@walletconnect/ethereum-provider 2.11.2 → 2.11.3-canary-0ff236b6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.umd.js +37 -37
- package/dist/index.umd.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(fn,yr){typeof exports=="object"&&typeof module<"u"?yr(exports):typeof define=="function"&&define.amd?define(["exports"],yr):(fn=typeof globalThis<"u"?globalThis:fn||self,yr(fn["@walletconnect/ethereum-provider"]={}))})(this,function(fn){"use strict";var yr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Oy(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Pi(r){var e=r.default;if(typeof e=="function"){var t=function(){return e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return r[n]}})}),t}var lr={exports:{}},ms=typeof Reflect=="object"?Reflect:null,Rd=ms&&typeof ms.apply=="function"?ms.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},Ea;ms&&typeof ms.ownKeys=="function"?Ea=ms.ownKeys:Object.getOwnPropertySymbols?Ea=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Ea=function(e){return Object.getOwnPropertyNames(e)};function $y(r){console&&console.warn&&console.warn(r)}var Nd=Number.isNaN||function(e){return e!==e};function pt(){pt.init.call(this)}lr.exports=pt,lr.exports.once=Ry,pt.EventEmitter=pt,pt.prototype._events=void 0,pt.prototype._eventsCount=0,pt.prototype._maxListeners=void 0;var Ld=10;function xa(r){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r)}Object.defineProperty(pt,"defaultMaxListeners",{enumerable:!0,get:function(){return Ld},set:function(r){if(typeof r!="number"||r<0||Nd(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");Ld=r}}),pt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},pt.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Nd(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Md(r){return r._maxListeners===void 0?pt.defaultMaxListeners:r._maxListeners}pt.prototype.getMaxListeners=function(){return Md(this)},pt.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e==="error",a=this._events;if(a!==void 0)i=i&&a.error===void 0;else if(!i)return!1;if(i){var c;if(t.length>0&&(c=t[0]),c instanceof Error)throw c;var u=new Error("Unhandled error."+(c?" ("+c.message+")":""));throw u.context=c,u}var f=a[e];if(f===void 0)return!1;if(typeof f=="function")Rd(f,this,t);else for(var h=f.length,m=kd(f,h),n=0;n<h;++n)Rd(m[n],this,t);return!0};function Ud(r,e,t,n){var i,a,c;if(xa(t),a=r._events,a===void 0?(a=r._events=Object.create(null),r._eventsCount=0):(a.newListener!==void 0&&(r.emit("newListener",e,t.listener?t.listener:t),a=r._events),c=a[e]),c===void 0)c=a[e]=t,++r._eventsCount;else if(typeof c=="function"?c=a[e]=n?[t,c]:[c,t]:n?c.unshift(t):c.push(t),i=Md(r),i>0&&c.length>i&&!c.warned){c.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=r,u.type=e,u.count=c.length,$y(u)}return r}pt.prototype.addListener=function(e,t){return Ud(this,e,t,!1)},pt.prototype.on=pt.prototype.addListener,pt.prototype.prependListener=function(e,t){return Ud(this,e,t,!0)};function Ay(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function jd(r,e,t){var n={fired:!1,wrapFn:void 0,target:r,type:e,listener:t},i=Ay.bind(n);return i.listener=t,n.wrapFn=i,i}pt.prototype.once=function(e,t){return xa(t),this.on(e,jd(this,e,t)),this},pt.prototype.prependOnceListener=function(e,t){return xa(t),this.prependListener(e,jd(this,e,t)),this},pt.prototype.removeListener=function(e,t){var n,i,a,c,u;if(xa(t),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if(typeof n!="function"){for(a=-1,c=n.length-1;c>=0;c--)if(n[c]===t||n[c].listener===t){u=n[c].listener,a=c;break}if(a<0)return this;a===0?n.shift():Py(n,a),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||t)}return this},pt.prototype.off=pt.prototype.removeListener,pt.prototype.removeAllListeners=function(e){var t,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var a=Object.keys(n),c;for(i=0;i<a.length;++i)c=a[i],c!=="removeListener"&&this.removeAllListeners(c);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this};function Fd(r,e,t){var n=r._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?t?[i.listener||i]:[i]:t?Ty(i):kd(i,i.length)}pt.prototype.listeners=function(e){return Fd(this,e,!0)},pt.prototype.rawListeners=function(e){return Fd(this,e,!1)},pt.listenerCount=function(r,e){return typeof r.listenerCount=="function"?r.listenerCount(e):Bd.call(r,e)},pt.prototype.listenerCount=Bd;function Bd(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}pt.prototype.eventNames=function(){return this._eventsCount>0?Ea(this._events):[]};function kd(r,e){for(var t=new Array(e),n=0;n<e;++n)t[n]=r[n];return t}function Py(r,e){for(;e+1<r.length;e++)r[e]=r[e+1];r.pop()}function Ty(r){for(var e=new Array(r.length),t=0;t<e.length;++t)e[t]=r[t].listener||r[t];return e}function Ry(r,e){return new Promise(function(t,n){function i(c){r.removeListener(e,a),n(c)}function a(){typeof r.removeListener=="function"&&r.removeListener("error",i),t([].slice.call(arguments))}qd(r,e,a,{once:!0}),e!=="error"&&Ny(r,i,{once:!0})})}function Ny(r,e,t){typeof r.on=="function"&&qd(r,"error",e,t)}function qd(r,e,t,n){if(typeof r.on=="function")n.once?r.once(e,t):r.on(e,t);else if(typeof r.addEventListener=="function")r.addEventListener(e,function i(a){n.once&&r.removeEventListener(e,i),t(a)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof r)}var Pl={},Ia={},Me={},zd={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});function e(u,f){var h=u>>>16&65535,m=u&65535,w=f>>>16&65535,y=f&65535;return m*y+(h*y+m*w<<16>>>0)|0}r.mul=Math.imul||e;function t(u,f){return u+f|0}r.add=t;function n(u,f){return u-f|0}r.sub=n;function i(u,f){return u<<f|u>>>32-f}r.rotl=i;function a(u,f){return u<<32-f|u>>>f}r.rotr=a;function c(u){return typeof u=="number"&&isFinite(u)&&Math.floor(u)===u}r.isInteger=Number.isInteger||c,r.MAX_SAFE_INTEGER=9007199254740991,r.isSafeInteger=function(u){return r.isInteger(u)&&u>=-r.MAX_SAFE_INTEGER&&u<=r.MAX_SAFE_INTEGER}})(zd),Object.defineProperty(Me,"__esModule",{value:!0});var Hd=zd;function Ly(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}Me.readInt16BE=Ly;function My(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}Me.readUint16BE=My;function Uy(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}Me.readInt16LE=Uy;function jy(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}Me.readUint16LE=jy;function Wd(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>8,e[t+1]=r>>>0,e}Me.writeUint16BE=Wd,Me.writeInt16BE=Wd;function Kd(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e}Me.writeUint16LE=Kd,Me.writeInt16LE=Kd;function Tl(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}Me.readInt32BE=Tl;function Rl(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}Me.readUint32BE=Rl;function Nl(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}Me.readInt32LE=Nl;function Ll(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}Me.readUint32LE=Ll;function Da(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>24,e[t+1]=r>>>16,e[t+2]=r>>>8,e[t+3]=r>>>0,e}Me.writeUint32BE=Da,Me.writeInt32BE=Da;function Sa(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}Me.writeUint32LE=Sa,Me.writeInt32LE=Sa;function Fy(r,e){e===void 0&&(e=0);var t=Tl(r,e),n=Tl(r,e+4);return t*4294967296+n-(n>>31)*4294967296}Me.readInt64BE=Fy;function By(r,e){e===void 0&&(e=0);var t=Rl(r,e),n=Rl(r,e+4);return t*4294967296+n}Me.readUint64BE=By;function ky(r,e){e===void 0&&(e=0);var t=Nl(r,e),n=Nl(r,e+4);return n*4294967296+t-(t>>31)*4294967296}Me.readInt64LE=ky;function qy(r,e){e===void 0&&(e=0);var t=Ll(r,e),n=Ll(r,e+4);return n*4294967296+t}Me.readUint64LE=qy;function Vd(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),Da(r/4294967296>>>0,e,t),Da(r>>>0,e,t+4),e}Me.writeUint64BE=Vd,Me.writeInt64BE=Vd;function Gd(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),Sa(r>>>0,e,t),Sa(r/4294967296>>>0,e,t+4),e}Me.writeUint64LE=Gd,Me.writeInt64LE=Gd;function zy(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,a=r/8+t-1;a>=t;a--)n+=e[a]*i,i*=256;return n}Me.readUintBE=zy;function Hy(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,a=t;a<t+r/8;a++)n+=e[a]*i,i*=256;return n}Me.readUintLE=Hy;function Wy(r,e,t,n){if(t===void 0&&(t=new Uint8Array(r/8)),n===void 0&&(n=0),r%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!Hd.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var i=1,a=r/8+n-1;a>=n;a--)t[a]=e/i&255,i*=256;return t}Me.writeUintBE=Wy;function Ky(r,e,t,n){if(t===void 0&&(t=new Uint8Array(r/8)),n===void 0&&(n=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Hd.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,a=n;a<n+r/8;a++)t[a]=e/i&255,i*=256;return t}Me.writeUintLE=Ky;function Vy(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e)}Me.readFloat32BE=Vy;function Gy(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e,!0)}Me.readFloat32LE=Gy;function Yy(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e)}Me.readFloat64BE=Yy;function Jy(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e,!0)}Me.readFloat64LE=Jy;function Zy(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(t,r),e}Me.writeFloat32BE=Zy;function Qy(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(t,r,!0),e}Me.writeFloat32LE=Qy;function Xy(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(t,r),e}Me.writeFloat64BE=Xy;function ew(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(t,r,!0),e}Me.writeFloat64LE=ew;var zr={};Object.defineProperty(zr,"__esModule",{value:!0});function tw(r){for(var e=0;e<r.length;e++)r[e]=0;return r}zr.wipe=tw,Object.defineProperty(Ia,"__esModule",{value:!0});var dr=Me,Ml=zr,rw=20;function nw(r,e,t){for(var n=1634760805,i=857760878,a=2036477234,c=1797285236,u=t[3]<<24|t[2]<<16|t[1]<<8|t[0],f=t[7]<<24|t[6]<<16|t[5]<<8|t[4],h=t[11]<<24|t[10]<<16|t[9]<<8|t[8],m=t[15]<<24|t[14]<<16|t[13]<<8|t[12],w=t[19]<<24|t[18]<<16|t[17]<<8|t[16],y=t[23]<<24|t[22]<<16|t[21]<<8|t[20],x=t[27]<<24|t[26]<<16|t[25]<<8|t[24],S=t[31]<<24|t[30]<<16|t[29]<<8|t[28],P=e[3]<<24|e[2]<<16|e[1]<<8|e[0],U=e[7]<<24|e[6]<<16|e[5]<<8|e[4],j=e[11]<<24|e[10]<<16|e[9]<<8|e[8],A=e[15]<<24|e[14]<<16|e[13]<<8|e[12],T=n,C=i,$=a,E=c,d=u,b=f,H=h,F=m,V=w,se=y,ce=x,I=S,N=P,X=U,ee=j,Y=A,J=0;J<rw;J+=2)T=T+d|0,N^=T,N=N>>>32-16|N<<16,V=V+N|0,d^=V,d=d>>>32-12|d<<12,C=C+b|0,X^=C,X=X>>>32-16|X<<16,se=se+X|0,b^=se,b=b>>>32-12|b<<12,$=$+H|0,ee^=$,ee=ee>>>32-16|ee<<16,ce=ce+ee|0,H^=ce,H=H>>>32-12|H<<12,E=E+F|0,Y^=E,Y=Y>>>32-16|Y<<16,I=I+Y|0,F^=I,F=F>>>32-12|F<<12,$=$+H|0,ee^=$,ee=ee>>>32-8|ee<<8,ce=ce+ee|0,H^=ce,H=H>>>32-7|H<<7,E=E+F|0,Y^=E,Y=Y>>>32-8|Y<<8,I=I+Y|0,F^=I,F=F>>>32-7|F<<7,C=C+b|0,X^=C,X=X>>>32-8|X<<8,se=se+X|0,b^=se,b=b>>>32-7|b<<7,T=T+d|0,N^=T,N=N>>>32-8|N<<8,V=V+N|0,d^=V,d=d>>>32-7|d<<7,T=T+b|0,Y^=T,Y=Y>>>32-16|Y<<16,ce=ce+Y|0,b^=ce,b=b>>>32-12|b<<12,C=C+H|0,N^=C,N=N>>>32-16|N<<16,I=I+N|0,H^=I,H=H>>>32-12|H<<12,$=$+F|0,X^=$,X=X>>>32-16|X<<16,V=V+X|0,F^=V,F=F>>>32-12|F<<12,E=E+d|0,ee^=E,ee=ee>>>32-16|ee<<16,se=se+ee|0,d^=se,d=d>>>32-12|d<<12,$=$+F|0,X^=$,X=X>>>32-8|X<<8,V=V+X|0,F^=V,F=F>>>32-7|F<<7,E=E+d|0,ee^=E,ee=ee>>>32-8|ee<<8,se=se+ee|0,d^=se,d=d>>>32-7|d<<7,C=C+H|0,N^=C,N=N>>>32-8|N<<8,I=I+N|0,H^=I,H=H>>>32-7|H<<7,T=T+b|0,Y^=T,Y=Y>>>32-8|Y<<8,ce=ce+Y|0,b^=ce,b=b>>>32-7|b<<7;dr.writeUint32LE(T+n|0,r,0),dr.writeUint32LE(C+i|0,r,4),dr.writeUint32LE($+a|0,r,8),dr.writeUint32LE(E+c|0,r,12),dr.writeUint32LE(d+u|0,r,16),dr.writeUint32LE(b+f|0,r,20),dr.writeUint32LE(H+h|0,r,24),dr.writeUint32LE(F+m|0,r,28),dr.writeUint32LE(V+w|0,r,32),dr.writeUint32LE(se+y|0,r,36),dr.writeUint32LE(ce+x|0,r,40),dr.writeUint32LE(I+S|0,r,44),dr.writeUint32LE(N+P|0,r,48),dr.writeUint32LE(X+U|0,r,52),dr.writeUint32LE(ee+j|0,r,56),dr.writeUint32LE(Y+A|0,r,60)}function Yd(r,e,t,n,i){if(i===void 0&&(i=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<t.length)throw new Error("ChaCha: destination is shorter than source");var a,c;if(i===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");a=new Uint8Array(16),c=a.length-e.length,a.set(e,c)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");a=e,c=i}for(var u=new Uint8Array(64),f=0;f<t.length;f+=64){nw(u,a,r);for(var h=f;h<f+64&&h<t.length;h++)n[h]=t[h]^u[h-f];sw(a,0,c)}return Ml.wipe(u),i===0&&Ml.wipe(a),n}Ia.streamXOR=Yd;function iw(r,e,t,n){return n===void 0&&(n=0),Ml.wipe(t),Yd(r,e,t,t,n)}Ia.stream=iw;function sw(r,e,t){for(var n=1;t--;)n=n+(r[e]&255)|0,r[e]=n&255,n>>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var Jd={},ni={};Object.defineProperty(ni,"__esModule",{value:!0});function ow(r,e,t){return~(r-1)&e|r-1&t}ni.select=ow;function aw(r,e){return(r|0)-(e|0)-1>>>31&1}ni.lessOrEqual=aw;function Zd(r,e){if(r.length!==e.length)return 0;for(var t=0,n=0;n<r.length;n++)t|=r[n]^e[n];return 1&t-1>>>8}ni.compare=Zd;function cw(r,e){return r.length===0||e.length===0?!1:Zd(r,e)!==0}ni.equal=cw,function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=ni,t=zr;r.DIGEST_LENGTH=16;var n=function(){function c(u){this.digestLength=r.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var f=u[0]|u[1]<<8;this._r[0]=f&8191;var h=u[2]|u[3]<<8;this._r[1]=(f>>>13|h<<3)&8191;var m=u[4]|u[5]<<8;this._r[2]=(h>>>10|m<<6)&7939;var w=u[6]|u[7]<<8;this._r[3]=(m>>>7|w<<9)&8191;var y=u[8]|u[9]<<8;this._r[4]=(w>>>4|y<<12)&255,this._r[5]=y>>>1&8190;var x=u[10]|u[11]<<8;this._r[6]=(y>>>14|x<<2)&8191;var S=u[12]|u[13]<<8;this._r[7]=(x>>>11|S<<5)&8065;var P=u[14]|u[15]<<8;this._r[8]=(S>>>8|P<<8)&8191,this._r[9]=P>>>5&127,this._pad[0]=u[16]|u[17]<<8,this._pad[1]=u[18]|u[19]<<8,this._pad[2]=u[20]|u[21]<<8,this._pad[3]=u[22]|u[23]<<8,this._pad[4]=u[24]|u[25]<<8,this._pad[5]=u[26]|u[27]<<8,this._pad[6]=u[28]|u[29]<<8,this._pad[7]=u[30]|u[31]<<8}return c.prototype._blocks=function(u,f,h){for(var m=this._fin?0:2048,w=this._h[0],y=this._h[1],x=this._h[2],S=this._h[3],P=this._h[4],U=this._h[5],j=this._h[6],A=this._h[7],T=this._h[8],C=this._h[9],$=this._r[0],E=this._r[1],d=this._r[2],b=this._r[3],H=this._r[4],F=this._r[5],V=this._r[6],se=this._r[7],ce=this._r[8],I=this._r[9];h>=16;){var N=u[f+0]|u[f+1]<<8;w+=N&8191;var X=u[f+2]|u[f+3]<<8;y+=(N>>>13|X<<3)&8191;var ee=u[f+4]|u[f+5]<<8;x+=(X>>>10|ee<<6)&8191;var Y=u[f+6]|u[f+7]<<8;S+=(ee>>>7|Y<<9)&8191;var J=u[f+8]|u[f+9]<<8;P+=(Y>>>4|J<<12)&8191,U+=J>>>1&8191;var Q=u[f+10]|u[f+11]<<8;j+=(J>>>14|Q<<2)&8191;var ie=u[f+12]|u[f+13]<<8;A+=(Q>>>11|ie<<5)&8191;var Ee=u[f+14]|u[f+15]<<8;T+=(ie>>>8|Ee<<8)&8191,C+=Ee>>>5|m;var ae=0,xe=ae;xe+=w*$,xe+=y*(5*I),xe+=x*(5*ce),xe+=S*(5*se),xe+=P*(5*V),ae=xe>>>13,xe&=8191,xe+=U*(5*F),xe+=j*(5*H),xe+=A*(5*b),xe+=T*(5*d),xe+=C*(5*E),ae+=xe>>>13,xe&=8191;var de=ae;de+=w*E,de+=y*$,de+=x*(5*I),de+=S*(5*ce),de+=P*(5*se),ae=de>>>13,de&=8191,de+=U*(5*V),de+=j*(5*F),de+=A*(5*H),de+=T*(5*b),de+=C*(5*d),ae+=de>>>13,de&=8191;var be=ae;be+=w*d,be+=y*E,be+=x*$,be+=S*(5*I),be+=P*(5*ce),ae=be>>>13,be&=8191,be+=U*(5*se),be+=j*(5*V),be+=A*(5*F),be+=T*(5*H),be+=C*(5*b),ae+=be>>>13,be&=8191;var K=ae;K+=w*b,K+=y*d,K+=x*E,K+=S*$,K+=P*(5*I),ae=K>>>13,K&=8191,K+=U*(5*ce),K+=j*(5*se),K+=A*(5*V),K+=T*(5*F),K+=C*(5*H),ae+=K>>>13,K&=8191;var W=ae;W+=w*H,W+=y*b,W+=x*d,W+=S*E,W+=P*$,ae=W>>>13,W&=8191,W+=U*(5*I),W+=j*(5*ce),W+=A*(5*se),W+=T*(5*V),W+=C*(5*F),ae+=W>>>13,W&=8191;var B=ae;B+=w*F,B+=y*H,B+=x*b,B+=S*d,B+=P*E,ae=B>>>13,B&=8191,B+=U*$,B+=j*(5*I),B+=A*(5*ce),B+=T*(5*se),B+=C*(5*V),ae+=B>>>13,B&=8191;var g=ae;g+=w*V,g+=y*F,g+=x*H,g+=S*b,g+=P*d,ae=g>>>13,g&=8191,g+=U*E,g+=j*$,g+=A*(5*I),g+=T*(5*ce),g+=C*(5*se),ae+=g>>>13,g&=8191;var L=ae;L+=w*se,L+=y*V,L+=x*F,L+=S*H,L+=P*b,ae=L>>>13,L&=8191,L+=U*d,L+=j*E,L+=A*$,L+=T*(5*I),L+=C*(5*ce),ae+=L>>>13,L&=8191;var le=ae;le+=w*ce,le+=y*se,le+=x*V,le+=S*F,le+=P*H,ae=le>>>13,le&=8191,le+=U*b,le+=j*d,le+=A*E,le+=T*$,le+=C*(5*I),ae+=le>>>13,le&=8191;var pe=ae;pe+=w*I,pe+=y*ce,pe+=x*se,pe+=S*V,pe+=P*F,ae=pe>>>13,pe&=8191,pe+=U*H,pe+=j*b,pe+=A*d,pe+=T*E,pe+=C*$,ae+=pe>>>13,pe&=8191,ae=(ae<<2)+ae|0,ae=ae+xe|0,xe=ae&8191,ae=ae>>>13,de+=ae,w=xe,y=de,x=be,S=K,P=W,U=B,j=g,A=L,T=le,C=pe,f+=16,h-=16}this._h[0]=w,this._h[1]=y,this._h[2]=x,this._h[3]=S,this._h[4]=P,this._h[5]=U,this._h[6]=j,this._h[7]=A,this._h[8]=T,this._h[9]=C},c.prototype.finish=function(u,f){f===void 0&&(f=0);var h=new Uint16Array(10),m,w,y,x;if(this._leftover){for(x=this._leftover,this._buffer[x++]=1;x<16;x++)this._buffer[x]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(m=this._h[1]>>>13,this._h[1]&=8191,x=2;x<10;x++)this._h[x]+=m,m=this._h[x]>>>13,this._h[x]&=8191;for(this._h[0]+=m*5,m=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=m,m=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=m,h[0]=this._h[0]+5,m=h[0]>>>13,h[0]&=8191,x=1;x<10;x++)h[x]=this._h[x]+m,m=h[x]>>>13,h[x]&=8191;for(h[9]-=8192,w=(m^1)-1,x=0;x<10;x++)h[x]&=w;for(w=~w,x=0;x<10;x++)this._h[x]=this._h[x]&w|h[x];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,y=this._h[0]+this._pad[0],this._h[0]=y&65535,x=1;x<8;x++)y=(this._h[x]+this._pad[x]|0)+(y>>>16)|0,this._h[x]=y&65535;return u[f+0]=this._h[0]>>>0,u[f+1]=this._h[0]>>>8,u[f+2]=this._h[1]>>>0,u[f+3]=this._h[1]>>>8,u[f+4]=this._h[2]>>>0,u[f+5]=this._h[2]>>>8,u[f+6]=this._h[3]>>>0,u[f+7]=this._h[3]>>>8,u[f+8]=this._h[4]>>>0,u[f+9]=this._h[4]>>>8,u[f+10]=this._h[5]>>>0,u[f+11]=this._h[5]>>>8,u[f+12]=this._h[6]>>>0,u[f+13]=this._h[6]>>>8,u[f+14]=this._h[7]>>>0,u[f+15]=this._h[7]>>>8,this._finished=!0,this},c.prototype.update=function(u){var f=0,h=u.length,m;if(this._leftover){m=16-this._leftover,m>h&&(m=h);for(var w=0;w<m;w++)this._buffer[this._leftover+w]=u[f+w];if(h-=m,f+=m,this._leftover+=m,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(h>=16&&(m=h-h%16,this._blocks(u,f,m),f+=m,h-=m),h){for(var w=0;w<h;w++)this._buffer[this._leftover+w]=u[f+w];this._leftover+=h}return this},c.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var u=new Uint8Array(16);return this.finish(u),u},c.prototype.clean=function(){return t.wipe(this._buffer),t.wipe(this._r),t.wipe(this._h),t.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},c}();r.Poly1305=n;function i(c,u){var f=new n(c);f.update(u);var h=f.digest();return f.clean(),h}r.oneTimeAuth=i;function a(c,u){return c.length!==r.DIGEST_LENGTH||u.length!==r.DIGEST_LENGTH?!1:e.equal(c,u)}r.equal=a}(Jd),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=Ia,t=Jd,n=zr,i=Me,a=ni;r.KEY_LENGTH=32,r.NONCE_LENGTH=12,r.TAG_LENGTH=16;var c=new Uint8Array(16),u=function(){function f(h){if(this.nonceLength=r.NONCE_LENGTH,this.tagLength=r.TAG_LENGTH,h.length!==r.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(h)}return f.prototype.seal=function(h,m,w,y){if(h.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var x=new Uint8Array(16);x.set(h,x.length-h.length);var S=new Uint8Array(32);e.stream(this._key,x,S,4);var P=m.length+this.tagLength,U;if(y){if(y.length!==P)throw new Error("ChaCha20Poly1305: incorrect destination length");U=y}else U=new Uint8Array(P);return e.streamXOR(this._key,x,m,U,4),this._authenticate(U.subarray(U.length-this.tagLength,U.length),S,U.subarray(0,U.length-this.tagLength),w),n.wipe(x),U},f.prototype.open=function(h,m,w,y){if(h.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(m.length<this.tagLength)return null;var x=new Uint8Array(16);x.set(h,x.length-h.length);var S=new Uint8Array(32);e.stream(this._key,x,S,4);var P=new Uint8Array(this.tagLength);if(this._authenticate(P,S,m.subarray(0,m.length-this.tagLength),w),!a.equal(P,m.subarray(m.length-this.tagLength,m.length)))return null;var U=m.length-this.tagLength,j;if(y){if(y.length!==U)throw new Error("ChaCha20Poly1305: incorrect destination length");j=y}else j=new Uint8Array(U);return e.streamXOR(this._key,x,m.subarray(0,m.length-this.tagLength),j,4),n.wipe(x),j},f.prototype.clean=function(){return n.wipe(this._key),this},f.prototype._authenticate=function(h,m,w,y){var x=new t.Poly1305(m);y&&(x.update(y),y.length%16>0&&x.update(c.subarray(y.length%16))),x.update(w),w.length%16>0&&x.update(c.subarray(w.length%16));var S=new Uint8Array(8);y&&i.writeUint64LE(y.length,S),x.update(S),i.writeUint64LE(w.length,S),x.update(S);for(var P=x.digest(),U=0;U<P.length;U++)h[U]=P[U];x.clean(),n.wipe(P),n.wipe(S)},f}();r.ChaCha20Poly1305=u}(Pl);var Qd={},fo={},Ul={};Object.defineProperty(Ul,"__esModule",{value:!0});function lw(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}Ul.isSerializableHash=lw,Object.defineProperty(fo,"__esModule",{value:!0});var _n=Ul,uw=ni,hw=zr,Xd=function(){function r(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(n).clean():n.set(t);for(var i=0;i<n.length;i++)n[i]^=54;this._inner.update(n);for(var i=0;i<n.length;i++)n[i]^=106;this._outer.update(n),_n.isSerializableHash(this._inner)&&_n.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),hw.wipe(n)}return r.prototype.reset=function(){if(!_n.isSerializableHash(this._inner)||!_n.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.clean=function(){_n.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),_n.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},r.prototype.update=function(e){return this._inner.update(e),this},r.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(!_n.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},r.prototype.restoreState=function(e){if(!_n.isSerializableHash(this._inner)||!_n.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.cleanSavedState=function(e){if(!_n.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},r}();fo.HMAC=Xd;function fw(r,e,t){var n=new Xd(r,e);n.update(t);var i=n.digest();return n.clean(),i}fo.hmac=fw,fo.equal=uw.equal,Object.defineProperty(Qd,"__esModule",{value:!0});var e0=fo,t0=zr,dw=function(){function r(e,t,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var a=e0.hmac(this._hash,n,t);this._hmac=new e0.HMAC(e,a),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},r.prototype.expand=function(e){for(var t=new Uint8Array(e),n=0;n<t.length;n++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[n]=this._buffer[this._bufpos++];return t},r.prototype.clean=function(){this._hmac.clean(),t0.wipe(this._buffer),t0.wipe(this._counter),this._bufpos=0},r}(),pw=Qd.HKDF=dw,vs={},Ca={},Oa={};Object.defineProperty(Oa,"__esModule",{value:!0}),Oa.BrowserRandomSource=void 0;const r0=65536;class gw{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let n=0;n<t.length;n+=r0)this._crypto.getRandomValues(t.subarray(n,n+Math.min(t.length-n,r0)));return t}}Oa.BrowserRandomSource=gw;function mw(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var $a={},vw={},yw=Object.freeze({__proto__:null,default:vw}),ww=Pi(yw);Object.defineProperty($a,"__esModule",{value:!0}),$a.NodeRandomSource=void 0;const bw=zr;class _w{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof mw<"u"){const e=ww;e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const n=new Uint8Array(e);for(let i=0;i<n.length;i++)n[i]=t[i];return(0,bw.wipe)(t),n}}$a.NodeRandomSource=_w,Object.defineProperty(Ca,"__esModule",{value:!0}),Ca.SystemRandomSource=void 0;const Ew=Oa,xw=$a;class Iw{constructor(){if(this.isAvailable=!1,this.name="",this._source=new Ew.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new xw.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}Ca.SystemRandomSource=Iw,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.randomStringForEntropy=r.randomString=r.randomUint32=r.randomBytes=r.defaultRandomSource=void 0;const e=Ca,t=Me,n=zr;r.defaultRandomSource=new e.SystemRandomSource;function i(h,m=r.defaultRandomSource){return m.randomBytes(h)}r.randomBytes=i;function a(h=r.defaultRandomSource){const m=i(4,h),w=(0,t.readUint32LE)(m);return(0,n.wipe)(m),w}r.randomUint32=a;const c="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function u(h,m=c,w=r.defaultRandomSource){if(m.length<2)throw new Error("randomString charset is too short");if(m.length>256)throw new Error("randomString charset is too long");let y="";const x=m.length,S=256-256%x;for(;h>0;){const P=i(Math.ceil(h*256/S),w);for(let U=0;U<P.length&&h>0;U++){const j=P[U];j<S&&(y+=m.charAt(j%x),h--)}(0,n.wipe)(P)}return y}r.randomString=u;function f(h,m=c,w=r.defaultRandomSource){const y=Math.ceil(h/(Math.log(m.length)/Math.LN2));return u(y,m,w)}r.randomStringForEntropy=f}(vs);var Aa={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=Me,t=zr;r.DIGEST_LENGTH=32,r.BLOCK_SIZE=64;var n=function(){function u(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return u.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},u.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},u.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._temp),this.reset()},u.prototype.update=function(f,h){if(h===void 0&&(h=f.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var m=0;if(this._bytesHashed+=h,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&h>0;)this._buffer[this._bufferLength++]=f[m++],h--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(h>=this.blockSize&&(m=a(this._temp,this._state,f,m,h),h%=this.blockSize);h>0;)this._buffer[this._bufferLength++]=f[m++],h--;return this},u.prototype.finish=function(f){if(!this._finished){var h=this._bytesHashed,m=this._bufferLength,w=h/536870912|0,y=h<<3,x=h%64<56?64:128;this._buffer[m]=128;for(var S=m+1;S<x-8;S++)this._buffer[S]=0;e.writeUint32BE(w,this._buffer,x-8),e.writeUint32BE(y,this._buffer,x-4),a(this._temp,this._state,this._buffer,0,x),this._finished=!0}for(var S=0;S<this.digestLength/4;S++)e.writeUint32BE(this._state[S],f,S*4);return this},u.prototype.digest=function(){var f=new Uint8Array(this.digestLength);return this.finish(f),f},u.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},u.prototype.restoreState=function(f){return this._state.set(f.state),this._bufferLength=f.bufferLength,f.buffer&&this._buffer.set(f.buffer),this._bytesHashed=f.bytesHashed,this._finished=!1,this},u.prototype.cleanSavedState=function(f){t.wipe(f.state),f.buffer&&t.wipe(f.buffer),f.bufferLength=0,f.bytesHashed=0},u}();r.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function a(u,f,h,m,w){for(;w>=64;){for(var y=f[0],x=f[1],S=f[2],P=f[3],U=f[4],j=f[5],A=f[6],T=f[7],C=0;C<16;C++){var $=m+C*4;u[C]=e.readUint32BE(h,$)}for(var C=16;C<64;C++){var E=u[C-2],d=(E>>>17|E<<32-17)^(E>>>19|E<<32-19)^E>>>10;E=u[C-15];var b=(E>>>7|E<<32-7)^(E>>>18|E<<32-18)^E>>>3;u[C]=(d+u[C-7]|0)+(b+u[C-16]|0)}for(var C=0;C<64;C++){var d=(((U>>>6|U<<26)^(U>>>11|U<<21)^(U>>>25|U<<7))+(U&j^~U&A)|0)+(T+(i[C]+u[C]|0)|0)|0,b=((y>>>2|y<<32-2)^(y>>>13|y<<32-13)^(y>>>22|y<<32-22))+(y&x^y&S^x&S)|0;T=A,A=j,j=U,U=P+d|0,P=S,S=x,x=y,y=d+b|0}f[0]+=y,f[1]+=x,f[2]+=S,f[3]+=P,f[4]+=U,f[5]+=j,f[6]+=A,f[7]+=T,m+=64,w-=64}return m}function c(u){var f=new n;f.update(u);var h=f.digest();return f.clean(),h}r.hash=c})(Aa);var jl={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.sharedKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.scalarMultBase=r.scalarMult=r.SHARED_KEY_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=void 0;const e=vs,t=zr;r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=32,r.SHARED_KEY_LENGTH=32;function n(C){const $=new Float64Array(16);if(C)for(let E=0;E<C.length;E++)$[E]=C[E];return $}const i=new Uint8Array(32);i[0]=9;const a=n([56129,1]);function c(C){let $=1;for(let E=0;E<16;E++){let d=C[E]+$+65535;$=Math.floor(d/65536),C[E]=d-$*65536}C[0]+=$-1+37*($-1)}function u(C,$,E){const d=~(E-1);for(let b=0;b<16;b++){const H=d&(C[b]^$[b]);C[b]^=H,$[b]^=H}}function f(C,$){const E=n(),d=n();for(let b=0;b<16;b++)d[b]=$[b];c(d),c(d),c(d);for(let b=0;b<2;b++){E[0]=d[0]-65517;for(let F=1;F<15;F++)E[F]=d[F]-65535-(E[F-1]>>16&1),E[F-1]&=65535;E[15]=d[15]-32767-(E[14]>>16&1);const H=E[15]>>16&1;E[14]&=65535,u(d,E,1-H)}for(let b=0;b<16;b++)C[2*b]=d[b]&255,C[2*b+1]=d[b]>>8}function h(C,$){for(let E=0;E<16;E++)C[E]=$[2*E]+($[2*E+1]<<8);C[15]&=32767}function m(C,$,E){for(let d=0;d<16;d++)C[d]=$[d]+E[d]}function w(C,$,E){for(let d=0;d<16;d++)C[d]=$[d]-E[d]}function y(C,$,E){let d,b,H=0,F=0,V=0,se=0,ce=0,I=0,N=0,X=0,ee=0,Y=0,J=0,Q=0,ie=0,Ee=0,ae=0,xe=0,de=0,be=0,K=0,W=0,B=0,g=0,L=0,le=0,pe=0,Ce=0,Ke=0,Je=0,ke=0,St=0,Ct=0,ze=E[0],Oe=E[1],Ue=E[2],je=E[3],He=E[4],Ae=E[5],Fe=E[6],Se=E[7],Te=E[8],Ve=E[9],$e=E[10],Ze=E[11],et=E[12],at=E[13],ct=E[14],nt=E[15];d=$[0],H+=d*ze,F+=d*Oe,V+=d*Ue,se+=d*je,ce+=d*He,I+=d*Ae,N+=d*Fe,X+=d*Se,ee+=d*Te,Y+=d*Ve,J+=d*$e,Q+=d*Ze,ie+=d*et,Ee+=d*at,ae+=d*ct,xe+=d*nt,d=$[1],F+=d*ze,V+=d*Oe,se+=d*Ue,ce+=d*je,I+=d*He,N+=d*Ae,X+=d*Fe,ee+=d*Se,Y+=d*Te,J+=d*Ve,Q+=d*$e,ie+=d*Ze,Ee+=d*et,ae+=d*at,xe+=d*ct,de+=d*nt,d=$[2],V+=d*ze,se+=d*Oe,ce+=d*Ue,I+=d*je,N+=d*He,X+=d*Ae,ee+=d*Fe,Y+=d*Se,J+=d*Te,Q+=d*Ve,ie+=d*$e,Ee+=d*Ze,ae+=d*et,xe+=d*at,de+=d*ct,be+=d*nt,d=$[3],se+=d*ze,ce+=d*Oe,I+=d*Ue,N+=d*je,X+=d*He,ee+=d*Ae,Y+=d*Fe,J+=d*Se,Q+=d*Te,ie+=d*Ve,Ee+=d*$e,ae+=d*Ze,xe+=d*et,de+=d*at,be+=d*ct,K+=d*nt,d=$[4],ce+=d*ze,I+=d*Oe,N+=d*Ue,X+=d*je,ee+=d*He,Y+=d*Ae,J+=d*Fe,Q+=d*Se,ie+=d*Te,Ee+=d*Ve,ae+=d*$e,xe+=d*Ze,de+=d*et,be+=d*at,K+=d*ct,W+=d*nt,d=$[5],I+=d*ze,N+=d*Oe,X+=d*Ue,ee+=d*je,Y+=d*He,J+=d*Ae,Q+=d*Fe,ie+=d*Se,Ee+=d*Te,ae+=d*Ve,xe+=d*$e,de+=d*Ze,be+=d*et,K+=d*at,W+=d*ct,B+=d*nt,d=$[6],N+=d*ze,X+=d*Oe,ee+=d*Ue,Y+=d*je,J+=d*He,Q+=d*Ae,ie+=d*Fe,Ee+=d*Se,ae+=d*Te,xe+=d*Ve,de+=d*$e,be+=d*Ze,K+=d*et,W+=d*at,B+=d*ct,g+=d*nt,d=$[7],X+=d*ze,ee+=d*Oe,Y+=d*Ue,J+=d*je,Q+=d*He,ie+=d*Ae,Ee+=d*Fe,ae+=d*Se,xe+=d*Te,de+=d*Ve,be+=d*$e,K+=d*Ze,W+=d*et,B+=d*at,g+=d*ct,L+=d*nt,d=$[8],ee+=d*ze,Y+=d*Oe,J+=d*Ue,Q+=d*je,ie+=d*He,Ee+=d*Ae,ae+=d*Fe,xe+=d*Se,de+=d*Te,be+=d*Ve,K+=d*$e,W+=d*Ze,B+=d*et,g+=d*at,L+=d*ct,le+=d*nt,d=$[9],Y+=d*ze,J+=d*Oe,Q+=d*Ue,ie+=d*je,Ee+=d*He,ae+=d*Ae,xe+=d*Fe,de+=d*Se,be+=d*Te,K+=d*Ve,W+=d*$e,B+=d*Ze,g+=d*et,L+=d*at,le+=d*ct,pe+=d*nt,d=$[10],J+=d*ze,Q+=d*Oe,ie+=d*Ue,Ee+=d*je,ae+=d*He,xe+=d*Ae,de+=d*Fe,be+=d*Se,K+=d*Te,W+=d*Ve,B+=d*$e,g+=d*Ze,L+=d*et,le+=d*at,pe+=d*ct,Ce+=d*nt,d=$[11],Q+=d*ze,ie+=d*Oe,Ee+=d*Ue,ae+=d*je,xe+=d*He,de+=d*Ae,be+=d*Fe,K+=d*Se,W+=d*Te,B+=d*Ve,g+=d*$e,L+=d*Ze,le+=d*et,pe+=d*at,Ce+=d*ct,Ke+=d*nt,d=$[12],ie+=d*ze,Ee+=d*Oe,ae+=d*Ue,xe+=d*je,de+=d*He,be+=d*Ae,K+=d*Fe,W+=d*Se,B+=d*Te,g+=d*Ve,L+=d*$e,le+=d*Ze,pe+=d*et,Ce+=d*at,Ke+=d*ct,Je+=d*nt,d=$[13],Ee+=d*ze,ae+=d*Oe,xe+=d*Ue,de+=d*je,be+=d*He,K+=d*Ae,W+=d*Fe,B+=d*Se,g+=d*Te,L+=d*Ve,le+=d*$e,pe+=d*Ze,Ce+=d*et,Ke+=d*at,Je+=d*ct,ke+=d*nt,d=$[14],ae+=d*ze,xe+=d*Oe,de+=d*Ue,be+=d*je,K+=d*He,W+=d*Ae,B+=d*Fe,g+=d*Se,L+=d*Te,le+=d*Ve,pe+=d*$e,Ce+=d*Ze,Ke+=d*et,Je+=d*at,ke+=d*ct,St+=d*nt,d=$[15],xe+=d*ze,de+=d*Oe,be+=d*Ue,K+=d*je,W+=d*He,B+=d*Ae,g+=d*Fe,L+=d*Se,le+=d*Te,pe+=d*Ve,Ce+=d*$e,Ke+=d*Ze,Je+=d*et,ke+=d*at,St+=d*ct,Ct+=d*nt,H+=38*de,F+=38*be,V+=38*K,se+=38*W,ce+=38*B,I+=38*g,N+=38*L,X+=38*le,ee+=38*pe,Y+=38*Ce,J+=38*Ke,Q+=38*Je,ie+=38*ke,Ee+=38*St,ae+=38*Ct,b=1,d=H+b+65535,b=Math.floor(d/65536),H=d-b*65536,d=F+b+65535,b=Math.floor(d/65536),F=d-b*65536,d=V+b+65535,b=Math.floor(d/65536),V=d-b*65536,d=se+b+65535,b=Math.floor(d/65536),se=d-b*65536,d=ce+b+65535,b=Math.floor(d/65536),ce=d-b*65536,d=I+b+65535,b=Math.floor(d/65536),I=d-b*65536,d=N+b+65535,b=Math.floor(d/65536),N=d-b*65536,d=X+b+65535,b=Math.floor(d/65536),X=d-b*65536,d=ee+b+65535,b=Math.floor(d/65536),ee=d-b*65536,d=Y+b+65535,b=Math.floor(d/65536),Y=d-b*65536,d=J+b+65535,b=Math.floor(d/65536),J=d-b*65536,d=Q+b+65535,b=Math.floor(d/65536),Q=d-b*65536,d=ie+b+65535,b=Math.floor(d/65536),ie=d-b*65536,d=Ee+b+65535,b=Math.floor(d/65536),Ee=d-b*65536,d=ae+b+65535,b=Math.floor(d/65536),ae=d-b*65536,d=xe+b+65535,b=Math.floor(d/65536),xe=d-b*65536,H+=b-1+37*(b-1),b=1,d=H+b+65535,b=Math.floor(d/65536),H=d-b*65536,d=F+b+65535,b=Math.floor(d/65536),F=d-b*65536,d=V+b+65535,b=Math.floor(d/65536),V=d-b*65536,d=se+b+65535,b=Math.floor(d/65536),se=d-b*65536,d=ce+b+65535,b=Math.floor(d/65536),ce=d-b*65536,d=I+b+65535,b=Math.floor(d/65536),I=d-b*65536,d=N+b+65535,b=Math.floor(d/65536),N=d-b*65536,d=X+b+65535,b=Math.floor(d/65536),X=d-b*65536,d=ee+b+65535,b=Math.floor(d/65536),ee=d-b*65536,d=Y+b+65535,b=Math.floor(d/65536),Y=d-b*65536,d=J+b+65535,b=Math.floor(d/65536),J=d-b*65536,d=Q+b+65535,b=Math.floor(d/65536),Q=d-b*65536,d=ie+b+65535,b=Math.floor(d/65536),ie=d-b*65536,d=Ee+b+65535,b=Math.floor(d/65536),Ee=d-b*65536,d=ae+b+65535,b=Math.floor(d/65536),ae=d-b*65536,d=xe+b+65535,b=Math.floor(d/65536),xe=d-b*65536,H+=b-1+37*(b-1),C[0]=H,C[1]=F,C[2]=V,C[3]=se,C[4]=ce,C[5]=I,C[6]=N,C[7]=X,C[8]=ee,C[9]=Y,C[10]=J,C[11]=Q,C[12]=ie,C[13]=Ee,C[14]=ae,C[15]=xe}function x(C,$){y(C,$,$)}function S(C,$){const E=n();for(let d=0;d<16;d++)E[d]=$[d];for(let d=253;d>=0;d--)x(E,E),d!==2&&d!==4&&y(E,E,$);for(let d=0;d<16;d++)C[d]=E[d]}function P(C,$){const E=new Uint8Array(32),d=new Float64Array(80),b=n(),H=n(),F=n(),V=n(),se=n(),ce=n();for(let ee=0;ee<31;ee++)E[ee]=C[ee];E[31]=C[31]&127|64,E[0]&=248,h(d,$);for(let ee=0;ee<16;ee++)H[ee]=d[ee];b[0]=V[0]=1;for(let ee=254;ee>=0;--ee){const Y=E[ee>>>3]>>>(ee&7)&1;u(b,H,Y),u(F,V,Y),m(se,b,F),w(b,b,F),m(F,H,V),w(H,H,V),x(V,se),x(ce,b),y(b,F,b),y(F,H,se),m(se,b,F),w(b,b,F),x(H,b),w(F,V,ce),y(b,F,a),m(b,b,V),y(F,F,b),y(b,V,ce),y(V,H,d),x(H,se),u(b,H,Y),u(F,V,Y)}for(let ee=0;ee<16;ee++)d[ee+16]=b[ee],d[ee+32]=F[ee],d[ee+48]=H[ee],d[ee+64]=V[ee];const I=d.subarray(32),N=d.subarray(16);S(I,I),y(N,N,I);const X=new Uint8Array(32);return f(X,N),X}r.scalarMult=P;function U(C){return P(C,i)}r.scalarMultBase=U;function j(C){if(C.length!==r.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${r.SECRET_KEY_LENGTH} bytes`);const $=new Uint8Array(C);return{publicKey:U($),secretKey:$}}r.generateKeyPairFromSeed=j;function A(C){const $=(0,e.randomBytes)(32,C),E=j($);return(0,t.wipe)($),E}r.generateKeyPair=A;function T(C,$,E=!1){if(C.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if($.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const d=P(C,$);if(E){let b=0;for(let H=0;H<d.length;H++)b|=d[H];if(b===0)throw new Error("X25519: invalid shared key")}return d}r.sharedKey=T})(jl);function Fl(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function n0(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Fl(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Bl(r,e){e||(e=r.reduce((i,a)=>i+a.length,0));const t=n0(e);let n=0;for(const i of r)t.set(i,n),n+=i.length;return Fl(t)}function Dw(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var i=0;i<r.length;i++){var a=r.charAt(i),c=a.charCodeAt(0);if(t[c]!==255)throw new TypeError(a+" is ambiguous");t[c]=i}var u=r.length,f=r.charAt(0),h=Math.log(u)/Math.log(256),m=Math.log(256)/Math.log(u);function w(S){if(S instanceof Uint8Array||(ArrayBuffer.isView(S)?S=new Uint8Array(S.buffer,S.byteOffset,S.byteLength):Array.isArray(S)&&(S=Uint8Array.from(S))),!(S instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(S.length===0)return"";for(var P=0,U=0,j=0,A=S.length;j!==A&&S[j]===0;)j++,P++;for(var T=(A-j)*m+1>>>0,C=new Uint8Array(T);j!==A;){for(var $=S[j],E=0,d=T-1;($!==0||E<U)&&d!==-1;d--,E++)$+=256*C[d]>>>0,C[d]=$%u>>>0,$=$/u>>>0;if($!==0)throw new Error("Non-zero carry");U=E,j++}for(var b=T-U;b!==T&&C[b]===0;)b++;for(var H=f.repeat(P);b<T;++b)H+=r.charAt(C[b]);return H}function y(S){if(typeof S!="string")throw new TypeError("Expected String");if(S.length===0)return new Uint8Array;var P=0;if(S[P]!==" "){for(var U=0,j=0;S[P]===f;)U++,P++;for(var A=(S.length-P)*h+1>>>0,T=new Uint8Array(A);S[P];){var C=t[S.charCodeAt(P)];if(C===255)return;for(var $=0,E=A-1;(C!==0||$<j)&&E!==-1;E--,$++)C+=u*T[E]>>>0,T[E]=C%256>>>0,C=C/256>>>0;if(C!==0)throw new Error("Non-zero carry");j=$,P++}if(S[P]!==" "){for(var d=A-j;d!==A&&T[d]===0;)d++;for(var b=new Uint8Array(U+(A-d)),H=U;d!==A;)b[H++]=T[d++];return b}}}function x(S){var P=y(S);if(P)return P;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:y,decode:x}}var Sw=Dw,Cw=Sw;const i0=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},Ow=r=>new TextEncoder().encode(r),$w=r=>new TextDecoder().decode(r);class Aw{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Pw{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return s0(this,e)}}class Tw{constructor(e){this.decoders=e}or(e){return s0(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const s0=(r,e)=>new Tw({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});class Rw{constructor(e,t,n,i){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=i,this.encoder=new Aw(e,t,n),this.decoder=new Pw(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Pa=({name:r,prefix:e,encode:t,decode:n})=>new Rw(r,e,t,n),po=({prefix:r,name:e,alphabet:t})=>{const{encode:n,decode:i}=Cw(t,e);return Pa({prefix:r,name:e,encode:n,decode:a=>i0(i(a))})},Nw=(r,e,t,n)=>{const i={};for(let m=0;m<e.length;++m)i[e[m]]=m;let a=r.length;for(;r[a-1]==="=";)--a;const c=new Uint8Array(a*t/8|0);let u=0,f=0,h=0;for(let m=0;m<a;++m){const w=i[r[m]];if(w===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<t|w,u+=t,u>=8&&(u-=8,c[h++]=255&f>>u)}if(u>=t||255&f<<8-u)throw new SyntaxError("Unexpected end of data");return c},Lw=(r,e,t)=>{const n=e[e.length-1]==="=",i=(1<<t)-1;let a="",c=0,u=0;for(let f=0;f<r.length;++f)for(u=u<<8|r[f],c+=8;c>t;)c-=t,a+=e[i&u>>c];if(c&&(a+=e[i&u<<t-c]),n)for(;a.length*t&7;)a+="=";return a},ur=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>Pa({prefix:e,name:r,encode(i){return Lw(i,n,t)},decode(i){return Nw(i,n,t,r)}}),Mw=Pa({prefix:"\0",name:"identity",encode:r=>$w(r),decode:r=>Ow(r)});var Uw=Object.freeze({__proto__:null,identity:Mw});const jw=ur({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Fw=Object.freeze({__proto__:null,base2:jw});const Bw=ur({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var kw=Object.freeze({__proto__:null,base8:Bw});const qw=po({prefix:"9",name:"base10",alphabet:"0123456789"});var zw=Object.freeze({__proto__:null,base10:qw});const Hw=ur({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Ww=ur({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Kw=Object.freeze({__proto__:null,base16:Hw,base16upper:Ww});const Vw=ur({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Gw=ur({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Yw=ur({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Jw=ur({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Zw=ur({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Qw=ur({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Xw=ur({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),eb=ur({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),tb=ur({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var rb=Object.freeze({__proto__:null,base32:Vw,base32upper:Gw,base32pad:Yw,base32padupper:Jw,base32hex:Zw,base32hexupper:Qw,base32hexpad:Xw,base32hexpadupper:eb,base32z:tb});const nb=po({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ib=po({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var sb=Object.freeze({__proto__:null,base36:nb,base36upper:ib});const ob=po({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ab=po({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var cb=Object.freeze({__proto__:null,base58btc:ob,base58flickr:ab});const lb=ur({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),ub=ur({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),hb=ur({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),fb=ur({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var db=Object.freeze({__proto__:null,base64:lb,base64pad:ub,base64url:hb,base64urlpad:fb});const o0=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),pb=o0.reduce((r,e,t)=>(r[t]=e,r),[]),gb=o0.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function mb(r){return r.reduce((e,t)=>(e+=pb[t],e),"")}function vb(r){const e=[];for(const t of r){const n=gb[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}const yb=Pa({prefix:"\u{1F680}",name:"base256emoji",encode:mb,decode:vb});var wb=Object.freeze({__proto__:null,base256emoji:yb}),bb=c0,a0=128,_b=127,Eb=~_b,xb=Math.pow(2,31);function c0(r,e,t){e=e||[],t=t||0;for(var n=t;r>=xb;)e[t++]=r&255|a0,r/=128;for(;r&Eb;)e[t++]=r&255|a0,r>>>=7;return e[t]=r|0,c0.bytes=t-n+1,e}var Ib=kl,Db=128,l0=127;function kl(r,n){var t=0,n=n||0,i=0,a=n,c,u=r.length;do{if(a>=u)throw kl.bytes=0,new RangeError("Could not decode varint");c=r[a++],t+=i<28?(c&l0)<<i:(c&l0)*Math.pow(2,i),i+=7}while(c>=Db);return kl.bytes=a-n,t}var Sb=Math.pow(2,7),Cb=Math.pow(2,14),Ob=Math.pow(2,21),$b=Math.pow(2,28),Ab=Math.pow(2,35),Pb=Math.pow(2,42),Tb=Math.pow(2,49),Rb=Math.pow(2,56),Nb=Math.pow(2,63),Lb=function(r){return r<Sb?1:r<Cb?2:r<Ob?3:r<$b?4:r<Ab?5:r<Pb?6:r<Tb?7:r<Rb?8:r<Nb?9:10},Mb={encode:bb,decode:Ib,encodingLength:Lb},u0=Mb;const h0=(r,e,t=0)=>(u0.encode(r,e,t),e),f0=r=>u0.encodingLength(r),ql=(r,e)=>{const t=e.byteLength,n=f0(r),i=n+f0(t),a=new Uint8Array(i+t);return h0(r,a,0),h0(t,a,n),a.set(e,i),new Ub(r,t,e,a)};class Ub{constructor(e,t,n,i){this.code=e,this.size=t,this.digest=n,this.bytes=i}}const d0=({name:r,code:e,encode:t})=>new jb(r,e,t);class jb{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?ql(this.code,t):t.then(n=>ql(this.code,n))}else throw Error("Unknown type, must be binary type")}}const p0=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),Fb=d0({name:"sha2-256",code:18,encode:p0("SHA-256")}),Bb=d0({name:"sha2-512",code:19,encode:p0("SHA-512")});var kb=Object.freeze({__proto__:null,sha256:Fb,sha512:Bb});const g0=0,qb="identity",m0=i0;var zb=Object.freeze({__proto__:null,identity:{code:g0,name:qb,encode:m0,digest:r=>ql(g0,m0(r))}});new TextEncoder,new TextDecoder;const v0={...Uw,...Fw,...kw,...zw,...Kw,...rb,...sb,...cb,...db,...wb};({...kb,...zb});function y0(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}const w0=y0("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),zl=y0("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=n0(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),b0={utf8:w0,"utf-8":w0,hex:v0.base16,latin1:zl,ascii:zl,binary:zl,...v0};function Tr(r,e="utf8"){const t=b0[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Fl(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}function wr(r,e="utf8"){const t=b0[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}var _0=function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))},Hb=function(){function r(e,t,n){this.name=e,this.version=t,this.os=n,this.type="browser"}return r}(),Wb=function(){function r(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return r}(),Kb=function(){function r(e,t,n,i){this.name=e,this.version=t,this.os=n,this.bot=i,this.type="bot-device"}return r}(),Vb=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),Gb=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),Yb=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Jb=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,E0=3,Zb=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",Yb]],x0=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function Qb(r){return r?I0(r):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Gb:typeof navigator<"u"?I0(navigator.userAgent):t2()}function Xb(r){return r!==""&&Zb.reduce(function(e,t){var n=t[0],i=t[1];if(e)return e;var a=i.exec(r);return!!a&&[n,a]},!1)}function I0(r){var e=Xb(r);if(!e)return null;var t=e[0],n=e[1];if(t==="searchbot")return new Vb;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<E0&&(i=_0(_0([],i,!0),r2(E0-i.length),!0)):i=[];var a=i.join("."),c=e2(r),u=Jb.exec(r);return u&&u[1]?new Kb(t,a,c,u[1]):new Hb(t,a,c)}function e2(r){for(var e=0,t=x0.length;e<t;e++){var n=x0[e],i=n[0],a=n[1],c=a.exec(r);if(c)return i}return null}function t2(){var r=typeof process<"u"&&process.version;return r?new Wb(process.version.slice(1)):null}function r2(r){for(var e=[],t=0;t<r;t++)e.push("0");return e}var ye={};/*! *****************************************************************************
|
|
1
|
+
(function(en,wo){typeof exports=="object"&&typeof module<"u"?wo(exports,require("stream")):typeof define=="function"&&define.amd?define(["exports","stream"],wo):(en=typeof globalThis<"u"?globalThis:en||self,wo(en["@walletconnect/ethereum-provider"]={},en.stream$1))})(this,function(en,wo){"use strict";var pn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function zy(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Li(r){var e=r.default;if(typeof e=="function"){var t=function(){return e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return r[n]}})}),t}var cr={exports:{}},_s=typeof Reflect=="object"?Reflect:null,zd=_s&&typeof _s.apply=="function"?_s.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},Pa;_s&&typeof _s.ownKeys=="function"?Pa=_s.ownKeys:Object.getOwnPropertySymbols?Pa=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Pa=function(e){return Object.getOwnPropertyNames(e)};function qy(r){console&&console.warn&&console.warn(r)}var qd=Number.isNaN||function(e){return e!==e};function dt(){dt.init.call(this)}cr.exports=dt,cr.exports.once=Vy,dt.EventEmitter=dt,dt.prototype._events=void 0,dt.prototype._eventsCount=0,dt.prototype._maxListeners=void 0;var Hd=10;function Ta(r){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r)}Object.defineProperty(dt,"defaultMaxListeners",{enumerable:!0,get:function(){return Hd},set:function(r){if(typeof r!="number"||r<0||qd(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");Hd=r}}),dt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},dt.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||qd(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Wd(r){return r._maxListeners===void 0?dt.defaultMaxListeners:r._maxListeners}dt.prototype.getMaxListeners=function(){return Wd(this)},dt.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e==="error",a=this._events;if(a!==void 0)i=i&&a.error===void 0;else if(!i)return!1;if(i){var c;if(t.length>0&&(c=t[0]),c instanceof Error)throw c;var u=new Error("Unhandled error."+(c?" ("+c.message+")":""));throw u.context=c,u}var f=a[e];if(f===void 0)return!1;if(typeof f=="function")zd(f,this,t);else for(var h=f.length,m=Zd(f,h),n=0;n<h;++n)zd(m[n],this,t);return!0};function Kd(r,e,t,n){var i,a,c;if(Ta(t),a=r._events,a===void 0?(a=r._events=Object.create(null),r._eventsCount=0):(a.newListener!==void 0&&(r.emit("newListener",e,t.listener?t.listener:t),a=r._events),c=a[e]),c===void 0)c=a[e]=t,++r._eventsCount;else if(typeof c=="function"?c=a[e]=n?[t,c]:[c,t]:n?c.unshift(t):c.push(t),i=Wd(r),i>0&&c.length>i&&!c.warned){c.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=r,u.type=e,u.count=c.length,qy(u)}return r}dt.prototype.addListener=function(e,t){return Kd(this,e,t,!1)},dt.prototype.on=dt.prototype.addListener,dt.prototype.prependListener=function(e,t){return Kd(this,e,t,!0)};function Hy(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Vd(r,e,t){var n={fired:!1,wrapFn:void 0,target:r,type:e,listener:t},i=Hy.bind(n);return i.listener=t,n.wrapFn=i,i}dt.prototype.once=function(e,t){return Ta(t),this.on(e,Vd(this,e,t)),this},dt.prototype.prependOnceListener=function(e,t){return Ta(t),this.prependListener(e,Vd(this,e,t)),this},dt.prototype.removeListener=function(e,t){var n,i,a,c,u;if(Ta(t),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if(typeof n!="function"){for(a=-1,c=n.length-1;c>=0;c--)if(n[c]===t||n[c].listener===t){u=n[c].listener,a=c;break}if(a<0)return this;a===0?n.shift():Wy(n,a),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||t)}return this},dt.prototype.off=dt.prototype.removeListener,dt.prototype.removeAllListeners=function(e){var t,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var a=Object.keys(n),c;for(i=0;i<a.length;++i)c=a[i],c!=="removeListener"&&this.removeAllListeners(c);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this};function Gd(r,e,t){var n=r._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?t?[i.listener||i]:[i]:t?Ky(i):Zd(i,i.length)}dt.prototype.listeners=function(e){return Gd(this,e,!0)},dt.prototype.rawListeners=function(e){return Gd(this,e,!1)},dt.listenerCount=function(r,e){return typeof r.listenerCount=="function"?r.listenerCount(e):Yd.call(r,e)},dt.prototype.listenerCount=Yd;function Yd(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}dt.prototype.eventNames=function(){return this._eventsCount>0?Pa(this._events):[]};function Zd(r,e){for(var t=new Array(e),n=0;n<e;++n)t[n]=r[n];return t}function Wy(r,e){for(;e+1<r.length;e++)r[e]=r[e+1];r.pop()}function Ky(r){for(var e=new Array(r.length),t=0;t<e.length;++t)e[t]=r[t].listener||r[t];return e}function Vy(r,e){return new Promise(function(t,n){function i(c){r.removeListener(e,a),n(c)}function a(){typeof r.removeListener=="function"&&r.removeListener("error",i),t([].slice.call(arguments))}Jd(r,e,a,{once:!0}),e!=="error"&&Gy(r,i,{once:!0})})}function Gy(r,e,t){typeof r.on=="function"&&Jd(r,"error",e,t)}function Jd(r,e,t,n){if(typeof r.on=="function")n.once?r.once(e,t):r.on(e,t);else if(typeof r.addEventListener=="function")r.addEventListener(e,function i(a){n.once&&r.removeEventListener(e,i),t(a)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof r)}var kl={},Ra={},Me={},Qd={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});function e(u,f){var h=u>>>16&65535,m=u&65535,w=f>>>16&65535,y=f&65535;return m*y+(h*y+m*w<<16>>>0)|0}r.mul=Math.imul||e;function t(u,f){return u+f|0}r.add=t;function n(u,f){return u-f|0}r.sub=n;function i(u,f){return u<<f|u>>>32-f}r.rotl=i;function a(u,f){return u<<32-f|u>>>f}r.rotr=a;function c(u){return typeof u=="number"&&isFinite(u)&&Math.floor(u)===u}r.isInteger=Number.isInteger||c,r.MAX_SAFE_INTEGER=9007199254740991,r.isSafeInteger=function(u){return r.isInteger(u)&&u>=-r.MAX_SAFE_INTEGER&&u<=r.MAX_SAFE_INTEGER}})(Qd),Object.defineProperty(Me,"__esModule",{value:!0});var Xd=Qd;function Yy(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}Me.readInt16BE=Yy;function Zy(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}Me.readUint16BE=Zy;function Jy(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}Me.readInt16LE=Jy;function Qy(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}Me.readUint16LE=Qy;function ep(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>8,e[t+1]=r>>>0,e}Me.writeUint16BE=ep,Me.writeInt16BE=ep;function tp(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e}Me.writeUint16LE=tp,Me.writeInt16LE=tp;function zl(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}Me.readInt32BE=zl;function ql(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}Me.readUint32BE=ql;function Hl(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}Me.readInt32LE=Hl;function Wl(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}Me.readUint32LE=Wl;function Na(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>24,e[t+1]=r>>>16,e[t+2]=r>>>8,e[t+3]=r>>>0,e}Me.writeUint32BE=Na,Me.writeInt32BE=Na;function La(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}Me.writeUint32LE=La,Me.writeInt32LE=La;function Xy(r,e){e===void 0&&(e=0);var t=zl(r,e),n=zl(r,e+4);return t*4294967296+n-(n>>31)*4294967296}Me.readInt64BE=Xy;function ew(r,e){e===void 0&&(e=0);var t=ql(r,e),n=ql(r,e+4);return t*4294967296+n}Me.readUint64BE=ew;function tw(r,e){e===void 0&&(e=0);var t=Hl(r,e),n=Hl(r,e+4);return n*4294967296+t-(t>>31)*4294967296}Me.readInt64LE=tw;function rw(r,e){e===void 0&&(e=0);var t=Wl(r,e),n=Wl(r,e+4);return n*4294967296+t}Me.readUint64LE=rw;function rp(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),Na(r/4294967296>>>0,e,t),Na(r>>>0,e,t+4),e}Me.writeUint64BE=rp,Me.writeInt64BE=rp;function np(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),La(r>>>0,e,t),La(r/4294967296>>>0,e,t+4),e}Me.writeUint64LE=np,Me.writeInt64LE=np;function nw(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,a=r/8+t-1;a>=t;a--)n+=e[a]*i,i*=256;return n}Me.readUintBE=nw;function iw(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,a=t;a<t+r/8;a++)n+=e[a]*i,i*=256;return n}Me.readUintLE=iw;function sw(r,e,t,n){if(t===void 0&&(t=new Uint8Array(r/8)),n===void 0&&(n=0),r%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!Xd.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var i=1,a=r/8+n-1;a>=n;a--)t[a]=e/i&255,i*=256;return t}Me.writeUintBE=sw;function ow(r,e,t,n){if(t===void 0&&(t=new Uint8Array(r/8)),n===void 0&&(n=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Xd.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,a=n;a<n+r/8;a++)t[a]=e/i&255,i*=256;return t}Me.writeUintLE=ow;function aw(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e)}Me.readFloat32BE=aw;function cw(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e,!0)}Me.readFloat32LE=cw;function lw(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e)}Me.readFloat64BE=lw;function uw(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e,!0)}Me.readFloat64LE=uw;function hw(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(t,r),e}Me.writeFloat32BE=hw;function fw(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(t,r,!0),e}Me.writeFloat32LE=fw;function dw(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(t,r),e}Me.writeFloat64BE=dw;function pw(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(t,r,!0),e}Me.writeFloat64LE=pw;var Br={};Object.defineProperty(Br,"__esModule",{value:!0});function gw(r){for(var e=0;e<r.length;e++)r[e]=0;return r}Br.wipe=gw,Object.defineProperty(Ra,"__esModule",{value:!0});var fr=Me,Kl=Br,mw=20;function vw(r,e,t){for(var n=1634760805,i=857760878,a=2036477234,c=1797285236,u=t[3]<<24|t[2]<<16|t[1]<<8|t[0],f=t[7]<<24|t[6]<<16|t[5]<<8|t[4],h=t[11]<<24|t[10]<<16|t[9]<<8|t[8],m=t[15]<<24|t[14]<<16|t[13]<<8|t[12],w=t[19]<<24|t[18]<<16|t[17]<<8|t[16],y=t[23]<<24|t[22]<<16|t[21]<<8|t[20],b=t[27]<<24|t[26]<<16|t[25]<<8|t[24],I=t[31]<<24|t[30]<<16|t[29]<<8|t[28],A=e[3]<<24|e[2]<<16|e[1]<<8|e[0],U=e[7]<<24|e[6]<<16|e[5]<<8|e[4],j=e[11]<<24|e[10]<<16|e[9]<<8|e[8],$=e[15]<<24|e[14]<<16|e[13]<<8|e[12],T=n,O=i,P=a,x=c,d=u,_=f,H=h,F=m,V=w,se=y,ce=b,D=I,N=A,X=U,ee=j,Y=$,Z=0;Z<mw;Z+=2)T=T+d|0,N^=T,N=N>>>32-16|N<<16,V=V+N|0,d^=V,d=d>>>32-12|d<<12,O=O+_|0,X^=O,X=X>>>32-16|X<<16,se=se+X|0,_^=se,_=_>>>32-12|_<<12,P=P+H|0,ee^=P,ee=ee>>>32-16|ee<<16,ce=ce+ee|0,H^=ce,H=H>>>32-12|H<<12,x=x+F|0,Y^=x,Y=Y>>>32-16|Y<<16,D=D+Y|0,F^=D,F=F>>>32-12|F<<12,P=P+H|0,ee^=P,ee=ee>>>32-8|ee<<8,ce=ce+ee|0,H^=ce,H=H>>>32-7|H<<7,x=x+F|0,Y^=x,Y=Y>>>32-8|Y<<8,D=D+Y|0,F^=D,F=F>>>32-7|F<<7,O=O+_|0,X^=O,X=X>>>32-8|X<<8,se=se+X|0,_^=se,_=_>>>32-7|_<<7,T=T+d|0,N^=T,N=N>>>32-8|N<<8,V=V+N|0,d^=V,d=d>>>32-7|d<<7,T=T+_|0,Y^=T,Y=Y>>>32-16|Y<<16,ce=ce+Y|0,_^=ce,_=_>>>32-12|_<<12,O=O+H|0,N^=O,N=N>>>32-16|N<<16,D=D+N|0,H^=D,H=H>>>32-12|H<<12,P=P+F|0,X^=P,X=X>>>32-16|X<<16,V=V+X|0,F^=V,F=F>>>32-12|F<<12,x=x+d|0,ee^=x,ee=ee>>>32-16|ee<<16,se=se+ee|0,d^=se,d=d>>>32-12|d<<12,P=P+F|0,X^=P,X=X>>>32-8|X<<8,V=V+X|0,F^=V,F=F>>>32-7|F<<7,x=x+d|0,ee^=x,ee=ee>>>32-8|ee<<8,se=se+ee|0,d^=se,d=d>>>32-7|d<<7,O=O+H|0,N^=O,N=N>>>32-8|N<<8,D=D+N|0,H^=D,H=H>>>32-7|H<<7,T=T+_|0,Y^=T,Y=Y>>>32-8|Y<<8,ce=ce+Y|0,_^=ce,_=_>>>32-7|_<<7;fr.writeUint32LE(T+n|0,r,0),fr.writeUint32LE(O+i|0,r,4),fr.writeUint32LE(P+a|0,r,8),fr.writeUint32LE(x+c|0,r,12),fr.writeUint32LE(d+u|0,r,16),fr.writeUint32LE(_+f|0,r,20),fr.writeUint32LE(H+h|0,r,24),fr.writeUint32LE(F+m|0,r,28),fr.writeUint32LE(V+w|0,r,32),fr.writeUint32LE(se+y|0,r,36),fr.writeUint32LE(ce+b|0,r,40),fr.writeUint32LE(D+I|0,r,44),fr.writeUint32LE(N+A|0,r,48),fr.writeUint32LE(X+U|0,r,52),fr.writeUint32LE(ee+j|0,r,56),fr.writeUint32LE(Y+$|0,r,60)}function ip(r,e,t,n,i){if(i===void 0&&(i=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<t.length)throw new Error("ChaCha: destination is shorter than source");var a,c;if(i===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");a=new Uint8Array(16),c=a.length-e.length,a.set(e,c)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");a=e,c=i}for(var u=new Uint8Array(64),f=0;f<t.length;f+=64){vw(u,a,r);for(var h=f;h<f+64&&h<t.length;h++)n[h]=t[h]^u[h-f];ww(a,0,c)}return Kl.wipe(u),i===0&&Kl.wipe(a),n}Ra.streamXOR=ip;function yw(r,e,t,n){return n===void 0&&(n=0),Kl.wipe(t),ip(r,e,t,t,n)}Ra.stream=yw;function ww(r,e,t){for(var n=1;t--;)n=n+(r[e]&255)|0,r[e]=n&255,n>>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}var sp={},oi={};Object.defineProperty(oi,"__esModule",{value:!0});function bw(r,e,t){return~(r-1)&e|r-1&t}oi.select=bw;function _w(r,e){return(r|0)-(e|0)-1>>>31&1}oi.lessOrEqual=_w;function op(r,e){if(r.length!==e.length)return 0;for(var t=0,n=0;n<r.length;n++)t|=r[n]^e[n];return 1&t-1>>>8}oi.compare=op;function Ew(r,e){return r.length===0||e.length===0?!1:op(r,e)!==0}oi.equal=Ew,function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=oi,t=Br;r.DIGEST_LENGTH=16;var n=function(){function c(u){this.digestLength=r.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var f=u[0]|u[1]<<8;this._r[0]=f&8191;var h=u[2]|u[3]<<8;this._r[1]=(f>>>13|h<<3)&8191;var m=u[4]|u[5]<<8;this._r[2]=(h>>>10|m<<6)&7939;var w=u[6]|u[7]<<8;this._r[3]=(m>>>7|w<<9)&8191;var y=u[8]|u[9]<<8;this._r[4]=(w>>>4|y<<12)&255,this._r[5]=y>>>1&8190;var b=u[10]|u[11]<<8;this._r[6]=(y>>>14|b<<2)&8191;var I=u[12]|u[13]<<8;this._r[7]=(b>>>11|I<<5)&8065;var A=u[14]|u[15]<<8;this._r[8]=(I>>>8|A<<8)&8191,this._r[9]=A>>>5&127,this._pad[0]=u[16]|u[17]<<8,this._pad[1]=u[18]|u[19]<<8,this._pad[2]=u[20]|u[21]<<8,this._pad[3]=u[22]|u[23]<<8,this._pad[4]=u[24]|u[25]<<8,this._pad[5]=u[26]|u[27]<<8,this._pad[6]=u[28]|u[29]<<8,this._pad[7]=u[30]|u[31]<<8}return c.prototype._blocks=function(u,f,h){for(var m=this._fin?0:2048,w=this._h[0],y=this._h[1],b=this._h[2],I=this._h[3],A=this._h[4],U=this._h[5],j=this._h[6],$=this._h[7],T=this._h[8],O=this._h[9],P=this._r[0],x=this._r[1],d=this._r[2],_=this._r[3],H=this._r[4],F=this._r[5],V=this._r[6],se=this._r[7],ce=this._r[8],D=this._r[9];h>=16;){var N=u[f+0]|u[f+1]<<8;w+=N&8191;var X=u[f+2]|u[f+3]<<8;y+=(N>>>13|X<<3)&8191;var ee=u[f+4]|u[f+5]<<8;b+=(X>>>10|ee<<6)&8191;var Y=u[f+6]|u[f+7]<<8;I+=(ee>>>7|Y<<9)&8191;var Z=u[f+8]|u[f+9]<<8;A+=(Y>>>4|Z<<12)&8191,U+=Z>>>1&8191;var Q=u[f+10]|u[f+11]<<8;j+=(Z>>>14|Q<<2)&8191;var ie=u[f+12]|u[f+13]<<8;$+=(Q>>>11|ie<<5)&8191;var Ee=u[f+14]|u[f+15]<<8;T+=(ie>>>8|Ee<<8)&8191,O+=Ee>>>5|m;var ae=0,xe=ae;xe+=w*P,xe+=y*(5*D),xe+=b*(5*ce),xe+=I*(5*se),xe+=A*(5*V),ae=xe>>>13,xe&=8191,xe+=U*(5*F),xe+=j*(5*H),xe+=$*(5*_),xe+=T*(5*d),xe+=O*(5*x),ae+=xe>>>13,xe&=8191;var de=ae;de+=w*x,de+=y*P,de+=b*(5*D),de+=I*(5*ce),de+=A*(5*se),ae=de>>>13,de&=8191,de+=U*(5*V),de+=j*(5*F),de+=$*(5*H),de+=T*(5*_),de+=O*(5*d),ae+=de>>>13,de&=8191;var be=ae;be+=w*d,be+=y*x,be+=b*P,be+=I*(5*D),be+=A*(5*ce),ae=be>>>13,be&=8191,be+=U*(5*se),be+=j*(5*V),be+=$*(5*F),be+=T*(5*H),be+=O*(5*_),ae+=be>>>13,be&=8191;var K=ae;K+=w*_,K+=y*d,K+=b*x,K+=I*P,K+=A*(5*D),ae=K>>>13,K&=8191,K+=U*(5*ce),K+=j*(5*se),K+=$*(5*V),K+=T*(5*F),K+=O*(5*H),ae+=K>>>13,K&=8191;var W=ae;W+=w*H,W+=y*_,W+=b*d,W+=I*x,W+=A*P,ae=W>>>13,W&=8191,W+=U*(5*D),W+=j*(5*ce),W+=$*(5*se),W+=T*(5*V),W+=O*(5*F),ae+=W>>>13,W&=8191;var B=ae;B+=w*F,B+=y*H,B+=b*_,B+=I*d,B+=A*x,ae=B>>>13,B&=8191,B+=U*P,B+=j*(5*D),B+=$*(5*ce),B+=T*(5*se),B+=O*(5*V),ae+=B>>>13,B&=8191;var g=ae;g+=w*V,g+=y*F,g+=b*H,g+=I*_,g+=A*d,ae=g>>>13,g&=8191,g+=U*x,g+=j*P,g+=$*(5*D),g+=T*(5*ce),g+=O*(5*se),ae+=g>>>13,g&=8191;var L=ae;L+=w*se,L+=y*V,L+=b*F,L+=I*H,L+=A*_,ae=L>>>13,L&=8191,L+=U*d,L+=j*x,L+=$*P,L+=T*(5*D),L+=O*(5*ce),ae+=L>>>13,L&=8191;var le=ae;le+=w*ce,le+=y*se,le+=b*V,le+=I*F,le+=A*H,ae=le>>>13,le&=8191,le+=U*_,le+=j*d,le+=$*x,le+=T*P,le+=O*(5*D),ae+=le>>>13,le&=8191;var pe=ae;pe+=w*D,pe+=y*ce,pe+=b*se,pe+=I*V,pe+=A*F,ae=pe>>>13,pe&=8191,pe+=U*H,pe+=j*_,pe+=$*d,pe+=T*x,pe+=O*P,ae+=pe>>>13,pe&=8191,ae=(ae<<2)+ae|0,ae=ae+xe|0,xe=ae&8191,ae=ae>>>13,de+=ae,w=xe,y=de,b=be,I=K,A=W,U=B,j=g,$=L,T=le,O=pe,f+=16,h-=16}this._h[0]=w,this._h[1]=y,this._h[2]=b,this._h[3]=I,this._h[4]=A,this._h[5]=U,this._h[6]=j,this._h[7]=$,this._h[8]=T,this._h[9]=O},c.prototype.finish=function(u,f){f===void 0&&(f=0);var h=new Uint16Array(10),m,w,y,b;if(this._leftover){for(b=this._leftover,this._buffer[b++]=1;b<16;b++)this._buffer[b]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(m=this._h[1]>>>13,this._h[1]&=8191,b=2;b<10;b++)this._h[b]+=m,m=this._h[b]>>>13,this._h[b]&=8191;for(this._h[0]+=m*5,m=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=m,m=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=m,h[0]=this._h[0]+5,m=h[0]>>>13,h[0]&=8191,b=1;b<10;b++)h[b]=this._h[b]+m,m=h[b]>>>13,h[b]&=8191;for(h[9]-=8192,w=(m^1)-1,b=0;b<10;b++)h[b]&=w;for(w=~w,b=0;b<10;b++)this._h[b]=this._h[b]&w|h[b];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,y=this._h[0]+this._pad[0],this._h[0]=y&65535,b=1;b<8;b++)y=(this._h[b]+this._pad[b]|0)+(y>>>16)|0,this._h[b]=y&65535;return u[f+0]=this._h[0]>>>0,u[f+1]=this._h[0]>>>8,u[f+2]=this._h[1]>>>0,u[f+3]=this._h[1]>>>8,u[f+4]=this._h[2]>>>0,u[f+5]=this._h[2]>>>8,u[f+6]=this._h[3]>>>0,u[f+7]=this._h[3]>>>8,u[f+8]=this._h[4]>>>0,u[f+9]=this._h[4]>>>8,u[f+10]=this._h[5]>>>0,u[f+11]=this._h[5]>>>8,u[f+12]=this._h[6]>>>0,u[f+13]=this._h[6]>>>8,u[f+14]=this._h[7]>>>0,u[f+15]=this._h[7]>>>8,this._finished=!0,this},c.prototype.update=function(u){var f=0,h=u.length,m;if(this._leftover){m=16-this._leftover,m>h&&(m=h);for(var w=0;w<m;w++)this._buffer[this._leftover+w]=u[f+w];if(h-=m,f+=m,this._leftover+=m,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(h>=16&&(m=h-h%16,this._blocks(u,f,m),f+=m,h-=m),h){for(var w=0;w<h;w++)this._buffer[this._leftover+w]=u[f+w];this._leftover+=h}return this},c.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var u=new Uint8Array(16);return this.finish(u),u},c.prototype.clean=function(){return t.wipe(this._buffer),t.wipe(this._r),t.wipe(this._h),t.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},c}();r.Poly1305=n;function i(c,u){var f=new n(c);f.update(u);var h=f.digest();return f.clean(),h}r.oneTimeAuth=i;function a(c,u){return c.length!==r.DIGEST_LENGTH||u.length!==r.DIGEST_LENGTH?!1:e.equal(c,u)}r.equal=a}(sp),function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=Ra,t=sp,n=Br,i=Me,a=oi;r.KEY_LENGTH=32,r.NONCE_LENGTH=12,r.TAG_LENGTH=16;var c=new Uint8Array(16),u=function(){function f(h){if(this.nonceLength=r.NONCE_LENGTH,this.tagLength=r.TAG_LENGTH,h.length!==r.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(h)}return f.prototype.seal=function(h,m,w,y){if(h.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var b=new Uint8Array(16);b.set(h,b.length-h.length);var I=new Uint8Array(32);e.stream(this._key,b,I,4);var A=m.length+this.tagLength,U;if(y){if(y.length!==A)throw new Error("ChaCha20Poly1305: incorrect destination length");U=y}else U=new Uint8Array(A);return e.streamXOR(this._key,b,m,U,4),this._authenticate(U.subarray(U.length-this.tagLength,U.length),I,U.subarray(0,U.length-this.tagLength),w),n.wipe(b),U},f.prototype.open=function(h,m,w,y){if(h.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(m.length<this.tagLength)return null;var b=new Uint8Array(16);b.set(h,b.length-h.length);var I=new Uint8Array(32);e.stream(this._key,b,I,4);var A=new Uint8Array(this.tagLength);if(this._authenticate(A,I,m.subarray(0,m.length-this.tagLength),w),!a.equal(A,m.subarray(m.length-this.tagLength,m.length)))return null;var U=m.length-this.tagLength,j;if(y){if(y.length!==U)throw new Error("ChaCha20Poly1305: incorrect destination length");j=y}else j=new Uint8Array(U);return e.streamXOR(this._key,b,m.subarray(0,m.length-this.tagLength),j,4),n.wipe(b),j},f.prototype.clean=function(){return n.wipe(this._key),this},f.prototype._authenticate=function(h,m,w,y){var b=new t.Poly1305(m);y&&(b.update(y),y.length%16>0&&b.update(c.subarray(y.length%16))),b.update(w),w.length%16>0&&b.update(c.subarray(w.length%16));var I=new Uint8Array(8);y&&i.writeUint64LE(y.length,I),b.update(I),i.writeUint64LE(w.length,I),b.update(I);for(var A=b.digest(),U=0;U<A.length;U++)h[U]=A[U];b.clean(),n.wipe(A),n.wipe(I)},f}();r.ChaCha20Poly1305=u}(kl);var ap={},bo={},Vl={};Object.defineProperty(Vl,"__esModule",{value:!0});function xw(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}Vl.isSerializableHash=xw,Object.defineProperty(bo,"__esModule",{value:!0});var xn=Vl,Iw=oi,Dw=Br,cp=function(){function r(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(n).clean():n.set(t);for(var i=0;i<n.length;i++)n[i]^=54;this._inner.update(n);for(var i=0;i<n.length;i++)n[i]^=106;this._outer.update(n),xn.isSerializableHash(this._inner)&&xn.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),Dw.wipe(n)}return r.prototype.reset=function(){if(!xn.isSerializableHash(this._inner)||!xn.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.clean=function(){xn.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),xn.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},r.prototype.update=function(e){return this._inner.update(e),this},r.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(!xn.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},r.prototype.restoreState=function(e){if(!xn.isSerializableHash(this._inner)||!xn.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.cleanSavedState=function(e){if(!xn.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},r}();bo.HMAC=cp;function Sw(r,e,t){var n=new cp(r,e);n.update(t);var i=n.digest();return n.clean(),i}bo.hmac=Sw,bo.equal=Iw.equal,Object.defineProperty(ap,"__esModule",{value:!0});var lp=bo,up=Br,Ow=function(){function r(e,t,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var a=lp.hmac(this._hash,n,t);this._hmac=new lp.HMAC(e,a),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},r.prototype.expand=function(e){for(var t=new Uint8Array(e),n=0;n<t.length;n++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[n]=this._buffer[this._bufpos++];return t},r.prototype.clean=function(){this._hmac.clean(),up.wipe(this._buffer),up.wipe(this._counter),this._bufpos=0},r}(),Cw=ap.HKDF=Ow,Es={},Ma={},Ua={};Object.defineProperty(Ua,"__esModule",{value:!0}),Ua.BrowserRandomSource=void 0;const hp=65536;class $w{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const t=new Uint8Array(e);for(let n=0;n<t.length;n+=hp)this._crypto.getRandomValues(t.subarray(n,n+Math.min(t.length-n,hp)));return t}}Ua.BrowserRandomSource=$w;function Aw(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ja={},Pw={},Tw=Object.freeze({__proto__:null,default:Pw}),Rw=Li(Tw);Object.defineProperty(ja,"__esModule",{value:!0}),ja.NodeRandomSource=void 0;const Nw=Br;class Lw{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Aw<"u"){const e=Rw;e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const n=new Uint8Array(e);for(let i=0;i<n.length;i++)n[i]=t[i];return(0,Nw.wipe)(t),n}}ja.NodeRandomSource=Lw,Object.defineProperty(Ma,"__esModule",{value:!0}),Ma.SystemRandomSource=void 0;const Mw=Ua,Uw=ja;class jw{constructor(){if(this.isAvailable=!1,this.name="",this._source=new Mw.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new Uw.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}Ma.SystemRandomSource=jw,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.randomStringForEntropy=r.randomString=r.randomUint32=r.randomBytes=r.defaultRandomSource=void 0;const e=Ma,t=Me,n=Br;r.defaultRandomSource=new e.SystemRandomSource;function i(h,m=r.defaultRandomSource){return m.randomBytes(h)}r.randomBytes=i;function a(h=r.defaultRandomSource){const m=i(4,h),w=(0,t.readUint32LE)(m);return(0,n.wipe)(m),w}r.randomUint32=a;const c="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function u(h,m=c,w=r.defaultRandomSource){if(m.length<2)throw new Error("randomString charset is too short");if(m.length>256)throw new Error("randomString charset is too long");let y="";const b=m.length,I=256-256%b;for(;h>0;){const A=i(Math.ceil(h*256/I),w);for(let U=0;U<A.length&&h>0;U++){const j=A[U];j<I&&(y+=m.charAt(j%b),h--)}(0,n.wipe)(A)}return y}r.randomString=u;function f(h,m=c,w=r.defaultRandomSource){const y=Math.ceil(h/(Math.log(m.length)/Math.LN2));return u(y,m,w)}r.randomStringForEntropy=f}(Es);var Fa={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=Me,t=Br;r.DIGEST_LENGTH=32,r.BLOCK_SIZE=64;var n=function(){function u(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return u.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},u.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},u.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._temp),this.reset()},u.prototype.update=function(f,h){if(h===void 0&&(h=f.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var m=0;if(this._bytesHashed+=h,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&h>0;)this._buffer[this._bufferLength++]=f[m++],h--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(h>=this.blockSize&&(m=a(this._temp,this._state,f,m,h),h%=this.blockSize);h>0;)this._buffer[this._bufferLength++]=f[m++],h--;return this},u.prototype.finish=function(f){if(!this._finished){var h=this._bytesHashed,m=this._bufferLength,w=h/536870912|0,y=h<<3,b=h%64<56?64:128;this._buffer[m]=128;for(var I=m+1;I<b-8;I++)this._buffer[I]=0;e.writeUint32BE(w,this._buffer,b-8),e.writeUint32BE(y,this._buffer,b-4),a(this._temp,this._state,this._buffer,0,b),this._finished=!0}for(var I=0;I<this.digestLength/4;I++)e.writeUint32BE(this._state[I],f,I*4);return this},u.prototype.digest=function(){var f=new Uint8Array(this.digestLength);return this.finish(f),f},u.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},u.prototype.restoreState=function(f){return this._state.set(f.state),this._bufferLength=f.bufferLength,f.buffer&&this._buffer.set(f.buffer),this._bytesHashed=f.bytesHashed,this._finished=!1,this},u.prototype.cleanSavedState=function(f){t.wipe(f.state),f.buffer&&t.wipe(f.buffer),f.bufferLength=0,f.bytesHashed=0},u}();r.SHA256=n;var i=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function a(u,f,h,m,w){for(;w>=64;){for(var y=f[0],b=f[1],I=f[2],A=f[3],U=f[4],j=f[5],$=f[6],T=f[7],O=0;O<16;O++){var P=m+O*4;u[O]=e.readUint32BE(h,P)}for(var O=16;O<64;O++){var x=u[O-2],d=(x>>>17|x<<32-17)^(x>>>19|x<<32-19)^x>>>10;x=u[O-15];var _=(x>>>7|x<<32-7)^(x>>>18|x<<32-18)^x>>>3;u[O]=(d+u[O-7]|0)+(_+u[O-16]|0)}for(var O=0;O<64;O++){var d=(((U>>>6|U<<26)^(U>>>11|U<<21)^(U>>>25|U<<7))+(U&j^~U&$)|0)+(T+(i[O]+u[O]|0)|0)|0,_=((y>>>2|y<<32-2)^(y>>>13|y<<32-13)^(y>>>22|y<<32-22))+(y&b^y&I^b&I)|0;T=$,$=j,j=U,U=A+d|0,A=I,I=b,b=y,y=d+_|0}f[0]+=y,f[1]+=b,f[2]+=I,f[3]+=A,f[4]+=U,f[5]+=j,f[6]+=$,f[7]+=T,m+=64,w-=64}return m}function c(u){var f=new n;f.update(u);var h=f.digest();return f.clean(),h}r.hash=c})(Fa);var Gl={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.sharedKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.scalarMultBase=r.scalarMult=r.SHARED_KEY_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=void 0;const e=Es,t=Br;r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=32,r.SHARED_KEY_LENGTH=32;function n(O){const P=new Float64Array(16);if(O)for(let x=0;x<O.length;x++)P[x]=O[x];return P}const i=new Uint8Array(32);i[0]=9;const a=n([56129,1]);function c(O){let P=1;for(let x=0;x<16;x++){let d=O[x]+P+65535;P=Math.floor(d/65536),O[x]=d-P*65536}O[0]+=P-1+37*(P-1)}function u(O,P,x){const d=~(x-1);for(let _=0;_<16;_++){const H=d&(O[_]^P[_]);O[_]^=H,P[_]^=H}}function f(O,P){const x=n(),d=n();for(let _=0;_<16;_++)d[_]=P[_];c(d),c(d),c(d);for(let _=0;_<2;_++){x[0]=d[0]-65517;for(let F=1;F<15;F++)x[F]=d[F]-65535-(x[F-1]>>16&1),x[F-1]&=65535;x[15]=d[15]-32767-(x[14]>>16&1);const H=x[15]>>16&1;x[14]&=65535,u(d,x,1-H)}for(let _=0;_<16;_++)O[2*_]=d[_]&255,O[2*_+1]=d[_]>>8}function h(O,P){for(let x=0;x<16;x++)O[x]=P[2*x]+(P[2*x+1]<<8);O[15]&=32767}function m(O,P,x){for(let d=0;d<16;d++)O[d]=P[d]+x[d]}function w(O,P,x){for(let d=0;d<16;d++)O[d]=P[d]-x[d]}function y(O,P,x){let d,_,H=0,F=0,V=0,se=0,ce=0,D=0,N=0,X=0,ee=0,Y=0,Z=0,Q=0,ie=0,Ee=0,ae=0,xe=0,de=0,be=0,K=0,W=0,B=0,g=0,L=0,le=0,pe=0,Oe=0,Ke=0,Ze=0,ke=0,St=0,Ot=0,qe=x[0],Ce=x[1],Ue=x[2],je=x[3],He=x[4],Ae=x[5],Fe=x[6],Se=x[7],Te=x[8],Ve=x[9],$e=x[10],Je=x[11],Xe=x[12],ot=x[13],at=x[14],rt=x[15];d=P[0],H+=d*qe,F+=d*Ce,V+=d*Ue,se+=d*je,ce+=d*He,D+=d*Ae,N+=d*Fe,X+=d*Se,ee+=d*Te,Y+=d*Ve,Z+=d*$e,Q+=d*Je,ie+=d*Xe,Ee+=d*ot,ae+=d*at,xe+=d*rt,d=P[1],F+=d*qe,V+=d*Ce,se+=d*Ue,ce+=d*je,D+=d*He,N+=d*Ae,X+=d*Fe,ee+=d*Se,Y+=d*Te,Z+=d*Ve,Q+=d*$e,ie+=d*Je,Ee+=d*Xe,ae+=d*ot,xe+=d*at,de+=d*rt,d=P[2],V+=d*qe,se+=d*Ce,ce+=d*Ue,D+=d*je,N+=d*He,X+=d*Ae,ee+=d*Fe,Y+=d*Se,Z+=d*Te,Q+=d*Ve,ie+=d*$e,Ee+=d*Je,ae+=d*Xe,xe+=d*ot,de+=d*at,be+=d*rt,d=P[3],se+=d*qe,ce+=d*Ce,D+=d*Ue,N+=d*je,X+=d*He,ee+=d*Ae,Y+=d*Fe,Z+=d*Se,Q+=d*Te,ie+=d*Ve,Ee+=d*$e,ae+=d*Je,xe+=d*Xe,de+=d*ot,be+=d*at,K+=d*rt,d=P[4],ce+=d*qe,D+=d*Ce,N+=d*Ue,X+=d*je,ee+=d*He,Y+=d*Ae,Z+=d*Fe,Q+=d*Se,ie+=d*Te,Ee+=d*Ve,ae+=d*$e,xe+=d*Je,de+=d*Xe,be+=d*ot,K+=d*at,W+=d*rt,d=P[5],D+=d*qe,N+=d*Ce,X+=d*Ue,ee+=d*je,Y+=d*He,Z+=d*Ae,Q+=d*Fe,ie+=d*Se,Ee+=d*Te,ae+=d*Ve,xe+=d*$e,de+=d*Je,be+=d*Xe,K+=d*ot,W+=d*at,B+=d*rt,d=P[6],N+=d*qe,X+=d*Ce,ee+=d*Ue,Y+=d*je,Z+=d*He,Q+=d*Ae,ie+=d*Fe,Ee+=d*Se,ae+=d*Te,xe+=d*Ve,de+=d*$e,be+=d*Je,K+=d*Xe,W+=d*ot,B+=d*at,g+=d*rt,d=P[7],X+=d*qe,ee+=d*Ce,Y+=d*Ue,Z+=d*je,Q+=d*He,ie+=d*Ae,Ee+=d*Fe,ae+=d*Se,xe+=d*Te,de+=d*Ve,be+=d*$e,K+=d*Je,W+=d*Xe,B+=d*ot,g+=d*at,L+=d*rt,d=P[8],ee+=d*qe,Y+=d*Ce,Z+=d*Ue,Q+=d*je,ie+=d*He,Ee+=d*Ae,ae+=d*Fe,xe+=d*Se,de+=d*Te,be+=d*Ve,K+=d*$e,W+=d*Je,B+=d*Xe,g+=d*ot,L+=d*at,le+=d*rt,d=P[9],Y+=d*qe,Z+=d*Ce,Q+=d*Ue,ie+=d*je,Ee+=d*He,ae+=d*Ae,xe+=d*Fe,de+=d*Se,be+=d*Te,K+=d*Ve,W+=d*$e,B+=d*Je,g+=d*Xe,L+=d*ot,le+=d*at,pe+=d*rt,d=P[10],Z+=d*qe,Q+=d*Ce,ie+=d*Ue,Ee+=d*je,ae+=d*He,xe+=d*Ae,de+=d*Fe,be+=d*Se,K+=d*Te,W+=d*Ve,B+=d*$e,g+=d*Je,L+=d*Xe,le+=d*ot,pe+=d*at,Oe+=d*rt,d=P[11],Q+=d*qe,ie+=d*Ce,Ee+=d*Ue,ae+=d*je,xe+=d*He,de+=d*Ae,be+=d*Fe,K+=d*Se,W+=d*Te,B+=d*Ve,g+=d*$e,L+=d*Je,le+=d*Xe,pe+=d*ot,Oe+=d*at,Ke+=d*rt,d=P[12],ie+=d*qe,Ee+=d*Ce,ae+=d*Ue,xe+=d*je,de+=d*He,be+=d*Ae,K+=d*Fe,W+=d*Se,B+=d*Te,g+=d*Ve,L+=d*$e,le+=d*Je,pe+=d*Xe,Oe+=d*ot,Ke+=d*at,Ze+=d*rt,d=P[13],Ee+=d*qe,ae+=d*Ce,xe+=d*Ue,de+=d*je,be+=d*He,K+=d*Ae,W+=d*Fe,B+=d*Se,g+=d*Te,L+=d*Ve,le+=d*$e,pe+=d*Je,Oe+=d*Xe,Ke+=d*ot,Ze+=d*at,ke+=d*rt,d=P[14],ae+=d*qe,xe+=d*Ce,de+=d*Ue,be+=d*je,K+=d*He,W+=d*Ae,B+=d*Fe,g+=d*Se,L+=d*Te,le+=d*Ve,pe+=d*$e,Oe+=d*Je,Ke+=d*Xe,Ze+=d*ot,ke+=d*at,St+=d*rt,d=P[15],xe+=d*qe,de+=d*Ce,be+=d*Ue,K+=d*je,W+=d*He,B+=d*Ae,g+=d*Fe,L+=d*Se,le+=d*Te,pe+=d*Ve,Oe+=d*$e,Ke+=d*Je,Ze+=d*Xe,ke+=d*ot,St+=d*at,Ot+=d*rt,H+=38*de,F+=38*be,V+=38*K,se+=38*W,ce+=38*B,D+=38*g,N+=38*L,X+=38*le,ee+=38*pe,Y+=38*Oe,Z+=38*Ke,Q+=38*Ze,ie+=38*ke,Ee+=38*St,ae+=38*Ot,_=1,d=H+_+65535,_=Math.floor(d/65536),H=d-_*65536,d=F+_+65535,_=Math.floor(d/65536),F=d-_*65536,d=V+_+65535,_=Math.floor(d/65536),V=d-_*65536,d=se+_+65535,_=Math.floor(d/65536),se=d-_*65536,d=ce+_+65535,_=Math.floor(d/65536),ce=d-_*65536,d=D+_+65535,_=Math.floor(d/65536),D=d-_*65536,d=N+_+65535,_=Math.floor(d/65536),N=d-_*65536,d=X+_+65535,_=Math.floor(d/65536),X=d-_*65536,d=ee+_+65535,_=Math.floor(d/65536),ee=d-_*65536,d=Y+_+65535,_=Math.floor(d/65536),Y=d-_*65536,d=Z+_+65535,_=Math.floor(d/65536),Z=d-_*65536,d=Q+_+65535,_=Math.floor(d/65536),Q=d-_*65536,d=ie+_+65535,_=Math.floor(d/65536),ie=d-_*65536,d=Ee+_+65535,_=Math.floor(d/65536),Ee=d-_*65536,d=ae+_+65535,_=Math.floor(d/65536),ae=d-_*65536,d=xe+_+65535,_=Math.floor(d/65536),xe=d-_*65536,H+=_-1+37*(_-1),_=1,d=H+_+65535,_=Math.floor(d/65536),H=d-_*65536,d=F+_+65535,_=Math.floor(d/65536),F=d-_*65536,d=V+_+65535,_=Math.floor(d/65536),V=d-_*65536,d=se+_+65535,_=Math.floor(d/65536),se=d-_*65536,d=ce+_+65535,_=Math.floor(d/65536),ce=d-_*65536,d=D+_+65535,_=Math.floor(d/65536),D=d-_*65536,d=N+_+65535,_=Math.floor(d/65536),N=d-_*65536,d=X+_+65535,_=Math.floor(d/65536),X=d-_*65536,d=ee+_+65535,_=Math.floor(d/65536),ee=d-_*65536,d=Y+_+65535,_=Math.floor(d/65536),Y=d-_*65536,d=Z+_+65535,_=Math.floor(d/65536),Z=d-_*65536,d=Q+_+65535,_=Math.floor(d/65536),Q=d-_*65536,d=ie+_+65535,_=Math.floor(d/65536),ie=d-_*65536,d=Ee+_+65535,_=Math.floor(d/65536),Ee=d-_*65536,d=ae+_+65535,_=Math.floor(d/65536),ae=d-_*65536,d=xe+_+65535,_=Math.floor(d/65536),xe=d-_*65536,H+=_-1+37*(_-1),O[0]=H,O[1]=F,O[2]=V,O[3]=se,O[4]=ce,O[5]=D,O[6]=N,O[7]=X,O[8]=ee,O[9]=Y,O[10]=Z,O[11]=Q,O[12]=ie,O[13]=Ee,O[14]=ae,O[15]=xe}function b(O,P){y(O,P,P)}function I(O,P){const x=n();for(let d=0;d<16;d++)x[d]=P[d];for(let d=253;d>=0;d--)b(x,x),d!==2&&d!==4&&y(x,x,P);for(let d=0;d<16;d++)O[d]=x[d]}function A(O,P){const x=new Uint8Array(32),d=new Float64Array(80),_=n(),H=n(),F=n(),V=n(),se=n(),ce=n();for(let ee=0;ee<31;ee++)x[ee]=O[ee];x[31]=O[31]&127|64,x[0]&=248,h(d,P);for(let ee=0;ee<16;ee++)H[ee]=d[ee];_[0]=V[0]=1;for(let ee=254;ee>=0;--ee){const Y=x[ee>>>3]>>>(ee&7)&1;u(_,H,Y),u(F,V,Y),m(se,_,F),w(_,_,F),m(F,H,V),w(H,H,V),b(V,se),b(ce,_),y(_,F,_),y(F,H,se),m(se,_,F),w(_,_,F),b(H,_),w(F,V,ce),y(_,F,a),m(_,_,V),y(F,F,_),y(_,V,ce),y(V,H,d),b(H,se),u(_,H,Y),u(F,V,Y)}for(let ee=0;ee<16;ee++)d[ee+16]=_[ee],d[ee+32]=F[ee],d[ee+48]=H[ee],d[ee+64]=V[ee];const D=d.subarray(32),N=d.subarray(16);I(D,D),y(N,N,D);const X=new Uint8Array(32);return f(X,N),X}r.scalarMult=A;function U(O){return A(O,i)}r.scalarMultBase=U;function j(O){if(O.length!==r.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${r.SECRET_KEY_LENGTH} bytes`);const P=new Uint8Array(O);return{publicKey:U(P),secretKey:P}}r.generateKeyPairFromSeed=j;function $(O){const P=(0,e.randomBytes)(32,O),x=j(P);return(0,t.wipe)(P),x}r.generateKeyPair=$;function T(O,P,x=!1){if(O.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(P.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const d=A(O,P);if(x){let _=0;for(let H=0;H<d.length;H++)_|=d[H];if(_===0)throw new Error("X25519: invalid shared key")}return d}r.sharedKey=T})(Gl);function Yl(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function fp(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Yl(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Zl(r,e){e||(e=r.reduce((i,a)=>i+a.length,0));const t=fp(e);let n=0;for(const i of r)t.set(i,n),n+=i.length;return Yl(t)}function Fw(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var i=0;i<r.length;i++){var a=r.charAt(i),c=a.charCodeAt(0);if(t[c]!==255)throw new TypeError(a+" is ambiguous");t[c]=i}var u=r.length,f=r.charAt(0),h=Math.log(u)/Math.log(256),m=Math.log(256)/Math.log(u);function w(I){if(I instanceof Uint8Array||(ArrayBuffer.isView(I)?I=new Uint8Array(I.buffer,I.byteOffset,I.byteLength):Array.isArray(I)&&(I=Uint8Array.from(I))),!(I instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(I.length===0)return"";for(var A=0,U=0,j=0,$=I.length;j!==$&&I[j]===0;)j++,A++;for(var T=($-j)*m+1>>>0,O=new Uint8Array(T);j!==$;){for(var P=I[j],x=0,d=T-1;(P!==0||x<U)&&d!==-1;d--,x++)P+=256*O[d]>>>0,O[d]=P%u>>>0,P=P/u>>>0;if(P!==0)throw new Error("Non-zero carry");U=x,j++}for(var _=T-U;_!==T&&O[_]===0;)_++;for(var H=f.repeat(A);_<T;++_)H+=r.charAt(O[_]);return H}function y(I){if(typeof I!="string")throw new TypeError("Expected String");if(I.length===0)return new Uint8Array;var A=0;if(I[A]!==" "){for(var U=0,j=0;I[A]===f;)U++,A++;for(var $=(I.length-A)*h+1>>>0,T=new Uint8Array($);I[A];){var O=t[I.charCodeAt(A)];if(O===255)return;for(var P=0,x=$-1;(O!==0||P<j)&&x!==-1;x--,P++)O+=u*T[x]>>>0,T[x]=O%256>>>0,O=O/256>>>0;if(O!==0)throw new Error("Non-zero carry");j=P,A++}if(I[A]!==" "){for(var d=$-j;d!==$&&T[d]===0;)d++;for(var _=new Uint8Array(U+($-d)),H=U;d!==$;)_[H++]=T[d++];return _}}}function b(I){var A=y(I);if(A)return A;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:y,decode:b}}var Bw=Fw,kw=Bw;const dp=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},zw=r=>new TextEncoder().encode(r),qw=r=>new TextDecoder().decode(r);class Hw{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Ww{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return pp(this,e)}}class Kw{constructor(e){this.decoders=e}or(e){return pp(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const pp=(r,e)=>new Kw({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}});class Vw{constructor(e,t,n,i){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=i,this.encoder=new Hw(e,t,n),this.decoder=new Ww(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Ba=({name:r,prefix:e,encode:t,decode:n})=>new Vw(r,e,t,n),_o=({prefix:r,name:e,alphabet:t})=>{const{encode:n,decode:i}=kw(t,e);return Ba({prefix:r,name:e,encode:n,decode:a=>dp(i(a))})},Gw=(r,e,t,n)=>{const i={};for(let m=0;m<e.length;++m)i[e[m]]=m;let a=r.length;for(;r[a-1]==="=";)--a;const c=new Uint8Array(a*t/8|0);let u=0,f=0,h=0;for(let m=0;m<a;++m){const w=i[r[m]];if(w===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<t|w,u+=t,u>=8&&(u-=8,c[h++]=255&f>>u)}if(u>=t||255&f<<8-u)throw new SyntaxError("Unexpected end of data");return c},Yw=(r,e,t)=>{const n=e[e.length-1]==="=",i=(1<<t)-1;let a="",c=0,u=0;for(let f=0;f<r.length;++f)for(u=u<<8|r[f],c+=8;c>t;)c-=t,a+=e[i&u>>c];if(c&&(a+=e[i&u<<t-c]),n)for(;a.length*t&7;)a+="=";return a},lr=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>Ba({prefix:e,name:r,encode(i){return Yw(i,n,t)},decode(i){return Gw(i,n,t,r)}}),Zw=Ba({prefix:"\0",name:"identity",encode:r=>qw(r),decode:r=>zw(r)});var Jw=Object.freeze({__proto__:null,identity:Zw});const Qw=lr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Xw=Object.freeze({__proto__:null,base2:Qw});const eb=lr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var tb=Object.freeze({__proto__:null,base8:eb});const rb=_o({prefix:"9",name:"base10",alphabet:"0123456789"});var nb=Object.freeze({__proto__:null,base10:rb});const ib=lr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),sb=lr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var ob=Object.freeze({__proto__:null,base16:ib,base16upper:sb});const ab=lr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),cb=lr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),lb=lr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ub=lr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),hb=lr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),fb=lr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),db=lr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),pb=lr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),gb=lr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var mb=Object.freeze({__proto__:null,base32:ab,base32upper:cb,base32pad:lb,base32padupper:ub,base32hex:hb,base32hexupper:fb,base32hexpad:db,base32hexpadupper:pb,base32z:gb});const vb=_o({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),yb=_o({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var wb=Object.freeze({__proto__:null,base36:vb,base36upper:yb});const bb=_o({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),_b=_o({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Eb=Object.freeze({__proto__:null,base58btc:bb,base58flickr:_b});const xb=lr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Ib=lr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Db=lr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Sb=lr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ob=Object.freeze({__proto__:null,base64:xb,base64pad:Ib,base64url:Db,base64urlpad:Sb});const gp=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Cb=gp.reduce((r,e,t)=>(r[t]=e,r),[]),$b=gp.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function Ab(r){return r.reduce((e,t)=>(e+=Cb[t],e),"")}function Pb(r){const e=[];for(const t of r){const n=$b[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}const Tb=Ba({prefix:"\u{1F680}",name:"base256emoji",encode:Ab,decode:Pb});var Rb=Object.freeze({__proto__:null,base256emoji:Tb}),Nb=vp,mp=128,Lb=127,Mb=~Lb,Ub=Math.pow(2,31);function vp(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Ub;)e[t++]=r&255|mp,r/=128;for(;r&Mb;)e[t++]=r&255|mp,r>>>=7;return e[t]=r|0,vp.bytes=t-n+1,e}var jb=Jl,Fb=128,yp=127;function Jl(r,n){var t=0,n=n||0,i=0,a=n,c,u=r.length;do{if(a>=u)throw Jl.bytes=0,new RangeError("Could not decode varint");c=r[a++],t+=i<28?(c&yp)<<i:(c&yp)*Math.pow(2,i),i+=7}while(c>=Fb);return Jl.bytes=a-n,t}var Bb=Math.pow(2,7),kb=Math.pow(2,14),zb=Math.pow(2,21),qb=Math.pow(2,28),Hb=Math.pow(2,35),Wb=Math.pow(2,42),Kb=Math.pow(2,49),Vb=Math.pow(2,56),Gb=Math.pow(2,63),Yb=function(r){return r<Bb?1:r<kb?2:r<zb?3:r<qb?4:r<Hb?5:r<Wb?6:r<Kb?7:r<Vb?8:r<Gb?9:10},Zb={encode:Nb,decode:jb,encodingLength:Yb},wp=Zb;const bp=(r,e,t=0)=>(wp.encode(r,e,t),e),_p=r=>wp.encodingLength(r),Ql=(r,e)=>{const t=e.byteLength,n=_p(r),i=n+_p(t),a=new Uint8Array(i+t);return bp(r,a,0),bp(t,a,n),a.set(e,i),new Jb(r,t,e,a)};class Jb{constructor(e,t,n,i){this.code=e,this.size=t,this.digest=n,this.bytes=i}}const Ep=({name:r,code:e,encode:t})=>new Qb(r,e,t);class Qb{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Ql(this.code,t):t.then(n=>Ql(this.code,n))}else throw Error("Unknown type, must be binary type")}}const xp=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),Xb=Ep({name:"sha2-256",code:18,encode:xp("SHA-256")}),e2=Ep({name:"sha2-512",code:19,encode:xp("SHA-512")});var t2=Object.freeze({__proto__:null,sha256:Xb,sha512:e2});const Ip=0,r2="identity",Dp=dp;var n2=Object.freeze({__proto__:null,identity:{code:Ip,name:r2,encode:Dp,digest:r=>Ql(Ip,Dp(r))}});new TextEncoder,new TextDecoder;const Sp={...Jw,...Xw,...tb,...nb,...ob,...mb,...wb,...Eb,...Ob,...Rb};({...t2,...n2});function Op(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}const Cp=Op("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Xl=Op("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=fp(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),$p={utf8:Cp,"utf-8":Cp,hex:Sp.base16,latin1:Xl,ascii:Xl,binary:Xl,...Sp};function $r(r,e="utf8"){const t=$p[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Yl(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}function vr(r,e="utf8"){const t=$p[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}var Ap=function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))},i2=function(){function r(e,t,n){this.name=e,this.version=t,this.os=n,this.type="browser"}return r}(),s2=function(){function r(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return r}(),o2=function(){function r(e,t,n,i){this.name=e,this.version=t,this.os=n,this.bot=i,this.type="bot-device"}return r}(),a2=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),c2=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),l2=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,u2=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Pp=3,h2=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",l2]],Tp=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function f2(r){return r?Rp(r):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new c2:typeof navigator<"u"?Rp(navigator.userAgent):g2()}function d2(r){return r!==""&&h2.reduce(function(e,t){var n=t[0],i=t[1];if(e)return e;var a=i.exec(r);return!!a&&[n,a]},!1)}function Rp(r){var e=d2(r);if(!e)return null;var t=e[0],n=e[1];if(t==="searchbot")return new a2;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<Pp&&(i=Ap(Ap([],i,!0),m2(Pp-i.length),!0)):i=[];var a=i.join("."),c=p2(r),u=u2.exec(r);return u&&u[1]?new o2(t,a,c,u[1]):new i2(t,a,c)}function p2(r){for(var e=0,t=Tp.length;e<t;e++){var n=Tp[e],i=n[0],a=n[1],c=a.exec(r);if(c)return i}return null}function g2(){var r=typeof process<"u"&&process.version;return r?new s2(process.version.slice(1)):null}function m2(r){for(var e=[],t=0;t<r;t++)e.push("0");return e}var me={};/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
12
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
13
|
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
-
***************************************************************************** */var Hl=function(r,e){return Hl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},Hl(r,e)};function n2(r,e){Hl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Wl=function(){return Wl=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},Wl.apply(this,arguments)};function i2(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function s2(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var u=r.length-1;u>=0;u--)(c=r[u])&&(a=(i<3?c(a):i>3?c(e,t,a):c(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a}function o2(r,e){return function(t,n){e(t,n,r)}}function a2(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function c2(r,e,t,n){function i(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function u(m){try{h(n.next(m))}catch(w){c(w)}}function f(m){try{h(n.throw(m))}catch(w){c(w)}}function h(m){m.done?a(m.value):i(m.value).then(u,f)}h((n=n.apply(r,e||[])).next())})}function l2(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,c;return c={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(h){return function(m){return f([h,m])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(a=h[0]&2?i.return:h[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,h[1])).done)return a;switch(i=0,a&&(h=[h[0]&2,a.value]),h[0]){case 0:case 1:a=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,i=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!a||h[1]>a[0]&&h[1]<a[3])){t.label=h[1];break}if(h[0]===6&&t.label<a[1]){t.label=a[1],a=h;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(h);break}a[2]&&t.ops.pop(),t.trys.pop();continue}h=e.call(r,t)}catch(m){h=[6,m],i=0}finally{n=a=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function u2(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}function h2(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function Kl(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function D0(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,a=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(u){c={error:u}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(c)throw c.error}}return a}function f2(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(D0(arguments[e]));return r}function d2(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),i=0,e=0;e<t;e++)for(var a=arguments[e],c=0,u=a.length;c<u;c++,i++)n[i]=a[c];return n}function go(r){return this instanceof go?(this.v=r,this):new go(r)}function p2(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(y){n[y]&&(i[y]=function(x){return new Promise(function(S,P){a.push([y,x,S,P])>1||u(y,x)})})}function u(y,x){try{f(n[y](x))}catch(S){w(a[0][3],S)}}function f(y){y.value instanceof go?Promise.resolve(y.value.v).then(h,m):w(a[0][2],y)}function h(y){u("next",y)}function m(y){u("throw",y)}function w(y,x){y(x),a.shift(),a.length&&u(a[0][0],a[0][1])}}function g2(r){var e,t;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,a){e[i]=r[i]?function(c){return(t=!t)?{value:go(r[i](c)),done:i==="return"}:a?a(c):c}:a}}function m2(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof Kl=="function"?Kl(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(c){return new Promise(function(u,f){c=r[a](c),i(u,f,c.done,c.value)})}}function i(a,c,u,f){Promise.resolve(f).then(function(h){a({value:h,done:u})},c)}}function v2(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function y2(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function w2(r){return r&&r.__esModule?r:{default:r}}function b2(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function _2(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var E2=Object.freeze({__proto__:null,__extends:n2,get __assign(){return Wl},__rest:i2,__decorate:s2,__param:o2,__metadata:a2,__awaiter:c2,__generator:l2,__createBinding:u2,__exportStar:h2,__values:Kl,__read:D0,__spread:f2,__spreadArrays:d2,__await:go,__asyncGenerator:p2,__asyncDelegator:g2,__asyncValues:m2,__makeTemplateObject:v2,__importStar:y2,__importDefault:w2,__classPrivateFieldGet:b2,__classPrivateFieldSet:_2}),Ta=Pi(E2),Vl={},mo={},S0;function x2(){if(S0)return mo;S0=1,Object.defineProperty(mo,"__esModule",{value:!0}),mo.delay=void 0;function r(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}return mo.delay=r,mo}var Ti={},Gl={},Ri={},C0;function I2(){return C0||(C0=1,Object.defineProperty(Ri,"__esModule",{value:!0}),Ri.ONE_THOUSAND=Ri.ONE_HUNDRED=void 0,Ri.ONE_HUNDRED=100,Ri.ONE_THOUSAND=1e3),Ri}var Yl={},O0;function D2(){return O0||(O0=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ONE_YEAR=r.FOUR_WEEKS=r.THREE_WEEKS=r.TWO_WEEKS=r.ONE_WEEK=r.THIRTY_DAYS=r.SEVEN_DAYS=r.FIVE_DAYS=r.THREE_DAYS=r.ONE_DAY=r.TWENTY_FOUR_HOURS=r.TWELVE_HOURS=r.SIX_HOURS=r.THREE_HOURS=r.ONE_HOUR=r.SIXTY_MINUTES=r.THIRTY_MINUTES=r.TEN_MINUTES=r.FIVE_MINUTES=r.ONE_MINUTE=r.SIXTY_SECONDS=r.THIRTY_SECONDS=r.TEN_SECONDS=r.FIVE_SECONDS=r.ONE_SECOND=void 0,r.ONE_SECOND=1,r.FIVE_SECONDS=5,r.TEN_SECONDS=10,r.THIRTY_SECONDS=30,r.SIXTY_SECONDS=60,r.ONE_MINUTE=r.SIXTY_SECONDS,r.FIVE_MINUTES=r.ONE_MINUTE*5,r.TEN_MINUTES=r.ONE_MINUTE*10,r.THIRTY_MINUTES=r.ONE_MINUTE*30,r.SIXTY_MINUTES=r.ONE_MINUTE*60,r.ONE_HOUR=r.SIXTY_MINUTES,r.THREE_HOURS=r.ONE_HOUR*3,r.SIX_HOURS=r.ONE_HOUR*6,r.TWELVE_HOURS=r.ONE_HOUR*12,r.TWENTY_FOUR_HOURS=r.ONE_HOUR*24,r.ONE_DAY=r.TWENTY_FOUR_HOURS,r.THREE_DAYS=r.ONE_DAY*3,r.FIVE_DAYS=r.ONE_DAY*5,r.SEVEN_DAYS=r.ONE_DAY*7,r.THIRTY_DAYS=r.ONE_DAY*30,r.ONE_WEEK=r.SEVEN_DAYS,r.TWO_WEEKS=r.ONE_WEEK*2,r.THREE_WEEKS=r.ONE_WEEK*3,r.FOUR_WEEKS=r.ONE_WEEK*4,r.ONE_YEAR=r.ONE_DAY*365}(Yl)),Yl}var $0;function A0(){return $0||($0=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Ta;e.__exportStar(I2(),r),e.__exportStar(D2(),r)}(Gl)),Gl}var P0;function S2(){if(P0)return Ti;P0=1,Object.defineProperty(Ti,"__esModule",{value:!0}),Ti.fromMiliseconds=Ti.toMiliseconds=void 0;const r=A0();function e(n){return n*r.ONE_THOUSAND}Ti.toMiliseconds=e;function t(n){return Math.floor(n/r.ONE_THOUSAND)}return Ti.fromMiliseconds=t,Ti}var T0;function C2(){return T0||(T0=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Ta;e.__exportStar(x2(),r),e.__exportStar(S2(),r)}(Vl)),Vl}var ys={},R0;function O2(){if(R0)return ys;R0=1,Object.defineProperty(ys,"__esModule",{value:!0}),ys.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(t){if(this.timestamps.has(t))throw new Error(`Watch already started for label: ${t}`);this.timestamps.set(t,{started:Date.now()})}stop(t){const n=this.get(t);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${t}`);const i=Date.now()-n.started;this.timestamps.set(t,{started:n.started,elapsed:i})}get(t){const n=this.timestamps.get(t);if(typeof n>"u")throw new Error(`No timestamp found for label: ${t}`);return n}elapsed(t){const n=this.get(t);return n.elapsed||Date.now()-n.started}}return ys.Watch=r,ys.default=r,ys}var Jl={},vo={},N0;function $2(){if(N0)return vo;N0=1,Object.defineProperty(vo,"__esModule",{value:!0}),vo.IWatch=void 0;class r{}return vo.IWatch=r,vo}var L0;function A2(){return L0||(L0=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),Ta.__exportStar($2(),r)}(Jl)),Jl}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Ta;e.__exportStar(C2(),r),e.__exportStar(O2(),r),e.__exportStar(A2(),r),e.__exportStar(A0(),r)})(ye);var bt={};Object.defineProperty(bt,"__esModule",{value:!0}),bt.getLocalStorage=bt.getLocalStorageOrThrow=bt.getCrypto=bt.getCryptoOrThrow=M0=bt.getLocation=bt.getLocationOrThrow=Ql=bt.getNavigator=bt.getNavigatorOrThrow=Zl=bt.getDocument=bt.getDocumentOrThrow=bt.getFromWindowOrThrow=bt.getFromWindow=void 0;function Ni(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}bt.getFromWindow=Ni;function ws(r){const e=Ni(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}bt.getFromWindowOrThrow=ws;function P2(){return ws("document")}bt.getDocumentOrThrow=P2;function T2(){return Ni("document")}var Zl=bt.getDocument=T2;function R2(){return ws("navigator")}bt.getNavigatorOrThrow=R2;function N2(){return Ni("navigator")}var Ql=bt.getNavigator=N2;function L2(){return ws("location")}bt.getLocationOrThrow=L2;function M2(){return Ni("location")}var M0=bt.getLocation=M2;function U2(){return ws("crypto")}bt.getCryptoOrThrow=U2;function j2(){return Ni("crypto")}bt.getCrypto=j2;function F2(){return ws("localStorage")}bt.getLocalStorageOrThrow=F2;function B2(){return Ni("localStorage")}bt.getLocalStorage=B2;var Xl={};Object.defineProperty(Xl,"__esModule",{value:!0});var U0=Xl.getWindowMetadata=void 0;const j0=bt;function k2(){let r,e;try{r=j0.getDocumentOrThrow(),e=j0.getLocationOrThrow()}catch{return null}function t(){const w=r.getElementsByTagName("link"),y=[];for(let x=0;x<w.length;x++){const S=w[x],P=S.getAttribute("rel");if(P&&P.toLowerCase().indexOf("icon")>-1){const U=S.getAttribute("href");if(U)if(U.toLowerCase().indexOf("https:")===-1&&U.toLowerCase().indexOf("http:")===-1&&U.indexOf("//")!==0){let j=e.protocol+"//"+e.host;if(U.indexOf("/")===0)j+=U;else{const A=e.pathname.split("/");A.pop();const T=A.join("/");j+=T+"/"+U}y.push(j)}else if(U.indexOf("//")===0){const j=e.protocol+U;y.push(j)}else y.push(U)}}return y}function n(...w){const y=r.getElementsByTagName("meta");for(let x=0;x<y.length;x++){const S=y[x],P=["itemprop","property","name"].map(U=>S.getAttribute(U)).filter(U=>U?w.includes(U):!1);if(P.length&&P){const U=S.getAttribute("content");if(U)return U}}return""}function i(){let w=n("name","og:site_name","og:title","twitter:title");return w||(w=r.title),w}function a(){return n("description","og:description","twitter:description","keywords")}const c=i(),u=a(),f=e.origin,h=t();return{description:u,url:f,icons:h,name:c}}U0=Xl.getWindowMetadata=k2;var yo={},q2=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),F0="%[a-f0-9]{2}",B0=new RegExp("("+F0+")|([^%]+?)","gi"),k0=new RegExp("("+F0+")+","gi");function eu(r,e){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),n=r.slice(e);return Array.prototype.concat.call([],eu(t),eu(n))}function z2(r){try{return decodeURIComponent(r)}catch{for(var e=r.match(B0)||[],t=1;t<e.length;t++)r=eu(e,t).join(""),e=r.match(B0)||[];return r}}function H2(r){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},t=k0.exec(r);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{var n=z2(t[0]);n!==t[0]&&(e[t[0]]=n)}t=k0.exec(r)}e["%C2"]="\uFFFD";for(var i=Object.keys(e),a=0;a<i.length;a++){var c=i[a];r=r.replace(new RegExp(c,"g"),e[c])}return r}var W2=function(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch{return H2(r)}},K2=(r,e)=>{if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[r];const t=r.indexOf(e);return t===-1?[r]:[r.slice(0,t),r.slice(t+e.length)]},V2=function(r,e){for(var t={},n=Object.keys(r),i=Array.isArray(e),a=0;a<n.length;a++){var c=n[a],u=r[c];(i?e.indexOf(c)!==-1:e(c,u,r))&&(t[c]=u)}return t};(function(r){const e=q2,t=W2,n=K2,i=V2,a=A=>A==null,c=Symbol("encodeFragmentIdentifier");function u(A){switch(A.arrayFormat){case"index":return T=>(C,$)=>{const E=C.length;return $===void 0||A.skipNull&&$===null||A.skipEmptyString&&$===""?C:$===null?[...C,[m(T,A),"[",E,"]"].join("")]:[...C,[m(T,A),"[",m(E,A),"]=",m($,A)].join("")]};case"bracket":return T=>(C,$)=>$===void 0||A.skipNull&&$===null||A.skipEmptyString&&$===""?C:$===null?[...C,[m(T,A),"[]"].join("")]:[...C,[m(T,A),"[]=",m($,A)].join("")];case"colon-list-separator":return T=>(C,$)=>$===void 0||A.skipNull&&$===null||A.skipEmptyString&&$===""?C:$===null?[...C,[m(T,A),":list="].join("")]:[...C,[m(T,A),":list=",m($,A)].join("")];case"comma":case"separator":case"bracket-separator":{const T=A.arrayFormat==="bracket-separator"?"[]=":"=";return C=>($,E)=>E===void 0||A.skipNull&&E===null||A.skipEmptyString&&E===""?$:(E=E===null?"":E,$.length===0?[[m(C,A),T,m(E,A)].join("")]:[[$,m(E,A)].join(A.arrayFormatSeparator)])}default:return T=>(C,$)=>$===void 0||A.skipNull&&$===null||A.skipEmptyString&&$===""?C:$===null?[...C,m(T,A)]:[...C,[m(T,A),"=",m($,A)].join("")]}}function f(A){let T;switch(A.arrayFormat){case"index":return(C,$,E)=>{if(T=/\[(\d*)\]$/.exec(C),C=C.replace(/\[\d*\]$/,""),!T){E[C]=$;return}E[C]===void 0&&(E[C]={}),E[C][T[1]]=$};case"bracket":return(C,$,E)=>{if(T=/(\[\])$/.exec(C),C=C.replace(/\[\]$/,""),!T){E[C]=$;return}if(E[C]===void 0){E[C]=[$];return}E[C]=[].concat(E[C],$)};case"colon-list-separator":return(C,$,E)=>{if(T=/(:list)$/.exec(C),C=C.replace(/:list$/,""),!T){E[C]=$;return}if(E[C]===void 0){E[C]=[$];return}E[C]=[].concat(E[C],$)};case"comma":case"separator":return(C,$,E)=>{const d=typeof $=="string"&&$.includes(A.arrayFormatSeparator),b=typeof $=="string"&&!d&&w($,A).includes(A.arrayFormatSeparator);$=b?w($,A):$;const H=d||b?$.split(A.arrayFormatSeparator).map(F=>w(F,A)):$===null?$:w($,A);E[C]=H};case"bracket-separator":return(C,$,E)=>{const d=/(\[\])$/.test(C);if(C=C.replace(/\[\]$/,""),!d){E[C]=$&&w($,A);return}const b=$===null?[]:$.split(A.arrayFormatSeparator).map(H=>w(H,A));if(E[C]===void 0){E[C]=b;return}E[C]=[].concat(E[C],b)};default:return(C,$,E)=>{if(E[C]===void 0){E[C]=$;return}E[C]=[].concat(E[C],$)}}}function h(A){if(typeof A!="string"||A.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function m(A,T){return T.encode?T.strict?e(A):encodeURIComponent(A):A}function w(A,T){return T.decode?t(A):A}function y(A){return Array.isArray(A)?A.sort():typeof A=="object"?y(Object.keys(A)).sort((T,C)=>Number(T)-Number(C)).map(T=>A[T]):A}function x(A){const T=A.indexOf("#");return T!==-1&&(A=A.slice(0,T)),A}function S(A){let T="";const C=A.indexOf("#");return C!==-1&&(T=A.slice(C)),T}function P(A){A=x(A);const T=A.indexOf("?");return T===-1?"":A.slice(T+1)}function U(A,T){return T.parseNumbers&&!Number.isNaN(Number(A))&&typeof A=="string"&&A.trim()!==""?A=Number(A):T.parseBooleans&&A!==null&&(A.toLowerCase()==="true"||A.toLowerCase()==="false")&&(A=A.toLowerCase()==="true"),A}function j(A,T){T=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},T),h(T.arrayFormatSeparator);const C=f(T),$=Object.create(null);if(typeof A!="string"||(A=A.trim().replace(/^[?#&]/,""),!A))return $;for(const E of A.split("&")){if(E==="")continue;let[d,b]=n(T.decode?E.replace(/\+/g," "):E,"=");b=b===void 0?null:["comma","separator","bracket-separator"].includes(T.arrayFormat)?b:w(b,T),C(w(d,T),b,$)}for(const E of Object.keys($)){const d=$[E];if(typeof d=="object"&&d!==null)for(const b of Object.keys(d))d[b]=U(d[b],T);else $[E]=U(d,T)}return T.sort===!1?$:(T.sort===!0?Object.keys($).sort():Object.keys($).sort(T.sort)).reduce((E,d)=>{const b=$[d];return b&&typeof b=="object"&&!Array.isArray(b)?E[d]=y(b):E[d]=b,E},Object.create(null))}r.extract=P,r.parse=j,r.stringify=(A,T)=>{if(!A)return"";T=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},T),h(T.arrayFormatSeparator);const C=b=>T.skipNull&&a(A[b])||T.skipEmptyString&&A[b]==="",$=u(T),E={};for(const b of Object.keys(A))C(b)||(E[b]=A[b]);const d=Object.keys(E);return T.sort!==!1&&d.sort(T.sort),d.map(b=>{const H=A[b];return H===void 0?"":H===null?m(b,T):Array.isArray(H)?H.length===0&&T.arrayFormat==="bracket-separator"?m(b,T)+"[]":H.reduce($(b),[]).join("&"):m(b,T)+"="+m(H,T)}).filter(b=>b.length>0).join("&")},r.parseUrl=(A,T)=>{T=Object.assign({decode:!0},T);const[C,$]=n(A,"#");return Object.assign({url:C.split("?")[0]||"",query:j(P(A),T)},T&&T.parseFragmentIdentifier&&$?{fragmentIdentifier:w($,T)}:{})},r.stringifyUrl=(A,T)=>{T=Object.assign({encode:!0,strict:!0,[c]:!0},T);const C=x(A.url).split("?")[0]||"",$=r.extract(A.url),E=r.parse($,{sort:!1}),d=Object.assign(E,A.query);let b=r.stringify(d,T);b&&(b=`?${b}`);let H=S(A.url);return A.fragmentIdentifier&&(H=`#${T[c]?m(A.fragmentIdentifier,T):A.fragmentIdentifier}`),`${C}${b}${H}`},r.pick=(A,T,C)=>{C=Object.assign({parseFragmentIdentifier:!0,[c]:!1},C);const{url:$,query:E,fragmentIdentifier:d}=r.parseUrl(A,C);return r.stringifyUrl({url:$,query:i(E,T),fragmentIdentifier:d},C)},r.exclude=(A,T,C)=>{const $=Array.isArray(T)?E=>!T.includes(E):(E,d)=>!T(E,d);return r.pick(A,$,C)}})(yo);const G2={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe"}},Y2=":";function J2(r){const[e,t]=r.split(Y2);return{namespace:e,reference:t}}function Z2(r,e=[]){const t=[];return Object.keys(r).forEach(n=>{if(e.length&&!e.includes(n))return;const i=r[n];t.push(...i.accounts)}),t}function q0(r,e){return r.includes(":")?[r]:e.chains||[]}const z0="base10",br="base16",tu="base64pad",ru="utf8",H0=0,Li=1,Q2=0,W0=1,nu=12,iu=32;function X2(){const r=jl.generateKeyPair();return{privateKey:wr(r.secretKey,br),publicKey:wr(r.publicKey,br)}}function su(){const r=vs.randomBytes(iu);return wr(r,br)}function e_(r,e){const t=jl.sharedKey(Tr(r,br),Tr(e,br),!0),n=new pw(Aa.SHA256,t).expand(iu);return wr(n,br)}function t_(r){const e=Aa.hash(Tr(r,br));return wr(e,br)}function bs(r){const e=Aa.hash(Tr(r,ru));return wr(e,br)}function r_(r){return Tr(`${r}`,z0)}function wo(r){return Number(wr(r,z0))}function n_(r){const e=r_(typeof r.type<"u"?r.type:H0);if(wo(e)===Li&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const t=typeof r.senderPublicKey<"u"?Tr(r.senderPublicKey,br):void 0,n=typeof r.iv<"u"?Tr(r.iv,br):vs.randomBytes(nu),i=new Pl.ChaCha20Poly1305(Tr(r.symKey,br)).seal(n,Tr(r.message,ru));return s_({type:e,sealed:i,iv:n,senderPublicKey:t})}function i_(r){const e=new Pl.ChaCha20Poly1305(Tr(r.symKey,br)),{sealed:t,iv:n}=Ra(r.encoded),i=e.open(n,t);if(i===null)throw new Error("Failed to decrypt");return wr(i,ru)}function s_(r){if(wo(r.type)===Li){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return wr(Bl([r.type,r.senderPublicKey,r.iv,r.sealed]),tu)}return wr(Bl([r.type,r.iv,r.sealed]),tu)}function Ra(r){const e=Tr(r,tu),t=e.slice(Q2,W0),n=W0;if(wo(t)===Li){const u=n+iu,f=u+nu,h=e.slice(n,u),m=e.slice(u,f),w=e.slice(f);return{type:t,sealed:w,iv:m,senderPublicKey:h}}const i=n+nu,a=e.slice(n,i),c=e.slice(i);return{type:t,sealed:c,iv:a}}function o_(r,e){const t=Ra(r);return K0({type:wo(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?wr(t.senderPublicKey,br):void 0,receiverPublicKey:e?.receiverPublicKey})}function K0(r){const e=r?.type||H0;if(e===Li){if(typeof r?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof r?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:r?.senderPublicKey,receiverPublicKey:r?.receiverPublicKey}}function V0(r){return r.type===Li&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}var a_=Object.defineProperty,G0=Object.getOwnPropertySymbols,c_=Object.prototype.hasOwnProperty,l_=Object.prototype.propertyIsEnumerable,Y0=(r,e,t)=>e in r?a_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,J0=(r,e)=>{for(var t in e||(e={}))c_.call(e,t)&&Y0(r,t,e[t]);if(G0)for(var t of G0(e))l_.call(e,t)&&Y0(r,t,e[t]);return r};const u_="ReactNative",Hr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},h_="js";function ou(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function _s(){return!Zl()&&!!Ql()&&navigator.product===u_}function Es(){return!ou()&&!!Ql()&&!!Zl()}function bo(){return _s()?Hr.reactNative:ou()?Hr.node:Es()?Hr.browser:Hr.unknown}function f_(){var r;try{return _s()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(r=global.Application)==null?void 0:r.applicationId:void 0}catch{return}}function d_(r,e){let t=yo.parse(r);return t=J0(J0({},t),e),r=yo.stringify(t),r}function p_(){return U0()||{name:"",description:"",url:"",icons:[""]}}function g_(){if(bo()===Hr.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:t,Version:n}=global.Platform;return[t,n].join("-")}const r=Qb();if(r===null)return"unknown";const e=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[e,r.name,r.version].join("-"):[e,r.version].join("-")}function m_(){var r;const e=bo();return e===Hr.browser?[e,((r=M0())==null?void 0:r.host)||"unknown"].join(":"):e}function v_(r,e,t){const n=g_(),i=m_();return[[r,e].join("-"),[h_,t].join("-"),n,i].join("/")}function y_({protocol:r,version:e,relayUrl:t,sdkVersion:n,auth:i,projectId:a,useOnCloseEvent:c,bundleId:u}){const f=t.split("?"),h=v_(r,e,n),m={auth:i,ua:h,projectId:a,useOnCloseEvent:c||void 0,origin:u||void 0},w=d_(f[1]||"",m);return f[0]+"?"+w}function Mi(r,e){return r.filter(t=>e.includes(t)).length===r.length}function Z0(r){return Object.fromEntries(r.entries())}function Q0(r){return new Map(Object.entries(r))}function xs(r=ye.FIVE_MINUTES,e){const t=ye.toMiliseconds(r||ye.FIVE_MINUTES);let n,i,a;return{resolve:c=>{a&&n&&(clearTimeout(a),n(c))},reject:c=>{a&&i&&(clearTimeout(a),i(c))},done:()=>new Promise((c,u)=>{a=setTimeout(()=>{u(new Error(e))},t),n=c,i=u})}}function _o(r,e,t){return new Promise(async(n,i)=>{const a=setTimeout(()=>i(new Error(t)),e);try{const c=await r;n(c)}catch(c){i(c)}clearTimeout(a)})}function X0(r,e){if(typeof e=="string"&&e.startsWith(`${r}:`))return e;if(r.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(r.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${r}`)}function w_(r){return X0("topic",r)}function b_(r){return X0("id",r)}function ep(r){const[e,t]=r.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")n.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))n.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return n}function Wr(r,e){return ye.fromMiliseconds((e||Date.now())+ye.toMiliseconds(r))}function ii(r){return Date.now()>=ye.toMiliseconds(r)}function qt(r,e){return`${r}${e?`:${e}`:""}`}function au(r=[],e=[]){return[...new Set([...r,...e])]}async function __({id:r,topic:e,wcDeepLink:t}){try{if(!t)return;const n=typeof t=="string"?JSON.parse(t):t;let i=n?.href;if(typeof i!="string")return;i.endsWith("/")&&(i=i.slice(0,-1));const a=`${i}/wc?requestId=${r}&sessionTopic=${e}`,c=bo();c===Hr.browser?a.startsWith("https://")?window.open(a,"_blank","noreferrer noopener"):window.open(a,"_self","noreferrer noopener"):c===Hr.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(a)}catch(n){console.error(n)}}async function E_(r,e){try{return await r.getItem(e)||(Es()?localStorage.getItem(e):void 0)}catch(t){console.error(t)}}const x_="irn";function cu(r){return r?.relay||{protocol:x_}}function Na(r){const e=G2[r];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${r}`);return e}var I_=Object.defineProperty,D_=Object.defineProperties,S_=Object.getOwnPropertyDescriptors,tp=Object.getOwnPropertySymbols,C_=Object.prototype.hasOwnProperty,O_=Object.prototype.propertyIsEnumerable,rp=(r,e,t)=>e in r?I_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,$_=(r,e)=>{for(var t in e||(e={}))C_.call(e,t)&&rp(r,t,e[t]);if(tp)for(var t of tp(e))O_.call(e,t)&&rp(r,t,e[t]);return r},A_=(r,e)=>D_(r,S_(e));function P_(r,e="-"){const t={},n="relay"+e;return Object.keys(r).forEach(i=>{if(i.startsWith(n)){const a=i.replace(n,""),c=r[i];t[a]=c}}),t}function np(r){r=r.includes("wc://")?r.replace("wc://",""):r,r=r.includes("wc:")?r.replace("wc:",""):r;const e=r.indexOf(":"),t=r.indexOf("?")!==-1?r.indexOf("?"):void 0,n=r.substring(0,e),i=r.substring(e+1,t).split("@"),a=typeof t<"u"?r.substring(t):"",c=yo.parse(a);return{protocol:n,topic:T_(i[0]),version:parseInt(i[1],10),symKey:c.symKey,relay:P_(c),expiryTimestamp:c.expiryTimestamp?parseInt(c.expiryTimestamp,10):void 0}}function T_(r){return r.startsWith("//")?r.substring(2):r}function R_(r,e="-"){const t="relay",n={};return Object.keys(r).forEach(i=>{const a=t+e+i;r[i]&&(n[a]=r[i])}),n}function N_(r){return`${r.protocol}:${r.topic}@${r.version}?`+yo.stringify(A_($_({symKey:r.symKey},R_(r.relay)),{expiryTimestamp:r.expiryTimestamp}))}function Is(r){const e=[];return r.forEach(t=>{const[n,i]=t.split(":");e.push(`${n}:${i}`)}),e}function L_(r){const e=[];return Object.values(r).forEach(t=>{e.push(...Is(t.accounts))}),e}function M_(r,e){const t=[];return Object.values(r).forEach(n=>{Is(n.accounts).includes(e)&&t.push(...n.methods)}),t}function U_(r,e){const t=[];return Object.values(r).forEach(n=>{Is(n.accounts).includes(e)&&t.push(...n.events)}),t}function lu(r){return r.includes(":")}function Eo(r){return lu(r)?r.split(":")[0]:r}const j_={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},F_={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ue(r,e){const{message:t,code:n}=F_[r];return{message:e?`${t} ${e}`:t,code:n}}function It(r,e){const{message:t,code:n}=j_[r];return{message:e?`${t} ${e}`:t,code:n}}function En(r,e){return Array.isArray(r)?typeof e<"u"&&r.length?r.every(e):!0:!1}function xo(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function _r(r){return typeof r>"u"}function ir(r,e){return e&&_r(r)?!0:typeof r=="string"&&!!r.trim().length}function uu(r,e){return e&&_r(r)?!0:typeof r=="number"&&!isNaN(r)}function B_(r,e){const{requiredNamespaces:t}=e,n=Object.keys(r.namespaces),i=Object.keys(t);let a=!0;return Mi(i,n)?(n.forEach(c=>{const{accounts:u,methods:f,events:h}=r.namespaces[c],m=Is(u),w=t[c];(!Mi(q0(c,w),m)||!Mi(w.methods,f)||!Mi(w.events,h))&&(a=!1)}),a):!1}function La(r){return ir(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function k_(r){if(ir(r,!1)&&r.includes(":")){const e=r.split(":");if(e.length===3){const t=e[0]+":"+e[1];return!!e[2]&&La(t)}}return!1}function q_(r){if(ir(r,!1))try{return typeof new URL(r)<"u"}catch{return!1}return!1}function z_(r){var e;return(e=r?.proposer)==null?void 0:e.publicKey}function H_(r){return r?.topic}function W_(r,e){let t=null;return ir(r?.publicKey,!1)||(t=ue("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function ip(r){let e=!0;return En(r)?r.length&&(e=r.every(t=>ir(t,!1))):e=!1,e}function K_(r,e,t){let n=null;return En(e)&&e.length?e.forEach(i=>{n||La(i)||(n=It("UNSUPPORTED_CHAINS",`${t}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):La(r)||(n=It("UNSUPPORTED_CHAINS",`${t}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function V_(r,e,t){let n=null;return Object.entries(r).forEach(([i,a])=>{if(n)return;const c=K_(i,q0(i,a),`${e} ${t}`);c&&(n=c)}),n}function G_(r,e){let t=null;return En(r)?r.forEach(n=>{t||k_(n)||(t=It("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):t=It("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function Y_(r,e){let t=null;return Object.values(r).forEach(n=>{if(t)return;const i=G_(n?.accounts,`${e} namespace`);i&&(t=i)}),t}function J_(r,e){let t=null;return ip(r?.methods)?ip(r?.events)||(t=It("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=It("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function sp(r,e){let t=null;return Object.values(r).forEach(n=>{if(t)return;const i=J_(n,`${e}, namespace`);i&&(t=i)}),t}function Z_(r,e,t){let n=null;if(r&&xo(r)){const i=sp(r,e);i&&(n=i);const a=V_(r,e,t);a&&(n=a)}else n=ue("MISSING_OR_INVALID",`${e}, ${t} should be an object with data`);return n}function hu(r,e){let t=null;if(r&&xo(r)){const n=sp(r,e);n&&(t=n);const i=Y_(r,e);i&&(t=i)}else t=ue("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function op(r){return ir(r.protocol,!0)}function Q_(r,e){let t=!1;return e&&!r?t=!0:r&&En(r)&&r.length&&r.forEach(n=>{t=op(n)}),t}function X_(r){return typeof r=="number"}function Rr(r){return typeof r<"u"&&typeof r!==null}function e3(r){return!(!r||typeof r!="object"||!r.code||!uu(r.code,!1)||!r.message||!ir(r.message,!1))}function t3(r){return!(_r(r)||!ir(r.method,!1))}function r3(r){return!(_r(r)||_r(r.result)&&_r(r.error)||!uu(r.id,!1)||!ir(r.jsonrpc,!1))}function n3(r){return!(_r(r)||!ir(r.name,!1))}function ap(r,e){return!(!La(e)||!L_(r).includes(e))}function i3(r,e,t){return ir(t,!1)?M_(r,e).includes(t):!1}function s3(r,e,t){return ir(t,!1)?U_(r,e).includes(t):!1}function cp(r,e,t){let n=null;const i=o3(r),a=a3(e),c=Object.keys(i),u=Object.keys(a),f=lp(Object.keys(r)),h=lp(Object.keys(e)),m=f.filter(w=>!h.includes(w));return m.length&&(n=ue("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy requiredNamespaces.
|
|
14
|
+
***************************************************************************** */var eu=function(r,e){return eu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},eu(r,e)};function v2(r,e){eu(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var tu=function(){return tu=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},tu.apply(this,arguments)};function y2(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function w2(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var u=r.length-1;u>=0;u--)(c=r[u])&&(a=(i<3?c(a):i>3?c(e,t,a):c(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a}function b2(r,e){return function(t,n){e(t,n,r)}}function _2(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function E2(r,e,t,n){function i(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function u(m){try{h(n.next(m))}catch(w){c(w)}}function f(m){try{h(n.throw(m))}catch(w){c(w)}}function h(m){m.done?a(m.value):i(m.value).then(u,f)}h((n=n.apply(r,e||[])).next())})}function x2(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,c;return c={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(h){return function(m){return f([h,m])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(a=h[0]&2?i.return:h[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,h[1])).done)return a;switch(i=0,a&&(h=[h[0]&2,a.value]),h[0]){case 0:case 1:a=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,i=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!a||h[1]>a[0]&&h[1]<a[3])){t.label=h[1];break}if(h[0]===6&&t.label<a[1]){t.label=a[1],a=h;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(h);break}a[2]&&t.ops.pop(),t.trys.pop();continue}h=e.call(r,t)}catch(m){h=[6,m],i=0}finally{n=a=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function I2(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}function D2(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function ru(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Np(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,a=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(u){c={error:u}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(c)throw c.error}}return a}function S2(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(Np(arguments[e]));return r}function O2(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),i=0,e=0;e<t;e++)for(var a=arguments[e],c=0,u=a.length;c<u;c++,i++)n[i]=a[c];return n}function Eo(r){return this instanceof Eo?(this.v=r,this):new Eo(r)}function C2(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(y){n[y]&&(i[y]=function(b){return new Promise(function(I,A){a.push([y,b,I,A])>1||u(y,b)})})}function u(y,b){try{f(n[y](b))}catch(I){w(a[0][3],I)}}function f(y){y.value instanceof Eo?Promise.resolve(y.value.v).then(h,m):w(a[0][2],y)}function h(y){u("next",y)}function m(y){u("throw",y)}function w(y,b){y(b),a.shift(),a.length&&u(a[0][0],a[0][1])}}function $2(r){var e,t;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,a){e[i]=r[i]?function(c){return(t=!t)?{value:Eo(r[i](c)),done:i==="return"}:a?a(c):c}:a}}function A2(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof ru=="function"?ru(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(c){return new Promise(function(u,f){c=r[a](c),i(u,f,c.done,c.value)})}}function i(a,c,u,f){Promise.resolve(f).then(function(h){a({value:h,done:u})},c)}}function P2(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function T2(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function R2(r){return r&&r.__esModule?r:{default:r}}function N2(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function L2(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var M2=Object.freeze({__proto__:null,__extends:v2,get __assign(){return tu},__rest:y2,__decorate:w2,__param:b2,__metadata:_2,__awaiter:E2,__generator:x2,__createBinding:I2,__exportStar:D2,__values:ru,__read:Np,__spread:S2,__spreadArrays:O2,__await:Eo,__asyncGenerator:C2,__asyncDelegator:$2,__asyncValues:A2,__makeTemplateObject:P2,__importStar:T2,__importDefault:R2,__classPrivateFieldGet:N2,__classPrivateFieldSet:L2}),ka=Li(M2),nu={},xo={},Lp;function U2(){if(Lp)return xo;Lp=1,Object.defineProperty(xo,"__esModule",{value:!0}),xo.delay=void 0;function r(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}return xo.delay=r,xo}var Mi={},iu={},Ui={},Mp;function j2(){return Mp||(Mp=1,Object.defineProperty(Ui,"__esModule",{value:!0}),Ui.ONE_THOUSAND=Ui.ONE_HUNDRED=void 0,Ui.ONE_HUNDRED=100,Ui.ONE_THOUSAND=1e3),Ui}var su={},Up;function F2(){return Up||(Up=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ONE_YEAR=r.FOUR_WEEKS=r.THREE_WEEKS=r.TWO_WEEKS=r.ONE_WEEK=r.THIRTY_DAYS=r.SEVEN_DAYS=r.FIVE_DAYS=r.THREE_DAYS=r.ONE_DAY=r.TWENTY_FOUR_HOURS=r.TWELVE_HOURS=r.SIX_HOURS=r.THREE_HOURS=r.ONE_HOUR=r.SIXTY_MINUTES=r.THIRTY_MINUTES=r.TEN_MINUTES=r.FIVE_MINUTES=r.ONE_MINUTE=r.SIXTY_SECONDS=r.THIRTY_SECONDS=r.TEN_SECONDS=r.FIVE_SECONDS=r.ONE_SECOND=void 0,r.ONE_SECOND=1,r.FIVE_SECONDS=5,r.TEN_SECONDS=10,r.THIRTY_SECONDS=30,r.SIXTY_SECONDS=60,r.ONE_MINUTE=r.SIXTY_SECONDS,r.FIVE_MINUTES=r.ONE_MINUTE*5,r.TEN_MINUTES=r.ONE_MINUTE*10,r.THIRTY_MINUTES=r.ONE_MINUTE*30,r.SIXTY_MINUTES=r.ONE_MINUTE*60,r.ONE_HOUR=r.SIXTY_MINUTES,r.THREE_HOURS=r.ONE_HOUR*3,r.SIX_HOURS=r.ONE_HOUR*6,r.TWELVE_HOURS=r.ONE_HOUR*12,r.TWENTY_FOUR_HOURS=r.ONE_HOUR*24,r.ONE_DAY=r.TWENTY_FOUR_HOURS,r.THREE_DAYS=r.ONE_DAY*3,r.FIVE_DAYS=r.ONE_DAY*5,r.SEVEN_DAYS=r.ONE_DAY*7,r.THIRTY_DAYS=r.ONE_DAY*30,r.ONE_WEEK=r.SEVEN_DAYS,r.TWO_WEEKS=r.ONE_WEEK*2,r.THREE_WEEKS=r.ONE_WEEK*3,r.FOUR_WEEKS=r.ONE_WEEK*4,r.ONE_YEAR=r.ONE_DAY*365}(su)),su}var jp;function Fp(){return jp||(jp=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=ka;e.__exportStar(j2(),r),e.__exportStar(F2(),r)}(iu)),iu}var Bp;function B2(){if(Bp)return Mi;Bp=1,Object.defineProperty(Mi,"__esModule",{value:!0}),Mi.fromMiliseconds=Mi.toMiliseconds=void 0;const r=Fp();function e(n){return n*r.ONE_THOUSAND}Mi.toMiliseconds=e;function t(n){return Math.floor(n/r.ONE_THOUSAND)}return Mi.fromMiliseconds=t,Mi}var kp;function k2(){return kp||(kp=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=ka;e.__exportStar(U2(),r),e.__exportStar(B2(),r)}(nu)),nu}var xs={},zp;function z2(){if(zp)return xs;zp=1,Object.defineProperty(xs,"__esModule",{value:!0}),xs.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(t){if(this.timestamps.has(t))throw new Error(`Watch already started for label: ${t}`);this.timestamps.set(t,{started:Date.now()})}stop(t){const n=this.get(t);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${t}`);const i=Date.now()-n.started;this.timestamps.set(t,{started:n.started,elapsed:i})}get(t){const n=this.timestamps.get(t);if(typeof n>"u")throw new Error(`No timestamp found for label: ${t}`);return n}elapsed(t){const n=this.get(t);return n.elapsed||Date.now()-n.started}}return xs.Watch=r,xs.default=r,xs}var ou={},Io={},qp;function q2(){if(qp)return Io;qp=1,Object.defineProperty(Io,"__esModule",{value:!0}),Io.IWatch=void 0;class r{}return Io.IWatch=r,Io}var Hp;function H2(){return Hp||(Hp=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),ka.__exportStar(q2(),r)}(ou)),ou}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=ka;e.__exportStar(k2(),r),e.__exportStar(z2(),r),e.__exportStar(H2(),r),e.__exportStar(Fp(),r)})(me);var bt={};Object.defineProperty(bt,"__esModule",{value:!0}),bt.getLocalStorage=bt.getLocalStorageOrThrow=bt.getCrypto=bt.getCryptoOrThrow=Wp=bt.getLocation=bt.getLocationOrThrow=cu=bt.getNavigator=bt.getNavigatorOrThrow=au=bt.getDocument=bt.getDocumentOrThrow=bt.getFromWindowOrThrow=bt.getFromWindow=void 0;function ji(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}bt.getFromWindow=ji;function Is(r){const e=ji(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}bt.getFromWindowOrThrow=Is;function W2(){return Is("document")}bt.getDocumentOrThrow=W2;function K2(){return ji("document")}var au=bt.getDocument=K2;function V2(){return Is("navigator")}bt.getNavigatorOrThrow=V2;function G2(){return ji("navigator")}var cu=bt.getNavigator=G2;function Y2(){return Is("location")}bt.getLocationOrThrow=Y2;function Z2(){return ji("location")}var Wp=bt.getLocation=Z2;function J2(){return Is("crypto")}bt.getCryptoOrThrow=J2;function Q2(){return ji("crypto")}bt.getCrypto=Q2;function X2(){return Is("localStorage")}bt.getLocalStorageOrThrow=X2;function e_(){return ji("localStorage")}bt.getLocalStorage=e_;var lu={};Object.defineProperty(lu,"__esModule",{value:!0});var Kp=lu.getWindowMetadata=void 0;const Vp=bt;function t_(){let r,e;try{r=Vp.getDocumentOrThrow(),e=Vp.getLocationOrThrow()}catch{return null}function t(){const w=r.getElementsByTagName("link"),y=[];for(let b=0;b<w.length;b++){const I=w[b],A=I.getAttribute("rel");if(A&&A.toLowerCase().indexOf("icon")>-1){const U=I.getAttribute("href");if(U)if(U.toLowerCase().indexOf("https:")===-1&&U.toLowerCase().indexOf("http:")===-1&&U.indexOf("//")!==0){let j=e.protocol+"//"+e.host;if(U.indexOf("/")===0)j+=U;else{const $=e.pathname.split("/");$.pop();const T=$.join("/");j+=T+"/"+U}y.push(j)}else if(U.indexOf("//")===0){const j=e.protocol+U;y.push(j)}else y.push(U)}}return y}function n(...w){const y=r.getElementsByTagName("meta");for(let b=0;b<y.length;b++){const I=y[b],A=["itemprop","property","name"].map(U=>I.getAttribute(U)).filter(U=>U?w.includes(U):!1);if(A.length&&A){const U=I.getAttribute("content");if(U)return U}}return""}function i(){let w=n("name","og:site_name","og:title","twitter:title");return w||(w=r.title),w}function a(){return n("description","og:description","twitter:description","keywords")}const c=i(),u=a(),f=e.origin,h=t();return{description:u,url:f,icons:h,name:c}}Kp=lu.getWindowMetadata=t_;var Do={},r_=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Gp="%[a-f0-9]{2}",Yp=new RegExp("("+Gp+")|([^%]+?)","gi"),Zp=new RegExp("("+Gp+")+","gi");function uu(r,e){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),n=r.slice(e);return Array.prototype.concat.call([],uu(t),uu(n))}function n_(r){try{return decodeURIComponent(r)}catch{for(var e=r.match(Yp)||[],t=1;t<e.length;t++)r=uu(e,t).join(""),e=r.match(Yp)||[];return r}}function i_(r){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},t=Zp.exec(r);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch{var n=n_(t[0]);n!==t[0]&&(e[t[0]]=n)}t=Zp.exec(r)}e["%C2"]="\uFFFD";for(var i=Object.keys(e),a=0;a<i.length;a++){var c=i[a];r=r.replace(new RegExp(c,"g"),e[c])}return r}var s_=function(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch{return i_(r)}},o_=(r,e)=>{if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[r];const t=r.indexOf(e);return t===-1?[r]:[r.slice(0,t),r.slice(t+e.length)]},a_=function(r,e){for(var t={},n=Object.keys(r),i=Array.isArray(e),a=0;a<n.length;a++){var c=n[a],u=r[c];(i?e.indexOf(c)!==-1:e(c,u,r))&&(t[c]=u)}return t};(function(r){const e=r_,t=s_,n=o_,i=a_,a=$=>$==null,c=Symbol("encodeFragmentIdentifier");function u($){switch($.arrayFormat){case"index":return T=>(O,P)=>{const x=O.length;return P===void 0||$.skipNull&&P===null||$.skipEmptyString&&P===""?O:P===null?[...O,[m(T,$),"[",x,"]"].join("")]:[...O,[m(T,$),"[",m(x,$),"]=",m(P,$)].join("")]};case"bracket":return T=>(O,P)=>P===void 0||$.skipNull&&P===null||$.skipEmptyString&&P===""?O:P===null?[...O,[m(T,$),"[]"].join("")]:[...O,[m(T,$),"[]=",m(P,$)].join("")];case"colon-list-separator":return T=>(O,P)=>P===void 0||$.skipNull&&P===null||$.skipEmptyString&&P===""?O:P===null?[...O,[m(T,$),":list="].join("")]:[...O,[m(T,$),":list=",m(P,$)].join("")];case"comma":case"separator":case"bracket-separator":{const T=$.arrayFormat==="bracket-separator"?"[]=":"=";return O=>(P,x)=>x===void 0||$.skipNull&&x===null||$.skipEmptyString&&x===""?P:(x=x===null?"":x,P.length===0?[[m(O,$),T,m(x,$)].join("")]:[[P,m(x,$)].join($.arrayFormatSeparator)])}default:return T=>(O,P)=>P===void 0||$.skipNull&&P===null||$.skipEmptyString&&P===""?O:P===null?[...O,m(T,$)]:[...O,[m(T,$),"=",m(P,$)].join("")]}}function f($){let T;switch($.arrayFormat){case"index":return(O,P,x)=>{if(T=/\[(\d*)\]$/.exec(O),O=O.replace(/\[\d*\]$/,""),!T){x[O]=P;return}x[O]===void 0&&(x[O]={}),x[O][T[1]]=P};case"bracket":return(O,P,x)=>{if(T=/(\[\])$/.exec(O),O=O.replace(/\[\]$/,""),!T){x[O]=P;return}if(x[O]===void 0){x[O]=[P];return}x[O]=[].concat(x[O],P)};case"colon-list-separator":return(O,P,x)=>{if(T=/(:list)$/.exec(O),O=O.replace(/:list$/,""),!T){x[O]=P;return}if(x[O]===void 0){x[O]=[P];return}x[O]=[].concat(x[O],P)};case"comma":case"separator":return(O,P,x)=>{const d=typeof P=="string"&&P.includes($.arrayFormatSeparator),_=typeof P=="string"&&!d&&w(P,$).includes($.arrayFormatSeparator);P=_?w(P,$):P;const H=d||_?P.split($.arrayFormatSeparator).map(F=>w(F,$)):P===null?P:w(P,$);x[O]=H};case"bracket-separator":return(O,P,x)=>{const d=/(\[\])$/.test(O);if(O=O.replace(/\[\]$/,""),!d){x[O]=P&&w(P,$);return}const _=P===null?[]:P.split($.arrayFormatSeparator).map(H=>w(H,$));if(x[O]===void 0){x[O]=_;return}x[O]=[].concat(x[O],_)};default:return(O,P,x)=>{if(x[O]===void 0){x[O]=P;return}x[O]=[].concat(x[O],P)}}}function h($){if(typeof $!="string"||$.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function m($,T){return T.encode?T.strict?e($):encodeURIComponent($):$}function w($,T){return T.decode?t($):$}function y($){return Array.isArray($)?$.sort():typeof $=="object"?y(Object.keys($)).sort((T,O)=>Number(T)-Number(O)).map(T=>$[T]):$}function b($){const T=$.indexOf("#");return T!==-1&&($=$.slice(0,T)),$}function I($){let T="";const O=$.indexOf("#");return O!==-1&&(T=$.slice(O)),T}function A($){$=b($);const T=$.indexOf("?");return T===-1?"":$.slice(T+1)}function U($,T){return T.parseNumbers&&!Number.isNaN(Number($))&&typeof $=="string"&&$.trim()!==""?$=Number($):T.parseBooleans&&$!==null&&($.toLowerCase()==="true"||$.toLowerCase()==="false")&&($=$.toLowerCase()==="true"),$}function j($,T){T=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},T),h(T.arrayFormatSeparator);const O=f(T),P=Object.create(null);if(typeof $!="string"||($=$.trim().replace(/^[?#&]/,""),!$))return P;for(const x of $.split("&")){if(x==="")continue;let[d,_]=n(T.decode?x.replace(/\+/g," "):x,"=");_=_===void 0?null:["comma","separator","bracket-separator"].includes(T.arrayFormat)?_:w(_,T),O(w(d,T),_,P)}for(const x of Object.keys(P)){const d=P[x];if(typeof d=="object"&&d!==null)for(const _ of Object.keys(d))d[_]=U(d[_],T);else P[x]=U(d,T)}return T.sort===!1?P:(T.sort===!0?Object.keys(P).sort():Object.keys(P).sort(T.sort)).reduce((x,d)=>{const _=P[d];return _&&typeof _=="object"&&!Array.isArray(_)?x[d]=y(_):x[d]=_,x},Object.create(null))}r.extract=A,r.parse=j,r.stringify=($,T)=>{if(!$)return"";T=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},T),h(T.arrayFormatSeparator);const O=_=>T.skipNull&&a($[_])||T.skipEmptyString&&$[_]==="",P=u(T),x={};for(const _ of Object.keys($))O(_)||(x[_]=$[_]);const d=Object.keys(x);return T.sort!==!1&&d.sort(T.sort),d.map(_=>{const H=$[_];return H===void 0?"":H===null?m(_,T):Array.isArray(H)?H.length===0&&T.arrayFormat==="bracket-separator"?m(_,T)+"[]":H.reduce(P(_),[]).join("&"):m(_,T)+"="+m(H,T)}).filter(_=>_.length>0).join("&")},r.parseUrl=($,T)=>{T=Object.assign({decode:!0},T);const[O,P]=n($,"#");return Object.assign({url:O.split("?")[0]||"",query:j(A($),T)},T&&T.parseFragmentIdentifier&&P?{fragmentIdentifier:w(P,T)}:{})},r.stringifyUrl=($,T)=>{T=Object.assign({encode:!0,strict:!0,[c]:!0},T);const O=b($.url).split("?")[0]||"",P=r.extract($.url),x=r.parse(P,{sort:!1}),d=Object.assign(x,$.query);let _=r.stringify(d,T);_&&(_=`?${_}`);let H=I($.url);return $.fragmentIdentifier&&(H=`#${T[c]?m($.fragmentIdentifier,T):$.fragmentIdentifier}`),`${O}${_}${H}`},r.pick=($,T,O)=>{O=Object.assign({parseFragmentIdentifier:!0,[c]:!1},O);const{url:P,query:x,fragmentIdentifier:d}=r.parseUrl($,O);return r.stringifyUrl({url:P,query:i(x,T),fragmentIdentifier:d},O)},r.exclude=($,T,O)=>{const P=Array.isArray(T)?x=>!T.includes(x):(x,d)=>!T(x,d);return r.pick($,P,O)}})(Do);const c_={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe"}},l_=":";function u_(r){const[e,t]=r.split(l_);return{namespace:e,reference:t}}function h_(r,e=[]){const t=[];return Object.keys(r).forEach(n=>{if(e.length&&!e.includes(n))return;const i=r[n];t.push(...i.accounts)}),t}function Jp(r,e){return r.includes(":")?[r]:e.chains||[]}const Qp="base10",yr="base16",hu="base64pad",fu="utf8",Xp=0,Fi=1,f_=0,e0=1,du=12,pu=32;function d_(){const r=Gl.generateKeyPair();return{privateKey:vr(r.secretKey,yr),publicKey:vr(r.publicKey,yr)}}function gu(){const r=Es.randomBytes(pu);return vr(r,yr)}function p_(r,e){const t=Gl.sharedKey($r(r,yr),$r(e,yr),!0),n=new Cw(Fa.SHA256,t).expand(pu);return vr(n,yr)}function g_(r){const e=Fa.hash($r(r,yr));return vr(e,yr)}function Ds(r){const e=Fa.hash($r(r,fu));return vr(e,yr)}function m_(r){return $r(`${r}`,Qp)}function So(r){return Number(vr(r,Qp))}function v_(r){const e=m_(typeof r.type<"u"?r.type:Xp);if(So(e)===Fi&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const t=typeof r.senderPublicKey<"u"?$r(r.senderPublicKey,yr):void 0,n=typeof r.iv<"u"?$r(r.iv,yr):Es.randomBytes(du),i=new kl.ChaCha20Poly1305($r(r.symKey,yr)).seal(n,$r(r.message,fu));return w_({type:e,sealed:i,iv:n,senderPublicKey:t})}function y_(r){const e=new kl.ChaCha20Poly1305($r(r.symKey,yr)),{sealed:t,iv:n}=za(r.encoded),i=e.open(n,t);if(i===null)throw new Error("Failed to decrypt");return vr(i,fu)}function w_(r){if(So(r.type)===Fi){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return vr(Zl([r.type,r.senderPublicKey,r.iv,r.sealed]),hu)}return vr(Zl([r.type,r.iv,r.sealed]),hu)}function za(r){const e=$r(r,hu),t=e.slice(f_,e0),n=e0;if(So(t)===Fi){const u=n+pu,f=u+du,h=e.slice(n,u),m=e.slice(u,f),w=e.slice(f);return{type:t,sealed:w,iv:m,senderPublicKey:h}}const i=n+du,a=e.slice(n,i),c=e.slice(i);return{type:t,sealed:c,iv:a}}function b_(r,e){const t=za(r);return t0({type:So(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?vr(t.senderPublicKey,yr):void 0,receiverPublicKey:e?.receiverPublicKey})}function t0(r){const e=r?.type||Xp;if(e===Fi){if(typeof r?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof r?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:r?.senderPublicKey,receiverPublicKey:r?.receiverPublicKey}}function r0(r){return r.type===Fi&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}var __=Object.defineProperty,n0=Object.getOwnPropertySymbols,E_=Object.prototype.hasOwnProperty,x_=Object.prototype.propertyIsEnumerable,i0=(r,e,t)=>e in r?__(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,s0=(r,e)=>{for(var t in e||(e={}))E_.call(e,t)&&i0(r,t,e[t]);if(n0)for(var t of n0(e))x_.call(e,t)&&i0(r,t,e[t]);return r};const I_="ReactNative",kr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},D_="js";function Oo(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Ss(){return!au()&&!!cu()&&navigator.product===I_}function Os(){return!Oo()&&!!cu()&&!!au()}function Co(){return Ss()?kr.reactNative:Oo()?kr.node:Os()?kr.browser:kr.unknown}function S_(){var r;try{return Ss()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(r=global.Application)==null?void 0:r.applicationId:void 0}catch{return}}function O_(r,e){let t=Do.parse(r);return t=s0(s0({},t),e),r=Do.stringify(t),r}function C_(){return Kp()||{name:"",description:"",url:"",icons:[""]}}function $_(){if(Co()===kr.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:t,Version:n}=global.Platform;return[t,n].join("-")}const r=f2();if(r===null)return"unknown";const e=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[e,r.name,r.version].join("-"):[e,r.version].join("-")}function A_(){var r;const e=Co();return e===kr.browser?[e,((r=Wp())==null?void 0:r.host)||"unknown"].join(":"):e}function P_(r,e,t){const n=$_(),i=A_();return[[r,e].join("-"),[D_,t].join("-"),n,i].join("/")}function T_({protocol:r,version:e,relayUrl:t,sdkVersion:n,auth:i,projectId:a,useOnCloseEvent:c,bundleId:u}){const f=t.split("?"),h=P_(r,e,n),m={auth:i,ua:h,projectId:a,useOnCloseEvent:c||void 0,origin:u||void 0},w=O_(f[1]||"",m);return f[0]+"?"+w}function Bi(r,e){return r.filter(t=>e.includes(t)).length===r.length}function o0(r){return Object.fromEntries(r.entries())}function a0(r){return new Map(Object.entries(r))}function Cs(r=me.FIVE_MINUTES,e){const t=me.toMiliseconds(r||me.FIVE_MINUTES);let n,i,a;return{resolve:c=>{a&&n&&(clearTimeout(a),n(c))},reject:c=>{a&&i&&(clearTimeout(a),i(c))},done:()=>new Promise((c,u)=>{a=setTimeout(()=>{u(new Error(e))},t),n=c,i=u})}}function $o(r,e,t){return new Promise(async(n,i)=>{const a=setTimeout(()=>i(new Error(t)),e);try{const c=await r;n(c)}catch(c){i(c)}clearTimeout(a)})}function c0(r,e){if(typeof e=="string"&&e.startsWith(`${r}:`))return e;if(r.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(r.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${r}`)}function R_(r){return c0("topic",r)}function N_(r){return c0("id",r)}function l0(r){const[e,t]=r.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")n.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))n.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return n}function zr(r,e){return me.fromMiliseconds((e||Date.now())+me.toMiliseconds(r))}function ai(r){return Date.now()>=me.toMiliseconds(r)}function pt(r,e){return`${r}${e?`:${e}`:""}`}function mu(r=[],e=[]){return[...new Set([...r,...e])]}async function L_({id:r,topic:e,wcDeepLink:t}){try{if(!t)return;const n=typeof t=="string"?JSON.parse(t):t;let i=n?.href;if(typeof i!="string")return;i.endsWith("/")&&(i=i.slice(0,-1));const a=`${i}/wc?requestId=${r}&sessionTopic=${e}`,c=Co();c===kr.browser?a.startsWith("https://")||a.startsWith("http://")?window.open(a,"_blank","noreferrer noopener"):window.open(a,"_self","noreferrer noopener"):c===kr.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(a)}catch(n){console.error(n)}}async function M_(r,e){try{return await r.getItem(e)||(Os()?localStorage.getItem(e):void 0)}catch(t){console.error(t)}}const U_="irn";function vu(r){return r?.relay||{protocol:U_}}function qa(r){const e=c_[r];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${r}`);return e}var j_=Object.defineProperty,F_=Object.defineProperties,B_=Object.getOwnPropertyDescriptors,u0=Object.getOwnPropertySymbols,k_=Object.prototype.hasOwnProperty,z_=Object.prototype.propertyIsEnumerable,h0=(r,e,t)=>e in r?j_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,q_=(r,e)=>{for(var t in e||(e={}))k_.call(e,t)&&h0(r,t,e[t]);if(u0)for(var t of u0(e))z_.call(e,t)&&h0(r,t,e[t]);return r},H_=(r,e)=>F_(r,B_(e));function W_(r,e="-"){const t={},n="relay"+e;return Object.keys(r).forEach(i=>{if(i.startsWith(n)){const a=i.replace(n,""),c=r[i];t[a]=c}}),t}function f0(r){r=r.includes("wc://")?r.replace("wc://",""):r,r=r.includes("wc:")?r.replace("wc:",""):r;const e=r.indexOf(":"),t=r.indexOf("?")!==-1?r.indexOf("?"):void 0,n=r.substring(0,e),i=r.substring(e+1,t).split("@"),a=typeof t<"u"?r.substring(t):"",c=Do.parse(a);return{protocol:n,topic:K_(i[0]),version:parseInt(i[1],10),symKey:c.symKey,relay:W_(c),expiryTimestamp:c.expiryTimestamp?parseInt(c.expiryTimestamp,10):void 0}}function K_(r){return r.startsWith("//")?r.substring(2):r}function V_(r,e="-"){const t="relay",n={};return Object.keys(r).forEach(i=>{const a=t+e+i;r[i]&&(n[a]=r[i])}),n}function G_(r){return`${r.protocol}:${r.topic}@${r.version}?`+Do.stringify(H_(q_({symKey:r.symKey},V_(r.relay)),{expiryTimestamp:r.expiryTimestamp}))}function $s(r){const e=[];return r.forEach(t=>{const[n,i]=t.split(":");e.push(`${n}:${i}`)}),e}function Y_(r){const e=[];return Object.values(r).forEach(t=>{e.push(...$s(t.accounts))}),e}function Z_(r,e){const t=[];return Object.values(r).forEach(n=>{$s(n.accounts).includes(e)&&t.push(...n.methods)}),t}function J_(r,e){const t=[];return Object.values(r).forEach(n=>{$s(n.accounts).includes(e)&&t.push(...n.events)}),t}function yu(r){return r.includes(":")}function Ao(r){return yu(r)?r.split(":")[0]:r}const Q_={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},X_={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ue(r,e){const{message:t,code:n}=X_[r];return{message:e?`${t} ${e}`:t,code:n}}function Et(r,e){const{message:t,code:n}=Q_[r];return{message:e?`${t} ${e}`:t,code:n}}function In(r,e){return Array.isArray(r)?typeof e<"u"&&r.length?r.every(e):!0:!1}function Po(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function wr(r){return typeof r>"u"}function nr(r,e){return e&&wr(r)?!0:typeof r=="string"&&!!r.trim().length}function wu(r,e){return e&&wr(r)?!0:typeof r=="number"&&!isNaN(r)}function e3(r,e){const{requiredNamespaces:t}=e,n=Object.keys(r.namespaces),i=Object.keys(t);let a=!0;return Bi(i,n)?(n.forEach(c=>{const{accounts:u,methods:f,events:h}=r.namespaces[c],m=$s(u),w=t[c];(!Bi(Jp(c,w),m)||!Bi(w.methods,f)||!Bi(w.events,h))&&(a=!1)}),a):!1}function Ha(r){return nr(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function t3(r){if(nr(r,!1)&&r.includes(":")){const e=r.split(":");if(e.length===3){const t=e[0]+":"+e[1];return!!e[2]&&Ha(t)}}return!1}function r3(r){if(nr(r,!1))try{return typeof new URL(r)<"u"}catch{return!1}return!1}function n3(r){var e;return(e=r?.proposer)==null?void 0:e.publicKey}function i3(r){return r?.topic}function s3(r,e){let t=null;return nr(r?.publicKey,!1)||(t=ue("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function d0(r){let e=!0;return In(r)?r.length&&(e=r.every(t=>nr(t,!1))):e=!1,e}function o3(r,e,t){let n=null;return In(e)&&e.length?e.forEach(i=>{n||Ha(i)||(n=Et("UNSUPPORTED_CHAINS",`${t}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):Ha(r)||(n=Et("UNSUPPORTED_CHAINS",`${t}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function a3(r,e,t){let n=null;return Object.entries(r).forEach(([i,a])=>{if(n)return;const c=o3(i,Jp(i,a),`${e} ${t}`);c&&(n=c)}),n}function c3(r,e){let t=null;return In(r)?r.forEach(n=>{t||t3(n)||(t=Et("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):t=Et("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function l3(r,e){let t=null;return Object.values(r).forEach(n=>{if(t)return;const i=c3(n?.accounts,`${e} namespace`);i&&(t=i)}),t}function u3(r,e){let t=null;return d0(r?.methods)?d0(r?.events)||(t=Et("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=Et("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function p0(r,e){let t=null;return Object.values(r).forEach(n=>{if(t)return;const i=u3(n,`${e}, namespace`);i&&(t=i)}),t}function h3(r,e,t){let n=null;if(r&&Po(r)){const i=p0(r,e);i&&(n=i);const a=a3(r,e,t);a&&(n=a)}else n=ue("MISSING_OR_INVALID",`${e}, ${t} should be an object with data`);return n}function bu(r,e){let t=null;if(r&&Po(r)){const n=p0(r,e);n&&(t=n);const i=l3(r,e);i&&(t=i)}else t=ue("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function g0(r){return nr(r.protocol,!0)}function f3(r,e){let t=!1;return e&&!r?t=!0:r&&In(r)&&r.length&&r.forEach(n=>{t=g0(n)}),t}function d3(r){return typeof r=="number"}function Ar(r){return typeof r<"u"&&typeof r!==null}function p3(r){return!(!r||typeof r!="object"||!r.code||!wu(r.code,!1)||!r.message||!nr(r.message,!1))}function g3(r){return!(wr(r)||!nr(r.method,!1))}function m3(r){return!(wr(r)||wr(r.result)&&wr(r.error)||!wu(r.id,!1)||!nr(r.jsonrpc,!1))}function v3(r){return!(wr(r)||!nr(r.name,!1))}function m0(r,e){return!(!Ha(e)||!Y_(r).includes(e))}function y3(r,e,t){return nr(t,!1)?Z_(r,e).includes(t):!1}function w3(r,e,t){return nr(t,!1)?J_(r,e).includes(t):!1}function v0(r,e,t){let n=null;const i=b3(r),a=_3(e),c=Object.keys(i),u=Object.keys(a),f=y0(Object.keys(r)),h=y0(Object.keys(e)),m=f.filter(w=>!h.includes(w));return m.length&&(n=ue("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy requiredNamespaces.
|
|
15
15
|
Required: ${m.toString()}
|
|
16
|
-
Received: ${Object.keys(e).toString()}`)),
|
|
16
|
+
Received: ${Object.keys(e).toString()}`)),Bi(c,u)||(n=ue("NON_CONFORMING_NAMESPACES",`${t} namespaces chains don't satisfy required namespaces.
|
|
17
17
|
Required: ${c.toString()}
|
|
18
|
-
Approved: ${u.toString()}`)),Object.keys(e).forEach(w=>{if(!w.includes(":")||n)return;const y
|
|
18
|
+
Approved: ${u.toString()}`)),Object.keys(e).forEach(w=>{if(!w.includes(":")||n)return;const y=$s(e[w].accounts);y.includes(w)||(n=ue("NON_CONFORMING_NAMESPACES",`${t} namespaces accounts don't satisfy namespace accounts for ${w}
|
|
19
19
|
Required: ${w}
|
|
20
|
-
Approved: ${y.toString()}`))}),c.forEach(w=>{n||(Mi(i[w].methods,a[w].methods)?Mi(i[w].events,a[w].events)||(n=ue("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${w}`)):n=ue("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${w}`))}),n}function o3(r){const e={};return Object.keys(r).forEach(t=>{var n;t.includes(":")?e[t]=r[t]:(n=r[t].chains)==null||n.forEach(i=>{e[i]={methods:r[t].methods,events:r[t].events}})}),e}function lp(r){return[...new Set(r.map(e=>e.includes(":")?e.split(":")[0]:e))]}function a3(r){const e={};return Object.keys(r).forEach(t=>{if(t.includes(":"))e[t]=r[t];else{const n=Is(r[t].accounts);n?.forEach(i=>{e[i]={accounts:r[t].accounts.filter(a=>a.includes(`${i}:`)),methods:r[t].methods,events:r[t].events}})}}),e}function c3(r,e){return uu(r,!1)&&r<=e.max&&r>=e.min}function up(){const r=bo();return new Promise(e=>{switch(r){case Hr.browser:e(l3());break;case Hr.reactNative:e(u3());break;case Hr.node:e(h3());break;default:e(!0)}})}function l3(){return Es()&&navigator?.onLine}async function u3(){if(_s()&&typeof global<"u"&&global!=null&&global.NetInfo){const r=await(global==null?void 0:global.NetInfo.fetch());return r?.isConnected}return!0}function h3(){return!0}function f3(r){switch(bo()){case Hr.browser:d3(r);break;case Hr.reactNative:p3(r);break}}function d3(r){!_s()&&Es()&&(window.addEventListener("online",()=>r(!0)),window.addEventListener("offline",()=>r(!1)))}function p3(r){_s()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>r(e?.isConnected))}const fu={};class Ma{static get(e){return fu[e]}static set(e,t){fu[e]=t}static delete(e){delete fu[e]}}const g3=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,m3=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,v3=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function y3(r,e){if(r==="__proto__"||r==="constructor"&&e&&typeof e=="object"&&"prototype"in e){w3(r);return}return e}function w3(r){console.warn(`[destr] Dropping "${r}" key to prevent prototype pollution.`)}function Ua(r,e={}){if(typeof r!="string")return r;const t=r.trim();if(r[0]==='"'&&r.at(-1)==='"'&&!r.includes("\\"))return t.slice(1,-1);if(t.length<=9){const n=t.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!v3.test(r)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return r}try{if(g3.test(r)||m3.test(r)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(r,y3)}return JSON.parse(r)}catch(n){if(e.strict)throw n;return r}}function b3(r){return!r||typeof r.then!="function"?Promise.resolve(r):r}function sr(r,...e){try{return b3(r(...e))}catch(t){return Promise.reject(t)}}function _3(r){const e=typeof r;return r===null||e!=="object"&&e!=="function"}function E3(r){const e=Object.getPrototypeOf(r);return!e||e.isPrototypeOf(Object)}function ja(r){if(_3(r))return String(r);if(E3(r)||Array.isArray(r))return JSON.stringify(r);if(typeof r.toJSON=="function")return ja(r.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function hp(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const du="base64:";function x3(r){if(typeof r=="string")return r;hp();const e=Buffer.from(r).toString("base64");return du+e}function I3(r){return typeof r!="string"||!r.startsWith(du)?r:(hp(),Buffer.from(r.slice(du.length),"base64"))}function Nr(r){return r?r.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function D3(...r){return Nr(r.join(":"))}function Fa(r){return r=Nr(r),r?r+":":""}function zT(r){return r}const S3="memory",C3=()=>{const r=new Map;return{name:S3,options:{},hasItem(e){return r.has(e)},getItem(e){return r.get(e)||null},getItemRaw(e){return r.get(e)||null},setItem(e,t){r.set(e,t)},setItemRaw(e,t){r.set(e,t)},removeItem(e){r.delete(e)},getKeys(){return Array.from(r.keys())},clear(){r.clear()},dispose(){r.clear()}}};function O3(r={}){const e={mounts:{"":r.driver||C3()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},t=h=>{for(const m of e.mountpoints)if(h.startsWith(m))return{base:m,relativeKey:h.slice(m.length),driver:e.mounts[m]};return{base:"",relativeKey:h,driver:e.mounts[""]}},n=(h,m)=>e.mountpoints.filter(w=>w.startsWith(h)||m&&h.startsWith(w)).map(w=>({relativeBase:h.length>w.length?h.slice(w.length):void 0,mountpoint:w,driver:e.mounts[w]})),i=(h,m)=>{if(e.watching){m=Nr(m);for(const w of e.watchListeners)w(h,m)}},a=async()=>{if(!e.watching){e.watching=!0;for(const h in e.mounts)e.unwatch[h]=await fp(e.mounts[h],i,h)}},c=async()=>{if(e.watching){for(const h in e.unwatch)await e.unwatch[h]();e.unwatch={},e.watching=!1}},u=(h,m,w)=>{const y=new Map,x=S=>{let P=y.get(S.base);return P||(P={driver:S.driver,base:S.base,items:[]},y.set(S.base,P)),P};for(const S of h){const P=typeof S=="string",U=Nr(P?S:S.key),j=P?void 0:S.value,A=P||!S.options?m:{...m,...S.options},T=t(U);x(T).items.push({key:U,value:j,relativeKey:T.relativeKey,options:A})}return Promise.all([...y.values()].map(S=>w(S))).then(S=>S.flat())},f={hasItem(h,m={}){h=Nr(h);const{relativeKey:w,driver:y}=t(h);return sr(y.hasItem,w,m)},getItem(h,m={}){h=Nr(h);const{relativeKey:w,driver:y}=t(h);return sr(y.getItem,w,m).then(x=>Ua(x))},getItems(h,m){return u(h,m,w=>w.driver.getItems?sr(w.driver.getItems,w.items.map(y=>({key:y.relativeKey,options:y.options})),m).then(y=>y.map(x=>({key:D3(w.base,x.key),value:Ua(x.value)}))):Promise.all(w.items.map(y=>sr(w.driver.getItem,y.relativeKey,y.options).then(x=>({key:y.key,value:Ua(x)})))))},getItemRaw(h,m={}){h=Nr(h);const{relativeKey:w,driver:y}=t(h);return y.getItemRaw?sr(y.getItemRaw,w,m):sr(y.getItem,w,m).then(x=>I3(x))},async setItem(h,m,w={}){if(m===void 0)return f.removeItem(h);h=Nr(h);const{relativeKey:y,driver:x}=t(h);x.setItem&&(await sr(x.setItem,y,ja(m),w),x.watch||i("update",h))},async setItems(h,m){await u(h,m,async w=>{w.driver.setItems&&await sr(w.driver.setItems,w.items.map(y=>({key:y.relativeKey,value:ja(y.value),options:y.options})),m),w.driver.setItem&&await Promise.all(w.items.map(y=>sr(w.driver.setItem,y.relativeKey,ja(y.value),y.options)))})},async setItemRaw(h,m,w={}){if(m===void 0)return f.removeItem(h,w);h=Nr(h);const{relativeKey:y,driver:x}=t(h);if(x.setItemRaw)await sr(x.setItemRaw,y,m,w);else if(x.setItem)await sr(x.setItem,y,x3(m),w);else return;x.watch||i("update",h)},async removeItem(h,m={}){typeof m=="boolean"&&(m={removeMeta:m}),h=Nr(h);const{relativeKey:w,driver:y}=t(h);y.removeItem&&(await sr(y.removeItem,w,m),(m.removeMeta||m.removeMata)&&await sr(y.removeItem,w+"$",m),y.watch||i("remove",h))},async getMeta(h,m={}){typeof m=="boolean"&&(m={nativeOnly:m}),h=Nr(h);const{relativeKey:w,driver:y}=t(h),x=Object.create(null);if(y.getMeta&&Object.assign(x,await sr(y.getMeta,w,m)),!m.nativeOnly){const S=await sr(y.getItem,w+"$",m).then(P=>Ua(P));S&&typeof S=="object"&&(typeof S.atime=="string"&&(S.atime=new Date(S.atime)),typeof S.mtime=="string"&&(S.mtime=new Date(S.mtime)),Object.assign(x,S))}return x},setMeta(h,m,w={}){return this.setItem(h+"$",m,w)},removeMeta(h,m={}){return this.removeItem(h+"$",m)},async getKeys(h,m={}){h=Fa(h);const w=n(h,!0);let y=[];const x=[];for(const S of w){const U=(await sr(S.driver.getKeys,S.relativeBase,m)).map(j=>S.mountpoint+Nr(j)).filter(j=>!y.some(A=>j.startsWith(A)));x.push(...U),y=[S.mountpoint,...y.filter(j=>!j.startsWith(S.mountpoint))]}return h?x.filter(S=>S.startsWith(h)&&!S.endsWith("$")):x.filter(S=>!S.endsWith("$"))},async clear(h,m={}){h=Fa(h),await Promise.all(n(h,!1).map(async w=>{if(w.driver.clear)return sr(w.driver.clear,w.relativeBase,m);if(w.driver.removeItem){const y=await w.driver.getKeys(w.relativeBase||"",m);return Promise.all(y.map(x=>w.driver.removeItem(x,m)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(h=>dp(h)))},async watch(h){return await a(),e.watchListeners.push(h),async()=>{e.watchListeners=e.watchListeners.filter(m=>m!==h),e.watchListeners.length===0&&await c()}},async unwatch(){e.watchListeners=[],await c()},mount(h,m){if(h=Fa(h),h&&e.mounts[h])throw new Error(`already mounted at ${h}`);return h&&(e.mountpoints.push(h),e.mountpoints.sort((w,y)=>y.length-w.length)),e.mounts[h]=m,e.watching&&Promise.resolve(fp(m,i,h)).then(w=>{e.unwatch[h]=w}).catch(console.error),f},async unmount(h,m=!0){h=Fa(h),!(!h||!e.mounts[h])&&(e.watching&&h in e.unwatch&&(e.unwatch[h](),delete e.unwatch[h]),m&&await dp(e.mounts[h]),e.mountpoints=e.mountpoints.filter(w=>w!==h),delete e.mounts[h])},getMount(h=""){h=Nr(h)+":";const m=t(h);return{driver:m.driver,base:m.base}},getMounts(h="",m={}){return h=Nr(h),n(h,m.parents).map(y=>({driver:y.driver,base:y.mountpoint}))}};return f}function fp(r,e,t){return r.watch?r.watch((n,i)=>e(n,t+i)):()=>{}}async function dp(r){typeof r.dispose=="function"&&await sr(r.dispose)}function Ui(r){return new Promise((e,t)=>{r.oncomplete=r.onsuccess=()=>e(r.result),r.onabort=r.onerror=()=>t(r.error)})}function pp(r,e){const t=indexedDB.open(r);t.onupgradeneeded=()=>t.result.createObjectStore(e);const n=Ui(t);return(i,a)=>n.then(c=>a(c.transaction(e,i).objectStore(e)))}let pu;function Io(){return pu||(pu=pp("keyval-store","keyval")),pu}function gp(r,e=Io()){return e("readonly",t=>Ui(t.get(r)))}function $3(r,e,t=Io()){return t("readwrite",n=>(n.put(e,r),Ui(n.transaction)))}function A3(r,e=Io()){return e("readwrite",t=>(t.delete(r),Ui(t.transaction)))}function P3(r=Io()){return r("readwrite",e=>(e.clear(),Ui(e.transaction)))}function T3(r,e){return r.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Ui(r.transaction)}function R3(r=Io()){return r("readonly",e=>{if(e.getAllKeys)return Ui(e.getAllKeys());const t=[];return T3(e,n=>t.push(n.key)).then(()=>t)})}const N3=r=>JSON.stringify(r,(e,t)=>typeof t=="bigint"?t.toString()+"n":t),L3=r=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,t=r.replace(e,'$1"$2n"$3');return JSON.parse(t,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function Do(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return L3(r)}catch{return r}}function ji(r){return typeof r=="string"?r:N3(r)||""}const M3="idb-keyval";var U3=(r={})=>{const e=r.base&&r.base.length>0?`${r.base}:`:"",t=i=>e+i;let n;return r.dbName&&r.storeName&&(n=pp(r.dbName,r.storeName)),{name:M3,options:r,async hasItem(i){return!(typeof await gp(t(i),n)>"u")},async getItem(i){return await gp(t(i),n)??null},setItem(i,a){return $3(t(i),a,n)},removeItem(i){return A3(t(i),n)},getKeys(){return R3(n)},clear(){return P3(n)}}};const j3="WALLET_CONNECT_V2_INDEXED_DB",F3="keyvaluestorage";class B3{constructor(){this.indexedDb=O3({driver:U3({dbName:j3,storeName:F3})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const t=await this.indexedDb.getItem(e);if(t!==null)return t}async setItem(e,t){await this.indexedDb.setItem(e,ji(t))}async removeItem(e){await this.indexedDb.removeItem(e)}}var gu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ba={exports:{}};(function(){let r;function e(){}r=e,r.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},r.prototype.setItem=function(t,n){this[t]=String(n)},r.prototype.removeItem=function(t){delete this[t]},r.prototype.clear=function(){const t=this;Object.keys(t).forEach(function(n){t[n]=void 0,delete t[n]})},r.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof gu<"u"&&gu.localStorage?Ba.exports=gu.localStorage:typeof window<"u"&&window.localStorage?Ba.exports=window.localStorage:Ba.exports=new e})();function k3(r){var e;return[r[0],Do((e=r[1])!=null?e:"")]}class q3{constructor(){this.localStorage=Ba.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(k3)}async getItem(e){const t=this.localStorage.getItem(e);if(t!==null)return Do(t)}async setItem(e,t){this.localStorage.setItem(e,ji(t))}async removeItem(e){this.localStorage.removeItem(e)}}const z3="wc_storage_version",mp=1,H3=async(r,e,t)=>{const n=z3,i=await e.getItem(n);if(i&&i>=mp){t(e);return}const a=await r.getKeys();if(!a.length){t(e);return}const c=[];for(;a.length;){const u=a.shift();if(!u)continue;const f=u.toLowerCase();if(f.includes("wc@")||f.includes("walletconnect")||f.includes("wc_")||f.includes("wallet_connect")){const h=await r.getItem(u);await e.setItem(u,h),c.push(u)}}await e.setItem(n,mp),t(e),W3(r,c)},W3=async(r,e)=>{e.length&&e.forEach(async t=>{await r.removeItem(t)})};class K3{constructor(){this.initialized=!1,this.setInitialized=t=>{this.storage=t,this.initialized=!0};const e=new q3;this.storage=e;try{const t=new B3;H3(e,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const t=setInterval(()=>{this.initialized&&(clearInterval(t),e())},20)})}}var Ds={};/*! *****************************************************************************
|
|
20
|
+
Approved: ${y.toString()}`))}),c.forEach(w=>{n||(Bi(i[w].methods,a[w].methods)?Bi(i[w].events,a[w].events)||(n=ue("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${w}`)):n=ue("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${w}`))}),n}function b3(r){const e={};return Object.keys(r).forEach(t=>{var n;t.includes(":")?e[t]=r[t]:(n=r[t].chains)==null||n.forEach(i=>{e[i]={methods:r[t].methods,events:r[t].events}})}),e}function y0(r){return[...new Set(r.map(e=>e.includes(":")?e.split(":")[0]:e))]}function _3(r){const e={};return Object.keys(r).forEach(t=>{if(t.includes(":"))e[t]=r[t];else{const n=$s(r[t].accounts);n?.forEach(i=>{e[i]={accounts:r[t].accounts.filter(a=>a.includes(`${i}:`)),methods:r[t].methods,events:r[t].events}})}}),e}function E3(r,e){return wu(r,!1)&&r<=e.max&&r>=e.min}function w0(){const r=Co();return new Promise(e=>{switch(r){case kr.browser:e(x3());break;case kr.reactNative:e(I3());break;case kr.node:e(D3());break;default:e(!0)}})}function x3(){return Os()&&navigator?.onLine}async function I3(){if(Ss()&&typeof global<"u"&&global!=null&&global.NetInfo){const r=await(global==null?void 0:global.NetInfo.fetch());return r?.isConnected}return!0}function D3(){return!0}function S3(r){switch(Co()){case kr.browser:O3(r);break;case kr.reactNative:C3(r);break}}function O3(r){!Ss()&&Os()&&(window.addEventListener("online",()=>r(!0)),window.addEventListener("offline",()=>r(!1)))}function C3(r){Ss()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>r(e?.isConnected))}const _u={};class To{static get(e){return _u[e]}static set(e,t){_u[e]=t}static delete(e){delete _u[e]}}const $3=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,A3=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,P3=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function T3(r,e){if(r==="__proto__"||r==="constructor"&&e&&typeof e=="object"&&"prototype"in e){R3(r);return}return e}function R3(r){console.warn(`[destr] Dropping "${r}" key to prevent prototype pollution.`)}function Wa(r,e={}){if(typeof r!="string")return r;const t=r.trim();if(r[0]==='"'&&r.at(-1)==='"'&&!r.includes("\\"))return t.slice(1,-1);if(t.length<=9){const n=t.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!P3.test(r)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return r}try{if($3.test(r)||A3.test(r)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(r,T3)}return JSON.parse(r)}catch(n){if(e.strict)throw n;return r}}function N3(r){return!r||typeof r.then!="function"?Promise.resolve(r):r}function ir(r,...e){try{return N3(r(...e))}catch(t){return Promise.reject(t)}}function L3(r){const e=typeof r;return r===null||e!=="object"&&e!=="function"}function M3(r){const e=Object.getPrototypeOf(r);return!e||e.isPrototypeOf(Object)}function Ka(r){if(L3(r))return String(r);if(M3(r)||Array.isArray(r))return JSON.stringify(r);if(typeof r.toJSON=="function")return Ka(r.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function b0(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const Eu="base64:";function U3(r){if(typeof r=="string")return r;b0();const e=Buffer.from(r).toString("base64");return Eu+e}function j3(r){return typeof r!="string"||!r.startsWith(Eu)?r:(b0(),Buffer.from(r.slice(Eu.length),"base64"))}function Pr(r){return r?r.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function F3(...r){return Pr(r.join(":"))}function Va(r){return r=Pr(r),r?r+":":""}function vR(r){return r}const B3="memory",k3=()=>{const r=new Map;return{name:B3,options:{},hasItem(e){return r.has(e)},getItem(e){return r.get(e)||null},getItemRaw(e){return r.get(e)||null},setItem(e,t){r.set(e,t)},setItemRaw(e,t){r.set(e,t)},removeItem(e){r.delete(e)},getKeys(){return Array.from(r.keys())},clear(){r.clear()},dispose(){r.clear()}}};function z3(r={}){const e={mounts:{"":r.driver||k3()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},t=h=>{for(const m of e.mountpoints)if(h.startsWith(m))return{base:m,relativeKey:h.slice(m.length),driver:e.mounts[m]};return{base:"",relativeKey:h,driver:e.mounts[""]}},n=(h,m)=>e.mountpoints.filter(w=>w.startsWith(h)||m&&h.startsWith(w)).map(w=>({relativeBase:h.length>w.length?h.slice(w.length):void 0,mountpoint:w,driver:e.mounts[w]})),i=(h,m)=>{if(e.watching){m=Pr(m);for(const w of e.watchListeners)w(h,m)}},a=async()=>{if(!e.watching){e.watching=!0;for(const h in e.mounts)e.unwatch[h]=await _0(e.mounts[h],i,h)}},c=async()=>{if(e.watching){for(const h in e.unwatch)await e.unwatch[h]();e.unwatch={},e.watching=!1}},u=(h,m,w)=>{const y=new Map,b=I=>{let A=y.get(I.base);return A||(A={driver:I.driver,base:I.base,items:[]},y.set(I.base,A)),A};for(const I of h){const A=typeof I=="string",U=Pr(A?I:I.key),j=A?void 0:I.value,$=A||!I.options?m:{...m,...I.options},T=t(U);b(T).items.push({key:U,value:j,relativeKey:T.relativeKey,options:$})}return Promise.all([...y.values()].map(I=>w(I))).then(I=>I.flat())},f={hasItem(h,m={}){h=Pr(h);const{relativeKey:w,driver:y}=t(h);return ir(y.hasItem,w,m)},getItem(h,m={}){h=Pr(h);const{relativeKey:w,driver:y}=t(h);return ir(y.getItem,w,m).then(b=>Wa(b))},getItems(h,m){return u(h,m,w=>w.driver.getItems?ir(w.driver.getItems,w.items.map(y=>({key:y.relativeKey,options:y.options})),m).then(y=>y.map(b=>({key:F3(w.base,b.key),value:Wa(b.value)}))):Promise.all(w.items.map(y=>ir(w.driver.getItem,y.relativeKey,y.options).then(b=>({key:y.key,value:Wa(b)})))))},getItemRaw(h,m={}){h=Pr(h);const{relativeKey:w,driver:y}=t(h);return y.getItemRaw?ir(y.getItemRaw,w,m):ir(y.getItem,w,m).then(b=>j3(b))},async setItem(h,m,w={}){if(m===void 0)return f.removeItem(h);h=Pr(h);const{relativeKey:y,driver:b}=t(h);b.setItem&&(await ir(b.setItem,y,Ka(m),w),b.watch||i("update",h))},async setItems(h,m){await u(h,m,async w=>{w.driver.setItems&&await ir(w.driver.setItems,w.items.map(y=>({key:y.relativeKey,value:Ka(y.value),options:y.options})),m),w.driver.setItem&&await Promise.all(w.items.map(y=>ir(w.driver.setItem,y.relativeKey,Ka(y.value),y.options)))})},async setItemRaw(h,m,w={}){if(m===void 0)return f.removeItem(h,w);h=Pr(h);const{relativeKey:y,driver:b}=t(h);if(b.setItemRaw)await ir(b.setItemRaw,y,m,w);else if(b.setItem)await ir(b.setItem,y,U3(m),w);else return;b.watch||i("update",h)},async removeItem(h,m={}){typeof m=="boolean"&&(m={removeMeta:m}),h=Pr(h);const{relativeKey:w,driver:y}=t(h);y.removeItem&&(await ir(y.removeItem,w,m),(m.removeMeta||m.removeMata)&&await ir(y.removeItem,w+"$",m),y.watch||i("remove",h))},async getMeta(h,m={}){typeof m=="boolean"&&(m={nativeOnly:m}),h=Pr(h);const{relativeKey:w,driver:y}=t(h),b=Object.create(null);if(y.getMeta&&Object.assign(b,await ir(y.getMeta,w,m)),!m.nativeOnly){const I=await ir(y.getItem,w+"$",m).then(A=>Wa(A));I&&typeof I=="object"&&(typeof I.atime=="string"&&(I.atime=new Date(I.atime)),typeof I.mtime=="string"&&(I.mtime=new Date(I.mtime)),Object.assign(b,I))}return b},setMeta(h,m,w={}){return this.setItem(h+"$",m,w)},removeMeta(h,m={}){return this.removeItem(h+"$",m)},async getKeys(h,m={}){h=Va(h);const w=n(h,!0);let y=[];const b=[];for(const I of w){const U=(await ir(I.driver.getKeys,I.relativeBase,m)).map(j=>I.mountpoint+Pr(j)).filter(j=>!y.some($=>j.startsWith($)));b.push(...U),y=[I.mountpoint,...y.filter(j=>!j.startsWith(I.mountpoint))]}return h?b.filter(I=>I.startsWith(h)&&!I.endsWith("$")):b.filter(I=>!I.endsWith("$"))},async clear(h,m={}){h=Va(h),await Promise.all(n(h,!1).map(async w=>{if(w.driver.clear)return ir(w.driver.clear,w.relativeBase,m);if(w.driver.removeItem){const y=await w.driver.getKeys(w.relativeBase||"",m);return Promise.all(y.map(b=>w.driver.removeItem(b,m)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(h=>E0(h)))},async watch(h){return await a(),e.watchListeners.push(h),async()=>{e.watchListeners=e.watchListeners.filter(m=>m!==h),e.watchListeners.length===0&&await c()}},async unwatch(){e.watchListeners=[],await c()},mount(h,m){if(h=Va(h),h&&e.mounts[h])throw new Error(`already mounted at ${h}`);return h&&(e.mountpoints.push(h),e.mountpoints.sort((w,y)=>y.length-w.length)),e.mounts[h]=m,e.watching&&Promise.resolve(_0(m,i,h)).then(w=>{e.unwatch[h]=w}).catch(console.error),f},async unmount(h,m=!0){h=Va(h),!(!h||!e.mounts[h])&&(e.watching&&h in e.unwatch&&(e.unwatch[h](),delete e.unwatch[h]),m&&await E0(e.mounts[h]),e.mountpoints=e.mountpoints.filter(w=>w!==h),delete e.mounts[h])},getMount(h=""){h=Pr(h)+":";const m=t(h);return{driver:m.driver,base:m.base}},getMounts(h="",m={}){return h=Pr(h),n(h,m.parents).map(y=>({driver:y.driver,base:y.mountpoint}))}};return f}function _0(r,e,t){return r.watch?r.watch((n,i)=>e(n,t+i)):()=>{}}async function E0(r){typeof r.dispose=="function"&&await ir(r.dispose)}function ki(r){return new Promise((e,t)=>{r.oncomplete=r.onsuccess=()=>e(r.result),r.onabort=r.onerror=()=>t(r.error)})}function x0(r,e){const t=indexedDB.open(r);t.onupgradeneeded=()=>t.result.createObjectStore(e);const n=ki(t);return(i,a)=>n.then(c=>a(c.transaction(e,i).objectStore(e)))}let xu;function Ro(){return xu||(xu=x0("keyval-store","keyval")),xu}function I0(r,e=Ro()){return e("readonly",t=>ki(t.get(r)))}function q3(r,e,t=Ro()){return t("readwrite",n=>(n.put(e,r),ki(n.transaction)))}function H3(r,e=Ro()){return e("readwrite",t=>(t.delete(r),ki(t.transaction)))}function W3(r=Ro()){return r("readwrite",e=>(e.clear(),ki(e.transaction)))}function K3(r,e){return r.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},ki(r.transaction)}function V3(r=Ro()){return r("readonly",e=>{if(e.getAllKeys)return ki(e.getAllKeys());const t=[];return K3(e,n=>t.push(n.key)).then(()=>t)})}const G3=r=>JSON.stringify(r,(e,t)=>typeof t=="bigint"?t.toString()+"n":t),Y3=r=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,t=r.replace(e,'$1"$2n"$3');return JSON.parse(t,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function No(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return Y3(r)}catch{return r}}function Mn(r){return typeof r=="string"?r:G3(r)||""}const Z3="idb-keyval";var J3=(r={})=>{const e=r.base&&r.base.length>0?`${r.base}:`:"",t=i=>e+i;let n;return r.dbName&&r.storeName&&(n=x0(r.dbName,r.storeName)),{name:Z3,options:r,async hasItem(i){return!(typeof await I0(t(i),n)>"u")},async getItem(i){return await I0(t(i),n)??null},setItem(i,a){return q3(t(i),a,n)},removeItem(i){return H3(t(i),n)},getKeys(){return V3(n)},clear(){return W3(n)}}};const Q3="WALLET_CONNECT_V2_INDEXED_DB",X3="keyvaluestorage";class e5{constructor(){this.indexedDb=z3({driver:J3({dbName:Q3,storeName:X3})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const t=await this.indexedDb.getItem(e);if(t!==null)return t}async setItem(e,t){await this.indexedDb.setItem(e,Mn(t))}async removeItem(e){await this.indexedDb.removeItem(e)}}var Iu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ga={exports:{}};(function(){let r;function e(){}r=e,r.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},r.prototype.setItem=function(t,n){this[t]=String(n)},r.prototype.removeItem=function(t){delete this[t]},r.prototype.clear=function(){const t=this;Object.keys(t).forEach(function(n){t[n]=void 0,delete t[n]})},r.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Iu<"u"&&Iu.localStorage?Ga.exports=Iu.localStorage:typeof window<"u"&&window.localStorage?Ga.exports=window.localStorage:Ga.exports=new e})();function t5(r){var e;return[r[0],No((e=r[1])!=null?e:"")]}class r5{constructor(){this.localStorage=Ga.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(t5)}async getItem(e){const t=this.localStorage.getItem(e);if(t!==null)return No(t)}async setItem(e,t){this.localStorage.setItem(e,Mn(t))}async removeItem(e){this.localStorage.removeItem(e)}}const n5="wc_storage_version",D0=1,i5=async(r,e,t)=>{const n=n5,i=await e.getItem(n);if(i&&i>=D0){t(e);return}const a=await r.getKeys();if(!a.length){t(e);return}const c=[];for(;a.length;){const u=a.shift();if(!u)continue;const f=u.toLowerCase();if(f.includes("wc@")||f.includes("walletconnect")||f.includes("wc_")||f.includes("wallet_connect")){const h=await r.getItem(u);await e.setItem(u,h),c.push(u)}}await e.setItem(n,D0),t(e),s5(r,c)},s5=async(r,e)=>{e.length&&e.forEach(async t=>{await r.removeItem(t)})};class o5{constructor(){this.initialized=!1,this.setInitialized=t=>{this.storage=t,this.initialized=!0};const e=new r5;this.storage=e;try{const t=new e5;i5(e,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const t=setInterval(()=>{this.initialized&&(clearInterval(t),e())},20)})}}var As={};/*! *****************************************************************************
|
|
21
21
|
Copyright (c) Microsoft Corporation.
|
|
22
22
|
|
|
23
23
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
31
31
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
32
32
|
PERFORMANCE OF THIS SOFTWARE.
|
|
33
|
-
***************************************************************************** */var mu=function(r,e){return mu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},mu(r,e)};function V3(r,e){mu(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var vu=function(){return vu=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},vu.apply(this,arguments)};function G3(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function Y3(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var u=r.length-1;u>=0;u--)(c=r[u])&&(a=(i<3?c(a):i>3?c(e,t,a):c(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a}function J3(r,e){return function(t,n){e(t,n,r)}}function Z3(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function Q3(r,e,t,n){function i(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function u(m){try{h(n.next(m))}catch(w){c(w)}}function f(m){try{h(n.throw(m))}catch(w){c(w)}}function h(m){m.done?a(m.value):i(m.value).then(u,f)}h((n=n.apply(r,e||[])).next())})}function X3(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,c;return c={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(h){return function(m){return f([h,m])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(a=h[0]&2?i.return:h[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,h[1])).done)return a;switch(i=0,a&&(h=[h[0]&2,a.value]),h[0]){case 0:case 1:a=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,i=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!a||h[1]>a[0]&&h[1]<a[3])){t.label=h[1];break}if(h[0]===6&&t.label<a[1]){t.label=a[1],a=h;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(h);break}a[2]&&t.ops.pop(),t.trys.pop();continue}h=e.call(r,t)}catch(m){h=[6,m],i=0}finally{n=a=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function e5(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}function t5(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function yu(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function vp(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,a=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(u){c={error:u}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(c)throw c.error}}return a}function r5(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(vp(arguments[e]));return r}function n5(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),i=0,e=0;e<t;e++)for(var a=arguments[e],c=0,u=a.length;c<u;c++,i++)n[i]=a[c];return n}function So(r){return this instanceof So?(this.v=r,this):new So(r)}function i5(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(y){n[y]&&(i[y]=function(x){return new Promise(function(S,P){a.push([y,x,S,P])>1||u(y,x)})})}function u(y,x){try{f(n[y](x))}catch(S){w(a[0][3],S)}}function f(y){y.value instanceof So?Promise.resolve(y.value.v).then(h,m):w(a[0][2],y)}function h(y){u("next",y)}function m(y){u("throw",y)}function w(y,x){y(x),a.shift(),a.length&&u(a[0][0],a[0][1])}}function s5(r){var e,t;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,a){e[i]=r[i]?function(c){return(t=!t)?{value:So(r[i](c)),done:i==="return"}:a?a(c):c}:a}}function o5(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof yu=="function"?yu(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(c){return new Promise(function(u,f){c=r[a](c),i(u,f,c.done,c.value)})}}function i(a,c,u,f){Promise.resolve(f).then(function(h){a({value:h,done:u})},c)}}function a5(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function c5(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function l5(r){return r&&r.__esModule?r:{default:r}}function u5(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function h5(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var f5=Object.freeze({__proto__:null,__extends:V3,get __assign(){return vu},__rest:G3,__decorate:Y3,__param:J3,__metadata:Z3,__awaiter:Q3,__generator:X3,__createBinding:e5,__exportStar:t5,__values:yu,__read:vp,__spread:r5,__spreadArrays:n5,__await:So,__asyncGenerator:i5,__asyncDelegator:s5,__asyncValues:o5,__makeTemplateObject:a5,__importStar:c5,__importDefault:l5,__classPrivateFieldGet:u5,__classPrivateFieldSet:h5}),ka=Pi(f5),Co={},wu={},Oo={};class Fi{}var d5=Object.freeze({__proto__:null,IEvents:Fi}),p5=Pi(d5),yp;function g5(){if(yp)return Oo;yp=1,Object.defineProperty(Oo,"__esModule",{value:!0}),Oo.IHeartBeat=void 0;const r=p5;class e extends r.IEvents{constructor(n){super()}}return Oo.IHeartBeat=e,Oo}var wp;function bp(){return wp||(wp=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),ka.__exportStar(g5(),r)}(wu)),wu}var bu={},Bi={},_p;function m5(){if(_p)return Bi;_p=1,Object.defineProperty(Bi,"__esModule",{value:!0}),Bi.HEARTBEAT_EVENTS=Bi.HEARTBEAT_INTERVAL=void 0;const r=ye;return Bi.HEARTBEAT_INTERVAL=r.FIVE_SECONDS,Bi.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"},Bi}var Ep;function xp(){return Ep||(Ep=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),ka.__exportStar(m5(),r)}(bu)),bu}var Ip;function v5(){if(Ip)return Co;Ip=1,Object.defineProperty(Co,"__esModule",{value:!0}),Co.HeartBeat=void 0;const r=ka,e=lr.exports,t=ye,n=bp(),i=xp();class a extends n.IHeartBeat{constructor(u){super(u),this.events=new e.EventEmitter,this.interval=i.HEARTBEAT_INTERVAL,this.interval=u?.interval||i.HEARTBEAT_INTERVAL}static init(u){return r.__awaiter(this,void 0,void 0,function*(){const f=new a(u);return yield f.init(),f})}init(){return r.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(u,f){this.events.on(u,f)}once(u,f){this.events.once(u,f)}off(u,f){this.events.off(u,f)}removeListener(u,f){this.events.removeListener(u,f)}initialize(){return r.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),t.toMiliseconds(this.interval))})}pulse(){this.events.emit(i.HEARTBEAT_EVENTS.pulse)}}return Co.HeartBeat=a,Co}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=ka;e.__exportStar(v5(),r),e.__exportStar(bp(),r),e.__exportStar(xp(),r)})(Ds);var Xe={};/*! *****************************************************************************
|
|
33
|
+
***************************************************************************** */var Du=function(r,e){return Du=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},Du(r,e)};function a5(r,e){Du(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Su=function(){return Su=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},Su.apply(this,arguments)};function c5(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function l5(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var u=r.length-1;u>=0;u--)(c=r[u])&&(a=(i<3?c(a):i>3?c(e,t,a):c(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a}function u5(r,e){return function(t,n){e(t,n,r)}}function h5(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function f5(r,e,t,n){function i(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function u(m){try{h(n.next(m))}catch(w){c(w)}}function f(m){try{h(n.throw(m))}catch(w){c(w)}}function h(m){m.done?a(m.value):i(m.value).then(u,f)}h((n=n.apply(r,e||[])).next())})}function d5(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,c;return c={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(h){return function(m){return f([h,m])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(a=h[0]&2?i.return:h[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,h[1])).done)return a;switch(i=0,a&&(h=[h[0]&2,a.value]),h[0]){case 0:case 1:a=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,i=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!a||h[1]>a[0]&&h[1]<a[3])){t.label=h[1];break}if(h[0]===6&&t.label<a[1]){t.label=a[1],a=h;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(h);break}a[2]&&t.ops.pop(),t.trys.pop();continue}h=e.call(r,t)}catch(m){h=[6,m],i=0}finally{n=a=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function p5(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}function g5(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function Ou(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function S0(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,a=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(u){c={error:u}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(c)throw c.error}}return a}function m5(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(S0(arguments[e]));return r}function v5(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),i=0,e=0;e<t;e++)for(var a=arguments[e],c=0,u=a.length;c<u;c++,i++)n[i]=a[c];return n}function Lo(r){return this instanceof Lo?(this.v=r,this):new Lo(r)}function y5(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(y){n[y]&&(i[y]=function(b){return new Promise(function(I,A){a.push([y,b,I,A])>1||u(y,b)})})}function u(y,b){try{f(n[y](b))}catch(I){w(a[0][3],I)}}function f(y){y.value instanceof Lo?Promise.resolve(y.value.v).then(h,m):w(a[0][2],y)}function h(y){u("next",y)}function m(y){u("throw",y)}function w(y,b){y(b),a.shift(),a.length&&u(a[0][0],a[0][1])}}function w5(r){var e,t;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,a){e[i]=r[i]?function(c){return(t=!t)?{value:Lo(r[i](c)),done:i==="return"}:a?a(c):c}:a}}function b5(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof Ou=="function"?Ou(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(c){return new Promise(function(u,f){c=r[a](c),i(u,f,c.done,c.value)})}}function i(a,c,u,f){Promise.resolve(f).then(function(h){a({value:h,done:u})},c)}}function _5(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function E5(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function x5(r){return r&&r.__esModule?r:{default:r}}function I5(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function D5(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var S5=Object.freeze({__proto__:null,__extends:a5,get __assign(){return Su},__rest:c5,__decorate:l5,__param:u5,__metadata:h5,__awaiter:f5,__generator:d5,__createBinding:p5,__exportStar:g5,__values:Ou,__read:S0,__spread:m5,__spreadArrays:v5,__await:Lo,__asyncGenerator:y5,__asyncDelegator:w5,__asyncValues:b5,__makeTemplateObject:_5,__importStar:E5,__importDefault:x5,__classPrivateFieldGet:I5,__classPrivateFieldSet:D5}),Ya=Li(S5),Mo={},Cu={},Uo={};class zi{}var O5=Object.freeze({__proto__:null,IEvents:zi}),C5=Li(O5),O0;function $5(){if(O0)return Uo;O0=1,Object.defineProperty(Uo,"__esModule",{value:!0}),Uo.IHeartBeat=void 0;const r=C5;class e extends r.IEvents{constructor(n){super()}}return Uo.IHeartBeat=e,Uo}var C0;function $0(){return C0||(C0=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),Ya.__exportStar($5(),r)}(Cu)),Cu}var $u={},qi={},A0;function A5(){if(A0)return qi;A0=1,Object.defineProperty(qi,"__esModule",{value:!0}),qi.HEARTBEAT_EVENTS=qi.HEARTBEAT_INTERVAL=void 0;const r=me;return qi.HEARTBEAT_INTERVAL=r.FIVE_SECONDS,qi.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"},qi}var P0;function T0(){return P0||(P0=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),Ya.__exportStar(A5(),r)}($u)),$u}var R0;function P5(){if(R0)return Mo;R0=1,Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.HeartBeat=void 0;const r=Ya,e=cr.exports,t=me,n=$0(),i=T0();class a extends n.IHeartBeat{constructor(u){super(u),this.events=new e.EventEmitter,this.interval=i.HEARTBEAT_INTERVAL,this.interval=u?.interval||i.HEARTBEAT_INTERVAL}static init(u){return r.__awaiter(this,void 0,void 0,function*(){const f=new a(u);return yield f.init(),f})}init(){return r.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(u,f){this.events.on(u,f)}once(u,f){this.events.once(u,f)}off(u,f){this.events.off(u,f)}removeListener(u,f){this.events.removeListener(u,f)}initialize(){return r.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),t.toMiliseconds(this.interval))})}pulse(){this.events.emit(i.HEARTBEAT_EVENTS.pulse)}}return Mo.HeartBeat=a,Mo}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=Ya;e.__exportStar(P5(),r),e.__exportStar($0(),r),e.__exportStar(T0(),r)})(As);var Au,N0;function T5(){if(N0)return Au;N0=1;function r(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}Au=e;function e(t,n,i){var a=i&&i.stringify||r,c=1;if(typeof t=="object"&&t!==null){var u=n.length+c;if(u===1)return t;var f=new Array(u);f[0]=a(t);for(var h=1;h<u;h++)f[h]=a(n[h]);return f.join(" ")}if(typeof t!="string")return t;var m=n.length;if(m===0)return t;for(var w="",y=1-c,b=-1,I=t&&t.length||0,A=0;A<I;){if(t.charCodeAt(A)===37&&A+1<I){switch(b=b>-1?b:0,t.charCodeAt(A+1)){case 100:case 102:if(y>=m||n[y]==null)break;b<A&&(w+=t.slice(b,A)),w+=Number(n[y]),b=A+2,A++;break;case 105:if(y>=m||n[y]==null)break;b<A&&(w+=t.slice(b,A)),w+=Math.floor(Number(n[y])),b=A+2,A++;break;case 79:case 111:case 106:if(y>=m||n[y]===void 0)break;b<A&&(w+=t.slice(b,A));var U=typeof n[y];if(U==="string"){w+="'"+n[y]+"'",b=A+2,A++;break}if(U==="function"){w+=n[y].name||"<anonymous>",b=A+2,A++;break}w+=a(n[y]),b=A+2,A++;break;case 115:if(y>=m)break;b<A&&(w+=t.slice(b,A)),w+=String(n[y]),b=A+2,A++;break;case 37:b<A&&(w+=t.slice(b,A)),w+="%",b=A+2,A++,y--;break}++y}++A}return b===-1?t:(b<I&&(w+=t.slice(b)),w)}return Au}var Pu,L0;function M0(){if(L0)return Pu;L0=1;const r=T5();Pu=i;const e=P().console||{},t={mapHttpRequest:I,mapHttpResponse:I,wrapRequestSerializer:A,wrapResponseSerializer:A,wrapErrorSerializer:A,req:I,res:I,err:y};function n(x,d){return Array.isArray(x)?x.filter(function(H){return H!=="!stdSerializers.err"}):x===!0?Object.keys(d):!1}function i(x){x=x||{},x.browser=x.browser||{};const d=x.browser.transmit;if(d&&typeof d.send!="function")throw Error("pino: transmit option must have a send function");const _=x.browser.write||e;x.browser.write&&(x.browser.asObject=!0);const H=x.serializers||{},F=n(x.browser.serialize,H);let V=x.browser.serialize;Array.isArray(x.browser.serialize)&&x.browser.serialize.indexOf("!stdSerializers.err")>-1&&(V=!1);const se=["error","fatal","warn","info","debug","trace"];typeof _=="function"&&(_.error=_.fatal=_.warn=_.info=_.debug=_.trace=_),x.enabled===!1&&(x.level="silent");const ce=x.level||"info",D=Object.create(_);D.log||(D.log=U),Object.defineProperty(D,"levelVal",{get:X}),Object.defineProperty(D,"level",{get:ee,set:Y});const N={transmit:d,serialize:F,asObject:x.browser.asObject,levels:se,timestamp:b(x)};D.levels=i.levels,D.level=ce,D.setMaxListeners=D.getMaxListeners=D.emit=D.addListener=D.on=D.prependListener=D.once=D.prependOnceListener=D.removeListener=D.removeAllListeners=D.listeners=D.listenerCount=D.eventNames=D.write=D.flush=U,D.serializers=H,D._serialize=F,D._stdErrSerialize=V,D.child=Z,d&&(D._logEvent=w());function X(){return this.level==="silent"?1/0:this.levels.values[this.level]}function ee(){return this._level}function Y(Q){if(Q!=="silent"&&!this.levels.values[Q])throw Error("unknown level "+Q);this._level=Q,a(N,D,"error","log"),a(N,D,"fatal","error"),a(N,D,"warn","error"),a(N,D,"info","log"),a(N,D,"debug","log"),a(N,D,"trace","log")}function Z(Q,ie){if(!Q)throw new Error("missing bindings for child Pino");ie=ie||{},F&&Q.serializers&&(ie.serializers=Q.serializers);const Ee=ie.serializers;if(F&&Ee){var ae=Object.assign({},H,Ee),xe=x.browser.serialize===!0?Object.keys(ae):F;delete Q.serializers,f([Q],xe,ae,this._stdErrSerialize)}function de(be){this._childLevel=(be._childLevel|0)+1,this.error=h(be,Q,"error"),this.fatal=h(be,Q,"fatal"),this.warn=h(be,Q,"warn"),this.info=h(be,Q,"info"),this.debug=h(be,Q,"debug"),this.trace=h(be,Q,"trace"),ae&&(this.serializers=ae,this._serialize=xe),d&&(this._logEvent=w([].concat(be._logEvent.bindings,Q)))}return de.prototype=this,new de(this)}return D}i.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},i.stdSerializers=t,i.stdTimeFunctions=Object.assign({},{nullTime:j,epochTime:$,unixTime:T,isoTime:O});function a(x,d,_,H){const F=Object.getPrototypeOf(d);d[_]=d.levelVal>d.levels.values[_]?U:F[_]?F[_]:e[_]||e[H]||U,c(x,d,_)}function c(x,d,_){!x.transmit&&d[_]===U||(d[_]=function(H){return function(){const V=x.timestamp(),se=new Array(arguments.length),ce=Object.getPrototypeOf&&Object.getPrototypeOf(this)===e?e:this;for(var D=0;D<se.length;D++)se[D]=arguments[D];if(x.serialize&&!x.asObject&&f(se,this._serialize,this.serializers,this._stdErrSerialize),x.asObject?H.call(ce,u(this,_,se,V)):H.apply(ce,se),x.transmit){const N=x.transmit.level||d.level,X=i.levels.values[N],ee=i.levels.values[_];if(ee<X)return;m(this,{ts:V,methodLevel:_,methodValue:ee,transmitLevel:N,transmitValue:i.levels.values[x.transmit.level||d.level],send:x.transmit.send,val:d.levelVal},se)}}}(d[_]))}function u(x,d,_,H){x._serialize&&f(_,x._serialize,x.serializers,x._stdErrSerialize);const F=_.slice();let V=F[0];const se={};H&&(se.time=H),se.level=i.levels.values[d];let ce=(x._childLevel|0)+1;if(ce<1&&(ce=1),V!==null&&typeof V=="object"){for(;ce--&&typeof F[0]=="object";)Object.assign(se,F.shift());V=F.length?r(F.shift(),F):void 0}else typeof V=="string"&&(V=r(F.shift(),F));return V!==void 0&&(se.msg=V),se}function f(x,d,_,H){for(const F in x)if(H&&x[F]instanceof Error)x[F]=i.stdSerializers.err(x[F]);else if(typeof x[F]=="object"&&!Array.isArray(x[F]))for(const V in x[F])d&&d.indexOf(V)>-1&&V in _&&(x[F][V]=_[V](x[F][V]))}function h(x,d,_){return function(){const H=new Array(1+arguments.length);H[0]=d;for(var F=1;F<H.length;F++)H[F]=arguments[F-1];return x[_].apply(this,H)}}function m(x,d,_){const H=d.send,F=d.ts,V=d.methodLevel,se=d.methodValue,ce=d.val,D=x._logEvent.bindings;f(_,x._serialize||Object.keys(x.serializers),x.serializers,x._stdErrSerialize===void 0?!0:x._stdErrSerialize),x._logEvent.ts=F,x._logEvent.messages=_.filter(function(N){return D.indexOf(N)===-1}),x._logEvent.level.label=V,x._logEvent.level.value=se,H(V,x._logEvent,ce),x._logEvent=w(D)}function w(x){return{ts:0,messages:[],bindings:x||[],level:{label:"",value:0}}}function y(x){const d={type:x.constructor.name,msg:x.message,stack:x.stack};for(const _ in x)d[_]===void 0&&(d[_]=x[_]);return d}function b(x){return typeof x.timestamp=="function"?x.timestamp:x.timestamp===!1?j:$}function I(){return{}}function A(x){return x}function U(){}function j(){return!1}function $(){return Date.now()}function T(){return Math.round(Date.now()/1e3)}function O(){return new Date(Date.now()).toISOString()}function P(){function x(d){return typeof d<"u"&&d}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return x(self)||x(window)||x(this)||{}}}return Pu}var ci=M0();const R5={level:"info"},jo="custom_context",Tu=1e3*1024;class N5{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class U0{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new N5(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;t!==null;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}}class j0{constructor(e,t=Tu){this.level=e??"error",this.levelValue=ci.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new U0(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===ci.levels.values.error?console.error(e):t===ci.levels.values.warn?console.warn(e):t===ci.levels.values.debug?console.debug(e):t===ci.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(Mn({timestamp:new Date().toISOString(),log:e}));const t=typeof e=="string"?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new U0(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(Mn({extraMetadata:e})),new Blob(t,{type:"application/json"})}}class L5{constructor(e,t=Tu){this.baseChunkLogger=new j0(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=t,n.download=`w3i-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}}class M5 extends wo.Writable{constructor(e,t=Tu){super({objectMode:!0}),this.baseChunkLogger=new j0(e,t)}_write(e,t,n){try{this.baseChunkLogger.appendToLogs(e),n()}catch(i){n(i)}}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var U5=Object.defineProperty,j5=Object.defineProperties,F5=Object.getOwnPropertyDescriptors,F0=Object.getOwnPropertySymbols,B5=Object.prototype.hasOwnProperty,k5=Object.prototype.propertyIsEnumerable,B0=(r,e,t)=>e in r?U5(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Za=(r,e)=>{for(var t in e||(e={}))B5.call(e,t)&&B0(r,t,e[t]);if(F0)for(var t of F0(e))k5.call(e,t)&&B0(r,t,e[t]);return r},Ja=(r,e)=>j5(r,F5(e));function k0(r){return Ja(Za({},r),{level:r?.level||R5.level})}function z5(r,e=jo){return r[e]||""}function q5(r,e,t=jo){return r[t]=e,r}function qr(r,e=jo){let t="";return typeof r.bindings>"u"?t=z5(r,e):t=r.bindings().context||"",t}function H5(r,e,t=jo){const n=qr(r,t);return n.trim()?`${n}/${e}`:e}function Hr(r,e,t=jo){const n=H5(r,e,t),i=r.child({context:n});return q5(i,n,t)}function W5(r){var e,t;const n=new L5((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:ci(Ja(Za({},r.opts),{level:"trace",browser:Ja(Za({},(t=r.opts)==null?void 0:t.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function K5(r){var e;const t=new M5((e=r.opts)==null?void 0:e.level,r.maxSizeInBytes);return{logger:ci(Ja(Za({},r.opts),{level:"trace"}),t),chunkLoggerController:t}}function V5(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?W5(r):K5(r)}class G5 extends zi{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class Y5 extends zi{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}}class Z5{constructor(e,t){this.logger=e,this.core=t}}class J5 extends zi{constructor(e,t){super(),this.relayer=e,this.logger=t}}class Q5 extends zi{constructor(e){super()}}class X5{constructor(e,t,n,i){this.core=e,this.logger=t,this.name=n}}class eE extends zi{constructor(e,t){super(),this.relayer=e,this.logger=t}}class tE extends zi{constructor(e,t){super(),this.core=e,this.logger=t}}class rE{constructor(e,t){this.projectId=e,this.logger=t}}class nE{constructor(e,t){this.projectId=e,this.logger=t}}class iE{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class sE{constructor(e){this.client=e}}var Ru={},z0={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=Me,t=Br;r.DIGEST_LENGTH=64,r.BLOCK_SIZE=128;var n=function(){function u(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return u.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},u.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},u.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._tempHi),t.wipe(this._tempLo),this.reset()},u.prototype.update=function(f,h){if(h===void 0&&(h=f.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var m=0;if(this._bytesHashed+=h,this._bufferLength>0){for(;this._bufferLength<r.BLOCK_SIZE&&h>0;)this._buffer[this._bufferLength++]=f[m++],h--;this._bufferLength===this.blockSize&&(a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(h>=this.blockSize&&(m=a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,f,m,h),h%=this.blockSize);h>0;)this._buffer[this._bufferLength++]=f[m++],h--;return this},u.prototype.finish=function(f){if(!this._finished){var h=this._bytesHashed,m=this._bufferLength,w=h/536870912|0,y=h<<3,b=h%128<112?128:256;this._buffer[m]=128;for(var I=m+1;I<b-8;I++)this._buffer[I]=0;e.writeUint32BE(w,this._buffer,b-8),e.writeUint32BE(y,this._buffer,b-4),a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,b),this._finished=!0}for(var I=0;I<this.digestLength/8;I++)e.writeUint32BE(this._stateHi[I],f,I*8),e.writeUint32BE(this._stateLo[I],f,I*8+4);return this},u.prototype.digest=function(){var f=new Uint8Array(this.digestLength);return this.finish(f),f},u.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},u.prototype.restoreState=function(f){return this._stateHi.set(f.stateHi),this._stateLo.set(f.stateLo),this._bufferLength=f.bufferLength,f.buffer&&this._buffer.set(f.buffer),this._bytesHashed=f.bytesHashed,this._finished=!1,this},u.prototype.cleanSavedState=function(f){t.wipe(f.stateHi),t.wipe(f.stateLo),f.buffer&&t.wipe(f.buffer),f.bufferLength=0,f.bytesHashed=0},u}();r.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function a(u,f,h,m,w,y,b){for(var I=h[0],A=h[1],U=h[2],j=h[3],$=h[4],T=h[5],O=h[6],P=h[7],x=m[0],d=m[1],_=m[2],H=m[3],F=m[4],V=m[5],se=m[6],ce=m[7],D,N,X,ee,Y,Z,Q,ie;b>=128;){for(var Ee=0;Ee<16;Ee++){var ae=8*Ee+y;u[Ee]=e.readUint32BE(w,ae),f[Ee]=e.readUint32BE(w,ae+4)}for(var Ee=0;Ee<80;Ee++){var xe=I,de=A,be=U,K=j,W=$,B=T,g=O,L=P,le=x,pe=d,Oe=_,Ke=H,Ze=F,ke=V,St=se,Ot=ce;if(D=P,N=ce,Y=N&65535,Z=N>>>16,Q=D&65535,ie=D>>>16,D=($>>>14|F<<32-14)^($>>>18|F<<32-18)^(F>>>41-32|$<<32-(41-32)),N=(F>>>14|$<<32-14)^(F>>>18|$<<32-18)^($>>>41-32|F<<32-(41-32)),Y+=N&65535,Z+=N>>>16,Q+=D&65535,ie+=D>>>16,D=$&T^~$&O,N=F&V^~F&se,Y+=N&65535,Z+=N>>>16,Q+=D&65535,ie+=D>>>16,D=i[Ee*2],N=i[Ee*2+1],Y+=N&65535,Z+=N>>>16,Q+=D&65535,ie+=D>>>16,D=u[Ee%16],N=f[Ee%16],Y+=N&65535,Z+=N>>>16,Q+=D&65535,ie+=D>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,X=Q&65535|ie<<16,ee=Y&65535|Z<<16,D=X,N=ee,Y=N&65535,Z=N>>>16,Q=D&65535,ie=D>>>16,D=(I>>>28|x<<32-28)^(x>>>34-32|I<<32-(34-32))^(x>>>39-32|I<<32-(39-32)),N=(x>>>28|I<<32-28)^(I>>>34-32|x<<32-(34-32))^(I>>>39-32|x<<32-(39-32)),Y+=N&65535,Z+=N>>>16,Q+=D&65535,ie+=D>>>16,D=I&A^I&U^A&U,N=x&d^x&_^d&_,Y+=N&65535,Z+=N>>>16,Q+=D&65535,ie+=D>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,L=Q&65535|ie<<16,Ot=Y&65535|Z<<16,D=K,N=Ke,Y=N&65535,Z=N>>>16,Q=D&65535,ie=D>>>16,D=X,N=ee,Y+=N&65535,Z+=N>>>16,Q+=D&65535,ie+=D>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,K=Q&65535|ie<<16,Ke=Y&65535|Z<<16,A=xe,U=de,j=be,$=K,T=W,O=B,P=g,I=L,d=le,_=pe,H=Oe,F=Ke,V=Ze,se=ke,ce=St,x=Ot,Ee%16===15)for(var ae=0;ae<16;ae++)D=u[ae],N=f[ae],Y=N&65535,Z=N>>>16,Q=D&65535,ie=D>>>16,D=u[(ae+9)%16],N=f[(ae+9)%16],Y+=N&65535,Z+=N>>>16,Q+=D&65535,ie+=D>>>16,X=u[(ae+1)%16],ee=f[(ae+1)%16],D=(X>>>1|ee<<32-1)^(X>>>8|ee<<32-8)^X>>>7,N=(ee>>>1|X<<32-1)^(ee>>>8|X<<32-8)^(ee>>>7|X<<32-7),Y+=N&65535,Z+=N>>>16,Q+=D&65535,ie+=D>>>16,X=u[(ae+14)%16],ee=f[(ae+14)%16],D=(X>>>19|ee<<32-19)^(ee>>>61-32|X<<32-(61-32))^X>>>6,N=(ee>>>19|X<<32-19)^(X>>>61-32|ee<<32-(61-32))^(ee>>>6|X<<32-6),Y+=N&65535,Z+=N>>>16,Q+=D&65535,ie+=D>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,u[ae]=Q&65535|ie<<16,f[ae]=Y&65535|Z<<16}D=I,N=x,Y=N&65535,Z=N>>>16,Q=D&65535,ie=D>>>16,D=h[0],N=m[0],Y+=N&65535,Z+=N>>>16,Q+=D&65535,ie+=D>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,h[0]=I=Q&65535|ie<<16,m[0]=x=Y&65535|Z<<16,D=A,N=d,Y=N&65535,Z=N>>>16,Q=D&65535,ie=D>>>16,D=h[1],N=m[1],Y+=N&65535,Z+=N>>>16,Q+=D&65535,ie+=D>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,h[1]=A=Q&65535|ie<<16,m[1]=d=Y&65535|Z<<16,D=U,N=_,Y=N&65535,Z=N>>>16,Q=D&65535,ie=D>>>16,D=h[2],N=m[2],Y+=N&65535,Z+=N>>>16,Q+=D&65535,ie+=D>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,h[2]=U=Q&65535|ie<<16,m[2]=_=Y&65535|Z<<16,D=j,N=H,Y=N&65535,Z=N>>>16,Q=D&65535,ie=D>>>16,D=h[3],N=m[3],Y+=N&65535,Z+=N>>>16,Q+=D&65535,ie+=D>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,h[3]=j=Q&65535|ie<<16,m[3]=H=Y&65535|Z<<16,D=$,N=F,Y=N&65535,Z=N>>>16,Q=D&65535,ie=D>>>16,D=h[4],N=m[4],Y+=N&65535,Z+=N>>>16,Q+=D&65535,ie+=D>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,h[4]=$=Q&65535|ie<<16,m[4]=F=Y&65535|Z<<16,D=T,N=V,Y=N&65535,Z=N>>>16,Q=D&65535,ie=D>>>16,D=h[5],N=m[5],Y+=N&65535,Z+=N>>>16,Q+=D&65535,ie+=D>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,h[5]=T=Q&65535|ie<<16,m[5]=V=Y&65535|Z<<16,D=O,N=se,Y=N&65535,Z=N>>>16,Q=D&65535,ie=D>>>16,D=h[6],N=m[6],Y+=N&65535,Z+=N>>>16,Q+=D&65535,ie+=D>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,h[6]=O=Q&65535|ie<<16,m[6]=se=Y&65535|Z<<16,D=P,N=ce,Y=N&65535,Z=N>>>16,Q=D&65535,ie=D>>>16,D=h[7],N=m[7],Y+=N&65535,Z+=N>>>16,Q+=D&65535,ie+=D>>>16,Z+=Y>>>16,Q+=Z>>>16,ie+=Q>>>16,h[7]=P=Q&65535|ie<<16,m[7]=ce=Y&65535|Z<<16,y+=128,b-=128}return y}function c(u){var f=new n;f.update(u);var h=f.digest();return f.clean(),h}r.hash=c})(z0),function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertSecretKeyToX25519=r.convertPublicKeyToX25519=r.verify=r.sign=r.extractPublicKeyFromSecretKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.SEED_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=r.SIGNATURE_LENGTH=void 0;const e=Es,t=z0,n=Br;r.SIGNATURE_LENGTH=64,r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=64,r.SEED_LENGTH=32;function i(K){const W=new Float64Array(16);if(K)for(let B=0;B<K.length;B++)W[B]=K[B];return W}const a=new Uint8Array(32);a[0]=9;const c=i(),u=i([1]),f=i([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),h=i([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),m=i([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),w=i([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),y=i([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function b(K,W){for(let B=0;B<16;B++)K[B]=W[B]|0}function I(K){let W=1;for(let B=0;B<16;B++){let g=K[B]+W+65535;W=Math.floor(g/65536),K[B]=g-W*65536}K[0]+=W-1+37*(W-1)}function A(K,W,B){const g=~(B-1);for(let L=0;L<16;L++){const le=g&(K[L]^W[L]);K[L]^=le,W[L]^=le}}function U(K,W){const B=i(),g=i();for(let L=0;L<16;L++)g[L]=W[L];I(g),I(g),I(g);for(let L=0;L<2;L++){B[0]=g[0]-65517;for(let pe=1;pe<15;pe++)B[pe]=g[pe]-65535-(B[pe-1]>>16&1),B[pe-1]&=65535;B[15]=g[15]-32767-(B[14]>>16&1);const le=B[15]>>16&1;B[14]&=65535,A(g,B,1-le)}for(let L=0;L<16;L++)K[2*L]=g[L]&255,K[2*L+1]=g[L]>>8}function j(K,W){let B=0;for(let g=0;g<32;g++)B|=K[g]^W[g];return(1&B-1>>>8)-1}function $(K,W){const B=new Uint8Array(32),g=new Uint8Array(32);return U(B,K),U(g,W),j(B,g)}function T(K){const W=new Uint8Array(32);return U(W,K),W[0]&1}function O(K,W){for(let B=0;B<16;B++)K[B]=W[2*B]+(W[2*B+1]<<8);K[15]&=32767}function P(K,W,B){for(let g=0;g<16;g++)K[g]=W[g]+B[g]}function x(K,W,B){for(let g=0;g<16;g++)K[g]=W[g]-B[g]}function d(K,W,B){let g,L,le=0,pe=0,Oe=0,Ke=0,Ze=0,ke=0,St=0,Ot=0,qe=0,Ce=0,Ue=0,je=0,He=0,Ae=0,Fe=0,Se=0,Te=0,Ve=0,$e=0,Je=0,Xe=0,ot=0,at=0,rt=0,xr=0,Nr=0,An=0,Ir=0,Gn=0,Ii=0,as=0,Lt=B[0],Ct=B[1],Mt=B[2],Ut=B[3],Tt=B[4],$t=B[5],Vt=B[6],Gt=B[7],jt=B[8],Yt=B[9],Ft=B[10],qt=B[11],Bt=B[12],_t=B[13],Zt=B[14],Jt=B[15];g=W[0],le+=g*Lt,pe+=g*Ct,Oe+=g*Mt,Ke+=g*Ut,Ze+=g*Tt,ke+=g*$t,St+=g*Vt,Ot+=g*Gt,qe+=g*jt,Ce+=g*Yt,Ue+=g*Ft,je+=g*qt,He+=g*Bt,Ae+=g*_t,Fe+=g*Zt,Se+=g*Jt,g=W[1],pe+=g*Lt,Oe+=g*Ct,Ke+=g*Mt,Ze+=g*Ut,ke+=g*Tt,St+=g*$t,Ot+=g*Vt,qe+=g*Gt,Ce+=g*jt,Ue+=g*Yt,je+=g*Ft,He+=g*qt,Ae+=g*Bt,Fe+=g*_t,Se+=g*Zt,Te+=g*Jt,g=W[2],Oe+=g*Lt,Ke+=g*Ct,Ze+=g*Mt,ke+=g*Ut,St+=g*Tt,Ot+=g*$t,qe+=g*Vt,Ce+=g*Gt,Ue+=g*jt,je+=g*Yt,He+=g*Ft,Ae+=g*qt,Fe+=g*Bt,Se+=g*_t,Te+=g*Zt,Ve+=g*Jt,g=W[3],Ke+=g*Lt,Ze+=g*Ct,ke+=g*Mt,St+=g*Ut,Ot+=g*Tt,qe+=g*$t,Ce+=g*Vt,Ue+=g*Gt,je+=g*jt,He+=g*Yt,Ae+=g*Ft,Fe+=g*qt,Se+=g*Bt,Te+=g*_t,Ve+=g*Zt,$e+=g*Jt,g=W[4],Ze+=g*Lt,ke+=g*Ct,St+=g*Mt,Ot+=g*Ut,qe+=g*Tt,Ce+=g*$t,Ue+=g*Vt,je+=g*Gt,He+=g*jt,Ae+=g*Yt,Fe+=g*Ft,Se+=g*qt,Te+=g*Bt,Ve+=g*_t,$e+=g*Zt,Je+=g*Jt,g=W[5],ke+=g*Lt,St+=g*Ct,Ot+=g*Mt,qe+=g*Ut,Ce+=g*Tt,Ue+=g*$t,je+=g*Vt,He+=g*Gt,Ae+=g*jt,Fe+=g*Yt,Se+=g*Ft,Te+=g*qt,Ve+=g*Bt,$e+=g*_t,Je+=g*Zt,Xe+=g*Jt,g=W[6],St+=g*Lt,Ot+=g*Ct,qe+=g*Mt,Ce+=g*Ut,Ue+=g*Tt,je+=g*$t,He+=g*Vt,Ae+=g*Gt,Fe+=g*jt,Se+=g*Yt,Te+=g*Ft,Ve+=g*qt,$e+=g*Bt,Je+=g*_t,Xe+=g*Zt,ot+=g*Jt,g=W[7],Ot+=g*Lt,qe+=g*Ct,Ce+=g*Mt,Ue+=g*Ut,je+=g*Tt,He+=g*$t,Ae+=g*Vt,Fe+=g*Gt,Se+=g*jt,Te+=g*Yt,Ve+=g*Ft,$e+=g*qt,Je+=g*Bt,Xe+=g*_t,ot+=g*Zt,at+=g*Jt,g=W[8],qe+=g*Lt,Ce+=g*Ct,Ue+=g*Mt,je+=g*Ut,He+=g*Tt,Ae+=g*$t,Fe+=g*Vt,Se+=g*Gt,Te+=g*jt,Ve+=g*Yt,$e+=g*Ft,Je+=g*qt,Xe+=g*Bt,ot+=g*_t,at+=g*Zt,rt+=g*Jt,g=W[9],Ce+=g*Lt,Ue+=g*Ct,je+=g*Mt,He+=g*Ut,Ae+=g*Tt,Fe+=g*$t,Se+=g*Vt,Te+=g*Gt,Ve+=g*jt,$e+=g*Yt,Je+=g*Ft,Xe+=g*qt,ot+=g*Bt,at+=g*_t,rt+=g*Zt,xr+=g*Jt,g=W[10],Ue+=g*Lt,je+=g*Ct,He+=g*Mt,Ae+=g*Ut,Fe+=g*Tt,Se+=g*$t,Te+=g*Vt,Ve+=g*Gt,$e+=g*jt,Je+=g*Yt,Xe+=g*Ft,ot+=g*qt,at+=g*Bt,rt+=g*_t,xr+=g*Zt,Nr+=g*Jt,g=W[11],je+=g*Lt,He+=g*Ct,Ae+=g*Mt,Fe+=g*Ut,Se+=g*Tt,Te+=g*$t,Ve+=g*Vt,$e+=g*Gt,Je+=g*jt,Xe+=g*Yt,ot+=g*Ft,at+=g*qt,rt+=g*Bt,xr+=g*_t,Nr+=g*Zt,An+=g*Jt,g=W[12],He+=g*Lt,Ae+=g*Ct,Fe+=g*Mt,Se+=g*Ut,Te+=g*Tt,Ve+=g*$t,$e+=g*Vt,Je+=g*Gt,Xe+=g*jt,ot+=g*Yt,at+=g*Ft,rt+=g*qt,xr+=g*Bt,Nr+=g*_t,An+=g*Zt,Ir+=g*Jt,g=W[13],Ae+=g*Lt,Fe+=g*Ct,Se+=g*Mt,Te+=g*Ut,Ve+=g*Tt,$e+=g*$t,Je+=g*Vt,Xe+=g*Gt,ot+=g*jt,at+=g*Yt,rt+=g*Ft,xr+=g*qt,Nr+=g*Bt,An+=g*_t,Ir+=g*Zt,Gn+=g*Jt,g=W[14],Fe+=g*Lt,Se+=g*Ct,Te+=g*Mt,Ve+=g*Ut,$e+=g*Tt,Je+=g*$t,Xe+=g*Vt,ot+=g*Gt,at+=g*jt,rt+=g*Yt,xr+=g*Ft,Nr+=g*qt,An+=g*Bt,Ir+=g*_t,Gn+=g*Zt,Ii+=g*Jt,g=W[15],Se+=g*Lt,Te+=g*Ct,Ve+=g*Mt,$e+=g*Ut,Je+=g*Tt,Xe+=g*$t,ot+=g*Vt,at+=g*Gt,rt+=g*jt,xr+=g*Yt,Nr+=g*Ft,An+=g*qt,Ir+=g*Bt,Gn+=g*_t,Ii+=g*Zt,as+=g*Jt,le+=38*Te,pe+=38*Ve,Oe+=38*$e,Ke+=38*Je,Ze+=38*Xe,ke+=38*ot,St+=38*at,Ot+=38*rt,qe+=38*xr,Ce+=38*Nr,Ue+=38*An,je+=38*Ir,He+=38*Gn,Ae+=38*Ii,Fe+=38*as,L=1,g=le+L+65535,L=Math.floor(g/65536),le=g-L*65536,g=pe+L+65535,L=Math.floor(g/65536),pe=g-L*65536,g=Oe+L+65535,L=Math.floor(g/65536),Oe=g-L*65536,g=Ke+L+65535,L=Math.floor(g/65536),Ke=g-L*65536,g=Ze+L+65535,L=Math.floor(g/65536),Ze=g-L*65536,g=ke+L+65535,L=Math.floor(g/65536),ke=g-L*65536,g=St+L+65535,L=Math.floor(g/65536),St=g-L*65536,g=Ot+L+65535,L=Math.floor(g/65536),Ot=g-L*65536,g=qe+L+65535,L=Math.floor(g/65536),qe=g-L*65536,g=Ce+L+65535,L=Math.floor(g/65536),Ce=g-L*65536,g=Ue+L+65535,L=Math.floor(g/65536),Ue=g-L*65536,g=je+L+65535,L=Math.floor(g/65536),je=g-L*65536,g=He+L+65535,L=Math.floor(g/65536),He=g-L*65536,g=Ae+L+65535,L=Math.floor(g/65536),Ae=g-L*65536,g=Fe+L+65535,L=Math.floor(g/65536),Fe=g-L*65536,g=Se+L+65535,L=Math.floor(g/65536),Se=g-L*65536,le+=L-1+37*(L-1),L=1,g=le+L+65535,L=Math.floor(g/65536),le=g-L*65536,g=pe+L+65535,L=Math.floor(g/65536),pe=g-L*65536,g=Oe+L+65535,L=Math.floor(g/65536),Oe=g-L*65536,g=Ke+L+65535,L=Math.floor(g/65536),Ke=g-L*65536,g=Ze+L+65535,L=Math.floor(g/65536),Ze=g-L*65536,g=ke+L+65535,L=Math.floor(g/65536),ke=g-L*65536,g=St+L+65535,L=Math.floor(g/65536),St=g-L*65536,g=Ot+L+65535,L=Math.floor(g/65536),Ot=g-L*65536,g=qe+L+65535,L=Math.floor(g/65536),qe=g-L*65536,g=Ce+L+65535,L=Math.floor(g/65536),Ce=g-L*65536,g=Ue+L+65535,L=Math.floor(g/65536),Ue=g-L*65536,g=je+L+65535,L=Math.floor(g/65536),je=g-L*65536,g=He+L+65535,L=Math.floor(g/65536),He=g-L*65536,g=Ae+L+65535,L=Math.floor(g/65536),Ae=g-L*65536,g=Fe+L+65535,L=Math.floor(g/65536),Fe=g-L*65536,g=Se+L+65535,L=Math.floor(g/65536),Se=g-L*65536,le+=L-1+37*(L-1),K[0]=le,K[1]=pe,K[2]=Oe,K[3]=Ke,K[4]=Ze,K[5]=ke,K[6]=St,K[7]=Ot,K[8]=qe,K[9]=Ce,K[10]=Ue,K[11]=je,K[12]=He,K[13]=Ae,K[14]=Fe,K[15]=Se}function _(K,W){d(K,W,W)}function H(K,W){const B=i();let g;for(g=0;g<16;g++)B[g]=W[g];for(g=253;g>=0;g--)_(B,B),g!==2&&g!==4&&d(B,B,W);for(g=0;g<16;g++)K[g]=B[g]}function F(K,W){const B=i();let g;for(g=0;g<16;g++)B[g]=W[g];for(g=250;g>=0;g--)_(B,B),g!==1&&d(B,B,W);for(g=0;g<16;g++)K[g]=B[g]}function V(K,W){const B=i(),g=i(),L=i(),le=i(),pe=i(),Oe=i(),Ke=i(),Ze=i(),ke=i();x(B,K[1],K[0]),x(ke,W[1],W[0]),d(B,B,ke),P(g,K[0],K[1]),P(ke,W[0],W[1]),d(g,g,ke),d(L,K[3],W[3]),d(L,L,h),d(le,K[2],W[2]),P(le,le,le),x(pe,g,B),x(Oe,le,L),P(Ke,le,L),P(Ze,g,B),d(K[0],pe,Oe),d(K[1],Ze,Ke),d(K[2],Ke,Oe),d(K[3],pe,Ze)}function se(K,W,B){for(let g=0;g<4;g++)A(K[g],W[g],B)}function ce(K,W){const B=i(),g=i(),L=i();H(L,W[2]),d(B,W[0],L),d(g,W[1],L),U(K,g),K[31]^=T(B)<<7}function D(K,W,B){b(K[0],c),b(K[1],u),b(K[2],u),b(K[3],c);for(let g=255;g>=0;--g){const L=B[g/8|0]>>(g&7)&1;se(K,W,L),V(W,K),V(K,K),se(K,W,L)}}function N(K,W){const B=[i(),i(),i(),i()];b(B[0],m),b(B[1],w),b(B[2],u),d(B[3],m,w),D(K,B,W)}function X(K){if(K.length!==r.SEED_LENGTH)throw new Error(`ed25519: seed must be ${r.SEED_LENGTH} bytes`);const W=(0,t.hash)(K);W[0]&=248,W[31]&=127,W[31]|=64;const B=new Uint8Array(32),g=[i(),i(),i(),i()];N(g,W),ce(B,g);const L=new Uint8Array(64);return L.set(K),L.set(B,32),{publicKey:B,secretKey:L}}r.generateKeyPairFromSeed=X;function ee(K){const W=(0,e.randomBytes)(32,K),B=X(W);return(0,n.wipe)(W),B}r.generateKeyPair=ee;function Y(K){if(K.length!==r.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${r.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(K.subarray(32))}r.extractPublicKeyFromSecretKey=Y;const Z=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Q(K,W){let B,g,L,le;for(g=63;g>=32;--g){for(B=0,L=g-32,le=g-12;L<le;++L)W[L]+=B-16*W[g]*Z[L-(g-32)],B=Math.floor((W[L]+128)/256),W[L]-=B*256;W[L]+=B,W[g]=0}for(B=0,L=0;L<32;L++)W[L]+=B-(W[31]>>4)*Z[L],B=W[L]>>8,W[L]&=255;for(L=0;L<32;L++)W[L]-=B*Z[L];for(g=0;g<32;g++)W[g+1]+=W[g]>>8,K[g]=W[g]&255}function ie(K){const W=new Float64Array(64);for(let B=0;B<64;B++)W[B]=K[B];for(let B=0;B<64;B++)K[B]=0;Q(K,W)}function Ee(K,W){const B=new Float64Array(64),g=[i(),i(),i(),i()],L=(0,t.hash)(K.subarray(0,32));L[0]&=248,L[31]&=127,L[31]|=64;const le=new Uint8Array(64);le.set(L.subarray(32),32);const pe=new t.SHA512;pe.update(le.subarray(32)),pe.update(W);const Oe=pe.digest();pe.clean(),ie(Oe),N(g,Oe),ce(le,g),pe.reset(),pe.update(le.subarray(0,32)),pe.update(K.subarray(32)),pe.update(W);const Ke=pe.digest();ie(Ke);for(let Ze=0;Ze<32;Ze++)B[Ze]=Oe[Ze];for(let Ze=0;Ze<32;Ze++)for(let ke=0;ke<32;ke++)B[Ze+ke]+=Ke[Ze]*L[ke];return Q(le.subarray(32),B),le}r.sign=Ee;function ae(K,W){const B=i(),g=i(),L=i(),le=i(),pe=i(),Oe=i(),Ke=i();return b(K[2],u),O(K[1],W),_(L,K[1]),d(le,L,f),x(L,L,K[2]),P(le,K[2],le),_(pe,le),_(Oe,pe),d(Ke,Oe,pe),d(B,Ke,L),d(B,B,le),F(B,B),d(B,B,L),d(B,B,le),d(B,B,le),d(K[0],B,le),_(g,K[0]),d(g,g,le),$(g,L)&&d(K[0],K[0],y),_(g,K[0]),d(g,g,le),$(g,L)?-1:(T(K[0])===W[31]>>7&&x(K[0],c,K[0]),d(K[3],K[0],K[1]),0)}function xe(K,W,B){const g=new Uint8Array(32),L=[i(),i(),i(),i()],le=[i(),i(),i(),i()];if(B.length!==r.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${r.SIGNATURE_LENGTH} bytes`);if(ae(le,K))return!1;const pe=new t.SHA512;pe.update(B.subarray(0,32)),pe.update(K),pe.update(W);const Oe=pe.digest();return ie(Oe),D(L,le,Oe),N(le,B.subarray(32)),V(L,le),ce(g,L),!j(B,g)}r.verify=xe;function de(K){let W=[i(),i(),i(),i()];if(ae(W,K))throw new Error("Ed25519: invalid public key");let B=i(),g=i(),L=W[1];P(B,u,L),x(g,u,L),H(g,g),d(B,B,g);let le=new Uint8Array(32);return U(le,B),le}r.convertPublicKeyToX25519=de;function be(K){const W=(0,t.hash)(K.subarray(0,32));W[0]&=248,W[31]&=127,W[31]|=64;const B=new Uint8Array(W.subarray(0,32));return(0,n.wipe)(W),B}r.convertSecretKeyToX25519=be}(Ru);const oE="EdDSA",aE="JWT",q0=".",H0="base64url",cE="utf8",lE="utf8",uE=":",hE="did",fE="key",W0="base58btc",dE="z",pE="K36",gE=32;function Qa(r){return vr($r(Mn(r),cE),H0)}function K0(r){const e=$r(pE,W0),t=dE+vr(Zl([e,r]),W0);return[hE,fE,t].join(uE)}function mE(r){return vr(r,H0)}function vE(r){return $r([Qa(r.header),Qa(r.payload)].join(q0),lE)}function yE(r){return[Qa(r.header),Qa(r.payload),mE(r.signature)].join(q0)}function V0(r=Es.randomBytes(gE)){return Ru.generateKeyPairFromSeed(r)}async function wE(r,e,t,n,i=me.fromMiliseconds(Date.now())){const a={alg:oE,typ:aE},c=K0(n.publicKey),u=i+t,f={iss:c,sub:r,aud:e,iat:i,exp:u},h=vE({header:a,payload:f}),m=Ru.sign(n.secretKey,h);return yE({header:a,payload:f,signature:m})}const bE="PARSE_ERROR",_E="INVALID_REQUEST",EE="METHOD_NOT_FOUND",xE="INVALID_PARAMS",G0="INTERNAL_ERROR",Nu="SERVER_ERROR",IE=[-32700,-32600,-32601,-32602,-32603],Fo={[bE]:{code:-32700,message:"Parse error"},[_E]:{code:-32600,message:"Invalid Request"},[EE]:{code:-32601,message:"Method not found"},[xE]:{code:-32602,message:"Invalid params"},[G0]:{code:-32603,message:"Internal error"},[Nu]:{code:-32e3,message:"Server error"}},Y0=Nu;function DE(r){return IE.includes(r)}function Z0(r){return Object.keys(Fo).includes(r)?Fo[r]:Fo[Y0]}function SE(r){const e=Object.values(Fo).find(t=>t.code===r);return e||Fo[Y0]}function J0(r,e,t){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${t} RPC url at ${e}`):r}var Q0={};/*! *****************************************************************************
|
|
34
34
|
Copyright (c) Microsoft Corporation.
|
|
35
35
|
|
|
36
36
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
44
44
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
45
45
|
PERFORMANCE OF THIS SOFTWARE.
|
|
46
|
-
***************************************************************************** */var _u=function(r,e){return _u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},_u(r,e)};function y5(r,e){_u(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Eu=function(){return Eu=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},Eu.apply(this,arguments)};function w5(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function b5(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var u=r.length-1;u>=0;u--)(c=r[u])&&(a=(i<3?c(a):i>3?c(e,t,a):c(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a}function _5(r,e){return function(t,n){e(t,n,r)}}function E5(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function x5(r,e,t,n){function i(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function u(m){try{h(n.next(m))}catch(w){c(w)}}function f(m){try{h(n.throw(m))}catch(w){c(w)}}function h(m){m.done?a(m.value):i(m.value).then(u,f)}h((n=n.apply(r,e||[])).next())})}function I5(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,c;return c={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(h){return function(m){return f([h,m])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(a=h[0]&2?i.return:h[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,h[1])).done)return a;switch(i=0,a&&(h=[h[0]&2,a.value]),h[0]){case 0:case 1:a=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,i=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!a||h[1]>a[0]&&h[1]<a[3])){t.label=h[1];break}if(h[0]===6&&t.label<a[1]){t.label=a[1],a=h;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(h);break}a[2]&&t.ops.pop(),t.trys.pop();continue}h=e.call(r,t)}catch(m){h=[6,m],i=0}finally{n=a=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function D5(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}function S5(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function xu(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Dp(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,a=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(u){c={error:u}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(c)throw c.error}}return a}function C5(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(Dp(arguments[e]));return r}function O5(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),i=0,e=0;e<t;e++)for(var a=arguments[e],c=0,u=a.length;c<u;c++,i++)n[i]=a[c];return n}function $o(r){return this instanceof $o?(this.v=r,this):new $o(r)}function $5(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(y){n[y]&&(i[y]=function(x){return new Promise(function(S,P){a.push([y,x,S,P])>1||u(y,x)})})}function u(y,x){try{f(n[y](x))}catch(S){w(a[0][3],S)}}function f(y){y.value instanceof $o?Promise.resolve(y.value.v).then(h,m):w(a[0][2],y)}function h(y){u("next",y)}function m(y){u("throw",y)}function w(y,x){y(x),a.shift(),a.length&&u(a[0][0],a[0][1])}}function A5(r){var e,t;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,a){e[i]=r[i]?function(c){return(t=!t)?{value:$o(r[i](c)),done:i==="return"}:a?a(c):c}:a}}function P5(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof xu=="function"?xu(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(c){return new Promise(function(u,f){c=r[a](c),i(u,f,c.done,c.value)})}}function i(a,c,u,f){Promise.resolve(f).then(function(h){a({value:h,done:u})},c)}}function T5(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function R5(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function N5(r){return r&&r.__esModule?r:{default:r}}function L5(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function M5(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var U5=Object.freeze({__proto__:null,__extends:y5,get __assign(){return Eu},__rest:w5,__decorate:b5,__param:_5,__metadata:E5,__awaiter:x5,__generator:I5,__createBinding:D5,__exportStar:S5,__values:xu,__read:Dp,__spread:C5,__spreadArrays:O5,__await:$o,__asyncGenerator:$5,__asyncDelegator:A5,__asyncValues:P5,__makeTemplateObject:T5,__importStar:R5,__importDefault:N5,__classPrivateFieldGet:L5,__classPrivateFieldSet:M5}),j5=Pi(U5),Iu,Sp;function F5(){if(Sp)return Iu;Sp=1;function r(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}Iu=e;function e(t,n,i){var a=i&&i.stringify||r,c=1;if(typeof t=="object"&&t!==null){var u=n.length+c;if(u===1)return t;var f=new Array(u);f[0]=a(t);for(var h=1;h<u;h++)f[h]=a(n[h]);return f.join(" ")}if(typeof t!="string")return t;var m=n.length;if(m===0)return t;for(var w="",y=1-c,x=-1,S=t&&t.length||0,P=0;P<S;){if(t.charCodeAt(P)===37&&P+1<S){switch(x=x>-1?x:0,t.charCodeAt(P+1)){case 100:case 102:if(y>=m||n[y]==null)break;x<P&&(w+=t.slice(x,P)),w+=Number(n[y]),x=P+2,P++;break;case 105:if(y>=m||n[y]==null)break;x<P&&(w+=t.slice(x,P)),w+=Math.floor(Number(n[y])),x=P+2,P++;break;case 79:case 111:case 106:if(y>=m||n[y]===void 0)break;x<P&&(w+=t.slice(x,P));var U=typeof n[y];if(U==="string"){w+="'"+n[y]+"'",x=P+2,P++;break}if(U==="function"){w+=n[y].name||"<anonymous>",x=P+2,P++;break}w+=a(n[y]),x=P+2,P++;break;case 115:if(y>=m)break;x<P&&(w+=t.slice(x,P)),w+=String(n[y]),x=P+2,P++;break;case 37:x<P&&(w+=t.slice(x,P)),w+="%",x=P+2,P++,y--;break}++y}++P}return x===-1?t:(x<S&&(w+=t.slice(x)),w)}return Iu}var Du,Cp;function B5(){if(Cp)return Du;Cp=1;const r=F5();Du=i;const e=$().console||{},t={mapHttpRequest:S,mapHttpResponse:S,wrapRequestSerializer:P,wrapResponseSerializer:P,wrapErrorSerializer:P,req:S,res:S,err:y};function n(E,d){return Array.isArray(E)?E.filter(function(H){return H!=="!stdSerializers.err"}):E===!0?Object.keys(d):!1}function i(E){E=E||{},E.browser=E.browser||{};const d=E.browser.transmit;if(d&&typeof d.send!="function")throw Error("pino: transmit option must have a send function");const b=E.browser.write||e;E.browser.write&&(E.browser.asObject=!0);const H=E.serializers||{},F=n(E.browser.serialize,H);let V=E.browser.serialize;Array.isArray(E.browser.serialize)&&E.browser.serialize.indexOf("!stdSerializers.err")>-1&&(V=!1);const se=["error","fatal","warn","info","debug","trace"];typeof b=="function"&&(b.error=b.fatal=b.warn=b.info=b.debug=b.trace=b),E.enabled===!1&&(E.level="silent");const ce=E.level||"info",I=Object.create(b);I.log||(I.log=U),Object.defineProperty(I,"levelVal",{get:X}),Object.defineProperty(I,"level",{get:ee,set:Y});const N={transmit:d,serialize:F,asObject:E.browser.asObject,levels:se,timestamp:x(E)};I.levels=i.levels,I.level=ce,I.setMaxListeners=I.getMaxListeners=I.emit=I.addListener=I.on=I.prependListener=I.once=I.prependOnceListener=I.removeListener=I.removeAllListeners=I.listeners=I.listenerCount=I.eventNames=I.write=I.flush=U,I.serializers=H,I._serialize=F,I._stdErrSerialize=V,I.child=J,d&&(I._logEvent=w());function X(){return this.level==="silent"?1/0:this.levels.values[this.level]}function ee(){return this._level}function Y(Q){if(Q!=="silent"&&!this.levels.values[Q])throw Error("unknown level "+Q);this._level=Q,a(N,I,"error","log"),a(N,I,"fatal","error"),a(N,I,"warn","error"),a(N,I,"info","log"),a(N,I,"debug","log"),a(N,I,"trace","log")}function J(Q,ie){if(!Q)throw new Error("missing bindings for child Pino");ie=ie||{},F&&Q.serializers&&(ie.serializers=Q.serializers);const Ee=ie.serializers;if(F&&Ee){var ae=Object.assign({},H,Ee),xe=E.browser.serialize===!0?Object.keys(ae):F;delete Q.serializers,f([Q],xe,ae,this._stdErrSerialize)}function de(be){this._childLevel=(be._childLevel|0)+1,this.error=h(be,Q,"error"),this.fatal=h(be,Q,"fatal"),this.warn=h(be,Q,"warn"),this.info=h(be,Q,"info"),this.debug=h(be,Q,"debug"),this.trace=h(be,Q,"trace"),ae&&(this.serializers=ae,this._serialize=xe),d&&(this._logEvent=w([].concat(be._logEvent.bindings,Q)))}return de.prototype=this,new de(this)}return I}i.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},i.stdSerializers=t,i.stdTimeFunctions=Object.assign({},{nullTime:j,epochTime:A,unixTime:T,isoTime:C});function a(E,d,b,H){const F=Object.getPrototypeOf(d);d[b]=d.levelVal>d.levels.values[b]?U:F[b]?F[b]:e[b]||e[H]||U,c(E,d,b)}function c(E,d,b){!E.transmit&&d[b]===U||(d[b]=function(H){return function(){const V=E.timestamp(),se=new Array(arguments.length),ce=Object.getPrototypeOf&&Object.getPrototypeOf(this)===e?e:this;for(var I=0;I<se.length;I++)se[I]=arguments[I];if(E.serialize&&!E.asObject&&f(se,this._serialize,this.serializers,this._stdErrSerialize),E.asObject?H.call(ce,u(this,b,se,V)):H.apply(ce,se),E.transmit){const N=E.transmit.level||d.level,X=i.levels.values[N],ee=i.levels.values[b];if(ee<X)return;m(this,{ts:V,methodLevel:b,methodValue:ee,transmitLevel:N,transmitValue:i.levels.values[E.transmit.level||d.level],send:E.transmit.send,val:d.levelVal},se)}}}(d[b]))}function u(E,d,b,H){E._serialize&&f(b,E._serialize,E.serializers,E._stdErrSerialize);const F=b.slice();let V=F[0];const se={};H&&(se.time=H),se.level=i.levels.values[d];let ce=(E._childLevel|0)+1;if(ce<1&&(ce=1),V!==null&&typeof V=="object"){for(;ce--&&typeof F[0]=="object";)Object.assign(se,F.shift());V=F.length?r(F.shift(),F):void 0}else typeof V=="string"&&(V=r(F.shift(),F));return V!==void 0&&(se.msg=V),se}function f(E,d,b,H){for(const F in E)if(H&&E[F]instanceof Error)E[F]=i.stdSerializers.err(E[F]);else if(typeof E[F]=="object"&&!Array.isArray(E[F]))for(const V in E[F])d&&d.indexOf(V)>-1&&V in b&&(E[F][V]=b[V](E[F][V]))}function h(E,d,b){return function(){const H=new Array(1+arguments.length);H[0]=d;for(var F=1;F<H.length;F++)H[F]=arguments[F-1];return E[b].apply(this,H)}}function m(E,d,b){const H=d.send,F=d.ts,V=d.methodLevel,se=d.methodValue,ce=d.val,I=E._logEvent.bindings;f(b,E._serialize||Object.keys(E.serializers),E.serializers,E._stdErrSerialize===void 0?!0:E._stdErrSerialize),E._logEvent.ts=F,E._logEvent.messages=b.filter(function(N){return I.indexOf(N)===-1}),E._logEvent.level.label=V,E._logEvent.level.value=se,H(V,E._logEvent,ce),E._logEvent=w(I)}function w(E){return{ts:0,messages:[],bindings:E||[],level:{label:"",value:0}}}function y(E){const d={type:E.constructor.name,msg:E.message,stack:E.stack};for(const b in E)d[b]===void 0&&(d[b]=E[b]);return d}function x(E){return typeof E.timestamp=="function"?E.timestamp:E.timestamp===!1?j:A}function S(){return{}}function P(E){return E}function U(){}function j(){return!1}function A(){return Date.now()}function T(){return Math.round(Date.now()/1e3)}function C(){return new Date(Date.now()).toISOString()}function $(){function E(d){return typeof d<"u"&&d}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return E(self)||E(window)||E(this)||{}}}return Du}var ki={},Op;function $p(){return Op||(Op=1,Object.defineProperty(ki,"__esModule",{value:!0}),ki.PINO_CUSTOM_CONTEXT_KEY=ki.PINO_LOGGER_DEFAULTS=void 0,ki.PINO_LOGGER_DEFAULTS={level:"info"},ki.PINO_CUSTOM_CONTEXT_KEY="custom_context"),ki}var Er={},Ap;function k5(){if(Ap)return Er;Ap=1,Object.defineProperty(Er,"__esModule",{value:!0}),Er.generateChildLogger=Er.formatChildLoggerContext=Er.getLoggerContext=Er.setBrowserLoggerContext=Er.getBrowserLoggerContext=Er.getDefaultLoggerOptions=void 0;const r=$p();function e(u){return Object.assign(Object.assign({},u),{level:u?.level||r.PINO_LOGGER_DEFAULTS.level})}Er.getDefaultLoggerOptions=e;function t(u,f=r.PINO_CUSTOM_CONTEXT_KEY){return u[f]||""}Er.getBrowserLoggerContext=t;function n(u,f,h=r.PINO_CUSTOM_CONTEXT_KEY){return u[h]=f,u}Er.setBrowserLoggerContext=n;function i(u,f=r.PINO_CUSTOM_CONTEXT_KEY){let h="";return typeof u.bindings>"u"?h=t(u,f):h=u.bindings().context||"",h}Er.getLoggerContext=i;function a(u,f,h=r.PINO_CUSTOM_CONTEXT_KEY){const m=i(u,h);return m.trim()?`${m}/${f}`:f}Er.formatChildLoggerContext=a;function c(u,f,h=r.PINO_CUSTOM_CONTEXT_KEY){const m=a(u,f,h),w=u.child({context:m});return n(w,m,h)}return Er.generateChildLogger=c,Er}(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.pino=void 0;const e=j5,t=e.__importDefault(B5());Object.defineProperty(r,"pino",{enumerable:!0,get:function(){return t.default}}),e.__exportStar($p(),r),e.__exportStar(k5(),r)})(Xe);class q5 extends Fi{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class z5 extends Fi{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}}class H5{constructor(e,t){this.logger=e,this.core=t}}class W5 extends Fi{constructor(e,t){super(),this.relayer=e,this.logger=t}}class K5 extends Fi{constructor(e){super()}}class V5{constructor(e,t,n,i){this.core=e,this.logger=t,this.name=n}}class G5 extends Fi{constructor(e,t){super(),this.relayer=e,this.logger=t}}class Y5 extends Fi{constructor(e,t){super(),this.core=e,this.logger=t}}class J5{constructor(e,t){this.projectId=e,this.logger=t}}class Z5{constructor(e,t){this.projectId=e,this.logger=t}}class Q5{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}class X5{constructor(e){this.client=e}}var Su={},Pp={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e=Me,t=zr;r.DIGEST_LENGTH=64,r.BLOCK_SIZE=128;var n=function(){function u(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return u.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},u.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},u.prototype.clean=function(){t.wipe(this._buffer),t.wipe(this._tempHi),t.wipe(this._tempLo),this.reset()},u.prototype.update=function(f,h){if(h===void 0&&(h=f.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var m=0;if(this._bytesHashed+=h,this._bufferLength>0){for(;this._bufferLength<r.BLOCK_SIZE&&h>0;)this._buffer[this._bufferLength++]=f[m++],h--;this._bufferLength===this.blockSize&&(a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(h>=this.blockSize&&(m=a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,f,m,h),h%=this.blockSize);h>0;)this._buffer[this._bufferLength++]=f[m++],h--;return this},u.prototype.finish=function(f){if(!this._finished){var h=this._bytesHashed,m=this._bufferLength,w=h/536870912|0,y=h<<3,x=h%128<112?128:256;this._buffer[m]=128;for(var S=m+1;S<x-8;S++)this._buffer[S]=0;e.writeUint32BE(w,this._buffer,x-8),e.writeUint32BE(y,this._buffer,x-4),a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,x),this._finished=!0}for(var S=0;S<this.digestLength/8;S++)e.writeUint32BE(this._stateHi[S],f,S*8),e.writeUint32BE(this._stateLo[S],f,S*8+4);return this},u.prototype.digest=function(){var f=new Uint8Array(this.digestLength);return this.finish(f),f},u.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},u.prototype.restoreState=function(f){return this._stateHi.set(f.stateHi),this._stateLo.set(f.stateLo),this._bufferLength=f.bufferLength,f.buffer&&this._buffer.set(f.buffer),this._bytesHashed=f.bytesHashed,this._finished=!1,this},u.prototype.cleanSavedState=function(f){t.wipe(f.stateHi),t.wipe(f.stateLo),f.buffer&&t.wipe(f.buffer),f.bufferLength=0,f.bytesHashed=0},u}();r.SHA512=n;var i=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function a(u,f,h,m,w,y,x){for(var S=h[0],P=h[1],U=h[2],j=h[3],A=h[4],T=h[5],C=h[6],$=h[7],E=m[0],d=m[1],b=m[2],H=m[3],F=m[4],V=m[5],se=m[6],ce=m[7],I,N,X,ee,Y,J,Q,ie;x>=128;){for(var Ee=0;Ee<16;Ee++){var ae=8*Ee+y;u[Ee]=e.readUint32BE(w,ae),f[Ee]=e.readUint32BE(w,ae+4)}for(var Ee=0;Ee<80;Ee++){var xe=S,de=P,be=U,K=j,W=A,B=T,g=C,L=$,le=E,pe=d,Ce=b,Ke=H,Je=F,ke=V,St=se,Ct=ce;if(I=$,N=ce,Y=N&65535,J=N>>>16,Q=I&65535,ie=I>>>16,I=(A>>>14|F<<32-14)^(A>>>18|F<<32-18)^(F>>>41-32|A<<32-(41-32)),N=(F>>>14|A<<32-14)^(F>>>18|A<<32-18)^(A>>>41-32|F<<32-(41-32)),Y+=N&65535,J+=N>>>16,Q+=I&65535,ie+=I>>>16,I=A&T^~A&C,N=F&V^~F&se,Y+=N&65535,J+=N>>>16,Q+=I&65535,ie+=I>>>16,I=i[Ee*2],N=i[Ee*2+1],Y+=N&65535,J+=N>>>16,Q+=I&65535,ie+=I>>>16,I=u[Ee%16],N=f[Ee%16],Y+=N&65535,J+=N>>>16,Q+=I&65535,ie+=I>>>16,J+=Y>>>16,Q+=J>>>16,ie+=Q>>>16,X=Q&65535|ie<<16,ee=Y&65535|J<<16,I=X,N=ee,Y=N&65535,J=N>>>16,Q=I&65535,ie=I>>>16,I=(S>>>28|E<<32-28)^(E>>>34-32|S<<32-(34-32))^(E>>>39-32|S<<32-(39-32)),N=(E>>>28|S<<32-28)^(S>>>34-32|E<<32-(34-32))^(S>>>39-32|E<<32-(39-32)),Y+=N&65535,J+=N>>>16,Q+=I&65535,ie+=I>>>16,I=S&P^S&U^P&U,N=E&d^E&b^d&b,Y+=N&65535,J+=N>>>16,Q+=I&65535,ie+=I>>>16,J+=Y>>>16,Q+=J>>>16,ie+=Q>>>16,L=Q&65535|ie<<16,Ct=Y&65535|J<<16,I=K,N=Ke,Y=N&65535,J=N>>>16,Q=I&65535,ie=I>>>16,I=X,N=ee,Y+=N&65535,J+=N>>>16,Q+=I&65535,ie+=I>>>16,J+=Y>>>16,Q+=J>>>16,ie+=Q>>>16,K=Q&65535|ie<<16,Ke=Y&65535|J<<16,P=xe,U=de,j=be,A=K,T=W,C=B,$=g,S=L,d=le,b=pe,H=Ce,F=Ke,V=Je,se=ke,ce=St,E=Ct,Ee%16===15)for(var ae=0;ae<16;ae++)I=u[ae],N=f[ae],Y=N&65535,J=N>>>16,Q=I&65535,ie=I>>>16,I=u[(ae+9)%16],N=f[(ae+9)%16],Y+=N&65535,J+=N>>>16,Q+=I&65535,ie+=I>>>16,X=u[(ae+1)%16],ee=f[(ae+1)%16],I=(X>>>1|ee<<32-1)^(X>>>8|ee<<32-8)^X>>>7,N=(ee>>>1|X<<32-1)^(ee>>>8|X<<32-8)^(ee>>>7|X<<32-7),Y+=N&65535,J+=N>>>16,Q+=I&65535,ie+=I>>>16,X=u[(ae+14)%16],ee=f[(ae+14)%16],I=(X>>>19|ee<<32-19)^(ee>>>61-32|X<<32-(61-32))^X>>>6,N=(ee>>>19|X<<32-19)^(X>>>61-32|ee<<32-(61-32))^(ee>>>6|X<<32-6),Y+=N&65535,J+=N>>>16,Q+=I&65535,ie+=I>>>16,J+=Y>>>16,Q+=J>>>16,ie+=Q>>>16,u[ae]=Q&65535|ie<<16,f[ae]=Y&65535|J<<16}I=S,N=E,Y=N&65535,J=N>>>16,Q=I&65535,ie=I>>>16,I=h[0],N=m[0],Y+=N&65535,J+=N>>>16,Q+=I&65535,ie+=I>>>16,J+=Y>>>16,Q+=J>>>16,ie+=Q>>>16,h[0]=S=Q&65535|ie<<16,m[0]=E=Y&65535|J<<16,I=P,N=d,Y=N&65535,J=N>>>16,Q=I&65535,ie=I>>>16,I=h[1],N=m[1],Y+=N&65535,J+=N>>>16,Q+=I&65535,ie+=I>>>16,J+=Y>>>16,Q+=J>>>16,ie+=Q>>>16,h[1]=P=Q&65535|ie<<16,m[1]=d=Y&65535|J<<16,I=U,N=b,Y=N&65535,J=N>>>16,Q=I&65535,ie=I>>>16,I=h[2],N=m[2],Y+=N&65535,J+=N>>>16,Q+=I&65535,ie+=I>>>16,J+=Y>>>16,Q+=J>>>16,ie+=Q>>>16,h[2]=U=Q&65535|ie<<16,m[2]=b=Y&65535|J<<16,I=j,N=H,Y=N&65535,J=N>>>16,Q=I&65535,ie=I>>>16,I=h[3],N=m[3],Y+=N&65535,J+=N>>>16,Q+=I&65535,ie+=I>>>16,J+=Y>>>16,Q+=J>>>16,ie+=Q>>>16,h[3]=j=Q&65535|ie<<16,m[3]=H=Y&65535|J<<16,I=A,N=F,Y=N&65535,J=N>>>16,Q=I&65535,ie=I>>>16,I=h[4],N=m[4],Y+=N&65535,J+=N>>>16,Q+=I&65535,ie+=I>>>16,J+=Y>>>16,Q+=J>>>16,ie+=Q>>>16,h[4]=A=Q&65535|ie<<16,m[4]=F=Y&65535|J<<16,I=T,N=V,Y=N&65535,J=N>>>16,Q=I&65535,ie=I>>>16,I=h[5],N=m[5],Y+=N&65535,J+=N>>>16,Q+=I&65535,ie+=I>>>16,J+=Y>>>16,Q+=J>>>16,ie+=Q>>>16,h[5]=T=Q&65535|ie<<16,m[5]=V=Y&65535|J<<16,I=C,N=se,Y=N&65535,J=N>>>16,Q=I&65535,ie=I>>>16,I=h[6],N=m[6],Y+=N&65535,J+=N>>>16,Q+=I&65535,ie+=I>>>16,J+=Y>>>16,Q+=J>>>16,ie+=Q>>>16,h[6]=C=Q&65535|ie<<16,m[6]=se=Y&65535|J<<16,I=$,N=ce,Y=N&65535,J=N>>>16,Q=I&65535,ie=I>>>16,I=h[7],N=m[7],Y+=N&65535,J+=N>>>16,Q+=I&65535,ie+=I>>>16,J+=Y>>>16,Q+=J>>>16,ie+=Q>>>16,h[7]=$=Q&65535|ie<<16,m[7]=ce=Y&65535|J<<16,y+=128,x-=128}return y}function c(u){var f=new n;f.update(u);var h=f.digest();return f.clean(),h}r.hash=c})(Pp),function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertSecretKeyToX25519=r.convertPublicKeyToX25519=r.verify=r.sign=r.extractPublicKeyFromSecretKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.SEED_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=r.SIGNATURE_LENGTH=void 0;const e=vs,t=Pp,n=zr;r.SIGNATURE_LENGTH=64,r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=64,r.SEED_LENGTH=32;function i(K){const W=new Float64Array(16);if(K)for(let B=0;B<K.length;B++)W[B]=K[B];return W}const a=new Uint8Array(32);a[0]=9;const c=i(),u=i([1]),f=i([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),h=i([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),m=i([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),w=i([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),y=i([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function x(K,W){for(let B=0;B<16;B++)K[B]=W[B]|0}function S(K){let W=1;for(let B=0;B<16;B++){let g=K[B]+W+65535;W=Math.floor(g/65536),K[B]=g-W*65536}K[0]+=W-1+37*(W-1)}function P(K,W,B){const g=~(B-1);for(let L=0;L<16;L++){const le=g&(K[L]^W[L]);K[L]^=le,W[L]^=le}}function U(K,W){const B=i(),g=i();for(let L=0;L<16;L++)g[L]=W[L];S(g),S(g),S(g);for(let L=0;L<2;L++){B[0]=g[0]-65517;for(let pe=1;pe<15;pe++)B[pe]=g[pe]-65535-(B[pe-1]>>16&1),B[pe-1]&=65535;B[15]=g[15]-32767-(B[14]>>16&1);const le=B[15]>>16&1;B[14]&=65535,P(g,B,1-le)}for(let L=0;L<16;L++)K[2*L]=g[L]&255,K[2*L+1]=g[L]>>8}function j(K,W){let B=0;for(let g=0;g<32;g++)B|=K[g]^W[g];return(1&B-1>>>8)-1}function A(K,W){const B=new Uint8Array(32),g=new Uint8Array(32);return U(B,K),U(g,W),j(B,g)}function T(K){const W=new Uint8Array(32);return U(W,K),W[0]&1}function C(K,W){for(let B=0;B<16;B++)K[B]=W[2*B]+(W[2*B+1]<<8);K[15]&=32767}function $(K,W,B){for(let g=0;g<16;g++)K[g]=W[g]+B[g]}function E(K,W,B){for(let g=0;g<16;g++)K[g]=W[g]-B[g]}function d(K,W,B){let g,L,le=0,pe=0,Ce=0,Ke=0,Je=0,ke=0,St=0,Ct=0,ze=0,Oe=0,Ue=0,je=0,He=0,Ae=0,Fe=0,Se=0,Te=0,Ve=0,$e=0,Ze=0,et=0,at=0,ct=0,nt=0,Sr=0,Ur=0,On=0,Cr=0,Wn=0,bi=0,rs=0,Lt=B[0],Ot=B[1],Mt=B[2],Ut=B[3],Tt=B[4],$t=B[5],Gt=B[6],Yt=B[7],jt=B[8],Jt=B[9],Ft=B[10],Ht=B[11],Bt=B[12],_t=B[13],Zt=B[14],Qt=B[15];g=W[0],le+=g*Lt,pe+=g*Ot,Ce+=g*Mt,Ke+=g*Ut,Je+=g*Tt,ke+=g*$t,St+=g*Gt,Ct+=g*Yt,ze+=g*jt,Oe+=g*Jt,Ue+=g*Ft,je+=g*Ht,He+=g*Bt,Ae+=g*_t,Fe+=g*Zt,Se+=g*Qt,g=W[1],pe+=g*Lt,Ce+=g*Ot,Ke+=g*Mt,Je+=g*Ut,ke+=g*Tt,St+=g*$t,Ct+=g*Gt,ze+=g*Yt,Oe+=g*jt,Ue+=g*Jt,je+=g*Ft,He+=g*Ht,Ae+=g*Bt,Fe+=g*_t,Se+=g*Zt,Te+=g*Qt,g=W[2],Ce+=g*Lt,Ke+=g*Ot,Je+=g*Mt,ke+=g*Ut,St+=g*Tt,Ct+=g*$t,ze+=g*Gt,Oe+=g*Yt,Ue+=g*jt,je+=g*Jt,He+=g*Ft,Ae+=g*Ht,Fe+=g*Bt,Se+=g*_t,Te+=g*Zt,Ve+=g*Qt,g=W[3],Ke+=g*Lt,Je+=g*Ot,ke+=g*Mt,St+=g*Ut,Ct+=g*Tt,ze+=g*$t,Oe+=g*Gt,Ue+=g*Yt,je+=g*jt,He+=g*Jt,Ae+=g*Ft,Fe+=g*Ht,Se+=g*Bt,Te+=g*_t,Ve+=g*Zt,$e+=g*Qt,g=W[4],Je+=g*Lt,ke+=g*Ot,St+=g*Mt,Ct+=g*Ut,ze+=g*Tt,Oe+=g*$t,Ue+=g*Gt,je+=g*Yt,He+=g*jt,Ae+=g*Jt,Fe+=g*Ft,Se+=g*Ht,Te+=g*Bt,Ve+=g*_t,$e+=g*Zt,Ze+=g*Qt,g=W[5],ke+=g*Lt,St+=g*Ot,Ct+=g*Mt,ze+=g*Ut,Oe+=g*Tt,Ue+=g*$t,je+=g*Gt,He+=g*Yt,Ae+=g*jt,Fe+=g*Jt,Se+=g*Ft,Te+=g*Ht,Ve+=g*Bt,$e+=g*_t,Ze+=g*Zt,et+=g*Qt,g=W[6],St+=g*Lt,Ct+=g*Ot,ze+=g*Mt,Oe+=g*Ut,Ue+=g*Tt,je+=g*$t,He+=g*Gt,Ae+=g*Yt,Fe+=g*jt,Se+=g*Jt,Te+=g*Ft,Ve+=g*Ht,$e+=g*Bt,Ze+=g*_t,et+=g*Zt,at+=g*Qt,g=W[7],Ct+=g*Lt,ze+=g*Ot,Oe+=g*Mt,Ue+=g*Ut,je+=g*Tt,He+=g*$t,Ae+=g*Gt,Fe+=g*Yt,Se+=g*jt,Te+=g*Jt,Ve+=g*Ft,$e+=g*Ht,Ze+=g*Bt,et+=g*_t,at+=g*Zt,ct+=g*Qt,g=W[8],ze+=g*Lt,Oe+=g*Ot,Ue+=g*Mt,je+=g*Ut,He+=g*Tt,Ae+=g*$t,Fe+=g*Gt,Se+=g*Yt,Te+=g*jt,Ve+=g*Jt,$e+=g*Ft,Ze+=g*Ht,et+=g*Bt,at+=g*_t,ct+=g*Zt,nt+=g*Qt,g=W[9],Oe+=g*Lt,Ue+=g*Ot,je+=g*Mt,He+=g*Ut,Ae+=g*Tt,Fe+=g*$t,Se+=g*Gt,Te+=g*Yt,Ve+=g*jt,$e+=g*Jt,Ze+=g*Ft,et+=g*Ht,at+=g*Bt,ct+=g*_t,nt+=g*Zt,Sr+=g*Qt,g=W[10],Ue+=g*Lt,je+=g*Ot,He+=g*Mt,Ae+=g*Ut,Fe+=g*Tt,Se+=g*$t,Te+=g*Gt,Ve+=g*Yt,$e+=g*jt,Ze+=g*Jt,et+=g*Ft,at+=g*Ht,ct+=g*Bt,nt+=g*_t,Sr+=g*Zt,Ur+=g*Qt,g=W[11],je+=g*Lt,He+=g*Ot,Ae+=g*Mt,Fe+=g*Ut,Se+=g*Tt,Te+=g*$t,Ve+=g*Gt,$e+=g*Yt,Ze+=g*jt,et+=g*Jt,at+=g*Ft,ct+=g*Ht,nt+=g*Bt,Sr+=g*_t,Ur+=g*Zt,On+=g*Qt,g=W[12],He+=g*Lt,Ae+=g*Ot,Fe+=g*Mt,Se+=g*Ut,Te+=g*Tt,Ve+=g*$t,$e+=g*Gt,Ze+=g*Yt,et+=g*jt,at+=g*Jt,ct+=g*Ft,nt+=g*Ht,Sr+=g*Bt,Ur+=g*_t,On+=g*Zt,Cr+=g*Qt,g=W[13],Ae+=g*Lt,Fe+=g*Ot,Se+=g*Mt,Te+=g*Ut,Ve+=g*Tt,$e+=g*$t,Ze+=g*Gt,et+=g*Yt,at+=g*jt,ct+=g*Jt,nt+=g*Ft,Sr+=g*Ht,Ur+=g*Bt,On+=g*_t,Cr+=g*Zt,Wn+=g*Qt,g=W[14],Fe+=g*Lt,Se+=g*Ot,Te+=g*Mt,Ve+=g*Ut,$e+=g*Tt,Ze+=g*$t,et+=g*Gt,at+=g*Yt,ct+=g*jt,nt+=g*Jt,Sr+=g*Ft,Ur+=g*Ht,On+=g*Bt,Cr+=g*_t,Wn+=g*Zt,bi+=g*Qt,g=W[15],Se+=g*Lt,Te+=g*Ot,Ve+=g*Mt,$e+=g*Ut,Ze+=g*Tt,et+=g*$t,at+=g*Gt,ct+=g*Yt,nt+=g*jt,Sr+=g*Jt,Ur+=g*Ft,On+=g*Ht,Cr+=g*Bt,Wn+=g*_t,bi+=g*Zt,rs+=g*Qt,le+=38*Te,pe+=38*Ve,Ce+=38*$e,Ke+=38*Ze,Je+=38*et,ke+=38*at,St+=38*ct,Ct+=38*nt,ze+=38*Sr,Oe+=38*Ur,Ue+=38*On,je+=38*Cr,He+=38*Wn,Ae+=38*bi,Fe+=38*rs,L=1,g=le+L+65535,L=Math.floor(g/65536),le=g-L*65536,g=pe+L+65535,L=Math.floor(g/65536),pe=g-L*65536,g=Ce+L+65535,L=Math.floor(g/65536),Ce=g-L*65536,g=Ke+L+65535,L=Math.floor(g/65536),Ke=g-L*65536,g=Je+L+65535,L=Math.floor(g/65536),Je=g-L*65536,g=ke+L+65535,L=Math.floor(g/65536),ke=g-L*65536,g=St+L+65535,L=Math.floor(g/65536),St=g-L*65536,g=Ct+L+65535,L=Math.floor(g/65536),Ct=g-L*65536,g=ze+L+65535,L=Math.floor(g/65536),ze=g-L*65536,g=Oe+L+65535,L=Math.floor(g/65536),Oe=g-L*65536,g=Ue+L+65535,L=Math.floor(g/65536),Ue=g-L*65536,g=je+L+65535,L=Math.floor(g/65536),je=g-L*65536,g=He+L+65535,L=Math.floor(g/65536),He=g-L*65536,g=Ae+L+65535,L=Math.floor(g/65536),Ae=g-L*65536,g=Fe+L+65535,L=Math.floor(g/65536),Fe=g-L*65536,g=Se+L+65535,L=Math.floor(g/65536),Se=g-L*65536,le+=L-1+37*(L-1),L=1,g=le+L+65535,L=Math.floor(g/65536),le=g-L*65536,g=pe+L+65535,L=Math.floor(g/65536),pe=g-L*65536,g=Ce+L+65535,L=Math.floor(g/65536),Ce=g-L*65536,g=Ke+L+65535,L=Math.floor(g/65536),Ke=g-L*65536,g=Je+L+65535,L=Math.floor(g/65536),Je=g-L*65536,g=ke+L+65535,L=Math.floor(g/65536),ke=g-L*65536,g=St+L+65535,L=Math.floor(g/65536),St=g-L*65536,g=Ct+L+65535,L=Math.floor(g/65536),Ct=g-L*65536,g=ze+L+65535,L=Math.floor(g/65536),ze=g-L*65536,g=Oe+L+65535,L=Math.floor(g/65536),Oe=g-L*65536,g=Ue+L+65535,L=Math.floor(g/65536),Ue=g-L*65536,g=je+L+65535,L=Math.floor(g/65536),je=g-L*65536,g=He+L+65535,L=Math.floor(g/65536),He=g-L*65536,g=Ae+L+65535,L=Math.floor(g/65536),Ae=g-L*65536,g=Fe+L+65535,L=Math.floor(g/65536),Fe=g-L*65536,g=Se+L+65535,L=Math.floor(g/65536),Se=g-L*65536,le+=L-1+37*(L-1),K[0]=le,K[1]=pe,K[2]=Ce,K[3]=Ke,K[4]=Je,K[5]=ke,K[6]=St,K[7]=Ct,K[8]=ze,K[9]=Oe,K[10]=Ue,K[11]=je,K[12]=He,K[13]=Ae,K[14]=Fe,K[15]=Se}function b(K,W){d(K,W,W)}function H(K,W){const B=i();let g;for(g=0;g<16;g++)B[g]=W[g];for(g=253;g>=0;g--)b(B,B),g!==2&&g!==4&&d(B,B,W);for(g=0;g<16;g++)K[g]=B[g]}function F(K,W){const B=i();let g;for(g=0;g<16;g++)B[g]=W[g];for(g=250;g>=0;g--)b(B,B),g!==1&&d(B,B,W);for(g=0;g<16;g++)K[g]=B[g]}function V(K,W){const B=i(),g=i(),L=i(),le=i(),pe=i(),Ce=i(),Ke=i(),Je=i(),ke=i();E(B,K[1],K[0]),E(ke,W[1],W[0]),d(B,B,ke),$(g,K[0],K[1]),$(ke,W[0],W[1]),d(g,g,ke),d(L,K[3],W[3]),d(L,L,h),d(le,K[2],W[2]),$(le,le,le),E(pe,g,B),E(Ce,le,L),$(Ke,le,L),$(Je,g,B),d(K[0],pe,Ce),d(K[1],Je,Ke),d(K[2],Ke,Ce),d(K[3],pe,Je)}function se(K,W,B){for(let g=0;g<4;g++)P(K[g],W[g],B)}function ce(K,W){const B=i(),g=i(),L=i();H(L,W[2]),d(B,W[0],L),d(g,W[1],L),U(K,g),K[31]^=T(B)<<7}function I(K,W,B){x(K[0],c),x(K[1],u),x(K[2],u),x(K[3],c);for(let g=255;g>=0;--g){const L=B[g/8|0]>>(g&7)&1;se(K,W,L),V(W,K),V(K,K),se(K,W,L)}}function N(K,W){const B=[i(),i(),i(),i()];x(B[0],m),x(B[1],w),x(B[2],u),d(B[3],m,w),I(K,B,W)}function X(K){if(K.length!==r.SEED_LENGTH)throw new Error(`ed25519: seed must be ${r.SEED_LENGTH} bytes`);const W=(0,t.hash)(K);W[0]&=248,W[31]&=127,W[31]|=64;const B=new Uint8Array(32),g=[i(),i(),i(),i()];N(g,W),ce(B,g);const L=new Uint8Array(64);return L.set(K),L.set(B,32),{publicKey:B,secretKey:L}}r.generateKeyPairFromSeed=X;function ee(K){const W=(0,e.randomBytes)(32,K),B=X(W);return(0,n.wipe)(W),B}r.generateKeyPair=ee;function Y(K){if(K.length!==r.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${r.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(K.subarray(32))}r.extractPublicKeyFromSecretKey=Y;const J=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Q(K,W){let B,g,L,le;for(g=63;g>=32;--g){for(B=0,L=g-32,le=g-12;L<le;++L)W[L]+=B-16*W[g]*J[L-(g-32)],B=Math.floor((W[L]+128)/256),W[L]-=B*256;W[L]+=B,W[g]=0}for(B=0,L=0;L<32;L++)W[L]+=B-(W[31]>>4)*J[L],B=W[L]>>8,W[L]&=255;for(L=0;L<32;L++)W[L]-=B*J[L];for(g=0;g<32;g++)W[g+1]+=W[g]>>8,K[g]=W[g]&255}function ie(K){const W=new Float64Array(64);for(let B=0;B<64;B++)W[B]=K[B];for(let B=0;B<64;B++)K[B]=0;Q(K,W)}function Ee(K,W){const B=new Float64Array(64),g=[i(),i(),i(),i()],L=(0,t.hash)(K.subarray(0,32));L[0]&=248,L[31]&=127,L[31]|=64;const le=new Uint8Array(64);le.set(L.subarray(32),32);const pe=new t.SHA512;pe.update(le.subarray(32)),pe.update(W);const Ce=pe.digest();pe.clean(),ie(Ce),N(g,Ce),ce(le,g),pe.reset(),pe.update(le.subarray(0,32)),pe.update(K.subarray(32)),pe.update(W);const Ke=pe.digest();ie(Ke);for(let Je=0;Je<32;Je++)B[Je]=Ce[Je];for(let Je=0;Je<32;Je++)for(let ke=0;ke<32;ke++)B[Je+ke]+=Ke[Je]*L[ke];return Q(le.subarray(32),B),le}r.sign=Ee;function ae(K,W){const B=i(),g=i(),L=i(),le=i(),pe=i(),Ce=i(),Ke=i();return x(K[2],u),C(K[1],W),b(L,K[1]),d(le,L,f),E(L,L,K[2]),$(le,K[2],le),b(pe,le),b(Ce,pe),d(Ke,Ce,pe),d(B,Ke,L),d(B,B,le),F(B,B),d(B,B,L),d(B,B,le),d(B,B,le),d(K[0],B,le),b(g,K[0]),d(g,g,le),A(g,L)&&d(K[0],K[0],y),b(g,K[0]),d(g,g,le),A(g,L)?-1:(T(K[0])===W[31]>>7&&E(K[0],c,K[0]),d(K[3],K[0],K[1]),0)}function xe(K,W,B){const g=new Uint8Array(32),L=[i(),i(),i(),i()],le=[i(),i(),i(),i()];if(B.length!==r.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${r.SIGNATURE_LENGTH} bytes`);if(ae(le,K))return!1;const pe=new t.SHA512;pe.update(B.subarray(0,32)),pe.update(K),pe.update(W);const Ce=pe.digest();return ie(Ce),I(L,le,Ce),N(le,B.subarray(32)),V(L,le),ce(g,L),!j(B,g)}r.verify=xe;function de(K){let W=[i(),i(),i(),i()];if(ae(W,K))throw new Error("Ed25519: invalid public key");let B=i(),g=i(),L=W[1];$(B,u,L),E(g,u,L),H(g,g),d(B,B,g);let le=new Uint8Array(32);return U(le,B),le}r.convertPublicKeyToX25519=de;function be(K){const W=(0,t.hash)(K.subarray(0,32));W[0]&=248,W[31]&=127,W[31]|=64;const B=new Uint8Array(W.subarray(0,32));return(0,n.wipe)(W),B}r.convertSecretKeyToX25519=be}(Su);const e6="EdDSA",t6="JWT",Tp=".",Rp="base64url",r6="utf8",n6="utf8",i6=":",s6="did",o6="key",Np="base58btc",a6="z",c6="K36",l6=32;function qa(r){return wr(Tr(ji(r),r6),Rp)}function Lp(r){const e=Tr(c6,Np),t=a6+wr(Bl([e,r]),Np);return[s6,o6,t].join(i6)}function u6(r){return wr(r,Rp)}function h6(r){return Tr([qa(r.header),qa(r.payload)].join(Tp),n6)}function f6(r){return[qa(r.header),qa(r.payload),u6(r.signature)].join(Tp)}function Mp(r=vs.randomBytes(l6)){return Su.generateKeyPairFromSeed(r)}async function d6(r,e,t,n,i=ye.fromMiliseconds(Date.now())){const a={alg:e6,typ:t6},c=Lp(n.publicKey),u=i+t,f={iss:c,sub:r,aud:e,iat:i,exp:u},h=h6({header:a,payload:f}),m=Su.sign(n.secretKey,h);return f6({header:a,payload:f,signature:m})}const p6="PARSE_ERROR",g6="INVALID_REQUEST",m6="METHOD_NOT_FOUND",v6="INVALID_PARAMS",Up="INTERNAL_ERROR",Cu="SERVER_ERROR",y6=[-32700,-32600,-32601,-32602,-32603],Ao={[p6]:{code:-32700,message:"Parse error"},[g6]:{code:-32600,message:"Invalid Request"},[m6]:{code:-32601,message:"Method not found"},[v6]:{code:-32602,message:"Invalid params"},[Up]:{code:-32603,message:"Internal error"},[Cu]:{code:-32e3,message:"Server error"}},jp=Cu;function w6(r){return y6.includes(r)}function Fp(r){return Object.keys(Ao).includes(r)?Ao[r]:Ao[jp]}function b6(r){const e=Object.values(Ao).find(t=>t.code===r);return e||Ao[jp]}function Bp(r,e,t){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${t} RPC url at ${e}`):r}var kp={};/*! *****************************************************************************
|
|
46
|
+
***************************************************************************** */var Lu=function(r,e){return Lu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},Lu(r,e)};function OE(r,e){Lu(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Mu=function(){return Mu=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},Mu.apply(this,arguments)};function CE(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function $E(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var u=r.length-1;u>=0;u--)(c=r[u])&&(a=(i<3?c(a):i>3?c(e,t,a):c(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a}function AE(r,e){return function(t,n){e(t,n,r)}}function PE(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function TE(r,e,t,n){function i(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function u(m){try{h(n.next(m))}catch(w){c(w)}}function f(m){try{h(n.throw(m))}catch(w){c(w)}}function h(m){m.done?a(m.value):i(m.value).then(u,f)}h((n=n.apply(r,e||[])).next())})}function RE(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,c;return c={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(h){return function(m){return f([h,m])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(a=h[0]&2?i.return:h[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,h[1])).done)return a;switch(i=0,a&&(h=[h[0]&2,a.value]),h[0]){case 0:case 1:a=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,i=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!a||h[1]>a[0]&&h[1]<a[3])){t.label=h[1];break}if(h[0]===6&&t.label<a[1]){t.label=a[1],a=h;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(h);break}a[2]&&t.ops.pop(),t.trys.pop();continue}h=e.call(r,t)}catch(m){h=[6,m],i=0}finally{n=a=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function NE(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}function LE(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function Uu(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function X0(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,a=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(u){c={error:u}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(c)throw c.error}}return a}function ME(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(X0(arguments[e]));return r}function UE(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),i=0,e=0;e<t;e++)for(var a=arguments[e],c=0,u=a.length;c<u;c++,i++)n[i]=a[c];return n}function Bo(r){return this instanceof Bo?(this.v=r,this):new Bo(r)}function jE(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(y){n[y]&&(i[y]=function(b){return new Promise(function(I,A){a.push([y,b,I,A])>1||u(y,b)})})}function u(y,b){try{f(n[y](b))}catch(I){w(a[0][3],I)}}function f(y){y.value instanceof Bo?Promise.resolve(y.value.v).then(h,m):w(a[0][2],y)}function h(y){u("next",y)}function m(y){u("throw",y)}function w(y,b){y(b),a.shift(),a.length&&u(a[0][0],a[0][1])}}function FE(r){var e,t;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,a){e[i]=r[i]?function(c){return(t=!t)?{value:Bo(r[i](c)),done:i==="return"}:a?a(c):c}:a}}function BE(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof Uu=="function"?Uu(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(c){return new Promise(function(u,f){c=r[a](c),i(u,f,c.done,c.value)})}}function i(a,c,u,f){Promise.resolve(f).then(function(h){a({value:h,done:u})},c)}}function kE(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function zE(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function qE(r){return r&&r.__esModule?r:{default:r}}function HE(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function WE(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var KE=Object.freeze({__proto__:null,__extends:OE,get __assign(){return Mu},__rest:CE,__decorate:$E,__param:AE,__metadata:PE,__awaiter:TE,__generator:RE,__createBinding:NE,__exportStar:LE,__values:Uu,__read:X0,__spread:ME,__spreadArrays:UE,__await:Bo,__asyncGenerator:jE,__asyncDelegator:FE,__asyncValues:BE,__makeTemplateObject:kE,__importStar:zE,__importDefault:qE,__classPrivateFieldGet:HE,__classPrivateFieldSet:WE}),VE=Li(KE),Un={},eg;function GE(){if(eg)return Un;eg=1,Object.defineProperty(Un,"__esModule",{value:!0}),Un.isBrowserCryptoAvailable=Un.getSubtleCrypto=Un.getBrowerCrypto=void 0;function r(){return pn?.crypto||pn?.msCrypto||{}}Un.getBrowerCrypto=r;function e(){const n=r();return n.subtle||n.webkitSubtle}Un.getSubtleCrypto=e;function t(){return!!r()&&!!e()}return Un.isBrowserCryptoAvailable=t,Un}var jn={},tg;function YE(){if(tg)return jn;tg=1,Object.defineProperty(jn,"__esModule",{value:!0}),jn.isBrowser=jn.isNode=jn.isReactNative=void 0;function r(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}jn.isReactNative=r;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}jn.isNode=e;function t(){return!r()&&!e()}return jn.isBrowser=t,jn}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=VE;e.__exportStar(GE(),r),e.__exportStar(YE(),r)})(Q0);function Ps(r=3){const e=Date.now()*Math.pow(10,r),t=Math.floor(Math.random()*Math.pow(10,r));return e+t}function Hi(r=6){return BigInt(Ps(r))}function Ts(r,e,t){return{id:t||Ps(),jsonrpc:"2.0",method:r,params:e}}function Xa(r,e){return{id:r,jsonrpc:"2.0",result:e}}function ec(r,e,t){return{id:r,jsonrpc:"2.0",error:ZE(e,t)}}function ZE(r,e){return typeof r>"u"?Z0(G0):(typeof r=="string"&&(r=Object.assign(Object.assign({},Z0(Nu)),{message:r})),typeof e<"u"&&(r.data=e),DE(r.code)&&(r=SE(r.code)),r)}class JE{}class QE extends JE{constructor(){super()}}class XE extends QE{constructor(e){super()}}const e6="^https?:",t6="^wss?:";function r6(r){const e=r.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function rg(r,e){const t=r6(r);return typeof t>"u"?!1:new RegExp(e).test(t)}function ng(r){return rg(r,e6)}function ig(r){return rg(r,t6)}function n6(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}function sg(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function ju(r){return sg(r)&&"method"in r}function tc(r){return sg(r)&&(Fn(r)||gn(r))}function Fn(r){return"result"in r}function gn(r){return"error"in r}class Bn extends XE{constructor(e){super(e),this.events=new cr.exports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(Ts(e.method,e.params||[],e.id||Hi().toString()),t)}async requestStrict(e,t){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(a){i(a)}this.events.on(`${e.id}`,a=>{gn(a)?i(a.error):n(a.result)});try{await this.connection.send(e,t)}catch(a){i(a)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),tc(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}}const i6=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),s6=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",og=r=>r.split("?")[0],ag=10,o6=i6();class a6{constructor(e){if(this.url=e,this.events=new cr.exports.EventEmitter,this.registering=!1,!ig(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>{if(typeof this.socket>"u"){t(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Mn(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!ig(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((n,i)=>{this.events.once("register_error",a=>{this.resetMaxListeners(),i(a)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,n)=>{const i=new URLSearchParams(e).get("origin"),a=Q0.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!n6(e)},c=new o6(e,[],a);s6()?c.onerror=u=>{const f=u;n(this.emitError(f.error))}:c.on("error",u=>{n(this.emitError(u))}),c.onopen=()=>{this.onOpen(c),t(c)}})}onOpen(e){e.onmessage=t=>this.onPayload(t),e.onclose=t=>this.onClose(t),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?No(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const n=this.parseError(t),i=n.message||n.toString(),a=ec(e,i);this.events.emit("payload",a)}parseError(e,t=this.url){return J0(e,og(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>ag&&this.events.setMaxListeners(ag)}emitError(e){const t=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${og(this.url)}`));return this.events.emit("register_error",t),t}}var Fu={exports:{}};(function(r,e){var t=200,n="__lodash_hash_undefined__",i=1,a=2,c=9007199254740991,u="[object Arguments]",f="[object Array]",h="[object AsyncFunction]",m="[object Boolean]",w="[object Date]",y="[object Error]",b="[object Function]",I="[object GeneratorFunction]",A="[object Map]",U="[object Number]",j="[object Null]",$="[object Object]",T="[object Promise]",O="[object Proxy]",P="[object RegExp]",x="[object Set]",d="[object String]",_="[object Symbol]",H="[object Undefined]",F="[object WeakMap]",V="[object ArrayBuffer]",se="[object DataView]",ce="[object Float32Array]",D="[object Float64Array]",N="[object Int8Array]",X="[object Int16Array]",ee="[object Int32Array]",Y="[object Uint8Array]",Z="[object Uint8ClampedArray]",Q="[object Uint16Array]",ie="[object Uint32Array]",Ee=/[\\^$.*+?()[\]{}|]/g,ae=/^\[object .+?Constructor\]$/,xe=/^(?:0|[1-9]\d*)$/,de={};de[ce]=de[D]=de[N]=de[X]=de[ee]=de[Y]=de[Z]=de[Q]=de[ie]=!0,de[u]=de[f]=de[V]=de[m]=de[se]=de[w]=de[y]=de[b]=de[A]=de[U]=de[$]=de[P]=de[x]=de[d]=de[F]=!1;var be=typeof pn=="object"&&pn&&pn.Object===Object&&pn,K=typeof self=="object"&&self&&self.Object===Object&&self,W=be||K||Function("return this")(),B=e&&!e.nodeType&&e,g=B&&!0&&r&&!r.nodeType&&r,L=g&&g.exports===B,le=L&&be.process,pe=function(){try{return le&&le.binding&&le.binding("util")}catch{}}(),Oe=pe&&pe.isTypedArray;function Ke(C,k){for(var ne=-1,ge=C==null?0:C.length,vt=0,Ne=[];++ne<ge;){var xt=C[ne];k(xt,ne,C)&&(Ne[vt++]=xt)}return Ne}function Ze(C,k){for(var ne=-1,ge=k.length,vt=C.length;++ne<ge;)C[vt+ne]=k[ne];return C}function ke(C,k){for(var ne=-1,ge=C==null?0:C.length;++ne<ge;)if(k(C[ne],ne,C))return!0;return!1}function St(C,k){for(var ne=-1,ge=Array(C);++ne<C;)ge[ne]=k(ne);return ge}function Ot(C){return function(k){return C(k)}}function qe(C,k){return C.has(k)}function Ce(C,k){return C?.[k]}function Ue(C){var k=-1,ne=Array(C.size);return C.forEach(function(ge,vt){ne[++k]=[vt,ge]}),ne}function je(C,k){return function(ne){return C(k(ne))}}function He(C){var k=-1,ne=Array(C.size);return C.forEach(function(ge){ne[++k]=ge}),ne}var Ae=Array.prototype,Fe=Function.prototype,Se=Object.prototype,Te=W["__core-js_shared__"],Ve=Fe.toString,$e=Se.hasOwnProperty,Je=function(){var C=/[^.]+$/.exec(Te&&Te.keys&&Te.keys.IE_PROTO||"");return C?"Symbol(src)_1."+C:""}(),Xe=Se.toString,ot=RegExp("^"+Ve.call($e).replace(Ee,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),at=L?W.Buffer:void 0,rt=W.Symbol,xr=W.Uint8Array,Nr=Se.propertyIsEnumerable,An=Ae.splice,Ir=rt?rt.toStringTag:void 0,Gn=Object.getOwnPropertySymbols,Ii=at?at.isBuffer:void 0,as=je(Object.keys,Object),Lt=Gr(W,"DataView"),Ct=Gr(W,"Map"),Mt=Gr(W,"Promise"),Ut=Gr(W,"Set"),Tt=Gr(W,"WeakMap"),$t=Gr(Object,"create"),Vt=Zn(Lt),Gt=Zn(Ct),jt=Zn(Mt),Yt=Zn(Ut),Ft=Zn(Tt),qt=rt?rt.prototype:void 0,Bt=qt?qt.valueOf:void 0;function _t(C){var k=-1,ne=C==null?0:C.length;for(this.clear();++k<ne;){var ge=C[k];this.set(ge[0],ge[1])}}function Zt(){this.__data__=$t?$t(null):{},this.size=0}function Jt(C){var k=this.has(C)&&delete this.__data__[C];return this.size-=k?1:0,k}function yf(C){var k=this.__data__;if($t){var ne=k[C];return ne===n?void 0:ne}return $e.call(k,C)?k[C]:void 0}function wf(C){var k=this.__data__;return $t?k[C]!==void 0:$e.call(k,C)}function bf(C,k){var ne=this.__data__;return this.size+=this.has(C)?0:1,ne[C]=$t&&k===void 0?n:k,this}_t.prototype.clear=Zt,_t.prototype.delete=Jt,_t.prototype.get=yf,_t.prototype.has=wf,_t.prototype.set=bf;function sn(C){var k=-1,ne=C==null?0:C.length;for(this.clear();++k<ne;){var ge=C[k];this.set(ge[0],ge[1])}}function _f(){this.__data__=[],this.size=0}function Ef(C){var k=this.__data__,ne=cs(k,C);if(ne<0)return!1;var ge=k.length-1;return ne==ge?k.pop():An.call(k,ne,1),--this.size,!0}function xf(C){var k=this.__data__,ne=cs(k,C);return ne<0?void 0:k[ne][1]}function If(C){return cs(this.__data__,C)>-1}function Df(C,k){var ne=this.__data__,ge=cs(ne,C);return ge<0?(++this.size,ne.push([C,k])):ne[ge][1]=k,this}sn.prototype.clear=_f,sn.prototype.delete=Ef,sn.prototype.get=xf,sn.prototype.has=If,sn.prototype.set=Df;function Yn(C){var k=-1,ne=C==null?0:C.length;for(this.clear();++k<ne;){var ge=C[k];this.set(ge[0],ge[1])}}function Qs(){this.size=0,this.__data__={hash:new _t,map:new(Ct||sn),string:new _t}}function Sf(C){var k=Di(this,C).delete(C);return this.size-=k?1:0,k}function Xs(C){return Di(this,C).get(C)}function Of(C){return Di(this,C).has(C)}function Cf(C,k){var ne=Di(this,C),ge=ne.size;return ne.set(C,k),this.size+=ne.size==ge?0:1,this}Yn.prototype.clear=Qs,Yn.prototype.delete=Sf,Yn.prototype.get=Xs,Yn.prototype.has=Of,Yn.prototype.set=Cf;function eo(C){var k=-1,ne=C==null?0:C.length;for(this.__data__=new Yn;++k<ne;)this.add(C[k])}function Uc(C){return this.__data__.set(C,n),this}function jc(C){return this.__data__.has(C)}eo.prototype.add=eo.prototype.push=Uc,eo.prototype.has=jc;function vn(C){var k=this.__data__=new sn(C);this.size=k.size}function $f(){this.__data__=new sn,this.size=0}function Af(C){var k=this.__data__,ne=k.delete(C);return this.size=k.size,ne}function Pf(C){return this.__data__.get(C)}function Tf(C){return this.__data__.has(C)}function Fc(C,k){var ne=this.__data__;if(ne instanceof sn){var ge=ne.__data__;if(!Ct||ge.length<t-1)return ge.push([C,k]),this.size=++ne.size,this;ne=this.__data__=new Yn(ge)}return ne.set(C,k),this.size=ne.size,this}vn.prototype.clear=$f,vn.prototype.delete=Af,vn.prototype.get=Pf,vn.prototype.has=Tf,vn.prototype.set=Fc;function Bc(C,k){var ne=no(C),ge=!ne&&Qc(C),vt=!ne&&!ge&&pa(C),Ne=!ne&&!ge&&!vt&&tl(C),xt=ne||ge||vt||Ne,Qt=xt?St(C.length,String):[],nt=Qt.length;for(var yt in C)(k||$e.call(C,yt))&&!(xt&&(yt=="length"||vt&&(yt=="offset"||yt=="parent")||Ne&&(yt=="buffer"||yt=="byteLength"||yt=="byteOffset")||Vc(yt,nt)))&&Qt.push(yt);return Qt}function cs(C,k){for(var ne=C.length;ne--;)if(Jc(C[ne][0],k))return ne;return-1}function fa(C,k,ne){var ge=k(C);return no(C)?ge:Ze(ge,ne(C))}function ls(C){return C==null?C===void 0?H:j:Ir&&Ir in Object(C)?Wc(C):Lf(C)}function da(C){return hs(C)&&ls(C)==u}function us(C,k,ne,ge,vt){return C===k?!0:C==null||k==null||!hs(C)&&!hs(k)?C!==C&&k!==k:kc(C,k,ne,ge,us,vt)}function kc(C,k,ne,ge,vt,Ne){var xt=no(C),Qt=no(k),nt=xt?f:Pn(C),yt=Qt?f:Pn(k);nt=nt==u?$:nt,yt=yt==u?$:yt;var Ht=nt==$,Lr=yt==$,Xt=nt==yt;if(Xt&&pa(C)){if(!pa(k))return!1;xt=!0,Ht=!1}if(Xt&&!Ht)return Ne||(Ne=new vn),xt||tl(C)?to(C,k,ne,ge,vt,Ne):Nf(C,k,nt,ne,ge,vt,Ne);if(!(ne&i)){var It=Ht&&$e.call(C,"__wrapped__"),Dr=Lr&&$e.call(k,"__wrapped__");if(It||Dr){var yn=It?C.value():C,on=Dr?k.value():k;return Ne||(Ne=new vn),vt(yn,on,ne,ge,Ne)}}return Xt?(Ne||(Ne=new vn),Hc(C,k,ne,ge,vt,Ne)):!1}function Rf(C){if(!el(C)||Yc(C))return!1;var k=io(C)?ot:ae;return k.test(Zn(C))}function zc(C){return hs(C)&&Xc(C.length)&&!!de[ls(C)]}function qc(C){if(!Zc(C))return as(C);var k=[];for(var ne in Object(C))$e.call(C,ne)&&ne!="constructor"&&k.push(ne);return k}function to(C,k,ne,ge,vt,Ne){var xt=ne&i,Qt=C.length,nt=k.length;if(Qt!=nt&&!(xt&&nt>Qt))return!1;var yt=Ne.get(C);if(yt&&Ne.get(k))return yt==k;var Ht=-1,Lr=!0,Xt=ne&a?new eo:void 0;for(Ne.set(C,k),Ne.set(k,C);++Ht<Qt;){var It=C[Ht],Dr=k[Ht];if(ge)var yn=xt?ge(Dr,It,Ht,k,C,Ne):ge(It,Dr,Ht,C,k,Ne);if(yn!==void 0){if(yn)continue;Lr=!1;break}if(Xt){if(!ke(k,function(on,Tn){if(!qe(Xt,Tn)&&(It===on||vt(It,on,ne,ge,Ne)))return Xt.push(Tn)})){Lr=!1;break}}else if(!(It===Dr||vt(It,Dr,ne,ge,Ne))){Lr=!1;break}}return Ne.delete(C),Ne.delete(k),Lr}function Nf(C,k,ne,ge,vt,Ne,xt){switch(ne){case se:if(C.byteLength!=k.byteLength||C.byteOffset!=k.byteOffset)return!1;C=C.buffer,k=k.buffer;case V:return!(C.byteLength!=k.byteLength||!Ne(new xr(C),new xr(k)));case m:case w:case U:return Jc(+C,+k);case y:return C.name==k.name&&C.message==k.message;case P:case d:return C==k+"";case A:var Qt=Ue;case x:var nt=ge&i;if(Qt||(Qt=He),C.size!=k.size&&!nt)return!1;var yt=xt.get(C);if(yt)return yt==k;ge|=a,xt.set(C,k);var Ht=to(Qt(C),Qt(k),ge,vt,Ne,xt);return xt.delete(C),Ht;case _:if(Bt)return Bt.call(C)==Bt.call(k)}return!1}function Hc(C,k,ne,ge,vt,Ne){var xt=ne&i,Qt=ro(C),nt=Qt.length,yt=ro(k),Ht=yt.length;if(nt!=Ht&&!xt)return!1;for(var Lr=nt;Lr--;){var Xt=Qt[Lr];if(!(xt?Xt in k:$e.call(k,Xt)))return!1}var It=Ne.get(C);if(It&&Ne.get(k))return It==k;var Dr=!0;Ne.set(C,k),Ne.set(k,C);for(var yn=xt;++Lr<nt;){Xt=Qt[Lr];var on=C[Xt],Tn=k[Xt];if(ge)var ga=xt?ge(Tn,on,Xt,k,C,Ne):ge(on,Tn,Xt,C,k,Ne);if(!(ga===void 0?on===Tn||vt(on,Tn,ne,ge,Ne):ga)){Dr=!1;break}yn||(yn=Xt=="constructor")}if(Dr&&!yn){var fs=C.constructor,or=k.constructor;fs!=or&&"constructor"in C&&"constructor"in k&&!(typeof fs=="function"&&fs instanceof fs&&typeof or=="function"&&or instanceof or)&&(Dr=!1)}return Ne.delete(C),Ne.delete(k),Dr}function ro(C){return fa(C,jf,Kc)}function Di(C,k){var ne=C.__data__;return Gc(k)?ne[typeof k=="string"?"string":"hash"]:ne.map}function Gr(C,k){var ne=Ce(C,k);return Rf(ne)?ne:void 0}function Wc(C){var k=$e.call(C,Ir),ne=C[Ir];try{C[Ir]=void 0;var ge=!0}catch{}var vt=Xe.call(C);return ge&&(k?C[Ir]=ne:delete C[Ir]),vt}var Kc=Gn?function(C){return C==null?[]:(C=Object(C),Ke(Gn(C),function(k){return Nr.call(C,k)}))}:mt,Pn=ls;(Lt&&Pn(new Lt(new ArrayBuffer(1)))!=se||Ct&&Pn(new Ct)!=A||Mt&&Pn(Mt.resolve())!=T||Ut&&Pn(new Ut)!=x||Tt&&Pn(new Tt)!=F)&&(Pn=function(C){var k=ls(C),ne=k==$?C.constructor:void 0,ge=ne?Zn(ne):"";if(ge)switch(ge){case Vt:return se;case Gt:return A;case jt:return T;case Yt:return x;case Ft:return F}return k});function Vc(C,k){return k=k??c,!!k&&(typeof C=="number"||xe.test(C))&&C>-1&&C%1==0&&C<k}function Gc(C){var k=typeof C;return k=="string"||k=="number"||k=="symbol"||k=="boolean"?C!=="__proto__":C===null}function Yc(C){return!!Je&&Je in C}function Zc(C){var k=C&&C.constructor,ne=typeof k=="function"&&k.prototype||Se;return C===ne}function Lf(C){return Xe.call(C)}function Zn(C){if(C!=null){try{return Ve.call(C)}catch{}try{return C+""}catch{}}return""}function Jc(C,k){return C===k||C!==C&&k!==k}var Qc=da(function(){return arguments}())?da:function(C){return hs(C)&&$e.call(C,"callee")&&!Nr.call(C,"callee")},no=Array.isArray;function Mf(C){return C!=null&&Xc(C.length)&&!io(C)}var pa=Ii||gt;function Uf(C,k){return us(C,k)}function io(C){if(!el(C))return!1;var k=ls(C);return k==b||k==I||k==h||k==O}function Xc(C){return typeof C=="number"&&C>-1&&C%1==0&&C<=c}function el(C){var k=typeof C;return C!=null&&(k=="object"||k=="function")}function hs(C){return C!=null&&typeof C=="object"}var tl=Oe?Ot(Oe):zc;function jf(C){return Mf(C)?Bc(C):qc(C)}function mt(){return[]}function gt(){return!1}r.exports=Uf})(Fu,Fu.exports);var c6=Fu.exports;function l6(r,e){return e=e||{},new Promise(function(t,n){var i=new XMLHttpRequest,a=[],c=[],u={},f=function(){return{ok:(i.status/100|0)==2,statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:f,headers:{keys:function(){return a},entries:function(){return c},get:function(m){return u[m.toLowerCase()]},has:function(m){return m.toLowerCase()in u}}}};for(var h in i.open(e.method||"get",r,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(m,w,y){a.push(w=w.toLowerCase()),c.push([w,y]),u[w]=u[w]?u[w]+","+y:y}),t(f())},i.onerror=n,i.withCredentials=e.credentials=="include",e.headers)i.setRequestHeader(h,e.headers[h]);i.send(e.body||null)})}var u6=Object.freeze({__proto__:null,default:l6}),cg=Li(u6),h6=self.fetch||(self.fetch=cg.default||cg),f6=Object.defineProperty,lg=Object.getOwnPropertySymbols,d6=Object.prototype.hasOwnProperty,p6=Object.prototype.propertyIsEnumerable,ug=(r,e,t)=>e in r?f6(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,br=(r,e)=>{for(var t in e||(e={}))d6.call(e,t)&&ug(r,t,e[t]);if(lg)for(var t of lg(e))p6.call(e,t)&&ug(r,t,e[t]);return r};function g6(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var i=0;i<r.length;i++){var a=r.charAt(i),c=a.charCodeAt(0);if(t[c]!==255)throw new TypeError(a+" is ambiguous");t[c]=i}var u=r.length,f=r.charAt(0),h=Math.log(u)/Math.log(256),m=Math.log(256)/Math.log(u);function w(I){if(I instanceof Uint8Array||(ArrayBuffer.isView(I)?I=new Uint8Array(I.buffer,I.byteOffset,I.byteLength):Array.isArray(I)&&(I=Uint8Array.from(I))),!(I instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(I.length===0)return"";for(var A=0,U=0,j=0,$=I.length;j!==$&&I[j]===0;)j++,A++;for(var T=($-j)*m+1>>>0,O=new Uint8Array(T);j!==$;){for(var P=I[j],x=0,d=T-1;(P!==0||x<U)&&d!==-1;d--,x++)P+=256*O[d]>>>0,O[d]=P%u>>>0,P=P/u>>>0;if(P!==0)throw new Error("Non-zero carry");U=x,j++}for(var _=T-U;_!==T&&O[_]===0;)_++;for(var H=f.repeat(A);_<T;++_)H+=r.charAt(O[_]);return H}function y(I){if(typeof I!="string")throw new TypeError("Expected String");if(I.length===0)return new Uint8Array;var A=0;if(I[A]!==" "){for(var U=0,j=0;I[A]===f;)U++,A++;for(var $=(I.length-A)*h+1>>>0,T=new Uint8Array($);I[A];){var O=t[I.charCodeAt(A)];if(O===255)return;for(var P=0,x=$-1;(O!==0||P<j)&&x!==-1;x--,P++)O+=u*T[x]>>>0,T[x]=O%256>>>0,O=O/256>>>0;if(O!==0)throw new Error("Non-zero carry");j=P,A++}if(I[A]!==" "){for(var d=$-j;d!==$&&T[d]===0;)d++;for(var _=new Uint8Array(U+($-d)),H=U;d!==$;)_[H++]=T[d++];return _}}}function b(I){var A=y(I);if(A)return A;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:y,decode:b}}var m6=g6,v6=m6;const hg=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},y6=r=>new TextEncoder().encode(r),w6=r=>new TextDecoder().decode(r);class b6{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class _6{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return fg(this,e)}}class E6{constructor(e){this.decoders=e}or(e){return fg(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const fg=(r,e)=>new E6(br(br({},r.decoders||{[r.prefix]:r}),e.decoders||{[e.prefix]:e}));class x6{constructor(e,t,n,i){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=i,this.encoder=new b6(e,t,n),this.decoder=new _6(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const rc=({name:r,prefix:e,encode:t,decode:n})=>new x6(r,e,t,n),ko=({prefix:r,name:e,alphabet:t})=>{const{encode:n,decode:i}=v6(t,e);return rc({prefix:r,name:e,encode:n,decode:a=>hg(i(a))})},I6=(r,e,t,n)=>{const i={};for(let m=0;m<e.length;++m)i[e[m]]=m;let a=r.length;for(;r[a-1]==="=";)--a;const c=new Uint8Array(a*t/8|0);let u=0,f=0,h=0;for(let m=0;m<a;++m){const w=i[r[m]];if(w===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<t|w,u+=t,u>=8&&(u-=8,c[h++]=255&f>>u)}if(u>=t||255&f<<8-u)throw new SyntaxError("Unexpected end of data");return c},D6=(r,e,t)=>{const n=e[e.length-1]==="=",i=(1<<t)-1;let a="",c=0,u=0;for(let f=0;f<r.length;++f)for(u=u<<8|r[f],c+=8;c>t;)c-=t,a+=e[i&u>>c];if(c&&(a+=e[i&u<<t-c]),n)for(;a.length*t&7;)a+="=";return a},ur=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>rc({prefix:e,name:r,encode(i){return D6(i,n,t)},decode(i){return I6(i,n,t,r)}}),S6=rc({prefix:"\0",name:"identity",encode:r=>w6(r),decode:r=>y6(r)});var O6=Object.freeze({__proto__:null,identity:S6});const C6=ur({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var $6=Object.freeze({__proto__:null,base2:C6});const A6=ur({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var P6=Object.freeze({__proto__:null,base8:A6});const T6=ko({prefix:"9",name:"base10",alphabet:"0123456789"});var R6=Object.freeze({__proto__:null,base10:T6});const N6=ur({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),L6=ur({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var M6=Object.freeze({__proto__:null,base16:N6,base16upper:L6});const U6=ur({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),j6=ur({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),F6=ur({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),B6=ur({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),k6=ur({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),z6=ur({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),q6=ur({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),H6=ur({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),W6=ur({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var K6=Object.freeze({__proto__:null,base32:U6,base32upper:j6,base32pad:F6,base32padupper:B6,base32hex:k6,base32hexupper:z6,base32hexpad:q6,base32hexpadupper:H6,base32z:W6});const V6=ko({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),G6=ko({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Y6=Object.freeze({__proto__:null,base36:V6,base36upper:G6});const Z6=ko({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),J6=ko({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Q6=Object.freeze({__proto__:null,base58btc:Z6,base58flickr:J6});const X6=ur({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),e4=ur({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),t4=ur({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),r4=ur({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var n4=Object.freeze({__proto__:null,base64:X6,base64pad:e4,base64url:t4,base64urlpad:r4});const dg=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),i4=dg.reduce((r,e,t)=>(r[t]=e,r),[]),s4=dg.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function o4(r){return r.reduce((e,t)=>(e+=i4[t],e),"")}function a4(r){const e=[];for(const t of r){const n=s4[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}const c4=rc({prefix:"\u{1F680}",name:"base256emoji",encode:o4,decode:a4});var l4=Object.freeze({__proto__:null,base256emoji:c4}),u4=gg,pg=128,h4=127,f4=~h4,d4=Math.pow(2,31);function gg(r,e,t){e=e||[],t=t||0;for(var n=t;r>=d4;)e[t++]=r&255|pg,r/=128;for(;r&f4;)e[t++]=r&255|pg,r>>>=7;return e[t]=r|0,gg.bytes=t-n+1,e}var p4=Bu,g4=128,mg=127;function Bu(r,n){var t=0,n=n||0,i=0,a=n,c,u=r.length;do{if(a>=u)throw Bu.bytes=0,new RangeError("Could not decode varint");c=r[a++],t+=i<28?(c&mg)<<i:(c&mg)*Math.pow(2,i),i+=7}while(c>=g4);return Bu.bytes=a-n,t}var m4=Math.pow(2,7),v4=Math.pow(2,14),y4=Math.pow(2,21),w4=Math.pow(2,28),b4=Math.pow(2,35),_4=Math.pow(2,42),E4=Math.pow(2,49),x4=Math.pow(2,56),I4=Math.pow(2,63),D4=function(r){return r<m4?1:r<v4?2:r<y4?3:r<w4?4:r<b4?5:r<_4?6:r<E4?7:r<x4?8:r<I4?9:10},S4={encode:u4,decode:p4,encodingLength:D4},vg=S4;const yg=(r,e,t=0)=>(vg.encode(r,e,t),e),wg=r=>vg.encodingLength(r),ku=(r,e)=>{const t=e.byteLength,n=wg(r),i=n+wg(t),a=new Uint8Array(i+t);return yg(r,a,0),yg(t,a,n),a.set(e,i),new O4(r,t,e,a)};class O4{constructor(e,t,n,i){this.code=e,this.size=t,this.digest=n,this.bytes=i}}const bg=({name:r,code:e,encode:t})=>new C4(r,e,t);class C4{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?ku(this.code,t):t.then(n=>ku(this.code,n))}else throw Error("Unknown type, must be binary type")}}const _g=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),$4=bg({name:"sha2-256",code:18,encode:_g("SHA-256")}),A4=bg({name:"sha2-512",code:19,encode:_g("SHA-512")});var P4=Object.freeze({__proto__:null,sha256:$4,sha512:A4});const Eg=0,T4="identity",xg=hg;var R4=Object.freeze({__proto__:null,identity:{code:Eg,name:T4,encode:xg,digest:r=>ku(Eg,xg(r))}});new TextEncoder,new TextDecoder;const Ig=br(br(br(br(br(br(br(br(br(br({},O6),$6),P6),R6),M6),K6),Y6),Q6),n4),l4);br(br({},P4),R4);function Dg(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function N4(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Dg(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Sg(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}const Og=Sg("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),zu=Sg("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=N4(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),L4=br({utf8:Og,"utf-8":Og,hex:Ig.base16,latin1:zu,ascii:zu,binary:zu},Ig);function M4(r,e="utf8"){const t=L4[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Dg(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}const Cg="wc",U4=2,qu="core",li=`${Cg}@2:${qu}:`,j4={name:qu,logger:"error"},F4={database:":memory:"},B4="crypto",$g="client_ed25519_seed",k4=me.ONE_DAY,z4="keychain",q4="0.3",H4="messages",W4="0.3",K4=me.SIX_HOURS,V4="publisher",Ag="irn",G4="error",Pg="wss://relay.walletconnect.com",Tg="wss://relay.walletconnect.org",Y4="relayer",Wr={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},Z4="_subscription",tn={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},J4=me.ONE_SECOND,Q4="2.11.3-canary-0ff236b6",X4=1e4,e8="0.3",t8="WALLETCONNECT_CLIENT_ID",Dn={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},r8="subscription",n8="0.3",i8=me.FIVE_SECONDS*1e3,s8="pairing",o8="0.3",zo={wc_pairingDelete:{req:{ttl:me.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:me.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:me.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:me.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:me.ONE_DAY,prompt:!1,tag:0},res:{ttl:me.ONE_DAY,prompt:!1,tag:0}}},Rs={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},mn={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},a8="history",c8="0.3",l8="expirer",rn={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},u8="0.3",Hu="verify-api",Ns="https://verify.walletconnect.com",Wu="https://verify.walletconnect.org",h8=[Ns,Wu],f8="echo",d8="https://echo.walletconnect.com";class p8{constructor(e,t){this.core=e,this.logger=t,this.keychain=new Map,this.name=z4,this.version=q4,this.initialized=!1,this.storagePrefix=li,this.init=async()=>{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:a}=ue("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(a)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=Hr(t,this.name)}get context(){return qr(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,o0(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?a0(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}}class g8{constructor(e,t,n){this.core=e,this.logger=t,this.name=B4,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),a=V0(i);return K0(a.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=d_();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const a=await this.getClientSeed(),c=V0(a),u=gu();return await wE(u,i,k4,c)},this.generateSharedKey=(i,a,c)=>{this.isInitialized();const u=this.getPrivateKey(i),f=p_(u,a);return this.setSymKey(f,c)},this.setSymKey=async(i,a)=>{this.isInitialized();const c=a||g_(i);return await this.keychain.set(c,i),c},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,a,c)=>{this.isInitialized();const u=t0(c),f=Mn(a);if(r0(u)){const y=u.senderPublicKey,b=u.receiverPublicKey;i=await this.generateSharedKey(y,b)}const h=this.getSymKey(i),{type:m,senderPublicKey:w}=u;return v_({type:m,symKey:h,message:f,senderPublicKey:w})},this.decode=async(i,a,c)=>{this.isInitialized();const u=b_(a,c);if(r0(u)){const f=u.receiverPublicKey,h=u.senderPublicKey;i=await this.generateSharedKey(f,h)}try{const f=this.getSymKey(i),h=y_({symKey:f,encoded:a});return No(h)}catch(f){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(f)}},this.getPayloadType=i=>{const a=za(i);return So(a.type)},this.getPayloadSenderPublicKey=i=>{const a=za(i);return a.senderPublicKey?vr(a.senderPublicKey,yr):void 0},this.core=e,this.logger=Hr(t,this.name),this.keychain=n||new p8(this.core,this.logger)}get context(){return qr(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get($g)}catch{e=gu(),await this.keychain.set($g,e)}return M4(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}}class m8 extends Z5{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=H4,this.version=W4,this.initialized=!1,this.storagePrefix=li,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const a=Ds(i);let c=this.messages.get(n);return typeof c>"u"&&(c={}),typeof c[a]<"u"||(c[a]=i,this.messages.set(n,c),await this.persist()),a},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const a=this.get(n),c=Ds(i);return typeof a[c]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Hr(e,this.name),this.core=t}get context(){return qr(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,o0(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?a0(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}}class v8 extends J5{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new cr.exports.EventEmitter,this.name=V4,this.queue=new Map,this.publishTimeout=me.toMiliseconds(me.ONE_MINUTE),this.failedPublishTimeout=me.toMiliseconds(me.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(n,i,a)=>{var c;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:a}});const u=a?.ttl||K4,f=vu(a),h=a?.prompt||!1,m=a?.tag||0,w=a?.id||Hi().toString(),y={topic:n,message:i,opts:{ttl:u,relay:f,prompt:h,tag:m,id:w}},b=`Failed to publish payload, please try again. id:${w} tag:${m}`,I=Date.now();let A,U=1;try{for(;A===void 0;){if(Date.now()-I>this.publishTimeout)throw new Error(b);this.logger.trace({id:w,attempts:U},`publisher.publish - attempt ${U}`),A=await await $o(this.rpcPublish(n,i,u,f,h,m,w).catch(j=>this.logger.warn(j)),this.publishTimeout,b),U++,A||await new Promise(j=>setTimeout(j,this.failedPublishTimeout))}this.relayer.events.emit(Wr.publish,y),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:w,topic:n,message:i,opts:a}})}catch(j){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(j),(c=a?.internal)!=null&&c.throwOnFailedPublish)throw j;this.queue.set(w,y)}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=Hr(t,this.name),this.registerEventListeners()}get context(){return qr(this.logger)}rpcPublish(e,t,n,i,a,c,u){var f,h,m,w;const y={method:qa(i.protocol).publish,params:{topic:e,message:t,ttl:n,prompt:a,tag:c},id:u};return wr((f=y.params)==null?void 0:f.prompt)&&((h=y.params)==null||delete h.prompt),wr((m=y.params)==null?void 0:m.tag)&&((w=y.params)==null||delete w.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:y}),this.relayer.request(y)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:t,message:n,opts:i}=e;await this.publish(t,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(As.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Wr.connection_stalled);return}this.checkQueue()}),this.relayer.on(Wr.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class y8{constructor(){this.map=new Map,this.set=(e,t)=>{const n=this.get(e);this.exists(e,t)||this.map.set(e,[...n,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,t))return;const i=n.filter(a=>a!==t);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var w8=Object.defineProperty,b8=Object.defineProperties,_8=Object.getOwnPropertyDescriptors,Rg=Object.getOwnPropertySymbols,E8=Object.prototype.hasOwnProperty,x8=Object.prototype.propertyIsEnumerable,Ng=(r,e,t)=>e in r?w8(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,qo=(r,e)=>{for(var t in e||(e={}))E8.call(e,t)&&Ng(r,t,e[t]);if(Rg)for(var t of Rg(e))x8.call(e,t)&&Ng(r,t,e[t]);return r},Ku=(r,e)=>b8(r,_8(e));class I8 extends eE{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new y8,this.events=new cr.exports.EventEmitter,this.name=r8,this.version=n8,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=li,this.subscribeTimeout=me.toMiliseconds(me.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const a=vu(i),c={topic:n,relay:a};this.pending.set(n,c);const u=await this.rpcSubscribe(n,a);return typeof u=="string"&&(this.onSubscribe(u,c),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}})),u}catch(a){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(a),a}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((a,c)=>{const u=new me.Watch;u.start(i);const f=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(f),u.stop(i),a(!0)),u.elapsed(i)>=i8&&(clearInterval(f),u.stop(i),c(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Hr(t,this.name),this.clientId=""}get context(){return qr(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let n=!1;try{n=this.getSubscription(e).topic===t}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,t)))}async unsubscribeById(e,t,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:n}});try{const i=vu(n);await this.rpcUnsubscribe(e,t,i);const a=Et("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,a),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,t){const n={method:qa(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await $o(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)?Ds(e+this.clientId):null}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Wr.connection_stalled)}return null}async rpcBatchSubscribe(e){if(!e.length)return;const t=e[0].relay,n={method:qa(t.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await $o(this.relayer.request(n).catch(i=>this.logger.warn(i)),this.subscribeTimeout)}catch{this.relayer.events.emit(Wr.connection_stalled)}}rpcUnsubscribe(e,t,n){const i={method:qa(n.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,t){this.setSubscription(e,Ku(qo({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(t=>{this.setSubscription(t.id,qo({},t)),this.pending.delete(t.topic)})}async onUnsubscribe(e,t,n){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,qo({},t)),this.topicMap.set(t.topic,e),this.events.emit(Dn.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:n}=ue("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Dn.deleted,Ku(qo({},n),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Dn.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t<e;t++){const n=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(n)}}this.events.emit(Dn.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:t}=ue("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const t=await this.rpcBatchSubscribe(e);In(t)&&this.onBatchSubscribe(t.map((n,i)=>Ku(qo({},e[i]),{id:n})))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(t=>{e.push(t)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(As.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.events.on(Dn.created,async e=>{const t=Dn.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(Dn.deleted,async e=>{const t=Dn.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.restartInProgress||(clearInterval(t),e())},this.pollingInterval)})}}var D8=Object.defineProperty,Lg=Object.getOwnPropertySymbols,S8=Object.prototype.hasOwnProperty,O8=Object.prototype.propertyIsEnumerable,Mg=(r,e,t)=>e in r?D8(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,C8=(r,e)=>{for(var t in e||(e={}))S8.call(e,t)&&Mg(r,t,e[t]);if(Lg)for(var t of Lg(e))O8.call(e,t)&&Mg(r,t,e[t]);return r};class $8 extends Q5{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new cr.exports.EventEmitter,this.name=Y4,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=me.toMiliseconds(me.THIRTY_SECONDS+me.ONE_SECOND),this.request=async t=>{var n,i;this.logger.debug("Publishing Request Payload");const a=t.id||Hi().toString();await this.toEstablishConnection();try{const c=this.provider.request(t);this.requestsInFlight.set(a,{promise:c,request:t}),this.logger.trace({id:a,method:t.method,topic:(n=t.params)==null?void 0:n.topic},"relayer.request - attempt to publish...");const u=await new Promise(async(f,h)=>{const m=()=>{h(new Error(`relayer.request - publish interrupted, id: ${a}`))};this.provider.on(tn.disconnect,m);const w=await c;this.provider.off(tn.disconnect,m),f(w)});return this.logger.trace({id:a,method:t.method,topic:(i=t.params)==null?void 0:i.topic},"relayer.request - published"),u}catch(c){throw this.logger.debug(`Failed to Publish Request: ${a}`),c}finally{this.requestsInFlight.delete(a)}},this.resetPingTimeout=()=>{if(Oo())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var t,n,i;(i=(n=(t=this.provider)==null?void 0:t.connection)==null?void 0:n.socket)==null||i.terminate()},this.heartBeatTimeout)}catch(t){this.logger.warn(t)}},this.onPayloadHandler=t=>{this.onProviderPayload(t),this.resetPingTimeout()},this.onConnectHandler=()=>{this.startPingTimeout(),this.events.emit(Wr.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=t=>{this.logger.error(t),this.events.emit(Wr.error,t),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(tn.payload,this.onPayloadHandler),this.provider.on(tn.connect,this.onConnectHandler),this.provider.on(tn.disconnect,this.onDisconnectHandler),this.provider.on(tn.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Hr(e.logger,this.name):ci(k0({level:e.logger||G4})),this.messages=new m8(this.logger,e.core),this.subscriber=new I8(this,this.logger),this.publisher=new v8(this,this.logger),this.relayUrl=e?.relayUrl||Pg,this.projectId=e.projectId,this.bundleId=S_(),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${Tg}...`),await this.restartTransport(Tg)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&this.subscriber.pending.size===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},X4)}get context(){return qr(this.logger)}get connected(){var e,t,n;return((n=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:n.readyState)===1}get connecting(){var e,t,n;return((n=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:n.readyState)===0}async publish(e,t,n){this.isInitialized(),await this.publisher.publish(e,t,n),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now()})}async subscribe(e,t){var n;this.isInitialized();let i=((n=this.subscriber.topicMap.get(e))==null?void 0:n[0])||"",a;const c=u=>{u.topic===e&&(this.subscriber.off(Dn.created,c),a())};return await Promise.all([new Promise(u=>{a=u,this.subscriber.on(Dn.created,c)}),new Promise(async u=>{i=await this.subscriber.subscribe(e,t)||i,u()})]),i}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.hasExperiencedNetworkDisruption||this.connected?await $o(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect(),await this.createProvider()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(t,n)=>{const i=()=>{this.provider.off(tn.disconnect,i),n(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(tn.disconnect,i),await $o(this.provider.connect(),me.toMiliseconds(me.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(a=>{n(a)}),await this.subscriber.start(),this.hasExperiencedNetworkDisruption=!1,t()})}catch(t){this.logger.error(t);const n=t;if(!this.isConnectionStalled(n.message))throw t}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await w0())throw new Error("No internet connection detected. Please restart your network and try again.")}startPingTimeout(){var e,t,n,i,a;if(Oo())try{(t=(e=this.provider)==null?void 0:e.connection)!=null&&t.socket&&((a=(i=(n=this.provider)==null?void 0:n.connection)==null?void 0:i.socket)==null||a.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(c){this.logger.warn(c)}}isConnectionStalled(e){return this.staleConnectionErrors.some(t=>e.includes(t))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Bn(new a6(T_({sdkVersion:Q4,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:n}=e;await this.messages.set(t,n)}async shouldIgnoreMessageEvent(e){const{topic:t,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const i=this.messages.has(t,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),ju(e)){if(!e.method.endsWith(Z4))return;const t=e.params,{topic:n,message:i,publishedAt:a}=t.data,c={topic:n,message:i,publishedAt:a};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(C8({type:"event",event:t.id},c)),this.events.emit(t.id,c),await this.acknowledgePayload(e),await this.onMessageEvent(c)}else tc(e)&&this.events.emit(Wr.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Wr.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=Xa(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(tn.payload,this.onPayloadHandler),this.provider.off(tn.connect,this.onConnectHandler),this.provider.off(tn.disconnect,this.onDisconnectHandler),this.provider.off(tn.error,this.onProviderErrorHandler)}async registerEventListeners(){let e=await w0();S3(async t=>{e!==t&&(e=t,t?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.events.emit(Wr.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},me.toMiliseconds(J4))}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.connected&&(clearInterval(t),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var A8=Object.defineProperty,Ug=Object.getOwnPropertySymbols,P8=Object.prototype.hasOwnProperty,T8=Object.prototype.propertyIsEnumerable,jg=(r,e,t)=>e in r?A8(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Fg=(r,e)=>{for(var t in e||(e={}))P8.call(e,t)&&jg(r,t,e[t]);if(Ug)for(var t of Ug(e))T8.call(e,t)&&jg(r,t,e[t]);return r};class nc extends X5{constructor(e,t,n,i=li,a=void 0){super(e,t,n,i),this.core=e,this.logger=t,this.name=n,this.map=new Map,this.version=e8,this.cached=[],this.initialized=!1,this.storagePrefix=li,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(c=>{this.getKey&&c!==null&&!wr(c)?this.map.set(this.getKey(c),c):n3(c)?this.map.set(c.id,c):i3(c)&&this.map.set(c.topic,c)}),this.cached=[],this.initialized=!0)},this.set=async(c,u)=>{this.isInitialized(),this.map.has(c)?await this.update(c,u):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:c,value:u}),this.map.set(c,u),await this.persist())},this.get=c=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:c}),this.getData(c)),this.getAll=c=>(this.isInitialized(),c?this.values.filter(u=>Object.keys(c).every(f=>c6(u[f],c[f]))):this.values),this.update=async(c,u)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:c,update:u});const f=Fg(Fg({},this.getData(c)),u);this.map.set(c,f),await this.persist()},this.delete=async(c,u)=>{this.isInitialized(),this.map.has(c)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:c,reason:u}),this.map.delete(c),this.addToRecentlyDeleted(c),await this.persist())},this.logger=Hr(t,this.name),this.storagePrefix=i,this.getKey=a}get context(){return qr(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){const{message:i}=ue("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}const{message:n}=ue("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:t}=ue("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}}class R8{constructor(e,t){this.core=e,this.logger=t,this.name=s8,this.version=o8,this.events=new cr.exports,this.initialized=!1,this.storagePrefix=li,this.ignoredPayloadTypes=[Fi],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async()=>{this.isInitialized();const n=gu(),i=await this.core.crypto.setSymKey(n),a=zr(me.FIVE_MINUTES),c={protocol:Ag},u={topic:i,expiry:a,relay:c,active:!1},f=G_({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:n,relay:c,expiryTimestamp:a});return await this.pairings.set(i,u),await this.core.relayer.subscribe(i),this.core.expirer.set(i,a),{topic:i,uri:f}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);const{topic:i,symKey:a,relay:c,expiryTimestamp:u}=f0(n.uri);let f;if(this.pairings.keys.includes(i)&&(f=this.pairings.get(i),f.active))throw new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);const h=u||zr(me.FIVE_MINUTES),m={topic:i,relay:c,expiry:h,active:!1};return await this.pairings.set(i,m),this.core.expirer.set(i,h),n.activatePairing&&await this.activate({topic:i}),this.events.emit(Rs.create,m),this.core.crypto.keychain.has(i)||await this.core.crypto.setSymKey(a,i),await this.core.relayer.subscribe(i,{relay:c}),m},this.activate=async({topic:n})=>{this.isInitialized();const i=zr(me.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:i}),this.core.expirer.set(n,i)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const a=await this.sendRequest(i,"wc_pairingPing",{}),{done:c,resolve:u,reject:f}=Cs();this.events.once(pt("pairing_ping",a),({error:h})=>{h?f(h):u()}),await c()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",Et("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,a)=>{const c=Ts(i,a),u=await this.core.crypto.encode(n,c),f=zo[i].req;return this.core.history.set(n,c),this.core.relayer.publish(n,u,f),c.id},this.sendResult=async(n,i,a)=>{const c=Xa(n,a),u=await this.core.crypto.encode(i,c),f=await this.core.history.get(i,n),h=zo[f.request.method].res;await this.core.relayer.publish(i,u,h),await this.core.history.resolve(c)},this.sendError=async(n,i,a)=>{const c=ec(n,a),u=await this.core.crypto.encode(i,c),f=await this.core.history.get(i,n),h=zo[f.request.method]?zo[f.request.method].res:zo.unregistered_method.res;await this.core.relayer.publish(i,u,h),await this.core.history.resolve(c)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,Et("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>ai(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:a}=n;switch(a.method){case"wc_pairingPing":return this.onPairingPingRequest(i,a);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,a);default:return this.onUnknownRpcMethodRequest(i,a)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:a}=n,c=(await this.core.history.get(i,a.id)).request.method;switch(c){case"wc_pairingPing":return this.onPairingPingResponse(i,a);default:return this.onUnknownRpcMethodResponse(c)}},this.onPairingPingRequest=async(n,i)=>{const{id:a}=i;try{this.isValidPing({topic:n}),await this.sendResult(a,n,!0),this.events.emit(Rs.ping,{id:a,topic:n})}catch(c){await this.sendError(a,n,c),this.logger.error(c)}},this.onPairingPingResponse=(n,i)=>{const{id:a}=i;setTimeout(()=>{Fn(i)?this.events.emit(pt("pairing_ping",a),{}):gn(i)&&this.events.emit(pt("pairing_ping",a),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:a}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(Rs.delete,{id:a,topic:n})}catch(c){await this.sendError(a,n,c),this.logger.error(c)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:a,method:c}=i;try{if(this.registeredMethods.includes(c))return;const u=Et("WC_METHOD_UNSUPPORTED",c);await this.sendError(a,n,u),this.logger.error(u)}catch(u){await this.sendError(a,n,u),this.logger.error(u)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(Et("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{var i;if(!Ar(n)){const{message:c}=ue("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(c)}if(!r3(n.uri)){const{message:c}=ue("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(c)}const a=f0(n.uri);if(!((i=a?.relay)!=null&&i.protocol)){const{message:c}=ue("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(c)}if(!(a!=null&&a.symKey)){const{message:c}=ue("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(c)}if(a!=null&&a.expiryTimestamp&&me.toMiliseconds(a?.expiryTimestamp)<Date.now()){const{message:c}=ue("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(c)}},this.isValidPing=async n=>{if(!Ar(n)){const{message:a}=ue("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(a)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!Ar(n)){const{message:a}=ue("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(a)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!nr(n,!1)){const{message:i}=ue("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=ue("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ai(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=ue("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=Hr(t,this.name),this.pairings=new nc(this.core,this.logger,this.name,this.storagePrefix)}get context(){return qr(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Wr.message,async e=>{const{topic:t,message:n}=e;if(!this.pairings.keys.includes(t)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const i=await this.core.crypto.decode(t,n);try{ju(i)?(this.core.history.set(t,i),this.onRelayEventRequest({topic:t,payload:i})):tc(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:t,payload:i}),this.core.history.delete(t,i.id))}catch(a){this.logger.error(a)}})}registerExpirerEvents(){this.core.expirer.on(rn.expired,async e=>{const{topic:t}=l0(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(Rs.expire,{topic:t}))})}}class N8 extends Y5{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new cr.exports.EventEmitter,this.name=a8,this.version=c8,this.cached=[],this.initialized=!1,this.storagePrefix=li,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,a)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:a}),this.records.has(i.id))return;const c={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:a,expiry:zr(me.THIRTY_DAYS)};this.records.set(c.id,c),this.persist(),this.events.emit(mn.created,c)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=gn(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.persist(),this.events.emit(mn.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(a=>{if(a.topic===n){if(typeof i<"u"&&a.id!==i)return;this.records.delete(a.id),this.events.emit(mn.deleted,a)}}),this.persist()},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Hr(t,this.name)}get context(){return qr(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(t=>{if(typeof t.response<"u")return;const n={topic:t.topic,request:Ts(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:n}=ue("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(mn.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:t}=ue("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(mn.created,e=>{const t=mn.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(mn.updated,e=>{const t=mn.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(mn.deleted,e=>{const t=mn.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.core.heartbeat.on(As.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(t=>{me.toMiliseconds(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(mn.deleted,t,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}}class L8 extends tE{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new cr.exports.EventEmitter,this.name=l8,this.version=u8,this.cached=[],this.initialized=!1,this.storagePrefix=li,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const a=this.formatTarget(n),c={target:a,expiry:i};this.expirations.set(a,c),this.checkExpiry(a,c),this.events.emit(rn.created,{target:a,expiration:c})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),a=this.getExpiration(i);this.expirations.delete(i),this.events.emit(rn.deleted,{target:i,expiration:a})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Hr(t,this.name)}get context(){return qr(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return R_(e);if(typeof e=="number")return N_(e);const{message:t}=ue("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(rn.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:t}=ue("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:n}=ue("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(n),new Error(n)}return t}checkExpiry(e,t){const{expiry:n}=t;me.toMiliseconds(n)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(rn.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(As.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(rn.created,e=>{const t=rn.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(rn.expired,e=>{const t=rn.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(rn.deleted,e=>{const t=rn.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}}class M8 extends rE{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.name=Hu,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async n=>{if(this.verifyDisabled||Ss()||!Os())return;const i=this.getVerifyUrl(n?.verifyUrl);this.verifyUrl!==i&&this.removeIframe(),this.verifyUrl=i;try{await this.createIframe()}catch(a){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(a)}if(!this.initialized){this.removeIframe(),this.verifyUrl=Wu;try{await this.createIframe()}catch(a){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(a),this.verifyDisabled=!0}}},this.register=async n=>{this.initialized?this.sendPost(n.attestationId):(this.addToQueue(n.attestationId),await this.init())},this.resolve=async n=>{if(this.isDevEnv)return"";const i=this.getVerifyUrl(n?.verifyUrl);let a;try{a=await this.fetchAttestation(n.attestationId,i)}catch(c){this.logger.info(`failed to resolve attestation: ${n.attestationId} from url: ${i}`),this.logger.info(c),a=await this.fetchAttestation(n.attestationId,Wu)}return a},this.fetchAttestation=async(n,i)=>{this.logger.info(`resolving attestation: ${n} from url: ${i}`);const a=this.startAbortTimer(me.ONE_SECOND*2),c=await fetch(`${i}/attestation/${n}`,{signal:this.abortController.signal});return clearTimeout(a),c.status===200?await c.json():void 0},this.addToQueue=n=>{this.queue.push(n)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(n=>this.sendPost(n)),this.queue=[])},this.sendPost=n=>{var i;try{if(!this.iframe)return;(i=this.iframe.contentWindow)==null||i.postMessage(n,"*"),this.logger.info(`postMessage sent: ${n} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let n;const i=a=>{a.data==="verify_ready"&&(this.onInit(),window.removeEventListener("message",i),n())};await Promise.race([new Promise(a=>{const c=document.getElementById(Hu);if(c)return this.iframe=c,this.onInit(),a();window.addEventListener("message",i);const u=document.createElement("iframe");u.id=Hu,u.src=`${this.verifyUrl}/${this.projectId}`,u.style.display="none",document.body.append(u),this.iframe=u,n=a}),new Promise((a,c)=>setTimeout(()=>{window.removeEventListener("message",i),c("verify iframe load timeout")},me.toMiliseconds(me.FIVE_SECONDS)))])},this.onInit=()=>{this.initialized=!0,this.processQueue()},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=n=>{let i=n||Ns;return h8.includes(i)||(this.logger.info(`verify url: ${i}, not included in trusted list, assigning default: ${Ns}`),i=Ns),i},this.logger=Hr(t,this.name),this.verifyUrl=Ns,this.abortController=new AbortController,this.isDevEnv=Oo()&&process.env.IS_VITEST}get context(){return qr(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),me.toMiliseconds(e))}}class U8 extends nE{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.context=f8,this.registerDeviceToken=async n=>{const{clientId:i,token:a,notificationType:c,enableEncrypted:u=!1}=n,f=`${d8}/${this.projectId}/clients`;await h6(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:c,token:a,always_raw:u})})},this.logger=Hr(t,this.context)}}var j8=Object.defineProperty,Bg=Object.getOwnPropertySymbols,F8=Object.prototype.hasOwnProperty,B8=Object.prototype.propertyIsEnumerable,kg=(r,e,t)=>e in r?j8(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,zg=(r,e)=>{for(var t in e||(e={}))F8.call(e,t)&&kg(r,t,e[t]);if(Bg)for(var t of Bg(e))B8.call(e,t)&&kg(r,t,e[t]);return r};class Vu extends G5{constructor(e){var t;super(e),this.protocol=Cg,this.version=U4,this.name=qu,this.events=new cr.exports.EventEmitter,this.initialized=!1,this.on=(c,u)=>this.events.on(c,u),this.once=(c,u)=>this.events.once(c,u),this.off=(c,u)=>this.events.off(c,u),this.removeListener=(c,u)=>this.events.removeListener(c,u),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||Pg,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const n=k0({level:typeof e?.logger=="string"&&e.logger?e.logger:j4.logger}),{logger:i,chunkLoggerController:a}=V5({opts:n,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=a,(t=this.logChunkController)!=null&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var c,u;(c=this.logChunkController)!=null&&c.downloadLogsBlobInBrowser&&((u=this.logChunkController)==null||u.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Hr(i,this.name),this.heartbeat=new As.HeartBeat,this.crypto=new g8(this,this.logger,e?.keychain),this.history=new N8(this,this.logger),this.expirer=new L8(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new o5(zg(zg({},F4),e?.storageOptions)),this.relayer=new $8({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new R8(this,this.logger),this.verify=new M8(this.projectId||"",this.logger),this.echoClient=new U8(this.projectId||"",this.logger)}static async init(e){const t=new Vu(e);await t.initialize();const n=await t.crypto.getClientId();return await t.storage.setItem(t8,n),t}get context(){return qr(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const k8=Vu;var Wi={};/*! *****************************************************************************
|
|
47
47
|
Copyright (c) Microsoft Corporation.
|
|
48
48
|
|
|
49
49
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -56,84 +56,84 @@
|
|
|
56
56
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
57
57
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
58
58
|
PERFORMANCE OF THIS SOFTWARE.
|
|
59
|
-
***************************************************************************** */var Ou=function(r,e){return Ou=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},Ou(r,e)};function _6(r,e){Ou(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var $u=function(){return $u=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},$u.apply(this,arguments)};function E6(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function x6(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var u=r.length-1;u>=0;u--)(c=r[u])&&(a=(i<3?c(a):i>3?c(e,t,a):c(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a}function I6(r,e){return function(t,n){e(t,n,r)}}function D6(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function S6(r,e,t,n){function i(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function u(m){try{h(n.next(m))}catch(w){c(w)}}function f(m){try{h(n.throw(m))}catch(w){c(w)}}function h(m){m.done?a(m.value):i(m.value).then(u,f)}h((n=n.apply(r,e||[])).next())})}function C6(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,c;return c={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(h){return function(m){return f([h,m])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(a=h[0]&2?i.return:h[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,h[1])).done)return a;switch(i=0,a&&(h=[h[0]&2,a.value]),h[0]){case 0:case 1:a=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,i=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!a||h[1]>a[0]&&h[1]<a[3])){t.label=h[1];break}if(h[0]===6&&t.label<a[1]){t.label=a[1],a=h;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(h);break}a[2]&&t.ops.pop(),t.trys.pop();continue}h=e.call(r,t)}catch(m){h=[6,m],i=0}finally{n=a=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function O6(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}function $6(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function Au(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function qp(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,a=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(u){c={error:u}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(c)throw c.error}}return a}function A6(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(qp(arguments[e]));return r}function P6(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),i=0,e=0;e<t;e++)for(var a=arguments[e],c=0,u=a.length;c<u;c++,i++)n[i]=a[c];return n}function Po(r){return this instanceof Po?(this.v=r,this):new Po(r)}function T6(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(y){n[y]&&(i[y]=function(x){return new Promise(function(S,P){a.push([y,x,S,P])>1||u(y,x)})})}function u(y,x){try{f(n[y](x))}catch(S){w(a[0][3],S)}}function f(y){y.value instanceof Po?Promise.resolve(y.value.v).then(h,m):w(a[0][2],y)}function h(y){u("next",y)}function m(y){u("throw",y)}function w(y,x){y(x),a.shift(),a.length&&u(a[0][0],a[0][1])}}function R6(r){var e,t;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,a){e[i]=r[i]?function(c){return(t=!t)?{value:Po(r[i](c)),done:i==="return"}:a?a(c):c}:a}}function N6(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof Au=="function"?Au(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(c){return new Promise(function(u,f){c=r[a](c),i(u,f,c.done,c.value)})}}function i(a,c,u,f){Promise.resolve(f).then(function(h){a({value:h,done:u})},c)}}function L6(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function M6(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function U6(r){return r&&r.__esModule?r:{default:r}}function j6(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function F6(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var B6=Object.freeze({__proto__:null,__extends:_6,get __assign(){return $u},__rest:E6,__decorate:x6,__param:I6,__metadata:D6,__awaiter:S6,__generator:C6,__createBinding:O6,__exportStar:$6,__values:Au,__read:qp,__spread:A6,__spreadArrays:P6,__await:Po,__asyncGenerator:T6,__asyncDelegator:R6,__asyncValues:N6,__makeTemplateObject:L6,__importStar:M6,__importDefault:U6,__classPrivateFieldGet:j6,__classPrivateFieldSet:F6}),k6=Pi(B6),Nn={},zp;function q6(){if(zp)return Nn;zp=1,Object.defineProperty(Nn,"__esModule",{value:!0}),Nn.isBrowserCryptoAvailable=Nn.getSubtleCrypto=Nn.getBrowerCrypto=void 0;function r(){return yr?.crypto||yr?.msCrypto||{}}Nn.getBrowerCrypto=r;function e(){const n=r();return n.subtle||n.webkitSubtle}Nn.getSubtleCrypto=e;function t(){return!!r()&&!!e()}return Nn.isBrowserCryptoAvailable=t,Nn}var Ln={},Hp;function z6(){if(Hp)return Ln;Hp=1,Object.defineProperty(Ln,"__esModule",{value:!0}),Ln.isBrowser=Ln.isNode=Ln.isReactNative=void 0;function r(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Ln.isReactNative=r;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Ln.isNode=e;function t(){return!r()&&!e()}return Ln.isBrowser=t,Ln}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const e=k6;e.__exportStar(q6(),r),e.__exportStar(z6(),r)})(kp);function Pu(r=3){const e=Date.now()*Math.pow(10,r),t=Math.floor(Math.random()*Math.pow(10,r));return e+t}function Wp(r=6){return BigInt(Pu(r))}function Ss(r,e,t){return{id:t||Pu(),jsonrpc:"2.0",method:r,params:e}}function za(r,e){return{id:r,jsonrpc:"2.0",result:e}}function Ha(r,e,t){return{id:r,jsonrpc:"2.0",error:H6(e,t)}}function H6(r,e){return typeof r>"u"?Fp(Up):(typeof r=="string"&&(r=Object.assign(Object.assign({},Fp(Cu)),{message:r})),typeof e<"u"&&(r.data=e),w6(r.code)&&(r=b6(r.code)),r)}class W6{}class K6 extends W6{constructor(){super()}}class V6 extends K6{constructor(e){super()}}const G6="^https?:",Y6="^wss?:";function J6(r){const e=r.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function Kp(r,e){const t=J6(r);return typeof t>"u"?!1:new RegExp(e).test(t)}function Vp(r){return Kp(r,G6)}function Gp(r){return Kp(r,Y6)}function Z6(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}function Yp(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function Tu(r){return Yp(r)&&"method"in r}function Wa(r){return Yp(r)&&(Mn(r)||dn(r))}function Mn(r){return"result"in r}function dn(r){return"error"in r}class Un extends V6{constructor(e){super(e),this.events=new lr.exports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(Ss(e.method,e.params||[],e.id||Wp().toString()),t)}async requestStrict(e,t){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(a){i(a)}this.events.on(`${e.id}`,a=>{dn(a)?i(a.error):n(a.result)});try{await this.connection.send(e,t)}catch(a){i(a)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Wa(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}}const Q6=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),X6=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",Jp=r=>r.split("?")[0],Zp=10,eE=Q6();class tE{constructor(e){if(this.url=e,this.events=new lr.exports.EventEmitter,this.registering=!1,!Gp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>{if(typeof this.socket>"u"){t(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(ji(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!Gp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((n,i)=>{this.events.once("register_error",a=>{this.resetMaxListeners(),i(a)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,n)=>{const i=new URLSearchParams(e).get("origin"),a=kp.isReactNative()?{headers:{origin:i}}:{rejectUnauthorized:!Z6(e)},c=new eE(e,[],a);X6()?c.onerror=u=>{const f=u;n(this.emitError(f.error))}:c.on("error",u=>{n(this.emitError(u))}),c.onopen=()=>{this.onOpen(c),t(c)}})}onOpen(e){e.onmessage=t=>this.onPayload(t),e.onclose=t=>this.onClose(t),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?Do(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const n=this.parseError(t),i=n.message||n.toString(),a=Ha(e,i);this.events.emit("payload",a)}parseError(e,t=this.url){return Bp(e,Jp(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>Zp&&this.events.setMaxListeners(Zp)}emitError(e){const t=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${Jp(this.url)}`));return this.events.emit("register_error",t),t}}var Ru={exports:{}};(function(r,e){var t=200,n="__lodash_hash_undefined__",i=1,a=2,c=9007199254740991,u="[object Arguments]",f="[object Array]",h="[object AsyncFunction]",m="[object Boolean]",w="[object Date]",y="[object Error]",x="[object Function]",S="[object GeneratorFunction]",P="[object Map]",U="[object Number]",j="[object Null]",A="[object Object]",T="[object Promise]",C="[object Proxy]",$="[object RegExp]",E="[object Set]",d="[object String]",b="[object Symbol]",H="[object Undefined]",F="[object WeakMap]",V="[object ArrayBuffer]",se="[object DataView]",ce="[object Float32Array]",I="[object Float64Array]",N="[object Int8Array]",X="[object Int16Array]",ee="[object Int32Array]",Y="[object Uint8Array]",J="[object Uint8ClampedArray]",Q="[object Uint16Array]",ie="[object Uint32Array]",Ee=/[\\^$.*+?()[\]{}|]/g,ae=/^\[object .+?Constructor\]$/,xe=/^(?:0|[1-9]\d*)$/,de={};de[ce]=de[I]=de[N]=de[X]=de[ee]=de[Y]=de[J]=de[Q]=de[ie]=!0,de[u]=de[f]=de[V]=de[m]=de[se]=de[w]=de[y]=de[x]=de[P]=de[U]=de[A]=de[$]=de[E]=de[d]=de[F]=!1;var be=typeof yr=="object"&&yr&&yr.Object===Object&&yr,K=typeof self=="object"&&self&&self.Object===Object&&self,W=be||K||Function("return this")(),B=e&&!e.nodeType&&e,g=B&&!0&&r&&!r.nodeType&&r,L=g&&g.exports===B,le=L&&be.process,pe=function(){try{return le&&le.binding&&le.binding("util")}catch{}}(),Ce=pe&&pe.isTypedArray;function Ke(O,k){for(var ne=-1,ge=O==null?0:O.length,vt=0,Ne=[];++ne<ge;){var Et=O[ne];k(Et,ne,O)&&(Ne[vt++]=Et)}return Ne}function Je(O,k){for(var ne=-1,ge=k.length,vt=O.length;++ne<ge;)O[vt+ne]=k[ne];return O}function ke(O,k){for(var ne=-1,ge=O==null?0:O.length;++ne<ge;)if(k(O[ne],ne,O))return!0;return!1}function St(O,k){for(var ne=-1,ge=Array(O);++ne<O;)ge[ne]=k(ne);return ge}function Ct(O){return function(k){return O(k)}}function ze(O,k){return O.has(k)}function Oe(O,k){return O?.[k]}function Ue(O){var k=-1,ne=Array(O.size);return O.forEach(function(ge,vt){ne[++k]=[vt,ge]}),ne}function je(O,k){return function(ne){return O(k(ne))}}function He(O){var k=-1,ne=Array(O.size);return O.forEach(function(ge){ne[++k]=ge}),ne}var Ae=Array.prototype,Fe=Function.prototype,Se=Object.prototype,Te=W["__core-js_shared__"],Ve=Fe.toString,$e=Se.hasOwnProperty,Ze=function(){var O=/[^.]+$/.exec(Te&&Te.keys&&Te.keys.IE_PROTO||"");return O?"Symbol(src)_1."+O:""}(),et=Se.toString,at=RegExp("^"+Ve.call($e).replace(Ee,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ct=L?W.Buffer:void 0,nt=W.Symbol,Sr=W.Uint8Array,Ur=Se.propertyIsEnumerable,On=Ae.splice,Cr=nt?nt.toStringTag:void 0,Wn=Object.getOwnPropertySymbols,bi=ct?ct.isBuffer:void 0,rs=je(Object.keys,Object),Lt=Gr(W,"DataView"),Ot=Gr(W,"Map"),Mt=Gr(W,"Promise"),Ut=Gr(W,"Set"),Tt=Gr(W,"WeakMap"),$t=Gr(Object,"create"),Gt=Vn(Lt),Yt=Vn(Ot),jt=Vn(Mt),Jt=Vn(Ut),Ft=Vn(Tt),Ht=nt?nt.prototype:void 0,Bt=Ht?Ht.valueOf:void 0;function _t(O){var k=-1,ne=O==null?0:O.length;for(this.clear();++k<ne;){var ge=O[k];this.set(ge[0],ge[1])}}function Zt(){this.__data__=$t?$t(null):{},this.size=0}function Qt(O){var k=this.has(O)&&delete this.__data__[O];return this.size-=k?1:0,k}function lf(O){var k=this.__data__;if($t){var ne=k[O];return ne===n?void 0:ne}return $e.call(k,O)?k[O]:void 0}function uf(O){var k=this.__data__;return $t?k[O]!==void 0:$e.call(k,O)}function hf(O,k){var ne=this.__data__;return this.size+=this.has(O)?0:1,ne[O]=$t&&k===void 0?n:k,this}_t.prototype.clear=Zt,_t.prototype.delete=Qt,_t.prototype.get=lf,_t.prototype.has=uf,_t.prototype.set=hf;function rn(O){var k=-1,ne=O==null?0:O.length;for(this.clear();++k<ne;){var ge=O[k];this.set(ge[0],ge[1])}}function ff(){this.__data__=[],this.size=0}function df(O){var k=this.__data__,ne=ns(k,O);if(ne<0)return!1;var ge=k.length-1;return ne==ge?k.pop():On.call(k,ne,1),--this.size,!0}function pf(O){var k=this.__data__,ne=ns(k,O);return ne<0?void 0:k[ne][1]}function gf(O){return ns(this.__data__,O)>-1}function mf(O,k){var ne=this.__data__,ge=ns(ne,O);return ge<0?(++this.size,ne.push([O,k])):ne[ge][1]=k,this}rn.prototype.clear=ff,rn.prototype.delete=df,rn.prototype.get=pf,rn.prototype.has=gf,rn.prototype.set=mf;function Kn(O){var k=-1,ne=O==null?0:O.length;for(this.clear();++k<ne;){var ge=O[k];this.set(ge[0],ge[1])}}function Ks(){this.size=0,this.__data__={hash:new _t,map:new(Ot||rn),string:new _t}}function vf(O){var k=_i(this,O).delete(O);return this.size-=k?1:0,k}function Vs(O){return _i(this,O).get(O)}function yf(O){return _i(this,O).has(O)}function wf(O,k){var ne=_i(this,O),ge=ne.size;return ne.set(O,k),this.size+=ne.size==ge?0:1,this}Kn.prototype.clear=Ks,Kn.prototype.delete=vf,Kn.prototype.get=Vs,Kn.prototype.has=yf,Kn.prototype.set=wf;function Gs(O){var k=-1,ne=O==null?0:O.length;for(this.__data__=new Kn;++k<ne;)this.add(O[k])}function Cc(O){return this.__data__.set(O,n),this}function Oc(O){return this.__data__.has(O)}Gs.prototype.add=Gs.prototype.push=Cc,Gs.prototype.has=Oc;function gn(O){var k=this.__data__=new rn(O);this.size=k.size}function bf(){this.__data__=new rn,this.size=0}function _f(O){var k=this.__data__,ne=k.delete(O);return this.size=k.size,ne}function Ef(O){return this.__data__.get(O)}function xf(O){return this.__data__.has(O)}function $c(O,k){var ne=this.__data__;if(ne instanceof rn){var ge=ne.__data__;if(!Ot||ge.length<t-1)return ge.push([O,k]),this.size=++ne.size,this;ne=this.__data__=new Kn(ge)}return ne.set(O,k),this.size=ne.size,this}gn.prototype.clear=bf,gn.prototype.delete=_f,gn.prototype.get=Ef,gn.prototype.has=xf,gn.prototype.set=$c;function Ac(O,k){var ne=Zs(O),ge=!ne&&qc(O),vt=!ne&&!ge&&sa(O),Ne=!ne&&!ge&&!vt&&Wc(O),Et=ne||ge||vt||Ne,Xt=Et?St(O.length,String):[],it=Xt.length;for(var yt in O)(k||$e.call(O,yt))&&!(Et&&(yt=="length"||vt&&(yt=="offset"||yt=="parent")||Ne&&(yt=="buffer"||yt=="byteLength"||yt=="byteOffset")||Uc(yt,it)))&&Xt.push(yt);return Xt}function ns(O,k){for(var ne=O.length;ne--;)if(kc(O[ne][0],k))return ne;return-1}function na(O,k,ne){var ge=k(O);return Zs(O)?ge:Je(ge,ne(O))}function is(O){return O==null?O===void 0?H:j:Cr&&Cr in Object(O)?Lc(O):Sf(O)}function ia(O){return os(O)&&is(O)==u}function ss(O,k,ne,ge,vt){return O===k?!0:O==null||k==null||!os(O)&&!os(k)?O!==O&&k!==k:Pc(O,k,ne,ge,ss,vt)}function Pc(O,k,ne,ge,vt,Ne){var Et=Zs(O),Xt=Zs(k),it=Et?f:$n(O),yt=Xt?f:$n(k);it=it==u?A:it,yt=yt==u?A:yt;var Wt=it==A,jr=yt==A,er=it==yt;if(er&&sa(O)){if(!sa(k))return!1;Et=!0,Wt=!1}if(er&&!Wt)return Ne||(Ne=new gn),Et||Wc(O)?Ys(O,k,ne,ge,vt,Ne):Df(O,k,it,ne,ge,vt,Ne);if(!(ne&i)){var xt=Wt&&$e.call(O,"__wrapped__"),Or=jr&&$e.call(k,"__wrapped__");if(xt||Or){var mn=xt?O.value():O,nn=Or?k.value():k;return Ne||(Ne=new gn),vt(mn,nn,ne,ge,Ne)}}return er?(Ne||(Ne=new gn),Nc(O,k,ne,ge,vt,Ne)):!1}function If(O){if(!Hc(O)||Fc(O))return!1;var k=Qs(O)?at:ae;return k.test(Vn(O))}function Tc(O){return os(O)&&zc(O.length)&&!!de[is(O)]}function Rc(O){if(!Bc(O))return rs(O);var k=[];for(var ne in Object(O))$e.call(O,ne)&&ne!="constructor"&&k.push(ne);return k}function Ys(O,k,ne,ge,vt,Ne){var Et=ne&i,Xt=O.length,it=k.length;if(Xt!=it&&!(Et&&it>Xt))return!1;var yt=Ne.get(O);if(yt&&Ne.get(k))return yt==k;var Wt=-1,jr=!0,er=ne&a?new Gs:void 0;for(Ne.set(O,k),Ne.set(k,O);++Wt<Xt;){var xt=O[Wt],Or=k[Wt];if(ge)var mn=Et?ge(Or,xt,Wt,k,O,Ne):ge(xt,Or,Wt,O,k,Ne);if(mn!==void 0){if(mn)continue;jr=!1;break}if(er){if(!ke(k,function(nn,An){if(!ze(er,An)&&(xt===nn||vt(xt,nn,ne,ge,Ne)))return er.push(An)})){jr=!1;break}}else if(!(xt===Or||vt(xt,Or,ne,ge,Ne))){jr=!1;break}}return Ne.delete(O),Ne.delete(k),jr}function Df(O,k,ne,ge,vt,Ne,Et){switch(ne){case se:if(O.byteLength!=k.byteLength||O.byteOffset!=k.byteOffset)return!1;O=O.buffer,k=k.buffer;case V:return!(O.byteLength!=k.byteLength||!Ne(new Sr(O),new Sr(k)));case m:case w:case U:return kc(+O,+k);case y:return O.name==k.name&&O.message==k.message;case $:case d:return O==k+"";case P:var Xt=Ue;case E:var it=ge&i;if(Xt||(Xt=He),O.size!=k.size&&!it)return!1;var yt=Et.get(O);if(yt)return yt==k;ge|=a,Et.set(O,k);var Wt=Ys(Xt(O),Xt(k),ge,vt,Ne,Et);return Et.delete(O),Wt;case b:if(Bt)return Bt.call(O)==Bt.call(k)}return!1}function Nc(O,k,ne,ge,vt,Ne){var Et=ne&i,Xt=Js(O),it=Xt.length,yt=Js(k),Wt=yt.length;if(it!=Wt&&!Et)return!1;for(var jr=it;jr--;){var er=Xt[jr];if(!(Et?er in k:$e.call(k,er)))return!1}var xt=Ne.get(O);if(xt&&Ne.get(k))return xt==k;var Or=!0;Ne.set(O,k),Ne.set(k,O);for(var mn=Et;++jr<it;){er=Xt[jr];var nn=O[er],An=k[er];if(ge)var oa=Et?ge(An,nn,er,k,O,Ne):ge(nn,An,er,O,k,Ne);if(!(oa===void 0?nn===An||vt(nn,An,ne,ge,Ne):oa)){Or=!1;break}mn||(mn=er=="constructor")}if(Or&&!mn){var as=O.constructor,ar=k.constructor;as!=ar&&"constructor"in O&&"constructor"in k&&!(typeof as=="function"&&as instanceof as&&typeof ar=="function"&&ar instanceof ar)&&(Or=!1)}return Ne.delete(O),Ne.delete(k),Or}function Js(O){return na(O,$f,Mc)}function _i(O,k){var ne=O.__data__;return jc(k)?ne[typeof k=="string"?"string":"hash"]:ne.map}function Gr(O,k){var ne=Oe(O,k);return If(ne)?ne:void 0}function Lc(O){var k=$e.call(O,Cr),ne=O[Cr];try{O[Cr]=void 0;var ge=!0}catch{}var vt=et.call(O);return ge&&(k?O[Cr]=ne:delete O[Cr]),vt}var Mc=Wn?function(O){return O==null?[]:(O=Object(O),Ke(Wn(O),function(k){return Ur.call(O,k)}))}:mt,$n=is;(Lt&&$n(new Lt(new ArrayBuffer(1)))!=se||Ot&&$n(new Ot)!=P||Mt&&$n(Mt.resolve())!=T||Ut&&$n(new Ut)!=E||Tt&&$n(new Tt)!=F)&&($n=function(O){var k=is(O),ne=k==A?O.constructor:void 0,ge=ne?Vn(ne):"";if(ge)switch(ge){case Gt:return se;case Yt:return P;case jt:return T;case Jt:return E;case Ft:return F}return k});function Uc(O,k){return k=k??c,!!k&&(typeof O=="number"||xe.test(O))&&O>-1&&O%1==0&&O<k}function jc(O){var k=typeof O;return k=="string"||k=="number"||k=="symbol"||k=="boolean"?O!=="__proto__":O===null}function Fc(O){return!!Ze&&Ze in O}function Bc(O){var k=O&&O.constructor,ne=typeof k=="function"&&k.prototype||Se;return O===ne}function Sf(O){return et.call(O)}function Vn(O){if(O!=null){try{return Ve.call(O)}catch{}try{return O+""}catch{}}return""}function kc(O,k){return O===k||O!==O&&k!==k}var qc=ia(function(){return arguments}())?ia:function(O){return os(O)&&$e.call(O,"callee")&&!Ur.call(O,"callee")},Zs=Array.isArray;function Cf(O){return O!=null&&zc(O.length)&&!Qs(O)}var sa=bi||gt;function Of(O,k){return ss(O,k)}function Qs(O){if(!Hc(O))return!1;var k=is(O);return k==x||k==S||k==h||k==C}function zc(O){return typeof O=="number"&&O>-1&&O%1==0&&O<=c}function Hc(O){var k=typeof O;return O!=null&&(k=="object"||k=="function")}function os(O){return O!=null&&typeof O=="object"}var Wc=Ce?Ct(Ce):Tc;function $f(O){return Cf(O)?Ac(O):Rc(O)}function mt(){return[]}function gt(){return!1}r.exports=Of})(Ru,Ru.exports);var rE=Ru.exports;function nE(r,e){return e=e||{},new Promise(function(t,n){var i=new XMLHttpRequest,a=[],c=[],u={},f=function(){return{ok:(i.status/100|0)==2,statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:f,headers:{keys:function(){return a},entries:function(){return c},get:function(m){return u[m.toLowerCase()]},has:function(m){return m.toLowerCase()in u}}}};for(var h in i.open(e.method||"get",r,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(m,w,y){a.push(w=w.toLowerCase()),c.push([w,y]),u[w]=u[w]?u[w]+","+y:y}),t(f())},i.onerror=n,i.withCredentials=e.credentials=="include",e.headers)i.setRequestHeader(h,e.headers[h]);i.send(e.body||null)})}var iE=Object.freeze({__proto__:null,default:nE}),Qp=Pi(iE),sE=self.fetch||(self.fetch=Qp.default||Qp),oE=Object.defineProperty,Xp=Object.getOwnPropertySymbols,aE=Object.prototype.hasOwnProperty,cE=Object.prototype.propertyIsEnumerable,e1=(r,e,t)=>e in r?oE(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,xr=(r,e)=>{for(var t in e||(e={}))aE.call(e,t)&&e1(r,t,e[t]);if(Xp)for(var t of Xp(e))cE.call(e,t)&&e1(r,t,e[t]);return r};function lE(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var i=0;i<r.length;i++){var a=r.charAt(i),c=a.charCodeAt(0);if(t[c]!==255)throw new TypeError(a+" is ambiguous");t[c]=i}var u=r.length,f=r.charAt(0),h=Math.log(u)/Math.log(256),m=Math.log(256)/Math.log(u);function w(S){if(S instanceof Uint8Array||(ArrayBuffer.isView(S)?S=new Uint8Array(S.buffer,S.byteOffset,S.byteLength):Array.isArray(S)&&(S=Uint8Array.from(S))),!(S instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(S.length===0)return"";for(var P=0,U=0,j=0,A=S.length;j!==A&&S[j]===0;)j++,P++;for(var T=(A-j)*m+1>>>0,C=new Uint8Array(T);j!==A;){for(var $=S[j],E=0,d=T-1;($!==0||E<U)&&d!==-1;d--,E++)$+=256*C[d]>>>0,C[d]=$%u>>>0,$=$/u>>>0;if($!==0)throw new Error("Non-zero carry");U=E,j++}for(var b=T-U;b!==T&&C[b]===0;)b++;for(var H=f.repeat(P);b<T;++b)H+=r.charAt(C[b]);return H}function y(S){if(typeof S!="string")throw new TypeError("Expected String");if(S.length===0)return new Uint8Array;var P=0;if(S[P]!==" "){for(var U=0,j=0;S[P]===f;)U++,P++;for(var A=(S.length-P)*h+1>>>0,T=new Uint8Array(A);S[P];){var C=t[S.charCodeAt(P)];if(C===255)return;for(var $=0,E=A-1;(C!==0||$<j)&&E!==-1;E--,$++)C+=u*T[E]>>>0,T[E]=C%256>>>0,C=C/256>>>0;if(C!==0)throw new Error("Non-zero carry");j=$,P++}if(S[P]!==" "){for(var d=A-j;d!==A&&T[d]===0;)d++;for(var b=new Uint8Array(U+(A-d)),H=U;d!==A;)b[H++]=T[d++];return b}}}function x(S){var P=y(S);if(P)return P;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:y,decode:x}}var uE=lE,hE=uE;const t1=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},fE=r=>new TextEncoder().encode(r),dE=r=>new TextDecoder().decode(r);class pE{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class gE{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return r1(this,e)}}class mE{constructor(e){this.decoders=e}or(e){return r1(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const r1=(r,e)=>new mE(xr(xr({},r.decoders||{[r.prefix]:r}),e.decoders||{[e.prefix]:e}));class vE{constructor(e,t,n,i){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=i,this.encoder=new pE(e,t,n),this.decoder=new gE(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Ka=({name:r,prefix:e,encode:t,decode:n})=>new vE(r,e,t,n),To=({prefix:r,name:e,alphabet:t})=>{const{encode:n,decode:i}=hE(t,e);return Ka({prefix:r,name:e,encode:n,decode:a=>t1(i(a))})},yE=(r,e,t,n)=>{const i={};for(let m=0;m<e.length;++m)i[e[m]]=m;let a=r.length;for(;r[a-1]==="=";)--a;const c=new Uint8Array(a*t/8|0);let u=0,f=0,h=0;for(let m=0;m<a;++m){const w=i[r[m]];if(w===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<t|w,u+=t,u>=8&&(u-=8,c[h++]=255&f>>u)}if(u>=t||255&f<<8-u)throw new SyntaxError("Unexpected end of data");return c},wE=(r,e,t)=>{const n=e[e.length-1]==="=",i=(1<<t)-1;let a="",c=0,u=0;for(let f=0;f<r.length;++f)for(u=u<<8|r[f],c+=8;c>t;)c-=t,a+=e[i&u>>c];if(c&&(a+=e[i&u<<t-c]),n)for(;a.length*t&7;)a+="=";return a},hr=({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>Ka({prefix:e,name:r,encode(i){return wE(i,n,t)},decode(i){return yE(i,n,t,r)}}),bE=Ka({prefix:"\0",name:"identity",encode:r=>dE(r),decode:r=>fE(r)});var _E=Object.freeze({__proto__:null,identity:bE});const EE=hr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var xE=Object.freeze({__proto__:null,base2:EE});const IE=hr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var DE=Object.freeze({__proto__:null,base8:IE});const SE=To({prefix:"9",name:"base10",alphabet:"0123456789"});var CE=Object.freeze({__proto__:null,base10:SE});const OE=hr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),$E=hr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var AE=Object.freeze({__proto__:null,base16:OE,base16upper:$E});const PE=hr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),TE=hr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),RE=hr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),NE=hr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),LE=hr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ME=hr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),UE=hr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),jE=hr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),FE=hr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var BE=Object.freeze({__proto__:null,base32:PE,base32upper:TE,base32pad:RE,base32padupper:NE,base32hex:LE,base32hexupper:ME,base32hexpad:UE,base32hexpadupper:jE,base32z:FE});const kE=To({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),qE=To({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var zE=Object.freeze({__proto__:null,base36:kE,base36upper:qE});const HE=To({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),WE=To({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var KE=Object.freeze({__proto__:null,base58btc:HE,base58flickr:WE});const VE=hr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),GE=hr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),YE=hr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),JE=hr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var ZE=Object.freeze({__proto__:null,base64:VE,base64pad:GE,base64url:YE,base64urlpad:JE});const n1=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),QE=n1.reduce((r,e,t)=>(r[t]=e,r),[]),XE=n1.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function e4(r){return r.reduce((e,t)=>(e+=QE[t],e),"")}function t4(r){const e=[];for(const t of r){const n=XE[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}const r4=Ka({prefix:"\u{1F680}",name:"base256emoji",encode:e4,decode:t4});var n4=Object.freeze({__proto__:null,base256emoji:r4}),i4=s1,i1=128,s4=127,o4=~s4,a4=Math.pow(2,31);function s1(r,e,t){e=e||[],t=t||0;for(var n=t;r>=a4;)e[t++]=r&255|i1,r/=128;for(;r&o4;)e[t++]=r&255|i1,r>>>=7;return e[t]=r|0,s1.bytes=t-n+1,e}var c4=Nu,l4=128,o1=127;function Nu(r,n){var t=0,n=n||0,i=0,a=n,c,u=r.length;do{if(a>=u)throw Nu.bytes=0,new RangeError("Could not decode varint");c=r[a++],t+=i<28?(c&o1)<<i:(c&o1)*Math.pow(2,i),i+=7}while(c>=l4);return Nu.bytes=a-n,t}var u4=Math.pow(2,7),h4=Math.pow(2,14),f4=Math.pow(2,21),d4=Math.pow(2,28),p4=Math.pow(2,35),g4=Math.pow(2,42),m4=Math.pow(2,49),v4=Math.pow(2,56),y4=Math.pow(2,63),w4=function(r){return r<u4?1:r<h4?2:r<f4?3:r<d4?4:r<p4?5:r<g4?6:r<m4?7:r<v4?8:r<y4?9:10},b4={encode:i4,decode:c4,encodingLength:w4},a1=b4;const c1=(r,e,t=0)=>(a1.encode(r,e,t),e),l1=r=>a1.encodingLength(r),Lu=(r,e)=>{const t=e.byteLength,n=l1(r),i=n+l1(t),a=new Uint8Array(i+t);return c1(r,a,0),c1(t,a,n),a.set(e,i),new _4(r,t,e,a)};class _4{constructor(e,t,n,i){this.code=e,this.size=t,this.digest=n,this.bytes=i}}const u1=({name:r,code:e,encode:t})=>new E4(r,e,t);class E4{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Lu(this.code,t):t.then(n=>Lu(this.code,n))}else throw Error("Unknown type, must be binary type")}}const h1=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),x4=u1({name:"sha2-256",code:18,encode:h1("SHA-256")}),I4=u1({name:"sha2-512",code:19,encode:h1("SHA-512")});var D4=Object.freeze({__proto__:null,sha256:x4,sha512:I4});const f1=0,S4="identity",d1=t1;var C4=Object.freeze({__proto__:null,identity:{code:f1,name:S4,encode:d1,digest:r=>Lu(f1,d1(r))}});new TextEncoder,new TextDecoder;const p1=xr(xr(xr(xr(xr(xr(xr(xr(xr(xr({},_E),xE),DE),CE),AE),BE),zE),KE),ZE),n4);xr(xr({},D4),C4);function g1(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function O4(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?g1(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function m1(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}const v1=m1("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Mu=m1("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);const e=O4(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),$4=xr({utf8:v1,"utf-8":v1,hex:p1.base16,latin1:Mu,ascii:Mu,binary:Mu},p1);function A4(r,e="utf8"){const t=$4[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?g1(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}const y1="wc",P4=2,Uu="core",si=`${y1}@2:${Uu}:`,T4={name:Uu,logger:"error"},R4={database:":memory:"},N4="crypto",w1="client_ed25519_seed",L4=ye.ONE_DAY,M4="keychain",U4="0.3",j4="messages",F4="0.3",B4=ye.SIX_HOURS,k4="publisher",b1="irn",q4="error",_1="wss://relay.walletconnect.com",E1="wss://relay.walletconnect.org",z4="relayer",pr={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},H4="_subscription",jn={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},W4=ye.ONE_SECOND,K4="2.11.2",V4=1e4,G4="0.3",Y4="WALLETCONNECT_CLIENT_ID",pn={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},J4="subscription",Z4="0.3",Q4=ye.FIVE_SECONDS*1e3,X4="pairing",e8="0.3",Ro={wc_pairingDelete:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:ye.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:ye.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:ye.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:0},res:{ttl:ye.ONE_DAY,prompt:!1,tag:0}}},No={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},xn={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},t8="history",r8="0.3",n8="expirer",en={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},i8="0.3",ju="verify-api",Cs="https://verify.walletconnect.com",Fu="https://verify.walletconnect.org",s8=[Cs,Fu],o8="echo",a8="https://echo.walletconnect.com";class c8{constructor(e,t){this.core=e,this.logger=t,this.keychain=new Map,this.name=M4,this.version=U4,this.initialized=!1,this.storagePrefix=si,this.init=async()=>{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();const i=this.keychain.get(n);if(typeof i>"u"){const{message:a}=ue("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(a)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=Xe.generateChildLogger(t,this.name)}get context(){return Xe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,Z0(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Q0(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}}class l8{constructor(e,t,n){this.core=e,this.logger=t,this.name=N4,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();const i=await this.getClientSeed(),a=Mp(i);return Lp(a.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const i=X2();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();const a=await this.getClientSeed(),c=Mp(a),u=su();return await d6(u,i,L4,c)},this.generateSharedKey=(i,a,c)=>{this.isInitialized();const u=this.getPrivateKey(i),f=e_(u,a);return this.setSymKey(f,c)},this.setSymKey=async(i,a)=>{this.isInitialized();const c=a||t_(i);return await this.keychain.set(c,i),c},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,a,c)=>{this.isInitialized();const u=K0(c),f=ji(a);if(V0(u)){const y=u.senderPublicKey,x=u.receiverPublicKey;i=await this.generateSharedKey(y,x)}const h=this.getSymKey(i),{type:m,senderPublicKey:w}=u;return n_({type:m,symKey:h,message:f,senderPublicKey:w})},this.decode=async(i,a,c)=>{this.isInitialized();const u=o_(a,c);if(V0(u)){const f=u.receiverPublicKey,h=u.senderPublicKey;i=await this.generateSharedKey(f,h)}try{const f=this.getSymKey(i),h=i_({symKey:f,encoded:a});return Do(h)}catch(f){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(f)}},this.getPayloadType=i=>{const a=Ra(i);return wo(a.type)},this.getPayloadSenderPublicKey=i=>{const a=Ra(i);return a.senderPublicKey?wr(a.senderPublicKey,br):void 0},this.core=e,this.logger=Xe.generateChildLogger(t,this.name),this.keychain=n||new c8(this.core,this.logger)}get context(){return Xe.getLoggerContext(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(w1)}catch{e=su(),await this.keychain.set(w1,e)}return A4(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}}class u8 extends H5{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=j4,this.version=F4,this.initialized=!1,this.storagePrefix=si,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();const a=bs(i);let c=this.messages.get(n);return typeof c>"u"&&(c={}),typeof c[a]<"u"||(c[a]=i,this.messages.set(n,c),await this.persist()),a},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();const a=this.get(n),c=bs(i);return typeof a[c]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Xe.generateChildLogger(e,this.name),this.core=t}get context(){return Xe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,Z0(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?Q0(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}}class h8 extends W5{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new lr.exports.EventEmitter,this.name=k4,this.queue=new Map,this.publishTimeout=ye.toMiliseconds(ye.TEN_SECONDS*2),this.needsTransportRestart=!1,this.publish=async(n,i,a)=>{var c;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:a}});try{const u=a?.ttl||B4,f=cu(a),h=a?.prompt||!1,m=a?.tag||0,w=a?.id||Wp().toString(),y={topic:n,message:i,opts:{ttl:u,relay:f,prompt:h,tag:m,id:w}},x=setTimeout(()=>this.queue.set(w,y),this.publishTimeout);try{await await _o(this.rpcPublish(n,i,u,f,h,m,w),this.publishTimeout,`Failed to publish payload, please try again. id:${w} tag:${m}`),this.removeRequestFromQueue(w),this.relayer.events.emit(pr.publish,y)}catch(S){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,(c=a?.internal)!=null&&c.throwOnFailedPublish)throw this.removeRequestFromQueue(w),S;return}finally{clearTimeout(x)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:a}})}catch(u){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(u),u}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=Xe.generateChildLogger(t,this.name),this.registerEventListeners()}get context(){return Xe.getLoggerContext(this.logger)}rpcPublish(e,t,n,i,a,c,u){var f,h,m,w;const y={method:Na(i.protocol).publish,params:{topic:e,message:t,ttl:n,prompt:a,tag:c},id:u};return _r((f=y.params)==null?void 0:f.prompt)&&((h=y.params)==null||delete h.prompt),_r((m=y.params)==null?void 0:m.tag)&&((w=y.params)==null||delete w.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:y}),this.relayer.request(y)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:t,message:n,opts:i}=e;await this.publish(t,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(Ds.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(pr.connection_stalled);return}this.checkQueue()}),this.relayer.on(pr.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class f8{constructor(){this.map=new Map,this.set=(e,t)=>{const n=this.get(e);this.exists(e,t)||this.map.set(e,[...n,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,t))return;const i=n.filter(a=>a!==t);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var d8=Object.defineProperty,p8=Object.defineProperties,g8=Object.getOwnPropertyDescriptors,x1=Object.getOwnPropertySymbols,m8=Object.prototype.hasOwnProperty,v8=Object.prototype.propertyIsEnumerable,I1=(r,e,t)=>e in r?d8(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Lo=(r,e)=>{for(var t in e||(e={}))m8.call(e,t)&&I1(r,t,e[t]);if(x1)for(var t of x1(e))v8.call(e,t)&&I1(r,t,e[t]);return r},Bu=(r,e)=>p8(r,g8(e));class y8 extends G5{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new f8,this.events=new lr.exports.EventEmitter,this.name=J4,this.version=Z4,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=si,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{const a=cu(i),c={topic:n,relay:a};this.pending.set(n,c);const u=await this.rpcSubscribe(n,a);return this.onSubscribe(u,c),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}}),u}catch(a){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(a),a}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>{if(this.topics.includes(n))return!0;const i=`${this.pendingSubscriptionWatchLabel}_${n}`;return await new Promise((a,c)=>{const u=new ye.Watch;u.start(i);const f=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(f),u.stop(i),a(!0)),u.elapsed(i)>=Q4&&(clearInterval(f),u.stop(i),c(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Xe.generateChildLogger(t,this.name),this.clientId=""}get context(){return Xe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,t){let n=!1;try{n=this.getSubscription(e).topic===t}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,t)))}async unsubscribeById(e,t,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:n}});try{const i=cu(n);await this.rpcUnsubscribe(e,t,i);const a=It("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,a),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,t){const n={method:Na(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await _o(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(pr.connection_stalled)}return bs(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;const t=e[0].relay,n={method:Na(t.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await _o(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(pr.connection_stalled)}}rpcUnsubscribe(e,t,n){const i={method:Na(n.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,t){this.setSubscription(e,Bu(Lo({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(t=>{this.setSubscription(t.id,Lo({},t)),this.pending.delete(t.topic)})}async onUnsubscribe(e,t,n){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t))}addSubscription(e,t){this.subscriptions.set(e,Lo({},t)),this.topicMap.set(t.topic,e),this.events.emit(pn.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:n}=ue("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(pn.deleted,Bu(Lo({},n),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(pn.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let t=0;t<e;t++){const n=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(n)}}this.events.emit(pn.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:t}=ue("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const t=await this.rpcBatchSubscribe(e);En(t)&&this.onBatchSubscribe(t.map((n,i)=>Bu(Lo({},e[i]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;const e=[];this.pending.forEach(t=>{e.push(t)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(Ds.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(pr.connect,async()=>{await this.onConnect()}),this.relayer.on(pr.disconnect,()=>{this.onDisconnect()}),this.events.on(pn.created,async e=>{const t=pn.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(pn.deleted,async e=>{const t=pn.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{const t=setInterval(()=>{this.restartInProgress||(clearInterval(t),e())},this.pollingInterval)})}}var w8=Object.defineProperty,D1=Object.getOwnPropertySymbols,b8=Object.prototype.hasOwnProperty,_8=Object.prototype.propertyIsEnumerable,S1=(r,e,t)=>e in r?w8(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,E8=(r,e)=>{for(var t in e||(e={}))b8.call(e,t)&&S1(r,t,e[t]);if(D1)for(var t of D1(e))_8.call(e,t)&&S1(r,t,e[t]);return r};class x8 extends K5{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new lr.exports.EventEmitter,this.name=z4,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.request=async t=>{this.logger.debug("Publishing Request Payload");const n=t.id;try{await this.toEstablishConnection();const i=this.provider.request(t);return this.requestsInFlight.set(n,{promise:i,request:t}),await i}catch(i){throw this.logger.debug("Failed to Publish Request"),this.logger.error(i),i}finally{this.requestsInFlight.delete(n)}},this.onPayloadHandler=t=>{this.onProviderPayload(t)},this.onConnectHandler=()=>{this.events.emit(pr.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=t=>{this.logger.error(t),this.events.emit(pr.error,t),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(jn.payload,this.onPayloadHandler),this.provider.on(jn.connect,this.onConnectHandler),this.provider.on(jn.disconnect,this.onDisconnectHandler),this.provider.on(jn.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Xe.generateChildLogger(e.logger,this.name):Xe.pino(Xe.getDefaultLoggerOptions({level:e.logger||q4})),this.messages=new u8(this.logger,e.core),this.subscriber=new y8(this,this.logger),this.publisher=new h8(this,this.logger),this.relayUrl=e?.relayUrl||_1,this.projectId=e.projectId,this.bundleId=f_(),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${E1}...`),await this.restartTransport(E1)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},V4)}get context(){return Xe.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,t,n){this.isInitialized(),await this.publisher.publish(e,t,n),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now()})}async subscribe(e,t){var n;this.isInitialized();let i=((n=this.subscriber.topicMap.get(e))==null?void 0:n[0])||"";if(i)return i;let a;const c=u=>{u.topic===e&&(this.subscriber.off(pn.created,c),a())};return await Promise.all([new Promise(u=>{a=u,this.subscriber.on(pn.created,c)}),new Promise(async u=>{i=await this.subscriber.subscribe(e,t),u()})]),i}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportClose(){this.requestsInFlight.size>0&&(this.logger.debug("Waiting for all in-flight requests to finish before closing transport..."),this.requestsInFlight.forEach(async e=>{await e.promise})),this.transportExplicitlyClosed=!0,this.hasExperiencedNetworkDisruption&&this.connected?await _o(this.provider.disconnect(),1e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(e){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(t=>{if(!this.initialized)return t();this.subscriber.once(pn.resubscribed,()=>{t()})}),new Promise(async(t,n)=>{try{await _o(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(i){n(i);return}t()})])}catch(t){this.logger.error(t);const n=t;if(!this.isConnectionStalled(n.message))throw t;this.provider.events.emit(jn.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(e){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await up())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(e){return this.staleConnectionErrors.some(t=>e.includes(t))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Un(new tE(y_({sdkVersion:K4,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:t,message:n}=e;await this.messages.set(t,n)}async shouldIgnoreMessageEvent(e){const{topic:t,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.debug(`Ignoring message for non-subscribed topic ${t}`),!0;const i=this.messages.has(t,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),Tu(e)){if(!e.method.endsWith(H4))return;const t=e.params,{topic:n,message:i,publishedAt:a}=t.data,c={topic:n,message:i,publishedAt:a};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(E8({type:"event",event:t.id},c)),this.events.emit(t.id,c),await this.acknowledgePayload(e),await this.onMessageEvent(c)}else Wa(e)&&this.events.emit(pr.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(pr.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const t=za(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(jn.payload,this.onPayloadHandler),this.provider.off(jn.connect,this.onConnectHandler),this.provider.off(jn.disconnect,this.onDisconnectHandler),this.provider.off(jn.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(pr.connection_stalled,()=>{this.restartTransport().catch(t=>this.logger.error(t))});let e=await up();f3(async t=>{this.initialized&&e!==t&&(e=t,t?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(n=>this.logger.error(n))))})}onProviderDisconnect(){this.events.emit(pr.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(e=>this.logger.error(e))},ye.toMiliseconds(W4)))}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(e=>{const t=setInterval(()=>{this.connected&&(clearInterval(t),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}}var I8=Object.defineProperty,C1=Object.getOwnPropertySymbols,D8=Object.prototype.hasOwnProperty,S8=Object.prototype.propertyIsEnumerable,O1=(r,e,t)=>e in r?I8(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,$1=(r,e)=>{for(var t in e||(e={}))D8.call(e,t)&&O1(r,t,e[t]);if(C1)for(var t of C1(e))S8.call(e,t)&&O1(r,t,e[t]);return r};class Va extends V5{constructor(e,t,n,i=si,a=void 0){super(e,t,n,i),this.core=e,this.logger=t,this.name=n,this.map=new Map,this.version=G4,this.cached=[],this.initialized=!1,this.storagePrefix=si,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(c=>{this.getKey&&c!==null&&!_r(c)?this.map.set(this.getKey(c),c):z_(c)?this.map.set(c.id,c):H_(c)&&this.map.set(c.topic,c)}),this.cached=[],this.initialized=!0)},this.set=async(c,u)=>{this.isInitialized(),this.map.has(c)?await this.update(c,u):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:c,value:u}),this.map.set(c,u),await this.persist())},this.get=c=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:c}),this.getData(c)),this.getAll=c=>(this.isInitialized(),c?this.values.filter(u=>Object.keys(c).every(f=>rE(u[f],c[f]))):this.values),this.update=async(c,u)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:c,update:u});const f=$1($1({},this.getData(c)),u);this.map.set(c,f),await this.persist()},this.delete=async(c,u)=>{this.isInitialized(),this.map.has(c)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:c,reason:u}),this.map.delete(c),await this.persist())},this.logger=Xe.generateChildLogger(t,this.name),this.storagePrefix=i,this.getKey=a}get context(){return Xe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){const{message:n}=ue("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:t}=ue("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}}class C8{constructor(e,t){this.core=e,this.logger=t,this.name=X4,this.version=e8,this.events=new lr.exports,this.initialized=!1,this.storagePrefix=si,this.ignoredPayloadTypes=[Li],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async()=>{this.isInitialized();const n=su(),i=await this.core.crypto.setSymKey(n),a=Wr(ye.FIVE_MINUTES),c={protocol:b1},u={topic:i,expiry:a,relay:c,active:!1},f=N_({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:n,relay:c,expiryTimestamp:a});return await this.pairings.set(i,u),await this.core.relayer.subscribe(i),this.core.expirer.set(i,a),{topic:i,uri:f}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);const{topic:i,symKey:a,relay:c,expiryTimestamp:u}=np(n.uri);let f;if(this.pairings.keys.includes(i)&&(f=this.pairings.get(i),f.active))throw new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);const h=u||Wr(ye.FIVE_MINUTES),m={topic:i,relay:c,expiry:h,active:!1};return await this.pairings.set(i,m),this.core.expirer.set(i,h),n.activatePairing&&await this.activate({topic:i}),this.events.emit(No.create,m),this.core.crypto.keychain.has(i)||(await this.core.crypto.setSymKey(a,i),await this.core.relayer.subscribe(i,{relay:c})),m},this.activate=async({topic:n})=>{this.isInitialized();const i=Wr(ye.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:i}),this.core.expirer.set(n,i)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:i}=n;if(this.pairings.keys.includes(i)){const a=await this.sendRequest(i,"wc_pairingPing",{}),{done:c,resolve:u,reject:f}=xs();this.events.once(qt("pairing_ping",a),({error:h})=>{h?f(h):u()}),await c()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",It("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,a)=>{const c=Ss(i,a),u=await this.core.crypto.encode(n,c),f=Ro[i].req;return this.core.history.set(n,c),this.core.relayer.publish(n,u,f),c.id},this.sendResult=async(n,i,a)=>{const c=za(n,a),u=await this.core.crypto.encode(i,c),f=await this.core.history.get(i,n),h=Ro[f.request.method].res;await this.core.relayer.publish(i,u,h),await this.core.history.resolve(c)},this.sendError=async(n,i,a)=>{const c=Ha(n,a),u=await this.core.crypto.encode(i,c),f=await this.core.history.get(i,n),h=Ro[f.request.method]?Ro[f.request.method].res:Ro.unregistered_method.res;await this.core.relayer.publish(i,u,h),await this.core.history.resolve(c)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,It("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(i=>ii(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{const{topic:i,payload:a}=n;switch(a.method){case"wc_pairingPing":return this.onPairingPingRequest(i,a);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,a);default:return this.onUnknownRpcMethodRequest(i,a)}},this.onRelayEventResponse=async n=>{const{topic:i,payload:a}=n,c=(await this.core.history.get(i,a.id)).request.method;switch(c){case"wc_pairingPing":return this.onPairingPingResponse(i,a);default:return this.onUnknownRpcMethodResponse(c)}},this.onPairingPingRequest=async(n,i)=>{const{id:a}=i;try{this.isValidPing({topic:n}),await this.sendResult(a,n,!0),this.events.emit(No.ping,{id:a,topic:n})}catch(c){await this.sendError(a,n,c),this.logger.error(c)}},this.onPairingPingResponse=(n,i)=>{const{id:a}=i;setTimeout(()=>{Mn(i)?this.events.emit(qt("pairing_ping",a),{}):dn(i)&&this.events.emit(qt("pairing_ping",a),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{const{id:a}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(No.delete,{id:a,topic:n})}catch(c){await this.sendError(a,n,c),this.logger.error(c)}},this.onUnknownRpcMethodRequest=async(n,i)=>{const{id:a,method:c}=i;try{if(this.registeredMethods.includes(c))return;const u=It("WC_METHOD_UNSUPPORTED",c);await this.sendError(a,n,u),this.logger.error(u)}catch(u){await this.sendError(a,n,u),this.logger.error(u)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(It("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{var i;if(!Rr(n)){const{message:c}=ue("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(c)}if(!q_(n.uri)){const{message:c}=ue("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(c)}const a=np(n.uri);if(!((i=a?.relay)!=null&&i.protocol)){const{message:c}=ue("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(c)}if(!(a!=null&&a.symKey)){const{message:c}=ue("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(c)}if(a!=null&&a.expiryTimestamp&&ye.toMiliseconds(a?.expiryTimestamp)<Date.now()){const{message:c}=ue("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(c)}},this.isValidPing=async n=>{if(!Rr(n)){const{message:a}=ue("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(a)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!Rr(n)){const{message:a}=ue("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(a)}const{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ir(n,!1)){const{message:i}=ue("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){const{message:i}=ue("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ii(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:i}=ue("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=Xe.generateChildLogger(t,this.name),this.pairings=new Va(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Xe.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(pr.message,async e=>{const{topic:t,message:n}=e;if(!this.pairings.keys.includes(t)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const i=await this.core.crypto.decode(t,n);try{Tu(i)?(this.core.history.set(t,i),this.onRelayEventRequest({topic:t,payload:i})):Wa(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:t,payload:i}),this.core.history.delete(t,i.id))}catch(a){this.logger.error(a)}})}registerExpirerEvents(){this.core.expirer.on(en.expired,async e=>{const{topic:t}=ep(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(No.expire,{topic:t}))})}}class O8 extends z5{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new lr.exports.EventEmitter,this.name=t8,this.version=r8,this.cached=[],this.initialized=!1,this.storagePrefix=si,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,a)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:a}),this.records.has(i.id))return;const c={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:a,expiry:Wr(ye.THIRTY_DAYS)};this.records.set(c.id,c),this.events.emit(xn.created,c)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=dn(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(xn.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(a=>{if(a.topic===n){if(typeof i<"u"&&a.id!==i)return;this.records.delete(a.id),this.events.emit(xn.deleted,a)}})},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Xe.generateChildLogger(t,this.name)}get context(){return Xe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(t=>{if(typeof t.response<"u")return;const n={topic:t.topic,request:Ss(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:n}=ue("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(xn.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:t}=ue("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(xn.created,e=>{const t=xn.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(xn.updated,e=>{const t=xn.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(xn.deleted,e=>{const t=xn.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.core.heartbeat.on(Ds.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(e=>{ye.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.delete(e.topic,e.id))})}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}}class $8 extends Y5{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new lr.exports.EventEmitter,this.name=n8,this.version=i8,this.cached=[],this.initialized=!1,this.storagePrefix=si,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();const a=this.formatTarget(n),c={target:a,expiry:i};this.expirations.set(a,c),this.checkExpiry(a,c),this.events.emit(en.created,{target:a,expiration:c})},this.get=n=>{this.isInitialized();const i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){const i=this.formatTarget(n),a=this.getExpiration(i);this.expirations.delete(i),this.events.emit(en.deleted,{target:i,expiration:a})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Xe.generateChildLogger(t,this.name)}get context(){return Xe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return w_(e);if(typeof e=="number")return b_(e);const{message:t}=ue("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(en.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:t}=ue("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:n}=ue("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return t}checkExpiry(e,t){const{expiry:n}=t;ye.toMiliseconds(n)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(en.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(Ds.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(en.created,e=>{const t=en.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(en.expired,e=>{const t=en.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(en.deleted,e=>{const t=en.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}}}class A8 extends J5{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.name=ju,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async n=>{if(this.verifyDisabled||_s()||!Es())return;const i=this.getVerifyUrl(n?.verifyUrl);this.verifyUrl!==i&&this.removeIframe(),this.verifyUrl=i;try{await this.createIframe()}catch(a){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(a)}if(!this.initialized){this.removeIframe(),this.verifyUrl=Fu;try{await this.createIframe()}catch(a){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(a),this.verifyDisabled=!0}}},this.register=async n=>{this.initialized?this.sendPost(n.attestationId):(this.addToQueue(n.attestationId),await this.init())},this.resolve=async n=>{if(this.isDevEnv)return"";const i=this.getVerifyUrl(n?.verifyUrl);let a;try{a=await this.fetchAttestation(n.attestationId,i)}catch(c){this.logger.info(`failed to resolve attestation: ${n.attestationId} from url: ${i}`),this.logger.info(c),a=await this.fetchAttestation(n.attestationId,Fu)}return a},this.fetchAttestation=async(n,i)=>{this.logger.info(`resolving attestation: ${n} from url: ${i}`);const a=this.startAbortTimer(ye.ONE_SECOND*2),c=await fetch(`${i}/attestation/${n}`,{signal:this.abortController.signal});return clearTimeout(a),c.status===200?await c.json():void 0},this.addToQueue=n=>{this.queue.push(n)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(n=>this.sendPost(n)),this.queue=[])},this.sendPost=n=>{var i;try{if(!this.iframe)return;(i=this.iframe.contentWindow)==null||i.postMessage(n,"*"),this.logger.info(`postMessage sent: ${n} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let n;const i=a=>{a.data==="verify_ready"&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",i),n())};await Promise.race([new Promise(a=>{if(document.getElementById(ju))return a();window.addEventListener("message",i);const c=document.createElement("iframe");c.id=ju,c.src=`${this.verifyUrl}/${this.projectId}`,c.style.display="none",document.body.append(c),this.iframe=c,n=a}),new Promise((a,c)=>setTimeout(()=>{window.removeEventListener("message",i),c("verify iframe load timeout")},ye.toMiliseconds(ye.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=n=>{let i=n||Cs;return s8.includes(i)||(this.logger.info(`verify url: ${i}, not included in trusted list, assigning default: ${Cs}`),i=Cs),i},this.logger=Xe.generateChildLogger(t,this.name),this.verifyUrl=Cs,this.abortController=new AbortController,this.isDevEnv=ou()&&process.env.IS_VITEST}get context(){return Xe.getLoggerContext(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),ye.toMiliseconds(e))}}class P8 extends Z5{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,this.context=o8,this.registerDeviceToken=async n=>{const{clientId:i,token:a,notificationType:c,enableEncrypted:u=!1}=n,f=`${a8}/${this.projectId}/clients`;await sE(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:c,token:a,always_raw:u})})},this.logger=Xe.generateChildLogger(t,this.context)}}var T8=Object.defineProperty,A1=Object.getOwnPropertySymbols,R8=Object.prototype.hasOwnProperty,N8=Object.prototype.propertyIsEnumerable,P1=(r,e,t)=>e in r?T8(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,T1=(r,e)=>{for(var t in e||(e={}))R8.call(e,t)&&P1(r,t,e[t]);if(A1)for(var t of A1(e))N8.call(e,t)&&P1(r,t,e[t]);return r};class ku extends q5{constructor(e){super(e),this.protocol=y1,this.version=P4,this.name=Uu,this.events=new lr.exports.EventEmitter,this.initialized=!1,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||_1,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Xe.pino(Xe.getDefaultLoggerOptions({level:e?.logger||T4.logger}));this.logger=Xe.generateChildLogger(t,this.name),this.heartbeat=new Ds.HeartBeat,this.crypto=new l8(this,this.logger,e?.keychain),this.history=new O8(this,this.logger),this.expirer=new $8(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new K3(T1(T1({},R4),e?.storageOptions)),this.relayer=new x8({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new C8(this,this.logger),this.verify=new A8(this.projectId||"",this.logger),this.echoClient=new P8(this.projectId||"",this.logger)}static async init(e){const t=new ku(e);await t.initialize();const n=await t.crypto.getClientId();return await t.storage.setItem(Y4,n),t}get context(){return Xe.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const L8=ku,R1="wc",N1=2,L1="client",qu=`${R1}@${N1}:${L1}:`,zu={name:L1,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},M1="WALLETCONNECT_DEEPLINK_CHOICE",M8="proposal",U1="Proposal expired",U8="session",Ga=ye.SEVEN_DAYS,j8="engine",Fn={wc_sessionPropose:{req:{ttl:ye.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:1104},res:{ttl:ye.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:1106},res:{ttl:ye.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:ye.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:ye.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:ye.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:ye.ONE_DAY,prompt:!1,tag:1112},res:{ttl:ye.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:ye.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:ye.THIRTY_SECONDS,prompt:!1,tag:1115}}},Hu={min:ye.FIVE_MINUTES,max:ye.SEVEN_DAYS},Bn={idle:"IDLE",active:"ACTIVE"},F8="request",B8=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"];var k8=Object.defineProperty,q8=Object.defineProperties,z8=Object.getOwnPropertyDescriptors,j1=Object.getOwnPropertySymbols,H8=Object.prototype.hasOwnProperty,W8=Object.prototype.propertyIsEnumerable,F1=(r,e,t)=>e in r?k8(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ir=(r,e)=>{for(var t in e||(e={}))H8.call(e,t)&&F1(r,t,e[t]);if(j1)for(var t of j1(e))W8.call(e,t)&&F1(r,t,e[t]);return r},Os=(r,e)=>q8(r,z8(e));class K8 extends X5{constructor(e){super(e),this.name=j8,this.events=new lr.exports,this.initialized=!1,this.ignoredPayloadTypes=[Li],this.requestQueue={state:Bn.idle,queue:[]},this.sessionRequestQueue={state:Bn.idle,queue:[]},this.requestQueueDelay=ye.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(Fn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},ye.toMiliseconds(this.requestQueueDelay)))},this.connect=async t=>{await this.isInitialized();const n=Os(Ir({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:a,optionalNamespaces:c,sessionProperties:u,relays:f}=n;let h=i,m,w=!1;if(h&&(w=this.client.core.pairing.pairings.get(h).active),!h||!w){const{topic:C,uri:$}=await this.client.core.pairing.create();h=C,m=$}const y=await this.client.core.crypto.generateKeyPair(),x=Fn.wc_sessionPropose.req.ttl||ye.FIVE_MINUTES,S=Wr(x),P=Ir({requiredNamespaces:a,optionalNamespaces:c,relays:f??[{protocol:b1}],proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:S},u&&{sessionProperties:u}),{reject:U,resolve:j,done:A}=xs(x,U1);if(this.events.once(qt("session_connect"),async({error:C,session:$})=>{if(C)U(C);else if($){$.self.publicKey=y;const E=Os(Ir({},$),{requiredNamespaces:P.requiredNamespaces,optionalNamespaces:P.optionalNamespaces});await this.client.session.set($.topic,E),await this.setExpiry($.topic,$.expiry),h&&await this.client.core.pairing.updateMetadata({topic:h,metadata:$.peer.metadata}),j(E)}}),!h){const{message:C}=ue("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error(C)}const T=await this.sendRequest({topic:h,method:"wc_sessionPropose",params:P,throwOnFailedPublish:!0});return await this.setProposal(T,Ir({id:T},P)),{uri:m,approval:A}},this.pair=async t=>(await this.isInitialized(),await this.client.core.pairing.pair(t)),this.approve=async t=>{await this.isInitialized(),await this.isValidApprove(t);const{id:n,relayProtocol:i,namespaces:a,sessionProperties:c}=t,u=this.client.proposal.get(n);let{pairingTopic:f,proposer:h,requiredNamespaces:m,optionalNamespaces:w}=u;f=f||"";const y=await this.client.core.crypto.generateKeyPair(),x=h.publicKey,S=await this.client.core.crypto.generateSharedKey(y,x);f&&n&&(await this.client.core.pairing.updateMetadata({topic:f,metadata:h.metadata}),await this.sendResult({id:n,topic:f,result:{relay:{protocol:i??"irn"},responderPublicKey:y}}),await this.client.proposal.delete(n,It("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:f}));const P=Ir({relay:{protocol:i??"irn"},namespaces:a,pairingTopic:f,controller:{publicKey:y,metadata:this.client.metadata},expiry:Wr(Ga)},c&&{sessionProperties:c});await this.client.core.relayer.subscribe(S);const U=Os(Ir({},P),{topic:S,requiredNamespaces:m,optionalNamespaces:w,pairingTopic:f,acknowledged:!1,self:P.controller,peer:{publicKey:h.publicKey,metadata:h.metadata},controller:y});await this.client.session.set(S,U);try{await this.sendRequest({topic:S,method:"wc_sessionSettle",params:P,throwOnFailedPublish:!0})}catch(j){throw this.client.logger.error(j),this.client.session.delete(S,It("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(S),j}return await this.setExpiry(S,Wr(Ga)),{topic:S,acknowledged:()=>new Promise(j=>setTimeout(()=>j(this.client.session.get(S)),500))}},this.reject=async t=>{await this.isInitialized(),await this.isValidReject(t);const{id:n,reason:i}=t,{pairingTopic:a}=this.client.proposal.get(n);a&&(await this.sendError(n,a,i),await this.client.proposal.delete(n,It("USER_DISCONNECTED")))},this.update=async t=>{await this.isInitialized(),await this.isValidUpdate(t);const{topic:n,namespaces:i}=t,a=await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i}}),{done:c,resolve:u,reject:f}=xs();return this.events.once(qt("session_update",a),({error:h})=>{h?f(h):u()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:c}},this.extend=async t=>{await this.isInitialized(),await this.isValidExtend(t);const{topic:n}=t,i=await this.sendRequest({topic:n,method:"wc_sessionExtend",params:{}}),{done:a,resolve:c,reject:u}=xs();return this.events.once(qt("session_extend",i),({error:f})=>{f?u(f):c()}),await this.setExpiry(n,Wr(Ga)),{acknowledged:a}},this.request=async t=>{await this.isInitialized(),await this.isValidRequest(t);const{chainId:n,request:i,topic:a,expiry:c=Fn.wc_sessionRequest.req.ttl}=t,u=Pu(),{done:f,resolve:h,reject:m}=xs(c,"Request expired. Please try again.");return this.events.once(qt("session_request",u),({error:w,result:y})=>{w?m(w):h(y)}),await Promise.all([new Promise(async w=>{await this.sendRequest({clientRpcId:u,topic:a,method:"wc_sessionRequest",params:{request:Os(Ir({},i),{expiryTimestamp:Wr(c)}),chainId:n},expiry:c,throwOnFailedPublish:!0}).catch(y=>m(y)),this.client.events.emit("session_request_sent",{topic:a,request:i,chainId:n,id:u}),w()}),new Promise(async w=>{const y=await E_(this.client.core.storage,M1);__({id:u,topic:a,wcDeepLink:y}),w()}),f()]).then(w=>w[2])},this.respond=async t=>{await this.isInitialized(),await this.isValidRespond(t);const{topic:n,response:i}=t,{id:a}=i;Mn(i)?await this.sendResult({id:a,topic:n,result:i.result,throwOnFailedPublish:!0}):dn(i)&&await this.sendError(a,n,i.error),this.cleanupAfterResponse(t)},this.ping=async t=>{await this.isInitialized(),await this.isValidPing(t);const{topic:n}=t;if(this.client.session.keys.includes(n)){const i=await this.sendRequest({topic:n,method:"wc_sessionPing",params:{}}),{done:a,resolve:c,reject:u}=xs();this.events.once(qt("session_ping",i),({error:f})=>{f?u(f):c()}),await a()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async t=>{await this.isInitialized(),await this.isValidEmit(t);const{topic:n,event:i,chainId:a}=t;await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:a}})},this.disconnect=async t=>{await this.isInitialized(),await this.isValidDisconnect(t);const{topic:n}=t;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:It("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=ue("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(n=>B_(n,t))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.cleanupDuplicatePairings=async t=>{if(t.pairingTopic)try{const n=this.client.core.pairing.pairings.get(t.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(a=>{var c,u;return((c=a.peerMetadata)==null?void 0:c.url)&&((u=a.peerMetadata)==null?void 0:u.url)===t.peer.metadata.url&&a.topic&&a.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(a=>this.client.core.pairing.disconnect({topic:a.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async t=>{const{topic:n,expirerHasDeleted:i=!1,emitEvent:a=!0,id:c=0}=t,{self:u}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,It("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(u.publicKey)&&await this.client.core.crypto.deleteKeyPair(u.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),i||this.client.core.expirer.del(n),this.client.core.storage.removeItem(M1).catch(f=>this.client.logger.warn(f)),this.getPendingSessionRequests().forEach(f=>{f.topic===n&&this.deletePendingSessionRequest(f.id,It("USER_DISCONNECTED"))}),a&&this.client.events.emit("session_delete",{id:c,topic:n})},this.deleteProposal=async(t,n)=>{await Promise.all([this.client.proposal.delete(t,It("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(t)])},this.deletePendingSessionRequest=async(t,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,n),i?Promise.resolve():this.client.core.expirer.del(t)]),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(a=>a.id!==t),i&&(this.sessionRequestQueue.state=Bn.idle,this.client.events.emit("session_request_expire",{id:t}))},this.setExpiry=async(t,n)=>{this.client.session.keys.includes(t)&&await this.client.session.update(t,{expiry:n}),this.client.core.expirer.set(t,n)},this.setProposal=async(t,n)=>{await this.client.proposal.set(t,n),this.client.core.expirer.set(t,Wr(Fn.wc_sessionPropose.req.ttl))},this.setPendingSessionRequest=async t=>{const{id:n,topic:i,params:a,verifyContext:c}=t,u=a.request.expiryTimestamp||Wr(Fn.wc_sessionRequest.req.ttl);await this.client.pendingRequest.set(n,{id:n,topic:i,params:a,verifyContext:c}),u&&this.client.core.expirer.set(n,u)},this.sendRequest=async t=>{const{topic:n,method:i,params:a,expiry:c,relayRpcId:u,clientRpcId:f,throwOnFailedPublish:h}=t,m=Ss(i,a,f);if(Es()&&B8.includes(i)){const x=bs(JSON.stringify(m));this.client.core.verify.register({attestationId:x})}const w=await this.client.core.crypto.encode(n,m),y=Fn[i].req;return c&&(y.ttl=c),u&&(y.id=u),this.client.core.history.set(n,m),h?(y.internal=Os(Ir({},y.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,w,y)):this.client.core.relayer.publish(n,w,y).catch(x=>this.client.logger.error(x)),m.id},this.sendResult=async t=>{const{id:n,topic:i,result:a,throwOnFailedPublish:c}=t,u=za(n,a),f=await this.client.core.crypto.encode(i,u),h=await this.client.core.history.get(i,n),m=Fn[h.request.method].res;c?(m.internal=Os(Ir({},m.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,f,m)):this.client.core.relayer.publish(i,f,m).catch(w=>this.client.logger.error(w)),await this.client.core.history.resolve(u)},this.sendError=async(t,n,i)=>{const a=Ha(t,i),c=await this.client.core.crypto.encode(n,a),u=await this.client.core.history.get(n,t),f=Fn[u.request.method].res;this.client.core.relayer.publish(n,c,f),await this.client.core.history.resolve(a)},this.cleanup=async()=>{const t=[],n=[];this.client.session.getAll().forEach(i=>{let a=!1;ii(i.expiry)&&(a=!0),this.client.core.crypto.keychain.has(i.topic)||(a=!0),a&&t.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{ii(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...t.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async t=>{this.requestQueue.queue.push(t),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Bn.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Bn.active;const t=this.requestQueue.queue.shift();if(t)try{this.processRequest(t),await new Promise(n=>setTimeout(n,300))}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Bn.idle},this.processRequest=t=>{const{topic:n,payload:i}=t,a=i.method;switch(a){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${a}`)}},this.onRelayEventResponse=async t=>{const{topic:n,payload:i}=t,a=(await this.client.core.history.get(n,i.id)).request.method;switch(a){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${a}`)}},this.onRelayEventUnknownPayload=t=>{const{topic:n}=t,{message:i}=ue("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.onSessionProposeRequest=async(t,n)=>{const{params:i,id:a}=n;try{this.isValidConnect(Ir({},n.params));const c=i.expiryTimestamp||Wr(Fn.wc_sessionPropose.req.ttl),u=Ir({id:a,pairingTopic:t,expiryTimestamp:c},i);await this.setProposal(a,u);const f=bs(JSON.stringify(n)),h=await this.getVerifyContext(f,u.proposer.metadata);this.client.events.emit("session_proposal",{id:a,params:u,verifyContext:h})}catch(c){await this.sendError(a,t,c),this.client.logger.error(c)}},this.onSessionProposeResponse=async(t,n)=>{const{id:i}=n;if(Mn(n)){const{result:a}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:a});const c=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:c});const u=c.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});const f=a.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:f});const h=await this.client.core.crypto.generateSharedKey(u,f);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:h});const m=await this.client.core.relayer.subscribe(h);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:m}),await this.client.core.pairing.activate({topic:t})}else dn(n)&&(await this.client.proposal.delete(i,It("USER_DISCONNECTED")),this.events.emit(qt("session_connect"),{error:n.error}))},this.onSessionSettleRequest=async(t,n)=>{const{id:i,params:a}=n;try{this.isValidSessionSettleRequest(a);const{relay:c,controller:u,expiry:f,namespaces:h,sessionProperties:m,pairingTopic:w}=n.params,y=Ir({topic:t,relay:c,expiry:f,namespaces:h,acknowledged:!0,pairingTopic:w,requiredNamespaces:{},optionalNamespaces:{},controller:u.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:u.publicKey,metadata:u.metadata}},m&&{sessionProperties:m});await this.sendResult({id:n.id,topic:t,result:!0}),this.events.emit(qt("session_connect"),{session:y}),this.cleanupDuplicatePairings(y)}catch(c){await this.sendError(i,t,c),this.client.logger.error(c)}},this.onSessionSettleResponse=async(t,n)=>{const{id:i}=n;Mn(n)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(qt("session_approve",i),{})):dn(n)&&(await this.client.session.delete(t,It("USER_DISCONNECTED")),this.events.emit(qt("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(t,n)=>{const{params:i,id:a}=n;try{const c=`${t}_session_update`,u=Ma.get(c);if(u&&this.isRequestOutOfSync(u,a)){this.client.logger.info(`Discarding out of sync request - ${a}`);return}this.isValidUpdate(Ir({topic:t},i)),await this.client.session.update(t,{namespaces:i.namespaces}),await this.sendResult({id:a,topic:t,result:!0}),this.client.events.emit("session_update",{id:a,topic:t,params:i}),Ma.set(c,a)}catch(c){await this.sendError(a,t,c),this.client.logger.error(c)}},this.isRequestOutOfSync=(t,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(t.toString().slice(0,-3)),this.onSessionUpdateResponse=(t,n)=>{const{id:i}=n;Mn(n)?this.events.emit(qt("session_update",i),{}):dn(n)&&this.events.emit(qt("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(t,n)=>{const{id:i}=n;try{this.isValidExtend({topic:t}),await this.setExpiry(t,Wr(Ga)),await this.sendResult({id:i,topic:t,result:!0}),this.client.events.emit("session_extend",{id:i,topic:t})}catch(a){await this.sendError(i,t,a),this.client.logger.error(a)}},this.onSessionExtendResponse=(t,n)=>{const{id:i}=n;Mn(n)?this.events.emit(qt("session_extend",i),{}):dn(n)&&this.events.emit(qt("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(t,n)=>{const{id:i}=n;try{this.isValidPing({topic:t}),await this.sendResult({id:i,topic:t,result:!0}),this.client.events.emit("session_ping",{id:i,topic:t})}catch(a){await this.sendError(i,t,a),this.client.logger.error(a)}},this.onSessionPingResponse=(t,n)=>{const{id:i}=n;setTimeout(()=>{Mn(n)?this.events.emit(qt("session_ping",i),{}):dn(n)&&this.events.emit(qt("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(t,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:t,reason:n.params}),await Promise.all([new Promise(a=>{this.client.core.relayer.once(pr.publish,async()=>{a(await this.deleteSession({topic:t,id:i}))})}),this.sendResult({id:i,topic:t,result:!0}),this.cleanupPendingSentRequestsForTopic({topic:t,error:It("USER_DISCONNECTED")})])}catch(a){this.client.logger.error(a)}},this.onSessionRequest=async(t,n)=>{const{id:i,params:a}=n;try{this.isValidRequest(Ir({topic:t},a));const c=bs(JSON.stringify(Ss("wc_sessionRequest",a,i))),u=this.client.session.get(t),f=await this.getVerifyContext(c,u.peer.metadata),h={id:i,topic:t,params:a,verifyContext:f};await this.setPendingSessionRequest(h),this.addSessionRequestToSessionRequestQueue(h),this.processSessionRequestQueue()}catch(c){await this.sendError(i,t,c),this.client.logger.error(c)}},this.onSessionRequestResponse=(t,n)=>{const{id:i}=n;Mn(n)?this.events.emit(qt("session_request",i),{result:n.result}):dn(n)&&this.events.emit(qt("session_request",i),{error:n.error})},this.onSessionEventRequest=async(t,n)=>{const{id:i,params:a}=n;try{const c=`${t}_session_event_${a.event.name}`,u=Ma.get(c);if(u&&this.isRequestOutOfSync(u,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(Ir({topic:t},a)),this.client.events.emit("session_event",{id:i,topic:t,params:a}),Ma.set(c,i)}catch(c){await this.sendError(i,t,c),this.client.logger.error(c)}},this.addSessionRequestToSessionRequestQueue=t=>{this.sessionRequestQueue.queue.push(t)},this.cleanupAfterResponse=t=>{this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Bn.idle,this.processSessionRequestQueue()},ye.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:t,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(a=>a.topic===t&&a.request.method==="wc_sessionRequest").forEach(a=>{this.events.emit(qt("session_request",a.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Bn.active){this.client.logger.info("session request queue is already active.");return}const t=this.sessionRequestQueue.queue[0];if(!t){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Bn.active,this.client.events.emit("session_request",t)}catch(n){this.client.logger.error(n)}},this.onPairingCreated=t=>{if(t.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===t.topic);n&&this.onSessionProposeRequest(t.topic,Ss("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id))},this.isValidConnect=async t=>{if(!Rr(t)){const{message:f}=ue("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(f)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:a,sessionProperties:c,relays:u}=t;if(_r(n)||await this.isValidPairingTopic(n),!Q_(u,!0)){const{message:f}=ue("MISSING_OR_INVALID",`connect() relays: ${u}`);throw new Error(f)}!_r(i)&&xo(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!_r(a)&&xo(a)!==0&&this.validateNamespaces(a,"optionalNamespaces"),_r(c)||this.validateSessionProps(c,"sessionProperties")},this.validateNamespaces=(t,n)=>{const i=Z_(t,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async t=>{if(!Rr(t))throw new Error(ue("MISSING_OR_INVALID",`approve() params: ${t}`).message);const{id:n,namespaces:i,relayProtocol:a,sessionProperties:c}=t;await this.isValidProposalId(n);const u=this.client.proposal.get(n),f=hu(i,"approve()");if(f)throw new Error(f.message);const h=cp(u.requiredNamespaces,i,"approve()");if(h)throw new Error(h.message);if(!ir(a,!0)){const{message:m}=ue("MISSING_OR_INVALID",`approve() relayProtocol: ${a}`);throw new Error(m)}_r(c)||this.validateSessionProps(c,"sessionProperties")},this.isValidReject=async t=>{if(!Rr(t)){const{message:a}=ue("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(a)}const{id:n,reason:i}=t;if(await this.isValidProposalId(n),!e3(i)){const{message:a}=ue("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidSessionSettleRequest=t=>{if(!Rr(t)){const{message:h}=ue("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(h)}const{relay:n,controller:i,namespaces:a,expiry:c}=t;if(!op(n)){const{message:h}=ue("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(h)}const u=W_(i,"onSessionSettleRequest()");if(u)throw new Error(u.message);const f=hu(a,"onSessionSettleRequest()");if(f)throw new Error(f.message);if(ii(c)){const{message:h}=ue("EXPIRED","onSessionSettleRequest()");throw new Error(h)}},this.isValidUpdate=async t=>{if(!Rr(t)){const{message:f}=ue("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(f)}const{topic:n,namespaces:i}=t;await this.isValidSessionTopic(n);const a=this.client.session.get(n),c=hu(i,"update()");if(c)throw new Error(c.message);const u=cp(a.requiredNamespaces,i,"update()");if(u)throw new Error(u.message)},this.isValidExtend=async t=>{if(!Rr(t)){const{message:i}=ue("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(i)}const{topic:n}=t;await this.isValidSessionTopic(n)},this.isValidRequest=async t=>{if(!Rr(t)){const{message:f}=ue("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(f)}const{topic:n,request:i,chainId:a,expiry:c}=t;await this.isValidSessionTopic(n);const{namespaces:u}=this.client.session.get(n);if(!ap(u,a)){const{message:f}=ue("MISSING_OR_INVALID",`request() chainId: ${a}`);throw new Error(f)}if(!t3(i)){const{message:f}=ue("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(f)}if(!i3(u,a,i.method)){const{message:f}=ue("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(f)}if(c&&!c3(c,Hu)){const{message:f}=ue("MISSING_OR_INVALID",`request() expiry: ${c}. Expiry must be a number (in seconds) between ${Hu.min} and ${Hu.max}`);throw new Error(f)}},this.isValidRespond=async t=>{var n;if(!Rr(t)){const{message:c}=ue("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(c)}const{topic:i,response:a}=t;try{await this.isValidSessionTopic(i)}catch(c){throw(n=t?.response)!=null&&n.id&&this.cleanupAfterResponse(t),c}if(!r3(a)){const{message:c}=ue("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(a)}`);throw new Error(c)}},this.isValidPing=async t=>{if(!Rr(t)){const{message:i}=ue("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(i)}const{topic:n}=t;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async t=>{if(!Rr(t)){const{message:u}=ue("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(u)}const{topic:n,event:i,chainId:a}=t;await this.isValidSessionTopic(n);const{namespaces:c}=this.client.session.get(n);if(!ap(c,a)){const{message:u}=ue("MISSING_OR_INVALID",`emit() chainId: ${a}`);throw new Error(u)}if(!n3(i)){const{message:u}=ue("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(u)}if(!s3(c,a,i.name)){const{message:u}=ue("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(u)}},this.isValidDisconnect=async t=>{if(!Rr(t)){const{message:i}=ue("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(i)}const{topic:n}=t;await this.isValidSessionOrPairingTopic(n)},this.getVerifyContext=async(t,n)=>{const i={verified:{verifyUrl:n.verifyUrl||Cs,validation:"UNKNOWN",origin:n.url||""}};try{const a=await this.client.core.verify.resolve({attestationId:t,verifyUrl:n.verifyUrl});a&&(i.verified.origin=a.origin,i.verified.isScam=a.isScam,i.verified.validation=a.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(a){this.client.logger.info(a)}return this.client.logger.info(`Verify context: ${JSON.stringify(i)}`),i},this.validateSessionProps=(t,n)=>{Object.values(t).forEach(i=>{if(!ir(i,!1)){const{message:a}=ue("MISSING_OR_INVALID",`${n} must be in Record<string, string> format. Received: ${JSON.stringify(i)}`);throw new Error(a)}})}}async isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(pr.message,async e=>{const{topic:t,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;const i=await this.client.core.crypto.decode(t,n);try{Tu(i)?(this.client.core.history.set(t,i),this.onRelayEventRequest({topic:t,payload:i})):Wa(i)?(await this.client.core.history.resolve(i),await this.onRelayEventResponse({topic:t,payload:i}),this.client.core.history.delete(t,i.id)):this.onRelayEventUnknownPayload({topic:t,payload:i})}catch(a){this.client.logger.error(a)}})}registerExpirerEvents(){this.client.core.expirer.on(en.expired,async e=>{const{topic:t,id:n}=ep(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,ue("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(No.create,e=>this.onPairingCreated(e))}isValidPairingTopic(e){if(!ir(e,!1)){const{message:t}=ue("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=ue("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(ii(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=ue("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!ir(e,!1)){const{message:t}=ue("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(!this.client.session.keys.includes(e)){const{message:t}=ue("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(ii(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:t}=ue("EXPIRED",`session topic: ${e}`);throw new Error(t)}if(!this.client.core.crypto.keychain.has(e)){const{message:t}=ue("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(t)}}async isValidSessionOrPairingTopic(e){if(this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(ir(e,!1)){const{message:t}=ue("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}else{const{message:t}=ue("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}async isValidProposalId(e){if(!X_(e)){const{message:t}=ue("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=ue("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(ii(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:t}=ue("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class V8 extends Va{constructor(e,t){super(e,t,M8,qu),this.core=e,this.logger=t}}class G8 extends Va{constructor(e,t){super(e,t,U8,qu),this.core=e,this.logger=t}}class Y8 extends Va{constructor(e,t){super(e,t,F8,qu,n=>n.id),this.core=e,this.logger=t}}class Wu extends Q5{constructor(e){super(e),this.protocol=R1,this.version=N1,this.name=zu.name,this.events=new lr.exports.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.name=e?.name||zu.name,this.metadata=e?.metadata||p_();const t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Xe.pino(Xe.getDefaultLoggerOptions({level:e?.logger||zu.logger}));this.core=e?.core||new L8(e),this.logger=Xe.generateChildLogger(t,this.name),this.session=new G8(this.core,this.logger),this.proposal=new V8(this.core,this.logger),this.pendingRequest=new Y8(this.core,this.logger),this.engine=new K8(this)}static async init(e){const t=new Wu(e);return await t.initialize(),t}get context(){return Xe.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var Ku={exports:{}};(function(r,e){var t=typeof self<"u"?self:yr,n=function(){function a(){this.fetch=!1,this.DOMException=t.DOMException}return a.prototype=t,new a}();(function(a){(function(c){var u={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 f(I){return I&&DataView.prototype.isPrototypeOf(I)}if(u.arrayBuffer)var h=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],m=ArrayBuffer.isView||function(I){return I&&h.indexOf(Object.prototype.toString.call(I))>-1};function w(I){if(typeof I!="string"&&(I=String(I)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(I))throw new TypeError("Invalid character in header field name");return I.toLowerCase()}function y(I){return typeof I!="string"&&(I=String(I)),I}function x(I){var N={next:function(){var X=I.shift();return{done:X===void 0,value:X}}};return u.iterable&&(N[Symbol.iterator]=function(){return N}),N}function S(I){this.map={},I instanceof S?I.forEach(function(N,X){this.append(X,N)},this):Array.isArray(I)?I.forEach(function(N){this.append(N[0],N[1])},this):I&&Object.getOwnPropertyNames(I).forEach(function(N){this.append(N,I[N])},this)}S.prototype.append=function(I,N){I=w(I),N=y(N);var X=this.map[I];this.map[I]=X?X+", "+N:N},S.prototype.delete=function(I){delete this.map[w(I)]},S.prototype.get=function(I){return I=w(I),this.has(I)?this.map[I]:null},S.prototype.has=function(I){return this.map.hasOwnProperty(w(I))},S.prototype.set=function(I,N){this.map[w(I)]=y(N)},S.prototype.forEach=function(I,N){for(var X in this.map)this.map.hasOwnProperty(X)&&I.call(N,this.map[X],X,this)},S.prototype.keys=function(){var I=[];return this.forEach(function(N,X){I.push(X)}),x(I)},S.prototype.values=function(){var I=[];return this.forEach(function(N){I.push(N)}),x(I)},S.prototype.entries=function(){var I=[];return this.forEach(function(N,X){I.push([X,N])}),x(I)},u.iterable&&(S.prototype[Symbol.iterator]=S.prototype.entries);function P(I){if(I.bodyUsed)return Promise.reject(new TypeError("Already read"));I.bodyUsed=!0}function U(I){return new Promise(function(N,X){I.onload=function(){N(I.result)},I.onerror=function(){X(I.error)}})}function j(I){var N=new FileReader,X=U(N);return N.readAsArrayBuffer(I),X}function A(I){var N=new FileReader,X=U(N);return N.readAsText(I),X}function T(I){for(var N=new Uint8Array(I),X=new Array(N.length),ee=0;ee<N.length;ee++)X[ee]=String.fromCharCode(N[ee]);return X.join("")}function C(I){if(I.slice)return I.slice(0);var N=new Uint8Array(I.byteLength);return N.set(new Uint8Array(I)),N.buffer}function $(){return this.bodyUsed=!1,this._initBody=function(I){this._bodyInit=I,I?typeof I=="string"?this._bodyText=I:u.blob&&Blob.prototype.isPrototypeOf(I)?this._bodyBlob=I:u.formData&&FormData.prototype.isPrototypeOf(I)?this._bodyFormData=I:u.searchParams&&URLSearchParams.prototype.isPrototypeOf(I)?this._bodyText=I.toString():u.arrayBuffer&&u.blob&&f(I)?(this._bodyArrayBuffer=C(I.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(I)||m(I))?this._bodyArrayBuffer=C(I):this._bodyText=I=Object.prototype.toString.call(I):this._bodyText="",this.headers.get("content-type")||(typeof I=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):u.searchParams&&URLSearchParams.prototype.isPrototypeOf(I)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u.blob&&(this.blob=function(){var I=P(this);if(I)return I;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(){return this._bodyArrayBuffer?P(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(j)}),this.text=function(){var I=P(this);if(I)return I;if(this._bodyBlob)return A(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(T(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},u.formData&&(this.formData=function(){return this.text().then(H)}),this.json=function(){return this.text().then(JSON.parse)},this}var E=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function d(I){var N=I.toUpperCase();return E.indexOf(N)>-1?N:I}function b(I,N){N=N||{};var X=N.body;if(I instanceof b){if(I.bodyUsed)throw new TypeError("Already read");this.url=I.url,this.credentials=I.credentials,N.headers||(this.headers=new S(I.headers)),this.method=I.method,this.mode=I.mode,this.signal=I.signal,!X&&I._bodyInit!=null&&(X=I._bodyInit,I.bodyUsed=!0)}else this.url=String(I);if(this.credentials=N.credentials||this.credentials||"same-origin",(N.headers||!this.headers)&&(this.headers=new S(N.headers)),this.method=d(N.method||this.method||"GET"),this.mode=N.mode||this.mode||null,this.signal=N.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&X)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(X)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})};function H(I){var N=new FormData;return I.trim().split("&").forEach(function(X){if(X){var ee=X.split("="),Y=ee.shift().replace(/\+/g," "),J=ee.join("=").replace(/\+/g," ");N.append(decodeURIComponent(Y),decodeURIComponent(J))}}),N}function F(I){var N=new S,X=I.replace(/\r?\n[\t ]+/g," ");return X.split(/\r?\n/).forEach(function(ee){var Y=ee.split(":"),J=Y.shift().trim();if(J){var Q=Y.join(":").trim();N.append(J,Q)}}),N}$.call(b.prototype);function V(I,N){N||(N={}),this.type="default",this.status=N.status===void 0?200:N.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in N?N.statusText:"OK",this.headers=new S(N.headers),this.url=N.url||"",this._initBody(I)}$.call(V.prototype),V.prototype.clone=function(){return new V(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new S(this.headers),url:this.url})},V.error=function(){var I=new V(null,{status:0,statusText:""});return I.type="error",I};var se=[301,302,303,307,308];V.redirect=function(I,N){if(se.indexOf(N)===-1)throw new RangeError("Invalid status code");return new V(null,{status:N,headers:{location:I}})},c.DOMException=a.DOMException;try{new c.DOMException}catch{c.DOMException=function(N,X){this.message=N,this.name=X;var ee=Error(N);this.stack=ee.stack},c.DOMException.prototype=Object.create(Error.prototype),c.DOMException.prototype.constructor=c.DOMException}function ce(I,N){return new Promise(function(X,ee){var Y=new b(I,N);if(Y.signal&&Y.signal.aborted)return ee(new c.DOMException("Aborted","AbortError"));var J=new XMLHttpRequest;function Q(){J.abort()}J.onload=function(){var ie={status:J.status,statusText:J.statusText,headers:F(J.getAllResponseHeaders()||"")};ie.url="responseURL"in J?J.responseURL:ie.headers.get("X-Request-URL");var Ee="response"in J?J.response:J.responseText;X(new V(Ee,ie))},J.onerror=function(){ee(new TypeError("Network request failed"))},J.ontimeout=function(){ee(new TypeError("Network request failed"))},J.onabort=function(){ee(new c.DOMException("Aborted","AbortError"))},J.open(Y.method,Y.url,!0),Y.credentials==="include"?J.withCredentials=!0:Y.credentials==="omit"&&(J.withCredentials=!1),"responseType"in J&&u.blob&&(J.responseType="blob"),Y.headers.forEach(function(ie,Ee){J.setRequestHeader(Ee,ie)}),Y.signal&&(Y.signal.addEventListener("abort",Q),J.onreadystatechange=function(){J.readyState===4&&Y.signal.removeEventListener("abort",Q)}),J.send(typeof Y._bodyInit>"u"?null:Y._bodyInit)})}return ce.polyfill=!0,a.fetch||(a.fetch=ce,a.Headers=S,a.Request=b,a.Response=V),c.Headers=S,c.Request=b,c.Response=V,c.fetch=ce,Object.defineProperty(c,"__esModule",{value:!0}),c})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,r.exports=e})(Ku,Ku.exports);var B1=Oy(Ku.exports);const k1={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"},q1=10;class oi{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new lr.exports.EventEmitter,this.isAvailable=!1,this.registering=!1,!Vp(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e,t){this.isAvailable||await this.register();try{const n=ji(e),a=await(await B1(this.url,Object.assign(Object.assign({},k1),{body:n}))).json();this.onPayload({data:a})}catch(n){this.onError(e.id,n)}}async register(e=this.url){if(!Vp(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((n,i)=>{this.events.once("register_error",a=>{this.resetMaxListeners(),i(a)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=ji({id:1,jsonrpc:"2.0",method:"test",params:[]});await B1(e,Object.assign(Object.assign({},k1),{body:t}))}this.onOpen()}catch(t){const n=this.parseError(t);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?Do(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const n=this.parseError(t),i=n.message||n.toString(),a=Ha(e,i);this.events.emit("payload",a)}parseError(e,t=this.url){return Bp(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>q1&&this.events.setMaxListeners(q1)}}const z1="error",J8="wss://relay.walletconnect.com",Z8="wc",Q8="universal_provider",H1=`${Z8}@2:${Q8}:`,X8="https://rpc.walletconnect.com/v1/",kn={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Mo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Vu={exports:{}};/**
|
|
59
|
+
***************************************************************************** */var Gu=function(r,e){return Gu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},Gu(r,e)};function z8(r,e){Gu(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Yu=function(){return Yu=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},Yu.apply(this,arguments)};function q8(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function H8(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var u=r.length-1;u>=0;u--)(c=r[u])&&(a=(i<3?c(a):i>3?c(e,t,a):c(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a}function W8(r,e){return function(t,n){e(t,n,r)}}function K8(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function V8(r,e,t,n){function i(a){return a instanceof t?a:new t(function(c){c(a)})}return new(t||(t=Promise))(function(a,c){function u(m){try{h(n.next(m))}catch(w){c(w)}}function f(m){try{h(n.throw(m))}catch(w){c(w)}}function h(m){m.done?a(m.value):i(m.value).then(u,f)}h((n=n.apply(r,e||[])).next())})}function G8(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,c;return c={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(h){return function(m){return f([h,m])}}function f(h){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(a=h[0]&2?i.return:h[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,h[1])).done)return a;switch(i=0,a&&(h=[h[0]&2,a.value]),h[0]){case 0:case 1:a=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,i=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!a||h[1]>a[0]&&h[1]<a[3])){t.label=h[1];break}if(h[0]===6&&t.label<a[1]){t.label=a[1],a=h;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(h);break}a[2]&&t.ops.pop(),t.trys.pop();continue}h=e.call(r,t)}catch(m){h=[6,m],i=0}finally{n=a=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function Y8(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}function Z8(r,e){for(var t in r)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=r[t])}function Zu(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function qg(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,a=[],c;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(u){c={error:u}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(c)throw c.error}}return a}function J8(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(qg(arguments[e]));return r}function Q8(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),i=0,e=0;e<t;e++)for(var a=arguments[e],c=0,u=a.length;c<u;c++,i++)n[i]=a[c];return n}function Ho(r){return this instanceof Ho?(this.v=r,this):new Ho(r)}function X8(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,a=[];return i={},c("next"),c("throw"),c("return"),i[Symbol.asyncIterator]=function(){return this},i;function c(y){n[y]&&(i[y]=function(b){return new Promise(function(I,A){a.push([y,b,I,A])>1||u(y,b)})})}function u(y,b){try{f(n[y](b))}catch(I){w(a[0][3],I)}}function f(y){y.value instanceof Ho?Promise.resolve(y.value.v).then(h,m):w(a[0][2],y)}function h(y){u("next",y)}function m(y){u("throw",y)}function w(y,b){y(b),a.shift(),a.length&&u(a[0][0],a[0][1])}}function ex(r){var e,t;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,a){e[i]=r[i]?function(c){return(t=!t)?{value:Ho(r[i](c)),done:i==="return"}:a?a(c):c}:a}}function tx(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof Zu=="function"?Zu(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(c){return new Promise(function(u,f){c=r[a](c),i(u,f,c.done,c.value)})}}function i(a,c,u,f){Promise.resolve(f).then(function(h){a({value:h,done:u})},c)}}function rx(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function nx(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function ix(r){return r&&r.__esModule?r:{default:r}}function sx(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function ox(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var ax=Object.freeze({__proto__:null,__extends:z8,get __assign(){return Yu},__rest:q8,__decorate:H8,__param:W8,__metadata:K8,__awaiter:V8,__generator:G8,__createBinding:Y8,__exportStar:Z8,__values:Zu,__read:qg,__spread:J8,__spreadArrays:Q8,__await:Ho,__asyncGenerator:X8,__asyncDelegator:ex,__asyncValues:tx,__makeTemplateObject:rx,__importStar:nx,__importDefault:ix,__classPrivateFieldGet:sx,__classPrivateFieldSet:ox}),cx=Li(ax),Ki={},Hg;function Wg(){return Hg||(Hg=1,Object.defineProperty(Ki,"__esModule",{value:!0}),Ki.PINO_CUSTOM_CONTEXT_KEY=Ki.PINO_LOGGER_DEFAULTS=void 0,Ki.PINO_LOGGER_DEFAULTS={level:"info"},Ki.PINO_CUSTOM_CONTEXT_KEY="custom_context"),Ki}var _r={},Kg;function lx(){if(Kg)return _r;Kg=1,Object.defineProperty(_r,"__esModule",{value:!0}),_r.generateChildLogger=_r.formatChildLoggerContext=_r.getLoggerContext=_r.setBrowserLoggerContext=_r.getBrowserLoggerContext=_r.getDefaultLoggerOptions=void 0;const r=Wg();function e(u){return Object.assign(Object.assign({},u),{level:u?.level||r.PINO_LOGGER_DEFAULTS.level})}_r.getDefaultLoggerOptions=e;function t(u,f=r.PINO_CUSTOM_CONTEXT_KEY){return u[f]||""}_r.getBrowserLoggerContext=t;function n(u,f,h=r.PINO_CUSTOM_CONTEXT_KEY){return u[h]=f,u}_r.setBrowserLoggerContext=n;function i(u,f=r.PINO_CUSTOM_CONTEXT_KEY){let h="";return typeof u.bindings>"u"?h=t(u,f):h=u.bindings().context||"",h}_r.getLoggerContext=i;function a(u,f,h=r.PINO_CUSTOM_CONTEXT_KEY){const m=i(u,h);return m.trim()?`${m}/${f}`:f}_r.formatChildLoggerContext=a;function c(u,f,h=r.PINO_CUSTOM_CONTEXT_KEY){const m=a(u,f,h),w=u.child({context:m});return n(w,m,h)}return _r.generateChildLogger=c,_r}(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.pino=void 0;const e=cx,t=e.__importDefault(M0());Object.defineProperty(r,"pino",{enumerable:!0,get:function(){return t.default}}),e.__exportStar(Wg(),r),e.__exportStar(lx(),r)})(Wi);const Vg="wc",Gg=2,Yg="client",Ju=`${Vg}@${Gg}:${Yg}:`,Qu={name:Yg,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},Zg="WALLETCONNECT_DEEPLINK_CHOICE",ux="proposal",Jg="Proposal expired",hx="session",ic=me.SEVEN_DAYS,fx="engine",kn={wc_sessionPropose:{req:{ttl:me.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:me.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:me.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:me.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:me.ONE_DAY,prompt:!1,tag:1104},res:{ttl:me.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:me.ONE_DAY,prompt:!1,tag:1106},res:{ttl:me.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:me.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:me.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:me.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:me.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:me.ONE_DAY,prompt:!1,tag:1112},res:{ttl:me.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:me.ONE_DAY,prompt:!1,tag:1114},res:{ttl:me.ONE_DAY,prompt:!1,tag:1115}}},Xu={min:me.FIVE_MINUTES,max:me.SEVEN_DAYS},zn={idle:"IDLE",active:"ACTIVE"},dx="request",px=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"];var gx=Object.defineProperty,mx=Object.defineProperties,vx=Object.getOwnPropertyDescriptors,Qg=Object.getOwnPropertySymbols,yx=Object.prototype.hasOwnProperty,wx=Object.prototype.propertyIsEnumerable,Xg=(r,e,t)=>e in r?gx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,dr=(r,e)=>{for(var t in e||(e={}))yx.call(e,t)&&Xg(r,t,e[t]);if(Qg)for(var t of Qg(e))wx.call(e,t)&&Xg(r,t,e[t]);return r},qn=(r,e)=>mx(r,vx(e));class bx extends sE{constructor(e){super(e),this.name=fx,this.events=new cr.exports,this.initialized=!1,this.ignoredPayloadTypes=[Fi],this.requestQueue={state:zn.idle,queue:[]},this.sessionRequestQueue={state:zn.idle,queue:[]},this.requestQueueDelay=me.ONE_SECOND,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(kn)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},me.toMiliseconds(this.requestQueueDelay)))},this.connect=async t=>{await this.isInitialized();const n=qn(dr({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:i,requiredNamespaces:a,optionalNamespaces:c,sessionProperties:u,relays:f}=n;let h=i,m,w=!1;try{h&&(w=this.client.core.pairing.pairings.get(h).active)}catch(O){throw this.client.logger.error(`connect() -> pairing.get(${h}) failed`),O}if(!h||!w){const{topic:O,uri:P}=await this.client.core.pairing.create();h=O,m=P}if(!h){const{message:O}=ue("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error(O)}const y=await this.client.core.crypto.generateKeyPair(),b=kn.wc_sessionPropose.req.ttl||me.FIVE_MINUTES,I=zr(b),A=dr({requiredNamespaces:a,optionalNamespaces:c,relays:f??[{protocol:Ag}],proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:I},u&&{sessionProperties:u}),{reject:U,resolve:j,done:$}=Cs(b,Jg);this.events.once(pt("session_connect"),async({error:O,session:P})=>{if(O)U(O);else if(P){P.self.publicKey=y;const x=qn(dr({},P),{requiredNamespaces:A.requiredNamespaces,optionalNamespaces:A.optionalNamespaces});await this.client.session.set(P.topic,x),await this.setExpiry(P.topic,P.expiry),h&&await this.client.core.pairing.updateMetadata({topic:h,metadata:P.peer.metadata}),j(x)}});const T=await this.sendRequest({topic:h,method:"wc_sessionPropose",params:A,throwOnFailedPublish:!0});return await this.setProposal(T,dr({id:T},A)),{uri:m,approval:$}},this.pair=async t=>{await this.isInitialized();try{return await this.client.core.pairing.pair(t)}catch(n){throw this.client.logger.error("pair() failed"),n}},this.approve=async t=>{await this.isInitialized();try{await this.isValidApprove(t)}catch($){throw this.client.logger.error("approve() -> isValidApprove() failed"),$}const{id:n,relayProtocol:i,namespaces:a,sessionProperties:c,sessionConfig:u}=t;let f;try{f=this.client.proposal.get(n)}catch($){throw this.client.logger.error(`approve() -> proposal.get(${n}) failed`),$}let{pairingTopic:h,proposer:m,requiredNamespaces:w,optionalNamespaces:y}=f;h=h||"";const b=await this.client.core.crypto.generateKeyPair(),I=m.publicKey,A=await this.client.core.crypto.generateSharedKey(b,I),U=qn(dr({relay:{protocol:i??"irn"},namespaces:a,pairingTopic:h,controller:{publicKey:b,metadata:this.client.metadata},expiry:zr(ic)},c&&{sessionProperties:c}),{sessionConfig:u});await this.client.core.relayer.subscribe(A);const j=qn(dr({},U),{topic:A,requiredNamespaces:w,optionalNamespaces:y,pairingTopic:h,acknowledged:!1,self:U.controller,peer:{publicKey:m.publicKey,metadata:m.metadata},controller:b});await this.client.session.set(A,j);try{await this.sendResult({id:n,topic:h,result:{relay:{protocol:i??"irn"},responderPublicKey:b},throwOnFailedPublish:!0}),await this.sendRequest({topic:A,method:"wc_sessionSettle",params:U,throwOnFailedPublish:!0})}catch($){throw this.client.logger.error($),this.client.session.delete(A,Et("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(A),$}return await this.client.core.pairing.updateMetadata({topic:h,metadata:m.metadata}),await this.client.proposal.delete(n,Et("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:h}),await this.setExpiry(A,zr(ic)),{topic:A,acknowledged:()=>new Promise($=>setTimeout(()=>$(this.client.session.get(A)),500))}},this.reject=async t=>{await this.isInitialized();try{await this.isValidReject(t)}catch(c){throw this.client.logger.error("reject() -> isValidReject() failed"),c}const{id:n,reason:i}=t;let a;try{a=this.client.proposal.get(n).pairingTopic}catch(c){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),c}a&&(await this.sendError(n,a,i),await this.client.proposal.delete(n,Et("USER_DISCONNECTED")))},this.update=async t=>{await this.isInitialized();try{await this.isValidUpdate(t)}catch(w){throw this.client.logger.error("update() -> isValidUpdate() failed"),w}const{topic:n,namespaces:i}=t,{done:a,resolve:c,reject:u}=Cs(),f=Ps(),h=Hi().toString(),m=this.client.session.get(n).namespaces;return this.events.once(pt("session_update",f),async({error:w})=>{w?u(w):(await this.client.session.update(n,{namespaces:i}),c())}),this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:f,relayRpcId:h}).catch(w=>{this.client.logger.error(w),this.client.session.update(n,{namespaces:m}),u(w)}),{acknowledged:a}},this.extend=async t=>{await this.isInitialized();try{await this.isValidExtend(t)}catch(f){throw this.client.logger.error("extend() -> isValidExtend() failed"),f}const{topic:n}=t,i=Ps(),{done:a,resolve:c,reject:u}=Cs();return this.events.once(pt("session_extend",i),({error:f})=>{f?u(f):c()}),await this.setExpiry(n,zr(ic)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(f=>{u(f)}),{acknowledged:a}},this.request=async t=>{await this.isInitialized();try{await this.isValidRequest(t)}catch(b){throw this.client.logger.error("request() -> isValidRequest() failed"),b}const{chainId:n,request:i,topic:a,expiry:c=kn.wc_sessionRequest.req.ttl}=t,u=this.client.session.get(a),f=Ps(),h=Hi().toString(),{done:m,resolve:w,reject:y}=Cs(c,"Request expired. Please try again.");return this.events.once(pt("session_request",f),({error:b,result:I})=>{b?y(b):w(I)}),await Promise.all([new Promise(async b=>{await this.sendRequest({clientRpcId:f,relayRpcId:h,topic:a,method:"wc_sessionRequest",params:{request:qn(dr({},i),{expiryTimestamp:zr(c)}),chainId:n},expiry:c,throwOnFailedPublish:!0}).catch(I=>y(I)),this.client.events.emit("session_request_sent",{topic:a,request:i,chainId:n,id:f}),b()}),new Promise(async b=>{var I;if(!((I=u.sessionConfig)!=null&&I.disableDeepLink)){const A=await M_(this.client.core.storage,Zg);L_({id:f,topic:a,wcDeepLink:A})}b()}),m()]).then(b=>b[2])},this.respond=async t=>{await this.isInitialized(),await this.isValidRespond(t);const{topic:n,response:i}=t,{id:a}=i;Fn(i)?await this.sendResult({id:a,topic:n,result:i.result,throwOnFailedPublish:!0}):gn(i)&&await this.sendError(a,n,i.error),this.cleanupAfterResponse(t)},this.ping=async t=>{await this.isInitialized();try{await this.isValidPing(t)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:n}=t;if(this.client.session.keys.includes(n)){const i=Ps(),a=Hi().toString(),{done:c,resolve:u,reject:f}=Cs();this.events.once(pt("session_ping",i),({error:h})=>{h?f(h):u()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:a}),c()])}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async t=>{await this.isInitialized(),await this.isValidEmit(t);const{topic:n,event:i,chainId:a}=t,c=Hi().toString();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:a},throwOnFailedPublish:!0,relayRpcId:c})},this.disconnect=async t=>{await this.isInitialized(),await this.isValidDisconnect(t);const{topic:n}=t;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:Et("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:i}=ue("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(i)}},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(n=>e3(n,t))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.cleanupDuplicatePairings=async t=>{if(t.pairingTopic)try{const n=this.client.core.pairing.pairings.get(t.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(a=>{var c,u;return((c=a.peerMetadata)==null?void 0:c.url)&&((u=a.peerMetadata)==null?void 0:u.url)===t.peer.metadata.url&&a.topic&&a.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(a=>this.client.core.pairing.disconnect({topic:a.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async t=>{const{topic:n,expirerHasDeleted:i=!1,emitEvent:a=!0,id:c=0}=t,{self:u}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,Et("USER_DISCONNECTED")),this.addToRecentlyDeleted(n,"session"),this.client.core.crypto.keychain.has(u.publicKey)&&await this.client.core.crypto.deleteKeyPair(u.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),i||this.client.core.expirer.del(n),this.client.core.storage.removeItem(Zg).catch(f=>this.client.logger.warn(f)),this.getPendingSessionRequests().forEach(f=>{f.topic===n&&this.deletePendingSessionRequest(f.id,Et("USER_DISCONNECTED"))}),a&&this.client.events.emit("session_delete",{id:c,topic:n})},this.deleteProposal=async(t,n)=>{await Promise.all([this.client.proposal.delete(t,Et("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"proposal")},this.deletePendingSessionRequest=async(t,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,n),i?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(a=>a.id!==t),i&&(this.sessionRequestQueue.state=zn.idle,this.client.events.emit("session_request_expire",{id:t}))},this.setExpiry=async(t,n)=>{this.client.session.keys.includes(t)&&await this.client.session.update(t,{expiry:n}),this.client.core.expirer.set(t,n)},this.setProposal=async(t,n)=>{await this.client.proposal.set(t,n),this.client.core.expirer.set(t,zr(kn.wc_sessionPropose.req.ttl))},this.setPendingSessionRequest=async t=>{const{id:n,topic:i,params:a,verifyContext:c}=t,u=a.request.expiryTimestamp||zr(kn.wc_sessionRequest.req.ttl);await this.client.pendingRequest.set(n,{id:n,topic:i,params:a,verifyContext:c}),u&&this.client.core.expirer.set(n,u)},this.sendRequest=async t=>{const{topic:n,method:i,params:a,expiry:c,relayRpcId:u,clientRpcId:f,throwOnFailedPublish:h}=t,m=Ts(i,a,f);if(Os()&&px.includes(i)){const b=Ds(JSON.stringify(m));this.client.core.verify.register({attestationId:b})}let w;try{w=await this.client.core.crypto.encode(n,m)}catch(b){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),b}const y=kn[i].req;return c&&(y.ttl=c),u&&(y.id=u),this.client.core.history.set(n,m),h?(y.internal=qn(dr({},y.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,w,y)):this.client.core.relayer.publish(n,w,y).catch(b=>this.client.logger.error(b)),m.id},this.sendResult=async t=>{const{id:n,topic:i,result:a,throwOnFailedPublish:c}=t,u=Xa(n,a);let f;try{f=await this.client.core.crypto.encode(i,u)}catch(w){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),w}let h;try{h=await this.client.core.history.get(i,n)}catch(w){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${n}) failed`),w}const m=kn[h.request.method].res;c?(m.internal=qn(dr({},m.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,f,m)):this.client.core.relayer.publish(i,f,m).catch(w=>this.client.logger.error(w)),await this.client.core.history.resolve(u)},this.sendError=async(t,n,i)=>{const a=ec(t,i);let c;try{c=await this.client.core.crypto.encode(n,a)}catch(h){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${n} failed`),h}let u;try{u=await this.client.core.history.get(n,t)}catch(h){throw this.client.logger.error(`sendError() -> history.get(${n}, ${t}) failed`),h}const f=kn[u.request.method].res;this.client.core.relayer.publish(n,c,f),await this.client.core.history.resolve(a)},this.cleanup=async()=>{const t=[],n=[];this.client.session.getAll().forEach(i=>{let a=!1;ai(i.expiry)&&(a=!0),this.client.core.crypto.keychain.has(i.topic)||(a=!0),a&&t.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{ai(i.expiryTimestamp)&&n.push(i.id)}),await Promise.all([...t.map(i=>this.deleteSession({topic:i})),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async t=>{this.requestQueue.queue.push(t),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===zn.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=zn.active;const t=this.requestQueue.queue.shift();if(t)try{this.processRequest(t),await new Promise(n=>setTimeout(n,300))}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=zn.idle},this.processRequest=t=>{const{topic:n,payload:i}=t,a=i.method;switch(a){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${a}`)}},this.onRelayEventResponse=async t=>{const{topic:n,payload:i}=t,a=(await this.client.core.history.get(n,i.id)).request.method;switch(a){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${a}`)}},this.onRelayEventUnknownPayload=t=>{const{topic:n}=t,{message:i}=ue("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.onSessionProposeRequest=async(t,n)=>{const{params:i,id:a}=n;try{this.isValidConnect(dr({},n.params));const c=i.expiryTimestamp||zr(kn.wc_sessionPropose.req.ttl),u=dr({id:a,pairingTopic:t,expiryTimestamp:c},i);await this.setProposal(a,u);const f=Ds(JSON.stringify(n)),h=await this.getVerifyContext(f,u.proposer.metadata);this.client.events.emit("session_proposal",{id:a,params:u,verifyContext:h})}catch(c){await this.sendError(a,t,c),this.client.logger.error(c)}},this.onSessionProposeResponse=async(t,n)=>{const{id:i}=n;if(Fn(n)){const{result:a}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:a});const c=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:c});const u=c.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:u});const f=a.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:f});const h=await this.client.core.crypto.generateSharedKey(u,f);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:h});const m=await this.client.core.relayer.subscribe(h);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:m}),await this.client.core.pairing.activate({topic:t})}else if(gn(n)){await this.client.proposal.delete(i,Et("USER_DISCONNECTED"));const a=pt("session_connect");if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners, 954`);this.events.emit(pt("session_connect"),{error:n.error})}},this.onSessionSettleRequest=async(t,n)=>{const{id:i,params:a}=n;try{this.isValidSessionSettleRequest(a);const{relay:c,controller:u,expiry:f,namespaces:h,sessionProperties:m,pairingTopic:w,sessionConfig:y}=n.params,b=qn(dr(qn(dr({},n.params),{topic:t,relay:c,expiry:f,namespaces:h,acknowledged:!0,pairingTopic:w,requiredNamespaces:{},optionalNamespaces:{},controller:u.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:u.publicKey,metadata:u.metadata}}),m&&{sessionProperties:m}),{sessionConfig:y});await this.sendResult({id:n.id,topic:t,result:!0,throwOnFailedPublish:!0});const I=pt("session_connect");if(this.events.listenerCount(I)===0)throw new Error(`emitting ${I} without any listeners 997`);this.events.emit(pt("session_connect"),{session:b}),this.cleanupDuplicatePairings(b)}catch(c){await this.sendError(i,t,c),this.client.logger.error(c)}},this.onSessionSettleResponse=async(t,n)=>{const{id:i}=n;Fn(n)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(pt("session_approve",i),{})):gn(n)&&(await this.client.session.delete(t,Et("USER_DISCONNECTED")),this.events.emit(pt("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(t,n)=>{const{params:i,id:a}=n;try{const c=`${t}_session_update`,u=To.get(c);if(u&&this.isRequestOutOfSync(u,a)){this.client.logger.info(`Discarding out of sync request - ${a}`),this.sendError(a,t,Et("INVALID_UPDATE_REQUEST"));return}this.isValidUpdate(dr({topic:t},i));try{To.set(c,a),await this.client.session.update(t,{namespaces:i.namespaces}),await this.sendResult({id:a,topic:t,result:!0,throwOnFailedPublish:!0})}catch(f){throw To.delete(c),f}this.client.events.emit("session_update",{id:a,topic:t,params:i})}catch(c){await this.sendError(a,t,c),this.client.logger.error(c)}},this.isRequestOutOfSync=(t,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(t.toString().slice(0,-3)),this.onSessionUpdateResponse=(t,n)=>{const{id:i}=n,a=pt("session_update",i);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);Fn(n)?this.events.emit(pt("session_update",i),{}):gn(n)&&this.events.emit(pt("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(t,n)=>{const{id:i}=n;try{this.isValidExtend({topic:t}),await this.setExpiry(t,zr(ic)),await this.sendResult({id:i,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:i,topic:t})}catch(a){await this.sendError(i,t,a),this.client.logger.error(a)}},this.onSessionExtendResponse=(t,n)=>{const{id:i}=n,a=pt("session_extend",i);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);Fn(n)?this.events.emit(pt("session_extend",i),{}):gn(n)&&this.events.emit(pt("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(t,n)=>{const{id:i}=n;try{this.isValidPing({topic:t}),await this.sendResult({id:i,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:t})}catch(a){await this.sendError(i,t,a),this.client.logger.error(a)}},this.onSessionPingResponse=(t,n)=>{const{id:i}=n,a=pt("session_ping",i);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);setTimeout(()=>{Fn(n)?this.events.emit(pt("session_ping",i),{}):gn(n)&&this.events.emit(pt("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(t,n)=>{const{id:i}=n;try{this.isValidDisconnect({topic:t,reason:n.params}),await Promise.all([new Promise(a=>{this.client.core.relayer.once(Wr.publish,async()=>{a(await this.deleteSession({topic:t,id:i}))})}),this.sendResult({id:i,topic:t,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:t,error:Et("USER_DISCONNECTED")})])}catch(a){this.client.logger.error(a)}},this.onSessionRequest=async(t,n)=>{const{id:i,params:a}=n;try{this.isValidRequest(dr({topic:t},a));const c=Ds(JSON.stringify(Ts("wc_sessionRequest",a,i))),u=this.client.session.get(t),f=await this.getVerifyContext(c,u.peer.metadata),h={id:i,topic:t,params:a,verifyContext:f};await this.setPendingSessionRequest(h),this.addSessionRequestToSessionRequestQueue(h),this.processSessionRequestQueue()}catch(c){await this.sendError(i,t,c),this.client.logger.error(c)}},this.onSessionRequestResponse=(t,n)=>{const{id:i}=n,a=pt("session_request",i);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);Fn(n)?this.events.emit(pt("session_request",i),{result:n.result}):gn(n)&&this.events.emit(pt("session_request",i),{error:n.error})},this.onSessionEventRequest=async(t,n)=>{const{id:i,params:a}=n;try{const c=`${t}_session_event_${a.event.name}`,u=To.get(c);if(u&&this.isRequestOutOfSync(u,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(dr({topic:t},a)),this.client.events.emit("session_event",{id:i,topic:t,params:a}),To.set(c,i)}catch(c){await this.sendError(i,t,c),this.client.logger.error(c)}},this.addSessionRequestToSessionRequestQueue=t=>{this.sessionRequestQueue.queue.push(t)},this.cleanupAfterResponse=t=>{this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=zn.idle,this.processSessionRequestQueue()},me.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:t,error:n})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(a=>a.topic===t&&a.request.method==="wc_sessionRequest").forEach(a=>{const c=a.request.id,u=pt("session_request",c);if(this.events.listenerCount(u)===0)throw new Error(`emitting ${u} without any listeners`);this.events.emit(pt("session_request",a.request.id),{error:n})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===zn.active){this.client.logger.info("session request queue is already active.");return}const t=this.sessionRequestQueue.queue[0];if(!t){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=zn.active,this.client.events.emit("session_request",t)}catch(n){this.client.logger.error(n)}},this.onPairingCreated=t=>{if(t.active)return;const n=this.client.proposal.getAll().find(i=>i.pairingTopic===t.topic);n&&this.onSessionProposeRequest(t.topic,Ts("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties},n.id))},this.isValidConnect=async t=>{if(!Ar(t)){const{message:f}=ue("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(f)}const{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:a,sessionProperties:c,relays:u}=t;if(wr(n)||await this.isValidPairingTopic(n),!f3(u,!0)){const{message:f}=ue("MISSING_OR_INVALID",`connect() relays: ${u}`);throw new Error(f)}!wr(i)&&Po(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!wr(a)&&Po(a)!==0&&this.validateNamespaces(a,"optionalNamespaces"),wr(c)||this.validateSessionProps(c,"sessionProperties")},this.validateNamespaces=(t,n)=>{const i=h3(t,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async t=>{if(!Ar(t))throw new Error(ue("MISSING_OR_INVALID",`approve() params: ${t}`).message);const{id:n,namespaces:i,relayProtocol:a,sessionProperties:c}=t;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const u=this.client.proposal.get(n),f=bu(i,"approve()");if(f)throw new Error(f.message);const h=v0(u.requiredNamespaces,i,"approve()");if(h)throw new Error(h.message);if(!nr(a,!0)){const{message:m}=ue("MISSING_OR_INVALID",`approve() relayProtocol: ${a}`);throw new Error(m)}wr(c)||this.validateSessionProps(c,"sessionProperties")},this.isValidReject=async t=>{if(!Ar(t)){const{message:a}=ue("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(a)}const{id:n,reason:i}=t;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!p3(i)){const{message:a}=ue("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidSessionSettleRequest=t=>{if(!Ar(t)){const{message:h}=ue("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(h)}const{relay:n,controller:i,namespaces:a,expiry:c}=t;if(!g0(n)){const{message:h}=ue("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(h)}const u=s3(i,"onSessionSettleRequest()");if(u)throw new Error(u.message);const f=bu(a,"onSessionSettleRequest()");if(f)throw new Error(f.message);if(ai(c)){const{message:h}=ue("EXPIRED","onSessionSettleRequest()");throw new Error(h)}},this.isValidUpdate=async t=>{if(!Ar(t)){const{message:f}=ue("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(f)}const{topic:n,namespaces:i}=t;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const a=this.client.session.get(n),c=bu(i,"update()");if(c)throw new Error(c.message);const u=v0(a.requiredNamespaces,i,"update()");if(u)throw new Error(u.message)},this.isValidExtend=async t=>{if(!Ar(t)){const{message:i}=ue("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(i)}const{topic:n}=t;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)},this.isValidRequest=async t=>{if(!Ar(t)){const{message:f}=ue("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(f)}const{topic:n,request:i,chainId:a,expiry:c}=t;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:u}=this.client.session.get(n);if(!m0(u,a)){const{message:f}=ue("MISSING_OR_INVALID",`request() chainId: ${a}`);throw new Error(f)}if(!g3(i)){const{message:f}=ue("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(f)}if(!y3(u,a,i.method)){const{message:f}=ue("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(f)}if(c&&!E3(c,Xu)){const{message:f}=ue("MISSING_OR_INVALID",`request() expiry: ${c}. Expiry must be a number (in seconds) between ${Xu.min} and ${Xu.max}`);throw new Error(f)}},this.isValidRespond=async t=>{var n;if(!Ar(t)){const{message:c}=ue("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(c)}const{topic:i,response:a}=t;try{await this.isValidSessionTopic(i)}catch(c){throw(n=t?.response)!=null&&n.id&&this.cleanupAfterResponse(t),c}if(!m3(a)){const{message:c}=ue("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(a)}`);throw new Error(c)}},this.isValidPing=async t=>{if(!Ar(t)){const{message:i}=ue("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(i)}const{topic:n}=t;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async t=>{if(!Ar(t)){const{message:u}=ue("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(u)}const{topic:n,event:i,chainId:a}=t;await this.isValidSessionTopic(n);const{namespaces:c}=this.client.session.get(n);if(!m0(c,a)){const{message:u}=ue("MISSING_OR_INVALID",`emit() chainId: ${a}`);throw new Error(u)}if(!v3(i)){const{message:u}=ue("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(u)}if(!w3(c,a,i.name)){const{message:u}=ue("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(u)}},this.isValidDisconnect=async t=>{if(!Ar(t)){const{message:i}=ue("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(i)}const{topic:n}=t;await this.isValidSessionOrPairingTopic(n)},this.getVerifyContext=async(t,n)=>{const i={verified:{verifyUrl:n.verifyUrl||Ns,validation:"UNKNOWN",origin:n.url||""}};try{const a=await this.client.core.verify.resolve({attestationId:t,verifyUrl:n.verifyUrl});a&&(i.verified.origin=a.origin,i.verified.isScam=a.isScam,i.verified.validation=a.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(a){this.client.logger.info(a)}return this.client.logger.info(`Verify context: ${JSON.stringify(i)}`),i},this.validateSessionProps=(t,n)=>{Object.values(t).forEach(i=>{if(!nr(i,!1)){const{message:a}=ue("MISSING_OR_INVALID",`${n} must be in Record<string, string> format. Received: ${JSON.stringify(i)}`);throw new Error(a)}})},this.addToRecentlyDeleted=(t,n)=>{if(this.recentlyDeletedMap.set(t,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const a=this.recentlyDeletedLimit/2;for(const c of this.recentlyDeletedMap.keys()){if(i++>=a)break;this.recentlyDeletedMap.delete(c)}}},this.checkRecentlyDeleted=t=>{const n=this.recentlyDeletedMap.get(t);if(n){const{message:i}=ue("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${t}`);throw new Error(i)}}}async isInitialized(){if(!this.initialized){const{message:e}=ue("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Wr.message,async e=>{const{topic:t,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;const i=await this.client.core.crypto.decode(t,n);try{ju(i)?(this.client.core.history.set(t,i),this.onRelayEventRequest({topic:t,payload:i})):tc(i)?(await this.client.core.history.resolve(i),await this.onRelayEventResponse({topic:t,payload:i}),this.client.core.history.delete(t,i.id)):this.onRelayEventUnknownPayload({topic:t,payload:i})}catch(a){this.client.logger.error(a)}})}registerExpirerEvents(){this.client.core.expirer.on(rn.expired,async e=>{const{topic:t,id:n}=l0(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,ue("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(Rs.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(Rs.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!nr(e,!1)){const{message:t}=ue("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=ue("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(ai(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=ue("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!nr(e,!1)){const{message:t}=ue("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:t}=ue("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(ai(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:t}=ue("EXPIRED",`session topic: ${e}`);throw new Error(t)}if(!this.client.core.crypto.keychain.has(e)){const{message:t}=ue("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(nr(e,!1)){const{message:t}=ue("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}else{const{message:t}=ue("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}async isValidProposalId(e){if(!d3(e)){const{message:t}=ue("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=ue("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(ai(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:t}=ue("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}}class _x extends nc{constructor(e,t){super(e,t,ux,Ju),this.core=e,this.logger=t}}class Ex extends nc{constructor(e,t){super(e,t,hx,Ju),this.core=e,this.logger=t}}class xx extends nc{constructor(e,t){super(e,t,dx,Ju,n=>n.id),this.core=e,this.logger=t}}class eh extends iE{constructor(e){super(e),this.protocol=Vg,this.version=Gg,this.name=Qu.name,this.events=new cr.exports.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.name=e?.name||Qu.name,this.metadata=e?.metadata||C_();const t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Wi.pino(Wi.getDefaultLoggerOptions({level:e?.logger||Qu.logger}));this.core=e?.core||new k8(e),this.logger=Wi.generateChildLogger(t,this.name),this.session=new Ex(this.core,this.logger),this.proposal=new _x(this.core,this.logger),this.pendingRequest=new xx(this.core,this.logger),this.engine=new bx(this)}static async init(e){const t=new eh(e);return await t.initialize(),t}get context(){return Wi.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var th={exports:{}};(function(r,e){var t=typeof self<"u"?self:pn,n=function(){function a(){this.fetch=!1,this.DOMException=t.DOMException}return a.prototype=t,new a}();(function(a){(function(c){var u={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 f(D){return D&&DataView.prototype.isPrototypeOf(D)}if(u.arrayBuffer)var h=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],m=ArrayBuffer.isView||function(D){return D&&h.indexOf(Object.prototype.toString.call(D))>-1};function w(D){if(typeof D!="string"&&(D=String(D)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(D))throw new TypeError("Invalid character in header field name");return D.toLowerCase()}function y(D){return typeof D!="string"&&(D=String(D)),D}function b(D){var N={next:function(){var X=D.shift();return{done:X===void 0,value:X}}};return u.iterable&&(N[Symbol.iterator]=function(){return N}),N}function I(D){this.map={},D instanceof I?D.forEach(function(N,X){this.append(X,N)},this):Array.isArray(D)?D.forEach(function(N){this.append(N[0],N[1])},this):D&&Object.getOwnPropertyNames(D).forEach(function(N){this.append(N,D[N])},this)}I.prototype.append=function(D,N){D=w(D),N=y(N);var X=this.map[D];this.map[D]=X?X+", "+N:N},I.prototype.delete=function(D){delete this.map[w(D)]},I.prototype.get=function(D){return D=w(D),this.has(D)?this.map[D]:null},I.prototype.has=function(D){return this.map.hasOwnProperty(w(D))},I.prototype.set=function(D,N){this.map[w(D)]=y(N)},I.prototype.forEach=function(D,N){for(var X in this.map)this.map.hasOwnProperty(X)&&D.call(N,this.map[X],X,this)},I.prototype.keys=function(){var D=[];return this.forEach(function(N,X){D.push(X)}),b(D)},I.prototype.values=function(){var D=[];return this.forEach(function(N){D.push(N)}),b(D)},I.prototype.entries=function(){var D=[];return this.forEach(function(N,X){D.push([X,N])}),b(D)},u.iterable&&(I.prototype[Symbol.iterator]=I.prototype.entries);function A(D){if(D.bodyUsed)return Promise.reject(new TypeError("Already read"));D.bodyUsed=!0}function U(D){return new Promise(function(N,X){D.onload=function(){N(D.result)},D.onerror=function(){X(D.error)}})}function j(D){var N=new FileReader,X=U(N);return N.readAsArrayBuffer(D),X}function $(D){var N=new FileReader,X=U(N);return N.readAsText(D),X}function T(D){for(var N=new Uint8Array(D),X=new Array(N.length),ee=0;ee<N.length;ee++)X[ee]=String.fromCharCode(N[ee]);return X.join("")}function O(D){if(D.slice)return D.slice(0);var N=new Uint8Array(D.byteLength);return N.set(new Uint8Array(D)),N.buffer}function P(){return this.bodyUsed=!1,this._initBody=function(D){this._bodyInit=D,D?typeof D=="string"?this._bodyText=D:u.blob&&Blob.prototype.isPrototypeOf(D)?this._bodyBlob=D:u.formData&&FormData.prototype.isPrototypeOf(D)?this._bodyFormData=D:u.searchParams&&URLSearchParams.prototype.isPrototypeOf(D)?this._bodyText=D.toString():u.arrayBuffer&&u.blob&&f(D)?(this._bodyArrayBuffer=O(D.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(D)||m(D))?this._bodyArrayBuffer=O(D):this._bodyText=D=Object.prototype.toString.call(D):this._bodyText="",this.headers.get("content-type")||(typeof D=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):u.searchParams&&URLSearchParams.prototype.isPrototypeOf(D)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u.blob&&(this.blob=function(){var D=A(this);if(D)return D;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(){return this._bodyArrayBuffer?A(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(j)}),this.text=function(){var D=A(this);if(D)return D;if(this._bodyBlob)return $(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(T(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},u.formData&&(this.formData=function(){return this.text().then(H)}),this.json=function(){return this.text().then(JSON.parse)},this}var x=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function d(D){var N=D.toUpperCase();return x.indexOf(N)>-1?N:D}function _(D,N){N=N||{};var X=N.body;if(D instanceof _){if(D.bodyUsed)throw new TypeError("Already read");this.url=D.url,this.credentials=D.credentials,N.headers||(this.headers=new I(D.headers)),this.method=D.method,this.mode=D.mode,this.signal=D.signal,!X&&D._bodyInit!=null&&(X=D._bodyInit,D.bodyUsed=!0)}else this.url=String(D);if(this.credentials=N.credentials||this.credentials||"same-origin",(N.headers||!this.headers)&&(this.headers=new I(N.headers)),this.method=d(N.method||this.method||"GET"),this.mode=N.mode||this.mode||null,this.signal=N.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&X)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(X)}_.prototype.clone=function(){return new _(this,{body:this._bodyInit})};function H(D){var N=new FormData;return D.trim().split("&").forEach(function(X){if(X){var ee=X.split("="),Y=ee.shift().replace(/\+/g," "),Z=ee.join("=").replace(/\+/g," ");N.append(decodeURIComponent(Y),decodeURIComponent(Z))}}),N}function F(D){var N=new I,X=D.replace(/\r?\n[\t ]+/g," ");return X.split(/\r?\n/).forEach(function(ee){var Y=ee.split(":"),Z=Y.shift().trim();if(Z){var Q=Y.join(":").trim();N.append(Z,Q)}}),N}P.call(_.prototype);function V(D,N){N||(N={}),this.type="default",this.status=N.status===void 0?200:N.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in N?N.statusText:"OK",this.headers=new I(N.headers),this.url=N.url||"",this._initBody(D)}P.call(V.prototype),V.prototype.clone=function(){return new V(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new I(this.headers),url:this.url})},V.error=function(){var D=new V(null,{status:0,statusText:""});return D.type="error",D};var se=[301,302,303,307,308];V.redirect=function(D,N){if(se.indexOf(N)===-1)throw new RangeError("Invalid status code");return new V(null,{status:N,headers:{location:D}})},c.DOMException=a.DOMException;try{new c.DOMException}catch{c.DOMException=function(N,X){this.message=N,this.name=X;var ee=Error(N);this.stack=ee.stack},c.DOMException.prototype=Object.create(Error.prototype),c.DOMException.prototype.constructor=c.DOMException}function ce(D,N){return new Promise(function(X,ee){var Y=new _(D,N);if(Y.signal&&Y.signal.aborted)return ee(new c.DOMException("Aborted","AbortError"));var Z=new XMLHttpRequest;function Q(){Z.abort()}Z.onload=function(){var ie={status:Z.status,statusText:Z.statusText,headers:F(Z.getAllResponseHeaders()||"")};ie.url="responseURL"in Z?Z.responseURL:ie.headers.get("X-Request-URL");var Ee="response"in Z?Z.response:Z.responseText;X(new V(Ee,ie))},Z.onerror=function(){ee(new TypeError("Network request failed"))},Z.ontimeout=function(){ee(new TypeError("Network request failed"))},Z.onabort=function(){ee(new c.DOMException("Aborted","AbortError"))},Z.open(Y.method,Y.url,!0),Y.credentials==="include"?Z.withCredentials=!0:Y.credentials==="omit"&&(Z.withCredentials=!1),"responseType"in Z&&u.blob&&(Z.responseType="blob"),Y.headers.forEach(function(ie,Ee){Z.setRequestHeader(Ee,ie)}),Y.signal&&(Y.signal.addEventListener("abort",Q),Z.onreadystatechange=function(){Z.readyState===4&&Y.signal.removeEventListener("abort",Q)}),Z.send(typeof Y._bodyInit>"u"?null:Y._bodyInit)})}return ce.polyfill=!0,a.fetch||(a.fetch=ce,a.Headers=I,a.Request=_,a.Response=V),c.Headers=I,c.Request=_,c.Response=V,c.fetch=ce,Object.defineProperty(c,"__esModule",{value:!0}),c})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,r.exports=e})(th,th.exports);var e1=zy(th.exports);const t1={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"},r1=10;class ui{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new cr.exports.EventEmitter,this.isAvailable=!1,this.registering=!1,!ng(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e,t){this.isAvailable||await this.register();try{const n=Mn(e),a=await(await e1(this.url,Object.assign(Object.assign({},t1),{body:n}))).json();this.onPayload({data:a})}catch(n){this.onError(e.id,n)}}async register(e=this.url){if(!ng(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((n,i)=>{this.events.once("register_error",a=>{this.resetMaxListeners(),i(a)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=Mn({id:1,jsonrpc:"2.0",method:"test",params:[]});await e1(e,Object.assign(Object.assign({},t1),{body:t}))}this.onOpen()}catch(t){const n=this.parseError(t);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?No(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const n=this.parseError(t),i=n.message||n.toString(),a=ec(e,i);this.events.emit("payload",a)}parseError(e,t=this.url){return J0(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>r1&&this.events.setMaxListeners(r1)}}const n1="error",Ix="wss://relay.walletconnect.com",Dx="wc",Sx="universal_provider",i1=`${Dx}@2:${Sx}:`,Ox="https://rpc.walletconnect.com/v1/",Hn={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Wo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},rh={exports:{}};/**
|
|
60
60
|
* @license
|
|
61
61
|
* Lodash <https://lodash.com/>
|
|
62
62
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
63
63
|
* Released under MIT license <https://lodash.com/license>
|
|
64
64
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
65
65
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
66
|
-
*/(function(r,e){(function(){var t,n="4.17.21",i=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",u="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",h=500,m="__lodash_placeholder__",w=1,y=2,x=4,S=1,P=2,U=1,j=2,A=4,T=8,C=16,$=32,E=64,d=128,b=256,H=512,F=30,V="...",se=800,ce=16,I=1,N=2,X=3,ee=1/0,Y=9007199254740991,J=17976931348623157e292,Q=0/0,ie=4294967295,Ee=ie-1,ae=ie>>>1,xe=[["ary",d],["bind",U],["bindKey",j],["curry",T],["curryRight",C],["flip",H],["partial",$],["partialRight",E],["rearg",b]],de="[object Arguments]",be="[object Array]",K="[object AsyncFunction]",W="[object Boolean]",B="[object Date]",g="[object DOMException]",L="[object Error]",le="[object Function]",pe="[object GeneratorFunction]",Ce="[object Map]",Ke="[object Number]",Je="[object Null]",ke="[object Object]",St="[object Promise]",Ct="[object Proxy]",ze="[object RegExp]",Oe="[object Set]",Ue="[object String]",je="[object Symbol]",He="[object Undefined]",Ae="[object WeakMap]",Fe="[object WeakSet]",Se="[object ArrayBuffer]",Te="[object DataView]",Ve="[object Float32Array]",$e="[object Float64Array]",Ze="[object Int8Array]",et="[object Int16Array]",at="[object Int32Array]",ct="[object Uint8Array]",nt="[object Uint8ClampedArray]",Sr="[object Uint16Array]",Ur="[object Uint32Array]",On=/\b__p \+= '';/g,Cr=/\b(__p \+=) '' \+/g,Wn=/(__e\(.*?\)|\b__t\)) \+\n'';/g,bi=/&(?:amp|lt|gt|quot|#39);/g,rs=/[&<>"']/g,Lt=RegExp(bi.source),Ot=RegExp(rs.source),Mt=/<%-([\s\S]+?)%>/g,Ut=/<%([\s\S]+?)%>/g,Tt=/<%=([\s\S]+?)%>/g,$t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Gt=/^\w*$/,Yt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,jt=/[\\^$.*+?()[\]{}|]/g,Jt=RegExp(jt.source),Ft=/^\s+/,Ht=/\s/,Bt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,_t=/\{\n\/\* \[wrapped with (.+)\] \*/,Zt=/,? & /,Qt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,lf=/[()=,{}\[\]\/\s]/,uf=/\\(\\)?/g,hf=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,rn=/\w*$/,ff=/^[-+]0x[0-9a-f]+$/i,df=/^0b[01]+$/i,pf=/^\[object .+?Constructor\]$/,gf=/^0o[0-7]+$/i,mf=/^(?:0|[1-9]\d*)$/,Kn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ks=/($^)/,vf=/['\n\r\u2028\u2029\\]/g,Vs="\\ud800-\\udfff",yf="\\u0300-\\u036f",wf="\\ufe20-\\ufe2f",Gs="\\u20d0-\\u20ff",Cc=yf+wf+Gs,Oc="\\u2700-\\u27bf",gn="a-z\\xdf-\\xf6\\xf8-\\xff",bf="\\xac\\xb1\\xd7\\xf7",_f="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ef="\\u2000-\\u206f",xf=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",$c="A-Z\\xc0-\\xd6\\xd8-\\xde",Ac="\\ufe0e\\ufe0f",ns=bf+_f+Ef+xf,na="['\u2019]",is="["+Vs+"]",ia="["+ns+"]",ss="["+Cc+"]",Pc="\\d+",If="["+Oc+"]",Tc="["+gn+"]",Rc="[^"+Vs+ns+Pc+Oc+gn+$c+"]",Ys="\\ud83c[\\udffb-\\udfff]",Df="(?:"+ss+"|"+Ys+")",Nc="[^"+Vs+"]",Js="(?:\\ud83c[\\udde6-\\uddff]){2}",_i="[\\ud800-\\udbff][\\udc00-\\udfff]",Gr="["+$c+"]",Lc="\\u200d",Mc="(?:"+Tc+"|"+Rc+")",$n="(?:"+Gr+"|"+Rc+")",Uc="(?:"+na+"(?:d|ll|m|re|s|t|ve))?",jc="(?:"+na+"(?:D|LL|M|RE|S|T|VE))?",Fc=Df+"?",Bc="["+Ac+"]?",Sf="(?:"+Lc+"(?:"+[Nc,Js,_i].join("|")+")"+Bc+Fc+")*",Vn="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",kc="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",qc=Bc+Fc+Sf,Zs="(?:"+[If,Js,_i].join("|")+")"+qc,Cf="(?:"+[Nc+ss+"?",ss,Js,_i,is].join("|")+")",sa=RegExp(na,"g"),Of=RegExp(ss,"g"),Qs=RegExp(Ys+"(?="+Ys+")|"+Cf+qc,"g"),zc=RegExp([Gr+"?"+Tc+"+"+Uc+"(?="+[ia,Gr,"$"].join("|")+")",$n+"+"+jc+"(?="+[ia,Gr+Mc,"$"].join("|")+")",Gr+"?"+Mc+"+"+Uc,Gr+"+"+jc,kc,Vn,Pc,Zs].join("|"),"g"),Hc=RegExp("["+Lc+Vs+Cc+Ac+"]"),os=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Wc=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],$f=-1,mt={};mt[Ve]=mt[$e]=mt[Ze]=mt[et]=mt[at]=mt[ct]=mt[nt]=mt[Sr]=mt[Ur]=!0,mt[de]=mt[be]=mt[Se]=mt[W]=mt[Te]=mt[B]=mt[L]=mt[le]=mt[Ce]=mt[Ke]=mt[ke]=mt[ze]=mt[Oe]=mt[Ue]=mt[Ae]=!1;var gt={};gt[de]=gt[be]=gt[Se]=gt[Te]=gt[W]=gt[B]=gt[Ve]=gt[$e]=gt[Ze]=gt[et]=gt[at]=gt[Ce]=gt[Ke]=gt[ke]=gt[ze]=gt[Oe]=gt[Ue]=gt[je]=gt[ct]=gt[nt]=gt[Sr]=gt[Ur]=!0,gt[L]=gt[le]=gt[Ae]=!1;var O={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},k={"&":"&","<":"<",">":">",'"':""","'":"'"},ne={"&":"&","<":"<",">":">",""":'"',"'":"'"},ge={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},vt=parseFloat,Ne=parseInt,Et=typeof Mo=="object"&&Mo&&Mo.Object===Object&&Mo,Xt=typeof self=="object"&&self&&self.Object===Object&&self,it=Et||Xt||Function("return this")(),yt=e&&!e.nodeType&&e,Wt=yt&&!0&&r&&!r.nodeType&&r,jr=Wt&&Wt.exports===yt,er=jr&&Et.process,xt=function(){try{var q=Wt&&Wt.require&&Wt.require("util").types;return q||er&&er.binding&&er.binding("util")}catch{}}(),Or=xt&&xt.isArrayBuffer,mn=xt&&xt.isDate,nn=xt&&xt.isMap,An=xt&&xt.isRegExp,oa=xt&&xt.isSet,as=xt&&xt.isTypedArray;function ar(q,Z,G){switch(G.length){case 0:return q.call(Z);case 1:return q.call(Z,G[0]);case 2:return q.call(Z,G[0],G[1]);case 3:return q.call(Z,G[0],G[1],G[2])}return q.apply(Z,G)}function uO(q,Z,G,me){for(var Re=-1,ut=q==null?0:q.length;++Re<ut;){var rr=q[Re];Z(me,rr,G(rr),q)}return me}function sn(q,Z){for(var G=-1,me=q==null?0:q.length;++G<me&&Z(q[G],G,q)!==!1;);return q}function hO(q,Z){for(var G=q==null?0:q.length;G--&&Z(q[G],G,q)!==!1;);return q}function $m(q,Z){for(var G=-1,me=q==null?0:q.length;++G<me;)if(!Z(q[G],G,q))return!1;return!0}function Ei(q,Z){for(var G=-1,me=q==null?0:q.length,Re=0,ut=[];++G<me;){var rr=q[G];Z(rr,G,q)&&(ut[Re++]=rr)}return ut}function Kc(q,Z){var G=q==null?0:q.length;return!!G&&Xs(q,Z,0)>-1}function Af(q,Z,G){for(var me=-1,Re=q==null?0:q.length;++me<Re;)if(G(Z,q[me]))return!0;return!1}function At(q,Z){for(var G=-1,me=q==null?0:q.length,Re=Array(me);++G<me;)Re[G]=Z(q[G],G,q);return Re}function xi(q,Z){for(var G=-1,me=Z.length,Re=q.length;++G<me;)q[Re+G]=Z[G];return q}function Pf(q,Z,G,me){var Re=-1,ut=q==null?0:q.length;for(me&&ut&&(G=q[++Re]);++Re<ut;)G=Z(G,q[Re],Re,q);return G}function fO(q,Z,G,me){var Re=q==null?0:q.length;for(me&&Re&&(G=q[--Re]);Re--;)G=Z(G,q[Re],Re,q);return G}function Tf(q,Z){for(var G=-1,me=q==null?0:q.length;++G<me;)if(Z(q[G],G,q))return!0;return!1}var dO=Rf("length");function pO(q){return q.split("")}function gO(q){return q.match(Qt)||[]}function Am(q,Z,G){var me;return G(q,function(Re,ut,rr){if(Z(Re,ut,rr))return me=ut,!1}),me}function Vc(q,Z,G,me){for(var Re=q.length,ut=G+(me?1:-1);me?ut--:++ut<Re;)if(Z(q[ut],ut,q))return ut;return-1}function Xs(q,Z,G){return Z===Z?CO(q,Z,G):Vc(q,Pm,G)}function mO(q,Z,G,me){for(var Re=G-1,ut=q.length;++Re<ut;)if(me(q[Re],Z))return Re;return-1}function Pm(q){return q!==q}function Tm(q,Z){var G=q==null?0:q.length;return G?Lf(q,Z)/G:Q}function Rf(q){return function(Z){return Z==null?t:Z[q]}}function Nf(q){return function(Z){return q==null?t:q[Z]}}function Rm(q,Z,G,me,Re){return Re(q,function(ut,rr,wt){G=me?(me=!1,ut):Z(G,ut,rr,wt)}),G}function vO(q,Z){var G=q.length;for(q.sort(Z);G--;)q[G]=q[G].value;return q}function Lf(q,Z){for(var G,me=-1,Re=q.length;++me<Re;){var ut=Z(q[me]);ut!==t&&(G=G===t?ut:G+ut)}return G}function Mf(q,Z){for(var G=-1,me=Array(q);++G<q;)me[G]=Z(G);return me}function yO(q,Z){return At(Z,function(G){return[G,q[G]]})}function Nm(q){return q&&q.slice(0,jm(q)+1).replace(Ft,"")}function Yr(q){return function(Z){return q(Z)}}function Uf(q,Z){return At(Z,function(G){return q[G]})}function aa(q,Z){return q.has(Z)}function Lm(q,Z){for(var G=-1,me=q.length;++G<me&&Xs(Z,q[G],0)>-1;);return G}function Mm(q,Z){for(var G=q.length;G--&&Xs(Z,q[G],0)>-1;);return G}function wO(q,Z){for(var G=q.length,me=0;G--;)q[G]===Z&&++me;return me}var bO=Nf(O),_O=Nf(k);function EO(q){return"\\"+ge[q]}function xO(q,Z){return q==null?t:q[Z]}function eo(q){return Hc.test(q)}function IO(q){return os.test(q)}function DO(q){for(var Z,G=[];!(Z=q.next()).done;)G.push(Z.value);return G}function jf(q){var Z=-1,G=Array(q.size);return q.forEach(function(me,Re){G[++Z]=[Re,me]}),G}function Um(q,Z){return function(G){return q(Z(G))}}function Ii(q,Z){for(var G=-1,me=q.length,Re=0,ut=[];++G<me;){var rr=q[G];(rr===Z||rr===m)&&(q[G]=m,ut[Re++]=G)}return ut}function Gc(q){var Z=-1,G=Array(q.size);return q.forEach(function(me){G[++Z]=me}),G}function SO(q){var Z=-1,G=Array(q.size);return q.forEach(function(me){G[++Z]=[me,me]}),G}function CO(q,Z,G){for(var me=G-1,Re=q.length;++me<Re;)if(q[me]===Z)return me;return-1}function OO(q,Z,G){for(var me=G+1;me--;)if(q[me]===Z)return me;return me}function to(q){return eo(q)?AO(q):dO(q)}function vn(q){return eo(q)?PO(q):pO(q)}function jm(q){for(var Z=q.length;Z--&&Ht.test(q.charAt(Z)););return Z}var $O=Nf(ne);function AO(q){for(var Z=Qs.lastIndex=0;Qs.test(q);)++Z;return Z}function PO(q){return q.match(Qs)||[]}function TO(q){return q.match(zc)||[]}var RO=function q(Z){Z=Z==null?it:ro.defaults(it.Object(),Z,ro.pick(it,Wc));var G=Z.Array,me=Z.Date,Re=Z.Error,ut=Z.Function,rr=Z.Math,wt=Z.Object,Ff=Z.RegExp,NO=Z.String,on=Z.TypeError,Yc=G.prototype,LO=ut.prototype,no=wt.prototype,Jc=Z["__core-js_shared__"],Zc=LO.toString,dt=no.hasOwnProperty,MO=0,Fm=function(){var s=/[^.]+$/.exec(Jc&&Jc.keys&&Jc.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),Qc=no.toString,UO=Zc.call(wt),jO=it._,FO=Ff("^"+Zc.call(dt).replace(jt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Xc=jr?Z.Buffer:t,Di=Z.Symbol,el=Z.Uint8Array,Bm=Xc?Xc.allocUnsafe:t,tl=Um(wt.getPrototypeOf,wt),km=wt.create,qm=no.propertyIsEnumerable,rl=Yc.splice,zm=Di?Di.isConcatSpreadable:t,ca=Di?Di.iterator:t,cs=Di?Di.toStringTag:t,nl=function(){try{var s=ds(wt,"defineProperty");return s({},"",{}),s}catch{}}(),BO=Z.clearTimeout!==it.clearTimeout&&Z.clearTimeout,kO=me&&me.now!==it.Date.now&&me.now,qO=Z.setTimeout!==it.setTimeout&&Z.setTimeout,il=rr.ceil,sl=rr.floor,Bf=wt.getOwnPropertySymbols,zO=Xc?Xc.isBuffer:t,Hm=Z.isFinite,HO=Yc.join,WO=Um(wt.keys,wt),nr=rr.max,mr=rr.min,KO=me.now,VO=Z.parseInt,Wm=rr.random,GO=Yc.reverse,kf=ds(Z,"DataView"),la=ds(Z,"Map"),qf=ds(Z,"Promise"),io=ds(Z,"Set"),ua=ds(Z,"WeakMap"),ha=ds(wt,"create"),ol=ua&&new ua,so={},YO=ps(kf),JO=ps(la),ZO=ps(qf),QO=ps(io),XO=ps(ua),al=Di?Di.prototype:t,fa=al?al.valueOf:t,Km=al?al.toString:t;function _(s){if(kt(s)&&!Le(s)&&!(s instanceof tt)){if(s instanceof an)return s;if(dt.call(s,"__wrapped__"))return Vv(s)}return new an(s)}var oo=function(){function s(){}return function(o){if(!Rt(o))return{};if(km)return km(o);s.prototype=o;var l=new s;return s.prototype=t,l}}();function cl(){}function an(s,o){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!o,this.__index__=0,this.__values__=t}_.templateSettings={escape:Mt,evaluate:Ut,interpolate:Tt,variable:"",imports:{_}},_.prototype=cl.prototype,_.prototype.constructor=_,an.prototype=oo(cl.prototype),an.prototype.constructor=an;function tt(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ie,this.__views__=[]}function e7(){var s=new tt(this.__wrapped__);return s.__actions__=Fr(this.__actions__),s.__dir__=this.__dir__,s.__filtered__=this.__filtered__,s.__iteratees__=Fr(this.__iteratees__),s.__takeCount__=this.__takeCount__,s.__views__=Fr(this.__views__),s}function t7(){if(this.__filtered__){var s=new tt(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function r7(){var s=this.__wrapped__.value(),o=this.__dir__,l=Le(s),p=o<0,v=l?s.length:0,D=p$(0,v,this.__views__),R=D.start,M=D.end,z=M-R,te=p?M:R-1,re=this.__iteratees__,oe=re.length,fe=0,ve=mr(z,this.__takeCount__);if(!l||!p&&v==z&&ve==z)return mv(s,this.__actions__);var Ie=[];e:for(;z--&&fe<ve;){te+=o;for(var We=-1,De=s[te];++We<oe;){var Qe=re[We],st=Qe.iteratee,Qr=Qe.type,Pr=st(De);if(Qr==N)De=Pr;else if(!Pr){if(Qr==I)continue e;break e}}Ie[fe++]=De}return Ie}tt.prototype=oo(cl.prototype),tt.prototype.constructor=tt;function ls(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var p=s[o];this.set(p[0],p[1])}}function n7(){this.__data__=ha?ha(null):{},this.size=0}function i7(s){var o=this.has(s)&&delete this.__data__[s];return this.size-=o?1:0,o}function s7(s){var o=this.__data__;if(ha){var l=o[s];return l===f?t:l}return dt.call(o,s)?o[s]:t}function o7(s){var o=this.__data__;return ha?o[s]!==t:dt.call(o,s)}function a7(s,o){var l=this.__data__;return this.size+=this.has(s)?0:1,l[s]=ha&&o===t?f:o,this}ls.prototype.clear=n7,ls.prototype.delete=i7,ls.prototype.get=s7,ls.prototype.has=o7,ls.prototype.set=a7;function Gn(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var p=s[o];this.set(p[0],p[1])}}function c7(){this.__data__=[],this.size=0}function l7(s){var o=this.__data__,l=ll(o,s);if(l<0)return!1;var p=o.length-1;return l==p?o.pop():rl.call(o,l,1),--this.size,!0}function u7(s){var o=this.__data__,l=ll(o,s);return l<0?t:o[l][1]}function h7(s){return ll(this.__data__,s)>-1}function f7(s,o){var l=this.__data__,p=ll(l,s);return p<0?(++this.size,l.push([s,o])):l[p][1]=o,this}Gn.prototype.clear=c7,Gn.prototype.delete=l7,Gn.prototype.get=u7,Gn.prototype.has=h7,Gn.prototype.set=f7;function Yn(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var p=s[o];this.set(p[0],p[1])}}function d7(){this.size=0,this.__data__={hash:new ls,map:new(la||Gn),string:new ls}}function p7(s){var o=_l(this,s).delete(s);return this.size-=o?1:0,o}function g7(s){return _l(this,s).get(s)}function m7(s){return _l(this,s).has(s)}function v7(s,o){var l=_l(this,s),p=l.size;return l.set(s,o),this.size+=l.size==p?0:1,this}Yn.prototype.clear=d7,Yn.prototype.delete=p7,Yn.prototype.get=g7,Yn.prototype.has=m7,Yn.prototype.set=v7;function us(s){var o=-1,l=s==null?0:s.length;for(this.__data__=new Yn;++o<l;)this.add(s[o])}function y7(s){return this.__data__.set(s,f),this}function w7(s){return this.__data__.has(s)}us.prototype.add=us.prototype.push=y7,us.prototype.has=w7;function yn(s){var o=this.__data__=new Gn(s);this.size=o.size}function b7(){this.__data__=new Gn,this.size=0}function _7(s){var o=this.__data__,l=o.delete(s);return this.size=o.size,l}function E7(s){return this.__data__.get(s)}function x7(s){return this.__data__.has(s)}function I7(s,o){var l=this.__data__;if(l instanceof Gn){var p=l.__data__;if(!la||p.length<i-1)return p.push([s,o]),this.size=++l.size,this;l=this.__data__=new Yn(p)}return l.set(s,o),this.size=l.size,this}yn.prototype.clear=b7,yn.prototype.delete=_7,yn.prototype.get=E7,yn.prototype.has=x7,yn.prototype.set=I7;function Vm(s,o){var l=Le(s),p=!l&&gs(s),v=!l&&!p&&Ai(s),D=!l&&!p&&!v&&uo(s),R=l||p||v||D,M=R?Mf(s.length,NO):[],z=M.length;for(var te in s)(o||dt.call(s,te))&&!(R&&(te=="length"||v&&(te=="offset"||te=="parent")||D&&(te=="buffer"||te=="byteLength"||te=="byteOffset")||Xn(te,z)))&&M.push(te);return M}function Gm(s){var o=s.length;return o?s[Xf(0,o-1)]:t}function D7(s,o){return El(Fr(s),hs(o,0,s.length))}function S7(s){return El(Fr(s))}function zf(s,o,l){(l!==t&&!wn(s[o],l)||l===t&&!(o in s))&&Jn(s,o,l)}function da(s,o,l){var p=s[o];(!(dt.call(s,o)&&wn(p,l))||l===t&&!(o in s))&&Jn(s,o,l)}function ll(s,o){for(var l=s.length;l--;)if(wn(s[l][0],o))return l;return-1}function C7(s,o,l,p){return Si(s,function(v,D,R){o(p,v,l(v),R)}),p}function Ym(s,o){return s&&Tn(o,cr(o),s)}function O7(s,o){return s&&Tn(o,kr(o),s)}function Jn(s,o,l){o=="__proto__"&&nl?nl(s,o,{configurable:!0,enumerable:!0,value:l,writable:!0}):s[o]=l}function Hf(s,o){for(var l=-1,p=o.length,v=G(p),D=s==null;++l<p;)v[l]=D?t:Id(s,o[l]);return v}function hs(s,o,l){return s===s&&(l!==t&&(s=s<=l?s:l),o!==t&&(s=s>=o?s:o)),s}function cn(s,o,l,p,v,D){var R,M=o&w,z=o&y,te=o&x;if(l&&(R=v?l(s,p,v,D):l(s)),R!==t)return R;if(!Rt(s))return s;var re=Le(s);if(re){if(R=m$(s),!M)return Fr(s,R)}else{var oe=vr(s),fe=oe==le||oe==pe;if(Ai(s))return wv(s,M);if(oe==ke||oe==de||fe&&!v){if(R=z||fe?{}:jv(s),!M)return z?s$(s,O7(R,s)):i$(s,Ym(R,s))}else{if(!gt[oe])return v?s:{};R=v$(s,oe,M)}}D||(D=new yn);var ve=D.get(s);if(ve)return ve;D.set(s,R),dy(s)?s.forEach(function(De){R.add(cn(De,o,l,De,s,D))}):hy(s)&&s.forEach(function(De,Qe){R.set(Qe,cn(De,o,l,Qe,s,D))});var Ie=te?z?ud:ld:z?kr:cr,We=re?t:Ie(s);return sn(We||s,function(De,Qe){We&&(Qe=De,De=s[Qe]),da(R,Qe,cn(De,o,l,Qe,s,D))}),R}function $7(s){var o=cr(s);return function(l){return Jm(l,s,o)}}function Jm(s,o,l){var p=l.length;if(s==null)return!p;for(s=wt(s);p--;){var v=l[p],D=o[v],R=s[v];if(R===t&&!(v in s)||!D(R))return!1}return!0}function Zm(s,o,l){if(typeof s!="function")throw new on(c);return ba(function(){s.apply(t,l)},o)}function pa(s,o,l,p){var v=-1,D=Kc,R=!0,M=s.length,z=[],te=o.length;if(!M)return z;l&&(o=At(o,Yr(l))),p?(D=Af,R=!1):o.length>=i&&(D=aa,R=!1,o=new us(o));e:for(;++v<M;){var re=s[v],oe=l==null?re:l(re);if(re=p||re!==0?re:0,R&&oe===oe){for(var fe=te;fe--;)if(o[fe]===oe)continue e;z.push(re)}else D(o,oe,p)||z.push(re)}return z}var Si=Iv(Pn),Qm=Iv(Kf,!0);function A7(s,o){var l=!0;return Si(s,function(p,v,D){return l=!!o(p,v,D),l}),l}function ul(s,o,l){for(var p=-1,v=s.length;++p<v;){var D=s[p],R=o(D);if(R!=null&&(M===t?R===R&&!Zr(R):l(R,M)))var M=R,z=D}return z}function P7(s,o,l,p){var v=s.length;for(l=qe(l),l<0&&(l=-l>v?0:v+l),p=p===t||p>v?v:qe(p),p<0&&(p+=v),p=l>p?0:gy(p);l<p;)s[l++]=o;return s}function Xm(s,o){var l=[];return Si(s,function(p,v,D){o(p,v,D)&&l.push(p)}),l}function fr(s,o,l,p,v){var D=-1,R=s.length;for(l||(l=w$),v||(v=[]);++D<R;){var M=s[D];o>0&&l(M)?o>1?fr(M,o-1,l,p,v):xi(v,M):p||(v[v.length]=M)}return v}var Wf=Dv(),ev=Dv(!0);function Pn(s,o){return s&&Wf(s,o,cr)}function Kf(s,o){return s&&ev(s,o,cr)}function hl(s,o){return Ei(o,function(l){return ei(s[l])})}function fs(s,o){o=Oi(o,s);for(var l=0,p=o.length;s!=null&&l<p;)s=s[Rn(o[l++])];return l&&l==p?s:t}function tv(s,o,l){var p=o(s);return Le(s)?p:xi(p,l(s))}function $r(s){return s==null?s===t?He:Je:cs&&cs in wt(s)?d$(s):S$(s)}function Vf(s,o){return s>o}function T7(s,o){return s!=null&&dt.call(s,o)}function R7(s,o){return s!=null&&o in wt(s)}function N7(s,o,l){return s>=mr(o,l)&&s<nr(o,l)}function Gf(s,o,l){for(var p=l?Af:Kc,v=s[0].length,D=s.length,R=D,M=G(D),z=1/0,te=[];R--;){var re=s[R];R&&o&&(re=At(re,Yr(o))),z=mr(re.length,z),M[R]=!l&&(o||v>=120&&re.length>=120)?new us(R&&re):t}re=s[0];var oe=-1,fe=M[0];e:for(;++oe<v&&te.length<z;){var ve=re[oe],Ie=o?o(ve):ve;if(ve=l||ve!==0?ve:0,!(fe?aa(fe,Ie):p(te,Ie,l))){for(R=D;--R;){var We=M[R];if(!(We?aa(We,Ie):p(s[R],Ie,l)))continue e}fe&&fe.push(Ie),te.push(ve)}}return te}function L7(s,o,l,p){return Pn(s,function(v,D,R){o(p,l(v),D,R)}),p}function ga(s,o,l){o=Oi(o,s),s=qv(s,o);var p=s==null?s:s[Rn(un(o))];return p==null?t:ar(p,s,l)}function rv(s){return kt(s)&&$r(s)==de}function M7(s){return kt(s)&&$r(s)==Se}function U7(s){return kt(s)&&$r(s)==B}function ma(s,o,l,p,v){return s===o?!0:s==null||o==null||!kt(s)&&!kt(o)?s!==s&&o!==o:j7(s,o,l,p,ma,v)}function j7(s,o,l,p,v,D){var R=Le(s),M=Le(o),z=R?be:vr(s),te=M?be:vr(o);z=z==de?ke:z,te=te==de?ke:te;var re=z==ke,oe=te==ke,fe=z==te;if(fe&&Ai(s)){if(!Ai(o))return!1;R=!0,re=!1}if(fe&&!re)return D||(D=new yn),R||uo(s)?Lv(s,o,l,p,v,D):h$(s,o,z,l,p,v,D);if(!(l&S)){var ve=re&&dt.call(s,"__wrapped__"),Ie=oe&&dt.call(o,"__wrapped__");if(ve||Ie){var We=ve?s.value():s,De=Ie?o.value():o;return D||(D=new yn),v(We,De,l,p,D)}}return fe?(D||(D=new yn),f$(s,o,l,p,v,D)):!1}function F7(s){return kt(s)&&vr(s)==Ce}function Yf(s,o,l,p){var v=l.length,D=v,R=!p;if(s==null)return!D;for(s=wt(s);v--;){var M=l[v];if(R&&M[2]?M[1]!==s[M[0]]:!(M[0]in s))return!1}for(;++v<D;){M=l[v];var z=M[0],te=s[z],re=M[1];if(R&&M[2]){if(te===t&&!(z in s))return!1}else{var oe=new yn;if(p)var fe=p(te,re,z,s,o,oe);if(!(fe===t?ma(re,te,S|P,p,oe):fe))return!1}}return!0}function nv(s){if(!Rt(s)||_$(s))return!1;var o=ei(s)?FO:pf;return o.test(ps(s))}function B7(s){return kt(s)&&$r(s)==ze}function k7(s){return kt(s)&&vr(s)==Oe}function q7(s){return kt(s)&&Ol(s.length)&&!!mt[$r(s)]}function iv(s){return typeof s=="function"?s:s==null?qr:typeof s=="object"?Le(s)?av(s[0],s[1]):ov(s):Sy(s)}function Jf(s){if(!wa(s))return WO(s);var o=[];for(var l in wt(s))dt.call(s,l)&&l!="constructor"&&o.push(l);return o}function z7(s){if(!Rt(s))return D$(s);var o=wa(s),l=[];for(var p in s)p=="constructor"&&(o||!dt.call(s,p))||l.push(p);return l}function Zf(s,o){return s<o}function sv(s,o){var l=-1,p=Br(s)?G(s.length):[];return Si(s,function(v,D,R){p[++l]=o(v,D,R)}),p}function ov(s){var o=fd(s);return o.length==1&&o[0][2]?Bv(o[0][0],o[0][1]):function(l){return l===s||Yf(l,s,o)}}function av(s,o){return pd(s)&&Fv(o)?Bv(Rn(s),o):function(l){var p=Id(l,s);return p===t&&p===o?Dd(l,s):ma(o,p,S|P)}}function fl(s,o,l,p,v){s!==o&&Wf(o,function(D,R){if(v||(v=new yn),Rt(D))H7(s,o,R,l,fl,p,v);else{var M=p?p(md(s,R),D,R+"",s,o,v):t;M===t&&(M=D),zf(s,R,M)}},kr)}function H7(s,o,l,p,v,D,R){var M=md(s,l),z=md(o,l),te=R.get(z);if(te){zf(s,l,te);return}var re=D?D(M,z,l+"",s,o,R):t,oe=re===t;if(oe){var fe=Le(z),ve=!fe&&Ai(z),Ie=!fe&&!ve&&uo(z);re=z,fe||ve||Ie?Le(M)?re=M:Kt(M)?re=Fr(M):ve?(oe=!1,re=wv(z,!0)):Ie?(oe=!1,re=bv(z,!0)):re=[]:_a(z)||gs(z)?(re=M,gs(M)?re=my(M):(!Rt(M)||ei(M))&&(re=jv(z))):oe=!1}oe&&(R.set(z,re),v(re,z,p,D,R),R.delete(z)),zf(s,l,re)}function cv(s,o){var l=s.length;if(l)return o+=o<0?l:0,Xn(o,l)?s[o]:t}function lv(s,o,l){o.length?o=At(o,function(D){return Le(D)?function(R){return fs(R,D.length===1?D[0]:D)}:D}):o=[qr];var p=-1;o=At(o,Yr(_e()));var v=sv(s,function(D,R,M){var z=At(o,function(te){return te(D)});return{criteria:z,index:++p,value:D}});return vO(v,function(D,R){return n$(D,R,l)})}function W7(s,o){return uv(s,o,function(l,p){return Dd(s,p)})}function uv(s,o,l){for(var p=-1,v=o.length,D={};++p<v;){var R=o[p],M=fs(s,R);l(M,R)&&va(D,Oi(R,s),M)}return D}function K7(s){return function(o){return fs(o,s)}}function Qf(s,o,l,p){var v=p?mO:Xs,D=-1,R=o.length,M=s;for(s===o&&(o=Fr(o)),l&&(M=At(s,Yr(l)));++D<R;)for(var z=0,te=o[D],re=l?l(te):te;(z=v(M,re,z,p))>-1;)M!==s&&rl.call(M,z,1),rl.call(s,z,1);return s}function hv(s,o){for(var l=s?o.length:0,p=l-1;l--;){var v=o[l];if(l==p||v!==D){var D=v;Xn(v)?rl.call(s,v,1):rd(s,v)}}return s}function Xf(s,o){return s+sl(Wm()*(o-s+1))}function V7(s,o,l,p){for(var v=-1,D=nr(il((o-s)/(l||1)),0),R=G(D);D--;)R[p?D:++v]=s,s+=l;return R}function ed(s,o){var l="";if(!s||o<1||o>Y)return l;do o%2&&(l+=s),o=sl(o/2),o&&(s+=s);while(o);return l}function Ge(s,o){return vd(kv(s,o,qr),s+"")}function G7(s){return Gm(ho(s))}function Y7(s,o){var l=ho(s);return El(l,hs(o,0,l.length))}function va(s,o,l,p){if(!Rt(s))return s;o=Oi(o,s);for(var v=-1,D=o.length,R=D-1,M=s;M!=null&&++v<D;){var z=Rn(o[v]),te=l;if(z==="__proto__"||z==="constructor"||z==="prototype")return s;if(v!=R){var re=M[z];te=p?p(re,z,M):t,te===t&&(te=Rt(re)?re:Xn(o[v+1])?[]:{})}da(M,z,te),M=M[z]}return s}var fv=ol?function(s,o){return ol.set(s,o),s}:qr,J7=nl?function(s,o){return nl(s,"toString",{configurable:!0,enumerable:!1,value:Cd(o),writable:!0})}:qr;function Z7(s){return El(ho(s))}function ln(s,o,l){var p=-1,v=s.length;o<0&&(o=-o>v?0:v+o),l=l>v?v:l,l<0&&(l+=v),v=o>l?0:l-o>>>0,o>>>=0;for(var D=G(v);++p<v;)D[p]=s[p+o];return D}function Q7(s,o){var l;return Si(s,function(p,v,D){return l=o(p,v,D),!l}),!!l}function dl(s,o,l){var p=0,v=s==null?p:s.length;if(typeof o=="number"&&o===o&&v<=ae){for(;p<v;){var D=p+v>>>1,R=s[D];R!==null&&!Zr(R)&&(l?R<=o:R<o)?p=D+1:v=D}return v}return td(s,o,qr,l)}function td(s,o,l,p){var v=0,D=s==null?0:s.length;if(D===0)return 0;o=l(o);for(var R=o!==o,M=o===null,z=Zr(o),te=o===t;v<D;){var re=sl((v+D)/2),oe=l(s[re]),fe=oe!==t,ve=oe===null,Ie=oe===oe,We=Zr(oe);if(R)var De=p||Ie;else te?De=Ie&&(p||fe):M?De=Ie&&fe&&(p||!ve):z?De=Ie&&fe&&!ve&&(p||!We):ve||We?De=!1:De=p?oe<=o:oe<o;De?v=re+1:D=re}return mr(D,Ee)}function dv(s,o){for(var l=-1,p=s.length,v=0,D=[];++l<p;){var R=s[l],M=o?o(R):R;if(!l||!wn(M,z)){var z=M;D[v++]=R===0?0:R}}return D}function pv(s){return typeof s=="number"?s:Zr(s)?Q:+s}function Jr(s){if(typeof s=="string")return s;if(Le(s))return At(s,Jr)+"";if(Zr(s))return Km?Km.call(s):"";var o=s+"";return o=="0"&&1/s==-ee?"-0":o}function Ci(s,o,l){var p=-1,v=Kc,D=s.length,R=!0,M=[],z=M;if(l)R=!1,v=Af;else if(D>=i){var te=o?null:l$(s);if(te)return Gc(te);R=!1,v=aa,z=new us}else z=o?[]:M;e:for(;++p<D;){var re=s[p],oe=o?o(re):re;if(re=l||re!==0?re:0,R&&oe===oe){for(var fe=z.length;fe--;)if(z[fe]===oe)continue e;o&&z.push(oe),M.push(re)}else v(z,oe,l)||(z!==M&&z.push(oe),M.push(re))}return M}function rd(s,o){return o=Oi(o,s),s=qv(s,o),s==null||delete s[Rn(un(o))]}function gv(s,o,l,p){return va(s,o,l(fs(s,o)),p)}function pl(s,o,l,p){for(var v=s.length,D=p?v:-1;(p?D--:++D<v)&&o(s[D],D,s););return l?ln(s,p?0:D,p?D+1:v):ln(s,p?D+1:0,p?v:D)}function mv(s,o){var l=s;return l instanceof tt&&(l=l.value()),Pf(o,function(p,v){return v.func.apply(v.thisArg,xi([p],v.args))},l)}function nd(s,o,l){var p=s.length;if(p<2)return p?Ci(s[0]):[];for(var v=-1,D=G(p);++v<p;)for(var R=s[v],M=-1;++M<p;)M!=v&&(D[v]=pa(D[v]||R,s[M],o,l));return Ci(fr(D,1),o,l)}function vv(s,o,l){for(var p=-1,v=s.length,D=o.length,R={};++p<v;){var M=p<D?o[p]:t;l(R,s[p],M)}return R}function id(s){return Kt(s)?s:[]}function sd(s){return typeof s=="function"?s:qr}function Oi(s,o){return Le(s)?s:pd(s,o)?[s]:Kv(ft(s))}var X7=Ge;function $i(s,o,l){var p=s.length;return l=l===t?p:l,!o&&l>=p?s:ln(s,o,l)}var yv=BO||function(s){return it.clearTimeout(s)};function wv(s,o){if(o)return s.slice();var l=s.length,p=Bm?Bm(l):new s.constructor(l);return s.copy(p),p}function od(s){var o=new s.constructor(s.byteLength);return new el(o).set(new el(s)),o}function e$(s,o){var l=o?od(s.buffer):s.buffer;return new s.constructor(l,s.byteOffset,s.byteLength)}function t$(s){var o=new s.constructor(s.source,rn.exec(s));return o.lastIndex=s.lastIndex,o}function r$(s){return fa?wt(fa.call(s)):{}}function bv(s,o){var l=o?od(s.buffer):s.buffer;return new s.constructor(l,s.byteOffset,s.length)}function _v(s,o){if(s!==o){var l=s!==t,p=s===null,v=s===s,D=Zr(s),R=o!==t,M=o===null,z=o===o,te=Zr(o);if(!M&&!te&&!D&&s>o||D&&R&&z&&!M&&!te||p&&R&&z||!l&&z||!v)return 1;if(!p&&!D&&!te&&s<o||te&&l&&v&&!p&&!D||M&&l&&v||!R&&v||!z)return-1}return 0}function n$(s,o,l){for(var p=-1,v=s.criteria,D=o.criteria,R=v.length,M=l.length;++p<R;){var z=_v(v[p],D[p]);if(z){if(p>=M)return z;var te=l[p];return z*(te=="desc"?-1:1)}}return s.index-o.index}function Ev(s,o,l,p){for(var v=-1,D=s.length,R=l.length,M=-1,z=o.length,te=nr(D-R,0),re=G(z+te),oe=!p;++M<z;)re[M]=o[M];for(;++v<R;)(oe||v<D)&&(re[l[v]]=s[v]);for(;te--;)re[M++]=s[v++];return re}function xv(s,o,l,p){for(var v=-1,D=s.length,R=-1,M=l.length,z=-1,te=o.length,re=nr(D-M,0),oe=G(re+te),fe=!p;++v<re;)oe[v]=s[v];for(var ve=v;++z<te;)oe[ve+z]=o[z];for(;++R<M;)(fe||v<D)&&(oe[ve+l[R]]=s[v++]);return oe}function Fr(s,o){var l=-1,p=s.length;for(o||(o=G(p));++l<p;)o[l]=s[l];return o}function Tn(s,o,l,p){var v=!l;l||(l={});for(var D=-1,R=o.length;++D<R;){var M=o[D],z=p?p(l[M],s[M],M,l,s):t;z===t&&(z=s[M]),v?Jn(l,M,z):da(l,M,z)}return l}function i$(s,o){return Tn(s,dd(s),o)}function s$(s,o){return Tn(s,Mv(s),o)}function gl(s,o){return function(l,p){var v=Le(l)?uO:C7,D=o?o():{};return v(l,s,_e(p,2),D)}}function ao(s){return Ge(function(o,l){var p=-1,v=l.length,D=v>1?l[v-1]:t,R=v>2?l[2]:t;for(D=s.length>3&&typeof D=="function"?(v--,D):t,R&&Ar(l[0],l[1],R)&&(D=v<3?t:D,v=1),o=wt(o);++p<v;){var M=l[p];M&&s(o,M,p,D)}return o})}function Iv(s,o){return function(l,p){if(l==null)return l;if(!Br(l))return s(l,p);for(var v=l.length,D=o?v:-1,R=wt(l);(o?D--:++D<v)&&p(R[D],D,R)!==!1;);return l}}function Dv(s){return function(o,l,p){for(var v=-1,D=wt(o),R=p(o),M=R.length;M--;){var z=R[s?M:++v];if(l(D[z],z,D)===!1)break}return o}}function o$(s,o,l){var p=o&U,v=ya(s);function D(){var R=this&&this!==it&&this instanceof D?v:s;return R.apply(p?l:this,arguments)}return D}function Sv(s){return function(o){o=ft(o);var l=eo(o)?vn(o):t,p=l?l[0]:o.charAt(0),v=l?$i(l,1).join(""):o.slice(1);return p[s]()+v}}function co(s){return function(o){return Pf(Iy(xy(o).replace(sa,"")),s,"")}}function ya(s){return function(){var o=arguments;switch(o.length){case 0:return new s;case 1:return new s(o[0]);case 2:return new s(o[0],o[1]);case 3:return new s(o[0],o[1],o[2]);case 4:return new s(o[0],o[1],o[2],o[3]);case 5:return new s(o[0],o[1],o[2],o[3],o[4]);case 6:return new s(o[0],o[1],o[2],o[3],o[4],o[5]);case 7:return new s(o[0],o[1],o[2],o[3],o[4],o[5],o[6])}var l=oo(s.prototype),p=s.apply(l,o);return Rt(p)?p:l}}function a$(s,o,l){var p=ya(s);function v(){for(var D=arguments.length,R=G(D),M=D,z=lo(v);M--;)R[M]=arguments[M];var te=D<3&&R[0]!==z&&R[D-1]!==z?[]:Ii(R,z);if(D-=te.length,D<l)return Pv(s,o,ml,v.placeholder,t,R,te,t,t,l-D);var re=this&&this!==it&&this instanceof v?p:s;return ar(re,this,R)}return v}function Cv(s){return function(o,l,p){var v=wt(o);if(!Br(o)){var D=_e(l,3);o=cr(o),l=function(M){return D(v[M],M,v)}}var R=s(o,l,p);return R>-1?v[D?o[R]:R]:t}}function Ov(s){return Qn(function(o){var l=o.length,p=l,v=an.prototype.thru;for(s&&o.reverse();p--;){var D=o[p];if(typeof D!="function")throw new on(c);if(v&&!R&&bl(D)=="wrapper")var R=new an([],!0)}for(p=R?p:l;++p<l;){D=o[p];var M=bl(D),z=M=="wrapper"?hd(D):t;z&&gd(z[0])&&z[1]==(d|T|$|b)&&!z[4].length&&z[9]==1?R=R[bl(z[0])].apply(R,z[3]):R=D.length==1&&gd(D)?R[M]():R.thru(D)}return function(){var te=arguments,re=te[0];if(R&&te.length==1&&Le(re))return R.plant(re).value();for(var oe=0,fe=l?o[oe].apply(this,te):re;++oe<l;)fe=o[oe].call(this,fe);return fe}})}function ml(s,o,l,p,v,D,R,M,z,te){var re=o&d,oe=o&U,fe=o&j,ve=o&(T|C),Ie=o&H,We=fe?t:ya(s);function De(){for(var Qe=arguments.length,st=G(Qe),Qr=Qe;Qr--;)st[Qr]=arguments[Qr];if(ve)var Pr=lo(De),Xr=wO(st,Pr);if(p&&(st=Ev(st,p,v,ve)),D&&(st=xv(st,D,R,ve)),Qe-=Xr,ve&&Qe<te){var Vt=Ii(st,Pr);return Pv(s,o,ml,De.placeholder,l,st,Vt,M,z,te-Qe)}var bn=oe?l:this,ri=fe?bn[s]:s;return Qe=st.length,M?st=C$(st,M):Ie&&Qe>1&&st.reverse(),re&&z<Qe&&(st.length=z),this&&this!==it&&this instanceof De&&(ri=We||ya(ri)),ri.apply(bn,st)}return De}function $v(s,o){return function(l,p){return L7(l,s,o(p),{})}}function vl(s,o){return function(l,p){var v;if(l===t&&p===t)return o;if(l!==t&&(v=l),p!==t){if(v===t)return p;typeof l=="string"||typeof p=="string"?(l=Jr(l),p=Jr(p)):(l=pv(l),p=pv(p)),v=s(l,p)}return v}}function ad(s){return Qn(function(o){return o=At(o,Yr(_e())),Ge(function(l){var p=this;return s(o,function(v){return ar(v,p,l)})})})}function yl(s,o){o=o===t?" ":Jr(o);var l=o.length;if(l<2)return l?ed(o,s):o;var p=ed(o,il(s/to(o)));return eo(o)?$i(vn(p),0,s).join(""):p.slice(0,s)}function c$(s,o,l,p){var v=o&U,D=ya(s);function R(){for(var M=-1,z=arguments.length,te=-1,re=p.length,oe=G(re+z),fe=this&&this!==it&&this instanceof R?D:s;++te<re;)oe[te]=p[te];for(;z--;)oe[te++]=arguments[++M];return ar(fe,v?l:this,oe)}return R}function Av(s){return function(o,l,p){return p&&typeof p!="number"&&Ar(o,l,p)&&(l=p=t),o=ti(o),l===t?(l=o,o=0):l=ti(l),p=p===t?o<l?1:-1:ti(p),V7(o,l,p,s)}}function wl(s){return function(o,l){return typeof o=="string"&&typeof l=="string"||(o=hn(o),l=hn(l)),s(o,l)}}function Pv(s,o,l,p,v,D,R,M,z,te){var re=o&T,oe=re?R:t,fe=re?t:R,ve=re?D:t,Ie=re?t:D;o|=re?$:E,o&=~(re?E:$),o&A||(o&=~(U|j));var We=[s,o,v,ve,oe,Ie,fe,M,z,te],De=l.apply(t,We);return gd(s)&&zv(De,We),De.placeholder=p,Hv(De,s,o)}function cd(s){var o=rr[s];return function(l,p){if(l=hn(l),p=p==null?0:mr(qe(p),292),p&&Hm(l)){var v=(ft(l)+"e").split("e"),D=o(v[0]+"e"+(+v[1]+p));return v=(ft(D)+"e").split("e"),+(v[0]+"e"+(+v[1]-p))}return o(l)}}var l$=io&&1/Gc(new io([,-0]))[1]==ee?function(s){return new io(s)}:Ad;function Tv(s){return function(o){var l=vr(o);return l==Ce?jf(o):l==Oe?SO(o):yO(o,s(o))}}function Zn(s,o,l,p,v,D,R,M){var z=o&j;if(!z&&typeof s!="function")throw new on(c);var te=p?p.length:0;if(te||(o&=~($|E),p=v=t),R=R===t?R:nr(qe(R),0),M=M===t?M:qe(M),te-=v?v.length:0,o&E){var re=p,oe=v;p=v=t}var fe=z?t:hd(s),ve=[s,o,l,p,v,re,oe,D,R,M];if(fe&&I$(ve,fe),s=ve[0],o=ve[1],l=ve[2],p=ve[3],v=ve[4],M=ve[9]=ve[9]===t?z?0:s.length:nr(ve[9]-te,0),!M&&o&(T|C)&&(o&=~(T|C)),!o||o==U)var Ie=o$(s,o,l);else o==T||o==C?Ie=a$(s,o,M):(o==$||o==(U|$))&&!v.length?Ie=c$(s,o,l,p):Ie=ml.apply(t,ve);var We=fe?fv:zv;return Hv(We(Ie,ve),s,o)}function Rv(s,o,l,p){return s===t||wn(s,no[l])&&!dt.call(p,l)?o:s}function Nv(s,o,l,p,v,D){return Rt(s)&&Rt(o)&&(D.set(o,s),fl(s,o,t,Nv,D),D.delete(o)),s}function u$(s){return _a(s)?t:s}function Lv(s,o,l,p,v,D){var R=l&S,M=s.length,z=o.length;if(M!=z&&!(R&&z>M))return!1;var te=D.get(s),re=D.get(o);if(te&&re)return te==o&&re==s;var oe=-1,fe=!0,ve=l&P?new us:t;for(D.set(s,o),D.set(o,s);++oe<M;){var Ie=s[oe],We=o[oe];if(p)var De=R?p(We,Ie,oe,o,s,D):p(Ie,We,oe,s,o,D);if(De!==t){if(De)continue;fe=!1;break}if(ve){if(!Tf(o,function(Qe,st){if(!aa(ve,st)&&(Ie===Qe||v(Ie,Qe,l,p,D)))return ve.push(st)})){fe=!1;break}}else if(!(Ie===We||v(Ie,We,l,p,D))){fe=!1;break}}return D.delete(s),D.delete(o),fe}function h$(s,o,l,p,v,D,R){switch(l){case Te:if(s.byteLength!=o.byteLength||s.byteOffset!=o.byteOffset)return!1;s=s.buffer,o=o.buffer;case Se:return!(s.byteLength!=o.byteLength||!D(new el(s),new el(o)));case W:case B:case Ke:return wn(+s,+o);case L:return s.name==o.name&&s.message==o.message;case ze:case Ue:return s==o+"";case Ce:var M=jf;case Oe:var z=p&S;if(M||(M=Gc),s.size!=o.size&&!z)return!1;var te=R.get(s);if(te)return te==o;p|=P,R.set(s,o);var re=Lv(M(s),M(o),p,v,D,R);return R.delete(s),re;case je:if(fa)return fa.call(s)==fa.call(o)}return!1}function f$(s,o,l,p,v,D){var R=l&S,M=ld(s),z=M.length,te=ld(o),re=te.length;if(z!=re&&!R)return!1;for(var oe=z;oe--;){var fe=M[oe];if(!(R?fe in o:dt.call(o,fe)))return!1}var ve=D.get(s),Ie=D.get(o);if(ve&&Ie)return ve==o&&Ie==s;var We=!0;D.set(s,o),D.set(o,s);for(var De=R;++oe<z;){fe=M[oe];var Qe=s[fe],st=o[fe];if(p)var Qr=R?p(st,Qe,fe,o,s,D):p(Qe,st,fe,s,o,D);if(!(Qr===t?Qe===st||v(Qe,st,l,p,D):Qr)){We=!1;break}De||(De=fe=="constructor")}if(We&&!De){var Pr=s.constructor,Xr=o.constructor;Pr!=Xr&&"constructor"in s&&"constructor"in o&&!(typeof Pr=="function"&&Pr instanceof Pr&&typeof Xr=="function"&&Xr instanceof Xr)&&(We=!1)}return D.delete(s),D.delete(o),We}function Qn(s){return vd(kv(s,t,Jv),s+"")}function ld(s){return tv(s,cr,dd)}function ud(s){return tv(s,kr,Mv)}var hd=ol?function(s){return ol.get(s)}:Ad;function bl(s){for(var o=s.name+"",l=so[o],p=dt.call(so,o)?l.length:0;p--;){var v=l[p],D=v.func;if(D==null||D==s)return v.name}return o}function lo(s){var o=dt.call(_,"placeholder")?_:s;return o.placeholder}function _e(){var s=_.iteratee||Od;return s=s===Od?iv:s,arguments.length?s(arguments[0],arguments[1]):s}function _l(s,o){var l=s.__data__;return b$(o)?l[typeof o=="string"?"string":"hash"]:l.map}function fd(s){for(var o=cr(s),l=o.length;l--;){var p=o[l],v=s[p];o[l]=[p,v,Fv(v)]}return o}function ds(s,o){var l=xO(s,o);return nv(l)?l:t}function d$(s){var o=dt.call(s,cs),l=s[cs];try{s[cs]=t;var p=!0}catch{}var v=Qc.call(s);return p&&(o?s[cs]=l:delete s[cs]),v}var dd=Bf?function(s){return s==null?[]:(s=wt(s),Ei(Bf(s),function(o){return qm.call(s,o)}))}:Pd,Mv=Bf?function(s){for(var o=[];s;)xi(o,dd(s)),s=tl(s);return o}:Pd,vr=$r;(kf&&vr(new kf(new ArrayBuffer(1)))!=Te||la&&vr(new la)!=Ce||qf&&vr(qf.resolve())!=St||io&&vr(new io)!=Oe||ua&&vr(new ua)!=Ae)&&(vr=function(s){var o=$r(s),l=o==ke?s.constructor:t,p=l?ps(l):"";if(p)switch(p){case YO:return Te;case JO:return Ce;case ZO:return St;case QO:return Oe;case XO:return Ae}return o});function p$(s,o,l){for(var p=-1,v=l.length;++p<v;){var D=l[p],R=D.size;switch(D.type){case"drop":s+=R;break;case"dropRight":o-=R;break;case"take":o=mr(o,s+R);break;case"takeRight":s=nr(s,o-R);break}}return{start:s,end:o}}function g$(s){var o=s.match(_t);return o?o[1].split(Zt):[]}function Uv(s,o,l){o=Oi(o,s);for(var p=-1,v=o.length,D=!1;++p<v;){var R=Rn(o[p]);if(!(D=s!=null&&l(s,R)))break;s=s[R]}return D||++p!=v?D:(v=s==null?0:s.length,!!v&&Ol(v)&&Xn(R,v)&&(Le(s)||gs(s)))}function m$(s){var o=s.length,l=new s.constructor(o);return o&&typeof s[0]=="string"&&dt.call(s,"index")&&(l.index=s.index,l.input=s.input),l}function jv(s){return typeof s.constructor=="function"&&!wa(s)?oo(tl(s)):{}}function v$(s,o,l){var p=s.constructor;switch(o){case Se:return od(s);case W:case B:return new p(+s);case Te:return e$(s,l);case Ve:case $e:case Ze:case et:case at:case ct:case nt:case Sr:case Ur:return bv(s,l);case Ce:return new p;case Ke:case Ue:return new p(s);case ze:return t$(s);case Oe:return new p;case je:return r$(s)}}function y$(s,o){var l=o.length;if(!l)return s;var p=l-1;return o[p]=(l>1?"& ":"")+o[p],o=o.join(l>2?", ":" "),s.replace(Bt,`{
|
|
66
|
+
*/(function(r,e){(function(){var t,n="4.17.21",i=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",u="Invalid `variable` option passed into `_.template`",f="__lodash_hash_undefined__",h=500,m="__lodash_placeholder__",w=1,y=2,b=4,I=1,A=2,U=1,j=2,$=4,T=8,O=16,P=32,x=64,d=128,_=256,H=512,F=30,V="...",se=800,ce=16,D=1,N=2,X=3,ee=1/0,Y=9007199254740991,Z=17976931348623157e292,Q=0/0,ie=4294967295,Ee=ie-1,ae=ie>>>1,xe=[["ary",d],["bind",U],["bindKey",j],["curry",T],["curryRight",O],["flip",H],["partial",P],["partialRight",x],["rearg",_]],de="[object Arguments]",be="[object Array]",K="[object AsyncFunction]",W="[object Boolean]",B="[object Date]",g="[object DOMException]",L="[object Error]",le="[object Function]",pe="[object GeneratorFunction]",Oe="[object Map]",Ke="[object Number]",Ze="[object Null]",ke="[object Object]",St="[object Promise]",Ot="[object Proxy]",qe="[object RegExp]",Ce="[object Set]",Ue="[object String]",je="[object Symbol]",He="[object Undefined]",Ae="[object WeakMap]",Fe="[object WeakSet]",Se="[object ArrayBuffer]",Te="[object DataView]",Ve="[object Float32Array]",$e="[object Float64Array]",Je="[object Int8Array]",Xe="[object Int16Array]",ot="[object Int32Array]",at="[object Uint8Array]",rt="[object Uint8ClampedArray]",xr="[object Uint16Array]",Nr="[object Uint32Array]",An=/\b__p \+= '';/g,Ir=/\b(__p \+=) '' \+/g,Gn=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Ii=/&(?:amp|lt|gt|quot|#39);/g,as=/[&<>"']/g,Lt=RegExp(Ii.source),Ct=RegExp(as.source),Mt=/<%-([\s\S]+?)%>/g,Ut=/<%([\s\S]+?)%>/g,Tt=/<%=([\s\S]+?)%>/g,$t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Vt=/^\w*$/,Gt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,jt=/[\\^$.*+?()[\]{}|]/g,Yt=RegExp(jt.source),Ft=/^\s+/,qt=/\s/,Bt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,_t=/\{\n\/\* \[wrapped with (.+)\] \*/,Zt=/,? & /,Jt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,yf=/[()=,{}\[\]\/\s]/,wf=/\\(\\)?/g,bf=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,sn=/\w*$/,_f=/^[-+]0x[0-9a-f]+$/i,Ef=/^0b[01]+$/i,xf=/^\[object .+?Constructor\]$/,If=/^0o[0-7]+$/i,Df=/^(?:0|[1-9]\d*)$/,Yn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Qs=/($^)/,Sf=/['\n\r\u2028\u2029\\]/g,Xs="\\ud800-\\udfff",Of="\\u0300-\\u036f",Cf="\\ufe20-\\ufe2f",eo="\\u20d0-\\u20ff",Uc=Of+Cf+eo,jc="\\u2700-\\u27bf",vn="a-z\\xdf-\\xf6\\xf8-\\xff",$f="\\xac\\xb1\\xd7\\xf7",Af="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Pf="\\u2000-\\u206f",Tf=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Fc="A-Z\\xc0-\\xd6\\xd8-\\xde",Bc="\\ufe0e\\ufe0f",cs=$f+Af+Pf+Tf,fa="['\u2019]",ls="["+Xs+"]",da="["+cs+"]",us="["+Uc+"]",kc="\\d+",Rf="["+jc+"]",zc="["+vn+"]",qc="[^"+Xs+cs+kc+jc+vn+Fc+"]",to="\\ud83c[\\udffb-\\udfff]",Nf="(?:"+us+"|"+to+")",Hc="[^"+Xs+"]",ro="(?:\\ud83c[\\udde6-\\uddff]){2}",Di="[\\ud800-\\udbff][\\udc00-\\udfff]",Gr="["+Fc+"]",Wc="\\u200d",Kc="(?:"+zc+"|"+qc+")",Pn="(?:"+Gr+"|"+qc+")",Vc="(?:"+fa+"(?:d|ll|m|re|s|t|ve))?",Gc="(?:"+fa+"(?:D|LL|M|RE|S|T|VE))?",Yc=Nf+"?",Zc="["+Bc+"]?",Lf="(?:"+Wc+"(?:"+[Hc,ro,Di].join("|")+")"+Zc+Yc+")*",Zn="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Jc="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Qc=Zc+Yc+Lf,no="(?:"+[Rf,ro,Di].join("|")+")"+Qc,Mf="(?:"+[Hc+us+"?",us,ro,Di,ls].join("|")+")",pa=RegExp(fa,"g"),Uf=RegExp(us,"g"),io=RegExp(to+"(?="+to+")|"+Mf+Qc,"g"),Xc=RegExp([Gr+"?"+zc+"+"+Vc+"(?="+[da,Gr,"$"].join("|")+")",Pn+"+"+Gc+"(?="+[da,Gr+Kc,"$"].join("|")+")",Gr+"?"+Kc+"+"+Vc,Gr+"+"+Gc,Jc,Zn,kc,no].join("|"),"g"),el=RegExp("["+Wc+Xs+Uc+Bc+"]"),hs=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,tl=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],jf=-1,mt={};mt[Ve]=mt[$e]=mt[Je]=mt[Xe]=mt[ot]=mt[at]=mt[rt]=mt[xr]=mt[Nr]=!0,mt[de]=mt[be]=mt[Se]=mt[W]=mt[Te]=mt[B]=mt[L]=mt[le]=mt[Oe]=mt[Ke]=mt[ke]=mt[qe]=mt[Ce]=mt[Ue]=mt[Ae]=!1;var gt={};gt[de]=gt[be]=gt[Se]=gt[Te]=gt[W]=gt[B]=gt[Ve]=gt[$e]=gt[Je]=gt[Xe]=gt[ot]=gt[Oe]=gt[Ke]=gt[ke]=gt[qe]=gt[Ce]=gt[Ue]=gt[je]=gt[at]=gt[rt]=gt[xr]=gt[Nr]=!0,gt[L]=gt[le]=gt[Ae]=!1;var C={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},k={"&":"&","<":"<",">":">",'"':""","'":"'"},ne={"&":"&","<":"<",">":">",""":'"',"'":"'"},ge={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},vt=parseFloat,Ne=parseInt,xt=typeof Wo=="object"&&Wo&&Wo.Object===Object&&Wo,Qt=typeof self=="object"&&self&&self.Object===Object&&self,nt=xt||Qt||Function("return this")(),yt=e&&!e.nodeType&&e,Ht=yt&&!0&&r&&!r.nodeType&&r,Lr=Ht&&Ht.exports===yt,Xt=Lr&&xt.process,It=function(){try{var z=Ht&&Ht.require&&Ht.require("util").types;return z||Xt&&Xt.binding&&Xt.binding("util")}catch{}}(),Dr=It&&It.isArrayBuffer,yn=It&&It.isDate,on=It&&It.isMap,Tn=It&&It.isRegExp,ga=It&&It.isSet,fs=It&&It.isTypedArray;function or(z,J,G){switch(G.length){case 0:return z.call(J);case 1:return z.call(J,G[0]);case 2:return z.call(J,G[0],G[1]);case 3:return z.call(J,G[0],G[1],G[2])}return z.apply(J,G)}function jC(z,J,G,ve){for(var Re=-1,lt=z==null?0:z.length;++Re<lt;){var tr=z[Re];J(ve,tr,G(tr),z)}return ve}function an(z,J){for(var G=-1,ve=z==null?0:z.length;++G<ve&&J(z[G],G,z)!==!1;);return z}function FC(z,J){for(var G=z==null?0:z.length;G--&&J(z[G],G,z)!==!1;);return z}function qm(z,J){for(var G=-1,ve=z==null?0:z.length;++G<ve;)if(!J(z[G],G,z))return!1;return!0}function Si(z,J){for(var G=-1,ve=z==null?0:z.length,Re=0,lt=[];++G<ve;){var tr=z[G];J(tr,G,z)&&(lt[Re++]=tr)}return lt}function rl(z,J){var G=z==null?0:z.length;return!!G&&so(z,J,0)>-1}function Ff(z,J,G){for(var ve=-1,Re=z==null?0:z.length;++ve<Re;)if(G(J,z[ve]))return!0;return!1}function At(z,J){for(var G=-1,ve=z==null?0:z.length,Re=Array(ve);++G<ve;)Re[G]=J(z[G],G,z);return Re}function Oi(z,J){for(var G=-1,ve=J.length,Re=z.length;++G<ve;)z[Re+G]=J[G];return z}function Bf(z,J,G,ve){var Re=-1,lt=z==null?0:z.length;for(ve&<&&(G=z[++Re]);++Re<lt;)G=J(G,z[Re],Re,z);return G}function BC(z,J,G,ve){var Re=z==null?0:z.length;for(ve&&Re&&(G=z[--Re]);Re--;)G=J(G,z[Re],Re,z);return G}function kf(z,J){for(var G=-1,ve=z==null?0:z.length;++G<ve;)if(J(z[G],G,z))return!0;return!1}var kC=zf("length");function zC(z){return z.split("")}function qC(z){return z.match(Jt)||[]}function Hm(z,J,G){var ve;return G(z,function(Re,lt,tr){if(J(Re,lt,tr))return ve=lt,!1}),ve}function nl(z,J,G,ve){for(var Re=z.length,lt=G+(ve?1:-1);ve?lt--:++lt<Re;)if(J(z[lt],lt,z))return lt;return-1}function so(z,J,G){return J===J?t7(z,J,G):nl(z,Wm,G)}function HC(z,J,G,ve){for(var Re=G-1,lt=z.length;++Re<lt;)if(ve(z[Re],J))return Re;return-1}function Wm(z){return z!==z}function Km(z,J){var G=z==null?0:z.length;return G?Hf(z,J)/G:Q}function zf(z){return function(J){return J==null?t:J[z]}}function qf(z){return function(J){return z==null?t:z[J]}}function Vm(z,J,G,ve,Re){return Re(z,function(lt,tr,wt){G=ve?(ve=!1,lt):J(G,lt,tr,wt)}),G}function WC(z,J){var G=z.length;for(z.sort(J);G--;)z[G]=z[G].value;return z}function Hf(z,J){for(var G,ve=-1,Re=z.length;++ve<Re;){var lt=J(z[ve]);lt!==t&&(G=G===t?lt:G+lt)}return G}function Wf(z,J){for(var G=-1,ve=Array(z);++G<z;)ve[G]=J(G);return ve}function KC(z,J){return At(J,function(G){return[G,z[G]]})}function Gm(z){return z&&z.slice(0,Qm(z)+1).replace(Ft,"")}function Yr(z){return function(J){return z(J)}}function Kf(z,J){return At(J,function(G){return z[G]})}function ma(z,J){return z.has(J)}function Ym(z,J){for(var G=-1,ve=z.length;++G<ve&&so(J,z[G],0)>-1;);return G}function Zm(z,J){for(var G=z.length;G--&&so(J,z[G],0)>-1;);return G}function VC(z,J){for(var G=z.length,ve=0;G--;)z[G]===J&&++ve;return ve}var GC=qf(C),YC=qf(k);function ZC(z){return"\\"+ge[z]}function JC(z,J){return z==null?t:z[J]}function oo(z){return el.test(z)}function QC(z){return hs.test(z)}function XC(z){for(var J,G=[];!(J=z.next()).done;)G.push(J.value);return G}function Vf(z){var J=-1,G=Array(z.size);return z.forEach(function(ve,Re){G[++J]=[Re,ve]}),G}function Jm(z,J){return function(G){return z(J(G))}}function Ci(z,J){for(var G=-1,ve=z.length,Re=0,lt=[];++G<ve;){var tr=z[G];(tr===J||tr===m)&&(z[G]=m,lt[Re++]=G)}return lt}function il(z){var J=-1,G=Array(z.size);return z.forEach(function(ve){G[++J]=ve}),G}function e7(z){var J=-1,G=Array(z.size);return z.forEach(function(ve){G[++J]=[ve,ve]}),G}function t7(z,J,G){for(var ve=G-1,Re=z.length;++ve<Re;)if(z[ve]===J)return ve;return-1}function r7(z,J,G){for(var ve=G+1;ve--;)if(z[ve]===J)return ve;return ve}function ao(z){return oo(z)?i7(z):kC(z)}function wn(z){return oo(z)?s7(z):zC(z)}function Qm(z){for(var J=z.length;J--&&qt.test(z.charAt(J)););return J}var n7=qf(ne);function i7(z){for(var J=io.lastIndex=0;io.test(z);)++J;return J}function s7(z){return z.match(io)||[]}function o7(z){return z.match(Xc)||[]}var a7=function z(J){J=J==null?nt:co.defaults(nt.Object(),J,co.pick(nt,tl));var G=J.Array,ve=J.Date,Re=J.Error,lt=J.Function,tr=J.Math,wt=J.Object,Gf=J.RegExp,c7=J.String,cn=J.TypeError,sl=G.prototype,l7=lt.prototype,lo=wt.prototype,ol=J["__core-js_shared__"],al=l7.toString,ft=lo.hasOwnProperty,u7=0,Xm=function(){var s=/[^.]+$/.exec(ol&&ol.keys&&ol.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),cl=lo.toString,h7=al.call(wt),f7=nt._,d7=Gf("^"+al.call(ft).replace(jt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ll=Lr?J.Buffer:t,$i=J.Symbol,ul=J.Uint8Array,ev=ll?ll.allocUnsafe:t,hl=Jm(wt.getPrototypeOf,wt),tv=wt.create,rv=lo.propertyIsEnumerable,fl=sl.splice,nv=$i?$i.isConcatSpreadable:t,va=$i?$i.iterator:t,ds=$i?$i.toStringTag:t,dl=function(){try{var s=ys(wt,"defineProperty");return s({},"",{}),s}catch{}}(),p7=J.clearTimeout!==nt.clearTimeout&&J.clearTimeout,g7=ve&&ve.now!==nt.Date.now&&ve.now,m7=J.setTimeout!==nt.setTimeout&&J.setTimeout,pl=tr.ceil,gl=tr.floor,Yf=wt.getOwnPropertySymbols,v7=ll?ll.isBuffer:t,iv=J.isFinite,y7=sl.join,w7=Jm(wt.keys,wt),rr=tr.max,gr=tr.min,b7=ve.now,_7=J.parseInt,sv=tr.random,E7=sl.reverse,Zf=ys(J,"DataView"),ya=ys(J,"Map"),Jf=ys(J,"Promise"),uo=ys(J,"Set"),wa=ys(J,"WeakMap"),ba=ys(wt,"create"),ml=wa&&new wa,ho={},x7=ws(Zf),I7=ws(ya),D7=ws(Jf),S7=ws(uo),O7=ws(wa),vl=$i?$i.prototype:t,_a=vl?vl.valueOf:t,ov=vl?vl.toString:t;function E(s){if(kt(s)&&!Le(s)&&!(s instanceof et)){if(s instanceof ln)return s;if(ft.call(s,"__wrapped__"))return ay(s)}return new ln(s)}var fo=function(){function s(){}return function(o){if(!Rt(o))return{};if(tv)return tv(o);s.prototype=o;var l=new s;return s.prototype=t,l}}();function yl(){}function ln(s,o){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!o,this.__index__=0,this.__values__=t}E.templateSettings={escape:Mt,evaluate:Ut,interpolate:Tt,variable:"",imports:{_:E}},E.prototype=yl.prototype,E.prototype.constructor=E,ln.prototype=fo(yl.prototype),ln.prototype.constructor=ln;function et(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=ie,this.__views__=[]}function C7(){var s=new et(this.__wrapped__);return s.__actions__=Mr(this.__actions__),s.__dir__=this.__dir__,s.__filtered__=this.__filtered__,s.__iteratees__=Mr(this.__iteratees__),s.__takeCount__=this.__takeCount__,s.__views__=Mr(this.__views__),s}function $7(){if(this.__filtered__){var s=new et(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function A7(){var s=this.__wrapped__.value(),o=this.__dir__,l=Le(s),p=o<0,v=l?s.length:0,S=z$(0,v,this.__views__),R=S.start,M=S.end,q=M-R,te=p?M:R-1,re=this.__iteratees__,oe=re.length,fe=0,ye=gr(q,this.__takeCount__);if(!l||!p&&v==q&&ye==q)return Av(s,this.__actions__);var Ie=[];e:for(;q--&&fe<ye;){te+=o;for(var We=-1,De=s[te];++We<oe;){var Qe=re[We],it=Qe.iteratee,Qr=Qe.type,Cr=it(De);if(Qr==N)De=Cr;else if(!Cr){if(Qr==D)continue e;break e}}Ie[fe++]=De}return Ie}et.prototype=fo(yl.prototype),et.prototype.constructor=et;function ps(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var p=s[o];this.set(p[0],p[1])}}function P7(){this.__data__=ba?ba(null):{},this.size=0}function T7(s){var o=this.has(s)&&delete this.__data__[s];return this.size-=o?1:0,o}function R7(s){var o=this.__data__;if(ba){var l=o[s];return l===f?t:l}return ft.call(o,s)?o[s]:t}function N7(s){var o=this.__data__;return ba?o[s]!==t:ft.call(o,s)}function L7(s,o){var l=this.__data__;return this.size+=this.has(s)?0:1,l[s]=ba&&o===t?f:o,this}ps.prototype.clear=P7,ps.prototype.delete=T7,ps.prototype.get=R7,ps.prototype.has=N7,ps.prototype.set=L7;function Jn(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var p=s[o];this.set(p[0],p[1])}}function M7(){this.__data__=[],this.size=0}function U7(s){var o=this.__data__,l=wl(o,s);if(l<0)return!1;var p=o.length-1;return l==p?o.pop():fl.call(o,l,1),--this.size,!0}function j7(s){var o=this.__data__,l=wl(o,s);return l<0?t:o[l][1]}function F7(s){return wl(this.__data__,s)>-1}function B7(s,o){var l=this.__data__,p=wl(l,s);return p<0?(++this.size,l.push([s,o])):l[p][1]=o,this}Jn.prototype.clear=M7,Jn.prototype.delete=U7,Jn.prototype.get=j7,Jn.prototype.has=F7,Jn.prototype.set=B7;function Qn(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var p=s[o];this.set(p[0],p[1])}}function k7(){this.size=0,this.__data__={hash:new ps,map:new(ya||Jn),string:new ps}}function z7(s){var o=Pl(this,s).delete(s);return this.size-=o?1:0,o}function q7(s){return Pl(this,s).get(s)}function H7(s){return Pl(this,s).has(s)}function W7(s,o){var l=Pl(this,s),p=l.size;return l.set(s,o),this.size+=l.size==p?0:1,this}Qn.prototype.clear=k7,Qn.prototype.delete=z7,Qn.prototype.get=q7,Qn.prototype.has=H7,Qn.prototype.set=W7;function gs(s){var o=-1,l=s==null?0:s.length;for(this.__data__=new Qn;++o<l;)this.add(s[o])}function K7(s){return this.__data__.set(s,f),this}function V7(s){return this.__data__.has(s)}gs.prototype.add=gs.prototype.push=K7,gs.prototype.has=V7;function bn(s){var o=this.__data__=new Jn(s);this.size=o.size}function G7(){this.__data__=new Jn,this.size=0}function Y7(s){var o=this.__data__,l=o.delete(s);return this.size=o.size,l}function Z7(s){return this.__data__.get(s)}function J7(s){return this.__data__.has(s)}function Q7(s,o){var l=this.__data__;if(l instanceof Jn){var p=l.__data__;if(!ya||p.length<i-1)return p.push([s,o]),this.size=++l.size,this;l=this.__data__=new Qn(p)}return l.set(s,o),this.size=l.size,this}bn.prototype.clear=G7,bn.prototype.delete=Y7,bn.prototype.get=Z7,bn.prototype.has=J7,bn.prototype.set=Q7;function av(s,o){var l=Le(s),p=!l&&bs(s),v=!l&&!p&&Ni(s),S=!l&&!p&&!v&&vo(s),R=l||p||v||S,M=R?Wf(s.length,c7):[],q=M.length;for(var te in s)(o||ft.call(s,te))&&!(R&&(te=="length"||v&&(te=="offset"||te=="parent")||S&&(te=="buffer"||te=="byteLength"||te=="byteOffset")||ri(te,q)))&&M.push(te);return M}function cv(s){var o=s.length;return o?s[cd(0,o-1)]:t}function X7(s,o){return Tl(Mr(s),ms(o,0,s.length))}function e$(s){return Tl(Mr(s))}function Qf(s,o,l){(l!==t&&!_n(s[o],l)||l===t&&!(o in s))&&Xn(s,o,l)}function Ea(s,o,l){var p=s[o];(!(ft.call(s,o)&&_n(p,l))||l===t&&!(o in s))&&Xn(s,o,l)}function wl(s,o){for(var l=s.length;l--;)if(_n(s[l][0],o))return l;return-1}function t$(s,o,l,p){return Ai(s,function(v,S,R){o(p,v,l(v),R)}),p}function lv(s,o){return s&&Nn(o,ar(o),s)}function r$(s,o){return s&&Nn(o,jr(o),s)}function Xn(s,o,l){o=="__proto__"&&dl?dl(s,o,{configurable:!0,enumerable:!0,value:l,writable:!0}):s[o]=l}function Xf(s,o){for(var l=-1,p=o.length,v=G(p),S=s==null;++l<p;)v[l]=S?t:Rd(s,o[l]);return v}function ms(s,o,l){return s===s&&(l!==t&&(s=s<=l?s:l),o!==t&&(s=s>=o?s:o)),s}function un(s,o,l,p,v,S){var R,M=o&w,q=o&y,te=o&b;if(l&&(R=v?l(s,p,v,S):l(s)),R!==t)return R;if(!Rt(s))return s;var re=Le(s);if(re){if(R=H$(s),!M)return Mr(s,R)}else{var oe=mr(s),fe=oe==le||oe==pe;if(Ni(s))return Rv(s,M);if(oe==ke||oe==de||fe&&!v){if(R=q||fe?{}:Qv(s),!M)return q?R$(s,r$(R,s)):T$(s,lv(R,s))}else{if(!gt[oe])return v?s:{};R=W$(s,oe,M)}}S||(S=new bn);var ye=S.get(s);if(ye)return ye;S.set(s,R),Oy(s)?s.forEach(function(De){R.add(un(De,o,l,De,s,S))}):Dy(s)&&s.forEach(function(De,Qe){R.set(Qe,un(De,o,l,Qe,s,S))});var Ie=te?q?wd:yd:q?jr:ar,We=re?t:Ie(s);return an(We||s,function(De,Qe){We&&(Qe=De,De=s[Qe]),Ea(R,Qe,un(De,o,l,Qe,s,S))}),R}function n$(s){var o=ar(s);return function(l){return uv(l,s,o)}}function uv(s,o,l){var p=l.length;if(s==null)return!p;for(s=wt(s);p--;){var v=l[p],S=o[v],R=s[v];if(R===t&&!(v in s)||!S(R))return!1}return!0}function hv(s,o,l){if(typeof s!="function")throw new cn(c);return $a(function(){s.apply(t,l)},o)}function xa(s,o,l,p){var v=-1,S=rl,R=!0,M=s.length,q=[],te=o.length;if(!M)return q;l&&(o=At(o,Yr(l))),p?(S=Ff,R=!1):o.length>=i&&(S=ma,R=!1,o=new gs(o));e:for(;++v<M;){var re=s[v],oe=l==null?re:l(re);if(re=p||re!==0?re:0,R&&oe===oe){for(var fe=te;fe--;)if(o[fe]===oe)continue e;q.push(re)}else S(o,oe,p)||q.push(re)}return q}var Ai=jv(Rn),fv=jv(td,!0);function i$(s,o){var l=!0;return Ai(s,function(p,v,S){return l=!!o(p,v,S),l}),l}function bl(s,o,l){for(var p=-1,v=s.length;++p<v;){var S=s[p],R=o(S);if(R!=null&&(M===t?R===R&&!Jr(R):l(R,M)))var M=R,q=S}return q}function s$(s,o,l,p){var v=s.length;for(l=ze(l),l<0&&(l=-l>v?0:v+l),p=p===t||p>v?v:ze(p),p<0&&(p+=v),p=l>p?0:$y(p);l<p;)s[l++]=o;return s}function dv(s,o){var l=[];return Ai(s,function(p,v,S){o(p,v,S)&&l.push(p)}),l}function hr(s,o,l,p,v){var S=-1,R=s.length;for(l||(l=V$),v||(v=[]);++S<R;){var M=s[S];o>0&&l(M)?o>1?hr(M,o-1,l,p,v):Oi(v,M):p||(v[v.length]=M)}return v}var ed=Fv(),pv=Fv(!0);function Rn(s,o){return s&&ed(s,o,ar)}function td(s,o){return s&&pv(s,o,ar)}function _l(s,o){return Si(o,function(l){return ni(s[l])})}function vs(s,o){o=Ti(o,s);for(var l=0,p=o.length;s!=null&&l<p;)s=s[Ln(o[l++])];return l&&l==p?s:t}function gv(s,o,l){var p=o(s);return Le(s)?p:Oi(p,l(s))}function Sr(s){return s==null?s===t?He:Ze:ds&&ds in wt(s)?k$(s):eA(s)}function rd(s,o){return s>o}function o$(s,o){return s!=null&&ft.call(s,o)}function a$(s,o){return s!=null&&o in wt(s)}function c$(s,o,l){return s>=gr(o,l)&&s<rr(o,l)}function nd(s,o,l){for(var p=l?Ff:rl,v=s[0].length,S=s.length,R=S,M=G(S),q=1/0,te=[];R--;){var re=s[R];R&&o&&(re=At(re,Yr(o))),q=gr(re.length,q),M[R]=!l&&(o||v>=120&&re.length>=120)?new gs(R&&re):t}re=s[0];var oe=-1,fe=M[0];e:for(;++oe<v&&te.length<q;){var ye=re[oe],Ie=o?o(ye):ye;if(ye=l||ye!==0?ye:0,!(fe?ma(fe,Ie):p(te,Ie,l))){for(R=S;--R;){var We=M[R];if(!(We?ma(We,Ie):p(s[R],Ie,l)))continue e}fe&&fe.push(Ie),te.push(ye)}}return te}function l$(s,o,l,p){return Rn(s,function(v,S,R){o(p,l(v),S,R)}),p}function Ia(s,o,l){o=Ti(o,s),s=ry(s,o);var p=s==null?s:s[Ln(fn(o))];return p==null?t:or(p,s,l)}function mv(s){return kt(s)&&Sr(s)==de}function u$(s){return kt(s)&&Sr(s)==Se}function h$(s){return kt(s)&&Sr(s)==B}function Da(s,o,l,p,v){return s===o?!0:s==null||o==null||!kt(s)&&!kt(o)?s!==s&&o!==o:f$(s,o,l,p,Da,v)}function f$(s,o,l,p,v,S){var R=Le(s),M=Le(o),q=R?be:mr(s),te=M?be:mr(o);q=q==de?ke:q,te=te==de?ke:te;var re=q==ke,oe=te==ke,fe=q==te;if(fe&&Ni(s)){if(!Ni(o))return!1;R=!0,re=!1}if(fe&&!re)return S||(S=new bn),R||vo(s)?Yv(s,o,l,p,v,S):F$(s,o,q,l,p,v,S);if(!(l&I)){var ye=re&&ft.call(s,"__wrapped__"),Ie=oe&&ft.call(o,"__wrapped__");if(ye||Ie){var We=ye?s.value():s,De=Ie?o.value():o;return S||(S=new bn),v(We,De,l,p,S)}}return fe?(S||(S=new bn),B$(s,o,l,p,v,S)):!1}function d$(s){return kt(s)&&mr(s)==Oe}function id(s,o,l,p){var v=l.length,S=v,R=!p;if(s==null)return!S;for(s=wt(s);v--;){var M=l[v];if(R&&M[2]?M[1]!==s[M[0]]:!(M[0]in s))return!1}for(;++v<S;){M=l[v];var q=M[0],te=s[q],re=M[1];if(R&&M[2]){if(te===t&&!(q in s))return!1}else{var oe=new bn;if(p)var fe=p(te,re,q,s,o,oe);if(!(fe===t?Da(re,te,I|A,p,oe):fe))return!1}}return!0}function vv(s){if(!Rt(s)||Y$(s))return!1;var o=ni(s)?d7:xf;return o.test(ws(s))}function p$(s){return kt(s)&&Sr(s)==qe}function g$(s){return kt(s)&&mr(s)==Ce}function m$(s){return kt(s)&&jl(s.length)&&!!mt[Sr(s)]}function yv(s){return typeof s=="function"?s:s==null?Fr:typeof s=="object"?Le(s)?_v(s[0],s[1]):bv(s):By(s)}function sd(s){if(!Ca(s))return w7(s);var o=[];for(var l in wt(s))ft.call(s,l)&&l!="constructor"&&o.push(l);return o}function v$(s){if(!Rt(s))return X$(s);var o=Ca(s),l=[];for(var p in s)p=="constructor"&&(o||!ft.call(s,p))||l.push(p);return l}function od(s,o){return s<o}function wv(s,o){var l=-1,p=Ur(s)?G(s.length):[];return Ai(s,function(v,S,R){p[++l]=o(v,S,R)}),p}function bv(s){var o=_d(s);return o.length==1&&o[0][2]?ey(o[0][0],o[0][1]):function(l){return l===s||id(l,s,o)}}function _v(s,o){return xd(s)&&Xv(o)?ey(Ln(s),o):function(l){var p=Rd(l,s);return p===t&&p===o?Nd(l,s):Da(o,p,I|A)}}function El(s,o,l,p,v){s!==o&&ed(o,function(S,R){if(v||(v=new bn),Rt(S))y$(s,o,R,l,El,p,v);else{var M=p?p(Dd(s,R),S,R+"",s,o,v):t;M===t&&(M=S),Qf(s,R,M)}},jr)}function y$(s,o,l,p,v,S,R){var M=Dd(s,l),q=Dd(o,l),te=R.get(q);if(te){Qf(s,l,te);return}var re=S?S(M,q,l+"",s,o,R):t,oe=re===t;if(oe){var fe=Le(q),ye=!fe&&Ni(q),Ie=!fe&&!ye&&vo(q);re=q,fe||ye||Ie?Le(M)?re=M:Wt(M)?re=Mr(M):ye?(oe=!1,re=Rv(q,!0)):Ie?(oe=!1,re=Nv(q,!0)):re=[]:Aa(q)||bs(q)?(re=M,bs(M)?re=Ay(M):(!Rt(M)||ni(M))&&(re=Qv(q))):oe=!1}oe&&(R.set(q,re),v(re,q,p,S,R),R.delete(q)),Qf(s,l,re)}function Ev(s,o){var l=s.length;if(l)return o+=o<0?l:0,ri(o,l)?s[o]:t}function xv(s,o,l){o.length?o=At(o,function(S){return Le(S)?function(R){return vs(R,S.length===1?S[0]:S)}:S}):o=[Fr];var p=-1;o=At(o,Yr(_e()));var v=wv(s,function(S,R,M){var q=At(o,function(te){return te(S)});return{criteria:q,index:++p,value:S}});return WC(v,function(S,R){return P$(S,R,l)})}function w$(s,o){return Iv(s,o,function(l,p){return Nd(s,p)})}function Iv(s,o,l){for(var p=-1,v=o.length,S={};++p<v;){var R=o[p],M=vs(s,R);l(M,R)&&Sa(S,Ti(R,s),M)}return S}function b$(s){return function(o){return vs(o,s)}}function ad(s,o,l,p){var v=p?HC:so,S=-1,R=o.length,M=s;for(s===o&&(o=Mr(o)),l&&(M=At(s,Yr(l)));++S<R;)for(var q=0,te=o[S],re=l?l(te):te;(q=v(M,re,q,p))>-1;)M!==s&&fl.call(M,q,1),fl.call(s,q,1);return s}function Dv(s,o){for(var l=s?o.length:0,p=l-1;l--;){var v=o[l];if(l==p||v!==S){var S=v;ri(v)?fl.call(s,v,1):hd(s,v)}}return s}function cd(s,o){return s+gl(sv()*(o-s+1))}function _$(s,o,l,p){for(var v=-1,S=rr(pl((o-s)/(l||1)),0),R=G(S);S--;)R[p?S:++v]=s,s+=l;return R}function ld(s,o){var l="";if(!s||o<1||o>Y)return l;do o%2&&(l+=s),o=gl(o/2),o&&(s+=s);while(o);return l}function Ge(s,o){return Sd(ty(s,o,Fr),s+"")}function E$(s){return cv(yo(s))}function x$(s,o){var l=yo(s);return Tl(l,ms(o,0,l.length))}function Sa(s,o,l,p){if(!Rt(s))return s;o=Ti(o,s);for(var v=-1,S=o.length,R=S-1,M=s;M!=null&&++v<S;){var q=Ln(o[v]),te=l;if(q==="__proto__"||q==="constructor"||q==="prototype")return s;if(v!=R){var re=M[q];te=p?p(re,q,M):t,te===t&&(te=Rt(re)?re:ri(o[v+1])?[]:{})}Ea(M,q,te),M=M[q]}return s}var Sv=ml?function(s,o){return ml.set(s,o),s}:Fr,I$=dl?function(s,o){return dl(s,"toString",{configurable:!0,enumerable:!1,value:Md(o),writable:!0})}:Fr;function D$(s){return Tl(yo(s))}function hn(s,o,l){var p=-1,v=s.length;o<0&&(o=-o>v?0:v+o),l=l>v?v:l,l<0&&(l+=v),v=o>l?0:l-o>>>0,o>>>=0;for(var S=G(v);++p<v;)S[p]=s[p+o];return S}function S$(s,o){var l;return Ai(s,function(p,v,S){return l=o(p,v,S),!l}),!!l}function xl(s,o,l){var p=0,v=s==null?p:s.length;if(typeof o=="number"&&o===o&&v<=ae){for(;p<v;){var S=p+v>>>1,R=s[S];R!==null&&!Jr(R)&&(l?R<=o:R<o)?p=S+1:v=S}return v}return ud(s,o,Fr,l)}function ud(s,o,l,p){var v=0,S=s==null?0:s.length;if(S===0)return 0;o=l(o);for(var R=o!==o,M=o===null,q=Jr(o),te=o===t;v<S;){var re=gl((v+S)/2),oe=l(s[re]),fe=oe!==t,ye=oe===null,Ie=oe===oe,We=Jr(oe);if(R)var De=p||Ie;else te?De=Ie&&(p||fe):M?De=Ie&&fe&&(p||!ye):q?De=Ie&&fe&&!ye&&(p||!We):ye||We?De=!1:De=p?oe<=o:oe<o;De?v=re+1:S=re}return gr(S,Ee)}function Ov(s,o){for(var l=-1,p=s.length,v=0,S=[];++l<p;){var R=s[l],M=o?o(R):R;if(!l||!_n(M,q)){var q=M;S[v++]=R===0?0:R}}return S}function Cv(s){return typeof s=="number"?s:Jr(s)?Q:+s}function Zr(s){if(typeof s=="string")return s;if(Le(s))return At(s,Zr)+"";if(Jr(s))return ov?ov.call(s):"";var o=s+"";return o=="0"&&1/s==-ee?"-0":o}function Pi(s,o,l){var p=-1,v=rl,S=s.length,R=!0,M=[],q=M;if(l)R=!1,v=Ff;else if(S>=i){var te=o?null:U$(s);if(te)return il(te);R=!1,v=ma,q=new gs}else q=o?[]:M;e:for(;++p<S;){var re=s[p],oe=o?o(re):re;if(re=l||re!==0?re:0,R&&oe===oe){for(var fe=q.length;fe--;)if(q[fe]===oe)continue e;o&&q.push(oe),M.push(re)}else v(q,oe,l)||(q!==M&&q.push(oe),M.push(re))}return M}function hd(s,o){return o=Ti(o,s),s=ry(s,o),s==null||delete s[Ln(fn(o))]}function $v(s,o,l,p){return Sa(s,o,l(vs(s,o)),p)}function Il(s,o,l,p){for(var v=s.length,S=p?v:-1;(p?S--:++S<v)&&o(s[S],S,s););return l?hn(s,p?0:S,p?S+1:v):hn(s,p?S+1:0,p?v:S)}function Av(s,o){var l=s;return l instanceof et&&(l=l.value()),Bf(o,function(p,v){return v.func.apply(v.thisArg,Oi([p],v.args))},l)}function fd(s,o,l){var p=s.length;if(p<2)return p?Pi(s[0]):[];for(var v=-1,S=G(p);++v<p;)for(var R=s[v],M=-1;++M<p;)M!=v&&(S[v]=xa(S[v]||R,s[M],o,l));return Pi(hr(S,1),o,l)}function Pv(s,o,l){for(var p=-1,v=s.length,S=o.length,R={};++p<v;){var M=p<S?o[p]:t;l(R,s[p],M)}return R}function dd(s){return Wt(s)?s:[]}function pd(s){return typeof s=="function"?s:Fr}function Ti(s,o){return Le(s)?s:xd(s,o)?[s]:oy(ht(s))}var O$=Ge;function Ri(s,o,l){var p=s.length;return l=l===t?p:l,!o&&l>=p?s:hn(s,o,l)}var Tv=p7||function(s){return nt.clearTimeout(s)};function Rv(s,o){if(o)return s.slice();var l=s.length,p=ev?ev(l):new s.constructor(l);return s.copy(p),p}function gd(s){var o=new s.constructor(s.byteLength);return new ul(o).set(new ul(s)),o}function C$(s,o){var l=o?gd(s.buffer):s.buffer;return new s.constructor(l,s.byteOffset,s.byteLength)}function $$(s){var o=new s.constructor(s.source,sn.exec(s));return o.lastIndex=s.lastIndex,o}function A$(s){return _a?wt(_a.call(s)):{}}function Nv(s,o){var l=o?gd(s.buffer):s.buffer;return new s.constructor(l,s.byteOffset,s.length)}function Lv(s,o){if(s!==o){var l=s!==t,p=s===null,v=s===s,S=Jr(s),R=o!==t,M=o===null,q=o===o,te=Jr(o);if(!M&&!te&&!S&&s>o||S&&R&&q&&!M&&!te||p&&R&&q||!l&&q||!v)return 1;if(!p&&!S&&!te&&s<o||te&&l&&v&&!p&&!S||M&&l&&v||!R&&v||!q)return-1}return 0}function P$(s,o,l){for(var p=-1,v=s.criteria,S=o.criteria,R=v.length,M=l.length;++p<R;){var q=Lv(v[p],S[p]);if(q){if(p>=M)return q;var te=l[p];return q*(te=="desc"?-1:1)}}return s.index-o.index}function Mv(s,o,l,p){for(var v=-1,S=s.length,R=l.length,M=-1,q=o.length,te=rr(S-R,0),re=G(q+te),oe=!p;++M<q;)re[M]=o[M];for(;++v<R;)(oe||v<S)&&(re[l[v]]=s[v]);for(;te--;)re[M++]=s[v++];return re}function Uv(s,o,l,p){for(var v=-1,S=s.length,R=-1,M=l.length,q=-1,te=o.length,re=rr(S-M,0),oe=G(re+te),fe=!p;++v<re;)oe[v]=s[v];for(var ye=v;++q<te;)oe[ye+q]=o[q];for(;++R<M;)(fe||v<S)&&(oe[ye+l[R]]=s[v++]);return oe}function Mr(s,o){var l=-1,p=s.length;for(o||(o=G(p));++l<p;)o[l]=s[l];return o}function Nn(s,o,l,p){var v=!l;l||(l={});for(var S=-1,R=o.length;++S<R;){var M=o[S],q=p?p(l[M],s[M],M,l,s):t;q===t&&(q=s[M]),v?Xn(l,M,q):Ea(l,M,q)}return l}function T$(s,o){return Nn(s,Ed(s),o)}function R$(s,o){return Nn(s,Zv(s),o)}function Dl(s,o){return function(l,p){var v=Le(l)?jC:t$,S=o?o():{};return v(l,s,_e(p,2),S)}}function po(s){return Ge(function(o,l){var p=-1,v=l.length,S=v>1?l[v-1]:t,R=v>2?l[2]:t;for(S=s.length>3&&typeof S=="function"?(v--,S):t,R&&Or(l[0],l[1],R)&&(S=v<3?t:S,v=1),o=wt(o);++p<v;){var M=l[p];M&&s(o,M,p,S)}return o})}function jv(s,o){return function(l,p){if(l==null)return l;if(!Ur(l))return s(l,p);for(var v=l.length,S=o?v:-1,R=wt(l);(o?S--:++S<v)&&p(R[S],S,R)!==!1;);return l}}function Fv(s){return function(o,l,p){for(var v=-1,S=wt(o),R=p(o),M=R.length;M--;){var q=R[s?M:++v];if(l(S[q],q,S)===!1)break}return o}}function N$(s,o,l){var p=o&U,v=Oa(s);function S(){var R=this&&this!==nt&&this instanceof S?v:s;return R.apply(p?l:this,arguments)}return S}function Bv(s){return function(o){o=ht(o);var l=oo(o)?wn(o):t,p=l?l[0]:o.charAt(0),v=l?Ri(l,1).join(""):o.slice(1);return p[s]()+v}}function go(s){return function(o){return Bf(jy(Uy(o).replace(pa,"")),s,"")}}function Oa(s){return function(){var o=arguments;switch(o.length){case 0:return new s;case 1:return new s(o[0]);case 2:return new s(o[0],o[1]);case 3:return new s(o[0],o[1],o[2]);case 4:return new s(o[0],o[1],o[2],o[3]);case 5:return new s(o[0],o[1],o[2],o[3],o[4]);case 6:return new s(o[0],o[1],o[2],o[3],o[4],o[5]);case 7:return new s(o[0],o[1],o[2],o[3],o[4],o[5],o[6])}var l=fo(s.prototype),p=s.apply(l,o);return Rt(p)?p:l}}function L$(s,o,l){var p=Oa(s);function v(){for(var S=arguments.length,R=G(S),M=S,q=mo(v);M--;)R[M]=arguments[M];var te=S<3&&R[0]!==q&&R[S-1]!==q?[]:Ci(R,q);if(S-=te.length,S<l)return Wv(s,o,Sl,v.placeholder,t,R,te,t,t,l-S);var re=this&&this!==nt&&this instanceof v?p:s;return or(re,this,R)}return v}function kv(s){return function(o,l,p){var v=wt(o);if(!Ur(o)){var S=_e(l,3);o=ar(o),l=function(M){return S(v[M],M,v)}}var R=s(o,l,p);return R>-1?v[S?o[R]:R]:t}}function zv(s){return ti(function(o){var l=o.length,p=l,v=ln.prototype.thru;for(s&&o.reverse();p--;){var S=o[p];if(typeof S!="function")throw new cn(c);if(v&&!R&&Al(S)=="wrapper")var R=new ln([],!0)}for(p=R?p:l;++p<l;){S=o[p];var M=Al(S),q=M=="wrapper"?bd(S):t;q&&Id(q[0])&&q[1]==(d|T|P|_)&&!q[4].length&&q[9]==1?R=R[Al(q[0])].apply(R,q[3]):R=S.length==1&&Id(S)?R[M]():R.thru(S)}return function(){var te=arguments,re=te[0];if(R&&te.length==1&&Le(re))return R.plant(re).value();for(var oe=0,fe=l?o[oe].apply(this,te):re;++oe<l;)fe=o[oe].call(this,fe);return fe}})}function Sl(s,o,l,p,v,S,R,M,q,te){var re=o&d,oe=o&U,fe=o&j,ye=o&(T|O),Ie=o&H,We=fe?t:Oa(s);function De(){for(var Qe=arguments.length,it=G(Qe),Qr=Qe;Qr--;)it[Qr]=arguments[Qr];if(ye)var Cr=mo(De),Xr=VC(it,Cr);if(p&&(it=Mv(it,p,v,ye)),S&&(it=Uv(it,S,R,ye)),Qe-=Xr,ye&&Qe<te){var Kt=Ci(it,Cr);return Wv(s,o,Sl,De.placeholder,l,it,Kt,M,q,te-Qe)}var En=oe?l:this,si=fe?En[s]:s;return Qe=it.length,M?it=tA(it,M):Ie&&Qe>1&&it.reverse(),re&&q<Qe&&(it.length=q),this&&this!==nt&&this instanceof De&&(si=We||Oa(si)),si.apply(En,it)}return De}function qv(s,o){return function(l,p){return l$(l,s,o(p),{})}}function Ol(s,o){return function(l,p){var v;if(l===t&&p===t)return o;if(l!==t&&(v=l),p!==t){if(v===t)return p;typeof l=="string"||typeof p=="string"?(l=Zr(l),p=Zr(p)):(l=Cv(l),p=Cv(p)),v=s(l,p)}return v}}function md(s){return ti(function(o){return o=At(o,Yr(_e())),Ge(function(l){var p=this;return s(o,function(v){return or(v,p,l)})})})}function Cl(s,o){o=o===t?" ":Zr(o);var l=o.length;if(l<2)return l?ld(o,s):o;var p=ld(o,pl(s/ao(o)));return oo(o)?Ri(wn(p),0,s).join(""):p.slice(0,s)}function M$(s,o,l,p){var v=o&U,S=Oa(s);function R(){for(var M=-1,q=arguments.length,te=-1,re=p.length,oe=G(re+q),fe=this&&this!==nt&&this instanceof R?S:s;++te<re;)oe[te]=p[te];for(;q--;)oe[te++]=arguments[++M];return or(fe,v?l:this,oe)}return R}function Hv(s){return function(o,l,p){return p&&typeof p!="number"&&Or(o,l,p)&&(l=p=t),o=ii(o),l===t?(l=o,o=0):l=ii(l),p=p===t?o<l?1:-1:ii(p),_$(o,l,p,s)}}function $l(s){return function(o,l){return typeof o=="string"&&typeof l=="string"||(o=dn(o),l=dn(l)),s(o,l)}}function Wv(s,o,l,p,v,S,R,M,q,te){var re=o&T,oe=re?R:t,fe=re?t:R,ye=re?S:t,Ie=re?t:S;o|=re?P:x,o&=~(re?x:P),o&$||(o&=~(U|j));var We=[s,o,v,ye,oe,Ie,fe,M,q,te],De=l.apply(t,We);return Id(s)&&ny(De,We),De.placeholder=p,iy(De,s,o)}function vd(s){var o=tr[s];return function(l,p){if(l=dn(l),p=p==null?0:gr(ze(p),292),p&&iv(l)){var v=(ht(l)+"e").split("e"),S=o(v[0]+"e"+(+v[1]+p));return v=(ht(S)+"e").split("e"),+(v[0]+"e"+(+v[1]-p))}return o(l)}}var U$=uo&&1/il(new uo([,-0]))[1]==ee?function(s){return new uo(s)}:Fd;function Kv(s){return function(o){var l=mr(o);return l==Oe?Vf(o):l==Ce?e7(o):KC(o,s(o))}}function ei(s,o,l,p,v,S,R,M){var q=o&j;if(!q&&typeof s!="function")throw new cn(c);var te=p?p.length:0;if(te||(o&=~(P|x),p=v=t),R=R===t?R:rr(ze(R),0),M=M===t?M:ze(M),te-=v?v.length:0,o&x){var re=p,oe=v;p=v=t}var fe=q?t:bd(s),ye=[s,o,l,p,v,re,oe,S,R,M];if(fe&&Q$(ye,fe),s=ye[0],o=ye[1],l=ye[2],p=ye[3],v=ye[4],M=ye[9]=ye[9]===t?q?0:s.length:rr(ye[9]-te,0),!M&&o&(T|O)&&(o&=~(T|O)),!o||o==U)var Ie=N$(s,o,l);else o==T||o==O?Ie=L$(s,o,M):(o==P||o==(U|P))&&!v.length?Ie=M$(s,o,l,p):Ie=Sl.apply(t,ye);var We=fe?Sv:ny;return iy(We(Ie,ye),s,o)}function Vv(s,o,l,p){return s===t||_n(s,lo[l])&&!ft.call(p,l)?o:s}function Gv(s,o,l,p,v,S){return Rt(s)&&Rt(o)&&(S.set(o,s),El(s,o,t,Gv,S),S.delete(o)),s}function j$(s){return Aa(s)?t:s}function Yv(s,o,l,p,v,S){var R=l&I,M=s.length,q=o.length;if(M!=q&&!(R&&q>M))return!1;var te=S.get(s),re=S.get(o);if(te&&re)return te==o&&re==s;var oe=-1,fe=!0,ye=l&A?new gs:t;for(S.set(s,o),S.set(o,s);++oe<M;){var Ie=s[oe],We=o[oe];if(p)var De=R?p(We,Ie,oe,o,s,S):p(Ie,We,oe,s,o,S);if(De!==t){if(De)continue;fe=!1;break}if(ye){if(!kf(o,function(Qe,it){if(!ma(ye,it)&&(Ie===Qe||v(Ie,Qe,l,p,S)))return ye.push(it)})){fe=!1;break}}else if(!(Ie===We||v(Ie,We,l,p,S))){fe=!1;break}}return S.delete(s),S.delete(o),fe}function F$(s,o,l,p,v,S,R){switch(l){case Te:if(s.byteLength!=o.byteLength||s.byteOffset!=o.byteOffset)return!1;s=s.buffer,o=o.buffer;case Se:return!(s.byteLength!=o.byteLength||!S(new ul(s),new ul(o)));case W:case B:case Ke:return _n(+s,+o);case L:return s.name==o.name&&s.message==o.message;case qe:case Ue:return s==o+"";case Oe:var M=Vf;case Ce:var q=p&I;if(M||(M=il),s.size!=o.size&&!q)return!1;var te=R.get(s);if(te)return te==o;p|=A,R.set(s,o);var re=Yv(M(s),M(o),p,v,S,R);return R.delete(s),re;case je:if(_a)return _a.call(s)==_a.call(o)}return!1}function B$(s,o,l,p,v,S){var R=l&I,M=yd(s),q=M.length,te=yd(o),re=te.length;if(q!=re&&!R)return!1;for(var oe=q;oe--;){var fe=M[oe];if(!(R?fe in o:ft.call(o,fe)))return!1}var ye=S.get(s),Ie=S.get(o);if(ye&&Ie)return ye==o&&Ie==s;var We=!0;S.set(s,o),S.set(o,s);for(var De=R;++oe<q;){fe=M[oe];var Qe=s[fe],it=o[fe];if(p)var Qr=R?p(it,Qe,fe,o,s,S):p(Qe,it,fe,s,o,S);if(!(Qr===t?Qe===it||v(Qe,it,l,p,S):Qr)){We=!1;break}De||(De=fe=="constructor")}if(We&&!De){var Cr=s.constructor,Xr=o.constructor;Cr!=Xr&&"constructor"in s&&"constructor"in o&&!(typeof Cr=="function"&&Cr instanceof Cr&&typeof Xr=="function"&&Xr instanceof Xr)&&(We=!1)}return S.delete(s),S.delete(o),We}function ti(s){return Sd(ty(s,t,uy),s+"")}function yd(s){return gv(s,ar,Ed)}function wd(s){return gv(s,jr,Zv)}var bd=ml?function(s){return ml.get(s)}:Fd;function Al(s){for(var o=s.name+"",l=ho[o],p=ft.call(ho,o)?l.length:0;p--;){var v=l[p],S=v.func;if(S==null||S==s)return v.name}return o}function mo(s){var o=ft.call(E,"placeholder")?E:s;return o.placeholder}function _e(){var s=E.iteratee||Ud;return s=s===Ud?yv:s,arguments.length?s(arguments[0],arguments[1]):s}function Pl(s,o){var l=s.__data__;return G$(o)?l[typeof o=="string"?"string":"hash"]:l.map}function _d(s){for(var o=ar(s),l=o.length;l--;){var p=o[l],v=s[p];o[l]=[p,v,Xv(v)]}return o}function ys(s,o){var l=JC(s,o);return vv(l)?l:t}function k$(s){var o=ft.call(s,ds),l=s[ds];try{s[ds]=t;var p=!0}catch{}var v=cl.call(s);return p&&(o?s[ds]=l:delete s[ds]),v}var Ed=Yf?function(s){return s==null?[]:(s=wt(s),Si(Yf(s),function(o){return rv.call(s,o)}))}:Bd,Zv=Yf?function(s){for(var o=[];s;)Oi(o,Ed(s)),s=hl(s);return o}:Bd,mr=Sr;(Zf&&mr(new Zf(new ArrayBuffer(1)))!=Te||ya&&mr(new ya)!=Oe||Jf&&mr(Jf.resolve())!=St||uo&&mr(new uo)!=Ce||wa&&mr(new wa)!=Ae)&&(mr=function(s){var o=Sr(s),l=o==ke?s.constructor:t,p=l?ws(l):"";if(p)switch(p){case x7:return Te;case I7:return Oe;case D7:return St;case S7:return Ce;case O7:return Ae}return o});function z$(s,o,l){for(var p=-1,v=l.length;++p<v;){var S=l[p],R=S.size;switch(S.type){case"drop":s+=R;break;case"dropRight":o-=R;break;case"take":o=gr(o,s+R);break;case"takeRight":s=rr(s,o-R);break}}return{start:s,end:o}}function q$(s){var o=s.match(_t);return o?o[1].split(Zt):[]}function Jv(s,o,l){o=Ti(o,s);for(var p=-1,v=o.length,S=!1;++p<v;){var R=Ln(o[p]);if(!(S=s!=null&&l(s,R)))break;s=s[R]}return S||++p!=v?S:(v=s==null?0:s.length,!!v&&jl(v)&&ri(R,v)&&(Le(s)||bs(s)))}function H$(s){var o=s.length,l=new s.constructor(o);return o&&typeof s[0]=="string"&&ft.call(s,"index")&&(l.index=s.index,l.input=s.input),l}function Qv(s){return typeof s.constructor=="function"&&!Ca(s)?fo(hl(s)):{}}function W$(s,o,l){var p=s.constructor;switch(o){case Se:return gd(s);case W:case B:return new p(+s);case Te:return C$(s,l);case Ve:case $e:case Je:case Xe:case ot:case at:case rt:case xr:case Nr:return Nv(s,l);case Oe:return new p;case Ke:case Ue:return new p(s);case qe:return $$(s);case Ce:return new p;case je:return A$(s)}}function K$(s,o){var l=o.length;if(!l)return s;var p=l-1;return o[p]=(l>1?"& ":"")+o[p],o=o.join(l>2?", ":" "),s.replace(Bt,`{
|
|
67
67
|
/* [wrapped with `+o+`] */
|
|
68
|
-
`)}function w$(s){return Le(s)||gs(s)||!!(zm&&s&&s[zm])}function Xn(s,o){var l=typeof s;return o=o??Y,!!o&&(l=="number"||l!="symbol"&&mf.test(s))&&s>-1&&s%1==0&&s<o}function Ar(s,o,l){if(!Rt(l))return!1;var p=typeof o;return(p=="number"?Br(l)&&Xn(o,l.length):p=="string"&&o in l)?wn(l[o],s):!1}function pd(s,o){if(Le(s))return!1;var l=typeof s;return l=="number"||l=="symbol"||l=="boolean"||s==null||Zr(s)?!0:Gt.test(s)||!$t.test(s)||o!=null&&s in wt(o)}function b$(s){var o=typeof s;return o=="string"||o=="number"||o=="symbol"||o=="boolean"?s!=="__proto__":s===null}function gd(s){var o=bl(s),l=_[o];if(typeof l!="function"||!(o in tt.prototype))return!1;if(s===l)return!0;var p=hd(l);return!!p&&s===p[0]}function _$(s){return!!Fm&&Fm in s}var E$=Jc?ei:Td;function wa(s){var o=s&&s.constructor,l=typeof o=="function"&&o.prototype||no;return s===l}function Fv(s){return s===s&&!Rt(s)}function Bv(s,o){return function(l){return l==null?!1:l[s]===o&&(o!==t||s in wt(l))}}function x$(s){var o=Sl(s,function(p){return l.size===h&&l.clear(),p}),l=o.cache;return o}function I$(s,o){var l=s[1],p=o[1],v=l|p,D=v<(U|j|d),R=p==d&&l==T||p==d&&l==b&&s[7].length<=o[8]||p==(d|b)&&o[7].length<=o[8]&&l==T;if(!(D||R))return s;p&U&&(s[2]=o[2],v|=l&U?0:A);var M=o[3];if(M){var z=s[3];s[3]=z?Ev(z,M,o[4]):M,s[4]=z?Ii(s[3],m):o[4]}return M=o[5],M&&(z=s[5],s[5]=z?xv(z,M,o[6]):M,s[6]=z?Ii(s[5],m):o[6]),M=o[7],M&&(s[7]=M),p&d&&(s[8]=s[8]==null?o[8]:mr(s[8],o[8])),s[9]==null&&(s[9]=o[9]),s[0]=o[0],s[1]=v,s}function D$(s){var o=[];if(s!=null)for(var l in wt(s))o.push(l);return o}function S$(s){return Qc.call(s)}function kv(s,o,l){return o=nr(o===t?s.length-1:o,0),function(){for(var p=arguments,v=-1,D=nr(p.length-o,0),R=G(D);++v<D;)R[v]=p[o+v];v=-1;for(var M=G(o+1);++v<o;)M[v]=p[v];return M[o]=l(R),ar(s,this,M)}}function qv(s,o){return o.length<2?s:fs(s,ln(o,0,-1))}function C$(s,o){for(var l=s.length,p=mr(o.length,l),v=Fr(s);p--;){var D=o[p];s[p]=Xn(D,l)?v[D]:t}return s}function md(s,o){if(!(o==="constructor"&&typeof s[o]=="function")&&o!="__proto__")return s[o]}var zv=Wv(fv),ba=qO||function(s,o){return it.setTimeout(s,o)},vd=Wv(J7);function Hv(s,o,l){var p=o+"";return vd(s,y$(p,O$(g$(p),l)))}function Wv(s){var o=0,l=0;return function(){var p=KO(),v=ce-(p-l);if(l=p,v>0){if(++o>=se)return arguments[0]}else o=0;return s.apply(t,arguments)}}function El(s,o){var l=-1,p=s.length,v=p-1;for(o=o===t?p:o;++l<o;){var D=Xf(l,v),R=s[D];s[D]=s[l],s[l]=R}return s.length=o,s}var Kv=x$(function(s){var o=[];return s.charCodeAt(0)===46&&o.push(""),s.replace(Yt,function(l,p,v,D){o.push(v?D.replace(uf,"$1"):p||l)}),o});function Rn(s){if(typeof s=="string"||Zr(s))return s;var o=s+"";return o=="0"&&1/s==-ee?"-0":o}function ps(s){if(s!=null){try{return Zc.call(s)}catch{}try{return s+""}catch{}}return""}function O$(s,o){return sn(xe,function(l){var p="_."+l[0];o&l[1]&&!Kc(s,p)&&s.push(p)}),s.sort()}function Vv(s){if(s instanceof tt)return s.clone();var o=new an(s.__wrapped__,s.__chain__);return o.__actions__=Fr(s.__actions__),o.__index__=s.__index__,o.__values__=s.__values__,o}function $$(s,o,l){(l?Ar(s,o,l):o===t)?o=1:o=nr(qe(o),0);var p=s==null?0:s.length;if(!p||o<1)return[];for(var v=0,D=0,R=G(il(p/o));v<p;)R[D++]=ln(s,v,v+=o);return R}function A$(s){for(var o=-1,l=s==null?0:s.length,p=0,v=[];++o<l;){var D=s[o];D&&(v[p++]=D)}return v}function P$(){var s=arguments.length;if(!s)return[];for(var o=G(s-1),l=arguments[0],p=s;p--;)o[p-1]=arguments[p];return xi(Le(l)?Fr(l):[l],fr(o,1))}var T$=Ge(function(s,o){return Kt(s)?pa(s,fr(o,1,Kt,!0)):[]}),R$=Ge(function(s,o){var l=un(o);return Kt(l)&&(l=t),Kt(s)?pa(s,fr(o,1,Kt,!0),_e(l,2)):[]}),N$=Ge(function(s,o){var l=un(o);return Kt(l)&&(l=t),Kt(s)?pa(s,fr(o,1,Kt,!0),t,l):[]});function L$(s,o,l){var p=s==null?0:s.length;return p?(o=l||o===t?1:qe(o),ln(s,o<0?0:o,p)):[]}function M$(s,o,l){var p=s==null?0:s.length;return p?(o=l||o===t?1:qe(o),o=p-o,ln(s,0,o<0?0:o)):[]}function U$(s,o){return s&&s.length?pl(s,_e(o,3),!0,!0):[]}function j$(s,o){return s&&s.length?pl(s,_e(o,3),!0):[]}function F$(s,o,l,p){var v=s==null?0:s.length;return v?(l&&typeof l!="number"&&Ar(s,o,l)&&(l=0,p=v),P7(s,o,l,p)):[]}function Gv(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=l==null?0:qe(l);return v<0&&(v=nr(p+v,0)),Vc(s,_e(o,3),v)}function Yv(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=p-1;return l!==t&&(v=qe(l),v=l<0?nr(p+v,0):mr(v,p-1)),Vc(s,_e(o,3),v,!0)}function Jv(s){var o=s==null?0:s.length;return o?fr(s,1):[]}function B$(s){var o=s==null?0:s.length;return o?fr(s,ee):[]}function k$(s,o){var l=s==null?0:s.length;return l?(o=o===t?1:qe(o),fr(s,o)):[]}function q$(s){for(var o=-1,l=s==null?0:s.length,p={};++o<l;){var v=s[o];p[v[0]]=v[1]}return p}function Zv(s){return s&&s.length?s[0]:t}function z$(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=l==null?0:qe(l);return v<0&&(v=nr(p+v,0)),Xs(s,o,v)}function H$(s){var o=s==null?0:s.length;return o?ln(s,0,-1):[]}var W$=Ge(function(s){var o=At(s,id);return o.length&&o[0]===s[0]?Gf(o):[]}),K$=Ge(function(s){var o=un(s),l=At(s,id);return o===un(l)?o=t:l.pop(),l.length&&l[0]===s[0]?Gf(l,_e(o,2)):[]}),V$=Ge(function(s){var o=un(s),l=At(s,id);return o=typeof o=="function"?o:t,o&&l.pop(),l.length&&l[0]===s[0]?Gf(l,t,o):[]});function G$(s,o){return s==null?"":HO.call(s,o)}function un(s){var o=s==null?0:s.length;return o?s[o-1]:t}function Y$(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=p;return l!==t&&(v=qe(l),v=v<0?nr(p+v,0):mr(v,p-1)),o===o?OO(s,o,v):Vc(s,Pm,v,!0)}function J$(s,o){return s&&s.length?cv(s,qe(o)):t}var Z$=Ge(Qv);function Qv(s,o){return s&&s.length&&o&&o.length?Qf(s,o):s}function Q$(s,o,l){return s&&s.length&&o&&o.length?Qf(s,o,_e(l,2)):s}function X$(s,o,l){return s&&s.length&&o&&o.length?Qf(s,o,t,l):s}var eA=Qn(function(s,o){var l=s==null?0:s.length,p=Hf(s,o);return hv(s,At(o,function(v){return Xn(v,l)?+v:v}).sort(_v)),p});function tA(s,o){var l=[];if(!(s&&s.length))return l;var p=-1,v=[],D=s.length;for(o=_e(o,3);++p<D;){var R=s[p];o(R,p,s)&&(l.push(R),v.push(p))}return hv(s,v),l}function yd(s){return s==null?s:GO.call(s)}function rA(s,o,l){var p=s==null?0:s.length;return p?(l&&typeof l!="number"&&Ar(s,o,l)?(o=0,l=p):(o=o==null?0:qe(o),l=l===t?p:qe(l)),ln(s,o,l)):[]}function nA(s,o){return dl(s,o)}function iA(s,o,l){return td(s,o,_e(l,2))}function sA(s,o){var l=s==null?0:s.length;if(l){var p=dl(s,o);if(p<l&&wn(s[p],o))return p}return-1}function oA(s,o){return dl(s,o,!0)}function aA(s,o,l){return td(s,o,_e(l,2),!0)}function cA(s,o){var l=s==null?0:s.length;if(l){var p=dl(s,o,!0)-1;if(wn(s[p],o))return p}return-1}function lA(s){return s&&s.length?dv(s):[]}function uA(s,o){return s&&s.length?dv(s,_e(o,2)):[]}function hA(s){var o=s==null?0:s.length;return o?ln(s,1,o):[]}function fA(s,o,l){return s&&s.length?(o=l||o===t?1:qe(o),ln(s,0,o<0?0:o)):[]}function dA(s,o,l){var p=s==null?0:s.length;return p?(o=l||o===t?1:qe(o),o=p-o,ln(s,o<0?0:o,p)):[]}function pA(s,o){return s&&s.length?pl(s,_e(o,3),!1,!0):[]}function gA(s,o){return s&&s.length?pl(s,_e(o,3)):[]}var mA=Ge(function(s){return Ci(fr(s,1,Kt,!0))}),vA=Ge(function(s){var o=un(s);return Kt(o)&&(o=t),Ci(fr(s,1,Kt,!0),_e(o,2))}),yA=Ge(function(s){var o=un(s);return o=typeof o=="function"?o:t,Ci(fr(s,1,Kt,!0),t,o)});function wA(s){return s&&s.length?Ci(s):[]}function bA(s,o){return s&&s.length?Ci(s,_e(o,2)):[]}function _A(s,o){return o=typeof o=="function"?o:t,s&&s.length?Ci(s,t,o):[]}function wd(s){if(!(s&&s.length))return[];var o=0;return s=Ei(s,function(l){if(Kt(l))return o=nr(l.length,o),!0}),Mf(o,function(l){return At(s,Rf(l))})}function Xv(s,o){if(!(s&&s.length))return[];var l=wd(s);return o==null?l:At(l,function(p){return ar(o,t,p)})}var EA=Ge(function(s,o){return Kt(s)?pa(s,o):[]}),xA=Ge(function(s){return nd(Ei(s,Kt))}),IA=Ge(function(s){var o=un(s);return Kt(o)&&(o=t),nd(Ei(s,Kt),_e(o,2))}),DA=Ge(function(s){var o=un(s);return o=typeof o=="function"?o:t,nd(Ei(s,Kt),t,o)}),SA=Ge(wd);function CA(s,o){return vv(s||[],o||[],da)}function OA(s,o){return vv(s||[],o||[],va)}var $A=Ge(function(s){var o=s.length,l=o>1?s[o-1]:t;return l=typeof l=="function"?(s.pop(),l):t,Xv(s,l)});function ey(s){var o=_(s);return o.__chain__=!0,o}function AA(s,o){return o(s),s}function xl(s,o){return o(s)}var PA=Qn(function(s){var o=s.length,l=o?s[0]:0,p=this.__wrapped__,v=function(D){return Hf(D,s)};return o>1||this.__actions__.length||!(p instanceof tt)||!Xn(l)?this.thru(v):(p=p.slice(l,+l+(o?1:0)),p.__actions__.push({func:xl,args:[v],thisArg:t}),new an(p,this.__chain__).thru(function(D){return o&&!D.length&&D.push(t),D}))});function TA(){return ey(this)}function RA(){return new an(this.value(),this.__chain__)}function NA(){this.__values__===t&&(this.__values__=py(this.value()));var s=this.__index__>=this.__values__.length,o=s?t:this.__values__[this.__index__++];return{done:s,value:o}}function LA(){return this}function MA(s){for(var o,l=this;l instanceof cl;){var p=Vv(l);p.__index__=0,p.__values__=t,o?v.__wrapped__=p:o=p;var v=p;l=l.__wrapped__}return v.__wrapped__=s,o}function UA(){var s=this.__wrapped__;if(s instanceof tt){var o=s;return this.__actions__.length&&(o=new tt(this)),o=o.reverse(),o.__actions__.push({func:xl,args:[yd],thisArg:t}),new an(o,this.__chain__)}return this.thru(yd)}function jA(){return mv(this.__wrapped__,this.__actions__)}var FA=gl(function(s,o,l){dt.call(s,l)?++s[l]:Jn(s,l,1)});function BA(s,o,l){var p=Le(s)?$m:A7;return l&&Ar(s,o,l)&&(o=t),p(s,_e(o,3))}function kA(s,o){var l=Le(s)?Ei:Xm;return l(s,_e(o,3))}var qA=Cv(Gv),zA=Cv(Yv);function HA(s,o){return fr(Il(s,o),1)}function WA(s,o){return fr(Il(s,o),ee)}function KA(s,o,l){return l=l===t?1:qe(l),fr(Il(s,o),l)}function ty(s,o){var l=Le(s)?sn:Si;return l(s,_e(o,3))}function ry(s,o){var l=Le(s)?hO:Qm;return l(s,_e(o,3))}var VA=gl(function(s,o,l){dt.call(s,l)?s[l].push(o):Jn(s,l,[o])});function GA(s,o,l,p){s=Br(s)?s:ho(s),l=l&&!p?qe(l):0;var v=s.length;return l<0&&(l=nr(v+l,0)),$l(s)?l<=v&&s.indexOf(o,l)>-1:!!v&&Xs(s,o,l)>-1}var YA=Ge(function(s,o,l){var p=-1,v=typeof o=="function",D=Br(s)?G(s.length):[];return Si(s,function(R){D[++p]=v?ar(o,R,l):ga(R,o,l)}),D}),JA=gl(function(s,o,l){Jn(s,l,o)});function Il(s,o){var l=Le(s)?At:sv;return l(s,_e(o,3))}function ZA(s,o,l,p){return s==null?[]:(Le(o)||(o=o==null?[]:[o]),l=p?t:l,Le(l)||(l=l==null?[]:[l]),lv(s,o,l))}var QA=gl(function(s,o,l){s[l?0:1].push(o)},function(){return[[],[]]});function XA(s,o,l){var p=Le(s)?Pf:Rm,v=arguments.length<3;return p(s,_e(o,4),l,v,Si)}function eP(s,o,l){var p=Le(s)?fO:Rm,v=arguments.length<3;return p(s,_e(o,4),l,v,Qm)}function tP(s,o){var l=Le(s)?Ei:Xm;return l(s,Cl(_e(o,3)))}function rP(s){var o=Le(s)?Gm:G7;return o(s)}function nP(s,o,l){(l?Ar(s,o,l):o===t)?o=1:o=qe(o);var p=Le(s)?D7:Y7;return p(s,o)}function iP(s){var o=Le(s)?S7:Z7;return o(s)}function sP(s){if(s==null)return 0;if(Br(s))return $l(s)?to(s):s.length;var o=vr(s);return o==Ce||o==Oe?s.size:Jf(s).length}function oP(s,o,l){var p=Le(s)?Tf:Q7;return l&&Ar(s,o,l)&&(o=t),p(s,_e(o,3))}var aP=Ge(function(s,o){if(s==null)return[];var l=o.length;return l>1&&Ar(s,o[0],o[1])?o=[]:l>2&&Ar(o[0],o[1],o[2])&&(o=[o[0]]),lv(s,fr(o,1),[])}),Dl=kO||function(){return it.Date.now()};function cP(s,o){if(typeof o!="function")throw new on(c);return s=qe(s),function(){if(--s<1)return o.apply(this,arguments)}}function ny(s,o,l){return o=l?t:o,o=s&&o==null?s.length:o,Zn(s,d,t,t,t,t,o)}function iy(s,o){var l;if(typeof o!="function")throw new on(c);return s=qe(s),function(){return--s>0&&(l=o.apply(this,arguments)),s<=1&&(o=t),l}}var bd=Ge(function(s,o,l){var p=U;if(l.length){var v=Ii(l,lo(bd));p|=$}return Zn(s,p,o,l,v)}),sy=Ge(function(s,o,l){var p=U|j;if(l.length){var v=Ii(l,lo(sy));p|=$}return Zn(o,p,s,l,v)});function oy(s,o,l){o=l?t:o;var p=Zn(s,T,t,t,t,t,t,o);return p.placeholder=oy.placeholder,p}function ay(s,o,l){o=l?t:o;var p=Zn(s,C,t,t,t,t,t,o);return p.placeholder=ay.placeholder,p}function cy(s,o,l){var p,v,D,R,M,z,te=0,re=!1,oe=!1,fe=!0;if(typeof s!="function")throw new on(c);o=hn(o)||0,Rt(l)&&(re=!!l.leading,oe="maxWait"in l,D=oe?nr(hn(l.maxWait)||0,o):D,fe="trailing"in l?!!l.trailing:fe);function ve(Vt){var bn=p,ri=v;return p=v=t,te=Vt,R=s.apply(ri,bn),R}function Ie(Vt){return te=Vt,M=ba(Qe,o),re?ve(Vt):R}function We(Vt){var bn=Vt-z,ri=Vt-te,Cy=o-bn;return oe?mr(Cy,D-ri):Cy}function De(Vt){var bn=Vt-z,ri=Vt-te;return z===t||bn>=o||bn<0||oe&&ri>=D}function Qe(){var Vt=Dl();if(De(Vt))return st(Vt);M=ba(Qe,We(Vt))}function st(Vt){return M=t,fe&&p?ve(Vt):(p=v=t,R)}function Qr(){M!==t&&yv(M),te=0,p=z=v=M=t}function Pr(){return M===t?R:st(Dl())}function Xr(){var Vt=Dl(),bn=De(Vt);if(p=arguments,v=this,z=Vt,bn){if(M===t)return Ie(z);if(oe)return yv(M),M=ba(Qe,o),ve(z)}return M===t&&(M=ba(Qe,o)),R}return Xr.cancel=Qr,Xr.flush=Pr,Xr}var lP=Ge(function(s,o){return Zm(s,1,o)}),uP=Ge(function(s,o,l){return Zm(s,hn(o)||0,l)});function hP(s){return Zn(s,H)}function Sl(s,o){if(typeof s!="function"||o!=null&&typeof o!="function")throw new on(c);var l=function(){var p=arguments,v=o?o.apply(this,p):p[0],D=l.cache;if(D.has(v))return D.get(v);var R=s.apply(this,p);return l.cache=D.set(v,R)||D,R};return l.cache=new(Sl.Cache||Yn),l}Sl.Cache=Yn;function Cl(s){if(typeof s!="function")throw new on(c);return function(){var o=arguments;switch(o.length){case 0:return!s.call(this);case 1:return!s.call(this,o[0]);case 2:return!s.call(this,o[0],o[1]);case 3:return!s.call(this,o[0],o[1],o[2])}return!s.apply(this,o)}}function fP(s){return iy(2,s)}var dP=X7(function(s,o){o=o.length==1&&Le(o[0])?At(o[0],Yr(_e())):At(fr(o,1),Yr(_e()));var l=o.length;return Ge(function(p){for(var v=-1,D=mr(p.length,l);++v<D;)p[v]=o[v].call(this,p[v]);return ar(s,this,p)})}),_d=Ge(function(s,o){var l=Ii(o,lo(_d));return Zn(s,$,t,o,l)}),ly=Ge(function(s,o){var l=Ii(o,lo(ly));return Zn(s,E,t,o,l)}),pP=Qn(function(s,o){return Zn(s,b,t,t,t,o)});function gP(s,o){if(typeof s!="function")throw new on(c);return o=o===t?o:qe(o),Ge(s,o)}function mP(s,o){if(typeof s!="function")throw new on(c);return o=o==null?0:nr(qe(o),0),Ge(function(l){var p=l[o],v=$i(l,0,o);return p&&xi(v,p),ar(s,this,v)})}function vP(s,o,l){var p=!0,v=!0;if(typeof s!="function")throw new on(c);return Rt(l)&&(p="leading"in l?!!l.leading:p,v="trailing"in l?!!l.trailing:v),cy(s,o,{leading:p,maxWait:o,trailing:v})}function yP(s){return ny(s,1)}function wP(s,o){return _d(sd(o),s)}function bP(){if(!arguments.length)return[];var s=arguments[0];return Le(s)?s:[s]}function _P(s){return cn(s,x)}function EP(s,o){return o=typeof o=="function"?o:t,cn(s,x,o)}function xP(s){return cn(s,w|x)}function IP(s,o){return o=typeof o=="function"?o:t,cn(s,w|x,o)}function DP(s,o){return o==null||Jm(s,o,cr(o))}function wn(s,o){return s===o||s!==s&&o!==o}var SP=wl(Vf),CP=wl(function(s,o){return s>=o}),gs=rv(function(){return arguments}())?rv:function(s){return kt(s)&&dt.call(s,"callee")&&!qm.call(s,"callee")},Le=G.isArray,OP=Or?Yr(Or):M7;function Br(s){return s!=null&&Ol(s.length)&&!ei(s)}function Kt(s){return kt(s)&&Br(s)}function $P(s){return s===!0||s===!1||kt(s)&&$r(s)==W}var Ai=zO||Td,AP=mn?Yr(mn):U7;function PP(s){return kt(s)&&s.nodeType===1&&!_a(s)}function TP(s){if(s==null)return!0;if(Br(s)&&(Le(s)||typeof s=="string"||typeof s.splice=="function"||Ai(s)||uo(s)||gs(s)))return!s.length;var o=vr(s);if(o==Ce||o==Oe)return!s.size;if(wa(s))return!Jf(s).length;for(var l in s)if(dt.call(s,l))return!1;return!0}function RP(s,o){return ma(s,o)}function NP(s,o,l){l=typeof l=="function"?l:t;var p=l?l(s,o):t;return p===t?ma(s,o,t,l):!!p}function Ed(s){if(!kt(s))return!1;var o=$r(s);return o==L||o==g||typeof s.message=="string"&&typeof s.name=="string"&&!_a(s)}function LP(s){return typeof s=="number"&&Hm(s)}function ei(s){if(!Rt(s))return!1;var o=$r(s);return o==le||o==pe||o==K||o==Ct}function uy(s){return typeof s=="number"&&s==qe(s)}function Ol(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=Y}function Rt(s){var o=typeof s;return s!=null&&(o=="object"||o=="function")}function kt(s){return s!=null&&typeof s=="object"}var hy=nn?Yr(nn):F7;function MP(s,o){return s===o||Yf(s,o,fd(o))}function UP(s,o,l){return l=typeof l=="function"?l:t,Yf(s,o,fd(o),l)}function jP(s){return fy(s)&&s!=+s}function FP(s){if(E$(s))throw new Re(a);return nv(s)}function BP(s){return s===null}function kP(s){return s==null}function fy(s){return typeof s=="number"||kt(s)&&$r(s)==Ke}function _a(s){if(!kt(s)||$r(s)!=ke)return!1;var o=tl(s);if(o===null)return!0;var l=dt.call(o,"constructor")&&o.constructor;return typeof l=="function"&&l instanceof l&&Zc.call(l)==UO}var xd=An?Yr(An):B7;function qP(s){return uy(s)&&s>=-Y&&s<=Y}var dy=oa?Yr(oa):k7;function $l(s){return typeof s=="string"||!Le(s)&&kt(s)&&$r(s)==Ue}function Zr(s){return typeof s=="symbol"||kt(s)&&$r(s)==je}var uo=as?Yr(as):q7;function zP(s){return s===t}function HP(s){return kt(s)&&vr(s)==Ae}function WP(s){return kt(s)&&$r(s)==Fe}var KP=wl(Zf),VP=wl(function(s,o){return s<=o});function py(s){if(!s)return[];if(Br(s))return $l(s)?vn(s):Fr(s);if(ca&&s[ca])return DO(s[ca]());var o=vr(s),l=o==Ce?jf:o==Oe?Gc:ho;return l(s)}function ti(s){if(!s)return s===0?s:0;if(s=hn(s),s===ee||s===-ee){var o=s<0?-1:1;return o*J}return s===s?s:0}function qe(s){var o=ti(s),l=o%1;return o===o?l?o-l:o:0}function gy(s){return s?hs(qe(s),0,ie):0}function hn(s){if(typeof s=="number")return s;if(Zr(s))return Q;if(Rt(s)){var o=typeof s.valueOf=="function"?s.valueOf():s;s=Rt(o)?o+"":o}if(typeof s!="string")return s===0?s:+s;s=Nm(s);var l=df.test(s);return l||gf.test(s)?Ne(s.slice(2),l?2:8):ff.test(s)?Q:+s}function my(s){return Tn(s,kr(s))}function GP(s){return s?hs(qe(s),-Y,Y):s===0?s:0}function ft(s){return s==null?"":Jr(s)}var YP=ao(function(s,o){if(wa(o)||Br(o)){Tn(o,cr(o),s);return}for(var l in o)dt.call(o,l)&&da(s,l,o[l])}),vy=ao(function(s,o){Tn(o,kr(o),s)}),Al=ao(function(s,o,l,p){Tn(o,kr(o),s,p)}),JP=ao(function(s,o,l,p){Tn(o,cr(o),s,p)}),ZP=Qn(Hf);function QP(s,o){var l=oo(s);return o==null?l:Ym(l,o)}var XP=Ge(function(s,o){s=wt(s);var l=-1,p=o.length,v=p>2?o[2]:t;for(v&&Ar(o[0],o[1],v)&&(p=1);++l<p;)for(var D=o[l],R=kr(D),M=-1,z=R.length;++M<z;){var te=R[M],re=s[te];(re===t||wn(re,no[te])&&!dt.call(s,te))&&(s[te]=D[te])}return s}),e9=Ge(function(s){return s.push(t,Nv),ar(yy,t,s)});function t9(s,o){return Am(s,_e(o,3),Pn)}function r9(s,o){return Am(s,_e(o,3),Kf)}function n9(s,o){return s==null?s:Wf(s,_e(o,3),kr)}function i9(s,o){return s==null?s:ev(s,_e(o,3),kr)}function s9(s,o){return s&&Pn(s,_e(o,3))}function o9(s,o){return s&&Kf(s,_e(o,3))}function a9(s){return s==null?[]:hl(s,cr(s))}function c9(s){return s==null?[]:hl(s,kr(s))}function Id(s,o,l){var p=s==null?t:fs(s,o);return p===t?l:p}function l9(s,o){return s!=null&&Uv(s,o,T7)}function Dd(s,o){return s!=null&&Uv(s,o,R7)}var u9=$v(function(s,o,l){o!=null&&typeof o.toString!="function"&&(o=Qc.call(o)),s[o]=l},Cd(qr)),h9=$v(function(s,o,l){o!=null&&typeof o.toString!="function"&&(o=Qc.call(o)),dt.call(s,o)?s[o].push(l):s[o]=[l]},_e),f9=Ge(ga);function cr(s){return Br(s)?Vm(s):Jf(s)}function kr(s){return Br(s)?Vm(s,!0):z7(s)}function d9(s,o){var l={};return o=_e(o,3),Pn(s,function(p,v,D){Jn(l,o(p,v,D),p)}),l}function p9(s,o){var l={};return o=_e(o,3),Pn(s,function(p,v,D){Jn(l,v,o(p,v,D))}),l}var g9=ao(function(s,o,l){fl(s,o,l)}),yy=ao(function(s,o,l,p){fl(s,o,l,p)}),m9=Qn(function(s,o){var l={};if(s==null)return l;var p=!1;o=At(o,function(D){return D=Oi(D,s),p||(p=D.length>1),D}),Tn(s,ud(s),l),p&&(l=cn(l,w|y|x,u$));for(var v=o.length;v--;)rd(l,o[v]);return l});function v9(s,o){return wy(s,Cl(_e(o)))}var y9=Qn(function(s,o){return s==null?{}:W7(s,o)});function wy(s,o){if(s==null)return{};var l=At(ud(s),function(p){return[p]});return o=_e(o),uv(s,l,function(p,v){return o(p,v[0])})}function w9(s,o,l){o=Oi(o,s);var p=-1,v=o.length;for(v||(v=1,s=t);++p<v;){var D=s==null?t:s[Rn(o[p])];D===t&&(p=v,D=l),s=ei(D)?D.call(s):D}return s}function b9(s,o,l){return s==null?s:va(s,o,l)}function _9(s,o,l,p){return p=typeof p=="function"?p:t,s==null?s:va(s,o,l,p)}var by=Tv(cr),_y=Tv(kr);function E9(s,o,l){var p=Le(s),v=p||Ai(s)||uo(s);if(o=_e(o,4),l==null){var D=s&&s.constructor;v?l=p?new D:[]:Rt(s)?l=ei(D)?oo(tl(s)):{}:l={}}return(v?sn:Pn)(s,function(R,M,z){return o(l,R,M,z)}),l}function x9(s,o){return s==null?!0:rd(s,o)}function I9(s,o,l){return s==null?s:gv(s,o,sd(l))}function D9(s,o,l,p){return p=typeof p=="function"?p:t,s==null?s:gv(s,o,sd(l),p)}function ho(s){return s==null?[]:Uf(s,cr(s))}function S9(s){return s==null?[]:Uf(s,kr(s))}function C9(s,o,l){return l===t&&(l=o,o=t),l!==t&&(l=hn(l),l=l===l?l:0),o!==t&&(o=hn(o),o=o===o?o:0),hs(hn(s),o,l)}function O9(s,o,l){return o=ti(o),l===t?(l=o,o=0):l=ti(l),s=hn(s),N7(s,o,l)}function $9(s,o,l){if(l&&typeof l!="boolean"&&Ar(s,o,l)&&(o=l=t),l===t&&(typeof o=="boolean"?(l=o,o=t):typeof s=="boolean"&&(l=s,s=t)),s===t&&o===t?(s=0,o=1):(s=ti(s),o===t?(o=s,s=0):o=ti(o)),s>o){var p=s;s=o,o=p}if(l||s%1||o%1){var v=Wm();return mr(s+v*(o-s+vt("1e-"+((v+"").length-1))),o)}return Xf(s,o)}var A9=co(function(s,o,l){return o=o.toLowerCase(),s+(l?Ey(o):o)});function Ey(s){return Sd(ft(s).toLowerCase())}function xy(s){return s=ft(s),s&&s.replace(Kn,bO).replace(Of,"")}function P9(s,o,l){s=ft(s),o=Jr(o);var p=s.length;l=l===t?p:hs(qe(l),0,p);var v=l;return l-=o.length,l>=0&&s.slice(l,v)==o}function T9(s){return s=ft(s),s&&Ot.test(s)?s.replace(rs,_O):s}function R9(s){return s=ft(s),s&&Jt.test(s)?s.replace(jt,"\\$&"):s}var N9=co(function(s,o,l){return s+(l?"-":"")+o.toLowerCase()}),L9=co(function(s,o,l){return s+(l?" ":"")+o.toLowerCase()}),M9=Sv("toLowerCase");function U9(s,o,l){s=ft(s),o=qe(o);var p=o?to(s):0;if(!o||p>=o)return s;var v=(o-p)/2;return yl(sl(v),l)+s+yl(il(v),l)}function j9(s,o,l){s=ft(s),o=qe(o);var p=o?to(s):0;return o&&p<o?s+yl(o-p,l):s}function F9(s,o,l){s=ft(s),o=qe(o);var p=o?to(s):0;return o&&p<o?yl(o-p,l)+s:s}function B9(s,o,l){return l||o==null?o=0:o&&(o=+o),VO(ft(s).replace(Ft,""),o||0)}function k9(s,o,l){return(l?Ar(s,o,l):o===t)?o=1:o=qe(o),ed(ft(s),o)}function q9(){var s=arguments,o=ft(s[0]);return s.length<3?o:o.replace(s[1],s[2])}var z9=co(function(s,o,l){return s+(l?"_":"")+o.toLowerCase()});function H9(s,o,l){return l&&typeof l!="number"&&Ar(s,o,l)&&(o=l=t),l=l===t?ie:l>>>0,l?(s=ft(s),s&&(typeof o=="string"||o!=null&&!xd(o))&&(o=Jr(o),!o&&eo(s))?$i(vn(s),0,l):s.split(o,l)):[]}var W9=co(function(s,o,l){return s+(l?" ":"")+Sd(o)});function K9(s,o,l){return s=ft(s),l=l==null?0:hs(qe(l),0,s.length),o=Jr(o),s.slice(l,l+o.length)==o}function V9(s,o,l){var p=_.templateSettings;l&&Ar(s,o,l)&&(o=t),s=ft(s),o=Al({},o,p,Rv);var v=Al({},o.imports,p.imports,Rv),D=cr(v),R=Uf(v,D),M,z,te=0,re=o.interpolate||Ks,oe="__p += '",fe=Ff((o.escape||Ks).source+"|"+re.source+"|"+(re===Tt?hf:Ks).source+"|"+(o.evaluate||Ks).source+"|$","g"),ve="//# sourceURL="+(dt.call(o,"sourceURL")?(o.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++$f+"]")+`
|
|
69
|
-
`;s.replace(fe,function(De,Qe,
|
|
68
|
+
`)}function V$(s){return Le(s)||bs(s)||!!(nv&&s&&s[nv])}function ri(s,o){var l=typeof s;return o=o??Y,!!o&&(l=="number"||l!="symbol"&&Df.test(s))&&s>-1&&s%1==0&&s<o}function Or(s,o,l){if(!Rt(l))return!1;var p=typeof o;return(p=="number"?Ur(l)&&ri(o,l.length):p=="string"&&o in l)?_n(l[o],s):!1}function xd(s,o){if(Le(s))return!1;var l=typeof s;return l=="number"||l=="symbol"||l=="boolean"||s==null||Jr(s)?!0:Vt.test(s)||!$t.test(s)||o!=null&&s in wt(o)}function G$(s){var o=typeof s;return o=="string"||o=="number"||o=="symbol"||o=="boolean"?s!=="__proto__":s===null}function Id(s){var o=Al(s),l=E[o];if(typeof l!="function"||!(o in et.prototype))return!1;if(s===l)return!0;var p=bd(l);return!!p&&s===p[0]}function Y$(s){return!!Xm&&Xm in s}var Z$=ol?ni:kd;function Ca(s){var o=s&&s.constructor,l=typeof o=="function"&&o.prototype||lo;return s===l}function Xv(s){return s===s&&!Rt(s)}function ey(s,o){return function(l){return l==null?!1:l[s]===o&&(o!==t||s in wt(l))}}function J$(s){var o=Ml(s,function(p){return l.size===h&&l.clear(),p}),l=o.cache;return o}function Q$(s,o){var l=s[1],p=o[1],v=l|p,S=v<(U|j|d),R=p==d&&l==T||p==d&&l==_&&s[7].length<=o[8]||p==(d|_)&&o[7].length<=o[8]&&l==T;if(!(S||R))return s;p&U&&(s[2]=o[2],v|=l&U?0:$);var M=o[3];if(M){var q=s[3];s[3]=q?Mv(q,M,o[4]):M,s[4]=q?Ci(s[3],m):o[4]}return M=o[5],M&&(q=s[5],s[5]=q?Uv(q,M,o[6]):M,s[6]=q?Ci(s[5],m):o[6]),M=o[7],M&&(s[7]=M),p&d&&(s[8]=s[8]==null?o[8]:gr(s[8],o[8])),s[9]==null&&(s[9]=o[9]),s[0]=o[0],s[1]=v,s}function X$(s){var o=[];if(s!=null)for(var l in wt(s))o.push(l);return o}function eA(s){return cl.call(s)}function ty(s,o,l){return o=rr(o===t?s.length-1:o,0),function(){for(var p=arguments,v=-1,S=rr(p.length-o,0),R=G(S);++v<S;)R[v]=p[o+v];v=-1;for(var M=G(o+1);++v<o;)M[v]=p[v];return M[o]=l(R),or(s,this,M)}}function ry(s,o){return o.length<2?s:vs(s,hn(o,0,-1))}function tA(s,o){for(var l=s.length,p=gr(o.length,l),v=Mr(s);p--;){var S=o[p];s[p]=ri(S,l)?v[S]:t}return s}function Dd(s,o){if(!(o==="constructor"&&typeof s[o]=="function")&&o!="__proto__")return s[o]}var ny=sy(Sv),$a=m7||function(s,o){return nt.setTimeout(s,o)},Sd=sy(I$);function iy(s,o,l){var p=o+"";return Sd(s,K$(p,rA(q$(p),l)))}function sy(s){var o=0,l=0;return function(){var p=b7(),v=ce-(p-l);if(l=p,v>0){if(++o>=se)return arguments[0]}else o=0;return s.apply(t,arguments)}}function Tl(s,o){var l=-1,p=s.length,v=p-1;for(o=o===t?p:o;++l<o;){var S=cd(l,v),R=s[S];s[S]=s[l],s[l]=R}return s.length=o,s}var oy=J$(function(s){var o=[];return s.charCodeAt(0)===46&&o.push(""),s.replace(Gt,function(l,p,v,S){o.push(v?S.replace(wf,"$1"):p||l)}),o});function Ln(s){if(typeof s=="string"||Jr(s))return s;var o=s+"";return o=="0"&&1/s==-ee?"-0":o}function ws(s){if(s!=null){try{return al.call(s)}catch{}try{return s+""}catch{}}return""}function rA(s,o){return an(xe,function(l){var p="_."+l[0];o&l[1]&&!rl(s,p)&&s.push(p)}),s.sort()}function ay(s){if(s instanceof et)return s.clone();var o=new ln(s.__wrapped__,s.__chain__);return o.__actions__=Mr(s.__actions__),o.__index__=s.__index__,o.__values__=s.__values__,o}function nA(s,o,l){(l?Or(s,o,l):o===t)?o=1:o=rr(ze(o),0);var p=s==null?0:s.length;if(!p||o<1)return[];for(var v=0,S=0,R=G(pl(p/o));v<p;)R[S++]=hn(s,v,v+=o);return R}function iA(s){for(var o=-1,l=s==null?0:s.length,p=0,v=[];++o<l;){var S=s[o];S&&(v[p++]=S)}return v}function sA(){var s=arguments.length;if(!s)return[];for(var o=G(s-1),l=arguments[0],p=s;p--;)o[p-1]=arguments[p];return Oi(Le(l)?Mr(l):[l],hr(o,1))}var oA=Ge(function(s,o){return Wt(s)?xa(s,hr(o,1,Wt,!0)):[]}),aA=Ge(function(s,o){var l=fn(o);return Wt(l)&&(l=t),Wt(s)?xa(s,hr(o,1,Wt,!0),_e(l,2)):[]}),cA=Ge(function(s,o){var l=fn(o);return Wt(l)&&(l=t),Wt(s)?xa(s,hr(o,1,Wt,!0),t,l):[]});function lA(s,o,l){var p=s==null?0:s.length;return p?(o=l||o===t?1:ze(o),hn(s,o<0?0:o,p)):[]}function uA(s,o,l){var p=s==null?0:s.length;return p?(o=l||o===t?1:ze(o),o=p-o,hn(s,0,o<0?0:o)):[]}function hA(s,o){return s&&s.length?Il(s,_e(o,3),!0,!0):[]}function fA(s,o){return s&&s.length?Il(s,_e(o,3),!0):[]}function dA(s,o,l,p){var v=s==null?0:s.length;return v?(l&&typeof l!="number"&&Or(s,o,l)&&(l=0,p=v),s$(s,o,l,p)):[]}function cy(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=l==null?0:ze(l);return v<0&&(v=rr(p+v,0)),nl(s,_e(o,3),v)}function ly(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=p-1;return l!==t&&(v=ze(l),v=l<0?rr(p+v,0):gr(v,p-1)),nl(s,_e(o,3),v,!0)}function uy(s){var o=s==null?0:s.length;return o?hr(s,1):[]}function pA(s){var o=s==null?0:s.length;return o?hr(s,ee):[]}function gA(s,o){var l=s==null?0:s.length;return l?(o=o===t?1:ze(o),hr(s,o)):[]}function mA(s){for(var o=-1,l=s==null?0:s.length,p={};++o<l;){var v=s[o];p[v[0]]=v[1]}return p}function hy(s){return s&&s.length?s[0]:t}function vA(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=l==null?0:ze(l);return v<0&&(v=rr(p+v,0)),so(s,o,v)}function yA(s){var o=s==null?0:s.length;return o?hn(s,0,-1):[]}var wA=Ge(function(s){var o=At(s,dd);return o.length&&o[0]===s[0]?nd(o):[]}),bA=Ge(function(s){var o=fn(s),l=At(s,dd);return o===fn(l)?o=t:l.pop(),l.length&&l[0]===s[0]?nd(l,_e(o,2)):[]}),_A=Ge(function(s){var o=fn(s),l=At(s,dd);return o=typeof o=="function"?o:t,o&&l.pop(),l.length&&l[0]===s[0]?nd(l,t,o):[]});function EA(s,o){return s==null?"":y7.call(s,o)}function fn(s){var o=s==null?0:s.length;return o?s[o-1]:t}function xA(s,o,l){var p=s==null?0:s.length;if(!p)return-1;var v=p;return l!==t&&(v=ze(l),v=v<0?rr(p+v,0):gr(v,p-1)),o===o?r7(s,o,v):nl(s,Wm,v,!0)}function IA(s,o){return s&&s.length?Ev(s,ze(o)):t}var DA=Ge(fy);function fy(s,o){return s&&s.length&&o&&o.length?ad(s,o):s}function SA(s,o,l){return s&&s.length&&o&&o.length?ad(s,o,_e(l,2)):s}function OA(s,o,l){return s&&s.length&&o&&o.length?ad(s,o,t,l):s}var CA=ti(function(s,o){var l=s==null?0:s.length,p=Xf(s,o);return Dv(s,At(o,function(v){return ri(v,l)?+v:v}).sort(Lv)),p});function $A(s,o){var l=[];if(!(s&&s.length))return l;var p=-1,v=[],S=s.length;for(o=_e(o,3);++p<S;){var R=s[p];o(R,p,s)&&(l.push(R),v.push(p))}return Dv(s,v),l}function Od(s){return s==null?s:E7.call(s)}function AA(s,o,l){var p=s==null?0:s.length;return p?(l&&typeof l!="number"&&Or(s,o,l)?(o=0,l=p):(o=o==null?0:ze(o),l=l===t?p:ze(l)),hn(s,o,l)):[]}function PA(s,o){return xl(s,o)}function TA(s,o,l){return ud(s,o,_e(l,2))}function RA(s,o){var l=s==null?0:s.length;if(l){var p=xl(s,o);if(p<l&&_n(s[p],o))return p}return-1}function NA(s,o){return xl(s,o,!0)}function LA(s,o,l){return ud(s,o,_e(l,2),!0)}function MA(s,o){var l=s==null?0:s.length;if(l){var p=xl(s,o,!0)-1;if(_n(s[p],o))return p}return-1}function UA(s){return s&&s.length?Ov(s):[]}function jA(s,o){return s&&s.length?Ov(s,_e(o,2)):[]}function FA(s){var o=s==null?0:s.length;return o?hn(s,1,o):[]}function BA(s,o,l){return s&&s.length?(o=l||o===t?1:ze(o),hn(s,0,o<0?0:o)):[]}function kA(s,o,l){var p=s==null?0:s.length;return p?(o=l||o===t?1:ze(o),o=p-o,hn(s,o<0?0:o,p)):[]}function zA(s,o){return s&&s.length?Il(s,_e(o,3),!1,!0):[]}function qA(s,o){return s&&s.length?Il(s,_e(o,3)):[]}var HA=Ge(function(s){return Pi(hr(s,1,Wt,!0))}),WA=Ge(function(s){var o=fn(s);return Wt(o)&&(o=t),Pi(hr(s,1,Wt,!0),_e(o,2))}),KA=Ge(function(s){var o=fn(s);return o=typeof o=="function"?o:t,Pi(hr(s,1,Wt,!0),t,o)});function VA(s){return s&&s.length?Pi(s):[]}function GA(s,o){return s&&s.length?Pi(s,_e(o,2)):[]}function YA(s,o){return o=typeof o=="function"?o:t,s&&s.length?Pi(s,t,o):[]}function Cd(s){if(!(s&&s.length))return[];var o=0;return s=Si(s,function(l){if(Wt(l))return o=rr(l.length,o),!0}),Wf(o,function(l){return At(s,zf(l))})}function dy(s,o){if(!(s&&s.length))return[];var l=Cd(s);return o==null?l:At(l,function(p){return or(o,t,p)})}var ZA=Ge(function(s,o){return Wt(s)?xa(s,o):[]}),JA=Ge(function(s){return fd(Si(s,Wt))}),QA=Ge(function(s){var o=fn(s);return Wt(o)&&(o=t),fd(Si(s,Wt),_e(o,2))}),XA=Ge(function(s){var o=fn(s);return o=typeof o=="function"?o:t,fd(Si(s,Wt),t,o)}),eP=Ge(Cd);function tP(s,o){return Pv(s||[],o||[],Ea)}function rP(s,o){return Pv(s||[],o||[],Sa)}var nP=Ge(function(s){var o=s.length,l=o>1?s[o-1]:t;return l=typeof l=="function"?(s.pop(),l):t,dy(s,l)});function py(s){var o=E(s);return o.__chain__=!0,o}function iP(s,o){return o(s),s}function Rl(s,o){return o(s)}var sP=ti(function(s){var o=s.length,l=o?s[0]:0,p=this.__wrapped__,v=function(S){return Xf(S,s)};return o>1||this.__actions__.length||!(p instanceof et)||!ri(l)?this.thru(v):(p=p.slice(l,+l+(o?1:0)),p.__actions__.push({func:Rl,args:[v],thisArg:t}),new ln(p,this.__chain__).thru(function(S){return o&&!S.length&&S.push(t),S}))});function oP(){return py(this)}function aP(){return new ln(this.value(),this.__chain__)}function cP(){this.__values__===t&&(this.__values__=Cy(this.value()));var s=this.__index__>=this.__values__.length,o=s?t:this.__values__[this.__index__++];return{done:s,value:o}}function lP(){return this}function uP(s){for(var o,l=this;l instanceof yl;){var p=ay(l);p.__index__=0,p.__values__=t,o?v.__wrapped__=p:o=p;var v=p;l=l.__wrapped__}return v.__wrapped__=s,o}function hP(){var s=this.__wrapped__;if(s instanceof et){var o=s;return this.__actions__.length&&(o=new et(this)),o=o.reverse(),o.__actions__.push({func:Rl,args:[Od],thisArg:t}),new ln(o,this.__chain__)}return this.thru(Od)}function fP(){return Av(this.__wrapped__,this.__actions__)}var dP=Dl(function(s,o,l){ft.call(s,l)?++s[l]:Xn(s,l,1)});function pP(s,o,l){var p=Le(s)?qm:i$;return l&&Or(s,o,l)&&(o=t),p(s,_e(o,3))}function gP(s,o){var l=Le(s)?Si:dv;return l(s,_e(o,3))}var mP=kv(cy),vP=kv(ly);function yP(s,o){return hr(Nl(s,o),1)}function wP(s,o){return hr(Nl(s,o),ee)}function bP(s,o,l){return l=l===t?1:ze(l),hr(Nl(s,o),l)}function gy(s,o){var l=Le(s)?an:Ai;return l(s,_e(o,3))}function my(s,o){var l=Le(s)?FC:fv;return l(s,_e(o,3))}var _P=Dl(function(s,o,l){ft.call(s,l)?s[l].push(o):Xn(s,l,[o])});function EP(s,o,l,p){s=Ur(s)?s:yo(s),l=l&&!p?ze(l):0;var v=s.length;return l<0&&(l=rr(v+l,0)),Fl(s)?l<=v&&s.indexOf(o,l)>-1:!!v&&so(s,o,l)>-1}var xP=Ge(function(s,o,l){var p=-1,v=typeof o=="function",S=Ur(s)?G(s.length):[];return Ai(s,function(R){S[++p]=v?or(o,R,l):Ia(R,o,l)}),S}),IP=Dl(function(s,o,l){Xn(s,l,o)});function Nl(s,o){var l=Le(s)?At:wv;return l(s,_e(o,3))}function DP(s,o,l,p){return s==null?[]:(Le(o)||(o=o==null?[]:[o]),l=p?t:l,Le(l)||(l=l==null?[]:[l]),xv(s,o,l))}var SP=Dl(function(s,o,l){s[l?0:1].push(o)},function(){return[[],[]]});function OP(s,o,l){var p=Le(s)?Bf:Vm,v=arguments.length<3;return p(s,_e(o,4),l,v,Ai)}function CP(s,o,l){var p=Le(s)?BC:Vm,v=arguments.length<3;return p(s,_e(o,4),l,v,fv)}function $P(s,o){var l=Le(s)?Si:dv;return l(s,Ul(_e(o,3)))}function AP(s){var o=Le(s)?cv:E$;return o(s)}function PP(s,o,l){(l?Or(s,o,l):o===t)?o=1:o=ze(o);var p=Le(s)?X7:x$;return p(s,o)}function TP(s){var o=Le(s)?e$:D$;return o(s)}function RP(s){if(s==null)return 0;if(Ur(s))return Fl(s)?ao(s):s.length;var o=mr(s);return o==Oe||o==Ce?s.size:sd(s).length}function NP(s,o,l){var p=Le(s)?kf:S$;return l&&Or(s,o,l)&&(o=t),p(s,_e(o,3))}var LP=Ge(function(s,o){if(s==null)return[];var l=o.length;return l>1&&Or(s,o[0],o[1])?o=[]:l>2&&Or(o[0],o[1],o[2])&&(o=[o[0]]),xv(s,hr(o,1),[])}),Ll=g7||function(){return nt.Date.now()};function MP(s,o){if(typeof o!="function")throw new cn(c);return s=ze(s),function(){if(--s<1)return o.apply(this,arguments)}}function vy(s,o,l){return o=l?t:o,o=s&&o==null?s.length:o,ei(s,d,t,t,t,t,o)}function yy(s,o){var l;if(typeof o!="function")throw new cn(c);return s=ze(s),function(){return--s>0&&(l=o.apply(this,arguments)),s<=1&&(o=t),l}}var $d=Ge(function(s,o,l){var p=U;if(l.length){var v=Ci(l,mo($d));p|=P}return ei(s,p,o,l,v)}),wy=Ge(function(s,o,l){var p=U|j;if(l.length){var v=Ci(l,mo(wy));p|=P}return ei(o,p,s,l,v)});function by(s,o,l){o=l?t:o;var p=ei(s,T,t,t,t,t,t,o);return p.placeholder=by.placeholder,p}function _y(s,o,l){o=l?t:o;var p=ei(s,O,t,t,t,t,t,o);return p.placeholder=_y.placeholder,p}function Ey(s,o,l){var p,v,S,R,M,q,te=0,re=!1,oe=!1,fe=!0;if(typeof s!="function")throw new cn(c);o=dn(o)||0,Rt(l)&&(re=!!l.leading,oe="maxWait"in l,S=oe?rr(dn(l.maxWait)||0,o):S,fe="trailing"in l?!!l.trailing:fe);function ye(Kt){var En=p,si=v;return p=v=t,te=Kt,R=s.apply(si,En),R}function Ie(Kt){return te=Kt,M=$a(Qe,o),re?ye(Kt):R}function We(Kt){var En=Kt-q,si=Kt-te,ky=o-En;return oe?gr(ky,S-si):ky}function De(Kt){var En=Kt-q,si=Kt-te;return q===t||En>=o||En<0||oe&&si>=S}function Qe(){var Kt=Ll();if(De(Kt))return it(Kt);M=$a(Qe,We(Kt))}function it(Kt){return M=t,fe&&p?ye(Kt):(p=v=t,R)}function Qr(){M!==t&&Tv(M),te=0,p=q=v=M=t}function Cr(){return M===t?R:it(Ll())}function Xr(){var Kt=Ll(),En=De(Kt);if(p=arguments,v=this,q=Kt,En){if(M===t)return Ie(q);if(oe)return Tv(M),M=$a(Qe,o),ye(q)}return M===t&&(M=$a(Qe,o)),R}return Xr.cancel=Qr,Xr.flush=Cr,Xr}var UP=Ge(function(s,o){return hv(s,1,o)}),jP=Ge(function(s,o,l){return hv(s,dn(o)||0,l)});function FP(s){return ei(s,H)}function Ml(s,o){if(typeof s!="function"||o!=null&&typeof o!="function")throw new cn(c);var l=function(){var p=arguments,v=o?o.apply(this,p):p[0],S=l.cache;if(S.has(v))return S.get(v);var R=s.apply(this,p);return l.cache=S.set(v,R)||S,R};return l.cache=new(Ml.Cache||Qn),l}Ml.Cache=Qn;function Ul(s){if(typeof s!="function")throw new cn(c);return function(){var o=arguments;switch(o.length){case 0:return!s.call(this);case 1:return!s.call(this,o[0]);case 2:return!s.call(this,o[0],o[1]);case 3:return!s.call(this,o[0],o[1],o[2])}return!s.apply(this,o)}}function BP(s){return yy(2,s)}var kP=O$(function(s,o){o=o.length==1&&Le(o[0])?At(o[0],Yr(_e())):At(hr(o,1),Yr(_e()));var l=o.length;return Ge(function(p){for(var v=-1,S=gr(p.length,l);++v<S;)p[v]=o[v].call(this,p[v]);return or(s,this,p)})}),Ad=Ge(function(s,o){var l=Ci(o,mo(Ad));return ei(s,P,t,o,l)}),xy=Ge(function(s,o){var l=Ci(o,mo(xy));return ei(s,x,t,o,l)}),zP=ti(function(s,o){return ei(s,_,t,t,t,o)});function qP(s,o){if(typeof s!="function")throw new cn(c);return o=o===t?o:ze(o),Ge(s,o)}function HP(s,o){if(typeof s!="function")throw new cn(c);return o=o==null?0:rr(ze(o),0),Ge(function(l){var p=l[o],v=Ri(l,0,o);return p&&Oi(v,p),or(s,this,v)})}function WP(s,o,l){var p=!0,v=!0;if(typeof s!="function")throw new cn(c);return Rt(l)&&(p="leading"in l?!!l.leading:p,v="trailing"in l?!!l.trailing:v),Ey(s,o,{leading:p,maxWait:o,trailing:v})}function KP(s){return vy(s,1)}function VP(s,o){return Ad(pd(o),s)}function GP(){if(!arguments.length)return[];var s=arguments[0];return Le(s)?s:[s]}function YP(s){return un(s,b)}function ZP(s,o){return o=typeof o=="function"?o:t,un(s,b,o)}function JP(s){return un(s,w|b)}function QP(s,o){return o=typeof o=="function"?o:t,un(s,w|b,o)}function XP(s,o){return o==null||uv(s,o,ar(o))}function _n(s,o){return s===o||s!==s&&o!==o}var e9=$l(rd),t9=$l(function(s,o){return s>=o}),bs=mv(function(){return arguments}())?mv:function(s){return kt(s)&&ft.call(s,"callee")&&!rv.call(s,"callee")},Le=G.isArray,r9=Dr?Yr(Dr):u$;function Ur(s){return s!=null&&jl(s.length)&&!ni(s)}function Wt(s){return kt(s)&&Ur(s)}function n9(s){return s===!0||s===!1||kt(s)&&Sr(s)==W}var Ni=v7||kd,i9=yn?Yr(yn):h$;function s9(s){return kt(s)&&s.nodeType===1&&!Aa(s)}function o9(s){if(s==null)return!0;if(Ur(s)&&(Le(s)||typeof s=="string"||typeof s.splice=="function"||Ni(s)||vo(s)||bs(s)))return!s.length;var o=mr(s);if(o==Oe||o==Ce)return!s.size;if(Ca(s))return!sd(s).length;for(var l in s)if(ft.call(s,l))return!1;return!0}function a9(s,o){return Da(s,o)}function c9(s,o,l){l=typeof l=="function"?l:t;var p=l?l(s,o):t;return p===t?Da(s,o,t,l):!!p}function Pd(s){if(!kt(s))return!1;var o=Sr(s);return o==L||o==g||typeof s.message=="string"&&typeof s.name=="string"&&!Aa(s)}function l9(s){return typeof s=="number"&&iv(s)}function ni(s){if(!Rt(s))return!1;var o=Sr(s);return o==le||o==pe||o==K||o==Ot}function Iy(s){return typeof s=="number"&&s==ze(s)}function jl(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=Y}function Rt(s){var o=typeof s;return s!=null&&(o=="object"||o=="function")}function kt(s){return s!=null&&typeof s=="object"}var Dy=on?Yr(on):d$;function u9(s,o){return s===o||id(s,o,_d(o))}function h9(s,o,l){return l=typeof l=="function"?l:t,id(s,o,_d(o),l)}function f9(s){return Sy(s)&&s!=+s}function d9(s){if(Z$(s))throw new Re(a);return vv(s)}function p9(s){return s===null}function g9(s){return s==null}function Sy(s){return typeof s=="number"||kt(s)&&Sr(s)==Ke}function Aa(s){if(!kt(s)||Sr(s)!=ke)return!1;var o=hl(s);if(o===null)return!0;var l=ft.call(o,"constructor")&&o.constructor;return typeof l=="function"&&l instanceof l&&al.call(l)==h7}var Td=Tn?Yr(Tn):p$;function m9(s){return Iy(s)&&s>=-Y&&s<=Y}var Oy=ga?Yr(ga):g$;function Fl(s){return typeof s=="string"||!Le(s)&&kt(s)&&Sr(s)==Ue}function Jr(s){return typeof s=="symbol"||kt(s)&&Sr(s)==je}var vo=fs?Yr(fs):m$;function v9(s){return s===t}function y9(s){return kt(s)&&mr(s)==Ae}function w9(s){return kt(s)&&Sr(s)==Fe}var b9=$l(od),_9=$l(function(s,o){return s<=o});function Cy(s){if(!s)return[];if(Ur(s))return Fl(s)?wn(s):Mr(s);if(va&&s[va])return XC(s[va]());var o=mr(s),l=o==Oe?Vf:o==Ce?il:yo;return l(s)}function ii(s){if(!s)return s===0?s:0;if(s=dn(s),s===ee||s===-ee){var o=s<0?-1:1;return o*Z}return s===s?s:0}function ze(s){var o=ii(s),l=o%1;return o===o?l?o-l:o:0}function $y(s){return s?ms(ze(s),0,ie):0}function dn(s){if(typeof s=="number")return s;if(Jr(s))return Q;if(Rt(s)){var o=typeof s.valueOf=="function"?s.valueOf():s;s=Rt(o)?o+"":o}if(typeof s!="string")return s===0?s:+s;s=Gm(s);var l=Ef.test(s);return l||If.test(s)?Ne(s.slice(2),l?2:8):_f.test(s)?Q:+s}function Ay(s){return Nn(s,jr(s))}function E9(s){return s?ms(ze(s),-Y,Y):s===0?s:0}function ht(s){return s==null?"":Zr(s)}var x9=po(function(s,o){if(Ca(o)||Ur(o)){Nn(o,ar(o),s);return}for(var l in o)ft.call(o,l)&&Ea(s,l,o[l])}),Py=po(function(s,o){Nn(o,jr(o),s)}),Bl=po(function(s,o,l,p){Nn(o,jr(o),s,p)}),I9=po(function(s,o,l,p){Nn(o,ar(o),s,p)}),D9=ti(Xf);function S9(s,o){var l=fo(s);return o==null?l:lv(l,o)}var O9=Ge(function(s,o){s=wt(s);var l=-1,p=o.length,v=p>2?o[2]:t;for(v&&Or(o[0],o[1],v)&&(p=1);++l<p;)for(var S=o[l],R=jr(S),M=-1,q=R.length;++M<q;){var te=R[M],re=s[te];(re===t||_n(re,lo[te])&&!ft.call(s,te))&&(s[te]=S[te])}return s}),C9=Ge(function(s){return s.push(t,Gv),or(Ty,t,s)});function $9(s,o){return Hm(s,_e(o,3),Rn)}function A9(s,o){return Hm(s,_e(o,3),td)}function P9(s,o){return s==null?s:ed(s,_e(o,3),jr)}function T9(s,o){return s==null?s:pv(s,_e(o,3),jr)}function R9(s,o){return s&&Rn(s,_e(o,3))}function N9(s,o){return s&&td(s,_e(o,3))}function L9(s){return s==null?[]:_l(s,ar(s))}function M9(s){return s==null?[]:_l(s,jr(s))}function Rd(s,o,l){var p=s==null?t:vs(s,o);return p===t?l:p}function U9(s,o){return s!=null&&Jv(s,o,o$)}function Nd(s,o){return s!=null&&Jv(s,o,a$)}var j9=qv(function(s,o,l){o!=null&&typeof o.toString!="function"&&(o=cl.call(o)),s[o]=l},Md(Fr)),F9=qv(function(s,o,l){o!=null&&typeof o.toString!="function"&&(o=cl.call(o)),ft.call(s,o)?s[o].push(l):s[o]=[l]},_e),B9=Ge(Ia);function ar(s){return Ur(s)?av(s):sd(s)}function jr(s){return Ur(s)?av(s,!0):v$(s)}function k9(s,o){var l={};return o=_e(o,3),Rn(s,function(p,v,S){Xn(l,o(p,v,S),p)}),l}function z9(s,o){var l={};return o=_e(o,3),Rn(s,function(p,v,S){Xn(l,v,o(p,v,S))}),l}var q9=po(function(s,o,l){El(s,o,l)}),Ty=po(function(s,o,l,p){El(s,o,l,p)}),H9=ti(function(s,o){var l={};if(s==null)return l;var p=!1;o=At(o,function(S){return S=Ti(S,s),p||(p=S.length>1),S}),Nn(s,wd(s),l),p&&(l=un(l,w|y|b,j$));for(var v=o.length;v--;)hd(l,o[v]);return l});function W9(s,o){return Ry(s,Ul(_e(o)))}var K9=ti(function(s,o){return s==null?{}:w$(s,o)});function Ry(s,o){if(s==null)return{};var l=At(wd(s),function(p){return[p]});return o=_e(o),Iv(s,l,function(p,v){return o(p,v[0])})}function V9(s,o,l){o=Ti(o,s);var p=-1,v=o.length;for(v||(v=1,s=t);++p<v;){var S=s==null?t:s[Ln(o[p])];S===t&&(p=v,S=l),s=ni(S)?S.call(s):S}return s}function G9(s,o,l){return s==null?s:Sa(s,o,l)}function Y9(s,o,l,p){return p=typeof p=="function"?p:t,s==null?s:Sa(s,o,l,p)}var Ny=Kv(ar),Ly=Kv(jr);function Z9(s,o,l){var p=Le(s),v=p||Ni(s)||vo(s);if(o=_e(o,4),l==null){var S=s&&s.constructor;v?l=p?new S:[]:Rt(s)?l=ni(S)?fo(hl(s)):{}:l={}}return(v?an:Rn)(s,function(R,M,q){return o(l,R,M,q)}),l}function J9(s,o){return s==null?!0:hd(s,o)}function Q9(s,o,l){return s==null?s:$v(s,o,pd(l))}function X9(s,o,l,p){return p=typeof p=="function"?p:t,s==null?s:$v(s,o,pd(l),p)}function yo(s){return s==null?[]:Kf(s,ar(s))}function eT(s){return s==null?[]:Kf(s,jr(s))}function tT(s,o,l){return l===t&&(l=o,o=t),l!==t&&(l=dn(l),l=l===l?l:0),o!==t&&(o=dn(o),o=o===o?o:0),ms(dn(s),o,l)}function rT(s,o,l){return o=ii(o),l===t?(l=o,o=0):l=ii(l),s=dn(s),c$(s,o,l)}function nT(s,o,l){if(l&&typeof l!="boolean"&&Or(s,o,l)&&(o=l=t),l===t&&(typeof o=="boolean"?(l=o,o=t):typeof s=="boolean"&&(l=s,s=t)),s===t&&o===t?(s=0,o=1):(s=ii(s),o===t?(o=s,s=0):o=ii(o)),s>o){var p=s;s=o,o=p}if(l||s%1||o%1){var v=sv();return gr(s+v*(o-s+vt("1e-"+((v+"").length-1))),o)}return cd(s,o)}var iT=go(function(s,o,l){return o=o.toLowerCase(),s+(l?My(o):o)});function My(s){return Ld(ht(s).toLowerCase())}function Uy(s){return s=ht(s),s&&s.replace(Yn,GC).replace(Uf,"")}function sT(s,o,l){s=ht(s),o=Zr(o);var p=s.length;l=l===t?p:ms(ze(l),0,p);var v=l;return l-=o.length,l>=0&&s.slice(l,v)==o}function oT(s){return s=ht(s),s&&Ct.test(s)?s.replace(as,YC):s}function aT(s){return s=ht(s),s&&Yt.test(s)?s.replace(jt,"\\$&"):s}var cT=go(function(s,o,l){return s+(l?"-":"")+o.toLowerCase()}),lT=go(function(s,o,l){return s+(l?" ":"")+o.toLowerCase()}),uT=Bv("toLowerCase");function hT(s,o,l){s=ht(s),o=ze(o);var p=o?ao(s):0;if(!o||p>=o)return s;var v=(o-p)/2;return Cl(gl(v),l)+s+Cl(pl(v),l)}function fT(s,o,l){s=ht(s),o=ze(o);var p=o?ao(s):0;return o&&p<o?s+Cl(o-p,l):s}function dT(s,o,l){s=ht(s),o=ze(o);var p=o?ao(s):0;return o&&p<o?Cl(o-p,l)+s:s}function pT(s,o,l){return l||o==null?o=0:o&&(o=+o),_7(ht(s).replace(Ft,""),o||0)}function gT(s,o,l){return(l?Or(s,o,l):o===t)?o=1:o=ze(o),ld(ht(s),o)}function mT(){var s=arguments,o=ht(s[0]);return s.length<3?o:o.replace(s[1],s[2])}var vT=go(function(s,o,l){return s+(l?"_":"")+o.toLowerCase()});function yT(s,o,l){return l&&typeof l!="number"&&Or(s,o,l)&&(o=l=t),l=l===t?ie:l>>>0,l?(s=ht(s),s&&(typeof o=="string"||o!=null&&!Td(o))&&(o=Zr(o),!o&&oo(s))?Ri(wn(s),0,l):s.split(o,l)):[]}var wT=go(function(s,o,l){return s+(l?" ":"")+Ld(o)});function bT(s,o,l){return s=ht(s),l=l==null?0:ms(ze(l),0,s.length),o=Zr(o),s.slice(l,l+o.length)==o}function _T(s,o,l){var p=E.templateSettings;l&&Or(s,o,l)&&(o=t),s=ht(s),o=Bl({},o,p,Vv);var v=Bl({},o.imports,p.imports,Vv),S=ar(v),R=Kf(v,S),M,q,te=0,re=o.interpolate||Qs,oe="__p += '",fe=Gf((o.escape||Qs).source+"|"+re.source+"|"+(re===Tt?bf:Qs).source+"|"+(o.evaluate||Qs).source+"|$","g"),ye="//# sourceURL="+(ft.call(o,"sourceURL")?(o.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++jf+"]")+`
|
|
69
|
+
`;s.replace(fe,function(De,Qe,it,Qr,Cr,Xr){return it||(it=Qr),oe+=s.slice(te,Xr).replace(Sf,ZC),Qe&&(M=!0,oe+=`' +
|
|
70
70
|
__e(`+Qe+`) +
|
|
71
|
-
'`),
|
|
72
|
-
`+
|
|
73
|
-
__p += '`),
|
|
74
|
-
((__t = (`+
|
|
71
|
+
'`),Cr&&(q=!0,oe+=`';
|
|
72
|
+
`+Cr+`;
|
|
73
|
+
__p += '`),it&&(oe+=`' +
|
|
74
|
+
((__t = (`+it+`)) == null ? '' : __t) +
|
|
75
75
|
'`),te=Xr+De.length,De}),oe+=`';
|
|
76
|
-
`;var Ie=
|
|
76
|
+
`;var Ie=ft.call(o,"variable")&&o.variable;if(!Ie)oe=`with (obj) {
|
|
77
77
|
`+oe+`
|
|
78
78
|
}
|
|
79
|
-
`;else if(
|
|
79
|
+
`;else if(yf.test(Ie))throw new Re(u);oe=(q?oe.replace(An,""):oe).replace(Ir,"$1").replace(Gn,"$1;"),oe="function("+(Ie||"obj")+`) {
|
|
80
80
|
`+(Ie?"":`obj || (obj = {});
|
|
81
|
-
`)+"var __t, __p = ''"+(M?", __e = _.escape":"")+(
|
|
81
|
+
`)+"var __t, __p = ''"+(M?", __e = _.escape":"")+(q?`, __j = Array.prototype.join;
|
|
82
82
|
function print() { __p += __j.call(arguments, '') }
|
|
83
83
|
`:`;
|
|
84
84
|
`)+oe+`return __p
|
|
85
|
-
}`;var We=Dy(function(){return ut(D,ve+"return "+oe).apply(t,R)});if(We.source=oe,Ed(We))throw We;return We}function G9(s){return ft(s).toLowerCase()}function Y9(s){return ft(s).toUpperCase()}function J9(s,o,l){if(s=ft(s),s&&(l||o===t))return Nm(s);if(!s||!(o=Jr(o)))return s;var p=vn(s),v=vn(o),D=Lm(p,v),R=Mm(p,v)+1;return $i(p,D,R).join("")}function Z9(s,o,l){if(s=ft(s),s&&(l||o===t))return s.slice(0,jm(s)+1);if(!s||!(o=Jr(o)))return s;var p=vn(s),v=Mm(p,vn(o))+1;return $i(p,0,v).join("")}function Q9(s,o,l){if(s=ft(s),s&&(l||o===t))return s.replace(Ft,"");if(!s||!(o=Jr(o)))return s;var p=vn(s),v=Lm(p,vn(o));return $i(p,v).join("")}function X9(s,o){var l=F,p=V;if(Rt(o)){var v="separator"in o?o.separator:v;l="length"in o?qe(o.length):l,p="omission"in o?Jr(o.omission):p}s=ft(s);var D=s.length;if(eo(s)){var R=vn(s);D=R.length}if(l>=D)return s;var M=l-to(p);if(M<1)return p;var z=R?$i(R,0,M).join(""):s.slice(0,M);if(v===t)return z+p;if(R&&(M+=z.length-M),xd(v)){if(s.slice(M).search(v)){var te,re=z;for(v.global||(v=Ff(v.source,ft(rn.exec(v))+"g")),v.lastIndex=0;te=v.exec(re);)var oe=te.index;z=z.slice(0,oe===t?M:oe)}}else if(s.indexOf(Jr(v),M)!=M){var fe=z.lastIndexOf(v);fe>-1&&(z=z.slice(0,fe))}return z+p}function eT(s){return s=ft(s),s&&Lt.test(s)?s.replace(bi,$O):s}var tT=co(function(s,o,l){return s+(l?" ":"")+o.toUpperCase()}),Sd=Sv("toUpperCase");function Iy(s,o,l){return s=ft(s),o=l?t:o,o===t?IO(s)?TO(s):gO(s):s.match(o)||[]}var Dy=Ge(function(s,o){try{return ar(s,t,o)}catch(l){return Ed(l)?l:new Re(l)}}),rT=Qn(function(s,o){return sn(o,function(l){l=Rn(l),Jn(s,l,bd(s[l],s))}),s});function nT(s){var o=s==null?0:s.length,l=_e();return s=o?At(s,function(p){if(typeof p[1]!="function")throw new on(c);return[l(p[0]),p[1]]}):[],Ge(function(p){for(var v=-1;++v<o;){var D=s[v];if(ar(D[0],this,p))return ar(D[1],this,p)}})}function iT(s){return $7(cn(s,w))}function Cd(s){return function(){return s}}function sT(s,o){return s==null||s!==s?o:s}var oT=Ov(),aT=Ov(!0);function qr(s){return s}function Od(s){return iv(typeof s=="function"?s:cn(s,w))}function cT(s){return ov(cn(s,w))}function lT(s,o){return av(s,cn(o,w))}var uT=Ge(function(s,o){return function(l){return ga(l,s,o)}}),hT=Ge(function(s,o){return function(l){return ga(s,l,o)}});function $d(s,o,l){var p=cr(o),v=hl(o,p);l==null&&!(Rt(o)&&(v.length||!p.length))&&(l=o,o=s,s=this,v=hl(o,cr(o)));var D=!(Rt(l)&&"chain"in l)||!!l.chain,R=ei(s);return sn(v,function(M){var z=o[M];s[M]=z,R&&(s.prototype[M]=function(){var te=this.__chain__;if(D||te){var re=s(this.__wrapped__),oe=re.__actions__=Fr(this.__actions__);return oe.push({func:z,args:arguments,thisArg:s}),re.__chain__=te,re}return z.apply(s,xi([this.value()],arguments))})}),s}function fT(){return it._===this&&(it._=jO),this}function Ad(){}function dT(s){return s=qe(s),Ge(function(o){return cv(o,s)})}var pT=ad(At),gT=ad($m),mT=ad(Tf);function Sy(s){return pd(s)?Rf(Rn(s)):K7(s)}function vT(s){return function(o){return s==null?t:fs(s,o)}}var yT=Av(),wT=Av(!0);function Pd(){return[]}function Td(){return!1}function bT(){return{}}function _T(){return""}function ET(){return!0}function xT(s,o){if(s=qe(s),s<1||s>Y)return[];var l=ie,p=mr(s,ie);o=_e(o),s-=ie;for(var v=Mf(p,o);++l<s;)o(l);return v}function IT(s){return Le(s)?At(s,Rn):Zr(s)?[s]:Fr(Kv(ft(s)))}function DT(s){var o=++MO;return ft(s)+o}var ST=vl(function(s,o){return s+o},0),CT=cd("ceil"),OT=vl(function(s,o){return s/o},1),$T=cd("floor");function AT(s){return s&&s.length?ul(s,qr,Vf):t}function PT(s,o){return s&&s.length?ul(s,_e(o,2),Vf):t}function TT(s){return Tm(s,qr)}function RT(s,o){return Tm(s,_e(o,2))}function NT(s){return s&&s.length?ul(s,qr,Zf):t}function LT(s,o){return s&&s.length?ul(s,_e(o,2),Zf):t}var MT=vl(function(s,o){return s*o},1),UT=cd("round"),jT=vl(function(s,o){return s-o},0);function FT(s){return s&&s.length?Lf(s,qr):0}function BT(s,o){return s&&s.length?Lf(s,_e(o,2)):0}return _.after=cP,_.ary=ny,_.assign=YP,_.assignIn=vy,_.assignInWith=Al,_.assignWith=JP,_.at=ZP,_.before=iy,_.bind=bd,_.bindAll=rT,_.bindKey=sy,_.castArray=bP,_.chain=ey,_.chunk=$$,_.compact=A$,_.concat=P$,_.cond=nT,_.conforms=iT,_.constant=Cd,_.countBy=FA,_.create=QP,_.curry=oy,_.curryRight=ay,_.debounce=cy,_.defaults=XP,_.defaultsDeep=e9,_.defer=lP,_.delay=uP,_.difference=T$,_.differenceBy=R$,_.differenceWith=N$,_.drop=L$,_.dropRight=M$,_.dropRightWhile=U$,_.dropWhile=j$,_.fill=F$,_.filter=kA,_.flatMap=HA,_.flatMapDeep=WA,_.flatMapDepth=KA,_.flatten=Jv,_.flattenDeep=B$,_.flattenDepth=k$,_.flip=hP,_.flow=oT,_.flowRight=aT,_.fromPairs=q$,_.functions=a9,_.functionsIn=c9,_.groupBy=VA,_.initial=H$,_.intersection=W$,_.intersectionBy=K$,_.intersectionWith=V$,_.invert=u9,_.invertBy=h9,_.invokeMap=YA,_.iteratee=Od,_.keyBy=JA,_.keys=cr,_.keysIn=kr,_.map=Il,_.mapKeys=d9,_.mapValues=p9,_.matches=cT,_.matchesProperty=lT,_.memoize=Sl,_.merge=g9,_.mergeWith=yy,_.method=uT,_.methodOf=hT,_.mixin=$d,_.negate=Cl,_.nthArg=dT,_.omit=m9,_.omitBy=v9,_.once=fP,_.orderBy=ZA,_.over=pT,_.overArgs=dP,_.overEvery=gT,_.overSome=mT,_.partial=_d,_.partialRight=ly,_.partition=QA,_.pick=y9,_.pickBy=wy,_.property=Sy,_.propertyOf=vT,_.pull=Z$,_.pullAll=Qv,_.pullAllBy=Q$,_.pullAllWith=X$,_.pullAt=eA,_.range=yT,_.rangeRight=wT,_.rearg=pP,_.reject=tP,_.remove=tA,_.rest=gP,_.reverse=yd,_.sampleSize=nP,_.set=b9,_.setWith=_9,_.shuffle=iP,_.slice=rA,_.sortBy=aP,_.sortedUniq=lA,_.sortedUniqBy=uA,_.split=H9,_.spread=mP,_.tail=hA,_.take=fA,_.takeRight=dA,_.takeRightWhile=pA,_.takeWhile=gA,_.tap=AA,_.throttle=vP,_.thru=xl,_.toArray=py,_.toPairs=by,_.toPairsIn=_y,_.toPath=IT,_.toPlainObject=my,_.transform=E9,_.unary=yP,_.union=mA,_.unionBy=vA,_.unionWith=yA,_.uniq=wA,_.uniqBy=bA,_.uniqWith=_A,_.unset=x9,_.unzip=wd,_.unzipWith=Xv,_.update=I9,_.updateWith=D9,_.values=ho,_.valuesIn=S9,_.without=EA,_.words=Iy,_.wrap=wP,_.xor=xA,_.xorBy=IA,_.xorWith=DA,_.zip=SA,_.zipObject=CA,_.zipObjectDeep=OA,_.zipWith=$A,_.entries=by,_.entriesIn=_y,_.extend=vy,_.extendWith=Al,$d(_,_),_.add=ST,_.attempt=Dy,_.camelCase=A9,_.capitalize=Ey,_.ceil=CT,_.clamp=C9,_.clone=_P,_.cloneDeep=xP,_.cloneDeepWith=IP,_.cloneWith=EP,_.conformsTo=DP,_.deburr=xy,_.defaultTo=sT,_.divide=OT,_.endsWith=P9,_.eq=wn,_.escape=T9,_.escapeRegExp=R9,_.every=BA,_.find=qA,_.findIndex=Gv,_.findKey=t9,_.findLast=zA,_.findLastIndex=Yv,_.findLastKey=r9,_.floor=$T,_.forEach=ty,_.forEachRight=ry,_.forIn=n9,_.forInRight=i9,_.forOwn=s9,_.forOwnRight=o9,_.get=Id,_.gt=SP,_.gte=CP,_.has=l9,_.hasIn=Dd,_.head=Zv,_.identity=qr,_.includes=GA,_.indexOf=z$,_.inRange=O9,_.invoke=f9,_.isArguments=gs,_.isArray=Le,_.isArrayBuffer=OP,_.isArrayLike=Br,_.isArrayLikeObject=Kt,_.isBoolean=$P,_.isBuffer=Ai,_.isDate=AP,_.isElement=PP,_.isEmpty=TP,_.isEqual=RP,_.isEqualWith=NP,_.isError=Ed,_.isFinite=LP,_.isFunction=ei,_.isInteger=uy,_.isLength=Ol,_.isMap=hy,_.isMatch=MP,_.isMatchWith=UP,_.isNaN=jP,_.isNative=FP,_.isNil=kP,_.isNull=BP,_.isNumber=fy,_.isObject=Rt,_.isObjectLike=kt,_.isPlainObject=_a,_.isRegExp=xd,_.isSafeInteger=qP,_.isSet=dy,_.isString=$l,_.isSymbol=Zr,_.isTypedArray=uo,_.isUndefined=zP,_.isWeakMap=HP,_.isWeakSet=WP,_.join=G$,_.kebabCase=N9,_.last=un,_.lastIndexOf=Y$,_.lowerCase=L9,_.lowerFirst=M9,_.lt=KP,_.lte=VP,_.max=AT,_.maxBy=PT,_.mean=TT,_.meanBy=RT,_.min=NT,_.minBy=LT,_.stubArray=Pd,_.stubFalse=Td,_.stubObject=bT,_.stubString=_T,_.stubTrue=ET,_.multiply=MT,_.nth=J$,_.noConflict=fT,_.noop=Ad,_.now=Dl,_.pad=U9,_.padEnd=j9,_.padStart=F9,_.parseInt=B9,_.random=$9,_.reduce=XA,_.reduceRight=eP,_.repeat=k9,_.replace=q9,_.result=w9,_.round=UT,_.runInContext=q,_.sample=rP,_.size=sP,_.snakeCase=z9,_.some=oP,_.sortedIndex=nA,_.sortedIndexBy=iA,_.sortedIndexOf=sA,_.sortedLastIndex=oA,_.sortedLastIndexBy=aA,_.sortedLastIndexOf=cA,_.startCase=W9,_.startsWith=K9,_.subtract=jT,_.sum=FT,_.sumBy=BT,_.template=V9,_.times=xT,_.toFinite=ti,_.toInteger=qe,_.toLength=gy,_.toLower=G9,_.toNumber=hn,_.toSafeInteger=GP,_.toString=ft,_.toUpper=Y9,_.trim=J9,_.trimEnd=Z9,_.trimStart=Q9,_.truncate=X9,_.unescape=eT,_.uniqueId=DT,_.upperCase=tT,_.upperFirst=Sd,_.each=ty,_.eachRight=ry,_.first=Zv,$d(_,function(){var s={};return Pn(_,function(o,l){dt.call(_.prototype,l)||(s[l]=o)}),s}(),{chain:!1}),_.VERSION=n,sn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){_[s].placeholder=_}),sn(["drop","take"],function(s,o){tt.prototype[s]=function(l){l=l===t?1:nr(qe(l),0);var p=this.__filtered__&&!o?new tt(this):this.clone();return p.__filtered__?p.__takeCount__=mr(l,p.__takeCount__):p.__views__.push({size:mr(l,ie),type:s+(p.__dir__<0?"Right":"")}),p},tt.prototype[s+"Right"]=function(l){return this.reverse()[s](l).reverse()}}),sn(["filter","map","takeWhile"],function(s,o){var l=o+1,p=l==I||l==X;tt.prototype[s]=function(v){var D=this.clone();return D.__iteratees__.push({iteratee:_e(v,3),type:l}),D.__filtered__=D.__filtered__||p,D}}),sn(["head","last"],function(s,o){var l="take"+(o?"Right":"");tt.prototype[s]=function(){return this[l](1).value()[0]}}),sn(["initial","tail"],function(s,o){var l="drop"+(o?"":"Right");tt.prototype[s]=function(){return this.__filtered__?new tt(this):this[l](1)}}),tt.prototype.compact=function(){return this.filter(qr)},tt.prototype.find=function(s){return this.filter(s).head()},tt.prototype.findLast=function(s){return this.reverse().find(s)},tt.prototype.invokeMap=Ge(function(s,o){return typeof s=="function"?new tt(this):this.map(function(l){return ga(l,s,o)})}),tt.prototype.reject=function(s){return this.filter(Cl(_e(s)))},tt.prototype.slice=function(s,o){s=qe(s);var l=this;return l.__filtered__&&(s>0||o<0)?new tt(l):(s<0?l=l.takeRight(-s):s&&(l=l.drop(s)),o!==t&&(o=qe(o),l=o<0?l.dropRight(-o):l.take(o-s)),l)},tt.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},tt.prototype.toArray=function(){return this.take(ie)},Pn(tt.prototype,function(s,o){var l=/^(?:filter|find|map|reject)|While$/.test(o),p=/^(?:head|last)$/.test(o),v=_[p?"take"+(o=="last"?"Right":""):o],D=p||/^find/.test(o);v&&(_.prototype[o]=function(){var R=this.__wrapped__,M=p?[1]:arguments,z=R instanceof tt,te=M[0],re=z||Le(R),oe=function(Qe){var st=v.apply(_,xi([Qe],M));return p&&fe?st[0]:st};re&&l&&typeof te=="function"&&te.length!=1&&(z=re=!1);var fe=this.__chain__,ve=!!this.__actions__.length,Ie=D&&!fe,We=z&&!ve;if(!D&&re){R=We?R:new tt(this);var De=s.apply(R,M);return De.__actions__.push({func:xl,args:[oe],thisArg:t}),new an(De,fe)}return Ie&&We?s.apply(this,M):(De=this.thru(oe),Ie?p?De.value()[0]:De.value():De)})}),sn(["pop","push","shift","sort","splice","unshift"],function(s){var o=Yc[s],l=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",p=/^(?:pop|shift)$/.test(s);_.prototype[s]=function(){var v=arguments;if(p&&!this.__chain__){var D=this.value();return o.apply(Le(D)?D:[],v)}return this[l](function(R){return o.apply(Le(R)?R:[],v)})}}),Pn(tt.prototype,function(s,o){var l=_[o];if(l){var p=l.name+"";dt.call(so,p)||(so[p]=[]),so[p].push({name:o,func:l})}}),so[ml(t,j).name]=[{name:"wrapper",func:t}],tt.prototype.clone=e7,tt.prototype.reverse=t7,tt.prototype.value=r7,_.prototype.at=PA,_.prototype.chain=TA,_.prototype.commit=RA,_.prototype.next=NA,_.prototype.plant=MA,_.prototype.reverse=UA,_.prototype.toJSON=_.prototype.valueOf=_.prototype.value=jA,_.prototype.first=_.prototype.head,ca&&(_.prototype[ca]=LA),_},ro=RO();Wt?((Wt.exports=ro)._=ro,yt._=ro):it._=ro}).call(Mo)})(Vu,Vu.exports);var ex=Object.defineProperty,tx=Object.defineProperties,rx=Object.getOwnPropertyDescriptors,W1=Object.getOwnPropertySymbols,nx=Object.prototype.hasOwnProperty,ix=Object.prototype.propertyIsEnumerable,K1=(r,e,t)=>e in r?ex(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ya=(r,e)=>{for(var t in e||(e={}))nx.call(e,t)&&K1(r,t,e[t]);if(W1)for(var t of W1(e))ix.call(e,t)&&K1(r,t,e[t]);return r},sx=(r,e)=>tx(r,rx(e));function ai(r,e,t){var n;const i=J2(r);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${X8}?chainId=${i.namespace}:${i.reference}&projectId=${t}`}function qi(r){return r.includes(":")?r.split(":")[1]:r}function V1(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function ox(r,e){const t=Object.keys(e.namespaces).filter(i=>i.includes(r));if(!t.length)return[];const n=[];return t.forEach(i=>{const a=e.namespaces[i].accounts;n.push(...a)}),n}function G1(r={},e={}){const t=Y1(r),n=Y1(e);return Vu.exports.merge(t,n)}function Y1(r){var e,t,n,i;const a={};if(!xo(r))return a;for(const[c,u]of Object.entries(r)){const f=lu(c)?[c]:u.chains,h=u.methods||[],m=u.events||[],w=u.rpcMap||{},y=Eo(c);a[y]=sx(Ya(Ya({},a[y]),u),{chains:au(f,(e=a[y])==null?void 0:e.chains),methods:au(h,(t=a[y])==null?void 0:t.methods),events:au(m,(n=a[y])==null?void 0:n.events),rpcMap:Ya(Ya({},w),(i=a[y])==null?void 0:i.rpcMap)})}return a}function ax(r){return r.includes(":")?r.split(":")[2]:r}function cx(r){const e={};for(const[t,n]of Object.entries(r)){const i=n.methods||[],a=n.events||[],c=n.accounts||[],u=lu(t)?[t]:n.chains?n.chains:V1(n.accounts);e[t]={chains:u,methods:i,events:a,accounts:c}}return e}function Gu(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):(r=r.includes(":")?r.split(":")[1]:r,isNaN(Number(r))?r:Number(r))}const J1={},Dt=r=>J1[r],Yu=(r,e)=>{J1[r]=e};class lx{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Dt("events"),this.client=Dt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(kn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const i=qi(t);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||ai(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Un(new oi(n,Dt("disableProviderPing")))}}class ux{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Dt("events"),this.client=Dt("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(kn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const n=t||ai(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Un(new oi(n,Dt("disableProviderPing")))}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const i=parseInt(qi(t));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,n;let i=e.request.params?(t=e.request.params[0])==null?void 0:t.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const a=parseInt(i,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}}class hx{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Dt("events"),this.client=Dt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(kn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const i=qi(t);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||ai(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Un(new oi(n,Dt("disableProviderPing")))}}class fx{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Dt("events"),this.client=Dt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(kn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const i=qi(t);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||ai(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Un(new oi(n,Dt("disableProviderPing")))}}class dx{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Dt("events"),this.client=Dt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(kn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{const n=this.getCardanoRPCUrl(t),i=qi(t);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Un(new oi(n,Dt("disableProviderPing")))}}class px{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Dt("events"),this.client=Dt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(kn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const i=qi(t);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||ai(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Un(new oi(n,Dt("disableProviderPing")))}}class gx{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Dt("events"),this.client=Dt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(kn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const i=qi(t);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||ai(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Un(new oi(n,Dt("disableProviderPing")))}}class mx{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Dt("events"),this.client=Dt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const n=t||ai(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(kn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;e[t]=this.createHttpProvider(t,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||ai(e,this.namespace);return typeof n>"u"?void 0:new Un(new oi(n,Dt("disableProviderPing")))}}var vx=Object.defineProperty,yx=Object.defineProperties,wx=Object.getOwnPropertyDescriptors,Z1=Object.getOwnPropertySymbols,bx=Object.prototype.hasOwnProperty,_x=Object.prototype.propertyIsEnumerable,Q1=(r,e,t)=>e in r?vx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ja=(r,e)=>{for(var t in e||(e={}))bx.call(e,t)&&Q1(r,t,e[t]);if(Z1)for(var t of Z1(e))_x.call(e,t)&&Q1(r,t,e[t]);return r},Ju=(r,e)=>yx(r,wx(e));class Zu{constructor(e){this.events=new lr.exports,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Xe.pino(Xe.getDefaultLoggerOptions({level:e?.logger||z1})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){const t=new Zu(e);return await t.initialize(),t}async request(e,t,n){const[i,a]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:Ja({},e),chainId:`${i}:${a}`,topic:this.session.topic,expiry:n})}sendAsync(e,t,n,i){const a=new Date().getTime();this.request(e,n,i).then(c=>t(null,za(a,c))).catch(c=>t(c,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:It("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(a=>{this.session=a;const c=cx(a.namespaces);this.namespaces=G1(this.namespaces,c),this.persist("namespaces",this.namespaces)}).catch(a=>{if(a.message!==U1)throw a;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[n,i]=this.validateChain(e);this.getProvider(n).setDefaultChain(i,t)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(En(t)){for(const n of t)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await Wu.init({logger:this.providerOpts.logger||z1,relayUrl:this.providerOpts.relayUrl||J8,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(t=>Eo(t)))];Yu("client",this.client),Yu("events",this.events),Yu("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const n=ox(t,this.session),i=V1(n),a=G1(this.namespaces,this.optionalNamespaces),c=Ju(Ja({},a[t]),{accounts:n,chains:i});switch(t){case"eip155":this.rpcProviders[t]=new ux({namespace:c});break;case"solana":this.rpcProviders[t]=new hx({namespace:c});break;case"cosmos":this.rpcProviders[t]=new fx({namespace:c});break;case"polkadot":this.rpcProviders[t]=new lx({namespace:c});break;case"cip34":this.rpcProviders[t]=new dx({namespace:c});break;case"elrond":this.rpcProviders[t]=new px({namespace:c});break;case"multiversx":this.rpcProviders[t]=new gx({namespace:c});break;case"near":this.rpcProviders[t]=new mx({namespace:c});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:t}=e,{event:n}=t;if(n.name==="accountsChanged"){const i=n.data;i&&En(i)&&this.events.emit("accountsChanged",i.map(ax))}else if(n.name==="chainChanged"){const i=t.chainId,a=t.event.data,c=Eo(i),u=Gu(i)!==Gu(a)?`${c}:${Gu(a)}`:i;this.onChainChanged(u)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var n;const{namespaces:i}=t,a=(n=this.client)==null?void 0:n.session.get(e);this.session=Ju(Ja({},a),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",Ju(Ja({},It("USER_DISCONNECTED")),{data:e.topic}))}),this.on(kn.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){if(!this.rpcProviders[e])throw new Error(`Provider not found: ${e}`);return this.rpcProviders[e]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace((t=this.session)==null?void 0:t.namespaces[e])})}setNamespaces(e){const{namespaces:t,optionalNamespaces:n,sessionProperties:i}=e;t&&Object.keys(t).length&&(this.namespaces=t),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",t),this.persist("optionalNamespaces",n)}validateChain(e){const[t,n]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,n];if(t&&!Object.keys(this.namespaces||{}).map(c=>Eo(c)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&n)return[t,n];const i=Eo(Object.keys(this.namespaces)[0]),a=this.rpcProviders[i].getDefaultChain();return[i,a]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(t||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${H1}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${H1}/${e}`)}}const Ex=Zu,xx="wc",Ix="ethereum_provider",Dx=`${xx}@2:${Ix}:`,Sx="https://rpc.walletconnect.com/v1/",Za=["eth_sendTransaction","personal_sign"],X1=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],Qa=["chainChanged","accountsChanged"],eg=["chainChanged","accountsChanged","message","disconnect","connect"];var Cx=Object.defineProperty,Ox=Object.defineProperties,$x=Object.getOwnPropertyDescriptors,tg=Object.getOwnPropertySymbols,Ax=Object.prototype.hasOwnProperty,Px=Object.prototype.propertyIsEnumerable,rg=(r,e,t)=>e in r?Cx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Uo=(r,e)=>{for(var t in e||(e={}))Ax.call(e,t)&&rg(r,t,e[t]);if(tg)for(var t of tg(e))Px.call(e,t)&&rg(r,t,e[t]);return r},ng=(r,e)=>Ox(r,$x(e));function Xa(r){return Number(r[0].split(":")[1])}function Qu(r){return`0x${r.toString(16)}`}function Tx(r){const{chains:e,optionalChains:t,methods:n,optionalMethods:i,events:a,optionalEvents:c,rpcMap:u}=r;if(!En(e))throw new Error("Invalid chains");const f={chains:e,methods:n||Za,events:a||Qa,rpcMap:Uo({},e.length?{[Xa(e)]:u[Xa(e)]}:{})},h=a?.filter(x=>!Qa.includes(x)),m=n?.filter(x=>!Za.includes(x));if(!t&&!c&&!i&&!(h!=null&&h.length)&&!(m!=null&&m.length))return{required:e.length?f:void 0};const w=h?.length&&m?.length||!t,y={chains:[...new Set(w?f.chains.concat(t||[]):t)],methods:[...new Set(f.methods.concat(i!=null&&i.length?i:X1))],events:[...new Set(f.events.concat(c!=null&&c.length?c:eg))],rpcMap:u};return{required:e.length?f:void 0,optional:t.length?y:void 0}}class ec{constructor(){this.events=new lr.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=Dx,this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const t=new ec;return await t.initialize(e),t}async request(e,t){return await this.signer.request(e,this.formatChainId(this.chainId),t)}sendAsync(e,t,n){this.signer.sendAsync(e,t,this.formatChainId(this.chainId),n)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:n}=Tx(this.rpc);try{const i=await new Promise(async(c,u)=>{var f;this.rpc.showQrModal&&((f=this.modal)==null||f.subscribeModal(h=>{!h.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),u(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(ng(Uo({namespaces:Uo({},t&&{[this.namespace]:t})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:e?.pairingTopic})).then(h=>{c(h)}).catch(h=>{u(new Error(h.message))})});if(!i)return;const a=Z2(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:Qu(this.chainId)})}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:t}=e,{event:n}=t;n.name==="accountsChanged"?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):n.name==="chainChanged"?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",Qu(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",ng(Uo({},It("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var t,n;this.rpc.showQrModal&&((t=this.modal)==null||t.closeModal(),(n=this.modal)==null||n.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const t=e.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",Qu(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,n,i]=e.split(":");return{chainId:`${t}:${n}`,address:i}}setAccounts(e){this.accounts=e.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,n;const i=(t=e?.chains)!=null?t:[],a=(n=e?.optionalChains)!=null?n:[],c=i.concat(a);if(!c.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const u=i.length?e?.methods||Za:[],f=i.length?e?.events||Qa:[],h=e?.optionalMethods||[],m=e?.optionalEvents||[],w=e?.rpcMap||this.buildRpcMap(c,e.projectId),y=e?.qrModalOptions||void 0;return{chains:i?.map(x=>this.formatChainId(x)),optionalChains:a.map(x=>this.formatChainId(x)),methods:u,events:f,optionalMethods:h,optionalEvents:m,rpcMap:w,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:y,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const n={};return e.forEach(i=>{n[i]=this.getRpcUrl(i,t)}),n}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?Xa(this.rpc.chains):Xa(this.rpc.optionalChains),this.signer=await Ex.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{const{WalletConnectModal:n}=await Promise.resolve().then(function(){return tI});t=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(Uo({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:n,rpcMap:i}=e;t&&En(t)&&(this.rpc.chains=t.map(a=>this.formatChainId(a)),t.forEach(a=>{this.rpc.rpcMap[a]=i?.[a]||this.getRpcUrl(a)})),n&&En(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n?.map(a=>this.formatChainId(a)),n.forEach(a=>{this.rpc.rpcMap[a]=i?.[a]||this.getRpcUrl(a)}))}getRpcUrl(e,t){var n;return((n=this.rpc.rpcMap)==null?void 0:n[e])||`${Sx}?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t?.accounts),this.setAccounts(t?.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(t=>this.parseAccount(t))}}const Rx=ec,Nx=Symbol(),ig=Object.getPrototypeOf,Xu=new WeakMap,Lx=r=>r&&(Xu.has(r)?Xu.get(r):ig(r)===Object.prototype||ig(r)===Array.prototype),Mx=r=>Lx(r)&&r[Nx]||null,sg=(r,e=!0)=>{Xu.set(r,e)},eh=r=>typeof r=="object"&&r!==null,ci=new WeakMap,tc=new WeakSet,Ux=(r=Object.is,e=(h,m)=>new Proxy(h,m),t=h=>eh(h)&&!tc.has(h)&&(Array.isArray(h)||!(Symbol.iterator in h))&&!(h instanceof WeakMap)&&!(h instanceof WeakSet)&&!(h instanceof Error)&&!(h instanceof Number)&&!(h instanceof Date)&&!(h instanceof String)&&!(h instanceof RegExp)&&!(h instanceof ArrayBuffer),n=h=>{switch(h.status){case"fulfilled":return h.value;case"rejected":throw h.reason;default:throw h}},i=new WeakMap,a=(h,m,w=n)=>{const y=i.get(h);if(y?.[0]===m)return y[1];const x=Array.isArray(h)?[]:Object.create(Object.getPrototypeOf(h));return sg(x,!0),i.set(h,[m,x]),Reflect.ownKeys(h).forEach(S=>{if(Object.getOwnPropertyDescriptor(x,S))return;const P=Reflect.get(h,S),U={value:P,enumerable:!0,configurable:!0};if(tc.has(P))sg(P,!1);else if(P instanceof Promise)delete U.value,U.get=()=>w(P);else if(ci.has(P)){const[j,A]=ci.get(P);U.value=a(j,A(),w)}Object.defineProperty(x,S,U)}),Object.preventExtensions(x)},c=new WeakMap,u=[1,1],f=h=>{if(!eh(h))throw new Error("object required");const m=c.get(h);if(m)return m;let w=u[0];const y=new Set,x=(H,F=++u[0])=>{w!==F&&(w=F,y.forEach(V=>V(H,F)))};let S=u[1];const P=(H=++u[1])=>(S!==H&&!y.size&&(S=H,j.forEach(([F])=>{const V=F[1](H);V>w&&(w=V)})),w),U=H=>(F,V)=>{const se=[...F];se[1]=[H,...se[1]],x(se,V)},j=new Map,A=(H,F)=>{if(j.has(H))throw new Error("prop listener already exists");if(y.size){const V=F[3](U(H));j.set(H,[F,V])}else j.set(H,[F])},T=H=>{var F;const V=j.get(H);V&&(j.delete(H),(F=V[1])==null||F.call(V))},C=H=>(y.add(H),y.size===1&&j.forEach(([V,se],ce)=>{if(se)throw new Error("remove already exists");const I=V[3](U(ce));j.set(ce,[V,I])}),()=>{y.delete(H),y.size===0&&j.forEach(([V,se],ce)=>{se&&(se(),j.set(ce,[V]))})}),$=Array.isArray(h)?[]:Object.create(Object.getPrototypeOf(h)),d=e($,{deleteProperty(H,F){const V=Reflect.get(H,F);T(F);const se=Reflect.deleteProperty(H,F);return se&&x(["delete",[F],V]),se},set(H,F,V,se){const ce=Reflect.has(H,F),I=Reflect.get(H,F,se);if(ce&&(r(I,V)||c.has(V)&&r(I,c.get(V))))return!0;T(F),eh(V)&&(V=Mx(V)||V);let N=V;if(V instanceof Promise)V.then(X=>{V.status="fulfilled",V.value=X,x(["resolve",[F],X])}).catch(X=>{V.status="rejected",V.reason=X,x(["reject",[F],X])});else{!ci.has(V)&&t(V)&&(N=f(V));const X=!tc.has(N)&&ci.get(N);X&&A(F,X)}return Reflect.set(H,F,N,se),x(["set",[F],V,I]),!0}});c.set(h,d);const b=[$,P,a,C];return ci.set(d,b),Reflect.ownKeys(h).forEach(H=>{const F=Object.getOwnPropertyDescriptor(h,H);"value"in F&&(d[H]=h[H],delete F.value,delete F.writable),Object.defineProperty($,H,F)}),d})=>[f,ci,tc,r,e,t,n,i,a,c,u],[jx]=Ux();function li(r={}){return jx(r)}function zi(r,e,t){const n=ci.get(r);n||console.warn("Please use proxy object");let i;const a=[],c=n[3];let u=!1;const h=c(m=>{if(a.push(m),t){e(a.splice(0));return}i||(i=Promise.resolve().then(()=>{i=void 0,u&&e(a.splice(0))}))});return u=!0,()=>{u=!1,h()}}function Fx(r,e){const t=ci.get(r);t||console.warn("Please use proxy object");const[n,i,a]=t;return a(n,i(),e)}const or=li({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),Pt={state:or,subscribe(r){return zi(or,()=>r(or))},push(r,e){r!==or.view&&(or.view=r,e&&(or.data=e),or.history.push(r))},reset(r){or.view=r,or.history=[r]},replace(r){or.history.length>1&&(or.history[or.history.length-1]=r,or.view=r)},goBack(){if(or.history.length>1){or.history.pop();const[r]=or.history.slice(-1);or.view=r}},setData(r){or.data=r}},we={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return we.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const r=navigator.userAgent.toLowerCase();return we.isMobile()&&(r.includes("iphone")||r.includes("ipad"))},isHttpUrl(r){return r.startsWith("http://")||r.startsWith("https://")},isArray(r){return Array.isArray(r)&&r.length>0},formatNativeUrl(r,e,t){if(we.isHttpUrl(r))return this.formatUniversalUrl(r,e,t);let n=r;n.includes("://")||(n=r.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,t);const i=encodeURIComponent(e);return`${n}wc?uri=${i}`},formatUniversalUrl(r,e,t){if(!we.isHttpUrl(r))return this.formatNativeUrl(r,e,t);let n=r;n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,t);const i=encodeURIComponent(e);return`${n}wc?uri=${i}`},async wait(r){return new Promise(e=>{setTimeout(e,r)})},openHref(r,e){window.open(r,e,"noreferrer noopener")},setWalletConnectDeepLink(r,e){try{localStorage.setItem(we.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:r,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(r){try{const[e]=r.split("?");localStorage.setItem(we.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(we.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(we.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var r;const e=(r=Pt.state.data)==null?void 0:r.Wallet;if(!e)throw new Error('Missing "Wallet" view data');return e}},Bx=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),gr=li({enabled:Bx,userSessionId:"",events:[],connectedWalletId:void 0}),og={state:gr,subscribe(r){return zi(gr.events,()=>r(Fx(gr.events[gr.events.length-1])))},initialize(){gr.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(gr.userSessionId=crypto.randomUUID())},setConnectedWalletId(r){gr.connectedWalletId=r},click(r){if(gr.enabled){const e={type:"CLICK",name:r.name,userSessionId:gr.userSessionId,timestamp:Date.now(),data:r};gr.events.push(e)}},track(r){if(gr.enabled){const e={type:"TRACK",name:r.name,userSessionId:gr.userSessionId,timestamp:Date.now(),data:r};gr.events.push(e)}},view(r){if(gr.enabled){const e={type:"VIEW",name:r.name,userSessionId:gr.userSessionId,timestamp:Date.now(),data:r};gr.events.push(e)}}},In=li({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),zt={state:In,subscribe(r){return zi(In,()=>r(In))},setChains(r){In.chains=r},setWalletConnectUri(r){In.walletConnectUri=r},setIsCustomDesktop(r){In.isCustomDesktop=r},setIsCustomMobile(r){In.isCustomMobile=r},setIsDataLoaded(r){In.isDataLoaded=r},setIsUiLoaded(r){In.isUiLoaded=r},setIsAuth(r){In.isAuth=r}},rc=li({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),Kr={state:rc,subscribe(r){return zi(rc,()=>r(rc))},setConfig(r){var e,t;og.initialize(),zt.setChains(r.chains),zt.setIsAuth(!!r.enableAuthMode),zt.setIsCustomMobile(!!((e=r.mobileWallets)!=null&&e.length)),zt.setIsCustomDesktop(!!((t=r.desktopWallets)!=null&&t.length)),we.setModalVersionInStorage(),Object.assign(rc,r)}};var kx=Object.defineProperty,ag=Object.getOwnPropertySymbols,qx=Object.prototype.hasOwnProperty,zx=Object.prototype.propertyIsEnumerable,cg=(r,e,t)=>e in r?kx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Hx=(r,e)=>{for(var t in e||(e={}))qx.call(e,t)&&cg(r,t,e[t]);if(ag)for(var t of ag(e))zx.call(e,t)&&cg(r,t,e[t]);return r};const th="https://explorer-api.walletconnect.com",rh="wcm",nh="js-2.6.2";async function nc(r,e){const t=Hx({sdkType:rh,sdkVersion:nh},e),n=new URL(r,th);return n.searchParams.append("projectId",Kr.state.projectId),Object.entries(t).forEach(([i,a])=>{a&&n.searchParams.append(i,String(a))}),(await fetch(n)).json()}const Hi={async getDesktopListings(r){return nc("/w3m/v1/getDesktopListings",r)},async getMobileListings(r){return nc("/w3m/v1/getMobileListings",r)},async getInjectedListings(r){return nc("/w3m/v1/getInjectedListings",r)},async getAllListings(r){return nc("/w3m/v1/getAllListings",r)},getWalletImageUrl(r){return`${th}/w3m/v1/getWalletImage/${r}?projectId=${Kr.state.projectId}&sdkType=${rh}&sdkVersion=${nh}`},getAssetImageUrl(r){return`${th}/w3m/v1/getAssetImage/${r}?projectId=${Kr.state.projectId}&sdkType=${rh}&sdkVersion=${nh}`}};var Wx=Object.defineProperty,lg=Object.getOwnPropertySymbols,Kx=Object.prototype.hasOwnProperty,Vx=Object.prototype.propertyIsEnumerable,ug=(r,e,t)=>e in r?Wx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Gx=(r,e)=>{for(var t in e||(e={}))Kx.call(e,t)&&ug(r,t,e[t]);if(lg)for(var t of lg(e))Vx.call(e,t)&&ug(r,t,e[t]);return r};const hg=we.isMobile(),Dn=li({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Lr={state:Dn,async getRecomendedWallets(){const{explorerRecommendedWalletIds:r,explorerExcludedWalletIds:e}=Kr.state;if(r==="NONE"||e==="ALL"&&!r)return Dn.recomendedWallets;if(we.isArray(r)){const t={recommendedIds:r.join(",")},{listings:n}=await Hi.getAllListings(t),i=Object.values(n);i.sort((a,c)=>{const u=r.indexOf(a.id),f=r.indexOf(c.id);return u-f}),Dn.recomendedWallets=i}else{const{chains:t,isAuth:n}=zt.state,i=t?.join(","),a=we.isArray(e),c={page:1,sdks:n?"auth_v1":void 0,entries:we.RECOMMENDED_WALLET_AMOUNT,chains:i,version:2,excludedIds:a?e.join(","):void 0},{listings:u}=hg?await Hi.getMobileListings(c):await Hi.getDesktopListings(c);Dn.recomendedWallets=Object.values(u)}return Dn.recomendedWallets},async getWallets(r){const e=Gx({},r),{explorerRecommendedWalletIds:t,explorerExcludedWalletIds:n}=Kr.state,{recomendedWallets:i}=Dn;if(n==="ALL")return Dn.wallets;i.length?e.excludedIds=i.map(w=>w.id).join(","):we.isArray(t)&&(e.excludedIds=t.join(",")),we.isArray(n)&&(e.excludedIds=[e.excludedIds,n].filter(Boolean).join(",")),zt.state.isAuth&&(e.sdks="auth_v1");const{page:a,search:c}=r,{listings:u,total:f}=hg?await Hi.getMobileListings(e):await Hi.getDesktopListings(e),h=Object.values(u),m=c?"search":"wallets";return Dn[m]={listings:[...Dn[m].listings,...h],total:f,page:a??1},{listings:h,total:f}},getWalletImageUrl(r){return Hi.getWalletImageUrl(r)},getAssetImageUrl(r){return Hi.getAssetImageUrl(r)},resetSearch(){Dn.search={listings:[],total:0,page:1}}},$s=li({open:!1}),Wi={state:$s,subscribe(r){return zi($s,()=>r($s))},async open(r){return new Promise(e=>{const{isUiLoaded:t,isDataLoaded:n}=zt.state;if(we.removeWalletConnectDeepLink(),zt.setWalletConnectUri(r?.uri),zt.setChains(r?.chains),Pt.reset("ConnectWallet"),t&&n)$s.open=!0,e();else{const i=setInterval(()=>{const a=zt.state;a.isUiLoaded&&a.isDataLoaded&&(clearInterval(i),$s.open=!0,e())},200)}})},close(){$s.open=!1}};var Yx=Object.defineProperty,fg=Object.getOwnPropertySymbols,Jx=Object.prototype.hasOwnProperty,Zx=Object.prototype.propertyIsEnumerable,dg=(r,e,t)=>e in r?Yx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Qx=(r,e)=>{for(var t in e||(e={}))Jx.call(e,t)&&dg(r,t,e[t]);if(fg)for(var t of fg(e))Zx.call(e,t)&&dg(r,t,e[t]);return r};function Xx(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const jo=li({themeMode:Xx()?"dark":"light"}),ui={state:jo,subscribe(r){return zi(jo,()=>r(jo))},setThemeConfig(r){const{themeMode:e,themeVariables:t}=r;e&&(jo.themeMode=e),t&&(jo.themeVariables=Qx({},t))}},Ki=li({open:!1,message:"",variant:"success"}),hi={state:Ki,subscribe(r){return zi(Ki,()=>r(Ki))},openToast(r,e){Ki.open=!0,Ki.message=r,Ki.variant=e},closeToast(){Ki.open=!1}};class eI{constructor(e){this.openModal=Wi.open,this.closeModal=Wi.close,this.subscribeModal=Wi.subscribe,this.setTheme=ui.setThemeConfig,ui.setThemeConfig(e),Kr.setConfig(e),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then(function(){return lO});const e=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",e),zt.setIsUiLoaded(!0)}}}var tI=Object.freeze({__proto__:null,WalletConnectModal:eI});/**
|
|
85
|
+
}`;var We=Fy(function(){return lt(S,ye+"return "+oe).apply(t,R)});if(We.source=oe,Pd(We))throw We;return We}function ET(s){return ht(s).toLowerCase()}function xT(s){return ht(s).toUpperCase()}function IT(s,o,l){if(s=ht(s),s&&(l||o===t))return Gm(s);if(!s||!(o=Zr(o)))return s;var p=wn(s),v=wn(o),S=Ym(p,v),R=Zm(p,v)+1;return Ri(p,S,R).join("")}function DT(s,o,l){if(s=ht(s),s&&(l||o===t))return s.slice(0,Qm(s)+1);if(!s||!(o=Zr(o)))return s;var p=wn(s),v=Zm(p,wn(o))+1;return Ri(p,0,v).join("")}function ST(s,o,l){if(s=ht(s),s&&(l||o===t))return s.replace(Ft,"");if(!s||!(o=Zr(o)))return s;var p=wn(s),v=Ym(p,wn(o));return Ri(p,v).join("")}function OT(s,o){var l=F,p=V;if(Rt(o)){var v="separator"in o?o.separator:v;l="length"in o?ze(o.length):l,p="omission"in o?Zr(o.omission):p}s=ht(s);var S=s.length;if(oo(s)){var R=wn(s);S=R.length}if(l>=S)return s;var M=l-ao(p);if(M<1)return p;var q=R?Ri(R,0,M).join(""):s.slice(0,M);if(v===t)return q+p;if(R&&(M+=q.length-M),Td(v)){if(s.slice(M).search(v)){var te,re=q;for(v.global||(v=Gf(v.source,ht(sn.exec(v))+"g")),v.lastIndex=0;te=v.exec(re);)var oe=te.index;q=q.slice(0,oe===t?M:oe)}}else if(s.indexOf(Zr(v),M)!=M){var fe=q.lastIndexOf(v);fe>-1&&(q=q.slice(0,fe))}return q+p}function CT(s){return s=ht(s),s&&Lt.test(s)?s.replace(Ii,n7):s}var $T=go(function(s,o,l){return s+(l?" ":"")+o.toUpperCase()}),Ld=Bv("toUpperCase");function jy(s,o,l){return s=ht(s),o=l?t:o,o===t?QC(s)?o7(s):qC(s):s.match(o)||[]}var Fy=Ge(function(s,o){try{return or(s,t,o)}catch(l){return Pd(l)?l:new Re(l)}}),AT=ti(function(s,o){return an(o,function(l){l=Ln(l),Xn(s,l,$d(s[l],s))}),s});function PT(s){var o=s==null?0:s.length,l=_e();return s=o?At(s,function(p){if(typeof p[1]!="function")throw new cn(c);return[l(p[0]),p[1]]}):[],Ge(function(p){for(var v=-1;++v<o;){var S=s[v];if(or(S[0],this,p))return or(S[1],this,p)}})}function TT(s){return n$(un(s,w))}function Md(s){return function(){return s}}function RT(s,o){return s==null||s!==s?o:s}var NT=zv(),LT=zv(!0);function Fr(s){return s}function Ud(s){return yv(typeof s=="function"?s:un(s,w))}function MT(s){return bv(un(s,w))}function UT(s,o){return _v(s,un(o,w))}var jT=Ge(function(s,o){return function(l){return Ia(l,s,o)}}),FT=Ge(function(s,o){return function(l){return Ia(s,l,o)}});function jd(s,o,l){var p=ar(o),v=_l(o,p);l==null&&!(Rt(o)&&(v.length||!p.length))&&(l=o,o=s,s=this,v=_l(o,ar(o)));var S=!(Rt(l)&&"chain"in l)||!!l.chain,R=ni(s);return an(v,function(M){var q=o[M];s[M]=q,R&&(s.prototype[M]=function(){var te=this.__chain__;if(S||te){var re=s(this.__wrapped__),oe=re.__actions__=Mr(this.__actions__);return oe.push({func:q,args:arguments,thisArg:s}),re.__chain__=te,re}return q.apply(s,Oi([this.value()],arguments))})}),s}function BT(){return nt._===this&&(nt._=f7),this}function Fd(){}function kT(s){return s=ze(s),Ge(function(o){return Ev(o,s)})}var zT=md(At),qT=md(qm),HT=md(kf);function By(s){return xd(s)?zf(Ln(s)):b$(s)}function WT(s){return function(o){return s==null?t:vs(s,o)}}var KT=Hv(),VT=Hv(!0);function Bd(){return[]}function kd(){return!1}function GT(){return{}}function YT(){return""}function ZT(){return!0}function JT(s,o){if(s=ze(s),s<1||s>Y)return[];var l=ie,p=gr(s,ie);o=_e(o),s-=ie;for(var v=Wf(p,o);++l<s;)o(l);return v}function QT(s){return Le(s)?At(s,Ln):Jr(s)?[s]:Mr(oy(ht(s)))}function XT(s){var o=++u7;return ht(s)+o}var eR=Ol(function(s,o){return s+o},0),tR=vd("ceil"),rR=Ol(function(s,o){return s/o},1),nR=vd("floor");function iR(s){return s&&s.length?bl(s,Fr,rd):t}function sR(s,o){return s&&s.length?bl(s,_e(o,2),rd):t}function oR(s){return Km(s,Fr)}function aR(s,o){return Km(s,_e(o,2))}function cR(s){return s&&s.length?bl(s,Fr,od):t}function lR(s,o){return s&&s.length?bl(s,_e(o,2),od):t}var uR=Ol(function(s,o){return s*o},1),hR=vd("round"),fR=Ol(function(s,o){return s-o},0);function dR(s){return s&&s.length?Hf(s,Fr):0}function pR(s,o){return s&&s.length?Hf(s,_e(o,2)):0}return E.after=MP,E.ary=vy,E.assign=x9,E.assignIn=Py,E.assignInWith=Bl,E.assignWith=I9,E.at=D9,E.before=yy,E.bind=$d,E.bindAll=AT,E.bindKey=wy,E.castArray=GP,E.chain=py,E.chunk=nA,E.compact=iA,E.concat=sA,E.cond=PT,E.conforms=TT,E.constant=Md,E.countBy=dP,E.create=S9,E.curry=by,E.curryRight=_y,E.debounce=Ey,E.defaults=O9,E.defaultsDeep=C9,E.defer=UP,E.delay=jP,E.difference=oA,E.differenceBy=aA,E.differenceWith=cA,E.drop=lA,E.dropRight=uA,E.dropRightWhile=hA,E.dropWhile=fA,E.fill=dA,E.filter=gP,E.flatMap=yP,E.flatMapDeep=wP,E.flatMapDepth=bP,E.flatten=uy,E.flattenDeep=pA,E.flattenDepth=gA,E.flip=FP,E.flow=NT,E.flowRight=LT,E.fromPairs=mA,E.functions=L9,E.functionsIn=M9,E.groupBy=_P,E.initial=yA,E.intersection=wA,E.intersectionBy=bA,E.intersectionWith=_A,E.invert=j9,E.invertBy=F9,E.invokeMap=xP,E.iteratee=Ud,E.keyBy=IP,E.keys=ar,E.keysIn=jr,E.map=Nl,E.mapKeys=k9,E.mapValues=z9,E.matches=MT,E.matchesProperty=UT,E.memoize=Ml,E.merge=q9,E.mergeWith=Ty,E.method=jT,E.methodOf=FT,E.mixin=jd,E.negate=Ul,E.nthArg=kT,E.omit=H9,E.omitBy=W9,E.once=BP,E.orderBy=DP,E.over=zT,E.overArgs=kP,E.overEvery=qT,E.overSome=HT,E.partial=Ad,E.partialRight=xy,E.partition=SP,E.pick=K9,E.pickBy=Ry,E.property=By,E.propertyOf=WT,E.pull=DA,E.pullAll=fy,E.pullAllBy=SA,E.pullAllWith=OA,E.pullAt=CA,E.range=KT,E.rangeRight=VT,E.rearg=zP,E.reject=$P,E.remove=$A,E.rest=qP,E.reverse=Od,E.sampleSize=PP,E.set=G9,E.setWith=Y9,E.shuffle=TP,E.slice=AA,E.sortBy=LP,E.sortedUniq=UA,E.sortedUniqBy=jA,E.split=yT,E.spread=HP,E.tail=FA,E.take=BA,E.takeRight=kA,E.takeRightWhile=zA,E.takeWhile=qA,E.tap=iP,E.throttle=WP,E.thru=Rl,E.toArray=Cy,E.toPairs=Ny,E.toPairsIn=Ly,E.toPath=QT,E.toPlainObject=Ay,E.transform=Z9,E.unary=KP,E.union=HA,E.unionBy=WA,E.unionWith=KA,E.uniq=VA,E.uniqBy=GA,E.uniqWith=YA,E.unset=J9,E.unzip=Cd,E.unzipWith=dy,E.update=Q9,E.updateWith=X9,E.values=yo,E.valuesIn=eT,E.without=ZA,E.words=jy,E.wrap=VP,E.xor=JA,E.xorBy=QA,E.xorWith=XA,E.zip=eP,E.zipObject=tP,E.zipObjectDeep=rP,E.zipWith=nP,E.entries=Ny,E.entriesIn=Ly,E.extend=Py,E.extendWith=Bl,jd(E,E),E.add=eR,E.attempt=Fy,E.camelCase=iT,E.capitalize=My,E.ceil=tR,E.clamp=tT,E.clone=YP,E.cloneDeep=JP,E.cloneDeepWith=QP,E.cloneWith=ZP,E.conformsTo=XP,E.deburr=Uy,E.defaultTo=RT,E.divide=rR,E.endsWith=sT,E.eq=_n,E.escape=oT,E.escapeRegExp=aT,E.every=pP,E.find=mP,E.findIndex=cy,E.findKey=$9,E.findLast=vP,E.findLastIndex=ly,E.findLastKey=A9,E.floor=nR,E.forEach=gy,E.forEachRight=my,E.forIn=P9,E.forInRight=T9,E.forOwn=R9,E.forOwnRight=N9,E.get=Rd,E.gt=e9,E.gte=t9,E.has=U9,E.hasIn=Nd,E.head=hy,E.identity=Fr,E.includes=EP,E.indexOf=vA,E.inRange=rT,E.invoke=B9,E.isArguments=bs,E.isArray=Le,E.isArrayBuffer=r9,E.isArrayLike=Ur,E.isArrayLikeObject=Wt,E.isBoolean=n9,E.isBuffer=Ni,E.isDate=i9,E.isElement=s9,E.isEmpty=o9,E.isEqual=a9,E.isEqualWith=c9,E.isError=Pd,E.isFinite=l9,E.isFunction=ni,E.isInteger=Iy,E.isLength=jl,E.isMap=Dy,E.isMatch=u9,E.isMatchWith=h9,E.isNaN=f9,E.isNative=d9,E.isNil=g9,E.isNull=p9,E.isNumber=Sy,E.isObject=Rt,E.isObjectLike=kt,E.isPlainObject=Aa,E.isRegExp=Td,E.isSafeInteger=m9,E.isSet=Oy,E.isString=Fl,E.isSymbol=Jr,E.isTypedArray=vo,E.isUndefined=v9,E.isWeakMap=y9,E.isWeakSet=w9,E.join=EA,E.kebabCase=cT,E.last=fn,E.lastIndexOf=xA,E.lowerCase=lT,E.lowerFirst=uT,E.lt=b9,E.lte=_9,E.max=iR,E.maxBy=sR,E.mean=oR,E.meanBy=aR,E.min=cR,E.minBy=lR,E.stubArray=Bd,E.stubFalse=kd,E.stubObject=GT,E.stubString=YT,E.stubTrue=ZT,E.multiply=uR,E.nth=IA,E.noConflict=BT,E.noop=Fd,E.now=Ll,E.pad=hT,E.padEnd=fT,E.padStart=dT,E.parseInt=pT,E.random=nT,E.reduce=OP,E.reduceRight=CP,E.repeat=gT,E.replace=mT,E.result=V9,E.round=hR,E.runInContext=z,E.sample=AP,E.size=RP,E.snakeCase=vT,E.some=NP,E.sortedIndex=PA,E.sortedIndexBy=TA,E.sortedIndexOf=RA,E.sortedLastIndex=NA,E.sortedLastIndexBy=LA,E.sortedLastIndexOf=MA,E.startCase=wT,E.startsWith=bT,E.subtract=fR,E.sum=dR,E.sumBy=pR,E.template=_T,E.times=JT,E.toFinite=ii,E.toInteger=ze,E.toLength=$y,E.toLower=ET,E.toNumber=dn,E.toSafeInteger=E9,E.toString=ht,E.toUpper=xT,E.trim=IT,E.trimEnd=DT,E.trimStart=ST,E.truncate=OT,E.unescape=CT,E.uniqueId=XT,E.upperCase=$T,E.upperFirst=Ld,E.each=gy,E.eachRight=my,E.first=hy,jd(E,function(){var s={};return Rn(E,function(o,l){ft.call(E.prototype,l)||(s[l]=o)}),s}(),{chain:!1}),E.VERSION=n,an(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){E[s].placeholder=E}),an(["drop","take"],function(s,o){et.prototype[s]=function(l){l=l===t?1:rr(ze(l),0);var p=this.__filtered__&&!o?new et(this):this.clone();return p.__filtered__?p.__takeCount__=gr(l,p.__takeCount__):p.__views__.push({size:gr(l,ie),type:s+(p.__dir__<0?"Right":"")}),p},et.prototype[s+"Right"]=function(l){return this.reverse()[s](l).reverse()}}),an(["filter","map","takeWhile"],function(s,o){var l=o+1,p=l==D||l==X;et.prototype[s]=function(v){var S=this.clone();return S.__iteratees__.push({iteratee:_e(v,3),type:l}),S.__filtered__=S.__filtered__||p,S}}),an(["head","last"],function(s,o){var l="take"+(o?"Right":"");et.prototype[s]=function(){return this[l](1).value()[0]}}),an(["initial","tail"],function(s,o){var l="drop"+(o?"":"Right");et.prototype[s]=function(){return this.__filtered__?new et(this):this[l](1)}}),et.prototype.compact=function(){return this.filter(Fr)},et.prototype.find=function(s){return this.filter(s).head()},et.prototype.findLast=function(s){return this.reverse().find(s)},et.prototype.invokeMap=Ge(function(s,o){return typeof s=="function"?new et(this):this.map(function(l){return Ia(l,s,o)})}),et.prototype.reject=function(s){return this.filter(Ul(_e(s)))},et.prototype.slice=function(s,o){s=ze(s);var l=this;return l.__filtered__&&(s>0||o<0)?new et(l):(s<0?l=l.takeRight(-s):s&&(l=l.drop(s)),o!==t&&(o=ze(o),l=o<0?l.dropRight(-o):l.take(o-s)),l)},et.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},et.prototype.toArray=function(){return this.take(ie)},Rn(et.prototype,function(s,o){var l=/^(?:filter|find|map|reject)|While$/.test(o),p=/^(?:head|last)$/.test(o),v=E[p?"take"+(o=="last"?"Right":""):o],S=p||/^find/.test(o);v&&(E.prototype[o]=function(){var R=this.__wrapped__,M=p?[1]:arguments,q=R instanceof et,te=M[0],re=q||Le(R),oe=function(Qe){var it=v.apply(E,Oi([Qe],M));return p&&fe?it[0]:it};re&&l&&typeof te=="function"&&te.length!=1&&(q=re=!1);var fe=this.__chain__,ye=!!this.__actions__.length,Ie=S&&!fe,We=q&&!ye;if(!S&&re){R=We?R:new et(this);var De=s.apply(R,M);return De.__actions__.push({func:Rl,args:[oe],thisArg:t}),new ln(De,fe)}return Ie&&We?s.apply(this,M):(De=this.thru(oe),Ie?p?De.value()[0]:De.value():De)})}),an(["pop","push","shift","sort","splice","unshift"],function(s){var o=sl[s],l=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",p=/^(?:pop|shift)$/.test(s);E.prototype[s]=function(){var v=arguments;if(p&&!this.__chain__){var S=this.value();return o.apply(Le(S)?S:[],v)}return this[l](function(R){return o.apply(Le(R)?R:[],v)})}}),Rn(et.prototype,function(s,o){var l=E[o];if(l){var p=l.name+"";ft.call(ho,p)||(ho[p]=[]),ho[p].push({name:o,func:l})}}),ho[Sl(t,j).name]=[{name:"wrapper",func:t}],et.prototype.clone=C7,et.prototype.reverse=$7,et.prototype.value=A7,E.prototype.at=sP,E.prototype.chain=oP,E.prototype.commit=aP,E.prototype.next=cP,E.prototype.plant=uP,E.prototype.reverse=hP,E.prototype.toJSON=E.prototype.valueOf=E.prototype.value=fP,E.prototype.first=E.prototype.head,va&&(E.prototype[va]=lP),E},co=a7();Ht?((Ht.exports=co)._=co,yt._=co):nt._=co}).call(Wo)})(rh,rh.exports);var Cx=Object.defineProperty,$x=Object.defineProperties,Ax=Object.getOwnPropertyDescriptors,s1=Object.getOwnPropertySymbols,Px=Object.prototype.hasOwnProperty,Tx=Object.prototype.propertyIsEnumerable,o1=(r,e,t)=>e in r?Cx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,sc=(r,e)=>{for(var t in e||(e={}))Px.call(e,t)&&o1(r,t,e[t]);if(s1)for(var t of s1(e))Tx.call(e,t)&&o1(r,t,e[t]);return r},Rx=(r,e)=>$x(r,Ax(e));function hi(r,e,t){var n;const i=u_(r);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${Ox}?chainId=${i.namespace}:${i.reference}&projectId=${t}`}function Vi(r){return r.includes(":")?r.split(":")[1]:r}function a1(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Nx(r,e){const t=Object.keys(e.namespaces).filter(i=>i.includes(r));if(!t.length)return[];const n=[];return t.forEach(i=>{const a=e.namespaces[i].accounts;n.push(...a)}),n}function c1(r={},e={}){const t=l1(r),n=l1(e);return rh.exports.merge(t,n)}function l1(r){var e,t,n,i;const a={};if(!Po(r))return a;for(const[c,u]of Object.entries(r)){const f=yu(c)?[c]:u.chains,h=u.methods||[],m=u.events||[],w=u.rpcMap||{},y=Ao(c);a[y]=Rx(sc(sc({},a[y]),u),{chains:mu(f,(e=a[y])==null?void 0:e.chains),methods:mu(h,(t=a[y])==null?void 0:t.methods),events:mu(m,(n=a[y])==null?void 0:n.events),rpcMap:sc(sc({},w),(i=a[y])==null?void 0:i.rpcMap)})}return a}function Lx(r){return r.includes(":")?r.split(":")[2]:r}function Mx(r){const e={};for(const[t,n]of Object.entries(r)){const i=n.methods||[],a=n.events||[],c=n.accounts||[],u=yu(t)?[t]:n.chains?n.chains:a1(n.accounts);e[t]={chains:u,methods:i,events:a,accounts:c}}return e}function nh(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):(r=r.includes(":")?r.split(":")[1]:r,isNaN(Number(r))?r:Number(r))}const u1={},Dt=r=>u1[r],ih=(r,e)=>{u1[r]=e};class Ux{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Dt("events"),this.client=Dt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Hn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const i=Vi(t);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||hi(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Bn(new ui(n,Dt("disableProviderPing")))}}class jx{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Dt("events"),this.client=Dt("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(Hn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const n=t||hi(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Bn(new ui(n,Dt("disableProviderPing")))}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const i=parseInt(Vi(t));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,n;let i=e.request.params?(t=e.request.params[0])==null?void 0:t.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const a=parseInt(i,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}}class Fx{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Dt("events"),this.client=Dt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Hn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const i=Vi(t);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||hi(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Bn(new ui(n,Dt("disableProviderPing")))}}class Bx{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Dt("events"),this.client=Dt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Hn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const i=Vi(t);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||hi(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Bn(new ui(n,Dt("disableProviderPing")))}}class kx{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Dt("events"),this.client=Dt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Hn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{const n=this.getCardanoRPCUrl(t),i=Vi(t);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Bn(new ui(n,Dt("disableProviderPing")))}}class zx{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Dt("events"),this.client=Dt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Hn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const i=Vi(t);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||hi(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Bn(new ui(n,Dt("disableProviderPing")))}}class qx{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Dt("events"),this.client=Dt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(Hn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;const i=Vi(t);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||hi(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new Bn(new ui(n,Dt("disableProviderPing")))}}class Hx{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Dt("events"),this.client=Dt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const n=t||hi(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(Hn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var n;e[t]=this.createHttpProvider(t,(n=this.namespace.rpcMap)==null?void 0:n[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||hi(e,this.namespace);return typeof n>"u"?void 0:new Bn(new ui(n,Dt("disableProviderPing")))}}var Wx=Object.defineProperty,Kx=Object.defineProperties,Vx=Object.getOwnPropertyDescriptors,h1=Object.getOwnPropertySymbols,Gx=Object.prototype.hasOwnProperty,Yx=Object.prototype.propertyIsEnumerable,f1=(r,e,t)=>e in r?Wx(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,oc=(r,e)=>{for(var t in e||(e={}))Gx.call(e,t)&&f1(r,t,e[t]);if(h1)for(var t of h1(e))Yx.call(e,t)&&f1(r,t,e[t]);return r},sh=(r,e)=>Kx(r,Vx(e));class oh{constructor(e){this.events=new cr.exports,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Wi.pino(Wi.getDefaultLoggerOptions({level:e?.logger||n1})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){const t=new oh(e);return await t.initialize(),t}async request(e,t,n){const[i,a]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:oc({},e),chainId:`${i}:${a}`,topic:this.session.topic,expiry:n})}sendAsync(e,t,n,i){const a=new Date().getTime();this.request(e,n,i).then(c=>t(null,Xa(a,c))).catch(c=>t(c,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Et("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(a=>{this.session=a;const c=Mx(a.namespaces);this.namespaces=c1(this.namespaces,c),this.persist("namespaces",this.namespaces)}).catch(a=>{if(a.message!==Jg)throw a;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[n,i]=this.validateChain(e);this.getProvider(n).setDefaultChain(i,t)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(In(t)){for(const n of t)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await eh.init({logger:this.providerOpts.logger||n1,relayUrl:this.providerOpts.relayUrl||Ix,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(t=>Ao(t)))];ih("client",this.client),ih("events",this.events),ih("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const n=Nx(t,this.session),i=a1(n),a=c1(this.namespaces,this.optionalNamespaces),c=sh(oc({},a[t]),{accounts:n,chains:i});switch(t){case"eip155":this.rpcProviders[t]=new jx({namespace:c});break;case"solana":this.rpcProviders[t]=new Fx({namespace:c});break;case"cosmos":this.rpcProviders[t]=new Bx({namespace:c});break;case"polkadot":this.rpcProviders[t]=new Ux({namespace:c});break;case"cip34":this.rpcProviders[t]=new kx({namespace:c});break;case"elrond":this.rpcProviders[t]=new zx({namespace:c});break;case"multiversx":this.rpcProviders[t]=new qx({namespace:c});break;case"near":this.rpcProviders[t]=new Hx({namespace:c});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:t}=e,{event:n}=t;if(n.name==="accountsChanged"){const i=n.data;i&&In(i)&&this.events.emit("accountsChanged",i.map(Lx))}else if(n.name==="chainChanged"){const i=t.chainId,a=t.event.data,c=Ao(i),u=nh(i)!==nh(a)?`${c}:${nh(a)}`:i;this.onChainChanged(u)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var n;const{namespaces:i}=t,a=(n=this.client)==null?void 0:n.session.get(e);this.session=sh(oc({},a),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",sh(oc({},Et("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Hn.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){if(!this.rpcProviders[e])throw new Error(`Provider not found: ${e}`);return this.rpcProviders[e]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace((t=this.session)==null?void 0:t.namespaces[e])})}setNamespaces(e){const{namespaces:t,optionalNamespaces:n,sessionProperties:i}=e;t&&Object.keys(t).length&&(this.namespaces=t),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",t),this.persist("optionalNamespaces",n)}validateChain(e){const[t,n]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,n];if(t&&!Object.keys(this.namespaces||{}).map(c=>Ao(c)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&n)return[t,n];const i=Ao(Object.keys(this.namespaces)[0]),a=this.rpcProviders[i].getDefaultChain();return[i,a]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(t||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${i1}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${i1}/${e}`)}}const Zx=oh,Jx="wc",Qx="ethereum_provider",Xx=`${Jx}@2:${Qx}:`,eI="https://rpc.walletconnect.com/v1/",ac=["eth_sendTransaction","personal_sign"],d1=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],cc=["chainChanged","accountsChanged"],p1=["chainChanged","accountsChanged","message","disconnect","connect"];var tI=Object.defineProperty,rI=Object.defineProperties,nI=Object.getOwnPropertyDescriptors,g1=Object.getOwnPropertySymbols,iI=Object.prototype.hasOwnProperty,sI=Object.prototype.propertyIsEnumerable,m1=(r,e,t)=>e in r?tI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ko=(r,e)=>{for(var t in e||(e={}))iI.call(e,t)&&m1(r,t,e[t]);if(g1)for(var t of g1(e))sI.call(e,t)&&m1(r,t,e[t]);return r},v1=(r,e)=>rI(r,nI(e));function lc(r){return Number(r[0].split(":")[1])}function ah(r){return`0x${r.toString(16)}`}function oI(r){const{chains:e,optionalChains:t,methods:n,optionalMethods:i,events:a,optionalEvents:c,rpcMap:u}=r;if(!In(e))throw new Error("Invalid chains");const f={chains:e,methods:n||ac,events:a||cc,rpcMap:Ko({},e.length?{[lc(e)]:u[lc(e)]}:{})},h=a?.filter(b=>!cc.includes(b)),m=n?.filter(b=>!ac.includes(b));if(!t&&!c&&!i&&!(h!=null&&h.length)&&!(m!=null&&m.length))return{required:e.length?f:void 0};const w=h?.length&&m?.length||!t,y={chains:[...new Set(w?f.chains.concat(t||[]):t)],methods:[...new Set(f.methods.concat(i!=null&&i.length?i:d1))],events:[...new Set(f.events.concat(c!=null&&c.length?c:p1))],rpcMap:u};return{required:e.length?f:void 0,optional:t.length?y:void 0}}class uc{constructor(){this.events=new cr.exports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=Xx,this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const t=new uc;return await t.initialize(e),t}async request(e,t){return await this.signer.request(e,this.formatChainId(this.chainId),t)}sendAsync(e,t,n){this.signer.sendAsync(e,t,this.formatChainId(this.chainId),n)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:n}=oI(this.rpc);try{const i=await new Promise(async(c,u)=>{var f;this.rpc.showQrModal&&((f=this.modal)==null||f.subscribeModal(h=>{!h.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),u(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(v1(Ko({namespaces:Ko({},t&&{[this.namespace]:t})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:e?.pairingTopic})).then(h=>{c(h)}).catch(h=>{u(new Error(h.message))})});if(!i)return;const a=h_(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:ah(this.chainId)})}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:t}=e,{event:n}=t;n.name==="accountsChanged"?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):n.name==="chainChanged"?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",ah(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",v1(Ko({},Et("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var t,n;this.rpc.showQrModal&&((t=this.modal)==null||t.closeModal(),(n=this.modal)==null||n.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const t=e.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",ah(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,n,i]=e.split(":");return{chainId:`${t}:${n}`,address:i}}setAccounts(e){this.accounts=e.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,n;const i=(t=e?.chains)!=null?t:[],a=(n=e?.optionalChains)!=null?n:[],c=i.concat(a);if(!c.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const u=i.length?e?.methods||ac:[],f=i.length?e?.events||cc:[],h=e?.optionalMethods||[],m=e?.optionalEvents||[],w=e?.rpcMap||this.buildRpcMap(c,e.projectId),y=e?.qrModalOptions||void 0;return{chains:i?.map(b=>this.formatChainId(b)),optionalChains:a.map(b=>this.formatChainId(b)),methods:u,events:f,optionalMethods:h,optionalEvents:m,rpcMap:w,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:y,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const n={};return e.forEach(i=>{n[i]=this.getRpcUrl(i,t)}),n}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?lc(this.rpc.chains):lc(this.rpc.optionalChains),this.signer=await Zx.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{const{WalletConnectModal:n}=await Promise.resolve().then(function(){return $I});t=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(Ko({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:n,rpcMap:i}=e;t&&In(t)&&(this.rpc.chains=t.map(a=>this.formatChainId(a)),t.forEach(a=>{this.rpc.rpcMap[a]=i?.[a]||this.getRpcUrl(a)})),n&&In(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n?.map(a=>this.formatChainId(a)),n.forEach(a=>{this.rpc.rpcMap[a]=i?.[a]||this.getRpcUrl(a)}))}getRpcUrl(e,t){var n;return((n=this.rpc.rpcMap)==null?void 0:n[e])||`${eI}?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t?.accounts),this.setAccounts(t?.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(t=>this.parseAccount(t))}}const aI=uc,cI=Symbol(),y1=Object.getPrototypeOf,ch=new WeakMap,lI=r=>r&&(ch.has(r)?ch.get(r):y1(r)===Object.prototype||y1(r)===Array.prototype),uI=r=>lI(r)&&r[cI]||null,w1=(r,e=!0)=>{ch.set(r,e)},lh=r=>typeof r=="object"&&r!==null,fi=new WeakMap,hc=new WeakSet,hI=(r=Object.is,e=(h,m)=>new Proxy(h,m),t=h=>lh(h)&&!hc.has(h)&&(Array.isArray(h)||!(Symbol.iterator in h))&&!(h instanceof WeakMap)&&!(h instanceof WeakSet)&&!(h instanceof Error)&&!(h instanceof Number)&&!(h instanceof Date)&&!(h instanceof String)&&!(h instanceof RegExp)&&!(h instanceof ArrayBuffer),n=h=>{switch(h.status){case"fulfilled":return h.value;case"rejected":throw h.reason;default:throw h}},i=new WeakMap,a=(h,m,w=n)=>{const y=i.get(h);if(y?.[0]===m)return y[1];const b=Array.isArray(h)?[]:Object.create(Object.getPrototypeOf(h));return w1(b,!0),i.set(h,[m,b]),Reflect.ownKeys(h).forEach(I=>{if(Object.getOwnPropertyDescriptor(b,I))return;const A=Reflect.get(h,I),U={value:A,enumerable:!0,configurable:!0};if(hc.has(A))w1(A,!1);else if(A instanceof Promise)delete U.value,U.get=()=>w(A);else if(fi.has(A)){const[j,$]=fi.get(A);U.value=a(j,$(),w)}Object.defineProperty(b,I,U)}),Object.preventExtensions(b)},c=new WeakMap,u=[1,1],f=h=>{if(!lh(h))throw new Error("object required");const m=c.get(h);if(m)return m;let w=u[0];const y=new Set,b=(H,F=++u[0])=>{w!==F&&(w=F,y.forEach(V=>V(H,F)))};let I=u[1];const A=(H=++u[1])=>(I!==H&&!y.size&&(I=H,j.forEach(([F])=>{const V=F[1](H);V>w&&(w=V)})),w),U=H=>(F,V)=>{const se=[...F];se[1]=[H,...se[1]],b(se,V)},j=new Map,$=(H,F)=>{if(j.has(H))throw new Error("prop listener already exists");if(y.size){const V=F[3](U(H));j.set(H,[F,V])}else j.set(H,[F])},T=H=>{var F;const V=j.get(H);V&&(j.delete(H),(F=V[1])==null||F.call(V))},O=H=>(y.add(H),y.size===1&&j.forEach(([V,se],ce)=>{if(se)throw new Error("remove already exists");const D=V[3](U(ce));j.set(ce,[V,D])}),()=>{y.delete(H),y.size===0&&j.forEach(([V,se],ce)=>{se&&(se(),j.set(ce,[V]))})}),P=Array.isArray(h)?[]:Object.create(Object.getPrototypeOf(h)),d=e(P,{deleteProperty(H,F){const V=Reflect.get(H,F);T(F);const se=Reflect.deleteProperty(H,F);return se&&b(["delete",[F],V]),se},set(H,F,V,se){const ce=Reflect.has(H,F),D=Reflect.get(H,F,se);if(ce&&(r(D,V)||c.has(V)&&r(D,c.get(V))))return!0;T(F),lh(V)&&(V=uI(V)||V);let N=V;if(V instanceof Promise)V.then(X=>{V.status="fulfilled",V.value=X,b(["resolve",[F],X])}).catch(X=>{V.status="rejected",V.reason=X,b(["reject",[F],X])});else{!fi.has(V)&&t(V)&&(N=f(V));const X=!hc.has(N)&&fi.get(N);X&&$(F,X)}return Reflect.set(H,F,N,se),b(["set",[F],V,D]),!0}});c.set(h,d);const _=[P,A,a,O];return fi.set(d,_),Reflect.ownKeys(h).forEach(H=>{const F=Object.getOwnPropertyDescriptor(h,H);"value"in F&&(d[H]=h[H],delete F.value,delete F.writable),Object.defineProperty(P,H,F)}),d})=>[f,fi,hc,r,e,t,n,i,a,c,u],[fI]=hI();function di(r={}){return fI(r)}function Gi(r,e,t){const n=fi.get(r);n||console.warn("Please use proxy object");let i;const a=[],c=n[3];let u=!1;const h=c(m=>{if(a.push(m),t){e(a.splice(0));return}i||(i=Promise.resolve().then(()=>{i=void 0,u&&e(a.splice(0))}))});return u=!0,()=>{u=!1,h()}}function dI(r,e){const t=fi.get(r);t||console.warn("Please use proxy object");const[n,i,a]=t;return a(n,i(),e)}const sr=di({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),Pt={state:sr,subscribe(r){return Gi(sr,()=>r(sr))},push(r,e){r!==sr.view&&(sr.view=r,e&&(sr.data=e),sr.history.push(r))},reset(r){sr.view=r,sr.history=[r]},replace(r){sr.history.length>1&&(sr.history[sr.history.length-1]=r,sr.view=r)},goBack(){if(sr.history.length>1){sr.history.pop();const[r]=sr.history.slice(-1);sr.view=r}},setData(r){sr.data=r}},we={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return we.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const r=navigator.userAgent.toLowerCase();return we.isMobile()&&(r.includes("iphone")||r.includes("ipad"))},isHttpUrl(r){return r.startsWith("http://")||r.startsWith("https://")},isArray(r){return Array.isArray(r)&&r.length>0},formatNativeUrl(r,e,t){if(we.isHttpUrl(r))return this.formatUniversalUrl(r,e,t);let n=r;n.includes("://")||(n=r.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,t);const i=encodeURIComponent(e);return`${n}wc?uri=${i}`},formatUniversalUrl(r,e,t){if(!we.isHttpUrl(r))return this.formatNativeUrl(r,e,t);let n=r;n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,t);const i=encodeURIComponent(e);return`${n}wc?uri=${i}`},async wait(r){return new Promise(e=>{setTimeout(e,r)})},openHref(r,e){window.open(r,e,"noreferrer noopener")},setWalletConnectDeepLink(r,e){try{localStorage.setItem(we.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:r,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(r){try{const[e]=r.split("?");localStorage.setItem(we.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(we.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(we.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var r;const e=(r=Pt.state.data)==null?void 0:r.Wallet;if(!e)throw new Error('Missing "Wallet" view data');return e}},pI=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),pr=di({enabled:pI,userSessionId:"",events:[],connectedWalletId:void 0}),b1={state:pr,subscribe(r){return Gi(pr.events,()=>r(dI(pr.events[pr.events.length-1])))},initialize(){pr.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(pr.userSessionId=crypto.randomUUID())},setConnectedWalletId(r){pr.connectedWalletId=r},click(r){if(pr.enabled){const e={type:"CLICK",name:r.name,userSessionId:pr.userSessionId,timestamp:Date.now(),data:r};pr.events.push(e)}},track(r){if(pr.enabled){const e={type:"TRACK",name:r.name,userSessionId:pr.userSessionId,timestamp:Date.now(),data:r};pr.events.push(e)}},view(r){if(pr.enabled){const e={type:"VIEW",name:r.name,userSessionId:pr.userSessionId,timestamp:Date.now(),data:r};pr.events.push(e)}}},Sn=di({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),zt={state:Sn,subscribe(r){return Gi(Sn,()=>r(Sn))},setChains(r){Sn.chains=r},setWalletConnectUri(r){Sn.walletConnectUri=r},setIsCustomDesktop(r){Sn.isCustomDesktop=r},setIsCustomMobile(r){Sn.isCustomMobile=r},setIsDataLoaded(r){Sn.isDataLoaded=r},setIsUiLoaded(r){Sn.isUiLoaded=r},setIsAuth(r){Sn.isAuth=r}},fc=di({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),Kr={state:fc,subscribe(r){return Gi(fc,()=>r(fc))},setConfig(r){var e,t;b1.initialize(),zt.setChains(r.chains),zt.setIsAuth(!!r.enableAuthMode),zt.setIsCustomMobile(!!((e=r.mobileWallets)!=null&&e.length)),zt.setIsCustomDesktop(!!((t=r.desktopWallets)!=null&&t.length)),we.setModalVersionInStorage(),Object.assign(fc,r)}};var gI=Object.defineProperty,_1=Object.getOwnPropertySymbols,mI=Object.prototype.hasOwnProperty,vI=Object.prototype.propertyIsEnumerable,E1=(r,e,t)=>e in r?gI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,yI=(r,e)=>{for(var t in e||(e={}))mI.call(e,t)&&E1(r,t,e[t]);if(_1)for(var t of _1(e))vI.call(e,t)&&E1(r,t,e[t]);return r};const uh="https://explorer-api.walletconnect.com",hh="wcm",fh="js-2.6.2";async function dc(r,e){const t=yI({sdkType:hh,sdkVersion:fh},e),n=new URL(r,uh);return n.searchParams.append("projectId",Kr.state.projectId),Object.entries(t).forEach(([i,a])=>{a&&n.searchParams.append(i,String(a))}),(await fetch(n)).json()}const Yi={async getDesktopListings(r){return dc("/w3m/v1/getDesktopListings",r)},async getMobileListings(r){return dc("/w3m/v1/getMobileListings",r)},async getInjectedListings(r){return dc("/w3m/v1/getInjectedListings",r)},async getAllListings(r){return dc("/w3m/v1/getAllListings",r)},getWalletImageUrl(r){return`${uh}/w3m/v1/getWalletImage/${r}?projectId=${Kr.state.projectId}&sdkType=${hh}&sdkVersion=${fh}`},getAssetImageUrl(r){return`${uh}/w3m/v1/getAssetImage/${r}?projectId=${Kr.state.projectId}&sdkType=${hh}&sdkVersion=${fh}`}};var wI=Object.defineProperty,x1=Object.getOwnPropertySymbols,bI=Object.prototype.hasOwnProperty,_I=Object.prototype.propertyIsEnumerable,I1=(r,e,t)=>e in r?wI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,EI=(r,e)=>{for(var t in e||(e={}))bI.call(e,t)&&I1(r,t,e[t]);if(x1)for(var t of x1(e))_I.call(e,t)&&I1(r,t,e[t]);return r};const D1=we.isMobile(),On=di({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Tr={state:On,async getRecomendedWallets(){const{explorerRecommendedWalletIds:r,explorerExcludedWalletIds:e}=Kr.state;if(r==="NONE"||e==="ALL"&&!r)return On.recomendedWallets;if(we.isArray(r)){const t={recommendedIds:r.join(",")},{listings:n}=await Yi.getAllListings(t),i=Object.values(n);i.sort((a,c)=>{const u=r.indexOf(a.id),f=r.indexOf(c.id);return u-f}),On.recomendedWallets=i}else{const{chains:t,isAuth:n}=zt.state,i=t?.join(","),a=we.isArray(e),c={page:1,sdks:n?"auth_v1":void 0,entries:we.RECOMMENDED_WALLET_AMOUNT,chains:i,version:2,excludedIds:a?e.join(","):void 0},{listings:u}=D1?await Yi.getMobileListings(c):await Yi.getDesktopListings(c);On.recomendedWallets=Object.values(u)}return On.recomendedWallets},async getWallets(r){const e=EI({},r),{explorerRecommendedWalletIds:t,explorerExcludedWalletIds:n}=Kr.state,{recomendedWallets:i}=On;if(n==="ALL")return On.wallets;i.length?e.excludedIds=i.map(w=>w.id).join(","):we.isArray(t)&&(e.excludedIds=t.join(",")),we.isArray(n)&&(e.excludedIds=[e.excludedIds,n].filter(Boolean).join(",")),zt.state.isAuth&&(e.sdks="auth_v1");const{page:a,search:c}=r,{listings:u,total:f}=D1?await Yi.getMobileListings(e):await Yi.getDesktopListings(e),h=Object.values(u),m=c?"search":"wallets";return On[m]={listings:[...On[m].listings,...h],total:f,page:a??1},{listings:h,total:f}},getWalletImageUrl(r){return Yi.getWalletImageUrl(r)},getAssetImageUrl(r){return Yi.getAssetImageUrl(r)},resetSearch(){On.search={listings:[],total:0,page:1}}},Ls=di({open:!1}),Zi={state:Ls,subscribe(r){return Gi(Ls,()=>r(Ls))},async open(r){return new Promise(e=>{const{isUiLoaded:t,isDataLoaded:n}=zt.state;if(we.removeWalletConnectDeepLink(),zt.setWalletConnectUri(r?.uri),zt.setChains(r?.chains),Pt.reset("ConnectWallet"),t&&n)Ls.open=!0,e();else{const i=setInterval(()=>{const a=zt.state;a.isUiLoaded&&a.isDataLoaded&&(clearInterval(i),Ls.open=!0,e())},200)}})},close(){Ls.open=!1}};var xI=Object.defineProperty,S1=Object.getOwnPropertySymbols,II=Object.prototype.hasOwnProperty,DI=Object.prototype.propertyIsEnumerable,O1=(r,e,t)=>e in r?xI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,SI=(r,e)=>{for(var t in e||(e={}))II.call(e,t)&&O1(r,t,e[t]);if(S1)for(var t of S1(e))DI.call(e,t)&&O1(r,t,e[t]);return r};function OI(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const Vo=di({themeMode:OI()?"dark":"light"}),pi={state:Vo,subscribe(r){return Gi(Vo,()=>r(Vo))},setThemeConfig(r){const{themeMode:e,themeVariables:t}=r;e&&(Vo.themeMode=e),t&&(Vo.themeVariables=SI({},t))}},Ji=di({open:!1,message:"",variant:"success"}),gi={state:Ji,subscribe(r){return Gi(Ji,()=>r(Ji))},openToast(r,e){Ji.open=!0,Ji.message=r,Ji.variant=e},closeToast(){Ji.open=!1}};class CI{constructor(e){this.openModal=Zi.open,this.closeModal=Zi.close,this.subscribeModal=Zi.subscribe,this.setTheme=pi.setThemeConfig,pi.setThemeConfig(e),Kr.setConfig(e),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then(function(){return UC});const e=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",e),zt.setIsUiLoaded(!0)}}}var $I=Object.freeze({__proto__:null,WalletConnectModal:CI});/**
|
|
86
86
|
* @license
|
|
87
87
|
* Copyright 2019 Google LLC
|
|
88
88
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
89
|
-
*/const
|
|
89
|
+
*/const pc=window,dh=pc.ShadowRoot&&(pc.ShadyCSS===void 0||pc.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ph=Symbol(),C1=new WeakMap;class $1{constructor(e,t,n){if(this._$cssResult$=!0,n!==ph)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(dh&&e===void 0){const n=t!==void 0&&t.length===1;n&&(e=C1.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&C1.set(t,e))}return e}toString(){return this.cssText}}const AI=r=>new $1(typeof r=="string"?r:r+"",void 0,ph),ct=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((n,i,a)=>n+(c=>{if(c._$cssResult$===!0)return c.cssText;if(typeof c=="number")return c;throw Error("Value passed to 'css' function must be a 'css' function result: "+c+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[a+1],r[0]);return new $1(t,r,ph)},PI=(r,e)=>{dh?r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{const n=document.createElement("style"),i=pc.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)})},A1=dh?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return AI(t)})(r):r;/**
|
|
90
90
|
* @license
|
|
91
91
|
* Copyright 2017 Google LLC
|
|
92
92
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
93
|
-
*/var
|
|
93
|
+
*/var gh;const gc=window,P1=gc.trustedTypes,TI=P1?P1.emptyScript:"",T1=gc.reactiveElementPolyfillSupport,mh={toAttribute(r,e){switch(e){case Boolean:r=r?TI:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},R1=(r,e)=>e!==r&&(e==e||r==r),vh={attribute:!0,type:String,converter:mh,reflect:!1,hasChanged:R1},yh="finalized";class Ms extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach((t,n)=>{const i=this._$Ep(n,t);i!==void 0&&(this._$Ev.set(i,n),e.push(i))}),e}static createProperty(e,t=vh){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const n=typeof e=="symbol"?Symbol():"__"+e,i=this.getPropertyDescriptor(e,n,t);i!==void 0&&Object.defineProperty(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(i){const a=this[e];this[t]=i,this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||vh}static finalize(){if(this.hasOwnProperty(yh))return!1;this[yh]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,n=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of n)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(A1(i))}else e!==void 0&&t.push(A1(e));return t}static _$Ep(e,t){const n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(t=>t(this))}addController(e){var t,n;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.call(e))}removeController(e){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var e;const t=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return PI(t,this.constructor.elementStyles),t}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(t=>{var n;return(n=t.hostConnected)===null||n===void 0?void 0:n.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var n;return(n=t.hostDisconnected)===null||n===void 0?void 0:n.call(t)})}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=vh){var i;const a=this.constructor._$Ep(e,n);if(a!==void 0&&n.reflect===!0){const c=(((i=n.converter)===null||i===void 0?void 0:i.toAttribute)!==void 0?n.converter:mh).toAttribute(t,n.type);this._$El=e,c==null?this.removeAttribute(a):this.setAttribute(a,c),this._$El=null}}_$AK(e,t){var n;const i=this.constructor,a=i._$Ev.get(e);if(a!==void 0&&this._$El!==a){const c=i.getPropertyOptions(a),u=typeof c.converter=="function"?{fromAttribute:c.converter}:((n=c.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?c.converter:mh;this._$El=a,this[a]=u.fromAttribute(t,c.type),this._$El=null}}requestUpdate(e,t,n){let i=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||R1)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):i=!1),!this.isUpdatePending&&i&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((i,a)=>this[a]=i),this._$Ei=void 0);let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach(i=>{var a;return(a=i.hostUpdate)===null||a===void 0?void 0:a.call(i)}),this.update(n)):this._$Ek()}catch(i){throw t=!1,this._$Ek(),i}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(n=>{var i;return(i=n.hostUpdated)===null||i===void 0?void 0:i.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((t,n)=>this._$EO(n,this[n],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}Ms[yh]=!0,Ms.elementProperties=new Map,Ms.elementStyles=[],Ms.shadowRootOptions={mode:"open"},T1?.({ReactiveElement:Ms}),((gh=gc.reactiveElementVersions)!==null&&gh!==void 0?gh:gc.reactiveElementVersions=[]).push("1.6.3");/**
|
|
94
94
|
* @license
|
|
95
95
|
* Copyright 2017 Google LLC
|
|
96
96
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
97
|
-
*/var
|
|
98
|
-
\f\r]`,
|
|
99
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
97
|
+
*/var wh;const mc=window,Us=mc.trustedTypes,N1=Us?Us.createPolicy("lit-html",{createHTML:r=>r}):void 0,bh="$lit$",mi=`lit$${(Math.random()+"").slice(9)}$`,L1="?"+mi,RI=`<${L1}>`,Qi=document,Go=()=>Qi.createComment(""),Yo=r=>r===null||typeof r!="object"&&typeof r!="function",M1=Array.isArray,NI=r=>M1(r)||typeof r?.[Symbol.iterator]=="function",_h=`[
|
|
98
|
+
\f\r]`,Zo=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,U1=/-->/g,j1=/>/g,Xi=RegExp(`>|${_h}(?:([^\\s"'>=/]+)(${_h}*=${_h}*(?:[^
|
|
99
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),F1=/'/g,B1=/"/g,k1=/^(?:script|style|textarea|title)$/i,z1=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),he=z1(1),Nt=z1(2),es=Symbol.for("lit-noChange"),er=Symbol.for("lit-nothing"),q1=new WeakMap,ts=Qi.createTreeWalker(Qi,129,null,!1);function H1(r,e){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return N1!==void 0?N1.createHTML(e):e}const LI=(r,e)=>{const t=r.length-1,n=[];let i,a=e===2?"<svg>":"",c=Zo;for(let u=0;u<t;u++){const f=r[u];let h,m,w=-1,y=0;for(;y<f.length&&(c.lastIndex=y,m=c.exec(f),m!==null);)y=c.lastIndex,c===Zo?m[1]==="!--"?c=U1:m[1]!==void 0?c=j1:m[2]!==void 0?(k1.test(m[2])&&(i=RegExp("</"+m[2],"g")),c=Xi):m[3]!==void 0&&(c=Xi):c===Xi?m[0]===">"?(c=i??Zo,w=-1):m[1]===void 0?w=-2:(w=c.lastIndex-m[2].length,h=m[1],c=m[3]===void 0?Xi:m[3]==='"'?B1:F1):c===B1||c===F1?c=Xi:c===U1||c===j1?c=Zo:(c=Xi,i=void 0);const b=c===Xi&&r[u+1].startsWith("/>")?" ":"";a+=c===Zo?f+RI:w>=0?(n.push(h),f.slice(0,w)+bh+f.slice(w)+mi+b):f+mi+(w===-2?(n.push(void 0),u):b)}return[H1(r,a+(r[t]||"<?>")+(e===2?"</svg>":"")),n]};class Jo{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let a=0,c=0;const u=e.length-1,f=this.parts,[h,m]=LI(e,t);if(this.el=Jo.createElement(h,n),ts.currentNode=this.el.content,t===2){const w=this.el.content,y=w.firstChild;y.remove(),w.append(...y.childNodes)}for(;(i=ts.nextNode())!==null&&f.length<u;){if(i.nodeType===1){if(i.hasAttributes()){const w=[];for(const y of i.getAttributeNames())if(y.endsWith(bh)||y.startsWith(mi)){const b=m[c++];if(w.push(y),b!==void 0){const I=i.getAttribute(b.toLowerCase()+bh).split(mi),A=/([.?@])?(.*)/.exec(b);f.push({type:1,index:a,name:A[2],strings:I,ctor:A[1]==="."?UI:A[1]==="?"?FI:A[1]==="@"?BI:vc})}else f.push({type:6,index:a})}for(const y of w)i.removeAttribute(y)}if(k1.test(i.tagName)){const w=i.textContent.split(mi),y=w.length-1;if(y>0){i.textContent=Us?Us.emptyScript:"";for(let b=0;b<y;b++)i.append(w[b],Go()),ts.nextNode(),f.push({type:2,index:++a});i.append(w[y],Go())}}}else if(i.nodeType===8)if(i.data===L1)f.push({type:2,index:a});else{let w=-1;for(;(w=i.data.indexOf(mi,w+1))!==-1;)f.push({type:7,index:a}),w+=mi.length-1}a++}}static createElement(e,t){const n=Qi.createElement("template");return n.innerHTML=e,n}}function js(r,e,t=r,n){var i,a,c,u;if(e===es)return e;let f=n!==void 0?(i=t._$Co)===null||i===void 0?void 0:i[n]:t._$Cl;const h=Yo(e)?void 0:e._$litDirective$;return f?.constructor!==h&&((a=f?._$AO)===null||a===void 0||a.call(f,!1),h===void 0?f=void 0:(f=new h(r),f._$AT(r,t,n)),n!==void 0?((c=(u=t)._$Co)!==null&&c!==void 0?c:u._$Co=[])[n]=f:t._$Cl=f),f!==void 0&&(e=js(r,f._$AS(r,e.values),f,n)),e}class MI{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;const{el:{content:n},parts:i}=this._$AD,a=((t=e?.creationScope)!==null&&t!==void 0?t:Qi).importNode(n,!0);ts.currentNode=a;let c=ts.nextNode(),u=0,f=0,h=i[0];for(;h!==void 0;){if(u===h.index){let m;h.type===2?m=new Qo(c,c.nextSibling,this,e):h.type===1?m=new h.ctor(c,h.name,h.strings,this,e):h.type===6&&(m=new kI(c,this,e)),this._$AV.push(m),h=i[++f]}u!==h?.index&&(c=ts.nextNode(),u++)}return ts.currentNode=Qi,a}v(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class Qo{constructor(e,t,n,i){var a;this.type=2,this._$AH=er,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cp=(a=i?.isConnected)===null||a===void 0||a}get _$AU(){var e,t;return(t=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&t!==void 0?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=js(this,e,t),Yo(e)?e===er||e==null||e===""?(this._$AH!==er&&this._$AR(),this._$AH=er):e!==this._$AH&&e!==es&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):NI(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==er&&Yo(this._$AH)?this._$AA.nextSibling.data=e:this.$(Qi.createTextNode(e)),this._$AH=e}g(e){var t;const{values:n,_$litType$:i}=e,a=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=Jo.createElement(H1(i.h,i.h[0]),this.options)),i);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===a)this._$AH.v(n);else{const c=new MI(a,this),u=c.u(this.options);c.v(n),this.$(u),this._$AH=c}}_$AC(e){let t=q1.get(e.strings);return t===void 0&&q1.set(e.strings,t=new Jo(e)),t}T(e){M1(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const a of e)i===t.length?t.push(n=new Qo(this.k(Go()),this.k(Go()),this,this.options)):n=t[i],n._$AI(a),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var n;for((n=this._$AP)===null||n===void 0||n.call(this,!1,!0,t);e&&e!==this._$AB;){const i=e.nextSibling;e.remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cp=e,(t=this._$AP)===null||t===void 0||t.call(this,e))}}class vc{constructor(e,t,n,i,a){this.type=1,this._$AH=er,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=a,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=er}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,n,i){const a=this.strings;let c=!1;if(a===void 0)e=js(this,e,t,0),c=!Yo(e)||e!==this._$AH&&e!==es,c&&(this._$AH=e);else{const u=e;let f,h;for(e=a[0],f=0;f<a.length-1;f++)h=js(this,u[n+f],t,f),h===es&&(h=this._$AH[f]),c||(c=!Yo(h)||h!==this._$AH[f]),h===er?e=er:e!==er&&(e+=(h??"")+a[f+1]),this._$AH[f]=h}c&&!i&&this.j(e)}j(e){e===er?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class UI extends vc{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===er?void 0:e}}const jI=Us?Us.emptyScript:"";class FI extends vc{constructor(){super(...arguments),this.type=4}j(e){e&&e!==er?this.element.setAttribute(this.name,jI):this.element.removeAttribute(this.name)}}class BI extends vc{constructor(e,t,n,i,a){super(e,t,n,i,a),this.type=5}_$AI(e,t=this){var n;if((e=(n=js(this,e,t,0))!==null&&n!==void 0?n:er)===es)return;const i=this._$AH,a=e===er&&i!==er||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,c=e!==er&&(i===er||a);a&&this.element.removeEventListener(this.name,this,i),c&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,n;typeof this._$AH=="function"?this._$AH.call((n=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&n!==void 0?n:this.element,e):this._$AH.handleEvent(e)}}class kI{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){js(this,e)}}const W1=mc.litHtmlPolyfillSupport;W1?.(Jo,Qo),((wh=mc.litHtmlVersions)!==null&&wh!==void 0?wh:mc.litHtmlVersions=[]).push("2.8.0");const zI=(r,e,t)=>{var n,i;const a=(n=t?.renderBefore)!==null&&n!==void 0?n:e;let c=a._$litPart$;if(c===void 0){const u=(i=t?.renderBefore)!==null&&i!==void 0?i:null;a._$litPart$=c=new Qo(e.insertBefore(Go(),u),u,void 0,t??{})}return c._$AI(r),c};/**
|
|
100
100
|
* @license
|
|
101
101
|
* Copyright 2017 Google LLC
|
|
102
102
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
103
|
-
*/var
|
|
103
|
+
*/var Eh,xh;class Ye extends Ms{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;const n=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=n.firstChild),n}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=zI(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return es}}Ye.finalized=!0,Ye._$litElement$=!0,(Eh=globalThis.litElementHydrateSupport)===null||Eh===void 0||Eh.call(globalThis,{LitElement:Ye});const K1=globalThis.litElementPolyfillSupport;K1?.({LitElement:Ye}),((xh=globalThis.litElementVersions)!==null&&xh!==void 0?xh:globalThis.litElementVersions=[]).push("3.3.3");/**
|
|
104
104
|
* @license
|
|
105
105
|
* Copyright 2017 Google LLC
|
|
106
106
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
107
|
-
*/const
|
|
107
|
+
*/const st=r=>e=>typeof e=="function"?((t,n)=>(customElements.define(t,n),n))(r,e):((t,n)=>{const{kind:i,elements:a}=n;return{kind:i,elements:a,finisher(c){customElements.define(t,c)}}})(r,e);/**
|
|
108
108
|
* @license
|
|
109
109
|
* Copyright 2017 Google LLC
|
|
110
110
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
111
|
-
*/const
|
|
111
|
+
*/const qI=(r,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,r)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(t){t.createProperty(e.key,r)}},HI=(r,e,t)=>{e.constructor.createProperty(t,r)};function Be(r){return(e,t)=>t!==void 0?HI(r,e,t):qI(r,e)}/**
|
|
112
112
|
* @license
|
|
113
113
|
* Copyright 2017 Google LLC
|
|
114
114
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
115
|
-
*/function
|
|
115
|
+
*/function Rr(r){return Be({...r,state:!0})}/**
|
|
116
116
|
* @license
|
|
117
117
|
* Copyright 2021 Google LLC
|
|
118
118
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
119
|
-
*/var
|
|
119
|
+
*/var Ih;((Ih=window.HTMLSlotElement)===null||Ih===void 0?void 0:Ih.prototype.assignedElements)!=null;/**
|
|
120
120
|
* @license
|
|
121
121
|
* Copyright 2017 Google LLC
|
|
122
122
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
123
|
-
*/const
|
|
123
|
+
*/const WI={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},KI=r=>(...e)=>({_$litDirective$:r,values:e});class VI{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
|
|
124
124
|
* @license
|
|
125
125
|
* Copyright 2018 Google LLC
|
|
126
126
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
127
|
-
*/const qn=yI(class extends wI{constructor(r){var e;if(super(r),r.type!==vI.ATTRIBUTE||r.name!=="class"||((e=r.strings)===null||e===void 0?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(r){return" "+Object.keys(r).filter(e=>r[e]).join(" ")+" "}update(r,[e]){var t,n;if(this.it===void 0){this.it=new Set,r.strings!==void 0&&(this.nt=new Set(r.strings.join(" ").split(/\s/).filter(a=>a!=="")));for(const a in e)e[a]&&!(!((t=this.nt)===null||t===void 0)&&t.has(a))&&this.it.add(a);return this.render(e)}const i=r.element.classList;this.it.forEach(a=>{a in e||(i.remove(a),this.it.delete(a))});for(const a in e){const c=!!e[a];c===this.it.has(a)||!((n=this.nt)===null||n===void 0)&&n.has(a)||(c?(i.add(a),this.it.add(a)):(i.remove(a),this.it.delete(a)))}return Yi}});function bI(r,e){r.indexOf(e)===-1&&r.push(e)}const Rg=(r,e,t)=>Math.min(Math.max(t,r),e),tn={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},cc=r=>typeof r=="number",Rs=r=>Array.isArray(r)&&!cc(r[0]),_I=(r,e,t)=>{const n=e-r;return((t-r)%n+n)%n+r};function EI(r,e){return Rs(r)?r[_I(0,r.length,e)]:r}const Ng=(r,e,t)=>-t*r+t*e+r,Lg=()=>{},di=r=>r,mh=(r,e,t)=>e-r===0?1:(t-r)/(e-r);function Mg(r,e){const t=r[r.length-1];for(let n=1;n<=e;n++){const i=mh(0,e,n);r.push(Ng(t,1,i))}}function xI(r){const e=[0];return Mg(e,r-1),e}function II(r,e=xI(r.length),t=di){const n=r.length,i=n-e.length;return i>0&&Mg(e,i),a=>{let c=0;for(;c<n-2&&!(a<e[c+1]);c++);let u=Rg(0,1,mh(e[c],e[c+1],a));return u=EI(t,c)(u),Ng(r[c],r[c+1],u)}}const Ug=r=>Array.isArray(r)&&cc(r[0]),vh=r=>typeof r=="object"&&!!r.createAnimation,Zi=r=>typeof r=="function",DI=r=>typeof r=="string",Ho={ms:r=>r*1e3,s:r=>r/1e3},jg=(r,e,t)=>(((1-3*t+3*e)*r+(3*t-6*e))*r+3*e)*r,SI=1e-7,CI=12;function OI(r,e,t,n,i){let a,c,u=0;do c=e+(t-e)/2,a=jg(c,n,i)-r,a>0?t=c:e=c;while(Math.abs(a)>SI&&++u<CI);return c}function Wo(r,e,t,n){if(r===e&&t===n)return di;const i=a=>OI(a,0,1,r,t);return a=>a===0||a===1?a:jg(i(a),e,n)}const $I=(r,e="end")=>t=>{t=e==="end"?Math.min(t,.999):Math.max(t,.001);const n=t*r,i=e==="end"?Math.floor(n):Math.ceil(n);return Rg(0,1,i/r)},Fg={ease:Wo(.25,.1,.25,1),"ease-in":Wo(.42,0,1,1),"ease-in-out":Wo(.42,0,.58,1),"ease-out":Wo(0,0,.58,1)},AI=/\((.*?)\)/;function Bg(r){if(Zi(r))return r;if(Ug(r))return Wo(...r);if(Fg[r])return Fg[r];if(r.startsWith("steps")){const e=AI.exec(r);if(e){const t=e[1].split(",");return $I(parseFloat(t[0]),t[1].trim())}}return di}class kg{constructor(e,t=[0,1],{easing:n,duration:i=tn.duration,delay:a=tn.delay,endDelay:c=tn.endDelay,repeat:u=tn.repeat,offset:f,direction:h="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=di,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((w,y)=>{this.resolve=w,this.reject=y}),n=n||tn.easing,vh(n)){const w=n.createAnimation(t);n=w.easing,t=w.keyframes||t,i=w.duration||i}this.repeat=u,this.easing=Rs(n)?di:Bg(n),this.updateDuration(i);const m=II(t,f,Rs(n)?n.map(Bg):di);this.tick=w=>{var y;a=a;let x=0;this.pauseTime!==void 0?x=this.pauseTime:x=(w-this.startTime)*this.rate,this.t=x,x/=1e3,x=Math.max(x-a,0),this.playState==="finished"&&this.pauseTime===void 0&&(x=this.totalDuration);const S=x/this.duration;let P=Math.floor(S),U=S%1;!U&&S>=1&&(U=1),U===1&&P--;const j=P%2;(h==="reverse"||h==="alternate"&&j||h==="alternate-reverse"&&!j)&&(U=1-U);const A=x>=this.totalDuration?1:Math.min(U,1),T=m(this.easing(A));e(T),this.pauseTime===void 0&&(this.playState==="finished"||x>=this.totalDuration+c)?(this.playState="finished",(y=this.resolve)===null||y===void 0||y.call(this,T)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){const e=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=e-this.pauseTime:this.startTime||(this.startTime=e),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var e;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(e=this.reject)===null||e===void 0||e.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(e){this.duration=e,this.totalDuration=e*(this.repeat+1)}get currentTime(){return this.t}set currentTime(e){this.pauseTime!==void 0||this.rate===0?this.pauseTime=e:this.startTime=performance.now()-e/this.rate}get playbackRate(){return this.rate}set playbackRate(e){this.rate=e}}var yh=function(){};process.env.NODE_ENV!=="production"&&(yh=function(r,e){if(!r)throw new Error(e)});class PI{setAnimation(e){this.animation=e,e?.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}const wh=new WeakMap;function qg(r){return wh.has(r)||wh.set(r,{transforms:[],values:new Map}),wh.get(r)}function TI(r,e){return r.has(e)||r.set(e,new PI),r.get(e)}const RI=["","X","Y","Z"],NI=["translate","scale","rotate","skew"],lc={x:"translateX",y:"translateY",z:"translateZ"},zg={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:r=>r+"deg"},LI={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:r=>r+"px"},rotate:zg,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:di},skew:zg},Ko=new Map,bh=r=>`--motion-${r}`,uc=["x","y","z"];NI.forEach(r=>{RI.forEach(e=>{uc.push(r+e),Ko.set(bh(r+e),LI[r])})});const MI=(r,e)=>uc.indexOf(r)-uc.indexOf(e),UI=new Set(uc),Hg=r=>UI.has(r),jI=(r,e)=>{lc[e]&&(e=lc[e]);const{transforms:t}=qg(r);bI(t,e),r.style.transform=FI(t)},FI=r=>r.sort(MI).reduce(BI,"").trim(),BI=(r,e)=>`${r} ${e}(var(${bh(e)}))`,_h=r=>r.startsWith("--"),Wg=new Set;function kI(r){if(!Wg.has(r)){Wg.add(r);try{const{syntax:e,initialValue:t}=Ko.has(r)?Ko.get(r):{};CSS.registerProperty({name:r,inherits:!1,syntax:e,initialValue:t})}catch{}}}const Eh=(r,e)=>document.createElement("div").animate(r,e),Kg={cssRegisterProperty:()=>typeof CSS<"u"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{Eh({opacity:[1]})}catch{return!1}return!0},finished:()=>!!Eh({opacity:[0,1]},{duration:.001}).finished,linearEasing:()=>{try{Eh({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0}},xh={},Ns={};for(const r in Kg)Ns[r]=()=>(xh[r]===void 0&&(xh[r]=Kg[r]()),xh[r]);const qI=.015,zI=(r,e)=>{let t="";const n=Math.round(e/qI);for(let i=0;i<n;i++)t+=r(mh(0,n-1,i))+", ";return t.substring(0,t.length-2)},Vg=(r,e)=>Zi(r)?Ns.linearEasing()?`linear(${zI(r,e)})`:tn.easing:Ug(r)?HI(r):r,HI=([r,e,t,n])=>`cubic-bezier(${r}, ${e}, ${t}, ${n})`;function WI(r,e){for(let t=0;t<r.length;t++)r[t]===null&&(r[t]=t?r[t-1]:e());return r}const KI=r=>Array.isArray(r)?r:[r];function Ih(r){return lc[r]&&(r=lc[r]),Hg(r)?bh(r):r}const hc={get:(r,e)=>{e=Ih(e);let t=_h(e)?r.style.getPropertyValue(e):getComputedStyle(r)[e];if(!t&&t!==0){const n=Ko.get(e);n&&(t=n.initialValue)}return t},set:(r,e,t)=>{e=Ih(e),_h(e)?r.style.setProperty(e,t):r.style[e]=t}};function Gg(r,e=!0){if(!(!r||r.playState==="finished"))try{r.stop?r.stop():(e&&r.commitStyles(),r.cancel())}catch{}}function VI(r,e){var t;let n=e?.toDefaultUnit||di;const i=r[r.length-1];if(DI(i)){const a=((t=i.match(/(-?[\d.]+)([a-z%]*)/))===null||t===void 0?void 0:t[2])||"";a&&(n=c=>c+a)}return n}function GI(){return window.__MOTION_DEV_TOOLS_RECORD}function YI(r,e,t,n={},i){const a=GI(),c=n.record!==!1&&a;let u,{duration:f=tn.duration,delay:h=tn.delay,endDelay:m=tn.endDelay,repeat:w=tn.repeat,easing:y=tn.easing,persist:x=!1,direction:S,offset:P,allowWebkitAcceleration:U=!1}=n;const j=qg(r),A=Hg(e);let T=Ns.waapi();A&&jI(r,e);const C=Ih(e),$=TI(j.values,C),E=Ko.get(C);return Gg($.animation,!(vh(y)&&$.generator)&&n.record!==!1),()=>{const d=()=>{var F,V;return(V=(F=hc.get(r,C))!==null&&F!==void 0?F:E?.initialValue)!==null&&V!==void 0?V:0};let b=WI(KI(t),d);const H=VI(b,E);if(vh(y)){const F=y.createAnimation(b,e!=="opacity",d,C,$);y=F.easing,b=F.keyframes||b,f=F.duration||f}if(_h(C)&&(Ns.cssRegisterProperty()?kI(C):T=!1),A&&!Ns.linearEasing()&&(Zi(y)||Rs(y)&&y.some(Zi))&&(T=!1),T){E&&(b=b.map(se=>cc(se)?E.toDefaultUnit(se):se)),b.length===1&&(!Ns.partialKeyframes()||c)&&b.unshift(d());const F={delay:Ho.ms(h),duration:Ho.ms(f),endDelay:Ho.ms(m),easing:Rs(y)?void 0:Vg(y,f),direction:S,iterations:w+1,fill:"both"};u=r.animate({[C]:b,offset:P,easing:Rs(y)?y.map(se=>Vg(se,f)):void 0},F),u.finished||(u.finished=new Promise((se,ce)=>{u.onfinish=se,u.oncancel=ce}));const V=b[b.length-1];u.finished.then(()=>{x||(hc.set(r,C,V),u.cancel())}).catch(Lg),U||(u.playbackRate=1.000001)}else if(i&&A)b=b.map(F=>typeof F=="string"?parseFloat(F):F),b.length===1&&b.unshift(parseFloat(d())),u=new i(F=>{hc.set(r,C,H?H(F):F)},b,Object.assign(Object.assign({},n),{duration:f,easing:y}));else{const F=b[b.length-1];hc.set(r,C,E&&cc(F)?E.toDefaultUnit(F):F)}return c&&a(r,e,b,{duration:f,delay:h,easing:y,repeat:w,offset:P},"motion-one"),$.setAnimation(u),u}}const JI=(r,e)=>r[e]?Object.assign(Object.assign({},r),r[e]):Object.assign({},r);function Yg(r,e){var t;return typeof r=="string"?e?((t=e[r])!==null&&t!==void 0||(e[r]=document.querySelectorAll(r)),r=e[r]):r=document.querySelectorAll(r):r instanceof Element&&(r=[r]),Array.from(r||[])}const ZI=r=>r(),Jg=(r,e,t=tn.duration)=>new Proxy({animations:r.map(ZI).filter(Boolean),duration:t,options:e},XI),QI=r=>r.animations[0],XI={get:(r,e)=>{const t=QI(r);switch(e){case"duration":return r.duration;case"currentTime":return Ho.s(t?.[e]||0);case"playbackRate":case"playState":return t?.[e];case"finished":return r.finished||(r.finished=Promise.all(r.animations.map(eD)).catch(Lg)),r.finished;case"stop":return()=>{r.animations.forEach(n=>Gg(n))};case"forEachNative":return n=>{r.animations.forEach(i=>n(i,r))};default:return typeof t?.[e]>"u"?void 0:()=>r.animations.forEach(n=>n[e]())}},set:(r,e,t)=>{switch(e){case"currentTime":t=Ho.ms(t);case"playbackRate":for(let n=0;n<r.animations.length;n++)r.animations[n][e]=t;return!0}return!1}},eD=r=>r.finished;function tD(r,e,t){return Zi(r)?r(e,t):r}function rD(r){return function(t,n,i={}){t=Yg(t);const a=t.length;yh(!!a,"No valid element provided."),yh(!!n,"No keyframes defined.");const c=[];for(let u=0;u<a;u++){const f=t[u];for(const h in n){const m=JI(i,h);m.delay=tD(m.delay,u,a);const w=YI(f,h,n[h],m,r);c.push(w)}}return Jg(c,i,i.duration)}}const nD=rD(kg);function iD(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}typeof SuppressedError=="function"&&SuppressedError;const sD={any:0,all:1};function oD(r,e,{root:t,margin:n,amount:i="any"}={}){if(typeof IntersectionObserver>"u")return()=>{};const a=Yg(r),c=new WeakMap,u=h=>{h.forEach(m=>{const w=c.get(m.target);if(m.isIntersecting!==!!w)if(m.isIntersecting){const y=e(m);Zi(y)?c.set(m.target,y):f.unobserve(m.target)}else w&&(w(m),c.delete(m.target))})},f=new IntersectionObserver(u,{root:t,rootMargin:n,threshold:typeof i=="number"?i:sD[i]});return a.forEach(h=>f.observe(h)),()=>f.disconnect()}function Dh(r,e,t){r.dispatchEvent(new CustomEvent(e,{detail:{originalEvent:t}}))}function Zg(r,e,t){r.dispatchEvent(new CustomEvent(e,{detail:{originalEntry:t}}))}const aD={isActive:r=>!!r.inView,subscribe:(r,{enable:e,disable:t},{inViewOptions:n={}})=>{const{once:i}=n,a=iD(n,["once"]);return oD(r,c=>{if(e(),Zg(r,"viewenter",c),!i)return u=>{t(),Zg(r,"viewleave",u)}},a)}},Qg=(r,e,t)=>n=>{n.pointerType&&n.pointerType!=="mouse"||(t(),Dh(r,e,n))};[...Object.keys({inView:aD,hover:{isActive:r=>!!r.hover,subscribe:(r,{enable:e,disable:t})=>{const n=Qg(r,"hoverstart",e),i=Qg(r,"hoverend",t);return r.addEventListener("pointerenter",n),r.addEventListener("pointerleave",i),()=>{r.removeEventListener("pointerenter",n),r.removeEventListener("pointerleave",i)}}},press:{isActive:r=>!!r.press,subscribe:(r,{enable:e,disable:t})=>{const n=a=>{t(),Dh(r,"pressend",a),window.removeEventListener("pointerup",n)},i=a=>{e(),Dh(r,"pressstart",a),window.addEventListener("pointerup",n)};return r.addEventListener("pointerdown",i),()=>{r.removeEventListener("pointerdown",i),window.removeEventListener("pointerup",n)}}}})];function cD(r,e={}){return Jg([()=>{const t=new kg(r,[0,1],e);return t.finished.catch(()=>{}),t}],e,e.duration)}function Qi(r,e,t){return(Zi(r)?cD:nD)(r,e,t)}/**
|
|
127
|
+
*/const Wn=KI(class extends VI{constructor(r){var e;if(super(r),r.type!==WI.ATTRIBUTE||r.name!=="class"||((e=r.strings)===null||e===void 0?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(r){return" "+Object.keys(r).filter(e=>r[e]).join(" ")+" "}update(r,[e]){var t,n;if(this.it===void 0){this.it=new Set,r.strings!==void 0&&(this.nt=new Set(r.strings.join(" ").split(/\s/).filter(a=>a!=="")));for(const a in e)e[a]&&!(!((t=this.nt)===null||t===void 0)&&t.has(a))&&this.it.add(a);return this.render(e)}const i=r.element.classList;this.it.forEach(a=>{a in e||(i.remove(a),this.it.delete(a))});for(const a in e){const c=!!e[a];c===this.it.has(a)||!((n=this.nt)===null||n===void 0)&&n.has(a)||(c?(i.add(a),this.it.add(a)):(i.remove(a),this.it.delete(a)))}return es}});function GI(r,e){r.indexOf(e)===-1&&r.push(e)}const V1=(r,e,t)=>Math.min(Math.max(t,r),e),nn={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},yc=r=>typeof r=="number",Fs=r=>Array.isArray(r)&&!yc(r[0]),YI=(r,e,t)=>{const n=e-r;return((t-r)%n+n)%n+r};function ZI(r,e){return Fs(r)?r[YI(0,r.length,e)]:r}const G1=(r,e,t)=>-t*r+t*e+r,Y1=()=>{},vi=r=>r,Dh=(r,e,t)=>e-r===0?1:(t-r)/(e-r);function Z1(r,e){const t=r[r.length-1];for(let n=1;n<=e;n++){const i=Dh(0,e,n);r.push(G1(t,1,i))}}function JI(r){const e=[0];return Z1(e,r-1),e}function QI(r,e=JI(r.length),t=vi){const n=r.length,i=n-e.length;return i>0&&Z1(e,i),a=>{let c=0;for(;c<n-2&&!(a<e[c+1]);c++);let u=V1(0,1,Dh(e[c],e[c+1],a));return u=ZI(t,c)(u),G1(r[c],r[c+1],u)}}const J1=r=>Array.isArray(r)&&yc(r[0]),Sh=r=>typeof r=="object"&&!!r.createAnimation,rs=r=>typeof r=="function",XI=r=>typeof r=="string",Xo={ms:r=>r*1e3,s:r=>r/1e3},Q1=(r,e,t)=>(((1-3*t+3*e)*r+(3*t-6*e))*r+3*e)*r,eD=1e-7,tD=12;function rD(r,e,t,n,i){let a,c,u=0;do c=e+(t-e)/2,a=Q1(c,n,i)-r,a>0?t=c:e=c;while(Math.abs(a)>eD&&++u<tD);return c}function ea(r,e,t,n){if(r===e&&t===n)return vi;const i=a=>rD(a,0,1,r,t);return a=>a===0||a===1?a:Q1(i(a),e,n)}const nD=(r,e="end")=>t=>{t=e==="end"?Math.min(t,.999):Math.max(t,.001);const n=t*r,i=e==="end"?Math.floor(n):Math.ceil(n);return V1(0,1,i/r)},X1={ease:ea(.25,.1,.25,1),"ease-in":ea(.42,0,1,1),"ease-in-out":ea(.42,0,.58,1),"ease-out":ea(0,0,.58,1)},iD=/\((.*?)\)/;function em(r){if(rs(r))return r;if(J1(r))return ea(...r);if(X1[r])return X1[r];if(r.startsWith("steps")){const e=iD.exec(r);if(e){const t=e[1].split(",");return nD(parseFloat(t[0]),t[1].trim())}}return vi}class tm{constructor(e,t=[0,1],{easing:n,duration:i=nn.duration,delay:a=nn.delay,endDelay:c=nn.endDelay,repeat:u=nn.repeat,offset:f,direction:h="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=vi,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((w,y)=>{this.resolve=w,this.reject=y}),n=n||nn.easing,Sh(n)){const w=n.createAnimation(t);n=w.easing,t=w.keyframes||t,i=w.duration||i}this.repeat=u,this.easing=Fs(n)?vi:em(n),this.updateDuration(i);const m=QI(t,f,Fs(n)?n.map(em):vi);this.tick=w=>{var y;a=a;let b=0;this.pauseTime!==void 0?b=this.pauseTime:b=(w-this.startTime)*this.rate,this.t=b,b/=1e3,b=Math.max(b-a,0),this.playState==="finished"&&this.pauseTime===void 0&&(b=this.totalDuration);const I=b/this.duration;let A=Math.floor(I),U=I%1;!U&&I>=1&&(U=1),U===1&&A--;const j=A%2;(h==="reverse"||h==="alternate"&&j||h==="alternate-reverse"&&!j)&&(U=1-U);const $=b>=this.totalDuration?1:Math.min(U,1),T=m(this.easing($));e(T),this.pauseTime===void 0&&(this.playState==="finished"||b>=this.totalDuration+c)?(this.playState="finished",(y=this.resolve)===null||y===void 0||y.call(this,T)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){const e=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=e-this.pauseTime:this.startTime||(this.startTime=e),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var e;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(e=this.reject)===null||e===void 0||e.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(e){this.duration=e,this.totalDuration=e*(this.repeat+1)}get currentTime(){return this.t}set currentTime(e){this.pauseTime!==void 0||this.rate===0?this.pauseTime=e:this.startTime=performance.now()-e/this.rate}get playbackRate(){return this.rate}set playbackRate(e){this.rate=e}}var Oh=function(){};process.env.NODE_ENV!=="production"&&(Oh=function(r,e){if(!r)throw new Error(e)});class sD{setAnimation(e){this.animation=e,e?.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}const Ch=new WeakMap;function rm(r){return Ch.has(r)||Ch.set(r,{transforms:[],values:new Map}),Ch.get(r)}function oD(r,e){return r.has(e)||r.set(e,new sD),r.get(e)}const aD=["","X","Y","Z"],cD=["translate","scale","rotate","skew"],wc={x:"translateX",y:"translateY",z:"translateZ"},nm={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:r=>r+"deg"},lD={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:r=>r+"px"},rotate:nm,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:vi},skew:nm},ta=new Map,$h=r=>`--motion-${r}`,bc=["x","y","z"];cD.forEach(r=>{aD.forEach(e=>{bc.push(r+e),ta.set($h(r+e),lD[r])})});const uD=(r,e)=>bc.indexOf(r)-bc.indexOf(e),hD=new Set(bc),im=r=>hD.has(r),fD=(r,e)=>{wc[e]&&(e=wc[e]);const{transforms:t}=rm(r);GI(t,e),r.style.transform=dD(t)},dD=r=>r.sort(uD).reduce(pD,"").trim(),pD=(r,e)=>`${r} ${e}(var(${$h(e)}))`,Ah=r=>r.startsWith("--"),sm=new Set;function gD(r){if(!sm.has(r)){sm.add(r);try{const{syntax:e,initialValue:t}=ta.has(r)?ta.get(r):{};CSS.registerProperty({name:r,inherits:!1,syntax:e,initialValue:t})}catch{}}}const Ph=(r,e)=>document.createElement("div").animate(r,e),om={cssRegisterProperty:()=>typeof CSS<"u"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{Ph({opacity:[1]})}catch{return!1}return!0},finished:()=>!!Ph({opacity:[0,1]},{duration:.001}).finished,linearEasing:()=>{try{Ph({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0}},Th={},Bs={};for(const r in om)Bs[r]=()=>(Th[r]===void 0&&(Th[r]=om[r]()),Th[r]);const mD=.015,vD=(r,e)=>{let t="";const n=Math.round(e/mD);for(let i=0;i<n;i++)t+=r(Dh(0,n-1,i))+", ";return t.substring(0,t.length-2)},am=(r,e)=>rs(r)?Bs.linearEasing()?`linear(${vD(r,e)})`:nn.easing:J1(r)?yD(r):r,yD=([r,e,t,n])=>`cubic-bezier(${r}, ${e}, ${t}, ${n})`;function wD(r,e){for(let t=0;t<r.length;t++)r[t]===null&&(r[t]=t?r[t-1]:e());return r}const bD=r=>Array.isArray(r)?r:[r];function Rh(r){return wc[r]&&(r=wc[r]),im(r)?$h(r):r}const _c={get:(r,e)=>{e=Rh(e);let t=Ah(e)?r.style.getPropertyValue(e):getComputedStyle(r)[e];if(!t&&t!==0){const n=ta.get(e);n&&(t=n.initialValue)}return t},set:(r,e,t)=>{e=Rh(e),Ah(e)?r.style.setProperty(e,t):r.style[e]=t}};function cm(r,e=!0){if(!(!r||r.playState==="finished"))try{r.stop?r.stop():(e&&r.commitStyles(),r.cancel())}catch{}}function _D(r,e){var t;let n=e?.toDefaultUnit||vi;const i=r[r.length-1];if(XI(i)){const a=((t=i.match(/(-?[\d.]+)([a-z%]*)/))===null||t===void 0?void 0:t[2])||"";a&&(n=c=>c+a)}return n}function ED(){return window.__MOTION_DEV_TOOLS_RECORD}function xD(r,e,t,n={},i){const a=ED(),c=n.record!==!1&&a;let u,{duration:f=nn.duration,delay:h=nn.delay,endDelay:m=nn.endDelay,repeat:w=nn.repeat,easing:y=nn.easing,persist:b=!1,direction:I,offset:A,allowWebkitAcceleration:U=!1}=n;const j=rm(r),$=im(e);let T=Bs.waapi();$&&fD(r,e);const O=Rh(e),P=oD(j.values,O),x=ta.get(O);return cm(P.animation,!(Sh(y)&&P.generator)&&n.record!==!1),()=>{const d=()=>{var F,V;return(V=(F=_c.get(r,O))!==null&&F!==void 0?F:x?.initialValue)!==null&&V!==void 0?V:0};let _=wD(bD(t),d);const H=_D(_,x);if(Sh(y)){const F=y.createAnimation(_,e!=="opacity",d,O,P);y=F.easing,_=F.keyframes||_,f=F.duration||f}if(Ah(O)&&(Bs.cssRegisterProperty()?gD(O):T=!1),$&&!Bs.linearEasing()&&(rs(y)||Fs(y)&&y.some(rs))&&(T=!1),T){x&&(_=_.map(se=>yc(se)?x.toDefaultUnit(se):se)),_.length===1&&(!Bs.partialKeyframes()||c)&&_.unshift(d());const F={delay:Xo.ms(h),duration:Xo.ms(f),endDelay:Xo.ms(m),easing:Fs(y)?void 0:am(y,f),direction:I,iterations:w+1,fill:"both"};u=r.animate({[O]:_,offset:A,easing:Fs(y)?y.map(se=>am(se,f)):void 0},F),u.finished||(u.finished=new Promise((se,ce)=>{u.onfinish=se,u.oncancel=ce}));const V=_[_.length-1];u.finished.then(()=>{b||(_c.set(r,O,V),u.cancel())}).catch(Y1),U||(u.playbackRate=1.000001)}else if(i&&$)_=_.map(F=>typeof F=="string"?parseFloat(F):F),_.length===1&&_.unshift(parseFloat(d())),u=new i(F=>{_c.set(r,O,H?H(F):F)},_,Object.assign(Object.assign({},n),{duration:f,easing:y}));else{const F=_[_.length-1];_c.set(r,O,x&&yc(F)?x.toDefaultUnit(F):F)}return c&&a(r,e,_,{duration:f,delay:h,easing:y,repeat:w,offset:A},"motion-one"),P.setAnimation(u),u}}const ID=(r,e)=>r[e]?Object.assign(Object.assign({},r),r[e]):Object.assign({},r);function lm(r,e){var t;return typeof r=="string"?e?((t=e[r])!==null&&t!==void 0||(e[r]=document.querySelectorAll(r)),r=e[r]):r=document.querySelectorAll(r):r instanceof Element&&(r=[r]),Array.from(r||[])}const DD=r=>r(),um=(r,e,t=nn.duration)=>new Proxy({animations:r.map(DD).filter(Boolean),duration:t,options:e},OD),SD=r=>r.animations[0],OD={get:(r,e)=>{const t=SD(r);switch(e){case"duration":return r.duration;case"currentTime":return Xo.s(t?.[e]||0);case"playbackRate":case"playState":return t?.[e];case"finished":return r.finished||(r.finished=Promise.all(r.animations.map(CD)).catch(Y1)),r.finished;case"stop":return()=>{r.animations.forEach(n=>cm(n))};case"forEachNative":return n=>{r.animations.forEach(i=>n(i,r))};default:return typeof t?.[e]>"u"?void 0:()=>r.animations.forEach(n=>n[e]())}},set:(r,e,t)=>{switch(e){case"currentTime":t=Xo.ms(t);case"playbackRate":for(let n=0;n<r.animations.length;n++)r.animations[n][e]=t;return!0}return!1}},CD=r=>r.finished;function $D(r,e,t){return rs(r)?r(e,t):r}function AD(r){return function(t,n,i={}){t=lm(t);const a=t.length;Oh(!!a,"No valid element provided."),Oh(!!n,"No keyframes defined.");const c=[];for(let u=0;u<a;u++){const f=t[u];for(const h in n){const m=ID(i,h);m.delay=$D(m.delay,u,a);const w=xD(f,h,n[h],m,r);c.push(w)}}return um(c,i,i.duration)}}const PD=AD(tm);function TD(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}typeof SuppressedError=="function"&&SuppressedError;const RD={any:0,all:1};function ND(r,e,{root:t,margin:n,amount:i="any"}={}){if(typeof IntersectionObserver>"u")return()=>{};const a=lm(r),c=new WeakMap,u=h=>{h.forEach(m=>{const w=c.get(m.target);if(m.isIntersecting!==!!w)if(m.isIntersecting){const y=e(m);rs(y)?c.set(m.target,y):f.unobserve(m.target)}else w&&(w(m),c.delete(m.target))})},f=new IntersectionObserver(u,{root:t,rootMargin:n,threshold:typeof i=="number"?i:RD[i]});return a.forEach(h=>f.observe(h)),()=>f.disconnect()}function Nh(r,e,t){r.dispatchEvent(new CustomEvent(e,{detail:{originalEvent:t}}))}function hm(r,e,t){r.dispatchEvent(new CustomEvent(e,{detail:{originalEntry:t}}))}const LD={isActive:r=>!!r.inView,subscribe:(r,{enable:e,disable:t},{inViewOptions:n={}})=>{const{once:i}=n,a=TD(n,["once"]);return ND(r,c=>{if(e(),hm(r,"viewenter",c),!i)return u=>{t(),hm(r,"viewleave",u)}},a)}},fm=(r,e,t)=>n=>{n.pointerType&&n.pointerType!=="mouse"||(t(),Nh(r,e,n))};[...Object.keys({inView:LD,hover:{isActive:r=>!!r.hover,subscribe:(r,{enable:e,disable:t})=>{const n=fm(r,"hoverstart",e),i=fm(r,"hoverend",t);return r.addEventListener("pointerenter",n),r.addEventListener("pointerleave",i),()=>{r.removeEventListener("pointerenter",n),r.removeEventListener("pointerleave",i)}}},press:{isActive:r=>!!r.press,subscribe:(r,{enable:e,disable:t})=>{const n=a=>{t(),Nh(r,"pressend",a),window.removeEventListener("pointerup",n)},i=a=>{e(),Nh(r,"pressstart",a),window.addEventListener("pointerup",n)};return r.addEventListener("pointerdown",i),()=>{r.removeEventListener("pointerdown",i),window.removeEventListener("pointerup",n)}}}})];function MD(r,e={}){return um([()=>{const t=new tm(r,[0,1],e);return t.finished.catch(()=>{}),t}],e,e.duration)}function ns(r,e,t){return(rs(r)?MD:PD)(r,e,t)}/**
|
|
128
128
|
* @license
|
|
129
129
|
* Copyright 2018 Google LLC
|
|
130
130
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
131
|
-
*/const
|
|
132
|
-
]))+`;
|
|
133
|
-
Make sure your charset is UTF-8`);t=(t>>>8&255)*192+(t&255),r.put(t,13)}};var
|
|
134
|
-
Suggested mode is: `+e.toString(
|
|
131
|
+
*/const Er=r=>r??er;var ra={},UD=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},dm={},Vr={};let Lh;const jD=[0,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];Vr.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17},Vr.getSymbolTotalCodewords=function(e){return jD[e]},Vr.getBCHDigit=function(r){let e=0;for(;r!==0;)e++,r>>>=1;return e},Vr.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');Lh=e},Vr.isKanjiModeEnabled=function(){return typeof Lh<"u"},Vr.toSJIS=function(e){return Lh(e)};var Ec={};(function(r){r.L={bit:1},r.M={bit:0},r.Q={bit:3},r.H={bit:2};function e(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return r.L;case"m":case"medium":return r.M;case"q":case"quartile":return r.Q;case"h":case"high":return r.H;default:throw new Error("Unknown EC Level: "+t)}}r.isValid=function(n){return n&&typeof n.bit<"u"&&n.bit>=0&&n.bit<4},r.from=function(n,i){if(r.isValid(n))return n;try{return e(n)}catch{return i}}})(Ec);function pm(){this.buffer=[],this.length=0}pm.prototype={get:function(r){const e=Math.floor(r/8);return(this.buffer[e]>>>7-r%8&1)===1},put:function(r,e){for(let t=0;t<e;t++)this.putBit((r>>>e-t-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(r){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),r&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var FD=pm;function na(r){if(!r||r<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=r,this.data=new Uint8Array(r*r),this.reservedBit=new Uint8Array(r*r)}na.prototype.set=function(r,e,t,n){const i=r*this.size+e;this.data[i]=t,n&&(this.reservedBit[i]=!0)},na.prototype.get=function(r,e){return this.data[r*this.size+e]},na.prototype.xor=function(r,e,t){this.data[r*this.size+e]^=t},na.prototype.isReserved=function(r,e){return this.reservedBit[r*this.size+e]};var BD=na,gm={};(function(r){const e=Vr.getSymbolSize;r.getRowColCoords=function(n){if(n===1)return[];const i=Math.floor(n/7)+2,a=e(n),c=a===145?26:Math.ceil((a-13)/(2*i-2))*2,u=[a-7];for(let f=1;f<i-1;f++)u[f]=u[f-1]-c;return u.push(6),u.reverse()},r.getPositions=function(n){const i=[],a=r.getRowColCoords(n),c=a.length;for(let u=0;u<c;u++)for(let f=0;f<c;f++)u===0&&f===0||u===0&&f===c-1||u===c-1&&f===0||i.push([a[u],a[f]]);return i}})(gm);var mm={};const kD=Vr.getSymbolSize,vm=7;mm.getPositions=function(e){const t=kD(e);return[[0,0],[t-vm,0],[0,t-vm]]};var ym={};(function(r){r.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e={N1:3,N2:3,N3:40,N4:10};r.isValid=function(i){return i!=null&&i!==""&&!isNaN(i)&&i>=0&&i<=7},r.from=function(i){return r.isValid(i)?parseInt(i,10):void 0},r.getPenaltyN1=function(i){const a=i.size;let c=0,u=0,f=0,h=null,m=null;for(let w=0;w<a;w++){u=f=0,h=m=null;for(let y=0;y<a;y++){let b=i.get(w,y);b===h?u++:(u>=5&&(c+=e.N1+(u-5)),h=b,u=1),b=i.get(y,w),b===m?f++:(f>=5&&(c+=e.N1+(f-5)),m=b,f=1)}u>=5&&(c+=e.N1+(u-5)),f>=5&&(c+=e.N1+(f-5))}return c},r.getPenaltyN2=function(i){const a=i.size;let c=0;for(let u=0;u<a-1;u++)for(let f=0;f<a-1;f++){const h=i.get(u,f)+i.get(u,f+1)+i.get(u+1,f)+i.get(u+1,f+1);(h===4||h===0)&&c++}return c*e.N2},r.getPenaltyN3=function(i){const a=i.size;let c=0,u=0,f=0;for(let h=0;h<a;h++){u=f=0;for(let m=0;m<a;m++)u=u<<1&2047|i.get(h,m),m>=10&&(u===1488||u===93)&&c++,f=f<<1&2047|i.get(m,h),m>=10&&(f===1488||f===93)&&c++}return c*e.N3},r.getPenaltyN4=function(i){let a=0;const c=i.data.length;for(let f=0;f<c;f++)a+=i.data[f];return Math.abs(Math.ceil(a*100/c/5)-10)*e.N4};function t(n,i,a){switch(n){case r.Patterns.PATTERN000:return(i+a)%2===0;case r.Patterns.PATTERN001:return i%2===0;case r.Patterns.PATTERN010:return a%3===0;case r.Patterns.PATTERN011:return(i+a)%3===0;case r.Patterns.PATTERN100:return(Math.floor(i/2)+Math.floor(a/3))%2===0;case r.Patterns.PATTERN101:return i*a%2+i*a%3===0;case r.Patterns.PATTERN110:return(i*a%2+i*a%3)%2===0;case r.Patterns.PATTERN111:return(i*a%3+(i+a)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}r.applyMask=function(i,a){const c=a.size;for(let u=0;u<c;u++)for(let f=0;f<c;f++)a.isReserved(f,u)||a.xor(f,u,t(i,f,u))},r.getBestMask=function(i,a){const c=Object.keys(r.Patterns).length;let u=0,f=1/0;for(let h=0;h<c;h++){a(h),r.applyMask(h,i);const m=r.getPenaltyN1(i)+r.getPenaltyN2(i)+r.getPenaltyN3(i)+r.getPenaltyN4(i);r.applyMask(h,i),m<f&&(f=m,u=h)}return u}})(ym);var xc={};const yi=Ec,Ic=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Dc=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];xc.getBlocksCount=function(e,t){switch(t){case yi.L:return Ic[(e-1)*4+0];case yi.M:return Ic[(e-1)*4+1];case yi.Q:return Ic[(e-1)*4+2];case yi.H:return Ic[(e-1)*4+3];default:return}},xc.getTotalCodewordsCount=function(e,t){switch(t){case yi.L:return Dc[(e-1)*4+0];case yi.M:return Dc[(e-1)*4+1];case yi.Q:return Dc[(e-1)*4+2];case yi.H:return Dc[(e-1)*4+3];default:return}};var wm={},Sc={};const ia=new Uint8Array(512),Oc=new Uint8Array(256);(function(){let e=1;for(let t=0;t<255;t++)ia[t]=e,Oc[e]=t,e<<=1,e&256&&(e^=285);for(let t=255;t<512;t++)ia[t]=ia[t-255]})(),Sc.log=function(e){if(e<1)throw new Error("log("+e+")");return Oc[e]},Sc.exp=function(e){return ia[e]},Sc.mul=function(e,t){return e===0||t===0?0:ia[Oc[e]+Oc[t]]},function(r){const e=Sc;r.mul=function(n,i){const a=new Uint8Array(n.length+i.length-1);for(let c=0;c<n.length;c++)for(let u=0;u<i.length;u++)a[c+u]^=e.mul(n[c],i[u]);return a},r.mod=function(n,i){let a=new Uint8Array(n);for(;a.length-i.length>=0;){const c=a[0];for(let f=0;f<i.length;f++)a[f]^=e.mul(i[f],c);let u=0;for(;u<a.length&&a[u]===0;)u++;a=a.slice(u)}return a},r.generateECPolynomial=function(n){let i=new Uint8Array([1]);for(let a=0;a<n;a++)i=r.mul(i,new Uint8Array([1,e.exp(a)]));return i}}(wm);const bm=wm;function Mh(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}Mh.prototype.initialize=function(e){this.degree=e,this.genPoly=bm.generateECPolynomial(this.degree)},Mh.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const n=bm.mod(t,this.genPoly),i=this.degree-n.length;if(i>0){const a=new Uint8Array(this.degree);return a.set(n,i),a}return n};var zD=Mh,_m={},wi={},Uh={};Uh.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var Cn={};const Em="[0-9]+",qD="[A-Z $%*+\\-./:]+";let sa="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";sa=sa.replace(/u/g,"\\u");const HD="(?:(?![A-Z0-9 $%*+\\-./:]|"+sa+`)(?:.|[\r
|
|
132
|
+
]))+`;Cn.KANJI=new RegExp(sa,"g"),Cn.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Cn.BYTE=new RegExp(HD,"g"),Cn.NUMERIC=new RegExp(Em,"g"),Cn.ALPHANUMERIC=new RegExp(qD,"g");const WD=new RegExp("^"+sa+"$"),KD=new RegExp("^"+Em+"$"),VD=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");Cn.testKanji=function(e){return WD.test(e)},Cn.testNumeric=function(e){return KD.test(e)},Cn.testAlphanumeric=function(e){return VD.test(e)},function(r){const e=Uh,t=Cn;r.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},r.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},r.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},r.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},r.MIXED={bit:-1},r.getCharCountIndicator=function(a,c){if(!a.ccBits)throw new Error("Invalid mode: "+a);if(!e.isValid(c))throw new Error("Invalid version: "+c);return c>=1&&c<10?a.ccBits[0]:c<27?a.ccBits[1]:a.ccBits[2]},r.getBestModeForData=function(a){return t.testNumeric(a)?r.NUMERIC:t.testAlphanumeric(a)?r.ALPHANUMERIC:t.testKanji(a)?r.KANJI:r.BYTE},r.toString=function(a){if(a&&a.id)return a.id;throw new Error("Invalid mode")},r.isValid=function(a){return a&&a.bit&&a.ccBits};function n(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"numeric":return r.NUMERIC;case"alphanumeric":return r.ALPHANUMERIC;case"kanji":return r.KANJI;case"byte":return r.BYTE;default:throw new Error("Unknown mode: "+i)}}r.from=function(a,c){if(r.isValid(a))return a;try{return n(a)}catch{return c}}}(wi),function(r){const e=Vr,t=xc,n=Ec,i=wi,a=Uh,c=7973,u=e.getBCHDigit(c);function f(y,b,I){for(let A=1;A<=40;A++)if(b<=r.getCapacity(A,I,y))return A}function h(y,b){return i.getCharCountIndicator(y,b)+4}function m(y,b){let I=0;return y.forEach(function(A){const U=h(A.mode,b);I+=U+A.getBitsLength()}),I}function w(y,b){for(let I=1;I<=40;I++)if(m(y,I)<=r.getCapacity(I,b,i.MIXED))return I}r.from=function(b,I){return a.isValid(b)?parseInt(b,10):I},r.getCapacity=function(b,I,A){if(!a.isValid(b))throw new Error("Invalid QR Code version");typeof A>"u"&&(A=i.BYTE);const U=e.getSymbolTotalCodewords(b),j=t.getTotalCodewordsCount(b,I),$=(U-j)*8;if(A===i.MIXED)return $;const T=$-h(A,b);switch(A){case i.NUMERIC:return Math.floor(T/10*3);case i.ALPHANUMERIC:return Math.floor(T/11*2);case i.KANJI:return Math.floor(T/13);case i.BYTE:default:return Math.floor(T/8)}},r.getBestVersionForData=function(b,I){let A;const U=n.from(I,n.M);if(Array.isArray(b)){if(b.length>1)return w(b,U);if(b.length===0)return 1;A=b[0]}else A=b;return f(A.mode,A.getLength(),U)},r.getEncodedBits=function(b){if(!a.isValid(b)||b<7)throw new Error("Invalid QR Code version");let I=b<<12;for(;e.getBCHDigit(I)-u>=0;)I^=c<<e.getBCHDigit(I)-u;return b<<12|I}}(_m);var xm={};const jh=Vr,Im=1335,GD=21522,Dm=jh.getBCHDigit(Im);xm.getEncodedBits=function(e,t){const n=e.bit<<3|t;let i=n<<10;for(;jh.getBCHDigit(i)-Dm>=0;)i^=Im<<jh.getBCHDigit(i)-Dm;return(n<<10|i)^GD};var Sm={};const YD=wi;function ks(r){this.mode=YD.NUMERIC,this.data=r.toString()}ks.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},ks.prototype.getLength=function(){return this.data.length},ks.prototype.getBitsLength=function(){return ks.getBitsLength(this.data.length)},ks.prototype.write=function(e){let t,n,i;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),i=parseInt(n,10),e.put(i,10);const a=this.data.length-t;a>0&&(n=this.data.substr(t),i=parseInt(n,10),e.put(i,a*3+1))};var ZD=ks;const JD=wi,Fh=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function zs(r){this.mode=JD.ALPHANUMERIC,this.data=r}zs.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)},zs.prototype.getLength=function(){return this.data.length},zs.prototype.getBitsLength=function(){return zs.getBitsLength(this.data.length)},zs.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=Fh.indexOf(this.data[t])*45;n+=Fh.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(Fh.indexOf(this.data[t]),6)};var QD=zs,XD=function(e){for(var t=[],n=e.length,i=0;i<n;i++){var a=e.charCodeAt(i);if(a>=55296&&a<=56319&&n>i+1){var c=e.charCodeAt(i+1);c>=56320&&c<=57343&&(a=(a-55296)*1024+c-56320+65536,i+=1)}if(a<128){t.push(a);continue}if(a<2048){t.push(a>>6|192),t.push(a&63|128);continue}if(a<55296||a>=57344&&a<65536){t.push(a>>12|224),t.push(a>>6&63|128),t.push(a&63|128);continue}if(a>=65536&&a<=1114111){t.push(a>>18|240),t.push(a>>12&63|128),t.push(a>>6&63|128),t.push(a&63|128);continue}t.push(239,191,189)}return new Uint8Array(t).buffer};const eS=XD,tS=wi;function qs(r){this.mode=tS.BYTE,typeof r=="string"&&(r=eS(r)),this.data=new Uint8Array(r)}qs.getBitsLength=function(e){return e*8},qs.prototype.getLength=function(){return this.data.length},qs.prototype.getBitsLength=function(){return qs.getBitsLength(this.data.length)},qs.prototype.write=function(r){for(let e=0,t=this.data.length;e<t;e++)r.put(this.data[e],8)};var rS=qs;const nS=wi,iS=Vr;function Hs(r){this.mode=nS.KANJI,this.data=r}Hs.getBitsLength=function(e){return e*13},Hs.prototype.getLength=function(){return this.data.length},Hs.prototype.getBitsLength=function(){return Hs.getBitsLength(this.data.length)},Hs.prototype.write=function(r){let e;for(e=0;e<this.data.length;e++){let t=iS.toSJIS(this.data[e]);if(t>=33088&&t<=40956)t-=33088;else if(t>=57408&&t<=60351)t-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
|
|
133
|
+
Make sure your charset is UTF-8`);t=(t>>>8&255)*192+(t&255),r.put(t,13)}};var sS=Hs,Om={exports:{}};(function(r){var e={single_source_shortest_paths:function(t,n,i){var a={},c={};c[n]=0;var u=e.PriorityQueue.make();u.push(n,0);for(var f,h,m,w,y,b,I,A,U;!u.empty();){f=u.pop(),h=f.value,w=f.cost,y=t[h]||{};for(m in y)y.hasOwnProperty(m)&&(b=y[m],I=w+b,A=c[m],U=typeof c[m]>"u",(U||A>I)&&(c[m]=I,u.push(m,I),a[m]=h))}if(typeof i<"u"&&typeof c[i]>"u"){var j=["Could not find a path from ",n," to ",i,"."].join("");throw new Error(j)}return a},extract_shortest_path_from_predecessor_list:function(t,n){for(var i=[],a=n;a;)i.push(a),t[a],a=t[a];return i.reverse(),i},find_path:function(t,n,i){var a=e.single_source_shortest_paths(t,n,i);return e.extract_shortest_path_from_predecessor_list(a,i)},PriorityQueue:{make:function(t){var n=e.PriorityQueue,i={},a;t=t||{};for(a in n)n.hasOwnProperty(a)&&(i[a]=n[a]);return i.queue=[],i.sorter=t.sorter||n.default_sorter,i},default_sorter:function(t,n){return t.cost-n.cost},push:function(t,n){var i={value:t,cost:n};this.queue.push(i),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};r.exports=e})(Om),function(r){const e=wi,t=ZD,n=QD,i=rS,a=sS,c=Cn,u=Vr,f=Om.exports;function h(j){return unescape(encodeURIComponent(j)).length}function m(j,$,T){const O=[];let P;for(;(P=j.exec(T))!==null;)O.push({data:P[0],index:P.index,mode:$,length:P[0].length});return O}function w(j){const $=m(c.NUMERIC,e.NUMERIC,j),T=m(c.ALPHANUMERIC,e.ALPHANUMERIC,j);let O,P;return u.isKanjiModeEnabled()?(O=m(c.BYTE,e.BYTE,j),P=m(c.KANJI,e.KANJI,j)):(O=m(c.BYTE_KANJI,e.BYTE,j),P=[]),$.concat(T,O,P).sort(function(d,_){return d.index-_.index}).map(function(d){return{data:d.data,mode:d.mode,length:d.length}})}function y(j,$){switch($){case e.NUMERIC:return t.getBitsLength(j);case e.ALPHANUMERIC:return n.getBitsLength(j);case e.KANJI:return a.getBitsLength(j);case e.BYTE:return i.getBitsLength(j)}}function b(j){return j.reduce(function($,T){const O=$.length-1>=0?$[$.length-1]:null;return O&&O.mode===T.mode?($[$.length-1].data+=T.data,$):($.push(T),$)},[])}function I(j){const $=[];for(let T=0;T<j.length;T++){const O=j[T];switch(O.mode){case e.NUMERIC:$.push([O,{data:O.data,mode:e.ALPHANUMERIC,length:O.length},{data:O.data,mode:e.BYTE,length:O.length}]);break;case e.ALPHANUMERIC:$.push([O,{data:O.data,mode:e.BYTE,length:O.length}]);break;case e.KANJI:$.push([O,{data:O.data,mode:e.BYTE,length:h(O.data)}]);break;case e.BYTE:$.push([{data:O.data,mode:e.BYTE,length:h(O.data)}])}}return $}function A(j,$){const T={},O={start:{}};let P=["start"];for(let x=0;x<j.length;x++){const d=j[x],_=[];for(let H=0;H<d.length;H++){const F=d[H],V=""+x+H;_.push(V),T[V]={node:F,lastCount:0},O[V]={};for(let se=0;se<P.length;se++){const ce=P[se];T[ce]&&T[ce].node.mode===F.mode?(O[ce][V]=y(T[ce].lastCount+F.length,F.mode)-y(T[ce].lastCount,F.mode),T[ce].lastCount+=F.length):(T[ce]&&(T[ce].lastCount=F.length),O[ce][V]=y(F.length,F.mode)+4+e.getCharCountIndicator(F.mode,$))}}P=_}for(let x=0;x<P.length;x++)O[P[x]].end=0;return{map:O,table:T}}function U(j,$){let T;const O=e.getBestModeForData(j);if(T=e.from($,O),T!==e.BYTE&&T.bit<O.bit)throw new Error('"'+j+'" cannot be encoded with mode '+e.toString(T)+`.
|
|
134
|
+
Suggested mode is: `+e.toString(O));switch(T===e.KANJI&&!u.isKanjiModeEnabled()&&(T=e.BYTE),T){case e.NUMERIC:return new t(j);case e.ALPHANUMERIC:return new n(j);case e.KANJI:return new a(j);case e.BYTE:return new i(j)}}r.fromArray=function($){return $.reduce(function(T,O){return typeof O=="string"?T.push(U(O,null)):O.data&&T.push(U(O.data,O.mode)),T},[])},r.fromString=function($,T){const O=w($,u.isKanjiModeEnabled()),P=I(O),x=A(P,T),d=f.find_path(x.map,"start","end"),_=[];for(let H=1;H<d.length-1;H++)_.push(x.table[d[H]].node);return r.fromArray(b(_))},r.rawSplit=function($){return r.fromArray(w($,u.isKanjiModeEnabled()))}}(Sm);const Cc=Vr,Bh=Ec,oS=FD,aS=BD,cS=gm,lS=mm,kh=ym,zh=xc,uS=zD,$c=_m,hS=xm,fS=wi,qh=Sm;function dS(r,e){const t=r.size,n=lS.getPositions(e);for(let i=0;i<n.length;i++){const a=n[i][0],c=n[i][1];for(let u=-1;u<=7;u++)if(!(a+u<=-1||t<=a+u))for(let f=-1;f<=7;f++)c+f<=-1||t<=c+f||(u>=0&&u<=6&&(f===0||f===6)||f>=0&&f<=6&&(u===0||u===6)||u>=2&&u<=4&&f>=2&&f<=4?r.set(a+u,c+f,!0,!0):r.set(a+u,c+f,!1,!0))}}function pS(r){const e=r.size;for(let t=8;t<e-8;t++){const n=t%2===0;r.set(t,6,n,!0),r.set(6,t,n,!0)}}function gS(r,e){const t=cS.getPositions(e);for(let n=0;n<t.length;n++){const i=t[n][0],a=t[n][1];for(let c=-2;c<=2;c++)for(let u=-2;u<=2;u++)c===-2||c===2||u===-2||u===2||c===0&&u===0?r.set(i+c,a+u,!0,!0):r.set(i+c,a+u,!1,!0)}}function mS(r,e){const t=r.size,n=$c.getEncodedBits(e);let i,a,c;for(let u=0;u<18;u++)i=Math.floor(u/3),a=u%3+t-8-3,c=(n>>u&1)===1,r.set(i,a,c,!0),r.set(a,i,c,!0)}function Hh(r,e,t){const n=r.size,i=hS.getEncodedBits(e,t);let a,c;for(a=0;a<15;a++)c=(i>>a&1)===1,a<6?r.set(a,8,c,!0):a<8?r.set(a+1,8,c,!0):r.set(n-15+a,8,c,!0),a<8?r.set(8,n-a-1,c,!0):a<9?r.set(8,15-a-1+1,c,!0):r.set(8,15-a-1,c,!0);r.set(n-8,8,1,!0)}function vS(r,e){const t=r.size;let n=-1,i=t-1,a=7,c=0;for(let u=t-1;u>0;u-=2)for(u===6&&u--;;){for(let f=0;f<2;f++)if(!r.isReserved(i,u-f)){let h=!1;c<e.length&&(h=(e[c]>>>a&1)===1),r.set(i,u-f,h),a--,a===-1&&(c++,a=7)}if(i+=n,i<0||t<=i){i-=n,n=-n;break}}}function yS(r,e,t){const n=new oS;t.forEach(function(f){n.put(f.mode.bit,4),n.put(f.getLength(),fS.getCharCountIndicator(f.mode,r)),f.write(n)});const i=Cc.getSymbolTotalCodewords(r),a=zh.getTotalCodewordsCount(r,e),c=(i-a)*8;for(n.getLengthInBits()+4<=c&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);const u=(c-n.getLengthInBits())/8;for(let f=0;f<u;f++)n.put(f%2?17:236,8);return wS(n,r,e)}function wS(r,e,t){const n=Cc.getSymbolTotalCodewords(e),i=zh.getTotalCodewordsCount(e,t),a=n-i,c=zh.getBlocksCount(e,t),u=n%c,f=c-u,h=Math.floor(n/c),m=Math.floor(a/c),w=m+1,y=h-m,b=new uS(y);let I=0;const A=new Array(c),U=new Array(c);let j=0;const $=new Uint8Array(r.buffer);for(let d=0;d<c;d++){const _=d<f?m:w;A[d]=$.slice(I,I+_),U[d]=b.encode(A[d]),I+=_,j=Math.max(j,_)}const T=new Uint8Array(n);let O=0,P,x;for(P=0;P<j;P++)for(x=0;x<c;x++)P<A[x].length&&(T[O++]=A[x][P]);for(P=0;P<y;P++)for(x=0;x<c;x++)T[O++]=U[x][P];return T}function bS(r,e,t,n){let i;if(Array.isArray(r))i=qh.fromArray(r);else if(typeof r=="string"){let h=e;if(!h){const m=qh.rawSplit(r);h=$c.getBestVersionForData(m,t)}i=qh.fromString(r,h||40)}else throw new Error("Invalid data");const a=$c.getBestVersionForData(i,t);if(!a)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=a;else if(e<a)throw new Error(`
|
|
135
135
|
The chosen QR Code version cannot contain this amount of data.
|
|
136
136
|
Minimum version required to store current data is: `+a+`.
|
|
137
|
-
`);const c=
|
|
138
|
-
`;return typeof n=="function"&&n(null,y),y};const YD=lD,jh=Xg,vm=pm,JD=gm;function Fh(r,e,t,n,i){const a=[].slice.call(arguments,1),c=a.length,u=typeof a[c-1]=="function";if(!u&&!YD())throw new Error("Callback required as last argument");if(u){if(c<2)throw new Error("Too few arguments provided");c===2?(i=t,t=e,e=n=void 0):c===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=t,t=e,e=void 0))}else{if(c<1)throw new Error("Too few arguments provided");return c===1?(t=e,e=n=void 0):c===2&&!e.getContext&&(n=t,t=e,e=void 0),new Promise(function(f,h){try{const m=jh.create(t,n);f(r(m,e,n))}catch(m){h(m)}})}try{const f=jh.create(t,n);i(null,r(f,e,n))}catch(f){i(f)}}Vo.create=jh.create,Vo.toCanvas=Fh.bind(null,vm.render),Vo.toDataURL=Fh.bind(null,vm.renderToDataURL),Vo.toString=Fh.bind(null,function(r,e,t){return JD.render(r,t)});var ZD=Object.defineProperty,ym=Object.getOwnPropertySymbols,QD=Object.prototype.hasOwnProperty,XD=Object.prototype.propertyIsEnumerable,wm=(r,e,t)=>e in r?ZD(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Bh=(r,e)=>{for(var t in e||(e={}))QD.call(e,t)&&wm(r,t,e[t]);if(ym)for(var t of ym(e))XD.call(e,t)&&wm(r,t,e[t]);return r};function eS(){var r;const e=(r=ui.state.themeMode)!=null?r:"dark",t={light:{foreground:{1:"rgb(20,20,20)",2:"rgb(121,134,134)",3:"rgb(158,169,169)"},background:{1:"rgb(255,255,255)",2:"rgb(241,243,243)",3:"rgb(228,231,231)"},overlay:"rgba(0,0,0,0.1)"},dark:{foreground:{1:"rgb(228,231,231)",2:"rgb(148,158,158)",3:"rgb(110,119,119)"},background:{1:"rgb(20,20,20)",2:"rgb(39,42,42)",3:"rgb(59,64,64)"},overlay:"rgba(255,255,255,0.1)"}}[e];return{"--wcm-color-fg-1":t.foreground[1],"--wcm-color-fg-2":t.foreground[2],"--wcm-color-fg-3":t.foreground[3],"--wcm-color-bg-1":t.background[1],"--wcm-color-bg-2":t.background[2],"--wcm-color-bg-3":t.background[3],"--wcm-color-overlay":t.overlay}}function bm(){return{"--wcm-accent-color":"#3396FF","--wcm-accent-fill-color":"#FFFFFF","--wcm-z-index":"89","--wcm-background-color":"#3396FF","--wcm-background-border-radius":"8px","--wcm-container-border-radius":"30px","--wcm-wallet-icon-border-radius":"15px","--wcm-wallet-icon-large-border-radius":"30px","--wcm-wallet-icon-small-border-radius":"7px","--wcm-input-border-radius":"28px","--wcm-button-border-radius":"10px","--wcm-notification-border-radius":"36px","--wcm-secondary-button-border-radius":"28px","--wcm-icon-button-border-radius":"50%","--wcm-button-hover-highlight-border-radius":"10px","--wcm-text-big-bold-size":"20px","--wcm-text-big-bold-weight":"600","--wcm-text-big-bold-line-height":"24px","--wcm-text-big-bold-letter-spacing":"-0.03em","--wcm-text-big-bold-text-transform":"none","--wcm-text-xsmall-bold-size":"10px","--wcm-text-xsmall-bold-weight":"700","--wcm-text-xsmall-bold-line-height":"12px","--wcm-text-xsmall-bold-letter-spacing":"0.02em","--wcm-text-xsmall-bold-text-transform":"uppercase","--wcm-text-xsmall-regular-size":"12px","--wcm-text-xsmall-regular-weight":"600","--wcm-text-xsmall-regular-line-height":"14px","--wcm-text-xsmall-regular-letter-spacing":"-0.03em","--wcm-text-xsmall-regular-text-transform":"none","--wcm-text-small-thin-size":"14px","--wcm-text-small-thin-weight":"500","--wcm-text-small-thin-line-height":"16px","--wcm-text-small-thin-letter-spacing":"-0.03em","--wcm-text-small-thin-text-transform":"none","--wcm-text-small-regular-size":"14px","--wcm-text-small-regular-weight":"600","--wcm-text-small-regular-line-height":"16px","--wcm-text-small-regular-letter-spacing":"-0.03em","--wcm-text-small-regular-text-transform":"none","--wcm-text-medium-regular-size":"16px","--wcm-text-medium-regular-weight":"600","--wcm-text-medium-regular-line-height":"20px","--wcm-text-medium-regular-letter-spacing":"-0.03em","--wcm-text-medium-regular-text-transform":"none","--wcm-font-family":"-apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', sans-serif","--wcm-font-feature-settings":"'tnum' on, 'lnum' on, 'case' on","--wcm-success-color":"rgb(38,181,98)","--wcm-error-color":"rgb(242, 90, 103)","--wcm-overlay-background-color":"rgba(0, 0, 0, 0.3)","--wcm-overlay-backdrop-filter":"none"}}const rt={getPreset(r){return bm()[r]},setTheme(){const r=document.querySelector(":root"),{themeVariables:e}=ui.state;if(r){const t=Bh(Bh(Bh({},eS()),bm()),e);Object.entries(t).forEach(([n,i])=>r.style.setProperty(n,i))}},globalCss:lt`*,::after,::before{margin:0;padding:0;box-sizing:border-box;font-style:normal;text-rendering:optimizeSpeed;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-tap-highlight-color:transparent;backface-visibility:hidden}button{cursor:pointer;display:flex;justify-content:center;align-items:center;position:relative;border:none;background-color:transparent;transition:all .2s ease}@media (hover:hover) and (pointer:fine){button:active{transition:all .1s ease;transform:scale(.93)}}button::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;transition:background-color,.2s ease}button:disabled{cursor:not-allowed}button svg,button wcm-text{position:relative;z-index:1}input{border:none;outline:0;appearance:none}img{display:block}::selection{color:var(--wcm-accent-fill-color);background:var(--wcm-accent-color)}`},tS=lt`button{border-radius:var(--wcm-secondary-button-border-radius);height:28px;padding:0 10px;background-color:var(--wcm-accent-color)}button path{fill:var(--wcm-accent-fill-color)}button::after{border-radius:inherit;border:1px solid var(--wcm-color-overlay)}button:disabled::after{background-color:transparent}.wcm-icon-left svg{margin-right:5px}.wcm-icon-right svg{margin-left:5px}button:active::after{background-color:var(--wcm-color-overlay)}.wcm-ghost,.wcm-ghost:active::after,.wcm-outline{background-color:transparent}.wcm-ghost:active{opacity:.5}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}.wcm-ghost:hover::after{background-color:transparent}.wcm-ghost:hover{opacity:.5}}button:disabled{background-color:var(--wcm-color-bg-3);pointer-events:none}.wcm-ghost::after{border-color:transparent}.wcm-ghost path{fill:var(--wcm-color-fg-2)}.wcm-outline path{fill:var(--wcm-accent-color)}.wcm-outline:disabled{background-color:transparent;opacity:.5}`;var rS=Object.defineProperty,nS=Object.getOwnPropertyDescriptor,Fs=(r,e,t,n)=>{for(var i=n>1?void 0:n?nS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&rS(e,t,i),i};let mi=class extends Ye{constructor(){super(...arguments),this.disabled=!1,this.iconLeft=void 0,this.iconRight=void 0,this.onClick=()=>null,this.variant="default"}render(){const r={"wcm-icon-left":this.iconLeft!==void 0,"wcm-icon-right":this.iconRight!==void 0,"wcm-ghost":this.variant==="ghost","wcm-outline":this.variant==="outline"};let e="inverse";return this.variant==="ghost"&&(e="secondary"),this.variant==="outline"&&(e="accent"),he`<button class="${qn(r)}" ?disabled="${this.disabled}" @click="${this.onClick}">${this.iconLeft}<wcm-text variant="small-regular" color="${e}"><slot></slot></wcm-text>${this.iconRight}</button>`}};mi.styles=[rt.globalCss,tS],Fs([Be({type:Boolean})],mi.prototype,"disabled",2),Fs([Be()],mi.prototype,"iconLeft",2),Fs([Be()],mi.prototype,"iconRight",2),Fs([Be()],mi.prototype,"onClick",2),Fs([Be()],mi.prototype,"variant",2),mi=Fs([ot("wcm-button")],mi);const iS=lt`:host{display:inline-block}button{padding:0 15px 1px;height:40px;border-radius:var(--wcm-button-border-radius);color:var(--wcm-accent-fill-color);background-color:var(--wcm-accent-color)}button::after{content:'';top:0;bottom:0;left:0;right:0;position:absolute;background-color:transparent;border-radius:inherit;transition:background-color .2s ease;border:1px solid var(--wcm-color-overlay)}button:active::after{background-color:var(--wcm-color-overlay)}button:disabled{padding-bottom:0;background-color:var(--wcm-color-bg-3);color:var(--wcm-color-fg-3)}.wcm-secondary{color:var(--wcm-accent-color);background-color:transparent}.wcm-secondary::after{display:none}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}}`;var sS=Object.defineProperty,oS=Object.getOwnPropertyDescriptor,kh=(r,e,t,n)=>{for(var i=n>1?void 0:n?oS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&sS(e,t,i),i};let Zo=class extends Ye{constructor(){super(...arguments),this.disabled=!1,this.variant="primary"}render(){const r={"wcm-secondary":this.variant==="secondary"};return he`<button ?disabled="${this.disabled}" class="${qn(r)}"><slot></slot></button>`}};Zo.styles=[rt.globalCss,iS],kh([Be({type:Boolean})],Zo.prototype,"disabled",2),kh([Be()],Zo.prototype,"variant",2),Zo=kh([ot("wcm-button-big")],Zo);const aS=lt`:host{background-color:var(--wcm-color-bg-2);border-top:1px solid var(--wcm-color-bg-3)}div{padding:10px 20px;display:inherit;flex-direction:inherit;align-items:inherit;width:inherit;justify-content:inherit}`;var cS=Object.defineProperty,lS=Object.getOwnPropertyDescriptor,uS=(r,e,t,n)=>{for(var i=n>1?void 0:n?lS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&cS(e,t,i),i};let qh=class extends Ye{render(){return he`<div><slot></slot></div>`}};qh.styles=[rt.globalCss,aS],qh=uS([ot("wcm-info-footer")],qh);const ht={CROSS_ICON:Nt`<svg width="12" height="12" viewBox="0 0 12 12"><path d="M9.94 11A.75.75 0 1 0 11 9.94L7.414 6.353a.5.5 0 0 1 0-.708L11 2.061A.75.75 0 1 0 9.94 1L6.353 4.586a.5.5 0 0 1-.708 0L2.061 1A.75.75 0 0 0 1 2.06l3.586 3.586a.5.5 0 0 1 0 .708L1 9.939A.75.75 0 1 0 2.06 11l3.586-3.586a.5.5 0 0 1 .708 0L9.939 11Z" fill="#fff"/></svg>`,WALLET_CONNECT_LOGO:Nt`<svg width="178" height="29" viewBox="0 0 178 29" id="wcm-wc-logo"><path d="M10.683 7.926c5.284-5.17 13.85-5.17 19.134 0l.636.623a.652.652 0 0 1 0 .936l-2.176 2.129a.343.343 0 0 1-.478 0l-.875-.857c-3.686-3.607-9.662-3.607-13.348 0l-.937.918a.343.343 0 0 1-.479 0l-2.175-2.13a.652.652 0 0 1 0-.936l.698-.683Zm23.633 4.403 1.935 1.895a.652.652 0 0 1 0 .936l-8.73 8.543a.687.687 0 0 1-.956 0L20.37 17.64a.172.172 0 0 0-.239 0l-6.195 6.063a.687.687 0 0 1-.957 0l-8.73-8.543a.652.652 0 0 1 0-.936l1.936-1.895a.687.687 0 0 1 .957 0l6.196 6.064a.172.172 0 0 0 .239 0l6.195-6.064a.687.687 0 0 1 .957 0l6.196 6.064a.172.172 0 0 0 .24 0l6.195-6.064a.687.687 0 0 1 .956 0ZM48.093 20.948l2.338-9.355c.139-.515.258-1.07.416-1.942.12.872.258 1.427.357 1.942l2.022 9.355h4.181l3.528-13.874h-3.21l-1.943 8.523a24.825 24.825 0 0 0-.456 2.457c-.158-.931-.317-1.625-.495-2.438l-1.883-8.542h-4.201l-2.042 8.542a41.204 41.204 0 0 0-.475 2.438 41.208 41.208 0 0 0-.476-2.438l-1.903-8.542h-3.349l3.508 13.874h4.083ZM63.33 21.304c1.585 0 2.596-.654 3.11-1.605-.059.297-.078.595-.078.892v.357h2.655V15.22c0-2.735-1.248-4.32-4.3-4.32-2.636 0-4.36 1.466-4.52 3.487h2.914c.1-.891.734-1.426 1.705-1.426.911 0 1.407.515 1.407 1.11 0 .435-.258.693-1.03.792l-1.388.159c-2.061.257-3.825 1.01-3.825 3.19 0 1.982 1.645 3.092 3.35 3.092Zm.891-2.041c-.773 0-1.348-.436-1.348-1.19 0-.733.655-1.09 1.645-1.268l.674-.119c.575-.118.892-.218 1.09-.396v.912c0 1.228-.892 2.06-2.06 2.06ZM70.398 7.074v13.874h2.874V7.074h-2.874ZM74.934 7.074v13.874h2.874V7.074h-2.874ZM84.08 21.304c2.735 0 4.5-1.546 4.697-3.567h-2.893c-.139.892-.892 1.387-1.804 1.387-1.228 0-2.12-.99-2.14-2.358h6.897v-.555c0-3.21-1.764-5.312-4.816-5.312-2.933 0-4.994 2.062-4.994 5.173 0 3.37 2.12 5.232 5.053 5.232Zm-2.16-6.421c.119-1.11.932-1.922 2.081-1.922 1.11 0 1.883.772 1.903 1.922H81.92ZM94.92 21.146c.633 0 1.248-.1 1.525-.179v-2.18c-.218.04-.475.06-.693.06-1.05 0-1.427-.595-1.427-1.566v-3.805h2.338v-2.24h-2.338V7.788H91.47v3.448H89.37v2.24h2.1v4.201c0 2.3 1.15 3.469 3.45 3.469ZM104.62 21.304c3.924 0 6.302-2.299 6.599-5.608h-3.111c-.238 1.803-1.506 3.032-3.369 3.032-2.2 0-3.746-1.784-3.746-4.796 0-2.953 1.605-4.638 3.805-4.638 1.883 0 2.953 1.15 3.171 2.834h3.191c-.317-3.448-2.854-5.41-6.342-5.41-3.984 0-7.036 2.695-7.036 7.214 0 4.677 2.676 7.372 6.838 7.372ZM117.449 21.304c2.993 0 5.114-1.882 5.114-5.172 0-3.23-2.121-5.233-5.114-5.233-2.972 0-5.093 2.002-5.093 5.233 0 3.29 2.101 5.172 5.093 5.172Zm0-2.22c-1.327 0-2.18-1.09-2.18-2.952 0-1.903.892-2.973 2.18-2.973 1.308 0 2.2 1.07 2.2 2.973 0 1.862-.872 2.953-2.2 2.953ZM126.569 20.948v-5.689c0-1.208.753-2.1 1.823-2.1 1.011 0 1.606.773 1.606 2.06v5.729h2.873v-6.144c0-2.339-1.229-3.905-3.428-3.905-1.526 0-2.458.734-2.953 1.606a5.31 5.31 0 0 0 .079-.892v-.377h-2.874v9.712h2.874ZM137.464 20.948v-5.689c0-1.208.753-2.1 1.823-2.1 1.011 0 1.606.773 1.606 2.06v5.729h2.873v-6.144c0-2.339-1.228-3.905-3.428-3.905-1.526 0-2.458.734-2.953 1.606a5.31 5.31 0 0 0 .079-.892v-.377h-2.874v9.712h2.874ZM149.949 21.304c2.735 0 4.499-1.546 4.697-3.567h-2.893c-.139.892-.892 1.387-1.804 1.387-1.228 0-2.12-.99-2.14-2.358h6.897v-.555c0-3.21-1.764-5.312-4.816-5.312-2.933 0-4.994 2.062-4.994 5.173 0 3.37 2.12 5.232 5.053 5.232Zm-2.16-6.421c.119-1.11.932-1.922 2.081-1.922 1.11 0 1.883.772 1.903 1.922h-3.984ZM160.876 21.304c3.013 0 4.658-1.645 4.975-4.201h-2.874c-.099 1.07-.713 1.982-2.001 1.982-1.309 0-2.2-1.21-2.2-2.993 0-1.942 1.03-2.933 2.259-2.933 1.209 0 1.803.872 1.883 1.882h2.873c-.218-2.358-1.823-4.142-4.776-4.142-2.874 0-5.153 1.903-5.153 5.193 0 3.25 1.923 5.212 5.014 5.212ZM172.067 21.146c.634 0 1.248-.1 1.526-.179v-2.18c-.218.04-.476.06-.694.06-1.05 0-1.427-.595-1.427-1.566v-3.805h2.339v-2.24h-2.339V7.788h-2.854v3.448h-2.1v2.24h2.1v4.201c0 2.3 1.15 3.469 3.449 3.469Z" fill="#fff"/></svg>`,WALLET_CONNECT_ICON:Nt`<svg width="28" height="20" viewBox="0 0 28 20"><g clip-path="url(#a)"><path d="M7.386 6.482c3.653-3.576 9.575-3.576 13.228 0l.44.43a.451.451 0 0 1 0 .648L19.55 9.033a.237.237 0 0 1-.33 0l-.606-.592c-2.548-2.496-6.68-2.496-9.228 0l-.648.634a.237.237 0 0 1-.33 0L6.902 7.602a.451.451 0 0 1 0-.647l.483-.473Zm16.338 3.046 1.339 1.31a.451.451 0 0 1 0 .648l-6.035 5.909a.475.475 0 0 1-.662 0L14.083 13.2a.119.119 0 0 0-.166 0l-4.283 4.194a.475.475 0 0 1-.662 0l-6.035-5.91a.451.451 0 0 1 0-.647l1.338-1.31a.475.475 0 0 1 .662 0l4.283 4.194c.046.044.12.044.166 0l4.283-4.194a.475.475 0 0 1 .662 0l4.283 4.194c.046.044.12.044.166 0l4.283-4.194a.475.475 0 0 1 .662 0Z" fill="#000000"/></g><defs><clipPath id="a"><path fill="#ffffff" d="M0 0h28v20H0z"/></clipPath></defs></svg>`,WALLET_CONNECT_ICON_COLORED:Nt`<svg width="96" height="96" fill="none"><path fill="#fff" d="M25.322 33.597c12.525-12.263 32.83-12.263 45.355 0l1.507 1.476a1.547 1.547 0 0 1 0 2.22l-5.156 5.048a.814.814 0 0 1-1.134 0l-2.074-2.03c-8.737-8.555-22.903-8.555-31.64 0l-2.222 2.175a.814.814 0 0 1-1.134 0l-5.156-5.049a1.547 1.547 0 0 1 0-2.22l1.654-1.62Zm56.019 10.44 4.589 4.494a1.547 1.547 0 0 1 0 2.22l-20.693 20.26a1.628 1.628 0 0 1-2.267 0L48.283 56.632a.407.407 0 0 0-.567 0L33.03 71.012a1.628 1.628 0 0 1-2.268 0L10.07 50.75a1.547 1.547 0 0 1 0-2.22l4.59-4.494a1.628 1.628 0 0 1 2.267 0l14.687 14.38c.156.153.41.153.567 0l14.685-14.38a1.628 1.628 0 0 1 2.268 0l14.687 14.38c.156.153.41.153.567 0l14.686-14.38a1.628 1.628 0 0 1 2.268 0Z"/><path stroke="#000" d="M25.672 33.954c12.33-12.072 32.325-12.072 44.655 0l1.508 1.476a1.047 1.047 0 0 1 0 1.506l-5.157 5.048a.314.314 0 0 1-.434 0l-2.074-2.03c-8.932-8.746-23.409-8.746-32.34 0l-2.222 2.174a.314.314 0 0 1-.434 0l-5.157-5.048a1.047 1.047 0 0 1 0-1.506l1.655-1.62Zm55.319 10.44 4.59 4.494a1.047 1.047 0 0 1 0 1.506l-20.694 20.26a1.128 1.128 0 0 1-1.568 0l-14.686-14.38a.907.907 0 0 0-1.267 0L32.68 70.655a1.128 1.128 0 0 1-1.568 0L10.42 50.394a1.047 1.047 0 0 1 0-1.506l4.59-4.493a1.128 1.128 0 0 1 1.567 0l14.687 14.379a.907.907 0 0 0 1.266 0l-.35-.357.35.357 14.686-14.38a1.128 1.128 0 0 1 1.568 0l14.687 14.38a.907.907 0 0 0 1.267 0l14.686-14.38a1.128 1.128 0 0 1 1.568 0Z"/></svg>`,BACK_ICON:Nt`<svg width="10" height="18" viewBox="0 0 10 18"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.735.179a.75.75 0 0 1 .087 1.057L2.92 8.192a1.25 1.25 0 0 0 0 1.617l5.902 6.956a.75.75 0 1 1-1.144.97L1.776 10.78a2.75 2.75 0 0 1 0-3.559L7.678.265A.75.75 0 0 1 8.735.18Z" fill="#fff"/></svg>`,COPY_ICON:Nt`<svg width="24" height="24" fill="none"><path fill="#fff" fill-rule="evenodd" d="M7.01 7.01c.03-1.545.138-2.5.535-3.28A5 5 0 0 1 9.73 1.545C10.8 1 12.2 1 15 1c2.8 0 4.2 0 5.27.545a5 5 0 0 1 2.185 2.185C23 4.8 23 6.2 23 9c0 2.8 0 4.2-.545 5.27a5 5 0 0 1-2.185 2.185c-.78.397-1.735.505-3.28.534l-.001.01c-.03 1.54-.138 2.493-.534 3.27a5 5 0 0 1-2.185 2.186C13.2 23 11.8 23 9 23c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C1 19.2 1 17.8 1 15c0-2.8 0-4.2.545-5.27A5 5 0 0 1 3.73 7.545C4.508 7.149 5.46 7.04 7 7.01h.01ZM15 15.5c-1.425 0-2.403-.001-3.162-.063-.74-.06-1.139-.172-1.427-.319a3.5 3.5 0 0 1-1.53-1.529c-.146-.288-.257-.686-.318-1.427C8.501 11.403 8.5 10.425 8.5 9c0-1.425.001-2.403.063-3.162.06-.74.172-1.139.318-1.427a3.5 3.5 0 0 1 1.53-1.53c.288-.146.686-.257 1.427-.318.759-.062 1.737-.063 3.162-.063 1.425 0 2.403.001 3.162.063.74.06 1.139.172 1.427.318a3.5 3.5 0 0 1 1.53 1.53c.146.288.257.686.318 1.427.062.759.063 1.737.063 3.162 0 1.425-.001 2.403-.063 3.162-.06.74-.172 1.139-.319 1.427a3.5 3.5 0 0 1-1.529 1.53c-.288.146-.686.257-1.427.318-.759.062-1.737.063-3.162.063ZM7 8.511c-.444.009-.825.025-1.162.052-.74.06-1.139.172-1.427.318a3.5 3.5 0 0 0-1.53 1.53c-.146.288-.257.686-.318 1.427-.062.759-.063 1.737-.063 3.162 0 1.425.001 2.403.063 3.162.06.74.172 1.139.318 1.427a3.5 3.5 0 0 0 1.53 1.53c.288.146.686.257 1.427.318.759.062 1.737.063 3.162.063 1.425 0 2.403-.001 3.162-.063.74-.06 1.139-.172 1.427-.319a3.5 3.5 0 0 0 1.53-1.53c.146-.287.257-.685.318-1.426.027-.337.043-.718.052-1.162H15c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C7 13.2 7 11.8 7 9v-.489Z" clip-rule="evenodd"/></svg>`,RETRY_ICON:Nt`<svg width="15" height="16" viewBox="0 0 15 16"><path d="M6.464 2.03A.75.75 0 0 0 5.403.97L2.08 4.293a1 1 0 0 0 0 1.414L5.403 9.03a.75.75 0 0 0 1.06-1.06L4.672 6.177a.25.25 0 0 1 .177-.427h2.085a4 4 0 1 1-3.93 4.746c-.077-.407-.405-.746-.82-.746-.414 0-.755.338-.7.748a5.501 5.501 0 1 0 5.45-6.248H4.848a.25.25 0 0 1-.177-.427L6.464 2.03Z" fill="#fff"/></svg>`,DESKTOP_ICON:Nt`<svg width="16" height="16" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M0 5.98c0-1.85 0-2.775.394-3.466a3 3 0 0 1 1.12-1.12C2.204 1 3.13 1 4.98 1h6.04c1.85 0 2.775 0 3.466.394a3 3 0 0 1 1.12 1.12C16 3.204 16 4.13 16 5.98v1.04c0 1.85 0 2.775-.394 3.466a3 3 0 0 1-1.12 1.12C13.796 12 12.87 12 11.02 12H4.98c-1.85 0-2.775 0-3.466-.394a3 3 0 0 1-1.12-1.12C0 9.796 0 8.87 0 7.02V5.98ZM4.98 2.5h6.04c.953 0 1.568.001 2.034.043.446.04.608.108.69.154a1.5 1.5 0 0 1 .559.56c.046.08.114.243.154.69.042.465.043 1.08.043 2.033v1.04c0 .952-.001 1.568-.043 2.034-.04.446-.108.608-.154.69a1.499 1.499 0 0 1-.56.559c-.08.046-.243.114-.69.154-.466.042-1.08.043-2.033.043H4.98c-.952 0-1.568-.001-2.034-.043-.446-.04-.608-.108-.69-.154a1.5 1.5 0 0 1-.559-.56c-.046-.08-.114-.243-.154-.69-.042-.465-.043-1.08-.043-2.033V5.98c0-.952.001-1.568.043-2.034.04-.446.108-.608.154-.69a1.5 1.5 0 0 1 .56-.559c.08-.046.243-.114.69-.154.465-.042 1.08-.043 2.033-.043Z" fill="#fff"/><path d="M4 14.25a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Z" fill="#fff"/></svg>`,MOBILE_ICON:Nt`<svg width="16" height="16" viewBox="0 0 16 16"><path d="M6.75 5a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M3 4.98c0-1.85 0-2.775.394-3.466a3 3 0 0 1 1.12-1.12C5.204 0 6.136 0 8 0s2.795 0 3.486.394a3 3 0 0 1 1.12 1.12C13 2.204 13 3.13 13 4.98v6.04c0 1.85 0 2.775-.394 3.466a3 3 0 0 1-1.12 1.12C10.796 16 9.864 16 8 16s-2.795 0-3.486-.394a3 3 0 0 1-1.12-1.12C3 13.796 3 12.87 3 11.02V4.98Zm8.5 0v6.04c0 .953-.001 1.568-.043 2.034-.04.446-.108.608-.154.69a1.499 1.499 0 0 1-.56.559c-.08.045-.242.113-.693.154-.47.042-1.091.043-2.05.043-.959 0-1.58-.001-2.05-.043-.45-.04-.613-.109-.693-.154a1.5 1.5 0 0 1-.56-.56c-.046-.08-.114-.243-.154-.69-.042-.466-.043-1.08-.043-2.033V4.98c0-.952.001-1.568.043-2.034.04-.446.108-.608.154-.69a1.5 1.5 0 0 1 .56-.559c.08-.045.243-.113.693-.154C6.42 1.501 7.041 1.5 8 1.5c.959 0 1.58.001 2.05.043.45.04.613.109.693.154a1.5 1.5 0 0 1 .56.56c.046.08.114.243.154.69.042.465.043 1.08.043 2.033Z" fill="#fff"/></svg>`,ARROW_DOWN_ICON:Nt`<svg width="14" height="14" viewBox="0 0 14 14"><path d="M2.28 7.47a.75.75 0 0 0-1.06 1.06l5.25 5.25a.75.75 0 0 0 1.06 0l5.25-5.25a.75.75 0 0 0-1.06-1.06l-3.544 3.543a.25.25 0 0 1-.426-.177V.75a.75.75 0 0 0-1.5 0v10.086a.25.25 0 0 1-.427.176L2.28 7.47Z" fill="#fff"/></svg>`,ARROW_UP_RIGHT_ICON:Nt`<svg width="15" height="14" fill="none"><path d="M4.5 1.75A.75.75 0 0 1 5.25 1H12a1.5 1.5 0 0 1 1.5 1.5v6.75a.75.75 0 0 1-1.5 0V4.164a.25.25 0 0 0-.427-.176L4.061 11.5A.75.75 0 0 1 3 10.44l7.513-7.513a.25.25 0 0 0-.177-.427H5.25a.75.75 0 0 1-.75-.75Z" fill="#fff"/></svg>`,ARROW_RIGHT_ICON:Nt`<svg width="6" height="14" viewBox="0 0 6 14"><path fill-rule="evenodd" clip-rule="evenodd" d="M2.181 1.099a.75.75 0 0 1 1.024.279l2.433 4.258a2.75 2.75 0 0 1 0 2.729l-2.433 4.257a.75.75 0 1 1-1.303-.744L4.335 7.62a1.25 1.25 0 0 0 0-1.24L1.902 2.122a.75.75 0 0 1 .28-1.023Z" fill="#fff"/></svg>`,QRCODE_ICON:Nt`<svg width="25" height="24" viewBox="0 0 25 24"><path d="M23.748 9a.748.748 0 0 0 .748-.752c-.018-2.596-.128-4.07-.784-5.22a6 6 0 0 0-2.24-2.24c-1.15-.656-2.624-.766-5.22-.784a.748.748 0 0 0-.752.748c0 .414.335.749.748.752 1.015.007 1.82.028 2.494.088.995.09 1.561.256 1.988.5.7.398 1.28.978 1.679 1.678.243.427.41.993.498 1.988.061.675.082 1.479.09 2.493a.753.753 0 0 0 .75.749ZM3.527.788C4.677.132 6.152.022 8.747.004A.748.748 0 0 1 9.5.752a.753.753 0 0 1-.749.752c-1.014.007-1.818.028-2.493.088-.995.09-1.561.256-1.988.5-.7.398-1.28.978-1.679 1.678-.243.427-.41.993-.499 1.988-.06.675-.081 1.479-.088 2.493A.753.753 0 0 1 1.252 9a.748.748 0 0 1-.748-.752c.018-2.596.128-4.07.784-5.22a6 6 0 0 1 2.24-2.24ZM1.252 15a.748.748 0 0 0-.748.752c.018 2.596.128 4.07.784 5.22a6 6 0 0 0 2.24 2.24c1.15.656 2.624.766 5.22.784a.748.748 0 0 0 .752-.748.753.753 0 0 0-.749-.752c-1.014-.007-1.818-.028-2.493-.089-.995-.089-1.561-.255-1.988-.498a4.5 4.5 0 0 1-1.679-1.68c-.243-.426-.41-.992-.499-1.987-.06-.675-.081-1.479-.088-2.493A.753.753 0 0 0 1.252 15ZM22.996 15.749a.753.753 0 0 1 .752-.749c.415 0 .751.338.748.752-.018 2.596-.128 4.07-.784 5.22a6 6 0 0 1-2.24 2.24c-1.15.656-2.624.766-5.22.784a.748.748 0 0 1-.752-.748c0-.414.335-.749.748-.752 1.015-.007 1.82-.028 2.494-.089.995-.089 1.561-.255 1.988-.498a4.5 4.5 0 0 0 1.679-1.68c.243-.426.41-.992.498-1.987.061-.675.082-1.479.09-2.493Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M7 4a2.5 2.5 0 0 0-2.5 2.5v2A2.5 2.5 0 0 0 7 11h2a2.5 2.5 0 0 0 2.5-2.5v-2A2.5 2.5 0 0 0 9 4H7Zm2 1.5H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1ZM13.5 6.5A2.5 2.5 0 0 1 16 4h2a2.5 2.5 0 0 1 2.5 2.5v2A2.5 2.5 0 0 1 18 11h-2a2.5 2.5 0 0 1-2.5-2.5v-2Zm2.5-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1ZM7 13a2.5 2.5 0 0 0-2.5 2.5v2A2.5 2.5 0 0 0 7 20h2a2.5 2.5 0 0 0 2.5-2.5v-2A2.5 2.5 0 0 0 9 13H7Zm2 1.5H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1Z" fill="#fff"/><path d="M13.5 15.5c0-.465 0-.697.038-.89a2 2 0 0 1 1.572-1.572C15.303 13 15.535 13 16 13v2.5h-2.5ZM18 13c.465 0 .697 0 .89.038a2 2 0 0 1 1.572 1.572c.038.193.038.425.038.89H18V13ZM18 17.5h2.5c0 .465 0 .697-.038.89a2 2 0 0 1-1.572 1.572C18.697 20 18.465 20 18 20v-2.5ZM13.5 17.5H16V20c-.465 0-.697 0-.89-.038a2 2 0 0 1-1.572-1.572c-.038-.193-.038-.425-.038-.89Z" fill="#fff"/></svg>`,SCAN_ICON:Nt`<svg width="16" height="16" fill="none"><path fill="#fff" d="M10 15.216c0 .422.347.763.768.74 1.202-.064 2.025-.222 2.71-.613a5.001 5.001 0 0 0 1.865-1.866c.39-.684.549-1.507.613-2.709a.735.735 0 0 0-.74-.768.768.768 0 0 0-.76.732c-.009.157-.02.306-.032.447-.073.812-.206 1.244-.384 1.555-.31.545-.761.996-1.306 1.306-.311.178-.743.311-1.555.384-.141.013-.29.023-.447.032a.768.768 0 0 0-.732.76ZM10 .784c0 .407.325.737.732.76.157.009.306.02.447.032.812.073 1.244.206 1.555.384a3.5 3.5 0 0 1 1.306 1.306c.178.311.311.743.384 1.555.013.142.023.29.032.447a.768.768 0 0 0 .76.732.734.734 0 0 0 .74-.768c-.064-1.202-.222-2.025-.613-2.71A5 5 0 0 0 13.477.658c-.684-.39-1.507-.549-2.709-.613a.735.735 0 0 0-.768.74ZM5.232.044A.735.735 0 0 1 6 .784a.768.768 0 0 1-.732.76c-.157.009-.305.02-.447.032-.812.073-1.244.206-1.555.384A3.5 3.5 0 0 0 1.96 3.266c-.178.311-.311.743-.384 1.555-.013.142-.023.29-.032.447A.768.768 0 0 1 .784 6a.735.735 0 0 1-.74-.768c.064-1.202.222-2.025.613-2.71A5 5 0 0 1 2.523.658C3.207.267 4.03.108 5.233.044ZM5.268 14.456a.768.768 0 0 1 .732.76.734.734 0 0 1-.768.74c-1.202-.064-2.025-.222-2.71-.613a5 5 0 0 1-1.865-1.866c-.39-.684-.549-1.507-.613-2.709A.735.735 0 0 1 .784 10c.407 0 .737.325.76.732.009.157.02.306.032.447.073.812.206 1.244.384 1.555a3.5 3.5 0 0 0 1.306 1.306c.311.178.743.311 1.555.384.142.013.29.023.447.032Z"/></svg>`,CHECKMARK_ICON:Nt`<svg width="13" height="12" viewBox="0 0 13 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.155.132a.75.75 0 0 1 .232 1.035L5.821 11.535a1 1 0 0 1-1.626.09L.665 7.21a.75.75 0 1 1 1.17-.937L4.71 9.867a.25.25 0 0 0 .406-.023L11.12.364a.75.75 0 0 1 1.035-.232Z" fill="#fff"/></svg>`,SEARCH_ICON:Nt`<svg width="20" height="21"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.432 13.992c-.354-.353-.91-.382-1.35-.146a5.5 5.5 0 1 1 2.265-2.265c-.237.441-.208.997.145 1.35l3.296 3.296a.75.75 0 1 1-1.06 1.061l-3.296-3.296Zm.06-5a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z" fill="#949E9E"/></svg>`,WALLET_PLACEHOLDER:Nt`<svg width="60" height="60" fill="none" viewBox="0 0 60 60"><g clip-path="url(#q)"><path id="wallet-placeholder-fill" fill="#fff" d="M0 24.9c0-9.251 0-13.877 1.97-17.332a15 15 0 0 1 5.598-5.597C11.023 0 15.648 0 24.9 0h10.2c9.252 0 13.877 0 17.332 1.97a15 15 0 0 1 5.597 5.598C60 11.023 60 15.648 60 24.9v10.2c0 9.252 0 13.877-1.97 17.332a15.001 15.001 0 0 1-5.598 5.597C48.977 60 44.352 60 35.1 60H24.9c-9.251 0-13.877 0-17.332-1.97a15 15 0 0 1-5.597-5.598C0 48.977 0 44.352 0 35.1V24.9Z"/><path id="wallet-placeholder-dash" stroke="#000" stroke-dasharray="4 4" stroke-width="1.5" d="M.04 41.708a231.598 231.598 0 0 1-.039-4.403l.75-.001L.75 35.1v-2.55H0v-5.1h.75V24.9l.001-2.204h-.75c.003-1.617.011-3.077.039-4.404l.75.016c.034-1.65.099-3.08.218-4.343l-.746-.07c.158-1.678.412-3.083.82-4.316l.713.236c.224-.679.497-1.296.827-1.875a14.25 14.25 0 0 1 1.05-1.585L3.076 5.9A15 15 0 0 1 5.9 3.076l.455.596a14.25 14.25 0 0 1 1.585-1.05c.579-.33 1.196-.603 1.875-.827l-.236-.712C10.812.674 12.217.42 13.895.262l.07.746C15.23.89 16.66.824 18.308.79l-.016-.75C19.62.012 21.08.004 22.695.001l.001.75L24.9.75h2.55V0h5.1v.75h2.55l2.204.001v-.75c1.617.003 3.077.011 4.404.039l-.016.75c1.65.034 3.08.099 4.343.218l.07-.746c1.678.158 3.083.412 4.316.82l-.236.713c.679.224 1.296.497 1.875.827a14.24 14.24 0 0 1 1.585 1.05l.455-.596A14.999 14.999 0 0 1 56.924 5.9l-.596.455c.384.502.735 1.032 1.05 1.585.33.579.602 1.196.827 1.875l.712-.236c.409 1.233.663 2.638.822 4.316l-.747.07c.119 1.264.184 2.694.218 4.343l.75-.016c.028 1.327.036 2.787.039 4.403l-.75.001.001 2.204v2.55H60v5.1h-.75v2.55l-.001 2.204h.75a231.431 231.431 0 0 1-.039 4.404l-.75-.016c-.034 1.65-.099 3.08-.218 4.343l.747.07c-.159 1.678-.413 3.083-.822 4.316l-.712-.236a10.255 10.255 0 0 1-.827 1.875 14.242 14.242 0 0 1-1.05 1.585l.596.455a14.997 14.997 0 0 1-2.824 2.824l-.455-.596c-.502.384-1.032.735-1.585 1.05-.579.33-1.196.602-1.875.827l.236.712c-1.233.409-2.638.663-4.316.822l-.07-.747c-1.264.119-2.694.184-4.343.218l.016.75c-1.327.028-2.787.036-4.403.039l-.001-.75-2.204.001h-2.55V60h-5.1v-.75H24.9l-2.204-.001v.75a231.431 231.431 0 0 1-4.404-.039l.016-.75c-1.65-.034-3.08-.099-4.343-.218l-.07.747c-1.678-.159-3.083-.413-4.316-.822l.236-.712a10.258 10.258 0 0 1-1.875-.827 14.252 14.252 0 0 1-1.585-1.05l-.455.596A14.999 14.999 0 0 1 3.076 54.1l.596-.455a14.24 14.24 0 0 1-1.05-1.585 10.259 10.259 0 0 1-.827-1.875l-.712.236C.674 49.188.42 47.783.262 46.105l.746-.07C.89 44.77.824 43.34.79 41.692l-.75.016Z"/><path fill="#fff" fill-rule="evenodd" d="M35.643 32.145c-.297-.743-.445-1.114-.401-1.275a.42.42 0 0 1 .182-.27c.134-.1.463-.1 1.123-.1.742 0 1.499.046 2.236-.05a6 6 0 0 0 5.166-5.166c.051-.39.051-.855.051-1.784 0-.928 0-1.393-.051-1.783a6 6 0 0 0-5.166-5.165c-.39-.052-.854-.052-1.783-.052h-7.72c-4.934 0-7.401 0-9.244 1.051a8 8 0 0 0-2.985 2.986C16.057 22.28 16.003 24.58 16 29 15.998 31.075 16 33.15 16 35.224A7.778 7.778 0 0 0 23.778 43H28.5c1.394 0 2.09 0 2.67-.116a6 6 0 0 0 4.715-4.714c.115-.58.115-1.301.115-2.744 0-1.31 0-1.964-.114-2.49a4.998 4.998 0 0 0-.243-.792Z" clip-rule="evenodd"/><path fill="#9EA9A9" fill-rule="evenodd" d="M37 18h-7.72c-2.494 0-4.266.002-5.647.126-1.361.122-2.197.354-2.854.728a6.5 6.5 0 0 0-2.425 2.426c-.375.657-.607 1.492-.729 2.853-.11 1.233-.123 2.777-.125 4.867 0 .7 0 1.05.097 1.181.096.13.182.181.343.2.163.02.518-.18 1.229-.581a6.195 6.195 0 0 1 3.053-.8H37c.977 0 1.32-.003 1.587-.038a4.5 4.5 0 0 0 3.874-3.874c.036-.268.039-.611.039-1.588 0-.976-.003-1.319-.038-1.587a4.5 4.5 0 0 0-3.875-3.874C38.32 18.004 37.977 18 37 18Zm-7.364 12.5h-7.414a4.722 4.722 0 0 0-4.722 4.723 6.278 6.278 0 0 0 6.278 6.278H28.5c1.466 0 1.98-.008 2.378-.087a4.5 4.5 0 0 0 3.535-3.536c.08-.397.087-.933.087-2.451 0-1.391-.009-1.843-.08-2.17a3.5 3.5 0 0 0-2.676-2.676c-.328-.072-.762-.08-2.108-.08Z" clip-rule="evenodd"/></g><defs><clipPath id="q"><path fill="#fff" d="M0 0h60v60H0z"/></clipPath></defs></svg>`,GLOBE_ICON:Nt`<svg width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="#fff" fill-rule="evenodd" d="M15.5 8a7.5 7.5 0 1 1-15 0 7.5 7.5 0 0 1 15 0Zm-2.113.75c.301 0 .535.264.47.558a6.01 6.01 0 0 1-2.867 3.896c-.203.116-.42-.103-.334-.32.409-1.018.691-2.274.797-3.657a.512.512 0 0 1 .507-.477h1.427Zm.47-2.058c.065.294-.169.558-.47.558H11.96a.512.512 0 0 1-.507-.477c-.106-1.383-.389-2.638-.797-3.656-.087-.217.13-.437.333-.32a6.01 6.01 0 0 1 2.868 3.895Zm-4.402.558c.286 0 .515-.24.49-.525-.121-1.361-.429-2.534-.83-3.393-.279-.6-.549-.93-.753-1.112a.535.535 0 0 0-.724 0c-.204.182-.474.513-.754 1.112-.4.859-.708 2.032-.828 3.393a.486.486 0 0 0 .49.525h2.909Zm-5.415 0c.267 0 .486-.21.507-.477.106-1.383.389-2.638.797-3.656.087-.217-.13-.437-.333-.32a6.01 6.01 0 0 0-2.868 3.895c-.065.294.169.558.47.558H4.04ZM2.143 9.308c-.065-.294.169-.558.47-.558H4.04c.267 0 .486.21.507.477.106 1.383.389 2.639.797 3.657.087.217-.13.436-.333.32a6.01 6.01 0 0 1-2.868-3.896Zm3.913-.033a.486.486 0 0 1 .49-.525h2.909c.286 0 .515.24.49.525-.121 1.361-.428 2.535-.83 3.394-.279.6-.549.93-.753 1.112a.535.535 0 0 1-.724 0c-.204-.182-.474-.513-.754-1.112-.4-.859-.708-2.033-.828-3.394Z" clip-rule="evenodd"/></svg>`},hS=lt`.wcm-toolbar-placeholder{top:0;bottom:0;left:0;right:0;width:100%;position:absolute;display:block;pointer-events:none;height:100px;border-radius:calc(var(--wcm-background-border-radius) * .9);background-color:var(--wcm-background-color);background-position:center;background-size:cover}.wcm-toolbar{height:38px;display:flex;position:relative;margin:5px 15px 5px 5px;justify-content:space-between;align-items:center}.wcm-toolbar img,.wcm-toolbar svg{height:28px;object-position:left center;object-fit:contain}#wcm-wc-logo path{fill:var(--wcm-accent-fill-color)}button{width:28px;height:28px;border-radius:var(--wcm-icon-button-border-radius);border:0;display:flex;justify-content:center;align-items:center;cursor:pointer;background-color:var(--wcm-color-bg-1);box-shadow:0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-bg-2)}button svg{display:block;object-position:center}button path{fill:var(--wcm-color-fg-1)}.wcm-toolbar div{display:flex}@media(hover:hover){button:hover{background-color:var(--wcm-color-bg-2)}}`;var fS=Object.defineProperty,dS=Object.getOwnPropertyDescriptor,pS=(r,e,t,n)=>{for(var i=n>1?void 0:n?dS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&fS(e,t,i),i};let zh=class extends Ye{render(){return he`<div class="wcm-toolbar-placeholder"></div><div class="wcm-toolbar">${ht.WALLET_CONNECT_LOGO} <button @click="${Wi.close}">${ht.CROSS_ICON}</button></div>`}};zh.styles=[rt.globalCss,hS],zh=pS([ot("wcm-modal-backcard")],zh);const gS=lt`main{padding:20px;padding-top:0;width:100%}`;var mS=Object.defineProperty,vS=Object.getOwnPropertyDescriptor,yS=(r,e,t,n)=>{for(var i=n>1?void 0:n?vS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&mS(e,t,i),i};let Hh=class extends Ye{render(){return he`<main><slot></slot></main>`}};Hh.styles=[rt.globalCss,gS],Hh=yS([ot("wcm-modal-content")],Hh);const wS=lt`footer{padding:10px;display:flex;flex-direction:column;align-items:inherit;justify-content:inherit;border-top:1px solid var(--wcm-color-bg-2)}`;var bS=Object.defineProperty,_S=Object.getOwnPropertyDescriptor,ES=(r,e,t,n)=>{for(var i=n>1?void 0:n?_S(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&bS(e,t,i),i};let Wh=class extends Ye{render(){return he`<footer><slot></slot></footer>`}};Wh.styles=[rt.globalCss,wS],Wh=ES([ot("wcm-modal-footer")],Wh);const xS=lt`header{display:flex;justify-content:center;align-items:center;padding:20px;position:relative}.wcm-border{border-bottom:1px solid var(--wcm-color-bg-2);margin-bottom:20px}header button{padding:15px 20px}header button:active{opacity:.5}@media(hover:hover){header button:hover{opacity:.5}}.wcm-back-btn{position:absolute;left:0}.wcm-action-btn{position:absolute;right:0}path{fill:var(--wcm-accent-color)}`;var IS=Object.defineProperty,DS=Object.getOwnPropertyDescriptor,Qo=(r,e,t,n)=>{for(var i=n>1?void 0:n?DS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&IS(e,t,i),i};let Xi=class extends Ye{constructor(){super(...arguments),this.title="",this.onAction=void 0,this.actionIcon=void 0,this.border=!1}backBtnTemplate(){return he`<button class="wcm-back-btn" @click="${Pt.goBack}">${ht.BACK_ICON}</button>`}actionBtnTemplate(){return he`<button class="wcm-action-btn" @click="${this.onAction}">${this.actionIcon}</button>`}render(){const r={"wcm-border":this.border},e=Pt.state.history.length>1,t=this.title?he`<wcm-text variant="big-bold">${this.title}</wcm-text>`:he`<slot></slot>`;return he`<header class="${qn(r)}">${e?this.backBtnTemplate():null} ${t} ${this.onAction?this.actionBtnTemplate():null}</header>`}};Xi.styles=[rt.globalCss,xS],Qo([Be()],Xi.prototype,"title",2),Qo([Be()],Xi.prototype,"onAction",2),Qo([Be()],Xi.prototype,"actionIcon",2),Qo([Be({type:Boolean})],Xi.prototype,"border",2),Xi=Qo([ot("wcm-modal-header")],Xi);const Pe={MOBILE_BREAKPOINT:600,WCM_RECENT_WALLET_DATA:"WCM_RECENT_WALLET_DATA",EXPLORER_WALLET_URL:"https://explorer.walletconnect.com/?type=wallet",getShadowRootElement(r,e){const t=r.renderRoot.querySelector(e);if(!t)throw new Error(`${e} not found`);return t},getWalletIcon({id:r,image_id:e}){const{walletImages:t}=Kr.state;return t!=null&&t[r]?t[r]:e?Lr.getWalletImageUrl(e):""},getWalletName(r,e=!1){return e&&r.length>8?`${r.substring(0,8)}..`:r},isMobileAnimation(){return window.innerWidth<=Pe.MOBILE_BREAKPOINT},async preloadImage(r){const e=new Promise((t,n)=>{const i=new Image;i.onload=t,i.onerror=n,i.crossOrigin="anonymous",i.src=r});return Promise.race([e,we.wait(3e3)])},getErrorMessage(r){return r instanceof Error?r.message:"Unknown Error"},debounce(r,e=500){let t;return(...n)=>{function i(){r(...n)}t&&clearTimeout(t),t=setTimeout(i,e)}},handleMobileLinking(r){const{walletConnectUri:e}=zt.state,{mobile:t,name:n}=r,i=t?.native,a=t?.universal;Pe.setRecentWallet(r);function c(u){let f="";i?f=we.formatUniversalUrl(i,u,n):a&&(f=we.formatNativeUrl(a,u,n)),we.openHref(f,"_self")}e&&c(e)},handleAndroidLinking(){const{walletConnectUri:r}=zt.state;r&&(we.setWalletConnectAndroidDeepLink(r),we.openHref(r,"_self"))},async handleUriCopy(){const{walletConnectUri:r}=zt.state;if(r)try{await navigator.clipboard.writeText(r),hi.openToast("Link copied","success")}catch{hi.openToast("Failed to copy","error")}},getCustomImageUrls(){const{walletImages:r}=Kr.state,e=Object.values(r??{});return Object.values(e)},truncate(r,e=8){return r.length<=e?r:`${r.substring(0,4)}...${r.substring(r.length-4)}`},setRecentWallet(r){try{localStorage.setItem(Pe.WCM_RECENT_WALLET_DATA,JSON.stringify(r))}catch{console.info("Unable to set recent wallet")}},getRecentWallet(){try{const r=localStorage.getItem(Pe.WCM_RECENT_WALLET_DATA);return r?JSON.parse(r):void 0}catch{console.info("Unable to get recent wallet")}},caseSafeIncludes(r,e){return r.toUpperCase().includes(e.toUpperCase())},openWalletExplorerUrl(){we.openHref(Pe.EXPLORER_WALLET_URL,"_blank")},getCachedRouterWalletPlatforms(){const{desktop:r,mobile:e}=we.getWalletRouterData(),t=!!r?.native,n=!!r?.universal,i=!!e?.native||!!e?.universal;return{isDesktop:t,isMobile:i,isWeb:n}},goToConnectingView(r){Pt.setData({Wallet:r});const e=we.isMobile(),{isDesktop:t,isWeb:n,isMobile:i}=Pe.getCachedRouterWalletPlatforms();e?i?Pt.push("MobileConnecting"):n?Pt.push("WebConnecting"):Pt.push("InstallWallet"):t?Pt.push("DesktopConnecting"):n?Pt.push("WebConnecting"):i?Pt.push("MobileQrcodeConnecting"):Pt.push("InstallWallet")}},SS=lt`.wcm-router{overflow:hidden;will-change:transform}.wcm-content{display:flex;flex-direction:column}`;var CS=Object.defineProperty,OS=Object.getOwnPropertyDescriptor,Kh=(r,e,t,n)=>{for(var i=n>1?void 0:n?OS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&CS(e,t,i),i};let Xo=class extends Ye{constructor(){super(),this.view=Pt.state.view,this.prevView=Pt.state.view,this.unsubscribe=void 0,this.oldHeight="0px",this.resizeObserver=void 0,this.unsubscribe=Pt.subscribe(r=>{this.view!==r.view&&this.onChangeRoute()})}firstUpdated(){this.resizeObserver=new ResizeObserver(([r])=>{const e=`${r.contentRect.height}px`;this.oldHeight!=="0px"&&Qi(this.routerEl,{height:[this.oldHeight,e]},{duration:.2}),this.oldHeight=e}),this.resizeObserver.observe(this.contentEl)}disconnectedCallback(){var r,e;(r=this.unsubscribe)==null||r.call(this),(e=this.resizeObserver)==null||e.disconnect()}get routerEl(){return Pe.getShadowRootElement(this,".wcm-router")}get contentEl(){return Pe.getShadowRootElement(this,".wcm-content")}viewTemplate(){switch(this.view){case"ConnectWallet":return he`<wcm-connect-wallet-view></wcm-connect-wallet-view>`;case"DesktopConnecting":return he`<wcm-desktop-connecting-view></wcm-desktop-connecting-view>`;case"MobileConnecting":return he`<wcm-mobile-connecting-view></wcm-mobile-connecting-view>`;case"WebConnecting":return he`<wcm-web-connecting-view></wcm-web-connecting-view>`;case"MobileQrcodeConnecting":return he`<wcm-mobile-qr-connecting-view></wcm-mobile-qr-connecting-view>`;case"WalletExplorer":return he`<wcm-wallet-explorer-view></wcm-wallet-explorer-view>`;case"Qrcode":return he`<wcm-qrcode-view></wcm-qrcode-view>`;case"InstallWallet":return he`<wcm-install-wallet-view></wcm-install-wallet-view>`;default:return he`<div>Not Found</div>`}}async onChangeRoute(){await Qi(this.routerEl,{opacity:[1,0],scale:[1,1.02]},{duration:.15,delay:.1}).finished,this.view=Pt.state.view,Qi(this.routerEl,{opacity:[0,1],scale:[.99,1]},{duration:.37,delay:.05})}render(){return he`<div class="wcm-router"><div class="wcm-content">${this.viewTemplate()}</div></div>`}};Xo.styles=[rt.globalCss,SS],Kh([Mr()],Xo.prototype,"view",2),Kh([Mr()],Xo.prototype,"prevView",2),Xo=Kh([ot("wcm-modal-router")],Xo);const $S=lt`div{height:36px;width:max-content;display:flex;justify-content:center;align-items:center;padding:9px 15px 11px;position:absolute;top:12px;box-shadow:0 6px 14px -6px rgba(10,16,31,.3),0 10px 32px -4px rgba(10,16,31,.15);z-index:2;left:50%;transform:translateX(-50%);pointer-events:none;backdrop-filter:blur(20px) saturate(1.8);-webkit-backdrop-filter:blur(20px) saturate(1.8);border-radius:var(--wcm-notification-border-radius);border:1px solid var(--wcm-color-overlay);background-color:var(--wcm-color-overlay)}svg{margin-right:5px}@-moz-document url-prefix(){div{background-color:var(--wcm-color-bg-3)}}.wcm-success path{fill:var(--wcm-accent-color)}.wcm-error path{fill:var(--wcm-error-color)}`;var AS=Object.defineProperty,PS=Object.getOwnPropertyDescriptor,_m=(r,e,t,n)=>{for(var i=n>1?void 0:n?PS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&AS(e,t,i),i};let bc=class extends Ye{constructor(){super(),this.open=!1,this.unsubscribe=void 0,this.timeout=void 0,this.unsubscribe=hi.subscribe(r=>{r.open?(this.open=!0,this.timeout=setTimeout(()=>hi.closeToast(),2200)):(this.open=!1,clearTimeout(this.timeout))})}disconnectedCallback(){var r;(r=this.unsubscribe)==null||r.call(this),clearTimeout(this.timeout),hi.closeToast()}render(){const{message:r,variant:e}=hi.state,t={"wcm-success":e==="success","wcm-error":e==="error"};return this.open?he`<div class="${qn(t)}">${e==="success"?ht.CHECKMARK_ICON:null} ${e==="error"?ht.CROSS_ICON:null}<wcm-text variant="small-regular">${r}</wcm-text></div>`:null}};bc.styles=[rt.globalCss,$S],_m([Mr()],bc.prototype,"open",2),bc=_m([ot("wcm-modal-toast")],bc);const TS=.1,Em=2.5,zn=7;function Vh(r,e,t){return r===e?!1:(r-e<0?e-r:r-e)<=t+TS}function RS(r,e){const t=Array.prototype.slice.call(Vo.create(r,{errorCorrectionLevel:e}).modules.data,0),n=Math.sqrt(t.length);return t.reduce((i,a,c)=>(c%n===0?i.push([a]):i[i.length-1].push(a))&&i,[])}const NS={generate(r,e,t){const n="#141414",i="#ffffff",a=[],c=RS(r,"Q"),u=e/c.length,f=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];f.forEach(({x:S,y:P})=>{const U=(c.length-zn)*u*S,j=(c.length-zn)*u*P,A=.45;for(let T=0;T<f.length;T+=1){const C=u*(zn-T*2);a.push(Nt`<rect fill="${T%2===0?n:i}" height="${C}" rx="${C*A}" ry="${C*A}" width="${C}" x="${U+u*T}" y="${j+u*T}">`)}});const h=Math.floor((t+25)/u),m=c.length/2-h/2,w=c.length/2+h/2-1,y=[];c.forEach((S,P)=>{S.forEach((U,j)=>{if(c[P][j]&&!(P<zn&&j<zn||P>c.length-(zn+1)&&j<zn||P<zn&&j>c.length-(zn+1))&&!(P>m&&P<w&&j>m&&j<w)){const A=P*u+u/2,T=j*u+u/2;y.push([A,T])}})});const x={};return y.forEach(([S,P])=>{x[S]?x[S].push(P):x[S]=[P]}),Object.entries(x).map(([S,P])=>{const U=P.filter(j=>P.every(A=>!Vh(j,A,u)));return[Number(S),U]}).forEach(([S,P])=>{P.forEach(U=>{a.push(Nt`<circle cx="${S}" cy="${U}" fill="${n}" r="${u/Em}">`)})}),Object.entries(x).filter(([S,P])=>P.length>1).map(([S,P])=>{const U=P.filter(j=>P.some(A=>Vh(j,A,u)));return[Number(S),U]}).map(([S,P])=>{P.sort((j,A)=>j<A?-1:1);const U=[];for(const j of P){const A=U.find(T=>T.some(C=>Vh(j,C,u)));A?A.push(j):U.push([j])}return[S,U.map(j=>[j[0],j[j.length-1]])]}).forEach(([S,P])=>{P.forEach(([U,j])=>{a.push(Nt`<line x1="${S}" x2="${S}" y1="${U}" y2="${j}" stroke="${n}" stroke-width="${u/(Em/2)}" stroke-linecap="round">`)})}),a}},LS=lt`@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}div{position:relative;user-select:none;display:block;overflow:hidden;aspect-ratio:1/1;animation:fadeIn ease .2s}.wcm-dark{background-color:#fff;border-radius:var(--wcm-container-border-radius);padding:18px;box-shadow:0 2px 5px #000}svg:first-child,wcm-wallet-image{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{width:25%;height:25%;border-radius:var(--wcm-wallet-icon-border-radius)}svg:first-child{transform:translateY(-50%) translateX(-50%) scale(.9)}svg:first-child path:first-child{fill:var(--wcm-accent-color)}svg:first-child path:last-child{stroke:var(--wcm-color-overlay)}`;var MS=Object.defineProperty,US=Object.getOwnPropertyDescriptor,Bs=(r,e,t,n)=>{for(var i=n>1?void 0:n?US(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&MS(e,t,i),i};let Hn=class extends Ye{constructor(){super(...arguments),this.uri="",this.size=0,this.imageId=void 0,this.walletId=void 0,this.imageUrl=void 0}svgTemplate(){const r=ui.state.themeMode==="light"?this.size:this.size-36;return Nt`<svg height="${r}" width="${r}">${NS.generate(this.uri,r,r/4)}</svg>`}render(){const r={"wcm-dark":ui.state.themeMode==="dark"};return he`<div style="${`width: ${this.size}px`}" class="${qn(r)}">${this.walletId||this.imageUrl?he`<wcm-wallet-image walletId="${Dr(this.walletId)}" imageId="${Dr(this.imageId)}" imageUrl="${Dr(this.imageUrl)}"></wcm-wallet-image>`:ht.WALLET_CONNECT_ICON_COLORED} ${this.svgTemplate()}</div>`}};Hn.styles=[rt.globalCss,LS],Bs([Be()],Hn.prototype,"uri",2),Bs([Be({type:Number})],Hn.prototype,"size",2),Bs([Be()],Hn.prototype,"imageId",2),Bs([Be()],Hn.prototype,"walletId",2),Bs([Be()],Hn.prototype,"imageUrl",2),Hn=Bs([ot("wcm-qrcode")],Hn);const jS=lt`:host{position:relative;height:28px;width:80%}input{width:100%;height:100%;line-height:28px!important;border-radius:var(--wcm-input-border-radius);font-style:normal;font-family:-apple-system,system-ui,BlinkMacSystemFont,'Segoe UI',Roboto,Ubuntu,'Helvetica Neue',sans-serif;font-feature-settings:'case' on;font-weight:500;font-size:16px;letter-spacing:-.03em;padding:0 10px 0 34px;transition:.2s all ease;color:var(--wcm-color-fg-1);background-color:var(--wcm-color-bg-3);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay);caret-color:var(--wcm-accent-color)}input::placeholder{color:var(--wcm-color-fg-2)}svg{left:10px;top:4px;pointer-events:none;position:absolute;width:20px;height:20px}input:focus-within{box-shadow:inset 0 0 0 1px var(--wcm-accent-color)}path{fill:var(--wcm-color-fg-2)}`;var FS=Object.defineProperty,BS=Object.getOwnPropertyDescriptor,xm=(r,e,t,n)=>{for(var i=n>1?void 0:n?BS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&FS(e,t,i),i};let _c=class extends Ye{constructor(){super(...arguments),this.onChange=()=>null}render(){return he`<input type="text" @input="${this.onChange}" placeholder="Search wallets"> ${ht.SEARCH_ICON}`}};_c.styles=[rt.globalCss,jS],xm([Be()],_c.prototype,"onChange",2),_c=xm([ot("wcm-search-input")],_c);const kS=lt`@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}100%{stroke-dasharray:90,150;stroke-dashoffset:-124}}svg{animation:rotate 2s linear infinite;display:flex;justify-content:center;align-items:center}svg circle{stroke-linecap:round;animation:dash 1.5s ease infinite;stroke:var(--wcm-accent-color)}`;var qS=Object.defineProperty,zS=Object.getOwnPropertyDescriptor,HS=(r,e,t,n)=>{for(var i=n>1?void 0:n?zS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&qS(e,t,i),i};let Gh=class extends Ye{render(){return he`<svg viewBox="0 0 50 50" width="24" height="24"><circle cx="25" cy="25" r="20" fill="none" stroke-width="4" stroke="#fff"/></svg>`}};Gh.styles=[rt.globalCss,kS],Gh=HS([ot("wcm-spinner")],Gh);const WS=lt`span{font-style:normal;font-family:var(--wcm-font-family);font-feature-settings:var(--wcm-font-feature-settings)}.wcm-xsmall-bold{font-family:var(--wcm-text-xsmall-bold-font-family);font-weight:var(--wcm-text-xsmall-bold-weight);font-size:var(--wcm-text-xsmall-bold-size);line-height:var(--wcm-text-xsmall-bold-line-height);letter-spacing:var(--wcm-text-xsmall-bold-letter-spacing);text-transform:var(--wcm-text-xsmall-bold-text-transform)}.wcm-xsmall-regular{font-family:var(--wcm-text-xsmall-regular-font-family);font-weight:var(--wcm-text-xsmall-regular-weight);font-size:var(--wcm-text-xsmall-regular-size);line-height:var(--wcm-text-xsmall-regular-line-height);letter-spacing:var(--wcm-text-xsmall-regular-letter-spacing);text-transform:var(--wcm-text-xsmall-regular-text-transform)}.wcm-small-thin{font-family:var(--wcm-text-small-thin-font-family);font-weight:var(--wcm-text-small-thin-weight);font-size:var(--wcm-text-small-thin-size);line-height:var(--wcm-text-small-thin-line-height);letter-spacing:var(--wcm-text-small-thin-letter-spacing);text-transform:var(--wcm-text-small-thin-text-transform)}.wcm-small-regular{font-family:var(--wcm-text-small-regular-font-family);font-weight:var(--wcm-text-small-regular-weight);font-size:var(--wcm-text-small-regular-size);line-height:var(--wcm-text-small-regular-line-height);letter-spacing:var(--wcm-text-small-regular-letter-spacing);text-transform:var(--wcm-text-small-regular-text-transform)}.wcm-medium-regular{font-family:var(--wcm-text-medium-regular-font-family);font-weight:var(--wcm-text-medium-regular-weight);font-size:var(--wcm-text-medium-regular-size);line-height:var(--wcm-text-medium-regular-line-height);letter-spacing:var(--wcm-text-medium-regular-letter-spacing);text-transform:var(--wcm-text-medium-regular-text-transform)}.wcm-big-bold{font-family:var(--wcm-text-big-bold-font-family);font-weight:var(--wcm-text-big-bold-weight);font-size:var(--wcm-text-big-bold-size);line-height:var(--wcm-text-big-bold-line-height);letter-spacing:var(--wcm-text-big-bold-letter-spacing);text-transform:var(--wcm-text-big-bold-text-transform)}:host(*){color:var(--wcm-color-fg-1)}.wcm-color-primary{color:var(--wcm-color-fg-1)}.wcm-color-secondary{color:var(--wcm-color-fg-2)}.wcm-color-tertiary{color:var(--wcm-color-fg-3)}.wcm-color-inverse{color:var(--wcm-accent-fill-color)}.wcm-color-accnt{color:var(--wcm-accent-color)}.wcm-color-error{color:var(--wcm-error-color)}`;var KS=Object.defineProperty,VS=Object.getOwnPropertyDescriptor,Yh=(r,e,t,n)=>{for(var i=n>1?void 0:n?VS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&KS(e,t,i),i};let ea=class extends Ye{constructor(){super(...arguments),this.variant="medium-regular",this.color="primary"}render(){const r={"wcm-big-bold":this.variant==="big-bold","wcm-medium-regular":this.variant==="medium-regular","wcm-small-regular":this.variant==="small-regular","wcm-small-thin":this.variant==="small-thin","wcm-xsmall-regular":this.variant==="xsmall-regular","wcm-xsmall-bold":this.variant==="xsmall-bold","wcm-color-primary":this.color==="primary","wcm-color-secondary":this.color==="secondary","wcm-color-tertiary":this.color==="tertiary","wcm-color-inverse":this.color==="inverse","wcm-color-accnt":this.color==="accent","wcm-color-error":this.color==="error"};return he`<span><slot class="${qn(r)}"></slot></span>`}};ea.styles=[rt.globalCss,WS],Yh([Be()],ea.prototype,"variant",2),Yh([Be()],ea.prototype,"color",2),ea=Yh([ot("wcm-text")],ea);const GS=lt`button{width:100%;height:100%;border-radius:var(--wcm-button-hover-highlight-border-radius);display:flex;align-items:flex-start}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}button>div{width:80px;padding:5px 0;display:flex;flex-direction:column;align-items:center}wcm-text{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:center}wcm-wallet-image{height:60px;width:60px;transition:all .2s ease;border-radius:var(--wcm-wallet-icon-border-radius);margin-bottom:5px}.wcm-sublabel{margin-top:2px}`;var YS=Object.defineProperty,JS=Object.getOwnPropertyDescriptor,vi=(r,e,t,n)=>{for(var i=n>1?void 0:n?JS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&YS(e,t,i),i};let Cn=class extends Ye{constructor(){super(...arguments),this.onClick=()=>null,this.name="",this.walletId="",this.label=void 0,this.imageId=void 0,this.installed=!1,this.recent=!1}sublabelTemplate(){return this.recent?he`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">RECENT</wcm-text>`:this.installed?he`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">INSTALLED</wcm-text>`:null}handleClick(){og.click({name:"WALLET_BUTTON",walletId:this.walletId}),this.onClick()}render(){var r;return he`<button @click="${this.handleClick.bind(this)}"><div><wcm-wallet-image walletId="${this.walletId}" imageId="${Dr(this.imageId)}"></wcm-wallet-image><wcm-text variant="xsmall-regular">${(r=this.label)!=null?r:Pe.getWalletName(this.name,!0)}</wcm-text>${this.sublabelTemplate()}</div></button>`}};Cn.styles=[rt.globalCss,GS],vi([Be()],Cn.prototype,"onClick",2),vi([Be()],Cn.prototype,"name",2),vi([Be()],Cn.prototype,"walletId",2),vi([Be()],Cn.prototype,"label",2),vi([Be()],Cn.prototype,"imageId",2),vi([Be({type:Boolean})],Cn.prototype,"installed",2),vi([Be({type:Boolean})],Cn.prototype,"recent",2),Cn=vi([ot("wcm-wallet-button")],Cn);const ZS=lt`:host{display:block}div{overflow:hidden;position:relative;border-radius:inherit;width:100%;height:100%;background-color:var(--wcm-color-overlay)}svg{position:relative;width:100%;height:100%}div::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;border-radius:inherit;border:1px solid var(--wcm-color-overlay)}div img{width:100%;height:100%;object-fit:cover;object-position:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var QS=Object.defineProperty,XS=Object.getOwnPropertyDescriptor,Ec=(r,e,t,n)=>{for(var i=n>1?void 0:n?XS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&QS(e,t,i),i};let ks=class extends Ye{constructor(){super(...arguments),this.walletId="",this.imageId=void 0,this.imageUrl=void 0}render(){var r;const e=(r=this.imageUrl)!=null&&r.length?this.imageUrl:Pe.getWalletIcon({id:this.walletId,image_id:this.imageId});return he`${e.length?he`<div><img crossorigin="anonymous" src="${e}" alt="${this.id}"></div>`:ht.WALLET_PLACEHOLDER}`}};ks.styles=[rt.globalCss,ZS],Ec([Be()],ks.prototype,"walletId",2),Ec([Be()],ks.prototype,"imageId",2),Ec([Be()],ks.prototype,"imageUrl",2),ks=Ec([ot("wcm-wallet-image")],ks);var eC=Object.defineProperty,tC=Object.getOwnPropertyDescriptor,Im=(r,e,t,n)=>{for(var i=n>1?void 0:n?tC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&eC(e,t,i),i};let Jh=class extends Ye{constructor(){super(),this.preload=!0,this.preloadData()}async loadImages(r){try{r!=null&&r.length&&await Promise.all(r.map(async e=>Pe.preloadImage(e)))}catch{console.info("Unsuccessful attempt at preloading some images",r)}}async preloadListings(){if(Kr.state.enableExplorer){await Lr.getRecomendedWallets(),zt.setIsDataLoaded(!0);const{recomendedWallets:r}=Lr.state,e=r.map(t=>Pe.getWalletIcon(t));await this.loadImages(e)}else zt.setIsDataLoaded(!0)}async preloadCustomImages(){const r=Pe.getCustomImageUrls();await this.loadImages(r)}async preloadData(){try{this.preload&&(this.preload=!1,await Promise.all([this.preloadListings(),this.preloadCustomImages()]))}catch(r){console.error(r),hi.openToast("Failed preloading","error")}}};Im([Mr()],Jh.prototype,"preload",2),Jh=Im([ot("wcm-explorer-context")],Jh);var rC=Object.defineProperty,nC=Object.getOwnPropertyDescriptor,iC=(r,e,t,n)=>{for(var i=n>1?void 0:n?nC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&rC(e,t,i),i};let Dm=class extends Ye{constructor(){super(),this.unsubscribeTheme=void 0,rt.setTheme(),this.unsubscribeTheme=ui.subscribe(rt.setTheme)}disconnectedCallback(){var r;(r=this.unsubscribeTheme)==null||r.call(this)}};Dm=iC([ot("wcm-theme-context")],Dm);const sC=lt`@keyframes scroll{0%{transform:translate3d(0,0,0)}100%{transform:translate3d(calc(-70px * 9),0,0)}}.wcm-slider{position:relative;overflow-x:hidden;padding:10px 0;margin:0 -20px;width:calc(100% + 40px)}.wcm-track{display:flex;width:calc(70px * 18);animation:scroll 20s linear infinite;opacity:.7}.wcm-track svg{margin:0 5px}wcm-wallet-image{width:60px;height:60px;margin:0 5px;border-radius:var(--wcm-wallet-icon-border-radius)}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-title{display:flex;align-items:center;margin-bottom:10px}.wcm-title svg{margin-right:6px}.wcm-title path{fill:var(--wcm-accent-color)}wcm-modal-footer .wcm-title{padding:0 10px}wcm-button-big{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%);filter:drop-shadow(0 0 17px var(--wcm-color-bg-1))}wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-info-footer wcm-text{text-align:center;margin-bottom:15px}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var oC=Object.defineProperty,aC=Object.getOwnPropertyDescriptor,cC=(r,e,t,n)=>{for(var i=n>1?void 0:n?aC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&oC(e,t,i),i};let Zh=class extends Ye{onGoToQrcode(){Pt.push("Qrcode")}render(){const{recomendedWallets:r}=Lr.state,e=[...r,...r],t=we.RECOMMENDED_WALLET_AMOUNT*2;return he`<wcm-modal-header title="Connect your wallet" .onAction="${this.onGoToQrcode}" .actionIcon="${ht.QRCODE_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-title">${ht.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">WalletConnect</wcm-text></div><div class="wcm-slider"><div class="wcm-track">${[...Array(t)].map((n,i)=>{const a=e[i%e.length];return a?he`<wcm-wallet-image walletId="${a.id}" imageId="${a.image_id}"></wcm-wallet-image>`:ht.WALLET_PLACEHOLDER})}</div><wcm-button-big @click="${Pe.handleAndroidLinking}"><wcm-text variant="medium-regular" color="inverse">Select Wallet</wcm-text></wcm-button-big></div></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">Choose WalletConnect to see supported apps on your device</wcm-text></wcm-info-footer>`}};Zh.styles=[rt.globalCss,sC],Zh=cC([ot("wcm-android-wallet-selection")],Zh);const lC=lt`@keyframes loading{to{stroke-dashoffset:0}}@keyframes shake{10%,90%{transform:translate3d(-1px,0,0)}20%,80%{transform:translate3d(1px,0,0)}30%,50%,70%{transform:translate3d(-2px,0,0)}40%,60%{transform:translate3d(2px,0,0)}}:host{display:flex;flex-direction:column;align-items:center}div{position:relative;width:110px;height:110px;display:flex;justify-content:center;align-items:center;margin:40px 0 20px 0;transform:translate3d(0,0,0)}svg{position:absolute;width:110px;height:110px;fill:none;stroke:transparent;stroke-linecap:round;stroke-width:2px;top:0;left:0}use{stroke:var(--wcm-accent-color);animation:loading 1s linear infinite}wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:90px;height:90px}wcm-text{margin-bottom:40px}.wcm-error svg{stroke:var(--wcm-error-color)}.wcm-error use{display:none}.wcm-error{animation:shake .4s cubic-bezier(.36,.07,.19,.97) both}.wcm-stale svg,.wcm-stale use{display:none}`;var uC=Object.defineProperty,hC=Object.getOwnPropertyDescriptor,qs=(r,e,t,n)=>{for(var i=n>1?void 0:n?hC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&uC(e,t,i),i};let yi=class extends Ye{constructor(){super(...arguments),this.walletId=void 0,this.imageId=void 0,this.isError=!1,this.isStale=!1,this.label=""}svgLoaderTemplate(){var r,e;const t=(e=(r=ui.state.themeVariables)==null?void 0:r["--wcm-wallet-icon-large-border-radius"])!=null?e:rt.getPreset("--wcm-wallet-icon-large-border-radius");let n=0;t.includes("%")?n=88/100*parseInt(t,10):n=parseInt(t,10),n*=1.17;const i=317-n*1.57,a=425-n*1.8;return he`<svg viewBox="0 0 110 110" width="110" height="110"><rect id="wcm-loader" x="2" y="2" width="106" height="106" rx="${n}"/><use xlink:href="#wcm-loader" stroke-dasharray="106 ${i}" stroke-dashoffset="${a}"></use></svg>`}render(){const r={"wcm-error":this.isError,"wcm-stale":this.isStale};return he`<div class="${qn(r)}">${this.svgLoaderTemplate()}<wcm-wallet-image walletId="${Dr(this.walletId)}" imageId="${Dr(this.imageId)}"></wcm-wallet-image></div><wcm-text variant="medium-regular" color="${this.isError?"error":"primary"}">${this.isError?"Connection declined":this.label}</wcm-text>`}};yi.styles=[rt.globalCss,lC],qs([Be()],yi.prototype,"walletId",2),qs([Be()],yi.prototype,"imageId",2),qs([Be({type:Boolean})],yi.prototype,"isError",2),qs([Be({type:Boolean})],yi.prototype,"isStale",2),qs([Be()],yi.prototype,"label",2),yi=qs([ot("wcm-connector-waiting")],yi);const zs={manualWallets(){var r,e;const{mobileWallets:t,desktopWallets:n}=Kr.state,i=(r=zs.recentWallet())==null?void 0:r.id,a=we.isMobile()?t:n,c=a?.filter(u=>i!==u.id);return(e=we.isMobile()?c?.map(({id:u,name:f,links:h})=>({id:u,name:f,mobile:h,links:h})):c?.map(({id:u,name:f,links:h})=>({id:u,name:f,desktop:h,links:h})))!=null?e:[]},recentWallet(){return Pe.getRecentWallet()},recomendedWallets(r=!1){var e;const t=r||(e=zs.recentWallet())==null?void 0:e.id,{recomendedWallets:n}=Lr.state;return n.filter(i=>t!==i.id)}},wi={onConnecting(r){Pe.goToConnectingView(r)},manualWalletsTemplate(){return zs.manualWallets().map(r=>he`<wcm-wallet-button walletId="${r.id}" name="${r.name}" .onClick="${()=>this.onConnecting(r)}"></wcm-wallet-button>`)},recomendedWalletsTemplate(r=!1){return zs.recomendedWallets(r).map(e=>he`<wcm-wallet-button name="${e.name}" walletId="${e.id}" imageId="${e.image_id}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`)},recentWalletTemplate(){const r=zs.recentWallet();if(r)return he`<wcm-wallet-button name="${r.name}" walletId="${r.id}" imageId="${Dr(r.image_id)}" .recent="${!0}" .onClick="${()=>this.onConnecting(r)}"></wcm-wallet-button>`}},fC=lt`.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-desktop-title,.wcm-mobile-title{display:flex;align-items:center}.wcm-mobile-title{justify-content:space-between;margin-bottom:20px;margin-top:-10px}.wcm-desktop-title{margin-bottom:10px;padding:0 10px}.wcm-subtitle{display:flex;align-items:center}.wcm-subtitle:last-child path{fill:var(--wcm-color-fg-3)}.wcm-desktop-title svg,.wcm-mobile-title svg{margin-right:6px}.wcm-desktop-title path,.wcm-mobile-title path{fill:var(--wcm-accent-color)}`;var dC=Object.defineProperty,pC=Object.getOwnPropertyDescriptor,gC=(r,e,t,n)=>{for(var i=n>1?void 0:n?pC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&dC(e,t,i),i};let Qh=class extends Ye{render(){const{explorerExcludedWalletIds:r,enableExplorer:e}=Kr.state,t=r!=="ALL"&&e,n=wi.manualWalletsTemplate(),i=wi.recomendedWalletsTemplate();let a=[wi.recentWalletTemplate(),...n,...i];a=a.filter(Boolean);const c=a.length>4||t;let u=[];c?u=a.slice(0,3):u=a;const f=!!u.length;return he`<wcm-modal-header .border="${!0}" title="Connect your wallet" .onAction="${Pe.handleUriCopy}" .actionIcon="${ht.COPY_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-mobile-title"><div class="wcm-subtitle">${ht.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">Mobile</wcm-text></div><div class="wcm-subtitle">${ht.SCAN_ICON}<wcm-text variant="small-regular" color="secondary">Scan with your wallet</wcm-text></div></div><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>${f?he`<wcm-modal-footer><div class="wcm-desktop-title">${ht.DESKTOP_ICON}<wcm-text variant="small-regular" color="accent">Desktop</wcm-text></div><div class="wcm-grid">${u} ${c?he`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-footer>`:null}`}};Qh.styles=[rt.globalCss,fC],Qh=gC([ot("wcm-desktop-wallet-selection")],Qh);const mC=lt`div{background-color:var(--wcm-color-bg-2);padding:10px 20px 15px 20px;border-top:1px solid var(--wcm-color-bg-3);text-align:center}a{color:var(--wcm-accent-color);text-decoration:none;transition:opacity .2s ease-in-out;display:inline}a:active{opacity:.8}@media(hover:hover){a:hover{opacity:.8}}`;var vC=Object.defineProperty,yC=Object.getOwnPropertyDescriptor,wC=(r,e,t,n)=>{for(var i=n>1?void 0:n?yC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&vC(e,t,i),i};let Xh=class extends Ye{render(){const{termsOfServiceUrl:r,privacyPolicyUrl:e}=Kr.state;return r??e?he`<div><wcm-text variant="small-regular" color="secondary">By connecting your wallet to this app, you agree to the app's ${r?he`<a href="${r}" target="_blank" rel="noopener noreferrer">Terms of Service</a>`:null} ${r&&e?"and":null} ${e?he`<a href="${e}" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`:null}</wcm-text></div>`:null}};Xh.styles=[rt.globalCss,mC],Xh=wC([ot("wcm-legal-notice")],Xh);const bC=lt`div{display:grid;grid-template-columns:repeat(4,80px);margin:0 -10px;justify-content:space-between;row-gap:10px}`;var _C=Object.defineProperty,EC=Object.getOwnPropertyDescriptor,xC=(r,e,t,n)=>{for(var i=n>1?void 0:n?EC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&_C(e,t,i),i};let ef=class extends Ye{onQrcode(){Pt.push("Qrcode")}render(){const{explorerExcludedWalletIds:r,enableExplorer:e}=Kr.state,t=r!=="ALL"&&e,n=wi.manualWalletsTemplate(),i=wi.recomendedWalletsTemplate();let a=[wi.recentWalletTemplate(),...n,...i];a=a.filter(Boolean);const c=a.length>8||t;let u=[];c?u=a.slice(0,7):u=a;const f=!!u.length;return he`<wcm-modal-header title="Connect your wallet" .onAction="${this.onQrcode}" .actionIcon="${ht.QRCODE_ICON}"></wcm-modal-header>${f?he`<wcm-modal-content><div>${u} ${c?he`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-content>`:null}`}};ef.styles=[rt.globalCss,bC],ef=xC([ot("wcm-mobile-wallet-selection")],ef);const IC=lt`:host{all:initial}.wcm-overlay{top:0;bottom:0;left:0;right:0;position:fixed;z-index:var(--wcm-z-index);overflow:hidden;display:flex;justify-content:center;align-items:center;opacity:0;pointer-events:none;background-color:var(--wcm-overlay-background-color);backdrop-filter:var(--wcm-overlay-backdrop-filter)}@media(max-height:720px) and (orientation:landscape){.wcm-overlay{overflow:scroll;align-items:flex-start;padding:20px 0}}.wcm-active{pointer-events:auto}.wcm-container{position:relative;max-width:360px;width:100%;outline:0;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) var(--wcm-container-border-radius) var(--wcm-container-border-radius);border:1px solid var(--wcm-color-overlay);overflow:hidden}.wcm-card{width:100%;position:relative;border-radius:var(--wcm-container-border-radius);overflow:hidden;box-shadow:0 6px 14px -6px rgba(10,16,31,.12),0 10px 32px -4px rgba(10,16,31,.1),0 0 0 1px var(--wcm-color-overlay);background-color:var(--wcm-color-bg-1);color:var(--wcm-color-fg-1)}@media(max-width:600px){.wcm-container{max-width:440px;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) 0 0}.wcm-card{border-radius:var(--wcm-container-border-radius) var(--wcm-container-border-radius) 0 0}.wcm-overlay{align-items:flex-end}}@media(max-width:440px){.wcm-container{border:0}}`;var DC=Object.defineProperty,SC=Object.getOwnPropertyDescriptor,tf=(r,e,t,n)=>{for(var i=n>1?void 0:n?SC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&DC(e,t,i),i};let Hs=class extends Ye{constructor(){super(),this.open=!1,this.active=!1,this.unsubscribeModal=void 0,this.abortController=void 0,this.unsubscribeModal=Wi.subscribe(r=>{r.open?this.onOpenModalEvent():this.onCloseModalEvent()})}disconnectedCallback(){var r;(r=this.unsubscribeModal)==null||r.call(this)}get overlayEl(){return Pe.getShadowRootElement(this,".wcm-overlay")}get containerEl(){return Pe.getShadowRootElement(this,".wcm-container")}toggleBodyScroll(r){document.querySelector("body")&&(r?document.getElementById("wcm-styles")?.remove():document.head.insertAdjacentHTML("beforeend",'<style id="wcm-styles">html,body{touch-action:none;overflow:hidden;overscroll-behavior:contain;}</style>'))}onCloseModal(r){r.target===r.currentTarget&&Wi.close()}onOpenModalEvent(){this.toggleBodyScroll(!1),this.addKeyboardEvents(),this.open=!0,setTimeout(async()=>{const r=Pe.isMobileAnimation()?{y:["50vh","0vh"]}:{scale:[.98,1]},e=.1,t=.2;await Promise.all([Qi(this.overlayEl,{opacity:[0,1]},{delay:e,duration:t}).finished,Qi(this.containerEl,r,{delay:e,duration:t}).finished]),this.active=!0},0)}async onCloseModalEvent(){this.toggleBodyScroll(!0),this.removeKeyboardEvents();const r=Pe.isMobileAnimation()?{y:["0vh","50vh"]}:{scale:[1,.98]},e=.2;await Promise.all([Qi(this.overlayEl,{opacity:[1,0]},{duration:e}).finished,Qi(this.containerEl,r,{duration:e}).finished]),this.containerEl.removeAttribute("style"),this.active=!1,this.open=!1}addKeyboardEvents(){this.abortController=new AbortController,window.addEventListener("keydown",r=>{var e;r.key==="Escape"?Wi.close():r.key==="Tab"&&((e=r.target)!=null&&e.tagName.includes("wcm-")||this.containerEl.focus())},this.abortController),this.containerEl.focus()}removeKeyboardEvents(){var r;(r=this.abortController)==null||r.abort(),this.abortController=void 0}render(){const r={"wcm-overlay":!0,"wcm-active":this.active};return he`<wcm-explorer-context></wcm-explorer-context><wcm-theme-context></wcm-theme-context><div id="wcm-modal" class="${qn(r)}" @click="${this.onCloseModal}" role="alertdialog" aria-modal="true"><div class="wcm-container" tabindex="0">${this.open?he`<wcm-modal-backcard></wcm-modal-backcard><div class="wcm-card"><wcm-modal-router></wcm-modal-router><wcm-modal-toast></wcm-modal-toast></div>`:null}</div></div>`}};Hs.styles=[rt.globalCss,IC],tf([Mr()],Hs.prototype,"open",2),tf([Mr()],Hs.prototype,"active",2),Hs=tf([ot("wcm-modal")],Hs);const CC=lt`div{display:flex;margin-top:15px}slot{display:inline-block;margin:0 5px}wcm-button{margin:0 5px}`;var OC=Object.defineProperty,$C=Object.getOwnPropertyDescriptor,ta=(r,e,t,n)=>{for(var i=n>1?void 0:n?$C(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&OC(e,t,i),i};let es=class extends Ye{constructor(){super(...arguments),this.isMobile=!1,this.isDesktop=!1,this.isWeb=!1,this.isRetry=!1}onMobile(){we.isMobile()?Pt.replace("MobileConnecting"):Pt.replace("MobileQrcodeConnecting")}onDesktop(){Pt.replace("DesktopConnecting")}onWeb(){Pt.replace("WebConnecting")}render(){return he`<div>${this.isRetry?he`<slot></slot>`:null} ${this.isMobile?he`<wcm-button .onClick="${this.onMobile}" .iconLeft="${ht.MOBILE_ICON}" variant="outline">Mobile</wcm-button>`:null} ${this.isDesktop?he`<wcm-button .onClick="${this.onDesktop}" .iconLeft="${ht.DESKTOP_ICON}" variant="outline">Desktop</wcm-button>`:null} ${this.isWeb?he`<wcm-button .onClick="${this.onWeb}" .iconLeft="${ht.GLOBE_ICON}" variant="outline">Web</wcm-button>`:null}</div>`}};es.styles=[rt.globalCss,CC],ta([Be({type:Boolean})],es.prototype,"isMobile",2),ta([Be({type:Boolean})],es.prototype,"isDesktop",2),ta([Be({type:Boolean})],es.prototype,"isWeb",2),ta([Be({type:Boolean})],es.prototype,"isRetry",2),es=ta([ot("wcm-platform-selection")],es);const AC=lt`button{display:flex;flex-direction:column;padding:5px 10px;border-radius:var(--wcm-button-hover-highlight-border-radius);height:100%;justify-content:flex-start}.wcm-icons{width:60px;height:60px;display:flex;flex-wrap:wrap;padding:7px;border-radius:var(--wcm-wallet-icon-border-radius);justify-content:space-between;align-items:center;margin-bottom:5px;background-color:var(--wcm-color-bg-2);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}.wcm-icons img{width:21px;height:21px;object-fit:cover;object-position:center;border-radius:calc(var(--wcm-wallet-icon-border-radius)/ 2);border:1px solid var(--wcm-color-overlay)}.wcm-icons svg{width:21px;height:21px}.wcm-icons img:nth-child(1),.wcm-icons img:nth-child(2),.wcm-icons svg:nth-child(1),.wcm-icons svg:nth-child(2){margin-bottom:4px}wcm-text{width:100%;text-align:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var PC=Object.defineProperty,TC=Object.getOwnPropertyDescriptor,RC=(r,e,t,n)=>{for(var i=n>1?void 0:n?TC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&PC(e,t,i),i};let rf=class extends Ye{onClick(){Pt.push("WalletExplorer")}render(){const{recomendedWallets:r}=Lr.state,e=zs.manualWallets(),t=[...r,...e].reverse().slice(0,4);return he`<button @click="${this.onClick}"><div class="wcm-icons">${t.map(n=>{const i=Pe.getWalletIcon(n);if(i)return he`<img crossorigin="anonymous" src="${i}">`;const a=Pe.getWalletIcon({id:n.id});return a?he`<img crossorigin="anonymous" src="${a}">`:ht.WALLET_PLACEHOLDER})} ${[...Array(4-t.length)].map(()=>ht.WALLET_PLACEHOLDER)}</div><wcm-text variant="xsmall-regular">View All</wcm-text></button>`}};rf.styles=[rt.globalCss,AC],rf=RC([ot("wcm-view-all-wallets-button")],rf);const NC=lt`.wcm-qr-container{width:100%;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1}`;var LC=Object.defineProperty,MC=Object.getOwnPropertyDescriptor,xc=(r,e,t,n)=>{for(var i=n>1?void 0:n?MC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&LC(e,t,i),i};let Ws=class extends Ye{constructor(){super(),this.walletId="",this.imageId="",this.uri="",setTimeout(()=>{const{walletConnectUri:r}=zt.state;this.uri=r},0)}get overlayEl(){return Pe.getShadowRootElement(this,".wcm-qr-container")}render(){return he`<div class="wcm-qr-container">${this.uri?he`<wcm-qrcode size="${this.overlayEl.offsetWidth}" uri="${this.uri}" walletId="${Dr(this.walletId)}" imageId="${Dr(this.imageId)}"></wcm-qrcode>`:he`<wcm-spinner></wcm-spinner>`}</div>`}};Ws.styles=[rt.globalCss,NC],xc([Be()],Ws.prototype,"walletId",2),xc([Be()],Ws.prototype,"imageId",2),xc([Mr()],Ws.prototype,"uri",2),Ws=xc([ot("wcm-walletconnect-qr")],Ws);var UC=Object.defineProperty,jC=Object.getOwnPropertyDescriptor,FC=(r,e,t,n)=>{for(var i=n>1?void 0:n?jC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&UC(e,t,i),i};let nf=class extends Ye{viewTemplate(){return we.isAndroid()?he`<wcm-android-wallet-selection></wcm-android-wallet-selection>`:we.isMobile()?he`<wcm-mobile-wallet-selection></wcm-mobile-wallet-selection>`:he`<wcm-desktop-wallet-selection></wcm-desktop-wallet-selection>`}render(){return he`${this.viewTemplate()}<wcm-legal-notice></wcm-legal-notice>`}};nf.styles=[rt.globalCss],nf=FC([ot("wcm-connect-wallet-view")],nf);const BC=lt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var kC=Object.defineProperty,qC=Object.getOwnPropertyDescriptor,Sm=(r,e,t,n)=>{for(var i=n>1?void 0:n?qC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&kC(e,t,i),i};let Ic=class extends Ye{constructor(){super(),this.isError=!1,this.openDesktopApp()}onFormatAndRedirect(r){const{desktop:e,name:t}=we.getWalletRouterData(),n=e?.native;if(n){const i=we.formatNativeUrl(n,r,t);we.openHref(i,"_self")}}openDesktopApp(){const{walletConnectUri:r}=zt.state,e=we.getWalletRouterData();Pe.setRecentWallet(e),r&&this.onFormatAndRedirect(r)}render(){const{name:r,id:e,image_id:t}=we.getWalletRouterData(),{isMobile:n,isWeb:i}=Pe.getCachedRouterWalletPlatforms();return he`<wcm-modal-header title="${r}" .onAction="${Pe.handleUriCopy}" .actionIcon="${ht.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Dr(t)}" label="${`Continue in ${r}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Connection can continue loading if ${r} is not installed on your device`}</wcm-text><wcm-platform-selection .isMobile="${n}" .isWeb="${i}" .isRetry="${!0}"><wcm-button .onClick="${this.openDesktopApp.bind(this)}" .iconRight="${ht.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Ic.styles=[rt.globalCss,BC],Sm([Mr()],Ic.prototype,"isError",2),Ic=Sm([ot("wcm-desktop-connecting-view")],Ic);const zC=lt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}wcm-button{margin-top:15px}`;var HC=Object.defineProperty,WC=Object.getOwnPropertyDescriptor,KC=(r,e,t,n)=>{for(var i=n>1?void 0:n?WC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&HC(e,t,i),i};let sf=class extends Ye{onInstall(r){r&&we.openHref(r,"_blank")}render(){const{name:r,id:e,image_id:t,homepage:n}=we.getWalletRouterData();return he`<wcm-modal-header title="${r}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Dr(t)}" label="Not Detected" .isStale="${!0}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Download ${r} to continue. If multiple browser extensions are installed, disable non ${r} ones and try again`}</wcm-text><wcm-button .onClick="${()=>this.onInstall(n)}" .iconLeft="${ht.ARROW_DOWN_ICON}">Download</wcm-button></wcm-info-footer>`}};sf.styles=[rt.globalCss,zC],sf=KC([ot("wcm-install-wallet-view")],sf);const VC=lt`wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:96px;height:96px;margin-bottom:20px}wcm-info-footer{display:flex;width:100%}.wcm-app-store{justify-content:space-between}.wcm-app-store wcm-wallet-image{margin-right:10px;margin-bottom:0;width:28px;height:28px;border-radius:var(--wcm-wallet-icon-small-border-radius)}.wcm-app-store div{display:flex;align-items:center}.wcm-app-store wcm-button{margin-right:-10px}.wcm-note{flex-direction:column;align-items:center;padding:5px 0}.wcm-note wcm-text{text-align:center}wcm-platform-selection{margin-top:-15px}.wcm-note wcm-text{margin-top:15px}.wcm-note wcm-text span{color:var(--wcm-accent-color)}`;var GC=Object.defineProperty,YC=Object.getOwnPropertyDescriptor,Cm=(r,e,t,n)=>{for(var i=n>1?void 0:n?YC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&GC(e,t,i),i};let Dc=class extends Ye{constructor(){super(),this.isError=!1,this.openMobileApp()}onFormatAndRedirect(r,e=!1){const{mobile:t,name:n}=we.getWalletRouterData(),i=t?.native,a=t?.universal;if(i&&!e){const c=we.formatNativeUrl(i,r,n);we.openHref(c,"_self")}else if(a){const c=we.formatUniversalUrl(a,r,n);we.openHref(c,"_self")}}openMobileApp(r=!1){const{walletConnectUri:e}=zt.state,t=we.getWalletRouterData();Pe.setRecentWallet(t),e&&this.onFormatAndRedirect(e,r)}onGoToAppStore(r){r&&we.openHref(r,"_blank")}render(){const{name:r,id:e,image_id:t,app:n,mobile:i}=we.getWalletRouterData(),{isWeb:a}=Pe.getCachedRouterWalletPlatforms(),c=n?.ios,u=i?.universal;return he`<wcm-modal-header title="${r}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Dr(t)}" label="Tap 'Open' to continue…" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer class="wcm-note"><wcm-platform-selection .isWeb="${a}" .isRetry="${!0}"><wcm-button .onClick="${()=>this.openMobileApp(!1)}" .iconRight="${ht.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection>${u?he`<wcm-text color="secondary" variant="small-thin">Still doesn't work? <span tabindex="0" @click="${()=>this.openMobileApp(!0)}">Try this alternate link</span></wcm-text>`:null}</wcm-info-footer><wcm-info-footer class="wcm-app-store"><div><wcm-wallet-image walletId="${e}" imageId="${Dr(t)}"></wcm-wallet-image><wcm-text>${`Get ${r}`}</wcm-text></div><wcm-button .iconRight="${ht.ARROW_RIGHT_ICON}" .onClick="${()=>this.onGoToAppStore(c)}" variant="ghost">App Store</wcm-button></wcm-info-footer>`}};Dc.styles=[rt.globalCss,VC],Cm([Mr()],Dc.prototype,"isError",2),Dc=Cm([ot("wcm-mobile-connecting-view")],Dc);const JC=lt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var ZC=Object.defineProperty,QC=Object.getOwnPropertyDescriptor,XC=(r,e,t,n)=>{for(var i=n>1?void 0:n?QC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&ZC(e,t,i),i};let of=class extends Ye{render(){const{name:r,id:e,image_id:t}=we.getWalletRouterData(),{isDesktop:n,isWeb:i}=Pe.getCachedRouterWalletPlatforms();return he`<wcm-modal-header title="${r}" .onAction="${Pe.handleUriCopy}" .actionIcon="${ht.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr walletId="${e}" imageId="${Dr(t)}"></wcm-walletconnect-qr></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Scan this QR Code with your phone's camera or inside ${r} app`}</wcm-text><wcm-platform-selection .isDesktop="${n}" .isWeb="${i}"></wcm-platform-selection></wcm-info-footer>`}};of.styles=[rt.globalCss,JC],of=XC([ot("wcm-mobile-qr-connecting-view")],of);var eO=Object.defineProperty,tO=Object.getOwnPropertyDescriptor,rO=(r,e,t,n)=>{for(var i=n>1?void 0:n?tO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&eO(e,t,i),i};let af=class extends Ye{render(){return he`<wcm-modal-header title="Scan the code" .onAction="${Pe.handleUriCopy}" .actionIcon="${ht.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>`}};af.styles=[rt.globalCss],af=rO([ot("wcm-qrcode-view")],af);const nO=lt`wcm-modal-content{height:clamp(200px,60vh,600px);display:block;overflow:scroll;scrollbar-width:none;position:relative;margin-top:1px}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between;margin:-15px -10px;padding-top:20px}wcm-modal-content::after,wcm-modal-content::before{content:'';position:fixed;pointer-events:none;z-index:1;width:100%;height:20px;opacity:1}wcm-modal-content::before{box-shadow:0 -1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(var(--wcm-color-bg-1),rgba(255,255,255,0))}wcm-modal-content::after{box-shadow:0 1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(rgba(255,255,255,0),var(--wcm-color-bg-1));top:calc(100% - 20px)}wcm-modal-content::-webkit-scrollbar{display:none}.wcm-placeholder-block{display:flex;justify-content:center;align-items:center;height:100px;overflow:hidden}.wcm-empty,.wcm-loading{display:flex}.wcm-loading .wcm-placeholder-block{height:100%}.wcm-end-reached .wcm-placeholder-block{height:0;opacity:0}.wcm-empty .wcm-placeholder-block{opacity:1;height:100%}wcm-wallet-button{margin:calc((100% - 60px)/ 3) 0}`;var iO=Object.defineProperty,sO=Object.getOwnPropertyDescriptor,ra=(r,e,t,n)=>{for(var i=n>1?void 0:n?sO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&iO(e,t,i),i};const cf=40;let ts=class extends Ye{constructor(){super(...arguments),this.loading=!Lr.state.wallets.listings.length,this.firstFetch=!Lr.state.wallets.listings.length,this.search="",this.endReached=!1,this.intersectionObserver=void 0,this.searchDebounce=Pe.debounce(r=>{r.length>=1?(this.firstFetch=!0,this.endReached=!1,this.search=r,Lr.resetSearch(),this.fetchWallets()):this.search&&(this.search="",this.endReached=this.isLastPage(),Lr.resetSearch())})}firstUpdated(){this.createPaginationObserver()}disconnectedCallback(){var r;(r=this.intersectionObserver)==null||r.disconnect()}get placeholderEl(){return Pe.getShadowRootElement(this,".wcm-placeholder-block")}createPaginationObserver(){this.intersectionObserver=new IntersectionObserver(([r])=>{r.isIntersecting&&!(this.search&&this.firstFetch)&&this.fetchWallets()}),this.intersectionObserver.observe(this.placeholderEl)}isLastPage(){const{wallets:r,search:e}=Lr.state,{listings:t,total:n}=this.search?e:r;return n<=cf||t.length>=n}async fetchWallets(){var r;const{wallets:e,search:t}=Lr.state,{listings:n,total:i,page:a}=this.search?t:e;if(!this.endReached&&(this.firstFetch||i>cf&&n.length<i))try{this.loading=!0;const c=(r=zt.state.chains)==null?void 0:r.join(","),{listings:u}=await Lr.getWallets({page:this.firstFetch?1:a+1,entries:cf,search:this.search,version:2,chains:c}),f=u.map(h=>Pe.getWalletIcon(h));await Promise.all([...f.map(async h=>Pe.preloadImage(h)),we.wait(300)]),this.endReached=this.isLastPage()}catch(c){console.error(c),hi.openToast(Pe.getErrorMessage(c),"error")}finally{this.loading=!1,this.firstFetch=!1}}onConnect(r){we.isAndroid()?Pe.handleMobileLinking(r):Pe.goToConnectingView(r)}onSearchChange(r){const{value:e}=r.target;this.searchDebounce(e)}render(){const{wallets:r,search:e}=Lr.state,{listings:t}=this.search?e:r,n=this.loading&&!t.length,i=this.search.length>=3;let a=wi.manualWalletsTemplate(),c=wi.recomendedWalletsTemplate(!0);i&&(a=a.filter(({values:h})=>Pe.caseSafeIncludes(h[0],this.search)),c=c.filter(({values:h})=>Pe.caseSafeIncludes(h[0],this.search)));const u=!this.loading&&!t.length&&!c.length,f={"wcm-loading":n,"wcm-end-reached":this.endReached||!this.loading,"wcm-empty":u};return he`<wcm-modal-header><wcm-search-input .onChange="${this.onSearchChange.bind(this)}"></wcm-search-input></wcm-modal-header><wcm-modal-content class="${qn(f)}"><div class="wcm-grid">${n?null:a} ${n?null:c} ${n?null:t.map(h=>he`${h?he`<wcm-wallet-button imageId="${h.image_id}" name="${h.name}" walletId="${h.id}" .onClick="${()=>this.onConnect(h)}"></wcm-wallet-button>`:null}`)}</div><div class="wcm-placeholder-block">${u?he`<wcm-text variant="big-bold" color="secondary">No results found</wcm-text>`:null} ${!u&&this.loading?he`<wcm-spinner></wcm-spinner>`:null}</div></wcm-modal-content>`}};ts.styles=[rt.globalCss,nO],ra([Mr()],ts.prototype,"loading",2),ra([Mr()],ts.prototype,"firstFetch",2),ra([Mr()],ts.prototype,"search",2),ra([Mr()],ts.prototype,"endReached",2),ts=ra([ot("wcm-wallet-explorer-view")],ts);const oO=lt`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var aO=Object.defineProperty,cO=Object.getOwnPropertyDescriptor,Om=(r,e,t,n)=>{for(var i=n>1?void 0:n?cO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&aO(e,t,i),i};let Sc=class extends Ye{constructor(){super(),this.isError=!1,this.openWebWallet()}onFormatAndRedirect(r){const{desktop:e,name:t}=we.getWalletRouterData(),n=e?.universal;if(n){const i=we.formatUniversalUrl(n,r,t);we.openHref(i,"_blank")}}openWebWallet(){const{walletConnectUri:r}=zt.state,e=we.getWalletRouterData();Pe.setRecentWallet(e),r&&this.onFormatAndRedirect(r)}render(){const{name:r,id:e,image_id:t}=we.getWalletRouterData(),{isMobile:n,isDesktop:i}=Pe.getCachedRouterWalletPlatforms(),a=we.isMobile();return he`<wcm-modal-header title="${r}" .onAction="${Pe.handleUriCopy}" .actionIcon="${ht.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Dr(t)}" label="${`Continue in ${r}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`${r} web app has opened in a new tab. Go there, accept the connection, and come back`}</wcm-text><wcm-platform-selection .isMobile="${n}" .isDesktop="${a?!1:i}" .isRetry="${!0}"><wcm-button .onClick="${this.openWebWallet.bind(this)}" .iconRight="${ht.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Sc.styles=[rt.globalCss,oO],Om([Mr()],Sc.prototype,"isError",2),Sc=Om([ot("wcm-web-connecting-view")],Sc);var lO=Object.freeze({__proto__:null,get WcmModal(){return Hs},get WcmQrCode(){return Hn}});fn.EthereumProvider=Rx,fn.OPTIONAL_EVENTS=eg,fn.OPTIONAL_METHODS=X1,fn.REQUIRED_EVENTS=Qa,fn.REQUIRED_METHODS=Za,fn.default=ec,Object.defineProperty(fn,"__esModule",{value:!0})});
|
|
137
|
+
`);const c=yS(e,t,i),u=Cc.getSymbolSize(e),f=new aS(u);return dS(f,e),pS(f),gS(f,e),Hh(f,t,0),e>=7&&mS(f,e),vS(f,c),isNaN(n)&&(n=kh.getBestMask(f,Hh.bind(null,f,t))),kh.applyMask(n,f),Hh(f,t,n),{modules:f,version:e,errorCorrectionLevel:t,maskPattern:n,segments:i}}dm.create=function(e,t){if(typeof e>"u"||e==="")throw new Error("No input text");let n=Bh.M,i,a;return typeof t<"u"&&(n=Bh.from(t.errorCorrectionLevel,Bh.M),i=$c.from(t.version),a=kh.from(t.maskPattern),t.toSJISFunc&&Cc.setToSJISFunction(t.toSJISFunc)),bS(e,i,n,a)};var Cm={},Wh={};(function(r){function e(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let n=t.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+t);(n.length===3||n.length===4)&&(n=Array.prototype.concat.apply([],n.map(function(a){return[a,a]}))),n.length===6&&n.push("F","F");const i=parseInt(n.join(""),16);return{r:i>>24&255,g:i>>16&255,b:i>>8&255,a:i&255,hex:"#"+n.slice(0,6).join("")}}r.getOptions=function(n){n||(n={}),n.color||(n.color={});const i=typeof n.margin>"u"||n.margin===null||n.margin<0?4:n.margin,a=n.width&&n.width>=21?n.width:void 0,c=n.scale||4;return{width:a,scale:a?4:c,margin:i,color:{dark:e(n.color.dark||"#000000ff"),light:e(n.color.light||"#ffffffff")},type:n.type,rendererOpts:n.rendererOpts||{}}},r.getScale=function(n,i){return i.width&&i.width>=n+i.margin*2?i.width/(n+i.margin*2):i.scale},r.getImageWidth=function(n,i){const a=r.getScale(n,i);return Math.floor((n+i.margin*2)*a)},r.qrToImageData=function(n,i,a){const c=i.modules.size,u=i.modules.data,f=r.getScale(c,a),h=Math.floor((c+a.margin*2)*f),m=a.margin*f,w=[a.color.light,a.color.dark];for(let y=0;y<h;y++)for(let b=0;b<h;b++){let I=(y*h+b)*4,A=a.color.light;if(y>=m&&b>=m&&y<h-m&&b<h-m){const U=Math.floor((y-m)/f),j=Math.floor((b-m)/f);A=w[u[U*c+j]?1:0]}n[I++]=A.r,n[I++]=A.g,n[I++]=A.b,n[I]=A.a}}})(Wh),function(r){const e=Wh;function t(i,a,c){i.clearRect(0,0,a.width,a.height),a.style||(a.style={}),a.height=c,a.width=c,a.style.height=c+"px",a.style.width=c+"px"}function n(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}r.render=function(a,c,u){let f=u,h=c;typeof f>"u"&&(!c||!c.getContext)&&(f=c,c=void 0),c||(h=n()),f=e.getOptions(f);const m=e.getImageWidth(a.modules.size,f),w=h.getContext("2d"),y=w.createImageData(m,m);return e.qrToImageData(y.data,a,f),t(w,h,m),w.putImageData(y,0,0),h},r.renderToDataURL=function(a,c,u){let f=u;typeof f>"u"&&(!c||!c.getContext)&&(f=c,c=void 0),f||(f={});const h=r.render(a,c,f),m=f.type||"image/png",w=f.rendererOpts||{};return h.toDataURL(m,w.quality)}}(Cm);var $m={};const _S=Wh;function Am(r,e){const t=r.a/255,n=e+'="'+r.hex+'"';return t<1?n+" "+e+'-opacity="'+t.toFixed(2).slice(1)+'"':n}function Kh(r,e,t){let n=r+e;return typeof t<"u"&&(n+=" "+t),n}function ES(r,e,t){let n="",i=0,a=!1,c=0;for(let u=0;u<r.length;u++){const f=Math.floor(u%e),h=Math.floor(u/e);!f&&!a&&(a=!0),r[u]?(c++,u>0&&f>0&&r[u-1]||(n+=a?Kh("M",f+t,.5+h+t):Kh("m",i,0),i=0,a=!1),f+1<e&&r[u+1]||(n+=Kh("h",c),c=0)):i++}return n}$m.render=function(e,t,n){const i=_S.getOptions(t),a=e.modules.size,c=e.modules.data,u=a+i.margin*2,f=i.color.light.a?"<path "+Am(i.color.light,"fill")+' d="M0 0h'+u+"v"+u+'H0z"/>':"",h="<path "+Am(i.color.dark,"stroke")+' d="'+ES(c,a,i.margin)+'"/>',m='viewBox="0 0 '+u+" "+u+'"',y='<svg xmlns="http://www.w3.org/2000/svg" '+(i.width?'width="'+i.width+'" height="'+i.width+'" ':"")+m+' shape-rendering="crispEdges">'+f+h+`</svg>
|
|
138
|
+
`;return typeof n=="function"&&n(null,y),y};const xS=UD,Vh=dm,Pm=Cm,IS=$m;function Gh(r,e,t,n,i){const a=[].slice.call(arguments,1),c=a.length,u=typeof a[c-1]=="function";if(!u&&!xS())throw new Error("Callback required as last argument");if(u){if(c<2)throw new Error("Too few arguments provided");c===2?(i=t,t=e,e=n=void 0):c===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=t,t=e,e=void 0))}else{if(c<1)throw new Error("Too few arguments provided");return c===1?(t=e,e=n=void 0):c===2&&!e.getContext&&(n=t,t=e,e=void 0),new Promise(function(f,h){try{const m=Vh.create(t,n);f(r(m,e,n))}catch(m){h(m)}})}try{const f=Vh.create(t,n);i(null,r(f,e,n))}catch(f){i(f)}}ra.create=Vh.create,ra.toCanvas=Gh.bind(null,Pm.render),ra.toDataURL=Gh.bind(null,Pm.renderToDataURL),ra.toString=Gh.bind(null,function(r,e,t){return IS.render(r,t)});var DS=Object.defineProperty,Tm=Object.getOwnPropertySymbols,SS=Object.prototype.hasOwnProperty,OS=Object.prototype.propertyIsEnumerable,Rm=(r,e,t)=>e in r?DS(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Yh=(r,e)=>{for(var t in e||(e={}))SS.call(e,t)&&Rm(r,t,e[t]);if(Tm)for(var t of Tm(e))OS.call(e,t)&&Rm(r,t,e[t]);return r};function CS(){var r;const e=(r=pi.state.themeMode)!=null?r:"dark",t={light:{foreground:{1:"rgb(20,20,20)",2:"rgb(121,134,134)",3:"rgb(158,169,169)"},background:{1:"rgb(255,255,255)",2:"rgb(241,243,243)",3:"rgb(228,231,231)"},overlay:"rgba(0,0,0,0.1)"},dark:{foreground:{1:"rgb(228,231,231)",2:"rgb(148,158,158)",3:"rgb(110,119,119)"},background:{1:"rgb(20,20,20)",2:"rgb(39,42,42)",3:"rgb(59,64,64)"},overlay:"rgba(255,255,255,0.1)"}}[e];return{"--wcm-color-fg-1":t.foreground[1],"--wcm-color-fg-2":t.foreground[2],"--wcm-color-fg-3":t.foreground[3],"--wcm-color-bg-1":t.background[1],"--wcm-color-bg-2":t.background[2],"--wcm-color-bg-3":t.background[3],"--wcm-color-overlay":t.overlay}}function Nm(){return{"--wcm-accent-color":"#3396FF","--wcm-accent-fill-color":"#FFFFFF","--wcm-z-index":"89","--wcm-background-color":"#3396FF","--wcm-background-border-radius":"8px","--wcm-container-border-radius":"30px","--wcm-wallet-icon-border-radius":"15px","--wcm-wallet-icon-large-border-radius":"30px","--wcm-wallet-icon-small-border-radius":"7px","--wcm-input-border-radius":"28px","--wcm-button-border-radius":"10px","--wcm-notification-border-radius":"36px","--wcm-secondary-button-border-radius":"28px","--wcm-icon-button-border-radius":"50%","--wcm-button-hover-highlight-border-radius":"10px","--wcm-text-big-bold-size":"20px","--wcm-text-big-bold-weight":"600","--wcm-text-big-bold-line-height":"24px","--wcm-text-big-bold-letter-spacing":"-0.03em","--wcm-text-big-bold-text-transform":"none","--wcm-text-xsmall-bold-size":"10px","--wcm-text-xsmall-bold-weight":"700","--wcm-text-xsmall-bold-line-height":"12px","--wcm-text-xsmall-bold-letter-spacing":"0.02em","--wcm-text-xsmall-bold-text-transform":"uppercase","--wcm-text-xsmall-regular-size":"12px","--wcm-text-xsmall-regular-weight":"600","--wcm-text-xsmall-regular-line-height":"14px","--wcm-text-xsmall-regular-letter-spacing":"-0.03em","--wcm-text-xsmall-regular-text-transform":"none","--wcm-text-small-thin-size":"14px","--wcm-text-small-thin-weight":"500","--wcm-text-small-thin-line-height":"16px","--wcm-text-small-thin-letter-spacing":"-0.03em","--wcm-text-small-thin-text-transform":"none","--wcm-text-small-regular-size":"14px","--wcm-text-small-regular-weight":"600","--wcm-text-small-regular-line-height":"16px","--wcm-text-small-regular-letter-spacing":"-0.03em","--wcm-text-small-regular-text-transform":"none","--wcm-text-medium-regular-size":"16px","--wcm-text-medium-regular-weight":"600","--wcm-text-medium-regular-line-height":"20px","--wcm-text-medium-regular-letter-spacing":"-0.03em","--wcm-text-medium-regular-text-transform":"none","--wcm-font-family":"-apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', sans-serif","--wcm-font-feature-settings":"'tnum' on, 'lnum' on, 'case' on","--wcm-success-color":"rgb(38,181,98)","--wcm-error-color":"rgb(242, 90, 103)","--wcm-overlay-background-color":"rgba(0, 0, 0, 0.3)","--wcm-overlay-backdrop-filter":"none"}}const tt={getPreset(r){return Nm()[r]},setTheme(){const r=document.querySelector(":root"),{themeVariables:e}=pi.state;if(r){const t=Yh(Yh(Yh({},CS()),Nm()),e);Object.entries(t).forEach(([n,i])=>r.style.setProperty(n,i))}},globalCss:ct`*,::after,::before{margin:0;padding:0;box-sizing:border-box;font-style:normal;text-rendering:optimizeSpeed;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-tap-highlight-color:transparent;backface-visibility:hidden}button{cursor:pointer;display:flex;justify-content:center;align-items:center;position:relative;border:none;background-color:transparent;transition:all .2s ease}@media (hover:hover) and (pointer:fine){button:active{transition:all .1s ease;transform:scale(.93)}}button::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;transition:background-color,.2s ease}button:disabled{cursor:not-allowed}button svg,button wcm-text{position:relative;z-index:1}input{border:none;outline:0;appearance:none}img{display:block}::selection{color:var(--wcm-accent-fill-color);background:var(--wcm-accent-color)}`},$S=ct`button{border-radius:var(--wcm-secondary-button-border-radius);height:28px;padding:0 10px;background-color:var(--wcm-accent-color)}button path{fill:var(--wcm-accent-fill-color)}button::after{border-radius:inherit;border:1px solid var(--wcm-color-overlay)}button:disabled::after{background-color:transparent}.wcm-icon-left svg{margin-right:5px}.wcm-icon-right svg{margin-left:5px}button:active::after{background-color:var(--wcm-color-overlay)}.wcm-ghost,.wcm-ghost:active::after,.wcm-outline{background-color:transparent}.wcm-ghost:active{opacity:.5}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}.wcm-ghost:hover::after{background-color:transparent}.wcm-ghost:hover{opacity:.5}}button:disabled{background-color:var(--wcm-color-bg-3);pointer-events:none}.wcm-ghost::after{border-color:transparent}.wcm-ghost path{fill:var(--wcm-color-fg-2)}.wcm-outline path{fill:var(--wcm-accent-color)}.wcm-outline:disabled{background-color:transparent;opacity:.5}`;var AS=Object.defineProperty,PS=Object.getOwnPropertyDescriptor,Ws=(r,e,t,n)=>{for(var i=n>1?void 0:n?PS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&AS(e,t,i),i};let bi=class extends Ye{constructor(){super(...arguments),this.disabled=!1,this.iconLeft=void 0,this.iconRight=void 0,this.onClick=()=>null,this.variant="default"}render(){const r={"wcm-icon-left":this.iconLeft!==void 0,"wcm-icon-right":this.iconRight!==void 0,"wcm-ghost":this.variant==="ghost","wcm-outline":this.variant==="outline"};let e="inverse";return this.variant==="ghost"&&(e="secondary"),this.variant==="outline"&&(e="accent"),he`<button class="${Wn(r)}" ?disabled="${this.disabled}" @click="${this.onClick}">${this.iconLeft}<wcm-text variant="small-regular" color="${e}"><slot></slot></wcm-text>${this.iconRight}</button>`}};bi.styles=[tt.globalCss,$S],Ws([Be({type:Boolean})],bi.prototype,"disabled",2),Ws([Be()],bi.prototype,"iconLeft",2),Ws([Be()],bi.prototype,"iconRight",2),Ws([Be()],bi.prototype,"onClick",2),Ws([Be()],bi.prototype,"variant",2),bi=Ws([st("wcm-button")],bi);const TS=ct`:host{display:inline-block}button{padding:0 15px 1px;height:40px;border-radius:var(--wcm-button-border-radius);color:var(--wcm-accent-fill-color);background-color:var(--wcm-accent-color)}button::after{content:'';top:0;bottom:0;left:0;right:0;position:absolute;background-color:transparent;border-radius:inherit;transition:background-color .2s ease;border:1px solid var(--wcm-color-overlay)}button:active::after{background-color:var(--wcm-color-overlay)}button:disabled{padding-bottom:0;background-color:var(--wcm-color-bg-3);color:var(--wcm-color-fg-3)}.wcm-secondary{color:var(--wcm-accent-color);background-color:transparent}.wcm-secondary::after{display:none}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}}`;var RS=Object.defineProperty,NS=Object.getOwnPropertyDescriptor,Zh=(r,e,t,n)=>{for(var i=n>1?void 0:n?NS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&RS(e,t,i),i};let oa=class extends Ye{constructor(){super(...arguments),this.disabled=!1,this.variant="primary"}render(){const r={"wcm-secondary":this.variant==="secondary"};return he`<button ?disabled="${this.disabled}" class="${Wn(r)}"><slot></slot></button>`}};oa.styles=[tt.globalCss,TS],Zh([Be({type:Boolean})],oa.prototype,"disabled",2),Zh([Be()],oa.prototype,"variant",2),oa=Zh([st("wcm-button-big")],oa);const LS=ct`:host{background-color:var(--wcm-color-bg-2);border-top:1px solid var(--wcm-color-bg-3)}div{padding:10px 20px;display:inherit;flex-direction:inherit;align-items:inherit;width:inherit;justify-content:inherit}`;var MS=Object.defineProperty,US=Object.getOwnPropertyDescriptor,jS=(r,e,t,n)=>{for(var i=n>1?void 0:n?US(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&MS(e,t,i),i};let Jh=class extends Ye{render(){return he`<div><slot></slot></div>`}};Jh.styles=[tt.globalCss,LS],Jh=jS([st("wcm-info-footer")],Jh);const ut={CROSS_ICON:Nt`<svg width="12" height="12" viewBox="0 0 12 12"><path d="M9.94 11A.75.75 0 1 0 11 9.94L7.414 6.353a.5.5 0 0 1 0-.708L11 2.061A.75.75 0 1 0 9.94 1L6.353 4.586a.5.5 0 0 1-.708 0L2.061 1A.75.75 0 0 0 1 2.06l3.586 3.586a.5.5 0 0 1 0 .708L1 9.939A.75.75 0 1 0 2.06 11l3.586-3.586a.5.5 0 0 1 .708 0L9.939 11Z" fill="#fff"/></svg>`,WALLET_CONNECT_LOGO:Nt`<svg width="178" height="29" viewBox="0 0 178 29" id="wcm-wc-logo"><path d="M10.683 7.926c5.284-5.17 13.85-5.17 19.134 0l.636.623a.652.652 0 0 1 0 .936l-2.176 2.129a.343.343 0 0 1-.478 0l-.875-.857c-3.686-3.607-9.662-3.607-13.348 0l-.937.918a.343.343 0 0 1-.479 0l-2.175-2.13a.652.652 0 0 1 0-.936l.698-.683Zm23.633 4.403 1.935 1.895a.652.652 0 0 1 0 .936l-8.73 8.543a.687.687 0 0 1-.956 0L20.37 17.64a.172.172 0 0 0-.239 0l-6.195 6.063a.687.687 0 0 1-.957 0l-8.73-8.543a.652.652 0 0 1 0-.936l1.936-1.895a.687.687 0 0 1 .957 0l6.196 6.064a.172.172 0 0 0 .239 0l6.195-6.064a.687.687 0 0 1 .957 0l6.196 6.064a.172.172 0 0 0 .24 0l6.195-6.064a.687.687 0 0 1 .956 0ZM48.093 20.948l2.338-9.355c.139-.515.258-1.07.416-1.942.12.872.258 1.427.357 1.942l2.022 9.355h4.181l3.528-13.874h-3.21l-1.943 8.523a24.825 24.825 0 0 0-.456 2.457c-.158-.931-.317-1.625-.495-2.438l-1.883-8.542h-4.201l-2.042 8.542a41.204 41.204 0 0 0-.475 2.438 41.208 41.208 0 0 0-.476-2.438l-1.903-8.542h-3.349l3.508 13.874h4.083ZM63.33 21.304c1.585 0 2.596-.654 3.11-1.605-.059.297-.078.595-.078.892v.357h2.655V15.22c0-2.735-1.248-4.32-4.3-4.32-2.636 0-4.36 1.466-4.52 3.487h2.914c.1-.891.734-1.426 1.705-1.426.911 0 1.407.515 1.407 1.11 0 .435-.258.693-1.03.792l-1.388.159c-2.061.257-3.825 1.01-3.825 3.19 0 1.982 1.645 3.092 3.35 3.092Zm.891-2.041c-.773 0-1.348-.436-1.348-1.19 0-.733.655-1.09 1.645-1.268l.674-.119c.575-.118.892-.218 1.09-.396v.912c0 1.228-.892 2.06-2.06 2.06ZM70.398 7.074v13.874h2.874V7.074h-2.874ZM74.934 7.074v13.874h2.874V7.074h-2.874ZM84.08 21.304c2.735 0 4.5-1.546 4.697-3.567h-2.893c-.139.892-.892 1.387-1.804 1.387-1.228 0-2.12-.99-2.14-2.358h6.897v-.555c0-3.21-1.764-5.312-4.816-5.312-2.933 0-4.994 2.062-4.994 5.173 0 3.37 2.12 5.232 5.053 5.232Zm-2.16-6.421c.119-1.11.932-1.922 2.081-1.922 1.11 0 1.883.772 1.903 1.922H81.92ZM94.92 21.146c.633 0 1.248-.1 1.525-.179v-2.18c-.218.04-.475.06-.693.06-1.05 0-1.427-.595-1.427-1.566v-3.805h2.338v-2.24h-2.338V7.788H91.47v3.448H89.37v2.24h2.1v4.201c0 2.3 1.15 3.469 3.45 3.469ZM104.62 21.304c3.924 0 6.302-2.299 6.599-5.608h-3.111c-.238 1.803-1.506 3.032-3.369 3.032-2.2 0-3.746-1.784-3.746-4.796 0-2.953 1.605-4.638 3.805-4.638 1.883 0 2.953 1.15 3.171 2.834h3.191c-.317-3.448-2.854-5.41-6.342-5.41-3.984 0-7.036 2.695-7.036 7.214 0 4.677 2.676 7.372 6.838 7.372ZM117.449 21.304c2.993 0 5.114-1.882 5.114-5.172 0-3.23-2.121-5.233-5.114-5.233-2.972 0-5.093 2.002-5.093 5.233 0 3.29 2.101 5.172 5.093 5.172Zm0-2.22c-1.327 0-2.18-1.09-2.18-2.952 0-1.903.892-2.973 2.18-2.973 1.308 0 2.2 1.07 2.2 2.973 0 1.862-.872 2.953-2.2 2.953ZM126.569 20.948v-5.689c0-1.208.753-2.1 1.823-2.1 1.011 0 1.606.773 1.606 2.06v5.729h2.873v-6.144c0-2.339-1.229-3.905-3.428-3.905-1.526 0-2.458.734-2.953 1.606a5.31 5.31 0 0 0 .079-.892v-.377h-2.874v9.712h2.874ZM137.464 20.948v-5.689c0-1.208.753-2.1 1.823-2.1 1.011 0 1.606.773 1.606 2.06v5.729h2.873v-6.144c0-2.339-1.228-3.905-3.428-3.905-1.526 0-2.458.734-2.953 1.606a5.31 5.31 0 0 0 .079-.892v-.377h-2.874v9.712h2.874ZM149.949 21.304c2.735 0 4.499-1.546 4.697-3.567h-2.893c-.139.892-.892 1.387-1.804 1.387-1.228 0-2.12-.99-2.14-2.358h6.897v-.555c0-3.21-1.764-5.312-4.816-5.312-2.933 0-4.994 2.062-4.994 5.173 0 3.37 2.12 5.232 5.053 5.232Zm-2.16-6.421c.119-1.11.932-1.922 2.081-1.922 1.11 0 1.883.772 1.903 1.922h-3.984ZM160.876 21.304c3.013 0 4.658-1.645 4.975-4.201h-2.874c-.099 1.07-.713 1.982-2.001 1.982-1.309 0-2.2-1.21-2.2-2.993 0-1.942 1.03-2.933 2.259-2.933 1.209 0 1.803.872 1.883 1.882h2.873c-.218-2.358-1.823-4.142-4.776-4.142-2.874 0-5.153 1.903-5.153 5.193 0 3.25 1.923 5.212 5.014 5.212ZM172.067 21.146c.634 0 1.248-.1 1.526-.179v-2.18c-.218.04-.476.06-.694.06-1.05 0-1.427-.595-1.427-1.566v-3.805h2.339v-2.24h-2.339V7.788h-2.854v3.448h-2.1v2.24h2.1v4.201c0 2.3 1.15 3.469 3.449 3.469Z" fill="#fff"/></svg>`,WALLET_CONNECT_ICON:Nt`<svg width="28" height="20" viewBox="0 0 28 20"><g clip-path="url(#a)"><path d="M7.386 6.482c3.653-3.576 9.575-3.576 13.228 0l.44.43a.451.451 0 0 1 0 .648L19.55 9.033a.237.237 0 0 1-.33 0l-.606-.592c-2.548-2.496-6.68-2.496-9.228 0l-.648.634a.237.237 0 0 1-.33 0L6.902 7.602a.451.451 0 0 1 0-.647l.483-.473Zm16.338 3.046 1.339 1.31a.451.451 0 0 1 0 .648l-6.035 5.909a.475.475 0 0 1-.662 0L14.083 13.2a.119.119 0 0 0-.166 0l-4.283 4.194a.475.475 0 0 1-.662 0l-6.035-5.91a.451.451 0 0 1 0-.647l1.338-1.31a.475.475 0 0 1 .662 0l4.283 4.194c.046.044.12.044.166 0l4.283-4.194a.475.475 0 0 1 .662 0l4.283 4.194c.046.044.12.044.166 0l4.283-4.194a.475.475 0 0 1 .662 0Z" fill="#000000"/></g><defs><clipPath id="a"><path fill="#ffffff" d="M0 0h28v20H0z"/></clipPath></defs></svg>`,WALLET_CONNECT_ICON_COLORED:Nt`<svg width="96" height="96" fill="none"><path fill="#fff" d="M25.322 33.597c12.525-12.263 32.83-12.263 45.355 0l1.507 1.476a1.547 1.547 0 0 1 0 2.22l-5.156 5.048a.814.814 0 0 1-1.134 0l-2.074-2.03c-8.737-8.555-22.903-8.555-31.64 0l-2.222 2.175a.814.814 0 0 1-1.134 0l-5.156-5.049a1.547 1.547 0 0 1 0-2.22l1.654-1.62Zm56.019 10.44 4.589 4.494a1.547 1.547 0 0 1 0 2.22l-20.693 20.26a1.628 1.628 0 0 1-2.267 0L48.283 56.632a.407.407 0 0 0-.567 0L33.03 71.012a1.628 1.628 0 0 1-2.268 0L10.07 50.75a1.547 1.547 0 0 1 0-2.22l4.59-4.494a1.628 1.628 0 0 1 2.267 0l14.687 14.38c.156.153.41.153.567 0l14.685-14.38a1.628 1.628 0 0 1 2.268 0l14.687 14.38c.156.153.41.153.567 0l14.686-14.38a1.628 1.628 0 0 1 2.268 0Z"/><path stroke="#000" d="M25.672 33.954c12.33-12.072 32.325-12.072 44.655 0l1.508 1.476a1.047 1.047 0 0 1 0 1.506l-5.157 5.048a.314.314 0 0 1-.434 0l-2.074-2.03c-8.932-8.746-23.409-8.746-32.34 0l-2.222 2.174a.314.314 0 0 1-.434 0l-5.157-5.048a1.047 1.047 0 0 1 0-1.506l1.655-1.62Zm55.319 10.44 4.59 4.494a1.047 1.047 0 0 1 0 1.506l-20.694 20.26a1.128 1.128 0 0 1-1.568 0l-14.686-14.38a.907.907 0 0 0-1.267 0L32.68 70.655a1.128 1.128 0 0 1-1.568 0L10.42 50.394a1.047 1.047 0 0 1 0-1.506l4.59-4.493a1.128 1.128 0 0 1 1.567 0l14.687 14.379a.907.907 0 0 0 1.266 0l-.35-.357.35.357 14.686-14.38a1.128 1.128 0 0 1 1.568 0l14.687 14.38a.907.907 0 0 0 1.267 0l14.686-14.38a1.128 1.128 0 0 1 1.568 0Z"/></svg>`,BACK_ICON:Nt`<svg width="10" height="18" viewBox="0 0 10 18"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.735.179a.75.75 0 0 1 .087 1.057L2.92 8.192a1.25 1.25 0 0 0 0 1.617l5.902 6.956a.75.75 0 1 1-1.144.97L1.776 10.78a2.75 2.75 0 0 1 0-3.559L7.678.265A.75.75 0 0 1 8.735.18Z" fill="#fff"/></svg>`,COPY_ICON:Nt`<svg width="24" height="24" fill="none"><path fill="#fff" fill-rule="evenodd" d="M7.01 7.01c.03-1.545.138-2.5.535-3.28A5 5 0 0 1 9.73 1.545C10.8 1 12.2 1 15 1c2.8 0 4.2 0 5.27.545a5 5 0 0 1 2.185 2.185C23 4.8 23 6.2 23 9c0 2.8 0 4.2-.545 5.27a5 5 0 0 1-2.185 2.185c-.78.397-1.735.505-3.28.534l-.001.01c-.03 1.54-.138 2.493-.534 3.27a5 5 0 0 1-2.185 2.186C13.2 23 11.8 23 9 23c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C1 19.2 1 17.8 1 15c0-2.8 0-4.2.545-5.27A5 5 0 0 1 3.73 7.545C4.508 7.149 5.46 7.04 7 7.01h.01ZM15 15.5c-1.425 0-2.403-.001-3.162-.063-.74-.06-1.139-.172-1.427-.319a3.5 3.5 0 0 1-1.53-1.529c-.146-.288-.257-.686-.318-1.427C8.501 11.403 8.5 10.425 8.5 9c0-1.425.001-2.403.063-3.162.06-.74.172-1.139.318-1.427a3.5 3.5 0 0 1 1.53-1.53c.288-.146.686-.257 1.427-.318.759-.062 1.737-.063 3.162-.063 1.425 0 2.403.001 3.162.063.74.06 1.139.172 1.427.318a3.5 3.5 0 0 1 1.53 1.53c.146.288.257.686.318 1.427.062.759.063 1.737.063 3.162 0 1.425-.001 2.403-.063 3.162-.06.74-.172 1.139-.319 1.427a3.5 3.5 0 0 1-1.529 1.53c-.288.146-.686.257-1.427.318-.759.062-1.737.063-3.162.063ZM7 8.511c-.444.009-.825.025-1.162.052-.74.06-1.139.172-1.427.318a3.5 3.5 0 0 0-1.53 1.53c-.146.288-.257.686-.318 1.427-.062.759-.063 1.737-.063 3.162 0 1.425.001 2.403.063 3.162.06.74.172 1.139.318 1.427a3.5 3.5 0 0 0 1.53 1.53c.288.146.686.257 1.427.318.759.062 1.737.063 3.162.063 1.425 0 2.403-.001 3.162-.063.74-.06 1.139-.172 1.427-.319a3.5 3.5 0 0 0 1.53-1.53c.146-.287.257-.685.318-1.426.027-.337.043-.718.052-1.162H15c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C7 13.2 7 11.8 7 9v-.489Z" clip-rule="evenodd"/></svg>`,RETRY_ICON:Nt`<svg width="15" height="16" viewBox="0 0 15 16"><path d="M6.464 2.03A.75.75 0 0 0 5.403.97L2.08 4.293a1 1 0 0 0 0 1.414L5.403 9.03a.75.75 0 0 0 1.06-1.06L4.672 6.177a.25.25 0 0 1 .177-.427h2.085a4 4 0 1 1-3.93 4.746c-.077-.407-.405-.746-.82-.746-.414 0-.755.338-.7.748a5.501 5.501 0 1 0 5.45-6.248H4.848a.25.25 0 0 1-.177-.427L6.464 2.03Z" fill="#fff"/></svg>`,DESKTOP_ICON:Nt`<svg width="16" height="16" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M0 5.98c0-1.85 0-2.775.394-3.466a3 3 0 0 1 1.12-1.12C2.204 1 3.13 1 4.98 1h6.04c1.85 0 2.775 0 3.466.394a3 3 0 0 1 1.12 1.12C16 3.204 16 4.13 16 5.98v1.04c0 1.85 0 2.775-.394 3.466a3 3 0 0 1-1.12 1.12C13.796 12 12.87 12 11.02 12H4.98c-1.85 0-2.775 0-3.466-.394a3 3 0 0 1-1.12-1.12C0 9.796 0 8.87 0 7.02V5.98ZM4.98 2.5h6.04c.953 0 1.568.001 2.034.043.446.04.608.108.69.154a1.5 1.5 0 0 1 .559.56c.046.08.114.243.154.69.042.465.043 1.08.043 2.033v1.04c0 .952-.001 1.568-.043 2.034-.04.446-.108.608-.154.69a1.499 1.499 0 0 1-.56.559c-.08.046-.243.114-.69.154-.466.042-1.08.043-2.033.043H4.98c-.952 0-1.568-.001-2.034-.043-.446-.04-.608-.108-.69-.154a1.5 1.5 0 0 1-.559-.56c-.046-.08-.114-.243-.154-.69-.042-.465-.043-1.08-.043-2.033V5.98c0-.952.001-1.568.043-2.034.04-.446.108-.608.154-.69a1.5 1.5 0 0 1 .56-.559c.08-.046.243-.114.69-.154.465-.042 1.08-.043 2.033-.043Z" fill="#fff"/><path d="M4 14.25a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Z" fill="#fff"/></svg>`,MOBILE_ICON:Nt`<svg width="16" height="16" viewBox="0 0 16 16"><path d="M6.75 5a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M3 4.98c0-1.85 0-2.775.394-3.466a3 3 0 0 1 1.12-1.12C5.204 0 6.136 0 8 0s2.795 0 3.486.394a3 3 0 0 1 1.12 1.12C13 2.204 13 3.13 13 4.98v6.04c0 1.85 0 2.775-.394 3.466a3 3 0 0 1-1.12 1.12C10.796 16 9.864 16 8 16s-2.795 0-3.486-.394a3 3 0 0 1-1.12-1.12C3 13.796 3 12.87 3 11.02V4.98Zm8.5 0v6.04c0 .953-.001 1.568-.043 2.034-.04.446-.108.608-.154.69a1.499 1.499 0 0 1-.56.559c-.08.045-.242.113-.693.154-.47.042-1.091.043-2.05.043-.959 0-1.58-.001-2.05-.043-.45-.04-.613-.109-.693-.154a1.5 1.5 0 0 1-.56-.56c-.046-.08-.114-.243-.154-.69-.042-.466-.043-1.08-.043-2.033V4.98c0-.952.001-1.568.043-2.034.04-.446.108-.608.154-.69a1.5 1.5 0 0 1 .56-.559c.08-.045.243-.113.693-.154C6.42 1.501 7.041 1.5 8 1.5c.959 0 1.58.001 2.05.043.45.04.613.109.693.154a1.5 1.5 0 0 1 .56.56c.046.08.114.243.154.69.042.465.043 1.08.043 2.033Z" fill="#fff"/></svg>`,ARROW_DOWN_ICON:Nt`<svg width="14" height="14" viewBox="0 0 14 14"><path d="M2.28 7.47a.75.75 0 0 0-1.06 1.06l5.25 5.25a.75.75 0 0 0 1.06 0l5.25-5.25a.75.75 0 0 0-1.06-1.06l-3.544 3.543a.25.25 0 0 1-.426-.177V.75a.75.75 0 0 0-1.5 0v10.086a.25.25 0 0 1-.427.176L2.28 7.47Z" fill="#fff"/></svg>`,ARROW_UP_RIGHT_ICON:Nt`<svg width="15" height="14" fill="none"><path d="M4.5 1.75A.75.75 0 0 1 5.25 1H12a1.5 1.5 0 0 1 1.5 1.5v6.75a.75.75 0 0 1-1.5 0V4.164a.25.25 0 0 0-.427-.176L4.061 11.5A.75.75 0 0 1 3 10.44l7.513-7.513a.25.25 0 0 0-.177-.427H5.25a.75.75 0 0 1-.75-.75Z" fill="#fff"/></svg>`,ARROW_RIGHT_ICON:Nt`<svg width="6" height="14" viewBox="0 0 6 14"><path fill-rule="evenodd" clip-rule="evenodd" d="M2.181 1.099a.75.75 0 0 1 1.024.279l2.433 4.258a2.75 2.75 0 0 1 0 2.729l-2.433 4.257a.75.75 0 1 1-1.303-.744L4.335 7.62a1.25 1.25 0 0 0 0-1.24L1.902 2.122a.75.75 0 0 1 .28-1.023Z" fill="#fff"/></svg>`,QRCODE_ICON:Nt`<svg width="25" height="24" viewBox="0 0 25 24"><path d="M23.748 9a.748.748 0 0 0 .748-.752c-.018-2.596-.128-4.07-.784-5.22a6 6 0 0 0-2.24-2.24c-1.15-.656-2.624-.766-5.22-.784a.748.748 0 0 0-.752.748c0 .414.335.749.748.752 1.015.007 1.82.028 2.494.088.995.09 1.561.256 1.988.5.7.398 1.28.978 1.679 1.678.243.427.41.993.498 1.988.061.675.082 1.479.09 2.493a.753.753 0 0 0 .75.749ZM3.527.788C4.677.132 6.152.022 8.747.004A.748.748 0 0 1 9.5.752a.753.753 0 0 1-.749.752c-1.014.007-1.818.028-2.493.088-.995.09-1.561.256-1.988.5-.7.398-1.28.978-1.679 1.678-.243.427-.41.993-.499 1.988-.06.675-.081 1.479-.088 2.493A.753.753 0 0 1 1.252 9a.748.748 0 0 1-.748-.752c.018-2.596.128-4.07.784-5.22a6 6 0 0 1 2.24-2.24ZM1.252 15a.748.748 0 0 0-.748.752c.018 2.596.128 4.07.784 5.22a6 6 0 0 0 2.24 2.24c1.15.656 2.624.766 5.22.784a.748.748 0 0 0 .752-.748.753.753 0 0 0-.749-.752c-1.014-.007-1.818-.028-2.493-.089-.995-.089-1.561-.255-1.988-.498a4.5 4.5 0 0 1-1.679-1.68c-.243-.426-.41-.992-.499-1.987-.06-.675-.081-1.479-.088-2.493A.753.753 0 0 0 1.252 15ZM22.996 15.749a.753.753 0 0 1 .752-.749c.415 0 .751.338.748.752-.018 2.596-.128 4.07-.784 5.22a6 6 0 0 1-2.24 2.24c-1.15.656-2.624.766-5.22.784a.748.748 0 0 1-.752-.748c0-.414.335-.749.748-.752 1.015-.007 1.82-.028 2.494-.089.995-.089 1.561-.255 1.988-.498a4.5 4.5 0 0 0 1.679-1.68c.243-.426.41-.992.498-1.987.061-.675.082-1.479.09-2.493Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M7 4a2.5 2.5 0 0 0-2.5 2.5v2A2.5 2.5 0 0 0 7 11h2a2.5 2.5 0 0 0 2.5-2.5v-2A2.5 2.5 0 0 0 9 4H7Zm2 1.5H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1ZM13.5 6.5A2.5 2.5 0 0 1 16 4h2a2.5 2.5 0 0 1 2.5 2.5v2A2.5 2.5 0 0 1 18 11h-2a2.5 2.5 0 0 1-2.5-2.5v-2Zm2.5-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1ZM7 13a2.5 2.5 0 0 0-2.5 2.5v2A2.5 2.5 0 0 0 7 20h2a2.5 2.5 0 0 0 2.5-2.5v-2A2.5 2.5 0 0 0 9 13H7Zm2 1.5H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1Z" fill="#fff"/><path d="M13.5 15.5c0-.465 0-.697.038-.89a2 2 0 0 1 1.572-1.572C15.303 13 15.535 13 16 13v2.5h-2.5ZM18 13c.465 0 .697 0 .89.038a2 2 0 0 1 1.572 1.572c.038.193.038.425.038.89H18V13ZM18 17.5h2.5c0 .465 0 .697-.038.89a2 2 0 0 1-1.572 1.572C18.697 20 18.465 20 18 20v-2.5ZM13.5 17.5H16V20c-.465 0-.697 0-.89-.038a2 2 0 0 1-1.572-1.572c-.038-.193-.038-.425-.038-.89Z" fill="#fff"/></svg>`,SCAN_ICON:Nt`<svg width="16" height="16" fill="none"><path fill="#fff" d="M10 15.216c0 .422.347.763.768.74 1.202-.064 2.025-.222 2.71-.613a5.001 5.001 0 0 0 1.865-1.866c.39-.684.549-1.507.613-2.709a.735.735 0 0 0-.74-.768.768.768 0 0 0-.76.732c-.009.157-.02.306-.032.447-.073.812-.206 1.244-.384 1.555-.31.545-.761.996-1.306 1.306-.311.178-.743.311-1.555.384-.141.013-.29.023-.447.032a.768.768 0 0 0-.732.76ZM10 .784c0 .407.325.737.732.76.157.009.306.02.447.032.812.073 1.244.206 1.555.384a3.5 3.5 0 0 1 1.306 1.306c.178.311.311.743.384 1.555.013.142.023.29.032.447a.768.768 0 0 0 .76.732.734.734 0 0 0 .74-.768c-.064-1.202-.222-2.025-.613-2.71A5 5 0 0 0 13.477.658c-.684-.39-1.507-.549-2.709-.613a.735.735 0 0 0-.768.74ZM5.232.044A.735.735 0 0 1 6 .784a.768.768 0 0 1-.732.76c-.157.009-.305.02-.447.032-.812.073-1.244.206-1.555.384A3.5 3.5 0 0 0 1.96 3.266c-.178.311-.311.743-.384 1.555-.013.142-.023.29-.032.447A.768.768 0 0 1 .784 6a.735.735 0 0 1-.74-.768c.064-1.202.222-2.025.613-2.71A5 5 0 0 1 2.523.658C3.207.267 4.03.108 5.233.044ZM5.268 14.456a.768.768 0 0 1 .732.76.734.734 0 0 1-.768.74c-1.202-.064-2.025-.222-2.71-.613a5 5 0 0 1-1.865-1.866c-.39-.684-.549-1.507-.613-2.709A.735.735 0 0 1 .784 10c.407 0 .737.325.76.732.009.157.02.306.032.447.073.812.206 1.244.384 1.555a3.5 3.5 0 0 0 1.306 1.306c.311.178.743.311 1.555.384.142.013.29.023.447.032Z"/></svg>`,CHECKMARK_ICON:Nt`<svg width="13" height="12" viewBox="0 0 13 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.155.132a.75.75 0 0 1 .232 1.035L5.821 11.535a1 1 0 0 1-1.626.09L.665 7.21a.75.75 0 1 1 1.17-.937L4.71 9.867a.25.25 0 0 0 .406-.023L11.12.364a.75.75 0 0 1 1.035-.232Z" fill="#fff"/></svg>`,SEARCH_ICON:Nt`<svg width="20" height="21"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.432 13.992c-.354-.353-.91-.382-1.35-.146a5.5 5.5 0 1 1 2.265-2.265c-.237.441-.208.997.145 1.35l3.296 3.296a.75.75 0 1 1-1.06 1.061l-3.296-3.296Zm.06-5a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z" fill="#949E9E"/></svg>`,WALLET_PLACEHOLDER:Nt`<svg width="60" height="60" fill="none" viewBox="0 0 60 60"><g clip-path="url(#q)"><path id="wallet-placeholder-fill" fill="#fff" d="M0 24.9c0-9.251 0-13.877 1.97-17.332a15 15 0 0 1 5.598-5.597C11.023 0 15.648 0 24.9 0h10.2c9.252 0 13.877 0 17.332 1.97a15 15 0 0 1 5.597 5.598C60 11.023 60 15.648 60 24.9v10.2c0 9.252 0 13.877-1.97 17.332a15.001 15.001 0 0 1-5.598 5.597C48.977 60 44.352 60 35.1 60H24.9c-9.251 0-13.877 0-17.332-1.97a15 15 0 0 1-5.597-5.598C0 48.977 0 44.352 0 35.1V24.9Z"/><path id="wallet-placeholder-dash" stroke="#000" stroke-dasharray="4 4" stroke-width="1.5" d="M.04 41.708a231.598 231.598 0 0 1-.039-4.403l.75-.001L.75 35.1v-2.55H0v-5.1h.75V24.9l.001-2.204h-.75c.003-1.617.011-3.077.039-4.404l.75.016c.034-1.65.099-3.08.218-4.343l-.746-.07c.158-1.678.412-3.083.82-4.316l.713.236c.224-.679.497-1.296.827-1.875a14.25 14.25 0 0 1 1.05-1.585L3.076 5.9A15 15 0 0 1 5.9 3.076l.455.596a14.25 14.25 0 0 1 1.585-1.05c.579-.33 1.196-.603 1.875-.827l-.236-.712C10.812.674 12.217.42 13.895.262l.07.746C15.23.89 16.66.824 18.308.79l-.016-.75C19.62.012 21.08.004 22.695.001l.001.75L24.9.75h2.55V0h5.1v.75h2.55l2.204.001v-.75c1.617.003 3.077.011 4.404.039l-.016.75c1.65.034 3.08.099 4.343.218l.07-.746c1.678.158 3.083.412 4.316.82l-.236.713c.679.224 1.296.497 1.875.827a14.24 14.24 0 0 1 1.585 1.05l.455-.596A14.999 14.999 0 0 1 56.924 5.9l-.596.455c.384.502.735 1.032 1.05 1.585.33.579.602 1.196.827 1.875l.712-.236c.409 1.233.663 2.638.822 4.316l-.747.07c.119 1.264.184 2.694.218 4.343l.75-.016c.028 1.327.036 2.787.039 4.403l-.75.001.001 2.204v2.55H60v5.1h-.75v2.55l-.001 2.204h.75a231.431 231.431 0 0 1-.039 4.404l-.75-.016c-.034 1.65-.099 3.08-.218 4.343l.747.07c-.159 1.678-.413 3.083-.822 4.316l-.712-.236a10.255 10.255 0 0 1-.827 1.875 14.242 14.242 0 0 1-1.05 1.585l.596.455a14.997 14.997 0 0 1-2.824 2.824l-.455-.596c-.502.384-1.032.735-1.585 1.05-.579.33-1.196.602-1.875.827l.236.712c-1.233.409-2.638.663-4.316.822l-.07-.747c-1.264.119-2.694.184-4.343.218l.016.75c-1.327.028-2.787.036-4.403.039l-.001-.75-2.204.001h-2.55V60h-5.1v-.75H24.9l-2.204-.001v.75a231.431 231.431 0 0 1-4.404-.039l.016-.75c-1.65-.034-3.08-.099-4.343-.218l-.07.747c-1.678-.159-3.083-.413-4.316-.822l.236-.712a10.258 10.258 0 0 1-1.875-.827 14.252 14.252 0 0 1-1.585-1.05l-.455.596A14.999 14.999 0 0 1 3.076 54.1l.596-.455a14.24 14.24 0 0 1-1.05-1.585 10.259 10.259 0 0 1-.827-1.875l-.712.236C.674 49.188.42 47.783.262 46.105l.746-.07C.89 44.77.824 43.34.79 41.692l-.75.016Z"/><path fill="#fff" fill-rule="evenodd" d="M35.643 32.145c-.297-.743-.445-1.114-.401-1.275a.42.42 0 0 1 .182-.27c.134-.1.463-.1 1.123-.1.742 0 1.499.046 2.236-.05a6 6 0 0 0 5.166-5.166c.051-.39.051-.855.051-1.784 0-.928 0-1.393-.051-1.783a6 6 0 0 0-5.166-5.165c-.39-.052-.854-.052-1.783-.052h-7.72c-4.934 0-7.401 0-9.244 1.051a8 8 0 0 0-2.985 2.986C16.057 22.28 16.003 24.58 16 29 15.998 31.075 16 33.15 16 35.224A7.778 7.778 0 0 0 23.778 43H28.5c1.394 0 2.09 0 2.67-.116a6 6 0 0 0 4.715-4.714c.115-.58.115-1.301.115-2.744 0-1.31 0-1.964-.114-2.49a4.998 4.998 0 0 0-.243-.792Z" clip-rule="evenodd"/><path fill="#9EA9A9" fill-rule="evenodd" d="M37 18h-7.72c-2.494 0-4.266.002-5.647.126-1.361.122-2.197.354-2.854.728a6.5 6.5 0 0 0-2.425 2.426c-.375.657-.607 1.492-.729 2.853-.11 1.233-.123 2.777-.125 4.867 0 .7 0 1.05.097 1.181.096.13.182.181.343.2.163.02.518-.18 1.229-.581a6.195 6.195 0 0 1 3.053-.8H37c.977 0 1.32-.003 1.587-.038a4.5 4.5 0 0 0 3.874-3.874c.036-.268.039-.611.039-1.588 0-.976-.003-1.319-.038-1.587a4.5 4.5 0 0 0-3.875-3.874C38.32 18.004 37.977 18 37 18Zm-7.364 12.5h-7.414a4.722 4.722 0 0 0-4.722 4.723 6.278 6.278 0 0 0 6.278 6.278H28.5c1.466 0 1.98-.008 2.378-.087a4.5 4.5 0 0 0 3.535-3.536c.08-.397.087-.933.087-2.451 0-1.391-.009-1.843-.08-2.17a3.5 3.5 0 0 0-2.676-2.676c-.328-.072-.762-.08-2.108-.08Z" clip-rule="evenodd"/></g><defs><clipPath id="q"><path fill="#fff" d="M0 0h60v60H0z"/></clipPath></defs></svg>`,GLOBE_ICON:Nt`<svg width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="#fff" fill-rule="evenodd" d="M15.5 8a7.5 7.5 0 1 1-15 0 7.5 7.5 0 0 1 15 0Zm-2.113.75c.301 0 .535.264.47.558a6.01 6.01 0 0 1-2.867 3.896c-.203.116-.42-.103-.334-.32.409-1.018.691-2.274.797-3.657a.512.512 0 0 1 .507-.477h1.427Zm.47-2.058c.065.294-.169.558-.47.558H11.96a.512.512 0 0 1-.507-.477c-.106-1.383-.389-2.638-.797-3.656-.087-.217.13-.437.333-.32a6.01 6.01 0 0 1 2.868 3.895Zm-4.402.558c.286 0 .515-.24.49-.525-.121-1.361-.429-2.534-.83-3.393-.279-.6-.549-.93-.753-1.112a.535.535 0 0 0-.724 0c-.204.182-.474.513-.754 1.112-.4.859-.708 2.032-.828 3.393a.486.486 0 0 0 .49.525h2.909Zm-5.415 0c.267 0 .486-.21.507-.477.106-1.383.389-2.638.797-3.656.087-.217-.13-.437-.333-.32a6.01 6.01 0 0 0-2.868 3.895c-.065.294.169.558.47.558H4.04ZM2.143 9.308c-.065-.294.169-.558.47-.558H4.04c.267 0 .486.21.507.477.106 1.383.389 2.639.797 3.657.087.217-.13.436-.333.32a6.01 6.01 0 0 1-2.868-3.896Zm3.913-.033a.486.486 0 0 1 .49-.525h2.909c.286 0 .515.24.49.525-.121 1.361-.428 2.535-.83 3.394-.279.6-.549.93-.753 1.112a.535.535 0 0 1-.724 0c-.204-.182-.474-.513-.754-1.112-.4-.859-.708-2.033-.828-3.394Z" clip-rule="evenodd"/></svg>`},FS=ct`.wcm-toolbar-placeholder{top:0;bottom:0;left:0;right:0;width:100%;position:absolute;display:block;pointer-events:none;height:100px;border-radius:calc(var(--wcm-background-border-radius) * .9);background-color:var(--wcm-background-color);background-position:center;background-size:cover}.wcm-toolbar{height:38px;display:flex;position:relative;margin:5px 15px 5px 5px;justify-content:space-between;align-items:center}.wcm-toolbar img,.wcm-toolbar svg{height:28px;object-position:left center;object-fit:contain}#wcm-wc-logo path{fill:var(--wcm-accent-fill-color)}button{width:28px;height:28px;border-radius:var(--wcm-icon-button-border-radius);border:0;display:flex;justify-content:center;align-items:center;cursor:pointer;background-color:var(--wcm-color-bg-1);box-shadow:0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-bg-2)}button svg{display:block;object-position:center}button path{fill:var(--wcm-color-fg-1)}.wcm-toolbar div{display:flex}@media(hover:hover){button:hover{background-color:var(--wcm-color-bg-2)}}`;var BS=Object.defineProperty,kS=Object.getOwnPropertyDescriptor,zS=(r,e,t,n)=>{for(var i=n>1?void 0:n?kS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&BS(e,t,i),i};let Qh=class extends Ye{render(){return he`<div class="wcm-toolbar-placeholder"></div><div class="wcm-toolbar">${ut.WALLET_CONNECT_LOGO} <button @click="${Zi.close}">${ut.CROSS_ICON}</button></div>`}};Qh.styles=[tt.globalCss,FS],Qh=zS([st("wcm-modal-backcard")],Qh);const qS=ct`main{padding:20px;padding-top:0;width:100%}`;var HS=Object.defineProperty,WS=Object.getOwnPropertyDescriptor,KS=(r,e,t,n)=>{for(var i=n>1?void 0:n?WS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&HS(e,t,i),i};let Xh=class extends Ye{render(){return he`<main><slot></slot></main>`}};Xh.styles=[tt.globalCss,qS],Xh=KS([st("wcm-modal-content")],Xh);const VS=ct`footer{padding:10px;display:flex;flex-direction:column;align-items:inherit;justify-content:inherit;border-top:1px solid var(--wcm-color-bg-2)}`;var GS=Object.defineProperty,YS=Object.getOwnPropertyDescriptor,ZS=(r,e,t,n)=>{for(var i=n>1?void 0:n?YS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&GS(e,t,i),i};let ef=class extends Ye{render(){return he`<footer><slot></slot></footer>`}};ef.styles=[tt.globalCss,VS],ef=ZS([st("wcm-modal-footer")],ef);const JS=ct`header{display:flex;justify-content:center;align-items:center;padding:20px;position:relative}.wcm-border{border-bottom:1px solid var(--wcm-color-bg-2);margin-bottom:20px}header button{padding:15px 20px}header button:active{opacity:.5}@media(hover:hover){header button:hover{opacity:.5}}.wcm-back-btn{position:absolute;left:0}.wcm-action-btn{position:absolute;right:0}path{fill:var(--wcm-accent-color)}`;var QS=Object.defineProperty,XS=Object.getOwnPropertyDescriptor,aa=(r,e,t,n)=>{for(var i=n>1?void 0:n?XS(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&QS(e,t,i),i};let is=class extends Ye{constructor(){super(...arguments),this.title="",this.onAction=void 0,this.actionIcon=void 0,this.border=!1}backBtnTemplate(){return he`<button class="wcm-back-btn" @click="${Pt.goBack}">${ut.BACK_ICON}</button>`}actionBtnTemplate(){return he`<button class="wcm-action-btn" @click="${this.onAction}">${this.actionIcon}</button>`}render(){const r={"wcm-border":this.border},e=Pt.state.history.length>1,t=this.title?he`<wcm-text variant="big-bold">${this.title}</wcm-text>`:he`<slot></slot>`;return he`<header class="${Wn(r)}">${e?this.backBtnTemplate():null} ${t} ${this.onAction?this.actionBtnTemplate():null}</header>`}};is.styles=[tt.globalCss,JS],aa([Be()],is.prototype,"title",2),aa([Be()],is.prototype,"onAction",2),aa([Be()],is.prototype,"actionIcon",2),aa([Be({type:Boolean})],is.prototype,"border",2),is=aa([st("wcm-modal-header")],is);const Pe={MOBILE_BREAKPOINT:600,WCM_RECENT_WALLET_DATA:"WCM_RECENT_WALLET_DATA",EXPLORER_WALLET_URL:"https://explorer.walletconnect.com/?type=wallet",getShadowRootElement(r,e){const t=r.renderRoot.querySelector(e);if(!t)throw new Error(`${e} not found`);return t},getWalletIcon({id:r,image_id:e}){const{walletImages:t}=Kr.state;return t!=null&&t[r]?t[r]:e?Tr.getWalletImageUrl(e):""},getWalletName(r,e=!1){return e&&r.length>8?`${r.substring(0,8)}..`:r},isMobileAnimation(){return window.innerWidth<=Pe.MOBILE_BREAKPOINT},async preloadImage(r){const e=new Promise((t,n)=>{const i=new Image;i.onload=t,i.onerror=n,i.crossOrigin="anonymous",i.src=r});return Promise.race([e,we.wait(3e3)])},getErrorMessage(r){return r instanceof Error?r.message:"Unknown Error"},debounce(r,e=500){let t;return(...n)=>{function i(){r(...n)}t&&clearTimeout(t),t=setTimeout(i,e)}},handleMobileLinking(r){const{walletConnectUri:e}=zt.state,{mobile:t,name:n}=r,i=t?.native,a=t?.universal;Pe.setRecentWallet(r);function c(u){let f="";i?f=we.formatUniversalUrl(i,u,n):a&&(f=we.formatNativeUrl(a,u,n)),we.openHref(f,"_self")}e&&c(e)},handleAndroidLinking(){const{walletConnectUri:r}=zt.state;r&&(we.setWalletConnectAndroidDeepLink(r),we.openHref(r,"_self"))},async handleUriCopy(){const{walletConnectUri:r}=zt.state;if(r)try{await navigator.clipboard.writeText(r),gi.openToast("Link copied","success")}catch{gi.openToast("Failed to copy","error")}},getCustomImageUrls(){const{walletImages:r}=Kr.state,e=Object.values(r??{});return Object.values(e)},truncate(r,e=8){return r.length<=e?r:`${r.substring(0,4)}...${r.substring(r.length-4)}`},setRecentWallet(r){try{localStorage.setItem(Pe.WCM_RECENT_WALLET_DATA,JSON.stringify(r))}catch{console.info("Unable to set recent wallet")}},getRecentWallet(){try{const r=localStorage.getItem(Pe.WCM_RECENT_WALLET_DATA);return r?JSON.parse(r):void 0}catch{console.info("Unable to get recent wallet")}},caseSafeIncludes(r,e){return r.toUpperCase().includes(e.toUpperCase())},openWalletExplorerUrl(){we.openHref(Pe.EXPLORER_WALLET_URL,"_blank")},getCachedRouterWalletPlatforms(){const{desktop:r,mobile:e}=we.getWalletRouterData(),t=!!r?.native,n=!!r?.universal,i=!!e?.native||!!e?.universal;return{isDesktop:t,isMobile:i,isWeb:n}},goToConnectingView(r){Pt.setData({Wallet:r});const e=we.isMobile(),{isDesktop:t,isWeb:n,isMobile:i}=Pe.getCachedRouterWalletPlatforms();e?i?Pt.push("MobileConnecting"):n?Pt.push("WebConnecting"):Pt.push("InstallWallet"):t?Pt.push("DesktopConnecting"):n?Pt.push("WebConnecting"):i?Pt.push("MobileQrcodeConnecting"):Pt.push("InstallWallet")}},eO=ct`.wcm-router{overflow:hidden;will-change:transform}.wcm-content{display:flex;flex-direction:column}`;var tO=Object.defineProperty,rO=Object.getOwnPropertyDescriptor,tf=(r,e,t,n)=>{for(var i=n>1?void 0:n?rO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&tO(e,t,i),i};let ca=class extends Ye{constructor(){super(),this.view=Pt.state.view,this.prevView=Pt.state.view,this.unsubscribe=void 0,this.oldHeight="0px",this.resizeObserver=void 0,this.unsubscribe=Pt.subscribe(r=>{this.view!==r.view&&this.onChangeRoute()})}firstUpdated(){this.resizeObserver=new ResizeObserver(([r])=>{const e=`${r.contentRect.height}px`;this.oldHeight!=="0px"&&ns(this.routerEl,{height:[this.oldHeight,e]},{duration:.2}),this.oldHeight=e}),this.resizeObserver.observe(this.contentEl)}disconnectedCallback(){var r,e;(r=this.unsubscribe)==null||r.call(this),(e=this.resizeObserver)==null||e.disconnect()}get routerEl(){return Pe.getShadowRootElement(this,".wcm-router")}get contentEl(){return Pe.getShadowRootElement(this,".wcm-content")}viewTemplate(){switch(this.view){case"ConnectWallet":return he`<wcm-connect-wallet-view></wcm-connect-wallet-view>`;case"DesktopConnecting":return he`<wcm-desktop-connecting-view></wcm-desktop-connecting-view>`;case"MobileConnecting":return he`<wcm-mobile-connecting-view></wcm-mobile-connecting-view>`;case"WebConnecting":return he`<wcm-web-connecting-view></wcm-web-connecting-view>`;case"MobileQrcodeConnecting":return he`<wcm-mobile-qr-connecting-view></wcm-mobile-qr-connecting-view>`;case"WalletExplorer":return he`<wcm-wallet-explorer-view></wcm-wallet-explorer-view>`;case"Qrcode":return he`<wcm-qrcode-view></wcm-qrcode-view>`;case"InstallWallet":return he`<wcm-install-wallet-view></wcm-install-wallet-view>`;default:return he`<div>Not Found</div>`}}async onChangeRoute(){await ns(this.routerEl,{opacity:[1,0],scale:[1,1.02]},{duration:.15,delay:.1}).finished,this.view=Pt.state.view,ns(this.routerEl,{opacity:[0,1],scale:[.99,1]},{duration:.37,delay:.05})}render(){return he`<div class="wcm-router"><div class="wcm-content">${this.viewTemplate()}</div></div>`}};ca.styles=[tt.globalCss,eO],tf([Rr()],ca.prototype,"view",2),tf([Rr()],ca.prototype,"prevView",2),ca=tf([st("wcm-modal-router")],ca);const nO=ct`div{height:36px;width:max-content;display:flex;justify-content:center;align-items:center;padding:9px 15px 11px;position:absolute;top:12px;box-shadow:0 6px 14px -6px rgba(10,16,31,.3),0 10px 32px -4px rgba(10,16,31,.15);z-index:2;left:50%;transform:translateX(-50%);pointer-events:none;backdrop-filter:blur(20px) saturate(1.8);-webkit-backdrop-filter:blur(20px) saturate(1.8);border-radius:var(--wcm-notification-border-radius);border:1px solid var(--wcm-color-overlay);background-color:var(--wcm-color-overlay)}svg{margin-right:5px}@-moz-document url-prefix(){div{background-color:var(--wcm-color-bg-3)}}.wcm-success path{fill:var(--wcm-accent-color)}.wcm-error path{fill:var(--wcm-error-color)}`;var iO=Object.defineProperty,sO=Object.getOwnPropertyDescriptor,Lm=(r,e,t,n)=>{for(var i=n>1?void 0:n?sO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&iO(e,t,i),i};let Ac=class extends Ye{constructor(){super(),this.open=!1,this.unsubscribe=void 0,this.timeout=void 0,this.unsubscribe=gi.subscribe(r=>{r.open?(this.open=!0,this.timeout=setTimeout(()=>gi.closeToast(),2200)):(this.open=!1,clearTimeout(this.timeout))})}disconnectedCallback(){var r;(r=this.unsubscribe)==null||r.call(this),clearTimeout(this.timeout),gi.closeToast()}render(){const{message:r,variant:e}=gi.state,t={"wcm-success":e==="success","wcm-error":e==="error"};return this.open?he`<div class="${Wn(t)}">${e==="success"?ut.CHECKMARK_ICON:null} ${e==="error"?ut.CROSS_ICON:null}<wcm-text variant="small-regular">${r}</wcm-text></div>`:null}};Ac.styles=[tt.globalCss,nO],Lm([Rr()],Ac.prototype,"open",2),Ac=Lm([st("wcm-modal-toast")],Ac);const oO=.1,Mm=2.5,Kn=7;function rf(r,e,t){return r===e?!1:(r-e<0?e-r:r-e)<=t+oO}function aO(r,e){const t=Array.prototype.slice.call(ra.create(r,{errorCorrectionLevel:e}).modules.data,0),n=Math.sqrt(t.length);return t.reduce((i,a,c)=>(c%n===0?i.push([a]):i[i.length-1].push(a))&&i,[])}const cO={generate(r,e,t){const n="#141414",i="#ffffff",a=[],c=aO(r,"Q"),u=e/c.length,f=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];f.forEach(({x:I,y:A})=>{const U=(c.length-Kn)*u*I,j=(c.length-Kn)*u*A,$=.45;for(let T=0;T<f.length;T+=1){const O=u*(Kn-T*2);a.push(Nt`<rect fill="${T%2===0?n:i}" height="${O}" rx="${O*$}" ry="${O*$}" width="${O}" x="${U+u*T}" y="${j+u*T}">`)}});const h=Math.floor((t+25)/u),m=c.length/2-h/2,w=c.length/2+h/2-1,y=[];c.forEach((I,A)=>{I.forEach((U,j)=>{if(c[A][j]&&!(A<Kn&&j<Kn||A>c.length-(Kn+1)&&j<Kn||A<Kn&&j>c.length-(Kn+1))&&!(A>m&&A<w&&j>m&&j<w)){const $=A*u+u/2,T=j*u+u/2;y.push([$,T])}})});const b={};return y.forEach(([I,A])=>{b[I]?b[I].push(A):b[I]=[A]}),Object.entries(b).map(([I,A])=>{const U=A.filter(j=>A.every($=>!rf(j,$,u)));return[Number(I),U]}).forEach(([I,A])=>{A.forEach(U=>{a.push(Nt`<circle cx="${I}" cy="${U}" fill="${n}" r="${u/Mm}">`)})}),Object.entries(b).filter(([I,A])=>A.length>1).map(([I,A])=>{const U=A.filter(j=>A.some($=>rf(j,$,u)));return[Number(I),U]}).map(([I,A])=>{A.sort((j,$)=>j<$?-1:1);const U=[];for(const j of A){const $=U.find(T=>T.some(O=>rf(j,O,u)));$?$.push(j):U.push([j])}return[I,U.map(j=>[j[0],j[j.length-1]])]}).forEach(([I,A])=>{A.forEach(([U,j])=>{a.push(Nt`<line x1="${I}" x2="${I}" y1="${U}" y2="${j}" stroke="${n}" stroke-width="${u/(Mm/2)}" stroke-linecap="round">`)})}),a}},lO=ct`@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}div{position:relative;user-select:none;display:block;overflow:hidden;aspect-ratio:1/1;animation:fadeIn ease .2s}.wcm-dark{background-color:#fff;border-radius:var(--wcm-container-border-radius);padding:18px;box-shadow:0 2px 5px #000}svg:first-child,wcm-wallet-image{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{width:25%;height:25%;border-radius:var(--wcm-wallet-icon-border-radius)}svg:first-child{transform:translateY(-50%) translateX(-50%) scale(.9)}svg:first-child path:first-child{fill:var(--wcm-accent-color)}svg:first-child path:last-child{stroke:var(--wcm-color-overlay)}`;var uO=Object.defineProperty,hO=Object.getOwnPropertyDescriptor,Ks=(r,e,t,n)=>{for(var i=n>1?void 0:n?hO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&uO(e,t,i),i};let Vn=class extends Ye{constructor(){super(...arguments),this.uri="",this.size=0,this.imageId=void 0,this.walletId=void 0,this.imageUrl=void 0}svgTemplate(){const r=pi.state.themeMode==="light"?this.size:this.size-36;return Nt`<svg height="${r}" width="${r}">${cO.generate(this.uri,r,r/4)}</svg>`}render(){const r={"wcm-dark":pi.state.themeMode==="dark"};return he`<div style="${`width: ${this.size}px`}" class="${Wn(r)}">${this.walletId||this.imageUrl?he`<wcm-wallet-image walletId="${Er(this.walletId)}" imageId="${Er(this.imageId)}" imageUrl="${Er(this.imageUrl)}"></wcm-wallet-image>`:ut.WALLET_CONNECT_ICON_COLORED} ${this.svgTemplate()}</div>`}};Vn.styles=[tt.globalCss,lO],Ks([Be()],Vn.prototype,"uri",2),Ks([Be({type:Number})],Vn.prototype,"size",2),Ks([Be()],Vn.prototype,"imageId",2),Ks([Be()],Vn.prototype,"walletId",2),Ks([Be()],Vn.prototype,"imageUrl",2),Vn=Ks([st("wcm-qrcode")],Vn);const fO=ct`:host{position:relative;height:28px;width:80%}input{width:100%;height:100%;line-height:28px!important;border-radius:var(--wcm-input-border-radius);font-style:normal;font-family:-apple-system,system-ui,BlinkMacSystemFont,'Segoe UI',Roboto,Ubuntu,'Helvetica Neue',sans-serif;font-feature-settings:'case' on;font-weight:500;font-size:16px;letter-spacing:-.03em;padding:0 10px 0 34px;transition:.2s all ease;color:var(--wcm-color-fg-1);background-color:var(--wcm-color-bg-3);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay);caret-color:var(--wcm-accent-color)}input::placeholder{color:var(--wcm-color-fg-2)}svg{left:10px;top:4px;pointer-events:none;position:absolute;width:20px;height:20px}input:focus-within{box-shadow:inset 0 0 0 1px var(--wcm-accent-color)}path{fill:var(--wcm-color-fg-2)}`;var dO=Object.defineProperty,pO=Object.getOwnPropertyDescriptor,Um=(r,e,t,n)=>{for(var i=n>1?void 0:n?pO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&dO(e,t,i),i};let Pc=class extends Ye{constructor(){super(...arguments),this.onChange=()=>null}render(){return he`<input type="text" @input="${this.onChange}" placeholder="Search wallets"> ${ut.SEARCH_ICON}`}};Pc.styles=[tt.globalCss,fO],Um([Be()],Pc.prototype,"onChange",2),Pc=Um([st("wcm-search-input")],Pc);const gO=ct`@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}100%{stroke-dasharray:90,150;stroke-dashoffset:-124}}svg{animation:rotate 2s linear infinite;display:flex;justify-content:center;align-items:center}svg circle{stroke-linecap:round;animation:dash 1.5s ease infinite;stroke:var(--wcm-accent-color)}`;var mO=Object.defineProperty,vO=Object.getOwnPropertyDescriptor,yO=(r,e,t,n)=>{for(var i=n>1?void 0:n?vO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&mO(e,t,i),i};let nf=class extends Ye{render(){return he`<svg viewBox="0 0 50 50" width="24" height="24"><circle cx="25" cy="25" r="20" fill="none" stroke-width="4" stroke="#fff"/></svg>`}};nf.styles=[tt.globalCss,gO],nf=yO([st("wcm-spinner")],nf);const wO=ct`span{font-style:normal;font-family:var(--wcm-font-family);font-feature-settings:var(--wcm-font-feature-settings)}.wcm-xsmall-bold{font-family:var(--wcm-text-xsmall-bold-font-family);font-weight:var(--wcm-text-xsmall-bold-weight);font-size:var(--wcm-text-xsmall-bold-size);line-height:var(--wcm-text-xsmall-bold-line-height);letter-spacing:var(--wcm-text-xsmall-bold-letter-spacing);text-transform:var(--wcm-text-xsmall-bold-text-transform)}.wcm-xsmall-regular{font-family:var(--wcm-text-xsmall-regular-font-family);font-weight:var(--wcm-text-xsmall-regular-weight);font-size:var(--wcm-text-xsmall-regular-size);line-height:var(--wcm-text-xsmall-regular-line-height);letter-spacing:var(--wcm-text-xsmall-regular-letter-spacing);text-transform:var(--wcm-text-xsmall-regular-text-transform)}.wcm-small-thin{font-family:var(--wcm-text-small-thin-font-family);font-weight:var(--wcm-text-small-thin-weight);font-size:var(--wcm-text-small-thin-size);line-height:var(--wcm-text-small-thin-line-height);letter-spacing:var(--wcm-text-small-thin-letter-spacing);text-transform:var(--wcm-text-small-thin-text-transform)}.wcm-small-regular{font-family:var(--wcm-text-small-regular-font-family);font-weight:var(--wcm-text-small-regular-weight);font-size:var(--wcm-text-small-regular-size);line-height:var(--wcm-text-small-regular-line-height);letter-spacing:var(--wcm-text-small-regular-letter-spacing);text-transform:var(--wcm-text-small-regular-text-transform)}.wcm-medium-regular{font-family:var(--wcm-text-medium-regular-font-family);font-weight:var(--wcm-text-medium-regular-weight);font-size:var(--wcm-text-medium-regular-size);line-height:var(--wcm-text-medium-regular-line-height);letter-spacing:var(--wcm-text-medium-regular-letter-spacing);text-transform:var(--wcm-text-medium-regular-text-transform)}.wcm-big-bold{font-family:var(--wcm-text-big-bold-font-family);font-weight:var(--wcm-text-big-bold-weight);font-size:var(--wcm-text-big-bold-size);line-height:var(--wcm-text-big-bold-line-height);letter-spacing:var(--wcm-text-big-bold-letter-spacing);text-transform:var(--wcm-text-big-bold-text-transform)}:host(*){color:var(--wcm-color-fg-1)}.wcm-color-primary{color:var(--wcm-color-fg-1)}.wcm-color-secondary{color:var(--wcm-color-fg-2)}.wcm-color-tertiary{color:var(--wcm-color-fg-3)}.wcm-color-inverse{color:var(--wcm-accent-fill-color)}.wcm-color-accnt{color:var(--wcm-accent-color)}.wcm-color-error{color:var(--wcm-error-color)}`;var bO=Object.defineProperty,_O=Object.getOwnPropertyDescriptor,sf=(r,e,t,n)=>{for(var i=n>1?void 0:n?_O(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&bO(e,t,i),i};let la=class extends Ye{constructor(){super(...arguments),this.variant="medium-regular",this.color="primary"}render(){const r={"wcm-big-bold":this.variant==="big-bold","wcm-medium-regular":this.variant==="medium-regular","wcm-small-regular":this.variant==="small-regular","wcm-small-thin":this.variant==="small-thin","wcm-xsmall-regular":this.variant==="xsmall-regular","wcm-xsmall-bold":this.variant==="xsmall-bold","wcm-color-primary":this.color==="primary","wcm-color-secondary":this.color==="secondary","wcm-color-tertiary":this.color==="tertiary","wcm-color-inverse":this.color==="inverse","wcm-color-accnt":this.color==="accent","wcm-color-error":this.color==="error"};return he`<span><slot class="${Wn(r)}"></slot></span>`}};la.styles=[tt.globalCss,wO],sf([Be()],la.prototype,"variant",2),sf([Be()],la.prototype,"color",2),la=sf([st("wcm-text")],la);const EO=ct`button{width:100%;height:100%;border-radius:var(--wcm-button-hover-highlight-border-radius);display:flex;align-items:flex-start}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}button>div{width:80px;padding:5px 0;display:flex;flex-direction:column;align-items:center}wcm-text{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:center}wcm-wallet-image{height:60px;width:60px;transition:all .2s ease;border-radius:var(--wcm-wallet-icon-border-radius);margin-bottom:5px}.wcm-sublabel{margin-top:2px}`;var xO=Object.defineProperty,IO=Object.getOwnPropertyDescriptor,_i=(r,e,t,n)=>{for(var i=n>1?void 0:n?IO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&xO(e,t,i),i};let $n=class extends Ye{constructor(){super(...arguments),this.onClick=()=>null,this.name="",this.walletId="",this.label=void 0,this.imageId=void 0,this.installed=!1,this.recent=!1}sublabelTemplate(){return this.recent?he`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">RECENT</wcm-text>`:this.installed?he`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">INSTALLED</wcm-text>`:null}handleClick(){b1.click({name:"WALLET_BUTTON",walletId:this.walletId}),this.onClick()}render(){var r;return he`<button @click="${this.handleClick.bind(this)}"><div><wcm-wallet-image walletId="${this.walletId}" imageId="${Er(this.imageId)}"></wcm-wallet-image><wcm-text variant="xsmall-regular">${(r=this.label)!=null?r:Pe.getWalletName(this.name,!0)}</wcm-text>${this.sublabelTemplate()}</div></button>`}};$n.styles=[tt.globalCss,EO],_i([Be()],$n.prototype,"onClick",2),_i([Be()],$n.prototype,"name",2),_i([Be()],$n.prototype,"walletId",2),_i([Be()],$n.prototype,"label",2),_i([Be()],$n.prototype,"imageId",2),_i([Be({type:Boolean})],$n.prototype,"installed",2),_i([Be({type:Boolean})],$n.prototype,"recent",2),$n=_i([st("wcm-wallet-button")],$n);const DO=ct`:host{display:block}div{overflow:hidden;position:relative;border-radius:inherit;width:100%;height:100%;background-color:var(--wcm-color-overlay)}svg{position:relative;width:100%;height:100%}div::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;border-radius:inherit;border:1px solid var(--wcm-color-overlay)}div img{width:100%;height:100%;object-fit:cover;object-position:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var SO=Object.defineProperty,OO=Object.getOwnPropertyDescriptor,Tc=(r,e,t,n)=>{for(var i=n>1?void 0:n?OO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&SO(e,t,i),i};let Vs=class extends Ye{constructor(){super(...arguments),this.walletId="",this.imageId=void 0,this.imageUrl=void 0}render(){var r;const e=(r=this.imageUrl)!=null&&r.length?this.imageUrl:Pe.getWalletIcon({id:this.walletId,image_id:this.imageId});return he`${e.length?he`<div><img crossorigin="anonymous" src="${e}" alt="${this.id}"></div>`:ut.WALLET_PLACEHOLDER}`}};Vs.styles=[tt.globalCss,DO],Tc([Be()],Vs.prototype,"walletId",2),Tc([Be()],Vs.prototype,"imageId",2),Tc([Be()],Vs.prototype,"imageUrl",2),Vs=Tc([st("wcm-wallet-image")],Vs);var CO=Object.defineProperty,$O=Object.getOwnPropertyDescriptor,jm=(r,e,t,n)=>{for(var i=n>1?void 0:n?$O(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&CO(e,t,i),i};let of=class extends Ye{constructor(){super(),this.preload=!0,this.preloadData()}async loadImages(r){try{r!=null&&r.length&&await Promise.all(r.map(async e=>Pe.preloadImage(e)))}catch{console.info("Unsuccessful attempt at preloading some images",r)}}async preloadListings(){if(Kr.state.enableExplorer){await Tr.getRecomendedWallets(),zt.setIsDataLoaded(!0);const{recomendedWallets:r}=Tr.state,e=r.map(t=>Pe.getWalletIcon(t));await this.loadImages(e)}else zt.setIsDataLoaded(!0)}async preloadCustomImages(){const r=Pe.getCustomImageUrls();await this.loadImages(r)}async preloadData(){try{this.preload&&(this.preload=!1,await Promise.all([this.preloadListings(),this.preloadCustomImages()]))}catch(r){console.error(r),gi.openToast("Failed preloading","error")}}};jm([Rr()],of.prototype,"preload",2),of=jm([st("wcm-explorer-context")],of);var AO=Object.defineProperty,PO=Object.getOwnPropertyDescriptor,TO=(r,e,t,n)=>{for(var i=n>1?void 0:n?PO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&AO(e,t,i),i};let Fm=class extends Ye{constructor(){super(),this.unsubscribeTheme=void 0,tt.setTheme(),this.unsubscribeTheme=pi.subscribe(tt.setTheme)}disconnectedCallback(){var r;(r=this.unsubscribeTheme)==null||r.call(this)}};Fm=TO([st("wcm-theme-context")],Fm);const RO=ct`@keyframes scroll{0%{transform:translate3d(0,0,0)}100%{transform:translate3d(calc(-70px * 9),0,0)}}.wcm-slider{position:relative;overflow-x:hidden;padding:10px 0;margin:0 -20px;width:calc(100% + 40px)}.wcm-track{display:flex;width:calc(70px * 18);animation:scroll 20s linear infinite;opacity:.7}.wcm-track svg{margin:0 5px}wcm-wallet-image{width:60px;height:60px;margin:0 5px;border-radius:var(--wcm-wallet-icon-border-radius)}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-title{display:flex;align-items:center;margin-bottom:10px}.wcm-title svg{margin-right:6px}.wcm-title path{fill:var(--wcm-accent-color)}wcm-modal-footer .wcm-title{padding:0 10px}wcm-button-big{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%);filter:drop-shadow(0 0 17px var(--wcm-color-bg-1))}wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-info-footer wcm-text{text-align:center;margin-bottom:15px}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var NO=Object.defineProperty,LO=Object.getOwnPropertyDescriptor,MO=(r,e,t,n)=>{for(var i=n>1?void 0:n?LO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&NO(e,t,i),i};let af=class extends Ye{onGoToQrcode(){Pt.push("Qrcode")}render(){const{recomendedWallets:r}=Tr.state,e=[...r,...r],t=we.RECOMMENDED_WALLET_AMOUNT*2;return he`<wcm-modal-header title="Connect your wallet" .onAction="${this.onGoToQrcode}" .actionIcon="${ut.QRCODE_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-title">${ut.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">WalletConnect</wcm-text></div><div class="wcm-slider"><div class="wcm-track">${[...Array(t)].map((n,i)=>{const a=e[i%e.length];return a?he`<wcm-wallet-image walletId="${a.id}" imageId="${a.image_id}"></wcm-wallet-image>`:ut.WALLET_PLACEHOLDER})}</div><wcm-button-big @click="${Pe.handleAndroidLinking}"><wcm-text variant="medium-regular" color="inverse">Select Wallet</wcm-text></wcm-button-big></div></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">Choose WalletConnect to see supported apps on your device</wcm-text></wcm-info-footer>`}};af.styles=[tt.globalCss,RO],af=MO([st("wcm-android-wallet-selection")],af);const UO=ct`@keyframes loading{to{stroke-dashoffset:0}}@keyframes shake{10%,90%{transform:translate3d(-1px,0,0)}20%,80%{transform:translate3d(1px,0,0)}30%,50%,70%{transform:translate3d(-2px,0,0)}40%,60%{transform:translate3d(2px,0,0)}}:host{display:flex;flex-direction:column;align-items:center}div{position:relative;width:110px;height:110px;display:flex;justify-content:center;align-items:center;margin:40px 0 20px 0;transform:translate3d(0,0,0)}svg{position:absolute;width:110px;height:110px;fill:none;stroke:transparent;stroke-linecap:round;stroke-width:2px;top:0;left:0}use{stroke:var(--wcm-accent-color);animation:loading 1s linear infinite}wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:90px;height:90px}wcm-text{margin-bottom:40px}.wcm-error svg{stroke:var(--wcm-error-color)}.wcm-error use{display:none}.wcm-error{animation:shake .4s cubic-bezier(.36,.07,.19,.97) both}.wcm-stale svg,.wcm-stale use{display:none}`;var jO=Object.defineProperty,FO=Object.getOwnPropertyDescriptor,Gs=(r,e,t,n)=>{for(var i=n>1?void 0:n?FO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&jO(e,t,i),i};let Ei=class extends Ye{constructor(){super(...arguments),this.walletId=void 0,this.imageId=void 0,this.isError=!1,this.isStale=!1,this.label=""}svgLoaderTemplate(){var r,e;const t=(e=(r=pi.state.themeVariables)==null?void 0:r["--wcm-wallet-icon-large-border-radius"])!=null?e:tt.getPreset("--wcm-wallet-icon-large-border-radius");let n=0;t.includes("%")?n=88/100*parseInt(t,10):n=parseInt(t,10),n*=1.17;const i=317-n*1.57,a=425-n*1.8;return he`<svg viewBox="0 0 110 110" width="110" height="110"><rect id="wcm-loader" x="2" y="2" width="106" height="106" rx="${n}"/><use xlink:href="#wcm-loader" stroke-dasharray="106 ${i}" stroke-dashoffset="${a}"></use></svg>`}render(){const r={"wcm-error":this.isError,"wcm-stale":this.isStale};return he`<div class="${Wn(r)}">${this.svgLoaderTemplate()}<wcm-wallet-image walletId="${Er(this.walletId)}" imageId="${Er(this.imageId)}"></wcm-wallet-image></div><wcm-text variant="medium-regular" color="${this.isError?"error":"primary"}">${this.isError?"Connection declined":this.label}</wcm-text>`}};Ei.styles=[tt.globalCss,UO],Gs([Be()],Ei.prototype,"walletId",2),Gs([Be()],Ei.prototype,"imageId",2),Gs([Be({type:Boolean})],Ei.prototype,"isError",2),Gs([Be({type:Boolean})],Ei.prototype,"isStale",2),Gs([Be()],Ei.prototype,"label",2),Ei=Gs([st("wcm-connector-waiting")],Ei);const Ys={manualWallets(){var r,e;const{mobileWallets:t,desktopWallets:n}=Kr.state,i=(r=Ys.recentWallet())==null?void 0:r.id,a=we.isMobile()?t:n,c=a?.filter(u=>i!==u.id);return(e=we.isMobile()?c?.map(({id:u,name:f,links:h})=>({id:u,name:f,mobile:h,links:h})):c?.map(({id:u,name:f,links:h})=>({id:u,name:f,desktop:h,links:h})))!=null?e:[]},recentWallet(){return Pe.getRecentWallet()},recomendedWallets(r=!1){var e;const t=r||(e=Ys.recentWallet())==null?void 0:e.id,{recomendedWallets:n}=Tr.state;return n.filter(i=>t!==i.id)}},xi={onConnecting(r){Pe.goToConnectingView(r)},manualWalletsTemplate(){return Ys.manualWallets().map(r=>he`<wcm-wallet-button walletId="${r.id}" name="${r.name}" .onClick="${()=>this.onConnecting(r)}"></wcm-wallet-button>`)},recomendedWalletsTemplate(r=!1){return Ys.recomendedWallets(r).map(e=>he`<wcm-wallet-button name="${e.name}" walletId="${e.id}" imageId="${e.image_id}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`)},recentWalletTemplate(){const r=Ys.recentWallet();if(r)return he`<wcm-wallet-button name="${r.name}" walletId="${r.id}" imageId="${Er(r.image_id)}" .recent="${!0}" .onClick="${()=>this.onConnecting(r)}"></wcm-wallet-button>`}},BO=ct`.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-desktop-title,.wcm-mobile-title{display:flex;align-items:center}.wcm-mobile-title{justify-content:space-between;margin-bottom:20px;margin-top:-10px}.wcm-desktop-title{margin-bottom:10px;padding:0 10px}.wcm-subtitle{display:flex;align-items:center}.wcm-subtitle:last-child path{fill:var(--wcm-color-fg-3)}.wcm-desktop-title svg,.wcm-mobile-title svg{margin-right:6px}.wcm-desktop-title path,.wcm-mobile-title path{fill:var(--wcm-accent-color)}`;var kO=Object.defineProperty,zO=Object.getOwnPropertyDescriptor,qO=(r,e,t,n)=>{for(var i=n>1?void 0:n?zO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&kO(e,t,i),i};let cf=class extends Ye{render(){const{explorerExcludedWalletIds:r,enableExplorer:e}=Kr.state,t=r!=="ALL"&&e,n=xi.manualWalletsTemplate(),i=xi.recomendedWalletsTemplate();let a=[xi.recentWalletTemplate(),...n,...i];a=a.filter(Boolean);const c=a.length>4||t;let u=[];c?u=a.slice(0,3):u=a;const f=!!u.length;return he`<wcm-modal-header .border="${!0}" title="Connect your wallet" .onAction="${Pe.handleUriCopy}" .actionIcon="${ut.COPY_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-mobile-title"><div class="wcm-subtitle">${ut.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">Mobile</wcm-text></div><div class="wcm-subtitle">${ut.SCAN_ICON}<wcm-text variant="small-regular" color="secondary">Scan with your wallet</wcm-text></div></div><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>${f?he`<wcm-modal-footer><div class="wcm-desktop-title">${ut.DESKTOP_ICON}<wcm-text variant="small-regular" color="accent">Desktop</wcm-text></div><div class="wcm-grid">${u} ${c?he`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-footer>`:null}`}};cf.styles=[tt.globalCss,BO],cf=qO([st("wcm-desktop-wallet-selection")],cf);const HO=ct`div{background-color:var(--wcm-color-bg-2);padding:10px 20px 15px 20px;border-top:1px solid var(--wcm-color-bg-3);text-align:center}a{color:var(--wcm-accent-color);text-decoration:none;transition:opacity .2s ease-in-out;display:inline}a:active{opacity:.8}@media(hover:hover){a:hover{opacity:.8}}`;var WO=Object.defineProperty,KO=Object.getOwnPropertyDescriptor,VO=(r,e,t,n)=>{for(var i=n>1?void 0:n?KO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&WO(e,t,i),i};let lf=class extends Ye{render(){const{termsOfServiceUrl:r,privacyPolicyUrl:e}=Kr.state;return r??e?he`<div><wcm-text variant="small-regular" color="secondary">By connecting your wallet to this app, you agree to the app's ${r?he`<a href="${r}" target="_blank" rel="noopener noreferrer">Terms of Service</a>`:null} ${r&&e?"and":null} ${e?he`<a href="${e}" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`:null}</wcm-text></div>`:null}};lf.styles=[tt.globalCss,HO],lf=VO([st("wcm-legal-notice")],lf);const GO=ct`div{display:grid;grid-template-columns:repeat(4,80px);margin:0 -10px;justify-content:space-between;row-gap:10px}`;var YO=Object.defineProperty,ZO=Object.getOwnPropertyDescriptor,JO=(r,e,t,n)=>{for(var i=n>1?void 0:n?ZO(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&YO(e,t,i),i};let uf=class extends Ye{onQrcode(){Pt.push("Qrcode")}render(){const{explorerExcludedWalletIds:r,enableExplorer:e}=Kr.state,t=r!=="ALL"&&e,n=xi.manualWalletsTemplate(),i=xi.recomendedWalletsTemplate();let a=[xi.recentWalletTemplate(),...n,...i];a=a.filter(Boolean);const c=a.length>8||t;let u=[];c?u=a.slice(0,7):u=a;const f=!!u.length;return he`<wcm-modal-header title="Connect your wallet" .onAction="${this.onQrcode}" .actionIcon="${ut.QRCODE_ICON}"></wcm-modal-header>${f?he`<wcm-modal-content><div>${u} ${c?he`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-content>`:null}`}};uf.styles=[tt.globalCss,GO],uf=JO([st("wcm-mobile-wallet-selection")],uf);const QO=ct`:host{all:initial}.wcm-overlay{top:0;bottom:0;left:0;right:0;position:fixed;z-index:var(--wcm-z-index);overflow:hidden;display:flex;justify-content:center;align-items:center;opacity:0;pointer-events:none;background-color:var(--wcm-overlay-background-color);backdrop-filter:var(--wcm-overlay-backdrop-filter)}@media(max-height:720px) and (orientation:landscape){.wcm-overlay{overflow:scroll;align-items:flex-start;padding:20px 0}}.wcm-active{pointer-events:auto}.wcm-container{position:relative;max-width:360px;width:100%;outline:0;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) var(--wcm-container-border-radius) var(--wcm-container-border-radius);border:1px solid var(--wcm-color-overlay);overflow:hidden}.wcm-card{width:100%;position:relative;border-radius:var(--wcm-container-border-radius);overflow:hidden;box-shadow:0 6px 14px -6px rgba(10,16,31,.12),0 10px 32px -4px rgba(10,16,31,.1),0 0 0 1px var(--wcm-color-overlay);background-color:var(--wcm-color-bg-1);color:var(--wcm-color-fg-1)}@media(max-width:600px){.wcm-container{max-width:440px;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) 0 0}.wcm-card{border-radius:var(--wcm-container-border-radius) var(--wcm-container-border-radius) 0 0}.wcm-overlay{align-items:flex-end}}@media(max-width:440px){.wcm-container{border:0}}`;var XO=Object.defineProperty,eC=Object.getOwnPropertyDescriptor,hf=(r,e,t,n)=>{for(var i=n>1?void 0:n?eC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&XO(e,t,i),i};let Zs=class extends Ye{constructor(){super(),this.open=!1,this.active=!1,this.unsubscribeModal=void 0,this.abortController=void 0,this.unsubscribeModal=Zi.subscribe(r=>{r.open?this.onOpenModalEvent():this.onCloseModalEvent()})}disconnectedCallback(){var r;(r=this.unsubscribeModal)==null||r.call(this)}get overlayEl(){return Pe.getShadowRootElement(this,".wcm-overlay")}get containerEl(){return Pe.getShadowRootElement(this,".wcm-container")}toggleBodyScroll(r){document.querySelector("body")&&(r?document.getElementById("wcm-styles")?.remove():document.head.insertAdjacentHTML("beforeend",'<style id="wcm-styles">html,body{touch-action:none;overflow:hidden;overscroll-behavior:contain;}</style>'))}onCloseModal(r){r.target===r.currentTarget&&Zi.close()}onOpenModalEvent(){this.toggleBodyScroll(!1),this.addKeyboardEvents(),this.open=!0,setTimeout(async()=>{const r=Pe.isMobileAnimation()?{y:["50vh","0vh"]}:{scale:[.98,1]},e=.1,t=.2;await Promise.all([ns(this.overlayEl,{opacity:[0,1]},{delay:e,duration:t}).finished,ns(this.containerEl,r,{delay:e,duration:t}).finished]),this.active=!0},0)}async onCloseModalEvent(){this.toggleBodyScroll(!0),this.removeKeyboardEvents();const r=Pe.isMobileAnimation()?{y:["0vh","50vh"]}:{scale:[1,.98]},e=.2;await Promise.all([ns(this.overlayEl,{opacity:[1,0]},{duration:e}).finished,ns(this.containerEl,r,{duration:e}).finished]),this.containerEl.removeAttribute("style"),this.active=!1,this.open=!1}addKeyboardEvents(){this.abortController=new AbortController,window.addEventListener("keydown",r=>{var e;r.key==="Escape"?Zi.close():r.key==="Tab"&&((e=r.target)!=null&&e.tagName.includes("wcm-")||this.containerEl.focus())},this.abortController),this.containerEl.focus()}removeKeyboardEvents(){var r;(r=this.abortController)==null||r.abort(),this.abortController=void 0}render(){const r={"wcm-overlay":!0,"wcm-active":this.active};return he`<wcm-explorer-context></wcm-explorer-context><wcm-theme-context></wcm-theme-context><div id="wcm-modal" class="${Wn(r)}" @click="${this.onCloseModal}" role="alertdialog" aria-modal="true"><div class="wcm-container" tabindex="0">${this.open?he`<wcm-modal-backcard></wcm-modal-backcard><div class="wcm-card"><wcm-modal-router></wcm-modal-router><wcm-modal-toast></wcm-modal-toast></div>`:null}</div></div>`}};Zs.styles=[tt.globalCss,QO],hf([Rr()],Zs.prototype,"open",2),hf([Rr()],Zs.prototype,"active",2),Zs=hf([st("wcm-modal")],Zs);const tC=ct`div{display:flex;margin-top:15px}slot{display:inline-block;margin:0 5px}wcm-button{margin:0 5px}`;var rC=Object.defineProperty,nC=Object.getOwnPropertyDescriptor,ua=(r,e,t,n)=>{for(var i=n>1?void 0:n?nC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&rC(e,t,i),i};let ss=class extends Ye{constructor(){super(...arguments),this.isMobile=!1,this.isDesktop=!1,this.isWeb=!1,this.isRetry=!1}onMobile(){we.isMobile()?Pt.replace("MobileConnecting"):Pt.replace("MobileQrcodeConnecting")}onDesktop(){Pt.replace("DesktopConnecting")}onWeb(){Pt.replace("WebConnecting")}render(){return he`<div>${this.isRetry?he`<slot></slot>`:null} ${this.isMobile?he`<wcm-button .onClick="${this.onMobile}" .iconLeft="${ut.MOBILE_ICON}" variant="outline">Mobile</wcm-button>`:null} ${this.isDesktop?he`<wcm-button .onClick="${this.onDesktop}" .iconLeft="${ut.DESKTOP_ICON}" variant="outline">Desktop</wcm-button>`:null} ${this.isWeb?he`<wcm-button .onClick="${this.onWeb}" .iconLeft="${ut.GLOBE_ICON}" variant="outline">Web</wcm-button>`:null}</div>`}};ss.styles=[tt.globalCss,tC],ua([Be({type:Boolean})],ss.prototype,"isMobile",2),ua([Be({type:Boolean})],ss.prototype,"isDesktop",2),ua([Be({type:Boolean})],ss.prototype,"isWeb",2),ua([Be({type:Boolean})],ss.prototype,"isRetry",2),ss=ua([st("wcm-platform-selection")],ss);const iC=ct`button{display:flex;flex-direction:column;padding:5px 10px;border-radius:var(--wcm-button-hover-highlight-border-radius);height:100%;justify-content:flex-start}.wcm-icons{width:60px;height:60px;display:flex;flex-wrap:wrap;padding:7px;border-radius:var(--wcm-wallet-icon-border-radius);justify-content:space-between;align-items:center;margin-bottom:5px;background-color:var(--wcm-color-bg-2);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}.wcm-icons img{width:21px;height:21px;object-fit:cover;object-position:center;border-radius:calc(var(--wcm-wallet-icon-border-radius)/ 2);border:1px solid var(--wcm-color-overlay)}.wcm-icons svg{width:21px;height:21px}.wcm-icons img:nth-child(1),.wcm-icons img:nth-child(2),.wcm-icons svg:nth-child(1),.wcm-icons svg:nth-child(2){margin-bottom:4px}wcm-text{width:100%;text-align:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var sC=Object.defineProperty,oC=Object.getOwnPropertyDescriptor,aC=(r,e,t,n)=>{for(var i=n>1?void 0:n?oC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&sC(e,t,i),i};let ff=class extends Ye{onClick(){Pt.push("WalletExplorer")}render(){const{recomendedWallets:r}=Tr.state,e=Ys.manualWallets(),t=[...r,...e].reverse().slice(0,4);return he`<button @click="${this.onClick}"><div class="wcm-icons">${t.map(n=>{const i=Pe.getWalletIcon(n);if(i)return he`<img crossorigin="anonymous" src="${i}">`;const a=Pe.getWalletIcon({id:n.id});return a?he`<img crossorigin="anonymous" src="${a}">`:ut.WALLET_PLACEHOLDER})} ${[...Array(4-t.length)].map(()=>ut.WALLET_PLACEHOLDER)}</div><wcm-text variant="xsmall-regular">View All</wcm-text></button>`}};ff.styles=[tt.globalCss,iC],ff=aC([st("wcm-view-all-wallets-button")],ff);const cC=ct`.wcm-qr-container{width:100%;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1}`;var lC=Object.defineProperty,uC=Object.getOwnPropertyDescriptor,Rc=(r,e,t,n)=>{for(var i=n>1?void 0:n?uC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&lC(e,t,i),i};let Js=class extends Ye{constructor(){super(),this.walletId="",this.imageId="",this.uri="",setTimeout(()=>{const{walletConnectUri:r}=zt.state;this.uri=r},0)}get overlayEl(){return Pe.getShadowRootElement(this,".wcm-qr-container")}render(){return he`<div class="wcm-qr-container">${this.uri?he`<wcm-qrcode size="${this.overlayEl.offsetWidth}" uri="${this.uri}" walletId="${Er(this.walletId)}" imageId="${Er(this.imageId)}"></wcm-qrcode>`:he`<wcm-spinner></wcm-spinner>`}</div>`}};Js.styles=[tt.globalCss,cC],Rc([Be()],Js.prototype,"walletId",2),Rc([Be()],Js.prototype,"imageId",2),Rc([Rr()],Js.prototype,"uri",2),Js=Rc([st("wcm-walletconnect-qr")],Js);var hC=Object.defineProperty,fC=Object.getOwnPropertyDescriptor,dC=(r,e,t,n)=>{for(var i=n>1?void 0:n?fC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&hC(e,t,i),i};let df=class extends Ye{viewTemplate(){return we.isAndroid()?he`<wcm-android-wallet-selection></wcm-android-wallet-selection>`:we.isMobile()?he`<wcm-mobile-wallet-selection></wcm-mobile-wallet-selection>`:he`<wcm-desktop-wallet-selection></wcm-desktop-wallet-selection>`}render(){return he`${this.viewTemplate()}<wcm-legal-notice></wcm-legal-notice>`}};df.styles=[tt.globalCss],df=dC([st("wcm-connect-wallet-view")],df);const pC=ct`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var gC=Object.defineProperty,mC=Object.getOwnPropertyDescriptor,Bm=(r,e,t,n)=>{for(var i=n>1?void 0:n?mC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&gC(e,t,i),i};let Nc=class extends Ye{constructor(){super(),this.isError=!1,this.openDesktopApp()}onFormatAndRedirect(r){const{desktop:e,name:t}=we.getWalletRouterData(),n=e?.native;if(n){const i=we.formatNativeUrl(n,r,t);we.openHref(i,"_self")}}openDesktopApp(){const{walletConnectUri:r}=zt.state,e=we.getWalletRouterData();Pe.setRecentWallet(e),r&&this.onFormatAndRedirect(r)}render(){const{name:r,id:e,image_id:t}=we.getWalletRouterData(),{isMobile:n,isWeb:i}=Pe.getCachedRouterWalletPlatforms();return he`<wcm-modal-header title="${r}" .onAction="${Pe.handleUriCopy}" .actionIcon="${ut.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Er(t)}" label="${`Continue in ${r}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Connection can continue loading if ${r} is not installed on your device`}</wcm-text><wcm-platform-selection .isMobile="${n}" .isWeb="${i}" .isRetry="${!0}"><wcm-button .onClick="${this.openDesktopApp.bind(this)}" .iconRight="${ut.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Nc.styles=[tt.globalCss,pC],Bm([Rr()],Nc.prototype,"isError",2),Nc=Bm([st("wcm-desktop-connecting-view")],Nc);const vC=ct`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}wcm-button{margin-top:15px}`;var yC=Object.defineProperty,wC=Object.getOwnPropertyDescriptor,bC=(r,e,t,n)=>{for(var i=n>1?void 0:n?wC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&yC(e,t,i),i};let pf=class extends Ye{onInstall(r){r&&we.openHref(r,"_blank")}render(){const{name:r,id:e,image_id:t,homepage:n}=we.getWalletRouterData();return he`<wcm-modal-header title="${r}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Er(t)}" label="Not Detected" .isStale="${!0}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Download ${r} to continue. If multiple browser extensions are installed, disable non ${r} ones and try again`}</wcm-text><wcm-button .onClick="${()=>this.onInstall(n)}" .iconLeft="${ut.ARROW_DOWN_ICON}">Download</wcm-button></wcm-info-footer>`}};pf.styles=[tt.globalCss,vC],pf=bC([st("wcm-install-wallet-view")],pf);const _C=ct`wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:96px;height:96px;margin-bottom:20px}wcm-info-footer{display:flex;width:100%}.wcm-app-store{justify-content:space-between}.wcm-app-store wcm-wallet-image{margin-right:10px;margin-bottom:0;width:28px;height:28px;border-radius:var(--wcm-wallet-icon-small-border-radius)}.wcm-app-store div{display:flex;align-items:center}.wcm-app-store wcm-button{margin-right:-10px}.wcm-note{flex-direction:column;align-items:center;padding:5px 0}.wcm-note wcm-text{text-align:center}wcm-platform-selection{margin-top:-15px}.wcm-note wcm-text{margin-top:15px}.wcm-note wcm-text span{color:var(--wcm-accent-color)}`;var EC=Object.defineProperty,xC=Object.getOwnPropertyDescriptor,km=(r,e,t,n)=>{for(var i=n>1?void 0:n?xC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&EC(e,t,i),i};let Lc=class extends Ye{constructor(){super(),this.isError=!1,this.openMobileApp()}onFormatAndRedirect(r,e=!1){const{mobile:t,name:n}=we.getWalletRouterData(),i=t?.native,a=t?.universal;if(i&&!e){const c=we.formatNativeUrl(i,r,n);we.openHref(c,"_self")}else if(a){const c=we.formatUniversalUrl(a,r,n);we.openHref(c,"_self")}}openMobileApp(r=!1){const{walletConnectUri:e}=zt.state,t=we.getWalletRouterData();Pe.setRecentWallet(t),e&&this.onFormatAndRedirect(e,r)}onGoToAppStore(r){r&&we.openHref(r,"_blank")}render(){const{name:r,id:e,image_id:t,app:n,mobile:i}=we.getWalletRouterData(),{isWeb:a}=Pe.getCachedRouterWalletPlatforms(),c=n?.ios,u=i?.universal;return he`<wcm-modal-header title="${r}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Er(t)}" label="Tap 'Open' to continue…" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer class="wcm-note"><wcm-platform-selection .isWeb="${a}" .isRetry="${!0}"><wcm-button .onClick="${()=>this.openMobileApp(!1)}" .iconRight="${ut.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection>${u?he`<wcm-text color="secondary" variant="small-thin">Still doesn't work? <span tabindex="0" @click="${()=>this.openMobileApp(!0)}">Try this alternate link</span></wcm-text>`:null}</wcm-info-footer><wcm-info-footer class="wcm-app-store"><div><wcm-wallet-image walletId="${e}" imageId="${Er(t)}"></wcm-wallet-image><wcm-text>${`Get ${r}`}</wcm-text></div><wcm-button .iconRight="${ut.ARROW_RIGHT_ICON}" .onClick="${()=>this.onGoToAppStore(c)}" variant="ghost">App Store</wcm-button></wcm-info-footer>`}};Lc.styles=[tt.globalCss,_C],km([Rr()],Lc.prototype,"isError",2),Lc=km([st("wcm-mobile-connecting-view")],Lc);const IC=ct`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var DC=Object.defineProperty,SC=Object.getOwnPropertyDescriptor,OC=(r,e,t,n)=>{for(var i=n>1?void 0:n?SC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&DC(e,t,i),i};let gf=class extends Ye{render(){const{name:r,id:e,image_id:t}=we.getWalletRouterData(),{isDesktop:n,isWeb:i}=Pe.getCachedRouterWalletPlatforms();return he`<wcm-modal-header title="${r}" .onAction="${Pe.handleUriCopy}" .actionIcon="${ut.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr walletId="${e}" imageId="${Er(t)}"></wcm-walletconnect-qr></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Scan this QR Code with your phone's camera or inside ${r} app`}</wcm-text><wcm-platform-selection .isDesktop="${n}" .isWeb="${i}"></wcm-platform-selection></wcm-info-footer>`}};gf.styles=[tt.globalCss,IC],gf=OC([st("wcm-mobile-qr-connecting-view")],gf);var CC=Object.defineProperty,$C=Object.getOwnPropertyDescriptor,AC=(r,e,t,n)=>{for(var i=n>1?void 0:n?$C(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&CC(e,t,i),i};let mf=class extends Ye{render(){return he`<wcm-modal-header title="Scan the code" .onAction="${Pe.handleUriCopy}" .actionIcon="${ut.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>`}};mf.styles=[tt.globalCss],mf=AC([st("wcm-qrcode-view")],mf);const PC=ct`wcm-modal-content{height:clamp(200px,60vh,600px);display:block;overflow:scroll;scrollbar-width:none;position:relative;margin-top:1px}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between;margin:-15px -10px;padding-top:20px}wcm-modal-content::after,wcm-modal-content::before{content:'';position:fixed;pointer-events:none;z-index:1;width:100%;height:20px;opacity:1}wcm-modal-content::before{box-shadow:0 -1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(var(--wcm-color-bg-1),rgba(255,255,255,0))}wcm-modal-content::after{box-shadow:0 1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(rgba(255,255,255,0),var(--wcm-color-bg-1));top:calc(100% - 20px)}wcm-modal-content::-webkit-scrollbar{display:none}.wcm-placeholder-block{display:flex;justify-content:center;align-items:center;height:100px;overflow:hidden}.wcm-empty,.wcm-loading{display:flex}.wcm-loading .wcm-placeholder-block{height:100%}.wcm-end-reached .wcm-placeholder-block{height:0;opacity:0}.wcm-empty .wcm-placeholder-block{opacity:1;height:100%}wcm-wallet-button{margin:calc((100% - 60px)/ 3) 0}`;var TC=Object.defineProperty,RC=Object.getOwnPropertyDescriptor,ha=(r,e,t,n)=>{for(var i=n>1?void 0:n?RC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&TC(e,t,i),i};const vf=40;let os=class extends Ye{constructor(){super(...arguments),this.loading=!Tr.state.wallets.listings.length,this.firstFetch=!Tr.state.wallets.listings.length,this.search="",this.endReached=!1,this.intersectionObserver=void 0,this.searchDebounce=Pe.debounce(r=>{r.length>=1?(this.firstFetch=!0,this.endReached=!1,this.search=r,Tr.resetSearch(),this.fetchWallets()):this.search&&(this.search="",this.endReached=this.isLastPage(),Tr.resetSearch())})}firstUpdated(){this.createPaginationObserver()}disconnectedCallback(){var r;(r=this.intersectionObserver)==null||r.disconnect()}get placeholderEl(){return Pe.getShadowRootElement(this,".wcm-placeholder-block")}createPaginationObserver(){this.intersectionObserver=new IntersectionObserver(([r])=>{r.isIntersecting&&!(this.search&&this.firstFetch)&&this.fetchWallets()}),this.intersectionObserver.observe(this.placeholderEl)}isLastPage(){const{wallets:r,search:e}=Tr.state,{listings:t,total:n}=this.search?e:r;return n<=vf||t.length>=n}async fetchWallets(){var r;const{wallets:e,search:t}=Tr.state,{listings:n,total:i,page:a}=this.search?t:e;if(!this.endReached&&(this.firstFetch||i>vf&&n.length<i))try{this.loading=!0;const c=(r=zt.state.chains)==null?void 0:r.join(","),{listings:u}=await Tr.getWallets({page:this.firstFetch?1:a+1,entries:vf,search:this.search,version:2,chains:c}),f=u.map(h=>Pe.getWalletIcon(h));await Promise.all([...f.map(async h=>Pe.preloadImage(h)),we.wait(300)]),this.endReached=this.isLastPage()}catch(c){console.error(c),gi.openToast(Pe.getErrorMessage(c),"error")}finally{this.loading=!1,this.firstFetch=!1}}onConnect(r){we.isAndroid()?Pe.handleMobileLinking(r):Pe.goToConnectingView(r)}onSearchChange(r){const{value:e}=r.target;this.searchDebounce(e)}render(){const{wallets:r,search:e}=Tr.state,{listings:t}=this.search?e:r,n=this.loading&&!t.length,i=this.search.length>=3;let a=xi.manualWalletsTemplate(),c=xi.recomendedWalletsTemplate(!0);i&&(a=a.filter(({values:h})=>Pe.caseSafeIncludes(h[0],this.search)),c=c.filter(({values:h})=>Pe.caseSafeIncludes(h[0],this.search)));const u=!this.loading&&!t.length&&!c.length,f={"wcm-loading":n,"wcm-end-reached":this.endReached||!this.loading,"wcm-empty":u};return he`<wcm-modal-header><wcm-search-input .onChange="${this.onSearchChange.bind(this)}"></wcm-search-input></wcm-modal-header><wcm-modal-content class="${Wn(f)}"><div class="wcm-grid">${n?null:a} ${n?null:c} ${n?null:t.map(h=>he`${h?he`<wcm-wallet-button imageId="${h.image_id}" name="${h.name}" walletId="${h.id}" .onClick="${()=>this.onConnect(h)}"></wcm-wallet-button>`:null}`)}</div><div class="wcm-placeholder-block">${u?he`<wcm-text variant="big-bold" color="secondary">No results found</wcm-text>`:null} ${!u&&this.loading?he`<wcm-spinner></wcm-spinner>`:null}</div></wcm-modal-content>`}};os.styles=[tt.globalCss,PC],ha([Rr()],os.prototype,"loading",2),ha([Rr()],os.prototype,"firstFetch",2),ha([Rr()],os.prototype,"search",2),ha([Rr()],os.prototype,"endReached",2),os=ha([st("wcm-wallet-explorer-view")],os);const NC=ct`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var LC=Object.defineProperty,MC=Object.getOwnPropertyDescriptor,zm=(r,e,t,n)=>{for(var i=n>1?void 0:n?MC(e,t):e,a=r.length-1,c;a>=0;a--)(c=r[a])&&(i=(n?c(e,t,i):c(i))||i);return n&&i&&LC(e,t,i),i};let Mc=class extends Ye{constructor(){super(),this.isError=!1,this.openWebWallet()}onFormatAndRedirect(r){const{desktop:e,name:t}=we.getWalletRouterData(),n=e?.universal;if(n){const i=we.formatUniversalUrl(n,r,t);we.openHref(i,"_blank")}}openWebWallet(){const{walletConnectUri:r}=zt.state,e=we.getWalletRouterData();Pe.setRecentWallet(e),r&&this.onFormatAndRedirect(r)}render(){const{name:r,id:e,image_id:t}=we.getWalletRouterData(),{isMobile:n,isDesktop:i}=Pe.getCachedRouterWalletPlatforms(),a=we.isMobile();return he`<wcm-modal-header title="${r}" .onAction="${Pe.handleUriCopy}" .actionIcon="${ut.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${Er(t)}" label="${`Continue in ${r}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`${r} web app has opened in a new tab. Go there, accept the connection, and come back`}</wcm-text><wcm-platform-selection .isMobile="${n}" .isDesktop="${a?!1:i}" .isRetry="${!0}"><wcm-button .onClick="${this.openWebWallet.bind(this)}" .iconRight="${ut.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Mc.styles=[tt.globalCss,NC],zm([Rr()],Mc.prototype,"isError",2),Mc=zm([st("wcm-web-connecting-view")],Mc);var UC=Object.freeze({__proto__:null,get WcmModal(){return Zs},get WcmQrCode(){return Vn}});en.EthereumProvider=aI,en.OPTIONAL_EVENTS=p1,en.OPTIONAL_METHODS=d1,en.REQUIRED_EVENTS=cc,en.REQUIRED_METHODS=ac,en.default=uc,Object.defineProperty(en,"__esModule",{value:!0})});
|
|
139
139
|
//# sourceMappingURL=index.umd.js.map
|