@hashgraphonline/hashinal-wc 1.0.65 → 1.0.67
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/es/hashinal-wc.es.js +12 -1
- package/dist/es/hashinal-wc.es.js.map +1 -1
- package/dist/es/index.d.ts +69 -0
- package/dist/es/logger/logger.d.ts +14 -0
- package/dist/es/types.d.ts +179 -0
- package/dist/es/utils/retry.d.ts +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/types.d.ts +180 -0
- package/dist/umd/hashinal-wc.umd.js +2 -2
- package/dist/umd/hashinal-wc.umd.js.map +1 -1
- package/dist/umd/index.d.ts +69 -0
- package/dist/umd/logger/logger.d.ts +14 -0
- package/dist/umd/types.d.ts +179 -0
- package/dist/umd/utils/retry.d.ts +1 -0
- package/package.json +2 -2
|
@@ -107,7 +107,7 @@ function utilFromBase(e,t){let r=0;if(1===e.length)return e[0];for(let n=e.lengt
|
|
|
107
107
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
108
108
|
* @copyright Chen, Yi-Cyuan 2015-2018
|
|
109
109
|
* @license MIT
|
|
110
|
-
*/!function(e){!function(){var t="input is invalid type",r="object"==typeof window,n=r?window:{};n.JS_SHA3_NO_WINDOW&&(r=!1);var o=!r&&"object"==typeof self;!n.JS_SHA3_NO_NODE_JS&&"object"==typeof process$1&&process$1.versions&&process$1.versions.node?n=On:o&&(n=self);var i=!n.JS_SHA3_NO_COMMON_JS&&e.exports,s=!n.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",a="0123456789abcdef".split(""),c=[4,1024,262144,67108864],u=[0,8,16,24],l=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],d=[224,256,384,512],h=[128,256],f=["hex","buffer","arrayBuffer","array","digest"],p={128:168,256:136};(n.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),s&&(n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var m=function(e,t,r){return function(n){return new R(e,t,e).update(n)[r]()}},y=function(e,t,r){return function(n,o){return new R(e,t,o).update(n)[r]()}},g=function(e,t,r){return function(t,n,o,i){return A["cshake"+e].update(t,n,o,i)[r]()}},b=function(e,t,r){return function(t,n,o,i){return A["kmac"+e].update(t,n,o,i)[r]()}},w=function(e,t,r,n){for(var o=0;o<f.length;++o){var i=f[o];e[i]=t(r,n,i)}return e},v=function(e,t){var r=m(e,t,"hex");return r.create=function(){return new R(e,t,e)},r.update=function(e){return r.create().update(e)},w(r,m,e,t)},_=[{name:"keccak",padding:[1,256,65536,16777216],bits:d,createMethod:v},{name:"sha3",padding:[6,1536,393216,100663296],bits:d,createMethod:v},{name:"shake",padding:[31,7936,2031616,520093696],bits:h,createMethod:function(e,t){var r=y(e,t,"hex");return r.create=function(r){return new R(e,t,r)},r.update=function(e,t){return r.create(t).update(e)},w(r,y,e,t)}},{name:"cshake",padding:c,bits:h,createMethod:function(e,t){var r=p[e],n=g(e,0,"hex");return n.create=function(n,o,i){return o||i?new R(e,t,n).bytepad([o,i],r):A["shake"+e].create(n)},n.update=function(e,t,r,o){return n.create(t,r,o).update(e)},w(n,g,e,t)}},{name:"kmac",padding:c,bits:h,createMethod:function(e,t){var r=p[e],n=b(e,0,"hex");return n.create=function(n,o,i){return new O(e,t,o).bytepad(["KMAC",i],r).bytepad([n],r)},n.update=function(e,t,r,o){return n.create(e,r,o).update(t)},w(n,b,e,t)}}],A={},I=[],T=0;T<_.length;++T)for(var k=_[T],S=k.bits,E=0;E<S.length;++E){var $=k.name+"_"+S[E];if(I.push($),A[$]=k.createMethod(S[E],k.padding),"sha3"!==k.name){var C=k.name+S[E];I.push(C),A[C]=A[$]}}function R(e,t,r){this.blocks=[],this.s=[],this.padding=t,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function O(e,t,r){R.call(this,e,t,r)}R.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var r,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(t);if(null===e)throw new Error(t);if(s&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||s&&ArrayBuffer.isView(e)))throw new Error(t);r=!0}for(var o,i,a=this.blocks,c=this.byteCount,l=e.length,d=this.blockCount,h=0,f=this.s;h<l;){if(this.reset)for(this.reset=!1,a[0]=this.block,o=1;o<d+1;++o)a[o]=0;if(r)for(o=this.start;h<l&&o<c;++h)a[o>>2]|=e[h]<<u[3&o++];else for(o=this.start;h<l&&o<c;++h)(i=e.charCodeAt(h))<128?a[o>>2]|=i<<u[3&o++]:i<2048?(a[o>>2]|=(192|i>>6)<<u[3&o++],a[o>>2]|=(128|63&i)<<u[3&o++]):i<55296||i>=57344?(a[o>>2]|=(224|i>>12)<<u[3&o++],a[o>>2]|=(128|i>>6&63)<<u[3&o++],a[o>>2]|=(128|63&i)<<u[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++h)),a[o>>2]|=(240|i>>18)<<u[3&o++],a[o>>2]|=(128|i>>12&63)<<u[3&o++],a[o>>2]|=(128|i>>6&63)<<u[3&o++],a[o>>2]|=(128|63&i)<<u[3&o++]);if(this.lastByteIndex=o,o>=c){for(this.start=o-c,this.block=a[d],o=0;o<d;++o)f[o]^=a[o];N(f),this.reset=!0}else this.start=o}return this},R.prototype.encode=function(e,t){var r=255&e,n=1,o=[r];for(r=255&(e>>=8);r>0;)o.unshift(r),r=255&(e>>=8),++n;return t?o.push(n):o.unshift(n),this.update(o),o.length},R.prototype.encodeString=function(e){var r,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(t);if(null===e)throw new Error(t);if(s&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||s&&ArrayBuffer.isView(e)))throw new Error(t);r=!0}var o=0,i=e.length;if(r)o=i;else for(var a=0;a<e.length;++a){var c=e.charCodeAt(a);c<128?o+=1:c<2048?o+=2:c<55296||c>=57344?o+=3:(c=65536+((1023&c)<<10|1023&e.charCodeAt(++a)),o+=4)}return o+=this.encode(8*o),this.update(e),o},R.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n<e.length;++n)r+=this.encodeString(e[n]);var o=t-r%t,i=[];return i.length=o,this.update(i),this},R.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,r=this.blockCount,n=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t<r+1;++t)e[t]=0;for(e[r-1]|=2147483648,t=0;t<r;++t)n[t]^=e[t];N(n)}},R.prototype.toString=R.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,r=this.s,n=this.outputBlocks,o=this.extraBytes,i=0,s=0,c="";s<n;){for(i=0;i<t&&s<n;++i,++s)e=r[i],c+=a[e>>4&15]+a[15&e]+a[e>>12&15]+a[e>>8&15]+a[e>>20&15]+a[e>>16&15]+a[e>>28&15]+a[e>>24&15];s%t==0&&(N(r),i=0)}return o&&(e=r[i],c+=a[e>>4&15]+a[15&e],o>1&&(c+=a[e>>12&15]+a[e>>8&15]),o>2&&(c+=a[e>>20&15]+a[e>>16&15])),c},R.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,o=this.extraBytes,i=0,s=0,a=this.outputBits>>3;e=o?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var c=new Uint32Array(e);s<n;){for(i=0;i<t&&s<n;++i,++s)c[s]=r[i];s%t==0&&N(r)}return o&&(c[i]=r[i],e=e.slice(0,a)),e},R.prototype.buffer=R.prototype.arrayBuffer,R.prototype.digest=R.prototype.array=function(){this.finalize();for(var e,t,r=this.blockCount,n=this.s,o=this.outputBlocks,i=this.extraBytes,s=0,a=0,c=[];a<o;){for(s=0;s<r&&a<o;++s,++a)e=a<<2,t=n[s],c[e]=255&t,c[e+1]=t>>8&255,c[e+2]=t>>16&255,c[e+3]=t>>24&255;a%r==0&&N(n)}return i&&(e=a<<2,t=n[s],c[e]=255&t,i>1&&(c[e+1]=t>>8&255),i>2&&(c[e+2]=t>>16&255)),c},O.prototype=new R,O.prototype.finalize=function(){return this.encode(this.outputBits,!0),R.prototype.finalize.call(this)};var N=function(e){var t,r,n,o,i,s,a,c,u,d,h,f,p,m,y,g,b,w,v,_,A,I,T,k,S,E,$,C,R,O,N,M,B,D,P,x,L,U,j,F,q,K,G,H,V,z,Q,W,Y,Z,J,X,ee,te,re,ne,oe,ie,se,ae,ce,ue,le;for(n=0;n<48;n+=2)o=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],d=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(f=e[8]^e[18]^e[28]^e[38]^e[48])^(s<<1|a>>>31),r=(p=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|s>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=o^(c<<1|u>>>31),r=i^(u<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=s^(d<<1|h>>>31),r=a^(h<<1|d>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(f<<1|p>>>31),r=u^(p<<1|f>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=d^(o<<1|i>>>31),r=h^(i<<1|o>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,m=e[0],y=e[1],z=e[11]<<4|e[10]>>>28,Q=e[10]<<4|e[11]>>>28,C=e[20]<<3|e[21]>>>29,R=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,K=e[40]<<18|e[41]>>>14,G=e[41]<<18|e[40]>>>14,D=e[2]<<1|e[3]>>>31,P=e[3]<<1|e[2]>>>31,g=e[13]<<12|e[12]>>>20,b=e[12]<<12|e[13]>>>20,W=e[22]<<10|e[23]>>>22,Y=e[23]<<10|e[22]>>>22,O=e[33]<<13|e[32]>>>19,N=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,le=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,x=e[14]<<6|e[15]>>>26,L=e[15]<<6|e[14]>>>26,w=e[25]<<11|e[24]>>>21,v=e[24]<<11|e[25]>>>21,Z=e[34]<<15|e[35]>>>17,J=e[35]<<15|e[34]>>>17,M=e[45]<<29|e[44]>>>3,B=e[44]<<29|e[45]>>>3,k=e[6]<<28|e[7]>>>4,S=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,oe=e[16]<<23|e[17]>>>9,U=e[26]<<25|e[27]>>>7,j=e[27]<<25|e[26]>>>7,_=e[36]<<21|e[37]>>>11,A=e[37]<<21|e[36]>>>11,X=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,H=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,E=e[18]<<20|e[19]>>>12,$=e[19]<<20|e[18]>>>12,ie=e[29]<<7|e[28]>>>25,se=e[28]<<7|e[29]>>>25,F=e[38]<<8|e[39]>>>24,q=e[39]<<8|e[38]>>>24,I=e[48]<<14|e[49]>>>18,T=e[49]<<14|e[48]>>>18,e[0]=m^~g&w,e[1]=y^~b&v,e[10]=k^~E&C,e[11]=S^~$&R,e[20]=D^~x&U,e[21]=P^~L&j,e[30]=H^~z&W,e[31]=V^~Q&Y,e[40]=te^~ne&ie,e[41]=re^~oe&se,e[2]=g^~w&_,e[3]=b^~v&A,e[12]=E^~C&O,e[13]=$^~R&N,e[22]=x^~U&F,e[23]=L^~j&q,e[32]=z^~W&Z,e[33]=Q^~Y&J,e[42]=ne^~ie&ae,e[43]=oe^~se&ce,e[4]=w^~_&I,e[5]=v^~A&T,e[14]=C^~O&M,e[15]=R^~N&B,e[24]=U^~F&K,e[25]=j^~q&G,e[34]=W^~Z&X,e[35]=Y^~J&ee,e[44]=ie^~ae&ue,e[45]=se^~ce&le,e[6]=_^~I&m,e[7]=A^~T&y,e[16]=O^~M&k,e[17]=N^~B&S,e[26]=F^~K&D,e[27]=q^~G&P,e[36]=Z^~X&H,e[37]=J^~ee&V,e[46]=ae^~ue&te,e[47]=ce^~le&re,e[8]=I^~m&g,e[9]=T^~y&b,e[18]=M^~k&E,e[19]=B^~S&$,e[28]=K^~D&x,e[29]=G^~P&L,e[38]=X^~H&z,e[39]=ee^~V&Q,e[48]=ue^~te&ne,e[49]=le^~re&oe,e[0]^=l[n],e[1]^=l[n+1]};if(i)e.exports=A;else for(T=0;T<I.length;++T)n[I[T]]=A[I[T]]}()}(Pn);var b0=Pn.exports;const y0="logger/5.7.0";let Dn=!1,Fn=!1;const Cr={debug:1,default:2,info:2,warning:3,error:4,off:5};let Tn=Cr.default,gi=null;function w0(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch{e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e2){return e2.message}return null}const Un=w0();var Ai,re$2;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(Ai||(Ai={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(re$2||(re$2={}));const kn="0123456789abcdef";let L$6=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==Cr[r]&&this.throwArgumentError("invalid log level name","logLevel",e),!(Tn>Cr[r])&&console.log.apply(console,t)}debug(...t){this._log(e.levels.DEBUG,t)}info(...t){this._log(e.levels.INFO,t)}warn(...t){this._log(e.levels.WARNING,t)}makeError(t,r,n){if(Fn)return this.makeError("censored error",r,{});r||(r=e.errors.UNKNOWN_ERROR),n||(n={});const o=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=kn[t[e]>>4],r+=kn[15&t[e]];o.push(e+"=Uint8Array(0x"+r+")")}else o.push(e+"="+JSON.stringify(t))}catch{o.push(e+"="+JSON.stringify(n[e].toString()))}})),o.push(`code=${r}`),o.push(`version=${this.version}`);const i=t;let s="";switch(r){case re$2.NUMERIC_FAULT:{s="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":s+="-"+e;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case re$2.CALL_EXCEPTION:case re$2.INSUFFICIENT_FUNDS:case re$2.MISSING_NEW:case re$2.NONCE_EXPIRED:case re$2.REPLACEMENT_UNDERPRICED:case re$2.TRANSACTION_REPLACED:case re$2.UNPREDICTABLE_GAS_LIMIT:s=r}s&&(t+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),o.length&&(t+=" ("+o.join(", ")+")");const a=new Error(t);return a.reason=i,a.code=r,Object.keys(n).forEach((function(e){a[e]=n[e]})),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(t,r,n){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(t){Un&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Un})}checkSafeUint53(t,r){"number"==typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,r,n){n=n?": "+n:"",t<r&&this.throwError("missing argument"+n,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}checkNew(t,r){(t===Object||null==t)&&this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}checkAbstract(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):(t===Object||null==t)&&this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return gi||(gi=new e(y0)),gi}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Dn){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Fn=!!t,Dn=!!r}static setLogLevel(t){const r=Cr[t.toLowerCase()];null!=r?Tn=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};L$6.errors=re$2,L$6.levels=Ai;const x0="bytes/5.7.0",Dt$1=new L$6(x0);function qn(e){return!!e.toHexString}function rr$1(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return rr$1(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function M0(e){return Qt$1(e)&&!(e.length%2)||ir$1(e)}function Kn(e){return"number"==typeof e&&e==e&&e%1==0}function ir$1(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e||!Kn(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!Kn(r)||r<0||r>=256)return!1}return!0}function Ot$1(e,t){if(t||(t={}),"number"==typeof e){Dt$1.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),rr$1(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),qn(e)&&(e=e.toHexString()),Qt$1(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":Dt$1.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;e<r.length;e+=2)n.push(parseInt(r.substring(e,e+2),16));return rr$1(new Uint8Array(n))}return ir$1(e)?rr$1(new Uint8Array(e)):Dt$1.throwArgumentError("invalid arrayify value","value",e)}function E0(e){const t=e.map((e=>Ot$1(e))),r=t.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(r);return t.reduce(((e,t)=>(n.set(t,e),e+t.length)),0),rr$1(n)}function S0(e,t){(e=Ot$1(e)).length>t&&Dt$1.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),rr$1(r)}function Qt$1(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/)||t&&e.length!==2+2*t)}const bi="0123456789abcdef";function Kt$1(e,t){if(t||(t={}),"number"==typeof e){Dt$1.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=bi[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),qn(e))return e.toHexString();if(Qt$1(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":Dt$1.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(ir$1(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+=bi[(240&n)>>4]+bi[15&n]}return t}return Dt$1.throwArgumentError("invalid hexlify value","value",e)}function N0(e){if("string"!=typeof e)e=Kt$1(e);else if(!Qt$1(e)||e.length%2)return null;return(e.length-2)/2}function Hn(e,t,r){return"string"!=typeof e?e=Kt$1(e):(!Qt$1(e)||e.length%2)&&Dt$1.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function oe$3(e,t){for("string"!=typeof e?e=Kt$1(e):Qt$1(e)||Dt$1.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&Dt$1.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function zn(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(M0(e)){let r=Ot$1(e);64===r.length?(t.v=27+(r[32]>>7),r[32]&=127,t.r=Kt$1(r.slice(0,32)),t.s=Kt$1(r.slice(32,64))):65===r.length?(t.r=Kt$1(r.slice(0,32)),t.s=Kt$1(r.slice(32,64)),t.v=r[64]):Dt$1.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:Dt$1.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=Kt$1(r.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){const r=S0(Ot$1(t._vs),32);t._vs=Kt$1(r);const n=r[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=n:t.recoveryParam!==n&&Dt$1.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),r[0]&=127;const o=Kt$1(r);null==t.s?t.s=o:t.s!==o&&Dt$1.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?Dt$1.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{const r=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==r&&Dt$1.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&Qt$1(t.r)?t.r=oe$3(t.r,32):Dt$1.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&Qt$1(t.s)?t.s=oe$3(t.s,32):Dt$1.throwArgumentError("signature missing or invalid s","signature",e);const r=Ot$1(t.s);r[0]>=128&&Dt$1.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const n=Kt$1(r);t._vs&&(Qt$1(t._vs)||Dt$1.throwArgumentError("signature invalid _vs","signature",e),t._vs=oe$3(t._vs,32)),null==t._vs?t._vs=n:t._vs!==n&&Dt$1.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function yi(e){return"0x"+b0.keccak_256(Ot$1(e))}var Ln={exports:{}},I0={},_0=Object.freeze({__proto__:null,default:I0}),B0=A0(_0);!function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&(("le"===t||"be"===t)&&(r=t,t=10),this._init(e||0,t||10,r||"be"))}var i;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{i=typeof window<"u"&&typeof window.Buffer<"u"?window.Buffer:B0.Buffer}catch{}function s(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function a(e,t,r){var n=s(e,r);return r-1>=t&&(n|=s(e,r-1)<<4),n}function c(e,t,n,o){for(var i=0,s=0,a=Math.min(e.length,n),c=t;c<a;c++){var u=e.charCodeAt(c)-48;i*=o,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<o,"Invalid character"),i+=s}return i}function u(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var o=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(o++,this.negative=1),o<e.length&&(16===t?this._parseHex(e,o,n):(this._parseBase(e,t,o),"le"===n&&this._initArray(this.toArray(),t,n)))},o.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var i,s,a=0;if("be"===n)for(o=e.length-1,i=0;o>=0;o-=3)s=e[o]|e[o-1]<<8|e[o-2]<<16,this.words[i]|=s<<a&67108863,this.words[i+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,i++);else if("le"===n)for(o=0,i=0;o<e.length;o+=3)s=e[o]|e[o+1]<<8|e[o+2]<<16,this.words[i]|=s<<a&67108863,this.words[i+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,i++);return this._strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,i=0,s=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)o=a(e,t,n)<<i,this.words[s]|=67108863&o,i>=18?(i-=18,s+=1,this.words[s]|=o>>>26):i+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)o=a(e,t,n)<<i,this.words[s]|=67108863&o,i>=18?(i-=18,s+=1,this.words[s]|=o>>>26):i+=8;this._strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,o=1;o<=67108863;o*=t)n++;n--,o=o/t|0;for(var i=e.length-r,s=i%n,a=Math.min(i,i-s)+r,u=0,l=r;l<a;l+=n)u=c(e,l,l+n,t),this.imuln(o),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var d=1;for(u=c(e,l,e.length,t),l=0;l<s;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype._move=function(e){u(e,this)},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},typeof Symbol<"u"&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch{o.prototype.inspect=l}else o.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var o=0,i=0,s=0;s<this.length;s++){var a=this.words[s],c=(16777215&(a<<o|i)).toString(16);i=a>>>24-o&16777215,(o+=2)>=26&&(o-=26,s--),n=0!==i||s!==this.length-1?d[6-c.length]+c+n:c+n}for(0!==i&&(n=i.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=h[e],l=f[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(e);n=(p=p.idivn(l)).isZero()?m+n:d[u-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},i&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(i,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function p(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var o=0|e.words[0],i=0|t.words[0],s=o*i,a=67108863&s,c=s/67108864|0;r.words[0]=a;for(var u=1;u<n;u++){for(var l=c>>>26,d=67108863&c,h=Math.min(u,t.length-1),f=Math.max(0,u-e.length+1);f<=h;f++){var p=u-f|0;l+=(s=(o=0|e.words[p])*(i=0|t.words[f])+d)/67108864|0,d=67108863&s}r.words[u]=0|d,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r._strip()}o.prototype.toArrayLike=function(e,t,n){this._strip();var o=this.byteLength(),i=n||Math.max(1,o);r(o<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0");var s=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,i);return this["_toArrayLike"+("le"===t?"LE":"BE")](s,o),s},o.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,o=0,i=0;o<this.length;o++){var s=this.words[o]<<i|n;e[r++]=255&s,r<e.length&&(e[r++]=s>>8&255),r<e.length&&(e[r++]=s>>16&255),6===i?(r<e.length&&(e[r++]=s>>24&255),n=0,i=0):(n=s>>>24,i+=2)}if(r<e.length)for(e[r++]=n;r<e.length;)e[r++]=0},o.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,n=0,o=0,i=0;o<this.length;o++){var s=this.words[o]<<i|n;e[r--]=255&s,r>=0&&(e[r--]=s>>8&255),r>=0&&(e[r--]=s>>16&255),6===i?(r>=0&&(e[r--]=s>>24&255),n=0,i=0):(n=s>>>24,i+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},o.prototype.ior=function(e){return r(!(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},o.prototype.iand=function(e){return r(!(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this._strip()},o.prototype.ixor=function(e){return r(!(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var o=0;o<t;o++)this.words[o]=67108863&~this.words[o];return n>0&&(this.words[o]=~this.words[o]&67108863>>26-n),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,o=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<o:this.words[n]&~(1<<o),this._strip()},o.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var o=0,i=0;i<n.length;i++)t=(0|r.words[i])+(0|n.words[i])+o,this.words[i]=67108863&t,o=t>>>26;for(;0!==o&&i<r.length;i++)t=(0|r.words[i])+o,this.words[i]=67108863&t,o=t>>>26;if(this.length=r.length,0!==o)this.words[this.length]=o,this.length++;else if(r!==this)for(;i<r.length;i++)this.words[i]=r.words[i];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,o=this.cmp(e);if(0===o)return this.negative=0,this.length=1,this.words[0]=0,this;o>0?(r=this,n=e):(r=e,n=this);for(var i=0,s=0;s<n.length;s++)i=(t=(0|r.words[s])-(0|n.words[s])+i)>>26,this.words[s]=67108863&t;for(;0!==i&&s<r.length;s++)i=(t=(0|r.words[s])+i)>>26,this.words[s]=67108863&t;if(0===i&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var m=function(e,t,r){var n,o,i,s=e.words,a=t.words,c=r.words,u=0,l=0|s[0],d=8191&l,h=l>>>13,f=0|s[1],p=8191&f,m=f>>>13,y=0|s[2],g=8191&y,b=y>>>13,w=0|s[3],v=8191&w,_=w>>>13,A=0|s[4],I=8191&A,T=A>>>13,k=0|s[5],S=8191&k,E=k>>>13,$=0|s[6],C=8191&$,R=$>>>13,O=0|s[7],N=8191&O,M=O>>>13,B=0|s[8],D=8191&B,P=B>>>13,x=0|s[9],L=8191&x,U=x>>>13,j=0|a[0],F=8191&j,q=j>>>13,K=0|a[1],G=8191&K,H=K>>>13,V=0|a[2],z=8191&V,Q=V>>>13,W=0|a[3],Y=8191&W,Z=W>>>13,J=0|a[4],X=8191&J,ee=J>>>13,te=0|a[5],re=8191&te,ne=te>>>13,oe=0|a[6],ie=8191&oe,se=oe>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],de=8191&le,he=le>>>13,fe=0|a[9],pe=8191&fe,me=fe>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(u+(n=Math.imul(d,F))|0)+((8191&(o=(o=Math.imul(d,q))+Math.imul(h,F)|0))<<13)|0;u=((i=Math.imul(h,q))+(o>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(p,F),o=(o=Math.imul(p,q))+Math.imul(m,F)|0,i=Math.imul(m,q);var ge=(u+(n=n+Math.imul(d,G)|0)|0)+((8191&(o=(o=o+Math.imul(d,H)|0)+Math.imul(h,G)|0))<<13)|0;u=((i=i+Math.imul(h,H)|0)+(o>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(g,F),o=(o=Math.imul(g,q))+Math.imul(b,F)|0,i=Math.imul(b,q),n=n+Math.imul(p,G)|0,o=(o=o+Math.imul(p,H)|0)+Math.imul(m,G)|0,i=i+Math.imul(m,H)|0;var be=(u+(n=n+Math.imul(d,z)|0)|0)+((8191&(o=(o=o+Math.imul(d,Q)|0)+Math.imul(h,z)|0))<<13)|0;u=((i=i+Math.imul(h,Q)|0)+(o>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(v,F),o=(o=Math.imul(v,q))+Math.imul(_,F)|0,i=Math.imul(_,q),n=n+Math.imul(g,G)|0,o=(o=o+Math.imul(g,H)|0)+Math.imul(b,G)|0,i=i+Math.imul(b,H)|0,n=n+Math.imul(p,z)|0,o=(o=o+Math.imul(p,Q)|0)+Math.imul(m,z)|0,i=i+Math.imul(m,Q)|0;var we=(u+(n=n+Math.imul(d,Y)|0)|0)+((8191&(o=(o=o+Math.imul(d,Z)|0)+Math.imul(h,Y)|0))<<13)|0;u=((i=i+Math.imul(h,Z)|0)+(o>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(I,F),o=(o=Math.imul(I,q))+Math.imul(T,F)|0,i=Math.imul(T,q),n=n+Math.imul(v,G)|0,o=(o=o+Math.imul(v,H)|0)+Math.imul(_,G)|0,i=i+Math.imul(_,H)|0,n=n+Math.imul(g,z)|0,o=(o=o+Math.imul(g,Q)|0)+Math.imul(b,z)|0,i=i+Math.imul(b,Q)|0,n=n+Math.imul(p,Y)|0,o=(o=o+Math.imul(p,Z)|0)+Math.imul(m,Y)|0,i=i+Math.imul(m,Z)|0;var ve=(u+(n=n+Math.imul(d,X)|0)|0)+((8191&(o=(o=o+Math.imul(d,ee)|0)+Math.imul(h,X)|0))<<13)|0;u=((i=i+Math.imul(h,ee)|0)+(o>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(S,F),o=(o=Math.imul(S,q))+Math.imul(E,F)|0,i=Math.imul(E,q),n=n+Math.imul(I,G)|0,o=(o=o+Math.imul(I,H)|0)+Math.imul(T,G)|0,i=i+Math.imul(T,H)|0,n=n+Math.imul(v,z)|0,o=(o=o+Math.imul(v,Q)|0)+Math.imul(_,z)|0,i=i+Math.imul(_,Q)|0,n=n+Math.imul(g,Y)|0,o=(o=o+Math.imul(g,Z)|0)+Math.imul(b,Y)|0,i=i+Math.imul(b,Z)|0,n=n+Math.imul(p,X)|0,o=(o=o+Math.imul(p,ee)|0)+Math.imul(m,X)|0,i=i+Math.imul(m,ee)|0;var _e=(u+(n=n+Math.imul(d,re)|0)|0)+((8191&(o=(o=o+Math.imul(d,ne)|0)+Math.imul(h,re)|0))<<13)|0;u=((i=i+Math.imul(h,ne)|0)+(o>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(C,F),o=(o=Math.imul(C,q))+Math.imul(R,F)|0,i=Math.imul(R,q),n=n+Math.imul(S,G)|0,o=(o=o+Math.imul(S,H)|0)+Math.imul(E,G)|0,i=i+Math.imul(E,H)|0,n=n+Math.imul(I,z)|0,o=(o=o+Math.imul(I,Q)|0)+Math.imul(T,z)|0,i=i+Math.imul(T,Q)|0,n=n+Math.imul(v,Y)|0,o=(o=o+Math.imul(v,Z)|0)+Math.imul(_,Y)|0,i=i+Math.imul(_,Z)|0,n=n+Math.imul(g,X)|0,o=(o=o+Math.imul(g,ee)|0)+Math.imul(b,X)|0,i=i+Math.imul(b,ee)|0,n=n+Math.imul(p,re)|0,o=(o=o+Math.imul(p,ne)|0)+Math.imul(m,re)|0,i=i+Math.imul(m,ne)|0;var Ae=(u+(n=n+Math.imul(d,ie)|0)|0)+((8191&(o=(o=o+Math.imul(d,se)|0)+Math.imul(h,ie)|0))<<13)|0;u=((i=i+Math.imul(h,se)|0)+(o>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(N,F),o=(o=Math.imul(N,q))+Math.imul(M,F)|0,i=Math.imul(M,q),n=n+Math.imul(C,G)|0,o=(o=o+Math.imul(C,H)|0)+Math.imul(R,G)|0,i=i+Math.imul(R,H)|0,n=n+Math.imul(S,z)|0,o=(o=o+Math.imul(S,Q)|0)+Math.imul(E,z)|0,i=i+Math.imul(E,Q)|0,n=n+Math.imul(I,Y)|0,o=(o=o+Math.imul(I,Z)|0)+Math.imul(T,Y)|0,i=i+Math.imul(T,Z)|0,n=n+Math.imul(v,X)|0,o=(o=o+Math.imul(v,ee)|0)+Math.imul(_,X)|0,i=i+Math.imul(_,ee)|0,n=n+Math.imul(g,re)|0,o=(o=o+Math.imul(g,ne)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,ne)|0,n=n+Math.imul(p,ie)|0,o=(o=o+Math.imul(p,se)|0)+Math.imul(m,ie)|0,i=i+Math.imul(m,se)|0;var Ie=(u+(n=n+Math.imul(d,ce)|0)|0)+((8191&(o=(o=o+Math.imul(d,ue)|0)+Math.imul(h,ce)|0))<<13)|0;u=((i=i+Math.imul(h,ue)|0)+(o>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(D,F),o=(o=Math.imul(D,q))+Math.imul(P,F)|0,i=Math.imul(P,q),n=n+Math.imul(N,G)|0,o=(o=o+Math.imul(N,H)|0)+Math.imul(M,G)|0,i=i+Math.imul(M,H)|0,n=n+Math.imul(C,z)|0,o=(o=o+Math.imul(C,Q)|0)+Math.imul(R,z)|0,i=i+Math.imul(R,Q)|0,n=n+Math.imul(S,Y)|0,o=(o=o+Math.imul(S,Z)|0)+Math.imul(E,Y)|0,i=i+Math.imul(E,Z)|0,n=n+Math.imul(I,X)|0,o=(o=o+Math.imul(I,ee)|0)+Math.imul(T,X)|0,i=i+Math.imul(T,ee)|0,n=n+Math.imul(v,re)|0,o=(o=o+Math.imul(v,ne)|0)+Math.imul(_,re)|0,i=i+Math.imul(_,ne)|0,n=n+Math.imul(g,ie)|0,o=(o=o+Math.imul(g,se)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,se)|0,n=n+Math.imul(p,ce)|0,o=(o=o+Math.imul(p,ue)|0)+Math.imul(m,ce)|0,i=i+Math.imul(m,ue)|0;var Te=(u+(n=n+Math.imul(d,de)|0)|0)+((8191&(o=(o=o+Math.imul(d,he)|0)+Math.imul(h,de)|0))<<13)|0;u=((i=i+Math.imul(h,he)|0)+(o>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(L,F),o=(o=Math.imul(L,q))+Math.imul(U,F)|0,i=Math.imul(U,q),n=n+Math.imul(D,G)|0,o=(o=o+Math.imul(D,H)|0)+Math.imul(P,G)|0,i=i+Math.imul(P,H)|0,n=n+Math.imul(N,z)|0,o=(o=o+Math.imul(N,Q)|0)+Math.imul(M,z)|0,i=i+Math.imul(M,Q)|0,n=n+Math.imul(C,Y)|0,o=(o=o+Math.imul(C,Z)|0)+Math.imul(R,Y)|0,i=i+Math.imul(R,Z)|0,n=n+Math.imul(S,X)|0,o=(o=o+Math.imul(S,ee)|0)+Math.imul(E,X)|0,i=i+Math.imul(E,ee)|0,n=n+Math.imul(I,re)|0,o=(o=o+Math.imul(I,ne)|0)+Math.imul(T,re)|0,i=i+Math.imul(T,ne)|0,n=n+Math.imul(v,ie)|0,o=(o=o+Math.imul(v,se)|0)+Math.imul(_,ie)|0,i=i+Math.imul(_,se)|0,n=n+Math.imul(g,ce)|0,o=(o=o+Math.imul(g,ue)|0)+Math.imul(b,ce)|0,i=i+Math.imul(b,ue)|0,n=n+Math.imul(p,de)|0,o=(o=o+Math.imul(p,he)|0)+Math.imul(m,de)|0,i=i+Math.imul(m,he)|0;var ke=(u+(n=n+Math.imul(d,pe)|0)|0)+((8191&(o=(o=o+Math.imul(d,me)|0)+Math.imul(h,pe)|0))<<13)|0;u=((i=i+Math.imul(h,me)|0)+(o>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(L,G),o=(o=Math.imul(L,H))+Math.imul(U,G)|0,i=Math.imul(U,H),n=n+Math.imul(D,z)|0,o=(o=o+Math.imul(D,Q)|0)+Math.imul(P,z)|0,i=i+Math.imul(P,Q)|0,n=n+Math.imul(N,Y)|0,o=(o=o+Math.imul(N,Z)|0)+Math.imul(M,Y)|0,i=i+Math.imul(M,Z)|0,n=n+Math.imul(C,X)|0,o=(o=o+Math.imul(C,ee)|0)+Math.imul(R,X)|0,i=i+Math.imul(R,ee)|0,n=n+Math.imul(S,re)|0,o=(o=o+Math.imul(S,ne)|0)+Math.imul(E,re)|0,i=i+Math.imul(E,ne)|0,n=n+Math.imul(I,ie)|0,o=(o=o+Math.imul(I,se)|0)+Math.imul(T,ie)|0,i=i+Math.imul(T,se)|0,n=n+Math.imul(v,ce)|0,o=(o=o+Math.imul(v,ue)|0)+Math.imul(_,ce)|0,i=i+Math.imul(_,ue)|0,n=n+Math.imul(g,de)|0,o=(o=o+Math.imul(g,he)|0)+Math.imul(b,de)|0,i=i+Math.imul(b,he)|0;var Se=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(o=(o=o+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;u=((i=i+Math.imul(m,me)|0)+(o>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(L,z),o=(o=Math.imul(L,Q))+Math.imul(U,z)|0,i=Math.imul(U,Q),n=n+Math.imul(D,Y)|0,o=(o=o+Math.imul(D,Z)|0)+Math.imul(P,Y)|0,i=i+Math.imul(P,Z)|0,n=n+Math.imul(N,X)|0,o=(o=o+Math.imul(N,ee)|0)+Math.imul(M,X)|0,i=i+Math.imul(M,ee)|0,n=n+Math.imul(C,re)|0,o=(o=o+Math.imul(C,ne)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,ne)|0,n=n+Math.imul(S,ie)|0,o=(o=o+Math.imul(S,se)|0)+Math.imul(E,ie)|0,i=i+Math.imul(E,se)|0,n=n+Math.imul(I,ce)|0,o=(o=o+Math.imul(I,ue)|0)+Math.imul(T,ce)|0,i=i+Math.imul(T,ue)|0,n=n+Math.imul(v,de)|0,o=(o=o+Math.imul(v,he)|0)+Math.imul(_,de)|0,i=i+Math.imul(_,he)|0;var Ee=(u+(n=n+Math.imul(g,pe)|0)|0)+((8191&(o=(o=o+Math.imul(g,me)|0)+Math.imul(b,pe)|0))<<13)|0;u=((i=i+Math.imul(b,me)|0)+(o>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(L,Y),o=(o=Math.imul(L,Z))+Math.imul(U,Y)|0,i=Math.imul(U,Z),n=n+Math.imul(D,X)|0,o=(o=o+Math.imul(D,ee)|0)+Math.imul(P,X)|0,i=i+Math.imul(P,ee)|0,n=n+Math.imul(N,re)|0,o=(o=o+Math.imul(N,ne)|0)+Math.imul(M,re)|0,i=i+Math.imul(M,ne)|0,n=n+Math.imul(C,ie)|0,o=(o=o+Math.imul(C,se)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,se)|0,n=n+Math.imul(S,ce)|0,o=(o=o+Math.imul(S,ue)|0)+Math.imul(E,ce)|0,i=i+Math.imul(E,ue)|0,n=n+Math.imul(I,de)|0,o=(o=o+Math.imul(I,he)|0)+Math.imul(T,de)|0,i=i+Math.imul(T,he)|0;var $e=(u+(n=n+Math.imul(v,pe)|0)|0)+((8191&(o=(o=o+Math.imul(v,me)|0)+Math.imul(_,pe)|0))<<13)|0;u=((i=i+Math.imul(_,me)|0)+(o>>>13)|0)+($e>>>26)|0,$e&=67108863,n=Math.imul(L,X),o=(o=Math.imul(L,ee))+Math.imul(U,X)|0,i=Math.imul(U,ee),n=n+Math.imul(D,re)|0,o=(o=o+Math.imul(D,ne)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,ne)|0,n=n+Math.imul(N,ie)|0,o=(o=o+Math.imul(N,se)|0)+Math.imul(M,ie)|0,i=i+Math.imul(M,se)|0,n=n+Math.imul(C,ce)|0,o=(o=o+Math.imul(C,ue)|0)+Math.imul(R,ce)|0,i=i+Math.imul(R,ue)|0,n=n+Math.imul(S,de)|0,o=(o=o+Math.imul(S,he)|0)+Math.imul(E,de)|0,i=i+Math.imul(E,he)|0;var Ce=(u+(n=n+Math.imul(I,pe)|0)|0)+((8191&(o=(o=o+Math.imul(I,me)|0)+Math.imul(T,pe)|0))<<13)|0;u=((i=i+Math.imul(T,me)|0)+(o>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(L,re),o=(o=Math.imul(L,ne))+Math.imul(U,re)|0,i=Math.imul(U,ne),n=n+Math.imul(D,ie)|0,o=(o=o+Math.imul(D,se)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,se)|0,n=n+Math.imul(N,ce)|0,o=(o=o+Math.imul(N,ue)|0)+Math.imul(M,ce)|0,i=i+Math.imul(M,ue)|0,n=n+Math.imul(C,de)|0,o=(o=o+Math.imul(C,he)|0)+Math.imul(R,de)|0,i=i+Math.imul(R,he)|0;var Re=(u+(n=n+Math.imul(S,pe)|0)|0)+((8191&(o=(o=o+Math.imul(S,me)|0)+Math.imul(E,pe)|0))<<13)|0;u=((i=i+Math.imul(E,me)|0)+(o>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(L,ie),o=(o=Math.imul(L,se))+Math.imul(U,ie)|0,i=Math.imul(U,se),n=n+Math.imul(D,ce)|0,o=(o=o+Math.imul(D,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,n=n+Math.imul(N,de)|0,o=(o=o+Math.imul(N,he)|0)+Math.imul(M,de)|0,i=i+Math.imul(M,he)|0;var Oe=(u+(n=n+Math.imul(C,pe)|0)|0)+((8191&(o=(o=o+Math.imul(C,me)|0)+Math.imul(R,pe)|0))<<13)|0;u=((i=i+Math.imul(R,me)|0)+(o>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(L,ce),o=(o=Math.imul(L,ue))+Math.imul(U,ce)|0,i=Math.imul(U,ue),n=n+Math.imul(D,de)|0,o=(o=o+Math.imul(D,he)|0)+Math.imul(P,de)|0,i=i+Math.imul(P,he)|0;var Ne=(u+(n=n+Math.imul(N,pe)|0)|0)+((8191&(o=(o=o+Math.imul(N,me)|0)+Math.imul(M,pe)|0))<<13)|0;u=((i=i+Math.imul(M,me)|0)+(o>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,n=Math.imul(L,de),o=(o=Math.imul(L,he))+Math.imul(U,de)|0,i=Math.imul(U,he);var Me=(u+(n=n+Math.imul(D,pe)|0)|0)+((8191&(o=(o=o+Math.imul(D,me)|0)+Math.imul(P,pe)|0))<<13)|0;u=((i=i+Math.imul(P,me)|0)+(o>>>13)|0)+(Me>>>26)|0,Me&=67108863;var Be=(u+(n=Math.imul(L,pe))|0)+((8191&(o=(o=Math.imul(L,me))+Math.imul(U,pe)|0))<<13)|0;return u=((i=Math.imul(U,me))+(o>>>13)|0)+(Be>>>26)|0,Be&=67108863,c[0]=ye,c[1]=ge,c[2]=be,c[3]=we,c[4]=ve,c[5]=_e,c[6]=Ae,c[7]=Ie,c[8]=Te,c[9]=ke,c[10]=Se,c[11]=Ee,c[12]=$e,c[13]=Ce,c[14]=Re,c[15]=Oe,c[16]=Ne,c[17]=Me,c[18]=Be,0!==u&&(c[19]=u,r.length++),r};function y(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,o=0,i=0;i<r.length-1;i++){var s=o;o=0;for(var a=67108863&n,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,d=(0|e.words[l])*(0|t.words[u]),h=67108863&d;a=67108863&(h=h+a|0),o+=(s=(s=s+(d/67108864|0)|0)+(h>>>26)|0)>>>26,s&=67108863}r.words[i]=a,n=s,s=o}return 0!==n?r.words[i]=n:r.length--,r._strip()}function g(e,t,r){return y(e,t,r)}Math.imul||(m=p),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):r<63?p(this,e,t):r<1024?y(this,e,t):g(this,e,t)},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),g(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){var t=e<0;t&&(e=-e),r("number"==typeof e),r(e<67108864);for(var n=0,o=0;o<this.length;o++){var i=(0|this.words[o])*e,s=(67108863&i)+(67108863&n);n>>=26,n+=i/67108864|0,n+=s>>>26,this.words[o]=67108863&s}return 0!==n&&(this.words[o]=n,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var n=r/26|0,o=r%26;t[r]=e.words[n]>>>o&1}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var i=r.sqr();n<t.length;n++,i=i.sqr())0!==t[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,o=(e-n)/26,i=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t<this.length;t++){var a=this.words[t]&i,c=(0|this.words[t])-a<<n;this.words[t]=c|s,s=a>>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==o){for(t=this.length-1;t>=0;t--)this.words[t+o]=this.words[t];for(t=0;t<o;t++)this.words[t]=0;this.length+=o}return this._strip()},o.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,n){var o;r("number"==typeof e&&e>=0),o=t?(t-t%26)/26:0;var i=e%26,s=Math.min((e-i)/26,this.length),a=67108863^67108863>>>i<<i,c=n;if(o-=s,o=Math.max(0,o),c){for(var u=0;u<s;u++)c.words[u]=this.words[u];c.length=s}if(0!==s)if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=o);u--){var d=0|this.words[u];this.words[u]=l<<26-i|d>>>i,l=d&a}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,o=1<<t;return!(this.length<=n)&&!!(this.words[n]&o)},o.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var o=67108863^67108863>>>t<<t;this.words[this.length-1]&=o}return this._strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,n){var o,i=e.length+n;this._expand(i);var s,a=0;for(o=0;o<e.length;o++){s=(0|this.words[o+n])+a;var c=(0|e.words[o])*t;a=((s-=67108863&c)>>26)-(c/67108864|0),this.words[o+n]=67108863&s}for(;o<this.length-n;o++)a=(s=(0|this.words[o+n])+a)>>26,this.words[o+n]=67108863&s;if(0===a)return this._strip();for(r(-1===a),a=0,o=0;o<this.length;o++)a=(s=-(0|this.words[o])+a)>>26,this.words[o]=67108863&s;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,c=n.length-i.length;if("mod"!==t){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=n.clone()._ishlnsubmul(i,1,c);0===l.negative&&(n=l,a&&(a.words[c]=1));for(var d=c-1;d>=0;d--){var h=67108864*(0|n.words[i.length+d])+(0|n.words[i.length+d-1]);for(h=Math.min(h/s|0,67108863),n._ishlnsubmul(i,h,d);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(i,1,d),n.isZero()||(n.negative^=1);a&&(a.words[d]=h)}return a&&a._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):this.negative&e.negative?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),o=e.andln(1),i=r.cmp(n);return i<0||1===o&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,o=0,i=this.length-1;i>=0;i--)o=(n*o+(0|this.words[i]))%e;return t?-o:o},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,o=this.length-1;o>=0;o--){var i=(0|this.words[o])+67108864*n;this.words[o]=i/e|0,n=i%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),c=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),d=t.clone();!t.isZero();){for(var h=0,f=1;!(t.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(d)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;!(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(l),c.isub(d)),a.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(a),s.isub(c)):(n.isub(t),a.isub(i),c.isub(s))}return{a:a,b:c,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t,n=this,i=e.clone();n=0!==n.negative?n.umod(e):n.clone();for(var s=new o(1),a=new o(0),c=i.clone();n.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;!(n.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(n.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var d=0,h=1;!(i.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(i.iushrn(d);d-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);n.cmp(i)>=0?(n.isub(i),s.isub(a)):(i.isub(n),a.isub(s))}return(t=0===n.cmpn(1)?s:a).cmpn(0)<0&&t.iadd(e),t},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var o=t.cmp(r);if(o<0){var i=t;t=r,r=i}else if(0===o||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return!(1&this.words[0])},o.prototype.isOdd=function(){return!(1&~this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,o=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=o,this;for(var i=o,s=n;0!==i&&s<this.length;s++){var a=0|this.words[s];i=(a+=i)>>>26,a&=67108863,this.words[s]=a}return 0!==i&&(this.words[s]=i,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var o=0|this.words[0];t=o===e?0:o<e?-1:1}return 0!==this.negative?0|-t:t},o.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],o=0|e.words[r];if(n!==o){n<o?t=-1:n>o&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new T(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var b={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function I(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function T(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function k(e){T.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},n(v,w),v.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),o=0;o<n;o++)t.words[o]=e.words[o];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&r,o=10;o<e.length;o++){var s=0|e.words[o];e.words[o-10]=(s&r)<<4|i>>>22,i=s}i>>>=22,e.words[o-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},v.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(_,w),n(A,w),n(I,w),I.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,o=67108863&n;n>>>=26,e.words[r]=o,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(b[e])return b[e];var t;if("k256"===e)t=new v;else if("p224"===e)t=new _;else if("p192"===e)t=new A;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new I}return b[e]=t,t},T.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},T.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},T.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},T.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},T.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},T.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},T.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},T.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},T.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},T.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},T.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},T.prototype.isqr=function(e){return this.imul(e,e.clone())},T.prototype.sqr=function(e){return this.mul(e,e)},T.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),h=this.pow(e,i.addn(1).iushrn(1)),f=this.pow(e,i),p=s;0!==f.cmp(a);){for(var m=f,y=0;0!==m.cmp(a);y++)m=m.redSqr();r(y<p);var g=this.pow(d,new o(1).iushln(p-y-1));h=h.redMul(g),d=g.redSqr(),f=f.redMul(d),p=y}return h},T.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},T.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var i=r[0],s=0,a=0,c=t.bitLength()%26;for(0===c&&(c=26),n=t.length-1;n>=0;n--){for(var u=t.words[n],l=c-1;l>=0;l--){var d=u>>l&1;(i!==r[0]&&(i=this.sqr(i)),0!==d||0!==s)?(s<<=1,s|=d,(4===++a||0===n&&0===l)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}c=26}return i},T.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},T.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new k(e)},n(k,T),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},k.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),i=o;return o.cmp(this.m)>=0?i=o.isub(this.m):o.cmpn(0)<0&&(i=o.iadd(this.m)),i._forceRed(this)},k.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,On)}(Ln);var K$3=Ln.exports;const jn="bignumber/5.7.0";var Rr=K$3.BN;const Ae$1=new L$6(jn),wi={},Qn=9007199254740991;function C0(e){return null!=e&&(V$3.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||Qt$1(e)||"bigint"==typeof e||ir$1(e))}let Jn=!1,V$3=class e{constructor(e,t){e!==wi&&Ae$1.throwError("cannot call constructor directly; use BigNumber.from",L$6.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Lt$1(j$4(this).fromTwos(e))}toTwos(e){return Lt$1(j$4(this).toTwos(e))}abs(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}add(e){return Lt$1(j$4(this).add(j$4(e)))}sub(e){return Lt$1(j$4(this).sub(j$4(e)))}div(t){return e.from(t).isZero()&&Wt$2("division-by-zero","div"),Lt$1(j$4(this).div(j$4(t)))}mul(e){return Lt$1(j$4(this).mul(j$4(e)))}mod(e){const t=j$4(e);return t.isNeg()&&Wt$2("division-by-zero","mod"),Lt$1(j$4(this).umod(t))}pow(e){const t=j$4(e);return t.isNeg()&&Wt$2("negative-power","pow"),Lt$1(j$4(this).pow(t))}and(e){const t=j$4(e);return(this.isNegative()||t.isNeg())&&Wt$2("unbound-bitwise-result","and"),Lt$1(j$4(this).and(t))}or(e){const t=j$4(e);return(this.isNegative()||t.isNeg())&&Wt$2("unbound-bitwise-result","or"),Lt$1(j$4(this).or(t))}xor(e){const t=j$4(e);return(this.isNegative()||t.isNeg())&&Wt$2("unbound-bitwise-result","xor"),Lt$1(j$4(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Wt$2("negative-width","mask"),Lt$1(j$4(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Wt$2("negative-width","shl"),Lt$1(j$4(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Wt$2("negative-width","shr"),Lt$1(j$4(this).shrn(e))}eq(e){return j$4(this).eq(j$4(e))}lt(e){return j$4(this).lt(j$4(e))}lte(e){return j$4(this).lte(j$4(e))}gt(e){return j$4(this).gt(j$4(e))}gte(e){return j$4(this).gte(j$4(e))}isNegative(){return"-"===this._hex[0]}isZero(){return j$4(this).isZero()}toNumber(){try{return j$4(this).toNumber()}catch{Wt$2("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Ae$1.throwError("this platform does not support BigInt",L$6.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Jn||(Jn=!0,Ae$1.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Ae$1.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",L$6.errors.UNEXPECTED_ARGUMENT,{}):Ae$1.throwError("BigNumber.toString does not accept parameters",L$6.errors.UNEXPECTED_ARGUMENT,{})),j$4(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof e)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new e(wi,vr(t)):t.match(/^-?[0-9]+$/)?new e(wi,vr(new Rr(t))):Ae$1.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Wt$2("underflow","BigNumber.from",t),(t>=Qn||t<=-Qn)&&Wt$2("overflow","BigNumber.from",t),e.from(String(t));const r=t;if("bigint"==typeof r)return e.from(r.toString());if(ir$1(r))return e.from(Kt$1(r));if(r)if(r.toHexString){const t=r.toHexString();if("string"==typeof t)return e.from(t)}else{let t=r._hex;if(null==t&&"BigNumber"===r.type&&(t=r.hex),"string"==typeof t&&(Qt$1(t)||"-"===t[0]&&Qt$1(t.substring(1))))return e.from(t)}return Ae$1.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(e){return!(!e||!e._isBigNumber)}};function vr(e){if("string"!=typeof e)return vr(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&Ae$1.throwArgumentError("invalid hex","value",e),"0x00"===(e=vr(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function Lt$1(e){return V$3.from(vr(e))}function j$4(e){const t=V$3.from(e).toHexString();return"-"===t[0]?new Rr("-"+t.substring(3),16):new Rr(t.substring(2),16)}function Wt$2(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),Ae$1.throwError(e,L$6.errors.NUMERIC_FAULT,n)}function R0(e){return new Rr(e,36).toString(16)}const Ht$1=new L$6(jn),mr$1={},Gn=V$3.from(0),Yn=V$3.from(-1);function Vn(e,t,r,n){const o={fault:t,operation:r};return void 0!==n&&(o.value=n),Ht$1.throwError(e,L$6.errors.NUMERIC_FAULT,o)}let gr="0";for(;gr.length<256;)gr+=gr;function xi(e){if("number"!=typeof e)try{e=V$3.from(e).toNumber()}catch{}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+gr.substring(0,e):Ht$1.throwArgumentError("invalid decimal size","decimals",e)}function Mi(e,t){null==t&&(t=0);const r=xi(t),n=(e=V$3.from(e)).lt(Gn);n&&(e=e.mul(Yn));let o=e.mod(r).toString();for(;o.length<r.length-1;)o="0"+o;o=o.match(/^([0-9]*[1-9]|0)(0*)/)[1];const i=e.div(r).toString();return e=1===r.length?i:i+"."+o,n&&(e="-"+e),e}function be$1(e,t){null==t&&(t=0);const r=xi(t);("string"!=typeof e||!e.match(/^-?[0-9.]+$/))&&Ht$1.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&Ht$1.throwArgumentError("missing value","value",e);const o=e.split(".");o.length>2&&Ht$1.throwArgumentError("too many decimal points","value",e);let i=o[0],s=o[1];for(i||(i="0"),s||(s="0");"0"===s[s.length-1];)s=s.substring(0,s.length-1);for(s.length>r.length-1&&Vn("fractional component exceeds decimals","underflow","parseFixed"),""===s&&(s="0");s.length<r.length-1;)s+="0";const a=V$3.from(i),c=V$3.from(s);let u=a.mul(r).add(c);return n&&(u=u.mul(Yn)),u}let dr$1=class e{constructor(e,t,r,n){e!==mr$1&&Ht$1.throwError("cannot use FixedFormat constructor; use FixedFormat.from",L$6.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=r,this.decimals=n,this.name=(t?"":"u")+"fixed"+String(r)+"x"+String(n),this._multiplier=xi(n),Object.freeze(this)}static from(t){if(t instanceof e)return t;"number"==typeof t&&(t=`fixed128x${t}`);let r=!0,n=128,o=18;if("string"==typeof t){if("fixed"!==t)if("ufixed"===t)r=!1;else{const e=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);e||Ht$1.throwArgumentError("invalid fixed format","format",t),r="u"!==e[1],n=parseInt(e[2]),o=parseInt(e[3])}}else if(t){const e=(e,r,n)=>null==t[e]?n:(typeof t[e]!==r&&Ht$1.throwArgumentError("invalid fixed format ("+e+" not "+r+")","format."+e,t[e]),t[e]);r=e("signed","boolean",r),n=e("width","number",n),o=e("decimals","number",o)}return n%8&&Ht$1.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),o>80&&Ht$1.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",o),new e(mr$1,r,n,o)}},Ut$1=class e{constructor(e,t,r,n){e!==mr$1&&Ht$1.throwError("cannot use FixedNumber constructor; use FixedNumber.from",L$6.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&Ht$1.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(t){this._checkFormat(t);const r=be$1(this._value,this.format.decimals),n=be$1(t._value,t.format.decimals);return e.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const r=be$1(this._value,this.format.decimals),n=be$1(t._value,t.format.decimals);return e.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const r=be$1(this._value,this.format.decimals),n=be$1(t._value,t.format.decimals);return e.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const r=be$1(this._value,this.format.decimals),n=be$1(t._value,t.format.decimals);return e.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let r=e.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(Wn.toFormat(r.format))),r}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let r=e.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(Wn.toFormat(r.format))),r}round(t){null==t&&(t=0);const r=this.toString().split(".");if(1===r.length&&r.push("0"),(t<0||t>80||t%1)&&Ht$1.throwArgumentError("invalid decimal count","decimals",t),r[1].length<=t)return this;const n=e.from("1"+gr.substring(0,t),this.format),o=O0.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(o).floor().divUnsafe(n)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){if(null==e)return this._hex;e%8&&Ht$1.throwArgumentError("invalid byte width","width",e);return oe$3(V$3.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return e.fromString(this._value,t)}static fromValue(t,r,n){return null==n&&null!=r&&!C0(r)&&(n=r,r=null),null==r&&(r=0),null==n&&(n="fixed"),e.fromString(Mi(t,r),dr$1.from(n))}static fromString(t,r){null==r&&(r="fixed");const n=dr$1.from(r),o=be$1(t,n.decimals);!n.signed&&o.lt(Gn)&&Vn("unsigned value cannot be negative","overflow","value",t);let i=null;n.signed?i=o.toTwos(n.width).toHexString():(i=o.toHexString(),i=oe$3(i,n.width/8));const s=Mi(o,n.decimals);return new e(mr$1,i,s,n)}static fromBytes(t,r){null==r&&(r="fixed");const n=dr$1.from(r);if(Ot$1(t).length>n.width/8)throw new Error("overflow");let o=V$3.from(t);n.signed&&(o=o.fromTwos(n.width));const i=o.toTwos((n.signed?0:1)+n.width).toHexString(),s=Mi(o,n.decimals);return new e(mr$1,i,s,n)}static from(t,r){if("string"==typeof t)return e.fromString(t,r);if(ir$1(t))return e.fromBytes(t,r);try{return e.fromValue(t,0,r)}catch(n){if(n.code!==L$6.errors.INVALID_ARGUMENT)throw n}return Ht$1.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}};const Wn=Ut$1.from(1),O0=Ut$1.from("0.5"),P0="strings/5.7.0",Xn=new L$6(P0);var Or,nr$1;function Ei(e,t=Or.current){t!=Or.current&&(Xn.checkNormalize(),e=e.normalize(t));let r=[];for(let n=0;n<e.length;n++){const t=e.charCodeAt(n);if(t<128)r.push(t);else if(t<2048)r.push(t>>6|192),r.push(63&t|128);else if(55296==(64512&t)){n++;const o=e.charCodeAt(n);if(n>=e.length||56320!=(64512&o))throw new Error("invalid utf-8 string");const i=65536+((1023&t)<<10)+(1023&o);r.push(i>>18|240),r.push(i>>12&63|128),r.push(i>>6&63|128),r.push(63&i|128)}else r.push(t>>12|224),r.push(t>>6&63|128),r.push(63&t|128)}return Ot$1(r)}function T0(e){if(e.length%4!=0)throw new Error("bad data");let t=[];for(let r=0;r<e.length;r+=4)t.push(parseInt(e.substring(r,r+4),16));return t}function Si(e,t){t||(t=function(e){return[parseInt(e,16)]});let r=0,n={};return e.split(",").forEach((e=>{let o=e.split(":");r+=parseInt(o[0],16),n[r]=t(o[1])})),n}function $n(e){let t=0;return e.split(",").map((e=>{let r=e.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=t+parseInt(r[0],16);return t=parseInt(r[1],16),{l:n,h:t}}))}function U0(e){e=atob(e);const t=[];for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));return Ot$1(t)}function ef(e,t){null==t&&(t=1);const r=[],n=r.forEach,o=function(e,t){n.call(e,(function(e){t>0&&Array.isArray(e)?o(e,t-1):r.push(e)}))};return o(e,t),r}function k0(e){const t={};for(let r=0;r<e.length;r++){const n=e[r];t[n[0]]=n[1]}return t}function q0(e){let t=0;function r(){return e[t++]<<8|e[t++]}let n=r(),o=1,i=[0,1];for(let v=1;v<n;v++)i.push(o+=r());let s=r(),a=t;t+=s;let c=0,u=0;function l(){return 0==c&&(u=u<<8|e[t++],c=8),u>>--c&1}const d=Math.pow(2,31),h=d>>>1,f=h>>1,p=d-1;let m=0;for(let v=0;v<31;v++)m=m<<1|l();let y=[],g=0,b=d;for(;;){let e=Math.floor(((m-g+1)*o-1)/b),t=0,r=n;for(;r-t>1;){let n=t+r>>>1;e<i[n]?r=n:t=n}if(0==t)break;y.push(t);let s=g+Math.floor(b*i[t]/o),a=g+Math.floor(b*i[t+1]/o)-1;for(;!((s^a)&h);)m=m<<1&p|l(),s=s<<1&p,a=a<<1&p|1;for(;s&~a&f;)m=m&h|m<<1&p>>>1|l(),s=s<<1^h,a=(a^h)<<1|h|1;g=s,b=1+a-s}let w=n-4;return y.map((t=>{switch(t-w){case 3:return w+65792+(e[a++]<<16|e[a++]<<8|e[a++]);case 2:return w+256+(e[a++]<<8|e[a++]);case 1:return w+e[a++];default:return t-1}}))}function K0(e){let t=0;return()=>e[t++]}function H0(e){return K0(q0(e))}function z0(e){return 1&e?~e>>1:e>>1}function L0(e,t){let r=Array(e);for(let n=0;n<e;n++)r[n]=1+t();return r}function rf(e,t){let r=Array(e);for(let n=0,o=-1;n<e;n++)r[n]=o+=1+t();return r}function j0(e,t){let r=Array(e);for(let n=0,o=0;n<e;n++)r[n]=o+=z0(t());return r}function Pr(e,t){let r=rf(e(),e),n=e(),o=rf(n,e),i=L0(n,e);for(let s=0;s<n;s++)for(let e=0;e<i[s];e++)r.push(o[s]+e);return t?r.map((e=>t[e])):r}function Q0(e){let t=[];for(;;){let r=e();if(0==r)break;t.push(G0(r,e))}for(;;){let r=e()-1;if(r<0)break;t.push(Y0(r,e))}return k0(ef(t))}function J0(e){let t=[];for(;;){let r=e();if(0==r)break;t.push(r)}return t}function nf(e,t,r){let n=Array(e).fill(void 0).map((()=>[]));for(let o=0;o<t;o++)j0(e,r).forEach(((e,t)=>n[t].push(e)));return n}function G0(e,t){let r=1+t(),n=t(),o=J0(t);return ef(nf(o.length,1+e,t).map(((e,t)=>{const i=e[0],s=e.slice(1);return Array(o[t]).fill(void 0).map(((e,t)=>{let o=t*n;return[i+t*r,s.map((e=>e+o))]}))})))}function Y0(e,t){return nf(1+t(),1+e,t).map((e=>[e[0],e.slice(1)]))}function V0(e){let t=Pr(e).sort(((e,t)=>e-t));return function r(){let n=[];for(;;){let o=Pr(e,t);if(0==o.length)break;n.push({set:new Set(o),node:r()})}n.sort(((e,t)=>t.set.size-e.set.size));let o=e(),i=o%3;o=o/3|0;let s=!!(1&o);return o>>=1,{branches:n,valid:i,fe0f:s,save:1==o,check:2==o}}()}function W0(){return H0(U0("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(Or||(Or={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(nr$1||(nr$1={})),$n("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((e=>parseInt(e,16))),Si("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),Si("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),Si("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",T0),$n("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");const Dr=W0();new Set(Pr(Dr)),new Set(Pr(Dr)),Q0(Dr),V0(Dr);const X0=new Uint8Array(32);X0.fill(0);const Z0="Ethereum Signed Message:\n";function ff(e){return"string"==typeof e&&(e=Ei(e)),yi(E0([Ei(Z0),Ei(String(e.length)),e]))}const ts$1="address/5.7.0",Ar=new L$6(ts$1);function of(e){Qt$1(e,20)||Ar.throwArgumentError("invalid address","address",e);const t=(e=e.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let o=0;o<40;o++)r[o]=t[o].charCodeAt(0);const n=Ot$1(yi(r));for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&(t[o]=t[o].toUpperCase()),(15&n[o>>1])>=8&&(t[o+1]=t[o+1].toUpperCase());return"0x"+t.join("")}const es$2=9007199254740991;function rs$1(e){return Math.log10?Math.log10(e):Math.log(e)/Math.LN10}const Ni={};for(let Br=0;Br<10;Br++)Ni[String(Br)]=String(Br);for(let Br=0;Br<26;Br++)Ni[String.fromCharCode(65+Br)]=String(10+Br);const sf=Math.floor(rs$1(es$2));function is$1(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((e=>Ni[e])).join("");for(;t.length>=sf;){let e=t.substring(0,sf);t=parseInt(e,10)%97+t.substring(e.length)}let r=String(98-parseInt(t,10)%97);for(;r.length<2;)r="0"+r;return r}function ns$1(e){let t=null;if("string"!=typeof e&&Ar.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=of(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&Ar.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==is$1(e)&&Ar.throwArgumentError("bad icap checksum","address",e),t=R0(e.substring(4));t.length<40;)t="0"+t;t=of("0x"+t)}else Ar.throwArgumentError("invalid address","address",e);return t}function br(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}const os=new Uint8Array(32);os.fill(0),V$3.from(-1);const ss$1=V$3.from(0),as=V$3.from(1);V$3.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),oe$3(as.toHexString(),32),oe$3(ss$1.toHexString(),32);var se$2={},Q$3={},yr=af;function af(e,t){if(!e)throw new Error(t||"Assertion failed")}af.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var Ii={exports:{}};"function"==typeof Object.create?Ii.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Ii.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}};var us=yr,hs=Ii.exports;function cs(e,t){return!(55296!=(64512&e.charCodeAt(t))||t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1))}function ls(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),o=0;o<e.length;o+=2)r.push(parseInt(e[o]+e[o+1],16))}else for(var n=0,o=0;o<e.length;o++){var i=e.charCodeAt(o);i<128?r[n++]=i:i<2048?(r[n++]=i>>6|192,r[n++]=63&i|128):cs(e,o)?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++o)),r[n++]=i>>18|240,r[n++]=i>>12&63|128,r[n++]=i>>6&63|128,r[n++]=63&i|128):(r[n++]=i>>12|224,r[n++]=i>>6&63|128,r[n++]=63&i|128)}else for(o=0;o<e.length;o++)r[o]=0|e[o];return r}function ds(e){for(var t="",r=0;r<e.length;r++)t+=hf(e[r].toString(16));return t}function uf(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function ps(e,t){for(var r="",n=0;n<e.length;n++){var o=e[n];"little"===t&&(o=uf(o)),r+=cf(o.toString(16))}return r}function hf(e){return 1===e.length?"0"+e:e}function cf(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}function vs(e,t,r,n){var o=r-t;us(o%4==0);for(var i=new Array(o/4),s=0,a=t;s<i.length;s++,a+=4){var c;c="big"===n?e[a]<<24|e[a+1]<<16|e[a+2]<<8|e[a+3]:e[a+3]<<24|e[a+2]<<16|e[a+1]<<8|e[a],i[s]=c>>>0}return i}function ms(e,t){for(var r=new Array(4*e.length),n=0,o=0;n<e.length;n++,o+=4){var i=e[n];"big"===t?(r[o]=i>>>24,r[o+1]=i>>>16&255,r[o+2]=i>>>8&255,r[o+3]=255&i):(r[o+3]=i>>>24,r[o+2]=i>>>16&255,r[o+1]=i>>>8&255,r[o]=255&i)}return r}function gs(e,t){return e>>>t|e<<32-t}function As(e,t){return e<<t|e>>>32-t}function bs(e,t){return e+t>>>0}function ys(e,t,r){return e+t+r>>>0}function ws(e,t,r,n){return e+t+r+n>>>0}function xs(e,t,r,n,o){return e+t+r+n+o>>>0}function Ms(e,t,r,n){var o=e[t],i=n+e[t+1]>>>0,s=(i<n?1:0)+r+o;e[t]=s>>>0,e[t+1]=i}function Es(e,t,r,n){return(t+n>>>0<t?1:0)+e+r>>>0}function Ss(e,t,r,n){return t+n>>>0}function Ns(e,t,r,n,o,i,s,a){var c=0,u=t;return c+=(u=u+n>>>0)<t?1:0,c+=(u=u+i>>>0)<i?1:0,e+r+o+s+(c+=(u=u+a>>>0)<a?1:0)>>>0}function Is(e,t,r,n,o,i,s,a){return t+n+i+a>>>0}function _s(e,t,r,n,o,i,s,a,c,u){var l=0,d=t;return l+=(d=d+n>>>0)<t?1:0,l+=(d=d+i>>>0)<i?1:0,l+=(d=d+a>>>0)<a?1:0,e+r+o+s+c+(l+=(d=d+u>>>0)<u?1:0)>>>0}function Bs(e,t,r,n,o,i,s,a,c,u){return t+n+i+a+u>>>0}function Cs(e,t,r){return(t<<32-r|e>>>r)>>>0}function Rs(e,t,r){return(e<<32-r|t>>>r)>>>0}function Os(e,t,r){return e>>>r}function Ps(e,t,r){return(e<<32-r|t>>>r)>>>0}Q$3.inherits=hs,Q$3.toArray=ls,Q$3.toHex=ds,Q$3.htonl=uf,Q$3.toHex32=ps,Q$3.zero2=hf,Q$3.zero8=cf,Q$3.join32=vs,Q$3.split32=ms,Q$3.rotr32=gs,Q$3.rotl32=As,Q$3.sum32=bs,Q$3.sum32_3=ys,Q$3.sum32_4=ws,Q$3.sum32_5=xs,Q$3.sum64=Ms,Q$3.sum64_hi=Es,Q$3.sum64_lo=Ss,Q$3.sum64_4_hi=Ns,Q$3.sum64_4_lo=Is,Q$3.sum64_5_hi=_s,Q$3.sum64_5_lo=Bs,Q$3.rotr64_hi=Cs,Q$3.rotr64_lo=Rs,Q$3.shr64_hi=Os,Q$3.shr64_lo=Ps;var fr$1={},lf=Q$3,Ds=yr;function Fr(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}fr$1.BlockHash=Fr,Fr.prototype.update=function(e,t){if(e=lf.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=lf.join32(e,0,e.length-r,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},Fr.prototype.digest=function(e){return this.update(this._pad()),Ds(null===this.pending),this._digest(e)},Fr.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,n=new Array(r+this.padLength);n[0]=128;for(var o=1;o<r;o++)n[o]=0;if(e<<=3,"big"===this.endian){for(var i=8;i<this.padLength;i++)n[o++]=0;n[o++]=0,n[o++]=0,n[o++]=0,n[o++]=0,n[o++]=e>>>24&255,n[o++]=e>>>16&255,n[o++]=e>>>8&255,n[o++]=255&e}else for(n[o++]=255&e,n[o++]=e>>>8&255,n[o++]=e>>>16&255,n[o++]=e>>>24&255,n[o++]=0,n[o++]=0,n[o++]=0,n[o++]=0,i=8;i<this.padLength;i++)n[o++]=0;return n};var or={},ae$1={},Fs=Q$3,ue$1=Fs.rotr32;function Ts(e,t,r,n){return 0===e?df(t,r,n):1===e||3===e?vf(t,r,n):2===e?pf(t,r,n):void 0}function df(e,t,r){return e&t^~e&r}function pf(e,t,r){return e&t^e&r^t&r}function vf(e,t,r){return e^t^r}function Us(e){return ue$1(e,2)^ue$1(e,13)^ue$1(e,22)}function ks(e){return ue$1(e,6)^ue$1(e,11)^ue$1(e,25)}function qs(e){return ue$1(e,7)^ue$1(e,18)^e>>>3}function Ks(e){return ue$1(e,17)^ue$1(e,19)^e>>>10}ae$1.ft_1=Ts,ae$1.ch32=df,ae$1.maj32=pf,ae$1.p32=vf,ae$1.s0_256=Us,ae$1.s1_256=ks,ae$1.g0_256=qs,ae$1.g1_256=Ks;var sr$1=Q$3,Hs=fr$1,zs=ae$1,_i=sr$1.rotl32,wr=sr$1.sum32,Ls=sr$1.sum32_5,js=zs.ft_1,mf=Hs.BlockHash,Qs=[1518500249,1859775393,2400959708,3395469782];function he$1(){if(!(this instanceof he$1))return new he$1;mf.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}sr$1.inherits(he$1,mf);var Js=he$1;he$1.blockSize=512,he$1.outSize=160,he$1.hmacStrength=80,he$1.padLength=64,he$1.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=_i(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var o=this.h[0],i=this.h[1],s=this.h[2],a=this.h[3],c=this.h[4];for(n=0;n<r.length;n++){var u=~~(n/20),l=Ls(_i(o,5),js(u,i,s,a),c,r[n],Qs[u]);c=a,a=s,s=_i(i,30),i=o,o=l}this.h[0]=wr(this.h[0],o),this.h[1]=wr(this.h[1],i),this.h[2]=wr(this.h[2],s),this.h[3]=wr(this.h[3],a),this.h[4]=wr(this.h[4],c)},he$1.prototype._digest=function(e){return"hex"===e?sr$1.toHex32(this.h,"big"):sr$1.split32(this.h,"big")};var ar=Q$3,Gs=fr$1,ur=ae$1,Ys=yr,ie$2=ar.sum32,Vs=ar.sum32_4,Ws=ar.sum32_5,Xs=ur.ch32,Zs=ur.maj32,$s=ur.s0_256,ta=ur.s1_256,ea=ur.g0_256,ra=ur.g1_256,gf=Gs.BlockHash,ia=[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 ce$1(){if(!(this instanceof ce$1))return new ce$1;gf.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=ia,this.W=new Array(64)}ar.inherits(ce$1,gf);var Af=ce$1;ce$1.blockSize=512,ce$1.outSize=256,ce$1.hmacStrength=192,ce$1.padLength=64,ce$1.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=Vs(ra(r[n-2]),r[n-7],ea(r[n-15]),r[n-16]);var o=this.h[0],i=this.h[1],s=this.h[2],a=this.h[3],c=this.h[4],u=this.h[5],l=this.h[6],d=this.h[7];for(Ys(this.k.length===r.length),n=0;n<r.length;n++){var h=Ws(d,ta(c),Xs(c,u,l),this.k[n],r[n]),f=ie$2($s(o),Zs(o,i,s));d=l,l=u,u=c,c=ie$2(a,h),a=s,s=i,i=o,o=ie$2(h,f)}this.h[0]=ie$2(this.h[0],o),this.h[1]=ie$2(this.h[1],i),this.h[2]=ie$2(this.h[2],s),this.h[3]=ie$2(this.h[3],a),this.h[4]=ie$2(this.h[4],c),this.h[5]=ie$2(this.h[5],u),this.h[6]=ie$2(this.h[6],l),this.h[7]=ie$2(this.h[7],d)},ce$1.prototype._digest=function(e){return"hex"===e?ar.toHex32(this.h,"big"):ar.split32(this.h,"big")};var Bi=Q$3,bf=Af;function ye$1(){if(!(this instanceof ye$1))return new ye$1;bf.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Bi.inherits(ye$1,bf);var na=ye$1;ye$1.blockSize=512,ye$1.outSize=224,ye$1.hmacStrength=192,ye$1.padLength=64,ye$1.prototype._digest=function(e){return"hex"===e?Bi.toHex32(this.h.slice(0,7),"big"):Bi.split32(this.h.slice(0,7),"big")};var jt$1=Q$3,fa$1=fr$1,oa=yr,le$1=jt$1.rotr64_hi,de$2=jt$1.rotr64_lo,yf=jt$1.shr64_hi,wf=jt$1.shr64_lo,Be$2=jt$1.sum64,Ci=jt$1.sum64_hi,Ri=jt$1.sum64_lo,sa=jt$1.sum64_4_hi,aa=jt$1.sum64_4_lo,ua=jt$1.sum64_5_hi,ha=jt$1.sum64_5_lo,xf=fa$1.BlockHash,ca=[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 ne$3(){if(!(this instanceof ne$3))return new ne$3;xf.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=ca,this.W=new Array(160)}jt$1.inherits(ne$3,xf);var Mf=ne$3;function la(e,t,r,n,o){var i=e&r^~e&o;return i<0&&(i+=4294967296),i}function da(e,t,r,n,o,i){var s=t&n^~t&i;return s<0&&(s+=4294967296),s}function pa(e,t,r,n,o){var i=e&r^e&o^r&o;return i<0&&(i+=4294967296),i}function va(e,t,r,n,o,i){var s=t&n^t&i^n&i;return s<0&&(s+=4294967296),s}function ma(e,t){var r=le$1(e,t,28)^le$1(t,e,2)^le$1(t,e,7);return r<0&&(r+=4294967296),r}function ga(e,t){var r=de$2(e,t,28)^de$2(t,e,2)^de$2(t,e,7);return r<0&&(r+=4294967296),r}function Aa(e,t){var r=le$1(e,t,14)^le$1(e,t,18)^le$1(t,e,9);return r<0&&(r+=4294967296),r}function ba(e,t){var r=de$2(e,t,14)^de$2(e,t,18)^de$2(t,e,9);return r<0&&(r+=4294967296),r}function ya(e,t){var r=le$1(e,t,1)^le$1(e,t,8)^yf(e,t,7);return r<0&&(r+=4294967296),r}function wa(e,t){var r=de$2(e,t,1)^de$2(e,t,8)^wf(e,t,7);return r<0&&(r+=4294967296),r}function xa(e,t){var r=le$1(e,t,19)^le$1(t,e,29)^yf(e,t,6);return r<0&&(r+=4294967296),r}function Ma(e,t){var r=de$2(e,t,19)^de$2(t,e,29)^wf(e,t,6);return r<0&&(r+=4294967296),r}ne$3.blockSize=1024,ne$3.outSize=512,ne$3.hmacStrength=192,ne$3.padLength=128,ne$3.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var o=xa(r[n-4],r[n-3]),i=Ma(r[n-4],r[n-3]),s=r[n-14],a=r[n-13],c=ya(r[n-30],r[n-29]),u=wa(r[n-30],r[n-29]),l=r[n-32],d=r[n-31];r[n]=sa(o,i,s,a,c,u,l,d),r[n+1]=aa(o,i,s,a,c,u,l,d)}},ne$3.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],o=this.h[1],i=this.h[2],s=this.h[3],a=this.h[4],c=this.h[5],u=this.h[6],l=this.h[7],d=this.h[8],h=this.h[9],f=this.h[10],p=this.h[11],m=this.h[12],y=this.h[13],g=this.h[14],b=this.h[15];oa(this.k.length===r.length);for(var w=0;w<r.length;w+=2){var v=g,_=b,A=Aa(d,h),I=ba(d,h),T=la(d,h,f,p,m),k=da(d,h,f,p,m,y),S=this.k[w],E=this.k[w+1],$=r[w],C=r[w+1],R=ua(v,_,A,I,T,k,S,E,$,C),O=ha(v,_,A,I,T,k,S,E,$,C);v=ma(n,o),_=ga(n,o),A=pa(n,o,i,s,a),I=va(n,o,i,s,a,c);var N=Ci(v,_,A,I),M=Ri(v,_,A,I);g=m,b=y,m=f,y=p,f=d,p=h,d=Ci(u,l,R,O),h=Ri(l,l,R,O),u=a,l=c,a=i,c=s,i=n,s=o,n=Ci(R,O,N,M),o=Ri(R,O,N,M)}Be$2(this.h,0,n,o),Be$2(this.h,2,i,s),Be$2(this.h,4,a,c),Be$2(this.h,6,u,l),Be$2(this.h,8,d,h),Be$2(this.h,10,f,p),Be$2(this.h,12,m,y),Be$2(this.h,14,g,b)},ne$3.prototype._digest=function(e){return"hex"===e?jt$1.toHex32(this.h,"big"):jt$1.split32(this.h,"big")};var Oi=Q$3,Ef=Mf;function we$1(){if(!(this instanceof we$1))return new we$1;Ef.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Oi.inherits(we$1,Ef);var Ea=we$1;we$1.blockSize=1024,we$1.outSize=384,we$1.hmacStrength=192,we$1.padLength=128,we$1.prototype._digest=function(e){return"hex"===e?Oi.toHex32(this.h.slice(0,12),"big"):Oi.split32(this.h.slice(0,12),"big")},or.sha1=Js,or.sha224=na,or.sha256=Af,or.sha384=Ea,or.sha512=Mf;var Sf={},Xe$1=Q$3,Sa=fr$1,Tr=Xe$1.rotl32,Nf=Xe$1.sum32,xr=Xe$1.sum32_3,If=Xe$1.sum32_4,_f=Sa.BlockHash;function pe(){if(!(this instanceof pe))return new pe;_f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function Bf(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function Na(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function Ia(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}Xe$1.inherits(pe,_f),Sf.ripemd160=pe,pe.blockSize=512,pe.outSize=160,pe.hmacStrength=192,pe.padLength=64,pe.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],o=this.h[2],i=this.h[3],s=this.h[4],a=r,c=n,u=o,l=i,d=s,h=0;h<80;h++){var f=Nf(Tr(If(r,Bf(h,n,o,i),e[_a[h]+t],Na(h)),Ca[h]),s);r=s,s=i,i=Tr(o,10),o=n,n=f,f=Nf(Tr(If(a,Bf(79-h,c,u,l),e[Ba[h]+t],Ia(h)),Ra[h]),d),a=d,d=l,l=Tr(u,10),u=c,c=f}f=xr(this.h[1],o,l),this.h[1]=xr(this.h[2],i,d),this.h[2]=xr(this.h[3],s,a),this.h[3]=xr(this.h[4],r,c),this.h[4]=xr(this.h[0],n,u),this.h[0]=f},pe.prototype._digest=function(e){return"hex"===e?Xe$1.toHex32(this.h,"little"):Xe$1.split32(this.h,"little")};var _a=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],Ba=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Ca=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Ra=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Oa=Q$3,Pa=yr;function hr$1(e,t,r){if(!(this instanceof hr$1))return new hr$1(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(Oa.toArray(t,r))}var Da=hr$1;function cr$1(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return Fa(e,t??r.path)}},r.exports),r.exports}function Fa(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}hr$1.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),Pa(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},hr$1.prototype.update=function(e,t){return this.inner.update(e,t),this},hr$1.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(e){var t=e;t.utils=Q$3,t.common=fr$1,t.sha=or,t.ripemd=Sf,t.hmac=Da,t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160}(se$2);var Pi=Cf;function Cf(e,t){if(!e)throw new Error(t||"Assertion failed")}Cf.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var fe$2=cr$1((function(e,t){var r=t;function n(e){return 1===e.length?"0"+e:e}function o(e){for(var t="",r=0;r<e.length;r++)t+=n(e[r].toString(16));return t}r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(n=0;n<e.length;n++){var o=e.charCodeAt(n),i=o>>8,s=255&o;i?r.push(i,s):r.push(s)}return r},r.zero2=n,r.toHex=o,r.encode=function(e,t){return"hex"===t?o(e):e}})),Jt$2=cr$1((function(e,t){var r=t;r.assert=Pi,r.toArray=fe$2.toArray,r.zero2=fe$2.zero2,r.toHex=fe$2.toHex,r.encode=fe$2.encode,r.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var o=1<<t+1,i=e.clone(),s=0;s<n.length;s++){var a,c=i.andln(o-1);i.isOdd()?(a=c>(o>>1)-1?(o>>1)-c:c,i.isubn(a)):a=0,n[s]=a,i.iushrn(1)}return n},r.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,o=0,i=0;e.cmpn(-o)>0||t.cmpn(-i)>0;){var s,a,c=e.andln(3)+o&3,u=t.andln(3)+i&3;3===c&&(c=-1),3===u&&(u=-1),1&c?s=3!==(n=e.andln(7)+o&7)&&5!==n||2!==u?c:-c:s=0,r[0].push(s),1&u?a=3!==(n=t.andln(7)+i&7)&&5!==n||2!==c?u:-u:a=0,r[1].push(a),2*o===s+1&&(o=1-o),2*i===a+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return r},r.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(e){return"string"==typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new K$3(e,"hex","le")}})),Ur=Jt$2.getNAF,Ta=Jt$2.getJSF,kr=Jt$2.assert;function Ce$1(e,t){this.type=e,this.p=new K$3(t.p,16),this.red=t.prime?K$3.red(t.prime):K$3.mont(this.p),this.zero=new K$3(0).toRed(this.red),this.one=new K$3(1).toRed(this.red),this.two=new K$3(2).toRed(this.red),this.n=t.n&&new K$3(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Ze$1=Ce$1;function Xt$2(e,t){this.curve=e,this.type=t,this.precomputed=null}Ce$1.prototype.point=function(){throw new Error("Not implemented")},Ce$1.prototype.validate=function(){throw new Error("Not implemented")},Ce$1.prototype._fixedNafMul=function(e,t){kr(e.precomputed);var r=e._getDoubles(),n=Ur(t,1,this._bitLength),o=(1<<r.step+1)-(r.step%2==0?2:1);o/=3;var i,s,a=[];for(i=0;i<n.length;i+=r.step){s=0;for(var c=i+r.step-1;c>=i;c--)s=(s<<1)+n[c];a.push(s)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=o;d>0;d--){for(i=0;i<a.length;i++)(s=a[i])===d?l=l.mixedAdd(r.points[i]):s===-d&&(l=l.mixedAdd(r.points[i].neg()));u=u.add(l)}return u.toP()},Ce$1.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var o=n.points,i=Ur(t,r,this._bitLength),s=this.jpoint(null,null,null),a=i.length-1;a>=0;a--){for(var c=0;a>=0&&0===i[a];a--)c++;if(a>=0&&c++,s=s.dblp(c),a<0)break;var u=i[a];kr(0!==u),s="affine"===e.type?u>0?s.mixedAdd(o[u-1>>1]):s.mixedAdd(o[-u-1>>1].neg()):u>0?s.add(o[u-1>>1]):s.add(o[-u-1>>1].neg())}return"affine"===e.type?s.toP():s},Ce$1.prototype._wnafMulAdd=function(e,t,r,n,o){var i,s,a,c=this._wnafT1,u=this._wnafT2,l=this._wnafT3,d=0;for(i=0;i<n;i++){var h=(a=t[i])._getNAFPoints(e);c[i]=h.wnd,u[i]=h.points}for(i=n-1;i>=1;i-=2){var f=i-1,p=i;if(1===c[f]&&1===c[p]){var m=[t[f],null,null,t[p]];0===t[f].y.cmp(t[p].y)?(m[1]=t[f].add(t[p]),m[2]=t[f].toJ().mixedAdd(t[p].neg())):0===t[f].y.cmp(t[p].y.redNeg())?(m[1]=t[f].toJ().mixedAdd(t[p]),m[2]=t[f].add(t[p].neg())):(m[1]=t[f].toJ().mixedAdd(t[p]),m[2]=t[f].toJ().mixedAdd(t[p].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],g=Ta(r[f],r[p]);for(d=Math.max(g[0].length,d),l[f]=new Array(d),l[p]=new Array(d),s=0;s<d;s++){var b=0|g[0][s],w=0|g[1][s];l[f][s]=y[3*(b+1)+(w+1)],l[p][s]=0,u[f]=m}}else l[f]=Ur(r[f],c[f],this._bitLength),l[p]=Ur(r[p],c[p],this._bitLength),d=Math.max(l[f].length,d),d=Math.max(l[p].length,d)}var v=this.jpoint(null,null,null),_=this._wnafT4;for(i=d;i>=0;i--){for(var A=0;i>=0;){var I=!0;for(s=0;s<n;s++)_[s]=0|l[s][i],0!==_[s]&&(I=!1);if(!I)break;A++,i--}if(i>=0&&A++,v=v.dblp(A),i<0)break;for(s=0;s<n;s++){var T=_[s];0!==T&&(T>0?a=u[s][T-1>>1]:T<0&&(a=u[s][-T-1>>1].neg()),v="affine"===a.type?v.mixedAdd(a):v.add(a))}}for(i=0;i<n;i++)u[i]=null;return o?v:v.toP()},Ce$1.BasePoint=Xt$2,Xt$2.prototype.eq=function(){throw new Error("Not implemented")},Xt$2.prototype.validate=function(){return this.curve.validate(this)},Ce$1.prototype.decodePoint=function(e,t){e=Jt$2.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?kr(e[e.length-1]%2==0):7===e[0]&&kr(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},Xt$2.prototype.encodeCompressed=function(e){return this.encode(e,!0)},Xt$2.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},Xt$2.prototype.encode=function(e,t){return Jt$2.encode(this._encode(t),e)},Xt$2.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},Xt$2.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},Xt$2.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,o=0;o<t;o+=e){for(var i=0;i<e;i++)n=n.dbl();r.push(n)}return{step:e,points:r}},Xt$2.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1===r?null:this.dbl(),o=1;o<r;o++)t[o]=t[o-1].add(n);return{wnd:e,points:t}},Xt$2.prototype._getBeta=function(){return null},Xt$2.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var Di=cr$1((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}})),Ua=Jt$2.assert;function Zt$2(e){Ze$1.call(this,"short",e),this.a=new K$3(e.a,16).toRed(this.red),this.b=new K$3(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Di(Zt$2,Ze$1);var ka=Zt$2;function Ft(e,t,r,n){Ze$1.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new K$3(t,16),this.y=new K$3(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function Tt$1(e,t,r,n){Ze$1.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new K$3(0)):(this.x=new K$3(t,16),this.y=new K$3(r,16),this.z=new K$3(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Zt$2.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new K$3(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new K$3(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?r=o[0]:(r=o[1],Ua(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new K$3(e.a,16),b:new K$3(e.b,16)}})):this._getEndoBasis(r)}}},Zt$2.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:K$3.mont(e),r=new K$3(2).toRed(t).redInvm(),n=r.redNeg(),o=new K$3(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},Zt$2.prototype._getEndoBasis=function(e){for(var t,r,n,o,i,s,a,c,u,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,h=this.n.clone(),f=new K$3(1),p=new K$3(0),m=new K$3(0),y=new K$3(1),g=0;0!==d.cmpn(0);){var b=h.div(d);c=h.sub(b.mul(d)),u=m.sub(b.mul(f));var w=y.sub(b.mul(p));if(!n&&c.cmp(l)<0)t=a.neg(),r=f,n=c.neg(),o=u;else if(n&&2==++g)break;a=c,h=d,d=c,m=f,f=u,y=p,p=w}i=c.neg(),s=u;var v=n.sqr().add(o.sqr());return i.sqr().add(s.sqr()).cmp(v)>=0&&(i=t,s=r),n.negative&&(n=n.neg(),o=o.neg()),i.negative&&(i=i.neg(),s=s.neg()),[{a:n,b:o},{a:i,b:s}]},Zt$2.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],o=n.b.mul(e).divRound(this.n),i=r.b.neg().mul(e).divRound(this.n),s=o.mul(r.a),a=i.mul(n.a),c=o.mul(r.b),u=i.mul(n.b);return{k1:e.sub(s).sub(a),k2:c.add(u).neg()}},Zt$2.prototype.pointFromX=function(e,t){(e=new K$3(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(t&&!o||!t&&o)&&(n=n.redNeg()),this.point(e,n)},Zt$2.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),o=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(o).cmpn(0)},Zt$2.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,o=this._endoWnafT2,i=0;i<e.length;i++){var s=this._endoSplit(t[i]),a=e[i],c=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),c=c.neg(!0)),n[2*i]=a,n[2*i+1]=c,o[2*i]=s.k1,o[2*i+1]=s.k2}for(var u=this._wnafMulAdd(1,n,o,2*i,r),l=0;l<2*i;l++)n[l]=null,o[l]=null;return u},Di(Ft,Ze$1.BasePoint),Zt$2.prototype.point=function(e,t,r){return new Ft(this,e,t,r)},Zt$2.prototype.pointFromJSON=function(e,t){return Ft.fromJSON(this,e,t)},Ft.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Ft.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Ft.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function o(t){return e.point(t[0],t[1],r)}var i=t[2];return n.precomputed={beta:null,doubles:i.doubles&&{step:i.doubles.step,points:[n].concat(i.doubles.points.map(o))},naf:i.naf&&{wnd:i.naf.wnd,points:[n].concat(i.naf.points.map(o))}},n},Ft.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Ft.prototype.isInfinity=function(){return this.inf},Ft.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},Ft.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),o=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),i=o.redSqr().redISub(this.x.redAdd(this.x)),s=o.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,s)},Ft.prototype.getX=function(){return this.x.fromRed()},Ft.prototype.getY=function(){return this.y.fromRed()},Ft.prototype.mul=function(e){return e=new K$3(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Ft.prototype.mulAdd=function(e,t,r){var n=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,o):this.curve._wnafMulAdd(1,n,o,2)},Ft.prototype.jmulAdd=function(e,t,r){var n=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,o,!0):this.curve._wnafMulAdd(1,n,o,2,!0)},Ft.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},Ft.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},Ft.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Di(Tt$1,Ze$1.BasePoint),Zt$2.prototype.jpoint=function(e,t,r){return new Tt$1(this,e,t,r)},Tt$1.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},Tt$1.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Tt$1.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),o=e.x.redMul(r),i=this.y.redMul(t.redMul(e.z)),s=e.y.redMul(r.redMul(this.z)),a=n.redSub(o),c=i.redSub(s);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),d=n.redMul(u),h=c.redSqr().redIAdd(l).redISub(d).redISub(d),f=c.redMul(d.redISub(h)).redISub(i.redMul(l)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(h,f,p)},Tt$1.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),o=this.y,i=e.y.redMul(t).redMul(this.z),s=r.redSub(n),a=o.redSub(i);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),u=c.redMul(s),l=r.redMul(c),d=a.redSqr().redIAdd(u).redISub(l).redISub(l),h=a.redMul(l.redISub(d)).redISub(o.redMul(u)),f=this.z.redMul(s);return this.curve.jpoint(d,h,f)},Tt$1.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)r=r.dbl();return r}var n=this.curve.a,o=this.curve.tinv,i=this.x,s=this.y,a=this.z,c=a.redSqr().redSqr(),u=s.redAdd(s);for(t=0;t<e;t++){var l=i.redSqr(),d=u.redSqr(),h=d.redSqr(),f=l.redAdd(l).redIAdd(l).redIAdd(n.redMul(c)),p=i.redMul(d),m=f.redSqr().redISub(p.redAdd(p)),y=p.redISub(m),g=f.redMul(y);g=g.redIAdd(g).redISub(h);var b=u.redMul(a);t+1<e&&(c=c.redMul(h)),i=m,a=b,u=g}return this.curve.jpoint(i,u.redMul(o),a)},Tt$1.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Tt$1.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),i=o.redSqr(),s=this.x.redAdd(o).redSqr().redISub(n).redISub(i);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n),c=a.redSqr().redISub(s).redISub(s),u=i.redIAdd(i);u=(u=u.redIAdd(u)).redIAdd(u),e=c,t=a.redMul(s.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),d=this.y.redSqr(),h=d.redSqr(),f=this.x.redAdd(d).redSqr().redISub(l).redISub(h);f=f.redIAdd(f);var p=l.redAdd(l).redIAdd(l),m=p.redSqr(),y=h.redIAdd(h);y=(y=y.redIAdd(y)).redIAdd(y),e=m.redISub(f).redISub(f),t=p.redMul(f.redISub(e)).redISub(y),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},Tt$1.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),i=o.redSqr(),s=this.x.redAdd(o).redSqr().redISub(n).redISub(i);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),c=a.redSqr().redISub(s).redISub(s);e=c;var u=i.redIAdd(i);u=(u=u.redIAdd(u)).redIAdd(u),t=a.redMul(s.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),d=this.y.redSqr(),h=this.x.redMul(d),f=this.x.redSub(l).redMul(this.x.redAdd(l));f=f.redAdd(f).redIAdd(f);var p=h.redIAdd(h),m=(p=p.redIAdd(p)).redAdd(p);e=f.redSqr().redISub(m),r=this.y.redAdd(this.z).redSqr().redISub(d).redISub(l);var y=d.redSqr();y=(y=(y=y.redIAdd(y)).redIAdd(y)).redIAdd(y),t=f.redMul(p.redISub(e)).redISub(y)}return this.curve.jpoint(e,t,r)},Tt$1.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,o=n.redSqr().redSqr(),i=t.redSqr(),s=r.redSqr(),a=i.redAdd(i).redIAdd(i).redIAdd(e.redMul(o)),c=t.redAdd(t),u=(c=c.redIAdd(c)).redMul(s),l=a.redSqr().redISub(u.redAdd(u)),d=u.redISub(l),h=s.redSqr();h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var f=a.redMul(d).redISub(h),p=r.redAdd(r).redMul(n);return this.curve.jpoint(l,f,p)},Tt$1.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),o=e.redAdd(e).redIAdd(e),i=o.redSqr(),s=this.x.redAdd(t).redSqr().redISub(e).redISub(n),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(i)).redSqr(),c=n.redIAdd(n);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var u=o.redIAdd(s).redSqr().redISub(i).redISub(a).redISub(c),l=t.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var d=this.x.redMul(a).redISub(l);d=(d=d.redIAdd(d)).redIAdd(d);var h=this.y.redMul(u.redMul(c.redISub(u)).redISub(s.redMul(a)));h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var f=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(d,h,f)},Tt$1.prototype.mul=function(e,t){return e=new K$3(e,t),this.curve._wnafMul(this,e)},Tt$1.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var n=t.redMul(this.z),o=r.redMul(e.z);return 0===this.y.redMul(o).redISub(e.y.redMul(n)).cmpn(0)},Tt$1.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),o=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(o),0===this.x.cmp(r))return!0}},Tt$1.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},Tt$1.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var qr=cr$1((function(e,t){var r=t;r.base=Ze$1,r.short=ka,r.mont=null,r.edwards=null})),Kr=cr$1((function(e,t){var r,n=t,o=Jt$2.assert;function i(e){"short"===e.type?this.curve=new qr.short(e):"edwards"===e.type?this.curve=new qr.edwards(e):this.curve=new qr.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,o(this.g.validate(),"Invalid curve"),o(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new i(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=i,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:se$2.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:se$2.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:se$2.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:se$2.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:se$2.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:se$2.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:se$2.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch{r=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:se$2.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function Re$1(e){if(!(this instanceof Re$1))return new Re$1(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=fe$2.toArray(e.entropy,e.entropyEnc||"hex"),r=fe$2.toArray(e.nonce,e.nonceEnc||"hex"),n=fe$2.toArray(e.pers,e.persEnc||"hex");Pi(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var Rf=Re$1;Re$1.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o<this.V.length;o++)this.K[o]=0,this.V[o]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},Re$1.prototype._hmac=function(){return new se$2.hmac(this.hash,this.K)},Re$1.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},Re$1.prototype.reseed=function(e,t,r,n){"string"!=typeof t&&(n=r,r=t,t=null),e=fe$2.toArray(e,t),r=fe$2.toArray(r,n),Pi(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},Re$1.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=fe$2.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length<e;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var i=o.slice(0,e);return this._update(r),this._reseed++,fe$2.encode(i,t)};var Fi=Jt$2.assert;function kt(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var Ti=kt;kt.fromPublic=function(e,t,r){return t instanceof kt?t:new kt(e,{pub:t,pubEnc:r})},kt.fromPrivate=function(e,t,r){return t instanceof kt?t:new kt(e,{priv:t,privEnc:r})},kt.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},kt.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},kt.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},kt.prototype._importPrivate=function(e,t){this.priv=new K$3(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},kt.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?Fi(e.x,"Need x coordinate"):("short"===this.ec.curve.type||"edwards"===this.ec.curve.type)&&Fi(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},kt.prototype.derive=function(e){return e.validate()||Fi(e.validate(),"public point not validated"),e.mul(this.priv).getX()},kt.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},kt.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},kt.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var qa=Jt$2.assert;function Hr(e,t){if(e instanceof Hr)return e;this._importDER(e,t)||(qa(e.r&&e.s,"Signature without r or s"),this.r=new K$3(e.r,16),this.s=new K$3(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var zr=Hr;function Ka(){this.place=0}function Ui(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var o=0,i=0,s=t.place;i<n;i++,s++)o<<=8,o|=e[s],o>>>=0;return!(o<=127)&&(t.place=s,o)}function Of(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function ki(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}Hr.prototype._importDER=function(e,t){e=Jt$2.toArray(e,t);var r=new Ka;if(48!==e[r.place++])return!1;var n=Ui(e,r);if(!1===n||n+r.place!==e.length||2!==e[r.place++])return!1;var o=Ui(e,r);if(!1===o)return!1;var i=e.slice(r.place,o+r.place);if(r.place+=o,2!==e[r.place++])return!1;var s=Ui(e,r);if(!1===s||e.length!==s+r.place)return!1;var a=e.slice(r.place,s+r.place);if(0===i[0]){if(!(128&i[1]))return!1;i=i.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new K$3(i),this.s=new K$3(a),this.recoveryParam=null,!0},Hr.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=Of(t),r=Of(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];ki(n,t.length),(n=n.concat(t)).push(2),ki(n,r.length);var o=n.concat(r),i=[48];return ki(i,o.length),i=i.concat(o),Jt$2.encode(i,e)};var Ha=function(){throw new Error("unsupported")},Pf=Jt$2.assert;function $t$1(e){if(!(this instanceof $t$1))return new $t$1(e);"string"==typeof e&&(Pf(Object.prototype.hasOwnProperty.call(Kr,e),"Unknown curve "+e),e=Kr[e]),e instanceof Kr.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var za=$t$1;$t$1.prototype.keyPair=function(e){return new Ti(this,e)},$t$1.prototype.keyFromPrivate=function(e,t){return Ti.fromPrivate(this,e,t)},$t$1.prototype.keyFromPublic=function(e,t){return Ti.fromPublic(this,e,t)},$t$1.prototype.genKeyPair=function(e){e||(e={});for(var t=new Rf({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Ha(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new K$3(2));;){var o=new K$3(t.generate(r));if(!(o.cmp(n)>0))return o.iaddn(1),this.keyFromPrivate(o)}},$t$1.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},$t$1.prototype.sign=function(e,t,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new K$3(e,16));for(var o=this.n.byteLength(),i=t.getPrivate().toArray("be",o),s=e.toArray("be",o),a=new Rf({hash:this.hash,entropy:i,nonce:s,pers:n.pers,persEnc:n.persEnc||"utf8"}),c=this.n.sub(new K$3(1)),u=0;;u++){var l=n.k?n.k(u):new K$3(a.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(c)>=0)){var d=this.g.mul(l);if(!d.isInfinity()){var h=d.getX(),f=h.umod(this.n);if(0!==f.cmpn(0)){var p=l.invm(this.n).mul(f.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(d.getY().isOdd()?1:0)|(0!==h.cmp(f)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new zr({r:f,s:p,recoveryParam:m})}}}}}},$t$1.prototype.verify=function(e,t,r,n){e=this._truncateToN(new K$3(e,16)),r=this.keyFromPublic(r,n);var o=(t=new zr(t,"hex")).r,i=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;var s,a=i.invm(this.n),c=a.mul(e).umod(this.n),u=a.mul(o).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(c,r.getPublic(),u)).isInfinity()&&s.eqXToP(o):!(s=this.g.mulAdd(c,r.getPublic(),u)).isInfinity()&&0===s.getX().umod(this.n).cmp(o)},$t$1.prototype.recoverPubKey=function(e,t,r,n){Pf((3&r)===r,"The recovery param is more than two bits"),t=new zr(t,n);var o=this.n,i=new K$3(e),s=t.r,a=t.s,c=1&r,u=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");s=u?this.curve.pointFromX(s.add(this.curve.n),c):this.curve.pointFromX(s,c);var l=t.r.invm(o),d=o.sub(i).mul(l).umod(o),h=a.mul(l).umod(o);return this.g.mulAdd(d,s,h)},$t$1.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new zr(t,n)).recoveryParam)return t.recoveryParam;for(var o=0;o<4;o++){var i;try{i=this.recoverPubKey(e,t,o)}catch{continue}if(i.eq(r))return o}throw new Error("Unable to find valid recovery factor")};var La=cr$1((function(e,t){var r=t;r.version="6.5.4",r.utils=Jt$2,r.rand=function(){throw new Error("unsupported")},r.curve=qr,r.curves=Kr,r.ec=za,r.eddsa=null})),ja=La.ec;const Qa="signing-key/5.7.0",qi=new L$6(Qa);let Ki=null;function ve$1(){return Ki||(Ki=new ja("secp256k1")),Ki}class Ja{constructor(e){br(this,"curve","secp256k1"),br(this,"privateKey",Kt$1(e)),32!==N0(this.privateKey)&&qi.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=ve$1().keyFromPrivate(Ot$1(this.privateKey));br(this,"publicKey","0x"+t.getPublic(!1,"hex")),br(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),br(this,"_isSigningKey",!0)}_addPoint(e){const t=ve$1().keyFromPublic(Ot$1(this.publicKey)),r=ve$1().keyFromPublic(Ot$1(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=ve$1().keyFromPrivate(Ot$1(this.privateKey)),r=Ot$1(e);32!==r.length&&qi.throwArgumentError("bad digest length","digest",e);const n=t.sign(r,{canonical:!0});return zn({recoveryParam:n.recoveryParam,r:oe$3("0x"+n.r.toString(16),32),s:oe$3("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const t=ve$1().keyFromPrivate(Ot$1(this.privateKey)),r=ve$1().keyFromPublic(Ot$1(Df(e)));return oe$3("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!(!e||!e._isSigningKey)}}function Ga(e,t){const r=zn(t),n={r:Ot$1(r.r),s:Ot$1(r.s)};return"0x"+ve$1().recoverPubKey(Ot$1(e),n,r.recoveryParam).encode("hex",!1)}function Df(e,t){const r=Ot$1(e);if(32===r.length){return new Ja(r).publicKey}return 33===r.length?"0x"+ve$1().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?Kt$1(r):qi.throwArgumentError("invalid public or private key","key","[REDACTED]")}var Ff;function Va(e){return ns$1(Hn(yi(Hn(Df(e),1)),12))}function Wa(e,t){return Va(Ga(Ot$1(e),t))}!function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(Ff||(Ff={}));const Xa="https://rpc.walletconnect.com/v1";async function Tf(e,t,r,n,o,i){switch(r.t){case"eip191":return Uf(e,t,r.s);case"eip1271":return await kf(e,t,r.s,n,o,i);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function Uf(e,t,r){return Wa(ff(t),r).toLowerCase()===e.toLowerCase()}async function kf(e,t,r,n,o,i){try{const s="0x1626ba7e",a="0000000000000000000000000000000000000000000000000000000000000040",c="0000000000000000000000000000000000000000000000000000000000000041",u=r.substring(2),l=s+ff(t).substring(2)+a+c+u,d=await fetch(`${i||Xa}/?chainId=${n}&projectId=${o}`,{method:"POST",body:JSON.stringify({id:Za(),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:l},"latest"]})}),{result:h}=await d.json();return!!h&&h.slice(0,s.length).toLowerCase()===s.toLowerCase()}catch(s){return console.error("isValidEip1271Signature: ",s),!1}}function Za(){return Date.now()+Math.floor(1e3*Math.random())}var $a=Object.defineProperty,tu=Object.defineProperties,eu=Object.getOwnPropertyDescriptors,qf=Object.getOwnPropertySymbols,ru=Object.prototype.hasOwnProperty,iu=Object.prototype.propertyIsEnumerable,Kf=(e,t,r)=>t in e?$a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Hi=(e,t)=>{for(var r in t||(t={}))ru.call(t,r)&&Kf(e,r,t[r]);if(qf)for(var r of qf(t))iu.call(t,r)&&Kf(e,r,t[r]);return e},Hf=(e,t)=>tu(e,eu(t));const nu="did:pkh:",Lr=e=>null==e?void 0:e.split(":"),zi=e=>{const t=e&&Lr(e);if(t)return e.includes(nu)?t[3]:t[1]},fu=e=>{const t=e&&Lr(e);if(t)return t[2]+":"+t[3]},Li=e=>{const t=e&&Lr(e);if(t)return t.pop()};async function ou(e){const{cacao:t,projectId:r}=e,{s:n,p:o}=t,i=zf(o,o.iss),s=Li(o.iss);return await Tf(s,i,n,zi(o.iss),r)}const zf=(e,t)=>{const r=`${e.domain} wants you to sign in with your Ethereum account:`,n=Li(t);if(!e.aud&&!e.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let o=e.statement||void 0;const i=`URI: ${e.aud||e.uri}`,s=`Version: ${e.version}`,a=`Chain ID: ${zi(t)}`,c=`Nonce: ${e.nonce}`,u=`Issued At: ${e.iat}`,l=e.exp?`Expiration Time: ${e.exp}`:void 0,d=e.nbf?`Not Before: ${e.nbf}`:void 0,h=e.requestId?`Request ID: ${e.requestId}`:void 0,f=e.resources?`Resources:${e.resources.map((e=>`\n- ${e}`)).join("")}`:void 0,p=Qr(e.resources);if(p){o=Ji(o,Oe$1(p))}return[r,n,"",o,"",i,s,a,c,u,l,d,h,f].filter((e=>null!=e)).join("\n")};function Jf(e){return Buffer$2.from(JSON.stringify(e)).toString("base64")}function Gf(e){return JSON.parse(Buffer$2.from(e,"base64").toString("utf-8"))}function me$1(e){if(!e)throw new Error("No recap provided, value is undefined");if(!e.att)throw new Error("No `att` property found");const t=Object.keys(e.att);if(null==t||!t.length)throw new Error("No resources found in `att` property");t.forEach((t=>{const r=e.att[t];if(Array.isArray(r))throw new Error(`Resource must be an object: ${t}`);if("object"!=typeof r)throw new Error(`Resource must be an object: ${t}`);if(!Object.keys(r).length)throw new Error(`Resource object is empty: ${t}`);Object.keys(r).forEach((e=>{const t=r[e];if(!Array.isArray(t))throw new Error(`Ability limits ${e} must be an array of objects, found: ${t}`);if(!t.length)throw new Error(`Value of ${e} is empty array, must be an array with objects`);t.forEach((t=>{if("object"!=typeof t)throw new Error(`Ability limits (${e}) must be an array of objects, found: ${t}`)}))}))}))}function Yf(e,t,r,n={}){return null==r||r.sort(((e,t)=>e.localeCompare(t))),{att:{[e]:ji(t,r,n)}}}function ji(e,t,r={}){const n=(t=null==t?void 0:t.sort(((e,t)=>e.localeCompare(t)))).map((t=>({[`${e}/${t}`]:[r]})));return Object.assign({},...n)}function jr(e){return me$1(e),`urn:recap:${Jf(e).replace(/=/g,"")}`}function Oe$1(e){const t=Gf(e.replace("urn:recap:",""));return me$1(t),t}function cu(e,t,r){return jr(Yf(e,t,r))}function Qi(e){return e&&e.includes("urn:recap:")}function lu(e,t){return jr(Wf(Oe$1(e),Oe$1(t)))}function Wf(e,t){me$1(e),me$1(t);const r=Object.keys(e.att).concat(Object.keys(t.att)).sort(((e,t)=>e.localeCompare(t))),n={att:{}};return r.forEach((r=>{var o,i;Object.keys((null==(o=e.att)?void 0:o[r])||{}).concat(Object.keys((null==(i=t.att)?void 0:i[r])||{})).sort(((e,t)=>e.localeCompare(t))).forEach((o=>{var i,s;n.att[r]=Hf(Hi({},n.att[r]),{[o]:(null==(i=e.att[r])?void 0:i[o])||(null==(s=t.att[r])?void 0:s[o])})}))})),n}function Ji(e="",t){me$1(t);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(e.includes(r))return e;const n=[];let o=0;Object.keys(t.att).forEach((e=>{const r=Object.keys(t.att[e]).map((e=>({ability:e.split("/")[0],action:e.split("/")[1]})));r.sort(((e,t)=>e.action.localeCompare(t.action)));const i={};r.forEach((e=>{i[e.ability]||(i[e.ability]=[]),i[e.ability].push(e.action)}));const s=Object.keys(i).map((t=>(o++,`(${o}) '${t}': '${i[t].join("', '")}' for '${e}'.`)));n.push(s.join(", ").replace(".,","."))}));return`${e?e+" ":""}${`${r}${n.join(" ")}`}`}function du(e){var t;const r=Oe$1(e);me$1(r);const n=null==(t=r.att)?void 0:t.eip155;return n?Object.keys(n).map((e=>e.split("/")[1])):[]}function pu(e){const t=Oe$1(e);me$1(t);const r=[];return Object.values(t.att).forEach((e=>{Object.values(e).forEach((e=>{var t;null!=(t=null==e?void 0:e[0])&&t.chains&&r.push(e[0].chains)}))})),[...new Set(r.flat())]}function Qr(e){if(!e)return;const t=null==e?void 0:e[e.length-1];return Qi(t)?t:void 0}const zt$1="base16",Gr="utf8",lr=1;function bu(e){return toString$1(sha256.hash(fromString$1(e,zt$1)),zt$1)}function yu(e){return toString$1(sha256.hash(fromString$1(e,Gr)),zt$1)}function $e$1(e){const t=[];return e.forEach((e=>{const[r,n]=e.split(":");t.push(`${r}:${n}`)})),t}function co$1(e){const t=[];return Object.values(e).forEach((e=>{t.push(...$e$1(e.accounts))})),t}function lo(e,t){const r=[];return Object.values(e).forEach((e=>{$e$1(e.accounts).includes(t)&&r.push(...e.methods)})),r}function po$1(e,t){const r=[];return Object.values(e).forEach((e=>{$e$1(e.accounts).includes(t)&&r.push(...e.events)})),r}function mo(e){const t={};return null==e||e.forEach((e=>{const[r,n]=e.split(":");t[r]||(t[r]={accounts:[],chains:[],events:[]}),t[r].accounts.push(e),t[r].chains.push(`${r}:${n}`)})),t}function ju(e,t){const r=mo(t=t.map((e=>e.replace("did:pkh:",""))));for(const[n,o]of Object.entries(r))o.methods?o.methods=ge(o.methods,e):o.methods=e,o.events=["chainChanged","accountsChanged"];return r}const go$1={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}},Ao$1={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 xe$1(e,t){const{message:r,code:n}=Ao$1[e];return{message:t?`${r} ${t}`:r,code:n}}function tr(e,t){const{message:r,code:n}=go$1[e];return{message:t?`${r} ${t}`:r,code:n}}function Er(e,t){return!!Array.isArray(e)}function Yr(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function Pe$1(e){return typeof e>"u"}function Gt$1(e,t){return!(!t||!Pe$1(e))||"string"==typeof e&&!!e.trim().length}function Vr(e,t){return"number"==typeof e&&!isNaN(e)}function Qu(e,t){const{requiredNamespaces:r}=t,n=Object.keys(e.namespaces),o=Object.keys(r);let i=!0;return!!_e$2(o,n)&&(n.forEach((t=>{const{accounts:n,methods:o,events:s}=e.namespaces[t],a=$e$1(n),c=r[t];_e$2(_r(t,c),a)&&_e$2(c.methods,o)&&_e$2(c.events,s)||(i=!1)})),i)}function Sr(e){return!(!Gt$1(e,!1)||!e.includes(":"))&&2===e.split(":").length}function bo(e){if(Gt$1(e,!1)&&e.includes(":")){const t=e.split(":");if(3===t.length){const e=t[0]+":"+t[1];return!!t[2]&&Sr(e)}}return!1}function Vu(e,t){let r=null;return Gt$1(null==e?void 0:e.publicKey,!1)||(r=xe$1("MISSING_OR_INVALID",`${t} controller public key should be a string`)),r}function tn(e){let t=!0;return Er(e)?e.length&&(t=e.every((e=>Gt$1(e,!1)))):t=!1,t}function yo(e,t,r){let n=null;return Er(t)&&t.length?t.forEach((e=>{n||Sr(e)||(n=tr("UNSUPPORTED_CHAINS",`${r}, chain ${e} should be a string and conform to "namespace:chainId" format`))})):Sr(e)||(n=tr("UNSUPPORTED_CHAINS",`${r}, 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 wo$1(e,t,r){let n=null;return Object.entries(e).forEach((([e,o])=>{if(n)return;const i=yo(e,_r(e,o),`${t} ${r}`);i&&(n=i)})),n}function xo$1(e,t){let r=null;return Er(e)?e.forEach((e=>{r||bo(e)||(r=tr("UNSUPPORTED_ACCOUNTS",`${t}, account ${e} should be a string and conform to "namespace:chainId:address" format`))})):r=tr("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function Mo$1(e,t){let r=null;return Object.values(e).forEach((e=>{if(r)return;const n=xo$1(null==e?void 0:e.accounts,`${t} namespace`);n&&(r=n)})),r}function Eo$1(e,t){let r=null;return tn(null==e?void 0:e.methods)?tn(null==e?void 0:e.events)||(r=tr("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):r=tr("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),r}function en$1(e,t){let r=null;return Object.values(e).forEach((e=>{if(r)return;const n=Eo$1(e,`${t}, namespace`);n&&(r=n)})),r}function Wu(e,t,r){let n=null;if(e&&Yr(e)){const o=en$1(e,t);o&&(n=o);const i=wo$1(e,t,r);i&&(n=i)}else n=xe$1("MISSING_OR_INVALID",`${t}, ${r} should be an object with data`);return n}function So$1(e,t){let r=null;if(e&&Yr(e)){const n=en$1(e,t);n&&(r=n);const o=Mo$1(e,t);o&&(r=o)}else r=xe$1("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return r}function No$1(e){return Gt$1(e.protocol,!0)}function Xu(e,t){let r=!1;return e?e&&Er(e)&&e.length&&e.forEach((e=>{r=No$1(e)})):r=!0,r}function Zu(e){return"number"==typeof e}function $u(e){return typeof e<"u"&&null!==typeof e}function th(e){return!!(e&&"object"==typeof e&&e.code&&Vr(e.code)&&e.message&&Gt$1(e.message,!1))}function eh(e){return!(Pe$1(e)||!Gt$1(e.method,!1))}function rh(e){return!(Pe$1(e)||Pe$1(e.result)&&Pe$1(e.error)||!Vr(e.id)||!Gt$1(e.jsonrpc,!1))}function ih(e){return!(Pe$1(e)||!Gt$1(e.name,!1))}function nh(e,t){return!(!Sr(t)||!co$1(e).includes(t))}function fh(e,t,r){return!!Gt$1(r,!1)&&lo(e,t).includes(r)}function oh(e,t,r){return!!Gt$1(r,!1)&&po$1(e,t).includes(r)}function Io$1(e,t,r){let n=null;const o=sh(e),i=ah(t),s=Object.keys(o),a=Object.keys(i),c=_o(Object.keys(e)),u=_o(Object.keys(t)),l=c.filter((e=>!u.includes(e)));return l.length&&(n=xe$1("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces.\n Required: ${l.toString()}\n Received: ${Object.keys(t).toString()}`)),_e$2(s,a)||(n=xe$1("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces.\n Required: ${s.toString()}\n Approved: ${a.toString()}`)),Object.keys(t).forEach((e=>{if(!e.includes(":")||n)return;const o=$e$1(t[e].accounts);o.includes(e)||(n=xe$1("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${e}\n Required: ${e}\n Approved: ${o.toString()}`))})),s.forEach((e=>{n||(_e$2(o[e].methods,i[e].methods)?_e$2(o[e].events,i[e].events)||(n=xe$1("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${e}`)):n=xe$1("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${e}`))})),n}function sh(e){const t={};return Object.keys(e).forEach((r=>{var n;r.includes(":")?t[r]=e[r]:null==(n=e[r].chains)||n.forEach((n=>{t[n]={methods:e[r].methods,events:e[r].events}}))})),t}function _o(e){return[...new Set(e.map((e=>e.includes(":")?e.split(":")[0]:e)))]}function ah(e){const t={};return Object.keys(e).forEach((r=>{if(r.includes(":"))t[r]=e[r];else{const n=$e$1(e[r].accounts);null==n||n.forEach((n=>{t[n]={accounts:e[r].accounts.filter((e=>e.includes(`${n}:`))),methods:e[r].methods,events:e[r].events}}))}})),t}function uh(e,t){return Vr(e)&&e<=t.max&&e>=t.min}const rn={};class lh{static get(e){return rn[e]}static set(e,t){rn[e]=t}static delete(e){delete rn[e]}}const Ee$1="wc",Se=2,_e$1="client",ie$1=`${Ee$1}@${Se}:${_e$1}:`,re$1={name:_e$1,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},fe$1="WALLETCONNECT_DEEPLINK_CHOICE",Ue$1="proposal",Ge$1="Proposal expired",ke$1="session",$$4=cjs$a.SEVEN_DAYS,je$1="engine",R$3={wc_sessionPropose:{req:{ttl:cjs$a.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:cjs$a.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:cjs$a.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:cjs$a.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:cjs$a.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:cjs$a.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:cjs$a.ONE_DAY,prompt:!1,tag:1104},res:{ttl:cjs$a.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:cjs$a.ONE_DAY,prompt:!1,tag:1106},res:{ttl:cjs$a.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:cjs$a.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:cjs$a.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:cjs$a.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:cjs$a.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:cjs$a.ONE_DAY,prompt:!1,tag:1112},res:{ttl:cjs$a.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:cjs$a.ONE_DAY,prompt:!1,tag:1114},res:{ttl:cjs$a.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:cjs$a.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:cjs$a.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:cjs$a.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:cjs$a.FIVE_MINUTES,prompt:!1,tag:1119}}},ne$2={min:cjs$a.FIVE_MINUTES,max:cjs$a.SEVEN_DAYS},D$5={idle:"IDLE",active:"ACTIVE"},Fe$1="request",Qe$1=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],ze$1="wc",He$1="auth",Ye$1="authKeys",Xe="pairingTopics",Je="requests",J$2=`${ze$1}@1.5:${He$1}:`,B$4=`${J$2}:PUB_KEY`;var Yt$1=Object.defineProperty,Xt$1=Object.defineProperties,Jt$1=Object.getOwnPropertyDescriptors,Be$1=Object.getOwnPropertySymbols,Bt$1=Object.prototype.hasOwnProperty,Wt$1=Object.prototype.propertyIsEnumerable,We$1=(e,t,r)=>t in e?Yt$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,m$4=(e,t)=>{for(var r in t||(t={}))Bt$1.call(t,r)&&We$1(e,r,t[r]);if(Be$1)for(var r of Be$1(t))Wt$1.call(t,r)&&We$1(e,r,t[r]);return e},L$5=(e,t)=>Xt$1(e,Jt$1(t));let Zt$1=class extends w$5{constructor(e){super(e),this.name=je$1,this.events=new Ct$1,this.initialized=!1,this.requestQueue={state:D$5.idle,queue:[]},this.sessionRequestQueue={state:D$5.idle,queue:[]},this.requestQueueDelay=cjs$a.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(R$3)}),this.initialized=!0,setTimeout((()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()}),cjs$a.toMiliseconds(this.requestQueueDelay)))},this.connect=async e=>{await this.isInitialized();const t=L$5(m$4({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(t);const{pairingTopic:r,requiredNamespaces:n,optionalNamespaces:o,sessionProperties:i,relays:s}=t;let a,c=r,u=!1;try{c&&(u=this.client.core.pairing.pairings.get(c).active)}catch(b){throw this.client.logger.error(`connect() -> pairing.get(${c}) failed`),b}if(!c||!u){const{topic:e,uri:t}=await this.client.core.pairing.create();c=e,a=t}if(!c){const{message:e}=xe$1("NO_MATCHING_KEY",`connect() pairing topic: ${c}`);throw new Error(e)}const l=await this.client.core.crypto.generateKeyPair(),d=R$3.wc_sessionPropose.req.ttl||cjs$a.FIVE_MINUTES,h=d0(d),f=m$4({requiredNamespaces:n,optionalNamespaces:o,relays:s??[{protocol:at$1}],proposer:{publicKey:l,metadata:this.client.metadata},expiryTimestamp:h,pairingTopic:c},i&&{sessionProperties:i}),{reject:p,resolve:m,done:y}=a0(d,Ge$1);this.events.once(v0("session_connect"),(async({error:e,session:t})=>{if(e)p(e);else if(t){t.self.publicKey=l;const e=L$5(m$4({},t),{pairingTopic:f.pairingTopic,requiredNamespaces:f.requiredNamespaces,optionalNamespaces:f.optionalNamespaces});await this.client.session.set(t.topic,e),await this.setExpiry(t.topic,t.expiry),c&&await this.client.core.pairing.updateMetadata({topic:c,metadata:t.peer.metadata}),this.cleanupDuplicatePairings(e),m(e)}}));const g=await this.sendRequest({topic:c,method:"wc_sessionPropose",params:f,throwOnFailedPublish:!0});return await this.setProposal(g,m$4({id:g},f)),{uri:a,approval:y}},this.pair=async e=>{await this.isInitialized();try{return await this.client.core.pairing.pair(e)}catch(e2){throw this.client.logger.error("pair() failed"),e2}},this.approve=async e=>{await this.isInitialized();try{await this.isValidApprove(e)}catch(y){throw this.client.logger.error("approve() -> isValidApprove() failed"),y}const{id:t,relayProtocol:r,namespaces:n,sessionProperties:o,sessionConfig:i}=e;let s;try{s=this.client.proposal.get(t)}catch(y){throw this.client.logger.error(`approve() -> proposal.get(${t}) failed`),y}const{pairingTopic:a,proposer:c,requiredNamespaces:u,optionalNamespaces:l}=s,d=await this.client.core.crypto.generateKeyPair(),h=c.publicKey,f=await this.client.core.crypto.generateSharedKey(d,h),p=m$4(m$4({relay:{protocol:r??"irn"},namespaces:n,controller:{publicKey:d,metadata:this.client.metadata},expiry:d0($$4)},o&&{sessionProperties:o}),i&&{sessionConfig:i});await this.client.core.relayer.subscribe(f);const m=L$5(m$4({},p),{topic:f,requiredNamespaces:u,optionalNamespaces:l,pairingTopic:a,acknowledged:!1,self:p.controller,peer:{publicKey:c.publicKey,metadata:c.metadata},controller:d});await this.client.session.set(f,m);try{await this.sendResult({id:t,topic:a,result:{relay:{protocol:r??"irn"},responderPublicKey:d},throwOnFailedPublish:!0}),await this.sendRequest({topic:f,method:"wc_sessionSettle",params:p,throwOnFailedPublish:!0})}catch(y){throw this.client.logger.error(y),this.client.session.delete(f,tr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(f),y}return await this.client.core.pairing.updateMetadata({topic:a,metadata:c.metadata}),await this.client.proposal.delete(t,tr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:a}),await this.setExpiry(f,d0($$4)),{topic:f,acknowledged:()=>new Promise((e=>setTimeout((()=>e(this.client.session.get(f))),500)))}},this.reject=async e=>{await this.isInitialized();try{await this.isValidReject(e)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:t,reason:r}=e;let n;try{n=this.client.proposal.get(t).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${t}) failed`),o}n&&(await this.sendError({id:t,topic:n,error:r,rpcOpts:R$3.wc_sessionPropose.reject}),await this.client.proposal.delete(t,tr("USER_DISCONNECTED")))},this.update=async e=>{await this.isInitialized();try{await this.isValidUpdate(e)}catch(u){throw this.client.logger.error("update() -> isValidUpdate() failed"),u}const{topic:t,namespaces:r}=e,{done:n,resolve:o,reject:i}=a0(),s=payloadId(),a=getBigIntRpcId().toString(),c=this.client.session.get(t).namespaces;return this.events.once(v0("session_update",s),(({error:e})=>{e?i(e):o()})),await this.client.session.update(t,{namespaces:r}),await this.sendRequest({topic:t,method:"wc_sessionUpdate",params:{namespaces:r},throwOnFailedPublish:!0,clientRpcId:s,relayRpcId:a}).catch((e=>{this.client.logger.error(e),this.client.session.update(t,{namespaces:c}),i(e)})),{acknowledged:n}},this.extend=async e=>{await this.isInitialized();try{await this.isValidExtend(e)}catch(s){throw this.client.logger.error("extend() -> isValidExtend() failed"),s}const{topic:t}=e,r=payloadId(),{done:n,resolve:o,reject:i}=a0();return this.events.once(v0("session_extend",r),(({error:e})=>{e?i(e):o()})),await this.setExpiry(t,d0($$4)),this.sendRequest({topic:t,method:"wc_sessionExtend",params:{},clientRpcId:r,throwOnFailedPublish:!0}).catch((e=>{i(e)})),{acknowledged:n}},this.request=async e=>{await this.isInitialized();try{await this.isValidRequest(e)}catch(d){throw this.client.logger.error("request() -> isValidRequest() failed"),d}const{chainId:t,request:r,topic:n,expiry:o=R$3.wc_sessionRequest.req.ttl}=e,i=this.client.session.get(n),s=payloadId(),a=getBigIntRpcId().toString(),{done:c,resolve:u,reject:l}=a0(o,"Request expired. Please try again.");return this.events.once(v0("session_request",s),(({error:e,result:t})=>{e?l(e):u(t)})),await Promise.all([new Promise((async e=>{await this.sendRequest({clientRpcId:s,relayRpcId:a,topic:n,method:"wc_sessionRequest",params:{request:L$5(m$4({},r),{expiryTimestamp:d0(o)}),chainId:t},expiry:o,throwOnFailedPublish:!0}).catch((e=>l(e))),this.client.events.emit("session_request_sent",{topic:n,request:r,chainId:t,id:s}),e()})),new Promise((async e=>{var t;if(null==(t=i.sessionConfig)||!t.disableDeepLink){const e=await g0(this.client.core.storage,fe$1);m0({id:s,topic:n,wcDeepLink:e})}e()})),c()]).then((e=>e[2]))},this.respond=async e=>{await this.isInitialized(),await this.isValidRespond(e);const{topic:t,response:r}=e,{id:n}=r;isJsonRpcResult(r)?await this.sendResult({id:n,topic:t,result:r.result,throwOnFailedPublish:!0}):isJsonRpcError(r)&&await this.sendError({id:n,topic:t,error:r.error}),this.cleanupAfterResponse(e)},this.ping=async e=>{await this.isInitialized();try{await this.isValidPing(e)}catch(r){throw this.client.logger.error("ping() -> isValidPing() failed"),r}const{topic:t}=e;if(this.client.session.keys.includes(t)){const e=payloadId(),r=getBigIntRpcId().toString(),{done:n,resolve:o,reject:i}=a0();this.events.once(v0("session_ping",e),(({error:e})=>{e?i(e):o()})),await Promise.all([this.sendRequest({topic:t,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:e,relayRpcId:r}),n()])}else this.client.core.pairing.pairings.keys.includes(t)&&await this.client.core.pairing.ping({topic:t})},this.emit=async e=>{await this.isInitialized(),await this.isValidEmit(e);const{topic:t,event:r,chainId:n}=e,o=getBigIntRpcId().toString();await this.sendRequest({topic:t,method:"wc_sessionEvent",params:{event:r,chainId:n},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async e=>{await this.isInitialized(),await this.isValidDisconnect(e);const{topic:t}=e;if(this.client.session.keys.includes(t))await this.sendRequest({topic:t,method:"wc_sessionDelete",params:tr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:t,emitEvent:!1});else{if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:e}=xe$1("MISMATCHED_TOPIC",`Session or pairing topic not found: ${t}`);throw new Error(e)}await this.client.core.pairing.disconnect({topic:t})}},this.find=e=>(this.isInitialized(),this.client.session.getAll().filter((t=>Qu(t,e)))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async e=>{this.isInitialized(),this.isValidAuthenticate(e);const{chains:t,statement:r="",uri:n,domain:o,nonce:i,type:s,exp:a,nbf:c,methods:u=[],expiry:l}=e,d=[...e.resources||[]],{topic:h,uri:f}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"]});this.client.logger.info({message:"Generated new pairing",pairing:{topic:h,uri:f}});const p=await this.client.core.crypto.generateKeyPair(),m=bu(p);if(await Promise.all([this.client.auth.authKeys.set(B$4,{responseTopic:m,publicKey:p}),this.client.auth.pairingTopics.set(m,{topic:m,pairingTopic:h})]),await this.client.core.relayer.subscribe(m),this.client.logger.info(`sending request to new pairing topic: ${h}`),u.length>0){const{namespace:e}=dn(t[0]);let r=cu(e,"request",u);Qr(d)&&(r=lu(r,d.pop())),d.push(r)}const y=l&&l>R$3.wc_sessionAuthenticate.req.ttl?l:R$3.wc_sessionAuthenticate.req.ttl,g={authPayload:{type:s??"caip122",chains:t,statement:r,aud:n,domain:o,version:"1",nonce:i,iat:(new Date).toISOString(),exp:a,nbf:c,resources:d},requester:{publicKey:p,metadata:this.client.metadata},expiryTimestamp:d0(y)},b={requiredNamespaces:{},optionalNamespaces:{eip155:{chains:t,methods:[...new Set(["personal_sign",...u])],events:["chainChanged","accountsChanged"]}},relays:[{protocol:"irn"}],pairingTopic:h,proposer:{publicKey:p,metadata:this.client.metadata},expiryTimestamp:d0(R$3.wc_sessionPropose.req.ttl)},{done:w,resolve:v,reject:_}=a0(y,"Request expired"),A=async({error:e,session:t})=>{if(this.events.off(v0("session_request",T),I),e)_(e);else if(t){t.self.publicKey=p,await this.client.session.set(t.topic,t),await this.setExpiry(t.topic,t.expiry),h&&await this.client.core.pairing.updateMetadata({topic:h,metadata:t.peer.metadata});const e=this.client.session.get(t.topic);await this.deleteProposal(k),v({session:e})}},I=async e=>{if(await this.deletePendingAuthRequest(T,{message:"fulfilled",code:0}),e.error){const t=tr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return e.error.code===t.code?void 0:(this.events.off(v0("session_connect"),A),_(e.error.message))}await this.deleteProposal(k),this.events.off(v0("session_connect"),A);const{cacaos:t,responder:r}=e.result,n=[],o=[];for(const a of t){await ou({cacao:a,projectId:this.client.core.projectId})||(this.client.logger.error(a,"Signature verification failed"),_(tr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:e}=a,t=Qr(e.resources),r=[fu(e.iss)],i=Li(e.iss);if(t){const e=du(t),o=pu(t);n.push(...e),r.push(...o)}for(const n of r)o.push(`${n}:${i}`)}const i=await this.client.core.crypto.generateSharedKey(p,r.publicKey);let s;n.length>0&&(s={topic:i,acknowledged:!0,self:{publicKey:p,metadata:this.client.metadata},peer:r,controller:r.publicKey,expiry:d0($$4),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:h,namespaces:ju([...new Set(n)],[...new Set(o)])},await this.client.core.relayer.subscribe(i),await this.client.session.set(i,s),h&&await this.client.core.pairing.updateMetadata({topic:h,metadata:r.metadata}),s=this.client.session.get(i)),v({auths:t,session:s})},T=payloadId(),k=payloadId();this.events.once(v0("session_connect"),A),this.events.once(v0("session_request",T),I);try{await Promise.all([this.sendRequest({topic:h,method:"wc_sessionAuthenticate",params:g,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:T}),this.sendRequest({topic:h,method:"wc_sessionPropose",params:b,expiry:R$3.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:k})])}catch(S){throw this.events.off(v0("session_connect"),A),this.events.off(v0("session_request",T),I),S}return await this.setProposal(k,m$4({id:k},b)),await this.setAuthRequest(T,{request:L$5(m$4({},g),{verifyContext:{}}),pairingTopic:h}),{uri:f,response:w}},this.approveSessionAuthenticate=async e=>{this.isInitialized();const{id:t,auths:r}=e,n=this.getPendingAuthRequest(t);if(!n)throw new Error(`Could not find pending auth request with id ${t}`);const o=n.requester.publicKey,i=await this.client.core.crypto.generateKeyPair(),s=bu(o),a={type:lr,receiverPublicKey:o,senderPublicKey:i},c=[],u=[];for(const h of r){if(!(await ou({cacao:h,projectId:this.client.core.projectId}))){const e=tr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:t,topic:s,error:e,encodeOpts:a}),new Error(e.message)}const{p:e}=h,r=Qr(e.resources),n=[fu(e.iss)],o=Li(e.iss);if(r){const e=du(r),t=pu(r);c.push(...e),n.push(...t)}for(const t of n)u.push(`${t}:${o}`)}const l=await this.client.core.crypto.generateSharedKey(i,o);let d;return(null==c?void 0:c.length)>0&&(d={topic:l,acknowledged:!0,self:{publicKey:i,metadata:this.client.metadata},peer:{publicKey:o,metadata:n.requester.metadata},controller:o,expiry:d0($$4),authentication:r,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:n.pairingTopic,namespaces:ju([...new Set(c)],[...new Set(u)])},await this.client.core.relayer.subscribe(l),await this.client.session.set(l,d),await this.client.core.pairing.updateMetadata({topic:n.pairingTopic,metadata:n.requester.metadata})),await this.sendResult({topic:s,id:t,result:{cacaos:r,responder:{publicKey:i,metadata:this.client.metadata}},encodeOpts:a,throwOnFailedPublish:!0}),await this.client.auth.requests.delete(t,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:n.pairingTopic}),{session:d}},this.rejectSessionAuthenticate=async e=>{await this.isInitialized();const{id:t,reason:r}=e,n=this.getPendingAuthRequest(t);if(!n)throw new Error(`Could not find pending auth request with id ${t}`);const o=n.requester.publicKey,i=await this.client.core.crypto.generateKeyPair(),s=bu(o),a={type:lr,receiverPublicKey:o,senderPublicKey:i};await this.sendError({id:t,topic:s,error:r,encodeOpts:a,rpcOpts:R$3.wc_sessionAuthenticate.reject}),await this.client.auth.requests.delete(t,{message:"rejected",code:0}),await this.client.proposal.delete(t,tr("USER_DISCONNECTED"))},this.formatAuthMessage=e=>{this.isInitialized();const{request:t,iss:r}=e;return zf(t,r)},this.processRelayMessageCache=()=>{setTimeout((async()=>{if(0!==this.relayMessageCache.length)for(;this.relayMessageCache.length>0;)try{const e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(e){this.client.logger.error(e)}}),50)},this.cleanupDuplicatePairings=async e=>{if(e.pairingTopic)try{const t=this.client.core.pairing.pairings.get(e.pairingTopic),r=this.client.core.pairing.pairings.getAll().filter((r=>{var n,o;return(null==(n=r.peerMetadata)?void 0:n.url)&&(null==(o=r.peerMetadata)?void 0:o.url)===e.peer.metadata.url&&r.topic&&r.topic!==t.topic}));if(0===r.length)return;this.client.logger.info(`Cleaning up ${r.length} duplicate pairing(s)`),await Promise.all(r.map((e=>this.client.core.pairing.disconnect({topic:e.topic})))),this.client.logger.info("Duplicate pairings clean up finished")}catch(e2){this.client.logger.error(e2)}},this.deleteSession=async e=>{var t;const{topic:r,expirerHasDeleted:n=!1,emitEvent:o=!0,id:i=0}=e,{self:s}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await this.client.session.delete(r,tr("USER_DISCONNECTED")),this.addToRecentlyDeleted(r,"session"),this.client.core.crypto.keychain.has(s.publicKey)&&await this.client.core.crypto.deleteKeyPair(s.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),n||this.client.core.expirer.del(r),this.client.core.storage.removeItem(fe$1).catch((e=>this.client.logger.warn(e))),this.getPendingSessionRequests().forEach((e=>{e.topic===r&&this.deletePendingSessionRequest(e.id,tr("USER_DISCONNECTED"))})),r===(null==(t=this.sessionRequestQueue.queue[0])?void 0:t.topic)&&(this.sessionRequestQueue.state=D$5.idle),o&&this.client.events.emit("session_delete",{id:i,topic:r})},this.deleteProposal=async(e,t)=>{await Promise.all([this.client.proposal.delete(e,tr("USER_DISCONNECTED")),t?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")},this.deletePendingSessionRequest=async(e,t,r=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,t),r?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter((t=>t.id!==e)),r&&(this.sessionRequestQueue.state=D$5.idle,this.client.events.emit("session_request_expire",{id:e}))},this.deletePendingAuthRequest=async(e,t,r=!1)=>{await Promise.all([this.client.auth.requests.delete(e,t),r?Promise.resolve():this.client.core.expirer.del(e)])},this.setExpiry=async(e,t)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,t),await this.client.session.update(e,{expiry:t}))},this.setProposal=async(e,t)=>{this.client.core.expirer.set(e,d0(R$3.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,t)},this.setAuthRequest=async(e,t)=>{const{request:r,pairingTopic:n}=t;this.client.core.expirer.set(e,r.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:r.authPayload,requester:r.requester,expiryTimestamp:r.expiryTimestamp,id:e,pairingTopic:n,verifyContext:r.verifyContext})},this.setPendingSessionRequest=async e=>{const{id:t,topic:r,params:n,verifyContext:o}=e,i=n.request.expiryTimestamp||d0(R$3.wc_sessionRequest.req.ttl);this.client.core.expirer.set(t,i),await this.client.pendingRequest.set(t,{id:t,topic:r,params:n,verifyContext:o})},this.sendRequest=async e=>{const{topic:t,method:r,params:n,expiry:o,relayRpcId:i,clientRpcId:s,throwOnFailedPublish:a}=e,c=formatJsonRpcRequest(r,n,s);if(pr()&&Qe$1.includes(r)){const e=yu(JSON.stringify(c));this.client.core.verify.register({attestationId:e})}let u;try{u=await this.client.core.crypto.encode(t,c)}catch(d){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${t} failed`),d}const l=R$3[r].req;return o&&(l.ttl=o),i&&(l.id=i),this.client.core.history.set(t,c),a?(l.internal=L$5(m$4({},l.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(t,u,l)):this.client.core.relayer.publish(t,u,l).catch((e=>this.client.logger.error(e))),c.id},this.sendResult=async e=>{const{id:t,topic:r,result:n,throwOnFailedPublish:o,encodeOpts:i}=e,s=formatJsonRpcResult(t,n);let a,c;try{a=await this.client.core.crypto.encode(r,s,i)}catch(l){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${r} failed`),l}try{c=await this.client.core.history.get(r,t)}catch(l){throw this.client.logger.error(`sendResult() -> history.get(${r}, ${t}) failed`),l}const u=R$3[c.request.method].res;o?(u.internal=L$5(m$4({},u.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(r,a,u)):this.client.core.relayer.publish(r,a,u).catch((e=>this.client.logger.error(e))),await this.client.core.history.resolve(s)},this.sendError=async e=>{const{id:t,topic:r,error:n,encodeOpts:o,rpcOpts:i}=e,s=formatJsonRpcError(t,n);let a,c;try{a=await this.client.core.crypto.encode(r,s,o)}catch(l){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${r} failed`),l}try{c=await this.client.core.history.get(r,t)}catch(l){throw this.client.logger.error(`sendError() -> history.get(${r}, ${t}) failed`),l}const u=i||R$3[c.request.method].res;this.client.core.relayer.publish(r,a,u),await this.client.core.history.resolve(s)},this.cleanup=async()=>{const e=[],t=[];this.client.session.getAll().forEach((t=>{let r=!1;p0(t.expiry)&&(r=!0),this.client.core.crypto.keychain.has(t.topic)||(r=!0),r&&e.push(t.topic)})),this.client.proposal.getAll().forEach((e=>{p0(e.expiryTimestamp)&&t.push(e.id)})),await Promise.all([...e.map((e=>this.deleteSession({topic:e}))),...t.map((e=>this.deleteProposal(e)))])},this.onRelayEventRequest=async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state!==D$5.active){for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=D$5.active;const e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(e2){this.client.logger.warn(e2)}}this.requestQueue.state=D$5.idle}else this.client.logger.info("Request queue already active, skipping...")},this.processRequest=async e=>{const{topic:t,payload:r}=e,n=r.method;if(!this.shouldIgnorePairingRequest({topic:t,requestMethod:n}))switch(n){case"wc_sessionPropose":return await this.onSessionProposeRequest(t,r);case"wc_sessionSettle":return await this.onSessionSettleRequest(t,r);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(t,r);case"wc_sessionExtend":return await this.onSessionExtendRequest(t,r);case"wc_sessionPing":return await this.onSessionPingRequest(t,r);case"wc_sessionDelete":return await this.onSessionDeleteRequest(t,r);case"wc_sessionRequest":return await this.onSessionRequest(t,r);case"wc_sessionEvent":return await this.onSessionEventRequest(t,r);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest(t,r);default:return this.client.logger.info(`Unsupported request method ${n}`)}},this.onRelayEventResponse=async e=>{const{topic:t,payload:r}=e,n=(await this.client.core.history.get(t,r.id)).request.method;switch(n){case"wc_sessionPropose":return this.onSessionProposeResponse(t,r);case"wc_sessionSettle":return this.onSessionSettleResponse(t,r);case"wc_sessionUpdate":return this.onSessionUpdateResponse(t,r);case"wc_sessionExtend":return this.onSessionExtendResponse(t,r);case"wc_sessionPing":return this.onSessionPingResponse(t,r);case"wc_sessionRequest":return this.onSessionRequestResponse(t,r);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(t,r);default:return this.client.logger.info(`Unsupported response method ${n}`)}},this.onRelayEventUnknownPayload=e=>{const{topic:t}=e,{message:r}=xe$1("MISSING_OR_INVALID",`Decoded payload on topic ${t} is not identifiable as a JSON-RPC request or a response.`);throw new Error(r)},this.shouldIgnorePairingRequest=e=>{const{topic:t,requestMethod:r}=e,n=this.expectedPairingMethodMap.get(t);return!(!n||n.includes(r))&&!!(n.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async(e,t)=>{const{params:r,id:n}=t;try{this.isValidConnect(m$4({},t.params));const o=r.expiryTimestamp||d0(R$3.wc_sessionPropose.req.ttl),i=m$4({id:n,pairingTopic:e,expiryTimestamp:o},r);await this.setProposal(n,i);const s=yu(JSON.stringify(t)),a=await this.getVerifyContext(s,i.proposer.metadata);this.client.events.emit("session_proposal",{id:n,params:i,verifyContext:a})}catch(o){await this.sendError({id:n,topic:e,error:o,rpcOpts:R$3.wc_sessionPropose.autoReject}),this.client.logger.error(o)}},this.onSessionProposeResponse=async(e,t)=>{const{id:r}=t;if(isJsonRpcResult(t)){const{result:n}=t;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:n});const o=this.client.proposal.get(r);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});const i=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:i});const s=n.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:s});const a=await this.client.core.crypto.generateSharedKey(i,s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:a});const c=await this.client.core.relayer.subscribe(a);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:c}),await this.client.core.pairing.activate({topic:e})}else if(isJsonRpcError(t)){await this.client.proposal.delete(r,tr("USER_DISCONNECTED"));const e=v0("session_connect");if(0===this.events.listenerCount(e))throw new Error(`emitting ${e} without any listeners, 954`);this.events.emit(v0("session_connect"),{error:t.error})}},this.onSessionSettleRequest=async(e,t)=>{const{id:r,params:n}=t;try{this.isValidSessionSettleRequest(n);const{relay:r,controller:o,expiry:i,namespaces:s,sessionProperties:a,sessionConfig:c}=t.params,u=m$4(m$4({topic:e,relay:r,expiry:i,namespaces:s,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:o.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:o.publicKey,metadata:o.metadata}},a&&{sessionProperties:a}),c&&{sessionConfig:c});await this.sendResult({id:t.id,topic:e,result:!0,throwOnFailedPublish:!0});const l=v0("session_connect");if(0===this.events.listenerCount(l))throw new Error(`emitting ${l} without any listeners 997`);this.events.emit(v0("session_connect"),{session:u})}catch(o){await this.sendError({id:r,topic:e,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(e,t)=>{const{id:r}=t;isJsonRpcResult(t)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(v0("session_approve",r),{})):isJsonRpcError(t)&&(await this.client.session.delete(e,tr("USER_DISCONNECTED")),this.events.emit(v0("session_approve",r),{error:t.error}))},this.onSessionUpdateRequest=async(e,t)=>{const{params:r,id:n}=t;try{const t=`${e}_session_update`,i=lh.get(t);if(i&&this.isRequestOutOfSync(i,n))return this.client.logger.info(`Discarding out of sync request - ${n}`),void this.sendError({id:n,topic:e,error:tr("INVALID_UPDATE_REQUEST")});this.isValidUpdate(m$4({topic:e},r));try{lh.set(t,n),await this.client.session.update(e,{namespaces:r.namespaces}),await this.sendResult({id:n,topic:e,result:!0,throwOnFailedPublish:!0})}catch(o){throw lh.delete(t),o}this.client.events.emit("session_update",{id:n,topic:e,params:r})}catch(i){await this.sendError({id:n,topic:e,error:i}),this.client.logger.error(i)}},this.isRequestOutOfSync=(e,t)=>parseInt(t.toString().slice(0,-3))<=parseInt(e.toString().slice(0,-3)),this.onSessionUpdateResponse=(e,t)=>{const{id:r}=t,n=v0("session_update",r);if(0===this.events.listenerCount(n))throw new Error(`emitting ${n} without any listeners`);isJsonRpcResult(t)?this.events.emit(v0("session_update",r),{}):isJsonRpcError(t)&&this.events.emit(v0("session_update",r),{error:t.error})},this.onSessionExtendRequest=async(e,t)=>{const{id:r}=t;try{this.isValidExtend({topic:e}),await this.setExpiry(e,d0($$4)),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:r,topic:e})}catch(n){await this.sendError({id:r,topic:e,error:n}),this.client.logger.error(n)}},this.onSessionExtendResponse=(e,t)=>{const{id:r}=t,n=v0("session_extend",r);if(0===this.events.listenerCount(n))throw new Error(`emitting ${n} without any listeners`);isJsonRpcResult(t)?this.events.emit(v0("session_extend",r),{}):isJsonRpcError(t)&&this.events.emit(v0("session_extend",r),{error:t.error})},this.onSessionPingRequest=async(e,t)=>{const{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:r,topic:e})}catch(n){await this.sendError({id:r,topic:e,error:n}),this.client.logger.error(n)}},this.onSessionPingResponse=(e,t)=>{const{id:r}=t,n=v0("session_ping",r);if(0===this.events.listenerCount(n))throw new Error(`emitting ${n} without any listeners`);setTimeout((()=>{isJsonRpcResult(t)?this.events.emit(v0("session_ping",r),{}):isJsonRpcError(t)&&this.events.emit(v0("session_ping",r),{error:t.error})}),500)},this.onSessionDeleteRequest=async(e,t)=>{const{id:r}=t;try{this.isValidDisconnect({topic:e,reason:t.params}),await Promise.all([new Promise((t=>{this.client.core.relayer.once(f$3.publish,(async()=>{t(await this.deleteSession({topic:e,id:r}))}))})),this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:tr("USER_DISCONNECTED")})])}catch(n){this.client.logger.error(n)}},this.onSessionRequest=async(e,t)=>{var r;const{id:n,params:o}=t;try{await this.isValidRequest(m$4({topic:e},o));const t=yu(JSON.stringify(formatJsonRpcRequest("wc_sessionRequest",o,n))),i=this.client.session.get(e),s={id:n,topic:e,params:o,verifyContext:await this.getVerifyContext(t,i.peer.metadata)};await this.setPendingSessionRequest(s),null!=(r=this.client.signConfig)&&r.disableRequestQueue?this.emitSessionRequest(s):(this.addSessionRequestToSessionRequestQueue(s),this.processSessionRequestQueue())}catch(i){await this.sendError({id:n,topic:e,error:i}),this.client.logger.error(i)}},this.onSessionRequestResponse=(e,t)=>{const{id:r}=t,n=v0("session_request",r);if(0===this.events.listenerCount(n))throw new Error(`emitting ${n} without any listeners`);isJsonRpcResult(t)?this.events.emit(v0("session_request",r),{result:t.result}):isJsonRpcError(t)&&this.events.emit(v0("session_request",r),{error:t.error})},this.onSessionEventRequest=async(e,t)=>{const{id:r,params:n}=t;try{const t=`${e}_session_event_${n.event.name}`,o=lh.get(t);if(o&&this.isRequestOutOfSync(o,r))return void this.client.logger.info(`Discarding out of sync request - ${r}`);this.isValidEmit(m$4({topic:e},n)),this.client.events.emit("session_event",{id:r,topic:e,params:n}),lh.set(t,r)}catch(o){await this.sendError({id:r,topic:e,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(e,t)=>{const{id:r}=t;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:t}),isJsonRpcResult(t)?this.events.emit(v0("session_request",r),{result:t.result}):isJsonRpcError(t)&&this.events.emit(v0("session_request",r),{error:t.error})},this.onSessionAuthenticateRequest=async(e,t)=>{try{const{requester:r,authPayload:n,expiryTimestamp:o}=t.params,i=yu(JSON.stringify(t)),s=await this.getVerifyContext(i,this.client.metadata),a={requester:r,pairingTopic:e,id:t.id,authPayload:n,verifyContext:s,expiryTimestamp:o};await this.setAuthRequest(t.id,{request:a,pairingTopic:e}),this.client.events.emit("session_authenticate",{topic:e,params:t.params,id:t.id,verifyContext:s})}catch(r){this.client.logger.error(r);const n=t.params.requester.publicKey,o=await this.client.core.crypto.generateKeyPair(),i={type:lr,receiverPublicKey:n,senderPublicKey:o};await this.sendError({id:t.id,topic:e,error:r,encodeOpts:i,rpcOpts:R$3.wc_sessionAuthenticate.autoReject})}},this.addSessionRequestToSessionRequestQueue=e=>{this.sessionRequestQueue.queue.push(e)},this.cleanupAfterResponse=e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout((()=>{this.sessionRequestQueue.state=D$5.idle,this.processSessionRequestQueue()}),cjs$a.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:e,error:t})=>{const r=this.client.core.history.pending;r.length>0&&r.filter((t=>t.topic===e&&"wc_sessionRequest"===t.request.method)).forEach((e=>{const r=v0("session_request",e.request.id);if(0===this.events.listenerCount(r))throw new Error(`emitting ${r} without any listeners`);this.events.emit(v0("session_request",e.request.id),{error:t})}))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===D$5.active)return void this.client.logger.info("session request queue is already active.");const e=this.sessionRequestQueue.queue[0];if(e)try{this.sessionRequestQueue.state=D$5.active,this.emitSessionRequest(e)}catch(e2){this.client.logger.error(e2)}else this.client.logger.info("session request queue is empty.")},this.emitSessionRequest=e=>{this.client.events.emit("session_request",e)},this.onPairingCreated=e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;const t=this.client.proposal.getAll().find((t=>t.pairingTopic===e.topic));t&&this.onSessionProposeRequest(e.topic,formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces,relays:t.relays,proposer:t.proposer,sessionProperties:t.sessionProperties},t.id))},this.isValidConnect=async e=>{if(!$u(e)){const{message:t}=xe$1("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(t)}const{pairingTopic:t,requiredNamespaces:r,optionalNamespaces:n,sessionProperties:o,relays:i}=e;if(Pe$1(t)||await this.isValidPairingTopic(t),!Xu(i)){const{message:e}=xe$1("MISSING_OR_INVALID",`connect() relays: ${i}`);throw new Error(e)}!Pe$1(r)&&0!==Yr(r)&&this.validateNamespaces(r,"requiredNamespaces"),!Pe$1(n)&&0!==Yr(n)&&this.validateNamespaces(n,"optionalNamespaces"),Pe$1(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(e,t)=>{const r=Wu(e,"connect()",t);if(r)throw new Error(r.message)},this.isValidApprove=async e=>{if(!$u(e))throw new Error(xe$1("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:t,namespaces:r,relayProtocol:n,sessionProperties:o}=e;this.checkRecentlyDeleted(t),await this.isValidProposalId(t);const i=this.client.proposal.get(t),s=So$1(r,"approve()");if(s)throw new Error(s.message);const a=Io$1(i.requiredNamespaces,r,"approve()");if(a)throw new Error(a.message);if(!Gt$1(n,!0)){const{message:e}=xe$1("MISSING_OR_INVALID",`approve() relayProtocol: ${n}`);throw new Error(e)}Pe$1(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async e=>{if(!$u(e)){const{message:t}=xe$1("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(t)}const{id:t,reason:r}=e;if(this.checkRecentlyDeleted(t),await this.isValidProposalId(t),!th(r)){const{message:e}=xe$1("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(r)}`);throw new Error(e)}},this.isValidSessionSettleRequest=e=>{if(!$u(e)){const{message:t}=xe$1("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(t)}const{relay:t,controller:r,namespaces:n,expiry:o}=e;if(!No$1(t)){const{message:e}=xe$1("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(e)}const i=Vu(r,"onSessionSettleRequest()");if(i)throw new Error(i.message);const s=So$1(n,"onSessionSettleRequest()");if(s)throw new Error(s.message);if(p0(o)){const{message:e}=xe$1("EXPIRED","onSessionSettleRequest()");throw new Error(e)}},this.isValidUpdate=async e=>{if(!$u(e)){const{message:t}=xe$1("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(t)}const{topic:t,namespaces:r}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);const n=this.client.session.get(t),o=So$1(r,"update()");if(o)throw new Error(o.message);const i=Io$1(n.requiredNamespaces,r,"update()");if(i)throw new Error(i.message)},this.isValidExtend=async e=>{if(!$u(e)){const{message:t}=xe$1("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(t)}const{topic:t}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t)},this.isValidRequest=async e=>{if(!$u(e)){const{message:t}=xe$1("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(t)}const{topic:t,request:r,chainId:n,expiry:o}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);const{namespaces:i}=this.client.session.get(t);if(!nh(i,n)){const{message:e}=xe$1("MISSING_OR_INVALID",`request() chainId: ${n}`);throw new Error(e)}if(!eh(r)){const{message:e}=xe$1("MISSING_OR_INVALID",`request() ${JSON.stringify(r)}`);throw new Error(e)}if(!fh(i,n,r.method)){const{message:e}=xe$1("MISSING_OR_INVALID",`request() method: ${r.method}`);throw new Error(e)}if(o&&!uh(o,ne$2)){const{message:e}=xe$1("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${ne$2.min} and ${ne$2.max}`);throw new Error(e)}},this.isValidRespond=async e=>{var t;if(!$u(e)){const{message:t}=xe$1("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(t)}const{topic:r,response:n}=e;try{await this.isValidSessionTopic(r)}catch(o){throw null!=(t=null==e?void 0:e.response)&&t.id&&this.cleanupAfterResponse(e),o}if(!rh(n)){const{message:e}=xe$1("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(n)}`);throw new Error(e)}},this.isValidPing=async e=>{if(!$u(e)){const{message:t}=xe$1("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.isValidEmit=async e=>{if(!$u(e)){const{message:t}=xe$1("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(t)}const{topic:t,event:r,chainId:n}=e;await this.isValidSessionTopic(t);const{namespaces:o}=this.client.session.get(t);if(!nh(o,n)){const{message:e}=xe$1("MISSING_OR_INVALID",`emit() chainId: ${n}`);throw new Error(e)}if(!ih(r)){const{message:e}=xe$1("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw new Error(e)}if(!oh(o,n,r.name)){const{message:e}=xe$1("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw new Error(e)}},this.isValidDisconnect=async e=>{if(!$u(e)){const{message:t}=xe$1("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.isValidAuthenticate=e=>{const{chains:t,uri:r,domain:n,nonce:o}=e;if(!Array.isArray(t)||0===t.length)throw new Error("chains is required and must be a non-empty array");if(!Gt$1(r,!1))throw new Error("uri is required parameter");if(!Gt$1(n,!1))throw new Error("domain is required parameter");if(!Gt$1(o,!1))throw new Error("nonce is required parameter");if([...new Set(t.map((e=>dn(e).namespace)))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:i}=dn(t[0]);if("eip155"!==i)throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async(e,t)=>{const r={verified:{verifyUrl:t.verifyUrl||V$5,validation:"UNKNOWN",origin:t.url||""}};try{const n=await this.client.core.verify.resolve({attestationId:e,verifyUrl:t.verifyUrl});n&&(r.verified.origin=n.origin,r.verified.isScam=n.isScam,r.verified.validation=n.origin===new URL(t.url).origin?"VALID":"INVALID")}catch(n){this.client.logger.info(n)}return this.client.logger.info(`Verify context: ${JSON.stringify(r)}`),r},this.validateSessionProps=(e,t)=>{Object.values(e).forEach((e=>{if(!Gt$1(e,!1)){const{message:r}=xe$1("MISSING_OR_INVALID",`${t} must be in Record<string, string> format. Received: ${JSON.stringify(e)}`);throw new Error(r)}}))},this.getPendingAuthRequest=e=>{const t=this.client.auth.requests.get(e);return"object"==typeof t?t:void 0},this.addToRecentlyDeleted=(e,t)=>{if(this.recentlyDeletedMap.set(e,t),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let e=0;const t=this.recentlyDeletedLimit/2;for(const r of this.recentlyDeletedMap.keys()){if(e++>=t)break;this.recentlyDeletedMap.delete(r)}}},this.checkRecentlyDeleted=e=>{const t=this.recentlyDeletedMap.get(e);if(t){const{message:r}=xe$1("MISSING_OR_INVALID",`Record was recently deleted - ${t}: ${e}`);throw new Error(r)}}}async isInitialized(){if(!this.initialized){const{message:e}=xe$1("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(f$3.message,(e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)}))}async onRelayMessage(e){const{topic:t,message:r}=e,{publicKey:n}=this.client.auth.authKeys.keys.includes(B$4)?this.client.auth.authKeys.get(B$4):{responseTopic:void 0,publicKey:void 0},o=await this.client.core.crypto.decode(t,r,{receiverPublicKey:n});try{isJsonRpcRequest(o)?(this.client.core.history.set(t,o),this.onRelayEventRequest({topic:t,payload:o})):isJsonRpcResponse(o)?(await this.client.core.history.resolve(o),await this.onRelayEventResponse({topic:t,payload:o}),this.client.core.history.delete(t,o.id)):this.onRelayEventUnknownPayload({topic:t,payload:o})}catch(i){this.client.logger.error(i)}}registerExpirerEvents(){this.client.core.expirer.on(C$4.expired,(async e=>{const{topic:t,id:r}=l0(e.target);return r&&this.client.pendingRequest.keys.includes(r)?await this.deletePendingSessionRequest(r,xe$1("EXPIRED"),!0):r&&this.client.auth.requests.keys.includes(r)?await this.deletePendingAuthRequest(r,xe$1("EXPIRED"),!0):void(t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r})))}))}registerPairingEvents(){this.client.core.pairing.events.on(q$4.create,(e=>this.onPairingCreated(e))),this.client.core.pairing.events.on(q$4.delete,(e=>{this.addToRecentlyDeleted(e.topic,"pairing")}))}isValidPairingTopic(e){if(!Gt$1(e,!1)){const{message:t}=xe$1("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}=xe$1("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(p0(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=xe$1("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!Gt$1(e,!1)){const{message:t}=xe$1("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}=xe$1("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(p0(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:t}=xe$1("EXPIRED",`session topic: ${e}`);throw new Error(t)}if(!this.client.core.crypto.keychain.has(e)){const{message:t}=xe$1("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)){if(Gt$1(e,!1)){const{message:t}=xe$1("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}{const{message:t}=xe$1("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}this.isValidPairingTopic(e)}}async isValidProposalId(e){if(!Zu(e)){const{message:t}=xe$1("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=xe$1("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(p0(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:t}=xe$1("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}},es$1=class extends kt$2{constructor(e,t){super(e,t,Ue$1,ie$1),this.core=e,this.logger=t}};class Ze extends kt$2{constructor(e,t){super(e,t,ke$1,ie$1),this.core=e,this.logger=t}}class ts extends kt$2{constructor(e,t){super(e,t,Fe$1,ie$1,(e=>e.id)),this.core=e,this.logger=t}}class ss extends kt$2{constructor(e,t){super(e,t,Ye$1,J$2,(()=>B$4)),this.core=e,this.logger=t}}class is extends kt$2{constructor(e,t){super(e,t,Xe,J$2),this.core=e,this.logger=t}}class rs extends kt$2{constructor(e,t){super(e,t,Je,J$2,(e=>e.id)),this.core=e,this.logger=t}}class ns{constructor(e,t){this.core=e,this.logger=t,this.authKeys=new ss(this.core,this.logger),this.pairingTopics=new is(this.core,this.logger),this.requests=new rs(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}let oe$2=class e extends b$2{constructor(e){super(e),this.protocol=Ee$1,this.version=Se,this.name=re$1.name,this.events=new eventsExports.EventEmitter,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.removeAllListeners=e=>this.events.removeAllListeners(e),this.connect=async e=>{try{return await this.engine.connect(e)}catch(t){throw this.logger.error(t.message),t}},this.pair=async e=>{try{return await this.engine.pair(e)}catch(t){throw this.logger.error(t.message),t}},this.approve=async e=>{try{return await this.engine.approve(e)}catch(t){throw this.logger.error(t.message),t}},this.reject=async e=>{try{return await this.engine.reject(e)}catch(t){throw this.logger.error(t.message),t}},this.update=async e=>{try{return await this.engine.update(e)}catch(t){throw this.logger.error(t.message),t}},this.extend=async e=>{try{return await this.engine.extend(e)}catch(t){throw this.logger.error(t.message),t}},this.request=async e=>{try{return await this.engine.request(e)}catch(t){throw this.logger.error(t.message),t}},this.respond=async e=>{try{return await this.engine.respond(e)}catch(t){throw this.logger.error(t.message),t}},this.ping=async e=>{try{return await this.engine.ping(e)}catch(t){throw this.logger.error(t.message),t}},this.emit=async e=>{try{return await this.engine.emit(e)}catch(t){throw this.logger.error(t.message),t}},this.disconnect=async e=>{try{return await this.engine.disconnect(e)}catch(t){throw this.logger.error(t.message),t}},this.find=e=>{try{return this.engine.find(e)}catch(t){throw this.logger.error(t.message),t}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(e2){throw this.logger.error(e2.message),e2}},this.authenticate=async e=>{try{return await this.engine.authenticate(e)}catch(t){throw this.logger.error(t.message),t}},this.formatAuthMessage=e=>{try{return this.engine.formatAuthMessage(e)}catch(t){throw this.logger.error(t.message),t}},this.approveSessionAuthenticate=async e=>{try{return await this.engine.approveSessionAuthenticate(e)}catch(t){throw this.logger.error(t.message),t}},this.rejectSessionAuthenticate=async e=>{try{return await this.engine.rejectSessionAuthenticate(e)}catch(t){throw this.logger.error(t.message),t}},this.name=(null==e?void 0:e.name)||re$1.name,this.metadata=(null==e?void 0:e.metadata)||Xo$1(),this.signConfig=null==e?void 0:e.signConfig;const t=typeof(null==e?void 0:e.logger)<"u"&&"string"!=typeof(null==e?void 0:e.logger)?e.logger:ot$2(k$4({level:(null==e?void 0:e.logger)||re$1.logger}));this.core=(null==e?void 0:e.core)||new Mr(e),this.logger=E$7(t,this.name),this.session=new Ze(this.core,this.logger),this.proposal=new es$1(this.core,this.logger),this.pendingRequest=new ts(this.core,this.logger),this.engine=new Zt$1(this),this.auth=new ns(this.core,this.logger)}static async init(t){const r=new e(t);return await r.initialize(),r}get context(){return y$7(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(),await this.auth.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}};var cjs$2={},cjs$1={};Object.defineProperty(cjs$1,"__esModule",{value:!0});var getLocalStorage_1=cjs$1.getLocalStorage=getLocalStorageOrThrow_1=cjs$1.getLocalStorageOrThrow=getCrypto_1=cjs$1.getCrypto=getCryptoOrThrow_1=cjs$1.getCryptoOrThrow=getLocation_1=cjs$1.getLocation=getLocationOrThrow_1=cjs$1.getLocationOrThrow=getNavigator_1=cjs$1.getNavigator=getNavigatorOrThrow_1=cjs$1.getNavigatorOrThrow=getDocument_1=cjs$1.getDocument=getDocumentOrThrow_1=cjs$1.getDocumentOrThrow=getFromWindowOrThrow_1=cjs$1.getFromWindowOrThrow=getFromWindow_1=cjs$1.getFromWindow=void 0;function getFromWindow$1(e){let t;return"undefined"!=typeof window&&void 0!==window[e]&&(t=window[e]),t}var getFromWindow_1=cjs$1.getFromWindow=getFromWindow$1;function getFromWindowOrThrow$1(e){const t=getFromWindow$1(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}var getFromWindowOrThrow_1=cjs$1.getFromWindowOrThrow=getFromWindowOrThrow$1;function getDocumentOrThrow$1(){return getFromWindowOrThrow$1("document")}var getDocumentOrThrow_1=cjs$1.getDocumentOrThrow=getDocumentOrThrow$1;function getDocument$1(){return getFromWindow$1("document")}var getDocument_1=cjs$1.getDocument=getDocument$1;function getNavigatorOrThrow$1(){return getFromWindowOrThrow$1("navigator")}var getNavigatorOrThrow_1=cjs$1.getNavigatorOrThrow=getNavigatorOrThrow$1;function getNavigator$1(){return getFromWindow$1("navigator")}var getNavigator_1=cjs$1.getNavigator=getNavigator$1;function getLocationOrThrow$1(){return getFromWindowOrThrow$1("location")}var getLocationOrThrow_1=cjs$1.getLocationOrThrow=getLocationOrThrow$1;function getLocation$1(){return getFromWindow$1("location")}var getLocation_1=cjs$1.getLocation=getLocation$1;function getCryptoOrThrow$1(){return getFromWindowOrThrow$1("crypto")}var getCryptoOrThrow_1=cjs$1.getCryptoOrThrow=getCryptoOrThrow$1;function getCrypto$1(){return getFromWindow$1("crypto")}var getCrypto_1=cjs$1.getCrypto=getCrypto$1;function getLocalStorageOrThrow$1(){return getFromWindowOrThrow$1("localStorage")}var getLocalStorageOrThrow_1=cjs$1.getLocalStorageOrThrow=getLocalStorageOrThrow$1;function getLocalStorage$1(){return getFromWindow$1("localStorage")}getLocalStorage_1=cjs$1.getLocalStorage=getLocalStorage$1,Object.defineProperty(cjs$2,"__esModule",{value:!0});var getWindowMetadata_1=cjs$2.getWindowMetadata=void 0;const window_getters_1=cjs$1;function getWindowMetadata(){let e,t;try{e=window_getters_1.getDocumentOrThrow(),t=window_getters_1.getLocationOrThrow()}catch(e2){return null}function r(...t){const r=e.getElementsByTagName("meta");for(let e=0;e<r.length;e++){const n=r[e],o=["itemprop","property","name"].map((e=>n.getAttribute(e))).filter((e=>!!e&&t.includes(e)));if(o.length&&o){const e=n.getAttribute("content");if(e)return e}}return""}const n=function(){let t=r("name","og:site_name","og:title","twitter:title");return t||(t=e.title),t}();return{description:r("description","og:description","twitter:description","keywords"),url:t.origin,icons:function(){const r=e.getElementsByTagName("link"),n=[];for(let e=0;e<r.length;e++){const o=r[e],i=o.getAttribute("rel");if(i&&i.toLowerCase().indexOf("icon")>-1){const e=o.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let r=t.protocol+"//"+t.host;if(0===e.indexOf("/"))r+=e;else{const n=t.pathname.split("/");n.pop();r+=n.join("/")+"/"+e}n.push(r)}else if(0===e.indexOf("//")){const r=t.protocol+e;n.push(r)}else n.push(e)}}return n}(),name:n}}getWindowMetadata_1=cjs$2.getWindowMetadata=getWindowMetadata;var __spreadArrays=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var i=arguments[t],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n},BrowserInfo=function(){return function(e,t,r){this.name=e,this.version=t,this.os=r,this.type="browser"}}(),NodeInfo=function(){return function(e){this.version=e,this.type="node",this.name="node",this.os=process$1.platform}}(),SearchBotDeviceInfo=function(){return function(e,t,r,n){this.name=e,this.version=t,this.os=r,this.bot=n,this.type="bot-device"}}(),BotInfo=function(){return function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}}(),ReactNativeInfo=function(){return function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}}(),SEARCHBOX_UA_REGEX=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,SEARCHBOT_OS_REGEX=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,REQUIRED_VERSION_PARTS=3,userAgentRules=[["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|$)/],["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",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",SEARCHBOX_UA_REGEX]],operatingSystemRules=[["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/],["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 detect(e){return e?parseUserAgent(e):"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new ReactNativeInfo:"undefined"!=typeof navigator?parseUserAgent(navigator.userAgent):getNodeVersion()}function matchUserAgent(e){return""!==e&&userAgentRules.reduce((function(t,r){var n=r[0],o=r[1];if(t)return t;var i=o.exec(e);return!!i&&[n,i]}),!1)}function parseUserAgent(e){var t=matchUserAgent(e);if(!t)return null;var r=t[0],n=t[1];if("searchbot"===r)return new BotInfo;var o=n[1]&&n[1].split(/[._]/).slice(0,3);o?o.length<REQUIRED_VERSION_PARTS&&(o=__spreadArrays(o,createVersionParts(REQUIRED_VERSION_PARTS-o.length))):o=[];var i=o.join("."),s=detectOS$1(e),a=SEARCHBOT_OS_REGEX.exec(e);return a&&a[1]?new SearchBotDeviceInfo(r,i,s,a[1]):new BrowserInfo(r,i,s)}function detectOS$1(e){for(var t=0,r=operatingSystemRules.length;t<r;t++){var n=operatingSystemRules[t],o=n[0];if(n[1].exec(e))return o}return null}function getNodeVersion(){return void 0!==process$1&&process$1.version?new NodeInfo(process$1.version.slice(1)):null}function createVersionParts(e){for(var t=[],r=0;r<e;r++)t.push("0");return t}function detectEnv(e){return detect(e)}function detectOS(){const e=detectEnv();return e&&e.os?e.os:void 0}function isAndroid(){const e=detectOS();return!!e&&e.toLowerCase().includes("android")}function isIOS(){const e=detectOS();return!!e&&(e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1)}function isMobile(){return!!detectOS()&&(isAndroid()||isIOS())}function isNode$1(){const e=detectEnv();return!(!e||!e.name)&&"node"===e.name.toLowerCase()}function isBrowser(){return!isNode$1()&&!!getNavigator()}const getFromWindow=getFromWindow_1,getFromWindowOrThrow=getFromWindowOrThrow_1,getDocumentOrThrow=getDocumentOrThrow_1,getDocument=getDocument_1,getNavigatorOrThrow=getNavigatorOrThrow_1,getNavigator=getNavigator_1,getLocationOrThrow=getLocationOrThrow_1,getLocation=getLocation_1,getCryptoOrThrow=getCryptoOrThrow_1,getCrypto=getCrypto_1,getLocalStorageOrThrow=getLocalStorageOrThrow_1,getLocalStorage=getLocalStorage_1;function getClientMeta(){return getWindowMetadata_1()}function safeJsonParse$1(e){if("string"!=typeof e)throw new Error("Cannot safe json parse value of type "+typeof e);try{return JSON.parse(e)}catch(t){return e}}function safeJsonStringify$1(e){return"string"==typeof e?e:JSON.stringify(e)}const safeJsonParse=safeJsonParse$1,safeJsonStringify=safeJsonStringify$1;function setLocal(e,t){const r=safeJsonStringify(t),n=getLocalStorage();n&&n.setItem(e,r)}function getLocal(e){let t=null,r=null;const n=getLocalStorage();return n&&(r=n.getItem(e)),t=r?safeJsonParse(r):r,t}function removeLocal(e){const t=getLocalStorage();t&&t.removeItem(e)}const mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function formatIOSMobile(e,t){const r=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${r}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${r}`:""}function saveMobileLinkInfo(e){const t=e.href.split("?")[0];setLocal(mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}function getMobileRegistryEntry(e,t){return e.filter((e=>e.name.toLowerCase().includes(t.toLowerCase())))[0]}function getMobileLinkRegistry(e,t){let r=e;return t&&(r=t.map((t=>getMobileRegistryEntry(e,t))).filter(Boolean)),r}const API_URL="https://registry.walletconnect.com";function getWalletRegistryUrl(){return API_URL+"/api/v2/wallets"}function getDappRegistryUrl(){return API_URL+"/api/v2/dapps"}function formatMobileRegistryEntry(e,t="mobile"){var r;return{name:e.name||"",shortName:e.metadata.shortName||"",color:e.metadata.colors.primary||"",logo:null!==(r=e.image_url.sm)&&void 0!==r?r:"",universalLink:e[t].universal||"",deepLink:e[t].native||""}}function formatMobileRegistry(e,t="mobile"){return Object.values(e).filter((e=>!!e[t].universal||!!e[t].native)).map((e=>formatMobileRegistryEntry(e,t)))}const esm=Object.freeze(Object.defineProperty({__proto__:null,detectEnv:detectEnv,detectOS:detectOS,formatIOSMobile:formatIOSMobile,formatMobileRegistry:formatMobileRegistry,formatMobileRegistryEntry:formatMobileRegistryEntry,getClientMeta:getClientMeta,getCrypto:getCrypto,getCryptoOrThrow:getCryptoOrThrow,getDappRegistryUrl:getDappRegistryUrl,getDocument:getDocument,getDocumentOrThrow:getDocumentOrThrow,getFromWindow:getFromWindow,getFromWindowOrThrow:getFromWindowOrThrow,getLocal:getLocal,getLocalStorage:getLocalStorage,getLocalStorageOrThrow:getLocalStorageOrThrow,getLocation:getLocation,getLocationOrThrow:getLocationOrThrow,getMobileLinkRegistry:getMobileLinkRegistry,getMobileRegistryEntry:getMobileRegistryEntry,getNavigator:getNavigator,getNavigatorOrThrow:getNavigatorOrThrow,getWalletRegistryUrl:getWalletRegistryUrl,isAndroid:isAndroid,isBrowser:isBrowser,isIOS:isIOS,isMobile:isMobile,isNode:isNode$1,mobileLinkChoiceKey:mobileLinkChoiceKey,removeLocal:removeLocal,safeJsonParse:safeJsonParse,safeJsonStringify:safeJsonStringify,saveMobileLinkInfo:saveMobileLinkInfo,setLocal:setLocal},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(esm);var browser$1={},canPromise$3=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then},qrcode$1={},typedarrayBuffer={},toString={}.toString,isarray=Array.isArray||function(e){return"[object Array]"==toString.call(e)},isArray$1=isarray;function typedArraySupport(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e2){return!1}}Buffer$1.TYPED_ARRAY_SUPPORT=typedArraySupport();var K_MAX_LENGTH=Buffer$1.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function Buffer$1(e,t,r){return Buffer$1.TYPED_ARRAY_SUPPORT||this instanceof Buffer$1?"number"==typeof e?allocUnsafe(this,e):from(this,e,t,r):new Buffer$1(e,t,r)}function checked(e){if(e>=K_MAX_LENGTH)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K_MAX_LENGTH.toString(16)+" bytes");return 0|e}function isnan(e){return e!=e}function createBuffer(e,t){var r;return Buffer$1.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(t)).__proto__=Buffer$1.prototype:(null===(r=e)&&(r=new Buffer$1(t)),r.length=t),r}function allocUnsafe(e,t){var r=createBuffer(e,t<0?0:0|checked(t));if(!Buffer$1.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)r[n]=0;return r}function fromString(e,t){var r=0|byteLength(t),n=createBuffer(e,r),o=n.write(t);return o!==r&&(n=n.slice(0,o)),n}function fromArrayLike(e,t){for(var r=t.length<0?0:0|checked(t.length),n=createBuffer(e,r),o=0;o<r;o+=1)n[o]=255&t[o];return n}function fromArrayBuffer(e,t,r,n){if(r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");var o;return o=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n),Buffer$1.TYPED_ARRAY_SUPPORT?o.__proto__=Buffer$1.prototype:o=fromArrayLike(e,o),o}function fromObject(e,t){if(Buffer$1.isBuffer(t)){var r=0|checked(t.length),n=createBuffer(e,r);return 0===n.length||t.copy(n,0,0,r),n}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||isnan(t.length)?createBuffer(e,0):fromArrayLike(e,t);if("Buffer"===t.type&&Array.isArray(t.data))return fromArrayLike(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function utf8ToBytes(e,t){var r;t=t||1/0;for(var n=e.length,o=null,i=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function byteLength(e){return Buffer$1.isBuffer(e)?e.length:"undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)?e.byteLength:("string"!=typeof e&&(e=""+e),0===e.length?0:utf8ToBytes(e).length)}function blitBuffer(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function utf8Write(e,t,r,n){return blitBuffer(utf8ToBytes(t,e.length-r),e,r,n)}function from(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?fromArrayBuffer(e,t,r,n):"string"==typeof t?fromString(e,t):fromObject(e,t)}Buffer$1.TYPED_ARRAY_SUPPORT&&(Buffer$1.prototype.__proto__=Uint8Array.prototype,Buffer$1.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Buffer$1[Symbol.species]===Buffer$1&&Object.defineProperty(Buffer$1,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1})),Buffer$1.prototype.write=function(e,t,r){void 0===t||void 0===r&&"string"==typeof t?(r=this.length,t=0):isFinite(t)&&(t|=0,isFinite(r)?r|=0:r=void 0);var n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");return utf8Write(this,e,t,r)},Buffer$1.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),Buffer$1.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=Buffer$1.prototype;else{var o=t-e;r=new Buffer$1(o,void 0);for(var i=0;i<o;++i)r[i]=this[i+e]}return r},Buffer$1.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var o,i=n-r;if(this===e&&r<t&&t<n)for(o=i-1;o>=0;--o)e[o+t]=this[o+r];else if(i<1e3||!Buffer$1.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+i),t);return i},Buffer$1.prototype.fill=function(e,t,r){if("string"==typeof e){if("string"==typeof t?(t=0,r=this.length):"string"==typeof r&&(r=this.length),1===e.length){var n=e.charCodeAt(0);n<256&&(e=n)}}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var i=Buffer$1.isBuffer(e)?e:new Buffer$1(e),s=i.length;for(o=0;o<r-t;++o)this[o+t]=i[o%s]}return this},Buffer$1.concat=function(e,t){if(!isArray$1(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return createBuffer(null,0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=allocUnsafe(null,t),o=0;for(r=0;r<e.length;++r){var i=e[r];if(!Buffer$1.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o),o+=i.length}return n},Buffer$1.byteLength=byteLength,Buffer$1.prototype._isBuffer=!0,Buffer$1.isBuffer=function(e){return!(null==e||!e._isBuffer)},typedarrayBuffer.alloc=function(e){var t=new Buffer$1(e);return t.fill(0),t},typedarrayBuffer.from=function(e){return new Buffer$1(e)};var utils$3={},toSJISFunction$1,CODEWORDS_COUNT$1=[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];utils$3.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 4*e+17},utils$3.getSymbolTotalCodewords=function(e){return CODEWORDS_COUNT$1[e]},utils$3.getBCHDigit=function(e){for(var t=0;0!==e;)t++,e>>>=1;return t},utils$3.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');toSJISFunction$1=e},utils$3.isKanjiModeEnabled=function(){return void 0!==toSJISFunction$1},utils$3.toSJIS=function(e){return toSJISFunction$1(e)};var errorCorrectionLevel$1={};function BitBuffer$3(){this.buffer=[],this.length=0}!function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2},e.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},e.from=function(t,r){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+t)}}(t)}catch(e2){return r}}}(errorCorrectionLevel$1),BitBuffer$3.prototype={get:function(e){var t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(var r=0;r<t;r++)this.putBit(1==(e>>>t-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var bitBuffer$1=BitBuffer$3,BufferUtil$4=typedarrayBuffer;function BitMatrix$3(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=BufferUtil$4.alloc(e*e),this.reservedBit=BufferUtil$4.alloc(e*e)}BitMatrix$3.prototype.set=function(e,t,r,n){var o=e*this.size+t;this.data[o]=r,n&&(this.reservedBit[o]=!0)},BitMatrix$3.prototype.get=function(e,t){return this.data[e*this.size+t]},BitMatrix$3.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r},BitMatrix$3.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var bitMatrix$1=BitMatrix$3,alignmentPattern$1={};!function(e){var t=utils$3.getSymbolSize;e.getRowColCoords=function(e){if(1===e)return[];for(var r=Math.floor(e/7)+2,n=t(e),o=145===n?26:2*Math.ceil((n-13)/(2*r-2)),i=[n-7],s=1;s<r-1;s++)i[s]=i[s-1]-o;return i.push(6),i.reverse()},e.getPositions=function(t){for(var r=[],n=e.getRowColCoords(t),o=n.length,i=0;i<o;i++)for(var s=0;s<o;s++)0===i&&0===s||0===i&&s===o-1||i===o-1&&0===s||r.push([n[i],n[s]]);return r}}(alignmentPattern$1);var finderPattern$1={},getSymbolSize$1=utils$3.getSymbolSize,FINDER_PATTERN_SIZE$1=7;finderPattern$1.getPositions=function(e){var t=getSymbolSize$1(e);return[[0,0],[t-FINDER_PATTERN_SIZE$1,0],[0,t-FINDER_PATTERN_SIZE$1]]};var maskPattern$1={};!function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t=3,r=3,n=40,o=10;function i(t,r,n){switch(t){case e.Patterns.PATTERN000:return(r+n)%2==0;case e.Patterns.PATTERN001:return r%2==0;case e.Patterns.PATTERN010:return n%3==0;case e.Patterns.PATTERN011:return(r+n)%3==0;case e.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(n/3))%2==0;case e.Patterns.PATTERN101:return r*n%2+r*n%3==0;case e.Patterns.PATTERN110:return(r*n%2+r*n%3)%2==0;case e.Patterns.PATTERN111:return(r*n%3+(r+n)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}}e.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){for(var r=e.size,n=0,o=0,i=0,s=null,a=null,c=0;c<r;c++){o=i=0,s=a=null;for(var u=0;u<r;u++){var l=e.get(c,u);l===s?o++:(o>=5&&(n+=t+(o-5)),s=l,o=1),(l=e.get(u,c))===a?i++:(i>=5&&(n+=t+(i-5)),a=l,i=1)}o>=5&&(n+=t+(o-5)),i>=5&&(n+=t+(i-5))}return n},e.getPenaltyN2=function(e){for(var t=e.size,n=0,o=0;o<t-1;o++)for(var i=0;i<t-1;i++){var s=e.get(o,i)+e.get(o,i+1)+e.get(o+1,i)+e.get(o+1,i+1);4!==s&&0!==s||n++}return n*r},e.getPenaltyN3=function(e){for(var t=e.size,r=0,o=0,i=0,s=0;s<t;s++){o=i=0;for(var a=0;a<t;a++)o=o<<1&2047|e.get(s,a),a>=10&&(1488===o||93===o)&&r++,i=i<<1&2047|e.get(a,s),a>=10&&(1488===i||93===i)&&r++}return r*n},e.getPenaltyN4=function(e){for(var t=0,r=e.data.length,n=0;n<r;n++)t+=e.data[n];return Math.abs(Math.ceil(100*t/r/5)-10)*o},e.applyMask=function(e,t){for(var r=t.size,n=0;n<r;n++)for(var o=0;o<r;o++)t.isReserved(o,n)||t.xor(o,n,i(e,o,n))},e.getBestMask=function(t,r){for(var n=Object.keys(e.Patterns).length,o=0,i=1/0,s=0;s<n;s++){r(s),e.applyMask(s,t);var a=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(s,t),a<i&&(i=a,o=s)}return o}}(maskPattern$1);var errorCorrectionCode$1={},ECLevel$3=errorCorrectionLevel$1,EC_BLOCKS_TABLE$1=[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],EC_CODEWORDS_TABLE$1=[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];errorCorrectionCode$1.getBlocksCount=function(e,t){switch(t){case ECLevel$3.L:return EC_BLOCKS_TABLE$1[4*(e-1)+0];case ECLevel$3.M:return EC_BLOCKS_TABLE$1[4*(e-1)+1];case ECLevel$3.Q:return EC_BLOCKS_TABLE$1[4*(e-1)+2];case ECLevel$3.H:return EC_BLOCKS_TABLE$1[4*(e-1)+3];default:return}},errorCorrectionCode$1.getTotalCodewordsCount=function(e,t){switch(t){case ECLevel$3.L:return EC_CODEWORDS_TABLE$1[4*(e-1)+0];case ECLevel$3.M:return EC_CODEWORDS_TABLE$1[4*(e-1)+1];case ECLevel$3.Q:return EC_CODEWORDS_TABLE$1[4*(e-1)+2];case ECLevel$3.H:return EC_CODEWORDS_TABLE$1[4*(e-1)+3];default:return}};var polynomial$1={},galoisField$1={},BufferUtil$3=typedarrayBuffer,EXP_TABLE$1=BufferUtil$3.alloc(512),LOG_TABLE$1=BufferUtil$3.alloc(256);!function(){for(var e=1,t=0;t<255;t++)EXP_TABLE$1[t]=e,LOG_TABLE$1[e]=t,256&(e<<=1)&&(e^=285);for(t=255;t<512;t++)EXP_TABLE$1[t]=EXP_TABLE$1[t-255]}(),galoisField$1.log=function(e){if(e<1)throw new Error("log("+e+")");return LOG_TABLE$1[e]},galoisField$1.exp=function(e){return EXP_TABLE$1[e]},galoisField$1.mul=function(e,t){return 0===e||0===t?0:EXP_TABLE$1[LOG_TABLE$1[e]+LOG_TABLE$1[t]]},function(e){var t=typedarrayBuffer,r=galoisField$1;e.mul=function(e,n){for(var o=t.alloc(e.length+n.length-1),i=0;i<e.length;i++)for(var s=0;s<n.length;s++)o[i+s]^=r.mul(e[i],n[s]);return o},e.mod=function(e,n){for(var o=t.from(e);o.length-n.length>=0;){for(var i=o[0],s=0;s<n.length;s++)o[s]^=r.mul(n[s],i);for(var a=0;a<o.length&&0===o[a];)a++;o=o.slice(a)}return o},e.generateECPolynomial=function(n){for(var o=t.from([1]),i=0;i<n;i++)o=e.mul(o,[1,r.exp(i)]);return o}}(polynomial$1);var BufferUtil$2=typedarrayBuffer,Polynomial$1=polynomial$1,Buffer=require$$2$1.Buffer;function ReedSolomonEncoder$3(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}ReedSolomonEncoder$3.prototype.initialize=function(e){this.degree=e,this.genPoly=Polynomial$1.generateECPolynomial(this.degree)},ReedSolomonEncoder$3.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");var t=BufferUtil$2.alloc(this.degree),r=Buffer.concat([e,t],e.length+this.degree),n=Polynomial$1.mod(r,this.genPoly),o=this.degree-n.length;if(o>0){var i=BufferUtil$2.alloc(this.degree);return n.copy(i,o),i}return n};var reedSolomonEncoder$1=ReedSolomonEncoder$3,version$1={},mode$1={},versionCheck$1={isValid:function(e){return!isNaN(e)&&e>=1&&e<=40}},regex$1={},numeric$1="[0-9]+",alphanumeric$1="[A-Z $%*+\\-./:]+",kanji$1="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";kanji$1=kanji$1.replace(/u/g,"\\u");var byte$1="(?:(?![A-Z0-9 $%*+\\-./:]|"+kanji$1+")(?:.|[\r\n]))+";regex$1.KANJI=new RegExp(kanji$1,"g"),regex$1.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),regex$1.BYTE=new RegExp(byte$1,"g"),regex$1.NUMERIC=new RegExp(numeric$1,"g"),regex$1.ALPHANUMERIC=new RegExp(alphanumeric$1,"g");var TEST_KANJI$1=new RegExp("^"+kanji$1+"$"),TEST_NUMERIC$1=new RegExp("^"+numeric$1+"$"),TEST_ALPHANUMERIC$1=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");regex$1.testKanji=function(e){return TEST_KANJI$1.test(e)},regex$1.testNumeric=function(e){return TEST_NUMERIC$1.test(e)},regex$1.testAlphanumeric=function(e){return TEST_ALPHANUMERIC$1.test(e)},function(e){var t=versionCheck$1,r=regex$1;e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!t.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return r.testNumeric(t)?e.NUMERIC:r.testAlphanumeric(t)?e.ALPHANUMERIC:r.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},e.isValid=function(e){return e&&e.bit&&e.ccBits},e.from=function(t,r){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(e2){return r}}}(mode$1),function(e){var t=utils$3,r=errorCorrectionCode$1,n=errorCorrectionLevel$1,o=mode$1,i=versionCheck$1,s=isarray,a=t.getBCHDigit(7973);function c(e,t){return o.getCharCountIndicator(e,t)+4}function u(e,t){var r=0;return e.forEach((function(e){var n=c(e.mode,t);r+=n+e.getBitsLength()})),r}e.from=function(e,t){return i.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,n,s){if(!i.isValid(e))throw new Error("Invalid QR Code version");void 0===s&&(s=o.BYTE);var a=8*(t.getSymbolTotalCodewords(e)-r.getTotalCodewordsCount(e,n));if(s===o.MIXED)return a;var u=a-c(s,e);switch(s){case o.NUMERIC:return Math.floor(u/10*3);case o.ALPHANUMERIC:return Math.floor(u/11*2);case o.KANJI:return Math.floor(u/13);case o.BYTE:default:return Math.floor(u/8)}},e.getBestVersionForData=function(t,r){var i,a=n.from(r,n.M);if(s(t)){if(t.length>1)return function(t,r){for(var n=1;n<=40;n++)if(u(t,n)<=e.getCapacity(n,r,o.MIXED))return n}(t,a);if(0===t.length)return 1;i=t[0]}else i=t;return function(t,r,n){for(var o=1;o<=40;o++)if(r<=e.getCapacity(o,n,t))return o}(i.mode,i.getLength(),a)},e.getEncodedBits=function(e){if(!i.isValid(e)||e<7)throw new Error("Invalid QR Code version");for(var r=e<<12;t.getBCHDigit(r)-a>=0;)r^=7973<<t.getBCHDigit(r)-a;return e<<12|r}}(version$1);var formatInfo$1={},Utils$7=utils$3,G15$1=1335,G15_MASK$1=21522,G15_BCH$1=Utils$7.getBCHDigit(G15$1);formatInfo$1.getEncodedBits=function(e,t){for(var r=e.bit<<3|t,n=r<<10;Utils$7.getBCHDigit(n)-G15_BCH$1>=0;)n^=G15$1<<Utils$7.getBCHDigit(n)-G15_BCH$1;return(r<<10|n)^G15_MASK$1};var segments$1={},Mode$9=mode$1;function NumericData$1(e){this.mode=Mode$9.NUMERIC,this.data=e.toString()}NumericData$1.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},NumericData$1.prototype.getLength=function(){return this.data.length},NumericData$1.prototype.getBitsLength=function(){return NumericData$1.getBitsLength(this.data.length)},NumericData$1.prototype.write=function(e){var t,r,n;for(t=0;t+3<=this.data.length;t+=3)r=this.data.substr(t,3),n=parseInt(r,10),e.put(n,10);var o=this.data.length-t;o>0&&(r=this.data.substr(t),n=parseInt(r,10),e.put(n,3*o+1))};var numericData$1=NumericData$1,Mode$8=mode$1,ALPHA_NUM_CHARS$1=["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 AlphanumericData$1(e){this.mode=Mode$8.ALPHANUMERIC,this.data=e}AlphanumericData$1.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},AlphanumericData$1.prototype.getLength=function(){return this.data.length},AlphanumericData$1.prototype.getBitsLength=function(){return AlphanumericData$1.getBitsLength(this.data.length)},AlphanumericData$1.prototype.write=function(e){var t;for(t=0;t+2<=this.data.length;t+=2){var r=45*ALPHA_NUM_CHARS$1.indexOf(this.data[t]);r+=ALPHA_NUM_CHARS$1.indexOf(this.data[t+1]),e.put(r,11)}this.data.length%2&&e.put(ALPHA_NUM_CHARS$1.indexOf(this.data[t]),6)};var alphanumericData$1=AlphanumericData$1,BufferUtil$1=typedarrayBuffer,Mode$7=mode$1;function ByteData$1(e){this.mode=Mode$7.BYTE,this.data=BufferUtil$1.from(e)}ByteData$1.getBitsLength=function(e){return 8*e},ByteData$1.prototype.getLength=function(){return this.data.length},ByteData$1.prototype.getBitsLength=function(){return ByteData$1.getBitsLength(this.data.length)},ByteData$1.prototype.write=function(e){for(var t=0,r=this.data.length;t<r;t++)e.put(this.data[t],8)};var byteData$1=ByteData$1,Mode$6=mode$1,Utils$6=utils$3;function KanjiData$1(e){this.mode=Mode$6.KANJI,this.data=e}KanjiData$1.getBitsLength=function(e){return 13*e},KanjiData$1.prototype.getLength=function(){return this.data.length},KanjiData$1.prototype.getBitsLength=function(){return KanjiData$1.getBitsLength(this.data.length)},KanjiData$1.prototype.write=function(e){var t;for(t=0;t<this.data.length;t++){var r=Utils$6.toSJIS(this.data[t]);if(r>=33088&&r<=40956)r-=33088;else{if(!(r>=57408&&r<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");r-=49472}r=192*(r>>>8&255)+(255&r),e.put(r,13)}};var kanjiData$1=KanjiData$1,dijkstra={exports:{}};!function(e){var t={single_source_shortest_paths:function(e,r,n){var o={},i={};i[r]=0;var s,a,c,u,l,d,h,f=t.PriorityQueue.make();for(f.push(r,0);!f.empty();)for(c in a=(s=f.pop()).value,u=s.cost,l=e[a]||{})l.hasOwnProperty(c)&&(d=u+l[c],h=i[c],(void 0===i[c]||h>d)&&(i[c]=d,f.push(c,d),o[c]=a));if(void 0!==n&&void 0===i[n]){var p=["Could not find a path from ",r," to ",n,"."].join("");throw new Error(p)}return o},extract_shortest_path_from_predecessor_list:function(e,t){for(var r=[],n=t;n;)r.push(n),e[n],n=e[n];return r.reverse(),r},find_path:function(e,r,n){var o=t.single_source_shortest_paths(e,r,n);return t.extract_shortest_path_from_predecessor_list(o,n)},PriorityQueue:{make:function(e){var r,n=t.PriorityQueue,o={};for(r in e=e||{},n)n.hasOwnProperty(r)&&(o[r]=n[r]);return o.queue=[],o.sorter=e.sorter||n.default_sorter,o},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var r={value:e,cost:t};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t}(dijkstra);var dijkstraExports=dijkstra.exports;!function(e){var t=mode$1,r=numericData$1,n=alphanumericData$1,o=byteData$1,i=kanjiData$1,s=regex$1,a=utils$3,c=dijkstraExports;function u(e){return unescape(encodeURIComponent(e)).length}function l(e,t,r){for(var n,o=[];null!==(n=e.exec(r));)o.push({data:n[0],index:n.index,mode:t,length:n[0].length});return o}function d(e){var r,n,o=l(s.NUMERIC,t.NUMERIC,e),i=l(s.ALPHANUMERIC,t.ALPHANUMERIC,e);return a.isKanjiModeEnabled()?(r=l(s.BYTE,t.BYTE,e),n=l(s.KANJI,t.KANJI,e)):(r=l(s.BYTE_KANJI,t.BYTE,e),n=[]),o.concat(i,r,n).sort((function(e,t){return e.index-t.index})).map((function(e){return{data:e.data,mode:e.mode,length:e.length}}))}function h(e,s){switch(s){case t.NUMERIC:return r.getBitsLength(e);case t.ALPHANUMERIC:return n.getBitsLength(e);case t.KANJI:return i.getBitsLength(e);case t.BYTE:return o.getBitsLength(e)}}function f(e,s){var c,u=t.getBestModeForData(e);if((c=t.from(s,u))!==t.BYTE&&c.bit<u.bit)throw new Error('"'+e+'" cannot be encoded with mode '+t.toString(c)+".\n Suggested mode is: "+t.toString(u));switch(c!==t.KANJI||a.isKanjiModeEnabled()||(c=t.BYTE),c){case t.NUMERIC:return new r(e);case t.ALPHANUMERIC:return new n(e);case t.KANJI:return new i(e);case t.BYTE:return new o(e)}}e.fromArray=function(e){return e.reduce((function(e,t){return"string"==typeof t?e.push(f(t,null)):t.data&&e.push(f(t.data,t.mode)),e}),[])},e.fromString=function(r,n){for(var o=function(e){for(var r=[],n=0;n<e.length;n++){var o=e[n];switch(o.mode){case t.NUMERIC:r.push([o,{data:o.data,mode:t.ALPHANUMERIC,length:o.length},{data:o.data,mode:t.BYTE,length:o.length}]);break;case t.ALPHANUMERIC:r.push([o,{data:o.data,mode:t.BYTE,length:o.length}]);break;case t.KANJI:r.push([o,{data:o.data,mode:t.BYTE,length:u(o.data)}]);break;case t.BYTE:r.push([{data:o.data,mode:t.BYTE,length:u(o.data)}])}}return r}(d(r,a.isKanjiModeEnabled())),i=function(e,r){for(var n={},o={start:{}},i=["start"],s=0;s<e.length;s++){for(var a=e[s],c=[],u=0;u<a.length;u++){var l=a[u],d=""+s+u;c.push(d),n[d]={node:l,lastCount:0},o[d]={};for(var f=0;f<i.length;f++){var p=i[f];n[p]&&n[p].node.mode===l.mode?(o[p][d]=h(n[p].lastCount+l.length,l.mode)-h(n[p].lastCount,l.mode),n[p].lastCount+=l.length):(n[p]&&(n[p].lastCount=l.length),o[p][d]=h(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,r))}}i=c}for(f=0;f<i.length;f++)o[i[f]].end=0;return{map:o,table:n}}(o,n),s=c.find_path(i.map,"start","end"),l=[],f=1;f<s.length-1;f++)l.push(i.table[s[f]].node);return e.fromArray(function(e){return e.reduce((function(e,t){var r=e.length-1>=0?e[e.length-1]:null;return r&&r.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)}),[])}(l))},e.rawSplit=function(t){return e.fromArray(d(t,a.isKanjiModeEnabled()))}}(segments$1);var BufferUtil=typedarrayBuffer,Utils$5=utils$3,ECLevel$2=errorCorrectionLevel$1,BitBuffer$2=bitBuffer$1,BitMatrix$2=bitMatrix$1,AlignmentPattern$1=alignmentPattern$1,FinderPattern$1=finderPattern$1,MaskPattern$1=maskPattern$1,ECCode$1=errorCorrectionCode$1,ReedSolomonEncoder$2=reedSolomonEncoder$1,Version$1=version$1,FormatInfo$1=formatInfo$1,Mode$5=mode$1,Segments$1=segments$1,isArray=isarray;function setupFinderPattern$1(e,t){for(var r=e.size,n=FinderPattern$1.getPositions(t),o=0;o<n.length;o++)for(var i=n[o][0],s=n[o][1],a=-1;a<=7;a++)if(!(i+a<=-1||r<=i+a))for(var c=-1;c<=7;c++)s+c<=-1||r<=s+c||(a>=0&&a<=6&&(0===c||6===c)||c>=0&&c<=6&&(0===a||6===a)||a>=2&&a<=4&&c>=2&&c<=4?e.set(i+a,s+c,!0,!0):e.set(i+a,s+c,!1,!0))}function setupTimingPattern$1(e){for(var t=e.size,r=8;r<t-8;r++){var n=r%2==0;e.set(r,6,n,!0),e.set(6,r,n,!0)}}function setupAlignmentPattern$1(e,t){for(var r=AlignmentPattern$1.getPositions(t),n=0;n<r.length;n++)for(var o=r[n][0],i=r[n][1],s=-2;s<=2;s++)for(var a=-2;a<=2;a++)-2===s||2===s||-2===a||2===a||0===s&&0===a?e.set(o+s,i+a,!0,!0):e.set(o+s,i+a,!1,!0)}function setupVersionInfo$1(e,t){for(var r,n,o,i=e.size,s=Version$1.getEncodedBits(t),a=0;a<18;a++)r=Math.floor(a/3),n=a%3+i-8-3,o=1==(s>>a&1),e.set(r,n,o,!0),e.set(n,r,o,!0)}function setupFormatInfo$1(e,t,r){var n,o,i=e.size,s=FormatInfo$1.getEncodedBits(t,r);for(n=0;n<15;n++)o=1==(s>>n&1),n<6?e.set(n,8,o,!0):n<8?e.set(n+1,8,o,!0):e.set(i-15+n,8,o,!0),n<8?e.set(8,i-n-1,o,!0):n<9?e.set(8,15-n-1+1,o,!0):e.set(8,15-n-1,o,!0);e.set(i-8,8,1,!0)}function setupData$1(e,t){for(var r=e.size,n=-1,o=r-1,i=7,s=0,a=r-1;a>0;a-=2)for(6===a&&a--;;){for(var c=0;c<2;c++)if(!e.isReserved(o,a-c)){var u=!1;s<t.length&&(u=1==(t[s]>>>i&1)),e.set(o,a-c,u),-1===--i&&(s++,i=7)}if((o+=n)<0||r<=o){o-=n,n=-n;break}}}function createData$1(e,t,r){var n=new BitBuffer$2;r.forEach((function(t){n.put(t.mode.bit,4),n.put(t.getLength(),Mode$5.getCharCountIndicator(t.mode,e)),t.write(n)}));var o=8*(Utils$5.getSymbolTotalCodewords(e)-ECCode$1.getTotalCodewordsCount(e,t));for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(0);for(var i=(o-n.getLengthInBits())/8,s=0;s<i;s++)n.put(s%2?17:236,8);return createCodewords$1(n,e,t)}function createCodewords$1(e,t,r){for(var n=Utils$5.getSymbolTotalCodewords(t),o=n-ECCode$1.getTotalCodewordsCount(t,r),i=ECCode$1.getBlocksCount(t,r),s=i-n%i,a=Math.floor(n/i),c=Math.floor(o/i),u=c+1,l=a-c,d=new ReedSolomonEncoder$2(l),h=0,f=new Array(i),p=new Array(i),m=0,y=BufferUtil.from(e.buffer),g=0;g<i;g++){var b=g<s?c:u;f[g]=y.slice(h,h+b),p[g]=d.encode(f[g]),h+=b,m=Math.max(m,b)}var w,v,_=BufferUtil.alloc(n),A=0;for(w=0;w<m;w++)for(v=0;v<i;v++)w<f[v].length&&(_[A++]=f[v][w]);for(w=0;w<l;w++)for(v=0;v<i;v++)_[A++]=p[v][w];return _}function createSymbol$1(e,t,r,n){var o;if(isArray(e))o=Segments$1.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");var i=t;if(!i){var s=Segments$1.rawSplit(e);i=Version$1.getBestVersionForData(s,r)}o=Segments$1.fromString(e,i||40)}var a=Version$1.getBestVersionForData(o,r);if(!a)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<a)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+a+".\n")}else t=a;var c=createData$1(t,r,o),u=Utils$5.getSymbolSize(t),l=new BitMatrix$2(u);return setupFinderPattern$1(l,t),setupTimingPattern$1(l),setupAlignmentPattern$1(l,t),setupFormatInfo$1(l,r,0),t>=7&&setupVersionInfo$1(l,t),setupData$1(l,c),isNaN(n)&&(n=MaskPattern$1.getBestMask(l,setupFormatInfo$1.bind(null,l,r))),MaskPattern$1.applyMask(n,l),setupFormatInfo$1(l,r,n),{modules:l,version:t,errorCorrectionLevel:r,maskPattern:n,segments:o}}qrcode$1.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");var r,n,o=ECLevel$2.M;return void 0!==t&&(o=ECLevel$2.from(t.errorCorrectionLevel,ECLevel$2.M),r=Version$1.from(t.version),n=MaskPattern$1.from(t.maskPattern),t.toSJISFunc&&Utils$5.setToSJISFunction(t.toSJISFunc)),createSymbol$1(e,r,o,n)};var canvas$1={},utils$2={};!function(e){function t(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");var t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map((function(e){return[e,e]})))),6===t.length&&t.push("F","F");var r=parseInt(t.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:255&r,hex:"#"+t.slice(0,6).join("")}}e.getOptions=function(e){e||(e={}),e.color||(e.color={});var r=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,o=e.scale||4;return{width:n,scale:n?4:o,margin:r,color:{dark:t(e.color.dark||"#000000ff"),light:t(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},e.getImageWidth=function(t,r){var n=e.getScale(t,r);return Math.floor((t+2*r.margin)*n)},e.qrToImageData=function(t,r,n){for(var o=r.modules.size,i=r.modules.data,s=e.getScale(o,n),a=Math.floor((o+2*n.margin)*s),c=n.margin*s,u=[n.color.light,n.color.dark],l=0;l<a;l++)for(var d=0;d<a;d++){var h=4*(l*a+d),f=n.color.light;if(l>=c&&d>=c&&l<a-c&&d<a-c)f=u[i[Math.floor((l-c)/s)*o+Math.floor((d-c)/s)]?1:0];t[h++]=f.r,t[h++]=f.g,t[h++]=f.b,t[h]=f.a}}}(utils$2),function(e){var t=utils$2;e.render=function(e,r,n){var o=n,i=r;void 0!==o||r&&r.getContext||(o=r,r=void 0),r||(i=function(){try{return document.createElement("canvas")}catch(e2){throw new Error("You need to specify a canvas element")}}()),o=t.getOptions(o);var s=t.getImageWidth(e.modules.size,o),a=i.getContext("2d"),c=a.createImageData(s,s);return t.qrToImageData(c.data,e,o),function(e,t,r){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=r,t.width=r,t.style.height=r+"px",t.style.width=r+"px"}(a,i,s),a.putImageData(c,0,0),i},e.renderToDataURL=function(t,r,n){var o=n;void 0!==o||r&&r.getContext||(o=r,r=void 0),o||(o={});var i=e.render(t,r,o),s=o.type||"image/png",a=o.rendererOpts||{};return i.toDataURL(s,a.quality)}}(canvas$1);var svgTag$1={},Utils$4=utils$2;function getColorAttrib$1(e,t){var r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function svgCmd$1(e,t,r){var n=e+t;return void 0!==r&&(n+=" "+r),n}function qrToPath$1(e,t,r){for(var n="",o=0,i=!1,s=0,a=0;a<e.length;a++){var c=Math.floor(a%t),u=Math.floor(a/t);c||i||(i=!0),e[a]?(s++,a>0&&c>0&&e[a-1]||(n+=i?svgCmd$1("M",c+r,.5+u+r):svgCmd$1("m",o,0),o=0,i=!1),c+1<t&&e[a+1]||(n+=svgCmd$1("h",s),s=0)):o++}return n}svgTag$1.render=function(e,t,r){var n=Utils$4.getOptions(t),o=e.modules.size,i=e.modules.data,s=o+2*n.margin,a=n.color.light.a?"<path "+getColorAttrib$1(n.color.light,"fill")+' d="M0 0h'+s+"v"+s+'H0z"/>':"",c="<path "+getColorAttrib$1(n.color.dark,"stroke")+' d="'+qrToPath$1(i,o,n.margin)+'"/>',u='viewBox="0 0 '+s+" "+s+'"',l='<svg xmlns="http://www.w3.org/2000/svg" '+(n.width?'width="'+n.width+'" height="'+n.width+'" ':"")+u+' shape-rendering="crispEdges">'+a+c+"</svg>\n";return"function"==typeof r&&r(null,l),l};var canPromise$2=canPromise$3,QRCode$2=qrcode$1,CanvasRenderer$1=canvas$1,SvgRenderer$1=svgTag$1;function renderCanvas$1(e,t,r,n,o){var i=[].slice.call(arguments,1),s=i.length,a="function"==typeof i[s-1];if(!a&&!canPromise$2())throw new Error("Callback required as last argument");if(!a){if(s<1)throw new Error("Too few arguments provided");return 1===s?(r=t,t=n=void 0):2!==s||t.getContext||(n=r,r=t,t=void 0),new Promise((function(o,i){try{var s=QRCode$2.create(r,n);o(e(s,t,n))}catch(e2){i(e2)}}))}if(s<2)throw new Error("Too few arguments provided");2===s?(o=r,r=t,t=n=void 0):3===s&&(t.getContext&&void 0===o?(o=n,n=void 0):(o=n,n=r,r=t,t=void 0));try{var c=QRCode$2.create(r,n);o(null,e(c,t,n))}catch(e2){o(e2)}}browser$1.create=QRCode$2.create,browser$1.toCanvas=renderCanvas$1.bind(null,CanvasRenderer$1.render),browser$1.toDataURL=renderCanvas$1.bind(null,CanvasRenderer$1.renderToDataURL),browser$1.toString=renderCanvas$1.bind(null,(function(e,t,r){return SvgRenderer$1.render(e,r)}));var toggleSelection=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],n=0;n<e.rangeCount;n++)r.push(e.getRangeAt(n));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||r.forEach((function(t){e.addRange(t)})),t&&t.focus()}},deselectCurrent=toggleSelection,clipboardToIE11Formatting={"text/plain":"Text","text/html":"Url",default:"Text"},defaultMessage="Copy to clipboard: #{key}, Enter";function format(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function copy$1(e,t){var r,n,o,i,s,a,c=!1;t||(t={}),r=t.debug||!1;try{if(o=deselectCurrent(),i=document.createRange(),s=document.getSelection(),(a=document.createElement("span")).textContent=e,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.addEventListener("copy",(function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),void 0===n.clipboardData){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=clipboardToIE11Formatting[t.format]||clipboardToIE11Formatting.default;window.clipboardData.setData(o,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))})),document.body.appendChild(a),i.selectNodeContents(a),s.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");c=!0}catch(u){r&&console.error("unable to copy using execCommand: ",u),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(l){r&&console.error("unable to copy using clipboardData: ",l),r&&console.error("falling back to prompt"),n=format("message"in t?t.message:defaultMessage),window.prompt(n,e)}}finally{s&&("function"==typeof s.removeRange?s.removeRange(i):s.removeAllRanges()),a&&document.body.removeChild(a),o()}return c}var copyToClipboard=copy$1,n$6,u$3,i$5,t$6,r$5,o$7,f$2,e$7={},c$6=[],s$6=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord/i;function a$4(e,t){for(var r in t)e[r]=t[r];return e}function v$3(e){var t=e.parentNode;t&&t.removeChild(e)}function h$5(e,t,r){var n,o=arguments,i={};for(n in t)"key"!==n&&"ref"!==n&&(i[n]=t[n]);if(arguments.length>3)for(r=[r],n=3;n<arguments.length;n++)r.push(o[n]);if(null!=r&&(i.children=r),"function"==typeof e&&null!=e.defaultProps)for(n in e.defaultProps)void 0===i[n]&&(i[n]=e.defaultProps[n]);return p$3(e,i,t&&t.key,t&&t.ref,null)}function p$3(e,t,r,n,o){var i={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o};return null==o&&(i.__v=i),n$6.vnode&&n$6.vnode(i),i}function y$4(){return{}}function d$5(e){return e.children}function m$3(e,t){this.props=e,this.context=t}function w$4(e,t){if(null==t)return e.__?w$4(e.__,e.__.__k.indexOf(e)+1):null;for(var r;t<e.__k.length;t++)if(null!=(r=e.__k[t])&&null!=r.__e)return r.__e;return"function"==typeof e.type?w$4(e):null}function k$3(e){var t,r;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(r=e.__k[t])&&null!=r.__e){e.__e=e.__c.base=r.__e;break}return k$3(e)}}function g$3(e){(!e.__d&&(e.__d=!0)&&u$3.push(e)&&!i$5++||r$5!==n$6.debounceRendering)&&((r$5=n$6.debounceRendering)||t$6)(_$5)}function _$5(){for(var e;i$5=u$3.length;)e=u$3.sort((function(e,t){return e.__v.__b-t.__v.__b})),u$3=[],e.some((function(e){var t,r,n,o,i,s,a;e.__d&&(s=(i=(t=e).__v).__e,(a=t.__P)&&(r=[],(n=a$4({},i)).__v=n,o=A$4(a,i,n,t.__n,void 0!==a.ownerSVGElement,null,r,null==s?w$4(i):s),T$5(r,i),o!=s&&k$3(i)))}))}function b$1(e,t,r,n,o,i,s,a,c){var u,l,d,h,f,p,m,y=r&&r.__k||c$6,g=y.length;if(a==e$7&&(a=null!=i?i[0]:g?w$4(r,0):null),u=0,t.__k=x$2(t.__k,(function(r){if(null!=r){if(r.__=t,r.__b=t.__b+1,null===(d=y[u])||d&&r.key==d.key&&r.type===d.type)y[u]=void 0;else for(l=0;l<g;l++){if((d=y[l])&&r.key==d.key&&r.type===d.type){y[l]=void 0;break}d=null}if(h=A$4(e,r,d=d||e$7,n,o,i,s,a,c),(l=r.ref)&&d.ref!=l&&(m||(m=[]),d.ref&&m.push(d.ref,null,r),m.push(l,r.__c||h,r)),null!=h){var b;if(null==p&&(p=h),void 0!==r.__d)b=r.__d,r.__d=void 0;else if(i==d||h!=a||null==h.parentNode){e:if(null==a||a.parentNode!==e)e.appendChild(h),b=null;else{for(f=a,l=0;(f=f.nextSibling)&&l<g;l+=2)if(f==h)break e;e.insertBefore(h,a),b=a}"option"==t.type&&(e.value="")}a=void 0!==b?b:h.nextSibling,"function"==typeof t.type&&(t.__d=a)}else a&&d.__e==a&&a.parentNode!=e&&(a=w$4(d))}return u++,r})),t.__e=p,null!=i&&"function"!=typeof t.type)for(u=i.length;u--;)null!=i[u]&&v$3(i[u]);for(u=g;u--;)null!=y[u]&&D$4(y[u],y[u]);if(m)for(u=0;u<m.length;u++)j$3(m[u],m[++u],m[++u])}function x$2(e,t,r){if(null==r&&(r=[]),null==e||"boolean"==typeof e)t&&r.push(t(null));else if(Array.isArray(e))for(var n=0;n<e.length;n++)x$2(e[n],t,r);else r.push(t?t("string"==typeof e||"number"==typeof e?p$3(null,e,null,null,e):null!=e.__e||null!=e.__c?p$3(e.type,e.props,e.key,null,e.__v):e):e);return r}function P$2(e,t,r,n,o){var i;for(i in r)"children"===i||"key"===i||i in t||N$3(e,i,null,r[i],n);for(i in t)o&&"function"!=typeof t[i]||"children"===i||"key"===i||"value"===i||"checked"===i||r[i]===t[i]||N$3(e,i,t[i],r[i],n)}function C$3(e,t,r){"-"===t[0]?e.setProperty(t,r):e[t]="number"==typeof r&&!1===s$6.test(t)?r+"px":null==r?"":r}function N$3(e,t,r,n,o){var i,s,a,c,u;if(o?"className"===t&&(t="class"):"class"===t&&(t="className"),"style"===t)if(i=e.style,"string"==typeof r)i.cssText=r;else{if("string"==typeof n&&(i.cssText="",n=null),n)for(c in n)r&&c in r||C$3(i,c,"");if(r)for(u in r)n&&r[u]===n[u]||C$3(i,u,r[u])}else"o"===t[0]&&"n"===t[1]?(s=t!==(t=t.replace(/Capture$/,"")),a=t.toLowerCase(),t=(a in e?a:t).slice(2),r?(n||e.addEventListener(t,z$3,s),(e.l||(e.l={}))[t]=r):e.removeEventListener(t,z$3,s)):"list"!==t&&"tagName"!==t&&"form"!==t&&"type"!==t&&"size"!==t&&!o&&t in e?e[t]=null==r?"":r:"function"!=typeof r&&"dangerouslySetInnerHTML"!==t&&(t!==(t=t.replace(/^xlink:?/,""))?null==r||!1===r?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),r):null==r||!1===r&&!/^ar/.test(t)?e.removeAttribute(t):e.setAttribute(t,r))}function z$3(e){this.l[e.type](n$6.event?n$6.event(e):e)}function A$4(e,t,r,n,o,i,s,a,c){var u,l,d,h,f,p,m,y,g,b,w=t.type;if(void 0!==t.constructor)return null;(u=n$6.__b)&&u(t);try{e:if("function"==typeof w){if(y=t.props,g=(u=w.contextType)&&n[u.__c],b=u?g?g.props.value:u.__:n,r.__c?m=(l=t.__c=r.__c).__=l.__E:("prototype"in w&&w.prototype.render?t.__c=l=new w(y,b):(t.__c=l=new m$3(y,b),l.constructor=w,l.render=E$4),g&&g.sub(l),l.props=y,l.state||(l.state={}),l.context=b,l.__n=n,d=l.__d=!0,l.__h=[]),null==l.__s&&(l.__s=l.state),null!=w.getDerivedStateFromProps&&(l.__s==l.state&&(l.__s=a$4({},l.__s)),a$4(l.__s,w.getDerivedStateFromProps(y,l.__s))),h=l.props,f=l.state,d)null==w.getDerivedStateFromProps&&null!=l.componentWillMount&&l.componentWillMount(),null!=l.componentDidMount&&l.__h.push(l.componentDidMount);else{if(null==w.getDerivedStateFromProps&&y!==h&&null!=l.componentWillReceiveProps&&l.componentWillReceiveProps(y,b),!l.__e&&null!=l.shouldComponentUpdate&&!1===l.shouldComponentUpdate(y,l.__s,b)||t.__v===r.__v&&!l.__){for(l.props=y,l.state=l.__s,t.__v!==r.__v&&(l.__d=!1),l.__v=t,t.__e=r.__e,t.__k=r.__k,l.__h.length&&s.push(l),u=0;u<t.__k.length;u++)t.__k[u]&&(t.__k[u].__=t);break e}null!=l.componentWillUpdate&&l.componentWillUpdate(y,l.__s,b),null!=l.componentDidUpdate&&l.__h.push((function(){l.componentDidUpdate(h,f,p)}))}l.context=b,l.props=y,l.state=l.__s,(u=n$6.__r)&&u(t),l.__d=!1,l.__v=t,l.__P=e,u=l.render(l.props,l.state,l.context),t.__k=null!=u&&u.type==d$5&&null==u.key?u.props.children:Array.isArray(u)?u:[u],null!=l.getChildContext&&(n=a$4(a$4({},n),l.getChildContext())),d||null==l.getSnapshotBeforeUpdate||(p=l.getSnapshotBeforeUpdate(h,f)),b$1(e,t,r,n,o,i,s,a,c),l.base=t.__e,l.__h.length&&s.push(l),m&&(l.__E=l.__=null),l.__e=!1}else null==i&&t.__v===r.__v?(t.__k=r.__k,t.__e=r.__e):t.__e=$$3(r.__e,t,r,n,o,i,s,c);(u=n$6.diffed)&&u(t)}catch(v){t.__v=null,n$6.__e(v,t,r)}return t.__e}function T$5(e,t){n$6.__c&&n$6.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(r){n$6.__e(r,t.__v)}}))}function $$3(e,t,r,n,o,i,s,a){var c,u,l,d,h,f=r.props,p=t.props;if(o="svg"===t.type||o,null!=i)for(c=0;c<i.length;c++)if(null!=(u=i[c])&&((null===t.type?3===u.nodeType:u.localName===t.type)||e==u)){e=u,i[c]=null;break}if(null==e){if(null===t.type)return document.createTextNode(p);e=o?document.createElementNS("http://www.w3.org/2000/svg",t.type):document.createElement(t.type,p.is&&{is:p.is}),i=null,a=!1}if(null===t.type)f!==p&&e.data!=p&&(e.data=p);else{if(null!=i&&(i=c$6.slice.call(e.childNodes)),l=(f=r.props||e$7).dangerouslySetInnerHTML,d=p.dangerouslySetInnerHTML,!a){if(f===e$7)for(f={},h=0;h<e.attributes.length;h++)f[e.attributes[h].name]=e.attributes[h].value;(d||l)&&(d&&l&&d.__html==l.__html||(e.innerHTML=d&&d.__html||""))}P$2(e,p,f,o,a),d?t.__k=[]:(t.__k=t.props.children,b$1(e,t,r,n,"foreignObject"!==t.type&&o,i,s,e$7,a)),a||("value"in p&&void 0!==(c=p.value)&&c!==e.value&&N$3(e,"value",c,f.value,!1),"checked"in p&&void 0!==(c=p.checked)&&c!==e.checked&&N$3(e,"checked",c,f.checked,!1))}return e}function j$3(e,t,r){try{"function"==typeof e?e(t):e.current=t}catch(n){n$6.__e(n,r)}}function D$4(e,t,r){var n,o,i;if(n$6.unmount&&n$6.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||j$3(n,null,t)),r||"function"==typeof e.type||(r=null!=(o=e.__e)),e.__e=e.__d=void 0,null!=(n=e.__c)){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){n$6.__e(s,t)}n.base=n.__P=null}if(n=e.__k)for(i=0;i<n.length;i++)n[i]&&D$4(n[i],t,r);null!=o&&v$3(o)}function E$4(e,t,r){return this.constructor(e,r)}function H$3(e,t,r){var n,o,i;n$6.__&&n$6.__(e,t),o=(n=r===o$7)?null:r&&r.__k||t.__k,e=h$5(d$5,null,[e]),i=[],A$4(t,(n?t:r||t).__k=e,o||e$7,e$7,void 0!==t.ownerSVGElement,r&&!n?[r]:o?null:c$6.slice.call(t.childNodes),i,r||e$7,n),T$5(i,e)}function I$3(e,t){H$3(e,t,o$7)}function L$4(e,t){var r,n;for(n in t=a$4(a$4({},e.props),t),arguments.length>2&&(t.children=c$6.slice.call(arguments,2)),r={},t)"key"!==n&&"ref"!==n&&(r[n]=t[n]);return p$3(e.type,r,t.key||e.key,t.ref||e.ref,null)}function M$3(e){var t={},r={__c:"__cC"+f$2++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,o=this;return this.getChildContext||(n=[],this.getChildContext=function(){return t[r.__c]=o,t},this.shouldComponentUpdate=function(e){o.props.value!==e.value&&n.some((function(t){t.context=e.value,g$3(t)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return r.Consumer.contextType=r,r.Provider.__=r,r}n$6={__e:function(e,t){for(var r,n;t=t.__;)if((r=t.__c)&&!r.__)try{if(r.constructor&&null!=r.constructor.getDerivedStateFromError&&(n=!0,r.setState(r.constructor.getDerivedStateFromError(e))),null!=r.componentDidCatch&&(n=!0,r.componentDidCatch(e)),n)return g$3(r.__E=r)}catch(o){e=o}throw e}},m$3.prototype.setState=function(e,t){var r;r=this.__s!==this.state?this.__s:this.__s=a$4({},this.state),"function"==typeof e&&(e=e(r,this.props)),e&&a$4(r,e),null!=e&&this.__v&&(t&&this.__h.push(t),g$3(this))},m$3.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),g$3(this))},m$3.prototype.render=d$5,u$3=[],i$5=0,t$6="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,o$7=e$7,f$2=0;var t$5,u$2,r$4,i$4=0,o$6=[],c$5=n$6.__r,f$1=n$6.diffed,e$6=n$6.__c,a$3=n$6.unmount;function v$2(e,t){n$6.__h&&n$6.__h(u$2,e,i$4||t),i$4=0;var r=u$2.__H||(u$2.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function m$2(e){return i$4=1,p$2(E$3,e)}function p$2(e,t,r){var n=v$2(t$5++,2);return n.__c||(n.__c=u$2,n.__=[r?r(t):E$3(void 0,t),function(t){var r=e(n.__[0],t);n.__[0]!==r&&(n.__[0]=r,n.__c.setState({}))}]),n.__}function l$5(e,t){var r=v$2(t$5++,3);!n$6.__s&&x$1(r.__H,t)&&(r.__=e,r.__H=t,u$2.__H.__h.push(r))}function y$3(e,t){var r=v$2(t$5++,4);!n$6.__s&&x$1(r.__H,t)&&(r.__=e,r.__H=t,u$2.__h.push(r))}function d$4(e){return i$4=5,h$4((function(){return{current:e}}),[])}function s$5(e,t,r){i$4=6,y$3((function(){"function"==typeof e?e(t()):e&&(e.current=t())}),null==r?r:r.concat(e))}function h$4(e,t){var r=v$2(t$5++,7);return x$1(r.__H,t)?(r.__H=t,r.__h=e,r.__=e()):r.__}function T$4(e,t){return i$4=8,h$4((function(){return e}),t)}function w$3(e){var t=u$2.context[e.__c],r=v$2(t$5++,9);return r.__c=e,t?(null==r.__&&(r.__=!0,t.sub(u$2)),t.props.value):e.__}function A$3(e,t){n$6.useDebugValue&&n$6.useDebugValue(t?t(e):e)}function F$3(e){var t=v$2(t$5++,10),r=m$2();return t.__=e,u$2.componentDidCatch||(u$2.componentDidCatch=function(e){t.__&&t.__(e),r[1](e)}),[r[0],function(){r[1](void 0)}]}function _$4(){o$6.some((function(e){if(e.__P)try{e.__H.__h.forEach(g$2),e.__H.__h.forEach(q$3),e.__H.__h=[]}catch(t){return e.__H.__h=[],n$6.__e(t,e.__v),!0}})),o$6=[]}function g$2(e){e.t&&e.t()}function q$3(e){var t=e.__();"function"==typeof t&&(e.t=t)}function x$1(e,t){return!e||t.some((function(t,r){return t!==e[r]}))}function E$3(e,t){return"function"==typeof t?t(e):t}function E$2(e,t){for(var r in t)e[r]=t[r];return e}function w$2(e,t){for(var r in e)if("__source"!==r&&!(r in t))return!0;for(var n in t)if("__source"!==n&&e[n]!==t[n])return!0;return!1}n$6.__r=function(e){c$5&&c$5(e),t$5=0,(u$2=e.__c).__H&&(u$2.__H.__h.forEach(g$2),u$2.__H.__h.forEach(q$3),u$2.__H.__h=[])},n$6.diffed=function(e){f$1&&f$1(e);var t=e.__c;if(t){var r=t.__H;r&&r.__h.length&&(1!==o$6.push(t)&&r$4===n$6.requestAnimationFrame||((r$4=n$6.requestAnimationFrame)||function(e){var t,r=function(){clearTimeout(n),cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);"undefined"!=typeof window&&(t=requestAnimationFrame(r))})(_$4))}},n$6.__c=function(e,t){t.some((function(e){try{e.__h.forEach(g$2),e.__h=e.__h.filter((function(e){return!e.__||q$3(e)}))}catch(r){t.some((function(e){e.__h&&(e.__h=[])})),t=[],n$6.__e(r,e.__v)}})),e$6&&e$6(e,t)},n$6.unmount=function(e){a$3&&a$3(e);var t=e.__c;if(t){var r=t.__H;if(r)try{r.__.forEach((function(e){return e.t&&e.t()}))}catch(n){n$6.__e(n,t.__v)}}};var C$2=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).isPureReactComponent=!0,r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.prototype.shouldComponentUpdate=function(e,t){return w$2(this.props,e)||w$2(this.state,t)},n}(m$3);function _$3(e,t){function r(e){var r=this.props.ref,n=r==e.ref;return!n&&r&&(r.call?r(null):r.current=null),t?!t(this.props,e)||!n:w$2(this.props,e)}function n(t){return this.shouldComponentUpdate=r,h$5(e,E$2({},t))}return n.prototype.isReactComponent=!0,n.displayName="Memo("+(e.displayName||e.name)+")",n.t=!0,n}var A$2=n$6.__b;function S$4(e){function t(t){var r=E$2({},t);return delete r.ref,e(r,t.ref)}return t.prototype.isReactComponent=t.t=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}n$6.__b=function(e){e.type&&e.type.t&&e.ref&&(e.props.ref=e.ref,e.ref=null),A$2&&A$2(e)};var k$2=function(e,t){return e?x$2(e).reduce((function(e,r,n){return e.concat(t(r,n))}),[]):null},R$2={map:k$2,forEach:k$2,count:function(e){return e?x$2(e).length:0},only:function(e){if(1!==(e=x$2(e)).length)throw new Error("Children.only() expects only one child.");return e[0]},toArray:x$2},F$2=n$6.__e;function N$2(e){return e&&((e=E$2({},e)).__c=null,e.__k=e.__k&&e.__k.map(N$2)),e}function U$1(){this.__u=0,this.o=null,this.__b=null}function M$2(e){var t=e.__.__c;return t&&t.u&&t.u(e)}function L$3(e){var t,r,n;function o(o){if(t||(t=e()).then((function(e){r=e.default||e}),(function(e){n=e})),n)throw n;if(!r)throw t;return h$5(r,o)}return o.displayName="Lazy",o.t=!0,o}function O$1(){this.i=null,this.l=null}n$6.__e=function(e,t,r){if(e.then)for(var n,o=t;o=o.__;)if((n=o.__c)&&n.__c)return n.__c(e,t.__c);F$2(e,t,r)},(U$1.prototype=new m$3).__c=function(e,t){var r=this;null==r.o&&(r.o=[]),r.o.push(t);var n=M$2(r.__v),o=!1,i=function(){o||(o=!0,n?n(s):s())};t.__c=t.componentWillUnmount,t.componentWillUnmount=function(){i(),t.__c&&t.__c()};var s=function(){var e;if(! --r.__u)for(r.__v.__k[0]=r.state.u,r.setState({u:r.__b=null});e=r.o.pop();)e.forceUpdate()};r.__u++||r.setState({u:r.__b=r.__v.__k[0]}),e.then(i,i)},U$1.prototype.render=function(e,t){return this.__b&&(this.__v.__k[0]=N$2(this.__b),this.__b=null),[h$5(m$3,null,t.u?null:e.children),t.u&&e.fallback]};var P$1=function(e,t,r){if(++r[1]===r[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(r=e.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.i=r=r[2]}};(O$1.prototype=new m$3).u=function(e){var t=this,r=M$2(t.__v),n=t.l.get(e);return n[0]++,function(o){var i=function(){t.props.revealOrder?(n.push(o),P$1(t,e,n)):o()};r?r(i):i()}},O$1.prototype.render=function(e){this.i=null,this.l=new Map;var t=x$2(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var r=t.length;r--;)this.l.set(t[r],this.i=[1,0,this.i]);return e.children},O$1.prototype.componentDidUpdate=O$1.prototype.componentDidMount=function(){var e=this;e.l.forEach((function(t,r){P$1(e,r,t)}))};var W$1=function(){function e(){}var t=e.prototype;return t.getChildContext=function(){return this.props.context},t.render=function(e){return e.children},e}();function j$2(e){var t=this,r=e.container,n=h$5(W$1,{context:t.context},e.vnode);return t.s&&t.s!==r&&(t.v.parentNode&&t.s.removeChild(t.v),D$4(t.h),t.p=!1),e.vnode?t.p?(r.__k=t.__k,H$3(n,r),t.__k=r.__k):(t.v=document.createTextNode(""),I$3("",r),r.appendChild(t.v),t.p=!0,t.s=r,H$3(n,r,t.v),t.__k=t.v.__k):t.p&&(t.v.parentNode&&t.s.removeChild(t.v),D$4(t.h)),t.h=n,t.componentWillUnmount=function(){t.v.parentNode&&t.s.removeChild(t.v),D$4(t.h)},null}function z$2(e,t){return h$5(j$2,{vnode:e,container:t})}var D$3=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/;m$3.prototype.isReactComponent={};var H$2="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;function T$3(e,t,r){if(null==t.__k)for(;t.firstChild;)t.removeChild(t.firstChild);return H$3(e,t),"function"==typeof r&&r(),e?e.__c:null}function V$2(e,t,r){return I$3(e,t),"function"==typeof r&&r(),e?e.__c:null}var Z$3=n$6.event;function I$2(e,t){e["UNSAFE_"+t]&&!e[t]&&Object.defineProperty(e,t,{configurable:!1,get:function(){return this["UNSAFE_"+t]},set:function(e){this["UNSAFE_"+t]=e}})}n$6.event=function(e){Z$3&&(e=Z$3(e)),e.persist=function(){};var t=!1,r=!1,n=e.stopPropagation;e.stopPropagation=function(){n.call(e),t=!0};var o=e.preventDefault;return e.preventDefault=function(){o.call(e),r=!0},e.isPropagationStopped=function(){return t},e.isDefaultPrevented=function(){return r},e.nativeEvent=e};var $$2={configurable:!0,get:function(){return this.class}},q$2=n$6.vnode;n$6.vnode=function(e){e.$$typeof=H$2;var t=e.type,r=e.props;if(t){if(r.class!=r.className&&($$2.enumerable="className"in r,null!=r.className&&(r.class=r.className),Object.defineProperty(r,"className",$$2)),"function"!=typeof t){var n,o,i;for(i in r.defaultValue&&void 0!==r.value&&(r.value||0===r.value||(r.value=r.defaultValue),delete r.defaultValue),Array.isArray(r.value)&&r.multiple&&"select"===t&&(x$2(r.children).forEach((function(e){-1!=r.value.indexOf(e.props.value)&&(e.props.selected=!0)})),delete r.value),r)if(n=D$3.test(i))break;if(n)for(i in o=e.props={},r)o[D$3.test(i)?i.replace(/[A-Z0-9]/,"-$&").toLowerCase():i]=r[i]}!function(){var t=e.type,r=e.props;if(r&&"string"==typeof t){var n={};for(var o in r)/^on(Ani|Tra|Tou)/.test(o)&&(r[o.toLowerCase()]=r[o],delete r[o]),n[o.toLowerCase()]=o;if(n.ondoubleclick&&(r.ondblclick=r[n.ondoubleclick],delete r[n.ondoubleclick]),n.onbeforeinput&&(r.onbeforeinput=r[n.onbeforeinput],delete r[n.onbeforeinput]),n.onchange&&("textarea"===t||"input"===t.toLowerCase()&&!/^fil|che|ra/i.test(r.type))){var i=n.oninput||"oninput";r[i]||(r[i]=r[n.onchange],delete r[n.onchange])}}}(),"function"==typeof t&&!t.m&&t.prototype&&(I$2(t.prototype,"componentWillMount"),I$2(t.prototype,"componentWillReceiveProps"),I$2(t.prototype,"componentWillUpdate"),t.m=!0)}q$2&&q$2(e)};var B$3="16.8.0";function G$2(e){return h$5.bind(null,e)}function J$1(e){return!!e&&e.$$typeof===H$2}function K$2(e){return J$1(e)?L$4.apply(null,arguments):e}function Q$2(e){return!!e.__k&&(H$3(null,e),!0)}function X$1(e){return e&&(e.base||1===e.nodeType&&e)||null}var Y$2=function(e,t){return e(t)};const compat_module={useState:m$2,useReducer:p$2,useEffect:l$5,useLayoutEffect:y$3,useRef:d$4,useImperativeHandle:s$5,useMemo:h$4,useCallback:T$4,useContext:w$3,useDebugValue:A$3,version:"16.8.0",Children:R$2,render:T$3,hydrate:T$3,unmountComponentAtNode:Q$2,createPortal:z$2,createElement:h$5,createContext:M$3,createFactory:G$2,cloneElement:K$2,createRef:y$4,Fragment:d$5,isValidElement:J$1,findDOMNode:X$1,Component:m$3,PureComponent:C$2,memo:_$3,forwardRef:S$4,unstable_batchedUpdates:Y$2,Suspense:U$1,SuspenseList:O$1,lazy:L$3},compat_module$1=Object.freeze(Object.defineProperty({__proto__:null,Children:R$2,Component:m$3,Fragment:d$5,PureComponent:C$2,Suspense:U$1,SuspenseList:O$1,cloneElement:K$2,createContext:M$3,createElement:h$5,createFactory:G$2,createPortal:z$2,createRef:y$4,default:compat_module,findDOMNode:X$1,forwardRef:S$4,hydrate:V$2,isValidElement:J$1,lazy:L$3,memo:_$3,render:T$3,unmountComponentAtNode:Q$2,unstable_batchedUpdates:Y$2,useCallback:T$4,useContext:w$3,useDebugValue:A$3,useEffect:l$5,useErrorBoundary:F$3,useImperativeHandle:s$5,useLayoutEffect:y$3,useMemo:h$4,useReducer:p$2,useRef:d$4,useState:m$2,version:B$3},Symbol.toStringTag,{value:"Module"})),require$$3=getAugmentedNamespace(compat_module$1);function _interopDefault$1(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var browserUtils=require$$0,QRCode$1=_interopDefault$1(browser$1),copy=_interopDefault$1(copyToClipboard),React=require$$3;function open(e){QRCode$1.toString(e,{type:"terminal"}).then(console.log)}var WALLETCONNECT_STYLE_SHEET=':root {\n --animation-duration: 300ms;\n}\n\n@keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes fadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n.animated {\n animation-duration: var(--animation-duration);\n animation-fill-mode: both;\n}\n\n.fadeIn {\n animation-name: fadeIn;\n}\n\n.fadeOut {\n animation-name: fadeOut;\n}\n\n#walletconnect-wrapper {\n -webkit-user-select: none;\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n left: 0;\n pointer-events: none;\n position: fixed;\n top: 0;\n user-select: none;\n width: 100%;\n z-index: 99999999999999;\n}\n\n.walletconnect-modal__headerLogo {\n height: 21px;\n}\n\n.walletconnect-modal__header p {\n color: #ffffff;\n font-size: 20px;\n font-weight: 600;\n margin: 0;\n align-items: flex-start;\n display: flex;\n flex: 1;\n margin-left: 5px;\n}\n\n.walletconnect-modal__close__wrapper {\n position: absolute;\n top: 0px;\n right: 0px;\n z-index: 10000;\n background: white;\n border-radius: 26px;\n padding: 6px;\n box-sizing: border-box;\n width: 26px;\n height: 26px;\n cursor: pointer;\n}\n\n.walletconnect-modal__close__icon {\n position: relative;\n top: 7px;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n transform: rotate(45deg);\n}\n\n.walletconnect-modal__close__line1 {\n position: absolute;\n width: 100%;\n border: 1px solid rgb(48, 52, 59);\n}\n\n.walletconnect-modal__close__line2 {\n position: absolute;\n width: 100%;\n border: 1px solid rgb(48, 52, 59);\n transform: rotate(90deg);\n}\n\n.walletconnect-qrcode__base {\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n background: rgba(37, 41, 46, 0.95);\n height: 100%;\n left: 0;\n pointer-events: auto;\n position: fixed;\n top: 0;\n transition: 0.4s cubic-bezier(0.19, 1, 0.22, 1);\n width: 100%;\n will-change: opacity;\n padding: 40px;\n box-sizing: border-box;\n}\n\n.walletconnect-qrcode__text {\n color: rgba(60, 66, 82, 0.6);\n font-size: 16px;\n font-weight: 600;\n letter-spacing: 0;\n line-height: 1.1875em;\n margin: 10px 0 20px 0;\n text-align: center;\n width: 100%;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-qrcode__text {\n font-size: 4vw;\n }\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-qrcode__text {\n font-size: 14px;\n }\n}\n\n.walletconnect-qrcode__image {\n width: calc(100% - 30px);\n box-sizing: border-box;\n cursor: none;\n margin: 0 auto;\n}\n\n.walletconnect-qrcode__notification {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n font-size: 16px;\n padding: 16px 20px;\n border-radius: 16px;\n text-align: center;\n transition: all 0.1s ease-in-out;\n background: white;\n color: black;\n margin-bottom: -60px;\n opacity: 0;\n}\n\n.walletconnect-qrcode__notification.notification__show {\n opacity: 1;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-modal__header {\n height: 130px;\n }\n .walletconnect-modal__base {\n overflow: auto;\n }\n}\n\n@media only screen and (min-device-width: 415px) and (max-width: 768px) {\n #content {\n max-width: 768px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (min-width: 375px) and (max-width: 415px) {\n #content {\n max-width: 414px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (min-width: 320px) and (max-width: 375px) {\n #content {\n max-width: 375px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (max-width: 320px) {\n #content {\n max-width: 320px;\n box-sizing: border-box;\n }\n}\n\n.walletconnect-modal__base {\n -webkit-font-smoothing: antialiased;\n background: #ffffff;\n border-radius: 24px;\n box-shadow: 0 10px 50px 5px rgba(0, 0, 0, 0.4);\n font-family: ui-rounded, "SF Pro Rounded", "SF Pro Text", medium-content-sans-serif-font,\n -apple-system, BlinkMacSystemFont, ui-sans-serif, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell,\n "Open Sans", "Helvetica Neue", sans-serif;\n margin-top: 41px;\n padding: 24px 24px 22px;\n pointer-events: auto;\n position: relative;\n text-align: center;\n transition: 0.4s cubic-bezier(0.19, 1, 0.22, 1);\n will-change: transform;\n overflow: visible;\n transform: translateY(-50%);\n top: 50%;\n max-width: 500px;\n margin: auto;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-modal__base {\n padding: 24px 12px;\n }\n}\n\n.walletconnect-modal__base .hidden {\n transform: translateY(150%);\n transition: 0.125s cubic-bezier(0.4, 0, 1, 1);\n}\n\n.walletconnect-modal__header {\n align-items: center;\n display: flex;\n height: 26px;\n left: 0;\n justify-content: space-between;\n position: absolute;\n top: -42px;\n width: 100%;\n}\n\n.walletconnect-modal__base .wc-logo {\n align-items: center;\n display: flex;\n height: 26px;\n margin-top: 15px;\n padding-bottom: 15px;\n pointer-events: auto;\n}\n\n.walletconnect-modal__base .wc-logo div {\n background-color: #3399ff;\n height: 21px;\n margin-right: 5px;\n mask-image: url("images/wc-logo.svg") center no-repeat;\n width: 32px;\n}\n\n.walletconnect-modal__base .wc-logo p {\n color: #ffffff;\n font-size: 20px;\n font-weight: 600;\n margin: 0;\n}\n\n.walletconnect-modal__base h2 {\n color: rgba(60, 66, 82, 0.6);\n font-size: 16px;\n font-weight: 600;\n letter-spacing: 0;\n line-height: 1.1875em;\n margin: 0 0 19px 0;\n text-align: center;\n width: 100%;\n}\n\n.walletconnect-modal__base__row {\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n align-items: center;\n border-radius: 20px;\n cursor: pointer;\n display: flex;\n height: 56px;\n justify-content: space-between;\n padding: 0 15px;\n position: relative;\n margin: 0px 0px 8px;\n text-align: left;\n transition: 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n will-change: transform;\n text-decoration: none;\n}\n\n.walletconnect-modal__base__row:hover {\n background: rgba(60, 66, 82, 0.06);\n}\n\n.walletconnect-modal__base__row:active {\n background: rgba(60, 66, 82, 0.06);\n transform: scale(0.975);\n transition: 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n}\n\n.walletconnect-modal__base__row__h3 {\n color: #25292e;\n font-size: 20px;\n font-weight: 700;\n margin: 0;\n padding-bottom: 3px;\n}\n\n.walletconnect-modal__base__row__right {\n align-items: center;\n display: flex;\n justify-content: center;\n}\n\n.walletconnect-modal__base__row__right__app-icon {\n border-radius: 8px;\n height: 34px;\n margin: 0 11px 2px 0;\n width: 34px;\n background-size: 100%;\n box-shadow: 0 4px 12px 0 rgba(37, 41, 46, 0.25);\n}\n\n.walletconnect-modal__base__row__right__caret {\n height: 18px;\n opacity: 0.3;\n transition: 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n width: 8px;\n will-change: opacity;\n}\n\n.walletconnect-modal__base__row:hover .caret,\n.walletconnect-modal__base__row:active .caret {\n opacity: 0.6;\n}\n\n.walletconnect-modal__mobile__toggle {\n width: 80%;\n display: flex;\n margin: 0 auto;\n position: relative;\n overflow: hidden;\n border-radius: 8px;\n margin-bottom: 18px;\n background: #d4d5d9;\n}\n\n.walletconnect-modal__single_wallet {\n display: flex;\n justify-content: center;\n margin-top: 7px;\n margin-bottom: 18px;\n}\n\n.walletconnect-modal__single_wallet a {\n cursor: pointer;\n color: rgb(64, 153, 255);\n font-size: 21px;\n font-weight: 800;\n text-decoration: none !important;\n margin: 0 auto;\n}\n\n.walletconnect-modal__mobile__toggle_selector {\n width: calc(50% - 8px);\n background: white;\n position: absolute;\n border-radius: 5px;\n height: calc(100% - 8px);\n top: 4px;\n transition: all 0.2s ease-in-out;\n transform: translate3d(4px, 0, 0);\n}\n\n.walletconnect-modal__mobile__toggle.right__selected .walletconnect-modal__mobile__toggle_selector {\n transform: translate3d(calc(100% + 12px), 0, 0);\n}\n\n.walletconnect-modal__mobile__toggle a {\n font-size: 12px;\n width: 50%;\n text-align: center;\n padding: 8px;\n margin: 0;\n font-weight: 600;\n z-index: 1;\n}\n\n.walletconnect-modal__footer {\n display: flex;\n justify-content: center;\n margin-top: 20px;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-modal__footer {\n margin-top: 5vw;\n }\n}\n\n.walletconnect-modal__footer a {\n cursor: pointer;\n color: #898d97;\n font-size: 15px;\n margin: 0 auto;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-modal__footer a {\n font-size: 14px;\n }\n}\n\n.walletconnect-connect__buttons__wrapper {\n max-height: 44vh;\n}\n\n.walletconnect-connect__buttons__wrapper__android {\n margin: 50% 0;\n}\n\n.walletconnect-connect__buttons__wrapper__wrap {\n display: grid;\n grid-template-columns: repeat(4, 1fr);\n margin: 10px 0;\n}\n\n@media only screen and (min-width: 768px) {\n .walletconnect-connect__buttons__wrapper__wrap {\n margin-top: 40px;\n }\n}\n\n.walletconnect-connect__button {\n background-color: rgb(64, 153, 255);\n padding: 12px;\n border-radius: 8px;\n text-decoration: none;\n color: rgb(255, 255, 255);\n font-weight: 500;\n}\n\n.walletconnect-connect__button__icon_anchor {\n cursor: pointer;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n margin: 8px;\n width: 42px;\n justify-self: center;\n flex-direction: column;\n text-decoration: none !important;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-connect__button__icon_anchor {\n margin: 4px;\n }\n}\n\n.walletconnect-connect__button__icon {\n border-radius: 10px;\n height: 42px;\n margin: 0;\n width: 42px;\n background-size: cover !important;\n box-shadow: 0 4px 12px 0 rgba(37, 41, 46, 0.25);\n}\n\n.walletconnect-connect__button__text {\n color: #424952;\n font-size: 2.7vw;\n text-decoration: none !important;\n padding: 0;\n margin-top: 1.8vw;\n font-weight: 600;\n}\n\n@media only screen and (min-width: 768px) {\n .walletconnect-connect__button__text {\n font-size: 16px;\n margin-top: 12px;\n }\n}\n\n.walletconnect-search__input {\n border: none;\n background: #d4d5d9;\n border-style: none;\n padding: 8px 16px;\n outline: none;\n font-style: normal;\n font-stretch: normal;\n font-size: 16px;\n font-style: normal;\n font-stretch: normal;\n line-height: normal;\n letter-spacing: normal;\n text-align: left;\n border-radius: 8px;\n width: calc(100% - 16px);\n margin: 0;\n margin-bottom: 8px;\n}\n';function _catch(e,t){try{var r=e()}catch(e2){return t(e2)}return r&&r.then?r.then(void 0,t):r}"undefined"==typeof Symbol||(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"==typeof Symbol||(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var WALLETCONNECT_LOGO_SVG_URL="data:image/svg+xml,%3Csvg height='185' viewBox='0 0 300 185' width='300' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m61.4385429 36.2562612c48.9112241-47.8881663 128.2119871-47.8881663 177.1232091 0l5.886545 5.7634174c2.445561 2.3944081 2.445561 6.2765112 0 8.6709204l-20.136695 19.715503c-1.222781 1.1972051-3.2053 1.1972051-4.428081 0l-8.100584-7.9311479c-34.121692-33.4079817-89.443886-33.4079817-123.5655788 0l-8.6750562 8.4936051c-1.2227816 1.1972041-3.205301 1.1972041-4.4280806 0l-20.1366949-19.7155031c-2.4455612-2.3944092-2.4455612-6.2765122 0-8.6709204zm218.7677961 40.7737449 17.921697 17.546897c2.445549 2.3943969 2.445563 6.2764769.000031 8.6708899l-80.810171 79.121134c-2.445544 2.394426-6.410582 2.394453-8.85616.000062-.00001-.00001-.000022-.000022-.000032-.000032l-57.354143-56.154572c-.61139-.598602-1.60265-.598602-2.21404 0-.000004.000004-.000007.000008-.000011.000011l-57.3529212 56.154531c-2.4455368 2.394432-6.4105755 2.394472-8.8561612.000087-.0000143-.000014-.0000296-.000028-.0000449-.000044l-80.81241943-79.122185c-2.44556021-2.394408-2.44556021-6.2765115 0-8.6709197l17.92172963-17.5468673c2.4455602-2.3944082 6.4105989-2.3944082 8.8561602 0l57.3549775 56.155357c.6113908.598602 1.602649.598602 2.2140398 0 .0000092-.000009.0000174-.000017.0000265-.000024l57.3521031-56.155333c2.445505-2.3944633 6.410544-2.3945531 8.856161-.0002.000034.0000336.000068.0000673.000101.000101l57.354902 56.155432c.61139.598601 1.60265.598601 2.21404 0l57.353975-56.1543249c2.445561-2.3944092 6.410599-2.3944092 8.85616 0z' fill='%233b99fc'/%3E%3C/svg%3E",WALLETCONNECT_HEADER_TEXT="WalletConnect",ANIMATION_DURATION=300,DEFAULT_BUTTON_COLOR="rgb(64, 153, 255)",WALLETCONNECT_WRAPPER_ID="walletconnect-wrapper",WALLETCONNECT_STYLE_ID="walletconnect-style-sheet",WALLETCONNECT_MODAL_ID="walletconnect-qrcode-modal",WALLETCONNECT_CLOSE_BUTTON_ID="walletconnect-qrcode-close",WALLETCONNECT_CTA_TEXT_ID="walletconnect-qrcode-text",WALLETCONNECT_CONNECT_BUTTON_ID="walletconnect-connect-button";function Header(e){return React.createElement("div",{className:"walletconnect-modal__header"},React.createElement("img",{src:WALLETCONNECT_LOGO_SVG_URL,className:"walletconnect-modal__headerLogo"}),React.createElement("p",null,WALLETCONNECT_HEADER_TEXT),React.createElement("div",{className:"walletconnect-modal__close__wrapper",onClick:e.onClose},React.createElement("div",{id:WALLETCONNECT_CLOSE_BUTTON_ID,className:"walletconnect-modal__close__icon"},React.createElement("div",{className:"walletconnect-modal__close__line1"}),React.createElement("div",{className:"walletconnect-modal__close__line2"}))))}function ConnectButton(e){return React.createElement("a",{className:"walletconnect-connect__button",href:e.href,id:WALLETCONNECT_CONNECT_BUTTON_ID+"-"+e.name,onClick:e.onClick,rel:"noopener noreferrer",style:{backgroundColor:e.color},target:"_blank"},e.name)}var CARET_SVG_URL="data:image/svg+xml,%3Csvg fill='none' height='18' viewBox='0 0 8 18' width='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath clip-rule='evenodd' d='m.586301.213898c-.435947.33907-.5144813.967342-.175411 1.403292l4.87831 6.27212c.28087.36111.28087.86677 0 1.22788l-4.878311 6.27211c-.33907.436-.260536 1.0642.175412 1.4033.435949.3391 1.064219.2605 1.403289-.1754l4.87832-6.2721c.84259-1.08336.84259-2.60034 0-3.68367l-4.87832-6.27212c-.33907-.4359474-.96734-.514482-1.403289-.175412z' fill='%233c4252' fill-rule='evenodd'/%3E%3C/svg%3E";function WalletButton(e){var t=e.color,r=e.href,n=e.name,o=e.logo,i=e.onClick;return React.createElement("a",{className:"walletconnect-modal__base__row",href:r,onClick:i,rel:"noopener noreferrer",target:"_blank"},React.createElement("h3",{className:"walletconnect-modal__base__row__h3"},n),React.createElement("div",{className:"walletconnect-modal__base__row__right"},React.createElement("div",{className:"walletconnect-modal__base__row__right__app-icon",style:{background:"url('"+o+"') "+t,backgroundSize:"100%"}}),React.createElement("img",{src:CARET_SVG_URL,className:"walletconnect-modal__base__row__right__caret"})))}function WalletIcon(e){var t=e.color,r=e.href,n=e.name,o=e.logo,i=e.onClick,s=window.innerWidth<768?(n.length>8?2.5:2.7)+"vw":"inherit";return React.createElement("a",{className:"walletconnect-connect__button__icon_anchor",href:r,onClick:i,rel:"noopener noreferrer",target:"_blank"},React.createElement("div",{className:"walletconnect-connect__button__icon",style:{background:"url('"+o+"') "+t,backgroundSize:"100%"}}),React.createElement("div",{style:{fontSize:s},className:"walletconnect-connect__button__text"},n))}var GRID_MIN_COUNT=5,LINKS_PER_PAGE=12;function LinkDisplay(e){var t=browserUtils.isAndroid(),r=React.useState(""),n=r[0],o=r[1],i=React.useState(""),s=i[0],a=i[1],c=React.useState(1),u=c[0],l=c[1],d=s?e.links.filter((function(e){return e.name.toLowerCase().includes(s.toLowerCase())})):e.links,h=e.errorMessage,f=s||d.length>GRID_MIN_COUNT,p=Math.ceil(d.length/LINKS_PER_PAGE),m=[(u-1)*LINKS_PER_PAGE+1,u*LINKS_PER_PAGE],y=d.length?d.filter((function(e,t){return t+1>=m[0]&&t+1<=m[1]})):[],g=!(t||!(p>1)),b=void 0;return React.createElement("div",null,React.createElement("p",{id:WALLETCONNECT_CTA_TEXT_ID,className:"walletconnect-qrcode__text"},t?e.text.connect_mobile_wallet:e.text.choose_preferred_wallet),!t&&React.createElement("input",{className:"walletconnect-search__input",placeholder:"Search",value:n,onChange:function(e){o(e.target.value),clearTimeout(b),e.target.value?b=setTimeout((function(){a(e.target.value),l(1)}),1e3):(o(""),a(""),l(1))}}),React.createElement("div",{className:"walletconnect-connect__buttons__wrapper"+(t?"__android":f&&d.length?"__wrap":"")},t?React.createElement(ConnectButton,{name:e.text.connect,color:DEFAULT_BUTTON_COLOR,href:e.uri,onClick:React.useCallback((function(){browserUtils.saveMobileLinkInfo({name:"Unknown",href:e.uri})}),[])}):y.length?y.map((function(t){var r=t.color,n=t.name,o=t.shortName,i=t.logo,s=browserUtils.formatIOSMobile(e.uri,t),a=React.useCallback((function(){browserUtils.saveMobileLinkInfo({name:n,href:s})}),[y]);return f?React.createElement(WalletIcon,{color:r,href:s,name:o||n,logo:i,onClick:a}):React.createElement(WalletButton,{color:r,href:s,name:n,logo:i,onClick:a})})):React.createElement(React.Fragment,null,React.createElement("p",null,h.length?e.errorMessage:e.links.length&&!d.length?e.text.no_wallets_found:e.text.loading))),g&&React.createElement("div",{className:"walletconnect-modal__footer"},Array(p).fill(0).map((function(e,t){var r=t+1,n=u===r;return React.createElement("a",{style:{margin:"auto 10px",fontWeight:n?"bold":"normal"},onClick:function(){return l(r)}},r)}))))}function Notification(e){var t=!!e.message.trim();return React.createElement("div",{className:"walletconnect-qrcode__notification"+(t?" notification__show":"")},e.message)}var formatQRCodeImage=function(e){try{var t="";return Promise.resolve(QRCode$1.toString(e,{margin:0,type:"svg"})).then((function(e){return"string"==typeof e&&(t=e.replace("<svg",'<svg class="walletconnect-qrcode__image"')),t}))}catch(e2){return Promise.reject(e2)}};function QRCodeDisplay(e){var t=React.useState(""),r=t[0],n=t[1],o=React.useState(""),i=o[0],s=o[1];React.useEffect((function(){try{return Promise.resolve(formatQRCodeImage(e.uri)).then((function(e){s(e)}))}catch(e2){Promise.reject(e2)}}),[]);return React.createElement("div",null,React.createElement("p",{id:WALLETCONNECT_CTA_TEXT_ID,className:"walletconnect-qrcode__text"},e.text.scan_qrcode_with_wallet),React.createElement("div",{dangerouslySetInnerHTML:{__html:i}}),React.createElement("div",{className:"walletconnect-modal__footer"},React.createElement("a",{onClick:function(){copy(e.uri)?(n(e.text.copied_to_clipboard),setInterval((function(){return n("")}),1200)):(n("Error"),setInterval((function(){return n("")}),1200))}},e.text.copy_to_clipboard)),React.createElement(Notification,{message:r}))}function Modal(e){var t=browserUtils.isAndroid(),r=browserUtils.isMobile(),n=r?e.qrcodeModalOptions&&e.qrcodeModalOptions.mobileLinks?e.qrcodeModalOptions.mobileLinks:void 0:e.qrcodeModalOptions&&e.qrcodeModalOptions.desktopLinks?e.qrcodeModalOptions.desktopLinks:void 0,o=React.useState(!1),i=o[0],s=o[1],a=React.useState(!1),c=a[0],u=a[1],l=React.useState(!r),d=l[0],h=l[1],f={mobile:r,text:e.text,uri:e.uri,qrcodeModalOptions:e.qrcodeModalOptions},p=React.useState(""),m=p[0],y=p[1],g=React.useState(!1),b=g[0],w=g[1],v=React.useState([]),_=v[0],A=v[1],I=React.useState(""),T=I[0],k=I[1],S=function(){c||i||n&&!n.length||_.length>0||React.useEffect((function(){!function(){try{if(t)return Promise.resolve();s(!0);var o=_catch((function(){var t=e.qrcodeModalOptions&&e.qrcodeModalOptions.registryUrl?e.qrcodeModalOptions.registryUrl:browserUtils.getWalletRegistryUrl();return Promise.resolve(fetch(t)).then((function(t){return Promise.resolve(t.json()).then((function(t){var o=t.listings,i=r?"mobile":"desktop",a=browserUtils.getMobileLinkRegistry(browserUtils.formatMobileRegistry(o,i),n);s(!1),u(!0),k(a.length?"":e.text.no_supported_wallets),A(a);var c=1===a.length;c&&(y(browserUtils.formatIOSMobile(e.uri,a[0])),h(!0)),w(c)}))}))}),(function(t){s(!1),u(!0),k(e.text.something_went_wrong),console.error(t)}));return Promise.resolve(o&&o.then?o.then((function(){})):void 0)}catch(e2){return Promise.reject(e2)}}()}))};S();var E=r?d:!d;return React.createElement("div",{id:WALLETCONNECT_MODAL_ID,className:"walletconnect-qrcode__base animated fadeIn"},React.createElement("div",{className:"walletconnect-modal__base"},React.createElement(Header,{onClose:e.onClose}),b&&d?React.createElement("div",{className:"walletconnect-modal__single_wallet"},React.createElement("a",{onClick:function(){return browserUtils.saveMobileLinkInfo({name:_[0].name,href:m})},href:m,rel:"noopener noreferrer",target:"_blank"},e.text.connect_with+" "+(b?_[0].name:"")+" ›")):t||i||!i&&_.length?React.createElement("div",{className:"walletconnect-modal__mobile__toggle"+(E?" right__selected":"")},React.createElement("div",{className:"walletconnect-modal__mobile__toggle_selector"}),r?React.createElement(React.Fragment,null,React.createElement("a",{onClick:function(){return h(!1),S()}},e.text.mobile),React.createElement("a",{onClick:function(){return h(!0)}},e.text.qrcode)):React.createElement(React.Fragment,null,React.createElement("a",{onClick:function(){return h(!0)}},e.text.qrcode),React.createElement("a",{onClick:function(){return h(!1),S()}},e.text.desktop))):null,React.createElement("div",null,d||!t&&!i&&!_.length?React.createElement(QRCodeDisplay,Object.assign({},f)):React.createElement(LinkDisplay,Object.assign({},f,{links:_,errorMessage:T})))))}var de$1={choose_preferred_wallet:"Wähle bevorzugte Wallet",connect_mobile_wallet:"Verbinde mit Mobile Wallet",scan_qrcode_with_wallet:"Scanne den QR-code mit einer WalletConnect kompatiblen Wallet",connect:"Verbinden",qrcode:"QR-Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"In die Zwischenablage kopieren",copied_to_clipboard:"In die Zwischenablage kopiert!",connect_with:"Verbinden mit Hilfe von",loading:"Laden...",something_went_wrong:"Etwas ist schief gelaufen",no_supported_wallets:"Es gibt noch keine unterstützten Wallet",no_wallets_found:"keine Wallet gefunden"},en={choose_preferred_wallet:"Choose your preferred wallet",connect_mobile_wallet:"Connect to Mobile Wallet",scan_qrcode_with_wallet:"Scan QR code with a WalletConnect-compatible wallet",connect:"Connect",qrcode:"QR Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"Copy to clipboard",copied_to_clipboard:"Copied to clipboard!",connect_with:"Connect with",loading:"Loading...",something_went_wrong:"Something went wrong",no_supported_wallets:"There are no supported wallets yet",no_wallets_found:"No wallets found"},es={choose_preferred_wallet:"Elige tu billetera preferida",connect_mobile_wallet:"Conectar a billetera móvil",scan_qrcode_with_wallet:"Escanea el código QR con una billetera compatible con WalletConnect",connect:"Conectar",qrcode:"Código QR",mobile:"Móvil",desktop:"Desktop",copy_to_clipboard:"Copiar",copied_to_clipboard:"Copiado!",connect_with:"Conectar mediante",loading:"Cargando...",something_went_wrong:"Algo salió mal",no_supported_wallets:"Todavía no hay billeteras compatibles",no_wallets_found:"No se encontraron billeteras"},fr={choose_preferred_wallet:"Choisissez votre portefeuille préféré",connect_mobile_wallet:"Se connecter au portefeuille mobile",scan_qrcode_with_wallet:"Scannez le QR code avec un portefeuille compatible WalletConnect",connect:"Se connecter",qrcode:"QR Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"Copier",copied_to_clipboard:"Copié!",connect_with:"Connectez-vous à l'aide de",loading:"Chargement...",something_went_wrong:"Quelque chose a mal tourné",no_supported_wallets:"Il n'y a pas encore de portefeuilles pris en charge",no_wallets_found:"Aucun portefeuille trouvé"},ko$1={choose_preferred_wallet:"원하는 지갑을 선택하세요",connect_mobile_wallet:"모바일 지갑과 연결",scan_qrcode_with_wallet:"WalletConnect 지원 지갑에서 QR코드를 스캔하세요",connect:"연결",qrcode:"QR 코드",mobile:"모바일",desktop:"데스크탑",copy_to_clipboard:"클립보드에 복사",copied_to_clipboard:"클립보드에 복사되었습니다!",connect_with:"와 연결하다",loading:"로드 중...",something_went_wrong:"문제가 발생했습니다.",no_supported_wallets:"아직 지원되는 지갑이 없습니다",no_wallets_found:"지갑을 찾을 수 없습니다"},pt$1={choose_preferred_wallet:"Escolha sua carteira preferida",connect_mobile_wallet:"Conectar-se à carteira móvel",scan_qrcode_with_wallet:"Ler o código QR com uma carteira compatível com WalletConnect",connect:"Conectar",qrcode:"Código QR",mobile:"Móvel",desktop:"Desktop",copy_to_clipboard:"Copiar",copied_to_clipboard:"Copiado!",connect_with:"Ligar por meio de",loading:"Carregamento...",something_went_wrong:"Algo correu mal",no_supported_wallets:"Ainda não há carteiras suportadas",no_wallets_found:"Nenhuma carteira encontrada"},zh={choose_preferred_wallet:"选择你的钱包",connect_mobile_wallet:"连接至移动端钱包",scan_qrcode_with_wallet:"使用兼容 WalletConnect 的钱包扫描二维码",connect:"连接",qrcode:"二维码",mobile:"移动",desktop:"桌面",copy_to_clipboard:"复制到剪贴板",copied_to_clipboard:"复制到剪贴板成功!",connect_with:"通过以下方式连接",loading:"正在加载...",something_went_wrong:"出了问题",no_supported_wallets:"目前还没有支持的钱包",no_wallets_found:"没有找到钱包"},fa={choose_preferred_wallet:"کیف پول مورد نظر خود را انتخاب کنید",connect_mobile_wallet:"به کیف پول موبایل وصل شوید",scan_qrcode_with_wallet:"کد QR را با یک کیف پول سازگار با WalletConnect اسکن کنید",connect:"اتصال",qrcode:"کد QR",mobile:"سیار",desktop:"دسکتاپ",copy_to_clipboard:"کپی به کلیپ بورد",copied_to_clipboard:"در کلیپ بورد کپی شد!",connect_with:"ارتباط با",loading:"...بارگذاری",something_went_wrong:"مشکلی پیش آمد",no_supported_wallets:"هنوز هیچ کیف پول پشتیبانی شده ای وجود ندارد",no_wallets_found:"هیچ کیف پولی پیدا نشد"},languages={de:de$1,en:en,es:es,fr:fr,ko:ko$1,pt:pt$1,zh:zh,fa:fa};function injectStyleSheet(){var e=browserUtils.getDocumentOrThrow(),t=e.getElementById(WALLETCONNECT_STYLE_ID);t&&e.head.removeChild(t);var r=e.createElement("style");r.setAttribute("id",WALLETCONNECT_STYLE_ID),r.innerText=WALLETCONNECT_STYLE_SHEET,e.head.appendChild(r)}function renderWrapper(){var e=browserUtils.getDocumentOrThrow(),t=e.createElement("div");return t.setAttribute("id",WALLETCONNECT_WRAPPER_ID),e.body.appendChild(t),t}function triggerCloseAnimation(){var e=browserUtils.getDocumentOrThrow(),t=e.getElementById(WALLETCONNECT_MODAL_ID);t&&(t.className=t.className.replace("fadeIn","fadeOut"),setTimeout((function(){var t=e.getElementById(WALLETCONNECT_WRAPPER_ID);t&&e.body.removeChild(t)}),ANIMATION_DURATION))}function getWrappedCallback(e){return function(){triggerCloseAnimation(),e&&e()}}function getText(){var e=browserUtils.getNavigatorOrThrow().language.split("-")[0]||"en";return languages[e]||languages.en}function open$1(e,t,r){injectStyleSheet();var n=renderWrapper();React.render(React.createElement(Modal,{text:getText(),uri:e,onClose:getWrappedCallback(t),qrcodeModalOptions:r}),n)}function close$1(){triggerCloseAnimation()}var isNode=function(){return void 0!==process$1&&void 0!==process$1.versions&&void 0!==process$1.versions.node};function open$2(e,t,r){console.log(e),isNode()?open(e):open$1(e,t,r)}function close$2(){isNode()||close$1()}var index$1={open:open$2,close:close$2},cjs=index$1;const QRCodeModal=getDefaultExportFromCjs$1(cjs),t$4=Symbol(),s$4=Object.getPrototypeOf,c$4=new WeakMap,l$4=e=>e&&(c$4.has(e)?c$4.get(e):s$4(e)===Object.prototype||s$4(e)===Array.prototype),y$2=e=>l$4(e)&&e[t$4]||null,h$3=(e,t=!0)=>{c$4.set(e,t)},__vite_import_meta_env__={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},isObject=e=>"object"==typeof e&&null!==e,proxyStateMap=new WeakMap,refSet=new WeakSet,buildProxyFunction=(e=Object.is,t=(e,t)=>new Proxy(e,t),r=e=>isObject(e)&&!refSet.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer),n=e=>{switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e}},o=new WeakMap,i=(e,t,r=n)=>{const s=o.get(e);if((null==s?void 0:s[0])===t)return s[1];const a=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));return h$3(a,!0),o.set(e,[t,a]),Reflect.ownKeys(e).forEach((t=>{if(Object.getOwnPropertyDescriptor(a,t))return;const n=Reflect.get(e,t),o={value:n,enumerable:!0,configurable:!0};if(refSet.has(n))h$3(n,!1);else if(n instanceof Promise)delete o.value,o.get=()=>r(n);else if(proxyStateMap.has(n)){const[e,t]=proxyStateMap.get(n);o.value=i(e,t(),r)}Object.defineProperty(a,t,o)})),Object.preventExtensions(a)},s=new WeakMap,a=[1,1],c=n=>{if(!isObject(n))throw new Error("object required");const o=s.get(n);if(o)return o;let u=a[0];const l=new Set,d=(e,t=++a[0])=>{u!==t&&(u=t,l.forEach((r=>r(e,t))))};let h=a[1];const f=e=>(t,r)=>{const n=[...t];n[1]=[e,...n[1]],d(n,r)},p=new Map,m=e=>{var t;const r=p.get(e);r&&(p.delete(e),null==(t=r[1])||t.call(r))},y=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),g={deleteProperty(e,t){const r=Reflect.get(e,t);m(t);const n=Reflect.deleteProperty(e,t);return n&&d(["delete",[t],r]),n},set(t,n,o,i){const a=Reflect.has(t,n),u=Reflect.get(t,n,i);if(a&&(e(u,o)||s.has(o)&&e(u,s.get(o))))return!0;m(n),isObject(o)&&(o=y$2(o)||o);let h=o;if(o instanceof Promise)o.then((e=>{o.status="fulfilled",o.value=e,d(["resolve",[n],e])})).catch((e=>{o.status="rejected",o.reason=e,d(["reject",[n],e])}));else{!proxyStateMap.has(o)&&r(o)&&(h=c(o));const e=!refSet.has(h)&&proxyStateMap.get(h);e&&((e,t)=>{if("production"!==(__vite_import_meta_env__?"production":void 0)&&p.has(e))throw new Error("prop listener already exists");if(l.size){const r=t[3](f(e));p.set(e,[t,r])}else p.set(e,[t])})(n,e)}return Reflect.set(t,n,h,i),d(["set",[n],o,u]),!0}},b=t(y,g);s.set(n,b);const w=[y,(e=++a[1])=>(h===e||l.size||(h=e,p.forEach((([t])=>{const r=t[1](e);r>u&&(u=r)}))),u),i,e=>{l.add(e),1===l.size&&p.forEach((([e,t],r)=>{if("production"!==(__vite_import_meta_env__?"production":void 0)&&t)throw new Error("remove already exists");const n=e[3](f(r));p.set(r,[e,n])}));return()=>{l.delete(e),0===l.size&&p.forEach((([e,t],r)=>{t&&(t(),p.set(r,[e]))}))}}];return proxyStateMap.set(b,w),Reflect.ownKeys(n).forEach((e=>{const t=Object.getOwnPropertyDescriptor(n,e);"value"in t&&(b[e]=n[e],delete t.value,delete t.writable),Object.defineProperty(y,e,t)})),b})=>[c,proxyStateMap,refSet,e,t,r,n,o,i,s,a],[defaultProxyFunction]=buildProxyFunction();function proxy(e={}){return defaultProxyFunction(e)}function subscribe(e,t,r){const n=proxyStateMap.get(e);let o;"production"===(__vite_import_meta_env__?"production":void 0)||n||console.warn("Please use proxy object");const i=[],s=n[3];let a=!1;const c=s((e=>{i.push(e),o||(o=Promise.resolve().then((()=>{o=void 0,a&&t(i.splice(0))})))}));return a=!0,()=>{a=!1,c()}}function snapshot(e,t){const r=proxyStateMap.get(e);"production"===(__vite_import_meta_env__?"production":void 0)||r||console.warn("Please use proxy object");const[n,o,i]=r;return i(n,o(),t)}const o$5=proxy({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),T$2={state:o$5,subscribe:e=>subscribe(o$5,(()=>e(o$5))),push(e,t){e!==o$5.view&&(o$5.view=e,t&&(o$5.data=t),o$5.history.push(e))},reset(e){o$5.view=e,o$5.history=[e]},replace(e){o$5.history.length>1&&(o$5.history[o$5.history.length-1]=e,o$5.view=e)},goBack(){if(o$5.history.length>1){o$5.history.pop();const[e]=o$5.history.slice(-1);o$5.view=e}},setData(e){o$5.data=e}},a$2={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile:()=>typeof window<"u"&&Boolean(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)),isAndroid:()=>a$2.isMobile()&&navigator.userAgent.toLowerCase().includes("android"),isIos(){const e=navigator.userAgent.toLowerCase();return a$2.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl:e=>e.startsWith("http://")||e.startsWith("https://"),isArray:e=>Array.isArray(e)&&e.length>0,formatNativeUrl(e,t,r){if(a$2.isHttpUrl(e))return this.formatUniversalUrl(e,t,r);let n=e;n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,r);return`${n}wc?uri=${encodeURIComponent(t)}`},formatUniversalUrl(e,t,r){if(!a$2.isHttpUrl(e))return this.formatNativeUrl(e,t,r);let n=e;n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,r);return`${n}wc?uri=${encodeURIComponent(t)}`},wait:async e=>new Promise((t=>{setTimeout(t,e)})),openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(a$2.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(a$2.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(a$2.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(a$2.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=null==(e=T$2.state.data)?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},_$2=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),r$3=proxy({enabled:_$2,userSessionId:"",events:[],connectedWalletId:void 0}),R$1={state:r$3,subscribe:e=>subscribe(r$3.events,(()=>e(snapshot(r$3.events[r$3.events.length-1])))),initialize(){r$3.enabled&&typeof(null==crypto?void 0:crypto.randomUUID)<"u"&&(r$3.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){r$3.connectedWalletId=e},click(e){if(r$3.enabled){const t={type:"CLICK",name:e.name,userSessionId:r$3.userSessionId,timestamp:Date.now(),data:e};r$3.events.push(t)}},track(e){if(r$3.enabled){const t={type:"TRACK",name:e.name,userSessionId:r$3.userSessionId,timestamp:Date.now(),data:e};r$3.events.push(t)}},view(e){if(r$3.enabled){const t={type:"VIEW",name:e.name,userSessionId:r$3.userSessionId,timestamp:Date.now(),data:e};r$3.events.push(t)}}},c$3=proxy({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),p$1={state:c$3,subscribe:e=>subscribe(c$3,(()=>e(c$3))),setChains(e){c$3.chains=e},setWalletConnectUri(e){c$3.walletConnectUri=e},setIsCustomDesktop(e){c$3.isCustomDesktop=e},setIsCustomMobile(e){c$3.isCustomMobile=e},setIsDataLoaded(e){c$3.isDataLoaded=e},setIsUiLoaded(e){c$3.isUiLoaded=e},setIsAuth(e){c$3.isAuth=e}},W=proxy({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}),y$1={state:W,subscribe:e=>subscribe(W,(()=>e(W))),setConfig(e){var t,r;R$1.initialize(),p$1.setChains(e.chains),p$1.setIsAuth(Boolean(e.enableAuthMode)),p$1.setIsCustomMobile(Boolean(null==(t=e.mobileWallets)?void 0:t.length)),p$1.setIsCustomDesktop(Boolean(null==(r=e.desktopWallets)?void 0:r.length)),a$2.setModalVersionInStorage(),Object.assign(W,e)}};var V$1=Object.defineProperty,D$2=Object.getOwnPropertySymbols,H$1=Object.prototype.hasOwnProperty,B$2=Object.prototype.propertyIsEnumerable,M$1=(e,t,r)=>t in e?V$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,K$1=(e,t)=>{for(var r in t||(t={}))H$1.call(t,r)&&M$1(e,r,t[r]);if(D$2)for(var r of D$2(t))B$2.call(t,r)&&M$1(e,r,t[r]);return e};const L$2="https://explorer-api.walletconnect.com",E$1="wcm",O="js-2.6.2";async function w$1(e,t){const r=K$1({sdkType:E$1,sdkVersion:O},t),n=new URL(e,L$2);return n.searchParams.append("projectId",y$1.state.projectId),Object.entries(r).forEach((([e,t])=>{t&&n.searchParams.append(e,String(t))})),(await fetch(n)).json()}const m$1={getDesktopListings:async e=>w$1("/w3m/v1/getDesktopListings",e),getMobileListings:async e=>w$1("/w3m/v1/getMobileListings",e),getInjectedListings:async e=>w$1("/w3m/v1/getInjectedListings",e),getAllListings:async e=>w$1("/w3m/v1/getAllListings",e),getWalletImageUrl:e=>`${L$2}/w3m/v1/getWalletImage/${e}?projectId=${y$1.state.projectId}&sdkType=${E$1}&sdkVersion=${O}`,getAssetImageUrl:e=>`${L$2}/w3m/v1/getAssetImage/${e}?projectId=${y$1.state.projectId}&sdkType=${E$1}&sdkVersion=${O}`};var z$1=Object.defineProperty,j$1=Object.getOwnPropertySymbols,J=Object.prototype.hasOwnProperty,q$1=Object.prototype.propertyIsEnumerable,k$1=(e,t,r)=>t in e?z$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,F$1=(e,t)=>{for(var r in t||(t={}))J.call(t,r)&&k$1(e,r,t[r]);if(j$1)for(var r of j$1(t))q$1.call(t,r)&&k$1(e,r,t[r]);return e};const N$1=a$2.isMobile(),d$3=proxy({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),te$1={state:d$3,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=y$1.state;if("NONE"===e||"ALL"===t&&!e)return d$3.recomendedWallets;if(a$2.isArray(e)){const t={recommendedIds:e.join(",")},{listings:r}=await m$1.getAllListings(t),n=Object.values(r);n.sort(((t,r)=>e.indexOf(t.id)-e.indexOf(r.id))),d$3.recomendedWallets=n}else{const{chains:e,isAuth:r}=p$1.state,n=null==e?void 0:e.join(","),o=a$2.isArray(t),i={page:1,sdks:r?"auth_v1":void 0,entries:a$2.RECOMMENDED_WALLET_AMOUNT,chains:n,version:2,excludedIds:o?t.join(","):void 0},{listings:s}=N$1?await m$1.getMobileListings(i):await m$1.getDesktopListings(i);d$3.recomendedWallets=Object.values(s)}return d$3.recomendedWallets},async getWallets(e){const t=F$1({},e),{explorerRecommendedWalletIds:r,explorerExcludedWalletIds:n}=y$1.state,{recomendedWallets:o}=d$3;if("ALL"===n)return d$3.wallets;o.length?t.excludedIds=o.map((e=>e.id)).join(","):a$2.isArray(r)&&(t.excludedIds=r.join(",")),a$2.isArray(n)&&(t.excludedIds=[t.excludedIds,n].filter(Boolean).join(",")),p$1.state.isAuth&&(t.sdks="auth_v1");const{page:i,search:s}=e,{listings:a,total:c}=N$1?await m$1.getMobileListings(t):await m$1.getDesktopListings(t),u=Object.values(a),l=s?"search":"wallets";return d$3[l]={listings:[...d$3[l].listings,...u],total:c,page:i??1},{listings:u,total:c}},getWalletImageUrl:e=>m$1.getWalletImageUrl(e),getAssetImageUrl:e=>m$1.getAssetImageUrl(e),resetSearch(){d$3.search={listings:[],total:0,page:1}}},I$1=proxy({open:!1}),se$1={state:I$1,subscribe:e=>subscribe(I$1,(()=>e(I$1))),open:async e=>new Promise((t=>{const{isUiLoaded:r,isDataLoaded:n}=p$1.state;if(a$2.removeWalletConnectDeepLink(),p$1.setWalletConnectUri(null==e?void 0:e.uri),p$1.setChains(null==e?void 0:e.chains),T$2.reset("ConnectWallet"),r&&n)I$1.open=!0,t();else{const e=setInterval((()=>{const r=p$1.state;r.isUiLoaded&&r.isDataLoaded&&(clearInterval(e),I$1.open=!0,t())}),200)}})),close(){I$1.open=!1}};var G$1=Object.defineProperty,$$1=Object.getOwnPropertySymbols,Q$1=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,S$3=(e,t,r)=>t in e?G$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Y$1=(e,t)=>{for(var r in t||(t={}))Q$1.call(t,r)&&S$3(e,r,t[r]);if($$1)for(var r of $$1(t))X.call(t,r)&&S$3(e,r,t[r]);return e};function Z$2(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const C$1=proxy({themeMode:Z$2()?"dark":"light"}),ne$1={state:C$1,subscribe:e=>subscribe(C$1,(()=>e(C$1))),setThemeConfig(e){const{themeMode:t,themeVariables:r}=e;t&&(C$1.themeMode=t),r&&(C$1.themeVariables=Y$1({},r))}},g$1=proxy({open:!1,message:"",variant:"success"}),oe$1={state:g$1,subscribe:e=>subscribe(g$1,(()=>e(g$1))),openToast(e,t){g$1.open=!0,g$1.message=e,g$1.variant=t},closeToast(){g$1.open=!1}};let d$2=class{constructor(e){this.openModal=se$1.open,this.closeModal=se$1.close,this.subscribeModal=se$1.subscribe,this.setTheme=ne$1.setThemeConfig,ne$1.setThemeConfig(e),y$1.setConfig(e),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then((()=>index));const e=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",e),p$1.setIsUiLoaded(!0)}}};const clients={};class DAppSigner{constructor(e,t,r,n=LedgerId.MAINNET,o){this.accountId=e,this.signClient=t,this.topic=r,this.ledgerId=n,this.extensionId=o}_getHederaClient(){const e=this.ledgerId.toString();return clients[e]||(clients[e]=WebClient.forName(e)),clients[e]}get _signerAccountId(){return`${ledgerIdToCAIPChainId(this.ledgerId)}:${this.accountId.toString()}`}_getRandomNodes(e){const t=Object.values(this._getHederaClient().network).map((e=>"string"==typeof e?AccountId.fromString(e):e));for(let r=t.length-1;r>0;r--){const e=Math.floor(Math.random()*(r+1));[t[r],t[e]]=[t[e],t[r]]}return t.slice(0,e)}request(e){return this.extensionId&&extensionOpen(this.extensionId),this.signClient.request({topic:this.topic,request:e,chainId:ledgerIdToCAIPChainId(this.ledgerId)})}getAccountId(){return this.accountId}getAccountKey(){throw new Error("Method not implemented.")}getLedgerId(){return this.ledgerId}getNetwork(){return this._getHederaClient().network}getMirrorNetwork(){return this._getHederaClient().mirrorNetwork}getAccountBalance(){return this.call((new AccountBalanceQuery).setAccountId(this.accountId))}getAccountInfo(){return this.call((new AccountInfoQuery).setAccountId(this.accountId))}getAccountRecords(){return this.call((new AccountRecordsQuery).setAccountId(this.accountId))}async sign(e,t){const{signatureMap:r}=await this.request({method:HederaJsonRpcMethod.SignMessage,params:{signerAccountId:this._signerAccountId,message:Uint8ArrayToBase64String(e[0])}}),n=base64StringToSignatureMap(r);return[new SignerSignature({accountId:this.getAccountId(),publicKey:PublicKey.fromBytes(n.sigPair[0].pubKeyPrefix),signature:n.sigPair[0].ed25519||n.sigPair[0].ECDSASecp256k1})]}async checkTransaction(e){throw new Error("Method not implemented.")}async populateTransaction(e){return e.setNodeAccountIds(this._getRandomNodes(10)).setTransactionId(TransactionId.generate(this.getAccountId()))}async signTransaction(e){let t;t=e.nodeAccountIds&&0!==e.nodeAccountIds.length?e.nodeAccountIds[0]:this._getRandomNodes(1)[0];const r=transactionBodyToBase64String(transactionToTransactionBody(e,t)),{signatureMap:n}=await this.request({method:HederaJsonRpcMethod.SignTransaction,params:{signerAccountId:this._signerAccountId,transactionBody:r}}),o=base64StringToSignatureMap(n),i=base64StringToUint8Array(r),s=lib.proto.Transaction.encode({bodyBytes:i,sigMap:o}).finish();return Transaction.fromBytes(s)}async _tryExecuteTransactionRequest(e){try{const t=Transaction.fromBytes(e.toBytes()),r=await this.request({method:HederaJsonRpcMethod.SignAndExecuteTransaction,params:{signerAccountId:this._signerAccountId,transactionList:transactionToBase64String(t)}});return{result:TransactionResponse.fromJSON(r)}}catch(t){return{error:t}}}async _parseQueryResponse(e,t){if(e instanceof AccountRecordsQuery){return t.split(",").map((e=>base64StringToUint8Array(e))).map((e=>TransactionRecord.fromBytes(e)))}const r=base64StringToUint8Array(t);if(e instanceof AccountBalanceQuery)return AccountBalance.fromBytes(r);if(e instanceof AccountInfoQuery)return AccountInfo.fromBytes(r);if(e instanceof TransactionReceiptQuery)return TransactionReceipt.fromBytes(r);throw new Error("Unsupported query type")}async _tryExecuteQueryRequest(e){try{const t=Query.fromBytes(e.toBytes()),r=await this.request({method:HederaJsonRpcMethod.SignAndExecuteQuery,params:{signerAccountId:this._signerAccountId,query:queryToBase64String(t)}});return{result:this._parseQueryResponse(t,r.response)}}catch(t){return{error:t}}}async call(e){var t,r,n,o,i,s;const a=await this._tryExecuteTransactionRequest(e);if(a.result)return a.result;const c=await this._tryExecuteQueryRequest(e);if(c.result)return c.result;throw new Error("Error executing transaction or query: \n"+JSON.stringify({txError:{name:null===(t=a.error)||void 0===t?void 0:t.name,message:null===(r=a.error)||void 0===r?void 0:r.message,stack:null===(n=a.error)||void 0===n?void 0:n.stack},queryError:{name:null===(o=c.error)||void 0===o?void 0:o.name,message:null===(i=c.error)||void 0===i?void 0:i.message,stack:null===(s=c.error)||void 0===s?void 0:s.stack}},null,2))}}class DAppConnector{constructor(e,t,r,n,o,i){this.network=LedgerId.TESTNET,this.supportedMethods=[],this.supportedEvents=[],this.supportedChains=[],this.extensions=[],this.onSessionIframeCreated=null,this.signers=[],this.isInitializing=!1,this.abortableConnect=async e=>new Promise((async(t,r)=>{const n=48e4,o=setTimeout((()=>{QRCodeModal.close(),r(new Error("Connect timed out after 480000(ms)"))}),n);try{return t(await e())}catch(i){r(i)}finally{clearTimeout(o)}})),this.dAppMetadata=e,this.network=t,this.projectId=r,this.supportedMethods=null!=n?n:Object.values(HederaJsonRpcMethod),this.supportedEvents=null!=o?o:[],this.supportedChains=null!=i?i:[],this.extensions=[],this.walletConnectModal=new d$2({projectId:r,chains:i}),findExtensions(((e,t)=>{this.extensions.push(Object.assign(Object.assign({},e),{available:!0,availableInIframe:t}))}))}async init({logger:e}={}){try{if(this.isInitializing=!0,!this.projectId)throw new Error("Project ID is not defined");this.walletConnectClient=await oe$2.init({logger:e,relayUrl:"wss://relay.walletconnect.com",projectId:this.projectId,metadata:this.dAppMetadata});const t=this.walletConnectClient.session.getAll();t.length>0?this.signers=t.flatMap((e=>this.createSigners(e))):this.checkIframeConnect(),this.walletConnectClient.on("session_event",(e=>{console.log(e)})),this.walletConnectClient.on("session_update",(({topic:e,params:t})=>{const{namespaces:r}=t,n=this.walletConnectClient.session.get(e),o=Object.assign(Object.assign({},n),{namespaces:r});console.log(o)})),this.walletConnectClient.on("session_delete",(e=>{console.log(e),this.signers=this.signers.filter((t=>t.topic!==e.topic)),this.disconnect(e.topic),console.log("Dapp: Session deleted by wallet!")})),this.walletConnectClient.core.pairing.events.on("pairing_delete",(e=>{console.log(e),this.signers=this.signers.filter((t=>t.topic!==e.topic)),this.disconnect(e.topic),console.log("Dapp: Pairing deleted by wallet!")}))}finally{this.isInitializing=!1}}getSigner(e){const t=this.signers.find((t=>t.getAccountId().equals(e)));if(!t)throw new Error("Signer is not found for this accountId");return t}async connectQR(e){return this.abortableConnect((async()=>{try{const{uri:t,approval:r}=await this.connectURI(e);if(!t)throw new Error("URI is not defined");QRCodeModal.open(t,(()=>{throw new Error("User rejected pairing")})),await this.onSessionConnected(await r())}finally{QRCodeModal.close()}}))}async openModal(e){try{const{uri:t,approval:r}=await this.connectURI(e);this.walletConnectModal.openModal({uri:t});const n=await r();return await this.onSessionConnected(n),n}finally{this.walletConnectModal.closeModal()}}async connect(e,t,r){return this.abortableConnect((async()=>{var n;const{uri:o,approval:i}=await this.connectURI(t);if(!o)throw new Error("URI is not defined");e(o);const s=await i();if(r){const e=Object.assign(Object.assign({},s.sessionProperties),{extensionId:r});s.sessionProperties=e,await(null===(n=this.walletConnectClient)||void 0===n?void 0:n.session.update(s.topic,{sessionProperties:e}))}return await this.onSessionConnected(s),s}))}async connectExtension(e,t){const r=this.extensions.find((t=>t.id===e));if(!r||!r.available)throw new Error("Extension is not available");return this.connect((e=>{extensionConnect(r.id,r.availableInIframe,e)}),t,r.availableInIframe?void 0:e)}async checkIframeConnect(){const e=this.extensions.find((e=>e.availableInIframe));if(e){const t=await this.connectExtension(e.id);this.onSessionIframeCreated&&this.onSessionIframeCreated(t)}}async disconnect(e){await this.walletConnectClient.disconnect({topic:e,reason:tr$1("USER_DISCONNECTED")})}async disconnectAll(){if(!this.walletConnectClient)throw new Error("WalletConnect is not initialized");const e=this.walletConnectClient.session.getAll(),t=this.walletConnectClient.core.pairing.getPairings();if(!(null==e?void 0:e.length)&&!(null==t?void 0:t.length))throw new Error("There is no active session/pairing. Connect to the wallet at first.");const r=[];for(const n of this.walletConnectClient.session.getAll()){console.log(`Disconnecting from session: ${n}`);const e=this.disconnect(n.topic);r.push(e)}for(const n of t){const e=this.disconnect(n.topic);r.push(e)}await Promise.all(r),this.signers=[]}createSigners(e){return accountAndLedgerFromSession(e).map((({account:t,network:r})=>{var n;return new DAppSigner(t,this.walletConnectClient,e.topic,r,null===(n=e.sessionProperties)||void 0===n?void 0:n.extensionId)}))}async onSessionConnected(e){this.signers.push(...this.createSigners(e))}async connectURI(e){if(!this.walletConnectClient)throw new Error("WalletConnect is not initialized");return this.walletConnectClient.connect({pairingTopic:e,requiredNamespaces:networkNamespaces(this.network,this.supportedMethods,this.supportedEvents)})}async request({method:e,params:t}){const r=this.signers[this.signers.length-1];if(!r)throw new Error("There is no active session. Connect to the wallet at first.");return await r.request({method:e,params:t})}async getNodeAddresses(){return await this.request({method:HederaJsonRpcMethod.GetNodeAddresses,params:void 0})}async executeTransaction(e){return await this.request({method:HederaJsonRpcMethod.ExecuteTransaction,params:e})}async signMessage(e){return await this.request({method:HederaJsonRpcMethod.SignMessage,params:e})}async signAndExecuteQuery(e){return await this.request({method:HederaJsonRpcMethod.SignAndExecuteQuery,params:e})}async signAndExecuteTransaction(e){return await this.request({method:HederaJsonRpcMethod.SignAndExecuteTransaction,params:e})}async signTransaction(e){return await this.request({method:HederaJsonRpcMethod.SignTransaction,params:e})}}class DefaultLogger{constructor(){this.logLevel="info"}setLogLevel(e){this.logLevel=e}error(e,...t){["error","warn","info","debug"].includes(this.logLevel)&&console.error(`[ERROR] ${e}`,...t)}warn(e,...t){["warn","info","debug"].includes(this.logLevel)&&console.warn(`[WARN] ${e}`,...t)}info(e,...t){["info","debug"].includes(this.logLevel)&&console.info(`[INFO] ${e}`,...t)}debug(e,...t){"debug"===this.logLevel&&console.debug(`[DEBUG] ${e}`,...t)}}var fetchRetry_umd={exports:{}};!function(e,t){e.exports=function(){function e(e){return Number.isInteger(e)&&e>=0}function t(e){this.name="ArgumentError",this.message=e}return function(r,n){if(n=n||{},"function"!=typeof r)throw new t("fetch must be a function");if("object"!=typeof n)throw new t("defaults must be an object");if(void 0!==n.retries&&!e(n.retries))throw new t("retries must be a positive integer");if(void 0!==n.retryDelay&&!e(n.retryDelay)&&"function"!=typeof n.retryDelay)throw new t("retryDelay must be a positive integer or a function returning a positive integer");if(void 0!==n.retryOn&&!Array.isArray(n.retryOn)&&"function"!=typeof n.retryOn)throw new t("retryOn property expects an array or function");var o={retries:3,retryDelay:1e3,retryOn:[]};return n=Object.assign(o,n),function(o,i){var s=n.retries,a=n.retryDelay,c=n.retryOn;if(i&&void 0!==i.retries){if(!e(i.retries))throw new t("retries must be a positive integer");s=i.retries}if(i&&void 0!==i.retryDelay){if(!e(i.retryDelay)&&"function"!=typeof i.retryDelay)throw new t("retryDelay must be a positive integer or a function returning a positive integer");a=i.retryDelay}if(i&&i.retryOn){if(!Array.isArray(i.retryOn)&&"function"!=typeof i.retryOn)throw new t("retryOn property expects an array or function");c=i.retryOn}return new Promise((function(e,t){var n=function(n){var a="undefined"!=typeof Request&&o instanceof Request?o.clone():o;r(a,i).then((function(r){if(Array.isArray(c)&&-1===c.indexOf(r.status))e(r);else if("function"==typeof c)try{return Promise.resolve(c(n,null,r)).then((function(t){t?u(n,null,r):e(r)})).catch(t)}catch(o){t(o)}else n<s?u(n,null,r):e(r)})).catch((function(e){if("function"==typeof c)try{Promise.resolve(c(n,e,null)).then((function(r){r?u(n,e,null):t(e)})).catch((function(e){t(e)}))}catch(r){t(r)}else n<s?u(n,e,null):t(e)}))};function u(e,t,r){var o="function"==typeof a?a(e,t,r):a;setTimeout((function(){n(++e)}),o)}n(0)}))}}}()}(fetchRetry_umd);var fetchRetry_umdExports=fetchRetry_umd.exports;const retryFetch=getDefaultExportFromCjs$1(fetchRetry_umdExports),fetchWithRetry=()=>retryFetch(fetch,{retries:3});class HashinalsWalletConnectSDK{constructor(e,t){this.logger=e||new DefaultLogger,this.network=t||LedgerId.MAINNET}static getInstance(e,t){let r=null==HashinalsWalletConnectSDK?void 0:HashinalsWalletConnectSDK.instance;return r||(HashinalsWalletConnectSDK.instance=new HashinalsWalletConnectSDK(e,t),r=HashinalsWalletConnectSDK.instance),t&&r.setNetwork(t),r}setLogger(e){this.logger=e}setNetwork(e){this.network=e}getNetwork(){return this.network}setLogLevel(e){this.logger instanceof DefaultLogger?this.logger.setLogLevel(e):this.logger.warn("setLogLevel is only available for the default logger")}async init(e,t,r){const n=r||this.network,o="mainnet"===n.toString();return this.dAppConnector=new DAppConnector(t,n,e,Object.values(HederaJsonRpcMethod),[HederaSessionEvent.ChainChanged,HederaSessionEvent.AccountsChanged],[o?HederaChainId.Mainnet:HederaChainId.Testnet]),await this.dAppConnector.init({logger:"error"}),this.dAppConnector.onSessionIframeCreated=e=>{this.handleNewSession(e)},this.logger.info(`Hedera Wallet Connect SDK initialized on ${n}`),this.dAppConnector}async connect(){this.ensureInitialized();const e=await this.dAppConnector.openModal();return this.handleNewSession(e),e}async disconnect(){try{return this.ensureInitialized(),await this.dAppConnector.disconnectAll(),this.logger.info("Disconnected from all wallets"),!0}catch(e2){return this.logger.error("Failed to disconnect",e2),!1}}async executeTransaction(e,t=!1){this.ensureInitialized();const r=this.getAccountInfo(),n=null==r?void 0:r.accountId,o=this.dAppConnector.signers.find((e=>e.getAccountId().toString()===n));if(t){const t=await e.executeWithSigner(o);return await t.getReceiptWithSigner(o)}{const t=await e.freezeWithSigner(o),r=await t.executeWithSigner(o);return await r.getReceiptWithSigner(o)}}async executeTransactionWithErrorHandling(e,t){var r;try{return{result:await this.executeTransaction(e,t),error:void 0}}catch(e2){const t=null==(r=e2.message)?void 0:r.toLowerCase();if(this.logger.error("Failed to execute transaction",e2),this.logger.error("Failure reason for transaction is",t),t.includes("insufficient payer balance"))return{result:void 0,error:"Insufficient balance to complete the transaction."};if(t.includes("reject"))return{result:void 0,error:"You rejected the transaction"};if(t.includes("invalid signature"))return{result:void 0,error:"Invalid signature. Please check your account and try again."};if(t.includes("transaction expired"))return{result:void 0,error:"Transaction expired. Please try again."};if(t.includes("account not found"))return{result:void 0,error:"Account not found. Please check the account ID and try again."};if(t.includes("unauthorized"))return{result:void 0,error:"Unauthorized. You may not have the necessary permissions for this action."};if(t.includes("busy"))return{result:void 0,error:"The network is busy. Please try again later."};if(t.includes("invalid transaction"))return{result:void 0,error:"Invalid transaction. Please check your inputs and try again."}}}async submitMessageToTopic(e,t,r){this.ensureInitialized();let n=(new TopicMessageSubmitTransaction).setTopicId(TopicId.fromString(e)).setMessage(t);return r&&(n=await n.sign(r)),this.executeTransaction(n)}async transferHbar(e,t,r){this.ensureInitialized();const n=(new TransferTransaction).setTransactionId(TransactionId.generate(e)).addHbarTransfer(AccountId.fromString(e),new Hbar(-r)).addHbarTransfer(AccountId.fromString(t),new Hbar(r));return this.executeTransaction(n)}async executeSmartContract(e,t,r,n=1e5){this.ensureInitialized();const o=(new ContractExecuteTransaction).setContractId(ContractId.fromString(e)).setGas(n).setFunction(t,r);return this.executeTransaction(o)}handleNewSession(e){var t,r,n;const o=null==(n=null==(r=null==(t=e.namespaces)?void 0:t.hedera)?void 0:r.accounts)?void 0:n[0],i=null==o?void 0:o.split(":"),s=i.pop(),a=i.pop();this.logger.info("sessionAccount is",s,a),s?this.saveConnectionInfo(s,a):this.logger.error("No account id found in the session")}getNetworkPrefix(){const e=this.getAccountInfo(),t=null==e?void 0:e.network;if(!t){this.logger.warn("Network is not set on SDK, defaulting.");const e=localStorage.getItem("connectedNetwork");return e||"mainnet-public"}return t!==this.network&&(this.logger.warn("Detected network mismatch, reverting to signer network",t),this.network=t),t.isMainnet()?"mainnet-public":"testnet"}async requestAccount(e){try{const t=`https://${this.getNetworkPrefix()}.mirrornode.hedera.com/api/v1/accounts/${e}`,r=await fetchWithRetry()(t);if(!r.ok)throw new Error(`Failed to make request to mirror node for account: ${r.status}`);return await r.json()}catch(e2){throw this.logger.error("Failed to fetch account",e2),e2}}async getAccountBalance(){this.ensureInitialized();const e=this.getAccountInfo(),t=null==e?void 0:e.accountId;if(!t)return null;const r=await this.requestAccount(t);if(!r)throw new Error("Failed to fetch account. Try again or check if the Account ID is valid.");const n=r.balance.balance/10**8;return Number(n).toLocaleString("en-US")}getAccountInfo(){var e,t;const{accountId:r}=this.loadConnectionInfo();if(!r)return null;const n=null==(e=null==this?void 0:this.dAppConnector)?void 0:e.signers;if(!(null==n?void 0:n.length))return null;const o=this.dAppConnector.signers.find((e=>e.getAccountId().toString()===r));return{accountId:null==(t=null==o?void 0:o.getAccountId())?void 0:t.toString(),network:o.getLedgerId()}}async createTopic(e,t,r){this.ensureInitialized();let n=(new TopicCreateTransaction).setTopicMemo(e||"");if(t){const e=PrivateKey.fromString(t);n.setAdminKey(e.publicKey),n=await n.sign(e)}r&&n.setSubmitKey(PrivateKey.fromString(r).publicKey);return(await this.executeTransaction(n)).topicId.toString()}async createToken(e,t,r,n,o,i,s){this.ensureInitialized();let a=(new TokenCreateTransaction).setTokenName(e).setTokenSymbol(t).setDecimals(n).setInitialSupply(r).setTreasuryAccountId(AccountId.fromString(o)).setTokenType(TokenType.NonFungibleUnique).setSupplyType(TokenSupplyType.Finite);s&&(a=a.setSupplyKey(PrivateKey.fromString(s))),i&&(a=a.setAdminKey(PrivateKey.fromString(i)),a=await a.sign(PrivateKey.fromString(i)));return(await this.executeTransaction(a)).tokenId.toString()}async mintNFT(e,t,r){this.ensureInitialized();let n=await(new TokenMintTransaction).setTokenId(e).setMetadata([Buffer$1$1.from(t,"utf-8")]).sign(r);return this.executeTransaction(n)}async getMessages(e,t,r=!1){var n,o;const i=`${`https://${this.getNetworkPrefix()}.mirrornode.hedera.com`}/api/v1/topics/${e}/messages?limit=200${Number(t)>0&&!r?`×tamp=gt:${t}`:""}`;try{const t=await fetchWithRetry()(i);if(!t.ok)throw new Error(`Failed to make request to mirror node: ${t.status}`);const s=await t.json(),a=(null==s?void 0:s.messages)||[],c=null==(n=null==s?void 0:s.links)?void 0:n.next,u=a.map((e=>({...JSON.parse(atob(e.message)),payer:e.payer_account_id,created:new Date(1e3*Number(e.consensus_timestamp)),consensus_timestamp:e.consensus_timestamp,sequence_number:e.sequence_number})));if(c){const t=await this.getMessages(e,Number(null==(o=u[u.length-1])?void 0:o.consensus_timestamp),r);u.push(...t.messages)}return{messages:u.sort(((e,t)=>e.sequence_number-t.sequence_number)),error:""}}catch(s){return this.logger.error("Error fetching topic data:",s),{messages:[],error:s.toString()}}}saveConnectionInfo(e,t){e?(localStorage.setItem("connectedNetwork",t),localStorage.setItem("connectedAccountId",e)):(localStorage.removeItem("connectedAccountId"),localStorage.removeItem("connectedNetwork"))}loadConnectionInfo(){return{accountId:localStorage.getItem("connectedAccountId"),network:localStorage.getItem("connectedNetwork")}}async connectWallet(e,t,r){try{await this.init(e,t,r);const n=await this.connect(),o=this.getAccountInfo(),i=null==o?void 0:o.accountId,s=await this.getAccountBalance(),a=this.getNetworkPrefix();return this.saveConnectionInfo(i,a),{accountId:i,balance:s,session:n}}catch(n){throw this.logger.error("Failed to connect wallet:",n),n}}async disconnectWallet(e=!0){try{const t=await this.disconnect();return t&&e&&localStorage.clear(),this.saveConnectionInfo(void 0),t}catch(t){return this.logger.error("Failed to disconnect wallet:",t),!1}}async initAccount(e,t){const{accountId:r,network:n}=this.loadConnectionInfo();if(r&&n)try{const o="mainnet"===n?LedgerId.MAINNET:LedgerId.TESTNET;await this.init(e,t,o);return{accountId:r,balance:await this.getAccountBalance()}}catch(o){return this.logger.error("Failed to reconnect:",o),this.saveConnectionInfo(void 0,void 0),null}return null}ensureInitialized(){if(!this.dAppConnector)throw new Error("SDK not initialized. Call init() first.")}static run(){try{"undefined"!=typeof window&&(window.HashinalsWalletConnectSDK=HashinalsWalletConnectSDK.getInstance(),window.HashgraphSDK=HashgraphSDK)}catch(e2){console.error("[ERROR]: failed setting sdk on window")}}async transferToken(e,t,r,n){this.ensureInitialized();const o=(new TransferTransaction).setTransactionId(TransactionId.generate(t)).addTokenTransfer(TokenId.fromString(e),AccountId.fromString(t),-n).addTokenTransfer(TokenId.fromString(e),AccountId.fromString(r),n);return this.executeTransaction(o)}async createAccount(e){this.ensureInitialized();const t=(new AccountCreateTransaction).setInitialBalance(new Hbar(e));return this.executeTransaction(t)}async associateTokenToAccount(e,t){this.ensureInitialized();const r=(new TokenAssociateTransaction).setAccountId(AccountId.fromString(e)).setTokenIds([TokenId.fromString(t)]);return this.executeTransaction(r)}async dissociateTokenFromAccount(e,t){this.ensureInitialized();const r=(new TokenDissociateTransaction).setAccountId(AccountId.fromString(e)).setTokenIds([TokenId.fromString(t)]);return this.executeTransaction(r)}async updateAccount(e,t){this.ensureInitialized();const r=(new AccountUpdateTransaction).setAccountId(AccountId.fromString(e)).setMaxAutomaticTokenAssociations(t);return this.executeTransaction(r)}async approveAllowance(e,t,r,n){this.ensureInitialized();const o=(new AccountAllowanceApproveTransaction).approveTokenAllowance(TokenId.fromString(t),AccountId.fromString(n),AccountId.fromString(e),r);return this.executeTransaction(o)}async getAccountTokens(e){var t,r;this.ensureInitialized();const n=`https://${this.getNetworkPrefix()}.mirrornode.hedera.com`,o=`${n}/api/v1/accounts/${e}/tokens?limit=200`;try{const e=await fetchWithRetry()(o);if(!e.ok)throw new Error(`Failed to make request to mirror node for account tokens: ${e.status}`);const i=await e.json(),s=[];for(const t of i.tokens)t.token_id&&s.push({tokenId:t.token_id,balance:t.balance,decimals:t.decimals,formatted_balance:(t.balance/10**t.decimals).toLocaleString("en-US"),created_timestamp:new Date(1e3*Number(t.created_timestamp))});let a=null==(t=i.links)?void 0:t.next;for(;a;){const e=`${n}${a}`,t=await fetchWithRetry()(e);if(!t.ok)throw new Error(`Failed to make request to mirror node for account tokens: ${t.status}, page: ${e}`);const o=await t.json();for(const r of o.tokens)r.token_id&&s.push({tokenId:r.token_id,balance:r.balance,decimals:r.decimals,formatted_balance:(r.balance/10**r.decimals).toLocaleString("en-US"),created_timestamp:new Date(1e3*Number(r.created_timestamp))});a=null==(r=o.links)?void 0:r.next}return{tokens:s}}catch(i){throw this.logger.error("Error fetching account tokens:",i),i}}}HashinalsWalletConnectSDK.run();
|
|
110
|
+
*/!function(e){!function(){var t="input is invalid type",r="object"==typeof window,n=r?window:{};n.JS_SHA3_NO_WINDOW&&(r=!1);var o=!r&&"object"==typeof self;!n.JS_SHA3_NO_NODE_JS&&"object"==typeof process$1&&process$1.versions&&process$1.versions.node?n=On:o&&(n=self);var i=!n.JS_SHA3_NO_COMMON_JS&&e.exports,s=!n.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",a="0123456789abcdef".split(""),c=[4,1024,262144,67108864],u=[0,8,16,24],l=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],d=[224,256,384,512],h=[128,256],f=["hex","buffer","arrayBuffer","array","digest"],p={128:168,256:136};(n.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),s&&(n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var m=function(e,t,r){return function(n){return new R(e,t,e).update(n)[r]()}},y=function(e,t,r){return function(n,o){return new R(e,t,o).update(n)[r]()}},g=function(e,t,r){return function(t,n,o,i){return A["cshake"+e].update(t,n,o,i)[r]()}},b=function(e,t,r){return function(t,n,o,i){return A["kmac"+e].update(t,n,o,i)[r]()}},w=function(e,t,r,n){for(var o=0;o<f.length;++o){var i=f[o];e[i]=t(r,n,i)}return e},v=function(e,t){var r=m(e,t,"hex");return r.create=function(){return new R(e,t,e)},r.update=function(e){return r.create().update(e)},w(r,m,e,t)},_=[{name:"keccak",padding:[1,256,65536,16777216],bits:d,createMethod:v},{name:"sha3",padding:[6,1536,393216,100663296],bits:d,createMethod:v},{name:"shake",padding:[31,7936,2031616,520093696],bits:h,createMethod:function(e,t){var r=y(e,t,"hex");return r.create=function(r){return new R(e,t,r)},r.update=function(e,t){return r.create(t).update(e)},w(r,y,e,t)}},{name:"cshake",padding:c,bits:h,createMethod:function(e,t){var r=p[e],n=g(e,0,"hex");return n.create=function(n,o,i){return o||i?new R(e,t,n).bytepad([o,i],r):A["shake"+e].create(n)},n.update=function(e,t,r,o){return n.create(t,r,o).update(e)},w(n,g,e,t)}},{name:"kmac",padding:c,bits:h,createMethod:function(e,t){var r=p[e],n=b(e,0,"hex");return n.create=function(n,o,i){return new O(e,t,o).bytepad(["KMAC",i],r).bytepad([n],r)},n.update=function(e,t,r,o){return n.create(e,r,o).update(t)},w(n,b,e,t)}}],A={},I=[],T=0;T<_.length;++T)for(var k=_[T],S=k.bits,E=0;E<S.length;++E){var $=k.name+"_"+S[E];if(I.push($),A[$]=k.createMethod(S[E],k.padding),"sha3"!==k.name){var C=k.name+S[E];I.push(C),A[C]=A[$]}}function R(e,t,r){this.blocks=[],this.s=[],this.padding=t,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function O(e,t,r){R.call(this,e,t,r)}R.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var r,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(t);if(null===e)throw new Error(t);if(s&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||s&&ArrayBuffer.isView(e)))throw new Error(t);r=!0}for(var o,i,a=this.blocks,c=this.byteCount,l=e.length,d=this.blockCount,h=0,f=this.s;h<l;){if(this.reset)for(this.reset=!1,a[0]=this.block,o=1;o<d+1;++o)a[o]=0;if(r)for(o=this.start;h<l&&o<c;++h)a[o>>2]|=e[h]<<u[3&o++];else for(o=this.start;h<l&&o<c;++h)(i=e.charCodeAt(h))<128?a[o>>2]|=i<<u[3&o++]:i<2048?(a[o>>2]|=(192|i>>6)<<u[3&o++],a[o>>2]|=(128|63&i)<<u[3&o++]):i<55296||i>=57344?(a[o>>2]|=(224|i>>12)<<u[3&o++],a[o>>2]|=(128|i>>6&63)<<u[3&o++],a[o>>2]|=(128|63&i)<<u[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++h)),a[o>>2]|=(240|i>>18)<<u[3&o++],a[o>>2]|=(128|i>>12&63)<<u[3&o++],a[o>>2]|=(128|i>>6&63)<<u[3&o++],a[o>>2]|=(128|63&i)<<u[3&o++]);if(this.lastByteIndex=o,o>=c){for(this.start=o-c,this.block=a[d],o=0;o<d;++o)f[o]^=a[o];N(f),this.reset=!0}else this.start=o}return this},R.prototype.encode=function(e,t){var r=255&e,n=1,o=[r];for(r=255&(e>>=8);r>0;)o.unshift(r),r=255&(e>>=8),++n;return t?o.push(n):o.unshift(n),this.update(o),o.length},R.prototype.encodeString=function(e){var r,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(t);if(null===e)throw new Error(t);if(s&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||s&&ArrayBuffer.isView(e)))throw new Error(t);r=!0}var o=0,i=e.length;if(r)o=i;else for(var a=0;a<e.length;++a){var c=e.charCodeAt(a);c<128?o+=1:c<2048?o+=2:c<55296||c>=57344?o+=3:(c=65536+((1023&c)<<10|1023&e.charCodeAt(++a)),o+=4)}return o+=this.encode(8*o),this.update(e),o},R.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n<e.length;++n)r+=this.encodeString(e[n]);var o=t-r%t,i=[];return i.length=o,this.update(i),this},R.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,r=this.blockCount,n=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t<r+1;++t)e[t]=0;for(e[r-1]|=2147483648,t=0;t<r;++t)n[t]^=e[t];N(n)}},R.prototype.toString=R.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,r=this.s,n=this.outputBlocks,o=this.extraBytes,i=0,s=0,c="";s<n;){for(i=0;i<t&&s<n;++i,++s)e=r[i],c+=a[e>>4&15]+a[15&e]+a[e>>12&15]+a[e>>8&15]+a[e>>20&15]+a[e>>16&15]+a[e>>28&15]+a[e>>24&15];s%t==0&&(N(r),i=0)}return o&&(e=r[i],c+=a[e>>4&15]+a[15&e],o>1&&(c+=a[e>>12&15]+a[e>>8&15]),o>2&&(c+=a[e>>20&15]+a[e>>16&15])),c},R.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,o=this.extraBytes,i=0,s=0,a=this.outputBits>>3;e=o?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var c=new Uint32Array(e);s<n;){for(i=0;i<t&&s<n;++i,++s)c[s]=r[i];s%t==0&&N(r)}return o&&(c[i]=r[i],e=e.slice(0,a)),e},R.prototype.buffer=R.prototype.arrayBuffer,R.prototype.digest=R.prototype.array=function(){this.finalize();for(var e,t,r=this.blockCount,n=this.s,o=this.outputBlocks,i=this.extraBytes,s=0,a=0,c=[];a<o;){for(s=0;s<r&&a<o;++s,++a)e=a<<2,t=n[s],c[e]=255&t,c[e+1]=t>>8&255,c[e+2]=t>>16&255,c[e+3]=t>>24&255;a%r==0&&N(n)}return i&&(e=a<<2,t=n[s],c[e]=255&t,i>1&&(c[e+1]=t>>8&255),i>2&&(c[e+2]=t>>16&255)),c},O.prototype=new R,O.prototype.finalize=function(){return this.encode(this.outputBits,!0),R.prototype.finalize.call(this)};var N=function(e){var t,r,n,o,i,s,a,c,u,d,h,f,p,m,y,g,b,w,v,_,A,I,T,k,S,E,$,C,R,O,N,M,B,D,P,x,L,U,j,F,q,K,G,H,V,z,Q,W,Y,Z,J,X,ee,te,re,ne,oe,ie,se,ae,ce,ue,le;for(n=0;n<48;n+=2)o=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],d=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(f=e[8]^e[18]^e[28]^e[38]^e[48])^(s<<1|a>>>31),r=(p=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|s>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=o^(c<<1|u>>>31),r=i^(u<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=s^(d<<1|h>>>31),r=a^(h<<1|d>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(f<<1|p>>>31),r=u^(p<<1|f>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=d^(o<<1|i>>>31),r=h^(i<<1|o>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,m=e[0],y=e[1],z=e[11]<<4|e[10]>>>28,Q=e[10]<<4|e[11]>>>28,C=e[20]<<3|e[21]>>>29,R=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,K=e[40]<<18|e[41]>>>14,G=e[41]<<18|e[40]>>>14,D=e[2]<<1|e[3]>>>31,P=e[3]<<1|e[2]>>>31,g=e[13]<<12|e[12]>>>20,b=e[12]<<12|e[13]>>>20,W=e[22]<<10|e[23]>>>22,Y=e[23]<<10|e[22]>>>22,O=e[33]<<13|e[32]>>>19,N=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,le=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,x=e[14]<<6|e[15]>>>26,L=e[15]<<6|e[14]>>>26,w=e[25]<<11|e[24]>>>21,v=e[24]<<11|e[25]>>>21,Z=e[34]<<15|e[35]>>>17,J=e[35]<<15|e[34]>>>17,M=e[45]<<29|e[44]>>>3,B=e[44]<<29|e[45]>>>3,k=e[6]<<28|e[7]>>>4,S=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,oe=e[16]<<23|e[17]>>>9,U=e[26]<<25|e[27]>>>7,j=e[27]<<25|e[26]>>>7,_=e[36]<<21|e[37]>>>11,A=e[37]<<21|e[36]>>>11,X=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,H=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,E=e[18]<<20|e[19]>>>12,$=e[19]<<20|e[18]>>>12,ie=e[29]<<7|e[28]>>>25,se=e[28]<<7|e[29]>>>25,F=e[38]<<8|e[39]>>>24,q=e[39]<<8|e[38]>>>24,I=e[48]<<14|e[49]>>>18,T=e[49]<<14|e[48]>>>18,e[0]=m^~g&w,e[1]=y^~b&v,e[10]=k^~E&C,e[11]=S^~$&R,e[20]=D^~x&U,e[21]=P^~L&j,e[30]=H^~z&W,e[31]=V^~Q&Y,e[40]=te^~ne&ie,e[41]=re^~oe&se,e[2]=g^~w&_,e[3]=b^~v&A,e[12]=E^~C&O,e[13]=$^~R&N,e[22]=x^~U&F,e[23]=L^~j&q,e[32]=z^~W&Z,e[33]=Q^~Y&J,e[42]=ne^~ie&ae,e[43]=oe^~se&ce,e[4]=w^~_&I,e[5]=v^~A&T,e[14]=C^~O&M,e[15]=R^~N&B,e[24]=U^~F&K,e[25]=j^~q&G,e[34]=W^~Z&X,e[35]=Y^~J&ee,e[44]=ie^~ae&ue,e[45]=se^~ce&le,e[6]=_^~I&m,e[7]=A^~T&y,e[16]=O^~M&k,e[17]=N^~B&S,e[26]=F^~K&D,e[27]=q^~G&P,e[36]=Z^~X&H,e[37]=J^~ee&V,e[46]=ae^~ue&te,e[47]=ce^~le&re,e[8]=I^~m&g,e[9]=T^~y&b,e[18]=M^~k&E,e[19]=B^~S&$,e[28]=K^~D&x,e[29]=G^~P&L,e[38]=X^~H&z,e[39]=ee^~V&Q,e[48]=ue^~te&ne,e[49]=le^~re&oe,e[0]^=l[n],e[1]^=l[n+1]};if(i)e.exports=A;else for(T=0;T<I.length;++T)n[I[T]]=A[I[T]]}()}(Pn);var b0=Pn.exports;const y0="logger/5.7.0";let Dn=!1,Fn=!1;const Cr={debug:1,default:2,info:2,warning:3,error:4,off:5};let Tn=Cr.default,gi=null;function w0(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch{e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e2){return e2.message}return null}const Un=w0();var Ai,re$2;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(Ai||(Ai={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(re$2||(re$2={}));const kn="0123456789abcdef";let L$6=class e{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==Cr[r]&&this.throwArgumentError("invalid log level name","logLevel",e),!(Tn>Cr[r])&&console.log.apply(console,t)}debug(...t){this._log(e.levels.DEBUG,t)}info(...t){this._log(e.levels.INFO,t)}warn(...t){this._log(e.levels.WARNING,t)}makeError(t,r,n){if(Fn)return this.makeError("censored error",r,{});r||(r=e.errors.UNKNOWN_ERROR),n||(n={});const o=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=kn[t[e]>>4],r+=kn[15&t[e]];o.push(e+"=Uint8Array(0x"+r+")")}else o.push(e+"="+JSON.stringify(t))}catch{o.push(e+"="+JSON.stringify(n[e].toString()))}})),o.push(`code=${r}`),o.push(`version=${this.version}`);const i=t;let s="";switch(r){case re$2.NUMERIC_FAULT:{s="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":s+="-"+e;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result"}break}case re$2.CALL_EXCEPTION:case re$2.INSUFFICIENT_FUNDS:case re$2.MISSING_NEW:case re$2.NONCE_EXPIRED:case re$2.REPLACEMENT_UNDERPRICED:case re$2.TRANSACTION_REPLACED:case re$2.UNPREDICTABLE_GAS_LIMIT:s=r}s&&(t+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),o.length&&(t+=" ("+o.join(", ")+")");const a=new Error(t);return a.reason=i,a.code=r,Object.keys(n).forEach((function(e){a[e]=n[e]})),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(t,r,n){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(t){Un&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Un})}checkSafeUint53(t,r){"number"==typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,r,n){n=n?": "+n:"",t<r&&this.throwError("missing argument"+n,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}checkNew(t,r){(t===Object||null==t)&&this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}checkAbstract(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):(t===Object||null==t)&&this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return gi||(gi=new e(y0)),gi}static setCensorship(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Dn){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Fn=!!t,Dn=!!r}static setLogLevel(t){const r=Cr[t.toLowerCase()];null!=r?Tn=r:e.globalLogger().warn("invalid log level - "+t)}static from(t){return new e(t)}};L$6.errors=re$2,L$6.levels=Ai;const x0="bytes/5.7.0",Dt$1=new L$6(x0);function qn(e){return!!e.toHexString}function rr$1(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return rr$1(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function M0(e){return Qt$1(e)&&!(e.length%2)||ir$1(e)}function Kn(e){return"number"==typeof e&&e==e&&e%1==0}function ir$1(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e||!Kn(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!Kn(r)||r<0||r>=256)return!1}return!0}function Ot$1(e,t){if(t||(t={}),"number"==typeof e){Dt$1.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),rr$1(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),qn(e)&&(e=e.toHexString()),Qt$1(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":Dt$1.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;e<r.length;e+=2)n.push(parseInt(r.substring(e,e+2),16));return rr$1(new Uint8Array(n))}return ir$1(e)?rr$1(new Uint8Array(e)):Dt$1.throwArgumentError("invalid arrayify value","value",e)}function E0(e){const t=e.map((e=>Ot$1(e))),r=t.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(r);return t.reduce(((e,t)=>(n.set(t,e),e+t.length)),0),rr$1(n)}function S0(e,t){(e=Ot$1(e)).length>t&&Dt$1.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),rr$1(r)}function Qt$1(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/)||t&&e.length!==2+2*t)}const bi="0123456789abcdef";function Kt$1(e,t){if(t||(t={}),"number"==typeof e){Dt$1.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=bi[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),qn(e))return e.toHexString();if(Qt$1(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":Dt$1.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(ir$1(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+=bi[(240&n)>>4]+bi[15&n]}return t}return Dt$1.throwArgumentError("invalid hexlify value","value",e)}function N0(e){if("string"!=typeof e)e=Kt$1(e);else if(!Qt$1(e)||e.length%2)return null;return(e.length-2)/2}function Hn(e,t,r){return"string"!=typeof e?e=Kt$1(e):(!Qt$1(e)||e.length%2)&&Dt$1.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function oe$3(e,t){for("string"!=typeof e?e=Kt$1(e):Qt$1(e)||Dt$1.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&Dt$1.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function zn(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(M0(e)){let r=Ot$1(e);64===r.length?(t.v=27+(r[32]>>7),r[32]&=127,t.r=Kt$1(r.slice(0,32)),t.s=Kt$1(r.slice(32,64))):65===r.length?(t.r=Kt$1(r.slice(0,32)),t.s=Kt$1(r.slice(32,64)),t.v=r[64]):Dt$1.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:Dt$1.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=Kt$1(r.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){const r=S0(Ot$1(t._vs),32);t._vs=Kt$1(r);const n=r[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=n:t.recoveryParam!==n&&Dt$1.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),r[0]&=127;const o=Kt$1(r);null==t.s?t.s=o:t.s!==o&&Dt$1.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?Dt$1.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{const r=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==r&&Dt$1.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&Qt$1(t.r)?t.r=oe$3(t.r,32):Dt$1.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&Qt$1(t.s)?t.s=oe$3(t.s,32):Dt$1.throwArgumentError("signature missing or invalid s","signature",e);const r=Ot$1(t.s);r[0]>=128&&Dt$1.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const n=Kt$1(r);t._vs&&(Qt$1(t._vs)||Dt$1.throwArgumentError("signature invalid _vs","signature",e),t._vs=oe$3(t._vs,32)),null==t._vs?t._vs=n:t._vs!==n&&Dt$1.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function yi(e){return"0x"+b0.keccak_256(Ot$1(e))}var Ln={exports:{}},I0={},_0=Object.freeze({__proto__:null,default:I0}),B0=A0(_0);!function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&(("le"===t||"be"===t)&&(r=t,t=10),this._init(e||0,t||10,r||"be"))}var i;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{i=typeof window<"u"&&typeof window.Buffer<"u"?window.Buffer:B0.Buffer}catch{}function s(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function a(e,t,r){var n=s(e,r);return r-1>=t&&(n|=s(e,r-1)<<4),n}function c(e,t,n,o){for(var i=0,s=0,a=Math.min(e.length,n),c=t;c<a;c++){var u=e.charCodeAt(c)-48;i*=o,s=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&s<o,"Invalid character"),i+=s}return i}function u(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var o=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(o++,this.negative=1),o<e.length&&(16===t?this._parseHex(e,o,n):(this._parseBase(e,t,o),"le"===n&&this._initArray(this.toArray(),t,n)))},o.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var o=0;o<this.length;o++)this.words[o]=0;var i,s,a=0;if("be"===n)for(o=e.length-1,i=0;o>=0;o-=3)s=e[o]|e[o-1]<<8|e[o-2]<<16,this.words[i]|=s<<a&67108863,this.words[i+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,i++);else if("le"===n)for(o=0,i=0;o<e.length;o+=3)s=e[o]|e[o+1]<<8|e[o+2]<<16,this.words[i]|=s<<a&67108863,this.words[i+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,i++);return this._strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,i=0,s=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)o=a(e,t,n)<<i,this.words[s]|=67108863&o,i>=18?(i-=18,s+=1,this.words[s]|=o>>>26):i+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)o=a(e,t,n)<<i,this.words[s]|=67108863&o,i>=18?(i-=18,s+=1,this.words[s]|=o>>>26):i+=8;this._strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,o=1;o<=67108863;o*=t)n++;n--,o=o/t|0;for(var i=e.length-r,s=i%n,a=Math.min(i,i-s)+r,u=0,l=r;l<a;l+=n)u=c(e,l,l+n,t),this.imuln(o),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var d=1;for(u=c(e,l,e.length,t),l=0;l<s;l++)d*=t;this.imuln(d),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype._move=function(e){u(e,this)},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},typeof Symbol<"u"&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch{o.prototype.inspect=l}else o.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var o=0,i=0,s=0;s<this.length;s++){var a=this.words[s],c=(16777215&(a<<o|i)).toString(16);i=a>>>24-o&16777215,(o+=2)>=26&&(o-=26,s--),n=0!==i||s!==this.length-1?d[6-c.length]+c+n:c+n}for(0!==i&&(n=i.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var u=h[e],l=f[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(e);n=(p=p.idivn(l)).isZero()?m+n:d[u-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16,2)},i&&(o.prototype.toBuffer=function(e,t){return this.toArrayLike(i,e,t)}),o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function p(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var o=0|e.words[0],i=0|t.words[0],s=o*i,a=67108863&s,c=s/67108864|0;r.words[0]=a;for(var u=1;u<n;u++){for(var l=c>>>26,d=67108863&c,h=Math.min(u,t.length-1),f=Math.max(0,u-e.length+1);f<=h;f++){var p=u-f|0;l+=(s=(o=0|e.words[p])*(i=0|t.words[f])+d)/67108864|0,d=67108863&s}r.words[u]=0|d,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r._strip()}o.prototype.toArrayLike=function(e,t,n){this._strip();var o=this.byteLength(),i=n||Math.max(1,o);r(o<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0");var s=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,i);return this["_toArrayLike"+("le"===t?"LE":"BE")](s,o),s},o.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,o=0,i=0;o<this.length;o++){var s=this.words[o]<<i|n;e[r++]=255&s,r<e.length&&(e[r++]=s>>8&255),r<e.length&&(e[r++]=s>>16&255),6===i?(r<e.length&&(e[r++]=s>>24&255),n=0,i=0):(n=s>>>24,i+=2)}if(r<e.length)for(e[r++]=n;r<e.length;)e[r++]=0},o.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,n=0,o=0,i=0;o<this.length;o++){var s=this.words[o]<<i|n;e[r--]=255&s,r>=0&&(e[r--]=s>>8&255),r>=0&&(e[r--]=s>>16&255),6===i?(r>=0&&(e[r--]=s>>24&255),n=0,i=0):(n=s>>>24,i+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},o.prototype.ior=function(e){return r(!(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},o.prototype.iand=function(e){return r(!(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this._strip()},o.prototype.ixor=function(e){return r(!(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var o=0;o<t;o++)this.words[o]=67108863&~this.words[o];return n>0&&(this.words[o]=~this.words[o]&67108863>>26-n),this._strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,o=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<o:this.words[n]&~(1<<o),this._strip()},o.prototype.iadd=function(e){var t,r,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var o=0,i=0;i<n.length;i++)t=(0|r.words[i])+(0|n.words[i])+o,this.words[i]=67108863&t,o=t>>>26;for(;0!==o&&i<r.length;i++)t=(0|r.words[i])+o,this.words[i]=67108863&t,o=t>>>26;if(this.length=r.length,0!==o)this.words[this.length]=o,this.length++;else if(r!==this)for(;i<r.length;i++)this.words[i]=r.words[i];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,o=this.cmp(e);if(0===o)return this.negative=0,this.length=1,this.words[0]=0,this;o>0?(r=this,n=e):(r=e,n=this);for(var i=0,s=0;s<n.length;s++)i=(t=(0|r.words[s])-(0|n.words[s])+i)>>26,this.words[s]=67108863&t;for(;0!==i&&s<r.length;s++)i=(t=(0|r.words[s])+i)>>26,this.words[s]=67108863&t;if(0===i&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var m=function(e,t,r){var n,o,i,s=e.words,a=t.words,c=r.words,u=0,l=0|s[0],d=8191&l,h=l>>>13,f=0|s[1],p=8191&f,m=f>>>13,y=0|s[2],g=8191&y,b=y>>>13,w=0|s[3],v=8191&w,_=w>>>13,A=0|s[4],I=8191&A,T=A>>>13,k=0|s[5],S=8191&k,E=k>>>13,$=0|s[6],C=8191&$,R=$>>>13,O=0|s[7],N=8191&O,M=O>>>13,B=0|s[8],D=8191&B,P=B>>>13,x=0|s[9],L=8191&x,U=x>>>13,j=0|a[0],F=8191&j,q=j>>>13,K=0|a[1],G=8191&K,H=K>>>13,V=0|a[2],z=8191&V,Q=V>>>13,W=0|a[3],Y=8191&W,Z=W>>>13,J=0|a[4],X=8191&J,ee=J>>>13,te=0|a[5],re=8191&te,ne=te>>>13,oe=0|a[6],ie=8191&oe,se=oe>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],de=8191&le,he=le>>>13,fe=0|a[9],pe=8191&fe,me=fe>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(u+(n=Math.imul(d,F))|0)+((8191&(o=(o=Math.imul(d,q))+Math.imul(h,F)|0))<<13)|0;u=((i=Math.imul(h,q))+(o>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(p,F),o=(o=Math.imul(p,q))+Math.imul(m,F)|0,i=Math.imul(m,q);var ge=(u+(n=n+Math.imul(d,G)|0)|0)+((8191&(o=(o=o+Math.imul(d,H)|0)+Math.imul(h,G)|0))<<13)|0;u=((i=i+Math.imul(h,H)|0)+(o>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(g,F),o=(o=Math.imul(g,q))+Math.imul(b,F)|0,i=Math.imul(b,q),n=n+Math.imul(p,G)|0,o=(o=o+Math.imul(p,H)|0)+Math.imul(m,G)|0,i=i+Math.imul(m,H)|0;var be=(u+(n=n+Math.imul(d,z)|0)|0)+((8191&(o=(o=o+Math.imul(d,Q)|0)+Math.imul(h,z)|0))<<13)|0;u=((i=i+Math.imul(h,Q)|0)+(o>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(v,F),o=(o=Math.imul(v,q))+Math.imul(_,F)|0,i=Math.imul(_,q),n=n+Math.imul(g,G)|0,o=(o=o+Math.imul(g,H)|0)+Math.imul(b,G)|0,i=i+Math.imul(b,H)|0,n=n+Math.imul(p,z)|0,o=(o=o+Math.imul(p,Q)|0)+Math.imul(m,z)|0,i=i+Math.imul(m,Q)|0;var we=(u+(n=n+Math.imul(d,Y)|0)|0)+((8191&(o=(o=o+Math.imul(d,Z)|0)+Math.imul(h,Y)|0))<<13)|0;u=((i=i+Math.imul(h,Z)|0)+(o>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(I,F),o=(o=Math.imul(I,q))+Math.imul(T,F)|0,i=Math.imul(T,q),n=n+Math.imul(v,G)|0,o=(o=o+Math.imul(v,H)|0)+Math.imul(_,G)|0,i=i+Math.imul(_,H)|0,n=n+Math.imul(g,z)|0,o=(o=o+Math.imul(g,Q)|0)+Math.imul(b,z)|0,i=i+Math.imul(b,Q)|0,n=n+Math.imul(p,Y)|0,o=(o=o+Math.imul(p,Z)|0)+Math.imul(m,Y)|0,i=i+Math.imul(m,Z)|0;var ve=(u+(n=n+Math.imul(d,X)|0)|0)+((8191&(o=(o=o+Math.imul(d,ee)|0)+Math.imul(h,X)|0))<<13)|0;u=((i=i+Math.imul(h,ee)|0)+(o>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(S,F),o=(o=Math.imul(S,q))+Math.imul(E,F)|0,i=Math.imul(E,q),n=n+Math.imul(I,G)|0,o=(o=o+Math.imul(I,H)|0)+Math.imul(T,G)|0,i=i+Math.imul(T,H)|0,n=n+Math.imul(v,z)|0,o=(o=o+Math.imul(v,Q)|0)+Math.imul(_,z)|0,i=i+Math.imul(_,Q)|0,n=n+Math.imul(g,Y)|0,o=(o=o+Math.imul(g,Z)|0)+Math.imul(b,Y)|0,i=i+Math.imul(b,Z)|0,n=n+Math.imul(p,X)|0,o=(o=o+Math.imul(p,ee)|0)+Math.imul(m,X)|0,i=i+Math.imul(m,ee)|0;var _e=(u+(n=n+Math.imul(d,re)|0)|0)+((8191&(o=(o=o+Math.imul(d,ne)|0)+Math.imul(h,re)|0))<<13)|0;u=((i=i+Math.imul(h,ne)|0)+(o>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(C,F),o=(o=Math.imul(C,q))+Math.imul(R,F)|0,i=Math.imul(R,q),n=n+Math.imul(S,G)|0,o=(o=o+Math.imul(S,H)|0)+Math.imul(E,G)|0,i=i+Math.imul(E,H)|0,n=n+Math.imul(I,z)|0,o=(o=o+Math.imul(I,Q)|0)+Math.imul(T,z)|0,i=i+Math.imul(T,Q)|0,n=n+Math.imul(v,Y)|0,o=(o=o+Math.imul(v,Z)|0)+Math.imul(_,Y)|0,i=i+Math.imul(_,Z)|0,n=n+Math.imul(g,X)|0,o=(o=o+Math.imul(g,ee)|0)+Math.imul(b,X)|0,i=i+Math.imul(b,ee)|0,n=n+Math.imul(p,re)|0,o=(o=o+Math.imul(p,ne)|0)+Math.imul(m,re)|0,i=i+Math.imul(m,ne)|0;var Ae=(u+(n=n+Math.imul(d,ie)|0)|0)+((8191&(o=(o=o+Math.imul(d,se)|0)+Math.imul(h,ie)|0))<<13)|0;u=((i=i+Math.imul(h,se)|0)+(o>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(N,F),o=(o=Math.imul(N,q))+Math.imul(M,F)|0,i=Math.imul(M,q),n=n+Math.imul(C,G)|0,o=(o=o+Math.imul(C,H)|0)+Math.imul(R,G)|0,i=i+Math.imul(R,H)|0,n=n+Math.imul(S,z)|0,o=(o=o+Math.imul(S,Q)|0)+Math.imul(E,z)|0,i=i+Math.imul(E,Q)|0,n=n+Math.imul(I,Y)|0,o=(o=o+Math.imul(I,Z)|0)+Math.imul(T,Y)|0,i=i+Math.imul(T,Z)|0,n=n+Math.imul(v,X)|0,o=(o=o+Math.imul(v,ee)|0)+Math.imul(_,X)|0,i=i+Math.imul(_,ee)|0,n=n+Math.imul(g,re)|0,o=(o=o+Math.imul(g,ne)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,ne)|0,n=n+Math.imul(p,ie)|0,o=(o=o+Math.imul(p,se)|0)+Math.imul(m,ie)|0,i=i+Math.imul(m,se)|0;var Ie=(u+(n=n+Math.imul(d,ce)|0)|0)+((8191&(o=(o=o+Math.imul(d,ue)|0)+Math.imul(h,ce)|0))<<13)|0;u=((i=i+Math.imul(h,ue)|0)+(o>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(D,F),o=(o=Math.imul(D,q))+Math.imul(P,F)|0,i=Math.imul(P,q),n=n+Math.imul(N,G)|0,o=(o=o+Math.imul(N,H)|0)+Math.imul(M,G)|0,i=i+Math.imul(M,H)|0,n=n+Math.imul(C,z)|0,o=(o=o+Math.imul(C,Q)|0)+Math.imul(R,z)|0,i=i+Math.imul(R,Q)|0,n=n+Math.imul(S,Y)|0,o=(o=o+Math.imul(S,Z)|0)+Math.imul(E,Y)|0,i=i+Math.imul(E,Z)|0,n=n+Math.imul(I,X)|0,o=(o=o+Math.imul(I,ee)|0)+Math.imul(T,X)|0,i=i+Math.imul(T,ee)|0,n=n+Math.imul(v,re)|0,o=(o=o+Math.imul(v,ne)|0)+Math.imul(_,re)|0,i=i+Math.imul(_,ne)|0,n=n+Math.imul(g,ie)|0,o=(o=o+Math.imul(g,se)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,se)|0,n=n+Math.imul(p,ce)|0,o=(o=o+Math.imul(p,ue)|0)+Math.imul(m,ce)|0,i=i+Math.imul(m,ue)|0;var Te=(u+(n=n+Math.imul(d,de)|0)|0)+((8191&(o=(o=o+Math.imul(d,he)|0)+Math.imul(h,de)|0))<<13)|0;u=((i=i+Math.imul(h,he)|0)+(o>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(L,F),o=(o=Math.imul(L,q))+Math.imul(U,F)|0,i=Math.imul(U,q),n=n+Math.imul(D,G)|0,o=(o=o+Math.imul(D,H)|0)+Math.imul(P,G)|0,i=i+Math.imul(P,H)|0,n=n+Math.imul(N,z)|0,o=(o=o+Math.imul(N,Q)|0)+Math.imul(M,z)|0,i=i+Math.imul(M,Q)|0,n=n+Math.imul(C,Y)|0,o=(o=o+Math.imul(C,Z)|0)+Math.imul(R,Y)|0,i=i+Math.imul(R,Z)|0,n=n+Math.imul(S,X)|0,o=(o=o+Math.imul(S,ee)|0)+Math.imul(E,X)|0,i=i+Math.imul(E,ee)|0,n=n+Math.imul(I,re)|0,o=(o=o+Math.imul(I,ne)|0)+Math.imul(T,re)|0,i=i+Math.imul(T,ne)|0,n=n+Math.imul(v,ie)|0,o=(o=o+Math.imul(v,se)|0)+Math.imul(_,ie)|0,i=i+Math.imul(_,se)|0,n=n+Math.imul(g,ce)|0,o=(o=o+Math.imul(g,ue)|0)+Math.imul(b,ce)|0,i=i+Math.imul(b,ue)|0,n=n+Math.imul(p,de)|0,o=(o=o+Math.imul(p,he)|0)+Math.imul(m,de)|0,i=i+Math.imul(m,he)|0;var ke=(u+(n=n+Math.imul(d,pe)|0)|0)+((8191&(o=(o=o+Math.imul(d,me)|0)+Math.imul(h,pe)|0))<<13)|0;u=((i=i+Math.imul(h,me)|0)+(o>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(L,G),o=(o=Math.imul(L,H))+Math.imul(U,G)|0,i=Math.imul(U,H),n=n+Math.imul(D,z)|0,o=(o=o+Math.imul(D,Q)|0)+Math.imul(P,z)|0,i=i+Math.imul(P,Q)|0,n=n+Math.imul(N,Y)|0,o=(o=o+Math.imul(N,Z)|0)+Math.imul(M,Y)|0,i=i+Math.imul(M,Z)|0,n=n+Math.imul(C,X)|0,o=(o=o+Math.imul(C,ee)|0)+Math.imul(R,X)|0,i=i+Math.imul(R,ee)|0,n=n+Math.imul(S,re)|0,o=(o=o+Math.imul(S,ne)|0)+Math.imul(E,re)|0,i=i+Math.imul(E,ne)|0,n=n+Math.imul(I,ie)|0,o=(o=o+Math.imul(I,se)|0)+Math.imul(T,ie)|0,i=i+Math.imul(T,se)|0,n=n+Math.imul(v,ce)|0,o=(o=o+Math.imul(v,ue)|0)+Math.imul(_,ce)|0,i=i+Math.imul(_,ue)|0,n=n+Math.imul(g,de)|0,o=(o=o+Math.imul(g,he)|0)+Math.imul(b,de)|0,i=i+Math.imul(b,he)|0;var Se=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(o=(o=o+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;u=((i=i+Math.imul(m,me)|0)+(o>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(L,z),o=(o=Math.imul(L,Q))+Math.imul(U,z)|0,i=Math.imul(U,Q),n=n+Math.imul(D,Y)|0,o=(o=o+Math.imul(D,Z)|0)+Math.imul(P,Y)|0,i=i+Math.imul(P,Z)|0,n=n+Math.imul(N,X)|0,o=(o=o+Math.imul(N,ee)|0)+Math.imul(M,X)|0,i=i+Math.imul(M,ee)|0,n=n+Math.imul(C,re)|0,o=(o=o+Math.imul(C,ne)|0)+Math.imul(R,re)|0,i=i+Math.imul(R,ne)|0,n=n+Math.imul(S,ie)|0,o=(o=o+Math.imul(S,se)|0)+Math.imul(E,ie)|0,i=i+Math.imul(E,se)|0,n=n+Math.imul(I,ce)|0,o=(o=o+Math.imul(I,ue)|0)+Math.imul(T,ce)|0,i=i+Math.imul(T,ue)|0,n=n+Math.imul(v,de)|0,o=(o=o+Math.imul(v,he)|0)+Math.imul(_,de)|0,i=i+Math.imul(_,he)|0;var Ee=(u+(n=n+Math.imul(g,pe)|0)|0)+((8191&(o=(o=o+Math.imul(g,me)|0)+Math.imul(b,pe)|0))<<13)|0;u=((i=i+Math.imul(b,me)|0)+(o>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(L,Y),o=(o=Math.imul(L,Z))+Math.imul(U,Y)|0,i=Math.imul(U,Z),n=n+Math.imul(D,X)|0,o=(o=o+Math.imul(D,ee)|0)+Math.imul(P,X)|0,i=i+Math.imul(P,ee)|0,n=n+Math.imul(N,re)|0,o=(o=o+Math.imul(N,ne)|0)+Math.imul(M,re)|0,i=i+Math.imul(M,ne)|0,n=n+Math.imul(C,ie)|0,o=(o=o+Math.imul(C,se)|0)+Math.imul(R,ie)|0,i=i+Math.imul(R,se)|0,n=n+Math.imul(S,ce)|0,o=(o=o+Math.imul(S,ue)|0)+Math.imul(E,ce)|0,i=i+Math.imul(E,ue)|0,n=n+Math.imul(I,de)|0,o=(o=o+Math.imul(I,he)|0)+Math.imul(T,de)|0,i=i+Math.imul(T,he)|0;var $e=(u+(n=n+Math.imul(v,pe)|0)|0)+((8191&(o=(o=o+Math.imul(v,me)|0)+Math.imul(_,pe)|0))<<13)|0;u=((i=i+Math.imul(_,me)|0)+(o>>>13)|0)+($e>>>26)|0,$e&=67108863,n=Math.imul(L,X),o=(o=Math.imul(L,ee))+Math.imul(U,X)|0,i=Math.imul(U,ee),n=n+Math.imul(D,re)|0,o=(o=o+Math.imul(D,ne)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,ne)|0,n=n+Math.imul(N,ie)|0,o=(o=o+Math.imul(N,se)|0)+Math.imul(M,ie)|0,i=i+Math.imul(M,se)|0,n=n+Math.imul(C,ce)|0,o=(o=o+Math.imul(C,ue)|0)+Math.imul(R,ce)|0,i=i+Math.imul(R,ue)|0,n=n+Math.imul(S,de)|0,o=(o=o+Math.imul(S,he)|0)+Math.imul(E,de)|0,i=i+Math.imul(E,he)|0;var Ce=(u+(n=n+Math.imul(I,pe)|0)|0)+((8191&(o=(o=o+Math.imul(I,me)|0)+Math.imul(T,pe)|0))<<13)|0;u=((i=i+Math.imul(T,me)|0)+(o>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(L,re),o=(o=Math.imul(L,ne))+Math.imul(U,re)|0,i=Math.imul(U,ne),n=n+Math.imul(D,ie)|0,o=(o=o+Math.imul(D,se)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,se)|0,n=n+Math.imul(N,ce)|0,o=(o=o+Math.imul(N,ue)|0)+Math.imul(M,ce)|0,i=i+Math.imul(M,ue)|0,n=n+Math.imul(C,de)|0,o=(o=o+Math.imul(C,he)|0)+Math.imul(R,de)|0,i=i+Math.imul(R,he)|0;var Re=(u+(n=n+Math.imul(S,pe)|0)|0)+((8191&(o=(o=o+Math.imul(S,me)|0)+Math.imul(E,pe)|0))<<13)|0;u=((i=i+Math.imul(E,me)|0)+(o>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(L,ie),o=(o=Math.imul(L,se))+Math.imul(U,ie)|0,i=Math.imul(U,se),n=n+Math.imul(D,ce)|0,o=(o=o+Math.imul(D,ue)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,ue)|0,n=n+Math.imul(N,de)|0,o=(o=o+Math.imul(N,he)|0)+Math.imul(M,de)|0,i=i+Math.imul(M,he)|0;var Oe=(u+(n=n+Math.imul(C,pe)|0)|0)+((8191&(o=(o=o+Math.imul(C,me)|0)+Math.imul(R,pe)|0))<<13)|0;u=((i=i+Math.imul(R,me)|0)+(o>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(L,ce),o=(o=Math.imul(L,ue))+Math.imul(U,ce)|0,i=Math.imul(U,ue),n=n+Math.imul(D,de)|0,o=(o=o+Math.imul(D,he)|0)+Math.imul(P,de)|0,i=i+Math.imul(P,he)|0;var Ne=(u+(n=n+Math.imul(N,pe)|0)|0)+((8191&(o=(o=o+Math.imul(N,me)|0)+Math.imul(M,pe)|0))<<13)|0;u=((i=i+Math.imul(M,me)|0)+(o>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,n=Math.imul(L,de),o=(o=Math.imul(L,he))+Math.imul(U,de)|0,i=Math.imul(U,he);var Me=(u+(n=n+Math.imul(D,pe)|0)|0)+((8191&(o=(o=o+Math.imul(D,me)|0)+Math.imul(P,pe)|0))<<13)|0;u=((i=i+Math.imul(P,me)|0)+(o>>>13)|0)+(Me>>>26)|0,Me&=67108863;var Be=(u+(n=Math.imul(L,pe))|0)+((8191&(o=(o=Math.imul(L,me))+Math.imul(U,pe)|0))<<13)|0;return u=((i=Math.imul(U,me))+(o>>>13)|0)+(Be>>>26)|0,Be&=67108863,c[0]=ye,c[1]=ge,c[2]=be,c[3]=we,c[4]=ve,c[5]=_e,c[6]=Ae,c[7]=Ie,c[8]=Te,c[9]=ke,c[10]=Se,c[11]=Ee,c[12]=$e,c[13]=Ce,c[14]=Re,c[15]=Oe,c[16]=Ne,c[17]=Me,c[18]=Be,0!==u&&(c[19]=u,r.length++),r};function y(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,o=0,i=0;i<r.length-1;i++){var s=o;o=0;for(var a=67108863&n,c=Math.min(i,t.length-1),u=Math.max(0,i-e.length+1);u<=c;u++){var l=i-u,d=(0|e.words[l])*(0|t.words[u]),h=67108863&d;a=67108863&(h=h+a|0),o+=(s=(s=s+(d/67108864|0)|0)+(h>>>26)|0)>>>26,s&=67108863}r.words[i]=a,n=s,s=o}return 0!==n?r.words[i]=n:r.length--,r._strip()}function g(e,t,r){return y(e,t,r)}Math.imul||(m=p),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):r<63?p(this,e,t):r<1024?y(this,e,t):g(this,e,t)},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),g(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){var t=e<0;t&&(e=-e),r("number"==typeof e),r(e<67108864);for(var n=0,o=0;o<this.length;o++){var i=(0|this.words[o])*e,s=(67108863&i)+(67108863&n);n>>=26,n+=i/67108864|0,n+=s>>>26,this.words[o]=67108863&s}return 0!==n&&(this.words[o]=n,this.length++),t?this.ineg():this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var n=r/26|0,o=r%26;t[r]=e.words[n]>>>o&1}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var i=r.sqr();n<t.length;n++,i=i.sqr())0!==t[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,o=(e-n)/26,i=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t<this.length;t++){var a=this.words[t]&i,c=(0|this.words[t])-a<<n;this.words[t]=c|s,s=a>>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==o){for(t=this.length-1;t>=0;t--)this.words[t+o]=this.words[t];for(t=0;t<o;t++)this.words[t]=0;this.length+=o}return this._strip()},o.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,n){var o;r("number"==typeof e&&e>=0),o=t?(t-t%26)/26:0;var i=e%26,s=Math.min((e-i)/26,this.length),a=67108863^67108863>>>i<<i,c=n;if(o-=s,o=Math.max(0,o),c){for(var u=0;u<s;u++)c.words[u]=this.words[u];c.length=s}if(0!==s)if(this.length>s)for(this.length-=s,u=0;u<this.length;u++)this.words[u]=this.words[u+s];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=o);u--){var d=0|this.words[u];this.words[u]=l<<26-i|d>>>i,l=d&a}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,o=1<<t;return!(this.length<=n)&&!!(this.words[n]&o)},o.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var o=67108863^67108863>>>t<<t;this.words[this.length-1]&=o}return this._strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,n){var o,i=e.length+n;this._expand(i);var s,a=0;for(o=0;o<e.length;o++){s=(0|this.words[o+n])+a;var c=(0|e.words[o])*t;a=((s-=67108863&c)>>26)-(c/67108864|0),this.words[o+n]=67108863&s}for(;o<this.length-n;o++)a=(s=(0|this.words[o+n])+a)>>26,this.words[o+n]=67108863&s;if(0===a)return this._strip();for(r(-1===a),a=0,o=0;o<this.length;o++)a=(s=-(0|this.words[o])+a)>>26,this.words[o]=67108863&s;return this.negative=1,this._strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,s=0|i.words[i.length-1];0!==(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,c=n.length-i.length;if("mod"!==t){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u<a.length;u++)a.words[u]=0}var l=n.clone()._ishlnsubmul(i,1,c);0===l.negative&&(n=l,a&&(a.words[c]=1));for(var d=c-1;d>=0;d--){var h=67108864*(0|n.words[i.length+d])+(0|n.words[i.length+d-1]);for(h=Math.min(h/s|0,67108863),n._ishlnsubmul(i,h,d);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(i,1,d),n.isZero()||(n.negative^=1);a&&(a.words[d]=h)}return a&&a._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):this.negative&e.negative?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),o=e.andln(1),i=r.cmp(n);return i<0||1===o&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,o=0,i=this.length-1;i>=0;i--)o=(n*o+(0|this.words[i]))%e;return t?-o:o},o.prototype.modn=function(e){return this.modrn(e)},o.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,o=this.length-1;o>=0;o--){var i=(0|this.words[o])+67108864*n;this.words[o]=i/e|0,n=i%e}return this._strip(),t?this.ineg():this},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),c=new o(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),d=t.clone();!t.isZero();){for(var h=0,f=1;!(t.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(d)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;!(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(l),c.isub(d)),a.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(a),s.isub(c)):(n.isub(t),a.isub(i),c.isub(s))}return{a:a,b:c,gcd:n.iushln(u)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t,n=this,i=e.clone();n=0!==n.negative?n.umod(e):n.clone();for(var s=new o(1),a=new o(0),c=i.clone();n.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;!(n.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(n.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var d=0,h=1;!(i.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(i.iushrn(d);d-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);n.cmp(i)>=0?(n.isub(i),s.isub(a)):(i.isub(n),a.isub(s))}return(t=0===n.cmpn(1)?s:a).cmpn(0)<0&&t.iadd(e),t},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var o=t.cmp(r);if(o<0){var i=t;t=r,r=i}else if(0===o||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return!(1&this.words[0])},o.prototype.isOdd=function(){return!(1&~this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,o=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=o,this;for(var i=o,s=n;0!==i&&s<this.length;s++){var a=0|this.words[s];i=(a+=i)>>>26,a&=67108863,this.words[s]=a}return 0!==i&&(this.words[s]=i,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var o=0|this.words[0];t=o===e?0:o<e?-1:1}return 0!==this.negative?0|-t:t},o.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],o=0|e.words[r];if(n!==o){n<o?t=-1:n>o&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new T(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var b={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function I(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function T(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function k(e){T.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}w.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},w.prototype.split=function(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},n(v,w),v.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),o=0;o<n;o++)t.words[o]=e.words[o];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=i&r,o=10;o<e.length;o++){var s=0|e.words[o];e.words[o-10]=(s&r)<<4|i>>>22,i=s}i>>>=22,e.words[o-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},v.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(_,w),n(A,w),n(I,w),I.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,o=67108863&n;n>>>=26,e.words[r]=o,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(b[e])return b[e];var t;if("k256"===e)t=new v;else if("p224"===e)t=new _;else if("p192"===e)t=new A;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new I}return b[e]=t,t},T.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},T.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},T.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},T.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},T.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},T.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},T.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},T.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},T.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},T.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},T.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},T.prototype.isqr=function(e){return this.imul(e,e.clone())},T.prototype.sqr=function(e){return this.mul(e,e)},T.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var d=this.pow(l,i),h=this.pow(e,i.addn(1).iushrn(1)),f=this.pow(e,i),p=s;0!==f.cmp(a);){for(var m=f,y=0;0!==m.cmp(a);y++)m=m.redSqr();r(y<p);var g=this.pow(d,new o(1).iushln(p-y-1));h=h.redMul(g),d=g.redSqr(),f=f.redMul(d),p=y}return h},T.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},T.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var i=r[0],s=0,a=0,c=t.bitLength()%26;for(0===c&&(c=26),n=t.length-1;n>=0;n--){for(var u=t.words[n],l=c-1;l>=0;l--){var d=u>>l&1;(i!==r[0]&&(i=this.sqr(i)),0!==d||0!==s)?(s<<=1,s|=d,(4===++a||0===n&&0===l)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}c=26}return i},T.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},T.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new k(e)},n(k,T),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},k.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).iushrn(this.shift),i=o;return o.cmp(this.m)>=0?i=o.isub(this.m):o.cmpn(0)<0&&(i=o.iadd(this.m)),i._forceRed(this)},k.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,On)}(Ln);var K$3=Ln.exports;const jn="bignumber/5.7.0";var Rr=K$3.BN;const Ae$1=new L$6(jn),wi={},Qn=9007199254740991;function C0(e){return null!=e&&(V$3.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||Qt$1(e)||"bigint"==typeof e||ir$1(e))}let Jn=!1,V$3=class e{constructor(e,t){e!==wi&&Ae$1.throwError("cannot call constructor directly; use BigNumber.from",L$6.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Lt$1(j$4(this).fromTwos(e))}toTwos(e){return Lt$1(j$4(this).toTwos(e))}abs(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}add(e){return Lt$1(j$4(this).add(j$4(e)))}sub(e){return Lt$1(j$4(this).sub(j$4(e)))}div(t){return e.from(t).isZero()&&Wt$2("division-by-zero","div"),Lt$1(j$4(this).div(j$4(t)))}mul(e){return Lt$1(j$4(this).mul(j$4(e)))}mod(e){const t=j$4(e);return t.isNeg()&&Wt$2("division-by-zero","mod"),Lt$1(j$4(this).umod(t))}pow(e){const t=j$4(e);return t.isNeg()&&Wt$2("negative-power","pow"),Lt$1(j$4(this).pow(t))}and(e){const t=j$4(e);return(this.isNegative()||t.isNeg())&&Wt$2("unbound-bitwise-result","and"),Lt$1(j$4(this).and(t))}or(e){const t=j$4(e);return(this.isNegative()||t.isNeg())&&Wt$2("unbound-bitwise-result","or"),Lt$1(j$4(this).or(t))}xor(e){const t=j$4(e);return(this.isNegative()||t.isNeg())&&Wt$2("unbound-bitwise-result","xor"),Lt$1(j$4(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Wt$2("negative-width","mask"),Lt$1(j$4(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Wt$2("negative-width","shl"),Lt$1(j$4(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Wt$2("negative-width","shr"),Lt$1(j$4(this).shrn(e))}eq(e){return j$4(this).eq(j$4(e))}lt(e){return j$4(this).lt(j$4(e))}lte(e){return j$4(this).lte(j$4(e))}gt(e){return j$4(this).gt(j$4(e))}gte(e){return j$4(this).gte(j$4(e))}isNegative(){return"-"===this._hex[0]}isZero(){return j$4(this).isZero()}toNumber(){try{return j$4(this).toNumber()}catch{Wt$2("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Ae$1.throwError("this platform does not support BigInt",L$6.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Jn||(Jn=!0,Ae$1.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Ae$1.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",L$6.errors.UNEXPECTED_ARGUMENT,{}):Ae$1.throwError("BigNumber.toString does not accept parameters",L$6.errors.UNEXPECTED_ARGUMENT,{})),j$4(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof e)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new e(wi,vr(t)):t.match(/^-?[0-9]+$/)?new e(wi,vr(new Rr(t))):Ae$1.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Wt$2("underflow","BigNumber.from",t),(t>=Qn||t<=-Qn)&&Wt$2("overflow","BigNumber.from",t),e.from(String(t));const r=t;if("bigint"==typeof r)return e.from(r.toString());if(ir$1(r))return e.from(Kt$1(r));if(r)if(r.toHexString){const t=r.toHexString();if("string"==typeof t)return e.from(t)}else{let t=r._hex;if(null==t&&"BigNumber"===r.type&&(t=r.hex),"string"==typeof t&&(Qt$1(t)||"-"===t[0]&&Qt$1(t.substring(1))))return e.from(t)}return Ae$1.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(e){return!(!e||!e._isBigNumber)}};function vr(e){if("string"!=typeof e)return vr(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&Ae$1.throwArgumentError("invalid hex","value",e),"0x00"===(e=vr(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function Lt$1(e){return V$3.from(vr(e))}function j$4(e){const t=V$3.from(e).toHexString();return"-"===t[0]?new Rr("-"+t.substring(3),16):new Rr(t.substring(2),16)}function Wt$2(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),Ae$1.throwError(e,L$6.errors.NUMERIC_FAULT,n)}function R0(e){return new Rr(e,36).toString(16)}const Ht$1=new L$6(jn),mr$1={},Gn=V$3.from(0),Yn=V$3.from(-1);function Vn(e,t,r,n){const o={fault:t,operation:r};return void 0!==n&&(o.value=n),Ht$1.throwError(e,L$6.errors.NUMERIC_FAULT,o)}let gr="0";for(;gr.length<256;)gr+=gr;function xi(e){if("number"!=typeof e)try{e=V$3.from(e).toNumber()}catch{}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+gr.substring(0,e):Ht$1.throwArgumentError("invalid decimal size","decimals",e)}function Mi(e,t){null==t&&(t=0);const r=xi(t),n=(e=V$3.from(e)).lt(Gn);n&&(e=e.mul(Yn));let o=e.mod(r).toString();for(;o.length<r.length-1;)o="0"+o;o=o.match(/^([0-9]*[1-9]|0)(0*)/)[1];const i=e.div(r).toString();return e=1===r.length?i:i+"."+o,n&&(e="-"+e),e}function be$1(e,t){null==t&&(t=0);const r=xi(t);("string"!=typeof e||!e.match(/^-?[0-9.]+$/))&&Ht$1.throwArgumentError("invalid decimal value","value",e);const n="-"===e.substring(0,1);n&&(e=e.substring(1)),"."===e&&Ht$1.throwArgumentError("missing value","value",e);const o=e.split(".");o.length>2&&Ht$1.throwArgumentError("too many decimal points","value",e);let i=o[0],s=o[1];for(i||(i="0"),s||(s="0");"0"===s[s.length-1];)s=s.substring(0,s.length-1);for(s.length>r.length-1&&Vn("fractional component exceeds decimals","underflow","parseFixed"),""===s&&(s="0");s.length<r.length-1;)s+="0";const a=V$3.from(i),c=V$3.from(s);let u=a.mul(r).add(c);return n&&(u=u.mul(Yn)),u}let dr$1=class e{constructor(e,t,r,n){e!==mr$1&&Ht$1.throwError("cannot use FixedFormat constructor; use FixedFormat.from",L$6.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=r,this.decimals=n,this.name=(t?"":"u")+"fixed"+String(r)+"x"+String(n),this._multiplier=xi(n),Object.freeze(this)}static from(t){if(t instanceof e)return t;"number"==typeof t&&(t=`fixed128x${t}`);let r=!0,n=128,o=18;if("string"==typeof t){if("fixed"!==t)if("ufixed"===t)r=!1;else{const e=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);e||Ht$1.throwArgumentError("invalid fixed format","format",t),r="u"!==e[1],n=parseInt(e[2]),o=parseInt(e[3])}}else if(t){const e=(e,r,n)=>null==t[e]?n:(typeof t[e]!==r&&Ht$1.throwArgumentError("invalid fixed format ("+e+" not "+r+")","format."+e,t[e]),t[e]);r=e("signed","boolean",r),n=e("width","number",n),o=e("decimals","number",o)}return n%8&&Ht$1.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),o>80&&Ht$1.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",o),new e(mr$1,r,n,o)}},Ut$1=class e{constructor(e,t,r,n){e!==mr$1&&Ht$1.throwError("cannot use FixedNumber constructor; use FixedNumber.from",L$6.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&Ht$1.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(t){this._checkFormat(t);const r=be$1(this._value,this.format.decimals),n=be$1(t._value,t.format.decimals);return e.fromValue(r.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const r=be$1(this._value,this.format.decimals),n=be$1(t._value,t.format.decimals);return e.fromValue(r.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const r=be$1(this._value,this.format.decimals),n=be$1(t._value,t.format.decimals);return e.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const r=be$1(this._value,this.format.decimals),n=be$1(t._value,t.format.decimals);return e.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let r=e.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(Wn.toFormat(r.format))),r}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let r=e.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(Wn.toFormat(r.format))),r}round(t){null==t&&(t=0);const r=this.toString().split(".");if(1===r.length&&r.push("0"),(t<0||t>80||t%1)&&Ht$1.throwArgumentError("invalid decimal count","decimals",t),r[1].length<=t)return this;const n=e.from("1"+gr.substring(0,t),this.format),o=O0.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(o).floor().divUnsafe(n)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){if(null==e)return this._hex;e%8&&Ht$1.throwArgumentError("invalid byte width","width",e);return oe$3(V$3.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return e.fromString(this._value,t)}static fromValue(t,r,n){return null==n&&null!=r&&!C0(r)&&(n=r,r=null),null==r&&(r=0),null==n&&(n="fixed"),e.fromString(Mi(t,r),dr$1.from(n))}static fromString(t,r){null==r&&(r="fixed");const n=dr$1.from(r),o=be$1(t,n.decimals);!n.signed&&o.lt(Gn)&&Vn("unsigned value cannot be negative","overflow","value",t);let i=null;n.signed?i=o.toTwos(n.width).toHexString():(i=o.toHexString(),i=oe$3(i,n.width/8));const s=Mi(o,n.decimals);return new e(mr$1,i,s,n)}static fromBytes(t,r){null==r&&(r="fixed");const n=dr$1.from(r);if(Ot$1(t).length>n.width/8)throw new Error("overflow");let o=V$3.from(t);n.signed&&(o=o.fromTwos(n.width));const i=o.toTwos((n.signed?0:1)+n.width).toHexString(),s=Mi(o,n.decimals);return new e(mr$1,i,s,n)}static from(t,r){if("string"==typeof t)return e.fromString(t,r);if(ir$1(t))return e.fromBytes(t,r);try{return e.fromValue(t,0,r)}catch(n){if(n.code!==L$6.errors.INVALID_ARGUMENT)throw n}return Ht$1.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}};const Wn=Ut$1.from(1),O0=Ut$1.from("0.5"),P0="strings/5.7.0",Xn=new L$6(P0);var Or,nr$1;function Ei(e,t=Or.current){t!=Or.current&&(Xn.checkNormalize(),e=e.normalize(t));let r=[];for(let n=0;n<e.length;n++){const t=e.charCodeAt(n);if(t<128)r.push(t);else if(t<2048)r.push(t>>6|192),r.push(63&t|128);else if(55296==(64512&t)){n++;const o=e.charCodeAt(n);if(n>=e.length||56320!=(64512&o))throw new Error("invalid utf-8 string");const i=65536+((1023&t)<<10)+(1023&o);r.push(i>>18|240),r.push(i>>12&63|128),r.push(i>>6&63|128),r.push(63&i|128)}else r.push(t>>12|224),r.push(t>>6&63|128),r.push(63&t|128)}return Ot$1(r)}function T0(e){if(e.length%4!=0)throw new Error("bad data");let t=[];for(let r=0;r<e.length;r+=4)t.push(parseInt(e.substring(r,r+4),16));return t}function Si(e,t){t||(t=function(e){return[parseInt(e,16)]});let r=0,n={};return e.split(",").forEach((e=>{let o=e.split(":");r+=parseInt(o[0],16),n[r]=t(o[1])})),n}function $n(e){let t=0;return e.split(",").map((e=>{let r=e.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=t+parseInt(r[0],16);return t=parseInt(r[1],16),{l:n,h:t}}))}function U0(e){e=atob(e);const t=[];for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));return Ot$1(t)}function ef(e,t){null==t&&(t=1);const r=[],n=r.forEach,o=function(e,t){n.call(e,(function(e){t>0&&Array.isArray(e)?o(e,t-1):r.push(e)}))};return o(e,t),r}function k0(e){const t={};for(let r=0;r<e.length;r++){const n=e[r];t[n[0]]=n[1]}return t}function q0(e){let t=0;function r(){return e[t++]<<8|e[t++]}let n=r(),o=1,i=[0,1];for(let v=1;v<n;v++)i.push(o+=r());let s=r(),a=t;t+=s;let c=0,u=0;function l(){return 0==c&&(u=u<<8|e[t++],c=8),u>>--c&1}const d=Math.pow(2,31),h=d>>>1,f=h>>1,p=d-1;let m=0;for(let v=0;v<31;v++)m=m<<1|l();let y=[],g=0,b=d;for(;;){let e=Math.floor(((m-g+1)*o-1)/b),t=0,r=n;for(;r-t>1;){let n=t+r>>>1;e<i[n]?r=n:t=n}if(0==t)break;y.push(t);let s=g+Math.floor(b*i[t]/o),a=g+Math.floor(b*i[t+1]/o)-1;for(;!((s^a)&h);)m=m<<1&p|l(),s=s<<1&p,a=a<<1&p|1;for(;s&~a&f;)m=m&h|m<<1&p>>>1|l(),s=s<<1^h,a=(a^h)<<1|h|1;g=s,b=1+a-s}let w=n-4;return y.map((t=>{switch(t-w){case 3:return w+65792+(e[a++]<<16|e[a++]<<8|e[a++]);case 2:return w+256+(e[a++]<<8|e[a++]);case 1:return w+e[a++];default:return t-1}}))}function K0(e){let t=0;return()=>e[t++]}function H0(e){return K0(q0(e))}function z0(e){return 1&e?~e>>1:e>>1}function L0(e,t){let r=Array(e);for(let n=0;n<e;n++)r[n]=1+t();return r}function rf(e,t){let r=Array(e);for(let n=0,o=-1;n<e;n++)r[n]=o+=1+t();return r}function j0(e,t){let r=Array(e);for(let n=0,o=0;n<e;n++)r[n]=o+=z0(t());return r}function Pr(e,t){let r=rf(e(),e),n=e(),o=rf(n,e),i=L0(n,e);for(let s=0;s<n;s++)for(let e=0;e<i[s];e++)r.push(o[s]+e);return t?r.map((e=>t[e])):r}function Q0(e){let t=[];for(;;){let r=e();if(0==r)break;t.push(G0(r,e))}for(;;){let r=e()-1;if(r<0)break;t.push(Y0(r,e))}return k0(ef(t))}function J0(e){let t=[];for(;;){let r=e();if(0==r)break;t.push(r)}return t}function nf(e,t,r){let n=Array(e).fill(void 0).map((()=>[]));for(let o=0;o<t;o++)j0(e,r).forEach(((e,t)=>n[t].push(e)));return n}function G0(e,t){let r=1+t(),n=t(),o=J0(t);return ef(nf(o.length,1+e,t).map(((e,t)=>{const i=e[0],s=e.slice(1);return Array(o[t]).fill(void 0).map(((e,t)=>{let o=t*n;return[i+t*r,s.map((e=>e+o))]}))})))}function Y0(e,t){return nf(1+t(),1+e,t).map((e=>[e[0],e.slice(1)]))}function V0(e){let t=Pr(e).sort(((e,t)=>e-t));return function r(){let n=[];for(;;){let o=Pr(e,t);if(0==o.length)break;n.push({set:new Set(o),node:r()})}n.sort(((e,t)=>t.set.size-e.set.size));let o=e(),i=o%3;o=o/3|0;let s=!!(1&o);return o>>=1,{branches:n,valid:i,fe0f:s,save:1==o,check:2==o}}()}function W0(){return H0(U0("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(Or||(Or={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(nr$1||(nr$1={})),$n("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((e=>parseInt(e,16))),Si("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),Si("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),Si("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",T0),$n("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");const Dr=W0();new Set(Pr(Dr)),new Set(Pr(Dr)),Q0(Dr),V0(Dr);const X0=new Uint8Array(32);X0.fill(0);const Z0="Ethereum Signed Message:\n";function ff(e){return"string"==typeof e&&(e=Ei(e)),yi(E0([Ei(Z0),Ei(String(e.length)),e]))}const ts$1="address/5.7.0",Ar=new L$6(ts$1);function of(e){Qt$1(e,20)||Ar.throwArgumentError("invalid address","address",e);const t=(e=e.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let o=0;o<40;o++)r[o]=t[o].charCodeAt(0);const n=Ot$1(yi(r));for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&(t[o]=t[o].toUpperCase()),(15&n[o>>1])>=8&&(t[o+1]=t[o+1].toUpperCase());return"0x"+t.join("")}const es$2=9007199254740991;function rs$1(e){return Math.log10?Math.log10(e):Math.log(e)/Math.LN10}const Ni={};for(let Br=0;Br<10;Br++)Ni[String(Br)]=String(Br);for(let Br=0;Br<26;Br++)Ni[String.fromCharCode(65+Br)]=String(10+Br);const sf=Math.floor(rs$1(es$2));function is$1(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((e=>Ni[e])).join("");for(;t.length>=sf;){let e=t.substring(0,sf);t=parseInt(e,10)%97+t.substring(e.length)}let r=String(98-parseInt(t,10)%97);for(;r.length<2;)r="0"+r;return r}function ns$1(e){let t=null;if("string"!=typeof e&&Ar.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=of(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&Ar.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==is$1(e)&&Ar.throwArgumentError("bad icap checksum","address",e),t=R0(e.substring(4));t.length<40;)t="0"+t;t=of("0x"+t)}else Ar.throwArgumentError("invalid address","address",e);return t}function br(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}const os=new Uint8Array(32);os.fill(0),V$3.from(-1);const ss$1=V$3.from(0),as=V$3.from(1);V$3.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),oe$3(as.toHexString(),32),oe$3(ss$1.toHexString(),32);var se$2={},Q$3={},yr=af;function af(e,t){if(!e)throw new Error(t||"Assertion failed")}af.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var Ii={exports:{}};"function"==typeof Object.create?Ii.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Ii.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}};var us=yr,hs=Ii.exports;function cs(e,t){return!(55296!=(64512&e.charCodeAt(t))||t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1))}function ls(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),o=0;o<e.length;o+=2)r.push(parseInt(e[o]+e[o+1],16))}else for(var n=0,o=0;o<e.length;o++){var i=e.charCodeAt(o);i<128?r[n++]=i:i<2048?(r[n++]=i>>6|192,r[n++]=63&i|128):cs(e,o)?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++o)),r[n++]=i>>18|240,r[n++]=i>>12&63|128,r[n++]=i>>6&63|128,r[n++]=63&i|128):(r[n++]=i>>12|224,r[n++]=i>>6&63|128,r[n++]=63&i|128)}else for(o=0;o<e.length;o++)r[o]=0|e[o];return r}function ds(e){for(var t="",r=0;r<e.length;r++)t+=hf(e[r].toString(16));return t}function uf(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function ps(e,t){for(var r="",n=0;n<e.length;n++){var o=e[n];"little"===t&&(o=uf(o)),r+=cf(o.toString(16))}return r}function hf(e){return 1===e.length?"0"+e:e}function cf(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}function vs(e,t,r,n){var o=r-t;us(o%4==0);for(var i=new Array(o/4),s=0,a=t;s<i.length;s++,a+=4){var c;c="big"===n?e[a]<<24|e[a+1]<<16|e[a+2]<<8|e[a+3]:e[a+3]<<24|e[a+2]<<16|e[a+1]<<8|e[a],i[s]=c>>>0}return i}function ms(e,t){for(var r=new Array(4*e.length),n=0,o=0;n<e.length;n++,o+=4){var i=e[n];"big"===t?(r[o]=i>>>24,r[o+1]=i>>>16&255,r[o+2]=i>>>8&255,r[o+3]=255&i):(r[o+3]=i>>>24,r[o+2]=i>>>16&255,r[o+1]=i>>>8&255,r[o]=255&i)}return r}function gs(e,t){return e>>>t|e<<32-t}function As(e,t){return e<<t|e>>>32-t}function bs(e,t){return e+t>>>0}function ys(e,t,r){return e+t+r>>>0}function ws(e,t,r,n){return e+t+r+n>>>0}function xs(e,t,r,n,o){return e+t+r+n+o>>>0}function Ms(e,t,r,n){var o=e[t],i=n+e[t+1]>>>0,s=(i<n?1:0)+r+o;e[t]=s>>>0,e[t+1]=i}function Es(e,t,r,n){return(t+n>>>0<t?1:0)+e+r>>>0}function Ss(e,t,r,n){return t+n>>>0}function Ns(e,t,r,n,o,i,s,a){var c=0,u=t;return c+=(u=u+n>>>0)<t?1:0,c+=(u=u+i>>>0)<i?1:0,e+r+o+s+(c+=(u=u+a>>>0)<a?1:0)>>>0}function Is(e,t,r,n,o,i,s,a){return t+n+i+a>>>0}function _s(e,t,r,n,o,i,s,a,c,u){var l=0,d=t;return l+=(d=d+n>>>0)<t?1:0,l+=(d=d+i>>>0)<i?1:0,l+=(d=d+a>>>0)<a?1:0,e+r+o+s+c+(l+=(d=d+u>>>0)<u?1:0)>>>0}function Bs(e,t,r,n,o,i,s,a,c,u){return t+n+i+a+u>>>0}function Cs(e,t,r){return(t<<32-r|e>>>r)>>>0}function Rs(e,t,r){return(e<<32-r|t>>>r)>>>0}function Os(e,t,r){return e>>>r}function Ps(e,t,r){return(e<<32-r|t>>>r)>>>0}Q$3.inherits=hs,Q$3.toArray=ls,Q$3.toHex=ds,Q$3.htonl=uf,Q$3.toHex32=ps,Q$3.zero2=hf,Q$3.zero8=cf,Q$3.join32=vs,Q$3.split32=ms,Q$3.rotr32=gs,Q$3.rotl32=As,Q$3.sum32=bs,Q$3.sum32_3=ys,Q$3.sum32_4=ws,Q$3.sum32_5=xs,Q$3.sum64=Ms,Q$3.sum64_hi=Es,Q$3.sum64_lo=Ss,Q$3.sum64_4_hi=Ns,Q$3.sum64_4_lo=Is,Q$3.sum64_5_hi=_s,Q$3.sum64_5_lo=Bs,Q$3.rotr64_hi=Cs,Q$3.rotr64_lo=Rs,Q$3.shr64_hi=Os,Q$3.shr64_lo=Ps;var fr$1={},lf=Q$3,Ds=yr;function Fr(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}fr$1.BlockHash=Fr,Fr.prototype.update=function(e,t){if(e=lf.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=lf.join32(e,0,e.length-r,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this},Fr.prototype.digest=function(e){return this.update(this._pad()),Ds(null===this.pending),this._digest(e)},Fr.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,n=new Array(r+this.padLength);n[0]=128;for(var o=1;o<r;o++)n[o]=0;if(e<<=3,"big"===this.endian){for(var i=8;i<this.padLength;i++)n[o++]=0;n[o++]=0,n[o++]=0,n[o++]=0,n[o++]=0,n[o++]=e>>>24&255,n[o++]=e>>>16&255,n[o++]=e>>>8&255,n[o++]=255&e}else for(n[o++]=255&e,n[o++]=e>>>8&255,n[o++]=e>>>16&255,n[o++]=e>>>24&255,n[o++]=0,n[o++]=0,n[o++]=0,n[o++]=0,i=8;i<this.padLength;i++)n[o++]=0;return n};var or={},ae$1={},Fs=Q$3,ue$1=Fs.rotr32;function Ts(e,t,r,n){return 0===e?df(t,r,n):1===e||3===e?vf(t,r,n):2===e?pf(t,r,n):void 0}function df(e,t,r){return e&t^~e&r}function pf(e,t,r){return e&t^e&r^t&r}function vf(e,t,r){return e^t^r}function Us(e){return ue$1(e,2)^ue$1(e,13)^ue$1(e,22)}function ks(e){return ue$1(e,6)^ue$1(e,11)^ue$1(e,25)}function qs(e){return ue$1(e,7)^ue$1(e,18)^e>>>3}function Ks(e){return ue$1(e,17)^ue$1(e,19)^e>>>10}ae$1.ft_1=Ts,ae$1.ch32=df,ae$1.maj32=pf,ae$1.p32=vf,ae$1.s0_256=Us,ae$1.s1_256=ks,ae$1.g0_256=qs,ae$1.g1_256=Ks;var sr$1=Q$3,Hs=fr$1,zs=ae$1,_i=sr$1.rotl32,wr=sr$1.sum32,Ls=sr$1.sum32_5,js=zs.ft_1,mf=Hs.BlockHash,Qs=[1518500249,1859775393,2400959708,3395469782];function he$1(){if(!(this instanceof he$1))return new he$1;mf.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}sr$1.inherits(he$1,mf);var Js=he$1;he$1.blockSize=512,he$1.outSize=160,he$1.hmacStrength=80,he$1.padLength=64,he$1.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=_i(r[n-3]^r[n-8]^r[n-14]^r[n-16],1);var o=this.h[0],i=this.h[1],s=this.h[2],a=this.h[3],c=this.h[4];for(n=0;n<r.length;n++){var u=~~(n/20),l=Ls(_i(o,5),js(u,i,s,a),c,r[n],Qs[u]);c=a,a=s,s=_i(i,30),i=o,o=l}this.h[0]=wr(this.h[0],o),this.h[1]=wr(this.h[1],i),this.h[2]=wr(this.h[2],s),this.h[3]=wr(this.h[3],a),this.h[4]=wr(this.h[4],c)},he$1.prototype._digest=function(e){return"hex"===e?sr$1.toHex32(this.h,"big"):sr$1.split32(this.h,"big")};var ar=Q$3,Gs=fr$1,ur=ae$1,Ys=yr,ie$2=ar.sum32,Vs=ar.sum32_4,Ws=ar.sum32_5,Xs=ur.ch32,Zs=ur.maj32,$s=ur.s0_256,ta=ur.s1_256,ea=ur.g0_256,ra=ur.g1_256,gf=Gs.BlockHash,ia=[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 ce$1(){if(!(this instanceof ce$1))return new ce$1;gf.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=ia,this.W=new Array(64)}ar.inherits(ce$1,gf);var Af=ce$1;ce$1.blockSize=512,ce$1.outSize=256,ce$1.hmacStrength=192,ce$1.padLength=64,ce$1.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=Vs(ra(r[n-2]),r[n-7],ea(r[n-15]),r[n-16]);var o=this.h[0],i=this.h[1],s=this.h[2],a=this.h[3],c=this.h[4],u=this.h[5],l=this.h[6],d=this.h[7];for(Ys(this.k.length===r.length),n=0;n<r.length;n++){var h=Ws(d,ta(c),Xs(c,u,l),this.k[n],r[n]),f=ie$2($s(o),Zs(o,i,s));d=l,l=u,u=c,c=ie$2(a,h),a=s,s=i,i=o,o=ie$2(h,f)}this.h[0]=ie$2(this.h[0],o),this.h[1]=ie$2(this.h[1],i),this.h[2]=ie$2(this.h[2],s),this.h[3]=ie$2(this.h[3],a),this.h[4]=ie$2(this.h[4],c),this.h[5]=ie$2(this.h[5],u),this.h[6]=ie$2(this.h[6],l),this.h[7]=ie$2(this.h[7],d)},ce$1.prototype._digest=function(e){return"hex"===e?ar.toHex32(this.h,"big"):ar.split32(this.h,"big")};var Bi=Q$3,bf=Af;function ye$1(){if(!(this instanceof ye$1))return new ye$1;bf.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Bi.inherits(ye$1,bf);var na=ye$1;ye$1.blockSize=512,ye$1.outSize=224,ye$1.hmacStrength=192,ye$1.padLength=64,ye$1.prototype._digest=function(e){return"hex"===e?Bi.toHex32(this.h.slice(0,7),"big"):Bi.split32(this.h.slice(0,7),"big")};var jt$1=Q$3,fa$1=fr$1,oa=yr,le$1=jt$1.rotr64_hi,de$2=jt$1.rotr64_lo,yf=jt$1.shr64_hi,wf=jt$1.shr64_lo,Be$2=jt$1.sum64,Ci=jt$1.sum64_hi,Ri=jt$1.sum64_lo,sa=jt$1.sum64_4_hi,aa=jt$1.sum64_4_lo,ua=jt$1.sum64_5_hi,ha=jt$1.sum64_5_lo,xf=fa$1.BlockHash,ca=[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 ne$3(){if(!(this instanceof ne$3))return new ne$3;xf.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=ca,this.W=new Array(160)}jt$1.inherits(ne$3,xf);var Mf=ne$3;function la(e,t,r,n,o){var i=e&r^~e&o;return i<0&&(i+=4294967296),i}function da(e,t,r,n,o,i){var s=t&n^~t&i;return s<0&&(s+=4294967296),s}function pa(e,t,r,n,o){var i=e&r^e&o^r&o;return i<0&&(i+=4294967296),i}function va(e,t,r,n,o,i){var s=t&n^t&i^n&i;return s<0&&(s+=4294967296),s}function ma(e,t){var r=le$1(e,t,28)^le$1(t,e,2)^le$1(t,e,7);return r<0&&(r+=4294967296),r}function ga(e,t){var r=de$2(e,t,28)^de$2(t,e,2)^de$2(t,e,7);return r<0&&(r+=4294967296),r}function Aa(e,t){var r=le$1(e,t,14)^le$1(e,t,18)^le$1(t,e,9);return r<0&&(r+=4294967296),r}function ba(e,t){var r=de$2(e,t,14)^de$2(e,t,18)^de$2(t,e,9);return r<0&&(r+=4294967296),r}function ya(e,t){var r=le$1(e,t,1)^le$1(e,t,8)^yf(e,t,7);return r<0&&(r+=4294967296),r}function wa(e,t){var r=de$2(e,t,1)^de$2(e,t,8)^wf(e,t,7);return r<0&&(r+=4294967296),r}function xa(e,t){var r=le$1(e,t,19)^le$1(t,e,29)^yf(e,t,6);return r<0&&(r+=4294967296),r}function Ma(e,t){var r=de$2(e,t,19)^de$2(t,e,29)^wf(e,t,6);return r<0&&(r+=4294967296),r}ne$3.blockSize=1024,ne$3.outSize=512,ne$3.hmacStrength=192,ne$3.padLength=128,ne$3.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var o=xa(r[n-4],r[n-3]),i=Ma(r[n-4],r[n-3]),s=r[n-14],a=r[n-13],c=ya(r[n-30],r[n-29]),u=wa(r[n-30],r[n-29]),l=r[n-32],d=r[n-31];r[n]=sa(o,i,s,a,c,u,l,d),r[n+1]=aa(o,i,s,a,c,u,l,d)}},ne$3.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],o=this.h[1],i=this.h[2],s=this.h[3],a=this.h[4],c=this.h[5],u=this.h[6],l=this.h[7],d=this.h[8],h=this.h[9],f=this.h[10],p=this.h[11],m=this.h[12],y=this.h[13],g=this.h[14],b=this.h[15];oa(this.k.length===r.length);for(var w=0;w<r.length;w+=2){var v=g,_=b,A=Aa(d,h),I=ba(d,h),T=la(d,h,f,p,m),k=da(d,h,f,p,m,y),S=this.k[w],E=this.k[w+1],$=r[w],C=r[w+1],R=ua(v,_,A,I,T,k,S,E,$,C),O=ha(v,_,A,I,T,k,S,E,$,C);v=ma(n,o),_=ga(n,o),A=pa(n,o,i,s,a),I=va(n,o,i,s,a,c);var N=Ci(v,_,A,I),M=Ri(v,_,A,I);g=m,b=y,m=f,y=p,f=d,p=h,d=Ci(u,l,R,O),h=Ri(l,l,R,O),u=a,l=c,a=i,c=s,i=n,s=o,n=Ci(R,O,N,M),o=Ri(R,O,N,M)}Be$2(this.h,0,n,o),Be$2(this.h,2,i,s),Be$2(this.h,4,a,c),Be$2(this.h,6,u,l),Be$2(this.h,8,d,h),Be$2(this.h,10,f,p),Be$2(this.h,12,m,y),Be$2(this.h,14,g,b)},ne$3.prototype._digest=function(e){return"hex"===e?jt$1.toHex32(this.h,"big"):jt$1.split32(this.h,"big")};var Oi=Q$3,Ef=Mf;function we$1(){if(!(this instanceof we$1))return new we$1;Ef.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Oi.inherits(we$1,Ef);var Ea=we$1;we$1.blockSize=1024,we$1.outSize=384,we$1.hmacStrength=192,we$1.padLength=128,we$1.prototype._digest=function(e){return"hex"===e?Oi.toHex32(this.h.slice(0,12),"big"):Oi.split32(this.h.slice(0,12),"big")},or.sha1=Js,or.sha224=na,or.sha256=Af,or.sha384=Ea,or.sha512=Mf;var Sf={},Xe$1=Q$3,Sa=fr$1,Tr=Xe$1.rotl32,Nf=Xe$1.sum32,xr=Xe$1.sum32_3,If=Xe$1.sum32_4,_f=Sa.BlockHash;function pe(){if(!(this instanceof pe))return new pe;_f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function Bf(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function Na(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function Ia(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}Xe$1.inherits(pe,_f),Sf.ripemd160=pe,pe.blockSize=512,pe.outSize=160,pe.hmacStrength=192,pe.padLength=64,pe.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],o=this.h[2],i=this.h[3],s=this.h[4],a=r,c=n,u=o,l=i,d=s,h=0;h<80;h++){var f=Nf(Tr(If(r,Bf(h,n,o,i),e[_a[h]+t],Na(h)),Ca[h]),s);r=s,s=i,i=Tr(o,10),o=n,n=f,f=Nf(Tr(If(a,Bf(79-h,c,u,l),e[Ba[h]+t],Ia(h)),Ra[h]),d),a=d,d=l,l=Tr(u,10),u=c,c=f}f=xr(this.h[1],o,l),this.h[1]=xr(this.h[2],i,d),this.h[2]=xr(this.h[3],s,a),this.h[3]=xr(this.h[4],r,c),this.h[4]=xr(this.h[0],n,u),this.h[0]=f},pe.prototype._digest=function(e){return"hex"===e?Xe$1.toHex32(this.h,"little"):Xe$1.split32(this.h,"little")};var _a=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],Ba=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Ca=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Ra=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],Oa=Q$3,Pa=yr;function hr$1(e,t,r){if(!(this instanceof hr$1))return new hr$1(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(Oa.toArray(t,r))}var Da=hr$1;function cr$1(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return Fa(e,t??r.path)}},r.exports),r.exports}function Fa(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}hr$1.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),Pa(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},hr$1.prototype.update=function(e,t){return this.inner.update(e,t),this},hr$1.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(e){var t=e;t.utils=Q$3,t.common=fr$1,t.sha=or,t.ripemd=Sf,t.hmac=Da,t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160}(se$2);var Pi=Cf;function Cf(e,t){if(!e)throw new Error(t||"Assertion failed")}Cf.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var fe$2=cr$1((function(e,t){var r=t;function n(e){return 1===e.length?"0"+e:e}function o(e){for(var t="",r=0;r<e.length;r++)t+=n(e[r].toString(16));return t}r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(n=0;n<e.length;n++){var o=e.charCodeAt(n),i=o>>8,s=255&o;i?r.push(i,s):r.push(s)}return r},r.zero2=n,r.toHex=o,r.encode=function(e,t){return"hex"===t?o(e):e}})),Jt$2=cr$1((function(e,t){var r=t;r.assert=Pi,r.toArray=fe$2.toArray,r.zero2=fe$2.zero2,r.toHex=fe$2.toHex,r.encode=fe$2.encode,r.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var o=1<<t+1,i=e.clone(),s=0;s<n.length;s++){var a,c=i.andln(o-1);i.isOdd()?(a=c>(o>>1)-1?(o>>1)-c:c,i.isubn(a)):a=0,n[s]=a,i.iushrn(1)}return n},r.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,o=0,i=0;e.cmpn(-o)>0||t.cmpn(-i)>0;){var s,a,c=e.andln(3)+o&3,u=t.andln(3)+i&3;3===c&&(c=-1),3===u&&(u=-1),1&c?s=3!==(n=e.andln(7)+o&7)&&5!==n||2!==u?c:-c:s=0,r[0].push(s),1&u?a=3!==(n=t.andln(7)+i&7)&&5!==n||2!==c?u:-u:a=0,r[1].push(a),2*o===s+1&&(o=1-o),2*i===a+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return r},r.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(e){return"string"==typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new K$3(e,"hex","le")}})),Ur=Jt$2.getNAF,Ta=Jt$2.getJSF,kr=Jt$2.assert;function Ce$1(e,t){this.type=e,this.p=new K$3(t.p,16),this.red=t.prime?K$3.red(t.prime):K$3.mont(this.p),this.zero=new K$3(0).toRed(this.red),this.one=new K$3(1).toRed(this.red),this.two=new K$3(2).toRed(this.red),this.n=t.n&&new K$3(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Ze$1=Ce$1;function Xt$2(e,t){this.curve=e,this.type=t,this.precomputed=null}Ce$1.prototype.point=function(){throw new Error("Not implemented")},Ce$1.prototype.validate=function(){throw new Error("Not implemented")},Ce$1.prototype._fixedNafMul=function(e,t){kr(e.precomputed);var r=e._getDoubles(),n=Ur(t,1,this._bitLength),o=(1<<r.step+1)-(r.step%2==0?2:1);o/=3;var i,s,a=[];for(i=0;i<n.length;i+=r.step){s=0;for(var c=i+r.step-1;c>=i;c--)s=(s<<1)+n[c];a.push(s)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=o;d>0;d--){for(i=0;i<a.length;i++)(s=a[i])===d?l=l.mixedAdd(r.points[i]):s===-d&&(l=l.mixedAdd(r.points[i].neg()));u=u.add(l)}return u.toP()},Ce$1.prototype._wnafMul=function(e,t){var r=4,n=e._getNAFPoints(r);r=n.wnd;for(var o=n.points,i=Ur(t,r,this._bitLength),s=this.jpoint(null,null,null),a=i.length-1;a>=0;a--){for(var c=0;a>=0&&0===i[a];a--)c++;if(a>=0&&c++,s=s.dblp(c),a<0)break;var u=i[a];kr(0!==u),s="affine"===e.type?u>0?s.mixedAdd(o[u-1>>1]):s.mixedAdd(o[-u-1>>1].neg()):u>0?s.add(o[u-1>>1]):s.add(o[-u-1>>1].neg())}return"affine"===e.type?s.toP():s},Ce$1.prototype._wnafMulAdd=function(e,t,r,n,o){var i,s,a,c=this._wnafT1,u=this._wnafT2,l=this._wnafT3,d=0;for(i=0;i<n;i++){var h=(a=t[i])._getNAFPoints(e);c[i]=h.wnd,u[i]=h.points}for(i=n-1;i>=1;i-=2){var f=i-1,p=i;if(1===c[f]&&1===c[p]){var m=[t[f],null,null,t[p]];0===t[f].y.cmp(t[p].y)?(m[1]=t[f].add(t[p]),m[2]=t[f].toJ().mixedAdd(t[p].neg())):0===t[f].y.cmp(t[p].y.redNeg())?(m[1]=t[f].toJ().mixedAdd(t[p]),m[2]=t[f].add(t[p].neg())):(m[1]=t[f].toJ().mixedAdd(t[p]),m[2]=t[f].toJ().mixedAdd(t[p].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],g=Ta(r[f],r[p]);for(d=Math.max(g[0].length,d),l[f]=new Array(d),l[p]=new Array(d),s=0;s<d;s++){var b=0|g[0][s],w=0|g[1][s];l[f][s]=y[3*(b+1)+(w+1)],l[p][s]=0,u[f]=m}}else l[f]=Ur(r[f],c[f],this._bitLength),l[p]=Ur(r[p],c[p],this._bitLength),d=Math.max(l[f].length,d),d=Math.max(l[p].length,d)}var v=this.jpoint(null,null,null),_=this._wnafT4;for(i=d;i>=0;i--){for(var A=0;i>=0;){var I=!0;for(s=0;s<n;s++)_[s]=0|l[s][i],0!==_[s]&&(I=!1);if(!I)break;A++,i--}if(i>=0&&A++,v=v.dblp(A),i<0)break;for(s=0;s<n;s++){var T=_[s];0!==T&&(T>0?a=u[s][T-1>>1]:T<0&&(a=u[s][-T-1>>1].neg()),v="affine"===a.type?v.mixedAdd(a):v.add(a))}}for(i=0;i<n;i++)u[i]=null;return o?v:v.toP()},Ce$1.BasePoint=Xt$2,Xt$2.prototype.eq=function(){throw new Error("Not implemented")},Xt$2.prototype.validate=function(){return this.curve.validate(this)},Ce$1.prototype.decodePoint=function(e,t){e=Jt$2.toArray(e,t);var r=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*r)return 6===e[0]?kr(e[e.length-1]%2==0):7===e[0]&&kr(e[e.length-1]%2==1),this.point(e.slice(1,1+r),e.slice(1+r,1+2*r));if((2===e[0]||3===e[0])&&e.length-1===r)return this.pointFromX(e.slice(1,1+r),3===e[0]);throw new Error("Unknown point format")},Xt$2.prototype.encodeCompressed=function(e){return this.encode(e,!0)},Xt$2.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},Xt$2.prototype.encode=function(e,t){return Jt$2.encode(this._encode(t),e)},Xt$2.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},Xt$2.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},Xt$2.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,o=0;o<t;o+=e){for(var i=0;i<e;i++)n=n.dbl();r.push(n)}return{step:e,points:r}},Xt$2.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1===r?null:this.dbl(),o=1;o<r;o++)t[o]=t[o-1].add(n);return{wnd:e,points:t}},Xt$2.prototype._getBeta=function(){return null},Xt$2.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t};var Di=cr$1((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}})),Ua=Jt$2.assert;function Zt$2(e){Ze$1.call(this,"short",e),this.a=new K$3(e.a,16).toRed(this.red),this.b=new K$3(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Di(Zt$2,Ze$1);var ka=Zt$2;function Ft(e,t,r,n){Ze$1.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new K$3(t,16),this.y=new K$3(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function Tt$1(e,t,r,n){Ze$1.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new K$3(0)):(this.x=new K$3(t,16),this.y=new K$3(r,16),this.z=new K$3(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Zt$2.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new K$3(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new K$3(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?r=o[0]:(r=o[1],Ua(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new K$3(e.a,16),b:new K$3(e.b,16)}})):this._getEndoBasis(r)}}},Zt$2.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:K$3.mont(e),r=new K$3(2).toRed(t).redInvm(),n=r.redNeg(),o=new K$3(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},Zt$2.prototype._getEndoBasis=function(e){for(var t,r,n,o,i,s,a,c,u,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,h=this.n.clone(),f=new K$3(1),p=new K$3(0),m=new K$3(0),y=new K$3(1),g=0;0!==d.cmpn(0);){var b=h.div(d);c=h.sub(b.mul(d)),u=m.sub(b.mul(f));var w=y.sub(b.mul(p));if(!n&&c.cmp(l)<0)t=a.neg(),r=f,n=c.neg(),o=u;else if(n&&2==++g)break;a=c,h=d,d=c,m=f,f=u,y=p,p=w}i=c.neg(),s=u;var v=n.sqr().add(o.sqr());return i.sqr().add(s.sqr()).cmp(v)>=0&&(i=t,s=r),n.negative&&(n=n.neg(),o=o.neg()),i.negative&&(i=i.neg(),s=s.neg()),[{a:n,b:o},{a:i,b:s}]},Zt$2.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],o=n.b.mul(e).divRound(this.n),i=r.b.neg().mul(e).divRound(this.n),s=o.mul(r.a),a=i.mul(n.a),c=o.mul(r.b),u=i.mul(n.b);return{k1:e.sub(s).sub(a),k2:c.add(u).neg()}},Zt$2.prototype.pointFromX=function(e,t){(e=new K$3(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(t&&!o||!t&&o)&&(n=n.redNeg()),this.point(e,n)},Zt$2.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),o=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(o).cmpn(0)},Zt$2.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,o=this._endoWnafT2,i=0;i<e.length;i++){var s=this._endoSplit(t[i]),a=e[i],c=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),c=c.neg(!0)),n[2*i]=a,n[2*i+1]=c,o[2*i]=s.k1,o[2*i+1]=s.k2}for(var u=this._wnafMulAdd(1,n,o,2*i,r),l=0;l<2*i;l++)n[l]=null,o[l]=null;return u},Di(Ft,Ze$1.BasePoint),Zt$2.prototype.point=function(e,t,r){return new Ft(this,e,t,r)},Zt$2.prototype.pointFromJSON=function(e,t){return Ft.fromJSON(this,e,t)},Ft.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var r=this.curve,n=function(e){return r.point(e.x.redMul(r.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return t}},Ft.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Ft.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function o(t){return e.point(t[0],t[1],r)}var i=t[2];return n.precomputed={beta:null,doubles:i.doubles&&{step:i.doubles.step,points:[n].concat(i.doubles.points.map(o))},naf:i.naf&&{wnd:i.naf.wnd,points:[n].concat(i.naf.points.map(o))}},n},Ft.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Ft.prototype.isInfinity=function(){return this.inf},Ft.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},Ft.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),o=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),i=o.redSqr().redISub(this.x.redAdd(this.x)),s=o.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,s)},Ft.prototype.getX=function(){return this.x.fromRed()},Ft.prototype.getY=function(){return this.y.fromRed()},Ft.prototype.mul=function(e){return e=new K$3(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Ft.prototype.mulAdd=function(e,t,r){var n=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,o):this.curve._wnafMulAdd(1,n,o,2)},Ft.prototype.jmulAdd=function(e,t,r){var n=[this,t],o=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,o,!0):this.curve._wnafMulAdd(1,n,o,2,!0)},Ft.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},Ft.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},Ft.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Di(Tt$1,Ze$1.BasePoint),Zt$2.prototype.jpoint=function(e,t,r){return new Tt$1(this,e,t,r)},Tt$1.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},Tt$1.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Tt$1.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),o=e.x.redMul(r),i=this.y.redMul(t.redMul(e.z)),s=e.y.redMul(r.redMul(this.z)),a=n.redSub(o),c=i.redSub(s);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),l=u.redMul(a),d=n.redMul(u),h=c.redSqr().redIAdd(l).redISub(d).redISub(d),f=c.redMul(d.redISub(h)).redISub(i.redMul(l)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(h,f,p)},Tt$1.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),o=this.y,i=e.y.redMul(t).redMul(this.z),s=r.redSub(n),a=o.redSub(i);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),u=c.redMul(s),l=r.redMul(c),d=a.redSqr().redIAdd(u).redISub(l).redISub(l),h=a.redMul(l.redISub(d)).redISub(o.redMul(u)),f=this.z.redMul(s);return this.curve.jpoint(d,h,f)},Tt$1.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t<e;t++)r=r.dbl();return r}var n=this.curve.a,o=this.curve.tinv,i=this.x,s=this.y,a=this.z,c=a.redSqr().redSqr(),u=s.redAdd(s);for(t=0;t<e;t++){var l=i.redSqr(),d=u.redSqr(),h=d.redSqr(),f=l.redAdd(l).redIAdd(l).redIAdd(n.redMul(c)),p=i.redMul(d),m=f.redSqr().redISub(p.redAdd(p)),y=p.redISub(m),g=f.redMul(y);g=g.redIAdd(g).redISub(h);var b=u.redMul(a);t+1<e&&(c=c.redMul(h)),i=m,a=b,u=g}return this.curve.jpoint(i,u.redMul(o),a)},Tt$1.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Tt$1.prototype._zeroDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),i=o.redSqr(),s=this.x.redAdd(o).redSqr().redISub(n).redISub(i);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n),c=a.redSqr().redISub(s).redISub(s),u=i.redIAdd(i);u=(u=u.redIAdd(u)).redIAdd(u),e=c,t=a.redMul(s.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),d=this.y.redSqr(),h=d.redSqr(),f=this.x.redAdd(d).redSqr().redISub(l).redISub(h);f=f.redIAdd(f);var p=l.redAdd(l).redIAdd(l),m=p.redSqr(),y=h.redIAdd(h);y=(y=y.redIAdd(y)).redIAdd(y),e=m.redISub(f).redISub(f),t=p.redMul(f.redISub(e)).redISub(y),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(e,t,r)},Tt$1.prototype._threeDbl=function(){var e,t,r;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),i=o.redSqr(),s=this.x.redAdd(o).redSqr().redISub(n).redISub(i);s=s.redIAdd(s);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),c=a.redSqr().redISub(s).redISub(s);e=c;var u=i.redIAdd(i);u=(u=u.redIAdd(u)).redIAdd(u),t=a.redMul(s.redISub(c)).redISub(u),r=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),d=this.y.redSqr(),h=this.x.redMul(d),f=this.x.redSub(l).redMul(this.x.redAdd(l));f=f.redAdd(f).redIAdd(f);var p=h.redIAdd(h),m=(p=p.redIAdd(p)).redAdd(p);e=f.redSqr().redISub(m),r=this.y.redAdd(this.z).redSqr().redISub(d).redISub(l);var y=d.redSqr();y=(y=(y=y.redIAdd(y)).redIAdd(y)).redIAdd(y),t=f.redMul(p.redISub(e)).redISub(y)}return this.curve.jpoint(e,t,r)},Tt$1.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,o=n.redSqr().redSqr(),i=t.redSqr(),s=r.redSqr(),a=i.redAdd(i).redIAdd(i).redIAdd(e.redMul(o)),c=t.redAdd(t),u=(c=c.redIAdd(c)).redMul(s),l=a.redSqr().redISub(u.redAdd(u)),d=u.redISub(l),h=s.redSqr();h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var f=a.redMul(d).redISub(h),p=r.redAdd(r).redMul(n);return this.curve.jpoint(l,f,p)},Tt$1.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),o=e.redAdd(e).redIAdd(e),i=o.redSqr(),s=this.x.redAdd(t).redSqr().redISub(e).redISub(n),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(i)).redSqr(),c=n.redIAdd(n);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var u=o.redIAdd(s).redSqr().redISub(i).redISub(a).redISub(c),l=t.redMul(u);l=(l=l.redIAdd(l)).redIAdd(l);var d=this.x.redMul(a).redISub(l);d=(d=d.redIAdd(d)).redIAdd(d);var h=this.y.redMul(u.redMul(c.redISub(u)).redISub(s.redMul(a)));h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var f=this.z.redAdd(s).redSqr().redISub(r).redISub(a);return this.curve.jpoint(d,h,f)},Tt$1.prototype.mul=function(e,t){return e=new K$3(e,t),this.curve._wnafMul(this,e)},Tt$1.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();if(0!==this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0))return!1;var n=t.redMul(this.z),o=r.redMul(e.z);return 0===this.y.redMul(o).redISub(e.y.redMul(n)).cmpn(0)},Tt$1.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),o=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(o),0===this.x.cmp(r))return!0}},Tt$1.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},Tt$1.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var qr=cr$1((function(e,t){var r=t;r.base=Ze$1,r.short=ka,r.mont=null,r.edwards=null})),Kr=cr$1((function(e,t){var r,n=t,o=Jt$2.assert;function i(e){"short"===e.type?this.curve=new qr.short(e):"edwards"===e.type?this.curve=new qr.edwards(e):this.curve=new qr.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,o(this.g.validate(),"Invalid curve"),o(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new i(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=i,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:se$2.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:se$2.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:se$2.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:se$2.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:se$2.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:se$2.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:se$2.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch{r=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:se$2.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function Re$1(e){if(!(this instanceof Re$1))return new Re$1(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=fe$2.toArray(e.entropy,e.entropyEnc||"hex"),r=fe$2.toArray(e.nonce,e.nonceEnc||"hex"),n=fe$2.toArray(e.pers,e.persEnc||"hex");Pi(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var Rf=Re$1;Re$1.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o<this.V.length;o++)this.K[o]=0,this.V[o]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656},Re$1.prototype._hmac=function(){return new se$2.hmac(this.hash,this.K)},Re$1.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},Re$1.prototype.reseed=function(e,t,r,n){"string"!=typeof t&&(n=r,r=t,t=null),e=fe$2.toArray(e,t),r=fe$2.toArray(r,n),Pi(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},Re$1.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=fe$2.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length<e;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var i=o.slice(0,e);return this._update(r),this._reseed++,fe$2.encode(i,t)};var Fi=Jt$2.assert;function kt(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var Ti=kt;kt.fromPublic=function(e,t,r){return t instanceof kt?t:new kt(e,{pub:t,pubEnc:r})},kt.fromPrivate=function(e,t,r){return t instanceof kt?t:new kt(e,{priv:t,privEnc:r})},kt.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},kt.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},kt.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},kt.prototype._importPrivate=function(e,t){this.priv=new K$3(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},kt.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?Fi(e.x,"Need x coordinate"):("short"===this.ec.curve.type||"edwards"===this.ec.curve.type)&&Fi(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},kt.prototype.derive=function(e){return e.validate()||Fi(e.validate(),"public point not validated"),e.mul(this.priv).getX()},kt.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},kt.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},kt.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var qa=Jt$2.assert;function Hr(e,t){if(e instanceof Hr)return e;this._importDER(e,t)||(qa(e.r&&e.s,"Signature without r or s"),this.r=new K$3(e.r,16),this.s=new K$3(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var zr=Hr;function Ka(){this.place=0}function Ui(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var o=0,i=0,s=t.place;i<n;i++,s++)o<<=8,o|=e[s],o>>>=0;return!(o<=127)&&(t.place=s,o)}function Of(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function ki(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}Hr.prototype._importDER=function(e,t){e=Jt$2.toArray(e,t);var r=new Ka;if(48!==e[r.place++])return!1;var n=Ui(e,r);if(!1===n||n+r.place!==e.length||2!==e[r.place++])return!1;var o=Ui(e,r);if(!1===o)return!1;var i=e.slice(r.place,o+r.place);if(r.place+=o,2!==e[r.place++])return!1;var s=Ui(e,r);if(!1===s||e.length!==s+r.place)return!1;var a=e.slice(r.place,s+r.place);if(0===i[0]){if(!(128&i[1]))return!1;i=i.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new K$3(i),this.s=new K$3(a),this.recoveryParam=null,!0},Hr.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=Of(t),r=Of(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];ki(n,t.length),(n=n.concat(t)).push(2),ki(n,r.length);var o=n.concat(r),i=[48];return ki(i,o.length),i=i.concat(o),Jt$2.encode(i,e)};var Ha=function(){throw new Error("unsupported")},Pf=Jt$2.assert;function $t$1(e){if(!(this instanceof $t$1))return new $t$1(e);"string"==typeof e&&(Pf(Object.prototype.hasOwnProperty.call(Kr,e),"Unknown curve "+e),e=Kr[e]),e instanceof Kr.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var za=$t$1;$t$1.prototype.keyPair=function(e){return new Ti(this,e)},$t$1.prototype.keyFromPrivate=function(e,t){return Ti.fromPrivate(this,e,t)},$t$1.prototype.keyFromPublic=function(e,t){return Ti.fromPublic(this,e,t)},$t$1.prototype.genKeyPair=function(e){e||(e={});for(var t=new Rf({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Ha(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new K$3(2));;){var o=new K$3(t.generate(r));if(!(o.cmp(n)>0))return o.iaddn(1),this.keyFromPrivate(o)}},$t$1.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},$t$1.prototype.sign=function(e,t,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new K$3(e,16));for(var o=this.n.byteLength(),i=t.getPrivate().toArray("be",o),s=e.toArray("be",o),a=new Rf({hash:this.hash,entropy:i,nonce:s,pers:n.pers,persEnc:n.persEnc||"utf8"}),c=this.n.sub(new K$3(1)),u=0;;u++){var l=n.k?n.k(u):new K$3(a.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(c)>=0)){var d=this.g.mul(l);if(!d.isInfinity()){var h=d.getX(),f=h.umod(this.n);if(0!==f.cmpn(0)){var p=l.invm(this.n).mul(f.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(d.getY().isOdd()?1:0)|(0!==h.cmp(f)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new zr({r:f,s:p,recoveryParam:m})}}}}}},$t$1.prototype.verify=function(e,t,r,n){e=this._truncateToN(new K$3(e,16)),r=this.keyFromPublic(r,n);var o=(t=new zr(t,"hex")).r,i=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;var s,a=i.invm(this.n),c=a.mul(e).umod(this.n),u=a.mul(o).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(c,r.getPublic(),u)).isInfinity()&&s.eqXToP(o):!(s=this.g.mulAdd(c,r.getPublic(),u)).isInfinity()&&0===s.getX().umod(this.n).cmp(o)},$t$1.prototype.recoverPubKey=function(e,t,r,n){Pf((3&r)===r,"The recovery param is more than two bits"),t=new zr(t,n);var o=this.n,i=new K$3(e),s=t.r,a=t.s,c=1&r,u=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");s=u?this.curve.pointFromX(s.add(this.curve.n),c):this.curve.pointFromX(s,c);var l=t.r.invm(o),d=o.sub(i).mul(l).umod(o),h=a.mul(l).umod(o);return this.g.mulAdd(d,s,h)},$t$1.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new zr(t,n)).recoveryParam)return t.recoveryParam;for(var o=0;o<4;o++){var i;try{i=this.recoverPubKey(e,t,o)}catch{continue}if(i.eq(r))return o}throw new Error("Unable to find valid recovery factor")};var La=cr$1((function(e,t){var r=t;r.version="6.5.4",r.utils=Jt$2,r.rand=function(){throw new Error("unsupported")},r.curve=qr,r.curves=Kr,r.ec=za,r.eddsa=null})),ja=La.ec;const Qa="signing-key/5.7.0",qi=new L$6(Qa);let Ki=null;function ve$1(){return Ki||(Ki=new ja("secp256k1")),Ki}class Ja{constructor(e){br(this,"curve","secp256k1"),br(this,"privateKey",Kt$1(e)),32!==N0(this.privateKey)&&qi.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=ve$1().keyFromPrivate(Ot$1(this.privateKey));br(this,"publicKey","0x"+t.getPublic(!1,"hex")),br(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),br(this,"_isSigningKey",!0)}_addPoint(e){const t=ve$1().keyFromPublic(Ot$1(this.publicKey)),r=ve$1().keyFromPublic(Ot$1(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=ve$1().keyFromPrivate(Ot$1(this.privateKey)),r=Ot$1(e);32!==r.length&&qi.throwArgumentError("bad digest length","digest",e);const n=t.sign(r,{canonical:!0});return zn({recoveryParam:n.recoveryParam,r:oe$3("0x"+n.r.toString(16),32),s:oe$3("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const t=ve$1().keyFromPrivate(Ot$1(this.privateKey)),r=ve$1().keyFromPublic(Ot$1(Df(e)));return oe$3("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!(!e||!e._isSigningKey)}}function Ga(e,t){const r=zn(t),n={r:Ot$1(r.r),s:Ot$1(r.s)};return"0x"+ve$1().recoverPubKey(Ot$1(e),n,r.recoveryParam).encode("hex",!1)}function Df(e,t){const r=Ot$1(e);if(32===r.length){return new Ja(r).publicKey}return 33===r.length?"0x"+ve$1().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?Kt$1(r):qi.throwArgumentError("invalid public or private key","key","[REDACTED]")}var Ff;function Va(e){return ns$1(Hn(yi(Hn(Df(e),1)),12))}function Wa(e,t){return Va(Ga(Ot$1(e),t))}!function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(Ff||(Ff={}));const Xa="https://rpc.walletconnect.com/v1";async function Tf(e,t,r,n,o,i){switch(r.t){case"eip191":return Uf(e,t,r.s);case"eip1271":return await kf(e,t,r.s,n,o,i);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function Uf(e,t,r){return Wa(ff(t),r).toLowerCase()===e.toLowerCase()}async function kf(e,t,r,n,o,i){try{const s="0x1626ba7e",a="0000000000000000000000000000000000000000000000000000000000000040",c="0000000000000000000000000000000000000000000000000000000000000041",u=r.substring(2),l=s+ff(t).substring(2)+a+c+u,d=await fetch(`${i||Xa}/?chainId=${n}&projectId=${o}`,{method:"POST",body:JSON.stringify({id:Za(),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:l},"latest"]})}),{result:h}=await d.json();return!!h&&h.slice(0,s.length).toLowerCase()===s.toLowerCase()}catch(s){return console.error("isValidEip1271Signature: ",s),!1}}function Za(){return Date.now()+Math.floor(1e3*Math.random())}var $a=Object.defineProperty,tu=Object.defineProperties,eu=Object.getOwnPropertyDescriptors,qf=Object.getOwnPropertySymbols,ru=Object.prototype.hasOwnProperty,iu=Object.prototype.propertyIsEnumerable,Kf=(e,t,r)=>t in e?$a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Hi=(e,t)=>{for(var r in t||(t={}))ru.call(t,r)&&Kf(e,r,t[r]);if(qf)for(var r of qf(t))iu.call(t,r)&&Kf(e,r,t[r]);return e},Hf=(e,t)=>tu(e,eu(t));const nu="did:pkh:",Lr=e=>null==e?void 0:e.split(":"),zi=e=>{const t=e&&Lr(e);if(t)return e.includes(nu)?t[3]:t[1]},fu=e=>{const t=e&&Lr(e);if(t)return t[2]+":"+t[3]},Li=e=>{const t=e&&Lr(e);if(t)return t.pop()};async function ou(e){const{cacao:t,projectId:r}=e,{s:n,p:o}=t,i=zf(o,o.iss),s=Li(o.iss);return await Tf(s,i,n,zi(o.iss),r)}const zf=(e,t)=>{const r=`${e.domain} wants you to sign in with your Ethereum account:`,n=Li(t);if(!e.aud&&!e.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let o=e.statement||void 0;const i=`URI: ${e.aud||e.uri}`,s=`Version: ${e.version}`,a=`Chain ID: ${zi(t)}`,c=`Nonce: ${e.nonce}`,u=`Issued At: ${e.iat}`,l=e.exp?`Expiration Time: ${e.exp}`:void 0,d=e.nbf?`Not Before: ${e.nbf}`:void 0,h=e.requestId?`Request ID: ${e.requestId}`:void 0,f=e.resources?`Resources:${e.resources.map((e=>`\n- ${e}`)).join("")}`:void 0,p=Qr(e.resources);if(p){o=Ji(o,Oe$1(p))}return[r,n,"",o,"",i,s,a,c,u,l,d,h,f].filter((e=>null!=e)).join("\n")};function Jf(e){return Buffer$2.from(JSON.stringify(e)).toString("base64")}function Gf(e){return JSON.parse(Buffer$2.from(e,"base64").toString("utf-8"))}function me$1(e){if(!e)throw new Error("No recap provided, value is undefined");if(!e.att)throw new Error("No `att` property found");const t=Object.keys(e.att);if(null==t||!t.length)throw new Error("No resources found in `att` property");t.forEach((t=>{const r=e.att[t];if(Array.isArray(r))throw new Error(`Resource must be an object: ${t}`);if("object"!=typeof r)throw new Error(`Resource must be an object: ${t}`);if(!Object.keys(r).length)throw new Error(`Resource object is empty: ${t}`);Object.keys(r).forEach((e=>{const t=r[e];if(!Array.isArray(t))throw new Error(`Ability limits ${e} must be an array of objects, found: ${t}`);if(!t.length)throw new Error(`Value of ${e} is empty array, must be an array with objects`);t.forEach((t=>{if("object"!=typeof t)throw new Error(`Ability limits (${e}) must be an array of objects, found: ${t}`)}))}))}))}function Yf(e,t,r,n={}){return null==r||r.sort(((e,t)=>e.localeCompare(t))),{att:{[e]:ji(t,r,n)}}}function ji(e,t,r={}){const n=(t=null==t?void 0:t.sort(((e,t)=>e.localeCompare(t)))).map((t=>({[`${e}/${t}`]:[r]})));return Object.assign({},...n)}function jr(e){return me$1(e),`urn:recap:${Jf(e).replace(/=/g,"")}`}function Oe$1(e){const t=Gf(e.replace("urn:recap:",""));return me$1(t),t}function cu(e,t,r){return jr(Yf(e,t,r))}function Qi(e){return e&&e.includes("urn:recap:")}function lu(e,t){return jr(Wf(Oe$1(e),Oe$1(t)))}function Wf(e,t){me$1(e),me$1(t);const r=Object.keys(e.att).concat(Object.keys(t.att)).sort(((e,t)=>e.localeCompare(t))),n={att:{}};return r.forEach((r=>{var o,i;Object.keys((null==(o=e.att)?void 0:o[r])||{}).concat(Object.keys((null==(i=t.att)?void 0:i[r])||{})).sort(((e,t)=>e.localeCompare(t))).forEach((o=>{var i,s;n.att[r]=Hf(Hi({},n.att[r]),{[o]:(null==(i=e.att[r])?void 0:i[o])||(null==(s=t.att[r])?void 0:s[o])})}))})),n}function Ji(e="",t){me$1(t);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(e.includes(r))return e;const n=[];let o=0;Object.keys(t.att).forEach((e=>{const r=Object.keys(t.att[e]).map((e=>({ability:e.split("/")[0],action:e.split("/")[1]})));r.sort(((e,t)=>e.action.localeCompare(t.action)));const i={};r.forEach((e=>{i[e.ability]||(i[e.ability]=[]),i[e.ability].push(e.action)}));const s=Object.keys(i).map((t=>(o++,`(${o}) '${t}': '${i[t].join("', '")}' for '${e}'.`)));n.push(s.join(", ").replace(".,","."))}));return`${e?e+" ":""}${`${r}${n.join(" ")}`}`}function du(e){var t;const r=Oe$1(e);me$1(r);const n=null==(t=r.att)?void 0:t.eip155;return n?Object.keys(n).map((e=>e.split("/")[1])):[]}function pu(e){const t=Oe$1(e);me$1(t);const r=[];return Object.values(t.att).forEach((e=>{Object.values(e).forEach((e=>{var t;null!=(t=null==e?void 0:e[0])&&t.chains&&r.push(e[0].chains)}))})),[...new Set(r.flat())]}function Qr(e){if(!e)return;const t=null==e?void 0:e[e.length-1];return Qi(t)?t:void 0}const zt$1="base16",Gr="utf8",lr=1;function bu(e){return toString$1(sha256.hash(fromString$1(e,zt$1)),zt$1)}function yu(e){return toString$1(sha256.hash(fromString$1(e,Gr)),zt$1)}function $e$1(e){const t=[];return e.forEach((e=>{const[r,n]=e.split(":");t.push(`${r}:${n}`)})),t}function co$1(e){const t=[];return Object.values(e).forEach((e=>{t.push(...$e$1(e.accounts))})),t}function lo(e,t){const r=[];return Object.values(e).forEach((e=>{$e$1(e.accounts).includes(t)&&r.push(...e.methods)})),r}function po$1(e,t){const r=[];return Object.values(e).forEach((e=>{$e$1(e.accounts).includes(t)&&r.push(...e.events)})),r}function mo(e){const t={};return null==e||e.forEach((e=>{const[r,n]=e.split(":");t[r]||(t[r]={accounts:[],chains:[],events:[]}),t[r].accounts.push(e),t[r].chains.push(`${r}:${n}`)})),t}function ju(e,t){const r=mo(t=t.map((e=>e.replace("did:pkh:",""))));for(const[n,o]of Object.entries(r))o.methods?o.methods=ge(o.methods,e):o.methods=e,o.events=["chainChanged","accountsChanged"];return r}const go$1={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}},Ao$1={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 xe$1(e,t){const{message:r,code:n}=Ao$1[e];return{message:t?`${r} ${t}`:r,code:n}}function tr(e,t){const{message:r,code:n}=go$1[e];return{message:t?`${r} ${t}`:r,code:n}}function Er(e,t){return!!Array.isArray(e)}function Yr(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function Pe$1(e){return typeof e>"u"}function Gt$1(e,t){return!(!t||!Pe$1(e))||"string"==typeof e&&!!e.trim().length}function Vr(e,t){return"number"==typeof e&&!isNaN(e)}function Qu(e,t){const{requiredNamespaces:r}=t,n=Object.keys(e.namespaces),o=Object.keys(r);let i=!0;return!!_e$2(o,n)&&(n.forEach((t=>{const{accounts:n,methods:o,events:s}=e.namespaces[t],a=$e$1(n),c=r[t];_e$2(_r(t,c),a)&&_e$2(c.methods,o)&&_e$2(c.events,s)||(i=!1)})),i)}function Sr(e){return!(!Gt$1(e,!1)||!e.includes(":"))&&2===e.split(":").length}function bo(e){if(Gt$1(e,!1)&&e.includes(":")){const t=e.split(":");if(3===t.length){const e=t[0]+":"+t[1];return!!t[2]&&Sr(e)}}return!1}function Vu(e,t){let r=null;return Gt$1(null==e?void 0:e.publicKey,!1)||(r=xe$1("MISSING_OR_INVALID",`${t} controller public key should be a string`)),r}function tn(e){let t=!0;return Er(e)?e.length&&(t=e.every((e=>Gt$1(e,!1)))):t=!1,t}function yo(e,t,r){let n=null;return Er(t)&&t.length?t.forEach((e=>{n||Sr(e)||(n=tr("UNSUPPORTED_CHAINS",`${r}, chain ${e} should be a string and conform to "namespace:chainId" format`))})):Sr(e)||(n=tr("UNSUPPORTED_CHAINS",`${r}, 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 wo$1(e,t,r){let n=null;return Object.entries(e).forEach((([e,o])=>{if(n)return;const i=yo(e,_r(e,o),`${t} ${r}`);i&&(n=i)})),n}function xo$1(e,t){let r=null;return Er(e)?e.forEach((e=>{r||bo(e)||(r=tr("UNSUPPORTED_ACCOUNTS",`${t}, account ${e} should be a string and conform to "namespace:chainId:address" format`))})):r=tr("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function Mo$1(e,t){let r=null;return Object.values(e).forEach((e=>{if(r)return;const n=xo$1(null==e?void 0:e.accounts,`${t} namespace`);n&&(r=n)})),r}function Eo$1(e,t){let r=null;return tn(null==e?void 0:e.methods)?tn(null==e?void 0:e.events)||(r=tr("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):r=tr("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),r}function en$1(e,t){let r=null;return Object.values(e).forEach((e=>{if(r)return;const n=Eo$1(e,`${t}, namespace`);n&&(r=n)})),r}function Wu(e,t,r){let n=null;if(e&&Yr(e)){const o=en$1(e,t);o&&(n=o);const i=wo$1(e,t,r);i&&(n=i)}else n=xe$1("MISSING_OR_INVALID",`${t}, ${r} should be an object with data`);return n}function So$1(e,t){let r=null;if(e&&Yr(e)){const n=en$1(e,t);n&&(r=n);const o=Mo$1(e,t);o&&(r=o)}else r=xe$1("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return r}function No$1(e){return Gt$1(e.protocol,!0)}function Xu(e,t){let r=!1;return e?e&&Er(e)&&e.length&&e.forEach((e=>{r=No$1(e)})):r=!0,r}function Zu(e){return"number"==typeof e}function $u(e){return typeof e<"u"&&null!==typeof e}function th(e){return!!(e&&"object"==typeof e&&e.code&&Vr(e.code)&&e.message&&Gt$1(e.message,!1))}function eh(e){return!(Pe$1(e)||!Gt$1(e.method,!1))}function rh(e){return!(Pe$1(e)||Pe$1(e.result)&&Pe$1(e.error)||!Vr(e.id)||!Gt$1(e.jsonrpc,!1))}function ih(e){return!(Pe$1(e)||!Gt$1(e.name,!1))}function nh(e,t){return!(!Sr(t)||!co$1(e).includes(t))}function fh(e,t,r){return!!Gt$1(r,!1)&&lo(e,t).includes(r)}function oh(e,t,r){return!!Gt$1(r,!1)&&po$1(e,t).includes(r)}function Io$1(e,t,r){let n=null;const o=sh(e),i=ah(t),s=Object.keys(o),a=Object.keys(i),c=_o(Object.keys(e)),u=_o(Object.keys(t)),l=c.filter((e=>!u.includes(e)));return l.length&&(n=xe$1("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces.\n Required: ${l.toString()}\n Received: ${Object.keys(t).toString()}`)),_e$2(s,a)||(n=xe$1("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces.\n Required: ${s.toString()}\n Approved: ${a.toString()}`)),Object.keys(t).forEach((e=>{if(!e.includes(":")||n)return;const o=$e$1(t[e].accounts);o.includes(e)||(n=xe$1("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${e}\n Required: ${e}\n Approved: ${o.toString()}`))})),s.forEach((e=>{n||(_e$2(o[e].methods,i[e].methods)?_e$2(o[e].events,i[e].events)||(n=xe$1("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${e}`)):n=xe$1("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${e}`))})),n}function sh(e){const t={};return Object.keys(e).forEach((r=>{var n;r.includes(":")?t[r]=e[r]:null==(n=e[r].chains)||n.forEach((n=>{t[n]={methods:e[r].methods,events:e[r].events}}))})),t}function _o(e){return[...new Set(e.map((e=>e.includes(":")?e.split(":")[0]:e)))]}function ah(e){const t={};return Object.keys(e).forEach((r=>{if(r.includes(":"))t[r]=e[r];else{const n=$e$1(e[r].accounts);null==n||n.forEach((n=>{t[n]={accounts:e[r].accounts.filter((e=>e.includes(`${n}:`))),methods:e[r].methods,events:e[r].events}}))}})),t}function uh(e,t){return Vr(e)&&e<=t.max&&e>=t.min}const rn={};class lh{static get(e){return rn[e]}static set(e,t){rn[e]=t}static delete(e){delete rn[e]}}const Ee$1="wc",Se=2,_e$1="client",ie$1=`${Ee$1}@${Se}:${_e$1}:`,re$1={name:_e$1,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},fe$1="WALLETCONNECT_DEEPLINK_CHOICE",Ue$1="proposal",Ge$1="Proposal expired",ke$1="session",$$4=cjs$a.SEVEN_DAYS,je$1="engine",R$3={wc_sessionPropose:{req:{ttl:cjs$a.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:cjs$a.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:cjs$a.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:cjs$a.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:cjs$a.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:cjs$a.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:cjs$a.ONE_DAY,prompt:!1,tag:1104},res:{ttl:cjs$a.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:cjs$a.ONE_DAY,prompt:!1,tag:1106},res:{ttl:cjs$a.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:cjs$a.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:cjs$a.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:cjs$a.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:cjs$a.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:cjs$a.ONE_DAY,prompt:!1,tag:1112},res:{ttl:cjs$a.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:cjs$a.ONE_DAY,prompt:!1,tag:1114},res:{ttl:cjs$a.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:cjs$a.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:cjs$a.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:cjs$a.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:cjs$a.FIVE_MINUTES,prompt:!1,tag:1119}}},ne$2={min:cjs$a.FIVE_MINUTES,max:cjs$a.SEVEN_DAYS},D$5={idle:"IDLE",active:"ACTIVE"},Fe$1="request",Qe$1=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],ze$1="wc",He$1="auth",Ye$1="authKeys",Xe="pairingTopics",Je="requests",J$2=`${ze$1}@1.5:${He$1}:`,B$4=`${J$2}:PUB_KEY`;var Yt$1=Object.defineProperty,Xt$1=Object.defineProperties,Jt$1=Object.getOwnPropertyDescriptors,Be$1=Object.getOwnPropertySymbols,Bt$1=Object.prototype.hasOwnProperty,Wt$1=Object.prototype.propertyIsEnumerable,We$1=(e,t,r)=>t in e?Yt$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,m$4=(e,t)=>{for(var r in t||(t={}))Bt$1.call(t,r)&&We$1(e,r,t[r]);if(Be$1)for(var r of Be$1(t))Wt$1.call(t,r)&&We$1(e,r,t[r]);return e},L$5=(e,t)=>Xt$1(e,Jt$1(t));let Zt$1=class extends w$5{constructor(e){super(e),this.name=je$1,this.events=new Ct$1,this.initialized=!1,this.requestQueue={state:D$5.idle,queue:[]},this.sessionRequestQueue={state:D$5.idle,queue:[]},this.requestQueueDelay=cjs$a.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(R$3)}),this.initialized=!0,setTimeout((()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()}),cjs$a.toMiliseconds(this.requestQueueDelay)))},this.connect=async e=>{await this.isInitialized();const t=L$5(m$4({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(t);const{pairingTopic:r,requiredNamespaces:n,optionalNamespaces:o,sessionProperties:i,relays:s}=t;let a,c=r,u=!1;try{c&&(u=this.client.core.pairing.pairings.get(c).active)}catch(b){throw this.client.logger.error(`connect() -> pairing.get(${c}) failed`),b}if(!c||!u){const{topic:e,uri:t}=await this.client.core.pairing.create();c=e,a=t}if(!c){const{message:e}=xe$1("NO_MATCHING_KEY",`connect() pairing topic: ${c}`);throw new Error(e)}const l=await this.client.core.crypto.generateKeyPair(),d=R$3.wc_sessionPropose.req.ttl||cjs$a.FIVE_MINUTES,h=d0(d),f=m$4({requiredNamespaces:n,optionalNamespaces:o,relays:s??[{protocol:at$1}],proposer:{publicKey:l,metadata:this.client.metadata},expiryTimestamp:h,pairingTopic:c},i&&{sessionProperties:i}),{reject:p,resolve:m,done:y}=a0(d,Ge$1);this.events.once(v0("session_connect"),(async({error:e,session:t})=>{if(e)p(e);else if(t){t.self.publicKey=l;const e=L$5(m$4({},t),{pairingTopic:f.pairingTopic,requiredNamespaces:f.requiredNamespaces,optionalNamespaces:f.optionalNamespaces});await this.client.session.set(t.topic,e),await this.setExpiry(t.topic,t.expiry),c&&await this.client.core.pairing.updateMetadata({topic:c,metadata:t.peer.metadata}),this.cleanupDuplicatePairings(e),m(e)}}));const g=await this.sendRequest({topic:c,method:"wc_sessionPropose",params:f,throwOnFailedPublish:!0});return await this.setProposal(g,m$4({id:g},f)),{uri:a,approval:y}},this.pair=async e=>{await this.isInitialized();try{return await this.client.core.pairing.pair(e)}catch(e2){throw this.client.logger.error("pair() failed"),e2}},this.approve=async e=>{await this.isInitialized();try{await this.isValidApprove(e)}catch(y){throw this.client.logger.error("approve() -> isValidApprove() failed"),y}const{id:t,relayProtocol:r,namespaces:n,sessionProperties:o,sessionConfig:i}=e;let s;try{s=this.client.proposal.get(t)}catch(y){throw this.client.logger.error(`approve() -> proposal.get(${t}) failed`),y}const{pairingTopic:a,proposer:c,requiredNamespaces:u,optionalNamespaces:l}=s,d=await this.client.core.crypto.generateKeyPair(),h=c.publicKey,f=await this.client.core.crypto.generateSharedKey(d,h),p=m$4(m$4({relay:{protocol:r??"irn"},namespaces:n,controller:{publicKey:d,metadata:this.client.metadata},expiry:d0($$4)},o&&{sessionProperties:o}),i&&{sessionConfig:i});await this.client.core.relayer.subscribe(f);const m=L$5(m$4({},p),{topic:f,requiredNamespaces:u,optionalNamespaces:l,pairingTopic:a,acknowledged:!1,self:p.controller,peer:{publicKey:c.publicKey,metadata:c.metadata},controller:d});await this.client.session.set(f,m);try{await this.sendResult({id:t,topic:a,result:{relay:{protocol:r??"irn"},responderPublicKey:d},throwOnFailedPublish:!0}),await this.sendRequest({topic:f,method:"wc_sessionSettle",params:p,throwOnFailedPublish:!0})}catch(y){throw this.client.logger.error(y),this.client.session.delete(f,tr("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(f),y}return await this.client.core.pairing.updateMetadata({topic:a,metadata:c.metadata}),await this.client.proposal.delete(t,tr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:a}),await this.setExpiry(f,d0($$4)),{topic:f,acknowledged:()=>new Promise((e=>setTimeout((()=>e(this.client.session.get(f))),500)))}},this.reject=async e=>{await this.isInitialized();try{await this.isValidReject(e)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:t,reason:r}=e;let n;try{n=this.client.proposal.get(t).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${t}) failed`),o}n&&(await this.sendError({id:t,topic:n,error:r,rpcOpts:R$3.wc_sessionPropose.reject}),await this.client.proposal.delete(t,tr("USER_DISCONNECTED")))},this.update=async e=>{await this.isInitialized();try{await this.isValidUpdate(e)}catch(u){throw this.client.logger.error("update() -> isValidUpdate() failed"),u}const{topic:t,namespaces:r}=e,{done:n,resolve:o,reject:i}=a0(),s=payloadId(),a=getBigIntRpcId().toString(),c=this.client.session.get(t).namespaces;return this.events.once(v0("session_update",s),(({error:e})=>{e?i(e):o()})),await this.client.session.update(t,{namespaces:r}),await this.sendRequest({topic:t,method:"wc_sessionUpdate",params:{namespaces:r},throwOnFailedPublish:!0,clientRpcId:s,relayRpcId:a}).catch((e=>{this.client.logger.error(e),this.client.session.update(t,{namespaces:c}),i(e)})),{acknowledged:n}},this.extend=async e=>{await this.isInitialized();try{await this.isValidExtend(e)}catch(s){throw this.client.logger.error("extend() -> isValidExtend() failed"),s}const{topic:t}=e,r=payloadId(),{done:n,resolve:o,reject:i}=a0();return this.events.once(v0("session_extend",r),(({error:e})=>{e?i(e):o()})),await this.setExpiry(t,d0($$4)),this.sendRequest({topic:t,method:"wc_sessionExtend",params:{},clientRpcId:r,throwOnFailedPublish:!0}).catch((e=>{i(e)})),{acknowledged:n}},this.request=async e=>{await this.isInitialized();try{await this.isValidRequest(e)}catch(d){throw this.client.logger.error("request() -> isValidRequest() failed"),d}const{chainId:t,request:r,topic:n,expiry:o=R$3.wc_sessionRequest.req.ttl}=e,i=this.client.session.get(n),s=payloadId(),a=getBigIntRpcId().toString(),{done:c,resolve:u,reject:l}=a0(o,"Request expired. Please try again.");return this.events.once(v0("session_request",s),(({error:e,result:t})=>{e?l(e):u(t)})),await Promise.all([new Promise((async e=>{await this.sendRequest({clientRpcId:s,relayRpcId:a,topic:n,method:"wc_sessionRequest",params:{request:L$5(m$4({},r),{expiryTimestamp:d0(o)}),chainId:t},expiry:o,throwOnFailedPublish:!0}).catch((e=>l(e))),this.client.events.emit("session_request_sent",{topic:n,request:r,chainId:t,id:s}),e()})),new Promise((async e=>{var t;if(null==(t=i.sessionConfig)||!t.disableDeepLink){const e=await g0(this.client.core.storage,fe$1);m0({id:s,topic:n,wcDeepLink:e})}e()})),c()]).then((e=>e[2]))},this.respond=async e=>{await this.isInitialized(),await this.isValidRespond(e);const{topic:t,response:r}=e,{id:n}=r;isJsonRpcResult(r)?await this.sendResult({id:n,topic:t,result:r.result,throwOnFailedPublish:!0}):isJsonRpcError(r)&&await this.sendError({id:n,topic:t,error:r.error}),this.cleanupAfterResponse(e)},this.ping=async e=>{await this.isInitialized();try{await this.isValidPing(e)}catch(r){throw this.client.logger.error("ping() -> isValidPing() failed"),r}const{topic:t}=e;if(this.client.session.keys.includes(t)){const e=payloadId(),r=getBigIntRpcId().toString(),{done:n,resolve:o,reject:i}=a0();this.events.once(v0("session_ping",e),(({error:e})=>{e?i(e):o()})),await Promise.all([this.sendRequest({topic:t,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:e,relayRpcId:r}),n()])}else this.client.core.pairing.pairings.keys.includes(t)&&await this.client.core.pairing.ping({topic:t})},this.emit=async e=>{await this.isInitialized(),await this.isValidEmit(e);const{topic:t,event:r,chainId:n}=e,o=getBigIntRpcId().toString();await this.sendRequest({topic:t,method:"wc_sessionEvent",params:{event:r,chainId:n},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async e=>{await this.isInitialized(),await this.isValidDisconnect(e);const{topic:t}=e;if(this.client.session.keys.includes(t))await this.sendRequest({topic:t,method:"wc_sessionDelete",params:tr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:t,emitEvent:!1});else{if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:e}=xe$1("MISMATCHED_TOPIC",`Session or pairing topic not found: ${t}`);throw new Error(e)}await this.client.core.pairing.disconnect({topic:t})}},this.find=e=>(this.isInitialized(),this.client.session.getAll().filter((t=>Qu(t,e)))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async e=>{this.isInitialized(),this.isValidAuthenticate(e);const{chains:t,statement:r="",uri:n,domain:o,nonce:i,type:s,exp:a,nbf:c,methods:u=[],expiry:l}=e,d=[...e.resources||[]],{topic:h,uri:f}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"]});this.client.logger.info({message:"Generated new pairing",pairing:{topic:h,uri:f}});const p=await this.client.core.crypto.generateKeyPair(),m=bu(p);if(await Promise.all([this.client.auth.authKeys.set(B$4,{responseTopic:m,publicKey:p}),this.client.auth.pairingTopics.set(m,{topic:m,pairingTopic:h})]),await this.client.core.relayer.subscribe(m),this.client.logger.info(`sending request to new pairing topic: ${h}`),u.length>0){const{namespace:e}=dn(t[0]);let r=cu(e,"request",u);Qr(d)&&(r=lu(r,d.pop())),d.push(r)}const y=l&&l>R$3.wc_sessionAuthenticate.req.ttl?l:R$3.wc_sessionAuthenticate.req.ttl,g={authPayload:{type:s??"caip122",chains:t,statement:r,aud:n,domain:o,version:"1",nonce:i,iat:(new Date).toISOString(),exp:a,nbf:c,resources:d},requester:{publicKey:p,metadata:this.client.metadata},expiryTimestamp:d0(y)},b={requiredNamespaces:{},optionalNamespaces:{eip155:{chains:t,methods:[...new Set(["personal_sign",...u])],events:["chainChanged","accountsChanged"]}},relays:[{protocol:"irn"}],pairingTopic:h,proposer:{publicKey:p,metadata:this.client.metadata},expiryTimestamp:d0(R$3.wc_sessionPropose.req.ttl)},{done:w,resolve:v,reject:_}=a0(y,"Request expired"),A=async({error:e,session:t})=>{if(this.events.off(v0("session_request",T),I),e)_(e);else if(t){t.self.publicKey=p,await this.client.session.set(t.topic,t),await this.setExpiry(t.topic,t.expiry),h&&await this.client.core.pairing.updateMetadata({topic:h,metadata:t.peer.metadata});const e=this.client.session.get(t.topic);await this.deleteProposal(k),v({session:e})}},I=async e=>{if(await this.deletePendingAuthRequest(T,{message:"fulfilled",code:0}),e.error){const t=tr("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return e.error.code===t.code?void 0:(this.events.off(v0("session_connect"),A),_(e.error.message))}await this.deleteProposal(k),this.events.off(v0("session_connect"),A);const{cacaos:t,responder:r}=e.result,n=[],o=[];for(const a of t){await ou({cacao:a,projectId:this.client.core.projectId})||(this.client.logger.error(a,"Signature verification failed"),_(tr("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:e}=a,t=Qr(e.resources),r=[fu(e.iss)],i=Li(e.iss);if(t){const e=du(t),o=pu(t);n.push(...e),r.push(...o)}for(const n of r)o.push(`${n}:${i}`)}const i=await this.client.core.crypto.generateSharedKey(p,r.publicKey);let s;n.length>0&&(s={topic:i,acknowledged:!0,self:{publicKey:p,metadata:this.client.metadata},peer:r,controller:r.publicKey,expiry:d0($$4),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:h,namespaces:ju([...new Set(n)],[...new Set(o)])},await this.client.core.relayer.subscribe(i),await this.client.session.set(i,s),h&&await this.client.core.pairing.updateMetadata({topic:h,metadata:r.metadata}),s=this.client.session.get(i)),v({auths:t,session:s})},T=payloadId(),k=payloadId();this.events.once(v0("session_connect"),A),this.events.once(v0("session_request",T),I);try{await Promise.all([this.sendRequest({topic:h,method:"wc_sessionAuthenticate",params:g,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:T}),this.sendRequest({topic:h,method:"wc_sessionPropose",params:b,expiry:R$3.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:k})])}catch(S){throw this.events.off(v0("session_connect"),A),this.events.off(v0("session_request",T),I),S}return await this.setProposal(k,m$4({id:k},b)),await this.setAuthRequest(T,{request:L$5(m$4({},g),{verifyContext:{}}),pairingTopic:h}),{uri:f,response:w}},this.approveSessionAuthenticate=async e=>{this.isInitialized();const{id:t,auths:r}=e,n=this.getPendingAuthRequest(t);if(!n)throw new Error(`Could not find pending auth request with id ${t}`);const o=n.requester.publicKey,i=await this.client.core.crypto.generateKeyPair(),s=bu(o),a={type:lr,receiverPublicKey:o,senderPublicKey:i},c=[],u=[];for(const h of r){if(!(await ou({cacao:h,projectId:this.client.core.projectId}))){const e=tr("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:t,topic:s,error:e,encodeOpts:a}),new Error(e.message)}const{p:e}=h,r=Qr(e.resources),n=[fu(e.iss)],o=Li(e.iss);if(r){const e=du(r),t=pu(r);c.push(...e),n.push(...t)}for(const t of n)u.push(`${t}:${o}`)}const l=await this.client.core.crypto.generateSharedKey(i,o);let d;return(null==c?void 0:c.length)>0&&(d={topic:l,acknowledged:!0,self:{publicKey:i,metadata:this.client.metadata},peer:{publicKey:o,metadata:n.requester.metadata},controller:o,expiry:d0($$4),authentication:r,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:n.pairingTopic,namespaces:ju([...new Set(c)],[...new Set(u)])},await this.client.core.relayer.subscribe(l),await this.client.session.set(l,d),await this.client.core.pairing.updateMetadata({topic:n.pairingTopic,metadata:n.requester.metadata})),await this.sendResult({topic:s,id:t,result:{cacaos:r,responder:{publicKey:i,metadata:this.client.metadata}},encodeOpts:a,throwOnFailedPublish:!0}),await this.client.auth.requests.delete(t,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:n.pairingTopic}),{session:d}},this.rejectSessionAuthenticate=async e=>{await this.isInitialized();const{id:t,reason:r}=e,n=this.getPendingAuthRequest(t);if(!n)throw new Error(`Could not find pending auth request with id ${t}`);const o=n.requester.publicKey,i=await this.client.core.crypto.generateKeyPair(),s=bu(o),a={type:lr,receiverPublicKey:o,senderPublicKey:i};await this.sendError({id:t,topic:s,error:r,encodeOpts:a,rpcOpts:R$3.wc_sessionAuthenticate.reject}),await this.client.auth.requests.delete(t,{message:"rejected",code:0}),await this.client.proposal.delete(t,tr("USER_DISCONNECTED"))},this.formatAuthMessage=e=>{this.isInitialized();const{request:t,iss:r}=e;return zf(t,r)},this.processRelayMessageCache=()=>{setTimeout((async()=>{if(0!==this.relayMessageCache.length)for(;this.relayMessageCache.length>0;)try{const e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(e){this.client.logger.error(e)}}),50)},this.cleanupDuplicatePairings=async e=>{if(e.pairingTopic)try{const t=this.client.core.pairing.pairings.get(e.pairingTopic),r=this.client.core.pairing.pairings.getAll().filter((r=>{var n,o;return(null==(n=r.peerMetadata)?void 0:n.url)&&(null==(o=r.peerMetadata)?void 0:o.url)===e.peer.metadata.url&&r.topic&&r.topic!==t.topic}));if(0===r.length)return;this.client.logger.info(`Cleaning up ${r.length} duplicate pairing(s)`),await Promise.all(r.map((e=>this.client.core.pairing.disconnect({topic:e.topic})))),this.client.logger.info("Duplicate pairings clean up finished")}catch(e2){this.client.logger.error(e2)}},this.deleteSession=async e=>{var t;const{topic:r,expirerHasDeleted:n=!1,emitEvent:o=!0,id:i=0}=e,{self:s}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await this.client.session.delete(r,tr("USER_DISCONNECTED")),this.addToRecentlyDeleted(r,"session"),this.client.core.crypto.keychain.has(s.publicKey)&&await this.client.core.crypto.deleteKeyPair(s.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),n||this.client.core.expirer.del(r),this.client.core.storage.removeItem(fe$1).catch((e=>this.client.logger.warn(e))),this.getPendingSessionRequests().forEach((e=>{e.topic===r&&this.deletePendingSessionRequest(e.id,tr("USER_DISCONNECTED"))})),r===(null==(t=this.sessionRequestQueue.queue[0])?void 0:t.topic)&&(this.sessionRequestQueue.state=D$5.idle),o&&this.client.events.emit("session_delete",{id:i,topic:r})},this.deleteProposal=async(e,t)=>{await Promise.all([this.client.proposal.delete(e,tr("USER_DISCONNECTED")),t?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")},this.deletePendingSessionRequest=async(e,t,r=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,t),r?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter((t=>t.id!==e)),r&&(this.sessionRequestQueue.state=D$5.idle,this.client.events.emit("session_request_expire",{id:e}))},this.deletePendingAuthRequest=async(e,t,r=!1)=>{await Promise.all([this.client.auth.requests.delete(e,t),r?Promise.resolve():this.client.core.expirer.del(e)])},this.setExpiry=async(e,t)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,t),await this.client.session.update(e,{expiry:t}))},this.setProposal=async(e,t)=>{this.client.core.expirer.set(e,d0(R$3.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,t)},this.setAuthRequest=async(e,t)=>{const{request:r,pairingTopic:n}=t;this.client.core.expirer.set(e,r.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:r.authPayload,requester:r.requester,expiryTimestamp:r.expiryTimestamp,id:e,pairingTopic:n,verifyContext:r.verifyContext})},this.setPendingSessionRequest=async e=>{const{id:t,topic:r,params:n,verifyContext:o}=e,i=n.request.expiryTimestamp||d0(R$3.wc_sessionRequest.req.ttl);this.client.core.expirer.set(t,i),await this.client.pendingRequest.set(t,{id:t,topic:r,params:n,verifyContext:o})},this.sendRequest=async e=>{const{topic:t,method:r,params:n,expiry:o,relayRpcId:i,clientRpcId:s,throwOnFailedPublish:a}=e,c=formatJsonRpcRequest(r,n,s);if(pr()&&Qe$1.includes(r)){const e=yu(JSON.stringify(c));this.client.core.verify.register({attestationId:e})}let u;try{u=await this.client.core.crypto.encode(t,c)}catch(d){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${t} failed`),d}const l=R$3[r].req;return o&&(l.ttl=o),i&&(l.id=i),this.client.core.history.set(t,c),a?(l.internal=L$5(m$4({},l.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(t,u,l)):this.client.core.relayer.publish(t,u,l).catch((e=>this.client.logger.error(e))),c.id},this.sendResult=async e=>{const{id:t,topic:r,result:n,throwOnFailedPublish:o,encodeOpts:i}=e,s=formatJsonRpcResult(t,n);let a,c;try{a=await this.client.core.crypto.encode(r,s,i)}catch(l){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${r} failed`),l}try{c=await this.client.core.history.get(r,t)}catch(l){throw this.client.logger.error(`sendResult() -> history.get(${r}, ${t}) failed`),l}const u=R$3[c.request.method].res;o?(u.internal=L$5(m$4({},u.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(r,a,u)):this.client.core.relayer.publish(r,a,u).catch((e=>this.client.logger.error(e))),await this.client.core.history.resolve(s)},this.sendError=async e=>{const{id:t,topic:r,error:n,encodeOpts:o,rpcOpts:i}=e,s=formatJsonRpcError(t,n);let a,c;try{a=await this.client.core.crypto.encode(r,s,o)}catch(l){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${r} failed`),l}try{c=await this.client.core.history.get(r,t)}catch(l){throw this.client.logger.error(`sendError() -> history.get(${r}, ${t}) failed`),l}const u=i||R$3[c.request.method].res;this.client.core.relayer.publish(r,a,u),await this.client.core.history.resolve(s)},this.cleanup=async()=>{const e=[],t=[];this.client.session.getAll().forEach((t=>{let r=!1;p0(t.expiry)&&(r=!0),this.client.core.crypto.keychain.has(t.topic)||(r=!0),r&&e.push(t.topic)})),this.client.proposal.getAll().forEach((e=>{p0(e.expiryTimestamp)&&t.push(e.id)})),await Promise.all([...e.map((e=>this.deleteSession({topic:e}))),...t.map((e=>this.deleteProposal(e)))])},this.onRelayEventRequest=async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state!==D$5.active){for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=D$5.active;const e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(e2){this.client.logger.warn(e2)}}this.requestQueue.state=D$5.idle}else this.client.logger.info("Request queue already active, skipping...")},this.processRequest=async e=>{const{topic:t,payload:r}=e,n=r.method;if(!this.shouldIgnorePairingRequest({topic:t,requestMethod:n}))switch(n){case"wc_sessionPropose":return await this.onSessionProposeRequest(t,r);case"wc_sessionSettle":return await this.onSessionSettleRequest(t,r);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(t,r);case"wc_sessionExtend":return await this.onSessionExtendRequest(t,r);case"wc_sessionPing":return await this.onSessionPingRequest(t,r);case"wc_sessionDelete":return await this.onSessionDeleteRequest(t,r);case"wc_sessionRequest":return await this.onSessionRequest(t,r);case"wc_sessionEvent":return await this.onSessionEventRequest(t,r);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest(t,r);default:return this.client.logger.info(`Unsupported request method ${n}`)}},this.onRelayEventResponse=async e=>{const{topic:t,payload:r}=e,n=(await this.client.core.history.get(t,r.id)).request.method;switch(n){case"wc_sessionPropose":return this.onSessionProposeResponse(t,r);case"wc_sessionSettle":return this.onSessionSettleResponse(t,r);case"wc_sessionUpdate":return this.onSessionUpdateResponse(t,r);case"wc_sessionExtend":return this.onSessionExtendResponse(t,r);case"wc_sessionPing":return this.onSessionPingResponse(t,r);case"wc_sessionRequest":return this.onSessionRequestResponse(t,r);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(t,r);default:return this.client.logger.info(`Unsupported response method ${n}`)}},this.onRelayEventUnknownPayload=e=>{const{topic:t}=e,{message:r}=xe$1("MISSING_OR_INVALID",`Decoded payload on topic ${t} is not identifiable as a JSON-RPC request or a response.`);throw new Error(r)},this.shouldIgnorePairingRequest=e=>{const{topic:t,requestMethod:r}=e,n=this.expectedPairingMethodMap.get(t);return!(!n||n.includes(r))&&!!(n.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async(e,t)=>{const{params:r,id:n}=t;try{this.isValidConnect(m$4({},t.params));const o=r.expiryTimestamp||d0(R$3.wc_sessionPropose.req.ttl),i=m$4({id:n,pairingTopic:e,expiryTimestamp:o},r);await this.setProposal(n,i);const s=yu(JSON.stringify(t)),a=await this.getVerifyContext(s,i.proposer.metadata);this.client.events.emit("session_proposal",{id:n,params:i,verifyContext:a})}catch(o){await this.sendError({id:n,topic:e,error:o,rpcOpts:R$3.wc_sessionPropose.autoReject}),this.client.logger.error(o)}},this.onSessionProposeResponse=async(e,t)=>{const{id:r}=t;if(isJsonRpcResult(t)){const{result:n}=t;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:n});const o=this.client.proposal.get(r);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});const i=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:i});const s=n.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:s});const a=await this.client.core.crypto.generateSharedKey(i,s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:a});const c=await this.client.core.relayer.subscribe(a);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:c}),await this.client.core.pairing.activate({topic:e})}else if(isJsonRpcError(t)){await this.client.proposal.delete(r,tr("USER_DISCONNECTED"));const e=v0("session_connect");if(0===this.events.listenerCount(e))throw new Error(`emitting ${e} without any listeners, 954`);this.events.emit(v0("session_connect"),{error:t.error})}},this.onSessionSettleRequest=async(e,t)=>{const{id:r,params:n}=t;try{this.isValidSessionSettleRequest(n);const{relay:r,controller:o,expiry:i,namespaces:s,sessionProperties:a,sessionConfig:c}=t.params,u=m$4(m$4({topic:e,relay:r,expiry:i,namespaces:s,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:o.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:o.publicKey,metadata:o.metadata}},a&&{sessionProperties:a}),c&&{sessionConfig:c});await this.sendResult({id:t.id,topic:e,result:!0,throwOnFailedPublish:!0});const l=v0("session_connect");if(0===this.events.listenerCount(l))throw new Error(`emitting ${l} without any listeners 997`);this.events.emit(v0("session_connect"),{session:u})}catch(o){await this.sendError({id:r,topic:e,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(e,t)=>{const{id:r}=t;isJsonRpcResult(t)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(v0("session_approve",r),{})):isJsonRpcError(t)&&(await this.client.session.delete(e,tr("USER_DISCONNECTED")),this.events.emit(v0("session_approve",r),{error:t.error}))},this.onSessionUpdateRequest=async(e,t)=>{const{params:r,id:n}=t;try{const t=`${e}_session_update`,i=lh.get(t);if(i&&this.isRequestOutOfSync(i,n))return this.client.logger.info(`Discarding out of sync request - ${n}`),void this.sendError({id:n,topic:e,error:tr("INVALID_UPDATE_REQUEST")});this.isValidUpdate(m$4({topic:e},r));try{lh.set(t,n),await this.client.session.update(e,{namespaces:r.namespaces}),await this.sendResult({id:n,topic:e,result:!0,throwOnFailedPublish:!0})}catch(o){throw lh.delete(t),o}this.client.events.emit("session_update",{id:n,topic:e,params:r})}catch(i){await this.sendError({id:n,topic:e,error:i}),this.client.logger.error(i)}},this.isRequestOutOfSync=(e,t)=>parseInt(t.toString().slice(0,-3))<=parseInt(e.toString().slice(0,-3)),this.onSessionUpdateResponse=(e,t)=>{const{id:r}=t,n=v0("session_update",r);if(0===this.events.listenerCount(n))throw new Error(`emitting ${n} without any listeners`);isJsonRpcResult(t)?this.events.emit(v0("session_update",r),{}):isJsonRpcError(t)&&this.events.emit(v0("session_update",r),{error:t.error})},this.onSessionExtendRequest=async(e,t)=>{const{id:r}=t;try{this.isValidExtend({topic:e}),await this.setExpiry(e,d0($$4)),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:r,topic:e})}catch(n){await this.sendError({id:r,topic:e,error:n}),this.client.logger.error(n)}},this.onSessionExtendResponse=(e,t)=>{const{id:r}=t,n=v0("session_extend",r);if(0===this.events.listenerCount(n))throw new Error(`emitting ${n} without any listeners`);isJsonRpcResult(t)?this.events.emit(v0("session_extend",r),{}):isJsonRpcError(t)&&this.events.emit(v0("session_extend",r),{error:t.error})},this.onSessionPingRequest=async(e,t)=>{const{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:r,topic:e})}catch(n){await this.sendError({id:r,topic:e,error:n}),this.client.logger.error(n)}},this.onSessionPingResponse=(e,t)=>{const{id:r}=t,n=v0("session_ping",r);if(0===this.events.listenerCount(n))throw new Error(`emitting ${n} without any listeners`);setTimeout((()=>{isJsonRpcResult(t)?this.events.emit(v0("session_ping",r),{}):isJsonRpcError(t)&&this.events.emit(v0("session_ping",r),{error:t.error})}),500)},this.onSessionDeleteRequest=async(e,t)=>{const{id:r}=t;try{this.isValidDisconnect({topic:e,reason:t.params}),await Promise.all([new Promise((t=>{this.client.core.relayer.once(f$3.publish,(async()=>{t(await this.deleteSession({topic:e,id:r}))}))})),this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:tr("USER_DISCONNECTED")})])}catch(n){this.client.logger.error(n)}},this.onSessionRequest=async(e,t)=>{var r;const{id:n,params:o}=t;try{await this.isValidRequest(m$4({topic:e},o));const t=yu(JSON.stringify(formatJsonRpcRequest("wc_sessionRequest",o,n))),i=this.client.session.get(e),s={id:n,topic:e,params:o,verifyContext:await this.getVerifyContext(t,i.peer.metadata)};await this.setPendingSessionRequest(s),null!=(r=this.client.signConfig)&&r.disableRequestQueue?this.emitSessionRequest(s):(this.addSessionRequestToSessionRequestQueue(s),this.processSessionRequestQueue())}catch(i){await this.sendError({id:n,topic:e,error:i}),this.client.logger.error(i)}},this.onSessionRequestResponse=(e,t)=>{const{id:r}=t,n=v0("session_request",r);if(0===this.events.listenerCount(n))throw new Error(`emitting ${n} without any listeners`);isJsonRpcResult(t)?this.events.emit(v0("session_request",r),{result:t.result}):isJsonRpcError(t)&&this.events.emit(v0("session_request",r),{error:t.error})},this.onSessionEventRequest=async(e,t)=>{const{id:r,params:n}=t;try{const t=`${e}_session_event_${n.event.name}`,o=lh.get(t);if(o&&this.isRequestOutOfSync(o,r))return void this.client.logger.info(`Discarding out of sync request - ${r}`);this.isValidEmit(m$4({topic:e},n)),this.client.events.emit("session_event",{id:r,topic:e,params:n}),lh.set(t,r)}catch(o){await this.sendError({id:r,topic:e,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(e,t)=>{const{id:r}=t;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:t}),isJsonRpcResult(t)?this.events.emit(v0("session_request",r),{result:t.result}):isJsonRpcError(t)&&this.events.emit(v0("session_request",r),{error:t.error})},this.onSessionAuthenticateRequest=async(e,t)=>{try{const{requester:r,authPayload:n,expiryTimestamp:o}=t.params,i=yu(JSON.stringify(t)),s=await this.getVerifyContext(i,this.client.metadata),a={requester:r,pairingTopic:e,id:t.id,authPayload:n,verifyContext:s,expiryTimestamp:o};await this.setAuthRequest(t.id,{request:a,pairingTopic:e}),this.client.events.emit("session_authenticate",{topic:e,params:t.params,id:t.id,verifyContext:s})}catch(r){this.client.logger.error(r);const n=t.params.requester.publicKey,o=await this.client.core.crypto.generateKeyPair(),i={type:lr,receiverPublicKey:n,senderPublicKey:o};await this.sendError({id:t.id,topic:e,error:r,encodeOpts:i,rpcOpts:R$3.wc_sessionAuthenticate.autoReject})}},this.addSessionRequestToSessionRequestQueue=e=>{this.sessionRequestQueue.queue.push(e)},this.cleanupAfterResponse=e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout((()=>{this.sessionRequestQueue.state=D$5.idle,this.processSessionRequestQueue()}),cjs$a.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:e,error:t})=>{const r=this.client.core.history.pending;r.length>0&&r.filter((t=>t.topic===e&&"wc_sessionRequest"===t.request.method)).forEach((e=>{const r=v0("session_request",e.request.id);if(0===this.events.listenerCount(r))throw new Error(`emitting ${r} without any listeners`);this.events.emit(v0("session_request",e.request.id),{error:t})}))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===D$5.active)return void this.client.logger.info("session request queue is already active.");const e=this.sessionRequestQueue.queue[0];if(e)try{this.sessionRequestQueue.state=D$5.active,this.emitSessionRequest(e)}catch(e2){this.client.logger.error(e2)}else this.client.logger.info("session request queue is empty.")},this.emitSessionRequest=e=>{this.client.events.emit("session_request",e)},this.onPairingCreated=e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;const t=this.client.proposal.getAll().find((t=>t.pairingTopic===e.topic));t&&this.onSessionProposeRequest(e.topic,formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces,relays:t.relays,proposer:t.proposer,sessionProperties:t.sessionProperties},t.id))},this.isValidConnect=async e=>{if(!$u(e)){const{message:t}=xe$1("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(t)}const{pairingTopic:t,requiredNamespaces:r,optionalNamespaces:n,sessionProperties:o,relays:i}=e;if(Pe$1(t)||await this.isValidPairingTopic(t),!Xu(i)){const{message:e}=xe$1("MISSING_OR_INVALID",`connect() relays: ${i}`);throw new Error(e)}!Pe$1(r)&&0!==Yr(r)&&this.validateNamespaces(r,"requiredNamespaces"),!Pe$1(n)&&0!==Yr(n)&&this.validateNamespaces(n,"optionalNamespaces"),Pe$1(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(e,t)=>{const r=Wu(e,"connect()",t);if(r)throw new Error(r.message)},this.isValidApprove=async e=>{if(!$u(e))throw new Error(xe$1("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:t,namespaces:r,relayProtocol:n,sessionProperties:o}=e;this.checkRecentlyDeleted(t),await this.isValidProposalId(t);const i=this.client.proposal.get(t),s=So$1(r,"approve()");if(s)throw new Error(s.message);const a=Io$1(i.requiredNamespaces,r,"approve()");if(a)throw new Error(a.message);if(!Gt$1(n,!0)){const{message:e}=xe$1("MISSING_OR_INVALID",`approve() relayProtocol: ${n}`);throw new Error(e)}Pe$1(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async e=>{if(!$u(e)){const{message:t}=xe$1("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(t)}const{id:t,reason:r}=e;if(this.checkRecentlyDeleted(t),await this.isValidProposalId(t),!th(r)){const{message:e}=xe$1("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(r)}`);throw new Error(e)}},this.isValidSessionSettleRequest=e=>{if(!$u(e)){const{message:t}=xe$1("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(t)}const{relay:t,controller:r,namespaces:n,expiry:o}=e;if(!No$1(t)){const{message:e}=xe$1("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(e)}const i=Vu(r,"onSessionSettleRequest()");if(i)throw new Error(i.message);const s=So$1(n,"onSessionSettleRequest()");if(s)throw new Error(s.message);if(p0(o)){const{message:e}=xe$1("EXPIRED","onSessionSettleRequest()");throw new Error(e)}},this.isValidUpdate=async e=>{if(!$u(e)){const{message:t}=xe$1("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(t)}const{topic:t,namespaces:r}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);const n=this.client.session.get(t),o=So$1(r,"update()");if(o)throw new Error(o.message);const i=Io$1(n.requiredNamespaces,r,"update()");if(i)throw new Error(i.message)},this.isValidExtend=async e=>{if(!$u(e)){const{message:t}=xe$1("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(t)}const{topic:t}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t)},this.isValidRequest=async e=>{if(!$u(e)){const{message:t}=xe$1("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(t)}const{topic:t,request:r,chainId:n,expiry:o}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);const{namespaces:i}=this.client.session.get(t);if(!nh(i,n)){const{message:e}=xe$1("MISSING_OR_INVALID",`request() chainId: ${n}`);throw new Error(e)}if(!eh(r)){const{message:e}=xe$1("MISSING_OR_INVALID",`request() ${JSON.stringify(r)}`);throw new Error(e)}if(!fh(i,n,r.method)){const{message:e}=xe$1("MISSING_OR_INVALID",`request() method: ${r.method}`);throw new Error(e)}if(o&&!uh(o,ne$2)){const{message:e}=xe$1("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${ne$2.min} and ${ne$2.max}`);throw new Error(e)}},this.isValidRespond=async e=>{var t;if(!$u(e)){const{message:t}=xe$1("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(t)}const{topic:r,response:n}=e;try{await this.isValidSessionTopic(r)}catch(o){throw null!=(t=null==e?void 0:e.response)&&t.id&&this.cleanupAfterResponse(e),o}if(!rh(n)){const{message:e}=xe$1("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(n)}`);throw new Error(e)}},this.isValidPing=async e=>{if(!$u(e)){const{message:t}=xe$1("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.isValidEmit=async e=>{if(!$u(e)){const{message:t}=xe$1("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(t)}const{topic:t,event:r,chainId:n}=e;await this.isValidSessionTopic(t);const{namespaces:o}=this.client.session.get(t);if(!nh(o,n)){const{message:e}=xe$1("MISSING_OR_INVALID",`emit() chainId: ${n}`);throw new Error(e)}if(!ih(r)){const{message:e}=xe$1("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw new Error(e)}if(!oh(o,n,r.name)){const{message:e}=xe$1("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw new Error(e)}},this.isValidDisconnect=async e=>{if(!$u(e)){const{message:t}=xe$1("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(t)}const{topic:t}=e;await this.isValidSessionOrPairingTopic(t)},this.isValidAuthenticate=e=>{const{chains:t,uri:r,domain:n,nonce:o}=e;if(!Array.isArray(t)||0===t.length)throw new Error("chains is required and must be a non-empty array");if(!Gt$1(r,!1))throw new Error("uri is required parameter");if(!Gt$1(n,!1))throw new Error("domain is required parameter");if(!Gt$1(o,!1))throw new Error("nonce is required parameter");if([...new Set(t.map((e=>dn(e).namespace)))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:i}=dn(t[0]);if("eip155"!==i)throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async(e,t)=>{const r={verified:{verifyUrl:t.verifyUrl||V$5,validation:"UNKNOWN",origin:t.url||""}};try{const n=await this.client.core.verify.resolve({attestationId:e,verifyUrl:t.verifyUrl});n&&(r.verified.origin=n.origin,r.verified.isScam=n.isScam,r.verified.validation=n.origin===new URL(t.url).origin?"VALID":"INVALID")}catch(n){this.client.logger.info(n)}return this.client.logger.info(`Verify context: ${JSON.stringify(r)}`),r},this.validateSessionProps=(e,t)=>{Object.values(e).forEach((e=>{if(!Gt$1(e,!1)){const{message:r}=xe$1("MISSING_OR_INVALID",`${t} must be in Record<string, string> format. Received: ${JSON.stringify(e)}`);throw new Error(r)}}))},this.getPendingAuthRequest=e=>{const t=this.client.auth.requests.get(e);return"object"==typeof t?t:void 0},this.addToRecentlyDeleted=(e,t)=>{if(this.recentlyDeletedMap.set(e,t),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let e=0;const t=this.recentlyDeletedLimit/2;for(const r of this.recentlyDeletedMap.keys()){if(e++>=t)break;this.recentlyDeletedMap.delete(r)}}},this.checkRecentlyDeleted=e=>{const t=this.recentlyDeletedMap.get(e);if(t){const{message:r}=xe$1("MISSING_OR_INVALID",`Record was recently deleted - ${t}: ${e}`);throw new Error(r)}}}async isInitialized(){if(!this.initialized){const{message:e}=xe$1("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(f$3.message,(e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)}))}async onRelayMessage(e){const{topic:t,message:r}=e,{publicKey:n}=this.client.auth.authKeys.keys.includes(B$4)?this.client.auth.authKeys.get(B$4):{responseTopic:void 0,publicKey:void 0},o=await this.client.core.crypto.decode(t,r,{receiverPublicKey:n});try{isJsonRpcRequest(o)?(this.client.core.history.set(t,o),this.onRelayEventRequest({topic:t,payload:o})):isJsonRpcResponse(o)?(await this.client.core.history.resolve(o),await this.onRelayEventResponse({topic:t,payload:o}),this.client.core.history.delete(t,o.id)):this.onRelayEventUnknownPayload({topic:t,payload:o})}catch(i){this.client.logger.error(i)}}registerExpirerEvents(){this.client.core.expirer.on(C$4.expired,(async e=>{const{topic:t,id:r}=l0(e.target);return r&&this.client.pendingRequest.keys.includes(r)?await this.deletePendingSessionRequest(r,xe$1("EXPIRED"),!0):r&&this.client.auth.requests.keys.includes(r)?await this.deletePendingAuthRequest(r,xe$1("EXPIRED"),!0):void(t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r})))}))}registerPairingEvents(){this.client.core.pairing.events.on(q$4.create,(e=>this.onPairingCreated(e))),this.client.core.pairing.events.on(q$4.delete,(e=>{this.addToRecentlyDeleted(e.topic,"pairing")}))}isValidPairingTopic(e){if(!Gt$1(e,!1)){const{message:t}=xe$1("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}=xe$1("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(p0(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=xe$1("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!Gt$1(e,!1)){const{message:t}=xe$1("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}=xe$1("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(p0(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:t}=xe$1("EXPIRED",`session topic: ${e}`);throw new Error(t)}if(!this.client.core.crypto.keychain.has(e)){const{message:t}=xe$1("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)){if(Gt$1(e,!1)){const{message:t}=xe$1("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}{const{message:t}=xe$1("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}this.isValidPairingTopic(e)}}async isValidProposalId(e){if(!Zu(e)){const{message:t}=xe$1("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=xe$1("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(p0(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:t}=xe$1("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}},es$1=class extends kt$2{constructor(e,t){super(e,t,Ue$1,ie$1),this.core=e,this.logger=t}};class Ze extends kt$2{constructor(e,t){super(e,t,ke$1,ie$1),this.core=e,this.logger=t}}class ts extends kt$2{constructor(e,t){super(e,t,Fe$1,ie$1,(e=>e.id)),this.core=e,this.logger=t}}class ss extends kt$2{constructor(e,t){super(e,t,Ye$1,J$2,(()=>B$4)),this.core=e,this.logger=t}}class is extends kt$2{constructor(e,t){super(e,t,Xe,J$2),this.core=e,this.logger=t}}class rs extends kt$2{constructor(e,t){super(e,t,Je,J$2,(e=>e.id)),this.core=e,this.logger=t}}class ns{constructor(e,t){this.core=e,this.logger=t,this.authKeys=new ss(this.core,this.logger),this.pairingTopics=new is(this.core,this.logger),this.requests=new rs(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}let oe$2=class e extends b$2{constructor(e){super(e),this.protocol=Ee$1,this.version=Se,this.name=re$1.name,this.events=new eventsExports.EventEmitter,this.on=(e,t)=>this.events.on(e,t),this.once=(e,t)=>this.events.once(e,t),this.off=(e,t)=>this.events.off(e,t),this.removeListener=(e,t)=>this.events.removeListener(e,t),this.removeAllListeners=e=>this.events.removeAllListeners(e),this.connect=async e=>{try{return await this.engine.connect(e)}catch(t){throw this.logger.error(t.message),t}},this.pair=async e=>{try{return await this.engine.pair(e)}catch(t){throw this.logger.error(t.message),t}},this.approve=async e=>{try{return await this.engine.approve(e)}catch(t){throw this.logger.error(t.message),t}},this.reject=async e=>{try{return await this.engine.reject(e)}catch(t){throw this.logger.error(t.message),t}},this.update=async e=>{try{return await this.engine.update(e)}catch(t){throw this.logger.error(t.message),t}},this.extend=async e=>{try{return await this.engine.extend(e)}catch(t){throw this.logger.error(t.message),t}},this.request=async e=>{try{return await this.engine.request(e)}catch(t){throw this.logger.error(t.message),t}},this.respond=async e=>{try{return await this.engine.respond(e)}catch(t){throw this.logger.error(t.message),t}},this.ping=async e=>{try{return await this.engine.ping(e)}catch(t){throw this.logger.error(t.message),t}},this.emit=async e=>{try{return await this.engine.emit(e)}catch(t){throw this.logger.error(t.message),t}},this.disconnect=async e=>{try{return await this.engine.disconnect(e)}catch(t){throw this.logger.error(t.message),t}},this.find=e=>{try{return this.engine.find(e)}catch(t){throw this.logger.error(t.message),t}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(e2){throw this.logger.error(e2.message),e2}},this.authenticate=async e=>{try{return await this.engine.authenticate(e)}catch(t){throw this.logger.error(t.message),t}},this.formatAuthMessage=e=>{try{return this.engine.formatAuthMessage(e)}catch(t){throw this.logger.error(t.message),t}},this.approveSessionAuthenticate=async e=>{try{return await this.engine.approveSessionAuthenticate(e)}catch(t){throw this.logger.error(t.message),t}},this.rejectSessionAuthenticate=async e=>{try{return await this.engine.rejectSessionAuthenticate(e)}catch(t){throw this.logger.error(t.message),t}},this.name=(null==e?void 0:e.name)||re$1.name,this.metadata=(null==e?void 0:e.metadata)||Xo$1(),this.signConfig=null==e?void 0:e.signConfig;const t=typeof(null==e?void 0:e.logger)<"u"&&"string"!=typeof(null==e?void 0:e.logger)?e.logger:ot$2(k$4({level:(null==e?void 0:e.logger)||re$1.logger}));this.core=(null==e?void 0:e.core)||new Mr(e),this.logger=E$7(t,this.name),this.session=new Ze(this.core,this.logger),this.proposal=new es$1(this.core,this.logger),this.pendingRequest=new ts(this.core,this.logger),this.engine=new Zt$1(this),this.auth=new ns(this.core,this.logger)}static async init(t){const r=new e(t);return await r.initialize(),r}get context(){return y$7(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(),await this.auth.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}};var cjs$2={},cjs$1={};Object.defineProperty(cjs$1,"__esModule",{value:!0});var getLocalStorage_1=cjs$1.getLocalStorage=getLocalStorageOrThrow_1=cjs$1.getLocalStorageOrThrow=getCrypto_1=cjs$1.getCrypto=getCryptoOrThrow_1=cjs$1.getCryptoOrThrow=getLocation_1=cjs$1.getLocation=getLocationOrThrow_1=cjs$1.getLocationOrThrow=getNavigator_1=cjs$1.getNavigator=getNavigatorOrThrow_1=cjs$1.getNavigatorOrThrow=getDocument_1=cjs$1.getDocument=getDocumentOrThrow_1=cjs$1.getDocumentOrThrow=getFromWindowOrThrow_1=cjs$1.getFromWindowOrThrow=getFromWindow_1=cjs$1.getFromWindow=void 0;function getFromWindow$1(e){let t;return"undefined"!=typeof window&&void 0!==window[e]&&(t=window[e]),t}var getFromWindow_1=cjs$1.getFromWindow=getFromWindow$1;function getFromWindowOrThrow$1(e){const t=getFromWindow$1(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}var getFromWindowOrThrow_1=cjs$1.getFromWindowOrThrow=getFromWindowOrThrow$1;function getDocumentOrThrow$1(){return getFromWindowOrThrow$1("document")}var getDocumentOrThrow_1=cjs$1.getDocumentOrThrow=getDocumentOrThrow$1;function getDocument$1(){return getFromWindow$1("document")}var getDocument_1=cjs$1.getDocument=getDocument$1;function getNavigatorOrThrow$1(){return getFromWindowOrThrow$1("navigator")}var getNavigatorOrThrow_1=cjs$1.getNavigatorOrThrow=getNavigatorOrThrow$1;function getNavigator$1(){return getFromWindow$1("navigator")}var getNavigator_1=cjs$1.getNavigator=getNavigator$1;function getLocationOrThrow$1(){return getFromWindowOrThrow$1("location")}var getLocationOrThrow_1=cjs$1.getLocationOrThrow=getLocationOrThrow$1;function getLocation$1(){return getFromWindow$1("location")}var getLocation_1=cjs$1.getLocation=getLocation$1;function getCryptoOrThrow$1(){return getFromWindowOrThrow$1("crypto")}var getCryptoOrThrow_1=cjs$1.getCryptoOrThrow=getCryptoOrThrow$1;function getCrypto$1(){return getFromWindow$1("crypto")}var getCrypto_1=cjs$1.getCrypto=getCrypto$1;function getLocalStorageOrThrow$1(){return getFromWindowOrThrow$1("localStorage")}var getLocalStorageOrThrow_1=cjs$1.getLocalStorageOrThrow=getLocalStorageOrThrow$1;function getLocalStorage$1(){return getFromWindow$1("localStorage")}getLocalStorage_1=cjs$1.getLocalStorage=getLocalStorage$1,Object.defineProperty(cjs$2,"__esModule",{value:!0});var getWindowMetadata_1=cjs$2.getWindowMetadata=void 0;const window_getters_1=cjs$1;function getWindowMetadata(){let e,t;try{e=window_getters_1.getDocumentOrThrow(),t=window_getters_1.getLocationOrThrow()}catch(e2){return null}function r(...t){const r=e.getElementsByTagName("meta");for(let e=0;e<r.length;e++){const n=r[e],o=["itemprop","property","name"].map((e=>n.getAttribute(e))).filter((e=>!!e&&t.includes(e)));if(o.length&&o){const e=n.getAttribute("content");if(e)return e}}return""}const n=function(){let t=r("name","og:site_name","og:title","twitter:title");return t||(t=e.title),t}();return{description:r("description","og:description","twitter:description","keywords"),url:t.origin,icons:function(){const r=e.getElementsByTagName("link"),n=[];for(let e=0;e<r.length;e++){const o=r[e],i=o.getAttribute("rel");if(i&&i.toLowerCase().indexOf("icon")>-1){const e=o.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let r=t.protocol+"//"+t.host;if(0===e.indexOf("/"))r+=e;else{const n=t.pathname.split("/");n.pop();r+=n.join("/")+"/"+e}n.push(r)}else if(0===e.indexOf("//")){const r=t.protocol+e;n.push(r)}else n.push(e)}}return n}(),name:n}}getWindowMetadata_1=cjs$2.getWindowMetadata=getWindowMetadata;var __spreadArrays=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var i=arguments[t],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n},BrowserInfo=function(){return function(e,t,r){this.name=e,this.version=t,this.os=r,this.type="browser"}}(),NodeInfo=function(){return function(e){this.version=e,this.type="node",this.name="node",this.os=process$1.platform}}(),SearchBotDeviceInfo=function(){return function(e,t,r,n){this.name=e,this.version=t,this.os=r,this.bot=n,this.type="bot-device"}}(),BotInfo=function(){return function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}}(),ReactNativeInfo=function(){return function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}}(),SEARCHBOX_UA_REGEX=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,SEARCHBOT_OS_REGEX=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,REQUIRED_VERSION_PARTS=3,userAgentRules=[["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|$)/],["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",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",SEARCHBOX_UA_REGEX]],operatingSystemRules=[["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/],["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 detect(e){return e?parseUserAgent(e):"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new ReactNativeInfo:"undefined"!=typeof navigator?parseUserAgent(navigator.userAgent):getNodeVersion()}function matchUserAgent(e){return""!==e&&userAgentRules.reduce((function(t,r){var n=r[0],o=r[1];if(t)return t;var i=o.exec(e);return!!i&&[n,i]}),!1)}function parseUserAgent(e){var t=matchUserAgent(e);if(!t)return null;var r=t[0],n=t[1];if("searchbot"===r)return new BotInfo;var o=n[1]&&n[1].split(/[._]/).slice(0,3);o?o.length<REQUIRED_VERSION_PARTS&&(o=__spreadArrays(o,createVersionParts(REQUIRED_VERSION_PARTS-o.length))):o=[];var i=o.join("."),s=detectOS$1(e),a=SEARCHBOT_OS_REGEX.exec(e);return a&&a[1]?new SearchBotDeviceInfo(r,i,s,a[1]):new BrowserInfo(r,i,s)}function detectOS$1(e){for(var t=0,r=operatingSystemRules.length;t<r;t++){var n=operatingSystemRules[t],o=n[0];if(n[1].exec(e))return o}return null}function getNodeVersion(){return void 0!==process$1&&process$1.version?new NodeInfo(process$1.version.slice(1)):null}function createVersionParts(e){for(var t=[],r=0;r<e;r++)t.push("0");return t}function detectEnv(e){return detect(e)}function detectOS(){const e=detectEnv();return e&&e.os?e.os:void 0}function isAndroid(){const e=detectOS();return!!e&&e.toLowerCase().includes("android")}function isIOS(){const e=detectOS();return!!e&&(e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1)}function isMobile(){return!!detectOS()&&(isAndroid()||isIOS())}function isNode$1(){const e=detectEnv();return!(!e||!e.name)&&"node"===e.name.toLowerCase()}function isBrowser(){return!isNode$1()&&!!getNavigator()}const getFromWindow=getFromWindow_1,getFromWindowOrThrow=getFromWindowOrThrow_1,getDocumentOrThrow=getDocumentOrThrow_1,getDocument=getDocument_1,getNavigatorOrThrow=getNavigatorOrThrow_1,getNavigator=getNavigator_1,getLocationOrThrow=getLocationOrThrow_1,getLocation=getLocation_1,getCryptoOrThrow=getCryptoOrThrow_1,getCrypto=getCrypto_1,getLocalStorageOrThrow=getLocalStorageOrThrow_1,getLocalStorage=getLocalStorage_1;function getClientMeta(){return getWindowMetadata_1()}function safeJsonParse$1(e){if("string"!=typeof e)throw new Error("Cannot safe json parse value of type "+typeof e);try{return JSON.parse(e)}catch(t){return e}}function safeJsonStringify$1(e){return"string"==typeof e?e:JSON.stringify(e)}const safeJsonParse=safeJsonParse$1,safeJsonStringify=safeJsonStringify$1;function setLocal(e,t){const r=safeJsonStringify(t),n=getLocalStorage();n&&n.setItem(e,r)}function getLocal(e){let t=null,r=null;const n=getLocalStorage();return n&&(r=n.getItem(e)),t=r?safeJsonParse(r):r,t}function removeLocal(e){const t=getLocalStorage();t&&t.removeItem(e)}const mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function formatIOSMobile(e,t){const r=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${r}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${r}`:""}function saveMobileLinkInfo(e){const t=e.href.split("?")[0];setLocal(mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}function getMobileRegistryEntry(e,t){return e.filter((e=>e.name.toLowerCase().includes(t.toLowerCase())))[0]}function getMobileLinkRegistry(e,t){let r=e;return t&&(r=t.map((t=>getMobileRegistryEntry(e,t))).filter(Boolean)),r}const API_URL="https://registry.walletconnect.com";function getWalletRegistryUrl(){return API_URL+"/api/v2/wallets"}function getDappRegistryUrl(){return API_URL+"/api/v2/dapps"}function formatMobileRegistryEntry(e,t="mobile"){var r;return{name:e.name||"",shortName:e.metadata.shortName||"",color:e.metadata.colors.primary||"",logo:null!==(r=e.image_url.sm)&&void 0!==r?r:"",universalLink:e[t].universal||"",deepLink:e[t].native||""}}function formatMobileRegistry(e,t="mobile"){return Object.values(e).filter((e=>!!e[t].universal||!!e[t].native)).map((e=>formatMobileRegistryEntry(e,t)))}const esm=Object.freeze(Object.defineProperty({__proto__:null,detectEnv:detectEnv,detectOS:detectOS,formatIOSMobile:formatIOSMobile,formatMobileRegistry:formatMobileRegistry,formatMobileRegistryEntry:formatMobileRegistryEntry,getClientMeta:getClientMeta,getCrypto:getCrypto,getCryptoOrThrow:getCryptoOrThrow,getDappRegistryUrl:getDappRegistryUrl,getDocument:getDocument,getDocumentOrThrow:getDocumentOrThrow,getFromWindow:getFromWindow,getFromWindowOrThrow:getFromWindowOrThrow,getLocal:getLocal,getLocalStorage:getLocalStorage,getLocalStorageOrThrow:getLocalStorageOrThrow,getLocation:getLocation,getLocationOrThrow:getLocationOrThrow,getMobileLinkRegistry:getMobileLinkRegistry,getMobileRegistryEntry:getMobileRegistryEntry,getNavigator:getNavigator,getNavigatorOrThrow:getNavigatorOrThrow,getWalletRegistryUrl:getWalletRegistryUrl,isAndroid:isAndroid,isBrowser:isBrowser,isIOS:isIOS,isMobile:isMobile,isNode:isNode$1,mobileLinkChoiceKey:mobileLinkChoiceKey,removeLocal:removeLocal,safeJsonParse:safeJsonParse,safeJsonStringify:safeJsonStringify,saveMobileLinkInfo:saveMobileLinkInfo,setLocal:setLocal},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(esm);var browser$1={},canPromise$3=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then},qrcode$1={},typedarrayBuffer={},toString={}.toString,isarray=Array.isArray||function(e){return"[object Array]"==toString.call(e)},isArray$1=isarray;function typedArraySupport(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e2){return!1}}Buffer$1.TYPED_ARRAY_SUPPORT=typedArraySupport();var K_MAX_LENGTH=Buffer$1.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function Buffer$1(e,t,r){return Buffer$1.TYPED_ARRAY_SUPPORT||this instanceof Buffer$1?"number"==typeof e?allocUnsafe(this,e):from(this,e,t,r):new Buffer$1(e,t,r)}function checked(e){if(e>=K_MAX_LENGTH)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K_MAX_LENGTH.toString(16)+" bytes");return 0|e}function isnan(e){return e!=e}function createBuffer(e,t){var r;return Buffer$1.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(t)).__proto__=Buffer$1.prototype:(null===(r=e)&&(r=new Buffer$1(t)),r.length=t),r}function allocUnsafe(e,t){var r=createBuffer(e,t<0?0:0|checked(t));if(!Buffer$1.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)r[n]=0;return r}function fromString(e,t){var r=0|byteLength(t),n=createBuffer(e,r),o=n.write(t);return o!==r&&(n=n.slice(0,o)),n}function fromArrayLike(e,t){for(var r=t.length<0?0:0|checked(t.length),n=createBuffer(e,r),o=0;o<r;o+=1)n[o]=255&t[o];return n}function fromArrayBuffer(e,t,r,n){if(r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");var o;return o=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n),Buffer$1.TYPED_ARRAY_SUPPORT?o.__proto__=Buffer$1.prototype:o=fromArrayLike(e,o),o}function fromObject(e,t){if(Buffer$1.isBuffer(t)){var r=0|checked(t.length),n=createBuffer(e,r);return 0===n.length||t.copy(n,0,0,r),n}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||isnan(t.length)?createBuffer(e,0):fromArrayLike(e,t);if("Buffer"===t.type&&Array.isArray(t.data))return fromArrayLike(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function utf8ToBytes(e,t){var r;t=t||1/0;for(var n=e.length,o=null,i=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function byteLength(e){return Buffer$1.isBuffer(e)?e.length:"undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)?e.byteLength:("string"!=typeof e&&(e=""+e),0===e.length?0:utf8ToBytes(e).length)}function blitBuffer(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function utf8Write(e,t,r,n){return blitBuffer(utf8ToBytes(t,e.length-r),e,r,n)}function from(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?fromArrayBuffer(e,t,r,n):"string"==typeof t?fromString(e,t):fromObject(e,t)}Buffer$1.TYPED_ARRAY_SUPPORT&&(Buffer$1.prototype.__proto__=Uint8Array.prototype,Buffer$1.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Buffer$1[Symbol.species]===Buffer$1&&Object.defineProperty(Buffer$1,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1})),Buffer$1.prototype.write=function(e,t,r){void 0===t||void 0===r&&"string"==typeof t?(r=this.length,t=0):isFinite(t)&&(t|=0,isFinite(r)?r|=0:r=void 0);var n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");return utf8Write(this,e,t,r)},Buffer$1.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),Buffer$1.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=Buffer$1.prototype;else{var o=t-e;r=new Buffer$1(o,void 0);for(var i=0;i<o;++i)r[i]=this[i+e]}return r},Buffer$1.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var o,i=n-r;if(this===e&&r<t&&t<n)for(o=i-1;o>=0;--o)e[o+t]=this[o+r];else if(i<1e3||!Buffer$1.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+i),t);return i},Buffer$1.prototype.fill=function(e,t,r){if("string"==typeof e){if("string"==typeof t?(t=0,r=this.length):"string"==typeof r&&(r=this.length),1===e.length){var n=e.charCodeAt(0);n<256&&(e=n)}}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var i=Buffer$1.isBuffer(e)?e:new Buffer$1(e),s=i.length;for(o=0;o<r-t;++o)this[o+t]=i[o%s]}return this},Buffer$1.concat=function(e,t){if(!isArray$1(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return createBuffer(null,0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=allocUnsafe(null,t),o=0;for(r=0;r<e.length;++r){var i=e[r];if(!Buffer$1.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o),o+=i.length}return n},Buffer$1.byteLength=byteLength,Buffer$1.prototype._isBuffer=!0,Buffer$1.isBuffer=function(e){return!(null==e||!e._isBuffer)},typedarrayBuffer.alloc=function(e){var t=new Buffer$1(e);return t.fill(0),t},typedarrayBuffer.from=function(e){return new Buffer$1(e)};var utils$3={},toSJISFunction$1,CODEWORDS_COUNT$1=[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];utils$3.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 4*e+17},utils$3.getSymbolTotalCodewords=function(e){return CODEWORDS_COUNT$1[e]},utils$3.getBCHDigit=function(e){for(var t=0;0!==e;)t++,e>>>=1;return t},utils$3.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');toSJISFunction$1=e},utils$3.isKanjiModeEnabled=function(){return void 0!==toSJISFunction$1},utils$3.toSJIS=function(e){return toSJISFunction$1(e)};var errorCorrectionLevel$1={};function BitBuffer$3(){this.buffer=[],this.length=0}!function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2},e.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},e.from=function(t,r){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+t)}}(t)}catch(e2){return r}}}(errorCorrectionLevel$1),BitBuffer$3.prototype={get:function(e){var t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(var r=0;r<t;r++)this.putBit(1==(e>>>t-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var bitBuffer$1=BitBuffer$3,BufferUtil$4=typedarrayBuffer;function BitMatrix$3(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=BufferUtil$4.alloc(e*e),this.reservedBit=BufferUtil$4.alloc(e*e)}BitMatrix$3.prototype.set=function(e,t,r,n){var o=e*this.size+t;this.data[o]=r,n&&(this.reservedBit[o]=!0)},BitMatrix$3.prototype.get=function(e,t){return this.data[e*this.size+t]},BitMatrix$3.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r},BitMatrix$3.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var bitMatrix$1=BitMatrix$3,alignmentPattern$1={};!function(e){var t=utils$3.getSymbolSize;e.getRowColCoords=function(e){if(1===e)return[];for(var r=Math.floor(e/7)+2,n=t(e),o=145===n?26:2*Math.ceil((n-13)/(2*r-2)),i=[n-7],s=1;s<r-1;s++)i[s]=i[s-1]-o;return i.push(6),i.reverse()},e.getPositions=function(t){for(var r=[],n=e.getRowColCoords(t),o=n.length,i=0;i<o;i++)for(var s=0;s<o;s++)0===i&&0===s||0===i&&s===o-1||i===o-1&&0===s||r.push([n[i],n[s]]);return r}}(alignmentPattern$1);var finderPattern$1={},getSymbolSize$1=utils$3.getSymbolSize,FINDER_PATTERN_SIZE$1=7;finderPattern$1.getPositions=function(e){var t=getSymbolSize$1(e);return[[0,0],[t-FINDER_PATTERN_SIZE$1,0],[0,t-FINDER_PATTERN_SIZE$1]]};var maskPattern$1={};!function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t=3,r=3,n=40,o=10;function i(t,r,n){switch(t){case e.Patterns.PATTERN000:return(r+n)%2==0;case e.Patterns.PATTERN001:return r%2==0;case e.Patterns.PATTERN010:return n%3==0;case e.Patterns.PATTERN011:return(r+n)%3==0;case e.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(n/3))%2==0;case e.Patterns.PATTERN101:return r*n%2+r*n%3==0;case e.Patterns.PATTERN110:return(r*n%2+r*n%3)%2==0;case e.Patterns.PATTERN111:return(r*n%3+(r+n)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}}e.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){for(var r=e.size,n=0,o=0,i=0,s=null,a=null,c=0;c<r;c++){o=i=0,s=a=null;for(var u=0;u<r;u++){var l=e.get(c,u);l===s?o++:(o>=5&&(n+=t+(o-5)),s=l,o=1),(l=e.get(u,c))===a?i++:(i>=5&&(n+=t+(i-5)),a=l,i=1)}o>=5&&(n+=t+(o-5)),i>=5&&(n+=t+(i-5))}return n},e.getPenaltyN2=function(e){for(var t=e.size,n=0,o=0;o<t-1;o++)for(var i=0;i<t-1;i++){var s=e.get(o,i)+e.get(o,i+1)+e.get(o+1,i)+e.get(o+1,i+1);4!==s&&0!==s||n++}return n*r},e.getPenaltyN3=function(e){for(var t=e.size,r=0,o=0,i=0,s=0;s<t;s++){o=i=0;for(var a=0;a<t;a++)o=o<<1&2047|e.get(s,a),a>=10&&(1488===o||93===o)&&r++,i=i<<1&2047|e.get(a,s),a>=10&&(1488===i||93===i)&&r++}return r*n},e.getPenaltyN4=function(e){for(var t=0,r=e.data.length,n=0;n<r;n++)t+=e.data[n];return Math.abs(Math.ceil(100*t/r/5)-10)*o},e.applyMask=function(e,t){for(var r=t.size,n=0;n<r;n++)for(var o=0;o<r;o++)t.isReserved(o,n)||t.xor(o,n,i(e,o,n))},e.getBestMask=function(t,r){for(var n=Object.keys(e.Patterns).length,o=0,i=1/0,s=0;s<n;s++){r(s),e.applyMask(s,t);var a=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(s,t),a<i&&(i=a,o=s)}return o}}(maskPattern$1);var errorCorrectionCode$1={},ECLevel$3=errorCorrectionLevel$1,EC_BLOCKS_TABLE$1=[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],EC_CODEWORDS_TABLE$1=[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];errorCorrectionCode$1.getBlocksCount=function(e,t){switch(t){case ECLevel$3.L:return EC_BLOCKS_TABLE$1[4*(e-1)+0];case ECLevel$3.M:return EC_BLOCKS_TABLE$1[4*(e-1)+1];case ECLevel$3.Q:return EC_BLOCKS_TABLE$1[4*(e-1)+2];case ECLevel$3.H:return EC_BLOCKS_TABLE$1[4*(e-1)+3];default:return}},errorCorrectionCode$1.getTotalCodewordsCount=function(e,t){switch(t){case ECLevel$3.L:return EC_CODEWORDS_TABLE$1[4*(e-1)+0];case ECLevel$3.M:return EC_CODEWORDS_TABLE$1[4*(e-1)+1];case ECLevel$3.Q:return EC_CODEWORDS_TABLE$1[4*(e-1)+2];case ECLevel$3.H:return EC_CODEWORDS_TABLE$1[4*(e-1)+3];default:return}};var polynomial$1={},galoisField$1={},BufferUtil$3=typedarrayBuffer,EXP_TABLE$1=BufferUtil$3.alloc(512),LOG_TABLE$1=BufferUtil$3.alloc(256);!function(){for(var e=1,t=0;t<255;t++)EXP_TABLE$1[t]=e,LOG_TABLE$1[e]=t,256&(e<<=1)&&(e^=285);for(t=255;t<512;t++)EXP_TABLE$1[t]=EXP_TABLE$1[t-255]}(),galoisField$1.log=function(e){if(e<1)throw new Error("log("+e+")");return LOG_TABLE$1[e]},galoisField$1.exp=function(e){return EXP_TABLE$1[e]},galoisField$1.mul=function(e,t){return 0===e||0===t?0:EXP_TABLE$1[LOG_TABLE$1[e]+LOG_TABLE$1[t]]},function(e){var t=typedarrayBuffer,r=galoisField$1;e.mul=function(e,n){for(var o=t.alloc(e.length+n.length-1),i=0;i<e.length;i++)for(var s=0;s<n.length;s++)o[i+s]^=r.mul(e[i],n[s]);return o},e.mod=function(e,n){for(var o=t.from(e);o.length-n.length>=0;){for(var i=o[0],s=0;s<n.length;s++)o[s]^=r.mul(n[s],i);for(var a=0;a<o.length&&0===o[a];)a++;o=o.slice(a)}return o},e.generateECPolynomial=function(n){for(var o=t.from([1]),i=0;i<n;i++)o=e.mul(o,[1,r.exp(i)]);return o}}(polynomial$1);var BufferUtil$2=typedarrayBuffer,Polynomial$1=polynomial$1,Buffer=require$$2$1.Buffer;function ReedSolomonEncoder$3(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}ReedSolomonEncoder$3.prototype.initialize=function(e){this.degree=e,this.genPoly=Polynomial$1.generateECPolynomial(this.degree)},ReedSolomonEncoder$3.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");var t=BufferUtil$2.alloc(this.degree),r=Buffer.concat([e,t],e.length+this.degree),n=Polynomial$1.mod(r,this.genPoly),o=this.degree-n.length;if(o>0){var i=BufferUtil$2.alloc(this.degree);return n.copy(i,o),i}return n};var reedSolomonEncoder$1=ReedSolomonEncoder$3,version$1={},mode$1={},versionCheck$1={isValid:function(e){return!isNaN(e)&&e>=1&&e<=40}},regex$1={},numeric$1="[0-9]+",alphanumeric$1="[A-Z $%*+\\-./:]+",kanji$1="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";kanji$1=kanji$1.replace(/u/g,"\\u");var byte$1="(?:(?![A-Z0-9 $%*+\\-./:]|"+kanji$1+")(?:.|[\r\n]))+";regex$1.KANJI=new RegExp(kanji$1,"g"),regex$1.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),regex$1.BYTE=new RegExp(byte$1,"g"),regex$1.NUMERIC=new RegExp(numeric$1,"g"),regex$1.ALPHANUMERIC=new RegExp(alphanumeric$1,"g");var TEST_KANJI$1=new RegExp("^"+kanji$1+"$"),TEST_NUMERIC$1=new RegExp("^"+numeric$1+"$"),TEST_ALPHANUMERIC$1=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");regex$1.testKanji=function(e){return TEST_KANJI$1.test(e)},regex$1.testNumeric=function(e){return TEST_NUMERIC$1.test(e)},regex$1.testAlphanumeric=function(e){return TEST_ALPHANUMERIC$1.test(e)},function(e){var t=versionCheck$1,r=regex$1;e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!t.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return r.testNumeric(t)?e.NUMERIC:r.testAlphanumeric(t)?e.ALPHANUMERIC:r.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},e.isValid=function(e){return e&&e.bit&&e.ccBits},e.from=function(t,r){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(e2){return r}}}(mode$1),function(e){var t=utils$3,r=errorCorrectionCode$1,n=errorCorrectionLevel$1,o=mode$1,i=versionCheck$1,s=isarray,a=t.getBCHDigit(7973);function c(e,t){return o.getCharCountIndicator(e,t)+4}function u(e,t){var r=0;return e.forEach((function(e){var n=c(e.mode,t);r+=n+e.getBitsLength()})),r}e.from=function(e,t){return i.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,n,s){if(!i.isValid(e))throw new Error("Invalid QR Code version");void 0===s&&(s=o.BYTE);var a=8*(t.getSymbolTotalCodewords(e)-r.getTotalCodewordsCount(e,n));if(s===o.MIXED)return a;var u=a-c(s,e);switch(s){case o.NUMERIC:return Math.floor(u/10*3);case o.ALPHANUMERIC:return Math.floor(u/11*2);case o.KANJI:return Math.floor(u/13);case o.BYTE:default:return Math.floor(u/8)}},e.getBestVersionForData=function(t,r){var i,a=n.from(r,n.M);if(s(t)){if(t.length>1)return function(t,r){for(var n=1;n<=40;n++)if(u(t,n)<=e.getCapacity(n,r,o.MIXED))return n}(t,a);if(0===t.length)return 1;i=t[0]}else i=t;return function(t,r,n){for(var o=1;o<=40;o++)if(r<=e.getCapacity(o,n,t))return o}(i.mode,i.getLength(),a)},e.getEncodedBits=function(e){if(!i.isValid(e)||e<7)throw new Error("Invalid QR Code version");for(var r=e<<12;t.getBCHDigit(r)-a>=0;)r^=7973<<t.getBCHDigit(r)-a;return e<<12|r}}(version$1);var formatInfo$1={},Utils$7=utils$3,G15$1=1335,G15_MASK$1=21522,G15_BCH$1=Utils$7.getBCHDigit(G15$1);formatInfo$1.getEncodedBits=function(e,t){for(var r=e.bit<<3|t,n=r<<10;Utils$7.getBCHDigit(n)-G15_BCH$1>=0;)n^=G15$1<<Utils$7.getBCHDigit(n)-G15_BCH$1;return(r<<10|n)^G15_MASK$1};var segments$1={},Mode$9=mode$1;function NumericData$1(e){this.mode=Mode$9.NUMERIC,this.data=e.toString()}NumericData$1.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},NumericData$1.prototype.getLength=function(){return this.data.length},NumericData$1.prototype.getBitsLength=function(){return NumericData$1.getBitsLength(this.data.length)},NumericData$1.prototype.write=function(e){var t,r,n;for(t=0;t+3<=this.data.length;t+=3)r=this.data.substr(t,3),n=parseInt(r,10),e.put(n,10);var o=this.data.length-t;o>0&&(r=this.data.substr(t),n=parseInt(r,10),e.put(n,3*o+1))};var numericData$1=NumericData$1,Mode$8=mode$1,ALPHA_NUM_CHARS$1=["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 AlphanumericData$1(e){this.mode=Mode$8.ALPHANUMERIC,this.data=e}AlphanumericData$1.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},AlphanumericData$1.prototype.getLength=function(){return this.data.length},AlphanumericData$1.prototype.getBitsLength=function(){return AlphanumericData$1.getBitsLength(this.data.length)},AlphanumericData$1.prototype.write=function(e){var t;for(t=0;t+2<=this.data.length;t+=2){var r=45*ALPHA_NUM_CHARS$1.indexOf(this.data[t]);r+=ALPHA_NUM_CHARS$1.indexOf(this.data[t+1]),e.put(r,11)}this.data.length%2&&e.put(ALPHA_NUM_CHARS$1.indexOf(this.data[t]),6)};var alphanumericData$1=AlphanumericData$1,BufferUtil$1=typedarrayBuffer,Mode$7=mode$1;function ByteData$1(e){this.mode=Mode$7.BYTE,this.data=BufferUtil$1.from(e)}ByteData$1.getBitsLength=function(e){return 8*e},ByteData$1.prototype.getLength=function(){return this.data.length},ByteData$1.prototype.getBitsLength=function(){return ByteData$1.getBitsLength(this.data.length)},ByteData$1.prototype.write=function(e){for(var t=0,r=this.data.length;t<r;t++)e.put(this.data[t],8)};var byteData$1=ByteData$1,Mode$6=mode$1,Utils$6=utils$3;function KanjiData$1(e){this.mode=Mode$6.KANJI,this.data=e}KanjiData$1.getBitsLength=function(e){return 13*e},KanjiData$1.prototype.getLength=function(){return this.data.length},KanjiData$1.prototype.getBitsLength=function(){return KanjiData$1.getBitsLength(this.data.length)},KanjiData$1.prototype.write=function(e){var t;for(t=0;t<this.data.length;t++){var r=Utils$6.toSJIS(this.data[t]);if(r>=33088&&r<=40956)r-=33088;else{if(!(r>=57408&&r<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");r-=49472}r=192*(r>>>8&255)+(255&r),e.put(r,13)}};var kanjiData$1=KanjiData$1,dijkstra={exports:{}};!function(e){var t={single_source_shortest_paths:function(e,r,n){var o={},i={};i[r]=0;var s,a,c,u,l,d,h,f=t.PriorityQueue.make();for(f.push(r,0);!f.empty();)for(c in a=(s=f.pop()).value,u=s.cost,l=e[a]||{})l.hasOwnProperty(c)&&(d=u+l[c],h=i[c],(void 0===i[c]||h>d)&&(i[c]=d,f.push(c,d),o[c]=a));if(void 0!==n&&void 0===i[n]){var p=["Could not find a path from ",r," to ",n,"."].join("");throw new Error(p)}return o},extract_shortest_path_from_predecessor_list:function(e,t){for(var r=[],n=t;n;)r.push(n),e[n],n=e[n];return r.reverse(),r},find_path:function(e,r,n){var o=t.single_source_shortest_paths(e,r,n);return t.extract_shortest_path_from_predecessor_list(o,n)},PriorityQueue:{make:function(e){var r,n=t.PriorityQueue,o={};for(r in e=e||{},n)n.hasOwnProperty(r)&&(o[r]=n[r]);return o.queue=[],o.sorter=e.sorter||n.default_sorter,o},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var r={value:e,cost:t};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t}(dijkstra);var dijkstraExports=dijkstra.exports;!function(e){var t=mode$1,r=numericData$1,n=alphanumericData$1,o=byteData$1,i=kanjiData$1,s=regex$1,a=utils$3,c=dijkstraExports;function u(e){return unescape(encodeURIComponent(e)).length}function l(e,t,r){for(var n,o=[];null!==(n=e.exec(r));)o.push({data:n[0],index:n.index,mode:t,length:n[0].length});return o}function d(e){var r,n,o=l(s.NUMERIC,t.NUMERIC,e),i=l(s.ALPHANUMERIC,t.ALPHANUMERIC,e);return a.isKanjiModeEnabled()?(r=l(s.BYTE,t.BYTE,e),n=l(s.KANJI,t.KANJI,e)):(r=l(s.BYTE_KANJI,t.BYTE,e),n=[]),o.concat(i,r,n).sort((function(e,t){return e.index-t.index})).map((function(e){return{data:e.data,mode:e.mode,length:e.length}}))}function h(e,s){switch(s){case t.NUMERIC:return r.getBitsLength(e);case t.ALPHANUMERIC:return n.getBitsLength(e);case t.KANJI:return i.getBitsLength(e);case t.BYTE:return o.getBitsLength(e)}}function f(e,s){var c,u=t.getBestModeForData(e);if((c=t.from(s,u))!==t.BYTE&&c.bit<u.bit)throw new Error('"'+e+'" cannot be encoded with mode '+t.toString(c)+".\n Suggested mode is: "+t.toString(u));switch(c!==t.KANJI||a.isKanjiModeEnabled()||(c=t.BYTE),c){case t.NUMERIC:return new r(e);case t.ALPHANUMERIC:return new n(e);case t.KANJI:return new i(e);case t.BYTE:return new o(e)}}e.fromArray=function(e){return e.reduce((function(e,t){return"string"==typeof t?e.push(f(t,null)):t.data&&e.push(f(t.data,t.mode)),e}),[])},e.fromString=function(r,n){for(var o=function(e){for(var r=[],n=0;n<e.length;n++){var o=e[n];switch(o.mode){case t.NUMERIC:r.push([o,{data:o.data,mode:t.ALPHANUMERIC,length:o.length},{data:o.data,mode:t.BYTE,length:o.length}]);break;case t.ALPHANUMERIC:r.push([o,{data:o.data,mode:t.BYTE,length:o.length}]);break;case t.KANJI:r.push([o,{data:o.data,mode:t.BYTE,length:u(o.data)}]);break;case t.BYTE:r.push([{data:o.data,mode:t.BYTE,length:u(o.data)}])}}return r}(d(r,a.isKanjiModeEnabled())),i=function(e,r){for(var n={},o={start:{}},i=["start"],s=0;s<e.length;s++){for(var a=e[s],c=[],u=0;u<a.length;u++){var l=a[u],d=""+s+u;c.push(d),n[d]={node:l,lastCount:0},o[d]={};for(var f=0;f<i.length;f++){var p=i[f];n[p]&&n[p].node.mode===l.mode?(o[p][d]=h(n[p].lastCount+l.length,l.mode)-h(n[p].lastCount,l.mode),n[p].lastCount+=l.length):(n[p]&&(n[p].lastCount=l.length),o[p][d]=h(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,r))}}i=c}for(f=0;f<i.length;f++)o[i[f]].end=0;return{map:o,table:n}}(o,n),s=c.find_path(i.map,"start","end"),l=[],f=1;f<s.length-1;f++)l.push(i.table[s[f]].node);return e.fromArray(function(e){return e.reduce((function(e,t){var r=e.length-1>=0?e[e.length-1]:null;return r&&r.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)}),[])}(l))},e.rawSplit=function(t){return e.fromArray(d(t,a.isKanjiModeEnabled()))}}(segments$1);var BufferUtil=typedarrayBuffer,Utils$5=utils$3,ECLevel$2=errorCorrectionLevel$1,BitBuffer$2=bitBuffer$1,BitMatrix$2=bitMatrix$1,AlignmentPattern$1=alignmentPattern$1,FinderPattern$1=finderPattern$1,MaskPattern$1=maskPattern$1,ECCode$1=errorCorrectionCode$1,ReedSolomonEncoder$2=reedSolomonEncoder$1,Version$1=version$1,FormatInfo$1=formatInfo$1,Mode$5=mode$1,Segments$1=segments$1,isArray=isarray;function setupFinderPattern$1(e,t){for(var r=e.size,n=FinderPattern$1.getPositions(t),o=0;o<n.length;o++)for(var i=n[o][0],s=n[o][1],a=-1;a<=7;a++)if(!(i+a<=-1||r<=i+a))for(var c=-1;c<=7;c++)s+c<=-1||r<=s+c||(a>=0&&a<=6&&(0===c||6===c)||c>=0&&c<=6&&(0===a||6===a)||a>=2&&a<=4&&c>=2&&c<=4?e.set(i+a,s+c,!0,!0):e.set(i+a,s+c,!1,!0))}function setupTimingPattern$1(e){for(var t=e.size,r=8;r<t-8;r++){var n=r%2==0;e.set(r,6,n,!0),e.set(6,r,n,!0)}}function setupAlignmentPattern$1(e,t){for(var r=AlignmentPattern$1.getPositions(t),n=0;n<r.length;n++)for(var o=r[n][0],i=r[n][1],s=-2;s<=2;s++)for(var a=-2;a<=2;a++)-2===s||2===s||-2===a||2===a||0===s&&0===a?e.set(o+s,i+a,!0,!0):e.set(o+s,i+a,!1,!0)}function setupVersionInfo$1(e,t){for(var r,n,o,i=e.size,s=Version$1.getEncodedBits(t),a=0;a<18;a++)r=Math.floor(a/3),n=a%3+i-8-3,o=1==(s>>a&1),e.set(r,n,o,!0),e.set(n,r,o,!0)}function setupFormatInfo$1(e,t,r){var n,o,i=e.size,s=FormatInfo$1.getEncodedBits(t,r);for(n=0;n<15;n++)o=1==(s>>n&1),n<6?e.set(n,8,o,!0):n<8?e.set(n+1,8,o,!0):e.set(i-15+n,8,o,!0),n<8?e.set(8,i-n-1,o,!0):n<9?e.set(8,15-n-1+1,o,!0):e.set(8,15-n-1,o,!0);e.set(i-8,8,1,!0)}function setupData$1(e,t){for(var r=e.size,n=-1,o=r-1,i=7,s=0,a=r-1;a>0;a-=2)for(6===a&&a--;;){for(var c=0;c<2;c++)if(!e.isReserved(o,a-c)){var u=!1;s<t.length&&(u=1==(t[s]>>>i&1)),e.set(o,a-c,u),-1===--i&&(s++,i=7)}if((o+=n)<0||r<=o){o-=n,n=-n;break}}}function createData$1(e,t,r){var n=new BitBuffer$2;r.forEach((function(t){n.put(t.mode.bit,4),n.put(t.getLength(),Mode$5.getCharCountIndicator(t.mode,e)),t.write(n)}));var o=8*(Utils$5.getSymbolTotalCodewords(e)-ECCode$1.getTotalCodewordsCount(e,t));for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(0);for(var i=(o-n.getLengthInBits())/8,s=0;s<i;s++)n.put(s%2?17:236,8);return createCodewords$1(n,e,t)}function createCodewords$1(e,t,r){for(var n=Utils$5.getSymbolTotalCodewords(t),o=n-ECCode$1.getTotalCodewordsCount(t,r),i=ECCode$1.getBlocksCount(t,r),s=i-n%i,a=Math.floor(n/i),c=Math.floor(o/i),u=c+1,l=a-c,d=new ReedSolomonEncoder$2(l),h=0,f=new Array(i),p=new Array(i),m=0,y=BufferUtil.from(e.buffer),g=0;g<i;g++){var b=g<s?c:u;f[g]=y.slice(h,h+b),p[g]=d.encode(f[g]),h+=b,m=Math.max(m,b)}var w,v,_=BufferUtil.alloc(n),A=0;for(w=0;w<m;w++)for(v=0;v<i;v++)w<f[v].length&&(_[A++]=f[v][w]);for(w=0;w<l;w++)for(v=0;v<i;v++)_[A++]=p[v][w];return _}function createSymbol$1(e,t,r,n){var o;if(isArray(e))o=Segments$1.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");var i=t;if(!i){var s=Segments$1.rawSplit(e);i=Version$1.getBestVersionForData(s,r)}o=Segments$1.fromString(e,i||40)}var a=Version$1.getBestVersionForData(o,r);if(!a)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<a)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+a+".\n")}else t=a;var c=createData$1(t,r,o),u=Utils$5.getSymbolSize(t),l=new BitMatrix$2(u);return setupFinderPattern$1(l,t),setupTimingPattern$1(l),setupAlignmentPattern$1(l,t),setupFormatInfo$1(l,r,0),t>=7&&setupVersionInfo$1(l,t),setupData$1(l,c),isNaN(n)&&(n=MaskPattern$1.getBestMask(l,setupFormatInfo$1.bind(null,l,r))),MaskPattern$1.applyMask(n,l),setupFormatInfo$1(l,r,n),{modules:l,version:t,errorCorrectionLevel:r,maskPattern:n,segments:o}}qrcode$1.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");var r,n,o=ECLevel$2.M;return void 0!==t&&(o=ECLevel$2.from(t.errorCorrectionLevel,ECLevel$2.M),r=Version$1.from(t.version),n=MaskPattern$1.from(t.maskPattern),t.toSJISFunc&&Utils$5.setToSJISFunction(t.toSJISFunc)),createSymbol$1(e,r,o,n)};var canvas$1={},utils$2={};!function(e){function t(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");var t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map((function(e){return[e,e]})))),6===t.length&&t.push("F","F");var r=parseInt(t.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:255&r,hex:"#"+t.slice(0,6).join("")}}e.getOptions=function(e){e||(e={}),e.color||(e.color={});var r=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,o=e.scale||4;return{width:n,scale:n?4:o,margin:r,color:{dark:t(e.color.dark||"#000000ff"),light:t(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},e.getImageWidth=function(t,r){var n=e.getScale(t,r);return Math.floor((t+2*r.margin)*n)},e.qrToImageData=function(t,r,n){for(var o=r.modules.size,i=r.modules.data,s=e.getScale(o,n),a=Math.floor((o+2*n.margin)*s),c=n.margin*s,u=[n.color.light,n.color.dark],l=0;l<a;l++)for(var d=0;d<a;d++){var h=4*(l*a+d),f=n.color.light;if(l>=c&&d>=c&&l<a-c&&d<a-c)f=u[i[Math.floor((l-c)/s)*o+Math.floor((d-c)/s)]?1:0];t[h++]=f.r,t[h++]=f.g,t[h++]=f.b,t[h]=f.a}}}(utils$2),function(e){var t=utils$2;e.render=function(e,r,n){var o=n,i=r;void 0!==o||r&&r.getContext||(o=r,r=void 0),r||(i=function(){try{return document.createElement("canvas")}catch(e2){throw new Error("You need to specify a canvas element")}}()),o=t.getOptions(o);var s=t.getImageWidth(e.modules.size,o),a=i.getContext("2d"),c=a.createImageData(s,s);return t.qrToImageData(c.data,e,o),function(e,t,r){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=r,t.width=r,t.style.height=r+"px",t.style.width=r+"px"}(a,i,s),a.putImageData(c,0,0),i},e.renderToDataURL=function(t,r,n){var o=n;void 0!==o||r&&r.getContext||(o=r,r=void 0),o||(o={});var i=e.render(t,r,o),s=o.type||"image/png",a=o.rendererOpts||{};return i.toDataURL(s,a.quality)}}(canvas$1);var svgTag$1={},Utils$4=utils$2;function getColorAttrib$1(e,t){var r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function svgCmd$1(e,t,r){var n=e+t;return void 0!==r&&(n+=" "+r),n}function qrToPath$1(e,t,r){for(var n="",o=0,i=!1,s=0,a=0;a<e.length;a++){var c=Math.floor(a%t),u=Math.floor(a/t);c||i||(i=!0),e[a]?(s++,a>0&&c>0&&e[a-1]||(n+=i?svgCmd$1("M",c+r,.5+u+r):svgCmd$1("m",o,0),o=0,i=!1),c+1<t&&e[a+1]||(n+=svgCmd$1("h",s),s=0)):o++}return n}svgTag$1.render=function(e,t,r){var n=Utils$4.getOptions(t),o=e.modules.size,i=e.modules.data,s=o+2*n.margin,a=n.color.light.a?"<path "+getColorAttrib$1(n.color.light,"fill")+' d="M0 0h'+s+"v"+s+'H0z"/>':"",c="<path "+getColorAttrib$1(n.color.dark,"stroke")+' d="'+qrToPath$1(i,o,n.margin)+'"/>',u='viewBox="0 0 '+s+" "+s+'"',l='<svg xmlns="http://www.w3.org/2000/svg" '+(n.width?'width="'+n.width+'" height="'+n.width+'" ':"")+u+' shape-rendering="crispEdges">'+a+c+"</svg>\n";return"function"==typeof r&&r(null,l),l};var canPromise$2=canPromise$3,QRCode$2=qrcode$1,CanvasRenderer$1=canvas$1,SvgRenderer$1=svgTag$1;function renderCanvas$1(e,t,r,n,o){var i=[].slice.call(arguments,1),s=i.length,a="function"==typeof i[s-1];if(!a&&!canPromise$2())throw new Error("Callback required as last argument");if(!a){if(s<1)throw new Error("Too few arguments provided");return 1===s?(r=t,t=n=void 0):2!==s||t.getContext||(n=r,r=t,t=void 0),new Promise((function(o,i){try{var s=QRCode$2.create(r,n);o(e(s,t,n))}catch(e2){i(e2)}}))}if(s<2)throw new Error("Too few arguments provided");2===s?(o=r,r=t,t=n=void 0):3===s&&(t.getContext&&void 0===o?(o=n,n=void 0):(o=n,n=r,r=t,t=void 0));try{var c=QRCode$2.create(r,n);o(null,e(c,t,n))}catch(e2){o(e2)}}browser$1.create=QRCode$2.create,browser$1.toCanvas=renderCanvas$1.bind(null,CanvasRenderer$1.render),browser$1.toDataURL=renderCanvas$1.bind(null,CanvasRenderer$1.renderToDataURL),browser$1.toString=renderCanvas$1.bind(null,(function(e,t,r){return SvgRenderer$1.render(e,r)}));var toggleSelection=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],n=0;n<e.rangeCount;n++)r.push(e.getRangeAt(n));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||r.forEach((function(t){e.addRange(t)})),t&&t.focus()}},deselectCurrent=toggleSelection,clipboardToIE11Formatting={"text/plain":"Text","text/html":"Url",default:"Text"},defaultMessage="Copy to clipboard: #{key}, Enter";function format(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function copy$1(e,t){var r,n,o,i,s,a,c=!1;t||(t={}),r=t.debug||!1;try{if(o=deselectCurrent(),i=document.createRange(),s=document.getSelection(),(a=document.createElement("span")).textContent=e,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.addEventListener("copy",(function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),void 0===n.clipboardData){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=clipboardToIE11Formatting[t.format]||clipboardToIE11Formatting.default;window.clipboardData.setData(o,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))})),document.body.appendChild(a),i.selectNodeContents(a),s.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");c=!0}catch(u){r&&console.error("unable to copy using execCommand: ",u),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(l){r&&console.error("unable to copy using clipboardData: ",l),r&&console.error("falling back to prompt"),n=format("message"in t?t.message:defaultMessage),window.prompt(n,e)}}finally{s&&("function"==typeof s.removeRange?s.removeRange(i):s.removeAllRanges()),a&&document.body.removeChild(a),o()}return c}var copyToClipboard=copy$1,n$6,u$3,i$5,t$6,r$5,o$7,f$2,e$7={},c$6=[],s$6=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord/i;function a$4(e,t){for(var r in t)e[r]=t[r];return e}function v$3(e){var t=e.parentNode;t&&t.removeChild(e)}function h$5(e,t,r){var n,o=arguments,i={};for(n in t)"key"!==n&&"ref"!==n&&(i[n]=t[n]);if(arguments.length>3)for(r=[r],n=3;n<arguments.length;n++)r.push(o[n]);if(null!=r&&(i.children=r),"function"==typeof e&&null!=e.defaultProps)for(n in e.defaultProps)void 0===i[n]&&(i[n]=e.defaultProps[n]);return p$3(e,i,t&&t.key,t&&t.ref,null)}function p$3(e,t,r,n,o){var i={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o};return null==o&&(i.__v=i),n$6.vnode&&n$6.vnode(i),i}function y$4(){return{}}function d$5(e){return e.children}function m$3(e,t){this.props=e,this.context=t}function w$4(e,t){if(null==t)return e.__?w$4(e.__,e.__.__k.indexOf(e)+1):null;for(var r;t<e.__k.length;t++)if(null!=(r=e.__k[t])&&null!=r.__e)return r.__e;return"function"==typeof e.type?w$4(e):null}function k$3(e){var t,r;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(r=e.__k[t])&&null!=r.__e){e.__e=e.__c.base=r.__e;break}return k$3(e)}}function g$3(e){(!e.__d&&(e.__d=!0)&&u$3.push(e)&&!i$5++||r$5!==n$6.debounceRendering)&&((r$5=n$6.debounceRendering)||t$6)(_$5)}function _$5(){for(var e;i$5=u$3.length;)e=u$3.sort((function(e,t){return e.__v.__b-t.__v.__b})),u$3=[],e.some((function(e){var t,r,n,o,i,s,a;e.__d&&(s=(i=(t=e).__v).__e,(a=t.__P)&&(r=[],(n=a$4({},i)).__v=n,o=A$4(a,i,n,t.__n,void 0!==a.ownerSVGElement,null,r,null==s?w$4(i):s),T$5(r,i),o!=s&&k$3(i)))}))}function b$1(e,t,r,n,o,i,s,a,c){var u,l,d,h,f,p,m,y=r&&r.__k||c$6,g=y.length;if(a==e$7&&(a=null!=i?i[0]:g?w$4(r,0):null),u=0,t.__k=x$2(t.__k,(function(r){if(null!=r){if(r.__=t,r.__b=t.__b+1,null===(d=y[u])||d&&r.key==d.key&&r.type===d.type)y[u]=void 0;else for(l=0;l<g;l++){if((d=y[l])&&r.key==d.key&&r.type===d.type){y[l]=void 0;break}d=null}if(h=A$4(e,r,d=d||e$7,n,o,i,s,a,c),(l=r.ref)&&d.ref!=l&&(m||(m=[]),d.ref&&m.push(d.ref,null,r),m.push(l,r.__c||h,r)),null!=h){var b;if(null==p&&(p=h),void 0!==r.__d)b=r.__d,r.__d=void 0;else if(i==d||h!=a||null==h.parentNode){e:if(null==a||a.parentNode!==e)e.appendChild(h),b=null;else{for(f=a,l=0;(f=f.nextSibling)&&l<g;l+=2)if(f==h)break e;e.insertBefore(h,a),b=a}"option"==t.type&&(e.value="")}a=void 0!==b?b:h.nextSibling,"function"==typeof t.type&&(t.__d=a)}else a&&d.__e==a&&a.parentNode!=e&&(a=w$4(d))}return u++,r})),t.__e=p,null!=i&&"function"!=typeof t.type)for(u=i.length;u--;)null!=i[u]&&v$3(i[u]);for(u=g;u--;)null!=y[u]&&D$4(y[u],y[u]);if(m)for(u=0;u<m.length;u++)j$3(m[u],m[++u],m[++u])}function x$2(e,t,r){if(null==r&&(r=[]),null==e||"boolean"==typeof e)t&&r.push(t(null));else if(Array.isArray(e))for(var n=0;n<e.length;n++)x$2(e[n],t,r);else r.push(t?t("string"==typeof e||"number"==typeof e?p$3(null,e,null,null,e):null!=e.__e||null!=e.__c?p$3(e.type,e.props,e.key,null,e.__v):e):e);return r}function P$2(e,t,r,n,o){var i;for(i in r)"children"===i||"key"===i||i in t||N$3(e,i,null,r[i],n);for(i in t)o&&"function"!=typeof t[i]||"children"===i||"key"===i||"value"===i||"checked"===i||r[i]===t[i]||N$3(e,i,t[i],r[i],n)}function C$3(e,t,r){"-"===t[0]?e.setProperty(t,r):e[t]="number"==typeof r&&!1===s$6.test(t)?r+"px":null==r?"":r}function N$3(e,t,r,n,o){var i,s,a,c,u;if(o?"className"===t&&(t="class"):"class"===t&&(t="className"),"style"===t)if(i=e.style,"string"==typeof r)i.cssText=r;else{if("string"==typeof n&&(i.cssText="",n=null),n)for(c in n)r&&c in r||C$3(i,c,"");if(r)for(u in r)n&&r[u]===n[u]||C$3(i,u,r[u])}else"o"===t[0]&&"n"===t[1]?(s=t!==(t=t.replace(/Capture$/,"")),a=t.toLowerCase(),t=(a in e?a:t).slice(2),r?(n||e.addEventListener(t,z$3,s),(e.l||(e.l={}))[t]=r):e.removeEventListener(t,z$3,s)):"list"!==t&&"tagName"!==t&&"form"!==t&&"type"!==t&&"size"!==t&&!o&&t in e?e[t]=null==r?"":r:"function"!=typeof r&&"dangerouslySetInnerHTML"!==t&&(t!==(t=t.replace(/^xlink:?/,""))?null==r||!1===r?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),r):null==r||!1===r&&!/^ar/.test(t)?e.removeAttribute(t):e.setAttribute(t,r))}function z$3(e){this.l[e.type](n$6.event?n$6.event(e):e)}function A$4(e,t,r,n,o,i,s,a,c){var u,l,d,h,f,p,m,y,g,b,w=t.type;if(void 0!==t.constructor)return null;(u=n$6.__b)&&u(t);try{e:if("function"==typeof w){if(y=t.props,g=(u=w.contextType)&&n[u.__c],b=u?g?g.props.value:u.__:n,r.__c?m=(l=t.__c=r.__c).__=l.__E:("prototype"in w&&w.prototype.render?t.__c=l=new w(y,b):(t.__c=l=new m$3(y,b),l.constructor=w,l.render=E$4),g&&g.sub(l),l.props=y,l.state||(l.state={}),l.context=b,l.__n=n,d=l.__d=!0,l.__h=[]),null==l.__s&&(l.__s=l.state),null!=w.getDerivedStateFromProps&&(l.__s==l.state&&(l.__s=a$4({},l.__s)),a$4(l.__s,w.getDerivedStateFromProps(y,l.__s))),h=l.props,f=l.state,d)null==w.getDerivedStateFromProps&&null!=l.componentWillMount&&l.componentWillMount(),null!=l.componentDidMount&&l.__h.push(l.componentDidMount);else{if(null==w.getDerivedStateFromProps&&y!==h&&null!=l.componentWillReceiveProps&&l.componentWillReceiveProps(y,b),!l.__e&&null!=l.shouldComponentUpdate&&!1===l.shouldComponentUpdate(y,l.__s,b)||t.__v===r.__v&&!l.__){for(l.props=y,l.state=l.__s,t.__v!==r.__v&&(l.__d=!1),l.__v=t,t.__e=r.__e,t.__k=r.__k,l.__h.length&&s.push(l),u=0;u<t.__k.length;u++)t.__k[u]&&(t.__k[u].__=t);break e}null!=l.componentWillUpdate&&l.componentWillUpdate(y,l.__s,b),null!=l.componentDidUpdate&&l.__h.push((function(){l.componentDidUpdate(h,f,p)}))}l.context=b,l.props=y,l.state=l.__s,(u=n$6.__r)&&u(t),l.__d=!1,l.__v=t,l.__P=e,u=l.render(l.props,l.state,l.context),t.__k=null!=u&&u.type==d$5&&null==u.key?u.props.children:Array.isArray(u)?u:[u],null!=l.getChildContext&&(n=a$4(a$4({},n),l.getChildContext())),d||null==l.getSnapshotBeforeUpdate||(p=l.getSnapshotBeforeUpdate(h,f)),b$1(e,t,r,n,o,i,s,a,c),l.base=t.__e,l.__h.length&&s.push(l),m&&(l.__E=l.__=null),l.__e=!1}else null==i&&t.__v===r.__v?(t.__k=r.__k,t.__e=r.__e):t.__e=$$3(r.__e,t,r,n,o,i,s,c);(u=n$6.diffed)&&u(t)}catch(v){t.__v=null,n$6.__e(v,t,r)}return t.__e}function T$5(e,t){n$6.__c&&n$6.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(r){n$6.__e(r,t.__v)}}))}function $$3(e,t,r,n,o,i,s,a){var c,u,l,d,h,f=r.props,p=t.props;if(o="svg"===t.type||o,null!=i)for(c=0;c<i.length;c++)if(null!=(u=i[c])&&((null===t.type?3===u.nodeType:u.localName===t.type)||e==u)){e=u,i[c]=null;break}if(null==e){if(null===t.type)return document.createTextNode(p);e=o?document.createElementNS("http://www.w3.org/2000/svg",t.type):document.createElement(t.type,p.is&&{is:p.is}),i=null,a=!1}if(null===t.type)f!==p&&e.data!=p&&(e.data=p);else{if(null!=i&&(i=c$6.slice.call(e.childNodes)),l=(f=r.props||e$7).dangerouslySetInnerHTML,d=p.dangerouslySetInnerHTML,!a){if(f===e$7)for(f={},h=0;h<e.attributes.length;h++)f[e.attributes[h].name]=e.attributes[h].value;(d||l)&&(d&&l&&d.__html==l.__html||(e.innerHTML=d&&d.__html||""))}P$2(e,p,f,o,a),d?t.__k=[]:(t.__k=t.props.children,b$1(e,t,r,n,"foreignObject"!==t.type&&o,i,s,e$7,a)),a||("value"in p&&void 0!==(c=p.value)&&c!==e.value&&N$3(e,"value",c,f.value,!1),"checked"in p&&void 0!==(c=p.checked)&&c!==e.checked&&N$3(e,"checked",c,f.checked,!1))}return e}function j$3(e,t,r){try{"function"==typeof e?e(t):e.current=t}catch(n){n$6.__e(n,r)}}function D$4(e,t,r){var n,o,i;if(n$6.unmount&&n$6.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||j$3(n,null,t)),r||"function"==typeof e.type||(r=null!=(o=e.__e)),e.__e=e.__d=void 0,null!=(n=e.__c)){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){n$6.__e(s,t)}n.base=n.__P=null}if(n=e.__k)for(i=0;i<n.length;i++)n[i]&&D$4(n[i],t,r);null!=o&&v$3(o)}function E$4(e,t,r){return this.constructor(e,r)}function H$3(e,t,r){var n,o,i;n$6.__&&n$6.__(e,t),o=(n=r===o$7)?null:r&&r.__k||t.__k,e=h$5(d$5,null,[e]),i=[],A$4(t,(n?t:r||t).__k=e,o||e$7,e$7,void 0!==t.ownerSVGElement,r&&!n?[r]:o?null:c$6.slice.call(t.childNodes),i,r||e$7,n),T$5(i,e)}function I$3(e,t){H$3(e,t,o$7)}function L$4(e,t){var r,n;for(n in t=a$4(a$4({},e.props),t),arguments.length>2&&(t.children=c$6.slice.call(arguments,2)),r={},t)"key"!==n&&"ref"!==n&&(r[n]=t[n]);return p$3(e.type,r,t.key||e.key,t.ref||e.ref,null)}function M$3(e){var t={},r={__c:"__cC"+f$2++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,o=this;return this.getChildContext||(n=[],this.getChildContext=function(){return t[r.__c]=o,t},this.shouldComponentUpdate=function(e){o.props.value!==e.value&&n.some((function(t){t.context=e.value,g$3(t)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return r.Consumer.contextType=r,r.Provider.__=r,r}n$6={__e:function(e,t){for(var r,n;t=t.__;)if((r=t.__c)&&!r.__)try{if(r.constructor&&null!=r.constructor.getDerivedStateFromError&&(n=!0,r.setState(r.constructor.getDerivedStateFromError(e))),null!=r.componentDidCatch&&(n=!0,r.componentDidCatch(e)),n)return g$3(r.__E=r)}catch(o){e=o}throw e}},m$3.prototype.setState=function(e,t){var r;r=this.__s!==this.state?this.__s:this.__s=a$4({},this.state),"function"==typeof e&&(e=e(r,this.props)),e&&a$4(r,e),null!=e&&this.__v&&(t&&this.__h.push(t),g$3(this))},m$3.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),g$3(this))},m$3.prototype.render=d$5,u$3=[],i$5=0,t$6="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,o$7=e$7,f$2=0;var t$5,u$2,r$4,i$4=0,o$6=[],c$5=n$6.__r,f$1=n$6.diffed,e$6=n$6.__c,a$3=n$6.unmount;function v$2(e,t){n$6.__h&&n$6.__h(u$2,e,i$4||t),i$4=0;var r=u$2.__H||(u$2.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function m$2(e){return i$4=1,p$2(E$3,e)}function p$2(e,t,r){var n=v$2(t$5++,2);return n.__c||(n.__c=u$2,n.__=[r?r(t):E$3(void 0,t),function(t){var r=e(n.__[0],t);n.__[0]!==r&&(n.__[0]=r,n.__c.setState({}))}]),n.__}function l$5(e,t){var r=v$2(t$5++,3);!n$6.__s&&x$1(r.__H,t)&&(r.__=e,r.__H=t,u$2.__H.__h.push(r))}function y$3(e,t){var r=v$2(t$5++,4);!n$6.__s&&x$1(r.__H,t)&&(r.__=e,r.__H=t,u$2.__h.push(r))}function d$4(e){return i$4=5,h$4((function(){return{current:e}}),[])}function s$5(e,t,r){i$4=6,y$3((function(){"function"==typeof e?e(t()):e&&(e.current=t())}),null==r?r:r.concat(e))}function h$4(e,t){var r=v$2(t$5++,7);return x$1(r.__H,t)?(r.__H=t,r.__h=e,r.__=e()):r.__}function T$4(e,t){return i$4=8,h$4((function(){return e}),t)}function w$3(e){var t=u$2.context[e.__c],r=v$2(t$5++,9);return r.__c=e,t?(null==r.__&&(r.__=!0,t.sub(u$2)),t.props.value):e.__}function A$3(e,t){n$6.useDebugValue&&n$6.useDebugValue(t?t(e):e)}function F$3(e){var t=v$2(t$5++,10),r=m$2();return t.__=e,u$2.componentDidCatch||(u$2.componentDidCatch=function(e){t.__&&t.__(e),r[1](e)}),[r[0],function(){r[1](void 0)}]}function _$4(){o$6.some((function(e){if(e.__P)try{e.__H.__h.forEach(g$2),e.__H.__h.forEach(q$3),e.__H.__h=[]}catch(t){return e.__H.__h=[],n$6.__e(t,e.__v),!0}})),o$6=[]}function g$2(e){e.t&&e.t()}function q$3(e){var t=e.__();"function"==typeof t&&(e.t=t)}function x$1(e,t){return!e||t.some((function(t,r){return t!==e[r]}))}function E$3(e,t){return"function"==typeof t?t(e):t}function E$2(e,t){for(var r in t)e[r]=t[r];return e}function w$2(e,t){for(var r in e)if("__source"!==r&&!(r in t))return!0;for(var n in t)if("__source"!==n&&e[n]!==t[n])return!0;return!1}n$6.__r=function(e){c$5&&c$5(e),t$5=0,(u$2=e.__c).__H&&(u$2.__H.__h.forEach(g$2),u$2.__H.__h.forEach(q$3),u$2.__H.__h=[])},n$6.diffed=function(e){f$1&&f$1(e);var t=e.__c;if(t){var r=t.__H;r&&r.__h.length&&(1!==o$6.push(t)&&r$4===n$6.requestAnimationFrame||((r$4=n$6.requestAnimationFrame)||function(e){var t,r=function(){clearTimeout(n),cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);"undefined"!=typeof window&&(t=requestAnimationFrame(r))})(_$4))}},n$6.__c=function(e,t){t.some((function(e){try{e.__h.forEach(g$2),e.__h=e.__h.filter((function(e){return!e.__||q$3(e)}))}catch(r){t.some((function(e){e.__h&&(e.__h=[])})),t=[],n$6.__e(r,e.__v)}})),e$6&&e$6(e,t)},n$6.unmount=function(e){a$3&&a$3(e);var t=e.__c;if(t){var r=t.__H;if(r)try{r.__.forEach((function(e){return e.t&&e.t()}))}catch(n){n$6.__e(n,t.__v)}}};var C$2=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).isPureReactComponent=!0,r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.prototype.shouldComponentUpdate=function(e,t){return w$2(this.props,e)||w$2(this.state,t)},n}(m$3);function _$3(e,t){function r(e){var r=this.props.ref,n=r==e.ref;return!n&&r&&(r.call?r(null):r.current=null),t?!t(this.props,e)||!n:w$2(this.props,e)}function n(t){return this.shouldComponentUpdate=r,h$5(e,E$2({},t))}return n.prototype.isReactComponent=!0,n.displayName="Memo("+(e.displayName||e.name)+")",n.t=!0,n}var A$2=n$6.__b;function S$4(e){function t(t){var r=E$2({},t);return delete r.ref,e(r,t.ref)}return t.prototype.isReactComponent=t.t=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}n$6.__b=function(e){e.type&&e.type.t&&e.ref&&(e.props.ref=e.ref,e.ref=null),A$2&&A$2(e)};var k$2=function(e,t){return e?x$2(e).reduce((function(e,r,n){return e.concat(t(r,n))}),[]):null},R$2={map:k$2,forEach:k$2,count:function(e){return e?x$2(e).length:0},only:function(e){if(1!==(e=x$2(e)).length)throw new Error("Children.only() expects only one child.");return e[0]},toArray:x$2},F$2=n$6.__e;function N$2(e){return e&&((e=E$2({},e)).__c=null,e.__k=e.__k&&e.__k.map(N$2)),e}function U$1(){this.__u=0,this.o=null,this.__b=null}function M$2(e){var t=e.__.__c;return t&&t.u&&t.u(e)}function L$3(e){var t,r,n;function o(o){if(t||(t=e()).then((function(e){r=e.default||e}),(function(e){n=e})),n)throw n;if(!r)throw t;return h$5(r,o)}return o.displayName="Lazy",o.t=!0,o}function O$1(){this.i=null,this.l=null}n$6.__e=function(e,t,r){if(e.then)for(var n,o=t;o=o.__;)if((n=o.__c)&&n.__c)return n.__c(e,t.__c);F$2(e,t,r)},(U$1.prototype=new m$3).__c=function(e,t){var r=this;null==r.o&&(r.o=[]),r.o.push(t);var n=M$2(r.__v),o=!1,i=function(){o||(o=!0,n?n(s):s())};t.__c=t.componentWillUnmount,t.componentWillUnmount=function(){i(),t.__c&&t.__c()};var s=function(){var e;if(! --r.__u)for(r.__v.__k[0]=r.state.u,r.setState({u:r.__b=null});e=r.o.pop();)e.forceUpdate()};r.__u++||r.setState({u:r.__b=r.__v.__k[0]}),e.then(i,i)},U$1.prototype.render=function(e,t){return this.__b&&(this.__v.__k[0]=N$2(this.__b),this.__b=null),[h$5(m$3,null,t.u?null:e.children),t.u&&e.fallback]};var P$1=function(e,t,r){if(++r[1]===r[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(r=e.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.i=r=r[2]}};(O$1.prototype=new m$3).u=function(e){var t=this,r=M$2(t.__v),n=t.l.get(e);return n[0]++,function(o){var i=function(){t.props.revealOrder?(n.push(o),P$1(t,e,n)):o()};r?r(i):i()}},O$1.prototype.render=function(e){this.i=null,this.l=new Map;var t=x$2(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var r=t.length;r--;)this.l.set(t[r],this.i=[1,0,this.i]);return e.children},O$1.prototype.componentDidUpdate=O$1.prototype.componentDidMount=function(){var e=this;e.l.forEach((function(t,r){P$1(e,r,t)}))};var W$1=function(){function e(){}var t=e.prototype;return t.getChildContext=function(){return this.props.context},t.render=function(e){return e.children},e}();function j$2(e){var t=this,r=e.container,n=h$5(W$1,{context:t.context},e.vnode);return t.s&&t.s!==r&&(t.v.parentNode&&t.s.removeChild(t.v),D$4(t.h),t.p=!1),e.vnode?t.p?(r.__k=t.__k,H$3(n,r),t.__k=r.__k):(t.v=document.createTextNode(""),I$3("",r),r.appendChild(t.v),t.p=!0,t.s=r,H$3(n,r,t.v),t.__k=t.v.__k):t.p&&(t.v.parentNode&&t.s.removeChild(t.v),D$4(t.h)),t.h=n,t.componentWillUnmount=function(){t.v.parentNode&&t.s.removeChild(t.v),D$4(t.h)},null}function z$2(e,t){return h$5(j$2,{vnode:e,container:t})}var D$3=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/;m$3.prototype.isReactComponent={};var H$2="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;function T$3(e,t,r){if(null==t.__k)for(;t.firstChild;)t.removeChild(t.firstChild);return H$3(e,t),"function"==typeof r&&r(),e?e.__c:null}function V$2(e,t,r){return I$3(e,t),"function"==typeof r&&r(),e?e.__c:null}var Z$3=n$6.event;function I$2(e,t){e["UNSAFE_"+t]&&!e[t]&&Object.defineProperty(e,t,{configurable:!1,get:function(){return this["UNSAFE_"+t]},set:function(e){this["UNSAFE_"+t]=e}})}n$6.event=function(e){Z$3&&(e=Z$3(e)),e.persist=function(){};var t=!1,r=!1,n=e.stopPropagation;e.stopPropagation=function(){n.call(e),t=!0};var o=e.preventDefault;return e.preventDefault=function(){o.call(e),r=!0},e.isPropagationStopped=function(){return t},e.isDefaultPrevented=function(){return r},e.nativeEvent=e};var $$2={configurable:!0,get:function(){return this.class}},q$2=n$6.vnode;n$6.vnode=function(e){e.$$typeof=H$2;var t=e.type,r=e.props;if(t){if(r.class!=r.className&&($$2.enumerable="className"in r,null!=r.className&&(r.class=r.className),Object.defineProperty(r,"className",$$2)),"function"!=typeof t){var n,o,i;for(i in r.defaultValue&&void 0!==r.value&&(r.value||0===r.value||(r.value=r.defaultValue),delete r.defaultValue),Array.isArray(r.value)&&r.multiple&&"select"===t&&(x$2(r.children).forEach((function(e){-1!=r.value.indexOf(e.props.value)&&(e.props.selected=!0)})),delete r.value),r)if(n=D$3.test(i))break;if(n)for(i in o=e.props={},r)o[D$3.test(i)?i.replace(/[A-Z0-9]/,"-$&").toLowerCase():i]=r[i]}!function(){var t=e.type,r=e.props;if(r&&"string"==typeof t){var n={};for(var o in r)/^on(Ani|Tra|Tou)/.test(o)&&(r[o.toLowerCase()]=r[o],delete r[o]),n[o.toLowerCase()]=o;if(n.ondoubleclick&&(r.ondblclick=r[n.ondoubleclick],delete r[n.ondoubleclick]),n.onbeforeinput&&(r.onbeforeinput=r[n.onbeforeinput],delete r[n.onbeforeinput]),n.onchange&&("textarea"===t||"input"===t.toLowerCase()&&!/^fil|che|ra/i.test(r.type))){var i=n.oninput||"oninput";r[i]||(r[i]=r[n.onchange],delete r[n.onchange])}}}(),"function"==typeof t&&!t.m&&t.prototype&&(I$2(t.prototype,"componentWillMount"),I$2(t.prototype,"componentWillReceiveProps"),I$2(t.prototype,"componentWillUpdate"),t.m=!0)}q$2&&q$2(e)};var B$3="16.8.0";function G$2(e){return h$5.bind(null,e)}function J$1(e){return!!e&&e.$$typeof===H$2}function K$2(e){return J$1(e)?L$4.apply(null,arguments):e}function Q$2(e){return!!e.__k&&(H$3(null,e),!0)}function X$1(e){return e&&(e.base||1===e.nodeType&&e)||null}var Y$2=function(e,t){return e(t)};const compat_module={useState:m$2,useReducer:p$2,useEffect:l$5,useLayoutEffect:y$3,useRef:d$4,useImperativeHandle:s$5,useMemo:h$4,useCallback:T$4,useContext:w$3,useDebugValue:A$3,version:"16.8.0",Children:R$2,render:T$3,hydrate:T$3,unmountComponentAtNode:Q$2,createPortal:z$2,createElement:h$5,createContext:M$3,createFactory:G$2,cloneElement:K$2,createRef:y$4,Fragment:d$5,isValidElement:J$1,findDOMNode:X$1,Component:m$3,PureComponent:C$2,memo:_$3,forwardRef:S$4,unstable_batchedUpdates:Y$2,Suspense:U$1,SuspenseList:O$1,lazy:L$3},compat_module$1=Object.freeze(Object.defineProperty({__proto__:null,Children:R$2,Component:m$3,Fragment:d$5,PureComponent:C$2,Suspense:U$1,SuspenseList:O$1,cloneElement:K$2,createContext:M$3,createElement:h$5,createFactory:G$2,createPortal:z$2,createRef:y$4,default:compat_module,findDOMNode:X$1,forwardRef:S$4,hydrate:V$2,isValidElement:J$1,lazy:L$3,memo:_$3,render:T$3,unmountComponentAtNode:Q$2,unstable_batchedUpdates:Y$2,useCallback:T$4,useContext:w$3,useDebugValue:A$3,useEffect:l$5,useErrorBoundary:F$3,useImperativeHandle:s$5,useLayoutEffect:y$3,useMemo:h$4,useReducer:p$2,useRef:d$4,useState:m$2,version:B$3},Symbol.toStringTag,{value:"Module"})),require$$3=getAugmentedNamespace(compat_module$1);function _interopDefault$1(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var browserUtils=require$$0,QRCode$1=_interopDefault$1(browser$1),copy=_interopDefault$1(copyToClipboard),React=require$$3;function open(e){QRCode$1.toString(e,{type:"terminal"}).then(console.log)}var WALLETCONNECT_STYLE_SHEET=':root {\n --animation-duration: 300ms;\n}\n\n@keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes fadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n.animated {\n animation-duration: var(--animation-duration);\n animation-fill-mode: both;\n}\n\n.fadeIn {\n animation-name: fadeIn;\n}\n\n.fadeOut {\n animation-name: fadeOut;\n}\n\n#walletconnect-wrapper {\n -webkit-user-select: none;\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n left: 0;\n pointer-events: none;\n position: fixed;\n top: 0;\n user-select: none;\n width: 100%;\n z-index: 99999999999999;\n}\n\n.walletconnect-modal__headerLogo {\n height: 21px;\n}\n\n.walletconnect-modal__header p {\n color: #ffffff;\n font-size: 20px;\n font-weight: 600;\n margin: 0;\n align-items: flex-start;\n display: flex;\n flex: 1;\n margin-left: 5px;\n}\n\n.walletconnect-modal__close__wrapper {\n position: absolute;\n top: 0px;\n right: 0px;\n z-index: 10000;\n background: white;\n border-radius: 26px;\n padding: 6px;\n box-sizing: border-box;\n width: 26px;\n height: 26px;\n cursor: pointer;\n}\n\n.walletconnect-modal__close__icon {\n position: relative;\n top: 7px;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n transform: rotate(45deg);\n}\n\n.walletconnect-modal__close__line1 {\n position: absolute;\n width: 100%;\n border: 1px solid rgb(48, 52, 59);\n}\n\n.walletconnect-modal__close__line2 {\n position: absolute;\n width: 100%;\n border: 1px solid rgb(48, 52, 59);\n transform: rotate(90deg);\n}\n\n.walletconnect-qrcode__base {\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n background: rgba(37, 41, 46, 0.95);\n height: 100%;\n left: 0;\n pointer-events: auto;\n position: fixed;\n top: 0;\n transition: 0.4s cubic-bezier(0.19, 1, 0.22, 1);\n width: 100%;\n will-change: opacity;\n padding: 40px;\n box-sizing: border-box;\n}\n\n.walletconnect-qrcode__text {\n color: rgba(60, 66, 82, 0.6);\n font-size: 16px;\n font-weight: 600;\n letter-spacing: 0;\n line-height: 1.1875em;\n margin: 10px 0 20px 0;\n text-align: center;\n width: 100%;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-qrcode__text {\n font-size: 4vw;\n }\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-qrcode__text {\n font-size: 14px;\n }\n}\n\n.walletconnect-qrcode__image {\n width: calc(100% - 30px);\n box-sizing: border-box;\n cursor: none;\n margin: 0 auto;\n}\n\n.walletconnect-qrcode__notification {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n font-size: 16px;\n padding: 16px 20px;\n border-radius: 16px;\n text-align: center;\n transition: all 0.1s ease-in-out;\n background: white;\n color: black;\n margin-bottom: -60px;\n opacity: 0;\n}\n\n.walletconnect-qrcode__notification.notification__show {\n opacity: 1;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-modal__header {\n height: 130px;\n }\n .walletconnect-modal__base {\n overflow: auto;\n }\n}\n\n@media only screen and (min-device-width: 415px) and (max-width: 768px) {\n #content {\n max-width: 768px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (min-width: 375px) and (max-width: 415px) {\n #content {\n max-width: 414px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (min-width: 320px) and (max-width: 375px) {\n #content {\n max-width: 375px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (max-width: 320px) {\n #content {\n max-width: 320px;\n box-sizing: border-box;\n }\n}\n\n.walletconnect-modal__base {\n -webkit-font-smoothing: antialiased;\n background: #ffffff;\n border-radius: 24px;\n box-shadow: 0 10px 50px 5px rgba(0, 0, 0, 0.4);\n font-family: ui-rounded, "SF Pro Rounded", "SF Pro Text", medium-content-sans-serif-font,\n -apple-system, BlinkMacSystemFont, ui-sans-serif, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell,\n "Open Sans", "Helvetica Neue", sans-serif;\n margin-top: 41px;\n padding: 24px 24px 22px;\n pointer-events: auto;\n position: relative;\n text-align: center;\n transition: 0.4s cubic-bezier(0.19, 1, 0.22, 1);\n will-change: transform;\n overflow: visible;\n transform: translateY(-50%);\n top: 50%;\n max-width: 500px;\n margin: auto;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-modal__base {\n padding: 24px 12px;\n }\n}\n\n.walletconnect-modal__base .hidden {\n transform: translateY(150%);\n transition: 0.125s cubic-bezier(0.4, 0, 1, 1);\n}\n\n.walletconnect-modal__header {\n align-items: center;\n display: flex;\n height: 26px;\n left: 0;\n justify-content: space-between;\n position: absolute;\n top: -42px;\n width: 100%;\n}\n\n.walletconnect-modal__base .wc-logo {\n align-items: center;\n display: flex;\n height: 26px;\n margin-top: 15px;\n padding-bottom: 15px;\n pointer-events: auto;\n}\n\n.walletconnect-modal__base .wc-logo div {\n background-color: #3399ff;\n height: 21px;\n margin-right: 5px;\n mask-image: url("images/wc-logo.svg") center no-repeat;\n width: 32px;\n}\n\n.walletconnect-modal__base .wc-logo p {\n color: #ffffff;\n font-size: 20px;\n font-weight: 600;\n margin: 0;\n}\n\n.walletconnect-modal__base h2 {\n color: rgba(60, 66, 82, 0.6);\n font-size: 16px;\n font-weight: 600;\n letter-spacing: 0;\n line-height: 1.1875em;\n margin: 0 0 19px 0;\n text-align: center;\n width: 100%;\n}\n\n.walletconnect-modal__base__row {\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n align-items: center;\n border-radius: 20px;\n cursor: pointer;\n display: flex;\n height: 56px;\n justify-content: space-between;\n padding: 0 15px;\n position: relative;\n margin: 0px 0px 8px;\n text-align: left;\n transition: 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n will-change: transform;\n text-decoration: none;\n}\n\n.walletconnect-modal__base__row:hover {\n background: rgba(60, 66, 82, 0.06);\n}\n\n.walletconnect-modal__base__row:active {\n background: rgba(60, 66, 82, 0.06);\n transform: scale(0.975);\n transition: 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n}\n\n.walletconnect-modal__base__row__h3 {\n color: #25292e;\n font-size: 20px;\n font-weight: 700;\n margin: 0;\n padding-bottom: 3px;\n}\n\n.walletconnect-modal__base__row__right {\n align-items: center;\n display: flex;\n justify-content: center;\n}\n\n.walletconnect-modal__base__row__right__app-icon {\n border-radius: 8px;\n height: 34px;\n margin: 0 11px 2px 0;\n width: 34px;\n background-size: 100%;\n box-shadow: 0 4px 12px 0 rgba(37, 41, 46, 0.25);\n}\n\n.walletconnect-modal__base__row__right__caret {\n height: 18px;\n opacity: 0.3;\n transition: 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n width: 8px;\n will-change: opacity;\n}\n\n.walletconnect-modal__base__row:hover .caret,\n.walletconnect-modal__base__row:active .caret {\n opacity: 0.6;\n}\n\n.walletconnect-modal__mobile__toggle {\n width: 80%;\n display: flex;\n margin: 0 auto;\n position: relative;\n overflow: hidden;\n border-radius: 8px;\n margin-bottom: 18px;\n background: #d4d5d9;\n}\n\n.walletconnect-modal__single_wallet {\n display: flex;\n justify-content: center;\n margin-top: 7px;\n margin-bottom: 18px;\n}\n\n.walletconnect-modal__single_wallet a {\n cursor: pointer;\n color: rgb(64, 153, 255);\n font-size: 21px;\n font-weight: 800;\n text-decoration: none !important;\n margin: 0 auto;\n}\n\n.walletconnect-modal__mobile__toggle_selector {\n width: calc(50% - 8px);\n background: white;\n position: absolute;\n border-radius: 5px;\n height: calc(100% - 8px);\n top: 4px;\n transition: all 0.2s ease-in-out;\n transform: translate3d(4px, 0, 0);\n}\n\n.walletconnect-modal__mobile__toggle.right__selected .walletconnect-modal__mobile__toggle_selector {\n transform: translate3d(calc(100% + 12px), 0, 0);\n}\n\n.walletconnect-modal__mobile__toggle a {\n font-size: 12px;\n width: 50%;\n text-align: center;\n padding: 8px;\n margin: 0;\n font-weight: 600;\n z-index: 1;\n}\n\n.walletconnect-modal__footer {\n display: flex;\n justify-content: center;\n margin-top: 20px;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-modal__footer {\n margin-top: 5vw;\n }\n}\n\n.walletconnect-modal__footer a {\n cursor: pointer;\n color: #898d97;\n font-size: 15px;\n margin: 0 auto;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-modal__footer a {\n font-size: 14px;\n }\n}\n\n.walletconnect-connect__buttons__wrapper {\n max-height: 44vh;\n}\n\n.walletconnect-connect__buttons__wrapper__android {\n margin: 50% 0;\n}\n\n.walletconnect-connect__buttons__wrapper__wrap {\n display: grid;\n grid-template-columns: repeat(4, 1fr);\n margin: 10px 0;\n}\n\n@media only screen and (min-width: 768px) {\n .walletconnect-connect__buttons__wrapper__wrap {\n margin-top: 40px;\n }\n}\n\n.walletconnect-connect__button {\n background-color: rgb(64, 153, 255);\n padding: 12px;\n border-radius: 8px;\n text-decoration: none;\n color: rgb(255, 255, 255);\n font-weight: 500;\n}\n\n.walletconnect-connect__button__icon_anchor {\n cursor: pointer;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n margin: 8px;\n width: 42px;\n justify-self: center;\n flex-direction: column;\n text-decoration: none !important;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-connect__button__icon_anchor {\n margin: 4px;\n }\n}\n\n.walletconnect-connect__button__icon {\n border-radius: 10px;\n height: 42px;\n margin: 0;\n width: 42px;\n background-size: cover !important;\n box-shadow: 0 4px 12px 0 rgba(37, 41, 46, 0.25);\n}\n\n.walletconnect-connect__button__text {\n color: #424952;\n font-size: 2.7vw;\n text-decoration: none !important;\n padding: 0;\n margin-top: 1.8vw;\n font-weight: 600;\n}\n\n@media only screen and (min-width: 768px) {\n .walletconnect-connect__button__text {\n font-size: 16px;\n margin-top: 12px;\n }\n}\n\n.walletconnect-search__input {\n border: none;\n background: #d4d5d9;\n border-style: none;\n padding: 8px 16px;\n outline: none;\n font-style: normal;\n font-stretch: normal;\n font-size: 16px;\n font-style: normal;\n font-stretch: normal;\n line-height: normal;\n letter-spacing: normal;\n text-align: left;\n border-radius: 8px;\n width: calc(100% - 16px);\n margin: 0;\n margin-bottom: 8px;\n}\n';function _catch(e,t){try{var r=e()}catch(e2){return t(e2)}return r&&r.then?r.then(void 0,t):r}"undefined"==typeof Symbol||(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"==typeof Symbol||(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var WALLETCONNECT_LOGO_SVG_URL="data:image/svg+xml,%3Csvg height='185' viewBox='0 0 300 185' width='300' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m61.4385429 36.2562612c48.9112241-47.8881663 128.2119871-47.8881663 177.1232091 0l5.886545 5.7634174c2.445561 2.3944081 2.445561 6.2765112 0 8.6709204l-20.136695 19.715503c-1.222781 1.1972051-3.2053 1.1972051-4.428081 0l-8.100584-7.9311479c-34.121692-33.4079817-89.443886-33.4079817-123.5655788 0l-8.6750562 8.4936051c-1.2227816 1.1972041-3.205301 1.1972041-4.4280806 0l-20.1366949-19.7155031c-2.4455612-2.3944092-2.4455612-6.2765122 0-8.6709204zm218.7677961 40.7737449 17.921697 17.546897c2.445549 2.3943969 2.445563 6.2764769.000031 8.6708899l-80.810171 79.121134c-2.445544 2.394426-6.410582 2.394453-8.85616.000062-.00001-.00001-.000022-.000022-.000032-.000032l-57.354143-56.154572c-.61139-.598602-1.60265-.598602-2.21404 0-.000004.000004-.000007.000008-.000011.000011l-57.3529212 56.154531c-2.4455368 2.394432-6.4105755 2.394472-8.8561612.000087-.0000143-.000014-.0000296-.000028-.0000449-.000044l-80.81241943-79.122185c-2.44556021-2.394408-2.44556021-6.2765115 0-8.6709197l17.92172963-17.5468673c2.4455602-2.3944082 6.4105989-2.3944082 8.8561602 0l57.3549775 56.155357c.6113908.598602 1.602649.598602 2.2140398 0 .0000092-.000009.0000174-.000017.0000265-.000024l57.3521031-56.155333c2.445505-2.3944633 6.410544-2.3945531 8.856161-.0002.000034.0000336.000068.0000673.000101.000101l57.354902 56.155432c.61139.598601 1.60265.598601 2.21404 0l57.353975-56.1543249c2.445561-2.3944092 6.410599-2.3944092 8.85616 0z' fill='%233b99fc'/%3E%3C/svg%3E",WALLETCONNECT_HEADER_TEXT="WalletConnect",ANIMATION_DURATION=300,DEFAULT_BUTTON_COLOR="rgb(64, 153, 255)",WALLETCONNECT_WRAPPER_ID="walletconnect-wrapper",WALLETCONNECT_STYLE_ID="walletconnect-style-sheet",WALLETCONNECT_MODAL_ID="walletconnect-qrcode-modal",WALLETCONNECT_CLOSE_BUTTON_ID="walletconnect-qrcode-close",WALLETCONNECT_CTA_TEXT_ID="walletconnect-qrcode-text",WALLETCONNECT_CONNECT_BUTTON_ID="walletconnect-connect-button";function Header(e){return React.createElement("div",{className:"walletconnect-modal__header"},React.createElement("img",{src:WALLETCONNECT_LOGO_SVG_URL,className:"walletconnect-modal__headerLogo"}),React.createElement("p",null,WALLETCONNECT_HEADER_TEXT),React.createElement("div",{className:"walletconnect-modal__close__wrapper",onClick:e.onClose},React.createElement("div",{id:WALLETCONNECT_CLOSE_BUTTON_ID,className:"walletconnect-modal__close__icon"},React.createElement("div",{className:"walletconnect-modal__close__line1"}),React.createElement("div",{className:"walletconnect-modal__close__line2"}))))}function ConnectButton(e){return React.createElement("a",{className:"walletconnect-connect__button",href:e.href,id:WALLETCONNECT_CONNECT_BUTTON_ID+"-"+e.name,onClick:e.onClick,rel:"noopener noreferrer",style:{backgroundColor:e.color},target:"_blank"},e.name)}var CARET_SVG_URL="data:image/svg+xml,%3Csvg fill='none' height='18' viewBox='0 0 8 18' width='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath clip-rule='evenodd' d='m.586301.213898c-.435947.33907-.5144813.967342-.175411 1.403292l4.87831 6.27212c.28087.36111.28087.86677 0 1.22788l-4.878311 6.27211c-.33907.436-.260536 1.0642.175412 1.4033.435949.3391 1.064219.2605 1.403289-.1754l4.87832-6.2721c.84259-1.08336.84259-2.60034 0-3.68367l-4.87832-6.27212c-.33907-.4359474-.96734-.514482-1.403289-.175412z' fill='%233c4252' fill-rule='evenodd'/%3E%3C/svg%3E";function WalletButton(e){var t=e.color,r=e.href,n=e.name,o=e.logo,i=e.onClick;return React.createElement("a",{className:"walletconnect-modal__base__row",href:r,onClick:i,rel:"noopener noreferrer",target:"_blank"},React.createElement("h3",{className:"walletconnect-modal__base__row__h3"},n),React.createElement("div",{className:"walletconnect-modal__base__row__right"},React.createElement("div",{className:"walletconnect-modal__base__row__right__app-icon",style:{background:"url('"+o+"') "+t,backgroundSize:"100%"}}),React.createElement("img",{src:CARET_SVG_URL,className:"walletconnect-modal__base__row__right__caret"})))}function WalletIcon(e){var t=e.color,r=e.href,n=e.name,o=e.logo,i=e.onClick,s=window.innerWidth<768?(n.length>8?2.5:2.7)+"vw":"inherit";return React.createElement("a",{className:"walletconnect-connect__button__icon_anchor",href:r,onClick:i,rel:"noopener noreferrer",target:"_blank"},React.createElement("div",{className:"walletconnect-connect__button__icon",style:{background:"url('"+o+"') "+t,backgroundSize:"100%"}}),React.createElement("div",{style:{fontSize:s},className:"walletconnect-connect__button__text"},n))}var GRID_MIN_COUNT=5,LINKS_PER_PAGE=12;function LinkDisplay(e){var t=browserUtils.isAndroid(),r=React.useState(""),n=r[0],o=r[1],i=React.useState(""),s=i[0],a=i[1],c=React.useState(1),u=c[0],l=c[1],d=s?e.links.filter((function(e){return e.name.toLowerCase().includes(s.toLowerCase())})):e.links,h=e.errorMessage,f=s||d.length>GRID_MIN_COUNT,p=Math.ceil(d.length/LINKS_PER_PAGE),m=[(u-1)*LINKS_PER_PAGE+1,u*LINKS_PER_PAGE],y=d.length?d.filter((function(e,t){return t+1>=m[0]&&t+1<=m[1]})):[],g=!(t||!(p>1)),b=void 0;return React.createElement("div",null,React.createElement("p",{id:WALLETCONNECT_CTA_TEXT_ID,className:"walletconnect-qrcode__text"},t?e.text.connect_mobile_wallet:e.text.choose_preferred_wallet),!t&&React.createElement("input",{className:"walletconnect-search__input",placeholder:"Search",value:n,onChange:function(e){o(e.target.value),clearTimeout(b),e.target.value?b=setTimeout((function(){a(e.target.value),l(1)}),1e3):(o(""),a(""),l(1))}}),React.createElement("div",{className:"walletconnect-connect__buttons__wrapper"+(t?"__android":f&&d.length?"__wrap":"")},t?React.createElement(ConnectButton,{name:e.text.connect,color:DEFAULT_BUTTON_COLOR,href:e.uri,onClick:React.useCallback((function(){browserUtils.saveMobileLinkInfo({name:"Unknown",href:e.uri})}),[])}):y.length?y.map((function(t){var r=t.color,n=t.name,o=t.shortName,i=t.logo,s=browserUtils.formatIOSMobile(e.uri,t),a=React.useCallback((function(){browserUtils.saveMobileLinkInfo({name:n,href:s})}),[y]);return f?React.createElement(WalletIcon,{color:r,href:s,name:o||n,logo:i,onClick:a}):React.createElement(WalletButton,{color:r,href:s,name:n,logo:i,onClick:a})})):React.createElement(React.Fragment,null,React.createElement("p",null,h.length?e.errorMessage:e.links.length&&!d.length?e.text.no_wallets_found:e.text.loading))),g&&React.createElement("div",{className:"walletconnect-modal__footer"},Array(p).fill(0).map((function(e,t){var r=t+1,n=u===r;return React.createElement("a",{style:{margin:"auto 10px",fontWeight:n?"bold":"normal"},onClick:function(){return l(r)}},r)}))))}function Notification(e){var t=!!e.message.trim();return React.createElement("div",{className:"walletconnect-qrcode__notification"+(t?" notification__show":"")},e.message)}var formatQRCodeImage=function(e){try{var t="";return Promise.resolve(QRCode$1.toString(e,{margin:0,type:"svg"})).then((function(e){return"string"==typeof e&&(t=e.replace("<svg",'<svg class="walletconnect-qrcode__image"')),t}))}catch(e2){return Promise.reject(e2)}};function QRCodeDisplay(e){var t=React.useState(""),r=t[0],n=t[1],o=React.useState(""),i=o[0],s=o[1];React.useEffect((function(){try{return Promise.resolve(formatQRCodeImage(e.uri)).then((function(e){s(e)}))}catch(e2){Promise.reject(e2)}}),[]);return React.createElement("div",null,React.createElement("p",{id:WALLETCONNECT_CTA_TEXT_ID,className:"walletconnect-qrcode__text"},e.text.scan_qrcode_with_wallet),React.createElement("div",{dangerouslySetInnerHTML:{__html:i}}),React.createElement("div",{className:"walletconnect-modal__footer"},React.createElement("a",{onClick:function(){copy(e.uri)?(n(e.text.copied_to_clipboard),setInterval((function(){return n("")}),1200)):(n("Error"),setInterval((function(){return n("")}),1200))}},e.text.copy_to_clipboard)),React.createElement(Notification,{message:r}))}function Modal(e){var t=browserUtils.isAndroid(),r=browserUtils.isMobile(),n=r?e.qrcodeModalOptions&&e.qrcodeModalOptions.mobileLinks?e.qrcodeModalOptions.mobileLinks:void 0:e.qrcodeModalOptions&&e.qrcodeModalOptions.desktopLinks?e.qrcodeModalOptions.desktopLinks:void 0,o=React.useState(!1),i=o[0],s=o[1],a=React.useState(!1),c=a[0],u=a[1],l=React.useState(!r),d=l[0],h=l[1],f={mobile:r,text:e.text,uri:e.uri,qrcodeModalOptions:e.qrcodeModalOptions},p=React.useState(""),m=p[0],y=p[1],g=React.useState(!1),b=g[0],w=g[1],v=React.useState([]),_=v[0],A=v[1],I=React.useState(""),T=I[0],k=I[1],S=function(){c||i||n&&!n.length||_.length>0||React.useEffect((function(){!function(){try{if(t)return Promise.resolve();s(!0);var o=_catch((function(){var t=e.qrcodeModalOptions&&e.qrcodeModalOptions.registryUrl?e.qrcodeModalOptions.registryUrl:browserUtils.getWalletRegistryUrl();return Promise.resolve(fetch(t)).then((function(t){return Promise.resolve(t.json()).then((function(t){var o=t.listings,i=r?"mobile":"desktop",a=browserUtils.getMobileLinkRegistry(browserUtils.formatMobileRegistry(o,i),n);s(!1),u(!0),k(a.length?"":e.text.no_supported_wallets),A(a);var c=1===a.length;c&&(y(browserUtils.formatIOSMobile(e.uri,a[0])),h(!0)),w(c)}))}))}),(function(t){s(!1),u(!0),k(e.text.something_went_wrong),console.error(t)}));return Promise.resolve(o&&o.then?o.then((function(){})):void 0)}catch(e2){return Promise.reject(e2)}}()}))};S();var E=r?d:!d;return React.createElement("div",{id:WALLETCONNECT_MODAL_ID,className:"walletconnect-qrcode__base animated fadeIn"},React.createElement("div",{className:"walletconnect-modal__base"},React.createElement(Header,{onClose:e.onClose}),b&&d?React.createElement("div",{className:"walletconnect-modal__single_wallet"},React.createElement("a",{onClick:function(){return browserUtils.saveMobileLinkInfo({name:_[0].name,href:m})},href:m,rel:"noopener noreferrer",target:"_blank"},e.text.connect_with+" "+(b?_[0].name:"")+" ›")):t||i||!i&&_.length?React.createElement("div",{className:"walletconnect-modal__mobile__toggle"+(E?" right__selected":"")},React.createElement("div",{className:"walletconnect-modal__mobile__toggle_selector"}),r?React.createElement(React.Fragment,null,React.createElement("a",{onClick:function(){return h(!1),S()}},e.text.mobile),React.createElement("a",{onClick:function(){return h(!0)}},e.text.qrcode)):React.createElement(React.Fragment,null,React.createElement("a",{onClick:function(){return h(!0)}},e.text.qrcode),React.createElement("a",{onClick:function(){return h(!1),S()}},e.text.desktop))):null,React.createElement("div",null,d||!t&&!i&&!_.length?React.createElement(QRCodeDisplay,Object.assign({},f)):React.createElement(LinkDisplay,Object.assign({},f,{links:_,errorMessage:T})))))}var de$1={choose_preferred_wallet:"Wähle bevorzugte Wallet",connect_mobile_wallet:"Verbinde mit Mobile Wallet",scan_qrcode_with_wallet:"Scanne den QR-code mit einer WalletConnect kompatiblen Wallet",connect:"Verbinden",qrcode:"QR-Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"In die Zwischenablage kopieren",copied_to_clipboard:"In die Zwischenablage kopiert!",connect_with:"Verbinden mit Hilfe von",loading:"Laden...",something_went_wrong:"Etwas ist schief gelaufen",no_supported_wallets:"Es gibt noch keine unterstützten Wallet",no_wallets_found:"keine Wallet gefunden"},en={choose_preferred_wallet:"Choose your preferred wallet",connect_mobile_wallet:"Connect to Mobile Wallet",scan_qrcode_with_wallet:"Scan QR code with a WalletConnect-compatible wallet",connect:"Connect",qrcode:"QR Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"Copy to clipboard",copied_to_clipboard:"Copied to clipboard!",connect_with:"Connect with",loading:"Loading...",something_went_wrong:"Something went wrong",no_supported_wallets:"There are no supported wallets yet",no_wallets_found:"No wallets found"},es={choose_preferred_wallet:"Elige tu billetera preferida",connect_mobile_wallet:"Conectar a billetera móvil",scan_qrcode_with_wallet:"Escanea el código QR con una billetera compatible con WalletConnect",connect:"Conectar",qrcode:"Código QR",mobile:"Móvil",desktop:"Desktop",copy_to_clipboard:"Copiar",copied_to_clipboard:"Copiado!",connect_with:"Conectar mediante",loading:"Cargando...",something_went_wrong:"Algo salió mal",no_supported_wallets:"Todavía no hay billeteras compatibles",no_wallets_found:"No se encontraron billeteras"},fr={choose_preferred_wallet:"Choisissez votre portefeuille préféré",connect_mobile_wallet:"Se connecter au portefeuille mobile",scan_qrcode_with_wallet:"Scannez le QR code avec un portefeuille compatible WalletConnect",connect:"Se connecter",qrcode:"QR Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"Copier",copied_to_clipboard:"Copié!",connect_with:"Connectez-vous à l'aide de",loading:"Chargement...",something_went_wrong:"Quelque chose a mal tourné",no_supported_wallets:"Il n'y a pas encore de portefeuilles pris en charge",no_wallets_found:"Aucun portefeuille trouvé"},ko$1={choose_preferred_wallet:"원하는 지갑을 선택하세요",connect_mobile_wallet:"모바일 지갑과 연결",scan_qrcode_with_wallet:"WalletConnect 지원 지갑에서 QR코드를 스캔하세요",connect:"연결",qrcode:"QR 코드",mobile:"모바일",desktop:"데스크탑",copy_to_clipboard:"클립보드에 복사",copied_to_clipboard:"클립보드에 복사되었습니다!",connect_with:"와 연결하다",loading:"로드 중...",something_went_wrong:"문제가 발생했습니다.",no_supported_wallets:"아직 지원되는 지갑이 없습니다",no_wallets_found:"지갑을 찾을 수 없습니다"},pt$1={choose_preferred_wallet:"Escolha sua carteira preferida",connect_mobile_wallet:"Conectar-se à carteira móvel",scan_qrcode_with_wallet:"Ler o código QR com uma carteira compatível com WalletConnect",connect:"Conectar",qrcode:"Código QR",mobile:"Móvel",desktop:"Desktop",copy_to_clipboard:"Copiar",copied_to_clipboard:"Copiado!",connect_with:"Ligar por meio de",loading:"Carregamento...",something_went_wrong:"Algo correu mal",no_supported_wallets:"Ainda não há carteiras suportadas",no_wallets_found:"Nenhuma carteira encontrada"},zh={choose_preferred_wallet:"选择你的钱包",connect_mobile_wallet:"连接至移动端钱包",scan_qrcode_with_wallet:"使用兼容 WalletConnect 的钱包扫描二维码",connect:"连接",qrcode:"二维码",mobile:"移动",desktop:"桌面",copy_to_clipboard:"复制到剪贴板",copied_to_clipboard:"复制到剪贴板成功!",connect_with:"通过以下方式连接",loading:"正在加载...",something_went_wrong:"出了问题",no_supported_wallets:"目前还没有支持的钱包",no_wallets_found:"没有找到钱包"},fa={choose_preferred_wallet:"کیف پول مورد نظر خود را انتخاب کنید",connect_mobile_wallet:"به کیف پول موبایل وصل شوید",scan_qrcode_with_wallet:"کد QR را با یک کیف پول سازگار با WalletConnect اسکن کنید",connect:"اتصال",qrcode:"کد QR",mobile:"سیار",desktop:"دسکتاپ",copy_to_clipboard:"کپی به کلیپ بورد",copied_to_clipboard:"در کلیپ بورد کپی شد!",connect_with:"ارتباط با",loading:"...بارگذاری",something_went_wrong:"مشکلی پیش آمد",no_supported_wallets:"هنوز هیچ کیف پول پشتیبانی شده ای وجود ندارد",no_wallets_found:"هیچ کیف پولی پیدا نشد"},languages={de:de$1,en:en,es:es,fr:fr,ko:ko$1,pt:pt$1,zh:zh,fa:fa};function injectStyleSheet(){var e=browserUtils.getDocumentOrThrow(),t=e.getElementById(WALLETCONNECT_STYLE_ID);t&&e.head.removeChild(t);var r=e.createElement("style");r.setAttribute("id",WALLETCONNECT_STYLE_ID),r.innerText=WALLETCONNECT_STYLE_SHEET,e.head.appendChild(r)}function renderWrapper(){var e=browserUtils.getDocumentOrThrow(),t=e.createElement("div");return t.setAttribute("id",WALLETCONNECT_WRAPPER_ID),e.body.appendChild(t),t}function triggerCloseAnimation(){var e=browserUtils.getDocumentOrThrow(),t=e.getElementById(WALLETCONNECT_MODAL_ID);t&&(t.className=t.className.replace("fadeIn","fadeOut"),setTimeout((function(){var t=e.getElementById(WALLETCONNECT_WRAPPER_ID);t&&e.body.removeChild(t)}),ANIMATION_DURATION))}function getWrappedCallback(e){return function(){triggerCloseAnimation(),e&&e()}}function getText(){var e=browserUtils.getNavigatorOrThrow().language.split("-")[0]||"en";return languages[e]||languages.en}function open$1(e,t,r){injectStyleSheet();var n=renderWrapper();React.render(React.createElement(Modal,{text:getText(),uri:e,onClose:getWrappedCallback(t),qrcodeModalOptions:r}),n)}function close$1(){triggerCloseAnimation()}var isNode=function(){return void 0!==process$1&&void 0!==process$1.versions&&void 0!==process$1.versions.node};function open$2(e,t,r){console.log(e),isNode()?open(e):open$1(e,t,r)}function close$2(){isNode()||close$1()}var index$1={open:open$2,close:close$2},cjs=index$1;const QRCodeModal=getDefaultExportFromCjs$1(cjs),t$4=Symbol(),s$4=Object.getPrototypeOf,c$4=new WeakMap,l$4=e=>e&&(c$4.has(e)?c$4.get(e):s$4(e)===Object.prototype||s$4(e)===Array.prototype),y$2=e=>l$4(e)&&e[t$4]||null,h$3=(e,t=!0)=>{c$4.set(e,t)},__vite_import_meta_env__={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},isObject=e=>"object"==typeof e&&null!==e,proxyStateMap=new WeakMap,refSet=new WeakSet,buildProxyFunction=(e=Object.is,t=(e,t)=>new Proxy(e,t),r=e=>isObject(e)&&!refSet.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer),n=e=>{switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e}},o=new WeakMap,i=(e,t,r=n)=>{const s=o.get(e);if((null==s?void 0:s[0])===t)return s[1];const a=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));return h$3(a,!0),o.set(e,[t,a]),Reflect.ownKeys(e).forEach((t=>{if(Object.getOwnPropertyDescriptor(a,t))return;const n=Reflect.get(e,t),o={value:n,enumerable:!0,configurable:!0};if(refSet.has(n))h$3(n,!1);else if(n instanceof Promise)delete o.value,o.get=()=>r(n);else if(proxyStateMap.has(n)){const[e,t]=proxyStateMap.get(n);o.value=i(e,t(),r)}Object.defineProperty(a,t,o)})),Object.preventExtensions(a)},s=new WeakMap,a=[1,1],c=n=>{if(!isObject(n))throw new Error("object required");const o=s.get(n);if(o)return o;let u=a[0];const l=new Set,d=(e,t=++a[0])=>{u!==t&&(u=t,l.forEach((r=>r(e,t))))};let h=a[1];const f=e=>(t,r)=>{const n=[...t];n[1]=[e,...n[1]],d(n,r)},p=new Map,m=e=>{var t;const r=p.get(e);r&&(p.delete(e),null==(t=r[1])||t.call(r))},y=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),g={deleteProperty(e,t){const r=Reflect.get(e,t);m(t);const n=Reflect.deleteProperty(e,t);return n&&d(["delete",[t],r]),n},set(t,n,o,i){const a=Reflect.has(t,n),u=Reflect.get(t,n,i);if(a&&(e(u,o)||s.has(o)&&e(u,s.get(o))))return!0;m(n),isObject(o)&&(o=y$2(o)||o);let h=o;if(o instanceof Promise)o.then((e=>{o.status="fulfilled",o.value=e,d(["resolve",[n],e])})).catch((e=>{o.status="rejected",o.reason=e,d(["reject",[n],e])}));else{!proxyStateMap.has(o)&&r(o)&&(h=c(o));const e=!refSet.has(h)&&proxyStateMap.get(h);e&&((e,t)=>{if("production"!==(__vite_import_meta_env__?"production":void 0)&&p.has(e))throw new Error("prop listener already exists");if(l.size){const r=t[3](f(e));p.set(e,[t,r])}else p.set(e,[t])})(n,e)}return Reflect.set(t,n,h,i),d(["set",[n],o,u]),!0}},b=t(y,g);s.set(n,b);const w=[y,(e=++a[1])=>(h===e||l.size||(h=e,p.forEach((([t])=>{const r=t[1](e);r>u&&(u=r)}))),u),i,e=>{l.add(e),1===l.size&&p.forEach((([e,t],r)=>{if("production"!==(__vite_import_meta_env__?"production":void 0)&&t)throw new Error("remove already exists");const n=e[3](f(r));p.set(r,[e,n])}));return()=>{l.delete(e),0===l.size&&p.forEach((([e,t],r)=>{t&&(t(),p.set(r,[e]))}))}}];return proxyStateMap.set(b,w),Reflect.ownKeys(n).forEach((e=>{const t=Object.getOwnPropertyDescriptor(n,e);"value"in t&&(b[e]=n[e],delete t.value,delete t.writable),Object.defineProperty(y,e,t)})),b})=>[c,proxyStateMap,refSet,e,t,r,n,o,i,s,a],[defaultProxyFunction]=buildProxyFunction();function proxy(e={}){return defaultProxyFunction(e)}function subscribe(e,t,r){const n=proxyStateMap.get(e);let o;"production"===(__vite_import_meta_env__?"production":void 0)||n||console.warn("Please use proxy object");const i=[],s=n[3];let a=!1;const c=s((e=>{i.push(e),o||(o=Promise.resolve().then((()=>{o=void 0,a&&t(i.splice(0))})))}));return a=!0,()=>{a=!1,c()}}function snapshot(e,t){const r=proxyStateMap.get(e);"production"===(__vite_import_meta_env__?"production":void 0)||r||console.warn("Please use proxy object");const[n,o,i]=r;return i(n,o(),t)}const o$5=proxy({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),T$2={state:o$5,subscribe:e=>subscribe(o$5,(()=>e(o$5))),push(e,t){e!==o$5.view&&(o$5.view=e,t&&(o$5.data=t),o$5.history.push(e))},reset(e){o$5.view=e,o$5.history=[e]},replace(e){o$5.history.length>1&&(o$5.history[o$5.history.length-1]=e,o$5.view=e)},goBack(){if(o$5.history.length>1){o$5.history.pop();const[e]=o$5.history.slice(-1);o$5.view=e}},setData(e){o$5.data=e}},a$2={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile:()=>typeof window<"u"&&Boolean(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)),isAndroid:()=>a$2.isMobile()&&navigator.userAgent.toLowerCase().includes("android"),isIos(){const e=navigator.userAgent.toLowerCase();return a$2.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl:e=>e.startsWith("http://")||e.startsWith("https://"),isArray:e=>Array.isArray(e)&&e.length>0,formatNativeUrl(e,t,r){if(a$2.isHttpUrl(e))return this.formatUniversalUrl(e,t,r);let n=e;n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,r);return`${n}wc?uri=${encodeURIComponent(t)}`},formatUniversalUrl(e,t,r){if(!a$2.isHttpUrl(e))return this.formatNativeUrl(e,t,r);let n=e;n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,r);return`${n}wc?uri=${encodeURIComponent(t)}`},wait:async e=>new Promise((t=>{setTimeout(t,e)})),openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(a$2.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(a$2.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(a$2.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(a$2.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=null==(e=T$2.state.data)?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},_$2=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),r$3=proxy({enabled:_$2,userSessionId:"",events:[],connectedWalletId:void 0}),R$1={state:r$3,subscribe:e=>subscribe(r$3.events,(()=>e(snapshot(r$3.events[r$3.events.length-1])))),initialize(){r$3.enabled&&typeof(null==crypto?void 0:crypto.randomUUID)<"u"&&(r$3.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){r$3.connectedWalletId=e},click(e){if(r$3.enabled){const t={type:"CLICK",name:e.name,userSessionId:r$3.userSessionId,timestamp:Date.now(),data:e};r$3.events.push(t)}},track(e){if(r$3.enabled){const t={type:"TRACK",name:e.name,userSessionId:r$3.userSessionId,timestamp:Date.now(),data:e};r$3.events.push(t)}},view(e){if(r$3.enabled){const t={type:"VIEW",name:e.name,userSessionId:r$3.userSessionId,timestamp:Date.now(),data:e};r$3.events.push(t)}}},c$3=proxy({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),p$1={state:c$3,subscribe:e=>subscribe(c$3,(()=>e(c$3))),setChains(e){c$3.chains=e},setWalletConnectUri(e){c$3.walletConnectUri=e},setIsCustomDesktop(e){c$3.isCustomDesktop=e},setIsCustomMobile(e){c$3.isCustomMobile=e},setIsDataLoaded(e){c$3.isDataLoaded=e},setIsUiLoaded(e){c$3.isUiLoaded=e},setIsAuth(e){c$3.isAuth=e}},W=proxy({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}),y$1={state:W,subscribe:e=>subscribe(W,(()=>e(W))),setConfig(e){var t,r;R$1.initialize(),p$1.setChains(e.chains),p$1.setIsAuth(Boolean(e.enableAuthMode)),p$1.setIsCustomMobile(Boolean(null==(t=e.mobileWallets)?void 0:t.length)),p$1.setIsCustomDesktop(Boolean(null==(r=e.desktopWallets)?void 0:r.length)),a$2.setModalVersionInStorage(),Object.assign(W,e)}};var V$1=Object.defineProperty,D$2=Object.getOwnPropertySymbols,H$1=Object.prototype.hasOwnProperty,B$2=Object.prototype.propertyIsEnumerable,M$1=(e,t,r)=>t in e?V$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,K$1=(e,t)=>{for(var r in t||(t={}))H$1.call(t,r)&&M$1(e,r,t[r]);if(D$2)for(var r of D$2(t))B$2.call(t,r)&&M$1(e,r,t[r]);return e};const L$2="https://explorer-api.walletconnect.com",E$1="wcm",O="js-2.6.2";async function w$1(e,t){const r=K$1({sdkType:E$1,sdkVersion:O},t),n=new URL(e,L$2);return n.searchParams.append("projectId",y$1.state.projectId),Object.entries(r).forEach((([e,t])=>{t&&n.searchParams.append(e,String(t))})),(await fetch(n)).json()}const m$1={getDesktopListings:async e=>w$1("/w3m/v1/getDesktopListings",e),getMobileListings:async e=>w$1("/w3m/v1/getMobileListings",e),getInjectedListings:async e=>w$1("/w3m/v1/getInjectedListings",e),getAllListings:async e=>w$1("/w3m/v1/getAllListings",e),getWalletImageUrl:e=>`${L$2}/w3m/v1/getWalletImage/${e}?projectId=${y$1.state.projectId}&sdkType=${E$1}&sdkVersion=${O}`,getAssetImageUrl:e=>`${L$2}/w3m/v1/getAssetImage/${e}?projectId=${y$1.state.projectId}&sdkType=${E$1}&sdkVersion=${O}`};var z$1=Object.defineProperty,j$1=Object.getOwnPropertySymbols,J=Object.prototype.hasOwnProperty,q$1=Object.prototype.propertyIsEnumerable,k$1=(e,t,r)=>t in e?z$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,F$1=(e,t)=>{for(var r in t||(t={}))J.call(t,r)&&k$1(e,r,t[r]);if(j$1)for(var r of j$1(t))q$1.call(t,r)&&k$1(e,r,t[r]);return e};const N$1=a$2.isMobile(),d$3=proxy({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),te$1={state:d$3,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=y$1.state;if("NONE"===e||"ALL"===t&&!e)return d$3.recomendedWallets;if(a$2.isArray(e)){const t={recommendedIds:e.join(",")},{listings:r}=await m$1.getAllListings(t),n=Object.values(r);n.sort(((t,r)=>e.indexOf(t.id)-e.indexOf(r.id))),d$3.recomendedWallets=n}else{const{chains:e,isAuth:r}=p$1.state,n=null==e?void 0:e.join(","),o=a$2.isArray(t),i={page:1,sdks:r?"auth_v1":void 0,entries:a$2.RECOMMENDED_WALLET_AMOUNT,chains:n,version:2,excludedIds:o?t.join(","):void 0},{listings:s}=N$1?await m$1.getMobileListings(i):await m$1.getDesktopListings(i);d$3.recomendedWallets=Object.values(s)}return d$3.recomendedWallets},async getWallets(e){const t=F$1({},e),{explorerRecommendedWalletIds:r,explorerExcludedWalletIds:n}=y$1.state,{recomendedWallets:o}=d$3;if("ALL"===n)return d$3.wallets;o.length?t.excludedIds=o.map((e=>e.id)).join(","):a$2.isArray(r)&&(t.excludedIds=r.join(",")),a$2.isArray(n)&&(t.excludedIds=[t.excludedIds,n].filter(Boolean).join(",")),p$1.state.isAuth&&(t.sdks="auth_v1");const{page:i,search:s}=e,{listings:a,total:c}=N$1?await m$1.getMobileListings(t):await m$1.getDesktopListings(t),u=Object.values(a),l=s?"search":"wallets";return d$3[l]={listings:[...d$3[l].listings,...u],total:c,page:i??1},{listings:u,total:c}},getWalletImageUrl:e=>m$1.getWalletImageUrl(e),getAssetImageUrl:e=>m$1.getAssetImageUrl(e),resetSearch(){d$3.search={listings:[],total:0,page:1}}},I$1=proxy({open:!1}),se$1={state:I$1,subscribe:e=>subscribe(I$1,(()=>e(I$1))),open:async e=>new Promise((t=>{const{isUiLoaded:r,isDataLoaded:n}=p$1.state;if(a$2.removeWalletConnectDeepLink(),p$1.setWalletConnectUri(null==e?void 0:e.uri),p$1.setChains(null==e?void 0:e.chains),T$2.reset("ConnectWallet"),r&&n)I$1.open=!0,t();else{const e=setInterval((()=>{const r=p$1.state;r.isUiLoaded&&r.isDataLoaded&&(clearInterval(e),I$1.open=!0,t())}),200)}})),close(){I$1.open=!1}};var G$1=Object.defineProperty,$$1=Object.getOwnPropertySymbols,Q$1=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,S$3=(e,t,r)=>t in e?G$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Y$1=(e,t)=>{for(var r in t||(t={}))Q$1.call(t,r)&&S$3(e,r,t[r]);if($$1)for(var r of $$1(t))X.call(t,r)&&S$3(e,r,t[r]);return e};function Z$2(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const C$1=proxy({themeMode:Z$2()?"dark":"light"}),ne$1={state:C$1,subscribe:e=>subscribe(C$1,(()=>e(C$1))),setThemeConfig(e){const{themeMode:t,themeVariables:r}=e;t&&(C$1.themeMode=t),r&&(C$1.themeVariables=Y$1({},r))}},g$1=proxy({open:!1,message:"",variant:"success"}),oe$1={state:g$1,subscribe:e=>subscribe(g$1,(()=>e(g$1))),openToast(e,t){g$1.open=!0,g$1.message=e,g$1.variant=t},closeToast(){g$1.open=!1}};let d$2=class{constructor(e){this.openModal=se$1.open,this.closeModal=se$1.close,this.subscribeModal=se$1.subscribe,this.setTheme=ne$1.setThemeConfig,ne$1.setThemeConfig(e),y$1.setConfig(e),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then((()=>index));const e=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",e),p$1.setIsUiLoaded(!0)}}};const clients={};class DAppSigner{constructor(e,t,r,n=LedgerId.MAINNET,o){this.accountId=e,this.signClient=t,this.topic=r,this.ledgerId=n,this.extensionId=o}_getHederaClient(){const e=this.ledgerId.toString();return clients[e]||(clients[e]=WebClient.forName(e)),clients[e]}get _signerAccountId(){return`${ledgerIdToCAIPChainId(this.ledgerId)}:${this.accountId.toString()}`}_getRandomNodes(e){const t=Object.values(this._getHederaClient().network).map((e=>"string"==typeof e?AccountId.fromString(e):e));for(let r=t.length-1;r>0;r--){const e=Math.floor(Math.random()*(r+1));[t[r],t[e]]=[t[e],t[r]]}return t.slice(0,e)}request(e){return this.extensionId&&extensionOpen(this.extensionId),this.signClient.request({topic:this.topic,request:e,chainId:ledgerIdToCAIPChainId(this.ledgerId)})}getAccountId(){return this.accountId}getAccountKey(){throw new Error("Method not implemented.")}getLedgerId(){return this.ledgerId}getNetwork(){return this._getHederaClient().network}getMirrorNetwork(){return this._getHederaClient().mirrorNetwork}getAccountBalance(){return this.call((new AccountBalanceQuery).setAccountId(this.accountId))}getAccountInfo(){return this.call((new AccountInfoQuery).setAccountId(this.accountId))}getAccountRecords(){return this.call((new AccountRecordsQuery).setAccountId(this.accountId))}async sign(e,t){const{signatureMap:r}=await this.request({method:HederaJsonRpcMethod.SignMessage,params:{signerAccountId:this._signerAccountId,message:Uint8ArrayToBase64String(e[0])}}),n=base64StringToSignatureMap(r);return[new SignerSignature({accountId:this.getAccountId(),publicKey:PublicKey.fromBytes(n.sigPair[0].pubKeyPrefix),signature:n.sigPair[0].ed25519||n.sigPair[0].ECDSASecp256k1})]}async checkTransaction(e){throw new Error("Method not implemented.")}async populateTransaction(e){return e.setNodeAccountIds(this._getRandomNodes(10)).setTransactionId(TransactionId.generate(this.getAccountId()))}async signTransaction(e){let t;t=e.nodeAccountIds&&0!==e.nodeAccountIds.length?e.nodeAccountIds[0]:this._getRandomNodes(1)[0];const r=transactionBodyToBase64String(transactionToTransactionBody(e,t)),{signatureMap:n}=await this.request({method:HederaJsonRpcMethod.SignTransaction,params:{signerAccountId:this._signerAccountId,transactionBody:r}}),o=base64StringToSignatureMap(n),i=base64StringToUint8Array(r),s=lib.proto.Transaction.encode({bodyBytes:i,sigMap:o}).finish();return Transaction.fromBytes(s)}async _tryExecuteTransactionRequest(e){try{const t=Transaction.fromBytes(e.toBytes()),r=await this.request({method:HederaJsonRpcMethod.SignAndExecuteTransaction,params:{signerAccountId:this._signerAccountId,transactionList:transactionToBase64String(t)}});return{result:TransactionResponse.fromJSON(r)}}catch(t){return{error:t}}}async _parseQueryResponse(e,t){if(e instanceof AccountRecordsQuery){return t.split(",").map((e=>base64StringToUint8Array(e))).map((e=>TransactionRecord.fromBytes(e)))}const r=base64StringToUint8Array(t);if(e instanceof AccountBalanceQuery)return AccountBalance.fromBytes(r);if(e instanceof AccountInfoQuery)return AccountInfo.fromBytes(r);if(e instanceof TransactionReceiptQuery)return TransactionReceipt.fromBytes(r);throw new Error("Unsupported query type")}async _tryExecuteQueryRequest(e){try{const t=Query.fromBytes(e.toBytes()),r=await this.request({method:HederaJsonRpcMethod.SignAndExecuteQuery,params:{signerAccountId:this._signerAccountId,query:queryToBase64String(t)}});return{result:this._parseQueryResponse(t,r.response)}}catch(t){return{error:t}}}async call(e){var t,r,n,o,i,s;const a=await this._tryExecuteTransactionRequest(e);if(a.result)return a.result;const c=await this._tryExecuteQueryRequest(e);if(c.result)return c.result;throw new Error("Error executing transaction or query: \n"+JSON.stringify({txError:{name:null===(t=a.error)||void 0===t?void 0:t.name,message:null===(r=a.error)||void 0===r?void 0:r.message,stack:null===(n=a.error)||void 0===n?void 0:n.stack},queryError:{name:null===(o=c.error)||void 0===o?void 0:o.name,message:null===(i=c.error)||void 0===i?void 0:i.message,stack:null===(s=c.error)||void 0===s?void 0:s.stack}},null,2))}}class DAppConnector{constructor(e,t,r,n,o,i){this.network=LedgerId.TESTNET,this.supportedMethods=[],this.supportedEvents=[],this.supportedChains=[],this.extensions=[],this.onSessionIframeCreated=null,this.signers=[],this.isInitializing=!1,this.abortableConnect=async e=>new Promise((async(t,r)=>{const n=48e4,o=setTimeout((()=>{QRCodeModal.close(),r(new Error("Connect timed out after 480000(ms)"))}),n);try{return t(await e())}catch(i){r(i)}finally{clearTimeout(o)}})),this.dAppMetadata=e,this.network=t,this.projectId=r,this.supportedMethods=null!=n?n:Object.values(HederaJsonRpcMethod),this.supportedEvents=null!=o?o:[],this.supportedChains=null!=i?i:[],this.extensions=[],this.walletConnectModal=new d$2({projectId:r,chains:i}),findExtensions(((e,t)=>{this.extensions.push(Object.assign(Object.assign({},e),{available:!0,availableInIframe:t}))}))}async init({logger:e}={}){try{if(this.isInitializing=!0,!this.projectId)throw new Error("Project ID is not defined");this.walletConnectClient=await oe$2.init({logger:e,relayUrl:"wss://relay.walletconnect.com",projectId:this.projectId,metadata:this.dAppMetadata});const t=this.walletConnectClient.session.getAll();t.length>0?this.signers=t.flatMap((e=>this.createSigners(e))):this.checkIframeConnect(),this.walletConnectClient.on("session_event",(e=>{console.log(e)})),this.walletConnectClient.on("session_update",(({topic:e,params:t})=>{const{namespaces:r}=t,n=this.walletConnectClient.session.get(e),o=Object.assign(Object.assign({},n),{namespaces:r});console.log(o)})),this.walletConnectClient.on("session_delete",(e=>{console.log(e),this.signers=this.signers.filter((t=>t.topic!==e.topic)),this.disconnect(e.topic),console.log("Dapp: Session deleted by wallet!")})),this.walletConnectClient.core.pairing.events.on("pairing_delete",(e=>{console.log(e),this.signers=this.signers.filter((t=>t.topic!==e.topic)),this.disconnect(e.topic),console.log("Dapp: Pairing deleted by wallet!")}))}finally{this.isInitializing=!1}}getSigner(e){const t=this.signers.find((t=>t.getAccountId().equals(e)));if(!t)throw new Error("Signer is not found for this accountId");return t}async connectQR(e){return this.abortableConnect((async()=>{try{const{uri:t,approval:r}=await this.connectURI(e);if(!t)throw new Error("URI is not defined");QRCodeModal.open(t,(()=>{throw new Error("User rejected pairing")})),await this.onSessionConnected(await r())}finally{QRCodeModal.close()}}))}async openModal(e){try{const{uri:t,approval:r}=await this.connectURI(e);this.walletConnectModal.openModal({uri:t});const n=await r();return await this.onSessionConnected(n),n}finally{this.walletConnectModal.closeModal()}}async connect(e,t,r){return this.abortableConnect((async()=>{var n;const{uri:o,approval:i}=await this.connectURI(t);if(!o)throw new Error("URI is not defined");e(o);const s=await i();if(r){const e=Object.assign(Object.assign({},s.sessionProperties),{extensionId:r});s.sessionProperties=e,await(null===(n=this.walletConnectClient)||void 0===n?void 0:n.session.update(s.topic,{sessionProperties:e}))}return await this.onSessionConnected(s),s}))}async connectExtension(e,t){const r=this.extensions.find((t=>t.id===e));if(!r||!r.available)throw new Error("Extension is not available");return this.connect((e=>{extensionConnect(r.id,r.availableInIframe,e)}),t,r.availableInIframe?void 0:e)}async checkIframeConnect(){const e=this.extensions.find((e=>e.availableInIframe));if(e){const t=await this.connectExtension(e.id);this.onSessionIframeCreated&&this.onSessionIframeCreated(t)}}async disconnect(e){await this.walletConnectClient.disconnect({topic:e,reason:tr$1("USER_DISCONNECTED")})}async disconnectAll(){if(!this.walletConnectClient)throw new Error("WalletConnect is not initialized");const e=this.walletConnectClient.session.getAll(),t=this.walletConnectClient.core.pairing.getPairings();if(!(null==e?void 0:e.length)&&!(null==t?void 0:t.length))throw new Error("There is no active session/pairing. Connect to the wallet at first.");const r=[];for(const n of this.walletConnectClient.session.getAll()){console.log(`Disconnecting from session: ${n}`);const e=this.disconnect(n.topic);r.push(e)}for(const n of t){const e=this.disconnect(n.topic);r.push(e)}await Promise.all(r),this.signers=[]}createSigners(e){return accountAndLedgerFromSession(e).map((({account:t,network:r})=>{var n;return new DAppSigner(t,this.walletConnectClient,e.topic,r,null===(n=e.sessionProperties)||void 0===n?void 0:n.extensionId)}))}async onSessionConnected(e){this.signers.push(...this.createSigners(e))}async connectURI(e){if(!this.walletConnectClient)throw new Error("WalletConnect is not initialized");return this.walletConnectClient.connect({pairingTopic:e,requiredNamespaces:networkNamespaces(this.network,this.supportedMethods,this.supportedEvents)})}async request({method:e,params:t}){const r=this.signers[this.signers.length-1];if(!r)throw new Error("There is no active session. Connect to the wallet at first.");return await r.request({method:e,params:t})}async getNodeAddresses(){return await this.request({method:HederaJsonRpcMethod.GetNodeAddresses,params:void 0})}async executeTransaction(e){return await this.request({method:HederaJsonRpcMethod.ExecuteTransaction,params:e})}async signMessage(e){return await this.request({method:HederaJsonRpcMethod.SignMessage,params:e})}async signAndExecuteQuery(e){return await this.request({method:HederaJsonRpcMethod.SignAndExecuteQuery,params:e})}async signAndExecuteTransaction(e){return await this.request({method:HederaJsonRpcMethod.SignAndExecuteTransaction,params:e})}async signTransaction(e){return await this.request({method:HederaJsonRpcMethod.SignTransaction,params:e})}}class DefaultLogger{constructor(){this.logLevel="info"}setLogLevel(e){this.logLevel=e}error(e,...t){["error","warn","info","debug"].includes(this.logLevel)&&console.error(`[ERROR] ${e}`,...t)}warn(e,...t){["warn","info","debug"].includes(this.logLevel)&&console.warn(`[WARN] ${e}`,...t)}info(e,...t){["info","debug"].includes(this.logLevel)&&console.info(`[INFO] ${e}`,...t)}debug(e,...t){"debug"===this.logLevel&&console.debug(`[DEBUG] ${e}`,...t)}}var fetchRetry_umd={exports:{}};!function(e,t){e.exports=function(){function e(e){return Number.isInteger(e)&&e>=0}function t(e){this.name="ArgumentError",this.message=e}return function(r,n){if(n=n||{},"function"!=typeof r)throw new t("fetch must be a function");if("object"!=typeof n)throw new t("defaults must be an object");if(void 0!==n.retries&&!e(n.retries))throw new t("retries must be a positive integer");if(void 0!==n.retryDelay&&!e(n.retryDelay)&&"function"!=typeof n.retryDelay)throw new t("retryDelay must be a positive integer or a function returning a positive integer");if(void 0!==n.retryOn&&!Array.isArray(n.retryOn)&&"function"!=typeof n.retryOn)throw new t("retryOn property expects an array or function");var o={retries:3,retryDelay:1e3,retryOn:[]};return n=Object.assign(o,n),function(o,i){var s=n.retries,a=n.retryDelay,c=n.retryOn;if(i&&void 0!==i.retries){if(!e(i.retries))throw new t("retries must be a positive integer");s=i.retries}if(i&&void 0!==i.retryDelay){if(!e(i.retryDelay)&&"function"!=typeof i.retryDelay)throw new t("retryDelay must be a positive integer or a function returning a positive integer");a=i.retryDelay}if(i&&i.retryOn){if(!Array.isArray(i.retryOn)&&"function"!=typeof i.retryOn)throw new t("retryOn property expects an array or function");c=i.retryOn}return new Promise((function(e,t){var n=function(n){var a="undefined"!=typeof Request&&o instanceof Request?o.clone():o;r(a,i).then((function(r){if(Array.isArray(c)&&-1===c.indexOf(r.status))e(r);else if("function"==typeof c)try{return Promise.resolve(c(n,null,r)).then((function(t){t?u(n,null,r):e(r)})).catch(t)}catch(o){t(o)}else n<s?u(n,null,r):e(r)})).catch((function(e){if("function"==typeof c)try{Promise.resolve(c(n,e,null)).then((function(r){r?u(n,e,null):t(e)})).catch((function(e){t(e)}))}catch(r){t(r)}else n<s?u(n,e,null):t(e)}))};function u(e,t,r){var o="function"==typeof a?a(e,t,r):a;setTimeout((function(){n(++e)}),o)}n(0)}))}}}()}(fetchRetry_umd);var fetchRetry_umdExports=fetchRetry_umd.exports;const retryFetch=getDefaultExportFromCjs$1(fetchRetry_umdExports),fetchWithRetry=()=>retryFetch(fetch,{retries:3});var Name=(e=>(e.Contractcall="CONTRACTCALL",e.Cryptotransfer="CRYPTOTRANSFER",e))(Name||{}),Result=(e=>(e.Success="SUCCESS",e))(Result||{});class HashinalsWalletConnectSDK{constructor(e,t){this.logger=e||new DefaultLogger,this.network=t||LedgerId.MAINNET}static getInstance(e,t){let r=null==HashinalsWalletConnectSDK?void 0:HashinalsWalletConnectSDK.instance;return r||(HashinalsWalletConnectSDK.instance=new HashinalsWalletConnectSDK(e,t),r=HashinalsWalletConnectSDK.instance),t&&r.setNetwork(t),r}setLogger(e){this.logger=e}setNetwork(e){this.network=e}getNetwork(){return this.network}setLogLevel(e){this.logger instanceof DefaultLogger?this.logger.setLogLevel(e):this.logger.warn("setLogLevel is only available for the default logger")}async init(e,t,r){const n=r||this.network,o="mainnet"===n.toString();return this.dAppConnector=new DAppConnector(t,n,e,Object.values(HederaJsonRpcMethod),[HederaSessionEvent.ChainChanged,HederaSessionEvent.AccountsChanged],[o?HederaChainId.Mainnet:HederaChainId.Testnet]),await this.dAppConnector.init({logger:"error"}),this.dAppConnector.onSessionIframeCreated=e=>{this.handleNewSession(e)},this.logger.info(`Hedera Wallet Connect SDK initialized on ${n}`),this.dAppConnector}async connect(){this.ensureInitialized();const e=await this.dAppConnector.openModal();return this.handleNewSession(e),e}async disconnect(){try{return this.ensureInitialized(),await this.dAppConnector.disconnectAll(),this.logger.info("Disconnected from all wallets"),!0}catch(e2){return this.logger.error("Failed to disconnect",e2),!1}}async executeTransaction(e,t=!1){this.ensureInitialized();const r=this.getAccountInfo(),n=null==r?void 0:r.accountId,o=this.dAppConnector.signers.find((e=>e.getAccountId().toString()===n));if(t){const t=await e.executeWithSigner(o);return await t.getReceiptWithSigner(o)}{const t=await e.freezeWithSigner(o),r=await t.executeWithSigner(o);return await r.getReceiptWithSigner(o)}}async executeTransactionWithErrorHandling(e,t){var r;try{return{result:await this.executeTransaction(e,t),error:void 0}}catch(e2){const t=null==(r=e2.message)?void 0:r.toLowerCase();if(this.logger.error("Failed to execute transaction",e2),this.logger.error("Failure reason for transaction is",t),t.includes("insufficient payer balance"))return{result:void 0,error:"Insufficient balance to complete the transaction."};if(t.includes("reject"))return{result:void 0,error:"You rejected the transaction"};if(t.includes("invalid signature"))return{result:void 0,error:"Invalid signature. Please check your account and try again."};if(t.includes("transaction expired"))return{result:void 0,error:"Transaction expired. Please try again."};if(t.includes("account not found"))return{result:void 0,error:"Account not found. Please check the account ID and try again."};if(t.includes("unauthorized"))return{result:void 0,error:"Unauthorized. You may not have the necessary permissions for this action."};if(t.includes("busy"))return{result:void 0,error:"The network is busy. Please try again later."};if(t.includes("invalid transaction"))return{result:void 0,error:"Invalid transaction. Please check your inputs and try again."}}}async submitMessageToTopic(e,t,r){this.ensureInitialized();let n=(new TopicMessageSubmitTransaction).setTopicId(TopicId.fromString(e)).setMessage(t);return r&&(n=await n.sign(r)),this.executeTransaction(n)}async transferHbar(e,t,r){this.ensureInitialized();const n=(new TransferTransaction).setTransactionId(TransactionId.generate(e)).addHbarTransfer(AccountId.fromString(e),new Hbar(-r)).addHbarTransfer(AccountId.fromString(t),new Hbar(r));return this.executeTransaction(n)}async executeSmartContract(e,t,r,n=1e5){this.ensureInitialized();const o=(new ContractExecuteTransaction).setContractId(ContractId.fromString(e)).setGas(n).setFunction(t,r);return this.executeTransaction(o)}handleNewSession(e){var t,r,n;const o=null==(n=null==(r=null==(t=e.namespaces)?void 0:t.hedera)?void 0:r.accounts)?void 0:n[0],i=null==o?void 0:o.split(":"),s=i.pop(),a=i.pop();this.logger.info("sessionAccount is",s,a),s?this.saveConnectionInfo(s,a):this.logger.error("No account id found in the session")}getNetworkPrefix(){const e=this.getAccountInfo(),t=null==e?void 0:e.network;if(!t){this.logger.warn("Network is not set on SDK, defaulting.");const e=localStorage.getItem("connectedNetwork");return e||"mainnet-public"}return t!==this.network&&(this.logger.warn("Detected network mismatch, reverting to signer network",t),this.network=t),t.isMainnet()?"mainnet-public":"testnet"}async requestAccount(e){try{const t=`https://${this.getNetworkPrefix()}.mirrornode.hedera.com/api/v1/accounts/${e}`,r=await fetchWithRetry()(t);if(!r.ok)throw new Error(`Failed to make request to mirror node for account: ${r.status}`);return await r.json()}catch(e2){throw this.logger.error("Failed to fetch account",e2),e2}}async getAccountBalance(){this.ensureInitialized();const e=this.getAccountInfo(),t=null==e?void 0:e.accountId;if(!t)return null;const r=await this.requestAccount(t);if(!r)throw new Error("Failed to fetch account. Try again or check if the Account ID is valid.");const n=r.balance.balance/10**8;return Number(n).toLocaleString("en-US")}getAccountInfo(){var e,t;const{accountId:r}=this.loadConnectionInfo();if(!r)return null;const n=null==(e=null==this?void 0:this.dAppConnector)?void 0:e.signers;if(!(null==n?void 0:n.length))return null;const o=this.dAppConnector.signers.find((e=>e.getAccountId().toString()===r));return{accountId:null==(t=null==o?void 0:o.getAccountId())?void 0:t.toString(),network:o.getLedgerId()}}async createTopic(e,t,r){this.ensureInitialized();let n=(new TopicCreateTransaction).setTopicMemo(e||"");if(t){const e=PrivateKey.fromString(t);n.setAdminKey(e.publicKey),n=await n.sign(e)}r&&n.setSubmitKey(PrivateKey.fromString(r).publicKey);return(await this.executeTransaction(n)).topicId.toString()}async createToken(e,t,r,n,o,i,s){this.ensureInitialized();let a=(new TokenCreateTransaction).setTokenName(e).setTokenSymbol(t).setDecimals(n).setInitialSupply(r).setTreasuryAccountId(AccountId.fromString(o)).setTokenType(TokenType.NonFungibleUnique).setSupplyType(TokenSupplyType.Finite);s&&(a=a.setSupplyKey(PrivateKey.fromString(s))),i&&(a=a.setAdminKey(PrivateKey.fromString(i)),a=await a.sign(PrivateKey.fromString(i)));return(await this.executeTransaction(a)).tokenId.toString()}async mintNFT(e,t,r){this.ensureInitialized();let n=await(new TokenMintTransaction).setTokenId(e).setMetadata([Buffer$1$1.from(t,"utf-8")]).sign(r);return this.executeTransaction(n)}async getMessages(e,t,r=!1){var n,o;const i=`${`https://${this.getNetworkPrefix()}.mirrornode.hedera.com`}/api/v1/topics/${e}/messages?limit=200${Number(t)>0&&!r?`×tamp=gt:${t}`:""}`;try{const t=await fetchWithRetry()(i);if(!t.ok)throw new Error(`Failed to make request to mirror node: ${t.status}`);const s=await t.json(),a=(null==s?void 0:s.messages)||[],c=null==(n=null==s?void 0:s.links)?void 0:n.next,u=a.map((e=>({...JSON.parse(atob(e.message)),payer:e.payer_account_id,created:new Date(1e3*Number(e.consensus_timestamp)),consensus_timestamp:e.consensus_timestamp,sequence_number:e.sequence_number})));if(c){const t=await this.getMessages(e,Number(null==(o=u[u.length-1])?void 0:o.consensus_timestamp),r);u.push(...t.messages)}return{messages:u.sort(((e,t)=>e.sequence_number-t.sequence_number)),error:""}}catch(s){return this.logger.error("Error fetching topic data:",s),{messages:[],error:s.toString()}}}saveConnectionInfo(e,t){e?(localStorage.setItem("connectedNetwork",t),localStorage.setItem("connectedAccountId",e)):(localStorage.removeItem("connectedAccountId"),localStorage.removeItem("connectedNetwork"))}loadConnectionInfo(){return{accountId:localStorage.getItem("connectedAccountId"),network:localStorage.getItem("connectedNetwork")}}async connectWallet(e,t,r){try{await this.init(e,t,r);const n=await this.connect(),o=this.getAccountInfo(),i=null==o?void 0:o.accountId,s=await this.getAccountBalance(),a=this.getNetworkPrefix();return this.saveConnectionInfo(i,a),{accountId:i,balance:s,session:n}}catch(n){throw this.logger.error("Failed to connect wallet:",n),n}}async disconnectWallet(e=!0){try{const t=await this.disconnect();return t&&e&&localStorage.clear(),this.saveConnectionInfo(void 0),t}catch(t){return this.logger.error("Failed to disconnect wallet:",t),!1}}async initAccount(e,t){const{accountId:r,network:n}=this.loadConnectionInfo();if(r&&n)try{const o="mainnet"===n?LedgerId.MAINNET:LedgerId.TESTNET;await this.init(e,t,o);return{accountId:r,balance:await this.getAccountBalance()}}catch(o){return this.logger.error("Failed to reconnect:",o),this.saveConnectionInfo(void 0,void 0),null}return null}ensureInitialized(){if(!this.dAppConnector)throw new Error("SDK not initialized. Call init() first.")}static run(){try{"undefined"!=typeof window&&(window.HashinalsWalletConnectSDK=HashinalsWalletConnectSDK.getInstance(),window.HashgraphSDK=HashgraphSDK)}catch(e2){console.error("[ERROR]: failed setting sdk on window")}}async transferToken(e,t,r,n){this.ensureInitialized();const o=(new TransferTransaction).setTransactionId(TransactionId.generate(t)).addTokenTransfer(TokenId.fromString(e),AccountId.fromString(t),-n).addTokenTransfer(TokenId.fromString(e),AccountId.fromString(r),n);return this.executeTransaction(o)}async createAccount(e){this.ensureInitialized();const t=(new AccountCreateTransaction).setInitialBalance(new Hbar(e));return this.executeTransaction(t)}async associateTokenToAccount(e,t){this.ensureInitialized();const r=(new TokenAssociateTransaction).setAccountId(AccountId.fromString(e)).setTokenIds([TokenId.fromString(t)]);return this.executeTransaction(r)}async dissociateTokenFromAccount(e,t){this.ensureInitialized();const r=(new TokenDissociateTransaction).setAccountId(AccountId.fromString(e)).setTokenIds([TokenId.fromString(t)]);return this.executeTransaction(r)}async updateAccount(e,t){this.ensureInitialized();const r=(new AccountUpdateTransaction).setAccountId(AccountId.fromString(e)).setMaxAutomaticTokenAssociations(t);return this.executeTransaction(r)}async approveAllowance(e,t,r,n){this.ensureInitialized();const o=(new AccountAllowanceApproveTransaction).approveTokenAllowance(TokenId.fromString(t),AccountId.fromString(n),AccountId.fromString(e),r);return this.executeTransaction(o)}async getAccountTokens(e){var t,r;this.ensureInitialized();const n=`https://${this.getNetworkPrefix()}.mirrornode.hedera.com`,o=`${n}/api/v1/accounts/${e}/tokens?limit=200`;try{const e=await fetchWithRetry()(o);if(!e.ok)throw new Error(`Failed to make request to mirror node for account tokens: ${e.status}`);const i=await e.json(),s=[];for(const t of i.tokens)t.token_id&&s.push({tokenId:t.token_id,balance:t.balance,decimals:t.decimals,formatted_balance:(t.balance/10**t.decimals).toLocaleString("en-US"),created_timestamp:new Date(1e3*Number(t.created_timestamp))});let a=null==(t=i.links)?void 0:t.next;for(;a;){const e=`${n}${a}`,t=await fetchWithRetry()(e);if(!t.ok)throw new Error(`Failed to make request to mirror node for account tokens: ${t.status}, page: ${e}`);const o=await t.json();for(const r of o.tokens)r.token_id&&s.push({tokenId:r.token_id,balance:r.balance,decimals:r.decimals,formatted_balance:(r.balance/10**r.decimals).toLocaleString("en-US"),created_timestamp:new Date(1e3*Number(r.created_timestamp))});a=null==(r=o.links)?void 0:r.next}return{tokens:s}}catch(i){throw this.logger.error("Error fetching account tokens:",i),i}}}HashinalsWalletConnectSDK.run();
|
|
111
111
|
/**
|
|
112
112
|
* @license
|
|
113
113
|
* Copyright 2019 Google LLC
|
|
@@ -166,5 +166,5 @@ const t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e
|
|
|
166
166
|
* @license
|
|
167
167
|
* Copyright 2018 Google LLC
|
|
168
168
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
169
|
-
*/const l=e=>null!=e?e:A$1;var browser={},canPromise$1=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then},qrcode={},utils$1={};let toSJISFunction;const CODEWORDS_COUNT=[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];utils$1.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 4*e+17},utils$1.getSymbolTotalCodewords=function(e){return CODEWORDS_COUNT[e]},utils$1.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},utils$1.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');toSJISFunction=e},utils$1.isKanjiModeEnabled=function(){return void 0!==toSJISFunction},utils$1.toSJIS=function(e){return toSJISFunction(e)};var errorCorrectionLevel={};function BitBuffer$1(){this.buffer=[],this.length=0}!function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2},e.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},e.from=function(t,r){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+t)}}(t)}catch(e2){return r}}}(errorCorrectionLevel),BitBuffer$1.prototype={get:function(e){const t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(let r=0;r<t;r++)this.putBit(1==(e>>>t-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var bitBuffer=BitBuffer$1;function BitMatrix$1(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}BitMatrix$1.prototype.set=function(e,t,r,n){const o=e*this.size+t;this.data[o]=r,n&&(this.reservedBit[o]=!0)},BitMatrix$1.prototype.get=function(e,t){return this.data[e*this.size+t]},BitMatrix$1.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r},BitMatrix$1.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var bitMatrix=BitMatrix$1,alignmentPattern={};!function(e){const t=utils$1.getSymbolSize;e.getRowColCoords=function(e){if(1===e)return[];const r=Math.floor(e/7)+2,n=t(e),o=145===n?26:2*Math.ceil((n-13)/(2*r-2)),i=[n-7];for(let t=1;t<r-1;t++)i[t]=i[t-1]-o;return i.push(6),i.reverse()},e.getPositions=function(t){const r=[],n=e.getRowColCoords(t),o=n.length;for(let e=0;e<o;e++)for(let t=0;t<o;t++)0===e&&0===t||0===e&&t===o-1||e===o-1&&0===t||r.push([n[e],n[t]]);return r}}(alignmentPattern);var finderPattern={};const getSymbolSize=utils$1.getSymbolSize,FINDER_PATTERN_SIZE=7;finderPattern.getPositions=function(e){const t=getSymbolSize(e);return[[0,0],[t-FINDER_PATTERN_SIZE,0],[0,t-FINDER_PATTERN_SIZE]]};var maskPattern={};!function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t=3,r=3,n=40,o=10;function i(t,r,n){switch(t){case e.Patterns.PATTERN000:return(r+n)%2==0;case e.Patterns.PATTERN001:return r%2==0;case e.Patterns.PATTERN010:return n%3==0;case e.Patterns.PATTERN011:return(r+n)%3==0;case e.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(n/3))%2==0;case e.Patterns.PATTERN101:return r*n%2+r*n%3==0;case e.Patterns.PATTERN110:return(r*n%2+r*n%3)%2==0;case e.Patterns.PATTERN111:return(r*n%3+(r+n)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}}e.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){const r=e.size;let n=0,o=0,i=0,s=null,a=null;for(let c=0;c<r;c++){o=i=0,s=a=null;for(let u=0;u<r;u++){let r=e.get(c,u);r===s?o++:(o>=5&&(n+=t+(o-5)),s=r,o=1),r=e.get(u,c),r===a?i++:(i>=5&&(n+=t+(i-5)),a=r,i=1)}o>=5&&(n+=t+(o-5)),i>=5&&(n+=t+(i-5))}return n},e.getPenaltyN2=function(e){const t=e.size;let n=0;for(let r=0;r<t-1;r++)for(let o=0;o<t-1;o++){const t=e.get(r,o)+e.get(r,o+1)+e.get(r+1,o)+e.get(r+1,o+1);4!==t&&0!==t||n++}return n*r},e.getPenaltyN3=function(e){const t=e.size;let r=0,o=0,i=0;for(let n=0;n<t;n++){o=i=0;for(let s=0;s<t;s++)o=o<<1&2047|e.get(n,s),s>=10&&(1488===o||93===o)&&r++,i=i<<1&2047|e.get(s,n),s>=10&&(1488===i||93===i)&&r++}return r*n},e.getPenaltyN4=function(e){let t=0;const r=e.data.length;for(let n=0;n<r;n++)t+=e.data[n];return Math.abs(Math.ceil(100*t/r/5)-10)*o},e.applyMask=function(e,t){const r=t.size;for(let n=0;n<r;n++)for(let o=0;o<r;o++)t.isReserved(o,n)||t.xor(o,n,i(e,o,n))},e.getBestMask=function(t,r){const n=Object.keys(e.Patterns).length;let o=0,i=1/0;for(let s=0;s<n;s++){r(s),e.applyMask(s,t);const n=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(s,t),n<i&&(i=n,o=s)}return o}}(maskPattern);var errorCorrectionCode={};const ECLevel$1=errorCorrectionLevel,EC_BLOCKS_TABLE=[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],EC_CODEWORDS_TABLE=[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];errorCorrectionCode.getBlocksCount=function(e,t){switch(t){case ECLevel$1.L:return EC_BLOCKS_TABLE[4*(e-1)+0];case ECLevel$1.M:return EC_BLOCKS_TABLE[4*(e-1)+1];case ECLevel$1.Q:return EC_BLOCKS_TABLE[4*(e-1)+2];case ECLevel$1.H:return EC_BLOCKS_TABLE[4*(e-1)+3];default:return}},errorCorrectionCode.getTotalCodewordsCount=function(e,t){switch(t){case ECLevel$1.L:return EC_CODEWORDS_TABLE[4*(e-1)+0];case ECLevel$1.M:return EC_CODEWORDS_TABLE[4*(e-1)+1];case ECLevel$1.Q:return EC_CODEWORDS_TABLE[4*(e-1)+2];case ECLevel$1.H:return EC_CODEWORDS_TABLE[4*(e-1)+3];default:return}};var polynomial={},galoisField={};const EXP_TABLE=new Uint8Array(512),LOG_TABLE=new Uint8Array(256);!function(){let e=1;for(let t=0;t<255;t++)EXP_TABLE[t]=e,LOG_TABLE[e]=t,e<<=1,256&e&&(e^=285);for(let t=255;t<512;t++)EXP_TABLE[t]=EXP_TABLE[t-255]}(),galoisField.log=function(e){if(e<1)throw new Error("log("+e+")");return LOG_TABLE[e]},galoisField.exp=function(e){return EXP_TABLE[e]},galoisField.mul=function(e,t){return 0===e||0===t?0:EXP_TABLE[LOG_TABLE[e]+LOG_TABLE[t]]},function(e){const t=galoisField;e.mul=function(e,r){const n=new Uint8Array(e.length+r.length-1);for(let o=0;o<e.length;o++)for(let i=0;i<r.length;i++)n[o+i]^=t.mul(e[o],r[i]);return n},e.mod=function(e,r){let n=new Uint8Array(e);for(;n.length-r.length>=0;){const e=n[0];for(let i=0;i<r.length;i++)n[i]^=t.mul(r[i],e);let o=0;for(;o<n.length&&0===n[o];)o++;n=n.slice(o)}return n},e.generateECPolynomial=function(r){let n=new Uint8Array([1]);for(let o=0;o<r;o++)n=e.mul(n,new Uint8Array([1,t.exp(o)]));return n}}(polynomial);const Polynomial=polynomial;function ReedSolomonEncoder$1(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}ReedSolomonEncoder$1.prototype.initialize=function(e){this.degree=e,this.genPoly=Polynomial.generateECPolynomial(this.degree)},ReedSolomonEncoder$1.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 r=Polynomial.mod(t,this.genPoly),n=this.degree-r.length;if(n>0){const e=new Uint8Array(this.degree);return e.set(r,n),e}return r};var reedSolomonEncoder=ReedSolomonEncoder$1,version={},mode={},versionCheck={isValid:function(e){return!isNaN(e)&&e>=1&&e<=40}},regex={};const numeric="[0-9]+",alphanumeric="[A-Z $%*+\\-./:]+";let kanji="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";kanji=kanji.replace(/u/g,"\\u");const byte="(?:(?![A-Z0-9 $%*+\\-./:]|"+kanji+")(?:.|[\r\n]))+";regex.KANJI=new RegExp(kanji,"g"),regex.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),regex.BYTE=new RegExp(byte,"g"),regex.NUMERIC=new RegExp(numeric,"g"),regex.ALPHANUMERIC=new RegExp(alphanumeric,"g");const TEST_KANJI=new RegExp("^"+kanji+"$"),TEST_NUMERIC=new RegExp("^"+numeric+"$"),TEST_ALPHANUMERIC=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");regex.testKanji=function(e){return TEST_KANJI.test(e)},regex.testNumeric=function(e){return TEST_NUMERIC.test(e)},regex.testAlphanumeric=function(e){return TEST_ALPHANUMERIC.test(e)},function(e){const t=versionCheck,r=regex;e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!t.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return r.testNumeric(t)?e.NUMERIC:r.testAlphanumeric(t)?e.ALPHANUMERIC:r.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},e.isValid=function(e){return e&&e.bit&&e.ccBits},e.from=function(t,r){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(e2){return r}}}(mode),function(e){const t=utils$1,r=errorCorrectionCode,n=errorCorrectionLevel,o=mode,i=versionCheck,s=t.getBCHDigit(7973);function a(e,t){return o.getCharCountIndicator(e,t)+4}function c(e,t){let r=0;return e.forEach((function(e){const n=a(e.mode,t);r+=n+e.getBitsLength()})),r}e.from=function(e,t){return i.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,n,s){if(!i.isValid(e))throw new Error("Invalid QR Code version");void 0===s&&(s=o.BYTE);const c=8*(t.getSymbolTotalCodewords(e)-r.getTotalCodewordsCount(e,n));if(s===o.MIXED)return c;const u=c-a(s,e);switch(s){case o.NUMERIC:return Math.floor(u/10*3);case o.ALPHANUMERIC:return Math.floor(u/11*2);case o.KANJI:return Math.floor(u/13);case o.BYTE:default:return Math.floor(u/8)}},e.getBestVersionForData=function(t,r){let i;const s=n.from(r,n.M);if(Array.isArray(t)){if(t.length>1)return function(t,r){for(let n=1;n<=40;n++)if(c(t,n)<=e.getCapacity(n,r,o.MIXED))return n}(t,s);if(0===t.length)return 1;i=t[0]}else i=t;return function(t,r,n){for(let o=1;o<=40;o++)if(r<=e.getCapacity(o,n,t))return o}(i.mode,i.getLength(),s)},e.getEncodedBits=function(e){if(!i.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;t.getBCHDigit(r)-s>=0;)r^=7973<<t.getBCHDigit(r)-s;return e<<12|r}}(version);var formatInfo={};const Utils$3=utils$1,G15=1335,G15_MASK=21522,G15_BCH=Utils$3.getBCHDigit(G15);formatInfo.getEncodedBits=function(e,t){const r=e.bit<<3|t;let n=r<<10;for(;Utils$3.getBCHDigit(n)-G15_BCH>=0;)n^=G15<<Utils$3.getBCHDigit(n)-G15_BCH;return(r<<10|n)^G15_MASK};var segments={};const Mode$4=mode;function NumericData(e){this.mode=Mode$4.NUMERIC,this.data=e.toString()}NumericData.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},NumericData.prototype.getLength=function(){return this.data.length},NumericData.prototype.getBitsLength=function(){return NumericData.getBitsLength(this.data.length)},NumericData.prototype.write=function(e){let t,r,n;for(t=0;t+3<=this.data.length;t+=3)r=this.data.substr(t,3),n=parseInt(r,10),e.put(n,10);const o=this.data.length-t;o>0&&(r=this.data.substr(t),n=parseInt(r,10),e.put(n,3*o+1))};var numericData=NumericData;const Mode$3=mode,ALPHA_NUM_CHARS=["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 AlphanumericData(e){this.mode=Mode$3.ALPHANUMERIC,this.data=e}AlphanumericData.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},AlphanumericData.prototype.getLength=function(){return this.data.length},AlphanumericData.prototype.getBitsLength=function(){return AlphanumericData.getBitsLength(this.data.length)},AlphanumericData.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let r=45*ALPHA_NUM_CHARS.indexOf(this.data[t]);r+=ALPHA_NUM_CHARS.indexOf(this.data[t+1]),e.put(r,11)}this.data.length%2&&e.put(ALPHA_NUM_CHARS.indexOf(this.data[t]),6)};var alphanumericData=AlphanumericData,encodeUtf8$1=function(e){for(var t=[],r=e.length,n=0;n<r;n++){var o=e.charCodeAt(n);if(o>=55296&&o<=56319&&r>n+1){var i=e.charCodeAt(n+1);i>=56320&&i<=57343&&(o=1024*(o-55296)+i-56320+65536,n+=1)}o<128?t.push(o):o<2048?(t.push(o>>6|192),t.push(63&o|128)):o<55296||o>=57344&&o<65536?(t.push(o>>12|224),t.push(o>>6&63|128),t.push(63&o|128)):o>=65536&&o<=1114111?(t.push(o>>18|240),t.push(o>>12&63|128),t.push(o>>6&63|128),t.push(63&o|128)):t.push(239,191,189)}return new Uint8Array(t).buffer};const encodeUtf8=encodeUtf8$1,Mode$2=mode;function ByteData(e){this.mode=Mode$2.BYTE,"string"==typeof e&&(e=encodeUtf8(e)),this.data=new Uint8Array(e)}ByteData.getBitsLength=function(e){return 8*e},ByteData.prototype.getLength=function(){return this.data.length},ByteData.prototype.getBitsLength=function(){return ByteData.getBitsLength(this.data.length)},ByteData.prototype.write=function(e){for(let t=0,r=this.data.length;t<r;t++)e.put(this.data[t],8)};var byteData=ByteData;const Mode$1=mode,Utils$2=utils$1;function KanjiData(e){this.mode=Mode$1.KANJI,this.data=e}KanjiData.getBitsLength=function(e){return 13*e},KanjiData.prototype.getLength=function(){return this.data.length},KanjiData.prototype.getBitsLength=function(){return KanjiData.getBitsLength(this.data.length)},KanjiData.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let r=Utils$2.toSJIS(this.data[t]);if(r>=33088&&r<=40956)r-=33088;else{if(!(r>=57408&&r<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");r-=49472}r=192*(r>>>8&255)+(255&r),e.put(r,13)}};var kanjiData=KanjiData;!function(e){const t=mode,r=numericData,n=alphanumericData,o=byteData,i=kanjiData,s=regex,a=utils$1,c=dijkstraExports;function u(e){return unescape(encodeURIComponent(e)).length}function l(e,t,r){const n=[];let o;for(;null!==(o=e.exec(r));)n.push({data:o[0],index:o.index,mode:t,length:o[0].length});return n}function d(e){const r=l(s.NUMERIC,t.NUMERIC,e),n=l(s.ALPHANUMERIC,t.ALPHANUMERIC,e);let o,i;a.isKanjiModeEnabled()?(o=l(s.BYTE,t.BYTE,e),i=l(s.KANJI,t.KANJI,e)):(o=l(s.BYTE_KANJI,t.BYTE,e),i=[]);return r.concat(n,o,i).sort((function(e,t){return e.index-t.index})).map((function(e){return{data:e.data,mode:e.mode,length:e.length}}))}function h(e,s){switch(s){case t.NUMERIC:return r.getBitsLength(e);case t.ALPHANUMERIC:return n.getBitsLength(e);case t.KANJI:return i.getBitsLength(e);case t.BYTE:return o.getBitsLength(e)}}function f(e,s){let c;const u=t.getBestModeForData(e);if(c=t.from(s,u),c!==t.BYTE&&c.bit<u.bit)throw new Error('"'+e+'" cannot be encoded with mode '+t.toString(c)+".\n Suggested mode is: "+t.toString(u));switch(c!==t.KANJI||a.isKanjiModeEnabled()||(c=t.BYTE),c){case t.NUMERIC:return new r(e);case t.ALPHANUMERIC:return new n(e);case t.KANJI:return new i(e);case t.BYTE:return new o(e)}}e.fromArray=function(e){return e.reduce((function(e,t){return"string"==typeof t?e.push(f(t,null)):t.data&&e.push(f(t.data,t.mode)),e}),[])},e.fromString=function(r,n){const o=function(e){const r=[];for(let n=0;n<e.length;n++){const o=e[n];switch(o.mode){case t.NUMERIC:r.push([o,{data:o.data,mode:t.ALPHANUMERIC,length:o.length},{data:o.data,mode:t.BYTE,length:o.length}]);break;case t.ALPHANUMERIC:r.push([o,{data:o.data,mode:t.BYTE,length:o.length}]);break;case t.KANJI:r.push([o,{data:o.data,mode:t.BYTE,length:u(o.data)}]);break;case t.BYTE:r.push([{data:o.data,mode:t.BYTE,length:u(o.data)}])}}return r}(d(r,a.isKanjiModeEnabled())),i=function(e,r){const n={},o={start:{}};let i=["start"];for(let s=0;s<e.length;s++){const a=e[s],c=[];for(let e=0;e<a.length;e++){const u=a[e],l=""+s+e;c.push(l),n[l]={node:u,lastCount:0},o[l]={};for(let e=0;e<i.length;e++){const s=i[e];n[s]&&n[s].node.mode===u.mode?(o[s][l]=h(n[s].lastCount+u.length,u.mode)-h(n[s].lastCount,u.mode),n[s].lastCount+=u.length):(n[s]&&(n[s].lastCount=u.length),o[s][l]=h(u.length,u.mode)+4+t.getCharCountIndicator(u.mode,r))}}i=c}for(let t=0;t<i.length;t++)o[i[t]].end=0;return{map:o,table:n}}(o,n),s=c.find_path(i.map,"start","end"),l=[];for(let e=1;e<s.length-1;e++)l.push(i.table[s[e]].node);return e.fromArray(function(e){return e.reduce((function(e,t){const r=e.length-1>=0?e[e.length-1]:null;return r&&r.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)}),[])}(l))},e.rawSplit=function(t){return e.fromArray(d(t,a.isKanjiModeEnabled()))}}(segments);const Utils$1=utils$1,ECLevel=errorCorrectionLevel,BitBuffer=bitBuffer,BitMatrix=bitMatrix,AlignmentPattern=alignmentPattern,FinderPattern=finderPattern,MaskPattern=maskPattern,ECCode=errorCorrectionCode,ReedSolomonEncoder=reedSolomonEncoder,Version=version,FormatInfo=formatInfo,Mode=mode,Segments=segments;function setupFinderPattern(e,t){const r=e.size,n=FinderPattern.getPositions(t);for(let o=0;o<n.length;o++){const t=n[o][0],i=n[o][1];for(let n=-1;n<=7;n++)if(!(t+n<=-1||r<=t+n))for(let o=-1;o<=7;o++)i+o<=-1||r<=i+o||(n>=0&&n<=6&&(0===o||6===o)||o>=0&&o<=6&&(0===n||6===n)||n>=2&&n<=4&&o>=2&&o<=4?e.set(t+n,i+o,!0,!0):e.set(t+n,i+o,!1,!0))}}function setupTimingPattern(e){const t=e.size;for(let r=8;r<t-8;r++){const t=r%2==0;e.set(r,6,t,!0),e.set(6,r,t,!0)}}function setupAlignmentPattern(e,t){const r=AlignmentPattern.getPositions(t);for(let n=0;n<r.length;n++){const t=r[n][0],o=r[n][1];for(let r=-2;r<=2;r++)for(let n=-2;n<=2;n++)-2===r||2===r||-2===n||2===n||0===r&&0===n?e.set(t+r,o+n,!0,!0):e.set(t+r,o+n,!1,!0)}}function setupVersionInfo(e,t){const r=e.size,n=Version.getEncodedBits(t);let o,i,s;for(let a=0;a<18;a++)o=Math.floor(a/3),i=a%3+r-8-3,s=1==(n>>a&1),e.set(o,i,s,!0),e.set(i,o,s,!0)}function setupFormatInfo(e,t,r){const n=e.size,o=FormatInfo.getEncodedBits(t,r);let i,s;for(i=0;i<15;i++)s=1==(o>>i&1),i<6?e.set(i,8,s,!0):i<8?e.set(i+1,8,s,!0):e.set(n-15+i,8,s,!0),i<8?e.set(8,n-i-1,s,!0):i<9?e.set(8,15-i-1+1,s,!0):e.set(8,15-i-1,s,!0);e.set(n-8,8,1,!0)}function setupData(e,t){const r=e.size;let n=-1,o=r-1,i=7,s=0;for(let a=r-1;a>0;a-=2)for(6===a&&a--;;){for(let r=0;r<2;r++)if(!e.isReserved(o,a-r)){let n=!1;s<t.length&&(n=1==(t[s]>>>i&1)),e.set(o,a-r,n),i--,-1===i&&(s++,i=7)}if(o+=n,o<0||r<=o){o-=n,n=-n;break}}}function createData(e,t,r){const n=new BitBuffer;r.forEach((function(t){n.put(t.mode.bit,4),n.put(t.getLength(),Mode.getCharCountIndicator(t.mode,e)),t.write(n)}));const o=8*(Utils$1.getSymbolTotalCodewords(e)-ECCode.getTotalCodewordsCount(e,t));for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(0);const i=(o-n.getLengthInBits())/8;for(let s=0;s<i;s++)n.put(s%2?17:236,8);return createCodewords(n,e,t)}function createCodewords(e,t,r){const n=Utils$1.getSymbolTotalCodewords(t),o=n-ECCode.getTotalCodewordsCount(t,r),i=ECCode.getBlocksCount(t,r),s=i-n%i,a=Math.floor(n/i),c=Math.floor(o/i),u=c+1,l=a-c,d=new ReedSolomonEncoder(l);let h=0;const f=new Array(i),p=new Array(i);let m=0;const y=new Uint8Array(e.buffer);for(let _=0;_<i;_++){const e=_<s?c:u;f[_]=y.slice(h,h+e),p[_]=d.encode(f[_]),h+=e,m=Math.max(m,e)}const g=new Uint8Array(n);let b,w,v=0;for(b=0;b<m;b++)for(w=0;w<i;w++)b<f[w].length&&(g[v++]=f[w][b]);for(b=0;b<l;b++)for(w=0;w<i;w++)g[v++]=p[w][b];return g}function createSymbol(e,t,r,n){let o;if(Array.isArray(e))o=Segments.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");{let n=t;if(!n){const t=Segments.rawSplit(e);n=Version.getBestVersionForData(t,r)}o=Segments.fromString(e,n||40)}}const i=Version.getBestVersionForData(o,r);if(!i)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<i)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+i+".\n")}else t=i;const s=createData(t,r,o),a=Utils$1.getSymbolSize(t),c=new BitMatrix(a);return setupFinderPattern(c,t),setupTimingPattern(c),setupAlignmentPattern(c,t),setupFormatInfo(c,r,0),t>=7&&setupVersionInfo(c,t),setupData(c,s),isNaN(n)&&(n=MaskPattern.getBestMask(c,setupFormatInfo.bind(null,c,r))),MaskPattern.applyMask(n,c),setupFormatInfo(c,r,n),{modules:c,version:t,errorCorrectionLevel:r,maskPattern:n,segments:o}}qrcode.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");let r,n,o=ECLevel.M;return void 0!==t&&(o=ECLevel.from(t.errorCorrectionLevel,ECLevel.M),r=Version.from(t.version),n=MaskPattern.from(t.maskPattern),t.toSJISFunc&&Utils$1.setToSJISFunction(t.toSJISFunc)),createSymbol(e,r,o,n)};var canvas={},utils={};!function(e){function t(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map((function(e){return[e,e]})))),6===t.length&&t.push("F","F");const r=parseInt(t.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:255&r,hex:"#"+t.slice(0,6).join("")}}e.getOptions=function(e){e||(e={}),e.color||(e.color={});const r=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,o=e.scale||4;return{width:n,scale:n?4:o,margin:r,color:{dark:t(e.color.dark||"#000000ff"),light:t(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},e.getImageWidth=function(t,r){const n=e.getScale(t,r);return Math.floor((t+2*r.margin)*n)},e.qrToImageData=function(t,r,n){const o=r.modules.size,i=r.modules.data,s=e.getScale(o,n),a=Math.floor((o+2*n.margin)*s),c=n.margin*s,u=[n.color.light,n.color.dark];for(let e=0;e<a;e++)for(let r=0;r<a;r++){let l=4*(e*a+r),d=n.color.light;if(e>=c&&r>=c&&e<a-c&&r<a-c){d=u[i[Math.floor((e-c)/s)*o+Math.floor((r-c)/s)]?1:0]}t[l++]=d.r,t[l++]=d.g,t[l++]=d.b,t[l]=d.a}}}(utils),function(e){const t=utils;e.render=function(e,r,n){let o=n,i=r;void 0!==o||r&&r.getContext||(o=r,r=void 0),r||(i=function(){try{return document.createElement("canvas")}catch(e2){throw new Error("You need to specify a canvas element")}}()),o=t.getOptions(o);const s=t.getImageWidth(e.modules.size,o),a=i.getContext("2d"),c=a.createImageData(s,s);return t.qrToImageData(c.data,e,o),function(e,t,r){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=r,t.width=r,t.style.height=r+"px",t.style.width=r+"px"}(a,i,s),a.putImageData(c,0,0),i},e.renderToDataURL=function(t,r,n){let o=n;void 0!==o||r&&r.getContext||(o=r,r=void 0),o||(o={});const i=e.render(t,r,o),s=o.type||"image/png",a=o.rendererOpts||{};return i.toDataURL(s,a.quality)}}(canvas);var svgTag={};const Utils=utils;function getColorAttrib(e,t){const r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function svgCmd(e,t,r){let n=e+t;return void 0!==r&&(n+=" "+r),n}function qrToPath(e,t,r){let n="",o=0,i=!1,s=0;for(let a=0;a<e.length;a++){const c=Math.floor(a%t),u=Math.floor(a/t);c||i||(i=!0),e[a]?(s++,a>0&&c>0&&e[a-1]||(n+=i?svgCmd("M",c+r,.5+u+r):svgCmd("m",o,0),o=0,i=!1),c+1<t&&e[a+1]||(n+=svgCmd("h",s),s=0)):o++}return n}svgTag.render=function(e,t,r){const n=Utils.getOptions(t),o=e.modules.size,i=e.modules.data,s=o+2*n.margin,a=n.color.light.a?"<path "+getColorAttrib(n.color.light,"fill")+' d="M0 0h'+s+"v"+s+'H0z"/>':"",c="<path "+getColorAttrib(n.color.dark,"stroke")+' d="'+qrToPath(i,o,n.margin)+'"/>',u='viewBox="0 0 '+s+" "+s+'"',l='<svg xmlns="http://www.w3.org/2000/svg" '+(n.width?'width="'+n.width+'" height="'+n.width+'" ':"")+u+' shape-rendering="crispEdges">'+a+c+"</svg>\n";return"function"==typeof r&&r(null,l),l};const canPromise=canPromise$1,QRCode=qrcode,CanvasRenderer=canvas,SvgRenderer=svgTag;function renderCanvas(e,t,r,n,o){const i=[].slice.call(arguments,1),s=i.length,a="function"==typeof i[s-1];if(!a&&!canPromise())throw new Error("Callback required as last argument");if(!a){if(s<1)throw new Error("Too few arguments provided");return 1===s?(r=t,t=n=void 0):2!==s||t.getContext||(n=r,r=t,t=void 0),new Promise((function(o,i){try{const i=QRCode.create(r,n);o(e(i,t,n))}catch(e2){i(e2)}}))}if(s<2)throw new Error("Too few arguments provided");2===s?(o=r,r=t,t=n=void 0):3===s&&(t.getContext&&void 0===o?(o=n,n=void 0):(o=n,n=r,r=t,t=void 0));try{const i=QRCode.create(r,n);o(null,e(i,t,n))}catch(e2){o(e2)}}browser.create=QRCode.create,browser.toCanvas=renderCanvas.bind(null,CanvasRenderer.render),browser.toDataURL=renderCanvas.bind(null,CanvasRenderer.renderToDataURL),browser.toString=renderCanvas.bind(null,(function(e,t,r){return SvgRenderer.render(e,r)}));var et=Object.defineProperty,Be=Object.getOwnPropertySymbols,tt=Object.prototype.hasOwnProperty,ot=Object.prototype.propertyIsEnumerable,Ue=(e,t,r)=>t in e?et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ve=(e,t)=>{for(var r in t||(t={}))tt.call(t,r)&&Ue(e,r,t[r]);if(Be)for(var r of Be(t))ot.call(t,r)&&Ue(e,r,t[r]);return e};function rt(){var e;const 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)"}}[null!=(e=ne$1.state.themeMode)?e:"dark"];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 He(){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 h={getPreset:e=>He()[e],setTheme(){const e=document.querySelector(":root"),{themeVariables:t}=ne$1.state;if(e){const r=ve(ve(ve({},rt()),He()),t);Object.entries(r).forEach((([t,r])=>e.style.setProperty(t,r)))}},globalCss:i$3`*,::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)}`},at=i$3`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 lt=Object.defineProperty,it=Object.getOwnPropertyDescriptor,F=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?it(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&<(t,r,i),i};let T=class extends s{constructor(){super(...arguments),this.disabled=!1,this.iconLeft=void 0,this.iconRight=void 0,this.onClick=()=>null,this.variant="default"}render(){const e={"wcm-icon-left":void 0!==this.iconLeft,"wcm-icon-right":void 0!==this.iconRight,"wcm-ghost":"ghost"===this.variant,"wcm-outline":"outline"===this.variant};let t="inverse";return"ghost"===this.variant&&(t="secondary"),"outline"===this.variant&&(t="accent"),x`<button class="${o(e)}" ?disabled="${this.disabled}" @click="${this.onClick}">${this.iconLeft}<wcm-text variant="small-regular" color="${t}"><slot></slot></wcm-text>${this.iconRight}</button>`}};T.styles=[h.globalCss,at],F([n$1({type:Boolean})],T.prototype,"disabled",2),F([n$1()],T.prototype,"iconLeft",2),F([n$1()],T.prototype,"iconRight",2),F([n$1()],T.prototype,"onClick",2),F([n$1()],T.prototype,"variant",2),T=F([e$2("wcm-button")],T);const nt=i$3`: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 ct=Object.defineProperty,st=Object.getOwnPropertyDescriptor,ue=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?st(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&ct(t,r,i),i};let ee=class extends s{constructor(){super(...arguments),this.disabled=!1,this.variant="primary"}render(){const e={"wcm-secondary":"secondary"===this.variant};return x`<button ?disabled="${this.disabled}" class="${o(e)}"><slot></slot></button>`}};ee.styles=[h.globalCss,nt],ue([n$1({type:Boolean})],ee.prototype,"disabled",2),ue([n$1()],ee.prototype,"variant",2),ee=ue([e$2("wcm-button-big")],ee);const dt=i$3`: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 wt=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let be=class extends s{render(){return x`<div><slot></slot></div>`}};be.styles=[h.globalCss,dt],be=wt([e$2("wcm-info-footer")],be);const v={CROSS_ICON:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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>`},pt=i$3`.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 ut=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let fe=class extends s{render(){return x`<div class="wcm-toolbar-placeholder"></div><div class="wcm-toolbar">${v.WALLET_CONNECT_LOGO} <button @click="${se$1.close}">${v.CROSS_ICON}</button></div>`}};fe.styles=[h.globalCss,pt],fe=ut([e$2("wcm-modal-backcard")],fe);const bt=i$3`main{padding:20px;padding-top:0;width:100%}`;var yt=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let xe=class extends s{render(){return x`<main><slot></slot></main>`}};xe.styles=[h.globalCss,bt],xe=yt([e$2("wcm-modal-content")],xe);const $t=i$3`footer{padding:10px;display:flex;flex-direction:column;align-items:inherit;justify-content:inherit;border-top:1px solid var(--wcm-color-bg-2)}`;var Ot=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let ye=class extends s{render(){return x`<footer><slot></slot></footer>`}};ye.styles=[h.globalCss,$t],ye=Ot([e$2("wcm-modal-footer")],ye);const Wt=i$3`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 It=Object.defineProperty,Et=Object.getOwnPropertyDescriptor,te=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?Et(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&It(t,r,i),i};let S=class extends s{constructor(){super(...arguments),this.title="",this.onAction=void 0,this.actionIcon=void 0,this.border=!1}backBtnTemplate(){return x`<button class="wcm-back-btn" @click="${T$2.goBack}">${v.BACK_ICON}</button>`}actionBtnTemplate(){return x`<button class="wcm-action-btn" @click="${this.onAction}">${this.actionIcon}</button>`}render(){const e={"wcm-border":this.border},t=T$2.state.history.length>1,r=this.title?x`<wcm-text variant="big-bold">${this.title}</wcm-text>`:x`<slot></slot>`;return x`<header class="${o(e)}">${t?this.backBtnTemplate():null} ${r} ${this.onAction?this.actionBtnTemplate():null}</header>`}};S.styles=[h.globalCss,Wt],te([n$1()],S.prototype,"title",2),te([n$1()],S.prototype,"onAction",2),te([n$1()],S.prototype,"actionIcon",2),te([n$1({type:Boolean})],S.prototype,"border",2),S=te([e$2("wcm-modal-header")],S);const c={MOBILE_BREAKPOINT:600,WCM_RECENT_WALLET_DATA:"WCM_RECENT_WALLET_DATA",EXPLORER_WALLET_URL:"https://explorer.walletconnect.com/?type=wallet",getShadowRootElement(e,t){const r=e.renderRoot.querySelector(t);if(!r)throw new Error(`${t} not found`);return r},getWalletIcon({id:e,image_id:t}){const{walletImages:r}=y$1.state;return null!=r&&r[e]?r[e]:t?te$1.getWalletImageUrl(t):""},getWalletName:(e,t=!1)=>t&&e.length>8?`${e.substring(0,8)}..`:e,isMobileAnimation:()=>window.innerWidth<=c.MOBILE_BREAKPOINT,async preloadImage(e){const t=new Promise(((t,r)=>{const n=new Image;n.onload=t,n.onerror=r,n.crossOrigin="anonymous",n.src=e}));return Promise.race([t,a$2.wait(3e3)])},getErrorMessage:e=>e instanceof Error?e.message:"Unknown Error",debounce(e,t=500){let r;return(...n)=>{r&&clearTimeout(r),r=setTimeout((function(){e(...n)}),t)}},handleMobileLinking(e){const{walletConnectUri:t}=p$1.state,{mobile:r,name:n}=e,o=null==r?void 0:r.native,i=null==r?void 0:r.universal;c.setRecentWallet(e),t&&function(e){let t="";o?t=a$2.formatUniversalUrl(o,e,n):i&&(t=a$2.formatNativeUrl(i,e,n)),a$2.openHref(t,"_self")}(t)},handleAndroidLinking(){const{walletConnectUri:e}=p$1.state;e&&(a$2.setWalletConnectAndroidDeepLink(e),a$2.openHref(e,"_self"))},async handleUriCopy(){const{walletConnectUri:e}=p$1.state;if(e)try{await navigator.clipboard.writeText(e),oe$1.openToast("Link copied","success")}catch{oe$1.openToast("Failed to copy","error")}},getCustomImageUrls(){const{walletImages:e}=y$1.state,t=Object.values(e??{});return Object.values(t)},truncate:(e,t=8)=>e.length<=t?e:`${e.substring(0,4)}...${e.substring(e.length-4)}`,setRecentWallet(e){try{localStorage.setItem(c.WCM_RECENT_WALLET_DATA,JSON.stringify(e))}catch{console.info("Unable to set recent wallet")}},getRecentWallet(){try{const e=localStorage.getItem(c.WCM_RECENT_WALLET_DATA);return e?JSON.parse(e):void 0}catch{console.info("Unable to get recent wallet")}},caseSafeIncludes:(e,t)=>e.toUpperCase().includes(t.toUpperCase()),openWalletExplorerUrl(){a$2.openHref(c.EXPLORER_WALLET_URL,"_blank")},getCachedRouterWalletPlatforms(){const{desktop:e,mobile:t}=a$2.getWalletRouterData(),r=Boolean(null==e?void 0:e.native),n=Boolean(null==e?void 0:e.universal);return{isDesktop:r,isMobile:Boolean(null==t?void 0:t.native)||Boolean(null==t?void 0:t.universal),isWeb:n}},goToConnectingView(e){T$2.setData({Wallet:e});const t=a$2.isMobile(),{isDesktop:r,isWeb:n,isMobile:o}=c.getCachedRouterWalletPlatforms();t?o?T$2.push("MobileConnecting"):n?T$2.push("WebConnecting"):T$2.push("InstallWallet"):r?T$2.push("DesktopConnecting"):n?T$2.push("WebConnecting"):o?T$2.push("MobileQrcodeConnecting"):T$2.push("InstallWallet")}},Mt=i$3`.wcm-router{overflow:hidden;will-change:transform}.wcm-content{display:flex;flex-direction:column}`;var Lt=Object.defineProperty,Rt=Object.getOwnPropertyDescriptor,$e=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?Rt(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Lt(t,r,i),i};let oe=class extends s{constructor(){super(),this.view=T$2.state.view,this.prevView=T$2.state.view,this.unsubscribe=void 0,this.oldHeight="0px",this.resizeObserver=void 0,this.unsubscribe=T$2.subscribe((e=>{this.view!==e.view&&this.onChangeRoute()}))}firstUpdated(){this.resizeObserver=new ResizeObserver((([e])=>{const t=`${e.contentRect.height}px`;"0px"!==this.oldHeight&&animate(this.routerEl,{height:[this.oldHeight,t]},{duration:.2}),this.oldHeight=t})),this.resizeObserver.observe(this.contentEl)}disconnectedCallback(){var e,t;null==(e=this.unsubscribe)||e.call(this),null==(t=this.resizeObserver)||t.disconnect()}get routerEl(){return c.getShadowRootElement(this,".wcm-router")}get contentEl(){return c.getShadowRootElement(this,".wcm-content")}viewTemplate(){switch(this.view){case"ConnectWallet":return x`<wcm-connect-wallet-view></wcm-connect-wallet-view>`;case"DesktopConnecting":return x`<wcm-desktop-connecting-view></wcm-desktop-connecting-view>`;case"MobileConnecting":return x`<wcm-mobile-connecting-view></wcm-mobile-connecting-view>`;case"WebConnecting":return x`<wcm-web-connecting-view></wcm-web-connecting-view>`;case"MobileQrcodeConnecting":return x`<wcm-mobile-qr-connecting-view></wcm-mobile-qr-connecting-view>`;case"WalletExplorer":return x`<wcm-wallet-explorer-view></wcm-wallet-explorer-view>`;case"Qrcode":return x`<wcm-qrcode-view></wcm-qrcode-view>`;case"InstallWallet":return x`<wcm-install-wallet-view></wcm-install-wallet-view>`;default:return x`<div>Not Found</div>`}}async onChangeRoute(){await animate(this.routerEl,{opacity:[1,0],scale:[1,1.02]},{duration:.15,delay:.1}).finished,this.view=T$2.state.view,animate(this.routerEl,{opacity:[0,1],scale:[.99,1]},{duration:.37,delay:.05})}render(){return x`<div class="wcm-router"><div class="wcm-content">${this.viewTemplate()}</div></div>`}};oe.styles=[h.globalCss,Mt],$e([t$1()],oe.prototype,"view",2),$e([t$1()],oe.prototype,"prevView",2),oe=$e([e$2("wcm-modal-router")],oe);const At=i$3`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 Pt=Object.defineProperty,Tt=Object.getOwnPropertyDescriptor,ze=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?Tt(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Pt(t,r,i),i};let ne=class extends s{constructor(){super(),this.open=!1,this.unsubscribe=void 0,this.timeout=void 0,this.unsubscribe=oe$1.subscribe((e=>{e.open?(this.open=!0,this.timeout=setTimeout((()=>oe$1.closeToast()),2200)):(this.open=!1,clearTimeout(this.timeout))}))}disconnectedCallback(){var e;null==(e=this.unsubscribe)||e.call(this),clearTimeout(this.timeout),oe$1.closeToast()}render(){const{message:e,variant:t}=oe$1.state,r={"wcm-success":"success"===t,"wcm-error":"error"===t};return this.open?x`<div class="${o(r)}">${"success"===t?v.CHECKMARK_ICON:null} ${"error"===t?v.CROSS_ICON:null}<wcm-text variant="small-regular">${e}</wcm-text></div>`:null}};ne.styles=[h.globalCss,At],ze([t$1()],ne.prototype,"open",2),ne=ze([e$2("wcm-modal-toast")],ne);const jt=.1,Ve=2.5,A=7;function Ce(e,t,r){return e!==t&&(e-t<0?t-e:e-t)<=r+jt}function _t(e,t){const r=Array.prototype.slice.call(browser.create(e,{errorCorrectionLevel:t}).modules.data,0),n=Math.sqrt(r.length);return r.reduce(((e,t,r)=>(r%n==0?e.push([t]):e[e.length-1].push(t))&&e),[])}const Dt={generate(e,t,r){const n="#141414",o=[],i=_t(e,"Q"),s=t/i.length,a=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];a.forEach((({x:e,y:t})=>{const r=(i.length-A)*s*e,c=(i.length-A)*s*t;for(let i=0;i<a.length;i+=1){const e=s*(A-2*i);o.push(b`<rect fill="${i%2==0?n:"#ffffff"}" height="${e}" rx="${.45*e}" ry="${.45*e}" width="${e}" x="${r+s*i}" y="${c+s*i}">`)}}));const c=Math.floor((r+25)/s),u=i.length/2-c/2,l=i.length/2+c/2-1,d=[];i.forEach(((e,t)=>{e.forEach(((e,r)=>{if(i[t][r]&&!(t<A&&r<A||t>i.length-(A+1)&&r<A||t<A&&r>i.length-(A+1))&&!(t>u&&t<l&&r>u&&r<l)){const e=t*s+s/2,n=r*s+s/2;d.push([e,n])}}))}));const h={};return d.forEach((([e,t])=>{h[e]?h[e].push(t):h[e]=[t]})),Object.entries(h).map((([e,t])=>{const r=t.filter((e=>t.every((t=>!Ce(e,t,s)))));return[Number(e),r]})).forEach((([e,t])=>{t.forEach((t=>{o.push(b`<circle cx="${e}" cy="${t}" fill="${n}" r="${s/Ve}">`)}))})),Object.entries(h).filter((([e,t])=>t.length>1)).map((([e,t])=>{const r=t.filter((e=>t.some((t=>Ce(e,t,s)))));return[Number(e),r]})).map((([e,t])=>{t.sort(((e,t)=>e<t?-1:1));const r=[];for(const n of t){const e=r.find((e=>e.some((e=>Ce(n,e,s)))));e?e.push(n):r.push([n])}return[e,r.map((e=>[e[0],e[e.length-1]]))]})).forEach((([e,t])=>{t.forEach((([t,r])=>{o.push(b`<line x1="${e}" x2="${e}" y1="${t}" y2="${r}" stroke="${n}" stroke-width="${s/(Ve/2)}" stroke-linecap="round">`)}))})),o}},Nt=i$3`@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 Zt=Object.defineProperty,St=Object.getOwnPropertyDescriptor,q=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?St(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Zt(t,r,i),i};let j=class extends s{constructor(){super(...arguments),this.uri="",this.size=0,this.imageId=void 0,this.walletId=void 0,this.imageUrl=void 0}svgTemplate(){const e="light"===ne$1.state.themeMode?this.size:this.size-36;return b`<svg height="${e}" width="${e}">${Dt.generate(this.uri,e,e/4)}</svg>`}render(){const e={"wcm-dark":"dark"===ne$1.state.themeMode};return x`<div style="${`width: ${this.size}px`}" class="${o(e)}">${this.walletId||this.imageUrl?x`<wcm-wallet-image walletId="${l(this.walletId)}" imageId="${l(this.imageId)}" imageUrl="${l(this.imageUrl)}"></wcm-wallet-image>`:v.WALLET_CONNECT_ICON_COLORED} ${this.svgTemplate()}</div>`}};j.styles=[h.globalCss,Nt],q([n$1()],j.prototype,"uri",2),q([n$1({type:Number})],j.prototype,"size",2),q([n$1()],j.prototype,"imageId",2),q([n$1()],j.prototype,"walletId",2),q([n$1()],j.prototype,"imageUrl",2),j=q([e$2("wcm-qrcode")],j);const Bt=i$3`: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 Ut=Object.defineProperty,Ht=Object.getOwnPropertyDescriptor,Fe=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?Ht(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Ut(t,r,i),i};let ce=class extends s{constructor(){super(...arguments),this.onChange=()=>null}render(){return x`<input type="text" @input="${this.onChange}" placeholder="Search wallets"> ${v.SEARCH_ICON}`}};ce.styles=[h.globalCss,Bt],Fe([n$1()],ce.prototype,"onChange",2),ce=Fe([e$2("wcm-search-input")],ce);const zt=i$3`@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 qt=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let ke=class extends s{render(){return x`<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>`}};ke.styles=[h.globalCss,zt],ke=qt([e$2("wcm-spinner")],ke);const Qt=i$3`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 Kt=Object.defineProperty,Yt=Object.getOwnPropertyDescriptor,Oe=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?Yt(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Kt(t,r,i),i};let re=class extends s{constructor(){super(...arguments),this.variant="medium-regular",this.color="primary"}render(){const e={"wcm-big-bold":"big-bold"===this.variant,"wcm-medium-regular":"medium-regular"===this.variant,"wcm-small-regular":"small-regular"===this.variant,"wcm-small-thin":"small-thin"===this.variant,"wcm-xsmall-regular":"xsmall-regular"===this.variant,"wcm-xsmall-bold":"xsmall-bold"===this.variant,"wcm-color-primary":"primary"===this.color,"wcm-color-secondary":"secondary"===this.color,"wcm-color-tertiary":"tertiary"===this.color,"wcm-color-inverse":"inverse"===this.color,"wcm-color-accnt":"accent"===this.color,"wcm-color-error":"error"===this.color};return x`<span><slot class="${o(e)}"></slot></span>`}};re.styles=[h.globalCss,Qt],Oe([n$1()],re.prototype,"variant",2),Oe([n$1()],re.prototype,"color",2),re=Oe([e$2("wcm-text")],re);const Gt=i$3`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 Xt=Object.defineProperty,Jt=Object.getOwnPropertyDescriptor,_=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?Jt(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Xt(t,r,i),i};let L=class extends s{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?x`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">RECENT</wcm-text>`:this.installed?x`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">INSTALLED</wcm-text>`:null}handleClick(){R$1.click({name:"WALLET_BUTTON",walletId:this.walletId}),this.onClick()}render(){var e;return x`<button @click="${this.handleClick.bind(this)}"><div><wcm-wallet-image walletId="${this.walletId}" imageId="${l(this.imageId)}"></wcm-wallet-image><wcm-text variant="xsmall-regular">${null!=(e=this.label)?e:c.getWalletName(this.name,!0)}</wcm-text>${this.sublabelTemplate()}</div></button>`}};L.styles=[h.globalCss,Gt],_([n$1()],L.prototype,"onClick",2),_([n$1()],L.prototype,"name",2),_([n$1()],L.prototype,"walletId",2),_([n$1()],L.prototype,"label",2),_([n$1()],L.prototype,"imageId",2),_([n$1({type:Boolean})],L.prototype,"installed",2),_([n$1({type:Boolean})],L.prototype,"recent",2),L=_([e$2("wcm-wallet-button")],L);const eo=i$3`: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 to=Object.defineProperty,oo=Object.getOwnPropertyDescriptor,se=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?oo(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&to(t,r,i),i};let Q=class extends s{constructor(){super(...arguments),this.walletId="",this.imageId=void 0,this.imageUrl=void 0}render(){var e;const t=null!=(e=this.imageUrl)&&e.length?this.imageUrl:c.getWalletIcon({id:this.walletId,image_id:this.imageId});return x`${t.length?x`<div><img crossorigin="anonymous" src="${t}" alt="${this.id}"></div>`:v.WALLET_PLACEHOLDER}`}};Q.styles=[h.globalCss,eo],se([n$1()],Q.prototype,"walletId",2),se([n$1()],Q.prototype,"imageId",2),se([n$1()],Q.prototype,"imageUrl",2),Q=se([e$2("wcm-wallet-image")],Q);var ro=Object.defineProperty,ao=Object.getOwnPropertyDescriptor,qe=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?ao(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&ro(t,r,i),i};let We=class extends s{constructor(){super(),this.preload=!0,this.preloadData()}async loadImages(e){try{null!=e&&e.length&&await Promise.all(e.map((async e=>c.preloadImage(e))))}catch{console.info("Unsuccessful attempt at preloading some images",e)}}async preloadListings(){if(y$1.state.enableExplorer){await te$1.getRecomendedWallets(),p$1.setIsDataLoaded(!0);const{recomendedWallets:e}=te$1.state,t=e.map((e=>c.getWalletIcon(e)));await this.loadImages(t)}else p$1.setIsDataLoaded(!0)}async preloadCustomImages(){const e=c.getCustomImageUrls();await this.loadImages(e)}async preloadData(){try{this.preload&&(this.preload=!1,await Promise.all([this.preloadListings(),this.preloadCustomImages()]))}catch(e2){console.error(e2),oe$1.openToast("Failed preloading","error")}}};qe([t$1()],We.prototype,"preload",2),We=qe([e$2("wcm-explorer-context")],We);var no=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let Qe=class extends s{constructor(){super(),this.unsubscribeTheme=void 0,h.setTheme(),this.unsubscribeTheme=ne$1.subscribe(h.setTheme)}disconnectedCallback(){var e;null==(e=this.unsubscribeTheme)||e.call(this)}};Qe=no([e$2("wcm-theme-context")],Qe);const co=i$3`@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 ho=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let Ie=class extends s{onGoToQrcode(){T$2.push("Qrcode")}render(){const{recomendedWallets:e}=te$1.state,t=[...e,...e],r=2*a$2.RECOMMENDED_WALLET_AMOUNT;return x`<wcm-modal-header title="Connect your wallet" .onAction="${this.onGoToQrcode}" .actionIcon="${v.QRCODE_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-title">${v.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">WalletConnect</wcm-text></div><div class="wcm-slider"><div class="wcm-track">${[...Array(r)].map(((e,r)=>{const n=t[r%t.length];return n?x`<wcm-wallet-image walletId="${n.id}" imageId="${n.image_id}"></wcm-wallet-image>`:v.WALLET_PLACEHOLDER}))}</div><wcm-button-big @click="${c.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>`}};Ie.styles=[h.globalCss,co],Ie=ho([e$2("wcm-android-wallet-selection")],Ie);const wo=i$3`@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 po=Object.defineProperty,go=Object.getOwnPropertyDescriptor,K=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?go(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&po(t,r,i),i};let D=class extends s{constructor(){super(...arguments),this.walletId=void 0,this.imageId=void 0,this.isError=!1,this.isStale=!1,this.label=""}svgLoaderTemplate(){var e,t;const r=null!=(t=null==(e=ne$1.state.themeVariables)?void 0:e["--wcm-wallet-icon-large-border-radius"])?t:h.getPreset("--wcm-wallet-icon-large-border-radius");let n=0;n=r.includes("%")?.88*parseInt(r,10):parseInt(r,10),n*=1.17;return x`<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 ${317-1.57*n}" stroke-dashoffset="${425-1.8*n}"></use></svg>`}render(){const e={"wcm-error":this.isError,"wcm-stale":this.isStale};return x`<div class="${o(e)}">${this.svgLoaderTemplate()}<wcm-wallet-image walletId="${l(this.walletId)}" imageId="${l(this.imageId)}"></wcm-wallet-image></div><wcm-text variant="medium-regular" color="${this.isError?"error":"primary"}">${this.isError?"Connection declined":this.label}</wcm-text>`}};D.styles=[h.globalCss,wo],K([n$1()],D.prototype,"walletId",2),K([n$1()],D.prototype,"imageId",2),K([n$1({type:Boolean})],D.prototype,"isError",2),K([n$1({type:Boolean})],D.prototype,"isStale",2),K([n$1()],D.prototype,"label",2),D=K([e$2("wcm-connector-waiting")],D);const G={manualWallets(){var e,t;const{mobileWallets:r,desktopWallets:n}=y$1.state,o=null==(e=G.recentWallet())?void 0:e.id,i=a$2.isMobile()?r:n,s=null==i?void 0:i.filter((e=>o!==e.id));return null!=(t=a$2.isMobile()?null==s?void 0:s.map((({id:e,name:t,links:r})=>({id:e,name:t,mobile:r,links:r}))):null==s?void 0:s.map((({id:e,name:t,links:r})=>({id:e,name:t,desktop:r,links:r}))))?t:[]},recentWallet:()=>c.getRecentWallet(),recomendedWallets(e=!1){var t;const r=e||null==(t=G.recentWallet())?void 0:t.id,{recomendedWallets:n}=te$1.state;return n.filter((e=>r!==e.id))}},Z={onConnecting(e){c.goToConnectingView(e)},manualWalletsTemplate(){return G.manualWallets().map((e=>x`<wcm-wallet-button walletId="${e.id}" name="${e.name}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`))},recomendedWalletsTemplate(e=!1){return G.recomendedWallets(e).map((e=>x`<wcm-wallet-button name="${e.name}" walletId="${e.id}" imageId="${e.image_id}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`))},recentWalletTemplate(){const e=G.recentWallet();if(e)return x`<wcm-wallet-button name="${e.name}" walletId="${e.id}" imageId="${l(e.image_id)}" .recent="${!0}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`}},vo=i$3`.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 fo=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let Ee=class extends s{render(){const{explorerExcludedWalletIds:e,enableExplorer:t}=y$1.state,r="ALL"!==e&&t,n=Z.manualWalletsTemplate(),o=Z.recomendedWalletsTemplate();let i=[Z.recentWalletTemplate(),...n,...o];i=i.filter(Boolean);const s=i.length>4||r;let a=[];a=s?i.slice(0,3):i;const u=Boolean(a.length);return x`<wcm-modal-header .border="${!0}" title="Connect your wallet" .onAction="${c.handleUriCopy}" .actionIcon="${v.COPY_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-mobile-title"><div class="wcm-subtitle">${v.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">Mobile</wcm-text></div><div class="wcm-subtitle">${v.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>${u?x`<wcm-modal-footer><div class="wcm-desktop-title">${v.DESKTOP_ICON}<wcm-text variant="small-regular" color="accent">Desktop</wcm-text></div><div class="wcm-grid">${a} ${s?x`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-footer>`:null}`}};Ee.styles=[h.globalCss,vo],Ee=fo([e$2("wcm-desktop-wallet-selection")],Ee);const xo=i$3`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 Co=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let Me=class extends s{render(){const{termsOfServiceUrl:e,privacyPolicyUrl:t}=y$1.state;return e??t?x`<div><wcm-text variant="small-regular" color="secondary">By connecting your wallet to this app, you agree to the app's ${e?x`<a href="${e}" target="_blank" rel="noopener noreferrer">Terms of Service</a>`:null} ${e&&t?"and":null} ${t?x`<a href="${t}" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`:null}</wcm-text></div>`:null}};Me.styles=[h.globalCss,xo],Me=Co([e$2("wcm-legal-notice")],Me);const ko=i$3`div{display:grid;grid-template-columns:repeat(4,80px);margin:0 -10px;justify-content:space-between;row-gap:10px}`;var Io=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let Le=class extends s{onQrcode(){T$2.push("Qrcode")}render(){const{explorerExcludedWalletIds:e,enableExplorer:t}=y$1.state,r="ALL"!==e&&t,n=Z.manualWalletsTemplate(),o=Z.recomendedWalletsTemplate();let i=[Z.recentWalletTemplate(),...n,...o];i=i.filter(Boolean);const s=i.length>8||r;let a=[];a=s?i.slice(0,7):i;const c=Boolean(a.length);return x`<wcm-modal-header title="Connect your wallet" .onAction="${this.onQrcode}" .actionIcon="${v.QRCODE_ICON}"></wcm-modal-header>${c?x`<wcm-modal-content><div>${a} ${s?x`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-content>`:null}`}};Le.styles=[h.globalCss,ko],Le=Io([e$2("wcm-mobile-wallet-selection")],Le);const Eo=i$3`: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 Mo=Object.defineProperty,Lo=Object.getOwnPropertyDescriptor,Re=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?Lo(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Mo(t,r,i),i};let ae=class extends s{constructor(){super(),this.open=!1,this.active=!1,this.unsubscribeModal=void 0,this.abortController=void 0,this.unsubscribeModal=se$1.subscribe((e=>{e.open?this.onOpenModalEvent():this.onCloseModalEvent()}))}disconnectedCallback(){var e;null==(e=this.unsubscribeModal)||e.call(this)}get overlayEl(){return c.getShadowRootElement(this,".wcm-overlay")}get containerEl(){return c.getShadowRootElement(this,".wcm-container")}toggleBodyScroll(e){if(document.querySelector("body"))if(e){const e=document.getElementById("wcm-styles");null==e||e.remove()}else document.head.insertAdjacentHTML("beforeend",'<style id="wcm-styles">html,body{touch-action:none;overflow:hidden;overscroll-behavior:contain;}</style>')}onCloseModal(e){e.target===e.currentTarget&&se$1.close()}onOpenModalEvent(){this.toggleBodyScroll(!1),this.addKeyboardEvents(),this.open=!0,setTimeout((async()=>{const e=c.isMobileAnimation()?{y:["50vh","0vh"]}:{scale:[.98,1]};await Promise.all([animate(this.overlayEl,{opacity:[0,1]},{delay:.1,duration:.2}).finished,animate(this.containerEl,e,{delay:.1,duration:.2}).finished]),this.active=!0}),0)}async onCloseModalEvent(){this.toggleBodyScroll(!0),this.removeKeyboardEvents();const e=c.isMobileAnimation()?{y:["0vh","50vh"]}:{scale:[1,.98]};await Promise.all([animate(this.overlayEl,{opacity:[1,0]},{duration:.2}).finished,animate(this.containerEl,e,{duration:.2}).finished]),this.containerEl.removeAttribute("style"),this.active=!1,this.open=!1}addKeyboardEvents(){this.abortController=new AbortController,window.addEventListener("keydown",(e=>{var t;"Escape"===e.key?se$1.close():"Tab"===e.key&&(null!=(t=e.target)&&t.tagName.includes("wcm-")||this.containerEl.focus())}),this.abortController),this.containerEl.focus()}removeKeyboardEvents(){var e;null==(e=this.abortController)||e.abort(),this.abortController=void 0}render(){const e={"wcm-overlay":!0,"wcm-active":this.active};return x`<wcm-explorer-context></wcm-explorer-context><wcm-theme-context></wcm-theme-context><div id="wcm-modal" class="${o(e)}" @click="${this.onCloseModal}" role="alertdialog" aria-modal="true"><div class="wcm-container" tabindex="0">${this.open?x`<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>`}};ae.styles=[h.globalCss,Eo],Re([t$1()],ae.prototype,"open",2),Re([t$1()],ae.prototype,"active",2),ae=Re([e$2("wcm-modal")],ae);const Ro=i$3`div{display:flex;margin-top:15px}slot{display:inline-block;margin:0 5px}wcm-button{margin:0 5px}`;var Ao=Object.defineProperty,Po=Object.getOwnPropertyDescriptor,le=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?Po(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Ao(t,r,i),i};let B=class extends s{constructor(){super(...arguments),this.isMobile=!1,this.isDesktop=!1,this.isWeb=!1,this.isRetry=!1}onMobile(){a$2.isMobile()?T$2.replace("MobileConnecting"):T$2.replace("MobileQrcodeConnecting")}onDesktop(){T$2.replace("DesktopConnecting")}onWeb(){T$2.replace("WebConnecting")}render(){return x`<div>${this.isRetry?x`<slot></slot>`:null} ${this.isMobile?x`<wcm-button .onClick="${this.onMobile}" .iconLeft="${v.MOBILE_ICON}" variant="outline">Mobile</wcm-button>`:null} ${this.isDesktop?x`<wcm-button .onClick="${this.onDesktop}" .iconLeft="${v.DESKTOP_ICON}" variant="outline">Desktop</wcm-button>`:null} ${this.isWeb?x`<wcm-button .onClick="${this.onWeb}" .iconLeft="${v.GLOBE_ICON}" variant="outline">Web</wcm-button>`:null}</div>`}};B.styles=[h.globalCss,Ro],le([n$1({type:Boolean})],B.prototype,"isMobile",2),le([n$1({type:Boolean})],B.prototype,"isDesktop",2),le([n$1({type:Boolean})],B.prototype,"isWeb",2),le([n$1({type:Boolean})],B.prototype,"isRetry",2),B=le([e$2("wcm-platform-selection")],B);const To=i$3`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 Do=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let Ae=class extends s{onClick(){T$2.push("WalletExplorer")}render(){const{recomendedWallets:e}=te$1.state,t=[...e,...G.manualWallets()].reverse().slice(0,4);return x`<button @click="${this.onClick}"><div class="wcm-icons">${t.map((e=>{const t=c.getWalletIcon(e);if(t)return x`<img crossorigin="anonymous" src="${t}">`;const r=c.getWalletIcon({id:e.id});return r?x`<img crossorigin="anonymous" src="${r}">`:v.WALLET_PLACEHOLDER}))} ${[...Array(4-t.length)].map((()=>v.WALLET_PLACEHOLDER))}</div><wcm-text variant="xsmall-regular">View All</wcm-text></button>`}};Ae.styles=[h.globalCss,To],Ae=Do([e$2("wcm-view-all-wallets-button")],Ae);const No=i$3`.wcm-qr-container{width:100%;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1}`;var Zo=Object.defineProperty,So=Object.getOwnPropertyDescriptor,de=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?So(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Zo(t,r,i),i};let Y=class extends s{constructor(){super(),this.walletId="",this.imageId="",this.uri="",setTimeout((()=>{const{walletConnectUri:e}=p$1.state;this.uri=e}),0)}get overlayEl(){return c.getShadowRootElement(this,".wcm-qr-container")}render(){return x`<div class="wcm-qr-container">${this.uri?x`<wcm-qrcode size="${this.overlayEl.offsetWidth}" uri="${this.uri}" walletId="${l(this.walletId)}" imageId="${l(this.imageId)}"></wcm-qrcode>`:x`<wcm-spinner></wcm-spinner>`}</div>`}};Y.styles=[h.globalCss,No],de([n$1()],Y.prototype,"walletId",2),de([n$1()],Y.prototype,"imageId",2),de([t$1()],Y.prototype,"uri",2),Y=de([e$2("wcm-walletconnect-qr")],Y);var Ho=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let Pe=class extends s{viewTemplate(){return a$2.isAndroid()?x`<wcm-android-wallet-selection></wcm-android-wallet-selection>`:a$2.isMobile()?x`<wcm-mobile-wallet-selection></wcm-mobile-wallet-selection>`:x`<wcm-desktop-wallet-selection></wcm-desktop-wallet-selection>`}render(){return x`${this.viewTemplate()}<wcm-legal-notice></wcm-legal-notice>`}};Pe.styles=[h.globalCss],Pe=Ho([e$2("wcm-connect-wallet-view")],Pe);const zo=i$3`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var Vo=Object.defineProperty,Fo=Object.getOwnPropertyDescriptor,Ke=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?Fo(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Vo(t,r,i),i};let me=class extends s{constructor(){super(),this.isError=!1,this.openDesktopApp()}onFormatAndRedirect(e){const{desktop:t,name:r}=a$2.getWalletRouterData(),n=null==t?void 0:t.native;if(n){const t=a$2.formatNativeUrl(n,e,r);a$2.openHref(t,"_self")}}openDesktopApp(){const{walletConnectUri:e}=p$1.state,t=a$2.getWalletRouterData();c.setRecentWallet(t),e&&this.onFormatAndRedirect(e)}render(){const{name:e,id:t,image_id:r}=a$2.getWalletRouterData(),{isMobile:n,isWeb:o}=c.getCachedRouterWalletPlatforms();return x`<wcm-modal-header title="${e}" .onAction="${c.handleUriCopy}" .actionIcon="${v.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${l(r)}" label="${`Continue in ${e}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Connection can continue loading if ${e} is not installed on your device`}</wcm-text><wcm-platform-selection .isMobile="${n}" .isWeb="${o}" .isRetry="${!0}"><wcm-button .onClick="${this.openDesktopApp.bind(this)}" .iconRight="${v.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};me.styles=[h.globalCss,zo],Ke([t$1()],me.prototype,"isError",2),me=Ke([e$2("wcm-desktop-connecting-view")],me);const qo=i$3`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 Yo=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let Te=class extends s{onInstall(e){e&&a$2.openHref(e,"_blank")}render(){const{name:e,id:t,image_id:r,homepage:n}=a$2.getWalletRouterData();return x`<wcm-modal-header title="${e}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${l(r)}" label="Not Detected" .isStale="${!0}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Download ${e} to continue. If multiple browser extensions are installed, disable non ${e} ones and try again`}</wcm-text><wcm-button .onClick="${()=>this.onInstall(n)}" .iconLeft="${v.ARROW_DOWN_ICON}">Download</wcm-button></wcm-info-footer>`}};Te.styles=[h.globalCss,qo],Te=Yo([e$2("wcm-install-wallet-view")],Te);const Go=i$3`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 Xo=Object.defineProperty,Jo=Object.getOwnPropertyDescriptor,Ye=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?Jo(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Xo(t,r,i),i};let he=class extends s{constructor(){super(),this.isError=!1,this.openMobileApp()}onFormatAndRedirect(e,t=!1){const{mobile:r,name:n}=a$2.getWalletRouterData(),o=null==r?void 0:r.native,i=null==r?void 0:r.universal;if(o&&!t){const t=a$2.formatNativeUrl(o,e,n);a$2.openHref(t,"_self")}else if(i){const t=a$2.formatUniversalUrl(i,e,n);a$2.openHref(t,"_self")}}openMobileApp(e=!1){const{walletConnectUri:t}=p$1.state,r=a$2.getWalletRouterData();c.setRecentWallet(r),t&&this.onFormatAndRedirect(t,e)}onGoToAppStore(e){e&&a$2.openHref(e,"_blank")}render(){const{name:e,id:t,image_id:r,app:n,mobile:o}=a$2.getWalletRouterData(),{isWeb:i}=c.getCachedRouterWalletPlatforms(),s=null==n?void 0:n.ios,a=null==o?void 0:o.universal;return x`<wcm-modal-header title="${e}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${l(r)}" label="Tap 'Open' to continue…" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer class="wcm-note"><wcm-platform-selection .isWeb="${i}" .isRetry="${!0}"><wcm-button .onClick="${()=>this.openMobileApp(!1)}" .iconRight="${v.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection>${a?x`<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="${t}" imageId="${l(r)}"></wcm-wallet-image><wcm-text>${`Get ${e}`}</wcm-text></div><wcm-button .iconRight="${v.ARROW_RIGHT_ICON}" .onClick="${()=>this.onGoToAppStore(s)}" variant="ghost">App Store</wcm-button></wcm-info-footer>`}};he.styles=[h.globalCss,Go],Ye([t$1()],he.prototype,"isError",2),he=Ye([e$2("wcm-mobile-connecting-view")],he);const er=i$3`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var rr=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let je=class extends s{render(){const{name:e,id:t,image_id:r}=a$2.getWalletRouterData(),{isDesktop:n,isWeb:o}=c.getCachedRouterWalletPlatforms();return x`<wcm-modal-header title="${e}" .onAction="${c.handleUriCopy}" .actionIcon="${v.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr walletId="${t}" imageId="${l(r)}"></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 ${e} app`}</wcm-text><wcm-platform-selection .isDesktop="${n}" .isWeb="${o}"></wcm-platform-selection></wcm-info-footer>`}};je.styles=[h.globalCss,er],je=rr([e$2("wcm-mobile-qr-connecting-view")],je);var ir=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let _e=class extends s{render(){return x`<wcm-modal-header title="Scan the code" .onAction="${c.handleUriCopy}" .actionIcon="${v.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>`}};_e.styles=[h.globalCss],_e=ir([e$2("wcm-qrcode-view")],_e);const nr=i$3`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 cr=Object.defineProperty,sr=Object.getOwnPropertyDescriptor,ie=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?sr(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&cr(t,r,i),i};const De=40;let U=class extends s{constructor(){super(...arguments),this.loading=!te$1.state.wallets.listings.length,this.firstFetch=!te$1.state.wallets.listings.length,this.search="",this.endReached=!1,this.intersectionObserver=void 0,this.searchDebounce=c.debounce((e=>{e.length>=1?(this.firstFetch=!0,this.endReached=!1,this.search=e,te$1.resetSearch(),this.fetchWallets()):this.search&&(this.search="",this.endReached=this.isLastPage(),te$1.resetSearch())}))}firstUpdated(){this.createPaginationObserver()}disconnectedCallback(){var e;null==(e=this.intersectionObserver)||e.disconnect()}get placeholderEl(){return c.getShadowRootElement(this,".wcm-placeholder-block")}createPaginationObserver(){this.intersectionObserver=new IntersectionObserver((([e])=>{e.isIntersecting&&(!this.search||!this.firstFetch)&&this.fetchWallets()})),this.intersectionObserver.observe(this.placeholderEl)}isLastPage(){const{wallets:e,search:t}=te$1.state,{listings:r,total:n}=this.search?t:e;return n<=De||r.length>=n}async fetchWallets(){var e;const{wallets:t,search:r}=te$1.state,{listings:n,total:o,page:i}=this.search?r:t;if(!this.endReached&&(this.firstFetch||o>De&&n.length<o))try{this.loading=!0;const t=null==(e=p$1.state.chains)?void 0:e.join(","),{listings:r}=await te$1.getWallets({page:this.firstFetch?1:i+1,entries:De,search:this.search,version:2,chains:t}),n=r.map((e=>c.getWalletIcon(e)));await Promise.all([...n.map((async e=>c.preloadImage(e))),a$2.wait(300)]),this.endReached=this.isLastPage()}catch(s){console.error(s),oe$1.openToast(c.getErrorMessage(s),"error")}finally{this.loading=!1,this.firstFetch=!1}}onConnect(e){a$2.isAndroid()?c.handleMobileLinking(e):c.goToConnectingView(e)}onSearchChange(e){const{value:t}=e.target;this.searchDebounce(t)}render(){const{wallets:e,search:t}=te$1.state,{listings:r}=this.search?t:e,n=this.loading&&!r.length,i=this.search.length>=3;let s=Z.manualWalletsTemplate(),a=Z.recomendedWalletsTemplate(!0);i&&(s=s.filter((({values:e})=>c.caseSafeIncludes(e[0],this.search))),a=a.filter((({values:e})=>c.caseSafeIncludes(e[0],this.search))));const u=!this.loading&&!r.length&&!a.length,l={"wcm-loading":n,"wcm-end-reached":this.endReached||!this.loading,"wcm-empty":u};return x`<wcm-modal-header><wcm-search-input .onChange="${this.onSearchChange.bind(this)}"></wcm-search-input></wcm-modal-header><wcm-modal-content class="${o(l)}"><div class="wcm-grid">${n?null:s} ${n?null:a} ${n?null:r.map((e=>x`${e?x`<wcm-wallet-button imageId="${e.image_id}" name="${e.name}" walletId="${e.id}" .onClick="${()=>this.onConnect(e)}"></wcm-wallet-button>`:null}`))}</div><div class="wcm-placeholder-block">${u?x`<wcm-text variant="big-bold" color="secondary">No results found</wcm-text>`:null} ${!u&&this.loading?x`<wcm-spinner></wcm-spinner>`:null}</div></wcm-modal-content>`}};U.styles=[h.globalCss,nr],ie([t$1()],U.prototype,"loading",2),ie([t$1()],U.prototype,"firstFetch",2),ie([t$1()],U.prototype,"search",2),ie([t$1()],U.prototype,"endReached",2),U=ie([e$2("wcm-wallet-explorer-view")],U);const dr=i$3`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var mr=Object.defineProperty,hr=Object.getOwnPropertyDescriptor,Ge=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?hr(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&mr(t,r,i),i};let we=class extends s{constructor(){super(),this.isError=!1,this.openWebWallet()}onFormatAndRedirect(e){const{desktop:t,name:r}=a$2.getWalletRouterData(),n=null==t?void 0:t.universal;if(n){const t=a$2.formatUniversalUrl(n,e,r);a$2.openHref(t,"_blank")}}openWebWallet(){const{walletConnectUri:e}=p$1.state,t=a$2.getWalletRouterData();c.setRecentWallet(t),e&&this.onFormatAndRedirect(e)}render(){const{name:e,id:t,image_id:r}=a$2.getWalletRouterData(),{isMobile:n,isDesktop:o}=c.getCachedRouterWalletPlatforms(),i=a$2.isMobile();return x`<wcm-modal-header title="${e}" .onAction="${c.handleUriCopy}" .actionIcon="${v.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${l(r)}" label="${`Continue in ${e}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`${e} web app has opened in a new tab. Go there, accept the connection, and come back`}</wcm-text><wcm-platform-selection .isMobile="${n}" .isDesktop="${!i&&o}" .isRetry="${!0}"><wcm-button .onClick="${this.openWebWallet.bind(this)}" .iconRight="${v.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};we.styles=[h.globalCss,dr],Ge([t$1()],we.prototype,"isError",2),we=Ge([e$2("wcm-web-connecting-view")],we);const index=Object.freeze(Object.defineProperty({__proto__:null,get WcmModal(){return ae},get WcmQrCode(){return j}},Symbol.toStringTag,{value:"Module"}));exports.HashgraphSDK=HashgraphSDK,exports.HashinalsWalletConnectSDK=HashinalsWalletConnectSDK,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})}));
|
|
169
|
+
*/const l=e=>null!=e?e:A$1;var browser={},canPromise$1=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then},qrcode={},utils$1={};let toSJISFunction;const CODEWORDS_COUNT=[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];utils$1.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 4*e+17},utils$1.getSymbolTotalCodewords=function(e){return CODEWORDS_COUNT[e]},utils$1.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},utils$1.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');toSJISFunction=e},utils$1.isKanjiModeEnabled=function(){return void 0!==toSJISFunction},utils$1.toSJIS=function(e){return toSJISFunction(e)};var errorCorrectionLevel={};function BitBuffer$1(){this.buffer=[],this.length=0}!function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2},e.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},e.from=function(t,r){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+t)}}(t)}catch(e2){return r}}}(errorCorrectionLevel),BitBuffer$1.prototype={get:function(e){const t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(let r=0;r<t;r++)this.putBit(1==(e>>>t-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var bitBuffer=BitBuffer$1;function BitMatrix$1(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}BitMatrix$1.prototype.set=function(e,t,r,n){const o=e*this.size+t;this.data[o]=r,n&&(this.reservedBit[o]=!0)},BitMatrix$1.prototype.get=function(e,t){return this.data[e*this.size+t]},BitMatrix$1.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r},BitMatrix$1.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var bitMatrix=BitMatrix$1,alignmentPattern={};!function(e){const t=utils$1.getSymbolSize;e.getRowColCoords=function(e){if(1===e)return[];const r=Math.floor(e/7)+2,n=t(e),o=145===n?26:2*Math.ceil((n-13)/(2*r-2)),i=[n-7];for(let t=1;t<r-1;t++)i[t]=i[t-1]-o;return i.push(6),i.reverse()},e.getPositions=function(t){const r=[],n=e.getRowColCoords(t),o=n.length;for(let e=0;e<o;e++)for(let t=0;t<o;t++)0===e&&0===t||0===e&&t===o-1||e===o-1&&0===t||r.push([n[e],n[t]]);return r}}(alignmentPattern);var finderPattern={};const getSymbolSize=utils$1.getSymbolSize,FINDER_PATTERN_SIZE=7;finderPattern.getPositions=function(e){const t=getSymbolSize(e);return[[0,0],[t-FINDER_PATTERN_SIZE,0],[0,t-FINDER_PATTERN_SIZE]]};var maskPattern={};!function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t=3,r=3,n=40,o=10;function i(t,r,n){switch(t){case e.Patterns.PATTERN000:return(r+n)%2==0;case e.Patterns.PATTERN001:return r%2==0;case e.Patterns.PATTERN010:return n%3==0;case e.Patterns.PATTERN011:return(r+n)%3==0;case e.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(n/3))%2==0;case e.Patterns.PATTERN101:return r*n%2+r*n%3==0;case e.Patterns.PATTERN110:return(r*n%2+r*n%3)%2==0;case e.Patterns.PATTERN111:return(r*n%3+(r+n)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}}e.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){const r=e.size;let n=0,o=0,i=0,s=null,a=null;for(let c=0;c<r;c++){o=i=0,s=a=null;for(let u=0;u<r;u++){let r=e.get(c,u);r===s?o++:(o>=5&&(n+=t+(o-5)),s=r,o=1),r=e.get(u,c),r===a?i++:(i>=5&&(n+=t+(i-5)),a=r,i=1)}o>=5&&(n+=t+(o-5)),i>=5&&(n+=t+(i-5))}return n},e.getPenaltyN2=function(e){const t=e.size;let n=0;for(let r=0;r<t-1;r++)for(let o=0;o<t-1;o++){const t=e.get(r,o)+e.get(r,o+1)+e.get(r+1,o)+e.get(r+1,o+1);4!==t&&0!==t||n++}return n*r},e.getPenaltyN3=function(e){const t=e.size;let r=0,o=0,i=0;for(let n=0;n<t;n++){o=i=0;for(let s=0;s<t;s++)o=o<<1&2047|e.get(n,s),s>=10&&(1488===o||93===o)&&r++,i=i<<1&2047|e.get(s,n),s>=10&&(1488===i||93===i)&&r++}return r*n},e.getPenaltyN4=function(e){let t=0;const r=e.data.length;for(let n=0;n<r;n++)t+=e.data[n];return Math.abs(Math.ceil(100*t/r/5)-10)*o},e.applyMask=function(e,t){const r=t.size;for(let n=0;n<r;n++)for(let o=0;o<r;o++)t.isReserved(o,n)||t.xor(o,n,i(e,o,n))},e.getBestMask=function(t,r){const n=Object.keys(e.Patterns).length;let o=0,i=1/0;for(let s=0;s<n;s++){r(s),e.applyMask(s,t);const n=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(s,t),n<i&&(i=n,o=s)}return o}}(maskPattern);var errorCorrectionCode={};const ECLevel$1=errorCorrectionLevel,EC_BLOCKS_TABLE=[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],EC_CODEWORDS_TABLE=[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];errorCorrectionCode.getBlocksCount=function(e,t){switch(t){case ECLevel$1.L:return EC_BLOCKS_TABLE[4*(e-1)+0];case ECLevel$1.M:return EC_BLOCKS_TABLE[4*(e-1)+1];case ECLevel$1.Q:return EC_BLOCKS_TABLE[4*(e-1)+2];case ECLevel$1.H:return EC_BLOCKS_TABLE[4*(e-1)+3];default:return}},errorCorrectionCode.getTotalCodewordsCount=function(e,t){switch(t){case ECLevel$1.L:return EC_CODEWORDS_TABLE[4*(e-1)+0];case ECLevel$1.M:return EC_CODEWORDS_TABLE[4*(e-1)+1];case ECLevel$1.Q:return EC_CODEWORDS_TABLE[4*(e-1)+2];case ECLevel$1.H:return EC_CODEWORDS_TABLE[4*(e-1)+3];default:return}};var polynomial={},galoisField={};const EXP_TABLE=new Uint8Array(512),LOG_TABLE=new Uint8Array(256);!function(){let e=1;for(let t=0;t<255;t++)EXP_TABLE[t]=e,LOG_TABLE[e]=t,e<<=1,256&e&&(e^=285);for(let t=255;t<512;t++)EXP_TABLE[t]=EXP_TABLE[t-255]}(),galoisField.log=function(e){if(e<1)throw new Error("log("+e+")");return LOG_TABLE[e]},galoisField.exp=function(e){return EXP_TABLE[e]},galoisField.mul=function(e,t){return 0===e||0===t?0:EXP_TABLE[LOG_TABLE[e]+LOG_TABLE[t]]},function(e){const t=galoisField;e.mul=function(e,r){const n=new Uint8Array(e.length+r.length-1);for(let o=0;o<e.length;o++)for(let i=0;i<r.length;i++)n[o+i]^=t.mul(e[o],r[i]);return n},e.mod=function(e,r){let n=new Uint8Array(e);for(;n.length-r.length>=0;){const e=n[0];for(let i=0;i<r.length;i++)n[i]^=t.mul(r[i],e);let o=0;for(;o<n.length&&0===n[o];)o++;n=n.slice(o)}return n},e.generateECPolynomial=function(r){let n=new Uint8Array([1]);for(let o=0;o<r;o++)n=e.mul(n,new Uint8Array([1,t.exp(o)]));return n}}(polynomial);const Polynomial=polynomial;function ReedSolomonEncoder$1(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}ReedSolomonEncoder$1.prototype.initialize=function(e){this.degree=e,this.genPoly=Polynomial.generateECPolynomial(this.degree)},ReedSolomonEncoder$1.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 r=Polynomial.mod(t,this.genPoly),n=this.degree-r.length;if(n>0){const e=new Uint8Array(this.degree);return e.set(r,n),e}return r};var reedSolomonEncoder=ReedSolomonEncoder$1,version={},mode={},versionCheck={isValid:function(e){return!isNaN(e)&&e>=1&&e<=40}},regex={};const numeric="[0-9]+",alphanumeric="[A-Z $%*+\\-./:]+";let kanji="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";kanji=kanji.replace(/u/g,"\\u");const byte="(?:(?![A-Z0-9 $%*+\\-./:]|"+kanji+")(?:.|[\r\n]))+";regex.KANJI=new RegExp(kanji,"g"),regex.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),regex.BYTE=new RegExp(byte,"g"),regex.NUMERIC=new RegExp(numeric,"g"),regex.ALPHANUMERIC=new RegExp(alphanumeric,"g");const TEST_KANJI=new RegExp("^"+kanji+"$"),TEST_NUMERIC=new RegExp("^"+numeric+"$"),TEST_ALPHANUMERIC=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");regex.testKanji=function(e){return TEST_KANJI.test(e)},regex.testNumeric=function(e){return TEST_NUMERIC.test(e)},regex.testAlphanumeric=function(e){return TEST_ALPHANUMERIC.test(e)},function(e){const t=versionCheck,r=regex;e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!t.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return r.testNumeric(t)?e.NUMERIC:r.testAlphanumeric(t)?e.ALPHANUMERIC:r.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},e.isValid=function(e){return e&&e.bit&&e.ccBits},e.from=function(t,r){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(e2){return r}}}(mode),function(e){const t=utils$1,r=errorCorrectionCode,n=errorCorrectionLevel,o=mode,i=versionCheck,s=t.getBCHDigit(7973);function a(e,t){return o.getCharCountIndicator(e,t)+4}function c(e,t){let r=0;return e.forEach((function(e){const n=a(e.mode,t);r+=n+e.getBitsLength()})),r}e.from=function(e,t){return i.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,n,s){if(!i.isValid(e))throw new Error("Invalid QR Code version");void 0===s&&(s=o.BYTE);const c=8*(t.getSymbolTotalCodewords(e)-r.getTotalCodewordsCount(e,n));if(s===o.MIXED)return c;const u=c-a(s,e);switch(s){case o.NUMERIC:return Math.floor(u/10*3);case o.ALPHANUMERIC:return Math.floor(u/11*2);case o.KANJI:return Math.floor(u/13);case o.BYTE:default:return Math.floor(u/8)}},e.getBestVersionForData=function(t,r){let i;const s=n.from(r,n.M);if(Array.isArray(t)){if(t.length>1)return function(t,r){for(let n=1;n<=40;n++)if(c(t,n)<=e.getCapacity(n,r,o.MIXED))return n}(t,s);if(0===t.length)return 1;i=t[0]}else i=t;return function(t,r,n){for(let o=1;o<=40;o++)if(r<=e.getCapacity(o,n,t))return o}(i.mode,i.getLength(),s)},e.getEncodedBits=function(e){if(!i.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;t.getBCHDigit(r)-s>=0;)r^=7973<<t.getBCHDigit(r)-s;return e<<12|r}}(version);var formatInfo={};const Utils$3=utils$1,G15=1335,G15_MASK=21522,G15_BCH=Utils$3.getBCHDigit(G15);formatInfo.getEncodedBits=function(e,t){const r=e.bit<<3|t;let n=r<<10;for(;Utils$3.getBCHDigit(n)-G15_BCH>=0;)n^=G15<<Utils$3.getBCHDigit(n)-G15_BCH;return(r<<10|n)^G15_MASK};var segments={};const Mode$4=mode;function NumericData(e){this.mode=Mode$4.NUMERIC,this.data=e.toString()}NumericData.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},NumericData.prototype.getLength=function(){return this.data.length},NumericData.prototype.getBitsLength=function(){return NumericData.getBitsLength(this.data.length)},NumericData.prototype.write=function(e){let t,r,n;for(t=0;t+3<=this.data.length;t+=3)r=this.data.substr(t,3),n=parseInt(r,10),e.put(n,10);const o=this.data.length-t;o>0&&(r=this.data.substr(t),n=parseInt(r,10),e.put(n,3*o+1))};var numericData=NumericData;const Mode$3=mode,ALPHA_NUM_CHARS=["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 AlphanumericData(e){this.mode=Mode$3.ALPHANUMERIC,this.data=e}AlphanumericData.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},AlphanumericData.prototype.getLength=function(){return this.data.length},AlphanumericData.prototype.getBitsLength=function(){return AlphanumericData.getBitsLength(this.data.length)},AlphanumericData.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let r=45*ALPHA_NUM_CHARS.indexOf(this.data[t]);r+=ALPHA_NUM_CHARS.indexOf(this.data[t+1]),e.put(r,11)}this.data.length%2&&e.put(ALPHA_NUM_CHARS.indexOf(this.data[t]),6)};var alphanumericData=AlphanumericData,encodeUtf8$1=function(e){for(var t=[],r=e.length,n=0;n<r;n++){var o=e.charCodeAt(n);if(o>=55296&&o<=56319&&r>n+1){var i=e.charCodeAt(n+1);i>=56320&&i<=57343&&(o=1024*(o-55296)+i-56320+65536,n+=1)}o<128?t.push(o):o<2048?(t.push(o>>6|192),t.push(63&o|128)):o<55296||o>=57344&&o<65536?(t.push(o>>12|224),t.push(o>>6&63|128),t.push(63&o|128)):o>=65536&&o<=1114111?(t.push(o>>18|240),t.push(o>>12&63|128),t.push(o>>6&63|128),t.push(63&o|128)):t.push(239,191,189)}return new Uint8Array(t).buffer};const encodeUtf8=encodeUtf8$1,Mode$2=mode;function ByteData(e){this.mode=Mode$2.BYTE,"string"==typeof e&&(e=encodeUtf8(e)),this.data=new Uint8Array(e)}ByteData.getBitsLength=function(e){return 8*e},ByteData.prototype.getLength=function(){return this.data.length},ByteData.prototype.getBitsLength=function(){return ByteData.getBitsLength(this.data.length)},ByteData.prototype.write=function(e){for(let t=0,r=this.data.length;t<r;t++)e.put(this.data[t],8)};var byteData=ByteData;const Mode$1=mode,Utils$2=utils$1;function KanjiData(e){this.mode=Mode$1.KANJI,this.data=e}KanjiData.getBitsLength=function(e){return 13*e},KanjiData.prototype.getLength=function(){return this.data.length},KanjiData.prototype.getBitsLength=function(){return KanjiData.getBitsLength(this.data.length)},KanjiData.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let r=Utils$2.toSJIS(this.data[t]);if(r>=33088&&r<=40956)r-=33088;else{if(!(r>=57408&&r<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");r-=49472}r=192*(r>>>8&255)+(255&r),e.put(r,13)}};var kanjiData=KanjiData;!function(e){const t=mode,r=numericData,n=alphanumericData,o=byteData,i=kanjiData,s=regex,a=utils$1,c=dijkstraExports;function u(e){return unescape(encodeURIComponent(e)).length}function l(e,t,r){const n=[];let o;for(;null!==(o=e.exec(r));)n.push({data:o[0],index:o.index,mode:t,length:o[0].length});return n}function d(e){const r=l(s.NUMERIC,t.NUMERIC,e),n=l(s.ALPHANUMERIC,t.ALPHANUMERIC,e);let o,i;a.isKanjiModeEnabled()?(o=l(s.BYTE,t.BYTE,e),i=l(s.KANJI,t.KANJI,e)):(o=l(s.BYTE_KANJI,t.BYTE,e),i=[]);return r.concat(n,o,i).sort((function(e,t){return e.index-t.index})).map((function(e){return{data:e.data,mode:e.mode,length:e.length}}))}function h(e,s){switch(s){case t.NUMERIC:return r.getBitsLength(e);case t.ALPHANUMERIC:return n.getBitsLength(e);case t.KANJI:return i.getBitsLength(e);case t.BYTE:return o.getBitsLength(e)}}function f(e,s){let c;const u=t.getBestModeForData(e);if(c=t.from(s,u),c!==t.BYTE&&c.bit<u.bit)throw new Error('"'+e+'" cannot be encoded with mode '+t.toString(c)+".\n Suggested mode is: "+t.toString(u));switch(c!==t.KANJI||a.isKanjiModeEnabled()||(c=t.BYTE),c){case t.NUMERIC:return new r(e);case t.ALPHANUMERIC:return new n(e);case t.KANJI:return new i(e);case t.BYTE:return new o(e)}}e.fromArray=function(e){return e.reduce((function(e,t){return"string"==typeof t?e.push(f(t,null)):t.data&&e.push(f(t.data,t.mode)),e}),[])},e.fromString=function(r,n){const o=function(e){const r=[];for(let n=0;n<e.length;n++){const o=e[n];switch(o.mode){case t.NUMERIC:r.push([o,{data:o.data,mode:t.ALPHANUMERIC,length:o.length},{data:o.data,mode:t.BYTE,length:o.length}]);break;case t.ALPHANUMERIC:r.push([o,{data:o.data,mode:t.BYTE,length:o.length}]);break;case t.KANJI:r.push([o,{data:o.data,mode:t.BYTE,length:u(o.data)}]);break;case t.BYTE:r.push([{data:o.data,mode:t.BYTE,length:u(o.data)}])}}return r}(d(r,a.isKanjiModeEnabled())),i=function(e,r){const n={},o={start:{}};let i=["start"];for(let s=0;s<e.length;s++){const a=e[s],c=[];for(let e=0;e<a.length;e++){const u=a[e],l=""+s+e;c.push(l),n[l]={node:u,lastCount:0},o[l]={};for(let e=0;e<i.length;e++){const s=i[e];n[s]&&n[s].node.mode===u.mode?(o[s][l]=h(n[s].lastCount+u.length,u.mode)-h(n[s].lastCount,u.mode),n[s].lastCount+=u.length):(n[s]&&(n[s].lastCount=u.length),o[s][l]=h(u.length,u.mode)+4+t.getCharCountIndicator(u.mode,r))}}i=c}for(let t=0;t<i.length;t++)o[i[t]].end=0;return{map:o,table:n}}(o,n),s=c.find_path(i.map,"start","end"),l=[];for(let e=1;e<s.length-1;e++)l.push(i.table[s[e]].node);return e.fromArray(function(e){return e.reduce((function(e,t){const r=e.length-1>=0?e[e.length-1]:null;return r&&r.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)}),[])}(l))},e.rawSplit=function(t){return e.fromArray(d(t,a.isKanjiModeEnabled()))}}(segments);const Utils$1=utils$1,ECLevel=errorCorrectionLevel,BitBuffer=bitBuffer,BitMatrix=bitMatrix,AlignmentPattern=alignmentPattern,FinderPattern=finderPattern,MaskPattern=maskPattern,ECCode=errorCorrectionCode,ReedSolomonEncoder=reedSolomonEncoder,Version=version,FormatInfo=formatInfo,Mode=mode,Segments=segments;function setupFinderPattern(e,t){const r=e.size,n=FinderPattern.getPositions(t);for(let o=0;o<n.length;o++){const t=n[o][0],i=n[o][1];for(let n=-1;n<=7;n++)if(!(t+n<=-1||r<=t+n))for(let o=-1;o<=7;o++)i+o<=-1||r<=i+o||(n>=0&&n<=6&&(0===o||6===o)||o>=0&&o<=6&&(0===n||6===n)||n>=2&&n<=4&&o>=2&&o<=4?e.set(t+n,i+o,!0,!0):e.set(t+n,i+o,!1,!0))}}function setupTimingPattern(e){const t=e.size;for(let r=8;r<t-8;r++){const t=r%2==0;e.set(r,6,t,!0),e.set(6,r,t,!0)}}function setupAlignmentPattern(e,t){const r=AlignmentPattern.getPositions(t);for(let n=0;n<r.length;n++){const t=r[n][0],o=r[n][1];for(let r=-2;r<=2;r++)for(let n=-2;n<=2;n++)-2===r||2===r||-2===n||2===n||0===r&&0===n?e.set(t+r,o+n,!0,!0):e.set(t+r,o+n,!1,!0)}}function setupVersionInfo(e,t){const r=e.size,n=Version.getEncodedBits(t);let o,i,s;for(let a=0;a<18;a++)o=Math.floor(a/3),i=a%3+r-8-3,s=1==(n>>a&1),e.set(o,i,s,!0),e.set(i,o,s,!0)}function setupFormatInfo(e,t,r){const n=e.size,o=FormatInfo.getEncodedBits(t,r);let i,s;for(i=0;i<15;i++)s=1==(o>>i&1),i<6?e.set(i,8,s,!0):i<8?e.set(i+1,8,s,!0):e.set(n-15+i,8,s,!0),i<8?e.set(8,n-i-1,s,!0):i<9?e.set(8,15-i-1+1,s,!0):e.set(8,15-i-1,s,!0);e.set(n-8,8,1,!0)}function setupData(e,t){const r=e.size;let n=-1,o=r-1,i=7,s=0;for(let a=r-1;a>0;a-=2)for(6===a&&a--;;){for(let r=0;r<2;r++)if(!e.isReserved(o,a-r)){let n=!1;s<t.length&&(n=1==(t[s]>>>i&1)),e.set(o,a-r,n),i--,-1===i&&(s++,i=7)}if(o+=n,o<0||r<=o){o-=n,n=-n;break}}}function createData(e,t,r){const n=new BitBuffer;r.forEach((function(t){n.put(t.mode.bit,4),n.put(t.getLength(),Mode.getCharCountIndicator(t.mode,e)),t.write(n)}));const o=8*(Utils$1.getSymbolTotalCodewords(e)-ECCode.getTotalCodewordsCount(e,t));for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(0);const i=(o-n.getLengthInBits())/8;for(let s=0;s<i;s++)n.put(s%2?17:236,8);return createCodewords(n,e,t)}function createCodewords(e,t,r){const n=Utils$1.getSymbolTotalCodewords(t),o=n-ECCode.getTotalCodewordsCount(t,r),i=ECCode.getBlocksCount(t,r),s=i-n%i,a=Math.floor(n/i),c=Math.floor(o/i),u=c+1,l=a-c,d=new ReedSolomonEncoder(l);let h=0;const f=new Array(i),p=new Array(i);let m=0;const y=new Uint8Array(e.buffer);for(let _=0;_<i;_++){const e=_<s?c:u;f[_]=y.slice(h,h+e),p[_]=d.encode(f[_]),h+=e,m=Math.max(m,e)}const g=new Uint8Array(n);let b,w,v=0;for(b=0;b<m;b++)for(w=0;w<i;w++)b<f[w].length&&(g[v++]=f[w][b]);for(b=0;b<l;b++)for(w=0;w<i;w++)g[v++]=p[w][b];return g}function createSymbol(e,t,r,n){let o;if(Array.isArray(e))o=Segments.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");{let n=t;if(!n){const t=Segments.rawSplit(e);n=Version.getBestVersionForData(t,r)}o=Segments.fromString(e,n||40)}}const i=Version.getBestVersionForData(o,r);if(!i)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<i)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+i+".\n")}else t=i;const s=createData(t,r,o),a=Utils$1.getSymbolSize(t),c=new BitMatrix(a);return setupFinderPattern(c,t),setupTimingPattern(c),setupAlignmentPattern(c,t),setupFormatInfo(c,r,0),t>=7&&setupVersionInfo(c,t),setupData(c,s),isNaN(n)&&(n=MaskPattern.getBestMask(c,setupFormatInfo.bind(null,c,r))),MaskPattern.applyMask(n,c),setupFormatInfo(c,r,n),{modules:c,version:t,errorCorrectionLevel:r,maskPattern:n,segments:o}}qrcode.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");let r,n,o=ECLevel.M;return void 0!==t&&(o=ECLevel.from(t.errorCorrectionLevel,ECLevel.M),r=Version.from(t.version),n=MaskPattern.from(t.maskPattern),t.toSJISFunc&&Utils$1.setToSJISFunction(t.toSJISFunc)),createSymbol(e,r,o,n)};var canvas={},utils={};!function(e){function t(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map((function(e){return[e,e]})))),6===t.length&&t.push("F","F");const r=parseInt(t.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:255&r,hex:"#"+t.slice(0,6).join("")}}e.getOptions=function(e){e||(e={}),e.color||(e.color={});const r=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,o=e.scale||4;return{width:n,scale:n?4:o,margin:r,color:{dark:t(e.color.dark||"#000000ff"),light:t(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},e.getImageWidth=function(t,r){const n=e.getScale(t,r);return Math.floor((t+2*r.margin)*n)},e.qrToImageData=function(t,r,n){const o=r.modules.size,i=r.modules.data,s=e.getScale(o,n),a=Math.floor((o+2*n.margin)*s),c=n.margin*s,u=[n.color.light,n.color.dark];for(let e=0;e<a;e++)for(let r=0;r<a;r++){let l=4*(e*a+r),d=n.color.light;if(e>=c&&r>=c&&e<a-c&&r<a-c){d=u[i[Math.floor((e-c)/s)*o+Math.floor((r-c)/s)]?1:0]}t[l++]=d.r,t[l++]=d.g,t[l++]=d.b,t[l]=d.a}}}(utils),function(e){const t=utils;e.render=function(e,r,n){let o=n,i=r;void 0!==o||r&&r.getContext||(o=r,r=void 0),r||(i=function(){try{return document.createElement("canvas")}catch(e2){throw new Error("You need to specify a canvas element")}}()),o=t.getOptions(o);const s=t.getImageWidth(e.modules.size,o),a=i.getContext("2d"),c=a.createImageData(s,s);return t.qrToImageData(c.data,e,o),function(e,t,r){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=r,t.width=r,t.style.height=r+"px",t.style.width=r+"px"}(a,i,s),a.putImageData(c,0,0),i},e.renderToDataURL=function(t,r,n){let o=n;void 0!==o||r&&r.getContext||(o=r,r=void 0),o||(o={});const i=e.render(t,r,o),s=o.type||"image/png",a=o.rendererOpts||{};return i.toDataURL(s,a.quality)}}(canvas);var svgTag={};const Utils=utils;function getColorAttrib(e,t){const r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function svgCmd(e,t,r){let n=e+t;return void 0!==r&&(n+=" "+r),n}function qrToPath(e,t,r){let n="",o=0,i=!1,s=0;for(let a=0;a<e.length;a++){const c=Math.floor(a%t),u=Math.floor(a/t);c||i||(i=!0),e[a]?(s++,a>0&&c>0&&e[a-1]||(n+=i?svgCmd("M",c+r,.5+u+r):svgCmd("m",o,0),o=0,i=!1),c+1<t&&e[a+1]||(n+=svgCmd("h",s),s=0)):o++}return n}svgTag.render=function(e,t,r){const n=Utils.getOptions(t),o=e.modules.size,i=e.modules.data,s=o+2*n.margin,a=n.color.light.a?"<path "+getColorAttrib(n.color.light,"fill")+' d="M0 0h'+s+"v"+s+'H0z"/>':"",c="<path "+getColorAttrib(n.color.dark,"stroke")+' d="'+qrToPath(i,o,n.margin)+'"/>',u='viewBox="0 0 '+s+" "+s+'"',l='<svg xmlns="http://www.w3.org/2000/svg" '+(n.width?'width="'+n.width+'" height="'+n.width+'" ':"")+u+' shape-rendering="crispEdges">'+a+c+"</svg>\n";return"function"==typeof r&&r(null,l),l};const canPromise=canPromise$1,QRCode=qrcode,CanvasRenderer=canvas,SvgRenderer=svgTag;function renderCanvas(e,t,r,n,o){const i=[].slice.call(arguments,1),s=i.length,a="function"==typeof i[s-1];if(!a&&!canPromise())throw new Error("Callback required as last argument");if(!a){if(s<1)throw new Error("Too few arguments provided");return 1===s?(r=t,t=n=void 0):2!==s||t.getContext||(n=r,r=t,t=void 0),new Promise((function(o,i){try{const i=QRCode.create(r,n);o(e(i,t,n))}catch(e2){i(e2)}}))}if(s<2)throw new Error("Too few arguments provided");2===s?(o=r,r=t,t=n=void 0):3===s&&(t.getContext&&void 0===o?(o=n,n=void 0):(o=n,n=r,r=t,t=void 0));try{const i=QRCode.create(r,n);o(null,e(i,t,n))}catch(e2){o(e2)}}browser.create=QRCode.create,browser.toCanvas=renderCanvas.bind(null,CanvasRenderer.render),browser.toDataURL=renderCanvas.bind(null,CanvasRenderer.renderToDataURL),browser.toString=renderCanvas.bind(null,(function(e,t,r){return SvgRenderer.render(e,r)}));var et=Object.defineProperty,Be=Object.getOwnPropertySymbols,tt=Object.prototype.hasOwnProperty,ot=Object.prototype.propertyIsEnumerable,Ue=(e,t,r)=>t in e?et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ve=(e,t)=>{for(var r in t||(t={}))tt.call(t,r)&&Ue(e,r,t[r]);if(Be)for(var r of Be(t))ot.call(t,r)&&Ue(e,r,t[r]);return e};function rt(){var e;const 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)"}}[null!=(e=ne$1.state.themeMode)?e:"dark"];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 He(){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 h={getPreset:e=>He()[e],setTheme(){const e=document.querySelector(":root"),{themeVariables:t}=ne$1.state;if(e){const r=ve(ve(ve({},rt()),He()),t);Object.entries(r).forEach((([t,r])=>e.style.setProperty(t,r)))}},globalCss:i$3`*,::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)}`},at=i$3`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 lt=Object.defineProperty,it=Object.getOwnPropertyDescriptor,F=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?it(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&<(t,r,i),i};let T=class extends s{constructor(){super(...arguments),this.disabled=!1,this.iconLeft=void 0,this.iconRight=void 0,this.onClick=()=>null,this.variant="default"}render(){const e={"wcm-icon-left":void 0!==this.iconLeft,"wcm-icon-right":void 0!==this.iconRight,"wcm-ghost":"ghost"===this.variant,"wcm-outline":"outline"===this.variant};let t="inverse";return"ghost"===this.variant&&(t="secondary"),"outline"===this.variant&&(t="accent"),x`<button class="${o(e)}" ?disabled="${this.disabled}" @click="${this.onClick}">${this.iconLeft}<wcm-text variant="small-regular" color="${t}"><slot></slot></wcm-text>${this.iconRight}</button>`}};T.styles=[h.globalCss,at],F([n$1({type:Boolean})],T.prototype,"disabled",2),F([n$1()],T.prototype,"iconLeft",2),F([n$1()],T.prototype,"iconRight",2),F([n$1()],T.prototype,"onClick",2),F([n$1()],T.prototype,"variant",2),T=F([e$2("wcm-button")],T);const nt=i$3`: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 ct=Object.defineProperty,st=Object.getOwnPropertyDescriptor,ue=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?st(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&ct(t,r,i),i};let ee=class extends s{constructor(){super(...arguments),this.disabled=!1,this.variant="primary"}render(){const e={"wcm-secondary":"secondary"===this.variant};return x`<button ?disabled="${this.disabled}" class="${o(e)}"><slot></slot></button>`}};ee.styles=[h.globalCss,nt],ue([n$1({type:Boolean})],ee.prototype,"disabled",2),ue([n$1()],ee.prototype,"variant",2),ee=ue([e$2("wcm-button-big")],ee);const dt=i$3`: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 wt=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let be=class extends s{render(){return x`<div><slot></slot></div>`}};be.styles=[h.globalCss,dt],be=wt([e$2("wcm-info-footer")],be);const v={CROSS_ICON:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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:b`<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>`},pt=i$3`.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 ut=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let fe=class extends s{render(){return x`<div class="wcm-toolbar-placeholder"></div><div class="wcm-toolbar">${v.WALLET_CONNECT_LOGO} <button @click="${se$1.close}">${v.CROSS_ICON}</button></div>`}};fe.styles=[h.globalCss,pt],fe=ut([e$2("wcm-modal-backcard")],fe);const bt=i$3`main{padding:20px;padding-top:0;width:100%}`;var yt=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let xe=class extends s{render(){return x`<main><slot></slot></main>`}};xe.styles=[h.globalCss,bt],xe=yt([e$2("wcm-modal-content")],xe);const $t=i$3`footer{padding:10px;display:flex;flex-direction:column;align-items:inherit;justify-content:inherit;border-top:1px solid var(--wcm-color-bg-2)}`;var Ot=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let ye=class extends s{render(){return x`<footer><slot></slot></footer>`}};ye.styles=[h.globalCss,$t],ye=Ot([e$2("wcm-modal-footer")],ye);const Wt=i$3`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 It=Object.defineProperty,Et=Object.getOwnPropertyDescriptor,te=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?Et(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&It(t,r,i),i};let S=class extends s{constructor(){super(...arguments),this.title="",this.onAction=void 0,this.actionIcon=void 0,this.border=!1}backBtnTemplate(){return x`<button class="wcm-back-btn" @click="${T$2.goBack}">${v.BACK_ICON}</button>`}actionBtnTemplate(){return x`<button class="wcm-action-btn" @click="${this.onAction}">${this.actionIcon}</button>`}render(){const e={"wcm-border":this.border},t=T$2.state.history.length>1,r=this.title?x`<wcm-text variant="big-bold">${this.title}</wcm-text>`:x`<slot></slot>`;return x`<header class="${o(e)}">${t?this.backBtnTemplate():null} ${r} ${this.onAction?this.actionBtnTemplate():null}</header>`}};S.styles=[h.globalCss,Wt],te([n$1()],S.prototype,"title",2),te([n$1()],S.prototype,"onAction",2),te([n$1()],S.prototype,"actionIcon",2),te([n$1({type:Boolean})],S.prototype,"border",2),S=te([e$2("wcm-modal-header")],S);const c={MOBILE_BREAKPOINT:600,WCM_RECENT_WALLET_DATA:"WCM_RECENT_WALLET_DATA",EXPLORER_WALLET_URL:"https://explorer.walletconnect.com/?type=wallet",getShadowRootElement(e,t){const r=e.renderRoot.querySelector(t);if(!r)throw new Error(`${t} not found`);return r},getWalletIcon({id:e,image_id:t}){const{walletImages:r}=y$1.state;return null!=r&&r[e]?r[e]:t?te$1.getWalletImageUrl(t):""},getWalletName:(e,t=!1)=>t&&e.length>8?`${e.substring(0,8)}..`:e,isMobileAnimation:()=>window.innerWidth<=c.MOBILE_BREAKPOINT,async preloadImage(e){const t=new Promise(((t,r)=>{const n=new Image;n.onload=t,n.onerror=r,n.crossOrigin="anonymous",n.src=e}));return Promise.race([t,a$2.wait(3e3)])},getErrorMessage:e=>e instanceof Error?e.message:"Unknown Error",debounce(e,t=500){let r;return(...n)=>{r&&clearTimeout(r),r=setTimeout((function(){e(...n)}),t)}},handleMobileLinking(e){const{walletConnectUri:t}=p$1.state,{mobile:r,name:n}=e,o=null==r?void 0:r.native,i=null==r?void 0:r.universal;c.setRecentWallet(e),t&&function(e){let t="";o?t=a$2.formatUniversalUrl(o,e,n):i&&(t=a$2.formatNativeUrl(i,e,n)),a$2.openHref(t,"_self")}(t)},handleAndroidLinking(){const{walletConnectUri:e}=p$1.state;e&&(a$2.setWalletConnectAndroidDeepLink(e),a$2.openHref(e,"_self"))},async handleUriCopy(){const{walletConnectUri:e}=p$1.state;if(e)try{await navigator.clipboard.writeText(e),oe$1.openToast("Link copied","success")}catch{oe$1.openToast("Failed to copy","error")}},getCustomImageUrls(){const{walletImages:e}=y$1.state,t=Object.values(e??{});return Object.values(t)},truncate:(e,t=8)=>e.length<=t?e:`${e.substring(0,4)}...${e.substring(e.length-4)}`,setRecentWallet(e){try{localStorage.setItem(c.WCM_RECENT_WALLET_DATA,JSON.stringify(e))}catch{console.info("Unable to set recent wallet")}},getRecentWallet(){try{const e=localStorage.getItem(c.WCM_RECENT_WALLET_DATA);return e?JSON.parse(e):void 0}catch{console.info("Unable to get recent wallet")}},caseSafeIncludes:(e,t)=>e.toUpperCase().includes(t.toUpperCase()),openWalletExplorerUrl(){a$2.openHref(c.EXPLORER_WALLET_URL,"_blank")},getCachedRouterWalletPlatforms(){const{desktop:e,mobile:t}=a$2.getWalletRouterData(),r=Boolean(null==e?void 0:e.native),n=Boolean(null==e?void 0:e.universal);return{isDesktop:r,isMobile:Boolean(null==t?void 0:t.native)||Boolean(null==t?void 0:t.universal),isWeb:n}},goToConnectingView(e){T$2.setData({Wallet:e});const t=a$2.isMobile(),{isDesktop:r,isWeb:n,isMobile:o}=c.getCachedRouterWalletPlatforms();t?o?T$2.push("MobileConnecting"):n?T$2.push("WebConnecting"):T$2.push("InstallWallet"):r?T$2.push("DesktopConnecting"):n?T$2.push("WebConnecting"):o?T$2.push("MobileQrcodeConnecting"):T$2.push("InstallWallet")}},Mt=i$3`.wcm-router{overflow:hidden;will-change:transform}.wcm-content{display:flex;flex-direction:column}`;var Lt=Object.defineProperty,Rt=Object.getOwnPropertyDescriptor,$e=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?Rt(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Lt(t,r,i),i};let oe=class extends s{constructor(){super(),this.view=T$2.state.view,this.prevView=T$2.state.view,this.unsubscribe=void 0,this.oldHeight="0px",this.resizeObserver=void 0,this.unsubscribe=T$2.subscribe((e=>{this.view!==e.view&&this.onChangeRoute()}))}firstUpdated(){this.resizeObserver=new ResizeObserver((([e])=>{const t=`${e.contentRect.height}px`;"0px"!==this.oldHeight&&animate(this.routerEl,{height:[this.oldHeight,t]},{duration:.2}),this.oldHeight=t})),this.resizeObserver.observe(this.contentEl)}disconnectedCallback(){var e,t;null==(e=this.unsubscribe)||e.call(this),null==(t=this.resizeObserver)||t.disconnect()}get routerEl(){return c.getShadowRootElement(this,".wcm-router")}get contentEl(){return c.getShadowRootElement(this,".wcm-content")}viewTemplate(){switch(this.view){case"ConnectWallet":return x`<wcm-connect-wallet-view></wcm-connect-wallet-view>`;case"DesktopConnecting":return x`<wcm-desktop-connecting-view></wcm-desktop-connecting-view>`;case"MobileConnecting":return x`<wcm-mobile-connecting-view></wcm-mobile-connecting-view>`;case"WebConnecting":return x`<wcm-web-connecting-view></wcm-web-connecting-view>`;case"MobileQrcodeConnecting":return x`<wcm-mobile-qr-connecting-view></wcm-mobile-qr-connecting-view>`;case"WalletExplorer":return x`<wcm-wallet-explorer-view></wcm-wallet-explorer-view>`;case"Qrcode":return x`<wcm-qrcode-view></wcm-qrcode-view>`;case"InstallWallet":return x`<wcm-install-wallet-view></wcm-install-wallet-view>`;default:return x`<div>Not Found</div>`}}async onChangeRoute(){await animate(this.routerEl,{opacity:[1,0],scale:[1,1.02]},{duration:.15,delay:.1}).finished,this.view=T$2.state.view,animate(this.routerEl,{opacity:[0,1],scale:[.99,1]},{duration:.37,delay:.05})}render(){return x`<div class="wcm-router"><div class="wcm-content">${this.viewTemplate()}</div></div>`}};oe.styles=[h.globalCss,Mt],$e([t$1()],oe.prototype,"view",2),$e([t$1()],oe.prototype,"prevView",2),oe=$e([e$2("wcm-modal-router")],oe);const At=i$3`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 Pt=Object.defineProperty,Tt=Object.getOwnPropertyDescriptor,ze=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?Tt(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Pt(t,r,i),i};let ne=class extends s{constructor(){super(),this.open=!1,this.unsubscribe=void 0,this.timeout=void 0,this.unsubscribe=oe$1.subscribe((e=>{e.open?(this.open=!0,this.timeout=setTimeout((()=>oe$1.closeToast()),2200)):(this.open=!1,clearTimeout(this.timeout))}))}disconnectedCallback(){var e;null==(e=this.unsubscribe)||e.call(this),clearTimeout(this.timeout),oe$1.closeToast()}render(){const{message:e,variant:t}=oe$1.state,r={"wcm-success":"success"===t,"wcm-error":"error"===t};return this.open?x`<div class="${o(r)}">${"success"===t?v.CHECKMARK_ICON:null} ${"error"===t?v.CROSS_ICON:null}<wcm-text variant="small-regular">${e}</wcm-text></div>`:null}};ne.styles=[h.globalCss,At],ze([t$1()],ne.prototype,"open",2),ne=ze([e$2("wcm-modal-toast")],ne);const jt=.1,Ve=2.5,A=7;function Ce(e,t,r){return e!==t&&(e-t<0?t-e:e-t)<=r+jt}function _t(e,t){const r=Array.prototype.slice.call(browser.create(e,{errorCorrectionLevel:t}).modules.data,0),n=Math.sqrt(r.length);return r.reduce(((e,t,r)=>(r%n==0?e.push([t]):e[e.length-1].push(t))&&e),[])}const Dt={generate(e,t,r){const n="#141414",o=[],i=_t(e,"Q"),s=t/i.length,a=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];a.forEach((({x:e,y:t})=>{const r=(i.length-A)*s*e,c=(i.length-A)*s*t;for(let i=0;i<a.length;i+=1){const e=s*(A-2*i);o.push(b`<rect fill="${i%2==0?n:"#ffffff"}" height="${e}" rx="${.45*e}" ry="${.45*e}" width="${e}" x="${r+s*i}" y="${c+s*i}">`)}}));const c=Math.floor((r+25)/s),u=i.length/2-c/2,l=i.length/2+c/2-1,d=[];i.forEach(((e,t)=>{e.forEach(((e,r)=>{if(i[t][r]&&!(t<A&&r<A||t>i.length-(A+1)&&r<A||t<A&&r>i.length-(A+1))&&!(t>u&&t<l&&r>u&&r<l)){const e=t*s+s/2,n=r*s+s/2;d.push([e,n])}}))}));const h={};return d.forEach((([e,t])=>{h[e]?h[e].push(t):h[e]=[t]})),Object.entries(h).map((([e,t])=>{const r=t.filter((e=>t.every((t=>!Ce(e,t,s)))));return[Number(e),r]})).forEach((([e,t])=>{t.forEach((t=>{o.push(b`<circle cx="${e}" cy="${t}" fill="${n}" r="${s/Ve}">`)}))})),Object.entries(h).filter((([e,t])=>t.length>1)).map((([e,t])=>{const r=t.filter((e=>t.some((t=>Ce(e,t,s)))));return[Number(e),r]})).map((([e,t])=>{t.sort(((e,t)=>e<t?-1:1));const r=[];for(const n of t){const e=r.find((e=>e.some((e=>Ce(n,e,s)))));e?e.push(n):r.push([n])}return[e,r.map((e=>[e[0],e[e.length-1]]))]})).forEach((([e,t])=>{t.forEach((([t,r])=>{o.push(b`<line x1="${e}" x2="${e}" y1="${t}" y2="${r}" stroke="${n}" stroke-width="${s/(Ve/2)}" stroke-linecap="round">`)}))})),o}},Nt=i$3`@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 Zt=Object.defineProperty,St=Object.getOwnPropertyDescriptor,q=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?St(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Zt(t,r,i),i};let j=class extends s{constructor(){super(...arguments),this.uri="",this.size=0,this.imageId=void 0,this.walletId=void 0,this.imageUrl=void 0}svgTemplate(){const e="light"===ne$1.state.themeMode?this.size:this.size-36;return b`<svg height="${e}" width="${e}">${Dt.generate(this.uri,e,e/4)}</svg>`}render(){const e={"wcm-dark":"dark"===ne$1.state.themeMode};return x`<div style="${`width: ${this.size}px`}" class="${o(e)}">${this.walletId||this.imageUrl?x`<wcm-wallet-image walletId="${l(this.walletId)}" imageId="${l(this.imageId)}" imageUrl="${l(this.imageUrl)}"></wcm-wallet-image>`:v.WALLET_CONNECT_ICON_COLORED} ${this.svgTemplate()}</div>`}};j.styles=[h.globalCss,Nt],q([n$1()],j.prototype,"uri",2),q([n$1({type:Number})],j.prototype,"size",2),q([n$1()],j.prototype,"imageId",2),q([n$1()],j.prototype,"walletId",2),q([n$1()],j.prototype,"imageUrl",2),j=q([e$2("wcm-qrcode")],j);const Bt=i$3`: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 Ut=Object.defineProperty,Ht=Object.getOwnPropertyDescriptor,Fe=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?Ht(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Ut(t,r,i),i};let ce=class extends s{constructor(){super(...arguments),this.onChange=()=>null}render(){return x`<input type="text" @input="${this.onChange}" placeholder="Search wallets"> ${v.SEARCH_ICON}`}};ce.styles=[h.globalCss,Bt],Fe([n$1()],ce.prototype,"onChange",2),ce=Fe([e$2("wcm-search-input")],ce);const zt=i$3`@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 qt=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let ke=class extends s{render(){return x`<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>`}};ke.styles=[h.globalCss,zt],ke=qt([e$2("wcm-spinner")],ke);const Qt=i$3`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 Kt=Object.defineProperty,Yt=Object.getOwnPropertyDescriptor,Oe=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?Yt(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Kt(t,r,i),i};let re=class extends s{constructor(){super(...arguments),this.variant="medium-regular",this.color="primary"}render(){const e={"wcm-big-bold":"big-bold"===this.variant,"wcm-medium-regular":"medium-regular"===this.variant,"wcm-small-regular":"small-regular"===this.variant,"wcm-small-thin":"small-thin"===this.variant,"wcm-xsmall-regular":"xsmall-regular"===this.variant,"wcm-xsmall-bold":"xsmall-bold"===this.variant,"wcm-color-primary":"primary"===this.color,"wcm-color-secondary":"secondary"===this.color,"wcm-color-tertiary":"tertiary"===this.color,"wcm-color-inverse":"inverse"===this.color,"wcm-color-accnt":"accent"===this.color,"wcm-color-error":"error"===this.color};return x`<span><slot class="${o(e)}"></slot></span>`}};re.styles=[h.globalCss,Qt],Oe([n$1()],re.prototype,"variant",2),Oe([n$1()],re.prototype,"color",2),re=Oe([e$2("wcm-text")],re);const Gt=i$3`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 Xt=Object.defineProperty,Jt=Object.getOwnPropertyDescriptor,_=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?Jt(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Xt(t,r,i),i};let L=class extends s{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?x`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">RECENT</wcm-text>`:this.installed?x`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">INSTALLED</wcm-text>`:null}handleClick(){R$1.click({name:"WALLET_BUTTON",walletId:this.walletId}),this.onClick()}render(){var e;return x`<button @click="${this.handleClick.bind(this)}"><div><wcm-wallet-image walletId="${this.walletId}" imageId="${l(this.imageId)}"></wcm-wallet-image><wcm-text variant="xsmall-regular">${null!=(e=this.label)?e:c.getWalletName(this.name,!0)}</wcm-text>${this.sublabelTemplate()}</div></button>`}};L.styles=[h.globalCss,Gt],_([n$1()],L.prototype,"onClick",2),_([n$1()],L.prototype,"name",2),_([n$1()],L.prototype,"walletId",2),_([n$1()],L.prototype,"label",2),_([n$1()],L.prototype,"imageId",2),_([n$1({type:Boolean})],L.prototype,"installed",2),_([n$1({type:Boolean})],L.prototype,"recent",2),L=_([e$2("wcm-wallet-button")],L);const eo=i$3`: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 to=Object.defineProperty,oo=Object.getOwnPropertyDescriptor,se=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?oo(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&to(t,r,i),i};let Q=class extends s{constructor(){super(...arguments),this.walletId="",this.imageId=void 0,this.imageUrl=void 0}render(){var e;const t=null!=(e=this.imageUrl)&&e.length?this.imageUrl:c.getWalletIcon({id:this.walletId,image_id:this.imageId});return x`${t.length?x`<div><img crossorigin="anonymous" src="${t}" alt="${this.id}"></div>`:v.WALLET_PLACEHOLDER}`}};Q.styles=[h.globalCss,eo],se([n$1()],Q.prototype,"walletId",2),se([n$1()],Q.prototype,"imageId",2),se([n$1()],Q.prototype,"imageUrl",2),Q=se([e$2("wcm-wallet-image")],Q);var ro=Object.defineProperty,ao=Object.getOwnPropertyDescriptor,qe=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?ao(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&ro(t,r,i),i};let We=class extends s{constructor(){super(),this.preload=!0,this.preloadData()}async loadImages(e){try{null!=e&&e.length&&await Promise.all(e.map((async e=>c.preloadImage(e))))}catch{console.info("Unsuccessful attempt at preloading some images",e)}}async preloadListings(){if(y$1.state.enableExplorer){await te$1.getRecomendedWallets(),p$1.setIsDataLoaded(!0);const{recomendedWallets:e}=te$1.state,t=e.map((e=>c.getWalletIcon(e)));await this.loadImages(t)}else p$1.setIsDataLoaded(!0)}async preloadCustomImages(){const e=c.getCustomImageUrls();await this.loadImages(e)}async preloadData(){try{this.preload&&(this.preload=!1,await Promise.all([this.preloadListings(),this.preloadCustomImages()]))}catch(e2){console.error(e2),oe$1.openToast("Failed preloading","error")}}};qe([t$1()],We.prototype,"preload",2),We=qe([e$2("wcm-explorer-context")],We);var no=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let Qe=class extends s{constructor(){super(),this.unsubscribeTheme=void 0,h.setTheme(),this.unsubscribeTheme=ne$1.subscribe(h.setTheme)}disconnectedCallback(){var e;null==(e=this.unsubscribeTheme)||e.call(this)}};Qe=no([e$2("wcm-theme-context")],Qe);const co=i$3`@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 ho=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let Ie=class extends s{onGoToQrcode(){T$2.push("Qrcode")}render(){const{recomendedWallets:e}=te$1.state,t=[...e,...e],r=2*a$2.RECOMMENDED_WALLET_AMOUNT;return x`<wcm-modal-header title="Connect your wallet" .onAction="${this.onGoToQrcode}" .actionIcon="${v.QRCODE_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-title">${v.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">WalletConnect</wcm-text></div><div class="wcm-slider"><div class="wcm-track">${[...Array(r)].map(((e,r)=>{const n=t[r%t.length];return n?x`<wcm-wallet-image walletId="${n.id}" imageId="${n.image_id}"></wcm-wallet-image>`:v.WALLET_PLACEHOLDER}))}</div><wcm-button-big @click="${c.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>`}};Ie.styles=[h.globalCss,co],Ie=ho([e$2("wcm-android-wallet-selection")],Ie);const wo=i$3`@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 po=Object.defineProperty,go=Object.getOwnPropertyDescriptor,K=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?go(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&po(t,r,i),i};let D=class extends s{constructor(){super(...arguments),this.walletId=void 0,this.imageId=void 0,this.isError=!1,this.isStale=!1,this.label=""}svgLoaderTemplate(){var e,t;const r=null!=(t=null==(e=ne$1.state.themeVariables)?void 0:e["--wcm-wallet-icon-large-border-radius"])?t:h.getPreset("--wcm-wallet-icon-large-border-radius");let n=0;n=r.includes("%")?.88*parseInt(r,10):parseInt(r,10),n*=1.17;return x`<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 ${317-1.57*n}" stroke-dashoffset="${425-1.8*n}"></use></svg>`}render(){const e={"wcm-error":this.isError,"wcm-stale":this.isStale};return x`<div class="${o(e)}">${this.svgLoaderTemplate()}<wcm-wallet-image walletId="${l(this.walletId)}" imageId="${l(this.imageId)}"></wcm-wallet-image></div><wcm-text variant="medium-regular" color="${this.isError?"error":"primary"}">${this.isError?"Connection declined":this.label}</wcm-text>`}};D.styles=[h.globalCss,wo],K([n$1()],D.prototype,"walletId",2),K([n$1()],D.prototype,"imageId",2),K([n$1({type:Boolean})],D.prototype,"isError",2),K([n$1({type:Boolean})],D.prototype,"isStale",2),K([n$1()],D.prototype,"label",2),D=K([e$2("wcm-connector-waiting")],D);const G={manualWallets(){var e,t;const{mobileWallets:r,desktopWallets:n}=y$1.state,o=null==(e=G.recentWallet())?void 0:e.id,i=a$2.isMobile()?r:n,s=null==i?void 0:i.filter((e=>o!==e.id));return null!=(t=a$2.isMobile()?null==s?void 0:s.map((({id:e,name:t,links:r})=>({id:e,name:t,mobile:r,links:r}))):null==s?void 0:s.map((({id:e,name:t,links:r})=>({id:e,name:t,desktop:r,links:r}))))?t:[]},recentWallet:()=>c.getRecentWallet(),recomendedWallets(e=!1){var t;const r=e||null==(t=G.recentWallet())?void 0:t.id,{recomendedWallets:n}=te$1.state;return n.filter((e=>r!==e.id))}},Z={onConnecting(e){c.goToConnectingView(e)},manualWalletsTemplate(){return G.manualWallets().map((e=>x`<wcm-wallet-button walletId="${e.id}" name="${e.name}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`))},recomendedWalletsTemplate(e=!1){return G.recomendedWallets(e).map((e=>x`<wcm-wallet-button name="${e.name}" walletId="${e.id}" imageId="${e.image_id}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`))},recentWalletTemplate(){const e=G.recentWallet();if(e)return x`<wcm-wallet-button name="${e.name}" walletId="${e.id}" imageId="${l(e.image_id)}" .recent="${!0}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`}},vo=i$3`.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 fo=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let Ee=class extends s{render(){const{explorerExcludedWalletIds:e,enableExplorer:t}=y$1.state,r="ALL"!==e&&t,n=Z.manualWalletsTemplate(),o=Z.recomendedWalletsTemplate();let i=[Z.recentWalletTemplate(),...n,...o];i=i.filter(Boolean);const s=i.length>4||r;let a=[];a=s?i.slice(0,3):i;const u=Boolean(a.length);return x`<wcm-modal-header .border="${!0}" title="Connect your wallet" .onAction="${c.handleUriCopy}" .actionIcon="${v.COPY_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-mobile-title"><div class="wcm-subtitle">${v.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">Mobile</wcm-text></div><div class="wcm-subtitle">${v.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>${u?x`<wcm-modal-footer><div class="wcm-desktop-title">${v.DESKTOP_ICON}<wcm-text variant="small-regular" color="accent">Desktop</wcm-text></div><div class="wcm-grid">${a} ${s?x`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-footer>`:null}`}};Ee.styles=[h.globalCss,vo],Ee=fo([e$2("wcm-desktop-wallet-selection")],Ee);const xo=i$3`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 Co=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let Me=class extends s{render(){const{termsOfServiceUrl:e,privacyPolicyUrl:t}=y$1.state;return e??t?x`<div><wcm-text variant="small-regular" color="secondary">By connecting your wallet to this app, you agree to the app's ${e?x`<a href="${e}" target="_blank" rel="noopener noreferrer">Terms of Service</a>`:null} ${e&&t?"and":null} ${t?x`<a href="${t}" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`:null}</wcm-text></div>`:null}};Me.styles=[h.globalCss,xo],Me=Co([e$2("wcm-legal-notice")],Me);const ko=i$3`div{display:grid;grid-template-columns:repeat(4,80px);margin:0 -10px;justify-content:space-between;row-gap:10px}`;var Io=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let Le=class extends s{onQrcode(){T$2.push("Qrcode")}render(){const{explorerExcludedWalletIds:e,enableExplorer:t}=y$1.state,r="ALL"!==e&&t,n=Z.manualWalletsTemplate(),o=Z.recomendedWalletsTemplate();let i=[Z.recentWalletTemplate(),...n,...o];i=i.filter(Boolean);const s=i.length>8||r;let a=[];a=s?i.slice(0,7):i;const c=Boolean(a.length);return x`<wcm-modal-header title="Connect your wallet" .onAction="${this.onQrcode}" .actionIcon="${v.QRCODE_ICON}"></wcm-modal-header>${c?x`<wcm-modal-content><div>${a} ${s?x`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-content>`:null}`}};Le.styles=[h.globalCss,ko],Le=Io([e$2("wcm-mobile-wallet-selection")],Le);const Eo=i$3`: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 Mo=Object.defineProperty,Lo=Object.getOwnPropertyDescriptor,Re=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?Lo(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Mo(t,r,i),i};let ae=class extends s{constructor(){super(),this.open=!1,this.active=!1,this.unsubscribeModal=void 0,this.abortController=void 0,this.unsubscribeModal=se$1.subscribe((e=>{e.open?this.onOpenModalEvent():this.onCloseModalEvent()}))}disconnectedCallback(){var e;null==(e=this.unsubscribeModal)||e.call(this)}get overlayEl(){return c.getShadowRootElement(this,".wcm-overlay")}get containerEl(){return c.getShadowRootElement(this,".wcm-container")}toggleBodyScroll(e){if(document.querySelector("body"))if(e){const e=document.getElementById("wcm-styles");null==e||e.remove()}else document.head.insertAdjacentHTML("beforeend",'<style id="wcm-styles">html,body{touch-action:none;overflow:hidden;overscroll-behavior:contain;}</style>')}onCloseModal(e){e.target===e.currentTarget&&se$1.close()}onOpenModalEvent(){this.toggleBodyScroll(!1),this.addKeyboardEvents(),this.open=!0,setTimeout((async()=>{const e=c.isMobileAnimation()?{y:["50vh","0vh"]}:{scale:[.98,1]};await Promise.all([animate(this.overlayEl,{opacity:[0,1]},{delay:.1,duration:.2}).finished,animate(this.containerEl,e,{delay:.1,duration:.2}).finished]),this.active=!0}),0)}async onCloseModalEvent(){this.toggleBodyScroll(!0),this.removeKeyboardEvents();const e=c.isMobileAnimation()?{y:["0vh","50vh"]}:{scale:[1,.98]};await Promise.all([animate(this.overlayEl,{opacity:[1,0]},{duration:.2}).finished,animate(this.containerEl,e,{duration:.2}).finished]),this.containerEl.removeAttribute("style"),this.active=!1,this.open=!1}addKeyboardEvents(){this.abortController=new AbortController,window.addEventListener("keydown",(e=>{var t;"Escape"===e.key?se$1.close():"Tab"===e.key&&(null!=(t=e.target)&&t.tagName.includes("wcm-")||this.containerEl.focus())}),this.abortController),this.containerEl.focus()}removeKeyboardEvents(){var e;null==(e=this.abortController)||e.abort(),this.abortController=void 0}render(){const e={"wcm-overlay":!0,"wcm-active":this.active};return x`<wcm-explorer-context></wcm-explorer-context><wcm-theme-context></wcm-theme-context><div id="wcm-modal" class="${o(e)}" @click="${this.onCloseModal}" role="alertdialog" aria-modal="true"><div class="wcm-container" tabindex="0">${this.open?x`<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>`}};ae.styles=[h.globalCss,Eo],Re([t$1()],ae.prototype,"open",2),Re([t$1()],ae.prototype,"active",2),ae=Re([e$2("wcm-modal")],ae);const Ro=i$3`div{display:flex;margin-top:15px}slot{display:inline-block;margin:0 5px}wcm-button{margin:0 5px}`;var Ao=Object.defineProperty,Po=Object.getOwnPropertyDescriptor,le=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?Po(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Ao(t,r,i),i};let B=class extends s{constructor(){super(...arguments),this.isMobile=!1,this.isDesktop=!1,this.isWeb=!1,this.isRetry=!1}onMobile(){a$2.isMobile()?T$2.replace("MobileConnecting"):T$2.replace("MobileQrcodeConnecting")}onDesktop(){T$2.replace("DesktopConnecting")}onWeb(){T$2.replace("WebConnecting")}render(){return x`<div>${this.isRetry?x`<slot></slot>`:null} ${this.isMobile?x`<wcm-button .onClick="${this.onMobile}" .iconLeft="${v.MOBILE_ICON}" variant="outline">Mobile</wcm-button>`:null} ${this.isDesktop?x`<wcm-button .onClick="${this.onDesktop}" .iconLeft="${v.DESKTOP_ICON}" variant="outline">Desktop</wcm-button>`:null} ${this.isWeb?x`<wcm-button .onClick="${this.onWeb}" .iconLeft="${v.GLOBE_ICON}" variant="outline">Web</wcm-button>`:null}</div>`}};B.styles=[h.globalCss,Ro],le([n$1({type:Boolean})],B.prototype,"isMobile",2),le([n$1({type:Boolean})],B.prototype,"isDesktop",2),le([n$1({type:Boolean})],B.prototype,"isWeb",2),le([n$1({type:Boolean})],B.prototype,"isRetry",2),B=le([e$2("wcm-platform-selection")],B);const To=i$3`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 Do=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let Ae=class extends s{onClick(){T$2.push("WalletExplorer")}render(){const{recomendedWallets:e}=te$1.state,t=[...e,...G.manualWallets()].reverse().slice(0,4);return x`<button @click="${this.onClick}"><div class="wcm-icons">${t.map((e=>{const t=c.getWalletIcon(e);if(t)return x`<img crossorigin="anonymous" src="${t}">`;const r=c.getWalletIcon({id:e.id});return r?x`<img crossorigin="anonymous" src="${r}">`:v.WALLET_PLACEHOLDER}))} ${[...Array(4-t.length)].map((()=>v.WALLET_PLACEHOLDER))}</div><wcm-text variant="xsmall-regular">View All</wcm-text></button>`}};Ae.styles=[h.globalCss,To],Ae=Do([e$2("wcm-view-all-wallets-button")],Ae);const No=i$3`.wcm-qr-container{width:100%;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1}`;var Zo=Object.defineProperty,So=Object.getOwnPropertyDescriptor,de=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?So(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Zo(t,r,i),i};let Y=class extends s{constructor(){super(),this.walletId="",this.imageId="",this.uri="",setTimeout((()=>{const{walletConnectUri:e}=p$1.state;this.uri=e}),0)}get overlayEl(){return c.getShadowRootElement(this,".wcm-qr-container")}render(){return x`<div class="wcm-qr-container">${this.uri?x`<wcm-qrcode size="${this.overlayEl.offsetWidth}" uri="${this.uri}" walletId="${l(this.walletId)}" imageId="${l(this.imageId)}"></wcm-qrcode>`:x`<wcm-spinner></wcm-spinner>`}</div>`}};Y.styles=[h.globalCss,No],de([n$1()],Y.prototype,"walletId",2),de([n$1()],Y.prototype,"imageId",2),de([t$1()],Y.prototype,"uri",2),Y=de([e$2("wcm-walletconnect-qr")],Y);var Ho=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let Pe=class extends s{viewTemplate(){return a$2.isAndroid()?x`<wcm-android-wallet-selection></wcm-android-wallet-selection>`:a$2.isMobile()?x`<wcm-mobile-wallet-selection></wcm-mobile-wallet-selection>`:x`<wcm-desktop-wallet-selection></wcm-desktop-wallet-selection>`}render(){return x`${this.viewTemplate()}<wcm-legal-notice></wcm-legal-notice>`}};Pe.styles=[h.globalCss],Pe=Ho([e$2("wcm-connect-wallet-view")],Pe);const zo=i$3`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var Vo=Object.defineProperty,Fo=Object.getOwnPropertyDescriptor,Ke=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?Fo(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Vo(t,r,i),i};let me=class extends s{constructor(){super(),this.isError=!1,this.openDesktopApp()}onFormatAndRedirect(e){const{desktop:t,name:r}=a$2.getWalletRouterData(),n=null==t?void 0:t.native;if(n){const t=a$2.formatNativeUrl(n,e,r);a$2.openHref(t,"_self")}}openDesktopApp(){const{walletConnectUri:e}=p$1.state,t=a$2.getWalletRouterData();c.setRecentWallet(t),e&&this.onFormatAndRedirect(e)}render(){const{name:e,id:t,image_id:r}=a$2.getWalletRouterData(),{isMobile:n,isWeb:o}=c.getCachedRouterWalletPlatforms();return x`<wcm-modal-header title="${e}" .onAction="${c.handleUriCopy}" .actionIcon="${v.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${l(r)}" label="${`Continue in ${e}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Connection can continue loading if ${e} is not installed on your device`}</wcm-text><wcm-platform-selection .isMobile="${n}" .isWeb="${o}" .isRetry="${!0}"><wcm-button .onClick="${this.openDesktopApp.bind(this)}" .iconRight="${v.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};me.styles=[h.globalCss,zo],Ke([t$1()],me.prototype,"isError",2),me=Ke([e$2("wcm-desktop-connecting-view")],me);const qo=i$3`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 Yo=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let Te=class extends s{onInstall(e){e&&a$2.openHref(e,"_blank")}render(){const{name:e,id:t,image_id:r,homepage:n}=a$2.getWalletRouterData();return x`<wcm-modal-header title="${e}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${l(r)}" label="Not Detected" .isStale="${!0}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Download ${e} to continue. If multiple browser extensions are installed, disable non ${e} ones and try again`}</wcm-text><wcm-button .onClick="${()=>this.onInstall(n)}" .iconLeft="${v.ARROW_DOWN_ICON}">Download</wcm-button></wcm-info-footer>`}};Te.styles=[h.globalCss,qo],Te=Yo([e$2("wcm-install-wallet-view")],Te);const Go=i$3`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 Xo=Object.defineProperty,Jo=Object.getOwnPropertyDescriptor,Ye=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?Jo(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&Xo(t,r,i),i};let he=class extends s{constructor(){super(),this.isError=!1,this.openMobileApp()}onFormatAndRedirect(e,t=!1){const{mobile:r,name:n}=a$2.getWalletRouterData(),o=null==r?void 0:r.native,i=null==r?void 0:r.universal;if(o&&!t){const t=a$2.formatNativeUrl(o,e,n);a$2.openHref(t,"_self")}else if(i){const t=a$2.formatUniversalUrl(i,e,n);a$2.openHref(t,"_self")}}openMobileApp(e=!1){const{walletConnectUri:t}=p$1.state,r=a$2.getWalletRouterData();c.setRecentWallet(r),t&&this.onFormatAndRedirect(t,e)}onGoToAppStore(e){e&&a$2.openHref(e,"_blank")}render(){const{name:e,id:t,image_id:r,app:n,mobile:o}=a$2.getWalletRouterData(),{isWeb:i}=c.getCachedRouterWalletPlatforms(),s=null==n?void 0:n.ios,a=null==o?void 0:o.universal;return x`<wcm-modal-header title="${e}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${l(r)}" label="Tap 'Open' to continue…" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer class="wcm-note"><wcm-platform-selection .isWeb="${i}" .isRetry="${!0}"><wcm-button .onClick="${()=>this.openMobileApp(!1)}" .iconRight="${v.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection>${a?x`<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="${t}" imageId="${l(r)}"></wcm-wallet-image><wcm-text>${`Get ${e}`}</wcm-text></div><wcm-button .iconRight="${v.ARROW_RIGHT_ICON}" .onClick="${()=>this.onGoToAppStore(s)}" variant="ghost">App Store</wcm-button></wcm-info-footer>`}};he.styles=[h.globalCss,Go],Ye([t$1()],he.prototype,"isError",2),he=Ye([e$2("wcm-mobile-connecting-view")],he);const er=i$3`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var rr=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let je=class extends s{render(){const{name:e,id:t,image_id:r}=a$2.getWalletRouterData(),{isDesktop:n,isWeb:o}=c.getCachedRouterWalletPlatforms();return x`<wcm-modal-header title="${e}" .onAction="${c.handleUriCopy}" .actionIcon="${v.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr walletId="${t}" imageId="${l(r)}"></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 ${e} app`}</wcm-text><wcm-platform-selection .isDesktop="${n}" .isWeb="${o}"></wcm-platform-selection></wcm-info-footer>`}};je.styles=[h.globalCss,er],je=rr([e$2("wcm-mobile-qr-connecting-view")],je);var ir=(e,t,r,n)=>{for(var o,i=t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=o(i)||i);return i};let _e=class extends s{render(){return x`<wcm-modal-header title="Scan the code" .onAction="${c.handleUriCopy}" .actionIcon="${v.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>`}};_e.styles=[h.globalCss],_e=ir([e$2("wcm-qrcode-view")],_e);const nr=i$3`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 cr=Object.defineProperty,sr=Object.getOwnPropertyDescriptor,ie=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?sr(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&cr(t,r,i),i};const De=40;let U=class extends s{constructor(){super(...arguments),this.loading=!te$1.state.wallets.listings.length,this.firstFetch=!te$1.state.wallets.listings.length,this.search="",this.endReached=!1,this.intersectionObserver=void 0,this.searchDebounce=c.debounce((e=>{e.length>=1?(this.firstFetch=!0,this.endReached=!1,this.search=e,te$1.resetSearch(),this.fetchWallets()):this.search&&(this.search="",this.endReached=this.isLastPage(),te$1.resetSearch())}))}firstUpdated(){this.createPaginationObserver()}disconnectedCallback(){var e;null==(e=this.intersectionObserver)||e.disconnect()}get placeholderEl(){return c.getShadowRootElement(this,".wcm-placeholder-block")}createPaginationObserver(){this.intersectionObserver=new IntersectionObserver((([e])=>{e.isIntersecting&&(!this.search||!this.firstFetch)&&this.fetchWallets()})),this.intersectionObserver.observe(this.placeholderEl)}isLastPage(){const{wallets:e,search:t}=te$1.state,{listings:r,total:n}=this.search?t:e;return n<=De||r.length>=n}async fetchWallets(){var e;const{wallets:t,search:r}=te$1.state,{listings:n,total:o,page:i}=this.search?r:t;if(!this.endReached&&(this.firstFetch||o>De&&n.length<o))try{this.loading=!0;const t=null==(e=p$1.state.chains)?void 0:e.join(","),{listings:r}=await te$1.getWallets({page:this.firstFetch?1:i+1,entries:De,search:this.search,version:2,chains:t}),n=r.map((e=>c.getWalletIcon(e)));await Promise.all([...n.map((async e=>c.preloadImage(e))),a$2.wait(300)]),this.endReached=this.isLastPage()}catch(s){console.error(s),oe$1.openToast(c.getErrorMessage(s),"error")}finally{this.loading=!1,this.firstFetch=!1}}onConnect(e){a$2.isAndroid()?c.handleMobileLinking(e):c.goToConnectingView(e)}onSearchChange(e){const{value:t}=e.target;this.searchDebounce(t)}render(){const{wallets:e,search:t}=te$1.state,{listings:r}=this.search?t:e,n=this.loading&&!r.length,i=this.search.length>=3;let s=Z.manualWalletsTemplate(),a=Z.recomendedWalletsTemplate(!0);i&&(s=s.filter((({values:e})=>c.caseSafeIncludes(e[0],this.search))),a=a.filter((({values:e})=>c.caseSafeIncludes(e[0],this.search))));const u=!this.loading&&!r.length&&!a.length,l={"wcm-loading":n,"wcm-end-reached":this.endReached||!this.loading,"wcm-empty":u};return x`<wcm-modal-header><wcm-search-input .onChange="${this.onSearchChange.bind(this)}"></wcm-search-input></wcm-modal-header><wcm-modal-content class="${o(l)}"><div class="wcm-grid">${n?null:s} ${n?null:a} ${n?null:r.map((e=>x`${e?x`<wcm-wallet-button imageId="${e.image_id}" name="${e.name}" walletId="${e.id}" .onClick="${()=>this.onConnect(e)}"></wcm-wallet-button>`:null}`))}</div><div class="wcm-placeholder-block">${u?x`<wcm-text variant="big-bold" color="secondary">No results found</wcm-text>`:null} ${!u&&this.loading?x`<wcm-spinner></wcm-spinner>`:null}</div></wcm-modal-content>`}};U.styles=[h.globalCss,nr],ie([t$1()],U.prototype,"loading",2),ie([t$1()],U.prototype,"firstFetch",2),ie([t$1()],U.prototype,"search",2),ie([t$1()],U.prototype,"endReached",2),U=ie([e$2("wcm-wallet-explorer-view")],U);const dr=i$3`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var mr=Object.defineProperty,hr=Object.getOwnPropertyDescriptor,Ge=(e,t,r,n)=>{for(var o,i=n>1?void 0:n?hr(t,r):t,s=e.length-1;s>=0;s--)(o=e[s])&&(i=(n?o(t,r,i):o(i))||i);return n&&i&&mr(t,r,i),i};let we=class extends s{constructor(){super(),this.isError=!1,this.openWebWallet()}onFormatAndRedirect(e){const{desktop:t,name:r}=a$2.getWalletRouterData(),n=null==t?void 0:t.universal;if(n){const t=a$2.formatUniversalUrl(n,e,r);a$2.openHref(t,"_blank")}}openWebWallet(){const{walletConnectUri:e}=p$1.state,t=a$2.getWalletRouterData();c.setRecentWallet(t),e&&this.onFormatAndRedirect(e)}render(){const{name:e,id:t,image_id:r}=a$2.getWalletRouterData(),{isMobile:n,isDesktop:o}=c.getCachedRouterWalletPlatforms(),i=a$2.isMobile();return x`<wcm-modal-header title="${e}" .onAction="${c.handleUriCopy}" .actionIcon="${v.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${t}" imageId="${l(r)}" label="${`Continue in ${e}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`${e} web app has opened in a new tab. Go there, accept the connection, and come back`}</wcm-text><wcm-platform-selection .isMobile="${n}" .isDesktop="${!i&&o}" .isRetry="${!0}"><wcm-button .onClick="${this.openWebWallet.bind(this)}" .iconRight="${v.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};we.styles=[h.globalCss,dr],Ge([t$1()],we.prototype,"isError",2),we=Ge([e$2("wcm-web-connecting-view")],we);const index=Object.freeze(Object.defineProperty({__proto__:null,get WcmModal(){return ae},get WcmQrCode(){return j}},Symbol.toStringTag,{value:"Module"}));exports.HashgraphSDK=HashgraphSDK,exports.HashinalsWalletConnectSDK=HashinalsWalletConnectSDK,exports.Name=Name,exports.Result=Result,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})}));
|
|
170
170
|
//# sourceMappingURL=hashinal-wc.umd.js.map
|