From a9d1e5e3bbbf7ad015111305b122aee6a7bcca0a Mon Sep 17 00:00:00 2001 From: sam Date: Fri, 1 Dec 2023 02:37:30 +0330 Subject: [PATCH] Updates --- assets/{browser-EcNbE0JS.js => browser-BNgg9dRV.js} | 2 +- assets/{http-gYlq8-dx.js => http-I_tKnr4x.js} | 2 +- assets/{index-gYtQYNYB.js => index-1oLxk3tb.js} | 2 +- assets/index-BWemBGvP.js | 7 ------- assets/{index-gx2zUO7q.js => index-XXy2awPw.js} | 2 +- assets/index-YweLEVJf.js | 7 +++++++ assets/{index-i7WuWpn4.js => index-iGWvbPrT.js} | 10 +++++----- assets/{index-zQvBO4FF.js => index-iunrmsho.js} | 2 +- assets/{index-wO-A2ttc.js => index-kEqCFnDY.js} | 2 +- assets/{index.es-TVuT00BF.js => index.es-JhrPxZI8.js} | 6 +++--- index.html | 4 ++-- 11 files changed, 23 insertions(+), 23 deletions(-) rename assets/{browser-EcNbE0JS.js => browser-BNgg9dRV.js} (99%) rename assets/{http-gYlq8-dx.js => http-I_tKnr4x.js} (99%) rename assets/{index-gYtQYNYB.js => index-1oLxk3tb.js} (99%) delete mode 100644 assets/index-BWemBGvP.js rename assets/{index-gx2zUO7q.js => index-XXy2awPw.js} (99%) create mode 100644 assets/index-YweLEVJf.js rename assets/{index-i7WuWpn4.js => index-iGWvbPrT.js} (96%) rename assets/{index-zQvBO4FF.js => index-iunrmsho.js} (99%) rename assets/{index-wO-A2ttc.js => index-kEqCFnDY.js} (99%) rename assets/{index.es-TVuT00BF.js => index.es-JhrPxZI8.js} (99%) diff --git a/assets/browser-EcNbE0JS.js b/assets/browser-BNgg9dRV.js similarity index 99% rename from assets/browser-EcNbE0JS.js rename to assets/browser-BNgg9dRV.js index 3ecb921..846a9f3 100644 --- a/assets/browser-EcNbE0JS.js +++ b/assets/browser-BNgg9dRV.js @@ -1,4 +1,4 @@ -import{aU as bt,aV as Pt}from"./index-i7WuWpn4.js";var O={},Rt=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},dt={},T={};let it;const Lt=[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];T.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return t*4+17};T.getSymbolTotalCodewords=function(t){return Lt[t]};T.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t};T.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');it=t};T.isKanjiModeEnabled=function(){return typeof it<"u"};T.toSJIS=function(t){return it(t)};var G={};(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.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: "+i)}}e.isValid=function(o){return o&&typeof o.bit<"u"&&o.bit>=0&&o.bit<4},e.from=function(o,n){if(e.isValid(o))return o;try{return t(o)}catch{return n}}})(G);function ht(){this.buffer=[],this.length=0}ht.prototype={get:function(e){const t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)===1},put:function(e,t){for(let i=0;i>>t-i-1&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 Ut=ht;function K(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)}K.prototype.set=function(e,t,i,o){const n=e*this.size+t;this.data[n]=i,o&&(this.reservedBit[n]=!0)};K.prototype.get=function(e,t){return this.data[e*this.size+t]};K.prototype.xor=function(e,t,i){this.data[e*this.size+t]^=i};K.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var Dt=K,wt={};(function(e){const t=T.getSymbolSize;e.getRowColCoords=function(o){if(o===1)return[];const n=Math.floor(o/7)+2,r=t(o),s=r===145?26:Math.ceil((r-13)/(2*n-2))*2,c=[r-7];for(let u=1;u=0&&n<=7},e.from=function(n){return e.isValid(n)?parseInt(n,10):void 0},e.getPenaltyN1=function(n){const r=n.size;let s=0,c=0,u=0,l=null,a=null;for(let A=0;A=5&&(s+=t.N1+(c-5)),l=g,c=1),g=n.get(w,A),g===a?u++:(u>=5&&(s+=t.N1+(u-5)),a=g,u=1)}c>=5&&(s+=t.N1+(c-5)),u>=5&&(s+=t.N1+(u-5))}return s},e.getPenaltyN2=function(n){const r=n.size;let s=0;for(let c=0;c=10&&(c===1488||c===93)&&s++,u=u<<1&2047|n.get(a,l),a>=10&&(u===1488||u===93)&&s++}return s*t.N3},e.getPenaltyN4=function(n){let r=0;const s=n.data.length;for(let u=0;u=0;){const s=r[0];for(let u=0;u0){const r=new Uint8Array(this.degree);return r.set(o,n),r}return o};var kt=st,Bt={},L={},ut={};ut.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40};var S={};const At="[0-9]+",zt="[A-Z $%*+\\-./:]+";let H="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";H=H.replace(/u/g,"\\u");const Vt="(?:(?![A-Z0-9 $%*+\\-./:]|"+H+`)(?:.|[\r +import{aU as bt,aV as Pt}from"./index-iGWvbPrT.js";var O={},Rt=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},dt={},T={};let it;const Lt=[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];T.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return t*4+17};T.getSymbolTotalCodewords=function(t){return Lt[t]};T.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t};T.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');it=t};T.isKanjiModeEnabled=function(){return typeof it<"u"};T.toSJIS=function(t){return it(t)};var G={};(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.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: "+i)}}e.isValid=function(o){return o&&typeof o.bit<"u"&&o.bit>=0&&o.bit<4},e.from=function(o,n){if(e.isValid(o))return o;try{return t(o)}catch{return n}}})(G);function ht(){this.buffer=[],this.length=0}ht.prototype={get:function(e){const t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)===1},put:function(e,t){for(let i=0;i>>t-i-1&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 Ut=ht;function K(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)}K.prototype.set=function(e,t,i,o){const n=e*this.size+t;this.data[n]=i,o&&(this.reservedBit[n]=!0)};K.prototype.get=function(e,t){return this.data[e*this.size+t]};K.prototype.xor=function(e,t,i){this.data[e*this.size+t]^=i};K.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var Dt=K,wt={};(function(e){const t=T.getSymbolSize;e.getRowColCoords=function(o){if(o===1)return[];const n=Math.floor(o/7)+2,r=t(o),s=r===145?26:Math.ceil((r-13)/(2*n-2))*2,c=[r-7];for(let u=1;u=0&&n<=7},e.from=function(n){return e.isValid(n)?parseInt(n,10):void 0},e.getPenaltyN1=function(n){const r=n.size;let s=0,c=0,u=0,l=null,a=null;for(let A=0;A=5&&(s+=t.N1+(c-5)),l=g,c=1),g=n.get(w,A),g===a?u++:(u>=5&&(s+=t.N1+(u-5)),a=g,u=1)}c>=5&&(s+=t.N1+(c-5)),u>=5&&(s+=t.N1+(u-5))}return s},e.getPenaltyN2=function(n){const r=n.size;let s=0;for(let c=0;c=10&&(c===1488||c===93)&&s++,u=u<<1&2047|n.get(a,l),a>=10&&(u===1488||u===93)&&s++}return s*t.N3},e.getPenaltyN4=function(n){let r=0;const s=n.data.length;for(let u=0;u=0;){const s=r[0];for(let u=0;u0){const r=new Uint8Array(this.degree);return r.set(o,n),r}return o};var kt=st,Bt={},L={},ut={};ut.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40};var S={};const At="[0-9]+",zt="[A-Z $%*+\\-./:]+";let H="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";H=H.replace(/u/g,"\\u");const Vt="(?:(?![A-Z0-9 $%*+\\-./:]|"+H+`)(?:.|[\r ]))+`;S.KANJI=new RegExp(H,"g");S.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");S.BYTE=new RegExp(Vt,"g");S.NUMERIC=new RegExp(At,"g");S.ALPHANUMERIC=new RegExp(zt,"g");const Ht=new RegExp("^"+H+"$"),Kt=new RegExp("^"+At+"$"),Jt=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");S.testKanji=function(t){return Ht.test(t)};S.testNumeric=function(t){return Kt.test(t)};S.testAlphanumeric=function(t){return Jt.test(t)};(function(e){const t=ut,i=S;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(r,s){if(!r.ccBits)throw new Error("Invalid mode: "+r);if(!t.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?r.ccBits[0]:s<27?r.ccBits[1]:r.ccBits[2]},e.getBestModeForData=function(r){return i.testNumeric(r)?e.NUMERIC:i.testAlphanumeric(r)?e.ALPHANUMERIC:i.testKanji(r)?e.KANJI:e.BYTE},e.toString=function(r){if(r&&r.id)return r.id;throw new Error("Invalid mode")},e.isValid=function(r){return r&&r.bit&&r.ccBits};function o(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.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: "+n)}}e.from=function(r,s){if(e.isValid(r))return r;try{return o(r)}catch{return s}}})(L);(function(e){const t=T,i=j,o=G,n=L,r=ut,s=7973,c=t.getBCHDigit(s);function u(w,g,E){for(let C=1;C<=40;C++)if(g<=e.getCapacity(C,E,w))return C}function l(w,g){return n.getCharCountIndicator(w,g)+4}function a(w,g){let E=0;return w.forEach(function(C){const N=l(C.mode,g);E+=N+C.getBitsLength()}),E}function A(w,g){for(let E=1;E<=40;E++)if(a(w,E)<=e.getCapacity(E,g,n.MIXED))return E}e.from=function(g,E){return r.isValid(g)?parseInt(g,10):E},e.getCapacity=function(g,E,C){if(!r.isValid(g))throw new Error("Invalid QR Code version");typeof C>"u"&&(C=n.BYTE);const N=t.getSymbolTotalCodewords(g),h=i.getTotalCodewordsCount(g,E),m=(N-h)*8;if(C===n.MIXED)return m;const d=m-l(C,g);switch(C){case n.NUMERIC:return Math.floor(d/10*3);case n.ALPHANUMERIC:return Math.floor(d/11*2);case n.KANJI:return Math.floor(d/13);case n.BYTE:default:return Math.floor(d/8)}},e.getBestVersionForData=function(g,E){let C;const N=o.from(E,o.M);if(Array.isArray(g)){if(g.length>1)return A(g,N);if(g.length===0)return 1;C=g[0]}else C=g;return u(C.mode,C.getLength(),N)},e.getEncodedBits=function(g){if(!r.isValid(g)||g<7)throw new Error("Invalid QR Code version");let E=g<<12;for(;t.getBCHDigit(E)-c>=0;)E^=s<=0;)n^=Nt<0&&(o=this.data.substr(i),n=parseInt(o,10),t.put(n,r*3+1))};var _t=U;const Ot=L,W=["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 D(e){this.mode=Ot.ALPHANUMERIC,this.data=e}D.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)};D.prototype.getLength=function(){return this.data.length};D.prototype.getBitsLength=function(){return D.getBitsLength(this.data.length)};D.prototype.write=function(t){let i;for(i=0;i+2<=this.data.length;i+=2){let o=W.indexOf(this.data[i])*45;o+=W.indexOf(this.data[i+1]),t.put(o,11)}this.data.length%2&&t.put(W.indexOf(this.data[i]),6)};var Gt=D;const jt=bt,vt=L;function F(e){this.mode=vt.BYTE,typeof e=="string"&&(e=jt(e)),this.data=new Uint8Array(e)}F.getBitsLength=function(t){return t*8};F.prototype.getLength=function(){return this.data.length};F.prototype.getBitsLength=function(){return F.getBitsLength(this.data.length)};F.prototype.write=function(e){for(let t=0,i=this.data.length;t=33088&&i<=40956)i-=33088;else if(i>=57408&&i<=60351)i-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+` Make sure your charset is UTF-8`);i=(i>>>8&255)*192+(i&255),e.put(i,13)}};var Zt=k;(function(e){const t=L,i=_t,o=Gt,n=Qt,r=Zt,s=S,c=T,u=Pt;function l(h){return unescape(encodeURIComponent(h)).length}function a(h,m,d){const f=[];let y;for(;(y=h.exec(d))!==null;)f.push({data:y[0],index:y.index,mode:m,length:y[0].length});return f}function A(h){const m=a(s.NUMERIC,t.NUMERIC,h),d=a(s.ALPHANUMERIC,t.ALPHANUMERIC,h);let f,y;return c.isKanjiModeEnabled()?(f=a(s.BYTE,t.BYTE,h),y=a(s.KANJI,t.KANJI,h)):(f=a(s.BYTE_KANJI,t.BYTE,h),y=[]),m.concat(d,f,y).sort(function(I,p){return I.index-p.index}).map(function(I){return{data:I.data,mode:I.mode,length:I.length}})}function w(h,m){switch(m){case t.NUMERIC:return i.getBitsLength(h);case t.ALPHANUMERIC:return o.getBitsLength(h);case t.KANJI:return r.getBitsLength(h);case t.BYTE:return n.getBitsLength(h)}}function g(h){return h.reduce(function(m,d){const f=m.length-1>=0?m[m.length-1]:null;return f&&f.mode===d.mode?(m[m.length-1].data+=d.data,m):(m.push(d),m)},[])}function E(h){const m=[];for(let d=0;d=0&&c<=6&&(u===0||u===6)||u>=0&&u<=6&&(c===0||c===6)||c>=2&&c<=4&&u>=2&&u<=4?e.set(r+c,s+u,!0,!0):e.set(r+c,s+u,!1,!0))}}function se(e){const t=e.size;for(let i=8;i>c&1)===1,e.set(n,r,s,!0),e.set(r,n,s,!0)}function x(e,t,i){const o=e.size,n=oe.getEncodedBits(t,i);let r,s;for(r=0;r<15;r++)s=(n>>r&1)===1,r<6?e.set(r,8,s,!0):r<8?e.set(r+1,8,s,!0):e.set(o-15+r,8,s,!0),r<8?e.set(8,o-r-1,s,!0):r<9?e.set(8,15-r-1+1,s,!0):e.set(8,15-r-1,s,!0);e.set(o-8,8,1,!0)}function le(e,t){const i=e.size;let o=-1,n=i-1,r=7,s=0;for(let c=i-1;c>0;c-=2)for(c===6&&c--;;){for(let u=0;u<2;u++)if(!e.isReserved(n,c-u)){let l=!1;s>>r&1)===1),e.set(n,c-u,l),r--,r===-1&&(s++,r=7)}if(n+=o,n<0||i<=n){n-=o,o=-o;break}}}function ae(e,t,i){const o=new Xt;i.forEach(function(u){o.put(u.mode.bit,4),o.put(u.getLength(),re.getCharCountIndicator(u.mode,e)),u.write(o)});const n=Q.getSymbolTotalCodewords(e),r=ot.getTotalCodewordsCount(e,t),s=(n-r)*8;for(o.getLengthInBits()+4<=s&&o.put(0,4);o.getLengthInBits()%8!==0;)o.putBit(0);const c=(s-o.getLengthInBits())/8;for(let u=0;uJSON.stringify(r,(t,s)=>typeof s=="bigint"?s.toString()+"n":s),ue=r=>{const t=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,s=r.replace(t,'$1"$2n"$3');return JSON.parse(s,(c,f)=>typeof f=="string"&&f.match(/^\d+n$/)?BigInt(f.substring(0,f.length-1)):f)};function he(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return ue(r)}catch{return r}}function I(r){return typeof r=="string"?r:fe(r)||""}const de="PARSE_ERROR",le="INVALID_REQUEST",pe="METHOD_NOT_FOUND",ye="INVALID_PARAMS",$="INTERNAL_ERROR",S="SERVER_ERROR",be=[-32700,-32600,-32601,-32602,-32603],R={[de]:{code:-32700,message:"Parse error"},[le]:{code:-32600,message:"Invalid Request"},[pe]:{code:-32601,message:"Method not found"},[ye]:{code:-32602,message:"Invalid params"},[$]:{code:-32603,message:"Internal error"},[S]:{code:-32e3,message:"Server error"}},V=S;function me(r){return be.includes(r)}function U(r){return Object.keys(R).includes(r)?R[r]:R[V]}function ve(r){const t=Object.values(R).find(s=>s.code===r);return t||R[V]}function Ee(r,t,s){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${s} RPC url at ${t}`):r}var ge={},b={},M;function we(){if(M)return b;M=1,Object.defineProperty(b,"__esModule",{value:!0}),b.isBrowserCryptoAvailable=b.getSubtleCrypto=b.getBrowerCrypto=void 0;function r(){return(E===null||E===void 0?void 0:E.crypto)||(E===null||E===void 0?void 0:E.msCrypto)||{}}b.getBrowerCrypto=r;function t(){const c=r();return c.subtle||c.webkitSubtle}b.getSubtleCrypto=t;function s(){return!!r()&&!!t()}return b.isBrowserCryptoAvailable=s,b}var m={},j;function Re(){if(j)return m;j=1,Object.defineProperty(m,"__esModule",{value:!0}),m.isBrowser=m.isNode=m.isReactNative=void 0;function r(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}m.isReactNative=r;function t(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}m.isNode=t;function s(){return!r()&&!t()}return m.isBrowser=s,m}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const t=ae;t.__exportStar(we(),r),t.__exportStar(Re(),r)})(ge);function k(r=3){const t=Date.now()*Math.pow(10,r),s=Math.floor(Math.random()*Math.pow(10,r));return t+s}function _e(r=6){return BigInt(k(r))}function Ae(r,t,s){return{id:s||k(),jsonrpc:"2.0",method:r,params:t}}function Ne(r,t){return{id:r,jsonrpc:"2.0",result:t}}function Te(r,t,s){return{id:r,jsonrpc:"2.0",error:Oe(t,s)}}function Oe(r,t){return typeof r>"u"?U($):(typeof r=="string"&&(r=Object.assign(Object.assign({},U(S)),{message:r})),typeof t<"u"&&(r.data=t),me(r.code)&&(r=ve(r.code)),r)}class G{}class Fe extends G{constructor(t){super()}}class Pe extends G{constructor(){super()}}class Be extends Pe{constructor(t){super()}}const Se="^https?:",De="^wss?:";function xe(r){const t=r.match(new RegExp(/^\w+:/,"gi"));if(!(!t||!t.length))return t[0]}function X(r,t){const s=xe(r);return typeof s>"u"?!1:new RegExp(t).test(s)}function N(r){return X(r,Se)}function He(r){return X(r,De)}function qe(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}function z(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function Je(r){return z(r)&&"method"in r}function Ce(r){return z(r)&&(Le(r)||W(r))}function Le(r){return"result"in r}function W(r){return"error"in r}class $e extends Be{constructor(t){super(t),this.events=new J.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(t),this.connection.connected&&this.registerEventListeners()}async connect(t=this.connection){await this.open(t)}async disconnect(){await this.close()}on(t,s){this.events.on(t,s)}once(t,s){this.events.once(t,s)}off(t,s){this.events.off(t,s)}removeListener(t,s){this.events.removeListener(t,s)}async request(t,s){return this.requestStrict(Ae(t.method,t.params||[],t.id||_e().toString()),s)}async requestStrict(t,s){return new Promise(async(c,f)=>{if(!this.connection.connected)try{await this.open()}catch(o){f(o)}this.events.on(`${t.id}`,o=>{W(o)?f(o.error):c(o.result)});try{await this.connection.send(t,s)}catch(o){f(o)}})}setConnection(t=this.connection){return t}onPayload(t){this.events.emit("payload",t),Ce(t)?this.events.emit(`${t.id}`,t):this.events.emit("message",{type:t.method,data:t.params})}onClose(t){t&&t.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${t.code} ${t.reason?`(${t.reason})`:""}`)),this.events.emit("disconnect")}async open(t=this.connection){this.connection===t&&this.connection.connected||(this.connection.connected&&this.close(),typeof t=="string"&&(await this.connection.open(t),t=this.connection),this.connection=this.setConnection(t),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",t=>this.onPayload(t)),this.connection.on("close",t=>this.onClose(t)),this.connection.on("error",t=>this.events.emit("error",t)),this.connection.on("register_error",t=>this.onClose()),this.hasRegisteredEventListeners=!0)}}var B={exports:{}};(function(r,t){var s=typeof self<"u"?self:E,c=function(){function o(){this.fetch=!1,this.DOMException=s.DOMException}return o.prototype=s,new o}();(function(o){(function(l){var p={searchParams:"URLSearchParams"in o,iterable:"Symbol"in o&&"iterator"in Symbol,blob:"FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in o,arrayBuffer:"ArrayBuffer"in o};function Q(e){return e&&DataView.prototype.isPrototypeOf(e)}if(p.arrayBuffer)var K=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],Y=ArrayBuffer.isView||function(e){return e&&K.indexOf(Object.prototype.toString.call(e))>-1};function g(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function D(e){return typeof e!="string"&&(e=String(e)),e}function A(e){var n={next:function(){var i=e.shift();return{done:i===void 0,value:i}}};return p.iterable&&(n[Symbol.iterator]=function(){return n}),n}function u(e){this.map={},e instanceof u?e.forEach(function(n,i){this.append(i,n)},this):Array.isArray(e)?e.forEach(function(n){this.append(n[0],n[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(n){this.append(n,e[n])},this)}u.prototype.append=function(e,n){e=g(e),n=D(n);var i=this.map[e];this.map[e]=i?i+", "+n:n},u.prototype.delete=function(e){delete this.map[g(e)]},u.prototype.get=function(e){return e=g(e),this.has(e)?this.map[e]:null},u.prototype.has=function(e){return this.map.hasOwnProperty(g(e))},u.prototype.set=function(e,n){this.map[g(e)]=D(n)},u.prototype.forEach=function(e,n){for(var i in this.map)this.map.hasOwnProperty(i)&&e.call(n,this.map[i],i,this)},u.prototype.keys=function(){var e=[];return this.forEach(function(n,i){e.push(i)}),A(e)},u.prototype.values=function(){var e=[];return this.forEach(function(n){e.push(n)}),A(e)},u.prototype.entries=function(){var e=[];return this.forEach(function(n,i){e.push([i,n])}),A(e)},p.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);function T(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function x(e){return new Promise(function(n,i){e.onload=function(){n(e.result)},e.onerror=function(){i(e.error)}})}function Z(e){var n=new FileReader,i=x(n);return n.readAsArrayBuffer(e),i}function ee(e){var n=new FileReader,i=x(n);return n.readAsText(e),i}function te(e){for(var n=new Uint8Array(e),i=new Array(n.length),d=0;d-1?n:e}function v(e,n){n=n||{};var i=n.body;if(e instanceof v){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,n.headers||(this.headers=new u(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,!i&&e._bodyInit!=null&&(i=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=n.credentials||this.credentials||"same-origin",(n.headers||!this.headers)&&(this.headers=new u(n.headers)),this.method=ne(n.method||this.method||"GET"),this.mode=n.mode||this.mode||null,this.signal=n.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})};function se(e){var n=new FormData;return e.trim().split("&").forEach(function(i){if(i){var d=i.split("="),h=d.shift().replace(/\+/g," "),a=d.join("=").replace(/\+/g," ");n.append(decodeURIComponent(h),decodeURIComponent(a))}}),n}function ie(e){var n=new u,i=e.replace(/\r?\n[\t ]+/g," ");return i.split(/\r?\n/).forEach(function(d){var h=d.split(":"),a=h.shift().trim();if(a){var _=h.join(":").trim();n.append(a,_)}}),n}L.call(v.prototype);function y(e,n){n||(n={}),this.type="default",this.status=n.status===void 0?200:n.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in n?n.statusText:"OK",this.headers=new u(n.headers),this.url=n.url||"",this._initBody(e)}L.call(y.prototype),y.prototype.clone=function(){return new y(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},y.error=function(){var e=new y(null,{status:0,statusText:""});return e.type="error",e};var oe=[301,302,303,307,308];y.redirect=function(e,n){if(oe.indexOf(n)===-1)throw new RangeError("Invalid status code");return new y(null,{status:n,headers:{location:e}})},l.DOMException=o.DOMException;try{new l.DOMException}catch{l.DOMException=function(n,i){this.message=n,this.name=i;var d=Error(n);this.stack=d.stack},l.DOMException.prototype=Object.create(Error.prototype),l.DOMException.prototype.constructor=l.DOMException}function O(e,n){return new Promise(function(i,d){var h=new v(e,n);if(h.signal&&h.signal.aborted)return d(new l.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function _(){a.abort()}a.onload=function(){var w={status:a.status,statusText:a.statusText,headers:ie(a.getAllResponseHeaders()||"")};w.url="responseURL"in a?a.responseURL:w.headers.get("X-Request-URL");var P="response"in a?a.response:a.responseText;i(new y(P,w))},a.onerror=function(){d(new TypeError("Network request failed"))},a.ontimeout=function(){d(new TypeError("Network request failed"))},a.onabort=function(){d(new l.DOMException("Aborted","AbortError"))},a.open(h.method,h.url,!0),h.credentials==="include"?a.withCredentials=!0:h.credentials==="omit"&&(a.withCredentials=!1),"responseType"in a&&p.blob&&(a.responseType="blob"),h.headers.forEach(function(w,P){a.setRequestHeader(P,w)}),h.signal&&(h.signal.addEventListener("abort",_),a.onreadystatechange=function(){a.readyState===4&&h.signal.removeEventListener("abort",_)}),a.send(typeof h._bodyInit>"u"?null:h._bodyInit)})}return O.polyfill=!0,o.fetch||(o.fetch=O,o.Headers=u,o.Request=v,o.Response=y),l.Headers=u,l.Request=v,l.Response=y,l.fetch=O,Object.defineProperty(l,"__esModule",{value:!0}),l})({})})(c),c.fetch.ponyfill=!0,delete c.fetch.polyfill;var f=c;t=f.fetch,t.default=f.fetch,t.fetch=f.fetch,t.Headers=f.Headers,t.Request=f.Request,t.Response=f.Response,r.exports=t})(B,B.exports);var Ie=B.exports;const F=ce(Ie),Ue={Accept:"application/json","Content-Type":"application/json"},Me="POST",H={headers:Ue,method:Me},q=10;class Ve{constructor(t,s=!1){if(this.url=t,this.disableProviderPing=s,this.events=new J.EventEmitter,this.isAvailable=!1,this.registering=!1,!N(t))throw new Error(`Provided URL is not compatible with HTTP connection: ${t}`);this.url=t,this.disableProviderPing=s}get connected(){return this.isAvailable}get connecting(){return this.registering}on(t,s){this.events.on(t,s)}once(t,s){this.events.once(t,s)}off(t,s){this.events.off(t,s)}removeListener(t,s){this.events.removeListener(t,s)}async open(t=this.url){await this.register(t)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(t,s){this.isAvailable||await this.register();try{const c=I(t),o=await(await F(this.url,Object.assign(Object.assign({},H),{body:c}))).json();this.onPayload({data:o})}catch(c){this.onError(t.id,c)}}async register(t=this.url){if(!N(t))throw new Error(`Provided URL is not compatible with HTTP connection: ${t}`);if(this.registering){const s=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=s||this.events.listenerCount("open")>=s)&&this.events.setMaxListeners(s+1),new Promise((c,f)=>{this.events.once("register_error",o=>{this.resetMaxListeners(),f(o)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return f(new Error("HTTP connection is missing or invalid"));c()})})}this.url=t,this.registering=!0;try{if(!this.disableProviderPing){const s=I({id:1,jsonrpc:"2.0",method:"test",params:[]});await F(t,Object.assign(Object.assign({},H),{body:s}))}this.onOpen()}catch(s){const c=this.parseError(s);throw this.events.emit("register_error",c),this.onClose(),c}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(t){if(typeof t.data>"u")return;const s=typeof t.data=="string"?he(t.data):t.data;this.events.emit("payload",s)}onError(t,s){const c=this.parseError(s),f=c.message||c.toString(),o=Te(t,f);this.events.emit("payload",o)}parseError(t,s=this.url){return Ee(t,s,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>q&&this.events.setMaxListeners(q)}}export{Ve as H,Fe as I,$e as J,he as a,qe as b,ge as c,Je as d,Ce as e,Te as f,Ne as g,Le as h,He as i,W as j,Ae as k,_e as l,k as m,Ee as p,I as s}; +import{o as E,r as ae,h as J,p as ce}from"./index-iGWvbPrT.js";const fe=r=>JSON.stringify(r,(t,s)=>typeof s=="bigint"?s.toString()+"n":s),ue=r=>{const t=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,s=r.replace(t,'$1"$2n"$3');return JSON.parse(s,(c,f)=>typeof f=="string"&&f.match(/^\d+n$/)?BigInt(f.substring(0,f.length-1)):f)};function he(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return ue(r)}catch{return r}}function I(r){return typeof r=="string"?r:fe(r)||""}const de="PARSE_ERROR",le="INVALID_REQUEST",pe="METHOD_NOT_FOUND",ye="INVALID_PARAMS",$="INTERNAL_ERROR",S="SERVER_ERROR",be=[-32700,-32600,-32601,-32602,-32603],R={[de]:{code:-32700,message:"Parse error"},[le]:{code:-32600,message:"Invalid Request"},[pe]:{code:-32601,message:"Method not found"},[ye]:{code:-32602,message:"Invalid params"},[$]:{code:-32603,message:"Internal error"},[S]:{code:-32e3,message:"Server error"}},V=S;function me(r){return be.includes(r)}function U(r){return Object.keys(R).includes(r)?R[r]:R[V]}function ve(r){const t=Object.values(R).find(s=>s.code===r);return t||R[V]}function Ee(r,t,s){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${s} RPC url at ${t}`):r}var ge={},b={},M;function we(){if(M)return b;M=1,Object.defineProperty(b,"__esModule",{value:!0}),b.isBrowserCryptoAvailable=b.getSubtleCrypto=b.getBrowerCrypto=void 0;function r(){return(E===null||E===void 0?void 0:E.crypto)||(E===null||E===void 0?void 0:E.msCrypto)||{}}b.getBrowerCrypto=r;function t(){const c=r();return c.subtle||c.webkitSubtle}b.getSubtleCrypto=t;function s(){return!!r()&&!!t()}return b.isBrowserCryptoAvailable=s,b}var m={},j;function Re(){if(j)return m;j=1,Object.defineProperty(m,"__esModule",{value:!0}),m.isBrowser=m.isNode=m.isReactNative=void 0;function r(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}m.isReactNative=r;function t(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}m.isNode=t;function s(){return!r()&&!t()}return m.isBrowser=s,m}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const t=ae;t.__exportStar(we(),r),t.__exportStar(Re(),r)})(ge);function k(r=3){const t=Date.now()*Math.pow(10,r),s=Math.floor(Math.random()*Math.pow(10,r));return t+s}function _e(r=6){return BigInt(k(r))}function Ae(r,t,s){return{id:s||k(),jsonrpc:"2.0",method:r,params:t}}function Ne(r,t){return{id:r,jsonrpc:"2.0",result:t}}function Te(r,t,s){return{id:r,jsonrpc:"2.0",error:Oe(t,s)}}function Oe(r,t){return typeof r>"u"?U($):(typeof r=="string"&&(r=Object.assign(Object.assign({},U(S)),{message:r})),typeof t<"u"&&(r.data=t),me(r.code)&&(r=ve(r.code)),r)}class G{}class Fe extends G{constructor(t){super()}}class Pe extends G{constructor(){super()}}class Be extends Pe{constructor(t){super()}}const Se="^https?:",De="^wss?:";function xe(r){const t=r.match(new RegExp(/^\w+:/,"gi"));if(!(!t||!t.length))return t[0]}function X(r,t){const s=xe(r);return typeof s>"u"?!1:new RegExp(t).test(s)}function N(r){return X(r,Se)}function He(r){return X(r,De)}function qe(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}function z(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function Je(r){return z(r)&&"method"in r}function Ce(r){return z(r)&&(Le(r)||W(r))}function Le(r){return"result"in r}function W(r){return"error"in r}class $e extends Be{constructor(t){super(t),this.events=new J.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(t),this.connection.connected&&this.registerEventListeners()}async connect(t=this.connection){await this.open(t)}async disconnect(){await this.close()}on(t,s){this.events.on(t,s)}once(t,s){this.events.once(t,s)}off(t,s){this.events.off(t,s)}removeListener(t,s){this.events.removeListener(t,s)}async request(t,s){return this.requestStrict(Ae(t.method,t.params||[],t.id||_e().toString()),s)}async requestStrict(t,s){return new Promise(async(c,f)=>{if(!this.connection.connected)try{await this.open()}catch(o){f(o)}this.events.on(`${t.id}`,o=>{W(o)?f(o.error):c(o.result)});try{await this.connection.send(t,s)}catch(o){f(o)}})}setConnection(t=this.connection){return t}onPayload(t){this.events.emit("payload",t),Ce(t)?this.events.emit(`${t.id}`,t):this.events.emit("message",{type:t.method,data:t.params})}onClose(t){t&&t.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${t.code} ${t.reason?`(${t.reason})`:""}`)),this.events.emit("disconnect")}async open(t=this.connection){this.connection===t&&this.connection.connected||(this.connection.connected&&this.close(),typeof t=="string"&&(await this.connection.open(t),t=this.connection),this.connection=this.setConnection(t),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",t=>this.onPayload(t)),this.connection.on("close",t=>this.onClose(t)),this.connection.on("error",t=>this.events.emit("error",t)),this.connection.on("register_error",t=>this.onClose()),this.hasRegisteredEventListeners=!0)}}var B={exports:{}};(function(r,t){var s=typeof self<"u"?self:E,c=function(){function o(){this.fetch=!1,this.DOMException=s.DOMException}return o.prototype=s,new o}();(function(o){(function(l){var p={searchParams:"URLSearchParams"in o,iterable:"Symbol"in o&&"iterator"in Symbol,blob:"FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in o,arrayBuffer:"ArrayBuffer"in o};function Q(e){return e&&DataView.prototype.isPrototypeOf(e)}if(p.arrayBuffer)var K=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],Y=ArrayBuffer.isView||function(e){return e&&K.indexOf(Object.prototype.toString.call(e))>-1};function g(e){if(typeof e!="string"&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function D(e){return typeof e!="string"&&(e=String(e)),e}function A(e){var n={next:function(){var i=e.shift();return{done:i===void 0,value:i}}};return p.iterable&&(n[Symbol.iterator]=function(){return n}),n}function u(e){this.map={},e instanceof u?e.forEach(function(n,i){this.append(i,n)},this):Array.isArray(e)?e.forEach(function(n){this.append(n[0],n[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(n){this.append(n,e[n])},this)}u.prototype.append=function(e,n){e=g(e),n=D(n);var i=this.map[e];this.map[e]=i?i+", "+n:n},u.prototype.delete=function(e){delete this.map[g(e)]},u.prototype.get=function(e){return e=g(e),this.has(e)?this.map[e]:null},u.prototype.has=function(e){return this.map.hasOwnProperty(g(e))},u.prototype.set=function(e,n){this.map[g(e)]=D(n)},u.prototype.forEach=function(e,n){for(var i in this.map)this.map.hasOwnProperty(i)&&e.call(n,this.map[i],i,this)},u.prototype.keys=function(){var e=[];return this.forEach(function(n,i){e.push(i)}),A(e)},u.prototype.values=function(){var e=[];return this.forEach(function(n){e.push(n)}),A(e)},u.prototype.entries=function(){var e=[];return this.forEach(function(n,i){e.push([i,n])}),A(e)},p.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);function T(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function x(e){return new Promise(function(n,i){e.onload=function(){n(e.result)},e.onerror=function(){i(e.error)}})}function Z(e){var n=new FileReader,i=x(n);return n.readAsArrayBuffer(e),i}function ee(e){var n=new FileReader,i=x(n);return n.readAsText(e),i}function te(e){for(var n=new Uint8Array(e),i=new Array(n.length),d=0;d-1?n:e}function v(e,n){n=n||{};var i=n.body;if(e instanceof v){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,n.headers||(this.headers=new u(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,!i&&e._bodyInit!=null&&(i=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=n.credentials||this.credentials||"same-origin",(n.headers||!this.headers)&&(this.headers=new u(n.headers)),this.method=ne(n.method||this.method||"GET"),this.mode=n.mode||this.mode||null,this.signal=n.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})};function se(e){var n=new FormData;return e.trim().split("&").forEach(function(i){if(i){var d=i.split("="),h=d.shift().replace(/\+/g," "),a=d.join("=").replace(/\+/g," ");n.append(decodeURIComponent(h),decodeURIComponent(a))}}),n}function ie(e){var n=new u,i=e.replace(/\r?\n[\t ]+/g," ");return i.split(/\r?\n/).forEach(function(d){var h=d.split(":"),a=h.shift().trim();if(a){var _=h.join(":").trim();n.append(a,_)}}),n}L.call(v.prototype);function y(e,n){n||(n={}),this.type="default",this.status=n.status===void 0?200:n.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in n?n.statusText:"OK",this.headers=new u(n.headers),this.url=n.url||"",this._initBody(e)}L.call(y.prototype),y.prototype.clone=function(){return new y(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},y.error=function(){var e=new y(null,{status:0,statusText:""});return e.type="error",e};var oe=[301,302,303,307,308];y.redirect=function(e,n){if(oe.indexOf(n)===-1)throw new RangeError("Invalid status code");return new y(null,{status:n,headers:{location:e}})},l.DOMException=o.DOMException;try{new l.DOMException}catch{l.DOMException=function(n,i){this.message=n,this.name=i;var d=Error(n);this.stack=d.stack},l.DOMException.prototype=Object.create(Error.prototype),l.DOMException.prototype.constructor=l.DOMException}function O(e,n){return new Promise(function(i,d){var h=new v(e,n);if(h.signal&&h.signal.aborted)return d(new l.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function _(){a.abort()}a.onload=function(){var w={status:a.status,statusText:a.statusText,headers:ie(a.getAllResponseHeaders()||"")};w.url="responseURL"in a?a.responseURL:w.headers.get("X-Request-URL");var P="response"in a?a.response:a.responseText;i(new y(P,w))},a.onerror=function(){d(new TypeError("Network request failed"))},a.ontimeout=function(){d(new TypeError("Network request failed"))},a.onabort=function(){d(new l.DOMException("Aborted","AbortError"))},a.open(h.method,h.url,!0),h.credentials==="include"?a.withCredentials=!0:h.credentials==="omit"&&(a.withCredentials=!1),"responseType"in a&&p.blob&&(a.responseType="blob"),h.headers.forEach(function(w,P){a.setRequestHeader(P,w)}),h.signal&&(h.signal.addEventListener("abort",_),a.onreadystatechange=function(){a.readyState===4&&h.signal.removeEventListener("abort",_)}),a.send(typeof h._bodyInit>"u"?null:h._bodyInit)})}return O.polyfill=!0,o.fetch||(o.fetch=O,o.Headers=u,o.Request=v,o.Response=y),l.Headers=u,l.Request=v,l.Response=y,l.fetch=O,Object.defineProperty(l,"__esModule",{value:!0}),l})({})})(c),c.fetch.ponyfill=!0,delete c.fetch.polyfill;var f=c;t=f.fetch,t.default=f.fetch,t.fetch=f.fetch,t.Headers=f.Headers,t.Request=f.Request,t.Response=f.Response,r.exports=t})(B,B.exports);var Ie=B.exports;const F=ce(Ie),Ue={Accept:"application/json","Content-Type":"application/json"},Me="POST",H={headers:Ue,method:Me},q=10;class Ve{constructor(t,s=!1){if(this.url=t,this.disableProviderPing=s,this.events=new J.EventEmitter,this.isAvailable=!1,this.registering=!1,!N(t))throw new Error(`Provided URL is not compatible with HTTP connection: ${t}`);this.url=t,this.disableProviderPing=s}get connected(){return this.isAvailable}get connecting(){return this.registering}on(t,s){this.events.on(t,s)}once(t,s){this.events.once(t,s)}off(t,s){this.events.off(t,s)}removeListener(t,s){this.events.removeListener(t,s)}async open(t=this.url){await this.register(t)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(t,s){this.isAvailable||await this.register();try{const c=I(t),o=await(await F(this.url,Object.assign(Object.assign({},H),{body:c}))).json();this.onPayload({data:o})}catch(c){this.onError(t.id,c)}}async register(t=this.url){if(!N(t))throw new Error(`Provided URL is not compatible with HTTP connection: ${t}`);if(this.registering){const s=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=s||this.events.listenerCount("open")>=s)&&this.events.setMaxListeners(s+1),new Promise((c,f)=>{this.events.once("register_error",o=>{this.resetMaxListeners(),f(o)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return f(new Error("HTTP connection is missing or invalid"));c()})})}this.url=t,this.registering=!0;try{if(!this.disableProviderPing){const s=I({id:1,jsonrpc:"2.0",method:"test",params:[]});await F(t,Object.assign(Object.assign({},H),{body:s}))}this.onOpen()}catch(s){const c=this.parseError(s);throw this.events.emit("register_error",c),this.onClose(),c}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(t){if(typeof t.data>"u")return;const s=typeof t.data=="string"?he(t.data):t.data;this.events.emit("payload",s)}onError(t,s){const c=this.parseError(s),f=c.message||c.toString(),o=Te(t,f);this.events.emit("payload",o)}parseError(t,s=this.url){return Ee(t,s,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>q&&this.events.setMaxListeners(q)}}export{Ve as H,Fe as I,$e as J,he as a,qe as b,ge as c,Je as d,Ce as e,Te as f,Ne as g,Le as h,He as i,W as j,Ae as k,_e as l,k as m,Ee as p,I as s}; diff --git a/assets/index-gYtQYNYB.js b/assets/index-1oLxk3tb.js similarity index 99% rename from assets/index-gYtQYNYB.js rename to assets/index-1oLxk3tb.js index 5df4a1e..94bdfd0 100644 --- a/assets/index-gYtQYNYB.js +++ b/assets/index-1oLxk3tb.js @@ -1,4 +1,4 @@ -import{h as ku,aA as no,o as te,e as wn,aB as G,p as B0}from"./index-i7WuWpn4.js";import{p as D0,h as $0}from"./hooks.module-o1hAt1ko.js";function F0(t,e){for(var r=0;rn[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var Nu={},Vi={},io={};Object.defineProperty(io,"__esModule",{value:!0});io.walletLogo=void 0;const j0=(t,e)=>{let r;switch(t){case"standard":return r=e,`data:image/svg+xml,%3Csvg width='${e}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return r=e,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${r}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return r=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return r=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return r=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return r=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return r=e,`data:image/svg+xml,%3Csvg width='${e}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};io.walletLogo=j0;var so={};Object.defineProperty(so,"__esModule",{value:!0});so.LINK_API_URL=void 0;so.LINK_API_URL="https://www.walletlink.org";var oo={};Object.defineProperty(oo,"__esModule",{value:!0});oo.ScopedLocalStorage=void 0;class U0{constructor(e){this.scope=e}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`${this.scope}:${e}`}}oo.ScopedLocalStorage=U0;var ti={},_n={};Object.defineProperty(_n,"__esModule",{value:!0});const W0=ku;function zc(t,e,r){try{Reflect.apply(t,e,r)}catch(n){setTimeout(()=>{throw n})}}function H0(t){const e=t.length,r=new Array(e);for(let n=0;n0&&([o]=r),o instanceof Error)throw o;const a=new Error(`Unhandled error.${o?` (${o.message})`:""}`);throw a.context=o,a}const s=i[e];if(s===void 0)return!1;if(typeof s=="function")zc(s,this,r);else{const o=s.length,a=H0(s);for(let c=0;c0?u:g},s.min=function(u,g){return u.cmp(g)<0?u:g},s.prototype._init=function(u,g,m){if(typeof u=="number")return this._initNumber(u,g,m);if(typeof u=="object")return this._initArray(u,g,m);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),u=u.toString().replace(/\s+/g,"");var E=0;u[0]==="-"&&(E++,this.negative=1),E=0;E-=3)T=u[E]|u[E-1]<<8|u[E-2]<<16,this.words[S]|=T<>>26-L&67108863,L+=24,L>=26&&(L-=26,S++);else if(m==="le")for(E=0,S=0;E>>26-L&67108863,L+=24,L>=26&&(L-=26,S++);return this._strip()};function a(w,u){var g=w.charCodeAt(u);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;n(!1,"Invalid character in "+w)}function c(w,u,g){var m=a(w,g);return g-1>=u&&(m|=a(w,g-1)<<4),m}s.prototype._parseHex=function(u,g,m){this.length=Math.ceil((u.length-g)/6),this.words=new Array(this.length);for(var E=0;E=g;E-=2)L=c(u,g,E)<=18?(S-=18,T+=1,this.words[T]|=L>>>26):S+=8;else{var _=u.length-g;for(E=_%2===0?g+1:g;E=18?(S-=18,T+=1,this.words[T]|=L>>>26):S+=8}this._strip()};function l(w,u,g,m){for(var E=0,S=0,T=Math.min(w.length,g),L=u;L=49?S=_-49+10:_>=17?S=_-17+10:S=_,n(_>=0&&S1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=y}catch{s.prototype.inspect=y}else s.prototype.inspect=y;function y(){return(this.red?""}var v=["","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"],A=[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],O=[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];s.prototype.toString=function(u,g){u=u||10,g=g|0||1;var m;if(u===16||u==="hex"){m="";for(var E=0,S=0,T=0;T>>24-E&16777215,E+=2,E>=26&&(E-=26,T--),S!==0||T!==this.length-1?m=v[6-_.length]+_+m:m=_+m}for(S!==0&&(m=S.toString(16)+m);m.length%g!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}if(u===(u|0)&&u>=2&&u<=36){var d=A[u],R=O[u];m="";var Y=this.clone();for(Y.negative=0;!Y.isZero();){var X=Y.modrn(R).toString(u);Y=Y.idivn(R),Y.isZero()?m=X+m:m=v[d-X.length]+X+m}for(this.isZero()&&(m="0"+m);m.length%g!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var u=this.words[0];return this.length===2?u+=this.words[1]*67108864:this.length===3&&this.words[2]===1?u+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-u:u},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(u,g){return this.toArrayLike(o,u,g)}),s.prototype.toArray=function(u,g){return this.toArrayLike(Array,u,g)};var j=function(u,g){return u.allocUnsafe?u.allocUnsafe(g):new u(g)};s.prototype.toArrayLike=function(u,g,m){this._strip();var E=this.byteLength(),S=m||Math.max(1,E);n(E<=S,"byte array longer than desired length"),n(S>0,"Requested array length <= 0");var T=j(u,S),L=g==="le"?"LE":"BE";return this["_toArrayLike"+L](T,E),T},s.prototype._toArrayLikeLE=function(u,g){for(var m=0,E=0,S=0,T=0;S>8&255),m>16&255),T===6?(m>24&255),E=0,T=0):(E=L>>>24,T+=2)}if(m=0&&(u[m--]=L>>8&255),m>=0&&(u[m--]=L>>16&255),T===6?(m>=0&&(u[m--]=L>>24&255),E=0,T=0):(E=L>>>24,T+=2)}if(m>=0)for(u[m--]=E;m>=0;)u[m--]=0},Math.clz32?s.prototype._countBits=function(u){return 32-Math.clz32(u)}:s.prototype._countBits=function(u){var g=u,m=0;return g>=4096&&(m+=13,g>>>=13),g>=64&&(m+=7,g>>>=7),g>=8&&(m+=4,g>>>=4),g>=2&&(m+=2,g>>>=2),m+g},s.prototype._zeroBits=function(u){if(u===0)return 26;var g=u,m=0;return g&8191||(m+=13,g>>>=13),g&127||(m+=7,g>>>=7),g&15||(m+=4,g>>>=4),g&3||(m+=2,g>>>=2),g&1||m++,m},s.prototype.bitLength=function(){var u=this.words[this.length-1],g=this._countBits(u);return(this.length-1)*26+g};function F(w){for(var u=new Array(w.bitLength()),g=0;g>>E&1}return u}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var u=0,g=0;gu.length?this.clone().ior(u):u.clone().ior(this)},s.prototype.uor=function(u){return this.length>u.length?this.clone().iuor(u):u.clone().iuor(this)},s.prototype.iuand=function(u){var g;this.length>u.length?g=u:g=this;for(var m=0;mu.length?this.clone().iand(u):u.clone().iand(this)},s.prototype.uand=function(u){return this.length>u.length?this.clone().iuand(u):u.clone().iuand(this)},s.prototype.iuxor=function(u){var g,m;this.length>u.length?(g=this,m=u):(g=u,m=this);for(var E=0;Eu.length?this.clone().ixor(u):u.clone().ixor(this)},s.prototype.uxor=function(u){return this.length>u.length?this.clone().iuxor(u):u.clone().iuxor(this)},s.prototype.inotn=function(u){n(typeof u=="number"&&u>=0);var g=Math.ceil(u/26)|0,m=u%26;this._expand(g),m>0&&g--;for(var E=0;E0&&(this.words[E]=~this.words[E]&67108863>>26-m),this._strip()},s.prototype.notn=function(u){return this.clone().inotn(u)},s.prototype.setn=function(u,g){n(typeof u=="number"&&u>=0);var m=u/26|0,E=u%26;return this._expand(m+1),g?this.words[m]=this.words[m]|1<u.length?(m=this,E=u):(m=u,E=this);for(var S=0,T=0;T>>26;for(;S!==0&&T>>26;if(this.length=m.length,S!==0)this.words[this.length]=S,this.length++;else if(m!==this)for(;Tu.length?this.clone().iadd(u):u.clone().iadd(this)},s.prototype.isub=function(u){if(u.negative!==0){u.negative=0;var g=this.iadd(u);return u.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(u),this.negative=1,this._normSign();var m=this.cmp(u);if(m===0)return this.negative=0,this.length=1,this.words[0]=0,this;var E,S;m>0?(E=this,S=u):(E=u,S=this);for(var T=0,L=0;L>26,this.words[L]=g&67108863;for(;T!==0&&L>26,this.words[L]=g&67108863;if(T===0&&L>>26,Y=_&67108863,X=Math.min(d,u.length-1),k=Math.max(0,d-w.length+1);k<=X;k++){var B=d-k|0;E=w.words[B]|0,S=u.words[k]|0,T=E*S+Y,R+=T/67108864|0,Y=T&67108863}g.words[d]=Y|0,_=R|0}return _!==0?g.words[d]=_|0:g.length--,g._strip()}var N=function(u,g,m){var E=u.words,S=g.words,T=m.words,L=0,_,d,R,Y=E[0]|0,X=Y&8191,k=Y>>>13,B=E[1]|0,V=B&8191,Q=B>>>13,ge=E[2]|0,M=ge&8191,C=ge>>>13,q=E[3]|0,J=q&8191,fe=q>>>13,ye=E[4]|0,ae=ye&8191,Se=ye>>>13,Pt=E[5]|0,Ae=Pt&8191,Ie=Pt>>>13,ot=E[6]|0,Me=ot&8191,Te=ot>>>13,ct=E[7]|0,Ce=ct&8191,b=ct>>>13,f=E[8]|0,h=f&8191,x=f>>>13,P=E[9]|0,$=P&8191,W=P>>>13,de=S[0]|0,he=de&8191,ce=de>>>13,Oe=S[1]|0,ue=Oe&8191,Le=Oe>>>13,An=S[2]|0,Pe=An&8191,Be=An>>>13,Tn=S[3]|0,De=Tn&8191,$e=Tn>>>13,On=S[4]|0,Fe=On&8191,je=On>>>13,kn=S[5]|0,Ue=kn&8191,We=kn>>>13,Nn=S[6]|0,He=Nn&8191,Ve=Nn>>>13,Ln=S[7]|0,ze=Ln&8191,qe=Ln>>>13,Pn=S[8]|0,Ge=Pn&8191,Je=Pn>>>13,Bn=S[9]|0,Ze=Bn&8191,Qe=Bn>>>13;m.negative=u.negative^g.negative,m.length=19,_=Math.imul(X,he),d=Math.imul(X,ce),d=d+Math.imul(k,he)|0,R=Math.imul(k,ce);var Wr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(Wr>>>26)|0,Wr&=67108863,_=Math.imul(V,he),d=Math.imul(V,ce),d=d+Math.imul(Q,he)|0,R=Math.imul(Q,ce),_=_+Math.imul(X,ue)|0,d=d+Math.imul(X,Le)|0,d=d+Math.imul(k,ue)|0,R=R+Math.imul(k,Le)|0;var Hr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,_=Math.imul(M,he),d=Math.imul(M,ce),d=d+Math.imul(C,he)|0,R=Math.imul(C,ce),_=_+Math.imul(V,ue)|0,d=d+Math.imul(V,Le)|0,d=d+Math.imul(Q,ue)|0,R=R+Math.imul(Q,Le)|0,_=_+Math.imul(X,Pe)|0,d=d+Math.imul(X,Be)|0,d=d+Math.imul(k,Pe)|0,R=R+Math.imul(k,Be)|0;var Vr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(Vr>>>26)|0,Vr&=67108863,_=Math.imul(J,he),d=Math.imul(J,ce),d=d+Math.imul(fe,he)|0,R=Math.imul(fe,ce),_=_+Math.imul(M,ue)|0,d=d+Math.imul(M,Le)|0,d=d+Math.imul(C,ue)|0,R=R+Math.imul(C,Le)|0,_=_+Math.imul(V,Pe)|0,d=d+Math.imul(V,Be)|0,d=d+Math.imul(Q,Pe)|0,R=R+Math.imul(Q,Be)|0,_=_+Math.imul(X,De)|0,d=d+Math.imul(X,$e)|0,d=d+Math.imul(k,De)|0,R=R+Math.imul(k,$e)|0;var zr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(zr>>>26)|0,zr&=67108863,_=Math.imul(ae,he),d=Math.imul(ae,ce),d=d+Math.imul(Se,he)|0,R=Math.imul(Se,ce),_=_+Math.imul(J,ue)|0,d=d+Math.imul(J,Le)|0,d=d+Math.imul(fe,ue)|0,R=R+Math.imul(fe,Le)|0,_=_+Math.imul(M,Pe)|0,d=d+Math.imul(M,Be)|0,d=d+Math.imul(C,Pe)|0,R=R+Math.imul(C,Be)|0,_=_+Math.imul(V,De)|0,d=d+Math.imul(V,$e)|0,d=d+Math.imul(Q,De)|0,R=R+Math.imul(Q,$e)|0,_=_+Math.imul(X,Fe)|0,d=d+Math.imul(X,je)|0,d=d+Math.imul(k,Fe)|0,R=R+Math.imul(k,je)|0;var qr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(qr>>>26)|0,qr&=67108863,_=Math.imul(Ae,he),d=Math.imul(Ae,ce),d=d+Math.imul(Ie,he)|0,R=Math.imul(Ie,ce),_=_+Math.imul(ae,ue)|0,d=d+Math.imul(ae,Le)|0,d=d+Math.imul(Se,ue)|0,R=R+Math.imul(Se,Le)|0,_=_+Math.imul(J,Pe)|0,d=d+Math.imul(J,Be)|0,d=d+Math.imul(fe,Pe)|0,R=R+Math.imul(fe,Be)|0,_=_+Math.imul(M,De)|0,d=d+Math.imul(M,$e)|0,d=d+Math.imul(C,De)|0,R=R+Math.imul(C,$e)|0,_=_+Math.imul(V,Fe)|0,d=d+Math.imul(V,je)|0,d=d+Math.imul(Q,Fe)|0,R=R+Math.imul(Q,je)|0,_=_+Math.imul(X,Ue)|0,d=d+Math.imul(X,We)|0,d=d+Math.imul(k,Ue)|0,R=R+Math.imul(k,We)|0;var Gr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(Gr>>>26)|0,Gr&=67108863,_=Math.imul(Me,he),d=Math.imul(Me,ce),d=d+Math.imul(Te,he)|0,R=Math.imul(Te,ce),_=_+Math.imul(Ae,ue)|0,d=d+Math.imul(Ae,Le)|0,d=d+Math.imul(Ie,ue)|0,R=R+Math.imul(Ie,Le)|0,_=_+Math.imul(ae,Pe)|0,d=d+Math.imul(ae,Be)|0,d=d+Math.imul(Se,Pe)|0,R=R+Math.imul(Se,Be)|0,_=_+Math.imul(J,De)|0,d=d+Math.imul(J,$e)|0,d=d+Math.imul(fe,De)|0,R=R+Math.imul(fe,$e)|0,_=_+Math.imul(M,Fe)|0,d=d+Math.imul(M,je)|0,d=d+Math.imul(C,Fe)|0,R=R+Math.imul(C,je)|0,_=_+Math.imul(V,Ue)|0,d=d+Math.imul(V,We)|0,d=d+Math.imul(Q,Ue)|0,R=R+Math.imul(Q,We)|0,_=_+Math.imul(X,He)|0,d=d+Math.imul(X,Ve)|0,d=d+Math.imul(k,He)|0,R=R+Math.imul(k,Ve)|0;var Jr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(Jr>>>26)|0,Jr&=67108863,_=Math.imul(Ce,he),d=Math.imul(Ce,ce),d=d+Math.imul(b,he)|0,R=Math.imul(b,ce),_=_+Math.imul(Me,ue)|0,d=d+Math.imul(Me,Le)|0,d=d+Math.imul(Te,ue)|0,R=R+Math.imul(Te,Le)|0,_=_+Math.imul(Ae,Pe)|0,d=d+Math.imul(Ae,Be)|0,d=d+Math.imul(Ie,Pe)|0,R=R+Math.imul(Ie,Be)|0,_=_+Math.imul(ae,De)|0,d=d+Math.imul(ae,$e)|0,d=d+Math.imul(Se,De)|0,R=R+Math.imul(Se,$e)|0,_=_+Math.imul(J,Fe)|0,d=d+Math.imul(J,je)|0,d=d+Math.imul(fe,Fe)|0,R=R+Math.imul(fe,je)|0,_=_+Math.imul(M,Ue)|0,d=d+Math.imul(M,We)|0,d=d+Math.imul(C,Ue)|0,R=R+Math.imul(C,We)|0,_=_+Math.imul(V,He)|0,d=d+Math.imul(V,Ve)|0,d=d+Math.imul(Q,He)|0,R=R+Math.imul(Q,Ve)|0,_=_+Math.imul(X,ze)|0,d=d+Math.imul(X,qe)|0,d=d+Math.imul(k,ze)|0,R=R+Math.imul(k,qe)|0;var Zr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,_=Math.imul(h,he),d=Math.imul(h,ce),d=d+Math.imul(x,he)|0,R=Math.imul(x,ce),_=_+Math.imul(Ce,ue)|0,d=d+Math.imul(Ce,Le)|0,d=d+Math.imul(b,ue)|0,R=R+Math.imul(b,Le)|0,_=_+Math.imul(Me,Pe)|0,d=d+Math.imul(Me,Be)|0,d=d+Math.imul(Te,Pe)|0,R=R+Math.imul(Te,Be)|0,_=_+Math.imul(Ae,De)|0,d=d+Math.imul(Ae,$e)|0,d=d+Math.imul(Ie,De)|0,R=R+Math.imul(Ie,$e)|0,_=_+Math.imul(ae,Fe)|0,d=d+Math.imul(ae,je)|0,d=d+Math.imul(Se,Fe)|0,R=R+Math.imul(Se,je)|0,_=_+Math.imul(J,Ue)|0,d=d+Math.imul(J,We)|0,d=d+Math.imul(fe,Ue)|0,R=R+Math.imul(fe,We)|0,_=_+Math.imul(M,He)|0,d=d+Math.imul(M,Ve)|0,d=d+Math.imul(C,He)|0,R=R+Math.imul(C,Ve)|0,_=_+Math.imul(V,ze)|0,d=d+Math.imul(V,qe)|0,d=d+Math.imul(Q,ze)|0,R=R+Math.imul(Q,qe)|0,_=_+Math.imul(X,Ge)|0,d=d+Math.imul(X,Je)|0,d=d+Math.imul(k,Ge)|0,R=R+Math.imul(k,Je)|0;var Qr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,_=Math.imul($,he),d=Math.imul($,ce),d=d+Math.imul(W,he)|0,R=Math.imul(W,ce),_=_+Math.imul(h,ue)|0,d=d+Math.imul(h,Le)|0,d=d+Math.imul(x,ue)|0,R=R+Math.imul(x,Le)|0,_=_+Math.imul(Ce,Pe)|0,d=d+Math.imul(Ce,Be)|0,d=d+Math.imul(b,Pe)|0,R=R+Math.imul(b,Be)|0,_=_+Math.imul(Me,De)|0,d=d+Math.imul(Me,$e)|0,d=d+Math.imul(Te,De)|0,R=R+Math.imul(Te,$e)|0,_=_+Math.imul(Ae,Fe)|0,d=d+Math.imul(Ae,je)|0,d=d+Math.imul(Ie,Fe)|0,R=R+Math.imul(Ie,je)|0,_=_+Math.imul(ae,Ue)|0,d=d+Math.imul(ae,We)|0,d=d+Math.imul(Se,Ue)|0,R=R+Math.imul(Se,We)|0,_=_+Math.imul(J,He)|0,d=d+Math.imul(J,Ve)|0,d=d+Math.imul(fe,He)|0,R=R+Math.imul(fe,Ve)|0,_=_+Math.imul(M,ze)|0,d=d+Math.imul(M,qe)|0,d=d+Math.imul(C,ze)|0,R=R+Math.imul(C,qe)|0,_=_+Math.imul(V,Ge)|0,d=d+Math.imul(V,Je)|0,d=d+Math.imul(Q,Ge)|0,R=R+Math.imul(Q,Je)|0,_=_+Math.imul(X,Ze)|0,d=d+Math.imul(X,Qe)|0,d=d+Math.imul(k,Ze)|0,R=R+Math.imul(k,Qe)|0;var Yr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(Yr>>>26)|0,Yr&=67108863,_=Math.imul($,ue),d=Math.imul($,Le),d=d+Math.imul(W,ue)|0,R=Math.imul(W,Le),_=_+Math.imul(h,Pe)|0,d=d+Math.imul(h,Be)|0,d=d+Math.imul(x,Pe)|0,R=R+Math.imul(x,Be)|0,_=_+Math.imul(Ce,De)|0,d=d+Math.imul(Ce,$e)|0,d=d+Math.imul(b,De)|0,R=R+Math.imul(b,$e)|0,_=_+Math.imul(Me,Fe)|0,d=d+Math.imul(Me,je)|0,d=d+Math.imul(Te,Fe)|0,R=R+Math.imul(Te,je)|0,_=_+Math.imul(Ae,Ue)|0,d=d+Math.imul(Ae,We)|0,d=d+Math.imul(Ie,Ue)|0,R=R+Math.imul(Ie,We)|0,_=_+Math.imul(ae,He)|0,d=d+Math.imul(ae,Ve)|0,d=d+Math.imul(Se,He)|0,R=R+Math.imul(Se,Ve)|0,_=_+Math.imul(J,ze)|0,d=d+Math.imul(J,qe)|0,d=d+Math.imul(fe,ze)|0,R=R+Math.imul(fe,qe)|0,_=_+Math.imul(M,Ge)|0,d=d+Math.imul(M,Je)|0,d=d+Math.imul(C,Ge)|0,R=R+Math.imul(C,Je)|0,_=_+Math.imul(V,Ze)|0,d=d+Math.imul(V,Qe)|0,d=d+Math.imul(Q,Ze)|0,R=R+Math.imul(Q,Qe)|0;var Kr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(Kr>>>26)|0,Kr&=67108863,_=Math.imul($,Pe),d=Math.imul($,Be),d=d+Math.imul(W,Pe)|0,R=Math.imul(W,Be),_=_+Math.imul(h,De)|0,d=d+Math.imul(h,$e)|0,d=d+Math.imul(x,De)|0,R=R+Math.imul(x,$e)|0,_=_+Math.imul(Ce,Fe)|0,d=d+Math.imul(Ce,je)|0,d=d+Math.imul(b,Fe)|0,R=R+Math.imul(b,je)|0,_=_+Math.imul(Me,Ue)|0,d=d+Math.imul(Me,We)|0,d=d+Math.imul(Te,Ue)|0,R=R+Math.imul(Te,We)|0,_=_+Math.imul(Ae,He)|0,d=d+Math.imul(Ae,Ve)|0,d=d+Math.imul(Ie,He)|0,R=R+Math.imul(Ie,Ve)|0,_=_+Math.imul(ae,ze)|0,d=d+Math.imul(ae,qe)|0,d=d+Math.imul(Se,ze)|0,R=R+Math.imul(Se,qe)|0,_=_+Math.imul(J,Ge)|0,d=d+Math.imul(J,Je)|0,d=d+Math.imul(fe,Ge)|0,R=R+Math.imul(fe,Je)|0,_=_+Math.imul(M,Ze)|0,d=d+Math.imul(M,Qe)|0,d=d+Math.imul(C,Ze)|0,R=R+Math.imul(C,Qe)|0;var Xr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,_=Math.imul($,De),d=Math.imul($,$e),d=d+Math.imul(W,De)|0,R=Math.imul(W,$e),_=_+Math.imul(h,Fe)|0,d=d+Math.imul(h,je)|0,d=d+Math.imul(x,Fe)|0,R=R+Math.imul(x,je)|0,_=_+Math.imul(Ce,Ue)|0,d=d+Math.imul(Ce,We)|0,d=d+Math.imul(b,Ue)|0,R=R+Math.imul(b,We)|0,_=_+Math.imul(Me,He)|0,d=d+Math.imul(Me,Ve)|0,d=d+Math.imul(Te,He)|0,R=R+Math.imul(Te,Ve)|0,_=_+Math.imul(Ae,ze)|0,d=d+Math.imul(Ae,qe)|0,d=d+Math.imul(Ie,ze)|0,R=R+Math.imul(Ie,qe)|0,_=_+Math.imul(ae,Ge)|0,d=d+Math.imul(ae,Je)|0,d=d+Math.imul(Se,Ge)|0,R=R+Math.imul(Se,Je)|0,_=_+Math.imul(J,Ze)|0,d=d+Math.imul(J,Qe)|0,d=d+Math.imul(fe,Ze)|0,R=R+Math.imul(fe,Qe)|0;var en=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(en>>>26)|0,en&=67108863,_=Math.imul($,Fe),d=Math.imul($,je),d=d+Math.imul(W,Fe)|0,R=Math.imul(W,je),_=_+Math.imul(h,Ue)|0,d=d+Math.imul(h,We)|0,d=d+Math.imul(x,Ue)|0,R=R+Math.imul(x,We)|0,_=_+Math.imul(Ce,He)|0,d=d+Math.imul(Ce,Ve)|0,d=d+Math.imul(b,He)|0,R=R+Math.imul(b,Ve)|0,_=_+Math.imul(Me,ze)|0,d=d+Math.imul(Me,qe)|0,d=d+Math.imul(Te,ze)|0,R=R+Math.imul(Te,qe)|0,_=_+Math.imul(Ae,Ge)|0,d=d+Math.imul(Ae,Je)|0,d=d+Math.imul(Ie,Ge)|0,R=R+Math.imul(Ie,Je)|0,_=_+Math.imul(ae,Ze)|0,d=d+Math.imul(ae,Qe)|0,d=d+Math.imul(Se,Ze)|0,R=R+Math.imul(Se,Qe)|0;var tn=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(tn>>>26)|0,tn&=67108863,_=Math.imul($,Ue),d=Math.imul($,We),d=d+Math.imul(W,Ue)|0,R=Math.imul(W,We),_=_+Math.imul(h,He)|0,d=d+Math.imul(h,Ve)|0,d=d+Math.imul(x,He)|0,R=R+Math.imul(x,Ve)|0,_=_+Math.imul(Ce,ze)|0,d=d+Math.imul(Ce,qe)|0,d=d+Math.imul(b,ze)|0,R=R+Math.imul(b,qe)|0,_=_+Math.imul(Me,Ge)|0,d=d+Math.imul(Me,Je)|0,d=d+Math.imul(Te,Ge)|0,R=R+Math.imul(Te,Je)|0,_=_+Math.imul(Ae,Ze)|0,d=d+Math.imul(Ae,Qe)|0,d=d+Math.imul(Ie,Ze)|0,R=R+Math.imul(Ie,Qe)|0;var fa=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(fa>>>26)|0,fa&=67108863,_=Math.imul($,He),d=Math.imul($,Ve),d=d+Math.imul(W,He)|0,R=Math.imul(W,Ve),_=_+Math.imul(h,ze)|0,d=d+Math.imul(h,qe)|0,d=d+Math.imul(x,ze)|0,R=R+Math.imul(x,qe)|0,_=_+Math.imul(Ce,Ge)|0,d=d+Math.imul(Ce,Je)|0,d=d+Math.imul(b,Ge)|0,R=R+Math.imul(b,Je)|0,_=_+Math.imul(Me,Ze)|0,d=d+Math.imul(Me,Qe)|0,d=d+Math.imul(Te,Ze)|0,R=R+Math.imul(Te,Qe)|0;var ha=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(ha>>>26)|0,ha&=67108863,_=Math.imul($,ze),d=Math.imul($,qe),d=d+Math.imul(W,ze)|0,R=Math.imul(W,qe),_=_+Math.imul(h,Ge)|0,d=d+Math.imul(h,Je)|0,d=d+Math.imul(x,Ge)|0,R=R+Math.imul(x,Je)|0,_=_+Math.imul(Ce,Ze)|0,d=d+Math.imul(Ce,Qe)|0,d=d+Math.imul(b,Ze)|0,R=R+Math.imul(b,Qe)|0;var da=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(da>>>26)|0,da&=67108863,_=Math.imul($,Ge),d=Math.imul($,Je),d=d+Math.imul(W,Ge)|0,R=Math.imul(W,Je),_=_+Math.imul(h,Ze)|0,d=d+Math.imul(h,Qe)|0,d=d+Math.imul(x,Ze)|0,R=R+Math.imul(x,Qe)|0;var pa=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(pa>>>26)|0,pa&=67108863,_=Math.imul($,Ze),d=Math.imul($,Qe),d=d+Math.imul(W,Ze)|0,R=Math.imul(W,Qe);var ga=(L+_|0)+((d&8191)<<13)|0;return L=(R+(d>>>13)|0)+(ga>>>26)|0,ga&=67108863,T[0]=Wr,T[1]=Hr,T[2]=Vr,T[3]=zr,T[4]=qr,T[5]=Gr,T[6]=Jr,T[7]=Zr,T[8]=Qr,T[9]=Yr,T[10]=Kr,T[11]=Xr,T[12]=en,T[13]=tn,T[14]=fa,T[15]=ha,T[16]=da,T[17]=pa,T[18]=ga,L!==0&&(T[19]=L,m.length++),m};Math.imul||(N=I);function D(w,u,g){g.negative=u.negative^w.negative,g.length=w.length+u.length;for(var m=0,E=0,S=0;S>>26)|0,E+=T>>>26,T&=67108863}g.words[S]=L,m=T,T=E}return m!==0?g.words[S]=m:g.length--,g._strip()}function H(w,u,g){return D(w,u,g)}s.prototype.mulTo=function(u,g){var m,E=this.length+u.length;return this.length===10&&u.length===10?m=N(this,u,g):E<63?m=I(this,u,g):E<1024?m=D(this,u,g):m=H(this,u,g),m},s.prototype.mul=function(u){var g=new s(null);return g.words=new Array(this.length+u.length),this.mulTo(u,g)},s.prototype.mulf=function(u){var g=new s(null);return g.words=new Array(this.length+u.length),H(this,u,g)},s.prototype.imul=function(u){return this.clone().mulTo(u,this)},s.prototype.imuln=function(u){var g=u<0;g&&(u=-u),n(typeof u=="number"),n(u<67108864);for(var m=0,E=0;E>=26,m+=S/67108864|0,m+=T>>>26,this.words[E]=T&67108863}return m!==0&&(this.words[E]=m,this.length++),g?this.ineg():this},s.prototype.muln=function(u){return this.clone().imuln(u)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(u){var g=F(u);if(g.length===0)return new s(1);for(var m=this,E=0;E=0);var g=u%26,m=(u-g)/26,E=67108863>>>26-g<<26-g,S;if(g!==0){var T=0;for(S=0;S>>26-g}T&&(this.words[S]=T,this.length++)}if(m!==0){for(S=this.length-1;S>=0;S--)this.words[S+m]=this.words[S];for(S=0;S=0);var E;g?E=(g-g%26)/26:E=0;var S=u%26,T=Math.min((u-S)/26,this.length),L=67108863^67108863>>>S<T)for(this.length-=T,d=0;d=0&&(R!==0||d>=E);d--){var Y=this.words[d]|0;this.words[d]=R<<26-S|Y>>>S,R=Y&L}return _&&R!==0&&(_.words[_.length++]=R),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(u,g,m){return n(this.negative===0),this.iushrn(u,g,m)},s.prototype.shln=function(u){return this.clone().ishln(u)},s.prototype.ushln=function(u){return this.clone().iushln(u)},s.prototype.shrn=function(u){return this.clone().ishrn(u)},s.prototype.ushrn=function(u){return this.clone().iushrn(u)},s.prototype.testn=function(u){n(typeof u=="number"&&u>=0);var g=u%26,m=(u-g)/26,E=1<=0);var g=u%26,m=(u-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=m)return this;if(g!==0&&m++,this.length=Math.min(m,this.length),g!==0){var E=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},s.prototype.isubn=function(u){if(n(typeof u=="number"),n(u<67108864),u<0)return this.iaddn(-u);if(this.negative!==0)return this.negative=0,this.iaddn(u),this.negative=1,this;if(this.words[0]-=u,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(_/67108864|0),this.words[S+m]=T&67108863}for(;S>26,this.words[S+m]=T&67108863;if(L===0)return this._strip();for(n(L===-1),L=0,S=0;S>26,this.words[S]=T&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(u,g){var m=this.length-u.length,E=this.clone(),S=u,T=S.words[S.length-1]|0,L=this._countBits(T);m=26-L,m!==0&&(S=S.ushln(m),E.iushln(m),T=S.words[S.length-1]|0);var _=E.length-S.length,d;if(g!=="mod"){d=new s(null),d.length=_+1,d.words=new Array(d.length);for(var R=0;R=0;X--){var k=(E.words[S.length+X]|0)*67108864+(E.words[S.length+X-1]|0);for(k=Math.min(k/T|0,67108863),E._ishlnsubmul(S,k,X);E.negative!==0;)k--,E.negative=0,E._ishlnsubmul(S,1,X),E.isZero()||(E.negative^=1);d&&(d.words[X]=k)}return d&&d._strip(),E._strip(),g!=="div"&&m!==0&&E.iushrn(m),{div:d||null,mod:E}},s.prototype.divmod=function(u,g,m){if(n(!u.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var E,S,T;return this.negative!==0&&u.negative===0?(T=this.neg().divmod(u,g),g!=="mod"&&(E=T.div.neg()),g!=="div"&&(S=T.mod.neg(),m&&S.negative!==0&&S.iadd(u)),{div:E,mod:S}):this.negative===0&&u.negative!==0?(T=this.divmod(u.neg(),g),g!=="mod"&&(E=T.div.neg()),{div:E,mod:T.mod}):this.negative&u.negative?(T=this.neg().divmod(u.neg(),g),g!=="div"&&(S=T.mod.neg(),m&&S.negative!==0&&S.isub(u)),{div:T.div,mod:S}):u.length>this.length||this.cmp(u)<0?{div:new s(0),mod:this}:u.length===1?g==="div"?{div:this.divn(u.words[0]),mod:null}:g==="mod"?{div:null,mod:new s(this.modrn(u.words[0]))}:{div:this.divn(u.words[0]),mod:new s(this.modrn(u.words[0]))}:this._wordDiv(u,g)},s.prototype.div=function(u){return this.divmod(u,"div",!1).div},s.prototype.mod=function(u){return this.divmod(u,"mod",!1).mod},s.prototype.umod=function(u){return this.divmod(u,"mod",!0).mod},s.prototype.divRound=function(u){var g=this.divmod(u);if(g.mod.isZero())return g.div;var m=g.div.negative!==0?g.mod.isub(u):g.mod,E=u.ushrn(1),S=u.andln(1),T=m.cmp(E);return T<0||S===1&&T===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},s.prototype.modrn=function(u){var g=u<0;g&&(u=-u),n(u<=67108863);for(var m=(1<<26)%u,E=0,S=this.length-1;S>=0;S--)E=(m*E+(this.words[S]|0))%u;return g?-E:E},s.prototype.modn=function(u){return this.modrn(u)},s.prototype.idivn=function(u){var g=u<0;g&&(u=-u),n(u<=67108863);for(var m=0,E=this.length-1;E>=0;E--){var S=(this.words[E]|0)+m*67108864;this.words[E]=S/u|0,m=S%u}return this._strip(),g?this.ineg():this},s.prototype.divn=function(u){return this.clone().idivn(u)},s.prototype.egcd=function(u){n(u.negative===0),n(!u.isZero());var g=this,m=u.clone();g.negative!==0?g=g.umod(u):g=g.clone();for(var E=new s(1),S=new s(0),T=new s(0),L=new s(1),_=0;g.isEven()&&m.isEven();)g.iushrn(1),m.iushrn(1),++_;for(var d=m.clone(),R=g.clone();!g.isZero();){for(var Y=0,X=1;!(g.words[0]&X)&&Y<26;++Y,X<<=1);if(Y>0)for(g.iushrn(Y);Y-- >0;)(E.isOdd()||S.isOdd())&&(E.iadd(d),S.isub(R)),E.iushrn(1),S.iushrn(1);for(var k=0,B=1;!(m.words[0]&B)&&k<26;++k,B<<=1);if(k>0)for(m.iushrn(k);k-- >0;)(T.isOdd()||L.isOdd())&&(T.iadd(d),L.isub(R)),T.iushrn(1),L.iushrn(1);g.cmp(m)>=0?(g.isub(m),E.isub(T),S.isub(L)):(m.isub(g),T.isub(E),L.isub(S))}return{a:T,b:L,gcd:m.iushln(_)}},s.prototype._invmp=function(u){n(u.negative===0),n(!u.isZero());var g=this,m=u.clone();g.negative!==0?g=g.umod(u):g=g.clone();for(var E=new s(1),S=new s(0),T=m.clone();g.cmpn(1)>0&&m.cmpn(1)>0;){for(var L=0,_=1;!(g.words[0]&_)&&L<26;++L,_<<=1);if(L>0)for(g.iushrn(L);L-- >0;)E.isOdd()&&E.iadd(T),E.iushrn(1);for(var d=0,R=1;!(m.words[0]&R)&&d<26;++d,R<<=1);if(d>0)for(m.iushrn(d);d-- >0;)S.isOdd()&&S.iadd(T),S.iushrn(1);g.cmp(m)>=0?(g.isub(m),E.isub(S)):(m.isub(g),S.isub(E))}var Y;return g.cmpn(1)===0?Y=E:Y=S,Y.cmpn(0)<0&&Y.iadd(u),Y},s.prototype.gcd=function(u){if(this.isZero())return u.abs();if(u.isZero())return this.abs();var g=this.clone(),m=u.clone();g.negative=0,m.negative=0;for(var E=0;g.isEven()&&m.isEven();E++)g.iushrn(1),m.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;m.isEven();)m.iushrn(1);var S=g.cmp(m);if(S<0){var T=g;g=m,m=T}else if(S===0||m.cmpn(1)===0)break;g.isub(m)}while(!0);return m.iushln(E)},s.prototype.invm=function(u){return this.egcd(u).a.umod(u)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(u){return this.words[0]&u},s.prototype.bincn=function(u){n(typeof u=="number");var g=u%26,m=(u-g)/26,E=1<>>26,L&=67108863,this.words[T]=L}return S!==0&&(this.words[T]=S,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(u){var g=u<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var m;if(this.length>1)m=1;else{g&&(u=-u),n(u<=67108863,"Number is too big");var E=this.words[0]|0;m=E===u?0:Eu.length)return 1;if(this.length=0;m--){var E=this.words[m]|0,S=u.words[m]|0;if(E!==S){ES&&(g=1);break}}return g},s.prototype.gtn=function(u){return this.cmpn(u)===1},s.prototype.gt=function(u){return this.cmp(u)===1},s.prototype.gten=function(u){return this.cmpn(u)>=0},s.prototype.gte=function(u){return this.cmp(u)>=0},s.prototype.ltn=function(u){return this.cmpn(u)===-1},s.prototype.lt=function(u){return this.cmp(u)===-1},s.prototype.lten=function(u){return this.cmpn(u)<=0},s.prototype.lte=function(u){return this.cmp(u)<=0},s.prototype.eqn=function(u){return this.cmpn(u)===0},s.prototype.eq=function(u){return this.cmp(u)===0},s.red=function(u){return new ne(u)},s.prototype.toRed=function(u){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),u.convertTo(this)._forceRed(u)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(u){return this.red=u,this},s.prototype.forceRed=function(u){return n(!this.red,"Already a number in reduction context"),this._forceRed(u)},s.prototype.redAdd=function(u){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,u)},s.prototype.redIAdd=function(u){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,u)},s.prototype.redSub=function(u){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,u)},s.prototype.redISub=function(u){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,u)},s.prototype.redShl=function(u){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,u)},s.prototype.redMul=function(u){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.mul(this,u)},s.prototype.redIMul=function(u){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.imul(this,u)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(u){return n(this.red&&!u.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,u)};var U={k256:null,p224:null,p192:null,p25519:null};function z(w,u){this.name=w,this.p=new s(u,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}z.prototype._tmp=function(){var u=new s(null);return u.words=new Array(Math.ceil(this.n/13)),u},z.prototype.ireduce=function(u){var g=u,m;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),m=g.bitLength();while(m>this.n);var E=m0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},z.prototype.split=function(u,g){u.iushrn(this.n,0,g)},z.prototype.imulK=function(u){return u.imul(this.k)};function ee(){z.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(ee,z),ee.prototype.split=function(u,g){for(var m=4194303,E=Math.min(u.length,9),S=0;S>>22,T=L}T>>>=22,u.words[S-10]=T,T===0&&u.length>10?u.length-=10:u.length-=9},ee.prototype.imulK=function(u){u.words[u.length]=0,u.words[u.length+1]=0,u.length+=2;for(var g=0,m=0;m>>=26,u.words[m]=S,g=E}return g!==0&&(u.words[u.length++]=g),u},s._prime=function(u){if(U[u])return U[u];var g;if(u==="k256")g=new ee;else if(u==="p224")g=new K;else if(u==="p192")g=new Z;else if(u==="p25519")g=new se;else throw new Error("Unknown prime "+u);return U[u]=g,g};function ne(w){if(typeof w=="string"){var u=s._prime(w);this.m=u.p,this.prime=u}else n(w.gtn(1),"modulus must be greater than 1"),this.m=w,this.prime=null}ne.prototype._verify1=function(u){n(u.negative===0,"red works only with positives"),n(u.red,"red works only with red numbers")},ne.prototype._verify2=function(u,g){n((u.negative|g.negative)===0,"red works only with positives"),n(u.red&&u.red===g.red,"red works only with red numbers")},ne.prototype.imod=function(u){return this.prime?this.prime.ireduce(u)._forceRed(this):(p(u,u.umod(this.m)._forceRed(this)),u)},ne.prototype.neg=function(u){return u.isZero()?u.clone():this.m.sub(u)._forceRed(this)},ne.prototype.add=function(u,g){this._verify2(u,g);var m=u.add(g);return m.cmp(this.m)>=0&&m.isub(this.m),m._forceRed(this)},ne.prototype.iadd=function(u,g){this._verify2(u,g);var m=u.iadd(g);return m.cmp(this.m)>=0&&m.isub(this.m),m},ne.prototype.sub=function(u,g){this._verify2(u,g);var m=u.sub(g);return m.cmpn(0)<0&&m.iadd(this.m),m._forceRed(this)},ne.prototype.isub=function(u,g){this._verify2(u,g);var m=u.isub(g);return m.cmpn(0)<0&&m.iadd(this.m),m},ne.prototype.shl=function(u,g){return this._verify1(u),this.imod(u.ushln(g))},ne.prototype.imul=function(u,g){return this._verify2(u,g),this.imod(u.imul(g))},ne.prototype.mul=function(u,g){return this._verify2(u,g),this.imod(u.mul(g))},ne.prototype.isqr=function(u){return this.imul(u,u.clone())},ne.prototype.sqr=function(u){return this.mul(u,u)},ne.prototype.sqrt=function(u){if(u.isZero())return u.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var m=this.m.add(new s(1)).iushrn(2);return this.pow(u,m)}for(var E=this.m.subn(1),S=0;!E.isZero()&&E.andln(1)===0;)S++,E.iushrn(1);n(!E.isZero());var T=new s(1).toRed(this),L=T.redNeg(),_=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new s(2*d*d).toRed(this);this.pow(d,_).cmp(L)!==0;)d.redIAdd(L);for(var R=this.pow(d,E),Y=this.pow(u,E.addn(1).iushrn(1)),X=this.pow(u,E),k=S;X.cmp(T)!==0;){for(var B=X,V=0;B.cmp(T)!==0;V++)B=B.redSqr();n(V=0;S--){for(var R=g.words[S],Y=d-1;Y>=0;Y--){var X=R>>Y&1;if(T!==E[0]&&(T=this.sqr(T)),X===0&&L===0){_=0;continue}L<<=1,L|=X,_++,!(_!==m&&(S!==0||Y!==0))&&(T=this.mul(T,E[L]),_=0,L=0)}d=26}return T},ne.prototype.convertTo=function(u){var g=u.umod(this.m);return g===u?g.clone():g},ne.prototype.convertFrom=function(u){var g=u.clone();return g.red=null,g},s.mont=function(u){return new oe(u)};function oe(w){ne.call(this,w),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(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)}i(oe,ne),oe.prototype.convertTo=function(u){return this.imod(u.ushln(this.shift))},oe.prototype.convertFrom=function(u){var g=this.imod(u.mul(this.rinv));return g.red=null,g},oe.prototype.imul=function(u,g){if(u.isZero()||g.isZero())return u.words[0]=0,u.length=1,u;var m=u.imul(g),E=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=m.isub(E).iushrn(this.shift),T=S;return S.cmp(this.m)>=0?T=S.isub(this.m):S.cmpn(0)<0&&(T=S.iadd(this.m)),T._forceRed(this)},oe.prototype.mul=function(u,g){if(u.isZero()||g.isZero())return new s(0)._forceRed(this);var m=u.mul(g),E=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=m.isub(E).iushrn(this.shift),T=S;return S.cmp(this.m)>=0?T=S.isub(this.m):S.cmpn(0)<0&&(T=S.iadd(this.m)),T._forceRed(this)},oe.prototype.invm=function(u){var g=this.imod(u._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(t,te)})(Lu);var ao=Lu.exports,yi={};Object.defineProperty(yi,"__esModule",{value:!0});yi.EVENTS=void 0;yi.EVENTS={STARTED_CONNECTING:"walletlink_sdk.started.connecting",CONNECTED_STATE_CHANGE:"walletlink_sdk.connected",DISCONNECTED:"walletlink_sdk.disconnected",METADATA_DESTROYED:"walletlink_sdk_metadata_destroyed",LINKED:"walletlink_sdk.linked",FAILURE:"walletlink_sdk.generic_failure",SESSION_CONFIG_RECEIVED:"walletlink_sdk.session_config_event_received",ETH_ACCOUNTS_STATE:"walletlink_sdk.eth_accounts_state",SESSION_STATE_CHANGE:"walletlink_sdk.session_state_change",UNLINKED_ERROR_STATE:"walletlink_sdk.unlinked_error_state",SKIPPED_CLEARING_SESSION:"walletlink_sdk.skipped_clearing_session",GENERAL_ERROR:"walletlink_sdk.general_error",WEB3_REQUEST:"walletlink_sdk.web3.request",WEB3_REQUEST_PUBLISHED:"walletlink_sdk.web3.request_published",WEB3_RESPONSE:"walletlink_sdk.web3.response",UNKNOWN_ADDRESS_ENCOUNTERED:"walletlink_sdk.unknown_address_encountered"};var Yi={},uh={},Nr={},ch=zi;zi.default=zi;zi.stable=hh;zi.stableStringify=hh;var Ws="[...]",lh="[Circular]",gn=[],ln=[];function fh(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function zi(t,e,r,n){typeof n>"u"&&(n=fh()),ou(t,"",0,[],void 0,0,n);var i;try{ln.length===0?i=JSON.stringify(t,e,r):i=JSON.stringify(t,dh(e),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;gn.length!==0;){var s=gn.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return i}function Zn(t,e,r,n){var i=Object.getOwnPropertyDescriptor(n,r);i.get!==void 0?i.configurable?(Object.defineProperty(n,r,{value:t}),gn.push([n,r,e,i])):ln.push([e,r,t]):(n[r]=t,gn.push([n,r,e]))}function ou(t,e,r,n,i,s,o){s+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;ao.depthLimit){Zn(Ws,t,e,i);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){Zn(Ws,t,e,i);return}if(n.push(t),Array.isArray(t))for(a=0;ae?1:0}function hh(t,e,r,n){typeof n>"u"&&(n=fh());var i=au(t,"",0,[],void 0,0,n)||t,s;try{ln.length===0?s=JSON.stringify(i,e,r):s=JSON.stringify(i,dh(e),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;gn.length!==0;){var o=gn.pop();o.length===4?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return s}function au(t,e,r,n,i,s,o){s+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;ao.depthLimit){Zn(Ws,t,e,i);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){Zn(Ws,t,e,i);return}if(n.push(t),Array.isArray(t))for(a=0;a0)for(var n=0;n=1e3&&t<=4999}function Z0(t,e){if(e!=="[Circular]")return e}var Pu={},Lr={};Object.defineProperty(Lr,"__esModule",{value:!0});Lr.errorValues=Lr.errorCodes=void 0;Lr.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}};Lr.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.serializeError=t.isValidCode=t.getMessageFromCode=t.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=Lr,r=Nr,n=e.errorCodes.rpc.internal,i="Unspecified error message. This is a bug, please report it.",s={code:n,message:o(n)};t.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function o(v,A=i){if(Number.isInteger(v)){const O=v.toString();if(y(e.errorValues,O))return e.errorValues[O].message;if(l(v))return t.JSON_RPC_SERVER_ERROR_MESSAGE}return A}t.getMessageFromCode=o;function a(v){if(!Number.isInteger(v))return!1;const A=v.toString();return!!(e.errorValues[A]||l(v))}t.isValidCode=a;function c(v,{fallbackError:A=s,shouldIncludeStack:O=!1}={}){var j,F;if(!A||!Number.isInteger(A.code)||typeof A.message!="string")throw new Error("Must provide fallback error with integer number code and string message.");if(v instanceof r.EthereumRpcError)return v.serialize();const I={};if(v&&typeof v=="object"&&!Array.isArray(v)&&y(v,"code")&&a(v.code)){const D=v;I.code=D.code,D.message&&typeof D.message=="string"?(I.message=D.message,y(D,"data")&&(I.data=D.data)):(I.message=o(I.code),I.data={originalError:p(v)})}else{I.code=A.code;const D=(j=v)===null||j===void 0?void 0:j.message;I.message=D&&typeof D=="string"?D:A.message,I.data={originalError:p(v)}}const N=(F=v)===null||F===void 0?void 0:F.stack;return O&&v&&N&&typeof N=="string"&&(I.stack=N),I}t.serializeError=c;function l(v){return v>=-32099&&v<=-32e3}function p(v){return v&&typeof v=="object"&&!Array.isArray(v)?Object.assign({},v):v}function y(v,A){return Object.prototype.hasOwnProperty.call(v,A)}})(Pu);var uo={};Object.defineProperty(uo,"__esModule",{value:!0});uo.ethErrors=void 0;const Bu=Nr,gh=Pu,mt=Lr;uo.ethErrors={rpc:{parse:t=>Bt(mt.errorCodes.rpc.parse,t),invalidRequest:t=>Bt(mt.errorCodes.rpc.invalidRequest,t),invalidParams:t=>Bt(mt.errorCodes.rpc.invalidParams,t),methodNotFound:t=>Bt(mt.errorCodes.rpc.methodNotFound,t),internal:t=>Bt(mt.errorCodes.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return Bt(e,t)},invalidInput:t=>Bt(mt.errorCodes.rpc.invalidInput,t),resourceNotFound:t=>Bt(mt.errorCodes.rpc.resourceNotFound,t),resourceUnavailable:t=>Bt(mt.errorCodes.rpc.resourceUnavailable,t),transactionRejected:t=>Bt(mt.errorCodes.rpc.transactionRejected,t),methodNotSupported:t=>Bt(mt.errorCodes.rpc.methodNotSupported,t),limitExceeded:t=>Bt(mt.errorCodes.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Ai(mt.errorCodes.provider.userRejectedRequest,t),unauthorized:t=>Ai(mt.errorCodes.provider.unauthorized,t),unsupportedMethod:t=>Ai(mt.errorCodes.provider.unsupportedMethod,t),disconnected:t=>Ai(mt.errorCodes.provider.disconnected,t),chainDisconnected:t=>Ai(mt.errorCodes.provider.chainDisconnected,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new Bu.EthereumProviderError(e,r,n)}}};function Bt(t,e){const[r,n]=yh(e);return new Bu.EthereumRpcError(t,r||gh.getMessageFromCode(t),n)}function Ai(t,e){const[r,n]=yh(e);return new Bu.EthereumProviderError(t,r||gh.getMessageFromCode(t),n)}function yh(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getMessageFromCode=t.serializeError=t.EthereumProviderError=t.EthereumRpcError=t.ethErrors=t.errorCodes=void 0;const e=Nr;Object.defineProperty(t,"EthereumRpcError",{enumerable:!0,get:function(){return e.EthereumRpcError}}),Object.defineProperty(t,"EthereumProviderError",{enumerable:!0,get:function(){return e.EthereumProviderError}});const r=Pu;Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return r.serializeError}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return r.getMessageFromCode}});const n=uo;Object.defineProperty(t,"ethErrors",{enumerable:!0,get:function(){return n.ethErrors}});const i=Lr;Object.defineProperty(t,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})})(uh);var Ne={},co={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Web3Method=void 0,function(e){e.requestEthereumAccounts="requestEthereumAccounts",e.signEthereumMessage="signEthereumMessage",e.signEthereumTransaction="signEthereumTransaction",e.submitEthereumTransaction="submitEthereumTransaction",e.ethereumAddressFromSignedMessage="ethereumAddressFromSignedMessage",e.scanQRCode="scanQRCode",e.generic="generic",e.childRequestEthereumAccounts="childRequestEthereumAccounts",e.addEthereumChain="addEthereumChain",e.switchEthereumChain="switchEthereumChain",e.makeEthereumJSONRPCRequest="makeEthereumJSONRPCRequest",e.watchAsset="watchAsset",e.selectProvider="selectProvider"}(t.Web3Method||(t.Web3Method={}))})(co);Object.defineProperty(Ne,"__esModule",{value:!0});Ne.EthereumAddressFromSignedMessageResponse=Ne.SubmitEthereumTransactionResponse=Ne.SignEthereumTransactionResponse=Ne.SignEthereumMessageResponse=Ne.isRequestEthereumAccountsResponse=Ne.SelectProviderResponse=Ne.WatchAssetReponse=Ne.RequestEthereumAccountsResponse=Ne.SwitchEthereumChainResponse=Ne.AddEthereumChainResponse=Ne.isErrorResponse=void 0;const yr=co;function Q0(t){var e,r;return((e=t)===null||e===void 0?void 0:e.method)!==void 0&&((r=t)===null||r===void 0?void 0:r.errorMessage)!==void 0}Ne.isErrorResponse=Q0;function Y0(t){return{method:yr.Web3Method.addEthereumChain,result:t}}Ne.AddEthereumChainResponse=Y0;function K0(t){return{method:yr.Web3Method.switchEthereumChain,result:t}}Ne.SwitchEthereumChainResponse=K0;function X0(t){return{method:yr.Web3Method.requestEthereumAccounts,result:t}}Ne.RequestEthereumAccountsResponse=X0;function eg(t){return{method:yr.Web3Method.watchAsset,result:t}}Ne.WatchAssetReponse=eg;function tg(t){return{method:yr.Web3Method.selectProvider,result:t}}Ne.SelectProviderResponse=tg;function rg(t){return t&&t.method===yr.Web3Method.requestEthereumAccounts}Ne.isRequestEthereumAccountsResponse=rg;function ng(t){return{method:yr.Web3Method.signEthereumMessage,result:t}}Ne.SignEthereumMessageResponse=ng;function ig(t){return{method:yr.Web3Method.signEthereumTransaction,result:t}}Ne.SignEthereumTransactionResponse=ig;function sg(t){return{method:yr.Web3Method.submitEthereumTransaction,result:t}}Ne.SubmitEthereumTransactionResponse=sg;function og(t){return{method:yr.Web3Method.ethereumAddressFromSignedMessage,result:t}}Ne.EthereumAddressFromSignedMessageResponse=og;var bi={};Object.defineProperty(bi,"__esModule",{value:!0});bi.LIB_VERSION=void 0;bi.LIB_VERSION="3.7.2";(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorCode=t.serializeError=t.standardErrors=t.standardErrorMessage=t.standardErrorCodes=void 0;const e=uh,r=Ne,n=bi;t.standardErrorCodes=Object.freeze(Object.assign(Object.assign({},e.errorCodes),{provider:Object.freeze(Object.assign(Object.assign({},e.errorCodes.provider),{unsupportedChain:4902}))}));function i(p){return p!==void 0?(0,e.getMessageFromCode)(p):"Unknown error"}t.standardErrorMessage=i,t.standardErrors=Object.freeze(Object.assign(Object.assign({},e.ethErrors),{provider:Object.freeze(Object.assign(Object.assign({},e.ethErrors.provider),{unsupportedChain:(p="")=>e.ethErrors.provider.custom({code:t.standardErrorCodes.provider.unsupportedChain,message:`Unrecognized chain ID ${p}. Try adding the chain using wallet_addEthereumChain first.`})}))}));function s(p,y){const v=(0,e.serializeError)(o(p),{shouldIncludeStack:!0}),A=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");A.searchParams.set("version",n.LIB_VERSION),A.searchParams.set("code",v.code.toString());const O=a(v.data,y);return O&&A.searchParams.set("method",O),A.searchParams.set("message",v.message),Object.assign(Object.assign({},v),{docUrl:A.href})}t.serializeError=s;function o(p){return typeof p=="string"?{message:p,code:t.standardErrorCodes.rpc.internal}:(0,r.isErrorResponse)(p)?Object.assign(Object.assign({},p),{message:p.errorMessage,code:p.errorCode,data:{method:p.method,result:p.result}}):p}function a(p,y){var v;const A=(v=p)===null||v===void 0?void 0:v.method;if(A)return A;if(y!==void 0)return typeof y=="string"?y:Array.isArray(y)?y.length>0?y[0].method:void 0:y.method}function c(p){var y;if(typeof p=="number")return p;if(l(p))return(y=p.code)!==null&&y!==void 0?y:p.errorCode}t.getErrorCode=c;function l(p){return typeof p=="object"&&p!==null&&(typeof p.code=="number"||typeof p.errorCode=="number")}})(Yi);var vi={},bh={exports:{}},uu={exports:{}};typeof Object.create=="function"?uu.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:uu.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var er=uu.exports,cu={exports:{}},Ki={},lo={};lo.byteLength=cg;lo.toByteArray=fg;lo.fromByteArray=pg;var lr=[],jt=[],ag=typeof Uint8Array<"u"?Uint8Array:Array,ya="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Dn=0,ug=ya.length;Dn0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function cg(t){var e=vh(t),r=e[0],n=e[1];return(r+n)*3/4-n}function lg(t,e,r){return(e+r)*3/4-r}function fg(t){var e,r=vh(t),n=r[0],i=r[1],s=new ag(lg(t,n,i)),o=0,a=i>0?n-4:n,c;for(c=0;c>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=jt[t.charCodeAt(c)]<<2|jt[t.charCodeAt(c+1)]>>4,s[o++]=e&255),i===1&&(e=jt[t.charCodeAt(c)]<<10|jt[t.charCodeAt(c+1)]<<4|jt[t.charCodeAt(c+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function hg(t){return lr[t>>18&63]+lr[t>>12&63]+lr[t>>6&63]+lr[t&63]}function dg(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(lr[e>>2]+lr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(lr[e>>10]+lr[e>>4&63]+lr[e<<2&63]+"=")),i.join("")}var Du={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */Du.read=function(t,e,r,n,i){var s,o,a=i*8-n-1,c=(1<>1,p=-7,y=r?i-1:0,v=r?-1:1,A=t[e+y];for(y+=v,s=A&(1<<-p)-1,A>>=-p,p+=a;p>0;s=s*256+t[e+y],y+=v,p-=8);for(o=s&(1<<-p)-1,s>>=-p,p+=n;p>0;o=o*256+t[e+y],y+=v,p-=8);if(s===0)s=1-l;else{if(s===c)return o?NaN:(A?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-l}return(A?-1:1)*o*Math.pow(2,s-n)};Du.write=function(t,e,r,n,i,s){var o,a,c,l=s*8-i-1,p=(1<>1,v=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=n?0:s-1,O=n?1:-1,j=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=p):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+y>=1?e+=v/c:e+=v*Math.pow(2,1-y),e*c>=2&&(o++,c/=2),o+y>=p?(a=0,o=p):o+y>=1?(a=(e*c-1)*Math.pow(2,i),o=o+y):(a=e*Math.pow(2,y-1)*Math.pow(2,i),o=0));i>=8;t[r+A]=a&255,A+=O,a/=256,i-=8);for(o=o<0;t[r+A]=o&255,A+=O,o/=256,l-=8);t[r+A-O]|=j*128};/*! +import{h as ku,aA as no,o as te,e as wn,aB as G,p as B0}from"./index-iGWvbPrT.js";import{p as D0,h as $0}from"./hooks.module-o1hAt1ko.js";function F0(t,e){for(var r=0;rn[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var Nu={},Vi={},io={};Object.defineProperty(io,"__esModule",{value:!0});io.walletLogo=void 0;const j0=(t,e)=>{let r;switch(t){case"standard":return r=e,`data:image/svg+xml,%3Csvg width='${e}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return r=e,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${r}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return r=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return r=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return r=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return r=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return r=e,`data:image/svg+xml,%3Csvg width='${e}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};io.walletLogo=j0;var so={};Object.defineProperty(so,"__esModule",{value:!0});so.LINK_API_URL=void 0;so.LINK_API_URL="https://www.walletlink.org";var oo={};Object.defineProperty(oo,"__esModule",{value:!0});oo.ScopedLocalStorage=void 0;class U0{constructor(e){this.scope=e}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`${this.scope}:${e}`}}oo.ScopedLocalStorage=U0;var ti={},_n={};Object.defineProperty(_n,"__esModule",{value:!0});const W0=ku;function zc(t,e,r){try{Reflect.apply(t,e,r)}catch(n){setTimeout(()=>{throw n})}}function H0(t){const e=t.length,r=new Array(e);for(let n=0;n0&&([o]=r),o instanceof Error)throw o;const a=new Error(`Unhandled error.${o?` (${o.message})`:""}`);throw a.context=o,a}const s=i[e];if(s===void 0)return!1;if(typeof s=="function")zc(s,this,r);else{const o=s.length,a=H0(s);for(let c=0;c0?u:g},s.min=function(u,g){return u.cmp(g)<0?u:g},s.prototype._init=function(u,g,m){if(typeof u=="number")return this._initNumber(u,g,m);if(typeof u=="object")return this._initArray(u,g,m);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),u=u.toString().replace(/\s+/g,"");var E=0;u[0]==="-"&&(E++,this.negative=1),E=0;E-=3)T=u[E]|u[E-1]<<8|u[E-2]<<16,this.words[S]|=T<>>26-L&67108863,L+=24,L>=26&&(L-=26,S++);else if(m==="le")for(E=0,S=0;E>>26-L&67108863,L+=24,L>=26&&(L-=26,S++);return this._strip()};function a(w,u){var g=w.charCodeAt(u);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;n(!1,"Invalid character in "+w)}function c(w,u,g){var m=a(w,g);return g-1>=u&&(m|=a(w,g-1)<<4),m}s.prototype._parseHex=function(u,g,m){this.length=Math.ceil((u.length-g)/6),this.words=new Array(this.length);for(var E=0;E=g;E-=2)L=c(u,g,E)<=18?(S-=18,T+=1,this.words[T]|=L>>>26):S+=8;else{var _=u.length-g;for(E=_%2===0?g+1:g;E=18?(S-=18,T+=1,this.words[T]|=L>>>26):S+=8}this._strip()};function l(w,u,g,m){for(var E=0,S=0,T=Math.min(w.length,g),L=u;L=49?S=_-49+10:_>=17?S=_-17+10:S=_,n(_>=0&&S1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=y}catch{s.prototype.inspect=y}else s.prototype.inspect=y;function y(){return(this.red?""}var v=["","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"],A=[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],O=[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];s.prototype.toString=function(u,g){u=u||10,g=g|0||1;var m;if(u===16||u==="hex"){m="";for(var E=0,S=0,T=0;T>>24-E&16777215,E+=2,E>=26&&(E-=26,T--),S!==0||T!==this.length-1?m=v[6-_.length]+_+m:m=_+m}for(S!==0&&(m=S.toString(16)+m);m.length%g!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}if(u===(u|0)&&u>=2&&u<=36){var d=A[u],R=O[u];m="";var Y=this.clone();for(Y.negative=0;!Y.isZero();){var X=Y.modrn(R).toString(u);Y=Y.idivn(R),Y.isZero()?m=X+m:m=v[d-X.length]+X+m}for(this.isZero()&&(m="0"+m);m.length%g!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var u=this.words[0];return this.length===2?u+=this.words[1]*67108864:this.length===3&&this.words[2]===1?u+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-u:u},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(u,g){return this.toArrayLike(o,u,g)}),s.prototype.toArray=function(u,g){return this.toArrayLike(Array,u,g)};var j=function(u,g){return u.allocUnsafe?u.allocUnsafe(g):new u(g)};s.prototype.toArrayLike=function(u,g,m){this._strip();var E=this.byteLength(),S=m||Math.max(1,E);n(E<=S,"byte array longer than desired length"),n(S>0,"Requested array length <= 0");var T=j(u,S),L=g==="le"?"LE":"BE";return this["_toArrayLike"+L](T,E),T},s.prototype._toArrayLikeLE=function(u,g){for(var m=0,E=0,S=0,T=0;S>8&255),m>16&255),T===6?(m>24&255),E=0,T=0):(E=L>>>24,T+=2)}if(m=0&&(u[m--]=L>>8&255),m>=0&&(u[m--]=L>>16&255),T===6?(m>=0&&(u[m--]=L>>24&255),E=0,T=0):(E=L>>>24,T+=2)}if(m>=0)for(u[m--]=E;m>=0;)u[m--]=0},Math.clz32?s.prototype._countBits=function(u){return 32-Math.clz32(u)}:s.prototype._countBits=function(u){var g=u,m=0;return g>=4096&&(m+=13,g>>>=13),g>=64&&(m+=7,g>>>=7),g>=8&&(m+=4,g>>>=4),g>=2&&(m+=2,g>>>=2),m+g},s.prototype._zeroBits=function(u){if(u===0)return 26;var g=u,m=0;return g&8191||(m+=13,g>>>=13),g&127||(m+=7,g>>>=7),g&15||(m+=4,g>>>=4),g&3||(m+=2,g>>>=2),g&1||m++,m},s.prototype.bitLength=function(){var u=this.words[this.length-1],g=this._countBits(u);return(this.length-1)*26+g};function F(w){for(var u=new Array(w.bitLength()),g=0;g>>E&1}return u}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var u=0,g=0;gu.length?this.clone().ior(u):u.clone().ior(this)},s.prototype.uor=function(u){return this.length>u.length?this.clone().iuor(u):u.clone().iuor(this)},s.prototype.iuand=function(u){var g;this.length>u.length?g=u:g=this;for(var m=0;mu.length?this.clone().iand(u):u.clone().iand(this)},s.prototype.uand=function(u){return this.length>u.length?this.clone().iuand(u):u.clone().iuand(this)},s.prototype.iuxor=function(u){var g,m;this.length>u.length?(g=this,m=u):(g=u,m=this);for(var E=0;Eu.length?this.clone().ixor(u):u.clone().ixor(this)},s.prototype.uxor=function(u){return this.length>u.length?this.clone().iuxor(u):u.clone().iuxor(this)},s.prototype.inotn=function(u){n(typeof u=="number"&&u>=0);var g=Math.ceil(u/26)|0,m=u%26;this._expand(g),m>0&&g--;for(var E=0;E0&&(this.words[E]=~this.words[E]&67108863>>26-m),this._strip()},s.prototype.notn=function(u){return this.clone().inotn(u)},s.prototype.setn=function(u,g){n(typeof u=="number"&&u>=0);var m=u/26|0,E=u%26;return this._expand(m+1),g?this.words[m]=this.words[m]|1<u.length?(m=this,E=u):(m=u,E=this);for(var S=0,T=0;T>>26;for(;S!==0&&T>>26;if(this.length=m.length,S!==0)this.words[this.length]=S,this.length++;else if(m!==this)for(;Tu.length?this.clone().iadd(u):u.clone().iadd(this)},s.prototype.isub=function(u){if(u.negative!==0){u.negative=0;var g=this.iadd(u);return u.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(u),this.negative=1,this._normSign();var m=this.cmp(u);if(m===0)return this.negative=0,this.length=1,this.words[0]=0,this;var E,S;m>0?(E=this,S=u):(E=u,S=this);for(var T=0,L=0;L>26,this.words[L]=g&67108863;for(;T!==0&&L>26,this.words[L]=g&67108863;if(T===0&&L>>26,Y=_&67108863,X=Math.min(d,u.length-1),k=Math.max(0,d-w.length+1);k<=X;k++){var B=d-k|0;E=w.words[B]|0,S=u.words[k]|0,T=E*S+Y,R+=T/67108864|0,Y=T&67108863}g.words[d]=Y|0,_=R|0}return _!==0?g.words[d]=_|0:g.length--,g._strip()}var N=function(u,g,m){var E=u.words,S=g.words,T=m.words,L=0,_,d,R,Y=E[0]|0,X=Y&8191,k=Y>>>13,B=E[1]|0,V=B&8191,Q=B>>>13,ge=E[2]|0,M=ge&8191,C=ge>>>13,q=E[3]|0,J=q&8191,fe=q>>>13,ye=E[4]|0,ae=ye&8191,Se=ye>>>13,Pt=E[5]|0,Ae=Pt&8191,Ie=Pt>>>13,ot=E[6]|0,Me=ot&8191,Te=ot>>>13,ct=E[7]|0,Ce=ct&8191,b=ct>>>13,f=E[8]|0,h=f&8191,x=f>>>13,P=E[9]|0,$=P&8191,W=P>>>13,de=S[0]|0,he=de&8191,ce=de>>>13,Oe=S[1]|0,ue=Oe&8191,Le=Oe>>>13,An=S[2]|0,Pe=An&8191,Be=An>>>13,Tn=S[3]|0,De=Tn&8191,$e=Tn>>>13,On=S[4]|0,Fe=On&8191,je=On>>>13,kn=S[5]|0,Ue=kn&8191,We=kn>>>13,Nn=S[6]|0,He=Nn&8191,Ve=Nn>>>13,Ln=S[7]|0,ze=Ln&8191,qe=Ln>>>13,Pn=S[8]|0,Ge=Pn&8191,Je=Pn>>>13,Bn=S[9]|0,Ze=Bn&8191,Qe=Bn>>>13;m.negative=u.negative^g.negative,m.length=19,_=Math.imul(X,he),d=Math.imul(X,ce),d=d+Math.imul(k,he)|0,R=Math.imul(k,ce);var Wr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(Wr>>>26)|0,Wr&=67108863,_=Math.imul(V,he),d=Math.imul(V,ce),d=d+Math.imul(Q,he)|0,R=Math.imul(Q,ce),_=_+Math.imul(X,ue)|0,d=d+Math.imul(X,Le)|0,d=d+Math.imul(k,ue)|0,R=R+Math.imul(k,Le)|0;var Hr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,_=Math.imul(M,he),d=Math.imul(M,ce),d=d+Math.imul(C,he)|0,R=Math.imul(C,ce),_=_+Math.imul(V,ue)|0,d=d+Math.imul(V,Le)|0,d=d+Math.imul(Q,ue)|0,R=R+Math.imul(Q,Le)|0,_=_+Math.imul(X,Pe)|0,d=d+Math.imul(X,Be)|0,d=d+Math.imul(k,Pe)|0,R=R+Math.imul(k,Be)|0;var Vr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(Vr>>>26)|0,Vr&=67108863,_=Math.imul(J,he),d=Math.imul(J,ce),d=d+Math.imul(fe,he)|0,R=Math.imul(fe,ce),_=_+Math.imul(M,ue)|0,d=d+Math.imul(M,Le)|0,d=d+Math.imul(C,ue)|0,R=R+Math.imul(C,Le)|0,_=_+Math.imul(V,Pe)|0,d=d+Math.imul(V,Be)|0,d=d+Math.imul(Q,Pe)|0,R=R+Math.imul(Q,Be)|0,_=_+Math.imul(X,De)|0,d=d+Math.imul(X,$e)|0,d=d+Math.imul(k,De)|0,R=R+Math.imul(k,$e)|0;var zr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(zr>>>26)|0,zr&=67108863,_=Math.imul(ae,he),d=Math.imul(ae,ce),d=d+Math.imul(Se,he)|0,R=Math.imul(Se,ce),_=_+Math.imul(J,ue)|0,d=d+Math.imul(J,Le)|0,d=d+Math.imul(fe,ue)|0,R=R+Math.imul(fe,Le)|0,_=_+Math.imul(M,Pe)|0,d=d+Math.imul(M,Be)|0,d=d+Math.imul(C,Pe)|0,R=R+Math.imul(C,Be)|0,_=_+Math.imul(V,De)|0,d=d+Math.imul(V,$e)|0,d=d+Math.imul(Q,De)|0,R=R+Math.imul(Q,$e)|0,_=_+Math.imul(X,Fe)|0,d=d+Math.imul(X,je)|0,d=d+Math.imul(k,Fe)|0,R=R+Math.imul(k,je)|0;var qr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(qr>>>26)|0,qr&=67108863,_=Math.imul(Ae,he),d=Math.imul(Ae,ce),d=d+Math.imul(Ie,he)|0,R=Math.imul(Ie,ce),_=_+Math.imul(ae,ue)|0,d=d+Math.imul(ae,Le)|0,d=d+Math.imul(Se,ue)|0,R=R+Math.imul(Se,Le)|0,_=_+Math.imul(J,Pe)|0,d=d+Math.imul(J,Be)|0,d=d+Math.imul(fe,Pe)|0,R=R+Math.imul(fe,Be)|0,_=_+Math.imul(M,De)|0,d=d+Math.imul(M,$e)|0,d=d+Math.imul(C,De)|0,R=R+Math.imul(C,$e)|0,_=_+Math.imul(V,Fe)|0,d=d+Math.imul(V,je)|0,d=d+Math.imul(Q,Fe)|0,R=R+Math.imul(Q,je)|0,_=_+Math.imul(X,Ue)|0,d=d+Math.imul(X,We)|0,d=d+Math.imul(k,Ue)|0,R=R+Math.imul(k,We)|0;var Gr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(Gr>>>26)|0,Gr&=67108863,_=Math.imul(Me,he),d=Math.imul(Me,ce),d=d+Math.imul(Te,he)|0,R=Math.imul(Te,ce),_=_+Math.imul(Ae,ue)|0,d=d+Math.imul(Ae,Le)|0,d=d+Math.imul(Ie,ue)|0,R=R+Math.imul(Ie,Le)|0,_=_+Math.imul(ae,Pe)|0,d=d+Math.imul(ae,Be)|0,d=d+Math.imul(Se,Pe)|0,R=R+Math.imul(Se,Be)|0,_=_+Math.imul(J,De)|0,d=d+Math.imul(J,$e)|0,d=d+Math.imul(fe,De)|0,R=R+Math.imul(fe,$e)|0,_=_+Math.imul(M,Fe)|0,d=d+Math.imul(M,je)|0,d=d+Math.imul(C,Fe)|0,R=R+Math.imul(C,je)|0,_=_+Math.imul(V,Ue)|0,d=d+Math.imul(V,We)|0,d=d+Math.imul(Q,Ue)|0,R=R+Math.imul(Q,We)|0,_=_+Math.imul(X,He)|0,d=d+Math.imul(X,Ve)|0,d=d+Math.imul(k,He)|0,R=R+Math.imul(k,Ve)|0;var Jr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(Jr>>>26)|0,Jr&=67108863,_=Math.imul(Ce,he),d=Math.imul(Ce,ce),d=d+Math.imul(b,he)|0,R=Math.imul(b,ce),_=_+Math.imul(Me,ue)|0,d=d+Math.imul(Me,Le)|0,d=d+Math.imul(Te,ue)|0,R=R+Math.imul(Te,Le)|0,_=_+Math.imul(Ae,Pe)|0,d=d+Math.imul(Ae,Be)|0,d=d+Math.imul(Ie,Pe)|0,R=R+Math.imul(Ie,Be)|0,_=_+Math.imul(ae,De)|0,d=d+Math.imul(ae,$e)|0,d=d+Math.imul(Se,De)|0,R=R+Math.imul(Se,$e)|0,_=_+Math.imul(J,Fe)|0,d=d+Math.imul(J,je)|0,d=d+Math.imul(fe,Fe)|0,R=R+Math.imul(fe,je)|0,_=_+Math.imul(M,Ue)|0,d=d+Math.imul(M,We)|0,d=d+Math.imul(C,Ue)|0,R=R+Math.imul(C,We)|0,_=_+Math.imul(V,He)|0,d=d+Math.imul(V,Ve)|0,d=d+Math.imul(Q,He)|0,R=R+Math.imul(Q,Ve)|0,_=_+Math.imul(X,ze)|0,d=d+Math.imul(X,qe)|0,d=d+Math.imul(k,ze)|0,R=R+Math.imul(k,qe)|0;var Zr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,_=Math.imul(h,he),d=Math.imul(h,ce),d=d+Math.imul(x,he)|0,R=Math.imul(x,ce),_=_+Math.imul(Ce,ue)|0,d=d+Math.imul(Ce,Le)|0,d=d+Math.imul(b,ue)|0,R=R+Math.imul(b,Le)|0,_=_+Math.imul(Me,Pe)|0,d=d+Math.imul(Me,Be)|0,d=d+Math.imul(Te,Pe)|0,R=R+Math.imul(Te,Be)|0,_=_+Math.imul(Ae,De)|0,d=d+Math.imul(Ae,$e)|0,d=d+Math.imul(Ie,De)|0,R=R+Math.imul(Ie,$e)|0,_=_+Math.imul(ae,Fe)|0,d=d+Math.imul(ae,je)|0,d=d+Math.imul(Se,Fe)|0,R=R+Math.imul(Se,je)|0,_=_+Math.imul(J,Ue)|0,d=d+Math.imul(J,We)|0,d=d+Math.imul(fe,Ue)|0,R=R+Math.imul(fe,We)|0,_=_+Math.imul(M,He)|0,d=d+Math.imul(M,Ve)|0,d=d+Math.imul(C,He)|0,R=R+Math.imul(C,Ve)|0,_=_+Math.imul(V,ze)|0,d=d+Math.imul(V,qe)|0,d=d+Math.imul(Q,ze)|0,R=R+Math.imul(Q,qe)|0,_=_+Math.imul(X,Ge)|0,d=d+Math.imul(X,Je)|0,d=d+Math.imul(k,Ge)|0,R=R+Math.imul(k,Je)|0;var Qr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(Qr>>>26)|0,Qr&=67108863,_=Math.imul($,he),d=Math.imul($,ce),d=d+Math.imul(W,he)|0,R=Math.imul(W,ce),_=_+Math.imul(h,ue)|0,d=d+Math.imul(h,Le)|0,d=d+Math.imul(x,ue)|0,R=R+Math.imul(x,Le)|0,_=_+Math.imul(Ce,Pe)|0,d=d+Math.imul(Ce,Be)|0,d=d+Math.imul(b,Pe)|0,R=R+Math.imul(b,Be)|0,_=_+Math.imul(Me,De)|0,d=d+Math.imul(Me,$e)|0,d=d+Math.imul(Te,De)|0,R=R+Math.imul(Te,$e)|0,_=_+Math.imul(Ae,Fe)|0,d=d+Math.imul(Ae,je)|0,d=d+Math.imul(Ie,Fe)|0,R=R+Math.imul(Ie,je)|0,_=_+Math.imul(ae,Ue)|0,d=d+Math.imul(ae,We)|0,d=d+Math.imul(Se,Ue)|0,R=R+Math.imul(Se,We)|0,_=_+Math.imul(J,He)|0,d=d+Math.imul(J,Ve)|0,d=d+Math.imul(fe,He)|0,R=R+Math.imul(fe,Ve)|0,_=_+Math.imul(M,ze)|0,d=d+Math.imul(M,qe)|0,d=d+Math.imul(C,ze)|0,R=R+Math.imul(C,qe)|0,_=_+Math.imul(V,Ge)|0,d=d+Math.imul(V,Je)|0,d=d+Math.imul(Q,Ge)|0,R=R+Math.imul(Q,Je)|0,_=_+Math.imul(X,Ze)|0,d=d+Math.imul(X,Qe)|0,d=d+Math.imul(k,Ze)|0,R=R+Math.imul(k,Qe)|0;var Yr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(Yr>>>26)|0,Yr&=67108863,_=Math.imul($,ue),d=Math.imul($,Le),d=d+Math.imul(W,ue)|0,R=Math.imul(W,Le),_=_+Math.imul(h,Pe)|0,d=d+Math.imul(h,Be)|0,d=d+Math.imul(x,Pe)|0,R=R+Math.imul(x,Be)|0,_=_+Math.imul(Ce,De)|0,d=d+Math.imul(Ce,$e)|0,d=d+Math.imul(b,De)|0,R=R+Math.imul(b,$e)|0,_=_+Math.imul(Me,Fe)|0,d=d+Math.imul(Me,je)|0,d=d+Math.imul(Te,Fe)|0,R=R+Math.imul(Te,je)|0,_=_+Math.imul(Ae,Ue)|0,d=d+Math.imul(Ae,We)|0,d=d+Math.imul(Ie,Ue)|0,R=R+Math.imul(Ie,We)|0,_=_+Math.imul(ae,He)|0,d=d+Math.imul(ae,Ve)|0,d=d+Math.imul(Se,He)|0,R=R+Math.imul(Se,Ve)|0,_=_+Math.imul(J,ze)|0,d=d+Math.imul(J,qe)|0,d=d+Math.imul(fe,ze)|0,R=R+Math.imul(fe,qe)|0,_=_+Math.imul(M,Ge)|0,d=d+Math.imul(M,Je)|0,d=d+Math.imul(C,Ge)|0,R=R+Math.imul(C,Je)|0,_=_+Math.imul(V,Ze)|0,d=d+Math.imul(V,Qe)|0,d=d+Math.imul(Q,Ze)|0,R=R+Math.imul(Q,Qe)|0;var Kr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(Kr>>>26)|0,Kr&=67108863,_=Math.imul($,Pe),d=Math.imul($,Be),d=d+Math.imul(W,Pe)|0,R=Math.imul(W,Be),_=_+Math.imul(h,De)|0,d=d+Math.imul(h,$e)|0,d=d+Math.imul(x,De)|0,R=R+Math.imul(x,$e)|0,_=_+Math.imul(Ce,Fe)|0,d=d+Math.imul(Ce,je)|0,d=d+Math.imul(b,Fe)|0,R=R+Math.imul(b,je)|0,_=_+Math.imul(Me,Ue)|0,d=d+Math.imul(Me,We)|0,d=d+Math.imul(Te,Ue)|0,R=R+Math.imul(Te,We)|0,_=_+Math.imul(Ae,He)|0,d=d+Math.imul(Ae,Ve)|0,d=d+Math.imul(Ie,He)|0,R=R+Math.imul(Ie,Ve)|0,_=_+Math.imul(ae,ze)|0,d=d+Math.imul(ae,qe)|0,d=d+Math.imul(Se,ze)|0,R=R+Math.imul(Se,qe)|0,_=_+Math.imul(J,Ge)|0,d=d+Math.imul(J,Je)|0,d=d+Math.imul(fe,Ge)|0,R=R+Math.imul(fe,Je)|0,_=_+Math.imul(M,Ze)|0,d=d+Math.imul(M,Qe)|0,d=d+Math.imul(C,Ze)|0,R=R+Math.imul(C,Qe)|0;var Xr=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(Xr>>>26)|0,Xr&=67108863,_=Math.imul($,De),d=Math.imul($,$e),d=d+Math.imul(W,De)|0,R=Math.imul(W,$e),_=_+Math.imul(h,Fe)|0,d=d+Math.imul(h,je)|0,d=d+Math.imul(x,Fe)|0,R=R+Math.imul(x,je)|0,_=_+Math.imul(Ce,Ue)|0,d=d+Math.imul(Ce,We)|0,d=d+Math.imul(b,Ue)|0,R=R+Math.imul(b,We)|0,_=_+Math.imul(Me,He)|0,d=d+Math.imul(Me,Ve)|0,d=d+Math.imul(Te,He)|0,R=R+Math.imul(Te,Ve)|0,_=_+Math.imul(Ae,ze)|0,d=d+Math.imul(Ae,qe)|0,d=d+Math.imul(Ie,ze)|0,R=R+Math.imul(Ie,qe)|0,_=_+Math.imul(ae,Ge)|0,d=d+Math.imul(ae,Je)|0,d=d+Math.imul(Se,Ge)|0,R=R+Math.imul(Se,Je)|0,_=_+Math.imul(J,Ze)|0,d=d+Math.imul(J,Qe)|0,d=d+Math.imul(fe,Ze)|0,R=R+Math.imul(fe,Qe)|0;var en=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(en>>>26)|0,en&=67108863,_=Math.imul($,Fe),d=Math.imul($,je),d=d+Math.imul(W,Fe)|0,R=Math.imul(W,je),_=_+Math.imul(h,Ue)|0,d=d+Math.imul(h,We)|0,d=d+Math.imul(x,Ue)|0,R=R+Math.imul(x,We)|0,_=_+Math.imul(Ce,He)|0,d=d+Math.imul(Ce,Ve)|0,d=d+Math.imul(b,He)|0,R=R+Math.imul(b,Ve)|0,_=_+Math.imul(Me,ze)|0,d=d+Math.imul(Me,qe)|0,d=d+Math.imul(Te,ze)|0,R=R+Math.imul(Te,qe)|0,_=_+Math.imul(Ae,Ge)|0,d=d+Math.imul(Ae,Je)|0,d=d+Math.imul(Ie,Ge)|0,R=R+Math.imul(Ie,Je)|0,_=_+Math.imul(ae,Ze)|0,d=d+Math.imul(ae,Qe)|0,d=d+Math.imul(Se,Ze)|0,R=R+Math.imul(Se,Qe)|0;var tn=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(tn>>>26)|0,tn&=67108863,_=Math.imul($,Ue),d=Math.imul($,We),d=d+Math.imul(W,Ue)|0,R=Math.imul(W,We),_=_+Math.imul(h,He)|0,d=d+Math.imul(h,Ve)|0,d=d+Math.imul(x,He)|0,R=R+Math.imul(x,Ve)|0,_=_+Math.imul(Ce,ze)|0,d=d+Math.imul(Ce,qe)|0,d=d+Math.imul(b,ze)|0,R=R+Math.imul(b,qe)|0,_=_+Math.imul(Me,Ge)|0,d=d+Math.imul(Me,Je)|0,d=d+Math.imul(Te,Ge)|0,R=R+Math.imul(Te,Je)|0,_=_+Math.imul(Ae,Ze)|0,d=d+Math.imul(Ae,Qe)|0,d=d+Math.imul(Ie,Ze)|0,R=R+Math.imul(Ie,Qe)|0;var fa=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(fa>>>26)|0,fa&=67108863,_=Math.imul($,He),d=Math.imul($,Ve),d=d+Math.imul(W,He)|0,R=Math.imul(W,Ve),_=_+Math.imul(h,ze)|0,d=d+Math.imul(h,qe)|0,d=d+Math.imul(x,ze)|0,R=R+Math.imul(x,qe)|0,_=_+Math.imul(Ce,Ge)|0,d=d+Math.imul(Ce,Je)|0,d=d+Math.imul(b,Ge)|0,R=R+Math.imul(b,Je)|0,_=_+Math.imul(Me,Ze)|0,d=d+Math.imul(Me,Qe)|0,d=d+Math.imul(Te,Ze)|0,R=R+Math.imul(Te,Qe)|0;var ha=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(ha>>>26)|0,ha&=67108863,_=Math.imul($,ze),d=Math.imul($,qe),d=d+Math.imul(W,ze)|0,R=Math.imul(W,qe),_=_+Math.imul(h,Ge)|0,d=d+Math.imul(h,Je)|0,d=d+Math.imul(x,Ge)|0,R=R+Math.imul(x,Je)|0,_=_+Math.imul(Ce,Ze)|0,d=d+Math.imul(Ce,Qe)|0,d=d+Math.imul(b,Ze)|0,R=R+Math.imul(b,Qe)|0;var da=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(da>>>26)|0,da&=67108863,_=Math.imul($,Ge),d=Math.imul($,Je),d=d+Math.imul(W,Ge)|0,R=Math.imul(W,Je),_=_+Math.imul(h,Ze)|0,d=d+Math.imul(h,Qe)|0,d=d+Math.imul(x,Ze)|0,R=R+Math.imul(x,Qe)|0;var pa=(L+_|0)+((d&8191)<<13)|0;L=(R+(d>>>13)|0)+(pa>>>26)|0,pa&=67108863,_=Math.imul($,Ze),d=Math.imul($,Qe),d=d+Math.imul(W,Ze)|0,R=Math.imul(W,Qe);var ga=(L+_|0)+((d&8191)<<13)|0;return L=(R+(d>>>13)|0)+(ga>>>26)|0,ga&=67108863,T[0]=Wr,T[1]=Hr,T[2]=Vr,T[3]=zr,T[4]=qr,T[5]=Gr,T[6]=Jr,T[7]=Zr,T[8]=Qr,T[9]=Yr,T[10]=Kr,T[11]=Xr,T[12]=en,T[13]=tn,T[14]=fa,T[15]=ha,T[16]=da,T[17]=pa,T[18]=ga,L!==0&&(T[19]=L,m.length++),m};Math.imul||(N=I);function D(w,u,g){g.negative=u.negative^w.negative,g.length=w.length+u.length;for(var m=0,E=0,S=0;S>>26)|0,E+=T>>>26,T&=67108863}g.words[S]=L,m=T,T=E}return m!==0?g.words[S]=m:g.length--,g._strip()}function H(w,u,g){return D(w,u,g)}s.prototype.mulTo=function(u,g){var m,E=this.length+u.length;return this.length===10&&u.length===10?m=N(this,u,g):E<63?m=I(this,u,g):E<1024?m=D(this,u,g):m=H(this,u,g),m},s.prototype.mul=function(u){var g=new s(null);return g.words=new Array(this.length+u.length),this.mulTo(u,g)},s.prototype.mulf=function(u){var g=new s(null);return g.words=new Array(this.length+u.length),H(this,u,g)},s.prototype.imul=function(u){return this.clone().mulTo(u,this)},s.prototype.imuln=function(u){var g=u<0;g&&(u=-u),n(typeof u=="number"),n(u<67108864);for(var m=0,E=0;E>=26,m+=S/67108864|0,m+=T>>>26,this.words[E]=T&67108863}return m!==0&&(this.words[E]=m,this.length++),g?this.ineg():this},s.prototype.muln=function(u){return this.clone().imuln(u)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(u){var g=F(u);if(g.length===0)return new s(1);for(var m=this,E=0;E=0);var g=u%26,m=(u-g)/26,E=67108863>>>26-g<<26-g,S;if(g!==0){var T=0;for(S=0;S>>26-g}T&&(this.words[S]=T,this.length++)}if(m!==0){for(S=this.length-1;S>=0;S--)this.words[S+m]=this.words[S];for(S=0;S=0);var E;g?E=(g-g%26)/26:E=0;var S=u%26,T=Math.min((u-S)/26,this.length),L=67108863^67108863>>>S<T)for(this.length-=T,d=0;d=0&&(R!==0||d>=E);d--){var Y=this.words[d]|0;this.words[d]=R<<26-S|Y>>>S,R=Y&L}return _&&R!==0&&(_.words[_.length++]=R),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(u,g,m){return n(this.negative===0),this.iushrn(u,g,m)},s.prototype.shln=function(u){return this.clone().ishln(u)},s.prototype.ushln=function(u){return this.clone().iushln(u)},s.prototype.shrn=function(u){return this.clone().ishrn(u)},s.prototype.ushrn=function(u){return this.clone().iushrn(u)},s.prototype.testn=function(u){n(typeof u=="number"&&u>=0);var g=u%26,m=(u-g)/26,E=1<=0);var g=u%26,m=(u-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=m)return this;if(g!==0&&m++,this.length=Math.min(m,this.length),g!==0){var E=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},s.prototype.isubn=function(u){if(n(typeof u=="number"),n(u<67108864),u<0)return this.iaddn(-u);if(this.negative!==0)return this.negative=0,this.iaddn(u),this.negative=1,this;if(this.words[0]-=u,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(_/67108864|0),this.words[S+m]=T&67108863}for(;S>26,this.words[S+m]=T&67108863;if(L===0)return this._strip();for(n(L===-1),L=0,S=0;S>26,this.words[S]=T&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(u,g){var m=this.length-u.length,E=this.clone(),S=u,T=S.words[S.length-1]|0,L=this._countBits(T);m=26-L,m!==0&&(S=S.ushln(m),E.iushln(m),T=S.words[S.length-1]|0);var _=E.length-S.length,d;if(g!=="mod"){d=new s(null),d.length=_+1,d.words=new Array(d.length);for(var R=0;R=0;X--){var k=(E.words[S.length+X]|0)*67108864+(E.words[S.length+X-1]|0);for(k=Math.min(k/T|0,67108863),E._ishlnsubmul(S,k,X);E.negative!==0;)k--,E.negative=0,E._ishlnsubmul(S,1,X),E.isZero()||(E.negative^=1);d&&(d.words[X]=k)}return d&&d._strip(),E._strip(),g!=="div"&&m!==0&&E.iushrn(m),{div:d||null,mod:E}},s.prototype.divmod=function(u,g,m){if(n(!u.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var E,S,T;return this.negative!==0&&u.negative===0?(T=this.neg().divmod(u,g),g!=="mod"&&(E=T.div.neg()),g!=="div"&&(S=T.mod.neg(),m&&S.negative!==0&&S.iadd(u)),{div:E,mod:S}):this.negative===0&&u.negative!==0?(T=this.divmod(u.neg(),g),g!=="mod"&&(E=T.div.neg()),{div:E,mod:T.mod}):this.negative&u.negative?(T=this.neg().divmod(u.neg(),g),g!=="div"&&(S=T.mod.neg(),m&&S.negative!==0&&S.isub(u)),{div:T.div,mod:S}):u.length>this.length||this.cmp(u)<0?{div:new s(0),mod:this}:u.length===1?g==="div"?{div:this.divn(u.words[0]),mod:null}:g==="mod"?{div:null,mod:new s(this.modrn(u.words[0]))}:{div:this.divn(u.words[0]),mod:new s(this.modrn(u.words[0]))}:this._wordDiv(u,g)},s.prototype.div=function(u){return this.divmod(u,"div",!1).div},s.prototype.mod=function(u){return this.divmod(u,"mod",!1).mod},s.prototype.umod=function(u){return this.divmod(u,"mod",!0).mod},s.prototype.divRound=function(u){var g=this.divmod(u);if(g.mod.isZero())return g.div;var m=g.div.negative!==0?g.mod.isub(u):g.mod,E=u.ushrn(1),S=u.andln(1),T=m.cmp(E);return T<0||S===1&&T===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},s.prototype.modrn=function(u){var g=u<0;g&&(u=-u),n(u<=67108863);for(var m=(1<<26)%u,E=0,S=this.length-1;S>=0;S--)E=(m*E+(this.words[S]|0))%u;return g?-E:E},s.prototype.modn=function(u){return this.modrn(u)},s.prototype.idivn=function(u){var g=u<0;g&&(u=-u),n(u<=67108863);for(var m=0,E=this.length-1;E>=0;E--){var S=(this.words[E]|0)+m*67108864;this.words[E]=S/u|0,m=S%u}return this._strip(),g?this.ineg():this},s.prototype.divn=function(u){return this.clone().idivn(u)},s.prototype.egcd=function(u){n(u.negative===0),n(!u.isZero());var g=this,m=u.clone();g.negative!==0?g=g.umod(u):g=g.clone();for(var E=new s(1),S=new s(0),T=new s(0),L=new s(1),_=0;g.isEven()&&m.isEven();)g.iushrn(1),m.iushrn(1),++_;for(var d=m.clone(),R=g.clone();!g.isZero();){for(var Y=0,X=1;!(g.words[0]&X)&&Y<26;++Y,X<<=1);if(Y>0)for(g.iushrn(Y);Y-- >0;)(E.isOdd()||S.isOdd())&&(E.iadd(d),S.isub(R)),E.iushrn(1),S.iushrn(1);for(var k=0,B=1;!(m.words[0]&B)&&k<26;++k,B<<=1);if(k>0)for(m.iushrn(k);k-- >0;)(T.isOdd()||L.isOdd())&&(T.iadd(d),L.isub(R)),T.iushrn(1),L.iushrn(1);g.cmp(m)>=0?(g.isub(m),E.isub(T),S.isub(L)):(m.isub(g),T.isub(E),L.isub(S))}return{a:T,b:L,gcd:m.iushln(_)}},s.prototype._invmp=function(u){n(u.negative===0),n(!u.isZero());var g=this,m=u.clone();g.negative!==0?g=g.umod(u):g=g.clone();for(var E=new s(1),S=new s(0),T=m.clone();g.cmpn(1)>0&&m.cmpn(1)>0;){for(var L=0,_=1;!(g.words[0]&_)&&L<26;++L,_<<=1);if(L>0)for(g.iushrn(L);L-- >0;)E.isOdd()&&E.iadd(T),E.iushrn(1);for(var d=0,R=1;!(m.words[0]&R)&&d<26;++d,R<<=1);if(d>0)for(m.iushrn(d);d-- >0;)S.isOdd()&&S.iadd(T),S.iushrn(1);g.cmp(m)>=0?(g.isub(m),E.isub(S)):(m.isub(g),S.isub(E))}var Y;return g.cmpn(1)===0?Y=E:Y=S,Y.cmpn(0)<0&&Y.iadd(u),Y},s.prototype.gcd=function(u){if(this.isZero())return u.abs();if(u.isZero())return this.abs();var g=this.clone(),m=u.clone();g.negative=0,m.negative=0;for(var E=0;g.isEven()&&m.isEven();E++)g.iushrn(1),m.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;m.isEven();)m.iushrn(1);var S=g.cmp(m);if(S<0){var T=g;g=m,m=T}else if(S===0||m.cmpn(1)===0)break;g.isub(m)}while(!0);return m.iushln(E)},s.prototype.invm=function(u){return this.egcd(u).a.umod(u)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(u){return this.words[0]&u},s.prototype.bincn=function(u){n(typeof u=="number");var g=u%26,m=(u-g)/26,E=1<>>26,L&=67108863,this.words[T]=L}return S!==0&&(this.words[T]=S,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(u){var g=u<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var m;if(this.length>1)m=1;else{g&&(u=-u),n(u<=67108863,"Number is too big");var E=this.words[0]|0;m=E===u?0:Eu.length)return 1;if(this.length=0;m--){var E=this.words[m]|0,S=u.words[m]|0;if(E!==S){ES&&(g=1);break}}return g},s.prototype.gtn=function(u){return this.cmpn(u)===1},s.prototype.gt=function(u){return this.cmp(u)===1},s.prototype.gten=function(u){return this.cmpn(u)>=0},s.prototype.gte=function(u){return this.cmp(u)>=0},s.prototype.ltn=function(u){return this.cmpn(u)===-1},s.prototype.lt=function(u){return this.cmp(u)===-1},s.prototype.lten=function(u){return this.cmpn(u)<=0},s.prototype.lte=function(u){return this.cmp(u)<=0},s.prototype.eqn=function(u){return this.cmpn(u)===0},s.prototype.eq=function(u){return this.cmp(u)===0},s.red=function(u){return new ne(u)},s.prototype.toRed=function(u){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),u.convertTo(this)._forceRed(u)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(u){return this.red=u,this},s.prototype.forceRed=function(u){return n(!this.red,"Already a number in reduction context"),this._forceRed(u)},s.prototype.redAdd=function(u){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,u)},s.prototype.redIAdd=function(u){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,u)},s.prototype.redSub=function(u){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,u)},s.prototype.redISub=function(u){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,u)},s.prototype.redShl=function(u){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,u)},s.prototype.redMul=function(u){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.mul(this,u)},s.prototype.redIMul=function(u){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.imul(this,u)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(u){return n(this.red&&!u.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,u)};var U={k256:null,p224:null,p192:null,p25519:null};function z(w,u){this.name=w,this.p=new s(u,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}z.prototype._tmp=function(){var u=new s(null);return u.words=new Array(Math.ceil(this.n/13)),u},z.prototype.ireduce=function(u){var g=u,m;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),m=g.bitLength();while(m>this.n);var E=m0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},z.prototype.split=function(u,g){u.iushrn(this.n,0,g)},z.prototype.imulK=function(u){return u.imul(this.k)};function ee(){z.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(ee,z),ee.prototype.split=function(u,g){for(var m=4194303,E=Math.min(u.length,9),S=0;S>>22,T=L}T>>>=22,u.words[S-10]=T,T===0&&u.length>10?u.length-=10:u.length-=9},ee.prototype.imulK=function(u){u.words[u.length]=0,u.words[u.length+1]=0,u.length+=2;for(var g=0,m=0;m>>=26,u.words[m]=S,g=E}return g!==0&&(u.words[u.length++]=g),u},s._prime=function(u){if(U[u])return U[u];var g;if(u==="k256")g=new ee;else if(u==="p224")g=new K;else if(u==="p192")g=new Z;else if(u==="p25519")g=new se;else throw new Error("Unknown prime "+u);return U[u]=g,g};function ne(w){if(typeof w=="string"){var u=s._prime(w);this.m=u.p,this.prime=u}else n(w.gtn(1),"modulus must be greater than 1"),this.m=w,this.prime=null}ne.prototype._verify1=function(u){n(u.negative===0,"red works only with positives"),n(u.red,"red works only with red numbers")},ne.prototype._verify2=function(u,g){n((u.negative|g.negative)===0,"red works only with positives"),n(u.red&&u.red===g.red,"red works only with red numbers")},ne.prototype.imod=function(u){return this.prime?this.prime.ireduce(u)._forceRed(this):(p(u,u.umod(this.m)._forceRed(this)),u)},ne.prototype.neg=function(u){return u.isZero()?u.clone():this.m.sub(u)._forceRed(this)},ne.prototype.add=function(u,g){this._verify2(u,g);var m=u.add(g);return m.cmp(this.m)>=0&&m.isub(this.m),m._forceRed(this)},ne.prototype.iadd=function(u,g){this._verify2(u,g);var m=u.iadd(g);return m.cmp(this.m)>=0&&m.isub(this.m),m},ne.prototype.sub=function(u,g){this._verify2(u,g);var m=u.sub(g);return m.cmpn(0)<0&&m.iadd(this.m),m._forceRed(this)},ne.prototype.isub=function(u,g){this._verify2(u,g);var m=u.isub(g);return m.cmpn(0)<0&&m.iadd(this.m),m},ne.prototype.shl=function(u,g){return this._verify1(u),this.imod(u.ushln(g))},ne.prototype.imul=function(u,g){return this._verify2(u,g),this.imod(u.imul(g))},ne.prototype.mul=function(u,g){return this._verify2(u,g),this.imod(u.mul(g))},ne.prototype.isqr=function(u){return this.imul(u,u.clone())},ne.prototype.sqr=function(u){return this.mul(u,u)},ne.prototype.sqrt=function(u){if(u.isZero())return u.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var m=this.m.add(new s(1)).iushrn(2);return this.pow(u,m)}for(var E=this.m.subn(1),S=0;!E.isZero()&&E.andln(1)===0;)S++,E.iushrn(1);n(!E.isZero());var T=new s(1).toRed(this),L=T.redNeg(),_=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new s(2*d*d).toRed(this);this.pow(d,_).cmp(L)!==0;)d.redIAdd(L);for(var R=this.pow(d,E),Y=this.pow(u,E.addn(1).iushrn(1)),X=this.pow(u,E),k=S;X.cmp(T)!==0;){for(var B=X,V=0;B.cmp(T)!==0;V++)B=B.redSqr();n(V=0;S--){for(var R=g.words[S],Y=d-1;Y>=0;Y--){var X=R>>Y&1;if(T!==E[0]&&(T=this.sqr(T)),X===0&&L===0){_=0;continue}L<<=1,L|=X,_++,!(_!==m&&(S!==0||Y!==0))&&(T=this.mul(T,E[L]),_=0,L=0)}d=26}return T},ne.prototype.convertTo=function(u){var g=u.umod(this.m);return g===u?g.clone():g},ne.prototype.convertFrom=function(u){var g=u.clone();return g.red=null,g},s.mont=function(u){return new oe(u)};function oe(w){ne.call(this,w),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(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)}i(oe,ne),oe.prototype.convertTo=function(u){return this.imod(u.ushln(this.shift))},oe.prototype.convertFrom=function(u){var g=this.imod(u.mul(this.rinv));return g.red=null,g},oe.prototype.imul=function(u,g){if(u.isZero()||g.isZero())return u.words[0]=0,u.length=1,u;var m=u.imul(g),E=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=m.isub(E).iushrn(this.shift),T=S;return S.cmp(this.m)>=0?T=S.isub(this.m):S.cmpn(0)<0&&(T=S.iadd(this.m)),T._forceRed(this)},oe.prototype.mul=function(u,g){if(u.isZero()||g.isZero())return new s(0)._forceRed(this);var m=u.mul(g),E=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=m.isub(E).iushrn(this.shift),T=S;return S.cmp(this.m)>=0?T=S.isub(this.m):S.cmpn(0)<0&&(T=S.iadd(this.m)),T._forceRed(this)},oe.prototype.invm=function(u){var g=this.imod(u._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(t,te)})(Lu);var ao=Lu.exports,yi={};Object.defineProperty(yi,"__esModule",{value:!0});yi.EVENTS=void 0;yi.EVENTS={STARTED_CONNECTING:"walletlink_sdk.started.connecting",CONNECTED_STATE_CHANGE:"walletlink_sdk.connected",DISCONNECTED:"walletlink_sdk.disconnected",METADATA_DESTROYED:"walletlink_sdk_metadata_destroyed",LINKED:"walletlink_sdk.linked",FAILURE:"walletlink_sdk.generic_failure",SESSION_CONFIG_RECEIVED:"walletlink_sdk.session_config_event_received",ETH_ACCOUNTS_STATE:"walletlink_sdk.eth_accounts_state",SESSION_STATE_CHANGE:"walletlink_sdk.session_state_change",UNLINKED_ERROR_STATE:"walletlink_sdk.unlinked_error_state",SKIPPED_CLEARING_SESSION:"walletlink_sdk.skipped_clearing_session",GENERAL_ERROR:"walletlink_sdk.general_error",WEB3_REQUEST:"walletlink_sdk.web3.request",WEB3_REQUEST_PUBLISHED:"walletlink_sdk.web3.request_published",WEB3_RESPONSE:"walletlink_sdk.web3.response",UNKNOWN_ADDRESS_ENCOUNTERED:"walletlink_sdk.unknown_address_encountered"};var Yi={},uh={},Nr={},ch=zi;zi.default=zi;zi.stable=hh;zi.stableStringify=hh;var Ws="[...]",lh="[Circular]",gn=[],ln=[];function fh(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function zi(t,e,r,n){typeof n>"u"&&(n=fh()),ou(t,"",0,[],void 0,0,n);var i;try{ln.length===0?i=JSON.stringify(t,e,r):i=JSON.stringify(t,dh(e),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;gn.length!==0;){var s=gn.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return i}function Zn(t,e,r,n){var i=Object.getOwnPropertyDescriptor(n,r);i.get!==void 0?i.configurable?(Object.defineProperty(n,r,{value:t}),gn.push([n,r,e,i])):ln.push([e,r,t]):(n[r]=t,gn.push([n,r,e]))}function ou(t,e,r,n,i,s,o){s+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;ao.depthLimit){Zn(Ws,t,e,i);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){Zn(Ws,t,e,i);return}if(n.push(t),Array.isArray(t))for(a=0;ae?1:0}function hh(t,e,r,n){typeof n>"u"&&(n=fh());var i=au(t,"",0,[],void 0,0,n)||t,s;try{ln.length===0?s=JSON.stringify(i,e,r):s=JSON.stringify(i,dh(e),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;gn.length!==0;){var o=gn.pop();o.length===4?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return s}function au(t,e,r,n,i,s,o){s+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;ao.depthLimit){Zn(Ws,t,e,i);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){Zn(Ws,t,e,i);return}if(n.push(t),Array.isArray(t))for(a=0;a0)for(var n=0;n=1e3&&t<=4999}function Z0(t,e){if(e!=="[Circular]")return e}var Pu={},Lr={};Object.defineProperty(Lr,"__esModule",{value:!0});Lr.errorValues=Lr.errorCodes=void 0;Lr.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}};Lr.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.serializeError=t.isValidCode=t.getMessageFromCode=t.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=Lr,r=Nr,n=e.errorCodes.rpc.internal,i="Unspecified error message. This is a bug, please report it.",s={code:n,message:o(n)};t.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function o(v,A=i){if(Number.isInteger(v)){const O=v.toString();if(y(e.errorValues,O))return e.errorValues[O].message;if(l(v))return t.JSON_RPC_SERVER_ERROR_MESSAGE}return A}t.getMessageFromCode=o;function a(v){if(!Number.isInteger(v))return!1;const A=v.toString();return!!(e.errorValues[A]||l(v))}t.isValidCode=a;function c(v,{fallbackError:A=s,shouldIncludeStack:O=!1}={}){var j,F;if(!A||!Number.isInteger(A.code)||typeof A.message!="string")throw new Error("Must provide fallback error with integer number code and string message.");if(v instanceof r.EthereumRpcError)return v.serialize();const I={};if(v&&typeof v=="object"&&!Array.isArray(v)&&y(v,"code")&&a(v.code)){const D=v;I.code=D.code,D.message&&typeof D.message=="string"?(I.message=D.message,y(D,"data")&&(I.data=D.data)):(I.message=o(I.code),I.data={originalError:p(v)})}else{I.code=A.code;const D=(j=v)===null||j===void 0?void 0:j.message;I.message=D&&typeof D=="string"?D:A.message,I.data={originalError:p(v)}}const N=(F=v)===null||F===void 0?void 0:F.stack;return O&&v&&N&&typeof N=="string"&&(I.stack=N),I}t.serializeError=c;function l(v){return v>=-32099&&v<=-32e3}function p(v){return v&&typeof v=="object"&&!Array.isArray(v)?Object.assign({},v):v}function y(v,A){return Object.prototype.hasOwnProperty.call(v,A)}})(Pu);var uo={};Object.defineProperty(uo,"__esModule",{value:!0});uo.ethErrors=void 0;const Bu=Nr,gh=Pu,mt=Lr;uo.ethErrors={rpc:{parse:t=>Bt(mt.errorCodes.rpc.parse,t),invalidRequest:t=>Bt(mt.errorCodes.rpc.invalidRequest,t),invalidParams:t=>Bt(mt.errorCodes.rpc.invalidParams,t),methodNotFound:t=>Bt(mt.errorCodes.rpc.methodNotFound,t),internal:t=>Bt(mt.errorCodes.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return Bt(e,t)},invalidInput:t=>Bt(mt.errorCodes.rpc.invalidInput,t),resourceNotFound:t=>Bt(mt.errorCodes.rpc.resourceNotFound,t),resourceUnavailable:t=>Bt(mt.errorCodes.rpc.resourceUnavailable,t),transactionRejected:t=>Bt(mt.errorCodes.rpc.transactionRejected,t),methodNotSupported:t=>Bt(mt.errorCodes.rpc.methodNotSupported,t),limitExceeded:t=>Bt(mt.errorCodes.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Ai(mt.errorCodes.provider.userRejectedRequest,t),unauthorized:t=>Ai(mt.errorCodes.provider.unauthorized,t),unsupportedMethod:t=>Ai(mt.errorCodes.provider.unsupportedMethod,t),disconnected:t=>Ai(mt.errorCodes.provider.disconnected,t),chainDisconnected:t=>Ai(mt.errorCodes.provider.chainDisconnected,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new Bu.EthereumProviderError(e,r,n)}}};function Bt(t,e){const[r,n]=yh(e);return new Bu.EthereumRpcError(t,r||gh.getMessageFromCode(t),n)}function Ai(t,e){const[r,n]=yh(e);return new Bu.EthereumProviderError(t,r||gh.getMessageFromCode(t),n)}function yh(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getMessageFromCode=t.serializeError=t.EthereumProviderError=t.EthereumRpcError=t.ethErrors=t.errorCodes=void 0;const e=Nr;Object.defineProperty(t,"EthereumRpcError",{enumerable:!0,get:function(){return e.EthereumRpcError}}),Object.defineProperty(t,"EthereumProviderError",{enumerable:!0,get:function(){return e.EthereumProviderError}});const r=Pu;Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return r.serializeError}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return r.getMessageFromCode}});const n=uo;Object.defineProperty(t,"ethErrors",{enumerable:!0,get:function(){return n.ethErrors}});const i=Lr;Object.defineProperty(t,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})})(uh);var Ne={},co={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Web3Method=void 0,function(e){e.requestEthereumAccounts="requestEthereumAccounts",e.signEthereumMessage="signEthereumMessage",e.signEthereumTransaction="signEthereumTransaction",e.submitEthereumTransaction="submitEthereumTransaction",e.ethereumAddressFromSignedMessage="ethereumAddressFromSignedMessage",e.scanQRCode="scanQRCode",e.generic="generic",e.childRequestEthereumAccounts="childRequestEthereumAccounts",e.addEthereumChain="addEthereumChain",e.switchEthereumChain="switchEthereumChain",e.makeEthereumJSONRPCRequest="makeEthereumJSONRPCRequest",e.watchAsset="watchAsset",e.selectProvider="selectProvider"}(t.Web3Method||(t.Web3Method={}))})(co);Object.defineProperty(Ne,"__esModule",{value:!0});Ne.EthereumAddressFromSignedMessageResponse=Ne.SubmitEthereumTransactionResponse=Ne.SignEthereumTransactionResponse=Ne.SignEthereumMessageResponse=Ne.isRequestEthereumAccountsResponse=Ne.SelectProviderResponse=Ne.WatchAssetReponse=Ne.RequestEthereumAccountsResponse=Ne.SwitchEthereumChainResponse=Ne.AddEthereumChainResponse=Ne.isErrorResponse=void 0;const yr=co;function Q0(t){var e,r;return((e=t)===null||e===void 0?void 0:e.method)!==void 0&&((r=t)===null||r===void 0?void 0:r.errorMessage)!==void 0}Ne.isErrorResponse=Q0;function Y0(t){return{method:yr.Web3Method.addEthereumChain,result:t}}Ne.AddEthereumChainResponse=Y0;function K0(t){return{method:yr.Web3Method.switchEthereumChain,result:t}}Ne.SwitchEthereumChainResponse=K0;function X0(t){return{method:yr.Web3Method.requestEthereumAccounts,result:t}}Ne.RequestEthereumAccountsResponse=X0;function eg(t){return{method:yr.Web3Method.watchAsset,result:t}}Ne.WatchAssetReponse=eg;function tg(t){return{method:yr.Web3Method.selectProvider,result:t}}Ne.SelectProviderResponse=tg;function rg(t){return t&&t.method===yr.Web3Method.requestEthereumAccounts}Ne.isRequestEthereumAccountsResponse=rg;function ng(t){return{method:yr.Web3Method.signEthereumMessage,result:t}}Ne.SignEthereumMessageResponse=ng;function ig(t){return{method:yr.Web3Method.signEthereumTransaction,result:t}}Ne.SignEthereumTransactionResponse=ig;function sg(t){return{method:yr.Web3Method.submitEthereumTransaction,result:t}}Ne.SubmitEthereumTransactionResponse=sg;function og(t){return{method:yr.Web3Method.ethereumAddressFromSignedMessage,result:t}}Ne.EthereumAddressFromSignedMessageResponse=og;var bi={};Object.defineProperty(bi,"__esModule",{value:!0});bi.LIB_VERSION=void 0;bi.LIB_VERSION="3.7.2";(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorCode=t.serializeError=t.standardErrors=t.standardErrorMessage=t.standardErrorCodes=void 0;const e=uh,r=Ne,n=bi;t.standardErrorCodes=Object.freeze(Object.assign(Object.assign({},e.errorCodes),{provider:Object.freeze(Object.assign(Object.assign({},e.errorCodes.provider),{unsupportedChain:4902}))}));function i(p){return p!==void 0?(0,e.getMessageFromCode)(p):"Unknown error"}t.standardErrorMessage=i,t.standardErrors=Object.freeze(Object.assign(Object.assign({},e.ethErrors),{provider:Object.freeze(Object.assign(Object.assign({},e.ethErrors.provider),{unsupportedChain:(p="")=>e.ethErrors.provider.custom({code:t.standardErrorCodes.provider.unsupportedChain,message:`Unrecognized chain ID ${p}. Try adding the chain using wallet_addEthereumChain first.`})}))}));function s(p,y){const v=(0,e.serializeError)(o(p),{shouldIncludeStack:!0}),A=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");A.searchParams.set("version",n.LIB_VERSION),A.searchParams.set("code",v.code.toString());const O=a(v.data,y);return O&&A.searchParams.set("method",O),A.searchParams.set("message",v.message),Object.assign(Object.assign({},v),{docUrl:A.href})}t.serializeError=s;function o(p){return typeof p=="string"?{message:p,code:t.standardErrorCodes.rpc.internal}:(0,r.isErrorResponse)(p)?Object.assign(Object.assign({},p),{message:p.errorMessage,code:p.errorCode,data:{method:p.method,result:p.result}}):p}function a(p,y){var v;const A=(v=p)===null||v===void 0?void 0:v.method;if(A)return A;if(y!==void 0)return typeof y=="string"?y:Array.isArray(y)?y.length>0?y[0].method:void 0:y.method}function c(p){var y;if(typeof p=="number")return p;if(l(p))return(y=p.code)!==null&&y!==void 0?y:p.errorCode}t.getErrorCode=c;function l(p){return typeof p=="object"&&p!==null&&(typeof p.code=="number"||typeof p.errorCode=="number")}})(Yi);var vi={},bh={exports:{}},uu={exports:{}};typeof Object.create=="function"?uu.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:uu.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var er=uu.exports,cu={exports:{}},Ki={},lo={};lo.byteLength=cg;lo.toByteArray=fg;lo.fromByteArray=pg;var lr=[],jt=[],ag=typeof Uint8Array<"u"?Uint8Array:Array,ya="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Dn=0,ug=ya.length;Dn0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function cg(t){var e=vh(t),r=e[0],n=e[1];return(r+n)*3/4-n}function lg(t,e,r){return(e+r)*3/4-r}function fg(t){var e,r=vh(t),n=r[0],i=r[1],s=new ag(lg(t,n,i)),o=0,a=i>0?n-4:n,c;for(c=0;c>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=jt[t.charCodeAt(c)]<<2|jt[t.charCodeAt(c+1)]>>4,s[o++]=e&255),i===1&&(e=jt[t.charCodeAt(c)]<<10|jt[t.charCodeAt(c+1)]<<4|jt[t.charCodeAt(c+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function hg(t){return lr[t>>18&63]+lr[t>>12&63]+lr[t>>6&63]+lr[t&63]}function dg(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(lr[e>>2]+lr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(lr[e>>10]+lr[e>>4&63]+lr[e<<2&63]+"=")),i.join("")}var Du={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */Du.read=function(t,e,r,n,i){var s,o,a=i*8-n-1,c=(1<>1,p=-7,y=r?i-1:0,v=r?-1:1,A=t[e+y];for(y+=v,s=A&(1<<-p)-1,A>>=-p,p+=a;p>0;s=s*256+t[e+y],y+=v,p-=8);for(o=s&(1<<-p)-1,s>>=-p,p+=n;p>0;o=o*256+t[e+y],y+=v,p-=8);if(s===0)s=1-l;else{if(s===c)return o?NaN:(A?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-l}return(A?-1:1)*o*Math.pow(2,s-n)};Du.write=function(t,e,r,n,i,s){var o,a,c,l=s*8-i-1,p=(1<>1,v=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=n?0:s-1,O=n?1:-1,j=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=p):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+y>=1?e+=v/c:e+=v*Math.pow(2,1-y),e*c>=2&&(o++,c/=2),o+y>=p?(a=0,o=p):o+y>=1?(a=(e*c-1)*Math.pow(2,i),o=o+y):(a=e*Math.pow(2,y-1)*Math.pow(2,i),o=0));i>=8;t[r+A]=a&255,A+=O,a/=256,i-=8);for(o=o<0;t[r+A]=o&255,A+=O,o/=256,l-=8);t[r+A-O]|=j*128};/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh diff --git a/assets/index-BWemBGvP.js b/assets/index-BWemBGvP.js deleted file mode 100644 index acf1399..0000000 --- a/assets/index-BWemBGvP.js +++ /dev/null @@ -1,7 +0,0 @@ -import{az as fe}from"./index-i7WuWpn4.js";const me=Symbol(),ee=Object.getPrototypeOf,G=new WeakMap,ge=e=>e&&(G.has(e)?G.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),he=e=>ge(e)&&e[me]||null,te=(e,t=!0)=>{G.set(e,t)};var z={VITE_REACT_APP_PROJECT_ID:"9d80089c30635ff84b5339d993d63fa1",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const q=e=>typeof e=="object"&&e!==null,A=new WeakMap,x=new WeakSet,be=(e=Object.is,t=(n,h)=>new Proxy(n,h),s=n=>q(n)&&!x.has(n)&&(Array.isArray(n)||!(Symbol.iterator in n))&&!(n instanceof WeakMap)&&!(n instanceof WeakSet)&&!(n instanceof Error)&&!(n instanceof Number)&&!(n instanceof Date)&&!(n instanceof String)&&!(n instanceof RegExp)&&!(n instanceof ArrayBuffer),r=n=>{switch(n.status){case"fulfilled":return n.value;case"rejected":throw n.reason;default:throw n}},l=new WeakMap,c=(n,h,I=r)=>{const y=l.get(n);if((y==null?void 0:y[0])===h)return y[1];const v=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n));return te(v,!0),l.set(n,[h,v]),Reflect.ownKeys(n).forEach(S=>{if(Object.getOwnPropertyDescriptor(v,S))return;const O=Reflect.get(n,S),M={value:O,enumerable:!0,configurable:!0};if(x.has(O))te(O,!1);else if(O instanceof Promise)delete M.value,M.get=()=>I(O);else if(A.has(O)){const[b,H]=A.get(O);M.value=c(b,H(),I)}Object.defineProperty(v,S,M)}),Object.preventExtensions(v)},m=new WeakMap,f=[1,1],W=n=>{if(!q(n))throw new Error("object required");const h=m.get(n);if(h)return h;let I=f[0];const y=new Set,v=(a,i=++f[0])=>{I!==i&&(I=i,y.forEach(o=>o(a,i)))};let S=f[1];const O=(a=++f[1])=>(S!==a&&!y.size&&(S=a,b.forEach(([i])=>{const o=i[1](a);o>I&&(I=o)})),I),M=a=>(i,o)=>{const g=[...i];g[1]=[a,...g[1]],v(g,o)},b=new Map,H=(a,i)=>{if((z?"production":void 0)!=="production"&&b.has(a))throw new Error("prop listener already exists");if(y.size){const o=i[3](M(a));b.set(a,[i,o])}else b.set(a,[i])},Z=a=>{var i;const o=b.get(a);o&&(b.delete(a),(i=o[1])==null||i.call(o))},ue=a=>(y.add(a),y.size===1&&b.forEach(([o,g],_)=>{if((z?"production":void 0)!=="production"&&g)throw new Error("remove already exists");const N=o[3](M(_));b.set(_,[o,N])}),()=>{y.delete(a),y.size===0&&b.forEach(([o,g],_)=>{g&&(g(),b.set(_,[o]))})}),J=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),$=t(J,{deleteProperty(a,i){const o=Reflect.get(a,i);Z(i);const g=Reflect.deleteProperty(a,i);return g&&v(["delete",[i],o]),g},set(a,i,o,g){const _=Reflect.has(a,i),N=Reflect.get(a,i,g);if(_&&(e(N,o)||m.has(o)&&e(N,m.get(o))))return!0;Z(i),q(o)&&(o=he(o)||o);let V=o;if(o instanceof Promise)o.then(C=>{o.status="fulfilled",o.value=C,v(["resolve",[i],C])}).catch(C=>{o.status="rejected",o.reason=C,v(["reject",[i],C])});else{!A.has(o)&&s(o)&&(V=W(o));const C=!x.has(V)&&A.get(V);C&&H(i,C)}return Reflect.set(a,i,V,g),v(["set",[i],o,N]),!0}});m.set(n,$);const pe=[J,O,c,ue];return A.set($,pe),Reflect.ownKeys(n).forEach(a=>{const i=Object.getOwnPropertyDescriptor(n,a);"value"in i&&($[a]=n[a],delete i.value,delete i.writable),Object.defineProperty(J,a,i)}),$})=>[W,A,x,e,t,s,r,l,c,m,f],[ye]=be();function j(e={}){return ye(e)}function D(e,t,s){const r=A.get(e);(z?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");let l;const c=[],m=r[3];let f=!1;const n=m(h=>{if(c.push(h),s){t(c.splice(0));return}l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,n()}}function ve(e,t){const s=A.get(e);(z?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[r,l,c]=s;return c(r,l(),t)}const d=j({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),de={state:d,subscribe(e){return D(d,()=>e(d))},push(e,t){e!==d.view&&(d.view=e,t&&(d.data=t),d.history.push(e))},reset(e){d.view=e,d.history=[e]},replace(e){d.history.length>1&&(d.history[d.history.length-1]=e,d.view=e)},goBack(){if(d.history.length>1){d.history.pop();const[e]=d.history.slice(-1);d.view=e}},setData(e){d.data=e}},p={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return p.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return p.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},formatNativeUrl(e,t,s){if(p.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!p.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let r=e;r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(p.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(p.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(p.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(p.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=de.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},we=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),u=j({enabled:we,userSessionId:"",events:[],connectedWalletId:void 0}),Ie={state:u,subscribe(e){return D(u.events,()=>e(ve(u.events[u.events.length-1])))},initialize(){u.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(u.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){u.connectedWalletId=e},click(e){if(u.enabled){const t={type:"CLICK",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}},track(e){if(u.enabled){const t={type:"TRACK",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}},view(e){if(u.enabled){const t={type:"VIEW",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}}},E=j({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),w={state:E,subscribe(e){return D(E,()=>e(E))},setChains(e){E.chains=e},setWalletConnectUri(e){E.walletConnectUri=e},setIsCustomDesktop(e){E.isCustomDesktop=e},setIsCustomMobile(e){E.isCustomMobile=e},setIsDataLoaded(e){E.isDataLoaded=e},setIsUiLoaded(e){E.isUiLoaded=e},setIsAuth(e){E.isAuth=e}},B=j({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}),T={state:B,subscribe(e){return D(B,()=>e(B))},setConfig(e){var t,s;Ie.initialize(),w.setChains(e.chains),w.setIsAuth(!!e.enableAuthMode),w.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),w.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),p.setModalVersionInStorage(),Object.assign(B,e)}};var Ee=Object.defineProperty,se=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,We=(e,t)=>{for(var s in t||(t={}))Le.call(t,s)&&ne(e,s,t[s]);if(se)for(var s of se(t))Oe.call(t,s)&&ne(e,s,t[s]);return e};const Q="https://explorer-api.walletconnect.com",X="wcm",Y="js-2.6.2";async function K(e,t){const s=We({sdkType:X,sdkVersion:Y},t),r=new URL(e,Q);return r.searchParams.append("projectId",T.state.projectId),Object.entries(s).forEach(([l,c])=>{c&&r.searchParams.append(l,String(c))}),(await fetch(r)).json()}const P={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${Q}/w3m/v1/getWalletImage/${e}?projectId=${T.state.projectId}&sdkType=${X}&sdkVersion=${Y}`},getAssetImageUrl(e){return`${Q}/w3m/v1/getAssetImage/${e}?projectId=${T.state.projectId}&sdkType=${X}&sdkVersion=${Y}`}};var Ce=Object.defineProperty,oe=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Me=(e,t)=>{for(var s in t||(t={}))Ae.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))je.call(t,s)&&re(e,s,t[s]);return e};const ie=p.isMobile(),L=j({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Re={state:L,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=T.state;if(e==="NONE"||t==="ALL"&&!e)return L.recomendedWallets;if(p.isArray(e)){const s={recommendedIds:e.join(",")},{listings:r}=await P.getAllListings(s),l=Object.values(r);l.sort((c,m)=>{const f=e.indexOf(c.id),W=e.indexOf(m.id);return f-W}),L.recomendedWallets=l}else{const{chains:s,isAuth:r}=w.state,l=s==null?void 0:s.join(","),c=p.isArray(t),m={page:1,sdks:r?"auth_v1":void 0,entries:p.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=ie?await P.getMobileListings(m):await P.getDesktopListings(m);L.recomendedWallets=Object.values(f)}return L.recomendedWallets},async getWallets(e){const t=Me({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:r}=T.state,{recomendedWallets:l}=L;if(r==="ALL")return L.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):p.isArray(s)&&(t.excludedIds=s.join(",")),p.isArray(r)&&(t.excludedIds=[t.excludedIds,r].filter(Boolean).join(",")),w.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:m}=e,{listings:f,total:W}=ie?await P.getMobileListings(t):await P.getDesktopListings(t),n=Object.values(f),h=m?"search":"wallets";return L[h]={listings:[...L[h].listings,...n],total:W,page:c??1},{listings:n,total:W}},getWalletImageUrl(e){return P.getWalletImageUrl(e)},getAssetImageUrl(e){return P.getAssetImageUrl(e)},resetSearch(){L.search={listings:[],total:0,page:1}}},k=j({open:!1}),F={state:k,subscribe(e){return D(k,()=>e(k))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:r}=w.state;if(p.removeWalletConnectDeepLink(),w.setWalletConnectUri(e==null?void 0:e.uri),w.setChains(e==null?void 0:e.chains),de.reset("ConnectWallet"),s&&r)k.open=!0,t();else{const l=setInterval(()=>{const c=w.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),k.open=!0,t())},200)}})},close(){k.open=!1}};var Pe=Object.defineProperty,ae=Object.getOwnPropertySymbols,Ue=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable,le=(e,t,s)=>t in e?Pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Se=(e,t)=>{for(var s in t||(t={}))Ue.call(t,s)&&le(e,s,t[s]);if(ae)for(var s of ae(t))De.call(t,s)&&le(e,s,t[s]);return e};function _e(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const R=j({themeMode:_e()?"dark":"light"}),ce={state:R,subscribe(e){return D(R,()=>e(R))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(R.themeMode=t),s&&(R.themeVariables=Se({},s))}},U=j({open:!1,message:"",variant:"success"}),$e={state:U,subscribe(e){return D(U,()=>e(U))},openToast(e,t){U.open=!0,U.message=e,U.variant=t},closeToast(){U.open=!1}};class ke{constructor(t){this.openModal=F.open,this.closeModal=F.close,this.subscribeModal=F.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),T.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await fe(()=>import("./index-wO-A2ttc.js"),__vite__mapDeps([0,1,2,3]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),w.setIsUiLoaded(!0)}}}const Ve=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:ke},Symbol.toStringTag,{value:"Module"}));export{Ie as R,de as T,p as a,Ve as i,ce as n,$e as o,w as p,F as s,Re as t,T as y}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/index-wO-A2ttc.js","assets/browser-EcNbE0JS.js","assets/index-i7WuWpn4.js","assets/index-qK5f71Lf.css"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/assets/index-gx2zUO7q.js b/assets/index-XXy2awPw.js similarity index 99% rename from assets/index-gx2zUO7q.js rename to assets/index-XXy2awPw.js index 92bc9b6..11a1f64 100644 --- a/assets/index-gx2zUO7q.js +++ b/assets/index-XXy2awPw.js @@ -1 +1 @@ -import{g as ce,a as Be,b as ie,c as Qe,d as Ee,l as fe,n as ge}from"./index-i7WuWpn4.js";var dA="AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQBgEGAi8FYQVgt8AFcTtlQhpCWEmfe5tmZ6IAExsDzQ8t+X8rBKtTAltbAn0jsy8Bl6utPWMDTR8Ei2kRANkDBrNHNysDBzECQWUAcwFpJ3kAiyUhAJ0BUb8AL3EfAbfNAz81KUsFWwF3YQZtAm0A+VEfAzEJDQBRSQCzAQBlAHsAM70GD/v3IZWHBwARKQAxALsjTwHZAeMPEzmXgIHwABIAGQA8AEUAQDt3gdvIEGcQZAkGTRFMdEIVEwK0D64L7REdDNkq09PgADSxB/MDWwfzA1sDWwfzB/MDWwfzA1sDWwNbA1scEvAi28gQZw9QBHUFlgWTBN4IiyZREYkHMAjaVBV0JhxPA00BBCMtSSQ7mzMTJUpMFE0LCAQ2SmyvfUADTzGzVP2QqgPTMlc5dAkGHnkSqAAyD3skNb1OhnpPcagKU0+2tYdJak5vAsY6sEAACikJm2/Dd1YGRRAfJ6kQ+ww3AbkBPw3xS9wE9QY/BM0fgRkdD9GVoAipLeEM8SbnLqWAXiP5KocF8Uv4POELUVFsD10LaQnnOmeBUgMlAREijwrhDT0IcRD3Cs1vDekRSQc9A9lJngCpBwULFR05FbkmFGKwCw05ewb/GvoLkyazEy17AAXXGiUGUQEtGwMA0y7rhbRaNVwgT2MGBwspI8sUrFAkDSlAu3hMGh8HGSWtApVDdEqLUToelyH6PEENai4XUYAH+TwJGVMLhTyiRq9FEhHWPpE9TCJNTDAEOYMsMyePCdMPiQy9fHYBXQklCbUMdRM1ERs3yQg9Bx0xlygnGQglRplgngT7owP3E9UDDwVDCUUHFwO5HDETMhUtBRGBKNsC9zbZLrcCk1aEARsFzw8pH+MQVEfkDu0InwJpA4cl7wAxFSUAGyKfCEdnAGOP3FMJLs8Iy2pwI3gDaxTrZRF3B5UOWwerHDcVwxzlcMxeD4YMKKezCV8BeQmdAWME5wgNNV+MpCBFZ1eLXBifIGVBQ14AAjUMaRWjRMGHfAKPD28SHwE5AXcHPQ0FAnsR8RFvEJkI74YINbkz/DopBFMhhyAVCisDU2zSCysm/Qz8bQGnEmYDEDRBd/Jnr2C6KBgBBx0yyUFkIfULlk/RDKAaxRhGVDIZ6AfDA/ca9yfuQVsGAwOnBxc6UTPyBMELbQiPCUMATQ6nGwfbGG4KdYzUATWPAbudA1uVhwJzkwY7Bw8Aaw+LBX3pACECqwinAAkA0wNbAD0CsQehAB0AiUUBQQMrMwEl6QKTA5cINc8BmTMB9y0EH8cMGQD7O25OAsO1AoBuZqYF4VwCkgJNOQFRKQQJUktVA7N15QDfAE8GF+NLARmvTs8e50cB43MvAMsA/wAJOQcJRQHRAfdxALsBYws1Caa3uQFR7S0AhwAZbwHbAo0A4QA5AIP1AVcAUQVd/QXXAlNNARU1HC9bZQG/AyMBNwERAH0Gz5GpzQsjBHEH1wIQHxXlAu8yB7kFAyLjE9FCyQK94lkAMhoKPAqrCqpgX2Q3CjV2PVQAEh+sPss/UgVVO1c7XDtXO1w7VztcO1c7XDtXO1wDm8Pmw+YKcF9JYe8Mqg3YRMw6TRPfYFVgNhPMLbsUxRXSJVoZQRrAJwkl6FUNDwgt12Y0CDA0eRfAAEMpbINFY4oeNApPHOtTlVT8LR8AtUumM7MNsBsZREQFS3XxYi4WEgomAmSFAmJGX1GzAV83JAKh+wJonAJmDQKfiDgfDwJmPwJmKgRyBIMDfxcDfpY5Cjl7GzmGOicnAmwhAjI6OA4CbcsCbbLzjgM3a0kvAWsA4gDlAE4JB5wMkQECD8YAEbkCdzMCdqZDAnlPRwJ4viFg30WyRvcCfEMCeswCfQ0CfPRIBEiBZygALxlJXEpfGRtK0ALRBQLQ0EsrA4hTA4fqRMmRNgLypV0HAwOyS9JMMSkH001QTbMCi0MCitzFHwshR2sJuwKOOwKOYESbhQKO3QKOYHxRuFM5AQ5S2FSJApP/ApMQAO0AIFUiVbNV1AosHymZijLleGpFPz0Cl6MC77ZYJawAXSkClpMCloCgAK1ZsFoNhVEAPwKWuQKWUlxIXNUCmc8CmWhczl0LHQKcnznGOqECnBoCn58CnryOACETNS4TAp31Ap6WALlBYThh8wKe1wKgcgGtAp6jIwKeUqljzGQrKS8CJ7MCJoICoP8CoFDbAqYzAqXSAqgDAIECp/ZogGi1AAdNaiBq1QKs5wKssgKtawKtBgJXIQJV4AKx5dsDH1JsmwKywRECsuwbbORtZ21MYwMl0QK2YD9DbpQDKUkCuGICuUsZArkue3A6cOUCvR0DLbYDMhUCvoxyBgMzdQK+HnMmc1MCw88CwwhzhnRPOUl05AM8qwEDPJ4DPcMCxYACxksCxhSNAshtVQLISALJUwLJMgJkoQLd1nh9ZXiyeSlL1AMYp2cGAmH4GfeVKHsPXpZevxUCz28Cz3AzT1fW9xejAMqxAs93AS3uA04Wfk8JAtwrAtuOAtJTA1JgA1NjAQUDVZCAjUMEzxrxZEl5A4LSg5EC2ssC2eKEFIRNp0ADhqkAMwNkEoZ1Xf0AWQLfaQLevHd7AuIz7RgB8zQrAfSfAfLWiwLr9wLpdH0DAur9AuroAP1LAb0C7o0C66CWrpcHAu5DA4XkmH1w5HGlAvMHAG0DjhqZlwL3FwORcgOSiwL3nAL53QL4apogmq+/O5siA52HAv7+AR8APZ8gAZ+3AwWRA6ZuA6bdANXJAwZuoYyiCQ0DDE0BEwEjB3EGZb1rCQC/BG/DFY8etxEAG3k9ACcDNxJRA42DAWcrJQCM8wAlAOanC6OVCLsGI6fJBgCvBRnDBvElRUYFFoAFcD9GSDNCKUK8X3kZX8QAls0FOgCQVCGbwTsuYDoZutcONxjOGJHJ/gVfBWAFXwVgBWsFYAVfBWAFXwVgBV8FYAVfBWBOHQjfjW8KCgoKbF7xMwTRA7kGN8PDAMMEr8MA70gxFroFTj5xPnhCR0K+X30/X/AAWBkzswCNBsxzzASm70aCRS4rDDMeLz49fnXfcsH5GcoscQFz13Y4HwVnBXLJycnACNdRYwgICAqEXoWTxgA7P4kACxbZBu21Kw0AjMsTAwkVAOVtJUUsJ1JCuULESUArXy9gPi9AKwnJRQYKTD9LPoA+iT54PnkCkULEUUpDX9NWV3JVEjQAc1w3A3IBE3YnX+g7QiMJb6MKaiszRCUuQrNCxDPMCcwEX9EWJzYREBEEBwIHKn6l33JCNVIfybPJtAltydPUCmhBZw/tEKsZAJOVJU1CLRuxbUHOQAo7P0s+eEJHHA8SJVRPdGM0NVrpvBoKhfUlM0JHHGUQUhEWO1xLSj8MO0ucNAqJIzVCRxv9EFsqKyA4OQgNj2nwZgp5ZNFgE2A1K3YHS2AhQQojJmC7DgpzGG1WYFUZCQYHZO9gHWCdYIVgu2BTYJlwFh8GvRbcXbG8YgtDHrMBwzPVyQonHQgkCyYBgQJ0Ajc4nVqIAwGSCsBPIgDsK3SWEtIVBa5N8gGjAo+kVwVIZwD/AEUSCDweX4ITrRQsJ8K3TwBXFDwEAB0TvzVcAtoTS20RIwDgVgZ9BBImYgA5AL4Coi8LFnezOkCnIQFjAY4KBAPh9RcGsgZSBsEAJctdsWIRu2kTkQstRw7DAcMBKgpPBGIGMDAwKCYnKTQaLg4AKRSVAFwCdl+YUZ0JdicFD3lPAdt1F9ZZKCGxuE3yBxkFVGcA/wBFEgiCBwAOLHQSjxOtQDg1z7deFRMAZ8QTAGtKb1ApIiPHADkAvgKiLy1DFtYCmBiDAlDDWNB0eo7fpaMO/aEVRRv0ATEQZBIODyMEAc8JQhCbDRgzFD4TAEMAu9YBCgCsAOkAm5I3ABwAYxvONnR+MhXJAxgKQyxL2+kkJhMbhQKDBMkSsvF0AD9BNQ6uQC7WqSQHwxEAEEIu1hkhAH2z4iQPwyJPHNWpdyYBRSpnJALzoBAEVPPsH20MxA0CCEQKRgAFyAtFAlMNwwjEDUQJRArELtapMg7DDZgJIw+TGukEIwvDFkMAqAtDEMMMBhioe+QAO3MMRAACrgnEBSPY9Q0FDnbSBoMAB8MSYxkSxAEJAPIJAAB8FWMOFtMc/HcXwxhDAC7DAvOowwAewwJdKDKHAAHDAALrFUQVwwAbwyvzpWMWv8wA/ABpAy++bcYDUKPD0KhDCwKmJ1MAAmMA5+UZwxAagwipBRL/eADfw6fDGOMCGsOjk3l6BwOpo4sAEsMOGxMAA5sAbcMOAAvDp0MJGkMDwgipnNIPAwfIqUMGAOGDAAPzABXDAAcDAAnDAGmTABrDAA7DChjDjnEWAwABYwAOcwAuUyYABsMAF8MIKQANUgC6wy4AA8MADqMq8wCyYgAcIwAB8wqpAAXOCx0V4wAHowBCwwEKAGnDAAuDAB3DAAjDCakABdIAbqcZ3QCZCCkABdIAAAFDAAfjAB2jCCkABqIACYMAGzMAbSMA5sOIAAhjAAhDABTDBAkpAAbSAOOTAAlDC6kOzPtnAAdDAG6kQFAATwAKwwwAA0MACbUDPwAHIwAZgwACE6cDAAojAApDAAoDp/MGwwAJIwADEwAQQwgAFEMAEXMAD5MADfMADcMAGRMOFiMAFUMAbqMWuwHDAMIAE0MLAGkzEgDhUwACQwAEWgAXgwUjAAbYABjDBSYBgzBaAEFNALcQBxUMegAwMngBrA0IZgJ0KxQHBREPd1N0ZzKRJwaIHAZqNT4DqQq8BwngAB4DAwt2AX56T1ocKQNXAh1GATQGC3tOxYNagkgAMQA5CQADAQEAWxLjAIOYNAEzAH7tFRk6TglSAF8NAAlYAQ+S1ACAQwQorQBiAN4dAJ1wPyeTANVzuQDX3AIeEMp9eyMgXiUAEdkBkJizKltbVVAaRMqRAAEAhyQ/SDEz6BmfVwB6ATEsOClKIRcDOF0E/832AFNt5AByAnkCRxGCOs94NjXdAwINGBonDBwPALW2AwICAgAAAAAAAAYDBQMDARrUAwAtAAAAAgEGBgYGBgYFBQUFBQUEBQYHCAkEBQUFBQQAAAICAAAAIgCNAJAAlT0A6gC7ANwApEQAwgCyAK0AqADuAKYA2gCjAOcBCAEDAMcAgQBiANIA1AEDAN4A8gCQAKkBMQDqAN8A3AsBCQ8yO9ra2tq8xuLT1tRJOB0BUgFcNU0BWgFpAWgBWwFMUUlLbhMBUxsNEAs6PhMOACcUKy0vMj5AQENDQ0RFFEYGJFdXV1dZWVhZL1pbXVxcI2NnZ2ZoZypsbnZ1eHh4eHh4enp6enp6enp6enp8fH18e2IARPIASQCaAHgAMgBm+ACOAFcAVwA3AnbvAIsABfj4AGQAk/IAnwBPAGIAZP//sACFAIUAaQBWALEAJAC2AIMCQAJDAPwA5wD+AP4A6AD/AOkA6QDoAOYALwJ7AVEBQAE+AVQBPgE+AT4BOQE4ATgBOAEcAVgXADEQCAEAUx8SHgsdHhYAjgCWAKYAUQBqIAIxAHYAbwCXAxUDJzIDIUlGTzEAkQJPAMcCVwKkAMAClgKWApYClgKWApYCiwKWApYClgKWApYClgKVApUCmAKgApcClgKWApQClAKUApQCkgKVAnUB1AKXAp8ClgKWApUeAIETBQD+DQOfAmECOh8BVBg9AuIZEjMbAU4/G1WZAXusRAFpYQEFA0FPAQYAmTEeIJdyADFoAHEANgCRA5zMk/C2jGINwjMWygIZCaXdfDILBCs5dAE7YnQBugDlhoiHhoiGiYqKhouOjIaNkI6Ij4qQipGGkoaThpSSlYaWhpeKmIaZhpqGm4aci52QnoqfhuIC4XTpAt90AIp0LHSoAIsAdHQEQwRABEIERQRDBEkERgRBBEcESQRIBEQERgRJAJ5udACrA490ALxuAQ10ANFZdHQA13QCFHQA/mJ0AP4BIQD+APwA/AD9APwDhGZ03ASMK23HAP4A/AD8AP0A/CR0dACRYnQA/gCRASEA/gCRAvQA/gCRA4RmdNwEjCttxyR0AP9idAEhAP4A/gD8APwA/QD8AP8A/AD8AP0A/AOEZnTcBIwrbcckdHQAkWJ0ASEA/gCRAP4AkQL0AP4AkQOEZnTcBIwrbcckdAJLAT50AlIBQXQCU8l0dAJfdHQDpgL0A6YDpgOnA6cDpwOnA4RmdNwEjCttxyR0dACRYnQBIQOmAJEDpgCRAvQDpgCRA4RmdNwEjCttxyR0BDh0AJEEOQCRDpU5dSgCADR03gV2CwArdAEFAM5iCnR0AF1iAAYcOgp0dACRCnQAXAEIwWZ0CnRmdHQAkWZ0CnRmdEXgAFF03gp0dEY0tlT2u3SOAQTwscwhjZZKrhYcBSfFp9XNbKiVDOD2b+cpe4/Z17mQnbtzzhaeQtE2GGj0IDNTjRUSyTxxw/RPHW/+vS7d1NfRt9z9QPZg4X7QFfhCnkvgNPIItOsC2eV6hPannZNHlZ9xrwZXIMOlu3jSoQSq78WEjwLjw1ELSlF1aBvfzwk5ZX7AUvQzjPQKbDuQ+sm4wNOp4A6AdVuRS0t1y/DZpg4R6m7FNjM9HgvW7Bi88zaMjOo6lM8wtBBdj8LP4ylv3zCXPhebMKJc066o9sF71oFW/8JXu86HJbwDID5lzw5GWLR/LhT0Qqnp2JQxNZNfcbLIzPy+YypqRm/lBmGmex+82+PisxUumSeJkALIT6rJezxMH+CTJmQtt5uwTVbL3ptmjDUQzlSIvWi8Tl7ng1NpuRn1Ng4n14Qc+3Iil7OwkvNWogLSPkn3pihIFytyIGmMhOe3n1tWsuMy9BdKyqF4Z3v2SgggTL9KVvMXPnCbRe+oOuFFP3HejBG/w9gvmfNYvg6JuWia2lcSSN1uIjBktzoIazOHPJZ7kKHPz8mRWVdW3lA8WGF9dQF6Bm673boov3BUWDU2JNcahR23GtfHKLOz/viZ+rYnZFaIznXO67CYEJ1fXuTRpZhYZkKe54xeoagkNGLs+NTZHE0rX45/XvQ2RGADX6vcAvdxIUBV27wxGm2zjZo4X3ILgAlrOFheuZ6wtsvaIj4yLY7qqawlliaIcrz2G+c3vscAnCkCuMzMmZvMfu9lLwTvfX+3cVSyPdN9ZwgDZhfjRgNJcLiJ67b9xx8JHswprbiE3v9UphotAPIgnXVIN5KmMc0piXhc6cChPnN+MRhG9adtdttQTTwSIpl8I4/j//d3sz1326qTBTpPRM/Hgh3kzqEXs8ZAk4ErQhNO8hzrQ0DLkWMA/N+91tn2MdOJnWC2FCZehkQrwzwbKOjhvZsbM95QoeL9skYyMf4srVPVJSgg7pOLUtr/n9eT99oe9nLtFRpjA9okV2Kj8h9k5HaC0oivRD8VyXkJ81tcd4fHNXPCfloIQasxsuO18/46dR2jgul/UIet2G0kRvnyONMKhHs6J26FEoqSqd+rfYjeEGwHWVDpX1fh1jBBcKGMqRepju9Y00mDVHC+Xdij/j44rKfvfjGinNs1jO/0F3jB83XCDINN/HB84axlP+3E/klktRo+vl3U/aiyMJbIodE1XSsDn6UAzIoMtUObY2+k/4gY/l+AkZJ5Sj2vQrkyLm3FoxjhDX+31UXBFf9XrAH31fFqoBmDEZvhvvpnZ87N+oZEu7U9O/nnk+QWj3x8uyoRbEnf+O5UMr9i0nHP38IF5AvzrBW8YWBUR0mIAzIvndQq9N3v/Jto3aPjPXUPl8ASdPPyAp7jENf8bk7VMM9ol9XGmlBmeDMuGqt+WzuL6CXAxXjIhCPM5vACchgMJ/8XBGLO/D1isVvGhwwHHr1DLaI5mn2Jr/b1pUD90uciDaS8cXNDzCWvNmT/PhQe5e8nTnnnkt8Ds/SIjibcum/fqDhKopxAY8AkSrPn+IGDEKOO+U3XOP6djFs2H5N9+orhOahiQk5KnEUWa+CzkVzhp8bMHRbg81qhjjXuIKbHjSLSIBKWqockGtKinY+z4/RdBUF6pcc3JmnlxVcNgrI4SEzKUZSwcD2QCyxzKve+gAmg6ZuSRkpPFa6mfThu7LJNu3H5K42uCpNvPAsoedolKV/LHe/eJ+BbaG5MG0NaSGVPRUmNFMFFSSpXEcXwbVh7UETOZZtoVNRGOIbbkig3McEtR68cG0RZAoJevWYo7Dg/lZ1CQzblWeUvVHmr8fY4Nqd9JJiH/zEX24mJviH60fAyFr0A3c4bC1j3yZU60VgJxXn8JgJXLUIsiBnmKmMYz+7yBQFBvqb2eYnuW59joZBf56/wXvWIR4R8wTmV80i1mZy+S4+BUES+hzjk0uXpC///z/IlqHZ1monzlXp8aCfhGKMti73FI1KbL1q6IKO4fuBuZ59gagjn5xU79muMpHXg6S+e+gDM/U9BKLHbl9l6o8czQKl4RUkJJiqftQG2i3BMg/TQlUYFkJDYBOOvAugYuzYSDnZbDDd/aSd9x0Oe6F+bJcHfl9+gp6L5/TgA+BdFFovbfCrQ40s5vMPw8866pNX8zyFGeFWdxIpPVp9Rg1UPOVFbFZrvaFq/YAzHQgqMWpahMYfqHpmwXfHL1/kpYmGuHFwT55mQu0dylfNuq2Oq0hTMCPwqfxnuBIPLXfci4Y1ANy+1CUipQxld/izVh16WyG2Q0CQQ9NqtAnx1HCHwDj7sYxOSB0wopZSnOzxQOcExmxrVTF2BkOthVpGfuhaGECfCJpJKpjnihY+xOT2QJxN61+9K6QSqtv2Shr82I3jgJrqBg0wELFZPjvHpvzTtaJnLK6Vb97Yn933koO/saN7fsjwNKzp4l2lJVx2orjCGzC/4ZL4zCver6aQYtC5sdoychuFE6ufOiog+VWi5UDkbmvmtah/3aArEBIi39s5ILUnlFLgilcGuz9CQshEY7fw2ouoILAYPVT/gyAIq3TFAIwVsl+ktkRz/qGfnCDGrm5gsl/l9QdvCWGsjPz3dU7XuqKfdUrr/6XIgjp4rey6AJBmCmUJMjITHVdFb5m1p+dLMCL8t55zD42cmftmLEJC0Da04YiRCVUBLLa8D071/N5UBNBXDh0LFsmhV/5B5ExOB4j3WVG/S3lfK5o+V6ELHvy6RR9n4ac+VsK4VE4yphPvV+kG9FegTBH4ZRXL2HytUHCduJazB/KykjfetYxOXTLws267aGOd+I+JhKP//+VnXmS90OD/jvLcVu0asyqcuYN1mSb6XTlCkqv1vigZPIYwNF/zpWcT1GR/6aEIRjkh0yhg4LXJfaGobYJTY4JI58KiAKgmmgAKWdl5nYCeLqavRJGQNuYuZtZFGx+IkI4w4NS2xwbetNMunOjBu/hmKCI/w7tfiiyUd//4rbTeWt4izBY8YvGIN6vyKYmP/8X8wHKCeN+WRcKM70+tXKNGyevU9H2Dg5BsljnTf8YbsJ1TmMs74Ce2XlHisleguhyeg44rQOHZuw/6HTkhnnurK2d62q6yS7210SsAIaR+jXMQA+svkrLpsUY+F30Uw89uOdGAR6vo4FIME0EfVVeHTu6eKicfhSqOeXJhbftcd08sWEnNUL1C9fnprTgd83IMut8onVUF0hvqzZfHduPjbjwEXIcoYmy+P6tcJZHmeOv6VrvEdkHDJecjHuHeWANe79VG662qTjA/HCvumVv3qL+LrOcpqGps2ZGwQdFJ7PU4iuyRlBrwfO+xnPyr47s2cXVbWzAyznDiBGjCM3ksxjjqM62GE9C8f5U38kB3VjtabKp/nRdvMESPGDG90bWRLAt1Qk5DyLuazRR1YzdC1c+hZXvAWV8xA72S4A8B67vjVhbba3MMop293FeEXpe7zItMWrJG/LOH9ByOXmYnNJfjmfuX9KbrpgLOba4nZ+fl8Gbdv/ihv+6wFGKHCYrVwmhFC0J3V2bn2tIB1wCc1CST3d3X2OyxhguXcs4sm679UngzofuSeBewMFJboIQHbUh/m2JhW2hG9DIvG2t7yZIzKBTz9wBtnNC+2pCRYhSIuQ1j8xsz5VvqnyUIthvuoyyu7fNIrg/KQUVmGQaqkqZk/Vx5b33/gsEs8yX7SC1J+NV4icz6bvIE7C5G6McBaI8rVg56q5QBJWxn/87Q1sPK4+sQa8fLU5gXo4paaq4cOcQ4wR0VBHPGjKh+UlPCbA1nLXyEUX45qZ8J7/Ln4FPJE2TdzD0Z8MLSNQiykMMmSyOCiFfy84Rq60emYB2vD09KjYwsoIpeDcBDTElBbXxND72yhd9pC/1CMid/5HUMvAL27OtcIJDzNKpRPNqPOpyt2aPGz9QWIs9hQ9LiX5s8m9hjTUu/f7MyIatjjd+tSfQ3ufZxPpmJhTaBtZtKLUcfOCUqADuO+QoH8B9v6U+P0HV1GLQmtoNFTb3s74ivZgjES0qfK+8RdGgBbcCMSy8eBvh98+et1KIFqSe1KQPyXULBMTsIYnysIwiZBJYdI20vseV+wuJkcqGemehKjaAb9L57xZm3g2zX0bZ2xk/fU+bCo7TlnbW7JuF1YdURo/2Gw7VclDG1W7LOtas2LX4upifZ/23rzpsnY/ALfRgrcWP5hYmV9VxVOQA1fZvp9F2UNU+7d7xRyVm5wiLp3/0dlV7vdw1PMiZrbDAYzIVqEjRY2YU03sJhPnlwIPcZUG5ltL6S8XCxU1eYS5cjr34veBmXAvy7yN4ZjArIG0dfD/5UpBNlX1ZPoxJOwyqRi3wQWtOzd4oNKh0LkoTm8cwqgIfKhqqGOhwo71I+zXnMemTv2B2AUzABWyFztGgGULjDDzWYwJUVBTjKCn5K2QGMK1CQT7SzziOjo+BhAmqBjzuc3xYym2eedGeOIRJVyTwDw37iCMe4g5Vbnsb5ZBdxOAnMT7HU4DHpxWGuQ7GeiY30Cpbvzss55+5Km1YsbD5ea3NI9QNYIXol5apgSu9dZ8f8xS5dtHpido5BclDuLWY4lhik0tbJa07yJhH0BOyEut/GRbYTS6RfiTYWGMCkNpfSHi7HvdiTglEVHKZXaVhezH4kkXiIvKopYAlPusftpE4a5IZwvw1x/eLvoDIh/zpo9FiQInsTb2SAkKHV42XYBjpJDg4374XiVb3ws4qM0s9eSQ5HzsMU4OZJKuopFjBM+dAZEl8RUMx5uU2N486Kr141tVsGQfGjORYMCJAMsxELeNT4RmWjRcpdTGBwcx6XN9drWqPmJzcrGrH4+DRc7+n1w3kPZwu0BkNr6hQrqgo7JTB9A5kdJ/H7P4cWBMwsmuixAzJB3yrQpnGIq90lxAXLzDCdn1LPibsRt7rHNjgQBklRgPZ8vTbjXdgXrTWQsK5MdrXXQVPp0Rinq3frzZKJ0qD6Qhc40VzAraUXlob1gvkhK3vpmHgI6FRlQZNx6eRqkp0zy4AQlX813fAPtL3jMRaitGFFjo0zmErloC+h+YYdVQ6k4F/epxAoF0BmqEoKNTt6j4vQZNQ2BoqF9Vj53TOIoNmDiu9Xp15RkIgQIGcoLpfoIbenzpGUAtqFJp5W+LLnx38jHeECTJ/navKY1NWfN0sY1T8/pB8kIH3DU3DX+u6W3YwpypBMYOhbSxGjq84RZ84fWJow8pyHqn4S/9J15EcCMsXqrfwyd9mhiu3+rEo9pPpoJkdZqHjra4NvzFwuThNKy6hao/SlLw3ZADUcUp3w3SRVfW2rhl80zOgTYnKE0Hs2qp1J6H3xqPqIkvUDRMFDYyRbsFI3M9MEyovPk8rlw7/0a81cDVLmBsR2ze2pBuKb23fbeZC0uXoIvDppfTwIDxk1Oq2dGesGc+oJXWJLGkOha3CX+DUnzgAp9HGH9RsPZN63Hn4RMA5eSVhPHO+9RcRb/IOgtW31V1Q5IPGtoxPjC+MEJbVlIMYADd9aHYWUIQKopuPOHmoqSkubnAKnzgKHqgIOfW5RdAgotN6BN+O2ZYHkuemLnvQ8U9THVrS1RtLmKbcC7PeeDsYznvqzeg6VCNwmr0Yyx1wnLjyT84BZz3EJyCptD3yeueAyDWIs0L2qs/VQ3HUyqfrja0V1LdDzqAikeWuV4sc7RLIB69jEIBjCkyZedoUHqCrOvShVzyd73OdrJW0hPOuQv2qOoHDc9xVb6Yu6uq3Xqp2ZaH46A7lzevbxQEmfrzvAYSJuZ4WDk1Hz3QX1LVdiUK0EvlAGAYlG3Md30r7dcPN63yqBCIj25prpvZP0nI4+EgWoFG95V596CurXpKRBGRjQlHCvy5Ib/iW8nZJWwrET3mgd6mEhfP4KCuaLjopWs7h+MdXFdIv8dHQJgg1xi1eYqB0uDYjxwVmri0Sv5XKut/onqapC+FQiC2C1lvYJ9MVco6yDYsS3AANUfMtvtbYI2hfwZatiSsnoUeMZd34GVjkMMKA+XnjJpXgRW2SHTZplVowPmJsvXy6w3cfO1AK2dvtZEKTkC/TY9LFiKHCG0DnrMQdGm2lzlBHM9iEYynH2UcVMhUEjsc0oDBTgo2ZSQ1gzkAHeWeBXYFjYLuuf8yzTCy7/RFR81WDjXMbq2BOH5dURnxo6oivmxL3cKzKInlZkD31nvpHB9Kk7GfcfE1t+1V64b9LtgeJGlpRFxQCAqWJ5DoY77ski8gsOEOr2uywZaoO/NGa0X0y1pNQHBi3b2SUGNpcZxDT7rLbBf1FSnQ8guxGW3W+36BW0gBje4DOz6Ba6SVk0xiKgt+q2JOFyr4SYfnu+Ic1QZYIuwHBrgzr6UvOcSCzPTOo7D6IC4ISeS7zkl4h+2VoeHpnG/uWR3+ysNgPcOIXQbv0n4mr3BwQcdKJxgPSeyuP/z1Jjg4e9nUvoXegqQVIE30EHx5GHv+FAVUNTowYDJgyFhf5IvlYmEqRif6+WN1MkEJmDcQITx9FX23a4mxy1AQRsOHO/+eImX9l8EMJI3oPWzVXxSOeHU1dUWYr2uAA7AMb+vAEZSbU3qob9ibCyXeypEMpZ6863o6QPqlqGHZkuWABSTVNd4cOh9hv3qEpSx2Zy/DJMP6cItEmiBJ5PFqQnDEIt3NrA3COlOSgz43D7gpNFNJ5MBh4oFzhDPiglC2ypsNU4ISywY2erkyb1NC3Qh/IfWj0eDgZI4/ln8WPfBsT3meTjq1Uqt1E7Zl/qftqkx6aM9KueMCekSnMrcHj1CqTWWzEzPsZGcDe3Ue4Ws+XFYVxNbOFF8ezkvQGR6ZOtOLU2lQEnMBStx47vE6Pb7AYMBRj2OOfZXfisjJnpTfSNjo6sZ6qSvNxZNmDeS7Gk3yYyCk1HtKN2UnhMIjOXUzAqDv90lx9O/q/AT1ZMnit5XQe9wmQxnE/WSH0CqZ9/2Hy+Sfmpeg8RwsHI5Z8kC8H293m/LHVVM/BA7HaTJYg5Enk7M/xWpq0192ACfBai2LA/qrCjCr6Dh1BIMzMXINBmX96MJ5Hn2nxln/RXPFhwHxUmSV0EV2V0jm86/dxxuYSU1W7sVkEbN9EzkG0QFwPhyHKyb3t+Fj5WoUUTErcazE/N6EW6Lvp0d//SDPj7EV9UdJN+Amnf3Wwk3A0SlJ9Z00yvXZ7n3z70G47Hfsow8Wq1JXcfwnA+Yxa5mFsgV464KKP4T31wqIgzFPd3eCe3j5ory5fBF2hgCFyVFrLzI9eetNXvM7oQqyFgDo4CTp/hDV9NMX9JDHQ/nyHTLvZLNLF6ftn2OxjGm8+PqOwhxnPHWipkE/8wbtyri80Sr7pMNkQGMfo4ZYK9OcCC4ESVFFbLMIvlxSoRqWie0wxqnLfcLSXMSpMMQEJYDVObYsXIQNv4TGNwjq1kvT1UOkicTrG3IaBZ3XdScS3u8sgeZPVpOLkbiF940FjbCeNRINNvDbd01EPBrTCPpm12m43ze1bBB59Ia6Ovhnur/Nvx3IxwSWol+3H2qfCJR8df6aQf4v6WiONxkK+IqT4pKQrZK/LplgDI/PJZbOep8dtbV7oCr6CgfpWa8NczOkPx81iSHbsNhVSJBOtrLIMrL31LK9TqHqAbAHe0RLmmV806kRLDLNEhUEJfm9u0sxpkL93Zgd6rw+tqBfTMi59xqXHLXSHwSbSBl0EK0+loECOPtrl+/nsaFe197di4yUgoe4jKoAJDXc6DGDjrQOoFDWZJ9HXwt8xDrQP+7aRwWKWI1GF8s8O4KzxWBBcwnl3vnl1Oez3oh6Ea1vjR7/z7DDTrFtqU2W/KAEzAuXDNZ7MY73MF216dzdSbWmUp4lcm7keJfWaMHgut9x5C9mj66Z0lJ+yhsjVvyiWrfk1lzPOTdhG15Y7gQlXtacvI7qv/XNSscDwqkgwHT/gUsD5yB7LdRRvJxQGYINn9hTpodKFVSTPrtGvyQw+HlRFXIkodErAGu9Iy1YpfSPc3jkFh5CX3lPxv7aqjE/JAfTIpEjGb/H7MO0e2vsViSW1qa/Lmi4/n4DEI3g7lYrcanspDfEpKkdV1OjSLOy0BCUqVoECaB55vs06rXl4jqmLsPsFM/7vYJ0vrBhDCm/00A/H81l1uekJ/6Lml3Hb9+NKiLqATJmDpyzfYZFHumEjC662L0Bwkxi7E9U4cQA0XMVDuMYAIeLMPgQaMVOd8fmt5SflFIfuBoszeAw7ow5gXPE2Y/yBc/7jExARUf/BxIHQBF5Sn3i61w4z5xJdCyO1F1X3+3ax+JSvMeZ7S6QSKp1Fp/sjYz6Z+VgCZzibGeEoujryfMulH7Rai5kAft9ebcW50DyJr2uo2z97mTWIu45YsSnNSMrrNUuG1XsYBtD9TDYzQffKB87vWbkM4EbPAFgoBV4GQS+vtFDUqOFAoi1nTtmIOvg38N4hT2Sn8r8clmBCXspBlMBYTnrqFJGBT3wZOzAyJDre9dHH7+x7qaaKDOB4UQALD5ecS0DE4obubQEiuJZ0EpBVpLuYcce8Aa4PYd/V4DLDAJBYKQPCWTcrEaZ5HYbJi11Gd6hjGom1ii18VHYnG28NKpkz2UKVPxlhYSp8uZr367iOmoy7zsxehW9wzcy2zG0a80PBMCRQMb32hnaHeOR8fnNDzZhaNYhkOdDsBUZ3loDMa1YP0uS0cjUP3b/6DBlqmZOeNABDsLl5BI5QJups8uxAuWJdkUB/pO6Zax6tsg7fN5mjjDgMGngO+DPcKqiHIDbFIGudxtPTIyDi9SFMKBDcfdGQRv41q1AqmxgkVfJMnP8w/Bc7N9/TR6C7mGObFqFkIEom8sKi2xYqJLTCHK7cxzaZvqODo22c3wisBCP4HeAgcRbNPAsBkNRhSmD48dHupdBRw4mIvtS5oeF6zeT1KMCyhMnmhpkFAGWnGscoNkwvQ8ZM5lE/vgTHFYL99OuNxdFBxTEDd5v2qLR8y9WkXsWgG6kZNndFG+pO/UAkOCipqIhL3hq7cRSdrCq7YhUsTocEcnaFa6nVkhnSeRYUA1YO0z5itF9Sly3VlxYDw239TJJH6f3EUfYO5lb7bcFcz8Bp7Oo8QmnsUHOz/fagVUBtKEw1iT88j+aKkv8cscKNkMxjYr8344D1kFoZ7/td1W6LCNYN594301tUGRmFjAzeRg5vyoM1F6+bJZ/Q54jN/k8SFd3DxPTYaAUsivsBfgTn7Mx8H2SpPt4GOdYRnEJOH6jHM2p6SgB0gzIRq6fHxGMmSmqaPCmlfwxiuloaVIitLGN8wie2CDWhkzLoCJcODh7KIOAqbHEvXdUxaS4TTTs07Clzj/6GmVs9kiZDerMxEnhUB6QQPlcfqkG9882RqHoLiHGBoHfQuXIsAG8GTAtao2KVwRnvvam8jo1e312GQAKWEa4sUVEAMG4G6ckcONDwRcg1e2D3+ohXgY4UAWF8wHKQMrSnzCgfFpsxh+aHXMGtPQroQasRY4U6UdG0rz1Vjbka0MekOGRZQEvqQFlxseFor8zWFgHek3v29+WqN6gaK5gZOTOMZzpQIC1201LkMCXild3vWXSc5UX9xcFYfbRPzGFa1FDcPfPB/jUEq/FeGt419CI3YmBlVoHsa4KdcwQP5ZSwHHhFJ7/Ph/Rap/4vmG91eDwPP0lDfCDRCLszTqfzM71xpmiKi2HwS4WlqvGNwtvwF5Dqpn6KTq8ax00UMPkxDcZrEEEsIvHiUXXEphdb4GB4FymlPwBz4Gperqq5pW7TQ6/yNRhW8VT5NhuP0udlxo4gILq5ZxAZk8ZGh3g4CqxJlPKY7AQxupfUcVpWT5VItp1+30UqoyP4wWsRo3olRRgkWZZ2ZN6VC3OZFeXB8NbnUrSdikNptD1QiGuKkr8EmSR/AK9Rw+FF3s5uwuPbvHGiPeFOViltMK7AUaOsq9+x9cndk3iJEE5LKZRlWJbKOZweROzmPNVPkjE3K/TyA57Rs68TkZ3MR8akKpm7cFjnjPd/DdkWjgYoKHSr5Wu5ssoBYU4acRs5g2DHxUmdq8VXOXRbunD8QN0LhgkssgahcdoYsNvuXGUK/KXD/7oFb+VGdhqIn02veuM5bLudJOc2Ky0GMaG4W/xWBxIJcL7yliJOXOpx0AkBqUgzlDczmLT4iILXDxxtRR1oZa2JWFgiAb43obrJnG/TZC2KSK2wqOzRZTXavZZFMb1f3bXvVaNaK828w9TO610gk8JNf3gMfETzXXsbcvRGCG9JWQZ6+cDPqc4466Yo2RcKH+PILeKOqtnlbInR3MmBeGG3FH10yzkybuqEC2HSQwpA0An7d9+73BkDUTm30bZmoP/RGbgFN+GrCOfADgqr0WbI1a1okpFms8iHYw9hm0zUvlEMivBRxModrbJJ+9/p3jUdQQ9BCtQdxnOGrT5dzRUmw0593/mbRSdBg0nRvRZM5/E16m7ZHmDEtWhwvfdZCZ8J8M12W0yRMszXamWfQTwIZ4ayYktrnscQuWr8idp3PjT2eF/jmtdhIfcpMnb+IfZY2FebW6UY/AK3jP4u3Tu4zE4qlnQgLFbM19EBIsNf7KhjdbqQ/D6yiDb+NlEi2SKD+ivXVUK8ib0oBo366gXkR8ZxGjpJIDcEgZPa9TcYe0TIbiPl/rPUQDu3XBJ9X/GNq3FAUsKsll57DzaGMrjcT+gctp+9MLYXCq+sqP81eVQ0r9lt+gcQfZbACRbEjvlMskztZG8gbC8Qn9tt26Q7y7nDrbZq/LEz7kR6Jc6pg3N9rVX8Y5MJrGlML9p9lU4jbTkKqCveeZUJjHB03m2KRKR2TytoFkTXOLg7keU1s1lrPMQJpoOKLuAAC+y1HlJucU6ysB5hsXhvSPPLq5J7JtnqHKZ4vYjC4Vy8153QY+6780xDuGARsGbOs1WqzH0QS765rnSKEbbKlkO8oI/VDwUd0is13tKpqILu1mDJFNy/iJAWcvDgjxvusIT+PGz3ST/J9r9Mtfd0jpaGeiLYIqXc7DiHSS8TcjFVksi66PEkxW1z6ujbLLUGNNYnzOWpH8BZGK4bCK7iR+MbIv8ncDAz1u4StN3vTTzewr9IQjk9wxFxn+6N1ddKs0vffJiS08N3a4G1SVrlZ97Q/M+8G9fe5AP6d9/Qq4WRnORVhofPIKEdCr3llspUfE0oKIIYoByBRPh+bX1HLS3JWGJRhIvE1aW4NTd8ePi4Z+kXb+Z8snYfSNcqijhAgVsx4RCM54cXUiYkjeBmmC4ajOHrChoELscJJC7+9jjMjw5BagZKlgRMiSNYz7h7vvZIoQqbtQmspc0cUk1G/73iXtSpROl5wtLgQi0mW2Ex8i3WULhcggx6E1LMVHUsdc9GHI1PH3U2Ko0PyGdn9KdVOLm7FPBui0i9a0HpA60MsewVE4z8CAt5d401Gv6zXlIT5Ybit1VIA0FCs7wtvYreru1fUyW3oLAZ/+aTnZrOcYRNVA8spoRtlRoWflsRClFcgzkqiHOrf0/SVw+EpVaFlJ0g4Kxq1MMOmiQdpMNpte8lMMQqm6cIFXlnGbfJllysKDi+0JJMotkqgIxOSQgU9dn/lWkeVf8nUm3iwX2Nl3WDw9i6AUK3vBAbZZrcJpDQ/N64AVwjT07Jef30GSSmtNu2WlW7YoyW2FlWfZFQUwk867EdLYKk9VG6JgEnBiBxkY7LMo4YLQJJlAo9l/oTvJkSARDF/XtyAzM8O2t3eT/iXa6wDN3WewNmQHdPfsxChU/KtLG2Mn8i4ZqKdSlIaBZadxJmRzVS/o4yA65RTSViq60oa395Lqw0pzY4SipwE0SXXsKV+GZraGSkr/RW08wPRvqvSUkYBMA9lPx4m24az+IHmCbXA+0faxTRE9wuGeO06DIXa6QlKJ3puIyiuAVfPr736vzo2pBirS+Vxel3TMm3JKhz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";const AA=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),eA=4;function UA(A){let e=0;function t(){return A[e++]<<8|A[e++]}let l=t(),n=1,r=[0,1];for(let D=1;D>--C&1}const c=31,B=2**c,i=B>>>1,g=i>>1,E=B-1;let f=0;for(let D=0;D1;){let b=p+Z>>>1;D>>1|s(),u=u<<1^i,h=(h^i)<<1|i|1;I=u,S=1+h-u}let P=l-4;return M.map(D=>{switch(D-P){case 3:return P+65792+(A[w++]<<16|A[w++]<<8|A[w++]);case 2:return P+256+(A[w++]<<8|A[w++]);case 1:return P+A[w++];default:return D-1}})}function NA(A){let e=0;return()=>A[e++]}function rA(A){return NA(UA(kA(A)))}function kA(A){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((n,r)=>e[n.charCodeAt(0)]=r);let t=A.length,l=new Uint8Array(6*t>>3);for(let n=0,r=0,o=0,w=0;n=8&&(l[r++]=w>>(o-=8));return l}function FA(A){return A&1?~A>>1:A>>1}function JA(A,e){let t=Array(A);for(let l=0,n=0;l{let e=H(A);if(e.length)return e})}function wA(A){let e=[];for(;;){let t=A();if(t==0)break;e.push(HA(t,A))}for(;;){let t=A()-1;if(t<0)break;e.push(OA(t,A))}return e.flat()}function O(A){let e=[];for(;;){let t=A(e.length);if(!t)break;e.push(t)}return e}function sA(A,e,t){let l=Array(A).fill().map(()=>[]);for(let n=0;nl[o].push(r));return l}function HA(A,e){let t=1+e(),l=e(),n=O(e);return sA(n.length,1+A,e).flatMap((o,w)=>{let[C,...Q]=o;return Array(n[w]).fill().map((s,c)=>{let B=c*l;return[C+c*t,Q.map(i=>i+B)]})})}function OA(A,e){let t=1+e();return sA(t,1+A,e).map(n=>[n[0],n.slice(1)])}function mA(A){let e=[],t=H(A);return n(l([]),[]),e;function l(r){let o=A(),w=O(()=>{let C=H(A).map(Q=>t[Q]);if(C.length)return l(C)});return{S:o,B:w,Q:r}}function n({S:r,B:o},w,C){if(!(r&4&&C===w[w.length-1])){r&2&&(C=w[w.length-1]),r&1&&e.push(w);for(let Q of o)for(let s of Q.Q)n(Q,[...w,s],C)}}}function GA(A){return A.toString(16).toUpperCase().padStart(2,"0")}function CA(A){return`{${GA(A)}}`}function SA(A){let e=[];for(let t=0,l=A.length;t>24&255}function iA(A){return A&16777215}let j,tA,X,V;function ZA(){let A=rA(VA);j=new Map(oA(A).flatMap((e,t)=>e.map(l=>[l,t+1<<24]))),tA=new Set(H(A)),X=new Map,V=new Map;for(let[e,t]of wA(A)){if(!tA.has(e)&&t.length==2){let[l,n]=t,r=V.get(l);r||(r=new Map,V.set(l,r)),r.set(n,e)}X.set(e,t.reverse())}}function QA(A){return A>=m&&A=L&&A=K&&ex&&e0&&n(x+Q)}else{let o=X.get(r);o?t.push(...o):n(r)}if(!t.length)break;r=t.pop()}if(l&&e.length>1){let r=F(e[0]);for(let o=1;o0&&n>=o)o==0?(e.push(l,...t),t.length=0,l=w):t.push(w),n=o;else{let C=bA(l,w);C>=0?l=C:n==0&&o==0?(e.push(l),l=w):(t.push(w),n=o)}}return l>=0&&e.push(l,...t),e}function fA(A){return EA(A).map(iA)}function jA(A){return TA(EA(A))}const nA=45,gA=".",MA=65039,DA=1,d=A=>Array.from(A);function G(A,e){return A.P.has(e)||A.Q.has(e)}class XA extends Array{get is_emoji(){return!0}}let v,uA,a,W,pA,U,T,R,hA,lA,q;function y(){if(v)return;let A=rA(dA);const e=()=>H(A),t=()=>new Set(e());v=new Map(wA(A)),uA=t(),a=e(),W=new Set(e().map(s=>a[s])),a=new Set(a),pA=t(),t();let l=oA(A),n=A();const r=()=>new Set(e().flatMap(s=>l[s]).concat(e()));U=O(s=>{let c=O(A).map(B=>B+96);if(c.length){let B=s>=n;c[0]-=32,c=N(c),B&&(c=`Restricted[${c}]`);let i=r(),g=r(),E=!A();return{N:c,P:i,Q:g,M:E,R:B}}}),T=t(),R=new Map;let o=e().concat(d(T)).sort((s,c)=>s-c);o.forEach((s,c)=>{let B=A(),i=o[c]=B?o[c-B]:{V:[],M:new Map};i.V.push(s),T.has(s)||R.set(s,i)});for(let{V:s,M:c}of new Set(R.values())){let B=[];for(let g of s){let E=U.filter(M=>G(M,g)),f=B.find(({G:M})=>E.some(I=>M.has(I)));f||(f={G:new Set,V:[]},B.push(f)),f.V.push(g),E.forEach(M=>f.G.add(M))}let i=B.flatMap(g=>d(g.G));for(let{G:g,V:E}of B){let f=new Set(i.filter(M=>!g.has(M)));for(let M of E)c.set(M,f)}}let w=new Set,C=new Set;const Q=s=>w.has(s)?C.add(s):w.add(s);for(let s of U){for(let c of s.P)Q(c);for(let c of s.Q)Q(c)}for(let s of w)!R.has(s)&&!C.has(s)&&R.set(s,DA);hA=new Set(d(w).concat(d(fA(w)))),lA=mA(A).map(s=>XA.from(s)).sort(PA),q=new Map;for(let s of lA){let c=[q];for(let B of s){let i=c.map(g=>{let E=g.get(B);return E||(E=new Map,g.set(B,E)),E});B===MA?c.push(...i):c=i}for(let B of c)B.V=s}}function _(A){return(aA(A)?"":`${$(Y([A]))} `)+CA(A)}function $(A){return`"${A}"‎`}function vA(A){if(A.length>=4&&A[2]==nA&&A[3]==nA)throw new Error(`invalid label extension: "${N(A.slice(0,4))}"`)}function WA(A){for(let t=A.lastIndexOf(95);t>0;)if(A[--t]!==95)throw new Error("underscore allowed only at start")}function qA(A){let e=A[0],t=AA.get(e);if(t)throw J(`leading ${t}`);let l=A.length,n=-1;for(let r=1;r{let r=SA(n),o={input:r,offset:l};l+=r.length+1;try{let w=o.tokens=le(r,e,t),C=w.length,Q;if(!C)throw new Error("empty label");let s=o.output=w.flat();if(WA(s),!(o.emoji=C>1||w[0].is_emoji)&&s.every(B=>B<128))vA(s),Q="ASCII";else{let B=w.flatMap(i=>i.is_emoji?[]:i);if(!B.length)Q="Emoji";else{if(a.has(s[0]))throw J("leading combining mark");for(let E=1;Eo.has(w)):d(o),!t.length)return}else l.push(n)}if(t){for(let n of t)if(l.every(r=>G(n,r)))throw new Error(`whole-script confusable: ${A.N}/${n.N}`)}}function ee(A){let e=U;for(let t of A){let l=e.filter(n=>G(n,t));if(!l.length)throw U.some(n=>G(n,t))?RA(e[0],t):IA(t);if(e=l,l.length==1)break}return e}function te(A){return A.map(({input:e,error:t,output:l})=>{if(t){let n=t.message;throw new Error(A.length==1?n:`Invalid label ${$(Y(e))}: ${n}`)}return N(l)}).join(gA)}function IA(A){return new Error(`disallowed character: ${_(A)}`)}function RA(A,e){let t=_(e),l=U.find(n=>n.P.has(e));return l&&(t=`${l.N} ${t}`),new Error(`illegal mixture: ${A.N} + ${t}`)}function J(A){return new Error(`illegal placement: ${A}`)}function ne(A,e){for(let t of e)if(!G(A,t))throw RA(A,t);if(A.M){let t=fA(e);for(let l=1,n=t.length;leA)throw new Error(`excessive non-spacing marks: ${$(Y(t.slice(l-1,r)))} (${r-l}/${eA})`);l=r}}}function le(A,e,t){let l=[],n=[];for(A=A.slice().reverse();A.length;){let r=oe(A);if(r)n.length&&(l.push(e(n)),n=[]),l.push(t(r));else{let o=A.pop();if(hA.has(o))n.push(o);else{let w=v.get(o);if(w)n.push(...w);else if(!uA.has(o))throw IA(o)}}}return n.length&&l.push(e(n)),l}function re(A){return A.filter(e=>e!=MA)}function oe(A,e){let t=q,l,n=A.length;for(;n&&(t=t.get(A[--n]),!!t);){let{V:r}=t;r&&(l=r,e&&e.push(...A.slice(n).reverse()),A.length=n)}return l}function we(A){return _A(A)}export{ce as getEnsAddress,Be as getEnsAvatar,ie as getEnsName,Qe as getEnsResolver,Ee as getEnsText,fe as labelhash,ge as namehash,we as normalize}; +import{g as ce,a as Be,b as ie,c as Qe,d as Ee,l as fe,n as ge}from"./index-iGWvbPrT.js";var dA="AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQBgEGAi8FYQVgt8AFcTtlQhpCWEmfe5tmZ6IAExsDzQ8t+X8rBKtTAltbAn0jsy8Bl6utPWMDTR8Ei2kRANkDBrNHNysDBzECQWUAcwFpJ3kAiyUhAJ0BUb8AL3EfAbfNAz81KUsFWwF3YQZtAm0A+VEfAzEJDQBRSQCzAQBlAHsAM70GD/v3IZWHBwARKQAxALsjTwHZAeMPEzmXgIHwABIAGQA8AEUAQDt3gdvIEGcQZAkGTRFMdEIVEwK0D64L7REdDNkq09PgADSxB/MDWwfzA1sDWwfzB/MDWwfzA1sDWwNbA1scEvAi28gQZw9QBHUFlgWTBN4IiyZREYkHMAjaVBV0JhxPA00BBCMtSSQ7mzMTJUpMFE0LCAQ2SmyvfUADTzGzVP2QqgPTMlc5dAkGHnkSqAAyD3skNb1OhnpPcagKU0+2tYdJak5vAsY6sEAACikJm2/Dd1YGRRAfJ6kQ+ww3AbkBPw3xS9wE9QY/BM0fgRkdD9GVoAipLeEM8SbnLqWAXiP5KocF8Uv4POELUVFsD10LaQnnOmeBUgMlAREijwrhDT0IcRD3Cs1vDekRSQc9A9lJngCpBwULFR05FbkmFGKwCw05ewb/GvoLkyazEy17AAXXGiUGUQEtGwMA0y7rhbRaNVwgT2MGBwspI8sUrFAkDSlAu3hMGh8HGSWtApVDdEqLUToelyH6PEENai4XUYAH+TwJGVMLhTyiRq9FEhHWPpE9TCJNTDAEOYMsMyePCdMPiQy9fHYBXQklCbUMdRM1ERs3yQg9Bx0xlygnGQglRplgngT7owP3E9UDDwVDCUUHFwO5HDETMhUtBRGBKNsC9zbZLrcCk1aEARsFzw8pH+MQVEfkDu0InwJpA4cl7wAxFSUAGyKfCEdnAGOP3FMJLs8Iy2pwI3gDaxTrZRF3B5UOWwerHDcVwxzlcMxeD4YMKKezCV8BeQmdAWME5wgNNV+MpCBFZ1eLXBifIGVBQ14AAjUMaRWjRMGHfAKPD28SHwE5AXcHPQ0FAnsR8RFvEJkI74YINbkz/DopBFMhhyAVCisDU2zSCysm/Qz8bQGnEmYDEDRBd/Jnr2C6KBgBBx0yyUFkIfULlk/RDKAaxRhGVDIZ6AfDA/ca9yfuQVsGAwOnBxc6UTPyBMELbQiPCUMATQ6nGwfbGG4KdYzUATWPAbudA1uVhwJzkwY7Bw8Aaw+LBX3pACECqwinAAkA0wNbAD0CsQehAB0AiUUBQQMrMwEl6QKTA5cINc8BmTMB9y0EH8cMGQD7O25OAsO1AoBuZqYF4VwCkgJNOQFRKQQJUktVA7N15QDfAE8GF+NLARmvTs8e50cB43MvAMsA/wAJOQcJRQHRAfdxALsBYws1Caa3uQFR7S0AhwAZbwHbAo0A4QA5AIP1AVcAUQVd/QXXAlNNARU1HC9bZQG/AyMBNwERAH0Gz5GpzQsjBHEH1wIQHxXlAu8yB7kFAyLjE9FCyQK94lkAMhoKPAqrCqpgX2Q3CjV2PVQAEh+sPss/UgVVO1c7XDtXO1w7VztcO1c7XDtXO1wDm8Pmw+YKcF9JYe8Mqg3YRMw6TRPfYFVgNhPMLbsUxRXSJVoZQRrAJwkl6FUNDwgt12Y0CDA0eRfAAEMpbINFY4oeNApPHOtTlVT8LR8AtUumM7MNsBsZREQFS3XxYi4WEgomAmSFAmJGX1GzAV83JAKh+wJonAJmDQKfiDgfDwJmPwJmKgRyBIMDfxcDfpY5Cjl7GzmGOicnAmwhAjI6OA4CbcsCbbLzjgM3a0kvAWsA4gDlAE4JB5wMkQECD8YAEbkCdzMCdqZDAnlPRwJ4viFg30WyRvcCfEMCeswCfQ0CfPRIBEiBZygALxlJXEpfGRtK0ALRBQLQ0EsrA4hTA4fqRMmRNgLypV0HAwOyS9JMMSkH001QTbMCi0MCitzFHwshR2sJuwKOOwKOYESbhQKO3QKOYHxRuFM5AQ5S2FSJApP/ApMQAO0AIFUiVbNV1AosHymZijLleGpFPz0Cl6MC77ZYJawAXSkClpMCloCgAK1ZsFoNhVEAPwKWuQKWUlxIXNUCmc8CmWhczl0LHQKcnznGOqECnBoCn58CnryOACETNS4TAp31Ap6WALlBYThh8wKe1wKgcgGtAp6jIwKeUqljzGQrKS8CJ7MCJoICoP8CoFDbAqYzAqXSAqgDAIECp/ZogGi1AAdNaiBq1QKs5wKssgKtawKtBgJXIQJV4AKx5dsDH1JsmwKywRECsuwbbORtZ21MYwMl0QK2YD9DbpQDKUkCuGICuUsZArkue3A6cOUCvR0DLbYDMhUCvoxyBgMzdQK+HnMmc1MCw88CwwhzhnRPOUl05AM8qwEDPJ4DPcMCxYACxksCxhSNAshtVQLISALJUwLJMgJkoQLd1nh9ZXiyeSlL1AMYp2cGAmH4GfeVKHsPXpZevxUCz28Cz3AzT1fW9xejAMqxAs93AS3uA04Wfk8JAtwrAtuOAtJTA1JgA1NjAQUDVZCAjUMEzxrxZEl5A4LSg5EC2ssC2eKEFIRNp0ADhqkAMwNkEoZ1Xf0AWQLfaQLevHd7AuIz7RgB8zQrAfSfAfLWiwLr9wLpdH0DAur9AuroAP1LAb0C7o0C66CWrpcHAu5DA4XkmH1w5HGlAvMHAG0DjhqZlwL3FwORcgOSiwL3nAL53QL4apogmq+/O5siA52HAv7+AR8APZ8gAZ+3AwWRA6ZuA6bdANXJAwZuoYyiCQ0DDE0BEwEjB3EGZb1rCQC/BG/DFY8etxEAG3k9ACcDNxJRA42DAWcrJQCM8wAlAOanC6OVCLsGI6fJBgCvBRnDBvElRUYFFoAFcD9GSDNCKUK8X3kZX8QAls0FOgCQVCGbwTsuYDoZutcONxjOGJHJ/gVfBWAFXwVgBWsFYAVfBWAFXwVgBV8FYAVfBWBOHQjfjW8KCgoKbF7xMwTRA7kGN8PDAMMEr8MA70gxFroFTj5xPnhCR0K+X30/X/AAWBkzswCNBsxzzASm70aCRS4rDDMeLz49fnXfcsH5GcoscQFz13Y4HwVnBXLJycnACNdRYwgICAqEXoWTxgA7P4kACxbZBu21Kw0AjMsTAwkVAOVtJUUsJ1JCuULESUArXy9gPi9AKwnJRQYKTD9LPoA+iT54PnkCkULEUUpDX9NWV3JVEjQAc1w3A3IBE3YnX+g7QiMJb6MKaiszRCUuQrNCxDPMCcwEX9EWJzYREBEEBwIHKn6l33JCNVIfybPJtAltydPUCmhBZw/tEKsZAJOVJU1CLRuxbUHOQAo7P0s+eEJHHA8SJVRPdGM0NVrpvBoKhfUlM0JHHGUQUhEWO1xLSj8MO0ucNAqJIzVCRxv9EFsqKyA4OQgNj2nwZgp5ZNFgE2A1K3YHS2AhQQojJmC7DgpzGG1WYFUZCQYHZO9gHWCdYIVgu2BTYJlwFh8GvRbcXbG8YgtDHrMBwzPVyQonHQgkCyYBgQJ0Ajc4nVqIAwGSCsBPIgDsK3SWEtIVBa5N8gGjAo+kVwVIZwD/AEUSCDweX4ITrRQsJ8K3TwBXFDwEAB0TvzVcAtoTS20RIwDgVgZ9BBImYgA5AL4Coi8LFnezOkCnIQFjAY4KBAPh9RcGsgZSBsEAJctdsWIRu2kTkQstRw7DAcMBKgpPBGIGMDAwKCYnKTQaLg4AKRSVAFwCdl+YUZ0JdicFD3lPAdt1F9ZZKCGxuE3yBxkFVGcA/wBFEgiCBwAOLHQSjxOtQDg1z7deFRMAZ8QTAGtKb1ApIiPHADkAvgKiLy1DFtYCmBiDAlDDWNB0eo7fpaMO/aEVRRv0ATEQZBIODyMEAc8JQhCbDRgzFD4TAEMAu9YBCgCsAOkAm5I3ABwAYxvONnR+MhXJAxgKQyxL2+kkJhMbhQKDBMkSsvF0AD9BNQ6uQC7WqSQHwxEAEEIu1hkhAH2z4iQPwyJPHNWpdyYBRSpnJALzoBAEVPPsH20MxA0CCEQKRgAFyAtFAlMNwwjEDUQJRArELtapMg7DDZgJIw+TGukEIwvDFkMAqAtDEMMMBhioe+QAO3MMRAACrgnEBSPY9Q0FDnbSBoMAB8MSYxkSxAEJAPIJAAB8FWMOFtMc/HcXwxhDAC7DAvOowwAewwJdKDKHAAHDAALrFUQVwwAbwyvzpWMWv8wA/ABpAy++bcYDUKPD0KhDCwKmJ1MAAmMA5+UZwxAagwipBRL/eADfw6fDGOMCGsOjk3l6BwOpo4sAEsMOGxMAA5sAbcMOAAvDp0MJGkMDwgipnNIPAwfIqUMGAOGDAAPzABXDAAcDAAnDAGmTABrDAA7DChjDjnEWAwABYwAOcwAuUyYABsMAF8MIKQANUgC6wy4AA8MADqMq8wCyYgAcIwAB8wqpAAXOCx0V4wAHowBCwwEKAGnDAAuDAB3DAAjDCakABdIAbqcZ3QCZCCkABdIAAAFDAAfjAB2jCCkABqIACYMAGzMAbSMA5sOIAAhjAAhDABTDBAkpAAbSAOOTAAlDC6kOzPtnAAdDAG6kQFAATwAKwwwAA0MACbUDPwAHIwAZgwACE6cDAAojAApDAAoDp/MGwwAJIwADEwAQQwgAFEMAEXMAD5MADfMADcMAGRMOFiMAFUMAbqMWuwHDAMIAE0MLAGkzEgDhUwACQwAEWgAXgwUjAAbYABjDBSYBgzBaAEFNALcQBxUMegAwMngBrA0IZgJ0KxQHBREPd1N0ZzKRJwaIHAZqNT4DqQq8BwngAB4DAwt2AX56T1ocKQNXAh1GATQGC3tOxYNagkgAMQA5CQADAQEAWxLjAIOYNAEzAH7tFRk6TglSAF8NAAlYAQ+S1ACAQwQorQBiAN4dAJ1wPyeTANVzuQDX3AIeEMp9eyMgXiUAEdkBkJizKltbVVAaRMqRAAEAhyQ/SDEz6BmfVwB6ATEsOClKIRcDOF0E/832AFNt5AByAnkCRxGCOs94NjXdAwINGBonDBwPALW2AwICAgAAAAAAAAYDBQMDARrUAwAtAAAAAgEGBgYGBgYFBQUFBQUEBQYHCAkEBQUFBQQAAAICAAAAIgCNAJAAlT0A6gC7ANwApEQAwgCyAK0AqADuAKYA2gCjAOcBCAEDAMcAgQBiANIA1AEDAN4A8gCQAKkBMQDqAN8A3AsBCQ8yO9ra2tq8xuLT1tRJOB0BUgFcNU0BWgFpAWgBWwFMUUlLbhMBUxsNEAs6PhMOACcUKy0vMj5AQENDQ0RFFEYGJFdXV1dZWVhZL1pbXVxcI2NnZ2ZoZypsbnZ1eHh4eHh4enp6enp6enp6enp8fH18e2IARPIASQCaAHgAMgBm+ACOAFcAVwA3AnbvAIsABfj4AGQAk/IAnwBPAGIAZP//sACFAIUAaQBWALEAJAC2AIMCQAJDAPwA5wD+AP4A6AD/AOkA6QDoAOYALwJ7AVEBQAE+AVQBPgE+AT4BOQE4ATgBOAEcAVgXADEQCAEAUx8SHgsdHhYAjgCWAKYAUQBqIAIxAHYAbwCXAxUDJzIDIUlGTzEAkQJPAMcCVwKkAMAClgKWApYClgKWApYCiwKWApYClgKWApYClgKVApUCmAKgApcClgKWApQClAKUApQCkgKVAnUB1AKXAp8ClgKWApUeAIETBQD+DQOfAmECOh8BVBg9AuIZEjMbAU4/G1WZAXusRAFpYQEFA0FPAQYAmTEeIJdyADFoAHEANgCRA5zMk/C2jGINwjMWygIZCaXdfDILBCs5dAE7YnQBugDlhoiHhoiGiYqKhouOjIaNkI6Ij4qQipGGkoaThpSSlYaWhpeKmIaZhpqGm4aci52QnoqfhuIC4XTpAt90AIp0LHSoAIsAdHQEQwRABEIERQRDBEkERgRBBEcESQRIBEQERgRJAJ5udACrA490ALxuAQ10ANFZdHQA13QCFHQA/mJ0AP4BIQD+APwA/AD9APwDhGZ03ASMK23HAP4A/AD8AP0A/CR0dACRYnQA/gCRASEA/gCRAvQA/gCRA4RmdNwEjCttxyR0AP9idAEhAP4A/gD8APwA/QD8AP8A/AD8AP0A/AOEZnTcBIwrbcckdHQAkWJ0ASEA/gCRAP4AkQL0AP4AkQOEZnTcBIwrbcckdAJLAT50AlIBQXQCU8l0dAJfdHQDpgL0A6YDpgOnA6cDpwOnA4RmdNwEjCttxyR0dACRYnQBIQOmAJEDpgCRAvQDpgCRA4RmdNwEjCttxyR0BDh0AJEEOQCRDpU5dSgCADR03gV2CwArdAEFAM5iCnR0AF1iAAYcOgp0dACRCnQAXAEIwWZ0CnRmdHQAkWZ0CnRmdEXgAFF03gp0dEY0tlT2u3SOAQTwscwhjZZKrhYcBSfFp9XNbKiVDOD2b+cpe4/Z17mQnbtzzhaeQtE2GGj0IDNTjRUSyTxxw/RPHW/+vS7d1NfRt9z9QPZg4X7QFfhCnkvgNPIItOsC2eV6hPannZNHlZ9xrwZXIMOlu3jSoQSq78WEjwLjw1ELSlF1aBvfzwk5ZX7AUvQzjPQKbDuQ+sm4wNOp4A6AdVuRS0t1y/DZpg4R6m7FNjM9HgvW7Bi88zaMjOo6lM8wtBBdj8LP4ylv3zCXPhebMKJc066o9sF71oFW/8JXu86HJbwDID5lzw5GWLR/LhT0Qqnp2JQxNZNfcbLIzPy+YypqRm/lBmGmex+82+PisxUumSeJkALIT6rJezxMH+CTJmQtt5uwTVbL3ptmjDUQzlSIvWi8Tl7ng1NpuRn1Ng4n14Qc+3Iil7OwkvNWogLSPkn3pihIFytyIGmMhOe3n1tWsuMy9BdKyqF4Z3v2SgggTL9KVvMXPnCbRe+oOuFFP3HejBG/w9gvmfNYvg6JuWia2lcSSN1uIjBktzoIazOHPJZ7kKHPz8mRWVdW3lA8WGF9dQF6Bm673boov3BUWDU2JNcahR23GtfHKLOz/viZ+rYnZFaIznXO67CYEJ1fXuTRpZhYZkKe54xeoagkNGLs+NTZHE0rX45/XvQ2RGADX6vcAvdxIUBV27wxGm2zjZo4X3ILgAlrOFheuZ6wtsvaIj4yLY7qqawlliaIcrz2G+c3vscAnCkCuMzMmZvMfu9lLwTvfX+3cVSyPdN9ZwgDZhfjRgNJcLiJ67b9xx8JHswprbiE3v9UphotAPIgnXVIN5KmMc0piXhc6cChPnN+MRhG9adtdttQTTwSIpl8I4/j//d3sz1326qTBTpPRM/Hgh3kzqEXs8ZAk4ErQhNO8hzrQ0DLkWMA/N+91tn2MdOJnWC2FCZehkQrwzwbKOjhvZsbM95QoeL9skYyMf4srVPVJSgg7pOLUtr/n9eT99oe9nLtFRpjA9okV2Kj8h9k5HaC0oivRD8VyXkJ81tcd4fHNXPCfloIQasxsuO18/46dR2jgul/UIet2G0kRvnyONMKhHs6J26FEoqSqd+rfYjeEGwHWVDpX1fh1jBBcKGMqRepju9Y00mDVHC+Xdij/j44rKfvfjGinNs1jO/0F3jB83XCDINN/HB84axlP+3E/klktRo+vl3U/aiyMJbIodE1XSsDn6UAzIoMtUObY2+k/4gY/l+AkZJ5Sj2vQrkyLm3FoxjhDX+31UXBFf9XrAH31fFqoBmDEZvhvvpnZ87N+oZEu7U9O/nnk+QWj3x8uyoRbEnf+O5UMr9i0nHP38IF5AvzrBW8YWBUR0mIAzIvndQq9N3v/Jto3aPjPXUPl8ASdPPyAp7jENf8bk7VMM9ol9XGmlBmeDMuGqt+WzuL6CXAxXjIhCPM5vACchgMJ/8XBGLO/D1isVvGhwwHHr1DLaI5mn2Jr/b1pUD90uciDaS8cXNDzCWvNmT/PhQe5e8nTnnnkt8Ds/SIjibcum/fqDhKopxAY8AkSrPn+IGDEKOO+U3XOP6djFs2H5N9+orhOahiQk5KnEUWa+CzkVzhp8bMHRbg81qhjjXuIKbHjSLSIBKWqockGtKinY+z4/RdBUF6pcc3JmnlxVcNgrI4SEzKUZSwcD2QCyxzKve+gAmg6ZuSRkpPFa6mfThu7LJNu3H5K42uCpNvPAsoedolKV/LHe/eJ+BbaG5MG0NaSGVPRUmNFMFFSSpXEcXwbVh7UETOZZtoVNRGOIbbkig3McEtR68cG0RZAoJevWYo7Dg/lZ1CQzblWeUvVHmr8fY4Nqd9JJiH/zEX24mJviH60fAyFr0A3c4bC1j3yZU60VgJxXn8JgJXLUIsiBnmKmMYz+7yBQFBvqb2eYnuW59joZBf56/wXvWIR4R8wTmV80i1mZy+S4+BUES+hzjk0uXpC///z/IlqHZ1monzlXp8aCfhGKMti73FI1KbL1q6IKO4fuBuZ59gagjn5xU79muMpHXg6S+e+gDM/U9BKLHbl9l6o8czQKl4RUkJJiqftQG2i3BMg/TQlUYFkJDYBOOvAugYuzYSDnZbDDd/aSd9x0Oe6F+bJcHfl9+gp6L5/TgA+BdFFovbfCrQ40s5vMPw8866pNX8zyFGeFWdxIpPVp9Rg1UPOVFbFZrvaFq/YAzHQgqMWpahMYfqHpmwXfHL1/kpYmGuHFwT55mQu0dylfNuq2Oq0hTMCPwqfxnuBIPLXfci4Y1ANy+1CUipQxld/izVh16WyG2Q0CQQ9NqtAnx1HCHwDj7sYxOSB0wopZSnOzxQOcExmxrVTF2BkOthVpGfuhaGECfCJpJKpjnihY+xOT2QJxN61+9K6QSqtv2Shr82I3jgJrqBg0wELFZPjvHpvzTtaJnLK6Vb97Yn933koO/saN7fsjwNKzp4l2lJVx2orjCGzC/4ZL4zCver6aQYtC5sdoychuFE6ufOiog+VWi5UDkbmvmtah/3aArEBIi39s5ILUnlFLgilcGuz9CQshEY7fw2ouoILAYPVT/gyAIq3TFAIwVsl+ktkRz/qGfnCDGrm5gsl/l9QdvCWGsjPz3dU7XuqKfdUrr/6XIgjp4rey6AJBmCmUJMjITHVdFb5m1p+dLMCL8t55zD42cmftmLEJC0Da04YiRCVUBLLa8D071/N5UBNBXDh0LFsmhV/5B5ExOB4j3WVG/S3lfK5o+V6ELHvy6RR9n4ac+VsK4VE4yphPvV+kG9FegTBH4ZRXL2HytUHCduJazB/KykjfetYxOXTLws267aGOd+I+JhKP//+VnXmS90OD/jvLcVu0asyqcuYN1mSb6XTlCkqv1vigZPIYwNF/zpWcT1GR/6aEIRjkh0yhg4LXJfaGobYJTY4JI58KiAKgmmgAKWdl5nYCeLqavRJGQNuYuZtZFGx+IkI4w4NS2xwbetNMunOjBu/hmKCI/w7tfiiyUd//4rbTeWt4izBY8YvGIN6vyKYmP/8X8wHKCeN+WRcKM70+tXKNGyevU9H2Dg5BsljnTf8YbsJ1TmMs74Ce2XlHisleguhyeg44rQOHZuw/6HTkhnnurK2d62q6yS7210SsAIaR+jXMQA+svkrLpsUY+F30Uw89uOdGAR6vo4FIME0EfVVeHTu6eKicfhSqOeXJhbftcd08sWEnNUL1C9fnprTgd83IMut8onVUF0hvqzZfHduPjbjwEXIcoYmy+P6tcJZHmeOv6VrvEdkHDJecjHuHeWANe79VG662qTjA/HCvumVv3qL+LrOcpqGps2ZGwQdFJ7PU4iuyRlBrwfO+xnPyr47s2cXVbWzAyznDiBGjCM3ksxjjqM62GE9C8f5U38kB3VjtabKp/nRdvMESPGDG90bWRLAt1Qk5DyLuazRR1YzdC1c+hZXvAWV8xA72S4A8B67vjVhbba3MMop293FeEXpe7zItMWrJG/LOH9ByOXmYnNJfjmfuX9KbrpgLOba4nZ+fl8Gbdv/ihv+6wFGKHCYrVwmhFC0J3V2bn2tIB1wCc1CST3d3X2OyxhguXcs4sm679UngzofuSeBewMFJboIQHbUh/m2JhW2hG9DIvG2t7yZIzKBTz9wBtnNC+2pCRYhSIuQ1j8xsz5VvqnyUIthvuoyyu7fNIrg/KQUVmGQaqkqZk/Vx5b33/gsEs8yX7SC1J+NV4icz6bvIE7C5G6McBaI8rVg56q5QBJWxn/87Q1sPK4+sQa8fLU5gXo4paaq4cOcQ4wR0VBHPGjKh+UlPCbA1nLXyEUX45qZ8J7/Ln4FPJE2TdzD0Z8MLSNQiykMMmSyOCiFfy84Rq60emYB2vD09KjYwsoIpeDcBDTElBbXxND72yhd9pC/1CMid/5HUMvAL27OtcIJDzNKpRPNqPOpyt2aPGz9QWIs9hQ9LiX5s8m9hjTUu/f7MyIatjjd+tSfQ3ufZxPpmJhTaBtZtKLUcfOCUqADuO+QoH8B9v6U+P0HV1GLQmtoNFTb3s74ivZgjES0qfK+8RdGgBbcCMSy8eBvh98+et1KIFqSe1KQPyXULBMTsIYnysIwiZBJYdI20vseV+wuJkcqGemehKjaAb9L57xZm3g2zX0bZ2xk/fU+bCo7TlnbW7JuF1YdURo/2Gw7VclDG1W7LOtas2LX4upifZ/23rzpsnY/ALfRgrcWP5hYmV9VxVOQA1fZvp9F2UNU+7d7xRyVm5wiLp3/0dlV7vdw1PMiZrbDAYzIVqEjRY2YU03sJhPnlwIPcZUG5ltL6S8XCxU1eYS5cjr34veBmXAvy7yN4ZjArIG0dfD/5UpBNlX1ZPoxJOwyqRi3wQWtOzd4oNKh0LkoTm8cwqgIfKhqqGOhwo71I+zXnMemTv2B2AUzABWyFztGgGULjDDzWYwJUVBTjKCn5K2QGMK1CQT7SzziOjo+BhAmqBjzuc3xYym2eedGeOIRJVyTwDw37iCMe4g5Vbnsb5ZBdxOAnMT7HU4DHpxWGuQ7GeiY30Cpbvzss55+5Km1YsbD5ea3NI9QNYIXol5apgSu9dZ8f8xS5dtHpido5BclDuLWY4lhik0tbJa07yJhH0BOyEut/GRbYTS6RfiTYWGMCkNpfSHi7HvdiTglEVHKZXaVhezH4kkXiIvKopYAlPusftpE4a5IZwvw1x/eLvoDIh/zpo9FiQInsTb2SAkKHV42XYBjpJDg4374XiVb3ws4qM0s9eSQ5HzsMU4OZJKuopFjBM+dAZEl8RUMx5uU2N486Kr141tVsGQfGjORYMCJAMsxELeNT4RmWjRcpdTGBwcx6XN9drWqPmJzcrGrH4+DRc7+n1w3kPZwu0BkNr6hQrqgo7JTB9A5kdJ/H7P4cWBMwsmuixAzJB3yrQpnGIq90lxAXLzDCdn1LPibsRt7rHNjgQBklRgPZ8vTbjXdgXrTWQsK5MdrXXQVPp0Rinq3frzZKJ0qD6Qhc40VzAraUXlob1gvkhK3vpmHgI6FRlQZNx6eRqkp0zy4AQlX813fAPtL3jMRaitGFFjo0zmErloC+h+YYdVQ6k4F/epxAoF0BmqEoKNTt6j4vQZNQ2BoqF9Vj53TOIoNmDiu9Xp15RkIgQIGcoLpfoIbenzpGUAtqFJp5W+LLnx38jHeECTJ/navKY1NWfN0sY1T8/pB8kIH3DU3DX+u6W3YwpypBMYOhbSxGjq84RZ84fWJow8pyHqn4S/9J15EcCMsXqrfwyd9mhiu3+rEo9pPpoJkdZqHjra4NvzFwuThNKy6hao/SlLw3ZADUcUp3w3SRVfW2rhl80zOgTYnKE0Hs2qp1J6H3xqPqIkvUDRMFDYyRbsFI3M9MEyovPk8rlw7/0a81cDVLmBsR2ze2pBuKb23fbeZC0uXoIvDppfTwIDxk1Oq2dGesGc+oJXWJLGkOha3CX+DUnzgAp9HGH9RsPZN63Hn4RMA5eSVhPHO+9RcRb/IOgtW31V1Q5IPGtoxPjC+MEJbVlIMYADd9aHYWUIQKopuPOHmoqSkubnAKnzgKHqgIOfW5RdAgotN6BN+O2ZYHkuemLnvQ8U9THVrS1RtLmKbcC7PeeDsYznvqzeg6VCNwmr0Yyx1wnLjyT84BZz3EJyCptD3yeueAyDWIs0L2qs/VQ3HUyqfrja0V1LdDzqAikeWuV4sc7RLIB69jEIBjCkyZedoUHqCrOvShVzyd73OdrJW0hPOuQv2qOoHDc9xVb6Yu6uq3Xqp2ZaH46A7lzevbxQEmfrzvAYSJuZ4WDk1Hz3QX1LVdiUK0EvlAGAYlG3Md30r7dcPN63yqBCIj25prpvZP0nI4+EgWoFG95V596CurXpKRBGRjQlHCvy5Ib/iW8nZJWwrET3mgd6mEhfP4KCuaLjopWs7h+MdXFdIv8dHQJgg1xi1eYqB0uDYjxwVmri0Sv5XKut/onqapC+FQiC2C1lvYJ9MVco6yDYsS3AANUfMtvtbYI2hfwZatiSsnoUeMZd34GVjkMMKA+XnjJpXgRW2SHTZplVowPmJsvXy6w3cfO1AK2dvtZEKTkC/TY9LFiKHCG0DnrMQdGm2lzlBHM9iEYynH2UcVMhUEjsc0oDBTgo2ZSQ1gzkAHeWeBXYFjYLuuf8yzTCy7/RFR81WDjXMbq2BOH5dURnxo6oivmxL3cKzKInlZkD31nvpHB9Kk7GfcfE1t+1V64b9LtgeJGlpRFxQCAqWJ5DoY77ski8gsOEOr2uywZaoO/NGa0X0y1pNQHBi3b2SUGNpcZxDT7rLbBf1FSnQ8guxGW3W+36BW0gBje4DOz6Ba6SVk0xiKgt+q2JOFyr4SYfnu+Ic1QZYIuwHBrgzr6UvOcSCzPTOo7D6IC4ISeS7zkl4h+2VoeHpnG/uWR3+ysNgPcOIXQbv0n4mr3BwQcdKJxgPSeyuP/z1Jjg4e9nUvoXegqQVIE30EHx5GHv+FAVUNTowYDJgyFhf5IvlYmEqRif6+WN1MkEJmDcQITx9FX23a4mxy1AQRsOHO/+eImX9l8EMJI3oPWzVXxSOeHU1dUWYr2uAA7AMb+vAEZSbU3qob9ibCyXeypEMpZ6863o6QPqlqGHZkuWABSTVNd4cOh9hv3qEpSx2Zy/DJMP6cItEmiBJ5PFqQnDEIt3NrA3COlOSgz43D7gpNFNJ5MBh4oFzhDPiglC2ypsNU4ISywY2erkyb1NC3Qh/IfWj0eDgZI4/ln8WPfBsT3meTjq1Uqt1E7Zl/qftqkx6aM9KueMCekSnMrcHj1CqTWWzEzPsZGcDe3Ue4Ws+XFYVxNbOFF8ezkvQGR6ZOtOLU2lQEnMBStx47vE6Pb7AYMBRj2OOfZXfisjJnpTfSNjo6sZ6qSvNxZNmDeS7Gk3yYyCk1HtKN2UnhMIjOXUzAqDv90lx9O/q/AT1ZMnit5XQe9wmQxnE/WSH0CqZ9/2Hy+Sfmpeg8RwsHI5Z8kC8H293m/LHVVM/BA7HaTJYg5Enk7M/xWpq0192ACfBai2LA/qrCjCr6Dh1BIMzMXINBmX96MJ5Hn2nxln/RXPFhwHxUmSV0EV2V0jm86/dxxuYSU1W7sVkEbN9EzkG0QFwPhyHKyb3t+Fj5WoUUTErcazE/N6EW6Lvp0d//SDPj7EV9UdJN+Amnf3Wwk3A0SlJ9Z00yvXZ7n3z70G47Hfsow8Wq1JXcfwnA+Yxa5mFsgV464KKP4T31wqIgzFPd3eCe3j5ory5fBF2hgCFyVFrLzI9eetNXvM7oQqyFgDo4CTp/hDV9NMX9JDHQ/nyHTLvZLNLF6ftn2OxjGm8+PqOwhxnPHWipkE/8wbtyri80Sr7pMNkQGMfo4ZYK9OcCC4ESVFFbLMIvlxSoRqWie0wxqnLfcLSXMSpMMQEJYDVObYsXIQNv4TGNwjq1kvT1UOkicTrG3IaBZ3XdScS3u8sgeZPVpOLkbiF940FjbCeNRINNvDbd01EPBrTCPpm12m43ze1bBB59Ia6Ovhnur/Nvx3IxwSWol+3H2qfCJR8df6aQf4v6WiONxkK+IqT4pKQrZK/LplgDI/PJZbOep8dtbV7oCr6CgfpWa8NczOkPx81iSHbsNhVSJBOtrLIMrL31LK9TqHqAbAHe0RLmmV806kRLDLNEhUEJfm9u0sxpkL93Zgd6rw+tqBfTMi59xqXHLXSHwSbSBl0EK0+loECOPtrl+/nsaFe197di4yUgoe4jKoAJDXc6DGDjrQOoFDWZJ9HXwt8xDrQP+7aRwWKWI1GF8s8O4KzxWBBcwnl3vnl1Oez3oh6Ea1vjR7/z7DDTrFtqU2W/KAEzAuXDNZ7MY73MF216dzdSbWmUp4lcm7keJfWaMHgut9x5C9mj66Z0lJ+yhsjVvyiWrfk1lzPOTdhG15Y7gQlXtacvI7qv/XNSscDwqkgwHT/gUsD5yB7LdRRvJxQGYINn9hTpodKFVSTPrtGvyQw+HlRFXIkodErAGu9Iy1YpfSPc3jkFh5CX3lPxv7aqjE/JAfTIpEjGb/H7MO0e2vsViSW1qa/Lmi4/n4DEI3g7lYrcanspDfEpKkdV1OjSLOy0BCUqVoECaB55vs06rXl4jqmLsPsFM/7vYJ0vrBhDCm/00A/H81l1uekJ/6Lml3Hb9+NKiLqATJmDpyzfYZFHumEjC662L0Bwkxi7E9U4cQA0XMVDuMYAIeLMPgQaMVOd8fmt5SflFIfuBoszeAw7ow5gXPE2Y/yBc/7jExARUf/BxIHQBF5Sn3i61w4z5xJdCyO1F1X3+3ax+JSvMeZ7S6QSKp1Fp/sjYz6Z+VgCZzibGeEoujryfMulH7Rai5kAft9ebcW50DyJr2uo2z97mTWIu45YsSnNSMrrNUuG1XsYBtD9TDYzQffKB87vWbkM4EbPAFgoBV4GQS+vtFDUqOFAoi1nTtmIOvg38N4hT2Sn8r8clmBCXspBlMBYTnrqFJGBT3wZOzAyJDre9dHH7+x7qaaKDOB4UQALD5ecS0DE4obubQEiuJZ0EpBVpLuYcce8Aa4PYd/V4DLDAJBYKQPCWTcrEaZ5HYbJi11Gd6hjGom1ii18VHYnG28NKpkz2UKVPxlhYSp8uZr367iOmoy7zsxehW9wzcy2zG0a80PBMCRQMb32hnaHeOR8fnNDzZhaNYhkOdDsBUZ3loDMa1YP0uS0cjUP3b/6DBlqmZOeNABDsLl5BI5QJups8uxAuWJdkUB/pO6Zax6tsg7fN5mjjDgMGngO+DPcKqiHIDbFIGudxtPTIyDi9SFMKBDcfdGQRv41q1AqmxgkVfJMnP8w/Bc7N9/TR6C7mGObFqFkIEom8sKi2xYqJLTCHK7cxzaZvqODo22c3wisBCP4HeAgcRbNPAsBkNRhSmD48dHupdBRw4mIvtS5oeF6zeT1KMCyhMnmhpkFAGWnGscoNkwvQ8ZM5lE/vgTHFYL99OuNxdFBxTEDd5v2qLR8y9WkXsWgG6kZNndFG+pO/UAkOCipqIhL3hq7cRSdrCq7YhUsTocEcnaFa6nVkhnSeRYUA1YO0z5itF9Sly3VlxYDw239TJJH6f3EUfYO5lb7bcFcz8Bp7Oo8QmnsUHOz/fagVUBtKEw1iT88j+aKkv8cscKNkMxjYr8344D1kFoZ7/td1W6LCNYN594301tUGRmFjAzeRg5vyoM1F6+bJZ/Q54jN/k8SFd3DxPTYaAUsivsBfgTn7Mx8H2SpPt4GOdYRnEJOH6jHM2p6SgB0gzIRq6fHxGMmSmqaPCmlfwxiuloaVIitLGN8wie2CDWhkzLoCJcODh7KIOAqbHEvXdUxaS4TTTs07Clzj/6GmVs9kiZDerMxEnhUB6QQPlcfqkG9882RqHoLiHGBoHfQuXIsAG8GTAtao2KVwRnvvam8jo1e312GQAKWEa4sUVEAMG4G6ckcONDwRcg1e2D3+ohXgY4UAWF8wHKQMrSnzCgfFpsxh+aHXMGtPQroQasRY4U6UdG0rz1Vjbka0MekOGRZQEvqQFlxseFor8zWFgHek3v29+WqN6gaK5gZOTOMZzpQIC1201LkMCXild3vWXSc5UX9xcFYfbRPzGFa1FDcPfPB/jUEq/FeGt419CI3YmBlVoHsa4KdcwQP5ZSwHHhFJ7/Ph/Rap/4vmG91eDwPP0lDfCDRCLszTqfzM71xpmiKi2HwS4WlqvGNwtvwF5Dqpn6KTq8ax00UMPkxDcZrEEEsIvHiUXXEphdb4GB4FymlPwBz4Gperqq5pW7TQ6/yNRhW8VT5NhuP0udlxo4gILq5ZxAZk8ZGh3g4CqxJlPKY7AQxupfUcVpWT5VItp1+30UqoyP4wWsRo3olRRgkWZZ2ZN6VC3OZFeXB8NbnUrSdikNptD1QiGuKkr8EmSR/AK9Rw+FF3s5uwuPbvHGiPeFOViltMK7AUaOsq9+x9cndk3iJEE5LKZRlWJbKOZweROzmPNVPkjE3K/TyA57Rs68TkZ3MR8akKpm7cFjnjPd/DdkWjgYoKHSr5Wu5ssoBYU4acRs5g2DHxUmdq8VXOXRbunD8QN0LhgkssgahcdoYsNvuXGUK/KXD/7oFb+VGdhqIn02veuM5bLudJOc2Ky0GMaG4W/xWBxIJcL7yliJOXOpx0AkBqUgzlDczmLT4iILXDxxtRR1oZa2JWFgiAb43obrJnG/TZC2KSK2wqOzRZTXavZZFMb1f3bXvVaNaK828w9TO610gk8JNf3gMfETzXXsbcvRGCG9JWQZ6+cDPqc4466Yo2RcKH+PILeKOqtnlbInR3MmBeGG3FH10yzkybuqEC2HSQwpA0An7d9+73BkDUTm30bZmoP/RGbgFN+GrCOfADgqr0WbI1a1okpFms8iHYw9hm0zUvlEMivBRxModrbJJ+9/p3jUdQQ9BCtQdxnOGrT5dzRUmw0593/mbRSdBg0nRvRZM5/E16m7ZHmDEtWhwvfdZCZ8J8M12W0yRMszXamWfQTwIZ4ayYktrnscQuWr8idp3PjT2eF/jmtdhIfcpMnb+IfZY2FebW6UY/AK3jP4u3Tu4zE4qlnQgLFbM19EBIsNf7KhjdbqQ/D6yiDb+NlEi2SKD+ivXVUK8ib0oBo366gXkR8ZxGjpJIDcEgZPa9TcYe0TIbiPl/rPUQDu3XBJ9X/GNq3FAUsKsll57DzaGMrjcT+gctp+9MLYXCq+sqP81eVQ0r9lt+gcQfZbACRbEjvlMskztZG8gbC8Qn9tt26Q7y7nDrbZq/LEz7kR6Jc6pg3N9rVX8Y5MJrGlML9p9lU4jbTkKqCveeZUJjHB03m2KRKR2TytoFkTXOLg7keU1s1lrPMQJpoOKLuAAC+y1HlJucU6ysB5hsXhvSPPLq5J7JtnqHKZ4vYjC4Vy8153QY+6780xDuGARsGbOs1WqzH0QS765rnSKEbbKlkO8oI/VDwUd0is13tKpqILu1mDJFNy/iJAWcvDgjxvusIT+PGz3ST/J9r9Mtfd0jpaGeiLYIqXc7DiHSS8TcjFVksi66PEkxW1z6ujbLLUGNNYnzOWpH8BZGK4bCK7iR+MbIv8ncDAz1u4StN3vTTzewr9IQjk9wxFxn+6N1ddKs0vffJiS08N3a4G1SVrlZ97Q/M+8G9fe5AP6d9/Qq4WRnORVhofPIKEdCr3llspUfE0oKIIYoByBRPh+bX1HLS3JWGJRhIvE1aW4NTd8ePi4Z+kXb+Z8snYfSNcqijhAgVsx4RCM54cXUiYkjeBmmC4ajOHrChoELscJJC7+9jjMjw5BagZKlgRMiSNYz7h7vvZIoQqbtQmspc0cUk1G/73iXtSpROl5wtLgQi0mW2Ex8i3WULhcggx6E1LMVHUsdc9GHI1PH3U2Ko0PyGdn9KdVOLm7FPBui0i9a0HpA60MsewVE4z8CAt5d401Gv6zXlIT5Ybit1VIA0FCs7wtvYreru1fUyW3oLAZ/+aTnZrOcYRNVA8spoRtlRoWflsRClFcgzkqiHOrf0/SVw+EpVaFlJ0g4Kxq1MMOmiQdpMNpte8lMMQqm6cIFXlnGbfJllysKDi+0JJMotkqgIxOSQgU9dn/lWkeVf8nUm3iwX2Nl3WDw9i6AUK3vBAbZZrcJpDQ/N64AVwjT07Jef30GSSmtNu2WlW7YoyW2FlWfZFQUwk867EdLYKk9VG6JgEnBiBxkY7LMo4YLQJJlAo9l/oTvJkSARDF/XtyAzM8O2t3eT/iXa6wDN3WewNmQHdPfsxChU/KtLG2Mn8i4ZqKdSlIaBZadxJmRzVS/o4yA65RTSViq60oa395Lqw0pzY4SipwE0SXXsKV+GZraGSkr/RW08wPRvqvSUkYBMA9lPx4m24az+IHmCbXA+0faxTRE9wuGeO06DIXa6QlKJ3puIyiuAVfPr736vzo2pBirS+Vxel3TMm3JKhz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";const AA=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),eA=4;function UA(A){let e=0;function t(){return A[e++]<<8|A[e++]}let l=t(),n=1,r=[0,1];for(let D=1;D>--C&1}const c=31,B=2**c,i=B>>>1,g=i>>1,E=B-1;let f=0;for(let D=0;D1;){let b=p+Z>>>1;D>>1|s(),u=u<<1^i,h=(h^i)<<1|i|1;I=u,S=1+h-u}let P=l-4;return M.map(D=>{switch(D-P){case 3:return P+65792+(A[w++]<<16|A[w++]<<8|A[w++]);case 2:return P+256+(A[w++]<<8|A[w++]);case 1:return P+A[w++];default:return D-1}})}function NA(A){let e=0;return()=>A[e++]}function rA(A){return NA(UA(kA(A)))}function kA(A){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((n,r)=>e[n.charCodeAt(0)]=r);let t=A.length,l=new Uint8Array(6*t>>3);for(let n=0,r=0,o=0,w=0;n=8&&(l[r++]=w>>(o-=8));return l}function FA(A){return A&1?~A>>1:A>>1}function JA(A,e){let t=Array(A);for(let l=0,n=0;l{let e=H(A);if(e.length)return e})}function wA(A){let e=[];for(;;){let t=A();if(t==0)break;e.push(HA(t,A))}for(;;){let t=A()-1;if(t<0)break;e.push(OA(t,A))}return e.flat()}function O(A){let e=[];for(;;){let t=A(e.length);if(!t)break;e.push(t)}return e}function sA(A,e,t){let l=Array(A).fill().map(()=>[]);for(let n=0;nl[o].push(r));return l}function HA(A,e){let t=1+e(),l=e(),n=O(e);return sA(n.length,1+A,e).flatMap((o,w)=>{let[C,...Q]=o;return Array(n[w]).fill().map((s,c)=>{let B=c*l;return[C+c*t,Q.map(i=>i+B)]})})}function OA(A,e){let t=1+e();return sA(t,1+A,e).map(n=>[n[0],n.slice(1)])}function mA(A){let e=[],t=H(A);return n(l([]),[]),e;function l(r){let o=A(),w=O(()=>{let C=H(A).map(Q=>t[Q]);if(C.length)return l(C)});return{S:o,B:w,Q:r}}function n({S:r,B:o},w,C){if(!(r&4&&C===w[w.length-1])){r&2&&(C=w[w.length-1]),r&1&&e.push(w);for(let Q of o)for(let s of Q.Q)n(Q,[...w,s],C)}}}function GA(A){return A.toString(16).toUpperCase().padStart(2,"0")}function CA(A){return`{${GA(A)}}`}function SA(A){let e=[];for(let t=0,l=A.length;t>24&255}function iA(A){return A&16777215}let j,tA,X,V;function ZA(){let A=rA(VA);j=new Map(oA(A).flatMap((e,t)=>e.map(l=>[l,t+1<<24]))),tA=new Set(H(A)),X=new Map,V=new Map;for(let[e,t]of wA(A)){if(!tA.has(e)&&t.length==2){let[l,n]=t,r=V.get(l);r||(r=new Map,V.set(l,r)),r.set(n,e)}X.set(e,t.reverse())}}function QA(A){return A>=m&&A=L&&A=K&&ex&&e0&&n(x+Q)}else{let o=X.get(r);o?t.push(...o):n(r)}if(!t.length)break;r=t.pop()}if(l&&e.length>1){let r=F(e[0]);for(let o=1;o0&&n>=o)o==0?(e.push(l,...t),t.length=0,l=w):t.push(w),n=o;else{let C=bA(l,w);C>=0?l=C:n==0&&o==0?(e.push(l),l=w):(t.push(w),n=o)}}return l>=0&&e.push(l,...t),e}function fA(A){return EA(A).map(iA)}function jA(A){return TA(EA(A))}const nA=45,gA=".",MA=65039,DA=1,d=A=>Array.from(A);function G(A,e){return A.P.has(e)||A.Q.has(e)}class XA extends Array{get is_emoji(){return!0}}let v,uA,a,W,pA,U,T,R,hA,lA,q;function y(){if(v)return;let A=rA(dA);const e=()=>H(A),t=()=>new Set(e());v=new Map(wA(A)),uA=t(),a=e(),W=new Set(e().map(s=>a[s])),a=new Set(a),pA=t(),t();let l=oA(A),n=A();const r=()=>new Set(e().flatMap(s=>l[s]).concat(e()));U=O(s=>{let c=O(A).map(B=>B+96);if(c.length){let B=s>=n;c[0]-=32,c=N(c),B&&(c=`Restricted[${c}]`);let i=r(),g=r(),E=!A();return{N:c,P:i,Q:g,M:E,R:B}}}),T=t(),R=new Map;let o=e().concat(d(T)).sort((s,c)=>s-c);o.forEach((s,c)=>{let B=A(),i=o[c]=B?o[c-B]:{V:[],M:new Map};i.V.push(s),T.has(s)||R.set(s,i)});for(let{V:s,M:c}of new Set(R.values())){let B=[];for(let g of s){let E=U.filter(M=>G(M,g)),f=B.find(({G:M})=>E.some(I=>M.has(I)));f||(f={G:new Set,V:[]},B.push(f)),f.V.push(g),E.forEach(M=>f.G.add(M))}let i=B.flatMap(g=>d(g.G));for(let{G:g,V:E}of B){let f=new Set(i.filter(M=>!g.has(M)));for(let M of E)c.set(M,f)}}let w=new Set,C=new Set;const Q=s=>w.has(s)?C.add(s):w.add(s);for(let s of U){for(let c of s.P)Q(c);for(let c of s.Q)Q(c)}for(let s of w)!R.has(s)&&!C.has(s)&&R.set(s,DA);hA=new Set(d(w).concat(d(fA(w)))),lA=mA(A).map(s=>XA.from(s)).sort(PA),q=new Map;for(let s of lA){let c=[q];for(let B of s){let i=c.map(g=>{let E=g.get(B);return E||(E=new Map,g.set(B,E)),E});B===MA?c.push(...i):c=i}for(let B of c)B.V=s}}function _(A){return(aA(A)?"":`${$(Y([A]))} `)+CA(A)}function $(A){return`"${A}"‎`}function vA(A){if(A.length>=4&&A[2]==nA&&A[3]==nA)throw new Error(`invalid label extension: "${N(A.slice(0,4))}"`)}function WA(A){for(let t=A.lastIndexOf(95);t>0;)if(A[--t]!==95)throw new Error("underscore allowed only at start")}function qA(A){let e=A[0],t=AA.get(e);if(t)throw J(`leading ${t}`);let l=A.length,n=-1;for(let r=1;r{let r=SA(n),o={input:r,offset:l};l+=r.length+1;try{let w=o.tokens=le(r,e,t),C=w.length,Q;if(!C)throw new Error("empty label");let s=o.output=w.flat();if(WA(s),!(o.emoji=C>1||w[0].is_emoji)&&s.every(B=>B<128))vA(s),Q="ASCII";else{let B=w.flatMap(i=>i.is_emoji?[]:i);if(!B.length)Q="Emoji";else{if(a.has(s[0]))throw J("leading combining mark");for(let E=1;Eo.has(w)):d(o),!t.length)return}else l.push(n)}if(t){for(let n of t)if(l.every(r=>G(n,r)))throw new Error(`whole-script confusable: ${A.N}/${n.N}`)}}function ee(A){let e=U;for(let t of A){let l=e.filter(n=>G(n,t));if(!l.length)throw U.some(n=>G(n,t))?RA(e[0],t):IA(t);if(e=l,l.length==1)break}return e}function te(A){return A.map(({input:e,error:t,output:l})=>{if(t){let n=t.message;throw new Error(A.length==1?n:`Invalid label ${$(Y(e))}: ${n}`)}return N(l)}).join(gA)}function IA(A){return new Error(`disallowed character: ${_(A)}`)}function RA(A,e){let t=_(e),l=U.find(n=>n.P.has(e));return l&&(t=`${l.N} ${t}`),new Error(`illegal mixture: ${A.N} + ${t}`)}function J(A){return new Error(`illegal placement: ${A}`)}function ne(A,e){for(let t of e)if(!G(A,t))throw RA(A,t);if(A.M){let t=fA(e);for(let l=1,n=t.length;leA)throw new Error(`excessive non-spacing marks: ${$(Y(t.slice(l-1,r)))} (${r-l}/${eA})`);l=r}}}function le(A,e,t){let l=[],n=[];for(A=A.slice().reverse();A.length;){let r=oe(A);if(r)n.length&&(l.push(e(n)),n=[]),l.push(t(r));else{let o=A.pop();if(hA.has(o))n.push(o);else{let w=v.get(o);if(w)n.push(...w);else if(!uA.has(o))throw IA(o)}}}return n.length&&l.push(e(n)),l}function re(A){return A.filter(e=>e!=MA)}function oe(A,e){let t=q,l,n=A.length;for(;n&&(t=t.get(A[--n]),!!t);){let{V:r}=t;r&&(l=r,e&&e.push(...A.slice(n).reverse()),A.length=n)}return l}function we(A){return _A(A)}export{ce as getEnsAddress,Be as getEnsAvatar,ie as getEnsName,Qe as getEnsResolver,Ee as getEnsText,fe as labelhash,ge as namehash,we as normalize}; diff --git a/assets/index-YweLEVJf.js b/assets/index-YweLEVJf.js new file mode 100644 index 0000000..a8fb98f --- /dev/null +++ b/assets/index-YweLEVJf.js @@ -0,0 +1,7 @@ +import{az as fe}from"./index-iGWvbPrT.js";const me=Symbol(),ee=Object.getPrototypeOf,G=new WeakMap,ge=e=>e&&(G.has(e)?G.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),he=e=>ge(e)&&e[me]||null,te=(e,t=!0)=>{G.set(e,t)};var z={VITE_REACT_APP_PROJECT_ID:"9d80089c30635ff84b5339d993d63fa1",BASE_URL:"/real-token/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const q=e=>typeof e=="object"&&e!==null,A=new WeakMap,x=new WeakSet,be=(e=Object.is,t=(n,h)=>new Proxy(n,h),s=n=>q(n)&&!x.has(n)&&(Array.isArray(n)||!(Symbol.iterator in n))&&!(n instanceof WeakMap)&&!(n instanceof WeakSet)&&!(n instanceof Error)&&!(n instanceof Number)&&!(n instanceof Date)&&!(n instanceof String)&&!(n instanceof RegExp)&&!(n instanceof ArrayBuffer),r=n=>{switch(n.status){case"fulfilled":return n.value;case"rejected":throw n.reason;default:throw n}},l=new WeakMap,c=(n,h,I=r)=>{const y=l.get(n);if((y==null?void 0:y[0])===h)return y[1];const v=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n));return te(v,!0),l.set(n,[h,v]),Reflect.ownKeys(n).forEach(S=>{if(Object.getOwnPropertyDescriptor(v,S))return;const O=Reflect.get(n,S),M={value:O,enumerable:!0,configurable:!0};if(x.has(O))te(O,!1);else if(O instanceof Promise)delete M.value,M.get=()=>I(O);else if(A.has(O)){const[b,H]=A.get(O);M.value=c(b,H(),I)}Object.defineProperty(v,S,M)}),Object.preventExtensions(v)},m=new WeakMap,f=[1,1],W=n=>{if(!q(n))throw new Error("object required");const h=m.get(n);if(h)return h;let I=f[0];const y=new Set,v=(i,a=++f[0])=>{I!==a&&(I=a,y.forEach(o=>o(i,a)))};let S=f[1];const O=(i=++f[1])=>(S!==i&&!y.size&&(S=i,b.forEach(([a])=>{const o=a[1](i);o>I&&(I=o)})),I),M=i=>(a,o)=>{const g=[...a];g[1]=[i,...g[1]],v(g,o)},b=new Map,H=(i,a)=>{if((z?"production":void 0)!=="production"&&b.has(i))throw new Error("prop listener already exists");if(y.size){const o=a[3](M(i));b.set(i,[a,o])}else b.set(i,[a])},Z=i=>{var a;const o=b.get(i);o&&(b.delete(i),(a=o[1])==null||a.call(o))},ue=i=>(y.add(i),y.size===1&&b.forEach(([o,g],_)=>{if((z?"production":void 0)!=="production"&&g)throw new Error("remove already exists");const N=o[3](M(_));b.set(_,[o,N])}),()=>{y.delete(i),y.size===0&&b.forEach(([o,g],_)=>{g&&(g(),b.set(_,[o]))})}),J=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),$=t(J,{deleteProperty(i,a){const o=Reflect.get(i,a);Z(a);const g=Reflect.deleteProperty(i,a);return g&&v(["delete",[a],o]),g},set(i,a,o,g){const _=Reflect.has(i,a),N=Reflect.get(i,a,g);if(_&&(e(N,o)||m.has(o)&&e(N,m.get(o))))return!0;Z(a),q(o)&&(o=he(o)||o);let V=o;if(o instanceof Promise)o.then(C=>{o.status="fulfilled",o.value=C,v(["resolve",[a],C])}).catch(C=>{o.status="rejected",o.reason=C,v(["reject",[a],C])});else{!A.has(o)&&s(o)&&(V=W(o));const C=!x.has(V)&&A.get(V);C&&H(a,C)}return Reflect.set(i,a,V,g),v(["set",[a],o,N]),!0}});m.set(n,$);const pe=[J,O,c,ue];return A.set($,pe),Reflect.ownKeys(n).forEach(i=>{const a=Object.getOwnPropertyDescriptor(n,i);"value"in a&&($[i]=n[i],delete a.value,delete a.writable),Object.defineProperty(J,i,a)}),$})=>[W,A,x,e,t,s,r,l,c,m,f],[ye]=be();function j(e={}){return ye(e)}function D(e,t,s){const r=A.get(e);(z?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");let l;const c=[],m=r[3];let f=!1;const n=m(h=>{if(c.push(h),s){t(c.splice(0));return}l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,n()}}function ve(e,t){const s=A.get(e);(z?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[r,l,c]=s;return c(r,l(),t)}const d=j({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),de={state:d,subscribe(e){return D(d,()=>e(d))},push(e,t){e!==d.view&&(d.view=e,t&&(d.data=t),d.history.push(e))},reset(e){d.view=e,d.history=[e]},replace(e){d.history.length>1&&(d.history[d.history.length-1]=e,d.view=e)},goBack(){if(d.history.length>1){d.history.pop();const[e]=d.history.slice(-1);d.view=e}},setData(e){d.data=e}},p={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return p.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return p.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},formatNativeUrl(e,t,s){if(p.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!p.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let r=e;r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(p.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(p.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(p.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(p.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=de.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},we=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),u=j({enabled:we,userSessionId:"",events:[],connectedWalletId:void 0}),Ie={state:u,subscribe(e){return D(u.events,()=>e(ve(u.events[u.events.length-1])))},initialize(){u.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(u.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){u.connectedWalletId=e},click(e){if(u.enabled){const t={type:"CLICK",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}},track(e){if(u.enabled){const t={type:"TRACK",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}},view(e){if(u.enabled){const t={type:"VIEW",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}}},E=j({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),w={state:E,subscribe(e){return D(E,()=>e(E))},setChains(e){E.chains=e},setWalletConnectUri(e){E.walletConnectUri=e},setIsCustomDesktop(e){E.isCustomDesktop=e},setIsCustomMobile(e){E.isCustomMobile=e},setIsDataLoaded(e){E.isDataLoaded=e},setIsUiLoaded(e){E.isUiLoaded=e},setIsAuth(e){E.isAuth=e}},B=j({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}),T={state:B,subscribe(e){return D(B,()=>e(B))},setConfig(e){var t,s;Ie.initialize(),w.setChains(e.chains),w.setIsAuth(!!e.enableAuthMode),w.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),w.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),p.setModalVersionInStorage(),Object.assign(B,e)}};var Ee=Object.defineProperty,se=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,We=(e,t)=>{for(var s in t||(t={}))Le.call(t,s)&&ne(e,s,t[s]);if(se)for(var s of se(t))Oe.call(t,s)&&ne(e,s,t[s]);return e};const Q="https://explorer-api.walletconnect.com",X="wcm",Y="js-2.6.2";async function K(e,t){const s=We({sdkType:X,sdkVersion:Y},t),r=new URL(e,Q);return r.searchParams.append("projectId",T.state.projectId),Object.entries(s).forEach(([l,c])=>{c&&r.searchParams.append(l,String(c))}),(await fetch(r)).json()}const P={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${Q}/w3m/v1/getWalletImage/${e}?projectId=${T.state.projectId}&sdkType=${X}&sdkVersion=${Y}`},getAssetImageUrl(e){return`${Q}/w3m/v1/getAssetImage/${e}?projectId=${T.state.projectId}&sdkType=${X}&sdkVersion=${Y}`}};var Ce=Object.defineProperty,oe=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Me=(e,t)=>{for(var s in t||(t={}))Ae.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))je.call(t,s)&&re(e,s,t[s]);return e};const ae=p.isMobile(),L=j({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Re={state:L,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=T.state;if(e==="NONE"||t==="ALL"&&!e)return L.recomendedWallets;if(p.isArray(e)){const s={recommendedIds:e.join(",")},{listings:r}=await P.getAllListings(s),l=Object.values(r);l.sort((c,m)=>{const f=e.indexOf(c.id),W=e.indexOf(m.id);return f-W}),L.recomendedWallets=l}else{const{chains:s,isAuth:r}=w.state,l=s==null?void 0:s.join(","),c=p.isArray(t),m={page:1,sdks:r?"auth_v1":void 0,entries:p.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=ae?await P.getMobileListings(m):await P.getDesktopListings(m);L.recomendedWallets=Object.values(f)}return L.recomendedWallets},async getWallets(e){const t=Me({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:r}=T.state,{recomendedWallets:l}=L;if(r==="ALL")return L.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):p.isArray(s)&&(t.excludedIds=s.join(",")),p.isArray(r)&&(t.excludedIds=[t.excludedIds,r].filter(Boolean).join(",")),w.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:m}=e,{listings:f,total:W}=ae?await P.getMobileListings(t):await P.getDesktopListings(t),n=Object.values(f),h=m?"search":"wallets";return L[h]={listings:[...L[h].listings,...n],total:W,page:c??1},{listings:n,total:W}},getWalletImageUrl(e){return P.getWalletImageUrl(e)},getAssetImageUrl(e){return P.getAssetImageUrl(e)},resetSearch(){L.search={listings:[],total:0,page:1}}},k=j({open:!1}),F={state:k,subscribe(e){return D(k,()=>e(k))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:r}=w.state;if(p.removeWalletConnectDeepLink(),w.setWalletConnectUri(e==null?void 0:e.uri),w.setChains(e==null?void 0:e.chains),de.reset("ConnectWallet"),s&&r)k.open=!0,t();else{const l=setInterval(()=>{const c=w.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),k.open=!0,t())},200)}})},close(){k.open=!1}};var Pe=Object.defineProperty,ie=Object.getOwnPropertySymbols,Ue=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable,le=(e,t,s)=>t in e?Pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Se=(e,t)=>{for(var s in t||(t={}))Ue.call(t,s)&&le(e,s,t[s]);if(ie)for(var s of ie(t))De.call(t,s)&&le(e,s,t[s]);return e};function _e(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const R=j({themeMode:_e()?"dark":"light"}),ce={state:R,subscribe(e){return D(R,()=>e(R))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(R.themeMode=t),s&&(R.themeVariables=Se({},s))}},U=j({open:!1,message:"",variant:"success"}),$e={state:U,subscribe(e){return D(U,()=>e(U))},openToast(e,t){U.open=!0,U.message=e,U.variant=t},closeToast(){U.open=!1}};class ke{constructor(t){this.openModal=F.open,this.closeModal=F.close,this.subscribeModal=F.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),T.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await fe(()=>import("./index-kEqCFnDY.js"),__vite__mapDeps([0,1,2,3]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),w.setIsUiLoaded(!0)}}}const Ve=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:ke},Symbol.toStringTag,{value:"Module"}));export{Ie as R,de as T,p as a,Ve as i,ce as n,$e as o,w as p,F as s,Re as t,T as y}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/index-kEqCFnDY.js","assets/browser-BNgg9dRV.js","assets/index-iGWvbPrT.js","assets/index-qK5f71Lf.css"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/assets/index-i7WuWpn4.js b/assets/index-iGWvbPrT.js similarity index 96% rename from assets/index-i7WuWpn4.js rename to assets/index-iGWvbPrT.js index 742ba5c..0bbeef7 100644 --- a/assets/index-i7WuWpn4.js +++ b/assets/index-iGWvbPrT.js @@ -148,7 +148,7 @@ Error generating stack: `+i.message+` animation-iteration-count: infinite; animation-delay: 200ms; } -`),Ne.rippleVisible,fj,pd,({theme:u})=>u.transitions.easing.easeInOut,Ne.ripplePulsate,({theme:u})=>u.transitions.duration.shorter,Ne.child,Ne.childLeaving,pj,pd,({theme:u})=>u.transitions.easing.easeInOut,Ne.childPulsate,Cj,({theme:u})=>u.transitions.easing.easeInOut),Aj=w.forwardRef(function(e,t){const n=Xn({props:e,name:"MuiTouchRipple"}),{center:r=!1,classes:i={},className:a}=n,o=_0(n,Ej),[s,l]=w.useState([]),c=w.useRef(0),E=w.useRef(null);w.useEffect(()=>{E.current&&(E.current(),E.current=null)},[s]);const d=w.useRef(!1),f=w.useRef(0),p=w.useRef(null),C=w.useRef(null);w.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]);const v=w.useCallback(B=>{const{pulsate:D,rippleX:F,rippleY:h,rippleSize:b,cb:T}=B;l(k=>[...k,ku.jsx(mj,{classes:{ripple:$0(i.ripple,Ne.ripple),rippleVisible:$0(i.rippleVisible,Ne.rippleVisible),ripplePulsate:$0(i.ripplePulsate,Ne.ripplePulsate),child:$0(i.child,Ne.child),childLeaving:$0(i.childLeaving,Ne.childLeaving),childPulsate:$0(i.childPulsate,Ne.childPulsate)},timeout:pd,pulsate:D,rippleX:F,rippleY:h,rippleSize:b},c.current)]),c.current+=1,E.current=T},[i]),A=w.useCallback((B={},D={},F=()=>{})=>{const{pulsate:h=!1,center:b=r||D.pulsate,fakeElement:T=!1}=D;if((B==null?void 0:B.type)==="mousedown"&&d.current){d.current=!1;return}(B==null?void 0:B.type)==="touchstart"&&(d.current=!0);const k=T?null:C.current,L=k?k.getBoundingClientRect():{width:0,height:0,left:0,top:0};let Q,Z,tu;if(b||B===void 0||B.clientX===0&&B.clientY===0||!B.clientX&&!B.touches)Q=Math.round(L.width/2),Z=Math.round(L.height/2);else{const{clientX:q,clientY:V}=B.touches&&B.touches.length>0?B.touches[0]:B;Q=Math.round(q-L.left),Z=Math.round(V-L.top)}if(b)tu=Math.sqrt((2*L.width**2+L.height**2)/3),tu%2===0&&(tu+=1);else{const q=Math.max(Math.abs((k?k.clientWidth:0)-Q),Q)*2+2,V=Math.max(Math.abs((k?k.clientHeight:0)-Z),Z)*2+2;tu=Math.sqrt(q**2+V**2)}B!=null&&B.touches?p.current===null&&(p.current=()=>{v({pulsate:h,rippleX:Q,rippleY:Z,rippleSize:tu,cb:F})},f.current=setTimeout(()=>{p.current&&(p.current(),p.current=null)},dj)):v({pulsate:h,rippleX:Q,rippleY:Z,rippleSize:tu,cb:F})},[r,v]),m=w.useCallback(()=>{A({},{pulsate:!0})},[A]),g=w.useCallback((B,D)=>{if(clearTimeout(f.current),(B==null?void 0:B.type)==="touchend"&&p.current){p.current(),p.current=null,f.current=setTimeout(()=>{g(B,D)});return}p.current=null,l(F=>F.length>0?F.slice(1):F),E.current=D},[]);return w.useImperativeHandle(t,()=>({pulsate:m,start:A,stop:g}),[m,A,g]),ku.jsx(hj,lu({className:$0(Ne.root,i.root,a),ref:C},o,{children:ku.jsx(sj,{component:null,exit:!0,children:s})}))}),gj=Aj;function vj(u){return Mr("MuiButtonBase",u)}const Bj=Lr("MuiButtonBase",["root","disabled","focusVisible"]),Fj=Bj,yj=["action","centerRipple","children","className","component","disabled","disableRipple","disableTouchRipple","focusRipple","focusVisibleClassName","LinkComponent","onBlur","onClick","onContextMenu","onDragLeave","onFocus","onFocusVisible","onKeyDown","onKeyUp","onMouseDown","onMouseLeave","onMouseUp","onTouchEnd","onTouchMove","onTouchStart","tabIndex","TouchRippleProps","touchRippleRef","type"],Dj=u=>{const{disabled:e,focusVisible:t,focusVisibleClassName:n,classes:r}=u,a=Ia({root:["root",e&&"disabled",t&&"focusVisible"]},vj,r);return t&&n&&(a.root+=` ${n}`),a},bj=Tt("button",{name:"MuiButtonBase",slot:"Root",overridesResolver:(u,e)=>e.root})({display:"inline-flex",alignItems:"center",justifyContent:"center",position:"relative",boxSizing:"border-box",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none",textDecoration:"none",color:"inherit","&::-moz-focus-inner":{borderStyle:"none"},[`&.${Fj.disabled}`]:{pointerEvents:"none",cursor:"default"},"@media print":{colorAdjust:"exact"}}),wj=w.forwardRef(function(e,t){const n=Xn({props:e,name:"MuiButtonBase"}),{action:r,centerRipple:i=!1,children:a,className:o,component:s="button",disabled:l=!1,disableRipple:c=!1,disableTouchRipple:E=!1,focusRipple:d=!1,LinkComponent:f="a",onBlur:p,onClick:C,onContextMenu:v,onDragLeave:A,onFocus:m,onFocusVisible:g,onKeyDown:B,onKeyUp:D,onMouseDown:F,onMouseLeave:h,onMouseUp:b,onTouchEnd:T,onTouchMove:k,onTouchStart:L,tabIndex:Q=0,TouchRippleProps:Z,touchRippleRef:tu,type:q}=n,V=_0(n,yj),G=w.useRef(null),W=w.useRef(null),M=Lh(W,tu),{isFocusVisibleRef:j,onFocus:Y,onBlur:uu,ref:J}=PP(),[U,fu]=w.useState(!1);l&&U&&fu(!1),w.useImperativeHandle(r,()=>({focusVisible:()=>{fu(!0),G.current.focus()}}),[]);const[gu,yu]=w.useState(!1);w.useEffect(()=>{yu(!0)},[]);const Bu=gu&&!c&&!l;w.useEffect(()=>{U&&d&&!c&&gu&&W.current.pulsate()},[c,d,U,gu]);function hu(au,Ou,bu=E){return Ws(du=>(Ou&&Ou(du),!bu&&W.current&&W.current[au](du),!0))}const x=hu("start",F),_=hu("stop",v),S=hu("stop",A),z=hu("stop",b),O=hu("stop",au=>{U&&au.preventDefault(),h&&h(au)}),$=hu("start",L),H=hu("stop",T),I=hu("stop",k),R=hu("stop",au=>{uu(au),j.current===!1&&fu(!1),p&&p(au)},!1),K=Ws(au=>{G.current||(G.current=au.currentTarget),Y(au),j.current===!0&&(fu(!0),g&&g(au)),m&&m(au)}),N=()=>{const au=G.current;return s&&s!=="button"&&!(au.tagName==="A"&&au.href)},X=w.useRef(!1),iu=Ws(au=>{d&&!X.current&&U&&W.current&&au.key===" "&&(X.current=!0,W.current.stop(au,()=>{W.current.start(au)})),au.target===au.currentTarget&&N()&&au.key===" "&&au.preventDefault(),B&&B(au),au.target===au.currentTarget&&N()&&au.key==="Enter"&&!l&&(au.preventDefault(),C&&C(au))}),su=Ws(au=>{d&&au.key===" "&&W.current&&U&&!au.defaultPrevented&&(X.current=!1,W.current.stop(au,()=>{W.current.pulsate(au)})),D&&D(au),C&&au.target===au.currentTarget&&N()&&au.key===" "&&!au.defaultPrevented&&C(au)});let Fu=s;Fu==="button"&&(V.href||V.to)&&(Fu=f);const ou={};Fu==="button"?(ou.type=q===void 0?"button":q,ou.disabled=l):(!V.href&&!V.to&&(ou.role="button"),l&&(ou["aria-disabled"]=l));const pu=Lh(t,J,G),nu=lu({},n,{centerRipple:i,component:s,disabled:l,disableRipple:c,disableTouchRipple:E,focusRipple:d,tabIndex:Q,focusVisible:U}),Eu=Dj(nu);return ku.jsxs(bj,lu({as:Fu,className:$0(Eu.root,o),ownerState:nu,onBlur:R,onClick:C,onContextMenu:_,onFocus:K,onKeyDown:iu,onKeyUp:su,onMouseDown:x,onMouseLeave:O,onMouseUp:z,onDragLeave:S,onTouchEnd:H,onTouchMove:I,onTouchStart:$,ref:pu,tabIndex:l?-1:Q,type:q},ou,V,{children:[a,Bu?ku.jsx(gj,lu({ref:M,center:i},Z)):null]}))}),xj=wj;function kj(u){return Mr("MuiButton",u)}const _j=Lr("MuiButton",["root","text","textInherit","textPrimary","textSecondary","textSuccess","textError","textInfo","textWarning","outlined","outlinedInherit","outlinedPrimary","outlinedSecondary","outlinedSuccess","outlinedError","outlinedInfo","outlinedWarning","contained","containedInherit","containedPrimary","containedSecondary","containedSuccess","containedError","containedInfo","containedWarning","disableElevation","focusVisible","disabled","colorInherit","textSizeSmall","textSizeMedium","textSizeLarge","outlinedSizeSmall","outlinedSizeMedium","outlinedSizeLarge","containedSizeSmall","containedSizeMedium","containedSizeLarge","sizeMedium","sizeSmall","sizeLarge","fullWidth","startIcon","endIcon","iconSizeSmall","iconSizeMedium","iconSizeLarge"]),qs=_j,Sj=w.createContext({}),Tj=Sj,Pj=w.createContext(void 0),Oj=Pj,Ij=["children","color","component","className","disabled","disableElevation","disableFocusRipple","endIcon","focusVisibleClassName","fullWidth","size","startIcon","type","variant"],zj=u=>{const{color:e,disableElevation:t,fullWidth:n,size:r,variant:i,classes:a}=u,o={root:["root",i,`${i}${p0(e)}`,`size${p0(r)}`,`${i}Size${p0(r)}`,e==="inherit"&&"colorInherit",t&&"disableElevation",n&&"fullWidth"],label:["label"],startIcon:["startIcon",`iconSize${p0(r)}`],endIcon:["endIcon",`iconSize${p0(r)}`]},s=Ia(o,kj,a);return lu({},a,s)},qB=u=>lu({},u.size==="small"&&{"& > *:nth-of-type(1)":{fontSize:18}},u.size==="medium"&&{"& > *:nth-of-type(1)":{fontSize:20}},u.size==="large"&&{"& > *:nth-of-type(1)":{fontSize:22}}),jj=Tt(xj,{shouldForwardProp:u=>UB(u)||u==="classes",name:"MuiButton",slot:"Root",overridesResolver:(u,e)=>{const{ownerState:t}=u;return[e.root,e[t.variant],e[`${t.variant}${p0(t.color)}`],e[`size${p0(t.size)}`],e[`${t.variant}Size${p0(t.size)}`],t.color==="inherit"&&e.colorInherit,t.disableElevation&&e.disableElevation,t.fullWidth&&e.fullWidth]}})(({theme:u,ownerState:e})=>{var t,n;const r=u.palette.mode==="light"?u.palette.grey[300]:u.palette.grey[800],i=u.palette.mode==="light"?u.palette.grey.A100:u.palette.grey[700];return lu({},u.typography.button,{minWidth:64,padding:"6px 16px",borderRadius:(u.vars||u).shape.borderRadius,transition:u.transitions.create(["background-color","box-shadow","border-color","color"],{duration:u.transitions.duration.short}),"&:hover":lu({textDecoration:"none",backgroundColor:u.vars?`rgba(${u.vars.palette.text.primaryChannel} / ${u.vars.palette.action.hoverOpacity})`:Pi(u.palette.text.primary,u.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},e.variant==="text"&&e.color!=="inherit"&&{backgroundColor:u.vars?`rgba(${u.vars.palette[e.color].mainChannel} / ${u.vars.palette.action.hoverOpacity})`:Pi(u.palette[e.color].main,u.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},e.variant==="outlined"&&e.color!=="inherit"&&{border:`1px solid ${(u.vars||u).palette[e.color].main}`,backgroundColor:u.vars?`rgba(${u.vars.palette[e.color].mainChannel} / ${u.vars.palette.action.hoverOpacity})`:Pi(u.palette[e.color].main,u.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},e.variant==="contained"&&{backgroundColor:u.vars?u.vars.palette.Button.inheritContainedHoverBg:i,boxShadow:(u.vars||u).shadows[4],"@media (hover: none)":{boxShadow:(u.vars||u).shadows[2],backgroundColor:(u.vars||u).palette.grey[300]}},e.variant==="contained"&&e.color!=="inherit"&&{backgroundColor:(u.vars||u).palette[e.color].dark,"@media (hover: none)":{backgroundColor:(u.vars||u).palette[e.color].main}}),"&:active":lu({},e.variant==="contained"&&{boxShadow:(u.vars||u).shadows[8]}),[`&.${qs.focusVisible}`]:lu({},e.variant==="contained"&&{boxShadow:(u.vars||u).shadows[6]}),[`&.${qs.disabled}`]:lu({color:(u.vars||u).palette.action.disabled},e.variant==="outlined"&&{border:`1px solid ${(u.vars||u).palette.action.disabledBackground}`},e.variant==="contained"&&{color:(u.vars||u).palette.action.disabled,boxShadow:(u.vars||u).shadows[0],backgroundColor:(u.vars||u).palette.action.disabledBackground})},e.variant==="text"&&{padding:"6px 8px"},e.variant==="text"&&e.color!=="inherit"&&{color:(u.vars||u).palette[e.color].main},e.variant==="outlined"&&{padding:"5px 15px",border:"1px solid currentColor"},e.variant==="outlined"&&e.color!=="inherit"&&{color:(u.vars||u).palette[e.color].main,border:u.vars?`1px solid rgba(${u.vars.palette[e.color].mainChannel} / 0.5)`:`1px solid ${Pi(u.palette[e.color].main,.5)}`},e.variant==="contained"&&{color:u.vars?u.vars.palette.text.primary:(t=(n=u.palette).getContrastText)==null?void 0:t.call(n,u.palette.grey[300]),backgroundColor:u.vars?u.vars.palette.Button.inheritContainedBg:r,boxShadow:(u.vars||u).shadows[2]},e.variant==="contained"&&e.color!=="inherit"&&{color:(u.vars||u).palette[e.color].contrastText,backgroundColor:(u.vars||u).palette[e.color].main},e.color==="inherit"&&{color:"inherit",borderColor:"currentColor"},e.size==="small"&&e.variant==="text"&&{padding:"4px 5px",fontSize:u.typography.pxToRem(13)},e.size==="large"&&e.variant==="text"&&{padding:"8px 11px",fontSize:u.typography.pxToRem(15)},e.size==="small"&&e.variant==="outlined"&&{padding:"3px 9px",fontSize:u.typography.pxToRem(13)},e.size==="large"&&e.variant==="outlined"&&{padding:"7px 21px",fontSize:u.typography.pxToRem(15)},e.size==="small"&&e.variant==="contained"&&{padding:"4px 10px",fontSize:u.typography.pxToRem(13)},e.size==="large"&&e.variant==="contained"&&{padding:"8px 22px",fontSize:u.typography.pxToRem(15)},e.fullWidth&&{width:"100%"})},({ownerState:u})=>u.disableElevation&&{boxShadow:"none","&:hover":{boxShadow:"none"},[`&.${qs.focusVisible}`]:{boxShadow:"none"},"&:active":{boxShadow:"none"},[`&.${qs.disabled}`]:{boxShadow:"none"}}),Rj=Tt("span",{name:"MuiButton",slot:"StartIcon",overridesResolver:(u,e)=>{const{ownerState:t}=u;return[e.startIcon,e[`iconSize${p0(t.size)}`]]}})(({ownerState:u})=>lu({display:"inherit",marginRight:8,marginLeft:-4},u.size==="small"&&{marginLeft:-2},qB(u))),Nj=Tt("span",{name:"MuiButton",slot:"EndIcon",overridesResolver:(u,e)=>{const{ownerState:t}=u;return[e.endIcon,e[`iconSize${p0(t.size)}`]]}})(({ownerState:u})=>lu({display:"inherit",marginRight:-4,marginLeft:8},u.size==="small"&&{marginRight:-2},qB(u))),$j=w.forwardRef(function(e,t){const n=w.useContext(Tj),r=w.useContext(Oj),i=Df(n,e),a=Xn({props:i,name:"MuiButton"}),{children:o,color:s="primary",component:l="button",className:c,disabled:E=!1,disableElevation:d=!1,disableFocusRipple:f=!1,endIcon:p,focusVisibleClassName:C,fullWidth:v=!1,size:A="medium",startIcon:m,type:g,variant:B="text"}=a,D=_0(a,Ij),F=lu({},a,{color:s,component:l,disabled:E,disableElevation:d,disableFocusRipple:f,fullWidth:v,size:A,type:g,variant:B}),h=zj(F),b=m&&ku.jsx(Rj,{className:h.startIcon,ownerState:F,children:m}),T=p&&ku.jsx(Nj,{className:h.endIcon,ownerState:F,children:p}),k=r||"";return ku.jsxs(jj,lu({ownerState:F,className:$0(n.className,h.root,c,k),component:l,disabled:E,focusRipple:!f,focusVisibleClassName:$0(h.focusVisible,C),ref:t,type:g},D,{classes:h,children:[b,o,T]}))}),Mj=$j,Lj=u=>{let e;return u<1?e=5.11916*u**2:e=4.5*Math.log(u+1)+2,(e/100).toFixed(2)},h8=Lj;function Wj(u){return Mr("MuiPaper",u)}Lr("MuiPaper",["root","rounded","outlined","elevation","elevation0","elevation1","elevation2","elevation3","elevation4","elevation5","elevation6","elevation7","elevation8","elevation9","elevation10","elevation11","elevation12","elevation13","elevation14","elevation15","elevation16","elevation17","elevation18","elevation19","elevation20","elevation21","elevation22","elevation23","elevation24"]);const Uj=["className","component","elevation","square","variant"],qj=u=>{const{square:e,elevation:t,variant:n,classes:r}=u,i={root:["root",n,!e&&"rounded",n==="elevation"&&`elevation${t}`]};return Ia(i,Wj,r)},Hj=Tt("div",{name:"MuiPaper",slot:"Root",overridesResolver:(u,e)=>{const{ownerState:t}=u;return[e.root,e[t.variant],!t.square&&e.rounded,t.variant==="elevation"&&e[`elevation${t.elevation}`]]}})(({theme:u,ownerState:e})=>{var t;return lu({backgroundColor:(u.vars||u).palette.background.paper,color:(u.vars||u).palette.text.primary,transition:u.transitions.create("box-shadow")},!e.square&&{borderRadius:u.shape.borderRadius},e.variant==="outlined"&&{border:`1px solid ${(u.vars||u).palette.divider}`},e.variant==="elevation"&&lu({boxShadow:(u.vars||u).shadows[e.elevation]},!u.vars&&u.palette.mode==="dark"&&{backgroundImage:`linear-gradient(${Pi("#fff",h8(e.elevation))}, ${Pi("#fff",h8(e.elevation))})`},u.vars&&{backgroundImage:(t=u.vars.overlays)==null?void 0:t[e.elevation]}))}),Kj=w.forwardRef(function(e,t){const n=Xn({props:e,name:"MuiPaper"}),{className:r,component:i="div",elevation:a=1,square:o=!1,variant:s="elevation"}=n,l=_0(n,Uj),c=lu({},n,{component:i,elevation:a,square:o,variant:s}),E=qj(c);return ku.jsx(Hj,lu({as:i,ownerState:c,className:$0(E.root,r),ref:t},l))}),Vj=Kj;function Gj(u){return Mr("MuiAppBar",u)}Lr("MuiAppBar",["root","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorPrimary","colorSecondary","colorInherit","colorTransparent","colorError","colorInfo","colorSuccess","colorWarning"]);const Qj=["className","color","enableColorOnDark","position"],Xj=u=>{const{color:e,position:t,classes:n}=u,r={root:["root",`color${p0(e)}`,`position${p0(t)}`]};return Ia(r,Gj,n)},Hs=(u,e)=>u?`${u==null?void 0:u.replace(")","")}, ${e})`:e,Yj=Tt(Vj,{name:"MuiAppBar",slot:"Root",overridesResolver:(u,e)=>{const{ownerState:t}=u;return[e.root,e[`position${p0(t.position)}`],e[`color${p0(t.color)}`]]}})(({theme:u,ownerState:e})=>{const t=u.palette.mode==="light"?u.palette.grey[100]:u.palette.grey[900];return lu({display:"flex",flexDirection:"column",width:"100%",boxSizing:"border-box",flexShrink:0},e.position==="fixed"&&{position:"fixed",zIndex:(u.vars||u).zIndex.appBar,top:0,left:"auto",right:0,"@media print":{position:"absolute"}},e.position==="absolute"&&{position:"absolute",zIndex:(u.vars||u).zIndex.appBar,top:0,left:"auto",right:0},e.position==="sticky"&&{position:"sticky",zIndex:(u.vars||u).zIndex.appBar,top:0,left:"auto",right:0},e.position==="static"&&{position:"static"},e.position==="relative"&&{position:"relative"},!u.vars&&lu({},e.color==="default"&&{backgroundColor:t,color:u.palette.getContrastText(t)},e.color&&e.color!=="default"&&e.color!=="inherit"&&e.color!=="transparent"&&{backgroundColor:u.palette[e.color].main,color:u.palette[e.color].contrastText},e.color==="inherit"&&{color:"inherit"},u.palette.mode==="dark"&&!e.enableColorOnDark&&{backgroundColor:null,color:null},e.color==="transparent"&&lu({backgroundColor:"transparent",color:"inherit"},u.palette.mode==="dark"&&{backgroundImage:"none"})),u.vars&&lu({},e.color==="default"&&{"--AppBar-background":e.enableColorOnDark?u.vars.palette.AppBar.defaultBg:Hs(u.vars.palette.AppBar.darkBg,u.vars.palette.AppBar.defaultBg),"--AppBar-color":e.enableColorOnDark?u.vars.palette.text.primary:Hs(u.vars.palette.AppBar.darkColor,u.vars.palette.text.primary)},e.color&&!e.color.match(/^(default|inherit|transparent)$/)&&{"--AppBar-background":e.enableColorOnDark?u.vars.palette[e.color].main:Hs(u.vars.palette.AppBar.darkBg,u.vars.palette[e.color].main),"--AppBar-color":e.enableColorOnDark?u.vars.palette[e.color].contrastText:Hs(u.vars.palette.AppBar.darkColor,u.vars.palette[e.color].contrastText)},{backgroundColor:"var(--AppBar-background)",color:e.color==="inherit"?"inherit":"var(--AppBar-color)"},e.color==="transparent"&&{backgroundImage:"none",backgroundColor:"transparent",color:"inherit"}))}),Zj=w.forwardRef(function(e,t){const n=Xn({props:e,name:"MuiAppBar"}),{className:r,color:i="primary",enableColorOnDark:a=!1,position:o="fixed"}=n,s=_0(n,Qj),l=lu({},n,{color:i,position:o,enableColorOnDark:a}),c=Xj(l);return ku.jsx(Yj,lu({square:!0,component:"header",ownerState:l,elevation:4,className:$0(c.root,r,o==="fixed"&&"mui-fixed"),ref:t},s))}),Jj=Zj;function uR(u){return Mr("MuiToolbar",u)}Lr("MuiToolbar",["root","gutters","regular","dense"]);const eR=["className","component","disableGutters","variant"],tR=u=>{const{classes:e,disableGutters:t,variant:n}=u;return Ia({root:["root",!t&&"gutters",n]},uR,e)},nR=Tt("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(u,e)=>{const{ownerState:t}=u;return[e.root,!t.disableGutters&&e.gutters,e[t.variant]]}})(({theme:u,ownerState:e})=>lu({position:"relative",display:"flex",alignItems:"center"},!e.disableGutters&&{paddingLeft:u.spacing(2),paddingRight:u.spacing(2),[u.breakpoints.up("sm")]:{paddingLeft:u.spacing(3),paddingRight:u.spacing(3)}},e.variant==="dense"&&{minHeight:48}),({theme:u,ownerState:e})=>e.variant==="regular"&&u.mixins.toolbar),rR=w.forwardRef(function(e,t){const n=Xn({props:e,name:"MuiToolbar"}),{className:r,component:i="div",disableGutters:a=!1,variant:o="regular"}=n,s=_0(n,eR),l=lu({},n,{component:i,disableGutters:a,variant:o}),c=tR(l);return ku.jsx(nR,lu({as:i,className:$0(c.root,r),ref:t,ownerState:l},s))}),iR=rR,aR=Az({createStyledComponent:Tt("div",{name:"MuiContainer",slot:"Root",overridesResolver:(u,e)=>{const{ownerState:t}=u;return[e.root,e[`maxWidth${p0(String(t.maxWidth))}`],t.fixed&&e.fixed,t.disableGutters&&e.disableGutters]}}),useThemeProps:u=>Xn({props:u,name:"MuiContainer"})}),oR=aR,sR=["theme"];function lR(u){let{theme:e}=u,t=_0(u,sR);const n=e[ta];return ku.jsx(dz,lu({},t,{themeId:n?ta:void 0,theme:n||e}))}const cR=Lr("MuiBox",["root"]),ER=cR,dR=$f(),fR=WI({themeId:ta,defaultTheme:dR,defaultClassName:ER.root,generateClassName:pB.generate}),m8=fR,pR="/logo.svg",CR="modulepreload",hR=function(u){return"/"+u},A8={},xu=function(e,t,n){if(!t||t.length===0)return e();const r=document.getElementsByTagName("link");return Promise.all(t.map(i=>{if(i=hR(i),i in A8)return;A8[i]=!0;const a=i.endsWith(".css"),o=a?'[rel="stylesheet"]':"";if(!!n)for(let c=r.length-1;c>=0;c--){const E=r[c];if(E.href===i&&(!a||E.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${o}`))return;const l=document.createElement("link");if(l.rel=a?"stylesheet":CR,a||(l.as="script",l.crossOrigin=""),l.href=i,document.head.appendChild(l),a)return new Promise((c,E)=>{l.addEventListener("load",c),l.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>e()).catch(i=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i})};var g8='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',mR={rounded:`SFRounded, ui-rounded, "SF Pro Rounded", ${g8}`,system:g8},Fo={large:{actionButton:"9999px",connectButton:"12px",modal:"24px",modalMobile:"28px"},medium:{actionButton:"10px",connectButton:"8px",modal:"16px",modalMobile:"18px"},none:{actionButton:"0px",connectButton:"0px",modal:"0px",modalMobile:"0px"},small:{actionButton:"4px",connectButton:"4px",modal:"8px",modalMobile:"8px"}},AR={large:{modalOverlay:"blur(20px)"},none:{modalOverlay:"blur(0px)"},small:{modalOverlay:"blur(4px)"}},gR=({borderRadius:u="large",fontStack:e="rounded",overlayBlur:t="none"})=>({blurs:{modalOverlay:AR[t].modalOverlay},fonts:{body:mR[e]},radii:{actionButton:Fo[u].actionButton,connectButton:Fo[u].connectButton,menuButton:Fo[u].connectButton,modal:Fo[u].modal,modalMobile:Fo[u].modalMobile}}),HB={blue:{accentColor:"#0E76FD",accentColorForeground:"#FFF"},green:{accentColor:"#1DB847",accentColorForeground:"#FFF"},orange:{accentColor:"#FF801F",accentColorForeground:"#FFF"},pink:{accentColor:"#FF5CA0",accentColorForeground:"#FFF"},purple:{accentColor:"#5F5AFA",accentColorForeground:"#FFF"},red:{accentColor:"#FA423C",accentColorForeground:"#FFF"}},v8=HB.blue,KB=({accentColor:u=v8.accentColor,accentColorForeground:e=v8.accentColorForeground,...t}={})=>({...gR(t),colors:{accentColor:u,accentColorForeground:e,actionButtonBorder:"rgba(0, 0, 0, 0.04)",actionButtonBorderMobile:"rgba(0, 0, 0, 0.06)",actionButtonSecondaryBackground:"rgba(0, 0, 0, 0.06)",closeButton:"rgba(60, 66, 66, 0.8)",closeButtonBackground:"rgba(0, 0, 0, 0.06)",connectButtonBackground:"#FFF",connectButtonBackgroundError:"#FF494A",connectButtonInnerBackground:"linear-gradient(0deg, rgba(0, 0, 0, 0.03), rgba(0, 0, 0, 0.06))",connectButtonText:"#25292E",connectButtonTextError:"#FFF",connectionIndicator:"#30E000",downloadBottomCardBackground:"linear-gradient(126deg, rgba(255, 255, 255, 0) 9.49%, rgba(171, 171, 171, 0.04) 71.04%), #FFFFFF",downloadTopCardBackground:"linear-gradient(126deg, rgba(171, 171, 171, 0.2) 9.49%, rgba(255, 255, 255, 0) 71.04%), #FFFFFF",error:"#FF494A",generalBorder:"rgba(0, 0, 0, 0.06)",generalBorderDim:"rgba(0, 0, 0, 0.03)",menuItemBackground:"rgba(60, 66, 66, 0.1)",modalBackdrop:"rgba(0, 0, 0, 0.3)",modalBackground:"#FFF",modalBorder:"transparent",modalText:"#25292E",modalTextDim:"rgba(60, 66, 66, 0.3)",modalTextSecondary:"rgba(60, 66, 66, 0.6)",profileAction:"#FFF",profileActionHover:"rgba(255, 255, 255, 0.5)",profileForeground:"rgba(60, 66, 66, 0.06)",selectedOptionBorder:"rgba(60, 66, 66, 0.1)",standby:"#FFD641"},shadows:{connectButton:"0px 4px 12px rgba(0, 0, 0, 0.1)",dialog:"0px 8px 32px rgba(0, 0, 0, 0.32)",profileDetailsAction:"0px 2px 6px rgba(37, 41, 46, 0.04)",selectedOption:"0px 2px 6px rgba(0, 0, 0, 0.24)",selectedWallet:"0px 2px 6px rgba(0, 0, 0, 0.12)",walletLogo:"0px 2px 16px rgba(0, 0, 0, 0.16)"}});KB.accentColors=HB;function vR(u,e){return Object.defineProperty(u,"__recipe__",{value:e,writable:!1}),u}var VB=vR;function GB(u){var{conditions:e}=u;if(!e)throw new Error("Styles have no conditions");function t(n){if(typeof n=="string"||typeof n=="number"||typeof n=="boolean"){if(!e.defaultCondition)throw new Error("No default condition");return{[e.defaultCondition]:n}}if(Array.isArray(n)){if(!("responsiveArray"in e))throw new Error("Responsive arrays are not supported");var r={};for(var i in e.responsiveArray)n[i]!=null&&(r[e.responsiveArray[i]]=n[i]);return r}return n}return VB(t,{importPath:"@vanilla-extract/sprinkles/createUtils",importName:"createNormalizeValueFn",args:[{conditions:u.conditions}]})}function BR(u){var{conditions:e}=u;if(!e)throw new Error("Styles have no conditions");var t=GB(u);function n(r,i){if(typeof r=="string"||typeof r=="number"||typeof r=="boolean"){if(!e.defaultCondition)throw new Error("No default condition");return i(r,e.defaultCondition)}var a=Array.isArray(r)?t(r):r,o={};for(var s in a)a[s]!=null&&(o[s]=i(a[s],s));return o}return VB(n,{importPath:"@vanilla-extract/sprinkles/createUtils",importName:"createMapValueFn",args:[{conditions:u.conditions}]})}function FR(u,e,t){return e in u?Object.defineProperty(u,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):u[e]=t,u}function B8(u,e){var t=Object.keys(u);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(u);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(u,r).enumerable})),t.push.apply(t,n)}return t}function d9(u){for(var e=1;efunction(){for(var e=arguments.length,t=new Array(e),n=0;ns.styles)),i=Object.keys(r),a=i.filter(s=>"mappings"in r[s]),o=s=>{var l=[],c={},E=d9({},s),d=!1;for(var f of a){var p=s[f];if(p!=null){var C=r[f];d=!0;for(var v of C.mappings)c[v]=p,E[v]==null&&delete E[v]}}var A=d?d9(d9({},c),E):s;for(var m in A){var g=A[m],B=r[m];try{if(B.mappings)continue;if(typeof g=="string"||typeof g=="number")l.push(B.values[g].defaultClass);else if(Array.isArray(g))for(var D=0;Du,bR=function(){return yR(DR)(...arguments)};function wR({storage:u,key:e="REACT_QUERY_OFFLINE_CACHE",throttleTime:t=1e3,serialize:n=JSON.stringify,deserialize:r=JSON.parse,retry:i}){if(u){const a=o=>{try{u.setItem(e,n(o));return}catch(s){return s}};return{persistClient:xR(o=>{let s=o,l=a(s),c=0;for(;l&&s;)c++,s=i==null?void 0:i({persistedClient:s,error:l,errorCount:c}),s&&(l=a(s))},t),restoreClient:()=>{const o=u.getItem(e);if(o)return r(o)},removeClient:()=>{u.removeItem(e)}}}return{persistClient:F8,restoreClient:()=>{},removeClient:F8}}function xR(u,e=100){let t=null,n;return function(...r){n=r,t===null&&(t=setTimeout(()=>{u(...n),t=null},e))}}function F8(){}class ja{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){const t={listener:e};return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}}const g4=typeof window>"u"||"Deno"in window;function Re(){}function kR(u,e){return typeof u=="function"?u(e):u}function Cd(u){return typeof u=="number"&&u>=0&&u!==1/0}function QB(u,e){return Math.max(u+(e||0)-Date.now(),0)}function Ks(u,e,t){return M4(u)?typeof e=="function"?{...t,queryKey:u,queryFn:e}:{...e,queryKey:u}:u}function XB(u,e,t){return M4(u)?typeof e=="function"?{...t,mutationKey:u,mutationFn:e}:{...e,mutationKey:u}:typeof u=="function"?{...e,mutationFn:u}:{...u}}function gn(u,e,t){return M4(u)?[{...e,queryKey:u},t]:[u||{},e]}function y8(u,e){const{type:t="all",exact:n,fetchStatus:r,predicate:i,queryKey:a,stale:o}=u;if(M4(a)){if(n){if(e.queryHash!==Uf(a,e.options))return!1}else if(!El(e.queryKey,a))return!1}if(t!=="all"){const s=e.isActive();if(t==="active"&&!s||t==="inactive"&&s)return!1}return!(typeof o=="boolean"&&e.isStale()!==o||typeof r<"u"&&r!==e.state.fetchStatus||i&&!i(e))}function D8(u,e){const{exact:t,fetching:n,predicate:r,mutationKey:i}=u;if(M4(i)){if(!e.options.mutationKey)return!1;if(t){if(hr(e.options.mutationKey)!==hr(i))return!1}else if(!El(e.options.mutationKey,i))return!1}return!(typeof n=="boolean"&&e.state.status==="loading"!==n||r&&!r(e))}function Uf(u,e){return((e==null?void 0:e.queryKeyHashFn)||hr)(u)}function hr(u){return JSON.stringify(u,(e,t)=>hd(t)?Object.keys(t).sort().reduce((n,r)=>(n[r]=t[r],n),{}):t)}function El(u,e){return YB(u,e)}function YB(u,e){return u===e?!0:typeof u!=typeof e?!1:u&&e&&typeof u=="object"&&typeof e=="object"?!Object.keys(e).some(t=>!YB(u[t],e[t])):!1}function ZB(u,e){if(u===e)return u;const t=b8(u)&&b8(e);if(t||hd(u)&&hd(e)){const n=t?u.length:Object.keys(u).length,r=t?e:Object.keys(e),i=r.length,a=t?[]:{};let o=0;for(let s=0;s"u")return!0;const t=e.prototype;return!(!w8(t)||!t.hasOwnProperty("isPrototypeOf"))}function w8(u){return Object.prototype.toString.call(u)==="[object Object]"}function M4(u){return Array.isArray(u)}function JB(u){return new Promise(e=>{setTimeout(e,u)})}function x8(u){JB(0).then(u)}function _R(){if(typeof AbortController=="function")return new AbortController}function md(u,e,t){return t.isDataEqual!=null&&t.isDataEqual(u,e)?u:typeof t.structuralSharing=="function"?t.structuralSharing(u,e):t.structuralSharing!==!1?ZB(u,e):e}class SR extends ja{constructor(){super(),this.setup=e=>{if(!g4&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),window.addEventListener("focus",t,!1),()=>{window.removeEventListener("visibilitychange",t),window.removeEventListener("focus",t)}}}}onSubscribe(){this.cleanup||this.setEventListener(this.setup)}onUnsubscribe(){if(!this.hasListeners()){var e;(e=this.cleanup)==null||e.call(this),this.cleanup=void 0}}setEventListener(e){var t;this.setup=e,(t=this.cleanup)==null||t.call(this),this.cleanup=e(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()})}setFocused(e){this.focused!==e&&(this.focused=e,this.onFocus())}onFocus(){this.listeners.forEach(({listener:e})=>{e()})}isFocused(){return typeof this.focused=="boolean"?this.focused:typeof document>"u"?!0:[void 0,"visible","prerender"].includes(document.visibilityState)}}const fl=new SR,k8=["online","offline"];class TR extends ja{constructor(){super(),this.setup=e=>{if(!g4&&window.addEventListener){const t=()=>e();return k8.forEach(n=>{window.addEventListener(n,t,!1)}),()=>{k8.forEach(n=>{window.removeEventListener(n,t)})}}}}onSubscribe(){this.cleanup||this.setEventListener(this.setup)}onUnsubscribe(){if(!this.hasListeners()){var e;(e=this.cleanup)==null||e.call(this),this.cleanup=void 0}}setEventListener(e){var t;this.setup=e,(t=this.cleanup)==null||t.call(this),this.cleanup=e(n=>{typeof n=="boolean"?this.setOnline(n):this.onOnline()})}setOnline(e){this.online!==e&&(this.online=e,this.onOnline())}onOnline(){this.listeners.forEach(({listener:e})=>{e()})}isOnline(){return typeof this.online=="boolean"?this.online:typeof navigator>"u"||typeof navigator.onLine>"u"?!0:navigator.onLine}}const pl=new TR;function PR(u){return Math.min(1e3*2**u,3e4)}function Gc(u){return(u??"online")==="online"?pl.isOnline():!0}class uF{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}}function x3(u){return u instanceof uF}function eF(u){let e=!1,t=0,n=!1,r,i,a;const o=new Promise((v,A)=>{i=v,a=A}),s=v=>{n||(f(new uF(v)),u.abort==null||u.abort())},l=()=>{e=!0},c=()=>{e=!1},E=()=>!fl.isFocused()||u.networkMode!=="always"&&!pl.isOnline(),d=v=>{n||(n=!0,u.onSuccess==null||u.onSuccess(v),r==null||r(),i(v))},f=v=>{n||(n=!0,u.onError==null||u.onError(v),r==null||r(),a(v))},p=()=>new Promise(v=>{r=A=>{const m=n||!E();return m&&v(A),m},u.onPause==null||u.onPause()}).then(()=>{r=void 0,n||u.onContinue==null||u.onContinue()}),C=()=>{if(n)return;let v;try{v=u.fn()}catch(A){v=Promise.reject(A)}Promise.resolve(v).then(d).catch(A=>{var m,g;if(n)return;const B=(m=u.retry)!=null?m:3,D=(g=u.retryDelay)!=null?g:PR,F=typeof D=="function"?D(t,A):D,h=B===!0||typeof B=="number"&&t{if(E())return p()}).then(()=>{e?f(A):C()})})};return Gc(u.networkMode)?C():p().then(C),{promise:o,cancel:s,continue:()=>(r==null?void 0:r())?o:Promise.resolve(),cancelRetry:l,continueRetry:c}}const qf=console;function OR(){let u=[],e=0,t=c=>{c()},n=c=>{c()};const r=c=>{let E;e++;try{E=c()}finally{e--,e||o()}return E},i=c=>{e?u.push(c):x8(()=>{t(c)})},a=c=>(...E)=>{i(()=>{c(...E)})},o=()=>{const c=u;u=[],c.length&&x8(()=>{n(()=>{c.forEach(E=>{t(E)})})})};return{batch:r,batchCalls:a,schedule:i,setNotifyFunction:c=>{t=c},setBatchNotifyFunction:c=>{n=c}}}const f0=OR();class tF{destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Cd(this.cacheTime)&&(this.gcTimeout=setTimeout(()=>{this.optionalRemove()},this.cacheTime))}updateCacheTime(e){this.cacheTime=Math.max(this.cacheTime||0,e??(g4?1/0:5*60*1e3))}clearGcTimeout(){this.gcTimeout&&(clearTimeout(this.gcTimeout),this.gcTimeout=void 0)}}class IR extends tF{constructor(e){super(),this.abortSignalConsumed=!1,this.defaultOptions=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.cache=e.cache,this.logger=e.logger||qf,this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.initialState=e.state||zR(this.options),this.state=this.initialState,this.scheduleGc()}get meta(){return this.options.meta}setOptions(e){this.options={...this.defaultOptions,...e},this.updateCacheTime(this.options.cacheTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.cache.remove(this)}setData(e,t){const n=md(this.state.data,e,this.options);return this.dispatch({data:n,type:"success",dataUpdatedAt:t==null?void 0:t.updatedAt,manual:t==null?void 0:t.manual}),n}setState(e,t){this.dispatch({type:"setState",state:e,setStateOptions:t})}cancel(e){var t;const n=this.promise;return(t=this.retryer)==null||t.cancel(e),n?n.then(Re).catch(Re):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.initialState)}isActive(){return this.observers.some(e=>e.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||this.observers.some(e=>e.getCurrentResult().isStale)}isStaleByTime(e=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!QB(this.state.dataUpdatedAt,e)}onFocus(){var e;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t&&t.refetch({cancelRefetch:!1}),(e=this.retryer)==null||e.continue()}onOnline(){var e;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t&&t.refetch({cancelRefetch:!1}),(e=this.retryer)==null||e.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.cache.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.retryer&&(this.abortSignalConsumed?this.retryer.cancel({revert:!0}):this.retryer.cancelRetry()),this.scheduleGc()),this.cache.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.dispatch({type:"invalidate"})}fetch(e,t){var n,r;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&t!=null&&t.cancelRefetch)this.cancel({silent:!0});else if(this.promise){var i;return(i=this.retryer)==null||i.continueRetry(),this.promise}}if(e&&this.setOptions(e),!this.options.queryFn){const f=this.observers.find(p=>p.options.queryFn);f&&this.setOptions(f.options)}const a=_R(),o={queryKey:this.queryKey,pageParam:void 0,meta:this.meta},s=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>{if(a)return this.abortSignalConsumed=!0,a.signal}})};s(o);const l=()=>this.options.queryFn?(this.abortSignalConsumed=!1,this.options.queryFn(o)):Promise.reject("Missing queryFn for queryKey '"+this.options.queryHash+"'"),c={fetchOptions:t,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:l};if(s(c),(n=this.options.behavior)==null||n.onFetch(c),this.revertState=this.state,this.state.fetchStatus==="idle"||this.state.fetchMeta!==((r=c.fetchOptions)==null?void 0:r.meta)){var E;this.dispatch({type:"fetch",meta:(E=c.fetchOptions)==null?void 0:E.meta})}const d=f=>{if(x3(f)&&f.silent||this.dispatch({type:"error",error:f}),!x3(f)){var p,C,v,A;(p=(C=this.cache.config).onError)==null||p.call(C,f,this),(v=(A=this.cache.config).onSettled)==null||v.call(A,this.state.data,f,this)}this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return this.retryer=eF({fn:c.fetchFn,abort:a==null?void 0:a.abort.bind(a),onSuccess:f=>{var p,C,v,A;if(typeof f>"u"){d(new Error(this.queryHash+" data is undefined"));return}this.setData(f),(p=(C=this.cache.config).onSuccess)==null||p.call(C,f,this),(v=(A=this.cache.config).onSettled)==null||v.call(A,f,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:d,onFail:(f,p)=>{this.dispatch({type:"failed",failureCount:f,error:p})},onPause:()=>{this.dispatch({type:"pause"})},onContinue:()=>{this.dispatch({type:"continue"})},retry:c.options.retry,retryDelay:c.options.retryDelay,networkMode:c.options.networkMode}),this.promise=this.retryer.promise,this.promise}dispatch(e){const t=n=>{var r,i;switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:(r=e.meta)!=null?r:null,fetchStatus:Gc(this.options.networkMode)?"fetching":"paused",...!n.dataUpdatedAt&&{error:null,status:"loading"}};case"success":return{...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:(i=e.dataUpdatedAt)!=null?i:Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const a=e.error;return x3(a)&&a.revert&&this.revertState?{...this.revertState,fetchStatus:"idle"}:{...n,error:a,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),f0.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate(e)}),this.cache.notify({query:this,type:"updated",action:e})})}}function zR(u){const e=typeof u.initialData=="function"?u.initialData():u.initialData,t=typeof e<"u",n=t?typeof u.initialDataUpdatedAt=="function"?u.initialDataUpdatedAt():u.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:t?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:t?"success":"loading",fetchStatus:"idle"}}class jR extends ja{constructor(e){super(),this.config=e||{},this.queries=[],this.queriesMap={}}build(e,t,n){var r;const i=t.queryKey,a=(r=t.queryHash)!=null?r:Uf(i,t);let o=this.get(a);return o||(o=new IR({cache:this,logger:e.getLogger(),queryKey:i,queryHash:a,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){this.queriesMap[e.queryHash]||(this.queriesMap[e.queryHash]=e,this.queries.push(e),this.notify({type:"added",query:e}))}remove(e){const t=this.queriesMap[e.queryHash];t&&(e.destroy(),this.queries=this.queries.filter(n=>n!==e),t===e&&delete this.queriesMap[e.queryHash],this.notify({type:"removed",query:e}))}clear(){f0.batch(()=>{this.queries.forEach(e=>{this.remove(e)})})}get(e){return this.queriesMap[e]}getAll(){return this.queries}find(e,t){const[n]=gn(e,t);return typeof n.exact>"u"&&(n.exact=!0),this.queries.find(r=>y8(n,r))}findAll(e,t){const[n]=gn(e,t);return Object.keys(n).length>0?this.queries.filter(r=>y8(n,r)):this.queries}notify(e){f0.batch(()=>{this.listeners.forEach(({listener:t})=>{t(e)})})}onFocus(){f0.batch(()=>{this.queries.forEach(e=>{e.onFocus()})})}onOnline(){f0.batch(()=>{this.queries.forEach(e=>{e.onOnline()})})}}class RR extends tF{constructor(e){super(),this.defaultOptions=e.defaultOptions,this.mutationId=e.mutationId,this.mutationCache=e.mutationCache,this.logger=e.logger||qf,this.observers=[],this.state=e.state||nF(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options={...this.defaultOptions,...e},this.updateCacheTime(this.options.cacheTime)}get meta(){return this.options.meta}setState(e){this.dispatch({type:"setState",state:e})}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.mutationCache.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.observers=this.observers.filter(t=>t!==e),this.scheduleGc(),this.mutationCache.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.observers.length||(this.state.status==="loading"?this.scheduleGc():this.mutationCache.remove(this))}continue(){var e,t;return(e=(t=this.retryer)==null?void 0:t.continue())!=null?e:this.execute()}async execute(){const e=()=>{var h;return this.retryer=eF({fn:()=>this.options.mutationFn?this.options.mutationFn(this.state.variables):Promise.reject("No mutationFn found"),onFail:(b,T)=>{this.dispatch({type:"failed",failureCount:b,error:T})},onPause:()=>{this.dispatch({type:"pause"})},onContinue:()=>{this.dispatch({type:"continue"})},retry:(h=this.options.retry)!=null?h:0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode}),this.retryer.promise},t=this.state.status==="loading";try{var n,r,i,a,o,s,l,c;if(!t){var E,d,f,p;this.dispatch({type:"loading",variables:this.options.variables}),await((E=(d=this.mutationCache.config).onMutate)==null?void 0:E.call(d,this.state.variables,this));const b=await((f=(p=this.options).onMutate)==null?void 0:f.call(p,this.state.variables));b!==this.state.context&&this.dispatch({type:"loading",context:b,variables:this.state.variables})}const h=await e();return await((n=(r=this.mutationCache.config).onSuccess)==null?void 0:n.call(r,h,this.state.variables,this.state.context,this)),await((i=(a=this.options).onSuccess)==null?void 0:i.call(a,h,this.state.variables,this.state.context)),await((o=(s=this.mutationCache.config).onSettled)==null?void 0:o.call(s,h,null,this.state.variables,this.state.context,this)),await((l=(c=this.options).onSettled)==null?void 0:l.call(c,h,null,this.state.variables,this.state.context)),this.dispatch({type:"success",data:h}),h}catch(h){try{var C,v,A,m,g,B,D,F;throw await((C=(v=this.mutationCache.config).onError)==null?void 0:C.call(v,h,this.state.variables,this.state.context,this)),await((A=(m=this.options).onError)==null?void 0:A.call(m,h,this.state.variables,this.state.context)),await((g=(B=this.mutationCache.config).onSettled)==null?void 0:g.call(B,void 0,h,this.state.variables,this.state.context,this)),await((D=(F=this.options).onSettled)==null?void 0:D.call(F,void 0,h,this.state.variables,this.state.context)),h}finally{this.dispatch({type:"error",error:h})}}}dispatch(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"loading":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!Gc(this.options.networkMode),status:"loading",variables:e.variables};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"};case"setState":return{...n,...e.state}}};this.state=t(this.state),f0.batch(()=>{this.observers.forEach(n=>{n.onMutationUpdate(e)}),this.mutationCache.notify({mutation:this,type:"updated",action:e})})}}function nF(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0}}class NR extends ja{constructor(e){super(),this.config=e||{},this.mutations=[],this.mutationId=0}build(e,t,n){const r=new RR({mutationCache:this,logger:e.getLogger(),mutationId:++this.mutationId,options:e.defaultMutationOptions(t),state:n,defaultOptions:t.mutationKey?e.getMutationDefaults(t.mutationKey):void 0});return this.add(r),r}add(e){this.mutations.push(e),this.notify({type:"added",mutation:e})}remove(e){this.mutations=this.mutations.filter(t=>t!==e),this.notify({type:"removed",mutation:e})}clear(){f0.batch(()=>{this.mutations.forEach(e=>{this.remove(e)})})}getAll(){return this.mutations}find(e){return typeof e.exact>"u"&&(e.exact=!0),this.mutations.find(t=>D8(e,t))}findAll(e){return this.mutations.filter(t=>D8(e,t))}notify(e){f0.batch(()=>{this.listeners.forEach(({listener:t})=>{t(e)})})}resumePausedMutations(){var e;return this.resuming=((e=this.resuming)!=null?e:Promise.resolve()).then(()=>{const t=this.mutations.filter(n=>n.state.isPaused);return f0.batch(()=>t.reduce((n,r)=>n.then(()=>r.continue().catch(Re)),Promise.resolve()))}).then(()=>{this.resuming=void 0}),this.resuming}}function $R(){return{onFetch:u=>{u.fetchFn=()=>{var e,t,n,r,i,a;const o=(e=u.fetchOptions)==null||(t=e.meta)==null?void 0:t.refetchPage,s=(n=u.fetchOptions)==null||(r=n.meta)==null?void 0:r.fetchMore,l=s==null?void 0:s.pageParam,c=(s==null?void 0:s.direction)==="forward",E=(s==null?void 0:s.direction)==="backward",d=((i=u.state.data)==null?void 0:i.pages)||[],f=((a=u.state.data)==null?void 0:a.pageParams)||[];let p=f,C=!1;const v=F=>{Object.defineProperty(F,"signal",{enumerable:!0,get:()=>{var h;if((h=u.signal)!=null&&h.aborted)C=!0;else{var b;(b=u.signal)==null||b.addEventListener("abort",()=>{C=!0})}return u.signal}})},A=u.options.queryFn||(()=>Promise.reject("Missing queryFn for queryKey '"+u.options.queryHash+"'")),m=(F,h,b,T)=>(p=T?[h,...p]:[...p,h],T?[b,...F]:[...F,b]),g=(F,h,b,T)=>{if(C)return Promise.reject("Cancelled");if(typeof b>"u"&&!h&&F.length)return Promise.resolve(F);const k={queryKey:u.queryKey,pageParam:b,meta:u.options.meta};v(k);const L=A(k);return Promise.resolve(L).then(Z=>m(F,b,Z,T))};let B;if(!d.length)B=g([]);else if(c){const F=typeof l<"u",h=F?l:_8(u.options,d);B=g(d,F,h)}else if(E){const F=typeof l<"u",h=F?l:MR(u.options,d);B=g(d,F,h,!0)}else{p=[];const F=typeof u.options.getNextPageParam>"u";B=(o&&d[0]?o(d[0],0,d):!0)?g([],F,f[0]):Promise.resolve(m([],f[0],d[0]));for(let b=1;b{if(o&&d[b]?o(d[b],b,d):!0){const L=F?f[b]:_8(u.options,T);return g(T,F,L)}return Promise.resolve(m(T,f[b],d[b]))})}return B.then(F=>({pages:F,pageParams:p}))}}}}function _8(u,e){return u.getNextPageParam==null?void 0:u.getNextPageParam(e[e.length-1],e)}function MR(u,e){return u.getPreviousPageParam==null?void 0:u.getPreviousPageParam(e[0],e)}class LR{constructor(e={}){this.queryCache=e.queryCache||new jR,this.mutationCache=e.mutationCache||new NR,this.logger=e.logger||qf,this.defaultOptions=e.defaultOptions||{},this.queryDefaults=[],this.mutationDefaults=[],this.mountCount=0}mount(){this.mountCount++,this.mountCount===1&&(this.unsubscribeFocus=fl.subscribe(()=>{fl.isFocused()&&(this.resumePausedMutations(),this.queryCache.onFocus())}),this.unsubscribeOnline=pl.subscribe(()=>{pl.isOnline()&&(this.resumePausedMutations(),this.queryCache.onOnline())}))}unmount(){var e,t;this.mountCount--,this.mountCount===0&&((e=this.unsubscribeFocus)==null||e.call(this),this.unsubscribeFocus=void 0,(t=this.unsubscribeOnline)==null||t.call(this),this.unsubscribeOnline=void 0)}isFetching(e,t){const[n]=gn(e,t);return n.fetchStatus="fetching",this.queryCache.findAll(n).length}isMutating(e){return this.mutationCache.findAll({...e,fetching:!0}).length}getQueryData(e,t){var n;return(n=this.queryCache.find(e,t))==null?void 0:n.state.data}ensureQueryData(e,t,n){const r=Ks(e,t,n),i=this.getQueryData(r.queryKey);return i?Promise.resolve(i):this.fetchQuery(r)}getQueriesData(e){return this.getQueryCache().findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.queryCache.find(e),i=r==null?void 0:r.state.data,a=kR(t,i);if(typeof a>"u")return;const o=Ks(e),s=this.defaultQueryOptions(o);return this.queryCache.build(this,s).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return f0.batch(()=>this.getQueryCache().findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e,t){var n;return(n=this.queryCache.find(e,t))==null?void 0:n.state}removeQueries(e,t){const[n]=gn(e,t),r=this.queryCache;f0.batch(()=>{r.findAll(n).forEach(i=>{r.remove(i)})})}resetQueries(e,t,n){const[r,i]=gn(e,t,n),a=this.queryCache,o={type:"active",...r};return f0.batch(()=>(a.findAll(r).forEach(s=>{s.reset()}),this.refetchQueries(o,i)))}cancelQueries(e,t,n){const[r,i={}]=gn(e,t,n);typeof i.revert>"u"&&(i.revert=!0);const a=f0.batch(()=>this.queryCache.findAll(r).map(o=>o.cancel(i)));return Promise.all(a).then(Re).catch(Re)}invalidateQueries(e,t,n){const[r,i]=gn(e,t,n);return f0.batch(()=>{var a,o;if(this.queryCache.findAll(r).forEach(l=>{l.invalidate()}),r.refetchType==="none")return Promise.resolve();const s={...r,type:(a=(o=r.refetchType)!=null?o:r.type)!=null?a:"active"};return this.refetchQueries(s,i)})}refetchQueries(e,t,n){const[r,i]=gn(e,t,n),a=f0.batch(()=>this.queryCache.findAll(r).filter(s=>!s.isDisabled()).map(s=>{var l;return s.fetch(void 0,{...i,cancelRefetch:(l=i==null?void 0:i.cancelRefetch)!=null?l:!0,meta:{refetchPage:r.refetchPage}})}));let o=Promise.all(a).then(Re);return i!=null&&i.throwOnError||(o=o.catch(Re)),o}fetchQuery(e,t,n){const r=Ks(e,t,n),i=this.defaultQueryOptions(r);typeof i.retry>"u"&&(i.retry=!1);const a=this.queryCache.build(this,i);return a.isStaleByTime(i.staleTime)?a.fetch(i):Promise.resolve(a.state.data)}prefetchQuery(e,t,n){return this.fetchQuery(e,t,n).then(Re).catch(Re)}fetchInfiniteQuery(e,t,n){const r=Ks(e,t,n);return r.behavior=$R(),this.fetchQuery(r)}prefetchInfiniteQuery(e,t,n){return this.fetchInfiniteQuery(e,t,n).then(Re).catch(Re)}resumePausedMutations(){return this.mutationCache.resumePausedMutations()}getQueryCache(){return this.queryCache}getMutationCache(){return this.mutationCache}getLogger(){return this.logger}getDefaultOptions(){return this.defaultOptions}setDefaultOptions(e){this.defaultOptions=e}setQueryDefaults(e,t){const n=this.queryDefaults.find(r=>hr(e)===hr(r.queryKey));n?n.defaultOptions=t:this.queryDefaults.push({queryKey:e,defaultOptions:t})}getQueryDefaults(e){if(!e)return;const t=this.queryDefaults.find(n=>El(e,n.queryKey));return t==null?void 0:t.defaultOptions}setMutationDefaults(e,t){const n=this.mutationDefaults.find(r=>hr(e)===hr(r.mutationKey));n?n.defaultOptions=t:this.mutationDefaults.push({mutationKey:e,defaultOptions:t})}getMutationDefaults(e){if(!e)return;const t=this.mutationDefaults.find(n=>El(e,n.mutationKey));return t==null?void 0:t.defaultOptions}defaultQueryOptions(e){if(e!=null&&e._defaulted)return e;const t={...this.defaultOptions.queries,...this.getQueryDefaults(e==null?void 0:e.queryKey),...e,_defaulted:!0};return!t.queryHash&&t.queryKey&&(t.queryHash=Uf(t.queryKey,t)),typeof t.refetchOnReconnect>"u"&&(t.refetchOnReconnect=t.networkMode!=="always"),typeof t.useErrorBoundary>"u"&&(t.useErrorBoundary=!!t.suspense),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...this.defaultOptions.mutations,...this.getMutationDefaults(e==null?void 0:e.mutationKey),...e,_defaulted:!0}}clear(){this.queryCache.clear(),this.mutationCache.clear()}}class WR extends ja{constructor(e,t){super(),this.client=e,this.options=t,this.trackedProps=new Set,this.selectError=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.remove=this.remove.bind(this),this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.currentQuery.addObserver(this),S8(this.currentQuery,this.options)&&this.executeFetch(),this.updateTimers())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ad(this.currentQuery,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ad(this.currentQuery,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.clearStaleTimeout(),this.clearRefetchInterval(),this.currentQuery.removeObserver(this)}setOptions(e,t){const n=this.options,r=this.currentQuery;if(this.options=this.client.defaultQueryOptions(e),dl(n,this.options)||this.client.getQueryCache().notify({type:"observerOptionsUpdated",query:this.currentQuery,observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=n.queryKey),this.updateQuery();const i=this.hasListeners();i&&T8(this.currentQuery,r,this.options,n)&&this.executeFetch(),this.updateResult(t),i&&(this.currentQuery!==r||this.options.enabled!==n.enabled||this.options.staleTime!==n.staleTime)&&this.updateStaleTimeout();const a=this.computeRefetchInterval();i&&(this.currentQuery!==r||this.options.enabled!==n.enabled||a!==this.currentRefetchInterval)&&this.updateRefetchInterval(a)}getOptimisticResult(e){const t=this.client.getQueryCache().build(this.client,e),n=this.createResult(t,e);return qR(this,n,e)&&(this.currentResult=n,this.currentResultOptions=this.options,this.currentResultState=this.currentQuery.state),n}getCurrentResult(){return this.currentResult}trackResult(e){const t={};return Object.keys(e).forEach(n=>{Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:()=>(this.trackedProps.add(n),e[n])})}),t}getCurrentQuery(){return this.currentQuery}remove(){this.client.getQueryCache().remove(this.currentQuery)}refetch({refetchPage:e,...t}={}){return this.fetch({...t,meta:{refetchPage:e}})}fetchOptimistic(e){const t=this.client.defaultQueryOptions(e),n=this.client.getQueryCache().build(this.client,t);return n.isFetchingOptimistic=!0,n.fetch().then(()=>this.createResult(n,t))}fetch(e){var t;return this.executeFetch({...e,cancelRefetch:(t=e.cancelRefetch)!=null?t:!0}).then(()=>(this.updateResult(),this.currentResult))}executeFetch(e){this.updateQuery();let t=this.currentQuery.fetch(this.options,e);return e!=null&&e.throwOnError||(t=t.catch(Re)),t}updateStaleTimeout(){if(this.clearStaleTimeout(),g4||this.currentResult.isStale||!Cd(this.options.staleTime))return;const t=QB(this.currentResult.dataUpdatedAt,this.options.staleTime)+1;this.staleTimeoutId=setTimeout(()=>{this.currentResult.isStale||this.updateResult()},t)}computeRefetchInterval(){var e;return typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.currentResult.data,this.currentQuery):(e=this.options.refetchInterval)!=null?e:!1}updateRefetchInterval(e){this.clearRefetchInterval(),this.currentRefetchInterval=e,!(g4||this.options.enabled===!1||!Cd(this.currentRefetchInterval)||this.currentRefetchInterval===0)&&(this.refetchIntervalId=setInterval(()=>{(this.options.refetchIntervalInBackground||fl.isFocused())&&this.executeFetch()},this.currentRefetchInterval))}updateTimers(){this.updateStaleTimeout(),this.updateRefetchInterval(this.computeRefetchInterval())}clearStaleTimeout(){this.staleTimeoutId&&(clearTimeout(this.staleTimeoutId),this.staleTimeoutId=void 0)}clearRefetchInterval(){this.refetchIntervalId&&(clearInterval(this.refetchIntervalId),this.refetchIntervalId=void 0)}createResult(e,t){const n=this.currentQuery,r=this.options,i=this.currentResult,a=this.currentResultState,o=this.currentResultOptions,s=e!==n,l=s?e.state:this.currentQueryInitialState,c=s?this.currentResult:this.previousQueryResult,{state:E}=e;let{dataUpdatedAt:d,error:f,errorUpdatedAt:p,fetchStatus:C,status:v}=E,A=!1,m=!1,g;if(t._optimisticResults){const b=this.hasListeners(),T=!b&&S8(e,t),k=b&&T8(e,n,t,r);(T||k)&&(C=Gc(e.options.networkMode)?"fetching":"paused",d||(v="loading")),t._optimisticResults==="isRestoring"&&(C="idle")}if(t.keepPreviousData&&!E.dataUpdatedAt&&c!=null&&c.isSuccess&&v!=="error")g=c.data,d=c.dataUpdatedAt,v=c.status,A=!0;else if(t.select&&typeof E.data<"u")if(i&&E.data===(a==null?void 0:a.data)&&t.select===this.selectFn)g=this.selectResult;else try{this.selectFn=t.select,g=t.select(E.data),g=md(i==null?void 0:i.data,g,t),this.selectResult=g,this.selectError=null}catch(b){this.selectError=b}else g=E.data;if(typeof t.placeholderData<"u"&&typeof g>"u"&&v==="loading"){let b;if(i!=null&&i.isPlaceholderData&&t.placeholderData===(o==null?void 0:o.placeholderData))b=i.data;else if(b=typeof t.placeholderData=="function"?t.placeholderData():t.placeholderData,t.select&&typeof b<"u")try{b=t.select(b),this.selectError=null}catch(T){this.selectError=T}typeof b<"u"&&(v="success",g=md(i==null?void 0:i.data,b,t),m=!0)}this.selectError&&(f=this.selectError,g=this.selectResult,p=Date.now(),v="error");const B=C==="fetching",D=v==="loading",F=v==="error";return{status:v,fetchStatus:C,isLoading:D,isSuccess:v==="success",isError:F,isInitialLoading:D&&B,data:g,dataUpdatedAt:d,error:f,errorUpdatedAt:p,failureCount:E.fetchFailureCount,failureReason:E.fetchFailureReason,errorUpdateCount:E.errorUpdateCount,isFetched:E.dataUpdateCount>0||E.errorUpdateCount>0,isFetchedAfterMount:E.dataUpdateCount>l.dataUpdateCount||E.errorUpdateCount>l.errorUpdateCount,isFetching:B,isRefetching:B&&!D,isLoadingError:F&&E.dataUpdatedAt===0,isPaused:C==="paused",isPlaceholderData:m,isPreviousData:A,isRefetchError:F&&E.dataUpdatedAt!==0,isStale:Hf(e,t),refetch:this.refetch,remove:this.remove}}updateResult(e){const t=this.currentResult,n=this.createResult(this.currentQuery,this.options);if(this.currentResultState=this.currentQuery.state,this.currentResultOptions=this.options,dl(n,t))return;this.currentResult=n;const r={cache:!0},i=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,o=typeof a=="function"?a():a;if(o==="all"||!o&&!this.trackedProps.size)return!0;const s=new Set(o??this.trackedProps);return this.options.useErrorBoundary&&s.add("error"),Object.keys(this.currentResult).some(l=>{const c=l;return this.currentResult[c]!==t[c]&&s.has(c)})};(e==null?void 0:e.listeners)!==!1&&i()&&(r.listeners=!0),this.notify({...r,...e})}updateQuery(){const e=this.client.getQueryCache().build(this.client,this.options);if(e===this.currentQuery)return;const t=this.currentQuery;this.currentQuery=e,this.currentQueryInitialState=e.state,this.previousQueryResult=this.currentResult,this.hasListeners()&&(t==null||t.removeObserver(this),e.addObserver(this))}onQueryUpdate(e){const t={};e.type==="success"?t.onSuccess=!e.manual:e.type==="error"&&!x3(e.error)&&(t.onError=!0),this.updateResult(t),this.hasListeners()&&this.updateTimers()}notify(e){f0.batch(()=>{if(e.onSuccess){var t,n,r,i;(t=(n=this.options).onSuccess)==null||t.call(n,this.currentResult.data),(r=(i=this.options).onSettled)==null||r.call(i,this.currentResult.data,null)}else if(e.onError){var a,o,s,l;(a=(o=this.options).onError)==null||a.call(o,this.currentResult.error),(s=(l=this.options).onSettled)==null||s.call(l,void 0,this.currentResult.error)}e.listeners&&this.listeners.forEach(({listener:c})=>{c(this.currentResult)}),e.cache&&this.client.getQueryCache().notify({query:this.currentQuery,type:"observerResultsUpdated"})})}}function UR(u,e){return e.enabled!==!1&&!u.state.dataUpdatedAt&&!(u.state.status==="error"&&e.retryOnMount===!1)}function S8(u,e){return UR(u,e)||u.state.dataUpdatedAt>0&&Ad(u,e,e.refetchOnMount)}function Ad(u,e,t){if(e.enabled!==!1){const n=typeof t=="function"?t(u):t;return n==="always"||n!==!1&&Hf(u,e)}return!1}function T8(u,e,t,n){return t.enabled!==!1&&(u!==e||n.enabled===!1)&&(!t.suspense||u.state.status!=="error")&&Hf(u,t)}function Hf(u,e){return u.isStaleByTime(e.staleTime)}function qR(u,e,t){return t.keepPreviousData?!1:t.placeholderData!==void 0?e.isPlaceholderData:!dl(u.getCurrentResult(),e)}let HR=class extends ja{constructor(e,t){super(),this.client=e,this.setOptions(t),this.bindMethods(),this.updateResult()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){var t;const n=this.options;this.options=this.client.defaultMutationOptions(e),dl(n,this.options)||this.client.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.currentMutation,observer:this}),(t=this.currentMutation)==null||t.setOptions(this.options)}onUnsubscribe(){if(!this.hasListeners()){var e;(e=this.currentMutation)==null||e.removeObserver(this)}}onMutationUpdate(e){this.updateResult();const t={listeners:!0};e.type==="success"?t.onSuccess=!0:e.type==="error"&&(t.onError=!0),this.notify(t)}getCurrentResult(){return this.currentResult}reset(){this.currentMutation=void 0,this.updateResult(),this.notify({listeners:!0})}mutate(e,t){return this.mutateOptions=t,this.currentMutation&&this.currentMutation.removeObserver(this),this.currentMutation=this.client.getMutationCache().build(this.client,{...this.options,variables:typeof e<"u"?e:this.options.variables}),this.currentMutation.addObserver(this),this.currentMutation.execute()}updateResult(){const e=this.currentMutation?this.currentMutation.state:nF(),t={...e,isLoading:e.status==="loading",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset};this.currentResult=t}notify(e){f0.batch(()=>{if(this.mutateOptions&&this.hasListeners()){if(e.onSuccess){var t,n,r,i;(t=(n=this.mutateOptions).onSuccess)==null||t.call(n,this.currentResult.data,this.currentResult.variables,this.currentResult.context),(r=(i=this.mutateOptions).onSettled)==null||r.call(i,this.currentResult.data,null,this.currentResult.variables,this.currentResult.context)}else if(e.onError){var a,o,s,l;(a=(o=this.mutateOptions).onError)==null||a.call(o,this.currentResult.error,this.currentResult.variables,this.currentResult.context),(s=(l=this.mutateOptions).onSettled)==null||s.call(l,void 0,this.currentResult.error,this.currentResult.variables,this.currentResult.context)}}e.listeners&&this.listeners.forEach(({listener:c})=>{c(this.currentResult)})})}};function KR(u){return{mutationKey:u.options.mutationKey,state:u.state}}function VR(u){return{state:u.state,queryKey:u.queryKey,queryHash:u.queryHash}}function GR(u){return u.state.isPaused}function QR(u){return u.state.status==="success"}function XR(u,e={}){const t=[],n=[];if(e.dehydrateMutations!==!1){const r=e.shouldDehydrateMutation||GR;u.getMutationCache().getAll().forEach(i=>{r(i)&&t.push(KR(i))})}if(e.dehydrateQueries!==!1){const r=e.shouldDehydrateQuery||QR;u.getQueryCache().getAll().forEach(i=>{r(i)&&n.push(VR(i))})}return{mutations:t,queries:n}}function YR(u,e,t){if(typeof e!="object"||e===null)return;const n=u.getMutationCache(),r=u.getQueryCache(),i=e.mutations||[],a=e.queries||[];i.forEach(o=>{var s;n.build(u,{...t==null||(s=t.defaultOptions)==null?void 0:s.mutations,mutationKey:o.mutationKey},o.state)}),a.forEach(({queryKey:o,state:s,queryHash:l})=>{var c;const E=r.get(l);if(E){if(E.state.dataUpdatedAtu.transitions.easing.easeInOut,Ne.ripplePulsate,({theme:u})=>u.transitions.duration.shorter,Ne.child,Ne.childLeaving,pj,pd,({theme:u})=>u.transitions.easing.easeInOut,Ne.childPulsate,Cj,({theme:u})=>u.transitions.easing.easeInOut),Aj=w.forwardRef(function(e,t){const n=Xn({props:e,name:"MuiTouchRipple"}),{center:r=!1,classes:i={},className:a}=n,o=_0(n,Ej),[s,l]=w.useState([]),c=w.useRef(0),E=w.useRef(null);w.useEffect(()=>{E.current&&(E.current(),E.current=null)},[s]);const d=w.useRef(!1),f=w.useRef(0),p=w.useRef(null),C=w.useRef(null);w.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]);const v=w.useCallback(B=>{const{pulsate:D,rippleX:F,rippleY:h,rippleSize:b,cb:T}=B;l(k=>[...k,ku.jsx(mj,{classes:{ripple:$0(i.ripple,Ne.ripple),rippleVisible:$0(i.rippleVisible,Ne.rippleVisible),ripplePulsate:$0(i.ripplePulsate,Ne.ripplePulsate),child:$0(i.child,Ne.child),childLeaving:$0(i.childLeaving,Ne.childLeaving),childPulsate:$0(i.childPulsate,Ne.childPulsate)},timeout:pd,pulsate:D,rippleX:F,rippleY:h,rippleSize:b},c.current)]),c.current+=1,E.current=T},[i]),A=w.useCallback((B={},D={},F=()=>{})=>{const{pulsate:h=!1,center:b=r||D.pulsate,fakeElement:T=!1}=D;if((B==null?void 0:B.type)==="mousedown"&&d.current){d.current=!1;return}(B==null?void 0:B.type)==="touchstart"&&(d.current=!0);const k=T?null:C.current,L=k?k.getBoundingClientRect():{width:0,height:0,left:0,top:0};let Q,Z,tu;if(b||B===void 0||B.clientX===0&&B.clientY===0||!B.clientX&&!B.touches)Q=Math.round(L.width/2),Z=Math.round(L.height/2);else{const{clientX:q,clientY:V}=B.touches&&B.touches.length>0?B.touches[0]:B;Q=Math.round(q-L.left),Z=Math.round(V-L.top)}if(b)tu=Math.sqrt((2*L.width**2+L.height**2)/3),tu%2===0&&(tu+=1);else{const q=Math.max(Math.abs((k?k.clientWidth:0)-Q),Q)*2+2,V=Math.max(Math.abs((k?k.clientHeight:0)-Z),Z)*2+2;tu=Math.sqrt(q**2+V**2)}B!=null&&B.touches?p.current===null&&(p.current=()=>{v({pulsate:h,rippleX:Q,rippleY:Z,rippleSize:tu,cb:F})},f.current=setTimeout(()=>{p.current&&(p.current(),p.current=null)},dj)):v({pulsate:h,rippleX:Q,rippleY:Z,rippleSize:tu,cb:F})},[r,v]),m=w.useCallback(()=>{A({},{pulsate:!0})},[A]),g=w.useCallback((B,D)=>{if(clearTimeout(f.current),(B==null?void 0:B.type)==="touchend"&&p.current){p.current(),p.current=null,f.current=setTimeout(()=>{g(B,D)});return}p.current=null,l(F=>F.length>0?F.slice(1):F),E.current=D},[]);return w.useImperativeHandle(t,()=>({pulsate:m,start:A,stop:g}),[m,A,g]),ku.jsx(hj,lu({className:$0(Ne.root,i.root,a),ref:C},o,{children:ku.jsx(sj,{component:null,exit:!0,children:s})}))}),gj=Aj;function vj(u){return Mr("MuiButtonBase",u)}const Bj=Lr("MuiButtonBase",["root","disabled","focusVisible"]),Fj=Bj,yj=["action","centerRipple","children","className","component","disabled","disableRipple","disableTouchRipple","focusRipple","focusVisibleClassName","LinkComponent","onBlur","onClick","onContextMenu","onDragLeave","onFocus","onFocusVisible","onKeyDown","onKeyUp","onMouseDown","onMouseLeave","onMouseUp","onTouchEnd","onTouchMove","onTouchStart","tabIndex","TouchRippleProps","touchRippleRef","type"],Dj=u=>{const{disabled:e,focusVisible:t,focusVisibleClassName:n,classes:r}=u,a=Ia({root:["root",e&&"disabled",t&&"focusVisible"]},vj,r);return t&&n&&(a.root+=` ${n}`),a},bj=Tt("button",{name:"MuiButtonBase",slot:"Root",overridesResolver:(u,e)=>e.root})({display:"inline-flex",alignItems:"center",justifyContent:"center",position:"relative",boxSizing:"border-box",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none",textDecoration:"none",color:"inherit","&::-moz-focus-inner":{borderStyle:"none"},[`&.${Fj.disabled}`]:{pointerEvents:"none",cursor:"default"},"@media print":{colorAdjust:"exact"}}),wj=w.forwardRef(function(e,t){const n=Xn({props:e,name:"MuiButtonBase"}),{action:r,centerRipple:i=!1,children:a,className:o,component:s="button",disabled:l=!1,disableRipple:c=!1,disableTouchRipple:E=!1,focusRipple:d=!1,LinkComponent:f="a",onBlur:p,onClick:C,onContextMenu:v,onDragLeave:A,onFocus:m,onFocusVisible:g,onKeyDown:B,onKeyUp:D,onMouseDown:F,onMouseLeave:h,onMouseUp:b,onTouchEnd:T,onTouchMove:k,onTouchStart:L,tabIndex:Q=0,TouchRippleProps:Z,touchRippleRef:tu,type:q}=n,V=_0(n,yj),G=w.useRef(null),W=w.useRef(null),M=Lh(W,tu),{isFocusVisibleRef:j,onFocus:Y,onBlur:uu,ref:J}=PP(),[U,fu]=w.useState(!1);l&&U&&fu(!1),w.useImperativeHandle(r,()=>({focusVisible:()=>{fu(!0),G.current.focus()}}),[]);const[gu,yu]=w.useState(!1);w.useEffect(()=>{yu(!0)},[]);const Bu=gu&&!c&&!l;w.useEffect(()=>{U&&d&&!c&&gu&&W.current.pulsate()},[c,d,U,gu]);function hu(au,Ou,bu=E){return Ws(du=>(Ou&&Ou(du),!bu&&W.current&&W.current[au](du),!0))}const x=hu("start",F),_=hu("stop",v),S=hu("stop",A),z=hu("stop",b),O=hu("stop",au=>{U&&au.preventDefault(),h&&h(au)}),$=hu("start",L),H=hu("stop",T),I=hu("stop",k),R=hu("stop",au=>{uu(au),j.current===!1&&fu(!1),p&&p(au)},!1),K=Ws(au=>{G.current||(G.current=au.currentTarget),Y(au),j.current===!0&&(fu(!0),g&&g(au)),m&&m(au)}),N=()=>{const au=G.current;return s&&s!=="button"&&!(au.tagName==="A"&&au.href)},X=w.useRef(!1),iu=Ws(au=>{d&&!X.current&&U&&W.current&&au.key===" "&&(X.current=!0,W.current.stop(au,()=>{W.current.start(au)})),au.target===au.currentTarget&&N()&&au.key===" "&&au.preventDefault(),B&&B(au),au.target===au.currentTarget&&N()&&au.key==="Enter"&&!l&&(au.preventDefault(),C&&C(au))}),su=Ws(au=>{d&&au.key===" "&&W.current&&U&&!au.defaultPrevented&&(X.current=!1,W.current.stop(au,()=>{W.current.pulsate(au)})),D&&D(au),C&&au.target===au.currentTarget&&N()&&au.key===" "&&!au.defaultPrevented&&C(au)});let Fu=s;Fu==="button"&&(V.href||V.to)&&(Fu=f);const ou={};Fu==="button"?(ou.type=q===void 0?"button":q,ou.disabled=l):(!V.href&&!V.to&&(ou.role="button"),l&&(ou["aria-disabled"]=l));const pu=Lh(t,J,G),nu=lu({},n,{centerRipple:i,component:s,disabled:l,disableRipple:c,disableTouchRipple:E,focusRipple:d,tabIndex:Q,focusVisible:U}),Eu=Dj(nu);return ku.jsxs(bj,lu({as:Fu,className:$0(Eu.root,o),ownerState:nu,onBlur:R,onClick:C,onContextMenu:_,onFocus:K,onKeyDown:iu,onKeyUp:su,onMouseDown:x,onMouseLeave:O,onMouseUp:z,onDragLeave:S,onTouchEnd:H,onTouchMove:I,onTouchStart:$,ref:pu,tabIndex:l?-1:Q,type:q},ou,V,{children:[a,Bu?ku.jsx(gj,lu({ref:M,center:i},Z)):null]}))}),xj=wj;function kj(u){return Mr("MuiButton",u)}const _j=Lr("MuiButton",["root","text","textInherit","textPrimary","textSecondary","textSuccess","textError","textInfo","textWarning","outlined","outlinedInherit","outlinedPrimary","outlinedSecondary","outlinedSuccess","outlinedError","outlinedInfo","outlinedWarning","contained","containedInherit","containedPrimary","containedSecondary","containedSuccess","containedError","containedInfo","containedWarning","disableElevation","focusVisible","disabled","colorInherit","textSizeSmall","textSizeMedium","textSizeLarge","outlinedSizeSmall","outlinedSizeMedium","outlinedSizeLarge","containedSizeSmall","containedSizeMedium","containedSizeLarge","sizeMedium","sizeSmall","sizeLarge","fullWidth","startIcon","endIcon","iconSizeSmall","iconSizeMedium","iconSizeLarge"]),qs=_j,Sj=w.createContext({}),Tj=Sj,Pj=w.createContext(void 0),Oj=Pj,Ij=["children","color","component","className","disabled","disableElevation","disableFocusRipple","endIcon","focusVisibleClassName","fullWidth","size","startIcon","type","variant"],zj=u=>{const{color:e,disableElevation:t,fullWidth:n,size:r,variant:i,classes:a}=u,o={root:["root",i,`${i}${p0(e)}`,`size${p0(r)}`,`${i}Size${p0(r)}`,e==="inherit"&&"colorInherit",t&&"disableElevation",n&&"fullWidth"],label:["label"],startIcon:["startIcon",`iconSize${p0(r)}`],endIcon:["endIcon",`iconSize${p0(r)}`]},s=Ia(o,kj,a);return lu({},a,s)},qB=u=>lu({},u.size==="small"&&{"& > *:nth-of-type(1)":{fontSize:18}},u.size==="medium"&&{"& > *:nth-of-type(1)":{fontSize:20}},u.size==="large"&&{"& > *:nth-of-type(1)":{fontSize:22}}),jj=Tt(xj,{shouldForwardProp:u=>UB(u)||u==="classes",name:"MuiButton",slot:"Root",overridesResolver:(u,e)=>{const{ownerState:t}=u;return[e.root,e[t.variant],e[`${t.variant}${p0(t.color)}`],e[`size${p0(t.size)}`],e[`${t.variant}Size${p0(t.size)}`],t.color==="inherit"&&e.colorInherit,t.disableElevation&&e.disableElevation,t.fullWidth&&e.fullWidth]}})(({theme:u,ownerState:e})=>{var t,n;const r=u.palette.mode==="light"?u.palette.grey[300]:u.palette.grey[800],i=u.palette.mode==="light"?u.palette.grey.A100:u.palette.grey[700];return lu({},u.typography.button,{minWidth:64,padding:"6px 16px",borderRadius:(u.vars||u).shape.borderRadius,transition:u.transitions.create(["background-color","box-shadow","border-color","color"],{duration:u.transitions.duration.short}),"&:hover":lu({textDecoration:"none",backgroundColor:u.vars?`rgba(${u.vars.palette.text.primaryChannel} / ${u.vars.palette.action.hoverOpacity})`:Pi(u.palette.text.primary,u.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},e.variant==="text"&&e.color!=="inherit"&&{backgroundColor:u.vars?`rgba(${u.vars.palette[e.color].mainChannel} / ${u.vars.palette.action.hoverOpacity})`:Pi(u.palette[e.color].main,u.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},e.variant==="outlined"&&e.color!=="inherit"&&{border:`1px solid ${(u.vars||u).palette[e.color].main}`,backgroundColor:u.vars?`rgba(${u.vars.palette[e.color].mainChannel} / ${u.vars.palette.action.hoverOpacity})`:Pi(u.palette[e.color].main,u.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},e.variant==="contained"&&{backgroundColor:u.vars?u.vars.palette.Button.inheritContainedHoverBg:i,boxShadow:(u.vars||u).shadows[4],"@media (hover: none)":{boxShadow:(u.vars||u).shadows[2],backgroundColor:(u.vars||u).palette.grey[300]}},e.variant==="contained"&&e.color!=="inherit"&&{backgroundColor:(u.vars||u).palette[e.color].dark,"@media (hover: none)":{backgroundColor:(u.vars||u).palette[e.color].main}}),"&:active":lu({},e.variant==="contained"&&{boxShadow:(u.vars||u).shadows[8]}),[`&.${qs.focusVisible}`]:lu({},e.variant==="contained"&&{boxShadow:(u.vars||u).shadows[6]}),[`&.${qs.disabled}`]:lu({color:(u.vars||u).palette.action.disabled},e.variant==="outlined"&&{border:`1px solid ${(u.vars||u).palette.action.disabledBackground}`},e.variant==="contained"&&{color:(u.vars||u).palette.action.disabled,boxShadow:(u.vars||u).shadows[0],backgroundColor:(u.vars||u).palette.action.disabledBackground})},e.variant==="text"&&{padding:"6px 8px"},e.variant==="text"&&e.color!=="inherit"&&{color:(u.vars||u).palette[e.color].main},e.variant==="outlined"&&{padding:"5px 15px",border:"1px solid currentColor"},e.variant==="outlined"&&e.color!=="inherit"&&{color:(u.vars||u).palette[e.color].main,border:u.vars?`1px solid rgba(${u.vars.palette[e.color].mainChannel} / 0.5)`:`1px solid ${Pi(u.palette[e.color].main,.5)}`},e.variant==="contained"&&{color:u.vars?u.vars.palette.text.primary:(t=(n=u.palette).getContrastText)==null?void 0:t.call(n,u.palette.grey[300]),backgroundColor:u.vars?u.vars.palette.Button.inheritContainedBg:r,boxShadow:(u.vars||u).shadows[2]},e.variant==="contained"&&e.color!=="inherit"&&{color:(u.vars||u).palette[e.color].contrastText,backgroundColor:(u.vars||u).palette[e.color].main},e.color==="inherit"&&{color:"inherit",borderColor:"currentColor"},e.size==="small"&&e.variant==="text"&&{padding:"4px 5px",fontSize:u.typography.pxToRem(13)},e.size==="large"&&e.variant==="text"&&{padding:"8px 11px",fontSize:u.typography.pxToRem(15)},e.size==="small"&&e.variant==="outlined"&&{padding:"3px 9px",fontSize:u.typography.pxToRem(13)},e.size==="large"&&e.variant==="outlined"&&{padding:"7px 21px",fontSize:u.typography.pxToRem(15)},e.size==="small"&&e.variant==="contained"&&{padding:"4px 10px",fontSize:u.typography.pxToRem(13)},e.size==="large"&&e.variant==="contained"&&{padding:"8px 22px",fontSize:u.typography.pxToRem(15)},e.fullWidth&&{width:"100%"})},({ownerState:u})=>u.disableElevation&&{boxShadow:"none","&:hover":{boxShadow:"none"},[`&.${qs.focusVisible}`]:{boxShadow:"none"},"&:active":{boxShadow:"none"},[`&.${qs.disabled}`]:{boxShadow:"none"}}),Rj=Tt("span",{name:"MuiButton",slot:"StartIcon",overridesResolver:(u,e)=>{const{ownerState:t}=u;return[e.startIcon,e[`iconSize${p0(t.size)}`]]}})(({ownerState:u})=>lu({display:"inherit",marginRight:8,marginLeft:-4},u.size==="small"&&{marginLeft:-2},qB(u))),Nj=Tt("span",{name:"MuiButton",slot:"EndIcon",overridesResolver:(u,e)=>{const{ownerState:t}=u;return[e.endIcon,e[`iconSize${p0(t.size)}`]]}})(({ownerState:u})=>lu({display:"inherit",marginRight:-4,marginLeft:8},u.size==="small"&&{marginRight:-2},qB(u))),$j=w.forwardRef(function(e,t){const n=w.useContext(Tj),r=w.useContext(Oj),i=Df(n,e),a=Xn({props:i,name:"MuiButton"}),{children:o,color:s="primary",component:l="button",className:c,disabled:E=!1,disableElevation:d=!1,disableFocusRipple:f=!1,endIcon:p,focusVisibleClassName:C,fullWidth:v=!1,size:A="medium",startIcon:m,type:g,variant:B="text"}=a,D=_0(a,Ij),F=lu({},a,{color:s,component:l,disabled:E,disableElevation:d,disableFocusRipple:f,fullWidth:v,size:A,type:g,variant:B}),h=zj(F),b=m&&ku.jsx(Rj,{className:h.startIcon,ownerState:F,children:m}),T=p&&ku.jsx(Nj,{className:h.endIcon,ownerState:F,children:p}),k=r||"";return ku.jsxs(jj,lu({ownerState:F,className:$0(n.className,h.root,c,k),component:l,disabled:E,focusRipple:!f,focusVisibleClassName:$0(h.focusVisible,C),ref:t,type:g},D,{classes:h,children:[b,o,T]}))}),Mj=$j,Lj=u=>{let e;return u<1?e=5.11916*u**2:e=4.5*Math.log(u+1)+2,(e/100).toFixed(2)},h8=Lj;function Wj(u){return Mr("MuiPaper",u)}Lr("MuiPaper",["root","rounded","outlined","elevation","elevation0","elevation1","elevation2","elevation3","elevation4","elevation5","elevation6","elevation7","elevation8","elevation9","elevation10","elevation11","elevation12","elevation13","elevation14","elevation15","elevation16","elevation17","elevation18","elevation19","elevation20","elevation21","elevation22","elevation23","elevation24"]);const Uj=["className","component","elevation","square","variant"],qj=u=>{const{square:e,elevation:t,variant:n,classes:r}=u,i={root:["root",n,!e&&"rounded",n==="elevation"&&`elevation${t}`]};return Ia(i,Wj,r)},Hj=Tt("div",{name:"MuiPaper",slot:"Root",overridesResolver:(u,e)=>{const{ownerState:t}=u;return[e.root,e[t.variant],!t.square&&e.rounded,t.variant==="elevation"&&e[`elevation${t.elevation}`]]}})(({theme:u,ownerState:e})=>{var t;return lu({backgroundColor:(u.vars||u).palette.background.paper,color:(u.vars||u).palette.text.primary,transition:u.transitions.create("box-shadow")},!e.square&&{borderRadius:u.shape.borderRadius},e.variant==="outlined"&&{border:`1px solid ${(u.vars||u).palette.divider}`},e.variant==="elevation"&&lu({boxShadow:(u.vars||u).shadows[e.elevation]},!u.vars&&u.palette.mode==="dark"&&{backgroundImage:`linear-gradient(${Pi("#fff",h8(e.elevation))}, ${Pi("#fff",h8(e.elevation))})`},u.vars&&{backgroundImage:(t=u.vars.overlays)==null?void 0:t[e.elevation]}))}),Kj=w.forwardRef(function(e,t){const n=Xn({props:e,name:"MuiPaper"}),{className:r,component:i="div",elevation:a=1,square:o=!1,variant:s="elevation"}=n,l=_0(n,Uj),c=lu({},n,{component:i,elevation:a,square:o,variant:s}),E=qj(c);return ku.jsx(Hj,lu({as:i,ownerState:c,className:$0(E.root,r),ref:t},l))}),Vj=Kj;function Gj(u){return Mr("MuiAppBar",u)}Lr("MuiAppBar",["root","positionFixed","positionAbsolute","positionSticky","positionStatic","positionRelative","colorDefault","colorPrimary","colorSecondary","colorInherit","colorTransparent","colorError","colorInfo","colorSuccess","colorWarning"]);const Qj=["className","color","enableColorOnDark","position"],Xj=u=>{const{color:e,position:t,classes:n}=u,r={root:["root",`color${p0(e)}`,`position${p0(t)}`]};return Ia(r,Gj,n)},Hs=(u,e)=>u?`${u==null?void 0:u.replace(")","")}, ${e})`:e,Yj=Tt(Vj,{name:"MuiAppBar",slot:"Root",overridesResolver:(u,e)=>{const{ownerState:t}=u;return[e.root,e[`position${p0(t.position)}`],e[`color${p0(t.color)}`]]}})(({theme:u,ownerState:e})=>{const t=u.palette.mode==="light"?u.palette.grey[100]:u.palette.grey[900];return lu({display:"flex",flexDirection:"column",width:"100%",boxSizing:"border-box",flexShrink:0},e.position==="fixed"&&{position:"fixed",zIndex:(u.vars||u).zIndex.appBar,top:0,left:"auto",right:0,"@media print":{position:"absolute"}},e.position==="absolute"&&{position:"absolute",zIndex:(u.vars||u).zIndex.appBar,top:0,left:"auto",right:0},e.position==="sticky"&&{position:"sticky",zIndex:(u.vars||u).zIndex.appBar,top:0,left:"auto",right:0},e.position==="static"&&{position:"static"},e.position==="relative"&&{position:"relative"},!u.vars&&lu({},e.color==="default"&&{backgroundColor:t,color:u.palette.getContrastText(t)},e.color&&e.color!=="default"&&e.color!=="inherit"&&e.color!=="transparent"&&{backgroundColor:u.palette[e.color].main,color:u.palette[e.color].contrastText},e.color==="inherit"&&{color:"inherit"},u.palette.mode==="dark"&&!e.enableColorOnDark&&{backgroundColor:null,color:null},e.color==="transparent"&&lu({backgroundColor:"transparent",color:"inherit"},u.palette.mode==="dark"&&{backgroundImage:"none"})),u.vars&&lu({},e.color==="default"&&{"--AppBar-background":e.enableColorOnDark?u.vars.palette.AppBar.defaultBg:Hs(u.vars.palette.AppBar.darkBg,u.vars.palette.AppBar.defaultBg),"--AppBar-color":e.enableColorOnDark?u.vars.palette.text.primary:Hs(u.vars.palette.AppBar.darkColor,u.vars.palette.text.primary)},e.color&&!e.color.match(/^(default|inherit|transparent)$/)&&{"--AppBar-background":e.enableColorOnDark?u.vars.palette[e.color].main:Hs(u.vars.palette.AppBar.darkBg,u.vars.palette[e.color].main),"--AppBar-color":e.enableColorOnDark?u.vars.palette[e.color].contrastText:Hs(u.vars.palette.AppBar.darkColor,u.vars.palette[e.color].contrastText)},{backgroundColor:"var(--AppBar-background)",color:e.color==="inherit"?"inherit":"var(--AppBar-color)"},e.color==="transparent"&&{backgroundImage:"none",backgroundColor:"transparent",color:"inherit"}))}),Zj=w.forwardRef(function(e,t){const n=Xn({props:e,name:"MuiAppBar"}),{className:r,color:i="primary",enableColorOnDark:a=!1,position:o="fixed"}=n,s=_0(n,Qj),l=lu({},n,{color:i,position:o,enableColorOnDark:a}),c=Xj(l);return ku.jsx(Yj,lu({square:!0,component:"header",ownerState:l,elevation:4,className:$0(c.root,r,o==="fixed"&&"mui-fixed"),ref:t},s))}),Jj=Zj;function uR(u){return Mr("MuiToolbar",u)}Lr("MuiToolbar",["root","gutters","regular","dense"]);const eR=["className","component","disableGutters","variant"],tR=u=>{const{classes:e,disableGutters:t,variant:n}=u;return Ia({root:["root",!t&&"gutters",n]},uR,e)},nR=Tt("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(u,e)=>{const{ownerState:t}=u;return[e.root,!t.disableGutters&&e.gutters,e[t.variant]]}})(({theme:u,ownerState:e})=>lu({position:"relative",display:"flex",alignItems:"center"},!e.disableGutters&&{paddingLeft:u.spacing(2),paddingRight:u.spacing(2),[u.breakpoints.up("sm")]:{paddingLeft:u.spacing(3),paddingRight:u.spacing(3)}},e.variant==="dense"&&{minHeight:48}),({theme:u,ownerState:e})=>e.variant==="regular"&&u.mixins.toolbar),rR=w.forwardRef(function(e,t){const n=Xn({props:e,name:"MuiToolbar"}),{className:r,component:i="div",disableGutters:a=!1,variant:o="regular"}=n,s=_0(n,eR),l=lu({},n,{component:i,disableGutters:a,variant:o}),c=tR(l);return ku.jsx(nR,lu({as:i,className:$0(c.root,r),ref:t,ownerState:l},s))}),iR=rR,aR=Az({createStyledComponent:Tt("div",{name:"MuiContainer",slot:"Root",overridesResolver:(u,e)=>{const{ownerState:t}=u;return[e.root,e[`maxWidth${p0(String(t.maxWidth))}`],t.fixed&&e.fixed,t.disableGutters&&e.disableGutters]}}),useThemeProps:u=>Xn({props:u,name:"MuiContainer"})}),oR=aR,sR=["theme"];function lR(u){let{theme:e}=u,t=_0(u,sR);const n=e[ta];return ku.jsx(dz,lu({},t,{themeId:n?ta:void 0,theme:n||e}))}const cR=Lr("MuiBox",["root"]),ER=cR,dR=$f(),fR=WI({themeId:ta,defaultTheme:dR,defaultClassName:ER.root,generateClassName:pB.generate}),m8=fR,pR="/real-token/logo.svg",CR="modulepreload",hR=function(u){return"/real-token/"+u},A8={},xu=function(e,t,n){if(!t||t.length===0)return e();const r=document.getElementsByTagName("link");return Promise.all(t.map(i=>{if(i=hR(i),i in A8)return;A8[i]=!0;const a=i.endsWith(".css"),o=a?'[rel="stylesheet"]':"";if(!!n)for(let c=r.length-1;c>=0;c--){const E=r[c];if(E.href===i&&(!a||E.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${o}`))return;const l=document.createElement("link");if(l.rel=a?"stylesheet":CR,a||(l.as="script",l.crossOrigin=""),l.href=i,document.head.appendChild(l),a)return new Promise((c,E)=>{l.addEventListener("load",c),l.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>e()).catch(i=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i})};var g8='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',mR={rounded:`SFRounded, ui-rounded, "SF Pro Rounded", ${g8}`,system:g8},Fo={large:{actionButton:"9999px",connectButton:"12px",modal:"24px",modalMobile:"28px"},medium:{actionButton:"10px",connectButton:"8px",modal:"16px",modalMobile:"18px"},none:{actionButton:"0px",connectButton:"0px",modal:"0px",modalMobile:"0px"},small:{actionButton:"4px",connectButton:"4px",modal:"8px",modalMobile:"8px"}},AR={large:{modalOverlay:"blur(20px)"},none:{modalOverlay:"blur(0px)"},small:{modalOverlay:"blur(4px)"}},gR=({borderRadius:u="large",fontStack:e="rounded",overlayBlur:t="none"})=>({blurs:{modalOverlay:AR[t].modalOverlay},fonts:{body:mR[e]},radii:{actionButton:Fo[u].actionButton,connectButton:Fo[u].connectButton,menuButton:Fo[u].connectButton,modal:Fo[u].modal,modalMobile:Fo[u].modalMobile}}),HB={blue:{accentColor:"#0E76FD",accentColorForeground:"#FFF"},green:{accentColor:"#1DB847",accentColorForeground:"#FFF"},orange:{accentColor:"#FF801F",accentColorForeground:"#FFF"},pink:{accentColor:"#FF5CA0",accentColorForeground:"#FFF"},purple:{accentColor:"#5F5AFA",accentColorForeground:"#FFF"},red:{accentColor:"#FA423C",accentColorForeground:"#FFF"}},v8=HB.blue,KB=({accentColor:u=v8.accentColor,accentColorForeground:e=v8.accentColorForeground,...t}={})=>({...gR(t),colors:{accentColor:u,accentColorForeground:e,actionButtonBorder:"rgba(0, 0, 0, 0.04)",actionButtonBorderMobile:"rgba(0, 0, 0, 0.06)",actionButtonSecondaryBackground:"rgba(0, 0, 0, 0.06)",closeButton:"rgba(60, 66, 66, 0.8)",closeButtonBackground:"rgba(0, 0, 0, 0.06)",connectButtonBackground:"#FFF",connectButtonBackgroundError:"#FF494A",connectButtonInnerBackground:"linear-gradient(0deg, rgba(0, 0, 0, 0.03), rgba(0, 0, 0, 0.06))",connectButtonText:"#25292E",connectButtonTextError:"#FFF",connectionIndicator:"#30E000",downloadBottomCardBackground:"linear-gradient(126deg, rgba(255, 255, 255, 0) 9.49%, rgba(171, 171, 171, 0.04) 71.04%), #FFFFFF",downloadTopCardBackground:"linear-gradient(126deg, rgba(171, 171, 171, 0.2) 9.49%, rgba(255, 255, 255, 0) 71.04%), #FFFFFF",error:"#FF494A",generalBorder:"rgba(0, 0, 0, 0.06)",generalBorderDim:"rgba(0, 0, 0, 0.03)",menuItemBackground:"rgba(60, 66, 66, 0.1)",modalBackdrop:"rgba(0, 0, 0, 0.3)",modalBackground:"#FFF",modalBorder:"transparent",modalText:"#25292E",modalTextDim:"rgba(60, 66, 66, 0.3)",modalTextSecondary:"rgba(60, 66, 66, 0.6)",profileAction:"#FFF",profileActionHover:"rgba(255, 255, 255, 0.5)",profileForeground:"rgba(60, 66, 66, 0.06)",selectedOptionBorder:"rgba(60, 66, 66, 0.1)",standby:"#FFD641"},shadows:{connectButton:"0px 4px 12px rgba(0, 0, 0, 0.1)",dialog:"0px 8px 32px rgba(0, 0, 0, 0.32)",profileDetailsAction:"0px 2px 6px rgba(37, 41, 46, 0.04)",selectedOption:"0px 2px 6px rgba(0, 0, 0, 0.24)",selectedWallet:"0px 2px 6px rgba(0, 0, 0, 0.12)",walletLogo:"0px 2px 16px rgba(0, 0, 0, 0.16)"}});KB.accentColors=HB;function vR(u,e){return Object.defineProperty(u,"__recipe__",{value:e,writable:!1}),u}var VB=vR;function GB(u){var{conditions:e}=u;if(!e)throw new Error("Styles have no conditions");function t(n){if(typeof n=="string"||typeof n=="number"||typeof n=="boolean"){if(!e.defaultCondition)throw new Error("No default condition");return{[e.defaultCondition]:n}}if(Array.isArray(n)){if(!("responsiveArray"in e))throw new Error("Responsive arrays are not supported");var r={};for(var i in e.responsiveArray)n[i]!=null&&(r[e.responsiveArray[i]]=n[i]);return r}return n}return VB(t,{importPath:"@vanilla-extract/sprinkles/createUtils",importName:"createNormalizeValueFn",args:[{conditions:u.conditions}]})}function BR(u){var{conditions:e}=u;if(!e)throw new Error("Styles have no conditions");var t=GB(u);function n(r,i){if(typeof r=="string"||typeof r=="number"||typeof r=="boolean"){if(!e.defaultCondition)throw new Error("No default condition");return i(r,e.defaultCondition)}var a=Array.isArray(r)?t(r):r,o={};for(var s in a)a[s]!=null&&(o[s]=i(a[s],s));return o}return VB(n,{importPath:"@vanilla-extract/sprinkles/createUtils",importName:"createMapValueFn",args:[{conditions:u.conditions}]})}function FR(u,e,t){return e in u?Object.defineProperty(u,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):u[e]=t,u}function B8(u,e){var t=Object.keys(u);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(u);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(u,r).enumerable})),t.push.apply(t,n)}return t}function d9(u){for(var e=1;efunction(){for(var e=arguments.length,t=new Array(e),n=0;ns.styles)),i=Object.keys(r),a=i.filter(s=>"mappings"in r[s]),o=s=>{var l=[],c={},E=d9({},s),d=!1;for(var f of a){var p=s[f];if(p!=null){var C=r[f];d=!0;for(var v of C.mappings)c[v]=p,E[v]==null&&delete E[v]}}var A=d?d9(d9({},c),E):s;for(var m in A){var g=A[m],B=r[m];try{if(B.mappings)continue;if(typeof g=="string"||typeof g=="number")l.push(B.values[g].defaultClass);else if(Array.isArray(g))for(var D=0;Du,bR=function(){return yR(DR)(...arguments)};function wR({storage:u,key:e="REACT_QUERY_OFFLINE_CACHE",throttleTime:t=1e3,serialize:n=JSON.stringify,deserialize:r=JSON.parse,retry:i}){if(u){const a=o=>{try{u.setItem(e,n(o));return}catch(s){return s}};return{persistClient:xR(o=>{let s=o,l=a(s),c=0;for(;l&&s;)c++,s=i==null?void 0:i({persistedClient:s,error:l,errorCount:c}),s&&(l=a(s))},t),restoreClient:()=>{const o=u.getItem(e);if(o)return r(o)},removeClient:()=>{u.removeItem(e)}}}return{persistClient:F8,restoreClient:()=>{},removeClient:F8}}function xR(u,e=100){let t=null,n;return function(...r){n=r,t===null&&(t=setTimeout(()=>{u(...n),t=null},e))}}function F8(){}class ja{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){const t={listener:e};return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}}const g4=typeof window>"u"||"Deno"in window;function Re(){}function kR(u,e){return typeof u=="function"?u(e):u}function Cd(u){return typeof u=="number"&&u>=0&&u!==1/0}function QB(u,e){return Math.max(u+(e||0)-Date.now(),0)}function Ks(u,e,t){return M4(u)?typeof e=="function"?{...t,queryKey:u,queryFn:e}:{...e,queryKey:u}:u}function XB(u,e,t){return M4(u)?typeof e=="function"?{...t,mutationKey:u,mutationFn:e}:{...e,mutationKey:u}:typeof u=="function"?{...e,mutationFn:u}:{...u}}function gn(u,e,t){return M4(u)?[{...e,queryKey:u},t]:[u||{},e]}function y8(u,e){const{type:t="all",exact:n,fetchStatus:r,predicate:i,queryKey:a,stale:o}=u;if(M4(a)){if(n){if(e.queryHash!==Uf(a,e.options))return!1}else if(!El(e.queryKey,a))return!1}if(t!=="all"){const s=e.isActive();if(t==="active"&&!s||t==="inactive"&&s)return!1}return!(typeof o=="boolean"&&e.isStale()!==o||typeof r<"u"&&r!==e.state.fetchStatus||i&&!i(e))}function D8(u,e){const{exact:t,fetching:n,predicate:r,mutationKey:i}=u;if(M4(i)){if(!e.options.mutationKey)return!1;if(t){if(hr(e.options.mutationKey)!==hr(i))return!1}else if(!El(e.options.mutationKey,i))return!1}return!(typeof n=="boolean"&&e.state.status==="loading"!==n||r&&!r(e))}function Uf(u,e){return((e==null?void 0:e.queryKeyHashFn)||hr)(u)}function hr(u){return JSON.stringify(u,(e,t)=>hd(t)?Object.keys(t).sort().reduce((n,r)=>(n[r]=t[r],n),{}):t)}function El(u,e){return YB(u,e)}function YB(u,e){return u===e?!0:typeof u!=typeof e?!1:u&&e&&typeof u=="object"&&typeof e=="object"?!Object.keys(e).some(t=>!YB(u[t],e[t])):!1}function ZB(u,e){if(u===e)return u;const t=b8(u)&&b8(e);if(t||hd(u)&&hd(e)){const n=t?u.length:Object.keys(u).length,r=t?e:Object.keys(e),i=r.length,a=t?[]:{};let o=0;for(let s=0;s"u")return!0;const t=e.prototype;return!(!w8(t)||!t.hasOwnProperty("isPrototypeOf"))}function w8(u){return Object.prototype.toString.call(u)==="[object Object]"}function M4(u){return Array.isArray(u)}function JB(u){return new Promise(e=>{setTimeout(e,u)})}function x8(u){JB(0).then(u)}function _R(){if(typeof AbortController=="function")return new AbortController}function md(u,e,t){return t.isDataEqual!=null&&t.isDataEqual(u,e)?u:typeof t.structuralSharing=="function"?t.structuralSharing(u,e):t.structuralSharing!==!1?ZB(u,e):e}class SR extends ja{constructor(){super(),this.setup=e=>{if(!g4&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),window.addEventListener("focus",t,!1),()=>{window.removeEventListener("visibilitychange",t),window.removeEventListener("focus",t)}}}}onSubscribe(){this.cleanup||this.setEventListener(this.setup)}onUnsubscribe(){if(!this.hasListeners()){var e;(e=this.cleanup)==null||e.call(this),this.cleanup=void 0}}setEventListener(e){var t;this.setup=e,(t=this.cleanup)==null||t.call(this),this.cleanup=e(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()})}setFocused(e){this.focused!==e&&(this.focused=e,this.onFocus())}onFocus(){this.listeners.forEach(({listener:e})=>{e()})}isFocused(){return typeof this.focused=="boolean"?this.focused:typeof document>"u"?!0:[void 0,"visible","prerender"].includes(document.visibilityState)}}const fl=new SR,k8=["online","offline"];class TR extends ja{constructor(){super(),this.setup=e=>{if(!g4&&window.addEventListener){const t=()=>e();return k8.forEach(n=>{window.addEventListener(n,t,!1)}),()=>{k8.forEach(n=>{window.removeEventListener(n,t)})}}}}onSubscribe(){this.cleanup||this.setEventListener(this.setup)}onUnsubscribe(){if(!this.hasListeners()){var e;(e=this.cleanup)==null||e.call(this),this.cleanup=void 0}}setEventListener(e){var t;this.setup=e,(t=this.cleanup)==null||t.call(this),this.cleanup=e(n=>{typeof n=="boolean"?this.setOnline(n):this.onOnline()})}setOnline(e){this.online!==e&&(this.online=e,this.onOnline())}onOnline(){this.listeners.forEach(({listener:e})=>{e()})}isOnline(){return typeof this.online=="boolean"?this.online:typeof navigator>"u"||typeof navigator.onLine>"u"?!0:navigator.onLine}}const pl=new TR;function PR(u){return Math.min(1e3*2**u,3e4)}function Gc(u){return(u??"online")==="online"?pl.isOnline():!0}class uF{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}}function x3(u){return u instanceof uF}function eF(u){let e=!1,t=0,n=!1,r,i,a;const o=new Promise((v,A)=>{i=v,a=A}),s=v=>{n||(f(new uF(v)),u.abort==null||u.abort())},l=()=>{e=!0},c=()=>{e=!1},E=()=>!fl.isFocused()||u.networkMode!=="always"&&!pl.isOnline(),d=v=>{n||(n=!0,u.onSuccess==null||u.onSuccess(v),r==null||r(),i(v))},f=v=>{n||(n=!0,u.onError==null||u.onError(v),r==null||r(),a(v))},p=()=>new Promise(v=>{r=A=>{const m=n||!E();return m&&v(A),m},u.onPause==null||u.onPause()}).then(()=>{r=void 0,n||u.onContinue==null||u.onContinue()}),C=()=>{if(n)return;let v;try{v=u.fn()}catch(A){v=Promise.reject(A)}Promise.resolve(v).then(d).catch(A=>{var m,g;if(n)return;const B=(m=u.retry)!=null?m:3,D=(g=u.retryDelay)!=null?g:PR,F=typeof D=="function"?D(t,A):D,h=B===!0||typeof B=="number"&&t{if(E())return p()}).then(()=>{e?f(A):C()})})};return Gc(u.networkMode)?C():p().then(C),{promise:o,cancel:s,continue:()=>(r==null?void 0:r())?o:Promise.resolve(),cancelRetry:l,continueRetry:c}}const qf=console;function OR(){let u=[],e=0,t=c=>{c()},n=c=>{c()};const r=c=>{let E;e++;try{E=c()}finally{e--,e||o()}return E},i=c=>{e?u.push(c):x8(()=>{t(c)})},a=c=>(...E)=>{i(()=>{c(...E)})},o=()=>{const c=u;u=[],c.length&&x8(()=>{n(()=>{c.forEach(E=>{t(E)})})})};return{batch:r,batchCalls:a,schedule:i,setNotifyFunction:c=>{t=c},setBatchNotifyFunction:c=>{n=c}}}const f0=OR();class tF{destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Cd(this.cacheTime)&&(this.gcTimeout=setTimeout(()=>{this.optionalRemove()},this.cacheTime))}updateCacheTime(e){this.cacheTime=Math.max(this.cacheTime||0,e??(g4?1/0:5*60*1e3))}clearGcTimeout(){this.gcTimeout&&(clearTimeout(this.gcTimeout),this.gcTimeout=void 0)}}class IR extends tF{constructor(e){super(),this.abortSignalConsumed=!1,this.defaultOptions=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.cache=e.cache,this.logger=e.logger||qf,this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.initialState=e.state||zR(this.options),this.state=this.initialState,this.scheduleGc()}get meta(){return this.options.meta}setOptions(e){this.options={...this.defaultOptions,...e},this.updateCacheTime(this.options.cacheTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.cache.remove(this)}setData(e,t){const n=md(this.state.data,e,this.options);return this.dispatch({data:n,type:"success",dataUpdatedAt:t==null?void 0:t.updatedAt,manual:t==null?void 0:t.manual}),n}setState(e,t){this.dispatch({type:"setState",state:e,setStateOptions:t})}cancel(e){var t;const n=this.promise;return(t=this.retryer)==null||t.cancel(e),n?n.then(Re).catch(Re):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.initialState)}isActive(){return this.observers.some(e=>e.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||this.observers.some(e=>e.getCurrentResult().isStale)}isStaleByTime(e=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!QB(this.state.dataUpdatedAt,e)}onFocus(){var e;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t&&t.refetch({cancelRefetch:!1}),(e=this.retryer)==null||e.continue()}onOnline(){var e;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t&&t.refetch({cancelRefetch:!1}),(e=this.retryer)==null||e.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.cache.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.retryer&&(this.abortSignalConsumed?this.retryer.cancel({revert:!0}):this.retryer.cancelRetry()),this.scheduleGc()),this.cache.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.dispatch({type:"invalidate"})}fetch(e,t){var n,r;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&t!=null&&t.cancelRefetch)this.cancel({silent:!0});else if(this.promise){var i;return(i=this.retryer)==null||i.continueRetry(),this.promise}}if(e&&this.setOptions(e),!this.options.queryFn){const f=this.observers.find(p=>p.options.queryFn);f&&this.setOptions(f.options)}const a=_R(),o={queryKey:this.queryKey,pageParam:void 0,meta:this.meta},s=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>{if(a)return this.abortSignalConsumed=!0,a.signal}})};s(o);const l=()=>this.options.queryFn?(this.abortSignalConsumed=!1,this.options.queryFn(o)):Promise.reject("Missing queryFn for queryKey '"+this.options.queryHash+"'"),c={fetchOptions:t,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:l};if(s(c),(n=this.options.behavior)==null||n.onFetch(c),this.revertState=this.state,this.state.fetchStatus==="idle"||this.state.fetchMeta!==((r=c.fetchOptions)==null?void 0:r.meta)){var E;this.dispatch({type:"fetch",meta:(E=c.fetchOptions)==null?void 0:E.meta})}const d=f=>{if(x3(f)&&f.silent||this.dispatch({type:"error",error:f}),!x3(f)){var p,C,v,A;(p=(C=this.cache.config).onError)==null||p.call(C,f,this),(v=(A=this.cache.config).onSettled)==null||v.call(A,this.state.data,f,this)}this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return this.retryer=eF({fn:c.fetchFn,abort:a==null?void 0:a.abort.bind(a),onSuccess:f=>{var p,C,v,A;if(typeof f>"u"){d(new Error(this.queryHash+" data is undefined"));return}this.setData(f),(p=(C=this.cache.config).onSuccess)==null||p.call(C,f,this),(v=(A=this.cache.config).onSettled)==null||v.call(A,f,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:d,onFail:(f,p)=>{this.dispatch({type:"failed",failureCount:f,error:p})},onPause:()=>{this.dispatch({type:"pause"})},onContinue:()=>{this.dispatch({type:"continue"})},retry:c.options.retry,retryDelay:c.options.retryDelay,networkMode:c.options.networkMode}),this.promise=this.retryer.promise,this.promise}dispatch(e){const t=n=>{var r,i;switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:(r=e.meta)!=null?r:null,fetchStatus:Gc(this.options.networkMode)?"fetching":"paused",...!n.dataUpdatedAt&&{error:null,status:"loading"}};case"success":return{...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:(i=e.dataUpdatedAt)!=null?i:Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const a=e.error;return x3(a)&&a.revert&&this.revertState?{...this.revertState,fetchStatus:"idle"}:{...n,error:a,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),f0.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate(e)}),this.cache.notify({query:this,type:"updated",action:e})})}}function zR(u){const e=typeof u.initialData=="function"?u.initialData():u.initialData,t=typeof e<"u",n=t?typeof u.initialDataUpdatedAt=="function"?u.initialDataUpdatedAt():u.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:t?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:t?"success":"loading",fetchStatus:"idle"}}class jR extends ja{constructor(e){super(),this.config=e||{},this.queries=[],this.queriesMap={}}build(e,t,n){var r;const i=t.queryKey,a=(r=t.queryHash)!=null?r:Uf(i,t);let o=this.get(a);return o||(o=new IR({cache:this,logger:e.getLogger(),queryKey:i,queryHash:a,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){this.queriesMap[e.queryHash]||(this.queriesMap[e.queryHash]=e,this.queries.push(e),this.notify({type:"added",query:e}))}remove(e){const t=this.queriesMap[e.queryHash];t&&(e.destroy(),this.queries=this.queries.filter(n=>n!==e),t===e&&delete this.queriesMap[e.queryHash],this.notify({type:"removed",query:e}))}clear(){f0.batch(()=>{this.queries.forEach(e=>{this.remove(e)})})}get(e){return this.queriesMap[e]}getAll(){return this.queries}find(e,t){const[n]=gn(e,t);return typeof n.exact>"u"&&(n.exact=!0),this.queries.find(r=>y8(n,r))}findAll(e,t){const[n]=gn(e,t);return Object.keys(n).length>0?this.queries.filter(r=>y8(n,r)):this.queries}notify(e){f0.batch(()=>{this.listeners.forEach(({listener:t})=>{t(e)})})}onFocus(){f0.batch(()=>{this.queries.forEach(e=>{e.onFocus()})})}onOnline(){f0.batch(()=>{this.queries.forEach(e=>{e.onOnline()})})}}class RR extends tF{constructor(e){super(),this.defaultOptions=e.defaultOptions,this.mutationId=e.mutationId,this.mutationCache=e.mutationCache,this.logger=e.logger||qf,this.observers=[],this.state=e.state||nF(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options={...this.defaultOptions,...e},this.updateCacheTime(this.options.cacheTime)}get meta(){return this.options.meta}setState(e){this.dispatch({type:"setState",state:e})}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.mutationCache.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.observers=this.observers.filter(t=>t!==e),this.scheduleGc(),this.mutationCache.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.observers.length||(this.state.status==="loading"?this.scheduleGc():this.mutationCache.remove(this))}continue(){var e,t;return(e=(t=this.retryer)==null?void 0:t.continue())!=null?e:this.execute()}async execute(){const e=()=>{var h;return this.retryer=eF({fn:()=>this.options.mutationFn?this.options.mutationFn(this.state.variables):Promise.reject("No mutationFn found"),onFail:(b,T)=>{this.dispatch({type:"failed",failureCount:b,error:T})},onPause:()=>{this.dispatch({type:"pause"})},onContinue:()=>{this.dispatch({type:"continue"})},retry:(h=this.options.retry)!=null?h:0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode}),this.retryer.promise},t=this.state.status==="loading";try{var n,r,i,a,o,s,l,c;if(!t){var E,d,f,p;this.dispatch({type:"loading",variables:this.options.variables}),await((E=(d=this.mutationCache.config).onMutate)==null?void 0:E.call(d,this.state.variables,this));const b=await((f=(p=this.options).onMutate)==null?void 0:f.call(p,this.state.variables));b!==this.state.context&&this.dispatch({type:"loading",context:b,variables:this.state.variables})}const h=await e();return await((n=(r=this.mutationCache.config).onSuccess)==null?void 0:n.call(r,h,this.state.variables,this.state.context,this)),await((i=(a=this.options).onSuccess)==null?void 0:i.call(a,h,this.state.variables,this.state.context)),await((o=(s=this.mutationCache.config).onSettled)==null?void 0:o.call(s,h,null,this.state.variables,this.state.context,this)),await((l=(c=this.options).onSettled)==null?void 0:l.call(c,h,null,this.state.variables,this.state.context)),this.dispatch({type:"success",data:h}),h}catch(h){try{var C,v,A,m,g,B,D,F;throw await((C=(v=this.mutationCache.config).onError)==null?void 0:C.call(v,h,this.state.variables,this.state.context,this)),await((A=(m=this.options).onError)==null?void 0:A.call(m,h,this.state.variables,this.state.context)),await((g=(B=this.mutationCache.config).onSettled)==null?void 0:g.call(B,void 0,h,this.state.variables,this.state.context,this)),await((D=(F=this.options).onSettled)==null?void 0:D.call(F,void 0,h,this.state.variables,this.state.context)),h}finally{this.dispatch({type:"error",error:h})}}}dispatch(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"loading":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!Gc(this.options.networkMode),status:"loading",variables:e.variables};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"};case"setState":return{...n,...e.state}}};this.state=t(this.state),f0.batch(()=>{this.observers.forEach(n=>{n.onMutationUpdate(e)}),this.mutationCache.notify({mutation:this,type:"updated",action:e})})}}function nF(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0}}class NR extends ja{constructor(e){super(),this.config=e||{},this.mutations=[],this.mutationId=0}build(e,t,n){const r=new RR({mutationCache:this,logger:e.getLogger(),mutationId:++this.mutationId,options:e.defaultMutationOptions(t),state:n,defaultOptions:t.mutationKey?e.getMutationDefaults(t.mutationKey):void 0});return this.add(r),r}add(e){this.mutations.push(e),this.notify({type:"added",mutation:e})}remove(e){this.mutations=this.mutations.filter(t=>t!==e),this.notify({type:"removed",mutation:e})}clear(){f0.batch(()=>{this.mutations.forEach(e=>{this.remove(e)})})}getAll(){return this.mutations}find(e){return typeof e.exact>"u"&&(e.exact=!0),this.mutations.find(t=>D8(e,t))}findAll(e){return this.mutations.filter(t=>D8(e,t))}notify(e){f0.batch(()=>{this.listeners.forEach(({listener:t})=>{t(e)})})}resumePausedMutations(){var e;return this.resuming=((e=this.resuming)!=null?e:Promise.resolve()).then(()=>{const t=this.mutations.filter(n=>n.state.isPaused);return f0.batch(()=>t.reduce((n,r)=>n.then(()=>r.continue().catch(Re)),Promise.resolve()))}).then(()=>{this.resuming=void 0}),this.resuming}}function $R(){return{onFetch:u=>{u.fetchFn=()=>{var e,t,n,r,i,a;const o=(e=u.fetchOptions)==null||(t=e.meta)==null?void 0:t.refetchPage,s=(n=u.fetchOptions)==null||(r=n.meta)==null?void 0:r.fetchMore,l=s==null?void 0:s.pageParam,c=(s==null?void 0:s.direction)==="forward",E=(s==null?void 0:s.direction)==="backward",d=((i=u.state.data)==null?void 0:i.pages)||[],f=((a=u.state.data)==null?void 0:a.pageParams)||[];let p=f,C=!1;const v=F=>{Object.defineProperty(F,"signal",{enumerable:!0,get:()=>{var h;if((h=u.signal)!=null&&h.aborted)C=!0;else{var b;(b=u.signal)==null||b.addEventListener("abort",()=>{C=!0})}return u.signal}})},A=u.options.queryFn||(()=>Promise.reject("Missing queryFn for queryKey '"+u.options.queryHash+"'")),m=(F,h,b,T)=>(p=T?[h,...p]:[...p,h],T?[b,...F]:[...F,b]),g=(F,h,b,T)=>{if(C)return Promise.reject("Cancelled");if(typeof b>"u"&&!h&&F.length)return Promise.resolve(F);const k={queryKey:u.queryKey,pageParam:b,meta:u.options.meta};v(k);const L=A(k);return Promise.resolve(L).then(Z=>m(F,b,Z,T))};let B;if(!d.length)B=g([]);else if(c){const F=typeof l<"u",h=F?l:_8(u.options,d);B=g(d,F,h)}else if(E){const F=typeof l<"u",h=F?l:MR(u.options,d);B=g(d,F,h,!0)}else{p=[];const F=typeof u.options.getNextPageParam>"u";B=(o&&d[0]?o(d[0],0,d):!0)?g([],F,f[0]):Promise.resolve(m([],f[0],d[0]));for(let b=1;b{if(o&&d[b]?o(d[b],b,d):!0){const L=F?f[b]:_8(u.options,T);return g(T,F,L)}return Promise.resolve(m(T,f[b],d[b]))})}return B.then(F=>({pages:F,pageParams:p}))}}}}function _8(u,e){return u.getNextPageParam==null?void 0:u.getNextPageParam(e[e.length-1],e)}function MR(u,e){return u.getPreviousPageParam==null?void 0:u.getPreviousPageParam(e[0],e)}class LR{constructor(e={}){this.queryCache=e.queryCache||new jR,this.mutationCache=e.mutationCache||new NR,this.logger=e.logger||qf,this.defaultOptions=e.defaultOptions||{},this.queryDefaults=[],this.mutationDefaults=[],this.mountCount=0}mount(){this.mountCount++,this.mountCount===1&&(this.unsubscribeFocus=fl.subscribe(()=>{fl.isFocused()&&(this.resumePausedMutations(),this.queryCache.onFocus())}),this.unsubscribeOnline=pl.subscribe(()=>{pl.isOnline()&&(this.resumePausedMutations(),this.queryCache.onOnline())}))}unmount(){var e,t;this.mountCount--,this.mountCount===0&&((e=this.unsubscribeFocus)==null||e.call(this),this.unsubscribeFocus=void 0,(t=this.unsubscribeOnline)==null||t.call(this),this.unsubscribeOnline=void 0)}isFetching(e,t){const[n]=gn(e,t);return n.fetchStatus="fetching",this.queryCache.findAll(n).length}isMutating(e){return this.mutationCache.findAll({...e,fetching:!0}).length}getQueryData(e,t){var n;return(n=this.queryCache.find(e,t))==null?void 0:n.state.data}ensureQueryData(e,t,n){const r=Ks(e,t,n),i=this.getQueryData(r.queryKey);return i?Promise.resolve(i):this.fetchQuery(r)}getQueriesData(e){return this.getQueryCache().findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.queryCache.find(e),i=r==null?void 0:r.state.data,a=kR(t,i);if(typeof a>"u")return;const o=Ks(e),s=this.defaultQueryOptions(o);return this.queryCache.build(this,s).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return f0.batch(()=>this.getQueryCache().findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e,t){var n;return(n=this.queryCache.find(e,t))==null?void 0:n.state}removeQueries(e,t){const[n]=gn(e,t),r=this.queryCache;f0.batch(()=>{r.findAll(n).forEach(i=>{r.remove(i)})})}resetQueries(e,t,n){const[r,i]=gn(e,t,n),a=this.queryCache,o={type:"active",...r};return f0.batch(()=>(a.findAll(r).forEach(s=>{s.reset()}),this.refetchQueries(o,i)))}cancelQueries(e,t,n){const[r,i={}]=gn(e,t,n);typeof i.revert>"u"&&(i.revert=!0);const a=f0.batch(()=>this.queryCache.findAll(r).map(o=>o.cancel(i)));return Promise.all(a).then(Re).catch(Re)}invalidateQueries(e,t,n){const[r,i]=gn(e,t,n);return f0.batch(()=>{var a,o;if(this.queryCache.findAll(r).forEach(l=>{l.invalidate()}),r.refetchType==="none")return Promise.resolve();const s={...r,type:(a=(o=r.refetchType)!=null?o:r.type)!=null?a:"active"};return this.refetchQueries(s,i)})}refetchQueries(e,t,n){const[r,i]=gn(e,t,n),a=f0.batch(()=>this.queryCache.findAll(r).filter(s=>!s.isDisabled()).map(s=>{var l;return s.fetch(void 0,{...i,cancelRefetch:(l=i==null?void 0:i.cancelRefetch)!=null?l:!0,meta:{refetchPage:r.refetchPage}})}));let o=Promise.all(a).then(Re);return i!=null&&i.throwOnError||(o=o.catch(Re)),o}fetchQuery(e,t,n){const r=Ks(e,t,n),i=this.defaultQueryOptions(r);typeof i.retry>"u"&&(i.retry=!1);const a=this.queryCache.build(this,i);return a.isStaleByTime(i.staleTime)?a.fetch(i):Promise.resolve(a.state.data)}prefetchQuery(e,t,n){return this.fetchQuery(e,t,n).then(Re).catch(Re)}fetchInfiniteQuery(e,t,n){const r=Ks(e,t,n);return r.behavior=$R(),this.fetchQuery(r)}prefetchInfiniteQuery(e,t,n){return this.fetchInfiniteQuery(e,t,n).then(Re).catch(Re)}resumePausedMutations(){return this.mutationCache.resumePausedMutations()}getQueryCache(){return this.queryCache}getMutationCache(){return this.mutationCache}getLogger(){return this.logger}getDefaultOptions(){return this.defaultOptions}setDefaultOptions(e){this.defaultOptions=e}setQueryDefaults(e,t){const n=this.queryDefaults.find(r=>hr(e)===hr(r.queryKey));n?n.defaultOptions=t:this.queryDefaults.push({queryKey:e,defaultOptions:t})}getQueryDefaults(e){if(!e)return;const t=this.queryDefaults.find(n=>El(e,n.queryKey));return t==null?void 0:t.defaultOptions}setMutationDefaults(e,t){const n=this.mutationDefaults.find(r=>hr(e)===hr(r.mutationKey));n?n.defaultOptions=t:this.mutationDefaults.push({mutationKey:e,defaultOptions:t})}getMutationDefaults(e){if(!e)return;const t=this.mutationDefaults.find(n=>El(e,n.mutationKey));return t==null?void 0:t.defaultOptions}defaultQueryOptions(e){if(e!=null&&e._defaulted)return e;const t={...this.defaultOptions.queries,...this.getQueryDefaults(e==null?void 0:e.queryKey),...e,_defaulted:!0};return!t.queryHash&&t.queryKey&&(t.queryHash=Uf(t.queryKey,t)),typeof t.refetchOnReconnect>"u"&&(t.refetchOnReconnect=t.networkMode!=="always"),typeof t.useErrorBoundary>"u"&&(t.useErrorBoundary=!!t.suspense),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...this.defaultOptions.mutations,...this.getMutationDefaults(e==null?void 0:e.mutationKey),...e,_defaulted:!0}}clear(){this.queryCache.clear(),this.mutationCache.clear()}}class WR extends ja{constructor(e,t){super(),this.client=e,this.options=t,this.trackedProps=new Set,this.selectError=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.remove=this.remove.bind(this),this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.currentQuery.addObserver(this),S8(this.currentQuery,this.options)&&this.executeFetch(),this.updateTimers())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ad(this.currentQuery,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ad(this.currentQuery,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.clearStaleTimeout(),this.clearRefetchInterval(),this.currentQuery.removeObserver(this)}setOptions(e,t){const n=this.options,r=this.currentQuery;if(this.options=this.client.defaultQueryOptions(e),dl(n,this.options)||this.client.getQueryCache().notify({type:"observerOptionsUpdated",query:this.currentQuery,observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=n.queryKey),this.updateQuery();const i=this.hasListeners();i&&T8(this.currentQuery,r,this.options,n)&&this.executeFetch(),this.updateResult(t),i&&(this.currentQuery!==r||this.options.enabled!==n.enabled||this.options.staleTime!==n.staleTime)&&this.updateStaleTimeout();const a=this.computeRefetchInterval();i&&(this.currentQuery!==r||this.options.enabled!==n.enabled||a!==this.currentRefetchInterval)&&this.updateRefetchInterval(a)}getOptimisticResult(e){const t=this.client.getQueryCache().build(this.client,e),n=this.createResult(t,e);return qR(this,n,e)&&(this.currentResult=n,this.currentResultOptions=this.options,this.currentResultState=this.currentQuery.state),n}getCurrentResult(){return this.currentResult}trackResult(e){const t={};return Object.keys(e).forEach(n=>{Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:()=>(this.trackedProps.add(n),e[n])})}),t}getCurrentQuery(){return this.currentQuery}remove(){this.client.getQueryCache().remove(this.currentQuery)}refetch({refetchPage:e,...t}={}){return this.fetch({...t,meta:{refetchPage:e}})}fetchOptimistic(e){const t=this.client.defaultQueryOptions(e),n=this.client.getQueryCache().build(this.client,t);return n.isFetchingOptimistic=!0,n.fetch().then(()=>this.createResult(n,t))}fetch(e){var t;return this.executeFetch({...e,cancelRefetch:(t=e.cancelRefetch)!=null?t:!0}).then(()=>(this.updateResult(),this.currentResult))}executeFetch(e){this.updateQuery();let t=this.currentQuery.fetch(this.options,e);return e!=null&&e.throwOnError||(t=t.catch(Re)),t}updateStaleTimeout(){if(this.clearStaleTimeout(),g4||this.currentResult.isStale||!Cd(this.options.staleTime))return;const t=QB(this.currentResult.dataUpdatedAt,this.options.staleTime)+1;this.staleTimeoutId=setTimeout(()=>{this.currentResult.isStale||this.updateResult()},t)}computeRefetchInterval(){var e;return typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.currentResult.data,this.currentQuery):(e=this.options.refetchInterval)!=null?e:!1}updateRefetchInterval(e){this.clearRefetchInterval(),this.currentRefetchInterval=e,!(g4||this.options.enabled===!1||!Cd(this.currentRefetchInterval)||this.currentRefetchInterval===0)&&(this.refetchIntervalId=setInterval(()=>{(this.options.refetchIntervalInBackground||fl.isFocused())&&this.executeFetch()},this.currentRefetchInterval))}updateTimers(){this.updateStaleTimeout(),this.updateRefetchInterval(this.computeRefetchInterval())}clearStaleTimeout(){this.staleTimeoutId&&(clearTimeout(this.staleTimeoutId),this.staleTimeoutId=void 0)}clearRefetchInterval(){this.refetchIntervalId&&(clearInterval(this.refetchIntervalId),this.refetchIntervalId=void 0)}createResult(e,t){const n=this.currentQuery,r=this.options,i=this.currentResult,a=this.currentResultState,o=this.currentResultOptions,s=e!==n,l=s?e.state:this.currentQueryInitialState,c=s?this.currentResult:this.previousQueryResult,{state:E}=e;let{dataUpdatedAt:d,error:f,errorUpdatedAt:p,fetchStatus:C,status:v}=E,A=!1,m=!1,g;if(t._optimisticResults){const b=this.hasListeners(),T=!b&&S8(e,t),k=b&&T8(e,n,t,r);(T||k)&&(C=Gc(e.options.networkMode)?"fetching":"paused",d||(v="loading")),t._optimisticResults==="isRestoring"&&(C="idle")}if(t.keepPreviousData&&!E.dataUpdatedAt&&c!=null&&c.isSuccess&&v!=="error")g=c.data,d=c.dataUpdatedAt,v=c.status,A=!0;else if(t.select&&typeof E.data<"u")if(i&&E.data===(a==null?void 0:a.data)&&t.select===this.selectFn)g=this.selectResult;else try{this.selectFn=t.select,g=t.select(E.data),g=md(i==null?void 0:i.data,g,t),this.selectResult=g,this.selectError=null}catch(b){this.selectError=b}else g=E.data;if(typeof t.placeholderData<"u"&&typeof g>"u"&&v==="loading"){let b;if(i!=null&&i.isPlaceholderData&&t.placeholderData===(o==null?void 0:o.placeholderData))b=i.data;else if(b=typeof t.placeholderData=="function"?t.placeholderData():t.placeholderData,t.select&&typeof b<"u")try{b=t.select(b),this.selectError=null}catch(T){this.selectError=T}typeof b<"u"&&(v="success",g=md(i==null?void 0:i.data,b,t),m=!0)}this.selectError&&(f=this.selectError,g=this.selectResult,p=Date.now(),v="error");const B=C==="fetching",D=v==="loading",F=v==="error";return{status:v,fetchStatus:C,isLoading:D,isSuccess:v==="success",isError:F,isInitialLoading:D&&B,data:g,dataUpdatedAt:d,error:f,errorUpdatedAt:p,failureCount:E.fetchFailureCount,failureReason:E.fetchFailureReason,errorUpdateCount:E.errorUpdateCount,isFetched:E.dataUpdateCount>0||E.errorUpdateCount>0,isFetchedAfterMount:E.dataUpdateCount>l.dataUpdateCount||E.errorUpdateCount>l.errorUpdateCount,isFetching:B,isRefetching:B&&!D,isLoadingError:F&&E.dataUpdatedAt===0,isPaused:C==="paused",isPlaceholderData:m,isPreviousData:A,isRefetchError:F&&E.dataUpdatedAt!==0,isStale:Hf(e,t),refetch:this.refetch,remove:this.remove}}updateResult(e){const t=this.currentResult,n=this.createResult(this.currentQuery,this.options);if(this.currentResultState=this.currentQuery.state,this.currentResultOptions=this.options,dl(n,t))return;this.currentResult=n;const r={cache:!0},i=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,o=typeof a=="function"?a():a;if(o==="all"||!o&&!this.trackedProps.size)return!0;const s=new Set(o??this.trackedProps);return this.options.useErrorBoundary&&s.add("error"),Object.keys(this.currentResult).some(l=>{const c=l;return this.currentResult[c]!==t[c]&&s.has(c)})};(e==null?void 0:e.listeners)!==!1&&i()&&(r.listeners=!0),this.notify({...r,...e})}updateQuery(){const e=this.client.getQueryCache().build(this.client,this.options);if(e===this.currentQuery)return;const t=this.currentQuery;this.currentQuery=e,this.currentQueryInitialState=e.state,this.previousQueryResult=this.currentResult,this.hasListeners()&&(t==null||t.removeObserver(this),e.addObserver(this))}onQueryUpdate(e){const t={};e.type==="success"?t.onSuccess=!e.manual:e.type==="error"&&!x3(e.error)&&(t.onError=!0),this.updateResult(t),this.hasListeners()&&this.updateTimers()}notify(e){f0.batch(()=>{if(e.onSuccess){var t,n,r,i;(t=(n=this.options).onSuccess)==null||t.call(n,this.currentResult.data),(r=(i=this.options).onSettled)==null||r.call(i,this.currentResult.data,null)}else if(e.onError){var a,o,s,l;(a=(o=this.options).onError)==null||a.call(o,this.currentResult.error),(s=(l=this.options).onSettled)==null||s.call(l,void 0,this.currentResult.error)}e.listeners&&this.listeners.forEach(({listener:c})=>{c(this.currentResult)}),e.cache&&this.client.getQueryCache().notify({query:this.currentQuery,type:"observerResultsUpdated"})})}}function UR(u,e){return e.enabled!==!1&&!u.state.dataUpdatedAt&&!(u.state.status==="error"&&e.retryOnMount===!1)}function S8(u,e){return UR(u,e)||u.state.dataUpdatedAt>0&&Ad(u,e,e.refetchOnMount)}function Ad(u,e,t){if(e.enabled!==!1){const n=typeof t=="function"?t(u):t;return n==="always"||n!==!1&&Hf(u,e)}return!1}function T8(u,e,t,n){return t.enabled!==!1&&(u!==e||n.enabled===!1)&&(!t.suspense||u.state.status!=="error")&&Hf(u,t)}function Hf(u,e){return u.isStaleByTime(e.staleTime)}function qR(u,e,t){return t.keepPreviousData?!1:t.placeholderData!==void 0?e.isPlaceholderData:!dl(u.getCurrentResult(),e)}let HR=class extends ja{constructor(e,t){super(),this.client=e,this.setOptions(t),this.bindMethods(),this.updateResult()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){var t;const n=this.options;this.options=this.client.defaultMutationOptions(e),dl(n,this.options)||this.client.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.currentMutation,observer:this}),(t=this.currentMutation)==null||t.setOptions(this.options)}onUnsubscribe(){if(!this.hasListeners()){var e;(e=this.currentMutation)==null||e.removeObserver(this)}}onMutationUpdate(e){this.updateResult();const t={listeners:!0};e.type==="success"?t.onSuccess=!0:e.type==="error"&&(t.onError=!0),this.notify(t)}getCurrentResult(){return this.currentResult}reset(){this.currentMutation=void 0,this.updateResult(),this.notify({listeners:!0})}mutate(e,t){return this.mutateOptions=t,this.currentMutation&&this.currentMutation.removeObserver(this),this.currentMutation=this.client.getMutationCache().build(this.client,{...this.options,variables:typeof e<"u"?e:this.options.variables}),this.currentMutation.addObserver(this),this.currentMutation.execute()}updateResult(){const e=this.currentMutation?this.currentMutation.state:nF(),t={...e,isLoading:e.status==="loading",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset};this.currentResult=t}notify(e){f0.batch(()=>{if(this.mutateOptions&&this.hasListeners()){if(e.onSuccess){var t,n,r,i;(t=(n=this.mutateOptions).onSuccess)==null||t.call(n,this.currentResult.data,this.currentResult.variables,this.currentResult.context),(r=(i=this.mutateOptions).onSettled)==null||r.call(i,this.currentResult.data,null,this.currentResult.variables,this.currentResult.context)}else if(e.onError){var a,o,s,l;(a=(o=this.mutateOptions).onError)==null||a.call(o,this.currentResult.error,this.currentResult.variables,this.currentResult.context),(s=(l=this.mutateOptions).onSettled)==null||s.call(l,void 0,this.currentResult.error,this.currentResult.variables,this.currentResult.context)}}e.listeners&&this.listeners.forEach(({listener:c})=>{c(this.currentResult)})})}};function KR(u){return{mutationKey:u.options.mutationKey,state:u.state}}function VR(u){return{state:u.state,queryKey:u.queryKey,queryHash:u.queryHash}}function GR(u){return u.state.isPaused}function QR(u){return u.state.status==="success"}function XR(u,e={}){const t=[],n=[];if(e.dehydrateMutations!==!1){const r=e.shouldDehydrateMutation||GR;u.getMutationCache().getAll().forEach(i=>{r(i)&&t.push(KR(i))})}if(e.dehydrateQueries!==!1){const r=e.shouldDehydrateQuery||QR;u.getQueryCache().getAll().forEach(i=>{r(i)&&n.push(VR(i))})}return{mutations:t,queries:n}}function YR(u,e,t){if(typeof e!="object"||e===null)return;const n=u.getMutationCache(),r=u.getQueryCache(),i=e.mutations||[],a=e.queries||[];i.forEach(o=>{var s;n.build(u,{...t==null||(s=t.defaultOptions)==null?void 0:s.mutations,mutationKey:o.mutationKey},o.state)}),a.forEach(({queryKey:o,state:s,queryHash:l})=>{var c;const E=r.get(l);if(E){if(E.state.dataUpdatedAt"data"in d)||u.walk():{},E=u instanceof H4?new wy({functionName:i}):[tM,Or.code].includes(o)&&(s||l||c)?new xl({abi:e,data:typeof s=="object"?s.data:s,functionName:i,message:c??l}):u;return new lE(E,{abi:e,args:n,contractAddress:t,docsPath:r,functionName:i,sender:a})}class Ma extends eu{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the WalletClient."].join(` `),{docsPath:e,docsSlug:"account"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccountNotFoundError"})}}class _y extends eu{constructor(e,{account:t,docsPath:n,chain:r,data:i,gas:a,gasPrice:o,maxFeePerGas:s,maxPriorityFeePerGas:l,nonce:c,to:E,value:d}){var p;const f=V4({from:t==null?void 0:t.address,to:E,value:typeof d<"u"&&`${oE(d)} ${((p=r==null?void 0:r.nativeCurrency)==null?void 0:p.symbol)||"ETH"}`,data:i,gas:a,gasPrice:typeof o<"u"&&`${ne(o)} gwei`,maxFeePerGas:typeof s<"u"&&`${ne(s)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${ne(l)} gwei`,nonce:c});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",f].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EstimateGasExecutionError"}),this.cause=e}}function vp(u,e){const t=(u.details||"").toLowerCase(),n=u.walk(r=>r.code===mr.code);return n instanceof eu?new mr({cause:u,message:n.details}):mr.nodeMessage.test(t)?new mr({cause:u,message:u.details}):Ln.nodeMessage.test(t)?new Ln({cause:u,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):hl.nodeMessage.test(t)?new hl({cause:u,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):ml.nodeMessage.test(t)?new ml({cause:u,nonce:e==null?void 0:e.nonce}):Al.nodeMessage.test(t)?new Al({cause:u,nonce:e==null?void 0:e.nonce}):gl.nodeMessage.test(t)?new gl({cause:u,nonce:e==null?void 0:e.nonce}):vl.nodeMessage.test(t)?new vl({cause:u}):Bl.nodeMessage.test(t)?new Bl({cause:u,gas:e==null?void 0:e.gas}):Fl.nodeMessage.test(t)?new Fl({cause:u,gas:e==null?void 0:e.gas}):yl.nodeMessage.test(t)?new yl({cause:u}):ra.nodeMessage.test(t)?new ra({cause:u,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new U4({cause:u})}function nM(u,{docsPath:e,...t}){const n=(()=>{const r=vp(u,t);return r instanceof U4?u:r})();return new _y(n,{docsPath:e,...t})}function dE(u,{format:e}){if(!e)return{};const t={};function n(i){const a=Object.keys(i);for(const o of a)o in u&&(t[o]=u[o]),i[o]&&typeof i[o]=="object"&&!Array.isArray(i[o])&&n(i[o])}const r=e(u||{});return n(r),t}function La(u){const{account:e,gasPrice:t,maxFeePerGas:n,maxPriorityFeePerGas:r,to:i}=u,a=e?Ye(e):void 0;if(a&&!ae(a.address))throw new ge({address:a.address});if(i&&!ae(i))throw new ge({address:i});if(typeof t<"u"&&(typeof n<"u"||typeof r<"u"))throw new vy;if(n&&n>2n**256n-1n)throw new Ln({maxFeePerGas:n});if(r&&n&&r>n)throw new ra({maxFeePerGas:n,maxPriorityFeePerGas:r})}class Sy extends eu{constructor(){super("`baseFeeMultiplier` must be greater than 1."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseFeeScalarError"})}}class fE extends eu{constructor(){super("Chain does not support EIP-1559 fees."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip1559FeesNotSupportedError"})}}class Ty extends eu{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${ne(e)} gwei).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MaxFeePerGasTooLowError"})}}class Bp extends eu{constructor({blockHash:e,blockNumber:t}){let n="Block";e&&(n=`Block at hash "${e}"`),t&&(n=`Block at number "${t}"`),super(`${n} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlockNotFoundError"})}}async function qn(u,{blockHash:e,blockNumber:t,blockTag:n,includeTransactions:r}={}){var c,E,d;const i=n??"latest",a=r??!1,o=t!==void 0?vu(t):void 0;let s=null;if(e?s=await u.request({method:"eth_getBlockByHash",params:[e,a]}):s=await u.request({method:"eth_getBlockByNumber",params:[o||i,a]}),!s)throw new Bp({blockHash:e,blockNumber:t});return(((d=(E=(c=u.chain)==null?void 0:c.formatters)==null?void 0:E.block)==null?void 0:d.format)||Zc)(s)}async function Fp(u){const e=await u.request({method:"eth_gasPrice"});return BigInt(e)}async function rM(u,e){return Py(u,e)}async function Py(u,e){var i,a,o;const{block:t,chain:n=u.chain,request:r}=e||{};if(typeof((i=n==null?void 0:n.fees)==null?void 0:i.defaultPriorityFee)=="function"){const s=t||await Du(u,qn,"getBlock")({});return n.fees.defaultPriorityFee({block:s,client:u,request:r})}if(typeof((a=n==null?void 0:n.fees)==null?void 0:a.defaultPriorityFee)<"u")return(o=n==null?void 0:n.fees)==null?void 0:o.defaultPriorityFee;try{const s=await u.request({method:"eth_maxPriorityFeePerGas"});return Hu(s)}catch{const[s,l]=await Promise.all([t?Promise.resolve(t):Du(u,qn,"getBlock")({}),Du(u,Fp,"getGasPrice")({})]);if(typeof s.baseFeePerGas!="bigint")throw new fE;const c=l-s.baseFeePerGas;return c<0n?0n:c}}async function iM(u,e){return wd(u,e)}async function wd(u,e){var d,f;const{block:t,chain:n=u.chain,request:r,type:i="eip1559"}=e||{},a=await(async()=>{var p,C;return typeof((p=n==null?void 0:n.fees)==null?void 0:p.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:t,client:u,request:r}):((C=n==null?void 0:n.fees)==null?void 0:C.baseFeeMultiplier)??1.2})();if(a<1)throw new Sy;const s=10**(((d=a.toString().split(".")[1])==null?void 0:d.length)??0),l=p=>p*BigInt(Math.ceil(a*s))/BigInt(s),c=t||await Du(u,qn,"getBlock")({});if(typeof((f=n==null?void 0:n.fees)==null?void 0:f.estimateFeesPerGas)=="function")return n.fees.estimateFeesPerGas({block:t,client:u,multiply:l,request:r,type:i});if(i==="eip1559"){if(typeof c.baseFeePerGas!="bigint")throw new fE;const p=r!=null&&r.maxPriorityFeePerGas?r.maxPriorityFeePerGas:await Py(u,{block:c,chain:n,request:r}),C=l(c.baseFeePerGas);return{maxFeePerGas:(r==null?void 0:r.maxFeePerGas)??C+p,maxPriorityFeePerGas:p}}return{gasPrice:(r==null?void 0:r.gasPrice)??l(await Du(u,Fp,"getGasPrice")({}))}}async function Oy(u,{address:e,blockTag:t="latest",blockNumber:n}){const r=await u.request({method:"eth_getTransactionCount",params:[e,n?vu(n):t]});return Ku(r)}function yp(u){if(u.type)return u.type;if(typeof u.maxFeePerGas<"u"||typeof u.maxPriorityFeePerGas<"u")return"eip1559";if(typeof u.gasPrice<"u")return typeof u.accessList<"u"?"eip2930":"legacy";throw new By({transaction:u})}async function pE(u,e){const{account:t=u.account,chain:n,gas:r,nonce:i,type:a}=e;if(!t)throw new Ma;const o=Ye(t),s=await Du(u,qn,"getBlock")({blockTag:"latest"}),l={...e,from:o.address};if(typeof i>"u"&&(l.nonce=await Du(u,Oy,"getTransactionCount")({address:o.address,blockTag:"pending"})),typeof a>"u")try{l.type=yp(l)}catch{l.type=typeof s.baseFeePerGas=="bigint"?"eip1559":"legacy"}if(l.type==="eip1559"){const{maxFeePerGas:c,maxPriorityFeePerGas:E}=await wd(u,{block:s,chain:n,request:l});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"&&(l.gas=await Du(u,Dp,"estimateGas")({...l,account:{address:o.address,type:"json-rpc"}})),La(l),l}async function Dp(u,e){var r,i,a;const t=e.account??u.account;if(!t)throw new Ma({docsPath:"/docs/actions/public/estimateGas"});const n=Ye(t);try{const{accessList:o,blockNumber:s,blockTag:l,data:c,gas:E,gasPrice:d,maxFeePerGas:f,maxPriorityFeePerGas:p,nonce:C,to:v,value:A,...m}=n.type==="local"?await pE(u,e):e,B=(s?vu(s):void 0)||l;La(e);const D=(a=(i=(r=u.chain)==null?void 0:r.formatters)==null?void 0:i.transactionRequest)==null?void 0:a.format,h=(D||Wr)({...dE(m,{format:D}),from:n.address,accessList:o,data:c,gas:E,gasPrice:d,maxFeePerGas:f,maxPriorityFeePerGas:p,nonce:C,to:v,value:A}),b=await u.request({method:"eth_estimateGas",params:B?[h,B]:[h]});return BigInt(b)}catch(o){throw nM(o,{...e,account:n,chain:u.chain})}}async function Iy(u,{abi:e,address:t,args:n,functionName:r,...i}){const a=an({abi:e,args:n,functionName:r});try{return await Du(u,Dp,"estimateGas")({data:a,to:t,...i})}catch(o){const s=i.account?Ye(i.account):void 0;throw ga(o,{abi:e,address:t,args:n,docsPath:"/docs/contract/estimateContractGas",functionName:r,sender:s==null?void 0:s.address})}}const L8="/docs/contract/decodeEventLog";function Wa({abi:u,data:e,strict:t,topics:n}){const r=t??!0,[i,...a]=n;if(!i)throw new ZF({docsPath:L8});const o=u.find(p=>p.type==="event"&&i===rE(nn(p)));if(!(o&&"name"in o)||o.type!=="event")throw new JF(i,{docsPath:L8});const{name:s,inputs:l}=o,c=l==null?void 0:l.some(p=>!("name"in p&&p.name));let E=c?[]:{};const d=l.filter(p=>"indexed"in p&&p.indexed);for(let p=0;p!("indexed"in p&&p.indexed));if(f.length>0){if(e&&e!=="0x")try{const p=qr(f,e);if(p)if(c)E=[...E,...p];else for(let C=0;C0?E:void 0}}function aM({param:u,value:e}){return u.type==="string"||u.type==="bytes"||u.type==="tuple"||u.type.match(/^(.*)\[(\d+)?\]$/)?e:(qr([u],e)||[])[0]}async function bp(u,{address:e,blockHash:t,fromBlock:n,toBlock:r,event:i,events:a,args:o,strict:s}={}){const l=s??!1,c=a??(i?[i]:void 0);let E=[];c&&(E=[c.flatMap(f=>$a({abi:[f],eventName:f.name,args:o}))],i&&(E=E[0]));let d;return t?d=await u.request({method:"eth_getLogs",params:[{address:e,topics:E,blockHash:t}]}):d=await u.request({method:"eth_getLogs",params:[{address:e,topics:E,fromBlock:typeof n=="bigint"?vu(n):n,toBlock:typeof r=="bigint"?vu(r):r}]}),d.map(f=>{var p;try{const{eventName:C,args:v}=c?Wa({abi:c,data:f.data,topics:f.topics,strict:l}):{eventName:void 0,args:void 0};return Ve(f,{args:v,eventName:C})}catch(C){let v,A;if(C instanceof Wn||C instanceof Ur){if(l)return;v=C.abiItem.name,A=(p=C.abiItem.inputs)==null?void 0:p.some(m=>!("name"in m&&m.name))}return Ve(f,{args:A?[]:{},eventName:v})}}).filter(Boolean)}async function wp(u,{abi:e,address:t,args:n,blockHash:r,eventName:i,fromBlock:a,toBlock:o,strict:s}){const l=i?Zn({abi:e,name:i}):void 0,c=l?void 0:e.filter(E=>E.type==="event");return Du(u,bp,"getLogs")({address:t,args:n,blockHash:r,event:l,events:c,fromBlock:a,toBlock:o,strict:s})}const m9="/docs/contract/decodeFunctionResult";function Kr({abi:u,args:e,functionName:t,data:n}){let r=u[0];if(t&&(r=Zn({abi:u,args:e,name:t}),!r))throw new Pr(t,{docsPath:m9});if(r.type!=="function")throw new Pr(void 0,{docsPath:m9});if(!r.outputs)throw new ip(r.name,{docsPath:m9});const i=qr(r.outputs,n);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}const _l=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],zy=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"}],jy=[...zy,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],oM=[...zy,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],W8=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],U8=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],sM=[{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"}],lM="0x82ad56cb";function Vr({blockNumber:u,chain:e,contract:t}){var r;const n=(r=e==null?void 0:e.contracts)==null?void 0:r[t];if(!n)throw new Cl({chain:e,contract:{name:t}});if(u&&n.blockCreated&&n.blockCreated>u)throw new Cl({blockNumber:u,chain:e,contract:{name:t,blockCreated:n.blockCreated}});return n.address}function cM(u,{docsPath:e,...t}){const n=(()=>{const r=vp(u,t);return r instanceof U4?u:r})();return new gp(n,{docsPath:e,...t})}const A9=new Map;function xp({fn:u,id:e,shouldSplitBatch:t,wait:n=0,sort:r}){const i=async()=>{const c=s();a();const E=c.map(({args:d})=>d);E.length!==0&&u(E).then(d=>{var f;r&&Array.isArray(d)&&d.sort(r);for(let p=0;p{var f;for(let p=0;pA9.delete(e),o=()=>s().map(({args:c})=>c),s=()=>A9.get(e)||[],l=c=>A9.set(e,[...s(),c]);return{flush:a,async schedule(c){const E={},d=new Promise((C,v)=>{E.resolve=C,E.reject=v});return(t==null?void 0:t([...o(),c]))&&i(),s().length>0?(l({args:c,pendingPromise:E}),d):(l({args:c,pendingPromise:E}),setTimeout(i,n),d)}}}async function G4(u,e){var A,m,g,B;const{account:t=u.account,batch:n=!!((A=u.batch)!=null&&A.multicall),blockNumber:r,blockTag:i="latest",accessList:a,data:o,gas:s,gasPrice:l,maxFeePerGas:c,maxPriorityFeePerGas:E,nonce:d,to:f,value:p,...C}=e,v=t?Ye(t):void 0;try{La(e);const F=(r?vu(r):void 0)||i,h=(B=(g=(m=u.chain)==null?void 0:m.formatters)==null?void 0:g.transactionRequest)==null?void 0:B.format,T=(h||Wr)({...dE(C,{format:h}),from:v==null?void 0:v.address,accessList:a,data:o,gas:s,gasPrice:l,maxFeePerGas:c,maxPriorityFeePerGas:E,nonce:d,to:f,value:p});if(n&&EM({request:T}))try{return await dM(u,{...T,blockNumber:r,blockTag:i})}catch(L){if(!(L instanceof Jf)&&!(L instanceof Cl))throw L}const k=await u.request({method:"eth_call",params:F?[T,F]:[T]});return k==="0x"?{data:void 0}:{data:k}}catch(D){const F=fM(D),{offchainLookup:h,offchainLookupSignature:b}=await xu(()=>Promise.resolve().then(()=>nL),void 0);if((F==null?void 0:F.slice(0,10))===b&&f)return{data:await h(u,{data:F,to:f})};throw cM(D,{...e,account:v,chain:u.chain})}}function EM({request:u}){const{data:e,to:t,...n}=u;return!(!e||e.startsWith(lM)||!t||Object.values(n).filter(r=>typeof r<"u").length>0)}async function dM(u,e){var C;const{batchSize:t=1024,wait:n=0}=typeof((C=u.batch)==null?void 0:C.multicall)=="object"?u.batch.multicall:{},{blockNumber:r,blockTag:i="latest",data:a,multicallAddress:o,to:s}=e;let l=o;if(!l){if(!u.chain)throw new Jf;l=Vr({blockNumber:r,chain:u.chain,contract:"multicall3"})}const E=(r?vu(r):void 0)||i,{schedule:d}=xp({id:`${u.uid}.${E}`,wait:n,shouldSplitBatch(v){return v.reduce((m,{data:g})=>m+(g.length-2),0)>t*2},fn:async v=>{const A=v.map(B=>({allowFailure:!0,callData:B.data,target:B.to})),m=an({abi:_l,args:[A],functionName:"aggregate3"}),g=await u.request({method:"eth_call",params:[{data:m,to:l},E]});return Kr({abi:_l,args:[A],functionName:"aggregate3",data:g||"0x"})}}),[{returnData:f,success:p}]=await d({data:a,to:s});if(!p)throw new cE({data:f});return f==="0x"?{data:void 0}:{data:f}}function fM(u){if(!(u instanceof eu))return;const e=u.walk();return typeof e.data=="object"?e.data.data:e.data}async function Zt(u,{abi:e,address:t,args:n,functionName:r,...i}){const a=an({abi:e,args:n,functionName:r});try{const{data:o}=await Du(u,G4,"call")({data:a,to:t,...i});return Kr({abi:e,args:n,functionName:r,data:o||"0x"})}catch(o){throw ga(o,{abi:e,address:t,args:n,docsPath:"/docs/contract/readContract",functionName:r})}}async function Ry(u,{abi:e,address:t,args:n,dataSuffix:r,functionName:i,...a}){const o=a.account?Ye(a.account):void 0,s=an({abi:e,args:n,functionName:i});try{const{data:l}=await Du(u,G4,"call")({batch:!1,data:`${s}${r?r.replace("0x",""):""}`,to:t,...a});return{result:Kr({abi:e,args:n,functionName:i,data:l||"0x"}),request:{abi:e,address:t,args:n,dataSuffix:r,functionName:i,...a}}}catch(l){throw ga(l,{abi:e,address:t,args:n,docsPath:"/docs/contract/simulateContract",functionName:i,sender:o==null?void 0:o.address})}}const g9=new Map,q8=new Map;let pM=0;function Ua(u,e,t){const n=++pM,r=()=>g9.get(u)||[],i=()=>{const c=r();g9.set(u,c.filter(E=>E.id!==n))},a=()=>{const c=q8.get(u);r().length===1&&c&&c(),i()},o=r();if(g9.set(u,[...o,{id:n,fns:e}]),o&&o.length>0)return a;const s={};for(const c in e)s[c]=(...E)=>{var f,p;const d=r();if(d.length!==0)for(const C of d)(p=(f=C.fns)[c])==null||p.call(f,...E)};const l=t(s);return typeof l=="function"&&q8.set(u,l),a}async function Sl(u){return new Promise(e=>setTimeout(e,u))}function Q4(u,{emitOnBegin:e,initialWaitTime:t,interval:n}){let r=!0;const i=()=>r=!1;return(async()=>{let o;e&&(o=await u({unpoll:i}));const s=await(t==null?void 0:t(o))??n;await Sl(s);const l=async()=>{r&&(await u({unpoll:i}),await Sl(n),l())};l()})(),i}const CM=new Map,hM=new Map;function mM(u){const e=(r,i)=>({clear:()=>i.delete(r),get:()=>i.get(r),set:a=>i.set(r,a)}),t=e(u,CM),n=e(u,hM);return{clear:()=>{t.clear(),n.clear()},promise:t,response:n}}async function AM(u,{cacheKey:e,cacheTime:t=1/0}){const n=mM(e),r=n.response.get();if(r&&t>0&&new Date().getTime()-r.created.getTime()`blockNumber.${u}`;async function X4(u,{cacheTime:e=u.cacheTime,maxAge:t}={}){const n=await AM(()=>u.request({method:"eth_blockNumber"}),{cacheKey:gM(u.uid),cacheTime:t??e});return BigInt(n)}async function CE(u,{filter:e}){const t="strict"in e&&e.strict;return(await e.request({method:"eth_getFilterChanges",params:[e.id]})).map(r=>{var i;if(typeof r=="string")return r;try{const{eventName:a,args:o}="abi"in e&&e.abi?Wa({abi:e.abi,data:r.data,topics:r.topics,strict:t}):{eventName:void 0,args:void 0};return Ve(r,{args:o,eventName:a})}catch(a){let o,s;if(a instanceof Wn||a instanceof Ur){if("strict"in e&&e.strict)return;o=a.abiItem.name,s=(i=a.abiItem.inputs)==null?void 0:i.some(l=>!("name"in l&&l.name))}return Ve(r,{args:s?[]:{},eventName:o})}}).filter(Boolean)}async function hE(u,{filter:e}){return e.request({method:"eth_uninstallFilter",params:[e.id]})}function Ny(u,{abi:e,address:t,args:n,batch:r=!0,eventName:i,onError:a,onLogs:o,poll:s,pollingInterval:l=u.pollingInterval,strict:c}){return(typeof s<"u"?s:u.transport.type!=="webSocket")?(()=>{const p=z0(["watchContractEvent",t,n,r,u.uid,i,l]),C=c??!1;return Ua(p,{onLogs:o,onError:a},v=>{let A,m,g=!1;const B=Q4(async()=>{var D;if(!g){try{m=await Du(u,pp,"createContractEventFilter")({abi:e,address:t,args:n,eventName:i,strict:C})}catch{}g=!0;return}try{let F;if(m)F=await Du(u,CE,"getFilterChanges")({filter:m});else{const h=await Du(u,X4,"getBlockNumber")({});A&&A!==h?F=await Du(u,wp,"getContractEvents")({abi:e,address:t,args:n,eventName:i,fromBlock:A+1n,toBlock:h,strict:C}):F=[],A=h}if(F.length===0)return;if(r)v.onLogs(F);else for(const h of F)v.onLogs([h])}catch(F){m&&F instanceof Un&&(g=!1),(D=v.onError)==null||D.call(v,F)}},{emitOnBegin:!0,interval:l});return async()=>{m&&await Du(u,hE,"uninstallFilter")({filter:m}),B()}})})():(()=>{let p=!0,C=()=>p=!1;return(async()=>{try{const v=i?$a({abi:e,eventName:i,args:n}):[],{unsubscribe:A}=await u.transport.subscribe({params:["logs",{address:t,topics:v}],onData(m){var B;if(!p)return;const g=m.result;try{const{eventName:D,args:F}=Wa({abi:e,data:g.data,topics:g.topics,strict:c}),h=Ve(g,{args:F,eventName:D});o([h])}catch(D){let F,h;if(D instanceof Wn||D instanceof Ur){if(c)return;F=D.abiItem.name,h=(B=D.abiItem.inputs)==null?void 0:B.some(T=>!("name"in T&&T.name))}const b=Ve(g,{args:h?[]:{},eventName:F});o([b])}},onError(m){a==null||a(m)}});C=A,p||C()}catch(v){a==null||a(v)}})(),C})()}function kp({chain:u,currentChainId:e}){if(!u)throw new yF;if(e!==u.id)throw new FF({chain:u,currentChainId:e})}function vM(u,{docsPath:e,...t}){const n=(()=>{const r=vp(u,t);return r instanceof U4?u:r})();return new Dy(n,{docsPath:e,...t})}async function F4(u){const e=await u.request({method:"eth_chainId"});return Ku(e)}async function _p(u,{serializedTransaction:e}){return u.request({method:"eth_sendRawTransaction",params:[e]})}async function Sp(u,e){var C,v,A,m;const{account:t=u.account,chain:n=u.chain,accessList:r,data:i,gas:a,gasPrice:o,maxFeePerGas:s,maxPriorityFeePerGas:l,nonce:c,to:E,value:d,...f}=e;if(!t)throw new Ma({docsPath:"/docs/actions/wallet/sendTransaction"});const p=Ye(t);try{La(e);let g;if(n!==null&&(g=await Du(u,F4,"getChainId")({}),kp({currentChainId:g,chain:n})),p.type==="local"){const h=await Du(u,pE,"prepareTransactionRequest")({account:p,accessList:r,chain:n,data:i,gas:a,gasPrice:o,maxFeePerGas:s,maxPriorityFeePerGas:l,nonce:c,to:E,value:d,...f});g||(g=await Du(u,F4,"getChainId")({}));const b=(C=n==null?void 0:n.serializers)==null?void 0:C.transaction,T=await p.signTransaction({...h,chainId:g},{serializer:b});return await Du(u,_p,"sendRawTransaction")({serializedTransaction:T})}const B=(m=(A=(v=u.chain)==null?void 0:v.formatters)==null?void 0:A.transactionRequest)==null?void 0:m.format,F=(B||Wr)({...dE(f,{format:B}),accessList:r,data:i,from:p.address,gas:a,gasPrice:o,maxFeePerGas:s,maxPriorityFeePerGas:l,nonce:c,to:E,value:d});return await u.request({method:"eth_sendTransaction",params:[F]})}catch(g){throw vM(g,{...e,account:p,chain:e.chain||void 0})}}async function $y(u,{abi:e,address:t,args:n,dataSuffix:r,functionName:i,...a}){const o=an({abi:e,args:n,functionName:i});return await Du(u,Sp,"sendTransaction")({data:`${o}${r?r.replace("0x",""):""}`,to:t,...a})}function BM({abi:u,address:e,publicClient:t,walletClient:n}){const r=t!=null,i=n!=null,a={};let o=!1,s=!1,l=!1;for(const c of u)if(c.type==="function"?c.stateMutability==="view"||c.stateMutability==="pure"?o=!0:s=!0:c.type==="event"&&(l=!0),o&&s&&l)break;return r&&(o&&(a.read=new Proxy({},{get(c,E){return(...d)=>{const{args:f,options:p}=Gs(d);return Du(t,Zt,"readContract")({abi:u,address:e,functionName:E,args:f,...p})}}})),s&&(a.simulate=new Proxy({},{get(c,E){return(...d)=>{const{args:f,options:p}=Gs(d);return Du(t,Ry,"simulateContract")({abi:u,address:e,functionName:E,args:f,...p})}}})),l&&(a.createEventFilter=new Proxy({},{get(c,E){return(...d)=>{const f=u.find(v=>v.type==="event"&&v.name===E),{args:p,options:C}=v9(d,f);return Du(t,pp,"createContractEventFilter")({abi:u,address:e,eventName:E,args:p,...C})}}}),a.getEvents=new Proxy({},{get(c,E){return(...d)=>{const f=u.find(v=>v.type==="event"&&v.name===E),{args:p,options:C}=v9(d,f);return Du(t,wp,"getContractEvents")({abi:u,address:e,eventName:E,args:p,...C})}}}),a.watchEvent=new Proxy({},{get(c,E){return(...d)=>{const f=u.find(v=>v.type==="event"&&v.name===E),{args:p,options:C}=v9(d,f);return Du(t,Ny,"watchContractEvent")({abi:u,address:e,eventName:E,args:p,...C})}}}))),i&&s&&(a.write=new Proxy({},{get(c,E){return(...d)=>{const{args:f,options:p}=Gs(d);return Du(n,$y,"writeContract")({abi:u,address:e,functionName:E,args:f,...p})}}})),(r||i)&&s&&(a.estimateGas=new Proxy({},{get(c,E){return(...d)=>{const{args:f,options:p}=Gs(d);return Du(t??n,Iy,"estimateContractGas")({abi:u,address:e,functionName:E,args:f,...p,account:p.account??n.account})}}})),a.address=e,a.abi=u,a}function Gs(u){const e=u.length&&Array.isArray(u[0]),t=e?u[0]:[],n=(e?u[1]:u[0])??{};return{args:t,options:n}}function v9(u,e){let t=!1;Array.isArray(u[0])?t=!0:u.length===1?t=e.inputs.some(i=>i.indexed):u.length===2&&(t=!0);const n=t?u[0]:void 0,r=(t?u[1]:u[0])??{};return{args:n,options:r}}async function FM(u,{chain:e}){const{id:t,name:n,nativeCurrency:r,rpcUrls:i,blockExplorers:a}=e;await u.request({method:"wallet_addEthereumChain",params:[{chainId:vu(t),chainName:n,nativeCurrency:r,rpcUrls:i.default.http,blockExplorerUrls:a?Object.values(a).map(({url:o})=>o):void 0}]})}function yM(u){const e=B0(`0x${u.substring(4)}`).substring(26);return K4(`0x${e}`)}const xd=256;let Qs=xd,Xs;function DM(u=11){if(!Xs||Qs+u>xd*2){Xs="",Qs=0;for(let e=0;e{const A=v(C);for(const g in f)delete A[g];const m={...C,...A};return Object.assign(m,{extend:p(m)})}}return Object.assign(f,{extend:p(f)})}function kd(u,{delay:e=100,retryCount:t=2,shouldRetry:n=()=>!0}={}){return new Promise((r,i)=>{const a=async({count:o=0}={})=>{const s=async({error:l})=>{const c=typeof e=="function"?e({count:o,error:l}):e;c&&await Sl(c),a({count:o+1})};try{const l=await u();r(l)}catch(l){if(o"code"in u?u.code!==-1&&u.code!==-32004&&u.code!==-32005&&u.code!==-32042&&u.code!==-32603:u instanceof Rn&&u.status?u.status!==403&&u.status!==408&&u.status!==413&&u.status!==429&&u.status!==500&&u.status!==502&&u.status!==503&&u.status!==504:!1;function bM(u,{retryDelay:e=150,retryCount:t=3}={}){return async n=>kd(async()=>{try{return await u(n)}catch(r){const i=r;switch(i.code){case aa.code:throw new aa(i);case oa.code:throw new oa(i);case sa.code:throw new sa(i);case la.code:throw new la(i);case Or.code:throw new Or(i);case Un.code:throw new Un(i);case ca.code:throw new ca(i);case Yt.code:throw new Yt(i);case Ea.code:throw new Ea(i);case da.code:throw new da(i);case fa.code:throw new fa(i);case pa.code:throw new pa(i);case F0.code:throw new F0(i);case Ca.code:throw new Ca(i);case ha.code:throw new ha(i);case ma.code:throw new ma(i);case Aa.code:throw new Aa(i);case pt.code:throw new pt(i);case 5e3:throw new F0(i);default:throw r instanceof eu?r:new ky(i)}}},{delay:({count:r,error:i})=>{var a;if(i&&i instanceof Rn){const o=(a=i==null?void 0:i.headers)==null?void 0:a.get("Retry-After");if(o!=null&&o.match(/\d/))return parseInt(o)*1e3}return~~(1<!My(r)})}function Y4({key:u,name:e,request:t,retryCount:n=3,retryDelay:r=150,timeout:i,type:a},o){return{config:{key:u,name:e,request:t,retryCount:n,retryDelay:r,timeout:i,type:a},request:bM(t,{retryCount:n,retryDelay:r}),value:o}}function qa(u,e={}){const{key:t="custom",name:n="Custom Provider",retryDelay:r}=e;return({retryCount:i})=>Y4({key:t,name:n,request:u.request.bind(u),retryCount:e.retryCount??i,retryDelay:r,type:"custom"})}function _d(u,e={}){const{key:t="fallback",name:n="Fallback",rank:r=!1,retryCount:i,retryDelay:a}=e;return({chain:o,pollingInterval:s=4e3,timeout:l})=>{let c=u,E=()=>{};const d=Y4({key:t,name:n,async request({method:f,params:p}){const C=async(v=0)=>{const A=c[v]({chain:o,retryCount:0,timeout:l});try{const m=await A.request({method:f,params:p});return E({method:f,params:p,response:m,transport:A,status:"success"}),m}catch(m){if(E({error:m,method:f,params:p,transport:A,status:"error"}),My(m)||v===c.length-1)throw m;return C(v+1)}};return C()},retryCount:i,retryDelay:a,type:"fallback"},{onResponse:f=>E=f,transports:c.map(f=>f({chain:o,retryCount:0}))});if(r){const f=typeof r=="object"?r:{};wM({chain:o,interval:f.interval??s,onTransports:p=>c=p,sampleCount:f.sampleCount,timeout:f.timeout,transports:c,weights:f.weights})}return d}}function wM({chain:u,interval:e=4e3,onTransports:t,sampleCount:n=10,timeout:r=1e3,transports:i,weights:a={}}){const{stability:o=.7,latency:s=.3}=a,l=[],c=async()=>{const E=await Promise.all(i.map(async p=>{const C=p({chain:u,retryCount:0,timeout:r}),v=Date.now();let A,m;try{await C.request({method:"net_listening"}),m=1}catch{m=0}finally{A=Date.now()}return{latency:A-v,success:m}}));l.push(E),l.length>n&&l.shift();const d=Math.max(...l.map(p=>Math.max(...p.map(({latency:C})=>C)))),f=i.map((p,C)=>{const v=l.map(D=>D[C].latency),m=1-v.reduce((D,F)=>D+F,0)/v.length/d,g=l.map(D=>D[C].success),B=g.reduce((D,F)=>D+F,0)/g.length;return B===0?[0,C]:[s*m+o*B,C]}).sort((p,C)=>C[0]-p[0]);t(f.map(([,p])=>i[p])),await Sl(e),c()};c()}class Tp extends eu{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro"})}}function xM(){if(typeof WebSocket<"u")return WebSocket;if(typeof global.WebSocket<"u")return global.WebSocket;if(typeof window.WebSocket<"u")return window.WebSocket;if(typeof self.WebSocket<"u")return self.WebSocket;throw new Error("`WebSocket` is not supported in this environment")}const H8=xM();function Ly(u,{errorInstance:e=new Error("timed out"),timeout:t,signal:n}){return new Promise((r,i)=>{(async()=>{let a;try{const o=new AbortController;t>0&&(a=setTimeout(()=>{n?o.abort():i(e)},t)),r(await u({signal:o==null?void 0:o.signal}))}catch(o){o.name==="AbortError"&&i(e),i(o)}finally{clearTimeout(a)}})()})}let Sd=0;async function kM(u,{body:e,fetchOptions:t={},timeout:n=1e4}){var o;const{headers:r,method:i,signal:a}=t;try{const s=await Ly(async({signal:c})=>await fetch(u,{...t,body:Array.isArray(e)?z0(e.map(d=>({jsonrpc:"2.0",id:d.id??Sd++,...d}))):z0({jsonrpc:"2.0",id:e.id??Sd++,...e}),headers:{...r,"Content-Type":"application/json"},method:i||"POST",signal:a||(n>0?c:void 0)}),{errorInstance:new kl({body:e,url:u}),timeout:n,signal:!0});let l;if((o=s.headers.get("Content-Type"))!=null&&o.startsWith("application/json")?l=await s.json():l=await s.text(),!s.ok)throw new Rn({body:e,details:z0(l.error)||s.statusText,headers:s.headers,status:s.status,url:u});return l}catch(s){throw s instanceof Rn||s instanceof kl?s:new Rn({body:e,details:s.message,url:u})}}const B9=new Map;async function F9(u){let e=B9.get(u);if(e)return e;const{schedule:t}=xp({id:u,fn:async()=>{const i=new H8(u),a=new Map,o=new Map,s=({data:c})=>{const E=JSON.parse(c),d=E.method==="eth_subscription",f=d?E.params.subscription:E.id,p=d?o:a,C=p.get(f);C&&C({data:c}),d||p.delete(f)},l=()=>{B9.delete(u),i.removeEventListener("close",l),i.removeEventListener("message",s)};return i.addEventListener("close",l),i.addEventListener("message",s),i.readyState===H8.CONNECTING&&await new Promise((c,E)=>{i&&(i.onopen=c,i.onerror=E)}),e=Object.assign(i,{requests:a,subscriptions:o}),B9.set(u,e),[e]}}),[n,[r]]=await t();return r}function _M(u,{body:e,onResponse:t}){if(u.readyState===u.CLOSED||u.readyState===u.CLOSING)throw new xy({body:e,url:u.url,details:"Socket is closed."});const n=Sd++,r=({data:i})=>{var o;const a=JSON.parse(i);typeof a.id=="number"&&n!==a.id||(t==null||t(a),e.method==="eth_subscribe"&&typeof a.result=="string"&&u.subscriptions.set(a.result,r),e.method==="eth_unsubscribe"&&u.subscriptions.delete((o=e.params)==null?void 0:o[0]))};return u.requests.set(n,r),u.send(JSON.stringify({jsonrpc:"2.0",...e,id:n})),u}async function SM(u,{body:e,timeout:t=1e4}){return Ly(()=>new Promise(n=>qi.webSocket(u,{body:e,onResponse:n})),{errorInstance:new kl({body:e,url:u.url}),timeout:t})}const qi={http:kM,webSocket:_M,webSocketAsync:SM};function Wy(u,e={}){const{batch:t,fetchOptions:n,key:r="http",name:i="HTTP JSON-RPC",retryDelay:a}=e;return({chain:o,retryCount:s,timeout:l})=>{const{batchSize:c=1e3,wait:E=0}=typeof t=="object"?t:{},d=e.retryCount??s,f=l??e.timeout??1e4,p=u||(o==null?void 0:o.rpcUrls.default.http[0]);if(!p)throw new Tp;return Y4({key:r,name:i,async request({method:C,params:v}){const A={method:C,params:v},{schedule:m}=xp({id:`${u}`,wait:E,shouldSplitBatch(F){return F.length>c},fn:F=>qi.http(p,{body:F,fetchOptions:n,timeout:f}),sort:(F,h)=>F.id-h.id}),g=async F=>t?m(F):[await qi.http(p,{body:F,fetchOptions:n,timeout:f})],[{error:B,result:D}]=await g(A);if(B)throw new EE({body:A,error:B,url:p});return D},retryCount:d,retryDelay:a,timeout:f,type:"http"},{fetchOptions:n,url:u})}}function Pp(u,e){var n,r,i;if(!(u instanceof eu))return!1;const t=u.walk(a=>a instanceof xl);return t instanceof xl?!!(((n=t.data)==null?void 0:n.errorName)==="ResolverNotFound"||((r=t.data)==null?void 0:r.errorName)==="ResolverWildcardNotSupported"||(i=t.reason)!=null&&i.includes("Wildcard on non-extended resolvers is not supported")||e==="reverse"&&t.reason===Ay[50]):!1}function Uy(u){if(u.length!==66||u.indexOf("[")!==0||u.indexOf("]")!==65)return null;const e=`0x${u.slice(1,65)}`;return zu(e)?e:null}function Qo(u){let e=new Uint8Array(32).fill(0);if(!u)return Ae(e);const t=u.split(".");for(let n=t.length-1;n>=0;n-=1){const r=Uy(t[n]),i=r?ue(r):B0(kt(t[n]),"bytes");e=B0(Ge([e,i]),"bytes")}return Ae(e)}function TM(u){return`[${u.slice(2)}]`}function qy(u){const e=new Uint8Array(32).fill(0);return u?Uy(u)||B0(kt(u)):Ae(e)}function AE(u){const e=u.replace(/^\.|\.$/gm,"");if(e.length===0)return new Uint8Array(1);const t=new Uint8Array(kt(e).byteLength+2);let n=0;const r=e.split(".");for(let i=0;i255&&(a=kt(TM(qy(r[i])))),t[n]=a.length,t.set(a,n+1),n+=a.length+1}return t.byteLength!==n+1?t.slice(0,n+1):t}async function PM(u,{blockNumber:e,blockTag:t,coinType:n,name:r,universalResolverAddress:i}){let a=i;if(!a){if(!u.chain)throw new Error("client chain not configured. universalResolverAddress is required.");a=Vr({blockNumber:e,chain:u.chain,contract:"ensUniversalResolver"})}try{const o=an({abi:U8,functionName:"addr",...n!=null?{args:[Qo(r),BigInt(n)]}:{args:[Qo(r)]}}),s=await Du(u,Zt,"readContract")({address:a,abi:jy,functionName:"resolve",args:[ju(AE(r)),o],blockNumber:e,blockTag:t});if(s[0]==="0x")return null;const l=Kr({abi:U8,args:n!=null?[Qo(r),BigInt(n)]:void 0,functionName:"addr",data:s[0]});return l==="0x"||te(l)==="0x00"?null:l}catch(o){if(Pp(o,"resolve"))return null;throw o}}class OM extends eu{constructor({data:e}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidMetadataError"})}}class pi extends eu{constructor({reason:e}){super(`ENS NFT avatar URI is invalid. ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidNftUriError"})}}class gE extends eu{constructor({uri:e}){super(`Unable to resolve ENS avatar URI "${e}". The URI may be malformed, invalid, or does not respond with a valid image.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUriResolutionError"})}}class Hy extends eu{constructor({namespace:e}){super(`ENS NFT avatar namespace "${e}" is not supported. Must be "erc721" or "erc1155".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUnsupportedNamespaceError"})}}const IM=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,zM=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?[\w\-.]+))?(?\/.*)?$/,jM=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,RM=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function NM(u){try{const e=await fetch(u,{method:"HEAD"});if(e.status===200){const t=e.headers.get("content-type");return t==null?void 0:t.startsWith("image/")}return!1}catch(e){return typeof e=="object"&&typeof e.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(t=>{const n=new Image;n.onload=()=>{t(!0)},n.onerror=()=>{t(!1)},n.src=u})}}function K8(u,e){return u?u.endsWith("/")?u.slice(0,-1):u:e}function Ky({uri:u,gatewayUrls:e}){const t=jM.test(u);if(t)return{uri:u,isOnChain:!0,isEncoded:t};const n=K8(e==null?void 0:e.ipfs,"https://ipfs.io"),r=K8(e==null?void 0:e.arweave,"https://arweave.net"),i=u.match(IM),{protocol:a,subpath:o,target:s,subtarget:l=""}=(i==null?void 0:i.groups)||{},c=a==="ipns:/"||o==="ipns/",E=a==="ipfs:/"||o==="ipfs/"||zM.test(u);if(u.startsWith("http")&&!c&&!E){let f=u;return e!=null&&e.arweave&&(f=u.replace(/https:\/\/arweave.net/g,e==null?void 0:e.arweave)),{uri:f,isOnChain:!1,isEncoded:!1}}if((c||E)&&s)return{uri:`${n}/${c?"ipns":"ipfs"}/${s}${l}`,isOnChain:!1,isEncoded:!1};if(a==="ar:/"&&s)return{uri:`${r}/${s}${l||""}`,isOnChain:!1,isEncoded:!1};let d=u.replace(RM,"");if(d.startsWith("r.json());return await Op({gatewayUrls:u,uri:Vy(t)})}catch{throw new gE({uri:e})}}async function Op({gatewayUrls:u,uri:e}){const{uri:t,isOnChain:n}=Ky({uri:e,gatewayUrls:u});if(n||await NM(t))return t;throw new gE({uri:e})}function MM(u){let e=u;e.startsWith("did:nft:")&&(e=e.replace("did:nft:","").replace(/_/g,"/"));const[t,n,r]=e.split("/"),[i,a]=t.split(":"),[o,s]=n.split(":");if(!i||i.toLowerCase()!=="eip155")throw new pi({reason:"Only EIP-155 supported"});if(!a)throw new pi({reason:"Chain ID not found"});if(!s)throw new pi({reason:"Contract address not found"});if(!r)throw new pi({reason:"Token ID not found"});if(!o)throw new pi({reason:"ERC namespace not found"});return{chainID:parseInt(a),namespace:o.toLowerCase(),contractAddress:s,tokenID:r}}async function LM(u,{nft:e}){if(e.namespace==="erc721")return Zt(u,{address:e.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(e.tokenID)]});if(e.namespace==="erc1155")return Zt(u,{address:e.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(e.tokenID)]});throw new Hy({namespace:e.namespace})}async function WM(u,{gatewayUrls:e,record:t}){return/eip155:/i.test(t)?UM(u,{gatewayUrls:e,record:t}):Op({uri:t,gatewayUrls:e})}async function UM(u,{gatewayUrls:e,record:t}){const n=MM(t),r=await LM(u,{nft:n}),{uri:i,isOnChain:a,isEncoded:o}=Ky({uri:r,gatewayUrls:e});if(a&&(i.includes("data:application/json;base64,")||i.startsWith("{"))){const l=o?atob(i.replace("data:application/json;base64,","")):i,c=JSON.parse(l);return Op({uri:Vy(c),gatewayUrls:e})}let s=n.tokenID;return n.namespace==="erc1155"&&(s=s.replace("0x","").padStart(64,"0")),$M({gatewayUrls:e,uri:i.replace(/(?:0x)?{id}/,s)})}async function Gy(u,{blockNumber:e,blockTag:t,name:n,key:r,universalResolverAddress:i}){let a=i;if(!a){if(!u.chain)throw new Error("client chain not configured. universalResolverAddress is required.");a=Vr({blockNumber:e,chain:u.chain,contract:"ensUniversalResolver"})}try{const o=await Du(u,Zt,"readContract")({address:a,abi:jy,functionName:"resolve",args:[ju(AE(n)),an({abi:W8,functionName:"text",args:[Qo(n),r]})],blockNumber:e,blockTag:t});if(o[0]==="0x")return null;const s=Kr({abi:W8,functionName:"text",data:o[0]});return s===""?null:s}catch(o){if(Pp(o,"resolve"))return null;throw o}}async function qM(u,{blockNumber:e,blockTag:t,gatewayUrls:n,name:r,universalResolverAddress:i}){const a=await Du(u,Gy,"getEnsText")({blockNumber:e,blockTag:t,key:"avatar",name:r,universalResolverAddress:i});if(!a)return null;try{return await WM(u,{record:a,gatewayUrls:n})}catch{return null}}async function HM(u,{address:e,blockNumber:t,blockTag:n,universalResolverAddress:r}){let i=r;if(!i){if(!u.chain)throw new Error("client chain not configured. universalResolverAddress is required.");i=Vr({blockNumber:t,chain:u.chain,contract:"ensUniversalResolver"})}const a=`${e.toLowerCase().substring(2)}.addr.reverse`;try{return(await Du(u,Zt,"readContract")({address:i,abi:oM,functionName:"reverse",args:[ju(AE(a))],blockNumber:t,blockTag:n}))[0]}catch(o){if(Pp(o,"reverse"))return null;throw o}}async function KM(u,{blockNumber:e,blockTag:t,name:n,universalResolverAddress:r}){let i=r;if(!i){if(!u.chain)throw new Error("client chain not configured. universalResolverAddress is required.");i=Vr({blockNumber:e,chain:u.chain,contract:"ensUniversalResolver"})}const[a]=await Du(u,Zt,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[ju(AE(n))],blockNumber:e,blockTag:t});return a}async function VM(u){const e=aE(u,{method:"eth_newBlockFilter"}),t=await u.request({method:"eth_newBlockFilter"});return{id:t,request:e(t),type:"block"}}async function Qy(u,{address:e,args:t,event:n,events:r,fromBlock:i,strict:a,toBlock:o}={}){const s=r??(n?[n]:void 0),l=aE(u,{method:"eth_newFilter"});let c=[];s&&(c=[s.flatMap(d=>$a({abi:[d],eventName:d.name,args:t}))],n&&(c=c[0]));const E=await u.request({method:"eth_newFilter",params:[{address:e,fromBlock:typeof i=="bigint"?vu(i):i,toBlock:typeof o=="bigint"?vu(o):o,...c.length?{topics:c}:{}}]});return{abi:s,args:t,eventName:n?n.name:void 0,fromBlock:i,id:E,request:l(E),strict:a,toBlock:o,type:"event"}}async function Xy(u){const e=aE(u,{method:"eth_newPendingTransactionFilter"}),t=await u.request({method:"eth_newPendingTransactionFilter"});return{id:t,request:e(t),type:"transaction"}}async function GM(u,{address:e,blockNumber:t,blockTag:n="latest"}){const r=t?vu(t):void 0,i=await u.request({method:"eth_getBalance",params:[e,r||n]});return BigInt(i)}async function QM(u,{blockHash:e,blockNumber:t,blockTag:n="latest"}={}){const r=t!==void 0?vu(t):void 0;let i;return e?i=await u.request({method:"eth_getBlockTransactionCountByHash",params:[e]}):i=await u.request({method:"eth_getBlockTransactionCountByNumber",params:[r||n]}),Ku(i)}async function XM(u,{address:e,blockNumber:t,blockTag:n="latest"}){const r=t!==void 0?vu(t):void 0,i=await u.request({method:"eth_getCode",params:[e,r||n]});if(i!=="0x")return i}function YM(u){var e;return{baseFeePerGas:u.baseFeePerGas.map(t=>BigInt(t)),gasUsedRatio:u.gasUsedRatio,oldestBlock:BigInt(u.oldestBlock),reward:(e=u.reward)==null?void 0:e.map(t=>t.map(n=>BigInt(n)))}}async function ZM(u,{blockCount:e,blockNumber:t,blockTag:n="latest",rewardPercentiles:r}){const i=t?vu(t):void 0,a=await u.request({method:"eth_feeHistory",params:[vu(e),i||n,r]});return YM(a)}async function JM(u,{filter:e}){const t=e.strict??!1;return(await e.request({method:"eth_getFilterLogs",params:[e.id]})).map(r=>{var i;try{const{eventName:a,args:o}="abi"in e&&e.abi?Wa({abi:e.abi,data:r.data,topics:r.topics,strict:t}):{eventName:void 0,args:void 0};return Ve(r,{args:o,eventName:a})}catch(a){let o,s;if(a instanceof Wn||a instanceof Ur){if("strict"in e&&e.strict)return;o=a.abiItem.name,s=(i=a.abiItem.inputs)==null?void 0:i.some(l=>!("name"in l&&l.name))}return Ve(r,{args:s?[]:{},eventName:o})}}).filter(Boolean)}class uL extends eu{constructor({callbackSelector:e,cause:t,data:n,extraData:r,sender:i,urls:a}){var o;super(t.shortMessage||"An error occurred while fetching for an offchain result.",{cause:t,metaMessages:[...t.metaMessages||[],(o=t.metaMessages)!=null&&o.length?"":[],"Offchain Gateway Call:",a&&[" Gateway URL(s):",...a.map(s=>` ${Ra(s)}`)],` Sender: ${i}`,` Data: ${n}`,` Callback selector: ${e}`,` Extra data: ${r}`].flat()}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupError"})}}class eL extends eu{constructor({result:e,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${Ra(t)}`,`Response: ${z0(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupResponseMalformedError"})}}class tL extends eu{constructor({sender:e,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupSenderMismatchError"})}}function vE(u,e){if(!ae(u))throw new ge({address:u});if(!ae(e))throw new ge({address:e});return u.toLowerCase()===e.toLowerCase()}const Yy="0x556f1830",Ip={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function Zy(u,{blockNumber:e,blockTag:t,data:n,to:r}){const{args:i}=Cp({data:n,abi:[Ip]}),[a,o,s,l,c]=i;try{if(!vE(r,a))throw new tL({sender:a,to:r});const E=await zp({data:s,sender:a,urls:o}),{data:d}=await G4(u,{blockNumber:e,blockTag:t,data:Ge([l,rn([{type:"bytes"},{type:"bytes"}],[E,c])]),to:r});return d}catch(E){throw new uL({callbackSelector:l,cause:E,data:n,extraData:c,sender:a,urls:o})}}async function zp({data:u,sender:e,urls:t}){var r;let n=new Error("An unknown error occurred.");for(let i=0;it.id===e)}const iL=/^(.*)\[([0-9]*)\]$/,Jy=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,uD=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function jp({domain:u,message:e,primaryType:t,types:n}){const r=typeof u>"u"?{}:u,i={EIP712Domain:BE({domain:r}),...n};Np({domain:r,message:e,primaryType:t,types:i});const a=["0x1901"];return r&&a.push(Rp({domain:r,types:i})),t!=="EIP712Domain"&&a.push(eD({data:e,primaryType:t,types:i})),B0(Ge(a))}function Rp({domain:u,types:e}){return eD({data:u,primaryType:"EIP712Domain",types:e})}function eD({data:u,primaryType:e,types:t}){const n=tD({data:u,primaryType:e,types:t});return B0(n)}function tD({data:u,primaryType:e,types:t}){const n=[{type:"bytes32"}],r=[aL({primaryType:e,types:t})];for(const i of t[e]){const[a,o]=rD({types:t,name:i.name,type:i.type,value:u[i.name]});n.push(a),r.push(o)}return rn(n,r)}function aL({primaryType:u,types:e}){const t=ju(oL({primaryType:u,types:e}));return B0(t)}function oL({primaryType:u,types:e}){let t="";const n=nD({primaryType:u,types:e});n.delete(u);const r=[u,...Array.from(n).sort()];for(const i of r)t+=`${i}(${e[i].map(({name:a,type:o})=>`${o} ${a}`).join(",")})`;return t}function nD({primaryType:u,types:e},t=new Set){const n=u.match(/^\w*/u),r=n==null?void 0:n[0];if(t.has(r)||e[r]===void 0)return t;t.add(r);for(const i of e[r])nD({primaryType:i.type,types:e},t);return t}function rD({types:u,name:e,type:t,value:n}){if(u[t]!==void 0)return[{type:"bytes32"},B0(tD({data:n,primaryType:t,types:u}))];if(t==="bytes")return n=`0x${(n.length%2?"0":"")+n.slice(2)}`,[{type:"bytes32"},B0(n)];if(t==="string")return[{type:"bytes32"},B0(ju(n))];if(t.lastIndexOf("]")===t.length-1){const r=t.slice(0,t.lastIndexOf("[")),i=n.map(a=>rD({name:e,type:r,types:u,value:a}));return[{type:"bytes32"},B0(rn(i.map(([a])=>a),i.map(([,a])=>a)))]}return[{type:t},n]}function Np({domain:u,message:e,primaryType:t,types:n}){const r=n,i=(a,o)=>{for(const s of a){const{name:l,type:c}=s,E=c,d=o[l],f=E.match(uD);if(f&&(typeof d=="number"||typeof d=="bigint")){const[v,A,m]=f;vu(d,{signed:A==="int",size:parseInt(m)/8})}if(E==="address"&&typeof d=="string"&&!ae(d))throw new ge({address:d});const p=E.match(Jy);if(p){const[v,A]=p;if(A&&m0(d)!==parseInt(A))throw new ap({expectedSize:parseInt(A),givenSize:m0(d)})}const C=r[E];C&&i(C,d)}};if(r.EIP712Domain&&u&&i(r.EIP712Domain,u),t!=="EIP712Domain"){const a=r[t];i(a,e)}}function BE({domain:u}){return[typeof(u==null?void 0:u.name)=="string"&&{name:"name",type:"string"},(u==null?void 0:u.version)&&{name:"version",type:"string"},typeof(u==null?void 0:u.chainId)=="number"&&{name:"chainId",type:"uint256"},(u==null?void 0:u.verifyingContract)&&{name:"verifyingContract",type:"address"},(u==null?void 0:u.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function sL({domain:u}){return Rp({domain:u,types:{EIP712Domain:BE({domain:u})}})}function lL({abi:u,data:e}){const t=t0(e,0,4),n=u.find(r=>r.type==="function"&&t===Na(nn(r)));if(!n)throw new uy(t,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:n.name,args:"inputs"in n&&n.inputs&&n.inputs.length>0?qr(n.inputs,t0(e,4)):void 0}}const y9="/docs/contract/encodeDeployData";function $p({abi:u,args:e,bytecode:t}){if(!e||e.length===0)return t;const n=u.find(i=>"type"in i&&i.type==="constructor");if(!n)throw new tp({docsPath:y9});if(!("inputs"in n))throw new B4({docsPath:y9});if(!n.inputs||n.inputs.length===0)throw new B4({docsPath:y9});const r=rn(n.inputs,e);return tn([t,r])}const D9="/docs/contract/encodeErrorResult";function cL({abi:u,errorName:e,args:t}){let n=u[0];if(e&&(n=Zn({abi:u,args:t,name:e}),!n))throw new yd(e,{docsPath:D9});if(n.type!=="error")throw new yd(void 0,{docsPath:D9});const r=nn(n),i=Na(r);let a="0x";if(t&&t.length>0){if(!n.inputs)throw new YF(n.name,{docsPath:D9});a=rn(n.inputs,t)}return tn([i,a])}const EL="/docs/contract/encodeFunctionResult";function dL({abi:u,functionName:e,result:t}){let n=u[0];if(e&&(n=Zn({abi:u,name:e}),!n))throw new Pr(e,{docsPath:"/docs/contract/encodeFunctionResult"});if(n.type!=="function")throw new Pr(void 0,{docsPath:"/docs/contract/encodeFunctionResult"});if(!n.outputs)throw new ip(n.name,{docsPath:EL});let r=Array.isArray(t)?t:[t];return n.outputs.length===0&&!r[0]&&(r=[]),rn(n.outputs,r)}function fL(u,e){if(u.length!==e.length)throw new np({expectedLength:u.length,givenLength:e.length});const t=[];for(let n=0;n1||t[0]>1)throw new EF(t);return!!t[0]}function lD(u,e={}){typeof e.size<"u"&&Xe(u,{size:e.size});const t=Ae(u,e);return Ku(t)}function cD(u,e={}){let t=u;return typeof e.size<"u"&&(Xe(t,{size:e.size}),t=te(t,{dir:"right"})),new TextDecoder().decode(t)}class V8 extends eu{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NegativeOffsetError"})}}class hL extends eu{constructor({length:e,position:t}){super(`Position \`${t}\` is out of bounds (\`0 < position < ${e}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PositionOutOfBoundsError"})}}const mL={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,assertPosition(u){if(u<0||u>this.bytes.length-1)throw new hL({length:this.bytes.length,position:u})},decrementPosition(u){if(u<0)throw new V8({offset:u});const e=this.position-u;this.assertPosition(e),this.position=e},incrementPosition(u){if(u<0)throw new V8({offset:u});const e=this.position+u;this.assertPosition(e),this.position=e},inspectByte(u){const e=u??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(u,e){const t=e??this.position;return this.assertPosition(t+u-1),this.bytes.subarray(t,t+u)},inspectUint8(u){const e=u??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(u){const e=u??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(u){const e=u??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(u){const e=u??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(u){this.assertPosition(this.position),this.bytes[this.position]=u,this.position++},pushBytes(u){this.assertPosition(this.position+u.length-1),this.bytes.set(u,this.position),this.position+=u.length},pushUint8(u){this.assertPosition(this.position),this.bytes[this.position]=u,this.position++},pushUint16(u){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,u),this.position+=2},pushUint24(u){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,u>>8),this.dataView.setUint8(this.position+2,u&255),this.position+=3},pushUint32(u){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,u),this.position+=4},readByte(){const u=this.inspectByte();return this.position++,u},readBytes(u){const e=this.inspectBytes(u);return this.position+=u,e},readUint8(){const u=this.inspectUint8();return this.position+=1,u},readUint16(){const u=this.inspectUint16();return this.position+=2,u},readUint24(){const u=this.inspectUint24();return this.position+=3,u},readUint32(){const u=this.inspectUint32();return this.position+=4,u},setPosition(u){this.assertPosition(u),this.position=u}};function ED(u){const e=Object.create(mL);return e.bytes=u,e.dataView=new DataView(u.buffer,u.byteOffset,u.byteLength),e}function Mp(u,e="hex"){const t=(()=>{if(typeof u=="string"){if(u.length>3&&u.length%2!==0)throw new fF(u);return en(u)}return u})(),n=ED(t);return dD(n,e)}function dD(u,e="hex"){if(u.bytes.length===0)return e==="hex"?Ae(u.bytes):u.bytes;const t=u.readByte();if(t<128&&u.decrementPosition(1),t<192){const r=G8(u,t,128),i=u.readBytes(r);return e==="hex"?Ae(i):i}const n=G8(u,t,192);return AL(u,n,e)}function G8(u,e,t){if(t===128&&e<128)return 1;if(e<=t+55)return e-t;if(e===t+55+1)return u.readUint8();if(e===t+55+2)return u.readUint16();if(e===t+55+3)return u.readUint24();if(e===t+55+4)return u.readUint32();throw new eu("Invalid RLP prefix")}function AL(u,e,t){const n=u.position,r=[];for(;u.position-nPromise.resolve().then(()=>BH),void 0);return`0x${i.Signature.fromCompact(t.substring(2,130)).addRecoveryBit(r-27).recoverPublicKey(n.substring(2)).toHex(!1)}`}async function Lp({hash:u,signature:e}){return yM(await pD({hash:u,signature:e}))}const CD=`Ethereum Signed Message: -`;function Wp(u,e){const t=typeof u=="string"?kt(u):u.raw instanceof Uint8Array?u.raw:ue(u.raw),n=kt(`${CD}${t.length}`);return B0(Ge([n,t]),e)}async function hD({message:u,signature:e}){return Lp({hash:Wp(u),signature:e})}async function mD({domain:u,message:e,primaryType:t,signature:n,types:r}){return Lp({hash:jp({domain:u,message:e,primaryType:t,types:r}),signature:n})}async function gL({address:u,message:e,signature:t}){return vE(a0(u),await hD({message:e,signature:t}))}async function vL({address:u,domain:e,message:t,primaryType:n,signature:r,types:i}){return vE(a0(u),await mD({domain:e,message:t,primaryType:n,signature:r,types:i}))}function AD(u){const e=Ep(u,0,1);if(e==="0x02")return"eip1559";if(e==="0x01")return"eip2930";if(e!=="0x"&&Ku(e)>=192)return"legacy";throw new Fy({serializedType:e})}function Up(u){const{chainId:e,maxPriorityFeePerGas:t,gasPrice:n,maxFeePerGas:r,to:i}=u;if(e<=0)throw new Jc({chainId:e});if(i&&!ae(i))throw new ge({address:i});if(n)throw new eu("`gasPrice` is not a valid EIP-1559 Transaction attribute.");if(r&&r>2n**256n-1n)throw new Ln({maxFeePerGas:r});if(t&&r&&t>r)throw new ra({maxFeePerGas:r,maxPriorityFeePerGas:t})}function qp(u){const{chainId:e,maxPriorityFeePerGas:t,gasPrice:n,maxFeePerGas:r,to:i}=u;if(e<=0)throw new Jc({chainId:e});if(i&&!ae(i))throw new ge({address:i});if(t||r)throw new eu("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(n&&n>2n**256n-1n)throw new Ln({maxFeePerGas:n})}function Hp(u){const{chainId:e,maxPriorityFeePerGas:t,gasPrice:n,maxFeePerGas:r,to:i,accessList:a}=u;if(i&&!ae(i))throw new ge({address:i});if(typeof e<"u"&&e<=0)throw new Jc({chainId:e});if(t||r)throw new eu("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(n&&n>2n**256n-1n)throw new Ln({maxFeePerGas:n});if(a)throw new eu("`accessList` is not a valid Legacy Transaction attribute.")}function BL(u){const e=AD(u);return e==="eip1559"?FL(u):e==="eip2930"?yL(u):DL(u)}function FL(u){const e=gD(u),[t,n,r,i,a,o,s,l,c,E,d,f]=e;if(!(e.length===9||e.length===12))throw new sE({attributes:{chainId:t,nonce:n,maxPriorityFeePerGas:r,maxFeePerGas:i,gas:a,to:o,value:s,data:l,accessList:c,...e.length>9?{v:E,r:d,s:f}:{}},serializedTransaction:u,type:"eip1559"});const p={chainId:Ku(t),type:"eip1559"};return zu(o)&&o!=="0x"&&(p.to=o),zu(a)&&a!=="0x"&&(p.gas=Hu(a)),zu(l)&&l!=="0x"&&(p.data=l),zu(n)&&n!=="0x"&&(p.nonce=Ku(n)),zu(s)&&s!=="0x"&&(p.value=Hu(s)),zu(i)&&i!=="0x"&&(p.maxFeePerGas=Hu(i)),zu(r)&&r!=="0x"&&(p.maxPriorityFeePerGas=Hu(r)),c.length!==0&&c!=="0x"&&(p.accessList=vD(c)),Up(p),{...e.length===12?BD(e):void 0,...p}}function yL(u){const e=gD(u),[t,n,r,i,a,o,s,l,c,E,d]=e;if(!(e.length===8||e.length===11))throw new sE({attributes:{chainId:t,nonce:n,gasPrice:r,gas:i,to:a,value:o,data:s,accessList:l,...e.length>8?{v:c,r:E,s:d}:{}},serializedTransaction:u,type:"eip2930"});const f={chainId:Ku(t),type:"eip2930"};return zu(a)&&a!=="0x"&&(f.to=a),zu(i)&&i!=="0x"&&(f.gas=Hu(i)),zu(s)&&s!=="0x"&&(f.data=s),zu(n)&&n!=="0x"&&(f.nonce=Ku(n)),zu(o)&&o!=="0x"&&(f.value=Hu(o)),zu(r)&&r!=="0x"&&(f.gasPrice=Hu(r)),l.length!==0&&l!=="0x"&&(f.accessList=vD(l)),qp(f),{...e.length===11?BD(e):void 0,...f}}function DL(u){const e=Mp(u,"hex"),[t,n,r,i,a,o,s,l,c]=e;if(!(e.length===6||e.length===9))throw new sE({attributes:{nonce:t,gasPrice:n,gas:r,to:i,value:a,data:o,...e.length>6?{v:s,r:l,s:c}:{}},serializedTransaction:u,type:"legacy"});const E={type:"legacy"};if(zu(i)&&i!=="0x"&&(E.to=i),zu(r)&&r!=="0x"&&(E.gas=Hu(r)),zu(o)&&o!=="0x"&&(E.data=o),zu(t)&&t!=="0x"&&(E.nonce=Ku(t)),zu(a)&&a!=="0x"&&(E.value=Hu(a)),zu(n)&&n!=="0x"&&(E.gasPrice=Hu(n)),Hp(E),e.length===6)return E;const d=zu(s)&&s!=="0x"?Hu(s):0n;if(c==="0x"&&l==="0x")return d>0&&(E.chainId=Number(d)),E;const f=d,p=Number((f-35n)/2n);if(p>0)E.chainId=p;else if(f!==27n&&f!==28n)throw new hp({v:f});return E.v=f,E.s=c,E.r=l,E}function gD(u){return Mp(`0x${u.slice(4)}`,"hex")}function vD(u){const e=[];for(let t=0;tfD(i)?i:te(i))})}return e}function BD(u){const e=u.slice(-3),t=e[0]==="0x"||Hu(e[0])===0n?27n:28n;return{r:dt(e[1],{size:32}),s:dt(e[2],{size:32}),v:t,yParity:t===27n?0:1}}function Kp(u){if(!u||u.length===0)return[];const e=[];for(let t=0;t{if(t>0)return BigInt(t*2)+BigInt(35n+e.v-27n);if(e.v>=35n)return(e.v-35n)/2n>0?e.v:27n+(e.v===35n?0n:1n);const E=27n+(e.v===27n?0n:1n);if(e.v!==E)throw new hp({v:e.v});return E})();l=[...l,ju(c),e.r,e.s]}else t>0&&(l=[...l,ju(t),"0x","0x"]);return Gr(l)}function Vp(u,e){let[t,n="0"]=u.split(".");const r=t.startsWith("-");if(r&&(t=t.slice(1)),n=n.replace(/(0+)$/,""),e===0)Math.round(+`.${n}`)===1&&(t=`${BigInt(t)+1n}`),n="";else if(n.length>e){const[i,a,o]=[n.slice(0,e-1),n.slice(e-1,e),n.slice(e)],s=Math.round(+`${a}.${o}`);s>9?n=`${BigInt(i)+BigInt(1)}0`.padStart(i.length+1,"0"):n=`${i}${s}`,n.length>e&&(n=n.slice(1),t=`${BigInt(t)+1n}`),n=n.slice(0,e)}else n=n.padEnd(e,"0");return BigInt(`${r?"-":""}${t}${n}`)}function _L(u,e="wei"){return Vp(u,up[e])}function SL(u,e="wei"){return Vp(u,ep[e])}function TL(u){return u.map(e=>({...e,value:BigInt(e.value)}))}function PL(u){return{...u,balance:u.balance?BigInt(u.balance):void 0,nonce:u.nonce?Ku(u.nonce):void 0,storageProof:u.storageProof?TL(u.storageProof):void 0}}async function OL(u,{address:e,blockNumber:t,blockTag:n,storageKeys:r}){const i=n??"latest",a=t!==void 0?vu(t):void 0,o=await u.request({method:"eth_getProof",params:[e,r,a||i]});return PL(o)}async function IL(u,{address:e,blockNumber:t,blockTag:n="latest",slot:r}){const i=t!==void 0?vu(t):void 0;return await u.request({method:"eth_getStorageAt",params:[e,r,i||n]})}async function Gp(u,{blockHash:e,blockNumber:t,blockTag:n,hash:r,index:i}){var c,E,d;const a=n||"latest",o=t!==void 0?vu(t):void 0;let s=null;if(r?s=await u.request({method:"eth_getTransactionByHash",params:[r]}):e?s=await u.request({method:"eth_getTransactionByBlockHashAndIndex",params:[e,vu(i)]}):(o||a)&&(s=await u.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[o||a,vu(i)]})),!s)throw new mp({blockHash:e,blockNumber:t,blockTag:a,hash:r,index:i});return(((d=(E=(c=u.chain)==null?void 0:c.formatters)==null?void 0:E.transaction)==null?void 0:d.format)||W4)(s)}async function zL(u,{hash:e,transactionReceipt:t}){const[n,r]=await Promise.all([Du(u,X4,"getBlockNumber")({}),e?Du(u,Gp,"getBlockNumber")({hash:e}):void 0]),i=(t==null?void 0:t.blockNumber)||(r==null?void 0:r.blockNumber);return i?n-i+1n:0n}async function Od(u,{hash:e}){var r,i,a;const t=await u.request({method:"eth_getTransactionReceipt",params:[e]});if(!t)throw new Ap({hash:e});return(((a=(i=(r=u.chain)==null?void 0:r.formatters)==null?void 0:i.transactionReceipt)==null?void 0:a.format)||Zf)(t)}async function jL(u,e){var C;const{allowFailure:t=!0,batchSize:n,blockNumber:r,blockTag:i,contracts:a,multicallAddress:o}=e,s=n??(typeof((C=u.batch)==null?void 0:C.multicall)=="object"&&u.batch.multicall.batchSize||1024);let l=o;if(!l){if(!u.chain)throw new Error("client chain not configured. multicallAddress is required.");l=Vr({blockNumber:r,chain:u.chain,contract:"multicall3"})}const c=[[]];let E=0,d=0;for(let v=0;v0&&d>s&&c[E].length>0&&(E++,d=(D.length-2)/2,c[E]=[]),c[E]=[...c[E],{allowFailure:!0,callData:D,target:m}]}catch(D){const F=ga(D,{abi:A,address:m,args:g,docsPath:"/docs/contract/multicall",functionName:B});if(!t)throw F;c[E]=[...c[E],{allowFailure:!0,callData:"0x",target:m}]}}const f=await Promise.allSettled(c.map(v=>Du(u,Zt,"readContract")({abi:_l,address:l,args:[v],blockNumber:r,blockTag:i,functionName:"aggregate3"}))),p=[];for(let v=0;vu instanceof Uint8Array,$L=Array.from({length:256},(u,e)=>e.toString(16).padStart(2,"0"));function va(u){if(!yE(u))throw new Error("Uint8Array expected");let e="";for(let t=0;tn+r.length,0));let t=0;return u.forEach(n=>{if(!yE(n))throw new Error("Uint8Array expected");e.set(n,t),t+=n.length}),e}function DD(u,e){if(u.length!==e.length)return!1;for(let t=0;tFD;u>>=FE,e+=1);return e}function WL(u,e){return u>>BigInt(e)&FE}const UL=(u,e,t)=>u|(t?FE:FD)<(NL<new Uint8Array(u),Q8=u=>Uint8Array.from(u);function bD(u,e,t){if(typeof u!="number"||u<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let n=b9(u),r=b9(u),i=0;const a=()=>{n.fill(1),r.fill(0),i=0},o=(...E)=>t(r,n,...E),s=(E=b9())=>{r=o(Q8([0]),E),n=o(),E.length!==0&&(r=o(Q8([1]),E),n=o())},l=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let E=0;const d=[];for(;E{a(),s(E);let f;for(;!(f=d(l()));)s();return a(),f}}const qL={bigint:u=>typeof u=="bigint",function:u=>typeof u=="function",boolean:u=>typeof u=="boolean",string:u=>typeof u=="string",stringOrUint8Array:u=>typeof u=="string"||u instanceof Uint8Array,isSafeInteger:u=>Number.isSafeInteger(u),array:u=>Array.isArray(u),field:(u,e)=>e.Fp.isValid(u),hash:u=>typeof u=="function"&&Number.isSafeInteger(u.outputLen)};function Ha(u,e,t={}){const n=(r,i,a)=>{const o=qL[i];if(typeof o!="function")throw new Error(`Invalid validator "${i}", expected function`);const s=u[r];if(!(a&&s===void 0)&&!o(s,u))throw new Error(`Invalid param ${String(r)}=${s} (${typeof s}), expected ${i}`)};for(const[r,i]of Object.entries(e))n(r,i,!1);for(const[r,i]of Object.entries(t))n(r,i,!0);return u}const HL=Object.freeze(Object.defineProperty({__proto__:null,bitGet:WL,bitLen:LL,bitMask:Zp,bitSet:UL,bytesToHex:va,bytesToNumberBE:re,bytesToNumberLE:Xp,concatBytes:ye,createHmacDrbg:bD,ensureBytes:Q0,equalBytes:DD,hexToBytes:Ba,hexToNumber:Qp,numberToBytesBE:Hn,numberToBytesLE:Yp,numberToHexUnpadded:yD,numberToVarBytesBE:ML,utf8ToBytes:DE,validateObject:Ha},Symbol.toStringTag,{value:"Module"}));function KL(u,e){const t=zu(u)?ue(u):u,n=zu(e)?ue(e):e;return DD(t,n)}async function wD(u,{address:e,hash:t,signature:n,...r}){const i=zu(n)?n:ju(n);try{const{data:a}=await Du(u,G4,"call")({data:$p({abi:sM,args:[e,t,i],bytecode:RL}),...r});return KL(a??"0x0","0x1")}catch(a){if(a instanceof gp)return!1;throw a}}async function VL(u,{address:e,message:t,signature:n,...r}){const i=Wp(t);return wD(u,{address:e,hash:i,signature:n,...r})}async function GL(u,{address:e,signature:t,message:n,primaryType:r,types:i,domain:a,...o}){const s=jp({message:n,primaryType:r,types:i,domain:a});return wD(u,{address:e,hash:s,signature:t,...o})}function xD(u,{emitOnBegin:e=!1,emitMissed:t=!1,onBlockNumber:n,onError:r,poll:i,pollingInterval:a=u.pollingInterval}){const o=typeof i<"u"?i:u.transport.type!=="webSocket";let s;return o?(()=>{const E=z0(["watchBlockNumber",u.uid,e,t,a]);return Ua(E,{onBlockNumber:n,onError:r},d=>Q4(async()=>{var f;try{const p=await Du(u,X4,"getBlockNumber")({cacheTime:0});if(s){if(p===s)return;if(p-s>1&&t)for(let C=s+1n;Cs)&&(d.onBlockNumber(p,s),s=p)}catch(p){(f=d.onError)==null||f.call(d,p)}},{emitOnBegin:e,interval:a}))})():(()=>{let E=!0,d=()=>E=!1;return(async()=>{try{const{unsubscribe:f}=await u.transport.subscribe({params:["newHeads"],onData(p){var v;if(!E)return;const C=Hu((v=p.result)==null?void 0:v.number);n(C,s),s=C},onError(p){r==null||r(p)}});d=f,E||d()}catch(f){r==null||r(f)}})(),d})()}async function QL(u,{confirmations:e=1,hash:t,onReplaced:n,pollingInterval:r=u.pollingInterval,timeout:i}){const a=z0(["waitForTransactionReceipt",u.uid,t]);let o,s,l,c=!1;return new Promise((E,d)=>{i&&setTimeout(()=>d(new by({hash:t})),i);const f=Ua(a,{onReplaced:n,resolve:E,reject:d},p=>{const C=Du(u,xD,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:r,async onBlockNumber(v){if(c)return;let A=v;const m=g=>{C(),g(),f()};try{if(l){if(e>1&&(!l.blockNumber||A-l.blockNumber+1np.resolve(l));return}if(o||(c=!0,await kd(async()=>{o=await Du(u,Gp,"getTransaction")({hash:t}),o.blockNumber&&(A=o.blockNumber)},{delay:({count:g})=>~~(1<1&&(!l.blockNumber||A-l.blockNumber+1np.resolve(l))}catch(g){if(o&&(g instanceof mp||g instanceof Ap))try{s=o,c=!0;const B=await kd(()=>Du(u,qn,"getBlock")({blockNumber:A,includeTransactions:!0}),{delay:({count:h})=>~~(1<h instanceof Bp});c=!1;const D=B.transactions.find(({from:h,nonce:b})=>h===s.from&&b===s.nonce);if(!D||(l=await Du(u,Od,"getTransactionReceipt")({hash:D.hash}),e>1&&(!l.blockNumber||A-l.blockNumber+1n{var h;(h=p.onReplaced)==null||h.call(p,{reason:F,replacedTransaction:s,transaction:D,transactionReceipt:l}),p.resolve(l)})}catch(B){m(()=>p.reject(B))}else m(()=>p.reject(g))}}})})})}function XL(u,{blockTag:e="latest",emitMissed:t=!1,emitOnBegin:n=!1,onBlock:r,onError:i,includeTransactions:a,poll:o,pollingInterval:s=u.pollingInterval}){const l=typeof o<"u"?o:u.transport.type!=="webSocket",c=a??!1;let E;return l?(()=>{const p=z0(["watchBlocks",u.uid,t,n,c,s]);return Ua(p,{onBlock:r,onError:i},C=>Q4(async()=>{var v;try{const A=await Du(u,qn,"getBlock")({blockTag:e,includeTransactions:c});if(A.number&&(E!=null&&E.number)){if(A.number===E.number)return;if(A.number-E.number>1&&t)for(let m=(E==null?void 0:E.number)+1n;mE.number)&&(C.onBlock(A,E),E=A)}catch(A){(v=C.onError)==null||v.call(C,A)}},{emitOnBegin:n,interval:s}))})():(()=>{let p=!0,C=()=>p=!1;return(async()=>{try{const{unsubscribe:v}=await u.transport.subscribe({params:["newHeads"],onData(A){var B,D,F;if(!p)return;const g=(((F=(D=(B=u.chain)==null?void 0:B.formatters)==null?void 0:D.block)==null?void 0:F.format)||Zc)(A.result);r(g,E),E=g},onError(A){i==null||i(A)}});C=v,p||C()}catch(v){i==null||i(v)}})(),C})()}function YL(u,{address:e,args:t,batch:n=!0,event:r,events:i,onError:a,onLogs:o,poll:s,pollingInterval:l=u.pollingInterval,strict:c}){const E=typeof s<"u"?s:u.transport.type!=="webSocket",d=c??!1;return E?(()=>{const C=z0(["watchEvent",e,t,n,u.uid,r,l]);return Ua(C,{onLogs:o,onError:a},v=>{let A,m,g=!1;const B=Q4(async()=>{var D;if(!g){try{m=await Du(u,Qy,"createEventFilter")({address:e,args:t,event:r,events:i,strict:d})}catch{}g=!0;return}try{let F;if(m)F=await Du(u,CE,"getFilterChanges")({filter:m});else{const h=await Du(u,X4,"getBlockNumber")({});A&&A!==h?F=await Du(u,bp,"getLogs")({address:e,args:t,event:r,events:i,fromBlock:A+1n,toBlock:h}):F=[],A=h}if(F.length===0)return;if(n)v.onLogs(F);else for(const h of F)v.onLogs([h])}catch(F){m&&F instanceof Un&&(g=!1),(D=v.onError)==null||D.call(v,F)}},{emitOnBegin:!0,interval:l});return async()=>{m&&await Du(u,hE,"uninstallFilter")({filter:m}),B()}})})():(()=>{let C=!0,v=()=>C=!1;return(async()=>{try{const A=i??(r?[r]:void 0);let m=[];A&&(m=[A.flatMap(B=>$a({abi:[B],eventName:B.name,args:t}))],r&&(m=m[0]));const{unsubscribe:g}=await u.transport.subscribe({params:["logs",{address:e,topics:m}],onData(B){var F;if(!C)return;const D=B.result;try{const{eventName:h,args:b}=Wa({abi:A,data:D.data,topics:D.topics,strict:d}),T=Ve(D,{args:b,eventName:h});o([T])}catch(h){let b,T;if(h instanceof Wn||h instanceof Ur){if(c)return;b=h.abiItem.name,T=(F=h.abiItem.inputs)==null?void 0:F.some(L=>!("name"in L&&L.name))}const k=Ve(D,{args:T?[]:{},eventName:b});o([k])}},onError(B){a==null||a(B)}});v=g,C||v()}catch(A){a==null||a(A)}})(),v})()}function ZL(u,{batch:e=!0,onError:t,onTransactions:n,poll:r,pollingInterval:i=u.pollingInterval}){return(typeof r<"u"?r:u.transport.type!=="webSocket")?(()=>{const l=z0(["watchPendingTransactions",u.uid,e,i]);return Ua(l,{onTransactions:n,onError:t},c=>{let E;const d=Q4(async()=>{var f;try{if(!E)try{E=await Du(u,Xy,"createPendingTransactionFilter")({});return}catch(C){throw d(),C}const p=await Du(u,CE,"getFilterChanges")({filter:E});if(p.length===0)return;if(e)c.onTransactions(p);else for(const C of p)c.onTransactions([C])}catch(p){(f=c.onError)==null||f.call(c,p)}},{emitOnBegin:!0,interval:i});return async()=>{E&&await Du(u,hE,"uninstallFilter")({filter:E}),d()}})})():(()=>{let l=!0,c=()=>l=!1;return(async()=>{try{const{unsubscribe:E}=await u.transport.subscribe({params:["newPendingTransactions"],onData(d){if(!l)return;const f=d.result;n([f])},onError(d){t==null||t(d)}});c=E,l||c()}catch(E){t==null||t(E)}})(),c})()}function kD(u){return{call:e=>G4(u,e),createBlockFilter:()=>VM(u),createContractEventFilter:e=>pp(u,e),createEventFilter:e=>Qy(u,e),createPendingTransactionFilter:()=>Xy(u),estimateContractGas:e=>Iy(u,e),estimateGas:e=>Dp(u,e),getBalance:e=>GM(u,e),getBlock:e=>qn(u,e),getBlockNumber:e=>X4(u,e),getBlockTransactionCount:e=>QM(u,e),getBytecode:e=>XM(u,e),getChainId:()=>F4(u),getContractEvents:e=>wp(u,e),getEnsAddress:e=>PM(u,e),getEnsAvatar:e=>qM(u,e),getEnsName:e=>HM(u,e),getEnsResolver:e=>KM(u,e),getEnsText:e=>Gy(u,e),getFeeHistory:e=>ZM(u,e),estimateFeesPerGas:e=>iM(u,e),getFilterChanges:e=>CE(u,e),getFilterLogs:e=>JM(u,e),getGasPrice:()=>Fp(u),getLogs:e=>bp(u,e),getProof:e=>OL(u,e),estimateMaxPriorityFeePerGas:e=>rM(u,e),getStorageAt:e=>IL(u,e),getTransaction:e=>Gp(u,e),getTransactionConfirmations:e=>zL(u,e),getTransactionCount:e=>Oy(u,e),getTransactionReceipt:e=>Od(u,e),multicall:e=>jL(u,e),prepareTransactionRequest:e=>pE(u,e),readContract:e=>Zt(u,e),sendRawTransaction:e=>_p(u,e),simulateContract:e=>Ry(u,e),verifyMessage:e=>VL(u,e),verifyTypedData:e=>GL(u,e),uninstallFilter:e=>hE(u,e),waitForTransactionReceipt:e=>QL(u,e),watchBlocks:e=>XL(u,e),watchBlockNumber:e=>xD(u,e),watchContractEvent:e=>Ny(u,e),watchEvent:e=>YL(u,e),watchPendingTransactions:e=>ZL(u,e)}}function Id(u){const{key:e="public",name:t="Public Client"}=u;return mE({...u,key:e,name:t,type:"publicClient"}).extend(kD)}async function JL(u,{hash:e}){await u.request({method:`${u.mode}_dropTransaction`,params:[e]})}async function uW(u){return u.request({method:`${u.mode}_dumpState`})}async function eW(u){return u.mode==="ganache"?await u.request({method:"eth_mining"}):await u.request({method:`${u.mode}_getAutomine`})}async function tW(u){return await u.request({method:"txpool_content"})}async function nW(u){const{pending:e,queued:t}=await u.request({method:"txpool_status"});return{pending:Ku(e),queued:Ku(t)}}async function rW(u,{address:e}){await u.request({method:`${u.mode}_impersonateAccount`,params:[e]})}async function iW(u,{seconds:e}){return await u.request({method:"evm_increaseTime",params:[vu(e)]})}async function aW(u){return await u.request({method:"txpool_inspect"})}async function oW(u,{state:e}){await u.request({method:`${u.mode}_loadState`,params:[e]})}async function sW(u,{blocks:e,interval:t}){u.mode==="ganache"?await u.request({method:"evm_mine",params:[{blocks:vu(e)}]}):await u.request({method:`${u.mode}_mine`,params:[vu(e),vu(t||0)]})}async function lW(u){await u.request({method:`${u.mode}_removeBlockTimestampInterval`})}async function cW(u,{blockNumber:e,jsonRpcUrl:t}={}){await u.request({method:`${u.mode}_reset`,params:[{forking:{blockNumber:Number(e),jsonRpcUrl:t}}]})}async function EW(u,{id:e}){await u.request({method:"evm_revert",params:[e]})}async function dW(u,e){var A,m,g;const{accessList:t,data:n,from:r,gas:i,gasPrice:a,maxFeePerGas:o,maxPriorityFeePerGas:s,nonce:l,to:c,value:E,...d}=e,f=(g=(m=(A=u.chain)==null?void 0:A.formatters)==null?void 0:m.transactionRequest)==null?void 0:g.format,C=(f||Wr)({...dE(d,{format:f}),accessList:t,data:n,from:r,gas:i,gasPrice:a,maxFeePerGas:o,maxPriorityFeePerGas:s,nonce:l,to:c,value:E});return await u.request({method:"eth_sendUnsignedTransaction",params:[C]})}async function fW(u,e){u.mode==="ganache"?e?await u.request({method:"miner_start"}):await u.request({method:"miner_stop"}):await u.request({method:"evm_setAutomine",params:[e]})}async function pW(u,{address:e,value:t}){u.mode==="ganache"?await u.request({method:"evm_setAccountBalance",params:[e,vu(t)]}):await u.request({method:`${u.mode}_setBalance`,params:[e,vu(t)]})}async function CW(u,{gasLimit:e}){await u.request({method:"evm_setBlockGasLimit",params:[vu(e)]})}async function hW(u,{interval:e}){const t=u.mode==="hardhat"?e*1e3:e;await u.request({method:`${u.mode}_setBlockTimestampInterval`,params:[t]})}async function mW(u,{address:e,bytecode:t}){await u.request({method:`${u.mode}_setCode`,params:[e,t]})}async function AW(u,{address:e}){await u.request({method:`${u.mode}_setCoinbase`,params:[e]})}async function gW(u,{interval:e}){const t=u.mode==="hardhat"?e*1e3:e;await u.request({method:"evm_setIntervalMining",params:[t]})}async function vW(u,e){await u.request({method:`${u.mode}_setLoggingEnabled`,params:[e]})}async function BW(u,{gasPrice:e}){await u.request({method:`${u.mode}_setMinGasPrice`,params:[vu(e)]})}async function FW(u,{baseFeePerGas:e}){await u.request({method:`${u.mode}_setNextBlockBaseFeePerGas`,params:[vu(e)]})}async function yW(u,{timestamp:e}){await u.request({method:"evm_setNextBlockTimestamp",params:[vu(e)]})}async function DW(u,{address:e,nonce:t}){await u.request({method:`${u.mode}_setNonce`,params:[e,vu(t)]})}async function bW(u,e){await u.request({method:`${u.mode}_setRpcUrl`,params:[e]})}async function wW(u,{address:e,index:t,value:n}){await u.request({method:`${u.mode}_setStorageAt`,params:[e,typeof t=="number"?vu(t):t,n]})}async function xW(u){return await u.request({method:"evm_snapshot"})}async function kW(u,{address:e}){await u.request({method:`${u.mode}_stopImpersonatingAccount`,params:[e]})}function _D({mode:u}){return e=>{const t=e.extend(()=>({mode:u}));return{dropTransaction:n=>JL(t,n),dumpState:()=>uW(t),getAutomine:()=>eW(t),getTxpoolContent:()=>tW(t),getTxpoolStatus:()=>nW(t),impersonateAccount:n=>rW(t,n),increaseTime:n=>iW(t,n),inspectTxpool:()=>aW(t),loadState:n=>oW(t,n),mine:n=>sW(t,n),removeBlockTimestampInterval:()=>lW(t),reset:n=>cW(t,n),revert:n=>EW(t,n),sendUnsignedTransaction:n=>dW(t,n),setAutomine:n=>fW(t,n),setBalance:n=>pW(t,n),setBlockGasLimit:n=>CW(t,n),setBlockTimestampInterval:n=>hW(t,n),setCode:n=>mW(t,n),setCoinbase:n=>AW(t,n),setIntervalMining:n=>gW(t,n),setLoggingEnabled:n=>vW(t,n),setMinGasPrice:n=>BW(t,n),setNextBlockBaseFeePerGas:n=>FW(t,n),setNextBlockTimestamp:n=>yW(t,n),setNonce:n=>DW(t,n),setRpcUrl:n=>bW(t,n),setStorageAt:n=>wW(t,n),snapshot:()=>xW(t),stopImpersonatingAccount:n=>kW(t,n)}}}function _W(u){const{key:e="test",name:t="Test Client",mode:n}=u;return mE({...u,key:e,name:t,type:"testClient"}).extend(i=>({mode:n,..._D({mode:n})(i)}))}function SW(u,{abi:e,args:t,bytecode:n,...r}){const i=$p({abi:e,args:t,bytecode:n});return Sp(u,{...r,data:i})}async function TW(u){var t;return((t=u.account)==null?void 0:t.type)==="local"?[u.account.address]:(await u.request({method:"eth_accounts"})).map(n=>K4(n))}async function PW(u){return await u.request({method:"wallet_getPermissions"})}async function OW(u){return(await u.request({method:"eth_requestAccounts"})).map(t=>a0(t))}async function IW(u,e){return u.request({method:"wallet_requestPermissions",params:[e]})}async function zW(u,{account:e=u.account,message:t}){if(!e)throw new Ma({docsPath:"/docs/actions/wallet/signMessage"});const n=Ye(e);if(n.type==="local")return n.signMessage({message:t});const r=typeof t=="string"?L4(t):t.raw instanceof Uint8Array?ju(t.raw):t.raw;return u.request({method:"personal_sign",params:[r,n.address]})}async function jW(u,e){var l,c,E,d;const{account:t=u.account,chain:n=u.chain,...r}=e;if(!t)throw new Ma({docsPath:"/docs/actions/wallet/signTransaction"});const i=Ye(t);La({account:i,...e});const a=await Du(u,F4,"getChainId")({});n!==null&&kp({currentChainId:a,chain:n});const o=(n==null?void 0:n.formatters)||((l=u.chain)==null?void 0:l.formatters),s=((c=o==null?void 0:o.transactionRequest)==null?void 0:c.format)||Wr;return i.type==="local"?i.signTransaction({...r,chainId:a},{serializer:(d=(E=u.chain)==null?void 0:E.serializers)==null?void 0:d.transaction}):await u.request({method:"eth_signTransaction",params:[{...s(r),chainId:vu(a),from:i.address}]})}async function RW(u,{account:e=u.account,domain:t,message:n,primaryType:r,types:i}){if(!e)throw new Ma({docsPath:"/docs/actions/wallet/signTypedData"});const a=Ye(e),o={EIP712Domain:BE({domain:t}),...i};if(Np({domain:t,message:n,primaryType:r,types:o}),a.type==="local")return a.signTypedData({domain:t,primaryType:r,types:o,message:n});const s=z0({domain:t??{},primaryType:r,types:o,message:n},(l,c)=>zu(c)?c.toLowerCase():c);return u.request({method:"eth_signTypedData_v4",params:[a.address,s]})}async function NW(u,{id:e}){await u.request({method:"wallet_switchEthereumChain",params:[{chainId:vu(e)}]})}async function $W(u,e){return await u.request({method:"wallet_watchAsset",params:e})}function SD(u){return{addChain:e=>FM(u,e),deployContract:e=>SW(u,e),getAddresses:()=>TW(u),getChainId:()=>F4(u),getPermissions:()=>PW(u),prepareTransactionRequest:e=>pE(u,e),requestAddresses:()=>OW(u),requestPermissions:e=>IW(u,e),sendRawTransaction:e=>_p(u,e),sendTransaction:e=>Sp(u,e),signMessage:e=>zW(u,e),signTransaction:e=>jW(u,e),signTypedData:e=>RW(u,e),switchChain:e=>NW(u,e),watchAsset:e=>$W(u,e),writeContract:e=>$y(u,e)}}function Ka(u){const{key:e="wallet",name:t="Wallet Client",transport:n}=u;return mE({...u,key:e,name:t,transport:i=>n({...i,retryCount:0}),type:"walletClient"}).extend(SD)}function TD(u,e={}){const{key:t="webSocket",name:n="WebSocket JSON-RPC",retryDelay:r}=e;return({chain:i,retryCount:a,timeout:o})=>{var E;const s=e.retryCount??a,l=o??e.timeout??1e4,c=u||((E=i==null?void 0:i.rpcUrls.default.webSocket)==null?void 0:E[0]);if(!c)throw new Tp;return Y4({key:t,name:n,async request({method:d,params:f}){const p={method:d,params:f},C=await F9(c),{error:v,result:A}=await qi.webSocketAsync(C,{body:p,timeout:l});if(v)throw new EE({body:p,error:v,url:c});return A},retryCount:s,retryDelay:r,timeout:l,type:"webSocket"},{getSocket(){return F9(c)},async subscribe({params:d,onData:f,onError:p}){const C=await F9(c),{result:v}=await new Promise((A,m)=>qi.webSocket(C,{body:{method:"eth_subscribe",params:d},onResponse(g){if(g.error){m(g.error),p==null||p(g.error);return}if(typeof g.id=="number"){A(g);return}g.method==="eth_subscription"&&f(g.params)}}));return{subscriptionId:v,async unsubscribe(){return new Promise(A=>qi.webSocket(C,{body:{method:"eth_unsubscribe",params:[v]},onResponse:A}))}}}})}}const MW="0x0000000000000000000000000000000000000000",LW=2n**(8n-1n)-1n,WW=2n**(16n-1n)-1n,UW=2n**(24n-1n)-1n,qW=2n**(32n-1n)-1n,HW=2n**(40n-1n)-1n,KW=2n**(48n-1n)-1n,VW=2n**(56n-1n)-1n,GW=2n**(64n-1n)-1n,QW=2n**(72n-1n)-1n,XW=2n**(80n-1n)-1n,YW=2n**(88n-1n)-1n,ZW=2n**(96n-1n)-1n,JW=2n**(104n-1n)-1n,uU=2n**(112n-1n)-1n,eU=2n**(120n-1n)-1n,tU=2n**(128n-1n)-1n,nU=2n**(136n-1n)-1n,rU=2n**(144n-1n)-1n,iU=2n**(152n-1n)-1n,aU=2n**(160n-1n)-1n,oU=2n**(168n-1n)-1n,sU=2n**(176n-1n)-1n,lU=2n**(184n-1n)-1n,cU=2n**(192n-1n)-1n,EU=2n**(200n-1n)-1n,dU=2n**(208n-1n)-1n,fU=2n**(216n-1n)-1n,pU=2n**(224n-1n)-1n,CU=2n**(232n-1n)-1n,hU=2n**(240n-1n)-1n,mU=2n**(248n-1n)-1n,AU=2n**(256n-1n)-1n,gU=-(2n**(8n-1n)),vU=-(2n**(16n-1n)),BU=-(2n**(24n-1n)),FU=-(2n**(32n-1n)),yU=-(2n**(40n-1n)),DU=-(2n**(48n-1n)),bU=-(2n**(56n-1n)),wU=-(2n**(64n-1n)),xU=-(2n**(72n-1n)),kU=-(2n**(80n-1n)),_U=-(2n**(88n-1n)),SU=-(2n**(96n-1n)),TU=-(2n**(104n-1n)),PU=-(2n**(112n-1n)),OU=-(2n**(120n-1n)),IU=-(2n**(128n-1n)),zU=-(2n**(136n-1n)),jU=-(2n**(144n-1n)),RU=-(2n**(152n-1n)),NU=-(2n**(160n-1n)),$U=-(2n**(168n-1n)),MU=-(2n**(176n-1n)),LU=-(2n**(184n-1n)),WU=-(2n**(192n-1n)),UU=-(2n**(200n-1n)),qU=-(2n**(208n-1n)),HU=-(2n**(216n-1n)),KU=-(2n**(224n-1n)),VU=-(2n**(232n-1n)),GU=-(2n**(240n-1n)),QU=-(2n**(248n-1n)),XU=-(2n**(256n-1n)),YU=2n**8n-1n,ZU=2n**16n-1n,JU=2n**24n-1n,uq=2n**32n-1n,eq=2n**40n-1n,tq=2n**48n-1n,nq=2n**56n-1n,rq=2n**64n-1n,iq=2n**72n-1n,aq=2n**80n-1n,oq=2n**88n-1n,sq=2n**96n-1n,lq=2n**104n-1n,cq=2n**112n-1n,Eq=2n**120n-1n,dq=2n**128n-1n,fq=2n**136n-1n,pq=2n**144n-1n,Cq=2n**152n-1n,hq=2n**160n-1n,mq=2n**168n-1n,Aq=2n**176n-1n,gq=2n**184n-1n,vq=2n**192n-1n,Bq=2n**200n-1n,Fq=2n**208n-1n,yq=2n**216n-1n,Dq=2n**224n-1n,bq=2n**232n-1n,wq=2n**240n-1n,xq=2n**248n-1n,kq=2n**256n-1n,_q="0x0000000000000000000000000000000000000000000000000000000000000000",w9="/docs/contract/decodeDeployData";function Sq({abi:u,bytecode:e,data:t}){if(t===e)return{bytecode:e};const n=u.find(i=>"type"in i&&i.type==="constructor");if(!n)throw new tp({docsPath:w9});if(!("inputs"in n))throw new B4({docsPath:w9});if(!n.inputs||n.inputs.length===0)throw new B4({docsPath:w9});return{args:qr(n.inputs,`0x${t.replace(e,"")}`),bytecode:e}}function Tq({r:u,yParityAndS:e}){const t=en(e),n=t[0]&128?28n:27n,r=t;return n===28n&&(r[0]&=127),{r:u,s:Ae(r),v:n}}function Pq(u,e,t,n){if(typeof u.setBigUint64=="function")return u.setBigUint64(e,t,n);const r=BigInt(32),i=BigInt(4294967295),a=Number(t>>r&i),o=Number(t&i),s=n?4:0,l=n?0:4;u.setUint32(e+s,a,n),u.setUint32(e+l,o,n)}class Oq extends lp{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=h9(this.buffer)}update(e){ia(this);const{view:t,buffer:n,blockLen:r}=this;e=nE(e);const i=e.length;for(let a=0;ar-a&&(this.process(n,0),a=0);for(let E=a;Ec.length)throw new Error("_sha2: outputLen bigger than state");for(let E=0;Eu&e^~u&t,zq=(u,e,t)=>u&e^u&t^e&t,jq=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),dn=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),fn=new Uint32Array(64);class Rq extends Oq{constructor(){super(64,32,8,!1),this.A=dn[0]|0,this.B=dn[1]|0,this.C=dn[2]|0,this.D=dn[3]|0,this.E=dn[4]|0,this.F=dn[5]|0,this.G=dn[6]|0,this.H=dn[7]|0}get(){const{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}process(e,t){for(let E=0;E<16;E++,t+=4)fn[E]=e.getUint32(t,!1);for(let E=16;E<64;E++){const d=fn[E-15],f=fn[E-2],p=At(d,7)^At(d,18)^d>>>3,C=At(f,17)^At(f,19)^f>>>10;fn[E]=C+fn[E-7]+p+fn[E-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:l,H:c}=this;for(let E=0;E<64;E++){const d=At(o,6)^At(o,11)^At(o,25),f=c+d+Iq(o,s,l)+jq[E]+fn[E]|0,C=(At(n,2)^At(n,13)^At(n,22))+zq(n,r,i)|0;c=l,l=s,s=o,o=a+f|0,a=i,i=r,r=n,n=f+C|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(n,r,i,a,o,s,l,c)}roundClean(){fn.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Tl=cy(()=>new Rq);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const O0=BigInt(0),h0=BigInt(1),Er=BigInt(2),Nq=BigInt(3),zd=BigInt(4),X8=BigInt(5),Y8=BigInt(8);BigInt(9);BigInt(16);function P0(u,e){const t=u%e;return t>=O0?t:e+t}function $q(u,e,t){if(t<=O0||e 0");if(t===h0)return O0;let n=h0;for(;e>O0;)e&h0&&(n=n*u%t),u=u*u%t,e>>=h0;return n}function je(u,e,t){let n=u;for(;e-- >O0;)n*=n,n%=t;return n}function jd(u,e){if(u===O0||e<=O0)throw new Error(`invert: expected positive integers, got n=${u} mod=${e}`);let t=P0(u,e),n=e,r=O0,i=h0;for(;t!==O0;){const o=n/t,s=n%t,l=r-i*o;n=t,t=s,r=i,i=l}if(n!==h0)throw new Error("invert: does not exist");return P0(r,e)}function Mq(u){const e=(u-h0)/Er;let t,n,r;for(t=u-h0,n=0;t%Er===O0;t/=Er,n++);for(r=Er;r(n[r]="function",n),e);return Ha(u,t)}function Uq(u,e,t){if(t 0");if(t===O0)return u.ONE;if(t===h0)return e;let n=u.ONE,r=e;for(;t>O0;)t&h0&&(n=u.mul(n,r)),r=u.sqr(r),t>>=h0;return n}function qq(u,e){const t=new Array(e.length),n=e.reduce((i,a,o)=>u.is0(a)?i:(t[o]=i,u.mul(i,a)),u.ONE),r=u.inv(n);return e.reduceRight((i,a,o)=>u.is0(a)?i:(t[o]=u.mul(i,t[o]),u.mul(i,a)),r),t}function OD(u,e){const t=e!==void 0?e:u.toString(2).length,n=Math.ceil(t/8);return{nBitLength:t,nByteLength:n}}function Hq(u,e,t=!1,n={}){if(u<=O0)throw new Error(`Expected Field ORDER > 0, got ${u}`);const{nBitLength:r,nByteLength:i}=OD(u,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const a=Lq(u),o=Object.freeze({ORDER:u,BITS:r,BYTES:i,MASK:Zp(r),ZERO:O0,ONE:h0,create:s=>P0(s,u),isValid:s=>{if(typeof s!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof s}`);return O0<=s&&ss===O0,isOdd:s=>(s&h0)===h0,neg:s=>P0(-s,u),eql:(s,l)=>s===l,sqr:s=>P0(s*s,u),add:(s,l)=>P0(s+l,u),sub:(s,l)=>P0(s-l,u),mul:(s,l)=>P0(s*l,u),pow:(s,l)=>Uq(o,s,l),div:(s,l)=>P0(s*jd(l,u),u),sqrN:s=>s*s,addN:(s,l)=>s+l,subN:(s,l)=>s-l,mulN:(s,l)=>s*l,inv:s=>jd(s,u),sqrt:n.sqrt||(s=>a(o,s)),invertBatch:s=>qq(o,s),cmov:(s,l,c)=>c?l:s,toBytes:s=>t?Yp(s,i):Hn(s,i),fromBytes:s=>{if(s.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${s.length}`);return t?Xp(s):re(s)}});return Object.freeze(o)}function ID(u){if(typeof u!="bigint")throw new Error("field order must be bigint");const e=u.toString(2).length;return Math.ceil(e/8)}function zD(u){const e=ID(u);return e+Math.ceil(e/2)}function Kq(u,e,t=!1){const n=u.length,r=ID(e),i=zD(e);if(n<16||n1024)throw new Error(`expected ${i}-1024 bytes of input, got ${n}`);const a=t?re(u):Xp(u),o=P0(a,e-h0)+h0;return t?Yp(o,r):Hn(o,r)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Vq=BigInt(0),x9=BigInt(1);function Gq(u,e){const t=(r,i)=>{const a=i.negate();return r?a:i},n=r=>{const i=Math.ceil(e/r)+1,a=2**(r-1);return{windows:i,windowSize:a}};return{constTimeNegate:t,unsafeLadder(r,i){let a=u.ZERO,o=r;for(;i>Vq;)i&x9&&(a=a.add(o)),o=o.double(),i>>=x9;return a},precomputeWindow(r,i){const{windows:a,windowSize:o}=n(i),s=[];let l=r,c=l;for(let E=0;E>=f,v>s&&(v-=d,a+=x9);const A=C,m=C+Math.abs(v)-1,g=p%2!==0,B=v<0;v===0?c=c.add(t(g,i[A])):l=l.add(t(B,i[m]))}return{p:l,f:c}},wNAFCached(r,i,a,o){const s=r._WINDOW_SIZE||1;let l=i.get(r);return l||(l=this.precomputeWindow(r,s),s!==1&&i.set(r,o(l))),this.wNAF(s,l,a)}}}function jD(u){return PD(u.Fp),Ha(u,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...OD(u.n,u.nBitLength),...u,p:u.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Qq(u){const e=jD(u);Ha(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:n,a:r}=e;if(t){if(!n.eql(r,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:Xq,hexToBytes:Yq}=HL,Ar={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(u){const{Err:e}=Ar;if(u.length<2||u[0]!==2)throw new e("Invalid signature integer tag");const t=u[1],n=u.subarray(2,t+2);if(!t||n.length!==t)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:Xq(n),l:u.subarray(t+2)}},toSig(u){const{Err:e}=Ar,t=typeof u=="string"?Yq(u):u;if(!(t instanceof Uint8Array))throw new Error("ui8a expected");let n=t.length;if(n<2||t[0]!=48)throw new e("Invalid signature tag");if(t[1]!==n-2)throw new e("Invalid signature: incorrect length");const{d:r,l:i}=Ar._parseInt(t.subarray(2)),{d:a,l:o}=Ar._parseInt(i);if(o.length)throw new e("Invalid signature: left bytes after parsing");return{r,s:a}},hexFromSig(u){const e=l=>Number.parseInt(l[0],16)&8?"00"+l:l,t=l=>{const c=l.toString(16);return c.length&1?`0${c}`:c},n=e(t(u.s)),r=e(t(u.r)),i=n.length/2,a=r.length/2,o=t(i),s=t(a);return`30${t(a+i+4)}02${s}${r}02${o}${n}`}},at=BigInt(0),E0=BigInt(1),pn=BigInt(2),Pl=BigInt(3),Z8=BigInt(4);function Zq(u){const e=Qq(u),{Fp:t}=e,n=e.toBytes||((p,C,v)=>{const A=C.toAffine();return ye(Uint8Array.from([4]),t.toBytes(A.x),t.toBytes(A.y))}),r=e.fromBytes||(p=>{const C=p.subarray(1),v=t.fromBytes(C.subarray(0,t.BYTES)),A=t.fromBytes(C.subarray(t.BYTES,2*t.BYTES));return{x:v,y:A}});function i(p){const{a:C,b:v}=e,A=t.sqr(p),m=t.mul(A,p);return t.add(t.add(m,t.mul(p,C)),v)}if(!t.eql(t.sqr(e.Gy),i(e.Gx)))throw new Error("bad generator point: equation left != right");function a(p){return typeof p=="bigint"&&att.eql(g,t.ZERO);return m(v)&&m(A)?E.ZERO:new E(v,A,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(C){const v=t.invertBatch(C.map(A=>A.pz));return C.map((A,m)=>A.toAffine(v[m])).map(E.fromAffine)}static fromHex(C){const v=E.fromAffine(r(Q0("pointHex",C)));return v.assertValidity(),v}static fromPrivateKey(C){return E.BASE.multiply(s(C))}_setWindowSize(C){this._WINDOW_SIZE=C,l.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!t.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:C,y:v}=this.toAffine();if(!t.isValid(C)||!t.isValid(v))throw new Error("bad point: x or y not FE");const A=t.sqr(v),m=i(C);if(!t.eql(A,m))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:C}=this.toAffine();if(t.isOdd)return!t.isOdd(C);throw new Error("Field doesn't support isOdd")}equals(C){c(C);const{px:v,py:A,pz:m}=this,{px:g,py:B,pz:D}=C,F=t.eql(t.mul(v,D),t.mul(g,m)),h=t.eql(t.mul(A,D),t.mul(B,m));return F&&h}negate(){return new E(this.px,t.neg(this.py),this.pz)}double(){const{a:C,b:v}=e,A=t.mul(v,Pl),{px:m,py:g,pz:B}=this;let D=t.ZERO,F=t.ZERO,h=t.ZERO,b=t.mul(m,m),T=t.mul(g,g),k=t.mul(B,B),L=t.mul(m,g);return L=t.add(L,L),h=t.mul(m,B),h=t.add(h,h),D=t.mul(C,h),F=t.mul(A,k),F=t.add(D,F),D=t.sub(T,F),F=t.add(T,F),F=t.mul(D,F),D=t.mul(L,D),h=t.mul(A,h),k=t.mul(C,k),L=t.sub(b,k),L=t.mul(C,L),L=t.add(L,h),h=t.add(b,b),b=t.add(h,b),b=t.add(b,k),b=t.mul(b,L),F=t.add(F,b),k=t.mul(g,B),k=t.add(k,k),b=t.mul(k,L),D=t.sub(D,b),h=t.mul(k,T),h=t.add(h,h),h=t.add(h,h),new E(D,F,h)}add(C){c(C);const{px:v,py:A,pz:m}=this,{px:g,py:B,pz:D}=C;let F=t.ZERO,h=t.ZERO,b=t.ZERO;const T=e.a,k=t.mul(e.b,Pl);let L=t.mul(v,g),Q=t.mul(A,B),Z=t.mul(m,D),tu=t.add(v,A),q=t.add(g,B);tu=t.mul(tu,q),q=t.add(L,Q),tu=t.sub(tu,q),q=t.add(v,m);let V=t.add(g,D);return q=t.mul(q,V),V=t.add(L,Z),q=t.sub(q,V),V=t.add(A,m),F=t.add(B,D),V=t.mul(V,F),F=t.add(Q,Z),V=t.sub(V,F),b=t.mul(T,q),F=t.mul(k,Z),b=t.add(F,b),F=t.sub(Q,b),b=t.add(Q,b),h=t.mul(F,b),Q=t.add(L,L),Q=t.add(Q,L),Z=t.mul(T,Z),q=t.mul(k,q),Q=t.add(Q,Z),Z=t.sub(L,Z),Z=t.mul(T,Z),q=t.add(q,Z),L=t.mul(Q,q),h=t.add(h,L),L=t.mul(V,q),F=t.mul(tu,F),F=t.sub(F,L),L=t.mul(tu,Q),b=t.mul(V,b),b=t.add(b,L),new E(F,h,b)}subtract(C){return this.add(C.negate())}is0(){return this.equals(E.ZERO)}wNAF(C){return f.wNAFCached(this,l,C,v=>{const A=t.invertBatch(v.map(m=>m.pz));return v.map((m,g)=>m.toAffine(A[g])).map(E.fromAffine)})}multiplyUnsafe(C){const v=E.ZERO;if(C===at)return v;if(o(C),C===E0)return this;const{endo:A}=e;if(!A)return f.unsafeLadder(this,C);let{k1neg:m,k1:g,k2neg:B,k2:D}=A.splitScalar(C),F=v,h=v,b=this;for(;g>at||D>at;)g&E0&&(F=F.add(b)),D&E0&&(h=h.add(b)),b=b.double(),g>>=E0,D>>=E0;return m&&(F=F.negate()),B&&(h=h.negate()),h=new E(t.mul(h.px,A.beta),h.py,h.pz),F.add(h)}multiply(C){o(C);let v=C,A,m;const{endo:g}=e;if(g){const{k1neg:B,k1:D,k2neg:F,k2:h}=g.splitScalar(v);let{p:b,f:T}=this.wNAF(D),{p:k,f:L}=this.wNAF(h);b=f.constTimeNegate(B,b),k=f.constTimeNegate(F,k),k=new E(t.mul(k.px,g.beta),k.py,k.pz),A=b.add(k),m=T.add(L)}else{const{p:B,f:D}=this.wNAF(v);A=B,m=D}return E.normalizeZ([A,m])[0]}multiplyAndAddUnsafe(C,v,A){const m=E.BASE,g=(D,F)=>F===at||F===E0||!D.equals(m)?D.multiplyUnsafe(F):D.multiply(F),B=g(this,v).add(g(C,A));return B.is0()?void 0:B}toAffine(C){const{px:v,py:A,pz:m}=this,g=this.is0();C==null&&(C=g?t.ONE:t.inv(m));const B=t.mul(v,C),D=t.mul(A,C),F=t.mul(m,C);if(g)return{x:t.ZERO,y:t.ZERO};if(!t.eql(F,t.ONE))throw new Error("invZ was invalid");return{x:B,y:D}}isTorsionFree(){const{h:C,isTorsionFree:v}=e;if(C===E0)return!0;if(v)return v(E,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:C,clearCofactor:v}=e;return C===E0?this:v?v(E,this):this.multiplyUnsafe(e.h)}toRawBytes(C=!0){return this.assertValidity(),n(E,this,C)}toHex(C=!0){return va(this.toRawBytes(C))}}E.BASE=new E(e.Gx,e.Gy,t.ONE),E.ZERO=new E(t.ZERO,t.ONE,t.ZERO);const d=e.nBitLength,f=Gq(E,e.endo?Math.ceil(d/2):d);return{CURVE:e,ProjectivePoint:E,normPrivateKeyToScalar:s,weierstrassEquation:i,isWithinCurveOrder:a}}function Jq(u){const e=jD(u);return Ha(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function uH(u){const e=Jq(u),{Fp:t,n}=e,r=t.BYTES+1,i=2*t.BYTES+1;function a(q){return atva(Hn(q,e.nByteLength));function p(q){const V=n>>E0;return q>V}function C(q){return p(q)?o(-q):q}const v=(q,V,G)=>re(q.slice(V,G));class A{constructor(V,G,W){this.r=V,this.s=G,this.recovery=W,this.assertValidity()}static fromCompact(V){const G=e.nByteLength;return V=Q0("compactSignature",V,G*2),new A(v(V,0,G),v(V,G,2*G))}static fromDER(V){const{r:G,s:W}=Ar.toSig(Q0("DER",V));return new A(G,W)}assertValidity(){if(!d(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!d(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(V){return new A(this.r,this.s,V)}recoverPublicKey(V){const{r:G,s:W,recovery:M}=this,j=h(Q0("msgHash",V));if(M==null||![0,1,2,3].includes(M))throw new Error("recovery id invalid");const Y=M===2||M===3?G+e.n:G;if(Y>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const uu=M&1?"03":"02",J=l.fromHex(uu+f(Y)),U=s(Y),fu=o(-j*U),gu=o(W*U),yu=l.BASE.multiplyAndAddUnsafe(J,fu,gu);if(!yu)throw new Error("point at infinify");return yu.assertValidity(),yu}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new A(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return Ba(this.toDERHex())}toDERHex(){return Ar.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Ba(this.toCompactHex())}toCompactHex(){return f(this.r)+f(this.s)}}const m={isValidPrivateKey(q){try{return c(q),!0}catch{return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const q=zD(e.n);return Kq(e.randomBytes(q),e.n)},precompute(q=8,V=l.BASE){return V._setWindowSize(q),V.multiply(BigInt(3)),V}};function g(q,V=!0){return l.fromPrivateKey(q).toRawBytes(V)}function B(q){const V=q instanceof Uint8Array,G=typeof q=="string",W=(V||G)&&q.length;return V?W===r||W===i:G?W===2*r||W===2*i:q instanceof l}function D(q,V,G=!0){if(B(q))throw new Error("first arg must be private key");if(!B(V))throw new Error("second arg must be public key");return l.fromHex(V).multiply(c(q)).toRawBytes(G)}const F=e.bits2int||function(q){const V=re(q),G=q.length*8-e.nBitLength;return G>0?V>>BigInt(G):V},h=e.bits2int_modN||function(q){return o(F(q))},b=Zp(e.nBitLength);function T(q){if(typeof q!="bigint")throw new Error("bigint expected");if(!(at<=q&&qhu in G))throw new Error("sign() legacy options not supported");const{hash:W,randomBytes:M}=e;let{lowS:j,prehash:Y,extraEntropy:uu}=G;j==null&&(j=!0),q=Q0("msgHash",q),Y&&(q=Q0("prehashed msgHash",W(q)));const J=h(q),U=c(V),fu=[T(U),T(J)];if(uu!=null){const hu=uu===!0?M(t.BYTES):uu;fu.push(Q0("extraEntropy",hu))}const gu=ye(...fu),yu=J;function Bu(hu){const x=F(hu);if(!d(x))return;const _=s(x),S=l.BASE.multiply(x).toAffine(),z=o(S.x);if(z===at)return;const O=o(_*o(yu+z*U));if(O===at)return;let $=(S.x===z?0:2)|Number(S.y&E0),H=O;return j&&p(O)&&(H=C(O),$^=1),new A(z,H,$)}return{seed:gu,k2sig:Bu}}const L={lowS:e.lowS,prehash:!1},Q={lowS:e.lowS,prehash:!1};function Z(q,V,G=L){const{seed:W,k2sig:M}=k(q,V,G),j=e;return bD(j.hash.outputLen,j.nByteLength,j.hmac)(W,M)}l.BASE._setWindowSize(8);function tu(q,V,G,W=Q){var S;const M=q;if(V=Q0("msgHash",V),G=Q0("publicKey",G),"strict"in W)throw new Error("options.strict was renamed to lowS");const{lowS:j,prehash:Y}=W;let uu,J;try{if(typeof M=="string"||M instanceof Uint8Array)try{uu=A.fromDER(M)}catch(z){if(!(z instanceof Ar.Err))throw z;uu=A.fromCompact(M)}else if(typeof M=="object"&&typeof M.r=="bigint"&&typeof M.s=="bigint"){const{r:z,s:O}=M;uu=new A(z,O)}else throw new Error("PARSE");J=l.fromHex(G)}catch(z){if(z.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(j&&uu.hasHighS())return!1;Y&&(V=e.hash(V));const{r:U,s:fu}=uu,gu=h(V),yu=s(fu),Bu=o(gu*yu),hu=o(U*yu),x=(S=l.BASE.multiplyAndAddUnsafe(J,Bu,hu))==null?void 0:S.toAffine();return x?o(x.x)===U:!1}return{CURVE:e,getPublicKey:g,getSharedSecret:D,sign:Z,verify:tu,ProjectivePoint:l,Signature:A,utils:m}}function eH(u,e){const t=u.ORDER;let n=at;for(let p=t-E0;p%pn===at;p/=pn)n+=E0;const r=n,i=pn<{let v=E,A=u.pow(C,l),m=u.sqr(A);m=u.mul(m,C);let g=u.mul(p,m);g=u.pow(g,s),g=u.mul(g,A),A=u.mul(g,C),m=u.mul(g,p);let B=u.mul(m,A);g=u.pow(B,c);let D=u.eql(g,u.ONE);A=u.mul(m,d),g=u.mul(B,v),m=u.cmov(A,m,D),B=u.cmov(g,B,D);for(let F=r;F>E0;F--){let h=F-pn;h=pn<{let m=u.sqr(A);const g=u.mul(v,A);m=u.mul(m,g);let B=u.pow(m,p);B=u.mul(B,g);const D=u.mul(B,C),F=u.mul(u.sqr(B),A),h=u.eql(F,v);let b=u.cmov(D,B,h);return{isValid:h,value:b}}}return f}function tH(u,e){if(PD(u),!u.isValid(e.A)||!u.isValid(e.B)||!u.isValid(e.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const t=eH(u,e.Z);if(!u.isOdd)throw new Error("Fp.isOdd is not implemented!");return n=>{let r,i,a,o,s,l,c,E;r=u.sqr(n),r=u.mul(r,e.Z),i=u.sqr(r),i=u.add(i,r),a=u.add(i,u.ONE),a=u.mul(a,e.B),o=u.cmov(e.Z,u.neg(i),!u.eql(i,u.ZERO)),o=u.mul(o,e.A),i=u.sqr(a),l=u.sqr(o),s=u.mul(l,e.A),i=u.add(i,s),i=u.mul(i,a),l=u.mul(l,o),s=u.mul(l,e.B),i=u.add(i,s),c=u.mul(r,a);const{isValid:d,value:f}=t(i,l);E=u.mul(r,n),E=u.mul(E,f),c=u.cmov(c,a,d),E=u.cmov(E,f,d);const p=u.isOdd(n)===u.isOdd(E);return E=u.cmov(u.neg(E),E,p),c=u.div(c,o),{x:c,y:E}}}function nH(u){if(u instanceof Uint8Array)return u;if(typeof u=="string")return DE(u);throw new Error("DST must be Uint8Array or string")}const rH=re;function vn(u,e){if(u<0||u>=1<<8*e)throw new Error(`bad I2OSP call: value=${u} length=${e}`);const t=Array.from({length:e}).fill(0);for(let n=e-1;n>=0;n--)t[n]=u&255,u>>>=8;return new Uint8Array(t)}function iH(u,e){const t=new Uint8Array(u.length);for(let n=0;n255&&(e=n(ye(DE("H2C-OVERSIZE-DST-"),e)));const{outputLen:r,blockLen:i}=n,a=Math.ceil(t/r);if(a>255)throw new Error("Invalid xmd length");const o=ye(e,vn(e.length,1)),s=vn(0,i),l=vn(t,2),c=new Array(a),E=n(ye(s,u,l,vn(0,1),o));c[0]=n(ye(E,vn(1,1),o));for(let f=1;f<=a;f++){const p=[iH(E,c[f-1]),vn(f+1,1),o];c[f]=n(ye(...p))}return ye(...c).slice(0,t)}function oH(u,e,t,n,r){if(y4(u),y4(e),Jp(t),e.length>255){const i=Math.ceil(2*n/8);e=r.create({dkLen:i}).update(DE("H2C-OVERSIZE-DST-")).update(e).digest()}if(t>65535||e.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return r.create({dkLen:t}).update(u).update(vn(t,2)).update(e).update(vn(e.length,1)).digest()}function J8(u,e,t){Ha(t,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:n,k:r,m:i,hash:a,expand:o,DST:s}=t;y4(u),Jp(e);const l=nH(s),c=n.toString(2).length,E=Math.ceil((c+r)/8),d=e*i*E;let f;if(o==="xmd")f=aH(u,l,d,a);else if(o==="xof")f=oH(u,l,d,r,a);else if(o==="_internal_pass")f=u;else throw new Error('expand must be "xmd" or "xof"');const p=new Array(e);for(let C=0;CArray.from(n).reverse());return(n,r)=>{const[i,a,o,s]=t.map(l=>l.reduce((c,E)=>u.add(u.mul(c,n),E)));return n=u.div(i,a),r=u.mul(r,u.div(o,s)),{x:n,y:r}}}function lH(u,e,t){if(typeof e!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(n,r){const i=J8(n,2,{...t,DST:t.DST,...r}),a=u.fromAffine(e(i[0])),o=u.fromAffine(e(i[1])),s=a.add(o).clearCofactor();return s.assertValidity(),s},encodeToCurve(n,r){const i=J8(n,1,{...t,DST:t.encodeDST,...r}),a=u.fromAffine(e(i[0])).clearCofactor();return a.assertValidity(),a}}}let RD=class extends lp{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,p$(e);const n=nE(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?e.create().update(n).digest():n);for(let a=0;anew RD(u,e).update(t).digest();ND.create=(u,e)=>new RD(u,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function cH(u){return{hash:u,hmac:(e,...t)=>ND(u,e,D$(...t)),randomBytes:Ey}}function EH(u,e){const t=n=>uH({...u,...cH(n)});return Object.freeze({...t(e),create:t})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const bE=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Ol=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),$D=BigInt(1),Il=BigInt(2),um=(u,e)=>(u+e/Il)/e;function MD(u){const e=bE,t=BigInt(3),n=BigInt(6),r=BigInt(11),i=BigInt(22),a=BigInt(23),o=BigInt(44),s=BigInt(88),l=u*u*u%e,c=l*l*u%e,E=je(c,t,e)*c%e,d=je(E,t,e)*c%e,f=je(d,Il,e)*l%e,p=je(f,r,e)*f%e,C=je(p,i,e)*p%e,v=je(C,o,e)*C%e,A=je(v,s,e)*v%e,m=je(A,o,e)*C%e,g=je(m,t,e)*c%e,B=je(g,a,e)*p%e,D=je(B,n,e)*l%e,F=je(D,Il,e);if(!Kn.eql(Kn.sqr(F),u))throw new Error("Cannot find square root");return F}const Kn=Hq(bE,void 0,void 0,{sqrt:MD}),on=EH({a:BigInt(0),b:BigInt(7),Fp:Kn,n:Ol,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:u=>{const e=Ol,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-$D*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),r=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=t,a=BigInt("0x100000000000000000000000000000000"),o=um(i*u,e),s=um(-n*u,e);let l=P0(u-o*t-s*r,e),c=P0(-o*n-s*i,e);const E=l>a,d=c>a;if(E&&(l=e-l),d&&(c=e-c),l>a||c>a)throw new Error("splitScalar: Endomorphism failed, k="+u);return{k1neg:E,k1:l,k2neg:d,k2:c}}}},Tl),wE=BigInt(0),LD=u=>typeof u=="bigint"&&wEtypeof u=="bigint"&&wEr.charCodeAt(0)));t=ye(n,n),em[u]=t}return Tl(ye(t,...e))}const u5=u=>u.toRawBytes(!0).slice(1),Rd=u=>Hn(u,32),k9=u=>P0(u,bE),D4=u=>P0(u,Ol),e5=on.ProjectivePoint,fH=(u,e,t)=>e5.BASE.multiplyAndAddUnsafe(u,e,t);function Nd(u){let e=on.utils.normPrivateKeyToScalar(u),t=e5.fromPrivateKey(e);return{scalar:t.hasEvenY()?e:D4(-e),bytes:u5(t)}}function WD(u){if(!LD(u))throw new Error("bad x: need 0 < x < p");const e=k9(u*u),t=k9(e*u+BigInt(7));let n=MD(t);n%Il!==wE&&(n=k9(-n));const r=new e5(u,n,$D);return r.assertValidity(),r}function UD(...u){return D4(re(zl("BIP0340/challenge",...u)))}function pH(u){return Nd(u).bytes}function CH(u,e,t=Ey(32)){const n=Q0("message",u),{bytes:r,scalar:i}=Nd(e),a=Q0("auxRand",t,32),o=Rd(i^re(zl("BIP0340/aux",a))),s=zl("BIP0340/nonce",o,r,n),l=D4(re(s));if(l===wE)throw new Error("sign failed: k is zero");const{bytes:c,scalar:E}=Nd(l),d=UD(c,r,n),f=new Uint8Array(64);if(f.set(c,0),f.set(Rd(D4(E+d*i)),32),!qD(f,n,r))throw new Error("sign: Invalid signature produced");return f}function qD(u,e,t){const n=Q0("signature",u,64),r=Q0("message",e),i=Q0("publicKey",t,32);try{const a=WD(re(i)),o=re(n.subarray(0,32));if(!LD(o))return!1;const s=re(n.subarray(32,64));if(!dH(s))return!1;const l=UD(Rd(o),u5(a),r),c=fH(a,s,D4(-l));return!(!c||!c.hasEvenY()||c.toAffine().x!==o)}catch{return!1}}const hH={getPublicKey:pH,sign:CH,verify:qD,utils:{randomPrivateKey:on.utils.randomPrivateKey,lift_x:WD,pointToBytes:u5,numberToBytesBE:Hn,bytesToNumberBE:re,taggedHash:zl,mod:P0}},mH=sH(Kn,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(u=>u.map(e=>BigInt(e)))),AH=tH(Kn,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:Kn.create(BigInt("-11"))}),HD=lH(on.ProjectivePoint,u=>{const{x:e,y:t}=AH(Kn.create(u[0]));return mH(e,t)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:Kn.ORDER,m:1,k:128,expand:"xmd",hash:Tl}),gH=HD.hashToCurve,vH=HD.encodeToCurve,BH=Object.freeze(Object.defineProperty({__proto__:null,encodeToCurve:vH,hashToCurve:gH,schnorr:hH,secp256k1:on},Symbol.toStringTag,{value:"Module"}));function FH(u){const{r:e,s:t}=on.Signature.fromCompact(u.slice(2,130));return{r:vu(e,{size:32}),yParityAndS:vu(t,{size:32})}}function yH(u){const{r:e,s:t}=on.Signature.fromCompact(u.slice(2,130)),n=BigInt(`0x${u.slice(130)}`);return{r:vu(e,{size:32}),s:vu(t,{size:32}),v:n}}function DH(u){const{r:e,s:t,v:n}=u,r=n-27n;let i=t;if(r===1n){const a=en(t);a[0]|=128,i=Ae(a)}return{r:e,yParityAndS:i}}function bH({r:u,yParityAndS:e}){return`0x${new on.Signature(Hu(u),Hu(e)).toCompactHex()}`}function wH({r:u,s:e,v:t}){return`0x${new on.Signature(Hu(u),Hu(e)).toCompactHex()}${ju(t).slice(2)}`}const xH=Object.freeze(Object.defineProperty({__proto__:null,AbiConstructorNotFoundError:tp,AbiConstructorParamsNotFoundError:B4,AbiDecodingDataSizeInvalidError:d$,AbiDecodingDataSizeTooSmallError:tE,AbiDecodingZeroDataError:H4,AbiEncodingArrayLengthMismatchError:QF,AbiEncodingBytesSizeMismatchError:XF,AbiEncodingLengthMismatchError:np,AbiErrorInputsNotFoundError:YF,AbiErrorNotFoundError:yd,AbiErrorSignatureNotFoundError:rp,AbiEventNotFoundError:Dd,AbiEventSignatureEmptyTopicsError:ZF,AbiEventSignatureNotFoundError:JF,AbiFunctionNotFoundError:Pr,AbiFunctionOutputsNotFoundError:ip,AbiFunctionSignatureNotFoundError:uy,BaseError:eu,BaseFeeScalarError:Sy,BlockNotFoundError:Bp,BytesSizeMismatchError:ap,CallExecutionError:gp,ChainDisconnectedError:Aa,ChainDoesNotSupportContract:Cl,ChainMismatchError:FF,ChainNotFoundError:yF,CircularReferenceError:HF,ClientChainNotConfiguredError:Jf,ContractFunctionExecutionError:lE,ContractFunctionRevertedError:xl,ContractFunctionZeroDataError:wy,DataLengthTooLongError:DN,DataLengthTooShortError:bN,DecodeLogDataMismatch:Wn,DecodeLogTopicsMismatch:Ur,Eip1559FeesNotSupportedError:fE,EnsAvatarInvalidNftUriError:pi,EnsAvatarUnsupportedNamespaceError:Hy,EnsAvatarUriResolutionError:gE,EstimateGasExecutionError:_y,ExecutionRevertedError:mr,FeeCapTooHighError:Ln,FeeCapTooLowError:hl,FeeConflictError:vy,FilterTypeNotSupportedError:ay,HttpRequestError:Rn,InsufficientFundsError:vl,IntegerOutOfRangeError:cF,InternalRpcError:Or,IntrinsicGasTooHighError:Bl,IntrinsicGasTooLowError:Fl,InvalidAbiDecodingTypeError:ty,InvalidAbiEncodingTypeError:ey,InvalidAbiItemError:IF,InvalidAbiParameterError:jF,InvalidAbiParametersError:RF,InvalidAbiTypeParameterError:WF,InvalidAddressError:ge,InvalidArrayError:ny,InvalidBytesBooleanError:EF,InvalidChainIdError:Jc,InvalidDefinitionTypeError:ry,InvalidFunctionModifierError:LF,InvalidHexBooleanError:dF,InvalidHexValueError:fF,InvalidInputRpcError:Un,InvalidLegacyVError:hp,InvalidModifierError:MF,InvalidParameterError:NF,InvalidParamsRpcError:la,InvalidParenthesisError:KF,InvalidRequestRpcError:oa,InvalidSerializableTransactionError:By,InvalidSerializedTransactionError:sE,InvalidSerializedTransactionTypeError:Fy,InvalidSignatureError:Oi,InvalidStorageKeySizeError:yy,InvalidStructSignatureError:qF,JsonRpcVersionUnsupportedError:pa,LimitExceededRpcError:fa,MaxFeePerGasTooLowError:Ty,MethodNotFoundRpcError:sa,MethodNotSupportedRpcError:da,NonceMaxValueError:gl,NonceTooHighError:ml,NonceTooLowError:Al,OffsetOutOfBoundsError:wN,ParseRpcError:aa,ProviderDisconnectedError:ma,ProviderRpcError:Hr,RawContractError:cE,ResourceNotFoundRpcError:ca,ResourceUnavailableRpcError:Yt,RpcError:le,RpcRequestError:EE,SizeExceedsPaddingSizeError:Qf,SizeOverflowError:pF,SliceOffsetOutOfBoundsError:Gf,SolidityProtectedKeywordError:$F,SwitchChainError:pt,TimeoutError:kl,TipAboveFeeCapError:ra,TransactionExecutionError:Dy,TransactionNotFoundError:mp,TransactionReceiptNotFoundError:Ap,TransactionRejectedRpcError:Ea,TransactionTypeNotSupportedError:yl,UnauthorizedProviderError:Ca,UnknownNodeError:U4,UnknownRpcError:ky,UnknownSignatureError:UF,UnknownTypeError:zF,UnsupportedPackedAbiType:iy,UnsupportedProviderMethodError:ha,UrlRequiredError:Tp,UserRejectedRequestError:F0,WaitForTransactionReceiptTimeoutError:by,WebSocketRequestError:xy,assertCurrentChain:kp,assertRequest:La,assertTransactionEIP1559:Up,assertTransactionEIP2930:qp,assertTransactionLegacy:Hp,boolToBytes:hF,boolToHex:Qc,bytesToBigInt:Pd,bytesToBigint:Pd,bytesToBool:sD,bytesToHex:Ae,bytesToNumber:lD,bytesToRlp:kH,bytesToString:cD,ccipFetch:zp,checksumAddress:K4,compactSignatureToHex:bH,compactSignatureToSignature:Tq,concat:Ge,concatBytes:bF,concatHex:tn,createClient:mE,createPublicClient:Id,createTestClient:_W,createTransport:Y4,createWalletClient:Ka,custom:qa,decodeAbiParameters:qr,decodeDeployData:Sq,decodeErrorResult:Cp,decodeEventLog:Wa,decodeFunctionData:lL,decodeFunctionResult:Kr,defineBlock:gF,defineChain:Pt,defineTransaction:AF,defineTransactionReceipt:vF,defineTransactionRequest:IN,domainSeparator:sL,encodeAbiParameters:rn,encodeDeployData:$p,encodeErrorResult:cL,encodeEventTopics:$a,encodeFunctionData:an,encodeFunctionResult:dL,encodePacked:fL,etherUnits:up,extractChain:rL,fallback:_d,formatBlock:Zc,formatEther:oE,formatGwei:ne,formatLog:Ve,formatTransaction:W4,formatTransactionReceipt:Zf,formatTransactionRequest:Wr,formatUnits:v4,fromBytes:CL,fromHex:SN,fromRlp:Mp,getAbiItem:Zn,getAddress:a0,getChainContractAddress:Vr,getContract:BM,getContractAddress:pL,getContractError:ga,getCreate2Address:oD,getCreateAddress:aD,getEventSelector:rE,getEventSignature:oy,getFunctionSelector:Na,getFunctionSignature:op,getSerializedTransactionType:AD,getTransactionType:yp,getTypesForEIP712Domain:BE,gweiUnits:ep,hashDomain:Rp,hashMessage:Wp,hashTypedData:jp,hexToBigInt:Hu,hexToBool:Xf,hexToBytes:en,hexToCompactSignature:FH,hexToNumber:Ku,hexToRlp:_H,hexToSignature:yH,hexToString:Xc,http:Wy,isAddress:ae,isAddressEqual:vE,isBytes:Td,isHash:fD,isHex:zu,keccak256:B0,labelhash:qy,maxInt104:JW,maxInt112:uU,maxInt120:eU,maxInt128:tU,maxInt136:nU,maxInt144:rU,maxInt152:iU,maxInt16:WW,maxInt160:aU,maxInt168:oU,maxInt176:sU,maxInt184:lU,maxInt192:cU,maxInt200:EU,maxInt208:dU,maxInt216:fU,maxInt224:pU,maxInt232:CU,maxInt24:UW,maxInt240:hU,maxInt248:mU,maxInt256:AU,maxInt32:qW,maxInt40:HW,maxInt48:KW,maxInt56:VW,maxInt64:GW,maxInt72:QW,maxInt8:LW,maxInt80:XW,maxInt88:YW,maxInt96:ZW,maxUint104:lq,maxUint112:cq,maxUint120:Eq,maxUint128:dq,maxUint136:fq,maxUint144:pq,maxUint152:Cq,maxUint16:ZU,maxUint160:hq,maxUint168:mq,maxUint176:Aq,maxUint184:gq,maxUint192:vq,maxUint200:Bq,maxUint208:Fq,maxUint216:yq,maxUint224:Dq,maxUint232:bq,maxUint24:JU,maxUint240:wq,maxUint248:xq,maxUint256:kq,maxUint32:uq,maxUint40:eq,maxUint48:tq,maxUint56:nq,maxUint64:rq,maxUint72:iq,maxUint8:YU,maxUint80:aq,maxUint88:oq,maxUint96:sq,minInt104:TU,minInt112:PU,minInt120:OU,minInt128:IU,minInt136:zU,minInt144:jU,minInt152:RU,minInt16:vU,minInt160:NU,minInt168:$U,minInt176:MU,minInt184:LU,minInt192:WU,minInt200:UU,minInt208:qU,minInt216:HU,minInt224:KU,minInt232:VU,minInt24:BU,minInt240:GU,minInt248:QU,minInt256:XU,minInt32:FU,minInt40:yU,minInt48:DU,minInt56:bU,minInt64:wU,minInt72:xU,minInt8:gU,minInt80:kU,minInt88:_U,minInt96:SU,multicall3Abi:_l,namehash:Qo,numberToBytes:mF,numberToHex:vu,offchainLookup:Zy,offchainLookupAbiItem:Ip,offchainLookupSignature:Yy,pad:Et,padBytes:CF,padHex:dt,parseAbi:o$,parseAbiItem:s$,parseAbiParameter:l$,parseAbiParameters:c$,parseEther:_L,parseGwei:SL,parseTransaction:BL,parseUnits:Vp,presignMessagePrefix:CD,publicActions:kD,recoverAddress:Lp,recoverMessageAddress:hD,recoverPublicKey:pD,recoverTypedDataAddress:mD,rpcTransactionType:BF,serializeAccessList:Kp,serializeTransaction:bL,signatureToCompactSignature:DH,signatureToHex:wH,size:m0,slice:t0,sliceBytes:my,sliceHex:Ep,stringToBytes:kt,stringToHex:L4,stringify:z0,testActions:_D,toBytes:ue,toHex:ju,toRlp:Gr,transactionType:Yf,trim:te,validateTypedData:Np,verifyMessage:gL,verifyTypedData:vL,walletActions:SD,webSocket:TD,weiUnits:DF,zeroAddress:MW,zeroHash:_q},Symbol.toStringTag,{value:"Module"}));function Gr(u,e="hex"){const t=KD(u),n=ED(new Uint8Array(t.length));return t.encode(n),e==="hex"?Ae(n.bytes):n.bytes}function kH(u,e="bytes"){return Gr(u,e)}function _H(u,e="hex"){return Gr(u,e)}function KD(u){return Array.isArray(u)?SH(u.map(e=>KD(e))):TH(u)}function SH(u){const e=u.reduce((r,i)=>r+i.length,0),t=VD(e);return{length:e<=55?1+e:1+t+e,encode(r){e<=55?r.pushByte(192+e):(r.pushByte(247+t),t===1?r.pushUint8(e):t===2?r.pushUint16(e):t===3?r.pushUint24(e):r.pushUint32(e));for(const{encode:i}of u)i(r)}}}function TH(u){const e=typeof u=="string"?en(u):u,t=VD(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+t+e.length,encode(r){e.length===1&&e[0]<128?r.pushBytes(e):e.length<=55?(r.pushByte(128+e.length),r.pushBytes(e)):(r.pushByte(183+t),t===1?r.pushUint8(e.length):t===2?r.pushUint16(e.length):t===3?r.pushUint24(e.length):r.pushUint32(e.length),r.pushBytes(e))}}}function VD(u){if(u<2**8)return 1;if(u<2**16)return 2;if(u<2**24)return 3;if(u<2**32)return 4;throw new eu("Length is too large.")}const GD=Pt({id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-goerli.g.alchemy.com/v2"],webSocket:["wss://eth-goerli.g.alchemy.com/v2"]},infura:{http:["https://goerli.infura.io/v3"],webSocket:["wss://goerli.infura.io/ws/v3"]},default:{http:["https://rpc.ankr.com/eth_goerli"]},public:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli.etherscan.io"},default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0x56522D00C410a43BFfDF00a9A569489297385790",blockCreated:8765204},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:6507670}},testnet:!0}),PH=Pt({id:59140,name:"Linea Goerli Testnet",network:"linea-testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"},blockscout:{name:"Blockscout",url:"https://explorer.goerli.linea.build"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:498623}},testnet:!0}),QD=Pt({id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xc0497E381f536Be9ce14B0dD3817cBcAe57d2F62",blockCreated:16966585},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),OH=Pt({id:5001,name:"Mantle Testnet",network:"mantle",nativeCurrency:{decimals:18,name:"MNT",symbol:"MNT"},rpcUrls:{default:{http:["https://rpc.testnet.mantle.xyz"]},public:{http:["https://rpc.testnet.mantle.xyz"]}},blockExplorers:{etherscan:{name:"Mantle Testnet Explorer",url:"https://explorer.testnet.mantle.xyz"},default:{name:"Mantle Testnet Explorer",url:"https://explorer.testnet.mantle.xyz"}},testnet:!0}),IH=Pt({id:1442,name:"Polygon zkEVM Testnet",network:"polygon-zkevm-testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.public.zkevm-test.net"]},public:{http:["https://rpc.public.zkevm-test.net"]}},blockExplorers:{blockscout:{name:"Blockscout",url:"https://explorer.public.zkevm-test.net"},default:{name:"PolygonScan",url:"https://testnet-zkevm.polygonscan.com"}},testnet:!0,contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:525686}}}),zH=Pt({id:534351,name:"Scroll Sepolia",network:"scroll-sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rpc.scroll.io"]},public:{http:["https://sepolia-rpc.scroll.io"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-blockscout.scroll.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:9473}},testnet:!0}),jH=Pt({id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:751532},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0x21B000Fd62a880b2125A61e36a284BB757b76025",blockCreated:3914906}},testnet:!0});var XD=class extends Error{constructor({chainId:u,connectorId:e}){super(`Chain "${u}" not configured for connector "${e}".`),this.name="ChainNotConfiguredForConnectorError"}},We=class extends Error{constructor(){super(...arguments),this.name="ConnectorNotFoundError",this.message="Connector not found"}};function Ir(u){return typeof u=="string"?Number.parseInt(u,u.trim().substring(0,2)==="0x"?16:10):typeof u=="bigint"?Number(u):u}var YD={exports:{}};(function(u){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function r(s,l,c){this.fn=s,this.context=l,this.once=c||!1}function i(s,l,c,E,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var f=new r(c,E||s,d),p=t?t+l:l;return s._events[p]?s._events[p].fn?s._events[p]=[s._events[p],f]:s._events[p].push(f):(s._events[p]=f,s._eventsCount++),s}function a(s,l){--s._eventsCount===0?s._events=new n:delete s._events[l]}function o(){this._events=new n,this._eventsCount=0}o.prototype.eventNames=function(){var l=[],c,E;if(this._eventsCount===0)return l;for(E in c=this._events)e.call(c,E)&&l.push(t?E.slice(1):E);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},o.prototype.listeners=function(l){var c=t?t+l:l,E=this._events[c];if(!E)return[];if(E.fn)return[E.fn];for(var d=0,f=E.length,p=new Array(f);d{if(!e.has(u))throw TypeError("Cannot "+t)},Tu=(u,e,t)=>(t5(u,e,"read from private field"),t?t.call(u):e.get(u)),b0=(u,e,t)=>{if(e.has(u))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(u):e.set(u,t)},Jt=(u,e,t,n)=>(t5(u,e,"write to private field"),n?n.call(u,t):e.set(u,t),t),D0=(u,e,t)=>(t5(u,e,"access private method"),t),Z4=class extends NH{constructor({chains:u=[QD,GD],options:e}){super(),this.chains=u,this.options=e}getBlockExplorerUrls(u){const{default:e,...t}=u.blockExplorers??{};if(e)return[e.url,...Object.values(t).map(n=>n.url)]}isChainUnsupported(u){return!this.chains.some(e=>e.id===u)}setStorage(u){this.storage=u}};function $H(u){var t;if(!u)return"Injected";const e=n=>{if(n.isApexWallet)return"Apex Wallet";if(n.isAvalanche)return"Core Wallet";if(n.isBackpack)return"Backpack";if(n.isBifrost)return"Bifrost Wallet";if(n.isBitKeep)return"BitKeep";if(n.isBitski)return"Bitski";if(n.isBlockWallet)return"BlockWallet";if(n.isBraveWallet)return"Brave Wallet";if(n.isCoin98)return"Coin98 Wallet";if(n.isCoinbaseWallet)return"Coinbase Wallet";if(n.isDawn)return"Dawn Wallet";if(n.isDefiant)return"Defiant";if(n.isDesig)return"Desig Wallet";if(n.isEnkrypt)return"Enkrypt";if(n.isExodus)return"Exodus";if(n.isFordefi)return"Fordefi";if(n.isFrame)return"Frame";if(n.isFrontier)return"Frontier Wallet";if(n.isGamestop)return"GameStop Wallet";if(n.isHaqqWallet)return"HAQQ Wallet";if(n.isHyperPay)return"HyperPay Wallet";if(n.isImToken)return"ImToken";if(n.isHaloWallet)return"Halo Wallet";if(n.isKuCoinWallet)return"KuCoin Wallet";if(n.isMathWallet)return"MathWallet";if(n.isNovaWallet)return"Nova Wallet";if(n.isOkxWallet||n.isOKExWallet)return"OKX Wallet";if(n.isOneInchIOSWallet||n.isOneInchAndroidWallet)return"1inch Wallet";if(n.isOpera)return"Opera";if(n.isPhantom)return"Phantom";if(n.isPortal)return"Ripio Portal";if(n.isRabby)return"Rabby Wallet";if(n.isRainbow)return"Rainbow";if(n.isSafePal)return"SafePal Wallet";if(n.isStatus)return"Status";if(n.isSubWallet)return"SubWallet";if(n.isTalisman)return"Talisman";if(n.isTally)return"Taho";if(n.isTokenPocket)return"TokenPocket";if(n.isTokenary)return"Tokenary";if(n.isTrust||n.isTrustWallet)return"Trust Wallet";if(n.isTTWallet)return"TTWallet";if(n.isXDEFI)return"XDEFI Wallet";if(n.isZeal)return"Zeal";if(n.isZerion)return"Zerion";if(n.isMetaMask)return"MetaMask"};if((t=u.providers)!=null&&t.length){const n=new Set;let r=1;for(const a of u.providers){let o=e(a);o||(o=`Unknown Wallet #${r}`,r+=1),n.add(o)}const i=[...n];return i.length?i:i[0]??"Injected"}return e(u)??"Injected"}var k3,Fa=class extends Z4{constructor({chains:u,options:e}={}){const t={shimDisconnect:!0,getProvider(){if(typeof window>"u")return;const r=window.ethereum;return r!=null&&r.providers&&r.providers.length>0?r.providers[0]:r},...e};super({chains:u,options:t}),this.id="injected",b0(this,k3,void 0),this.shimDisconnectKey=`${this.id}.shimDisconnect`,this.onAccountsChanged=r=>{r.length===0?this.emit("disconnect"):this.emit("change",{account:a0(r[0])})},this.onChainChanged=r=>{const i=Ir(r),a=this.isChainUnsupported(i);this.emit("change",{chain:{id:i,unsupported:a}})},this.onDisconnect=async r=>{var i;r.code===1013&&await this.getProvider()&&await this.getAccount()||(this.emit("disconnect"),this.options.shimDisconnect&&((i=this.storage)==null||i.removeItem(this.shimDisconnectKey)))};const n=t.getProvider();if(typeof t.name=="string")this.name=t.name;else if(n){const r=$H(n);t.name?this.name=t.name(r):typeof r=="string"?this.name=r:this.name=r[0]}else this.name="Injected";this.ready=!!n}async connect({chainId:u}={}){var e;try{const t=await this.getProvider();if(!t)throw new We;t.on&&(t.on("accountsChanged",this.onAccountsChanged),t.on("chainChanged",this.onChainChanged),t.on("disconnect",this.onDisconnect)),this.emit("message",{type:"connecting"});const n=await t.request({method:"eth_requestAccounts"}),r=a0(n[0]);let i=await this.getChainId(),a=this.isChainUnsupported(i);return u&&i!==u&&(i=(await this.switchChain(u)).id,a=this.isChainUnsupported(i)),this.options.shimDisconnect&&((e=this.storage)==null||e.setItem(this.shimDisconnectKey,!0)),{account:r,chain:{id:i,unsupported:a}}}catch(t){throw this.isUserRejectedRequestError(t)?new F0(t):t.code===-32002?new Yt(t):t}}async disconnect(){var e;const u=await this.getProvider();u!=null&&u.removeListener&&(u.removeListener("accountsChanged",this.onAccountsChanged),u.removeListener("chainChanged",this.onChainChanged),u.removeListener("disconnect",this.onDisconnect),this.options.shimDisconnect&&((e=this.storage)==null||e.removeItem(this.shimDisconnectKey)))}async getAccount(){const u=await this.getProvider();if(!u)throw new We;const e=await u.request({method:"eth_accounts"});return a0(e[0])}async getChainId(){const u=await this.getProvider();if(!u)throw new We;return u.request({method:"eth_chainId"}).then(Ir)}async getProvider(){const u=this.options.getProvider();return u&&Jt(this,k3,u),Tu(this,k3)}async getWalletClient({chainId:u}={}){const[e,t]=await Promise.all([this.getProvider(),this.getAccount()]),n=this.chains.find(r=>r.id===u);if(!e)throw new Error("provider is required.");return Ka({account:t,chain:n,transport:qa(e)})}async isAuthorized(){var u;try{if(this.options.shimDisconnect&&!((u=this.storage)!=null&&u.getItem(this.shimDisconnectKey)))return!1;if(!await this.getProvider())throw new We;return!!await this.getAccount()}catch{return!1}}async switchChain(u){var n,r,i;const e=await this.getProvider();if(!e)throw new We;const t=vu(u);try{return await Promise.all([e.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}),new Promise(a=>this.on("change",({chain:o})=>{(o==null?void 0:o.id)===u&&a()}))]),this.chains.find(a=>a.id===u)??{id:u,name:`Chain ${t}`,network:`${t}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}}}catch(a){const o=this.chains.find(s=>s.id===u);if(!o)throw new XD({chainId:u,connectorId:this.id});if(a.code===4902||((r=(n=a==null?void 0:a.data)==null?void 0:n.originalError)==null?void 0:r.code)===4902)try{if(await e.request({method:"wallet_addEthereumChain",params:[{chainId:t,chainName:o.name,nativeCurrency:o.nativeCurrency,rpcUrls:[((i=o.rpcUrls.public)==null?void 0:i.http[0])??""],blockExplorerUrls:this.getBlockExplorerUrls(o)}]}),await this.getChainId()!==u)throw new F0(new Error("User rejected switch after adding network."));return o}catch(s){throw new F0(s)}throw this.isUserRejectedRequestError(a)?new F0(a):new pt(a)}}async watchAsset({address:u,decimals:e=18,image:t,symbol:n}){const r=await this.getProvider();if(!r)throw new We;return r.request({method:"wallet_watchAsset",params:{type:"ERC20",options:{address:u,decimals:e,image:t,symbol:n}}})}isUserRejectedRequestError(u){return u.code===4001}};k3=new WeakMap;var n5=(u,e,t)=>{if(!e.has(u))throw TypeError("Cannot "+t)},_9=(u,e,t)=>(n5(u,e,"read from private field"),t?t.call(u):e.get(u)),S9=(u,e,t)=>{if(e.has(u))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(u):e.set(u,t)},Ys=(u,e,t,n)=>(n5(u,e,"write to private field"),n?n.call(u,t):e.set(u,t),t),MH=(u,e,t)=>(n5(u,e,"access private method"),t),LH={VITE_REACT_APP_PROJECT_ID:"9d80089c30635ff84b5339d993d63fa1",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const WH=u=>(e,t,n)=>{const r=n.subscribe;return n.subscribe=(a,o,s)=>{let l=a;if(o){const c=(s==null?void 0:s.equalityFn)||Object.is;let E=a(n.getState());l=d=>{const f=a(d);if(!c(E,f)){const p=E;o(E=f,p)}},s!=null&&s.fireImmediately&&o(E,E)}return r(l)},u(e,t,n)},UH=WH;function qH(u,e){let t;try{t=u()}catch{return}return{getItem:r=>{var i;const a=s=>s===null?null:JSON.parse(s,e==null?void 0:e.reviver),o=(i=t.getItem(r))!=null?i:null;return o instanceof Promise?o.then(a):a(o)},setItem:(r,i)=>t.setItem(r,JSON.stringify(i,e==null?void 0:e.replacer)),removeItem:r=>t.removeItem(r)}}const b4=u=>e=>{try{const t=u(e);return t instanceof Promise?t:{then(n){return b4(n)(t)},catch(n){return this}}}catch(t){return{then(n){return this},catch(n){return b4(n)(t)}}}},HH=(u,e)=>(t,n,r)=>{let i={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:v=>v,version:0,merge:(v,A)=>({...A,...v}),...e},a=!1;const o=new Set,s=new Set;let l;try{l=i.getStorage()}catch{}if(!l)return u((...v)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),t(...v)},n,r);const c=b4(i.serialize),E=()=>{const v=i.partialize({...n()});let A;const m=c({state:v,version:i.version}).then(g=>l.setItem(i.name,g)).catch(g=>{A=g});if(A)throw A;return m},d=r.setState;r.setState=(v,A)=>{d(v,A),E()};const f=u((...v)=>{t(...v),E()},n,r);let p;const C=()=>{var v;if(!l)return;a=!1,o.forEach(m=>m(n()));const A=((v=i.onRehydrateStorage)==null?void 0:v.call(i,n()))||void 0;return b4(l.getItem.bind(l))(i.name).then(m=>{if(m)return i.deserialize(m)}).then(m=>{if(m)if(typeof m.version=="number"&&m.version!==i.version){if(i.migrate)return i.migrate(m.state,m.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return m.state}).then(m=>{var g;return p=i.merge(m,(g=n())!=null?g:f),t(p,!0),E()}).then(()=>{A==null||A(p,void 0),a=!0,s.forEach(m=>m(p))}).catch(m=>{A==null||A(void 0,m)})};return r.persist={setOptions:v=>{i={...i,...v},v.getStorage&&(l=v.getStorage())},clearStorage:()=>{l==null||l.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>C(),hasHydrated:()=>a,onHydrate:v=>(o.add(v),()=>{o.delete(v)}),onFinishHydration:v=>(s.add(v),()=>{s.delete(v)})},C(),p||f},KH=(u,e)=>(t,n,r)=>{let i={storage:qH(()=>localStorage),partialize:C=>C,version:0,merge:(C,v)=>({...v,...C}),...e},a=!1;const o=new Set,s=new Set;let l=i.storage;if(!l)return u((...C)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),t(...C)},n,r);const c=()=>{const C=i.partialize({...n()});return l.setItem(i.name,{state:C,version:i.version})},E=r.setState;r.setState=(C,v)=>{E(C,v),c()};const d=u((...C)=>{t(...C),c()},n,r);let f;const p=()=>{var C,v;if(!l)return;a=!1,o.forEach(m=>{var g;return m((g=n())!=null?g:d)});const A=((v=i.onRehydrateStorage)==null?void 0:v.call(i,(C=n())!=null?C:d))||void 0;return b4(l.getItem.bind(l))(i.name).then(m=>{if(m)if(typeof m.version=="number"&&m.version!==i.version){if(i.migrate)return i.migrate(m.state,m.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return m.state}).then(m=>{var g;return f=i.merge(m,(g=n())!=null?g:d),t(f,!0),c()}).then(()=>{A==null||A(f,void 0),f=n(),a=!0,s.forEach(m=>m(f))}).catch(m=>{A==null||A(void 0,m)})};return r.persist={setOptions:C=>{i={...i,...C},C.storage&&(l=C.storage)},clearStorage:()=>{l==null||l.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>p(),hasHydrated:()=>a,onHydrate:C=>(o.add(C),()=>{o.delete(C)}),onFinishHydration:C=>(s.add(C),()=>{s.delete(C)})},i.skipHydration||p(),f||d},VH=(u,e)=>"getStorage"in e||"serialize"in e||"deserialize"in e?((LH?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),HH(u,e)):KH(u,e),GH=VH;var QH={VITE_REACT_APP_PROJECT_ID:"9d80089c30635ff84b5339d993d63fa1",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const tm=u=>{let e;const t=new Set,n=(s,l)=>{const c=typeof s=="function"?s(e):s;if(!Object.is(c,e)){const E=e;e=l??(typeof c!="object"||c===null)?c:Object.assign({},e,c),t.forEach(d=>d(e,E))}},r=()=>e,o={setState:n,getState:r,subscribe:s=>(t.add(s),()=>t.delete(s)),destroy:()=>{(QH?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),t.clear()}};return e=u(n,r,o),o},XH=u=>u?tm(u):tm;function ZD(u,e){if(Object.is(u,e))return!0;if(typeof u!="object"||u===null||typeof e!="object"||e===null)return!1;if(u instanceof Map&&e instanceof Map){if(u.size!==e.size)return!1;for(const[n,r]of u)if(!Object.is(r,e.get(n)))return!1;return!0}if(u instanceof Set&&e instanceof Set){if(u.size!==e.size)return!1;for(const n of u)if(!e.has(n))return!1;return!0}const t=Object.keys(u);if(t.length!==Object.keys(e).length)return!1;for(let n=0;nC===E.id)||(s=[...s,p.chain]),l[E.id]=[...l[E.id]||[],...p.rpcUrls.http],p.rpcUrls.webSocket&&(c[E.id]=[...c[E.id]||[],...p.rpcUrls.webSocket]))}if(!d)throw new Error([`Could not find valid provider configuration for chain "${E.name}". +`;function Wp(u,e){const t=typeof u=="string"?kt(u):u.raw instanceof Uint8Array?u.raw:ue(u.raw),n=kt(`${CD}${t.length}`);return B0(Ge([n,t]),e)}async function hD({message:u,signature:e}){return Lp({hash:Wp(u),signature:e})}async function mD({domain:u,message:e,primaryType:t,signature:n,types:r}){return Lp({hash:jp({domain:u,message:e,primaryType:t,types:r}),signature:n})}async function gL({address:u,message:e,signature:t}){return vE(a0(u),await hD({message:e,signature:t}))}async function vL({address:u,domain:e,message:t,primaryType:n,signature:r,types:i}){return vE(a0(u),await mD({domain:e,message:t,primaryType:n,signature:r,types:i}))}function AD(u){const e=Ep(u,0,1);if(e==="0x02")return"eip1559";if(e==="0x01")return"eip2930";if(e!=="0x"&&Ku(e)>=192)return"legacy";throw new Fy({serializedType:e})}function Up(u){const{chainId:e,maxPriorityFeePerGas:t,gasPrice:n,maxFeePerGas:r,to:i}=u;if(e<=0)throw new Jc({chainId:e});if(i&&!ae(i))throw new ge({address:i});if(n)throw new eu("`gasPrice` is not a valid EIP-1559 Transaction attribute.");if(r&&r>2n**256n-1n)throw new Ln({maxFeePerGas:r});if(t&&r&&t>r)throw new ra({maxFeePerGas:r,maxPriorityFeePerGas:t})}function qp(u){const{chainId:e,maxPriorityFeePerGas:t,gasPrice:n,maxFeePerGas:r,to:i}=u;if(e<=0)throw new Jc({chainId:e});if(i&&!ae(i))throw new ge({address:i});if(t||r)throw new eu("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(n&&n>2n**256n-1n)throw new Ln({maxFeePerGas:n})}function Hp(u){const{chainId:e,maxPriorityFeePerGas:t,gasPrice:n,maxFeePerGas:r,to:i,accessList:a}=u;if(i&&!ae(i))throw new ge({address:i});if(typeof e<"u"&&e<=0)throw new Jc({chainId:e});if(t||r)throw new eu("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(n&&n>2n**256n-1n)throw new Ln({maxFeePerGas:n});if(a)throw new eu("`accessList` is not a valid Legacy Transaction attribute.")}function BL(u){const e=AD(u);return e==="eip1559"?FL(u):e==="eip2930"?yL(u):DL(u)}function FL(u){const e=gD(u),[t,n,r,i,a,o,s,l,c,E,d,f]=e;if(!(e.length===9||e.length===12))throw new sE({attributes:{chainId:t,nonce:n,maxPriorityFeePerGas:r,maxFeePerGas:i,gas:a,to:o,value:s,data:l,accessList:c,...e.length>9?{v:E,r:d,s:f}:{}},serializedTransaction:u,type:"eip1559"});const p={chainId:Ku(t),type:"eip1559"};return zu(o)&&o!=="0x"&&(p.to=o),zu(a)&&a!=="0x"&&(p.gas=Hu(a)),zu(l)&&l!=="0x"&&(p.data=l),zu(n)&&n!=="0x"&&(p.nonce=Ku(n)),zu(s)&&s!=="0x"&&(p.value=Hu(s)),zu(i)&&i!=="0x"&&(p.maxFeePerGas=Hu(i)),zu(r)&&r!=="0x"&&(p.maxPriorityFeePerGas=Hu(r)),c.length!==0&&c!=="0x"&&(p.accessList=vD(c)),Up(p),{...e.length===12?BD(e):void 0,...p}}function yL(u){const e=gD(u),[t,n,r,i,a,o,s,l,c,E,d]=e;if(!(e.length===8||e.length===11))throw new sE({attributes:{chainId:t,nonce:n,gasPrice:r,gas:i,to:a,value:o,data:s,accessList:l,...e.length>8?{v:c,r:E,s:d}:{}},serializedTransaction:u,type:"eip2930"});const f={chainId:Ku(t),type:"eip2930"};return zu(a)&&a!=="0x"&&(f.to=a),zu(i)&&i!=="0x"&&(f.gas=Hu(i)),zu(s)&&s!=="0x"&&(f.data=s),zu(n)&&n!=="0x"&&(f.nonce=Ku(n)),zu(o)&&o!=="0x"&&(f.value=Hu(o)),zu(r)&&r!=="0x"&&(f.gasPrice=Hu(r)),l.length!==0&&l!=="0x"&&(f.accessList=vD(l)),qp(f),{...e.length===11?BD(e):void 0,...f}}function DL(u){const e=Mp(u,"hex"),[t,n,r,i,a,o,s,l,c]=e;if(!(e.length===6||e.length===9))throw new sE({attributes:{nonce:t,gasPrice:n,gas:r,to:i,value:a,data:o,...e.length>6?{v:s,r:l,s:c}:{}},serializedTransaction:u,type:"legacy"});const E={type:"legacy"};if(zu(i)&&i!=="0x"&&(E.to=i),zu(r)&&r!=="0x"&&(E.gas=Hu(r)),zu(o)&&o!=="0x"&&(E.data=o),zu(t)&&t!=="0x"&&(E.nonce=Ku(t)),zu(a)&&a!=="0x"&&(E.value=Hu(a)),zu(n)&&n!=="0x"&&(E.gasPrice=Hu(n)),Hp(E),e.length===6)return E;const d=zu(s)&&s!=="0x"?Hu(s):0n;if(c==="0x"&&l==="0x")return d>0&&(E.chainId=Number(d)),E;const f=d,p=Number((f-35n)/2n);if(p>0)E.chainId=p;else if(f!==27n&&f!==28n)throw new hp({v:f});return E.v=f,E.s=c,E.r=l,E}function gD(u){return Mp(`0x${u.slice(4)}`,"hex")}function vD(u){const e=[];for(let t=0;tfD(i)?i:te(i))})}return e}function BD(u){const e=u.slice(-3),t=e[0]==="0x"||Hu(e[0])===0n?27n:28n;return{r:dt(e[1],{size:32}),s:dt(e[2],{size:32}),v:t,yParity:t===27n?0:1}}function Kp(u){if(!u||u.length===0)return[];const e=[];for(let t=0;t{if(t>0)return BigInt(t*2)+BigInt(35n+e.v-27n);if(e.v>=35n)return(e.v-35n)/2n>0?e.v:27n+(e.v===35n?0n:1n);const E=27n+(e.v===27n?0n:1n);if(e.v!==E)throw new hp({v:e.v});return E})();l=[...l,ju(c),e.r,e.s]}else t>0&&(l=[...l,ju(t),"0x","0x"]);return Gr(l)}function Vp(u,e){let[t,n="0"]=u.split(".");const r=t.startsWith("-");if(r&&(t=t.slice(1)),n=n.replace(/(0+)$/,""),e===0)Math.round(+`.${n}`)===1&&(t=`${BigInt(t)+1n}`),n="";else if(n.length>e){const[i,a,o]=[n.slice(0,e-1),n.slice(e-1,e),n.slice(e)],s=Math.round(+`${a}.${o}`);s>9?n=`${BigInt(i)+BigInt(1)}0`.padStart(i.length+1,"0"):n=`${i}${s}`,n.length>e&&(n=n.slice(1),t=`${BigInt(t)+1n}`),n=n.slice(0,e)}else n=n.padEnd(e,"0");return BigInt(`${r?"-":""}${t}${n}`)}function _L(u,e="wei"){return Vp(u,up[e])}function SL(u,e="wei"){return Vp(u,ep[e])}function TL(u){return u.map(e=>({...e,value:BigInt(e.value)}))}function PL(u){return{...u,balance:u.balance?BigInt(u.balance):void 0,nonce:u.nonce?Ku(u.nonce):void 0,storageProof:u.storageProof?TL(u.storageProof):void 0}}async function OL(u,{address:e,blockNumber:t,blockTag:n,storageKeys:r}){const i=n??"latest",a=t!==void 0?vu(t):void 0,o=await u.request({method:"eth_getProof",params:[e,r,a||i]});return PL(o)}async function IL(u,{address:e,blockNumber:t,blockTag:n="latest",slot:r}){const i=t!==void 0?vu(t):void 0;return await u.request({method:"eth_getStorageAt",params:[e,r,i||n]})}async function Gp(u,{blockHash:e,blockNumber:t,blockTag:n,hash:r,index:i}){var c,E,d;const a=n||"latest",o=t!==void 0?vu(t):void 0;let s=null;if(r?s=await u.request({method:"eth_getTransactionByHash",params:[r]}):e?s=await u.request({method:"eth_getTransactionByBlockHashAndIndex",params:[e,vu(i)]}):(o||a)&&(s=await u.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[o||a,vu(i)]})),!s)throw new mp({blockHash:e,blockNumber:t,blockTag:a,hash:r,index:i});return(((d=(E=(c=u.chain)==null?void 0:c.formatters)==null?void 0:E.transaction)==null?void 0:d.format)||W4)(s)}async function zL(u,{hash:e,transactionReceipt:t}){const[n,r]=await Promise.all([Du(u,X4,"getBlockNumber")({}),e?Du(u,Gp,"getBlockNumber")({hash:e}):void 0]),i=(t==null?void 0:t.blockNumber)||(r==null?void 0:r.blockNumber);return i?n-i+1n:0n}async function Od(u,{hash:e}){var r,i,a;const t=await u.request({method:"eth_getTransactionReceipt",params:[e]});if(!t)throw new Ap({hash:e});return(((a=(i=(r=u.chain)==null?void 0:r.formatters)==null?void 0:i.transactionReceipt)==null?void 0:a.format)||Zf)(t)}async function jL(u,e){var C;const{allowFailure:t=!0,batchSize:n,blockNumber:r,blockTag:i,contracts:a,multicallAddress:o}=e,s=n??(typeof((C=u.batch)==null?void 0:C.multicall)=="object"&&u.batch.multicall.batchSize||1024);let l=o;if(!l){if(!u.chain)throw new Error("client chain not configured. multicallAddress is required.");l=Vr({blockNumber:r,chain:u.chain,contract:"multicall3"})}const c=[[]];let E=0,d=0;for(let v=0;v0&&d>s&&c[E].length>0&&(E++,d=(D.length-2)/2,c[E]=[]),c[E]=[...c[E],{allowFailure:!0,callData:D,target:m}]}catch(D){const F=ga(D,{abi:A,address:m,args:g,docsPath:"/docs/contract/multicall",functionName:B});if(!t)throw F;c[E]=[...c[E],{allowFailure:!0,callData:"0x",target:m}]}}const f=await Promise.allSettled(c.map(v=>Du(u,Zt,"readContract")({abi:_l,address:l,args:[v],blockNumber:r,blockTag:i,functionName:"aggregate3"}))),p=[];for(let v=0;vu instanceof Uint8Array,$L=Array.from({length:256},(u,e)=>e.toString(16).padStart(2,"0"));function va(u){if(!yE(u))throw new Error("Uint8Array expected");let e="";for(let t=0;tn+r.length,0));let t=0;return u.forEach(n=>{if(!yE(n))throw new Error("Uint8Array expected");e.set(n,t),t+=n.length}),e}function DD(u,e){if(u.length!==e.length)return!1;for(let t=0;tFD;u>>=FE,e+=1);return e}function WL(u,e){return u>>BigInt(e)&FE}const UL=(u,e,t)=>u|(t?FE:FD)<(NL<new Uint8Array(u),Q8=u=>Uint8Array.from(u);function bD(u,e,t){if(typeof u!="number"||u<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let n=b9(u),r=b9(u),i=0;const a=()=>{n.fill(1),r.fill(0),i=0},o=(...E)=>t(r,n,...E),s=(E=b9())=>{r=o(Q8([0]),E),n=o(),E.length!==0&&(r=o(Q8([1]),E),n=o())},l=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let E=0;const d=[];for(;E{a(),s(E);let f;for(;!(f=d(l()));)s();return a(),f}}const qL={bigint:u=>typeof u=="bigint",function:u=>typeof u=="function",boolean:u=>typeof u=="boolean",string:u=>typeof u=="string",stringOrUint8Array:u=>typeof u=="string"||u instanceof Uint8Array,isSafeInteger:u=>Number.isSafeInteger(u),array:u=>Array.isArray(u),field:(u,e)=>e.Fp.isValid(u),hash:u=>typeof u=="function"&&Number.isSafeInteger(u.outputLen)};function Ha(u,e,t={}){const n=(r,i,a)=>{const o=qL[i];if(typeof o!="function")throw new Error(`Invalid validator "${i}", expected function`);const s=u[r];if(!(a&&s===void 0)&&!o(s,u))throw new Error(`Invalid param ${String(r)}=${s} (${typeof s}), expected ${i}`)};for(const[r,i]of Object.entries(e))n(r,i,!1);for(const[r,i]of Object.entries(t))n(r,i,!0);return u}const HL=Object.freeze(Object.defineProperty({__proto__:null,bitGet:WL,bitLen:LL,bitMask:Zp,bitSet:UL,bytesToHex:va,bytesToNumberBE:re,bytesToNumberLE:Xp,concatBytes:ye,createHmacDrbg:bD,ensureBytes:Q0,equalBytes:DD,hexToBytes:Ba,hexToNumber:Qp,numberToBytesBE:Hn,numberToBytesLE:Yp,numberToHexUnpadded:yD,numberToVarBytesBE:ML,utf8ToBytes:DE,validateObject:Ha},Symbol.toStringTag,{value:"Module"}));function KL(u,e){const t=zu(u)?ue(u):u,n=zu(e)?ue(e):e;return DD(t,n)}async function wD(u,{address:e,hash:t,signature:n,...r}){const i=zu(n)?n:ju(n);try{const{data:a}=await Du(u,G4,"call")({data:$p({abi:sM,args:[e,t,i],bytecode:RL}),...r});return KL(a??"0x0","0x1")}catch(a){if(a instanceof gp)return!1;throw a}}async function VL(u,{address:e,message:t,signature:n,...r}){const i=Wp(t);return wD(u,{address:e,hash:i,signature:n,...r})}async function GL(u,{address:e,signature:t,message:n,primaryType:r,types:i,domain:a,...o}){const s=jp({message:n,primaryType:r,types:i,domain:a});return wD(u,{address:e,hash:s,signature:t,...o})}function xD(u,{emitOnBegin:e=!1,emitMissed:t=!1,onBlockNumber:n,onError:r,poll:i,pollingInterval:a=u.pollingInterval}){const o=typeof i<"u"?i:u.transport.type!=="webSocket";let s;return o?(()=>{const E=z0(["watchBlockNumber",u.uid,e,t,a]);return Ua(E,{onBlockNumber:n,onError:r},d=>Q4(async()=>{var f;try{const p=await Du(u,X4,"getBlockNumber")({cacheTime:0});if(s){if(p===s)return;if(p-s>1&&t)for(let C=s+1n;Cs)&&(d.onBlockNumber(p,s),s=p)}catch(p){(f=d.onError)==null||f.call(d,p)}},{emitOnBegin:e,interval:a}))})():(()=>{let E=!0,d=()=>E=!1;return(async()=>{try{const{unsubscribe:f}=await u.transport.subscribe({params:["newHeads"],onData(p){var v;if(!E)return;const C=Hu((v=p.result)==null?void 0:v.number);n(C,s),s=C},onError(p){r==null||r(p)}});d=f,E||d()}catch(f){r==null||r(f)}})(),d})()}async function QL(u,{confirmations:e=1,hash:t,onReplaced:n,pollingInterval:r=u.pollingInterval,timeout:i}){const a=z0(["waitForTransactionReceipt",u.uid,t]);let o,s,l,c=!1;return new Promise((E,d)=>{i&&setTimeout(()=>d(new by({hash:t})),i);const f=Ua(a,{onReplaced:n,resolve:E,reject:d},p=>{const C=Du(u,xD,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:r,async onBlockNumber(v){if(c)return;let A=v;const m=g=>{C(),g(),f()};try{if(l){if(e>1&&(!l.blockNumber||A-l.blockNumber+1np.resolve(l));return}if(o||(c=!0,await kd(async()=>{o=await Du(u,Gp,"getTransaction")({hash:t}),o.blockNumber&&(A=o.blockNumber)},{delay:({count:g})=>~~(1<1&&(!l.blockNumber||A-l.blockNumber+1np.resolve(l))}catch(g){if(o&&(g instanceof mp||g instanceof Ap))try{s=o,c=!0;const B=await kd(()=>Du(u,qn,"getBlock")({blockNumber:A,includeTransactions:!0}),{delay:({count:h})=>~~(1<h instanceof Bp});c=!1;const D=B.transactions.find(({from:h,nonce:b})=>h===s.from&&b===s.nonce);if(!D||(l=await Du(u,Od,"getTransactionReceipt")({hash:D.hash}),e>1&&(!l.blockNumber||A-l.blockNumber+1n{var h;(h=p.onReplaced)==null||h.call(p,{reason:F,replacedTransaction:s,transaction:D,transactionReceipt:l}),p.resolve(l)})}catch(B){m(()=>p.reject(B))}else m(()=>p.reject(g))}}})})})}function XL(u,{blockTag:e="latest",emitMissed:t=!1,emitOnBegin:n=!1,onBlock:r,onError:i,includeTransactions:a,poll:o,pollingInterval:s=u.pollingInterval}){const l=typeof o<"u"?o:u.transport.type!=="webSocket",c=a??!1;let E;return l?(()=>{const p=z0(["watchBlocks",u.uid,t,n,c,s]);return Ua(p,{onBlock:r,onError:i},C=>Q4(async()=>{var v;try{const A=await Du(u,qn,"getBlock")({blockTag:e,includeTransactions:c});if(A.number&&(E!=null&&E.number)){if(A.number===E.number)return;if(A.number-E.number>1&&t)for(let m=(E==null?void 0:E.number)+1n;mE.number)&&(C.onBlock(A,E),E=A)}catch(A){(v=C.onError)==null||v.call(C,A)}},{emitOnBegin:n,interval:s}))})():(()=>{let p=!0,C=()=>p=!1;return(async()=>{try{const{unsubscribe:v}=await u.transport.subscribe({params:["newHeads"],onData(A){var B,D,F;if(!p)return;const g=(((F=(D=(B=u.chain)==null?void 0:B.formatters)==null?void 0:D.block)==null?void 0:F.format)||Zc)(A.result);r(g,E),E=g},onError(A){i==null||i(A)}});C=v,p||C()}catch(v){i==null||i(v)}})(),C})()}function YL(u,{address:e,args:t,batch:n=!0,event:r,events:i,onError:a,onLogs:o,poll:s,pollingInterval:l=u.pollingInterval,strict:c}){const E=typeof s<"u"?s:u.transport.type!=="webSocket",d=c??!1;return E?(()=>{const C=z0(["watchEvent",e,t,n,u.uid,r,l]);return Ua(C,{onLogs:o,onError:a},v=>{let A,m,g=!1;const B=Q4(async()=>{var D;if(!g){try{m=await Du(u,Qy,"createEventFilter")({address:e,args:t,event:r,events:i,strict:d})}catch{}g=!0;return}try{let F;if(m)F=await Du(u,CE,"getFilterChanges")({filter:m});else{const h=await Du(u,X4,"getBlockNumber")({});A&&A!==h?F=await Du(u,bp,"getLogs")({address:e,args:t,event:r,events:i,fromBlock:A+1n,toBlock:h}):F=[],A=h}if(F.length===0)return;if(n)v.onLogs(F);else for(const h of F)v.onLogs([h])}catch(F){m&&F instanceof Un&&(g=!1),(D=v.onError)==null||D.call(v,F)}},{emitOnBegin:!0,interval:l});return async()=>{m&&await Du(u,hE,"uninstallFilter")({filter:m}),B()}})})():(()=>{let C=!0,v=()=>C=!1;return(async()=>{try{const A=i??(r?[r]:void 0);let m=[];A&&(m=[A.flatMap(B=>$a({abi:[B],eventName:B.name,args:t}))],r&&(m=m[0]));const{unsubscribe:g}=await u.transport.subscribe({params:["logs",{address:e,topics:m}],onData(B){var F;if(!C)return;const D=B.result;try{const{eventName:h,args:b}=Wa({abi:A,data:D.data,topics:D.topics,strict:d}),T=Ve(D,{args:b,eventName:h});o([T])}catch(h){let b,T;if(h instanceof Wn||h instanceof Ur){if(c)return;b=h.abiItem.name,T=(F=h.abiItem.inputs)==null?void 0:F.some(L=>!("name"in L&&L.name))}const k=Ve(D,{args:T?[]:{},eventName:b});o([k])}},onError(B){a==null||a(B)}});v=g,C||v()}catch(A){a==null||a(A)}})(),v})()}function ZL(u,{batch:e=!0,onError:t,onTransactions:n,poll:r,pollingInterval:i=u.pollingInterval}){return(typeof r<"u"?r:u.transport.type!=="webSocket")?(()=>{const l=z0(["watchPendingTransactions",u.uid,e,i]);return Ua(l,{onTransactions:n,onError:t},c=>{let E;const d=Q4(async()=>{var f;try{if(!E)try{E=await Du(u,Xy,"createPendingTransactionFilter")({});return}catch(C){throw d(),C}const p=await Du(u,CE,"getFilterChanges")({filter:E});if(p.length===0)return;if(e)c.onTransactions(p);else for(const C of p)c.onTransactions([C])}catch(p){(f=c.onError)==null||f.call(c,p)}},{emitOnBegin:!0,interval:i});return async()=>{E&&await Du(u,hE,"uninstallFilter")({filter:E}),d()}})})():(()=>{let l=!0,c=()=>l=!1;return(async()=>{try{const{unsubscribe:E}=await u.transport.subscribe({params:["newPendingTransactions"],onData(d){if(!l)return;const f=d.result;n([f])},onError(d){t==null||t(d)}});c=E,l||c()}catch(E){t==null||t(E)}})(),c})()}function kD(u){return{call:e=>G4(u,e),createBlockFilter:()=>VM(u),createContractEventFilter:e=>pp(u,e),createEventFilter:e=>Qy(u,e),createPendingTransactionFilter:()=>Xy(u),estimateContractGas:e=>Iy(u,e),estimateGas:e=>Dp(u,e),getBalance:e=>GM(u,e),getBlock:e=>qn(u,e),getBlockNumber:e=>X4(u,e),getBlockTransactionCount:e=>QM(u,e),getBytecode:e=>XM(u,e),getChainId:()=>F4(u),getContractEvents:e=>wp(u,e),getEnsAddress:e=>PM(u,e),getEnsAvatar:e=>qM(u,e),getEnsName:e=>HM(u,e),getEnsResolver:e=>KM(u,e),getEnsText:e=>Gy(u,e),getFeeHistory:e=>ZM(u,e),estimateFeesPerGas:e=>iM(u,e),getFilterChanges:e=>CE(u,e),getFilterLogs:e=>JM(u,e),getGasPrice:()=>Fp(u),getLogs:e=>bp(u,e),getProof:e=>OL(u,e),estimateMaxPriorityFeePerGas:e=>rM(u,e),getStorageAt:e=>IL(u,e),getTransaction:e=>Gp(u,e),getTransactionConfirmations:e=>zL(u,e),getTransactionCount:e=>Oy(u,e),getTransactionReceipt:e=>Od(u,e),multicall:e=>jL(u,e),prepareTransactionRequest:e=>pE(u,e),readContract:e=>Zt(u,e),sendRawTransaction:e=>_p(u,e),simulateContract:e=>Ry(u,e),verifyMessage:e=>VL(u,e),verifyTypedData:e=>GL(u,e),uninstallFilter:e=>hE(u,e),waitForTransactionReceipt:e=>QL(u,e),watchBlocks:e=>XL(u,e),watchBlockNumber:e=>xD(u,e),watchContractEvent:e=>Ny(u,e),watchEvent:e=>YL(u,e),watchPendingTransactions:e=>ZL(u,e)}}function Id(u){const{key:e="public",name:t="Public Client"}=u;return mE({...u,key:e,name:t,type:"publicClient"}).extend(kD)}async function JL(u,{hash:e}){await u.request({method:`${u.mode}_dropTransaction`,params:[e]})}async function uW(u){return u.request({method:`${u.mode}_dumpState`})}async function eW(u){return u.mode==="ganache"?await u.request({method:"eth_mining"}):await u.request({method:`${u.mode}_getAutomine`})}async function tW(u){return await u.request({method:"txpool_content"})}async function nW(u){const{pending:e,queued:t}=await u.request({method:"txpool_status"});return{pending:Ku(e),queued:Ku(t)}}async function rW(u,{address:e}){await u.request({method:`${u.mode}_impersonateAccount`,params:[e]})}async function iW(u,{seconds:e}){return await u.request({method:"evm_increaseTime",params:[vu(e)]})}async function aW(u){return await u.request({method:"txpool_inspect"})}async function oW(u,{state:e}){await u.request({method:`${u.mode}_loadState`,params:[e]})}async function sW(u,{blocks:e,interval:t}){u.mode==="ganache"?await u.request({method:"evm_mine",params:[{blocks:vu(e)}]}):await u.request({method:`${u.mode}_mine`,params:[vu(e),vu(t||0)]})}async function lW(u){await u.request({method:`${u.mode}_removeBlockTimestampInterval`})}async function cW(u,{blockNumber:e,jsonRpcUrl:t}={}){await u.request({method:`${u.mode}_reset`,params:[{forking:{blockNumber:Number(e),jsonRpcUrl:t}}]})}async function EW(u,{id:e}){await u.request({method:"evm_revert",params:[e]})}async function dW(u,e){var A,m,g;const{accessList:t,data:n,from:r,gas:i,gasPrice:a,maxFeePerGas:o,maxPriorityFeePerGas:s,nonce:l,to:c,value:E,...d}=e,f=(g=(m=(A=u.chain)==null?void 0:A.formatters)==null?void 0:m.transactionRequest)==null?void 0:g.format,C=(f||Wr)({...dE(d,{format:f}),accessList:t,data:n,from:r,gas:i,gasPrice:a,maxFeePerGas:o,maxPriorityFeePerGas:s,nonce:l,to:c,value:E});return await u.request({method:"eth_sendUnsignedTransaction",params:[C]})}async function fW(u,e){u.mode==="ganache"?e?await u.request({method:"miner_start"}):await u.request({method:"miner_stop"}):await u.request({method:"evm_setAutomine",params:[e]})}async function pW(u,{address:e,value:t}){u.mode==="ganache"?await u.request({method:"evm_setAccountBalance",params:[e,vu(t)]}):await u.request({method:`${u.mode}_setBalance`,params:[e,vu(t)]})}async function CW(u,{gasLimit:e}){await u.request({method:"evm_setBlockGasLimit",params:[vu(e)]})}async function hW(u,{interval:e}){const t=u.mode==="hardhat"?e*1e3:e;await u.request({method:`${u.mode}_setBlockTimestampInterval`,params:[t]})}async function mW(u,{address:e,bytecode:t}){await u.request({method:`${u.mode}_setCode`,params:[e,t]})}async function AW(u,{address:e}){await u.request({method:`${u.mode}_setCoinbase`,params:[e]})}async function gW(u,{interval:e}){const t=u.mode==="hardhat"?e*1e3:e;await u.request({method:"evm_setIntervalMining",params:[t]})}async function vW(u,e){await u.request({method:`${u.mode}_setLoggingEnabled`,params:[e]})}async function BW(u,{gasPrice:e}){await u.request({method:`${u.mode}_setMinGasPrice`,params:[vu(e)]})}async function FW(u,{baseFeePerGas:e}){await u.request({method:`${u.mode}_setNextBlockBaseFeePerGas`,params:[vu(e)]})}async function yW(u,{timestamp:e}){await u.request({method:"evm_setNextBlockTimestamp",params:[vu(e)]})}async function DW(u,{address:e,nonce:t}){await u.request({method:`${u.mode}_setNonce`,params:[e,vu(t)]})}async function bW(u,e){await u.request({method:`${u.mode}_setRpcUrl`,params:[e]})}async function wW(u,{address:e,index:t,value:n}){await u.request({method:`${u.mode}_setStorageAt`,params:[e,typeof t=="number"?vu(t):t,n]})}async function xW(u){return await u.request({method:"evm_snapshot"})}async function kW(u,{address:e}){await u.request({method:`${u.mode}_stopImpersonatingAccount`,params:[e]})}function _D({mode:u}){return e=>{const t=e.extend(()=>({mode:u}));return{dropTransaction:n=>JL(t,n),dumpState:()=>uW(t),getAutomine:()=>eW(t),getTxpoolContent:()=>tW(t),getTxpoolStatus:()=>nW(t),impersonateAccount:n=>rW(t,n),increaseTime:n=>iW(t,n),inspectTxpool:()=>aW(t),loadState:n=>oW(t,n),mine:n=>sW(t,n),removeBlockTimestampInterval:()=>lW(t),reset:n=>cW(t,n),revert:n=>EW(t,n),sendUnsignedTransaction:n=>dW(t,n),setAutomine:n=>fW(t,n),setBalance:n=>pW(t,n),setBlockGasLimit:n=>CW(t,n),setBlockTimestampInterval:n=>hW(t,n),setCode:n=>mW(t,n),setCoinbase:n=>AW(t,n),setIntervalMining:n=>gW(t,n),setLoggingEnabled:n=>vW(t,n),setMinGasPrice:n=>BW(t,n),setNextBlockBaseFeePerGas:n=>FW(t,n),setNextBlockTimestamp:n=>yW(t,n),setNonce:n=>DW(t,n),setRpcUrl:n=>bW(t,n),setStorageAt:n=>wW(t,n),snapshot:()=>xW(t),stopImpersonatingAccount:n=>kW(t,n)}}}function _W(u){const{key:e="test",name:t="Test Client",mode:n}=u;return mE({...u,key:e,name:t,type:"testClient"}).extend(i=>({mode:n,..._D({mode:n})(i)}))}function SW(u,{abi:e,args:t,bytecode:n,...r}){const i=$p({abi:e,args:t,bytecode:n});return Sp(u,{...r,data:i})}async function TW(u){var t;return((t=u.account)==null?void 0:t.type)==="local"?[u.account.address]:(await u.request({method:"eth_accounts"})).map(n=>K4(n))}async function PW(u){return await u.request({method:"wallet_getPermissions"})}async function OW(u){return(await u.request({method:"eth_requestAccounts"})).map(t=>a0(t))}async function IW(u,e){return u.request({method:"wallet_requestPermissions",params:[e]})}async function zW(u,{account:e=u.account,message:t}){if(!e)throw new Ma({docsPath:"/docs/actions/wallet/signMessage"});const n=Ye(e);if(n.type==="local")return n.signMessage({message:t});const r=typeof t=="string"?L4(t):t.raw instanceof Uint8Array?ju(t.raw):t.raw;return u.request({method:"personal_sign",params:[r,n.address]})}async function jW(u,e){var l,c,E,d;const{account:t=u.account,chain:n=u.chain,...r}=e;if(!t)throw new Ma({docsPath:"/docs/actions/wallet/signTransaction"});const i=Ye(t);La({account:i,...e});const a=await Du(u,F4,"getChainId")({});n!==null&&kp({currentChainId:a,chain:n});const o=(n==null?void 0:n.formatters)||((l=u.chain)==null?void 0:l.formatters),s=((c=o==null?void 0:o.transactionRequest)==null?void 0:c.format)||Wr;return i.type==="local"?i.signTransaction({...r,chainId:a},{serializer:(d=(E=u.chain)==null?void 0:E.serializers)==null?void 0:d.transaction}):await u.request({method:"eth_signTransaction",params:[{...s(r),chainId:vu(a),from:i.address}]})}async function RW(u,{account:e=u.account,domain:t,message:n,primaryType:r,types:i}){if(!e)throw new Ma({docsPath:"/docs/actions/wallet/signTypedData"});const a=Ye(e),o={EIP712Domain:BE({domain:t}),...i};if(Np({domain:t,message:n,primaryType:r,types:o}),a.type==="local")return a.signTypedData({domain:t,primaryType:r,types:o,message:n});const s=z0({domain:t??{},primaryType:r,types:o,message:n},(l,c)=>zu(c)?c.toLowerCase():c);return u.request({method:"eth_signTypedData_v4",params:[a.address,s]})}async function NW(u,{id:e}){await u.request({method:"wallet_switchEthereumChain",params:[{chainId:vu(e)}]})}async function $W(u,e){return await u.request({method:"wallet_watchAsset",params:e})}function SD(u){return{addChain:e=>FM(u,e),deployContract:e=>SW(u,e),getAddresses:()=>TW(u),getChainId:()=>F4(u),getPermissions:()=>PW(u),prepareTransactionRequest:e=>pE(u,e),requestAddresses:()=>OW(u),requestPermissions:e=>IW(u,e),sendRawTransaction:e=>_p(u,e),sendTransaction:e=>Sp(u,e),signMessage:e=>zW(u,e),signTransaction:e=>jW(u,e),signTypedData:e=>RW(u,e),switchChain:e=>NW(u,e),watchAsset:e=>$W(u,e),writeContract:e=>$y(u,e)}}function Ka(u){const{key:e="wallet",name:t="Wallet Client",transport:n}=u;return mE({...u,key:e,name:t,transport:i=>n({...i,retryCount:0}),type:"walletClient"}).extend(SD)}function TD(u,e={}){const{key:t="webSocket",name:n="WebSocket JSON-RPC",retryDelay:r}=e;return({chain:i,retryCount:a,timeout:o})=>{var E;const s=e.retryCount??a,l=o??e.timeout??1e4,c=u||((E=i==null?void 0:i.rpcUrls.default.webSocket)==null?void 0:E[0]);if(!c)throw new Tp;return Y4({key:t,name:n,async request({method:d,params:f}){const p={method:d,params:f},C=await F9(c),{error:v,result:A}=await qi.webSocketAsync(C,{body:p,timeout:l});if(v)throw new EE({body:p,error:v,url:c});return A},retryCount:s,retryDelay:r,timeout:l,type:"webSocket"},{getSocket(){return F9(c)},async subscribe({params:d,onData:f,onError:p}){const C=await F9(c),{result:v}=await new Promise((A,m)=>qi.webSocket(C,{body:{method:"eth_subscribe",params:d},onResponse(g){if(g.error){m(g.error),p==null||p(g.error);return}if(typeof g.id=="number"){A(g);return}g.method==="eth_subscription"&&f(g.params)}}));return{subscriptionId:v,async unsubscribe(){return new Promise(A=>qi.webSocket(C,{body:{method:"eth_unsubscribe",params:[v]},onResponse:A}))}}}})}}const MW="0x0000000000000000000000000000000000000000",LW=2n**(8n-1n)-1n,WW=2n**(16n-1n)-1n,UW=2n**(24n-1n)-1n,qW=2n**(32n-1n)-1n,HW=2n**(40n-1n)-1n,KW=2n**(48n-1n)-1n,VW=2n**(56n-1n)-1n,GW=2n**(64n-1n)-1n,QW=2n**(72n-1n)-1n,XW=2n**(80n-1n)-1n,YW=2n**(88n-1n)-1n,ZW=2n**(96n-1n)-1n,JW=2n**(104n-1n)-1n,uU=2n**(112n-1n)-1n,eU=2n**(120n-1n)-1n,tU=2n**(128n-1n)-1n,nU=2n**(136n-1n)-1n,rU=2n**(144n-1n)-1n,iU=2n**(152n-1n)-1n,aU=2n**(160n-1n)-1n,oU=2n**(168n-1n)-1n,sU=2n**(176n-1n)-1n,lU=2n**(184n-1n)-1n,cU=2n**(192n-1n)-1n,EU=2n**(200n-1n)-1n,dU=2n**(208n-1n)-1n,fU=2n**(216n-1n)-1n,pU=2n**(224n-1n)-1n,CU=2n**(232n-1n)-1n,hU=2n**(240n-1n)-1n,mU=2n**(248n-1n)-1n,AU=2n**(256n-1n)-1n,gU=-(2n**(8n-1n)),vU=-(2n**(16n-1n)),BU=-(2n**(24n-1n)),FU=-(2n**(32n-1n)),yU=-(2n**(40n-1n)),DU=-(2n**(48n-1n)),bU=-(2n**(56n-1n)),wU=-(2n**(64n-1n)),xU=-(2n**(72n-1n)),kU=-(2n**(80n-1n)),_U=-(2n**(88n-1n)),SU=-(2n**(96n-1n)),TU=-(2n**(104n-1n)),PU=-(2n**(112n-1n)),OU=-(2n**(120n-1n)),IU=-(2n**(128n-1n)),zU=-(2n**(136n-1n)),jU=-(2n**(144n-1n)),RU=-(2n**(152n-1n)),NU=-(2n**(160n-1n)),$U=-(2n**(168n-1n)),MU=-(2n**(176n-1n)),LU=-(2n**(184n-1n)),WU=-(2n**(192n-1n)),UU=-(2n**(200n-1n)),qU=-(2n**(208n-1n)),HU=-(2n**(216n-1n)),KU=-(2n**(224n-1n)),VU=-(2n**(232n-1n)),GU=-(2n**(240n-1n)),QU=-(2n**(248n-1n)),XU=-(2n**(256n-1n)),YU=2n**8n-1n,ZU=2n**16n-1n,JU=2n**24n-1n,uq=2n**32n-1n,eq=2n**40n-1n,tq=2n**48n-1n,nq=2n**56n-1n,rq=2n**64n-1n,iq=2n**72n-1n,aq=2n**80n-1n,oq=2n**88n-1n,sq=2n**96n-1n,lq=2n**104n-1n,cq=2n**112n-1n,Eq=2n**120n-1n,dq=2n**128n-1n,fq=2n**136n-1n,pq=2n**144n-1n,Cq=2n**152n-1n,hq=2n**160n-1n,mq=2n**168n-1n,Aq=2n**176n-1n,gq=2n**184n-1n,vq=2n**192n-1n,Bq=2n**200n-1n,Fq=2n**208n-1n,yq=2n**216n-1n,Dq=2n**224n-1n,bq=2n**232n-1n,wq=2n**240n-1n,xq=2n**248n-1n,kq=2n**256n-1n,_q="0x0000000000000000000000000000000000000000000000000000000000000000",w9="/docs/contract/decodeDeployData";function Sq({abi:u,bytecode:e,data:t}){if(t===e)return{bytecode:e};const n=u.find(i=>"type"in i&&i.type==="constructor");if(!n)throw new tp({docsPath:w9});if(!("inputs"in n))throw new B4({docsPath:w9});if(!n.inputs||n.inputs.length===0)throw new B4({docsPath:w9});return{args:qr(n.inputs,`0x${t.replace(e,"")}`),bytecode:e}}function Tq({r:u,yParityAndS:e}){const t=en(e),n=t[0]&128?28n:27n,r=t;return n===28n&&(r[0]&=127),{r:u,s:Ae(r),v:n}}function Pq(u,e,t,n){if(typeof u.setBigUint64=="function")return u.setBigUint64(e,t,n);const r=BigInt(32),i=BigInt(4294967295),a=Number(t>>r&i),o=Number(t&i),s=n?4:0,l=n?0:4;u.setUint32(e+s,a,n),u.setUint32(e+l,o,n)}class Oq extends lp{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=h9(this.buffer)}update(e){ia(this);const{view:t,buffer:n,blockLen:r}=this;e=nE(e);const i=e.length;for(let a=0;ar-a&&(this.process(n,0),a=0);for(let E=a;Ec.length)throw new Error("_sha2: outputLen bigger than state");for(let E=0;Eu&e^~u&t,zq=(u,e,t)=>u&e^u&t^e&t,jq=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),dn=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),fn=new Uint32Array(64);class Rq extends Oq{constructor(){super(64,32,8,!1),this.A=dn[0]|0,this.B=dn[1]|0,this.C=dn[2]|0,this.D=dn[3]|0,this.E=dn[4]|0,this.F=dn[5]|0,this.G=dn[6]|0,this.H=dn[7]|0}get(){const{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}process(e,t){for(let E=0;E<16;E++,t+=4)fn[E]=e.getUint32(t,!1);for(let E=16;E<64;E++){const d=fn[E-15],f=fn[E-2],p=At(d,7)^At(d,18)^d>>>3,C=At(f,17)^At(f,19)^f>>>10;fn[E]=C+fn[E-7]+p+fn[E-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:l,H:c}=this;for(let E=0;E<64;E++){const d=At(o,6)^At(o,11)^At(o,25),f=c+d+Iq(o,s,l)+jq[E]+fn[E]|0,C=(At(n,2)^At(n,13)^At(n,22))+zq(n,r,i)|0;c=l,l=s,s=o,o=a+f|0,a=i,i=r,r=n,n=f+C|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(n,r,i,a,o,s,l,c)}roundClean(){fn.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Tl=cy(()=>new Rq);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const O0=BigInt(0),h0=BigInt(1),Er=BigInt(2),Nq=BigInt(3),zd=BigInt(4),X8=BigInt(5),Y8=BigInt(8);BigInt(9);BigInt(16);function P0(u,e){const t=u%e;return t>=O0?t:e+t}function $q(u,e,t){if(t<=O0||e 0");if(t===h0)return O0;let n=h0;for(;e>O0;)e&h0&&(n=n*u%t),u=u*u%t,e>>=h0;return n}function je(u,e,t){let n=u;for(;e-- >O0;)n*=n,n%=t;return n}function jd(u,e){if(u===O0||e<=O0)throw new Error(`invert: expected positive integers, got n=${u} mod=${e}`);let t=P0(u,e),n=e,r=O0,i=h0;for(;t!==O0;){const o=n/t,s=n%t,l=r-i*o;n=t,t=s,r=i,i=l}if(n!==h0)throw new Error("invert: does not exist");return P0(r,e)}function Mq(u){const e=(u-h0)/Er;let t,n,r;for(t=u-h0,n=0;t%Er===O0;t/=Er,n++);for(r=Er;r(n[r]="function",n),e);return Ha(u,t)}function Uq(u,e,t){if(t 0");if(t===O0)return u.ONE;if(t===h0)return e;let n=u.ONE,r=e;for(;t>O0;)t&h0&&(n=u.mul(n,r)),r=u.sqr(r),t>>=h0;return n}function qq(u,e){const t=new Array(e.length),n=e.reduce((i,a,o)=>u.is0(a)?i:(t[o]=i,u.mul(i,a)),u.ONE),r=u.inv(n);return e.reduceRight((i,a,o)=>u.is0(a)?i:(t[o]=u.mul(i,t[o]),u.mul(i,a)),r),t}function OD(u,e){const t=e!==void 0?e:u.toString(2).length,n=Math.ceil(t/8);return{nBitLength:t,nByteLength:n}}function Hq(u,e,t=!1,n={}){if(u<=O0)throw new Error(`Expected Field ORDER > 0, got ${u}`);const{nBitLength:r,nByteLength:i}=OD(u,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const a=Lq(u),o=Object.freeze({ORDER:u,BITS:r,BYTES:i,MASK:Zp(r),ZERO:O0,ONE:h0,create:s=>P0(s,u),isValid:s=>{if(typeof s!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof s}`);return O0<=s&&ss===O0,isOdd:s=>(s&h0)===h0,neg:s=>P0(-s,u),eql:(s,l)=>s===l,sqr:s=>P0(s*s,u),add:(s,l)=>P0(s+l,u),sub:(s,l)=>P0(s-l,u),mul:(s,l)=>P0(s*l,u),pow:(s,l)=>Uq(o,s,l),div:(s,l)=>P0(s*jd(l,u),u),sqrN:s=>s*s,addN:(s,l)=>s+l,subN:(s,l)=>s-l,mulN:(s,l)=>s*l,inv:s=>jd(s,u),sqrt:n.sqrt||(s=>a(o,s)),invertBatch:s=>qq(o,s),cmov:(s,l,c)=>c?l:s,toBytes:s=>t?Yp(s,i):Hn(s,i),fromBytes:s=>{if(s.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${s.length}`);return t?Xp(s):re(s)}});return Object.freeze(o)}function ID(u){if(typeof u!="bigint")throw new Error("field order must be bigint");const e=u.toString(2).length;return Math.ceil(e/8)}function zD(u){const e=ID(u);return e+Math.ceil(e/2)}function Kq(u,e,t=!1){const n=u.length,r=ID(e),i=zD(e);if(n<16||n1024)throw new Error(`expected ${i}-1024 bytes of input, got ${n}`);const a=t?re(u):Xp(u),o=P0(a,e-h0)+h0;return t?Yp(o,r):Hn(o,r)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Vq=BigInt(0),x9=BigInt(1);function Gq(u,e){const t=(r,i)=>{const a=i.negate();return r?a:i},n=r=>{const i=Math.ceil(e/r)+1,a=2**(r-1);return{windows:i,windowSize:a}};return{constTimeNegate:t,unsafeLadder(r,i){let a=u.ZERO,o=r;for(;i>Vq;)i&x9&&(a=a.add(o)),o=o.double(),i>>=x9;return a},precomputeWindow(r,i){const{windows:a,windowSize:o}=n(i),s=[];let l=r,c=l;for(let E=0;E>=f,v>s&&(v-=d,a+=x9);const A=C,m=C+Math.abs(v)-1,g=p%2!==0,B=v<0;v===0?c=c.add(t(g,i[A])):l=l.add(t(B,i[m]))}return{p:l,f:c}},wNAFCached(r,i,a,o){const s=r._WINDOW_SIZE||1;let l=i.get(r);return l||(l=this.precomputeWindow(r,s),s!==1&&i.set(r,o(l))),this.wNAF(s,l,a)}}}function jD(u){return PD(u.Fp),Ha(u,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...OD(u.n,u.nBitLength),...u,p:u.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Qq(u){const e=jD(u);Ha(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:n,a:r}=e;if(t){if(!n.eql(r,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:Xq,hexToBytes:Yq}=HL,Ar={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(u){const{Err:e}=Ar;if(u.length<2||u[0]!==2)throw new e("Invalid signature integer tag");const t=u[1],n=u.subarray(2,t+2);if(!t||n.length!==t)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:Xq(n),l:u.subarray(t+2)}},toSig(u){const{Err:e}=Ar,t=typeof u=="string"?Yq(u):u;if(!(t instanceof Uint8Array))throw new Error("ui8a expected");let n=t.length;if(n<2||t[0]!=48)throw new e("Invalid signature tag");if(t[1]!==n-2)throw new e("Invalid signature: incorrect length");const{d:r,l:i}=Ar._parseInt(t.subarray(2)),{d:a,l:o}=Ar._parseInt(i);if(o.length)throw new e("Invalid signature: left bytes after parsing");return{r,s:a}},hexFromSig(u){const e=l=>Number.parseInt(l[0],16)&8?"00"+l:l,t=l=>{const c=l.toString(16);return c.length&1?`0${c}`:c},n=e(t(u.s)),r=e(t(u.r)),i=n.length/2,a=r.length/2,o=t(i),s=t(a);return`30${t(a+i+4)}02${s}${r}02${o}${n}`}},at=BigInt(0),E0=BigInt(1),pn=BigInt(2),Pl=BigInt(3),Z8=BigInt(4);function Zq(u){const e=Qq(u),{Fp:t}=e,n=e.toBytes||((p,C,v)=>{const A=C.toAffine();return ye(Uint8Array.from([4]),t.toBytes(A.x),t.toBytes(A.y))}),r=e.fromBytes||(p=>{const C=p.subarray(1),v=t.fromBytes(C.subarray(0,t.BYTES)),A=t.fromBytes(C.subarray(t.BYTES,2*t.BYTES));return{x:v,y:A}});function i(p){const{a:C,b:v}=e,A=t.sqr(p),m=t.mul(A,p);return t.add(t.add(m,t.mul(p,C)),v)}if(!t.eql(t.sqr(e.Gy),i(e.Gx)))throw new Error("bad generator point: equation left != right");function a(p){return typeof p=="bigint"&&att.eql(g,t.ZERO);return m(v)&&m(A)?E.ZERO:new E(v,A,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(C){const v=t.invertBatch(C.map(A=>A.pz));return C.map((A,m)=>A.toAffine(v[m])).map(E.fromAffine)}static fromHex(C){const v=E.fromAffine(r(Q0("pointHex",C)));return v.assertValidity(),v}static fromPrivateKey(C){return E.BASE.multiply(s(C))}_setWindowSize(C){this._WINDOW_SIZE=C,l.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!t.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:C,y:v}=this.toAffine();if(!t.isValid(C)||!t.isValid(v))throw new Error("bad point: x or y not FE");const A=t.sqr(v),m=i(C);if(!t.eql(A,m))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:C}=this.toAffine();if(t.isOdd)return!t.isOdd(C);throw new Error("Field doesn't support isOdd")}equals(C){c(C);const{px:v,py:A,pz:m}=this,{px:g,py:B,pz:D}=C,F=t.eql(t.mul(v,D),t.mul(g,m)),h=t.eql(t.mul(A,D),t.mul(B,m));return F&&h}negate(){return new E(this.px,t.neg(this.py),this.pz)}double(){const{a:C,b:v}=e,A=t.mul(v,Pl),{px:m,py:g,pz:B}=this;let D=t.ZERO,F=t.ZERO,h=t.ZERO,b=t.mul(m,m),T=t.mul(g,g),k=t.mul(B,B),L=t.mul(m,g);return L=t.add(L,L),h=t.mul(m,B),h=t.add(h,h),D=t.mul(C,h),F=t.mul(A,k),F=t.add(D,F),D=t.sub(T,F),F=t.add(T,F),F=t.mul(D,F),D=t.mul(L,D),h=t.mul(A,h),k=t.mul(C,k),L=t.sub(b,k),L=t.mul(C,L),L=t.add(L,h),h=t.add(b,b),b=t.add(h,b),b=t.add(b,k),b=t.mul(b,L),F=t.add(F,b),k=t.mul(g,B),k=t.add(k,k),b=t.mul(k,L),D=t.sub(D,b),h=t.mul(k,T),h=t.add(h,h),h=t.add(h,h),new E(D,F,h)}add(C){c(C);const{px:v,py:A,pz:m}=this,{px:g,py:B,pz:D}=C;let F=t.ZERO,h=t.ZERO,b=t.ZERO;const T=e.a,k=t.mul(e.b,Pl);let L=t.mul(v,g),Q=t.mul(A,B),Z=t.mul(m,D),tu=t.add(v,A),q=t.add(g,B);tu=t.mul(tu,q),q=t.add(L,Q),tu=t.sub(tu,q),q=t.add(v,m);let V=t.add(g,D);return q=t.mul(q,V),V=t.add(L,Z),q=t.sub(q,V),V=t.add(A,m),F=t.add(B,D),V=t.mul(V,F),F=t.add(Q,Z),V=t.sub(V,F),b=t.mul(T,q),F=t.mul(k,Z),b=t.add(F,b),F=t.sub(Q,b),b=t.add(Q,b),h=t.mul(F,b),Q=t.add(L,L),Q=t.add(Q,L),Z=t.mul(T,Z),q=t.mul(k,q),Q=t.add(Q,Z),Z=t.sub(L,Z),Z=t.mul(T,Z),q=t.add(q,Z),L=t.mul(Q,q),h=t.add(h,L),L=t.mul(V,q),F=t.mul(tu,F),F=t.sub(F,L),L=t.mul(tu,Q),b=t.mul(V,b),b=t.add(b,L),new E(F,h,b)}subtract(C){return this.add(C.negate())}is0(){return this.equals(E.ZERO)}wNAF(C){return f.wNAFCached(this,l,C,v=>{const A=t.invertBatch(v.map(m=>m.pz));return v.map((m,g)=>m.toAffine(A[g])).map(E.fromAffine)})}multiplyUnsafe(C){const v=E.ZERO;if(C===at)return v;if(o(C),C===E0)return this;const{endo:A}=e;if(!A)return f.unsafeLadder(this,C);let{k1neg:m,k1:g,k2neg:B,k2:D}=A.splitScalar(C),F=v,h=v,b=this;for(;g>at||D>at;)g&E0&&(F=F.add(b)),D&E0&&(h=h.add(b)),b=b.double(),g>>=E0,D>>=E0;return m&&(F=F.negate()),B&&(h=h.negate()),h=new E(t.mul(h.px,A.beta),h.py,h.pz),F.add(h)}multiply(C){o(C);let v=C,A,m;const{endo:g}=e;if(g){const{k1neg:B,k1:D,k2neg:F,k2:h}=g.splitScalar(v);let{p:b,f:T}=this.wNAF(D),{p:k,f:L}=this.wNAF(h);b=f.constTimeNegate(B,b),k=f.constTimeNegate(F,k),k=new E(t.mul(k.px,g.beta),k.py,k.pz),A=b.add(k),m=T.add(L)}else{const{p:B,f:D}=this.wNAF(v);A=B,m=D}return E.normalizeZ([A,m])[0]}multiplyAndAddUnsafe(C,v,A){const m=E.BASE,g=(D,F)=>F===at||F===E0||!D.equals(m)?D.multiplyUnsafe(F):D.multiply(F),B=g(this,v).add(g(C,A));return B.is0()?void 0:B}toAffine(C){const{px:v,py:A,pz:m}=this,g=this.is0();C==null&&(C=g?t.ONE:t.inv(m));const B=t.mul(v,C),D=t.mul(A,C),F=t.mul(m,C);if(g)return{x:t.ZERO,y:t.ZERO};if(!t.eql(F,t.ONE))throw new Error("invZ was invalid");return{x:B,y:D}}isTorsionFree(){const{h:C,isTorsionFree:v}=e;if(C===E0)return!0;if(v)return v(E,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:C,clearCofactor:v}=e;return C===E0?this:v?v(E,this):this.multiplyUnsafe(e.h)}toRawBytes(C=!0){return this.assertValidity(),n(E,this,C)}toHex(C=!0){return va(this.toRawBytes(C))}}E.BASE=new E(e.Gx,e.Gy,t.ONE),E.ZERO=new E(t.ZERO,t.ONE,t.ZERO);const d=e.nBitLength,f=Gq(E,e.endo?Math.ceil(d/2):d);return{CURVE:e,ProjectivePoint:E,normPrivateKeyToScalar:s,weierstrassEquation:i,isWithinCurveOrder:a}}function Jq(u){const e=jD(u);return Ha(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function uH(u){const e=Jq(u),{Fp:t,n}=e,r=t.BYTES+1,i=2*t.BYTES+1;function a(q){return atva(Hn(q,e.nByteLength));function p(q){const V=n>>E0;return q>V}function C(q){return p(q)?o(-q):q}const v=(q,V,G)=>re(q.slice(V,G));class A{constructor(V,G,W){this.r=V,this.s=G,this.recovery=W,this.assertValidity()}static fromCompact(V){const G=e.nByteLength;return V=Q0("compactSignature",V,G*2),new A(v(V,0,G),v(V,G,2*G))}static fromDER(V){const{r:G,s:W}=Ar.toSig(Q0("DER",V));return new A(G,W)}assertValidity(){if(!d(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!d(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(V){return new A(this.r,this.s,V)}recoverPublicKey(V){const{r:G,s:W,recovery:M}=this,j=h(Q0("msgHash",V));if(M==null||![0,1,2,3].includes(M))throw new Error("recovery id invalid");const Y=M===2||M===3?G+e.n:G;if(Y>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const uu=M&1?"03":"02",J=l.fromHex(uu+f(Y)),U=s(Y),fu=o(-j*U),gu=o(W*U),yu=l.BASE.multiplyAndAddUnsafe(J,fu,gu);if(!yu)throw new Error("point at infinify");return yu.assertValidity(),yu}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new A(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return Ba(this.toDERHex())}toDERHex(){return Ar.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Ba(this.toCompactHex())}toCompactHex(){return f(this.r)+f(this.s)}}const m={isValidPrivateKey(q){try{return c(q),!0}catch{return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const q=zD(e.n);return Kq(e.randomBytes(q),e.n)},precompute(q=8,V=l.BASE){return V._setWindowSize(q),V.multiply(BigInt(3)),V}};function g(q,V=!0){return l.fromPrivateKey(q).toRawBytes(V)}function B(q){const V=q instanceof Uint8Array,G=typeof q=="string",W=(V||G)&&q.length;return V?W===r||W===i:G?W===2*r||W===2*i:q instanceof l}function D(q,V,G=!0){if(B(q))throw new Error("first arg must be private key");if(!B(V))throw new Error("second arg must be public key");return l.fromHex(V).multiply(c(q)).toRawBytes(G)}const F=e.bits2int||function(q){const V=re(q),G=q.length*8-e.nBitLength;return G>0?V>>BigInt(G):V},h=e.bits2int_modN||function(q){return o(F(q))},b=Zp(e.nBitLength);function T(q){if(typeof q!="bigint")throw new Error("bigint expected");if(!(at<=q&&qhu in G))throw new Error("sign() legacy options not supported");const{hash:W,randomBytes:M}=e;let{lowS:j,prehash:Y,extraEntropy:uu}=G;j==null&&(j=!0),q=Q0("msgHash",q),Y&&(q=Q0("prehashed msgHash",W(q)));const J=h(q),U=c(V),fu=[T(U),T(J)];if(uu!=null){const hu=uu===!0?M(t.BYTES):uu;fu.push(Q0("extraEntropy",hu))}const gu=ye(...fu),yu=J;function Bu(hu){const x=F(hu);if(!d(x))return;const _=s(x),S=l.BASE.multiply(x).toAffine(),z=o(S.x);if(z===at)return;const O=o(_*o(yu+z*U));if(O===at)return;let $=(S.x===z?0:2)|Number(S.y&E0),H=O;return j&&p(O)&&(H=C(O),$^=1),new A(z,H,$)}return{seed:gu,k2sig:Bu}}const L={lowS:e.lowS,prehash:!1},Q={lowS:e.lowS,prehash:!1};function Z(q,V,G=L){const{seed:W,k2sig:M}=k(q,V,G),j=e;return bD(j.hash.outputLen,j.nByteLength,j.hmac)(W,M)}l.BASE._setWindowSize(8);function tu(q,V,G,W=Q){var S;const M=q;if(V=Q0("msgHash",V),G=Q0("publicKey",G),"strict"in W)throw new Error("options.strict was renamed to lowS");const{lowS:j,prehash:Y}=W;let uu,J;try{if(typeof M=="string"||M instanceof Uint8Array)try{uu=A.fromDER(M)}catch(z){if(!(z instanceof Ar.Err))throw z;uu=A.fromCompact(M)}else if(typeof M=="object"&&typeof M.r=="bigint"&&typeof M.s=="bigint"){const{r:z,s:O}=M;uu=new A(z,O)}else throw new Error("PARSE");J=l.fromHex(G)}catch(z){if(z.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(j&&uu.hasHighS())return!1;Y&&(V=e.hash(V));const{r:U,s:fu}=uu,gu=h(V),yu=s(fu),Bu=o(gu*yu),hu=o(U*yu),x=(S=l.BASE.multiplyAndAddUnsafe(J,Bu,hu))==null?void 0:S.toAffine();return x?o(x.x)===U:!1}return{CURVE:e,getPublicKey:g,getSharedSecret:D,sign:Z,verify:tu,ProjectivePoint:l,Signature:A,utils:m}}function eH(u,e){const t=u.ORDER;let n=at;for(let p=t-E0;p%pn===at;p/=pn)n+=E0;const r=n,i=pn<{let v=E,A=u.pow(C,l),m=u.sqr(A);m=u.mul(m,C);let g=u.mul(p,m);g=u.pow(g,s),g=u.mul(g,A),A=u.mul(g,C),m=u.mul(g,p);let B=u.mul(m,A);g=u.pow(B,c);let D=u.eql(g,u.ONE);A=u.mul(m,d),g=u.mul(B,v),m=u.cmov(A,m,D),B=u.cmov(g,B,D);for(let F=r;F>E0;F--){let h=F-pn;h=pn<{let m=u.sqr(A);const g=u.mul(v,A);m=u.mul(m,g);let B=u.pow(m,p);B=u.mul(B,g);const D=u.mul(B,C),F=u.mul(u.sqr(B),A),h=u.eql(F,v);let b=u.cmov(D,B,h);return{isValid:h,value:b}}}return f}function tH(u,e){if(PD(u),!u.isValid(e.A)||!u.isValid(e.B)||!u.isValid(e.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const t=eH(u,e.Z);if(!u.isOdd)throw new Error("Fp.isOdd is not implemented!");return n=>{let r,i,a,o,s,l,c,E;r=u.sqr(n),r=u.mul(r,e.Z),i=u.sqr(r),i=u.add(i,r),a=u.add(i,u.ONE),a=u.mul(a,e.B),o=u.cmov(e.Z,u.neg(i),!u.eql(i,u.ZERO)),o=u.mul(o,e.A),i=u.sqr(a),l=u.sqr(o),s=u.mul(l,e.A),i=u.add(i,s),i=u.mul(i,a),l=u.mul(l,o),s=u.mul(l,e.B),i=u.add(i,s),c=u.mul(r,a);const{isValid:d,value:f}=t(i,l);E=u.mul(r,n),E=u.mul(E,f),c=u.cmov(c,a,d),E=u.cmov(E,f,d);const p=u.isOdd(n)===u.isOdd(E);return E=u.cmov(u.neg(E),E,p),c=u.div(c,o),{x:c,y:E}}}function nH(u){if(u instanceof Uint8Array)return u;if(typeof u=="string")return DE(u);throw new Error("DST must be Uint8Array or string")}const rH=re;function vn(u,e){if(u<0||u>=1<<8*e)throw new Error(`bad I2OSP call: value=${u} length=${e}`);const t=Array.from({length:e}).fill(0);for(let n=e-1;n>=0;n--)t[n]=u&255,u>>>=8;return new Uint8Array(t)}function iH(u,e){const t=new Uint8Array(u.length);for(let n=0;n255&&(e=n(ye(DE("H2C-OVERSIZE-DST-"),e)));const{outputLen:r,blockLen:i}=n,a=Math.ceil(t/r);if(a>255)throw new Error("Invalid xmd length");const o=ye(e,vn(e.length,1)),s=vn(0,i),l=vn(t,2),c=new Array(a),E=n(ye(s,u,l,vn(0,1),o));c[0]=n(ye(E,vn(1,1),o));for(let f=1;f<=a;f++){const p=[iH(E,c[f-1]),vn(f+1,1),o];c[f]=n(ye(...p))}return ye(...c).slice(0,t)}function oH(u,e,t,n,r){if(y4(u),y4(e),Jp(t),e.length>255){const i=Math.ceil(2*n/8);e=r.create({dkLen:i}).update(DE("H2C-OVERSIZE-DST-")).update(e).digest()}if(t>65535||e.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return r.create({dkLen:t}).update(u).update(vn(t,2)).update(e).update(vn(e.length,1)).digest()}function J8(u,e,t){Ha(t,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:n,k:r,m:i,hash:a,expand:o,DST:s}=t;y4(u),Jp(e);const l=nH(s),c=n.toString(2).length,E=Math.ceil((c+r)/8),d=e*i*E;let f;if(o==="xmd")f=aH(u,l,d,a);else if(o==="xof")f=oH(u,l,d,r,a);else if(o==="_internal_pass")f=u;else throw new Error('expand must be "xmd" or "xof"');const p=new Array(e);for(let C=0;CArray.from(n).reverse());return(n,r)=>{const[i,a,o,s]=t.map(l=>l.reduce((c,E)=>u.add(u.mul(c,n),E)));return n=u.div(i,a),r=u.mul(r,u.div(o,s)),{x:n,y:r}}}function lH(u,e,t){if(typeof e!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(n,r){const i=J8(n,2,{...t,DST:t.DST,...r}),a=u.fromAffine(e(i[0])),o=u.fromAffine(e(i[1])),s=a.add(o).clearCofactor();return s.assertValidity(),s},encodeToCurve(n,r){const i=J8(n,1,{...t,DST:t.encodeDST,...r}),a=u.fromAffine(e(i[0])).clearCofactor();return a.assertValidity(),a}}}let RD=class extends lp{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,p$(e);const n=nE(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?e.create().update(n).digest():n);for(let a=0;anew RD(u,e).update(t).digest();ND.create=(u,e)=>new RD(u,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function cH(u){return{hash:u,hmac:(e,...t)=>ND(u,e,D$(...t)),randomBytes:Ey}}function EH(u,e){const t=n=>uH({...u,...cH(n)});return Object.freeze({...t(e),create:t})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const bE=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Ol=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),$D=BigInt(1),Il=BigInt(2),um=(u,e)=>(u+e/Il)/e;function MD(u){const e=bE,t=BigInt(3),n=BigInt(6),r=BigInt(11),i=BigInt(22),a=BigInt(23),o=BigInt(44),s=BigInt(88),l=u*u*u%e,c=l*l*u%e,E=je(c,t,e)*c%e,d=je(E,t,e)*c%e,f=je(d,Il,e)*l%e,p=je(f,r,e)*f%e,C=je(p,i,e)*p%e,v=je(C,o,e)*C%e,A=je(v,s,e)*v%e,m=je(A,o,e)*C%e,g=je(m,t,e)*c%e,B=je(g,a,e)*p%e,D=je(B,n,e)*l%e,F=je(D,Il,e);if(!Kn.eql(Kn.sqr(F),u))throw new Error("Cannot find square root");return F}const Kn=Hq(bE,void 0,void 0,{sqrt:MD}),on=EH({a:BigInt(0),b:BigInt(7),Fp:Kn,n:Ol,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:u=>{const e=Ol,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-$D*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),r=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=t,a=BigInt("0x100000000000000000000000000000000"),o=um(i*u,e),s=um(-n*u,e);let l=P0(u-o*t-s*r,e),c=P0(-o*n-s*i,e);const E=l>a,d=c>a;if(E&&(l=e-l),d&&(c=e-c),l>a||c>a)throw new Error("splitScalar: Endomorphism failed, k="+u);return{k1neg:E,k1:l,k2neg:d,k2:c}}}},Tl),wE=BigInt(0),LD=u=>typeof u=="bigint"&&wEtypeof u=="bigint"&&wEr.charCodeAt(0)));t=ye(n,n),em[u]=t}return Tl(ye(t,...e))}const u5=u=>u.toRawBytes(!0).slice(1),Rd=u=>Hn(u,32),k9=u=>P0(u,bE),D4=u=>P0(u,Ol),e5=on.ProjectivePoint,fH=(u,e,t)=>e5.BASE.multiplyAndAddUnsafe(u,e,t);function Nd(u){let e=on.utils.normPrivateKeyToScalar(u),t=e5.fromPrivateKey(e);return{scalar:t.hasEvenY()?e:D4(-e),bytes:u5(t)}}function WD(u){if(!LD(u))throw new Error("bad x: need 0 < x < p");const e=k9(u*u),t=k9(e*u+BigInt(7));let n=MD(t);n%Il!==wE&&(n=k9(-n));const r=new e5(u,n,$D);return r.assertValidity(),r}function UD(...u){return D4(re(zl("BIP0340/challenge",...u)))}function pH(u){return Nd(u).bytes}function CH(u,e,t=Ey(32)){const n=Q0("message",u),{bytes:r,scalar:i}=Nd(e),a=Q0("auxRand",t,32),o=Rd(i^re(zl("BIP0340/aux",a))),s=zl("BIP0340/nonce",o,r,n),l=D4(re(s));if(l===wE)throw new Error("sign failed: k is zero");const{bytes:c,scalar:E}=Nd(l),d=UD(c,r,n),f=new Uint8Array(64);if(f.set(c,0),f.set(Rd(D4(E+d*i)),32),!qD(f,n,r))throw new Error("sign: Invalid signature produced");return f}function qD(u,e,t){const n=Q0("signature",u,64),r=Q0("message",e),i=Q0("publicKey",t,32);try{const a=WD(re(i)),o=re(n.subarray(0,32));if(!LD(o))return!1;const s=re(n.subarray(32,64));if(!dH(s))return!1;const l=UD(Rd(o),u5(a),r),c=fH(a,s,D4(-l));return!(!c||!c.hasEvenY()||c.toAffine().x!==o)}catch{return!1}}const hH={getPublicKey:pH,sign:CH,verify:qD,utils:{randomPrivateKey:on.utils.randomPrivateKey,lift_x:WD,pointToBytes:u5,numberToBytesBE:Hn,bytesToNumberBE:re,taggedHash:zl,mod:P0}},mH=sH(Kn,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(u=>u.map(e=>BigInt(e)))),AH=tH(Kn,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:Kn.create(BigInt("-11"))}),HD=lH(on.ProjectivePoint,u=>{const{x:e,y:t}=AH(Kn.create(u[0]));return mH(e,t)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:Kn.ORDER,m:1,k:128,expand:"xmd",hash:Tl}),gH=HD.hashToCurve,vH=HD.encodeToCurve,BH=Object.freeze(Object.defineProperty({__proto__:null,encodeToCurve:vH,hashToCurve:gH,schnorr:hH,secp256k1:on},Symbol.toStringTag,{value:"Module"}));function FH(u){const{r:e,s:t}=on.Signature.fromCompact(u.slice(2,130));return{r:vu(e,{size:32}),yParityAndS:vu(t,{size:32})}}function yH(u){const{r:e,s:t}=on.Signature.fromCompact(u.slice(2,130)),n=BigInt(`0x${u.slice(130)}`);return{r:vu(e,{size:32}),s:vu(t,{size:32}),v:n}}function DH(u){const{r:e,s:t,v:n}=u,r=n-27n;let i=t;if(r===1n){const a=en(t);a[0]|=128,i=Ae(a)}return{r:e,yParityAndS:i}}function bH({r:u,yParityAndS:e}){return`0x${new on.Signature(Hu(u),Hu(e)).toCompactHex()}`}function wH({r:u,s:e,v:t}){return`0x${new on.Signature(Hu(u),Hu(e)).toCompactHex()}${ju(t).slice(2)}`}const xH=Object.freeze(Object.defineProperty({__proto__:null,AbiConstructorNotFoundError:tp,AbiConstructorParamsNotFoundError:B4,AbiDecodingDataSizeInvalidError:d$,AbiDecodingDataSizeTooSmallError:tE,AbiDecodingZeroDataError:H4,AbiEncodingArrayLengthMismatchError:QF,AbiEncodingBytesSizeMismatchError:XF,AbiEncodingLengthMismatchError:np,AbiErrorInputsNotFoundError:YF,AbiErrorNotFoundError:yd,AbiErrorSignatureNotFoundError:rp,AbiEventNotFoundError:Dd,AbiEventSignatureEmptyTopicsError:ZF,AbiEventSignatureNotFoundError:JF,AbiFunctionNotFoundError:Pr,AbiFunctionOutputsNotFoundError:ip,AbiFunctionSignatureNotFoundError:uy,BaseError:eu,BaseFeeScalarError:Sy,BlockNotFoundError:Bp,BytesSizeMismatchError:ap,CallExecutionError:gp,ChainDisconnectedError:Aa,ChainDoesNotSupportContract:Cl,ChainMismatchError:FF,ChainNotFoundError:yF,CircularReferenceError:HF,ClientChainNotConfiguredError:Jf,ContractFunctionExecutionError:lE,ContractFunctionRevertedError:xl,ContractFunctionZeroDataError:wy,DataLengthTooLongError:DN,DataLengthTooShortError:bN,DecodeLogDataMismatch:Wn,DecodeLogTopicsMismatch:Ur,Eip1559FeesNotSupportedError:fE,EnsAvatarInvalidNftUriError:pi,EnsAvatarUnsupportedNamespaceError:Hy,EnsAvatarUriResolutionError:gE,EstimateGasExecutionError:_y,ExecutionRevertedError:mr,FeeCapTooHighError:Ln,FeeCapTooLowError:hl,FeeConflictError:vy,FilterTypeNotSupportedError:ay,HttpRequestError:Rn,InsufficientFundsError:vl,IntegerOutOfRangeError:cF,InternalRpcError:Or,IntrinsicGasTooHighError:Bl,IntrinsicGasTooLowError:Fl,InvalidAbiDecodingTypeError:ty,InvalidAbiEncodingTypeError:ey,InvalidAbiItemError:IF,InvalidAbiParameterError:jF,InvalidAbiParametersError:RF,InvalidAbiTypeParameterError:WF,InvalidAddressError:ge,InvalidArrayError:ny,InvalidBytesBooleanError:EF,InvalidChainIdError:Jc,InvalidDefinitionTypeError:ry,InvalidFunctionModifierError:LF,InvalidHexBooleanError:dF,InvalidHexValueError:fF,InvalidInputRpcError:Un,InvalidLegacyVError:hp,InvalidModifierError:MF,InvalidParameterError:NF,InvalidParamsRpcError:la,InvalidParenthesisError:KF,InvalidRequestRpcError:oa,InvalidSerializableTransactionError:By,InvalidSerializedTransactionError:sE,InvalidSerializedTransactionTypeError:Fy,InvalidSignatureError:Oi,InvalidStorageKeySizeError:yy,InvalidStructSignatureError:qF,JsonRpcVersionUnsupportedError:pa,LimitExceededRpcError:fa,MaxFeePerGasTooLowError:Ty,MethodNotFoundRpcError:sa,MethodNotSupportedRpcError:da,NonceMaxValueError:gl,NonceTooHighError:ml,NonceTooLowError:Al,OffsetOutOfBoundsError:wN,ParseRpcError:aa,ProviderDisconnectedError:ma,ProviderRpcError:Hr,RawContractError:cE,ResourceNotFoundRpcError:ca,ResourceUnavailableRpcError:Yt,RpcError:le,RpcRequestError:EE,SizeExceedsPaddingSizeError:Qf,SizeOverflowError:pF,SliceOffsetOutOfBoundsError:Gf,SolidityProtectedKeywordError:$F,SwitchChainError:pt,TimeoutError:kl,TipAboveFeeCapError:ra,TransactionExecutionError:Dy,TransactionNotFoundError:mp,TransactionReceiptNotFoundError:Ap,TransactionRejectedRpcError:Ea,TransactionTypeNotSupportedError:yl,UnauthorizedProviderError:Ca,UnknownNodeError:U4,UnknownRpcError:ky,UnknownSignatureError:UF,UnknownTypeError:zF,UnsupportedPackedAbiType:iy,UnsupportedProviderMethodError:ha,UrlRequiredError:Tp,UserRejectedRequestError:F0,WaitForTransactionReceiptTimeoutError:by,WebSocketRequestError:xy,assertCurrentChain:kp,assertRequest:La,assertTransactionEIP1559:Up,assertTransactionEIP2930:qp,assertTransactionLegacy:Hp,boolToBytes:hF,boolToHex:Qc,bytesToBigInt:Pd,bytesToBigint:Pd,bytesToBool:sD,bytesToHex:Ae,bytesToNumber:lD,bytesToRlp:kH,bytesToString:cD,ccipFetch:zp,checksumAddress:K4,compactSignatureToHex:bH,compactSignatureToSignature:Tq,concat:Ge,concatBytes:bF,concatHex:tn,createClient:mE,createPublicClient:Id,createTestClient:_W,createTransport:Y4,createWalletClient:Ka,custom:qa,decodeAbiParameters:qr,decodeDeployData:Sq,decodeErrorResult:Cp,decodeEventLog:Wa,decodeFunctionData:lL,decodeFunctionResult:Kr,defineBlock:gF,defineChain:Pt,defineTransaction:AF,defineTransactionReceipt:vF,defineTransactionRequest:IN,domainSeparator:sL,encodeAbiParameters:rn,encodeDeployData:$p,encodeErrorResult:cL,encodeEventTopics:$a,encodeFunctionData:an,encodeFunctionResult:dL,encodePacked:fL,etherUnits:up,extractChain:rL,fallback:_d,formatBlock:Zc,formatEther:oE,formatGwei:ne,formatLog:Ve,formatTransaction:W4,formatTransactionReceipt:Zf,formatTransactionRequest:Wr,formatUnits:v4,fromBytes:CL,fromHex:SN,fromRlp:Mp,getAbiItem:Zn,getAddress:a0,getChainContractAddress:Vr,getContract:BM,getContractAddress:pL,getContractError:ga,getCreate2Address:oD,getCreateAddress:aD,getEventSelector:rE,getEventSignature:oy,getFunctionSelector:Na,getFunctionSignature:op,getSerializedTransactionType:AD,getTransactionType:yp,getTypesForEIP712Domain:BE,gweiUnits:ep,hashDomain:Rp,hashMessage:Wp,hashTypedData:jp,hexToBigInt:Hu,hexToBool:Xf,hexToBytes:en,hexToCompactSignature:FH,hexToNumber:Ku,hexToRlp:_H,hexToSignature:yH,hexToString:Xc,http:Wy,isAddress:ae,isAddressEqual:vE,isBytes:Td,isHash:fD,isHex:zu,keccak256:B0,labelhash:qy,maxInt104:JW,maxInt112:uU,maxInt120:eU,maxInt128:tU,maxInt136:nU,maxInt144:rU,maxInt152:iU,maxInt16:WW,maxInt160:aU,maxInt168:oU,maxInt176:sU,maxInt184:lU,maxInt192:cU,maxInt200:EU,maxInt208:dU,maxInt216:fU,maxInt224:pU,maxInt232:CU,maxInt24:UW,maxInt240:hU,maxInt248:mU,maxInt256:AU,maxInt32:qW,maxInt40:HW,maxInt48:KW,maxInt56:VW,maxInt64:GW,maxInt72:QW,maxInt8:LW,maxInt80:XW,maxInt88:YW,maxInt96:ZW,maxUint104:lq,maxUint112:cq,maxUint120:Eq,maxUint128:dq,maxUint136:fq,maxUint144:pq,maxUint152:Cq,maxUint16:ZU,maxUint160:hq,maxUint168:mq,maxUint176:Aq,maxUint184:gq,maxUint192:vq,maxUint200:Bq,maxUint208:Fq,maxUint216:yq,maxUint224:Dq,maxUint232:bq,maxUint24:JU,maxUint240:wq,maxUint248:xq,maxUint256:kq,maxUint32:uq,maxUint40:eq,maxUint48:tq,maxUint56:nq,maxUint64:rq,maxUint72:iq,maxUint8:YU,maxUint80:aq,maxUint88:oq,maxUint96:sq,minInt104:TU,minInt112:PU,minInt120:OU,minInt128:IU,minInt136:zU,minInt144:jU,minInt152:RU,minInt16:vU,minInt160:NU,minInt168:$U,minInt176:MU,minInt184:LU,minInt192:WU,minInt200:UU,minInt208:qU,minInt216:HU,minInt224:KU,minInt232:VU,minInt24:BU,minInt240:GU,minInt248:QU,minInt256:XU,minInt32:FU,minInt40:yU,minInt48:DU,minInt56:bU,minInt64:wU,minInt72:xU,minInt8:gU,minInt80:kU,minInt88:_U,minInt96:SU,multicall3Abi:_l,namehash:Qo,numberToBytes:mF,numberToHex:vu,offchainLookup:Zy,offchainLookupAbiItem:Ip,offchainLookupSignature:Yy,pad:Et,padBytes:CF,padHex:dt,parseAbi:o$,parseAbiItem:s$,parseAbiParameter:l$,parseAbiParameters:c$,parseEther:_L,parseGwei:SL,parseTransaction:BL,parseUnits:Vp,presignMessagePrefix:CD,publicActions:kD,recoverAddress:Lp,recoverMessageAddress:hD,recoverPublicKey:pD,recoverTypedDataAddress:mD,rpcTransactionType:BF,serializeAccessList:Kp,serializeTransaction:bL,signatureToCompactSignature:DH,signatureToHex:wH,size:m0,slice:t0,sliceBytes:my,sliceHex:Ep,stringToBytes:kt,stringToHex:L4,stringify:z0,testActions:_D,toBytes:ue,toHex:ju,toRlp:Gr,transactionType:Yf,trim:te,validateTypedData:Np,verifyMessage:gL,verifyTypedData:vL,walletActions:SD,webSocket:TD,weiUnits:DF,zeroAddress:MW,zeroHash:_q},Symbol.toStringTag,{value:"Module"}));function Gr(u,e="hex"){const t=KD(u),n=ED(new Uint8Array(t.length));return t.encode(n),e==="hex"?Ae(n.bytes):n.bytes}function kH(u,e="bytes"){return Gr(u,e)}function _H(u,e="hex"){return Gr(u,e)}function KD(u){return Array.isArray(u)?SH(u.map(e=>KD(e))):TH(u)}function SH(u){const e=u.reduce((r,i)=>r+i.length,0),t=VD(e);return{length:e<=55?1+e:1+t+e,encode(r){e<=55?r.pushByte(192+e):(r.pushByte(247+t),t===1?r.pushUint8(e):t===2?r.pushUint16(e):t===3?r.pushUint24(e):r.pushUint32(e));for(const{encode:i}of u)i(r)}}}function TH(u){const e=typeof u=="string"?en(u):u,t=VD(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+t+e.length,encode(r){e.length===1&&e[0]<128?r.pushBytes(e):e.length<=55?(r.pushByte(128+e.length),r.pushBytes(e)):(r.pushByte(183+t),t===1?r.pushUint8(e.length):t===2?r.pushUint16(e.length):t===3?r.pushUint24(e.length):r.pushUint32(e.length),r.pushBytes(e))}}}function VD(u){if(u<2**8)return 1;if(u<2**16)return 2;if(u<2**24)return 3;if(u<2**32)return 4;throw new eu("Length is too large.")}const GD=Pt({id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-goerli.g.alchemy.com/v2"],webSocket:["wss://eth-goerli.g.alchemy.com/v2"]},infura:{http:["https://goerli.infura.io/v3"],webSocket:["wss://goerli.infura.io/ws/v3"]},default:{http:["https://rpc.ankr.com/eth_goerli"]},public:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli.etherscan.io"},default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0x56522D00C410a43BFfDF00a9A569489297385790",blockCreated:8765204},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:6507670}},testnet:!0}),PH=Pt({id:59140,name:"Linea Goerli Testnet",network:"linea-testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"},blockscout:{name:"Blockscout",url:"https://explorer.goerli.linea.build"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:498623}},testnet:!0}),QD=Pt({id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xc0497E381f536Be9ce14B0dD3817cBcAe57d2F62",blockCreated:16966585},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),OH=Pt({id:5001,name:"Mantle Testnet",network:"mantle",nativeCurrency:{decimals:18,name:"MNT",symbol:"MNT"},rpcUrls:{default:{http:["https://rpc.testnet.mantle.xyz"]},public:{http:["https://rpc.testnet.mantle.xyz"]}},blockExplorers:{etherscan:{name:"Mantle Testnet Explorer",url:"https://explorer.testnet.mantle.xyz"},default:{name:"Mantle Testnet Explorer",url:"https://explorer.testnet.mantle.xyz"}},testnet:!0}),IH=Pt({id:1442,name:"Polygon zkEVM Testnet",network:"polygon-zkevm-testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.public.zkevm-test.net"]},public:{http:["https://rpc.public.zkevm-test.net"]}},blockExplorers:{blockscout:{name:"Blockscout",url:"https://explorer.public.zkevm-test.net"},default:{name:"PolygonScan",url:"https://testnet-zkevm.polygonscan.com"}},testnet:!0,contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:525686}}}),zH=Pt({id:534351,name:"Scroll Sepolia",network:"scroll-sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rpc.scroll.io"]},public:{http:["https://sepolia-rpc.scroll.io"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-blockscout.scroll.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:9473}},testnet:!0}),jH=Pt({id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:751532},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0x21B000Fd62a880b2125A61e36a284BB757b76025",blockCreated:3914906}},testnet:!0});var XD=class extends Error{constructor({chainId:u,connectorId:e}){super(`Chain "${u}" not configured for connector "${e}".`),this.name="ChainNotConfiguredForConnectorError"}},We=class extends Error{constructor(){super(...arguments),this.name="ConnectorNotFoundError",this.message="Connector not found"}};function Ir(u){return typeof u=="string"?Number.parseInt(u,u.trim().substring(0,2)==="0x"?16:10):typeof u=="bigint"?Number(u):u}var YD={exports:{}};(function(u){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function r(s,l,c){this.fn=s,this.context=l,this.once=c||!1}function i(s,l,c,E,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var f=new r(c,E||s,d),p=t?t+l:l;return s._events[p]?s._events[p].fn?s._events[p]=[s._events[p],f]:s._events[p].push(f):(s._events[p]=f,s._eventsCount++),s}function a(s,l){--s._eventsCount===0?s._events=new n:delete s._events[l]}function o(){this._events=new n,this._eventsCount=0}o.prototype.eventNames=function(){var l=[],c,E;if(this._eventsCount===0)return l;for(E in c=this._events)e.call(c,E)&&l.push(t?E.slice(1):E);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},o.prototype.listeners=function(l){var c=t?t+l:l,E=this._events[c];if(!E)return[];if(E.fn)return[E.fn];for(var d=0,f=E.length,p=new Array(f);d{if(!e.has(u))throw TypeError("Cannot "+t)},Tu=(u,e,t)=>(t5(u,e,"read from private field"),t?t.call(u):e.get(u)),b0=(u,e,t)=>{if(e.has(u))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(u):e.set(u,t)},Jt=(u,e,t,n)=>(t5(u,e,"write to private field"),n?n.call(u,t):e.set(u,t),t),D0=(u,e,t)=>(t5(u,e,"access private method"),t),Z4=class extends NH{constructor({chains:u=[QD,GD],options:e}){super(),this.chains=u,this.options=e}getBlockExplorerUrls(u){const{default:e,...t}=u.blockExplorers??{};if(e)return[e.url,...Object.values(t).map(n=>n.url)]}isChainUnsupported(u){return!this.chains.some(e=>e.id===u)}setStorage(u){this.storage=u}};function $H(u){var t;if(!u)return"Injected";const e=n=>{if(n.isApexWallet)return"Apex Wallet";if(n.isAvalanche)return"Core Wallet";if(n.isBackpack)return"Backpack";if(n.isBifrost)return"Bifrost Wallet";if(n.isBitKeep)return"BitKeep";if(n.isBitski)return"Bitski";if(n.isBlockWallet)return"BlockWallet";if(n.isBraveWallet)return"Brave Wallet";if(n.isCoin98)return"Coin98 Wallet";if(n.isCoinbaseWallet)return"Coinbase Wallet";if(n.isDawn)return"Dawn Wallet";if(n.isDefiant)return"Defiant";if(n.isDesig)return"Desig Wallet";if(n.isEnkrypt)return"Enkrypt";if(n.isExodus)return"Exodus";if(n.isFordefi)return"Fordefi";if(n.isFrame)return"Frame";if(n.isFrontier)return"Frontier Wallet";if(n.isGamestop)return"GameStop Wallet";if(n.isHaqqWallet)return"HAQQ Wallet";if(n.isHyperPay)return"HyperPay Wallet";if(n.isImToken)return"ImToken";if(n.isHaloWallet)return"Halo Wallet";if(n.isKuCoinWallet)return"KuCoin Wallet";if(n.isMathWallet)return"MathWallet";if(n.isNovaWallet)return"Nova Wallet";if(n.isOkxWallet||n.isOKExWallet)return"OKX Wallet";if(n.isOneInchIOSWallet||n.isOneInchAndroidWallet)return"1inch Wallet";if(n.isOpera)return"Opera";if(n.isPhantom)return"Phantom";if(n.isPortal)return"Ripio Portal";if(n.isRabby)return"Rabby Wallet";if(n.isRainbow)return"Rainbow";if(n.isSafePal)return"SafePal Wallet";if(n.isStatus)return"Status";if(n.isSubWallet)return"SubWallet";if(n.isTalisman)return"Talisman";if(n.isTally)return"Taho";if(n.isTokenPocket)return"TokenPocket";if(n.isTokenary)return"Tokenary";if(n.isTrust||n.isTrustWallet)return"Trust Wallet";if(n.isTTWallet)return"TTWallet";if(n.isXDEFI)return"XDEFI Wallet";if(n.isZeal)return"Zeal";if(n.isZerion)return"Zerion";if(n.isMetaMask)return"MetaMask"};if((t=u.providers)!=null&&t.length){const n=new Set;let r=1;for(const a of u.providers){let o=e(a);o||(o=`Unknown Wallet #${r}`,r+=1),n.add(o)}const i=[...n];return i.length?i:i[0]??"Injected"}return e(u)??"Injected"}var k3,Fa=class extends Z4{constructor({chains:u,options:e}={}){const t={shimDisconnect:!0,getProvider(){if(typeof window>"u")return;const r=window.ethereum;return r!=null&&r.providers&&r.providers.length>0?r.providers[0]:r},...e};super({chains:u,options:t}),this.id="injected",b0(this,k3,void 0),this.shimDisconnectKey=`${this.id}.shimDisconnect`,this.onAccountsChanged=r=>{r.length===0?this.emit("disconnect"):this.emit("change",{account:a0(r[0])})},this.onChainChanged=r=>{const i=Ir(r),a=this.isChainUnsupported(i);this.emit("change",{chain:{id:i,unsupported:a}})},this.onDisconnect=async r=>{var i;r.code===1013&&await this.getProvider()&&await this.getAccount()||(this.emit("disconnect"),this.options.shimDisconnect&&((i=this.storage)==null||i.removeItem(this.shimDisconnectKey)))};const n=t.getProvider();if(typeof t.name=="string")this.name=t.name;else if(n){const r=$H(n);t.name?this.name=t.name(r):typeof r=="string"?this.name=r:this.name=r[0]}else this.name="Injected";this.ready=!!n}async connect({chainId:u}={}){var e;try{const t=await this.getProvider();if(!t)throw new We;t.on&&(t.on("accountsChanged",this.onAccountsChanged),t.on("chainChanged",this.onChainChanged),t.on("disconnect",this.onDisconnect)),this.emit("message",{type:"connecting"});const n=await t.request({method:"eth_requestAccounts"}),r=a0(n[0]);let i=await this.getChainId(),a=this.isChainUnsupported(i);return u&&i!==u&&(i=(await this.switchChain(u)).id,a=this.isChainUnsupported(i)),this.options.shimDisconnect&&((e=this.storage)==null||e.setItem(this.shimDisconnectKey,!0)),{account:r,chain:{id:i,unsupported:a}}}catch(t){throw this.isUserRejectedRequestError(t)?new F0(t):t.code===-32002?new Yt(t):t}}async disconnect(){var e;const u=await this.getProvider();u!=null&&u.removeListener&&(u.removeListener("accountsChanged",this.onAccountsChanged),u.removeListener("chainChanged",this.onChainChanged),u.removeListener("disconnect",this.onDisconnect),this.options.shimDisconnect&&((e=this.storage)==null||e.removeItem(this.shimDisconnectKey)))}async getAccount(){const u=await this.getProvider();if(!u)throw new We;const e=await u.request({method:"eth_accounts"});return a0(e[0])}async getChainId(){const u=await this.getProvider();if(!u)throw new We;return u.request({method:"eth_chainId"}).then(Ir)}async getProvider(){const u=this.options.getProvider();return u&&Jt(this,k3,u),Tu(this,k3)}async getWalletClient({chainId:u}={}){const[e,t]=await Promise.all([this.getProvider(),this.getAccount()]),n=this.chains.find(r=>r.id===u);if(!e)throw new Error("provider is required.");return Ka({account:t,chain:n,transport:qa(e)})}async isAuthorized(){var u;try{if(this.options.shimDisconnect&&!((u=this.storage)!=null&&u.getItem(this.shimDisconnectKey)))return!1;if(!await this.getProvider())throw new We;return!!await this.getAccount()}catch{return!1}}async switchChain(u){var n,r,i;const e=await this.getProvider();if(!e)throw new We;const t=vu(u);try{return await Promise.all([e.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}),new Promise(a=>this.on("change",({chain:o})=>{(o==null?void 0:o.id)===u&&a()}))]),this.chains.find(a=>a.id===u)??{id:u,name:`Chain ${t}`,network:`${t}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}}}catch(a){const o=this.chains.find(s=>s.id===u);if(!o)throw new XD({chainId:u,connectorId:this.id});if(a.code===4902||((r=(n=a==null?void 0:a.data)==null?void 0:n.originalError)==null?void 0:r.code)===4902)try{if(await e.request({method:"wallet_addEthereumChain",params:[{chainId:t,chainName:o.name,nativeCurrency:o.nativeCurrency,rpcUrls:[((i=o.rpcUrls.public)==null?void 0:i.http[0])??""],blockExplorerUrls:this.getBlockExplorerUrls(o)}]}),await this.getChainId()!==u)throw new F0(new Error("User rejected switch after adding network."));return o}catch(s){throw new F0(s)}throw this.isUserRejectedRequestError(a)?new F0(a):new pt(a)}}async watchAsset({address:u,decimals:e=18,image:t,symbol:n}){const r=await this.getProvider();if(!r)throw new We;return r.request({method:"wallet_watchAsset",params:{type:"ERC20",options:{address:u,decimals:e,image:t,symbol:n}}})}isUserRejectedRequestError(u){return u.code===4001}};k3=new WeakMap;var n5=(u,e,t)=>{if(!e.has(u))throw TypeError("Cannot "+t)},_9=(u,e,t)=>(n5(u,e,"read from private field"),t?t.call(u):e.get(u)),S9=(u,e,t)=>{if(e.has(u))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(u):e.set(u,t)},Ys=(u,e,t,n)=>(n5(u,e,"write to private field"),n?n.call(u,t):e.set(u,t),t),MH=(u,e,t)=>(n5(u,e,"access private method"),t),LH={VITE_REACT_APP_PROJECT_ID:"9d80089c30635ff84b5339d993d63fa1",BASE_URL:"/real-token/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const WH=u=>(e,t,n)=>{const r=n.subscribe;return n.subscribe=(a,o,s)=>{let l=a;if(o){const c=(s==null?void 0:s.equalityFn)||Object.is;let E=a(n.getState());l=d=>{const f=a(d);if(!c(E,f)){const p=E;o(E=f,p)}},s!=null&&s.fireImmediately&&o(E,E)}return r(l)},u(e,t,n)},UH=WH;function qH(u,e){let t;try{t=u()}catch{return}return{getItem:r=>{var i;const a=s=>s===null?null:JSON.parse(s,e==null?void 0:e.reviver),o=(i=t.getItem(r))!=null?i:null;return o instanceof Promise?o.then(a):a(o)},setItem:(r,i)=>t.setItem(r,JSON.stringify(i,e==null?void 0:e.replacer)),removeItem:r=>t.removeItem(r)}}const b4=u=>e=>{try{const t=u(e);return t instanceof Promise?t:{then(n){return b4(n)(t)},catch(n){return this}}}catch(t){return{then(n){return this},catch(n){return b4(n)(t)}}}},HH=(u,e)=>(t,n,r)=>{let i={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:v=>v,version:0,merge:(v,A)=>({...A,...v}),...e},a=!1;const o=new Set,s=new Set;let l;try{l=i.getStorage()}catch{}if(!l)return u((...v)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),t(...v)},n,r);const c=b4(i.serialize),E=()=>{const v=i.partialize({...n()});let A;const m=c({state:v,version:i.version}).then(g=>l.setItem(i.name,g)).catch(g=>{A=g});if(A)throw A;return m},d=r.setState;r.setState=(v,A)=>{d(v,A),E()};const f=u((...v)=>{t(...v),E()},n,r);let p;const C=()=>{var v;if(!l)return;a=!1,o.forEach(m=>m(n()));const A=((v=i.onRehydrateStorage)==null?void 0:v.call(i,n()))||void 0;return b4(l.getItem.bind(l))(i.name).then(m=>{if(m)return i.deserialize(m)}).then(m=>{if(m)if(typeof m.version=="number"&&m.version!==i.version){if(i.migrate)return i.migrate(m.state,m.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return m.state}).then(m=>{var g;return p=i.merge(m,(g=n())!=null?g:f),t(p,!0),E()}).then(()=>{A==null||A(p,void 0),a=!0,s.forEach(m=>m(p))}).catch(m=>{A==null||A(void 0,m)})};return r.persist={setOptions:v=>{i={...i,...v},v.getStorage&&(l=v.getStorage())},clearStorage:()=>{l==null||l.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>C(),hasHydrated:()=>a,onHydrate:v=>(o.add(v),()=>{o.delete(v)}),onFinishHydration:v=>(s.add(v),()=>{s.delete(v)})},C(),p||f},KH=(u,e)=>(t,n,r)=>{let i={storage:qH(()=>localStorage),partialize:C=>C,version:0,merge:(C,v)=>({...v,...C}),...e},a=!1;const o=new Set,s=new Set;let l=i.storage;if(!l)return u((...C)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),t(...C)},n,r);const c=()=>{const C=i.partialize({...n()});return l.setItem(i.name,{state:C,version:i.version})},E=r.setState;r.setState=(C,v)=>{E(C,v),c()};const d=u((...C)=>{t(...C),c()},n,r);let f;const p=()=>{var C,v;if(!l)return;a=!1,o.forEach(m=>{var g;return m((g=n())!=null?g:d)});const A=((v=i.onRehydrateStorage)==null?void 0:v.call(i,(C=n())!=null?C:d))||void 0;return b4(l.getItem.bind(l))(i.name).then(m=>{if(m)if(typeof m.version=="number"&&m.version!==i.version){if(i.migrate)return i.migrate(m.state,m.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return m.state}).then(m=>{var g;return f=i.merge(m,(g=n())!=null?g:d),t(f,!0),c()}).then(()=>{A==null||A(f,void 0),f=n(),a=!0,s.forEach(m=>m(f))}).catch(m=>{A==null||A(void 0,m)})};return r.persist={setOptions:C=>{i={...i,...C},C.storage&&(l=C.storage)},clearStorage:()=>{l==null||l.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>p(),hasHydrated:()=>a,onHydrate:C=>(o.add(C),()=>{o.delete(C)}),onFinishHydration:C=>(s.add(C),()=>{s.delete(C)})},i.skipHydration||p(),f||d},VH=(u,e)=>"getStorage"in e||"serialize"in e||"deserialize"in e?((LH?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),HH(u,e)):KH(u,e),GH=VH;var QH={VITE_REACT_APP_PROJECT_ID:"9d80089c30635ff84b5339d993d63fa1",BASE_URL:"/real-token/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const tm=u=>{let e;const t=new Set,n=(s,l)=>{const c=typeof s=="function"?s(e):s;if(!Object.is(c,e)){const E=e;e=l??(typeof c!="object"||c===null)?c:Object.assign({},e,c),t.forEach(d=>d(e,E))}},r=()=>e,o={setState:n,getState:r,subscribe:s=>(t.add(s),()=>t.delete(s)),destroy:()=>{(QH?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),t.clear()}};return e=u(n,r,o),o},XH=u=>u?tm(u):tm;function ZD(u,e){if(Object.is(u,e))return!0;if(typeof u!="object"||u===null||typeof e!="object"||e===null)return!1;if(u instanceof Map&&e instanceof Map){if(u.size!==e.size)return!1;for(const[n,r]of u)if(!Object.is(r,e.get(n)))return!1;return!0}if(u instanceof Set&&e instanceof Set){if(u.size!==e.size)return!1;for(const n of u)if(!e.has(n))return!1;return!0}const t=Object.keys(u);if(t.length!==Object.keys(e).length)return!1;for(let n=0;nC===E.id)||(s=[...s,p.chain]),l[E.id]=[...l[E.id]||[],...p.rpcUrls.http],p.rpcUrls.webSocket&&(c[E.id]=[...c[E.id]||[],...p.rpcUrls.webSocket]))}if(!d)throw new Error([`Could not find valid provider configuration for chain "${E.name}". `,"You may need to add `jsonRpcProvider` to `configureChains` with the chain's RPC URLs.","Read more: https://wagmi.sh/core/providers/jsonRpc"].join(` -`))}return{chains:s,publicClient:({chainId:E})=>{const d=s.find(C=>C.id===E)??u[0],f=l[d.id];if(!f||!f[0])throw new Error(`No providers configured for chain "${d.id}"`);const p=Id({batch:t,chain:d,transport:_d(f.map(C=>Wy(C,{timeout:o})),{rank:r,retryCount:i,retryDelay:a}),pollingInterval:n});return Object.assign(p,{chains:s})},webSocketPublicClient:({chainId:E})=>{const d=s.find(C=>C.id===E)??u[0],f=c[d.id];if(!f||!f[0])return;const p=Id({batch:t,chain:d,transport:_d(f.map(C=>TD(C,{timeout:o})),{rank:r,retryCount:i,retryDelay:a}),pollingInterval:n});return Object.assign(p,{chains:s})}}}var ZH=class extends Error{constructor({chainId:u,connectorId:e}){super(`Chain "${u}" not configured${e?` for connector "${e}"`:""}.`),this.name="ChainNotConfigured"}},JH=class extends Error{constructor(){super(...arguments),this.name="ConnectorAlreadyConnectedError",this.message="Connector already connected"}},uK=class extends Error{constructor(){super(...arguments),this.name="ConfigChainsNotFound",this.message="No chains were found on the wagmi config. Some functions that require a chain may not work."}},eK=class extends Error{constructor({connector:u}){super(`"${u.name}" does not support programmatic chain switching.`),this.name="SwitchChainNotSupportedError"}};function $d(u,e){if(u===e)return!0;if(u&&e&&typeof u=="object"&&typeof e=="object"){if(u.constructor!==e.constructor)return!1;let t,n;if(Array.isArray(u)&&Array.isArray(e)){if(t=u.length,t!=e.length)return!1;for(n=t;n--!==0;)if(!$d(u[n],e[n]))return!1;return!0}if(u.valueOf!==Object.prototype.valueOf)return u.valueOf()===e.valueOf();if(u.toString!==Object.prototype.toString)return u.toString()===e.toString();const r=Object.keys(u);if(t=r.length,t!==Object.keys(e).length)return!1;for(n=t;n--!==0;)if(!Object.prototype.hasOwnProperty.call(e,r[n]))return!1;for(n=t;n--!==0;){const i=r[n];if(i&&!$d(u[i],e[i]))return!1}return!0}return u!==u&&e!==e}var Md=(u,{find:e,replace:t})=>u&&e(u)?t(u):typeof u!="object"?u:Array.isArray(u)?u.map(n=>Md(n,{find:e,replace:t})):u instanceof Object?Object.entries(u).reduce((n,[r,i])=>({...n,[r]:Md(i,{find:e,replace:t})}),{}):u;function tK(u){const e=JSON.parse(u);return Md(e,{find:n=>typeof n=="string"&&n.startsWith("#bigint."),replace:n=>BigInt(n.replace("#bigint.",""))})}function nm(u){return typeof u=="number"?u:u==="wei"?0:Math.abs(DF[u])}function rm(u,e){return u.slice(0,e).join(".")||"."}function im(u,e){const{length:t}=u;for(let n=0;n{const a=typeof i=="bigint"?`#bigint.${i.toString()}`:i;return(e==null?void 0:e(r,a))||a},n),t??void 0)}var JD={getItem:u=>"",setItem:(u,e)=>null,removeItem:u=>null};function ub({deserialize:u=tK,key:e="wagmi",serialize:t=rK,storage:n}){return{...n,getItem:(r,i=null)=>{const a=n.getItem(`${e}.${r}`);try{return a?u(a):i}catch(o){return console.warn(o),i}},setItem:(r,i)=>{if(i===null)n.removeItem(`${e}.${r}`);else try{n.setItem(`${e}.${r}`,t(i))}catch(a){console.error(a)}},removeItem:r=>n.removeItem(`${e}.${r}`)}}var am="store",Ci,Po,Ld,eb,iK=class{constructor({autoConnect:u=!1,connectors:e=[new Fa],publicClient:t,storage:n=ub({storage:typeof window<"u"?window.localStorage:JD}),logger:r={warn:console.warn},webSocketPublicClient:i}){var l,c;S9(this,Ld),this.publicClients=new Map,this.webSocketPublicClients=new Map,S9(this,Ci,void 0),S9(this,Po,void 0),this.args={autoConnect:u,connectors:e,logger:r,publicClient:t,storage:n,webSocketPublicClient:i};let a="disconnected",o;if(u)try{const E=n.getItem(am),d=(l=E==null?void 0:E.state)==null?void 0:l.data;a=d!=null&&d.account?"reconnecting":"connecting",o=(c=d==null?void 0:d.chain)==null?void 0:c.id}catch{}const s=typeof e=="function"?e():e;s.forEach(E=>E.setStorage(n)),this.store=XH(UH(GH(()=>({connectors:s,publicClient:this.getPublicClient({chainId:o}),status:a,webSocketPublicClient:this.getWebSocketPublicClient({chainId:o})}),{name:am,storage:n,partialize:E=>{var d,f;return{...u&&{data:{account:(d=E==null?void 0:E.data)==null?void 0:d.account,chain:(f=E==null?void 0:E.data)==null?void 0:f.chain}},chains:E==null?void 0:E.chains}},version:2}))),this.storage=n,Ys(this,Po,n==null?void 0:n.getItem("wallet")),MH(this,Ld,eb).call(this),u&&typeof window<"u"&&setTimeout(async()=>await this.autoConnect(),0)}get chains(){return this.store.getState().chains}get connectors(){return this.store.getState().connectors}get connector(){return this.store.getState().connector}get data(){return this.store.getState().data}get error(){return this.store.getState().error}get lastUsedChainId(){var u,e;return(e=(u=this.data)==null?void 0:u.chain)==null?void 0:e.id}get publicClient(){return this.store.getState().publicClient}get status(){return this.store.getState().status}get subscribe(){return this.store.subscribe}get webSocketPublicClient(){return this.store.getState().webSocketPublicClient}setState(u){const e=typeof u=="function"?u(this.store.getState()):u;this.store.setState(e,!0)}clearState(){this.setState(u=>({...u,chains:void 0,connector:void 0,data:void 0,error:void 0,status:"disconnected"}))}async destroy(){var u,e;this.connector&&await((e=(u=this.connector).disconnect)==null?void 0:e.call(u)),Ys(this,Ci,!1),this.clearState(),this.store.destroy()}async autoConnect(){if(_9(this,Ci))return;Ys(this,Ci,!0),this.setState(t=>{var n;return{...t,status:(n=t.data)!=null&&n.account?"reconnecting":"connecting"}});const u=_9(this,Po)?[...this.connectors].sort(t=>t.id===_9(this,Po)?-1:1):this.connectors;let e=!1;for(const t of u){if(!t.ready||!t.isAuthorized||!await t.isAuthorized())continue;const r=await t.connect();this.setState(i=>({...i,connector:t,chains:t==null?void 0:t.chains,data:r,status:"connected"})),e=!0;break}return e||this.setState(t=>({...t,data:void 0,status:"disconnected"})),Ys(this,Ci,!1),this.data}setConnectors(u){this.args={...this.args,connectors:u};const e=typeof u=="function"?u():u;e.forEach(t=>t.setStorage(this.args.storage)),this.setState(t=>({...t,connectors:e}))}getPublicClient({chainId:u}={}){let e=this.publicClients.get(-1);if(e&&(e==null?void 0:e.chain.id)===u||(e=this.publicClients.get(u??-1),e))return e;const{publicClient:t}=this.args;return e=typeof t=="function"?t({chainId:u}):t,this.publicClients.set(u??-1,e),e}setPublicClient(u){var t,n;const e=(n=(t=this.data)==null?void 0:t.chain)==null?void 0:n.id;this.args={...this.args,publicClient:u},this.publicClients.clear(),this.setState(r=>({...r,publicClient:this.getPublicClient({chainId:e})}))}getWebSocketPublicClient({chainId:u}={}){let e=this.webSocketPublicClients.get(-1);if(e&&(e==null?void 0:e.chain.id)===u||(e=this.webSocketPublicClients.get(u??-1),e))return e;const{webSocketPublicClient:t}=this.args;return e=typeof t=="function"?t({chainId:u}):t,e&&this.webSocketPublicClients.set(u??-1,e),e}setWebSocketPublicClient(u){var t,n;const e=(n=(t=this.data)==null?void 0:t.chain)==null?void 0:n.id;this.args={...this.args,webSocketPublicClient:u},this.webSocketPublicClients.clear(),this.setState(r=>({...r,webSocketPublicClient:this.getWebSocketPublicClient({chainId:e})}))}setLastUsedConnector(u=null){var e;(e=this.storage)==null||e.setItem("wallet",u)}};Ci=new WeakMap;Po=new WeakMap;Ld=new WeakSet;eb=function(){const u=o=>{this.setState(s=>({...s,data:{...s.data,...o}}))},e=()=>{this.clearState()},t=o=>{this.setState(s=>({...s,error:o}))};this.store.subscribe(({connector:o})=>o,(o,s)=>{var l,c,E,d,f,p;(l=s==null?void 0:s.off)==null||l.call(s,"change",u),(c=s==null?void 0:s.off)==null||c.call(s,"disconnect",e),(E=s==null?void 0:s.off)==null||E.call(s,"error",t),o&&((d=o.on)==null||d.call(o,"change",u),(f=o.on)==null||f.call(o,"disconnect",e),(p=o.on)==null||p.call(o,"error",t))});const{publicClient:n,webSocketPublicClient:r}=this.args;(typeof n=="function"||typeof r=="function")&&this.store.subscribe(({data:o})=>{var s;return(s=o==null?void 0:o.chain)==null?void 0:s.id},o=>{this.setState(s=>({...s,publicClient:this.getPublicClient({chainId:o}),webSocketPublicClient:this.getWebSocketPublicClient({chainId:o})}))})};var Wd;function aK(u){const e=new iK(u);return Wd=e,e}function Ie(){if(!Wd)throw new Error("No wagmi config found. Ensure you have set up a config: https://wagmi.sh/react/config");return Wd}async function oK({chainId:u,connector:e}){const t=Ie(),n=t.connector;if(n&&e.id===n.id)throw new JH;try{t.setState(i=>({...i,status:"connecting"}));const r=await e.connect({chainId:u});return t.setLastUsedConnector(e.id),t.setState(i=>({...i,connector:e,chains:e==null?void 0:e.chains,data:r,status:"connected"})),t.storage.setItem("connected",!0),{...r,connector:e}}catch(r){throw t.setState(i=>({...i,status:i.connector?"connected":"disconnected"})),r}}async function sK(){const u=Ie();u.connector&&await u.connector.disconnect(),u.clearState(),u.storage.removeItem("connected")}var lK=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{name:"",type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{name:"",type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],cK=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{name:"",type:"bytes32"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{name:"",type:"bytes32"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}];function _t({chainId:u}={}){const e=Ie();return u&&e.getPublicClient({chainId:u})||e.publicClient}async function EK({chainId:u}={}){var n,r;return await((r=(n=Ie().connector)==null?void 0:n.getWalletClient)==null?void 0:r.call(n,{chainId:u}))||null}function Ud({chainId:u}={}){const e=Ie();return u&&e.getWebSocketPublicClient({chainId:u})||e.webSocketPublicClient}function dK(u,e){const t=Ie(),n=async()=>e(_t(u));return t.subscribe(({publicClient:i})=>i,n)}function fK(u,e){const t=Ie(),n=async()=>e(Ud(u));return t.subscribe(({webSocketPublicClient:i})=>i,n)}async function pK({chainId:u,contracts:e,blockNumber:t,blockTag:n,...r}){const i=_t({chainId:u});if(!i.chains)throw new uK;if(u&&i.chain.id!==u)throw new ZH({chainId:u});return i.multicall({allowFailure:r.allowFailure??!0,blockNumber:t,blockTag:n,contracts:e})}async function CK({address:u,account:e,chainId:t,abi:n,args:r,functionName:i,blockNumber:a,blockTag:o}){return _t({chainId:t}).readContract({abi:n,address:u,account:e,functionName:i,args:r,blockNumber:a,blockTag:o})}async function hK({contracts:u,blockNumber:e,blockTag:t,...n}){const{allowFailure:r=!0}=n;try{const i=_t(),a=u.reduce((c,E,d)=>{const f=E.chainId??i.chain.id;return{...c,[f]:[...c[f]||[],{contract:E,index:d}]}},{}),o=()=>Object.entries(a).map(([c,E])=>pK({allowFailure:r,chainId:parseInt(c),contracts:E.map(({contract:d})=>d),blockNumber:e,blockTag:t})),s=(await Promise.all(o())).flat(),l=Object.values(a).flatMap(c=>c.map(({index:E})=>E));return s.reduce((c,E,d)=>(c&&(c[l[d]]=E),c),[])}catch(i){if(i instanceof lE)throw i;const a=()=>u.map(o=>CK({...o,blockNumber:e,blockTag:t}));return r?(await Promise.allSettled(a())).map(o=>o.status==="fulfilled"?{result:o.value,status:"success"}:{error:o.reason,result:void 0,status:"failure"}):await Promise.all(a())}}async function mK({address:u,chainId:e,formatUnits:t,token:n}){const r=Ie(),i=_t({chainId:e});if(n){const l=async({abi:c})=>{const E={abi:c,address:n,chainId:e},[d,f,p]=await hK({allowFailure:!1,contracts:[{...E,functionName:"balanceOf",args:[u]},{...E,functionName:"decimals"},{...E,functionName:"symbol"}]});return{decimals:f,formatted:v4(d??"0",nm(t??f)),symbol:p,value:d}};try{return await l({abi:lK})}catch(c){if(c instanceof lE){const{symbol:E,...d}=await l({abi:cK});return{symbol:Xc(te(E,{dir:"right"})),...d}}throw c}}const a=[...r.publicClient.chains||[],...r.chains??[]],o=await i.getBalance({address:u}),s=a.find(l=>l.id===i.chain.id);return{decimals:(s==null?void 0:s.nativeCurrency.decimals)??18,formatted:v4(o??"0",nm(t??18)),symbol:(s==null?void 0:s.nativeCurrency.symbol)??"ETH",value:o}}function tb(){const{data:u,connector:e,status:t}=Ie();switch(t){case"connected":return{address:u==null?void 0:u.account,connector:e,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:t};case"reconnecting":return{address:u==null?void 0:u.account,connector:e,isConnected:!!(u!=null&&u.account),isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:t};case"connecting":return{address:u==null?void 0:u.account,connector:e,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:t};case"disconnected":return{address:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:t}}}function nb(){var r,i,a,o;const u=Ie(),e=(i=(r=u.data)==null?void 0:r.chain)==null?void 0:i.id,t=u.chains??[],n=[...((a=u.publicClient)==null?void 0:a.chains)||[],...t].find(s=>s.id===e)??{id:e,name:`Chain ${e}`,network:`${e}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}};return{chain:e?{...n,...(o=u.data)==null?void 0:o.chain,id:e}:void 0,chains:t}}async function AK(u){const e=await EK();if(!e)throw new We;return await e.signMessage({message:u.message})}async function gK({chainId:u}){const{connector:e}=Ie();if(!e)throw new We;if(!e.switchChain)throw new eK({connector:e});return e.switchChain(u)}function vK(u,{selector:e=t=>t}={}){const t=Ie(),n=()=>u(tb());return t.subscribe(({data:i,connector:a,status:o})=>e({address:i==null?void 0:i.account,connector:a,status:o}),n,{equalityFn:ZD})}function BK(u,{selector:e=t=>t}={}){const t=Ie(),n=()=>u(nb());return t.subscribe(({data:i,chains:a})=>{var o;return e({chainId:(o=i==null?void 0:i.chain)==null?void 0:o.id,chains:a})},n,{equalityFn:ZD})}async function FK({name:u,chainId:e}){const{normalize:t}=await xu(()=>import("./index-gx2zUO7q.js"),__vite__mapDeps([]));return await _t({chainId:e}).getEnsAvatar({name:t(u)})}async function yK({address:u,chainId:e}){return _t({chainId:e}).getEnsName({address:a0(u)})}async function DK({chainId:u}={}){return await _t({chainId:u}).getBlockNumber()}var rb={exports:{}},ib={};/** +`))}return{chains:s,publicClient:({chainId:E})=>{const d=s.find(C=>C.id===E)??u[0],f=l[d.id];if(!f||!f[0])throw new Error(`No providers configured for chain "${d.id}"`);const p=Id({batch:t,chain:d,transport:_d(f.map(C=>Wy(C,{timeout:o})),{rank:r,retryCount:i,retryDelay:a}),pollingInterval:n});return Object.assign(p,{chains:s})},webSocketPublicClient:({chainId:E})=>{const d=s.find(C=>C.id===E)??u[0],f=c[d.id];if(!f||!f[0])return;const p=Id({batch:t,chain:d,transport:_d(f.map(C=>TD(C,{timeout:o})),{rank:r,retryCount:i,retryDelay:a}),pollingInterval:n});return Object.assign(p,{chains:s})}}}var ZH=class extends Error{constructor({chainId:u,connectorId:e}){super(`Chain "${u}" not configured${e?` for connector "${e}"`:""}.`),this.name="ChainNotConfigured"}},JH=class extends Error{constructor(){super(...arguments),this.name="ConnectorAlreadyConnectedError",this.message="Connector already connected"}},uK=class extends Error{constructor(){super(...arguments),this.name="ConfigChainsNotFound",this.message="No chains were found on the wagmi config. Some functions that require a chain may not work."}},eK=class extends Error{constructor({connector:u}){super(`"${u.name}" does not support programmatic chain switching.`),this.name="SwitchChainNotSupportedError"}};function $d(u,e){if(u===e)return!0;if(u&&e&&typeof u=="object"&&typeof e=="object"){if(u.constructor!==e.constructor)return!1;let t,n;if(Array.isArray(u)&&Array.isArray(e)){if(t=u.length,t!=e.length)return!1;for(n=t;n--!==0;)if(!$d(u[n],e[n]))return!1;return!0}if(u.valueOf!==Object.prototype.valueOf)return u.valueOf()===e.valueOf();if(u.toString!==Object.prototype.toString)return u.toString()===e.toString();const r=Object.keys(u);if(t=r.length,t!==Object.keys(e).length)return!1;for(n=t;n--!==0;)if(!Object.prototype.hasOwnProperty.call(e,r[n]))return!1;for(n=t;n--!==0;){const i=r[n];if(i&&!$d(u[i],e[i]))return!1}return!0}return u!==u&&e!==e}var Md=(u,{find:e,replace:t})=>u&&e(u)?t(u):typeof u!="object"?u:Array.isArray(u)?u.map(n=>Md(n,{find:e,replace:t})):u instanceof Object?Object.entries(u).reduce((n,[r,i])=>({...n,[r]:Md(i,{find:e,replace:t})}),{}):u;function tK(u){const e=JSON.parse(u);return Md(e,{find:n=>typeof n=="string"&&n.startsWith("#bigint."),replace:n=>BigInt(n.replace("#bigint.",""))})}function nm(u){return typeof u=="number"?u:u==="wei"?0:Math.abs(DF[u])}function rm(u,e){return u.slice(0,e).join(".")||"."}function im(u,e){const{length:t}=u;for(let n=0;n{const a=typeof i=="bigint"?`#bigint.${i.toString()}`:i;return(e==null?void 0:e(r,a))||a},n),t??void 0)}var JD={getItem:u=>"",setItem:(u,e)=>null,removeItem:u=>null};function ub({deserialize:u=tK,key:e="wagmi",serialize:t=rK,storage:n}){return{...n,getItem:(r,i=null)=>{const a=n.getItem(`${e}.${r}`);try{return a?u(a):i}catch(o){return console.warn(o),i}},setItem:(r,i)=>{if(i===null)n.removeItem(`${e}.${r}`);else try{n.setItem(`${e}.${r}`,t(i))}catch(a){console.error(a)}},removeItem:r=>n.removeItem(`${e}.${r}`)}}var am="store",Ci,Po,Ld,eb,iK=class{constructor({autoConnect:u=!1,connectors:e=[new Fa],publicClient:t,storage:n=ub({storage:typeof window<"u"?window.localStorage:JD}),logger:r={warn:console.warn},webSocketPublicClient:i}){var l,c;S9(this,Ld),this.publicClients=new Map,this.webSocketPublicClients=new Map,S9(this,Ci,void 0),S9(this,Po,void 0),this.args={autoConnect:u,connectors:e,logger:r,publicClient:t,storage:n,webSocketPublicClient:i};let a="disconnected",o;if(u)try{const E=n.getItem(am),d=(l=E==null?void 0:E.state)==null?void 0:l.data;a=d!=null&&d.account?"reconnecting":"connecting",o=(c=d==null?void 0:d.chain)==null?void 0:c.id}catch{}const s=typeof e=="function"?e():e;s.forEach(E=>E.setStorage(n)),this.store=XH(UH(GH(()=>({connectors:s,publicClient:this.getPublicClient({chainId:o}),status:a,webSocketPublicClient:this.getWebSocketPublicClient({chainId:o})}),{name:am,storage:n,partialize:E=>{var d,f;return{...u&&{data:{account:(d=E==null?void 0:E.data)==null?void 0:d.account,chain:(f=E==null?void 0:E.data)==null?void 0:f.chain}},chains:E==null?void 0:E.chains}},version:2}))),this.storage=n,Ys(this,Po,n==null?void 0:n.getItem("wallet")),MH(this,Ld,eb).call(this),u&&typeof window<"u"&&setTimeout(async()=>await this.autoConnect(),0)}get chains(){return this.store.getState().chains}get connectors(){return this.store.getState().connectors}get connector(){return this.store.getState().connector}get data(){return this.store.getState().data}get error(){return this.store.getState().error}get lastUsedChainId(){var u,e;return(e=(u=this.data)==null?void 0:u.chain)==null?void 0:e.id}get publicClient(){return this.store.getState().publicClient}get status(){return this.store.getState().status}get subscribe(){return this.store.subscribe}get webSocketPublicClient(){return this.store.getState().webSocketPublicClient}setState(u){const e=typeof u=="function"?u(this.store.getState()):u;this.store.setState(e,!0)}clearState(){this.setState(u=>({...u,chains:void 0,connector:void 0,data:void 0,error:void 0,status:"disconnected"}))}async destroy(){var u,e;this.connector&&await((e=(u=this.connector).disconnect)==null?void 0:e.call(u)),Ys(this,Ci,!1),this.clearState(),this.store.destroy()}async autoConnect(){if(_9(this,Ci))return;Ys(this,Ci,!0),this.setState(t=>{var n;return{...t,status:(n=t.data)!=null&&n.account?"reconnecting":"connecting"}});const u=_9(this,Po)?[...this.connectors].sort(t=>t.id===_9(this,Po)?-1:1):this.connectors;let e=!1;for(const t of u){if(!t.ready||!t.isAuthorized||!await t.isAuthorized())continue;const r=await t.connect();this.setState(i=>({...i,connector:t,chains:t==null?void 0:t.chains,data:r,status:"connected"})),e=!0;break}return e||this.setState(t=>({...t,data:void 0,status:"disconnected"})),Ys(this,Ci,!1),this.data}setConnectors(u){this.args={...this.args,connectors:u};const e=typeof u=="function"?u():u;e.forEach(t=>t.setStorage(this.args.storage)),this.setState(t=>({...t,connectors:e}))}getPublicClient({chainId:u}={}){let e=this.publicClients.get(-1);if(e&&(e==null?void 0:e.chain.id)===u||(e=this.publicClients.get(u??-1),e))return e;const{publicClient:t}=this.args;return e=typeof t=="function"?t({chainId:u}):t,this.publicClients.set(u??-1,e),e}setPublicClient(u){var t,n;const e=(n=(t=this.data)==null?void 0:t.chain)==null?void 0:n.id;this.args={...this.args,publicClient:u},this.publicClients.clear(),this.setState(r=>({...r,publicClient:this.getPublicClient({chainId:e})}))}getWebSocketPublicClient({chainId:u}={}){let e=this.webSocketPublicClients.get(-1);if(e&&(e==null?void 0:e.chain.id)===u||(e=this.webSocketPublicClients.get(u??-1),e))return e;const{webSocketPublicClient:t}=this.args;return e=typeof t=="function"?t({chainId:u}):t,e&&this.webSocketPublicClients.set(u??-1,e),e}setWebSocketPublicClient(u){var t,n;const e=(n=(t=this.data)==null?void 0:t.chain)==null?void 0:n.id;this.args={...this.args,webSocketPublicClient:u},this.webSocketPublicClients.clear(),this.setState(r=>({...r,webSocketPublicClient:this.getWebSocketPublicClient({chainId:e})}))}setLastUsedConnector(u=null){var e;(e=this.storage)==null||e.setItem("wallet",u)}};Ci=new WeakMap;Po=new WeakMap;Ld=new WeakSet;eb=function(){const u=o=>{this.setState(s=>({...s,data:{...s.data,...o}}))},e=()=>{this.clearState()},t=o=>{this.setState(s=>({...s,error:o}))};this.store.subscribe(({connector:o})=>o,(o,s)=>{var l,c,E,d,f,p;(l=s==null?void 0:s.off)==null||l.call(s,"change",u),(c=s==null?void 0:s.off)==null||c.call(s,"disconnect",e),(E=s==null?void 0:s.off)==null||E.call(s,"error",t),o&&((d=o.on)==null||d.call(o,"change",u),(f=o.on)==null||f.call(o,"disconnect",e),(p=o.on)==null||p.call(o,"error",t))});const{publicClient:n,webSocketPublicClient:r}=this.args;(typeof n=="function"||typeof r=="function")&&this.store.subscribe(({data:o})=>{var s;return(s=o==null?void 0:o.chain)==null?void 0:s.id},o=>{this.setState(s=>({...s,publicClient:this.getPublicClient({chainId:o}),webSocketPublicClient:this.getWebSocketPublicClient({chainId:o})}))})};var Wd;function aK(u){const e=new iK(u);return Wd=e,e}function Ie(){if(!Wd)throw new Error("No wagmi config found. Ensure you have set up a config: https://wagmi.sh/react/config");return Wd}async function oK({chainId:u,connector:e}){const t=Ie(),n=t.connector;if(n&&e.id===n.id)throw new JH;try{t.setState(i=>({...i,status:"connecting"}));const r=await e.connect({chainId:u});return t.setLastUsedConnector(e.id),t.setState(i=>({...i,connector:e,chains:e==null?void 0:e.chains,data:r,status:"connected"})),t.storage.setItem("connected",!0),{...r,connector:e}}catch(r){throw t.setState(i=>({...i,status:i.connector?"connected":"disconnected"})),r}}async function sK(){const u=Ie();u.connector&&await u.connector.disconnect(),u.clearState(),u.storage.removeItem("connected")}var lK=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{name:"",type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{name:"",type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],cK=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{name:"",type:"bytes32"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{name:"",type:"bytes32"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}];function _t({chainId:u}={}){const e=Ie();return u&&e.getPublicClient({chainId:u})||e.publicClient}async function EK({chainId:u}={}){var n,r;return await((r=(n=Ie().connector)==null?void 0:n.getWalletClient)==null?void 0:r.call(n,{chainId:u}))||null}function Ud({chainId:u}={}){const e=Ie();return u&&e.getWebSocketPublicClient({chainId:u})||e.webSocketPublicClient}function dK(u,e){const t=Ie(),n=async()=>e(_t(u));return t.subscribe(({publicClient:i})=>i,n)}function fK(u,e){const t=Ie(),n=async()=>e(Ud(u));return t.subscribe(({webSocketPublicClient:i})=>i,n)}async function pK({chainId:u,contracts:e,blockNumber:t,blockTag:n,...r}){const i=_t({chainId:u});if(!i.chains)throw new uK;if(u&&i.chain.id!==u)throw new ZH({chainId:u});return i.multicall({allowFailure:r.allowFailure??!0,blockNumber:t,blockTag:n,contracts:e})}async function CK({address:u,account:e,chainId:t,abi:n,args:r,functionName:i,blockNumber:a,blockTag:o}){return _t({chainId:t}).readContract({abi:n,address:u,account:e,functionName:i,args:r,blockNumber:a,blockTag:o})}async function hK({contracts:u,blockNumber:e,blockTag:t,...n}){const{allowFailure:r=!0}=n;try{const i=_t(),a=u.reduce((c,E,d)=>{const f=E.chainId??i.chain.id;return{...c,[f]:[...c[f]||[],{contract:E,index:d}]}},{}),o=()=>Object.entries(a).map(([c,E])=>pK({allowFailure:r,chainId:parseInt(c),contracts:E.map(({contract:d})=>d),blockNumber:e,blockTag:t})),s=(await Promise.all(o())).flat(),l=Object.values(a).flatMap(c=>c.map(({index:E})=>E));return s.reduce((c,E,d)=>(c&&(c[l[d]]=E),c),[])}catch(i){if(i instanceof lE)throw i;const a=()=>u.map(o=>CK({...o,blockNumber:e,blockTag:t}));return r?(await Promise.allSettled(a())).map(o=>o.status==="fulfilled"?{result:o.value,status:"success"}:{error:o.reason,result:void 0,status:"failure"}):await Promise.all(a())}}async function mK({address:u,chainId:e,formatUnits:t,token:n}){const r=Ie(),i=_t({chainId:e});if(n){const l=async({abi:c})=>{const E={abi:c,address:n,chainId:e},[d,f,p]=await hK({allowFailure:!1,contracts:[{...E,functionName:"balanceOf",args:[u]},{...E,functionName:"decimals"},{...E,functionName:"symbol"}]});return{decimals:f,formatted:v4(d??"0",nm(t??f)),symbol:p,value:d}};try{return await l({abi:lK})}catch(c){if(c instanceof lE){const{symbol:E,...d}=await l({abi:cK});return{symbol:Xc(te(E,{dir:"right"})),...d}}throw c}}const a=[...r.publicClient.chains||[],...r.chains??[]],o=await i.getBalance({address:u}),s=a.find(l=>l.id===i.chain.id);return{decimals:(s==null?void 0:s.nativeCurrency.decimals)??18,formatted:v4(o??"0",nm(t??18)),symbol:(s==null?void 0:s.nativeCurrency.symbol)??"ETH",value:o}}function tb(){const{data:u,connector:e,status:t}=Ie();switch(t){case"connected":return{address:u==null?void 0:u.account,connector:e,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:t};case"reconnecting":return{address:u==null?void 0:u.account,connector:e,isConnected:!!(u!=null&&u.account),isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:t};case"connecting":return{address:u==null?void 0:u.account,connector:e,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:t};case"disconnected":return{address:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:t}}}function nb(){var r,i,a,o;const u=Ie(),e=(i=(r=u.data)==null?void 0:r.chain)==null?void 0:i.id,t=u.chains??[],n=[...((a=u.publicClient)==null?void 0:a.chains)||[],...t].find(s=>s.id===e)??{id:e,name:`Chain ${e}`,network:`${e}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}};return{chain:e?{...n,...(o=u.data)==null?void 0:o.chain,id:e}:void 0,chains:t}}async function AK(u){const e=await EK();if(!e)throw new We;return await e.signMessage({message:u.message})}async function gK({chainId:u}){const{connector:e}=Ie();if(!e)throw new We;if(!e.switchChain)throw new eK({connector:e});return e.switchChain(u)}function vK(u,{selector:e=t=>t}={}){const t=Ie(),n=()=>u(tb());return t.subscribe(({data:i,connector:a,status:o})=>e({address:i==null?void 0:i.account,connector:a,status:o}),n,{equalityFn:ZD})}function BK(u,{selector:e=t=>t}={}){const t=Ie(),n=()=>u(nb());return t.subscribe(({data:i,chains:a})=>{var o;return e({chainId:(o=i==null?void 0:i.chain)==null?void 0:o.id,chains:a})},n,{equalityFn:ZD})}async function FK({name:u,chainId:e}){const{normalize:t}=await xu(()=>import("./index-XXy2awPw.js"),__vite__mapDeps([]));return await _t({chainId:e}).getEnsAvatar({name:t(u)})}async function yK({address:u,chainId:e}){return _t({chainId:e}).getEnsName({address:a0(u)})}async function DK({chainId:u}={}){return await _t({chainId:u}).getBlockNumber()}var rb={exports:{}},ib={};/** * @license React * use-sync-external-store-shim/with-selector.production.min.js * @@ -267,10 +267,10 @@ PERFORMANCE OF THIS SOFTWARE. Required: ${a.toString()} Approved: ${o.toString()}`)),Object.keys(e).forEach(E=>{if(!E.includes(":")||n)return;const d=oo(e[E].accounts);d.includes(E)||(n=Dn("NON_CONFORMING_NAMESPACES",`${t} namespaces accounts don't satisfy namespace accounts for ${E} Required: ${E} - Approved: ${d.toString()}`))}),a.forEach(E=>{n||(gr(r[E].methods,i[E].methods)?gr(r[E].events,i[E].events)||(n=Dn("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${E}`)):n=Dn("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${E}`))}),n}function cCu(u){const e={};return Object.keys(u).forEach(t=>{var n;t.includes(":")?e[t]=u[t]:(n=u[t].chains)==null||n.forEach(r=>{e[r]={methods:u[t].methods,events:u[t].events}})}),e}function bA(u){return[...new Set(u.map(e=>e.includes(":")?e.split(":")[0]:e))]}function ECu(u){const e={};return Object.keys(u).forEach(t=>{if(t.includes(":"))e[t]=u[t];else{const n=oo(u[t].accounts);n==null||n.forEach(r=>{e[r]={accounts:u[t].accounts.filter(i=>i.includes(`${r}:`)),methods:u[t].methods,events:u[t].events}})}}),e}function rmu(u,e){return J5(u,!1)&&u<=e.max&&u>=e.min}function imu(){const u=ps();return new Promise(e=>{switch(u){case xe.browser:e(dCu());break;case xe.reactNative:e(fCu());break;case xe.node:e(pCu());break;default:e(!0)}})}function dCu(){return Y5()&&(navigator==null?void 0:navigator.onLine)}async function fCu(){if(A2()&&typeof global<"u"&&global!=null&&global.NetInfo){const u=await(global==null?void 0:global.NetInfo.fetch());return u==null?void 0:u.isConnected}return!0}function pCu(){return!0}function amu(u){switch(ps()){case xe.browser:CCu(u);break;case xe.reactNative:hCu(u);break}}function CCu(u){!A2()&&Y5()&&(window.addEventListener("online",()=>u(!0)),window.addEventListener("offline",()=>u(!1)))}function hCu(u){A2()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>u(e==null?void 0:e.isConnected)))}const o1={};class omu{static get(e){return o1[e]}static set(e,t){o1[e]=t}static delete(e){delete o1[e]}}var uk="eip155",mCu="store",ek="requestedChains",A6="wallet_addEthereumChain",r0,Yo,T3,g6,uC,tk,P3,v6,B6,nk,Gl,eC,mi,Io,Ql,tC,Xl,nC,Yl,rC,rk=class extends Z4{constructor(u){super({...u,options:{isNewChainsStale:!0,...u.options}}),b0(this,T3),b0(this,uC),b0(this,P3),b0(this,B6),b0(this,Gl),b0(this,mi),b0(this,Ql),b0(this,Xl),b0(this,Yl),this.id="walletConnect",this.name="WalletConnect",this.ready=!0,b0(this,r0,void 0),b0(this,Yo,void 0),this.onAccountsChanged=e=>{e.length===0?this.emit("disconnect"):this.emit("change",{account:a0(e[0])})},this.onChainChanged=e=>{const t=Number(e),n=this.isChainUnsupported(t);this.emit("change",{chain:{id:t,unsupported:n}})},this.onDisconnect=()=>{D0(this,mi,Io).call(this,[]),this.emit("disconnect")},this.onDisplayUri=e=>{this.emit("message",{type:"display_uri",data:e})},this.onConnect=()=>{this.emit("connect",{})},D0(this,T3,g6).call(this)}async connect({chainId:u,pairingTopic:e}={}){var t,n,r,i,a;try{let o=u;if(!o){const p=(t=this.storage)==null?void 0:t.getItem(mCu),C=(i=(r=(n=p==null?void 0:p.state)==null?void 0:n.data)==null?void 0:r.chain)==null?void 0:i.id;C&&!this.isChainUnsupported(C)?o=C:o=(a=this.chains[0])==null?void 0:a.id}if(!o)throw new Error("No chains found on connector.");const s=await this.getProvider();D0(this,B6,nk).call(this);const l=D0(this,P3,v6).call(this);if(s.session&&l&&await s.disconnect(),!s.session||l){const p=this.chains.filter(C=>C.id!==o).map(C=>C.id);this.emit("message",{type:"connecting"}),await s.connect({pairingTopic:e,chains:[o],optionalChains:p.length?p:void 0}),D0(this,mi,Io).call(this,this.chains.map(({id:C})=>C))}const c=await s.enable(),E=a0(c[0]),d=await this.getChainId(),f=this.isChainUnsupported(d);return{account:E,chain:{id:d,unsupported:f}}}catch(o){throw/user rejected/i.test(o==null?void 0:o.message)?new F0(o):o}}async disconnect(){const u=await this.getProvider();try{await u.disconnect()}catch(e){if(!/No matching key/i.test(e.message))throw e}finally{D0(this,Gl,eC).call(this),D0(this,mi,Io).call(this,[])}}async getAccount(){const{accounts:u}=await this.getProvider();return a0(u[0])}async getChainId(){const{chainId:u}=await this.getProvider();return u}async getProvider({chainId:u}={}){return Tu(this,r0)||await D0(this,T3,g6).call(this),u&&await this.switchChain(u),Tu(this,r0)}async getWalletClient({chainId:u}={}){const[e,t]=await Promise.all([this.getProvider({chainId:u}),this.getAccount()]),n=this.chains.find(r=>r.id===u);if(!e)throw new Error("provider is required.");return Ka({account:t,chain:n,transport:qa(e)})}async isAuthorized(){try{const[u,e]=await Promise.all([this.getAccount(),this.getProvider()]),t=D0(this,P3,v6).call(this);if(!u)return!1;if(t&&e.session){try{await e.disconnect()}catch{}return!1}return!0}catch{return!1}}async switchChain(u){var t,n;const e=this.chains.find(r=>r.id===u);if(!e)throw new pt(new Error("chain not found on connector."));try{const r=await this.getProvider(),i=D0(this,Xl,nC).call(this),a=D0(this,Yl,rC).call(this);if(!i.includes(u)&&a.includes(A6)){await r.request({method:A6,params:[{chainId:vu(e.id),blockExplorerUrls:[(n=(t=e.blockExplorers)==null?void 0:t.default)==null?void 0:n.url],chainName:e.name,nativeCurrency:e.nativeCurrency,rpcUrls:[...e.rpcUrls.default.http]}]});const s=D0(this,Ql,tC).call(this);s.push(u),D0(this,mi,Io).call(this,s)}return await r.request({method:"wallet_switchEthereumChain",params:[{chainId:vu(u)}]}),e}catch(r){const i=typeof r=="string"?r:r==null?void 0:r.message;throw/user rejected request/i.test(i)?new F0(r):new pt(r)}}};r0=new WeakMap;Yo=new WeakMap;T3=new WeakSet;g6=async function(){return!Tu(this,Yo)&&typeof window<"u"&&Jt(this,Yo,D0(this,uC,tk).call(this)),Tu(this,Yo)};uC=new WeakSet;tk=async function(){const{EthereumProvider:u,OPTIONAL_EVENTS:e,OPTIONAL_METHODS:t}=await xu(()=>import("./index.es-TVuT00BF.js"),__vite__mapDeps([0,1])),[n,...r]=this.chains.map(({id:i})=>i);if(n){const{projectId:i,showQrModal:a=!0,qrModalOptions:o,metadata:s,relayUrl:l}=this.options;Jt(this,r0,await u.init({showQrModal:a,qrModalOptions:o,projectId:i,optionalMethods:t,optionalEvents:e,chains:[n],optionalChains:r.length?r:void 0,rpcMap:Object.fromEntries(this.chains.map(c=>[c.id,c.rpcUrls.default.http[0]])),metadata:s,relayUrl:l}))}};P3=new WeakSet;v6=function(){if(D0(this,Yl,rC).call(this).includes(A6)||!this.options.isNewChainsStale)return!1;const e=D0(this,Ql,tC).call(this),t=this.chains.map(({id:r})=>r),n=D0(this,Xl,nC).call(this);return n.length&&!n.some(r=>t.includes(r))?!1:!t.every(r=>e.includes(r))};B6=new WeakSet;nk=function(){Tu(this,r0)&&(D0(this,Gl,eC).call(this),Tu(this,r0).on("accountsChanged",this.onAccountsChanged),Tu(this,r0).on("chainChanged",this.onChainChanged),Tu(this,r0).on("disconnect",this.onDisconnect),Tu(this,r0).on("session_delete",this.onDisconnect),Tu(this,r0).on("display_uri",this.onDisplayUri),Tu(this,r0).on("connect",this.onConnect))};Gl=new WeakSet;eC=function(){Tu(this,r0)&&(Tu(this,r0).removeListener("accountsChanged",this.onAccountsChanged),Tu(this,r0).removeListener("chainChanged",this.onChainChanged),Tu(this,r0).removeListener("disconnect",this.onDisconnect),Tu(this,r0).removeListener("session_delete",this.onDisconnect),Tu(this,r0).removeListener("display_uri",this.onDisplayUri),Tu(this,r0).removeListener("connect",this.onConnect))};mi=new WeakSet;Io=function(u){var e;(e=this.storage)==null||e.setItem(ek,u)};Ql=new WeakSet;tC=function(){var u;return((u=this.storage)==null?void 0:u.getItem(ek))??[]};Xl=new WeakSet;nC=function(){var n,r,i;if(!Tu(this,r0))return[];const u=(n=Tu(this,r0).session)==null?void 0:n.namespaces;return u?((i=(r=Zx(u)[uk])==null?void 0:r.chains)==null?void 0:i.map(a=>parseInt(a.split(":")[1]||"")))??[]:[]};Yl=new WeakSet;rC=function(){var n,r;if(!Tu(this,r0))return[];const u=(n=Tu(this,r0).session)==null?void 0:n.namespaces;return u?((r=Zx(u)[uk])==null?void 0:r.methods)??[]:[]};var zo,Ai,ACu=class extends Z4{constructor({chains:u,options:e}){super({chains:u,options:{reloadOnDisconnect:!1,...e}}),this.id="coinbaseWallet",this.name="Coinbase Wallet",this.ready=!0,b0(this,zo,void 0),b0(this,Ai,void 0),this.onAccountsChanged=t=>{t.length===0?this.emit("disconnect"):this.emit("change",{account:a0(t[0])})},this.onChainChanged=t=>{const n=Ir(t),r=this.isChainUnsupported(n);this.emit("change",{chain:{id:n,unsupported:r}})},this.onDisconnect=()=>{this.emit("disconnect")}}async connect({chainId:u}={}){try{const e=await this.getProvider();e.on("accountsChanged",this.onAccountsChanged),e.on("chainChanged",this.onChainChanged),e.on("disconnect",this.onDisconnect),this.emit("message",{type:"connecting"});const t=await e.enable(),n=a0(t[0]);let r=await this.getChainId(),i=this.isChainUnsupported(r);return u&&r!==u&&(r=(await this.switchChain(u)).id,i=this.isChainUnsupported(r)),{account:n,chain:{id:r,unsupported:i}}}catch(e){throw/(user closed modal|accounts received is empty)/i.test(e.message)?new F0(e):e}}async disconnect(){if(!Tu(this,Ai))return;const u=await this.getProvider();u.removeListener("accountsChanged",this.onAccountsChanged),u.removeListener("chainChanged",this.onChainChanged),u.removeListener("disconnect",this.onDisconnect),u.disconnect(),u.close()}async getAccount(){const e=await(await this.getProvider()).request({method:"eth_accounts"});return a0(e[0])}async getChainId(){const u=await this.getProvider();return Ir(u.chainId)}async getProvider(){var u;if(!Tu(this,Ai)){let e=(await xu(()=>import("./index-gYtQYNYB.js").then(a=>a.i),__vite__mapDeps([2,3]))).default;typeof e!="function"&&typeof e.default=="function"&&(e=e.default),Jt(this,zo,new e(this.options));const t=(u=Tu(this,zo).walletExtension)==null?void 0:u.getChainId(),n=this.chains.find(a=>this.options.chainId?a.id===this.options.chainId:a.id===t)||this.chains[0],r=this.options.chainId||(n==null?void 0:n.id),i=this.options.jsonRpcUrl||(n==null?void 0:n.rpcUrls.default.http[0]);Jt(this,Ai,Tu(this,zo).makeWeb3Provider(i,r))}return Tu(this,Ai)}async getWalletClient({chainId:u}={}){const[e,t]=await Promise.all([this.getProvider(),this.getAccount()]),n=this.chains.find(r=>r.id===u);if(!e)throw new Error("provider is required.");return Ka({account:t,chain:n,transport:qa(e)})}async isAuthorized(){try{return!!await this.getAccount()}catch{return!1}}async switchChain(u){var n;const e=await this.getProvider(),t=vu(u);try{return await e.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}),this.chains.find(r=>r.id===u)??{id:u,name:`Chain ${t}`,network:`${t}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}}}catch(r){const i=this.chains.find(a=>a.id===u);if(!i)throw new XD({chainId:u,connectorId:this.id});if(r.code===4902)try{return await e.request({method:"wallet_addEthereumChain",params:[{chainId:t,chainName:i.name,nativeCurrency:i.nativeCurrency,rpcUrls:[((n=i.rpcUrls.public)==null?void 0:n.http[0])??""],blockExplorerUrls:this.getBlockExplorerUrls(i)}]}),i}catch(a){throw new F0(a)}throw new pt(r)}}async watchAsset({address:u,decimals:e=18,image:t,symbol:n}){return(await this.getProvider()).request({method:"wallet_watchAsset",params:{type:"ERC20",options:{address:u,decimals:e,image:t,symbol:n}}})}};zo=new WeakMap;Ai=new WeakMap;var O3,gCu=class extends Fa{constructor({chains:u,options:e}={}){const t={name:"MetaMask",shimDisconnect:!0,getProvider(){function n(i){if(i!=null&&i.isMetaMask&&!(i.isBraveWallet&&!i._events&&!i._state)&&!i.isApexWallet&&!i.isAvalanche&&!i.isBitKeep&&!i.isBlockWallet&&!i.isCoin98&&!i.isFordefi&&!i.isMathWallet&&!(i.isOkxWallet||i.isOKExWallet)&&!(i.isOneInchIOSWallet||i.isOneInchAndroidWallet)&&!i.isOpera&&!i.isPortal&&!i.isRabby&&!i.isDefiant&&!i.isTokenPocket&&!i.isTokenary&&!i.isZeal&&!i.isZerion)return i}if(typeof window>"u")return;const r=window.ethereum;return r!=null&&r.providers?r.providers.find(n):n(r)},...e};super({chains:u,options:t}),this.id="metaMask",this.shimDisconnectKey=`${this.id}.shimDisconnect`,b0(this,O3,void 0),Jt(this,O3,t.UNSTABLE_shimOnConnectSelectAccount)}async connect({chainId:u}={}){var e,t,n,r;try{const i=await this.getProvider();if(!i)throw new We;i.on&&(i.on("accountsChanged",this.onAccountsChanged),i.on("chainChanged",this.onChainChanged),i.on("disconnect",this.onDisconnect)),this.emit("message",{type:"connecting"});let a=null;if(Tu(this,O3)&&((e=this.options)!=null&&e.shimDisconnect)&&!((t=this.storage)!=null&&t.getItem(this.shimDisconnectKey))&&(a=await this.getAccount().catch(()=>null),!!a))try{await i.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}),a=await this.getAccount()}catch(c){if(this.isUserRejectedRequestError(c))throw new F0(c);if(c.code===new Yt(c).code)throw c}if(!a){const l=await i.request({method:"eth_requestAccounts"});a=a0(l[0])}let o=await this.getChainId(),s=this.isChainUnsupported(o);return u&&o!==u&&(o=(await this.switchChain(u)).id,s=this.isChainUnsupported(o)),(n=this.options)!=null&&n.shimDisconnect&&((r=this.storage)==null||r.setItem(this.shimDisconnectKey,!0)),{account:a,chain:{id:o,unsupported:s},provider:i}}catch(i){throw this.isUserRejectedRequestError(i)?new F0(i):i.code===-32002?new Yt(i):i}}};O3=new WeakMap;var vCu=/(imtoken|metamask|rainbow|trust wallet|uniswap wallet|ledger)/i,lr,F6,ik,BCu=class extends Z4{constructor(){super(...arguments),b0(this,F6),this.id="walletConnectLegacy",this.name="WalletConnectLegacy",this.ready=!0,b0(this,lr,void 0),this.onAccountsChanged=u=>{u.length===0?this.emit("disconnect"):this.emit("change",{account:a0(u[0])})},this.onChainChanged=u=>{const e=Ir(u),t=this.isChainUnsupported(e);this.emit("change",{chain:{id:e,unsupported:t}})},this.onDisconnect=()=>{this.emit("disconnect")}}async connect({chainId:u}={}){var e,t,n,r,i,a;try{let o=u;if(!o){const p=(e=this.storage)==null?void 0:e.getItem("store"),C=(r=(n=(t=p==null?void 0:p.state)==null?void 0:t.data)==null?void 0:n.chain)==null?void 0:r.id;C&&!this.isChainUnsupported(C)&&(o=C)}const s=await this.getProvider({chainId:o,create:!0});s.on("accountsChanged",this.onAccountsChanged),s.on("chainChanged",this.onChainChanged),s.on("disconnect",this.onDisconnect),setTimeout(()=>this.emit("message",{type:"connecting"}),0);const l=await s.enable(),c=a0(l[0]),E=await this.getChainId(),d=this.isChainUnsupported(E),f=((a=(i=s.connector)==null?void 0:i.peerMeta)==null?void 0:a.name)??"";return vCu.test(f)&&(this.switchChain=D0(this,F6,ik)),{account:c,chain:{id:E,unsupported:d}}}catch(o){throw/user closed modal/i.test(o.message)?new F0(o):o}}async disconnect(){const u=await this.getProvider();await u.disconnect(),u.removeListener("accountsChanged",this.onAccountsChanged),u.removeListener("chainChanged",this.onChainChanged),u.removeListener("disconnect",this.onDisconnect),typeof localStorage<"u"&&localStorage.removeItem("walletconnect")}async getAccount(){const e=(await this.getProvider()).accounts;return a0(e[0])}async getChainId(){const u=await this.getProvider();return Ir(u.chainId)}async getProvider({chainId:u,create:e}={}){var t,n;if(!Tu(this,lr)||u||e){const r=(t=this.options)!=null&&t.infuraId?{}:this.chains.reduce((a,o)=>({...a,[o.id]:o.rpcUrls.default.http[0]}),{}),i=(await xu(()=>import("./index-zQvBO4FF.js"),__vite__mapDeps([4,1,5,3]))).default;Jt(this,lr,new i({...this.options,chainId:u,rpc:{...r,...(n=this.options)==null?void 0:n.rpc}})),Tu(this,lr).http=await Tu(this,lr).setHttpProvider(u)}return Tu(this,lr)}async getWalletClient({chainId:u}={}){const[e,t]=await Promise.all([this.getProvider({chainId:u}),this.getAccount()]),n=this.chains.find(r=>r.id===u);if(!e)throw new Error("provider is required.");return Ka({account:t,chain:n,transport:qa(e)})}async isAuthorized(){try{return!!await this.getAccount()}catch{return!1}}};lr=new WeakMap;F6=new WeakSet;ik=async function(u){const e=await this.getProvider(),t=vu(u);try{return await Promise.race([e.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}),new Promise(n=>this.on("change",({chain:r})=>{(r==null?void 0:r.id)===u&&n(u)}))]),this.chains.find(n=>n.id===u)??{id:u,name:`Chain ${t}`,network:`${t}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}}}catch(n){const r=typeof n=="string"?n:n==null?void 0:n.message;throw/user rejected request/i.test(r)?new F0(n):new pt(n)}};var ak={},v2={},iC={exports:{}},Hi=typeof Reflect=="object"?Reflect:null,wA=Hi&&typeof Hi.apply=="function"?Hi.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},I3;Hi&&typeof Hi.ownKeys=="function"?I3=Hi.ownKeys:Object.getOwnPropertySymbols?I3=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:I3=function(e){return Object.getOwnPropertyNames(e)};function FCu(u){console&&console.warn&&console.warn(u)}var ok=Number.isNaN||function(e){return e!==e};function Vu(){Vu.init.call(this)}iC.exports=Vu;iC.exports.once=wCu;Vu.EventEmitter=Vu;Vu.prototype._events=void 0;Vu.prototype._eventsCount=0;Vu.prototype._maxListeners=void 0;var xA=10;function B2(u){if(typeof u!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof u)}Object.defineProperty(Vu,"defaultMaxListeners",{enumerable:!0,get:function(){return xA},set:function(u){if(typeof u!="number"||u<0||ok(u))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+u+".");xA=u}});Vu.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};Vu.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||ok(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function sk(u){return u._maxListeners===void 0?Vu.defaultMaxListeners:u._maxListeners}Vu.prototype.getMaxListeners=function(){return sk(this)};Vu.prototype.emit=function(e){for(var t=[],n=1;n0&&(a=t[0]),a instanceof Error)throw a;var o=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var s=i[e];if(s===void 0)return!1;if(typeof s=="function")wA(s,this,t);else for(var l=s.length,c=fk(s,l),n=0;n0&&a.length>r&&!a.warned){a.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=u,o.type=e,o.count=a.length,FCu(o)}return u}Vu.prototype.addListener=function(e,t){return lk(this,e,t,!1)};Vu.prototype.on=Vu.prototype.addListener;Vu.prototype.prependListener=function(e,t){return lk(this,e,t,!0)};function yCu(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function ck(u,e,t){var n={fired:!1,wrapFn:void 0,target:u,type:e,listener:t},r=yCu.bind(n);return r.listener=t,n.wrapFn=r,r}Vu.prototype.once=function(e,t){return B2(t),this.on(e,ck(this,e,t)),this};Vu.prototype.prependOnceListener=function(e,t){return B2(t),this.prependListener(e,ck(this,e,t)),this};Vu.prototype.removeListener=function(e,t){var n,r,i,a,o;if(B2(t),r=this._events,r===void 0)return this;if(n=r[e],n===void 0)return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if(typeof n!="function"){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():DCu(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit("removeListener",e,o||t)}return this};Vu.prototype.off=Vu.prototype.removeListener;Vu.prototype.removeAllListeners=function(e){var t,n,r;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r=0;r--)this.removeListener(e,t[r]);return this};function Ek(u,e,t){var n=u._events;if(n===void 0)return[];var r=n[e];return r===void 0?[]:typeof r=="function"?t?[r.listener||r]:[r]:t?bCu(r):fk(r,r.length)}Vu.prototype.listeners=function(e){return Ek(this,e,!0)};Vu.prototype.rawListeners=function(e){return Ek(this,e,!1)};Vu.listenerCount=function(u,e){return typeof u.listenerCount=="function"?u.listenerCount(e):dk.call(u,e)};Vu.prototype.listenerCount=dk;function dk(u){var e=this._events;if(e!==void 0){var t=e[u];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}Vu.prototype.eventNames=function(){return this._eventsCount>0?I3(this._events):[]};function fk(u,e){for(var t=new Array(e),n=0;n(s&&(s.hash=n[0]),s));case"eth_getTransactionReceipt":{let s=n[0];try{s=(await this.sdk.txs.getBySafeTxHash(s)).txHash||s}catch{}return this.sdk.eth.getTransactionReceipt([s]).then(l=>(l&&(l.transactionHash=n[0]),l))}case"eth_estimateGas":return this.sdk.eth.getEstimateGas(n[0]);case"eth_call":return this.sdk.eth.call([n[0],n[1]]);case"eth_getLogs":return this.sdk.eth.getPastLogs([n[0]]);case"eth_gasPrice":return this.sdk.eth.getGasPrice();case"wallet_getPermissions":return this.sdk.wallet.getPermissions();case"wallet_requestPermissions":return this.sdk.wallet.requestPermissions(n[0]);case"safe_setSettings":return this.sdk.eth.setSafeSettings([n[0]]);default:throw Error(`"${e.method}" not implemented`)}}send(e,t){e||t("Undefined request"),this.request(e).then(n=>t(null,{jsonrpc:"2.0",id:e.id,result:n})).catch(n=>t(n,null))}}v2.SafeAppProvider=SCu;(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.SafeAppProvider=void 0;var e=v2;Object.defineProperty(u,"SafeAppProvider",{enumerable:!0,get:function(){return e.SafeAppProvider}})})(ak);var hk={},Zl={},mk={},Cs={},hs={};const TCu="@safe-global/safe-apps-sdk",PCu="8.1.0",OCu="SDK developed to integrate third-party apps with Safe app.",ICu="dist/src/index.js",zCu="dist/src/index.d.ts",jCu=["dist/**/*","src/**/*","CHANGELOG.md","README.md"],RCu=!1,NCu=["Safe","sdk","apps"],$Cu={test:"jest","format-dist":`sed -i '' 's/"files":/"_files":/' dist/package.json`,build:"yarn rimraf dist && tsc && yarn format-dist"},MCu="Safe (https://safe.global)",LCu="MIT",WCu={"@safe-global/safe-gateway-typescript-sdk":"^3.5.3",viem:"^1.0.0"},UCu={type:"git",url:"git+https://github.com/safe-global/safe-apps-sdk.git"},qCu={url:"https://github.com/safe-global/safe-apps-sdk/issues"},HCu="https://github.com/safe-global/safe-apps-sdk#readme",KCu={access:"public"},VCu={name:TCu,version:PCu,description:OCu,main:ICu,typings:zCu,_files:jCu,sideEffects:RCu,keywords:NCu,scripts:$Cu,author:MCu,license:LCu,dependencies:WCu,repository:UCu,bugs:qCu,homepage:HCu,publishConfig:KCu};var GCu=mu&&mu.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(hs,"__esModule",{value:!0});hs.getSDKVersion=void 0;const QCu=GCu(VCu),XCu=()=>QCu.default.version.split("-")[0];hs.getSDKVersion=XCu;var y2={};Object.defineProperty(y2,"__esModule",{value:!0});y2.generateRequestId=void 0;const YCu=u=>u.toString(16).padStart(2,"0"),ZCu=u=>{const e=new Uint8Array((u||40)/2);return window.crypto.getRandomValues(e),Array.from(e,YCu).join("")},JCu=()=>typeof window<"u"?ZCu(10):new Date().getTime().toString(36);y2.generateRequestId=JCu;Object.defineProperty(Cs,"__esModule",{value:!0});Cs.MessageFormatter=void 0;const uhu=hs,ehu=y2;class D2{}Cs.MessageFormatter=D2;D2.makeRequest=(u,e)=>({id:(0,ehu.generateRequestId)(),method:u,params:e,env:{sdkVersion:(0,uhu.getSDKVersion)()}});D2.makeResponse=(u,e,t)=>({id:u,success:!0,version:t,data:e});D2.makeErrorResponse=(u,e,t)=>({id:u,success:!1,error:e,version:t});var ei={};(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.RestrictedMethods=u.Methods=void 0,function(e){e.sendTransactions="sendTransactions",e.rpcCall="rpcCall",e.getChainInfo="getChainInfo",e.getSafeInfo="getSafeInfo",e.getTxBySafeTxHash="getTxBySafeTxHash",e.getSafeBalances="getSafeBalances",e.signMessage="signMessage",e.signTypedMessage="signTypedMessage",e.getEnvironmentInfo="getEnvironmentInfo",e.getOffChainSignature="getOffChainSignature",e.requestAddressBook="requestAddressBook",e.wallet_getPermissions="wallet_getPermissions",e.wallet_requestPermissions="wallet_requestPermissions"}(u.Methods||(u.Methods={})),function(e){e.requestAddressBook="requestAddressBook"}(u.RestrictedMethods||(u.RestrictedMethods={}))})(ei);(function(u){var e=mu&&mu.__createBinding||(Object.create?function(i,a,o,s){s===void 0&&(s=o);var l=Object.getOwnPropertyDescriptor(a,o);(!l||("get"in l?!a.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(i,s,l)}:function(i,a,o,s){s===void 0&&(s=o),i[s]=a[o]}),t=mu&&mu.__exportStar||function(i,a){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&e(a,i,o)};Object.defineProperty(u,"__esModule",{value:!0});const n=Cs;class r{constructor(a=null,o=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer=typeof window>"u",this.isValidMessage=({origin:s,data:l,source:c})=>{const E=!l,d=!this.isServer&&c===window.parent,p=(typeof l.version<"u"&&parseInt(l.version.split(".")[0]))>=1;let C=!0;return Array.isArray(this.allowedOrigins)&&(C=this.allowedOrigins.find(v=>v.test(s))!==void 0),!E&&d&&p&&C},this.logIncomingMessage=s=>{console.info(`Safe Apps SDK v1: A message was received from origin ${s.origin}. `,s.data)},this.onParentMessage=s=>{this.isValidMessage(s)&&(this.debugMode&&this.logIncomingMessage(s),this.handleIncomingMessage(s.data))},this.handleIncomingMessage=s=>{const{id:l}=s,c=this.callbacks.get(l);c&&(c(s),this.callbacks.delete(l))},this.send=(s,l)=>{const c=n.MessageFormatter.makeRequest(s,l);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(c,"*"),new Promise((E,d)=>{this.callbacks.set(c.id,f=>{if(!f.success){d(new Error(f.error));return}E(f)})})},this.allowedOrigins=a,this.debugMode=o,this.isServer||window.addEventListener("message",this.onParentMessage)}}u.default=r,t(ei,u)})(mk);var b2={},w2={},x2={};Object.defineProperty(x2,"__esModule",{value:!0});x2.isObjectEIP712TypedData=void 0;const thu=u=>typeof u=="object"&&u!=null&&"domain"in u&&"types"in u&&"message"in u;x2.isObjectEIP712TypedData=thu;var Ak={};Object.defineProperty(Ak,"__esModule",{value:!0});var gk={},vk={},Nn={},Dt={},aC=mu&&mu.__awaiter||function(u,e,t,n){function r(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function o(c){try{l(n.next(c))}catch(E){a(E)}}function s(c){try{l(n.throw(c))}catch(E){a(E)}}function l(c){c.done?i(c.value):r(c.value).then(o,s)}l((n=n.apply(u,e||[])).next())})};Object.defineProperty(Dt,"__esModule",{value:!0});Dt.deleteData=Dt.fetchData=Dt.stringifyQuery=Dt.insertParams=void 0;const nhu=u=>typeof u=="object"&&u!==null&&"code"in u&&"message"in u;function rhu(u,e,t){return u.replace(new RegExp(`\\{${e}\\}`,"g"),t)}function ihu(u,e){return e?Object.keys(e).reduce((t,n)=>rhu(t,n,String(e[n])),u):u}Dt.insertParams=ihu;function ahu(u){if(!u)return"";const e=new URLSearchParams;Object.keys(u).forEach(n=>{u[n]!=null&&e.append(n,String(u[n]))});const t=e.toString();return t?`?${t}`:""}Dt.stringifyQuery=ahu;function Bk(u){return aC(this,void 0,void 0,function*(){let e;try{e=yield u.json()}catch{if(u.headers&&u.headers.get("content-length")!=="0")throw new Error(`Invalid response content: ${u.statusText}`)}if(!u.ok){const t=nhu(e)?`${e.code}: ${e.message}`:u.statusText;throw new Error(t)}return e})}function ohu(u,e){return aC(this,void 0,void 0,function*(){let t;e!=null&&(t={method:"POST",body:typeof e=="string"?e:JSON.stringify(e),headers:{"Content-Type":"application/json"}});const n=yield fetch(u,t);return Bk(n)})}Dt.fetchData=ohu;function shu(u){return aC(this,void 0,void 0,function*(){const t=yield fetch(u,{method:"DELETE"});return Bk(t)})}Dt.deleteData=shu;Object.defineProperty(Nn,"__esModule",{value:!0});Nn.deleteEndpoint=Nn.getEndpoint=Nn.postEndpoint=void 0;const _a=Dt;function oC(u,e,t,n){const r=(0,_a.insertParams)(e,t),i=(0,_a.stringifyQuery)(n);return`${u}${r}${i}`}function lhu(u,e,t){const n=oC(u,e,t==null?void 0:t.path,t==null?void 0:t.query);return(0,_a.fetchData)(n,t==null?void 0:t.body)}Nn.postEndpoint=lhu;function chu(u,e,t,n){if(n)return(0,_a.fetchData)(n);const r=oC(u,e,t==null?void 0:t.path,t==null?void 0:t.query);return(0,_a.fetchData)(r)}Nn.getEndpoint=chu;function Ehu(u,e,t){const n=oC(u,e,t==null?void 0:t.path);return(0,_a.deleteData)(n)}Nn.deleteEndpoint=Ehu;var k2={};Object.defineProperty(k2,"__esModule",{value:!0});k2.DEFAULT_BASE_URL=void 0;k2.DEFAULT_BASE_URL="https://safe-client.safe.global";var Fk={};(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.ImplementationVersionState=void 0,function(e){e.UP_TO_DATE="UP_TO_DATE",e.OUTDATED="OUTDATED",e.UNKNOWN="UNKNOWN"}(u.ImplementationVersionState||(u.ImplementationVersionState={}))})(Fk);var yk={};(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.SafeAppSocialPlatforms=u.SafeAppFeatures=u.SafeAppAccessPolicyTypes=void 0,function(e){e.NoRestrictions="NO_RESTRICTIONS",e.DomainAllowlist="DOMAIN_ALLOWLIST"}(u.SafeAppAccessPolicyTypes||(u.SafeAppAccessPolicyTypes={})),function(e){e.BATCHED_TRANSACTIONS="BATCHED_TRANSACTIONS"}(u.SafeAppFeatures||(u.SafeAppFeatures={})),function(e){e.TWITTER="TWITTER",e.GITHUB="GITHUB",e.DISCORD="DISCORD"}(u.SafeAppSocialPlatforms||(u.SafeAppSocialPlatforms={}))})(yk);var Dk={};(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.LabelValue=u.DetailedExecutionInfoType=u.TransactionListItemType=u.ConflictType=u.TransactionInfoType=u.SettingsInfoType=u.TransactionTokenType=u.TransferDirection=u.TransactionStatus=u.Operation=void 0,function(e){e[e.CALL=0]="CALL",e[e.DELEGATE=1]="DELEGATE"}(u.Operation||(u.Operation={})),function(e){e.AWAITING_CONFIRMATIONS="AWAITING_CONFIRMATIONS",e.AWAITING_EXECUTION="AWAITING_EXECUTION",e.CANCELLED="CANCELLED",e.FAILED="FAILED",e.SUCCESS="SUCCESS"}(u.TransactionStatus||(u.TransactionStatus={})),function(e){e.INCOMING="INCOMING",e.OUTGOING="OUTGOING",e.UNKNOWN="UNKNOWN"}(u.TransferDirection||(u.TransferDirection={})),function(e){e.ERC20="ERC20",e.ERC721="ERC721",e.NATIVE_COIN="NATIVE_COIN"}(u.TransactionTokenType||(u.TransactionTokenType={})),function(e){e.SET_FALLBACK_HANDLER="SET_FALLBACK_HANDLER",e.ADD_OWNER="ADD_OWNER",e.REMOVE_OWNER="REMOVE_OWNER",e.SWAP_OWNER="SWAP_OWNER",e.CHANGE_THRESHOLD="CHANGE_THRESHOLD",e.CHANGE_IMPLEMENTATION="CHANGE_IMPLEMENTATION",e.ENABLE_MODULE="ENABLE_MODULE",e.DISABLE_MODULE="DISABLE_MODULE",e.SET_GUARD="SET_GUARD",e.DELETE_GUARD="DELETE_GUARD"}(u.SettingsInfoType||(u.SettingsInfoType={})),function(e){e.TRANSFER="Transfer",e.SETTINGS_CHANGE="SettingsChange",e.CUSTOM="Custom",e.CREATION="Creation"}(u.TransactionInfoType||(u.TransactionInfoType={})),function(e){e.NONE="None",e.HAS_NEXT="HasNext",e.END="End"}(u.ConflictType||(u.ConflictType={})),function(e){e.TRANSACTION="TRANSACTION",e.LABEL="LABEL",e.CONFLICT_HEADER="CONFLICT_HEADER",e.DATE_LABEL="DATE_LABEL"}(u.TransactionListItemType||(u.TransactionListItemType={})),function(e){e.MULTISIG="MULTISIG",e.MODULE="MODULE"}(u.DetailedExecutionInfoType||(u.DetailedExecutionInfoType={})),function(e){e.Queued="Queued",e.Next="Next"}(u.LabelValue||(u.LabelValue={}))})(Dk);var bk={};(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.FEATURES=u.GAS_PRICE_TYPE=u.RPC_AUTHENTICATION=void 0,function(e){e.API_KEY_PATH="API_KEY_PATH",e.NO_AUTHENTICATION="NO_AUTHENTICATION",e.UNKNOWN="UNKNOWN"}(u.RPC_AUTHENTICATION||(u.RPC_AUTHENTICATION={})),function(e){e.ORACLE="ORACLE",e.FIXED="FIXED",e.FIXED_1559="FIXED1559",e.UNKNOWN="UNKNOWN"}(u.GAS_PRICE_TYPE||(u.GAS_PRICE_TYPE={})),function(e){e.ERC721="ERC721",e.SAFE_APPS="SAFE_APPS",e.CONTRACT_INTERACTION="CONTRACT_INTERACTION",e.DOMAIN_LOOKUP="DOMAIN_LOOKUP",e.SPENDING_LIMIT="SPENDING_LIMIT",e.EIP1559="EIP1559",e.SAFE_TX_GAS_OPTIONAL="SAFE_TX_GAS_OPTIONAL",e.TX_SIMULATION="TX_SIMULATION",e.EIP1271="EIP1271"}(u.FEATURES||(u.FEATURES={}))})(bk);var wk={};(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.TokenType=void 0,function(e){e.ERC20="ERC20",e.ERC721="ERC721",e.NATIVE_TOKEN="NATIVE_TOKEN"}(u.TokenType||(u.TokenType={}))})(wk);var xk={};Object.defineProperty(xk,"__esModule",{value:!0});var kk={};Object.defineProperty(kk,"__esModule",{value:!0});var _k={};(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.SafeMessageStatus=u.SafeMessageListItemType=void 0,function(e){e.DATE_LABEL="DATE_LABEL",e.MESSAGE="MESSAGE"}(u.SafeMessageListItemType||(u.SafeMessageListItemType={})),function(e){e.NEEDS_CONFIRMATION="NEEDS_CONFIRMATION",e.CONFIRMED="CONFIRMED"}(u.SafeMessageStatus||(u.SafeMessageStatus={}))})(_k);var Sk={};(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.DeviceType=void 0,function(e){e.ANDROID="ANDROID",e.IOS="IOS",e.WEB="WEB"}(u.DeviceType||(u.DeviceType={}))})(Sk);(function(u){var e=mu&&mu.__createBinding||(Object.create?function(M,j,Y,uu){uu===void 0&&(uu=Y);var J=Object.getOwnPropertyDescriptor(j,Y);(!J||("get"in J?!j.__esModule:J.writable||J.configurable))&&(J={enumerable:!0,get:function(){return j[Y]}}),Object.defineProperty(M,uu,J)}:function(M,j,Y,uu){uu===void 0&&(uu=Y),M[uu]=j[Y]}),t=mu&&mu.__exportStar||function(M,j){for(var Y in M)Y!=="default"&&!Object.prototype.hasOwnProperty.call(j,Y)&&e(j,M,Y)};Object.defineProperty(u,"__esModule",{value:!0}),u.unregisterDevice=u.unregisterSafe=u.registerDevice=u.getDelegates=u.confirmSafeMessage=u.proposeSafeMessage=u.getSafeMessage=u.getSafeMessages=u.getDecodedData=u.getMasterCopies=u.getSafeApps=u.getChainConfig=u.getChainsConfig=u.proposeTransaction=u.getNonces=u.postSafeGasEstimation=u.getTransactionDetails=u.getTransactionQueue=u.getTransactionHistory=u.getCollectiblesPage=u.getCollectibles=u.getOwnedSafes=u.getFiatCurrencies=u.getBalances=u.getMultisigTransactions=u.getModuleTransactions=u.getIncomingTransfers=u.getSafeInfo=u.setBaseUrl=void 0;const n=Nn,r=k2;t(Fk,u),t(yk,u),t(Dk,u),t(bk,u),t(wk,u),t(xk,u),t(kk,u),t(_k,u),t(Sk,u);let i=r.DEFAULT_BASE_URL;const a=M=>{i=M};u.setBaseUrl=a;function o(M,j){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}",{path:{chainId:M,address:j}})}u.getSafeInfo=o;function s(M,j,Y,uu){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/incoming-transfers/",{path:{chainId:M,address:j},query:Y},uu)}u.getIncomingTransfers=s;function l(M,j,Y,uu){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/module-transactions/",{path:{chainId:M,address:j},query:Y},uu)}u.getModuleTransactions=l;function c(M,j,Y,uu){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/multisig-transactions/",{path:{chainId:M,address:j},query:Y},uu)}u.getMultisigTransactions=c;function E(M,j,Y="usd",uu={}){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/balances/{currency}",{path:{chainId:M,address:j,currency:Y},query:uu})}u.getBalances=E;function d(){return(0,n.getEndpoint)(i,"/v1/balances/supported-fiat-codes")}u.getFiatCurrencies=d;function f(M,j){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/owners/{address}/safes",{path:{chainId:M,address:j}})}u.getOwnedSafes=f;function p(M,j,Y={}){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:M,address:j},query:Y})}u.getCollectibles=p;function C(M,j,Y={},uu){return(0,n.getEndpoint)(i,"/v2/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:M,address:j},query:Y},uu)}u.getCollectiblesPage=C;function v(M,j,Y){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/transactions/history",{path:{chainId:M,safe_address:j},query:{}},Y)}u.getTransactionHistory=v;function A(M,j,Y,uu){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/transactions/queued",{path:{chainId:M,safe_address:j},query:{trusted:uu}},Y)}u.getTransactionQueue=A;function m(M,j){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/transactions/{transactionId}",{path:{chainId:M,transactionId:j}})}u.getTransactionDetails=m;function g(M,j,Y){return(0,n.postEndpoint)(i,"/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations",{path:{chainId:M,safe_address:j},body:Y})}u.postSafeGasEstimation=g;function B(M,j){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/nonces",{path:{chainId:M,safe_address:j}})}u.getNonces=B;function D(M,j,Y){return(0,n.postEndpoint)(i,"/v1/chains/{chainId}/transactions/{safe_address}/propose",{path:{chainId:M,safe_address:j},body:Y})}u.proposeTransaction=D;function F(M){return(0,n.getEndpoint)(i,"/v1/chains",{query:M})}u.getChainsConfig=F;function h(M){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}",{path:{chainId:M}})}u.getChainConfig=h;function b(M,j={}){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safe-apps",{path:{chainId:M},query:j})}u.getSafeApps=b;function T(M){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/about/master-copies",{path:{chainId:M}})}u.getMasterCopies=T;function k(M,j,Y){return(0,n.postEndpoint)(i,"/v1/chains/{chainId}/data-decoder",{path:{chainId:M},body:{data:j,to:Y}})}u.getDecodedData=k;function L(M,j,Y){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:M,safe_address:j},query:{}},Y)}u.getSafeMessages=L;function Q(M,j){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/messages/{message_hash}",{path:{chainId:M,message_hash:j}})}u.getSafeMessage=Q;function Z(M,j,Y){return(0,n.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:M,safe_address:j},body:Y})}u.proposeSafeMessage=Z;function tu(M,j,Y){return(0,n.postEndpoint)(i,"/v1/chains/{chainId}/messages/{message_hash}/signatures",{path:{chainId:M,message_hash:j},body:Y})}u.confirmSafeMessage=tu;function q(M,j={}){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/delegates",{path:{chainId:M},query:j})}u.getDelegates=q;function V(M){return(0,n.postEndpoint)(i,"/v1/register/notifications",{body:M})}u.registerDevice=V;function G(M,j,Y){return(0,n.deleteEndpoint)(i,"/v1/chains/{chainId}/notifications/devices/{uuid}/safes/{safe_address}",{path:{chainId:M,safe_address:j,uuid:Y}})}u.unregisterSafe=G;function W(M,j){return(0,n.deleteEndpoint)(i,"/v1/chains/{chainId}/notifications/devices/{uuid}",{path:{chainId:M,uuid:j}})}u.unregisterDevice=W})(vk);(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.TransferDirection=u.TransactionStatus=u.TokenType=u.Operation=void 0;var e=vk;Object.defineProperty(u,"Operation",{enumerable:!0,get:function(){return e.Operation}}),Object.defineProperty(u,"TokenType",{enumerable:!0,get:function(){return e.TokenType}}),Object.defineProperty(u,"TransactionStatus",{enumerable:!0,get:function(){return e.TransactionStatus}}),Object.defineProperty(u,"TransferDirection",{enumerable:!0,get:function(){return e.TransferDirection}})})(gk);var Tk={};Object.defineProperty(Tk,"__esModule",{value:!0});(function(u){var e=mu&&mu.__createBinding||(Object.create?function(n,r,i,a){a===void 0&&(a=i);var o=Object.getOwnPropertyDescriptor(r,i);(!o||("get"in o?!r.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(n,a,o)}:function(n,r,i,a){a===void 0&&(a=i),n[a]=r[i]}),t=mu&&mu.__exportStar||function(n,r){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(r,i)&&e(r,n,i)};Object.defineProperty(u,"__esModule",{value:!0}),t(x2,u),t(Ak,u),t(gk,u),t(Tk,u)})(w2);Object.defineProperty(b2,"__esModule",{value:!0});b2.TXs=void 0;const a3=ei,dhu=w2;class fhu{constructor(e){this.communicator=e}async getBySafeTxHash(e){if(!e)throw new Error("Invalid safeTxHash");return(await this.communicator.send(a3.Methods.getTxBySafeTxHash,{safeTxHash:e})).data}async signMessage(e){const t={message:e};return(await this.communicator.send(a3.Methods.signMessage,t)).data}async signTypedMessage(e){if(!(0,dhu.isObjectEIP712TypedData)(e))throw new Error("Invalid typed data");return(await this.communicator.send(a3.Methods.signTypedMessage,{typedData:e})).data}async send({txs:e,params:t}){if(!e||!e.length)throw new Error("No transactions were passed");const n={txs:e,params:t};return(await this.communicator.send(a3.Methods.sendTransactions,n)).data}}b2.TXs=fhu;var _2={},ms={};Object.defineProperty(ms,"__esModule",{value:!0});ms.RPC_CALLS=void 0;ms.RPC_CALLS={eth_call:"eth_call",eth_gasPrice:"eth_gasPrice",eth_getLogs:"eth_getLogs",eth_getBalance:"eth_getBalance",eth_getCode:"eth_getCode",eth_getBlockByHash:"eth_getBlockByHash",eth_getBlockByNumber:"eth_getBlockByNumber",eth_getStorageAt:"eth_getStorageAt",eth_getTransactionByHash:"eth_getTransactionByHash",eth_getTransactionReceipt:"eth_getTransactionReceipt",eth_getTransactionCount:"eth_getTransactionCount",eth_estimateGas:"eth_estimateGas",safe_setSettings:"safe_setSettings"};Object.defineProperty(_2,"__esModule",{value:!0});_2.Eth=void 0;const Be=ms,phu=ei,$t={defaultBlockParam:(u="latest")=>u,returnFullTxObjectParam:(u=!1)=>u,blockNumberToHex:u=>Number.isInteger(u)?`0x${u.toString(16)}`:u};class Chu{constructor(e){this.communicator=e,this.call=this.buildRequest({call:Be.RPC_CALLS.eth_call,formatters:[null,$t.defaultBlockParam]}),this.getBalance=this.buildRequest({call:Be.RPC_CALLS.eth_getBalance,formatters:[null,$t.defaultBlockParam]}),this.getCode=this.buildRequest({call:Be.RPC_CALLS.eth_getCode,formatters:[null,$t.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:Be.RPC_CALLS.eth_getStorageAt,formatters:[null,$t.blockNumberToHex,$t.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:Be.RPC_CALLS.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:Be.RPC_CALLS.eth_getBlockByHash,formatters:[null,$t.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:Be.RPC_CALLS.eth_getBlockByNumber,formatters:[$t.blockNumberToHex,$t.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:Be.RPC_CALLS.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:Be.RPC_CALLS.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:Be.RPC_CALLS.eth_getTransactionCount,formatters:[null,$t.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:Be.RPC_CALLS.eth_gasPrice}),this.getEstimateGas=t=>this.buildRequest({call:Be.RPC_CALLS.eth_estimateGas})([t]),this.setSafeSettings=this.buildRequest({call:Be.RPC_CALLS.safe_setSettings})}buildRequest(e){const{call:t,formatters:n}=e;return async r=>{n&&Array.isArray(r)&&n.forEach((o,s)=>{o&&(r[s]=o(r[s]))});const i={call:t,params:r||[]};return(await this.communicator.send(phu.Methods.rpcCall,i)).data}}}_2.Eth=Chu;var S2={};const hhu=ec(xH);var Sa={};Object.defineProperty(Sa,"__esModule",{value:!0});Sa.MAGIC_VALUE_BYTES=Sa.MAGIC_VALUE=void 0;const mhu="0x1626ba7e";Sa.MAGIC_VALUE=mhu;const Ahu="0x20c13b0b";Sa.MAGIC_VALUE_BYTES=Ahu;var sC={},As={},jr={};Object.defineProperty(jr,"__esModule",{value:!0});jr.PermissionsError=jr.PERMISSIONS_REQUEST_REJECTED=void 0;jr.PERMISSIONS_REQUEST_REJECTED=4001;class lC extends Error{constructor(e,t,n){super(e),this.code=t,this.data=n,Object.setPrototypeOf(this,lC.prototype)}}jr.PermissionsError=lC;Object.defineProperty(As,"__esModule",{value:!0});As.Wallet=void 0;const s1=ei,o3=jr;class ghu{constructor(e){this.communicator=e}async getPermissions(){return(await this.communicator.send(s1.Methods.wallet_getPermissions,void 0)).data}async requestPermissions(e){if(!this.isPermissionRequestValid(e))throw new o3.PermissionsError("Permissions request is invalid",o3.PERMISSIONS_REQUEST_REJECTED);try{return(await this.communicator.send(s1.Methods.wallet_requestPermissions,e)).data}catch{throw new o3.PermissionsError("Permissions rejected",o3.PERMISSIONS_REQUEST_REJECTED)}}isPermissionRequestValid(e){return e.every(t=>typeof t=="object"?Object.keys(t).every(n=>!!Object.values(s1.RestrictedMethods).includes(n)):!1)}}As.Wallet=ghu;Object.defineProperty(sC,"__esModule",{value:!0});const vhu=As,kA=jr,_A=(u,e)=>e.some(t=>t.parentCapability===u),Bhu=()=>(u,e,t)=>{const n=t.value;return t.value=async function(){const r=new vhu.Wallet(this.communicator);let i=await r.getPermissions();if(_A(e,i)||(i=await r.requestPermissions([{[e]:{}}])),!_A(e,i))throw new kA.PermissionsError("Permissions rejected",kA.PERMISSIONS_REQUEST_REJECTED);return n.apply(this)},t};sC.default=Bhu;var Fhu=mu&&mu.__decorate||function(u,e,t,n){var r=arguments.length,i=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(u,e,t,n);else for(var o=u.length-1;o>=0;o--)(a=u[o])&&(i=(r<3?a(i):r>3?a(e,t,i):a(e,t))||i);return r>3&&i&&Object.defineProperty(e,t,i),i},yhu=mu&&mu.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(S2,"__esModule",{value:!0});S2.Safe=void 0;const s3=hhu,SA=Sa,hn=ei,TA=ms,Dhu=w2,bhu=yhu(sC);class Pk{constructor(e){this.communicator=e}async getChainInfo(){return(await this.communicator.send(hn.Methods.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(hn.Methods.getSafeInfo,void 0)).data}async experimental_getBalances({currency:e="usd"}={}){return(await this.communicator.send(hn.Methods.getSafeBalances,{currency:e})).data}async check1271Signature(e,t="0x"){const n=await this.getInfo(),r=(0,s3.encodeFunctionData)({abi:[{constant:!1,inputs:[{name:"_dataHash",type:"bytes32"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[e,t]}),i={call:TA.RPC_CALLS.eth_call,params:[{to:n.safeAddress,data:r},"latest"]};try{return(await this.communicator.send(hn.Methods.rpcCall,i)).data.slice(0,10).toLowerCase()===SA.MAGIC_VALUE}catch{return!1}}async check1271SignatureBytes(e,t="0x"){const n=await this.getInfo(),r=(0,s3.encodeFunctionData)({abi:[{constant:!1,inputs:[{name:"_data",type:"bytes"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[e,t]}),i={call:TA.RPC_CALLS.eth_call,params:[{to:n.safeAddress,data:r},"latest"]};try{return(await this.communicator.send(hn.Methods.rpcCall,i)).data.slice(0,10).toLowerCase()===SA.MAGIC_VALUE_BYTES}catch{return!1}}calculateMessageHash(e){return(0,s3.hashMessage)(e)}calculateTypedMessageHash(e){const t=typeof e.domain.chainId=="object"?e.domain.chainId.toNumber():Number(e.domain.chainId);let n=e.primaryType;if(!n){const r=Object.values(e.types),i=Object.keys(e.types).filter(a=>r.every(o=>o.every(({type:s})=>s.replace("[","").replace("]","")!==a)));if(i.length===0||i.length>1)throw new Error("Please specify primaryType");n=i[0]}return(0,s3.hashTypedData)({message:e.message,domain:Object.assign(Object.assign({},e.domain),{chainId:t,verifyingContract:e.domain.verifyingContract,salt:e.domain.salt}),types:e.types,primaryType:n})}async getOffChainSignature(e){return(await this.communicator.send(hn.Methods.getOffChainSignature,e)).data}async isMessageSigned(e,t="0x"){let n;if(typeof e=="string"&&(n=async()=>{const r=this.calculateMessageHash(e);return await this.isMessageHashSigned(r,t)}),(0,Dhu.isObjectEIP712TypedData)(e)&&(n=async()=>{const r=this.calculateTypedMessageHash(e);return await this.isMessageHashSigned(r,t)}),n)return await n();throw new Error("Invalid message type")}async isMessageHashSigned(e,t="0x"){const n=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const r of n)if(await r(e,t))return!0;return!1}async getEnvironmentInfo(){return(await this.communicator.send(hn.Methods.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(hn.Methods.requestAddressBook,void 0)).data}}Fhu([(0,bhu.default)()],Pk.prototype,"requestAddressBook",null);S2.Safe=Pk;var whu=mu&&mu.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(Zl,"__esModule",{value:!0});const xhu=whu(mk),khu=b2,_hu=_2,Shu=S2,Thu=As;let Phu=class{constructor(e={}){const{allowedDomains:t=null,debug:n=!1}=e;this.communicator=new xhu.default(t,n),this.eth=new _hu.Eth(this.communicator),this.txs=new khu.TXs(this.communicator),this.safe=new Shu.Safe(this.communicator),this.wallet=new Thu.Wallet(this.communicator)}};Zl.default=Phu;(function(u){var e=mu&&mu.__createBinding||(Object.create?function(a,o,s,l){l===void 0&&(l=s);var c=Object.getOwnPropertyDescriptor(o,s);(!c||("get"in c?!o.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return o[s]}}),Object.defineProperty(a,l,c)}:function(a,o,s,l){l===void 0&&(l=s),a[l]=o[s]}),t=mu&&mu.__exportStar||function(a,o){for(var s in a)s!=="default"&&!Object.prototype.hasOwnProperty.call(o,s)&&e(o,a,s)},n=mu&&mu.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(u,"__esModule",{value:!0}),u.getSDKVersion=void 0;const r=n(Zl);u.default=r.default,t(Zl,u),t(w2,u),t(ei,u),t(Cs,u);var i=hs;Object.defineProperty(u,"getSDKVersion",{enumerable:!0,get:function(){return i.getSDKVersion}})})(hk);const l3=uc(hk);var jo,Ro,Ohu=class extends Z4{constructor({chains:u,options:e}){const t={shimDisconnect:!1,...e};super({chains:u,options:t}),this.id="safe",this.name="Safe",this.ready=!(typeof window>"u")&&(window==null?void 0:window.parent)!==window,b0(this,jo,void 0),b0(this,Ro,void 0),this.shimDisconnectKey=`${this.id}.shimDisconnect`;let n=l3;typeof l3!="function"&&typeof l3.default=="function"&&(n=l3.default),Jt(this,Ro,new n(t))}async connect(){var n;const u=await this.getProvider();if(!u)throw new We;u.on&&(u.on("accountsChanged",this.onAccountsChanged),u.on("chainChanged",this.onChainChanged),u.on("disconnect",this.onDisconnect)),this.emit("message",{type:"connecting"});const e=await this.getAccount(),t=await this.getChainId();return this.options.shimDisconnect&&((n=this.storage)==null||n.setItem(this.shimDisconnectKey,!0)),{account:e,chain:{id:t,unsupported:this.isChainUnsupported(t)}}}async disconnect(){var e;const u=await this.getProvider();u!=null&&u.removeListener&&(u.removeListener("accountsChanged",this.onAccountsChanged),u.removeListener("chainChanged",this.onChainChanged),u.removeListener("disconnect",this.onDisconnect),this.options.shimDisconnect&&((e=this.storage)==null||e.removeItem(this.shimDisconnectKey)))}async getAccount(){const u=await this.getProvider();if(!u)throw new We;const e=await u.request({method:"eth_accounts"});return a0(e[0])}async getChainId(){const u=await this.getProvider();if(!u)throw new We;return Ir(u.chainId)}async getProvider(){if(!Tu(this,jo)){const u=await Tu(this,Ro).safe.getInfo();if(!u)throw new Error("Could not load Safe information");Jt(this,jo,new ak.SafeAppProvider(u,Tu(this,Ro)))}return Tu(this,jo)}async getWalletClient({chainId:u}={}){const e=await this.getProvider(),t=await this.getAccount(),n=this.chains.find(r=>r.id===u);if(!e)throw new Error("provider is required.");return Ka({account:t,chain:n,transport:qa(e)})}async isAuthorized(){var u;try{return this.options.shimDisconnect&&!((u=this.storage)!=null&&u.getItem(this.shimDisconnectKey))?!1:!!await this.getAccount()}catch{return!1}}onAccountsChanged(u){}onChainChanged(u){}onDisconnect(){this.emit("disconnect")}};jo=new WeakMap;Ro=new WeakMap;function Ihu(u){return Object.fromEntries(Object.entries(u).filter(([e,t])=>t!==void 0))}function zhu(u){return"groupName"in u[0]?PA(u):PA([{groupName:"",wallets:u}])()}var PA=u=>()=>{let e=-1;const t=[],n=[],r=[],i=[];return u.forEach(({groupName:o,wallets:s},l)=>{s.forEach(c=>{if(e++,c!=null&&c.iconAccent&&!Mdu(c==null?void 0:c.iconAccent))throw new Error(`Property \`iconAccent\` is not a hex value for wallet: ${c.name}`);const E={...c,groupIndex:l,groupName:o,index:e};typeof c.hidden=="function"?r.push(E):n.push(E)})}),[...n,...r].forEach(({createConnector:o,groupIndex:s,groupName:l,hidden:c,index:E,...d})=>{if(typeof c=="function"&&c({wallets:[...i.map(({connector:m,id:g,installed:B,name:D})=>({connector:m,id:g,installed:B,name:D}))]}))return;const{connector:f,...p}=Ihu(o());let C;if(d.id==="walletConnect"&&p.qrCode&&!U0()){const{chains:A,options:m}=f;C=new rk({chains:A,options:{...m,showQrModal:!0}}),t.push(C)}const v={connector:f,groupIndex:s,groupName:l,index:E,walletConnectModalConnector:C,...d,...p};i.push(v),t.includes(f)||(t.push(f),f._wallets=[]),f._wallets.push(v)}),t},jhu=({chains:u,...e})=>{var t;return{id:"brave",name:"Brave Wallet",iconUrl:async()=>(await xu(()=>import("./braveWallet-BTBH4MDN-rhLwbrvd.js"),__vite__mapDeps([]))).default,iconBackground:"#fff",installed:typeof window<"u"&&((t=window.ethereum)==null?void 0:t.isBraveWallet)===!0,downloadUrls:{},createConnector:()=>({connector:new Fa({chains:u,options:e})})}};function Ok(u){if(typeof window>"u"||typeof window.ethereum>"u")return;const e=window.ethereum.providers;return e?e.find(t=>t[u]):window.ethereum[u]?window.ethereum:void 0}function Ik(u){return!!Ok(u)}function Rhu(u){if(typeof window>"u"||typeof window.ethereum>"u")return;const e=window.ethereum.providers,t=Ok(u);return t||(typeof e<"u"&&e.length>0?e[0]:window.ethereum)}function Nhu({chains:u,flag:e,options:t}){return new Fa({chains:u,options:{getProvider:()=>Rhu(e),...t}})}var $hu=({appName:u,chains:e,...t})=>{const n=Ik("isCoinbaseWallet");return{id:"coinbase",name:"Coinbase Wallet",shortName:"Coinbase",iconUrl:async()=>(await xu(()=>import("./coinbaseWallet-2OUR5TUP-lljav0iR.js"),__vite__mapDeps([]))).default,iconAccent:"#2c5ff6",iconBackground:"#2c5ff6",installed:n||void 0,downloadUrls:{android:"https://play.google.com/store/apps/details?id=org.toshi",ios:"https://apps.apple.com/us/app/coinbase-wallet-store-crypto/id1278383455",mobile:"https://coinbase.com/wallet/downloads",qrCode:"https://coinbase-wallet.onelink.me/q5Sx/fdb9b250",chrome:"https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad",browserExtension:"https://coinbase.com/wallet"},createConnector:()=>{const r=Jr(),i=new ACu({chains:e,options:{appName:u,headlessMode:!0,...t}});return{connector:i,...r?{}:{qrCode:{getUri:async()=>(await i.getProvider()).qrUrl,instructions:{learnMoreUrl:"https://coinbase.com/wallet/articles/getting-started-mobile",steps:[{description:"wallet_connectors.coinbase.qr_code.step1.description",step:"install",title:"wallet_connectors.coinbase.qr_code.step1.title"},{description:"wallet_connectors.coinbase.qr_code.step2.description",step:"create",title:"wallet_connectors.coinbase.qr_code.step2.title"},{description:"wallet_connectors.coinbase.qr_code.step3.description",step:"scan",title:"wallet_connectors.coinbase.qr_code.step3.title"}]}},extension:{instructions:{learnMoreUrl:"https://coinbase.com/wallet/articles/getting-started-extension",steps:[{description:"wallet_connectors.coinbase.extension.step1.description",step:"install",title:"wallet_connectors.coinbase.extension.step1.title"},{description:"wallet_connectors.coinbase.extension.step2.description",step:"create",title:"wallet_connectors.coinbase.extension.step2.title"},{description:"wallet_connectors.coinbase.extension.step3.description",step:"refresh",title:"wallet_connectors.coinbase.extension.step3.title"}]}}}}}}},Mhu=({chains:u,...e})=>({id:"injected",name:"Browser Wallet",iconUrl:async()=>(await xu(()=>import("./injectedWallet-EUKDEAIU-nRYX44n1.js"),__vite__mapDeps([]))).default,iconBackground:"#fff",hidden:({wallets:t})=>t.some(n=>n.installed&&n.name===n.connector.name&&(n.connector instanceof Fa||n.id==="coinbase")),createConnector:()=>({connector:new Fa({chains:u,options:e})})});async function cC(u,e){const t=await u.getProvider();return e==="2"?new Promise(n=>t.once("display_uri",n)):t.connector.uri}var zk=new Map;function Lhu(u,e){const t=u==="1"?new BCu(e):new rk(e);return zk.set(JSON.stringify(e),t),t}function Jl({chains:u,options:e={},projectId:t,version:n="2"}){const r="21fef48091f12692cad574a6f7753643";if(n==="2"){if(!t||t==="")throw new Error("No projectId found. Every dApp must now provide a WalletConnect Cloud projectId to enable WalletConnect v2 https://www.rainbowkit.com/docs/installation#configure");(t==="YOUR_PROJECT_ID"||t===r)&&console.warn("Invalid projectId. Please create a unique WalletConnect Cloud projectId for your dApp https://www.rainbowkit.com/docs/installation#configure")}const i={chains:u,options:n==="1"?{qrcode:!1,...e}:{projectId:t==="YOUR_PROJECT_ID"?r:t,showQrModal:!1,...e}},a=JSON.stringify(i),o=zk.get(a);return o??Lhu(n,i)}function OA(u){return!(!(u!=null&&u.isMetaMask)||u.isBraveWallet&&!u._events&&!u._state||u.isApexWallet||u.isAvalanche||u.isBackpack||u.isBifrost||u.isBitKeep||u.isBitski||u.isBlockWallet||u.isCoinbaseWallet||u.isDawn||u.isEnkrypt||u.isExodus||u.isFrame||u.isFrontier||u.isGamestop||u.isHyperPay||u.isImToken||u.isKuCoinWallet||u.isMathWallet||u.isOkxWallet||u.isOKExWallet||u.isOneInchIOSWallet||u.isOneInchAndroidWallet||u.isOpera||u.isPhantom||u.isPortal||u.isRabby||u.isRainbow||u.isStatus||u.isTalisman||u.isTally||u.isTokenPocket||u.isTokenary||u.isTrust||u.isTrustWallet||u.isXDEFI||u.isZeal||u.isZerion)}var Whu=({chains:u,projectId:e,walletConnectOptions:t,walletConnectVersion:n="2",...r})=>{var i,a;const o=typeof window<"u"&&((i=window.ethereum)==null?void 0:i.providers),s=typeof window<"u"&&typeof window.ethereum<"u"&&(((a=window.ethereum.providers)==null?void 0:a.some(OA))||window.ethereum.isMetaMask),l=!s;return{id:"metaMask",name:"MetaMask",iconUrl:async()=>(await xu(()=>import("./metaMaskWallet-ORHUNQRP-B-MG5eKR.js"),__vite__mapDeps([]))).default,iconAccent:"#f6851a",iconBackground:"#fff",installed:l?void 0:s,downloadUrls:{android:"https://play.google.com/store/apps/details?id=io.metamask",ios:"https://apps.apple.com/us/app/metamask/id1438144202",mobile:"https://metamask.io/download",qrCode:"https://metamask.io/download",chrome:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",edge:"https://microsoftedge.microsoft.com/addons/detail/metamask/ejbalbakoplchlghecdalmeeeajnimhm",firefox:"https://addons.mozilla.org/firefox/addon/ether-metamask",opera:"https://addons.opera.com/extensions/details/metamask-10",browserExtension:"https://metamask.io/download"},createConnector:()=>{const c=l?Jl({projectId:e,chains:u,version:n,options:t}):new gCu({chains:u,options:{getProvider:()=>o?o.find(OA):typeof window<"u"?window.ethereum:void 0,...r}}),E=async()=>{const d=await cC(c,n);return _5()?d:Jr()?`metamask://wc?uri=${encodeURIComponent(d)}`:`https://metamask.app.link/wc?uri=${encodeURIComponent(d)}`};return{connector:c,mobile:{getUri:l?E:void 0},qrCode:l?{getUri:E,instructions:{learnMoreUrl:"https://metamask.io/faqs/",steps:[{description:"wallet_connectors.metamask.qr_code.step1.description",step:"install",title:"wallet_connectors.metamask.qr_code.step1.title"},{description:"wallet_connectors.metamask.qr_code.step2.description",step:"create",title:"wallet_connectors.metamask.qr_code.step2.title"},{description:"wallet_connectors.metamask.qr_code.step3.description",step:"refresh",title:"wallet_connectors.metamask.qr_code.step3.title"}]}}:void 0,extension:{instructions:{learnMoreUrl:"https://metamask.io/faqs/",steps:[{description:"wallet_connectors.metamask.extension.step1.description",step:"install",title:"wallet_connectors.metamask.extension.step1.title"},{description:"wallet_connectors.metamask.extension.step2.description",step:"create",title:"wallet_connectors.metamask.extension.step2.title"},{description:"wallet_connectors.metamask.extension.step3.description",step:"refresh",title:"wallet_connectors.metamask.extension.step3.title"}]}}}}}},Uhu=({chains:u,projectId:e,walletConnectOptions:t,walletConnectVersion:n="2",...r})=>{const i=Ik("isRainbow"),a=!i;return{id:"rainbow",name:"Rainbow",iconUrl:async()=>(await xu(()=>import("./rainbowWallet-GGU64QEI-aO3VF4UJ.js"),__vite__mapDeps([]))).default,iconBackground:"#0c2f78",installed:a?void 0:i,downloadUrls:{android:"https://play.google.com/store/apps/details?id=me.rainbow&referrer=utm_source%3Drainbowkit&utm_source=rainbowkit",ios:"https://apps.apple.com/app/apple-store/id1457119021?pt=119997837&ct=rainbowkit&mt=8",mobile:"https://rainbow.download?utm_source=rainbowkit",qrCode:"https://rainbow.download?utm_source=rainbowkit&utm_medium=qrcode",browserExtension:"https://rainbow.me/extension?utm_source=rainbowkit"},createConnector:()=>{const o=a?Jl({projectId:e,chains:u,version:n,options:t}):Nhu({flag:"isRainbow",chains:u,options:r}),s=async()=>{const l=await cC(o,n);return _5()?l:Jr()?`rainbow://wc?uri=${encodeURIComponent(l)}&connector=rainbowkit`:`https://rnbwapp.com/wc?uri=${encodeURIComponent(l)}&connector=rainbowkit`};return{connector:o,mobile:{getUri:a?s:void 0},qrCode:a?{getUri:s,instructions:{learnMoreUrl:"https://learn.rainbow.me/connect-to-a-website-or-app?utm_source=rainbowkit&utm_medium=connector&utm_campaign=learnmore",steps:[{description:"wallet_connectors.rainbow.qr_code.step1.description",step:"install",title:"wallet_connectors.rainbow.qr_code.step1.title"},{description:"wallet_connectors.rainbow.qr_code.step2.description",step:"create",title:"wallet_connectors.rainbow.qr_code.step2.title"},{description:"wallet_connectors.rainbow.qr_code.step3.description",step:"scan",title:"wallet_connectors.rainbow.qr_code.step3.title"}]}}:void 0}}}},qhu=({chains:u,...e})=>({id:"safe",name:"Safe",iconAccent:"#12ff80",iconBackground:"#fff",iconUrl:async()=>(await xu(()=>import("./safeWallet-DFMLSLCR-0HldBjhm.js"),__vite__mapDeps([]))).default,installed:!(typeof window>"u")&&(window==null?void 0:window.parent)!==window,downloadUrls:{},createConnector:()=>({connector:new Ohu({chains:u,options:e})})}),Hhu=({chains:u,options:e,projectId:t,version:n="2"})=>({id:"walletConnect",name:"WalletConnect",iconUrl:async()=>(await xu(()=>import("./walletConnectWallet-D6ZADJM7-hbivFVny.js"),__vite__mapDeps([]))).default,iconBackground:"#3b99fc",createConnector:()=>{const r=Jr(),i=Jl(n==="1"?{version:"1",chains:u,options:{qrcode:r,...e}}:{version:"2",chains:u,projectId:t,options:{showQrModal:r,...e}}),a=async()=>cC(i,n);return{connector:i,...r?{}:{mobile:{getUri:a},qrCode:{getUri:a}}}}}),Khu=({appName:u,chains:e,projectId:t})=>{const n=[{groupName:"Popular",wallets:[Mhu({chains:e}),qhu({chains:e}),Uhu({chains:e,projectId:t}),$hu({appName:u,chains:e}),Whu({chains:e,projectId:t}),Hhu({chains:e,projectId:t}),jhu({chains:e})]}];return{connectors:zhu(n),wallets:n}};const Vhu=["MarketPlace","Factory"];function Ghu(){const u=e=>{console.log("Redirect to page: ",e)};return w.useEffect(()=>{},[]),ku.jsx(Jj,{position:"static",style:{background:"linear-gradient(269.67deg, #CCE1FA -10.61%, #C6EEEA 113.26%)"},children:ku.jsx(oR,{maxWidth:"xl",children:ku.jsxs(iR,{disableGutters:!0,children:[ku.jsx("img",{src:pR,width:40}),ku.jsx(m8,{sx:{flexGrow:1,display:{xs:"none",md:"flex"}},children:Vhu.map(e=>ku.jsx(Mj,{onClick:()=>u(e),sx:{my:2,color:"#352D50",display:"block"},children:e},e))}),ku.jsx(m8,{sx:{flexGrow:0},children:ku.jsx(W5,{})})]})})})}function Qhu(){return ku.jsxs(FP,{children:[ku.jsx(Ghu,{}),ku.jsx(vP,{children:ku.jsx(EB,{path:"/real-token"})})]})}function Xhu(){return ku.jsx(RT,{children:ku.jsx(Qhu,{})})}const Yhu=$f({palette:{primary:{main:"#556cd6"},secondary:{main:"#19857b"},error:{main:or.A400}}});function Zhu(u){return ku.jsx(RI,lu({},u,{defaultTheme:Mf,themeId:ta}))}const Jhu=(u,e)=>lu({WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",boxSizing:"border-box",WebkitTextSizeAdjust:"100%"},e&&!u.vars&&{colorScheme:u.palette.mode}),u8u=u=>lu({color:(u.vars||u).palette.text.primary},u.typography.body1,{backgroundColor:(u.vars||u).palette.background.default,"@media print":{backgroundColor:(u.vars||u).palette.common.white}}),e8u=(u,e=!1)=>{var t;const n={};e&&u.colorSchemes&&Object.entries(u.colorSchemes).forEach(([a,o])=>{var s;n[u.getColorSchemeSelector(a).replace(/\s*&/,"")]={colorScheme:(s=o.palette)==null?void 0:s.mode}});let r=lu({html:Jhu(u,e),"*, *::before, *::after":{boxSizing:"inherit"},"strong, b":{fontWeight:u.typography.fontWeightBold},body:lu({margin:0},u8u(u),{"&::backdrop":{backgroundColor:(u.vars||u).palette.background.default}})},n);const i=(t=u.components)==null||(t=t.MuiCssBaseline)==null?void 0:t.styleOverrides;return i&&(r=[r,i]),r};function t8u(u){const e=Xn({props:u,name:"MuiCssBaseline"}),{children:t,enableColorScheme:n=!1}=e;return ku.jsxs(w.Fragment,{children:[ku.jsx(Zhu,{styles:r=>e8u(r,n)}),t]})}function n8u(){return function(u){return u.rpcUrls.public.http[0]?{chain:u,rpcUrls:u.rpcUrls.public}:null}}var r8u={VITE_REACT_APP_PROJECT_ID:"9d80089c30635ff84b5339d993d63fa1",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{chains:jk,publicClient:i8u}=YH([GD,jH,zH,vN,IH,OH,PH,ON],[n8u()]);console.log(" Project ID:",r8u.REACT_APP_PROJECT_ID);const{connectors:a8u}=Khu({appName:"My RainbowKit App",projectId:"9d80089c30635ff84b5339d993d63fa1",chains:jk}),o8u=OK({autoConnect:!0,connectors:a8u,publicClient:i8u});c1.createRoot(document.getElementById("root")).render(ku.jsxs(lR,{theme:Yhu,children:[ku.jsx(t8u,{}),ku.jsx(IK,{config:o8u,children:ku.jsx(ndu,{chains:jk,children:ku.jsx(Xhu,{})})})]}));export{m2 as $,Ce as A,k8u as B,P8u as C,U8u as D,smu as E,F8u as F,$8u as G,N8u as H,x8u as I,D8u as J,g8u as K,v8u as L,I8u as M,Dn as N,O8u as O,Q8u as P,W8u as Q,b5u as R,Je as S,T8u as T,ka as U,m8u as V,_8u as W,amu as X,S8u as Y,imu as Z,fs as _,qM as a,A2 as a0,Y5 as a1,Qx as a2,b8u as a3,w8u as a4,A8u as a5,j8u as a6,R8u as a7,g2 as a8,y8u as a9,ifu as aA,vpu as aB,Wx as aC,Gpu as aD,V5 as aE,Qpu as aF,Xpu as aG,Zpu as aH,Lx as aI,e5u as aJ,r5u as aK,o5u as aL,l5u as aM,E5u as aN,Cpu as aO,Ux as aP,A5u as aQ,g5u as aR,p5u as aS,m5u as aT,dcu as aU,gcu as aV,Z5 as aa,M8u as ab,z8u as ac,L8u as ad,omu as ae,V8u as af,K8u as ag,sCu as ah,nmu as ai,X8u as aj,lCu as ak,H8u as al,umu as am,Y8u as an,emu as ao,rmu as ap,Z8u as aq,J8u as ar,tmu as as,G8u as at,J5u as au,Yx as av,a1 as aw,d8u as ax,f8u as ay,xu as az,HM as b,KM as c,Gy as d,ec as e,Dr as f,PM as g,Ck as h,_u as i,c2 as j,ot as k,qy as l,Y7 as m,Qo as n,mu as o,uc as p,br as q,h2 as r,q8u as s,Ct as t,p8u as u,C8u as v,ht as w,h8u as x,B8u as y,Gx as z}; + Approved: ${d.toString()}`))}),a.forEach(E=>{n||(gr(r[E].methods,i[E].methods)?gr(r[E].events,i[E].events)||(n=Dn("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${E}`)):n=Dn("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${E}`))}),n}function cCu(u){const e={};return Object.keys(u).forEach(t=>{var n;t.includes(":")?e[t]=u[t]:(n=u[t].chains)==null||n.forEach(r=>{e[r]={methods:u[t].methods,events:u[t].events}})}),e}function bA(u){return[...new Set(u.map(e=>e.includes(":")?e.split(":")[0]:e))]}function ECu(u){const e={};return Object.keys(u).forEach(t=>{if(t.includes(":"))e[t]=u[t];else{const n=oo(u[t].accounts);n==null||n.forEach(r=>{e[r]={accounts:u[t].accounts.filter(i=>i.includes(`${r}:`)),methods:u[t].methods,events:u[t].events}})}}),e}function rmu(u,e){return J5(u,!1)&&u<=e.max&&u>=e.min}function imu(){const u=ps();return new Promise(e=>{switch(u){case xe.browser:e(dCu());break;case xe.reactNative:e(fCu());break;case xe.node:e(pCu());break;default:e(!0)}})}function dCu(){return Y5()&&(navigator==null?void 0:navigator.onLine)}async function fCu(){if(A2()&&typeof global<"u"&&global!=null&&global.NetInfo){const u=await(global==null?void 0:global.NetInfo.fetch());return u==null?void 0:u.isConnected}return!0}function pCu(){return!0}function amu(u){switch(ps()){case xe.browser:CCu(u);break;case xe.reactNative:hCu(u);break}}function CCu(u){!A2()&&Y5()&&(window.addEventListener("online",()=>u(!0)),window.addEventListener("offline",()=>u(!1)))}function hCu(u){A2()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>u(e==null?void 0:e.isConnected)))}const o1={};class omu{static get(e){return o1[e]}static set(e,t){o1[e]=t}static delete(e){delete o1[e]}}var uk="eip155",mCu="store",ek="requestedChains",A6="wallet_addEthereumChain",r0,Yo,T3,g6,uC,tk,P3,v6,B6,nk,Gl,eC,mi,Io,Ql,tC,Xl,nC,Yl,rC,rk=class extends Z4{constructor(u){super({...u,options:{isNewChainsStale:!0,...u.options}}),b0(this,T3),b0(this,uC),b0(this,P3),b0(this,B6),b0(this,Gl),b0(this,mi),b0(this,Ql),b0(this,Xl),b0(this,Yl),this.id="walletConnect",this.name="WalletConnect",this.ready=!0,b0(this,r0,void 0),b0(this,Yo,void 0),this.onAccountsChanged=e=>{e.length===0?this.emit("disconnect"):this.emit("change",{account:a0(e[0])})},this.onChainChanged=e=>{const t=Number(e),n=this.isChainUnsupported(t);this.emit("change",{chain:{id:t,unsupported:n}})},this.onDisconnect=()=>{D0(this,mi,Io).call(this,[]),this.emit("disconnect")},this.onDisplayUri=e=>{this.emit("message",{type:"display_uri",data:e})},this.onConnect=()=>{this.emit("connect",{})},D0(this,T3,g6).call(this)}async connect({chainId:u,pairingTopic:e}={}){var t,n,r,i,a;try{let o=u;if(!o){const p=(t=this.storage)==null?void 0:t.getItem(mCu),C=(i=(r=(n=p==null?void 0:p.state)==null?void 0:n.data)==null?void 0:r.chain)==null?void 0:i.id;C&&!this.isChainUnsupported(C)?o=C:o=(a=this.chains[0])==null?void 0:a.id}if(!o)throw new Error("No chains found on connector.");const s=await this.getProvider();D0(this,B6,nk).call(this);const l=D0(this,P3,v6).call(this);if(s.session&&l&&await s.disconnect(),!s.session||l){const p=this.chains.filter(C=>C.id!==o).map(C=>C.id);this.emit("message",{type:"connecting"}),await s.connect({pairingTopic:e,chains:[o],optionalChains:p.length?p:void 0}),D0(this,mi,Io).call(this,this.chains.map(({id:C})=>C))}const c=await s.enable(),E=a0(c[0]),d=await this.getChainId(),f=this.isChainUnsupported(d);return{account:E,chain:{id:d,unsupported:f}}}catch(o){throw/user rejected/i.test(o==null?void 0:o.message)?new F0(o):o}}async disconnect(){const u=await this.getProvider();try{await u.disconnect()}catch(e){if(!/No matching key/i.test(e.message))throw e}finally{D0(this,Gl,eC).call(this),D0(this,mi,Io).call(this,[])}}async getAccount(){const{accounts:u}=await this.getProvider();return a0(u[0])}async getChainId(){const{chainId:u}=await this.getProvider();return u}async getProvider({chainId:u}={}){return Tu(this,r0)||await D0(this,T3,g6).call(this),u&&await this.switchChain(u),Tu(this,r0)}async getWalletClient({chainId:u}={}){const[e,t]=await Promise.all([this.getProvider({chainId:u}),this.getAccount()]),n=this.chains.find(r=>r.id===u);if(!e)throw new Error("provider is required.");return Ka({account:t,chain:n,transport:qa(e)})}async isAuthorized(){try{const[u,e]=await Promise.all([this.getAccount(),this.getProvider()]),t=D0(this,P3,v6).call(this);if(!u)return!1;if(t&&e.session){try{await e.disconnect()}catch{}return!1}return!0}catch{return!1}}async switchChain(u){var t,n;const e=this.chains.find(r=>r.id===u);if(!e)throw new pt(new Error("chain not found on connector."));try{const r=await this.getProvider(),i=D0(this,Xl,nC).call(this),a=D0(this,Yl,rC).call(this);if(!i.includes(u)&&a.includes(A6)){await r.request({method:A6,params:[{chainId:vu(e.id),blockExplorerUrls:[(n=(t=e.blockExplorers)==null?void 0:t.default)==null?void 0:n.url],chainName:e.name,nativeCurrency:e.nativeCurrency,rpcUrls:[...e.rpcUrls.default.http]}]});const s=D0(this,Ql,tC).call(this);s.push(u),D0(this,mi,Io).call(this,s)}return await r.request({method:"wallet_switchEthereumChain",params:[{chainId:vu(u)}]}),e}catch(r){const i=typeof r=="string"?r:r==null?void 0:r.message;throw/user rejected request/i.test(i)?new F0(r):new pt(r)}}};r0=new WeakMap;Yo=new WeakMap;T3=new WeakSet;g6=async function(){return!Tu(this,Yo)&&typeof window<"u"&&Jt(this,Yo,D0(this,uC,tk).call(this)),Tu(this,Yo)};uC=new WeakSet;tk=async function(){const{EthereumProvider:u,OPTIONAL_EVENTS:e,OPTIONAL_METHODS:t}=await xu(()=>import("./index.es-JhrPxZI8.js"),__vite__mapDeps([0,1])),[n,...r]=this.chains.map(({id:i})=>i);if(n){const{projectId:i,showQrModal:a=!0,qrModalOptions:o,metadata:s,relayUrl:l}=this.options;Jt(this,r0,await u.init({showQrModal:a,qrModalOptions:o,projectId:i,optionalMethods:t,optionalEvents:e,chains:[n],optionalChains:r.length?r:void 0,rpcMap:Object.fromEntries(this.chains.map(c=>[c.id,c.rpcUrls.default.http[0]])),metadata:s,relayUrl:l}))}};P3=new WeakSet;v6=function(){if(D0(this,Yl,rC).call(this).includes(A6)||!this.options.isNewChainsStale)return!1;const e=D0(this,Ql,tC).call(this),t=this.chains.map(({id:r})=>r),n=D0(this,Xl,nC).call(this);return n.length&&!n.some(r=>t.includes(r))?!1:!t.every(r=>e.includes(r))};B6=new WeakSet;nk=function(){Tu(this,r0)&&(D0(this,Gl,eC).call(this),Tu(this,r0).on("accountsChanged",this.onAccountsChanged),Tu(this,r0).on("chainChanged",this.onChainChanged),Tu(this,r0).on("disconnect",this.onDisconnect),Tu(this,r0).on("session_delete",this.onDisconnect),Tu(this,r0).on("display_uri",this.onDisplayUri),Tu(this,r0).on("connect",this.onConnect))};Gl=new WeakSet;eC=function(){Tu(this,r0)&&(Tu(this,r0).removeListener("accountsChanged",this.onAccountsChanged),Tu(this,r0).removeListener("chainChanged",this.onChainChanged),Tu(this,r0).removeListener("disconnect",this.onDisconnect),Tu(this,r0).removeListener("session_delete",this.onDisconnect),Tu(this,r0).removeListener("display_uri",this.onDisplayUri),Tu(this,r0).removeListener("connect",this.onConnect))};mi=new WeakSet;Io=function(u){var e;(e=this.storage)==null||e.setItem(ek,u)};Ql=new WeakSet;tC=function(){var u;return((u=this.storage)==null?void 0:u.getItem(ek))??[]};Xl=new WeakSet;nC=function(){var n,r,i;if(!Tu(this,r0))return[];const u=(n=Tu(this,r0).session)==null?void 0:n.namespaces;return u?((i=(r=Zx(u)[uk])==null?void 0:r.chains)==null?void 0:i.map(a=>parseInt(a.split(":")[1]||"")))??[]:[]};Yl=new WeakSet;rC=function(){var n,r;if(!Tu(this,r0))return[];const u=(n=Tu(this,r0).session)==null?void 0:n.namespaces;return u?((r=Zx(u)[uk])==null?void 0:r.methods)??[]:[]};var zo,Ai,ACu=class extends Z4{constructor({chains:u,options:e}){super({chains:u,options:{reloadOnDisconnect:!1,...e}}),this.id="coinbaseWallet",this.name="Coinbase Wallet",this.ready=!0,b0(this,zo,void 0),b0(this,Ai,void 0),this.onAccountsChanged=t=>{t.length===0?this.emit("disconnect"):this.emit("change",{account:a0(t[0])})},this.onChainChanged=t=>{const n=Ir(t),r=this.isChainUnsupported(n);this.emit("change",{chain:{id:n,unsupported:r}})},this.onDisconnect=()=>{this.emit("disconnect")}}async connect({chainId:u}={}){try{const e=await this.getProvider();e.on("accountsChanged",this.onAccountsChanged),e.on("chainChanged",this.onChainChanged),e.on("disconnect",this.onDisconnect),this.emit("message",{type:"connecting"});const t=await e.enable(),n=a0(t[0]);let r=await this.getChainId(),i=this.isChainUnsupported(r);return u&&r!==u&&(r=(await this.switchChain(u)).id,i=this.isChainUnsupported(r)),{account:n,chain:{id:r,unsupported:i}}}catch(e){throw/(user closed modal|accounts received is empty)/i.test(e.message)?new F0(e):e}}async disconnect(){if(!Tu(this,Ai))return;const u=await this.getProvider();u.removeListener("accountsChanged",this.onAccountsChanged),u.removeListener("chainChanged",this.onChainChanged),u.removeListener("disconnect",this.onDisconnect),u.disconnect(),u.close()}async getAccount(){const e=await(await this.getProvider()).request({method:"eth_accounts"});return a0(e[0])}async getChainId(){const u=await this.getProvider();return Ir(u.chainId)}async getProvider(){var u;if(!Tu(this,Ai)){let e=(await xu(()=>import("./index-1oLxk3tb.js").then(a=>a.i),__vite__mapDeps([2,3]))).default;typeof e!="function"&&typeof e.default=="function"&&(e=e.default),Jt(this,zo,new e(this.options));const t=(u=Tu(this,zo).walletExtension)==null?void 0:u.getChainId(),n=this.chains.find(a=>this.options.chainId?a.id===this.options.chainId:a.id===t)||this.chains[0],r=this.options.chainId||(n==null?void 0:n.id),i=this.options.jsonRpcUrl||(n==null?void 0:n.rpcUrls.default.http[0]);Jt(this,Ai,Tu(this,zo).makeWeb3Provider(i,r))}return Tu(this,Ai)}async getWalletClient({chainId:u}={}){const[e,t]=await Promise.all([this.getProvider(),this.getAccount()]),n=this.chains.find(r=>r.id===u);if(!e)throw new Error("provider is required.");return Ka({account:t,chain:n,transport:qa(e)})}async isAuthorized(){try{return!!await this.getAccount()}catch{return!1}}async switchChain(u){var n;const e=await this.getProvider(),t=vu(u);try{return await e.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}),this.chains.find(r=>r.id===u)??{id:u,name:`Chain ${t}`,network:`${t}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}}}catch(r){const i=this.chains.find(a=>a.id===u);if(!i)throw new XD({chainId:u,connectorId:this.id});if(r.code===4902)try{return await e.request({method:"wallet_addEthereumChain",params:[{chainId:t,chainName:i.name,nativeCurrency:i.nativeCurrency,rpcUrls:[((n=i.rpcUrls.public)==null?void 0:n.http[0])??""],blockExplorerUrls:this.getBlockExplorerUrls(i)}]}),i}catch(a){throw new F0(a)}throw new pt(r)}}async watchAsset({address:u,decimals:e=18,image:t,symbol:n}){return(await this.getProvider()).request({method:"wallet_watchAsset",params:{type:"ERC20",options:{address:u,decimals:e,image:t,symbol:n}}})}};zo=new WeakMap;Ai=new WeakMap;var O3,gCu=class extends Fa{constructor({chains:u,options:e}={}){const t={name:"MetaMask",shimDisconnect:!0,getProvider(){function n(i){if(i!=null&&i.isMetaMask&&!(i.isBraveWallet&&!i._events&&!i._state)&&!i.isApexWallet&&!i.isAvalanche&&!i.isBitKeep&&!i.isBlockWallet&&!i.isCoin98&&!i.isFordefi&&!i.isMathWallet&&!(i.isOkxWallet||i.isOKExWallet)&&!(i.isOneInchIOSWallet||i.isOneInchAndroidWallet)&&!i.isOpera&&!i.isPortal&&!i.isRabby&&!i.isDefiant&&!i.isTokenPocket&&!i.isTokenary&&!i.isZeal&&!i.isZerion)return i}if(typeof window>"u")return;const r=window.ethereum;return r!=null&&r.providers?r.providers.find(n):n(r)},...e};super({chains:u,options:t}),this.id="metaMask",this.shimDisconnectKey=`${this.id}.shimDisconnect`,b0(this,O3,void 0),Jt(this,O3,t.UNSTABLE_shimOnConnectSelectAccount)}async connect({chainId:u}={}){var e,t,n,r;try{const i=await this.getProvider();if(!i)throw new We;i.on&&(i.on("accountsChanged",this.onAccountsChanged),i.on("chainChanged",this.onChainChanged),i.on("disconnect",this.onDisconnect)),this.emit("message",{type:"connecting"});let a=null;if(Tu(this,O3)&&((e=this.options)!=null&&e.shimDisconnect)&&!((t=this.storage)!=null&&t.getItem(this.shimDisconnectKey))&&(a=await this.getAccount().catch(()=>null),!!a))try{await i.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}),a=await this.getAccount()}catch(c){if(this.isUserRejectedRequestError(c))throw new F0(c);if(c.code===new Yt(c).code)throw c}if(!a){const l=await i.request({method:"eth_requestAccounts"});a=a0(l[0])}let o=await this.getChainId(),s=this.isChainUnsupported(o);return u&&o!==u&&(o=(await this.switchChain(u)).id,s=this.isChainUnsupported(o)),(n=this.options)!=null&&n.shimDisconnect&&((r=this.storage)==null||r.setItem(this.shimDisconnectKey,!0)),{account:a,chain:{id:o,unsupported:s},provider:i}}catch(i){throw this.isUserRejectedRequestError(i)?new F0(i):i.code===-32002?new Yt(i):i}}};O3=new WeakMap;var vCu=/(imtoken|metamask|rainbow|trust wallet|uniswap wallet|ledger)/i,lr,F6,ik,BCu=class extends Z4{constructor(){super(...arguments),b0(this,F6),this.id="walletConnectLegacy",this.name="WalletConnectLegacy",this.ready=!0,b0(this,lr,void 0),this.onAccountsChanged=u=>{u.length===0?this.emit("disconnect"):this.emit("change",{account:a0(u[0])})},this.onChainChanged=u=>{const e=Ir(u),t=this.isChainUnsupported(e);this.emit("change",{chain:{id:e,unsupported:t}})},this.onDisconnect=()=>{this.emit("disconnect")}}async connect({chainId:u}={}){var e,t,n,r,i,a;try{let o=u;if(!o){const p=(e=this.storage)==null?void 0:e.getItem("store"),C=(r=(n=(t=p==null?void 0:p.state)==null?void 0:t.data)==null?void 0:n.chain)==null?void 0:r.id;C&&!this.isChainUnsupported(C)&&(o=C)}const s=await this.getProvider({chainId:o,create:!0});s.on("accountsChanged",this.onAccountsChanged),s.on("chainChanged",this.onChainChanged),s.on("disconnect",this.onDisconnect),setTimeout(()=>this.emit("message",{type:"connecting"}),0);const l=await s.enable(),c=a0(l[0]),E=await this.getChainId(),d=this.isChainUnsupported(E),f=((a=(i=s.connector)==null?void 0:i.peerMeta)==null?void 0:a.name)??"";return vCu.test(f)&&(this.switchChain=D0(this,F6,ik)),{account:c,chain:{id:E,unsupported:d}}}catch(o){throw/user closed modal/i.test(o.message)?new F0(o):o}}async disconnect(){const u=await this.getProvider();await u.disconnect(),u.removeListener("accountsChanged",this.onAccountsChanged),u.removeListener("chainChanged",this.onChainChanged),u.removeListener("disconnect",this.onDisconnect),typeof localStorage<"u"&&localStorage.removeItem("walletconnect")}async getAccount(){const e=(await this.getProvider()).accounts;return a0(e[0])}async getChainId(){const u=await this.getProvider();return Ir(u.chainId)}async getProvider({chainId:u,create:e}={}){var t,n;if(!Tu(this,lr)||u||e){const r=(t=this.options)!=null&&t.infuraId?{}:this.chains.reduce((a,o)=>({...a,[o.id]:o.rpcUrls.default.http[0]}),{}),i=(await xu(()=>import("./index-iunrmsho.js"),__vite__mapDeps([4,1,5,3]))).default;Jt(this,lr,new i({...this.options,chainId:u,rpc:{...r,...(n=this.options)==null?void 0:n.rpc}})),Tu(this,lr).http=await Tu(this,lr).setHttpProvider(u)}return Tu(this,lr)}async getWalletClient({chainId:u}={}){const[e,t]=await Promise.all([this.getProvider({chainId:u}),this.getAccount()]),n=this.chains.find(r=>r.id===u);if(!e)throw new Error("provider is required.");return Ka({account:t,chain:n,transport:qa(e)})}async isAuthorized(){try{return!!await this.getAccount()}catch{return!1}}};lr=new WeakMap;F6=new WeakSet;ik=async function(u){const e=await this.getProvider(),t=vu(u);try{return await Promise.race([e.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}),new Promise(n=>this.on("change",({chain:r})=>{(r==null?void 0:r.id)===u&&n(u)}))]),this.chains.find(n=>n.id===u)??{id:u,name:`Chain ${t}`,network:`${t}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}}}catch(n){const r=typeof n=="string"?n:n==null?void 0:n.message;throw/user rejected request/i.test(r)?new F0(n):new pt(n)}};var ak={},v2={},iC={exports:{}},Hi=typeof Reflect=="object"?Reflect:null,wA=Hi&&typeof Hi.apply=="function"?Hi.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},I3;Hi&&typeof Hi.ownKeys=="function"?I3=Hi.ownKeys:Object.getOwnPropertySymbols?I3=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:I3=function(e){return Object.getOwnPropertyNames(e)};function FCu(u){console&&console.warn&&console.warn(u)}var ok=Number.isNaN||function(e){return e!==e};function Vu(){Vu.init.call(this)}iC.exports=Vu;iC.exports.once=wCu;Vu.EventEmitter=Vu;Vu.prototype._events=void 0;Vu.prototype._eventsCount=0;Vu.prototype._maxListeners=void 0;var xA=10;function B2(u){if(typeof u!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof u)}Object.defineProperty(Vu,"defaultMaxListeners",{enumerable:!0,get:function(){return xA},set:function(u){if(typeof u!="number"||u<0||ok(u))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+u+".");xA=u}});Vu.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};Vu.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||ok(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function sk(u){return u._maxListeners===void 0?Vu.defaultMaxListeners:u._maxListeners}Vu.prototype.getMaxListeners=function(){return sk(this)};Vu.prototype.emit=function(e){for(var t=[],n=1;n0&&(a=t[0]),a instanceof Error)throw a;var o=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var s=i[e];if(s===void 0)return!1;if(typeof s=="function")wA(s,this,t);else for(var l=s.length,c=fk(s,l),n=0;n0&&a.length>r&&!a.warned){a.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=u,o.type=e,o.count=a.length,FCu(o)}return u}Vu.prototype.addListener=function(e,t){return lk(this,e,t,!1)};Vu.prototype.on=Vu.prototype.addListener;Vu.prototype.prependListener=function(e,t){return lk(this,e,t,!0)};function yCu(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function ck(u,e,t){var n={fired:!1,wrapFn:void 0,target:u,type:e,listener:t},r=yCu.bind(n);return r.listener=t,n.wrapFn=r,r}Vu.prototype.once=function(e,t){return B2(t),this.on(e,ck(this,e,t)),this};Vu.prototype.prependOnceListener=function(e,t){return B2(t),this.prependListener(e,ck(this,e,t)),this};Vu.prototype.removeListener=function(e,t){var n,r,i,a,o;if(B2(t),r=this._events,r===void 0)return this;if(n=r[e],n===void 0)return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if(typeof n!="function"){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():DCu(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit("removeListener",e,o||t)}return this};Vu.prototype.off=Vu.prototype.removeListener;Vu.prototype.removeAllListeners=function(e){var t,n,r;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r=0;r--)this.removeListener(e,t[r]);return this};function Ek(u,e,t){var n=u._events;if(n===void 0)return[];var r=n[e];return r===void 0?[]:typeof r=="function"?t?[r.listener||r]:[r]:t?bCu(r):fk(r,r.length)}Vu.prototype.listeners=function(e){return Ek(this,e,!0)};Vu.prototype.rawListeners=function(e){return Ek(this,e,!1)};Vu.listenerCount=function(u,e){return typeof u.listenerCount=="function"?u.listenerCount(e):dk.call(u,e)};Vu.prototype.listenerCount=dk;function dk(u){var e=this._events;if(e!==void 0){var t=e[u];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}Vu.prototype.eventNames=function(){return this._eventsCount>0?I3(this._events):[]};function fk(u,e){for(var t=new Array(e),n=0;n(s&&(s.hash=n[0]),s));case"eth_getTransactionReceipt":{let s=n[0];try{s=(await this.sdk.txs.getBySafeTxHash(s)).txHash||s}catch{}return this.sdk.eth.getTransactionReceipt([s]).then(l=>(l&&(l.transactionHash=n[0]),l))}case"eth_estimateGas":return this.sdk.eth.getEstimateGas(n[0]);case"eth_call":return this.sdk.eth.call([n[0],n[1]]);case"eth_getLogs":return this.sdk.eth.getPastLogs([n[0]]);case"eth_gasPrice":return this.sdk.eth.getGasPrice();case"wallet_getPermissions":return this.sdk.wallet.getPermissions();case"wallet_requestPermissions":return this.sdk.wallet.requestPermissions(n[0]);case"safe_setSettings":return this.sdk.eth.setSafeSettings([n[0]]);default:throw Error(`"${e.method}" not implemented`)}}send(e,t){e||t("Undefined request"),this.request(e).then(n=>t(null,{jsonrpc:"2.0",id:e.id,result:n})).catch(n=>t(n,null))}}v2.SafeAppProvider=SCu;(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.SafeAppProvider=void 0;var e=v2;Object.defineProperty(u,"SafeAppProvider",{enumerable:!0,get:function(){return e.SafeAppProvider}})})(ak);var hk={},Zl={},mk={},Cs={},hs={};const TCu="@safe-global/safe-apps-sdk",PCu="8.1.0",OCu="SDK developed to integrate third-party apps with Safe app.",ICu="dist/src/index.js",zCu="dist/src/index.d.ts",jCu=["dist/**/*","src/**/*","CHANGELOG.md","README.md"],RCu=!1,NCu=["Safe","sdk","apps"],$Cu={test:"jest","format-dist":`sed -i '' 's/"files":/"_files":/' dist/package.json`,build:"yarn rimraf dist && tsc && yarn format-dist"},MCu="Safe (https://safe.global)",LCu="MIT",WCu={"@safe-global/safe-gateway-typescript-sdk":"^3.5.3",viem:"^1.0.0"},UCu={type:"git",url:"git+https://github.com/safe-global/safe-apps-sdk.git"},qCu={url:"https://github.com/safe-global/safe-apps-sdk/issues"},HCu="https://github.com/safe-global/safe-apps-sdk#readme",KCu={access:"public"},VCu={name:TCu,version:PCu,description:OCu,main:ICu,typings:zCu,_files:jCu,sideEffects:RCu,keywords:NCu,scripts:$Cu,author:MCu,license:LCu,dependencies:WCu,repository:UCu,bugs:qCu,homepage:HCu,publishConfig:KCu};var GCu=mu&&mu.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(hs,"__esModule",{value:!0});hs.getSDKVersion=void 0;const QCu=GCu(VCu),XCu=()=>QCu.default.version.split("-")[0];hs.getSDKVersion=XCu;var y2={};Object.defineProperty(y2,"__esModule",{value:!0});y2.generateRequestId=void 0;const YCu=u=>u.toString(16).padStart(2,"0"),ZCu=u=>{const e=new Uint8Array((u||40)/2);return window.crypto.getRandomValues(e),Array.from(e,YCu).join("")},JCu=()=>typeof window<"u"?ZCu(10):new Date().getTime().toString(36);y2.generateRequestId=JCu;Object.defineProperty(Cs,"__esModule",{value:!0});Cs.MessageFormatter=void 0;const uhu=hs,ehu=y2;class D2{}Cs.MessageFormatter=D2;D2.makeRequest=(u,e)=>({id:(0,ehu.generateRequestId)(),method:u,params:e,env:{sdkVersion:(0,uhu.getSDKVersion)()}});D2.makeResponse=(u,e,t)=>({id:u,success:!0,version:t,data:e});D2.makeErrorResponse=(u,e,t)=>({id:u,success:!1,error:e,version:t});var ei={};(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.RestrictedMethods=u.Methods=void 0,function(e){e.sendTransactions="sendTransactions",e.rpcCall="rpcCall",e.getChainInfo="getChainInfo",e.getSafeInfo="getSafeInfo",e.getTxBySafeTxHash="getTxBySafeTxHash",e.getSafeBalances="getSafeBalances",e.signMessage="signMessage",e.signTypedMessage="signTypedMessage",e.getEnvironmentInfo="getEnvironmentInfo",e.getOffChainSignature="getOffChainSignature",e.requestAddressBook="requestAddressBook",e.wallet_getPermissions="wallet_getPermissions",e.wallet_requestPermissions="wallet_requestPermissions"}(u.Methods||(u.Methods={})),function(e){e.requestAddressBook="requestAddressBook"}(u.RestrictedMethods||(u.RestrictedMethods={}))})(ei);(function(u){var e=mu&&mu.__createBinding||(Object.create?function(i,a,o,s){s===void 0&&(s=o);var l=Object.getOwnPropertyDescriptor(a,o);(!l||("get"in l?!a.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(i,s,l)}:function(i,a,o,s){s===void 0&&(s=o),i[s]=a[o]}),t=mu&&mu.__exportStar||function(i,a){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&e(a,i,o)};Object.defineProperty(u,"__esModule",{value:!0});const n=Cs;class r{constructor(a=null,o=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer=typeof window>"u",this.isValidMessage=({origin:s,data:l,source:c})=>{const E=!l,d=!this.isServer&&c===window.parent,p=(typeof l.version<"u"&&parseInt(l.version.split(".")[0]))>=1;let C=!0;return Array.isArray(this.allowedOrigins)&&(C=this.allowedOrigins.find(v=>v.test(s))!==void 0),!E&&d&&p&&C},this.logIncomingMessage=s=>{console.info(`Safe Apps SDK v1: A message was received from origin ${s.origin}. `,s.data)},this.onParentMessage=s=>{this.isValidMessage(s)&&(this.debugMode&&this.logIncomingMessage(s),this.handleIncomingMessage(s.data))},this.handleIncomingMessage=s=>{const{id:l}=s,c=this.callbacks.get(l);c&&(c(s),this.callbacks.delete(l))},this.send=(s,l)=>{const c=n.MessageFormatter.makeRequest(s,l);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(c,"*"),new Promise((E,d)=>{this.callbacks.set(c.id,f=>{if(!f.success){d(new Error(f.error));return}E(f)})})},this.allowedOrigins=a,this.debugMode=o,this.isServer||window.addEventListener("message",this.onParentMessage)}}u.default=r,t(ei,u)})(mk);var b2={},w2={},x2={};Object.defineProperty(x2,"__esModule",{value:!0});x2.isObjectEIP712TypedData=void 0;const thu=u=>typeof u=="object"&&u!=null&&"domain"in u&&"types"in u&&"message"in u;x2.isObjectEIP712TypedData=thu;var Ak={};Object.defineProperty(Ak,"__esModule",{value:!0});var gk={},vk={},Nn={},Dt={},aC=mu&&mu.__awaiter||function(u,e,t,n){function r(i){return i instanceof t?i:new t(function(a){a(i)})}return new(t||(t=Promise))(function(i,a){function o(c){try{l(n.next(c))}catch(E){a(E)}}function s(c){try{l(n.throw(c))}catch(E){a(E)}}function l(c){c.done?i(c.value):r(c.value).then(o,s)}l((n=n.apply(u,e||[])).next())})};Object.defineProperty(Dt,"__esModule",{value:!0});Dt.deleteData=Dt.fetchData=Dt.stringifyQuery=Dt.insertParams=void 0;const nhu=u=>typeof u=="object"&&u!==null&&"code"in u&&"message"in u;function rhu(u,e,t){return u.replace(new RegExp(`\\{${e}\\}`,"g"),t)}function ihu(u,e){return e?Object.keys(e).reduce((t,n)=>rhu(t,n,String(e[n])),u):u}Dt.insertParams=ihu;function ahu(u){if(!u)return"";const e=new URLSearchParams;Object.keys(u).forEach(n=>{u[n]!=null&&e.append(n,String(u[n]))});const t=e.toString();return t?`?${t}`:""}Dt.stringifyQuery=ahu;function Bk(u){return aC(this,void 0,void 0,function*(){let e;try{e=yield u.json()}catch{if(u.headers&&u.headers.get("content-length")!=="0")throw new Error(`Invalid response content: ${u.statusText}`)}if(!u.ok){const t=nhu(e)?`${e.code}: ${e.message}`:u.statusText;throw new Error(t)}return e})}function ohu(u,e){return aC(this,void 0,void 0,function*(){let t;e!=null&&(t={method:"POST",body:typeof e=="string"?e:JSON.stringify(e),headers:{"Content-Type":"application/json"}});const n=yield fetch(u,t);return Bk(n)})}Dt.fetchData=ohu;function shu(u){return aC(this,void 0,void 0,function*(){const t=yield fetch(u,{method:"DELETE"});return Bk(t)})}Dt.deleteData=shu;Object.defineProperty(Nn,"__esModule",{value:!0});Nn.deleteEndpoint=Nn.getEndpoint=Nn.postEndpoint=void 0;const _a=Dt;function oC(u,e,t,n){const r=(0,_a.insertParams)(e,t),i=(0,_a.stringifyQuery)(n);return`${u}${r}${i}`}function lhu(u,e,t){const n=oC(u,e,t==null?void 0:t.path,t==null?void 0:t.query);return(0,_a.fetchData)(n,t==null?void 0:t.body)}Nn.postEndpoint=lhu;function chu(u,e,t,n){if(n)return(0,_a.fetchData)(n);const r=oC(u,e,t==null?void 0:t.path,t==null?void 0:t.query);return(0,_a.fetchData)(r)}Nn.getEndpoint=chu;function Ehu(u,e,t){const n=oC(u,e,t==null?void 0:t.path);return(0,_a.deleteData)(n)}Nn.deleteEndpoint=Ehu;var k2={};Object.defineProperty(k2,"__esModule",{value:!0});k2.DEFAULT_BASE_URL=void 0;k2.DEFAULT_BASE_URL="https://safe-client.safe.global";var Fk={};(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.ImplementationVersionState=void 0,function(e){e.UP_TO_DATE="UP_TO_DATE",e.OUTDATED="OUTDATED",e.UNKNOWN="UNKNOWN"}(u.ImplementationVersionState||(u.ImplementationVersionState={}))})(Fk);var yk={};(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.SafeAppSocialPlatforms=u.SafeAppFeatures=u.SafeAppAccessPolicyTypes=void 0,function(e){e.NoRestrictions="NO_RESTRICTIONS",e.DomainAllowlist="DOMAIN_ALLOWLIST"}(u.SafeAppAccessPolicyTypes||(u.SafeAppAccessPolicyTypes={})),function(e){e.BATCHED_TRANSACTIONS="BATCHED_TRANSACTIONS"}(u.SafeAppFeatures||(u.SafeAppFeatures={})),function(e){e.TWITTER="TWITTER",e.GITHUB="GITHUB",e.DISCORD="DISCORD"}(u.SafeAppSocialPlatforms||(u.SafeAppSocialPlatforms={}))})(yk);var Dk={};(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.LabelValue=u.DetailedExecutionInfoType=u.TransactionListItemType=u.ConflictType=u.TransactionInfoType=u.SettingsInfoType=u.TransactionTokenType=u.TransferDirection=u.TransactionStatus=u.Operation=void 0,function(e){e[e.CALL=0]="CALL",e[e.DELEGATE=1]="DELEGATE"}(u.Operation||(u.Operation={})),function(e){e.AWAITING_CONFIRMATIONS="AWAITING_CONFIRMATIONS",e.AWAITING_EXECUTION="AWAITING_EXECUTION",e.CANCELLED="CANCELLED",e.FAILED="FAILED",e.SUCCESS="SUCCESS"}(u.TransactionStatus||(u.TransactionStatus={})),function(e){e.INCOMING="INCOMING",e.OUTGOING="OUTGOING",e.UNKNOWN="UNKNOWN"}(u.TransferDirection||(u.TransferDirection={})),function(e){e.ERC20="ERC20",e.ERC721="ERC721",e.NATIVE_COIN="NATIVE_COIN"}(u.TransactionTokenType||(u.TransactionTokenType={})),function(e){e.SET_FALLBACK_HANDLER="SET_FALLBACK_HANDLER",e.ADD_OWNER="ADD_OWNER",e.REMOVE_OWNER="REMOVE_OWNER",e.SWAP_OWNER="SWAP_OWNER",e.CHANGE_THRESHOLD="CHANGE_THRESHOLD",e.CHANGE_IMPLEMENTATION="CHANGE_IMPLEMENTATION",e.ENABLE_MODULE="ENABLE_MODULE",e.DISABLE_MODULE="DISABLE_MODULE",e.SET_GUARD="SET_GUARD",e.DELETE_GUARD="DELETE_GUARD"}(u.SettingsInfoType||(u.SettingsInfoType={})),function(e){e.TRANSFER="Transfer",e.SETTINGS_CHANGE="SettingsChange",e.CUSTOM="Custom",e.CREATION="Creation"}(u.TransactionInfoType||(u.TransactionInfoType={})),function(e){e.NONE="None",e.HAS_NEXT="HasNext",e.END="End"}(u.ConflictType||(u.ConflictType={})),function(e){e.TRANSACTION="TRANSACTION",e.LABEL="LABEL",e.CONFLICT_HEADER="CONFLICT_HEADER",e.DATE_LABEL="DATE_LABEL"}(u.TransactionListItemType||(u.TransactionListItemType={})),function(e){e.MULTISIG="MULTISIG",e.MODULE="MODULE"}(u.DetailedExecutionInfoType||(u.DetailedExecutionInfoType={})),function(e){e.Queued="Queued",e.Next="Next"}(u.LabelValue||(u.LabelValue={}))})(Dk);var bk={};(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.FEATURES=u.GAS_PRICE_TYPE=u.RPC_AUTHENTICATION=void 0,function(e){e.API_KEY_PATH="API_KEY_PATH",e.NO_AUTHENTICATION="NO_AUTHENTICATION",e.UNKNOWN="UNKNOWN"}(u.RPC_AUTHENTICATION||(u.RPC_AUTHENTICATION={})),function(e){e.ORACLE="ORACLE",e.FIXED="FIXED",e.FIXED_1559="FIXED1559",e.UNKNOWN="UNKNOWN"}(u.GAS_PRICE_TYPE||(u.GAS_PRICE_TYPE={})),function(e){e.ERC721="ERC721",e.SAFE_APPS="SAFE_APPS",e.CONTRACT_INTERACTION="CONTRACT_INTERACTION",e.DOMAIN_LOOKUP="DOMAIN_LOOKUP",e.SPENDING_LIMIT="SPENDING_LIMIT",e.EIP1559="EIP1559",e.SAFE_TX_GAS_OPTIONAL="SAFE_TX_GAS_OPTIONAL",e.TX_SIMULATION="TX_SIMULATION",e.EIP1271="EIP1271"}(u.FEATURES||(u.FEATURES={}))})(bk);var wk={};(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.TokenType=void 0,function(e){e.ERC20="ERC20",e.ERC721="ERC721",e.NATIVE_TOKEN="NATIVE_TOKEN"}(u.TokenType||(u.TokenType={}))})(wk);var xk={};Object.defineProperty(xk,"__esModule",{value:!0});var kk={};Object.defineProperty(kk,"__esModule",{value:!0});var _k={};(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.SafeMessageStatus=u.SafeMessageListItemType=void 0,function(e){e.DATE_LABEL="DATE_LABEL",e.MESSAGE="MESSAGE"}(u.SafeMessageListItemType||(u.SafeMessageListItemType={})),function(e){e.NEEDS_CONFIRMATION="NEEDS_CONFIRMATION",e.CONFIRMED="CONFIRMED"}(u.SafeMessageStatus||(u.SafeMessageStatus={}))})(_k);var Sk={};(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.DeviceType=void 0,function(e){e.ANDROID="ANDROID",e.IOS="IOS",e.WEB="WEB"}(u.DeviceType||(u.DeviceType={}))})(Sk);(function(u){var e=mu&&mu.__createBinding||(Object.create?function(M,j,Y,uu){uu===void 0&&(uu=Y);var J=Object.getOwnPropertyDescriptor(j,Y);(!J||("get"in J?!j.__esModule:J.writable||J.configurable))&&(J={enumerable:!0,get:function(){return j[Y]}}),Object.defineProperty(M,uu,J)}:function(M,j,Y,uu){uu===void 0&&(uu=Y),M[uu]=j[Y]}),t=mu&&mu.__exportStar||function(M,j){for(var Y in M)Y!=="default"&&!Object.prototype.hasOwnProperty.call(j,Y)&&e(j,M,Y)};Object.defineProperty(u,"__esModule",{value:!0}),u.unregisterDevice=u.unregisterSafe=u.registerDevice=u.getDelegates=u.confirmSafeMessage=u.proposeSafeMessage=u.getSafeMessage=u.getSafeMessages=u.getDecodedData=u.getMasterCopies=u.getSafeApps=u.getChainConfig=u.getChainsConfig=u.proposeTransaction=u.getNonces=u.postSafeGasEstimation=u.getTransactionDetails=u.getTransactionQueue=u.getTransactionHistory=u.getCollectiblesPage=u.getCollectibles=u.getOwnedSafes=u.getFiatCurrencies=u.getBalances=u.getMultisigTransactions=u.getModuleTransactions=u.getIncomingTransfers=u.getSafeInfo=u.setBaseUrl=void 0;const n=Nn,r=k2;t(Fk,u),t(yk,u),t(Dk,u),t(bk,u),t(wk,u),t(xk,u),t(kk,u),t(_k,u),t(Sk,u);let i=r.DEFAULT_BASE_URL;const a=M=>{i=M};u.setBaseUrl=a;function o(M,j){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}",{path:{chainId:M,address:j}})}u.getSafeInfo=o;function s(M,j,Y,uu){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/incoming-transfers/",{path:{chainId:M,address:j},query:Y},uu)}u.getIncomingTransfers=s;function l(M,j,Y,uu){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/module-transactions/",{path:{chainId:M,address:j},query:Y},uu)}u.getModuleTransactions=l;function c(M,j,Y,uu){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/multisig-transactions/",{path:{chainId:M,address:j},query:Y},uu)}u.getMultisigTransactions=c;function E(M,j,Y="usd",uu={}){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/balances/{currency}",{path:{chainId:M,address:j,currency:Y},query:uu})}u.getBalances=E;function d(){return(0,n.getEndpoint)(i,"/v1/balances/supported-fiat-codes")}u.getFiatCurrencies=d;function f(M,j){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/owners/{address}/safes",{path:{chainId:M,address:j}})}u.getOwnedSafes=f;function p(M,j,Y={}){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:M,address:j},query:Y})}u.getCollectibles=p;function C(M,j,Y={},uu){return(0,n.getEndpoint)(i,"/v2/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:M,address:j},query:Y},uu)}u.getCollectiblesPage=C;function v(M,j,Y){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/transactions/history",{path:{chainId:M,safe_address:j},query:{}},Y)}u.getTransactionHistory=v;function A(M,j,Y,uu){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/transactions/queued",{path:{chainId:M,safe_address:j},query:{trusted:uu}},Y)}u.getTransactionQueue=A;function m(M,j){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/transactions/{transactionId}",{path:{chainId:M,transactionId:j}})}u.getTransactionDetails=m;function g(M,j,Y){return(0,n.postEndpoint)(i,"/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations",{path:{chainId:M,safe_address:j},body:Y})}u.postSafeGasEstimation=g;function B(M,j){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/nonces",{path:{chainId:M,safe_address:j}})}u.getNonces=B;function D(M,j,Y){return(0,n.postEndpoint)(i,"/v1/chains/{chainId}/transactions/{safe_address}/propose",{path:{chainId:M,safe_address:j},body:Y})}u.proposeTransaction=D;function F(M){return(0,n.getEndpoint)(i,"/v1/chains",{query:M})}u.getChainsConfig=F;function h(M){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}",{path:{chainId:M}})}u.getChainConfig=h;function b(M,j={}){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safe-apps",{path:{chainId:M},query:j})}u.getSafeApps=b;function T(M){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/about/master-copies",{path:{chainId:M}})}u.getMasterCopies=T;function k(M,j,Y){return(0,n.postEndpoint)(i,"/v1/chains/{chainId}/data-decoder",{path:{chainId:M},body:{data:j,to:Y}})}u.getDecodedData=k;function L(M,j,Y){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:M,safe_address:j},query:{}},Y)}u.getSafeMessages=L;function Q(M,j){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/messages/{message_hash}",{path:{chainId:M,message_hash:j}})}u.getSafeMessage=Q;function Z(M,j,Y){return(0,n.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:M,safe_address:j},body:Y})}u.proposeSafeMessage=Z;function tu(M,j,Y){return(0,n.postEndpoint)(i,"/v1/chains/{chainId}/messages/{message_hash}/signatures",{path:{chainId:M,message_hash:j},body:Y})}u.confirmSafeMessage=tu;function q(M,j={}){return(0,n.getEndpoint)(i,"/v1/chains/{chainId}/delegates",{path:{chainId:M},query:j})}u.getDelegates=q;function V(M){return(0,n.postEndpoint)(i,"/v1/register/notifications",{body:M})}u.registerDevice=V;function G(M,j,Y){return(0,n.deleteEndpoint)(i,"/v1/chains/{chainId}/notifications/devices/{uuid}/safes/{safe_address}",{path:{chainId:M,safe_address:j,uuid:Y}})}u.unregisterSafe=G;function W(M,j){return(0,n.deleteEndpoint)(i,"/v1/chains/{chainId}/notifications/devices/{uuid}",{path:{chainId:M,uuid:j}})}u.unregisterDevice=W})(vk);(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.TransferDirection=u.TransactionStatus=u.TokenType=u.Operation=void 0;var e=vk;Object.defineProperty(u,"Operation",{enumerable:!0,get:function(){return e.Operation}}),Object.defineProperty(u,"TokenType",{enumerable:!0,get:function(){return e.TokenType}}),Object.defineProperty(u,"TransactionStatus",{enumerable:!0,get:function(){return e.TransactionStatus}}),Object.defineProperty(u,"TransferDirection",{enumerable:!0,get:function(){return e.TransferDirection}})})(gk);var Tk={};Object.defineProperty(Tk,"__esModule",{value:!0});(function(u){var e=mu&&mu.__createBinding||(Object.create?function(n,r,i,a){a===void 0&&(a=i);var o=Object.getOwnPropertyDescriptor(r,i);(!o||("get"in o?!r.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return r[i]}}),Object.defineProperty(n,a,o)}:function(n,r,i,a){a===void 0&&(a=i),n[a]=r[i]}),t=mu&&mu.__exportStar||function(n,r){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(r,i)&&e(r,n,i)};Object.defineProperty(u,"__esModule",{value:!0}),t(x2,u),t(Ak,u),t(gk,u),t(Tk,u)})(w2);Object.defineProperty(b2,"__esModule",{value:!0});b2.TXs=void 0;const a3=ei,dhu=w2;class fhu{constructor(e){this.communicator=e}async getBySafeTxHash(e){if(!e)throw new Error("Invalid safeTxHash");return(await this.communicator.send(a3.Methods.getTxBySafeTxHash,{safeTxHash:e})).data}async signMessage(e){const t={message:e};return(await this.communicator.send(a3.Methods.signMessage,t)).data}async signTypedMessage(e){if(!(0,dhu.isObjectEIP712TypedData)(e))throw new Error("Invalid typed data");return(await this.communicator.send(a3.Methods.signTypedMessage,{typedData:e})).data}async send({txs:e,params:t}){if(!e||!e.length)throw new Error("No transactions were passed");const n={txs:e,params:t};return(await this.communicator.send(a3.Methods.sendTransactions,n)).data}}b2.TXs=fhu;var _2={},ms={};Object.defineProperty(ms,"__esModule",{value:!0});ms.RPC_CALLS=void 0;ms.RPC_CALLS={eth_call:"eth_call",eth_gasPrice:"eth_gasPrice",eth_getLogs:"eth_getLogs",eth_getBalance:"eth_getBalance",eth_getCode:"eth_getCode",eth_getBlockByHash:"eth_getBlockByHash",eth_getBlockByNumber:"eth_getBlockByNumber",eth_getStorageAt:"eth_getStorageAt",eth_getTransactionByHash:"eth_getTransactionByHash",eth_getTransactionReceipt:"eth_getTransactionReceipt",eth_getTransactionCount:"eth_getTransactionCount",eth_estimateGas:"eth_estimateGas",safe_setSettings:"safe_setSettings"};Object.defineProperty(_2,"__esModule",{value:!0});_2.Eth=void 0;const Be=ms,phu=ei,$t={defaultBlockParam:(u="latest")=>u,returnFullTxObjectParam:(u=!1)=>u,blockNumberToHex:u=>Number.isInteger(u)?`0x${u.toString(16)}`:u};class Chu{constructor(e){this.communicator=e,this.call=this.buildRequest({call:Be.RPC_CALLS.eth_call,formatters:[null,$t.defaultBlockParam]}),this.getBalance=this.buildRequest({call:Be.RPC_CALLS.eth_getBalance,formatters:[null,$t.defaultBlockParam]}),this.getCode=this.buildRequest({call:Be.RPC_CALLS.eth_getCode,formatters:[null,$t.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:Be.RPC_CALLS.eth_getStorageAt,formatters:[null,$t.blockNumberToHex,$t.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:Be.RPC_CALLS.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:Be.RPC_CALLS.eth_getBlockByHash,formatters:[null,$t.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:Be.RPC_CALLS.eth_getBlockByNumber,formatters:[$t.blockNumberToHex,$t.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:Be.RPC_CALLS.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:Be.RPC_CALLS.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:Be.RPC_CALLS.eth_getTransactionCount,formatters:[null,$t.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:Be.RPC_CALLS.eth_gasPrice}),this.getEstimateGas=t=>this.buildRequest({call:Be.RPC_CALLS.eth_estimateGas})([t]),this.setSafeSettings=this.buildRequest({call:Be.RPC_CALLS.safe_setSettings})}buildRequest(e){const{call:t,formatters:n}=e;return async r=>{n&&Array.isArray(r)&&n.forEach((o,s)=>{o&&(r[s]=o(r[s]))});const i={call:t,params:r||[]};return(await this.communicator.send(phu.Methods.rpcCall,i)).data}}}_2.Eth=Chu;var S2={};const hhu=ec(xH);var Sa={};Object.defineProperty(Sa,"__esModule",{value:!0});Sa.MAGIC_VALUE_BYTES=Sa.MAGIC_VALUE=void 0;const mhu="0x1626ba7e";Sa.MAGIC_VALUE=mhu;const Ahu="0x20c13b0b";Sa.MAGIC_VALUE_BYTES=Ahu;var sC={},As={},jr={};Object.defineProperty(jr,"__esModule",{value:!0});jr.PermissionsError=jr.PERMISSIONS_REQUEST_REJECTED=void 0;jr.PERMISSIONS_REQUEST_REJECTED=4001;class lC extends Error{constructor(e,t,n){super(e),this.code=t,this.data=n,Object.setPrototypeOf(this,lC.prototype)}}jr.PermissionsError=lC;Object.defineProperty(As,"__esModule",{value:!0});As.Wallet=void 0;const s1=ei,o3=jr;class ghu{constructor(e){this.communicator=e}async getPermissions(){return(await this.communicator.send(s1.Methods.wallet_getPermissions,void 0)).data}async requestPermissions(e){if(!this.isPermissionRequestValid(e))throw new o3.PermissionsError("Permissions request is invalid",o3.PERMISSIONS_REQUEST_REJECTED);try{return(await this.communicator.send(s1.Methods.wallet_requestPermissions,e)).data}catch{throw new o3.PermissionsError("Permissions rejected",o3.PERMISSIONS_REQUEST_REJECTED)}}isPermissionRequestValid(e){return e.every(t=>typeof t=="object"?Object.keys(t).every(n=>!!Object.values(s1.RestrictedMethods).includes(n)):!1)}}As.Wallet=ghu;Object.defineProperty(sC,"__esModule",{value:!0});const vhu=As,kA=jr,_A=(u,e)=>e.some(t=>t.parentCapability===u),Bhu=()=>(u,e,t)=>{const n=t.value;return t.value=async function(){const r=new vhu.Wallet(this.communicator);let i=await r.getPermissions();if(_A(e,i)||(i=await r.requestPermissions([{[e]:{}}])),!_A(e,i))throw new kA.PermissionsError("Permissions rejected",kA.PERMISSIONS_REQUEST_REJECTED);return n.apply(this)},t};sC.default=Bhu;var Fhu=mu&&mu.__decorate||function(u,e,t,n){var r=arguments.length,i=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(u,e,t,n);else for(var o=u.length-1;o>=0;o--)(a=u[o])&&(i=(r<3?a(i):r>3?a(e,t,i):a(e,t))||i);return r>3&&i&&Object.defineProperty(e,t,i),i},yhu=mu&&mu.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(S2,"__esModule",{value:!0});S2.Safe=void 0;const s3=hhu,SA=Sa,hn=ei,TA=ms,Dhu=w2,bhu=yhu(sC);class Pk{constructor(e){this.communicator=e}async getChainInfo(){return(await this.communicator.send(hn.Methods.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(hn.Methods.getSafeInfo,void 0)).data}async experimental_getBalances({currency:e="usd"}={}){return(await this.communicator.send(hn.Methods.getSafeBalances,{currency:e})).data}async check1271Signature(e,t="0x"){const n=await this.getInfo(),r=(0,s3.encodeFunctionData)({abi:[{constant:!1,inputs:[{name:"_dataHash",type:"bytes32"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[e,t]}),i={call:TA.RPC_CALLS.eth_call,params:[{to:n.safeAddress,data:r},"latest"]};try{return(await this.communicator.send(hn.Methods.rpcCall,i)).data.slice(0,10).toLowerCase()===SA.MAGIC_VALUE}catch{return!1}}async check1271SignatureBytes(e,t="0x"){const n=await this.getInfo(),r=(0,s3.encodeFunctionData)({abi:[{constant:!1,inputs:[{name:"_data",type:"bytes"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[e,t]}),i={call:TA.RPC_CALLS.eth_call,params:[{to:n.safeAddress,data:r},"latest"]};try{return(await this.communicator.send(hn.Methods.rpcCall,i)).data.slice(0,10).toLowerCase()===SA.MAGIC_VALUE_BYTES}catch{return!1}}calculateMessageHash(e){return(0,s3.hashMessage)(e)}calculateTypedMessageHash(e){const t=typeof e.domain.chainId=="object"?e.domain.chainId.toNumber():Number(e.domain.chainId);let n=e.primaryType;if(!n){const r=Object.values(e.types),i=Object.keys(e.types).filter(a=>r.every(o=>o.every(({type:s})=>s.replace("[","").replace("]","")!==a)));if(i.length===0||i.length>1)throw new Error("Please specify primaryType");n=i[0]}return(0,s3.hashTypedData)({message:e.message,domain:Object.assign(Object.assign({},e.domain),{chainId:t,verifyingContract:e.domain.verifyingContract,salt:e.domain.salt}),types:e.types,primaryType:n})}async getOffChainSignature(e){return(await this.communicator.send(hn.Methods.getOffChainSignature,e)).data}async isMessageSigned(e,t="0x"){let n;if(typeof e=="string"&&(n=async()=>{const r=this.calculateMessageHash(e);return await this.isMessageHashSigned(r,t)}),(0,Dhu.isObjectEIP712TypedData)(e)&&(n=async()=>{const r=this.calculateTypedMessageHash(e);return await this.isMessageHashSigned(r,t)}),n)return await n();throw new Error("Invalid message type")}async isMessageHashSigned(e,t="0x"){const n=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const r of n)if(await r(e,t))return!0;return!1}async getEnvironmentInfo(){return(await this.communicator.send(hn.Methods.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(hn.Methods.requestAddressBook,void 0)).data}}Fhu([(0,bhu.default)()],Pk.prototype,"requestAddressBook",null);S2.Safe=Pk;var whu=mu&&mu.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(Zl,"__esModule",{value:!0});const xhu=whu(mk),khu=b2,_hu=_2,Shu=S2,Thu=As;let Phu=class{constructor(e={}){const{allowedDomains:t=null,debug:n=!1}=e;this.communicator=new xhu.default(t,n),this.eth=new _hu.Eth(this.communicator),this.txs=new khu.TXs(this.communicator),this.safe=new Shu.Safe(this.communicator),this.wallet=new Thu.Wallet(this.communicator)}};Zl.default=Phu;(function(u){var e=mu&&mu.__createBinding||(Object.create?function(a,o,s,l){l===void 0&&(l=s);var c=Object.getOwnPropertyDescriptor(o,s);(!c||("get"in c?!o.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return o[s]}}),Object.defineProperty(a,l,c)}:function(a,o,s,l){l===void 0&&(l=s),a[l]=o[s]}),t=mu&&mu.__exportStar||function(a,o){for(var s in a)s!=="default"&&!Object.prototype.hasOwnProperty.call(o,s)&&e(o,a,s)},n=mu&&mu.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(u,"__esModule",{value:!0}),u.getSDKVersion=void 0;const r=n(Zl);u.default=r.default,t(Zl,u),t(w2,u),t(ei,u),t(Cs,u);var i=hs;Object.defineProperty(u,"getSDKVersion",{enumerable:!0,get:function(){return i.getSDKVersion}})})(hk);const l3=uc(hk);var jo,Ro,Ohu=class extends Z4{constructor({chains:u,options:e}){const t={shimDisconnect:!1,...e};super({chains:u,options:t}),this.id="safe",this.name="Safe",this.ready=!(typeof window>"u")&&(window==null?void 0:window.parent)!==window,b0(this,jo,void 0),b0(this,Ro,void 0),this.shimDisconnectKey=`${this.id}.shimDisconnect`;let n=l3;typeof l3!="function"&&typeof l3.default=="function"&&(n=l3.default),Jt(this,Ro,new n(t))}async connect(){var n;const u=await this.getProvider();if(!u)throw new We;u.on&&(u.on("accountsChanged",this.onAccountsChanged),u.on("chainChanged",this.onChainChanged),u.on("disconnect",this.onDisconnect)),this.emit("message",{type:"connecting"});const e=await this.getAccount(),t=await this.getChainId();return this.options.shimDisconnect&&((n=this.storage)==null||n.setItem(this.shimDisconnectKey,!0)),{account:e,chain:{id:t,unsupported:this.isChainUnsupported(t)}}}async disconnect(){var e;const u=await this.getProvider();u!=null&&u.removeListener&&(u.removeListener("accountsChanged",this.onAccountsChanged),u.removeListener("chainChanged",this.onChainChanged),u.removeListener("disconnect",this.onDisconnect),this.options.shimDisconnect&&((e=this.storage)==null||e.removeItem(this.shimDisconnectKey)))}async getAccount(){const u=await this.getProvider();if(!u)throw new We;const e=await u.request({method:"eth_accounts"});return a0(e[0])}async getChainId(){const u=await this.getProvider();if(!u)throw new We;return Ir(u.chainId)}async getProvider(){if(!Tu(this,jo)){const u=await Tu(this,Ro).safe.getInfo();if(!u)throw new Error("Could not load Safe information");Jt(this,jo,new ak.SafeAppProvider(u,Tu(this,Ro)))}return Tu(this,jo)}async getWalletClient({chainId:u}={}){const e=await this.getProvider(),t=await this.getAccount(),n=this.chains.find(r=>r.id===u);if(!e)throw new Error("provider is required.");return Ka({account:t,chain:n,transport:qa(e)})}async isAuthorized(){var u;try{return this.options.shimDisconnect&&!((u=this.storage)!=null&&u.getItem(this.shimDisconnectKey))?!1:!!await this.getAccount()}catch{return!1}}onAccountsChanged(u){}onChainChanged(u){}onDisconnect(){this.emit("disconnect")}};jo=new WeakMap;Ro=new WeakMap;function Ihu(u){return Object.fromEntries(Object.entries(u).filter(([e,t])=>t!==void 0))}function zhu(u){return"groupName"in u[0]?PA(u):PA([{groupName:"",wallets:u}])()}var PA=u=>()=>{let e=-1;const t=[],n=[],r=[],i=[];return u.forEach(({groupName:o,wallets:s},l)=>{s.forEach(c=>{if(e++,c!=null&&c.iconAccent&&!Mdu(c==null?void 0:c.iconAccent))throw new Error(`Property \`iconAccent\` is not a hex value for wallet: ${c.name}`);const E={...c,groupIndex:l,groupName:o,index:e};typeof c.hidden=="function"?r.push(E):n.push(E)})}),[...n,...r].forEach(({createConnector:o,groupIndex:s,groupName:l,hidden:c,index:E,...d})=>{if(typeof c=="function"&&c({wallets:[...i.map(({connector:m,id:g,installed:B,name:D})=>({connector:m,id:g,installed:B,name:D}))]}))return;const{connector:f,...p}=Ihu(o());let C;if(d.id==="walletConnect"&&p.qrCode&&!U0()){const{chains:A,options:m}=f;C=new rk({chains:A,options:{...m,showQrModal:!0}}),t.push(C)}const v={connector:f,groupIndex:s,groupName:l,index:E,walletConnectModalConnector:C,...d,...p};i.push(v),t.includes(f)||(t.push(f),f._wallets=[]),f._wallets.push(v)}),t},jhu=({chains:u,...e})=>{var t;return{id:"brave",name:"Brave Wallet",iconUrl:async()=>(await xu(()=>import("./braveWallet-BTBH4MDN-rhLwbrvd.js"),__vite__mapDeps([]))).default,iconBackground:"#fff",installed:typeof window<"u"&&((t=window.ethereum)==null?void 0:t.isBraveWallet)===!0,downloadUrls:{},createConnector:()=>({connector:new Fa({chains:u,options:e})})}};function Ok(u){if(typeof window>"u"||typeof window.ethereum>"u")return;const e=window.ethereum.providers;return e?e.find(t=>t[u]):window.ethereum[u]?window.ethereum:void 0}function Ik(u){return!!Ok(u)}function Rhu(u){if(typeof window>"u"||typeof window.ethereum>"u")return;const e=window.ethereum.providers,t=Ok(u);return t||(typeof e<"u"&&e.length>0?e[0]:window.ethereum)}function Nhu({chains:u,flag:e,options:t}){return new Fa({chains:u,options:{getProvider:()=>Rhu(e),...t}})}var $hu=({appName:u,chains:e,...t})=>{const n=Ik("isCoinbaseWallet");return{id:"coinbase",name:"Coinbase Wallet",shortName:"Coinbase",iconUrl:async()=>(await xu(()=>import("./coinbaseWallet-2OUR5TUP-lljav0iR.js"),__vite__mapDeps([]))).default,iconAccent:"#2c5ff6",iconBackground:"#2c5ff6",installed:n||void 0,downloadUrls:{android:"https://play.google.com/store/apps/details?id=org.toshi",ios:"https://apps.apple.com/us/app/coinbase-wallet-store-crypto/id1278383455",mobile:"https://coinbase.com/wallet/downloads",qrCode:"https://coinbase-wallet.onelink.me/q5Sx/fdb9b250",chrome:"https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad",browserExtension:"https://coinbase.com/wallet"},createConnector:()=>{const r=Jr(),i=new ACu({chains:e,options:{appName:u,headlessMode:!0,...t}});return{connector:i,...r?{}:{qrCode:{getUri:async()=>(await i.getProvider()).qrUrl,instructions:{learnMoreUrl:"https://coinbase.com/wallet/articles/getting-started-mobile",steps:[{description:"wallet_connectors.coinbase.qr_code.step1.description",step:"install",title:"wallet_connectors.coinbase.qr_code.step1.title"},{description:"wallet_connectors.coinbase.qr_code.step2.description",step:"create",title:"wallet_connectors.coinbase.qr_code.step2.title"},{description:"wallet_connectors.coinbase.qr_code.step3.description",step:"scan",title:"wallet_connectors.coinbase.qr_code.step3.title"}]}},extension:{instructions:{learnMoreUrl:"https://coinbase.com/wallet/articles/getting-started-extension",steps:[{description:"wallet_connectors.coinbase.extension.step1.description",step:"install",title:"wallet_connectors.coinbase.extension.step1.title"},{description:"wallet_connectors.coinbase.extension.step2.description",step:"create",title:"wallet_connectors.coinbase.extension.step2.title"},{description:"wallet_connectors.coinbase.extension.step3.description",step:"refresh",title:"wallet_connectors.coinbase.extension.step3.title"}]}}}}}}},Mhu=({chains:u,...e})=>({id:"injected",name:"Browser Wallet",iconUrl:async()=>(await xu(()=>import("./injectedWallet-EUKDEAIU-nRYX44n1.js"),__vite__mapDeps([]))).default,iconBackground:"#fff",hidden:({wallets:t})=>t.some(n=>n.installed&&n.name===n.connector.name&&(n.connector instanceof Fa||n.id==="coinbase")),createConnector:()=>({connector:new Fa({chains:u,options:e})})});async function cC(u,e){const t=await u.getProvider();return e==="2"?new Promise(n=>t.once("display_uri",n)):t.connector.uri}var zk=new Map;function Lhu(u,e){const t=u==="1"?new BCu(e):new rk(e);return zk.set(JSON.stringify(e),t),t}function Jl({chains:u,options:e={},projectId:t,version:n="2"}){const r="21fef48091f12692cad574a6f7753643";if(n==="2"){if(!t||t==="")throw new Error("No projectId found. Every dApp must now provide a WalletConnect Cloud projectId to enable WalletConnect v2 https://www.rainbowkit.com/docs/installation#configure");(t==="YOUR_PROJECT_ID"||t===r)&&console.warn("Invalid projectId. Please create a unique WalletConnect Cloud projectId for your dApp https://www.rainbowkit.com/docs/installation#configure")}const i={chains:u,options:n==="1"?{qrcode:!1,...e}:{projectId:t==="YOUR_PROJECT_ID"?r:t,showQrModal:!1,...e}},a=JSON.stringify(i),o=zk.get(a);return o??Lhu(n,i)}function OA(u){return!(!(u!=null&&u.isMetaMask)||u.isBraveWallet&&!u._events&&!u._state||u.isApexWallet||u.isAvalanche||u.isBackpack||u.isBifrost||u.isBitKeep||u.isBitski||u.isBlockWallet||u.isCoinbaseWallet||u.isDawn||u.isEnkrypt||u.isExodus||u.isFrame||u.isFrontier||u.isGamestop||u.isHyperPay||u.isImToken||u.isKuCoinWallet||u.isMathWallet||u.isOkxWallet||u.isOKExWallet||u.isOneInchIOSWallet||u.isOneInchAndroidWallet||u.isOpera||u.isPhantom||u.isPortal||u.isRabby||u.isRainbow||u.isStatus||u.isTalisman||u.isTally||u.isTokenPocket||u.isTokenary||u.isTrust||u.isTrustWallet||u.isXDEFI||u.isZeal||u.isZerion)}var Whu=({chains:u,projectId:e,walletConnectOptions:t,walletConnectVersion:n="2",...r})=>{var i,a;const o=typeof window<"u"&&((i=window.ethereum)==null?void 0:i.providers),s=typeof window<"u"&&typeof window.ethereum<"u"&&(((a=window.ethereum.providers)==null?void 0:a.some(OA))||window.ethereum.isMetaMask),l=!s;return{id:"metaMask",name:"MetaMask",iconUrl:async()=>(await xu(()=>import("./metaMaskWallet-ORHUNQRP-B-MG5eKR.js"),__vite__mapDeps([]))).default,iconAccent:"#f6851a",iconBackground:"#fff",installed:l?void 0:s,downloadUrls:{android:"https://play.google.com/store/apps/details?id=io.metamask",ios:"https://apps.apple.com/us/app/metamask/id1438144202",mobile:"https://metamask.io/download",qrCode:"https://metamask.io/download",chrome:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",edge:"https://microsoftedge.microsoft.com/addons/detail/metamask/ejbalbakoplchlghecdalmeeeajnimhm",firefox:"https://addons.mozilla.org/firefox/addon/ether-metamask",opera:"https://addons.opera.com/extensions/details/metamask-10",browserExtension:"https://metamask.io/download"},createConnector:()=>{const c=l?Jl({projectId:e,chains:u,version:n,options:t}):new gCu({chains:u,options:{getProvider:()=>o?o.find(OA):typeof window<"u"?window.ethereum:void 0,...r}}),E=async()=>{const d=await cC(c,n);return _5()?d:Jr()?`metamask://wc?uri=${encodeURIComponent(d)}`:`https://metamask.app.link/wc?uri=${encodeURIComponent(d)}`};return{connector:c,mobile:{getUri:l?E:void 0},qrCode:l?{getUri:E,instructions:{learnMoreUrl:"https://metamask.io/faqs/",steps:[{description:"wallet_connectors.metamask.qr_code.step1.description",step:"install",title:"wallet_connectors.metamask.qr_code.step1.title"},{description:"wallet_connectors.metamask.qr_code.step2.description",step:"create",title:"wallet_connectors.metamask.qr_code.step2.title"},{description:"wallet_connectors.metamask.qr_code.step3.description",step:"refresh",title:"wallet_connectors.metamask.qr_code.step3.title"}]}}:void 0,extension:{instructions:{learnMoreUrl:"https://metamask.io/faqs/",steps:[{description:"wallet_connectors.metamask.extension.step1.description",step:"install",title:"wallet_connectors.metamask.extension.step1.title"},{description:"wallet_connectors.metamask.extension.step2.description",step:"create",title:"wallet_connectors.metamask.extension.step2.title"},{description:"wallet_connectors.metamask.extension.step3.description",step:"refresh",title:"wallet_connectors.metamask.extension.step3.title"}]}}}}}},Uhu=({chains:u,projectId:e,walletConnectOptions:t,walletConnectVersion:n="2",...r})=>{const i=Ik("isRainbow"),a=!i;return{id:"rainbow",name:"Rainbow",iconUrl:async()=>(await xu(()=>import("./rainbowWallet-GGU64QEI-aO3VF4UJ.js"),__vite__mapDeps([]))).default,iconBackground:"#0c2f78",installed:a?void 0:i,downloadUrls:{android:"https://play.google.com/store/apps/details?id=me.rainbow&referrer=utm_source%3Drainbowkit&utm_source=rainbowkit",ios:"https://apps.apple.com/app/apple-store/id1457119021?pt=119997837&ct=rainbowkit&mt=8",mobile:"https://rainbow.download?utm_source=rainbowkit",qrCode:"https://rainbow.download?utm_source=rainbowkit&utm_medium=qrcode",browserExtension:"https://rainbow.me/extension?utm_source=rainbowkit"},createConnector:()=>{const o=a?Jl({projectId:e,chains:u,version:n,options:t}):Nhu({flag:"isRainbow",chains:u,options:r}),s=async()=>{const l=await cC(o,n);return _5()?l:Jr()?`rainbow://wc?uri=${encodeURIComponent(l)}&connector=rainbowkit`:`https://rnbwapp.com/wc?uri=${encodeURIComponent(l)}&connector=rainbowkit`};return{connector:o,mobile:{getUri:a?s:void 0},qrCode:a?{getUri:s,instructions:{learnMoreUrl:"https://learn.rainbow.me/connect-to-a-website-or-app?utm_source=rainbowkit&utm_medium=connector&utm_campaign=learnmore",steps:[{description:"wallet_connectors.rainbow.qr_code.step1.description",step:"install",title:"wallet_connectors.rainbow.qr_code.step1.title"},{description:"wallet_connectors.rainbow.qr_code.step2.description",step:"create",title:"wallet_connectors.rainbow.qr_code.step2.title"},{description:"wallet_connectors.rainbow.qr_code.step3.description",step:"scan",title:"wallet_connectors.rainbow.qr_code.step3.title"}]}}:void 0}}}},qhu=({chains:u,...e})=>({id:"safe",name:"Safe",iconAccent:"#12ff80",iconBackground:"#fff",iconUrl:async()=>(await xu(()=>import("./safeWallet-DFMLSLCR-0HldBjhm.js"),__vite__mapDeps([]))).default,installed:!(typeof window>"u")&&(window==null?void 0:window.parent)!==window,downloadUrls:{},createConnector:()=>({connector:new Ohu({chains:u,options:e})})}),Hhu=({chains:u,options:e,projectId:t,version:n="2"})=>({id:"walletConnect",name:"WalletConnect",iconUrl:async()=>(await xu(()=>import("./walletConnectWallet-D6ZADJM7-hbivFVny.js"),__vite__mapDeps([]))).default,iconBackground:"#3b99fc",createConnector:()=>{const r=Jr(),i=Jl(n==="1"?{version:"1",chains:u,options:{qrcode:r,...e}}:{version:"2",chains:u,projectId:t,options:{showQrModal:r,...e}}),a=async()=>cC(i,n);return{connector:i,...r?{}:{mobile:{getUri:a},qrCode:{getUri:a}}}}}),Khu=({appName:u,chains:e,projectId:t})=>{const n=[{groupName:"Popular",wallets:[Mhu({chains:e}),qhu({chains:e}),Uhu({chains:e,projectId:t}),$hu({appName:u,chains:e}),Whu({chains:e,projectId:t}),Hhu({chains:e,projectId:t}),jhu({chains:e})]}];return{connectors:zhu(n),wallets:n}};const Vhu=["MarketPlace","Factory"];function Ghu(){const u=e=>{console.log("Redirect to page: ",e)};return w.useEffect(()=>{},[]),ku.jsx(Jj,{position:"static",style:{background:"linear-gradient(269.67deg, #CCE1FA -10.61%, #C6EEEA 113.26%)"},children:ku.jsx(oR,{maxWidth:"xl",children:ku.jsxs(iR,{disableGutters:!0,children:[ku.jsx("img",{src:pR,width:40}),ku.jsx(m8,{sx:{flexGrow:1,display:{xs:"none",md:"flex"}},children:Vhu.map(e=>ku.jsx(Mj,{onClick:()=>u(e),sx:{my:2,color:"#352D50",display:"block"},children:e},e))}),ku.jsx(m8,{sx:{flexGrow:0},children:ku.jsx(W5,{})})]})})})}function Qhu(){return ku.jsxs(FP,{children:[ku.jsx(Ghu,{}),ku.jsx(vP,{children:ku.jsx(EB,{path:"/real-token"})})]})}function Xhu(){return ku.jsx(RT,{children:ku.jsx(Qhu,{})})}const Yhu=$f({palette:{primary:{main:"#556cd6"},secondary:{main:"#19857b"},error:{main:or.A400}}});function Zhu(u){return ku.jsx(RI,lu({},u,{defaultTheme:Mf,themeId:ta}))}const Jhu=(u,e)=>lu({WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",boxSizing:"border-box",WebkitTextSizeAdjust:"100%"},e&&!u.vars&&{colorScheme:u.palette.mode}),u8u=u=>lu({color:(u.vars||u).palette.text.primary},u.typography.body1,{backgroundColor:(u.vars||u).palette.background.default,"@media print":{backgroundColor:(u.vars||u).palette.common.white}}),e8u=(u,e=!1)=>{var t;const n={};e&&u.colorSchemes&&Object.entries(u.colorSchemes).forEach(([a,o])=>{var s;n[u.getColorSchemeSelector(a).replace(/\s*&/,"")]={colorScheme:(s=o.palette)==null?void 0:s.mode}});let r=lu({html:Jhu(u,e),"*, *::before, *::after":{boxSizing:"inherit"},"strong, b":{fontWeight:u.typography.fontWeightBold},body:lu({margin:0},u8u(u),{"&::backdrop":{backgroundColor:(u.vars||u).palette.background.default}})},n);const i=(t=u.components)==null||(t=t.MuiCssBaseline)==null?void 0:t.styleOverrides;return i&&(r=[r,i]),r};function t8u(u){const e=Xn({props:u,name:"MuiCssBaseline"}),{children:t,enableColorScheme:n=!1}=e;return ku.jsxs(w.Fragment,{children:[ku.jsx(Zhu,{styles:r=>e8u(r,n)}),t]})}function n8u(){return function(u){return u.rpcUrls.public.http[0]?{chain:u,rpcUrls:u.rpcUrls.public}:null}}var r8u={VITE_REACT_APP_PROJECT_ID:"9d80089c30635ff84b5339d993d63fa1",BASE_URL:"/real-token/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{chains:jk,publicClient:i8u}=YH([GD,jH,zH,vN,IH,OH,PH,ON],[n8u()]);console.log(" Project ID:",r8u.REACT_APP_PROJECT_ID);const{connectors:a8u}=Khu({appName:"My RainbowKit App",projectId:"9d80089c30635ff84b5339d993d63fa1",chains:jk}),o8u=OK({autoConnect:!0,connectors:a8u,publicClient:i8u});c1.createRoot(document.getElementById("root")).render(ku.jsxs(lR,{theme:Yhu,children:[ku.jsx(t8u,{}),ku.jsx(IK,{config:o8u,children:ku.jsx(ndu,{chains:jk,children:ku.jsx(Xhu,{})})})]}));export{m2 as $,Ce as A,k8u as B,P8u as C,U8u as D,smu as E,F8u as F,$8u as G,N8u as H,x8u as I,D8u as J,g8u as K,v8u as L,I8u as M,Dn as N,O8u as O,Q8u as P,W8u as Q,b5u as R,Je as S,T8u as T,ka as U,m8u as V,_8u as W,amu as X,S8u as Y,imu as Z,fs as _,qM as a,A2 as a0,Y5 as a1,Qx as a2,b8u as a3,w8u as a4,A8u as a5,j8u as a6,R8u as a7,g2 as a8,y8u as a9,ifu as aA,vpu as aB,Wx as aC,Gpu as aD,V5 as aE,Qpu as aF,Xpu as aG,Zpu as aH,Lx as aI,e5u as aJ,r5u as aK,o5u as aL,l5u as aM,E5u as aN,Cpu as aO,Ux as aP,A5u as aQ,g5u as aR,p5u as aS,m5u as aT,dcu as aU,gcu as aV,Z5 as aa,M8u as ab,z8u as ac,L8u as ad,omu as ae,V8u as af,K8u as ag,sCu as ah,nmu as ai,X8u as aj,lCu as ak,H8u as al,umu as am,Y8u as an,emu as ao,rmu as ap,Z8u as aq,J8u as ar,tmu as as,G8u as at,J5u as au,Yx as av,a1 as aw,d8u as ax,f8u as ay,xu as az,HM as b,KM as c,Gy as d,ec as e,Dr as f,PM as g,Ck as h,_u as i,c2 as j,ot as k,qy as l,Y7 as m,Qo as n,mu as o,uc as p,br as q,h2 as r,q8u as s,Ct as t,p8u as u,C8u as v,ht as w,h8u as x,B8u as y,Gx as z}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/index.es-TVuT00BF.js","assets/http-gYlq8-dx.js","assets/index-gYtQYNYB.js","assets/hooks.module-o1hAt1ko.js","assets/index-zQvBO4FF.js","assets/browser-EcNbE0JS.js"] + __vite__mapDeps.viteFileDeps = ["assets/index.es-JhrPxZI8.js","assets/http-I_tKnr4x.js","assets/index-1oLxk3tb.js","assets/hooks.module-o1hAt1ko.js","assets/index-iunrmsho.js","assets/browser-BNgg9dRV.js"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } \ No newline at end of file diff --git a/assets/index-zQvBO4FF.js b/assets/index-iunrmsho.js similarity index 99% rename from assets/index-zQvBO4FF.js rename to assets/index-iunrmsho.js index e4a4667..6923895 100644 --- a/assets/index-zQvBO4FF.js +++ b/assets/index-iunrmsho.js @@ -1,4 +1,4 @@ -import{p as pe,aC as Wn,aD as Fn,aE as Hn,aF as zn,aG as Qn,aH as Jn,aI as Vn,aJ as Gn,aK as Yn,aL as Kn,aM as Zn,aN as Xn,aO as er,aP as tr,aQ as nr,aR as rr,aS as or,aT as ir,e as et,E as tt}from"./index-i7WuWpn4.js";import{a as sr,s as ar,m as cr,c as Q,I as lr,f as $e,J as je,H as ur}from"./http-gYlq8-dx.js";import{b as dr}from"./browser-EcNbE0JS.js";import{b as A,l as C,y as x,g as $,$ as O,q as K,B as hr,E as fr,a as ee,c as ge,d as me,V as nt,s as rt,_ as ot,A as it,F as st,T as at,e as ct,x as lt,f as ut,i as dt,P as _r}from"./hooks.module-o1hAt1ko.js";const ae="Session currently connected",q="Session currently disconnected",pr="Session Rejected",gr="Missing JSON RPC response",mr='JSON-RPC success response must include "result" field',wr='JSON-RPC error response must include "error" field',yr='JSON RPC request must have valid "method" value',br='JSON RPC request must have valid "id" value',vr="Missing one of the required parameters: bridge / uri / session",Be="JSON RPC response format is invalid",Er="URI format is invalid",Cr="QRCode Modal not provided",We="User close QRCode Modal",Sr=["session_request","session_update","exchange_key","connect","disconnect","display_uri","modal_closed","transport_open","transport_close","transport_error"],kr=["wallet_addEthereumChain","wallet_switchEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],we=["eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v2","eth_signTypedData_v3","eth_signTypedData_v4","personal_sign",...kr],ue="WALLETCONNECT_DEEPLINK_CHOICE",xr={1:"mainnet",3:"ropsten",4:"rinkeby",5:"goerli",42:"kovan"};var ht=ye;ye.strict=ft;ye.loose=_t;var Ir=Object.prototype.toString,Rr={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function ye(t){return ft(t)||_t(t)}function ft(t){return t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array}function _t(t){return Rr[Ir.call(t)]}const Tr=pe(ht);var Or=ht.strict,Nr=function(e){if(Or(e)){var n=Buffer.from(e.buffer);return e.byteLength!==e.buffer.byteLength&&(n=n.slice(e.byteOffset,e.byteOffset+e.byteLength)),n}else return Buffer.from(e)};const Mr=pe(Nr),be="hex",ve="utf8",Lr="binary",qr="buffer",Ar="array",Ur="typed-array",Pr="array-buffer",te="0";function j(t){return new Uint8Array(t)}function Ee(t,e=!1){const n=t.toString(be);return e?J(n):n}function Ce(t){return t.toString(ve)}function pt(t){return t.readUIntBE(0,t.length)}function W(t){return Mr(t)}function N(t,e=!1){return Ee(W(t),e)}function gt(t){return Ce(W(t))}function mt(t){return pt(W(t))}function Se(t){return Buffer.from(B(t),be)}function M(t){return j(Se(t))}function Dr(t){return Ce(Se(t))}function $r(t){return mt(M(t))}function ke(t){return Buffer.from(t,ve)}function wt(t){return j(ke(t))}function jr(t,e=!1){return Ee(ke(t),e)}function Br(t){const e=parseInt(t,10);return io(oo(e),"Number can only safely store up to 53 bits"),e}function Wr(t){return Qr(xe(t))}function Fr(t){return Ie(xe(t))}function Hr(t,e){return Jr(xe(t),e)}function zr(t){return`${t}`}function xe(t){const e=(t>>>0).toString(2);return Te(e)}function Qr(t){return W(Ie(t))}function Ie(t){return new Uint8Array(Xr(t).map(e=>parseInt(e,2)))}function Jr(t,e){return N(Ie(t),e)}function Vr(t){return!(typeof t!="string"||!new RegExp(/^[01]+$/).test(t)||t.length%8!==0)}function yt(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}function ne(t){return Buffer.isBuffer(t)}function Re(t){return Tr.strict(t)&&!ne(t)}function bt(t){return!Re(t)&&!ne(t)&&typeof t.byteLength<"u"}function Gr(t){return ne(t)?qr:Re(t)?Ur:bt(t)?Pr:Array.isArray(t)?Ar:typeof t}function Yr(t){return Vr(t)?Lr:yt(t)?be:ve}function Kr(...t){return Buffer.concat(t)}function vt(...t){let e=[];return t.forEach(n=>e=e.concat(Array.from(n))),new Uint8Array([...e])}function Zr(t,e=8){const n=t%e;return n?(t-n)/e*e+e:t}function Xr(t,e=8){const n=Te(t).match(new RegExp(`.{${e}}`,"gi"));return Array.from(n||[])}function Te(t,e=8,n=te){return eo(t,Zr(t.length,e),n)}function eo(t,e,n=te){return so(t,e,!0,n)}function B(t){return t.replace(/^0x/,"")}function J(t){return t.startsWith("0x")?t:`0x${t}`}function to(t){return t=B(t),t=Te(t,2),t&&(t=J(t)),t}function no(t){const e=t.startsWith("0x");return t=B(t),t=t.startsWith(te)?t.substring(1):t,e?J(t):t}function ro(t){return typeof t>"u"}function oo(t){return!ro(t)}function io(t,e){if(!t)throw new Error(e)}function so(t,e,n,r=te){const o=e-t.length;let i=t;if(o>0){const d=r.repeat(o);i=n?d+t:t+d}return i}function Z(t){return W(new Uint8Array(t))}function ao(t){return gt(new Uint8Array(t))}function Et(t,e){return N(new Uint8Array(t),!e)}function co(t){return mt(new Uint8Array(t))}function lo(...t){return M(t.map(e=>N(new Uint8Array(e))).join("")).buffer}function Ct(t){return j(t).buffer}function uo(t){return Ce(t)}function ho(t,e){return Ee(t,!e)}function fo(t){return pt(t)}function _o(...t){return Kr(...t)}function po(t){return wt(t).buffer}function go(t){return ke(t)}function mo(t,e){return jr(t,!e)}function wo(t){return Br(t)}function yo(t){return Se(t)}function St(t){return M(t).buffer}function bo(t){return Dr(t)}function vo(t){return $r(t)}function Eo(t){return Wr(t)}function Co(t){return Fr(t).buffer}function So(t){return zr(t)}function kt(t,e){return Hr(Number(t),!e)}const ko=zn,xo=Qn,Io=Jn,Ro=Vn,To=Gn,xt=Hn,Oo=Yn,It=Wn,No=Kn,Mo=Zn,Lo=Xn,re=Fn;function oe(t){return er(t)}function ie(){const t=oe();return t&&t.os?t.os:void 0}function Rt(){const t=ie();return t?t.toLowerCase().includes("android"):!1}function Tt(){const t=ie();return t?t.toLowerCase().includes("ios")||t.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function Ot(){return ie()?Rt()||Tt():!1}function Nt(){const t=oe();return t&&t.name?t.name.toLowerCase()==="node":!1}function Mt(){return!Nt()&&!!xt()}const Lt=sr,qt=ar;function Oe(t,e){const n=qt(e),r=re();r&&r.setItem(t,n)}function Ne(t){let e=null,n=null;const r=re();return r&&(n=r.getItem(t)),e=n&&Lt(n),e}function Me(t){const e=re();e&&e.removeItem(t)}function de(){return tr()}function qo(t){return to(t)}function Ao(t){return J(t)}function Uo(t){return B(t)}function Po(t){return no(J(t))}const At=cr;function Y(){return((e,n)=>{for(n=e="";e++<36;n+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return n})()}function Do(){console.warn("DEPRECATION WARNING: This WalletConnect client library will be deprecated in favor of @walletconnect/client. Please check docs.walletconnect.org to learn more about this migration!")}function Ut(t,e){let n;const r=xr[t];return r&&(n=`https://${r}.infura.io/v3/${e}`),n}function Pt(t,e){let n;const r=Ut(t,e.infuraId);return e.custom&&e.custom[t]?n=e.custom[t]:r&&(n=r),n}function $o(t,e){const n=encodeURIComponent(t);return e.universalLink?`${e.universalLink}/wc?uri=${n}`:e.deepLink?`${e.deepLink}${e.deepLink.endsWith(":")?"//":"/"}wc?uri=${n}`:""}function jo(t){const e=t.href.split("?")[0];Oe(ue,Object.assign(Object.assign({},t),{href:e}))}function Dt(t,e){return t.filter(n=>n.name.toLowerCase().includes(e.toLowerCase()))[0]}function Bo(t,e){let n=t;return e&&(n=e.map(r=>Dt(t,r)).filter(Boolean)),n}function Wo(t,e){return async(...r)=>new Promise((o,i)=>{const d=(f,p)=>{(f===null||typeof f>"u")&&i(f),o(p)};t.apply(e,[...r,d])})}function $t(t){const e=t.message||"Failed or Rejected Request";let n=-32e3;if(t&&!t.code)switch(e){case"Parse error":n=-32700;break;case"Invalid request":n=-32600;break;case"Method not found":n=-32601;break;case"Invalid params":n=-32602;break;case"Internal error":n=-32603;break;default:n=-32e3;break}const r={code:n,message:e};return t.data&&(r.data=t.data),r}const jt="https://registry.walletconnect.com";function Fo(){return jt+"/api/v2/wallets"}function Ho(){return jt+"/api/v2/dapps"}function Bt(t,e="mobile"){var n;return{name:t.name||"",shortName:t.metadata.shortName||"",color:t.metadata.colors.primary||"",logo:(n=t.image_url.sm)!==null&&n!==void 0?n:"",universalLink:t[e].universal||"",deepLink:t[e].native||""}}function zo(t,e="mobile"){return Object.values(t).filter(n=>!!n[e].universal||!!n[e].native).map(n=>Bt(n,e))}var Le={};(function(t){const e=or,n=ir,r=nr,o=rr,i=s=>s==null;function d(s){switch(s.arrayFormat){case"index":return a=>(u,c)=>{const h=u.length;return c===void 0||s.skipNull&&c===null||s.skipEmptyString&&c===""?u:c===null?[...u,[g(a,s),"[",h,"]"].join("")]:[...u,[g(a,s),"[",g(h,s),"]=",g(c,s)].join("")]};case"bracket":return a=>(u,c)=>c===void 0||s.skipNull&&c===null||s.skipEmptyString&&c===""?u:c===null?[...u,[g(a,s),"[]"].join("")]:[...u,[g(a,s),"[]=",g(c,s)].join("")];case"comma":case"separator":return a=>(u,c)=>c==null||c.length===0?u:u.length===0?[[g(a,s),"=",g(c,s)].join("")]:[[u,g(c,s)].join(s.arrayFormatSeparator)];default:return a=>(u,c)=>c===void 0||s.skipNull&&c===null||s.skipEmptyString&&c===""?u:c===null?[...u,g(a,s)]:[...u,[g(a,s),"=",g(c,s)].join("")]}}function f(s){let a;switch(s.arrayFormat){case"index":return(u,c,h)=>{if(a=/\[(\d*)\]$/.exec(u),u=u.replace(/\[\d*\]$/,""),!a){h[u]=c;return}h[u]===void 0&&(h[u]={}),h[u][a[1]]=c};case"bracket":return(u,c,h)=>{if(a=/(\[\])$/.exec(u),u=u.replace(/\[\]$/,""),!a){h[u]=c;return}if(h[u]===void 0){h[u]=[c];return}h[u]=[].concat(h[u],c)};case"comma":case"separator":return(u,c,h)=>{const m=typeof c=="string"&&c.includes(s.arrayFormatSeparator),_=typeof c=="string"&&!m&&w(c,s).includes(s.arrayFormatSeparator);c=_?w(c,s):c;const v=m||_?c.split(s.arrayFormatSeparator).map(T=>w(T,s)):c===null?c:w(c,s);h[u]=v};default:return(u,c,h)=>{if(h[u]===void 0){h[u]=c;return}h[u]=[].concat(h[u],c)}}}function p(s){if(typeof s!="string"||s.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function g(s,a){return a.encode?a.strict?e(s):encodeURIComponent(s):s}function w(s,a){return a.decode?n(s):s}function y(s){return Array.isArray(s)?s.sort():typeof s=="object"?y(Object.keys(s)).sort((a,u)=>Number(a)-Number(u)).map(a=>s[a]):s}function b(s){const a=s.indexOf("#");return a!==-1&&(s=s.slice(0,a)),s}function S(s){let a="";const u=s.indexOf("#");return u!==-1&&(a=s.slice(u)),a}function k(s){s=b(s);const a=s.indexOf("?");return a===-1?"":s.slice(a+1)}function I(s,a){return a.parseNumbers&&!Number.isNaN(Number(s))&&typeof s=="string"&&s.trim()!==""?s=Number(s):a.parseBooleans&&s!==null&&(s.toLowerCase()==="true"||s.toLowerCase()==="false")&&(s=s.toLowerCase()==="true"),s}function R(s,a){a=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},a),p(a.arrayFormatSeparator);const u=f(a),c=Object.create(null);if(typeof s!="string"||(s=s.trim().replace(/^[?#&]/,""),!s))return c;for(const h of s.split("&")){if(h==="")continue;let[m,_]=r(a.decode?h.replace(/\+/g," "):h,"=");_=_===void 0?null:["comma","separator"].includes(a.arrayFormat)?_:w(_,a),u(w(m,a),_,c)}for(const h of Object.keys(c)){const m=c[h];if(typeof m=="object"&&m!==null)for(const _ of Object.keys(m))m[_]=I(m[_],a);else c[h]=I(m,a)}return a.sort===!1?c:(a.sort===!0?Object.keys(c).sort():Object.keys(c).sort(a.sort)).reduce((h,m)=>{const _=c[m];return _&&typeof _=="object"&&!Array.isArray(_)?h[m]=y(_):h[m]=_,h},Object.create(null))}t.extract=k,t.parse=R,t.stringify=(s,a)=>{if(!s)return"";a=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},a),p(a.arrayFormatSeparator);const u=_=>a.skipNull&&i(s[_])||a.skipEmptyString&&s[_]==="",c=d(a),h={};for(const _ of Object.keys(s))u(_)||(h[_]=s[_]);const m=Object.keys(h);return a.sort!==!1&&m.sort(a.sort),m.map(_=>{const v=s[_];return v===void 0?"":v===null?g(_,a):Array.isArray(v)?v.reduce(c(_),[]).join("&"):g(_,a)+"="+g(v,a)}).filter(_=>_.length>0).join("&")},t.parseUrl=(s,a)=>{a=Object.assign({decode:!0},a);const[u,c]=r(s,"#");return Object.assign({url:u.split("?")[0]||"",query:R(k(s),a)},a&&a.parseFragmentIdentifier&&c?{fragmentIdentifier:w(c,a)}:{})},t.stringifyUrl=(s,a)=>{a=Object.assign({encode:!0,strict:!0},a);const u=b(s.url).split("?")[0]||"",c=t.extract(s.url),h=t.parse(c,{sort:!1}),m=Object.assign(h,s.query);let _=t.stringify(m,a);_&&(_=`?${_}`);let v=S(s.url);return s.fragmentIdentifier&&(v=`#${g(s.fragmentIdentifier,a)}`),`${u}${_}${v}`},t.pick=(s,a,u)=>{u=Object.assign({parseFragmentIdentifier:!0},u);const{url:c,query:h,fragmentIdentifier:m}=t.parseUrl(s,u);return t.stringifyUrl({url:c,query:o(h,a),fragmentIdentifier:m},u)},t.exclude=(s,a,u)=>{const c=Array.isArray(a)?h=>!a.includes(h):(h,m)=>!a(h,m);return t.pick(s,c,u)}})(Le);function Wt(t){const e=t.indexOf("?")!==-1?t.indexOf("?"):void 0;return typeof e<"u"?t.substr(e):""}function Ft(t,e){let n=qe(t);return n=Object.assign(Object.assign({},n),e),t=Ht(n),t}function qe(t){return Le.parse(t)}function Ht(t){return Le.stringify(t)}function zt(t){return typeof t.bridge<"u"}function Qt(t){const e=t.indexOf(":"),n=t.indexOf("?")!==-1?t.indexOf("?"):void 0,r=t.substring(0,e),o=t.substring(e+1,n);function i(y){const b="@",S=y.split(b);return{handshakeTopic:S[0],version:parseInt(S[1],10)}}const d=i(o),f=typeof n<"u"?t.substr(n):"";function p(y){const b=qe(y);return{key:b.key||"",bridge:b.bridge||""}}const g=p(f);return Object.assign(Object.assign({protocol:r},d),g)}function Qo(t){return t===""||typeof t=="string"&&t.trim()===""}function Jo(t){return!(t&&t.length)}function Vo(t){return ne(t)}function Go(t){return Re(t)}function Yo(t){return bt(t)}function Ko(t){return Gr(t)}function Zo(t){return Yr(t)}function Xo(t,e){return yt(t,e)}function ei(t){return typeof t.params=="object"}function Jt(t){return typeof t.method<"u"}function P(t){return typeof t.result<"u"}function z(t){return typeof t.error<"u"}function he(t){return typeof t.event<"u"}function Vt(t){return Sr.includes(t)||t.startsWith("wc_")}function Gt(t){return t.method.startsWith("wc_")?!0:!we.includes(t.method)}const ti=Object.freeze(Object.defineProperty({__proto__:null,addHexPrefix:Ao,appendToQueryString:Ft,concatArrayBuffers:lo,concatBuffers:_o,convertArrayBufferToBuffer:Z,convertArrayBufferToHex:Et,convertArrayBufferToNumber:co,convertArrayBufferToUtf8:ao,convertBufferToArrayBuffer:Ct,convertBufferToHex:ho,convertBufferToNumber:fo,convertBufferToUtf8:uo,convertHexToArrayBuffer:St,convertHexToBuffer:yo,convertHexToNumber:vo,convertHexToUtf8:bo,convertNumberToArrayBuffer:Co,convertNumberToBuffer:Eo,convertNumberToHex:kt,convertNumberToUtf8:So,convertUtf8ToArrayBuffer:po,convertUtf8ToBuffer:go,convertUtf8ToHex:mo,convertUtf8ToNumber:wo,detectEnv:oe,detectOS:ie,formatIOSMobile:$o,formatMobileRegistry:zo,formatMobileRegistryEntry:Bt,formatQueryString:Ht,formatRpcError:$t,getClientMeta:de,getCrypto:Mo,getCryptoOrThrow:No,getDappRegistryUrl:Ho,getDocument:Ro,getDocumentOrThrow:Io,getEncoding:Zo,getFromWindow:ko,getFromWindowOrThrow:xo,getInfuraRpcUrl:Ut,getLocal:Ne,getLocalStorage:re,getLocalStorageOrThrow:Lo,getLocation:It,getLocationOrThrow:Oo,getMobileLinkRegistry:Bo,getMobileRegistryEntry:Dt,getNavigator:xt,getNavigatorOrThrow:To,getQueryString:Wt,getRpcUrl:Pt,getType:Ko,getWalletRegistryUrl:Fo,isAndroid:Rt,isArrayBuffer:Yo,isBrowser:Mt,isBuffer:Vo,isEmptyArray:Jo,isEmptyString:Qo,isHexString:Xo,isIOS:Tt,isInternalEvent:he,isJsonRpcRequest:Jt,isJsonRpcResponseError:z,isJsonRpcResponseSuccess:P,isJsonRpcSubscription:ei,isMobile:Ot,isNode:Nt,isReservedEvent:Vt,isSilentPayload:Gt,isTypedArray:Go,isWalletConnectSession:zt,logDeprecationWarning:Do,parseQueryString:qe,parseWalletConnectUri:Qt,payloadId:At,promisify:Wo,removeHexLeadingZeros:Po,removeHexPrefix:Uo,removeLocal:Me,safeJsonParse:Lt,safeJsonStringify:qt,sanitizeHex:qo,saveMobileLinkInfo:jo,setLocal:Oe,uuid:Y},Symbol.toStringTag,{value:"Module"}));class ni{constructor(){this._eventEmitters=[],typeof window<"u"&&typeof window.addEventListener<"u"&&(window.addEventListener("online",()=>this.trigger("online")),window.addEventListener("offline",()=>this.trigger("offline")))}on(e,n){this._eventEmitters.push({event:e,callback:n})}trigger(e){let n=[];e&&(n=this._eventEmitters.filter(r=>r.event===e)),n.forEach(r=>{r.callback()})}}const ri=typeof global.WebSocket<"u"?global.WebSocket:require("ws");class oi{constructor(e){if(this.opts=e,this._queue=[],this._events=[],this._subscriptions=[],this._protocol=e.protocol,this._version=e.version,this._url="",this._netMonitor=null,this._socket=null,this._nextSocket=null,this._subscriptions=e.subscriptions||[],this._netMonitor=e.netMonitor||new ni,!e.url||typeof e.url!="string")throw new Error("Missing or invalid WebSocket url");this._url=e.url,this._netMonitor.on("online",()=>this._socketCreate())}set readyState(e){}get readyState(){return this._socket?this._socket.readyState:-1}set connecting(e){}get connecting(){return this.readyState===0}set connected(e){}get connected(){return this.readyState===1}set closing(e){}get closing(){return this.readyState===2}set closed(e){}get closed(){return this.readyState===3}open(){this._socketCreate()}close(){this._socketClose()}send(e,n,r){if(!n||typeof n!="string")throw new Error("Missing or invalid topic field");this._socketSend({topic:n,type:"pub",payload:e,silent:!!r})}subscribe(e){this._socketSend({topic:e,type:"sub",payload:"",silent:!0})}on(e,n){this._events.push({event:e,callback:n})}_socketCreate(){if(this._nextSocket)return;const e=ii(this._url,this._protocol,this._version);if(this._nextSocket=new ri(e),!this._nextSocket)throw new Error("Failed to create socket");this._nextSocket.onmessage=n=>this._socketReceive(n),this._nextSocket.onopen=()=>this._socketOpen(),this._nextSocket.onerror=n=>this._socketError(n),this._nextSocket.onclose=()=>{setTimeout(()=>{this._nextSocket=null,this._socketCreate()},1e3)}}_socketOpen(){this._socketClose(),this._socket=this._nextSocket,this._nextSocket=null,this._queueSubscriptions(),this._pushQueue()}_socketClose(){this._socket&&(this._socket.onclose=()=>{},this._socket.close())}_socketSend(e){const n=JSON.stringify(e);this._socket&&this._socket.readyState===1?this._socket.send(n):(this._setToQueue(e),this._socketCreate())}async _socketReceive(e){let n;try{n=JSON.parse(e.data)}catch{return}if(this._socketSend({topic:n.topic,type:"ack",payload:"",silent:!0}),this._socket&&this._socket.readyState===1){const r=this._events.filter(o=>o.event==="message");r&&r.length&&r.forEach(o=>o.callback(n))}}_socketError(e){const n=this._events.filter(r=>r.event==="error");n&&n.length&&n.forEach(r=>r.callback(e))}_queueSubscriptions(){this._subscriptions.forEach(n=>this._queue.push({topic:n,type:"sub",payload:"",silent:!0})),this._subscriptions=this.opts.subscriptions||[]}_setToQueue(e){this._queue.push(e)}_pushQueue(){this._queue.forEach(n=>this._socketSend(n)),this._queue=[]}}function ii(t,e,n){var r,o;const d=(t.startsWith("https")?t.replace("https","wss"):t.startsWith("http")?t.replace("http","ws"):t).split("?"),f=Mt()?{protocol:e,version:n,env:"browser",host:((r=It())===null||r===void 0?void 0:r.host)||""}:{protocol:e,version:n,env:((o=oe())===null||o===void 0?void 0:o.name)||""},p=Ft(Wt(d[1]||""),f);return d[0]+"?"+p}class si{constructor(){this._eventEmitters=[]}subscribe(e){this._eventEmitters.push(e)}unsubscribe(e){this._eventEmitters=this._eventEmitters.filter(n=>n.event!==e)}trigger(e){let n=[],r;Jt(e)?r=e.method:P(e)||z(e)?r=`response:${e.id}`:he(e)?r=e.event:r="",r&&(n=this._eventEmitters.filter(o=>o.event===r)),(!n||!n.length)&&!Vt(r)&&!he(r)&&(n=this._eventEmitters.filter(o=>o.event==="call_request")),n.forEach(o=>{if(z(e)){const i=new Error(e.error.message);o.callback(i,null)}else o.callback(null,e)})}}class ai{constructor(e="walletconnect"){this.storageId=e}getSession(){let e=null;const n=Ne(this.storageId);return n&&zt(n)&&(e=n),e}setSession(e){return Oe(this.storageId,e),e}removeSession(){Me(this.storageId)}}const ci="walletconnect.org",li="abcdefghijklmnopqrstuvwxyz0123456789",Yt=li.split("").map(t=>`https://${t}.bridge.walletconnect.org`);function ui(t){let e=t.indexOf("//")>-1?t.split("/")[2]:t.split("/")[0];return e=e.split(":")[0],e=e.split("?")[0],e}function di(t){return ui(t).split(".").slice(-2).join(".")}function hi(){return Math.floor(Math.random()*Yt.length)}function fi(){return Yt[hi()]}function _i(t){return di(t)===ci}function pi(t){return _i(t)?fi():t}class gi{constructor(e){if(this.protocol="wc",this.version=1,this._bridge="",this._key=null,this._clientId="",this._clientMeta=null,this._peerId="",this._peerMeta=null,this._handshakeId=0,this._handshakeTopic="",this._connected=!1,this._accounts=[],this._chainId=0,this._networkId=0,this._rpcUrl="",this._eventManager=new si,this._clientMeta=de()||e.connectorOpts.clientMeta||null,this._cryptoLib=e.cryptoLib,this._sessionStorage=e.sessionStorage||new ai(e.connectorOpts.storageId),this._qrcodeModal=e.connectorOpts.qrcodeModal,this._qrcodeModalOptions=e.connectorOpts.qrcodeModalOptions,this._signingMethods=[...we,...e.connectorOpts.signingMethods||[]],!e.connectorOpts.bridge&&!e.connectorOpts.uri&&!e.connectorOpts.session)throw new Error(vr);e.connectorOpts.bridge&&(this.bridge=pi(e.connectorOpts.bridge)),e.connectorOpts.uri&&(this.uri=e.connectorOpts.uri);const n=e.connectorOpts.session||this._getStorageSession();n&&(this.session=n),this.handshakeId&&this._subscribeToSessionResponse(this.handshakeId,"Session request rejected"),this._transport=e.transport||new oi({protocol:this.protocol,version:this.version,url:this.bridge,subscriptions:[this.clientId]}),this._subscribeToInternalEvents(),this._initTransport(),e.connectorOpts.uri&&this._subscribeToSessionRequest(),e.pushServerOpts&&this._registerPushServer(e.pushServerOpts)}set bridge(e){e&&(this._bridge=e)}get bridge(){return this._bridge}set key(e){if(!e)return;const n=St(e);this._key=n}get key(){return this._key?Et(this._key,!0):""}set clientId(e){e&&(this._clientId=e)}get clientId(){let e=this._clientId;return e||(e=this._clientId=Y()),this._clientId}set peerId(e){e&&(this._peerId=e)}get peerId(){return this._peerId}set clientMeta(e){}get clientMeta(){let e=this._clientMeta;return e||(e=this._clientMeta=de()),e}set peerMeta(e){this._peerMeta=e}get peerMeta(){return this._peerMeta}set handshakeTopic(e){e&&(this._handshakeTopic=e)}get handshakeTopic(){return this._handshakeTopic}set handshakeId(e){e&&(this._handshakeId=e)}get handshakeId(){return this._handshakeId}get uri(){return this._formatUri()}set uri(e){if(!e)return;const{handshakeTopic:n,bridge:r,key:o}=this._parseUri(e);this.handshakeTopic=n,this.bridge=r,this.key=o}set chainId(e){this._chainId=e}get chainId(){return this._chainId}set networkId(e){this._networkId=e}get networkId(){return this._networkId}set accounts(e){this._accounts=e}get accounts(){return this._accounts}set rpcUrl(e){this._rpcUrl=e}get rpcUrl(){return this._rpcUrl}set connected(e){}get connected(){return this._connected}set pending(e){}get pending(){return!!this._handshakeTopic}get session(){return{connected:this.connected,accounts:this.accounts,chainId:this.chainId,bridge:this.bridge,key:this.key,clientId:this.clientId,clientMeta:this.clientMeta,peerId:this.peerId,peerMeta:this.peerMeta,handshakeId:this.handshakeId,handshakeTopic:this.handshakeTopic}}set session(e){e&&(this._connected=e.connected,this.accounts=e.accounts,this.chainId=e.chainId,this.bridge=e.bridge,this.key=e.key,this.clientId=e.clientId,this.clientMeta=e.clientMeta,this.peerId=e.peerId,this.peerMeta=e.peerMeta,this.handshakeId=e.handshakeId,this.handshakeTopic=e.handshakeTopic)}on(e,n){const r={event:e,callback:n};this._eventManager.subscribe(r)}off(e){this._eventManager.unsubscribe(e)}async createInstantRequest(e){this._key=await this._generateKey();const n=this._formatRequest({method:"wc_instantRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,request:this._formatRequest(e)}]});this.handshakeId=n.id,this.handshakeTopic=Y(),this._eventManager.trigger({event:"display_uri",params:[this.uri]}),this.on("modal_closed",()=>{throw new Error(We)});const r=()=>{this.killSession()};try{const o=await this._sendCallRequest(n);return o&&r(),o}catch(o){throw r(),o}}async connect(e){if(!this._qrcodeModal)throw new Error(Cr);return this.connected?{chainId:this.chainId,accounts:this.accounts}:(await this.createSession(e),new Promise(async(n,r)=>{this.on("modal_closed",()=>r(new Error(We))),this.on("connect",(o,i)=>{if(o)return r(o);n(i.params[0])})}))}async createSession(e){if(this._connected)throw new Error(ae);if(this.pending)return;this._key=await this._generateKey();const n=this._formatRequest({method:"wc_sessionRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,chainId:e&&e.chainId?e.chainId:null}]});this.handshakeId=n.id,this.handshakeTopic=Y(),this._sendSessionRequest(n,"Session update rejected",{topic:this.handshakeTopic}),this._eventManager.trigger({event:"display_uri",params:[this.uri]})}approveSession(e){if(this._connected)throw new Error(ae);this.chainId=e.chainId,this.accounts=e.accounts,this.networkId=e.networkId||0,this.rpcUrl=e.rpcUrl||"";const n={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl,peerId:this.clientId,peerMeta:this.clientMeta},r={id:this.handshakeId,jsonrpc:"2.0",result:n};this._sendResponse(r),this._connected=!0,this._setStorageSession(),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})}rejectSession(e){if(this._connected)throw new Error(ae);const n=e&&e.message?e.message:pr,r=this._formatResponse({id:this.handshakeId,error:{message:n}});this._sendResponse(r),this._connected=!1,this._eventManager.trigger({event:"disconnect",params:[{message:n}]}),this._removeStorageSession()}updateSession(e){if(!this._connected)throw new Error(q);this.chainId=e.chainId,this.accounts=e.accounts,this.networkId=e.networkId||0,this.rpcUrl=e.rpcUrl||"";const n={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl},r=this._formatRequest({method:"wc_sessionUpdate",params:[n]});this._sendSessionRequest(r,"Session update rejected"),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]}),this._manageStorageSession()}async killSession(e){const n=e?e.message:"Session Disconnected",r={approved:!1,chainId:null,networkId:null,accounts:null},o=this._formatRequest({method:"wc_sessionUpdate",params:[r]});await this._sendRequest(o),this._handleSessionDisconnect(n)}async sendTransaction(e){if(!this._connected)throw new Error(q);const n=e,r=this._formatRequest({method:"eth_sendTransaction",params:[n]});return await this._sendCallRequest(r)}async signTransaction(e){if(!this._connected)throw new Error(q);const n=e,r=this._formatRequest({method:"eth_signTransaction",params:[n]});return await this._sendCallRequest(r)}async signMessage(e){if(!this._connected)throw new Error(q);const n=this._formatRequest({method:"eth_sign",params:e});return await this._sendCallRequest(n)}async signPersonalMessage(e){if(!this._connected)throw new Error(q);const n=this._formatRequest({method:"personal_sign",params:e});return await this._sendCallRequest(n)}async signTypedData(e){if(!this._connected)throw new Error(q);const n=this._formatRequest({method:"eth_signTypedData",params:e});return await this._sendCallRequest(n)}async updateChain(e){if(!this._connected)throw new Error("Session currently disconnected");const n=this._formatRequest({method:"wallet_updateChain",params:[e]});return await this._sendCallRequest(n)}unsafeSend(e,n){return this._sendRequest(e,n),this._eventManager.trigger({event:"call_request_sent",params:[{request:e,options:n}]}),new Promise((r,o)=>{this._subscribeToResponse(e.id,(i,d)=>{if(i){o(i);return}if(!d)throw new Error(gr);r(d)})})}async sendCustomRequest(e,n){if(!this._connected)throw new Error(q);switch(e.method){case"eth_accounts":return this.accounts;case"eth_chainId":return kt(this.chainId);case"eth_sendTransaction":case"eth_signTransaction":e.params;break;case"personal_sign":e.params;break}const r=this._formatRequest(e);return await this._sendCallRequest(r,n)}approveRequest(e){if(P(e)){const n=this._formatResponse(e);this._sendResponse(n)}else throw new Error(mr)}rejectRequest(e){if(z(e)){const n=this._formatResponse(e);this._sendResponse(n)}else throw new Error(wr)}transportClose(){this._transport.close()}async _sendRequest(e,n){const r=this._formatRequest(e),o=await this._encrypt(r),i=typeof(n==null?void 0:n.topic)<"u"?n.topic:this.peerId,d=JSON.stringify(o),f=typeof(n==null?void 0:n.forcePushNotification)<"u"?!n.forcePushNotification:Gt(r);this._transport.send(d,i,f)}async _sendResponse(e){const n=await this._encrypt(e),r=this.peerId,o=JSON.stringify(n),i=!0;this._transport.send(o,r,i)}async _sendSessionRequest(e,n,r){this._sendRequest(e,r),this._subscribeToSessionResponse(e.id,n)}_sendCallRequest(e,n){return this._sendRequest(e,n),this._eventManager.trigger({event:"call_request_sent",params:[{request:e,options:n}]}),this._subscribeToCallResponse(e.id)}_formatRequest(e){if(typeof e.method>"u")throw new Error(yr);return{id:typeof e.id>"u"?At():e.id,jsonrpc:"2.0",method:e.method,params:typeof e.params>"u"?[]:e.params}}_formatResponse(e){if(typeof e.id>"u")throw new Error(br);const n={id:e.id,jsonrpc:"2.0"};if(z(e)){const r=$t(e.error);return Object.assign(Object.assign(Object.assign({},n),e),{error:r})}else if(P(e))return Object.assign(Object.assign({},n),e);throw new Error(Be)}_handleSessionDisconnect(e){const n=e||"Session Disconnected";this._connected||(this._qrcodeModal&&this._qrcodeModal.close(),Me(ue)),this._connected&&(this._connected=!1),this._handshakeId&&(this._handshakeId=0),this._handshakeTopic&&(this._handshakeTopic=""),this._peerId&&(this._peerId=""),this._eventManager.trigger({event:"disconnect",params:[{message:n}]}),this._removeStorageSession(),this.transportClose()}_handleSessionResponse(e,n){n?n.approved?(this._connected?(n.chainId&&(this.chainId=n.chainId),n.accounts&&(this.accounts=n.accounts),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]})):(this._connected=!0,n.chainId&&(this.chainId=n.chainId),n.accounts&&(this.accounts=n.accounts),n.peerId&&!this.peerId&&(this.peerId=n.peerId),n.peerMeta&&!this.peerMeta&&(this.peerMeta=n.peerMeta),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})),this._manageStorageSession()):this._handleSessionDisconnect(e):this._handleSessionDisconnect(e)}async _handleIncomingMessages(e){if(![this.clientId,this.handshakeTopic].includes(e.topic))return;let r;try{r=JSON.parse(e.payload)}catch{return}const o=await this._decrypt(r);o&&this._eventManager.trigger(o)}_subscribeToSessionRequest(){this._transport.subscribe(this.handshakeTopic)}_subscribeToResponse(e,n){this.on(`response:${e}`,n)}_subscribeToSessionResponse(e,n){this._subscribeToResponse(e,(r,o)=>{if(r){this._handleSessionResponse(r.message);return}P(o)?this._handleSessionResponse(n,o.result):o.error&&o.error.message?this._handleSessionResponse(o.error.message):this._handleSessionResponse(n)})}_subscribeToCallResponse(e){return new Promise((n,r)=>{this._subscribeToResponse(e,(o,i)=>{if(o){r(o);return}P(i)?n(i.result):i.error&&i.error.message?r(i.error):r(new Error(Be))})})}_subscribeToInternalEvents(){this.on("display_uri",()=>{this._qrcodeModal&&this._qrcodeModal.open(this.uri,()=>{this._eventManager.trigger({event:"modal_closed",params:[]})},this._qrcodeModalOptions)}),this.on("connect",()=>{this._qrcodeModal&&this._qrcodeModal.close()}),this.on("call_request_sent",(e,n)=>{const{request:r}=n.params[0];if(Ot()&&this._signingMethods.includes(r.method)){const o=Ne(ue);o&&(window.location.href=o.href)}}),this.on("wc_sessionRequest",(e,n)=>{e&&this._eventManager.trigger({event:"error",params:[{code:"SESSION_REQUEST_ERROR",message:e.toString()}]}),this.handshakeId=n.id,this.peerId=n.params[0].peerId,this.peerMeta=n.params[0].peerMeta;const r=Object.assign(Object.assign({},n),{method:"session_request"});this._eventManager.trigger(r)}),this.on("wc_sessionUpdate",(e,n)=>{e&&this._handleSessionResponse(e.message),this._handleSessionResponse("Session disconnected",n.params[0])})}_initTransport(){this._transport.on("message",e=>this._handleIncomingMessages(e)),this._transport.on("open",()=>this._eventManager.trigger({event:"transport_open",params:[]})),this._transport.on("close",()=>this._eventManager.trigger({event:"transport_close",params:[]})),this._transport.on("error",()=>this._eventManager.trigger({event:"transport_error",params:["Websocket connection failed"]})),this._transport.open()}_formatUri(){const e=this.protocol,n=this.handshakeTopic,r=this.version,o=encodeURIComponent(this.bridge),i=this.key;return`${e}:${n}@${r}?bridge=${o}&key=${i}`}_parseUri(e){const n=Qt(e);if(n.protocol===this.protocol){if(!n.handshakeTopic)throw Error("Invalid or missing handshakeTopic parameter value");const r=n.handshakeTopic;if(!n.bridge)throw Error("Invalid or missing bridge url parameter value");const o=decodeURIComponent(n.bridge);if(!n.key)throw Error("Invalid or missing key parameter value");const i=n.key;return{handshakeTopic:r,bridge:o,key:i}}else throw new Error(Er)}async _generateKey(){return this._cryptoLib?await this._cryptoLib.generateKey():null}async _encrypt(e){const n=this._key;return this._cryptoLib&&n?await this._cryptoLib.encrypt(e,n):null}async _decrypt(e){const n=this._key;return this._cryptoLib&&n?await this._cryptoLib.decrypt(e,n):null}_getStorageSession(){let e=null;return this._sessionStorage&&(e=this._sessionStorage.getSession()),e}_setStorageSession(){this._sessionStorage&&this._sessionStorage.setSession(this.session)}_removeStorageSession(){this._sessionStorage&&this._sessionStorage.removeSession()}_manageStorageSession(){this._connected?this._setStorageSession():this._removeStorageSession()}_registerPushServer(e){if(!e.url||typeof e.url!="string")throw Error("Invalid or missing pushServerOpts.url parameter value");if(!e.type||typeof e.type!="string")throw Error("Invalid or missing pushServerOpts.type parameter value");if(!e.token||typeof e.token!="string")throw Error("Invalid or missing pushServerOpts.token parameter value");const n={bridge:this.bridge,topic:this.clientId,type:e.type,token:e.token,peerName:"",language:e.language||""};this.on("connect",async(r,o)=>{if(r)throw r;if(e.peerMeta){const i=o.params[0].peerMeta.name;n.peerName=i}try{if(!(await(await fetch(`${e.url}/new`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(n)})).json()).success)throw Error("Failed to register in Push Server")}catch{throw Error("Failed to register in Push Server")}})}}function mi(t){return Q.getBrowerCrypto().getRandomValues(new Uint8Array(t))}const Kt=256,Zt=Kt,wi=Kt,L="AES-CBC",yi=`SHA-${Zt}`,fe="HMAC",bi="encrypt",vi="decrypt",Ei="sign",Ci="verify";function Si(t){return t===L?{length:Zt,name:L}:{hash:{name:yi},name:fe}}function ki(t){return t===L?[bi,vi]:[Ei,Ci]}async function Ae(t,e=L){return Q.getSubtleCrypto().importKey("raw",t,Si(e),!0,ki(e))}async function xi(t,e,n){const r=Q.getSubtleCrypto(),o=await Ae(e,L),i=await r.encrypt({iv:t,name:L},o,n);return new Uint8Array(i)}async function Ii(t,e,n){const r=Q.getSubtleCrypto(),o=await Ae(e,L),i=await r.decrypt({iv:t,name:L},o,n);return new Uint8Array(i)}async function Ri(t,e){const n=Q.getSubtleCrypto(),r=await Ae(t,fe),o=await n.sign({length:wi,name:fe},r,e);return new Uint8Array(o)}function Ti(t,e,n){return xi(t,e,n)}function Oi(t,e,n){return Ii(t,e,n)}async function Xt(t,e){return await Ri(t,e)}async function en(t){const e=(t||256)/8,n=mi(e);return Ct(W(n))}async function tn(t,e){const n=M(t.data),r=M(t.iv),o=M(t.hmac),i=N(o,!1),d=vt(n,r),f=await Xt(e,d),p=N(f,!1);return B(i)===B(p)}async function Ni(t,e,n){const r=j(Z(e)),o=n||await en(128),i=j(Z(o)),d=N(i,!1),f=JSON.stringify(t),p=wt(f),g=await Ti(i,r,p),w=N(g,!1),y=vt(g,i),b=await Xt(r,y),S=N(b,!1);return{data:w,hmac:S,iv:d}}async function Mi(t,e){const n=j(Z(e));if(!n)throw new Error("Missing key: required for decryption");if(!await tn(t,n))return null;const o=M(t.data),i=M(t.iv),d=await Oi(i,n,o),f=gt(d);let p;try{p=JSON.parse(f)}catch{return null}return p}const Li=Object.freeze(Object.defineProperty({__proto__:null,decrypt:Mi,encrypt:Ni,generateKey:en,verifyHmac:tn},Symbol.toStringTag,{value:"Module"}));class qi extends gi{constructor(e,n){super({cryptoLib:Li,connectorOpts:e,pushServerOpts:n})}}const Ai=et(ti);var Ui=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,n=[],r=0;r"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var y=Fe[e.format]||Fe.default;window.clipboardData.setData(y,t)}else w.clipboardData.clearData(),w.clipboardData.setData(e.format,t);e.onCopy&&(w.preventDefault(),e.onCopy(w.clipboardData))}),document.body.appendChild(f),i.selectNodeContents(f),d.addRange(i);var g=document.execCommand("copy");if(!g)throw new Error("copy command was unsuccessful");p=!0}catch(w){n&&console.error("unable to copy using execCommand: ",w),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),p=!0}catch(y){n&&console.error("unable to copy using clipboardData: ",y),n&&console.error("falling back to prompt"),r=$i("message"in e?e.message:Di),window.prompt(r,t)}}finally{d&&(typeof d.removeRange=="function"?d.removeRange(i):d.removeAllRanges()),f&&document.body.removeChild(f),o()}return p}var Bi=ji;function nn(t,e){for(var n in e)t[n]=e[n];return t}function _e(t,e){for(var n in t)if(n!=="__source"&&!(n in e))return!0;for(var r in e)if(r!=="__source"&&t[r]!==e[r])return!0;return!1}function X(t){this.props=t}function rn(t,e){function n(o){var i=this.props.ref,d=i==o.ref;return!d&&i&&(i.call?i(null):i.current=null),e?!e(this.props,o)||!d:_e(this.props,o)}function r(o){return this.shouldComponentUpdate=n,x(t,o)}return r.displayName="Memo("+(t.displayName||t.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(X.prototype=new A).isPureReactComponent=!0,X.prototype.shouldComponentUpdate=function(t,e){return _e(this.props,t)||_e(this.state,e)};var He=C.__b;C.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),He&&He(t)};var Wi=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function on(t){function e(n){var r=nn({},n);return delete r.ref,t(r,n.ref||null)}return e.$$typeof=Wi,e.render=e,e.prototype.isReactComponent=e.__f=!0,e.displayName="ForwardRef("+(t.displayName||t.name)+")",e}var ze=function(t,e){return t==null?null:O(O(t).map(e))},sn={map:ze,forEach:ze,count:function(t){return t?O(t).length:0},only:function(t){var e=O(t);if(e.length!==1)throw"Children.only";return e[0]},toArray:O},Fi=C.__e;C.__e=function(t,e,n,r){if(t.then){for(var o,i=e;i=i.__;)if((o=i.__c)&&o.__c)return e.__e==null&&(e.__e=n.__e,e.__k=n.__k),o.__c(t,e)}Fi(t,e,n,r)};var Qe=C.unmount;function an(t,e,n){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),t.__c.__H=null),(t=nn({},t)).__c!=null&&(t.__c.__P===n&&(t.__c.__P=e),t.__c=null),t.__k=t.__k&&t.__k.map(function(r){return an(r,e,n)})),t}function cn(t,e,n){return t&&n&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(r){return cn(r,e,n)}),t.__c&&t.__c.__P===e&&(t.__e&&n.appendChild(t.__e),t.__c.__e=!0,t.__c.__P=n)),t}function H(){this.__u=0,this.t=null,this.__b=null}function ln(t){var e=t.__.__c;return e&&e.__a&&e.__a(t)}function un(t){var e,n,r;function o(i){if(e||(e=t()).then(function(d){n=d.default||d},function(d){r=d}),r)throw r;if(!n)throw e;return x(n,i)}return o.displayName="Lazy",o.__f=!0,o}function D(){this.u=null,this.o=null}C.unmount=function(t){var e=t.__c;e&&e.__R&&e.__R(),e&&32&t.__u&&(t.type=null),Qe&&Qe(t)},(H.prototype=new A).__c=function(t,e){var n=e.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var o=ln(r.__v),i=!1,d=function(){i||(i=!0,n.__R=null,o?o(f):f())};n.__R=d;var f=function(){if(!--r.__u){if(r.state.__a){var p=r.state.__a;r.__v.__k[0]=cn(p,p.__c.__P,p.__c.__O)}var g;for(r.setState({__a:r.__b=null});g=r.t.pop();)g.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),t.then(d,d)},H.prototype.componentWillUnmount=function(){this.t=[]},H.prototype.render=function(t,e){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=an(this.__b,n,r.__O=r.__P)}this.__b=null}var o=e.__a&&x($,null,t.fallback);return o&&(o.__u&=-33),[x($,null,e.__a?null:t.children),o]};var Je=function(t,e,n){if(++n[1]===n[0]&&t.o.delete(e),t.props.revealOrder&&(t.props.revealOrder[0]!=="t"||!t.o.size))for(n=t.u;n;){for(;n.length>3;)n.pop()();if(n[1]>>1,1),e.i.removeChild(r)}}),K(x(Hi,{context:e.context},t.__v),e.l)}function dn(t,e){var n=x(zi,{__v:t,i:e});return n.containerInfo=e,n}(D.prototype=new A).__a=function(t){var e=this,n=ln(e.__v),r=e.o.get(t);return r[0]++,function(o){var i=function(){e.props.revealOrder?(r.push(o),Je(e,t,r)):o()};n?n(i):i()}},D.prototype.render=function(t){this.u=null,this.o=new Map;var e=O(t.children);t.revealOrder&&t.revealOrder[0]==="b"&&e.reverse();for(var n=e.length;n--;)this.o.set(e[n],this.u=[1,0,this.u]);return t.children},D.prototype.componentDidUpdate=D.prototype.componentDidMount=function(){var t=this;this.o.forEach(function(e,n){Je(t,n,e)})};var hn=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Qi=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Ji=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Vi=/[A-Z0-9]/g,Gi=typeof document<"u",Yi=function(t){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(t)};function fn(t,e,n){return e.__k==null&&(e.textContent=""),K(t,e),typeof n=="function"&&n(),t?t.__c:null}function _n(t,e,n){return hr(t,e),typeof n=="function"&&n(),t?t.__c:null}A.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(A.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})});var Ve=C.event;function Ki(){}function Zi(){return this.cancelBubble}function Xi(){return this.defaultPrevented}C.event=function(t){return Ve&&(t=Ve(t)),t.persist=Ki,t.isPropagationStopped=Zi,t.isDefaultPrevented=Xi,t.nativeEvent=t};var Ue,es={enumerable:!1,configurable:!0,get:function(){return this.class}},Ge=C.vnode;C.vnode=function(t){typeof t.type=="string"&&function(e){var n=e.props,r=e.type,o={};for(var i in n){var d=n[i];if(!(i==="value"&&"defaultValue"in n&&d==null||Gi&&i==="children"&&r==="noscript"||i==="class"||i==="className")){var f=i.toLowerCase();i==="defaultValue"&&"value"in n&&n.value==null?i="value":i==="download"&&d===!0?d="":f==="ondoubleclick"?i="ondblclick":f!=="onchange"||r!=="input"&&r!=="textarea"||Yi(n.type)?f==="onfocus"?i="onfocusin":f==="onblur"?i="onfocusout":Ji.test(i)?i=f:r.indexOf("-")===-1&&Qi.test(i)?i=i.replace(Vi,"-$&").toLowerCase():d===null&&(d=void 0):f=i="oninput",f==="oninput"&&o[i=f]&&(i="oninputCapture"),o[i]=d}}r=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=O(n.children).forEach(function(p){p.props.selected=o.value.indexOf(p.props.value)!=-1})),r=="select"&&o.defaultValue!=null&&(o.value=O(n.children).forEach(function(p){p.props.selected=o.multiple?o.defaultValue.indexOf(p.props.value)!=-1:o.defaultValue==p.props.value})),n.class&&!n.className?(o.class=n.class,Object.defineProperty(o,"className",es)):(n.className&&!n.class||n.class&&n.className)&&(o.class=o.className=n.className),e.props=o}(t),t.$$typeof=hn,Ge&&Ge(t)};var Ye=C.__r;C.__r=function(t){Ye&&Ye(t),Ue=t.__c};var Ke=C.diffed;C.diffed=function(t){Ke&&Ke(t);var e=t.props,n=t.__e;n!=null&&t.type==="textarea"&&"value"in e&&e.value!==n.value&&(n.value=e.value==null?"":e.value),Ue=null};var pn={ReactCurrentDispatcher:{current:{readContext:function(t){return Ue.__n[t.__c].props.value}}}},ts="17.0.2";function gn(t){return x.bind(null,t)}function V(t){return!!t&&t.$$typeof===hn}function mn(t){return V(t)&&t.type===$}function wn(t){return V(t)?fr.apply(null,arguments):t}function yn(t){return!!t.__k&&(K(null,t),!0)}function bn(t){return t&&(t.base||t.nodeType===1&&t)||null}var vn=function(t,e){return t(e)},En=function(t,e){return t(e)},Cn=$;function Pe(t){t()}function Sn(t){return t}function kn(){return[!1,Pe]}var xn=ee,In=V;function Rn(t,e){var n=e(),r=ge({h:{__:n,v:e}}),o=r[0].h,i=r[1];return ee(function(){o.__=n,o.v=e,ce(o)&&i({h:o})},[t,n,e]),me(function(){return ce(o)&&i({h:o}),t(function(){ce(o)&&i({h:o})})},[t]),n}function ce(t){var e,n,r=t.v,o=t.__;try{var i=r();return!((e=o)===(n=i)&&(e!==0||1/e==1/n)||e!=e&&n!=n)}catch{return!0}}var ns={useState:ge,useId:nt,useReducer:rt,useEffect:me,useLayoutEffect:ee,useInsertionEffect:xn,useTransition:kn,useDeferredValue:Sn,useSyncExternalStore:Rn,startTransition:Pe,useRef:ot,useImperativeHandle:it,useMemo:st,useCallback:at,useContext:ct,useDebugValue:lt,version:"17.0.2",Children:sn,render:fn,hydrate:_n,unmountComponentAtNode:yn,createPortal:dn,createElement:x,createContext:ut,createFactory:gn,cloneElement:wn,createRef:dt,Fragment:$,isValidElement:V,isElement:In,isFragment:mn,findDOMNode:bn,Component:A,PureComponent:X,memo:rn,forwardRef:on,flushSync:En,unstable_batchedUpdates:vn,StrictMode:Cn,Suspense:H,SuspenseList:D,lazy:un,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:pn};const rs=Object.freeze(Object.defineProperty({__proto__:null,Children:sn,Component:A,Fragment:$,PureComponent:X,StrictMode:Cn,Suspense:H,SuspenseList:D,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:pn,cloneElement:wn,createContext:ut,createElement:x,createFactory:gn,createPortal:dn,createRef:dt,default:ns,findDOMNode:bn,flushSync:En,forwardRef:on,hydrate:_n,isElement:In,isFragment:mn,isValidElement:V,lazy:un,memo:rn,render:fn,startTransition:Pe,unmountComponentAtNode:yn,unstable_batchedUpdates:vn,useCallback:at,useContext:ct,useDebugValue:lt,useDeferredValue:Sn,useEffect:me,useErrorBoundary:_r,useId:nt,useImperativeHandle:it,useInsertionEffect:xn,useLayoutEffect:ee,useMemo:st,useReducer:rt,useRef:ot,useState:ge,useSyncExternalStore:Rn,useTransition:kn,version:ts},Symbol.toStringTag,{value:"Module"})),os=et(rs);function Tn(t){return t&&typeof t=="object"&&"default"in t?t.default:t}var E=Ai,On=Tn(dr),is=Tn(Bi),l=os;function ss(t){On.toString(t,{type:"terminal"}).then(console.log)}var as=`:root { +import{p as pe,aC as Wn,aD as Fn,aE as Hn,aF as zn,aG as Qn,aH as Jn,aI as Vn,aJ as Gn,aK as Yn,aL as Kn,aM as Zn,aN as Xn,aO as er,aP as tr,aQ as nr,aR as rr,aS as or,aT as ir,e as et,E as tt}from"./index-iGWvbPrT.js";import{a as sr,s as ar,m as cr,c as Q,I as lr,f as $e,J as je,H as ur}from"./http-I_tKnr4x.js";import{b as dr}from"./browser-BNgg9dRV.js";import{b as A,l as C,y as x,g as $,$ as O,q as K,B as hr,E as fr,a as ee,c as ge,d as me,V as nt,s as rt,_ as ot,A as it,F as st,T as at,e as ct,x as lt,f as ut,i as dt,P as _r}from"./hooks.module-o1hAt1ko.js";const ae="Session currently connected",q="Session currently disconnected",pr="Session Rejected",gr="Missing JSON RPC response",mr='JSON-RPC success response must include "result" field',wr='JSON-RPC error response must include "error" field',yr='JSON RPC request must have valid "method" value',br='JSON RPC request must have valid "id" value',vr="Missing one of the required parameters: bridge / uri / session",Be="JSON RPC response format is invalid",Er="URI format is invalid",Cr="QRCode Modal not provided",We="User close QRCode Modal",Sr=["session_request","session_update","exchange_key","connect","disconnect","display_uri","modal_closed","transport_open","transport_close","transport_error"],kr=["wallet_addEthereumChain","wallet_switchEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],we=["eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v2","eth_signTypedData_v3","eth_signTypedData_v4","personal_sign",...kr],ue="WALLETCONNECT_DEEPLINK_CHOICE",xr={1:"mainnet",3:"ropsten",4:"rinkeby",5:"goerli",42:"kovan"};var ht=ye;ye.strict=ft;ye.loose=_t;var Ir=Object.prototype.toString,Rr={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function ye(t){return ft(t)||_t(t)}function ft(t){return t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array}function _t(t){return Rr[Ir.call(t)]}const Tr=pe(ht);var Or=ht.strict,Nr=function(e){if(Or(e)){var n=Buffer.from(e.buffer);return e.byteLength!==e.buffer.byteLength&&(n=n.slice(e.byteOffset,e.byteOffset+e.byteLength)),n}else return Buffer.from(e)};const Mr=pe(Nr),be="hex",ve="utf8",Lr="binary",qr="buffer",Ar="array",Ur="typed-array",Pr="array-buffer",te="0";function j(t){return new Uint8Array(t)}function Ee(t,e=!1){const n=t.toString(be);return e?J(n):n}function Ce(t){return t.toString(ve)}function pt(t){return t.readUIntBE(0,t.length)}function W(t){return Mr(t)}function N(t,e=!1){return Ee(W(t),e)}function gt(t){return Ce(W(t))}function mt(t){return pt(W(t))}function Se(t){return Buffer.from(B(t),be)}function M(t){return j(Se(t))}function Dr(t){return Ce(Se(t))}function $r(t){return mt(M(t))}function ke(t){return Buffer.from(t,ve)}function wt(t){return j(ke(t))}function jr(t,e=!1){return Ee(ke(t),e)}function Br(t){const e=parseInt(t,10);return io(oo(e),"Number can only safely store up to 53 bits"),e}function Wr(t){return Qr(xe(t))}function Fr(t){return Ie(xe(t))}function Hr(t,e){return Jr(xe(t),e)}function zr(t){return`${t}`}function xe(t){const e=(t>>>0).toString(2);return Te(e)}function Qr(t){return W(Ie(t))}function Ie(t){return new Uint8Array(Xr(t).map(e=>parseInt(e,2)))}function Jr(t,e){return N(Ie(t),e)}function Vr(t){return!(typeof t!="string"||!new RegExp(/^[01]+$/).test(t)||t.length%8!==0)}function yt(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}function ne(t){return Buffer.isBuffer(t)}function Re(t){return Tr.strict(t)&&!ne(t)}function bt(t){return!Re(t)&&!ne(t)&&typeof t.byteLength<"u"}function Gr(t){return ne(t)?qr:Re(t)?Ur:bt(t)?Pr:Array.isArray(t)?Ar:typeof t}function Yr(t){return Vr(t)?Lr:yt(t)?be:ve}function Kr(...t){return Buffer.concat(t)}function vt(...t){let e=[];return t.forEach(n=>e=e.concat(Array.from(n))),new Uint8Array([...e])}function Zr(t,e=8){const n=t%e;return n?(t-n)/e*e+e:t}function Xr(t,e=8){const n=Te(t).match(new RegExp(`.{${e}}`,"gi"));return Array.from(n||[])}function Te(t,e=8,n=te){return eo(t,Zr(t.length,e),n)}function eo(t,e,n=te){return so(t,e,!0,n)}function B(t){return t.replace(/^0x/,"")}function J(t){return t.startsWith("0x")?t:`0x${t}`}function to(t){return t=B(t),t=Te(t,2),t&&(t=J(t)),t}function no(t){const e=t.startsWith("0x");return t=B(t),t=t.startsWith(te)?t.substring(1):t,e?J(t):t}function ro(t){return typeof t>"u"}function oo(t){return!ro(t)}function io(t,e){if(!t)throw new Error(e)}function so(t,e,n,r=te){const o=e-t.length;let i=t;if(o>0){const d=r.repeat(o);i=n?d+t:t+d}return i}function Z(t){return W(new Uint8Array(t))}function ao(t){return gt(new Uint8Array(t))}function Et(t,e){return N(new Uint8Array(t),!e)}function co(t){return mt(new Uint8Array(t))}function lo(...t){return M(t.map(e=>N(new Uint8Array(e))).join("")).buffer}function Ct(t){return j(t).buffer}function uo(t){return Ce(t)}function ho(t,e){return Ee(t,!e)}function fo(t){return pt(t)}function _o(...t){return Kr(...t)}function po(t){return wt(t).buffer}function go(t){return ke(t)}function mo(t,e){return jr(t,!e)}function wo(t){return Br(t)}function yo(t){return Se(t)}function St(t){return M(t).buffer}function bo(t){return Dr(t)}function vo(t){return $r(t)}function Eo(t){return Wr(t)}function Co(t){return Fr(t).buffer}function So(t){return zr(t)}function kt(t,e){return Hr(Number(t),!e)}const ko=zn,xo=Qn,Io=Jn,Ro=Vn,To=Gn,xt=Hn,Oo=Yn,It=Wn,No=Kn,Mo=Zn,Lo=Xn,re=Fn;function oe(t){return er(t)}function ie(){const t=oe();return t&&t.os?t.os:void 0}function Rt(){const t=ie();return t?t.toLowerCase().includes("android"):!1}function Tt(){const t=ie();return t?t.toLowerCase().includes("ios")||t.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function Ot(){return ie()?Rt()||Tt():!1}function Nt(){const t=oe();return t&&t.name?t.name.toLowerCase()==="node":!1}function Mt(){return!Nt()&&!!xt()}const Lt=sr,qt=ar;function Oe(t,e){const n=qt(e),r=re();r&&r.setItem(t,n)}function Ne(t){let e=null,n=null;const r=re();return r&&(n=r.getItem(t)),e=n&&Lt(n),e}function Me(t){const e=re();e&&e.removeItem(t)}function de(){return tr()}function qo(t){return to(t)}function Ao(t){return J(t)}function Uo(t){return B(t)}function Po(t){return no(J(t))}const At=cr;function Y(){return((e,n)=>{for(n=e="";e++<36;n+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return n})()}function Do(){console.warn("DEPRECATION WARNING: This WalletConnect client library will be deprecated in favor of @walletconnect/client. Please check docs.walletconnect.org to learn more about this migration!")}function Ut(t,e){let n;const r=xr[t];return r&&(n=`https://${r}.infura.io/v3/${e}`),n}function Pt(t,e){let n;const r=Ut(t,e.infuraId);return e.custom&&e.custom[t]?n=e.custom[t]:r&&(n=r),n}function $o(t,e){const n=encodeURIComponent(t);return e.universalLink?`${e.universalLink}/wc?uri=${n}`:e.deepLink?`${e.deepLink}${e.deepLink.endsWith(":")?"//":"/"}wc?uri=${n}`:""}function jo(t){const e=t.href.split("?")[0];Oe(ue,Object.assign(Object.assign({},t),{href:e}))}function Dt(t,e){return t.filter(n=>n.name.toLowerCase().includes(e.toLowerCase()))[0]}function Bo(t,e){let n=t;return e&&(n=e.map(r=>Dt(t,r)).filter(Boolean)),n}function Wo(t,e){return async(...r)=>new Promise((o,i)=>{const d=(f,p)=>{(f===null||typeof f>"u")&&i(f),o(p)};t.apply(e,[...r,d])})}function $t(t){const e=t.message||"Failed or Rejected Request";let n=-32e3;if(t&&!t.code)switch(e){case"Parse error":n=-32700;break;case"Invalid request":n=-32600;break;case"Method not found":n=-32601;break;case"Invalid params":n=-32602;break;case"Internal error":n=-32603;break;default:n=-32e3;break}const r={code:n,message:e};return t.data&&(r.data=t.data),r}const jt="https://registry.walletconnect.com";function Fo(){return jt+"/api/v2/wallets"}function Ho(){return jt+"/api/v2/dapps"}function Bt(t,e="mobile"){var n;return{name:t.name||"",shortName:t.metadata.shortName||"",color:t.metadata.colors.primary||"",logo:(n=t.image_url.sm)!==null&&n!==void 0?n:"",universalLink:t[e].universal||"",deepLink:t[e].native||""}}function zo(t,e="mobile"){return Object.values(t).filter(n=>!!n[e].universal||!!n[e].native).map(n=>Bt(n,e))}var Le={};(function(t){const e=or,n=ir,r=nr,o=rr,i=s=>s==null;function d(s){switch(s.arrayFormat){case"index":return a=>(u,c)=>{const h=u.length;return c===void 0||s.skipNull&&c===null||s.skipEmptyString&&c===""?u:c===null?[...u,[g(a,s),"[",h,"]"].join("")]:[...u,[g(a,s),"[",g(h,s),"]=",g(c,s)].join("")]};case"bracket":return a=>(u,c)=>c===void 0||s.skipNull&&c===null||s.skipEmptyString&&c===""?u:c===null?[...u,[g(a,s),"[]"].join("")]:[...u,[g(a,s),"[]=",g(c,s)].join("")];case"comma":case"separator":return a=>(u,c)=>c==null||c.length===0?u:u.length===0?[[g(a,s),"=",g(c,s)].join("")]:[[u,g(c,s)].join(s.arrayFormatSeparator)];default:return a=>(u,c)=>c===void 0||s.skipNull&&c===null||s.skipEmptyString&&c===""?u:c===null?[...u,g(a,s)]:[...u,[g(a,s),"=",g(c,s)].join("")]}}function f(s){let a;switch(s.arrayFormat){case"index":return(u,c,h)=>{if(a=/\[(\d*)\]$/.exec(u),u=u.replace(/\[\d*\]$/,""),!a){h[u]=c;return}h[u]===void 0&&(h[u]={}),h[u][a[1]]=c};case"bracket":return(u,c,h)=>{if(a=/(\[\])$/.exec(u),u=u.replace(/\[\]$/,""),!a){h[u]=c;return}if(h[u]===void 0){h[u]=[c];return}h[u]=[].concat(h[u],c)};case"comma":case"separator":return(u,c,h)=>{const m=typeof c=="string"&&c.includes(s.arrayFormatSeparator),_=typeof c=="string"&&!m&&w(c,s).includes(s.arrayFormatSeparator);c=_?w(c,s):c;const v=m||_?c.split(s.arrayFormatSeparator).map(T=>w(T,s)):c===null?c:w(c,s);h[u]=v};default:return(u,c,h)=>{if(h[u]===void 0){h[u]=c;return}h[u]=[].concat(h[u],c)}}}function p(s){if(typeof s!="string"||s.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function g(s,a){return a.encode?a.strict?e(s):encodeURIComponent(s):s}function w(s,a){return a.decode?n(s):s}function y(s){return Array.isArray(s)?s.sort():typeof s=="object"?y(Object.keys(s)).sort((a,u)=>Number(a)-Number(u)).map(a=>s[a]):s}function b(s){const a=s.indexOf("#");return a!==-1&&(s=s.slice(0,a)),s}function S(s){let a="";const u=s.indexOf("#");return u!==-1&&(a=s.slice(u)),a}function k(s){s=b(s);const a=s.indexOf("?");return a===-1?"":s.slice(a+1)}function I(s,a){return a.parseNumbers&&!Number.isNaN(Number(s))&&typeof s=="string"&&s.trim()!==""?s=Number(s):a.parseBooleans&&s!==null&&(s.toLowerCase()==="true"||s.toLowerCase()==="false")&&(s=s.toLowerCase()==="true"),s}function R(s,a){a=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},a),p(a.arrayFormatSeparator);const u=f(a),c=Object.create(null);if(typeof s!="string"||(s=s.trim().replace(/^[?#&]/,""),!s))return c;for(const h of s.split("&")){if(h==="")continue;let[m,_]=r(a.decode?h.replace(/\+/g," "):h,"=");_=_===void 0?null:["comma","separator"].includes(a.arrayFormat)?_:w(_,a),u(w(m,a),_,c)}for(const h of Object.keys(c)){const m=c[h];if(typeof m=="object"&&m!==null)for(const _ of Object.keys(m))m[_]=I(m[_],a);else c[h]=I(m,a)}return a.sort===!1?c:(a.sort===!0?Object.keys(c).sort():Object.keys(c).sort(a.sort)).reduce((h,m)=>{const _=c[m];return _&&typeof _=="object"&&!Array.isArray(_)?h[m]=y(_):h[m]=_,h},Object.create(null))}t.extract=k,t.parse=R,t.stringify=(s,a)=>{if(!s)return"";a=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},a),p(a.arrayFormatSeparator);const u=_=>a.skipNull&&i(s[_])||a.skipEmptyString&&s[_]==="",c=d(a),h={};for(const _ of Object.keys(s))u(_)||(h[_]=s[_]);const m=Object.keys(h);return a.sort!==!1&&m.sort(a.sort),m.map(_=>{const v=s[_];return v===void 0?"":v===null?g(_,a):Array.isArray(v)?v.reduce(c(_),[]).join("&"):g(_,a)+"="+g(v,a)}).filter(_=>_.length>0).join("&")},t.parseUrl=(s,a)=>{a=Object.assign({decode:!0},a);const[u,c]=r(s,"#");return Object.assign({url:u.split("?")[0]||"",query:R(k(s),a)},a&&a.parseFragmentIdentifier&&c?{fragmentIdentifier:w(c,a)}:{})},t.stringifyUrl=(s,a)=>{a=Object.assign({encode:!0,strict:!0},a);const u=b(s.url).split("?")[0]||"",c=t.extract(s.url),h=t.parse(c,{sort:!1}),m=Object.assign(h,s.query);let _=t.stringify(m,a);_&&(_=`?${_}`);let v=S(s.url);return s.fragmentIdentifier&&(v=`#${g(s.fragmentIdentifier,a)}`),`${u}${_}${v}`},t.pick=(s,a,u)=>{u=Object.assign({parseFragmentIdentifier:!0},u);const{url:c,query:h,fragmentIdentifier:m}=t.parseUrl(s,u);return t.stringifyUrl({url:c,query:o(h,a),fragmentIdentifier:m},u)},t.exclude=(s,a,u)=>{const c=Array.isArray(a)?h=>!a.includes(h):(h,m)=>!a(h,m);return t.pick(s,c,u)}})(Le);function Wt(t){const e=t.indexOf("?")!==-1?t.indexOf("?"):void 0;return typeof e<"u"?t.substr(e):""}function Ft(t,e){let n=qe(t);return n=Object.assign(Object.assign({},n),e),t=Ht(n),t}function qe(t){return Le.parse(t)}function Ht(t){return Le.stringify(t)}function zt(t){return typeof t.bridge<"u"}function Qt(t){const e=t.indexOf(":"),n=t.indexOf("?")!==-1?t.indexOf("?"):void 0,r=t.substring(0,e),o=t.substring(e+1,n);function i(y){const b="@",S=y.split(b);return{handshakeTopic:S[0],version:parseInt(S[1],10)}}const d=i(o),f=typeof n<"u"?t.substr(n):"";function p(y){const b=qe(y);return{key:b.key||"",bridge:b.bridge||""}}const g=p(f);return Object.assign(Object.assign({protocol:r},d),g)}function Qo(t){return t===""||typeof t=="string"&&t.trim()===""}function Jo(t){return!(t&&t.length)}function Vo(t){return ne(t)}function Go(t){return Re(t)}function Yo(t){return bt(t)}function Ko(t){return Gr(t)}function Zo(t){return Yr(t)}function Xo(t,e){return yt(t,e)}function ei(t){return typeof t.params=="object"}function Jt(t){return typeof t.method<"u"}function P(t){return typeof t.result<"u"}function z(t){return typeof t.error<"u"}function he(t){return typeof t.event<"u"}function Vt(t){return Sr.includes(t)||t.startsWith("wc_")}function Gt(t){return t.method.startsWith("wc_")?!0:!we.includes(t.method)}const ti=Object.freeze(Object.defineProperty({__proto__:null,addHexPrefix:Ao,appendToQueryString:Ft,concatArrayBuffers:lo,concatBuffers:_o,convertArrayBufferToBuffer:Z,convertArrayBufferToHex:Et,convertArrayBufferToNumber:co,convertArrayBufferToUtf8:ao,convertBufferToArrayBuffer:Ct,convertBufferToHex:ho,convertBufferToNumber:fo,convertBufferToUtf8:uo,convertHexToArrayBuffer:St,convertHexToBuffer:yo,convertHexToNumber:vo,convertHexToUtf8:bo,convertNumberToArrayBuffer:Co,convertNumberToBuffer:Eo,convertNumberToHex:kt,convertNumberToUtf8:So,convertUtf8ToArrayBuffer:po,convertUtf8ToBuffer:go,convertUtf8ToHex:mo,convertUtf8ToNumber:wo,detectEnv:oe,detectOS:ie,formatIOSMobile:$o,formatMobileRegistry:zo,formatMobileRegistryEntry:Bt,formatQueryString:Ht,formatRpcError:$t,getClientMeta:de,getCrypto:Mo,getCryptoOrThrow:No,getDappRegistryUrl:Ho,getDocument:Ro,getDocumentOrThrow:Io,getEncoding:Zo,getFromWindow:ko,getFromWindowOrThrow:xo,getInfuraRpcUrl:Ut,getLocal:Ne,getLocalStorage:re,getLocalStorageOrThrow:Lo,getLocation:It,getLocationOrThrow:Oo,getMobileLinkRegistry:Bo,getMobileRegistryEntry:Dt,getNavigator:xt,getNavigatorOrThrow:To,getQueryString:Wt,getRpcUrl:Pt,getType:Ko,getWalletRegistryUrl:Fo,isAndroid:Rt,isArrayBuffer:Yo,isBrowser:Mt,isBuffer:Vo,isEmptyArray:Jo,isEmptyString:Qo,isHexString:Xo,isIOS:Tt,isInternalEvent:he,isJsonRpcRequest:Jt,isJsonRpcResponseError:z,isJsonRpcResponseSuccess:P,isJsonRpcSubscription:ei,isMobile:Ot,isNode:Nt,isReservedEvent:Vt,isSilentPayload:Gt,isTypedArray:Go,isWalletConnectSession:zt,logDeprecationWarning:Do,parseQueryString:qe,parseWalletConnectUri:Qt,payloadId:At,promisify:Wo,removeHexLeadingZeros:Po,removeHexPrefix:Uo,removeLocal:Me,safeJsonParse:Lt,safeJsonStringify:qt,sanitizeHex:qo,saveMobileLinkInfo:jo,setLocal:Oe,uuid:Y},Symbol.toStringTag,{value:"Module"}));class ni{constructor(){this._eventEmitters=[],typeof window<"u"&&typeof window.addEventListener<"u"&&(window.addEventListener("online",()=>this.trigger("online")),window.addEventListener("offline",()=>this.trigger("offline")))}on(e,n){this._eventEmitters.push({event:e,callback:n})}trigger(e){let n=[];e&&(n=this._eventEmitters.filter(r=>r.event===e)),n.forEach(r=>{r.callback()})}}const ri=typeof global.WebSocket<"u"?global.WebSocket:require("ws");class oi{constructor(e){if(this.opts=e,this._queue=[],this._events=[],this._subscriptions=[],this._protocol=e.protocol,this._version=e.version,this._url="",this._netMonitor=null,this._socket=null,this._nextSocket=null,this._subscriptions=e.subscriptions||[],this._netMonitor=e.netMonitor||new ni,!e.url||typeof e.url!="string")throw new Error("Missing or invalid WebSocket url");this._url=e.url,this._netMonitor.on("online",()=>this._socketCreate())}set readyState(e){}get readyState(){return this._socket?this._socket.readyState:-1}set connecting(e){}get connecting(){return this.readyState===0}set connected(e){}get connected(){return this.readyState===1}set closing(e){}get closing(){return this.readyState===2}set closed(e){}get closed(){return this.readyState===3}open(){this._socketCreate()}close(){this._socketClose()}send(e,n,r){if(!n||typeof n!="string")throw new Error("Missing or invalid topic field");this._socketSend({topic:n,type:"pub",payload:e,silent:!!r})}subscribe(e){this._socketSend({topic:e,type:"sub",payload:"",silent:!0})}on(e,n){this._events.push({event:e,callback:n})}_socketCreate(){if(this._nextSocket)return;const e=ii(this._url,this._protocol,this._version);if(this._nextSocket=new ri(e),!this._nextSocket)throw new Error("Failed to create socket");this._nextSocket.onmessage=n=>this._socketReceive(n),this._nextSocket.onopen=()=>this._socketOpen(),this._nextSocket.onerror=n=>this._socketError(n),this._nextSocket.onclose=()=>{setTimeout(()=>{this._nextSocket=null,this._socketCreate()},1e3)}}_socketOpen(){this._socketClose(),this._socket=this._nextSocket,this._nextSocket=null,this._queueSubscriptions(),this._pushQueue()}_socketClose(){this._socket&&(this._socket.onclose=()=>{},this._socket.close())}_socketSend(e){const n=JSON.stringify(e);this._socket&&this._socket.readyState===1?this._socket.send(n):(this._setToQueue(e),this._socketCreate())}async _socketReceive(e){let n;try{n=JSON.parse(e.data)}catch{return}if(this._socketSend({topic:n.topic,type:"ack",payload:"",silent:!0}),this._socket&&this._socket.readyState===1){const r=this._events.filter(o=>o.event==="message");r&&r.length&&r.forEach(o=>o.callback(n))}}_socketError(e){const n=this._events.filter(r=>r.event==="error");n&&n.length&&n.forEach(r=>r.callback(e))}_queueSubscriptions(){this._subscriptions.forEach(n=>this._queue.push({topic:n,type:"sub",payload:"",silent:!0})),this._subscriptions=this.opts.subscriptions||[]}_setToQueue(e){this._queue.push(e)}_pushQueue(){this._queue.forEach(n=>this._socketSend(n)),this._queue=[]}}function ii(t,e,n){var r,o;const d=(t.startsWith("https")?t.replace("https","wss"):t.startsWith("http")?t.replace("http","ws"):t).split("?"),f=Mt()?{protocol:e,version:n,env:"browser",host:((r=It())===null||r===void 0?void 0:r.host)||""}:{protocol:e,version:n,env:((o=oe())===null||o===void 0?void 0:o.name)||""},p=Ft(Wt(d[1]||""),f);return d[0]+"?"+p}class si{constructor(){this._eventEmitters=[]}subscribe(e){this._eventEmitters.push(e)}unsubscribe(e){this._eventEmitters=this._eventEmitters.filter(n=>n.event!==e)}trigger(e){let n=[],r;Jt(e)?r=e.method:P(e)||z(e)?r=`response:${e.id}`:he(e)?r=e.event:r="",r&&(n=this._eventEmitters.filter(o=>o.event===r)),(!n||!n.length)&&!Vt(r)&&!he(r)&&(n=this._eventEmitters.filter(o=>o.event==="call_request")),n.forEach(o=>{if(z(e)){const i=new Error(e.error.message);o.callback(i,null)}else o.callback(null,e)})}}class ai{constructor(e="walletconnect"){this.storageId=e}getSession(){let e=null;const n=Ne(this.storageId);return n&&zt(n)&&(e=n),e}setSession(e){return Oe(this.storageId,e),e}removeSession(){Me(this.storageId)}}const ci="walletconnect.org",li="abcdefghijklmnopqrstuvwxyz0123456789",Yt=li.split("").map(t=>`https://${t}.bridge.walletconnect.org`);function ui(t){let e=t.indexOf("//")>-1?t.split("/")[2]:t.split("/")[0];return e=e.split(":")[0],e=e.split("?")[0],e}function di(t){return ui(t).split(".").slice(-2).join(".")}function hi(){return Math.floor(Math.random()*Yt.length)}function fi(){return Yt[hi()]}function _i(t){return di(t)===ci}function pi(t){return _i(t)?fi():t}class gi{constructor(e){if(this.protocol="wc",this.version=1,this._bridge="",this._key=null,this._clientId="",this._clientMeta=null,this._peerId="",this._peerMeta=null,this._handshakeId=0,this._handshakeTopic="",this._connected=!1,this._accounts=[],this._chainId=0,this._networkId=0,this._rpcUrl="",this._eventManager=new si,this._clientMeta=de()||e.connectorOpts.clientMeta||null,this._cryptoLib=e.cryptoLib,this._sessionStorage=e.sessionStorage||new ai(e.connectorOpts.storageId),this._qrcodeModal=e.connectorOpts.qrcodeModal,this._qrcodeModalOptions=e.connectorOpts.qrcodeModalOptions,this._signingMethods=[...we,...e.connectorOpts.signingMethods||[]],!e.connectorOpts.bridge&&!e.connectorOpts.uri&&!e.connectorOpts.session)throw new Error(vr);e.connectorOpts.bridge&&(this.bridge=pi(e.connectorOpts.bridge)),e.connectorOpts.uri&&(this.uri=e.connectorOpts.uri);const n=e.connectorOpts.session||this._getStorageSession();n&&(this.session=n),this.handshakeId&&this._subscribeToSessionResponse(this.handshakeId,"Session request rejected"),this._transport=e.transport||new oi({protocol:this.protocol,version:this.version,url:this.bridge,subscriptions:[this.clientId]}),this._subscribeToInternalEvents(),this._initTransport(),e.connectorOpts.uri&&this._subscribeToSessionRequest(),e.pushServerOpts&&this._registerPushServer(e.pushServerOpts)}set bridge(e){e&&(this._bridge=e)}get bridge(){return this._bridge}set key(e){if(!e)return;const n=St(e);this._key=n}get key(){return this._key?Et(this._key,!0):""}set clientId(e){e&&(this._clientId=e)}get clientId(){let e=this._clientId;return e||(e=this._clientId=Y()),this._clientId}set peerId(e){e&&(this._peerId=e)}get peerId(){return this._peerId}set clientMeta(e){}get clientMeta(){let e=this._clientMeta;return e||(e=this._clientMeta=de()),e}set peerMeta(e){this._peerMeta=e}get peerMeta(){return this._peerMeta}set handshakeTopic(e){e&&(this._handshakeTopic=e)}get handshakeTopic(){return this._handshakeTopic}set handshakeId(e){e&&(this._handshakeId=e)}get handshakeId(){return this._handshakeId}get uri(){return this._formatUri()}set uri(e){if(!e)return;const{handshakeTopic:n,bridge:r,key:o}=this._parseUri(e);this.handshakeTopic=n,this.bridge=r,this.key=o}set chainId(e){this._chainId=e}get chainId(){return this._chainId}set networkId(e){this._networkId=e}get networkId(){return this._networkId}set accounts(e){this._accounts=e}get accounts(){return this._accounts}set rpcUrl(e){this._rpcUrl=e}get rpcUrl(){return this._rpcUrl}set connected(e){}get connected(){return this._connected}set pending(e){}get pending(){return!!this._handshakeTopic}get session(){return{connected:this.connected,accounts:this.accounts,chainId:this.chainId,bridge:this.bridge,key:this.key,clientId:this.clientId,clientMeta:this.clientMeta,peerId:this.peerId,peerMeta:this.peerMeta,handshakeId:this.handshakeId,handshakeTopic:this.handshakeTopic}}set session(e){e&&(this._connected=e.connected,this.accounts=e.accounts,this.chainId=e.chainId,this.bridge=e.bridge,this.key=e.key,this.clientId=e.clientId,this.clientMeta=e.clientMeta,this.peerId=e.peerId,this.peerMeta=e.peerMeta,this.handshakeId=e.handshakeId,this.handshakeTopic=e.handshakeTopic)}on(e,n){const r={event:e,callback:n};this._eventManager.subscribe(r)}off(e){this._eventManager.unsubscribe(e)}async createInstantRequest(e){this._key=await this._generateKey();const n=this._formatRequest({method:"wc_instantRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,request:this._formatRequest(e)}]});this.handshakeId=n.id,this.handshakeTopic=Y(),this._eventManager.trigger({event:"display_uri",params:[this.uri]}),this.on("modal_closed",()=>{throw new Error(We)});const r=()=>{this.killSession()};try{const o=await this._sendCallRequest(n);return o&&r(),o}catch(o){throw r(),o}}async connect(e){if(!this._qrcodeModal)throw new Error(Cr);return this.connected?{chainId:this.chainId,accounts:this.accounts}:(await this.createSession(e),new Promise(async(n,r)=>{this.on("modal_closed",()=>r(new Error(We))),this.on("connect",(o,i)=>{if(o)return r(o);n(i.params[0])})}))}async createSession(e){if(this._connected)throw new Error(ae);if(this.pending)return;this._key=await this._generateKey();const n=this._formatRequest({method:"wc_sessionRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,chainId:e&&e.chainId?e.chainId:null}]});this.handshakeId=n.id,this.handshakeTopic=Y(),this._sendSessionRequest(n,"Session update rejected",{topic:this.handshakeTopic}),this._eventManager.trigger({event:"display_uri",params:[this.uri]})}approveSession(e){if(this._connected)throw new Error(ae);this.chainId=e.chainId,this.accounts=e.accounts,this.networkId=e.networkId||0,this.rpcUrl=e.rpcUrl||"";const n={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl,peerId:this.clientId,peerMeta:this.clientMeta},r={id:this.handshakeId,jsonrpc:"2.0",result:n};this._sendResponse(r),this._connected=!0,this._setStorageSession(),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})}rejectSession(e){if(this._connected)throw new Error(ae);const n=e&&e.message?e.message:pr,r=this._formatResponse({id:this.handshakeId,error:{message:n}});this._sendResponse(r),this._connected=!1,this._eventManager.trigger({event:"disconnect",params:[{message:n}]}),this._removeStorageSession()}updateSession(e){if(!this._connected)throw new Error(q);this.chainId=e.chainId,this.accounts=e.accounts,this.networkId=e.networkId||0,this.rpcUrl=e.rpcUrl||"";const n={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl},r=this._formatRequest({method:"wc_sessionUpdate",params:[n]});this._sendSessionRequest(r,"Session update rejected"),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]}),this._manageStorageSession()}async killSession(e){const n=e?e.message:"Session Disconnected",r={approved:!1,chainId:null,networkId:null,accounts:null},o=this._formatRequest({method:"wc_sessionUpdate",params:[r]});await this._sendRequest(o),this._handleSessionDisconnect(n)}async sendTransaction(e){if(!this._connected)throw new Error(q);const n=e,r=this._formatRequest({method:"eth_sendTransaction",params:[n]});return await this._sendCallRequest(r)}async signTransaction(e){if(!this._connected)throw new Error(q);const n=e,r=this._formatRequest({method:"eth_signTransaction",params:[n]});return await this._sendCallRequest(r)}async signMessage(e){if(!this._connected)throw new Error(q);const n=this._formatRequest({method:"eth_sign",params:e});return await this._sendCallRequest(n)}async signPersonalMessage(e){if(!this._connected)throw new Error(q);const n=this._formatRequest({method:"personal_sign",params:e});return await this._sendCallRequest(n)}async signTypedData(e){if(!this._connected)throw new Error(q);const n=this._formatRequest({method:"eth_signTypedData",params:e});return await this._sendCallRequest(n)}async updateChain(e){if(!this._connected)throw new Error("Session currently disconnected");const n=this._formatRequest({method:"wallet_updateChain",params:[e]});return await this._sendCallRequest(n)}unsafeSend(e,n){return this._sendRequest(e,n),this._eventManager.trigger({event:"call_request_sent",params:[{request:e,options:n}]}),new Promise((r,o)=>{this._subscribeToResponse(e.id,(i,d)=>{if(i){o(i);return}if(!d)throw new Error(gr);r(d)})})}async sendCustomRequest(e,n){if(!this._connected)throw new Error(q);switch(e.method){case"eth_accounts":return this.accounts;case"eth_chainId":return kt(this.chainId);case"eth_sendTransaction":case"eth_signTransaction":e.params;break;case"personal_sign":e.params;break}const r=this._formatRequest(e);return await this._sendCallRequest(r,n)}approveRequest(e){if(P(e)){const n=this._formatResponse(e);this._sendResponse(n)}else throw new Error(mr)}rejectRequest(e){if(z(e)){const n=this._formatResponse(e);this._sendResponse(n)}else throw new Error(wr)}transportClose(){this._transport.close()}async _sendRequest(e,n){const r=this._formatRequest(e),o=await this._encrypt(r),i=typeof(n==null?void 0:n.topic)<"u"?n.topic:this.peerId,d=JSON.stringify(o),f=typeof(n==null?void 0:n.forcePushNotification)<"u"?!n.forcePushNotification:Gt(r);this._transport.send(d,i,f)}async _sendResponse(e){const n=await this._encrypt(e),r=this.peerId,o=JSON.stringify(n),i=!0;this._transport.send(o,r,i)}async _sendSessionRequest(e,n,r){this._sendRequest(e,r),this._subscribeToSessionResponse(e.id,n)}_sendCallRequest(e,n){return this._sendRequest(e,n),this._eventManager.trigger({event:"call_request_sent",params:[{request:e,options:n}]}),this._subscribeToCallResponse(e.id)}_formatRequest(e){if(typeof e.method>"u")throw new Error(yr);return{id:typeof e.id>"u"?At():e.id,jsonrpc:"2.0",method:e.method,params:typeof e.params>"u"?[]:e.params}}_formatResponse(e){if(typeof e.id>"u")throw new Error(br);const n={id:e.id,jsonrpc:"2.0"};if(z(e)){const r=$t(e.error);return Object.assign(Object.assign(Object.assign({},n),e),{error:r})}else if(P(e))return Object.assign(Object.assign({},n),e);throw new Error(Be)}_handleSessionDisconnect(e){const n=e||"Session Disconnected";this._connected||(this._qrcodeModal&&this._qrcodeModal.close(),Me(ue)),this._connected&&(this._connected=!1),this._handshakeId&&(this._handshakeId=0),this._handshakeTopic&&(this._handshakeTopic=""),this._peerId&&(this._peerId=""),this._eventManager.trigger({event:"disconnect",params:[{message:n}]}),this._removeStorageSession(),this.transportClose()}_handleSessionResponse(e,n){n?n.approved?(this._connected?(n.chainId&&(this.chainId=n.chainId),n.accounts&&(this.accounts=n.accounts),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]})):(this._connected=!0,n.chainId&&(this.chainId=n.chainId),n.accounts&&(this.accounts=n.accounts),n.peerId&&!this.peerId&&(this.peerId=n.peerId),n.peerMeta&&!this.peerMeta&&(this.peerMeta=n.peerMeta),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})),this._manageStorageSession()):this._handleSessionDisconnect(e):this._handleSessionDisconnect(e)}async _handleIncomingMessages(e){if(![this.clientId,this.handshakeTopic].includes(e.topic))return;let r;try{r=JSON.parse(e.payload)}catch{return}const o=await this._decrypt(r);o&&this._eventManager.trigger(o)}_subscribeToSessionRequest(){this._transport.subscribe(this.handshakeTopic)}_subscribeToResponse(e,n){this.on(`response:${e}`,n)}_subscribeToSessionResponse(e,n){this._subscribeToResponse(e,(r,o)=>{if(r){this._handleSessionResponse(r.message);return}P(o)?this._handleSessionResponse(n,o.result):o.error&&o.error.message?this._handleSessionResponse(o.error.message):this._handleSessionResponse(n)})}_subscribeToCallResponse(e){return new Promise((n,r)=>{this._subscribeToResponse(e,(o,i)=>{if(o){r(o);return}P(i)?n(i.result):i.error&&i.error.message?r(i.error):r(new Error(Be))})})}_subscribeToInternalEvents(){this.on("display_uri",()=>{this._qrcodeModal&&this._qrcodeModal.open(this.uri,()=>{this._eventManager.trigger({event:"modal_closed",params:[]})},this._qrcodeModalOptions)}),this.on("connect",()=>{this._qrcodeModal&&this._qrcodeModal.close()}),this.on("call_request_sent",(e,n)=>{const{request:r}=n.params[0];if(Ot()&&this._signingMethods.includes(r.method)){const o=Ne(ue);o&&(window.location.href=o.href)}}),this.on("wc_sessionRequest",(e,n)=>{e&&this._eventManager.trigger({event:"error",params:[{code:"SESSION_REQUEST_ERROR",message:e.toString()}]}),this.handshakeId=n.id,this.peerId=n.params[0].peerId,this.peerMeta=n.params[0].peerMeta;const r=Object.assign(Object.assign({},n),{method:"session_request"});this._eventManager.trigger(r)}),this.on("wc_sessionUpdate",(e,n)=>{e&&this._handleSessionResponse(e.message),this._handleSessionResponse("Session disconnected",n.params[0])})}_initTransport(){this._transport.on("message",e=>this._handleIncomingMessages(e)),this._transport.on("open",()=>this._eventManager.trigger({event:"transport_open",params:[]})),this._transport.on("close",()=>this._eventManager.trigger({event:"transport_close",params:[]})),this._transport.on("error",()=>this._eventManager.trigger({event:"transport_error",params:["Websocket connection failed"]})),this._transport.open()}_formatUri(){const e=this.protocol,n=this.handshakeTopic,r=this.version,o=encodeURIComponent(this.bridge),i=this.key;return`${e}:${n}@${r}?bridge=${o}&key=${i}`}_parseUri(e){const n=Qt(e);if(n.protocol===this.protocol){if(!n.handshakeTopic)throw Error("Invalid or missing handshakeTopic parameter value");const r=n.handshakeTopic;if(!n.bridge)throw Error("Invalid or missing bridge url parameter value");const o=decodeURIComponent(n.bridge);if(!n.key)throw Error("Invalid or missing key parameter value");const i=n.key;return{handshakeTopic:r,bridge:o,key:i}}else throw new Error(Er)}async _generateKey(){return this._cryptoLib?await this._cryptoLib.generateKey():null}async _encrypt(e){const n=this._key;return this._cryptoLib&&n?await this._cryptoLib.encrypt(e,n):null}async _decrypt(e){const n=this._key;return this._cryptoLib&&n?await this._cryptoLib.decrypt(e,n):null}_getStorageSession(){let e=null;return this._sessionStorage&&(e=this._sessionStorage.getSession()),e}_setStorageSession(){this._sessionStorage&&this._sessionStorage.setSession(this.session)}_removeStorageSession(){this._sessionStorage&&this._sessionStorage.removeSession()}_manageStorageSession(){this._connected?this._setStorageSession():this._removeStorageSession()}_registerPushServer(e){if(!e.url||typeof e.url!="string")throw Error("Invalid or missing pushServerOpts.url parameter value");if(!e.type||typeof e.type!="string")throw Error("Invalid or missing pushServerOpts.type parameter value");if(!e.token||typeof e.token!="string")throw Error("Invalid or missing pushServerOpts.token parameter value");const n={bridge:this.bridge,topic:this.clientId,type:e.type,token:e.token,peerName:"",language:e.language||""};this.on("connect",async(r,o)=>{if(r)throw r;if(e.peerMeta){const i=o.params[0].peerMeta.name;n.peerName=i}try{if(!(await(await fetch(`${e.url}/new`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(n)})).json()).success)throw Error("Failed to register in Push Server")}catch{throw Error("Failed to register in Push Server")}})}}function mi(t){return Q.getBrowerCrypto().getRandomValues(new Uint8Array(t))}const Kt=256,Zt=Kt,wi=Kt,L="AES-CBC",yi=`SHA-${Zt}`,fe="HMAC",bi="encrypt",vi="decrypt",Ei="sign",Ci="verify";function Si(t){return t===L?{length:Zt,name:L}:{hash:{name:yi},name:fe}}function ki(t){return t===L?[bi,vi]:[Ei,Ci]}async function Ae(t,e=L){return Q.getSubtleCrypto().importKey("raw",t,Si(e),!0,ki(e))}async function xi(t,e,n){const r=Q.getSubtleCrypto(),o=await Ae(e,L),i=await r.encrypt({iv:t,name:L},o,n);return new Uint8Array(i)}async function Ii(t,e,n){const r=Q.getSubtleCrypto(),o=await Ae(e,L),i=await r.decrypt({iv:t,name:L},o,n);return new Uint8Array(i)}async function Ri(t,e){const n=Q.getSubtleCrypto(),r=await Ae(t,fe),o=await n.sign({length:wi,name:fe},r,e);return new Uint8Array(o)}function Ti(t,e,n){return xi(t,e,n)}function Oi(t,e,n){return Ii(t,e,n)}async function Xt(t,e){return await Ri(t,e)}async function en(t){const e=(t||256)/8,n=mi(e);return Ct(W(n))}async function tn(t,e){const n=M(t.data),r=M(t.iv),o=M(t.hmac),i=N(o,!1),d=vt(n,r),f=await Xt(e,d),p=N(f,!1);return B(i)===B(p)}async function Ni(t,e,n){const r=j(Z(e)),o=n||await en(128),i=j(Z(o)),d=N(i,!1),f=JSON.stringify(t),p=wt(f),g=await Ti(i,r,p),w=N(g,!1),y=vt(g,i),b=await Xt(r,y),S=N(b,!1);return{data:w,hmac:S,iv:d}}async function Mi(t,e){const n=j(Z(e));if(!n)throw new Error("Missing key: required for decryption");if(!await tn(t,n))return null;const o=M(t.data),i=M(t.iv),d=await Oi(i,n,o),f=gt(d);let p;try{p=JSON.parse(f)}catch{return null}return p}const Li=Object.freeze(Object.defineProperty({__proto__:null,decrypt:Mi,encrypt:Ni,generateKey:en,verifyHmac:tn},Symbol.toStringTag,{value:"Module"}));class qi extends gi{constructor(e,n){super({cryptoLib:Li,connectorOpts:e,pushServerOpts:n})}}const Ai=et(ti);var Ui=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,n=[],r=0;r"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var y=Fe[e.format]||Fe.default;window.clipboardData.setData(y,t)}else w.clipboardData.clearData(),w.clipboardData.setData(e.format,t);e.onCopy&&(w.preventDefault(),e.onCopy(w.clipboardData))}),document.body.appendChild(f),i.selectNodeContents(f),d.addRange(i);var g=document.execCommand("copy");if(!g)throw new Error("copy command was unsuccessful");p=!0}catch(w){n&&console.error("unable to copy using execCommand: ",w),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),p=!0}catch(y){n&&console.error("unable to copy using clipboardData: ",y),n&&console.error("falling back to prompt"),r=$i("message"in e?e.message:Di),window.prompt(r,t)}}finally{d&&(typeof d.removeRange=="function"?d.removeRange(i):d.removeAllRanges()),f&&document.body.removeChild(f),o()}return p}var Bi=ji;function nn(t,e){for(var n in e)t[n]=e[n];return t}function _e(t,e){for(var n in t)if(n!=="__source"&&!(n in e))return!0;for(var r in e)if(r!=="__source"&&t[r]!==e[r])return!0;return!1}function X(t){this.props=t}function rn(t,e){function n(o){var i=this.props.ref,d=i==o.ref;return!d&&i&&(i.call?i(null):i.current=null),e?!e(this.props,o)||!d:_e(this.props,o)}function r(o){return this.shouldComponentUpdate=n,x(t,o)}return r.displayName="Memo("+(t.displayName||t.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(X.prototype=new A).isPureReactComponent=!0,X.prototype.shouldComponentUpdate=function(t,e){return _e(this.props,t)||_e(this.state,e)};var He=C.__b;C.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),He&&He(t)};var Wi=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function on(t){function e(n){var r=nn({},n);return delete r.ref,t(r,n.ref||null)}return e.$$typeof=Wi,e.render=e,e.prototype.isReactComponent=e.__f=!0,e.displayName="ForwardRef("+(t.displayName||t.name)+")",e}var ze=function(t,e){return t==null?null:O(O(t).map(e))},sn={map:ze,forEach:ze,count:function(t){return t?O(t).length:0},only:function(t){var e=O(t);if(e.length!==1)throw"Children.only";return e[0]},toArray:O},Fi=C.__e;C.__e=function(t,e,n,r){if(t.then){for(var o,i=e;i=i.__;)if((o=i.__c)&&o.__c)return e.__e==null&&(e.__e=n.__e,e.__k=n.__k),o.__c(t,e)}Fi(t,e,n,r)};var Qe=C.unmount;function an(t,e,n){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),t.__c.__H=null),(t=nn({},t)).__c!=null&&(t.__c.__P===n&&(t.__c.__P=e),t.__c=null),t.__k=t.__k&&t.__k.map(function(r){return an(r,e,n)})),t}function cn(t,e,n){return t&&n&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(r){return cn(r,e,n)}),t.__c&&t.__c.__P===e&&(t.__e&&n.appendChild(t.__e),t.__c.__e=!0,t.__c.__P=n)),t}function H(){this.__u=0,this.t=null,this.__b=null}function ln(t){var e=t.__.__c;return e&&e.__a&&e.__a(t)}function un(t){var e,n,r;function o(i){if(e||(e=t()).then(function(d){n=d.default||d},function(d){r=d}),r)throw r;if(!n)throw e;return x(n,i)}return o.displayName="Lazy",o.__f=!0,o}function D(){this.u=null,this.o=null}C.unmount=function(t){var e=t.__c;e&&e.__R&&e.__R(),e&&32&t.__u&&(t.type=null),Qe&&Qe(t)},(H.prototype=new A).__c=function(t,e){var n=e.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var o=ln(r.__v),i=!1,d=function(){i||(i=!0,n.__R=null,o?o(f):f())};n.__R=d;var f=function(){if(!--r.__u){if(r.state.__a){var p=r.state.__a;r.__v.__k[0]=cn(p,p.__c.__P,p.__c.__O)}var g;for(r.setState({__a:r.__b=null});g=r.t.pop();)g.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),t.then(d,d)},H.prototype.componentWillUnmount=function(){this.t=[]},H.prototype.render=function(t,e){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=an(this.__b,n,r.__O=r.__P)}this.__b=null}var o=e.__a&&x($,null,t.fallback);return o&&(o.__u&=-33),[x($,null,e.__a?null:t.children),o]};var Je=function(t,e,n){if(++n[1]===n[0]&&t.o.delete(e),t.props.revealOrder&&(t.props.revealOrder[0]!=="t"||!t.o.size))for(n=t.u;n;){for(;n.length>3;)n.pop()();if(n[1]>>1,1),e.i.removeChild(r)}}),K(x(Hi,{context:e.context},t.__v),e.l)}function dn(t,e){var n=x(zi,{__v:t,i:e});return n.containerInfo=e,n}(D.prototype=new A).__a=function(t){var e=this,n=ln(e.__v),r=e.o.get(t);return r[0]++,function(o){var i=function(){e.props.revealOrder?(r.push(o),Je(e,t,r)):o()};n?n(i):i()}},D.prototype.render=function(t){this.u=null,this.o=new Map;var e=O(t.children);t.revealOrder&&t.revealOrder[0]==="b"&&e.reverse();for(var n=e.length;n--;)this.o.set(e[n],this.u=[1,0,this.u]);return t.children},D.prototype.componentDidUpdate=D.prototype.componentDidMount=function(){var t=this;this.o.forEach(function(e,n){Je(t,n,e)})};var hn=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Qi=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Ji=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Vi=/[A-Z0-9]/g,Gi=typeof document<"u",Yi=function(t){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(t)};function fn(t,e,n){return e.__k==null&&(e.textContent=""),K(t,e),typeof n=="function"&&n(),t?t.__c:null}function _n(t,e,n){return hr(t,e),typeof n=="function"&&n(),t?t.__c:null}A.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(A.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})});var Ve=C.event;function Ki(){}function Zi(){return this.cancelBubble}function Xi(){return this.defaultPrevented}C.event=function(t){return Ve&&(t=Ve(t)),t.persist=Ki,t.isPropagationStopped=Zi,t.isDefaultPrevented=Xi,t.nativeEvent=t};var Ue,es={enumerable:!1,configurable:!0,get:function(){return this.class}},Ge=C.vnode;C.vnode=function(t){typeof t.type=="string"&&function(e){var n=e.props,r=e.type,o={};for(var i in n){var d=n[i];if(!(i==="value"&&"defaultValue"in n&&d==null||Gi&&i==="children"&&r==="noscript"||i==="class"||i==="className")){var f=i.toLowerCase();i==="defaultValue"&&"value"in n&&n.value==null?i="value":i==="download"&&d===!0?d="":f==="ondoubleclick"?i="ondblclick":f!=="onchange"||r!=="input"&&r!=="textarea"||Yi(n.type)?f==="onfocus"?i="onfocusin":f==="onblur"?i="onfocusout":Ji.test(i)?i=f:r.indexOf("-")===-1&&Qi.test(i)?i=i.replace(Vi,"-$&").toLowerCase():d===null&&(d=void 0):f=i="oninput",f==="oninput"&&o[i=f]&&(i="oninputCapture"),o[i]=d}}r=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=O(n.children).forEach(function(p){p.props.selected=o.value.indexOf(p.props.value)!=-1})),r=="select"&&o.defaultValue!=null&&(o.value=O(n.children).forEach(function(p){p.props.selected=o.multiple?o.defaultValue.indexOf(p.props.value)!=-1:o.defaultValue==p.props.value})),n.class&&!n.className?(o.class=n.class,Object.defineProperty(o,"className",es)):(n.className&&!n.class||n.class&&n.className)&&(o.class=o.className=n.className),e.props=o}(t),t.$$typeof=hn,Ge&&Ge(t)};var Ye=C.__r;C.__r=function(t){Ye&&Ye(t),Ue=t.__c};var Ke=C.diffed;C.diffed=function(t){Ke&&Ke(t);var e=t.props,n=t.__e;n!=null&&t.type==="textarea"&&"value"in e&&e.value!==n.value&&(n.value=e.value==null?"":e.value),Ue=null};var pn={ReactCurrentDispatcher:{current:{readContext:function(t){return Ue.__n[t.__c].props.value}}}},ts="17.0.2";function gn(t){return x.bind(null,t)}function V(t){return!!t&&t.$$typeof===hn}function mn(t){return V(t)&&t.type===$}function wn(t){return V(t)?fr.apply(null,arguments):t}function yn(t){return!!t.__k&&(K(null,t),!0)}function bn(t){return t&&(t.base||t.nodeType===1&&t)||null}var vn=function(t,e){return t(e)},En=function(t,e){return t(e)},Cn=$;function Pe(t){t()}function Sn(t){return t}function kn(){return[!1,Pe]}var xn=ee,In=V;function Rn(t,e){var n=e(),r=ge({h:{__:n,v:e}}),o=r[0].h,i=r[1];return ee(function(){o.__=n,o.v=e,ce(o)&&i({h:o})},[t,n,e]),me(function(){return ce(o)&&i({h:o}),t(function(){ce(o)&&i({h:o})})},[t]),n}function ce(t){var e,n,r=t.v,o=t.__;try{var i=r();return!((e=o)===(n=i)&&(e!==0||1/e==1/n)||e!=e&&n!=n)}catch{return!0}}var ns={useState:ge,useId:nt,useReducer:rt,useEffect:me,useLayoutEffect:ee,useInsertionEffect:xn,useTransition:kn,useDeferredValue:Sn,useSyncExternalStore:Rn,startTransition:Pe,useRef:ot,useImperativeHandle:it,useMemo:st,useCallback:at,useContext:ct,useDebugValue:lt,version:"17.0.2",Children:sn,render:fn,hydrate:_n,unmountComponentAtNode:yn,createPortal:dn,createElement:x,createContext:ut,createFactory:gn,cloneElement:wn,createRef:dt,Fragment:$,isValidElement:V,isElement:In,isFragment:mn,findDOMNode:bn,Component:A,PureComponent:X,memo:rn,forwardRef:on,flushSync:En,unstable_batchedUpdates:vn,StrictMode:Cn,Suspense:H,SuspenseList:D,lazy:un,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:pn};const rs=Object.freeze(Object.defineProperty({__proto__:null,Children:sn,Component:A,Fragment:$,PureComponent:X,StrictMode:Cn,Suspense:H,SuspenseList:D,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:pn,cloneElement:wn,createContext:ut,createElement:x,createFactory:gn,createPortal:dn,createRef:dt,default:ns,findDOMNode:bn,flushSync:En,forwardRef:on,hydrate:_n,isElement:In,isFragment:mn,isValidElement:V,lazy:un,memo:rn,render:fn,startTransition:Pe,unmountComponentAtNode:yn,unstable_batchedUpdates:vn,useCallback:at,useContext:ct,useDebugValue:lt,useDeferredValue:Sn,useEffect:me,useErrorBoundary:_r,useId:nt,useImperativeHandle:it,useInsertionEffect:xn,useLayoutEffect:ee,useMemo:st,useReducer:rt,useRef:ot,useState:ge,useSyncExternalStore:Rn,useTransition:kn,version:ts},Symbol.toStringTag,{value:"Module"})),os=et(rs);function Tn(t){return t&&typeof t=="object"&&"default"in t?t.default:t}var E=Ai,On=Tn(dr),is=Tn(Bi),l=os;function ss(t){On.toString(t,{type:"terminal"}).then(console.log)}var as=`:root { --animation-duration: 300ms; } diff --git a/assets/index-wO-A2ttc.js b/assets/index-kEqCFnDY.js similarity index 99% rename from assets/index-wO-A2ttc.js rename to assets/index-kEqCFnDY.js index 0d441bf..7fca626 100644 --- a/assets/index-wO-A2ttc.js +++ b/assets/index-kEqCFnDY.js @@ -1,4 +1,4 @@ -import{n as ve,s as qe,T as k,t as W,a as u,o as Q,R as jr,p as U,y as ne}from"./index-BWemBGvP.js";import{b as Nr}from"./browser-EcNbE0JS.js";import"./index-i7WuWpn4.js";/** +import{n as ve,s as qe,T as k,t as W,a as u,o as Q,R as jr,p as U,y as ne}from"./index-YweLEVJf.js";import{b as Nr}from"./browser-BNgg9dRV.js";import"./index-iGWvbPrT.js";/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause diff --git a/assets/index.es-TVuT00BF.js b/assets/index.es-JhrPxZI8.js similarity index 99% rename from assets/index.es-TVuT00BF.js rename to assets/index.es-JhrPxZI8.js index 4263c7c..eaad01f 100644 --- a/assets/index.es-TVuT00BF.js +++ b/assets/index.es-JhrPxZI8.js @@ -1,4 +1,4 @@ -import{e as K0,r as Fs,f as ie,h as Kr,i as V0,w as Cl,j as Ol,k as gc,t as ga,m as F0,o as ea,p as B0,q as _i,D as G0,s as W0,N as X,u as J0,v as oc,x as Q0,V as Y0,R as X0,F as Sh,K as Z0,y as em,L as tm,z as Ch,$ as rm,A as im,B as Vs,Z as Oh,J as sm,X as nm,E as vc,_ as Rl,C as Dr,G as am,H as om,I as us,M as $t,U as tr,O as wi,P as hr,Q as cm,S as hs,T as Tl,W as um,Y as hm,a0 as lm,a1 as Al,a2 as fm,a3 as Nl,a4 as $l,a5 as ls,a6 as cc,a7 as oa,a8 as fs,a9 as pm,aa as ca,ab as dm,ac as gm,ad as vm,ae as ta,af as ym,ag as mm,ah as Vo,ai as Rh,aj as wm,ak as _m,al as bm,am as Th,an as Em,ao as Im,ap as xm,aq as Pm,ar as Sm,as as Cm,at as Om,au as Us,av as Dl,aw as Fo,ax as Rm,ay as Tm,az as Am}from"./index-i7WuWpn4.js";import{s as Bs,a as va,i as Ah,c as Nm,b as $m,f as yc,p as Dm,J as ni,d as mc,e as wc,g as _c,h as mi,j as si,k as Ks,l as Lm,m as qm,H as Ii}from"./http-gYlq8-dx.js";const zm=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,Mm=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,jm=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function Um(c,i){if(c==="__proto__"||c==="constructor"&&i&&typeof i=="object"&&"prototype"in i){Hm(c);return}return i}function Hm(c){console.warn(`[destr] Dropping "${c}" key to prevent prototype pollution.`)}function ra(c,i={}){if(typeof c!="string")return c;const r=c.trim();if(c[0]==='"'&&c.at(-1)==='"'&&!c.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!jm.test(c)){if(i.strict)throw new SyntaxError("[destr] Invalid JSON");return c}try{if(zm.test(c)||Mm.test(c)){if(i.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(c,Um)}return JSON.parse(c)}catch(n){if(i.strict)throw n;return c}}function km(c){return!c||typeof c.then!="function"?Promise.resolve(c):c}function Ut(c,...i){try{return km(c(...i))}catch(r){return Promise.reject(r)}}function Km(c){const i=typeof c;return c===null||i!=="object"&&i!=="function"}function Vm(c){const i=Object.getPrototypeOf(c);return!i||i.isPrototypeOf(Object)}function ua(c){if(Km(c))return String(c);if(Vm(c)||Array.isArray(c))return JSON.stringify(c);if(typeof c.toJSON=="function")return ua(c.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Ll(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const uc="base64:";function Fm(c){if(typeof c=="string")return c;Ll();const i=Buffer.from(c).toString("base64");return uc+i}function Bm(c){return typeof c!="string"||!c.startsWith(uc)?c:(Ll(),Buffer.from(c.slice(uc.length),"base64"))}function ur(c){return c?c.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function Gm(...c){return ur(c.join(":"))}function ia(c){return c=ur(c),c?c+":":""}const Wm="memory",Jm=()=>{const c=new Map;return{name:Wm,options:{},hasItem(i){return c.has(i)},getItem(i){return c.get(i)??null},getItemRaw(i){return c.get(i)??null},setItem(i,r){c.set(i,r)},setItemRaw(i,r){c.set(i,r)},removeItem(i){c.delete(i)},getKeys(){return Array.from(c.keys())},clear(){c.clear()},dispose(){c.clear()}}};function Qm(c={}){const i={mounts:{"":c.driver||Jm()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=v=>{for(const E of i.mountpoints)if(v.startsWith(E))return{base:E,relativeKey:v.slice(E.length),driver:i.mounts[E]};return{base:"",relativeKey:v,driver:i.mounts[""]}},n=(v,E)=>i.mountpoints.filter(C=>C.startsWith(v)||E&&v.startsWith(C)).map(C=>({relativeBase:v.length>C.length?v.slice(C.length):void 0,mountpoint:C,driver:i.mounts[C]})),a=(v,E)=>{if(i.watching){E=ur(E);for(const C of i.watchListeners)C(v,E)}},l=async()=>{if(!i.watching){i.watching=!0;for(const v in i.mounts)i.unwatch[v]=await Nh(i.mounts[v],a,v)}},d=async()=>{if(i.watching){for(const v in i.unwatch)await i.unwatch[v]();i.unwatch={},i.watching=!1}},y=(v,E,C)=>{const T=new Map,j=D=>{let V=T.get(D.base);return V||(V={driver:D.driver,base:D.base,items:[]},T.set(D.base,V)),V};for(const D of v){const V=typeof D=="string",re=ur(V?D:D.key),ce=V?void 0:D.value,ue=V||!D.options?E:{...E,...D.options},he=r(re);j(he).items.push({key:re,value:ce,relativeKey:he.relativeKey,options:ue})}return Promise.all([...T.values()].map(D=>C(D))).then(D=>D.flat())},w={hasItem(v,E={}){v=ur(v);const{relativeKey:C,driver:T}=r(v);return Ut(T.hasItem,C,E)},getItem(v,E={}){v=ur(v);const{relativeKey:C,driver:T}=r(v);return Ut(T.getItem,C,E).then(j=>ra(j))},getItems(v,E){return y(v,E,C=>C.driver.getItems?Ut(C.driver.getItems,C.items.map(T=>({key:T.relativeKey,options:T.options})),E).then(T=>T.map(j=>({key:Gm(C.base,j.key),value:ra(j.value)}))):Promise.all(C.items.map(T=>Ut(C.driver.getItem,T.relativeKey,T.options).then(j=>({key:T.key,value:ra(j)})))))},getItemRaw(v,E={}){v=ur(v);const{relativeKey:C,driver:T}=r(v);return T.getItemRaw?Ut(T.getItemRaw,C,E):Ut(T.getItem,C,E).then(j=>Bm(j))},async setItem(v,E,C={}){if(E===void 0)return w.removeItem(v);v=ur(v);const{relativeKey:T,driver:j}=r(v);j.setItem&&(await Ut(j.setItem,T,ua(E),C),j.watch||a("update",v))},async setItems(v,E){await y(v,E,async C=>{C.driver.setItems&&await Ut(C.driver.setItems,C.items.map(T=>({key:T.relativeKey,value:ua(T.value),options:T.options})),E),C.driver.setItem&&await Promise.all(C.items.map(T=>Ut(C.driver.setItem,T.relativeKey,ua(T.value),T.options)))})},async setItemRaw(v,E,C={}){if(E===void 0)return w.removeItem(v,C);v=ur(v);const{relativeKey:T,driver:j}=r(v);if(j.setItemRaw)await Ut(j.setItemRaw,T,E,C);else if(j.setItem)await Ut(j.setItem,T,Fm(E),C);else return;j.watch||a("update",v)},async removeItem(v,E={}){typeof E=="boolean"&&(E={removeMeta:E}),v=ur(v);const{relativeKey:C,driver:T}=r(v);T.removeItem&&(await Ut(T.removeItem,C,E),(E.removeMeta||E.removeMata)&&await Ut(T.removeItem,C+"$",E),T.watch||a("remove",v))},async getMeta(v,E={}){typeof E=="boolean"&&(E={nativeOnly:E}),v=ur(v);const{relativeKey:C,driver:T}=r(v),j=Object.create(null);if(T.getMeta&&Object.assign(j,await Ut(T.getMeta,C,E)),!E.nativeOnly){const D=await Ut(T.getItem,C+"$",E).then(V=>ra(V));D&&typeof D=="object"&&(typeof D.atime=="string"&&(D.atime=new Date(D.atime)),typeof D.mtime=="string"&&(D.mtime=new Date(D.mtime)),Object.assign(j,D))}return j},setMeta(v,E,C={}){return this.setItem(v+"$",E,C)},removeMeta(v,E={}){return this.removeItem(v+"$",E)},async getKeys(v,E={}){v=ia(v);const C=n(v,!0);let T=[];const j=[];for(const D of C){const re=(await Ut(D.driver.getKeys,D.relativeBase,E)).map(ce=>D.mountpoint+ur(ce)).filter(ce=>!T.some(ue=>ce.startsWith(ue)));j.push(...re),T=[D.mountpoint,...T.filter(ce=>!ce.startsWith(D.mountpoint))]}return v?j.filter(D=>D.startsWith(v)&&!D.endsWith("$")):j.filter(D=>!D.endsWith("$"))},async clear(v,E={}){v=ia(v),await Promise.all(n(v,!1).map(async C=>{if(C.driver.clear)return Ut(C.driver.clear,C.relativeBase,E);if(C.driver.removeItem){const T=await C.driver.getKeys(C.relativeBase||"",E);return Promise.all(T.map(j=>C.driver.removeItem(j,E)))}}))},async dispose(){await Promise.all(Object.values(i.mounts).map(v=>$h(v)))},async watch(v){return await l(),i.watchListeners.push(v),async()=>{i.watchListeners=i.watchListeners.filter(E=>E!==v),i.watchListeners.length===0&&await d()}},async unwatch(){i.watchListeners=[],await d()},mount(v,E){if(v=ia(v),v&&i.mounts[v])throw new Error(`already mounted at ${v}`);return v&&(i.mountpoints.push(v),i.mountpoints.sort((C,T)=>T.length-C.length)),i.mounts[v]=E,i.watching&&Promise.resolve(Nh(E,a,v)).then(C=>{i.unwatch[v]=C}).catch(console.error),w},async unmount(v,E=!0){v=ia(v),!(!v||!i.mounts[v])&&(i.watching&&v in i.unwatch&&(i.unwatch[v](),delete i.unwatch[v]),E&&await $h(i.mounts[v]),i.mountpoints=i.mountpoints.filter(C=>C!==v),delete i.mounts[v])},getMount(v=""){v=ur(v)+":";const E=r(v);return{driver:E.driver,base:E.base}},getMounts(v="",E={}){return v=ur(v),n(v,E.parents).map(T=>({driver:T.driver,base:T.mountpoint}))}};return w}function Nh(c,i,r){return c.watch?c.watch((n,a)=>i(n,r+a)):()=>{}}async function $h(c){typeof c.dispose=="function"&&await Ut(c.dispose)}function Ui(c){return new Promise((i,r)=>{c.oncomplete=c.onsuccess=()=>i(c.result),c.onabort=c.onerror=()=>r(c.error)})}function ql(c,i){const r=indexedDB.open(c);r.onupgradeneeded=()=>r.result.createObjectStore(i);const n=Ui(r);return(a,l)=>n.then(d=>l(d.transaction(i,a).objectStore(i)))}let Bo;function Gs(){return Bo||(Bo=ql("keyval-store","keyval")),Bo}function Dh(c,i=Gs()){return i("readonly",r=>Ui(r.get(c)))}function Ym(c,i,r=Gs()){return r("readwrite",n=>(n.put(i,c),Ui(n.transaction)))}function Xm(c,i=Gs()){return i("readwrite",r=>(r.delete(c),Ui(r.transaction)))}function Zm(c=Gs()){return c("readwrite",i=>(i.clear(),Ui(i.transaction)))}function ew(c,i){return c.openCursor().onsuccess=function(){this.result&&(i(this.result),this.result.continue())},Ui(c.transaction)}function tw(c=Gs()){return c("readonly",i=>{if(i.getAllKeys)return Ui(i.getAllKeys());const r=[];return ew(i,n=>r.push(n.key)).then(()=>r)})}const rw="idb-keyval";var iw=(c={})=>{const i=c.base&&c.base.length>0?`${c.base}:`:"",r=a=>i+a;let n;return c.dbName&&c.storeName&&(n=ql(c.dbName,c.storeName)),{name:rw,options:c,async hasItem(a){return!(typeof await Dh(r(a),n)>"u")},async getItem(a){return await Dh(r(a),n)??null},setItem(a,l){return Ym(r(a),l,n)},removeItem(a){return Xm(r(a),n)},getKeys(){return tw(n)},clear(){return Zm(n)}}};const sw="WALLET_CONNECT_V2_INDEXED_DB",nw="keyvaluestorage";let aw=class{constructor(){this.indexedDb=Qm({driver:iw({dbName:sw,storeName:nw})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(i=>[i.key,i.value])}async getItem(i){const r=await this.indexedDb.getItem(i);if(r!==null)return r}async setItem(i,r){await this.indexedDb.setItem(i,Bs(r))}async removeItem(i){await this.indexedDb.removeItem(i)}};var Go=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ha={exports:{}};(function(){let c;function i(){}c=i,c.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},c.prototype.setItem=function(r,n){this[r]=String(n)},c.prototype.removeItem=function(r){delete this[r]},c.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},c.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},c.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Go<"u"&&Go.localStorage?ha.exports=Go.localStorage:typeof window<"u"&&window.localStorage?ha.exports=window.localStorage:ha.exports=new i})();function ow(c){var i;return[c[0],va((i=c[1])!=null?i:"")]}let cw=class{constructor(){this.localStorage=ha.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(ow)}async getItem(i){const r=this.localStorage.getItem(i);if(r!==null)return va(r)}async setItem(i,r){this.localStorage.setItem(i,Bs(r))}async removeItem(i){this.localStorage.removeItem(i)}};const uw="wc_storage_version",Lh=1,hw=async(c,i,r)=>{const n=uw,a=await i.getItem(n);if(a&&a>=Lh){r(i);return}const l=await c.getKeys();if(!l.length){r(i);return}const d=[];for(;l.length;){const y=l.shift();if(!y)continue;const w=y.toLowerCase();if(w.includes("wc@")||w.includes("walletconnect")||w.includes("wc_")||w.includes("wallet_connect")){const v=await c.getItem(y);await i.setItem(y,v),d.push(y)}}await i.setItem(n,Lh),r(i),lw(c,d)},lw=async(c,i)=>{i.length&&i.forEach(async r=>{await c.removeItem(r)})};let fw=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const i=new cw;this.storage=i;try{const r=new aw;hw(i,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(i){return await this.initialize(),this.storage.getItem(i)}async setItem(i,r){return await this.initialize(),this.storage.setItem(i,r)}async removeItem(i){return await this.initialize(),this.storage.removeItem(i)}async initialize(){this.initialized||await new Promise(i=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),i())},20)})}};var ps={},$s={},Wo={},Ds={};class Hi{}const pw=Object.freeze(Object.defineProperty({__proto__:null,IEvents:Hi},Symbol.toStringTag,{value:"Module"})),dw=K0(pw);var qh;function gw(){if(qh)return Ds;qh=1,Object.defineProperty(Ds,"__esModule",{value:!0}),Ds.IHeartBeat=void 0;const c=dw;class i extends c.IEvents{constructor(n){super()}}return Ds.IHeartBeat=i,Ds}var zh;function zl(){return zh||(zh=1,function(c){Object.defineProperty(c,"__esModule",{value:!0}),Fs.__exportStar(gw(),c)}(Wo)),Wo}var Jo={},Mi={},Mh;function vw(){if(Mh)return Mi;Mh=1,Object.defineProperty(Mi,"__esModule",{value:!0}),Mi.HEARTBEAT_EVENTS=Mi.HEARTBEAT_INTERVAL=void 0;const c=ie;return Mi.HEARTBEAT_INTERVAL=c.FIVE_SECONDS,Mi.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"},Mi}var jh;function Ml(){return jh||(jh=1,function(c){Object.defineProperty(c,"__esModule",{value:!0}),Fs.__exportStar(vw(),c)}(Jo)),Jo}var Uh;function yw(){if(Uh)return $s;Uh=1,Object.defineProperty($s,"__esModule",{value:!0}),$s.HeartBeat=void 0;const c=Fs,i=Kr,r=ie,n=zl(),a=Ml();class l extends n.IHeartBeat{constructor(y){super(y),this.events=new i.EventEmitter,this.interval=a.HEARTBEAT_INTERVAL,this.interval=(y==null?void 0:y.interval)||a.HEARTBEAT_INTERVAL}static init(y){return c.__awaiter(this,void 0,void 0,function*(){const w=new l(y);return yield w.init(),w})}init(){return c.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(y,w){this.events.on(y,w)}once(y,w){this.events.once(y,w)}off(y,w){this.events.off(y,w)}removeListener(y,w){this.events.removeListener(y,w)}initialize(){return c.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),r.toMiliseconds(this.interval))})}pulse(){this.events.emit(a.HEARTBEAT_EVENTS.pulse)}}return $s.HeartBeat=l,$s}(function(c){Object.defineProperty(c,"__esModule",{value:!0});const i=Fs;i.__exportStar(yw(),c),i.__exportStar(zl(),c),i.__exportStar(Ml(),c)})(ps);var Oe={},Qo,Hh;function mw(){if(Hh)return Qo;Hh=1;function c(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}Qo=i;function i(r,n,a){var l=a&&a.stringify||c,d=1;if(typeof r=="object"&&r!==null){var y=n.length+d;if(y===1)return r;var w=new Array(y);w[0]=l(r);for(var v=1;v-1?j:0,r.charCodeAt(V+1)){case 100:case 102:if(T>=E||n[T]==null)break;j=E||n[T]==null)break;j=E||n[T]===void 0)break;j",j=V+2,V++;break}C+=l(n[T]),j=V+2,V++;break;case 115:if(T>=E)break;j-1&&(Ee=!1);const Re=["error","fatal","warn","info","debug","trace"];typeof W=="function"&&(W.error=W.fatal=W.warn=W.info=W.debug=W.trace=W),$.enabled===!1&&($.level="silent");const et=$.level||"info",R=Object.create(W);R.log||(R.log=re),Object.defineProperty(R,"levelVal",{get:je}),Object.defineProperty(R,"level",{get:Te,set:J});const M={transmit:k,serialize:te,asObject:$.browser.asObject,levels:Re,timestamp:j($)};R.levels=a.levels,R.level=et,R.setMaxListeners=R.getMaxListeners=R.emit=R.addListener=R.on=R.prependListener=R.once=R.prependOnceListener=R.removeListener=R.removeAllListeners=R.listeners=R.listenerCount=R.eventNames=R.write=R.flush=re,R.serializers=ve,R._serialize=te,R._stdErrSerialize=Ee,R.child=F,k&&(R._logEvent=C());function je(){return this.level==="silent"?1/0:this.levels.values[this.level]}function Te(){return this._level}function J(K){if(K!=="silent"&&!this.levels.values[K])throw Error("unknown level "+K);this._level=K,l(M,R,"error","log"),l(M,R,"fatal","error"),l(M,R,"warn","error"),l(M,R,"info","log"),l(M,R,"debug","log"),l(M,R,"trace","log")}function F(K,B){if(!K)throw new Error("missing bindings for child Pino");B=B||{},te&&K.serializers&&(B.serializers=K.serializers);const ut=B.serializers;if(te&&ut){var ke=Object.assign({},ve,ut),Lr=$.browser.serialize===!0?Object.keys(ke):te;delete K.serializers,w([K],Lr,ke,this._stdErrSerialize)}function _e(It){this._childLevel=(It._childLevel|0)+1,this.error=v(It,K,"error"),this.fatal=v(It,K,"fatal"),this.warn=v(It,K,"warn"),this.info=v(It,K,"info"),this.debug=v(It,K,"debug"),this.trace=v(It,K,"trace"),ke&&(this.serializers=ke,this._serialize=Lr),k&&(this._logEvent=C([].concat(It._logEvent.bindings,K)))}return _e.prototype=this,new _e(this)}return R}a.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},a.stdSerializers=r,a.stdTimeFunctions=Object.assign({},{nullTime:ce,epochTime:ue,unixTime:he,isoTime:fe});function l($,k,W,ve){const te=Object.getPrototypeOf(k);k[W]=k.levelVal>k.levels.values[W]?re:te[W]?te[W]:i[W]||i[ve]||re,d($,k,W)}function d($,k,W){!$.transmit&&k[W]===re||(k[W]=function(ve){return function(){const Ee=$.timestamp(),Re=new Array(arguments.length),et=Object.getPrototypeOf&&Object.getPrototypeOf(this)===i?i:this;for(var R=0;R-1&&Ee in W&&($[te][Ee]=W[Ee]($[te][Ee]))}function v($,k,W){return function(){const ve=new Array(1+arguments.length);ve[0]=k;for(var te=1;te"u"?v=r(y,w):v=y.bindings().context||"",v}er.getLoggerContext=a;function l(y,w,v=c.PINO_CUSTOM_CONTEXT_KEY){const E=a(y,v);return E.trim()?`${E}/${w}`:w}er.formatChildLoggerContext=l;function d(y,w,v=c.PINO_CUSTOM_CONTEXT_KEY){const E=l(y,w,v),C=y.child({context:E});return n(C,E,v)}return er.generateChildLogger=d,er}(function(c){Object.defineProperty(c,"__esModule",{value:!0}),c.pino=void 0;const i=Fs,r=i.__importDefault(ww());Object.defineProperty(c,"pino",{enumerable:!0,get:function(){return r.default}}),i.__exportStar(jl(),c),i.__exportStar(_w(),c)})(Oe);class bw extends Hi{constructor(i){super(),this.opts=i,this.protocol="wc",this.version=2}}class Ew extends Hi{constructor(i,r){super(),this.core=i,this.logger=r,this.records=new Map}}class Iw{constructor(i,r){this.logger=i,this.core=r}}let xw=class extends Hi{constructor(i,r){super(),this.relayer=i,this.logger=r}},Pw=class extends Hi{constructor(i){super()}},Sw=class{constructor(i,r,n,a){this.core=i,this.logger=r,this.name=n}};class Cw extends Hi{constructor(i,r){super(),this.relayer=i,this.logger=r}}let Ow=class extends Hi{constructor(i,r){super(),this.core=i,this.logger=r}},Rw=class{constructor(i,r){this.projectId=i,this.logger=r}},Tw=class{constructor(i){this.opts=i,this.protocol="wc",this.version=2}},Aw=class{constructor(i){this.client=i}};var bc={},Ul={};(function(c){Object.defineProperty(c,"__esModule",{value:!0});var i=V0,r=Cl;c.DIGEST_LENGTH=64,c.BLOCK_SIZE=128;var n=function(){function y(){this.digestLength=c.DIGEST_LENGTH,this.blockSize=c.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return y.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},y.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},y.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._tempHi),r.wipe(this._tempLo),this.reset()},y.prototype.update=function(w,v){if(v===void 0&&(v=w.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var E=0;if(this._bytesHashed+=v,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=w[E++],v--;this._bufferLength===this.blockSize&&(l(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(v>=this.blockSize&&(E=l(this._tempHi,this._tempLo,this._stateHi,this._stateLo,w,E,v),v%=this.blockSize);v>0;)this._buffer[this._bufferLength++]=w[E++],v--;return this},y.prototype.finish=function(w){if(!this._finished){var v=this._bytesHashed,E=this._bufferLength,C=v/536870912|0,T=v<<3,j=v%128<112?128:256;this._buffer[E]=128;for(var D=E+1;D0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},y.prototype.restoreState=function(w){return this._stateHi.set(w.stateHi),this._stateLo.set(w.stateLo),this._bufferLength=w.bufferLength,w.buffer&&this._buffer.set(w.buffer),this._bytesHashed=w.bytesHashed,this._finished=!1,this},y.prototype.cleanSavedState=function(w){r.wipe(w.stateHi),r.wipe(w.stateLo),w.buffer&&r.wipe(w.buffer),w.bufferLength=0,w.bytesHashed=0},y}();c.SHA512=n;var a=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function l(y,w,v,E,C,T,j){for(var D=v[0],V=v[1],re=v[2],ce=v[3],ue=v[4],he=v[5],fe=v[6],pe=v[7],$=E[0],k=E[1],W=E[2],ve=E[3],te=E[4],Ee=E[5],Re=E[6],et=E[7],R,M,je,Te,J,F,K,B;j>=128;){for(var ut=0;ut<16;ut++){var ke=8*ut+T;y[ut]=i.readUint32BE(C,ke),w[ut]=i.readUint32BE(C,ke+4)}for(var ut=0;ut<80;ut++){var Lr=D,_e=V,It=re,N=ce,A=ue,S=he,u=fe,b=pe,Z=$,oe=k,me=W,Ae=ve,$e=te,xe=Ee,xt=Re,mt=et;if(R=pe,M=et,J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=(ue>>>14|te<<18)^(ue>>>18|te<<14)^(te>>>9|ue<<23),M=(te>>>14|ue<<18)^(te>>>18|ue<<14)^(ue>>>9|te<<23),J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,R=ue&he^~ue&fe,M=te&Ee^~te&Re,J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,R=a[ut*2],M=a[ut*2+1],J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,R=y[ut%16],M=w[ut%16],J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,je=K&65535|B<<16,Te=J&65535|F<<16,R=je,M=Te,J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=(D>>>28|$<<4)^($>>>2|D<<30)^($>>>7|D<<25),M=($>>>28|D<<4)^(D>>>2|$<<30)^(D>>>7|$<<25),J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,R=D&V^D&re^V&re,M=$&k^$&W^k&W,J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,b=K&65535|B<<16,mt=J&65535|F<<16,R=N,M=Ae,J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=je,M=Te,J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,N=K&65535|B<<16,Ae=J&65535|F<<16,V=Lr,re=_e,ce=It,ue=N,he=A,fe=S,pe=u,D=b,k=Z,W=oe,ve=me,te=Ae,Ee=$e,Re=xe,et=xt,$=mt,ut%16===15)for(var ke=0;ke<16;ke++)R=y[ke],M=w[ke],J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=y[(ke+9)%16],M=w[(ke+9)%16],J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,je=y[(ke+1)%16],Te=w[(ke+1)%16],R=(je>>>1|Te<<31)^(je>>>8|Te<<24)^je>>>7,M=(Te>>>1|je<<31)^(Te>>>8|je<<24)^(Te>>>7|je<<25),J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,je=y[(ke+14)%16],Te=w[(ke+14)%16],R=(je>>>19|Te<<13)^(Te>>>29|je<<3)^je>>>6,M=(Te>>>19|je<<13)^(je>>>29|Te<<3)^(Te>>>6|je<<26),J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,y[ke]=K&65535|B<<16,w[ke]=J&65535|F<<16}R=D,M=$,J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=v[0],M=E[0],J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,v[0]=D=K&65535|B<<16,E[0]=$=J&65535|F<<16,R=V,M=k,J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=v[1],M=E[1],J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,v[1]=V=K&65535|B<<16,E[1]=k=J&65535|F<<16,R=re,M=W,J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=v[2],M=E[2],J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,v[2]=re=K&65535|B<<16,E[2]=W=J&65535|F<<16,R=ce,M=ve,J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=v[3],M=E[3],J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,v[3]=ce=K&65535|B<<16,E[3]=ve=J&65535|F<<16,R=ue,M=te,J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=v[4],M=E[4],J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,v[4]=ue=K&65535|B<<16,E[4]=te=J&65535|F<<16,R=he,M=Ee,J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=v[5],M=E[5],J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,v[5]=he=K&65535|B<<16,E[5]=Ee=J&65535|F<<16,R=fe,M=Re,J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=v[6],M=E[6],J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,v[6]=fe=K&65535|B<<16,E[6]=Re=J&65535|F<<16,R=pe,M=et,J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=v[7],M=E[7],J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,v[7]=pe=K&65535|B<<16,E[7]=et=J&65535|F<<16,T+=128,j-=128}return T}function d(y){var w=new n;w.update(y);var v=w.digest();return w.clean(),v}c.hash=d})(Ul);(function(c){Object.defineProperty(c,"__esModule",{value:!0}),c.convertSecretKeyToX25519=c.convertPublicKeyToX25519=c.verify=c.sign=c.extractPublicKeyFromSecretKey=c.generateKeyPair=c.generateKeyPairFromSeed=c.SEED_LENGTH=c.SECRET_KEY_LENGTH=c.PUBLIC_KEY_LENGTH=c.SIGNATURE_LENGTH=void 0;const i=Ol,r=Ul,n=Cl;c.SIGNATURE_LENGTH=64,c.PUBLIC_KEY_LENGTH=32,c.SECRET_KEY_LENGTH=64,c.SEED_LENGTH=32;function a(N){const A=new Float64Array(16);if(N)for(let S=0;S>16&1),S[oe-1]&=65535;S[15]=u[15]-32767-(S[14]>>16&1);const Z=S[15]>>16&1;S[14]&=65535,V(u,S,1-Z)}for(let b=0;b<16;b++)N[2*b]=u[b]&255,N[2*b+1]=u[b]>>8}function ce(N,A){let S=0;for(let u=0;u<32;u++)S|=N[u]^A[u];return(1&S-1>>>8)-1}function ue(N,A){const S=new Uint8Array(32),u=new Uint8Array(32);return re(S,N),re(u,A),ce(S,u)}function he(N){const A=new Uint8Array(32);return re(A,N),A[0]&1}function fe(N,A){for(let S=0;S<16;S++)N[S]=A[2*S]+(A[2*S+1]<<8);N[15]&=32767}function pe(N,A,S){for(let u=0;u<16;u++)N[u]=A[u]+S[u]}function $(N,A,S){for(let u=0;u<16;u++)N[u]=A[u]-S[u]}function k(N,A,S){let u,b,Z=0,oe=0,me=0,Ae=0,$e=0,xe=0,xt=0,mt=0,nt=0,Le=0,Je=0,Qe=0,at=0,Ue=0,Ye=0,Ne=0,Ke=0,ht=0,ze=0,Pt=0,Dt=0,Ht=0,kt=0,zt=0,Wt=0,rr=0,qr=0,Jt=0,Vr=0,oi=0,xi=0,lt=S[0],tt=S[1],ft=S[2],pt=S[3],ot=S[4],rt=S[5],St=S[6],Ct=S[7],dt=S[8],Ot=S[9],gt=S[10],wt=S[11],vt=S[12],We=S[13],Rt=S[14],Tt=S[15];u=A[0],Z+=u*lt,oe+=u*tt,me+=u*ft,Ae+=u*pt,$e+=u*ot,xe+=u*rt,xt+=u*St,mt+=u*Ct,nt+=u*dt,Le+=u*Ot,Je+=u*gt,Qe+=u*wt,at+=u*vt,Ue+=u*We,Ye+=u*Rt,Ne+=u*Tt,u=A[1],oe+=u*lt,me+=u*tt,Ae+=u*ft,$e+=u*pt,xe+=u*ot,xt+=u*rt,mt+=u*St,nt+=u*Ct,Le+=u*dt,Je+=u*Ot,Qe+=u*gt,at+=u*wt,Ue+=u*vt,Ye+=u*We,Ne+=u*Rt,Ke+=u*Tt,u=A[2],me+=u*lt,Ae+=u*tt,$e+=u*ft,xe+=u*pt,xt+=u*ot,mt+=u*rt,nt+=u*St,Le+=u*Ct,Je+=u*dt,Qe+=u*Ot,at+=u*gt,Ue+=u*wt,Ye+=u*vt,Ne+=u*We,Ke+=u*Rt,ht+=u*Tt,u=A[3],Ae+=u*lt,$e+=u*tt,xe+=u*ft,xt+=u*pt,mt+=u*ot,nt+=u*rt,Le+=u*St,Je+=u*Ct,Qe+=u*dt,at+=u*Ot,Ue+=u*gt,Ye+=u*wt,Ne+=u*vt,Ke+=u*We,ht+=u*Rt,ze+=u*Tt,u=A[4],$e+=u*lt,xe+=u*tt,xt+=u*ft,mt+=u*pt,nt+=u*ot,Le+=u*rt,Je+=u*St,Qe+=u*Ct,at+=u*dt,Ue+=u*Ot,Ye+=u*gt,Ne+=u*wt,Ke+=u*vt,ht+=u*We,ze+=u*Rt,Pt+=u*Tt,u=A[5],xe+=u*lt,xt+=u*tt,mt+=u*ft,nt+=u*pt,Le+=u*ot,Je+=u*rt,Qe+=u*St,at+=u*Ct,Ue+=u*dt,Ye+=u*Ot,Ne+=u*gt,Ke+=u*wt,ht+=u*vt,ze+=u*We,Pt+=u*Rt,Dt+=u*Tt,u=A[6],xt+=u*lt,mt+=u*tt,nt+=u*ft,Le+=u*pt,Je+=u*ot,Qe+=u*rt,at+=u*St,Ue+=u*Ct,Ye+=u*dt,Ne+=u*Ot,Ke+=u*gt,ht+=u*wt,ze+=u*vt,Pt+=u*We,Dt+=u*Rt,Ht+=u*Tt,u=A[7],mt+=u*lt,nt+=u*tt,Le+=u*ft,Je+=u*pt,Qe+=u*ot,at+=u*rt,Ue+=u*St,Ye+=u*Ct,Ne+=u*dt,Ke+=u*Ot,ht+=u*gt,ze+=u*wt,Pt+=u*vt,Dt+=u*We,Ht+=u*Rt,kt+=u*Tt,u=A[8],nt+=u*lt,Le+=u*tt,Je+=u*ft,Qe+=u*pt,at+=u*ot,Ue+=u*rt,Ye+=u*St,Ne+=u*Ct,Ke+=u*dt,ht+=u*Ot,ze+=u*gt,Pt+=u*wt,Dt+=u*vt,Ht+=u*We,kt+=u*Rt,zt+=u*Tt,u=A[9],Le+=u*lt,Je+=u*tt,Qe+=u*ft,at+=u*pt,Ue+=u*ot,Ye+=u*rt,Ne+=u*St,Ke+=u*Ct,ht+=u*dt,ze+=u*Ot,Pt+=u*gt,Dt+=u*wt,Ht+=u*vt,kt+=u*We,zt+=u*Rt,Wt+=u*Tt,u=A[10],Je+=u*lt,Qe+=u*tt,at+=u*ft,Ue+=u*pt,Ye+=u*ot,Ne+=u*rt,Ke+=u*St,ht+=u*Ct,ze+=u*dt,Pt+=u*Ot,Dt+=u*gt,Ht+=u*wt,kt+=u*vt,zt+=u*We,Wt+=u*Rt,rr+=u*Tt,u=A[11],Qe+=u*lt,at+=u*tt,Ue+=u*ft,Ye+=u*pt,Ne+=u*ot,Ke+=u*rt,ht+=u*St,ze+=u*Ct,Pt+=u*dt,Dt+=u*Ot,Ht+=u*gt,kt+=u*wt,zt+=u*vt,Wt+=u*We,rr+=u*Rt,qr+=u*Tt,u=A[12],at+=u*lt,Ue+=u*tt,Ye+=u*ft,Ne+=u*pt,Ke+=u*ot,ht+=u*rt,ze+=u*St,Pt+=u*Ct,Dt+=u*dt,Ht+=u*Ot,kt+=u*gt,zt+=u*wt,Wt+=u*vt,rr+=u*We,qr+=u*Rt,Jt+=u*Tt,u=A[13],Ue+=u*lt,Ye+=u*tt,Ne+=u*ft,Ke+=u*pt,ht+=u*ot,ze+=u*rt,Pt+=u*St,Dt+=u*Ct,Ht+=u*dt,kt+=u*Ot,zt+=u*gt,Wt+=u*wt,rr+=u*vt,qr+=u*We,Jt+=u*Rt,Vr+=u*Tt,u=A[14],Ye+=u*lt,Ne+=u*tt,Ke+=u*ft,ht+=u*pt,ze+=u*ot,Pt+=u*rt,Dt+=u*St,Ht+=u*Ct,kt+=u*dt,zt+=u*Ot,Wt+=u*gt,rr+=u*wt,qr+=u*vt,Jt+=u*We,Vr+=u*Rt,oi+=u*Tt,u=A[15],Ne+=u*lt,Ke+=u*tt,ht+=u*ft,ze+=u*pt,Pt+=u*ot,Dt+=u*rt,Ht+=u*St,kt+=u*Ct,zt+=u*dt,Wt+=u*Ot,rr+=u*gt,qr+=u*wt,Jt+=u*vt,Vr+=u*We,oi+=u*Rt,xi+=u*Tt,Z+=38*Ke,oe+=38*ht,me+=38*ze,Ae+=38*Pt,$e+=38*Dt,xe+=38*Ht,xt+=38*kt,mt+=38*zt,nt+=38*Wt,Le+=38*rr,Je+=38*qr,Qe+=38*Jt,at+=38*Vr,Ue+=38*oi,Ye+=38*xi,b=1,u=Z+b+65535,b=Math.floor(u/65536),Z=u-b*65536,u=oe+b+65535,b=Math.floor(u/65536),oe=u-b*65536,u=me+b+65535,b=Math.floor(u/65536),me=u-b*65536,u=Ae+b+65535,b=Math.floor(u/65536),Ae=u-b*65536,u=$e+b+65535,b=Math.floor(u/65536),$e=u-b*65536,u=xe+b+65535,b=Math.floor(u/65536),xe=u-b*65536,u=xt+b+65535,b=Math.floor(u/65536),xt=u-b*65536,u=mt+b+65535,b=Math.floor(u/65536),mt=u-b*65536,u=nt+b+65535,b=Math.floor(u/65536),nt=u-b*65536,u=Le+b+65535,b=Math.floor(u/65536),Le=u-b*65536,u=Je+b+65535,b=Math.floor(u/65536),Je=u-b*65536,u=Qe+b+65535,b=Math.floor(u/65536),Qe=u-b*65536,u=at+b+65535,b=Math.floor(u/65536),at=u-b*65536,u=Ue+b+65535,b=Math.floor(u/65536),Ue=u-b*65536,u=Ye+b+65535,b=Math.floor(u/65536),Ye=u-b*65536,u=Ne+b+65535,b=Math.floor(u/65536),Ne=u-b*65536,Z+=b-1+37*(b-1),b=1,u=Z+b+65535,b=Math.floor(u/65536),Z=u-b*65536,u=oe+b+65535,b=Math.floor(u/65536),oe=u-b*65536,u=me+b+65535,b=Math.floor(u/65536),me=u-b*65536,u=Ae+b+65535,b=Math.floor(u/65536),Ae=u-b*65536,u=$e+b+65535,b=Math.floor(u/65536),$e=u-b*65536,u=xe+b+65535,b=Math.floor(u/65536),xe=u-b*65536,u=xt+b+65535,b=Math.floor(u/65536),xt=u-b*65536,u=mt+b+65535,b=Math.floor(u/65536),mt=u-b*65536,u=nt+b+65535,b=Math.floor(u/65536),nt=u-b*65536,u=Le+b+65535,b=Math.floor(u/65536),Le=u-b*65536,u=Je+b+65535,b=Math.floor(u/65536),Je=u-b*65536,u=Qe+b+65535,b=Math.floor(u/65536),Qe=u-b*65536,u=at+b+65535,b=Math.floor(u/65536),at=u-b*65536,u=Ue+b+65535,b=Math.floor(u/65536),Ue=u-b*65536,u=Ye+b+65535,b=Math.floor(u/65536),Ye=u-b*65536,u=Ne+b+65535,b=Math.floor(u/65536),Ne=u-b*65536,Z+=b-1+37*(b-1),N[0]=Z,N[1]=oe,N[2]=me,N[3]=Ae,N[4]=$e,N[5]=xe,N[6]=xt,N[7]=mt,N[8]=nt,N[9]=Le,N[10]=Je,N[11]=Qe,N[12]=at,N[13]=Ue,N[14]=Ye,N[15]=Ne}function W(N,A){k(N,A,A)}function ve(N,A){const S=a();let u;for(u=0;u<16;u++)S[u]=A[u];for(u=253;u>=0;u--)W(S,S),u!==2&&u!==4&&k(S,S,A);for(u=0;u<16;u++)N[u]=S[u]}function te(N,A){const S=a();let u;for(u=0;u<16;u++)S[u]=A[u];for(u=250;u>=0;u--)W(S,S),u!==1&&k(S,S,A);for(u=0;u<16;u++)N[u]=S[u]}function Ee(N,A){const S=a(),u=a(),b=a(),Z=a(),oe=a(),me=a(),Ae=a(),$e=a(),xe=a();$(S,N[1],N[0]),$(xe,A[1],A[0]),k(S,S,xe),pe(u,N[0],N[1]),pe(xe,A[0],A[1]),k(u,u,xe),k(b,N[3],A[3]),k(b,b,v),k(Z,N[2],A[2]),pe(Z,Z,Z),$(oe,u,S),$(me,Z,b),pe(Ae,Z,b),pe($e,u,S),k(N[0],oe,me),k(N[1],$e,Ae),k(N[2],Ae,me),k(N[3],oe,$e)}function Re(N,A,S){for(let u=0;u<4;u++)V(N[u],A[u],S)}function et(N,A){const S=a(),u=a(),b=a();ve(b,A[2]),k(S,A[0],b),k(u,A[1],b),re(N,u),N[31]^=he(S)<<7}function R(N,A,S){j(N[0],d),j(N[1],y),j(N[2],y),j(N[3],d);for(let u=255;u>=0;--u){const b=S[u/8|0]>>(u&7)&1;Re(N,A,b),Ee(A,N),Ee(N,N),Re(N,A,b)}}function M(N,A){const S=[a(),a(),a(),a()];j(S[0],E),j(S[1],C),j(S[2],y),k(S[3],E,C),R(N,S,A)}function je(N){if(N.length!==c.SEED_LENGTH)throw new Error(`ed25519: seed must be ${c.SEED_LENGTH} bytes`);const A=(0,r.hash)(N);A[0]&=248,A[31]&=127,A[31]|=64;const S=new Uint8Array(32),u=[a(),a(),a(),a()];M(u,A),et(S,u);const b=new Uint8Array(64);return b.set(N),b.set(S,32),{publicKey:S,secretKey:b}}c.generateKeyPairFromSeed=je;function Te(N){const A=(0,i.randomBytes)(32,N),S=je(A);return(0,n.wipe)(A),S}c.generateKeyPair=Te;function J(N){if(N.length!==c.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${c.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(N.subarray(32))}c.extractPublicKeyFromSecretKey=J;const F=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function K(N,A){let S,u,b,Z;for(u=63;u>=32;--u){for(S=0,b=u-32,Z=u-12;b>4)*F[b],S=A[b]>>8,A[b]&=255;for(b=0;b<32;b++)A[b]-=S*F[b];for(u=0;u<32;u++)A[u+1]+=A[u]>>8,N[u]=A[u]&255}function B(N){const A=new Float64Array(64);for(let S=0;S<64;S++)A[S]=N[S];for(let S=0;S<64;S++)N[S]=0;K(N,A)}function ut(N,A){const S=new Float64Array(64),u=[a(),a(),a(),a()],b=(0,r.hash)(N.subarray(0,32));b[0]&=248,b[31]&=127,b[31]|=64;const Z=new Uint8Array(64);Z.set(b.subarray(32),32);const oe=new r.SHA512;oe.update(Z.subarray(32)),oe.update(A);const me=oe.digest();oe.clean(),B(me),M(u,me),et(Z,u),oe.reset(),oe.update(Z.subarray(0,32)),oe.update(N.subarray(32)),oe.update(A);const Ae=oe.digest();B(Ae);for(let $e=0;$e<32;$e++)S[$e]=me[$e];for(let $e=0;$e<32;$e++)for(let xe=0;xe<32;xe++)S[$e+xe]+=Ae[$e]*b[xe];return K(Z.subarray(32),S),Z}c.sign=ut;function ke(N,A){const S=a(),u=a(),b=a(),Z=a(),oe=a(),me=a(),Ae=a();return j(N[2],y),fe(N[1],A),W(b,N[1]),k(Z,b,w),$(b,b,N[2]),pe(Z,N[2],Z),W(oe,Z),W(me,oe),k(Ae,me,oe),k(S,Ae,b),k(S,S,Z),te(S,S),k(S,S,b),k(S,S,Z),k(S,S,Z),k(N[0],S,Z),W(u,N[0]),k(u,u,Z),ue(u,b)&&k(N[0],N[0],T),W(u,N[0]),k(u,u,Z),ue(u,b)?-1:(he(N[0])===A[31]>>7&&$(N[0],d,N[0]),k(N[3],N[0],N[1]),0)}function Lr(N,A,S){const u=new Uint8Array(32),b=[a(),a(),a(),a()],Z=[a(),a(),a(),a()];if(S.length!==c.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${c.SIGNATURE_LENGTH} bytes`);if(ke(Z,N))return!1;const oe=new r.SHA512;oe.update(S.subarray(0,32)),oe.update(N),oe.update(A);const me=oe.digest();return B(me),R(b,Z,me),M(Z,S.subarray(32)),Ee(b,Z),et(u,b),!ce(S,u)}c.verify=Lr;function _e(N){let A=[a(),a(),a(),a()];if(ke(A,N))throw new Error("Ed25519: invalid public key");let S=a(),u=a(),b=A[1];pe(S,y,b),$(u,y,b),ve(u,u),k(S,S,u);let Z=new Uint8Array(32);return re(Z,S),Z}c.convertPublicKeyToX25519=_e;function It(N){const A=(0,r.hash)(N.subarray(0,32));A[0]&=248,A[31]&=127,A[31]|=64;const S=new Uint8Array(A.subarray(0,32));return(0,n.wipe)(A),S}c.convertSecretKeyToX25519=It})(bc);const Nw="EdDSA",$w="JWT",Hl=".",kl="base64url",Dw="utf8",Lw="utf8",qw=":",zw="did",Mw="key",Fh="base58btc",jw="z",Uw="K36",Hw=32;function fa(c){return ga(gc(Bs(c),Dw),kl)}function Kl(c){const i=gc(Uw,Fh),r=jw+ga(F0([i,c]),Fh);return[zw,Mw,r].join(qw)}function kw(c){return ga(c,kl)}function Kw(c){return gc([fa(c.header),fa(c.payload)].join(Hl),Lw)}function Vw(c){return[fa(c.header),fa(c.payload),kw(c.signature)].join(Hl)}function Bh(c=Ol.randomBytes(Hw)){return bc.generateKeyPairFromSeed(c)}async function Fw(c,i,r,n,a=ie.fromMiliseconds(Date.now())){const l={alg:Nw,typ:$w},d=Kl(n.publicKey),y=a+r,w={iss:d,sub:c,aud:i,iat:a,exp:y},v=Kw({header:l,payload:w}),E=bc.sign(n.secretKey,v);return Vw({header:l,payload:w,signature:E})}const Bw=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),Gw=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",Gh=c=>c.split("?")[0],Wh=10,Ww=Bw();class Jw{constructor(i){if(this.url=i,this.events=new Kr.EventEmitter,this.registering=!1,!Ah(i))throw new Error(`Provided URL is not compatible with WebSocket connection: ${i}`);this.url=i}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(i,r){this.events.on(i,r)}once(i,r){this.events.once(i,r)}off(i,r){this.events.off(i,r)}removeListener(i,r){this.events.removeListener(i,r)}async open(i=this.url){await this.register(i)}async close(){return new Promise((i,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),i()},this.socket.close()})}async send(i,r){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Bs(i))}catch(n){this.onError(i.id,n)}}register(i=this.url){if(!Ah(i))throw new Error(`Provided URL is not compatible with WebSocket connection: ${i}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,a)=>{this.events.once("register_error",l=>{this.resetMaxListeners(),a(l)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return a(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=i,this.registering=!0,new Promise((r,n)=>{const a=Nm.isReactNative()?void 0:{rejectUnauthorized:!$m(i)},l=new Ww(i,[],a);Gw()?l.onerror=d=>{const y=d;n(this.emitError(y.error))}:l.on("error",d=>{n(this.emitError(d))}),l.onopen=()=>{this.onOpen(l),r(l)}})}onOpen(i){i.onmessage=r=>this.onPayload(r),i.onclose=r=>this.onClose(r),this.socket=i,this.registering=!1,this.events.emit("open")}onClose(i){this.socket=void 0,this.registering=!1,this.events.emit("close",i)}onPayload(i){if(typeof i.data>"u")return;const r=typeof i.data=="string"?va(i.data):i.data;this.events.emit("payload",r)}onError(i,r){const n=this.parseError(r),a=n.message||n.toString(),l=yc(i,a);this.events.emit("payload",l)}parseError(i,r=this.url){return Dm(i,Gh(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>Wh&&this.events.setMaxListeners(Wh)}emitError(i){const r=this.parseError(new Error((i==null?void 0:i.message)||`WebSocket connection failed for host: ${Gh(this.url)}`));return this.events.emit("register_error",r),r}}var pa={exports:{}};pa.exports;(function(c,i){var r=200,n="__lodash_hash_undefined__",a=1,l=2,d=9007199254740991,y="[object Arguments]",w="[object Array]",v="[object AsyncFunction]",E="[object Boolean]",C="[object Date]",T="[object Error]",j="[object Function]",D="[object GeneratorFunction]",V="[object Map]",re="[object Number]",ce="[object Null]",ue="[object Object]",he="[object Promise]",fe="[object Proxy]",pe="[object RegExp]",$="[object Set]",k="[object String]",W="[object Symbol]",ve="[object Undefined]",te="[object WeakMap]",Ee="[object ArrayBuffer]",Re="[object DataView]",et="[object Float32Array]",R="[object Float64Array]",M="[object Int8Array]",je="[object Int16Array]",Te="[object Int32Array]",J="[object Uint8Array]",F="[object Uint8ClampedArray]",K="[object Uint16Array]",B="[object Uint32Array]",ut=/[\\^$.*+?()[\]{}|]/g,ke=/^\[object .+?Constructor\]$/,Lr=/^(?:0|[1-9]\d*)$/,_e={};_e[et]=_e[R]=_e[M]=_e[je]=_e[Te]=_e[J]=_e[F]=_e[K]=_e[B]=!0,_e[y]=_e[w]=_e[Ee]=_e[E]=_e[Re]=_e[C]=_e[T]=_e[j]=_e[V]=_e[re]=_e[ue]=_e[pe]=_e[$]=_e[k]=_e[te]=!1;var It=typeof ea=="object"&&ea&&ea.Object===Object&&ea,N=typeof self=="object"&&self&&self.Object===Object&&self,A=It||N||Function("return this")(),S=i&&!i.nodeType&&i,u=S&&!0&&c&&!c.nodeType&&c,b=u&&u.exports===S,Z=b&&It.process,oe=function(){try{return Z&&Z.binding&&Z.binding("util")}catch{}}(),me=oe&&oe.isTypedArray;function Ae(g,I){for(var U=-1,Q=g==null?0:g.length,Fe=0,de=[];++U-1}function Sa(g,I){var U=this.__data__,Q=Pi(U,g);return Q<0?(++this.size,U.push([g,I])):U[Q][1]=I,this}yr.prototype.clear=Ea,yr.prototype.delete=Ia,yr.prototype.get=xa,yr.prototype.has=Pa,yr.prototype.set=Sa;function Fr(g){var I=-1,U=g==null?0:g.length;for(this.clear();++IAt))return!1;var Be=de.get(g);if(Be&&de.get(I))return Be==I;var _t=-1,ir=!0,Nt=U&l?new Fi:void 0;for(de.set(g,I),de.set(I,g);++_t-1&&g%1==0&&g-1&&g%1==0&&g<=d}function pn(g){var I=typeof g;return g!=null&&(I=="object"||I=="function")}function Oi(g){return g!=null&&typeof g=="object"}var dn=me?mt(me):en;function ja(g){return za(g)?Xs(g):tn(g)}function Ve(){return[]}function He(){return!1}c.exports=Ma})(pa,pa.exports);var Qw=pa.exports;const Yw=B0(Qw);var Xw={};function Zw(c,i){if(c.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,fe=new Uint8Array(he);ce!==ue;){for(var pe=D[ce],$=0,k=he-1;(pe!==0||$>>0,fe[k]=pe%y>>>0,pe=pe/y>>>0;if(pe!==0)throw new Error("Non-zero carry");re=$,ce++}for(var W=he-re;W!==he&&fe[W]===0;)W++;for(var ve=w.repeat(V);W>>0,he=new Uint8Array(ue);D[V];){var fe=r[D.charCodeAt(V)];if(fe===255)return;for(var pe=0,$=ue-1;(fe!==0||pe>>0,he[$]=fe%256>>>0,fe=fe/256>>>0;if(fe!==0)throw new Error("Non-zero carry");ce=pe,V++}if(D[V]!==" "){for(var k=ue-ce;k!==ue&&he[k]===0;)k++;for(var W=new Uint8Array(re+(ue-k)),ve=re;k!==ue;)W[ve++]=he[k++];return W}}}function j(D){var V=T(D);if(V)return V;throw new Error(`Non-${i} character`)}return{encode:C,decodeUnsafe:T,decode:j}}var e_=Zw,t_=e_;const Vl=c=>{if(c instanceof Uint8Array&&c.constructor.name==="Uint8Array")return c;if(c instanceof ArrayBuffer)return new Uint8Array(c);if(ArrayBuffer.isView(c))return new Uint8Array(c.buffer,c.byteOffset,c.byteLength);throw new Error("Unknown type, must be binary type")},r_=c=>new TextEncoder().encode(c),i_=c=>new TextDecoder().decode(c);class s_{constructor(i,r,n){this.name=i,this.prefix=r,this.baseEncode=n}encode(i){if(i instanceof Uint8Array)return`${this.prefix}${this.baseEncode(i)}`;throw Error("Unknown type, must be binary type")}}class n_{constructor(i,r,n){if(this.name=i,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(i){if(typeof i=="string"){if(i.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(i)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(i.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(i){return Fl(this,i)}}class a_{constructor(i){this.decoders=i}or(i){return Fl(this,i)}decode(i){const r=i[0],n=this.decoders[r];if(n)return n.decode(i);throw RangeError(`Unable to decode multibase string ${JSON.stringify(i)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Fl=(c,i)=>new a_({...c.decoders||{[c.prefix]:c},...i.decoders||{[i.prefix]:i}});class o_{constructor(i,r,n,a){this.name=i,this.prefix=r,this.baseEncode=n,this.baseDecode=a,this.encoder=new s_(i,r,n),this.decoder=new n_(i,r,a)}encode(i){return this.encoder.encode(i)}decode(i){return this.decoder.decode(i)}}const ya=({name:c,prefix:i,encode:r,decode:n})=>new o_(c,i,r,n),Ws=({prefix:c,name:i,alphabet:r})=>{const{encode:n,decode:a}=t_(r,i);return ya({prefix:c,name:i,encode:n,decode:l=>Vl(a(l))})},c_=(c,i,r,n)=>{const a={};for(let E=0;E=8&&(y-=8,d[v++]=255&w>>y)}if(y>=r||255&w<<8-y)throw new SyntaxError("Unexpected end of data");return d},u_=(c,i,r)=>{const n=i[i.length-1]==="=",a=(1<r;)d-=r,l+=i[a&y>>d];if(d&&(l+=i[a&y<ya({prefix:i,name:c,encode(a){return u_(a,n,r)},decode(a){return c_(a,n,r,c)}}),h_=ya({prefix:"\0",name:"identity",encode:c=>i_(c),decode:c=>r_(c)});var l_=Object.freeze({__proto__:null,identity:h_});const f_=Vt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var p_=Object.freeze({__proto__:null,base2:f_});const d_=Vt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var g_=Object.freeze({__proto__:null,base8:d_});const v_=Ws({prefix:"9",name:"base10",alphabet:"0123456789"});var y_=Object.freeze({__proto__:null,base10:v_});const m_=Vt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),w_=Vt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var __=Object.freeze({__proto__:null,base16:m_,base16upper:w_});const b_=Vt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),E_=Vt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),I_=Vt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),x_=Vt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),P_=Vt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),S_=Vt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),C_=Vt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),O_=Vt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),R_=Vt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var T_=Object.freeze({__proto__:null,base32:b_,base32upper:E_,base32pad:I_,base32padupper:x_,base32hex:P_,base32hexupper:S_,base32hexpad:C_,base32hexpadupper:O_,base32z:R_});const A_=Ws({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),N_=Ws({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var $_=Object.freeze({__proto__:null,base36:A_,base36upper:N_});const D_=Ws({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),L_=Ws({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var q_=Object.freeze({__proto__:null,base58btc:D_,base58flickr:L_});const z_=Vt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),M_=Vt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),j_=Vt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),U_=Vt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var H_=Object.freeze({__proto__:null,base64:z_,base64pad:M_,base64url:j_,base64urlpad:U_});const Bl=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),k_=Bl.reduce((c,i,r)=>(c[r]=i,c),[]),K_=Bl.reduce((c,i,r)=>(c[i.codePointAt(0)]=r,c),[]);function V_(c){return c.reduce((i,r)=>(i+=k_[r],i),"")}function F_(c){const i=[];for(const r of c){const n=K_[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);i.push(n)}return new Uint8Array(i)}const B_=ya({prefix:"🚀",name:"base256emoji",encode:V_,decode:F_});var G_=Object.freeze({__proto__:null,base256emoji:B_}),W_=Gl,Jh=128,J_=127,Q_=~J_,Y_=Math.pow(2,31);function Gl(c,i,r){i=i||[],r=r||0;for(var n=r;c>=Y_;)i[r++]=c&255|Jh,c/=128;for(;c&Q_;)i[r++]=c&255|Jh,c>>>=7;return i[r]=c|0,Gl.bytes=r-n+1,i}var X_=hc,Z_=128,Qh=127;function hc(c,n){var r=0,n=n||0,a=0,l=n,d,y=c.length;do{if(l>=y)throw hc.bytes=0,new RangeError("Could not decode varint");d=c[l++],r+=a<28?(d&Qh)<=Z_);return hc.bytes=l-n,r}var e1=Math.pow(2,7),t1=Math.pow(2,14),r1=Math.pow(2,21),i1=Math.pow(2,28),s1=Math.pow(2,35),n1=Math.pow(2,42),a1=Math.pow(2,49),o1=Math.pow(2,56),c1=Math.pow(2,63),u1=function(c){return c(Wl.encode(c,i,r),i),Xh=c=>Wl.encodingLength(c),lc=(c,i)=>{const r=i.byteLength,n=Xh(c),a=n+Xh(r),l=new Uint8Array(a+r);return Yh(c,l,0),Yh(r,l,n),l.set(i,a),new l1(c,r,i,l)};class l1{constructor(i,r,n,a){this.code=i,this.size=r,this.digest=n,this.bytes=a}}const Jl=({name:c,code:i,encode:r})=>new f1(c,i,r);class f1{constructor(i,r,n){this.name=i,this.code=r,this.encode=n}digest(i){if(i instanceof Uint8Array){const r=this.encode(i);return r instanceof Uint8Array?lc(this.code,r):r.then(n=>lc(this.code,n))}else throw Error("Unknown type, must be binary type")}}const Ql=c=>async i=>new Uint8Array(await crypto.subtle.digest(c,i)),p1=Jl({name:"sha2-256",code:18,encode:Ql("SHA-256")}),d1=Jl({name:"sha2-512",code:19,encode:Ql("SHA-512")});var g1=Object.freeze({__proto__:null,sha256:p1,sha512:d1});const Yl=0,v1="identity",Xl=Vl,y1=c=>lc(Yl,Xl(c)),m1={code:Yl,name:v1,encode:Xl,digest:y1};var w1=Object.freeze({__proto__:null,identity:m1});new TextEncoder,new TextDecoder;const Zh={...l_,...p_,...g_,...y_,...__,...T_,...$_,...q_,...H_,...G_};({...g1,...w1});function Zl(c){return globalThis.Buffer!=null?new Uint8Array(c.buffer,c.byteOffset,c.byteLength):c}function _1(c=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Zl(globalThis.Buffer.allocUnsafe(c)):new Uint8Array(c)}function ef(c,i,r,n){return{name:c,prefix:i,encoder:{name:c,prefix:i,encode:r},decoder:{decode:n}}}const el=ef("utf8","u",c=>"u"+new TextDecoder("utf8").decode(c),c=>new TextEncoder().encode(c.substring(1))),Xo=ef("ascii","a",c=>{let i="a";for(let r=0;r{c=c.substring(1);const i=_1(c.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,a)=>{this.isInitialized(),this.keychain.set(n,a),await this.persist()},this.get=n=>{this.isInitialized();const a=this.keychain.get(n);if(typeof a>"u"){const{message:l}=X("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(l)}return a},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=i,this.logger=Oe.generateChildLogger(r,this.name)}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(i){await this.core.storage.setItem(this.storageKey,Nl(i))}async getKeyChain(){const i=await this.core.storage.getItem(this.storageKey);return typeof i<"u"?$l(i):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}}class X1{constructor(i,r,n){this.core=i,this.logger=r,this.name=S1,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=a=>(this.isInitialized(),this.keychain.has(a)),this.getClientId=async()=>{this.isInitialized();const a=await this.getClientSeed(),l=Bh(a);return Kl(l.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const a=J0();return this.setPrivateKey(a.publicKey,a.privateKey)},this.signJWT=async a=>{this.isInitialized();const l=await this.getClientSeed(),d=Bh(l),y=oc();return await Fw(y,a,C1,d)},this.generateSharedKey=(a,l,d)=>{this.isInitialized();const y=this.getPrivateKey(a),w=Q0(y,l);return this.setSymKey(w,d)},this.setSymKey=async(a,l)=>{this.isInitialized();const d=l||Y0(a);return await this.keychain.set(d,a),d},this.deleteKeyPair=async a=>{this.isInitialized(),await this.keychain.del(a)},this.deleteSymKey=async a=>{this.isInitialized(),await this.keychain.del(a)},this.encode=async(a,l,d)=>{this.isInitialized();const y=X0(d),w=Bs(l);if(Sh(y)){const T=y.senderPublicKey,j=y.receiverPublicKey;a=await this.generateSharedKey(T,j)}const v=this.getSymKey(a),{type:E,senderPublicKey:C}=y;return Z0({type:E,symKey:v,message:w,senderPublicKey:C})},this.decode=async(a,l,d)=>{this.isInitialized();const y=em(l,d);if(Sh(y)){const w=y.receiverPublicKey,v=y.senderPublicKey;a=await this.generateSharedKey(w,v)}try{const w=this.getSymKey(a),v=tm({symKey:w,encoded:l});return va(v)}catch(w){this.logger.error(`Failed to decode message from topic: '${a}', clientId: '${await this.getClientId()}'`),this.logger.error(w)}},this.getPayloadType=a=>{const l=Ch(a);return rm(l.type)},this.getPayloadSenderPublicKey=a=>{const l=Ch(a);return l.senderPublicKey?ga(l.senderPublicKey,im):void 0},this.core=i,this.logger=Oe.generateChildLogger(r,this.name),this.keychain=n||new Y1(this.core,this.logger)}get context(){return Oe.getLoggerContext(this.logger)}async setPrivateKey(i,r){return await this.keychain.set(i,r),i}getPrivateKey(i){return this.keychain.get(i)}async getClientSeed(){let i="";try{i=this.keychain.get(tl)}catch{i=oc(),await this.keychain.set(tl,i)}return E1(i,"base16")}getSymKey(i){return this.keychain.get(i)}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}}class Z1 extends Iw{constructor(i,r){super(i,r),this.logger=i,this.core=r,this.messages=new Map,this.name=T1,this.version=A1,this.initialized=!1,this.storagePrefix=bi,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,a)=>{this.isInitialized();const l=ls(a);let d=this.messages.get(n);return typeof d>"u"&&(d={}),typeof d[l]<"u"||(d[l]=a,this.messages.set(n,d),await this.persist()),l},this.get=n=>{this.isInitialized();let a=this.messages.get(n);return typeof a>"u"&&(a={}),a},this.has=(n,a)=>{this.isInitialized();const l=this.get(n),d=ls(a);return typeof l[d]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Oe.generateChildLogger(i,this.name),this.core=r}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(i){await this.core.storage.setItem(this.storageKey,Nl(i))}async getRelayerMessages(){const i=await this.core.storage.getItem(this.storageKey);return typeof i<"u"?$l(i):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}}class eb extends xw{constructor(i,r){super(i,r),this.relayer=i,this.logger=r,this.events=new Kr.EventEmitter,this.name=$1,this.queue=new Map,this.publishTimeout=ie.toMiliseconds(ie.TEN_SECONDS),this.needsTransportRestart=!1,this.publish=async(n,a,l)=>{var d;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:a,opts:l}});try{const y=(l==null?void 0:l.ttl)||N1,w=cc(l),v=(l==null?void 0:l.prompt)||!1,E=(l==null?void 0:l.tag)||0,C=(l==null?void 0:l.id)||Lm().toString(),T={topic:n,message:a,opts:{ttl:y,relay:w,prompt:v,tag:E,id:C}},j=setTimeout(()=>this.queue.set(C,T),this.publishTimeout);try{await await Vs(this.rpcPublish(n,a,y,w,v,E,C),this.publishTimeout,"Failed to publish payload, please try again."),this.removeRequestFromQueue(C),this.relayer.events.emit(Gt.publish,T)}catch(D){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,(d=l==null?void 0:l.internal)!=null&&d.throwOnFailedPublish)throw this.removeRequestFromQueue(C),D;return}finally{clearTimeout(j)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:a,opts:l}})}catch(y){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(y),y}},this.on=(n,a)=>{this.events.on(n,a)},this.once=(n,a)=>{this.events.once(n,a)},this.off=(n,a)=>{this.events.off(n,a)},this.removeListener=(n,a)=>{this.events.removeListener(n,a)},this.relayer=i,this.logger=Oe.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return Oe.getLoggerContext(this.logger)}rpcPublish(i,r,n,a,l,d,y){var w,v,E,C;const T={method:oa(a.protocol).publish,params:{topic:i,message:r,ttl:n,prompt:l,tag:d},id:y};return _i((w=T.params)==null?void 0:w.prompt)&&((v=T.params)==null||delete v.prompt),_i((E=T.params)==null?void 0:E.tag)&&((C=T.params)==null||delete C.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:T}),this.relayer.request(T)}removeRequestFromQueue(i){this.queue.delete(i)}checkQueue(){this.queue.forEach(async i=>{const{topic:r,message:n,opts:a}=i;await this.publish(r,n,a)})}registerEventListeners(){this.relayer.core.heartbeat.on(ps.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Gt.connection_stalled);return}this.checkQueue()}),this.relayer.on(Gt.message_ack,i=>{this.removeRequestFromQueue(i.id.toString())})}}class tb{constructor(){this.map=new Map,this.set=(i,r)=>{const n=this.get(i);this.exists(i,r)||this.map.set(i,[...n,r])},this.get=i=>this.map.get(i)||[],this.exists=(i,r)=>this.get(i).includes(r),this.delete=(i,r)=>{if(typeof r>"u"){this.map.delete(i);return}if(!this.map.has(i))return;const n=this.get(i);if(!this.exists(i,r))return;const a=n.filter(l=>l!==r);if(!a.length){this.map.delete(i);return}this.map.set(i,a)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var rb=Object.defineProperty,ib=Object.defineProperties,sb=Object.getOwnPropertyDescriptors,sl=Object.getOwnPropertySymbols,nb=Object.prototype.hasOwnProperty,ab=Object.prototype.propertyIsEnumerable,nl=(c,i,r)=>i in c?rb(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,qs=(c,i)=>{for(var r in i||(i={}))nb.call(i,r)&&nl(c,r,i[r]);if(sl)for(var r of sl(i))ab.call(i,r)&&nl(c,r,i[r]);return c},ec=(c,i)=>ib(c,sb(i));class ob extends Cw{constructor(i,r){super(i,r),this.relayer=i,this.logger=r,this.subscriptions=new Map,this.topicMap=new tb,this.events=new Kr.EventEmitter,this.name=k1,this.version=K1,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=bi,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,a)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:a}});try{const l=cc(a),d={topic:n,relay:l};this.pending.set(n,d);const y=await this.rpcSubscribe(n,l);return this.onSubscribe(y,d),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:a}}),y}catch(l){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(l),l}},this.unsubscribe=async(n,a)=>{await this.restartToComplete(),this.isInitialized(),typeof(a==null?void 0:a.id)<"u"?await this.unsubscribeById(n,a.id,a):await this.unsubscribeByTopic(n,a)},this.isSubscribed=async n=>this.topics.includes(n)?!0:await new Promise((a,l)=>{const d=new ie.Watch;d.start(this.pendingSubscriptionWatchLabel);const y=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(y),d.stop(this.pendingSubscriptionWatchLabel),a(!0)),d.elapsed(this.pendingSubscriptionWatchLabel)>=V1&&(clearInterval(y),d.stop(this.pendingSubscriptionWatchLabel),l(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1),this.on=(n,a)=>{this.events.on(n,a)},this.once=(n,a)=>{this.events.once(n,a)},this.off=(n,a)=>{this.events.off(n,a)},this.removeListener=(n,a)=>{this.events.removeListener(n,a)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=i,this.logger=Oe.generateChildLogger(r,this.name),this.clientId=""}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(i,r){let n=!1;try{n=this.getSubscription(i).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(i,r){const n=this.topicMap.get(i);await Promise.all(n.map(async a=>await this.unsubscribeById(i,a,r)))}async unsubscribeById(i,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:i,id:r,opts:n}});try{const a=cc(n);await this.rpcUnsubscribe(i,r,a);const l=tr("USER_DISCONNECTED",`${this.name}, ${i}`);await this.onUnsubscribe(i,r,l),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:i,id:r,opts:n}})}catch(a){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(a),a}}async rpcSubscribe(i,r){const n={method:oa(r.protocol).subscribe,params:{topic:i}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await Vs(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Gt.connection_stalled)}return ls(i+this.clientId)}async rpcBatchSubscribe(i){if(!i.length)return;const r=i[0].relay,n={method:oa(r.protocol).batchSubscribe,params:{topics:i.map(a=>a.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Vs(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(Gt.connection_stalled)}}rpcUnsubscribe(i,r,n){const a={method:oa(n.protocol).unsubscribe,params:{topic:i,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:a}),this.relayer.request(a)}onSubscribe(i,r){this.setSubscription(i,ec(qs({},r),{id:i})),this.pending.delete(r.topic)}onBatchSubscribe(i){i.length&&i.forEach(r=>{this.setSubscription(r.id,qs({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(i,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,i)&&this.deleteSubscription(r,n),await this.relayer.messages.del(i)}async setRelayerSubscriptions(i){await this.relayer.core.storage.setItem(this.storageKey,i)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(i,r){this.subscriptions.has(i)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:i,subscription:r}),this.addSubscription(i,r))}addSubscription(i,r){this.subscriptions.set(i,qs({},r)),this.topicMap.set(r.topic,i),this.events.emit($r.created,r)}getSubscription(i){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:i});const r=this.subscriptions.get(i);if(!r){const{message:n}=X("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(n)}return r}deleteSubscription(i,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:i,reason:r});const n=this.getSubscription(i);this.subscriptions.delete(i),this.topicMap.delete(n.topic,i),this.events.emit($r.deleted,ec(qs({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit($r.sync)}async reset(){if(this.cached.length){const i=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!i.length)return;if(this.subscriptions.size){const{message:r}=X("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=i,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(i){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(i)}}async batchSubscribe(i){if(!i.length)return;const r=await this.rpcBatchSubscribe(i);fs(r)&&this.onBatchSubscribe(r.map((n,a)=>ec(qs({},i[a]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;const i=[];this.pending.forEach(r=>{i.push(r)}),await this.batchSubscribe(i)}registerEventListeners(){this.relayer.core.heartbeat.on(ps.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(Gt.connect,async()=>{await this.onConnect()}),this.relayer.on(Gt.disconnect,()=>{this.onDisconnect()}),this.events.on($r.created,async i=>{const r=$r.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:i}),await this.persist()}),this.events.on($r.deleted,async i=>{const r=$r.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:i}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}async restartToComplete(){this.restartInProgress&&await new Promise(i=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),i())},this.pollingInterval)})}}var cb=Object.defineProperty,al=Object.getOwnPropertySymbols,ub=Object.prototype.hasOwnProperty,hb=Object.prototype.propertyIsEnumerable,ol=(c,i,r)=>i in c?cb(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,lb=(c,i)=>{for(var r in i||(i={}))ub.call(i,r)&&ol(c,r,i[r]);if(al)for(var r of al(i))hb.call(i,r)&&ol(c,r,i[r]);return c};class fb extends Pw{constructor(i){super(i),this.protocol="wc",this.version=2,this.events=new Kr.EventEmitter,this.name=L1,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,this.request=async r=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(r)}catch(n){throw this.logger.debug("Failed to Publish Request"),this.logger.error(n),n}},this.onPayloadHandler=r=>{this.onProviderPayload(r)},this.onConnectHandler=()=>{this.events.emit(Gt.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(Gt.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(ri.payload,this.onPayloadHandler),this.provider.on(ri.connect,this.onConnectHandler),this.provider.on(ri.disconnect,this.onDisconnectHandler),this.provider.on(ri.error,this.onProviderErrorHandler)},this.core=i.core,this.logger=typeof i.logger<"u"&&typeof i.logger!="string"?Oe.generateChildLogger(i.logger,this.name):Oe.pino(Oe.getDefaultLoggerOptions({level:i.logger||D1})),this.messages=new Z1(this.logger,i.core),this.subscriber=new ob(this,this.logger),this.publisher=new eb(this,this.logger),this.relayUrl=(i==null?void 0:i.relayUrl)||sf,this.projectId=i.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${rl}...`),await this.restartTransport(rl)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},j1)}get context(){return Oe.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(i,r,n){this.isInitialized(),await this.publisher.publish(i,r,n),await this.recordMessageEvent({topic:i,message:r,publishedAt:Date.now()})}async subscribe(i,r){var n;this.isInitialized();let a=((n=this.subscriber.topicMap.get(i))==null?void 0:n[0])||"";if(a)return a;let l;const d=y=>{y.topic===i&&(this.subscriber.off($r.created,d),l())};return await Promise.all([new Promise(y=>{l=y,this.subscriber.on($r.created,d)}),new Promise(async y=>{a=await this.subscriber.subscribe(i,r),y()})]),a}async unsubscribe(i,r){this.isInitialized(),await this.subscriber.unsubscribe(i,r)}on(i,r){this.events.on(i,r)}once(i,r){this.events.once(i,r)}off(i,r){this.events.off(i,r)}removeListener(i,r){this.events.removeListener(i,r)}async transportClose(){this.transportExplicitlyClosed=!0,this.hasExperiencedNetworkDisruption&&this.connected?await Vs(this.provider.disconnect(),1e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(i){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){i&&i!==this.relayUrl&&(this.relayUrl=i,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(r=>{if(!this.initialized)return r();this.subscriber.once($r.resubscribed,()=>{r()})}),new Promise(async(r,n)=>{try{await Vs(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(a){n(a);return}r()})])}catch(r){this.logger.error(r);const n=r;if(!this.isConnectionStalled(n.message))throw r;this.provider.events.emit(ri.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(i){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=i||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Oh())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(i){return this.staleConnectionErrors.some(r=>i.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const i=await this.core.crypto.signJWT(this.relayUrl);this.provider=new ni(new Jw(sm({sdkVersion:M1,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:i,useOnCloseEvent:!0}))),this.registerProviderListeners()}async recordMessageEvent(i){const{topic:r,message:n}=i;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(i){const{topic:r,message:n}=i;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const a=this.messages.has(r,n);return a&&this.logger.debug(`Ignoring duplicate message: ${n}`),a}async onProviderPayload(i){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:i}),mc(i)){if(!i.method.endsWith(q1))return;const r=i.params,{topic:n,message:a,publishedAt:l}=r.data,d={topic:n,message:a,publishedAt:l};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(lb({type:"event",event:r.id},d)),this.events.emit(r.id,d),await this.acknowledgePayload(i),await this.onMessageEvent(d)}else wc(i)&&this.events.emit(Gt.message_ack,i)}async onMessageEvent(i){await this.shouldIgnoreMessageEvent(i)||(this.events.emit(Gt.message,i),await this.recordMessageEvent(i))}async acknowledgePayload(i){const r=_c(i.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(ri.payload,this.onPayloadHandler),this.provider.off(ri.connect,this.onConnectHandler),this.provider.off(ri.disconnect,this.onDisconnectHandler),this.provider.off(ri.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(Gt.connection_stalled,()=>{this.restartTransport().catch(r=>this.logger.error(r))});let i=await Oh();nm(async r=>{this.initialized&&i!==r&&(i=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(n=>this.logger.error(n))))})}onProviderDisconnect(){this.events.emit(Gt.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(i=>this.logger.error(i))},ie.toMiliseconds(z1)))}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(i=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),i())},this.connectionStatusPollingInterval)});await this.restartTransport()}}}var pb=Object.defineProperty,cl=Object.getOwnPropertySymbols,db=Object.prototype.hasOwnProperty,gb=Object.prototype.propertyIsEnumerable,ul=(c,i,r)=>i in c?pb(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,hl=(c,i)=>{for(var r in i||(i={}))db.call(i,r)&&ul(c,r,i[r]);if(cl)for(var r of cl(i))gb.call(i,r)&&ul(c,r,i[r]);return c};class ma extends Sw{constructor(i,r,n,a=bi,l=void 0){super(i,r,n,a),this.core=i,this.logger=r,this.name=n,this.map=new Map,this.version=U1,this.cached=[],this.initialized=!1,this.storagePrefix=bi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(d=>{this.getKey&&d!==null&&!_i(d)?this.map.set(this.getKey(d),d):G0(d)?this.map.set(d.id,d):W0(d)&&this.map.set(d.topic,d)}),this.cached=[],this.initialized=!0)},this.set=async(d,y)=>{this.isInitialized(),this.map.has(d)?await this.update(d,y):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:d,value:y}),this.map.set(d,y),await this.persist())},this.get=d=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:d}),this.getData(d)),this.getAll=d=>(this.isInitialized(),d?this.values.filter(y=>Object.keys(d).every(w=>Yw(y[w],d[w]))):this.values),this.update=async(d,y)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:d,update:y});const w=hl(hl({},this.getData(d)),y);this.map.set(d,w),await this.persist()},this.delete=async(d,y)=>{this.isInitialized(),this.map.has(d)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:d,reason:y}),this.map.delete(d),await this.persist())},this.logger=Oe.generateChildLogger(r,this.name),this.storagePrefix=a,this.getKey=l}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(i){await this.core.storage.setItem(this.storageKey,i)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(i){const r=this.map.get(i);if(!r){const{message:n}=X("NO_MATCHING_KEY",`${this.name}: ${i}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const i=await this.getDataStore();if(typeof i>"u"||!i.length)return;if(this.map.size){const{message:r}=X("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=i,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(i){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(i)}}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}}class vb{constructor(i,r){this.core=i,this.logger=r,this.name=F1,this.version=B1,this.events=new vc,this.initialized=!1,this.storagePrefix=bi,this.ignoredPayloadTypes=[Rl],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async()=>{this.isInitialized();const n=oc(),a=await this.core.crypto.setSymKey(n),l=Dr(ie.FIVE_MINUTES),d={protocol:rf},y={topic:a,expiry:l,relay:d,active:!1},w=am({protocol:this.core.protocol,version:this.core.version,topic:a,symKey:n,relay:d});return await this.pairings.set(a,y),await this.core.relayer.subscribe(a),this.core.expirer.set(a,l),{topic:a,uri:w}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);const{topic:a,symKey:l,relay:d}=om(n.uri);let y;if(this.pairings.keys.includes(a)&&(y=this.pairings.get(a),y.active))throw new Error(`Pairing already exists: ${a}. Please try again with a new connection URI.`);this.core.crypto.keychain.has(a)||(await this.core.crypto.setSymKey(l,a),await this.core.relayer.subscribe(a,{relay:d}));const w=Dr(ie.FIVE_MINUTES),v={topic:a,relay:d,expiry:w,active:!1};return await this.pairings.set(a,v),this.core.expirer.set(a,w),n.activatePairing&&await this.activate({topic:a}),this.events.emit(Hs.create,v),v},this.activate=async({topic:n})=>{this.isInitialized();const a=Dr(ie.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:a}),this.core.expirer.set(n,a)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:a}=n;if(this.pairings.keys.includes(a)){const l=await this.sendRequest(a,"wc_pairingPing",{}),{done:d,resolve:y,reject:w}=us();this.events.once($t("pairing_ping",l),({error:v})=>{v?w(v):y()}),await d()}},this.updateExpiry=async({topic:n,expiry:a})=>{this.isInitialized(),await this.pairings.update(n,{expiry:a})},this.updateMetadata=async({topic:n,metadata:a})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:a})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:a}=n;this.pairings.keys.includes(a)&&(await this.sendRequest(a,"wc_pairingDelete",tr("USER_DISCONNECTED")),await this.deletePairing(a))},this.sendRequest=async(n,a,l)=>{const d=Ks(a,l),y=await this.core.crypto.encode(n,d),w=Ls[a].req;return this.core.history.set(n,d),this.core.relayer.publish(n,y,w),d.id},this.sendResult=async(n,a,l)=>{const d=_c(n,l),y=await this.core.crypto.encode(a,d),w=await this.core.history.get(a,n),v=Ls[w.request.method].res;await this.core.relayer.publish(a,y,v),await this.core.history.resolve(d)},this.sendError=async(n,a,l)=>{const d=yc(n,l),y=await this.core.crypto.encode(a,d),w=await this.core.history.get(a,n),v=Ls[w.request.method]?Ls[w.request.method].res:Ls.unregistered_method.res;await this.core.relayer.publish(a,y,v),await this.core.history.resolve(d)},this.deletePairing=async(n,a)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,tr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),a?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(a=>wi(a.expiry));await Promise.all(n.map(a=>this.deletePairing(a.topic)))},this.onRelayEventRequest=n=>{const{topic:a,payload:l}=n;switch(l.method){case"wc_pairingPing":return this.onPairingPingRequest(a,l);case"wc_pairingDelete":return this.onPairingDeleteRequest(a,l);default:return this.onUnknownRpcMethodRequest(a,l)}},this.onRelayEventResponse=async n=>{const{topic:a,payload:l}=n,d=(await this.core.history.get(a,l.id)).request.method;switch(d){case"wc_pairingPing":return this.onPairingPingResponse(a,l);default:return this.onUnknownRpcMethodResponse(d)}},this.onPairingPingRequest=async(n,a)=>{const{id:l}=a;try{this.isValidPing({topic:n}),await this.sendResult(l,n,!0),this.events.emit(Hs.ping,{id:l,topic:n})}catch(d){await this.sendError(l,n,d),this.logger.error(d)}},this.onPairingPingResponse=(n,a)=>{const{id:l}=a;setTimeout(()=>{mi(a)?this.events.emit($t("pairing_ping",l),{}):si(a)&&this.events.emit($t("pairing_ping",l),{error:a.error})},500)},this.onPairingDeleteRequest=async(n,a)=>{const{id:l}=a;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(Hs.delete,{id:l,topic:n})}catch(d){await this.sendError(l,n,d),this.logger.error(d)}},this.onUnknownRpcMethodRequest=async(n,a)=>{const{id:l,method:d}=a;try{if(this.registeredMethods.includes(d))return;const y=tr("WC_METHOD_UNSUPPORTED",d);await this.sendError(l,n,y),this.logger.error(y)}catch(y){await this.sendError(l,n,y),this.logger.error(y)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(tr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{if(!hr(n)){const{message:a}=X("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(a)}if(!cm(n.uri)){const{message:a}=X("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(a)}},this.isValidPing=async n=>{if(!hr(n)){const{message:l}=X("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(l)}const{topic:a}=n;await this.isValidPairingTopic(a)},this.isValidDisconnect=async n=>{if(!hr(n)){const{message:l}=X("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(l)}const{topic:a}=n;await this.isValidPairingTopic(a)},this.isValidPairingTopic=async n=>{if(!hs(n,!1)){const{message:a}=X("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(a)}if(!this.pairings.keys.includes(n)){const{message:a}=X("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(a)}if(wi(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:a}=X("EXPIRED",`pairing topic: ${n}`);throw new Error(a)}},this.core=i,this.logger=Oe.generateChildLogger(r,this.name),this.pairings=new ma(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Oe.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}registerRelayerEvents(){this.core.relayer.on(Gt.message,async i=>{const{topic:r,message:n}=i;if(!this.pairings.keys.includes(r)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const a=await this.core.crypto.decode(r,n);try{mc(a)?(this.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a})):wc(a)&&(await this.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a}),this.core.history.delete(r,a.id))}catch(l){this.logger.error(l)}})}registerExpirerEvents(){this.core.expirer.on(Sr.expired,async i=>{const{topic:r}=Tl(i.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(Hs.expire,{topic:r}))})}}class yb extends Ew{constructor(i,r){super(i,r),this.core=i,this.logger=r,this.records=new Map,this.events=new Kr.EventEmitter,this.name=G1,this.version=W1,this.cached=[],this.initialized=!1,this.storagePrefix=bi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,a,l)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:a,chainId:l}),this.records.has(a.id))return;const d={id:a.id,topic:n,request:{method:a.method,params:a.params||null},chainId:l,expiry:Dr(ie.THIRTY_DAYS)};this.records.set(d.id,d),this.events.emit(kr.created,d)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const a=await this.getRecord(n.id);typeof a.response>"u"&&(a.response=si(n)?{error:n.error}:{result:n.result},this.records.set(a.id,a),this.events.emit(kr.updated,a))},this.get=async(n,a)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:a}),await this.getRecord(a)),this.delete=(n,a)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:a}),this.values.forEach(l=>{if(l.topic===n){if(typeof a<"u"&&l.id!==a)return;this.records.delete(l.id),this.events.emit(kr.deleted,l)}})},this.exists=async(n,a)=>(this.isInitialized(),this.records.has(a)?(await this.getRecord(a)).topic===n:!1),this.on=(n,a)=>{this.events.on(n,a)},this.once=(n,a)=>{this.events.once(n,a)},this.off=(n,a)=>{this.events.off(n,a)},this.removeListener=(n,a)=>{this.events.removeListener(n,a)},this.logger=Oe.generateChildLogger(r,this.name)}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const i=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:Ks(r.request.method,r.request.params,r.id),chainId:r.chainId};return i.push(n)}),i}async setJsonRpcRecords(i){await this.core.storage.setItem(this.storageKey,i)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(i){this.isInitialized();const r=this.records.get(i);if(!r){const{message:n}=X("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(kr.sync)}async restore(){try{const i=await this.getJsonRpcRecords();if(typeof i>"u"||!i.length)return;if(this.records.size){const{message:r}=X("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=i,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}}registerEventListeners(){this.events.on(kr.created,i=>{const r=kr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:i}),this.persist()}),this.events.on(kr.updated,i=>{const r=kr.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:i}),this.persist()}),this.events.on(kr.deleted,i=>{const r=kr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:i}),this.persist()}),this.core.heartbeat.on(ps.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(i=>{ie.toMiliseconds(i.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${i.id}`),this.delete(i.topic,i.id))})}catch(i){this.logger.warn(i)}}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}}class mb extends Ow{constructor(i,r){super(i,r),this.core=i,this.logger=r,this.expirations=new Map,this.events=new Kr.EventEmitter,this.name=J1,this.version=Q1,this.cached=[],this.initialized=!1,this.storagePrefix=bi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const a=this.formatTarget(n);return typeof this.getExpiration(a)<"u"}catch{return!1}},this.set=(n,a)=>{this.isInitialized();const l=this.formatTarget(n),d={target:l,expiry:a};this.expirations.set(l,d),this.checkExpiry(l,d),this.events.emit(Sr.created,{target:l,expiration:d})},this.get=n=>{this.isInitialized();const a=this.formatTarget(n);return this.getExpiration(a)},this.del=n=>{if(this.isInitialized(),this.has(n)){const a=this.formatTarget(n),l=this.getExpiration(a);this.expirations.delete(a),this.events.emit(Sr.deleted,{target:a,expiration:l})}},this.on=(n,a)=>{this.events.on(n,a)},this.once=(n,a)=>{this.events.once(n,a)},this.off=(n,a)=>{this.events.off(n,a)},this.removeListener=(n,a)=>{this.events.removeListener(n,a)},this.logger=Oe.generateChildLogger(r,this.name)}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(i){if(typeof i=="string")return um(i);if(typeof i=="number")return hm(i);const{message:r}=X("UNKNOWN_TYPE",`Target type: ${typeof i}`);throw new Error(r)}async setExpirations(i){await this.core.storage.setItem(this.storageKey,i)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Sr.sync)}async restore(){try{const i=await this.getExpirations();if(typeof i>"u"||!i.length)return;if(this.expirations.size){const{message:r}=X("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=i,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(i){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(i)}}getExpiration(i){const r=this.expirations.get(i);if(!r){const{message:n}=X("NO_MATCHING_KEY",`${this.name}: ${i}`);throw this.logger.error(n),new Error(n)}return r}checkExpiry(i,r){const{expiry:n}=r;ie.toMiliseconds(n)-Date.now()<=0&&this.expire(i,r)}expire(i,r){this.expirations.delete(i),this.events.emit(Sr.expired,{target:i,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((i,r)=>this.checkExpiry(r,i))}registerEventListeners(){this.core.heartbeat.on(ps.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Sr.created,i=>{const r=Sr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:i}),this.persist()}),this.events.on(Sr.expired,i=>{const r=Sr.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:i}),this.persist()}),this.events.on(Sr.deleted,i=>{const r=Sr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:i}),this.persist()})}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}}class wb extends Rw{constructor(i,r){super(i,r),this.projectId=i,this.logger=r,this.name=Zo,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async()=>{if(this.verifyDisabled||lm()||!Al())return;const n=la;this.verifyUrl!==n&&this.removeIframe(),this.verifyUrl=n;try{await this.createIframe()}catch(a){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(a)}if(!this.initialized){this.removeIframe(),this.verifyUrl=il;try{await this.createIframe()}catch(a){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(a),this.verifyDisabled=!0}}},this.register=async n=>{this.initialized?this.sendPost(n.attestationId):(this.addToQueue(n.attestationId),await this.init())},this.resolve=async n=>{if(this.isDevEnv)return"";const a=(n==null?void 0:n.verifyUrl)||la;let l;try{l=await this.fetchAttestation(n.attestationId,a)}catch(d){this.logger.info(`failed to resolve attestation: ${n.attestationId} from url: ${a}`),this.logger.info(d),l=await this.fetchAttestation(n.attestationId,il)}return l},this.fetchAttestation=async(n,a)=>{this.logger.info(`resolving attestation: ${n} from url: ${a}`);const l=this.startAbortTimer(ie.ONE_SECOND*2),d=await fetch(`${a}/attestation/${n}`,{signal:this.abortController.signal});return clearTimeout(l),d.status===200?await d.json():void 0},this.addToQueue=n=>{this.queue.push(n)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(n=>this.sendPost(n)),this.queue=[])},this.sendPost=n=>{var a;try{if(!this.iframe)return;(a=this.iframe.contentWindow)==null||a.postMessage(n,"*"),this.logger.info(`postMessage sent: ${n} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let n;const a=l=>{l.data==="verify_ready"&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",a),n())};await Promise.race([new Promise(l=>{if(document.getElementById(Zo))return l();window.addEventListener("message",a);const d=document.createElement("iframe");d.id=Zo,d.src=`${this.verifyUrl}/${this.projectId}`,d.style.display="none",document.body.append(d),this.iframe=d,n=l}),new Promise((l,d)=>setTimeout(()=>{window.removeEventListener("message",a),d("verify iframe load timeout")},ie.toMiliseconds(ie.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.logger=Oe.generateChildLogger(r,this.name),this.verifyUrl=la,this.abortController=new AbortController,this.isDevEnv=fm()&&Xw.IS_VITEST}get context(){return Oe.getLoggerContext(this.logger)}startAbortTimer(i){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),ie.toMiliseconds(i))}}var _b=Object.defineProperty,ll=Object.getOwnPropertySymbols,bb=Object.prototype.hasOwnProperty,Eb=Object.prototype.propertyIsEnumerable,fl=(c,i,r)=>i in c?_b(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,pl=(c,i)=>{for(var r in i||(i={}))bb.call(i,r)&&fl(c,r,i[r]);if(ll)for(var r of ll(i))Eb.call(i,r)&&fl(c,r,i[r]);return c};class Ic extends bw{constructor(i){super(i),this.protocol=tf,this.version=I1,this.name=Ec,this.events=new Kr.EventEmitter,this.initialized=!1,this.on=(n,a)=>this.events.on(n,a),this.once=(n,a)=>this.events.once(n,a),this.off=(n,a)=>this.events.off(n,a),this.removeListener=(n,a)=>this.events.removeListener(n,a),this.projectId=i==null?void 0:i.projectId,this.relayUrl=(i==null?void 0:i.relayUrl)||sf,this.customStoragePrefix=i!=null&&i.customStoragePrefix?`:${i.customStoragePrefix}`:"";const r=typeof(i==null?void 0:i.logger)<"u"&&typeof(i==null?void 0:i.logger)!="string"?i.logger:Oe.pino(Oe.getDefaultLoggerOptions({level:(i==null?void 0:i.logger)||x1.logger}));this.logger=Oe.generateChildLogger(r,this.name),this.heartbeat=new ps.HeartBeat,this.crypto=new X1(this,this.logger,i==null?void 0:i.keychain),this.history=new yb(this,this.logger),this.expirer=new mb(this,this.logger),this.storage=i!=null&&i.storage?i.storage:new fw(pl(pl({},P1),i==null?void 0:i.storageOptions)),this.relayer=new fb({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new vb(this,this.logger),this.verify=new wb(this.projectId||"",this.logger)}static async init(i){const r=new Ic(i);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(H1,n),r}get context(){return Oe.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(i){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,i),this.logger.error(i.message),i}}}const Ib=Ic,nf="wc",af=2,of="client",xc=`${nf}@${af}:${of}:`,tc={name:of,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},dl="WALLETCONNECT_DEEPLINK_CHOICE",xb="proposal",cf="Proposal expired",Pb="session",sa=ie.SEVEN_DAYS,Sb="engine",zs={wc_sessionPropose:{req:{ttl:ie.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:ie.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:ie.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:ie.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:ie.ONE_DAY,prompt:!1,tag:1104},res:{ttl:ie.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:ie.ONE_DAY,prompt:!1,tag:1106},res:{ttl:ie.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:ie.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:ie.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:ie.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:ie.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:ie.ONE_DAY,prompt:!1,tag:1112},res:{ttl:ie.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:ie.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:ie.THIRTY_SECONDS,prompt:!1,tag:1115}}},rc={min:ie.FIVE_MINUTES,max:ie.SEVEN_DAYS},ii={idle:"IDLE",active:"ACTIVE"},Cb="request",Ob=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"];var Rb=Object.defineProperty,Tb=Object.defineProperties,Ab=Object.getOwnPropertyDescriptors,gl=Object.getOwnPropertySymbols,Nb=Object.prototype.hasOwnProperty,$b=Object.prototype.propertyIsEnumerable,vl=(c,i,r)=>i in c?Rb(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,cr=(c,i)=>{for(var r in i||(i={}))Nb.call(i,r)&&vl(c,r,i[r]);if(gl)for(var r of gl(i))$b.call(i,r)&&vl(c,r,i[r]);return c},Ms=(c,i)=>Tb(c,Ab(i));class Db extends Aw{constructor(i){super(i),this.name=Sb,this.events=new vc,this.initialized=!1,this.ignoredPayloadTypes=[Rl],this.requestQueue={state:ii.idle,queue:[]},this.sessionRequestQueue={state:ii.idle,queue:[]},this.requestQueueDelay=ie.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(zs)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},ie.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{await this.isInitialized();const n=Ms(cr({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:a,requiredNamespaces:l,optionalNamespaces:d,sessionProperties:y,relays:w}=n;let v=a,E,C=!1;if(v&&(C=this.client.core.pairing.pairings.get(v).active),!v||!C){const{topic:he,uri:fe}=await this.client.core.pairing.create();v=he,E=fe}const T=await this.client.core.crypto.generateKeyPair(),j=cr({requiredNamespaces:l,optionalNamespaces:d,relays:w??[{protocol:rf}],proposer:{publicKey:T,metadata:this.client.metadata}},y&&{sessionProperties:y}),{reject:D,resolve:V,done:re}=us(ie.FIVE_MINUTES,cf);if(this.events.once($t("session_connect"),async({error:he,session:fe})=>{if(he)D(he);else if(fe){fe.self.publicKey=T;const pe=Ms(cr({},fe),{requiredNamespaces:fe.requiredNamespaces,optionalNamespaces:fe.optionalNamespaces});await this.client.session.set(fe.topic,pe),await this.setExpiry(fe.topic,fe.expiry),v&&await this.client.core.pairing.updateMetadata({topic:v,metadata:fe.peer.metadata}),V(pe)}}),!v){const{message:he}=X("NO_MATCHING_KEY",`connect() pairing topic: ${v}`);throw new Error(he)}const ce=await this.sendRequest({topic:v,method:"wc_sessionPropose",params:j}),ue=Dr(ie.FIVE_MINUTES);return await this.setProposal(ce,cr({id:ce,expiry:ue},j)),{uri:E,approval:re}},this.pair=async r=>(await this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{await this.isInitialized(),await this.isValidApprove(r);const{id:n,relayProtocol:a,namespaces:l,sessionProperties:d}=r,y=this.client.proposal.get(n);let{pairingTopic:w,proposer:v,requiredNamespaces:E,optionalNamespaces:C}=y;w=w||"",ca(E)||(E=dm(l,"approve()"));const T=await this.client.core.crypto.generateKeyPair(),j=v.publicKey,D=await this.client.core.crypto.generateSharedKey(T,j);w&&n&&(await this.client.core.pairing.updateMetadata({topic:w,metadata:v.metadata}),await this.sendResult({id:n,topic:w,result:{relay:{protocol:a??"irn"},responderPublicKey:T}}),await this.client.proposal.delete(n,tr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:w}));const V=cr({relay:{protocol:a??"irn"},namespaces:l,requiredNamespaces:E,optionalNamespaces:C,pairingTopic:w,controller:{publicKey:T,metadata:this.client.metadata},expiry:Dr(sa)},d&&{sessionProperties:d});await this.client.core.relayer.subscribe(D),await this.sendRequest({topic:D,method:"wc_sessionSettle",params:V,throwOnFailedPublish:!0});const re=Ms(cr({},V),{topic:D,pairingTopic:w,acknowledged:!1,self:V.controller,peer:{publicKey:v.publicKey,metadata:v.metadata},controller:T});return await this.client.session.set(D,re),await this.setExpiry(D,Dr(sa)),{topic:D,acknowledged:()=>new Promise(ce=>setTimeout(()=>ce(this.client.session.get(D)),500))}},this.reject=async r=>{await this.isInitialized(),await this.isValidReject(r);const{id:n,reason:a}=r,{pairingTopic:l}=this.client.proposal.get(n);l&&(await this.sendError(n,l,a),await this.client.proposal.delete(n,tr("USER_DISCONNECTED")))},this.update=async r=>{await this.isInitialized(),await this.isValidUpdate(r);const{topic:n,namespaces:a}=r,l=await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:a}}),{done:d,resolve:y,reject:w}=us();return this.events.once($t("session_update",l),({error:v})=>{v?w(v):y()}),await this.client.session.update(n,{namespaces:a}),{acknowledged:d}},this.extend=async r=>{await this.isInitialized(),await this.isValidExtend(r);const{topic:n}=r,a=await this.sendRequest({topic:n,method:"wc_sessionExtend",params:{}}),{done:l,resolve:d,reject:y}=us();return this.events.once($t("session_extend",a),({error:w})=>{w?y(w):d()}),await this.setExpiry(n,Dr(sa)),{acknowledged:l}},this.request=async r=>{await this.isInitialized(),await this.isValidRequest(r);const{chainId:n,request:a,topic:l,expiry:d}=r,y=qm(),{done:w,resolve:v,reject:E}=us(d,"Request expired. Please try again.");return this.events.once($t("session_request",y),({error:C,result:T})=>{C?E(C):v(T)}),await Promise.all([new Promise(async C=>{await this.sendRequest({clientRpcId:y,topic:l,method:"wc_sessionRequest",params:{request:a,chainId:n},expiry:d,throwOnFailedPublish:!0}).catch(T=>E(T)),this.client.events.emit("session_request_sent",{topic:l,request:a,chainId:n,id:y}),C()}),new Promise(async C=>{const T=await this.client.core.storage.getItem(dl);gm({id:y,topic:l,wcDeepLink:T}),C()}),w()]).then(C=>C[2])},this.respond=async r=>{await this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:a}=r,{id:l}=a;mi(a)?await this.sendResult({id:l,topic:n,result:a.result,throwOnFailedPublish:!0}):si(a)&&await this.sendError(l,n,a.error),this.cleanupAfterResponse(r)},this.ping=async r=>{await this.isInitialized(),await this.isValidPing(r);const{topic:n}=r;if(this.client.session.keys.includes(n)){const a=await this.sendRequest({topic:n,method:"wc_sessionPing",params:{}}),{done:l,resolve:d,reject:y}=us();this.events.once($t("session_ping",a),({error:w})=>{w?y(w):d()}),await l()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{await this.isInitialized(),await this.isValidEmit(r);const{topic:n,event:a,chainId:l}=r;await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:a,chainId:l}})},this.disconnect=async r=>{await this.isInitialized(),await this.isValidDisconnect(r);const{topic:n}=r;this.client.session.keys.includes(n)?(await this.sendRequest({topic:n,method:"wc_sessionDelete",params:tr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>vm(n,r))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),a=this.client.core.pairing.pairings.getAll().filter(l=>{var d,y;return((d=l.peerMetadata)==null?void 0:d.url)&&((y=l.peerMetadata)==null?void 0:y.url)===r.peer.metadata.url&&l.topic&&l.topic!==n.topic});if(a.length===0)return;this.client.logger.info(`Cleaning up ${a.length} duplicate pairing(s)`),await Promise.all(a.map(l=>this.client.core.pairing.disconnect({topic:l.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async(r,n)=>{const{self:a}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),this.client.session.delete(r,tr("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(a.publicKey)&&await this.client.core.crypto.deleteKeyPair(a.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(dl).catch(l=>this.client.logger.warn(l))},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,tr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deletePendingSessionRequest=async(r,n,a=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),a?Promise.resolve():this.client.core.expirer.del(r)]),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(l=>l.id!==r),a&&(this.sessionRequestQueue.state=ii.idle)},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,n.expiry)},this.setPendingSessionRequest=async r=>{const n=zs.wc_sessionRequest.req.ttl,{id:a,topic:l,params:d,verifyContext:y}=r;await this.client.pendingRequest.set(a,{id:a,topic:l,params:d,verifyContext:y}),n&&this.client.core.expirer.set(a,Dr(n))},this.sendRequest=async r=>{const{topic:n,method:a,params:l,expiry:d,relayRpcId:y,clientRpcId:w,throwOnFailedPublish:v}=r,E=Ks(a,l,w);if(Al()&&Ob.includes(a)){const j=ls(JSON.stringify(E));this.client.core.verify.register({attestationId:j})}const C=await this.client.core.crypto.encode(n,E),T=zs[a].req;return d&&(T.ttl=d),y&&(T.id=y),this.client.core.history.set(n,E),v?(T.internal=Ms(cr({},T.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,C,T)):this.client.core.relayer.publish(n,C,T).catch(j=>this.client.logger.error(j)),E.id},this.sendResult=async r=>{const{id:n,topic:a,result:l,throwOnFailedPublish:d}=r,y=_c(n,l),w=await this.client.core.crypto.encode(a,y),v=await this.client.core.history.get(a,n),E=zs[v.request.method].res;d?(E.internal=Ms(cr({},E.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(a,w,E)):this.client.core.relayer.publish(a,w,E).catch(C=>this.client.logger.error(C)),await this.client.core.history.resolve(y)},this.sendError=async(r,n,a)=>{const l=yc(r,a),d=await this.client.core.crypto.encode(n,l),y=await this.client.core.history.get(n,r),w=zs[y.request.method].res;this.client.core.relayer.publish(n,d,w),await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(a=>{wi(a.expiry)&&r.push(a.topic)}),this.client.proposal.getAll().forEach(a=>{wi(a.expiry)&&n.push(a.id)}),await Promise.all([...r.map(a=>this.deleteSession(a)),...n.map(a=>this.deleteProposal(a))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===ii.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=ii.active;const r=this.requestQueue.queue.shift();if(r)try{this.processRequest(r),await new Promise(n=>setTimeout(n,300))}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=ii.idle},this.processRequest=r=>{const{topic:n,payload:a}=r,l=a.method;switch(l){case"wc_sessionPropose":return this.onSessionProposeRequest(n,a);case"wc_sessionSettle":return this.onSessionSettleRequest(n,a);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,a);case"wc_sessionExtend":return this.onSessionExtendRequest(n,a);case"wc_sessionPing":return this.onSessionPingRequest(n,a);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,a);case"wc_sessionRequest":return this.onSessionRequest(n,a);case"wc_sessionEvent":return this.onSessionEventRequest(n,a);default:return this.client.logger.info(`Unsupported request method ${l}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:a}=r,l=(await this.client.core.history.get(n,a.id)).request.method;switch(l){case"wc_sessionPropose":return this.onSessionProposeResponse(n,a);case"wc_sessionSettle":return this.onSessionSettleResponse(n,a);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,a);case"wc_sessionExtend":return this.onSessionExtendResponse(n,a);case"wc_sessionPing":return this.onSessionPingResponse(n,a);case"wc_sessionRequest":return this.onSessionRequestResponse(n,a);default:return this.client.logger.info(`Unsupported response method ${l}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:a}=X("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(a)},this.onSessionProposeRequest=async(r,n)=>{const{params:a,id:l}=n;try{this.isValidConnect(cr({},n.params));const d=Dr(ie.FIVE_MINUTES),y=cr({id:l,pairingTopic:r,expiry:d},a);await this.setProposal(l,y);const w=ls(JSON.stringify(n)),v=await this.getVerifyContext(w,y.proposer.metadata);this.client.events.emit("session_proposal",{id:l,params:y,verifyContext:v})}catch(d){await this.sendError(l,r,d),this.client.logger.error(d)}},this.onSessionProposeResponse=async(r,n)=>{const{id:a}=n;if(mi(n)){const{result:l}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:l});const d=this.client.proposal.get(a);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:d});const y=d.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:y});const w=l.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:w});const v=await this.client.core.crypto.generateSharedKey(y,w);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:v});const E=await this.client.core.relayer.subscribe(v);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:E}),await this.client.core.pairing.activate({topic:r})}else si(n)&&(await this.client.proposal.delete(a,tr("USER_DISCONNECTED")),this.events.emit($t("session_connect"),{error:n.error}))},this.onSessionSettleRequest=async(r,n)=>{const{id:a,params:l}=n;try{this.isValidSessionSettleRequest(l);const{relay:d,controller:y,expiry:w,namespaces:v,requiredNamespaces:E,optionalNamespaces:C,sessionProperties:T,pairingTopic:j}=n.params,D=cr({topic:r,relay:d,expiry:w,namespaces:v,acknowledged:!0,pairingTopic:j,requiredNamespaces:E,optionalNamespaces:C,controller:y.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:y.publicKey,metadata:y.metadata}},T&&{sessionProperties:T});await this.sendResult({id:n.id,topic:r,result:!0}),this.events.emit($t("session_connect"),{session:D}),this.cleanupDuplicatePairings(D)}catch(d){await this.sendError(a,r,d),this.client.logger.error(d)}},this.onSessionSettleResponse=async(r,n)=>{const{id:a}=n;mi(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit($t("session_approve",a),{})):si(n)&&(await this.client.session.delete(r,tr("USER_DISCONNECTED")),this.events.emit($t("session_approve",a),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:a,id:l}=n;try{const d=`${r}_session_update`,y=ta.get(d);if(y&&this.isRequestOutOfSync(y,l)){this.client.logger.info(`Discarding out of sync request - ${l}`);return}this.isValidUpdate(cr({topic:r},a)),await this.client.session.update(r,{namespaces:a.namespaces}),await this.sendResult({id:l,topic:r,result:!0}),this.client.events.emit("session_update",{id:l,topic:r,params:a}),ta.set(d,l)}catch(d){await this.sendError(l,r,d),this.client.logger.error(d)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:a}=n;mi(n)?this.events.emit($t("session_update",a),{}):si(n)&&this.events.emit($t("session_update",a),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:a}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,Dr(sa)),await this.sendResult({id:a,topic:r,result:!0}),this.client.events.emit("session_extend",{id:a,topic:r})}catch(l){await this.sendError(a,r,l),this.client.logger.error(l)}},this.onSessionExtendResponse=(r,n)=>{const{id:a}=n;mi(n)?this.events.emit($t("session_extend",a),{}):si(n)&&this.events.emit($t("session_extend",a),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:a}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:a,topic:r,result:!0}),this.client.events.emit("session_ping",{id:a,topic:r})}catch(l){await this.sendError(a,r,l),this.client.logger.error(l)}},this.onSessionPingResponse=(r,n)=>{const{id:a}=n;setTimeout(()=>{mi(n)?this.events.emit($t("session_ping",a),{}):si(n)&&this.events.emit($t("session_ping",a),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:a}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),await Promise.all([new Promise(l=>{this.client.core.relayer.once(Gt.publish,async()=>{l(await this.deleteSession(r))})}),this.sendResult({id:a,topic:r,result:!0})]),this.client.events.emit("session_delete",{id:a,topic:r})}catch(l){this.client.logger.error(l)}},this.onSessionRequest=async(r,n)=>{const{id:a,params:l}=n;try{this.isValidRequest(cr({topic:r},l));const d=ls(JSON.stringify(Ks("wc_sessionRequest",l,a))),y=this.client.session.get(r),w=await this.getVerifyContext(d,y.peer.metadata),v={id:a,topic:r,params:l,verifyContext:w};await this.setPendingSessionRequest(v),this.addSessionRequestToSessionRequestQueue(v),this.processSessionRequestQueue()}catch(d){await this.sendError(a,r,d),this.client.logger.error(d)}},this.onSessionRequestResponse=(r,n)=>{const{id:a}=n;mi(n)?this.events.emit($t("session_request",a),{result:n.result}):si(n)&&this.events.emit($t("session_request",a),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:a,params:l}=n;try{const d=`${r}_session_event_${l.event.name}`,y=ta.get(d);if(y&&this.isRequestOutOfSync(y,a)){this.client.logger.info(`Discarding out of sync request - ${a}`);return}this.isValidEmit(cr({topic:r},l)),this.client.events.emit("session_event",{id:a,topic:r,params:l}),ta.set(d,a)}catch(d){await this.sendError(a,r,d),this.client.logger.error(d)}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=ii.idle,this.processSessionRequestQueue()},ie.toMiliseconds(this.requestQueueDelay))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===ii.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=ii.active,this.client.events.emit("session_request",r)}catch(n){this.client.logger.error(n)}},this.onPairingCreated=r=>{if(r.active)return;const n=this.client.proposal.getAll().find(a=>a.pairingTopic===r.topic);n&&this.onSessionProposeRequest(r.topic,Ks("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer},n.id))},this.isValidConnect=async r=>{if(!hr(r)){const{message:w}=X("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(w)}const{pairingTopic:n,requiredNamespaces:a,optionalNamespaces:l,sessionProperties:d,relays:y}=r;if(_i(n)||await this.isValidPairingTopic(n),!ym(y,!0)){const{message:w}=X("MISSING_OR_INVALID",`connect() relays: ${y}`);throw new Error(w)}!_i(a)&&ca(a)!==0&&this.validateNamespaces(a,"requiredNamespaces"),!_i(l)&&ca(l)!==0&&this.validateNamespaces(l,"optionalNamespaces"),_i(d)||this.validateSessionProps(d,"sessionProperties")},this.validateNamespaces=(r,n)=>{const a=mm(r,"connect()",n);if(a)throw new Error(a.message)},this.isValidApprove=async r=>{if(!hr(r))throw new Error(X("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:a,relayProtocol:l,sessionProperties:d}=r;await this.isValidProposalId(n);const y=this.client.proposal.get(n),w=Vo(a,"approve()");if(w)throw new Error(w.message);const v=Rh(y.requiredNamespaces,a,"approve()");if(v)throw new Error(v.message);if(!hs(l,!0)){const{message:E}=X("MISSING_OR_INVALID",`approve() relayProtocol: ${l}`);throw new Error(E)}_i(d)||this.validateSessionProps(d,"sessionProperties")},this.isValidReject=async r=>{if(!hr(r)){const{message:l}=X("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(l)}const{id:n,reason:a}=r;if(await this.isValidProposalId(n),!wm(a)){const{message:l}=X("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(a)}`);throw new Error(l)}},this.isValidSessionSettleRequest=r=>{if(!hr(r)){const{message:v}=X("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(v)}const{relay:n,controller:a,namespaces:l,expiry:d}=r;if(!_m(n)){const{message:v}=X("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(v)}const y=bm(a,"onSessionSettleRequest()");if(y)throw new Error(y.message);const w=Vo(l,"onSessionSettleRequest()");if(w)throw new Error(w.message);if(wi(d)){const{message:v}=X("EXPIRED","onSessionSettleRequest()");throw new Error(v)}},this.isValidUpdate=async r=>{if(!hr(r)){const{message:w}=X("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(w)}const{topic:n,namespaces:a}=r;await this.isValidSessionTopic(n);const l=this.client.session.get(n),d=Vo(a,"update()");if(d)throw new Error(d.message);const y=Rh(l.requiredNamespaces,a,"update()");if(y)throw new Error(y.message)},this.isValidExtend=async r=>{if(!hr(r)){const{message:a}=X("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(a)}const{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!hr(r)){const{message:w}=X("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(w)}const{topic:n,request:a,chainId:l,expiry:d}=r;await this.isValidSessionTopic(n);const{namespaces:y}=this.client.session.get(n);if(!Th(y,l)){const{message:w}=X("MISSING_OR_INVALID",`request() chainId: ${l}`);throw new Error(w)}if(!Em(a)){const{message:w}=X("MISSING_OR_INVALID",`request() ${JSON.stringify(a)}`);throw new Error(w)}if(!Im(y,l,a.method)){const{message:w}=X("MISSING_OR_INVALID",`request() method: ${a.method}`);throw new Error(w)}if(d&&!xm(d,rc)){const{message:w}=X("MISSING_OR_INVALID",`request() expiry: ${d}. Expiry must be a number (in seconds) between ${rc.min} and ${rc.max}`);throw new Error(w)}},this.isValidRespond=async r=>{if(!hr(r)){const{message:l}=X("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(l)}const{topic:n,response:a}=r;if(await this.isValidSessionTopic(n),!Pm(a)){const{message:l}=X("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(a)}`);throw new Error(l)}},this.isValidPing=async r=>{if(!hr(r)){const{message:a}=X("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(a)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!hr(r)){const{message:y}=X("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(y)}const{topic:n,event:a,chainId:l}=r;await this.isValidSessionTopic(n);const{namespaces:d}=this.client.session.get(n);if(!Th(d,l)){const{message:y}=X("MISSING_OR_INVALID",`emit() chainId: ${l}`);throw new Error(y)}if(!Sm(a)){const{message:y}=X("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(a)}`);throw new Error(y)}if(!Cm(d,l,a.name)){const{message:y}=X("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(a)}`);throw new Error(y)}},this.isValidDisconnect=async r=>{if(!hr(r)){const{message:a}=X("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(a)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.getVerifyContext=async(r,n)=>{const a={verified:{verifyUrl:n.verifyUrl||la,validation:"UNKNOWN",origin:n.url||""}};try{const l=await this.client.core.verify.resolve({attestationId:r,verifyUrl:n.verifyUrl});l&&(a.verified.origin=l.origin,a.verified.isScam=l.isScam,a.verified.validation=l.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.info(l)}return this.client.logger.info(`Verify context: ${JSON.stringify(a)}`),a},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(a=>{if(!hs(a,!1)){const{message:l}=X("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(a)}`);throw new Error(l)}})}}async isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Gt.message,async i=>{const{topic:r,message:n}=i;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;const a=await this.client.core.crypto.decode(r,n);try{mc(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a})):wc(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a})}catch(l){this.client.logger.error(l)}})}registerExpirerEvents(){this.client.core.expirer.on(Sr.expired,async i=>{const{topic:r,id:n}=Tl(i.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,X("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession(r,!0),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(Hs.create,i=>this.onPairingCreated(i))}isValidPairingTopic(i){if(!hs(i,!1)){const{message:r}=X("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(i)){const{message:r}=X("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(r)}if(wi(this.client.core.pairing.pairings.get(i).expiry)){const{message:r}=X("EXPIRED",`pairing topic: ${i}`);throw new Error(r)}}async isValidSessionTopic(i){if(!hs(i,!1)){const{message:r}=X("MISSING_OR_INVALID",`session topic should be a string: ${i}`);throw new Error(r)}if(!this.client.session.keys.includes(i)){const{message:r}=X("NO_MATCHING_KEY",`session topic doesn't exist: ${i}`);throw new Error(r)}if(wi(this.client.session.get(i).expiry)){await this.deleteSession(i);const{message:r}=X("EXPIRED",`session topic: ${i}`);throw new Error(r)}}async isValidSessionOrPairingTopic(i){if(this.client.session.keys.includes(i))await this.isValidSessionTopic(i);else if(this.client.core.pairing.pairings.keys.includes(i))this.isValidPairingTopic(i);else if(hs(i,!1)){const{message:r}=X("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${i}`);throw new Error(r)}else{const{message:r}=X("MISSING_OR_INVALID",`session or pairing topic should be a string: ${i}`);throw new Error(r)}}async isValidProposalId(i){if(!Om(i)){const{message:r}=X("MISSING_OR_INVALID",`proposal id should be a number: ${i}`);throw new Error(r)}if(!this.client.proposal.keys.includes(i)){const{message:r}=X("NO_MATCHING_KEY",`proposal id doesn't exist: ${i}`);throw new Error(r)}if(wi(this.client.proposal.get(i).expiry)){await this.deleteProposal(i);const{message:r}=X("EXPIRED",`proposal id: ${i}`);throw new Error(r)}}}class Lb extends ma{constructor(i,r){super(i,r,xb,xc),this.core=i,this.logger=r}}class qb extends ma{constructor(i,r){super(i,r,Pb,xc),this.core=i,this.logger=r}}class zb extends ma{constructor(i,r){super(i,r,Cb,xc,n=>n.id),this.core=i,this.logger=r}}let Mb=class uf extends Tw{constructor(i){super(i),this.protocol=nf,this.version=af,this.name=tc.name,this.events=new Kr.EventEmitter,this.on=(n,a)=>this.events.on(n,a),this.once=(n,a)=>this.events.once(n,a),this.off=(n,a)=>this.events.off(n,a),this.removeListener=(n,a)=>this.events.removeListener(n,a),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(a){throw this.logger.error(a.message),a}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(a){throw this.logger.error(a.message),a}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(a){throw this.logger.error(a.message),a}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(a){throw this.logger.error(a.message),a}},this.update=async n=>{try{return await this.engine.update(n)}catch(a){throw this.logger.error(a.message),a}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(a){throw this.logger.error(a.message),a}},this.request=async n=>{try{return await this.engine.request(n)}catch(a){throw this.logger.error(a.message),a}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(a){throw this.logger.error(a.message),a}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(a){throw this.logger.error(a.message),a}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(a){throw this.logger.error(a.message),a}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(a){throw this.logger.error(a.message),a}},this.find=n=>{try{return this.engine.find(n)}catch(a){throw this.logger.error(a.message),a}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.name=(i==null?void 0:i.name)||tc.name,this.metadata=(i==null?void 0:i.metadata)||pm();const r=typeof(i==null?void 0:i.logger)<"u"&&typeof(i==null?void 0:i.logger)!="string"?i.logger:Oe.pino(Oe.getDefaultLoggerOptions({level:(i==null?void 0:i.logger)||tc.logger}));this.core=(i==null?void 0:i.core)||new Ib(i),this.logger=Oe.generateChildLogger(r,this.name),this.session=new qb(this.core,this.logger),this.proposal=new Lb(this.core,this.logger),this.pendingRequest=new zb(this.core,this.logger),this.engine=new Db(this)}static async init(i){const r=new uf(i);return await r.initialize(),r}get context(){return Oe.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(i){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(i.message),i}}};const yl="error",jb="wss://relay.walletconnect.com",Ub="wc",Hb="universal_provider",ml=`${Ub}@2:${Hb}:`,kb="https://rpc.walletconnect.com/v1/",ai={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var js=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},fc={exports:{}};/** +import{e as K0,r as Fs,f as ie,h as Kr,i as V0,w as Cl,j as Ol,k as gc,t as ga,m as F0,o as ea,p as B0,q as _i,D as G0,s as W0,N as X,u as J0,v as oc,x as Q0,V as Y0,R as X0,F as Sh,K as Z0,y as em,L as tm,z as Ch,$ as rm,A as im,B as Vs,Z as Oh,J as sm,X as nm,E as vc,_ as Rl,C as Dr,G as am,H as om,I as us,M as $t,U as tr,O as wi,P as hr,Q as cm,S as hs,T as Tl,W as um,Y as hm,a0 as lm,a1 as Al,a2 as fm,a3 as Nl,a4 as $l,a5 as ls,a6 as cc,a7 as oa,a8 as fs,a9 as pm,aa as ca,ab as dm,ac as gm,ad as vm,ae as ta,af as ym,ag as mm,ah as Vo,ai as Rh,aj as wm,ak as _m,al as bm,am as Th,an as Em,ao as Im,ap as xm,aq as Pm,ar as Sm,as as Cm,at as Om,au as Us,av as Dl,aw as Fo,ax as Rm,ay as Tm,az as Am}from"./index-iGWvbPrT.js";import{s as Bs,a as va,i as Ah,c as Nm,b as $m,f as yc,p as Dm,J as ni,d as mc,e as wc,g as _c,h as mi,j as si,k as Ks,l as Lm,m as qm,H as Ii}from"./http-I_tKnr4x.js";const zm=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,Mm=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,jm=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function Um(c,i){if(c==="__proto__"||c==="constructor"&&i&&typeof i=="object"&&"prototype"in i){Hm(c);return}return i}function Hm(c){console.warn(`[destr] Dropping "${c}" key to prevent prototype pollution.`)}function ra(c,i={}){if(typeof c!="string")return c;const r=c.trim();if(c[0]==='"'&&c.at(-1)==='"'&&!c.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!jm.test(c)){if(i.strict)throw new SyntaxError("[destr] Invalid JSON");return c}try{if(zm.test(c)||Mm.test(c)){if(i.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(c,Um)}return JSON.parse(c)}catch(n){if(i.strict)throw n;return c}}function km(c){return!c||typeof c.then!="function"?Promise.resolve(c):c}function Ut(c,...i){try{return km(c(...i))}catch(r){return Promise.reject(r)}}function Km(c){const i=typeof c;return c===null||i!=="object"&&i!=="function"}function Vm(c){const i=Object.getPrototypeOf(c);return!i||i.isPrototypeOf(Object)}function ua(c){if(Km(c))return String(c);if(Vm(c)||Array.isArray(c))return JSON.stringify(c);if(typeof c.toJSON=="function")return ua(c.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Ll(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const uc="base64:";function Fm(c){if(typeof c=="string")return c;Ll();const i=Buffer.from(c).toString("base64");return uc+i}function Bm(c){return typeof c!="string"||!c.startsWith(uc)?c:(Ll(),Buffer.from(c.slice(uc.length),"base64"))}function ur(c){return c?c.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function Gm(...c){return ur(c.join(":"))}function ia(c){return c=ur(c),c?c+":":""}const Wm="memory",Jm=()=>{const c=new Map;return{name:Wm,options:{},hasItem(i){return c.has(i)},getItem(i){return c.get(i)??null},getItemRaw(i){return c.get(i)??null},setItem(i,r){c.set(i,r)},setItemRaw(i,r){c.set(i,r)},removeItem(i){c.delete(i)},getKeys(){return Array.from(c.keys())},clear(){c.clear()},dispose(){c.clear()}}};function Qm(c={}){const i={mounts:{"":c.driver||Jm()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=v=>{for(const E of i.mountpoints)if(v.startsWith(E))return{base:E,relativeKey:v.slice(E.length),driver:i.mounts[E]};return{base:"",relativeKey:v,driver:i.mounts[""]}},n=(v,E)=>i.mountpoints.filter(C=>C.startsWith(v)||E&&v.startsWith(C)).map(C=>({relativeBase:v.length>C.length?v.slice(C.length):void 0,mountpoint:C,driver:i.mounts[C]})),a=(v,E)=>{if(i.watching){E=ur(E);for(const C of i.watchListeners)C(v,E)}},l=async()=>{if(!i.watching){i.watching=!0;for(const v in i.mounts)i.unwatch[v]=await Nh(i.mounts[v],a,v)}},d=async()=>{if(i.watching){for(const v in i.unwatch)await i.unwatch[v]();i.unwatch={},i.watching=!1}},y=(v,E,C)=>{const T=new Map,j=D=>{let V=T.get(D.base);return V||(V={driver:D.driver,base:D.base,items:[]},T.set(D.base,V)),V};for(const D of v){const V=typeof D=="string",re=ur(V?D:D.key),ce=V?void 0:D.value,ue=V||!D.options?E:{...E,...D.options},he=r(re);j(he).items.push({key:re,value:ce,relativeKey:he.relativeKey,options:ue})}return Promise.all([...T.values()].map(D=>C(D))).then(D=>D.flat())},w={hasItem(v,E={}){v=ur(v);const{relativeKey:C,driver:T}=r(v);return Ut(T.hasItem,C,E)},getItem(v,E={}){v=ur(v);const{relativeKey:C,driver:T}=r(v);return Ut(T.getItem,C,E).then(j=>ra(j))},getItems(v,E){return y(v,E,C=>C.driver.getItems?Ut(C.driver.getItems,C.items.map(T=>({key:T.relativeKey,options:T.options})),E).then(T=>T.map(j=>({key:Gm(C.base,j.key),value:ra(j.value)}))):Promise.all(C.items.map(T=>Ut(C.driver.getItem,T.relativeKey,T.options).then(j=>({key:T.key,value:ra(j)})))))},getItemRaw(v,E={}){v=ur(v);const{relativeKey:C,driver:T}=r(v);return T.getItemRaw?Ut(T.getItemRaw,C,E):Ut(T.getItem,C,E).then(j=>Bm(j))},async setItem(v,E,C={}){if(E===void 0)return w.removeItem(v);v=ur(v);const{relativeKey:T,driver:j}=r(v);j.setItem&&(await Ut(j.setItem,T,ua(E),C),j.watch||a("update",v))},async setItems(v,E){await y(v,E,async C=>{C.driver.setItems&&await Ut(C.driver.setItems,C.items.map(T=>({key:T.relativeKey,value:ua(T.value),options:T.options})),E),C.driver.setItem&&await Promise.all(C.items.map(T=>Ut(C.driver.setItem,T.relativeKey,ua(T.value),T.options)))})},async setItemRaw(v,E,C={}){if(E===void 0)return w.removeItem(v,C);v=ur(v);const{relativeKey:T,driver:j}=r(v);if(j.setItemRaw)await Ut(j.setItemRaw,T,E,C);else if(j.setItem)await Ut(j.setItem,T,Fm(E),C);else return;j.watch||a("update",v)},async removeItem(v,E={}){typeof E=="boolean"&&(E={removeMeta:E}),v=ur(v);const{relativeKey:C,driver:T}=r(v);T.removeItem&&(await Ut(T.removeItem,C,E),(E.removeMeta||E.removeMata)&&await Ut(T.removeItem,C+"$",E),T.watch||a("remove",v))},async getMeta(v,E={}){typeof E=="boolean"&&(E={nativeOnly:E}),v=ur(v);const{relativeKey:C,driver:T}=r(v),j=Object.create(null);if(T.getMeta&&Object.assign(j,await Ut(T.getMeta,C,E)),!E.nativeOnly){const D=await Ut(T.getItem,C+"$",E).then(V=>ra(V));D&&typeof D=="object"&&(typeof D.atime=="string"&&(D.atime=new Date(D.atime)),typeof D.mtime=="string"&&(D.mtime=new Date(D.mtime)),Object.assign(j,D))}return j},setMeta(v,E,C={}){return this.setItem(v+"$",E,C)},removeMeta(v,E={}){return this.removeItem(v+"$",E)},async getKeys(v,E={}){v=ia(v);const C=n(v,!0);let T=[];const j=[];for(const D of C){const re=(await Ut(D.driver.getKeys,D.relativeBase,E)).map(ce=>D.mountpoint+ur(ce)).filter(ce=>!T.some(ue=>ce.startsWith(ue)));j.push(...re),T=[D.mountpoint,...T.filter(ce=>!ce.startsWith(D.mountpoint))]}return v?j.filter(D=>D.startsWith(v)&&!D.endsWith("$")):j.filter(D=>!D.endsWith("$"))},async clear(v,E={}){v=ia(v),await Promise.all(n(v,!1).map(async C=>{if(C.driver.clear)return Ut(C.driver.clear,C.relativeBase,E);if(C.driver.removeItem){const T=await C.driver.getKeys(C.relativeBase||"",E);return Promise.all(T.map(j=>C.driver.removeItem(j,E)))}}))},async dispose(){await Promise.all(Object.values(i.mounts).map(v=>$h(v)))},async watch(v){return await l(),i.watchListeners.push(v),async()=>{i.watchListeners=i.watchListeners.filter(E=>E!==v),i.watchListeners.length===0&&await d()}},async unwatch(){i.watchListeners=[],await d()},mount(v,E){if(v=ia(v),v&&i.mounts[v])throw new Error(`already mounted at ${v}`);return v&&(i.mountpoints.push(v),i.mountpoints.sort((C,T)=>T.length-C.length)),i.mounts[v]=E,i.watching&&Promise.resolve(Nh(E,a,v)).then(C=>{i.unwatch[v]=C}).catch(console.error),w},async unmount(v,E=!0){v=ia(v),!(!v||!i.mounts[v])&&(i.watching&&v in i.unwatch&&(i.unwatch[v](),delete i.unwatch[v]),E&&await $h(i.mounts[v]),i.mountpoints=i.mountpoints.filter(C=>C!==v),delete i.mounts[v])},getMount(v=""){v=ur(v)+":";const E=r(v);return{driver:E.driver,base:E.base}},getMounts(v="",E={}){return v=ur(v),n(v,E.parents).map(T=>({driver:T.driver,base:T.mountpoint}))}};return w}function Nh(c,i,r){return c.watch?c.watch((n,a)=>i(n,r+a)):()=>{}}async function $h(c){typeof c.dispose=="function"&&await Ut(c.dispose)}function Ui(c){return new Promise((i,r)=>{c.oncomplete=c.onsuccess=()=>i(c.result),c.onabort=c.onerror=()=>r(c.error)})}function ql(c,i){const r=indexedDB.open(c);r.onupgradeneeded=()=>r.result.createObjectStore(i);const n=Ui(r);return(a,l)=>n.then(d=>l(d.transaction(i,a).objectStore(i)))}let Bo;function Gs(){return Bo||(Bo=ql("keyval-store","keyval")),Bo}function Dh(c,i=Gs()){return i("readonly",r=>Ui(r.get(c)))}function Ym(c,i,r=Gs()){return r("readwrite",n=>(n.put(i,c),Ui(n.transaction)))}function Xm(c,i=Gs()){return i("readwrite",r=>(r.delete(c),Ui(r.transaction)))}function Zm(c=Gs()){return c("readwrite",i=>(i.clear(),Ui(i.transaction)))}function ew(c,i){return c.openCursor().onsuccess=function(){this.result&&(i(this.result),this.result.continue())},Ui(c.transaction)}function tw(c=Gs()){return c("readonly",i=>{if(i.getAllKeys)return Ui(i.getAllKeys());const r=[];return ew(i,n=>r.push(n.key)).then(()=>r)})}const rw="idb-keyval";var iw=(c={})=>{const i=c.base&&c.base.length>0?`${c.base}:`:"",r=a=>i+a;let n;return c.dbName&&c.storeName&&(n=ql(c.dbName,c.storeName)),{name:rw,options:c,async hasItem(a){return!(typeof await Dh(r(a),n)>"u")},async getItem(a){return await Dh(r(a),n)??null},setItem(a,l){return Ym(r(a),l,n)},removeItem(a){return Xm(r(a),n)},getKeys(){return tw(n)},clear(){return Zm(n)}}};const sw="WALLET_CONNECT_V2_INDEXED_DB",nw="keyvaluestorage";let aw=class{constructor(){this.indexedDb=Qm({driver:iw({dbName:sw,storeName:nw})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(i=>[i.key,i.value])}async getItem(i){const r=await this.indexedDb.getItem(i);if(r!==null)return r}async setItem(i,r){await this.indexedDb.setItem(i,Bs(r))}async removeItem(i){await this.indexedDb.removeItem(i)}};var Go=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ha={exports:{}};(function(){let c;function i(){}c=i,c.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},c.prototype.setItem=function(r,n){this[r]=String(n)},c.prototype.removeItem=function(r){delete this[r]},c.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},c.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},c.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Go<"u"&&Go.localStorage?ha.exports=Go.localStorage:typeof window<"u"&&window.localStorage?ha.exports=window.localStorage:ha.exports=new i})();function ow(c){var i;return[c[0],va((i=c[1])!=null?i:"")]}let cw=class{constructor(){this.localStorage=ha.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(ow)}async getItem(i){const r=this.localStorage.getItem(i);if(r!==null)return va(r)}async setItem(i,r){this.localStorage.setItem(i,Bs(r))}async removeItem(i){this.localStorage.removeItem(i)}};const uw="wc_storage_version",Lh=1,hw=async(c,i,r)=>{const n=uw,a=await i.getItem(n);if(a&&a>=Lh){r(i);return}const l=await c.getKeys();if(!l.length){r(i);return}const d=[];for(;l.length;){const y=l.shift();if(!y)continue;const w=y.toLowerCase();if(w.includes("wc@")||w.includes("walletconnect")||w.includes("wc_")||w.includes("wallet_connect")){const v=await c.getItem(y);await i.setItem(y,v),d.push(y)}}await i.setItem(n,Lh),r(i),lw(c,d)},lw=async(c,i)=>{i.length&&i.forEach(async r=>{await c.removeItem(r)})};let fw=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const i=new cw;this.storage=i;try{const r=new aw;hw(i,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(i){return await this.initialize(),this.storage.getItem(i)}async setItem(i,r){return await this.initialize(),this.storage.setItem(i,r)}async removeItem(i){return await this.initialize(),this.storage.removeItem(i)}async initialize(){this.initialized||await new Promise(i=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),i())},20)})}};var ps={},$s={},Wo={},Ds={};class Hi{}const pw=Object.freeze(Object.defineProperty({__proto__:null,IEvents:Hi},Symbol.toStringTag,{value:"Module"})),dw=K0(pw);var qh;function gw(){if(qh)return Ds;qh=1,Object.defineProperty(Ds,"__esModule",{value:!0}),Ds.IHeartBeat=void 0;const c=dw;class i extends c.IEvents{constructor(n){super()}}return Ds.IHeartBeat=i,Ds}var zh;function zl(){return zh||(zh=1,function(c){Object.defineProperty(c,"__esModule",{value:!0}),Fs.__exportStar(gw(),c)}(Wo)),Wo}var Jo={},Mi={},Mh;function vw(){if(Mh)return Mi;Mh=1,Object.defineProperty(Mi,"__esModule",{value:!0}),Mi.HEARTBEAT_EVENTS=Mi.HEARTBEAT_INTERVAL=void 0;const c=ie;return Mi.HEARTBEAT_INTERVAL=c.FIVE_SECONDS,Mi.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"},Mi}var jh;function Ml(){return jh||(jh=1,function(c){Object.defineProperty(c,"__esModule",{value:!0}),Fs.__exportStar(vw(),c)}(Jo)),Jo}var Uh;function yw(){if(Uh)return $s;Uh=1,Object.defineProperty($s,"__esModule",{value:!0}),$s.HeartBeat=void 0;const c=Fs,i=Kr,r=ie,n=zl(),a=Ml();class l extends n.IHeartBeat{constructor(y){super(y),this.events=new i.EventEmitter,this.interval=a.HEARTBEAT_INTERVAL,this.interval=(y==null?void 0:y.interval)||a.HEARTBEAT_INTERVAL}static init(y){return c.__awaiter(this,void 0,void 0,function*(){const w=new l(y);return yield w.init(),w})}init(){return c.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(y,w){this.events.on(y,w)}once(y,w){this.events.once(y,w)}off(y,w){this.events.off(y,w)}removeListener(y,w){this.events.removeListener(y,w)}initialize(){return c.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),r.toMiliseconds(this.interval))})}pulse(){this.events.emit(a.HEARTBEAT_EVENTS.pulse)}}return $s.HeartBeat=l,$s}(function(c){Object.defineProperty(c,"__esModule",{value:!0});const i=Fs;i.__exportStar(yw(),c),i.__exportStar(zl(),c),i.__exportStar(Ml(),c)})(ps);var Oe={},Qo,Hh;function mw(){if(Hh)return Qo;Hh=1;function c(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}Qo=i;function i(r,n,a){var l=a&&a.stringify||c,d=1;if(typeof r=="object"&&r!==null){var y=n.length+d;if(y===1)return r;var w=new Array(y);w[0]=l(r);for(var v=1;v-1?j:0,r.charCodeAt(V+1)){case 100:case 102:if(T>=E||n[T]==null)break;j=E||n[T]==null)break;j=E||n[T]===void 0)break;j",j=V+2,V++;break}C+=l(n[T]),j=V+2,V++;break;case 115:if(T>=E)break;j-1&&(Ee=!1);const Re=["error","fatal","warn","info","debug","trace"];typeof W=="function"&&(W.error=W.fatal=W.warn=W.info=W.debug=W.trace=W),$.enabled===!1&&($.level="silent");const et=$.level||"info",R=Object.create(W);R.log||(R.log=re),Object.defineProperty(R,"levelVal",{get:je}),Object.defineProperty(R,"level",{get:Te,set:J});const M={transmit:k,serialize:te,asObject:$.browser.asObject,levels:Re,timestamp:j($)};R.levels=a.levels,R.level=et,R.setMaxListeners=R.getMaxListeners=R.emit=R.addListener=R.on=R.prependListener=R.once=R.prependOnceListener=R.removeListener=R.removeAllListeners=R.listeners=R.listenerCount=R.eventNames=R.write=R.flush=re,R.serializers=ve,R._serialize=te,R._stdErrSerialize=Ee,R.child=F,k&&(R._logEvent=C());function je(){return this.level==="silent"?1/0:this.levels.values[this.level]}function Te(){return this._level}function J(K){if(K!=="silent"&&!this.levels.values[K])throw Error("unknown level "+K);this._level=K,l(M,R,"error","log"),l(M,R,"fatal","error"),l(M,R,"warn","error"),l(M,R,"info","log"),l(M,R,"debug","log"),l(M,R,"trace","log")}function F(K,B){if(!K)throw new Error("missing bindings for child Pino");B=B||{},te&&K.serializers&&(B.serializers=K.serializers);const ut=B.serializers;if(te&&ut){var ke=Object.assign({},ve,ut),Lr=$.browser.serialize===!0?Object.keys(ke):te;delete K.serializers,w([K],Lr,ke,this._stdErrSerialize)}function _e(It){this._childLevel=(It._childLevel|0)+1,this.error=v(It,K,"error"),this.fatal=v(It,K,"fatal"),this.warn=v(It,K,"warn"),this.info=v(It,K,"info"),this.debug=v(It,K,"debug"),this.trace=v(It,K,"trace"),ke&&(this.serializers=ke,this._serialize=Lr),k&&(this._logEvent=C([].concat(It._logEvent.bindings,K)))}return _e.prototype=this,new _e(this)}return R}a.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},a.stdSerializers=r,a.stdTimeFunctions=Object.assign({},{nullTime:ce,epochTime:ue,unixTime:he,isoTime:fe});function l($,k,W,ve){const te=Object.getPrototypeOf(k);k[W]=k.levelVal>k.levels.values[W]?re:te[W]?te[W]:i[W]||i[ve]||re,d($,k,W)}function d($,k,W){!$.transmit&&k[W]===re||(k[W]=function(ve){return function(){const Ee=$.timestamp(),Re=new Array(arguments.length),et=Object.getPrototypeOf&&Object.getPrototypeOf(this)===i?i:this;for(var R=0;R-1&&Ee in W&&($[te][Ee]=W[Ee]($[te][Ee]))}function v($,k,W){return function(){const ve=new Array(1+arguments.length);ve[0]=k;for(var te=1;te"u"?v=r(y,w):v=y.bindings().context||"",v}er.getLoggerContext=a;function l(y,w,v=c.PINO_CUSTOM_CONTEXT_KEY){const E=a(y,v);return E.trim()?`${E}/${w}`:w}er.formatChildLoggerContext=l;function d(y,w,v=c.PINO_CUSTOM_CONTEXT_KEY){const E=l(y,w,v),C=y.child({context:E});return n(C,E,v)}return er.generateChildLogger=d,er}(function(c){Object.defineProperty(c,"__esModule",{value:!0}),c.pino=void 0;const i=Fs,r=i.__importDefault(ww());Object.defineProperty(c,"pino",{enumerable:!0,get:function(){return r.default}}),i.__exportStar(jl(),c),i.__exportStar(_w(),c)})(Oe);class bw extends Hi{constructor(i){super(),this.opts=i,this.protocol="wc",this.version=2}}class Ew extends Hi{constructor(i,r){super(),this.core=i,this.logger=r,this.records=new Map}}class Iw{constructor(i,r){this.logger=i,this.core=r}}let xw=class extends Hi{constructor(i,r){super(),this.relayer=i,this.logger=r}},Pw=class extends Hi{constructor(i){super()}},Sw=class{constructor(i,r,n,a){this.core=i,this.logger=r,this.name=n}};class Cw extends Hi{constructor(i,r){super(),this.relayer=i,this.logger=r}}let Ow=class extends Hi{constructor(i,r){super(),this.core=i,this.logger=r}},Rw=class{constructor(i,r){this.projectId=i,this.logger=r}},Tw=class{constructor(i){this.opts=i,this.protocol="wc",this.version=2}},Aw=class{constructor(i){this.client=i}};var bc={},Ul={};(function(c){Object.defineProperty(c,"__esModule",{value:!0});var i=V0,r=Cl;c.DIGEST_LENGTH=64,c.BLOCK_SIZE=128;var n=function(){function y(){this.digestLength=c.DIGEST_LENGTH,this.blockSize=c.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return y.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},y.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},y.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._tempHi),r.wipe(this._tempLo),this.reset()},y.prototype.update=function(w,v){if(v===void 0&&(v=w.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var E=0;if(this._bytesHashed+=v,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=w[E++],v--;this._bufferLength===this.blockSize&&(l(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(v>=this.blockSize&&(E=l(this._tempHi,this._tempLo,this._stateHi,this._stateLo,w,E,v),v%=this.blockSize);v>0;)this._buffer[this._bufferLength++]=w[E++],v--;return this},y.prototype.finish=function(w){if(!this._finished){var v=this._bytesHashed,E=this._bufferLength,C=v/536870912|0,T=v<<3,j=v%128<112?128:256;this._buffer[E]=128;for(var D=E+1;D0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},y.prototype.restoreState=function(w){return this._stateHi.set(w.stateHi),this._stateLo.set(w.stateLo),this._bufferLength=w.bufferLength,w.buffer&&this._buffer.set(w.buffer),this._bytesHashed=w.bytesHashed,this._finished=!1,this},y.prototype.cleanSavedState=function(w){r.wipe(w.stateHi),r.wipe(w.stateLo),w.buffer&&r.wipe(w.buffer),w.bufferLength=0,w.bytesHashed=0},y}();c.SHA512=n;var a=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function l(y,w,v,E,C,T,j){for(var D=v[0],V=v[1],re=v[2],ce=v[3],ue=v[4],he=v[5],fe=v[6],pe=v[7],$=E[0],k=E[1],W=E[2],ve=E[3],te=E[4],Ee=E[5],Re=E[6],et=E[7],R,M,je,Te,J,F,K,B;j>=128;){for(var ut=0;ut<16;ut++){var ke=8*ut+T;y[ut]=i.readUint32BE(C,ke),w[ut]=i.readUint32BE(C,ke+4)}for(var ut=0;ut<80;ut++){var Lr=D,_e=V,It=re,N=ce,A=ue,S=he,u=fe,b=pe,Z=$,oe=k,me=W,Ae=ve,$e=te,xe=Ee,xt=Re,mt=et;if(R=pe,M=et,J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=(ue>>>14|te<<18)^(ue>>>18|te<<14)^(te>>>9|ue<<23),M=(te>>>14|ue<<18)^(te>>>18|ue<<14)^(ue>>>9|te<<23),J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,R=ue&he^~ue&fe,M=te&Ee^~te&Re,J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,R=a[ut*2],M=a[ut*2+1],J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,R=y[ut%16],M=w[ut%16],J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,je=K&65535|B<<16,Te=J&65535|F<<16,R=je,M=Te,J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=(D>>>28|$<<4)^($>>>2|D<<30)^($>>>7|D<<25),M=($>>>28|D<<4)^(D>>>2|$<<30)^(D>>>7|$<<25),J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,R=D&V^D&re^V&re,M=$&k^$&W^k&W,J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,b=K&65535|B<<16,mt=J&65535|F<<16,R=N,M=Ae,J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=je,M=Te,J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,N=K&65535|B<<16,Ae=J&65535|F<<16,V=Lr,re=_e,ce=It,ue=N,he=A,fe=S,pe=u,D=b,k=Z,W=oe,ve=me,te=Ae,Ee=$e,Re=xe,et=xt,$=mt,ut%16===15)for(var ke=0;ke<16;ke++)R=y[ke],M=w[ke],J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=y[(ke+9)%16],M=w[(ke+9)%16],J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,je=y[(ke+1)%16],Te=w[(ke+1)%16],R=(je>>>1|Te<<31)^(je>>>8|Te<<24)^je>>>7,M=(Te>>>1|je<<31)^(Te>>>8|je<<24)^(Te>>>7|je<<25),J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,je=y[(ke+14)%16],Te=w[(ke+14)%16],R=(je>>>19|Te<<13)^(Te>>>29|je<<3)^je>>>6,M=(Te>>>19|je<<13)^(je>>>29|Te<<3)^(Te>>>6|je<<26),J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,y[ke]=K&65535|B<<16,w[ke]=J&65535|F<<16}R=D,M=$,J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=v[0],M=E[0],J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,v[0]=D=K&65535|B<<16,E[0]=$=J&65535|F<<16,R=V,M=k,J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=v[1],M=E[1],J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,v[1]=V=K&65535|B<<16,E[1]=k=J&65535|F<<16,R=re,M=W,J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=v[2],M=E[2],J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,v[2]=re=K&65535|B<<16,E[2]=W=J&65535|F<<16,R=ce,M=ve,J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=v[3],M=E[3],J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,v[3]=ce=K&65535|B<<16,E[3]=ve=J&65535|F<<16,R=ue,M=te,J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=v[4],M=E[4],J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,v[4]=ue=K&65535|B<<16,E[4]=te=J&65535|F<<16,R=he,M=Ee,J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=v[5],M=E[5],J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,v[5]=he=K&65535|B<<16,E[5]=Ee=J&65535|F<<16,R=fe,M=Re,J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=v[6],M=E[6],J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,v[6]=fe=K&65535|B<<16,E[6]=Re=J&65535|F<<16,R=pe,M=et,J=M&65535,F=M>>>16,K=R&65535,B=R>>>16,R=v[7],M=E[7],J+=M&65535,F+=M>>>16,K+=R&65535,B+=R>>>16,F+=J>>>16,K+=F>>>16,B+=K>>>16,v[7]=pe=K&65535|B<<16,E[7]=et=J&65535|F<<16,T+=128,j-=128}return T}function d(y){var w=new n;w.update(y);var v=w.digest();return w.clean(),v}c.hash=d})(Ul);(function(c){Object.defineProperty(c,"__esModule",{value:!0}),c.convertSecretKeyToX25519=c.convertPublicKeyToX25519=c.verify=c.sign=c.extractPublicKeyFromSecretKey=c.generateKeyPair=c.generateKeyPairFromSeed=c.SEED_LENGTH=c.SECRET_KEY_LENGTH=c.PUBLIC_KEY_LENGTH=c.SIGNATURE_LENGTH=void 0;const i=Ol,r=Ul,n=Cl;c.SIGNATURE_LENGTH=64,c.PUBLIC_KEY_LENGTH=32,c.SECRET_KEY_LENGTH=64,c.SEED_LENGTH=32;function a(N){const A=new Float64Array(16);if(N)for(let S=0;S>16&1),S[oe-1]&=65535;S[15]=u[15]-32767-(S[14]>>16&1);const Z=S[15]>>16&1;S[14]&=65535,V(u,S,1-Z)}for(let b=0;b<16;b++)N[2*b]=u[b]&255,N[2*b+1]=u[b]>>8}function ce(N,A){let S=0;for(let u=0;u<32;u++)S|=N[u]^A[u];return(1&S-1>>>8)-1}function ue(N,A){const S=new Uint8Array(32),u=new Uint8Array(32);return re(S,N),re(u,A),ce(S,u)}function he(N){const A=new Uint8Array(32);return re(A,N),A[0]&1}function fe(N,A){for(let S=0;S<16;S++)N[S]=A[2*S]+(A[2*S+1]<<8);N[15]&=32767}function pe(N,A,S){for(let u=0;u<16;u++)N[u]=A[u]+S[u]}function $(N,A,S){for(let u=0;u<16;u++)N[u]=A[u]-S[u]}function k(N,A,S){let u,b,Z=0,oe=0,me=0,Ae=0,$e=0,xe=0,xt=0,mt=0,nt=0,Le=0,Je=0,Qe=0,at=0,Ue=0,Ye=0,Ne=0,Ke=0,ht=0,ze=0,Pt=0,Dt=0,Ht=0,kt=0,zt=0,Wt=0,rr=0,qr=0,Jt=0,Vr=0,oi=0,xi=0,lt=S[0],tt=S[1],ft=S[2],pt=S[3],ot=S[4],rt=S[5],St=S[6],Ct=S[7],dt=S[8],Ot=S[9],gt=S[10],wt=S[11],vt=S[12],We=S[13],Rt=S[14],Tt=S[15];u=A[0],Z+=u*lt,oe+=u*tt,me+=u*ft,Ae+=u*pt,$e+=u*ot,xe+=u*rt,xt+=u*St,mt+=u*Ct,nt+=u*dt,Le+=u*Ot,Je+=u*gt,Qe+=u*wt,at+=u*vt,Ue+=u*We,Ye+=u*Rt,Ne+=u*Tt,u=A[1],oe+=u*lt,me+=u*tt,Ae+=u*ft,$e+=u*pt,xe+=u*ot,xt+=u*rt,mt+=u*St,nt+=u*Ct,Le+=u*dt,Je+=u*Ot,Qe+=u*gt,at+=u*wt,Ue+=u*vt,Ye+=u*We,Ne+=u*Rt,Ke+=u*Tt,u=A[2],me+=u*lt,Ae+=u*tt,$e+=u*ft,xe+=u*pt,xt+=u*ot,mt+=u*rt,nt+=u*St,Le+=u*Ct,Je+=u*dt,Qe+=u*Ot,at+=u*gt,Ue+=u*wt,Ye+=u*vt,Ne+=u*We,Ke+=u*Rt,ht+=u*Tt,u=A[3],Ae+=u*lt,$e+=u*tt,xe+=u*ft,xt+=u*pt,mt+=u*ot,nt+=u*rt,Le+=u*St,Je+=u*Ct,Qe+=u*dt,at+=u*Ot,Ue+=u*gt,Ye+=u*wt,Ne+=u*vt,Ke+=u*We,ht+=u*Rt,ze+=u*Tt,u=A[4],$e+=u*lt,xe+=u*tt,xt+=u*ft,mt+=u*pt,nt+=u*ot,Le+=u*rt,Je+=u*St,Qe+=u*Ct,at+=u*dt,Ue+=u*Ot,Ye+=u*gt,Ne+=u*wt,Ke+=u*vt,ht+=u*We,ze+=u*Rt,Pt+=u*Tt,u=A[5],xe+=u*lt,xt+=u*tt,mt+=u*ft,nt+=u*pt,Le+=u*ot,Je+=u*rt,Qe+=u*St,at+=u*Ct,Ue+=u*dt,Ye+=u*Ot,Ne+=u*gt,Ke+=u*wt,ht+=u*vt,ze+=u*We,Pt+=u*Rt,Dt+=u*Tt,u=A[6],xt+=u*lt,mt+=u*tt,nt+=u*ft,Le+=u*pt,Je+=u*ot,Qe+=u*rt,at+=u*St,Ue+=u*Ct,Ye+=u*dt,Ne+=u*Ot,Ke+=u*gt,ht+=u*wt,ze+=u*vt,Pt+=u*We,Dt+=u*Rt,Ht+=u*Tt,u=A[7],mt+=u*lt,nt+=u*tt,Le+=u*ft,Je+=u*pt,Qe+=u*ot,at+=u*rt,Ue+=u*St,Ye+=u*Ct,Ne+=u*dt,Ke+=u*Ot,ht+=u*gt,ze+=u*wt,Pt+=u*vt,Dt+=u*We,Ht+=u*Rt,kt+=u*Tt,u=A[8],nt+=u*lt,Le+=u*tt,Je+=u*ft,Qe+=u*pt,at+=u*ot,Ue+=u*rt,Ye+=u*St,Ne+=u*Ct,Ke+=u*dt,ht+=u*Ot,ze+=u*gt,Pt+=u*wt,Dt+=u*vt,Ht+=u*We,kt+=u*Rt,zt+=u*Tt,u=A[9],Le+=u*lt,Je+=u*tt,Qe+=u*ft,at+=u*pt,Ue+=u*ot,Ye+=u*rt,Ne+=u*St,Ke+=u*Ct,ht+=u*dt,ze+=u*Ot,Pt+=u*gt,Dt+=u*wt,Ht+=u*vt,kt+=u*We,zt+=u*Rt,Wt+=u*Tt,u=A[10],Je+=u*lt,Qe+=u*tt,at+=u*ft,Ue+=u*pt,Ye+=u*ot,Ne+=u*rt,Ke+=u*St,ht+=u*Ct,ze+=u*dt,Pt+=u*Ot,Dt+=u*gt,Ht+=u*wt,kt+=u*vt,zt+=u*We,Wt+=u*Rt,rr+=u*Tt,u=A[11],Qe+=u*lt,at+=u*tt,Ue+=u*ft,Ye+=u*pt,Ne+=u*ot,Ke+=u*rt,ht+=u*St,ze+=u*Ct,Pt+=u*dt,Dt+=u*Ot,Ht+=u*gt,kt+=u*wt,zt+=u*vt,Wt+=u*We,rr+=u*Rt,qr+=u*Tt,u=A[12],at+=u*lt,Ue+=u*tt,Ye+=u*ft,Ne+=u*pt,Ke+=u*ot,ht+=u*rt,ze+=u*St,Pt+=u*Ct,Dt+=u*dt,Ht+=u*Ot,kt+=u*gt,zt+=u*wt,Wt+=u*vt,rr+=u*We,qr+=u*Rt,Jt+=u*Tt,u=A[13],Ue+=u*lt,Ye+=u*tt,Ne+=u*ft,Ke+=u*pt,ht+=u*ot,ze+=u*rt,Pt+=u*St,Dt+=u*Ct,Ht+=u*dt,kt+=u*Ot,zt+=u*gt,Wt+=u*wt,rr+=u*vt,qr+=u*We,Jt+=u*Rt,Vr+=u*Tt,u=A[14],Ye+=u*lt,Ne+=u*tt,Ke+=u*ft,ht+=u*pt,ze+=u*ot,Pt+=u*rt,Dt+=u*St,Ht+=u*Ct,kt+=u*dt,zt+=u*Ot,Wt+=u*gt,rr+=u*wt,qr+=u*vt,Jt+=u*We,Vr+=u*Rt,oi+=u*Tt,u=A[15],Ne+=u*lt,Ke+=u*tt,ht+=u*ft,ze+=u*pt,Pt+=u*ot,Dt+=u*rt,Ht+=u*St,kt+=u*Ct,zt+=u*dt,Wt+=u*Ot,rr+=u*gt,qr+=u*wt,Jt+=u*vt,Vr+=u*We,oi+=u*Rt,xi+=u*Tt,Z+=38*Ke,oe+=38*ht,me+=38*ze,Ae+=38*Pt,$e+=38*Dt,xe+=38*Ht,xt+=38*kt,mt+=38*zt,nt+=38*Wt,Le+=38*rr,Je+=38*qr,Qe+=38*Jt,at+=38*Vr,Ue+=38*oi,Ye+=38*xi,b=1,u=Z+b+65535,b=Math.floor(u/65536),Z=u-b*65536,u=oe+b+65535,b=Math.floor(u/65536),oe=u-b*65536,u=me+b+65535,b=Math.floor(u/65536),me=u-b*65536,u=Ae+b+65535,b=Math.floor(u/65536),Ae=u-b*65536,u=$e+b+65535,b=Math.floor(u/65536),$e=u-b*65536,u=xe+b+65535,b=Math.floor(u/65536),xe=u-b*65536,u=xt+b+65535,b=Math.floor(u/65536),xt=u-b*65536,u=mt+b+65535,b=Math.floor(u/65536),mt=u-b*65536,u=nt+b+65535,b=Math.floor(u/65536),nt=u-b*65536,u=Le+b+65535,b=Math.floor(u/65536),Le=u-b*65536,u=Je+b+65535,b=Math.floor(u/65536),Je=u-b*65536,u=Qe+b+65535,b=Math.floor(u/65536),Qe=u-b*65536,u=at+b+65535,b=Math.floor(u/65536),at=u-b*65536,u=Ue+b+65535,b=Math.floor(u/65536),Ue=u-b*65536,u=Ye+b+65535,b=Math.floor(u/65536),Ye=u-b*65536,u=Ne+b+65535,b=Math.floor(u/65536),Ne=u-b*65536,Z+=b-1+37*(b-1),b=1,u=Z+b+65535,b=Math.floor(u/65536),Z=u-b*65536,u=oe+b+65535,b=Math.floor(u/65536),oe=u-b*65536,u=me+b+65535,b=Math.floor(u/65536),me=u-b*65536,u=Ae+b+65535,b=Math.floor(u/65536),Ae=u-b*65536,u=$e+b+65535,b=Math.floor(u/65536),$e=u-b*65536,u=xe+b+65535,b=Math.floor(u/65536),xe=u-b*65536,u=xt+b+65535,b=Math.floor(u/65536),xt=u-b*65536,u=mt+b+65535,b=Math.floor(u/65536),mt=u-b*65536,u=nt+b+65535,b=Math.floor(u/65536),nt=u-b*65536,u=Le+b+65535,b=Math.floor(u/65536),Le=u-b*65536,u=Je+b+65535,b=Math.floor(u/65536),Je=u-b*65536,u=Qe+b+65535,b=Math.floor(u/65536),Qe=u-b*65536,u=at+b+65535,b=Math.floor(u/65536),at=u-b*65536,u=Ue+b+65535,b=Math.floor(u/65536),Ue=u-b*65536,u=Ye+b+65535,b=Math.floor(u/65536),Ye=u-b*65536,u=Ne+b+65535,b=Math.floor(u/65536),Ne=u-b*65536,Z+=b-1+37*(b-1),N[0]=Z,N[1]=oe,N[2]=me,N[3]=Ae,N[4]=$e,N[5]=xe,N[6]=xt,N[7]=mt,N[8]=nt,N[9]=Le,N[10]=Je,N[11]=Qe,N[12]=at,N[13]=Ue,N[14]=Ye,N[15]=Ne}function W(N,A){k(N,A,A)}function ve(N,A){const S=a();let u;for(u=0;u<16;u++)S[u]=A[u];for(u=253;u>=0;u--)W(S,S),u!==2&&u!==4&&k(S,S,A);for(u=0;u<16;u++)N[u]=S[u]}function te(N,A){const S=a();let u;for(u=0;u<16;u++)S[u]=A[u];for(u=250;u>=0;u--)W(S,S),u!==1&&k(S,S,A);for(u=0;u<16;u++)N[u]=S[u]}function Ee(N,A){const S=a(),u=a(),b=a(),Z=a(),oe=a(),me=a(),Ae=a(),$e=a(),xe=a();$(S,N[1],N[0]),$(xe,A[1],A[0]),k(S,S,xe),pe(u,N[0],N[1]),pe(xe,A[0],A[1]),k(u,u,xe),k(b,N[3],A[3]),k(b,b,v),k(Z,N[2],A[2]),pe(Z,Z,Z),$(oe,u,S),$(me,Z,b),pe(Ae,Z,b),pe($e,u,S),k(N[0],oe,me),k(N[1],$e,Ae),k(N[2],Ae,me),k(N[3],oe,$e)}function Re(N,A,S){for(let u=0;u<4;u++)V(N[u],A[u],S)}function et(N,A){const S=a(),u=a(),b=a();ve(b,A[2]),k(S,A[0],b),k(u,A[1],b),re(N,u),N[31]^=he(S)<<7}function R(N,A,S){j(N[0],d),j(N[1],y),j(N[2],y),j(N[3],d);for(let u=255;u>=0;--u){const b=S[u/8|0]>>(u&7)&1;Re(N,A,b),Ee(A,N),Ee(N,N),Re(N,A,b)}}function M(N,A){const S=[a(),a(),a(),a()];j(S[0],E),j(S[1],C),j(S[2],y),k(S[3],E,C),R(N,S,A)}function je(N){if(N.length!==c.SEED_LENGTH)throw new Error(`ed25519: seed must be ${c.SEED_LENGTH} bytes`);const A=(0,r.hash)(N);A[0]&=248,A[31]&=127,A[31]|=64;const S=new Uint8Array(32),u=[a(),a(),a(),a()];M(u,A),et(S,u);const b=new Uint8Array(64);return b.set(N),b.set(S,32),{publicKey:S,secretKey:b}}c.generateKeyPairFromSeed=je;function Te(N){const A=(0,i.randomBytes)(32,N),S=je(A);return(0,n.wipe)(A),S}c.generateKeyPair=Te;function J(N){if(N.length!==c.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${c.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(N.subarray(32))}c.extractPublicKeyFromSecretKey=J;const F=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function K(N,A){let S,u,b,Z;for(u=63;u>=32;--u){for(S=0,b=u-32,Z=u-12;b>4)*F[b],S=A[b]>>8,A[b]&=255;for(b=0;b<32;b++)A[b]-=S*F[b];for(u=0;u<32;u++)A[u+1]+=A[u]>>8,N[u]=A[u]&255}function B(N){const A=new Float64Array(64);for(let S=0;S<64;S++)A[S]=N[S];for(let S=0;S<64;S++)N[S]=0;K(N,A)}function ut(N,A){const S=new Float64Array(64),u=[a(),a(),a(),a()],b=(0,r.hash)(N.subarray(0,32));b[0]&=248,b[31]&=127,b[31]|=64;const Z=new Uint8Array(64);Z.set(b.subarray(32),32);const oe=new r.SHA512;oe.update(Z.subarray(32)),oe.update(A);const me=oe.digest();oe.clean(),B(me),M(u,me),et(Z,u),oe.reset(),oe.update(Z.subarray(0,32)),oe.update(N.subarray(32)),oe.update(A);const Ae=oe.digest();B(Ae);for(let $e=0;$e<32;$e++)S[$e]=me[$e];for(let $e=0;$e<32;$e++)for(let xe=0;xe<32;xe++)S[$e+xe]+=Ae[$e]*b[xe];return K(Z.subarray(32),S),Z}c.sign=ut;function ke(N,A){const S=a(),u=a(),b=a(),Z=a(),oe=a(),me=a(),Ae=a();return j(N[2],y),fe(N[1],A),W(b,N[1]),k(Z,b,w),$(b,b,N[2]),pe(Z,N[2],Z),W(oe,Z),W(me,oe),k(Ae,me,oe),k(S,Ae,b),k(S,S,Z),te(S,S),k(S,S,b),k(S,S,Z),k(S,S,Z),k(N[0],S,Z),W(u,N[0]),k(u,u,Z),ue(u,b)&&k(N[0],N[0],T),W(u,N[0]),k(u,u,Z),ue(u,b)?-1:(he(N[0])===A[31]>>7&&$(N[0],d,N[0]),k(N[3],N[0],N[1]),0)}function Lr(N,A,S){const u=new Uint8Array(32),b=[a(),a(),a(),a()],Z=[a(),a(),a(),a()];if(S.length!==c.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${c.SIGNATURE_LENGTH} bytes`);if(ke(Z,N))return!1;const oe=new r.SHA512;oe.update(S.subarray(0,32)),oe.update(N),oe.update(A);const me=oe.digest();return B(me),R(b,Z,me),M(Z,S.subarray(32)),Ee(b,Z),et(u,b),!ce(S,u)}c.verify=Lr;function _e(N){let A=[a(),a(),a(),a()];if(ke(A,N))throw new Error("Ed25519: invalid public key");let S=a(),u=a(),b=A[1];pe(S,y,b),$(u,y,b),ve(u,u),k(S,S,u);let Z=new Uint8Array(32);return re(Z,S),Z}c.convertPublicKeyToX25519=_e;function It(N){const A=(0,r.hash)(N.subarray(0,32));A[0]&=248,A[31]&=127,A[31]|=64;const S=new Uint8Array(A.subarray(0,32));return(0,n.wipe)(A),S}c.convertSecretKeyToX25519=It})(bc);const Nw="EdDSA",$w="JWT",Hl=".",kl="base64url",Dw="utf8",Lw="utf8",qw=":",zw="did",Mw="key",Fh="base58btc",jw="z",Uw="K36",Hw=32;function fa(c){return ga(gc(Bs(c),Dw),kl)}function Kl(c){const i=gc(Uw,Fh),r=jw+ga(F0([i,c]),Fh);return[zw,Mw,r].join(qw)}function kw(c){return ga(c,kl)}function Kw(c){return gc([fa(c.header),fa(c.payload)].join(Hl),Lw)}function Vw(c){return[fa(c.header),fa(c.payload),kw(c.signature)].join(Hl)}function Bh(c=Ol.randomBytes(Hw)){return bc.generateKeyPairFromSeed(c)}async function Fw(c,i,r,n,a=ie.fromMiliseconds(Date.now())){const l={alg:Nw,typ:$w},d=Kl(n.publicKey),y=a+r,w={iss:d,sub:c,aud:i,iat:a,exp:y},v=Kw({header:l,payload:w}),E=bc.sign(n.secretKey,v);return Vw({header:l,payload:w,signature:E})}const Bw=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),Gw=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",Gh=c=>c.split("?")[0],Wh=10,Ww=Bw();class Jw{constructor(i){if(this.url=i,this.events=new Kr.EventEmitter,this.registering=!1,!Ah(i))throw new Error(`Provided URL is not compatible with WebSocket connection: ${i}`);this.url=i}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(i,r){this.events.on(i,r)}once(i,r){this.events.once(i,r)}off(i,r){this.events.off(i,r)}removeListener(i,r){this.events.removeListener(i,r)}async open(i=this.url){await this.register(i)}async close(){return new Promise((i,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),i()},this.socket.close()})}async send(i,r){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Bs(i))}catch(n){this.onError(i.id,n)}}register(i=this.url){if(!Ah(i))throw new Error(`Provided URL is not compatible with WebSocket connection: ${i}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,a)=>{this.events.once("register_error",l=>{this.resetMaxListeners(),a(l)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return a(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=i,this.registering=!0,new Promise((r,n)=>{const a=Nm.isReactNative()?void 0:{rejectUnauthorized:!$m(i)},l=new Ww(i,[],a);Gw()?l.onerror=d=>{const y=d;n(this.emitError(y.error))}:l.on("error",d=>{n(this.emitError(d))}),l.onopen=()=>{this.onOpen(l),r(l)}})}onOpen(i){i.onmessage=r=>this.onPayload(r),i.onclose=r=>this.onClose(r),this.socket=i,this.registering=!1,this.events.emit("open")}onClose(i){this.socket=void 0,this.registering=!1,this.events.emit("close",i)}onPayload(i){if(typeof i.data>"u")return;const r=typeof i.data=="string"?va(i.data):i.data;this.events.emit("payload",r)}onError(i,r){const n=this.parseError(r),a=n.message||n.toString(),l=yc(i,a);this.events.emit("payload",l)}parseError(i,r=this.url){return Dm(i,Gh(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>Wh&&this.events.setMaxListeners(Wh)}emitError(i){const r=this.parseError(new Error((i==null?void 0:i.message)||`WebSocket connection failed for host: ${Gh(this.url)}`));return this.events.emit("register_error",r),r}}var pa={exports:{}};pa.exports;(function(c,i){var r=200,n="__lodash_hash_undefined__",a=1,l=2,d=9007199254740991,y="[object Arguments]",w="[object Array]",v="[object AsyncFunction]",E="[object Boolean]",C="[object Date]",T="[object Error]",j="[object Function]",D="[object GeneratorFunction]",V="[object Map]",re="[object Number]",ce="[object Null]",ue="[object Object]",he="[object Promise]",fe="[object Proxy]",pe="[object RegExp]",$="[object Set]",k="[object String]",W="[object Symbol]",ve="[object Undefined]",te="[object WeakMap]",Ee="[object ArrayBuffer]",Re="[object DataView]",et="[object Float32Array]",R="[object Float64Array]",M="[object Int8Array]",je="[object Int16Array]",Te="[object Int32Array]",J="[object Uint8Array]",F="[object Uint8ClampedArray]",K="[object Uint16Array]",B="[object Uint32Array]",ut=/[\\^$.*+?()[\]{}|]/g,ke=/^\[object .+?Constructor\]$/,Lr=/^(?:0|[1-9]\d*)$/,_e={};_e[et]=_e[R]=_e[M]=_e[je]=_e[Te]=_e[J]=_e[F]=_e[K]=_e[B]=!0,_e[y]=_e[w]=_e[Ee]=_e[E]=_e[Re]=_e[C]=_e[T]=_e[j]=_e[V]=_e[re]=_e[ue]=_e[pe]=_e[$]=_e[k]=_e[te]=!1;var It=typeof ea=="object"&&ea&&ea.Object===Object&&ea,N=typeof self=="object"&&self&&self.Object===Object&&self,A=It||N||Function("return this")(),S=i&&!i.nodeType&&i,u=S&&!0&&c&&!c.nodeType&&c,b=u&&u.exports===S,Z=b&&It.process,oe=function(){try{return Z&&Z.binding&&Z.binding("util")}catch{}}(),me=oe&&oe.isTypedArray;function Ae(g,I){for(var U=-1,Q=g==null?0:g.length,Fe=0,de=[];++U-1}function Sa(g,I){var U=this.__data__,Q=Pi(U,g);return Q<0?(++this.size,U.push([g,I])):U[Q][1]=I,this}yr.prototype.clear=Ea,yr.prototype.delete=Ia,yr.prototype.get=xa,yr.prototype.has=Pa,yr.prototype.set=Sa;function Fr(g){var I=-1,U=g==null?0:g.length;for(this.clear();++IAt))return!1;var Be=de.get(g);if(Be&&de.get(I))return Be==I;var _t=-1,ir=!0,Nt=U&l?new Fi:void 0;for(de.set(g,I),de.set(I,g);++_t-1&&g%1==0&&g-1&&g%1==0&&g<=d}function pn(g){var I=typeof g;return g!=null&&(I=="object"||I=="function")}function Oi(g){return g!=null&&typeof g=="object"}var dn=me?mt(me):en;function ja(g){return za(g)?Xs(g):tn(g)}function Ve(){return[]}function He(){return!1}c.exports=Ma})(pa,pa.exports);var Qw=pa.exports;const Yw=B0(Qw);var Xw={};function Zw(c,i){if(c.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,fe=new Uint8Array(he);ce!==ue;){for(var pe=D[ce],$=0,k=he-1;(pe!==0||$>>0,fe[k]=pe%y>>>0,pe=pe/y>>>0;if(pe!==0)throw new Error("Non-zero carry");re=$,ce++}for(var W=he-re;W!==he&&fe[W]===0;)W++;for(var ve=w.repeat(V);W>>0,he=new Uint8Array(ue);D[V];){var fe=r[D.charCodeAt(V)];if(fe===255)return;for(var pe=0,$=ue-1;(fe!==0||pe>>0,he[$]=fe%256>>>0,fe=fe/256>>>0;if(fe!==0)throw new Error("Non-zero carry");ce=pe,V++}if(D[V]!==" "){for(var k=ue-ce;k!==ue&&he[k]===0;)k++;for(var W=new Uint8Array(re+(ue-k)),ve=re;k!==ue;)W[ve++]=he[k++];return W}}}function j(D){var V=T(D);if(V)return V;throw new Error(`Non-${i} character`)}return{encode:C,decodeUnsafe:T,decode:j}}var e_=Zw,t_=e_;const Vl=c=>{if(c instanceof Uint8Array&&c.constructor.name==="Uint8Array")return c;if(c instanceof ArrayBuffer)return new Uint8Array(c);if(ArrayBuffer.isView(c))return new Uint8Array(c.buffer,c.byteOffset,c.byteLength);throw new Error("Unknown type, must be binary type")},r_=c=>new TextEncoder().encode(c),i_=c=>new TextDecoder().decode(c);class s_{constructor(i,r,n){this.name=i,this.prefix=r,this.baseEncode=n}encode(i){if(i instanceof Uint8Array)return`${this.prefix}${this.baseEncode(i)}`;throw Error("Unknown type, must be binary type")}}class n_{constructor(i,r,n){if(this.name=i,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(i){if(typeof i=="string"){if(i.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(i)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(i.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(i){return Fl(this,i)}}class a_{constructor(i){this.decoders=i}or(i){return Fl(this,i)}decode(i){const r=i[0],n=this.decoders[r];if(n)return n.decode(i);throw RangeError(`Unable to decode multibase string ${JSON.stringify(i)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Fl=(c,i)=>new a_({...c.decoders||{[c.prefix]:c},...i.decoders||{[i.prefix]:i}});class o_{constructor(i,r,n,a){this.name=i,this.prefix=r,this.baseEncode=n,this.baseDecode=a,this.encoder=new s_(i,r,n),this.decoder=new n_(i,r,a)}encode(i){return this.encoder.encode(i)}decode(i){return this.decoder.decode(i)}}const ya=({name:c,prefix:i,encode:r,decode:n})=>new o_(c,i,r,n),Ws=({prefix:c,name:i,alphabet:r})=>{const{encode:n,decode:a}=t_(r,i);return ya({prefix:c,name:i,encode:n,decode:l=>Vl(a(l))})},c_=(c,i,r,n)=>{const a={};for(let E=0;E=8&&(y-=8,d[v++]=255&w>>y)}if(y>=r||255&w<<8-y)throw new SyntaxError("Unexpected end of data");return d},u_=(c,i,r)=>{const n=i[i.length-1]==="=",a=(1<r;)d-=r,l+=i[a&y>>d];if(d&&(l+=i[a&y<ya({prefix:i,name:c,encode(a){return u_(a,n,r)},decode(a){return c_(a,n,r,c)}}),h_=ya({prefix:"\0",name:"identity",encode:c=>i_(c),decode:c=>r_(c)});var l_=Object.freeze({__proto__:null,identity:h_});const f_=Vt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var p_=Object.freeze({__proto__:null,base2:f_});const d_=Vt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var g_=Object.freeze({__proto__:null,base8:d_});const v_=Ws({prefix:"9",name:"base10",alphabet:"0123456789"});var y_=Object.freeze({__proto__:null,base10:v_});const m_=Vt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),w_=Vt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var __=Object.freeze({__proto__:null,base16:m_,base16upper:w_});const b_=Vt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),E_=Vt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),I_=Vt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),x_=Vt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),P_=Vt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),S_=Vt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),C_=Vt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),O_=Vt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),R_=Vt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var T_=Object.freeze({__proto__:null,base32:b_,base32upper:E_,base32pad:I_,base32padupper:x_,base32hex:P_,base32hexupper:S_,base32hexpad:C_,base32hexpadupper:O_,base32z:R_});const A_=Ws({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),N_=Ws({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var $_=Object.freeze({__proto__:null,base36:A_,base36upper:N_});const D_=Ws({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),L_=Ws({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var q_=Object.freeze({__proto__:null,base58btc:D_,base58flickr:L_});const z_=Vt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),M_=Vt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),j_=Vt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),U_=Vt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var H_=Object.freeze({__proto__:null,base64:z_,base64pad:M_,base64url:j_,base64urlpad:U_});const Bl=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),k_=Bl.reduce((c,i,r)=>(c[r]=i,c),[]),K_=Bl.reduce((c,i,r)=>(c[i.codePointAt(0)]=r,c),[]);function V_(c){return c.reduce((i,r)=>(i+=k_[r],i),"")}function F_(c){const i=[];for(const r of c){const n=K_[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);i.push(n)}return new Uint8Array(i)}const B_=ya({prefix:"🚀",name:"base256emoji",encode:V_,decode:F_});var G_=Object.freeze({__proto__:null,base256emoji:B_}),W_=Gl,Jh=128,J_=127,Q_=~J_,Y_=Math.pow(2,31);function Gl(c,i,r){i=i||[],r=r||0;for(var n=r;c>=Y_;)i[r++]=c&255|Jh,c/=128;for(;c&Q_;)i[r++]=c&255|Jh,c>>>=7;return i[r]=c|0,Gl.bytes=r-n+1,i}var X_=hc,Z_=128,Qh=127;function hc(c,n){var r=0,n=n||0,a=0,l=n,d,y=c.length;do{if(l>=y)throw hc.bytes=0,new RangeError("Could not decode varint");d=c[l++],r+=a<28?(d&Qh)<=Z_);return hc.bytes=l-n,r}var e1=Math.pow(2,7),t1=Math.pow(2,14),r1=Math.pow(2,21),i1=Math.pow(2,28),s1=Math.pow(2,35),n1=Math.pow(2,42),a1=Math.pow(2,49),o1=Math.pow(2,56),c1=Math.pow(2,63),u1=function(c){return c(Wl.encode(c,i,r),i),Xh=c=>Wl.encodingLength(c),lc=(c,i)=>{const r=i.byteLength,n=Xh(c),a=n+Xh(r),l=new Uint8Array(a+r);return Yh(c,l,0),Yh(r,l,n),l.set(i,a),new l1(c,r,i,l)};class l1{constructor(i,r,n,a){this.code=i,this.size=r,this.digest=n,this.bytes=a}}const Jl=({name:c,code:i,encode:r})=>new f1(c,i,r);class f1{constructor(i,r,n){this.name=i,this.code=r,this.encode=n}digest(i){if(i instanceof Uint8Array){const r=this.encode(i);return r instanceof Uint8Array?lc(this.code,r):r.then(n=>lc(this.code,n))}else throw Error("Unknown type, must be binary type")}}const Ql=c=>async i=>new Uint8Array(await crypto.subtle.digest(c,i)),p1=Jl({name:"sha2-256",code:18,encode:Ql("SHA-256")}),d1=Jl({name:"sha2-512",code:19,encode:Ql("SHA-512")});var g1=Object.freeze({__proto__:null,sha256:p1,sha512:d1});const Yl=0,v1="identity",Xl=Vl,y1=c=>lc(Yl,Xl(c)),m1={code:Yl,name:v1,encode:Xl,digest:y1};var w1=Object.freeze({__proto__:null,identity:m1});new TextEncoder,new TextDecoder;const Zh={...l_,...p_,...g_,...y_,...__,...T_,...$_,...q_,...H_,...G_};({...g1,...w1});function Zl(c){return globalThis.Buffer!=null?new Uint8Array(c.buffer,c.byteOffset,c.byteLength):c}function _1(c=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Zl(globalThis.Buffer.allocUnsafe(c)):new Uint8Array(c)}function ef(c,i,r,n){return{name:c,prefix:i,encoder:{name:c,prefix:i,encode:r},decoder:{decode:n}}}const el=ef("utf8","u",c=>"u"+new TextDecoder("utf8").decode(c),c=>new TextEncoder().encode(c.substring(1))),Xo=ef("ascii","a",c=>{let i="a";for(let r=0;r{c=c.substring(1);const i=_1(c.length);for(let r=0;r{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,a)=>{this.isInitialized(),this.keychain.set(n,a),await this.persist()},this.get=n=>{this.isInitialized();const a=this.keychain.get(n);if(typeof a>"u"){const{message:l}=X("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(l)}return a},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=i,this.logger=Oe.generateChildLogger(r,this.name)}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(i){await this.core.storage.setItem(this.storageKey,Nl(i))}async getKeyChain(){const i=await this.core.storage.getItem(this.storageKey);return typeof i<"u"?$l(i):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}}class X1{constructor(i,r,n){this.core=i,this.logger=r,this.name=S1,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=a=>(this.isInitialized(),this.keychain.has(a)),this.getClientId=async()=>{this.isInitialized();const a=await this.getClientSeed(),l=Bh(a);return Kl(l.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const a=J0();return this.setPrivateKey(a.publicKey,a.privateKey)},this.signJWT=async a=>{this.isInitialized();const l=await this.getClientSeed(),d=Bh(l),y=oc();return await Fw(y,a,C1,d)},this.generateSharedKey=(a,l,d)=>{this.isInitialized();const y=this.getPrivateKey(a),w=Q0(y,l);return this.setSymKey(w,d)},this.setSymKey=async(a,l)=>{this.isInitialized();const d=l||Y0(a);return await this.keychain.set(d,a),d},this.deleteKeyPair=async a=>{this.isInitialized(),await this.keychain.del(a)},this.deleteSymKey=async a=>{this.isInitialized(),await this.keychain.del(a)},this.encode=async(a,l,d)=>{this.isInitialized();const y=X0(d),w=Bs(l);if(Sh(y)){const T=y.senderPublicKey,j=y.receiverPublicKey;a=await this.generateSharedKey(T,j)}const v=this.getSymKey(a),{type:E,senderPublicKey:C}=y;return Z0({type:E,symKey:v,message:w,senderPublicKey:C})},this.decode=async(a,l,d)=>{this.isInitialized();const y=em(l,d);if(Sh(y)){const w=y.receiverPublicKey,v=y.senderPublicKey;a=await this.generateSharedKey(w,v)}try{const w=this.getSymKey(a),v=tm({symKey:w,encoded:l});return va(v)}catch(w){this.logger.error(`Failed to decode message from topic: '${a}', clientId: '${await this.getClientId()}'`),this.logger.error(w)}},this.getPayloadType=a=>{const l=Ch(a);return rm(l.type)},this.getPayloadSenderPublicKey=a=>{const l=Ch(a);return l.senderPublicKey?ga(l.senderPublicKey,im):void 0},this.core=i,this.logger=Oe.generateChildLogger(r,this.name),this.keychain=n||new Y1(this.core,this.logger)}get context(){return Oe.getLoggerContext(this.logger)}async setPrivateKey(i,r){return await this.keychain.set(i,r),i}getPrivateKey(i){return this.keychain.get(i)}async getClientSeed(){let i="";try{i=this.keychain.get(tl)}catch{i=oc(),await this.keychain.set(tl,i)}return E1(i,"base16")}getSymKey(i){return this.keychain.get(i)}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}}class Z1 extends Iw{constructor(i,r){super(i,r),this.logger=i,this.core=r,this.messages=new Map,this.name=T1,this.version=A1,this.initialized=!1,this.storagePrefix=bi,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,a)=>{this.isInitialized();const l=ls(a);let d=this.messages.get(n);return typeof d>"u"&&(d={}),typeof d[l]<"u"||(d[l]=a,this.messages.set(n,d),await this.persist()),l},this.get=n=>{this.isInitialized();let a=this.messages.get(n);return typeof a>"u"&&(a={}),a},this.has=(n,a)=>{this.isInitialized();const l=this.get(n),d=ls(a);return typeof l[d]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Oe.generateChildLogger(i,this.name),this.core=r}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(i){await this.core.storage.setItem(this.storageKey,Nl(i))}async getRelayerMessages(){const i=await this.core.storage.getItem(this.storageKey);return typeof i<"u"?$l(i):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}}class eb extends xw{constructor(i,r){super(i,r),this.relayer=i,this.logger=r,this.events=new Kr.EventEmitter,this.name=$1,this.queue=new Map,this.publishTimeout=ie.toMiliseconds(ie.TEN_SECONDS),this.needsTransportRestart=!1,this.publish=async(n,a,l)=>{var d;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:a,opts:l}});try{const y=(l==null?void 0:l.ttl)||N1,w=cc(l),v=(l==null?void 0:l.prompt)||!1,E=(l==null?void 0:l.tag)||0,C=(l==null?void 0:l.id)||Lm().toString(),T={topic:n,message:a,opts:{ttl:y,relay:w,prompt:v,tag:E,id:C}},j=setTimeout(()=>this.queue.set(C,T),this.publishTimeout);try{await await Vs(this.rpcPublish(n,a,y,w,v,E,C),this.publishTimeout,"Failed to publish payload, please try again."),this.removeRequestFromQueue(C),this.relayer.events.emit(Gt.publish,T)}catch(D){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,(d=l==null?void 0:l.internal)!=null&&d.throwOnFailedPublish)throw this.removeRequestFromQueue(C),D;return}finally{clearTimeout(j)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:a,opts:l}})}catch(y){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(y),y}},this.on=(n,a)=>{this.events.on(n,a)},this.once=(n,a)=>{this.events.once(n,a)},this.off=(n,a)=>{this.events.off(n,a)},this.removeListener=(n,a)=>{this.events.removeListener(n,a)},this.relayer=i,this.logger=Oe.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return Oe.getLoggerContext(this.logger)}rpcPublish(i,r,n,a,l,d,y){var w,v,E,C;const T={method:oa(a.protocol).publish,params:{topic:i,message:r,ttl:n,prompt:l,tag:d},id:y};return _i((w=T.params)==null?void 0:w.prompt)&&((v=T.params)==null||delete v.prompt),_i((E=T.params)==null?void 0:E.tag)&&((C=T.params)==null||delete C.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:T}),this.relayer.request(T)}removeRequestFromQueue(i){this.queue.delete(i)}checkQueue(){this.queue.forEach(async i=>{const{topic:r,message:n,opts:a}=i;await this.publish(r,n,a)})}registerEventListeners(){this.relayer.core.heartbeat.on(ps.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Gt.connection_stalled);return}this.checkQueue()}),this.relayer.on(Gt.message_ack,i=>{this.removeRequestFromQueue(i.id.toString())})}}class tb{constructor(){this.map=new Map,this.set=(i,r)=>{const n=this.get(i);this.exists(i,r)||this.map.set(i,[...n,r])},this.get=i=>this.map.get(i)||[],this.exists=(i,r)=>this.get(i).includes(r),this.delete=(i,r)=>{if(typeof r>"u"){this.map.delete(i);return}if(!this.map.has(i))return;const n=this.get(i);if(!this.exists(i,r))return;const a=n.filter(l=>l!==r);if(!a.length){this.map.delete(i);return}this.map.set(i,a)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var rb=Object.defineProperty,ib=Object.defineProperties,sb=Object.getOwnPropertyDescriptors,sl=Object.getOwnPropertySymbols,nb=Object.prototype.hasOwnProperty,ab=Object.prototype.propertyIsEnumerable,nl=(c,i,r)=>i in c?rb(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,qs=(c,i)=>{for(var r in i||(i={}))nb.call(i,r)&&nl(c,r,i[r]);if(sl)for(var r of sl(i))ab.call(i,r)&&nl(c,r,i[r]);return c},ec=(c,i)=>ib(c,sb(i));class ob extends Cw{constructor(i,r){super(i,r),this.relayer=i,this.logger=r,this.subscriptions=new Map,this.topicMap=new tb,this.events=new Kr.EventEmitter,this.name=k1,this.version=K1,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=bi,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,a)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:a}});try{const l=cc(a),d={topic:n,relay:l};this.pending.set(n,d);const y=await this.rpcSubscribe(n,l);return this.onSubscribe(y,d),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:a}}),y}catch(l){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(l),l}},this.unsubscribe=async(n,a)=>{await this.restartToComplete(),this.isInitialized(),typeof(a==null?void 0:a.id)<"u"?await this.unsubscribeById(n,a.id,a):await this.unsubscribeByTopic(n,a)},this.isSubscribed=async n=>this.topics.includes(n)?!0:await new Promise((a,l)=>{const d=new ie.Watch;d.start(this.pendingSubscriptionWatchLabel);const y=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(y),d.stop(this.pendingSubscriptionWatchLabel),a(!0)),d.elapsed(this.pendingSubscriptionWatchLabel)>=V1&&(clearInterval(y),d.stop(this.pendingSubscriptionWatchLabel),l(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1),this.on=(n,a)=>{this.events.on(n,a)},this.once=(n,a)=>{this.events.once(n,a)},this.off=(n,a)=>{this.events.off(n,a)},this.removeListener=(n,a)=>{this.events.removeListener(n,a)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=i,this.logger=Oe.generateChildLogger(r,this.name),this.clientId=""}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(i,r){let n=!1;try{n=this.getSubscription(i).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(i,r){const n=this.topicMap.get(i);await Promise.all(n.map(async a=>await this.unsubscribeById(i,a,r)))}async unsubscribeById(i,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:i,id:r,opts:n}});try{const a=cc(n);await this.rpcUnsubscribe(i,r,a);const l=tr("USER_DISCONNECTED",`${this.name}, ${i}`);await this.onUnsubscribe(i,r,l),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:i,id:r,opts:n}})}catch(a){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(a),a}}async rpcSubscribe(i,r){const n={method:oa(r.protocol).subscribe,params:{topic:i}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await Vs(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Gt.connection_stalled)}return ls(i+this.clientId)}async rpcBatchSubscribe(i){if(!i.length)return;const r=i[0].relay,n={method:oa(r.protocol).batchSubscribe,params:{topics:i.map(a=>a.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await Vs(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(Gt.connection_stalled)}}rpcUnsubscribe(i,r,n){const a={method:oa(n.protocol).unsubscribe,params:{topic:i,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:a}),this.relayer.request(a)}onSubscribe(i,r){this.setSubscription(i,ec(qs({},r),{id:i})),this.pending.delete(r.topic)}onBatchSubscribe(i){i.length&&i.forEach(r=>{this.setSubscription(r.id,qs({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(i,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,i)&&this.deleteSubscription(r,n),await this.relayer.messages.del(i)}async setRelayerSubscriptions(i){await this.relayer.core.storage.setItem(this.storageKey,i)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(i,r){this.subscriptions.has(i)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:i,subscription:r}),this.addSubscription(i,r))}addSubscription(i,r){this.subscriptions.set(i,qs({},r)),this.topicMap.set(r.topic,i),this.events.emit($r.created,r)}getSubscription(i){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:i});const r=this.subscriptions.get(i);if(!r){const{message:n}=X("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(n)}return r}deleteSubscription(i,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:i,reason:r});const n=this.getSubscription(i);this.subscriptions.delete(i),this.topicMap.delete(n.topic,i),this.events.emit($r.deleted,ec(qs({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit($r.sync)}async reset(){if(this.cached.length){const i=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!i.length)return;if(this.subscriptions.size){const{message:r}=X("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=i,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(i){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(i)}}async batchSubscribe(i){if(!i.length)return;const r=await this.rpcBatchSubscribe(i);fs(r)&&this.onBatchSubscribe(r.map((n,a)=>ec(qs({},i[a]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;const i=[];this.pending.forEach(r=>{i.push(r)}),await this.batchSubscribe(i)}registerEventListeners(){this.relayer.core.heartbeat.on(ps.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(Gt.connect,async()=>{await this.onConnect()}),this.relayer.on(Gt.disconnect,()=>{this.onDisconnect()}),this.events.on($r.created,async i=>{const r=$r.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:i}),await this.persist()}),this.events.on($r.deleted,async i=>{const r=$r.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:i}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}async restartToComplete(){this.restartInProgress&&await new Promise(i=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),i())},this.pollingInterval)})}}var cb=Object.defineProperty,al=Object.getOwnPropertySymbols,ub=Object.prototype.hasOwnProperty,hb=Object.prototype.propertyIsEnumerable,ol=(c,i,r)=>i in c?cb(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,lb=(c,i)=>{for(var r in i||(i={}))ub.call(i,r)&&ol(c,r,i[r]);if(al)for(var r of al(i))hb.call(i,r)&&ol(c,r,i[r]);return c};class fb extends Pw{constructor(i){super(i),this.protocol="wc",this.version=2,this.events=new Kr.EventEmitter,this.name=L1,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,this.request=async r=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(r)}catch(n){throw this.logger.debug("Failed to Publish Request"),this.logger.error(n),n}},this.onPayloadHandler=r=>{this.onProviderPayload(r)},this.onConnectHandler=()=>{this.events.emit(Gt.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(Gt.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(ri.payload,this.onPayloadHandler),this.provider.on(ri.connect,this.onConnectHandler),this.provider.on(ri.disconnect,this.onDisconnectHandler),this.provider.on(ri.error,this.onProviderErrorHandler)},this.core=i.core,this.logger=typeof i.logger<"u"&&typeof i.logger!="string"?Oe.generateChildLogger(i.logger,this.name):Oe.pino(Oe.getDefaultLoggerOptions({level:i.logger||D1})),this.messages=new Z1(this.logger,i.core),this.subscriber=new ob(this,this.logger),this.publisher=new eb(this,this.logger),this.relayUrl=(i==null?void 0:i.relayUrl)||sf,this.projectId=i.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${rl}...`),await this.restartTransport(rl)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},j1)}get context(){return Oe.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(i,r,n){this.isInitialized(),await this.publisher.publish(i,r,n),await this.recordMessageEvent({topic:i,message:r,publishedAt:Date.now()})}async subscribe(i,r){var n;this.isInitialized();let a=((n=this.subscriber.topicMap.get(i))==null?void 0:n[0])||"";if(a)return a;let l;const d=y=>{y.topic===i&&(this.subscriber.off($r.created,d),l())};return await Promise.all([new Promise(y=>{l=y,this.subscriber.on($r.created,d)}),new Promise(async y=>{a=await this.subscriber.subscribe(i,r),y()})]),a}async unsubscribe(i,r){this.isInitialized(),await this.subscriber.unsubscribe(i,r)}on(i,r){this.events.on(i,r)}once(i,r){this.events.once(i,r)}off(i,r){this.events.off(i,r)}removeListener(i,r){this.events.removeListener(i,r)}async transportClose(){this.transportExplicitlyClosed=!0,this.hasExperiencedNetworkDisruption&&this.connected?await Vs(this.provider.disconnect(),1e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(i){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){i&&i!==this.relayUrl&&(this.relayUrl=i,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(r=>{if(!this.initialized)return r();this.subscriber.once($r.resubscribed,()=>{r()})}),new Promise(async(r,n)=>{try{await Vs(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(a){n(a);return}r()})])}catch(r){this.logger.error(r);const n=r;if(!this.isConnectionStalled(n.message))throw r;this.provider.events.emit(ri.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(i){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=i||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Oh())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(i){return this.staleConnectionErrors.some(r=>i.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const i=await this.core.crypto.signJWT(this.relayUrl);this.provider=new ni(new Jw(sm({sdkVersion:M1,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:i,useOnCloseEvent:!0}))),this.registerProviderListeners()}async recordMessageEvent(i){const{topic:r,message:n}=i;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(i){const{topic:r,message:n}=i;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const a=this.messages.has(r,n);return a&&this.logger.debug(`Ignoring duplicate message: ${n}`),a}async onProviderPayload(i){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:i}),mc(i)){if(!i.method.endsWith(q1))return;const r=i.params,{topic:n,message:a,publishedAt:l}=r.data,d={topic:n,message:a,publishedAt:l};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(lb({type:"event",event:r.id},d)),this.events.emit(r.id,d),await this.acknowledgePayload(i),await this.onMessageEvent(d)}else wc(i)&&this.events.emit(Gt.message_ack,i)}async onMessageEvent(i){await this.shouldIgnoreMessageEvent(i)||(this.events.emit(Gt.message,i),await this.recordMessageEvent(i))}async acknowledgePayload(i){const r=_c(i.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(ri.payload,this.onPayloadHandler),this.provider.off(ri.connect,this.onConnectHandler),this.provider.off(ri.disconnect,this.onDisconnectHandler),this.provider.off(ri.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(Gt.connection_stalled,()=>{this.restartTransport().catch(r=>this.logger.error(r))});let i=await Oh();nm(async r=>{this.initialized&&i!==r&&(i=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(n=>this.logger.error(n))))})}onProviderDisconnect(){this.events.emit(Gt.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(i=>this.logger.error(i))},ie.toMiliseconds(z1)))}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(i=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),i())},this.connectionStatusPollingInterval)});await this.restartTransport()}}}var pb=Object.defineProperty,cl=Object.getOwnPropertySymbols,db=Object.prototype.hasOwnProperty,gb=Object.prototype.propertyIsEnumerable,ul=(c,i,r)=>i in c?pb(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,hl=(c,i)=>{for(var r in i||(i={}))db.call(i,r)&&ul(c,r,i[r]);if(cl)for(var r of cl(i))gb.call(i,r)&&ul(c,r,i[r]);return c};class ma extends Sw{constructor(i,r,n,a=bi,l=void 0){super(i,r,n,a),this.core=i,this.logger=r,this.name=n,this.map=new Map,this.version=U1,this.cached=[],this.initialized=!1,this.storagePrefix=bi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(d=>{this.getKey&&d!==null&&!_i(d)?this.map.set(this.getKey(d),d):G0(d)?this.map.set(d.id,d):W0(d)&&this.map.set(d.topic,d)}),this.cached=[],this.initialized=!0)},this.set=async(d,y)=>{this.isInitialized(),this.map.has(d)?await this.update(d,y):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:d,value:y}),this.map.set(d,y),await this.persist())},this.get=d=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:d}),this.getData(d)),this.getAll=d=>(this.isInitialized(),d?this.values.filter(y=>Object.keys(d).every(w=>Yw(y[w],d[w]))):this.values),this.update=async(d,y)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:d,update:y});const w=hl(hl({},this.getData(d)),y);this.map.set(d,w),await this.persist()},this.delete=async(d,y)=>{this.isInitialized(),this.map.has(d)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:d,reason:y}),this.map.delete(d),await this.persist())},this.logger=Oe.generateChildLogger(r,this.name),this.storagePrefix=a,this.getKey=l}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(i){await this.core.storage.setItem(this.storageKey,i)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(i){const r=this.map.get(i);if(!r){const{message:n}=X("NO_MATCHING_KEY",`${this.name}: ${i}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const i=await this.getDataStore();if(typeof i>"u"||!i.length)return;if(this.map.size){const{message:r}=X("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=i,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(i){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(i)}}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}}class vb{constructor(i,r){this.core=i,this.logger=r,this.name=F1,this.version=B1,this.events=new vc,this.initialized=!1,this.storagePrefix=bi,this.ignoredPayloadTypes=[Rl],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async()=>{this.isInitialized();const n=oc(),a=await this.core.crypto.setSymKey(n),l=Dr(ie.FIVE_MINUTES),d={protocol:rf},y={topic:a,expiry:l,relay:d,active:!1},w=am({protocol:this.core.protocol,version:this.core.version,topic:a,symKey:n,relay:d});return await this.pairings.set(a,y),await this.core.relayer.subscribe(a),this.core.expirer.set(a,l),{topic:a,uri:w}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);const{topic:a,symKey:l,relay:d}=om(n.uri);let y;if(this.pairings.keys.includes(a)&&(y=this.pairings.get(a),y.active))throw new Error(`Pairing already exists: ${a}. Please try again with a new connection URI.`);this.core.crypto.keychain.has(a)||(await this.core.crypto.setSymKey(l,a),await this.core.relayer.subscribe(a,{relay:d}));const w=Dr(ie.FIVE_MINUTES),v={topic:a,relay:d,expiry:w,active:!1};return await this.pairings.set(a,v),this.core.expirer.set(a,w),n.activatePairing&&await this.activate({topic:a}),this.events.emit(Hs.create,v),v},this.activate=async({topic:n})=>{this.isInitialized();const a=Dr(ie.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:a}),this.core.expirer.set(n,a)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);const{topic:a}=n;if(this.pairings.keys.includes(a)){const l=await this.sendRequest(a,"wc_pairingPing",{}),{done:d,resolve:y,reject:w}=us();this.events.once($t("pairing_ping",l),({error:v})=>{v?w(v):y()}),await d()}},this.updateExpiry=async({topic:n,expiry:a})=>{this.isInitialized(),await this.pairings.update(n,{expiry:a})},this.updateMetadata=async({topic:n,metadata:a})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:a})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:a}=n;this.pairings.keys.includes(a)&&(await this.sendRequest(a,"wc_pairingDelete",tr("USER_DISCONNECTED")),await this.deletePairing(a))},this.sendRequest=async(n,a,l)=>{const d=Ks(a,l),y=await this.core.crypto.encode(n,d),w=Ls[a].req;return this.core.history.set(n,d),this.core.relayer.publish(n,y,w),d.id},this.sendResult=async(n,a,l)=>{const d=_c(n,l),y=await this.core.crypto.encode(a,d),w=await this.core.history.get(a,n),v=Ls[w.request.method].res;await this.core.relayer.publish(a,y,v),await this.core.history.resolve(d)},this.sendError=async(n,a,l)=>{const d=yc(n,l),y=await this.core.crypto.encode(a,d),w=await this.core.history.get(a,n),v=Ls[w.request.method]?Ls[w.request.method].res:Ls.unregistered_method.res;await this.core.relayer.publish(a,y,v),await this.core.history.resolve(d)},this.deletePairing=async(n,a)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,tr("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),a?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{const n=this.pairings.getAll().filter(a=>wi(a.expiry));await Promise.all(n.map(a=>this.deletePairing(a.topic)))},this.onRelayEventRequest=n=>{const{topic:a,payload:l}=n;switch(l.method){case"wc_pairingPing":return this.onPairingPingRequest(a,l);case"wc_pairingDelete":return this.onPairingDeleteRequest(a,l);default:return this.onUnknownRpcMethodRequest(a,l)}},this.onRelayEventResponse=async n=>{const{topic:a,payload:l}=n,d=(await this.core.history.get(a,l.id)).request.method;switch(d){case"wc_pairingPing":return this.onPairingPingResponse(a,l);default:return this.onUnknownRpcMethodResponse(d)}},this.onPairingPingRequest=async(n,a)=>{const{id:l}=a;try{this.isValidPing({topic:n}),await this.sendResult(l,n,!0),this.events.emit(Hs.ping,{id:l,topic:n})}catch(d){await this.sendError(l,n,d),this.logger.error(d)}},this.onPairingPingResponse=(n,a)=>{const{id:l}=a;setTimeout(()=>{mi(a)?this.events.emit($t("pairing_ping",l),{}):si(a)&&this.events.emit($t("pairing_ping",l),{error:a.error})},500)},this.onPairingDeleteRequest=async(n,a)=>{const{id:l}=a;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(Hs.delete,{id:l,topic:n})}catch(d){await this.sendError(l,n,d),this.logger.error(d)}},this.onUnknownRpcMethodRequest=async(n,a)=>{const{id:l,method:d}=a;try{if(this.registeredMethods.includes(d))return;const y=tr("WC_METHOD_UNSUPPORTED",d);await this.sendError(l,n,y),this.logger.error(y)}catch(y){await this.sendError(l,n,y),this.logger.error(y)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(tr("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{if(!hr(n)){const{message:a}=X("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(a)}if(!cm(n.uri)){const{message:a}=X("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(a)}},this.isValidPing=async n=>{if(!hr(n)){const{message:l}=X("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(l)}const{topic:a}=n;await this.isValidPairingTopic(a)},this.isValidDisconnect=async n=>{if(!hr(n)){const{message:l}=X("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(l)}const{topic:a}=n;await this.isValidPairingTopic(a)},this.isValidPairingTopic=async n=>{if(!hs(n,!1)){const{message:a}=X("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(a)}if(!this.pairings.keys.includes(n)){const{message:a}=X("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(a)}if(wi(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:a}=X("EXPIRED",`pairing topic: ${n}`);throw new Error(a)}},this.core=i,this.logger=Oe.generateChildLogger(r,this.name),this.pairings=new ma(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Oe.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}registerRelayerEvents(){this.core.relayer.on(Gt.message,async i=>{const{topic:r,message:n}=i;if(!this.pairings.keys.includes(r)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;const a=await this.core.crypto.decode(r,n);try{mc(a)?(this.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a})):wc(a)&&(await this.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a}),this.core.history.delete(r,a.id))}catch(l){this.logger.error(l)}})}registerExpirerEvents(){this.core.expirer.on(Sr.expired,async i=>{const{topic:r}=Tl(i.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(Hs.expire,{topic:r}))})}}class yb extends Ew{constructor(i,r){super(i,r),this.core=i,this.logger=r,this.records=new Map,this.events=new Kr.EventEmitter,this.name=G1,this.version=W1,this.cached=[],this.initialized=!1,this.storagePrefix=bi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,a,l)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:a,chainId:l}),this.records.has(a.id))return;const d={id:a.id,topic:n,request:{method:a.method,params:a.params||null},chainId:l,expiry:Dr(ie.THIRTY_DAYS)};this.records.set(d.id,d),this.events.emit(kr.created,d)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const a=await this.getRecord(n.id);typeof a.response>"u"&&(a.response=si(n)?{error:n.error}:{result:n.result},this.records.set(a.id,a),this.events.emit(kr.updated,a))},this.get=async(n,a)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:a}),await this.getRecord(a)),this.delete=(n,a)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:a}),this.values.forEach(l=>{if(l.topic===n){if(typeof a<"u"&&l.id!==a)return;this.records.delete(l.id),this.events.emit(kr.deleted,l)}})},this.exists=async(n,a)=>(this.isInitialized(),this.records.has(a)?(await this.getRecord(a)).topic===n:!1),this.on=(n,a)=>{this.events.on(n,a)},this.once=(n,a)=>{this.events.once(n,a)},this.off=(n,a)=>{this.events.off(n,a)},this.removeListener=(n,a)=>{this.events.removeListener(n,a)},this.logger=Oe.generateChildLogger(r,this.name)}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const i=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const n={topic:r.topic,request:Ks(r.request.method,r.request.params,r.id),chainId:r.chainId};return i.push(n)}),i}async setJsonRpcRecords(i){await this.core.storage.setItem(this.storageKey,i)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(i){this.isInitialized();const r=this.records.get(i);if(!r){const{message:n}=X("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(kr.sync)}async restore(){try{const i=await this.getJsonRpcRecords();if(typeof i>"u"||!i.length)return;if(this.records.size){const{message:r}=X("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=i,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}}registerEventListeners(){this.events.on(kr.created,i=>{const r=kr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:i}),this.persist()}),this.events.on(kr.updated,i=>{const r=kr.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:i}),this.persist()}),this.events.on(kr.deleted,i=>{const r=kr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:i}),this.persist()}),this.core.heartbeat.on(ps.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(i=>{ie.toMiliseconds(i.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${i.id}`),this.delete(i.topic,i.id))})}catch(i){this.logger.warn(i)}}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}}class mb extends Ow{constructor(i,r){super(i,r),this.core=i,this.logger=r,this.expirations=new Map,this.events=new Kr.EventEmitter,this.name=J1,this.version=Q1,this.cached=[],this.initialized=!1,this.storagePrefix=bi,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{const a=this.formatTarget(n);return typeof this.getExpiration(a)<"u"}catch{return!1}},this.set=(n,a)=>{this.isInitialized();const l=this.formatTarget(n),d={target:l,expiry:a};this.expirations.set(l,d),this.checkExpiry(l,d),this.events.emit(Sr.created,{target:l,expiration:d})},this.get=n=>{this.isInitialized();const a=this.formatTarget(n);return this.getExpiration(a)},this.del=n=>{if(this.isInitialized(),this.has(n)){const a=this.formatTarget(n),l=this.getExpiration(a);this.expirations.delete(a),this.events.emit(Sr.deleted,{target:a,expiration:l})}},this.on=(n,a)=>{this.events.on(n,a)},this.once=(n,a)=>{this.events.once(n,a)},this.off=(n,a)=>{this.events.off(n,a)},this.removeListener=(n,a)=>{this.events.removeListener(n,a)},this.logger=Oe.generateChildLogger(r,this.name)}get context(){return Oe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(i){if(typeof i=="string")return um(i);if(typeof i=="number")return hm(i);const{message:r}=X("UNKNOWN_TYPE",`Target type: ${typeof i}`);throw new Error(r)}async setExpirations(i){await this.core.storage.setItem(this.storageKey,i)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Sr.sync)}async restore(){try{const i=await this.getExpirations();if(typeof i>"u"||!i.length)return;if(this.expirations.size){const{message:r}=X("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=i,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(i){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(i)}}getExpiration(i){const r=this.expirations.get(i);if(!r){const{message:n}=X("NO_MATCHING_KEY",`${this.name}: ${i}`);throw this.logger.error(n),new Error(n)}return r}checkExpiry(i,r){const{expiry:n}=r;ie.toMiliseconds(n)-Date.now()<=0&&this.expire(i,r)}expire(i,r){this.expirations.delete(i),this.events.emit(Sr.expired,{target:i,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((i,r)=>this.checkExpiry(r,i))}registerEventListeners(){this.core.heartbeat.on(ps.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Sr.created,i=>{const r=Sr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:i}),this.persist()}),this.events.on(Sr.expired,i=>{const r=Sr.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:i}),this.persist()}),this.events.on(Sr.deleted,i=>{const r=Sr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:i}),this.persist()})}isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}}}class wb extends Rw{constructor(i,r){super(i,r),this.projectId=i,this.logger=r,this.name=Zo,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async()=>{if(this.verifyDisabled||lm()||!Al())return;const n=la;this.verifyUrl!==n&&this.removeIframe(),this.verifyUrl=n;try{await this.createIframe()}catch(a){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(a)}if(!this.initialized){this.removeIframe(),this.verifyUrl=il;try{await this.createIframe()}catch(a){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(a),this.verifyDisabled=!0}}},this.register=async n=>{this.initialized?this.sendPost(n.attestationId):(this.addToQueue(n.attestationId),await this.init())},this.resolve=async n=>{if(this.isDevEnv)return"";const a=(n==null?void 0:n.verifyUrl)||la;let l;try{l=await this.fetchAttestation(n.attestationId,a)}catch(d){this.logger.info(`failed to resolve attestation: ${n.attestationId} from url: ${a}`),this.logger.info(d),l=await this.fetchAttestation(n.attestationId,il)}return l},this.fetchAttestation=async(n,a)=>{this.logger.info(`resolving attestation: ${n} from url: ${a}`);const l=this.startAbortTimer(ie.ONE_SECOND*2),d=await fetch(`${a}/attestation/${n}`,{signal:this.abortController.signal});return clearTimeout(l),d.status===200?await d.json():void 0},this.addToQueue=n=>{this.queue.push(n)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(n=>this.sendPost(n)),this.queue=[])},this.sendPost=n=>{var a;try{if(!this.iframe)return;(a=this.iframe.contentWindow)==null||a.postMessage(n,"*"),this.logger.info(`postMessage sent: ${n} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let n;const a=l=>{l.data==="verify_ready"&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",a),n())};await Promise.race([new Promise(l=>{if(document.getElementById(Zo))return l();window.addEventListener("message",a);const d=document.createElement("iframe");d.id=Zo,d.src=`${this.verifyUrl}/${this.projectId}`,d.style.display="none",document.body.append(d),this.iframe=d,n=l}),new Promise((l,d)=>setTimeout(()=>{window.removeEventListener("message",a),d("verify iframe load timeout")},ie.toMiliseconds(ie.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.logger=Oe.generateChildLogger(r,this.name),this.verifyUrl=la,this.abortController=new AbortController,this.isDevEnv=fm()&&Xw.IS_VITEST}get context(){return Oe.getLoggerContext(this.logger)}startAbortTimer(i){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),ie.toMiliseconds(i))}}var _b=Object.defineProperty,ll=Object.getOwnPropertySymbols,bb=Object.prototype.hasOwnProperty,Eb=Object.prototype.propertyIsEnumerable,fl=(c,i,r)=>i in c?_b(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,pl=(c,i)=>{for(var r in i||(i={}))bb.call(i,r)&&fl(c,r,i[r]);if(ll)for(var r of ll(i))Eb.call(i,r)&&fl(c,r,i[r]);return c};class Ic extends bw{constructor(i){super(i),this.protocol=tf,this.version=I1,this.name=Ec,this.events=new Kr.EventEmitter,this.initialized=!1,this.on=(n,a)=>this.events.on(n,a),this.once=(n,a)=>this.events.once(n,a),this.off=(n,a)=>this.events.off(n,a),this.removeListener=(n,a)=>this.events.removeListener(n,a),this.projectId=i==null?void 0:i.projectId,this.relayUrl=(i==null?void 0:i.relayUrl)||sf,this.customStoragePrefix=i!=null&&i.customStoragePrefix?`:${i.customStoragePrefix}`:"";const r=typeof(i==null?void 0:i.logger)<"u"&&typeof(i==null?void 0:i.logger)!="string"?i.logger:Oe.pino(Oe.getDefaultLoggerOptions({level:(i==null?void 0:i.logger)||x1.logger}));this.logger=Oe.generateChildLogger(r,this.name),this.heartbeat=new ps.HeartBeat,this.crypto=new X1(this,this.logger,i==null?void 0:i.keychain),this.history=new yb(this,this.logger),this.expirer=new mb(this,this.logger),this.storage=i!=null&&i.storage?i.storage:new fw(pl(pl({},P1),i==null?void 0:i.storageOptions)),this.relayer=new fb({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new vb(this,this.logger),this.verify=new wb(this.projectId||"",this.logger)}static async init(i){const r=new Ic(i);await r.initialize();const n=await r.crypto.getClientId();return await r.storage.setItem(H1,n),r}get context(){return Oe.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(i){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,i),this.logger.error(i.message),i}}}const Ib=Ic,nf="wc",af=2,of="client",xc=`${nf}@${af}:${of}:`,tc={name:of,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},dl="WALLETCONNECT_DEEPLINK_CHOICE",xb="proposal",cf="Proposal expired",Pb="session",sa=ie.SEVEN_DAYS,Sb="engine",zs={wc_sessionPropose:{req:{ttl:ie.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:ie.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:ie.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:ie.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:ie.ONE_DAY,prompt:!1,tag:1104},res:{ttl:ie.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:ie.ONE_DAY,prompt:!1,tag:1106},res:{ttl:ie.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:ie.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:ie.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:ie.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:ie.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:ie.ONE_DAY,prompt:!1,tag:1112},res:{ttl:ie.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:ie.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:ie.THIRTY_SECONDS,prompt:!1,tag:1115}}},rc={min:ie.FIVE_MINUTES,max:ie.SEVEN_DAYS},ii={idle:"IDLE",active:"ACTIVE"},Cb="request",Ob=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"];var Rb=Object.defineProperty,Tb=Object.defineProperties,Ab=Object.getOwnPropertyDescriptors,gl=Object.getOwnPropertySymbols,Nb=Object.prototype.hasOwnProperty,$b=Object.prototype.propertyIsEnumerable,vl=(c,i,r)=>i in c?Rb(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,cr=(c,i)=>{for(var r in i||(i={}))Nb.call(i,r)&&vl(c,r,i[r]);if(gl)for(var r of gl(i))$b.call(i,r)&&vl(c,r,i[r]);return c},Ms=(c,i)=>Tb(c,Ab(i));class Db extends Aw{constructor(i){super(i),this.name=Sb,this.events=new vc,this.initialized=!1,this.ignoredPayloadTypes=[Rl],this.requestQueue={state:ii.idle,queue:[]},this.sessionRequestQueue={state:ii.idle,queue:[]},this.requestQueueDelay=ie.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(zs)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},ie.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{await this.isInitialized();const n=Ms(cr({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);const{pairingTopic:a,requiredNamespaces:l,optionalNamespaces:d,sessionProperties:y,relays:w}=n;let v=a,E,C=!1;if(v&&(C=this.client.core.pairing.pairings.get(v).active),!v||!C){const{topic:he,uri:fe}=await this.client.core.pairing.create();v=he,E=fe}const T=await this.client.core.crypto.generateKeyPair(),j=cr({requiredNamespaces:l,optionalNamespaces:d,relays:w??[{protocol:rf}],proposer:{publicKey:T,metadata:this.client.metadata}},y&&{sessionProperties:y}),{reject:D,resolve:V,done:re}=us(ie.FIVE_MINUTES,cf);if(this.events.once($t("session_connect"),async({error:he,session:fe})=>{if(he)D(he);else if(fe){fe.self.publicKey=T;const pe=Ms(cr({},fe),{requiredNamespaces:fe.requiredNamespaces,optionalNamespaces:fe.optionalNamespaces});await this.client.session.set(fe.topic,pe),await this.setExpiry(fe.topic,fe.expiry),v&&await this.client.core.pairing.updateMetadata({topic:v,metadata:fe.peer.metadata}),V(pe)}}),!v){const{message:he}=X("NO_MATCHING_KEY",`connect() pairing topic: ${v}`);throw new Error(he)}const ce=await this.sendRequest({topic:v,method:"wc_sessionPropose",params:j}),ue=Dr(ie.FIVE_MINUTES);return await this.setProposal(ce,cr({id:ce,expiry:ue},j)),{uri:E,approval:re}},this.pair=async r=>(await this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{await this.isInitialized(),await this.isValidApprove(r);const{id:n,relayProtocol:a,namespaces:l,sessionProperties:d}=r,y=this.client.proposal.get(n);let{pairingTopic:w,proposer:v,requiredNamespaces:E,optionalNamespaces:C}=y;w=w||"",ca(E)||(E=dm(l,"approve()"));const T=await this.client.core.crypto.generateKeyPair(),j=v.publicKey,D=await this.client.core.crypto.generateSharedKey(T,j);w&&n&&(await this.client.core.pairing.updateMetadata({topic:w,metadata:v.metadata}),await this.sendResult({id:n,topic:w,result:{relay:{protocol:a??"irn"},responderPublicKey:T}}),await this.client.proposal.delete(n,tr("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:w}));const V=cr({relay:{protocol:a??"irn"},namespaces:l,requiredNamespaces:E,optionalNamespaces:C,pairingTopic:w,controller:{publicKey:T,metadata:this.client.metadata},expiry:Dr(sa)},d&&{sessionProperties:d});await this.client.core.relayer.subscribe(D),await this.sendRequest({topic:D,method:"wc_sessionSettle",params:V,throwOnFailedPublish:!0});const re=Ms(cr({},V),{topic:D,pairingTopic:w,acknowledged:!1,self:V.controller,peer:{publicKey:v.publicKey,metadata:v.metadata},controller:T});return await this.client.session.set(D,re),await this.setExpiry(D,Dr(sa)),{topic:D,acknowledged:()=>new Promise(ce=>setTimeout(()=>ce(this.client.session.get(D)),500))}},this.reject=async r=>{await this.isInitialized(),await this.isValidReject(r);const{id:n,reason:a}=r,{pairingTopic:l}=this.client.proposal.get(n);l&&(await this.sendError(n,l,a),await this.client.proposal.delete(n,tr("USER_DISCONNECTED")))},this.update=async r=>{await this.isInitialized(),await this.isValidUpdate(r);const{topic:n,namespaces:a}=r,l=await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:a}}),{done:d,resolve:y,reject:w}=us();return this.events.once($t("session_update",l),({error:v})=>{v?w(v):y()}),await this.client.session.update(n,{namespaces:a}),{acknowledged:d}},this.extend=async r=>{await this.isInitialized(),await this.isValidExtend(r);const{topic:n}=r,a=await this.sendRequest({topic:n,method:"wc_sessionExtend",params:{}}),{done:l,resolve:d,reject:y}=us();return this.events.once($t("session_extend",a),({error:w})=>{w?y(w):d()}),await this.setExpiry(n,Dr(sa)),{acknowledged:l}},this.request=async r=>{await this.isInitialized(),await this.isValidRequest(r);const{chainId:n,request:a,topic:l,expiry:d}=r,y=qm(),{done:w,resolve:v,reject:E}=us(d,"Request expired. Please try again.");return this.events.once($t("session_request",y),({error:C,result:T})=>{C?E(C):v(T)}),await Promise.all([new Promise(async C=>{await this.sendRequest({clientRpcId:y,topic:l,method:"wc_sessionRequest",params:{request:a,chainId:n},expiry:d,throwOnFailedPublish:!0}).catch(T=>E(T)),this.client.events.emit("session_request_sent",{topic:l,request:a,chainId:n,id:y}),C()}),new Promise(async C=>{const T=await this.client.core.storage.getItem(dl);gm({id:y,topic:l,wcDeepLink:T}),C()}),w()]).then(C=>C[2])},this.respond=async r=>{await this.isInitialized(),await this.isValidRespond(r);const{topic:n,response:a}=r,{id:l}=a;mi(a)?await this.sendResult({id:l,topic:n,result:a.result,throwOnFailedPublish:!0}):si(a)&&await this.sendError(l,n,a.error),this.cleanupAfterResponse(r)},this.ping=async r=>{await this.isInitialized(),await this.isValidPing(r);const{topic:n}=r;if(this.client.session.keys.includes(n)){const a=await this.sendRequest({topic:n,method:"wc_sessionPing",params:{}}),{done:l,resolve:d,reject:y}=us();this.events.once($t("session_ping",a),({error:w})=>{w?y(w):d()}),await l()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{await this.isInitialized(),await this.isValidEmit(r);const{topic:n,event:a,chainId:l}=r;await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:a,chainId:l}})},this.disconnect=async r=>{await this.isInitialized(),await this.isValidDisconnect(r);const{topic:n}=r;this.client.session.keys.includes(n)?(await this.sendRequest({topic:n,method:"wc_sessionDelete",params:tr("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>vm(n,r))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const n=this.client.core.pairing.pairings.get(r.pairingTopic),a=this.client.core.pairing.pairings.getAll().filter(l=>{var d,y;return((d=l.peerMetadata)==null?void 0:d.url)&&((y=l.peerMetadata)==null?void 0:y.url)===r.peer.metadata.url&&l.topic&&l.topic!==n.topic});if(a.length===0)return;this.client.logger.info(`Cleaning up ${a.length} duplicate pairing(s)`),await Promise.all(a.map(l=>this.client.core.pairing.disconnect({topic:l.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async(r,n)=>{const{self:a}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),this.client.session.delete(r,tr("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(a.publicKey)&&await this.client.core.crypto.deleteKeyPair(a.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(dl).catch(l=>this.client.logger.warn(l))},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,tr("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deletePendingSessionRequest=async(r,n,a=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),a?Promise.resolve():this.client.core.expirer.del(r)]),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(l=>l.id!==r),a&&(this.sessionRequestQueue.state=ii.idle)},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,n.expiry)},this.setPendingSessionRequest=async r=>{const n=zs.wc_sessionRequest.req.ttl,{id:a,topic:l,params:d,verifyContext:y}=r;await this.client.pendingRequest.set(a,{id:a,topic:l,params:d,verifyContext:y}),n&&this.client.core.expirer.set(a,Dr(n))},this.sendRequest=async r=>{const{topic:n,method:a,params:l,expiry:d,relayRpcId:y,clientRpcId:w,throwOnFailedPublish:v}=r,E=Ks(a,l,w);if(Al()&&Ob.includes(a)){const j=ls(JSON.stringify(E));this.client.core.verify.register({attestationId:j})}const C=await this.client.core.crypto.encode(n,E),T=zs[a].req;return d&&(T.ttl=d),y&&(T.id=y),this.client.core.history.set(n,E),v?(T.internal=Ms(cr({},T.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,C,T)):this.client.core.relayer.publish(n,C,T).catch(j=>this.client.logger.error(j)),E.id},this.sendResult=async r=>{const{id:n,topic:a,result:l,throwOnFailedPublish:d}=r,y=_c(n,l),w=await this.client.core.crypto.encode(a,y),v=await this.client.core.history.get(a,n),E=zs[v.request.method].res;d?(E.internal=Ms(cr({},E.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(a,w,E)):this.client.core.relayer.publish(a,w,E).catch(C=>this.client.logger.error(C)),await this.client.core.history.resolve(y)},this.sendError=async(r,n,a)=>{const l=yc(r,a),d=await this.client.core.crypto.encode(n,l),y=await this.client.core.history.get(n,r),w=zs[y.request.method].res;this.client.core.relayer.publish(n,d,w),await this.client.core.history.resolve(l)},this.cleanup=async()=>{const r=[],n=[];this.client.session.getAll().forEach(a=>{wi(a.expiry)&&r.push(a.topic)}),this.client.proposal.getAll().forEach(a=>{wi(a.expiry)&&n.push(a.id)}),await Promise.all([...r.map(a=>this.deleteSession(a)),...n.map(a=>this.deleteProposal(a))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===ii.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=ii.active;const r=this.requestQueue.queue.shift();if(r)try{this.processRequest(r),await new Promise(n=>setTimeout(n,300))}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=ii.idle},this.processRequest=r=>{const{topic:n,payload:a}=r,l=a.method;switch(l){case"wc_sessionPropose":return this.onSessionProposeRequest(n,a);case"wc_sessionSettle":return this.onSessionSettleRequest(n,a);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,a);case"wc_sessionExtend":return this.onSessionExtendRequest(n,a);case"wc_sessionPing":return this.onSessionPingRequest(n,a);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,a);case"wc_sessionRequest":return this.onSessionRequest(n,a);case"wc_sessionEvent":return this.onSessionEventRequest(n,a);default:return this.client.logger.info(`Unsupported request method ${l}`)}},this.onRelayEventResponse=async r=>{const{topic:n,payload:a}=r,l=(await this.client.core.history.get(n,a.id)).request.method;switch(l){case"wc_sessionPropose":return this.onSessionProposeResponse(n,a);case"wc_sessionSettle":return this.onSessionSettleResponse(n,a);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,a);case"wc_sessionExtend":return this.onSessionExtendResponse(n,a);case"wc_sessionPing":return this.onSessionPingResponse(n,a);case"wc_sessionRequest":return this.onSessionRequestResponse(n,a);default:return this.client.logger.info(`Unsupported response method ${l}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:n}=r,{message:a}=X("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(a)},this.onSessionProposeRequest=async(r,n)=>{const{params:a,id:l}=n;try{this.isValidConnect(cr({},n.params));const d=Dr(ie.FIVE_MINUTES),y=cr({id:l,pairingTopic:r,expiry:d},a);await this.setProposal(l,y);const w=ls(JSON.stringify(n)),v=await this.getVerifyContext(w,y.proposer.metadata);this.client.events.emit("session_proposal",{id:l,params:y,verifyContext:v})}catch(d){await this.sendError(l,r,d),this.client.logger.error(d)}},this.onSessionProposeResponse=async(r,n)=>{const{id:a}=n;if(mi(n)){const{result:l}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:l});const d=this.client.proposal.get(a);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:d});const y=d.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:y});const w=l.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:w});const v=await this.client.core.crypto.generateSharedKey(y,w);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:v});const E=await this.client.core.relayer.subscribe(v);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:E}),await this.client.core.pairing.activate({topic:r})}else si(n)&&(await this.client.proposal.delete(a,tr("USER_DISCONNECTED")),this.events.emit($t("session_connect"),{error:n.error}))},this.onSessionSettleRequest=async(r,n)=>{const{id:a,params:l}=n;try{this.isValidSessionSettleRequest(l);const{relay:d,controller:y,expiry:w,namespaces:v,requiredNamespaces:E,optionalNamespaces:C,sessionProperties:T,pairingTopic:j}=n.params,D=cr({topic:r,relay:d,expiry:w,namespaces:v,acknowledged:!0,pairingTopic:j,requiredNamespaces:E,optionalNamespaces:C,controller:y.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:y.publicKey,metadata:y.metadata}},T&&{sessionProperties:T});await this.sendResult({id:n.id,topic:r,result:!0}),this.events.emit($t("session_connect"),{session:D}),this.cleanupDuplicatePairings(D)}catch(d){await this.sendError(a,r,d),this.client.logger.error(d)}},this.onSessionSettleResponse=async(r,n)=>{const{id:a}=n;mi(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit($t("session_approve",a),{})):si(n)&&(await this.client.session.delete(r,tr("USER_DISCONNECTED")),this.events.emit($t("session_approve",a),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{const{params:a,id:l}=n;try{const d=`${r}_session_update`,y=ta.get(d);if(y&&this.isRequestOutOfSync(y,l)){this.client.logger.info(`Discarding out of sync request - ${l}`);return}this.isValidUpdate(cr({topic:r},a)),await this.client.session.update(r,{namespaces:a.namespaces}),await this.sendResult({id:l,topic:r,result:!0}),this.client.events.emit("session_update",{id:l,topic:r,params:a}),ta.set(d,l)}catch(d){await this.sendError(l,r,d),this.client.logger.error(d)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{const{id:a}=n;mi(n)?this.events.emit($t("session_update",a),{}):si(n)&&this.events.emit($t("session_update",a),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{const{id:a}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,Dr(sa)),await this.sendResult({id:a,topic:r,result:!0}),this.client.events.emit("session_extend",{id:a,topic:r})}catch(l){await this.sendError(a,r,l),this.client.logger.error(l)}},this.onSessionExtendResponse=(r,n)=>{const{id:a}=n;mi(n)?this.events.emit($t("session_extend",a),{}):si(n)&&this.events.emit($t("session_extend",a),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{const{id:a}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:a,topic:r,result:!0}),this.client.events.emit("session_ping",{id:a,topic:r})}catch(l){await this.sendError(a,r,l),this.client.logger.error(l)}},this.onSessionPingResponse=(r,n)=>{const{id:a}=n;setTimeout(()=>{mi(n)?this.events.emit($t("session_ping",a),{}):si(n)&&this.events.emit($t("session_ping",a),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{const{id:a}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),await Promise.all([new Promise(l=>{this.client.core.relayer.once(Gt.publish,async()=>{l(await this.deleteSession(r))})}),this.sendResult({id:a,topic:r,result:!0})]),this.client.events.emit("session_delete",{id:a,topic:r})}catch(l){this.client.logger.error(l)}},this.onSessionRequest=async(r,n)=>{const{id:a,params:l}=n;try{this.isValidRequest(cr({topic:r},l));const d=ls(JSON.stringify(Ks("wc_sessionRequest",l,a))),y=this.client.session.get(r),w=await this.getVerifyContext(d,y.peer.metadata),v={id:a,topic:r,params:l,verifyContext:w};await this.setPendingSessionRequest(v),this.addSessionRequestToSessionRequestQueue(v),this.processSessionRequestQueue()}catch(d){await this.sendError(a,r,d),this.client.logger.error(d)}},this.onSessionRequestResponse=(r,n)=>{const{id:a}=n;mi(n)?this.events.emit($t("session_request",a),{result:n.result}):si(n)&&this.events.emit($t("session_request",a),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{const{id:a,params:l}=n;try{const d=`${r}_session_event_${l.event.name}`,y=ta.get(d);if(y&&this.isRequestOutOfSync(y,a)){this.client.logger.info(`Discarding out of sync request - ${a}`);return}this.isValidEmit(cr({topic:r},l)),this.client.events.emit("session_event",{id:a,topic:r,params:l}),ta.set(d,a)}catch(d){await this.sendError(a,r,d),this.client.logger.error(d)}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=ii.idle,this.processSessionRequestQueue()},ie.toMiliseconds(this.requestQueueDelay))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===ii.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=ii.active,this.client.events.emit("session_request",r)}catch(n){this.client.logger.error(n)}},this.onPairingCreated=r=>{if(r.active)return;const n=this.client.proposal.getAll().find(a=>a.pairingTopic===r.topic);n&&this.onSessionProposeRequest(r.topic,Ks("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer},n.id))},this.isValidConnect=async r=>{if(!hr(r)){const{message:w}=X("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(w)}const{pairingTopic:n,requiredNamespaces:a,optionalNamespaces:l,sessionProperties:d,relays:y}=r;if(_i(n)||await this.isValidPairingTopic(n),!ym(y,!0)){const{message:w}=X("MISSING_OR_INVALID",`connect() relays: ${y}`);throw new Error(w)}!_i(a)&&ca(a)!==0&&this.validateNamespaces(a,"requiredNamespaces"),!_i(l)&&ca(l)!==0&&this.validateNamespaces(l,"optionalNamespaces"),_i(d)||this.validateSessionProps(d,"sessionProperties")},this.validateNamespaces=(r,n)=>{const a=mm(r,"connect()",n);if(a)throw new Error(a.message)},this.isValidApprove=async r=>{if(!hr(r))throw new Error(X("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:n,namespaces:a,relayProtocol:l,sessionProperties:d}=r;await this.isValidProposalId(n);const y=this.client.proposal.get(n),w=Vo(a,"approve()");if(w)throw new Error(w.message);const v=Rh(y.requiredNamespaces,a,"approve()");if(v)throw new Error(v.message);if(!hs(l,!0)){const{message:E}=X("MISSING_OR_INVALID",`approve() relayProtocol: ${l}`);throw new Error(E)}_i(d)||this.validateSessionProps(d,"sessionProperties")},this.isValidReject=async r=>{if(!hr(r)){const{message:l}=X("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(l)}const{id:n,reason:a}=r;if(await this.isValidProposalId(n),!wm(a)){const{message:l}=X("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(a)}`);throw new Error(l)}},this.isValidSessionSettleRequest=r=>{if(!hr(r)){const{message:v}=X("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(v)}const{relay:n,controller:a,namespaces:l,expiry:d}=r;if(!_m(n)){const{message:v}=X("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(v)}const y=bm(a,"onSessionSettleRequest()");if(y)throw new Error(y.message);const w=Vo(l,"onSessionSettleRequest()");if(w)throw new Error(w.message);if(wi(d)){const{message:v}=X("EXPIRED","onSessionSettleRequest()");throw new Error(v)}},this.isValidUpdate=async r=>{if(!hr(r)){const{message:w}=X("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(w)}const{topic:n,namespaces:a}=r;await this.isValidSessionTopic(n);const l=this.client.session.get(n),d=Vo(a,"update()");if(d)throw new Error(d.message);const y=Rh(l.requiredNamespaces,a,"update()");if(y)throw new Error(y.message)},this.isValidExtend=async r=>{if(!hr(r)){const{message:a}=X("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(a)}const{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!hr(r)){const{message:w}=X("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(w)}const{topic:n,request:a,chainId:l,expiry:d}=r;await this.isValidSessionTopic(n);const{namespaces:y}=this.client.session.get(n);if(!Th(y,l)){const{message:w}=X("MISSING_OR_INVALID",`request() chainId: ${l}`);throw new Error(w)}if(!Em(a)){const{message:w}=X("MISSING_OR_INVALID",`request() ${JSON.stringify(a)}`);throw new Error(w)}if(!Im(y,l,a.method)){const{message:w}=X("MISSING_OR_INVALID",`request() method: ${a.method}`);throw new Error(w)}if(d&&!xm(d,rc)){const{message:w}=X("MISSING_OR_INVALID",`request() expiry: ${d}. Expiry must be a number (in seconds) between ${rc.min} and ${rc.max}`);throw new Error(w)}},this.isValidRespond=async r=>{if(!hr(r)){const{message:l}=X("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(l)}const{topic:n,response:a}=r;if(await this.isValidSessionTopic(n),!Pm(a)){const{message:l}=X("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(a)}`);throw new Error(l)}},this.isValidPing=async r=>{if(!hr(r)){const{message:a}=X("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(a)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!hr(r)){const{message:y}=X("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(y)}const{topic:n,event:a,chainId:l}=r;await this.isValidSessionTopic(n);const{namespaces:d}=this.client.session.get(n);if(!Th(d,l)){const{message:y}=X("MISSING_OR_INVALID",`emit() chainId: ${l}`);throw new Error(y)}if(!Sm(a)){const{message:y}=X("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(a)}`);throw new Error(y)}if(!Cm(d,l,a.name)){const{message:y}=X("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(a)}`);throw new Error(y)}},this.isValidDisconnect=async r=>{if(!hr(r)){const{message:a}=X("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(a)}const{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.getVerifyContext=async(r,n)=>{const a={verified:{verifyUrl:n.verifyUrl||la,validation:"UNKNOWN",origin:n.url||""}};try{const l=await this.client.core.verify.resolve({attestationId:r,verifyUrl:n.verifyUrl});l&&(a.verified.origin=l.origin,a.verified.isScam=l.isScam,a.verified.validation=l.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(l){this.client.logger.info(l)}return this.client.logger.info(`Verify context: ${JSON.stringify(a)}`),a},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(a=>{if(!hs(a,!1)){const{message:l}=X("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(a)}`);throw new Error(l)}})}}async isInitialized(){if(!this.initialized){const{message:i}=X("NOT_INITIALIZED",this.name);throw new Error(i)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Gt.message,async i=>{const{topic:r,message:n}=i;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;const a=await this.client.core.crypto.decode(r,n);try{mc(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a})):wc(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a})}catch(l){this.client.logger.error(l)}})}registerExpirerEvents(){this.client.core.expirer.on(Sr.expired,async i=>{const{topic:r,id:n}=Tl(i.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,X("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession(r,!0),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(Hs.create,i=>this.onPairingCreated(i))}isValidPairingTopic(i){if(!hs(i,!1)){const{message:r}=X("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(i)){const{message:r}=X("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(r)}if(wi(this.client.core.pairing.pairings.get(i).expiry)){const{message:r}=X("EXPIRED",`pairing topic: ${i}`);throw new Error(r)}}async isValidSessionTopic(i){if(!hs(i,!1)){const{message:r}=X("MISSING_OR_INVALID",`session topic should be a string: ${i}`);throw new Error(r)}if(!this.client.session.keys.includes(i)){const{message:r}=X("NO_MATCHING_KEY",`session topic doesn't exist: ${i}`);throw new Error(r)}if(wi(this.client.session.get(i).expiry)){await this.deleteSession(i);const{message:r}=X("EXPIRED",`session topic: ${i}`);throw new Error(r)}}async isValidSessionOrPairingTopic(i){if(this.client.session.keys.includes(i))await this.isValidSessionTopic(i);else if(this.client.core.pairing.pairings.keys.includes(i))this.isValidPairingTopic(i);else if(hs(i,!1)){const{message:r}=X("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${i}`);throw new Error(r)}else{const{message:r}=X("MISSING_OR_INVALID",`session or pairing topic should be a string: ${i}`);throw new Error(r)}}async isValidProposalId(i){if(!Om(i)){const{message:r}=X("MISSING_OR_INVALID",`proposal id should be a number: ${i}`);throw new Error(r)}if(!this.client.proposal.keys.includes(i)){const{message:r}=X("NO_MATCHING_KEY",`proposal id doesn't exist: ${i}`);throw new Error(r)}if(wi(this.client.proposal.get(i).expiry)){await this.deleteProposal(i);const{message:r}=X("EXPIRED",`proposal id: ${i}`);throw new Error(r)}}}class Lb extends ma{constructor(i,r){super(i,r,xb,xc),this.core=i,this.logger=r}}class qb extends ma{constructor(i,r){super(i,r,Pb,xc),this.core=i,this.logger=r}}class zb extends ma{constructor(i,r){super(i,r,Cb,xc,n=>n.id),this.core=i,this.logger=r}}let Mb=class uf extends Tw{constructor(i){super(i),this.protocol=nf,this.version=af,this.name=tc.name,this.events=new Kr.EventEmitter,this.on=(n,a)=>this.events.on(n,a),this.once=(n,a)=>this.events.once(n,a),this.off=(n,a)=>this.events.off(n,a),this.removeListener=(n,a)=>this.events.removeListener(n,a),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(a){throw this.logger.error(a.message),a}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(a){throw this.logger.error(a.message),a}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(a){throw this.logger.error(a.message),a}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(a){throw this.logger.error(a.message),a}},this.update=async n=>{try{return await this.engine.update(n)}catch(a){throw this.logger.error(a.message),a}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(a){throw this.logger.error(a.message),a}},this.request=async n=>{try{return await this.engine.request(n)}catch(a){throw this.logger.error(a.message),a}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(a){throw this.logger.error(a.message),a}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(a){throw this.logger.error(a.message),a}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(a){throw this.logger.error(a.message),a}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(a){throw this.logger.error(a.message),a}},this.find=n=>{try{return this.engine.find(n)}catch(a){throw this.logger.error(a.message),a}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.name=(i==null?void 0:i.name)||tc.name,this.metadata=(i==null?void 0:i.metadata)||pm();const r=typeof(i==null?void 0:i.logger)<"u"&&typeof(i==null?void 0:i.logger)!="string"?i.logger:Oe.pino(Oe.getDefaultLoggerOptions({level:(i==null?void 0:i.logger)||tc.logger}));this.core=(i==null?void 0:i.core)||new Ib(i),this.logger=Oe.generateChildLogger(r,this.name),this.session=new qb(this.core,this.logger),this.proposal=new Lb(this.core,this.logger),this.pendingRequest=new zb(this.core,this.logger),this.engine=new Db(this)}static async init(i){const r=new uf(i);return await r.initialize(),r}get context(){return Oe.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(i){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(i.message),i}}};const yl="error",jb="wss://relay.walletconnect.com",Ub="wc",Hb="universal_provider",ml=`${Ub}@2:${Hb}:`,kb="https://rpc.walletconnect.com/v1/",ai={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var js=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},fc={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors @@ -24,10 +24,10 @@ __p += '`),Ce&&(H+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+H+`return __p -}`;var we=Ih(function(){return De(p,ee+"return "+H).apply(r,m)});if(we.source=H,$o(we))throw we;return we}function Qy(e){return qe(e).toLowerCase()}function Yy(e){return qe(e).toUpperCase()}function Xy(e,t,s){if(e=qe(e),e&&(s||t===r))return Nc(e);if(!e||!(t=pr(t)))return e;var o=Rr(e),h=Rr(t),p=$c(o,h),m=Dc(o,h)+1;return vi(o,p,m).join("")}function Zy(e,t,s){if(e=qe(e),e&&(s||t===r))return e.slice(0,qc(e)+1);if(!e||!(t=pr(t)))return e;var o=Rr(e),h=Dc(o,Rr(t))+1;return vi(o,0,h).join("")}function e0(e,t,s){if(e=qe(e),e&&(s||t===r))return e.replace(gt,"");if(!e||!(t=pr(t)))return e;var o=Rr(e),h=$c(o,Rr(t));return vi(o,h).join("")}function t0(e,t){var s=te,o=Ee;if(ct(t)){var h="separator"in t?t.separator:h;s="length"in t?ye(t.length):s,o="omission"in t?pr(t.omission):o}e=qe(e);var p=e.length;if(Yi(e)){var m=Rr(e);p=m.length}if(s>=p)return e;var _=s-Xi(o);if(_<1)return o;var P=m?vi(m,0,_).join(""):e.slice(0,_);if(h===r)return P+o;if(m&&(_+=P.length-_),Do(h)){if(e.slice(_).search(h)){var q,z=P;for(h.global||(h=Ja(h.source,qe(yr.exec(h))+"g")),h.lastIndex=0;q=h.exec(z);)var H=q.index;P=P.slice(0,H===r?_:H)}}else if(e.indexOf(pr(h),_)!=_){var G=P.lastIndexOf(h);G>-1&&(P=P.slice(0,G))}return P+o}function r0(e){return e=qe(e),e&<.test(e)?e.replace(oi,Af):e}var i0=ns(function(e,t,s){return e+(s?" ":"")+t.toUpperCase()}),zo=xu("toUpperCase");function Eh(e,t,s){return e=qe(e),t=s?r:t,t===r?Sf(e)?Df(e):yf(e):e.match(t)||[]}var Ih=be(function(e,t){try{return Mt(e,r,t)}catch(s){return $o(s)?s:new le(s)}}),s0=Yr(function(e,t){return wr(t,function(s){s=Hr(s),Jr(e,s,Ao(e[s],e))}),e});function n0(e){var t=e==null?0:e.length,s=se();return e=t?it(e,function(o){if(typeof o[1]!="function")throw new _r(d);return[s(o[0]),o[1]]}):[],be(function(o){for(var h=-1;++hJ)return[];var s=B,o=Ft(e,B);t=se(t),e-=B;for(var h=Ba(o,t);++s0||t<0)?new Pe(s):(e<0?s=s.takeRight(-e):e&&(s=s.drop(e)),t!==r&&(t=ye(t),s=t<0?s.dropRight(-t):s.take(t-e)),s)},Pe.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Pe.prototype.toArray=function(){return this.take(B)},jr(Pe.prototype,function(e,t){var s=/^(?:filter|find|map|reject)|While$/.test(t),o=/^(?:head|last)$/.test(t),h=f[o?"take"+(t=="last"?"Right":""):t],p=o||/^find/.test(t);h&&(f.prototype[t]=function(){var m=this.__wrapped__,_=o?[1]:arguments,P=m instanceof Pe,q=_[0],z=P||ge(m),H=function(Ie){var Ce=h.apply(f,hi([Ie],_));return o&&G?Ce[0]:Ce};z&&s&&typeof q=="function"&&q.length!=1&&(P=z=!1);var G=this.__chain__,ee=!!this.__actions__.length,ne=p&&!G,we=P&&!ee;if(!p&&z){m=we?m:new Pe(this);var ae=e.apply(m,_);return ae.__actions__.push({func:Bn,args:[H],thisArg:r}),new br(ae,G)}return ne&&we?e.apply(this,_):(ae=this.thru(H),ne?o?ae.value()[0]:ae.value():ae)})}),wr(["pop","push","shift","sort","splice","unshift"],function(e){var t=mn[e],s=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",o=/^(?:pop|shift)$/.test(e);f.prototype[e]=function(){var h=arguments;if(o&&!this.__chain__){var p=this.value();return t.apply(ge(p)?p:[],h)}return this[s](function(m){return t.apply(ge(m)?m:[],h)})}}),jr(Pe.prototype,function(e,t){var s=f[t];if(s){var o=s.name+"";Me.call(rs,o)||(rs[o]=[]),rs[o].push({name:t,func:s})}}),rs[jn(r,ce).name]=[{name:"wrapper",func:r}],Pe.prototype.clone=rp,Pe.prototype.reverse=ip,Pe.prototype.value=sp,f.prototype.at=$g,f.prototype.chain=Dg,f.prototype.commit=Lg,f.prototype.next=qg,f.prototype.plant=Mg,f.prototype.reverse=jg,f.prototype.toJSON=f.prototype.valueOf=f.prototype.value=Ug,f.prototype.first=f.prototype.head,ws&&(f.prototype[ws]=zg),f},Zi=Lf();_t?((_t.exports=Zi)._=Zi,Be._=Zi):Se._=Zi}).call(js)})(fc,fc.exports);var Kb=Object.defineProperty,Vb=Object.defineProperties,Fb=Object.getOwnPropertyDescriptors,wl=Object.getOwnPropertySymbols,Bb=Object.prototype.hasOwnProperty,Gb=Object.prototype.propertyIsEnumerable,_l=(c,i,r)=>i in c?Kb(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,na=(c,i)=>{for(var r in i||(i={}))Bb.call(i,r)&&_l(c,r,i[r]);if(wl)for(var r of wl(i))Gb.call(i,r)&&_l(c,r,i[r]);return c},Wb=(c,i)=>Vb(c,Fb(i));function Ei(c,i,r){var n;const a=Rm(c);return((n=i.rpcMap)==null?void 0:n[a.reference])||`${kb}?chainId=${a.namespace}:${a.reference}&projectId=${r}`}function ki(c){return c.includes(":")?c.split(":")[1]:c}function hf(c){return c.map(i=>`${i.split(":")[0]}:${i.split(":")[1]}`)}function Jb(c,i){const r=Object.keys(i.namespaces).filter(a=>a.includes(c));if(!r.length)return[];const n=[];return r.forEach(a=>{const l=i.namespaces[a].accounts;n.push(...l)}),n}function Qb(c={},i={}){const r=bl(c),n=bl(i);return fc.exports.merge(r,n)}function bl(c){var i,r,n,a;const l={};if(!ca(c))return l;for(const[d,y]of Object.entries(c)){const w=Dl(d)?[d]:y.chains,v=y.methods||[],E=y.events||[],C=y.rpcMap||{},T=Us(d);l[T]=Wb(na(na({},l[T]),y),{chains:Fo(w,(i=l[T])==null?void 0:i.chains),methods:Fo(v,(r=l[T])==null?void 0:r.methods),events:Fo(E,(n=l[T])==null?void 0:n.events),rpcMap:na(na({},C),(a=l[T])==null?void 0:a.rpcMap)})}return l}function Yb(c){return c.includes(":")?c.split(":")[2]:c}function Xb(c){const i={};for(const[r,n]of Object.entries(c)){const a=n.methods||[],l=n.events||[],d=n.accounts||[],y=Dl(r)?[r]:n.chains?n.chains:hf(n.accounts);i[r]={chains:y,methods:a,events:l,accounts:d}}return i}function ic(c){return typeof c=="number"?c:c.includes("0x")?parseInt(c,16):c.includes(":")?Number(c.split(":")[1]):Number(c)}const lf={},st=c=>lf[c],sc=(c,i)=>{lf[c]=i};class Zb{constructor(i){this.name="polkadot",this.namespace=i.namespace,this.events=st("events"),this.client=st("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,r){this.httpProviders[i]||this.setHttpProvider(i,r),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}getAccounts(){const i=this.namespace.accounts;return i?i.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(r=>{var n;const a=ki(r);i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[r])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,r=this.httpProviders[i];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return r}setHttpProvider(i,r){const n=this.createHttpProvider(i,r);n&&(this.httpProviders[i]=n)}createHttpProvider(i,r){const n=r||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new ni(new Ii(n,st("disableProviderPing")))}}class eE{constructor(i){this.name="eip155",this.namespace=i.namespace,this.events=st("events"),this.client=st("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(i){switch(i.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(i);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(i.request.method)?await this.client.request(i):this.getHttpProvider().request(i.request)}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}setDefaultChain(i,r){this.httpProviders[i]||this.setHttpProvider(parseInt(i),r),this.chainId=parseInt(i),this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}createHttpProvider(i,r){const n=r||Ei(`${this.name}:${i}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new ni(new Ii(n,st("disableProviderPing")))}setHttpProvider(i,r){const n=this.createHttpProvider(i,r);n&&(this.httpProviders[i]=n)}createHttpProviders(){const i={};return this.namespace.chains.forEach(r=>{var n;const a=parseInt(ki(r));i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[r])}),i}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const i=this.chainId,r=this.httpProviders[i];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return r}async handleSwitchChain(i){var r,n;let a=i.request.params?(r=i.request.params[0])==null?void 0:r.chainId:"0x0";a=a.startsWith("0x")?a:`0x${a}`;const l=parseInt(a,16);if(this.isChainApproved(l))this.setDefaultChain(`${l}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:i.topic,request:{method:i.request.method,params:[{chainId:a}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${l}`);else throw new Error(`Failed to switch to chain 'eip155:${l}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(i){return this.namespace.chains.includes(`${this.name}:${i}`)}}class tE{constructor(i){this.name="solana",this.namespace=i.namespace,this.events=st("events"),this.client=st("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,r){this.httpProviders[i]||this.setHttpProvider(i,r),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(r=>{var n;const a=ki(r);i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[r])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,r=this.httpProviders[i];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return r}setHttpProvider(i,r){const n=this.createHttpProvider(i,r);n&&(this.httpProviders[i]=n)}createHttpProvider(i,r){const n=r||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new ni(new Ii(n,st("disableProviderPing")))}}class rE{constructor(i){this.name="cosmos",this.namespace=i.namespace,this.events=st("events"),this.client=st("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,r){this.httpProviders[i]||this.setHttpProvider(i,r),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(r=>{var n;const a=ki(r);i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[r])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,r=this.httpProviders[i];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return r}setHttpProvider(i,r){const n=this.createHttpProvider(i,r);n&&(this.httpProviders[i]=n)}createHttpProvider(i,r){const n=r||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new ni(new Ii(n,st("disableProviderPing")))}}class iE{constructor(i){this.name="cip34",this.namespace=i.namespace,this.events=st("events"),this.client=st("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,r){this.httpProviders[i]||this.setHttpProvider(i,r),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),a=ki(r);i[a]=this.createHttpProvider(a,n)}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,r=this.httpProviders[i];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return r}getCardanoRPCUrl(i){const r=this.namespace.rpcMap;if(r)return r[i]}setHttpProvider(i,r){const n=this.createHttpProvider(i,r);n&&(this.httpProviders[i]=n)}createHttpProvider(i,r){const n=r||this.getCardanoRPCUrl(i);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new ni(new Ii(n,st("disableProviderPing")))}}class sE{constructor(i){this.name="elrond",this.namespace=i.namespace,this.events=st("events"),this.client=st("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,r){this.httpProviders[i]||this.setHttpProvider(i,r),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(r=>{var n;const a=ki(r);i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[r])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,r=this.httpProviders[i];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return r}setHttpProvider(i,r){const n=this.createHttpProvider(i,r);n&&(this.httpProviders[i]=n)}createHttpProvider(i,r){const n=r||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new ni(new Ii(n,st("disableProviderPing")))}}class nE{constructor(i){this.name="multiversx",this.namespace=i.namespace,this.events=st("events"),this.client=st("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,r){this.httpProviders[i]||this.setHttpProvider(i,r),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(r=>{var n;const a=ki(r);i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[r])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,r=this.httpProviders[i];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return r}setHttpProvider(i,r){const n=this.createHttpProvider(i,r);n&&(this.httpProviders[i]=n)}createHttpProvider(i,r){const n=r||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new ni(new Ii(n,st("disableProviderPing")))}}class aE{constructor(i){this.name="near",this.namespace=i.namespace,this.events=st("events"),this.client=st("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,r){if(this.chainId=i,!this.httpProviders[i]){const n=r||Ei(`${this.name}:${i}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);this.setHttpProvider(i,n)}this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const i=this.namespace.accounts;return i?i.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(r=>{var n;i[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,r=this.httpProviders[i];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return r}setHttpProvider(i,r){const n=this.createHttpProvider(i,r);n&&(this.httpProviders[i]=n)}createHttpProvider(i,r){const n=r||Ei(i,this.namespace);return typeof n>"u"?void 0:new ni(new Ii(n,st("disableProviderPing")))}}var oE=Object.defineProperty,cE=Object.defineProperties,uE=Object.getOwnPropertyDescriptors,El=Object.getOwnPropertySymbols,hE=Object.prototype.hasOwnProperty,lE=Object.prototype.propertyIsEnumerable,Il=(c,i,r)=>i in c?oE(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,aa=(c,i)=>{for(var r in i||(i={}))hE.call(i,r)&&Il(c,r,i[r]);if(El)for(var r of El(i))lE.call(i,r)&&Il(c,r,i[r]);return c},nc=(c,i)=>cE(c,uE(i));class Pc{constructor(i){this.events=new vc,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=i,this.logger=typeof(i==null?void 0:i.logger)<"u"&&typeof(i==null?void 0:i.logger)!="string"?i.logger:Oe.pino(Oe.getDefaultLoggerOptions({level:(i==null?void 0:i.logger)||yl})),this.disableProviderPing=(i==null?void 0:i.disableProviderPing)||!1}static async init(i){const r=new Pc(i);return await r.initialize(),r}async request(i,r){const[n,a]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:aa({},i),chainId:`${n}:${a}`,topic:this.session.topic})}sendAsync(i,r,n){this.request(i,n).then(a=>r(null,a)).catch(a=>r(a,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var i;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(i=this.session)==null?void 0:i.topic,reason:tr("USER_DISCONNECTED")}),await this.cleanup()}async connect(i){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(i),await this.cleanupPendingPairings(),!i.skipPairing)return await this.pair(i.pairingTopic)}on(i,r){this.events.on(i,r)}once(i,r){this.events.once(i,r)}removeListener(i,r){this.events.removeListener(i,r)}off(i,r){this.events.off(i,r)}get isWalletConnect(){return!0}async pair(i){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:a}=await this.client.connect({pairingTopic:i,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await a().then(l=>{this.session=l,this.namespaces||(this.namespaces=Xb(l.namespaces),this.persist("namespaces",this.namespaces))}).catch(l=>{if(l.message!==cf)throw l;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(i,r){try{if(!this.session)return;const[n,a]=this.validateChain(i);this.getProvider(n).setDefaultChain(a,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(i={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(fs(r)){for(const n of r)i.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const i=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[i]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await Mb.init({logger:this.providerOpts.logger||yl,relayUrl:this.providerOpts.relayUrl||jb,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const i=[...new Set(Object.keys(this.session.namespaces).map(r=>Us(r)))];sc("client",this.client),sc("events",this.events),sc("disableProviderPing",this.disableProviderPing),i.forEach(r=>{if(!this.session)return;const n=Jb(r,this.session),a=hf(n),l=Qb(this.namespaces,this.optionalNamespaces),d=nc(aa({},l[r]),{accounts:n,chains:a});switch(r){case"eip155":this.rpcProviders[r]=new eE({namespace:d});break;case"solana":this.rpcProviders[r]=new tE({namespace:d});break;case"cosmos":this.rpcProviders[r]=new rE({namespace:d});break;case"polkadot":this.rpcProviders[r]=new Zb({namespace:d});break;case"cip34":this.rpcProviders[r]=new iE({namespace:d});break;case"elrond":this.rpcProviders[r]=new sE({namespace:d});break;case"multiversx":this.rpcProviders[r]=new nE({namespace:d});break;case"near":this.rpcProviders[r]=new aE({namespace:d});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",i=>{this.events.emit("session_ping",i)}),this.client.on("session_event",i=>{const{params:r}=i,{event:n}=r;if(n.name==="accountsChanged"){const a=n.data;a&&fs(a)&&this.events.emit("accountsChanged",a.map(Yb))}else if(n.name==="chainChanged"){const a=r.chainId,l=r.event.data,d=Us(a),y=ic(a)!==ic(l)?`${d}:${ic(l)}`:a;this.onChainChanged(y)}else this.events.emit(n.name,n.data);this.events.emit("session_event",i)}),this.client.on("session_update",({topic:i,params:r})=>{var n;const{namespaces:a}=r,l=(n=this.client)==null?void 0:n.session.get(i);this.session=nc(aa({},l),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:i,params:r})}),this.client.on("session_delete",async i=>{await this.cleanup(),this.events.emit("session_delete",i),this.events.emit("disconnect",nc(aa({},tr("USER_DISCONNECTED")),{data:i.topic}))}),this.on(ai.DEFAULT_CHAIN_CHANGED,i=>{this.onChainChanged(i,!0)})}getProvider(i){if(!this.rpcProviders[i])throw new Error(`Provider not found: ${i}`);return this.rpcProviders[i]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(i=>{var r;this.getProvider(i).updateNamespace((r=this.session)==null?void 0:r.namespaces[i])})}setNamespaces(i){const{namespaces:r,optionalNamespaces:n,sessionProperties:a}=i;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=a,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(i){const[r,n]=(i==null?void 0:i.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(d=>Us(d)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const a=Us(Object.keys(this.namespaces)[0]),l=this.rpcProviders[a].getDefaultChain();return[a,l]}async requestAccounts(){const[i]=this.validateChain();return await this.getProvider(i).requestAccounts()}onChainChanged(i,r=!1){var n;if(!this.namespaces)return;const[a,l]=this.validateChain(i);r||this.getProvider(a).setDefaultChain(l),((n=this.namespaces[a])!=null?n:this.namespaces[`${a}:${l}`]).defaultChain=l,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",l)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(i,r){this.client.core.storage.setItem(`${ml}/${i}`,r)}async getFromStore(i){return await this.client.core.storage.getItem(`${ml}/${i}`)}}const fE=Pc,pE="wc",dE="ethereum_provider",gE=`${pE}@2:${dE}:`,vE="https://rpc.walletconnect.com/v1/",pc=["eth_sendTransaction","personal_sign"],yE=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],dc=["chainChanged","accountsChanged"],mE=["chainChanged","accountsChanged","message","disconnect","connect"];var wE=Object.defineProperty,_E=Object.defineProperties,bE=Object.getOwnPropertyDescriptors,xl=Object.getOwnPropertySymbols,EE=Object.prototype.hasOwnProperty,IE=Object.prototype.propertyIsEnumerable,Pl=(c,i,r)=>i in c?wE(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,ks=(c,i)=>{for(var r in i||(i={}))EE.call(i,r)&&Pl(c,r,i[r]);if(xl)for(var r of xl(i))IE.call(i,r)&&Pl(c,r,i[r]);return c},Sl=(c,i)=>_E(c,bE(i));function da(c){return Number(c[0].split(":")[1])}function ac(c){return`0x${c.toString(16)}`}function xE(c){const{chains:i,optionalChains:r,methods:n,optionalMethods:a,events:l,optionalEvents:d,rpcMap:y}=c;if(!fs(i))throw new Error("Invalid chains");const w={chains:i,methods:n||pc,events:l||dc,rpcMap:ks({},i.length?{[da(i)]:y[da(i)]}:{})},v=l==null?void 0:l.filter(j=>!dc.includes(j)),E=n==null?void 0:n.filter(j=>!pc.includes(j));if(!r&&!d&&!a&&!(v!=null&&v.length)&&!(E!=null&&E.length))return{required:i.length?w:void 0};const C=(v==null?void 0:v.length)&&(E==null?void 0:E.length)||!r,T={chains:[...new Set(C?w.chains.concat(r||[]):r)],methods:[...new Set(w.methods.concat(a!=null&&a.length?a:yE))],events:[...new Set(w.events.concat(d!=null&&d.length?d:mE))],rpcMap:y};return{required:i.length?w:void 0,optional:r.length?T:void 0}}class Sc{constructor(){this.events=new Kr.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=gE,this.on=(i,r)=>(this.events.on(i,r),this),this.once=(i,r)=>(this.events.once(i,r),this),this.removeListener=(i,r)=>(this.events.removeListener(i,r),this),this.off=(i,r)=>(this.events.off(i,r),this),this.parseAccount=i=>this.isCompatibleChainId(i)?this.parseAccountId(i).address:i,this.signer={},this.rpc={}}static async init(i){const r=new Sc;return await r.initialize(i),r}async request(i){return await this.signer.request(i,this.formatChainId(this.chainId))}sendAsync(i,r){this.signer.sendAsync(i,r,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(i){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(i);const{required:r,optional:n}=xE(this.rpc);try{const a=await new Promise(async(d,y)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(v=>{!v.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),y(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(Sl(ks({namespaces:ks({},r&&{[this.namespace]:r})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:i==null?void 0:i.pairingTopic})).then(v=>{d(v)}).catch(v=>{y(new Error(v.message))})});if(!a)return;const l=Tm(a.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:l),this.setAccounts(l),this.events.emit("connect",{chainId:ac(this.chainId)})}catch(a){throw this.signer.logger.error(a),a}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",i=>{const{params:r}=i,{event:n}=r;n.name==="accountsChanged"?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):n.name==="chainChanged"?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",i)}),this.signer.on("chainChanged",i=>{const r=parseInt(i);this.chainId=r,this.events.emit("chainChanged",ac(this.chainId)),this.persist()}),this.signer.on("session_update",i=>{this.events.emit("session_update",i)}),this.signer.on("session_delete",i=>{this.reset(),this.events.emit("session_delete",i),this.events.emit("disconnect",Sl(ks({},tr("USER_DISCONNECTED")),{data:i.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",i=>{var r,n;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(n=this.modal)==null||n.openModal({uri:i})),this.events.emit("display_uri",i)})}switchEthereumChain(i){this.request({method:"wallet_switchEthereumChain",params:[{chainId:i.toString(16)}]})}isCompatibleChainId(i){return typeof i=="string"?i.startsWith(`${this.namespace}:`):!1}formatChainId(i){return`${this.namespace}:${i}`}parseChainId(i){return Number(i.split(":")[1])}setChainIds(i){const r=i.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",ac(this.chainId)),this.persist())}setChainId(i){if(this.isCompatibleChainId(i)){const r=this.parseChainId(i);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(i){const[r,n,a]=i.split(":");return{chainId:`${r}:${n}`,address:a}}setAccounts(i){this.accounts=i.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(i){var r,n;const a=(r=i==null?void 0:i.chains)!=null?r:[],l=(n=i==null?void 0:i.optionalChains)!=null?n:[],d=a.concat(l);if(!d.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const y=a.length?(i==null?void 0:i.methods)||pc:[],w=a.length?(i==null?void 0:i.events)||dc:[],v=(i==null?void 0:i.optionalMethods)||[],E=(i==null?void 0:i.optionalEvents)||[],C=(i==null?void 0:i.rpcMap)||this.buildRpcMap(d,i.projectId),T=(i==null?void 0:i.qrModalOptions)||void 0;return{chains:a==null?void 0:a.map(j=>this.formatChainId(j)),optionalChains:l.map(j=>this.formatChainId(j)),methods:y,events:w,optionalMethods:v,optionalEvents:E,rpcMap:C,showQrModal:!!(i!=null&&i.showQrModal),qrModalOptions:T,projectId:i.projectId,metadata:i.metadata}}buildRpcMap(i,r){const n={};return i.forEach(a=>{n[a]=this.getRpcUrl(a,r)}),n}async initialize(i){if(this.rpc=this.getRpcConfig(i),this.chainId=this.rpc.chains.length?da(this.rpc.chains):da(this.rpc.optionalChains),this.signer=await fE.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:i.disableProviderPing,relayUrl:i.relayUrl,storageOptions:i.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:n}=await Am(()=>import("./index-BWemBGvP.js").then(a=>a.i),__vite__mapDeps([0,1,2]));r=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(ks({walletConnectVersion:2,projectId:this.rpc.projectId,standaloneChains:this.rpc.chains},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(i){if(!i)return;const{chains:r,optionalChains:n,rpcMap:a}=i;r&&fs(r)&&(this.rpc.chains=r.map(l=>this.formatChainId(l)),r.forEach(l=>{this.rpc.rpcMap[l]=(a==null?void 0:a[l])||this.getRpcUrl(l)})),n&&fs(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n==null?void 0:n.map(l=>this.formatChainId(l)),n.forEach(l=>{this.rpc.rpcMap[l]=(a==null?void 0:a[l])||this.getRpcUrl(l)}))}getRpcUrl(i,r){var n;return((n=this.rpc.rpcMap)==null?void 0:n[i])||`${vE}?chainId=eip155:${i}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const i=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${i}`]?this.session.namespaces[`${this.namespace}:${i}`]:this.session.namespaces[this.namespace];this.setChainIds(i?[this.formatChainId(i)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(i){return typeof i=="string"||i instanceof String?[this.parseAccount(i)]:i.map(r=>this.parseAccount(r))}}const zE=Sc;export{zE as EthereumProvider,mE as OPTIONAL_EVENTS,yE as OPTIONAL_METHODS,dc as REQUIRED_EVENTS,pc as REQUIRED_METHODS,Sc as default}; +}`;var we=Ih(function(){return De(p,ee+"return "+H).apply(r,m)});if(we.source=H,$o(we))throw we;return we}function Qy(e){return qe(e).toLowerCase()}function Yy(e){return qe(e).toUpperCase()}function Xy(e,t,s){if(e=qe(e),e&&(s||t===r))return Nc(e);if(!e||!(t=pr(t)))return e;var o=Rr(e),h=Rr(t),p=$c(o,h),m=Dc(o,h)+1;return vi(o,p,m).join("")}function Zy(e,t,s){if(e=qe(e),e&&(s||t===r))return e.slice(0,qc(e)+1);if(!e||!(t=pr(t)))return e;var o=Rr(e),h=Dc(o,Rr(t))+1;return vi(o,0,h).join("")}function e0(e,t,s){if(e=qe(e),e&&(s||t===r))return e.replace(gt,"");if(!e||!(t=pr(t)))return e;var o=Rr(e),h=$c(o,Rr(t));return vi(o,h).join("")}function t0(e,t){var s=te,o=Ee;if(ct(t)){var h="separator"in t?t.separator:h;s="length"in t?ye(t.length):s,o="omission"in t?pr(t.omission):o}e=qe(e);var p=e.length;if(Yi(e)){var m=Rr(e);p=m.length}if(s>=p)return e;var _=s-Xi(o);if(_<1)return o;var P=m?vi(m,0,_).join(""):e.slice(0,_);if(h===r)return P+o;if(m&&(_+=P.length-_),Do(h)){if(e.slice(_).search(h)){var q,z=P;for(h.global||(h=Ja(h.source,qe(yr.exec(h))+"g")),h.lastIndex=0;q=h.exec(z);)var H=q.index;P=P.slice(0,H===r?_:H)}}else if(e.indexOf(pr(h),_)!=_){var G=P.lastIndexOf(h);G>-1&&(P=P.slice(0,G))}return P+o}function r0(e){return e=qe(e),e&<.test(e)?e.replace(oi,Af):e}var i0=ns(function(e,t,s){return e+(s?" ":"")+t.toUpperCase()}),zo=xu("toUpperCase");function Eh(e,t,s){return e=qe(e),t=s?r:t,t===r?Sf(e)?Df(e):yf(e):e.match(t)||[]}var Ih=be(function(e,t){try{return Mt(e,r,t)}catch(s){return $o(s)?s:new le(s)}}),s0=Yr(function(e,t){return wr(t,function(s){s=Hr(s),Jr(e,s,Ao(e[s],e))}),e});function n0(e){var t=e==null?0:e.length,s=se();return e=t?it(e,function(o){if(typeof o[1]!="function")throw new _r(d);return[s(o[0]),o[1]]}):[],be(function(o){for(var h=-1;++hJ)return[];var s=B,o=Ft(e,B);t=se(t),e-=B;for(var h=Ba(o,t);++s0||t<0)?new Pe(s):(e<0?s=s.takeRight(-e):e&&(s=s.drop(e)),t!==r&&(t=ye(t),s=t<0?s.dropRight(-t):s.take(t-e)),s)},Pe.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Pe.prototype.toArray=function(){return this.take(B)},jr(Pe.prototype,function(e,t){var s=/^(?:filter|find|map|reject)|While$/.test(t),o=/^(?:head|last)$/.test(t),h=f[o?"take"+(t=="last"?"Right":""):t],p=o||/^find/.test(t);h&&(f.prototype[t]=function(){var m=this.__wrapped__,_=o?[1]:arguments,P=m instanceof Pe,q=_[0],z=P||ge(m),H=function(Ie){var Ce=h.apply(f,hi([Ie],_));return o&&G?Ce[0]:Ce};z&&s&&typeof q=="function"&&q.length!=1&&(P=z=!1);var G=this.__chain__,ee=!!this.__actions__.length,ne=p&&!G,we=P&&!ee;if(!p&&z){m=we?m:new Pe(this);var ae=e.apply(m,_);return ae.__actions__.push({func:Bn,args:[H],thisArg:r}),new br(ae,G)}return ne&&we?e.apply(this,_):(ae=this.thru(H),ne?o?ae.value()[0]:ae.value():ae)})}),wr(["pop","push","shift","sort","splice","unshift"],function(e){var t=mn[e],s=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",o=/^(?:pop|shift)$/.test(e);f.prototype[e]=function(){var h=arguments;if(o&&!this.__chain__){var p=this.value();return t.apply(ge(p)?p:[],h)}return this[s](function(m){return t.apply(ge(m)?m:[],h)})}}),jr(Pe.prototype,function(e,t){var s=f[t];if(s){var o=s.name+"";Me.call(rs,o)||(rs[o]=[]),rs[o].push({name:t,func:s})}}),rs[jn(r,ce).name]=[{name:"wrapper",func:r}],Pe.prototype.clone=rp,Pe.prototype.reverse=ip,Pe.prototype.value=sp,f.prototype.at=$g,f.prototype.chain=Dg,f.prototype.commit=Lg,f.prototype.next=qg,f.prototype.plant=Mg,f.prototype.reverse=jg,f.prototype.toJSON=f.prototype.valueOf=f.prototype.value=Ug,f.prototype.first=f.prototype.head,ws&&(f.prototype[ws]=zg),f},Zi=Lf();_t?((_t.exports=Zi)._=Zi,Be._=Zi):Se._=Zi}).call(js)})(fc,fc.exports);var Kb=Object.defineProperty,Vb=Object.defineProperties,Fb=Object.getOwnPropertyDescriptors,wl=Object.getOwnPropertySymbols,Bb=Object.prototype.hasOwnProperty,Gb=Object.prototype.propertyIsEnumerable,_l=(c,i,r)=>i in c?Kb(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,na=(c,i)=>{for(var r in i||(i={}))Bb.call(i,r)&&_l(c,r,i[r]);if(wl)for(var r of wl(i))Gb.call(i,r)&&_l(c,r,i[r]);return c},Wb=(c,i)=>Vb(c,Fb(i));function Ei(c,i,r){var n;const a=Rm(c);return((n=i.rpcMap)==null?void 0:n[a.reference])||`${kb}?chainId=${a.namespace}:${a.reference}&projectId=${r}`}function ki(c){return c.includes(":")?c.split(":")[1]:c}function hf(c){return c.map(i=>`${i.split(":")[0]}:${i.split(":")[1]}`)}function Jb(c,i){const r=Object.keys(i.namespaces).filter(a=>a.includes(c));if(!r.length)return[];const n=[];return r.forEach(a=>{const l=i.namespaces[a].accounts;n.push(...l)}),n}function Qb(c={},i={}){const r=bl(c),n=bl(i);return fc.exports.merge(r,n)}function bl(c){var i,r,n,a;const l={};if(!ca(c))return l;for(const[d,y]of Object.entries(c)){const w=Dl(d)?[d]:y.chains,v=y.methods||[],E=y.events||[],C=y.rpcMap||{},T=Us(d);l[T]=Wb(na(na({},l[T]),y),{chains:Fo(w,(i=l[T])==null?void 0:i.chains),methods:Fo(v,(r=l[T])==null?void 0:r.methods),events:Fo(E,(n=l[T])==null?void 0:n.events),rpcMap:na(na({},C),(a=l[T])==null?void 0:a.rpcMap)})}return l}function Yb(c){return c.includes(":")?c.split(":")[2]:c}function Xb(c){const i={};for(const[r,n]of Object.entries(c)){const a=n.methods||[],l=n.events||[],d=n.accounts||[],y=Dl(r)?[r]:n.chains?n.chains:hf(n.accounts);i[r]={chains:y,methods:a,events:l,accounts:d}}return i}function ic(c){return typeof c=="number"?c:c.includes("0x")?parseInt(c,16):c.includes(":")?Number(c.split(":")[1]):Number(c)}const lf={},st=c=>lf[c],sc=(c,i)=>{lf[c]=i};class Zb{constructor(i){this.name="polkadot",this.namespace=i.namespace,this.events=st("events"),this.client=st("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,r){this.httpProviders[i]||this.setHttpProvider(i,r),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}getAccounts(){const i=this.namespace.accounts;return i?i.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(r=>{var n;const a=ki(r);i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[r])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,r=this.httpProviders[i];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return r}setHttpProvider(i,r){const n=this.createHttpProvider(i,r);n&&(this.httpProviders[i]=n)}createHttpProvider(i,r){const n=r||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new ni(new Ii(n,st("disableProviderPing")))}}class eE{constructor(i){this.name="eip155",this.namespace=i.namespace,this.events=st("events"),this.client=st("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(i){switch(i.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(i);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(i.request.method)?await this.client.request(i):this.getHttpProvider().request(i.request)}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}setDefaultChain(i,r){this.httpProviders[i]||this.setHttpProvider(parseInt(i),r),this.chainId=parseInt(i),this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}createHttpProvider(i,r){const n=r||Ei(`${this.name}:${i}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new ni(new Ii(n,st("disableProviderPing")))}setHttpProvider(i,r){const n=this.createHttpProvider(i,r);n&&(this.httpProviders[i]=n)}createHttpProviders(){const i={};return this.namespace.chains.forEach(r=>{var n;const a=parseInt(ki(r));i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[r])}),i}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const i=this.chainId,r=this.httpProviders[i];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return r}async handleSwitchChain(i){var r,n;let a=i.request.params?(r=i.request.params[0])==null?void 0:r.chainId:"0x0";a=a.startsWith("0x")?a:`0x${a}`;const l=parseInt(a,16);if(this.isChainApproved(l))this.setDefaultChain(`${l}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:i.topic,request:{method:i.request.method,params:[{chainId:a}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${l}`);else throw new Error(`Failed to switch to chain 'eip155:${l}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(i){return this.namespace.chains.includes(`${this.name}:${i}`)}}class tE{constructor(i){this.name="solana",this.namespace=i.namespace,this.events=st("events"),this.client=st("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,r){this.httpProviders[i]||this.setHttpProvider(i,r),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(r=>{var n;const a=ki(r);i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[r])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,r=this.httpProviders[i];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return r}setHttpProvider(i,r){const n=this.createHttpProvider(i,r);n&&(this.httpProviders[i]=n)}createHttpProvider(i,r){const n=r||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new ni(new Ii(n,st("disableProviderPing")))}}class rE{constructor(i){this.name="cosmos",this.namespace=i.namespace,this.events=st("events"),this.client=st("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,r){this.httpProviders[i]||this.setHttpProvider(i,r),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(r=>{var n;const a=ki(r);i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[r])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,r=this.httpProviders[i];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return r}setHttpProvider(i,r){const n=this.createHttpProvider(i,r);n&&(this.httpProviders[i]=n)}createHttpProvider(i,r){const n=r||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new ni(new Ii(n,st("disableProviderPing")))}}class iE{constructor(i){this.name="cip34",this.namespace=i.namespace,this.events=st("events"),this.client=st("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,r){this.httpProviders[i]||this.setHttpProvider(i,r),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),a=ki(r);i[a]=this.createHttpProvider(a,n)}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,r=this.httpProviders[i];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return r}getCardanoRPCUrl(i){const r=this.namespace.rpcMap;if(r)return r[i]}setHttpProvider(i,r){const n=this.createHttpProvider(i,r);n&&(this.httpProviders[i]=n)}createHttpProvider(i,r){const n=r||this.getCardanoRPCUrl(i);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new ni(new Ii(n,st("disableProviderPing")))}}class sE{constructor(i){this.name="elrond",this.namespace=i.namespace,this.events=st("events"),this.client=st("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,r){this.httpProviders[i]||this.setHttpProvider(i,r),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(r=>{var n;const a=ki(r);i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[r])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,r=this.httpProviders[i];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return r}setHttpProvider(i,r){const n=this.createHttpProvider(i,r);n&&(this.httpProviders[i]=n)}createHttpProvider(i,r){const n=r||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new ni(new Ii(n,st("disableProviderPing")))}}class nE{constructor(i){this.name="multiversx",this.namespace=i.namespace,this.events=st("events"),this.client=st("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,r){this.httpProviders[i]||this.setHttpProvider(i,r),this.chainId=i,this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${i}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}getAccounts(){const i=this.namespace.accounts;return i?[...new Set(i.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(r=>{var n;const a=ki(r);i[a]=this.createHttpProvider(a,(n=this.namespace.rpcMap)==null?void 0:n[r])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,r=this.httpProviders[i];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return r}setHttpProvider(i,r){const n=this.createHttpProvider(i,r);n&&(this.httpProviders[i]=n)}createHttpProvider(i,r){const n=r||Ei(i,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);return new ni(new Ii(n,st("disableProviderPing")))}}class aE{constructor(i){this.name="near",this.namespace=i.namespace,this.events=st("events"),this.client=st("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(i){this.namespace=Object.assign(this.namespace,i)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const i=this.namespace.chains[0];if(!i)throw new Error("ChainId not found");return i.split(":")[1]}request(i){return this.namespace.methods.includes(i.request.method)?this.client.request(i):this.getHttpProvider().request(i.request)}setDefaultChain(i,r){if(this.chainId=i,!this.httpProviders[i]){const n=r||Ei(`${this.name}:${i}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${i}`);this.setHttpProvider(i,n)}this.events.emit(ai.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const i=this.namespace.accounts;return i?i.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const i={};return this.namespace.chains.forEach(r=>{var n;i[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),i}getHttpProvider(){const i=`${this.name}:${this.chainId}`,r=this.httpProviders[i];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${i} not found`);return r}setHttpProvider(i,r){const n=this.createHttpProvider(i,r);n&&(this.httpProviders[i]=n)}createHttpProvider(i,r){const n=r||Ei(i,this.namespace);return typeof n>"u"?void 0:new ni(new Ii(n,st("disableProviderPing")))}}var oE=Object.defineProperty,cE=Object.defineProperties,uE=Object.getOwnPropertyDescriptors,El=Object.getOwnPropertySymbols,hE=Object.prototype.hasOwnProperty,lE=Object.prototype.propertyIsEnumerable,Il=(c,i,r)=>i in c?oE(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,aa=(c,i)=>{for(var r in i||(i={}))hE.call(i,r)&&Il(c,r,i[r]);if(El)for(var r of El(i))lE.call(i,r)&&Il(c,r,i[r]);return c},nc=(c,i)=>cE(c,uE(i));class Pc{constructor(i){this.events=new vc,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=i,this.logger=typeof(i==null?void 0:i.logger)<"u"&&typeof(i==null?void 0:i.logger)!="string"?i.logger:Oe.pino(Oe.getDefaultLoggerOptions({level:(i==null?void 0:i.logger)||yl})),this.disableProviderPing=(i==null?void 0:i.disableProviderPing)||!1}static async init(i){const r=new Pc(i);return await r.initialize(),r}async request(i,r){const[n,a]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:aa({},i),chainId:`${n}:${a}`,topic:this.session.topic})}sendAsync(i,r,n){this.request(i,n).then(a=>r(null,a)).catch(a=>r(a,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var i;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(i=this.session)==null?void 0:i.topic,reason:tr("USER_DISCONNECTED")}),await this.cleanup()}async connect(i){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(i),await this.cleanupPendingPairings(),!i.skipPairing)return await this.pair(i.pairingTopic)}on(i,r){this.events.on(i,r)}once(i,r){this.events.once(i,r)}removeListener(i,r){this.events.removeListener(i,r)}off(i,r){this.events.off(i,r)}get isWalletConnect(){return!0}async pair(i){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:a}=await this.client.connect({pairingTopic:i,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await a().then(l=>{this.session=l,this.namespaces||(this.namespaces=Xb(l.namespaces),this.persist("namespaces",this.namespaces))}).catch(l=>{if(l.message!==cf)throw l;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(i,r){try{if(!this.session)return;const[n,a]=this.validateChain(i);this.getProvider(n).setDefaultChain(a,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(i={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(fs(r)){for(const n of r)i.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const i=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[i]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await Mb.init({logger:this.providerOpts.logger||yl,relayUrl:this.providerOpts.relayUrl||jb,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const i=[...new Set(Object.keys(this.session.namespaces).map(r=>Us(r)))];sc("client",this.client),sc("events",this.events),sc("disableProviderPing",this.disableProviderPing),i.forEach(r=>{if(!this.session)return;const n=Jb(r,this.session),a=hf(n),l=Qb(this.namespaces,this.optionalNamespaces),d=nc(aa({},l[r]),{accounts:n,chains:a});switch(r){case"eip155":this.rpcProviders[r]=new eE({namespace:d});break;case"solana":this.rpcProviders[r]=new tE({namespace:d});break;case"cosmos":this.rpcProviders[r]=new rE({namespace:d});break;case"polkadot":this.rpcProviders[r]=new Zb({namespace:d});break;case"cip34":this.rpcProviders[r]=new iE({namespace:d});break;case"elrond":this.rpcProviders[r]=new sE({namespace:d});break;case"multiversx":this.rpcProviders[r]=new nE({namespace:d});break;case"near":this.rpcProviders[r]=new aE({namespace:d});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",i=>{this.events.emit("session_ping",i)}),this.client.on("session_event",i=>{const{params:r}=i,{event:n}=r;if(n.name==="accountsChanged"){const a=n.data;a&&fs(a)&&this.events.emit("accountsChanged",a.map(Yb))}else if(n.name==="chainChanged"){const a=r.chainId,l=r.event.data,d=Us(a),y=ic(a)!==ic(l)?`${d}:${ic(l)}`:a;this.onChainChanged(y)}else this.events.emit(n.name,n.data);this.events.emit("session_event",i)}),this.client.on("session_update",({topic:i,params:r})=>{var n;const{namespaces:a}=r,l=(n=this.client)==null?void 0:n.session.get(i);this.session=nc(aa({},l),{namespaces:a}),this.onSessionUpdate(),this.events.emit("session_update",{topic:i,params:r})}),this.client.on("session_delete",async i=>{await this.cleanup(),this.events.emit("session_delete",i),this.events.emit("disconnect",nc(aa({},tr("USER_DISCONNECTED")),{data:i.topic}))}),this.on(ai.DEFAULT_CHAIN_CHANGED,i=>{this.onChainChanged(i,!0)})}getProvider(i){if(!this.rpcProviders[i])throw new Error(`Provider not found: ${i}`);return this.rpcProviders[i]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(i=>{var r;this.getProvider(i).updateNamespace((r=this.session)==null?void 0:r.namespaces[i])})}setNamespaces(i){const{namespaces:r,optionalNamespaces:n,sessionProperties:a}=i;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=a,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(i){const[r,n]=(i==null?void 0:i.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(d=>Us(d)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const a=Us(Object.keys(this.namespaces)[0]),l=this.rpcProviders[a].getDefaultChain();return[a,l]}async requestAccounts(){const[i]=this.validateChain();return await this.getProvider(i).requestAccounts()}onChainChanged(i,r=!1){var n;if(!this.namespaces)return;const[a,l]=this.validateChain(i);r||this.getProvider(a).setDefaultChain(l),((n=this.namespaces[a])!=null?n:this.namespaces[`${a}:${l}`]).defaultChain=l,this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",l)}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(i,r){this.client.core.storage.setItem(`${ml}/${i}`,r)}async getFromStore(i){return await this.client.core.storage.getItem(`${ml}/${i}`)}}const fE=Pc,pE="wc",dE="ethereum_provider",gE=`${pE}@2:${dE}:`,vE="https://rpc.walletconnect.com/v1/",pc=["eth_sendTransaction","personal_sign"],yE=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],dc=["chainChanged","accountsChanged"],mE=["chainChanged","accountsChanged","message","disconnect","connect"];var wE=Object.defineProperty,_E=Object.defineProperties,bE=Object.getOwnPropertyDescriptors,xl=Object.getOwnPropertySymbols,EE=Object.prototype.hasOwnProperty,IE=Object.prototype.propertyIsEnumerable,Pl=(c,i,r)=>i in c?wE(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,ks=(c,i)=>{for(var r in i||(i={}))EE.call(i,r)&&Pl(c,r,i[r]);if(xl)for(var r of xl(i))IE.call(i,r)&&Pl(c,r,i[r]);return c},Sl=(c,i)=>_E(c,bE(i));function da(c){return Number(c[0].split(":")[1])}function ac(c){return`0x${c.toString(16)}`}function xE(c){const{chains:i,optionalChains:r,methods:n,optionalMethods:a,events:l,optionalEvents:d,rpcMap:y}=c;if(!fs(i))throw new Error("Invalid chains");const w={chains:i,methods:n||pc,events:l||dc,rpcMap:ks({},i.length?{[da(i)]:y[da(i)]}:{})},v=l==null?void 0:l.filter(j=>!dc.includes(j)),E=n==null?void 0:n.filter(j=>!pc.includes(j));if(!r&&!d&&!a&&!(v!=null&&v.length)&&!(E!=null&&E.length))return{required:i.length?w:void 0};const C=(v==null?void 0:v.length)&&(E==null?void 0:E.length)||!r,T={chains:[...new Set(C?w.chains.concat(r||[]):r)],methods:[...new Set(w.methods.concat(a!=null&&a.length?a:yE))],events:[...new Set(w.events.concat(d!=null&&d.length?d:mE))],rpcMap:y};return{required:i.length?w:void 0,optional:r.length?T:void 0}}class Sc{constructor(){this.events=new Kr.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=gE,this.on=(i,r)=>(this.events.on(i,r),this),this.once=(i,r)=>(this.events.once(i,r),this),this.removeListener=(i,r)=>(this.events.removeListener(i,r),this),this.off=(i,r)=>(this.events.off(i,r),this),this.parseAccount=i=>this.isCompatibleChainId(i)?this.parseAccountId(i).address:i,this.signer={},this.rpc={}}static async init(i){const r=new Sc;return await r.initialize(i),r}async request(i){return await this.signer.request(i,this.formatChainId(this.chainId))}sendAsync(i,r){this.signer.sendAsync(i,r,this.formatChainId(this.chainId))}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(i){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(i);const{required:r,optional:n}=xE(this.rpc);try{const a=await new Promise(async(d,y)=>{var w;this.rpc.showQrModal&&((w=this.modal)==null||w.subscribeModal(v=>{!v.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),y(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(Sl(ks({namespaces:ks({},r&&{[this.namespace]:r})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:i==null?void 0:i.pairingTopic})).then(v=>{d(v)}).catch(v=>{y(new Error(v.message))})});if(!a)return;const l=Tm(a.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:l),this.setAccounts(l),this.events.emit("connect",{chainId:ac(this.chainId)})}catch(a){throw this.signer.logger.error(a),a}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",i=>{const{params:r}=i,{event:n}=r;n.name==="accountsChanged"?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):n.name==="chainChanged"?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",i)}),this.signer.on("chainChanged",i=>{const r=parseInt(i);this.chainId=r,this.events.emit("chainChanged",ac(this.chainId)),this.persist()}),this.signer.on("session_update",i=>{this.events.emit("session_update",i)}),this.signer.on("session_delete",i=>{this.reset(),this.events.emit("session_delete",i),this.events.emit("disconnect",Sl(ks({},tr("USER_DISCONNECTED")),{data:i.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",i=>{var r,n;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(n=this.modal)==null||n.openModal({uri:i})),this.events.emit("display_uri",i)})}switchEthereumChain(i){this.request({method:"wallet_switchEthereumChain",params:[{chainId:i.toString(16)}]})}isCompatibleChainId(i){return typeof i=="string"?i.startsWith(`${this.namespace}:`):!1}formatChainId(i){return`${this.namespace}:${i}`}parseChainId(i){return Number(i.split(":")[1])}setChainIds(i){const r=i.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",ac(this.chainId)),this.persist())}setChainId(i){if(this.isCompatibleChainId(i)){const r=this.parseChainId(i);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(i){const[r,n,a]=i.split(":");return{chainId:`${r}:${n}`,address:a}}setAccounts(i){this.accounts=i.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(i){var r,n;const a=(r=i==null?void 0:i.chains)!=null?r:[],l=(n=i==null?void 0:i.optionalChains)!=null?n:[],d=a.concat(l);if(!d.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const y=a.length?(i==null?void 0:i.methods)||pc:[],w=a.length?(i==null?void 0:i.events)||dc:[],v=(i==null?void 0:i.optionalMethods)||[],E=(i==null?void 0:i.optionalEvents)||[],C=(i==null?void 0:i.rpcMap)||this.buildRpcMap(d,i.projectId),T=(i==null?void 0:i.qrModalOptions)||void 0;return{chains:a==null?void 0:a.map(j=>this.formatChainId(j)),optionalChains:l.map(j=>this.formatChainId(j)),methods:y,events:w,optionalMethods:v,optionalEvents:E,rpcMap:C,showQrModal:!!(i!=null&&i.showQrModal),qrModalOptions:T,projectId:i.projectId,metadata:i.metadata}}buildRpcMap(i,r){const n={};return i.forEach(a=>{n[a]=this.getRpcUrl(a,r)}),n}async initialize(i){if(this.rpc=this.getRpcConfig(i),this.chainId=this.rpc.chains.length?da(this.rpc.chains):da(this.rpc.optionalChains),this.signer=await fE.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:i.disableProviderPing,relayUrl:i.relayUrl,storageOptions:i.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:n}=await Am(()=>import("./index-YweLEVJf.js").then(a=>a.i),__vite__mapDeps([0,1,2]));r=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(ks({walletConnectVersion:2,projectId:this.rpc.projectId,standaloneChains:this.rpc.chains},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(i){if(!i)return;const{chains:r,optionalChains:n,rpcMap:a}=i;r&&fs(r)&&(this.rpc.chains=r.map(l=>this.formatChainId(l)),r.forEach(l=>{this.rpc.rpcMap[l]=(a==null?void 0:a[l])||this.getRpcUrl(l)})),n&&fs(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n==null?void 0:n.map(l=>this.formatChainId(l)),n.forEach(l=>{this.rpc.rpcMap[l]=(a==null?void 0:a[l])||this.getRpcUrl(l)}))}getRpcUrl(i,r){var n;return((n=this.rpc.rpcMap)==null?void 0:n[i])||`${vE}?chainId=eip155:${i}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const i=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${i}`]?this.session.namespaces[`${this.namespace}:${i}`]:this.session.namespaces[this.namespace];this.setChainIds(i?[this.formatChainId(i)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(i){return typeof i=="string"||i instanceof String?[this.parseAccount(i)]:i.map(r=>this.parseAccount(r))}}const zE=Sc;export{zE as EthereumProvider,mE as OPTIONAL_EVENTS,yE as OPTIONAL_METHODS,dc as REQUIRED_EVENTS,pc as REQUIRED_METHODS,Sc as default}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/index-BWemBGvP.js","assets/index-i7WuWpn4.js","assets/index-qK5f71Lf.css"] + __vite__mapDeps.viteFileDeps = ["assets/index-YweLEVJf.js","assets/index-iGWvbPrT.js","assets/index-qK5f71Lf.css"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } \ No newline at end of file diff --git a/index.html b/index.html index beab45e..489204e 100644 --- a/index.html +++ b/index.html @@ -5,8 +5,8 @@ Vite + React + TS - - + +