vendor: 9,846 bytes, lines 1-2
1import{c as Gr,g as vu,_ as Nf}from"./index-Cafi_b61.js";import{t as Ge}from"./browser-BMQZ0fw5.js";var bs={exports:{}};(function(t,e){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Gr<"u"&&Gr,r=function(){function o(){this.fetch=!1,this.DOMException=n.DOMException}return o.prototype=n,new o}();(function(o){(function(s){var a=typeof o<"u"&&o||typeof self<"u"&&self||typeof Gr<"u"&&Gr||{},c={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function l(C){return C&&DataView.prototype.isPrototypeOf(C)}if(c.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(C){return C&&u.indexOf(Object.prototype.toString.call(C))>-1};function h(C){if(typeof C!="string"&&(C=String(C)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(C)||C==="")throw new TypeError('Invalid character in header field name: "'+C+'"');return C.toLowerCase()}function f(C){return typeof C!="string"&&(C=String(C)),C}function g(C){var L={next:function(){var $=C.shift();return{done:$===void 0,value:$}}};return c.iterable&&(L[Symbol.iterator]=function(){return L}),L}function m(C){this.map={},C instanceof m?C.forEach(function(L,$){this.append($,L)},this):Array.isArray(C)?C.forEach(function(L){if(L.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+L.length);this.append(L[0],L[1])},this):C&&Object.getOwnPropertyNames(C).forEach(function(L){this.append(L,C[L])},this)}m.prototype.append=function(C,L){C=h(C),L=f(L);var $=this.map[C];this.map[C]=$?$+", "+L:L},m.prototype.delete=function(C){delete this.map[h(C)]},m.prototype.get=function(C){return C=h(C),this.has(C)?this.map[C]:null},m.prototype.has=function(C){return this.map.hasOwnProperty(h(C))},m.prototype.set=function(C,L){this.map[h(C)]=f(L)},m.prototype.forEach=function(C,L){for(var $ in this.map)this.map.hasOwnProperty($)&&C.call(L,this.map[$],$,this)},m.prototype.keys=function(){var C=[];return this.forEach(function(L,$){C.push($)}),g(C)},m.prototype.values=function(){var C=[];return this.forEach(function(L){C.push(L)}),g(C)},m.prototype.entries=function(){var C=[];return this.forEach(function(L,$){C.push([$,L])}),g(C)},c.iterable&&(m.prototype[Symbol.iterator]=m.prototype.entries);function w(C){if(!C._noBody){if(C.bodyUsed)return Promise.reject(new TypeError("Already read"));C.bodyUsed=!0}}function p(C){return new Promise(function(L,$){C.onload=function(){L(C.result)},C.onerror=function(){$(C.error)}})}function k(C){var L=new FileReader,$=p(L);return L.readAsArrayBuffer(C),$}function _(C){var L=new FileReader,$=p(L),y=/charset=([A-Za-z0-9_-]+)/.exec(C.type),E=y?y[1]:"utf-8";return L.readAsText(C,E),$}function O(C){for(var L=new Uint8Array(C),$=new Array(L.length),y=0;y<L.length;y++)$[y]=String.fromCharCode(L[y]);return $.join("")}function N(C){if(C.slice)return C.slice(0);var L=new Uint8Array(C.byteLength);return L.set(new Uint8Array(C)),L.buffer}function U(){return this.bodyUsed=!1,this._initBody=function(C){this.bodyUsed=this.bodyUsed,this._bodyInit=C,C?typeof C=="string"?this._bodyText=C:c.blob&&Blob.prototype.isPrototypeOf(C)?this._bodyBlob=C:c.formData&&FormData.prototype.isPrototypeOf(C)?this._bodyFormData=C:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(C)?this._bodyText=C.toString():c.arrayBuffer&&c.blob&&l(C)?(this._bodyArrayBuffer=N(C.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(C)||d(C))?this._bodyArrayBuffer=N(C):this._bodyText=C=Object.prototype.toString.call(C):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof C=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(C)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var C=w(this);if(C)return C;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var C=w(this);return C||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(c.blob)return this.blob().then(k);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var C=w(this);if(C)return C;if(this._bodyBlob)return _(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(O(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(K)}),this.json=function(){return this.text().then(JSON.parse)},this}var W=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function V(C){var L=C.toUpperCase();return W.indexOf(L)>-1?L:C}function H(C,L){if(!(this instanceof H))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');L=L||{};var $=L.body;if(C instanceof H){if(C.bodyUsed)throw new TypeError("Already read");this.url=C.url,this.credentials=C.credentials,L.headers||(this.headers=new m(C.headers)),this.method=C.method,this.mode=C.mode,this.signal=C.signal,!$&&C._bodyInit!=null&&($=C._bodyInit,C.bodyUsed=!0)}else this.url=String(C);if(this.credentials=L.credentials||this.credentials||"same-origin",(L.headers||!this.headers)&&(this.headers=new m(L.headers)),this.method=V(L.method||this.method||"GET"),this.mode=L.mode||this.mode||null,this.signal=L.signal||this.signal||function(){if("AbortController"in a){var A=new AbortController;return A.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&$)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody($),(this.method==="GET"||this.method==="HEAD")&&(L.cache==="no-store"||L.cache==="no-cache")){var y=/([?&])_=[^&]*/;if(y.test(this.url))this.url=this.url.replace(y,"$1_="+new Date().getTime());else{var E=/\?/;this.url+=(E.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}H.prototype.clone=function(){return new H(this,{body:this._bodyInit})};function K(C){var L=new FormData;return C.trim().split("&").forEach(function($){if($){var y=$.split("="),E=y.shift().replace(/\+/g," "),A=y.join("=").replace(/\+/g," ");L.append(decodeURIComponent(E),decodeURIComponent(A))}}),L}function Y(C){var L=new m,$=C.replace(/\r?\n[\t ]+/g," ");return $.split("\r").map(function(y){return y.indexOf(` 2`)===0?y.substr(1,y.length):y}).forEach(function(y){var E=y.split(":"),A=E.shift().trim();if(A){var M=E.join(":").trim();try{L.append(A,M)}catch(b){console.warn("Response "+b.message)}}}),L}U.call(H.prototype);function j(C,L){if(!(this instanceof j))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(L||(L={}),this.type="default",this.status=L.status===void 0?200:L.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=L.statusText===void 0?"":""+L.statusText,this.headers=new m(L.headers),this.url=L.url||"",this._initBody(C)}U.call(j.prototype),j.prototype.clone=function(){return new j(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new m(this.headers),url:this.url})},j.error=function(){var C=new j(null,{status:200,statusText:""});return C.ok=!1,C.status=0,C.type="error",C};var B=[301,302,303,307,308];j.redirect=function(C,L){if(B.indexOf(L)===-1)throw new RangeError("Invalid status code");return new j(null,{status:L,headers:{location:C}})},s.DOMException=a.DOMException;try{new s.DOMException}catch{s.DOMException=function(L,$){this.message=L,this.name=$;var y=Error(L);this.stack=y.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function R(C,L){return new Promise(function($,y){var E=new H(C,L);if(E.signal&&E.signal.aborted)return y(new s.DOMException("Aborted","AbortError"));var A=new XMLHttpRequest;function M(){A.abort()}A.onload=function(){var S={statusText:A.statusText,headers:Y(A.getAllResponseHeaders()||"")};E.url.indexOf("file://")===0&&(A.status<200||A.status>599)?S.status=200:S.status=A.status,S.url="responseURL"in A?A.responseURL:S.headers.get("X-Request-URL");var x="response"in A?A.response:A.responseText;setTimeout(function(){$(new j(x,S))},0)},A.onerror=function(){setTimeout(function(){y(new TypeError("Network request failed"))},0)},A.ontimeout=function(){setTimeout(function(){y(new TypeError("Network request timed out"))},0)},A.onabort=function(){setTimeout(function(){y(new s.DOMException("Aborted","AbortError"))},0)};function b(S){try{return S===""&&a.location.href?a.location.href:S}catch{return S}}if(A.open(E.method,b(E.url),!0),E.credentials==="include"?A.withCredentials=!0:E.credentials==="omit"&&(A.withCredentials=!1),"responseType"in A&&(c.blob?A.responseType="blob":c.arrayBuffer&&(A.responseType="arraybuffer")),L&&typeof L.headers=="object"&&!(L.headers instanceof m||a.Headers&&L.headers instanceof a.Headers)){var v=[];
2Object.getOwnPropertyNames(L.headers).forEach(function(S){v.push(h(S)),A.setRequestHeader(S,f(L.headers[S]))}),E.headers.forEach(function(S,x){v.indexOf(x)===-1&&A.setRequestHeader(x,S)})}else E.headers.forEach(function(S,x){A.setRequestHeader(x,S)});E.signal&&(E.signal.addEventListener("abort",M),A.onreadystatechange=function(){A.readyState===4&&E.signal.removeEventListener("abort",M)}),A.send(typeof E._bodyInit>"u"?null:E._bodyInit)})}return R.polyfill=!0,a.fetch||(a.fetch=R,a.Headers=m,a.Request=H,a.Response=j),s.Headers=m,s.Request=H,s.Response=j,s.fetch=R,s})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=n.fetch?n:r;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(bs,bs.exports);var Bf=bs.exports;const bu=vu(Bf);var wu={exports:{}};/*! 3 * EventEmitter2 4 * https://github.com/hij1nx/EventEmitter2 5 * 6 * Copyright (c) 2013 hij1nx 7 * Licensed under the MIT license. 8 */(function(t,e){(function(n){var r=Object.hasOwnProperty,i=Array.isArray?Array.isArray:function(E){return Object.prototype.toString.call(E)==="[object Array]"},o=10,s=typeof process=="object"&&typeof process.nextTick=="function",a=typeof Symbol=="function",c=typeof Reflect=="object",l=typeof setImmediate=="function",u=l?setImmediate:setTimeout,d=a?c&&typeof Reflect.ownKeys=="function"?Reflect.ownKeys:function(y){var E=Object.getOwnPropertyNames(y);return E.push.apply(E,Object.getOwnPropertySymbols(y)),E}:Object.keys;function h(){this._events={},this._conf&&f.call(this,this._conf)}function f(y){y&&(this._conf=y,y.delimiter&&(this.delimiter=y.delimiter),y.maxListeners!==n&&(this._maxListeners=y.maxListeners),y.wildcard&&(this.wildcard=y.wildcard),y.newListener&&(this._newListener=y.newListener),y.removeListener&&(this._removeListener=y.removeListener),y.verboseMemoryLeak&&(this.verboseMemoryLeak=y.verboseMemoryLeak),y.ignoreErrors&&(this.ignoreErrors=y.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function g(y,E){var A="(node) warning: possible EventEmitter memory leak detected. "+y+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(A+=" Event name: "+E+"."),typeof process<"u"&&process.emitWarning){var M=new Error(A);M.name="MaxListenersExceededWarning",M.emitter=this,M.count=y,process.emitWarning(M)}else console.error(A),console.trace&&console.trace()}var m=function(y,E,A){var M=arguments.length;switch(M){case 0:return[];case 1:return[y];case 2:return[y,E];case 3:return[y,E,A];default:for(var b=new Array(M);M--;)b[M]=arguments[M];return b}};function w(y,E){for(var A={},M,b=y.length,v=0,S=0;S<b;S++)M=y[S],A[M]=S<v?E[S]:n;return A}function p(y,E,A){this._emitter=y,this._target=E,this._listeners={},this._listenersCount=0;var M,b;if((A.on||A.off)&&(M=A.on,b=A.off),E.addEventListener?(M=E.addEventListener,b=E.removeEventListener):E.addListener?(M=E.addListener,b=E.removeListener):E.on&&(M=E.on,b=E.off),!M&&!b)throw Error("target does not implement any known event API");if(typeof M!="function")throw TypeError("on method must be a function");if(typeof b!="function")throw TypeError("off method must be a function");this._on=M,this._off=b;var v=y._observers;v?v.push(this):y._observers=[this]}Object.assign(p.prototype,{subscribe:function(y,E,A){var M=this,b=this._target,v=this._emitter,S=this._listeners,x=function(){var T=m.apply(null,arguments),I={data:T,name:E,original:y};if(A){var D=A.call(b,I);D!==!1&&v.emit.apply(v,[I.name].concat(T));return}v.emit.apply(v,[E].concat(T))};if(S[y])throw Error("Event '"+y+"' is already listening");this._listenersCount++,v._newListener&&v._removeListener&&!M._onNewListener?(this._onNewListener=function(T){T===E&&S[y]===null&&(S[y]=x,M._on.call(b,y,x))},v.on("newListener",this._onNewListener),this._onRemoveListener=function(T){T===E&&!v.hasListeners(T)&&S[y]&&(S[y]=null,M._off.call(b,y,x))},S[y]=null,v.on("removeListener",this._onRemoveListener)):(S[y]=x,M._on.call(b,y,x))},unsubscribe:function(y){var E=this,A=this._listeners,M=this._emitter,b,v,S=this._off,x=this._target,T;if(y&&typeof y!="string")throw TypeError("event must be a string");function I(){E._onNewListener&&(M.off("newListener",E._onNewListener),M.off("removeListener",E._onRemoveListener),E._onNewListener=null,E._onRemoveListener=null);var D=V.call(M,E);M._observers.splice(D,1)}if(y){if(b=A[y],!b)return;S.call(x,y,b),delete A[y],--this._listenersCount||I()}else{for(v=d(A),T=v.length;T-- >0;)y=v[T],S.call(x,y,A[y]);this._listeners={},this._listenersCount=0,I()}}});function k(y,E,A,M){var b=Object.assign({},E);if(!y)return b;if(typeof y!="object")throw TypeError("options must be an object");var v=Object.keys(y),S=v.length,x,T,I;function D(z){throw Error('Invalid "'+x+'" option value'+(z?". Reason: "+z:""))}for(var F=0;F<S;F++){if(x=v[F],!r.call(E,x))throw Error('Unknown "'+x+'" option');
8T=y[x],T!==n&&(I=A[x],b[x]=I?I(T,D):T)}return b}function _(y,E){return(typeof y!="function"||!y.hasOwnProperty("prototype"))&&E("value must be a constructor"),y}function O(y){var E="value must be type of "+y.join("|"),A=y.length,M=y[0],b=y[1];return A===1?function(v,S){if(typeof v===M)return v;S(E)}:A===2?function(v,S){var x=typeof v;if(x===M||x===b)return v;S(E)}:function(v,S){for(var x=typeof v,T=A;T-- >0;)if(x===y[T])return v;S(E)}}var N=O(["function"]),U=O(["object","function"]);function W(y,E,A){var M,b,v=0,S,x=new y(function(T,I,D){A=k(A,{timeout:0,overload:!1},{timeout:function(Q,ne){return Q*=1,(typeof Q!="number"||Q<0||!Number.isFinite(Q))&&ne("timeout must be a positive number"),Q}}),M=!A.overload&&typeof y.prototype.cancel=="function"&&typeof D=="function";function F(){b&&(b=null),v&&(clearTimeout(v),v=0)}var z=function(Q){F(),T(Q)},Z=function(Q){F(),I(Q)};M?E(z,Z,D):(b=[function(Q){Z(Q||Error("canceled"))}],E(z,Z,function(Q){if(S)throw Error("Unable to subscribe on cancel event asynchronously");if(typeof Q!="function")throw TypeError("onCancel callback must be a function");b.push(Q)}),S=!0),A.timeout>0&&(v=setTimeout(function(){var Q=Error("timeout");Q.code="ETIMEDOUT",v=0,x.cancel(Q),I(Q)},A.timeout))});return M||(x.cancel=function(T){if(b){for(var I=b.length,D=1;D<I;D++)b[D](T);b[0](T),b=null}}),x}function V(y){var E=this._observers;if(!E)return-1;for(var A=E.length,M=0;M<A;M++)if(E[M]._target===y)return M;return-1}function H(y,E,A,M,b){if(!A)return null;if(M===0){var v=typeof E;if(v==="string"){var S,x,T=0,I=0,D=this.delimiter,F=D.length;if((x=E.indexOf(D))!==-1){S=new Array(5);do S[T++]=E.slice(I,x),I=x+F;while((x=E.indexOf(D,I))!==-1);S[T++]=E.slice(I),E=S,b=T}else E=[E],b=1}else v==="object"?b=E.length:(E=[E],b=1)}var z=null,Z,Q,ne,se,le,re=E[M],ie=E[M+1],ce,ae;if(M===b)A._listeners&&(typeof A._listeners=="function"?(y&&y.push(A._listeners),z=[A]):(y&&y.push.apply(y,A._listeners),z=[A]));else if(re==="*"){for(ce=d(A),x=ce.length;x-- >0;)Z=ce[x],Z!=="_listeners"&&(ae=H(y,E,A[Z],M+1,b),ae&&(z?z.push.apply(z,ae):z=ae));return z}else if(re==="**"){for(le=M+1===b||M+2===b&&ie==="*",le&&A._listeners&&(z=H(y,E,A,b,b)),ce=d(A),x=ce.length;x-- >0;)Z=ce[x],Z!=="_listeners"&&(Z==="*"||Z==="**"?(A[Z]._listeners&&!le&&(ae=H(y,E,A[Z],b,b),ae&&(z?z.push.apply(z,ae):z=ae)),ae=H(y,E,A[Z],M,b)):Z===ie?ae=H(y,E,A[Z],M+2,b):ae=H(y,E,A[Z],M,b),ae&&(z?z.push.apply(z,ae):z=ae));return z}else A[re]&&(z=H(y,E,A[re],M+1,b));if(Q=A["*"],Q&&H(y,E,Q,M+1,b),ne=A["**"],ne)if(M<b)for(ne._listeners&&H(y,E,ne,b,b),ce=d(ne),x=ce.length;x-- >0;)Z=ce[x],Z!=="_listeners"&&(Z===ie?H(y,E,ne[Z],M+2,b):Z===re?H(y,E,ne[Z],M+1,b):(se={},se[Z]=ne[Z],H(y,E,{"**":se},M+1,b)));else ne._listeners?H(y,E,ne,b,b):ne["*"]&&ne["*"]._listeners&&H(y,E,ne["*"],b,b);return z}function K(y,E,A){var M=0,b=0,v,S=this.delimiter,x=S.length,T;if(typeof y=="string")if((v=y.indexOf(S))!==-1){T=new Array(5);do T[M++]=y.slice(b,v),b=v+x;while((v=y.indexOf(S,b))!==-1);T[M++]=y.slice(b)}else T=[y],M=1;else T=y,M=y.length;if(M>1){for(v=0;v+1<M;v++)if(T[v]==="**"&&T[v+1]==="**")return}var I=this.listenerTree,D;for(v=0;v<M;v++)if(D=T[v],I=I[D]||(I[D]={}),v===M-1)return I._listeners?(typeof I._listeners=="function"&&(I._listeners=[I._listeners]),A?I._listeners.unshift(E):I._listeners.push(E),!I._listeners.warned&&this._maxListeners>0&&I._listeners.length>this._maxListeners&&(I._listeners.warned=!0,g.call(this,I._listeners.length,D))):I._listeners=E,!0;return!0}function Y(y,E,A,M){for(var b=d(y),v=b.length,S,x,T,I=y._listeners,D;v-- >0;)x=b[v],S=y[x],x==="_listeners"?T=A:T=A?A.concat(x):[x],D=M||typeof x=="symbol",I&&E.push(D?T:T.join(this.delimiter)),typeof S=="object"&&Y.call(this,S,E,T,D);return E}function j(y){for(var E=d(y),A=E.length,M,b,v;A-- >0;)b=E[A],M=y[b],M&&(v=!0,b!=="_listeners"&&!j(M)&&delete y[b]);return v}function B(y,E,A){this.emitter=y,this.event=E,this.listener=A}B.prototype.off=function(){return this.emitter.off(this.event,this.listener),this};function R(y,E,A){if(A===!0)b=!0;else if(A===!1)M=!0;else{if(!A||typeof A!="object")throw TypeError("options should be an object or true");var M=A.async,b=A.promisify,v=A.nextTick,S=A.objectify}if(M||v||b){var x=E,T=E._origin||E;if(v&&!s)throw Error("process.nextTick is not supported");b===n&&(b=E.constructor.name==="AsyncFunction"),E=function(){var I=arguments,D=this,F=this.event;return b?v?Promise.resolve():new Promise(function(z){u(z)}).then(function(){return D.event=F,x.apply(D,I)}):(v?process.nextTick:u)(function(){D.event=F,x.apply(D,I)})},E._async=!0,E._origin=T}return[E,S?new B(this,y,E):this]}function C(y){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,f.call(this,y)}C.EventEmitter2=C,C.prototype.listenTo=function(y,E,A){if(typeof y!="object")throw TypeError("target musts be an object");var M=this;A=k(A,{on:n,off:n,reducers:n},{on:N,off:N,reducers:U});function b(v){if(typeof v!="object")throw TypeError("events must be an object");var S=A.reducers,x=V.call(M,y),T;x===-1?T=new p(M,y,A):T=M._observers[x];for(var I=d(v),D=I.length,F,z=typeof S=="function",Z=0;Z<D;Z++)F=I[Z],T.subscribe(F,v[F]||F,z?S:S&&S[F])}return i(E)?b(w(E)):b(typeof E=="string"?w(E.split(/\s+/)):E),this},C.prototype.stopListeningTo=function(y,E){var A=this._observers;if(!A)return!1;var M=A.length,b,v=!1;if(y&&typeof y!="object")throw TypeError("target should be an object");for(;M-- >0;)b=A[M],(!y||b._target===y)&&(b.unsubscribe(E),v=!0);return v},C.prototype.delimiter=".",C.prototype.setMaxListeners=function(y){y!==n&&(this._maxListeners=y,this._conf||(this._conf={}),this._conf.maxListeners=y)},C.prototype.getMaxListeners=function(){return this._maxListeners},C.prototype.event="",C.prototype.once=function(y,E,A){return this._once(y,E,!1,A)},C.prototype.prependOnceListener=function(y,E,A){return this._once(y,E,!0,A)},C.prototype._once=function(y,E,A,M){return this._many(y,1,E,A,M)},C.prototype.many=function(y,E,A,M){return this._many(y,E,A,!1,M)}
8,C.prototype.prependMany=function(y,E,A,M){return this._many(y,E,A,!0,M)},C.prototype._many=function(y,E,A,M,b){var v=this;if(typeof A!="function")throw new Error("many only accepts instances of Function");function S(){return--E===0&&v.off(y,S),A.apply(this,arguments)}return S._origin=A,this._on(y,S,M,b)},C.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||h.call(this);var y=arguments[0],E,A=this.wildcard,M,b,v,S,x;if(y==="newListener"&&!this._newListener&&!this._events.newListener)return!1;if(A&&(E=y,y!=="newListener"&&y!=="removeListener"&&typeof y=="object")){if(b=y.length,a){for(v=0;v<b;v++)if(typeof y[v]=="symbol"){x=!0;break}}x||(y=y.join(this.delimiter))}var T=arguments.length,I;if(this._all&&this._all.length)for(I=this._all.slice(),v=0,b=I.length;v<b;v++)switch(this.event=y,T){case 1:I[v].call(this,y);break;case 2:I[v].call(this,y,arguments[1]);break;case 3:I[v].call(this,y,arguments[1],arguments[2]);break;default:I[v].apply(this,arguments)}if(A)I=[],H.call(this,I,E,this.listenerTree,0,b);else if(I=this._events[y],typeof I=="function"){switch(this.event=y,T){case 1:I.call(this);break;case 2:I.call(this,arguments[1]);break;case 3:I.call(this,arguments[1],arguments[2]);break;default:for(M=new Array(T-1),S=1;S<T;S++)M[S-1]=arguments[S];I.apply(this,M)}return!0}else I&&(I=I.slice());if(I&&I.length){if(T>3)for(M=new Array(T-1),S=1;S<T;S++)M[S-1]=arguments[S];for(v=0,b=I.length;v<b;v++)switch(this.event=y,T){case 1:I[v].call(this);break;case 2:I[v].call(this,arguments[1]);break;case 3:I[v].call(this,arguments[1],arguments[2]);break;default:I[v].apply(this,M)}return!0}else if(!this.ignoreErrors&&!this._all&&y==="error")throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},C.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||h.call(this);var y=arguments[0],E=this.wildcard,A,M,b,v,S,x;if(y==="newListener"&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(E&&(A=y,y!=="newListener"&&y!=="removeListener"&&typeof y=="object")){if(v=y.length,a){for(S=0;S<v;S++)if(typeof y[S]=="symbol"){M=!0;break}}M||(y=y.join(this.delimiter))}var T=[],I=arguments.length,D;if(this._all)for(S=0,v=this._all.length;S<v;S++)switch(this.event=y,I){case 1:T.push(this._all[S].call(this,y));break;case 2:T.push(this._all[S].call(this,y,arguments[1]));break;case 3:T.push(this._all[S].call(this,y,arguments[1],arguments[2]));break;default:T.push(this._all[S].apply(this,arguments))}if(E?(D=[],H.call(this,D,A,this.listenerTree,0)):D=this._events[y],typeof D=="function")switch(this.event=y,I){case 1:T.push(D.call(this));break;case 2:T.push(D.call(this,arguments[1]));break;case 3:T.push(D.call(this,arguments[1],arguments[2]));break;default:for(b=new Array(I-1),x=1;x<I;x++)b[x-1]=arguments[x];T.push(D.apply(this,b))}else if(D&&D.length){if(D=D.slice(),I>3)for(b=new Array(I-1),x=1;x<I;x++)b[x-1]=arguments[x];for(S=0,v=D.length;S<v;S++)switch(this.event=y,I){case 1:T.push(D[S].call(this));break;case 2:T.push(D[S].call(this,arguments[1]));break;case 3:T.push(D[S].call(this,arguments[1],arguments[2]));break;default:T.push(D[S].apply(this,b))}}else if(!this.ignoreErrors&&!this._all&&y==="error")return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(T)},C.prototype.on=function(y,E,A){return this._on(y,E,!1,A)},C.prototype.prependListener=function(y,E,A){return this._on(y,E,!0,A)},C.prototype.onAny=function(y){return this._onAny(y,!1)},C.prototype.prependAny=function(y){return this._onAny(y,!0)},C.prototype.addListener=C.prototype.on,C.prototype._onAny=function(y,E){if(typeof y!="function")throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),E?this._all.unshift(y):this._all.push(y),this},C.prototype._on=function(y,E,A,M){if(typeof y=="function")return this._onAny(y,E),this;if(typeof E!="function")throw new Error("on only accepts instances of Function");this._events||h.call(this);var b=this,v;return M!==n&&(v=R.call(this,y,E,M),E=v[0],b=v[1]),this._newListener&&this.emit
8("newListener",y,E),this.wildcard?(K.call(this,y,E,A),b):(this._events[y]?(typeof this._events[y]=="function"&&(this._events[y]=[this._events[y]]),A?this._events[y].unshift(E):this._events[y].push(E),!this._events[y].warned&&this._maxListeners>0&&this._events[y].length>this._maxListeners&&(this._events[y].warned=!0,g.call(this,this._events[y].length,y))):this._events[y]=E,b)},C.prototype.off=function(y,E){if(typeof E!="function")throw new Error("removeListener only takes instances of Function");var A,M=[];if(this.wildcard){var b=typeof y=="string"?y.split(this.delimiter):y.slice();if(M=H.call(this,null,b,this.listenerTree,0),!M)return this}else{if(!this._events[y])return this;A=this._events[y],M.push({_listeners:A})}for(var v=0;v<M.length;v++){var S=M[v];if(A=S._listeners,i(A)){for(var x=-1,T=0,I=A.length;T<I;T++)if(A[T]===E||A[T].listener&&A[T].listener===E||A[T]._origin&&A[T]._origin===E){x=T;break}if(x<0)continue;return this.wildcard?S._listeners.splice(x,1):this._events[y].splice(x,1),A.length===0&&(this.wildcard?delete S._listeners:delete this._events[y]),this._removeListener&&this.emit("removeListener",y,E),this}else(A===E||A.listener&&A.listener===E||A._origin&&A._origin===E)&&(this.wildcard?delete S._listeners:delete this._events[y],this._removeListener&&this.emit("removeListener",y,E))}return this.listenerTree&&j(this.listenerTree),this},C.prototype.offAny=function(y){var E=0,A=0,M;if(y&&this._all&&this._all.length>0){for(M=this._all,E=0,A=M.length;E<A;E++)if(y===M[E])return M.splice(E,1),this._removeListener&&this.emit("removeListenerAny",y),this}else{if(M=this._all,this._removeListener)for(E=0,A=M.length;E<A;E++)this.emit("removeListenerAny",M[E]);this._all=[]}return this},C.prototype.removeListener=C.prototype.off,C.prototype.removeAllListeners=function(y){if(y===n)return!this._events||h.call(this),this;if(this.wildcard){var E=H.call(this,null,y,this.listenerTree,0),A,M;if(!E)return this;for(M=0;M<E.length;M++)A=E[M],A._listeners=null;this.listenerTree&&j(this.listenerTree)}else this._events&&(this._events[y]=null);return this},C.prototype.listeners=function(y){var E=this._events,A,M,b,v,S;if(y===n){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!E)return[];for(A=d(E),v=A.length,b=[];v-- >0;)M=E[A[v]],typeof M=="function"?b.push(M):b.push.apply(b,M);return b}else{if(this.wildcard){if(S=this.listenerTree,!S)return[];var x=[],T=typeof y=="string"?y.split(this.delimiter):y.slice();return H.call(this,x,T,S,0),x}return E?(M=E[y],M?typeof M=="function"?[M]:M:[]):[]}},C.prototype.eventNames=function(y){var E=this._events;return this.wildcard?Y.call(this,this.listenerTree,[],null,y):E?d(E):[]},C.prototype.listenerCount=function(y){return this.listeners(y).length},C.prototype.hasListeners=function(y){if(this.wildcard){var E=[],A=typeof y=="string"?y.split(this.delimiter):y.slice();return H.call(this,E,A,this.listenerTree,0),E.length>0}var M=this._events,b=this._all;return!!(b&&b.length||M&&(y===n?d(M).length:M[y]))},C.prototype.listenersAny=function(){return this._all?this._all:[]},C.prototype.waitFor=function(y,E){var A=this,M=typeof E;return M==="number"?E={timeout:E}:M==="function"&&(E={filter:E}),E=k(E,{timeout:0,filter:n,handleError:!1,Promise,overload:!1},{filter:N,Promise:_}),W(E.Promise,function(b,v,S){function x(){var T=E.filter;if(!(T&&!T.apply(A,arguments)))if(A.off(y,x),E.handleError){var I=arguments[0];I?v(I):b(m.apply(null,arguments).slice(1))}else b(m.apply(null,arguments))}S(function(){A.off(y,x)}),A._on(y,x,!1)},{timeout:E.timeout,overload:E.overload})};function L(y,E,A){A=k(A,{Promise,timeout:0,overload:!1},{Promise:_});var M=A.Promise;return W(M,function(b,v,S){var x;if(typeof y.addEventListener=="function"){x=function(){b(m.apply(null,arguments))},S(function(){y.removeEventListener(E,x)}),y.addEventListener(E,x,{once:!0});return}var T=function(){I&&y.removeListener("error",I),b(m.apply(null,arguments))},I;E!=="error"&&(I=function(D){y.removeListener(E,T),v(D)},y.once("error",I)),S(function(){I&&y.removeListener("error",I),y.removeListener(E,T)}),y.once(E,T)},{timeout:A.timeout,overload:A.overload})}var $=C.prototype;Object.defineProperties(C,{defaultMaxListeners:{get:function(){return $._maxListeners},set:function(y){if(typeof y!="number"||y<0||Number.isNaN(y))throw TypeError("n must be a non-negative number");$._maxListeners=y},enumerable:!0},once:{value:L,writable:!0,configurable:!0}}),Object.defineProperties($,{_maxListeners:{value:o,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),t.exports=C})()})(wu);var po=wu.exports;const Df=vu(po);
8var Yr,$f=new Uint8Array(16);function jf(){if(!Yr&&(Yr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Yr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Yr($f)}const Kf=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function ws(t){return typeof t=="string"&&Kf.test(t)}var De=[];for(var To=0;To<256;++To)De.push((To+256).toString(16).substr(1));function Uf(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(De[t[e+0]]+De[t[e+1]]+De[t[e+2]]+De[t[e+3]]+"-"+De[t[e+4]]+De[t[e+5]]+"-"+De[t[e+6]]+De[t[e+7]]+"-"+De[t[e+8]]+De[t[e+9]]+"-"+De[t[e+10]]+De[t[e+11]]+De[t[e+12]]+De[t[e+13]]+De[t[e+14]]+De[t[e+15]]).toLowerCase();if(!ws(n))throw TypeError("Stringified UUID is invalid");return n}function ia(t,e,n){t=t||{};var r=t.random||(t.rng||jf)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Uf(r)}const $t=Object.create(null);$t.open="0";$t.close="1";$t.ping="2";$t.pong="3";$t.message="4";$t.upgrade="5";$t.noop="6";const bi=Object.create(null);Object.keys($t).forEach(t=>{bi[$t[t]]=t});const Es={type:"error",data:"parser error"},Eu=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",_u=typeof ArrayBuffer=="function",Cu=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,oa=({type:t,data:e},n,r)=>Eu&&e instanceof Blob?n?r(e):Za(e,r):_u&&(e instanceof ArrayBuffer||Cu(e))?n?r(e):Za(new Blob([e]),r):r($t[t]+(e||"")),Za=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function Ja(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let Ro;function Hf(t,e){if(Eu&&t.data instanceof Blob)return t.data.arrayBuffer().then(Ja).then(e);if(_u&&(t.data instanceof ArrayBuffer||Cu(t.data)))return e(Ja(t.data));oa(t,!1,n=>{Ro||(Ro=new TextEncoder),e(Ro.encode(n))})}const Xa="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",yr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<Xa.length;t++)yr[Xa.charCodeAt(t)]=t;const Ff=t=>{let e=t.length*.75,n=t.length,r,i=0,o,s,a,c;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const l=new ArrayBuffer(e),u=new Uint8Array(l);for(r=0;r<n;r+=4)o=yr[t.charCodeAt(r)],s=yr[t.charCodeAt(r+1)],a=yr[t.charCodeAt(r+2)],c=yr[t.charCodeAt(r+3)],u[i++]=o<<2|s>>4,u[i++]=(s&15)<<4|a>>2,u[i++]=(a&3)<<6|c&63;return l},zf=typeof ArrayBuffer=="function",sa=(t,e)=>{if(typeof t!="string")return{type:"message",data:Su(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:qf(t.substring(1),e)}:bi[n]?t.length>1?{type:bi[n],data:t.substring(1)}:{type:bi[n]}:Es},qf=(t,e)=>{if(zf){const n=Ff(t);return Su(n,e)}else return{base64:!0,data:t}},Su=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},ku="�",Vf=(t,e)=>{const n=t.length,r=new Array(n);let i=0;t.forEach((o,s)=>{oa(o,!1,a=>{r[s]=a,++i===n&&e(r.join(ku))})})},Wf=(t,e)=>{const n=t.split(ku),r=[];for(let i=0;i<n.length;i++){const o=sa(n[i],e);if(r.push(o),o.type==="error")break}return r};function Gf(){return new TransformStream({transform(t,e){Hf(t,n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(n)})}})}let Oo;function Zr(t){return t.reduce((e,n)=>e+n.length,0)}function Jr(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let i=0;i<e;i++)n[i]=t[0][r++],r===t[0].length&&(t.shift(),r=0);return t.length&&r<t[0].length&&(t[0]=t[0].slice(r)),n}function Yf(t,e){Oo||(Oo=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(s,a){for(n.push(s);;){if(r===0){if(Zr(n)<1)break;
vendor: 36,773 bytes, line 8
8const c=Jr(n,1);o=(c[0]&128)===128,i=c[0]&127,i<126?r=3:i===126?r=1:r=2}else if(r===1){if(Zr(n)<2)break;const c=Jr(n,2);i=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(Zr(n)<8)break;const c=Jr(n,8),l=new DataView(c.buffer,c.byteOffset,c.length),u=l.getUint32(0);if(u>Math.pow(2,21)-1){a.enqueue(Es);break}i=u*Math.pow(2,32)+l.getUint32(4),r=3}else{if(Zr(n)<i)break;const c=Jr(n,i);a.enqueue(sa(o?c:Oo.decode(c),e)),r=0}if(i===0||i>t){a.enqueue(Es);break}}}})}const xu=4;function Re(t){if(t)return Zf(t)}function Zf(t){for(var e in Re.prototype)t[e]=Re.prototype[e];return t}Re.prototype.on=Re.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};Re.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};Re.prototype.off=Re.prototype.removeListener=Re.prototype.removeAllListeners=Re.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===e||r.fn===e){n.splice(i,1);break}return n.length===0&&delete this._callbacks["$"+t],this};Re.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,e)}return this};Re.prototype.emitReserved=Re.prototype.emit;Re.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Re.prototype.hasListeners=function(t){return!!this.listeners(t).length};const go=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),mt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Jf="arraybuffer";function Au(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const Xf=mt.setTimeout,Qf=mt.clearTimeout;function mo(t,e){e.useNativeTimers?(t.setTimeoutFn=Xf.bind(mt),t.clearTimeoutFn=Qf.bind(mt)):(t.setTimeoutFn=mt.setTimeout.bind(mt),t.clearTimeoutFn=mt.clearTimeout.bind(mt))}const e0=1.33;function t0(t){return typeof t=="string"?n0(t):Math.ceil((t.byteLength||t.size)*e0)}function n0(t){let e=0,n=0;for(let r=0,i=t.length;r<i;r++)e=t.charCodeAt(r),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(r++,n+=4);return n}function Mu(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function r0(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function i0(t){let e={},n=t.split("&");for(let r=0,i=n.length;r<i;r++){let o=n[r].split("=");e[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return e}class o0 extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class aa extends Re{constructor(e){super(),this.writable=!1,mo(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,n,r){return super.emitReserved("error",new o0(e,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=sa(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=r0(e);return n.length?"?"+n:""}}class s0 extends aa{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const n=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};Wf(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Vf(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=Mu()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let Tu=!1;try{Tu=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const a0=Tu;function c0(){}class l0 extends s0{constructor(e){if(super(e),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}class Nt extends Re{constructor(e,n,r){super(),this.createRequest=e,mo(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var e;const n=Au(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=Nt.requestsCount++,Nt.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=c0,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Nt.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Nt.requestsCount=0;Nt.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Qa);else if(typeof addEventListener=="function"){const t="onpagehide"in mt?"pagehide":"unload";addEventListener(t,Qa,!1)}}function Qa(){for(let t in Nt.requests)Nt.requests.hasOwnProperty(t)&&Nt.requests[t].abort()}const u0=function(){const t=Ru({xdomain:!1});return t&&t.responseType!==null}();class d0 extends l0{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=u0&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Nt(Ru,this.uri(),e)}}function Ru(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||a0))return new XMLHttpRequest}catch{}if(!e)try{return new mt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Ou=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class h0 extends aa{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=Ou?{}:Au(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],i=n===e.length-1;oa(r,this.supportsBinary,o=>{try{this.doWrite(r,o)}catch{}i&&go(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=Mu()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const Lo=mt.WebSocket||mt.MozWebSocket;class f0 extends h0{createSocket(e,n,r){return Ou?new Lo(e,n,r):n?new Lo(e,n):new Lo(e)}doWrite(e,n){this.ws.send(n)}}class p0 extends aa{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const n=Yf(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),i=Gf();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const o=()=>{r.read().then(({done:a,value:c})=>{a||(this.onPacket(c),o())}).catch(a=>{})};o();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],i=n===e.length-1;this._writer.write(r).then(()=>{i&&go(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const g0={websocket:f0,webtransport:p0,polling:d0},m0=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,y0=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function _s(t){if(t.length>8e3)throw"URI too long";const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let i=m0.exec(t||""),o={},s=14;for(;s--;)o[y0[s]]=i[s]||"";return n!=-1&&r!=-1&&(o.source=e,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=v0(o,o.path),o.queryKey=b0(o,o.query),o}function v0(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function b0(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}const Cs=typeof addEventListener=="function"&&typeof removeEventListener=="function",wi=[];Cs&&addEventListener("offline",()=>{wi.forEach(t=>t())},!1);class vn extends Re{constructor(e,n){if(super(),this.binaryType=Jf,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(n=e,e=null),e){const r=_s(e);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=_s(n.host).host);mo(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const i=r.prototype.name;this.transports.push(i),this._transportsByName[i]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=i0(this.opts.query)),Cs&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},wi.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=xu,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&vn.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(e);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",vn.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=e.data,this._onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const i=this.writeBuffer[r].data;if(i&&(n+=t0(i)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,go(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,n,r){return this._sendPacket("message",e,n,r),this}send(e,n,r){return this._sendPacket("message",e,n,r),this}_sendPacket(e,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:e,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(vn.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Cs&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=wi.indexOf(this._offlineEventListener);r!==-1&&wi.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}vn.protocol=xu;class w0 extends vn{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let n=this.createTransport(e),r=!1;vn.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",d=>{if(!r)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;vn.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(u(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const h=new Error("probe error");h.transport=n.name,this.emitReserved("upgradeError",h)}}))};function o(){r||(r=!0,u(),n.close(),n=null)}const s=d=>{const h=new Error("probe error: "+d);h.transport=n.name,o(),this.emitReserved("upgradeError",h)};function a(){s("transport closed")}function c(){s("socket closed")}function l(d){n&&d.name!==n.name&&o()}const u=()=>{n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",a),this.off("close",c),this.off("upgrading",l)};n.once("open",i),n.once("error",s),n.once("close",a),this.once("close",c),this.once("upgrading",l),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const n=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&n.push(e[r]);return n}}let E0=class extends w0{constructor(e,n={}){const r=typeof e=="object"?e:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(i=>g0[i]).filter(i=>!!i)),super(e,r)}};function _0(t,e="",n){let r=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),r=_s(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const o=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+e,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}const C0=typeof ArrayBuffer=="function",S0=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,Lu=Object.prototype.toString,k0=typeof Blob=="function"||typeof Blob<"u"&&Lu.call(Blob)==="[object BlobConstructor]",x0=typeof File=="function"||typeof File<"u"&&Lu.call(File)==="[object FileConstructor]";function ca(t){return C0&&(t instanceof ArrayBuffer||S0(t))||k0&&t instanceof Blob||x0&&t instanceof File}function Ei(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(Ei(t[n]))return!0;return!1}if(ca(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return Ei(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&Ei(t[n]))return!0;return!1}function A0(t){const e=[],n=t.data,r=t;return r.data=Ss(n,e),r.attachments=e.length,{packet:r,buffers:e}}function Ss(t,e){if(!t)return t;if(ca(t)){const n={_placeholder:!0,num:e.length};return e.push(t),n}else if(Array.isArray(t)){const n=new Array(t.length);for(let r=0;r<t.length;r++)n[r]=Ss(t[r],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){const n={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=Ss(t[r],e));return n}return t}function M0(t,e){return t.data=ks(t.data,e),delete t.attachments,t}function ks(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]=ks(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=ks(t[n],e));return t}const T0=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],R0=5;var ye;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(ye||(ye={}));class O0{constructor(e){this.replacer=e}encode(e){return(e.type===ye.EVENT||e.type===ye.ACK)&&Ei(e)?this.encodeAsBinary({type:e.type===ye.EVENT?ye.BINARY_EVENT:ye.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===ye.BINARY_EVENT||e.type===ye.BINARY_ACK)&&(n+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(n+=e.nsp+","),e.id!=null&&(n+=e.id),e.data!=null&&(n+=JSON.stringify(e.data,this.replacer)),n}encodeAsBinary(e){const n=A0(e),r=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(r),i}}function ec(t){return Object.prototype.toString.call(t)==="[object Object]"}class la extends Re{constructor(e){super(),this.reviver=e}add(e){let n;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(e);const r=n.type===ye.BINARY_EVENT;r||n.type===ye.BINARY_ACK?(n.type=r?ye.EVENT:ye.ACK,this.reconstructor=new L0(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(ca(e)||e.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(e),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let n=0;const r={type:Number(e.charAt(0))};if(ye[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===ye.BINARY_EVENT||r.type===ye.BINARY_ACK){const o=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const s=e.substring(o,n);if(s!=Number(s)||e.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(s)}if(e.charAt(n+1)==="/"){const o=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););r.nsp=e.substring(o,n)}else r.nsp="/";const i=e.charAt(n+1);if(i!==""&&Number(i)==i){const o=n+1;for(;++n;){const s=e.charAt(n);if(s==null||Number(s)!=s){--n;break}if(n===e.length)break}r.id=Number(e.substring(o,n+1))}if(e.charAt(++n)){const o=this.tryParse(e.substr(n));if(la.isPayloadValid(r.type,o))r.data=o;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case ye.CONNECT:return ec(n);case ye.DISCONNECT:return n===void 0;case ye.CONNECT_ERROR:return typeof n=="string"||ec(n);case ye.EVENT:case ye.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&T0.indexOf(n[0])===-1);case ye.ACK:case ye.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class L0{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=M0(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const P0=Object.freeze(Object.defineProperty({__proto__:null,Decoder:la,Encoder:O0,get PacketType(){return ye},protocol:R0},Symbol.toStringTag,{value:"Module"}));function wt(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const I0=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Pu extends Re{constructor(e,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[wt(e,"open",this.onopen.bind(this)),wt(e,"packet",this.onpacket.bind(this)),wt(e,"error",this.onerror.bind(this)),wt(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){var r,i,o;if(I0.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const s={type:ye.EVENT,data:n};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const u=this.ids++,d=n.pop();this._registerAckCallback(u,d),s.id=u}const a=(i=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||i===void 0?void 0:i.writable,c=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!a||(c?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,n){var r;const i=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(i===void 0){this.acks[e]=n;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===e&&this.sendBuffer.splice(a,1);n.call(this,new Error("operation has timed out"))},i),s=(...a)=>{this.io.clearTimeoutFn(o),n.apply(this,a)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...n){return new Promise((r,i)=>{const o=(s,a)=>s?i(s):r(a);o.withError=!0,n.push(o),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...o)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:ye.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(r=>String(r.id)===e)){const r=this.acks[e];delete this.acks[e],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case ye.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ye.EVENT:case ye.BINARY_EVENT:this.onevent(e);break;case ye.ACK:case ye.BINARY_ACK:this.onack(e);break;case ye.DISCONNECT:this.ondisconnect();break;case ye.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:ye.ACK,id:e,data:i}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(delete this.acks[e.id],n.withError&&e.data.unshift(null),n.apply(this,e.data))}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ye.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,e.data)}}}function ar(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}ar.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=Math.floor(e*10)&1?t+n:t-n}return Math.min(t,this.max)|0};ar.prototype.reset=function(){this.attempts=0};ar.prototype.setMin=function(t){this.ms=t};ar.prototype.setMax=function(t){this.max=t};ar.prototype.setJitter=function(t){this.jitter=t};class xs extends Re{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,mo(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new ar({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const i=n.parser||P0;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new E0(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=wt(n,"open",function(){r.onopen(),e&&e()}),o=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),e?e(a):this.maybeReconnectOnOpen()},s=wt(n,"error",o);if(this._timeout!==!1){const a=this._timeout,c=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},a);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(i),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(wt(e,"ping",this.onping.bind(this)),wt(e,"data",this.ondata.bind(this)),wt(e,"error",this.onerror.bind(this)),wt(e,"close",this.onclose.bind(this)),wt(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){go(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new Pu(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;r<n.length;r++)this.engine.write(n[r],e.options)}
8cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const dr={};function _i(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=_0(t,e.path||"/socket.io"),r=n.source,i=n.id,o=n.path,s=dr[i]&&o in dr[i].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let c;return a?c=new xs(r,e):(dr[i]||(dr[i]=new xs(r,e)),c=dr[i]),n.query&&!e.query&&(e.query=n.queryKey),c.socket(n.path,e)}Object.assign(_i,{Manager:xs,Socket:Pu,io:_i,connect:_i});function X(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(l){try{c(r.next(l))}catch(u){o(u)}}function a(l){try{c(r.throw(l))}catch(u){o(u)}}function c(l){var u;l.done?i(l.value):(u=l.value,u instanceof n?u:new n(function(d){d(u)})).then(s,a)}c((r=r.apply(t,e||[])).next())})}var Ye=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},Mt=[],ft=[],N0=typeof Uint8Array<"u"?Uint8Array:Array,ua=!1;function Iu(){ua=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0;e<64;++e)Mt[e]=t[e],ft[t.charCodeAt(e)]=e;ft[45]=62,ft[95]=63}function B0(t,e,n){for(var r,i,o=[],s=e;s<n;s+=3)r=(t[s]<<16)+(t[s+1]<<8)+t[s+2],o.push(Mt[(i=r)>>18&63]+Mt[i>>12&63]+Mt[i>>6&63]+Mt[63&i]);return o.join("")}function tc(t){var e;ua||Iu();for(var n=t.length,r=n%3,i="",o=[],s=16383,a=0,c=n-r;a<c;a+=s)o.push(B0(t,a,a+s>c?c:a+s));return r===1?(e=t[n-1],i+=Mt[e>>2],i+=Mt[e<<4&63],i+="=="):r===2&&(e=(t[n-2]<<8)+t[n-1],i+=Mt[e>>10],i+=Mt[e>>4&63],i+=Mt[e<<2&63],i+="="),o.push(i),o.join("")}function Xr(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,l=c>>1,u=-7,d=n?i-1:0,h=n?-1:1,f=t[e+d];for(d+=h,o=f&(1<<-u)-1,f>>=-u,u+=a;u>0;o=256*o+t[e+d],d+=h,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+t[e+d],d+=h,u-=8);if(o===0)o=1-l;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=l}return(f?-1:1)*s*Math.pow(2,o-r)}function Nu(t,e,n,r,i,o){var s,a,c,l=8*o-i-1,u=(1<<l)-1,d=u>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,g=r?1:-1,m=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+d>=1?h/c:h*Math.pow(2,1-d))*c>=2&&(s++,c/=2),s+d>=u?(a=0,s=u):s+d>=1?(a=(e*c-1)*Math.pow(2,i),s+=d):(a=e*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;t[n+f]=255&a,f+=g,a/=256,i-=8);for(s=s<<i|a,l+=i;l>0;t[n+f]=255&s,f+=g,s/=256,l-=8);t[n+f-g]|=128*m}var D0={}.toString,Bu=Array.isArray||function(t){return D0.call(t)=="[object Array]"};J.TYPED_ARRAY_SUPPORT=Ye.TYPED_ARRAY_SUPPORT===void 0||Ye.TYPED_ARRAY_SUPPORT;var $0=Ki();function Ki(){return J.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Vt(t,e){if(Ki()<e)throw new RangeError("Invalid typed array length");return J.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=J.prototype:(t===null&&(t=new J(e)),t.length=e),t}function J(t,e,n){if(!(J.TYPED_ARRAY_SUPPORT||this instanceof J))return new J(t,e,n);if(typeof t=="number"){if(typeof e=="string")throw new Error("If encoding is specified then the first argument must be a string");return As(this,t)}return Du(this,t,e,n)}function Du(t,e,n,r){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?function(i,o,s,a){if(o.byteLength,s<0||o.byteLength<s)throw new RangeError("'offset' is out of bounds");if(o.byteLength<s+(a||0))throw new RangeError("'length' is out of bounds");return o=s===void 0&&a===void 0?new Uint8Array(o):a===void 0?new Uint8Array(o,s):new Uint8Array(o,s,a),J.TYPED_ARRAY_SUPPORT?(i=o).__proto__=J.prototype:i=Po(i,o),i}
vendor: 13,580 bytes, line 8
8(t,e,n,r):typeof e=="string"?function(i,o,s){if(typeof s=="string"&&s!==""||(s="utf8"),!J.isEncoding(s))throw new TypeError('"encoding" must be a valid string encoding');var a=0|ju(o,s);i=Vt(i,a);var c=i.write(o,s);return c!==a&&(i=i.slice(0,c)),i}(t,e,n):function(i,o){if(Tt(o)){var s=0|da(o.length);return(i=Vt(i,s)).length===0||o.copy(i,0,0,s),i}if(o){if(typeof ArrayBuffer<"u"&&o.buffer instanceof ArrayBuffer||"length"in o)return typeof o.length!="number"||(a=o.length)!=a?Vt(i,0):Po(i,o);if(o.type==="Buffer"&&Bu(o.data))return Po(i,o.data)}var a;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function $u(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function As(t,e){if($u(e),t=Vt(t,e<0?0:0|da(e)),!J.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function Po(t,e){var n=e.length<0?0:0|da(e.length);t=Vt(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function da(t){if(t>=Ki())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ki().toString(16)+" bytes");return 0|t}function Tt(t){return!(t==null||!t._isBuffer)}function ju(t,e){if(Tt(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var n=t.length;if(n===0)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Ui(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Fu(t).length;default:if(r)return Ui(t).length;e=(""+e).toLowerCase(),r=!0}}function j0(t,e,n){var r=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return G0(this,e,n);case"utf8":case"utf-8":return Uu(this,e,n);case"ascii":return V0(this,e,n);case"latin1":case"binary":return W0(this,e,n);case"base64":return q0(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Y0(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function Sn(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function nc(t,e,n,r,i){if(t.length===0)return-1;if(typeof n=="string"?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if(typeof e=="string"&&(e=J.from(e,r)),Tt(e))return e.length===0?-1:rc(t,e,n,r,i);if(typeof e=="number")return e&=255,J.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):rc(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function rc(t,e,n,r,i){var o,s=1,a=t.length,c=e.length;if(r!==void 0&&((r=String(r).toLowerCase())==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,n/=2}function l(f,g){return s===1?f[g]:f.readUInt16BE(g*s)}if(i){var u=-1;for(o=n;o<a;o++)if(l(t,o)===l(e,u===-1?0:o-u)){if(u===-1&&(u=o),o-u+1===c)return u*s}else u!==-1&&(o-=o-u),u=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){for(var d=!0,h=0;h<c;h++)if(l(t,o+h)!==l(e,h)){d=!1;break}if(d)return o}return-1}function K0(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[n+s]=a}return s}function U0(t,e,n,r){return yo(Ui(e,t.length-n),t,n,r)}function Ku(t,e,n,r){return yo(function(i){for(var o=[],s=0;s<i.length;++s)o.push(255&i.charCodeAt(s));return o}(e),t,n,r)}function H0(t,e,n,r){return Ku(t,e,n,r)}function F0(t,e,n,r){return yo(Fu(e),t,n,r)}function z0(t,e,n,r){return yo(function(i,o){for(var s,a,c,l=[],u=0;u<i.length&&!((o-=2)<0);++u)a=(s=i.charCodeAt(u))>>8,c=s%256,l.push(c),l.push(a);return l}(e,t.length-n),t,n,r)}function q0(t,e,n){return e===0&&n===t.length?tc(t):tc(t.slice(e,n))}function Uu(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,s,a,c,l=t[i],u=null,d=l>239?4:l>223?3:l>191?2:1;if(i+d<=n)switch(d){case 1:l<128&&(u=l);break;case 2:(192&(o=t[i+1]))==128&&(c=(31&l)<<6|63&o)>127&&(u=c);break;case 3:o=t[i+1],s=t[i+2],(192&o)==128&&(192&s)==128&&(c=(15&l)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],(192&o)==128&&(192&s)==128&&(192&a)==128&&(c=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(u=c)}u===null?(u=65533,d=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=d}return function(h){var f=h.length;if(f<=ic)return String.fromCharCode.apply(String,h);for(var g="",m=0;m<f;)g+=String.fromCharCode.apply(String,h.slice(m,m+=ic));return g}(r)}J.poolSize=8192,J._augment=function(t){return t.__proto__=J.prototype,t},J.from=function(t,e,n){return Du(null,t,e,n)},J.TYPED_ARRAY_SUPPORT&&(J.prototype.__proto__=Uint8Array.prototype,J.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&J[Symbol.species]),J.alloc=function(t,e,n){return function(r,i,o,s){return $u(i),i<=0?Vt(r,i):o!==void 0?typeof s=="string"?Vt(r,i).fill(o,s):Vt(r,i).fill(o):Vt(r,i)}(null,t,e,n)},J.allocUnsafe=function(t){return As(null,t)},J.allocUnsafeSlow=function(t){return As(null,t)},J.isBuffer=zu,J.compare=function(t,e){if(!Tt(t)||!Tt(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},J.isEncoding=function(t){switch(String(t).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}},J.concat=function(t,e){if(!Bu(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return J.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=J.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var o=t[n];if(!Tt(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},J.byteLength=ju,J.prototype._isBuffer=!0,J.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)Sn(this,e,e+1);return this},J.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)Sn(this,e,e+3),Sn(this,e+1,e+2);return this},J.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)Sn(this,e,e+7),Sn(this,e+1,e+6),Sn(this,e+2,e+5),Sn(this,e+3,e+4);return this},J.prototype.toString=function(){var t=0|this.length;return t===0?"":arguments.length===0?Uu(this,0,t):j0.apply(this,arguments)},J.prototype.equals=function(t){if(!Tt(t))throw new TypeError("Argument must be a Buffer");return this===t||J.compare(this,t)===0},J.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},J.prototype.compare=function(t,e,n,r,i){if(!Tt(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0),a=Math.min(o,s),c=this.slice(r,i),l=t.slice(e,n),u=0;u<a;++u)if(c[u]!==l[u]){o=c[u],s=l[u];break}return o<s?-1:s<o?1:0},J.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1},J.prototype.indexOf=function(t,e,n){return nc(this,t,e,n,!0)},J.prototype.lastIndexOf=function(t,e,n){return nc(this,t,e,n,!1)},J.prototype.write=function(t,e,n,r){if(e===void 0)r="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,r===void 0&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((n===void 0||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return K0(this,t,e,n);case"utf8":case"utf-8":return U0(this,t,e,n);case"ascii":return Ku(this,t,e,n);case"latin1":case"binary":return H0(this,t,e,n);case"base64":return F0(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z0(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},J.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ic=4096;function V0(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function W0(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function G0(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=J0(t[o]);return i}function Y0(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function Le(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function Ze(t,e,n,r,i,o){if(!Tt(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function Qr(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i<o;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function ei(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i<o;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function Hu(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function oc(t,e,n,r,i){return i||Hu(t,0,n,4),Nu(t,e,n,r,23,4),n+4}function sc(t,e,n,r,i){return i||Hu(t,0,n,8),Nu(t,e,n,r,52,8),n+8}J.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=e===void 0?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),J.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=J.prototype;else{var i=e-t;n=new J(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+t]}return n},J.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||Le(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},J.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||Le(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},J.prototype.readUInt8=function(t,e){return e||Le(t,1,this.length),this[t]},J.prototype.readUInt16LE=function(t,e){return e||Le(t,2,this.length),this[t]|this[t+1]<<8},J.prototype.readUInt16BE=function(t,e){return e||Le(t,2,this.length),this[t]<<8|this[t+1]},J.prototype.readUInt32LE=function(t,e){return e||Le(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},J.prototype.readUInt32BE=function(t,e){return e||Le(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},J.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||Le(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},J.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||Le(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},J.prototype.readInt8=function(t,e){return e||Le(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},J.prototype.readInt16LE=function(t,e){e||Le(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},J.prototype.readInt16BE=function(t,e){e||Le(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},J.prototype.readInt32LE=function(t,e){return e||Le(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},J.prototype.readInt32BE=function(t,e){return e||Le(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},J.prototype.readFloatLE=function(t,e){return e||Le(t,4,this.length),Xr(this,t,!0,23,4)},J.prototype.readFloatBE=function(t,e){return e||Le(t,4,this.length),Xr(this,t,!1,23,4)},J.prototype.readDoubleLE=function(t,e){return e||Le(t,8,this.length),Xr(this,t,!0,52,8)},J.prototype.readDoubleBE=function(t,e){return e||Le(t,8,this.length),Xr(this,t,!1,52,8)},J.prototype.writeUIntLE=function(t,e,n,r){t=+t,e|=0,n|=0,r||Ze(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},J.prototype.writeUIntBE=function(t,e,n,r){t=+t,e|=0,n|=0,r||Ze(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},J.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||Ze(this,t,e,1,255,0),J.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},J.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||Ze(this,t,e,2,65535,0),J.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):Qr(this,t,e,!0),e+2},J.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||Ze(this,t,e,2,65535,0),J.TYPED_ARRAY_SUPPORT?(this[e]=t>>>
88,this[e+1]=255&t):Qr(this,t,e,!1),e+2},J.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||Ze(this,t,e,4,4294967295,0),J.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):ei(this,t,e,!0),e+4},J.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||Ze(this,t,e,4,4294967295,0),J.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):ei(this,t,e,!1),e+4},J.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);Ze(this,t,e,n,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<n&&(s*=256);)t<0&&a===0&&this[e+o-1]!==0&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},J.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);Ze(this,t,e,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&a===0&&this[e+o+1]!==0&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},J.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||Ze(this,t,e,1,127,-128),J.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},J.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||Ze(this,t,e,2,32767,-32768),J.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):Qr(this,t,e,!0),e+2},J.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||Ze(this,t,e,2,32767,-32768),J.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):Qr(this,t,e,!1),e+2},J.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||Ze(this,t,e,4,2147483647,-2147483648),J.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):ei(this,t,e,!0),e+4},J.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||Ze(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),J.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):ei(this,t,e,!1),e+4},J.prototype.writeFloatLE=function(t,e,n){return oc(this,t,e,!0,n)},J.prototype.writeFloatBE=function(t,e,n){return oc(this,t,e,!1,n)},J.prototype.writeDoubleLE=function(t,e,n){return sc(this,t,e,!0,n)},J.prototype.writeDoubleBE=function(t,e,n){return sc(this,t,e,!1,n)},J.prototype.copy=function(t,e,n,r){if(n||(n=0),r||r===0||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,o=r-n;if(this===t&&n<e&&e<r)for(i=o-1;i>=0;--i)t[i+e]=this[i+n];else if(o<1e3||!J.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},J.prototype.fill=function(t,e,n,r){if(typeof t=="string"){if(typeof e=="string"?(r=e,e=0,n=this.length):typeof n=="string"&&(r=n,n=this.length),t.length===1){var i=t.charCodeAt(0);i<256&&(t=i)}if(r!==void 0&&typeof r!="string")throw new TypeError("encoding must be a string");if(typeof r=="string"&&!J.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else typeof t=="number"&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=n===void 0?this.length:n>>>0,t||(t=0),typeof t=="number")for(o=e;o<n;++o)this[o]=t;else{var s=Tt(t)?t:Ui(new J(t,r).toString()),a=s.length;for(o=0;o<n-e;++o)this[o+e]=s[o%a]}return this};var Z0=/[^+\/0-9A-Za-z-_]/g;function J0(t){return t<16?"0"+t.toString(16):t.toString(16)}function Ui(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],s=0;s<r;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Fu(t){return function(e){var n,r,i,o,s,a;ua||Iu();var c=e.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s=e[c-2]==="="?2:e[c-1]==="="?1:0,a=new N0(3*c/4-s),i=s>0?c-4:c;var l=0;for(n=0,r=0;n<i;n+=4,r+=3)o=ft[e.charCodeAt(n)]<<18|ft[e.charCodeAt(n+1)]<<12|ft[e.charCodeAt(n+2)]<<6|ft[e.charCodeAt(n+3)],a[l++]=o>>16&255,a[l++]=o>>8&255,a[l++]=255&o;return s===2?(o=ft[e.charCodeAt(n)]<<2|ft[e.charCodeAt(n+1)]>>4,a[l++]=255&o):s===1&&(o=ft[e.charCodeAt(n)]<<10|ft[e.charCodeAt(n+1)]<<4|ft[e.charCodeAt(n+2)]>>2,a[l++]=o>>8&255,a[l++]=255&o),a}(function(e){if((e=function(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}(e).replace(Z0,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(t))}function yo(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function zu(t){return t!=null&&(!!t._isBuffer||ac(t)||function(e){return typeof e.readFloatLE=="function"&&typeof e.slice=="function"&&ac(e.slice(0,0))}(t))}function ac(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}var X0=Object.freeze({__proto__:null,Buffer:J,INSPECT_MAX_BYTES:50,SlowBuffer:function(t){return+t!=t&&(t=0),J.alloc(+t)},isBuffer:zu,kMaxLength:$0}),yt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function vo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}
8function zr(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var Fn={},at={},He={};function Hi(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function qu(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function Vu(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function ha(t,...e){if(!Vu(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function Wu(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("hash must be wrapped by utils.wrapConstructor");Hi(t.outputLen),Hi(t.blockLen)}function Gu(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Yu(t,e){ha(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}Object.defineProperty(He,"__esModule",{value:!0}),He.isBytes=Vu,He.number=Hi,He.bool=qu,He.bytes=ha,He.hash=Wu,He.exists=Gu,He.output=Yu;const Q0={number:Hi,bool:qu,bytes:ha,hash:Wu,exists:Gu,output:Yu};He.default=Q0,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.wrapCipher=t.Hash=t.nextTick=t.isLE=t.createView=t.u32=t.u16=t.u8=void 0,t.bytesToHex=r,t.hexToBytes=s,t.hexToNumber=a,t.bytesToNumberBE=function(d){return a(r(d))},t.numberToBytesBE=function(d,h){return s(d.toString(16).padStart(2*h,"0"))},t.asyncLoop=async function(d,h,f){let g=Date.now();for(let m=0;m<d;m++){f(m);const w=Date.now()-g;w>=0&&w<h||(await(0,t.nextTick)(),g+=w)}},t.utf8ToBytes=c,t.bytesToUtf8=function(d){return new TextDecoder().decode(d)},t.toBytes=function(d){if(typeof d=="string")d=c(d);else{if(!(0,e.isBytes)(d))throw new Error("Uint8Array expected, got "+typeof d);d=u(d)}return d},t.concatBytes=function(...d){let h=0;for(let g=0;g<d.length;g++){const m=d[g];(0,e.bytes)(m),h+=m.length}const f=new Uint8Array(h);for(let g=0,m=0;g<d.length;g++){const w=d[g];f.set(w,m),m+=w.length}return f},t.checkOpts=function(d,h){if(h==null||typeof h!="object")throw new Error("options must be defined");return Object.assign(d,h)},t.equalBytes=function(d,h){if(d.length!==h.length)return!1;let f=0;for(let g=0;g<d.length;g++)f|=d[g]^h[g];return f===0},t.setBigUint64=l,t.u64Lengths=function(d,h){const f=new Uint8Array(16),g=(0,t.createView)(f);return l(g,0,BigInt(h?h.length:0),!0),l(g,8,BigInt(d.length),!0),f},t.isAligned32=function(d){return d.byteOffset%4==0},t.copyBytes=u,t.clean=function(...d){for(let h=0;h<d.length;h++)d[h].fill(0)};const e=He;if(t.u8=d=>new Uint8Array(d.buffer,d.byteOffset,d.byteLength),t.u16=d=>new Uint16Array(d.buffer,d.byteOffset,Math.floor(d.byteLength/2)),t.u32=d=>new Uint32Array(d.buffer,d.byteOffset,Math.floor(d.byteLength/4)),t.createView=d=>new DataView(d.buffer,d.byteOffset,d.byteLength),t.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,!t.isLE)throw new Error("Non little-endian hardware is not supported");const n=Array.from({length:256},(d,h)=>h.toString(16).padStart(2,"0"));function r(d){(0,e.bytes)(d);let h="";for(let f=0;f<d.length;f++)h+=n[d[f]];return h}const i={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function o(d){return d>=i._0&&d<=i._9?d-i._0:d>=i._A&&d<=i._F?d-(i._A-10):d>=i._a&&d<=i._f?d-(i._a-10):void 0}function s(d){if(typeof d!="string")throw new Error("hex string expected, got "+typeof d);const h=d.length,f=h/2;if(h%2)throw new Error("padded hex string expected, got unpadded hex of length "+h);const g=new Uint8Array(f);for(let m=0,w=0;m<f;m++,w+=2){const p=o(d.charCodeAt(w)),k=o(d.charCodeAt(w+1));if(p===void 0||k===void 0){const _=d[w]+d[w+1];throw new Error('hex string expected, got non-hex character "'+_+'" at index '+w)}g[m]=16*p+k}return g}
8function a(d){if(typeof d!="string")throw new Error("hex string expected, got "+typeof d);return BigInt(d===""?"0":`0x${d}`)}function c(d){if(typeof d!="string")throw new Error("string expected, got "+typeof d);return new Uint8Array(new TextEncoder().encode(d))}t.nextTick=async()=>{},t.Hash=class{};function l(d,h,f,g){if(typeof d.setBigUint64=="function")return d.setBigUint64(h,f,g);const m=BigInt(32),w=BigInt(4294967295),p=Number(f>>m&w),k=Number(f&w),_=g?4:0,O=g?0:4;d.setUint32(h+_,p,g),d.setUint32(h+O,k,g)}function u(d){return Uint8Array.from(d)}t.wrapCipher=(d,h)=>(Object.assign(h,d),h)}(at);var Rr={},Pe={};Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.AEAD_TAG_LENGTH=Pe.XCHACHA20_NONCE_LENGTH=Pe.CURVE25519_PUBLIC_KEY_SIZE=Pe.ETH_PUBLIC_KEY_SIZE=Pe.UNCOMPRESSED_PUBLIC_KEY_SIZE=Pe.COMPRESSED_PUBLIC_KEY_SIZE=Pe.SECRET_KEY_LENGTH=void 0,Pe.SECRET_KEY_LENGTH=32,Pe.COMPRESSED_PUBLIC_KEY_SIZE=33,Pe.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,Pe.ETH_PUBLIC_KEY_SIZE=64,Pe.CURVE25519_PUBLIC_KEY_SIZE=32,Pe.XCHACHA20_NONCE_LENGTH=24,Pe.AEAD_TAG_LENGTH=16,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ephemeralKeySize=t.symmetricNonceLength=t.symmetricAlgorithm=t.isHkdfKeyCompressed=t.isEphemeralKeyCompressed=t.ellipticCurve=t.ECIES_CONFIG=void 0;var e=Pe,n=function(){this.ellipticCurve="secp256k1",this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm="aes-256-gcm",this.symmetricNonceLength=16};t.ECIES_CONFIG=new n,t.ellipticCurve=function(){return t.ECIES_CONFIG.ellipticCurve},t.isEphemeralKeyCompressed=function(){return t.ECIES_CONFIG.isEphemeralKeyCompressed},t.isHkdfKeyCompressed=function(){return t.ECIES_CONFIG.isHkdfKeyCompressed},t.symmetricAlgorithm=function(){return t.ECIES_CONFIG.symmetricAlgorithm},t.symmetricNonceLength=function(){return t.ECIES_CONFIG.symmetricNonceLength},t.ephemeralKeySize=function(){var r={secp256k1:t.ECIES_CONFIG.isEphemeralKeyCompressed?e.COMPRESSED_PUBLIC_KEY_SIZE:e.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:e.CURVE25519_PUBLIC_KEY_SIZE,ed25519:e.CURVE25519_PUBLIC_KEY_SIZE};if(t.ECIES_CONFIG.ellipticCurve in r)return r[t.ECIES_CONFIG.ellipticCurve];throw new Error("Not implemented")}}(Rr);var Io={},Fi={},bo={},Zu={},fa={},ti={};Object.defineProperty(ti,"__esModule",{value:!0}),ti.crypto=void 0,ti.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.gcm=t.ctr=t.cbc=t.utils=void 0,t.randomBytes=i,t.getWebcryptoSubtle=o,t.managedNonce=function(c){return(0,n.number)(c.nonceLength),(l,...u)=>({encrypt(d,...h){const{nonceLength:f}=c,g=i(f),m=c(l,g,...u).encrypt(d,...h),w=(0,r.concatBytes)(g,m);return m.fill(0),w},decrypt(d,...h){const{nonceLength:f}=c,g=d.subarray(0,f),m=d.subarray(f);return c(l,g,...u).decrypt(m,...h)}})};const e=ti,n=He,r=at;function i(c=32){if(e.crypto&&typeof e.crypto.getRandomValues=="function")return e.crypto.getRandomValues(new Uint8Array(c));if(e.crypto&&typeof e.crypto.randomBytes=="function")return e.crypto.randomBytes(c);throw new Error("crypto.getRandomValues must be defined")}function o(){if(e.crypto&&typeof e.crypto.subtle=="object"&&e.crypto.subtle!=null)return e.crypto.subtle;throw new Error("crypto.subtle must be defined")}t.utils={async encrypt(c,l,u,d){const h=o(),f=await h.importKey("raw",c,l,!0,["encrypt"]),g=await h.encrypt(u,f,d);return new Uint8Array(g)},async decrypt(c,l,u,d){const h=o(),f=await h.importKey("raw",c,l,!0,["decrypt"]),g=await h.decrypt(u,f,d);return new Uint8Array(g)}};const s={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function a(c){return(l,u,d)=>{(0,n.bytes)(l),(0,n.bytes)(u);const h={name:c,length:8*l.length},f=function(g,m,w){if(g===s.CBC)return{name:s.CBC,iv:m};if(g===s.CTR)return{name:s.CTR,counter:m,length:64};if(g===s.GCM)return w?{name:s.GCM,iv:m,additionalData:w}:{name:s.GCM,iv:m};throw new Error("unknown aes block mode")}(c,u,d);return{encrypt:g=>((0,n.bytes)(g),t.utils.encrypt(l,h,f,g)),decrypt:g=>((0,n.bytes)(g),t.utils.decrypt(l,h,f,g))}}}t.cbc=a(s.CBC),t.ctr=a(s.CTR),t.gcm=a(s.GCM)}(fa);var Ju={},Ie={},Wt={},ot={};function zi(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function Xu(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function Qu(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function pa(t,...e){if(!Qu(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function ed(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");zi(t.outputLen),zi(t.blockLen)}function td(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}
8function nd(t,e){pa(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}Object.defineProperty(ot,"__esModule",{value:!0}),ot.isBytes=Qu,ot.number=zi,ot.bool=Xu,ot.bytes=pa,ot.hash=ed,ot.exists=td,ot.output=nd;const e1={number:zi,bool:Xu,bytes:pa,hash:ed,exists:td,output:nd};ot.default=e1;var Xt={},ni={};Object.defineProperty(ni,"__esModule",{value:!0}),ni.crypto=void 0,ni.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Hash=t.nextTick=t.byteSwapIfBE=t.byteSwap=t.isLE=t.rotl=t.rotr=t.createView=t.u32=t.u8=void 0,t.isBytes=function(l){return l instanceof Uint8Array||l!=null&&typeof l=="object"&&l.constructor.name==="Uint8Array"},t.byteSwap32=function(l){for(let u=0;u<l.length;u++)l[u]=(0,t.byteSwap)(l[u])},t.bytesToHex=function(l){(0,n.bytes)(l);let u="";for(let d=0;d<l.length;d++)u+=r[l[d]];return u},t.hexToBytes=function(l){if(typeof l!="string")throw new Error("hex string expected, got "+typeof l);const u=l.length,d=u/2;if(u%2)throw new Error("padded hex string expected, got unpadded hex of length "+u);const h=new Uint8Array(d);for(let f=0,g=0;f<d;f++,g+=2){const m=o(l.charCodeAt(g)),w=o(l.charCodeAt(g+1));if(m===void 0||w===void 0){const p=l[g]+l[g+1];throw new Error('hex string expected, got non-hex character "'+p+'" at index '+g)}h[f]=16*m+w}return h},t.asyncLoop=async function(l,u,d){let h=Date.now();for(let f=0;f<l;f++){d(f);const g=Date.now()-h;g>=0&&g<u||(await(0,t.nextTick)(),h+=g)}},t.utf8ToBytes=s,t.toBytes=a,t.concatBytes=function(...l){let u=0;for(let h=0;h<l.length;h++){const f=l[h];(0,n.bytes)(f),u+=f.length}const d=new Uint8Array(u);for(let h=0,f=0;h<l.length;h++){const g=l[h];d.set(g,f),f+=g.length}return d},t.checkOpts=function(l,u){if(u!==void 0&&c.call(u)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(l,u)},t.wrapConstructor=function(l){const u=h=>l().update(a(h)).digest(),d=l();return u.outputLen=d.outputLen,u.blockLen=d.blockLen,u.create=()=>l(),u},t.wrapConstructorWithOpts=function(l){const u=(h,f)=>l(f).update(a(h)).digest(),d=l({});return u.outputLen=d.outputLen,u.blockLen=d.blockLen,u.create=h=>l(h),u},t.wrapXOFConstructorWithOpts=function(l){const u=(h,f)=>l(f).update(a(h)).digest(),d=l({});return u.outputLen=d.outputLen,u.blockLen=d.blockLen,u.create=h=>l(h),u},t.randomBytes=function(l=32){if(e.crypto&&typeof e.crypto.getRandomValues=="function")return e.crypto.getRandomValues(new Uint8Array(l));if(e.crypto&&typeof e.crypto.randomBytes=="function")return e.crypto.randomBytes(l);throw new Error("crypto.getRandomValues must be defined")};const e=ni,n=ot;t.u8=l=>new Uint8Array(l.buffer,l.byteOffset,l.byteLength),t.u32=l=>new Uint32Array(l.buffer,l.byteOffset,Math.floor(l.byteLength/4)),t.createView=l=>new DataView(l.buffer,l.byteOffset,l.byteLength),t.rotr=(l,u)=>l<<32-u|l>>>u,t.rotl=(l,u)=>l<<u|l>>>32-u>>>0,t.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,t.byteSwap=l=>l<<24&4278190080|l<<8&16711680|l>>>8&65280|l>>>24&255,t.byteSwapIfBE=t.isLE?l=>l:l=>(0,t.byteSwap)(l);const r=Array.from({length:256},(l,u)=>u.toString(16).padStart(2,"0")),i={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function o(l){return l>=i._0&&l<=i._9?l-i._0:l>=i._A&&l<=i._F?l-(i._A-10):l>=i._a&&l<=i._f?l-(i._a-10):void 0}function s(l){if(typeof l!="string")throw new Error("utf8ToBytes expected string, got "+typeof l);return new Uint8Array(new TextEncoder().encode(l))}function a(l){return typeof l=="string"&&(l=s(l)),(0,n.bytes)(l),l}t.nextTick=async()=>{},t.Hash=class{clone(){return this._cloneInto()}};const c={}.toString}(Xt),Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.HashMD=Wt.Maj=Wt.Chi=void 0;const No=ot,hr=Xt;Wt.Chi=(t,e,n)=>t&e^~t&n;Wt.Maj=(t,e,n)=>t&e^t&n^e&n;Wt.HashMD=class extends hr.Hash{constructor(t,e,n,r){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,hr.createView)(this.buffer)}update(t){(0,No.exists)(this);const{view:e,buffer:n,blockLen:r}=this,i=(t=(0,hr.toBytes)(t)).length;for(let o=0;o<i;){const s=Math.min(r-this.pos,i-o);if(s!==r)n.set(t.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(e,0),this.pos=0);else{const a=(0,hr.createView)(t);for(;r<=i-o;o+=r)this.process(a,o)}}return this.length+=t.length,this.roundClean(),this}digestInto(t){(0,No.exists)(this),(0,No.output)(t,this),this.finished=!0;const{buffer:e,view:n,blockLen:r,isLE:i}=this;let{pos:o}=this;e[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>r-o&&(this.process(n,0),o=0);for(let u=o;u<r;u++)e[u]=0;(function(u,d,h,f){if(typeof u.setBigUint64=="function")return u.setBigUint64(d,h,f);const g=BigInt(32),m=BigInt(4294967295),w=Number(h>>g&m),p=Number(h&m),k=f?4:0,_=f?0:4;u.setUint32(d+k,w,f),u.setUint32(d+_,p,f)})(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=(0,hr.createView)(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,l=this.get();if(c>l.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<c;u++)s.setUint32(4*u,l[u],i)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:n,length:r,finished:i,destroyed:o,pos:s}=this;return t.length=r,t.pos=s,t.finished=i,t.destroyed=o,r%e&&t.buffer.set(n),t}};var he={};
8Object.defineProperty(he,"__esModule",{value:!0}),he.add5L=he.add5H=he.add4H=he.add4L=he.add3H=he.add3L=he.rotlBL=he.rotlBH=he.rotlSL=he.rotlSH=he.rotr32L=he.rotr32H=he.rotrBL=he.rotrBH=he.rotrSL=he.rotrSH=he.shrSL=he.shrSH=he.toBig=void 0,he.fromBig=ga,he.split=rd,he.add=yd;const ri=BigInt(2**32-1),Ms=BigInt(32);function ga(t,e=!1){return e?{h:Number(t&ri),l:Number(t>>Ms&ri)}:{h:0|Number(t>>Ms&ri),l:0|Number(t&ri)}}function rd(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:o,l:s}=ga(t[i],e);[n[i],r[i]]=[o,s]}return[n,r]}const id=(t,e)=>BigInt(t>>>0)<<Ms|BigInt(e>>>0);he.toBig=id;const od=(t,e,n)=>t>>>n;he.shrSH=od;const sd=(t,e,n)=>t<<32-n|e>>>n;he.shrSL=sd;const ad=(t,e,n)=>t>>>n|e<<32-n;he.rotrSH=ad;const cd=(t,e,n)=>t<<32-n|e>>>n;he.rotrSL=cd;const ld=(t,e,n)=>t<<64-n|e>>>n-32;he.rotrBH=ld;const ud=(t,e,n)=>t>>>n-32|e<<64-n;he.rotrBL=ud;const dd=(t,e)=>e;he.rotr32H=dd;const hd=(t,e)=>t;he.rotr32L=hd;const fd=(t,e,n)=>t<<n|e>>>32-n;he.rotlSH=fd;const pd=(t,e,n)=>e<<n|t>>>32-n;he.rotlSL=pd;const gd=(t,e,n)=>e<<n-32|t>>>64-n;he.rotlBH=gd;const md=(t,e,n)=>t<<n-32|e>>>64-n;function yd(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:0|i}}he.rotlBL=md;const vd=(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0);he.add3L=vd;const bd=(t,e,n,r)=>e+n+r+(t/2**32|0)|0;he.add3H=bd;const wd=(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0);he.add4L=wd;const Ed=(t,e,n,r,i)=>e+n+r+i+(t/2**32|0)|0;he.add4H=Ed;const _d=(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0);he.add5L=_d;const Cd=(t,e,n,r,i,o)=>e+n+r+i+o+(t/2**32|0)|0;he.add5H=Cd;const t1={fromBig:ga,split:rd,toBig:id,shrSH:od,shrSL:sd,rotrSH:ad,rotrSL:cd,rotrBH:ld,rotrBL:ud,rotr32H:dd,rotr32L:hd,rotlSH:fd,rotlSL:pd,rotlBH:gd,rotlBL:md,add:yd,add3L:vd,add3H:bd,add4L:wd,add4H:Ed,add5H:Cd,add5L:_d};he.default=t1,Object.defineProperty(Ie,"__esModule",{value:!0}),Ie.sha384=Ie.sha512_256=Ie.sha512_224=Ie.sha512=Ie.SHA384=Ie.SHA512_256=Ie.SHA512_224=Ie.SHA512=void 0;const n1=Wt,fe=he,ii=Xt,[r1,i1]=fe.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
85771202a","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(t=>BigInt(t))),Qt=new Uint32Array(80),en=new Uint32Array(80);class qr extends n1.HashMD{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:n,Bh:r,Bl:i,Ch:o,Cl:s,Dh:a,Dl:c,Eh:l,El:u,Fh:d,Fl:h,Gh:f,Gl:g,Hh:m,Hl:w}=this;return[e,n,r,i,o,s,a,c,l,u,d,h,f,g,m,w]}set(e,n,r,i,o,s,a,c,l,u,d,h,f,g,m,w){this.Ah=0|e,this.Al=0|n,this.Bh=0|r,this.Bl=0|i,this.Ch=0|o,this.Cl=0|s,this.Dh=0|a,this.Dl=0|c,this.Eh=0|l,this.El=0|u,this.Fh=0|d,this.Fl=0|h,this.Gh=0|f,this.Gl=0|g,this.Hh=0|m,this.Hl=0|w}process(e,n){for(let _=0;_<16;_++,n+=4)Qt[_]=e.getUint32(n),en[_]=e.getUint32(n+=4);for(let _=16;_<80;_++){const O=0|Qt[_-15],N=0|en[_-15],U=fe.default.rotrSH(O,N,1)^fe.default.rotrSH(O,N,8)^fe.default.shrSH(O,N,7),W=fe.default.rotrSL(O,N,1)^fe.default.rotrSL(O,N,8)^fe.default.shrSL(O,N,7),V=0|Qt[_-2],H=0|en[_-2],K=fe.default.rotrSH(V,H,19)^fe.default.rotrBH(V,H,61)^fe.default.shrSH(V,H,6),Y=fe.default.rotrSL(V,H,19)^fe.default.rotrBL(V,H,61)^fe.default.shrSL(V,H,6),j=fe.default.add4L(W,Y,en[_-7],en[_-16]),B=fe.default.add4H(j,U,K,Qt[_-7],Qt[_-16]);Qt[_]=0|B,en[_]=0|j}let{Ah:r,Al:i,Bh:o,Bl:s,Ch:a,Cl:c,Dh:l,Dl:u,Eh:d,El:h,Fh:f,Fl:g,Gh:m,Gl:w,Hh:p,Hl:k}=this;for(let _=0;_<80;_++){const O=fe.default.rotrSH(d,h,14)^fe.default.rotrSH(d,h,18)^fe.default.rotrBH(d,h,41),N=fe.default.rotrSL(d,h,14)^fe.default.rotrSL(d,h,18)^fe.default.rotrBL(d,h,41),U=d&f^~d&m,W=h&g^~h&w,V=fe.default.add5L(k,N,W,i1[_],en[_]),H=fe.default.add5H(V,p,O,U,r1[_],Qt[_]),K=0|V,Y=fe.default.rotrSH(r,i,28)^fe.default.rotrBH(r,i,34)^fe.default.rotrBH(r,i,39),j=fe.default.rotrSL(r,i,28)^fe.default.rotrBL(r,i,34)^fe.default.rotrBL(r,i,39),B=r&o^r&a^o&a,R=i&s^i&c^s&c;p=0|m,k=0|w,m=0|f,w=0|g,f=0|d,g=0|h,{h:d,l:h}=fe.default.add(0|l,0|u,0|H,0|K),l=0|a,u=0|c,a=0|o,c=0|s,o=0|r,s=0|i;const C=fe.default.add3L(K,j,R);r=fe.default.add3H(C,H,Y,B),i=0|C}({h:r,l:i}=fe.default.add(0|this.Ah,0|this.Al,0|r,0|i)),{h:o,l:s}=fe.default.add(0|this.Bh,0|this.Bl,0|o,0|s),{h:a,l:c}=fe.default.add(0|this.Ch,0|this.Cl,0|a,0|c),{h:l,l:u}=fe.default.add(0|this.Dh,0|this.Dl,0|l,0|u),{h:d,l:h}=fe.default.add(0|this.Eh,0|this.El,0|d,0|h),{h:f,l:g}=fe.default.add(0|this.Fh,0|this.Fl,0|f,0|g),{h:m,l:w}=fe.default.add(0|this.Gh,0|this.Gl,0|m,0|w),{h:p,l:k}=fe.default.add(0|this.Hh,0|this.Hl,0|p,0|k),this.set(r,i,o,s,a,c,l,u,d,h,f,g,m,w,p,k)}roundClean(){Qt.fill(0),en.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)}}Ie.SHA512=qr;class Sd extends qr{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}Ie.SHA512_224=Sd;class kd extends qr{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}Ie.SHA512_256=kd;class cc extends qr{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}Ie.SHA384=cc,Ie.sha512=(0,ii.wrapConstructor)(()=>new qr),Ie.sha512_224=(0,ii.wrapConstructor)(()=>new Sd),Ie.sha512_256=(0,ii.wrapConstructor)(()=>new kd),Ie.sha384=(0,ii.wrapConstructor)(()=>new cc);var Ts={},qn={},Se={},pe={};
8Object.defineProperty(pe,"__esModule",{value:!0}),pe.notImplemented=pe.bitMask=void 0,pe.isBytes=qi,pe.abytes=Vi,pe.abool=function(t,e){if(typeof e!="boolean")throw new Error(`${t} must be valid boolean, got "${e}".`)},pe.bytesToHex=Bo,pe.numberToHexUnpadded=lc,pe.hexToNumber=Do,pe.hexToBytes=Si,pe.bytesToNumberBE=function(t){return Do(Bo(t))},pe.bytesToNumberLE=function(t){return Vi(t),Do(Bo(Uint8Array.from(t).reverse()))},pe.numberToBytesBE=dc,pe.numberToBytesLE=function(t,e){return dc(t,e).reverse()},pe.numberToVarBytesBE=function(t){return Si(lc(t))},pe.ensureBytes=function(t,e,n){let r;if(typeof e=="string")try{r=Si(e)}catch(o){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${o}`)}else{if(!qi(e))throw new Error(`${t} must be hex string or Uint8Array`);r=Uint8Array.from(e)}const i=r.length;if(typeof n=="number"&&i!==n)throw new Error(`${t} expected ${n} bytes, got ${i}`);return r},pe.concatBytes=hc,pe.equalBytes=function(t,e){if(t.length!==e.length)return!1;let n=0;for(let r=0;r<t.length;r++)n|=t[r]^e[r];return n===0},pe.utf8ToBytes=function(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))},pe.inRange=fc,pe.aInRange=function(t,e,n,r){if(!fc(e,n,r))throw new Error(`expected valid ${t}: ${n} <= n < ${r}, got ${typeof e} ${e}`)},pe.bitLen=function(t){let e;for(e=0;t>Rs;t>>=Ci,e+=1);return e},pe.bitGet=function(t,e){return t>>BigInt(e)&Ci},pe.bitSet=function(t,e,n){return t|(n?Ci:Rs)<<BigInt(e)},pe.createHmacDrbg=function(t,e,n){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=jo(t),i=jo(t),o=0;const s=()=>{r.fill(1),i.fill(0),o=0},a=(...u)=>n(i,r,...u),c=(u=jo())=>{i=a(pc([0]),u),r=a(),u.length!==0&&(i=a(pc([1]),u),r=a())},l=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let u=0;const d=[];for(;u<e;){r=a();const h=r.slice();d.push(h),u+=r.length}return hc(...d)};return(u,d)=>{let h;for(s(),c(u);!(h=d(l()));)c();return s(),h}},pe.validateObject=function(t,e,n={}){const r=(i,o,s)=>{const a=a1[o];if(typeof a!="function")throw new Error(`Invalid validator "${o}", expected function`);const c=t[i];if(!(s&&c===void 0||a(c,t)))throw new Error(`Invalid param ${String(i)}=${c} (${typeof c}), expected ${o}`)};for(const[i,o]of Object.entries(e))r(i,o,!1);for(const[i,o]of Object.entries(n))r(i,o,!0);return t},pe.memoized=function(t){const e=new WeakMap;return(n,...r)=>{const i=e.get(n);if(i!==void 0)return i;const o=t(n,...r);return e.set(n,o),o}};const Rs=BigInt(0),Ci=BigInt(1),o1=BigInt(2);function qi(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function Vi(t){if(!qi(t))throw new Error("Uint8Array expected")}const s1=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Bo(t){Vi(t);let e="";for(let n=0;n<t.length;n++)e+=s1[t[n]];return e}function lc(t){const e=t.toString(16);return 1&e.length?`0${e}`:e}function Do(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}const Kt={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function uc(t){return t>=Kt._0&&t<=Kt._9?t-Kt._0:t>=Kt._A&&t<=Kt._F?t-(Kt._A-10):t>=Kt._a&&t<=Kt._f?t-(Kt._a-10):void 0}function Si(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let i=0,o=0;i<n;i++,o+=2){const s=uc(t.charCodeAt(o)),a=uc(t.charCodeAt(o+1));if(s===void 0||a===void 0){const c=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+o)}r[i]=16*s+a}return r}function dc(t,e){return Si(t.toString(16).padStart(2*e,"0"))}function hc(...t){let e=0;for(let r=0;r<t.length;r++){const i=t[r];Vi(i),e+=i.length}const n=new Uint8Array(e);for(let r=0,i=0;r<t.length;r++){const o=t[r];n.set(o,i),i+=o.length}return n}const $o=t=>typeof t=="bigint"&&Rs<=t;function fc(t,e,n){return $o(t)&&$o(e)&&$o(n)&&e<=t&&t<n}pe.bitMask=t=>(o1<<BigInt(t-1))-Ci;const jo=t=>new Uint8Array(t),pc=t=>Uint8Array.from(t),a1={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||qi(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};pe.notImplemented=()=>{throw new Error("not implemented")}
8,Object.defineProperty(Se,"__esModule",{value:!0}),Se.isNegativeLE=void 0,Se.mod=rt,Se.pow=xd,Se.pow2=function(t,e,n){let r=t;for(;e-- >Ne;)r*=r,r%=n;return r},Se.invert=oi,Se.tonelliShanks=Ad,Se.FpSqrt=yc,Se.validateField=function(t){const e=l1.reduce((n,r)=>(n[r]="function",n),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});return(0,tt.validateObject)(t,e)},Se.FpPow=vc,Se.FpInvertBatch=bc,Se.FpDiv=function(t,e,n){return t.mul(e,typeof n=="bigint"?oi(n,t.ORDER):t.inv(n))},Se.FpLegendre=wc,Se.FpIsSquare=function(t){const e=wc(t.ORDER);return n=>{const r=e(t,n);return t.eql(r,t.ZERO)||t.eql(r,t.ONE)}},Se.nLength=Ko,Se.Field=function(t,e,n=!1,r={}){if(t<=Ne)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:i,nByteLength:o}=Ko(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=yc(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:(0,tt.bitMask)(i),ZERO:Ne,ONE:ke,create:c=>rt(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error("Invalid field element: expected bigint, got "+typeof c);return Ne<=c&&c<t},is0:c=>c===Ne,isOdd:c=>(c&ke)===ke,neg:c=>rt(-c,t),eql:(c,l)=>c===l,sqr:c=>rt(c*c,t),add:(c,l)=>rt(c+l,t),sub:(c,l)=>rt(c-l,t),mul:(c,l)=>rt(c*l,t),pow:(c,l)=>vc(a,c,l),div:(c,l)=>rt(c*oi(l,t),t),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>oi(c,t),sqrt:r.sqrt||(c=>s(a,c)),invertBatch:c=>bc(a,c),cmov:(c,l,u)=>u?l:c,toBytes:c=>n?(0,tt.numberToBytesLE)(c,o):(0,tt.numberToBytesBE)(c,o),fromBytes:c=>{if(c.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${c.length}`);return n?(0,tt.bytesToNumberLE)(c):(0,tt.bytesToNumberBE)(c)}});return Object.freeze(a)},Se.FpSqrtOdd=function(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const n=t.sqrt(e);return t.isOdd(n)?n:t.neg(n)},Se.FpSqrtEven=function(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");const n=t.sqrt(e);return t.isOdd(n)?t.neg(n):n},Se.hashToPrivateScalar=function(t,e,n=!1){t=(0,tt.ensureBytes)("privateHash",t);const r=t.length,i=Ko(e).nByteLength+8;if(i<24||r<i||r>1024)throw new Error(`hashToPrivateScalar: expected ${i}-1024 bytes of input, got ${r}`);const o=n?(0,tt.bytesToNumberLE)(t):(0,tt.bytesToNumberBE)(t);return rt(o,e-ke)+ke},Se.getFieldBytesLength=Ls,Se.getMinHashLength=Ec,Se.mapHashToField=function(t,e,n=!1){const r=t.length,i=Ls(e),o=Ec(e);if(r<16||r<o||r>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const s=rt(n?(0,tt.bytesToNumberBE)(t):(0,tt.bytesToNumberLE)(t),e-ke)+ke;return n?(0,tt.numberToBytesLE)(s,i):(0,tt.numberToBytesBE)(s,i)};const tt=pe,Ne=BigInt(0),ke=BigInt(1),pn=BigInt(2),c1=BigInt(3),Os=BigInt(4),gc=BigInt(5),mc=BigInt(8);function rt(t,e){const n=t%e;return n>=Ne?n:e+n}function xd(t,e,n){if(n<=Ne||e<Ne)throw new Error("Expected power/modulo > 0");if(n===ke)return Ne;let r=ke;for(;e>Ne;)e&ke&&(r=r*t%n),t=t*t%n,e>>=ke;return r}function oi(t,e){if(t===Ne||e<=Ne)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=rt(t,e),r=e,i=Ne,o=ke;for(;n!==Ne;){const s=r%n,a=i-o*(r/n);r=n,n=s,i=o,o=a}if(r!==ke)throw new Error("invert: does not exist");return rt(i,e)}function Ad(t){const e=(t-ke)/pn;let n,r,i;for(n=t-ke,r=0;n%pn===Ne;n/=pn,r++);for(i=pn;i<t&&xd(i,e,t)!==t-ke;i++);if(r===1){const s=(t+ke)/Os;return function(a,c){const l=a.pow(c,s);if(!a.eql(a.sqr(l),c))throw new Error("Cannot find square root");return l}}const o=(n+ke)/pn;return function(s,a){if(s.pow(a,e)===s.neg(s.ONE))throw new Error("Cannot find square root");let c=r,l=s.pow(s.mul(s.ONE,i),n),u=s.pow(a,o),d=s.pow(a,n);for(;!s.eql(d,s.ONE);){if(s.eql(d,s.ZERO))return s.ZERO;let h=1;for(let g=s.sqr(d);h<c&&!s.eql(g,s.ONE);h++)g=s.sqr(g);const f=s.pow(l,ke<<BigInt(c-h-1));l=s.sqr(f),u=s.mul(u,f),d=s.mul(d,l),c=h}return u}}function yc(t){if(t%Os===c1){const e=(t+ke)/Os;return function(n,r){const i=n.pow(r,e);if(!n.eql(n.sqr(i),r))throw new Error("Cannot find square root");return i}}if(t%mc===gc){const e=(t-gc)/mc;return function(n,r){const i=n.mul(r,pn),o=n.pow(i,e),s=n.mul(r,o),a=n.mul(n.mul(s,pn),o),c=n.mul(s,n.sub(a,n.ONE));if(!n.eql(n.sqr(c),r))throw new Error("Cannot find square root");return c}}return Ad(t)}BigInt(9),BigInt(16);Se.isNegativeLE=(t,e)=>(rt(t,e)&ke)===ke;const l1=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function vc(t,e,n){if(n<Ne)throw new Error("Expected power > 0");if(n===Ne)return t.ONE;if(n===ke)return e;let r=t.ONE,i=e;for(;n>Ne;)n&ke&&(r=t.mul(r,i)),i=t.sqr(i),n>>=ke;return r}function bc(t,e){const n=new Array(e.length),r=e.reduce((o,s,a)=>t.is0(s)?o:(n[a]=o,t.mul(o,s)),t.ONE),i=t.inv(r);return e.reduceRight((o,s,a)=>t.is0(s)?o:(n[a]=t.mul(o,n[a]),t.mul(o,s)),i),n}function wc(t){const e=(t-ke)/pn;return(n,r)=>n.pow(r,e)}function Ko(t,e){const n=e!==void 0?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function Ls(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function Ec(t){const e=Ls(t);return e+Math.ceil(e/2)}Object.defineProperty(qn,"__esModule",{value:!0}),qn.wNAF=function(t,e){const n=(o,s)=>{const a=s.negate();return o?a:s},r=o=>{if(!Number.isSafeInteger(o)||o<=0||o>e)throw new Error(`Wrong window size=${o}, should be [1..${e}]`)},i=o=>(r(o),{windows:Math.ceil(e/o)+1,windowSize:2**(o-1)});return{constTimeNegate:n,unsafeLadder(o,s){let a=t.ZERO,c=o;for(;s>u1;)s&Uo&&(a=a.add(c)),c=c.double(),s>>=Uo;return a},precomputeWindow(o,s){const{windows:a,windowSize:c}=i(s),l=[];let u=o,d=u;for(let h=0;h<a;h++){d=u,l.push(d);for(let f=1;f<c;f++)d=d.add(u),l.push(d);u=d.double()}return l},wNAF(o,s,a){const{windows:c,windowSize:l}=i(o);let u=t.ZERO,d=t.BASE;const h=BigInt(2**o-1),f=2**o,g=BigInt(o);for(let m=0;m<c;m++){const w=m*l;let p=Number(a&h);a>>=g,p>l&&(p-=f,a+=Uo);const k=w,_=w+Math.abs(p)-1,O=m%2!=0,N=p<0;p===0?d=d.add(n(O,s[k])):u=u.add(n(N,s[_]))}
8return{p:u,f:d}},wNAFCached(o,s,a){const c=Sc.get(o)||1;let l=Ho.get(o);return l||(l=this.precomputeWindow(o,c),c!==1&&Ho.set(o,a(l))),this.wNAF(c,l,s)},setWindowSize(o,s){r(s),Sc.set(o,s),Ho.delete(o)}}},qn.pippenger=function(t,e,n,r){if(!Array.isArray(n)||!Array.isArray(r)||r.length!==n.length)throw new Error("arrays of points and scalars must have equal length");r.forEach((u,d)=>{if(!e.isValid(u))throw new Error(`wrong scalar at index ${d}`)}),n.forEach((u,d)=>{if(!(u instanceof t))throw new Error(`wrong point at index ${d}`)});const i=(0,Cc.bitLen)(BigInt(n.length)),o=i>12?i-3:i>4?i-2:i?2:1,s=(1<<o)-1,a=new Array(s+1).fill(t.ZERO),c=Math.floor((e.BITS-1)/o)*o;let l=t.ZERO;for(let u=c;u>=0;u-=o){a.fill(t.ZERO);for(let h=0;h<r.length;h++){const f=r[h],g=Number(f>>BigInt(u)&BigInt(s));a[g]=a[g].add(n[h])}let d=t.ZERO;for(let h=a.length-1,f=t.ZERO;h>0;h--)f=f.add(a[h]),d=d.add(f);if(l=l.add(d),u!==0)for(let h=0;h<o;h++)l=l.double()}return l},qn.validateBasic=function(t){return(0,_c.validateField)(t.Fp),(0,Cc.validateObject)(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,_c.nLength)(t.n,t.nBitLength),...t,p:t.Fp.ORDER})};const _c=Se,Cc=pe,u1=BigInt(0),Uo=BigInt(1),Ho=new WeakMap,Sc=new WeakMap;Object.defineProperty(Ts,"__esModule",{value:!0}),Ts.twistedEdwards=function(t){const e=function(B){const R=(0,Fo.validateBasic)(B);return Je.validateObject(B,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...R})}(t),{Fp:n,n:r,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:c}=e,l=si<<BigInt(8*a)-Xe,u=n.create,d=(0,kc.Field)(e.n,e.nBitLength),h=e.uvRatio||((B,R)=>{try{return{isValid:!0,value:n.sqrt(B*n.inv(R))}}catch{return{isValid:!1,value:vt}}}),f=e.adjustScalarBytes||(B=>B),g=e.domain||((B,R,C)=>{if((0,nt.abool)("phflag",C),R.length||C)throw new Error("Contexts/pre-hash are not supported");return B});function m(B,R){Je.aInRange("coordinate "+B,R,vt,l)}function w(B){if(!(B instanceof _))throw new Error("ExtendedPoint expected")}const p=(0,nt.memoized)((B,R)=>{const{ex:C,ey:L,ez:$}=B,y=B.is0();R==null&&(R=y?d1:n.inv($));const E=u(C*R),A=u(L*R),M=u($*R);if(y)return{x:vt,y:Xe};if(M!==Xe)throw new Error("invZ was invalid");return{x:E,y:A}}),k=(0,nt.memoized)(B=>{const{a:R,d:C}=e;if(B.is0())throw new Error("bad point: ZERO");const{ex:L,ey:$,ez:y,et:E}=B,A=u(L*L),M=u($*$),b=u(y*y),v=u(b*b),S=u(A*R);if(u(b*u(S+M))!==u(v+u(C*u(A*M))))throw new Error("bad point: equation left != right (1)");if(u(L*$)!==u(y*E))throw new Error("bad point: equation left != right (2)");return!0});class _{constructor(R,C,L,$){this.ex=R,this.ey=C,this.ez=L,this.et=$,m("x",R),m("y",C),m("z",L),m("t",$),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(R){if(R instanceof _)throw new Error("extended point not allowed");const{x:C,y:L}=R||{};return m("x",C),m("y",L),new _(C,L,Xe,u(C*L))}static normalizeZ(R){const C=n.invertBatch(R.map(L=>L.ez));return R.map((L,$)=>L.toAffine(C[$])).map(_.fromAffine)}static msm(R,C){return(0,Fo.pippenger)(_,d,R,C)}_setWindowSize(R){U.setWindowSize(this,R)}assertValidity(){k(this)}equals(R){w(R);const{ex:C,ey:L,ez:$}=this,{ex:y,ey:E,ez:A}=R,M=u(C*A),b=u(y*$),v=u(L*A),S=u(E*$);return M===b&&v===S}is0(){return this.equals(_.ZERO)}negate(){return new _(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){const{a:R}=e,{ex:C,ey:L,ez:$}=this,y=u(C*C),E=u(L*L),A=u(si*u($*$)),M=u(R*y),b=C+L,v=u(u(b*b)-y-E),S=M+E,x=S-A,T=M-E,I=u(v*x),D=u(S*T),F=u(v*T),z=u(x*S);return new _(I,D,z,F)}add(R){w(R);const{a:C,d:L}=e,{ex:$,ey:y,ez:E,et:A}=this,{ex:M,ey:b,ez:v,et:S}=R;if(C===BigInt(-1)){const ie=u((y-$)*(b+M)),ce=u((y+$)*(b-M)),ae=u(ce-ie);if(ae===vt)return this.double();const me=u(E*si*S),Ee=u(A*si*v),de=Ee+me,ge=ce+ie,ve=Ee-me,Oe=u(de*ae),ct=u(ge*ve),xo=u(de*ve),Ao=u(ae*ge);return new _(Oe,ct,Ao,xo)}const x=u($*M),T=u(y*b),I=u(A*L*S),D=u(E*v),F=u(($+y)*(M+b)-x-T),z=D-I,Z=D+I,Q=u(T-C*x),ne=u(F*z),se=u(Z*Q),le=u(F*Q),re=u(z*Z);return new _(ne,se,re,le)}subtract(R){return this.add(R.negate())}wNAF(R){return U.wNAFCached(this,R,_.normalizeZ)}multiply(R){const C=R;Je.aInRange("scalar",C,Xe,r);const{p:L,f:$}=this.wNAF(C);return _.normalizeZ([L,$])[0]}multiplyUnsafe(R){const C=R;return Je.aInRange("scalar",C,vt,r),C===vt?N:this.equals(N)||C===Xe?this:this.equals(O)?this.wNAF(C).p:U.unsafeLadder(this,C)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return U.unsafeLadder(this,r).is0()}toAffine(R){return p(this,R)}clearCofactor(){const{h:R}=e;return R===Xe?this:this.multiplyUnsafe(R)}static fromHex(R,C=!1){const{d:L,a:$}=e,y=n.BYTES;R=(0,nt.ensureBytes)("pointHex",R,y),(0,nt.abool)("zip215",C);const E=R.slice(),A=R[y-1];E[y-1]=-129&A;const M=Je.bytesToNumberLE(E),b=C?l:n.ORDER;Je.aInRange("pointHex.y",M,vt,b);const v=u(M*M),S=u(v-Xe),x=u(L*v-$);let{isValid:T,value:I}=h(S,x);
8if(!T)throw new Error("Point.fromHex: invalid y coordinate");const D=(I&Xe)===Xe,F=(128&A)!=0;if(!C&&I===vt&&F)throw new Error("Point.fromHex: x=0 and x_0=1");return F!==D&&(I=u(-I)),_.fromAffine({x:I,y:M})}static fromPrivateKey(R){return H(R).point}toRawBytes(){const{x:R,y:C}=this.toAffine(),L=Je.numberToBytesLE(C,n.BYTES);return L[L.length-1]|=R&Xe?128:0,L}toHex(){return Je.bytesToHex(this.toRawBytes())}}_.BASE=new _(e.Gx,e.Gy,Xe,u(e.Gx*e.Gy)),_.ZERO=new _(vt,Xe,Xe,vt);const{BASE:O,ZERO:N}=_,U=(0,Fo.wNAF)(_,8*a);function W(B){return(0,kc.mod)(B,r)}function V(B){return W(Je.bytesToNumberLE(B))}function H(B){const R=a;B=(0,nt.ensureBytes)("private key",B,R);const C=(0,nt.ensureBytes)("hashed private key",o(B),2*R),L=f(C.slice(0,R)),$=C.slice(R,2*R),y=V(L),E=O.multiply(y),A=E.toRawBytes();return{head:L,prefix:$,scalar:y,point:E,pointBytes:A}}function K(B=new Uint8Array,...R){const C=Je.concatBytes(...R);return V(o(g(C,(0,nt.ensureBytes)("context",B),!!i)))}const Y=h1;return O._setWindowSize(8),{CURVE:e,getPublicKey:function(B){return H(B).pointBytes},sign:function(B,R,C={}){B=(0,nt.ensureBytes)("message",B),i&&(B=i(B));const{prefix:L,scalar:$,pointBytes:y}=H(R),E=K(C.context,L,B),A=O.multiply(E).toRawBytes(),M=W(E+K(C.context,A,y,B)*$);Je.aInRange("signature.s",M,vt,r);const b=Je.concatBytes(A,Je.numberToBytesLE(M,n.BYTES));return(0,nt.ensureBytes)("result",b,2*a)},verify:function(B,R,C,L=Y){const{context:$,zip215:y}=L,E=n.BYTES;B=(0,nt.ensureBytes)("signature",B,2*E),R=(0,nt.ensureBytes)("message",R),y!==void 0&&(0,nt.abool)("zip215",y),i&&(R=i(R));const A=Je.bytesToNumberLE(B.slice(E,2*E));let M,b,v;try{M=_.fromHex(C,y),b=_.fromHex(B.slice(0,E),y),v=O.multiplyUnsafe(A)}catch{return!1}if(!y&&M.isSmallOrder())return!1;const S=K($,b.toRawBytes(),M.toRawBytes(),R);return b.add(M.multiplyUnsafe(S)).subtract(v).clearCofactor().equals(_.ZERO)},ExtendedPoint:_,utils:{getExtendedPublicKey:H,randomPrivateKey:()=>s(n.BYTES),precompute:(B=8,R=_.BASE)=>(R._setWindowSize(B),R.multiply(BigInt(3)),R)}}};const Fo=qn,kc=Se,Je=pe,nt=pe,vt=BigInt(0),Xe=BigInt(1),si=BigInt(2),d1=BigInt(8),h1={zip215:!0};var ln={};Object.defineProperty(ln,"__esModule",{value:!0}),ln.expand_message_xmd=Md,ln.expand_message_xof=Td,ln.hash_to_field=zo,ln.isogenyMap=function(t,e){const n=e.map(r=>Array.from(r).reverse());return(r,i)=>{const[o,s,a,c]=n.map(l=>l.reduce((u,d)=>t.add(t.mul(u,r),d)));return r=t.div(o,s),i=t.mul(i,t.div(a,c)),{x:r,y:i}}},ln.createHasher=function(t,e,n){if(typeof e!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(r,i){const o=zo(r,2,{...n,DST:n.DST,...i}),s=t.fromAffine(e(o[0])),a=t.fromAffine(e(o[1])),c=s.add(a).clearCofactor();return c.assertValidity(),c},encodeToCurve(r,i){const o=zo(r,1,{...n,DST:n.encodeDST,...i}),s=t.fromAffine(e(o[0])).clearCofactor();return s.assertValidity(),s},mapToCurve(r){if(!Array.isArray(r))throw new Error("mapToCurve: expected array of bigints");for(const o of r)if(typeof o!="bigint")throw new Error(`mapToCurve: expected array of bigints, got ${o} in array`);const i=t.fromAffine(e(r)).clearCofactor();return i.assertValidity(),i}}};const f1=Se,Ue=pe,p1=Ue.bytesToNumberBE;function un(t,e){if(Or(t),Or(e),t<0||t>=1<<8*e)throw new Error(`bad I2OSP call: value=${t} length=${e}`);const n=Array.from({length:e}).fill(0);for(let r=e-1;r>=0;r--)n[r]=255&t,t>>>=8;return new Uint8Array(n)}function g1(t,e){const n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t[r]^e[r];return n}function Or(t){if(!Number.isSafeInteger(t))throw new Error("number expected")}function Md(t,e,n,r){(0,Ue.abytes)(t),(0,Ue.abytes)(e),Or(n),e.length>255&&(e=r((0,Ue.concatBytes)((0,Ue.utf8ToBytes)("H2C-OVERSIZE-DST-"),e)));const{outputLen:i,blockLen:o}=r,s=Math.ceil(n/i);if(n>65535||s>255)throw new Error("expand_message_xmd: invalid lenInBytes");const a=(0,Ue.concatBytes)(e,un(e.length,1)),c=un(0,o),l=un(n,2),u=new Array(s),d=r((0,Ue.concatBytes)(c,t,l,un(0,1),a));u[0]=r((0,Ue.concatBytes)(d,un(1,1),a));for(let h=1;h<=s;h++){const f=[g1(d,u[h-1]),un(h+1,1),a];u[h]=r((0,Ue.concatBytes)(...f))}return(0,Ue.concatBytes)(...u).slice(0,n)}function Td(t,e,n,r,i){if((0,Ue.abytes)(t),(0,Ue.abytes)(e),Or(n),e.length>255){const o=Math.ceil(2*r/8);e=i.create({dkLen:o}).update((0,Ue.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(e).digest()}if(n>65535||e.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return i.create({dkLen:n}).update(t).update(un(n,2)).update(e).update(un(e.length,1)).digest()}function zo(t,e,n){(0,Ue.validateObject)(n,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:r,k:i,m:o,hash:s,expand:a,DST:c}=n;(0,Ue.abytes)(t),Or(e);const l=typeof c=="string"?(0,Ue.utf8ToBytes)(c):c,u=r.toString(2).length,d=Math.ceil((u+i)/8),h=e*o*d;let f;if(a==="xmd")f=Md(t,l,h,s);else if(a==="xof")f=Td(t,l,h,i,s);else{if(a!=="_internal_pass")throw new Error('expand must be "xmd" or "xof"');f=t}const g=new Array(e);for(let m=0;m<e;m++){const w=new Array(o);for(let p=0;p<o;p++){const k=d*(p+m*o),_=f.subarray(k,k+d);w[p]=(0,f1.mod)(p1(_),r)}g[m]=w}return g}var Ps={};Object.defineProperty(Ps,"__esModule",{value:!0}),Ps.montgomery=function(t){const e=function(m){return(0,tn.validateObject)(m,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...m})}(t),{P:n}=e,r=m=>(0,xc.mod)(m,n),i=e.montgomeryBits,o=Math.ceil(i/8),s=e.nByteLength,a=e.adjustScalarBytes||(m=>m),c=e.powPminus2||(m=>(0,xc.pow)(m,n-BigInt(2),n));function l(m,w,p){const k=r(m*(w-p));return[w=r(w-k),p=r(p+k)]}const u=(e.a-BigInt(2))/BigInt(4);function d(m){return(0,tn.numberToBytesLE)(r(m),o)}function h(m,w){const p=function(O){const N=(0,tn.ensureBytes)("u coordinate",O,o);return s===32&&(N[31]&=127),(0,tn.bytesToNumberLE)(N)}(w),k=function(O){const N=(0,tn.ensureBytes)("scalar",O),U=N.length;if(U!==o&&U!==s)throw new Error(`Expected ${o} or ${s} bytes, got ${U}`);
8return(0,tn.bytesToNumberLE)(a(N))}(m),_=function(O,N){(0,tn.aInRange)("u",O,jn,n),(0,tn.aInRange)("scalar",N,jn,n);const U=N,W=O;let V,H=qo,K=jn,Y=O,j=qo,B=jn;for(let C=BigInt(i-1);C>=jn;C--){const L=U>>C&qo;B^=L,V=l(B,H,Y),H=V[0],Y=V[1],V=l(B,K,j),K=V[0],j=V[1],B=L;const $=H+K,y=r($*$),E=H-K,A=r(E*E),M=y-A,b=Y+j,v=r((Y-j)*$),S=r(b*E),x=v+S,T=v-S;Y=r(x*x),j=r(W*r(T*T)),H=r(y*A),K=r(M*(y+r(u*M)))}V=l(B,H,Y),H=V[0],Y=V[1],V=l(B,K,j),K=V[0],j=V[1];const R=c(K);return r(H*R)}(p,k);if(_===jn)throw new Error("Invalid private or public key received");return d(_)}const f=d(e.Gu);function g(m){return h(m,f)}return{scalarMult:h,scalarMultBase:g,getSharedSecret:(m,w)=>h(m,w),getPublicKey:m=>g(m),utils:{randomPrivateKey:()=>e.randomBytes(e.nByteLength)},GuBytes:f}};const xc=Se,tn=pe,jn=BigInt(0),qo=BigInt(1);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.hash_to_ristretto255=t.hashToRistretto255=t.RistrettoPoint=t.encodeToCurve=t.hashToCurve=t.edwardsToMontgomery=t.x25519=t.ed25519ph=t.ed25519ctx=t.ed25519=t.ED25519_TORSION_SUBGROUP=void 0,t.edwardsToMontgomeryPub=U,t.edwardsToMontgomeryPriv=function(S){const x=O.hash(S.subarray(0,32));return O.adjustScalarBytes(x).subarray(0,32)};const e=Ie,n=Xt,r=Ts,i=ln,o=Se,s=Ps,a=pe,c=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),u=BigInt(0),d=BigInt(1),h=BigInt(2),f=BigInt(3),g=BigInt(5),m=BigInt(8);function w(S){const x=BigInt(10),T=BigInt(20),I=BigInt(40),D=BigInt(80),F=c,z=S*S%F*S%F,Z=(0,o.pow2)(z,h,F)*z%F,Q=(0,o.pow2)(Z,d,F)*S%F,ne=(0,o.pow2)(Q,g,F)*Q%F,se=(0,o.pow2)(ne,x,F)*ne%F,le=(0,o.pow2)(se,T,F)*se%F,re=(0,o.pow2)(le,I,F)*le%F,ie=(0,o.pow2)(re,D,F)*re%F,ce=(0,o.pow2)(ie,D,F)*re%F,ae=(0,o.pow2)(ce,x,F)*ne%F;return{pow_p_5_8:(0,o.pow2)(ae,h,F)*S%F,b2:z}}function p(S){return S[0]&=248,S[31]&=127,S[31]|=64,S}function k(S,x){const T=c,I=(0,o.mod)(x*x*x,T),D=w(S*(0,o.mod)(I*I*x,T)).pow_p_5_8;let F=(0,o.mod)(S*I*D,T);const z=(0,o.mod)(x*F*F,T),Z=F,Q=(0,o.mod)(F*l,T),ne=z===S,se=z===(0,o.mod)(-S,T),le=z===(0,o.mod)(-S*l,T);return ne&&(F=Z),(se||le)&&(F=Q),(0,o.isNegativeLE)(F,T)&&(F=(0,o.mod)(-F,T)),{isValid:ne||se,value:F}}t.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];const _=(0,o.Field)(c,void 0,!0),O={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:_,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:m,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:e.sha512,randomBytes:n.randomBytes,adjustScalarBytes:p,uvRatio:k};function N(S,x,T){if(x.length>255)throw new Error("Context is too big");return(0,n.concatBytes)((0,n.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([T?1:0,x.length]),x,S)}function U(S){const{y:x}=t.ed25519.ExtendedPoint.fromHex(S),T=BigInt(1);return _.toBytes(_.create((T+x)*_.inv(T-x)))}t.ed25519=(0,r.twistedEdwards)(O),t.ed25519ctx=(0,r.twistedEdwards)({...O,domain:N}),t.ed25519ph=(0,r.twistedEdwards)(Object.assign({},O,{domain:N,prehash:e.sha512})),t.x25519=(0,s.montgomery)({P:c,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:S=>{const x=c,{pow_p_5_8:T,b2:I}=w(S);return(0,o.mod)((0,o.pow2)(T,f,x)*I,x)},adjustScalarBytes:p,randomBytes:n.randomBytes}),t.edwardsToMontgomery=U;const W=(_.ORDER+f)/m,V=_.pow(h,W),H=_.sqrt(_.neg(_.ONE)),K=(0,o.FpSqrtEven)(_,_.neg(BigInt(486664)));function Y(S){const{xMn:x,xMd:T,yMn:I,yMd:D}=function(re){const ie=(_.ORDER-g)/m,ce=BigInt(486662);let ae=_.sqr(re);ae=_.mul(ae,h);let me=_.add(ae,_.ONE),Ee=_.neg(ce),de=_.sqr(me),ge=_.mul(de,me),ve=_.mul(ae,ce);ve=_.mul(ve,Ee),ve=_.add(ve,de),ve=_.mul(ve,Ee);let Oe=_.sqr(ge);de=_.sqr(Oe),Oe=_.mul(Oe,ge),Oe=_.mul(Oe,ve),de=_.mul(de,Oe);let ct=_.pow(de,ie);ct=_.mul(ct,Oe);let xo=_.mul(ct,H);de=_.sqr(ct),de=_.mul(de,ge);let Ao=_.eql(de,ve),Ya=_.cmov(xo,ct,Ao),Mf=_.mul(Ee,ae),lr=_.mul(ct,re);lr=_.mul(lr,V);let Tf=_.mul(lr,H),Rf=_.mul(ve,ae);de=_.sqr(lr),de=_.mul(de,ge);let Of=_.eql(de,Rf),Lf=_.cmov(Tf,lr,Of);de=_.sqr(Ya),de=_.mul(de,ge);let Mo=_.eql(de,ve),Pf=_.cmov(Mf,Ee,Mo),ur=_.cmov(Lf,Ya,Mo),If=_.isOdd(ur);return ur=_.cmov(ur,_.neg(ur),Mo!==If),{xMn:Pf,xMd:me,yMn:ur,yMd:d}}(S);let F=_.mul(x,D);F=_.mul(F,K);let z=_.mul(T,I),Z=_.sub(x,T),Q=_.add(x,T),ne=_.mul(z,Q),se=_.eql(ne,_.ZERO);F=_.cmov(F,_.ZERO,se),z=_.cmov(z,_.ONE,se),Z=_.cmov(Z,_.ONE,se),Q=_.cmov(Q,_.ONE,se);const le=_.invertBatch([z,Q]);return{x:_.mul(F,le[0]),y:_.mul(Z,le[1])}}const j=(0,i.createHasher)(t.ed25519.ExtendedPoint,S=>Y(S[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:_.ORDER,m:1,k:128,expand:"xmd",hash:e.sha512});function B(S){if(!(S instanceof v))throw new Error("RistrettoPoint expected")}t.hashToCurve=j.hashToCurve,t.encodeToCurve=j.encodeToCurve;const R=l,C=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),L=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),$=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),y=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),E=S=>k(d,S),A=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),M=S=>t.ed25519.CURVE.Fp.create((0,a.bytesToNumberLE)(S)&A);function b(S){const{d:x}=t.ed25519.CURVE,T=t.ed25519.CURVE.Fp.ORDER,I=t.ed25519.CURVE.Fp.create,D=I(R*S*S),F=I((D+d)*$);let z=BigInt(-1);const Z=I((z-x*D)*I(D+x));let{isValid:Q,value:ne}
8=k(F,Z),se=I(ne*S);(0,o.isNegativeLE)(se,T)||(se=I(-se)),Q||(ne=se),Q||(z=D);const le=I(z*(D-d)*y-Z),re=ne*ne,ie=I((ne+ne)*Z),ce=I(le*C),ae=I(d-re),me=I(d+re);return new t.ed25519.ExtendedPoint(I(ie*me),I(ae*ce),I(ce*me),I(ie*ae))}class v{constructor(x){this.ep=x}static fromAffine(x){return new v(t.ed25519.ExtendedPoint.fromAffine(x))}static hashToCurve(x){x=(0,a.ensureBytes)("ristrettoHash",x,64);const T=b(M(x.slice(0,32))),I=b(M(x.slice(32,64)));return new v(T.add(I))}static fromHex(x){x=(0,a.ensureBytes)("ristrettoHex",x,32);const{a:T,d:I}=t.ed25519.CURVE,D=t.ed25519.CURVE.Fp.ORDER,F=t.ed25519.CURVE.Fp.create,z="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",Z=M(x);if(!(0,a.equalBytes)((0,a.numberToBytesLE)(Z,32),x)||(0,o.isNegativeLE)(Z,D))throw new Error(z);const Q=F(Z*Z),ne=F(d+T*Q),se=F(d-T*Q),le=F(ne*ne),re=F(se*se),ie=F(T*I*le-re),{isValid:ce,value:ae}=E(F(ie*re)),me=F(ae*se),Ee=F(ae*me*ie);let de=F((Z+Z)*me);(0,o.isNegativeLE)(de,D)&&(de=F(-de));const ge=F(ne*Ee),ve=F(de*ge);if(!ce||(0,o.isNegativeLE)(ve,D)||ge===u)throw new Error(z);return new v(new t.ed25519.ExtendedPoint(de,ge,d,ve))}toRawBytes(){let{ex:x,ey:T,ez:I,et:D}=this.ep;const F=t.ed25519.CURVE.Fp.ORDER,z=t.ed25519.CURVE.Fp.create,Z=z(z(I+T)*z(I-T)),Q=z(x*T),ne=z(Q*Q),{value:se}=E(z(Z*ne)),le=z(se*Z),re=z(se*Q),ie=z(le*re*D);let ce;if((0,o.isNegativeLE)(D*ie,F)){let me=z(T*R),Ee=z(x*R);x=me,T=Ee,ce=z(le*L)}else ce=re;(0,o.isNegativeLE)(x*ie,F)&&(T=z(-T));let ae=z((I-T)*ce);return(0,o.isNegativeLE)(ae,F)&&(ae=z(-ae)),(0,a.numberToBytesLE)(ae,32)}toHex(){return(0,a.bytesToHex)(this.toRawBytes())}toString(){return this.toHex()}equals(x){B(x);const{ex:T,ey:I}=this.ep,{ex:D,ey:F}=x.ep,z=t.ed25519.CURVE.Fp.create,Z=z(T*F)===z(I*D),Q=z(I*F)===z(T*D);return Z||Q}add(x){return B(x),new v(this.ep.add(x.ep))}subtract(x){return B(x),new v(this.ep.subtract(x.ep))}multiply(x){return new v(this.ep.multiply(x))}multiplyUnsafe(x){return new v(this.ep.multiplyUnsafe(x))}double(){return new v(this.ep.double())}negate(){return new v(this.ep.negate())}}t.RistrettoPoint=(v.BASE||(v.BASE=new v(t.ed25519.ExtendedPoint.BASE)),v.ZERO||(v.ZERO=new v(t.ed25519.ExtendedPoint.ZERO)),v),t.hashToRistretto255=(S,x)=>{const T=x.DST,I=typeof T=="string"?(0,n.utf8ToBytes)(T):T,D=(0,i.expand_message_xmd)(S,I,64,e.sha512);return v.hashToCurve(D)},t.hash_to_ristretto255=t.hashToRistretto255})(Ju);var Rd={},Gt={};Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.sha224=Gt.sha256=Gt.SHA256=void 0;const Vo=Wt,dt=Xt,m1=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),nn=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),rn=new Uint32Array(64);class ma extends Vo.HashMD{constructor(){super(64,32,8,!1),this.A=0|nn[0],this.B=0|nn[1],this.C=0|nn[2],this.D=0|nn[3],this.E=0|nn[4],this.F=0|nn[5],this.G=0|nn[6],this.H=0|nn[7]}get(){const{A:e,B:n,C:r,D:i,E:o,F:s,G:a,H:c}=this;return[e,n,r,i,o,s,a,c]}set(e,n,r,i,o,s,a,c){this.A=0|e,this.B=0|n,this.C=0|r,this.D=0|i,this.E=0|o,this.F=0|s,this.G=0|a,this.H=0|c}process(e,n){for(let d=0;d<16;d++,n+=4)rn[d]=e.getUint32(n,!1);for(let d=16;d<64;d++){const h=rn[d-15],f=rn[d-2],g=(0,dt.rotr)(h,7)^(0,dt.rotr)(h,18)^h>>>3,m=(0,dt.rotr)(f,17)^(0,dt.rotr)(f,19)^f>>>10;rn[d]=m+rn[d-7]+g+rn[d-16]|0}let{A:r,B:i,C:o,D:s,E:a,F:c,G:l,H:u}=this;for(let d=0;d<64;d++){const h=u+((0,dt.rotr)(a,6)^(0,dt.rotr)(a,11)^(0,dt.rotr)(a,25))+(0,Vo.Chi)(a,c,l)+m1[d]+rn[d]|0,f=((0,dt.rotr)(r,2)^(0,dt.rotr)(r,13)^(0,dt.rotr)(r,22))+(0,Vo.Maj)(r,i,o)|0;u=l,l=c,c=a,a=s+h|0,s=o,o=i,i=r,r=h+f|0}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(r,i,o,s,a,c,l,u)}roundClean(){rn.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}Gt.SHA256=ma;class y1 extends ma{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4
8191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}Gt.sha256=(0,dt.wrapConstructor)(()=>new ma),Gt.sha224=(0,dt.wrapConstructor)(()=>new y1);var ki={},ya={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.hmac=t.HMAC=void 0;const e=ot,n=Xt;class r extends n.Hash{constructor(o,s){super(),this.finished=!1,this.destroyed=!1,(0,e.hash)(o);const a=(0,n.toBytes)(s);if(this.iHash=o.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const c=this.blockLen,l=new Uint8Array(c);l.set(a.length>c?o.create().update(a).digest():a);for(let u=0;u<l.length;u++)l[u]^=54;this.iHash.update(l),this.oHash=o.create();for(let u=0;u<l.length;u++)l[u]^=106;this.oHash.update(l),l.fill(0)}update(o){return(0,e.exists)(this),this.iHash.update(o),this}digestInto(o){(0,e.exists)(this),(0,e.bytes)(o,this.outputLen),this.finished=!0,this.iHash.digestInto(o),this.oHash.update(o),this.oHash.digestInto(o),this.destroy()}digest(){const o=new Uint8Array(this.oHash.outputLen);return this.digestInto(o),o}_cloneInto(o){o||(o=Object.create(Object.getPrototypeOf(this),{}));const{oHash:s,iHash:a,finished:c,destroyed:l,blockLen:u,outputLen:d}=this;return o.finished=c,o.destroyed=l,o.blockLen=u,o.outputLen=d,o.oHash=s._cloneInto(o.oHash),o.iHash=a._cloneInto(o.iHash),o}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}t.HMAC=r,t.hmac=(i,o,s)=>new r(i,o).update(s).digest(),t.hmac.create=(i,o)=>new r(i,o)})(ya);var va={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DER=void 0,t.weierstrassPoints=f,t.weierstrass=function(m){const w=function(S){const x=(0,e.validateBasic)(S);return r.validateObject(x,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...x})}(m),{Fp:p,n:k}=w,_=p.BYTES+1,O=2*p.BYTES+1;function N(S){return n.mod(S,k)}function U(S){return n.invert(S,k)}const{ProjectivePoint:W,normPrivateKeyToScalar:V,weierstrassEquation:H,isWithinCurveOrder:K}=f({...w,toBytes(S,x,T){const I=x.toAffine(),D=p.toBytes(I.x),F=r.concatBytes;return(0,i.abool)("isCompressed",T),T?F(Uint8Array.from([x.hasEvenY()?2:3]),D):F(Uint8Array.from([4]),D,p.toBytes(I.y))},fromBytes(S){const x=S.length,T=S[0],I=S.subarray(1);if(x!==_||T!==2&&T!==3){if(x===O&&T===4)return{x:p.fromBytes(I.subarray(0,p.BYTES)),y:p.fromBytes(I.subarray(p.BYTES,2*p.BYTES))};throw new Error(`Point of length ${x} was invalid. Expected ${_} compressed bytes or ${O} uncompressed bytes`)}{const D=r.bytesToNumberBE(I);if(!r.inRange(D,l,p.ORDER))throw new Error("Point is not on curve");const F=H(D);let z;try{z=p.sqrt(F)}catch(Z){const Q=Z instanceof Error?": "+Z.message:"";throw new Error("Point is not on curve"+Q)}return(1&T)==1!=((z&l)===l)&&(z=p.neg(z)),{x:D,y:z}}}}),Y=S=>r.bytesToHex(r.numberToBytesBE(S,w.nByteLength));function j(S){return S>k>>l}const B=(S,x,T)=>r.bytesToNumberBE(S.slice(x,T));class R{constructor(x,T,I){this.r=x,this.s=T,this.recovery=I,this.assertValidity()}static fromCompact(x){const T=w.nByteLength;return x=(0,i.ensureBytes)("compactSignature",x,2*T),new R(B(x,0,T),B(x,T,2*T))}static fromDER(x){const{r:T,s:I}=t.DER.toSig((0,i.ensureBytes)("DER",x));return new R(T,I)}assertValidity(){r.aInRange("r",this.r,l,k),r.aInRange("s",this.s,l,k)}addRecoveryBit(x){return new R(this.r,this.s,x)}recoverPublicKey(x){const{r:T,s:I,recovery:D}=this,F=y((0,i.ensureBytes)("msgHash",x));if(D==null||![0,1,2,3].includes(D))throw new Error("recovery id invalid");const z=D===2||D===3?T+w.n:T;if(z>=p.ORDER)throw new Error("recovery id 2 or 3 invalid");const Z=1&D?"03":"02",Q=W.fromHex(Z+Y(z)),ne=U(z),se=N(-F*ne),le=N(I*ne),re=W.BASE.multiplyAndAddUnsafe(Q,se,le);if(!re)throw new Error("point at infinify");return re.assertValidity(),re}hasHighS(){return j(this.s)}normalizeS(){return this.hasHighS()?new R(this.r,N(-this.s),this.recovery):this}toDERRawBytes(){return r.hexToBytes(this.toDERHex())}toDERHex(){return t.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return r.hexToBytes(this.toCompactHex())}toCompactHex(){return Y(this.r)+Y(this.s)}}const C={isValidPrivateKey(S){try{return V(S),!0}catch{return!1}},normPrivateKeyToScalar:V,randomPrivateKey:()=>{const S=n.getMinHashLength(w.n);return n.mapHashToField(w.randomBytes(S),w.n)},precompute:(S=8,x=W.BASE)=>(x._setWindowSize(S),x.multiply(BigInt(3)),x)};function L(S){const x=r.isBytes(S),T=typeof S=="string",I=(x||T)&&S.length;return x?I===_||I===O:T?I===2*_||I===2*O:S instanceof W}const $=w.bits2int||function(S){const x=r.bytesToNumberBE(S),T=8*S.length-w.nBitLength;return T>0?x>>BigInt(T):x},y=w.bits2int_modN||function(S){return N($(S))},E=r.bitMask(w.nBitLength);function A(S){return r.aInRange(`num < 2^${w.nBitLength}`,S,c,E),r.numberToBytesBE(S,w.nByteLength)}function M(S,x,T=b){if(["recovered","canonical"].some(ie=>ie in T))throw new Error("sign() legacy options not supported");const{hash:I,randomBytes:D}=w;let{lowS:F,prehash:z,extraEntropy:Z}=T;F==null&&(F=!0),S=(0,i.ensureBytes)("msgHash",S),o(T),z&&(S=(0,i.ensureBytes)("prehashed msgHash",I(S)));const Q=y(S),ne=V(x),se=[A(ne),A(Q)];if(Z!=null&&Z!==!1){const ie=Z===!0?D(p.BYTES):Z;se.push((0,i.ensureBytes)("extraEntropy",ie))}const le=r.concatBytes(...se),re=Q;return{seed:le,k2sig:function(ie){const ce=$(ie);if(!K(ce))return;const ae=U(ce),me=W.BASE.multiply(ce).toAffine(),Ee=N(me.x);if(Ee===c)return;const de=N(ae*N(re+Ee*ne));if(de===c)return;let ge=(me.x===Ee?0:2)|Number(me.y&l),ve=de;return F&&j(de)&&(ve=function(Oe){return j(Oe)?N(-Oe):Oe}(de),ge^=1),new R(Ee,ve,ge)}}}const b={lowS:w.lowS,prehash:!1},v={lowS:w.lowS,prehash:!1};return W.BASE._setWindowSize(8),{CURVE:w,getPublicKey:function(S,x=!0){return W.fromPrivateKey(S).toRawBytes(x)},getSharedSecret:function(S,x,T=!0){if(L(S))throw new Error("first arg must be private key");if(!L(x))throw new Error("second arg must be public key");return W.fromHex(x).multiply(V(S)).toRawBytes(T)},sign:function(S,x,T=b){const{seed:I,k2sig:D}=M(S,x,T),F=w;return r.createHmacDrbg(F.hash.outputLen,F.nByteLength,F.hmac)(I,D)},verify:function(S,x,T,I=v){var Ee;const D=S;if(x=(0,i.ensureBytes)("msgHash",x),T=(0,i.ensureBytes)("publicKey",T),"strict"in I)throw new Error("options.strict was renamed to lowS");o(I);const{lowS:F,prehash:z}=I;let Z,Q;
8try{if(typeof D=="string"||r.isBytes(D))try{Z=R.fromDER(D)}catch(de){if(!(de instanceof t.DER.Err))throw de;Z=R.fromCompact(D)}else{if(typeof D!="object"||typeof D.r!="bigint"||typeof D.s!="bigint")throw new Error("PARSE");{const{r:de,s:ge}=D;Z=new R(de,ge)}}Q=W.fromHex(T)}catch(de){if(de.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(F&&Z.hasHighS())return!1;z&&(x=w.hash(x));const{r:ne,s:se}=Z,le=y(x),re=U(se),ie=N(le*re),ce=N(ne*re),ae=(Ee=W.BASE.multiplyAndAddUnsafe(Q,ie,ce))==null?void 0:Ee.toAffine();return ae?N(ae.x)===ne:!1},ProjectivePoint:W,Signature:R,utils:C}},t.SWUFpSqrtRatio=g,t.mapToCurveSimpleSWU=function(m,w){if(n.validateField(m),!m.isValid(w.A)||!m.isValid(w.B)||!m.isValid(w.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const p=g(m,w.Z);if(!m.isOdd)throw new Error("Fp.isOdd is not implemented!");return k=>{let _,O,N,U,W,V,H,K;_=m.sqr(k),_=m.mul(_,w.Z),O=m.sqr(_),O=m.add(O,_),N=m.add(O,m.ONE),N=m.mul(N,w.B),U=m.cmov(w.Z,m.neg(O),!m.eql(O,m.ZERO)),U=m.mul(U,w.A),O=m.sqr(N),V=m.sqr(U),W=m.mul(V,w.A),O=m.add(O,W),O=m.mul(O,N),V=m.mul(V,U),W=m.mul(V,w.B),O=m.add(O,W),H=m.mul(_,N);const{isValid:Y,value:j}=p(O,V);K=m.mul(_,k),K=m.mul(K,j),H=m.cmov(H,N,Y),K=m.cmov(K,j,Y);const B=m.isOdd(k)===m.isOdd(K);return K=m.cmov(m.neg(K),K,B),H=m.div(H,U),{x:H,y:K}}};const e=qn,n=Se,r=pe,i=pe;function o(m){m.lowS!==void 0&&(0,i.abool)("lowS",m.lowS),m.prehash!==void 0&&(0,i.abool)("prehash",m.prehash)}const{bytesToNumberBE:s,hexToBytes:a}=r;t.DER={Err:class extends Error{constructor(m=""){super(m)}},_tlv:{encode:(m,w)=>{const{Err:p}=t.DER;if(m<0||m>256)throw new p("tlv.encode: wrong tag");if(1&w.length)throw new p("tlv.encode: unpadded data");const k=w.length/2,_=r.numberToHexUnpadded(k);if(_.length/2&128)throw new p("tlv.encode: long form length too big");const O=k>127?r.numberToHexUnpadded(_.length/2|128):"";return`${r.numberToHexUnpadded(m)}${O}${_}${w}`},decode(m,w){const{Err:p}=t.DER;let k=0;if(m<0||m>256)throw new p("tlv.encode: wrong tag");if(w.length<2||w[k++]!==m)throw new p("tlv.decode: wrong tlv");const _=w[k++];let O=0;if(128&_){const U=127&_;if(!U)throw new p("tlv.decode(long): indefinite length not supported");if(U>4)throw new p("tlv.decode(long): byte length is too big");const W=w.subarray(k,k+U);if(W.length!==U)throw new p("tlv.decode: length bytes not complete");if(W[0]===0)throw new p("tlv.decode(long): zero leftmost byte");for(const V of W)O=O<<8|V;if(k+=U,O<128)throw new p("tlv.decode(long): not minimal encoding")}else O=_;const N=w.subarray(k,k+O);if(N.length!==O)throw new p("tlv.decode: wrong value length");return{v:N,l:w.subarray(k+O)}}},_int:{encode(m){const{Err:w}=t.DER;if(m<c)throw new w("integer: negative integers are not allowed");let p=r.numberToHexUnpadded(m);if(8&Number.parseInt(p[0],16)&&(p="00"+p),1&p.length)throw new w("unexpected assertion");return p},decode(m){const{Err:w}=t.DER;if(128&m[0])throw new w("Invalid signature integer: negative");if(m[0]===0&&!(128&m[1]))throw new w("Invalid signature integer: unnecessary leading zero");return s(m)}},toSig(m){const{Err:w,_int:p,_tlv:k}=t.DER,_=typeof m=="string"?a(m):m;r.abytes(_);const{v:O,l:N}=k.decode(48,_);if(N.length)throw new w("Invalid signature: left bytes after parsing");const{v:U,l:W}=k.decode(2,O),{v:V,l:H}=k.decode(2,W);if(H.length)throw new w("Invalid signature: left bytes after parsing");return{r:p.decode(U),s:p.decode(V)}},hexFromSig(m){const{_tlv:w,_int:p}=t.DER,k=`${w.encode(2,p.encode(m.r))}${w.encode(2,p.encode(m.s))}`;return w.encode(48,k)}};const c=BigInt(0),l=BigInt(1),u=BigInt(2),d=BigInt(3),h=BigInt(4);function f(m){const w=function(B){const R=(0,e.validateBasic)(B);r.validateObject(R,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:C,Fp:L,a:$}=R;if(C){if(!L.eql($,L.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof C!="object"||typeof C.beta!="bigint"||typeof C.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...R})}(m),{Fp:p}=w,k=n.Field(w.n,w.nBitLength),_=w.toBytes||((B,R,C)=>{const L=R.toAffine();return r.concatBytes(Uint8Array.from([4]),p.toBytes(L.x),p.toBytes(L.y))}),O=w.fromBytes||(B=>{const R=B.subarray(1);return{x:p.fromBytes(R.subarray(0,p.BYTES)),y:p.fromBytes(R.subarray(p.BYTES,2*p.BYTES))}});function N(B){const{a:R,b:C}=w,L=p.sqr(B),$=p.mul(L,B);return p.add(p.add($,p.mul(B,R)),C)}if(!p.eql(p.sqr(w.Gy),N(w.Gx)))throw new Error("bad generator point: equation left != right");function U(B){const{allowedPrivateKeyLengths:R,nByteLength:C,wrapPrivateKey:L,n:$}=w;if(R&&typeof B!="bigint"){if(r.isBytes(B)&&(B=r.bytesToHex(B)),typeof B!="string"||!R.includes(B.length))throw new Error("Invalid key");B=B.padStart(2*C,"0")}let y;try{y=typeof B=="bigint"?B:r.bytesToNumberBE((0,i.ensureBytes)("private key",B,C))}catch{throw new Error(`private key must be ${C} bytes, hex or bigint, not ${typeof B}`)}return L&&(y=n.mod(y,$)),r.aInRange("private key",y,l,$),y}function W(B){if(!(B instanceof K))throw new Error("ProjectivePoint expected")}const V=(0,i.memoized)((B,R)=>{const{px:C,py:L,pz:$}=B;if(p.eql($,p.ONE))return{x:C,y:L};const y=B.is0();R==null&&(R=y?p.ONE:p.inv($));const E=p.mul(C,R),A=p.mul(L,R),M=p.mul($,R);if(y)return{x:p.ZERO,y:p.ZERO};
8if(!p.eql(M,p.ONE))throw new Error("invZ was invalid");return{x:E,y:A}}),H=(0,i.memoized)(B=>{if(B.is0()){if(w.allowInfinityPoint&&!p.is0(B.py))return;throw new Error("bad point: ZERO")}const{x:R,y:C}=B.toAffine();if(!p.isValid(R)||!p.isValid(C))throw new Error("bad point: x or y not FE");const L=p.sqr(C),$=N(R);if(!p.eql(L,$))throw new Error("bad point: equation left != right");if(!B.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class K{constructor(R,C,L){if(this.px=R,this.py=C,this.pz=L,R==null||!p.isValid(R))throw new Error("x required");if(C==null||!p.isValid(C))throw new Error("y required");if(L==null||!p.isValid(L))throw new Error("z required");Object.freeze(this)}static fromAffine(R){const{x:C,y:L}=R||{};if(!R||!p.isValid(C)||!p.isValid(L))throw new Error("invalid affine point");if(R instanceof K)throw new Error("projective point not allowed");const $=y=>p.eql(y,p.ZERO);return $(C)&&$(L)?K.ZERO:new K(C,L,p.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(R){const C=p.invertBatch(R.map(L=>L.pz));return R.map((L,$)=>L.toAffine(C[$])).map(K.fromAffine)}static fromHex(R){const C=K.fromAffine(O((0,i.ensureBytes)("pointHex",R)));return C.assertValidity(),C}static fromPrivateKey(R){return K.BASE.multiply(U(R))}static msm(R,C){return(0,e.pippenger)(K,k,R,C)}_setWindowSize(R){j.setWindowSize(this,R)}assertValidity(){H(this)}hasEvenY(){const{y:R}=this.toAffine();if(p.isOdd)return!p.isOdd(R);throw new Error("Field doesn't support isOdd")}equals(R){W(R);const{px:C,py:L,pz:$}=this,{px:y,py:E,pz:A}=R,M=p.eql(p.mul(C,A),p.mul(y,$)),b=p.eql(p.mul(L,A),p.mul(E,$));return M&&b}negate(){return new K(this.px,p.neg(this.py),this.pz)}double(){const{a:R,b:C}=w,L=p.mul(C,d),{px:$,py:y,pz:E}=this;let A=p.ZERO,M=p.ZERO,b=p.ZERO,v=p.mul($,$),S=p.mul(y,y),x=p.mul(E,E),T=p.mul($,y);return T=p.add(T,T),b=p.mul($,E),b=p.add(b,b),A=p.mul(R,b),M=p.mul(L,x),M=p.add(A,M),A=p.sub(S,M),M=p.add(S,M),M=p.mul(A,M),A=p.mul(T,A),b=p.mul(L,b),x=p.mul(R,x),T=p.sub(v,x),T=p.mul(R,T),T=p.add(T,b),b=p.add(v,v),v=p.add(b,v),v=p.add(v,x),v=p.mul(v,T),M=p.add(M,v),x=p.mul(y,E),x=p.add(x,x),v=p.mul(x,T),A=p.sub(A,v),b=p.mul(x,S),b=p.add(b,b),b=p.add(b,b),new K(A,M,b)}add(R){W(R);const{px:C,py:L,pz:$}=this,{px:y,py:E,pz:A}=R;let M=p.ZERO,b=p.ZERO,v=p.ZERO;const S=w.a,x=p.mul(w.b,d);let T=p.mul(C,y),I=p.mul(L,E),D=p.mul($,A),F=p.add(C,L),z=p.add(y,E);F=p.mul(F,z),z=p.add(T,I),F=p.sub(F,z),z=p.add(C,$);let Z=p.add(y,A);return z=p.mul(z,Z),Z=p.add(T,D),z=p.sub(z,Z),Z=p.add(L,$),M=p.add(E,A),Z=p.mul(Z,M),M=p.add(I,D),Z=p.sub(Z,M),v=p.mul(S,z),M=p.mul(x,D),v=p.add(M,v),M=p.sub(I,v),v=p.add(I,v),b=p.mul(M,v),I=p.add(T,T),I=p.add(I,T),D=p.mul(S,D),z=p.mul(x,z),I=p.add(I,D),D=p.sub(T,D),D=p.mul(S,D),z=p.add(z,D),T=p.mul(I,z),b=p.add(b,T),T=p.mul(Z,z),M=p.mul(F,M),M=p.sub(M,T),T=p.mul(F,I),v=p.mul(Z,v),v=p.add(v,T),new K(M,b,v)}subtract(R){return this.add(R.negate())}is0(){return this.equals(K.ZERO)}wNAF(R){return j.wNAFCached(this,R,K.normalizeZ)}multiplyUnsafe(R){r.aInRange("scalar",R,c,w.n);const C=K.ZERO;if(R===c)return C;if(R===l)return this;const{endo:L}=w;if(!L)return j.unsafeLadder(this,R);let{k1neg:$,k1:y,k2neg:E,k2:A}=L.splitScalar(R),M=C,b=C,v=this;for(;y>c||A>c;)y&l&&(M=M.add(v)),A&l&&(b=b.add(v)),v=v.double(),y>>=l,A>>=l;return $&&(M=M.negate()),E&&(b=b.negate()),b=new K(p.mul(b.px,L.beta),b.py,b.pz),M.add(b)}multiply(R){const{endo:C,n:L}=w;let $,y;if(r.aInRange("scalar",R,l,L),C){const{k1neg:E,k1:A,k2neg:M,k2:b}=C.splitScalar(R);let{p:v,f:S}=this.wNAF(A),{p:x,f:T}=this.wNAF(b);v=j.constTimeNegate(E,v),x=j.constTimeNegate(M,x),x=new K(p.mul(x.px,C.beta),x.py,x.pz),$=v.add(x),y=S.add(T)}else{const{p:E,f:A}=this.wNAF(R);$=E,y=A}return K.normalizeZ([$,y])[0]}multiplyAndAddUnsafe(R,C,L){const $=K.BASE,y=(A,M)=>M!==c&&M!==l&&A.equals($)?A.multiply(M):A.multiplyUnsafe(M),E=y(this,C).add(y(R,L));return E.is0()?void 0:E}toAffine(R){return V(this,R)}isTorsionFree(){const{h:R,isTorsionFree:C}=w;if(R===l)return!0;if(C)return C(K,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:R,clearCofactor:C}=w;return R===l?this:C?C(K,this):this.multiplyUnsafe(w.h)}toRawBytes(R=!0){return(0,i.abool)("isCompressed",R),this.assertValidity(),_(K,this,R)}toHex(R=!0){return(0,i.abool)("isCompressed",R),r.bytesToHex(this.toRawBytes(R))}}K.BASE=new K(w.Gx,w.Gy,p.ONE),K.ZERO=new K(p.ZERO,p.ONE,p.ZERO);const Y=w.nBitLength,j=(0,e.wNAF)(K,w.endo?Math.ceil(Y/2):Y);return{CURVE:w,ProjectivePoint:K,normPrivateKeyToScalar:U,weierstrassEquation:N,isWithinCurveOrder:function(B){return r.inRange(B,l,w.n)}}}function g(m,w){const p=m.ORDER;let k=c;for(let B=p-l;B%u===c;B/=u)k+=l;const _=k,O=u<<_-l-l,N=O*u,U=(p-l)/N,W=(U-l)/u,V=N-l,H=O,K=m.pow(w,U),Y=m.pow(w,(U+l)/u);let j=(B,R)=>{let C=K,L=m.pow(R,V),$=m.sqr(L);$=m.mul($,R);let y=m.mul(B,$);y=m.pow(y,W),y=m.mul(y,L),L=m.mul(y,R),$=m.mul(y,B);let E=m.mul($,L);y=m.pow(E,H);let A=m.eql(y,m.ONE);L=m.mul($,Y),y=m.mul(E,C),$=m.cmov(L,$,A),E=m.cmov(y,E,A);for(let M=_;M>l;M--){let b=M-u;b=u<<b-l;let v=m.pow(E,b);const S=m.eql(v,m.ONE);L=m.mul($,C),C=m.mul(C,C),v=m.mul(E,C),$=m.cmov(L,$,S),E=m.cmov(v,E,S)}return{isValid:A,value:$}};if(m.ORDER%h===d){const B=(m.ORDER-d)/h,R=m.sqrt(m.neg(w));j=(C,L)=>{let $=m.sqr(L);const y=m.mul(C,L);$=m.mul($,y);let E=m.pow($,B);E=m.mul(E,y);const A=m.mul(E,R),M=m.mul(m.sqr(E),L),b=m.eql(M,C);return{isValid:b,value:m.cmov(A,E,b)}}}return j}})(va),Object.defineProperty(ki,"__esModule",{value:!0}),ki.getHash=Mc,ki.createCurve=function(t,e){const n=r=>(0,b1.weierstrass)({...t,...Mc(r)});return Object.freeze({...n(e),create:n})};const v1=ya,Ac=Xt,b1=va;function Mc(t){return{hash:t,hmac:(e,...n)=>(0,v1.hmac)(t,e,(0,Ac.concatBytes)(...n)),randomBytes:Ac.randomBytes}}
8(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.encodeToCurve=t.hashToCurve=t.schnorr=t.secp256k1=void 0;const e=Gt,n=Xt,r=ki,i=ln,o=Se,s=pe,a=va,c=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),l=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),u=BigInt(1),d=BigInt(2),h=(y,E)=>(y+E/d)/E;function f(y){const E=c,A=BigInt(3),M=BigInt(6),b=BigInt(11),v=BigInt(22),S=BigInt(23),x=BigInt(44),T=BigInt(88),I=y*y*y%E,D=I*I*y%E,F=(0,o.pow2)(D,A,E)*D%E,z=(0,o.pow2)(F,A,E)*D%E,Z=(0,o.pow2)(z,d,E)*I%E,Q=(0,o.pow2)(Z,b,E)*Z%E,ne=(0,o.pow2)(Q,v,E)*Q%E,se=(0,o.pow2)(ne,x,E)*ne%E,le=(0,o.pow2)(se,T,E)*se%E,re=(0,o.pow2)(le,x,E)*ne%E,ie=(0,o.pow2)(re,A,E)*D%E,ce=(0,o.pow2)(ie,S,E)*Q%E,ae=(0,o.pow2)(ce,M,E)*I%E,me=(0,o.pow2)(ae,d,E);if(!g.eql(g.sqr(me),y))throw new Error("Cannot find square root");return me}const g=(0,o.Field)(c,void 0,void 0,{sqrt:f});t.secp256k1=(0,r.createCurve)({a:BigInt(0),b:BigInt(7),Fp:g,n:l,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:y=>{const E=l,A=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),M=-u*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),b=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),v=A,S=BigInt("0x100000000000000000000000000000000"),x=h(v*y,E),T=h(-M*y,E);let I=(0,o.mod)(y-x*A-T*b,E),D=(0,o.mod)(-x*M-T*v,E);const F=I>S,z=D>S;if(F&&(I=E-I),z&&(D=E-D),I>S||D>S)throw new Error("splitScalar: Endomorphism failed, k="+y);return{k1neg:F,k1:I,k2neg:z,k2:D}}}},e.sha256);const m=BigInt(0),w={};function p(y,...E){let A=w[y];if(A===void 0){const M=(0,e.sha256)(Uint8Array.from(y,b=>b.charCodeAt(0)));A=(0,s.concatBytes)(M,M),w[y]=A}return(0,e.sha256)((0,s.concatBytes)(A,...E))}const k=y=>y.toRawBytes(!0).slice(1),_=y=>(0,s.numberToBytesBE)(y,32),O=y=>(0,o.mod)(y,c),N=y=>(0,o.mod)(y,l),U=t.secp256k1.ProjectivePoint,W=(y,E,A)=>U.BASE.multiplyAndAddUnsafe(y,E,A);function V(y){let E=t.secp256k1.utils.normPrivateKeyToScalar(y),A=U.fromPrivateKey(E);return{scalar:A.hasEvenY()?E:N(-E),bytes:k(A)}}function H(y){(0,s.aInRange)("x",y,u,c);const E=O(y*y);let A=f(O(E*y+BigInt(7)));A%d!==m&&(A=O(-A));const M=new U(y,A,u);return M.assertValidity(),M}const K=s.bytesToNumberBE;function Y(...y){return N(K(p("BIP0340/challenge",...y)))}function j(y){return V(y).bytes}function B(y,E,A=(0,n.randomBytes)(32)){const M=(0,s.ensureBytes)("message",y),{bytes:b,scalar:v}=V(E),S=(0,s.ensureBytes)("auxRand",A,32),x=_(v^K(p("BIP0340/aux",S))),T=p("BIP0340/nonce",x,b,M),I=N(K(T));if(I===m)throw new Error("sign failed: k is zero");const{bytes:D,scalar:F}=V(I),z=Y(D,b,M),Z=new Uint8Array(64);if(Z.set(D,0),Z.set(_(N(F+z*v)),32),!R(Z,M,b))throw new Error("sign: Invalid signature produced");return Z}function R(y,E,A){const M=(0,s.ensureBytes)("signature",y,64),b=(0,s.ensureBytes)("message",E),v=(0,s.ensureBytes)("publicKey",A,32);try{const S=H(K(v)),x=K(M.subarray(0,32));if(!(0,s.inRange)(x,u,c))return!1;const T=K(M.subarray(32,64));if(!(0,s.inRange)(T,u,l))return!1;const I=Y(_(x),k(S),b),D=W(S,T,N(-I));return!(!D||!D.hasEvenY()||D.toAffine().x!==x)}catch{return!1}}t.schnorr={getPublicKey:j,sign:B,verify:R,utils:{randomPrivateKey:t.secp256k1.utils.randomPrivateKey,lift_x:H,pointToBytes:k,numberToBytesBE:s.numberToBytesBE,bytesToNumberBE:s.bytesToNumberBE,taggedHash:p,mod:o.mod}};const C=(0,i.isogenyMap)(g,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(y=>y.map(E=>BigInt(E)))),L=(0,a.mapToCurveSimpleSWU)(g,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:g.create(BigInt("-11"))}),$=(0,i.createHasher)(t.secp256k1.ProjectivePoint,y=>{const{x:E,y:A}=L(g.create(y[0]));return C(E,A)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:g.ORDER,m:1,k:128,expand:"xmd",hash:e.sha256});t.hashToCurve=$.hashToCurve,t.encodeToCurve=$.encodeToCurve})(Rd);var Is={};
8(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.decodeHex=t.remove0x=void 0;var e=at;t.remove0x=function(n){return n.startsWith("0x")||n.startsWith("0X")?n.slice(2):n},t.decodeHex=function(n){return(0,e.hexToBytes)((0,t.remove0x)(n))}})(Is),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.hexToPublicKey=t.convertPublicKeyFormat=t.getSharedPoint=t.getPublicKey=t.isValidPrivateKey=t.getValidSecret=void 0;var e=fa,n=Ju,r=Rd,i=Rr,o=Pe,s=Is;t.getValidSecret=function(){var u;do u=(0,e.randomBytes)(o.SECRET_KEY_LENGTH);while(!(0,t.isValidPrivateKey)(u));return u},t.isValidPrivateKey=function(u){return a((0,i.ellipticCurve)(),function(d){return d.utils.isValidPrivateKey(u)},function(){return!0},function(){return!0})},t.getPublicKey=function(u){return a((0,i.ellipticCurve)(),function(d){return d.getPublicKey(u)},function(d){return d.getPublicKey(u)},function(d){return d.getPublicKey(u)})},t.getSharedPoint=function(u,d,h){return a((0,i.ellipticCurve)(),function(f){return f.getSharedSecret(u,d,h)},function(f){return f.getSharedSecret(u,d)},function(f){return l(f,u,d)})},t.convertPublicKeyFormat=function(u,d){return a((0,i.ellipticCurve)(),function(h){return h.getSharedSecret(BigInt(1),u,d)},function(){return u},function(){return u})};function a(u,d,h,f){if(u==="secp256k1")return d(r.secp256k1);if(u==="x25519")return h(n.x25519);if(u==="ed25519")return f(n.ed25519);throw new Error("Not implemented")}t.hexToPublicKey=function(u){var d=(0,s.decodeHex)(u);return a((0,i.ellipticCurve)(),function(){return c(d)},function(){return d},function(){return d})};var c=function(u){if(u.length===o.ETH_PUBLIC_KEY_SIZE){var d=new Uint8Array(1+u.length);return d.set([4]),d.set(u,1),d}return u},l=function(u,d,h){var f=u.utils.getExtendedPublicKey(d).scalar;return u.ExtendedPoint.fromHex(h).multiply(f).toRawBytes()}}(Zu);var Od={},Vn={};Object.defineProperty(Vn,"__esModule",{value:!0}),Vn.hkdf=void 0,Vn.extract=Pd,Vn.expand=Id;const Ns=ot,Tc=Xt,Ld=ya;function Pd(t,e,n){return(0,Ns.hash)(t),n===void 0&&(n=new Uint8Array(t.outputLen)),(0,Ld.hmac)(t,(0,Tc.toBytes)(n),(0,Tc.toBytes)(e))}const Wo=new Uint8Array([0]),Rc=new Uint8Array;function Id(t,e,n,r=32){if((0,Ns.hash)(t),(0,Ns.number)(r),r>255*t.outputLen)throw new Error("Length should be <= 255*HashLen");const i=Math.ceil(r/t.outputLen);n===void 0&&(n=Rc);const o=new Uint8Array(i*t.outputLen),s=Ld.hmac.create(t,e),a=s._cloneInto(),c=new Uint8Array(s.outputLen);for(let l=0;l<i;l++)Wo[0]=l+1,a.update(l===0?Rc:c).update(n).update(Wo).digestInto(c),o.set(c,t.outputLen*l),s._cloneInto(a);return s.destroy(),a.destroy(),c.fill(0),Wo.fill(0),o.slice(0,r)}Vn.hkdf=(t,e,n,r,i)=>Id(t,Pd(t,e,n),r,i),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getSharedKey=t.deriveKey=void 0;var e=at,n=Vn,r=Gt;t.deriveKey=function(i,o,s){return(0,n.hkdf)(r.sha256,i,o,s,32)},t.getSharedKey=function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return(0,t.deriveKey)(e.concatBytes.apply(void 0,i))}}(Od);var Oc={},Xn={},Ae={},Mn={};Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.polyval=Mn.ghash=void 0,Mn._toGHASHKey=Nd;const Tn=He,Ve=at,Ht=16,ba=new Uint8Array(16),Rt=(0,Ve.u32)(ba),pt=t=>(t>>>0&255)<<24|(t>>>8&255)<<16|(t>>>16&255)<<8|t>>>24&255|0;function Nd(t){t.reverse();const e=1&t[15];let n=0;for(let r=0;r<t.length;r++){const i=t[r];t[r]=i>>>1|n,n=(1&i)<<7}return t[0]^=225&-e,t}class Bd{constructor(e,n){this.blockLen=Ht,this.outputLen=Ht,this.s0=0,this.s1=0,this.s2=0,this.s3=0,this.finished=!1,e=(0,Ve.toBytes)(e),(0,Tn.bytes)(e,16);const r=(0,Ve.createView)(e);let i=r.getUint32(0,!1),o=r.getUint32(4,!1),s=r.getUint32(8,!1),a=r.getUint32(12,!1);const c=[];for(let p=0;p<128;p++)c.push({s0:pt(i),s1:pt(o),s2:pt(s),s3:pt(a)}),{s0:i,s1:o,s2:s,s3:a}={s3:(d=s)<<31|(h=a)>>>1,s2:(u=o)<<31|d>>>1,s1:(l=i)<<31|u>>>1,s0:l>>>1^225<<24&-(1&h)};var l,u,d,h;const f=(p=>p>65536?8:p>1024?4:2)(n||1024);if(![1,2,4,8].includes(f))throw new Error(`ghash: wrong window size=${f}, should be 2, 4 or 8`);this.W=f;const g=128/f,m=this.windowSize=2**f,w=[];for(let p=0;p<g;p++)for(let k=0;k<m;k++){let _=0,O=0,N=0,U=0;for(let W=0;W<f;
vendor: 4,098 bytes, line 8
8W++){if(!(k>>>f-W-1&1))continue;const{s0:V,s1:H,s2:K,s3:Y}=c[f*p+W];_^=V,O^=H,N^=K,U^=Y}w.push({s0:_,s1:O,s2:N,s3:U})}this.t=w}_updateBlock(e,n,r,i){e^=this.s0,n^=this.s1,r^=this.s2,i^=this.s3;const{W:o,t:s,windowSize:a}=this;let c=0,l=0,u=0,d=0;const h=(1<<o)-1;let f=0;for(const g of[e,n,r,i])for(let m=0;m<4;m++){const w=g>>>8*m&255;for(let p=8/o-1;p>=0;p--){const k=w>>>o*p&h,{s0:_,s1:O,s2:N,s3:U}=s[f*a+k];c^=_,l^=O,u^=N,d^=U,f+=1}}this.s0=c,this.s1=l,this.s2=u,this.s3=d}update(e){e=(0,Ve.toBytes)(e),(0,Tn.exists)(this);const n=(0,Ve.u32)(e),r=Math.floor(e.length/Ht),i=e.length%Ht;for(let o=0;o<r;o++)this._updateBlock(n[4*o+0],n[4*o+1],n[4*o+2],n[4*o+3]);return i&&(ba.set(e.subarray(r*Ht)),this._updateBlock(Rt[0],Rt[1],Rt[2],Rt[3]),(0,Ve.clean)(Rt)),this}destroy(){const{t:e}=this;for(const n of e)n.s0=0,n.s1=0,n.s2=0,n.s3=0}digestInto(e){(0,Tn.exists)(this),(0,Tn.output)(e,this),this.finished=!0;const{s0:n,s1:r,s2:i,s3:o}=this,s=(0,Ve.u32)(e);return s[0]=n,s[1]=r,s[2]=i,s[3]=o,e}digest(){const e=new Uint8Array(Ht);return this.digestInto(e),this.destroy(),e}}class w1 extends Bd{constructor(e,n){e=(0,Ve.toBytes)(e);const r=Nd((0,Ve.copyBytes)(e));super(r,n),(0,Ve.clean)(r)}update(e){e=(0,Ve.toBytes)(e),(0,Tn.exists)(this);const n=(0,Ve.u32)(e),r=e.length%Ht,i=Math.floor(e.length/Ht);for(let o=0;o<i;o++)this._updateBlock(pt(n[4*o+3]),pt(n[4*o+2]),pt(n[4*o+1]),pt(n[4*o+0]));return r&&(ba.set(e.subarray(i*Ht)),this._updateBlock(pt(Rt[3]),pt(Rt[2]),pt(Rt[1]),pt(Rt[0])),(0,Ve.clean)(Rt)),this}digestInto(e){(0,Tn.exists)(this),(0,Tn.output)(e,this),this.finished=!0;const{s0:n,s1:r,s2:i,s3:o}=this,s=(0,Ve.u32)(e);return s[0]=n,s[1]=r,s[2]=i,s[3]=o,e.reverse()}}function Lc(t){const e=(r,i)=>t(i,r.length).update((0,Ve.toBytes)(r)).digest(),n=t(new Uint8Array(16),0);return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=(r,i)=>t(r,i),e}Mn.ghash=Lc((t,e)=>new Bd(t,e)),Mn.polyval=Lc((t,e)=>new w1(t,e)),Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.unsafe=Ae.aeskwp=Ae.aeskw=Ae.siv=Ae.gcm=Ae.cfb=Ae.cbc=Ae.ecb=Ae.ctr=void 0,Ae.expandKeyLE=_t,Ae.expandKeyDecLE=Lr;const be=He,Bs=Mn,ee=at,et=16,ai=new Uint8Array(et),E1=283;function wa(t){return t<<1^E1&-(t>>7)}function Wn(t,e){let n=0;for(;e>0;e>>=1)n^=t&-(1&e),t=wa(t);return n}const Ds=(()=>{const t=new Uint8Array(256);for(let n=0,r=1;n<256;n++,r^=wa(r))t[n]=r;const e=new Uint8Array(256);e[0]=99;for(let n=0;n<255;n++){let r=t[255-n];r|=r<<8,e[t[n]]=255&(r^r>>4^r>>5^r>>6^r>>7^99)}return(0,ee.clean)(t),e})(),_1=Ds.map((t,e)=>Ds.indexOf(e)),C1=t=>t<<24|t>>>8,Go=t=>t<<8|t>>>24,Wi=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function Dd(t,e){if(t.length!==256)throw new Error("Wrong sbox length");const n=new Uint32Array(256).map((l,u)=>e(t[u])),r=n.map(Go),i=r.map(Go),o=i.map(Go),s=new Uint32Array(65536),a=new Uint32Array(65536),c=new Uint16Array(65536);for(let l=0;l<256;l++)for(let u=0;u<256;u++){const d=256*l+u;s[d]=n[l]^r[u],a[d]=i[l]^o[u],c[d]=t[l]<<8|t[u]}return{sbox:t,sbox2:c,T0:n,T1:r,T2:i,T3:o,T01:s,T23:a}}const Ea=Dd(Ds,t=>Wn(t,3)<<24|t<<16|t<<8|Wn(t,2)),$d=Dd(_1,t=>Wn(t,11)<<24|Wn(t,13)<<16|Wn(t,9)<<8|Wn(t,14)),S1=(()=>{const t=new Uint8Array(16);for(let e=0,n=1;e<16;e++,n=wa(n))t[e]=n;return t})();function _t(t){(0,be.bytes)(t);const e=t.length;if(![16,24,32].includes(e))throw new Error(`aes: wrong key size: should be 16, 24 or 32, got: ${e}`);const{sbox2:n}=Ea,r=[];(0,ee.isAligned32)(t)||r.push(t=(0,ee.copyBytes)(t));const i=(0,ee.u32)(t),o=i.length,s=c=>Lt(n,c,c,c,c),a=new Uint32Array(e+28);a.set(i);for(let c=o;c<a.length;c++){let l=a[c-1];c%o==0?l=s(C1(l))^S1[c/o-1]:o>6&&c%o==4&&(l=s(l)),a[c]=a[c-o]^l}return(0,ee.clean)(...r),a}function Lr(t){const e=_t(t),n=e.slice(),r=e.length,{sbox2:i}=Ea,{T0:o,T1:s,T2:a,T3:c}=$d;for(let l=0;l<r;l+=4)for(let u=0;u<4;u++)n[l+u]=e[r-l-4+u];(0,ee.clean)(e);for(let l=4;l<r-4;l++){const u=n[l],d=Lt(i,u,u,u,u);n[l]=o[255&d]^s[d>>>8&255]^a[d>>>16&255]^c[d>>>24]}return n}function mn(t,e,n,r,i,o){return t[n<<8&65280|r>>>8&255]^e[i>>>8&65280|o>>>24&255]}function Lt(t,e,n,r,i){return t[255&e|65280&n]|t[r>>>16&255|i>>>16&65280]<<16}
8function We(t,e,n,r,i){const{sbox2:o,T01:s,T23:a}=Ea;let c=0;e^=t[c++],n^=t[c++],r^=t[c++],i^=t[c++];const l=t.length/4-2;for(let u=0;u<l;u++){const d=t[c++]^mn(s,a,e,n,r,i),h=t[c++]^mn(s,a,n,r,i,e),f=t[c++]^mn(s,a,r,i,e,n),g=t[c++]^mn(s,a,i,e,n,r);e=d,n=h,r=f,i=g}return{s0:t[c++]^Lt(o,e,n,r,i),s1:t[c++]^Lt(o,n,r,i,e),s2:t[c++]^Lt(o,r,i,e,n),s3:t[c++]^Lt(o,i,e,n,r)}}function Pr(t,e,n,r,i){const{sbox2:o,T01:s,T23:a}=$d;let c=0;e^=t[c++],n^=t[c++],r^=t[c++],i^=t[c++];const l=t.length/4-2;for(let u=0;u<l;u++){const d=t[c++]^mn(s,a,e,i,r,n),h=t[c++]^mn(s,a,n,e,i,r),f=t[c++]^mn(s,a,r,n,e,i),g=t[c++]^mn(s,a,i,r,n,e);e=d,n=h,r=f,i=g}return{s0:t[c++]^Lt(o,e,i,r,n),s1:t[c++]^Lt(o,n,e,i,r),s2:t[c++]^Lt(o,r,n,e,i),s3:t[c++]^Lt(o,i,r,n,e)}}function Qn(t,e){if(e===void 0)return new Uint8Array(t);if((0,be.bytes)(e),e.length<t)throw new Error(`aes: wrong destination length, expected at least ${t}, got: ${e.length}`);if(!(0,ee.isAligned32)(e))throw new Error("unaligned dst");return e}function jd(t,e,n,r){(0,be.bytes)(e,et),(0,be.bytes)(n);const i=n.length;r=Qn(i,r);const o=e,s=(0,ee.u32)(o);let{s0:a,s1:c,s2:l,s3:u}=We(t,s[0],s[1],s[2],s[3]);const d=(0,ee.u32)(n),h=(0,ee.u32)(r);for(let g=0;g+4<=d.length;g+=4){h[g+0]=d[g+0]^a,h[g+1]=d[g+1]^c,h[g+2]=d[g+2]^l,h[g+3]=d[g+3]^u;let m=1;for(let w=o.length-1;w>=0;w--)m=m+(255&o[w])|0,o[w]=255&m,m>>>=8;({s0:a,s1:c,s2:l,s3:u}=We(t,s[0],s[1],s[2],s[3]))}const f=et*Math.floor(d.length/4);if(f<i){const g=new Uint32Array([a,c,l,u]),m=(0,ee.u8)(g);for(let w=f,p=0;w<i;w++,p++)r[w]=n[w]^m[p];(0,ee.clean)(g)}return r}function Gn(t,e,n,r,i){(0,be.bytes)(n,et),(0,be.bytes)(r),i=Qn(r.length,i);const o=n,s=(0,ee.u32)(o),a=(0,ee.createView)(o),c=(0,ee.u32)(r),l=(0,ee.u32)(i),u=e?0:12,d=r.length;let h=a.getUint32(u,e),{s0:f,s1:g,s2:m,s3:w}=We(t,s[0],s[1],s[2],s[3]);for(let k=0;k+4<=c.length;k+=4)l[k+0]=c[k+0]^f,l[k+1]=c[k+1]^g,l[k+2]=c[k+2]^m,l[k+3]=c[k+3]^w,h=h+1>>>0,a.setUint32(u,h,e),{s0:f,s1:g,s2:m,s3:w}=We(t,s[0],s[1],s[2],s[3]);const p=et*Math.floor(c.length/4);if(p<d){const k=new Uint32Array([f,g,m,w]),_=(0,ee.u8)(k);for(let O=p,N=0;O<d;O++,N++)i[O]=r[O]^_[N];(0,ee.clean)(k)}return i}function Pc(t){if((0,be.bytes)(t),t.length%et!=0)throw new Error("aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size 16")}function Ic(t,e,n){(0,be.bytes)(t);let r=t.length;const i=r%et;if(!e&&i!==0)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");(0,ee.isAligned32)(t)||(t=(0,ee.copyBytes)(t));const o=(0,ee.u32)(t);if(e){let a=et-i;a||(a=et),r+=a}const s=Qn(r,n);return{b:o,o:(0,ee.u32)(s),out:s}}function Nc(t,e){if(!e)return t;const n=t.length;if(!n)throw new Error("aes/pcks5: empty ciphertext not allowed");const r=t[n-1];if(r<=0||r>16)throw new Error("aes/pcks5: wrong padding");const i=t.subarray(0,-r);for(let o=0;o<r;o++)if(t[n-o-1]!==r)throw new Error("aes/pcks5: wrong padding");return i}function Bc(t){const e=new Uint8Array(16),n=(0,ee.u32)(e);e.set(t);const r=et-t.length;for(let i=et-r;i<et;i++)e[i]=r;return n}function Kd(t,e,n,r,i){const o=i==null?0:i.length,s=t.create(n,r.length+o);i&&s.update(i),s.update(r);const a=new Uint8Array(16),c=(0,ee.createView)(a);i&&(0,ee.setBigUint64)(c,0,BigInt(8*o),e),(0,ee.setBigUint64)(c,8,BigInt(8*r.length),e),s.update(a);const l=s.digest();return(0,ee.clean)(a),l}Ae.ctr=(0,ee.wrapCipher)({blockSize:16,nonceLength:16},function(t,e){function n(r,i){if((0,be.bytes)(r),i!==void 0&&((0,be.bytes)(i),!(0,ee.isAligned32)(i)))throw new Error("unaligned destination");const o=_t(t),s=(0,ee.copyBytes)(e),a=[o,s];(0,ee.isAligned32)(r)||a.push(r=(0,ee.copyBytes)(r));const c=jd(o,s,r,i);return(0,ee.clean)(...a),c}return(0,be.bytes)(t),(0,be.bytes)(e,et),{encrypt:(r,i)=>n(r,i),decrypt:(r,i)=>n(r,i)}}),Ae.ecb=(0,ee.wrapCipher)({blockSize:16},function(t,e={}){(0,be.bytes)(t);const n=!e.disablePadding;return{encrypt(r,i){const{b:o,o:s,out:a}=Ic(r,n,i),c=_t(t);let l=0;for(;l+4<=o.length;){const{s0:u,s1:d,s2:h,s3:f}=We(c,o[l+0],o[l+1],o[l+2],o[l+3]);s[l++]=u,s[l++]=d,s[l++]=h,s[l++]=f}if(n){const u=Bc(r.subarray(4*l)),{s0:d,s1:h,s2:f,s3:g}=We(c,u[0],u[1],u[2],u[3]);s[l++]=d,s[l++]=h,s[l++]=f,s[l++]=g}return(0,ee.clean)(c),a},decrypt(r,i){Pc(r);const o=Lr(t),s=Qn(r.length,i),a=[o];
8(0,ee.isAligned32)(r)||a.push(r=(0,ee.copyBytes)(r));const c=(0,ee.u32)(r),l=(0,ee.u32)(s);for(let u=0;u+4<=c.length;){const{s0:d,s1:h,s2:f,s3:g}=Pr(o,c[u+0],c[u+1],c[u+2],c[u+3]);l[u++]=d,l[u++]=h,l[u++]=f,l[u++]=g}return(0,ee.clean)(...a),Nc(s,n)}}}),Ae.cbc=(0,ee.wrapCipher)({blockSize:16,nonceLength:16},function(t,e,n={}){(0,be.bytes)(t),(0,be.bytes)(e,16);const r=!n.disablePadding;return{encrypt(i,o){const s=_t(t),{b:a,o:c,out:l}=Ic(i,r,o);let u=e;const d=[s];(0,ee.isAligned32)(u)||d.push(u=(0,ee.copyBytes)(u));const h=(0,ee.u32)(u);let f=h[0],g=h[1],m=h[2],w=h[3],p=0;for(;p+4<=a.length;)f^=a[p+0],g^=a[p+1],m^=a[p+2],w^=a[p+3],{s0:f,s1:g,s2:m,s3:w}=We(s,f,g,m,w),c[p++]=f,c[p++]=g,c[p++]=m,c[p++]=w;if(r){const k=Bc(i.subarray(4*p));f^=k[0],g^=k[1],m^=k[2],w^=k[3],{s0:f,s1:g,s2:m,s3:w}=We(s,f,g,m,w),c[p++]=f,c[p++]=g,c[p++]=m,c[p++]=w}return(0,ee.clean)(...d),l},decrypt(i,o){Pc(i);const s=Lr(t);let a=e;const c=[s];(0,ee.isAligned32)(a)||c.push(a=(0,ee.copyBytes)(a));const l=(0,ee.u32)(a),u=Qn(i.length,o);(0,ee.isAligned32)(i)||c.push(i=(0,ee.copyBytes)(i));const d=(0,ee.u32)(i),h=(0,ee.u32)(u);let f=l[0],g=l[1],m=l[2],w=l[3];for(let p=0;p+4<=d.length;){const k=f,_=g,O=m,N=w;f=d[p+0],g=d[p+1],m=d[p+2],w=d[p+3];const{s0:U,s1:W,s2:V,s3:H}=Pr(s,f,g,m,w);h[p++]=U^k,h[p++]=W^_,h[p++]=V^O,h[p++]=H^N}return(0,ee.clean)(...c),Nc(u,r)}}}),Ae.cfb=(0,ee.wrapCipher)({blockSize:16,nonceLength:16},function(t,e){function n(r,i,o){(0,be.bytes)(r);const s=r.length;o=Qn(s,o);const a=_t(t);let c=e;const l=[a];(0,ee.isAligned32)(c)||l.push(c=(0,ee.copyBytes)(c)),(0,ee.isAligned32)(r)||l.push(r=(0,ee.copyBytes)(r));const u=(0,ee.u32)(r),d=(0,ee.u32)(o),h=i?d:u,f=(0,ee.u32)(c);let g=f[0],m=f[1],w=f[2],p=f[3];for(let _=0;_+4<=u.length;){const{s0:O,s1:N,s2:U,s3:W}=We(a,g,m,w,p);d[_+0]=u[_+0]^O,d[_+1]=u[_+1]^N,d[_+2]=u[_+2]^U,d[_+3]=u[_+3]^W,g=h[_++],m=h[_++],w=h[_++],p=h[_++]}const k=et*Math.floor(u.length/4);if(k<s){({s0:g,s1:m,s2:w,s3:p}=We(a,g,m,w,p));const _=(0,ee.u8)(new Uint32Array([g,m,w,p]));for(let O=k,N=0;O<s;O++,N++)o[O]=r[O]^_[N];(0,ee.clean)(_)}return(0,ee.clean)(...l),o}return(0,be.bytes)(t),(0,be.bytes)(e,16),{encrypt:(r,i)=>n(r,!0,i),decrypt:(r,i)=>n(r,!1,i)}}),Ae.gcm=(0,ee.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16},function(t,e,n){if((0,be.bytes)(t),(0,be.bytes)(e),n!==void 0&&(0,be.bytes)(n),e.length<8)throw new Error("aes/gcm: invalid nonce length");const r=16;function i(s,a,c){const l=Kd(Bs.ghash,!1,s,c,n);for(let u=0;u<a.length;u++)l[u]^=a[u];return l}function o(){const s=_t(t),a=ai.slice(),c=ai.slice();if(Gn(s,!1,c,c,a),e.length===12)c.set(e);else{const l=ai.slice(),u=(0,ee.createView)(l);(0,ee.setBigUint64)(u,8,BigInt(8*e.length),!1);const d=Bs.ghash.create(a).update(e).update(l);d.digestInto(c),d.destroy()}return{xk:s,authKey:a,counter:c,tagMask:Gn(s,!1,c,ai)}}return{encrypt(s){(0,be.bytes)(s);const{xk:a,authKey:c,counter:l,tagMask:u}=o(),d=new Uint8Array(s.length+r),h=[a,c,l,u];(0,ee.isAligned32)(s)||h.push(s=(0,ee.copyBytes)(s)),Gn(a,!1,l,s,d);const f=i(c,u,d.subarray(0,d.length-r));return h.push(f),d.set(f,s.length),(0,ee.clean)(...h),d},decrypt(s){if((0,be.bytes)(s),s.length<r)throw new Error("aes/gcm: ciphertext less than tagLen (16)");const{xk:a,authKey:c,counter:l,tagMask:u}=o(),d=[a,c,u,l];(0,ee.isAligned32)(s)||d.push(s=(0,ee.copyBytes)(s));const h=s.subarray(0,-16),f=s.subarray(-16),g=i(c,u,h);if(d.push(g),!(0,ee.equalBytes)(g,f))throw new Error("aes/gcm: invalid ghash tag");const m=Gn(a,!1,l,h);return(0,ee.clean)(...d),m}}});const ci=(t,e,n)=>r=>{if(!Number.isSafeInteger(r)||e>r||r>n)throw new Error(`${t}: invalid value=${r}, must be [${e}..${n}]`)};function Ud(t){return t!=null&&typeof t=="object"&&(t instanceof Uint32Array||t.constructor.name==="Uint32Array")}function Hd(t,e){if((0,be.bytes)(e,16),!Ud(t))throw new Error("_encryptBlock accepts result of expandKeyLE");const n=(0,ee.u32)(e);let{s0:r,s1:i,s2:o,s3:s}=We(t,n[0],n[1],n[2],n[3]);return n[0]=r,n[1]=i,n[2]=o,n[3]=s,e}function Fd(t,e){if((0,be.bytes)(e,16),!Ud(t))throw new Error("_decryptBlock accepts result of expandKeyLE");const n=(0,ee.u32)(e);let{s0:r,s1:i,s2:o,s3:s}=Pr(t,n[0],n[1],n[2],n[3]);return n[0]=r,n[1]=i,n[2]=o,n[3]=s,e}Ae.siv=(0,ee.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16},function(t,e,n){const r=ci("AAD",0,68719476736),i=ci("plaintext",0,2**36),o=ci("nonce",12,12),s=ci("ciphertext",16,2**36+16);function a(){const u=_t(t),d=new Uint8Array(t.length),h=new Uint8Array(16),f=[u,d];let g=e;(0,ee.isAligned32)(g)||f.push(g=(0,ee.copyBytes)(g));const m=(0,ee.u32)(g);let w=0,p=m[0],k=m[1],_=m[2],O=0;for(const U of[h,d].map(ee.u32)){const W=(0,ee.u32)(U);for(let V=0;V<W.length;V+=2){const{s0:H,s1:K}=We(u,w,p,k,_);W[V+0]=H,W[V+1]=K,w=++O}}const N={authKey:h,encKey:_t(d)};return(0,ee.clean)(...f),N}function c(u,d,h){const f=Kd(Bs.polyval,!0,d,h,n);for(let _=0;_<12;_++)f[_]^=e[_];f[15]&=127;const g=(0,ee.u32)(f);let m=g[0],w=g[1],p=g[2],k=g[3];return{s0:m,s1:w,s2:p,s3:k}=We(u,m,w,p,k),g[0]=m,g[1]=w,g[2]=p,g[3]=k,f}function l(u,d,h){let f=(0,ee.copyBytes)(d);f[15]|=128;const g=Gn(u,!0,f,h);return(0,ee.clean)(f),g}return(0,be.bytes)(t,16,24,32),(0,be.bytes)(e),o(e.length),n!==void 0&&((0,be.bytes)(n),r(n.length)),{encrypt
8(u){(0,be.bytes)(u),i(u.length);const{encKey:d,authKey:h}=a(),f=c(d,h,u),g=[d,h,f];(0,ee.isAligned32)(u)||g.push(u=(0,ee.copyBytes)(u));const m=new Uint8Array(u.length+16);return m.set(f,u.length),m.set(l(d,f,u)),(0,ee.clean)(...g),m},decrypt(u){(0,be.bytes)(u),s(u.length);const d=u.subarray(-16),{encKey:h,authKey:f}=a(),g=[h,f];(0,ee.isAligned32)(u)||g.push(u=(0,ee.copyBytes)(u));const m=l(h,d,u.subarray(0,-16)),w=c(h,f,m);if(g.push(w),!(0,ee.equalBytes)(d,w))throw(0,ee.clean)(...g),new Error("invalid polyval tag");return(0,ee.clean)(...g),m}}});const Gi={encrypt(t,e){if(e.length>=2**32)throw new Error("plaintext should be less than 4gb");const n=_t(t);if(e.length===16)Hd(n,e);else{const r=(0,ee.u32)(e);let i=r[0],o=r[1];for(let s=0,a=1;s<6;s++)for(let c=2;c<r.length;c+=2,a++){const{s0:l,s1:u,s2:d,s3:h}=We(n,i,o,r[c],r[c+1]);i=l,o=u^Wi(a),r[c]=d,r[c+1]=h}r[0]=i,r[1]=o}n.fill(0)},decrypt(t,e){if(e.length-8>=2**32)throw new Error("ciphertext should be less than 4gb");const n=Lr(t),r=e.length/8-1;if(r===1)Fd(n,e);else{const i=(0,ee.u32)(e);let o=i[0],s=i[1];for(let a=0,c=6*r;a<6;a++)for(let l=2*r;l>=1;l-=2,c--){s^=Wi(c);const{s0:u,s1:d,s2:h,s3:f}=Pr(n,o,s,i[l],i[l+1]);o=u,s=d,i[l]=h,i[l+1]=f}i[0]=o,i[1]=s}n.fill(0)}},Dc=new Uint8Array(8).fill(166);Ae.aeskw=(0,ee.wrapCipher)({blockSize:8},t=>({encrypt(e){if((0,be.bytes)(e),!e.length||e.length%8!=0)throw new Error("invalid plaintext length");if(e.length===8)throw new Error("8-byte keys not allowed in AESKW, use AESKWP instead");const n=(0,ee.concatBytes)(Dc,e);return Gi.encrypt(t,n),n},decrypt(e){if((0,be.bytes)(e),e.length%8!=0||e.length<24)throw new Error("invalid ciphertext length");const n=(0,ee.copyBytes)(e);if(Gi.decrypt(t,n),!(0,ee.equalBytes)(n.subarray(0,8),Dc))throw new Error("integrity check failed");return n.subarray(0,8).fill(0),n.subarray(8)}}));const $c=2790873510;Ae.aeskwp=(0,ee.wrapCipher)({blockSize:8},t=>({encrypt(e){if((0,be.bytes)(e),!e.length)throw new Error("invalid plaintext length");const n=8*Math.ceil(e.length/8),r=new Uint8Array(8+n);r.set(e,8);const i=(0,ee.u32)(r);return i[0]=$c,i[1]=Wi(e.length),Gi.encrypt(t,r),r},decrypt(e){if((0,be.bytes)(e),e.length<16)throw new Error("invalid ciphertext length");const n=(0,ee.copyBytes)(e),r=(0,ee.u32)(n);Gi.decrypt(t,n);const i=Wi(r[1])>>>0,o=8*Math.ceil(i/8);if(r[0]!==$c||n.length-8!==o)throw new Error("integrity check failed");for(let s=i;s<o;s++)if(n[8+s]!==0)throw new Error("integrity check failed");return n.subarray(0,8).fill(0),n.subarray(8,8+i)}})),Ae.unsafe={expandKeyLE:_t,expandKeyDecLE:Lr,encrypt:We,decrypt:Pr,encryptBlock:Hd,decryptBlock:Fd,ctrCounter:jd,ctr32:Gn},Object.defineProperty(Xn,"__esModule",{value:!0}),Xn.aes256cbc=Xn.aes256gcm=void 0;var zd=Ae;Xn.aes256gcm=function(t,e,n){return(0,zd.gcm)(t,e,n)};Xn.aes256cbc=function(t,e,n){return(0,zd.cbc)(t,e)};var Yi={},qd={},Yn={};Object.defineProperty(Yn,"__esModule",{value:!0}),Yn.sigma=void 0,Yn.rotl=function(t,e){return t<<e|t>>>32-e},Yn.createCipher=function(t,e){const{allowShortKeys:n,extendNonceFn:r,counterLength:i,counterRight:o,rounds:s}=(0,ht.checkOpts)({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},e);if(typeof t!="function")throw new Error("core must be a function");return(0,Ut.number)(i),(0,Ut.number)(s),(0,Ut.bool)(o),(0,Ut.bool)(n),(a,c,l,u,d=0)=>{(0,Ut.bytes)(a),(0,Ut.bytes)(c),(0,Ut.bytes)(l);const h=l.length;if(u===void 0&&(u=new Uint8Array(h)),(0,Ut.bytes)(u),(0,Ut.number)(d),d<0||d>=jc)throw new Error("arx: counter overflow");if(u.length<h)throw new Error(`arx: output (${u.length}) is shorter than data (${h})`);const f=[];let g,m,w=a.length;if(w===32)f.push(g=(0,ht.copyBytes)(a)),m=Wd;else{if(w!==16||!n)throw new Error(`arx: invalid 32-byte key, got length=${w}`);g=new Uint8Array(32),g.set(a),g.set(a,16),m=A1,f.push(g)}Yo(c)||f.push(c=(0,ht.copyBytes)(c));const p=(0,ht.u32)(g);if(r){if(c.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(m,p,(0,ht.u32)(c.subarray(0,16)),p),c=c.subarray(16)}const k=16-i;if(k!==c.length)throw new Error(`arx: nonce must be ${k} or 16 bytes`);
8if(k!==12){const O=new Uint8Array(12);O.set(c,o?0:12-c.length),c=O,f.push(c)}const _=(0,ht.u32)(c);return function(O,N,U,W,V,H,K,Y){const j=V.length,B=new Uint8Array(li),R=(0,ht.u32)(B),C=Yo(V)&&Yo(H),L=C?(0,ht.u32)(V):Kc,$=C?(0,ht.u32)(H):Kc;for(let y=0;y<j;K++){if(O(N,U,W,R,K,Y),K>=jc)throw new Error("arx: counter overflow");const E=Math.min(li,j-y);if(C&&E===li){const A=y/4;if(y%4!=0)throw new Error("arx: invalid block position");for(let M,b=0;b<M1;b++)M=A+b,$[M]=L[M]^R[b];y+=li}else{for(let A,M=0;M<E;M++)A=y+M,H[A]=V[A]^B[M];y+=E}}}(t,m,p,_,l,u,d,s),(0,ht.clean)(...f),u}};const Ut=He,ht=at,Vd=t=>Uint8Array.from(t.split("").map(e=>e.charCodeAt(0))),k1=Vd("expand 16-byte k"),x1=Vd("expand 32-byte k"),A1=(0,ht.u32)(k1),Wd=(0,ht.u32)(x1);function Yo(t){return t.byteOffset%4==0}Yn.sigma=Wd.slice();const li=64,M1=16,jc=2**32-1,Kc=new Uint32Array;var _r={};Object.defineProperty(_r,"__esModule",{value:!0}),_r.poly1305=void 0,_r.wrapConstructorWithKey=Gd;const ui=He,vr=at,Be=(t,e)=>255&t[e++]|(255&t[e++])<<8;class T1{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,vr.toBytes)(e),(0,ui.bytes)(e,32);const n=Be(e,0),r=Be(e,2),i=Be(e,4),o=Be(e,6),s=Be(e,8),a=Be(e,10),c=Be(e,12),l=Be(e,14);this.r[0]=8191&n,this.r[1]=8191&(n>>>13|r<<3),this.r[2]=7939&(r>>>10|i<<6),this.r[3]=8191&(i>>>7|o<<9),this.r[4]=255&(o>>>4|s<<12),this.r[5]=s>>>1&8190,this.r[6]=8191&(s>>>14|a<<2),this.r[7]=8065&(a>>>11|c<<5),this.r[8]=8191&(c>>>8|l<<8),this.r[9]=l>>>5&127;for(let u=0;u<8;u++)this.pad[u]=Be(e,16+2*u)}process(e,n,r=!1){const i=r?0:2048,{h:o,r:s}=this,a=s[0],c=s[1],l=s[2],u=s[3],d=s[4],h=s[5],f=s[6],g=s[7],m=s[8],w=s[9],p=Be(e,n+0),k=Be(e,n+2),_=Be(e,n+4),O=Be(e,n+6),N=Be(e,n+8),U=Be(e,n+10),W=Be(e,n+12),V=Be(e,n+14);let H=o[0]+(8191&p),K=o[1]+(8191&(p>>>13|k<<3)),Y=o[2]+(8191&(k>>>10|_<<6)),j=o[3]+(8191&(_>>>7|O<<9)),B=o[4]+(8191&(O>>>4|N<<12)),R=o[5]+(N>>>1&8191),C=o[6]+(8191&(N>>>14|U<<2)),L=o[7]+(8191&(U>>>11|W<<5)),$=o[8]+(8191&(W>>>8|V<<8)),y=o[9]+(V>>>5|i),E=0,A=E+H*a+K*(5*w)+Y*(5*m)+j*(5*g)+B*(5*f);E=A>>>13,A&=8191,A+=R*(5*h)+C*(5*d)+L*(5*u)+$*(5*l)+y*(5*c),E+=A>>>13,A&=8191;let M=E+H*c+K*a+Y*(5*w)+j*(5*m)+B*(5*g);E=M>>>13,M&=8191,M+=R*(5*f)+C*(5*h)+L*(5*d)+$*(5*u)+y*(5*l),E+=M>>>13,M&=8191;let b=E+H*l+K*c+Y*a+j*(5*w)+B*(5*m);E=b>>>13,b&=8191,b+=R*(5*g)+C*(5*f)+L*(5*h)+$*(5*d)+y*(5*u),E+=b>>>13,b&=8191;let v=E+H*u+K*l+Y*c+j*a+B*(5*w);E=v>>>13,v&=8191,v+=R*(5*m)+C*(5*g)+L*(5*f)+$*(5*h)+y*(5*d),E+=v>>>13,v&=8191;let S=E+H*d+K*u+Y*l+j*c+B*a;E=S>>>13,S&=8191,S+=R*(5*w)+C*(5*m)+L*(5*g)+$*(5*f)+y*(5*h),E+=S>>>13,S&=8191;let x=E+H*h+K*d+Y*u+j*l+B*c;E=x>>>13,x&=8191,x+=R*a+C*(5*w)+L*(5*m)+$*(5*g)+y*(5*f),E+=x>>>13,x&=8191;let T=E+H*f+K*h+Y*d+j*u+B*l;E=T>>>13,T&=8191,T+=R*c+C*a+L*(5*w)+$*(5*m)+y*(5*g),E+=T>>>13,T&=8191;let I=E+H*g+K*f+Y*h+j*d+B*u;E=I>>>13,I&=8191,I+=R*l+C*c+L*a+$*(5*w)+y*(5*m),E+=I>>>13,I&=8191;let D=E+H*m+K*g+Y*f+j*h+B*d;E=D>>>13,D&=8191,D+=R*u+C*l+L*c+$*a+y*(5*w),E+=D>>>13,D&=8191;let F=E+H*w+K*m+Y*g+j*f+B*h;E=F>>>13,F&=8191,F+=R*d+C*u+L*l+$*c+y*a,E+=F>>>13,F&=8191,E=(E<<2)+E|0,E=E+A|0,A=8191&E,E>>>=13,M+=E,o[0]=A,o[1]=M,o[2]=b,o[3]=v,o[4]=S,o[5]=x,o[6]=T,o[7]=I,o[8]=D,o[9]=F}finalize(){const{h:e,pad:n}=this,r=new Uint16Array(10);let i=e[1]>>>13;e[1]&=8191;for(let a=2;a<10;a++)e[a]+=i,i=e[a]>>>13,e[a]&=8191;e[0]+=5*i,i=e[0]>>>13,e[0]&=8191,e[1]+=i,i=e[1]>>>13,e[1]&=8191,e[2]+=i,r[0]=e[0]+5,i=r[0]>>>13,r[0]&=8191;for(let a=1;a<10;a++)r[a]=e[a]+i,i=r[a]>>>13,r[a]&=8191;r[9]-=8192;let o=(1^i)-1;for(let a=0;a<10;a++)r[a]&=o;o=~o;for(let a=0;a<10;a++)e[a]=e[a]&o|r[a];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 s=e[0]+n[0];e[0]=65535&s;for(let a=1;a<8;a++)s=(e[a]+n[a]|0)+(s>>>16)|0,e[a]=65535&s;(0,vr.clean)(r)}update(e){(0,ui.exists)(this);const{buffer:n,blockLen:r}=this,i=(e=(0,vr.toBytes)(e)).length;for(let o=0;o<i;){const s=Math.min(r-this.pos,i-o);if(s!==r)n.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(n,0,!1),this.pos=0);else for(;r<=i-o;o+=r)this.process(e,o)}return this}destroy(){(0,vr.clean)(this.h,this.r,this.buffer,this.pad)}digestInto(e){(0,ui.exists)(this),(0,ui.output)(e,this),this.finished=!0;const{buffer:n,h:r}=this;let{pos:i}=this;if(i){for(n[i++]=1;i<16;i++)n[i]=0;this.process(n,0,!0)}this.finalize();let o=0;for(let s=0;s<8;s++)e[o++]=r[s]>>>0,e[o++]=r[s]>>>8;return e}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}}function Gd(t){const e=(r,i)=>t(i).update((0,vr.toBytes)(r)).digest(),n=t(new Uint8Array(32));return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=r=>t(r),e}_r.poly1305=Gd(t=>
8new T1(t)),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.xchacha20poly1305=t.chacha20poly1305=t._poly1305_aead=t.chacha12=t.chacha8=t.xchacha20=t.chacha20=t.chacha20orig=void 0,t.hchacha=s;const e=Yn,n=He,r=_r,i=at;function o(d,h,f,g,m,w=20){let p=d[0],k=d[1],_=d[2],O=d[3],N=h[0],U=h[1],W=h[2],V=h[3],H=h[4],K=h[5],Y=h[6],j=h[7],B=m,R=f[0],C=f[1],L=f[2],$=p,y=k,E=_,A=O,M=N,b=U,v=W,S=V,x=H,T=K,I=Y,D=j,F=B,z=R,Z=C,Q=L;for(let se=0;se<w;se+=2)$=$+M|0,F=(0,e.rotl)(F^$,16),x=x+F|0,M=(0,e.rotl)(M^x,12),$=$+M|0,F=(0,e.rotl)(F^$,8),x=x+F|0,M=(0,e.rotl)(M^x,7),y=y+b|0,z=(0,e.rotl)(z^y,16),T=T+z|0,b=(0,e.rotl)(b^T,12),y=y+b|0,z=(0,e.rotl)(z^y,8),T=T+z|0,b=(0,e.rotl)(b^T,7),E=E+v|0,Z=(0,e.rotl)(Z^E,16),I=I+Z|0,v=(0,e.rotl)(v^I,12),E=E+v|0,Z=(0,e.rotl)(Z^E,8),I=I+Z|0,v=(0,e.rotl)(v^I,7),A=A+S|0,Q=(0,e.rotl)(Q^A,16),D=D+Q|0,S=(0,e.rotl)(S^D,12),A=A+S|0,Q=(0,e.rotl)(Q^A,8),D=D+Q|0,S=(0,e.rotl)(S^D,7),$=$+b|0,Q=(0,e.rotl)(Q^$,16),I=I+Q|0,b=(0,e.rotl)(b^I,12),$=$+b|0,Q=(0,e.rotl)(Q^$,8),I=I+Q|0,b=(0,e.rotl)(b^I,7),y=y+v|0,F=(0,e.rotl)(F^y,16),D=D+F|0,v=(0,e.rotl)(v^D,12),y=y+v|0,F=(0,e.rotl)(F^y,8),D=D+F|0,v=(0,e.rotl)(v^D,7),E=E+S|0,z=(0,e.rotl)(z^E,16),x=x+z|0,S=(0,e.rotl)(S^x,12),E=E+S|0,z=(0,e.rotl)(z^E,8),x=x+z|0,S=(0,e.rotl)(S^x,7),A=A+M|0,Z=(0,e.rotl)(Z^A,16),T=T+Z|0,M=(0,e.rotl)(M^T,12),A=A+M|0,Z=(0,e.rotl)(Z^A,8),T=T+Z|0,M=(0,e.rotl)(M^T,7);let ne=0;g[ne++]=p+$|0,g[ne++]=k+y|0,g[ne++]=_+E|0,g[ne++]=O+A|0,g[ne++]=N+M|0,g[ne++]=U+b|0,g[ne++]=W+v|0,g[ne++]=V+S|0,g[ne++]=H+x|0,g[ne++]=K+T|0,g[ne++]=Y+I|0,g[ne++]=j+D|0,g[ne++]=B+F|0,g[ne++]=R+z|0,g[ne++]=C+Z|0,g[ne++]=L+Q|0}function s(d,h,f,g){let m=d[0],w=d[1],p=d[2],k=d[3],_=h[0],O=h[1],N=h[2],U=h[3],W=h[4],V=h[5],H=h[6],K=h[7],Y=f[0],j=f[1],B=f[2],R=f[3];for(let L=0;L<20;L+=2)m=m+_|0,Y=(0,e.rotl)(Y^m,16),W=W+Y|0,_=(0,e.rotl)(_^W,12),m=m+_|0,Y=(0,e.rotl)(Y^m,8),W=W+Y|0,_=(0,e.rotl)(_^W,7),w=w+O|0,j=(0,e.rotl)(j^w,16),V=V+j|0,O=(0,e.rotl)(O^V,12),w=w+O|0,j=(0,e.rotl)(j^w,8),V=V+j|0,O=(0,e.rotl)(O^V,7),p=p+N|0,B=(0,e.rotl)(B^p,16),H=H+B|0,N=(0,e.rotl)(N^H,12),p=p+N|0,B=(0,e.rotl)(B^p,8),H=H+B|0,N=(0,e.rotl)(N^H,7),k=k+U|0,R=(0,e.rotl)(R^k,16),K=K+R|0,U=(0,e.rotl)(U^K,12),k=k+U|0,R=(0,e.rotl)(R^k,8),K=K+R|0,U=(0,e.rotl)(U^K,7),m=m+O|0,R=(0,e.rotl)(R^m,16),H=H+R|0,O=(0,e.rotl)(O^H,12),m=m+O|0,R=(0,e.rotl)(R^m,8),H=H+R|0,O=(0,e.rotl)(O^H,7),w=w+N|0,Y=(0,e.rotl)(Y^w,16),K=K+Y|0,N=(0,e.rotl)(N^K,12),w=w+N|0,Y=(0,e.rotl)(Y^w,8),K=K+Y|0,N=(0,e.rotl)(N^K,7),p=p+U|0,j=(0,e.rotl)(j^p,16),W=W+j|0,U=(0,e.rotl)(U^W,12),p=p+U|0,j=(0,e.rotl)(j^p,8),W=W+j|0,U=(0,e.rotl)(U^W,7),k=k+_|0,B=(0,e.rotl)(B^k,16),V=V+B|0,_=(0,e.rotl)(_^V,12),k=k+_|0,B=(0,e.rotl)(B^k,8),V=V+B|0,_=(0,e.rotl)(_^V,7);let C=0;g[C++]=m,g[C++]=w,g[C++]=p,g[C++]=k,g[C++]=Y,g[C++]=j,g[C++]=B,g[C++]=R}t.chacha20orig=(0,e.createCipher)(o,{counterRight:!1,counterLength:8,allowShortKeys:!0}),t.chacha20=(0,e.createCipher)(o,{counterRight:!1,counterLength:4,allowShortKeys:!1}),t.xchacha20=(0,e.createCipher)(o,{counterRight:!1,counterLength:8,extendNonceFn:s,allowShortKeys:!1}),t.chacha8=(0,e.createCipher)(o,{counterRight:!1,counterLength:4,rounds:8}),t.chacha12=(0,e.createCipher)(o,{counterRight:!1,counterLength:4,rounds:12});const a=new Uint8Array(16),c=(d,h)=>{d.update(h);const f=h.length%16;f&&d.update(a.subarray(f))},l=new Uint8Array(32);function u(d,h,f,g,m){const w=d(h,f,l),p=r.poly1305.create(w);m&&c(p,m),c(p,g);const k=new Uint8Array(16),_=(0,i.createView)(k);(0,i.setBigUint64)(_,0,BigInt(m?m.length:0),!0),(0,i.setBigUint64)(_,8,BigInt(g.length),!0),p.update(k);const O=p.digest();return(0,i.clean)(w,k),O}t._poly1305_aead=d=>(h,f,g)=>((0,n.bytes)(h,32),(0,n.bytes)(f),{encrypt(w,p){const k=w.length,_=k+16;p?(0,n.bytes)(p,_):p=new Uint8Array(_),d(h,f,w,p,1);const O=u(d,h,f,p.subarray(0,-16),g);return p.set(O,k),(0,i.clean)(O),p},decrypt(w,p){const k=w.length,_=k-16;if(k<16)throw new Error("encrypted data must be at least 16 bytes");p?(0,n.bytes)(p,_):p=new Uint8Array(_);const O=w.subarray(0,-16),N=w.subarray(-16),U=u(d,h,f,O,g);if(!(0,i.equalBytes)(N,U))throw new Error("invalid tag");return d(h,f,O,p,1),(0,i.clean)(U),p}}),t.chacha20poly1305=(0,i.wrapCipher)({blockSize:64,nonceLength:12,tagLength:16},(0,t._poly1305_aead)(t.chacha20)),t.xchacha20poly1305=(0,i.wrapCipher)({blockSize:64,nonceLength:24,tagLength:16},(0,t._poly1305_aead)(t.xchacha20))}(qd),Object.defineProperty(Yi,"__esModule",{value:!0}),Yi.xchacha20=void 0;var Kn,Uc,fr,R1=qd;Yi.xchacha20=function(t,e,n){return(0,R1.xchacha20poly1305)(t,e,n)}
8,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.aesDecrypt=t.aesEncrypt=t.symDecrypt=t.symEncrypt=void 0;var e=at,n=fa,r=Xn,i=Yi,o=Rr,s=Pe;t.symEncrypt=function(u,d,h){return a(c,u,d,h)};function a(u,d,h,f){var g=(0,o.symmetricAlgorithm)();if(g==="aes-256-gcm")return u(r.aes256gcm,d,h,(0,o.symmetricNonceLength)(),s.AEAD_TAG_LENGTH,f);if(g==="xchacha20")return u(i.xchacha20,d,h,s.XCHACHA20_NONCE_LENGTH,s.AEAD_TAG_LENGTH,f);if(g==="aes-256-cbc")return u(r.aes256cbc,d,h,16,0);throw new Error("Not implemented")}function c(u,d,h,f,g,m){var w=(0,n.randomBytes)(f),p=u(d,w,m).encrypt(h);if(g===0)return(0,e.concatBytes)(w,p);var k=p.length-g,_=p.subarray(0,k),O=p.subarray(k);return(0,e.concatBytes)(w,O,_)}function l(u,d,h,f,g,m){var w=h.subarray(0,f),p=u(d,Uint8Array.from(w),m),k=h.subarray(f);if(g===0)return p.decrypt(k);var _=k.subarray(0,g),O=k.subarray(g);return p.decrypt((0,e.concatBytes)(O,_))}t.symDecrypt=function(u,d,h){return a(l,u,d,h)},t.aesEncrypt=t.symEncrypt,t.aesDecrypt=t.symDecrypt}(Oc),Kn=bo,Uc=yt&&yt.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),fr=yt&&yt.__exportStar||function(t,e){for(var n in t)n==="default"||Object.prototype.hasOwnProperty.call(e,n)||Uc(e,t,n)},Object.defineProperty(Kn,"__esModule",{value:!0}),fr(Zu,Kn),fr(Od,Kn),fr(Is,Kn),fr(Oc,Kn);var Ir={};Object.defineProperty(Ir,"__esModule",{value:!0}),Ir.PublicKey=void 0;var Hc=at,di=bo,O1=function(){function t(e){this.data=(0,di.convertPublicKeyFormat)(e,!0)}return t.fromHex=function(e){return new t((0,di.hexToPublicKey)(e))},Object.defineProperty(t.prototype,"uncompressed",{get:function(){return J.from((0,di.convertPublicKeyFormat)(this.data,!1))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"compressed",{get:function(){return J.from(this.data)},enumerable:!1,configurable:!0}),t.prototype.toHex=function(e){return e===void 0&&(e=!0),(0,Hc.bytesToHex)(e?this.data:this.uncompressed)}
8,t.prototype.decapsulate=function(e,n){n===void 0&&(n=!1);var r=n?this.data:this.uncompressed,i=e.multiply(this,n);return(0,di.getSharedKey)(r,i)},t.prototype.equals=function(e){return(0,Hc.equalBytes)(this.data,e.data)},t}();Ir.PublicKey=O1,Object.defineProperty(Fi,"__esModule",{value:!0}),Fi.PrivateKey=void 0;var Fc=at,Un=bo,L1=Ir,P1=function(){function t(e){if(e===void 0)this.data=(0,Un.getValidSecret)();else{if(!(0,Un.isValidPrivateKey)(e))throw new Error("Invalid private key");this.data=e}this.publicKey=new L1.PublicKey((0,Un.getPublicKey)(this.data))}return t.fromHex=function(e){return new t((0,Un.decodeHex)(e))},Object.defineProperty(t.prototype,"secret",{get:function(){return J.from(this.data)},enumerable:!1,configurable:!0}),t.prototype.toHex=function(){return(0,Fc.bytesToHex)(this.data)},t.prototype.encapsulate=function(e,n){n===void 0&&(n=!1);var r=n?this.publicKey.compressed:this.publicKey.uncompressed,i=this.multiply(e,n);return(0,Un.getSharedKey)(r,i)},t.prototype.multiply=function(e,n){return n===void 0&&(n=!1),(0,Un.getSharedPoint)(this.data,e.compressed,n)},t.prototype.equals=function(e){return(0,Fc.equalBytes)(this.data,e.data)},t}();Fi.PrivateKey=P1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.PublicKey=t.PrivateKey=void 0;var e=Fi;Object.defineProperty(t,"PrivateKey",{enumerable:!0,get:function(){return e.PrivateKey}});var n=Ir;Object.defineProperty(t,"PublicKey",{enumerable:!0,get:function(){return n.PublicKey}})}(Io),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.PublicKey=t.PrivateKey=t.ECIES_CONFIG=void 0,t.encrypt=function(a,c){var l=new r.PrivateKey,u=a instanceof Uint8Array?new r.PublicKey(a):r.PublicKey.fromHex(a),d=l.encapsulate(u,(0,n.isHkdfKeyCompressed)()),h=(0,n.isEphemeralKeyCompressed)()?l.publicKey.compressed:l.publicKey.uncompressed,f=(0,i.symEncrypt)(d,c);return J.from((0,e.concatBytes)(h,f))},t.decrypt=function(a,c){var l=a instanceof Uint8Array?new r.PrivateKey(a):r.PrivateKey.fromHex(a),u=(0,n.ephemeralKeySize)(),d=new r.PublicKey(c.subarray(0,u)),h=c.subarray(u),f=d.decapsulate(l,(0,n.isHkdfKeyCompressed)());return J.from((0,i.symDecrypt)(f,h))};var e=at,n=Rr,r=Io,i=bo,o=Rr;Object.defineProperty(t,"ECIES_CONFIG",{enumerable:!0,get:function(){return o.ECIES_CONFIG}});var s=Io;Object.defineProperty(t,"PrivateKey",{enumerable:!0,get:function(){return s.PrivateKey}}),Object.defineProperty(t,"PublicKey",{enumerable:!0,get:function(){return s.PublicKey}}),t.utils={aesEncrypt:i.aesEncrypt,aesDecrypt:i.aesDecrypt,symEncrypt:i.symEncrypt,symDecrypt:i.symDecrypt,decodeHex:i.decodeHex,getValidSecret:i.getValidSecret,remove0x:i.remove0x}}(Fn);const Yd=Ge("KeyExchange:Layer"),Zd=Ge("SocketService:Layer"),Jd=Ge("Ecies:Layer"),Xd=Ge("RemoteCommunication:Layer");Yd.color="##95c44e",Zd.color="#f638d7",Jd.color="#465b9c",Xd.color="#47a2be";const q={KeyExchange:Yd,SocketService:Zd,Ecies:Jd,RemoteCommunication:Xd};let pr,hi=[],Zo=[];const Jt=(t,e)=>X(void 0,void 0,void 0,function*(){pr=e,Zo.push(t),function(n){return X(this,void 0,void 0,function*(){if(!pr||!n)return;(function(){const s=Zo;Zo=hi,hi=s})();const r=pr.endsWith("/")?`${pr}evt`:`${pr}/evt`,i=Object.assign({},n);if(delete i.params,n.params)for(const[s,a]of Object.entries(n.params))i[s]=a;const o=JSON.stringify(i);q.RemoteCommunication(`[sendBufferedEvents] Sending ${hi.length} analytics events to ${r}`);try{const s=yield bu(r,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:o}),a=yield s.text();q.RemoteCommunication(`[sendBufferedEvents] Response: ${a}`),hi.length=0}catch{}})}(t).catch(()=>{})});class Jo{constructor(e){this.enabled=!0,e!=null&&e.debug&&Ge.enable("Ecies:Layer"),this.ecies=e!=null&&e.privateKey?Fn.PrivateKey.fromHex(e.privateKey):new Fn.PrivateKey,q.Ecies("[ECIES constructor()] initialized secret: ",this.ecies.toHex()),q.Ecies("[ECIES constructor()] initialized public: ",this.ecies.publicKey.toHex()),q.Ecies("[ECIES constructor()] init with",this)}generateECIES(){this.ecies=new Fn.PrivateKey}getPublicKey(){return this.ecies.publicKey.toHex()}encrypt(e,n){let r=e;if(this.enabled)try{q.Ecies("[ECIES: encrypt()] using otherPublicKey",n);
8const i=J.from(e),o=Fn.encrypt(n,i);r=J.from(o).toString("base64")}catch(i){throw q.Ecies("[ECIES: encrypt()] error encrypt:",i),q.Ecies("[ECIES: encrypt()] private: ",this.ecies.toHex()),q.Ecies("[ECIES: encrypt()] data: ",e),q.Ecies("[ECIES: encrypt()] otherkey: ",n),i}return r}decrypt(e){let n=e;if(this.enabled)try{q.Ecies("[ECIES: decrypt()] using privateKey",this.ecies.toHex());const r=J.from(e.toString(),"base64");n=Fn.decrypt(this.ecies.toHex(),r).toString()}catch(r){throw q.Ecies("[ECIES: decrypt()] error decrypt",r),q.Ecies("[ECIES: decrypt()] private: ",this.ecies.toHex()),q.Ecies("[ECIES: decrypt()] encryptedData: ",e),r}return n}getKeyInfo(){return{private:this.ecies.toHex(),public:this.ecies.publicKey.toHex()}}toString(){q.Ecies("[ECIES: toString()]",this.getKeyInfo())}}var En={name:"@metamask/sdk-communication-layer",version:"0.32.0",description:"",homepage:"https://github.com/MetaMask/metamask-sdk#readme",bugs:{url:"https://github.com/MetaMask/metamask-sdk/issues"},repository:{type:"git",url:"https://github.com/MetaMask/metamask-sdk.git",directory:"packages/sdk-communication-layer"},main:"dist/node/cjs/metamask-sdk-communication-layer.js",unpkg:"dist/browser/umd/metamask-sdk-communication-layer.js",module:"dist/node/es/metamask-sdk-communication-layer.js",browser:"dist/browser/es/metamask-sdk-communication-layer.js","react-native":"dist/react-native/es/metamask-sdk-communication-layer.js",types:"dist/types/src/index.d.ts",files:["/dist"],scripts:{"build:types":"tsc --project tsconfig.build.json --emitDeclarationOnly --outDir dist/types","build:clean":"yarn clean && yarn build",build:"yarn build:types && rollup -c --bundleConfigAsCjs","build:dev":"yarn build:types && NODE_ENV=dev rollup -c --bundleConfigAsCjs",dev:'concurrently "tsc --watch" "rollup -c --bundleConfigAsCjs -w"',"build:post-tsc":"echo 'N/A'","build:pre-tsc":"echo 'N/A'",size:"size-limit",clean:"rimraf ./dist",lint:"yarn lint:eslint && yarn lint:misc --check","lint:changelog":"../../scripts/validate-changelog.sh @metamask/sdk-communication-layer","lint:eslint":"eslint . --cache --ext js,ts","lint:fix":"yarn lint:eslint --fix && yarn lint:misc --write","lint:misc":"prettier '**/*.json' '**/*.md' '!CHANGELOG.md' --ignore-path ../../.gitignore","publish:preview":"yarn npm publish --tag preview",prepack:"../../scripts/prepack.sh",reset:"yarn clean && rimraf ./node_modules/",test:'jest --testPathIgnorePatterns "/e2e/"',"test:e2e":'jest --testPathPattern "/e2e/"',"test:coverage":"jest --coverage","test:ci":'jest --coverage --passWithNoTests --setupFilesAfterEnv ./jest-preload.js --testPathIgnorePatterns "/e2e/"',"test:dev":"jest",watch:"rollup -c --bundleConfigAsCjs -w"},dependencies:{bufferutil:"^4.0.8","date-fns":"^2.29.3",debug:"^4.3.4","utf-8-validate":"^5.0.2",uuid:"^8.3.2"},devDependencies:{"@jest/globals":"^29.3.1","@lavamoat/allow-scripts":"^2.3.1","@metamask/auto-changelog":"3.1.0","@metamask/eslint-config":"^6.0.0","@metamask/eslint-config-nodejs":"^6.0.0","@metamask/eslint-config-typescript":"^6.0.0","@rollup/plugin-commonjs":"^25.0.0","@rollup/plugin-json":"^6.0.0","@rollup/plugin-node-resolve":"^15.0.2","@rollup/plugin-replace":"^6.0.1","@rollup/plugin-terser":"^0.4.4","@size-limit/preset-big-lib":"^11.0.2","@types/jest":"^29.2.4","@types/node":"^20.1.3","@types/uuid":"^9.0.0","@typescript-eslint/eslint-plugin":"^4.26.0","@typescript-eslint/parser":"^4.26.0",concurrently:"^9.1.2","cross-fetch":"^4.0.0",eciesjs:"^0.4.11",eslint:"^7.30.0","eslint-config-prettier":"^8.3.0","eslint-plugin-import":"^2.23.4","eslint-plugin-jest":"^24.4.0","eslint-plugin-jsdoc":"^36.1.0","eslint-plugin-node":"^11.1.0","eslint-plugin-prettier":"^3.4.0",eventemitter2:"^6.4.9",jest:"^29.3.1",prettier:"^2.3.0",rimraf:"^3.0.2",rollup:"^4.26.0","rollup-plugin-jscc":"^2.0.0","rollup-plugin-natives":"^0.7.5","rollup-plugin-node-builtins":"^2.1.2","rollup-plugin-node-globals":"^1.4.0","rollup-plugin-peer-deps-external":"^2.2.4","rollup-plugin-polyfill-node":"^0.13.0","rollup-plugin-sizes":"^1.0.6","rollup-plugin-typescript2":"^0.31.2","rollup-plugin-visualizer":"^5.12.0","size-limit":"^11.1.6","socket.io-client":"^4.5.1","stream-browserify":"^3.0.0","ts-jest":"^29.0.3","ts-node":"^10.9.1",typescript:"^5.6.3"}
8,peerDependencies:{"cross-fetch":"^4.0.0",eciesjs:"*",eventemitter2:"^6.4.9","readable-stream":"^3.6.2","socket.io-client":"^4.5.1"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},lavamoat:{allowScripts:{"@lavamoat/preinstall-always-fail":!1,canvas:!0,"eciesjs>secp256k1":!1,"socket.io-client>engine.io-client>ws>bufferutil":!1,"socket.io-client>engine.io-client>ws>utf-8-validate":!1,bufferutil:!1,"utf-8-validate":!1}}};const rr="https://metamask-sdk.api.cx.metamask.io/",I1=["websocket"],ir=6048e5,N1=3e3,B1={METAMASK_GETPROVIDERSTATE:"metamask_getProviderState",ETH_REQUESTACCOUNTS:"eth_requestAccounts"};function Qd(t){const{context:e}=t;q.RemoteCommunication(`[RemoteCommunication: clean()] context=${e}`),t.channelConfig=void 0,t.ready=!1,t.originatorConnectStarted=!1}var je,te,Zi,Ce,xe,Te,Hn;(Hn=je||(je={})).DISCONNECTED="disconnected",Hn.WAITING="waiting",Hn.TIMEOUT="timeout",Hn.LINKED="linked",Hn.PAUSED="paused",Hn.TERMINATED="terminated",function(t){t.KEY_INFO="key_info",t.SERVICE_STATUS="service_status",t.PROVIDER_UPDATE="provider_update",t.RPC_UPDATE="rpc_update",t.KEYS_EXCHANGED="keys_exchanged",t.JOIN_CHANNEL="join_channel",t.PUBLIC_KEY="public_key",t.CHANNEL_CREATED="channel_created",t.CLIENTS_CONNECTED="clients_connected",t.CLIENTS_DISCONNECTED="clients_disconnected",t.CLIENTS_WAITING="clients_w
8aiting",t.CLIENTS_READY="clients_ready",t.REJECTED="rejected",t.WALLET_INIT="wallet_init",t.CHANNEL_PERSISTENCE="channel_persistence",t.CONFIG="config",t.MESSAGE_ACK="ack",t.SOCKET_DISCONNECTED="socket_disconnected",t.SOCKET_RECONNECT="socket_reconnect",t.OTP="otp",t.SDK_RPC_CALL="sdk_rpc_call",t.AUTHORIZED="authorized",t.CONNECTION_STATUS="connection_status",t.MESSAGE="message",t.TERMINATE="terminate"}(te||(te={})),(Zi||(Zi={})).KEY_EXCHANGE="key_exchange",function(t){t.KEY_HANDSHAKE_START="key_handshake_start",t.KEY_HANDSHAKE_CHECK="key_handshake_check",t.KEY_HANDSHAKE_SYN="key_handshake_SYN",t.KEY_HANDSHAKE_SYNACK="key_handshake_SYNACK",t.KEY_HANDSHAKE_ACK="key_handshake_ACK",t.KEY_HANDSHAKE_WALLET="key_handshake_wallet",t.KEY_HANDSHAKE_NONE="none"}(Ce||(Ce={}));class D1 extends po.EventEmitter2{constructor({communicationLayer:e,otherPublicKey:n,context:r,ecies:i,logging:o}){super(),this.keysExchanged=!1,this.step=Ce.KEY_HANDSHAKE_NONE,this.debug=!1,this.context=r,this.communicationLayer=e,i!=null&&i.privateKey&&n&&(q.KeyExchange(`[KeyExchange: constructor()] otherPubKey=${n} set keysExchanged to true!`,i),this.keysExchanged=!0),this.myECIES=new Jo(Object.assign(Object.assign({},i),{debug:o==null?void 0:o.eciesLayer})),this.communicationLayer.state.eciesInstance=this.myECIES,this.myPublicKey=this.myECIES.getPublicKey(),this.debug=(o==null?void 0:o.keyExchangeLayer)===!0,n&&this.setOtherPublicKey(n),this.communicationLayer.on(Zi.KEY_EXCHANGE,this.onKeyExchangeMessage.bind(this))}onKeyExchangeMessage(e){const{relayPersistence:n}=this.communicationLayer.remote.state;if(q.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} keysExchanged=${this.keysExchanged} relayPersistence=${n}`,e),n)return void q.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Ignoring key exchange message because relay persistence is activated");const{message:r}=e;this.keysExchanged&&q.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} received handshake while already exchanged. step=${this.step} otherPubKey=${this.otherPublicKey}`),this.emit(te.KEY_INFO,r.type),r.type===Ce.KEY_HANDSHAKE_SYN?(this.checkStep([Ce.KEY_HANDSHAKE_NONE,Ce.KEY_HANDSHAKE_ACK]),q.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYN",r),r.pubkey&&this.setOtherPublicKey(r.pubkey),this.communicationLayer.sendMessage({type:Ce.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey}).catch(i=>{q.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Error sending KEY_HANDSHAKE_SYNACK",i)}),this.setStep(Ce.KEY_HANDSHAKE_ACK)):r.type===Ce.KEY_HANDSHAKE_SYNACK?(this.checkStep([Ce.KEY_HANDSHAKE_SYNACK,Ce.KEY_HANDSHAKE_ACK,Ce.KEY_HANDSHAKE_NONE]),q.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYNACK"),r.pubkey&&this.setOtherPublicKey(r.pubkey),this.communicationLayer.sendMessage({type:Ce.KEY_HANDSHAKE_ACK}).catch(i=>{q.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Error sending KEY_HANDSHAKE_ACK",i)}),this.keysExchanged=!0,this.setStep(Ce.KEY_HANDSHAKE_ACK),this.emit(te.KEYS_EXCHANGED)):r.type===Ce.KEY_HANDSHAKE_ACK&&(q.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_ACK set keysExchanged to true!"),this.checkStep([Ce.KEY_HANDSHAKE_ACK,Ce.KEY_HANDSHAKE_NONE]),this.keysExchanged=!0,this.setStep(Ce.KEY_HANDSHAKE_ACK),this.emit(te.KEYS_EXCHANGED))}resetKeys(e){this.clean(),this.myECIES=new Jo(e)}clean(){q.KeyExchange(`[KeyExchange: clean()] context=${this.context} reset handshake state`),this.setStep(Ce.KEY_HANDSHAKE_NONE),this.emit(te.KEY_INFO,this.step),this.keysExchanged=!1}start({isOriginator:e,force:n}){const{relayPersistence:r,protocolVersion:i}=this.communicationLayer.remote.state,o=i>=2;r?q.KeyExchange("[KeyExchange: start()] Ignoring key exchange message because relay persistence is activated"):(q.KeyExchange(`[KeyExchange: start()] context=${this.context} protocolVersion=${i} isOriginator=${e} step=${this.step} force=${n} relayPersistence=${r} keysExchanged=${this.keysExchanged}`),e?!(this.keysExchanged||this.step!==Ce.KEY_HANDSHAKE_NONE&&this.step!==Ce.KEY_HANDSHAKE_SYNACK)||n?(q.KeyExchange(`[KeyExchange: start()] context=${this.context} -- start key exchange (force=${n}) -- step=${this.step}`,this.step),this.clean(),this.setStep(Ce.KEY_HANDSHAKE_SYNACK),this.communicationLayer.sendMessage({type:Ce.KEY_HANDSHAKE_SYN,pubkey:this.myPublicKey,v:2}).catch(s=>{q.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_SYN",s)}
8)):q.KeyExchange(`[KeyExchange: start()] context=${this.context} -- key exchange already ${this.keysExchanged?"done":"in progress"} -- aborted.`,this.step):this.keysExchanged&&n!==!0?q.KeyExchange("[KeyExchange: start()] don't send KEY_HANDSHAKE_START -- exchange already done."):o?this.communicationLayer.sendMessage({type:Ce.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey,v:2}).catch(s=>{q.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_SYNACK",s)}):(this.communicationLayer.sendMessage({type:Ce.KEY_HANDSHAKE_START}).catch(s=>{q.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_START",s)}),this.clean()))}setStep(e){this.step=e,this.emit(te.KEY_INFO,e)}checkStep(e){e.length>0&&e.indexOf(this.step.toString())}setRelayPersistence({localKey:e,otherKey:n}){this.otherPublicKey=n,this.myECIES=new Jo({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){q.KeyExchange("[KeyExchange: setOtherPubKey()]",e),this.otherPublicKey=e}encryptMessage(e){if(!this.otherPublicKey)throw new Error("encryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.encrypt(e,this.otherPublicKey)}decryptMessage(e){if(!this.otherPublicKey)throw new 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(){const e={keyInfo:this.getKeyInfo(),keysExchanged:this.keysExchanged,step:this.step};return JSON.stringify(e)}}(function(t){t.TERMINATE="terminate",t.ANSWER="answer",t.OFFER="offer",t.CANDIDATE="candidate",t.JSONRPC="jsonrpc",t.WALLET_INFO="wallet_info",t.WALLET_INIT="wallet_init",t.ORIGINATOR_INFO="originator_info",t.PAUSE="pause",t.OTP="otp",t.AUTHORIZED="authorized",t.PING="ping",t.READY="ready"})(xe||(xe={})),function(t){t.REQUEST="sdk_connect_request_started",t.REQUEST_MOBILE="sdk_connect_request_started_mobile",t.RECONNECT="sdk_reconnect_request_started",t.CONNECTED="sdk_connection_established",t.CONNECTED_MOBILE="sdk_connection_established_mobile",t.AUTHORIZED="sdk_connection_authorized",t.REJECTED="sdk_connection_rejected",t.TERMINATED="sdk_connection_terminated",t.DISCONNECTED="sdk_disconnected",t.SDK_USE_EXTENSION="sdk_use_extension",t.SDK_RPC_REQUEST="sdk_rpc_request",t.SDK_RPC_REQUEST_RECEIVED="sdk_rpc_request_received",t.SDK_RPC_REQUEST_DONE="sdk_rpc_request_done",t.SDK_EXTENSION_UTILIZED="sdk_extension_utilized",t.SDK_USE_INAPP_BROWSER="sdk_use_inapp_browser"}(Te||(Te={}));const xi=(t,e,n)=>X(void 0,void 0,void 0,function*(){var r,i,o,s,a,c;const{remote:l,state:u}=t,{channelId:d,isOriginator:h}=u;if(e==="error_terminated")return q.SocketService(`handleJoinChannelResults: Channel ${d} terminated`),void t.emit(te.TERMINATE);if(!n)return void q.SocketService(`handleJoinChannelResults: No result for channel ${d}`);const{persistence:f,walletKey:g,rejected:m}=n;if(q.SocketService(`handleJoinChannelResults: Channel ${d} persistence=${f} walletKey=${g} rejected=${m}`),m)return q.SocketService(`handleJoinChannelResults: Channel ${d} rejected`),yield t.remote.disconnect({terminate:!0}),t.remote.emit(te.REJECTED,{channelId:d}),void t.remote.emitServiceStatusEvent();if(g&&!(!((r=l.state.channelConfig)===null||r===void 0)&&r.otherKey)){t.getKeyExchange().setOtherPublicKey(g),(i=t.state.keyExchange)===null||i===void 0||i.setKeysExchanged(!0),l.state.ready=!0,l.state.authorized=!0,l.emit(te.AUTHORIZED);const{communicationLayer:w,storageManager:p}=l.state,k=Object.assign(Object.assign({},l.state.channelConfig),{channelId:(o=l.state.channelId)!==null&&o!==void 0?o:"",validUntil:Date.now()+ir,localKey:w==null?void 0:w.getKeyInfo().ecies.private,otherKey:g});t.sendMessage({type:Ce.KEY_HANDSHAKE_ACK}).catch(_=>{}),(s=t.state.socket)===null||s===void 0||s.emit(xe.PING,{id:d,clientType:h?"dapp":"wallet",context:"on_channel_reconnect",message:""}
8),yield p==null?void 0:p.persistChannelConfig(k),l.emitServiceStatusEvent(),l.setConnectionStatus(je.LINKED)}f&&(t.emit(te.CHANNEL_PERSISTENCE),(a=t.state.keyExchange)===null||a===void 0||a.setKeysExchanged(!0),l.state.ready=!0,l.state.authorized=!0,l.emit(te.AUTHORIZED),Jt(Object.assign(Object.assign({id:d??"",event:h?Te.CONNECTED:Te.CONNECTED_MOBILE},t.remote.state.originatorInfo),{sdkVersion:t.remote.state.sdkVersion,commLayer:t.state.communicationLayerPreference,commLayerVersion:En.version,walletVersion:(c=t.remote.state.walletInfo)===null||c===void 0?void 0:c.version}),u.communicationServerUrl).catch(w=>{}))}),er=t=>new Promise(e=>{setTimeout(e,t)}),zc=(t,e,...n)=>X(void 0,[t,e,...n],void 0,function*(r,i,o=200){let s;const a=Date.now();let c=!1;for(;!c;){if(c=Date.now()-a>3e5,s=i[r],s.elapsedTime!==void 0)return s;yield er(o)}throw new Error(`RPC ${r} timed out`)}),$s=t=>X(void 0,void 0,void 0,function*(){const{state:e}=t,{socket:n,channelId:r,context:i,isOriginator:o,isReconnecting:s}=e;if(s)return q.SocketService("[SocketService: reconnectSocket()] Reconnection already in progress, skipping",t),!1;if(!n)return q.SocketService("[SocketService: reconnectSocket()] socket is not defined",t),!1;if(!r)return!1;const{connected:a}=n;e.isReconnecting=!0,e.reconnectionAttempts=0,q.SocketService(`[SocketService: reconnectSocket()] connected=${a} trying to reconnect after socketio disconnection`,t);try{for(;3>e.reconnectionAttempts;){if(q.SocketService(`[SocketService: reconnectSocket()] Attempt ${e.reconnectionAttempts+1} of 3`,t),yield er(200),n.connected)return q.SocketService("Socket already connected --- ping to retrieve messages"),n.emit(xe.PING,{id:r,clientType:o?"dapp":"wallet",context:"on_channel_config",message:""}),!0;e.resumed=!0,n.connect(),t.emit(te.SOCKET_RECONNECT);try{if(yield new Promise((c,l)=>{n.emit(te.JOIN_CHANNEL,{channelId:r,context:`${i}connect_again`,clientType:o?"dapp":"wallet"},(u,d)=>X(void 0,void 0,void 0,function*(){try{yield xi(t,u,d),c()}catch(h){l(h)}}))}),yield er(100),n.connected)return q.SocketService(`Reconnection successful on attempt ${e.reconnectionAttempts+1}`),!0}catch(c){q.SocketService(`Error during reconnection attempt ${e.reconnectionAttempts+1}:`,c)}e.reconnectionAttempts+=1,3>e.reconnectionAttempts&&(yield er(200))}return q.SocketService("Failed to reconnect after 3 attempts"),!1}finally{e.isReconnecting=!1,e.reconnectionAttempts=0}});function eh(t,e){return X(this,void 0,void 0,function*(){var n;const r=(n=t.state.keyExchange)===null||n===void 0?void 0:n.encryptMessage(JSON.stringify(e)),i={id:t.state.channelId,context:t.state.context,clientType:t.state.isOriginator?"dapp":"wallet",message:r,plaintext:t.state.hasPlaintext?JSON.stringify(e):void 0};return q.SocketService(`[SocketService: encryptAndSendMessage()] context=${t.state.context}`,i),e.type===xe.TERMINATE&&(t.state.manualDisconnect=!0),new Promise((o,s)=>{var a;(a=t.state.socket)===null||a===void 0||a.emit(te.MESSAGE,i,(c,l)=>{var u;c&&(q.SocketService(`[SocketService: encryptAndSendMessage()] error=${c}`),s(c)),q.SocketService("[encryptAndSendMessage] response",l),o((u=l==null?void 0:l.success)!==null&&u!==void 0&&u)})})})}var Zn;(function(t){t.RPC_CHECK="rpcCheck",t.SKIPPED_RPC="skippedRpc"})(Zn||(Zn={}));const th=["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(t=>t.toLowerCase()),$1=[{event:te.CLIENTS_CONNECTED,handler:function(t,e){return n=>X(this,void 0,void 0,function*(){var r,i,o,s,a,c,l,u,d,h,f;const g=(i=(r=t.remote.state.channelConfig)===null||r===void 0?void 0:r.relayPersistence)!==null&&i!==void 0&&i;if(q.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} on 'clients_connected-${e}' relayPersistence=${g} resumed=${t.state.resumed} clientsPaused=${t.state.clientsPaused} keysExchanged=${(o=t.state.keyExchange)===null||o===void 0?void 0:o.areKeysExchanged()} isOriginator=${t.state.isOriginator}`),t.emit(te.CLIENTS_CONNECTED,{isOriginator:t.state.isOriginator,keysExchanged:(s=t.state.keyExchange)===null||s===void 0?void 0:s.areKeysExchanged(),context:t.state.context}),t.state.resumed)t.state.isOriginator||(q.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} 'clients_connected' / keysExchanged=${(a=t.state.keyExchange)===null||a===void 0?void 0:a.areKeysExchanged()} -- backward compatibility`),(c=t.state.keyExchange)===null||c===void 0||c.start({isOriginator:(l=t.state.isOriginator)!==null&&l!==void 0&&l})),t.state.resumed=!1;else if(t.state.clientsPaused)q.SocketService("[SocketService: handleClientsConnected()] 'clients_connected' skip sending originatorInfo on pause");else if(!t.state.isOriginator){const m=!g;q.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} on 'clients_connected' / keysExchanged=${(u=t.state.keyExchange)===null||u===void 0?void 0:u.areKeysExchanged()} -- force=${m} -- backward compatibility`),q.SocketService(`[SocketService: handleClientsConnected()] context=${t.state.context} on 'clients_connected' / keysExchanged=${(d=t.state.keyExchange)===null||d===void 0?void 0:d.areKeysExchanged()} -- force=${m} -- backward compatibility`),(h=t.state.keyExchange)===null||h===void 0||h.start({isOriginator:(f=t.state.isOriginator)!==null&&f!==void 0&&f,force:m})}t.state.clientsConnected=!0,t.state.clientsPaused=!1})}},{event:te.CHANNEL_CREATED,handler:function(t,e){return n=>{q.SocketService(`[SocketService: handleChannelCreated()] context=${t.state.context} on 'channel_created-${e}'`,n),t.emit(te.CHANNEL_CREATED,n)}}},{event:te.CLIENTS_DISCONNECTED,handler:function(t,e){return()=>{var n;t.state.clientsConnected=!1,q.SocketService(`[SocketService: handlesClientsDisconnected()] context=${t.state.context} on 'clients_disconnected-${e}'`),t.remote.state.relayPersistence?q.SocketService(`[SocketService: handlesClientsDisconnected()] context=${t.state.context} on 'clients_disconnected-${e}' - relayPersistence enabled, skipping key exchange cleanup.`):(t.state.isOriginator&&!t.state.clientsPaused&&((n=t.state.keyExchange)===null||n===void 0||n.clean()),t.emit(te.CLIENTS_DISCONNECTED,e))}}},{event:te.CONFIG,handler:function(t,e){return n=>X(this,void 0,void 0,function*(){var r,i,o;q.SocketService(`[SocketService: handleChannelConfig()] update relayPersistence on 'config-${e}'`,n);const{persistence:s,walletKey:a}=n;t.state.isOriginator&&t.remote.state.channelConfig?(n.walletKey&&!t.remote.state.channelConfig.otherKey&&(q.SocketService(`Setting wallet key ${a}`),t.remote.state.channelConfig.otherKey=a,t.getKeyExchange().setOtherPublicKey(n.walletKey),(r=t.state.keyExchange)===null||r===void 0||r.setKeysExchanged(!0),yield t.remote.sendMessage({type:Ce.KEY_HANDSHAKE_ACK}),yield t.remote.sendMessage({type:xe.PING}),yield(i=t.remote.state.storageManager)===null||i===void 0?void 0:i.persist
8ChannelConfig(t.remote.state.channelConfig)),s!==!0||t.remote.state.channelConfig.relayPersistence||(q.SocketService(`Setting relay persistence ${s}`),t.remote.state.channelConfig.relayPersistence=s,t.remote.state.relayPersistence=!0,t.remote.emit(te.CHANNEL_PERSISTENCE),t.remote.state.authorized=!0,t.remote.state.ready=!0,t.remote.emit(te.AUTHORIZED),yield(o=t.remote.state.storageManager)===null||o===void 0?void 0:o.persistChannelConfig(t.remote.state.channelConfig))):t.state.isOriginator||n.persistence&&(t.remote.state.relayPersistence=!0,t.remote.emit(te.CHANNEL_PERSISTENCE))})}},{event:te.MESSAGE,handler:function(t,e){return n=>{var r,i,o,s,a,c,l,u,d,h,f,g,m,w,p,k,_,O;const{ackId:N,message:U,error:W}=n,V=(r=t.remote.state.relayPersistence)!==null&&r!==void 0&&r;if(q.SocketService(`[SocketService handleMessage()] relayPersistence=${V} context=${t.state.context} on 'message' ${e} keysExchanged=${(i=t.state.keyExchange)===null||i===void 0?void 0:i.areKeysExchanged()}`,n),W)throw q.SocketService(` 9 [SocketService handleMessage()] context=${t.state.context}::on 'message' error=${W}`),new Error(W);const H=typeof U=="string";if(!H&&(U==null?void 0:U.type)===Ce.KEY_HANDSHAKE_START)return V?void 0:(q.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' received HANDSHAKE_START isOriginator=${t.state.isOriginator}`,U),void((o=t.state.keyExchange)===null||o===void 0||o.start({isOriginator:(s=t.state.isOriginator)!==null&&s!==void 0&&s,force:!0})));if(!H&&(!((a=U==null?void 0:U.type)===null||a===void 0)&&a.startsWith("key_handshake")))return V?void 0:(q.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' emit KEY_EXCHANGE`,U),void t.emit(Zi.KEY_EXCHANGE,{message:U,context:t.state.context}));if(H&&!(!((c=t.state.keyExchange)===null||c===void 0)&&c.areKeysExchanged())){let j=!1;try{q.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' trying to decrypt message`),(l=t.state.keyExchange)===null||l===void 0||l.decryptMessage(U),j=!0}catch(B){q.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' error`,B)}if(!j)return t.state.isOriginator?(d=t.state.keyExchange)===null||d===void 0||d.start({isOriginator:(h=t.state.isOriginator)!==null&&h!==void 0&&h}):t.sendMessage({type:Ce.KEY_HANDSHAKE_START}).catch(B=>{}),void q.SocketService(`Message ignored because invalid key exchange status. step=${(f=t.state.keyExchange)===null||f===void 0?void 0:f.getKeyInfo().step}
9`,(g=t.state.keyExchange)===null||g===void 0?void 0:g.getKeyInfo(),U);q.SocketService("Invalid key exchange status detected --- updating it."),(u=t.state.keyExchange)===null||u===void 0||u.setKeysExchanged(!0)}else if(!H&&(U!=null&&U.type))return void t.emit(te.MESSAGE,U);if(!H)return void t.emit(te.MESSAGE,U);const K=(m=t.state.keyExchange)===null||m===void 0?void 0:m.decryptMessage(U),Y=JSON.parse(K??"{}");if(N&&(N==null?void 0:N.length)>0&&(q.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' ackid=${N} channelId=${e}`),(w=t.state.socket)===null||w===void 0||w.emit(te.MESSAGE_ACK,{ackId:N,channelId:e,clientType:t.state.isOriginator?"dapp":"wallet"})),t.state.clientsPaused=(Y==null?void 0:Y.type)===xe.PAUSE,t.state.isOriginator&&Y.data){const j=Y.data,B=t.state.rpcMethodTracker[j.id];if(B){const R=Date.now()-B.timestamp;q.SocketService(`[SocketService handleMessage()] context=${t.state.context}::on 'message' received answer for id=${j.id} method=${B.method} responseTime=${R}`,Y),t.remote.state.analytics&&th.includes(B.method.toLowerCase())&&Jt(Object.assign(Object.assign({id:(p=t.remote.state.channelId)!==null&&p!==void 0?p:"",event:Te.SDK_RPC_REQUEST_DONE,sdkVersion:t.remote.state.sdkVersion,commLayerVersion:En.version},t.remote.state.originatorInfo),{walletVersion:(k=t.remote.state.walletInfo)===null||k===void 0?void 0:k.version,params:{method:B.method,from:"mobile"}}),t.remote.state.communicationServerUrl).catch(L=>{});const C=Object.assign(Object.assign({},B),{result:j.result,error:j.error?{code:(_=j.error)===null||_===void 0?void 0:_.code,message:(O=j.error)===null||O===void 0?void 0:O.message}:void 0,elapsedTime:R});t.state.rpcMethodTracker[j.id]=C,t.emit(te.RPC_UPDATE,C)}}t.emit(te.MESSAGE,{message:Y})}}},{event:te.REJECTED,handler:function(t,e){return n=>X(this,void 0,void 0,function*(){var r;t.state.isOriginator&&!t.remote.state.ready?(q.SocketService(`[SocketService: handleChannelRejected()] context=${t.state.context} channelId=${e} isOriginator=${t.state.isOriginator} ready=${t.remote.state.ready}`,t.remote.state.originatorInfo),Jt(Object.assign(Object.assign({id:e,event:Te.REJECTED},t.remote.state.originatorInfo),{sdkVersion:t.remote.state.sdkVersion,commLayer:t.state.communicationLayerPreference,commLayerVersion:En.version,walletVersion:(r=t.remote.state.walletInfo)===null||r===void 0?void 0:r.version}),t.remote.state.communicationServerUrl).catch(i=>{}),yield t.remote.disconnect({terminate:!0}),t.remote.emit(te.REJECTED,{channelId:e}),t.remote.setConnectionStatus(je.DISCONNECTED)):q.SocketService(`[SocketService: handleChannelRejected()] SKIP -- channelId=${e} isOriginator=${t.state.isOriginator} ready=${t.remote.state.ready}`)})}}
9,{event:"clients_waiting_to_join",handler:function(t,e){return n=>{q.SocketService(`[SocketService: handleClientsWaitingToJoin()] context=${t.state.context} on 'clients_waiting_to_join-${e}'`,n),t.emit(te.CLIENTS_WAITING,n)}}}],j1=[{event:te.KEY_INFO,handler:function(t){return e=>{q.SocketService("[SocketService: handleKeyInfo()] on 'KEY_INFO'",e),t.emit(te.KEY_INFO,e)}}},{event:te.KEYS_EXCHANGED,handler:function(t){return()=>{var e,n,r;q.SocketService(`[SocketService: handleKeysExchanged()] on 'keys_exchanged' keyschanged=${(e=t.state.keyExchange)===null||e===void 0?void 0:e.areKeysExchanged()}`);const{channelConfig:i}=t.remote.state;if(i){const s=t.getKeyExchange().getKeyInfo().ecies;i.localKey=s.private,i.otherKey=s.otherPubKey,t.remote.state.channelConfig=i,(n=t.remote.state.storageManager)===null||n===void 0||n.persistChannelConfig(i).catch(a=>{})}t.emit(te.KEYS_EXCHANGED,{keysExchanged:(r=t.state.keyExchange)===null||r===void 0?void 0:r.areKeysExchanged(),isOriginator:t.state.isOriginator});const o={keyInfo:t.getKeyInfo()};t.emit(te.SERVICE_STATUS,o)}}}];function qc(t,e){q.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} setting socket listeners for channel ${e}...`);const{socket:n}=t.state,{keyExchange:r}=t.state;n&&t.state.isOriginator&&(t.state.debug&&(n==null||n.io.on("error",i=>{q.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=error`,i)}),n==null||n.io.on("reconnect",i=>{q.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=reconnect`,i),$s(t).catch(o=>{})}),n==null||n.io.on("reconnect_error",i=>{q.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=reconnect_error`,i)}),n==null||n.io.on("reconnect_failed",()=>{q.SocketService(`[SocketService: setupChannelListener()] context=${t.state.context} socket event=reconnect_failed`)})),n==null||n.on("disconnect",i=>(q.SocketService(`[SocketService: setupChannelListener()] on 'disconnect' -- MetaMaskSDK socket disconnected '${i}' begin recovery...`),function(o){return s=>{q.SocketService(`[SocketService: handleDisconnect()] on 'disconnect' manualDisconnect=${o.state.manualDisconnect}`,s),o.state.manualDisconnect||(o.emit(te.SOCKET_DISCONNECTED),$s(o).catch(a=>{}))}}(t)(i)))),$1.forEach(({event:i,handler:o})=>{n==null||n.on(`${i}-${e}`,o(t,e))}),j1.forEach(({event:i,handler:o})=>{r==null||r.on(i,o(t))}),t.state.setupChannelListeners=!0}class K1 extends po.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:n,communicationLayerPreference:r,communicationServerUrl:i,context:o,remote:s,logging:a}=e;this.state.resumed=n,this.state.context=o,this.state.isOriginator=s.state.isOriginator,this.state.communicationLayerPreference=r,this.state.debug=(a==null?void 0:a.serviceLayer)===!0,this.remote=s,(a==null?void 0:a.serviceLayer)===!0&&Ge.enable("SocketService:Layer"),this.state.communicationServerUrl=i,this.state.hasPlaintext=this.state.communicationServerUrl!==rr&&(a==null?void 0:a.plaintext)===!0,q.SocketService(`[SocketService: constructor()] Socket IO url: ${this.state.communicationServerUrl}`),this.initSocket()}initSocket(){var e;const{otherPublicKey:n,ecies:r,logging:i}=this.options,o={autoConnect:!1,transports:I1,withCredentials:!0},s=this.state.communicationServerUrl;q.SocketService(`[SocketService: initSocket()] Socket IO url: ${s}`),this.state.socket=_i(s,o),function(c){if(typeof window<"u"&&typeof document<"u"&&(q.SocketService(`[SocketService: setupSocketFocusListener()] hasFocus=${document.hasFocus()}`,c),!c.state.focusListenerAdded)){const l=()=>{q.SocketService("Document has focus --- reconnecting socket"),$s(c).catch(u=>{})};window.addEventListener("focus",l),c.state.focusListenerAdded=!0,c.state.removeFocusListener=()=>{window.removeEventListener("focus",l),c.state.focusListenerAdded=!1}}}(this);const a={communicationLayer:this,otherPublicKey:n,sendPublicKey:!1,context:(e=this.state.context)!==null&&e!==void 0?e:"",ecies:r,logging:i};this.state.keyExchange=new D1(a)}resetKeys(){return q.SocketService("[SocketService: resetKeys()] Resetting keys."),void((e=this.state.keyExchange)===null||e===void 0||e.resetKeys());var e}createChannel(){return X(this,void 0,void 0,function*(){return function(e){return X(this,void 0,void 0,function*(){var n,r,i;if(q.SocketService(`[SocketService: createChannel()] context=${e.state.context}`),e.state.socket||e.initSocket(),(n=e.state.socket)===null||n===void 0?void 0:n.connected)throw new Error("socket already connected");(r=e.state.socket)===null||r===void 0||r.connect(),e.state.manualDisconnect=!1,e.state.isOriginator=!0;const o=ia();e.state.channelId=o,qc(e,o),yield new Promise((a,c)=>{var l;(l=e.state.socket)===null||l===void 0||l.emit(te.JOIN_CHANNEL,{channelId:o,context:`${e.state.context}createChannel`,clientType:"dapp"},(u,d)=>X(this,void 0,void 0,function*(){try{yield xi(e,u,d),a()}catch(h){c(h)}}))});const s=(i=e.state.keyExchange)===null||i===void 0?void 0:i.getKeyInfo();return{channelId:o,pubKey:(s==null?void 0:s.ecies.public)||"",privKey:(s==null?void 0:s.ecies.private)||""}})}(this)})}
9connectToChannel({channelId:e,withKeyExchange:n=!1,authorized:r}){return function(i){return X(this,arguments,void 0,function*({options:o,instance:s}){const{channelId:a,authorized:c,withKeyExchange:l}=o,{state:u,remote:d}=s,{isOriginator:h=!1,socket:f,keyExchange:g}=u,{channelConfig:m}=d.state;if(f!=null&&f.connected)throw new Error("socket already connected");if(h&&(m!=null&&m.relayPersistence)){const{localKey:w,otherKey:p}=m;w&&p&&(g==null||g.setRelayPersistence({localKey:w,otherKey:p}))}return Object.assign(u,{manualDisconnect:!1,withKeyExchange:l,isOriginator:h,channelId:a}),f==null||f.connect(),qc(s,a),!h&&c&&(g==null||g.setKeysExchanged(!0),Object.assign(d.state,{ready:!0,authorized:!0})),new Promise(w=>{var p;const k=(p=g==null?void 0:g.getKeyInfo())===null||p===void 0?void 0:p.ecies.public;f==null||f.emit(te.JOIN_CHANNEL,{channelId:a,context:`${u.context}_connectToChannel`,clientType:h?"dapp":"wallet",publicKey:c&&!h?k:void 0},(_,O)=>X(this,void 0,void 0,function*(){yield xi(s,_,O),w()}))})})}({options:{channelId:e,withKeyExchange:n,authorized:r},instance:this})}getKeyInfo(){return this.state.keyExchange.getKeyInfo()}keyCheck(){var e,n;(n=(e=this).state.socket)===null||n===void 0||n.emit(te.MESSAGE,{id:e.state.channelId,context:e.state.context,message:{type:Ce.KEY_HANDSHAKE_CHECK,pubkey:e.getKeyInfo().ecies.otherPubKey}})}getKeyExchange(){return this.state.keyExchange}sendMessage(e){return X(this,void 0,void 0,function*(){return function(n,r){return X(this,void 0,void 0,function*(){var i,o,s;if(!n.state.channelId)throw q.SocketService("handleSendMessage: no channelId - Create a channel first"),new Error("Create a channel first");
9if(q.SocketService(`[SocketService: handleSendMessage()] context=${n.state.context} areKeysExchanged=${(i=n.state.keyExchange)===null||i===void 0?void 0:i.areKeysExchanged()}`,r),(o=r==null?void 0:r.type)===null||o===void 0?void 0:o.startsWith("key_handshake"))return function(c,l){var u;q.SocketService(`[SocketService: handleKeyHandshake()] context=${c.state.context}`,l),(u=c.state.socket)===null||u===void 0||u.emit(te.MESSAGE,{id:c.state.channelId,context:c.state.context,clientType:c.state.isOriginator?"dapp":"wallet",message:l})}(n,r),!0;(function(c,l){var u;if(!(!((u=c.state.keyExchange)===null||u===void 0)&&u.areKeysExchanged())&&!c.remote.state.relayPersistence)throw q.SocketService(`[SocketService: validateKeyExchange()] context=${c.state.context} ERROR keys not exchanged`,l),new Error("Keys not exchanged BBB")})(n,r),function(c,l){var u;const d=(u=l==null?void 0:l.method)!==null&&u!==void 0?u:"",h=l==null?void 0:l.id;c.state.isOriginator&&h&&(c.state.rpcMethodTracker[h]={id:h,timestamp:Date.now(),method:d},c.emit(te.RPC_UPDATE,c.state.rpcMethodTracker[h]))}(n,r);const a=yield eh(n,r);return n.remote.state.analytics&&n.remote.state.isOriginator&&r.method&&th.includes(r.method.toLowerCase())&&Jt({id:(s=n.remote.state.channelId)!==null&&s!==void 0?s:"",event:Te.SDK_RPC_REQUEST,params:{method:r.method,from:"mobile"}},n.remote.state.communicationServerUrl).catch(c=>{}),function(c,l){return X(this,void 0,void 0,function*(){var u;const d=l==null?void 0:l.id,h=(u=l==null?void 0:l.method)!==null&&u!==void 0?u:"";if(c.state.isOriginator&&d)try{const f=zc(d,c.state.rpcMethodTracker,200).then(w=>({type:Zn.RPC_CHECK,result:w})),g=X(this,void 0,void 0,function*(){const w=yield(k=>X(void 0,[k],void 0,function*({rpcId:_,instance:O}){for(;O.state.lastRpcId===_||O.state.lastRpcId===void 0;)yield er(200);return O.state.lastRpcId}))({instance:c,rpcId:d}),p=yield zc(w,c.state.rpcMethodTracker,200);return{type:Zn.SKIPPED_RPC,result:p}}),m=yield Promise.race([f,g]);if(m.type===Zn.RPC_CHECK){const w=m.result;q.SocketService(`[SocketService:handleRpcReplies()] id=${l.id} ${h} ( ${w.elapsedTime} ms)`,w.result)}else{if(m.type!==Zn.SKIPPED_RPC)throw new Error(`Error handling RPC replies for ${d}`);{const w=Object.assign(Object.assign({},c.state.rpcMethodTracker[d]),{error:new Error("SDK_CONNECTION_ISSUE")});c.emit(te.RPC_UPDATE,w);const p={data:Object.assign(Object.assign({},w),{jsonrpc:"2.0"}),name:"metamask-provider"};c.emit(te.MESSAGE,{message:p})}}}catch(f){throw f}})}(n,r).catch(c=>{}),a})}(this,e)})}ping(){return function(e){return X(this,void 0,void 0,function*(){var n,r;q.SocketService(`[SocketService: ping()] context=${e.state.context} originator=${e.state.isOriginator} keysExchanged=${(n=e.state.keyExchange)===null||n===void 0?void 0:n.areKeysExchanged()}`),(r=e.state.socket)===null||r===void 0||r.emit(xe.PING,{id:e.state.channelId,context:"ping",clientType:e.remote.state.isOriginator?"dapp":"wallet",message:""})})}(this)}pause(){return function(e){return X(this,void 0,void 0,function*(){var n,r;q.SocketService(`[SocketService: pause()] context=${e.state.context}`),e.state.manualDisconnect=!0,!((n=e.state.keyExchange)===null||n===void 0)&&n.areKeysExchanged()&&(yield e.sendMessage({type:xe.PAUSE})),(r=e.state.socket)===null||r===void 0||r.disconnect()})}(this)}isConnected(){var e;return(e=this.state.socket)===null||e===void 0?void 0:e.connected}resume(){return function(e){return X(this,void 0,void 0,function*(){const{state:n,remote:r}=e,{socket:i,channelId:o,context:s,keyExchange:a,isOriginator:c}=n,{isOriginator:l}=r.state;if(q.SocketService(`[SocketService: resume()] channelId=${o} context=${s} connected=${i==null?void 0:i.connected} manualDisconnect=${n.manualDisconnect} resumed=${n.resumed} keysExchanged=${a==null?void 0:a.areKeysExchanged()}`),!o)throw q.SocketService("[SocketService: resume()] channelId is not defined"),new Error("ChannelId is not defined");i!=null&&i.connected?(q.SocketService("[SocketService: resume()] already connected."),i.emit(xe.PING,{id:o,clientType:l?"dapp":"wallet",context:"on_channel_config",message:""}),r.hasRelayPersistence()||a!=null&&a.areKeysExchanged()||(c?yield e.sendMessage({type:xe.READY}):a==null||a.start({isOriginator:!1}))):(i==null||i.connect(),q.SocketService(`[SocketService: resume()] after connecting socket --> connected=${i==null?void 0:i.connected}`),i==null||i.emit(te.JOIN_CHANNEL,{channelId:o,context:`${s}_resume`,clientType:l?"dapp":"wallet"},(u,d)=>X(this,void 0,void 0,function*(){try{yield xi(e,u,d)}catch{}}))),n.manualDisconnect=!1,n.resumed=!0})}(this)}getRPCMethodTracker(){return this.state.rpcMethodTracker}disconnect(e){return function(n,r){var i,o,s,a,c;q.SocketService(`[SocketService: disconnect()] context=${n.state.context}`,r),r!=null&&r.terminate&&((o=(i=n.state).removeFocusListener)===null||o===void 0||o.call(i),n.state.channelId=r.channelId,(s=n.state.socket)===null||s===void 0||s.removeAllListeners(),(a=n.state.keyExchange)===null||a===void 0||a.clean(),n.remote.state.ready=!1,n.state.socket=void 0,n.state.rpcMethodTracker={}),n.state.manualDisconnect=!0,(c=n.state.socket)===null||c===void 0||c.disconnect()}(this,e)}}var Pn,Fe,Vc;function U1(t){return()=>X(this,void 0,void 0,function*(){var e,n,r;const{state:i}=t;if(i.authorized)return;yield X(this,void 0,void 0,function*(){for(;!i.walletInfo;)yield er(500)});const o="7.3".localeCompare(((e=i.walletInfo)===null||e===void 0?void 0:e.version)||"");if(q.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' version=${(n=i.walletInfo)===null||n===void 0?void 0:n.version} compareValue=${o}`),o!==1)return;const s=i.platformType===Fe.MobileWeb||i.platformType===Fe.ReactNative||i.platformType===Fe.MetaMaskMobileWebview;q.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' platform=${i.platformType} secure=${s} channel=${i.channelId} walletVersion=${(r=i.walletInfo)===null||r===void 0?void 0:r.version}`),s&&(i.authorized=!0,t.emit(te.AUTHORIZED))})}function H1(t){return e=>{const{state:n}=t;q.RemoteCommunication(`[RemoteCommunication: handleChannelCreatedEvent()] context=${n.context} on 'channel_created' channelId=${e}`),t.emit(te.CHANNEL_CREATED,e)}}function F1(t,e){return()=>{var n,r,i,o;const{state:s}=t;q.RemoteCommunication(`[RemoteCommunication: handleClientsConnectedEvent()] on 'clients_connected' channel=${s.channelId} keysExchanged=${(r=(n=s.communicationLayer)===null||n===void 0?void 0:n.getKeyInfo())===null||r===void 0?void 0:r.keysExchanged}`),s.analytics&&Jt(Object.assign(Object.assign({id:(i=s.channelId)!==null&&i!==void 0?i:"",event:s.reconnection?Te.RECONNECT:s.isOriginator?Te.REQUEST:Te.REQUEST_MOBILE},s.originatorInfo),{commLayer:e,sdkVersion:s.sdkVersion,walletVersion:(o=s.walletInfo)===null||o===void 0?void 0:o.version,commLayerVersion:En.version}),s.communicationServerUrl).catch(a=>{}),s.clientsConnected=!0,s.originatorInfoSent=!1,t.emit(te.CLIENTS_CONNECTED)}}function z1(t){return e=>{const{state:n}=t;q.RemoteCommunication(`[RemoteCommunication: handleClientsDisconnectedEvent()] context=${n.context} on 'clients_disconnected' channelId=${e}`),n.relayPersistence||(n.clientsConnected=!1,n.ready=!1,n.authorized=!1),t.emit(te.CLIENTS_DISCONNECTED,n.channelId),t.setConnectionStatus(je.DISCONNECTED)}}function q1(t){return e=>{var n;const{state:r}=t;if(q.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] context=${r.context}
9 on 'clients_waiting' numberUsers=${e} ready=${r.ready} autoStarted=${r.originatorConnectStarted}`),t.setConnectionStatus(je.WAITING),t.emit(te.CLIENTS_WAITING,e),r.originatorConnectStarted){q.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] on 'clients_waiting' watch autoStarted=${r.originatorConnectStarted} timeout`,r.autoConnectOptions);const i=((n=r.autoConnectOptions)===null||n===void 0?void 0:n.timeout)||3e3,o=setTimeout(()=>{q.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] setTimeout(${i}) terminate channelConfig`,r.autoConnectOptions),r.originatorConnectStarted=!1,r.ready||t.setConnectionStatus(je.TIMEOUT),clearTimeout(o)},i)}}}function V1(t,e){return n=>{var r,i,o,s,a,c,l,u;const{state:d}=t;if(q.RemoteCommunication(`[RemoteCommunication: handleKeysExchangedEvent()] context=${d.context} on commLayer.'keys_exchanged' channel=${d.channelId}`,n),(i=(r=d.communicationLayer)===null||r===void 0?void 0:r.getKeyInfo())===null||i===void 0?void 0:i.keysExchanged){const h=Object.assign(Object.assign({},d.channelConfig),{channelId:(o=d.channelId)!==null&&o!==void 0?o:"",validUntil:((s=d.channelConfig)===null||s===void 0?void 0:s.validUntil)||ir,localKey:d.communicationLayer.getKeyInfo().ecies.private,otherKey:d.communicationLayer.getKeyInfo().ecies.otherPubKey});(a=d.storageManager)===null||a===void 0||a.persistChannelConfig(h).catch(f=>{}),t.setConnectionStatus(je.LINKED)}(function(h,f){var g,m,w,p,k,_,O,N;const{state:U}=h;q.RemoteCommunication(`[RemoteCommunication: setLastActiveDate()] channel=${U.channelId}`,f);const W=Object.assign(Object.assign({},U.channelConfig),{channelId:(g=U.channelId)!==null&&g!==void 0?g:"",validUntil:(w=(m=U.channelConfig)===null||m===void 0?void 0:m.validUntil)!==null&&w!==void 0?w:0,relayPersistence:U.relayPersistence,localKey:(k=(p=U.communicationLayer)===null||p===void 0?void 0:p.state.keyExchange)===null||k===void 0?void 0:k.getKeyInfo().ecies.private,otherKey:(O=(_=U.communicationLayer)===null||_===void 0?void 0:_.state.keyExchange)===null||O===void 0?void 0:O.getKeyInfo().ecies.otherPubKey,lastActive:f.getTime()});(N=U.storageManager)===null||N===void 0||N.persistChannelConfig(W)})(t,new Date),d.analytics&&d.channelId&&Jt(Object.assign(Object.assign({id:d.channelId,event:n.isOriginator?Te.CONNECTED:Te.CONNECTED_MOBILE},d.originatorInfo),{sdkVersion:d.sdkVersion,commLayer:e,commLayerVersion:En.version,walletVersion:(c=d.walletInfo)===null||c===void 0?void 0:c.version}),d.communicationServerUrl).catch(h=>{}),d.isOriginator=n.isOriginator,n.isOriginator||((l=d.communicationLayer)===null||l===void 0||l.sendMessage({type:xe.READY}),d.ready=!0,d.paused=!1),n.isOriginator&&!d.originatorInfoSent&&((u=d.communicationLayer)===null||u===void 0||u.sendMessage({type:xe.ORIGINATOR_INFO,originatorInfo:d.originatorInfo,originator:d.originatorInfo}),d.originatorInfoSent=!0)}}function W1(t){return e=>{let n=e;e.message&&(n=n.message),function(r,i){const{state:o}=i;if(q.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] context=${o.context} on 'message' typeof=${typeof r}`,r),i.state.ready=!0,o.isOriginator||r.type!==xe.ORIGINATOR_INFO)if(o.isOriginator&&r.type===xe.WALLET_INFO)(function(s,a){const{state:c}=s;c.walletInfo=a.walletInfo,c.paused=!1})(i,r);else{if(o.isOriginator&&r.type===xe.WALLET_INIT)(function(s,a){return X(this,void 0,void 0,function*(){var c,l,u;const{state:d}=s;if(d.isOriginator){const h=a.data||{};if(typeof h=="object"&&"accounts"in h&&"chainId"in h&&"walletKey"in h)try{const{channelConfig:f}=s.state;if(q.RemoteCommunication("WALLET_INIT: channelConfig",JSON.stringify(f,null,2)),f){const g=h.accounts,m=h.chainId,w=h.walletKey;let p,k=!1;"deeplinkProtocol"in h&&(k=!!h.deeplinkProtocol,s.state.deeplinkProtocolAvailable=k),"walletVersion"in h&&(p=h.walletVersion),yield(c=s.state.storageManager)===null||c===void 0?void 0:c.persist
9ChannelConfig(Object.assign(Object.assign({},f),{otherKey:w,walletVersion:p,deeplinkProtocolAvailable:k,relayPersistence:!0})),yield(l=s.state.storageManager)===null||l===void 0?void 0:l.persistAccounts(g),yield(u=s.state.storageManager)===null||u===void 0?void 0:u.persistChainId(m)}s.emit(te.WALLET_INIT,{accounts:h.accounts,chainId:h.chainId})}catch{}}})})(i,r).catch(s=>{q.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] error=${s}`)});else if(r.type===xe.TERMINATE)(function(s){return X(this,void 0,void 0,function*(){const{state:a}=s;a.isOriginator&&(yield nh({options:{terminate:!0,sendMessage:!1},instance:s}),s.emit(te.TERMINATE))})})(i).catch(s=>{q.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] error=${s}`)});else if(r.type===xe.PAUSE)(function(s){const{state:a}=s;a.paused=!0,s.setConnectionStatus(je.PAUSED)})(i);else if(r.type===xe.READY&&o.isOriginator)(function(s){const{state:a}=s;s.setConnectionStatus(je.LINKED);const c=a.paused;a.paused=!1,s.emit(te.CLIENTS_READY,{isOriginator:a.isOriginator,walletInfo:a.walletInfo}),c&&(a.authorized=!0,s.emit(te.AUTHORIZED))})(i);else{if(r.type===xe.OTP&&o.isOriginator)return void function(s,a){var c;const{state:l}=s;s.emit(te.OTP,a.otpAnswer),"6.6".localeCompare(((c=l.walletInfo)===null||c===void 0?void 0:c.version)||"")===1&&s.emit(te.SDK_RPC_CALL,{method:B1.ETH_REQUESTACCOUNTS,params:[]})}(i,r);r.type===xe.AUTHORIZED&&o.isOriginator&&function(s){const{state:a}=s;a.authorized=!0,s.emit(te.AUTHORIZED)}(i)}i.emit(te.MESSAGE,r)}else(function(s,a){var c;const{state:l}=s;(c=l.communicationLayer)===null||c===void 0||c.sendMessage({type:xe.WALLET_INFO,walletInfo:l.walletInfo}),l.originatorInfo=a.originatorInfo||a.originator,s.emit(te.CLIENTS_READY,{isOriginator:l.isOriginator,originatorInfo:l.originatorInfo}),l.paused=!1})(i,r)}(n,t)}}function G1(t){return()=>{const{state:e}=t;q.RemoteCommunication("[RemoteCommunication: handleSocketReconnectEvent()] on 'socket_reconnect' -- reset key exchange status / set ready to false"),e.ready=!1,e.authorized=!1,Qd(e),t.emitServiceStatusEvent({context:"socket_reconnect"})}}function Y1(t){return()=>{const{state:e}=t;q.RemoteCommunication("[RemoteCommunication: handleSocketDisconnectedEvent()] on 'socket_Disconnected' set ready to false"),e.ready=!1}}function Z1(t){return()=>X(this,void 0,void 0,function*(){var e,n,r,i,o,s,a;const{state:c}=t;q.RemoteCommunication(`[RemoteCommunication: handleFullPersistenceEvent()] context=${c.context}`),t.state.ready=!0,t.state.clientsConnected=!0,t.state.authorized=!0,t.state.relayPersistence=!0,(e=t.state.communicationLayer)===null||e===void 0||e.getKeyExchange().setKeysExchanged(!0),t.emit(te.KEYS_EXCHANGED,{keysExchanged:!0,isOriginator:!0}),t.emit(te.AUTHORIZED),t.emit(te.CLIENTS_READY),t.emit(te.CHANNEL_PERSISTENCE);try{c.channelConfig=Object.assign(Object.assign({},c.channelConfig),{localKey:(n=c.communicationLayer)===null||n===void 0?void 0:n.getKeyExchange().getKeyInfo().ecies.private,otherKey:(r=c.communicationLayer)===null||r===void 0?void 0:r.getKeyExchange().getOtherPublicKey(),channelId:(i=c.channelId)!==null&&i!==void 0?i:"",validUntil:(s=(o=c.channelConfig)===null||o===void 0?void 0:o.validUntil)!==null&&s!==void 0?s:ir,relayPersistence:!0}),yield(a=c.storageManager)===null||a===void 0?void 0:a.persistChannelConfig(c.channelConfig)}catch{}})}function Wc({communicationLayerPreference:t,otherPublicKey:e,reconnect:n,ecies:r,communicationServerUrl:i=rr,instance:o}){var s,a,c,l,u,d,h,f,g,m,w;const{state:p}=o;if(q.RemoteCommunication("[initCommunicationLayer()] ",JSON.stringify(p,null,2)),t!==Pn.SOCKET)throw new Error("Invalid communication protocol");p.communicationLayer=new K1({communicationLayerPreference:t,otherPublicKey:e,reconnect:n,transports:p.transports,communicationServerUrl:i,context:p.context,ecies:r,logging:p.logging,remote:o});let k=typeof document<"u"&&document.URL||"",_=typeof document<"u"&&document.title||"";!((s=p.dappMetadata)===null||s===void 0)&&s.url&&(k=p.dappMetadata.url),!((a=p.dappMetadata)===null||a===void 0)&&a.name&&(_=p.dappMetadata.name);const O=(d=(l=(c=p.dappMetadata)===null||c===void 0?void 0:c.name)!==null&&l!==void 0?l:(u=p.dappMetadata)===null||u===void 0?void 0:u.url)!==null&&d!==void 0?d:"N/A",N=typeof window<"u"&&window.location!==void 0&&(h=window.location.hostname)!==null&&h!==void 0?h:O,U={url:k,title:_,source:(f=p.dappMetadata)===null||f===void 0?void 0:f.source,dappId:N,icon:((g=p.dappMetadata)===null||g===void 0?void 0:g.iconUrl)||((m=p.dappMetadata)===null||m===void 0?void 0:m.base64Icon),platform:p.platformType,apiVersion:En.version,connector:(w=p.dappMetadata)===null||w===void 0?void 0:w.connector};p.originatorInfo=U;const W={[te.AUTHORIZED]:U1(o),[te.MESSAGE]:W1(o),[te.CHANNEL_PERSISTENCE]:Z1(o),[te.CLIENTS_CONNECTED]:F1(o,t),[te.KEYS_EXCHANGED]:V1(o,t),[te.SOCKET_DISCONNECTED]:Y1(o),[te.SOCKET_RECONNECT]:G1(o),[te.CLIENTS_DISCONNECTED]:z1(o),[te.KEY_INFO]:()=>{},[te.CHANNEL_CREATED]:H1(o),[te.CLIENTS_WAITING]:q1(o),[te.RPC_UPDATE]:V=>
9{o.emit(te.RPC_UPDATE,V)}};for(const[V,H]of Object.entries(W))try{p.communicationLayer.on(V,H)}catch{}}function nh(t){return X(this,arguments,void 0,function*({options:e,instance:n}){const{state:r}=n;return q.RemoteCommunication(`[RemoteCommunication: disconnect()] channel=${r.channelId}`,e),new Promise((i,o)=>{var s,a,c,l,u,d;e!=null&&e.terminate?(n.state.ready&&Jt({id:(s=n.state.channelId)!==null&&s!==void 0?s:"",event:Te.TERMINATED},n.state.communicationServerUrl).catch(h=>{}),r.ready=!1,r.paused=!1,(a=r.storageManager)===null||a===void 0||a.terminate((c=r.channelId)!==null&&c!==void 0?c:""),n.state.terminated=!0,e.sendMessage?!((l=r.communicationLayer)===null||l===void 0)&&l.getKeyInfo().keysExchanged&&n.state.communicationLayer&&eh(n.state.communicationLayer,{type:xe.TERMINATE}).then(()=>{i(!0)}).catch(h=>{o(h)}):i(!0),r.authorized=!1,r.relayPersistence=!1,r.channelId=ia(),e.channelId=r.channelId,r.channelConfig=void 0,r.originatorConnectStarted=!1,(u=r.communicationLayer)===null||u===void 0||u.disconnect(e),n.setConnectionStatus(je.TERMINATED)):((d=r.communicationLayer)===null||d===void 0||d.disconnect(e),n.setConnectionStatus(je.DISCONNECTED),i(!0))})})}(Pn||(Pn={})).SOCKET="socket",function(t){t.NonBrowser="nodejs",t.MetaMaskMobileWebview="in-app-browser",t.DesktopWeb="web-desktop",t.MobileWeb="web-mobile",t.ReactNative="react-native"}(Fe||(Fe={}));class J1 extends po.EventEmitter2{constructor(e){super(),this.state={ready:!1,authorized:!1,isOriginator:!1,terminated:!1,protocolVersion:1,paused:!1,deeplinkProtocolAvailable:!1,platformType:"metamask-mobile",analytics:!1,reconnection:!1,originatorInfoSent:!1,communicationServerUrl:rr,context:"",persist:!1,clientsConnected:!1,sessionDuration:ir,originatorConnectStarted:!1,debug:!1,_connectionStatus:je.DISCONNECTED},this._options=e;const{platformType:n,communicationLayerPreference:r,otherPublicKey:i,reconnect:o,walletInfo:s,dappMetadata:a,protocolVersion:c,transports:l,context:u,relayPersistence:d,ecies:h,analytics:f=!1,storage:g,sdkVersion:m,communicationServerUrl:w=rr,logging:p,autoConnect:k={timeout:N1}}=e;this.state.otherPublicKey=i,this.state.dappMetadata=a,this.state.walletInfo=s,this.state.transports=l,this.state.platformType=n,this.state.analytics=f,this.state.protocolVersion=c??1,this.state.isOriginator=!i,this.state.relayPersistence=d,this.state.communicationServerUrl=w,this.state.context=u,this.state.terminated=!1,this.state.sdkVersion=m,this.setMaxListeners(50),this.setConnectionStatus(je.DISCONNECTED),g!=null&&g.duration&&(this.state.sessionDuration=ir),this.state.storageOptions=g,this.state.autoConnectOptions=k,this.state.debug=(p==null?void 0:p.remoteLayer)===!0,(p==null?void 0:p.remoteLayer)===!0&&Ge.enable("RemoteCommunication:Layer"),(p==null?void 0:p.serviceLayer)===!0&&Ge.enable("SocketService:Layer"),(p==null?void 0:p.eciesLayer)===!0&&Ge.enable("ECIES:Layer"),(p==null?void 0:p.keyExchangeLayer)===!0&&Ge.enable("KeyExchange:Layer"),this.state.logging=p,g!=null&&g.storageManager&&(this.state.storageManager=g.storageManager),q.RemoteCommunication(`[RemoteCommunication: constructor()] protocolVersion=${c} relayPersistence=${d} isOriginator=${this.state.isOriginator} communicationLayerPreference=${r} otherPublicKey=${i} reconnect=${o}`),this.state.isOriginator||Wc({communicationLayerPreference:r,otherPublicKey:i,reconnect:o,ecies:h,communicationServerUrl:w,instance:this}),this.emitServiceStatusEvent({context:"constructor"})}initFromDappStorage(){return X(this,void 0,void 0,function*(){var e;if(this.state.storageManager){const n=yield this.state.storageManager.getPersistedChannelConfig({});n&&(this.state.channelConfig=n,this.state.channelId=n.channelId,this.state.deeplinkProtocolAvailable=(e=n.deeplinkProtocolAvailable)!==null&&e!==void 0&&e,n.relayPersistence&&(this.state.authorized=!0,this.state.ready=!0,this.setConnectionStatus(je.LINKED),yield this.connectToChannel({channelId:n.channelId})))}Wc({communicationLayerPreference:Pn.SOCKET,otherPublicKey:this.state.otherPublicKey,reconnect:this._options.reconnect,ecies:this._options.ecies,communicationServerUrl:this.state.communicationServerUrl,instance:this})})}originatorSessionConnect(){return X(this,void 0,void 0,function*(){return yield function(e){return X(this,void 0,void 0,function*(){var n;const{state:r}=e;
9if(!r.storageManager)return void q.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] no storage manager defined - skip");const i=yield r.storageManager.getPersistedChannelConfig({});if(q.RemoteCommunication(`[RemoteCommunication: originatorSessionConnect()] autoStarted=${r.originatorConnectStarted} channelConfig`,i),(n=r.communicationLayer)===null||n===void 0?void 0:n.isConnected())return q.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] socket already connected - skip"),i;if(i){if(i.validUntil>Date.now())return r.channelConfig=i,r.originatorConnectStarted=!0,r.channelId=i==null?void 0:i.channelId,r.reconnection=!0,i;q.RemoteCommunication("[RemoteCommunication: autoConnect()] Session has expired")}r.originatorConnectStarted=!1})}(this)})}generateChannelIdConnect(){return X(this,void 0,void 0,function*(){return function(e){return X(this,void 0,void 0,function*(){var n,r,i,o,s,a;if(!e.communicationLayer)throw new Error("communication layer not initialized");if(e.ready)throw new Error("Channel already connected");if(e.channelId&&(!((n=e.communicationLayer)===null||n===void 0)&&n.isConnected()))return e.channelConfig=Object.assign(Object.assign({},e.channelConfig),{channelId:e.channelId,validUntil:Date.now()+e.sessionDuration}),(r=e.storageManager)===null||r===void 0||r.persistChannelConfig(e.channelConfig),{channelId:e.channelId,privKey:(o=(i=e.communicationLayer)===null||i===void 0?void 0:i.getKeyInfo())===null||o===void 0?void 0:o.ecies.private,pubKey:(a=(s=e.communicationLayer)===null||s===void 0?void 0:s.getKeyInfo())===null||a===void 0?void 0:a.ecies.public};q.RemoteCommunication("[RemoteCommunication: generateChannelId()]");const c=yield e.communicationLayer.createChannel();q.RemoteCommunication("[RemoteCommunication: generateChannelId()] channel created",c);const l=Object.assign(Object.assign({},e.channelConfig),{channelId:c.channelId,localKey:c.privKey,validUntil:Date.now()+e.sessionDuration});return e.channelId=c.channelId,e.channelConfig=l,{channelId:e.channelId,pubKey:c.pubKey,privKey:c.privKey}})}(this.state)})}clean(){return Qd(this.state)}connectToChannel({channelId:e,withKeyExchange:n,authorized:r}){return function(i){return X(this,arguments,void 0,function*({channelId:o,withKeyExchange:s,authorized:a,state:c}){var l,u,d;if(!ws(o))throw q.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${c.context} invalid channel channelId=${o}`),new Error(`Invalid channel ${o}`);if(q.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${c.context} channelId=${o} withKeyExchange=${s}`),(l=c.communicationLayer)===null||l===void 0?void 0:l.isConnected())return void q.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${c.context} already connected - interrupt connection.`);c.channelId=o,yield(u=c.communicationLayer)===null||u===void 0?void 0:u.connectToChannel({channelId:o,authorized:a,withKeyExchange:s});const h=Object.assign(Object.assign({},c.channelConfig),{channelId:o,validUntil:Date.now()+c.sessionDuration});c.channelConfig=h,(d=c.storageManager)===null||d===void 0||d.persist
9ChannelConfig(h)})}({channelId:e,authorized:r,withKeyExchange:n,state:this.state})}sendMessage(e){return function(n,r){return X(this,void 0,void 0,function*(){var i,o;const{state:s}=n;q.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${s.context} paused=${s.paused} ready=${s.ready} relayPersistence=${s.relayPersistence} authorized=${s.authorized} socket=${(i=s.communicationLayer)===null||i===void 0?void 0:i.isConnected()} clientsConnected=${s.clientsConnected} status=${s._connectionStatus}`,r),s.relayPersistence||s.ready&&(!((o=s.communicationLayer)===null||o===void 0)&&o.isConnected())&&s.clientsConnected||(q.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${s.context} SKIP message waiting for MM mobile readiness.`),yield new Promise(a=>{n.once(te.CLIENTS_READY,a)}),q.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${s.context} AFTER SKIP / READY -- sending pending message`));try{return yield function(c,l){return X(this,void 0,void 0,function*(){return new Promise(u=>{var d;const{state:h}=c;q.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${h.context} ready=${h.ready} authorized=${h.authorized} method=${l.method}`),!h.isOriginator||h.authorized||h.relayPersistence?(d=h.communicationLayer)===null||d===void 0||d.sendMessage(l).then(f=>{u(f)}).catch(f=>{u(!1)}):c.once(te.AUTHORIZED,()=>{var f;q.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${h.context} AFTER SKIP / AUTHORIZED -- sending pending message`),(f=h.communicationLayer)===null||f===void 0||f.sendMessage(l).then(g=>{u(g)}).catch(g=>{u(!1)})})})})}(n,r)}catch(a){throw a}})}(this,e)}testStorage(){return X(this,void 0,void 0,function*(){return function(e){return X(this,void 0,void 0,function*(){var n;const r=yield(n=e.storageManager)===null||n===void 0?void 0:n.getPersistedChannelConfig();q.RemoteCommunication("[RemoteCommunication: testStorage()] res",r)})}(this.state)})}hasDeeplinkProtocol(){return this.state.deeplinkProtocolAvailable}getChannelConfig(){return this.state.channelConfig}isReady(){return this.state.ready}isConnected(){var e;return(e=this.state.communicationLayer)===null||e===void 0?void 0:e.isConnected()}isAuthorized(){return this.state.authorized}isPaused(){return this.state.paused}getCommunicationLayer(){return this.state.communicationLayer}ping(){return X(this,void 0,void 0,function*(){var e;q.RemoteCommunication(`[RemoteCommunication: ping()] channel=${this.state.channelId}`),yield(e=this.state.communicationLayer)===null||e===void 0?void 0:e.ping()})}testLogger(){q.RemoteCommunication(`testLogger() channel=${this.state.channelId}`),q.SocketService(`testLogger() channel=${this.state.channelId}`),q.Ecies(`testLogger() channel=${this.state.channelId}`),q.KeyExchange(`testLogger() channel=${this.state.channelId}`)}keyCheck(){var e;q.RemoteCommunication(`[RemoteCommunication: keyCheck()] channel=${this.state.channelId}`),(e=this.state.communicationLayer)===null||e===void 0||e.keyCheck()}setConnectionStatus(e){this.state._connectionStatus!==e&&(this.state._connectionStatus=e,this.emit(te.CONNECTION_STATUS,e),this.emitServiceStatusEvent({context:"setConnectionStatus"}))}emitServiceStatusEvent(e={}){this.emit(te.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(e=this.state.communicationLayer)===null||e===void 0?void 0:e.getKeyInfo()}resetKeys(){var e;(e=this.state.communicationLayer)===null||e===void 0||e.resetKeys()}setOtherPublicKey(e){var n;const r=(n=this.state.communicationLayer)===null||n===void 0?void 0:n.getKeyExchange();if(!r)throw new Error("KeyExchange is not initialized.");r.getOtherPublicKey()!==e&&r.setOtherPublicKey(e)}pause(){return X(this,void 0,void 0,function*(){var e;q.RemoteCommunication(`[RemoteCommunication: pause()] channel=${this.state.channelId}`),yield(e=this.state.communicationLayer)===null||e===void 0?void 0:e.pause(),this.setConnectionStatus(je.PAUSED)})}getVersion(){return En.version}hasRelayPersistence(){var e;return(e=this.state.relayPersistence)!==null&&e!==void 0&&e}resume(){return X(this,void 0,void 0,function*(){return function(e){return X(this,void 0,void 0,function*(){var n;const{state:r}=e;q.RemoteCommunication(`[RemoteCommunication: resume()] channel=${r.channelId}`),yield(n=r.communicationLayer)===null||n===void 0?void 0:n.resume(),e.setConnectionStatus(je.LINKED)})}(this)})}encrypt(e){var n,r,i;const o=(n=this.state.communicationLayer)===null||n===void 0?void 0:n.getKeyExchange(),s=o==null?void 0:o.getOtherPublicKey();
9if(!s)throw new Error("KeyExchange not completed");return(i=(r=this.state.communicationLayer)===null||r===void 0?void 0:r.state.eciesInstance)===null||i===void 0?void 0:i.encrypt(e,s)}decrypt(e){var n,r,i;if(!(!((n=this.state.communicationLayer)===null||n===void 0)&&n.state.eciesInstance))throw new Error("ECIES instance is not initialized");return(i=(r=this.state.communicationLayer)===null||r===void 0?void 0:r.state.eciesInstance)===null||i===void 0?void 0:i.decrypt(e)}getChannelId(){return this.state.channelId}getRPCMethodTracker(){var e;return(e=this.state.communicationLayer)===null||e===void 0?void 0:e.getRPCMethodTracker()}reject({channelId:e}){return function(n){return X(this,arguments,void 0,function*({channelId:r,state:i}){var o,s,a;if(!ws(r))throw q.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${i.context} invalid channel channelId=${r}`),new Error(`Invalid channel ${r}`);if(i.isOriginator)return void q.RemoteCommunication(`[RemoteCommunication: reject()] context=${i.context} isOriginator=${i.isOriginator} channelId=${r}`);const{socket:c}=(s=(o=i.communicationLayer)===null||o===void 0?void 0:o.state)!==null&&s!==void 0?s:{};c!=null&&c.connected||(q.RemoteCommunication(`[RemoteCommunication: reject()] context=${i.context} socket already connected`),c==null||c.connect()),Jt(Object.assign(Object.assign({id:r,event:Te.REJECTED},i.originatorInfo),{sdkVersion:i.sdkVersion,commLayerVersion:En.version,walletVersion:(a=i.walletInfo)===null||a===void 0?void 0:a.version}),i.communicationServerUrl).catch(l=>{}),yield new Promise((l,u)=>{c==null||c.emit(te.REJECTED,{channelId:r},(d,h)=>{q.RemoteCommunication(`[RemoteCommunication: reject()] context=${i.context} socket=${c==null?void 0:c.id}`,{error:d,response:h}),d?u(d):l(h)})})})}({channelId:e,state:this.state})}disconnect(e){return X(this,void 0,void 0,function*(){return nh({options:e,instance:this})})}}(function(t){t.RENEW="renew",t.LINK="link"})(Vc||(Vc={}));var X1="ERC721",Q1="ERC1155",Me={errors:{disconnected:()=>"MetaMask: Disconnected from chain. Attempting to connect.",permanentlyDisconnected:()=>"MetaMask: Disconnected from MetaMask background. Page reload required.",sendSiteMetadata:()=>"MetaMask: Failed to send site metadata. This is an internal error, please report this bug.",unsupportedSync:t=>`MetaMask: The MetaMask Ethereum provider does not support synchronous methods like ${t} without a callback parameter.`,invalidDuplexStream:()=>"Must provide a Node.js-style duplex stream.",invalidNetworkParams:()=>"MetaMask: Received invalid network parameters. Please report this bug.",invalidRequestArgs:()=>"Expected a single, non-array, object argument.",invalidRequestMethod:()=>"'args.method' must be a non-empty string.",invalidRequestParams:()=>"'args.params' must be an object or array if provided.",invalidLoggerObject:()=>"'args.logger' must be an object if provided.",invalidLoggerMethod:t=>`'args.logger' must include required method '${t}'.`},info:{connected:t=>`MetaMask: Connected to chain with ID "${t}".`},warnings:{chainIdDeprecation:`MetaMask: 'ethereum.chainId' is deprecated and may be removed in the future. Please use the 'eth_chainId' RPC method instead. 10For more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23`,networkVersionDeprecation:`MetaMask: 'ethereum.networkVersion' is deprecated and may be removed in the future. Please use the 'net_version' RPC method instead. 11For more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23`,selectedAddressDeprecation:`MetaMask: 'ethereum.selectedAddress' is deprecated and may be removed in the future. Please use the 'eth_accounts' RPC method instead. 12For more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23`,enableDeprecation:`MetaMask: 'ethereum.enable()' is deprecated and may be removed in the future. Please use the 'eth_requestAccounts' RPC method instead. 13For more information, see: https://eips.ethereum.org/EIPS/eip-1102`,sendDeprecation:`MetaMask: 'ethereum.send(...)' is deprecated and may be removed in the future. Please use 'ethereum.sendAsync(...)' or 'ethereum.request(...)' instead. 14For more information, see: https://eips.ethereum.org/EIPS/eip-1193`,events:{close:`MetaMask: The event 'close' is deprecated and may be removed in the future. Please use 'disconnect' instead. 15For 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. 16For 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. 17For 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. 18For more information, see: https://eips.ethereum.org/EIPS/eip-1193#message`},rpc:{ethDecryptDeprecation:`MetaMask: The RPC method 'eth_decrypt' is deprecated and may be removed in the future. 19For 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. 20For 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. 21For more information, see: https://github.com/MetaMask/metamask-improvement-proposals/blob/main/MIPs/mip-1.md and https://github.com/MetaMask/metamask-improvement-proposals/blob/main/PROCESS-GUIDE.md#proposal-lifecycle`},experimentalMethods:"MetaMask: 'ethereum._metamask' exposes non-standard, experimental methods. They may be removed or changed without warning."}};function ep(t){const e={ethDecryptDeprecation:!1,ethGetEncryptionPublicKeyDeprecation:!1,walletWatchAssetNFTExperimental:!1};return(n,r,i)=>{var o;e.ethDecryptDeprecation||n.method!=="eth_decrypt"?e.ethGetEncryptionPublicKeyDeprecation||n.method!=="eth_getEncryptionPublicKey"?!e.walletWatchAssetNFTExperimental&&n.method==="wallet_watchAsset"&&[X1,Q1].includes(((o=n.params)==null?void 0:o.type)||"")&&(t.warn(Me.warnings.rpc.walletWatchAssetNFTExperimental),e.walletWatchAssetNFTExperimental=!0):(t.warn(Me.warnings.rpc.ethGetEncryptionPublicKeyDeprecation),e.ethGetEncryptionPublicKeyDeprecation=!0):(t.warn(Me.warnings.rpc.ethDecryptDeprecation),e.ethDecryptDeprecation=!0),i()}}var rh=4294967295,Gc=Math.floor(Math.random()*rh);function tp(){return(t,e,n,r)=>{const i=t.id,o=Gc=(Gc+1)%rh;t.id=o,e.id=o,n(s=>{t.id=i,e.id=i,s()})}}var _a=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},gn=(t,e,n)=>(_a(t,e,"read from private field"),n?n.call(t):e.get(t)),Et=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},fi=(t,e,n,r)=>(_a(t,e,"write to private field"),e.set(t,n),n),qe=(t,e,n)=>(_a(t,e,"access private method"),n),dn={invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},Yc={"-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 Zc(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}var Ji=(t,e)=>Object.hasOwnProperty.call(t,e);class np extends TypeError{constructor(e,n){let r;const{message:i,explanation:o,...s}=e,{path:a}=e,c=a.length===0?i:`At path: ${a.join(".")} -- ${i}`;
21super(o??c),o!=null&&(this.cause=c),Object.assign(this,s),this.name=this.constructor.name,this.failures=()=>r??(r=[e,...n()])}}function Zt(t){return typeof t=="object"&&t!=null}function jt(t){return typeof t=="symbol"?t.toString():typeof t=="string"?JSON.stringify(t):`${t}`}function rp(t,e,n,r){if(t===!0)return;t===!1?t={}:typeof t=="string"&&(t={message:t});const{path:i,branch:o}=e,{type:s}=n,{refinement:a,message:c=`Expected a value of type \`${s}\`${a?` with refinement \`${a}\``:""}, but received: \`${jt(r)}\``}=t;return{value:r,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...t,message:c}}function*Jc(t,e,n,r){(function(i){return Zt(i)&&typeof i[Symbol.iterator]=="function"})(t)||(t=[t]);for(const i of t){const o=rp(i,e,n,r);o&&(yield o)}}function*Ca(t,e,n={}){const{path:r=[],branch:i=[t],coerce:o=!1,mask:s=!1}=n,a={path:r,branch:i};if(o&&(t=e.coercer(t,a),s&&e.type!=="type"&&Zt(e.schema)&&Zt(t)&&!Array.isArray(t)))for(const l in t)e.schema[l]===void 0&&delete t[l];let c="valid";for(const l of e.validator(t,a))l.explanation=n.message,c="not_valid",yield[l,void 0];for(let[l,u,d]of e.entries(t,a)){const h=Ca(u,d,{path:l===void 0?r:[...r,l],branch:l===void 0?i:[...i,u],coerce:o,mask:s,message:n.message});for(const f of h)f[0]?(c=f[0].refinement!=null?"not_refined":"not_valid",yield[f[0],void 0]):o&&(u=f[1],l===void 0?t=u:t instanceof Map?t.set(l,u):t instanceof Set?t.add(u):Zt(t)&&(u!==void 0||l in t)&&(t[l]=u))}
21if(c!=="not_valid")for(const l of e.refiner(t,a))l.explanation=n.message,c="not_refined",yield[l,void 0];c==="valid"&&(yield[void 0,t])}class St{constructor(e){const{type:n,schema:r,validator:i,refiner:o,coercer:s=c=>c,entries:a=function*(){}}=e;this.type=n,this.schema=r,this.entries=a,this.coercer=s,this.validator=i?(c,l)=>Jc(i(c,l),l,this,c):()=>[],this.refiner=o?(c,l)=>Jc(o(c,l),l,this,c):()=>[]}assert(e,n){return ih(e,this,n)}create(e,n){return oh(e,this,n)}is(e){return cr(e,this)}mask(e,n){return function(r,i,o){const s=Nr(r,i,{coerce:!0,mask:!0,message:o});if(s[0])throw s[0];return s[1]}(e,this,n)}validate(e,n={}){return Nr(e,this,n)}}function ih(t,e,n){const r=Nr(t,e,{message:n});if(r[0])throw r[0]}function oh(t,e,n){const r=Nr(t,e,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function cr(t,e){return!Nr(t,e)[0]}function Nr(t,e,n={}){const r=Ca(t,e,n),i=function(o){const{done:s,value:a}=o.next();return s?void 0:a}(r);return i[0]?[new np(i[0],function*(){for(const s of r)s[0]&&(yield s[0])}),void 0]:[void 0,i[1]]}function _n(t,e){return new St({type:t,schema:null,validator:e})}function Xc(t){let e;return new St({type:"lazy",schema:null,*entries(n,r){e??(e=t()),yield*e.entries(n,r)},validator:(n,r)=>(e??(e=t()),e.validator(n,r)),coercer:(n,r)=>(e??(e=t()),e.coercer(n,r)),refiner:(n,r)=>(e??(e=t()),e.refiner(n,r))})}function sh(t){return new St({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[n,r]of e.entries())yield[n,r,t]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${jt(e)}`})}function ah(t){const e=jt(t),n=typeof t;return new St({type:"literal",schema:n==="string"||n==="number"||n==="boolean"?t:null,validator:r=>r===t||`Expected the literal \`${e}\`, but received: ${jt(r)}`})}function ch(){return _n("number",t=>typeof t=="number"&&!isNaN(t)||`Expected a number, but received: ${jt(t)}`)}function lh(t){const e=t?Object.keys(t):[],n=_n("never",()=>!1);return new St({type:"object",schema:t||null,*entries(r){if(t&&Zt(r)){const i=new Set(Object.keys(r));for(const o of e)i.delete(o),yield[o,r[o],t[o]];for(const o of i)yield[o,r[o],n]}},validator:r=>Zt(r)||`Expected an object, but received: ${jt(r)}`,coercer:r=>Zt(r)?{...r}:r})}function Qc(t){return new St({...t,validator:(e,n)=>e===void 0||t.validator(e,n),refiner:(e,n)=>e===void 0||t.refiner(e,n)})}function uh(t,e){return new St({type:"record",schema:null,*entries(n){if(Zt(n))for(const r in n){const i=n[r];yield[r,r,t],yield[r,i,e]}},validator:n=>Zt(n)||`Expected an object, but received: ${jt(n)}`})}function Cn(){return _n("string",t=>typeof t=="string"||`Expected a string, but received: ${jt(t)}`)}function wo(t){const e=t.map(n=>n.type).join(" | ");return new St({type:"union",schema:null,coercer(n){for(const r of t){const[i,o]=r.validate(n,{coerce:!0});if(!i)return o}return n},validator(n,r){const i=[];for(const o of t){const[...s]=Ca(n,o,r),[a]=s;if(!a[0])return[];for(const[c]of s)c&&i.push(c)}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${jt(n)}`,...i]}})}function ip(t){return function(e){return function(n){return typeof n=="object"&&n!==null&&"message"in n}(e)&&typeof e.message=="string"?e.message:e==null?"":String(e)}(t).replace(/\.$/u,"")}function op(t,e){var r,i;return n=t,typeof((i=(r=n==null?void 0:n.prototype)==null?void 0:r.constructor)==null?void 0:i.name)=="string"?new t({message:e}):t({message:e});var n}var sp=class extends Error{constructor(t){super(t.message),this.code="ERR_ASSERTION"}};function dh(){throw new Error("setTimeout has not been defined")}function hh(){throw new Error("clearTimeout has not been defined")}var on=dh,sn=hh;function fh(t){if(on===setTimeout)return setTimeout(t,0);if((on===dh||!on)&&setTimeout)return on=setTimeout,setTimeout(t,0);try{return on(t,0)}catch{try{return on.call(null,t,0)}catch{return on.call(this,t,0)}}}typeof Ye.setTimeout=="function"&&(on=setTimeout),typeof Ye.clearTimeout=="function"&&(sn=clearTimeout);var Rn,Yt=[],tr=!1,Ai=-1;function ap(){tr&&Rn&&(tr=!1,Rn.length?Yt=Rn.concat(Yt):Ai=-1,Yt.length&&ph())}function ph(){if(!tr){var t=fh(ap);tr=!0;for(var e=Yt.length;e;){for(Rn=Yt,Yt=[];++Ai<e;)Rn&&Rn[Ai].run();Ai=-1,e=Yt.length}Rn=null,tr=!1,function(n){if(sn===clearTimeout)return clearTimeout(n);if((sn===hh||!sn)&&clearTimeout)return sn=clearTimeout,clearTimeout(n);try{return sn(n)}catch{try{return sn.call(null,n)}catch{return sn.call(this,n)}}}(t)}}function gh(t,e){this.fun=t,this.array=e}gh.prototype.run=function(){this.fun.apply(null,this.array)};function Nn(){}var cp=Nn,lp=Nn,up=Nn,dp=Nn,hp=Nn,fp=Nn,pp=Nn,zn=Ye.performance||{},gp=zn.now||zn.mozNow||zn.msNow||zn.oNow||zn.webkitNow||function(){return new Date().getTime()},mp=new Date,we={nextTick:function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];Yt.push(new gh(t,e)),Yt.length!==1||tr||fh(ph)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:cp,addListener:lp,once:up,off:dp,removeListener:hp,removeAllListeners:fp,emit:pp,binding:function(t){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(t){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(t){var e=.001*gp.call(zn),n=Math.floor(e),r=Math.floor(e%1*1e9);return t&&(n-=t[0],(r-=t[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-mp)/1e3}},Br=t=>lh(t);function el({path:t,branch:e}){const n=t[t.length-1];return Ji(e[e.length-2],n)}function Xi(t){return new St({...t,type:`optional ${t.type}`,validator:(e,n)=>!el(n)||t.validator(e,n),refiner:(e,n)=>!el(n)||t.refiner(e,n)})}var pi,tl,nl,Qi=wo([ah(null),_n("boolean",t=>typeof t=="boolean"),_n("finite number",t=>cr(t,ch())&&Number.isFinite(t)),Cn(),sh(Xc(()=>Qi)),uh(Cn(),Xc(()=>Qi))]),Dr=(pi=Qi,tl=_n("any",()=>!0),nl=t=>(function(e,n,r="Assertion failed",i=sp){try{ih(e,n)}catch(o){throw op(i,`${r}: ${ip(o)}.`)}}(t,Qi),JSON.parse(JSON.stringify(t,(e,n)=>{if(e!=="__proto__"&&e!=="constructor")return n}))),new St({...pi,coercer:(t,e)=>cr(t,tl)?pi.coercer(nl(t,e),e):pi.coercer(t,e)}));function js(t){try{return function(e){oh(e,Dr)}(t),!0}catch{return!1}}var Cr=ah("2.0"),Mi=function(t){return new St({...t,validator:(e,n)=>e===null||t.validator(e,n),refiner:(e,n)=>e===null||t.refiner(e,n)})}(wo([ch(),Cn()])),Ks=Br({code:_n("integer",t=>
21typeof t=="number"&&!isNaN(t)&&Number.isInteger(t)||`Expected an integer, but received: ${jt(t)}`),message:Cn(),data:Xi(Dr),stack:Xi(Cn())}),mh=wo([uh(Cn(),Dr),sh(Dr)]),yp=Br({id:Mi,jsonrpc:Cr,method:Cn(),params:Xi(mh)}),vp=Br({jsonrpc:Cr,method:Cn(),params:Xi(mh)});function rl(t){return cr(t,yp)}function il(t){return cr(t,Ks)}lh({id:Mi,jsonrpc:Cr,result:Qc(_n("unknown",()=>!0)),error:Qc(Ks)}),wo([Br({id:Mi,jsonrpc:Cr,result:Dr}),Br({id:Mi,jsonrpc:Cr,error:Ks})]);var ol=dn.internal,bp="Unspecified error message. This is a bug, please report it.",wp={code:ol,message:yh(ol)},Ep="Unspecified server error.";function yh(t,e=bp){if(function(n){return Number.isInteger(n)}(t)){const n=t.toString();if(Ji(Yc,n))return Yc[n].message;if(function(r){return r>=-32099&&r<=-32e3}(t))return Ep}return e}function sl(t,{fallbackError:e=wp,shouldIncludeStack:n=!0}={}){if(!il(e))throw new Error("Must provide fallback error with integer number code and string message.");const r=function(i,o){if(i&&typeof i=="object"&&"serialize"in i&&typeof i.serialize=="function")return i.serialize();if(il(i))return i;const s=vh(i);return{...o,data:{cause:s}}}(t,e);return n||delete r.stack,r}function vh(t){return Array.isArray(t)?t.map(e=>js(e)?e:Zc(e)?al(e):null):Zc(t)?al(t):js(t)?t:null}function al(t){return Object.getOwnPropertyNames(t).reduce((e,n)=>{const r=t[n];return js(r)&&(e[n]=r),e},{})}var bh=br;br.default=br,br.stable=cl,br.stableStringify=cl;var eo="[...]",wh="[Circular]",In=[],On=[];function Eh(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function br(t,e,n,r){var i;r===void 0&&(r=Eh()),Us(t,"",0,[],void 0,0,r);try{i=On.length===0?JSON.stringify(t,e,n):JSON.stringify(t,_h(e),n)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;In.length!==0;){var o=In.pop();o.length===4?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return i}function nr(t,e,n,r){var i=Object.getOwnPropertyDescriptor(r,n);i.get!==void 0?i.configurable?(Object.defineProperty(r,n,{value:t}),In.push([r,n,e,i])):On.push([e,n,t]):(r[n]=t,In.push([r,n,e]))}function Us(t,e,n,r,i,o,s){var a;if(o+=1,typeof t=="object"&&t!==null){for(a=0;a<r.length;a++)if(r[a]===t)return void nr(wh,t,e,i);if(s.depthLimit!==void 0&&o>s.depthLimit||s.edgesLimit!==void 0&&n+1>s.edgesLimit)return void nr(eo,t,e,i);if(r.push(t),Array.isArray(t))for(a=0;a<t.length;a++)Us(t[a],a,a,r,t,o,s);else{var c=Object.keys(t);for(a=0;a<c.length;a++){var l=c[a];Us(t[l],l,a,r,t,o,s)}}r.pop()}}function _p(t,e){return t<e?-1:t>e?1:0}function cl(t,e,n,r){r===void 0&&(r=Eh());var i,o=Hs(t,"",0,[],void 0,0,r)||t;try{i=On.length===0?JSON.stringify(o,e,n):JSON.stringify(o,_h(e),n)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;In.length!==0;){var s=In.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return i}function Hs(t,e,n,r,i,o,s){var a;if(o+=1,typeof t=="object"&&t!==null){for(a=0;a<r.length;a++)if(r[a]===t)return void nr(wh,t,e,i);try{if(typeof t.toJSON=="function")return}catch{return}if(s.depthLimit!==void 0&&o>s.depthLimit||s.edgesLimit!==void 0&&n+1>s.edgesLimit)return void nr(eo,t,e,i);if(r.push(t),Array.isArray(t))for(a=0;a<t.length;a++)Hs(t[a],a,a,r,t,o,s);else{var c={},l=Object.keys(t).sort(_p);for(a=0;a<l.length;a++){var u=l[a];Hs(t[u],u,a,r,t,o,s),c[u]=t[u]}if(i===void 0)return c;In.push([i,e,t]),i[e]=c}r.pop()}}function _h(t){return t=t!==void 0?t:function(e,n){return n},function(e,n){if(On.length>0)for(var r=0;r<On.length;r++){var i=On[r];if(i[1]===e&&i[0]===n){n=i[2],On.splice(r,1);break}}return t.call(this,e,n)}}var Cp=vo(bh),Ft=class extends Error{constructor(t,e,n){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!e||typeof e!="string")throw new Error('"message" must be a non-empty string.');super(e),this.code=t,n!==void 0&&(this.data=n)}serialize(){const t={code:this.code,message:this.message};return this.data!==void 0&&(t.data=this.data,function(e){if(typeof e!="object"||e===null)return!1;try{let n=e;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n}catch{return!1}}(this.data)&&(t.data.cause=vh(this.data.cause))),this.stack&&(t.stack=this.stack),t}toString(){return Cp(this.serialize(),Sp,2)}};function Sp(t,e){if(e!=="[Circular]")return e}var Sr=t=>kp(dn.invalidRequest,t);function kp(t,e){const[n,r]=function(i){if(i){if(typeof i=="string")return[i];if(typeof i=="object"&&!Array.isArray(i)){const{message:o,data:s}=i;
21if(o&&typeof o!="string")throw new Error("Must specify string message.");return[o??void 0,s]}}return[]}(e);return new Ft(t,n??yh(t),r)}var Ch={};function an(){}function _e(){_e.init.call(this)}function Sh(t){return t._maxListeners===void 0?_e.defaultMaxListeners:t._maxListeners}function ll(t,e,n,r){var i,o,s;if(typeof n!="function")throw new TypeError('"listener" argument must be a function');if((o=t._events)?(o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),s=o[e]):(o=t._events=new an,t._eventsCount=0),s){if(typeof s=="function"?s=o[e]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),!s.warned&&(i=Sh(t))&&i>0&&s.length>i){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+e+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,function(c){typeof console.warn=="function"?console.warn(c):console.log(c)}(a)}}else s=o[e]=n,++t._eventsCount;return t}function ul(t,e,n){var r=!1;function i(){t.removeListener(e,i),r||(r=!0,n.apply(t,arguments))}return i.listener=n,i}function dl(t){var e=this._events;if(e){var n=e[t];if(typeof n=="function")return 1;if(n)return n.length}return 0}function gr(t,e){for(var n=new Array(e);e--;)n[e]=t[e];return n}an.prototype=Object.create(null),_e.EventEmitter=_e,_e.usingDomains=!1,_e.prototype.domain=void 0,_e.prototype._events=void 0,_e.prototype._maxListeners=void 0,_e.defaultMaxListeners=10,_e.init=function(){this.domain=null,_e.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new an,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},_e.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||isNaN(t))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=t,this},_e.prototype.getMaxListeners=function(){return Sh(this)},_e.prototype.emit=function(t){var e,n,r,i,o,s,a,c=t==="error";if(s=this._events)c=c&&s.error==null;else if(!c)return!1;if(a=this.domain,c){if(e=arguments[1],!a){if(e instanceof Error)throw e;var l=new Error('Uncaught, unspecified "error" event. ('+e+")");throw l.context=e,l}return e||(e=new Error('Uncaught, unspecified "error" event')),e.domainEmitter=this,e.domain=a,e.domainThrown=!1,a.emit("error",e),!1}if(!(n=s[t]))return!1;var u=typeof n=="function";switch(r=arguments.length){case 1:(function(d,h,f){if(h)d.call(f);else for(var g=d.length,m=gr(d,g),w=0;w<g;++w)m[w].call(f)})(n,u,this);break;case 2:(function(d,h,f,g){if(h)d.call(f,g);else for(var m=d.length,w=gr(d,m),p=0;p<m;++p)w[p].call(f,g)})(n,u,this,arguments[1]);break;case 3:(function(d,h,f,g,m){if(h)d.call(f,g,m);else for(var w=d.length,p=gr(d,w),k=0;k<w;++k)p[k].call(f,g,m)})(n,u,this,arguments[1],arguments[2]);break;case 4:(function(d,h,f,g,m,w){if(h)d.call(f,g,m,w);else for(var p=d.length,k=gr(d,p),_=0;_<p;++_)k[_].call(f,g,m,w)})(n,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];(function(d,h,f,g){if(h)d.apply(f,g);else for(var m=d.length,w=gr(d,m),p=0;p<m;++p)w[p].apply(f,g)})(n,u,this,i)}return!0},_e.prototype.addListener=function(t,e){return ll(this,t,e,!1)},_e.prototype.on=_e.prototype.addListener,_e.prototype.prependListener=function(t,e){return ll(this,t,e,!0)},_e.prototype.once=function(t,e){if(typeof e!="function")throw new TypeError('"listener" argument must be a function');return this.on(t,ul(this,t,e)),this},_e.prototype.prependOnceListener=function(t,e){if(typeof e!="function")throw new TypeError('"listener" argument must be a function');return this.prependListener(t,ul(this,t,e)),this},_e.prototype.removeListener=function(t,e){var n,r,i,o,s;if(typeof e!="function")throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[t]))return this;if(n===e||n.listener&&n.listener===e)--this._eventsCount==0?this._events=new an:(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if(typeof n!="function"){for(i=-1,o=n.length;o-- >0;)if(n[o]===e||n[o].listener&&n[o].listener===e){s=n[o].listener,i=o;break}if(i<0)return this;if(n.length===1){if(n[0]=void 0,--this._eventsCount==0)return this._events=new an,this;delete r[t]}else(function(a,c){for(var l=c,u=l+1,d=a.length;u<d;l+=1,u+=1)a[l]=a[u];a.pop()})(n,i);
21r.removeListener&&this.emit("removeListener",t,s||e)}return this},_e.prototype.off=function(t,e){return this.removeListener(t,e)},_e.prototype.removeAllListeners=function(t){var e,n;if(!(n=this._events))return this;if(!n.removeListener)return arguments.length===0?(this._events=new an,this._eventsCount=0):n[t]&&(--this._eventsCount==0?this._events=new an:delete n[t]),this;if(arguments.length===0){for(var r,i=Object.keys(n),o=0;o<i.length;++o)(r=i[o])!=="removeListener"&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new an,this._eventsCount=0,this}if(typeof(e=n[t])=="function")this.removeListener(t,e);else if(e)do this.removeListener(t,e[e.length-1]);while(e[0]);return this},_e.prototype.listeners=function(t){var e,n,r=this._events;return n=r&&(e=r[t])?typeof e=="function"?[e.listener||e]:function(i){for(var o=new Array(i.length),s=0;s<o.length;++s)o[s]=i[s].listener||i[s];return o}(e):[],n},_e.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):dl.call(t,e)},_e.prototype.listenerCount=dl,_e.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var Sa=zr(Object.freeze({__proto__:null,EventEmitter:_e,default:_e}));Object.defineProperty(Ch,"__esModule",{value:!0});const xp=Sa;function hl(t,e,n){try{Reflect.apply(t,e,n)}catch(r){setTimeout(()=>{throw r})}}let Ap=class extends xp.EventEmitter{emit(t,...e){let n=t==="error";const r=this._events;if(r!==void 0)n=n&&r.error===void 0;else if(!n)return!1;if(n){let o;if(e.length>0&&([o]=e),o instanceof Error)throw o;const s=new Error("Unhandled error."+(o?` (${o.message})`:""));throw s.context=o,s}const i=r[t];if(i===void 0)return!1;if(typeof i=="function")hl(i,this,e);else{const o=i.length,s=function(a){const c=a.length,l=new Array(c);for(let u=0;u<c;u+=1)l[u]=a[u];return l}(i);for(let a=0;a<o;a+=1)hl(s[a],this,e)}return!0}};var to,hn,Jn,wr,Ti,Ri,Fs,Oi,zs,Xo,fl,Li,qs,Qo,pl,kr,no,es,gl,kh=Ch.default=Ap,bt=class Pi extends kh{constructor({notificationHandler:e}={}){super(),Et(this,wr),Et(this,Ri),Et(this,Oi),Et(this,to,!1),Et(this,hn,void 0),Et(this,Jn,void 0),fi(this,hn,[]),fi(this,Jn,e)}destroy(){gn(this,hn).forEach(e=>{"destroy"in e&&typeof e.destroy=="function"&&e.destroy()}),fi(this,hn,[]),fi(this,to,!0)}push(e){qe(this,wr,Ti).call(this),gn(this,hn).push(e)}handle(e,n){if(qe(this,wr,Ti).call(this),n&&typeof n!="function")throw new Error('"callback" must be a function if provided.');return Array.isArray(e)?n?qe(this,Ri,Fs).call(this,e,n):qe(this,Ri,Fs).call(this,e):n?qe(this,Oi,zs).call(this,e,n):this._promiseHandle(e)}asMiddleware(){return qe(this,wr,Ti).call(this),async(e,n,r,i)=>{var o,s;try{const[a,c,l]=await qe(o=Pi,Li,qs).call(o,e,n,gn(this,hn));return c?(await qe(s=Pi,kr,no).call(s,l),i(a)):r(async u=>{var d;try{await qe(d=Pi,kr,no).call(d,l)}catch(h){return u(h)}return u()})}catch(a){return i(a)}}}async _promiseHandle(e){return new Promise((n,r)=>{qe(this,Oi,zs).call(this,e,(i,o)=>{i&&o===void 0?r(i):n(o)}).catch(r)})}};to=new WeakMap,hn=new WeakMap,Jn=new WeakMap,wr=new WeakSet,Ti=function(){if(gn(this,to))throw new Error("This engine is destroyed and can no longer be used.")},Ri=new WeakSet,Fs=async function(t,e){try{if(t.length===0){const r=[{id:null,jsonrpc:"2.0",error:new Ft(dn.invalidRequest,"Request batch must contain plain objects. Received an empty array")}];return e?e(null,r):r}const n=(await Promise.all(t.map(this._promiseHandle.bind(this)))).filter(r=>r!==void 0);return e?e(null,n):n}catch(n){if(e)return e(n);throw n}},Oi=new WeakSet,zs=async function(t,e){var n;if(!t||Array.isArray(t)||typeof t!="object"){const s=new Ft(dn.invalidRequest,"Requests must be plain objects. Received: "+typeof t,{request:t});return e(s,{id:null,jsonrpc:"2.0",error:s})}if(typeof t.method!="string"){const s=new Ft(dn.invalidRequest,"Must specify a string method. Received: "+typeof t.method,{request:t});return gn(this,Jn)&&!rl(t)?e(null):e(s,{id:t.id??null,jsonrpc:"2.0",error:s})}if(gn(this,Jn)&&cr(t,vp)&&!rl(t)){try{await gn(this,Jn).call(this,t)}catch(s){return e(s)}return e(null)}let r=null;const i={...t},o={id:i.id,jsonrpc:i.jsonrpc};try{await qe(n=bt,Xo,fl).call(n,i,o,gn(this,hn))}catch(s){r=s}return r&&(delete o.result,o.error||(o.error=sl(r))),e(r,o)},Xo=new WeakSet,fl=async function(t,e,n){var r,i,o;const[s,a,c]=await qe(r=bt,Li,qs).call(r,t,e,n);if(qe(i=bt,es,gl).call(i,t,e,a),await qe(o=bt,kr,no).call(o,c),s)throw s},Li=new WeakSet,qs=async function(t,e,n){var r;const i=[];let o=null,s=!1;for(const a of n)if([o,s]=await qe(r=bt,Qo,pl).call(r,t,e,a,i),s)break;return[o,s,i.reverse()]},Qo=new WeakSet,pl=async function(t,e,n,r){return new Promise(i=>{const o=a=>{const c=a||e.error;c&&(e.error=sl(c)),i([c,!0])},s=a=>{e.error?o(e.error):(a&&(typeof a!="function"&&o(new Ft(dn.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof a}" for request: 22${ts(t)}`,{request:t})),r.push(a)),i([null,!1]))};try{n(t,e,s,o)}catch(a){o(a)}})},kr=new WeakSet,no=async function(t){for(const e of t)await new Promise((n,r)=>{e(i=>i?r(i):n())})},es=new WeakSet,gl=function(t,e,n){if(!Ji(e,"result")&&!Ji(e,"error"))throw new Ft(dn.internal,`JsonRpcEngine: Response has no error or result for request: 23${ts(t)}`,{request:t});if(!n)throw new Ft(dn.internal,`JsonRpcEngine: Nothing ended request: 24${ts(t)}`,{request:t})},Et(bt,Xo),Et(bt,Li),Et(bt,Qo),Et(bt,kr),Et(bt,es);var Mp=bt;function ts(t){return JSON.stringify(t,null,2)}var xh=Object.freeze(["eth_subscription"]),Tp=(t=console)=>[tp(),Rp(t),ep(t)];function Rp(t){return(e,n,r)=>{typeof e.method=="string"&&e.method||(n.error=Sr({message:"The request 'method' must be a non-empty string.",data:e})),r(i=>{const{error:o}=n;return o&&t.error(`MetaMask - RPC Error: ${o.message}`,o),i()})}}var Ii=(t,e,n=!0)=>(r,i)=>{r||i.error?e(r||i.error):!n||Array.isArray(i)?t(i):t(i.result)},Ah=t=>!!t&&typeof t=="string"&&t.startsWith("0x"),Mh=()=>{};async function ml(t,e){try{const n=await async function(){return{name:Op(window),icon:await Lp(window)}}();
24t.handle({jsonrpc:"2.0",id:1,method:"metamask_sendDomainMetadata",params:n},Mh)}catch(n){e.error({message:Me.errors.sendSiteMetadata(),originalError:n})}}function Op(t){const{document:e}=t,n=e.querySelector('head > meta[property="og:site_name"]');if(n)return n.content;const r=e.querySelector('head > meta[name="title"]');return r?r.content:e.title&&e.title.length>0?e.title:window.location.hostname}async function Lp(t){const{document:e}=t,n=e.querySelectorAll('head > link[rel~="icon"]');for(const r of Array.from(n))if(r&&await Pp(r.href))return r.href;return null}async function Pp(t){return new Promise((e,n)=>{try{const r=document.createElement("img");r.onload=()=>e(!0),r.onerror=()=>e(!1),r.src=t}catch(r){n(r)}})}var Th=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},Ot=(t,e,n)=>(Th(t,e,"read from private field"),n?n.call(t):e.get(t)),Vs=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},zt=(t,e,n,r)=>(Th(t,e,"write to private field"),e.set(t,n),n);function yl(t,e,n){try{Reflect.apply(t,e,n)}catch(r){setTimeout(()=>{throw r})}}class Ip extends _e{emit(e,...n){let r=e==="error";const i=this._events;if(i!==void 0)r=r&&i.error===void 0;else if(!r)return!1;if(r){let s;if(n.length>0&&([s]=n),s instanceof Error)throw s;const a=new Error("Unhandled error."+(s?` (${s.message})`:""));throw a.context=s,a}const o=i[e];if(o===void 0)return!1;if(typeof o=="function")yl(o,this,n);else{const s=o.length,a=function(c){const l=c.length,u=new Array(l);for(let d=0;d<l;d+=1)u[d]=c[d];return u}(o);for(let c=0;c<s;c+=1)yl(a[c],this,n)}return!0}}var cn,xn,Np=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,o;if(Array.isArray(e)){if((r=e.length)!=n.length)return!1;for(i=r;i--!=0;)if(!t(e[i],n[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if((r=(o=Object.keys(e)).length)!==Object.keys(n).length)return!1;for(i=r;i--!=0;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;i--!=0;){var s=o[i];if(!t(e[s],n[s]))return!1}return!0}return e!=e&&n!=n},Bp=vo(Np),Rh=class Oh extends Ip{constructor({logger:e=console,maxEventListeners:n=100,rpcMiddleware:r=[]}={}){super(),Vs(this,cn,void 0),Vs(this,xn,void 0),this._log=e,this.setMaxListeners(n),this._state={...Oh._defaultState},zt(this,xn,null),zt(this,cn,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 Mp;r.forEach(o=>i.push(o)),this._rpcEngine=i}get chainId(){return Ot(this,cn)}get selectedAddress(){return Ot(this,xn)}isConnected(){return this._state.isConnected}async request(e){if(!e||typeof e!="object"||Array.isArray(e))throw Sr({message:Me.errors.invalidRequestArgs(),data:e});const{method:n,params:r}=e;if(typeof n!="string"||n.length===0)throw Sr({message:Me.errors.invalidRequestMethod(),data:e});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw Sr({message:Me.errors.invalidRequestParams(),data:e});const i=r==null?{method:n}:{method:n,params:r};return new Promise((o,s)=>{this._rpcRequest(i,Ii(o,s))})}_initializeState(e){if(this._state.initialized)throw new Error("Provider already initialized.");if(e){const{accounts:n,chainId:r,isUnlocked:i,networkVersion:o}=e;this._handleConnect(r),this._handleChainChanged({chainId:r,networkVersion:o}),this._handleUnlockStateChanged({accounts:n,isUnlocked:i}),this._handleAccountsChanged(n)}this._state.initialized=!0,this.emit("_initialized")}_rpcRequest(e,n){let r=n;return Array.isArray(e)||(e.jsonrpc||(e.jsonrpc="2.0"),e.method!=="eth_accounts"&&e.method!=="eth_requestAccounts"||(r=(i,o)=>{this._handleAccountsChanged(o.result??[],e.method==="eth_accounts"),n(i,o)})),this._rpcEngine.handle(e,r)}_handleConnect(e){this._state.isConnected||(this._state.isConnected=!0,this.emit
24("connect",{chainId:e}),this._log.debug(Me.info.connected(e)))}_handleDisconnect(e,n){if(this._state.isConnected||!this._state.isPermanentlyDisconnected&&!e){let r;this._state.isConnected=!1,e?(r=new Ft(1013,n??Me.errors.disconnected()),this._log.debug(r)):(r=new Ft(1011,n??Me.errors.permanentlyDisconnected()),this._log.error(r),zt(this,cn,null),this._state.accounts=null,zt(this,xn,null),this._state.isUnlocked=!1,this._state.isPermanentlyDisconnected=!0),this.emit("disconnect",r)}}_handleChainChanged({chainId:e}={}){Ah(e)?(this._handleConnect(e),e!==Ot(this,cn)&&(zt(this,cn,e),this._state.initialized&&this.emit("chainChanged",Ot(this,cn)))):this._log.error(Me.errors.invalidNetworkParams(),{chainId:e})}_handleAccountsChanged(e,n=!1){let r=e;Array.isArray(e)||(this._log.error("MetaMask: Received invalid accounts parameter. Please report this bug.",e),r=[]);for(const i of e)if(typeof i!="string"){this._log.error("MetaMask: Received non-string account. Please report this bug.",e),r=[];break}if(!Bp(this._state.accounts,r)&&(n&&this._state.accounts!==null&&this._log.error("MetaMask: 'eth_accounts' unexpectedly updated accounts. Please report this bug.",r),this._state.accounts=r,Ot(this,xn)!==r[0]&&zt(this,xn,r[0]||null),this._state.initialized)){const i=[...r];this.emit("accountsChanged",i)}}_handleUnlockStateChanged({accounts:e,isUnlocked:n}={}){typeof n=="boolean"?n!==this._state.isUnlocked&&(this._state.isUnlocked=n,this._handleAccountsChanged(e??[])):this._log.error("MetaMask: Received invalid isUnlocked parameter. Please report this bug.")}};cn=new WeakMap,xn=new WeakMap,Rh._defaultState={accounts:null,isConnected:!1,isUnlocked:!1,initialized:!1,isPermanentlyDisconnected:!1};var vl,bl,Dp=Rh,Ws={exports:{}};function Lh(){return bl?vl:(bl=1,vl=Sa.EventEmitter)}var ka,xa=zr(X0);ka=typeof Object.create=="function"?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t};var Ph=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),n={},r=0;r<e.length;r++)n[e[r]]=Object.getOwnPropertyDescriptor(t,e[r]);return n},$p=/%[sdj%]/g;function Eo(t){if(!$r(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(Bt(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,i=r.length,o=String(t).replace($p,function(a){if(a==="%%")return"%";if(n>=i)return a;switch(a){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch{return"[Circular]"}default:return a}}),s=r[n];n<i;s=r[++n])Vr(s)||!Bn(s)?o+=" "+s:o+=" "+Bt(s);return o}function Aa(t,e){if(Pt(Ye.process))return function(){return Aa(t,e).apply(this,arguments)};if(we.noDeprecation===!0)return t;var n=!1;return function(){if(!n){if(we.throwDeprecation)throw new Error(e);we.traceDeprecation?console.trace(e):console.error(e),n=!0}return t.apply(this,arguments)}}var ns,gi={};function Ih(t){return Pt(ns)&&(ns=we.env.NODE_DEBUG||""),t=t.toUpperCase(),!gi[t]&&(new RegExp("\\b"+t+"\\b","i").test(ns)?gi[t]=function(){var e=Eo.apply(null,arguments);console.error("%s %d: %s",t,0,e)}:gi[t]=function(){}),gi[t]}function Bt(t,e){var n={seen:[],stylize:Kp};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),_o(e)?n.showHidden=e:e&&Oa(n,e),Pt(n.showHidden)&&(n.showHidden=!1),Pt(n.depth)&&(n.depth=2),Pt(n.colors)&&(n.colors=!1),Pt(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=jp),ro(n,t,n.depth)}function jp(t,e){var n=Bt.styles[e];return n?"\x1B["+Bt.colors[n][0]+"m"+t+"\x1B["+Bt.colors[n][1]+"m":t}function Kp(t,e){return t}function ro(t,e,n){if(t.customInspect&&e&&Mr(e.inspect)&&e.inspect!==Bt&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return $r(r)||(r=ro(t,r,n)),r}var i=function(h,f){if(Pt(f))return h.stylize("undefined","undefined");if($r(f)){var g="'"+JSON.stringify(f).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return h.stylize(g,"string")}if(Ta(f))return h.stylize(""+f,"number");if(_o(f))return h.stylize(""+f,"boolean");if(Vr(f))return h.stylize("null","null")}(t,e);if(i)return i;var o=Object.keys(e),s=function(h){var f={};return h.forEach(function(g,m){f[g]=!0}
24),f}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),Ar(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return rs(e);if(o.length===0){if(Mr(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(xr(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(io(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Ar(e))return rs(e)}var c,l="",u=!1,d=["{","}"];return Ma(e)&&(u=!0,d=["[","]"]),Mr(e)&&(l=" [Function"+(e.name?": "+e.name:"")+"]"),xr(e)&&(l=" "+RegExp.prototype.toString.call(e)),io(e)&&(l=" "+Date.prototype.toUTCString.call(e)),Ar(e)&&(l=" "+rs(e)),o.length!==0||u&&e.length!=0?n<0?xr(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),c=u?function(h,f,g,m,w){for(var p=[],k=0,_=f.length;k<_;++k)Kh(f,String(k))?p.push(is(h,f,g,m,String(k),!0)):p.push("");return w.forEach(function(O){O.match(/^\d+$/)||p.push(is(h,f,g,m,O,!0))}),p}(t,e,n,s,o):o.map(function(h){return is(t,e,n,s,h,u)}),t.seen.pop(),function(h,f,g){var m=h.reduce(function(w,p){return p.indexOf(` 25`),w+p.replace(/\u001b\[\d\d?m/g,"").length+1},0);return m>60?g[0]+(f===""?"":f+` 26 `)+" "+h.join(`, 27 `)+" "+g[1]:g[0]+f+" "+h.join(", ")+" "+g[1]}(c,l,d)):d[0]+l+d[1]}function rs(t){return"["+Error.prototype.toString.call(t)+"]"}function is(t,e,n,r,i,o){var s,a,c;if((c=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?a=c.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):c.set&&(a=t.stylize("[Setter]","special")),Kh(r,i)||(s="["+i+"]"),a||(t.seen.indexOf(c.value)<0?(a=Vr(n)?ro(t,c.value,null):ro(t,c.value,n-1)).indexOf(` 28`)>-1&&(a=o?a.split(` 29`).map(function(l){return" "+l}).join(` 30`).substr(2):` 31`+a.split(` 32`).map(function(l){return" "+l}).join(` 33`)):a=t.stylize("[Circular]","special")),Pt(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+a}function Ma(t){return Array.isArray(t)}function _o(t){return typeof t=="boolean"}function Vr(t){return t===null}function Nh(t){return t==null}function Ta(t){return typeof t=="number"}function $r(t){return typeof t=="string"}function Bh(t){return typeof t=="symbol"}function Pt(t){return t===void 0}function xr(t){return Bn(t)&&Ra(t)==="[object RegExp]"}function Bn(t){return typeof t=="object"&&t!==null}function io(t){return Bn(t)&&Ra(t)==="[object Date]"}function Ar(t){return Bn(t)&&(Ra(t)==="[object Error]"||t instanceof Error)}function Mr(t){return typeof t=="function"}function Dh(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||t===void 0}function $h(t){return J.isBuffer(t)}function Ra(t){return Object.prototype.toString.call(t)}function os(t){return t<10?"0"+t.toString(10):t.toString(10)}Bt.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]},Bt.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var Up=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function jh(){console.log("%s - %s",function(){var t=new Date,e=[os(t.getHours()),os(t.getMinutes()),os(t.getSeconds())].join(":");return[t.getDate(),Up[t.getMonth()],e].join(" ")}(),Eo.apply(null,arguments))}function Oa(t,e){if(!e||!Bn(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}function Kh(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var An=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;function La(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');if(An&&t[An]){var e;if(typeof(e=t[An])!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,An,{value:e,enumerable:!1,writable:!1,
33configurable:!0}),e}function e(){for(var n,r,i=new Promise(function(a,c){n=a,r=c}),o=[],s=0;s<arguments.length;s++)o.push(arguments[s]);o.push(function(a,c){a?r(a):n(c)});try{t.apply(this,o)}catch(a){r(a)}return i}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),An&&Object.defineProperty(e,An,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,Ph(t))}function Hp(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}function Uh(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');function e(){for(var n=[],r=0;r<arguments.length;r++)n.push(arguments[r]);var i=n.pop();if(typeof i!="function")throw new TypeError("The last argument must be of type Function");var o=this,s=function(){return i.apply(o,arguments)};t.apply(this,n).then(function(a){we.nextTick(s.bind(null,null,a))},function(a){we.nextTick(Hp.bind(null,a,s))})}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,Ph(t)),e}La.custom=An;var ss,wl,as,El,Fp={inherits:ka,_extend:Oa,log:jh,isBuffer:$h,isPrimitive:Dh,isFunction:Mr,isError:Ar,isDate:io,isObject:Bn,isRegExp:xr,isUndefined:Pt,isSymbol:Bh,isString:$r,isNumber:Ta,isNullOrUndefined:Nh,isNull:Vr,isBoolean:_o,isArray:Ma,inspect:Bt,deprecate:Aa,format:Eo,debuglog:Ih,promisify:La,callbackify:Uh},Hh=zr(Object.freeze({__proto__:null,_extend:Oa,callbackify:Uh,debuglog:Ih,default:Fp,deprecate:Aa,format:Eo,inherits:ka,inspect:Bt,isArray:Ma,isBoolean:_o,isBuffer:$h,isDate:io,isError:Ar,isFunction:Mr,isNull:Vr,isNullOrUndefined:Nh,isNumber:Ta,isObject:Bn,isPrimitive:Dh,isRegExp:xr,isString:$r,isSymbol:Bh,isUndefined:Pt,log:jh,promisify:La}));function zp(){if(wl)return ss;function t(c,l){var u=Object.keys(c);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(c);l&&(d=d.filter(function(h){return Object.getOwnPropertyDescriptor(c,h).enumerable})),u.push.apply(u,d)}return u}function e(c){for(var l=1;l<arguments.length;l++){var u=arguments[l]!=null?arguments[l]:{};l%2?t(Object(u),!0).forEach(function(d){n(c,d,u[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(u)):t(Object(u)).forEach(function(d){Object.defineProperty(c,d,Object.getOwnPropertyDescriptor(u,d))})}return c}function n(c,l,u){return(l=i(l))in c?Object.defineProperty(c,l,{value:u,enumerable:!0,configurable:!0,writable:!0}):c[l]=u,c}function r(c,l,u){return l&&function(d,h){for(var f=0;f<h.length;f++){var g=h[f];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(d,i(g.key),g)}}(c.prototype,l),Object.defineProperty(c,"prototype",{writable:!1}),c}function i(c){var l=function(u,d){if(typeof u!="object"||u===null)return u;var h=u[Symbol.toPrimitive];if(h!==void 0){var f=h.call(u,d);if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(u)}(c,"string");return typeof l=="symbol"?l:String(l)}wl=1;var o=xa.Buffer,s=Hh.inspect,a=s&&s.custom||"inspect";return ss=function(){function c(){(function(l,u){if(!(l instanceof u))throw new TypeError("Cannot call a class as a function")})(this,c),this.head=null,this.tail=null,this.length=0}return r(c,[{key:"push",value:function(l){var u={data:l,next:null};this.length>0?this.tail.next=u:this.head=u,this.tail=u,++this.length}},{key:"unshift",value:function(l){var u={data:l,next:this.head};this.length===0&&(this.tail=u),this.head=u,++this.length}},{key:"shift",value:function(){if(this.length!==0){var l=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,l}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(l){if(this.length===0)return"";for(var u=this.head,d=""+u.data;u=u.next;)d+=l+u.data;return d}},{key:"concat",value:function(l){if(this.length===0)return o.alloc(0);for(var u,d,h,f=o.allocUnsafe(l>>>0),g=this.head,m=0;g;)u=g.data,d=f,h=m,o.prototype.copy.call(u,d,h),m+=g.data.length,g=g.next;return f}},{key:"consume",value:function(l,u){var d;return l<this.head.data.length?(d=this.head.data.slice(0,l),this.head.data=this.head.data.slice(l)):d=l===this.head.data.length?this.shift():u?this._getString(l):this._getBuffer(l),d}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(l){var u=this.head,d=1,h=u.data;for(l-=h.length;u=u.next;){var f=u.data,g=l>f.length?f.length:l;if(g===f.length?h+=f:h+=f.slice(0,l),(l-=g)===0){g===f.length?(++d,u.next?this.head=u.next:this.head=this.tail=null):(this.head=u,u.data=f.slice(g));break}++d}return this.length-=d,h}},{key:"_getBuffer",value:function(l){var u=o.allocUnsafe(l),d=this.head,h=1;for(d.data.copy(u),l-=d.data.length;d=d.next;){var f=d.data,g=l>f.length?f.length:l;if(f.copy(u,u.length-l,0,g),(l-=g)===0){g===f.length?(++h,d.next?this.head=d.next:this.head=this.tail=null):(this.head=d,d.data=f.slice(g));break}++h}return this.length-=h,u}},{key:a,value:function(l,u){return s(this,e(e({},u),{},{depth:0,customInspect:!1}))}}]),c}(),ss}function Fh(){if(El)return as;function t(r,i){n(r,i),e(r)}function e(r){r._writableState&&!r._writableState.emitClose||r._readableState&&!r._readableState.emitClose||r.emit("close")}function n(r,i){r.emit("error",i)}return El=1,as={destroy:function(r,i){var o=this,s=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return s||a?(i?i(r):r&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,we.nextTick(n,this,r)):we.nextTick(n,this,r)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(r||null,function(c){!i&&c?o._writableState?o._writableState.errorEmitted?we.nextTick(e,o):(o._writableState.errorEmitted=!0,we.nextTick(t,o,c)):we.nextTick(t,o,c):i?(we.nextTick(e,o),i(c)):we.nextTick(e,o)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(r,i){var o=r._readableState,s=r._writableState;o&&o.autoDestroy||s&&s.autoDestroy?r.destroy(i):r.emit("error",i)}},as}var Dn={},_l,Cl,zh={};function lt(t,e,n){n||(n=Error);var r=function(i){var o,s;function a(c,l,u){return i.call(this,function(d,h,f){return typeof e=="string"?e:e(d,h,f)}(c,l,u))||this}return s=i,(o=a).prototype=Object.create(s.prototype),o.prototype.constructor=o,o.__proto__=s,a}(n);r.prototype.name=n.name,r.prototype.code=t,zh[t]=r}function Sl(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map(function(r){return String(r)}),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:n===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}function qh(){if(Cl)return _l;Cl=1;var t=Dn.codes.ERR_INVALID_OPT_VALUE;return _l={getHighWaterMark:function(e,n,r,i){var o=function(s,a,c){return s.highWaterMark!=null?s.highWaterMark:a?s[c]:null}(n,i,r);if(o!=null){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new t(i?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}}lt("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invali
33d for option "'+t+'"'},TypeError),lt("ERR_INVALID_ARG_TYPE",function(t,e,n){var r,i,o;if(typeof e=="string"&&(i="not ",e.substr(0,i.length)===i)?(r="must not be",e=e.replace(/^not /,"")):r="must be",function(a,c,l){return(l===void 0||l>a.length)&&(l=a.length),a.substring(l-c.length,l)===c}(t," argument"))o="The ".concat(t," ").concat(r," ").concat(Sl(e,"type"));else{var s=function(a,c,l){return typeof l!="number"&&(l=0),!(l+c.length>a.length)&&a.indexOf(c,l)!==-1}(t,".")?"property":"argument";o='The "'.concat(t,'" ').concat(s," ").concat(r," ").concat(Sl(e,"type"))}return o+=". Received type ".concat(typeof n)},TypeError),lt("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),lt("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"}),lt("ERR_STREAM_PREMATURE_CLOSE","Premature close"),lt("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"}),lt("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),lt("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),lt("ERR_STREAM_WRITE_AFTER_END","write after end"),lt("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),lt("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError),lt("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Dn.codes=zh;var cs,kl,ls,xl,us,Al,qp=typeof Object.create=="function"?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t},Wr=zr(Object.freeze({__proto__:null,default:qp}));function Vp(){if(kl)return cs;function t(e){try{if(!yt.localStorage)return!1}catch{return!1}var n=yt.localStorage[e];return n!=null&&String(n).toLowerCase()==="true"}return kl=1,cs=function(e,n){if(t("noDeprecation"))return e;var r=!1;return function(){if(!r){if(t("throwDeprecation"))throw new Error(n);t("traceDeprecation")?console.trace(n):console.warn(n),r=!0}return e.apply(this,arguments)}},cs}function Vh(){if(xl)return ls;function t(j){var B=this;this.next=null,this.entry=null,this.finish=function(){(function(R,C,L){var $=R.entry;for(R.entry=null;$;){var y=$.callback;C.pendingcb--,y(L),$=$.next}C.corkedRequestsFree.next=R})(B,j)}}var e;xl=1,ls=N,N.WritableState=O;var n={deprecate:Vp()},r=Lh(),i=xa.Buffer,o=(yt!==void 0?yt:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){},s,a=Fh(),c=qh().getHighWaterMark,l=Dn.codes,u=l.ERR_INVALID_ARG_TYPE,d=l.ERR_METHOD_NOT_IMPLEMENTED,h=l.ERR_MULTIPLE_CALLBACK,f=l.ERR_STREAM_CANNOT_PIPE,g=l.ERR_STREAM_DESTROYED,m=l.ERR_STREAM_NULL_VALUES,w=l.ERR_STREAM_WRITE_AFTER_END,p=l.ERR_UNKNOWN_ENCODING,k=a.errorOrDestroy;function _(){}function O(j,B,R){e=e||or(),j=j||{},typeof R!="boolean"&&(R=B instanceof e),this.objectMode=!!j.objectMode,R&&(this.objectMode=this.objectMode||!!j.writableObjectMode),this.highWaterMark=c(this,j,"writableHighWaterMark",R),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var C=j.decodeStrings===!1;this.decodeStrings=!C,this.defaultEncoding=j.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(L){(function($,y){var E=$._writableState,A=E.sync,M=E.writecb;if(typeof M!="function")throw new h;if(function(v){v.writing=!1,v.writecb=null,v.length-=v.writelen,v.writelen=0}(E),y)(function(v,S,x,T,I){--S.pendingcb,x?(we.nextTick(I,T),we.nextTick(Y,v,S),v._writableState.errorEmitted=!0,k(v,T)):(I(T),v._writableState.errorEmitted=!0,k(v,T),Y(v,S))})($,E,A,y,M);else{var b=H(E)||$.destroyed;b||E.corked||E.bufferProcessing||!E.bufferedRequest||V($,E),A?we.nextTick(W,$,E,b,M):W($,E,b,M)}})(B,L)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=j.emitClose!==!1,this.autoDestroy=!!j.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}function N(j){var B=this instanceof(e=e||or());if(!B&&!s.call(N,this))return new N(j);this._writableState=new O(j,this,B),this.writable=!0,j&&(typeof j.write=="function"&&(this._write=j.write),typeof j.writev=="function"&&(this._writev=j.writev),typeof j.destroy=="function"&&(this._destroy=j.destroy),typeof j.final=="function"&&(this._final=j.final)),r.call(this)}function U(j,B,R,C,L,$,y){B.writelen=C,B.writecb=y,B.writing=!0,B.sync=!0,B.destroyed?B.onwrite(new g("write")):R?j._writev(L,B.onwrite):j._write(L,$,B.onwrite),B.sync=!1}function W(j,B,R,C){R||function(L,$){$.length===0&&$.needDrain&&($.needDrain=!1,L.emit("drain"))}(j,B),B.pendingcb--,C(),Y(j,B)}function V(j,B){B.bufferProcessing=!0;var R=B.bufferedRequest;if(j._writev&&R&&R.next){var C=B.bufferedRequestCount,L=new Array(C),$=B.corkedRequestsFree;$.entry=R;for(var y=0,E=!0;R;)L[y]=R,R.isBuf||(E=!1),R=R.next,y+=1;L.allBuffers=E,U(j,B,!0,B.length,L,"",$.finish),B.pendingcb++,B.lastBufferedRequest=null,$.next?(B.corkedRequestsFree=$.next,$.next=null):B.corkedRequestsFree=new t(B),B.bufferedRequestCount=0}else{for(;R;){var A=R.chunk,M=R.encoding,b=R.callback;if(U(j,B,!1,B.objectMode?1:A.length,A,M,b),R=R.next,B.bufferedRequestCount--,B.writing)break}R===null&&(B.lastBufferedRequest=null)}B.bufferedRequest=R,B.bufferProcessing=!1}function H(j){return j.ending&&j.length===0&&j.bufferedRequest===null&&!j.finished&&!j.writing}function K(j,B){j._final(function(R){B.pendingcb--,R&&k(j,R),B.prefinished=!0,j.emit("prefinish"),Y(j,B)})}function Y(j,B){var R=H(B);if(R&&(function(L,$){$.prefinished||$.finalCalled||(typeof L._final!="function"||$.destroyed?($.prefinished=!0,L.emit("prefinish")):($.pendingcb++,$.finalCalled=!0,we.nextTick(K,L,$)))}(j,B),B.pendingcb===0&&(B.finished=!0,j.emit("finish"),B.autoDestroy))){var C=j._readableState;(!C||C.autoDestroy&&C.endEmitted)&&j.destroy()}return R}return Wr(N,r),O.prototype.getBuffer=function(){for(var j=this.bufferedRequest,B=[];j;)B.push(j),j=j.next;return B},function(){try{Object.defineProperty(O.prototype,"buffer",{get:n.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}(),typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(s=Function.prototype[Symbol.hasInstance],Object.defineProperty(N,Symbol.hasInstance,{value:function(j){return!!s.call(this,j)||this===N&&j&&j._writableState instanceof O}})):s=function(j){return j instanceof this},N.prototype.pipe=function(){k(this,new f)},N.prototype.write=function(j,B,R){var C,L=this._writableState,$=!1,y=!L.objectMode&&(C=j,i.isBuffer(C)||C instanceof o);return y&&!i.isBuffer(j)&&(j=function(E){return i.from(E)}(j)),typeof B=="function"&&(R=B,B=null),y?B="buffer":B||(B=L.defaultEncoding),typeof R!="function"&&(R=_),L.ending?function(E,A){var M=new w;k(E,M),we.nextTick(A,M)}(this,R):(y||function(E,A,M,b){var v;
33return M===null?v=new m:typeof M=="string"||A.objectMode||(v=new u("chunk",["string","Buffer"],M)),!v||(k(E,v),we.nextTick(b,v),!1)}(this,L,j,R))&&(L.pendingcb++,$=function(E,A,M,b,v,S){if(!M){var x=function(F,z,Z){return F.objectMode||F.decodeStrings===!1||typeof z!="string"||(z=i.from(z,Z)),z}(A,b,v);b!==x&&(M=!0,v="buffer",b=x)}var T=A.objectMode?1:b.length;A.length+=T;var I=A.length<A.highWaterMark;if(I||(A.needDrain=!0),A.writing||A.corked){var D=A.lastBufferedRequest;A.lastBufferedRequest={chunk:b,encoding:v,isBuf:M,callback:S,next:null},D?D.next=A.lastBufferedRequest:A.bufferedRequest=A.lastBufferedRequest,A.bufferedRequestCount+=1}else U(E,A,!1,T,b,v,S);return I}(this,L,y,j,B,R)),$},N.prototype.cork=function(){this._writableState.corked++},N.prototype.uncork=function(){var j=this._writableState;j.corked&&(j.corked--,j.writing||j.corked||j.bufferProcessing||!j.bufferedRequest||V(this,j))},N.prototype.setDefaultEncoding=function(j){if(typeof j=="string"&&(j=j.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((j+"").toLowerCase())>-1))throw new p(j);return this._writableState.defaultEncoding=j,this},Object.defineProperty(N.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(N.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),N.prototype._write=function(j,B,R){R(new d("_write()"))},N.prototype._writev=null,N.prototype.end=function(j,B,R){var C=this._writableState;return typeof j=="function"?(R=j,j=null,B=null):typeof B=="function"&&(R=B,B=null),j!=null&&this.write(j,B),C.corked&&(C.corked=1,this.uncork()),C.ending||function(L,$,y){$.ending=!0,Y(L,$),y&&($.finished?we.nextTick(y):L.once("finish",y)),$.ended=!0,L.writable=!1}(this,C,R),this},Object.defineProperty(N.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(N.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState!==void 0&&this._writableState.destroyed},set:function(j){this._writableState&&(this._writableState.destroyed=j)}}),N.prototype.destroy=a.destroy,N.prototype._undestroy=a.undestroy,N.prototype._destroy=function(j,B){B(j)},ls}function or(){if(Al)return us;Al=1;var t=Object.keys||function(l){var u=[];for(var d in l)u.push(d);return u};us=s;var e=Wh(),n=Vh();Wr(s,e);for(var r=t(n.prototype),i=0;i<r.length;i++){var o=r[i];s.prototype[o]||(s.prototype[o]=n.prototype[o])}function s(l){if(!(this instanceof s))return new s(l);e.call(this,l),n.call(this,l),this.allowHalfOpen=!0,l&&(l.readable===!1&&(this.readable=!1),l.writable===!1&&(this.writable=!1),l.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",a)))}function a(){this._writableState.ended||we.nextTick(c,this)}function c(l){l.end()}return Object.defineProperty(s.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(s.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(s.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(s.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._writableState!==void 0&&this._readableState.destroyed&&this._writableState.destroyed},set:function(l){this._readableState!==void 0&&this._writableState!==void 0&&(this._readableState.destroyed=l,this._writableState.destroyed=l)}}),us}var Wp=J.isEncoding||function(t){switch(t&&t.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 Ni(t){switch(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!Wp(e))throw new Error("Unknown encoding: "+e)}(t),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=Yp;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=Zp;break;default:return void(this.write=Gp)}this.charBuffer=new J(6),this.charReceived=0,this.charLength=0}function Gp(t){return t.toString(this.encoding)}function Yp(t){this.charReceived=t.length%2,this.charLength=this.charReceived?2:0}function Zp(t){this.charReceived=t.length%3,this.charLength=this.charReceived?3:0}Ni.prototype.write=function(t){for(var e="";this.charLength;){var n=t.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";
33if(t=t.slice(n,t.length),!((i=(e=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(e.length-1))>=55296&&i<=56319)){if(this.charReceived=this.charLength=0,t.length===0)return e;break}this.charLength+=this.surrogateSize,e=""}this.detectIncompleteChar(t);var r=t.length;this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,r),r-=this.charReceived);var i;if(r=(e+=t.toString(this.encoding,0,r)).length-1,(i=e.charCodeAt(r))>=55296&&i<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),t.copy(this.charBuffer,0,0,o),e.substring(0,r)}return e},Ni.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var n=t[t.length-e];if(e==1&&n>>5==6){this.charLength=2;break}if(e<=2&&n>>4==14){this.charLength=3;break}if(e<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=e},Ni.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;e+=r.slice(0,n).toString(i)}return e};var Ml=zr(Object.freeze({__proto__:null,StringDecoder:Ni})),Tl=Dn.codes.ERR_STREAM_PREMATURE_CLOSE;function Jp(){}var ds,Rl,Ol,Ll,hs,Pl,Pa=function t(e,n,r){if(typeof n=="function")return t(e,null,n);n||(n={}),r=function(g){var m=!1;return function(){if(!m){m=!0;for(var w=arguments.length,p=new Array(w),k=0;k<w;k++)p[k]=arguments[k];g.apply(this,p)}}}(r||Jp);var i=n.readable||n.readable!==!1&&e.readable,o=n.writable||n.writable!==!1&&e.writable,s=function(){e.writable||c()},a=e._writableState&&e._writableState.finished,c=function(){o=!1,a=!0,i||r.call(e)},l=e._readableState&&e._readableState.endEmitted,u=function(){i=!1,l=!0,o||r.call(e)},d=function(g){r.call(e,g)},h=function(){var g;return i&&!l?(e._readableState&&e._readableState.ended||(g=new Tl),r.call(e,g)):o&&!a?(e._writableState&&e._writableState.ended||(g=new Tl),r.call(e,g)):void 0},f=function(){e.req.on("finish",c)};return function(g){return g.setHeader&&typeof g.abort=="function"}(e)?(e.on("complete",c),e.on("abort",h),e.req?f():e.on("request",f)):o&&!e._writableState&&(e.on("end",s),e.on("close",s)),e.on("end",u),e.on("finish",c),n.error!==!1&&e.on("error",d),e.on("close",h),function(){e.removeListener("complete",c),e.removeListener("abort",h),e.removeListener("request",f),e.req&&e.req.removeListener("finish",c),e.removeListener("end",s),e.removeListener("close",s
33),e.removeListener("finish",c),e.removeListener("end",u),e.removeListener("error",d),e.removeListener("close",h)}};function Xp(){if(Rl)return ds;var t;function e(m,w,p){return(w=function(k){var _=function(O,N){if(typeof O!="object"||O===null)return O;var U=O[Symbol.toPrimitive];if(U!==void 0){var W=U.call(O,N||"default");if(typeof W!="object")return W;throw new TypeError("@@toPrimitive must return a primitive value.")}return(N==="string"?String:Number)(O)}(k,"string");return typeof _=="symbol"?_:String(_)}(w))in m?Object.defineProperty(m,w,{value:p,enumerable:!0,configurable:!0,writable:!0}):m[w]=p,m}Rl=1;var n=Pa,r=Symbol("lastResolve"),i=Symbol("lastReject"),o=Symbol("error"),s=Symbol("ended"),a=Symbol("lastPromise"),c=Symbol("handlePromise"),l=Symbol("stream");function u(m,w){return{value:m,done:w}}function d(m){var w=m[r];if(w!==null){var p=m[l].read();p!==null&&(m[a]=null,m[r]=null,m[i]=null,w(u(p,!1)))}}function h(m){we.nextTick(d,m)}var f=Object.getPrototypeOf(function(){}),g=Object.setPrototypeOf((e(t={get stream(){return this[l]},next:function(){var m=this,w=this[o];if(w!==null)return Promise.reject(w);if(this[s])return Promise.resolve(u(void 0,!0));if(this[l].destroyed)return new Promise(function(O,N){we.nextTick(function(){m[o]?N(m[o]):O(u(void 0,!0))})});var p,k=this[a];if(k)p=new Promise(function(O,N){return function(U,W){O.then(function(){N[s]?U(u(void 0,!0)):N[c](U,W)},W)}}(k,this));else{var _=this[l].read();if(_!==null)return Promise.resolve(u(_,!1));p=new Promise(this[c])}return this[a]=p,p}},Symbol.asyncIterator,function(){return this}),e(t,"return",function(){var m=this;return new Promise(function(w,p){m[l].destroy(null,function(k){k?p(k):w(u(void 0,!0))})})}),t),f);return ds=function(m){var w,p=Object.create(g,(e(w={},l,{value:m,writable:!0}),e(w,r,{value:null,writable:!0}),e(w,i,{value:null,writable:!0}),e(w,o,{value:null,writable:!0}),e(w,s,{value:m._readableState.endEmitted,writable:!0}),e(w,c,{value:function(k,_){var O=p[l].read();O?(p[a]=null,p[r]=null,p[i]=null,k(u(O,!1))):(p[r]=k,p[i]=_)},writable:!0}),w));return p[a]=null,n(m,function(k){if(k&&k.code!=="ERR_STREAM_PREMATURE_CLOSE"){var _=p[i];return _!==null&&(p[a]=null,p[r]=null,p[i]=null,_(k)),void(p[o]=k)}var O=p[r];O!==null&&(p[a]=null,p[r]=null,p[i]=null,O(u(void 0,!0))),p[s]=!0}),m.on("readable",h.bind(null,p)),p},ds}function Wh(){if(Pl)return hs;var t;Pl=1,hs=N,N.ReadableState=O,Sa.EventEmitter;var e=function(b,v){return b.listeners(v).length},n=Lh(),r=xa.Buffer,i=(yt!==void 0?yt:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){},o,s=Hh;o=s&&s.debuglog?s.debuglog("stream"):function(){};var a,c,l,u=zp(),d=Fh(),h=qh().getHighWaterMark,f=Dn.codes,g=f.ERR_INVALID_ARG_TYPE,m=f.ERR_STREAM_PUSH_AFTER_EOF,w=f.ERR_METHOD_NOT_IMPLEMENTED,p=f.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;Wr(N,n);var k=d.errorOrDestroy,_=["error","close","destroy","pause","resume"];function O(b,v,S){t=t||or(),b=b||{},typeof S!="boolean"&&(S=v instanceof t),this.objectMode=!!b.objectMode,S&&(this.objectMode=this.objectMode||!!b.readableObjectMode),this.highWaterMark=h(this,b,"readableHighWaterMark",S),this.buffer=new u,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=b.emitClose!==!1,this.autoDestroy=!!b.autoDestroy,this.destroyed=!1,this.defaultEncoding=b.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,b.encoding&&(a||(a=Ml.StringDecoder),this.decoder=new a(b.encoding),this.encoding=b.encoding)}function N(b){if(t=t||or(),!(this instanceof N))return new N(b);var v=this instanceof t;this._readableState=new O(b,this,v),this.readable=!0,b&&(typeof b.read=="function"&&(this._read=b.read),typeof b.destroy=="function"&&(this._destroy=b.destroy)),n.call(this)}function U(b,v,S,x,T){o("readableAddChunk",v);var I,D=b._readableState;if(v===null)D.reading=!1,function(F,z){if(o("onEofChunk"),!z.ended){if(z.decoder){var Z=z.decoder.end();Z&&Z.length&&(z.buffer.push(Z),z.length+=z.objectMode?1:Z.length)}z.ended=!0,z.sync?K(F):(z.needReadable=!1,z.emittedReadable||(z.emittedReadable=!0,Y(F)
33))}}(b,D);else if(T||(I=function(F,z){var Z;Q=z,r.isBuffer(Q)||Q instanceof i||typeof z=="string"||z===void 0||F.objectMode||(Z=new g("chunk",["string","Buffer","Uint8Array"],z));var Q;return Z}(D,v)),I)k(b,I);else if(D.objectMode||v&&v.length>0)if(typeof v=="string"||D.objectMode||Object.getPrototypeOf(v)===r.prototype||(v=function(F){return r.from(F)}(v)),x)D.endEmitted?k(b,new p):W(b,D,v,!0);else if(D.ended)k(b,new m);else{if(D.destroyed)return!1;D.reading=!1,D.decoder&&!S?(v=D.decoder.write(v),D.objectMode||v.length!==0?W(b,D,v,!1):j(b,D)):W(b,D,v,!1)}else x||(D.reading=!1,j(b,D));return!D.ended&&(D.length<D.highWaterMark||D.length===0)}function W(b,v,S,x){v.flowing&&v.length===0&&!v.sync?(v.awaitDrain=0,b.emit("data",S)):(v.length+=v.objectMode?1:S.length,x?v.buffer.unshift(S):v.buffer.push(S),v.needReadable&&K(b)),j(b,v)}Object.defineProperty(N.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState!==void 0&&this._readableState.destroyed},set:function(b){this._readableState&&(this._readableState.destroyed=b)}}),N.prototype.destroy=d.destroy,N.prototype._undestroy=d.undestroy,N.prototype._destroy=function(b,v){v(b)},N.prototype.push=function(b,v){var S,x=this._readableState;return x.objectMode?S=!0:typeof b=="string"&&((v=v||x.defaultEncoding)!==x.encoding&&(b=r.from(b,v),v=""),S=!0),U(this,b,v,!1,S)},N.prototype.unshift=function(b){return U(this,b,null,!0,!1)},N.prototype.isPaused=function(){return this._readableState.flowing===!1},N.prototype.setEncoding=function(b){a||(a=Ml.StringDecoder);var v=new a(b);this._readableState.decoder=v,this._readableState.encoding=this._readableState.decoder.encoding;for(var S=this._readableState.buffer.head,x="";S!==null;)x+=v.write(S.data),S=S.next;return this._readableState.buffer.clear(),x!==""&&this._readableState.buffer.push(x),this._readableState.length=x.length,this};var V=1073741824;function H(b,v){return b<=0||v.length===0&&v.ended?0:v.objectMode?1:b!=b?v.flowing&&v.length?v.buffer.head.data.length:v.length:(b>v.highWaterMark&&(v.highWaterMark=function(S){return S>=V?S=V:(S--,S|=S>>>1,S|=S>>>2,S|=S>>>4,S|=S>>>8,S|=S>>>16,S++),S}(b)),b<=v.length?b:v.ended?v.length:(v.needReadable=!0,0))}function K(b){var v=b._readableState;o("emitReadable",v.needReadable,v.emittedReadable),v.needReadable=!1,v.emittedReadable||(o("emitReadable",v.flowing),v.emittedReadable=!0,we.nextTick(Y,b))}function Y(b){var v=b._readableState;o("emitReadable_",v.destroyed,v.length,v.ended),v.destroyed||!v.length&&!v.ended||(b.emit("readable"),v.emittedReadable=!1),v.needReadable=!v.flowing&&!v.ended&&v.length<=v.highWaterMark,$(b)}function j(b,v){v.readingMore||(v.readingMore=!0,we.nextTick(B,b,v))}function B(b,v){for(;!v.reading&&!v.ended&&(v.length<v.highWaterMark||v.flowing&&v.length===0);){var S=v.length;if(o("maybeReadMore read 0"),b.read(0),S===v.length)break}v.readingMore=!1}function R(b){var v=b._readableState;v.readableListening=b.listenerCount("readable")>0,v.resumeScheduled&&!v.paused?v.flowing=!0:b.listenerCount("data")>0&&b.resume()}function C(b){o("readable nexttick read 0"),b.read(0)}function L(b,v){o("resume",v.reading),v.reading||b.read(0),v.resumeScheduled=!1,b.emit("resume"),$(b),v.flowing&&!v.reading&&b.read(0)}function $(b){var v=b._readableState;for(o("flow",v.flowing);v.flowing&&b.read()!==null;);}function y(b,v){return v.length===0?null:(v.objectMode?S=v.buffer.shift():!b||b>=v.length?(S=v.decoder?v.buffer.join(""):v.buffer.length===1?v.buffer.first():v.buffer.concat(v.length),v.buffer.clear()):S=v.buffer.consume(b,v.decoder),S);var S}function E(b){var v=b._readableState;o("endReadable",v.endEmitted),v.endEmitted||(v.ended=!0,we.nextTick(A,v,b))}function A(b,v){if(o("endReadableNT",b.endEmitted,b.length),!b.endEmitted&&b.length===0&&(b.endEmitted=!0,v.readable=!1,v.emit("end"),b.autoDestroy)){var S=v._writableState;(!S||S.autoDestroy&&S.finished)&&v.destroy()}}function M(b,v){for(var S=0,x=b.length;S<x;S++)if(b[S]===v)return S;return-1}return N.prototype.read=function(b){o("read",b),b=parseInt(b,10);var v=this._readableState,S=b;if(b!==0&&(v.emittedReadable=!1),b===0&&v.needReadable&&((v.highWaterMark!==0?v.length>=v.highWaterMark:v.length>0)||v.ended))return o("read: emitReadable",v.length,v.ended),v.length===0&&v.ended?E(this):K(this),null;if((b=H(b,v))===0&&v.ended)return v.length===0&&E(this),null;var x,T=v.needReadable;return o("need readable",T),(v.length===0||v.length-b<v.highWaterMark)&&o("length less than watermark",T=!0),v.ended||v.reading?o("reading or ended",T=!1):T&&(o("do read"),v.reading=!0,v.sync=!0,v.length===0&&(v.needReadable=!0),this._read(v.highWaterMark),v.sync=!1,v.reading||(b=H(S,v))),(x=b>0?y(b,v):null)===null?(v.needReadable=v.length<=v.highWaterMark,b=0):(v.length-=b,v.awaitDrain=0),v.length===0&&(v.ended||(v.needReadable=!0),S!==b&&v.ended&&E(this)),x!==null&&this.emit
33("data",x),x},N.prototype._read=function(b){k(this,new w("_read()"))},N.prototype.pipe=function(b,v){var S=this,x=this._readableState;switch(x.pipesCount){case 0:x.pipes=b;break;case 1:x.pipes=[x.pipes,b];break;default:x.pipes.push(b)}x.pipesCount+=1,o("pipe count=%d opts=%j",x.pipesCount,v);var T=(!v||v.end!==!1)&&b!==we.stdout&&b!==we.stderr?D:le;function I(re,ie){o("onunpipe"),re===S&&ie&&ie.hasUnpiped===!1&&(ie.hasUnpiped=!0,o("cleanup"),b.removeListener("close",ne),b.removeListener("finish",se),b.removeListener("drain",F),b.removeListener("error",Q),b.removeListener("unpipe",I),S.removeListener("end",D),S.removeListener("end",le),S.removeListener("data",Z),z=!0,!x.awaitDrain||b._writableState&&!b._writableState.needDrain||F())}function D(){o("onend"),b.end()}x.endEmitted?we.nextTick(T):S.once("end",T),b.on("unpipe",I);var F=function(re){return function(){var ie=re._readableState;o("pipeOnDrain",ie.awaitDrain),ie.awaitDrain&&ie.awaitDrain--,ie.awaitDrain===0&&e(re,"data")&&(ie.flowing=!0,$(re))}}(S);b.on("drain",F);var z=!1;function Z(re){o("ondata");var ie=b.write(re);o("dest.write",ie),ie===!1&&((x.pipesCount===1&&x.pipes===b||x.pipesCount>1&&M(x.pipes,b)!==-1)&&!z&&(o("false write response, pause",x.awaitDrain),x.awaitDrain++),S.pause())}function Q(re){o("onerror",re),le(),b.removeListener("error",Q),e(b,"error")===0&&k(b,re)}function ne(){b.removeListener("finish",se),le()}function se(){o("onfinish"),b.removeListener("close",ne),le()}function le(){o("unpipe"),S.unpipe(b)}return S.on("data",Z),function(re,ie,ce){if(typeof re.prependListener=="function")return re.prependListener(ie,ce);re._events&&re._events[ie]?Array.isArray(re._events[ie])?re._events[ie].unshift(ce):re._events[ie]=[ce,re._events[ie]]:re.on(ie,ce)}(b,"error",Q),b.once("close",ne),b.once("finish",se),b.emit("pipe",S),x.flowing||(o("pipe resume"),S.resume()),b},N.prototype.unpipe=function(b){var v=this._readableState,S={hasUnpiped:!1};if(v.pipesCount===0)return this;if(v.pipesCount===1)return b&&b!==v.pipes||(b||(b=v.pipes),v.pipes=null,v.pipesCount=0,v.flowing=!1,b&&b.emit("unpipe",this,S)),this;if(!b){var x=v.pipes,T=v.pipesCount;v.pipes=null,v.pipesCount=0,v.flowing=!1;for(var I=0;I<T;I++)x[I].emit("unpipe",this,{hasUnpiped:!1});return this}var D=M(v.pipes,b);return D===-1||(v.pipes.splice(D,1),v.pipesCount-=1,v.pipesCount===1&&(v.pipes=v.pipes[0]),b.emit("unpipe",this,S)),this},N.prototype.on=function(b,v){var S=n.prototype.on.call(this,b,v),x=this._readableState;return b==="data"?(x.readableListening=this.listenerCount("readable")>0,x.flowing!==!1&&this.resume()):b==="readable"&&(x.endEmitted||x.readableListening||(x.readableListening=x.needReadable=!0,x.flowing=!1,x.emittedReadable=!1,o("on readable",x.length,x.reading),x.length?K(this):x.reading||we.nextTick(C,this))),S},N.prototype.addListener=N.prototype.on,N.prototype.removeListener=function(b,v){var S=n.prototype.removeListener.call(this,b,v);return b==="readable"&&we.nextTick(R,this),S},N.prototype.removeAllListeners=function(b){var v=n.prototype.removeAllListeners.apply(this,arguments);return b!=="readable"&&b!==void 0||we.nextTick(R,this),v},N.prototype.resume=function(){var b=this._readableState;return b.flowing||(o("resume"),b.flowing=!b.readableListening,function(v,S){S.resumeScheduled||(S.resumeScheduled=!0,we.nextTick(L,v,S))}(this,b)),b.paused=!1,this},N.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},N.prototype.wrap=function(b){var v=this,S=this._readableState,x=!1;for(var T in b.on("end",function(){if(o("wrapped end"),S.decoder&&!S.ended){var D=S.decoder.end();D&&D.length&&v.push(D)}v.push(null)}),b.on("data",function(D){o("wrapped data"),S.decoder&&(D=S.decoder.write(D)),S.objectMode&&D==null||(S.objectMode||D&&D.length)&&(v.push(D)||(x=!0,b.pause()))}),b)this[T]===void 0&&typeof b[T]=="function"&&(this[T]=function(D){return function(){return b[D].apply(b,arguments)}}(T));for(var I=0;I<_.length;I++)b.on(_[I],this.emit.bind(this,_[I]));return this._read=function(D){o("wrapped _read",D),x&&(x=!1,b.resume())},this},typeof Symbol=="function"&&(N.prototype[Symbol.asyncIterator]=function(){return c===void 0&&(c=Xp()),c(this)}),Object.defineProperty(N.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(N.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(N.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(b){this._readableState&&(this._readableState.flowing=b)}}),N._fromList=y,Object.defineProperty(N.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),typeof Symbol=="function"&&(N.from=function(b,v){return l===void 0&&(l=Ll?Ol:(Ll=1,Ol=function(){throw new Error("Readable.from is not available in the browser")})),l(N,b,v)}),hs}
33var Gh=qt,Co=Dn.codes,Qp=Co.ERR_METHOD_NOT_IMPLEMENTED,e2=Co.ERR_MULTIPLE_CALLBACK,t2=Co.ERR_TRANSFORM_ALREADY_TRANSFORMING,n2=Co.ERR_TRANSFORM_WITH_LENGTH_0,Bi=or();function r2(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(r===null)return this.emit("error",new e2);n.writechunk=null,n.writecb=null,e!=null&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function qt(t){if(!(this instanceof qt))return new qt(t);Bi.call(this,t),this._transformState={afterTransform:r2.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",i2)}function i2(){var t=this;typeof this._flush!="function"||this._readableState.destroyed?Il(this,null,null):this._flush(function(e,n){Il(t,e,n)})}function Il(t,e,n){if(e)return t.emit("error",e);if(n!=null&&t.push(n),t._writableState.length)throw new n2;if(t._transformState.transforming)throw new t2;return t.push(null)}Wr(qt,Bi),qt.prototype.push=function(t,e){return this._transformState.needTransform=!1,Bi.prototype.push.call(this,t,e)},qt.prototype._transform=function(t,e,n){n(new Qp("_transform()"))},qt.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},qt.prototype._read=function(t){var e=this._transformState;e.writechunk===null||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},qt.prototype._destroy=function(t,e){Bi.prototype._destroy.call(this,t,function(n){e(n)})};var fs,o2=jr,Yh=Gh;function jr(t){if(!(this instanceof jr))return new jr(t);Yh.call(this,t)}Wr(jr,Yh),jr.prototype._transform=function(t,e,n){n(null,t)};var Zh=Dn.codes,s2=Zh.ERR_MISSING_ARGS,a2=Zh.ERR_STREAM_DESTROYED;function Nl(t){if(t)throw t}function Bl(t){t()}function c2(t,e){return t.pipe(e)}var l2=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r,i=function(s){return s.length?typeof s[s.length-1]!="function"?Nl:s.pop():Nl}(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new s2("streams");var o=e.map(function(s,a){var c=a<e.length-1;return function(l,u,d,h){h=function(m){var w=!1;return function(){w||(w=!0,m.apply(void 0,arguments))}}(h);var f=!1;l.on("close",function(){f=!0}),fs===void 0&&(fs=Pa),fs(l,{readable:u,writable:d},function(m){if(m)return h(m);f=!0,h()});var g=!1;return function(m){if(!f&&!g)return g=!0,function(w){return w.setHeader&&typeof w.abort=="function"}(l)?l.abort():typeof l.destroy=="function"?l.destroy():void h(m||new a2("pipe"))}}(s,c,a>0,function(l){r||(r=l),l&&o.forEach(Bl),c||(o.forEach(Bl),i(r))})});return e.reduce(c2)};(function(t,e){(e=Ws.exports=Wh()).Stream=e,e.Readable=e,e.Writable=Vh(),e.Duplex=or(),e.Transform=Gh,e.PassThrough=o2,e.finished=Pa,e.pipeline=l2})(0,Ws.exports);var sr=Ws.exports;function u2(t={}){const e={},n=new sr.Duplex({objectMode:!0,read:()=>{},write:function(o,s,a){let c=null;try{o.id?function(l){const{id:u}=l;if(u===null)return;const d=e[u];if(!d)return void console.warn(`StreamMiddleware - Unknown response id "${u}"`);delete e[u],Object.assign(d.res,l),setTimeout(d.end)}(o):function(l){t!=null&&t.retryOnMessage&&l.method===t.retryOnMessage&&Object.values(e).forEach(({req:u,retryCount:d=0})=>{if(!u.id)return;if(d>=3)throw new Error(`StreamMiddleware - Retry limit exceeded for request id "${u.id}"`);const h=e[u.id];h&&(h.retryCount=d+1),i(u)}),r.emit("notification",l)}(o)}catch(l){c=l}a(c)}}),r=new kh;return{events:r,middleware:(o,s,a,c)=>{e[o.id]={req:o,res:s,next:a,end:c},i(o)},stream:n};function i(o){n.push(o)}}var oo={},Gs={exports:{}},d2=function t(e,n){if(e&&n)return t(e)(n);if(typeof e!="function")throw new TypeError("need wrapper function");return Object.keys(e).forEach(function(i){r[i]=e[i]}),r;function r(){for(var i=new Array(arguments.length),o=0;o<i.length;o++)i[o]=arguments[o];var s=e.apply(this,i),a=i[i.length-1];
33return typeof s=="function"&&s!==a&&Object.keys(a).forEach(function(c){s[c]=a[c]}),s}},Dl=d2;function mi(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function $l(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},n=t.name||"Function wrapped with `once`";return e.onceError=n+" shouldn't be called more than once",e.called=!1,e}Gs.exports=Dl(mi),Gs.exports.strict=Dl($l),mi.proto=mi(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return mi(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return $l(this)},configurable:!0})});var h2=Gs.exports,so={};Object.defineProperty(so,"__esModule",{value:!0}),so.Substream=void 0;const f2=sr;class p2 extends f2.Duplex{constructor({parent:e,name:n}){super({objectMode:!0}),this._parent=e,this._name=n}_read(){}_write(e,n,r){this._parent.push({name:this._name,data:e}),r()}}so.Substream=p2;var g2=yt&&yt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(oo,"__esModule",{value:!0}),oo.ObjectMultiplex=void 0;const ps=sr,m2=g2(h2),y2=so,jl=Symbol("IGNORE_SUBSTREAM");let v2=class extends ps.Duplex{constructor(t={}){super(Object.assign(Object.assign({},t),{objectMode:!0})),this._substreams={}}createStream(t){if(this.destroyed)throw new Error(`ObjectMultiplex - parent stream for name "${t}" already destroyed`);if(this._readableState.ended||this._writableState.ended)throw new Error(`ObjectMultiplex - parent stream for name "${t}" already ended`);if(!t)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[t])throw new Error(`ObjectMultiplex - Substream for name "${t}" already exists`);const e=new y2.Substream({parent:this,name:t});return this._substreams[t]=e,function(n,r){const i=(0,m2.default)(r);(0,ps.finished)(n,{readable:!1},i),(0,ps.finished)(n,{writable:!1},i)}(this,n=>e.destroy(n||void 0)),e}ignoreStream(t){if(!t)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[t])throw new Error(`ObjectMultiplex - Substream for name "${t}" already exists`);this._substreams[t]=jl}_read(){}_write(t,e,n){const{name:r,data:i}=t;if(!r)return console.warn(`ObjectMultiplex - malformed chunk without name "${t}"`),n();const o=this._substreams[r];return o?(o!==jl&&o.push(i),n()):(console.warn(`ObjectMultiplex - orphaned data for stream "${r}"`),n())}};oo.ObjectMultiplex=v2;var b2=vo(oo.ObjectMultiplex);const xt=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";xt.writable=t=>xt(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object",xt.readable=t=>xt(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object",xt.duplex=t=>xt.writable(t)&&xt.readable(t),xt.transform=t=>xt.duplex(t)&&typeof t._transform=="function";var At,w2=xt,E2=class extends Dp{constructor(t,{jsonRpcStreamName:e,logger:n=console,maxEventListeners:r=100,rpcMiddleware:i=[]}){if(super({logger:n,maxEventListeners:r,rpcMiddleware:i}),!w2.duplex(t))throw new Error(Me.errors.invalidDuplexStream());this._handleStreamDisconnect=this._handleStreamDisconnect.bind(this);const o=new b2;sr.pipeline(t,o,t,this._handleStreamDisconnect.bind(this,"MetaMask")),this._jsonRpcConnection=u2({retryOnMessage:"METAMASK_EXTENSION_CONNECT_CAN_RETRY"}),sr.pipeline(this._jsonRpcConnection.stream,o.createStream(e),this._jsonRpcConnection.stream,this._handleStreamDisconnect.bind(this,"MetaMask RpcProvider")),this._rpcEngine.push(this._jsonRpcConnection.middleware),this._jsonRpcConnection.events.on("notification",s=>{const{method:a,params:c}=s;a==="metamask_accountsChanged"?this._handleAccountsChanged(c):a==="metamask_unlockStateChanged"?this._handleUnlockStateChanged(c):a==="metamask_chainChanged"?this._handleChainChanged(c):xh.includes(a)?this.emit("message",{type:a,data:c}):a==="METAMASK_STREAM_FAILURE"&&t.destroy(new Error(Me.errors.permanentlyDisconnected()))})}async _initializeStateAsync(){let t;try{t=await this.request({method:"metamask_getProviderState"})}catch(e){this._log.error("MetaMask: Failed to get initial state. Please report this bug.",e)}this._initializeState(t)}_handleStreamDisconnect(t,e){let n=`MetaMask: Lost connection to "${t}".`;e!=null&&e.stack&&(n+=` 34${e.stack}`),this._log.warn(n),this.listenerCount("error")>
340&&this.emit("error",n),this._handleDisconnect(!1,e?e.message:void 0)}_handleChainChanged({chainId:t,networkVersion:e}={}){Ah(t)&&(n=>!!n&&typeof n=="string")(e)?e==="loading"?this._handleDisconnect(!0):super._handleChainChanged({chainId:t}):this._log.error(Me.errors.invalidNetworkParams(),{chainId:t,networkVersion:e})}},_2=class extends E2{constructor(t,{jsonRpcStreamName:e="metamask-provider",logger:n=console,maxEventListeners:r=100,shouldSendMetadata:i}={}){if(super(t,{jsonRpcStreamName:e,logger:n,maxEventListeners:r,rpcMiddleware:Tp(n)}),this._sentWarnings={chainId:!1,networkVersion:!1,selectedAddress:!1,enable:!1,experimentalMethods:!1,send:!1,events:{close:!1,data:!1,networkChanged:!1,notification:!1}},Vs(this,At,void 0),this._initializeStateAsync(),zt(this,At,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",o=>{const{method:s}=o;xh.includes(s)&&(this.emit("data",o),this.emit("notification",o.params.result))}),i)if(document.readyState==="complete")ml(this._rpcEngine,this._log);else{const o=()=>{ml(this._rpcEngine,this._log),window.removeEventListener("DOMContentLoaded",o)};window.addEventListener("DOMContentLoaded",o)}}get chainId(){return this._sentWarnings.chainId||(this._log.warn(Me.warnings.chainIdDeprecation),this._sentWarnings.chainId=!0),super.chainId}get networkVersion(){return this._sentWarnings.networkVersion||(this._log.warn(Me.warnings.networkVersionDeprecation),this._sentWarnings.networkVersion=!0),Ot(this,At)}get selectedAddress(){return this._sentWarnings.selectedAddress||(this._log.warn(Me.warnings.selectedAddressDeprecation),this._sentWarnings.selectedAddress=!0),super.selectedAddress}sendAsync(t,e){this._rpcRequest(t,e)}addListener(t,e){return this._warnOfDeprecation(t),super.addListener(t,e)}on(t,e){return this._warnOfDeprecation(t),super.on(t,e)}once(t,e){return this._warnOfDeprecation(t),super.once(t,e)}prependListener(t,e){return this._warnOfDeprecation(t),super.prependListener(t,e)}prependOnceListener(t,e){return this._warnOfDeprecation(t),super.prependOnceListener(t,e)}_handleDisconnect(t,e){super._handleDisconnect(t,e),Ot(this,At)&&!t&&zt(this,At,null)}_warnOfDeprecation(t){var e;((e=this._sentWarnings)==null?void 0:e.events[t])===!1&&(this._log.warn(Me.warnings.events[t]),this._sentWarnings.events[t]=!0)}async enable(){return this._sentWarnings.enable||(this._log.warn(Me.warnings.enableDeprecation),this._sentWarnings.enable=!0),new Promise((t,e)=>{try{this._rpcRequest({method:"eth_requestAccounts",params:[]},Ii(t,e))}catch(n){e(n)}})}send(t,e){return this._sentWarnings.send||(this._log.warn(Me.warnings.sendDeprecation),this._sentWarnings.send=!0),typeof t!="string"||e&&!Array.isArray(e)?t&&typeof t=="object"&&typeof e=="function"?this._rpcRequest(t,e):this._sendSync(t):new Promise((n,r)=>{try{this._rpcRequest({method:t,params:e},Ii(n,r,!1))}catch(i){r(i)}})}_sendSync(t){let e;switch(t.method){case"eth_accounts":e=this.selectedAddress?[this.selectedAddress]:[];break;case"eth_coinbase":e=this.selectedAddress??null;break;case"eth_uninstallFilter":this._rpcRequest(t,Mh),e=!0;break;case"net_version":e=Ot(this,At)??null;break;default:throw new Error(Me.errors.unsupportedSync(t.method))}return{id:t.id,jsonrpc:t.jsonrpc,result:e}}_getExperimentalApi(){return new Proxy({isUnlocked:async()=>(this._state.initialized||await new Promise(t=>{this.on("_initialized",()=>t())}),this._state.isUnlocked),requestBatch:async t=>{if(!Array.isArray(t))throw Sr({message:"Batch requests must be made with an array of request objects.",data:t});return new Promise((e,n)=>{this._rpcRequest(t,Ii(e,n))})}},{get:(t,e,...n)=>(this._sentWarnings.experimentalMethods||(this._log.warn(Me.warnings.experimentalMethods),this._sentWarnings.experimentalMethods=!0),Reflect.get(t,e,...n))})}_handleChainChanged({chainId:t,networkVersion:e}={}){super._handleChainChanged({chainId:t,networkVersion:e}),this._state.isConnected&&e!==Ot(this,At)&&(zt(this,At,e),this._state.initialized&&this.emit
34("networkChanged",Ot(this,At)))}};At=new WeakMap;const G=Ge("MM_SDK");G.color="#FFAC1C";var Jh={},bn={};Object.defineProperty(bn,"__esModule",{value:!0}),bn.EthereumProviderError=bn.EthereumRpcError=void 0;const C2=bh;class Xh extends Error{constructor(e,n,r){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string.');super(n),this.code=e,r!==void 0&&(this.data=r)}serialize(){const e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),this.stack&&(e.stack=this.stack),e}toString(){return C2.default(this.serialize(),S2,2)}}bn.EthereumRpcError=Xh;function S2(t,e){if(e!=="[Circular]")return e}bn.EthereumProviderError=class extends Xh{constructor(t,e,n){if(!function(r){return Number.isInteger(r)&&r>=1e3&&r<=4999}(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,e,n)}};var Ia={},fn={};Object.defineProperty(fn,"__esModule",{value:!0}),fn.errorValues=fn.errorCodes=void 0,fn.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}},fn.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}},function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.serializeError=t.isValidCode=t.getMessageFromCode=t.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=fn,n=bn,r=e.errorCodes.rpc.internal,i="Unspecified error message. This is a bug, please report it.",o={code:r,message:s(r)};function s(d,h=i){if(Number.isInteger(d)){const f=d.toString();if(u(e.errorValues,f))return e.errorValues[f].message;if(c(d))return t.JSON_RPC_SERVER_ERROR_MESSAGE}return h}function a(d){if(!Number.isInteger(d))return!1;const h=d.toString();return!!e.errorValues[h]||!!c(d)}function c(d){return d>=-32099&&d<=-32e3}function l(d){return d&&typeof d=="object"&&!Array.isArray(d)?Object.assign({},d):d}function u(d,h){return Object.prototype.hasOwnProperty.call(d,h)}t.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",t.getMessageFromCode=s,t.isValidCode=a,t.serializeError=function(d,{fallbackError:h=o,shouldIncludeStack:f=!1}={}){var g,m;if(!h||!Number.isInteger(h.code)||typeof h.message!="string")throw new Error("Mu
34st provide fallback error with integer number code and string message.");if(d instanceof n.EthereumRpcError)return d.serialize();const w={};if(d&&typeof d=="object"&&!Array.isArray(d)&&u(d,"code")&&a(d.code)){const k=d;w.code=k.code,k.message&&typeof k.message=="string"?(w.message=k.message,u(k,"data")&&(w.data=k.data)):(w.message=s(w.code),w.data={originalError:l(d)})}else{w.code=h.code;const k=(g=d)===null||g===void 0?void 0:g.message;w.message=k&&typeof k=="string"?k:h.message,w.data={originalError:l(d)}}const p=(m=d)===null||m===void 0?void 0:m.stack;return f&&d&&p&&typeof p=="string"&&(w.stack=p),w}}(Ia);var ao={};Object.defineProperty(ao,"__esModule",{value:!0}),ao.ethErrors=void 0;const Na=bn,Qh=Ia,Ke=fn;function ut(t,e){const[n,r]=ef(e);return new Na.EthereumRpcError(t,n||Qh.getMessageFromCode(t),r)}function mr(t,e){const[n,r]=ef(e);return new Na.EthereumProviderError(t,n||Qh.getMessageFromCode(t),r)}function ef(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:n}=t;
34if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,n]}}return[]}ao.ethErrors={rpc:{parse:t=>ut(Ke.errorCodes.rpc.parse,t),invalidRequest:t=>ut(Ke.errorCodes.rpc.invalidRequest,t),invalidParams:t=>ut(Ke.errorCodes.rpc.invalidParams,t),methodNotFound:t=>ut(Ke.errorCodes.rpc.methodNotFound,t),internal:t=>ut(Ke.errorCodes.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return ut(e,t)},invalidInput:t=>ut(Ke.errorCodes.rpc.invalidInput,t),resourceNotFound:t=>ut(Ke.errorCodes.rpc.resourceNotFound,t),resourceUnavailable:t=>ut(Ke.errorCodes.rpc.resourceUnavailable,t),transactionRejected:t=>ut(Ke.errorCodes.rpc.transactionRejected,t),methodNotSupported:t=>ut(Ke.errorCodes.rpc.methodNotSupported,t),limitExceeded:t=>ut(Ke.errorCodes.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>mr(Ke.errorCodes.provider.userRejectedRequest,t),unauthorized:t=>mr(Ke.errorCodes.provider.unauthorized,t),unsupportedMethod:t=>mr(Ke.errorCodes.provider.unsupportedMethod,t),disconnected:t=>mr(Ke.errorCodes.provider.disconnected,t),chainDisconnected:t=>mr(Ke.errorCodes.provider.chainDisconnected,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:n,data:r}=t;if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string');return new Na.EthereumProviderError(e,n,r)}}},function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getMessageFromCode=t.serializeError=t.EthereumProviderError=t.EthereumRpcError=t.ethErrors=t.errorCodes=void 0;const e=bn;Object.defineProperty(t,"EthereumRpcError",{enumerable:!0,get:function(){return e.EthereumRpcError}}),Object.defineProperty(t,"EthereumProviderError",{enumerable:!0,get:function(){return e.EthereumProviderError}});const n=Ia;Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return n.serializeError}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return n.getMessageFromCode}});const r=ao;Object.defineProperty(t,"ethErrors",{enumerable:!0,get:function(){return r.ethErrors}});const i=fn;Object.defineProperty(t,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})}(Jh);var tf={exports:{}};tf.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(r,i,o){n.o(r,i)||Object.defineProperty(r,i,{enumerable:!0,get:o})},n.r=function(r){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},n.t=function(r,i){if(1&i&&(r=n(r)),8&i||4&i&&typeof r=="object"&&r&&r.__esModule)return r;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:r}),2&i&&typeof r!="string")for(var s in r)n.d(o,s,(function(a){return r[a]}).bind(null,s));return o},n.n=function(r){var i=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(i,"a",i),i},n.o=function(r,i){return Object.prototype.hasOwnProperty.call(r,i)},n.p="",n(n.s=90)}({17:function(t,e,n){e.__esModule=!0,e.default=void 0;var r=n(18),i=function(){function o(){}return o.getFirstMatch=function(s,a){var c=a.match(s);return c&&c.length>0&&c[1]||""},o.getSecondMatch=function(s,a){var c=a.match(s);return c&&c.length>1&&c[2]||""},o.matchAndReturnConst=function(s,a,c){if(s.test(a))return c},o.getWindowsVersionName=function(s){switch(s){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}},o.getMacOSVersionName=function(s){var a=s.split(".").splice(0,2).map(function(c){return parseInt(c,10)||0});if(a.push(0),a[0]===10)switch(a[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";
34case 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}},o.getAndroidVersionName=function(s){var a=s.split(".").splice(0,2).map(function(c){return parseInt(c,10)||0});if(a.push(0),!(a[0]===1&&a[1]<5))return a[0]===1&&a[1]<6?"Cupcake":a[0]===1&&a[1]>=6?"Donut":a[0]===2&&a[1]<2?"Eclair":a[0]===2&&a[1]===2?"Froyo":a[0]===2&&a[1]>2?"Gingerbread":a[0]===3?"Honeycomb":a[0]===4&&a[1]<1?"Ice Cream Sandwich":a[0]===4&&a[1]<4?"Jelly Bean":a[0]===4&&a[1]>=4?"KitKat":a[0]===5?"Lollipop":a[0]===6?"Marshmallow":a[0]===7?"Nougat":a[0]===8?"Oreo":a[0]===9?"Pie":void 0},o.getVersionPrecision=function(s){return s.split(".").length},o.compareVersions=function(s,a,c){c===void 0&&(c=!1);var l=o.getVersionPrecision(s),u=o.getVersionPrecision(a),d=Math.max(l,u),h=0,f=o.map([s,a],function(g){var m=d-o.getVersionPrecision(g),w=g+new Array(m+1).join(".0");return o.map(w.split("."),function(p){return new Array(20-p.length).join("0")+p}).reverse()});for(c&&(h=d-Math.min(l,u)),d-=1;d>=h;){if(f[0][d]>f[1][d])return 1;if(f[0][d]===f[1][d]){if(d===h)return 0;d-=1}else if(f[0][d]<f[1][d])return-1}},o.map=function(s,a){var c,l=[];if(Array.prototype.map)return Array.prototype.map.call(s,a);for(c=0;c<s.length;c+=1)l.push(a(s[c]));return l},o.find=function(s,a){var c,l;if(Array.prototype.find)return Array.prototype.find.call(s,a);for(c=0,l=s.length;c<l;c+=1){var u=s[c];if(a(u,c))return u}},o.assign=function(s){for(var a,c,l=s,u=arguments.length,d=new Array(u>1?u-1:0),h=1;h<u;h++)d[h-1]=arguments[h];if(Object.assign)return Object.assign.apply(Object,[s].concat(d));var f=function(){var g=d[a];typeof g=="object"&&g!==null&&Object.keys(g).forEach(function(m){l[m]=g[m]})};for(a=0,c=d.length;a<c;a+=1)f();return s},o.getBrowserAlias=function(s){return r.BROWSER_ALIASES_MAP[s]},o.getBrowserTypeByAlias=function(s){return r.BROWSER_MAP[s]||""},o}();e.default=i,t.exports=e.default},18:function(t,e,n){e.__esModule=!0,e.ENGINE_MAP=e.OS_MAP=e.PLATFORMS_MAP=e.BROWSER_MAP=e.BROWSER_ALIASES_MAP=void 0,e.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"},e.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"},e.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},e.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"},e.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}}
34,90:function(t,e,n){e.__esModule=!0,e.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);function s(c,l){for(var u=0;u<l.length;u++){var d=l[u];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(c,d.key,d)}}var a=function(){function c(){}var l,u,d;return c.getParser=function(h,f){if(f===void 0&&(f=!1),typeof h!="string")throw new Error("UserAgent should be a string");return new i.default(h,f)},c.parse=function(h){return new i.default(h).getResult()},l=c,d=[{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}}],(u=null)&&s(l.prototype,u),d&&s(l,d),c}();e.default=a,t.exports=e.default},91:function(t,e,n){e.__esModule=!0,e.default=void 0;var r=c(n(92)),i=c(n(93)),o=c(n(94)),s=c(n(95)),a=c(n(17));function c(u){return u&&u.__esModule?u:{default:u}}var l=function(){function u(h,f){if(f===void 0&&(f=!1),h==null||h==="")throw new Error("UserAgent parameter can't be empty");this._ua=h,this.parsedResult={},f!==!0&&this.parse()}var d=u.prototype;return d.getUA=function(){return this._ua},d.test=function(h){return h.test(this._ua)},d.parseBrowser=function(){var h=this;this.parsedResult.browser={};var f=a.default.find(r.default,function(g){if(typeof g.test=="function")return g.test(h);if(g.test instanceof Array)return g.test.some(function(m){return h.test(m)});throw new Error("Browser's test function is not valid")});return f&&(this.parsedResult.browser=f.describe(this.getUA())),this.parsedResult.browser},d.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},d.getBrowserName=function(h){return h?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},d.getBrowserVersion=function(){return this.getBrowser().version},d.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},d.parseOS=function(){var h=this;this.parsedResult.os={};var f=a.default.find(i.default,function(g){if(typeof g.test=="function")return g.test(h);if(g.test instanceof Array)return g.test.some(function(m){return h.test(m)});throw new Error("Browser's test function is not valid")});return f&&(this.parsedResult.os=f.describe(this.getUA())),this.parsedResult.os},d.getOSName=function(h){var f=this.getOS().name;return h?String(f).toLowerCase()||"":f||""},d.getOSVersion=function(){return this.getOS().version},d.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},d.getPlatformType=function(h){h===void 0&&(h=!1);var f=this.getPlatform().type;return h?String(f).toLowerCase()||"":f||""},d.parsePlatform=function(){var h=this;this.parsedResult.platform={};var f=a.default.find(o.default,function(g){if(typeof g.test=="function")return g.test(h);if(g.test instanceof Array)return g.test.some(function(m){return h.test(m)});throw new Error("Browser's test function is not valid")});return f&&(this.parsedResult.platform=f.describe(this.getUA())),this.parsedResult.platform},d.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},d.getEngineName=function(h){return h?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},d.parseEngine=function(){var h=this;this.parsedResult.engine={};var f=a.default.find(s.default,function(g){if(typeof g.test=="function")return g.test(h);if(g.test instanceof Array)return g.test.some(function(m){return h.test(m)});throw new Error("Browser's test function is not valid")});return f&&(this.parsedResult.engine=f.describe(this.getUA())),this.parsedResult.engine},d.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},d.getResult=function(){return a.default.assign({},this.parsedResult)},d.satisfies=function(h){var f=this,g={},m=0,w={},p=0;if(Object.keys(h).forEach(function(H){var K=h[H];typeof K=="string"?(w[H]=K,p+=1):typeof K=="object"&&(g[H]=K,m+=1)}),m>0){var k=Object.keys(g),_=a.default.find(k,function(H){return f.isOS(H)});if(_){var O=this.satisfies(g[_]);if(O!==void 0)return O}var N=a.default.find(k,function(H){return f.isPlatform(H)});if(N){var U=this.satisfies(g[N]);if(U!==void 0)return U}}if(p>0){var W=Object.keys(w),V=a.default.find(W,function(H){return f.isBrowser(H,!0)});if(V!==void 0)return this.compareVersion(w[V])}},d.isBrowser=function(h,f){f===void 0&&(f=!1);var g=this.getBrowserName().toLowerCase(),m=h.toLowerCase(),w=a.default.getBrowserTypeByAlias(m);return f&&w&&(m=w.toLowerCase()),m===g},d.compareVersion=function(h){var f=[0],g=h,m=!1,w=this.getBrowserVersion();if(typeof w=="string")return h[0]===">"||h[0]==="<"?(g=h.substr(1),h[1]==="="?(m=!0,g=h.substr(2)):f=[],h[0]===">"?f.push(1):f.push(-1)):h[0]==="="?g=h.substr(1):h[0]==="~"&&(m=!0,g=h.substr(1)),f.indexOf(a.default.compareVersions(w,g,m))>-1},d.isOS=function(h){return this.getOSName(!0)===String(h).toLowerCase()},d.isPlatform=function(h){return this.getPlatformType(!0)===String(h).toLowerCase()},d.isEngine=function(h){return this.getEngineName(!0)===String(h).toLowerCase()},d.is=function(h,f){return f===void 0&&(f=!1),this.isBrowser(h,f)||this.isOS(h)||this.isPlatform(h)},d.some=function(h){var f=this;return h===void 0&&(h=[]),h.some(function(g){return f.is(g)})},u}();e.default=l,t.exports=e.default}
vendor: 13,013 bytes, line 34
34,92:function(t,e,n){e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(a){var c={name:"Googlebot"},l=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,a)||i.default.getFirstMatch(o,a);return l&&(c.version=l),c}},{test:[/opera/i],describe:function(a){var c={name:"Opera"},l=i.default.getFirstMatch(o,a)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/opr\/|opios/i],describe:function(a){var c={name:"Opera"},l=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,a)||i.default.getFirstMatch(o,a);return l&&(c.version=l),c}},{test:[/SamsungBrowser/i],describe:function(a){var c={name:"Samsung Internet for Android"},l=i.default.getFirstMatch(o,a)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/Whale/i],describe:function(a){var c={name:"NAVER Whale Browser"},l=i.default.getFirstMatch(o,a)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/MZBrowser/i],describe:function(a){var c={name:"MZ Browser"},l=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,a)||i.default.getFirstMatch(o,a);return l&&(c.version=l),c}},{test:[/focus/i],describe:function(a){var c={name:"Focus"},l=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,a)||i.default.getFirstMatch(o,a);return l&&(c.version=l),c}},{test:[/swing/i],describe:function(a){var c={name:"Swing"},l=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,a)||i.default.getFirstMatch(o,a);return l&&(c.version=l),c}},{test:[/coast/i],describe:function(a){var c={name:"Opera Coast"},l=i.default.getFirstMatch(o,a)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(a){var c={name:"Opera Touch"},l=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,a)||i.default.getFirstMatch(o,a);return l&&(c.version=l),c}},{test:[/yabrowser/i],describe:function(a){var c={name:"Yandex Browser"},l=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,a)||i.default.getFirstMatch(o,a);return l&&(c.version=l),c}},{test:[/ucbrowser/i],describe:function(a){var c={name:"UC Browser"},l=i.default.getFirstMatch(o,a)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/Maxthon|mxios/i],describe:function(a){var c={name:"Maxthon"},l=i.default.getFirstMatch(o,a)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/epiphany/i],describe:function(a){var c={name:"Epiphany"},l=i.default.getFirstMatch(o,a)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/puffin/i],describe:function(a){var c={name:"Puffin"},l=i.default.getFirstMatch(o,a)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/sleipnir/i],describe:function(a){var c={name:"Sleipnir"},l=i.default.getFirstMatch(o,a)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/k-meleon/i],describe:function(a){var c={name:"K-Meleon"},l=i.default.getFirstMatch(o,a)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/micromessenger/i],describe:function(a){var c={name:"WeChat"},l=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,a)||i.default.getFirstMatch(o,a);return l&&(c.version=l),c}},{test:[/qqbrowser/i],describe:function(a){var c={name:/qqbrowserlite/i.test(a)?"QQ Browser Lite":"QQ Browser"},l=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,a)||i.default.getFirstMatch(o,a);return l&&(c.version=l),c}},{test:[/msie|trident/i],describe:function(a){var c={name:"Internet Explorer"},l=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/\sedg\//i],describe:function(a){var c={name:"Microsoft Edge"},l=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/edg([ea]|ios)/i],describe:function(a){var c={name:"Microsoft Edge"},l=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/vivaldi/i],describe:function(a){var c={name:"Vivaldi"},l=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/seamonkey/i],describe:function(a){var c={name:"SeaMonkey"},l=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/sailfish/i],describe:function(a){var c={name:"Sailfish"},l=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,a);return l&&(c.version=l),c}},{test:[/silk/i],describe:function(a){var c={name:"Amazon Silk"},l=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/phantom/i],describe:function(a){var c={name:"PhantomJS"},l=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/slimerjs/i],describe:function(a){var c={name:"SlimerJS"},l=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(a){var c={name:"BlackBerry"},l=i.default.getFirstMatch(o,a)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/(web|hpw)[o0]s/i],describe:function(a){var c={name:"WebOS Browser"},l=i.default.getFirstMatch(o,a)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/bada/i],describe:function(a){var c={name:"Bada"},l=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/tizen/i],describe:function(a){var c={name:"Tizen"},l=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,a)||i.default.getFirstMatch(o,a);return l&&(c.version=l),c}},{test:[/qupzilla/i],describe:function(a){var c={name:"QupZilla"},l=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,a)||i.default.getFirstMatch(o,a);return l&&(c.version=l),c}},{test:[/firefox|iceweasel|fxios/i],describe:function(a){var c={name:"Firefox"},l=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/electron/i],describe:function(a){var c={name:"Electron"},l=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/MiuiBrowser/i],describe:function(a){var c={name:"Miui"},l=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/chromium/i],describe:function(a){var c={name:"Chromium"},l=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,a)||i.default.getFirstMatch(o,a);return l&&(c.version=l),c}},{test:[/chrome|crios|crmo/i],describe:function(a){var c={name:"Chrome"},l=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/GSA/i],describe:function(a){var c={name:"Google Search"},l=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:function(a){var c=!a.test(/like android/i),l=a.test(/android/i);return c&&l},describe:function(a){var c={name:"Android Browser"},l=i.default.getFirstMatch(o,a);return l&&(c.version=l),c}},{test:[/playstation 4/i],describe:function(a){var c={name:"PlayStation 4"},l=i.default.getFirstMatch(o,a);return l&&(c.version=l),c}},{test:[/safari|applewebkit/i],describe:function(a){var c={name:"Safari"},l=i.default.getFirstMatch(o,a);return l&&(c.version=l),c}},{test:[/.*/i],describe:function(a){var c=a.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(c,a),version:i.default.getSecondMatch(c,a)}}}];e.default=s,t.exports=e.default},93:function(t,e,n){e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/Roku\/DVP/],describe:function(a){var c=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,a);return{name:o.OS_MAP.Roku,version:c}}},{test:[/windows phone/i],describe:function(a){var c=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,a);return{name:o.OS_MAP.WindowsPhone,version:c}}},{test:[/windows /i],describe:function(a){var c=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,a),l=i.default.getWindowsVersionName(c);return{name:o.OS_MAP.Windows,version:c,versionName:l}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(a){var c={name:o.OS_MAP.iOS},l=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,a);return l&&(c.version=l),c}},{test:[/macintosh/i],describe:function(a){var c=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,a).replace(/[_\s]/g,"."),l=i.default.getMacOSVersionName(c),u={name:o.OS_MAP.MacOS,version:c};return l&&(u.versionName=l),u}},{test:[/(ipod|iphone|ipad)/i],describe:function(a){var c=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,a).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:c}}},{test:function(a){var c=!a.test(/like android/i),l=a.test(/android/i);return c&&l},describe:function(a){var c=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,a),l=i.default.getAndroidVersionName(c),u={name:o.OS_MAP.Android,version:c};return l&&(u.versionName=l),u}},{test:[/(web|hpw)[o0]s/i],describe:function(a){var c=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,a),l={name:o.OS_MAP.WebOS};return c&&c.length&&(l.version=c),l}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(a){var c=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,a)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,a)||i.default.getFirstMatch(/\bbb(\d+)/i,a);return{name:o.OS_MAP.BlackBerry,version:c}}},{test:[/bada/i],describe:function(a){var c=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,a);return{name:o.OS_MAP.Bada,version:c}}},{test:[/tizen/i],describe:function(a){var c=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,a);return{name:o.OS_MAP.Tizen,version:c}}},{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(a){var c=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,a);return{name:o.OS_MAP.PlayStation4,version:c}}}];e.default=s,t.exports=e.default},94:function(t,e,n){e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(a){var c=i.default.getFirstMatch(/(can-l01)/i,a)&&"Nova",l={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return c&&(l.model=c),l}},{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(a){var c=a.test(/ipod|iphone/i),l=a.test(/like (ipod|iphone)/i);return c&&!l},describe:function(a){var c=i.default.getFirstMatch(/(ipod|iphone)/i,a);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:c}}},{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(a){return a.getBrowserName(!0)==="blackberry"},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(a){return a.getBrowserName(!0)==="bada"},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(a){return a.getBrowserName()==="windows phone"},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(a){var c=Number(String(a.getOSVersion()).split(".")[0]);return a.getOSName(!0)==="android"&&c>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(a){return a.getOSName(!0)==="android"},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(a){return a.getOSName(!0)==="macos"},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(a){return a.getOSName(!0)==="windows"},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(a){return a.getOSName(!0)==="linux"},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(a){return a.getOSName(!0)==="playstation 4"},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(a){return a.getOSName(!0)==="roku"},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];
34e.default=s,t.exports=e.default},95:function(t,e,n){e.__esModule=!0,e.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:function(a){return a.getBrowserName(!0)==="microsoft edge"},describe:function(a){if(/\sedg\//i.test(a))return{name:o.ENGINE_MAP.Blink};var c=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,a);return{name:o.ENGINE_MAP.EdgeHTML,version:c}}},{test:[/trident/i],describe:function(a){var c={name:o.ENGINE_MAP.Trident},l=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:function(a){return a.test(/presto/i)},describe:function(a){var c={name:o.ENGINE_MAP.Presto},l=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:function(a){var c=a.test(/gecko/i),l=a.test(/like gecko/i);return c&&!l},describe:function(a){var c={name:o.ENGINE_MAP.Gecko},l=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(a){var c={name:o.ENGINE_MAP.WebKit},l=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,a);return l&&(c.version=l),c}}];e.default=s,t.exports=e.default}});var nf=vo(tf.exports);const Qe={Initialized:"initialized",DisplayURI:"display_uri",ProviderUpdate:"provider_update",ConnectWithResponse:"connectWithResponse",ConnectionStatus:"connection_status",ServiceStatus:"service_status"};class Ct{constructor({shouldSetOnWindow:e,connectionStream:n,shouldSendMetadata:r=!1,shouldShimWeb3:i,sdkInstance:o}){const s=new k2({connectionStream:n,shouldSendMetadata:r,shouldSetOnWindow:e,shouldShimWeb3:i,autoRequestAccounts:!1}),a=new Proxy(s,{deleteProperty:()=>!0});if(this.provider=a,this.sdkInstance=o,e&&typeof window<"u")try{c=s,window.ethereum=c,window.dispatchEvent(new Event("ethereum#initialized"))}catch(l){G("[Ethereum] Unable to set global provider - window.ethereum may be read-only",l)}var c;if(i&&typeof window<"u")try{(function(l,u=console){let d=!1,h=!1;if(!window.web3){const f="__isMetaMaskShim__";let g={currentProvider:l};Object.defineProperty(g,f,{value:!0,enumerable:!0,configurable:!1,writable:!1}),g=new Proxy(g,{get:(m,w,...p)=>(w!=="currentProvider"||d?w==="currentProvider"||w===f||h||(h=!0,u.error("MetaMask no longer injects web3. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),l.request({method:"metamask_logWeb3ShimUsage"}).catch(k=>{u.debug("MetaMask: Failed to log web3 shim usage.",k)})):(d=!0,u.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(m,w,...p)),set:(...m)=>(u.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(...m))}),Object.defineProperty(window,"web3",{value:g,enumerable:!1,configurable:!0,writable:!0})}})(this.provider)}catch(l){G("[Ethereum] Unable to shim web3 - window.web3 may be read-only",l)}this.provider.on("display_uri",l=>{this.sdkInstance.emit(Qe.DisplayURI,l)}),this.provider.on("_initialized",()=>{const l={chainId:this.provider.getChainId(),isConnected:this.provider.isConnected(),isMetaMask:this.provider.isMetaMask,selectedAddress:this.provider.getSelectedAddress(),networkVersion:this.provider.getNetworkVersion()};this.sdkInstance.emit(Qe.Initialized,l),G("[Ethereum: constructor()] provider initialized",l)})}static init(e){var n;return G("[Ethereum: init()] Initializing Ethereum service"),this.instance=new Ct(e),(n=this.instance)===null||n===void 0?void 0:n.provider}static destroy(){}static getInstance(){var e;if(!(!((e=this.instance)===null||e===void 0)&&e.provider))throw new Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance}static getProvider(){var e;if(!(!((e=this.instance)===null||e===void 0)&&e.provider))throw new Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance.provider}}class Kr{constructor({useDeepLink:e,preferredOpenLink:n,debug:r=!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=n,this.state.debug=r}openDeeplink(e,n,r){return function(i,o,s,a){const{state:c}=i;G(`[PlatfformManager: openDeeplink()] universalLink --> ${o}`),G(`[PlatfformManager: openDeeplink()] deepLink --> ${s}`);try{if(c.preferredOpenLink)return void c.preferredOpenLink(c.useDeeplink?s:o,a);if(G(`[PlatfformManager: openDeeplink()] open link now useDeepLink=${c.useDeeplink} link=${c.useDeeplink?s:o}`),c.useDeeplink)typeof window<"u"&&(window.location.href=s);else if(typeof document<"u"){const l=document.createElement("a");l.href=o,l.target="_self",l.rel="noreferrer noopener",l.click()}}catch(l){console.log("[PlatfformManager: openDeeplink()] can't open link",l)}}(this,e,n,r)}isReactNative(){var e;return this.isNotBrowser()&&typeof window<"u"&&(window==null?void 0:window.navigator)&&((e=window.navigator)===null||e===void 0?void 0:e.product)==="ReactNative"}isMetaMaskInstalled(){return function(){const e=Ct.getProvider()||
34(window==null?void 0:window.ethereum);return G(`[PlatfformManager: isMetaMaskInstalled()] isMetaMask=${e==null?void 0:e.isMetaMask} isConnected=${e==null?void 0:e.isConnected()}`),(e==null?void 0:e.isMetaMask)&&(e==null?void 0:e.isConnected())}()}isDesktopWeb(){return this.isBrowser()&&!this.isMobileWeb()}isMobile(){var e,n;const r=nf.parse(window.navigator.userAgent);return((e=r==null?void 0:r.platform)===null||e===void 0?void 0:e.type)==="mobile"||((n=r==null?void 0:r.platform)===null||n===void 0?void 0:n.type)==="tablet"}isSecure(){return this.isReactNative()||this.isMobileWeb()}isMetaMaskMobileWebView(){return typeof window<"u"&&!!window.ReactNativeWebView&&!!navigator.userAgent.endsWith("MetaMaskMobile")}isMobileWeb(){return this.state.platformType===Fe.MobileWeb}static isNotBrowser(){var e;return typeof window>"u"||!(window!=null&&window.navigator)||Ye!==void 0&&((e=Ye==null?void 0:Ye.navigator)===null||e===void 0?void 0:e.product)==="ReactNative"||(navigator==null?void 0:navigator.product)==="ReactNative"}isNotBrowser(){return Kr.isNotBrowser()}static isBrowser(){return!this.isNotBrowser()}isBrowser(){return Kr.isBrowser()}isNodeJS(){return this.isNotBrowser()&&!this.isReactNative()}isUseDeepLink(){return this.state.useDeeplink}getPlatformType(){return function(e){const{state:n}=e;return n.platformType?n.platformType:e.isReactNative()?Fe.ReactNative:e.isNotBrowser()?Fe.NonBrowser:e.isMetaMaskMobileWebView()?Fe.MetaMaskMobileWebview:e.isMobile()?Fe.MobileWeb:Fe.DesktopWeb}(this)}}const rf=t=>X(void 0,void 0,void 0,function*(){if(Kr.isBrowser()){const{StorageManagerWeb:n}=yield Promise.resolve().then(function(){return Q2});return new n(t)}const e={persistChannelConfig:()=>X(void 0,void 0,void 0,function*(){}),getPersistedChannelConfig:()=>X(void 0,void 0,void 0,function*(){}),persistAccounts:()=>X(void 0,void 0,void 0,function*(){}),getCachedAccounts:()=>X(void 0,void 0,void 0,function*(){return[]}),persistChainId:()=>X(void 0,void 0,void 0,function*(){}),getCachedChainId:()=>X(void 0,void 0,void 0,function*(){}),terminate:()=>X(void 0,void 0,void 0,function*(){})};return Promise.resolve(e)});
34class k2 extends _2{constructor({connectionStream:e,shouldSendMetadata:n,autoRequestAccounts:r=!1}){super(e,{logger:console,maxEventListeners:100,shouldSendMetadata:n}),this.state={accounts:null,autoRequestAccounts:!1,providerStateRequested:!1,chainId:"",networkVersion:""},G(`[SDKProvider: constructor()] autoRequestAccounts=${r}`),this.state.autoRequestAccounts=r}forceInitializeState(){return X(this,void 0,void 0,function*(){return G(`[SDKProvider: forceInitializeState()] autoRequestAccounts=${this.state.autoRequestAccounts}`),this._initializeStateAsync()})}_setConnected(){G("[SDKProvider: _setConnected()] Setting connected state"),this._state.isConnected=!0}getState(){return this._state}getSDKProviderState(){return this.state}getSelectedAddress(){var e;const{accounts:n}=this._state;return n&&n.length!==0?((e=n[0])===null||e===void 0?void 0:e.toLowerCase())||"":(G("[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,n){return this._handleAccountsChanged(e,n)}handleDisconnect({terminate:e=!1}){(function({terminate:n=!1,instance:r}){const{state:i}=r;G(`[SDKProvider: handleDisconnect()] cleaning up provider state terminate=${n}`,r),n&&(r._state.accounts=null,r._state.isUnlocked=!1,r._state.isPermanentlyDisconnected=!0,r._state.initialized=!1),r._handleAccountsChanged([]),r._state.isConnected=!1,r.emit("disconnect",Jh.ethErrors.provider.disconnected()),i.providerStateRequested=!1})({terminate:e,instance:this})}_initializeStateAsync(){return X(this,void 0,void 0,function*(){return function(e){var n,r;return X(this,void 0,void 0,function*(){e.state===void 0&&(e.state={accounts:null,autoRequestAccounts:!1,providerStateRequested:!1,chainId:""});const{state:i}=e;let o;if(i.providerStateRequested)G("[SDKProvider: initializeStateAsync()] initialization already in progress");else{let s;i.providerStateRequested=!0;let a=null,c=!1,l=!1;const u=yield rf({enabled:!0});if(u){const d=yield u.getPersistedChannelConfig({});c=(n=d==null?void 0:d.relayPersistence)!==null&&n!==void 0&&n,s=yield u.getCachedChainId();const h=yield u.getCachedAccounts();h.length>0&&(a=h[0])}if(G(`[SDKProvider: initializeStateAsync()] relayPersistence=${c}`,{relayPersistence:c,cachedChainId:s,cachedSelectedAddress:a}),c)if(s&&a)o={accounts:[a],chainId:s,isUnlocked:!1},l=!0;else try{o=yield e.request({method:"metamask_getProviderState"})}catch(d){return e._log.error("MetaMask: Failed to get initial state. Please report this bug.",d),void(i.providerStateRequested=!1)}if(((r=o==null?void 0:o.accounts)===null||r===void 0?void 0:r.length)===0)if(e.getSelectedAddress())o.accounts=[e.getSelectedAddress()];else{G("[SDKProvider: initializeStateAsync()] Fetch accounts remotely.");const d=yield e.request({method:"eth_requestAccounts",params:[]});o.accounts=d}e._initializeState(o),i.providerStateRequested=!1,l&&(e._state.isConnected=!0,e.emit("connect",{chainId:o==null?void 0:o.chainId}))}})}(this)})}_initializeState(e){return G("[SDKProvider: _initializeState()]",e),function(n,r,i){return G("[SDKProvider: initializeState()] set state._initialized to false"),n._state.initialized=!1,r(i)}(this,super._initializeState.bind(this),e)}_handleChainChanged({chainId:e,networkVersion:n}={}){this.state.chainId=e,this.state.networkVersion=n,function({instance:r,chainId:i,networkVersion:o,superHandleChainChanged:s}){G(`[SDKProvider: handleChainChanged()] chainId=${i} networkVersion=${o}`);let a=o;o||(G("[SDKProvider: handleChainChanged()] forced network version to prevent provider error"),a="1"),r._state.isConnected=!0,r.emit("connect",{chainId:i}),s({chainId:i,networkVersion:a})}({instance:this,chainId:e,networkVersion:n,superHandleChainChanged:super._handleChainChanged.bind(this)})}}var Ur,$n={name:"@metamask/sdk",version:"0.32.0",description:"",homepage:"https://github.com/MetaMask/metamask-sdk#readme",bugs:{url:"https://github.com/MetaMask/metamask-sdk/issues"},repository:{type:"git",url:"https://github.com/MetaMask/metamask-sdk",directory:"packages/sdk"},main:"dist/node/cjs/metamask-sdk.js",module:"dist/browser/es/metamask-sdk.js",browser:"dist/browser/es/metamask-sdk.js",unpkg:"dist/browser/umd/metamask-sdk.js","react-native":"dist/react-native/es/metamask-sdk.js",types:"dist/types/src/index.d.ts",sideEffects:!1,files:["/dist"],scripts:{"build:types":"tsc --project tsconfig.build.json --emitDeclarationOnly --outDir dist/types",build:"yarn build:types && rollup -c --bundleConfigAsCjs","build:clean":"yarn clean && yarn build","build:post-tsc":"echo 'N/A'","build:pre-tsc":"echo 'N/A'",typecheck:"tsc --noEmit",clean:"rimraf ./dist",size:"node bundle-size && size-limit",lint:"yarn lint:eslint && yarn lint:misc --check","lint:changelog":"../../scripts/validate-changelog.sh @metamask/sdk","lint:eslint":"eslint . --cache --ext js,ts","lint:fix":"yarn lint:eslint --fix && yarn lint:misc --write","lint:misc":"prettier '**/*.json' '**/*.md' '!CHANGELOG.md' --ignore-path ../../.gitignore",prepack:"../../scripts/prepack.sh","publish:preview":"yarn npm publish --tag preview",reset:"yarn clean && rimraf ./node_modules/",test:'jest --testPathIgnorePatterns "/e2e/"',"test:coverage":'jest --coverage --testPathIgnorePatterns "/e2e/"',"test:e2e":'jest --testPathPattern "/e2e/"',"test:ci":'jest --coverage --passWithNoTests --setupFilesAfterEnv ./jest-preload.js --testPathIgnorePatterns "/e2e/"',"test:dev":'jest -c ./jest.config.ts --detectOpenHandles --testPathIgnorePatterns "/e2e/"',watch:"rollup -c -w",dev:'concurrently "tsc --watch" "rollup -c -w --bundleConfigAsCjs"',"build:dev":"yarn build:types && NODE_ENV=dev rollup -c --bundleConfigAsCjs"},dependencies:{"@babel/runtime":"^7.26.0","@metamask/onboarding":"^1.0.1","@metamask/providers":"16.1.0","@metamask/sdk-communication-layer":"workspace:*","@metamask/sdk-install-modal-web":"workspace:*","@paulmillr/qr":"^0.2.1",bowser:"^2.9.0","cross-fetch":"^4.0.0",debug:"^4.3.4",eciesjs:"^0.4.11","eth-rpc-errors":"^4.0.3",eventemitter2:"^6.4.9","obj-multiplex":"^1.0.0",pump:"^3.0.0","readable-stream":"^3.6.2","socket.io-client":"^4.5.1",tslib:"^2.6.0",util:"^0.12.4",uuid:"^8.3.2"},devDependencies:{"@jest/globals":"^29.3.1","@lavamoat/allow-scripts":"^2.3.1","@metamask/auto-changelog":"3.1.0","@metamask/eslint-config":"^6.0.0","@metamask/eslint-config-nodejs":"^6.0.0","@metamask/eslint-config-typescript":"^6.0.0","@react-native-async-storage/async-storage":"^1.19.6","@rollup/plugin-alias":"^5.1.1","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-json":"^6.0.0","@rollup/plugin-node-resolve":"^15.0.2","@rollup/plugin-replace":"^6.0.1","@rollup/plugin-terser":"^0.4.1","@size-limit/preset-big-lib":"^11.0.2","@types/dom-screen-wake-lock":"^1.0.2","@types/node":"^20.1.3","@types/pump":"^1.1.1","@types/qrcode-terminal":"^0.12.0","@types/uuid":"^10.0.0","@typescript-eslint/eslint-plugin":"^4.26.0","@typescript-eslint/parser":"^4.26.0","browserify-zlib":"^0.2.0",buffer:"^6.0.3",concurrently:"^9.1.2","crypto-browserify":"^3.12.0",eslint:"^7.30.0","eslint-config-prettier":"^8.3.0","eslint-plugin-import":"^2.23.4","eslint-plugin-jest":"^24.4.0","eslint-plugin-jsdoc":"^36.1.0","eslint-plugin-node":"^11.1.0","eslint-plugin-
34prettier":"^3.4.0","https-browserify":"^1.0.0",jest:"^29.3.1","jest-environment-jsdom":"^29.3.1",prettier:"^2.3.0",process:"^0.11.10",rimraf:"^4.4.0",rollup:"^4.26.0","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-jscc":"^2.0.0","rollup-plugin-natives":"^0.7.5","rollup-plugin-node-builtins":"^2.1.2","rollup-plugin-polyfill-node":"^0.13.0","rollup-plugin-sizes":"^1.0.6","rollup-plugin-typescript2":"^0.31.2","rollup-plugin-visualizer":"^5.12.0","size-limit":"^11.0.2","stream-browserify":"^3.0.0","stream-http":"^3.2.0","ts-jest":"^29.0.3","ts-node":"^10.9.1",typescript:"^4.3.2",url:"^0.11.0",webpack:"^5.0.0"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},lavamoat:{allowScripts:{"eciesjs>secp256k1":!1,"socket.io-client>engine.io-client>ws>bufferutil":!1,"socket.io-client>engine.io-client>ws>utf-8-validate":!1,"@metamask/sdk-communication-layer>bufferutil":!1,"@metamask/sdk-communication-layer>eciesjs>secp256k1":!1,"@metamask/sdk-communication-layer>utf-8-validate":!1}}};(function(t){t.INPAGE="metamask-inpage",t.CONTENT_SCRIPT="metamask-contentscript",t.PROVIDER="metamask-provider"})(Ur||(Ur={}));const Kl="direct",Hr="https://metamask.app.link/connect",Fr="metamask://connect",Ul={NAME:"MetaMask",RDNS:["io.metamask","io.metamask.flask"]},x2=/(?:^[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,ue={METAMASK_GETPROVIDERSTATE:"metamask_getProviderState",METAMASK_CONNECTSIGN:"metamask_connectSign",METAMASK_CONNECTWITH:"metamask_connectWith",METAMASK_OPEN:"metamask_open",METAMASK_BATCH:"metamask_batch",PERSONAL_SIGN:"personal_sign",WALLET_REQUESTPERMISSIONS:"wallet_requestPermissions",WALLET_REVOKEPERMISSIONS:"wallet_revokePermissions",WALLET_GETPERMISSIONS:"wallet_getPermissions",WALLET_WATCHASSET:"wallet_watchAsset",WALLET_ADDETHEREUMCHAIN:"wallet_addEthereumChain",WALLET_SWITCHETHETHEREUMCHAIN:"wallet_switchEthereumChain",ETH_REQUESTACCOUNTS:"eth_requestAccounts",ETH_ACCOUNTS:"eth_accounts",ETH_CHAINID:"eth_chainId",ETH_SENDTRANSACTION:"eth_sendTransaction",ETH_SIGNTYPEDDATA:"eth_signTypedData",ETH_SIGNTYPEDDATA_V3:"eth_signTypedData_v3",ETH_SIGNTYPEDDATA_V4:"eth_signTypedData_v4",ETH_SIGNTRANSACTION:"eth_signTransaction",ETH_SIGN:"eth_sign",PERSONAL_EC_RECOVER:"personal_ecRecover"},co={[ue.ETH_REQUESTACCOUNTS]:!0,[ue.ETH_SENDTRANSACTION]:!0,[ue.ETH_SIGNTRANSACTION]:!0,[ue.ETH_SIGN]:!0,[ue.PERSONAL_SIGN]:!0,[ue.ETH_ACCOUNTS]:!1,[ue.ETH_CHAINID]:!1,[ue.PERSONAL_SIGN]:!0,[ue.ETH_SIGNTYPEDDATA]:!0,[ue.ETH_SIGNTYPEDDATA_V3]:!0,[ue.ETH_SIGNTYPEDDATA_V4]:!0,[ue.WALLET_REQUESTPERMISSIONS]:!0,[ue.WALLET_GETPERMISSIONS]:!0,[ue.WALLET_WATCHASSET]:!0,[ue.WALLET_ADDETHEREUMCHAIN]:!0,[ue.WALLET_SWITCHETHETHEREUMCHAIN]:!0,[ue.METAMASK_CONNECTSIGN]:!0,[ue.METAMASK_CONNECTWITH]:!0,[ue.PERSONAL_EC_RECOVER]:!0,[ue.METAMASK_BATCH]:!0,[ue.METAMASK_OPEN]:!0},A2=Object.keys(co).map(t=>t.toLowerCase()),of=["eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sign"].map(t=>t.toLowerCase()),gs=".sdk-comm",lo="providerType",Ys=".MMSDK_cached_address",Zs=".MMSDK_cached_chainId",kt={CHAIN_CHANGED:"chainChanged",ACCOUNTS_CHANGED:"accountsChanged",DISCONNECT:"disconnect",CONNECT:"connect",CONNECTED:"connected"},M2=1e6;var Dt;(function(t){t.TERMINATE="terminate",t.EXTENSION="extension",t.INITIALIZED="initialized"})(Dt||(Dt={}));const T2=typeof window<"u"&&window.localStorage;function R2({instance:t,msg:e}){return X(this,void 0,void 0,function*(){if(t._initialized||(G("[MetaMaskSDK: connectAndSign()] provider not ready -- wait for init()"),yield t.init()),G(`[MetaMaskSDK: connectAndSign()] activeProvider=${t.activeProvider}`),!t.activeProvider)throw new Error("SDK state invalid -- undefined provider");const n=/^0x([0-9A-Fa-f]{2})*$/u.test(e)?e:function(r){let i;if(J!==void 0)i=J.from(r,"utf8").toString("hex");else if(typeof TextEncoder<"u"){const o=new TextEncoder().encode(r);i=Array.from(o).map(s=>s.toString(16).padStart(2,"0")).join("")}else{if(typeof Ye!="object"||!("Buffer"in Ye))throw new Error("Unable to convert string to hex: No available method.");i=Ye.Buffer.from(r,"utf8").toString("hex")}return`0x${i}`}(e);return t.activeProvider.request({method:ue.METAMASK_CONNECTWITH,params:[{method:ue.PERSONAL_SIGN,params:[n]}]})})}function Hl(t){var e,n;return X(this,void 0,void 0,function*(){G("[MetaMaskSDK: connectWithExtensionProvider()] ",t),t.sdkProvider=t.activeProvider,t.activeProvider=window.extension,window.ethereum=window.extension;try{const r=yield(e=window.extension)===null||e===void 0?void 0:e.request({method:"eth_requestAccounts"});G(`[MetaMaskSDK: connectWithExtensionProvider()] accounts=${r}`)}catch(r){return void console.warn("[MetaMaskSDK: connectWithExtensionProvider()] can't request accounts error",r)}localStorage.setItem(lo,"extension"),t.extensionActive=!0,t.emit(Qe.ProviderUpd
34ate,Dt.EXTENSION),t.options.enableAnalytics&&((n=t.analytics)===null||n===void 0||n.send({event:Te.SDK_USE_EXTENSION}))})}function uo(t){let e;if(J!==void 0)e=J.from(t,"utf8").toString("base64");else if(typeof btoa=="function")e=btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/gu,(n,r)=>String.fromCharCode(parseInt(r,16))));else{if(typeof Ye!="object"||!("Buffer"in Ye))throw new Error("Unable to base64 encode: No available method.");e=Ye.Buffer.from(t,"utf8").toString("base64")}return e}function O2(t,e,n,r){var i,o,s,a,c,l,u,d,h,f,g,m,w,p,k,_,O,N,U,W;return X(this,void 0,void 0,function*(){const V=(i=t.state.remote)===null||i===void 0?void 0:i.isReady(),H=(o=t.state.remote)===null||o===void 0?void 0:o.isConnected(),K=(s=t.state.remote)===null||s===void 0?void 0:s.isPaused(),Y=Ct.getProvider(),j=(a=t.state.remote)===null||a===void 0?void 0:a.getChannelId(),B=(c=t.state.remote)===null||c===void 0?void 0:c.isAuthorized(),{deeplinkProtocol:R}=t.state,{method:C,data:L,triggeredInstaller:$}=(M=>{var b,v,S,x;let T;J.isBuffer(M)?(T=M.toJSON(),T._isBuffer=!0):T=M;const I=(b=T==null?void 0:T.data)===null||b===void 0?void 0:b.method;let D=!1;return typeof((v=T==null?void 0:T.data)===null||v===void 0?void 0:v.params)=="object"&&((x=(S=T==null?void 0:T.data)===null||S===void 0?void 0:S.params)===null||x===void 0?void 0:x.__triggeredInstaller)===!0&&(D=!0,T.data.params=T.data.params.wrappedParams),{method:I,data:T,triggeredInstaller:D}})(e);if(G(`[RCPMS: write()] method='${C}' isRemoteReady=${V} channelId=${j} isSocketConnected=${H} isRemotePaused=${K} providerConnected=${Y.isConnected()}`,e),!j)return C!==ue.METAMASK_GETPROVIDERSTATE&&G(`[RCPMS: write()] ${C} --> channelId is undefined`),r(new Error("disconnected"));G(`[RCPMS: write()] remote.isPaused()=${(l=t.state.remote)===null||l===void 0?void 0:l.isPaused()} authorized=${B} ready=${V} socketConnected=${H}`,e);const y=(u=t.state.platformManager)===null||u===void 0?void 0:u.isSecure(),E=(h=(d=t.state.platformManager)===null||d===void 0?void 0:d.isMobileWeb())!==null&&h!==void 0&&h,A=(g=(f=t.state.remote)===null||f===void 0?void 0:f.hasDeeplinkProtocol())!==null&&g!==void 0&&g&&E&&B;try{if(!$){const v=JSON.stringify(L==null?void 0:L.data);if(v.length>M2)return r(new Error(`Message size ${v.length} exceeds maximum allowed size of 1000000 bytes`));(m=t.state.remote)===null||m===void 0||m.sendMessage(L==null?void 0:L.data).then(()=>{G(`[RCPMS: _write()] ${C} sent successfully`)}).catch(S=>{G("[RCPMS: _write()] error sending message",S)})}if(!y)return G(`[RCPMS: _write()] unsecure platform for method ${C} -- return callback`),r();if($)return G("[RCPMS: _write()] prevent deeplink -- installation completed separately."),r();const M=(k=(p=(w=t.state.remote)===null||w===void 0?void 0:w.getKeyInfo())===null||p===void 0?void 0:p.ecies.public)!==null&&k!==void 0?k:"";let b=encodeURI(`channelId=${j}&pubkey=${M}&comm=socket&t=d&v=2`);if(A){const v=JSON.stringify(L==null?void 0:L.data),S=(_=t.state.remote)===null||_===void 0?void 0:_.encrypt(v);if(!S)return G("[RCPMS: _write()] error encrypting message"),r(new Error("RemoteCommunicationPostMessageStream - disconnected"));b+=`&scheme=${R}&rpc=${uo(S)}`}if(!(!((O=t.state.platformManager)===null||O===void 0)&&O.isMetaMaskInstalled()))return G("[RCPMS: _write()] prevent deeplink until installation is completed."),r();co[C]?(G(`[RCPMS: _write()] redirect link for '${C}' socketConnected=${H} connect?${b}`),(N=t.state.platformManager)===null||N===void 0||N.openDeeplink(`${Hr}?${b}`,`${Fr}?${b}`,"_self")):!((U=t.state.remote)===null||U===void 0)&&U.isPaused()?(G(`[RCPMS: _write()] MM is PAUSED! deeplink with connect! targetMethod=${C}`),(W=t.state.platformManager)===null||W===void 0||W.openDeeplink(`${Hr}?redirect=true&${b}`,`${Fr}?redirect=true&${b}`,"_self")):G(`[RCPMS: _write()] method ${C} doesn't need redirect.`)}catch(M){return G("[RCPMS: _write()] error sending message",M),r(new Error("RemoteCommunicationPostMessageStream - disconnected"))}return r()})}class L2 extends sr.Duplex{constructor({name:e,remote:n,deeplinkProtocol:r,platformManager:i}){super({objectMode:!0}),this.state={_name:null,remote:null,deeplinkProtocol:!1,platformManager:null},this.state._name=e,this.state.remote=n,this.state.deeplinkProtocol=r,this.state.platformManager=i,this._onMessage=this._onMessage.bind(this),this.state.remote.on(te.MESSAGE,this._onMessage)}_write(e,n,r){return X(this,void 0,void 0,function*(){return O2(this,e,0,r)})}_read(){}_onMessage(e){return function(n,r){try{if(G("[RCPMS: onMessage()] message",r),!r||typeof r!="object"||typeof(r==null?void 0:r.data)!="object")return;if(!(r!=null&&r.name))return void G("[RCPMS: onMessage()] ignore message without name",r);if((r==null?void 0:r.name)!==Ur.PROVIDER)return void G(`[RCPMS: onMessage()] ignore message with wrong name message=${r}`);if(J.isBuffer(r)){const i=J.from(r);n.push(i)}else n.push(r)}catch(i){G(`[RCPMS: onMessage()] ignore message error err=${i}`)}}(this,e)}start(){}}
34let Fl=1;const sf=t=>new Promise(e=>{setTimeout(()=>{e(!0)},t)}),P2=({checkInstallationOnAllCalls:t=!1,communicationLayerPreference:e,injectProvider:n,shouldShimWeb3:r,platformManager:i,installer:o,sdk:s,remoteConnection:a,debug:c})=>X(void 0,void 0,void 0,function*(){var l,u;const d=(({name:K,remoteConnection:Y})=>{if(!Y||!(Y!=null&&Y.getConnector()))throw new Error("Missing remote connection parameter");return new L2({name:K,remote:Y==null?void 0:Y.getConnector(),deeplinkProtocol:Y==null?void 0:Y.state.deeplinkProtocol,platformManager:Y==null?void 0:Y.getPlatformManager()})})({name:Ur.INPAGE,target:Ur.CONTENT_SCRIPT,platformManager:i,communicationLayerPreference:e,remoteConnection:a}),h=i.getPlatformType(),f=s.options.dappMetadata,g=`Sdk/Javascript SdkVersion/${$n.version} Platform/${h} dApp/${(l=f.url)!==null&&l!==void 0?l:f.name} dAppTitle/${f.name}`;let m=null,w=null;const p=(u=s.options.storage)===null||u===void 0?void 0:u.storageManager;if(p){try{const K=yield p.getCachedAccounts();K.length>0&&(m=K[0])}catch(K){console.error(`[initializeMobileProvider] failed to get cached addresses: ${K}`)}try{const K=yield p.getCachedChainId();K&&(w=K)}catch(K){console.error(`[initializeMobileProvider] failed to parse cached chainId: ${K}`)}}G(`[initializeMobileProvider] cachedAccountAddress: ${m}, cachedChainId: ${w}`);const k=!(!n||h===Fe.NonBrowser||h===Fe.ReactNative),_=Ct.init({shouldSetOnWindow:k,connectionStream:d,shouldShimWeb3:r,sdkInstance:s});let O=!1;const N=K=>{O=K},U=()=>O,W=(K,Y,j,B)=>X(void 0,void 0,void 0,function*(){var R,C,L,$,y,E,A,M,b;const v=Ct.getProvider();if(O){v.emit("display_uri",(a==null?void 0:a.state.qrcodeLink)||""),a==null||a.showActiveModal();let Q=U();for(;Q;){const ne=U(),se=a==null?void 0:a.isAuthorized();Q=ne&&!se,G(`[initializeMobileProvider: sendRequest()] waiting for initialization to complete - initializing: ${ne} authorized: ${se}`),yield sf(1e3)}return G("[initializeMobileProvider: sendRequest()] initial method completed -- prevent installation and call provider"),j(...Y)}const S=i.isMetaMaskInstalled(),x=a==null?void 0:a.isConnected();let T=null,I=null,D=null;if(T=(R=v.getSelectedAddress())!==null&&R!==void 0?R:m,D=v.getChainId()||w,T&&p&&T!==m&&p.persistAccounts([T]).catch(Q=>{console.error(`[initializeMobileProvider] failed to persist account: ${Q}`)}),D&&(w=D,p&&p.persistChainId(D).catch(Q=>{console.error(`[initializeMobileProvider] failed to persist chainId: ${Q}`)})),G("[initializeMobileProvider: sendRequest()]",{selectedAddress:T,chainId:D}),B&&G(`[initializeMobileProvider: sendRequest()] method=${K} ongoing=${O} selectedAddress=${T} isInstalled=${S} checkInstallationOnAllCalls=${t} socketConnected=${x}`),T&&K.toLowerCase()===ue.ETH_ACCOUNTS.toLowerCase())return[T];if(D&&K.toLowerCase()===ue.ETH_CHAINID.toLowerCase())return D;const F=[ue.ETH_REQUESTACCOUNTS,ue.WALLET_REQUESTPERMISSIONS,ue.METAMASK_CONNECTSIGN,ue.METAMASK_CONNECTWITH],z=!co[K],Z=(C=s.options.readonlyRPCMap)===null||C===void 0?void 0:C[D];if(Z&&z)try{const Q=(L=Y==null?void 0:Y[0])===null||L===void 0?void 0:L.params,ne=yield(({rpcEndpoint:se,method:le,sdkInfo:re,params:ie})=>X(void 0,void 0,void 0,function*(){const ce=JSON.stringify({jsonrpc:"2.0",method:le,params:ie,id:(Fl+=1,Fl)}),ae={Accept:"application/json","Content-Type":"application/json"};let me;se.includes("infura")&&(ae["Metamask-Sdk-Info"]=re);try{me=yield bu(se,{method:"POST",headers:ae,body:ce})}catch(Ee){throw Ee instanceof Error?new Error(`Failed to fetch from RPC: ${Ee.message}`):new Error(`Failed to fetch from RPC: ${Ee}`)}if(!me.ok)throw new Error(`Server responded with a status of ${me.status}`);return(yield me.json()).result}))({rpcEndpoint:Z,sdkInfo:g,method:K,params:Q||[]});return B&&G(`initializeProvider::ReadOnlyRPCResponse ${ne}`),ne}catch(Q){console.warn(`[initializeMobileProvider: sendRequest()] method=${K} readOnlyRPCRequest failed:`,Q)}if((!S||S&&!x)&&K!==ue.METAMASK_GETPROVIDERSTATE){const Q=(($=Y==null?void 0:Y[0])===null||$===void 0?void 0:$.params)||[];if(F.indexOf(K)!==-1||t){N(!0);const ne=K===ue.METAMASK_CONNECTWITH,se=`${Date.now()}`;try{yield o.start({wait:!1,connectWith:ne?{method:K,id:se,params:Q}:void 0}),yield new Promise((le,re)=>{a!=null&&a.isAuthorized()&&(G("[initializeMobileProvider: sendRequest()] already authorized"),le(!0)),a==null||a.getConnector().once(te.AUTHORIZED,()=>{le(!0)}),s.once(te.PROVIDER_UPDATE,ie=>{G(`[initializeMobileProvider: sendRequest()] PROVIDER_UPDATE --- remote provider request interupted type=${ie}`),ie===Dt.EXTENSION?re(te.PROVIDER_UPDATE):re(new Error("Connection Terminated"))})})}catch(le){if(Dt.EXTENSION===le){if(G(`[initializeMobileProvider: sendRequest()] extension provider detect: re-create ${K} on the active provider`),K.toLowerCase()===ue.METAMASK_CONNECTSIGN.toLowerCase()){const re=yield(y=s.getProvider())===null||y===void 0?void 0:y.request({method:ue.ETH_REQUESTACCOUNTS,params:[]});if(!re.length)throw new Error("SDK state invalid -- undefined accounts");const ie=yield(E=s.getProvider())===null||E===void 0?void 0:E.request({method:ue.PERSONAL_SIGN,params:[Q[0],re[0]]});return s.emit(Qe.ConnectWithResponse,ie),ie}if(K.toLowerCase()===ue.METAMASK_CONNECTWITH.toLowerCase()){const[re]=Q,ie=yield(({method:ce,sdk:ae,params:me})=>X(void 0,void 0,void 0,function*(){var Ee,de,ge,ve;if(!ae.isExtensionActive())throw new Error("SDK state invalid -- extension is not active");G("[MetaMaskProvider: extensionConnectWithOverwrite()] Overwriting request method",ce,me);const Oe=yield(Ee=ae.getProvider())===null||Ee===void 0?void 0:Ee.request({method:ue.ETH_REQUESTACCOUNTS,params:[]});if(!Oe.length)throw new Error("SDK state invalid -- undefined accounts");if((ce==null?void 0:ce.toLowerCase())===ue.PERSONAL_SIGN.toLowerCase()){const ct={method:ce,params:[me[0],Oe[0]]};return yield(de=ae.getProvider())===null||de===void 0?void 0:de.request(ct)}if((ce==null?void 0:ce.toLowerCase())===ue.ETH_SENDTRANSACTION.toLowerCase()){const ct={method:ce,params:[Object.assign(Object.assign({},me[0]),{from:Oe[0]})]};return yield(ge=ae.getProvider())===null||ge===void 0?void 0:ge.request(ct)}return of.includes(ce.toLowerCase())?(console.warn(`MetaMaskSDK connectWith method=${ce} -- not handled by the extension -- call separately`),Oe):yield(ve=ae.getProvider())===null||ve===void 0?void 0:ve.request({method:ce,params:me})}))({method:re.method,sdk:s,params:re.params});return s.emit(Qe.ConnectWithResponse,ie),ie}return G(`[initializeMobileProvider: sendRequest()] sending '${K}' on active provider`,Q),yield(A=s.getProvider())===null||A===void 0?void 0:A.request({method:K,params:Q})}throw le===te.REJECTED?(a==null||a.closeModal(),(M=s.getProvider())===null||M===void 0||M.handleDisconnect({terminate:!1}),Object.assign(new Error("User rejected connection"),{code:4001})):(G(`[initializeMobileProvider: sendRequest()] failed to start installer: ${le}`),le)}finally{N(!1)}
34if(K===ue.ETH_REQUESTACCOUNTS)return I=yield new Promise(le=>{const re=setInterval(()=>{const{accounts:ie}=v.getState();ie&&(clearInterval(re),le(ie))},100)}),G(`[initializeMobileProvider: sendRequest()] selectedAddress: ${T} --- SKIP rpc call`),I;if(K===ue.METAMASK_CONNECTWITH)try{let le=0;const re=5,ie=({resolve:Ee,reject:de})=>{le+=1;const ge=a==null?void 0:a.getConnector().getRPCMethodTracker(),ve=ge==null?void 0:ge[se];return G(`TRACKER: update method ${se}`,ve),ve!=null&&ve.result?(G("[initializeMobileProvider: sendRequest()] found result",ve.result),s.emit(Qe.ConnectWithResponse,ve.result),void Ee(ve.result)):ve!=null&&ve.error?(G("[initializeMobileProvider: sendRequest()] found error",ve.error),void de(ve.error)):le>=re?(G("[initializeMobileProvider: sendRequest()] max message count reached without result"),void de(new Error("Max message count reached without result"))):void G("[initializeMobileProvider: sendRequest()] not found yet, need to wait for next update")};let ce,ae;const me=yield new Promise((Ee,de)=>{const ge=a==null?void 0:a.getConnector().getRPCMethodTracker();G(`TRACKER: method ${se}`,ge),ge!=null&&ge[se].result?(G("[initializeMobileProvider: sendRequest()] found result",ge==null?void 0:ge[se].result),Ee(ge==null?void 0:ge[se].result)):ge!=null&&ge[se].error&&(G("[initializeMobileProvider: sendRequest()] found error",ge==null?void 0:ge[se].error),de(ge==null?void 0:ge[se].error)),ae=()=>ie({resolve:Ee,reject:de}),ce=a==null?void 0:a.getConnector().on(te.RPC_UPDATE,ae)});return ae&&(ce==null||ce.off(te.RPC_UPDATE,ae)),G("TRACKER: result",me),me}catch(le){throw G("[initializeMobileProvider: sendRequest()] error:",le),le}return Y[0]&&typeof Y[0]=="object"&&(Y[0].params={__triggeredInstaller:!0,wrappedParams:Y[0].params}),j(...Y)}if(i.isSecure()&&co[K])return j(...Y);if(s.isExtensionActive())return G(`[initializeMobileProvider: sendRequest()] EXTENSION active - redirect request '${K}' to it`,Y,Q),yield(b=s.getProvider())===null||b===void 0?void 0:b.request({method:K,params:Q});throw G(`[initializeMobileProvider: sendRequest()] method=${K} --- skip --- not connected/installed`),new Error("MetaMask is not connected/installed, please call eth_requestAccounts to connect first.")}try{const Q=yield j(...Y);if(G(`[initializeMobileProvider: sendRequest()] method=${K} rpcResponse`,Q),K===ue.WALLET_REQUESTPERMISSIONS){const ne=Q.reduce((se,le)=>{var re;if(le.parentCapability==="eth_accounts"){const ie=(re=le.caveats.find(ce=>ce.type==="restrictReturnedAccounts"))===null||re===void 0?void 0:re.value;ie&&se.push(...ie)}return se},[]);G("[initializeMobileProvider: sendRequest()] accountsToPersist:",ne),ne.length>0&&(v.handleAccountsChanged(ne,!1),p==null||p.persistAccounts(ne))}return Q}catch(Q){throw console.error("[initializeMobileProvider: sendRequest()] error:",Q),Q}}),{request:V}=_;_.request=(...K)=>X(void 0,void 0,void 0,function*(){return W(K==null?void 0:K[0].method,K,V,c)});const{send:H}=_;return _.send=(...K)=>X(void 0,void 0,void 0,function*(){return W(K==null?void 0:K[0],K,H,c)}),G("[initializeMobileProvider: sendRequest()] metamaskStream.start()"),d.start(),_});function I2(t){var e,n,r,i;return X(this,void 0,void 0,function*(){const{options:o}=t,s={communicationLayerPreference:(e=o.communicationLayerPreference)!==null&&e!==void 0?e:Pn.SOCKET,platformManager:t.platformManager,sdk:t,checkInstallationOnAllCalls:o.checkInstallationOnAllCalls,injectProvider:(n=o.injectProvider)===null||n===void 0||n,shouldShimWeb3:(r=o.shouldShimWeb3)===null||r===void 0||r,extensionOnly:(i=o.extensionOnly)===null||i===void 0||i,installer:t.installer,remoteConnection:t.remoteConnection,debug:t.debug},a=yield P2(s);t.activeProvider=a,function(c){var l,u,d,h;(u=(l=c.remoteConnection)===null||l===void 0?void 0:l.getConnector())===null||u===void 0||u.on(Qe.ConnectionStatus,f=>{c.emit(Qe.ConnectionStatus,f)}),(h=(d=c.remoteConnection)===null||d===void 0?void 0:d.getConnector())===null||h===void 0||h.on(Qe.ServiceStatus,f=>{c.emit(Qe.ServiceStatus,f)})}(t)})}const N2="sdk";class B2{constructor({serverUrl:e,enabled:n,originatorInfo:r}){this.serverURL=rr,this.serverURL=e,this.originatorInfo=r,this.enabled=n==null||n}send({event:e,params:n}){if(!this.enabled)return;const r=Object.assign(Object.assign({id:N2,event:e,sdkVersion:$n.version},this.originatorInfo),{params:n});G(`[Analytics: send()] event: ${e}`,r),Jt(r,this.serverURL).catch(i=>{G(`[Analytics: send()] error: ${i}`)})}}const D2=()=>{if(typeof document>"u")return;let t;const e=document.getElementsByTagName("link");for(let n=0;n<e.length;n++)e[n].getAttribute("rel")!=="icon"&&e[n].getAttribute("rel")!=="shortcut icon"||(t=e[n].getAttribute("href"));return t},$2=163400;function zl(t){var e,n,r;const{dappMetadata:i}=t,o=function({url:u,name:d}){var h;const f=u+d,g=uo(f);if(!localStorage)return"";let m=(h=localStorage.getItem(g))!==null&&h!==void 0?h:"";if(!m){m=ia();try{localStorage.setItem(g,m)}catch{return""}}return m}({url:(e=i==null?void 0:i.url)!==null&&e!==void 0?e:"no_url",name:(n=i==null?void 0:i.name)!==null&&n!==void 0?n:"no_name"}),s=(r=t.platformManager)===null||r===void 0?void 0:r.getPlatformType(),a=s===Fe.DesktopWeb,c=s===Fe.MetaMaskMobileWebview;let l="N/A";return a?l="extension":c&&(l="mobile"),{id:o,from:l}}
34const Js=({provider:t,sdkInstance:e})=>{if("state"in t)throw new Error("INVALID EXTENSION PROVIDER");return new Proxy(t,{get:(n,r)=>r==="request"?function(i){var o,s;return X(this,void 0,void 0,function*(){G("[wrapExtensionProvider()] Overwriting request method",i);const{method:a,params:c}=i,l=A2.includes(a.toLowerCase()),{id:u,from:d}=zl(e);if(l&&((o=e.analytics)===null||o===void 0||o.send({event:Te.SDK_RPC_REQUEST,params:{method:a,from:d,id:u}})),a===ue.METAMASK_BATCH&&Array.isArray(c))return(({target:f,args:g,trackEvent:m,sdkInstance:w})=>X(void 0,void 0,void 0,function*(){var p,k;if(g.method!=="metamask_batch")throw new Error("Invalid usage");const _=[],O=(p=g==null?void 0:g.params)!==null&&p!==void 0?p:[];for(const W of O){const V=yield f==null?void 0:f.request({method:W.method,params:W.params});_.push(V)}const{id:N,from:U}=zl(w);return m&&((k=w.analytics)===null||k===void 0||k.send({event:Te.SDK_RPC_REQUEST_DONE,params:{method:g.method,from:U,id:N}})),_}))({target:n,args:i,trackEvent:l,sdkInstance:e});if(a.toLowerCase()===ue.METAMASK_CONNECTSIGN.toLowerCase()&&Array.isArray(c))return(({target:f,params:g})=>X(void 0,void 0,void 0,function*(){const m=yield f.request({method:ue.ETH_REQUESTACCOUNTS,params:[]});if(!m.length)throw new Error("SDK state invalid -- undefined accounts");return yield f.request({method:ue.PERSONAL_SIGN,params:[g[0],m[0]]})}))({target:n,params:c});if(a.toLowerCase()===ue.METAMASK_CONNECTWITH.toLowerCase()&&Array.isArray(c))return(({target:f,params:g})=>X(void 0,void 0,void 0,function*(){const[m]=g,w=m.method,p=m.params,k=yield f.request({method:ue.ETH_REQUESTACCOUNTS,params:[]});if(!k.length)throw new Error("SDK state invalid -- undefined accounts");return(w==null?void 0:w.toLowerCase())===ue.PERSONAL_SIGN.toLowerCase()?yield f.request({method:w,params:[p[0],k[0]]}):(w==null?void 0:w.toLowerCase())===ue.ETH_SENDTRANSACTION.toLowerCase()?yield f.request({method:w,params:[Object.assign(Object.assign({},p[0]),{from:k[0]})]}):of.includes(w.toLowerCase())?(console.warn(`MetaMaskSDK connectWith method=${w} -- not handled by the extension -- call separately`),k):yield f.request({method:w,params:p})}))({target:n,params:c});let h;try{return h=yield n.request(i),h}finally{l&&((s=e.analytics)===null||s===void 0||s.send({event:Te.SDK_RPC_REQUEST_DONE,params:{method:a,from:d,id:u}}))}})}:r==="getChainId"?function(){return t.chainId}:r==="getNetworkVersion"?function(){return t.networkVersion}:r==="getSelectedAddress"?function(){return t.selectedAddress}:r==="isConnected"?function(){return t._state.isConnected}:n[r]})};var ho;function j2({mustBeMetaMask:t,sdkInstance:e}){return X(this,void 0,void 0,function*(){if(typeof window>"u")throw new Error("window not available");try{const n=yield new Promise((r,i)=>{const o=setTimeout(()=>{i(new Error("eip6963RequestProvider timed out"))},500);window.addEventListener(ho.Announce,s=>{const a=s,{detail:{info:c,provider:l}={}}=a,{name:u,rdns:d,uuid:h}=c??{};x2.test(h)&&u.startsWith(Ul.NAME)&&Ul.RDNS.includes(d)&&(clearTimeout(o),r(l))}),window.dispatchEvent(new Event(ho.Request))});return Js({provider:n,sdkInstance:e})}catch{if(!t&&window.ethereum)return Js({provider:window.ethereum,sdkInstance:e});throw new Error("Provider not found")}})}(function(t){t.Announce="eip6963:announceProvider",t.Request="eip6963:requestProvider"})(ho||(ho={}));const K2=t=>X(void 0,void 0,void 0,function*(){const{options:e}=t,{infuraAPIKey:n}=e;if(!n)return;const 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}`};t.options.readonlyRPCMap?t.options.readonlyRPCMap=Object.assign(Object.assign({},t.options.readonlyRPCMap),r):t.options.readonlyRPCMap=r}),U2=t=>X(void 0,void 0,void 0,function*(){const{options:e}=t,{readonlyRPCMap:n}=e;if(n)try{G("[MetaMaskSDK: setupReadOnlyRPCProviders()] Setting up Readonly RPC Providers",n),t.setReadOnlyRPCCalls(!0)}catch{throw new Error("Invalid Infura Settings")}});
34function H2(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(l){try{c(r.next(l))}catch(u){o(u)}}function a(l){try{c(r.throw(l))}catch(u){o(u)}}function c(l){var u;l.done?i(l.value):(u=l.value,u instanceof n?u:new n(function(d){d(u)})).then(s,a)}c((r=r.apply(t,[])).next())})}function F2(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(l){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,r=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(i=s.trys,!((i=i.length>0&&i[i.length-1])||u[0]!==6&&u[0]!==2)){s=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){s.label=u[1];break}if(u[0]===6&&s.label<i[1]){s.label=i[1],i=u;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(u);break}i[2]&&s.ops.pop(),s.trys.pop();continue}u=e.call(t,s)}catch(d){u=[6,d],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([c,l])}}}var ql="INSTALLED",Vl="NOT_INSTALLED",Wl="REGISTERED",Gl="REGISTERING",Yl="RELOADING",Zl={CHROME:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",FIREFOX:"https://addons.mozilla.org/firefox/addon/ether-metamask/",DEFAULT:"https://metamask.io"},yi="REGISTRATION_IN_PROGRESS",Jl="FORWARDER_ID",z2=function(){function t(e){var n=e===void 0?{}:e,r=n.forwarderOrigin,i=r===void 0?"https://fwd.metamask.io":r,o=n.forwarderMode,s=o===void 0?t.FORWARDER_MODE.INJECT:o;this.forwarderOrigin=i,this.forwarderMode=s,this.state=t.isMetaMaskInstalled()?ql:Vl;var a=t._detectBrowser();this.downloadUrl=a?Zl[a]:Zl.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),s===t.FORWARDER_MODE.INJECT&&sessionStorage.getItem(yi)==="true"&&t._injectForwarder(this.forwarderOrigin)}return t.prototype._onMessage=function(e){if(e.origin===this.forwarderOrigin)return e.data.type==="metamask:reload"?this._onMessageFromForwarder(e):void console.debug("Unknown message from '"+e.origin+"' with data "+JSON.stringify(e.data))},t.prototype._onMessageUnknownStateError=function(e){throw new Error("Unknown state: '"+e+"'")},t.prototype._onMessageFromForwarder=function(e){return H2(this,0,void 0,function(){return F2(this,function(n){switch(n.label){case 0:switch(this.state){case Yl:return[3,1];case Vl:return[3,2];case ql:return[3,3];case Gl:return[3,5];case Wl: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=Yl,location.reload(),[3,8];case 3:return console.debug("Registering with MetaMask"),this.state=Gl,[4,t._register()];case 4:return n.sent(),this.state=Wl,e.source.postMessage({type:"metamask:registrationCompleted"},e.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]}})})},t.prototype.startOnboarding=function(){sessionStorage.setItem(yi,"true"),this._openDownloadPage(),this._openForwarder()},t.prototype.stopOnboarding=function(){sessionStorage.getItem(yi)==="true"&&(this.forwarderMode===t.FORWARDER_MODE.INJECT&&(console.debug("Removing forwarder"),t._removeForwarder()),sessionStorage.setItem(yi,"false"))},t.prototype._openForwarder=function(){this.forwarderMode===t.FORWARDER_MODE.OPEN_TAB?window.open(this.forwarderOrigin,"_blank"):t._injectForwarder(this.forwarderOrigin)},t.prototype._openDownloadPage=function(){window.open(this.downloadUrl,"_blank")},t.isMetaMaskInstalled=function(){return!!(window.ethereum&&window.ethereum.isMetaMask)},t._register=function(){return window.ethereum.request({method:"wallet_registerOnboarding"})},t._injectForwarder=function(e){var n=document.body,r=document.createElement("iframe");r.setAttribute("height","0"),r.setAttribute("width","0"),r.setAttribute("style","display: none;"),r.setAttribute("src",e),r.setAttribute("id",Jl),n.insertBefore(r,n.children[0])},t._removeForwarder=function(){var e;(e=document.getElementById(Jl))===null||e===void 0||e.remove()},t._detectBrowser=function(){var e=nf.parse(window.navigator.userAgent);return e.browser.name==="Firefox"?"FIREFOX":["Chrome","Chromium"].includes(e.browser.name||"")?"CHROME":null},t.FORWARDER_MODE={INJECT:"INJECT",OPEN_TAB:"OPEN_TAB"},t}();function q2(t,{wait:e=!1}){return X(this,void 0,void 0,function*(){return G(`[MetamaskInstaller: startInstaller()] wait=${e}`),e&&(yield sf(1e3)),yield t.checkInstallation()})}class V2{constructor({remote:e,preferDesktop:n,platformManager:r,debug:i=!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=n,this.state.platformManager=r,this.state.debug=i}startDesktopOnboarding(){return function(){return X(this,void 0,void 0,function*(){G("[MetamaskInstaller: startDesktopOnboarding() starting desktop onboarding"),window.ethereum&&(window.ethereum=void 0),new z2().startOnboarding()})}()}redirectToProperInstall(){return X(this,void 0,void 0,function*(){return function(e){var n,r;return X(this,void 0,void 0,function*(){const{state:i}=e,o=(n=i.platformManager)===null||n===void 0?void 0:n.getPlatformType();if(G(`[MetamaskInstaller: redirectToProperInstall()] platform=${o}`),o===Fe.MetaMaskMobileWebview)return!1;i.isInstalling=!0;try{yield(r=i.remote)===null||r===void 0?void 0:r.startConnection({connectWith:i.connectWith}),i.isInstalling=!1,i.hasInstalled=!0}catch(s){throw i.isInstalling=!1,s}return!0})}(this)})}checkInstallation(){return X(this,void 0,void 0,function*(){return function(e){var n;return X(this,void 0,void 0,function*(){const{state:r}=e,i=(n=r.platformManager)===null||n===void 0?void 0:n.isMetaMaskInstalled();return G(`[MetamaskInstaller: checkInstallation()] isInstalled=${i}`),!!i||(yield e.redirectToProperInstall())})}(this)})}start({wait:e=!1,connectWith:n}){return X(this,void 0,void 0,function*(){this.state.connectWith=n,G(`[MetaMaskInstaller: start()] w
34ait=${e}`,n),yield q2(this,{wait:e})})}}class af{constructor({debug:e,sdkVersion:n}){this.containers={install:void 0,pending:void 0,select:void 0},this.defined={install:!1,pending:!1,select:!1},this.debug=e!=null&&e,this.sdkVersion=n}loadComponent(e){return X(this,void 0,void 0,function*(){if(!this.defined[e]){this.defined[e]=!0;try{const n=yield Promise.resolve().then(function(){return xg});console.log("loader",n),n.defineCustomElements()}catch(n){console.error(`Failed to load ${e} modal:`,n)}}})}renderInstallModal(e){var n;return X(this,void 0,void 0,function*(){this.debug&&console.debug("ModalLoader: renderInstallModal",e),this.containers.install=e.parentElement,yield this.loadComponent("install");const r=document.createElement("mm-install-modal");r.link=e.link,r.preferDesktop=e.preferDesktop,r.sdkVersion=(n=e.sdkVersion)!==null&&n!==void 0?n:this.sdkVersion,r.addEventListener("close",({detail:{shouldTerminate:i}})=>e.onClose(i)),r.addEventListener("startDesktopOnboarding",e.metaMaskInstaller.startDesktopOnboarding),r.addEventListener("trackAnalytics",i=>{var o;return(o=e.onAnalyticsEvent)===null||o===void 0?void 0:o.call(e,i.detail)}),e.parentElement.appendChild(r)})}renderSelectModal(e){var n;return X(this,void 0,void 0,function*(){this.containers.select=e.parentElement,yield this.loadComponent("select");const r=document.createElement("mm-select-modal");r.link=e.link,r.sdkVersion=(n=e.sdkVersion)!==null&&n!==void 0?n:this.sdkVersion,r.preferDesktop=e.preferDesktop,r.addEventListener("close",({detail:{shouldTerminate:i}})=>e.onClose(i)),r.addEventListener("connectWithExtension",e.connectWithExtension),e.parentElement.appendChild(r),setTimeout(()=>this.updateQRCode(e.link),100)})}renderPendingModal(e){var n;return X(this,void 0,void 0,function*(){this.containers.pending=e.parentElement,yield this.loadComponent("pending");const r=document.createElement("mm-pending-modal");r.sdkVersion=(n=e.sdkVersion)!==null&&n!==void 0?n:this.sdkVersion,r.displayOTP=e.displayOTP,r.addEventListener("close",e.onClose),r.addEventListener("updateOTPValue",({detail:{otpValue:i}})=>e.updateOTPValue(i)),e.onDisconnect&&r.addEventListener("disconnect",e.onDisconnect),e.parentElement.appendChild(r)})}updateOTPValue(e){const n=()=>{var r;const i=(r=this.containers.pending)===null||r===void 0?void 0:r.querySelector("mm-pending-modal");return!!i&&(i.otpCode=e,!0)};setTimeout(()=>{n()},800)}updateQRCode(e){var n,r;const i=(n=this.containers.install)===null||n===void 0?void 0:n.querySelector("mm-install-modal");if(i)i.link=e;else{const o=(r=this.containers.select)===null||r===void 0?void 0:r.querySelector("mm-select-modal");o&&(o.link=e)}}unmount(){Object.entries(this.containers).forEach(([e,n])=>{var r;(r=n==null?void 0:n.parentNode)===null||r===void 0||r.removeChild(n),this.containers[e]=void 0})}}const W2=({link:t,debug:e,installer:n,terminate:r,connectWithExtension:i,preferDesktop:o,onAnalyticsEvent:s})=>{let a=null,c=null;G("[UI: InstallModal-web: sdkWebInstallModal()] ################## Installing Modal #################"),G(`[UI: InstallModal-web: sdkWebInstallModal()] link=${t}`),G(`[UI: InstallModal-web: sdkWebInstallModal()] npx uri-scheme open "${t}" --ios`),G(`[UI: InstallModal-web: sdkWebInstallModal()] npx uri-scheme open "${t}" --android`),G(`[UI: InstallModal-web: sdkWebInstallModal()] adb shell am start -a android.intent.action.VIEW -d "${t}"`);const l=u=>{var d;G("[UI: InstallModal-web: sdkWebInstallModal()] installModal-web unmounting install modal -- shouldTerminate:",u,c),c!=null&&c.parentNode&&((d=c.parentNode)===null||d===void 0||d.removeChild(c)),c=null,a=null,u===!0&&(r==null||r())};return{mount:u=>{if(G("[UI: InstallModal-web: sdkWebInstallModal()] installModal-web mounting install modal",c),c)return c.style.display="block",void(a==null||a.updateQRCode(u));a=new af({debug:e,sdkVersion:$n.version}),c=document.createElement("div"),document.body.appendChild(c),window.extension?a.renderSelectModal({parentElement:c,connectWithExtension:()=>{l(),i==null||i()},onClose:l,link:t,preferDesktop:o!=null&&o}).catch(d=>{console.error(d)}):a.renderInstallModal({parentElement:c,preferDesktop:o!=null&&o,link:t,metaMaskInstaller:n,onClose:l,onAnalyticsEvent:s}).catch(d=>{console.error("[UI: InstallModal-web: sdkWebInstallModal()]",d)})},unmount:l}},G2=({onDisconnect:t,debug:e})=>{let n=null,r=null;const i=()=>{G("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web unmount",n),n!=null&&n.parentNode&&n.parentNode.removeChild(n),n=null,r=null},o=a=>{G("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web updateOTPValue",a),r&&r.updateOTPValue(a)}
34,s=({displayOTP:a}={displayOTP:!0})=>{G("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web mount",n),n?n.style.display="block":(r=new af({debug:e,sdkVersion:$n.version}),n=document.createElement("div"),document.body.appendChild(n),r.renderPendingModal({parentElement:n,onClose:i,onDisconnect:t,updateOTPValue:o,displayOTP:a}).catch(c=>{console.error("[UI: pendingModal-web: sdkWebPendingModal()]",c)}))};return s(),{mount:s,unmount:i,updateOTPValue:o}};function cf(t,e){var n,r,i,o;t.connector||(G("[RemoteConnection: initializeConnector()] initialize connector"),t.connector=new J1({platformType:e.platformManager.getPlatformType(),communicationLayerPreference:e.communicationLayerPreference,transports:e.transports,dappMetadata:Object.assign(Object.assign({},e.dappMetadata),{source:e._source}),analytics:e.enableAnalytics,communicationServerUrl:e.communicationServerUrl,sdkVersion:$n.version,context:"dapp",ecies:e.ecies,storage:e.storage,logging:e.logging}),e.timer&&(G("[RemoteConnection: initializeConnector()] reset background timer",e.timer),(r=(n=e.timer)===null||n===void 0?void 0:n.stopBackgroundTimer)===null||r===void 0||r.call(n),(o=(i=e.timer)===null||i===void 0?void 0:i.runBackgroundTimer)===null||o===void 0||o.call(i,()=>!1,1e4)))}function Xs(t){t.listeners.forEach(({event:e,handler:n})=>{var r;(r=t.connector)===null||r===void 0||r.off(e,n)}),t.listeners=[]}function Y2(t,e,n){return X(this,void 0,void 0,function*(){return new Promise((r,i)=>{if(!t.connector)return void i(new Error("No connector available"));G("[RemoteConnection: connectWithModalInstaller()]",{state:t,options:e,linkParams:n});const o=`${t.useDeeplink?Fr:Hr}?${n}`;(function(s,a,c){var l,u,d,h;s.installModal=(u=(l=a.modals).install)===null||u===void 0?void 0:u.call(l,{link:c,preferDesktop:s.preferDesktop,installer:a.getMetaMaskInstaller(),terminate:()=>{G("[RemoteConnection: showInstallModal() => terminate()] terminate connection"),a.sdk.terminate().catch(f=>{console.warn("[MMSDK] failed to terminate connection",f)})},debug:s.developerMode,connectWithExtension:()=>{var f;return(f=a.connectWithExtensionProvider)===null||f===void 0||f.call(a),!1},onAnalyticsEvent:({event:f,params:g})=>{var m,w,p;const k=Object.assign(Object.assign({},g),{sdkVersion:a.sdk.getVersion(),dappId:(m=a.dappMetadata)===null||m===void 0?void 0:m.name,source:a._source,url:(w=a.dappMetadata)===null||w===void 0?void 0:w.url});(p=s.analytics)===null||p===void 0||p.send({event:f,params:k})}}),(h=(d=s.installModal)===null||d===void 0?void 0:d.mount)===null||h===void 0||h.call(d,c)})(t,e,o),e.sdk.once(te.PROVIDER_UPDATE,s=>X(this,void 0,void 0,function*(){G("[RemoteConnection: connectWithModalInstaller()] once provider_update -- resolving startConnection promise"),s!==Dt.TERMINATE?i(s):i({code:4001,message:"User rejected the request."})})),t.connector.once(te.AUTHORIZED,()=>{r()}),t.connector.once(te.REJECTED,()=>{i(te.REJECTED)}),t.connector.once(te.CLIENTS_READY,()=>X(this,void 0,void 0,function*(){G("[RemoteConnection: connectWithModalInstaller()] once clients_ready -- resolving startConnection promise"),r()}))})})}function lf(t,e){function n(r,i){var o;(o=t.connector)===null||o===void 0||o.on(r,i),t.listeners.push({event:r,handler:i})}t.connector&&(Xs(t),n(te.WALLET_INIT,({accounts:r,chainId:i})=>X(this,void 0,void 0,function*(){G(`[RemoteConnection: setupListeners() => EventType.WALLET_INIT] 'wallet_init' accounts=${r} chainId=${i}`);const o=Ct.getProvider();o._setConnected();const s={accounts:r,chainId:i,isUnlocked:!1};o._initializeState(s),o.emit("chainChanged",i),o.emit("accountsChanged",r)})),n(te.AUTHORIZED,()=>X(this,void 0,void 0,function*(){var r,i,o,s;try{G("[RemoteConnection: setupListeners() => EventType.AUTHORIZED] 'authorized' closing modals",t.pendingModal,t.installModal);const a=Ct.getProvider();a._setConnected(),(i=(r=t.pendingModal)===null||r===void 0?void 0:r.unmount)===null||i===void 0||i.call(r),(s=(o=t.installModal)===null||o===void 0?void 0:o.unmount)===null||s===void 0||s.call(o,!1),t.otpAnswer=void 0,t.authorized=!0,G("[RemoteConnection: setupListeners() => EventType.AUTHORIZED] 'authorized' provider.state",a.getState()),yield a.forceInitializeState()}catch{}})),n(te.TERMINATE,()=>{var r,i,o,s,a;(i=(r=t.pendingModal)===null||r===void 0?void 0:r.unmount)===null||i===void 0||i.call(r),(s=(o=t.installModal)===null||o===void 0?void 0:o.unmount)===null||s===void 0||s.call(o,!0),t.pendingModal=void 0,t.installModal=void 0,t.otpAnswer=void 0,(a=t.connector)===null||a===void 0||a.disconnect({terminate:!0}),t.authorized=!1,Ct.getProvider().handleDisconnect({terminate:!0}),Xs(t),G("[RemoteConnection: setupListeners()] All listeners cleaned up")}))}function Z2(t,e,{initialCheck:n,connectWith:r}={}){var i,o,s,a,c,l,u,d,h,f,g,m,w,p,k,_,O,N,U;return X(this,void 0,void 0,function*(){try{if(cf(t,e),!t.connector)throw new Error("no connector defined");lf(t);const W=Ct.getProvider();t.authorized=!1,W.emit("connecting");const V=yield(i=t.connector)===null||i===void 0?void 0:i.originatorSessionConnect();G(`[RemoteConnection: startConnection()] after originatorSessionConnect initialCheck=${n}`,V);let H=(o=V==null?void 0:V.channelId)!==null&&o!==void 0?o:"",K=(a=(s=t.connector.getKeyInfo())===null||s===void 0?void 0:s.ecies.public)!==null&&a!==void 0?a:"",Y=(l=(c=t.connector.getKeyInfo())===null||c===void 0?void 0:c.ecies.private)!==null&&l!==void 0?l:"";if(n&&!V)return Promise.resolve();if(!V&&!n){const x=yield t.connector.generateChannelIdConnect();
34H=(u=x.channelId)!==null&&u!==void 0?u:"",K=(d=x.pubKey)!==null&&d!==void 0?d:"",Y=(h=x.privKey)!==null&&h!==void 0?h:"";const T=Date.now();(f=t.connector.state.storageManager)===null||f===void 0||f.persistChannelConfig({channelId:H,localKey:Y,lastActive:T,validUntil:T+ir})}if(n&&(V!=null&&V.channelId))return!((g=t.connector)===null||g===void 0)&&g.isConnected()||(G(`[RemoteConnection: startConnection()] reconnecting to channel initialCheck=${n}`,V),yield(m=t.connector)===null||m===void 0?void 0:m.connectToChannel({channelId:H})),Promise.resolve();V&&!(!((w=t.connector)===null||w===void 0)&&w.isConnected())&&(G("[RemoteConnection: startConnection()] reconnecting to channel",V),yield(p=t.connector)===null||p===void 0?void 0:p.connectToChannel({channelId:H}));const j=!((k=t.platformManager)===null||k===void 0)&&k.isSecure()?"":"&t=q",B=$n.version,{iconUrl:R,name:C,url:L,scheme:$}=e.dappMetadata||{},y=(_=t.platformManager)===null||_===void 0?void 0:_.getPlatformType();let E="N/A";typeof window<"u"&&window.location&&window.location.hostname?E=window.location.hostname:C!==void 0?E=C:L!==void 0&&(E=L);const A={url:L??"",title:C??"",icon:R,scheme:$??"",apiVersion:B,dappId:E||L||"N/A",platform:y??"",source:(O=e._source)!==null&&O!==void 0?O:""},M=uo(JSON.stringify(A));let b=`channelId=${H}&v=2&comm=${(N=t.communicationLayerPreference)!==null&&N!==void 0?N:""}&pubkey=${K}${j}&originatorInfo=${M}`;if(r){b+=`&rpc=${uo(JSON.stringify(r))}`;const x=t.connector.getRPCMethodTracker();x&&(x[`${r.id}`]=Object.assign(Object.assign({},r),{id:`${r.id}`,timestamp:Date.now()}))}const v=encodeURI(b),S=`${t.useDeeplink?Fr:Hr}?${b}`;return t.qrcodeLink=S,t.developerMode&&G(`[RemoteConnection: startConnection()] qrcodeLink=${v}`),W.emit("display_uri",S),!((U=t.platformManager)===null||U===void 0)&&U.isSecure()?(yield function(x,T){var I,D;return X(this,void 0,void 0,function*(){const F=`${Hr}?${T}`,z=`${Fr}?${T}`;(D=(I=x.platformManager)===null||I===void 0?void 0:I.openDeeplink)===null||D===void 0||D.call(I,F,z,"_self")})}(t,v),new Promise((x,T)=>{var I,D,F;!((I=t.connector)===null||I===void 0)&&I.isAuthorized()?x():((D=t.connector)===null||D===void 0||D.once(te.AUTHORIZED,()=>{x()}),(F=t.connector)===null||F===void 0||F.once(te.REJECTED,()=>{T(te.REJECTED)}))})):Y2(t,e,v)}catch(W){throw console.error("[startConnection] error",W),W}})}class J2{constructor(e){var n,r,i;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 o=((n=e.logging)===null||n===void 0?void 0:n.developerMode)===!0||((r=e.logging)===null||r===void 0?void 0:r.sdk)===!0;this.state.developerMode=o,this.state.analytics=e.analytics,this.state.preferDesktop=(i=e.preferDesktop)!==null&&i!==void 0&&i,this.state.useDeeplink=e.sdk.options.useDeeplink,this.state.communicationLayerPreference=e.communicationLayerPreference,this.state.platformManager=e.platformManager,e.modals.install||(e.modals.install=W2),e.modals.otp||(e.modals.otp=G2)}startConnection(e){return X(this,void 0,void 0,function*(){return Z2(this.state,this.options,e)})}initRemoteCommunication({sdkInstance:e}){var n,r,i;return X(this,void 0,void 0,function*(){const o=yield(r=(n=e.options.storage)===null||n===void 0?void 0:n.storageManager)===null||r===void 0?void 0:r.getPersistedChannelConfig();if(!this.options.ecies){const s={privateKey:o==null?void 0:o.localKey};this.options.ecies=s}cf(this.state,this.options),yield(i=this.getConnector())===null||i===void 0?void 0:i.initFromDappStorage(),lf(this.state,this.options)})}showActiveModal(){return function(e){var n,r,i,o;e.authorized?G("[RemoteConnection: showActiveModal()] already authorized"):e.pendingModal?(r=(n=e.pendingModal).mount)===null||r===void 0||r.call(n):e.installModal&&((o=(i=e.installModal).mount)===null||o===void 0||o.call(i,e.qrcodeLink||""))}(this.state)}closeModal(){var e,n,r,i;(n=(e=this.state.pendingModal)===null||e===void 0?void 0:e.unmount)===null||n===void 0||n.call(e),(i=(r=this.state.installModal)===null||r===void 0?void 0:r.unmount)===null||i===void 0||i.call(r,!1)}getUniversalLink(){if(!this.state.qrcodeLink)throw new Error("connection not started. run startConnection() first.");return this.state.qrcodeLink}getChannelConfig(){var e;return(e=this.state.connector)===null||e===void 0?void 0:e.getChannelConfig()}
34getKeyInfo(){var e;return(e=this.state.connector)===null||e===void 0?void 0:e.getKeyInfo()}getConnector(){if(!this.state.connector)throw new Error("invalid remote connector");return this.state.connector}getPlatformManager(){if(!this.state.platformManager)throw new Error("PlatformManager not available");return this.state.platformManager}isConnected(){var e;return((e=this.state.connector)===null||e===void 0?void 0:e.isReady())||!1}isAuthorized(){var e;return((e=this.state.connector)===null||e===void 0?void 0:e.isAuthorized())||!1}isPaused(){var e;return(e=this.state.connector)===null||e===void 0?void 0:e.isPaused()}disconnect(e){var n,r,i;G("[RemoteConnection: disconnect()]",e),e!=null&&e.terminate&&(Ct.getProvider().handleDisconnect({terminate:!0}),(r=(n=this.state.pendingModal)===null||n===void 0?void 0:n.unmount)===null||r===void 0||r.call(n),this.state.otpAnswer=void 0),(i=this.state.connector)===null||i===void 0||i.disconnect(e),function(o){G("[RemoteConnection: cleanupConnector()] cleaning up connector"),o.connector&&(Xs(o),o.connector.disconnect({terminate:!0}).catch(s=>{G("[RemoteConnection: cleanupConnector()] error disconnecting connector",s)}))}(this.state)}}function X2(t){var e,n,r,i,o,s,a,c,l,u,d;return X(this,void 0,void 0,function*(){const{options:h}=t;if(h.logging=(e=h.logging)!==null&&e!==void 0?e:{},h.communicationLayerPreference=(n=h.communicationLayerPreference)!==null&&n!==void 0?n:Pn.SOCKET,h.enableDebug!==void 0&&(Ge.enable("MM_SDK"),console.warn("enableDebug is removed. Please use enableAnalytics instead.")),h.enableAnalytics=(r=h.enableAnalytics)===null||r===void 0||r,h.injectProvider=(i=h.injectProvider)===null||i===void 0||i,h.shouldShimWeb3=(o=h.shouldShimWeb3)===null||o===void 0||o,h.extensionOnly=(s=h.extensionOnly)===null||s===void 0||s,h.useDeeplink=(a=h.useDeeplink)===null||a===void 0||a,h.storage=(c=h.storage)!==null&&c!==void 0?c:{enabled:!0},h.headless){Ge("[MetaMaskSDK: performSDKInitialization()] headless mode enabled");const k=()=>{},_={install:()=>({mount:k,unmount:k})},O={installer:k};h.modals=_,h.ui=O}const f=((l=h.logging)===null||l===void 0?void 0:l.developerMode)===!0;t.debug=((u=h.logging)===null||u===void 0?void 0:u.sdk)||f,G("[MetaMaskSDK: performSDKInitialization()] options",t.options);const g=Object.assign({},h.logging);f&&(g.sdk=!0,g.eciesLayer=!0,g.keyExchangeLayer=!0,g.remoteLayer=!0,g.serviceLayer=!0,g.plaintext=!0),yield function(k){var _;return X(this,void 0,void 0,function*(){const{options:O}=k;k.platformManager=new Kr({useDeepLink:(_=O.useDeeplink)!==null&&_!==void 0&&_,preferredOpenLink:O.openDeeplink,debug:k.debug})})}(t),yield function(k){var _,O,N,U,W,V,H,K,Y;return X(this,void 0,void 0,function*(){const{options:j}=k,B=(_=k.platformManager)===null||_===void 0?void 0:_.getPlatformType();k.analytics=new B2({serverUrl:(O=j.communicationServerUrl)!==null&&O!==void 0?O:rr,enabled:j.enableAnalytics,originatorInfo:{url:(N=j.dappMetadata.url)!==null&&N!==void 0?N:"",title:(U=j.dappMetadata.name)!==null&&U!==void 0?U:"",dappId:typeof window>"u"||window.location===void 0?(K=(V=(W=j.dappMetadata)===null||W===void 0?void 0:W.name)!==null&&V!==void 0?V:(H=j.dappMetadata)===null||H===void 0?void 0:H.url)!==null&&K!==void 0?K:"N/A":window.location.hostname,platform:B??"",source:(Y=j._source)!==null&&Y!==void 0?Y:""}})})}(t),yield function(k){var _;return X(this,void 0,void 0,function*(){const{options:O}=k;((_=O.storage)===null||_===void 0?void 0:_.enabled)!==!0||O.storage.storageManager||(O.storage.storageManager=yield rf(O.storage))})}(t),yield function(k){return X(this,void 0,void 0,function*(){const{options:_}=k,O=/^(http|https):\/\/[^\s]*$/;if(_.dappMetadata){_.dappMetadata.iconUrl&&!O.test(_.dappMetadata.iconUrl)&&(console.warn("Invalid dappMetadata.iconUrl: URL must start with http:// or https://"),_.dappMetadata.iconUrl=void 0),_.dappMetadata.base64Icon&&_.dappMetadata.base64Icon.length>$2&&(console.warn("Invalid dappMetadata.base64Icon: Base64-encoded icon string length must be less than 163400 characters"),_.dappMetadata.base64Icon=void 0),_.dappMetadata.url&&!O.test(_.dappMetadata.url)&&console.warn("Invalid dappMetadata.url: URL must start with http:// or https://");const N=D2();if(N&&!_.dappMetadata.iconUrl&&!_.dappMetadata.base64Icon){const U=`${window.location.protocol}//${window.location.host}${N}`;_.dappMetadata.iconUrl=U}}k.dappMetadata=_.dappMetadata})}(t),yield K2(t),yield U2(t);const{metamaskBrowserExtension:m,preferExtension:w,shouldReturn:p}=yield function(k){var _,O,N,U;return X(this,void 0,void 0,function*(){const{options:W}=k;let V,H=!1,K=!1;if(typeof window<"u"&&window.ethereum&&!(!((_=k.platformManager)===null||_===void 0)&&_.isMetaMaskMobileWebView())){H=localStorage.getItem(lo)==="extension";try{V=yield j2({mustBeMetaMask:!0,sdkInstance:k}),window.extension=V,V.on(kt.CHAIN_CHANGED,Y=>{G(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE chainChanged chainId=${Y}`),k.sdkProvider&&k.getMobileProvider().emit(kt.CHAIN_CHANGED,Y)}),V.on(kt.ACCOUNTS_CHANGED,Y=>X(this,void 0,void 0,function*(){var j;G(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE accountsChanged accounts=${Y}`);const B=!!k.sdkProvider,R=!!k.extensionActive;if(B&&k.getMobileProvider().emit(kt.ACCOUNTS_CHANGED,Y),R&&(Y==null?void 0:Y.length)===0&&(yield(j=k.getProvider())===null||j===void 0?void 0:j.request({method:ue.WALLET_GETPE
34RMISSIONS,params:[]})).length===0)try{yield k.terminate()}catch(C){G("[MetaMaskSDK: setupExtensionPreferences()] error terminating on permissions revoked",C)}})),V.on(kt.DISCONNECT,Y=>{G(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE disconnect error=${Y}`),k.sdkProvider&&k.getMobileProvider().emit(kt.DISCONNECT,Y)}),V.on(kt.CONNECT,Y=>{G(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE connect args=${Y}`),k.sdkProvider&&k.getMobileProvider().emit(kt.CONNECT,Y)}),V.on(kt.CONNECTED,Y=>{G("[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE connected",Y),k.sdkProvider&&k.getMobileProvider().emit(kt.CONNECTED,Y)})}catch{window.extension=void 0}}else!((O=k.platformManager)===null||O===void 0)&&O.isMetaMaskMobileWebView()&&((N=k.analytics)===null||N===void 0||N.send({event:Te.SDK_USE_INAPP_BROWSER}),k.activeProvider=Js({provider:window.ethereum,sdkInstance:k}),k._initialized=!0,K=!0);return V&&W.extensionOnly&&(G("[MetaMaskSDK: setupExtensionPreferences()] EXTENSION ONLY --- prevent sdk initialization"),(U=k.analytics)===null||U===void 0||U.send({event:Te.SDK_USE_EXTENSION}),k.activeProvider=V,k.extensionActive=!0,k.extension=V,k._initialized=!0,K=!0),{preferExtension:H,shouldReturn:K,metamaskBrowserExtension:V}})}(t);if(p)G("[MetaMaskSDK: performSDKInitialization()] shouldReturn=true --- prevent sdk initialization");else{yield function(k,_){var O,N,U,W,V;return X(this,void 0,void 0,function*(){const{options:H}=k,K=Object.assign({},H.logging);k.remoteConnection=new J2({preferDesktop:(O=H.preferDesktop)!==null&&O!==void 0&&O,communicationLayerPreference:(N=H.communicationLayerPreference)!==null&&N!==void 0?N:Pn.SOCKET,analytics:k.analytics,dappMetadata:H.dappMetadata,_source:H._source,enableAnalytics:(U=H.enableAnalytics)===null||U===void 0||U,timer:H.timer,sdk:k,platformManager:k.platformManager,transports:H.transports,communicationServerUrl:H.communicationServerUrl,storage:(W=H.storage)!==null&&W!==void 0?W:{enabled:!0},getMetaMaskInstaller:()=>{if(!k.installer)throw new Error("Invalid SDK status -- installer not initialized");return k.installer},logging:K,connectWithExtensionProvider:_===void 0?void 0:()=>Hl(k),modals:Object.assign(Object.assign({},H.modals),{onPendingModalDisconnect:k.terminate.bind(k)})}),yield k.remoteConnection.initRemoteCommunication({sdkInstance:k}),k.installer=new V2({remote:k.remoteConnection,preferDesktop:(V=H.preferDesktop)!==null&&V!==void 0&&V,platformManager:k.platformManager,debug:k.debug})})}(t,m),yield I2(t),yield function(k,_){var O,N;return X(this,void 0,void 0,function*(){const{options:U}=k;_?(G("[MetaMaskSDK: handleAutoAndExtensionConnections()] preferExtension is detected -- connect with it."),(O=k.analytics)===null||O===void 0||O.send({event:Te.SDK_EXTENSION_UTILIZED}),Hl(k).catch(W=>{console.warn("Can't connect with MetaMask extension...",W),localStorage.removeItem(lo)})):U.checkInstallationImmediately&&(!((N=k.platformManager)===null||N===void 0)&&N.isDesktopWeb()?(G("[MetaMaskSDK: handleAutoAndExtensionConnections()] checkInstallationImmediately"),k.connect().catch(W=>{G(`[MetaMaskSDK: handleAutoAndExtensionConnections()] checkInstallationImmediately --- IGNORED --- error on autoconnect _err=${W}`)})):console.warn("[handleAutoAndExtensionConnections()] checkInstallationImmediately --- IGNORED --- only for web desktop")),k._initialized=!0})}(t,w);try{yield(d=t.remoteConnection)===null||d===void 0?void 0:d.startConnection({initialCheck:!0})}catch(k){console.error("[MetaMaskSDK: setupRemoteConnectionAndInstaller()] Error while checking installation",k)}t.emit(Qe.ProviderUpdate,Dt.INITIALIZED)}})}class Fg extends Df{constructor(e={storage:{enabled:!0},injectProvider:!0,forceInjectProvider:!1,enableAnalytics:!0,shouldShimWeb3:!0,useDeeplink:!0,extensionOnly:!0,headless:!1,dappMetadata:{name:"",url:"",iconUrl:""},_source:Kl,i18nOptions:{enabled:!1}}){var n,r,i;super(),this.extensionActive=!1,this._initialized=!1,this.sdkInitPromise=void 0,this.debug=!1,this.readonlyRPCCalls=!1,this.availableLanguages=["en"],Ge.disable();const o=((n=e.logging)===null||n===void 0?void 0:n.developerMode)===!0;if((!((r=e.logging)===null||r===void 0)&&r.sdk||o)&&Ge.enable("MM_SDK"),G("[MetaMaskSDK: constructor()]: begin."),this.setMaxListeners(50),!(!((i=e.dappMetadata)===null||i===void 0)&&i.url)){if(typeof window>"u"||typeof document>"u")throw new 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=Kl),this.init().then(()=>{G("[MetaMaskSDK: constructor()]: initialized successfully."),typeof window<"u"&&(window.mmsdk=this)}).catch(s=>{console.error("[MetaMaskSDK: constructor()] error during initialization",s)})}init(){return X(this,void 0,void 0,function*(){return function(e){var n;return X(this,void 0,void 0,function*(){if(typeof window<"u"&&(!((n=window.mmsdk)===null||n===void 0)&&n.isInitialized()))return G("[MetaMaskSDK: initializeMetaMaskSDK()] already initialized"),Promise.resolve(window.mmsdk);if(e._initialized)return G("[MetaMaskSDK: initializeMetaMaskSDK()] already initialized"),e.sdkInitPromise;if(e.sdkInitPromise)return G("[MetaMaskSDK: initializeMetaMaskSDK()] already initializing"),e.sdkInitPromise;try{e.sdkInitPromise=X2(e),yield e.sdkInitPromise}catch(r){throw console.error(r),r}return e.sdkInitPromise})}(this)})}isExtensionActive(){return this.extensionActive}checkExtensionAvailability(){var e;return typeof window<"u"&&!!(!((e=window.ethereum)===null||e===void 0)&&e.isMetaMask)}connect(){return X(this,void 0,void 0,function*(){return function(e){return X(this,void 0,void 0,function*(){if(e._initialized||(G("[MetaMaskSDK: connect()] provider not ready -- wait for init()"),yield e.init()),G(`[MetaMaskSDK: connect()] isExtensionActive=${e.isExtensionActive()} activeProvider`,e.activeProvider),!e.activeProvider)throw new Error("SDK state invalid -- undefined provider");const n=e.activeProvider.getSelectedAddress();return n?[n]:e.activeProvider.request({method:ue.ETH_REQUESTACCOUNTS,params:[]})})}(this)})}connectAndSign({msg:e}){return X(this,void 0,void 0,function*(){return R2({instance:this,msg:e})})}connectWith(e){return X(this,void 0,void 0,function*(){return function({instance:n,rpc:r}){return X(this,void 0,void 0,function*(){if(n._initialized||(G("[MetaMaskSDK: connectWith()] provider not ready -- wait for init()"),yield n.init()),G(`[MetaMaskSDK: connectWith()] method: ${r.method} rpc=${r}`),!n.activeProvider)throw new Error("SDK state invalid -- undefined provider");return n.activeProvider.request({method:ue.METAMASK_CONNECTWITH,params:[r]})})}({instance:this,rpc:e})})}resume(){return function(e){var n,r,i;return X(this,void 0,void 0,function*(){if(!(!((r=(n=e.remoteConnection)===null||n===void 0?void 0:n.getConnector())===null||r===void 0)&&r.isReady()))return G("[MetaMaskSDK: resume()] channel is not ready -- starting connection"),void((i=e.remoteConnection)===null||i===void 0||i.startConnection());G("[MetaMaskSDK: resume()] channel is ready")})}(this)}disconnect(){return console.warn("MetaMaskSDK.disconnect() is deprecated, use terminate()"),this.terminate()}isAuthorized(){var e;(e=this.remoteConnection)===null||e===void 0||e.isAuthorized()}terminate(){return function(e){var n,r,i;return X(this,void 0,void 0,function*(){if(!(!((n=e.platformManager)===null||n===void 0)&&n.isMetaMaskMobileWebView())){if(T2&&(window.localStorage.removeItem(lo),window.localStorage.removeItem(Zs),window.localStorage.removeItem(Ys)),e.extensionActive){try{yield(r=e.activeProvider)===null||r===void 0?void 0:r.request({method:ue.WALLET_REVOKEPERMISSIONS,params:[{eth_accounts:{}}]})}catch(o){G("[MetaMaskSDK: terminate()] error revoking permissions",o)}
34return e.options.extensionOnly?(e.emit(Qe.ProviderUpdate,Dt.TERMINATE),void G("[MetaMaskSDK: terminate()] extensionOnly --- prevent switching providers")):(e.activeProvider=e.sdkProvider,window.ethereum=e.activeProvider,e.extensionActive=!1,void e.emit(Qe.ProviderUpdate,Dt.TERMINATE))}e.emit(Qe.ProviderUpdate,Dt.TERMINATE),G(`[MetaMaskSDK: terminate()] remoteConnection=${e.remoteConnection}`),(i=e.remoteConnection)===null||i===void 0||i.disconnect({terminate:!0,sendMessage:!0})}})}(this)}isInitialized(){return this._initialized}setReadOnlyRPCCalls(e){this.readonlyRPCCalls=e}hasReadOnlyRPCCalls(){return this.readonlyRPCCalls}getProvider(){if(this.activeProvider)return this.activeProvider;console.warn("MetaMaskSDK: No active provider found")}getMobileProvider(){if(!this.sdkProvider)throw new Error("SDK state invalid -- undefined mobile provider");return this.sdkProvider}getUniversalLink(){var e;const n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getUniversalLink();if(!n)throw new Error("No Universal Link available, please call eth_requestAccounts first.");return n}getChannelId(){var e,n;return(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getChannelConfig())===null||n===void 0?void 0:n.channelId}getRPCHistory(){var e,n;return(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getConnector())===null||n===void 0?void 0:n.getRPCMethodTracker()}getVersion(){return $n.version}getWalletStatus(){var e,n;return(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getConnector())===null||n===void 0?void 0:n.getConnectionStatus()}_getChannelConfig(){var e;return(e=this.remoteConnection)===null||e===void 0?void 0:e.getChannelConfig()}_ping(){var e,n;(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getConnector())===null||n===void 0||n.ping()}_keyCheck(){var e,n;(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getConnector())===null||n===void 0||n.keyCheck()}_getServiceStatus(){var e,n;return(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getConnector())===null||n===void 0?void 0:n.getServiceStatus()}_getRemoteConnection(){return this.remoteConnection}_getDappMetadata(){return this.dappMetadata}_getKeyInfo(){var e;return(e=this.remoteConnection)===null||e===void 0?void 0:e.getKeyInfo()}_resetKeys(){var e,n;(n=(e=this.remoteConnection)===null||e===void 0?void 0:e.getConnector())===null||n===void 0||n.resetKeys()}_getConnection(){return this.remoteConnection}emit(e,n){return super.emit(e,n)}on(e,n){return super.on(e,n)}}var Q2=Object.freeze({__proto__:null,StorageManagerWeb:class{constructor({enabled:t}={enabled:!1}){this.enabled=!1,this.enabled=t}persistChannelConfig(t){return X(this,void 0,void 0,function*(){const e=JSON.stringify(t);G(`[StorageManagerWeb: persistChannelConfig()] enabled=${this.enabled}`,t),localStorage.setItem(gs,e)})}getPersistedChannelConfig(){return X(this,void 0,void 0,function*(){let t;try{if(G(`[StorageManagerWeb: getPersistedChannelConfig()] enabled=${this.enabled}`),t=localStorage.getItem(gs),G("[StorageManagerWeb: getPersistedChannelConfig()]",t),!t)return;const e=JSON.parse(t);return G("[StorageManagerWeb: getPersistedChannelConfig()] channelConfig",e),e}catch(e){return void console.error("[StorageManagerWeb: getPersistedChannelConfig()] Can't find existing channel config",e)}})}persistAccounts(t){return X(this,void 0,void 0,function*(){G(`[StorageManagerWeb: persistAccounts()] enabled=${this.enabled}`,t);const e=JSON.stringify(t);localStorage.setItem(Ys,e)})}getCachedAccounts(){return X(this,void 0,void 0,function*(){try{const t=localStorage.getItem(Ys);return t?JSON.parse(t):[]}catch(t){throw console.error("[StorageManagerWeb: getCachedAccounts()] Error reading cached accounts",t),t}})}persistChainId(t){return X(this,void 0,void 0,function*(){G(`[StorageManagerWeb: persistChainId()] enabled=${this.enabled}`,t),localStorage.setItem(Zs,t)})}getCachedChainId(){return X(this,void 0,void 0,function*(){try{const t=localStorage.getItem(Zs);return t??void 0}catch(t){throw console.error("[StorageManagerWeb: getCachedChainId()] Error reading cached chainId",t),t}})}terminate(){return X(this,void 0,void 0,function*(){G(`[StorageManagerWeb: terminate()] enabled=${this.enabled}`),localStorage.removeItem(gs)})}}});const eg="hydrated",tg=!1,ng=!1,rg=!0;var ig=Object.defineProperty,Ba=new WeakMap,yn=t=>Ba.get(t),Da=(t,e)=>
34Ba.set(e.$lazyInstance$=t,e),Xl=(t,e)=>e in t,Ln=(t,e)=>(0,console.error)(t,e),ms=new Map,Di=new Map,uf="slot-fb{display:contents}slot-fb[hidden]{display:none}",So=typeof window<"u"?window:{},It=So.document||{head:{}},$e={$flags$:0,$resourcesUrl$:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,r)=>t.addEventListener(e,n,r),rel:(t,e,n,r)=>t.removeEventListener(e,n,r),ce:(t,e)=>new CustomEvent(t,e)},df=(()=>{try{return new CSSStyleSheet,typeof new CSSStyleSheet().replaceSync=="function"}catch{}return!1})(),Qs=!1,Ql=[],hf=[],og=(t,e)=>n=>{t.push(n),Qs||(Qs=!0,4&$e.$flags$?$a(ea):$e.raf(ea))},eu=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(n){Ln(n)}t.length=0},ea=()=>{eu(Ql),eu(hf),(Qs=Ql.length>0)&&$e.raf(ea)},$a=t=>(e=>Promise.resolve(e))().then(t),sg=og(hf),tu={},ja=t=>(t=typeof t)=="object"||t==="function";function ff(t){var e,n,r;return(r=(n=(e=t.head)==null?void 0:e.querySelector('meta[name="csp-nonce"]'))==null?void 0:n.getAttribute("content"))!=null?r:void 0}((t,e)=>{for(var n in e)ig(t,n,{get:e[n],enumerable:!0})})({},{err:()=>pf,map:()=>ag,ok:()=>ta,unwrap:()=>cg,unwrapErr:()=>lg});var ta=t=>({isOk:!0,isErr:!1,value:t}),pf=t=>({isOk:!1,isErr:!0,value:t});function ag(t,e){if(t.isOk){const n=e(t.value);return n instanceof Promise?n.then(r=>ta(r)):ta(n)}if(t.isErr){const n=t.value;return pf(n)}throw"should never get here"}var $i,Ka,cg=t=>{if(t.isOk)return t.value;throw t.value},lg=t=>{if(t.isErr)return t.value;throw t.value},P=(t,e,...n)=>{let r=null,i=!1,o=!1;const s=[],a=l=>{for(let u=0;u<l.length;u++)r=l[u],Array.isArray(r)?a(r):r!=null&&typeof r!="boolean"&&((i=typeof t!="function"&&!ja(r))&&(r=String(r)),i&&o?s[s.length-1].$text$+=r:s.push(i?fo(null,r):r),o=i)};if(a(n),e){const l=e.className||e.class;l&&(e.class=typeof l!="object"?l:Object.keys(l).filter(u=>l[u]).join(" "))}if(typeof t=="function")return t(e===null?{}:e,s,dg);const c=fo(t,null);return c.$attrs$=e,s.length>0&&(c.$children$=s),c},fo=(t,e)=>({$flags$:0,$tag$:t,$text$:e,$elm$:null,$children$:null,$attrs$:null}),ug={},dg={forEach:(t,e)=>t.map(nu).forEach(e),map:(t,e)=>t.map(nu).map(e).map(hg)},nu=t=>({vattrs:t.$attrs$,vchildren:t.$children$,vkey:t.$key$,vname:t.$name$,vtag:t.$tag$,vtext:t.$text$}),hg=t=>{if(typeof t.vtag=="function"){const n={...t.vattrs};return t.vkey&&(n.key=t.vkey),t.vname&&(n.name=t.vname),P(t.vtag,n,...t.vchildren||[])}const e=fo(t.vtag,t.vtext);return e.$attrs$=t.vattrs,e.$children$=t.vchildren,e.$key$=t.vkey,e.$name$=t.vname,e},ko=t=>yn(t).$hostElement$,wn=(t,e,n)=>{const r=ko(t);return{emit:i=>
34gf(r,e,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:i})}},gf=(t,e,n)=>{const r=$e.ce(e,n);return t.dispatchEvent(r),r},ru=new WeakMap,fg=t=>{const e=t.$cmpMeta$,n=t.$hostElement$,r=e.$flags$;e.$tagName$;const i=((o,s,a)=>{var c;const l=mf(s),u=Di.get(l);if(o=o.nodeType===11?o:It,u)if(typeof u=="string"){o=o.head||o;let d,h=ru.get(o);if(h||ru.set(o,h=new Set),!h.has(l)){{d=It.createElement("style"),d.innerHTML=u;const f=(c=$e.$nonce$)!=null?c:ff(It);if(f!=null&&d.setAttribute("nonce",f),!(1&s.$flags$))if(o.nodeName==="HEAD"){const g=o.querySelectorAll("link[rel=preconnect]"),m=g.length>0?g[g.length-1].nextSibling:o.querySelector("style");o.insertBefore(d,m)}else if("host"in o)if(df){const g=new CSSStyleSheet;g.replaceSync(u),o.adoptedStyleSheets=[g,...o.adoptedStyleSheets]}else{const g=o.querySelector("style");g?g.innerHTML=u+g.innerHTML:o.prepend(d)}else o.append(d);1&s.$flags$&&o.nodeName!=="HEAD"&&o.insertBefore(d,null)}4&s.$flags$&&(d.innerHTML+=uf),h&&h.add(l)}}else o.adoptedStyleSheets.includes(u)||(o.adoptedStyleSheets=[...o.adoptedStyleSheets,u]);return l})(n.shadowRoot?n.shadowRoot:n.getRootNode(),e);10&r&&2&r&&(n["s-sc"]=i,n.classList.add(i+"-h"))},mf=(t,e)=>"sc-"+t.$tagName$,iu=(t,e,n,r,i,o)=>{if(n!==r){let s=Xl(t,e),a=e.toLowerCase();if(e==="class"){const c=t.classList,l=ou(n),u=ou(r);c.remove(...l.filter(d=>d&&!u.includes(d))),c.add(...u.filter(d=>d&&!l.includes(d)))}else if(e==="style"){for(const c in n)r&&r[c]!=null||(c.includes("-")?t.style.removeProperty(c):t.style[c]="");for(const c in r)n&&r[c]===n[c]||(c.includes("-")?t.style.setProperty(c,r[c]):t.style[c]=r[c])}else if(s||e[0]!=="o"||e[1]!=="n"){const c=ja(r);if((s||c&&r!==null)&&!i)try{if(t.tagName.includes("-"))t[e]=r;else{const l=r??"";e==="list"?s=!1:n!=null&&t[e]==l||(typeof t.__lookupSetter__(e)=="function"?t[e]=l:t.setAttribute(e,l))}}catch{}r==null||r===!1?r===!1&&t.getAttribute(e)!==""||t.removeAttribute(e):(!s||4&o||i)&&!c&&(r=r===!0?"":r,t.setAttribute(e,r))}else if(e=e[2]==="-"?e.slice(3):Xl(So,a)?a.slice(2):a[2]+e.slice(3),n||r){const c=e.endsWith(yf);e=e.replace(gg,""),n&&$e.rel(t,e,n,c),r&&$e.ael(t,e,r,c)}}},pg=/\s/,ou=t=>t?t.split(pg):[],yf="Capture",gg=new RegExp(yf+"$"),vf=(t,e,n)=>{const r=e.$elm$.nodeType===11&&e.$elm$.host?e.$elm$.host:e.$elm$,i=t&&t.$attrs$||tu,o=e.$attrs$||tu;for(const s of su(Object.keys(i)))s in o||iu(r,s,i[s],void 0,n,e.$flags$);for(const s of su(Object.keys(o)))iu(r,s,i[s],o[s],n,e.$flags$)};function su(t){return t.includes("ref")?[...t.filter(e=>e!=="ref"),"ref"]:t}var bf=!1,gt=!1,Ua=(t,e,n,r)=>{const i=e.$children$[n];let o,s,a=0;if(i.$text$!==null)o=i.$elm$=It.createTextNode(i.$text$);else{if(gt||(gt=i.$tag$==="svg"),o=i.$elm$=It.createElementNS(gt?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",!bf&&ng&&2&i.$flags$?"slot-fb":i.$tag$),gt&&i.$tag$==="foreignObject"&&(gt=!1),vf(null,i,gt),o.getRootNode().querySelector("body")&&tg&&(c=>c!=null)($i)&&o["s-si"]!==$i&&o.classList.add(o["s-si"]=$i),i.$children$)for(a=0;a<i.$children$.length;++a)s=Ua(t,i,a),s&&o.appendChild(s);i.$tag$==="svg"?gt=!1:o.tagName==="foreignObject"&&(gt=!0)}return o["s-hn"]=Ka,o},au=(t,e,n,r,i,o)=>{let s,a=t;for(a.shadowRoot&&a.tagName===Ka&&(a=a.shadowRoot);i<=o;++i)r[i]&&(s=Ua(null,n,i),s&&(r[i].$elm$=s,ji(a,s,e)))},cu=(t,e,n)=>{for(let r=e;r<=n;++r){const i=t[r];if(i){const o=i.$elm$;o&&o.remove()}}},vi=(t,e,n=!1)=>t.$tag$===e.$tag$,Er=(t,e,n=!1)=>{const r=e.$elm$=t.$elm$,i=t.$children$,o=e.$children$,s=e.$tag$,a=e.$text$;a===null?(vf(t,e,gt=s==="svg"||s!=="foreignObject"&>),i!==null&&o!==null?((c,l,u,d,h=!1)=>{let f,g=0,m=0,w=l.length-1,p=l[0],k=l[w],_=d.length-1,O=d[0],N=d[_];for(;g<=w&&m<=_;)p==null?p=l[++g]:k==null?k=l[--w]:O==null?O=d[++m]:N==null?N=d[--_]:vi(p,O,h)?(Er(p,O,h),p=l[++g],O=d[++m]):vi(k,N,h)?(Er(k,N,h),k=l[--w],N=d[--_]):vi(p,N,h)?(Er(p,N,h),ji(c,p.$elm$,k.$elm$.nextSibling),p=l[++g],N=d[--_]):vi(k,O,h)?(Er(k,O,h),ji(c,k.$elm$,p.$elm$),k=l[--w],O=d[++m]):(f=Ua(l&&l[m],u,m),O=d[++m],f&&ji(p.$elm$.parentNode,f,p.$elm$));g>w?au(c,d[_+1]==null?null:d[_+1].$elm$,u,d,m,_):m>_&&cu(l,g,w)})(r,i,e,o,n):o!==null?(t.$text$!==null&&(r.textContent=""),au(r,null,e,o,0,o.length-1)):!n&&rg&&i!==null&&cu(i,0,i.length-1),gt&&s==="svg"&&(gt=!1)):t.$text$!==a&&(r.data=a)},ji=(t,e,n)=>t==null?void 0:t.insertBefore(e,n),mg=(t,e,n=!1)=>{const r=t.$hostElement$,i=t.$cmpMeta$,o=t.$vnode$||fo(null,null),s=(a=e)&&a.$tag$===ug?e:P(null,null,e);var a;if(Ka=r.tagName,n&&s.$attrs$)for(const c of Object.keys(s.$attrs$))r.hasAttribute(c)&&!["key","ref","style","class"].includes(c)&&(s.$attrs$[c]=r[c]);s.$tag$=null,s.$flags$|=4,t.$vnode$=s,s.$elm$=o.$elm$=r.shadowRoot||r,$i=r["s-sc"],bf=(1&i.$flags$)!=0,Er(o,s,n)},wf=(t,e)=>{e&&!t.$onRenderResolve$&&e["s-p"]&&e["s-p"].push(new Promise(n=>t.$onRenderResolve$=n))},Ha=(t,e)=>(t.$flags$|=16,4&t.$flags$?void(t.$flags$|=512):(wf(t,t.$ancestorComponent$),sg(()=>yg(t,e)))),yg=(t,e)=>{const n=t.$hostElement$;t.$cmpMeta$.$tagName$;const r=t.$lazyInstance$;if(!r)throw new Error(`Can't render component <${n.tagName.toLowerCase()} />
34 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 vg(void 0,()=>wg(t,r,e))},vg=(t,e)=>bg(t)?t.then(e).catch(n=>{console.error(n),e()}):e(),bg=t=>t instanceof Promise||t&&t.then&&typeof t.then=="function",wg=async(t,e,n)=>{var r;const i=t.$hostElement$;t.$cmpMeta$.$tagName$;const o=i["s-rc"];n&&fg(t),t.$cmpMeta$.$tagName$,Eg(t,e,i,n),o&&(o.map(s=>s()),i["s-rc"]=void 0);{const s=(r=i["s-p"])!=null?r:[],a=()=>_g(t);s.length===0?a():(Promise.all(s).then(a),t.$flags$|=4,s.length=0)}},Eg=(t,e,n,r)=>{try{e=e.render(),t.$flags$&=-17,t.$flags$|=2,mg(t,e,r)}catch(i){Ln(i,t.$hostElement$)}return null},_g=t=>{t.$cmpMeta$.$tagName$;const e=t.$hostElement$,n=()=>{},r=t.$lazyInstance$,i=t.$ancestorComponent$;64&t.$flags$?n():(t.$flags$|=64,_f(e),Fa(r,"componentDidLoad"),t.$onReadyResolve$(e),i||Ef()),t.$onRenderResolve$&&(t.$onRenderResolve$(),t.$onRenderResolve$=void 0),512&t.$flags$&&$a(()=>Ha(t,!1)),t.$flags$&=-517},Ef=t=>{_f(It.documentElement),$a(()=>gf(So,"appload",{detail:{namespace:"sdk-install-modal-web"}}))},Fa=(t,e,n)=>{if(t&&t[e])try{return t[e](n)}catch(r){Ln(r)}},_f=t=>{var e;return t.classList.add((e=eg)!=null?e:"hydrated")},Cg=(t,e,n,r)=>{const i=yn(t);if(!i)throw new 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).`);const o=i.$hostElement$,s=i.$instanceValues$.get(e),a=i.$flags$,c=i.$lazyInstance$;var l,u;l=n,u=r.$members$[e][0],n=l==null||ja(l)?l:4&u?l!=="false"&&(l===""||!!l):1&u?String(l):l;const d=Number.isNaN(s)&&Number.isNaN(n);if((!(8&a)||s===void 0)&&n!==s&&!d&&(i.$instanceValues$.set(e,n),c)){if(r.$watchers$&&128&a){const h=r.$watchers$[e];h&&h.map(f=>{try{c[f](n,s,e)}catch(g){Ln(g,o)}})}(18&a)==2&&Ha(i,!1)}},Cf=(t,e,n)=>{var r,i;const o=t.prototype;if(e.$members$||e.$watchers$||t.watchers){t.watchers&&!e.$watchers$&&(e.$watchers$=t.watchers);const s=Object.entries((r=e.$members$)!=null?r:{});if(s.map(([a,[c]])=>{(31&c||2&n&&32&c)&&Object.defineProperty(o,a,{get(){return l=a,yn(this).$instanceValues$.get(l);var l},set(l){Cg(this,a,l,e)},configurable:!0,enumerable:!0})}),1&n){const a=new Map;o.attributeChangedCallback=function(c,l,u){$e.jmp(()=>{var d;const h=a.get(c);if(this.hasOwnProperty(h))u=this[h],delete this[h];else{if(o.hasOwnProperty(h)&&typeof this[h]=="number"&&this[h]==u)return;if(h==null){const f=yn(this),g=f==null?void 0:f.$flags$;if(g&&!(8&g)&&128&g&&u!==l){const m=f.$lazyInstance$,w=(d=e.$watchers$)==null?void 0:d[c];w==null||w.forEach(p=>{m[p]!=null&&m[p].call(m,u,l,c)})}return}}this[h]=(u!==null||typeof this[h]!="boolean")&&u})},t.observedAttributes=Array.from(new Set([...Object.keys((i=e.$watchers$)!=null?i:{}),...s.filter(([c,l])=>15&l[0]).map(([c,l])=>{const u=l[1]||c;return a.set(u,c),u})]))}}return t},Sg=async(t,e,n,r)=>{let i;if(!(32&e.$flags$)){if(e.$flags$|=32,n.$lazyBundleId$){const a=((c,l,u)=>{const d=c.$tagName$.replace(/-/g,"_"),h=c.$lazyBundleId$;if(!h)return;const f=ms.get(h);if(f)return f[d];{const g=m=>(ms.set(h,m),m[d]);if(h==="mm-install-modal_3")return Promise.resolve().then(function(){return jg}).then(g,Ln)}return Nf(()=>import(`./${h}.entry.js`),[]).then(g=>(ms.set(h,g),g[d]),Ln)})(n);if(a&&"then"in a?i=await a:i=a,!i)throw new Error(`Constructor for "${n.$tagName$}#${e.$modeName$}" was not found`);i.isProxied||(n.$watchers$=i.watchers,Cf(i,n,2),i.isProxied=!0),n.$tagName$,e.$flags$|=8;try{new i(e)}catch(c){Ln(c)}e.$flags$&=-9,e.$flags$|=128,na(e.$lazyInstance$)}else{i=t.constructor;const a=t.localName;customElements.whenDefined(a).then(()=>e.$flags$|=128)}if(i&&i.style){let a;typeof i.style=="string"&&(a=i.style);const c=mf(n);Di.has(c)||(n.$tagName$,((l,u,d)=>{let h=Di.get(l);df&&d?(h=h||new CSSStyleSheet,typeof h=="string"?h=u:h.replaceSync(u)):h=u,Di.set(l,h)})(c,a,!!(1&n.$flags$)))}}const o=e.$ancestorComponent$,s=()=>Ha(e,!0);o&&o["s-rc"]?o["s-rc"].push(s):s()},na=t=>{Fa(t,"connectedCallback")},lu=t=>{Fa(t,"disconnectedCallback")},kg=(t,e={})=>{var n;const r=[],i=e.exclude||[],o=So.customElements,s=It.head,a=s.querySelector("meta[charset]"),c=It.createElement("style"),l=[];let u,d=!0;Object.assign($e,e),$e.$resourcesUrl$=new URL(e.resourcesUrl||"./",It.baseURI).href;let h=!1;if(t.map(f=>{f[1].map(g=>{var m;const w={$flags$:g[0],$tagName$:g[1],$members$:g[2],$listeners$:g[3]};4&w.$flags$&&(h=!0),w.$members$=g[2],w.$watchers$=(m=g[4])!=null?m:{};const p=w.$tagName$,k=class extends HTMLElement{constructor(_){if(super(_),this.hasRegisteredEventListeners=!1,((O,N)=>{const U={$flags$:0,$hostElement$:O,$cmpMeta$:N,$instanceValues$:new Map};U.$onReadyPromise$=new Promise(W=>U.$onReadyResolve$=W),O["s-p"]=[],O["s-rc"]=[],Ba.set(O,U)})(_=this,w),1&w.$flags$)if(_.shadowRoot){if(_.shadowRoot.mode!=="open")throw new Error(`Unable to re-use existing shadow root for ${w.$tagName$}! Mode is set to ${_.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else _.attachShadow({mode:"open"})}connectedCallback(){yn(this),this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0),u&&(clearTimeout(u),u=null),d?l.push(this):$e.jmp(()=>(_=>{if(!(1&$e.$flags$)){const O=yn(_),N=O.$cmpMeta$;if(N.$tagName$,1&O.$flags$)O!=null&&O.$lazyInstance$?na(O.$lazyInstance$):O!=null&&O.$onReadyPromise$&&O.$onReadyPromise$.then(()=>na(O.$lazyInstance$));else{O.$flags$|=1;{let U=_;for(;U=U.parentNode||U.host;)if(U["s-p"]){wf(O,O.$ancestorComponent$=U);break}}N.$members$&&Object.entries(N.$members$).map(([U,[W]])=>{if(31&W&&_.hasOwnProperty(U)){const V=_[U];delete _[U],_[U]=V}}),Sg(_,O,N)}}})(this))}disconnectedCallback(){$e.jmp(()=>(async _=>{if(!(1&$e.$flags$)){const O=yn(_);O!=null&&O.$lazyInstance$?lu(O.$lazyInstance$):O!=null&&O.$onReadyPromise$&&O.$onReadyPromise$.then(()=>lu(O.$lazyInstance$))}})(this))}componentOnReady(){return yn(this).$onReadyPromise$}};w.$lazyBundleId$=f[0],i.includes(p)||o.get(p)||(r.push(p),o.define(p,Cf(k,w,1)))})}),r.length>0&&(h&&(c.textContent+=uf),c.textContent+=r.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",c.innerHTML.length)){c.setAttribute("data-styles","");const f=(n=$e.$nonce$)!=null?n:ff(It);f!=null&&c.setAttribute("nonce",f),s.insertBefore(c,a?a.nextSibling:s.firstChild)}d=!1,l.length?l.map(f=>f.connectedCallback()):$e.jmp(()=>u=setTimeout(Ef,30))};(function(){if(typeof window<"u"&&window.Reflect!==void 0&&window.customElements!==void 0){var t=HTMLElement;window.HTMLElement=function(){return Reflect.construct(t,[],this.constructor)},HTMLElement.prototype=t.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,t)}})();var xg=Object.freeze({__proto__:null,defineCustomElements:async(t,e)=>{if(typeof window<"u")return await void 0,kg([["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"]}]]]],e)},setNonce:t=>$e.$nonce$=t});const Ag={fontFamily:"Roboto, sans-serif"},za=({className:t},e)=>P("div",{style:Ag,class:t},e),ys=({Icon:t,text:e})=>P("div",{class:"flexContainer",style:{padding:"6",flexDirection:"row"}},P("div",{class:"flexItem1"},P(t,null)),P("div",{class:"flexItem11"},P("span",{style:{lineHeight:"2",color:"black"}},e))),Mg=()=>P("svg",{width:"20",height:"18",viewBox:"0 0 20 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},P("path",{d:"M20.0002 7.9702V10.0302C20.0002 10.5802 19.5602 11.0302 19.0002 11.0502H17.0402C15.9602 11.0502 14.9702 10.2602 14.8802 9.1802C14.8202 8.5502 15.0602 7.9602 15.4802 7.5502
34C15.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"}),P("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"})),Tg=()=>P("svg",{width:"20",height:"18",viewBox:"0 0 20 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},P("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"})),Rg=()=>P("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},P("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"})),Og=()=>P("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},P("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"}),P("path",{d:"M12 2V14.88",stroke:"white","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("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 qa({version:t}){return P("div",{style:{textAlign:"center",color:"#BBC0C5",fontSize:"12"}},"SDK Version ",t?`v${t}`:"unknown")}const Va=()=>P("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},P("rect",{width:"16",height:"16",fill:"white"}),P("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.40554 2.40554C2.94627 1.86482 3.82296 1.86482 4.36369 2.40554L8 6.04186L11.6363 2.40554C12.177 1.86482 13.0537 1.86482 13.5945 2.40554C14.1352 2.94627 14.1352 3.82296 13.5945 4.36369L9.95814 8L13.5945 11.6363C14.1352 12.177 14.1352 13.0537 13.5945 13.5945C13.0537 14.1352 12.177 14.1352 11.6363 13.5945L8 9.95814L4.36369 13.5945C3.82296 14.1352 2.94627 14.1352 2.40554 13.5945C1.86482 13.0537 1.86482 12.177 2.40554 11.6363L6.04186 8L2.40554 4.36369C1.86482 3.82296 1.86482 2.94627 2.40554 2.40554Z",fill:"#BBC0C5"})),Wa=()=>P("svg",{width:"273",height:"51",viewBox:"0 0 273 51",fill:"none",xmlns:"http://www.w3.org/2000/svg"},P("path",{d:"M240.882 25.9263C239.472 24.997 237.916 24.3361 236.443 23.5101C235.489 22.9731 234.473 22.4982 233.643 21.8167C232.233 20.6602 232.524 18.3885 233.996 17.3973C236.112 15.993 239.617 16.7777 239.99 19.6483C239.99 19.7102 240.052 19.7515 240.114 19.7515H243.308C243.391 19.7515 243.454 19.6896 243.433 19.607C243.267 17.6244 242.5 15.9723 241.089 14.9191C239.741 13.9072 238.206 13.3702 236.568 13.3702C228.127 13.3702 227.359 22.271 231.901 25.0796C232.42 25.41 236.879 27.6404 238.455 28.611C240.032 29.5816 240.529 31.3576 239.845 32.7619C239.223 34.0423 237.605 34.9303 235.987 34.8271C234.224 34.7238 232.855 33.7738 232.378 32.2869C232.295 32.0185 232.254 31.5022 232.254 31.275C232.254 31.2131 232.192 31.1511 232.129 31.1511H228.666C228.604 31.1511 228.541 31.2131 228.541 31.275C228.541 33.7738 229.164 35.1575 230.864 36.4172C232.461 37.615 234.203 38.1106 236.008 38.1106C240.737 38.1106 243.184 35.4466 243.682 32.6793C244.117 29.974 243.308 27.5371 240.882 25.9263Z",fill:"#24292E"}),P("path",{d:"M90.4943 13.8246H88.9595H87.2795C87.2173 13.8246 87.1758 13.8659 87.1551 13.9072L84.3
34137 23.2416C84.2722 23.3655 84.1063 23.3655 84.0648 23.2416L81.2234 13.9072C81.2026 13.8452 81.1612 13.8246 81.0989 13.8246H79.419H77.8842H75.8102C75.748 13.8246 75.6857 13.8865 75.6857 13.9485V37.7802C75.6857 37.8422 75.748 37.9041 75.8102 37.9041H79.2738C79.336 37.9041 79.3982 37.8422 79.3982 37.7802V19.6689C79.3982 19.5244 79.6056 19.5037 79.6471 19.6276L82.5093 29.024L82.7167 29.6849C82.7374 29.7468 82.7789 29.7675 82.8411 29.7675H85.4959C85.5581 29.7675 85.5996 29.7262 85.6203 29.6849L85.8277 29.024L88.6899 19.6276C88.7313 19.4831 88.9387 19.5244 88.9387 19.6689V37.7802C88.9387 37.8422 89.001 37.9041 89.0632 37.9041H92.5268C92.589 37.9041 92.6513 37.8422 92.6513 37.7802V13.9485C92.6513 13.8865 92.589 13.8246 92.5268 13.8246H90.4943Z",fill:"#24292E"}),P("path",{d:"M187.849 13.8246C187.787 13.8246 187.745 13.8659 187.725 13.9072L184.883 23.2416C184.842 23.3655 184.676 23.3655 184.634 23.2416L181.793 13.9072C181.772 13.8452 181.731 13.8246 181.668 13.8246H176.4C176.338 13.8246 176.276 13.8865 176.276 13.9485V37.7802C176.276 37.8422 176.338 37.9041 176.4 37.9041H179.864C179.926 37.9041 179.988 37.8422 179.988 37.7802V19.6689C179.988 19.5244 180.196 19.5037 180.237 19.6276L183.099 29.024L183.307 29.6849C183.328 29.7468 183.369 29.7675 183.431 29.7675H186.086C186.148 29.7675 186.19 29.7262 186.211 29.6849L186.418 29.024L189.28 19.6276C189.322 19.4831 189.529 19.5244 189.529 19.6689V37.7802C189.529 37.8422 189.591 37.9041 189.653 37.9041H193.117C193.179 37.9041 193.241 37.8422 193.241 37.7802V13.9485C193.241 13.8865 193.179 13.8246 193.117 13.8246H187.849Z",fill:"#24292E"}),P("path",{d:"M143.174 13.8246H136.724H133.261H126.81C126.748 13.8246 126.686 13.8865 126.686 13.9485V16.9223C126.686 16.9843 126.748 17.0462 126.81 17.0462H133.136V37.7802C133.136 37.8422 133.198 37.9041 133.261 37.9041H136.724C136.786 37.9041 136.849 37.8422 136.849 37.7802V17.0462H143.174C143.237 17.0462 143.299 16.9843 143.299 16.9223V13.9485C143.299 13.8865 143.257 13.8246 143.174 13.8246Z",fill:"#24292E"}),P("path",{d:"M163.604 37.9041H166.756C166.839 37.9041 166.901 37.8215 166.881 37.7389L160.368 13.8245C160.347 13.7626 160.306 13.7419 160.244 13.7419H159.041H156.925H155.722C155.66 13.7419 155.619 13.7832 155.598 13.8245L149.085 37.7389C149.065 37.8215 149.127 37.9041 149.21 37.9041H152.362C152.425 37.9041 152.466 37.8628 152.487 37.8215L154.374 30.862C154.395 30.8 154.436 30.7794 154.499 30.7794H161.467C161.53 30.7794 161.571 30.8207 161.592 30.862L163.479 37.8215C163.5 37.8628 163.562 37.9041 163.604 37.9041ZM155.328 27.3719L157.859 18.0581C157.9 17.9342 158.066 17.9342 158.107 18.0581L160.638 27.3719C160.659 27.4545 160.596 27.5371 160.513 27.5371H155.453C155.37 27.5371 155.308 27.4545 155.328 27.3719Z",fill:"#24292E"}),P("path",{d:"M217.362 37.9041H220.515C220.598 37.9041 220.66 37.8215 220.639 37.7389L214.127 13.8245C214.106 13.7626 214.065 13.7419 214.002 13.7419H212.8H210.684H209.481C209.419 13.7419 209.377 13.7832 209.357 13.8245L202.844 37.7389C202.823 37.8215 202.886 37.9041 202.969 37.9041H206.121C206.183 37.9041 206.225 37.8628 206.246 37.8215L208.133 30.862C208.154 30.8 208.195 30.7794 208.257 30.7794H215.226C215.288 30.7794 215.33 30.8207 215.351 30.862L217.238 37.8215C217.259 37.8628 217.3 37.9041 217.362 37.9041ZM209.087 27.3719L211.617 18.0581C211.659 17.9342 211.825 17.9342 211.866 18.0581L214.397 27.3719C214.417 27.4545 214.355 27.5371 214.272 27.5371H209.211C209.129 27.5371 209.066 27.4545 209.087 27.3719Z",fill:"#24292E"}),P("path",{d:"M106.713 34.3727V26.9795C106.713 26.9176 106.775 26.8556 106.837 26.8556H116.067C116.129 26.8556 116.191 26.7936 116.191 26.7317V23.7579C116.191 23.6959 116.129 23.634 116.067 23.634H106.837C106.775 23.634 106.713 23.572 106.713 23.5101V17.1907C106.713 17.1288 106.775 17.0668 106.837 17.0668H117.332C117.394 17.0668 117.457 17.0049 117.457 16.9429V13.9691C117.457 13.9072 117.394 13.8452 117.332 13.8452H106.713H103.125C103.063 13.8452 103.001 13.9072 103.001 13.9691V17.0668V23.6546V26.8763V34.5173V37.7802C103.001 37.8422 103.063 37.9041 103.125 37.9041H106.713H117.768C117.83 37.9041 117.892 37.8422 117.892 37.7802V34.6412C117.892 34.5792 117.83 34.5173 117.768 34.5173H106.817C106.755 34.4966 106.713 34.4553 106.713 34.3727Z",fill:"#24292E"}),P("path",{d:"M272.532 37.6976L260.544 25.3687C260.502 25.3274 260.502 25.2448 260.544 25.2035L271.329 14.0517C271.412 13.9691 271.349 13.8452 271.246 13.8452H266.828C266.787 13.8452 266.766 13.8659 266.745 13.8865L257.599 23.3449C257.516 23.4275 257.391 23.3655 257.391 23.2623V13.9691C257.391 13.9072 257.329 13.8452 257.267 13.8452H253.803C253.741 13.8452 253.679 13.9072 253.679 13.9691V37.8009C253.679 37.8628 253.741 37.9248 253.803 37.9248H257.267C257.329 37.9248 257.391 37.8628 257.391 37.8009V27.3099C257.391 27.2067 257.536 27.1447 257.599 27.2273L267.969 37.8835C267.989 37.9041 268.031 37.9248 268.052 37.9248H272.469C272.552 37.9041 272.615 37.7596 272.532 37.6976Z",fill:"#24292E"}
34),P("path",{d:"M52.021 1L31.0526 16.4886L34.9517 7.36063L52.021 1Z",fill:"#E17726",stroke:"#E17726","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M3.65491 1L24.4366 16.6331L20.7241 7.36063L3.65491 1Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M44.4716 36.9127L38.8925 45.4211L50.8389 48.7047L54.261 37.0986L44.4716 36.9127Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M1.43555 37.0986L4.83695 48.7047L16.7626 45.4211L11.2042 36.9127L1.43555 37.0986Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M16.1197 22.5395L12.8013 27.5371L24.6232 28.074L24.2292 15.3734L16.1197 22.5395Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M39.5561 22.5394L31.3222 15.2288L31.0526 28.0739L42.8746 27.537L39.5561 22.5394Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M16.7626 45.4212L23.918 41.9724L17.7582 37.1813L16.7626 45.4212Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M31.7578 41.9724L38.8925 45.4212L37.9177 37.1813L31.7578 41.9724Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M38.8923 45.4212L31.7577 41.9724L32.3384 46.5983L32.2762 48.5602L38.8923 45.4212Z",fill:"#D5BFB2",stroke:"#D5BFB2","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M16.7625 45.4212L23.3994 48.5602L23.3579 46.5983L23.9179 41.9724L16.7625 45.4212Z",fill:"#D5BFB2",stroke:"#D5BFB2","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M23.5239 34.1249L17.5922 32.3902L21.7818 30.4696L23.5239 34.1249Z",fill:"#233447",stroke:"#233447","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M32.1517 34.1249L33.8939 30.4696L38.1042 32.3902L32.1517 34.1249Z",fill:"#233447",stroke:"#233447","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M16.7626 45.4212L17.7996 36.9128L11.2042 37.0987L16.7626 45.4212Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M37.8761 36.9128L38.8924 45.4212L44.4715 37.0987L37.8761 36.9128Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M42.8745 27.5371L31.0526 28.074L32.1518 34.1249L33.894 30.4696L38.1042 32.3902L42.8745 27.5371Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M17.5922 32.3902L21.7817 30.4696L23.5239 34.1249L24.6232 28.074L12.8012 27.5371L17.5922 32.3902Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M12.8013 27.5371L17.7582 37.1813L17.5923 32.3902L12.8013 27.5371Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M38.1044 32.3902L37.9177 37.1813L42.8746 27.5371L38.1044 32.3902Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M24.6232 28.0741L23.524 34.125L24.9136 41.2703L25.2247 31.8533L24.6232 28.0741Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M31.0526 28.0741L30.4719 31.8327L30.7623 41.2703L32.1519 34.125L31.0526 28.0741Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M32.1519 34.1249L30.7623 41.2702L31.7578 41.9724L37.9177 37.1813L38.1043 32.3901L32.1519 34.1249Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M17.5922 32.3901L17.7581 37.1813L23.918 41.9724L24.9135 41.2702L23.5239 34.1249L17.5922 32.3901Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M32.2763 48.5602L32.3385 46.5983L31.7993 46.1439H23.8765L23.358 46.5983L23.3995 48.5602L16.7626 45.4211L19.0855 47.3211L23.7935 50.5633H31.8615L36.5903 47.3211L38.8924 45.4211L32.2763 48.5602Z",fill:"#C0AC9D",stroke:"#C0AC9D","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M31.7578 41.9724L30.7622 41.2703H24.9135L23.918 41.9724L23.358 46.5983L23.8765 46.144H31.7993L32.3385 46.5983L31.7578 41.9724Z",fill:"#24292E",stroke:"#24292E","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M52.9128 17.5005L54.6757 8.95079L52.021 1L31.7578 15.9723L39.5561 22.5394L50.5692 25.7404L52.9958 22.9111L51.938 22.147L53.618 20.6188L52.3321 19.6276L54.0121 18.3472L52.9128 17.5005Z",fill:"#763E1A",stroke:"#763E1A","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M1 8.95079L2.78366 17.5005L1.64295 18.3472L3.34365 19.6276L2.05775 20.6188L3.73771 22.147L2.67996 22.9111L5.10657 25.7404L16.1196 22.5394L23.918 15.9723L3.65475 1L1 8.95079Z",fill:"#763E1A",stroke:"#763E1A","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M50.5692 25.7404L39.5561 22.5394L42.8746 27.5371L37.9177 37.
341813L44.4716 37.0987H54.261L50.5692 25.7404Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M16.1196 22.5394L5.10651 25.7404L1.43549 37.0987H11.2041L17.7581 37.1813L12.8011 27.5371L16.1196 22.5394Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M31.0526 28.0741L31.7578 15.9724L34.9518 7.36072H20.7239L23.9179 15.9724L24.6231 28.0741L24.8927 31.8739L24.9135 41.2703H30.7622L30.783 31.8739L31.0526 28.0741Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}));function kn(t,e){return t.toString(2).padStart(e,"0")}function uu(t,e){const n=t%e;return n>=0?n:e+n}function st(t,e){return new Array(t).fill(e)}function du(...t){let e=0;for(const r of t)e=Math.max(e,r.length);const n=[];for(let r=0;r<e;r++)for(const i of t)r>=i.length||n.push(i[r]);return new Uint8Array(n)}function hu(t,e,n){if(n<0||n+e.length>t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[n+r])return!1;return!0}function fu(t){return{has:e=>t.includes(e),decode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="string")throw new Error("alphabet.decode input should be array of strings");return e.map(n=>{if(typeof n!="string")throw new Error(`alphabet.decode: not string element=${n}`);const r=t.indexOf(n);if(r===-1)throw new Error(`Unknown letter: "${n}". Allowed: ${t}`);return r})},encode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return e.map(n=>{if(function(r){if(!Number.isSafeInteger(r))throw new Error(`Wrong integer: ${r}`)}(n),n<0||n>=t.length)throw new Error(`Digit index outside alphabet: ${n} (alphabet: ${t.length})`);return t[n]})}}}class it{static size(e,n){if(typeof e=="number"&&(e={height:e,width:e}),!Number.isSafeInteger(e.height)&&e.height!==1/0)throw new Error(`Bitmap: wrong height=${e.height} (${typeof e.height})`);if(!Number.isSafeInteger(e.width)&&e.width!==1/0)throw new Error(`Bitmap: wrong width=${e.width} (${typeof e.width})`);return n!==void 0&&(e={width:Math.min(e.width,n.width),height:Math.min(e.height,n.height)}),e}static fromString(e){const n=(e=e.replace(/^\n+/g,"").replace(/\n+$/g,"")).split(` 35`),r=n.length,i=new Array(r);let o;for(const s of n){const a=s.split("").map(c=>{if(c==="X")return!0;if(c===" ")return!1;if(c!=="?")throw new Error(`Bitmap.fromString: unknown symbol=${c}`)});if(o&&a.length!==o)throw new Error(`Bitmap.fromString different row sizes: width=${o} cur=${a.length}`);o=a.length,i.push(a)}return o||(o=0),new it({height:r,width:o},i)}constructor(e,n){const{height:r,width:i}=it.size(e);this.data=n||Array.from({length:r},()=>st(i,void 0)),this.height=r,this.width=i}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};const{x:n,y:r}=this.xy(e);return{height:this.height-r,width:this.width-n}}xy(e){if(typeof e=="number"&&(e={x:e,y:e}),!Number.isSafeInteger(e.x))throw new Error(`Bitmap: wrong x=${e.x}`);if(!Number.isSafeInteger(e.y))throw new Error(`Bitmap: wrong y=${e.y}`);return e.x=uu(e.x,this.width),e.y=uu(e.y,this.height),e}rect(e,n,r){const{x:i,y:o}=this.xy(e),{height:s,width:a}=it.size(n,this.size({x:i,y:o}));for(let c=0;c<s;c++)for(let l=0;l<a;l++)this.data[o+c][i+l]=typeof r=="function"?r({x:l,y:c},this.data[o+c][i+l]):r;return this}rectRead(e,n,r){return this.rect(e,n,(i,o)=>(r(i,o),o))}hLine(e,n,r){return this.rect(e,{width:n,height:1},r)}vLine(e,n,r){return this.rect(e,{width:1,height:n},r)}border(e=2,n){const r=this.height+2*e,i=this.width+2*e,o=st(e,n),s=Array.from({length:e},()=>st(i,n));return new it({height:r,width:i},[...s,...this.data.map(a=>[...o,...a,...o]),...s])}embed(e,n){return this.rect(e,n.size(),({x:r,y:i})=>n.data[i][r])}rectSlice(e,n=this.size()){const r=new it(it.size(n,this.size(this.xy(e))));return this.rect(e,n,({x:i,y:o},s)=>r.data[o][i]=s),r}inverse(){const{height:e,width:n}=this;return new it({height:n,width:e}).rect({x:0,y:0},1/0,({x:r,y:i})=>this.data[r][i])}scale(e){if(!Number.isSafeInteger(e)||e>1024)throw new Error(`Wrong scale factor: ${e}`);const{height:n,width:r}=this;return new it({height:e*n,width:e*r}).rect({x:0,y:0},1/0,({x:i,y:o})=>this.data[Math.floor(o/e)][Math.floor(i/e)])}clone(){return new it(this.size()).rect({x:0,y:0},this.size(),({x:e,y:n})=>this.data[n][e])}
35assertDrawn(){this.rectRead(0,1/0,(e,n)=>{if(typeof n!="boolean")throw new Error("Invalid color type="+typeof n)})}toString(){return this.data.map(e=>e.map(n=>n===void 0?"?":n?"X":" ").join("")).join(` 36`)}toASCII(){const{height:e,width:n,data:r}=this;let i="";for(let o=0;o<e;o+=2){for(let s=0;s<n;s++){const a=r[o][s],c=o+1>=e||r[o+1][s];a||c?!a&&c?i+="â":a&&!c?i+="â":a&&c&&(i+=" "):i+="â"}i+=` 37`}return i}toTerm(){const e="\x1B[0m",n=`\x1B[1;47m ${e}`,r=`\x1B[40m ${e}`;return this.data.map(i=>i.map(o=>o?r:n).join("")).join(` 38`)}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:n,y:r},i)=>{i&&(e+=`<rect x="${n}" y="${r}" width="1" height="1" />`)}),e+="</svg>",e}toGIF(){const e=a=>[255&a,a>>>8&255],n=[...e(this.width),...e(this.height)],r=[];this.rectRead(0,1/0,(a,c)=>r.push(+(c===!0)));const i=126,o=[71,73,70,56,55,97,...n,246,0,0,255,255,255,...st(381,0),44,0,0,0,0,...n,0,7],s=Math.floor(r.length/i);for(let a=0;a<s;a++)o.push(127,128,...r.slice(i*a,i*(a+1)).map(c=>+c));return o.push(r.length%i+1,128,...r.slice(s*i).map(a=>+a)),o.push(1,129,0,59),new Uint8Array(o)}toImage(e=!1){const{height:n,width:r}=this.size(),i=new Uint8Array(n*r*(e?3:4));let o=0;for(let s=0;s<n;s++)for(let a=0;a<r;a++){const c=this.data[s][a]?0:255;i[o++]=c,i[o++]=c,i[o++]=c,e||(i[o++]=255)}return{height:n,width:r,data:i}}}const pu=["low","medium","quartile","high"],gu=["numeric","alphanumeric","byte","kanji","eci"],Lg=[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],Pg={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]},Ig={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]},ze={size:{encode:t=>21+4*(t-1),decode:t=>(t-17)/4},sizeType:t=>Math.floor((t+7)/17),alignmentPatterns(t){if(t===1)return[];const e=ze.size.encode(t)-6-1,n=e-6,r=Math.ceil(n/28);let i=Math.floor(n/r);i%2?i+=1:n%r*2>=r&&(i+=2);const o=[6];for(let s=1;s<r;s++)o.push(e-(r-s)*i);return o.push(e),o},ECCode:{low:1,medium:0,quartile:3,high:2},formatMask:21522,formatBits(t,e){const n=ze.ECCode[t]<<3|e;let r=n;for(let i=0;i<10;i++)r=r<<1^1335*(r>>9);return(n<<10|r)^ze.formatMask},versionBits(t){let e=t;for(let n=0;n<12;n++)e=e<<1^7973*(e>>11);return t<<12|e},alphabet:{numeric:fu("0123456789"),alphanumerc:fu("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:")},lengthBits:(t,e)=>({numeric:[10,12,14],alphanumeric:[9,11,13],byte:[8,16,16],kanji:[8,10,12],eci:[0,0,0]})[e][ze.sizeType(t)],modeBits:{numeric:"0001",alphanumeric:"0010",byte:"0100",kanji:"1000",eci:"0111"},capacity(t,e){const n=Lg[t-1],r=Pg[e][t-1],i=Ig[e][t-1],o=Math.floor(n/i)-r,s=i-n%i;return{words:r,numBlocks:i,shortBlocks:s,blockLen:o,capacity:8*(n-r*i),total:(r+o)*i+i-s}}},ra=[(t,e)=>(t+e)%2==0,(t,e)=>e%2==0,(t,e)=>t%3==0,(t,e)=>(t+e)%3==0,(t,e)=>(Math.floor(e/2)+Math.floor(t/3))%2==0,(t,e)=>t*e%2+t*e%3==0,(t,e)=>(t*e%2+t*e%3)%2==0,(t,e)=>((t+e)%2+t*e%3)%2==0],oe={tables:(t=>{const e=st(256,0),n=st(256,0);for(let r=0,i=1;r<256;r++)e[r]=i,n[i]=r,i<<=1,256&i&&(i^=285);return{exp:e,log:n}})(),exp:t=>oe.tables.exp[t],log(t){if(t===0)throw new Error(`GF.log: wrong arg=${t}`);return oe.tables.log[t]%255},mul:(t,e)=>t===0||e===0?0:oe.tables.exp[(oe.tables.log[t]+oe.tables.log[e])%255],add:(t,e)=>t^e,pow:(t,e)=>oe.tables.exp[oe.tables.log[t]*e%255],inv(t){if(t===0)throw new Error(`GF.inverse: wrong arg=${t}`);return oe.tables.exp[255-oe.tables.log[t]]},polynomial(t){if(t.length==0)throw new Error("GF.polymomial: wrong length");if(t[0]!==0)return t;let e=0;for(;e<t.length-1&&t[e]==0;e++);return t.slice(e)},monomial(t,e){if(t<0)throw new Error(`GF.monomial: wrong degree=${t}`);if(e==0)return[0];let n=st(t+1,0);return n[0]=e,oe.polynomial(n)},degree:t=>t.length-1,coefficient:(t,e)=>t[oe.degree(t)-e],mulPoly(t,e){if(t[0]===0||e[0]===0)return[0];const n=st(t.length+e.length-1,0);for(let r=0;r<t.length;r++)for(let i=0;i<e.length;i++)n[r+i]=oe.add(n[r+i],oe.mul(t[r],e[i]));return oe.polynomial(n)},mulPolyScalar(t,e){if(e==0)return[0];if(e==1)return t;const n=st(t.length,0);for(let r=0;r<t.length;r++)n[r]=oe.mul(t[r],e);return oe.polynomial(n)},mulPolyMonomial(t,e,n){if(e<0)throw new Error("GF.mulPolyMonomial: wrong degree");if(n==0)return[0];const r=st(t.length+e,0);for(let i=0;i<t.length;i++)r[i]=oe.mul(t[i],n);return oe.polynomial(r)},addPoly(t,e){if(t[0]===0)return e;if(e[0]===0)return t;let n=t,r=e;n.length>r.length&&([n,r]=[r,n]);let i=st(r.length,0),o=r.length-n.length,s=r.slice(0,o);for(let a=0;a<s.length;a++)i[a]=s[a];for(let a=o;a<r.length;a++)i[a]=oe.add(n[a-o],r[a]);return oe.polynomial(i)},remainderPoly(t,e){const n=Array.from(t);for(let r=0;r<t.length-e.length+1;r++){const i=n[r];if(i!==0)for(let o=1;o<e.length;o++)e[o]!==0&&(n[r+o]=oe.add(n[r+o],oe.mul(e[o],i)))}return n.slice(t.length-e.length+1,n.length)},divisorPoly(t){let e=[1];for(let n=0;n<t;n++)e=oe.mulPoly(e,[1,oe.pow(2,n)]);return e},evalPoly(t,e){if(e==0)return oe.coefficient(t,0);let n=t[0];for(let r=1;r<t.length;r++)n=oe.add(oe.mul(e,n),t[r]);return n},euclidian(t,e,n){oe.degree(t)<oe.degree(e)&&([t,e]=[e,t]);let r=t,i=e,o=[0],s=[1];for(;2*oe.degree(i)>=n;){let l=r,u=o;if(r=i,o=s,r[0]===0)throw new Error("rLast[0] === 0");i=l;let d=[0];const h=oe.inv(r[0]);for(;oe.degree(i)>=oe.degree(r)&&i[0]!==0;){const f=oe.degree(i)-oe.degree(r),g=oe.mul(i[0],h);d=oe.addPoly(d,oe.monomial(f,g)),i=oe.addPoly(i,oe.mulPolyMonomial(r,f,g))}if(d=oe.mulPoly(d,o),s=oe.addPoly(d,u),oe.degree(i)>=oe.degree(r))throw new Error(`Division failed r: ${i}, rLast: ${r}`)}const a=oe.coefficient(s,0);if(a==0)throw new Error("sigmaTilde(0) was zero");const c=oe.inv(a);return[oe.mulPolyScalar(s,c),oe.mulPolyScalar(i,c)]}};function Ng(t,e){const{words:n,shortBlocks:r,numBlocks:i,blockLen:o,total:s}=ze.capacity(t,e),a=(c=n,{encode(l){const u=oe.divisorPoly(c),d=Array.from(l);return d.push(...u.slice(0,-1).fill(0)),Uint8Array.from(oe.remainderPoly(d,u))},decode(l){const u=l.slice(),d=oe.polynomial(Array.from(l));let h=st(c,0),f=!1;for(let _=0;_<c;_++){const O=oe.evalPoly(d,oe.exp(_));h[h.length-1-_]=O,O!==0&&(f=!0)}if(!f)return u;h=oe.polynomial(h);const g=oe.monomial(c,1),[m,w]=oe.euclidian(g,h,c),p=st(oe.degree(m),0);let k=0;for(let _=1;_<256&&k<p.length;_++)oe.evalPoly(m,_)===0&&(p[k++]=oe.inv(_));if(k!==p.length)throw new Error("RS.decode: wrong errors number");for(let _=0;_<p.length;_++){const O=u.length-1-oe.log(p[_]);if(O<0)throw new Error("RS.decode: wrong error location");const N=oe.inv(p[_]);let U=1;for(let W=0;W<p.length;W++)_!==W&&(U=oe.mul(U,oe.add(1,oe.mul(p[W],N))));u[O]=oe.add(u[O],oe.mul(oe.evalPoly(w,N),oe.inv(U)))}return u}});var c;return{encode(l){const u=[],d=[];for(let m=0;m<i;m++){const w=o+(m<r?0:1);u.push(l.subarray(0,w)),d.push(a.encode(l.subarray(0,w))),l=l.subarray(w)}const h=du(...u),f=du(...d),g=new Uint8Array(h.length+f.length);return g.set(h),g.set(f,h.length),g},decode(l){if(l.length!==s)throw new Error(`interleave.decode: len(data)=${l.length}, total=${s}`);const u=[];for(let f=0;f<i;f++){const g=f<r;u.push(new Uint8Array(n+o+(g?0:1)))}let d=0;for(let f=0;f<o;f++)for(let g=0;g<i;g++)u[g][f]=l[d++];for(let f=r;f<i;f++)u[f][o]=l[d++];for(let f=o;f<o+n;f++)for(let g=0;g<i;g++){const m=g<r;u[g][f+(m?0:1)]=l[d++]}const h=[];for(const f of u)h.push(...Array.from(a.decode(f)).slice(0,-n));return Uint8Array.from(h)}}}function mu(t,e,n,r){let i="",o=n.length;if(r==="numeric"){const d=ze.alphabet.numeric.decode(n.split("")),h=d.length;for(let f=0;f<h-2;f+=3)i+=kn(100*d[f]+10*d[f+1]+d[f+2],10);h%3==1?i+=kn(d[h-1],4):h%3==2&&(i+=kn(10*d[h-2]+d[h-1],7))}
38else if(r==="alphanumeric"){const d=ze.alphabet.alphanumerc.decode(n.split("")),h=d.length;for(let f=0;f<h-1;f+=2)i+=kn(45*d[f]+d[f+1],11);h%2==1&&(i+=kn(d[h-1],6))}else{if(r!=="byte")throw new Error("encode: unsupported type");{const d=function(h){if(typeof h!="string")throw new Error("utf8ToBytes expected string, got "+typeof h);return new Uint8Array(new TextEncoder().encode(h))}(n);o=d.length,i=Array.from(d).map(h=>kn(h,8)).join("")}}const{capacity:s}=ze.capacity(t,e),a=kn(o,ze.lengthBits(t,r));let c=ze.modeBits[r]+a+i;if(c.length>s)throw new Error("Capacity overflow");c+="0".repeat(Math.min(4,Math.max(0,s-c.length))),c.length%8&&(c+="0".repeat(8-c.length%8));const l="1110110000010001";for(let d=0;c.length!==s;d++)c+=l[d%16];const u=Uint8Array.from(c.match(/(.{8})/g).map(d=>+`0b${d}`));return Ng(t,e).encode(u)}function yu(t,e,n,r,i=!1){const o=function(c,l,u,d=!1){const h=ze.size.encode(c);let f=new it(h+2);const g=new it(3).rect(0,3,!0).border(1,!1).border(1,!0).border(1,!1);f=f.embed(0,g).embed({x:-g.width,y:0},g).embed({x:0,y:-g.height},g),f=f.rectSlice(1,h);const m=new it(1).rect(0,1,!0).border(1,!1).border(1,!0),w=ze.alignmentPatterns(c);for(const p of w)for(const k of w)f.data[p][k]===void 0&&f.embed({x:k-2,y:p-2},m);f=f.hLine({x:0,y:6},1/0,({x:p},k)=>k===void 0?p%2==0:k).vLine({x:6,y:0},1/0,({y:p},k)=>k===void 0?p%2==0:k);{const p=ze.formatBits(l,u),k=_=>!d&&(p>>_&1)==1;for(let _=0;_<6;_++)f.data[_][8]=k(_);for(let _=6;_<8;_++)f.data[_+1][8]=k(_);for(let _=8;_<15;_++)f.data[h-15+_][8]=k(_);for(let _=0;_<8;_++)f.data[8][h-_-1]=k(_);for(let _=8;_<9;_++)f.data[8][15-_-1+1]=k(_);for(let _=9;_<15;_++)f.data[8][15-_-1]=k(_);f.data[h-8][8]=!d}if(c>=7){const p=ze.versionBits(c);for(let k=0;k<18;k+=1){const _=!d&&(p>>k&1)==1,O=Math.floor(k/3),N=k%3+h-8-3;f.data[O][N]=_,f.data[N][O]=_}}return f}(t,e,r,i);let s=0;const a=8*n.length;if(function(c,l,u){const d=c.height,h=ra[l];let f=-1,g=d-1;for(let m=d-1;m>0;m-=2){for(m==6&&(m=5);;g+=f){for(let w=0;w<2;w+=1){const p=m-w;c.data[g][p]===void 0&&u(p,g,h(p,g))}if(g+f<0||g+f>=d)break}f=-f}}(o,r,(c,l,u)=>{let d=!1;s<a&&(d=(n[s>>>3]>>(7-s&7)&1)!=0,s++),o.data[l][c]=d!==u}),s!==a)throw new Error("QR: bytes left after draw");return o}function Bg(t){const e=t.inverse(),n=f=>{let g=0;for(let m,w=0,p=1;w<f.length;w++)m===f[w]&&(p++,w!==f.length-1)||(p>=5&&(g+=p-5+3),m=f[w],p=1);return g};let r=0;t.data.forEach(f=>r+=n(f)),e.data.forEach(f=>r+=n(f));let i=0,o=t.data;const s=t.width-1,a=t.height-1;for(let f=0;f<s;f++)for(let g=0;g<a;g++){const m=f+1,w=g+1;o[f][g]===o[m][g]&&o[m][g]===o[f][w]&&o[m][g]===o[m][w]&&(i+=3)}const c=f=>{const g=[!0,!1,!0,!0,!0,!1,!0],m=[!1,!1,!1,!1],w=[...g,...m],p=[...m,...g];let k=0;for(let _=0;_<f.length;_++)hu(f,w,_)&&(k+=40),hu(f,p,_)&&(k+=40);return k};let l=0;for(const f of t.data)l+=c(f);for(const f of e.data)l+=c(f);let u=0;t.rectRead(0,1/0,(f,g)=>u+=g?1:0);const d=u/(t.height*t.width)*100,h=10*Math.floor(Math.abs(d-50)/5);return r+i+l+h}function Sf(t,e="raw",n={}){const r=n.ecc!==void 0?n.ecc:"medium";(function(u){if(!pu.includes(u))throw new Error(`Invalid error correction mode=${u}. Expected: ${pu}`)})(r);const i=n.encoding!==void 0?n.encoding:function(u){let d="numeric";for(let h of u)if(!ze.alphabet.numeric.has(h)&&(d="alphanumeric",!ze.alphabet.alphanumerc.has(h)))return"byte";return d}(t);(function(u){if(!gu.includes(u))throw new Error(`Encoding: invalid mode=${u}. Expected: ${gu}`);if(u==="kanji"||u==="eci")throw new Error(`Encoding: ${u} is not supported (yet?).`)})(i),n.mask!==void 0&&function(u){if(![0,1,2,3,4,5,6,7].includes(u)||!ra[u])throw new Error(`Invalid mask=${u}. Expected number [0..7]`)}(n.mask);let o,s=n.version,a=new Error("Unknown error");if(s!==void 0)(function(u){if(!Number.isSafeInteger(u)||u<1||u>40)throw new Error(`Invalid version=${u}. Expected number [1..40]`)})(s),o=mu(s,r,t,i);else for(let u=1;u<=40;u++)try{o=mu(u,r,t,i),s=u;break}catch(d){a=d}if(!s||!o)throw a;let c=function(u,d,h,f){if(f===void 0){const g=function(){let m,w=1/0;return{add(p,k){p>=w||(m=k,w=p)},get:()=>m,score:()=>w}}();for(let m=0;m<ra.length;m++)g.add(Bg(yu(u,d,h,m,!0)),m);f=g.get()}if(f===void 0)throw new Error("Cannot find mask");return yu(u,d,h,f)}(s,r,o,n.mask);c.assertDrawn();const l=n.border===void 0?2:n.border;if(!Number.isSafeInteger(l))throw new Error("Wrong border type="+typeof l);if(c=c.border(l,!1),n.scale!==void 0&&(c=c.scale(n.scale)),e==="raw")return c.data;if(e==="ascii")return c.toASCII();if(e==="svg")return c.toSVG();if(e==="gif")return c.toGIF();if(e==="term")return c.toTerm();throw new Error(`Unknown output: ${e}`)}const vs={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 Ga{constructor(e){var n;this.translations=vs,this.supportedLocales=["es","fr","he","it","pt","tr"],this.baseUrl=(n=e==null?void 0:e.baseUrl)!==null&&n!==void 0?n:"https://raw.githubusercontent.com/MetaMask/metamask-sdk/refs/heads/gh-pages/locales"}getBrowserLanguage(){if((navigator.languages||[navigator.language]).some(n=>n.toLowerCase().startsWith("en")))return"en";const e=navigator.language.toLowerCase().split("-")[0];return this.supportedLocales.includes(e)?e:"en"}async init(e){const n=this.getBrowserLanguage()||e.fallbackLng;await this.loadTranslations(n)}async loadTranslations(e){const n=e.split("-")[0];if(n!=="en"&&this.supportedLocales.includes(n))try{const r=`${this.baseUrl}/${n}.json`,i=await fetch(r);if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);this.translations=await i.json()}catch(r){console.warn(`â Failed to load ${n} translations, falling back to English:`,r),this.translations=vs}else this.translations=vs}t(e){return this.getNestedTranslation(e,this.translations)||e}getNestedTranslation(e,n){const r=e.split(".");let i=n;for(const o of r){if(typeof i!="object")return"";i=i[o]}return typeof i=="string"?i:""}}var Tr;(function(t){t.SDK_MODAL_VIEWED="sdk_modal_viewed",t.SDK_MODAL_BUTTON_CLICKED="sdk_modal_button_clicked",t.SDK_MODAL_TOGGLE_CHANGED="sdk_modal_toggle_changed"})(Tr||(Tr={}));const kf=class{constructor(t){Da(this,t),this.close=wn(this,"close",7),this.startDesktopOnboarding=wn(this,"startDesktopOnboarding",7),this.trackAnalytics=wn(this,"trackA
38nalytics",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 Ga}componentDidLoad(){this.trackAnalytics.emit({event:Tr.SDK_MODAL_VIEWED,params:{extensionInstalled:!1,tab:this.tab===1?"desktop":"mobile"}})}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}updatePreferDesktop(t){t?this.setTab(1):this.setTab(2)}onClose(t=!1){this.close.emit({shouldTerminate:t})}onStartDesktopOnboardingHandler(){this.trackAnalytics.emit({event:Tr.SDK_MODAL_BUTTON_CLICKED,params:{button_type:"install_extension",tab:"desktop"}}),this.startDesktopOnboarding.emit()}setTab(t,e=!1){e&&this.trackAnalytics.emit({event:Tr.SDK_MODAL_TOGGLE_CHANGED,params:{toggle:this.tab===1?"desktop_to_mobile":"mobile_to_desktop"}}),this.tab=t,this.isDefaultTab=!1}render(){if(!this.translationsLoaded)return null;const t=r=>this.i18nInstance.t(r),e=this.isDefaultTab?this.preferDesktop?1:2:this.tab,n=Sf(this.link,"svg",{ecc:"medium",scale:2});return P(za,{className:"install-model"},P("div",{class:"backdrop",onClick:()=>this.onClose(!0)}),P("div",{class:"modal"},P("div",{class:"closeButtonContainer"},P("div",{class:"right"},P("span",{class:"closeButton",onClick:()=>this.onClose(!0)},P(Va,null)))),P("div",{class:"logoContainer"},P(Wa,null)),P("div",null,P("div",{class:"tabcontainer"},P("div",{class:"flexContainer"},P("div",{onClick:()=>this.setTab(1,!0),class:"tab flexItem "+(e===1?"tabactive":"")},t("DESKTOP")),P("div",{onClick:()=>this.setTab(2,!0),class:"tab flexItem "+(e===2?"tabactive":"")},t("MOBILE")))),P("div",{style:{display:e===1?"none":"block"}},P("div",{class:"flexContainer"},P("div",{class:"flexItem",style:{textAlign:"center",marginTop:"4"}},n&&P("div",{id:"sdk-mm-qrcode",class:"center",innerHTML:n}),P("div",{class:"connectMobileText"},t("SCAN_TO_CONNECT")," ",P("br",null),P("span",{class:"blue"},P("b",null,t("META_MASK_MOBILE_APP"))))))),P("div",{style:{display:e===2?"none":"block"}},P("div",{class:"item"},P(ys,{Icon:Tg,text:t("INSTALL_MODAL.TRUSTED_BY_USERS")})),P("div",{class:"item"},P(ys,{Icon:Mg,text:t("INSTALL_MODAL.LEADING_CRYPTO_WALLET")})),P("div",{class:"item"},P(ys,{Icon:Rg,text:t("INSTALL_MODAL.CONTROL_DIGITAL_INTERACTIONS")})),P("button",{class:"button",onClick:()=>this.onStartDesktopOnboardingHandler()},P(Og,null),P("span",{class:"installExtensionText"},t("INSTALL_MODAL.INSTALL_META_MASK_EXTENSION"))))),P(qa,{version:this.sdkVersion})))}get el(){return ko(this)}static get watchers(){return{preferDesktop:["updatePreferDesktop"]}}};kf.style=`.flexContainer { 39 display: flex; 40 justify-content: center; 41 align-items: center; 42 flex-direction: row; 43} 44 45.flexItem { 46 flex: 1; 47 justify-content: center; 48 align-items: center; 49} 50 51.flexItem11 { 52 flex: 11; 53 justify-content: center; 54 align-items: center; 55} 56 57.flexItem1 { 58 flex: 1; 59 justify-content: center; 60 align-items: center; 61} 62 63.tab { 64 padding: 8px; 65 cursor: pointer; 66 background-color: #F2F4F6; 67 font-size: 12px; 68 text-align: center; 69 color: #24292E; 70} 71 72.tabcontainer { 73 padding: 4px; 74 background-color: #F2F4F6; 75 border-radius: 8px; 76 margin-bottom: 30px; 77 margin-top: 30px; 78} 79 80.tabactive { 81 background-color: white; 82 -webkit-transition: background-color 300ms linear; 83 -ms-transition: background-color 300ms linear; 84 transition: background-color 300ms linear; 85 border-radius: 8px; 86} 87 88.item { 89 font-size: 12px; 90 margin-bottom: 16px; 91 border-radius: 8px; 92 padding: 10px; 93 border: 2px #F2F4F6 solid; 94 color: #24292E; 95} 96 97.extensionLabel { 98 font-style: normal; 99 font-weight: bold; 100 font-size: 14px; 101 text-align: cetner; 102 color: #24272A; 103} 104 105.notice { 106 font-size: 12px; 107 margin-left: 10px; 108 margin-right: 10px; 109 color: grey; 110} 111 112.button { 113 margin-top: 41.5px; 114 margin-bottom: 20px; 115 width: 100%; 116 display: flex; 117 flex-direction: row; 118 justify-content: center;
119 align-items: center; 120 padding: 12px 20px; 121 background: #037DD6; 122 border-radius: 32px; 123 color: white; 124 border: 0; 125 font-size: 14px; 126 cursor: pointer; 127} 128 129.backdrop { 130 visibility: visible; 131 position: fixed; 132 top: 0; 133 left: 0; 134 right: 0; 135 bottom: 0; 136 width: 100%; 137 z-index: 99998; 138 background: rgba(0, 0, 0, 0.87); 139 opacity: 0.3; 140} 141 142.modal { 143 visibility: visible; 144 position: fixed; 145 left: 50%; 146 transform: translate(-50%, -50%); 147 z-index: 99999; 148 background: white; 149 padding: 20px; 150 border-radius: 8px; 151 top: 50%; 152 max-width: 100%; 153 width: 460px; 154 min-width: 300px; 155 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; 156 -webkit-font-smoothing: antialiased; 157} 158 159.closeButton { 160 color: #BBC0C5; 161 cursor: pointer; 162} 163 164.logoContainer { 165 margin-left: 24px; 166 margin-right: 24px; 167 margin-top: 24px; 168 display: flex; 169 align-items: center; 170 justify-content: center; 171} 172 173.connectMobileText { 174 font-size: 14px; 175 color: black; 176 margin-top: 28px; 177 margin-bottom: 28px; 178 line-height: 2; 179} 180 181.blue { 182 color: #037DD6; 183 font-weight: 700; 184} 185 186.installExtensionText { 187 margin-left: 10px; 188} 189 190.center { 191 display: flex; 192 justify-content: center; 193 align-items: center; 194} 195 196.right { 197 display: flex; 198 align-items: center; 199 justify-content: right; 200} 201 202#sdk-mm-qrcode { 203 svg { 204 width: 50%; 205 } 206}`;const xf=class{constructor(t){Da(this,t),this.close=wn(this,"close",7),this.disconnect=wn(this,"disconnect",7),this.updateOTPValue=wn(this,"updateOTPValue",7),this.displayOTP=void 0,this.sdkVersion=void 0,this.otpCode=void 0,this.translationsLoaded=!1,this.i18nInstance=new Ga}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}onClose(){this.close.emit()}onDisconnect(){this.disconnect.emit()}onUpdateOTPValueHandler(t){this.updateOTPValue.emit({otpValue:t})}disconnectedCallback(){this.onClose()}render(){var t;if(!this.translationsLoaded)return null;const e=(t=this.displayOTP)===null||t===void 0||t,n=this.sdkVersion,r=i=>this.i18nInstance.t(i);return P(za,{className:"pending-modal"},P("div",{class:"backdrop",onClick:()=>this.onClose()}),P("div",{class:"modal"},P("div",{class:"closeButtonContainer"},P("div",{class:"right"},P("span",{class:"closeButton",onClick:()=>this.onClose()},P(Va,null)))),P("div",{class:"logoContainer"},P(Wa,null)),P("div",null,P("div",{class:"flexContainer",style:{flexDirection:"column",color:"black"}},P("div",{class:"flexItem",style:{textAlign:"center",marginTop:"30px",marginBottom:"30px",fontSize:"16px"}},r(e?"PENDING_MODAL.OPEN_META_MASK_SELECT_CODE":"PENDING_MODAL.OPEN_META_MASK_CONTINUE")),P("div",{id:"sdk-mm-otp-value",style:{padding:"10px",fontSize:"32px",display:this.otpCode?"block":"none"}},this.otpCode),e&&P("div",{class:"notice"},"* ",r("PENDING_MODAL.NUMBER_AFTER_OPEN_NOTICE"))),P("div",{style:{marginTop:"20px"}},P("button",{class:"button blue",style:{marginTop:"5px",color:"#0376C9",borderColor:"#0376C9",borderWidth:"1px",borderStyle:"solid",backgroundColor:"white"},onClick:()=>this.onDisconnect()},r("PENDING_MODAL.DISCONNECT")))),P(qa,{version:n})))}get el(){return ko(this)}};xf.style=`.flexContainer { 207 display: flex; 208 justify-content: center; 209 align-items: center; 210 flex-direction: row; 211} 212 213.flexItem { 214 flex: 1; 215 justify-content: center; 216 align-items: center; 217} 218 219.flexItem11 { 220 flex: 11; 221 justify-content: center; 222 align-items: center; 223} 224 225.flexItem1 { 226 flex: 1; 227 justify-content: center; 228 align-items: center; 229} 230 231.tab { 232 padding: 8px; 233 cursor: pointer; 234 background-color: #F2F4F6; 235 font-size: 12px; 236 text-align: center; 237 color: #24292E; 238} 239 240.tabcontainer { 241 padding: 4px; 242 background-color: #F2F4F6; 243 border-radius: 8px; 244 margin-bottom: 30px; 245 margin-top: 30px; 246} 247 248.tabactive { 249 background-color: white; 250 -webkit-transition: background-color 300ms linear; 251 -ms-transition: background-color 300ms linear; 252 transition: background-color 300ms linear; 253 border-radius: 8px; 254} 255 256.item { 257 font-size: 12px; 258 margin-bottom: 16px; 259 border-radius: 8px; 260 padding: 10px; 261 border: 2px #F2F4F6 solid; 262 color: #24292E; 263} 264 265.extensionLabel { 266 font-style: normal; 267 font-weight: bold; 268 font-size: 14px; 269 text-align: cetner; 270 color: #24272A; 271} 272 273.notice { 274 font-size: 12px; 275 margin-left: 10px; 276 margin-right: 10px; 277 color: grey; 278} 279 280.button { 281 margin-top: 41.5px; 282 margin-bottom: 20px; 283 width: 100%; 284 display: flex; 285 flex-direction: row; 286 justify-content: center;
287 align-items: center; 288 padding: 12px 20px; 289 background: #037DD6; 290 border-radius: 32px; 291 color: white; 292 border: 0; 293 font-size: 14px; 294 cursor: pointer; 295} 296 297.backdrop { 298 visibility: visible; 299 position: fixed; 300 top: 0; 301 left: 0; 302 right: 0; 303 bottom: 0; 304 width: 100%; 305 z-index: 99998; 306 background: rgba(0, 0, 0, 0.87); 307 opacity: 0.3; 308} 309 310.modal { 311 visibility: visible; 312 position: fixed; 313 left: 50%; 314 transform: translate(-50%, -50%); 315 z-index: 99999; 316 background: white; 317 padding: 20px; 318 border-radius: 8px; 319 top: 50%; 320 max-width: 100%; 321 width: 460px; 322 min-width: 300px; 323 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; 324 -webkit-font-smoothing: antialiased; 325} 326 327.closeButton { 328 color: #BBC0C5; 329 cursor: pointer; 330} 331 332.logoContainer { 333 margin-left: 24px; 334 margin-right: 24px; 335 margin-top: 24px; 336 display: flex; 337 align-items: center; 338 justify-content: center; 339} 340 341.connectMobileText { 342 font-size: 14px; 343 color: black; 344 margin-top: 28px; 345 margin-bottom: 28px; 346 line-height: 2; 347} 348 349.blue { 350 color: #037DD6; 351 font-weight: 700; 352} 353 354.installExtensionText { 355 margin-left: 10px; 356} 357 358.center { 359 display: flex; 360 justify-content: center; 361 align-items: center; 362} 363 364.right { 365 display: flex; 366 align-items: center; 367 justify-content: right; 368} 369 370#sdk-mm-qrcode { 371 svg { 372 width: 50%; 373 } 374}`;const Dg=()=>P("svg",{width:"21",height:"15",viewBox:"0 0 21 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},P("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"})),$g=()=>P("svg",{width:"400",height:"300",viewBox:"0 0 467 300",fill:"none",xmlns:"http://www.w3.org/2000/svg"},P("path",{d:"M312.387 280.629C312.549 280.583 312.247 280.735 312.387 280.629L339.678 260.425C340.088 260.118 340.132 259.156 340.07 258.647C340.008 258.138 339.573 258.257 339.106 258.084L311.712 247.455C311.292 247.301 311.308 247.402 310.939 247.673C310.569 247.944 310.356 248.21 310.356 248.672L310.459 279.504C310.461 280.025 311.163 280.619 311.614 280.847C311.913 280.996 312.072 280.718 312.387 280.629ZM336.204 259.736L312.979 276.292L313.439 251.139L336.204 259.736Z",fill:"url(#paint0_linear_1356_14057)"}),P("path",{d:"M324.639 260.342C324.358 259.547 323.485 258.91 322.707 259.215C319.6 260.432 318.17 262.313 317.287 264.066C316.482 265.665 316.197 267.482 314.188 268.269C312.178 269.055 310.763 268.663 309.162 268.007C307.406 267.287 305.504 266.182 302.397 267.399C299.289 268.616 297.859 270.497 296.976 272.25C296.171 273.849 295.697 274.886 293.685 275.673C291.675 276.459 290.261 276.067 288.659 275.411C286.903 274.691 284.999 273.587 281.894 274.803C278.789 276.019 277.549 278.681 276.666 280.434C275.861 282.034 275.386 283.07 273.374 283.857C272.596 284.161 271.931 285.055 272.211 285.849C272.492 286.644 273.365 287.281 274.143 286.977C277.25 285.76 278.68 283.879 279.563 282.125C280.368 280.526 280.65 278.71 282.662 277.923C284.672 277.136 286.087 277.528 287.688 278.184C289.444 278.904 291.348 280.009 294.453 278.793C297.561 277.576 298.991 275.695 299.874 273.941C300.679 272.342 301.153 271.306 303.165 270.519C305.175 269.732 306.589 270.124 308.191 270.78C309.947 271.5 311.849 272.605 314.956 271.388C318.063 270.172 319.301 267.511 320.184 265.757C320.989 264.158 321.466 263.121 323.476 262.335C324.254 262.032 324.919 261.137 324.639 260.342Z",fill:"url(#paint1_linear_1356_14057)"}),P("path",{d:"M389.034 111.124C388.968 112.406 387.342 113.113 386.324 113.549C384.297 114.419 382.089 114.493 379.942 114.5C376.607 114.509 373.215 114.163 369.89 113.976C366.712 113.798 363.156 113.311 360.03 114.232C357.705 114.919 355.667 116.762 353.452 117.739C351.129 118.765 348.957 119.198 346.489 119.687C335.569 121.85 323.587 120.825 312.656 119.977C311.92 119.92 312.539 118.997 313.237 118.981C313.207 118.815 313.001 118.394 313.045 118.201C313.086 118.029 312.781 117.586 312.853 117.421C312.67 117.198 313.316 117.427 313.626 117.204C315.912 115.557 318.721 114.79 321.363
374115.041C324.677 115.355 327.293 116.04 330.641 115.781C334.392 115.491 338.125 114.787 341.857 114.312C345.142 113.892 349.09 113.941 352.106 112.28C352.916 111.834 353.137 111.262 353.269 110.287C353.331 109.828 353.672 108.969 353.658 108.511C353.629 107.529 354.191 107.886 355.013 107.298C356.857 105.981 358.274 105.516 360.428 105.784C362.841 106.083 365.264 107.273 367.578 107.953C370.761 108.888 374.328 108.646 377.631 108.477C380.517 108.329 383.141 107.901 385.944 108.653C387.013 108.941 389.104 109.745 389.034 111.124Z",fill:"url(#paint2_linear_1356_14057)"}),P("path",{d:"M278.118 85.4414C280.313 83.8186 283.302 83.9 285.853 83.2728C290.501 82.127 295.644 78.4476 300.549 79.1524C301.299 79.2595 300.904 81.0355 300.159 80.9295C300.131 80.9256 300.187 80.9333 300.159 80.9295C300.089 81.0185 299.516 81.1051 299.385 81.1463C294.999 82.515 292.895 87.5083 289.126 89.8598C287.799 90.688 286.771 90.8351 285.258 90.9441C283.515 91.0691 280.964 90.5775 279.269 90.1219C277.15 89.5532 275.965 87.034 278.118 85.4414Z",fill:"url(#paint3_linear_1356_14057)"}),P("path",{d:"M122.567 166.093C113.597 172.832 104.535 179.836 99.517 190.092C98.5342 192.099 97.519 195.019 97.9533 197.204C98.9699 202.316 105.76 203.049 110.691 201.96C113.468 201.347 116.325 199.231 115.921 196.319C115.576 193.81 113.158 192.986 112.072 190.73C110.779 188.04 112.35 184.97 114.218 182.62C128.134 165.099 150.074 157.394 171.093 151.607C175.385 150.425 180.897 147.69 180.581 143.099C180.372 140.072 177.118 137.683 174.221 137.383C171.324 137.082 168.481 138.773 165.715 139.776C158.416 142.419 151.17 143.799 143.489 143.526C136.865 143.29 130.976 143.316 129.562 150.781C128.138 158.276 129.53 160.863 122.567 166.093Z",fill:"url(#paint4_linear_1356_14057)"}),P("path",{d:"M79.1056 153.531C60.3932 164.378 43.7478 178.354 32.8214 197.415C30.3313 201.76 27.9216 206.554 27.1821 211.512C26.4448 216.47 27.7591 222.525 30.8133 226.337C34.908 231.446 41.6938 232.915 48.1811 233.125C50.7248 233.208 53.0035 233.066 55.3316 231.947C57.6602 230.83 59.7548 228.359 59.5978 225.742C59.3303 221.315 54.5491 219.665 50.9271 217.34C42.6566 212.037 40.4958 199.493 44.2381 190.032C47.9803 180.57 55.8228 173.173 63.2316 166.338C67.229 162.651 71.5194 158.372 76.777 157.522C79.9167 157.015 83.4706 157.589 86.6295 157.252C93.9004 156.479 99.64 151.404 105.588 146.912C115.048 139.765 126.045 134.283 137.501 132.093C141.913 131.248 146.293 130.493 149.682 127.831C151.37 126.507 150.803 123.567 148.726 123.93C138.542 125.713 128.652 131.135 119.142 134.758C105.627 139.914 91.7133 146.223 79.1056 153.531Z",fill:"url(#paint5_linear_1356_14057)"}),P("path",{d:"M96.3677 117.321C96.0315 116.64 95.2914 116.612 94.6293 116.975C91.9858 118.417 91.5452 120.509 90.9466 122.178C90.4004 123.702 89.3647 124.67 87.6542 125.604C85.9437 126.538 85.0983 126.316 83.5956 125.91C81.9481 125.465 79.8603 125.424 77.2168 126.866C74.5734 128.309 74.1348 130.401 73.5341 132.07C72.9879 133.593 71.9522 134.562 70.2417 135.496C68.5313 136.43 67.6859 136.208 66.1832 135.801C64.5357 135.357 62.2569 134.538 59.6128 135.978C56.9694 137.42 56.5308 139.512 55.9301 141.181C55.3839 142.705 54.5398 144.454 52.8293 145.388C52.1667 145.748 52.1006 146.485 52.439 147.165C52.7752 147.845 53.5153 147.874 54.1773 147.511C56.8208 146.069 57.2594 143.977 57.86 142.307C58.4062 140.784 59.4419 139.815 61.1524 138.881C62.8629 137.948 63.7083 138.17 65.211 138.576C66.8585 139.021 68.9458 139.059 71.5898 137.619C74.2333 136.177 74.6718 134.085 75.2725 132.416C75.8187 130.892 76.8544 129.924 78.5649 128.99C80.2754 128.056 81.1207 128.278 82.6235 128.684C84.2709 129.129 86.5503 129.95 89.1938 128.507C91.8373 127.065 92.2779 124.973 92.8765 123.304C93.4227 121.78 94.2663 120.03 95.9773 119.098C96.6378 118.738 96.7039 118.001 96.3677 117.321Z",fill:"#FBC49D"}),P("path",{d:"M391.827 164.699C392.04 164.639 392.39 164.573 392.6 164.481C393.87 163.921 395.363 162.429 395.893 161.051C396.421 159.673 396.237 158.321 395.712 156.931C394.629 154.061 391.777 152.62 389.155 153.775C386.531 154.931 384.962 158.455 386.042 161.325C387.038 163.963 389.369 165.392 391.827 164.699ZM394.166 157.367C394.529 158.332 394.52 159.751 394.156 160.706C393.792 161.662 393.1 162.534 392.218 162.921C390.398 163.723 388.338 162.878 387.589 160.889C387.226 159.925 387.234 158.506 387.599 157.55C387.963 156.594 388.654 155.723 389.536 155.336C391.356 154.534 393.416 155.376 394.166 157.367Z",fill:"#86E29B"}),P("path",{d:"M62.7198 108.691C64.4912 108.191 66.6152 106.609 67.5596 104.824C68.4273 103.187 68.465 101.455 67.9609 99.7066C67.4547 97.9586 66.0792 96.5141 64.4963 95.6786C62.9135 94.843 61.2077 94.8578 59.4756 95.4255C57.7435 95.9933 56.2768 97.4364 55.409 99.074C53.6185 102.456 55.2032 106.494 58.4723 108.22C60.0142 109.035 61.1315 109.138 62.7198 108.691ZM60.6304 96.7682C61.819 96.4332 63.0232 96.8871 64.1048 97.4571C65.2463 98.0603 66.0495 98.8796 66.4145 100.142C66.7791 101.403 66.4488 103.299 65.8224 104.48C64.5299 106.919 61.2212 107.686 58.8638 106.441C56.5063 105.197 55.8538 101.858 57.1462 99.4185C57.7726 98.2375 58.6059 97.3957 59.8573 96.9862C59.9214 96.9635 60.5631 96.7872 60.6304 96.7682Z",fill:"#FFB0EB"}),P("path",{d:"M77.0217 242.979C75.9542 243.28 75.1664 242.151 74.9029 241.074C74.6394 239.996 75 239.378 76.0676 239.077C77.1351 238.776 78.5053 238.907 78.7688 239.984C79.0323 241.061 78.0893 242.678 77.0217 242.979Z",fill:"url(#paint6_linear_1356_14057)"}),P("path",{d:"M380.506 184.577C379.439 184.878 378.651 183.749 378.387 182.672C378.124 181.594 378.484 180.976 379.552 180.675C380.619 180.374 381.99 180.50
3745 382.253 181.582C382.517 182.659 381.574 184.276 380.506 184.577Z",fill:"url(#paint7_linear_1356_14057)"}),P("path",{d:"M348.82 246.969C347.752 247.27 346.382 247.14 346.119 246.063C345.855 244.985 346.798 243.369 347.866 243.068C348.933 242.767 349.721 243.896 349.985 244.973C350.248 246.05 349.888 246.669 348.82 246.969Z",fill:"url(#paint8_linear_1356_14057)"}),P("path",{d:"M140.419 282.412C139.351 282.713 138.754 282.365 138.491 281.288C138.227 280.21 138.397 278.812 139.464 278.511C140.532 278.21 142.093 279.121 142.357 280.198C142.62 281.275 141.486 282.111 140.419 282.412Z",fill:"url(#paint9_linear_1356_14057)"}),P("path",{d:"M121.462 101.679C120.395 101.979 119.798 101.631 119.534 100.554C119.271 99.4764 119.44 98.0779 120.508 97.777C121.575 97.4761 123.136 98.3868 123.4 99.4642C123.663 100.542 122.53 101.378 121.462 101.679Z",fill:"url(#paint10_linear_1356_14057)"}),P("path",{d:"M370.749 159.005C369.682 159.306 368.311 159.175 368.048 158.098C367.784 157.021 368.727 155.404 369.795 155.103C370.863 154.802 371.65 155.931 371.914 157.008C372.177 158.086 371.817 158.704 370.749 159.005Z",fill:"url(#paint11_linear_1356_14057)"}),P("path",{d:"M384.211 245.345C383.143 245.646 381.773 245.515 381.51 244.438C381.246 243.361 382.189 241.744 383.257 241.443C384.324 241.142 385.112 242.271 385.376 243.348C385.639 244.426 385.278 245.044 384.211 245.345Z",fill:"url(#paint12_linear_1356_14057)"}),P("path",{d:"M364.771 41.3873C363.063 41.8687 361.337 40.8616 360.915 39.1378C360.493 37.414 361.536 35.6263 363.244 35.1449C364.953 34.6634 366.679 35.6706 367.101 37.3944C367.522 39.1182 366.479 40.9059 364.771 41.3873Z",fill:"url(#paint13_linear_1356_14057)"}),P("path",{d:"M404.311 77.905C404.602 77.8231 404.875 77.9236 405.084 77.6871C405.437 77.2908 404.814 76.6385 404.703 76.1265L401.277 58.7418C401.149 58.163 400.687 57.5371 400.123 57.3991C399.558 57.2611 398.969 57.3812 398.576 57.835L385.784 73.1179C385.395 73.564 385.199 74.3453 385.393 74.8964C385.585 75.4481 385.978 76.1646 386.548 76.2391L403.538 78.123C403.744 78.1479 404.114 77.9607 404.311 77.905ZM398.948 62.7348L401.811 74.4394L389.841 72.8085L398.948 62.7348Z",fill:"#FFB0EB"}),P("path",{d:"M97.5393 295.311C97.7108 295.263 97.4284 295.461 97.5393 295.311L108.785 280.464C108.975 280.211 108.718 279.972 108.594 279.684C108.47 279.396 108.124 279.917 107.821 279.902L88.5106 278.672C88.2101 278.659 87.895 278.62 87.7374 278.89C87.5798 279.159 87.7755 279.402 87.9283 279.67L96.5753 294.749C96.7102 294.99 97.2696 295.297 97.5393 295.311C97.6283 295.319 97.4556 295.335 97.5393 295.311ZM106.465 281.118L96.9667 292.97L90.6295 280.577L106.465 281.118Z",fill:"#86E29B"}),P("path",{d:"M393.699 108.848C389.518 104.446 414.629 114.366 413.945 120.659C413.259 126.952 401.355 129.102 403.894 123.491C406.042 118.747 400.376 115.876 393.699 108.848Z",fill:"#FBC49D"}),P("path",{d:"M139.414 115.959C139.434 115.953 139.392 115.965 139.414 115.959C141.963 115.2 143.436 111.976 142.717 109.189C142.37 107.839 141.526 107.199 140.408 106.504C139.289 105.808 138.171 105.449 136.933 105.815C135.698 106.182 134.85 107.033 134.222 108.247C133.595 109.461 133.282 111.234 133.63 112.585C133.978 113.935 134.821 114.574 135.94 115.27C137.04 115.952 138.199 116.301 139.414 115.959ZM137.315 107.375C138.222 107.12 139.005 106.994 139.825 107.502C140.661 108.02 140.912 108.618 141.171 109.625C141.708 111.704 140.935 113.834 139.032 114.398C138.11 114.675 137.356 114.791 136.522 114.272C135.686 113.753 135.436 113.155 135.176 112.149C134.917 111.142 134.718 109.714 135.186 108.81C135.654 107.905 136.394 107.649 137.315 107.375C137.329 107.371 137.299 107.38 137.315 107.375Z",fill:"#75C4FD"}),P("path",{d:"M308.981 78.7519C310.052 78.4043 311.158 78.7096 312.265 78.6613C313.655 78.6006 314.936 78.517 316.323 78.3531C319.497 77.9795 322.798 77.4906 325.984 77.3012C329.309 77.1025 332.514 76.8551 335.836 77.0295C338.809 77.1842 342.163 77.3405 345.105 77.7558C352.129 78.7468 359.331 79.0578 366.347 80.1158C372.252 81.008 377.93 82.1319 383.722 83.5644C385.925 84.0054 388.267 85.0754 389.126 85.3792C389.421 85.4833 389.37 85.8347 389.317 86.1595C389.306 86.2271 389.353 86.1146 389.317 86.1595C388.269 87.414 386.564 86.8124 385.259 86.4677C384.406 86.241 381.488 85.9494 381.011 85.9957C380.14 86.0815 379.277 86.014 379.656 87.2114C380.122 88.6824 382.391 89.7375 383.704 90.2419C385.883 91.0803 388.771 91.2561 390.845 92.4015C392.968 92.821 395.425 93.5002 397.022 93.9986C402.83 95.8103 407.806 98.8678 413.033 102.002C415.503 103.482 417.829 104.764 419.973 106.72C421.647 108.248 423.771 109.882 424.595 112.091C425.113 113.482 424.451 115.471 422.848 115.085C420.353 114.488 419.638 111.665 418.227 109.714C415.003 105.251 410.067 102.067 405.118 100.06C402.64 99.0556 399.803 98.729 397.204 98.1176C394.411 97.4613 391.597 97.0442 388.707 97.1736C385.646 97.3097 382.846 97.5534 379.819 98.0078C377.027 98.4264 374.252 98.4441 371.514 97.8441C368.766 97.2421 366.276 96.7553 363.6 95.9021C361.662 95.2848 359.013 94.5583 357.232 93.5247C355.699 92.6339 355.631 91.2381 357.241 90.186C359.87 88.4656 362.778 89.8021 365.546 90.3497C365.561 90.3527 365.532 90.3468 365.546 90.3497C367.858 90.804 369.649 90.098 371.923 89.3884C372.489 89.2128 373.255 89.0482 373.47 88.953C374.383 88.5432 375.895 87.8227 375.407 86.7394C374.868 85.5457 372.659 84.8846 371.55 84.4891C369.74 83.8428 368.053 82.9215 366.147 82.6743C365.654 82.6095 365.109 83.1606 364.6 83.1097C363.36 83.1121 361.769 83.348 360.543 83.418C357.43 83.5916 354.583 83.6228 351.464 83.4719C348.714 83.3377 346.432 82.8542 343.741 82.3102C340.773 81.7101 337.52 81.5879 334.471 81.5839C331.393 81.5811 328.6 81.7214 325.583 82.4181C322.758 83.0702 319.757 83.6198 316.887 84.0326C314.698 84.3481 312.467 84.6054 310.319 84.2137C309.079 83.9871 306.994 83.3394 306.461 81.9635C305.846 80.3659 307.736 79.1556 308.981 78.7519Z",fill:"url(#paint14_linear_1356_14057)"}),P("path",{d:"M242.269 242.95C242.295 242.947 242.244 242.955 242.269 242.95C244.934 242.606 247.53 241.858 250.2 241.574C253.133 241.264 256.006 240.56 258.906 239.982C263.26 239.117 268.026 238.52 272.254 237.097C274.429 236.365 276.067 235.298 278.251 234.592C280.361 233.909 283.058 233.12 285.216 232.652C289.317 231.764 293.049 231.66 297.016 230.198C301.109 228.69 305.088 226.673 308.819 224.409C312.645 222.086 316.282 219.769 320.622 218.62C322.381 218.154 323.919 218.219 325.65 218.886C327.016 219.413 327.739 220.337 327.196 221.79C326.557 223.504 324.659 224.7 323.131 225.423C320.854 226.5 319.53 227.184 317.134 227.927C314.619 228.707 311.888 229.24 309.395 230.083C308.226 230.947 307.17 232.522 306.105 233.501C303.996 235.441 301.666 237.03 298.945 237.996C292.934 240.129 286.354 238.602 280.183 239.056C279.661 239.095 279.162 239.442 278.635 239.487C275.592 240.135 272.2 240.63 269.156 241.294C264.546 242.299 260.456 243.409 255.808 244.179C251.971 244.814 243.815 245.854 243.815 245.854L242.074 245.505C240.575 245.281 240.751 243.152 242.269 242.95Z",fill:"url(#paint15_linear_1356_14057)"}),P("path",{d:"M432.985 171.626C438.212 165.465 445.109 153.64 442.906 144.649C442.162 137.999 433.671 132.912 424.963 135.518C420.16 136.957 416.435 142.146 419.724 144.498
374C420.656 145.164 422.187 145.591 423.391 145.969C434.204 149.375 434.925 162.538 425.069 169.683C421.087 172.569 416.347 174.292 411.914 176.719C400.151 183.162 399.887 196.847 387.7 202.712C382.326 205.298 375.761 206.838 370.297 209.275C359.98 213.88 352.555 221.733 342.241 226.341C337.225 228.584 330.266 231.632 323.483 234.12C321.475 234.855 321.999 237.058 324.056 236.46C324.098 236.449 324.017 236.474 324.056 236.46C329.079 234.971 334.437 233.161 339.331 231.33C352.278 226.48 365.28 220.971 377.43 214.775C401.78 202.367 416.881 190.609 432.985 171.626Z",fill:"url(#paint16_linear_1356_14057)"}),P("path",{d:"M343.644 241.104C348.002 234.144 357.126 232.455 364.343 231.134C368.176 230.431 372.406 229.878 376.137 228.662C380.691 227.175 384.558 224.095 388.327 221.077C389.452 220.177 391.204 218.466 392.393 217.436C393.185 216.748 393.644 216.026 394.33 215.225C396 213.275 399.599 209.812 401.687 208.16C403.263 206.914 407.779 204.758 408.259 207.986C408.611 210.359 406.379 213.087 404.961 214.747C402.224 217.953 398.998 221.079 395.475 223.243C391.749 225.531 387.701 227.439 383.674 229.051C381.672 229.853 379.519 230.073 377.486 230.785C376.001 231.307 374.486 232.236 373.037 232.866C371.034 233.738 368.99 234.28 367.041 235.38C364.436 236.849 361.782 238.783 359.108 240.105C356.331 241.477 353.823 242.691 350.791 243.27C348.6 243.687 345.501 243.641 343.836 241.884C343.526 241.554 343.389 241.51 343.644 241.104Z",fill:"url(#paint17_linear_1356_14057)"}),P("path",{d:"M190.163 273.219C222.905 268.849 232.64 262.943 213.962 259.057C195.285 255.172 187.5 262.08 188.434 266.2C189.366 270.32 180.381 271.326 169.286 272.39C158.193 273.454 157.141 276.354 190.163 273.219Z",fill:"url(#paint18_linear_1356_14057)"}),P("path",{d:"M295.952 95.4242L241.395 135.226L251.54 111.77L295.952 95.4242Z",fill:"#E17726",stroke:"#E17726","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M170.111 95.4242L224.181 135.598L214.522 111.77L170.111 95.4242Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M276.309 187.712L261.793 209.576L292.876 218.014L301.78 188.189L276.309 187.712Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M164.336 188.189L173.186 218.014L204.215 209.576L189.753 187.712L164.336 188.189Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M202.542 150.776L193.908 163.618L224.667 164.998L223.642 132.36L202.542 150.776Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M263.52 150.775L242.097 131.989L241.395 164.998L272.154 163.618L263.52 150.775Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M204.215 209.576L222.832 200.714L206.805 188.402L204.215 209.576Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M243.23 200.714L261.793 209.576L259.257 188.402L243.23 200.714Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M261.793 209.576L243.23 200.714L244.741 212.601L244.579 217.643L261.793 209.576Z",fill:"#D5BFB2",stroke:"#D5BFB2","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M204.215 209.576L221.483 217.643L221.375 212.601L222.832 200.714L204.215 209.576Z",fill:"#D5BFB2",stroke:"#D5BFB2","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M221.807 180.547L206.373 176.09L217.274 171.154L221.807 180.547Z",fill:"#233447",stroke:"#233447","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M244.255 180.547L248.788 171.154L259.742 176.09L244.255 180.547Z",fill:"#233447",stroke:"#233447","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M204.215 209.576L206.913 187.712L189.753 188.189L204.215 209.576Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M259.149 187.712L261.793 209.576L276.309 188.189L259.149 187.712Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M272.154 163.618L241.395 164.998L244.255 180.547L248.788 171.154L259.742 176.09L272.154 163.618Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M206.373 176.09L217.274 171.154L221.807 180.547L224.667 164.998L193.908 163.618L206.373 176.09Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M193.908 163.618L206.805 188.402L206.373 176.09L193.908 163.618Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M259.743 176.09L259.257 188.402L272.154 163.618L259.743 176.09Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M224.667 164.998L221.807 180.548L225.422 198.909L226.232 174.71L224.667 164.998Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M241.395 164.998L239.884 174.657L240.64 198.909L244.255 180.548L241.395 164.998Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M244.255 180.547L240.64 198.909L243.23 200.714L259.257 188.402L259.743 176.09L244.255 180.547Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M206.373 176.09L206.805 188.402L222.832 200.714L225.422 198.909L221.807 180.547L206.373 176.09Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M244.579 217.643L244.741 212.601L243.338 211.434H222.724L221.375 212.601L221.483 217.643L204.215 209.576L210.259 214.459L222.508 222.791H243.5L255.803 214.459L261.793 209.576L244.579 217.643Z",fill:"#C0AC9D",stroke:"#C0AC9D","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M243.23 200.714L240.64 198.909H225.422L222.832 200.714L221.375 212.601L222.724 211.434H243.338L244.741 212.601L243.23 200.714Z",fill:"#161616",stroke:"#161616","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M298.272 137.827L302.859 115.856L295.952 95.4242L243.23 133.899L263.52 150.775L292.174 159.001L298.488 151.731L295.736 149.767L300.107 145.84L296.761 143.293L301.
374132 140.002L298.272 137.827Z",fill:"#763E1A",stroke:"#763E1A","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M163.203 115.856L167.844 137.827L164.876 140.002L169.301 143.293L165.955 145.84L170.326 149.767L167.574 151.731L173.888 159.001L202.542 150.775L222.832 133.899L170.11 95.4242L163.203 115.856Z",fill:"#763E1A",stroke:"#763E1A","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M292.175 159.001L263.52 150.775L272.154 163.618L259.257 188.402L276.309 188.189H301.78L292.175 159.001Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M202.542 150.775L173.888 159.001L164.336 188.189H189.753L206.805 188.402L193.908 163.618L202.542 150.775Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("path",{d:"M241.395 164.998L243.23 133.9L251.54 111.77H214.522L222.832 133.9L224.667 164.998L225.368 174.763L225.422 198.909H240.64L240.694 174.763L241.395 164.998Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),P("defs",null,P("linearGradient",{id:"paint0_linear_1356_14057",x1:"335.991",y1:"250.487",x2:"303.873",y2:"266.801",gradientUnits:"userSpaceOnUse"},P("stop",{"stop-color":"#FFE466"}),P("stop",{offset:"1","stop-color":"#FFAFEA"})),P("linearGradient",{id:"paint1_linear_1356_14057",x1:"276.993",y1:"303.722",x2:"205.254",y2:"401.574",gradientUnits:"userSpaceOnUse"},P("stop",{"stop-color":"#75C3FC"}),P("stop",{offset:"0.0929","stop-color":"#81C2F6"}),P("stop",{offset:"1","stop-color":"#F0B8BD"})),P("linearGradient",{id:"paint2_linear_1356_14057",x1:"271.074",y1:"119.924",x2:"553.077",y2:"104.53",gradientUnits:"userSpaceOnUse"},P("stop",{"stop-color":"#FFE466"}),P("stop",{offset:"1","stop-color":"#FFAFEA"})),P("linearGradient",{id:"paint3_linear_1356_14057",x1:"264.209",y1:"91.0943",x2:"357.834",y2:"72.8792",gradientUnits:"userSpaceOnUse"},P("stop",{"stop-color":"#FFE466"}),P("stop",{offset:"1","stop-color":"#FFAFEA"})),P("linearGradient",{id:"paint4_linear_1356_14057",x1:"212.46",y1:"121.997",x2:"92.6119",y2:"183.406",gradientUnits:"userSpaceOnUse"},P("stop",{"stop-color":"#FFE466"}),P("stop",{offset:"1","stop-color":"#FFAFEA"})),P("linearGradient",{id:"paint5_linear_1356_14057",x1:"23.0498",y1:"204.411",x2:"161.86",y2:"163.003",gradientUnits:"userSpaceOnUse"},P("stop",{"stop-color":"#75C3FC"}),P("stop",{offset:"0.0929","stop-color":"#81C2F6"}),P("stop",{offset:"1","stop-color":"#F0B8BD"})),P("linearGradient",{id:"paint6_linear_1356_14057",x1:"78.8647",y1:"240.375",x2:"74.9655",y2:"241.328",gradientUnits:"userSpaceOnUse"},P("stop",{"stop-color":"#75C3FC"}),P("stop",{offset:"1","stop-color":"#75C3FC"})),P("linearGradient",{id:"paint7_linear_1356_14057",x1:"382.349",y1:"181.971",x2:"378.45",y2:"182.925",gradientUnits:"userSpaceOnUse"},P("stop",{"stop-color":"#75C3FC"}),P("stop",{offset:"1","stop-color":"#75C3FC"})),P("linearGradient",{id:"paint8_linear_1356_14057",x1:"349.889",y1:"244.583",x2:"345.99",y2:"245.537",gradientUnits:"userSpaceOnUse"},P("stop",{"stop-color":"#75C3FC"}),P("stop",{offset:"1","stop-color":"#75C3FC"})),P("linearGradient",{id:"paint9_linear_1356_14057",x1:"142.262",y1:"279.808",x2:"138.362",y2:"280.762",gradientUnits:"userSpaceOnUse"},P("stop",{"stop-color":"#75C3FC"}),P("stop",{offset:"1","stop-color":"#75C3FC"})),P("linearGradient",{id:"paint10_linear_1356_14057",x1:"123.305",y1:"99.0746",x2:"119.406",y2:"100.028",gradientUnits:"userSpaceOnUse"},P("stop",{"stop-color":"#75C3FC"}),P("stop",{offset:"1","stop-color":"#75C3FC"})),P("linearGradient",{id:"paint11_linear_1356_14057",x1:"371.818",y1:"156.617",x2:"367.919",y2:"157.571",gradientUnits:"userSpaceOnUse"},P("stop",{"stop-color":"#75C3FC"}),P("stop",{offset:"1","stop-color":"#75C3FC"})),P("linearGradient",{id:"paint12_linear_1356_14057",x1:"385.281",y1:"242.958",x2:"381.382",y2:"243.911",gradientUnits:"userSpaceOnUse"},P("stop",{"stop-color":"#75C3FC"}),P("stop",{offset:"1","stop-color":"#75C3FC"})),P("linearGradient",{id:"paint13_linear_1356_14057",x1:"367.125",y1:"37.5052",x2:"360.843",y2:"38.8076",gradientUnits:"userSpaceOnUse"},P("stop",{"stop-color":"#75C3FC"}),P("stop",{offset:"1","stop-color":"#75C3FC"})),P("linearGradient",{id:"paint14_linear_1356_14057",x1:"300.182",y1:"91.321",x2:"479.464",y2:"104.041",gradientUnits:"userSpaceOnUse"}
374,P("stop",{"stop-color":"#FFE466"}),P("stop",{offset:"1","stop-color":"#FFAFEA"})),P("linearGradient",{id:"paint15_linear_1356_14057",x1:"363.434",y1:"201.232",x2:"102.977",y2:"302.269",gradientUnits:"userSpaceOnUse"},P("stop",{"stop-color":"#FFE466"}),P("stop",{offset:"1","stop-color":"#FFAFEA"})),P("linearGradient",{id:"paint16_linear_1356_14057",x1:"447.962",y1:"165.159",x2:"313.049",y2:"197.95",gradientUnits:"userSpaceOnUse"},P("stop",{"stop-color":"#75C3FC"}),P("stop",{offset:"0.0929","stop-color":"#81C2F6"}),P("stop",{offset:"1","stop-color":"#F0B8BD"})),P("linearGradient",{id:"paint17_linear_1356_14057",x1:"410.211",y1:"215.859",x2:"341.378",y2:"232.788",gradientUnits:"userSpaceOnUse"},P("stop",{"stop-color":"#75C3FC"}),P("stop",{offset:"0.0929","stop-color":"#81C2F6"}),P("stop",{offset:"1","stop-color":"#F0B8BD"})),P("linearGradient",{id:"paint18_linear_1356_14057",x1:"222.282",y1:"258.986",x2:"162.257",y2:"273.774",gradientUnits:"userSpaceOnUse"},P("stop",{"stop-color":"#FFE466"}),P("stop",{offset:"1","stop-color":"#FFAFEA"})))),Af=class{constructor(t){Da(this,t),this.close=wn(this,"close",7),this.connectWithExtension=wn(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 Ga,this.setTab(this.preferDesktop?1:2)}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}onClose(t=!1){this.close.emit({shouldTerminate:t})}connectWithExtensionHandler(){this.connectWithExtension.emit()}setTab(t){this.tab=t,this.isDefaultTab=!1}disconnectedCallback(){this.onClose()}updatePreferDesktop(t){t?this.setTab(1):this.setTab(2)}render(){if(!this.translationsLoaded)return null;const t=i=>this.i18nInstance.t(i),e=this.sdkVersion,n=this.isDefaultTab?this.preferDesktop?1:2:this.tab,r=Sf(this.link,"svg",{ecc:"medium",scale:2});return P(za,{className:"select-modal"},P("div",{class:"backdrop",onClick:()=>this.onClose(!0)}),P("div",{class:"modal"},P("div",{class:"closeButtonContainer"},P("div",{class:"right"},P("span",{class:"closeButton",onClick:()=>this.onClose(!0)},P(Va,null)))),P("div",{class:"logoContainer"},P(Wa,null)),P("div",null,P("div",{class:"tabcontainer"},P("div",{class:"flexContainer"},P("div",{onClick:()=>this.setTab(1),class:"tab flexItem "+(n===1?"tabactive":"")},t("DESKTOP")),P("div",{onClick:()=>this.setTab(2),class:"tab flexItem "+(n===2?"tabactive":"")},t("MOBILE")))),P("div",{style:{display:n===1?"none":"block"}},P("div",{class:"flexContainer"},P("div",{class:"flexItem",style:{textAlign:"center",marginTop:"4"}},P("div",{class:"center",id:"sdk-mm-qrcode",innerHTML:r}),P("div",{class:"connectMobileText"},t("SCAN_TO_CONNECT"),P("br",null),P("span",{class:"blue"},P("b",null,t("META_MASK_MOBILE_APP"))))))),P("div",{style:{display:n===2?"none":"block"}},P("div",{style:{display:"flex",justifyContent:"center",height:"300",marginTop:"-20"}},P($g,null)),P("div",{class:"extensionLabel"},t("SELECT_MODAL.CRYPTO_TAKE_CONTROL_TEXT")),P("button",{class:"button",onClick:()=>this.connectWithExtensionHandler()},P(Dg,null),P("span",{class:"installExtensionText"},t("CONNECT_WITH_EXTENSION"))))),P(qa,{version:e})))}get el(){return ko(this)}static get watchers(){return{preferDesktop:["updatePreferDesktop"]}}};Af.style=`.flexContainer { 375 display: flex; 376 justify-content: center; 377 align-items: center; 378 flex-direction: row; 379} 380 381.flexItem { 382 flex: 1; 383 justify-content: center; 384 align-items: center; 385} 386 387.flexItem11 { 388 flex: 11; 389 justify-content: center; 390 align-items: center; 391} 392 393.flexItem1 { 394 flex: 1; 395 justify-content: center; 396 align-items: center; 397} 398 399.tab { 400 padding: 8px; 401 cursor: pointer; 402 background-color: #F2F4F6; 403 font-size: 12px; 404 text-align: center; 405 color: #24292E; 406} 407 408.tabcontainer { 409 padding: 4px; 410 background-color: #F2F4F6; 411 border-radius: 8px; 412 margin-bottom: 30px; 413 margin-top: 30px; 414} 415 416.tabactive { 417 background-color: white; 418 -webkit-transition: background-color 300ms linear; 419 -ms-transition: background-color 300ms linear; 420 transition: background-color 300ms linear; 421 border-radius: 8px; 422} 423 424.item { 425 font-size: 12px; 426 margin-bottom: 16px; 427 border-radius: 8px; 428 padding: 10px; 429 border: 2px #F2F4F6 solid; 430 color: #24292E; 431} 432 433.extensionLabel { 434 font-style: normal; 435 font-weight: bold; 436 font-size: 14px; 437 text-align: cetner; 438 color: #24272A; 439} 440 441.notice { 442 font-size: 12px; 443 margin-left: 10px; 444 margin-right: 10px; 445 color: grey; 446} 447 448.button { 449 margin-top: 41.5px; 450 margin-bottom: 20px; 451 width: 100%; 452 display: flex; 453 flex-direction: row; 454 justify-content: center;
455 align-items: center; 456 padding: 12px 20px; 457 background: #037DD6; 458 border-radius: 32px; 459 color: white; 460 border: 0; 461 font-size: 14px; 462 cursor: pointer; 463} 464 465.backdrop { 466 visibility: visible; 467 position: fixed; 468 top: 0; 469 left: 0; 470 right: 0; 471 bottom: 0; 472 width: 100%; 473 z-index: 99998; 474 background: rgba(0, 0, 0, 0.87); 475 opacity: 0.3; 476} 477 478.modal { 479 visibility: visible; 480 position: fixed; 481 left: 50%; 482 transform: translate(-50%, -50%); 483 z-index: 99999; 484 background: white; 485 padding: 20px; 486 border-radius: 8px; 487 top: 50%; 488 max-width: 100%; 489 width: 460px; 490 min-width: 300px; 491 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; 492 -webkit-font-smoothing: antialiased; 493} 494 495.closeButton { 496 color: #BBC0C5; 497 cursor: pointer; 498} 499 500.logoContainer { 501 margin-left: 24px; 502 margin-right: 24px; 503 margin-top: 24px; 504 display: flex; 505 align-items: center; 506 justify-content: center; 507} 508 509.connectMobileText { 510 font-size: 14px; 511 color: black; 512 margin-top: 28px; 513 margin-bottom: 28px; 514 line-height: 2; 515} 516 517.blue { 518 color: #037DD6; 519 font-weight: 700; 520} 521 522.installExtensionText { 523 margin-left: 10px; 524} 525 526.center { 527 display: flex; 528 justify-content: center; 529 align-items: center; 530} 531 532.right { 533 display: flex; 534 align-items: center; 535 justify-content: right; 536} 537 538#sdk-mm-qrcode { 539 svg { 540 width: 50%; 541 } 542}`;var jg=Object.freeze({__proto__:null,mm_install_modal:kf,mm_pending_modal:xf,mm_select_modal:Af});export{Pn as CommunicationLayerPreference,je as ConnectionStatus,rr as DEFAULT_SERVER_URL,te as EventType,xe as MessageType,Fg as MetaMaskSDK,Qe as MetaMaskSDKEvent,Dt as PROVIDER_UPDATE_TYPE,Fe as PlatformType,k2 as SDKProvider,Fg as default};
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.