@multiplatform.one/web3 8.1.0 → 8.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1761,7 +1761,7 @@ function print() { __p += __j.call(arguments, '') }
1761
1761
  `}return Ae%2&&_e>0?vt.substring(0,vt.length-Ae-1)+Array(Ae+1).join("▀"):vt.substring(0,vt.length-1)})(oe);ce-=1,oe=oe===void 0?2*ce:oe;var re,he,ye,be,ve=A.getModuleCount()*ce+2*oe,xe=oe,ke=ve-oe,He=Array(ce+1).join("██"),qe=Array(ce+1).join(" "),ze="",Re="";for(re=0;re<ve;re+=1){for(ye=Math.floor((re-xe)/ce),Re="",he=0;he<ve;he+=1)be=1,xe<=he&&he<ke&&xe<=re&&re<ke&&A.isDark(ye,Math.floor((he-xe)/ce))&&(be=0),Re+=be?He:qe;for(ye=0;ye<ce;ye+=1)ze+=Re+`
1762
1762
  `}return ze.substring(0,ze.length-1)},A.renderTo2dContext=function(ce,oe){oe=oe||2;for(var re=A.getModuleCount(),he=0;he<re;he++)for(var ye=0;ye<re;ye++)ce.fillStyle=A.isDark(he,ye)?"black":"white",ce.fillRect(he*oe,ye*oe,oe,oe)},A};p.stringToBytes=(p.stringToBytesFuncs={default:function(W){for(var F=[],$=0;$<W.length;$+=1){var b=W.charCodeAt($);F.push(255&b)}return F}}).default,p.createStringToBytes=function(W,F){var $=(function(){for(var g=G(W),C=function(){var K=g.read();if(K==-1)throw"eof";return K},B=0,x={};;){var A=g.read();if(A==-1)break;var U=C(),z=C()<<8|C();x[String.fromCharCode(A<<8|U)]=z,B+=1}if(B!=F)throw B+" != "+F;return x})(),b=63;return function(g){for(var C=[],B=0;B<g.length;B+=1){var x=g.charCodeAt(B);if(x<128)C.push(x);else{var A=$[g.charAt(B)];typeof A=="number"?(255&A)==A?C.push(A):(C.push(A>>>8),C.push(255&A)):C.push(b)}}return C}};var f,m,v,y,E,I={L:1,M:0,Q:3,H:2},w=(f=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],m=1335,v=7973,E=function(W){for(var F=0;W!=0;)F+=1,W>>>=1;return F},(y={}).getBCHTypeInfo=function(W){for(var F=W<<10;E(F)-E(m)>=0;)F^=m<<E(F)-E(m);return 21522^(W<<10|F)},y.getBCHTypeNumber=function(W){for(var F=W<<12;E(F)-E(v)>=0;)F^=v<<E(F)-E(v);return W<<12|F},y.getPatternPosition=function(W){return f[W-1]},y.getMaskFunction=function(W){switch(W){case 0:return function(F,$){return(F+$)%2==0};case 1:return function(F,$){return F%2==0};case 2:return function(F,$){return $%3==0};case 3:return function(F,$){return(F+$)%3==0};case 4:return function(F,$){return(Math.floor(F/2)+Math.floor($/3))%2==0};case 5:return function(F,$){return F*$%2+F*$%3==0};case 6:return function(F,$){return(F*$%2+F*$%3)%2==0};case 7:return function(F,$){return(F*$%3+(F+$)%2)%2==0};default:throw"bad maskPattern:"+W}},y.getErrorCorrectPolynomial=function(W){for(var F=_([1],0),$=0;$<W;$+=1)F=F.multiply(_([1,j.gexp($)],0));return F},y.getLengthInBits=function(W,F){if(1<=F&&F<10)switch(W){case 1:return 10;case 2:return 9;case 4:case 8:return 8;default:throw"mode:"+W}else if(F<27)switch(W){case 1:return 12;case 2:return 11;case 4:return 16;case 8:return 10;default:throw"mode:"+W}else{if(!(F<41))throw"type:"+F;switch(W){case 1:return 14;case 2:return 13;case 4:return 16;case 8:return 12;default:throw"mode:"+W}}},y.getLostPoint=function(W){for(var F=W.getModuleCount(),$=0,b=0;b<F;b+=1)for(var g=0;g<F;g+=1){for(var C=0,B=W.isDark(b,g),x=-1;x<=1;x+=1)if(!(b+x<0||F<=b+x))for(var A=-1;A<=1;A+=1)g+A<0||F<=g+A||x==0&&A==0||B==W.isDark(b+x,g+A)&&(C+=1);C>5&&($+=3+C-5)}for(b=0;b<F-1;b+=1)for(g=0;g<F-1;g+=1){var U=0;W.isDark(b,g)&&(U+=1),W.isDark(b+1,g)&&(U+=1),W.isDark(b,g+1)&&(U+=1),W.isDark(b+1,g+1)&&(U+=1),U!=0&&U!=4||($+=3)}for(b=0;b<F;b+=1)for(g=0;g<F-6;g+=1)W.isDark(b,g)&&!W.isDark(b,g+1)&&W.isDark(b,g+2)&&W.isDark(b,g+3)&&W.isDark(b,g+4)&&!W.isDark(b,g+5)&&W.isDark(b,g+6)&&($+=40);for(g=0;g<F;g+=1)for(b=0;b<F-6;b+=1)W.isDark(b,g)&&!W.isDark(b+1,g)&&W.isDark(b+2,g)&&W.isDark(b+3,g)&&W.isDark(b+4,g)&&!W.isDark(b+5,g)&&W.isDark(b+6,g)&&($+=40);var z=0;for(g=0;g<F;g+=1)for(b=0;b<F;b+=1)W.isDark(b,g)&&(z+=1);return $+Math.abs(100*z/F/F-50)/5*10},y),j=(function(){for(var W=new Array(256),F=new Array(256),$=0;$<8;$+=1)W[$]=1<<$;for($=8;$<256;$+=1)W[$]=W[$-4]^W[$-5]^W[$-6]^W[$-8];for($=0;$<255;$+=1)F[W[$]]=$;return{glog:function(b){if(b<1)throw"glog("+b+")";return F[b]},gexp:function(b){for(;b<0;)b+=255;for(;b>=256;)b-=255;return W[b]}}})();function _(W,F){if(W.length===void 0)throw W.length+"/"+F;var $=(function(){for(var g=0;g<W.length&&W[g]==0;)g+=1;for(var C=new Array(W.length-g+F),B=0;B<W.length-g;B+=1)C[B]=W[B+g];return C})(),b={getAt:function(g){return $[g]},getLength:function(){return $.length},multiply:function(g){for(var C=new Array(b.getLength()+g.getLength()-1),B=0;B<b.getLength();B+=1)for(var x=0;x<g.getLength();x+=1)C[B+x]^=j.gexp(j.glog(b.getAt(B))+j.glog(g.getAt(x)));return _(C,0)},mod:function(g){if(b.getLength()-g.getLength()<0)return b;for(var C=j.glog(b.getAt(0))-j.glog(g.getAt(0)),B=new Array(b.getLength()),x=0;x<b.getLength();x+=1)B[x]=b.getAt(x);for(x=0;x<g.getLength();x+=1)B[x]^=j.gexp(j.glog(g.getAt(x))+C);return _(B,0).mod(g)}};return b}var O=(function(){var W=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],F=function($,b){var g={};return g.totalCount=$,g.dataCount=b,g};return{getRSBlocks:function($,b){var g=(function(V,ee){switch(ee){case I.L:return W[4*(V-1)+0];case I.M:return W[4*(V-1)+1];case I.Q:return W[4*(V-1)+2];case I.H:return W[4*(V-1)+3];default:return}})($,b);if(g===void 0)throw"bad rs block @ typeNumber:"+$+"/errorCorrectionLevel:"+b;for(var C=g.length/3,B=[],x=0;x<C;x+=1)for(var A=g[3*x+0],U=g[3*x+1],z=g[3*x+2],K=0;K<A;K+=1)B.push(F(U,z));return B}}})(),R=function(){var W=[],F=0,$={getBuffer:function(){return W},getAt:function(b){return(W[Math.floor(b/8)]>>>7-b%8&1)==1},put:function(b,g){for(var C=0;C<g;C+=1)$.putBit((b>>>g-C-1&1)==1)},getLengthInBits:function(){return F},putBit:function(b){var g=Math.floor(F/8);W.length<=g&&W.push(0),b&&(W[g]|=128>>>F%8),F+=1}};return $},P=function(W){var F=W,$={getMode:function(){return 1},getLength:function(C){return F.length},write:function(C){for(var B=F,x=0;x+2<B.length;)C.put(b(B.substring(x,x+3)),10),x+=3;x<B.length&&(B.length-x==1?C.put(b(B.substring(x,x+1)),4):B.length-x==2&&C.put(b(B.substring(x,x+2)),7))}},b=function(C){for(var B=0,x=0;x<C.length;x+=1)B=10*B+g(C.charAt(x));return B},g=function(C){if("0"<=C&&C<="9")return C.charCodeAt(0)-48;throw"illegal char :"+C};return $},k=function(W){var F=W,$={getMode:function(){return 2},getLength:function(g){return F.length},write:function(g){for(var C=F,B=0;B+1<C.length;)g.put(45*b(C.charAt(B))+b(C.charAt(B+1)),11),B+=2;B<C.length&&g.put(b(C.charAt(B)),6)}},b=function(g){if("0"<=g&&g<="9")return g.charCodeAt(0)-48;if("A"<=g&&g<="Z")return g.charCodeAt(0)-65+10;switch(g){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+g}};return $},M=function(W){var F=p.stringToBytes(W);return{getMode:function(){return 4},getLength:function($){return F.length},write:function($){for(var b=0;b<F.length;b+=1)$.put(F[b],8)}}},L=function(W){var F=p.stringToBytesFuncs.SJIS;if(!F)throw"sjis not supported.";(function(){var b=F("友");if(b.length!=2||(b[0]<<8|b[1])!=38726)throw"sjis not supported."})();var $=F(W);return{getMode:function(){return 8},getLength:function(b){return~~($.length/2)},write:function(b){for(var g=$,C=0;C+1<g.length;){var B=(255&g[C])<<8|255&g[C+1];if(33088<=B&&B<=40956)B-=33088;else{if(!(57408<=B&&B<=60351))throw"illegal char at "+(C+1)+"/"+B;B-=49472}B=192*(B>>>8&255)+(255&B),b.put(B,13),C+=2}if(C<g.length)throw"illegal char at "+(C+1)}}},H=function(){var W=[],F={writeByte:function($){W.push(255&$)},writeShort:function($){F.writeByte($),F.writeByte($>>>8)},writeBytes:function($,b,g){b=b||0,g=g||$.length;for(var C=0;C<g;C+=1)F.writeByte($[C+b])},writeString:function($){for(var b=0;b<$.length;b+=1)F.writeByte($.charCodeAt(b))},toByteArray:function(){return W},toString:function(){var $="";$+="[";for(var b=0;b<W.length;b+=1)b>0&&($+=","),$+=W[b];return $+"]"}};return F},G=function(W){var F=W,$=0,b=0,g=0,C={read:function(){for(;g<8;){if($>=F.length){if(g==0)return-1;throw"unexpected end of file./"+g}var x=F.charAt($);if($+=1,x=="=")return g=0,-1;x.match(/^\s$/)||(b=b<<6|B(x.charCodeAt(0)),g+=6)}var A=b>>>g-8&255;return g-=8,A}},B=function(x){if(65<=x&&x<=90)return x-65;if(97<=x&&x<=122)return x-97+26;if(48<=x&&x<=57)return x-48+52;if(x==43)return 62;if(x==47)return 63;throw"c:"+x};return C},q=function(W,F,$){for(var b=(function(z,K){var V=z,ee=K,ne=new Array(z*K),ie={setPixel:function(ce,oe,re){ne[oe*V+ce]=re},write:function(ce){ce.writeString("GIF87a"),ce.writeShort(V),ce.writeShort(ee),ce.writeByte(128),ce.writeByte(0),ce.writeByte(0),ce.writeByte(0),ce.writeByte(0),ce.writeByte(0),ce.writeByte(255),ce.writeByte(255),ce.writeByte(255),ce.writeString(","),ce.writeShort(0),ce.writeShort(0),ce.writeShort(V),ce.writeShort(ee),ce.writeByte(0);var oe=se(2);ce.writeByte(2);for(var re=0;oe.length-re>255;)ce.writeByte(255),ce.writeBytes(oe,re,255),re+=255;ce.writeByte(oe.length-re),ce.writeBytes(oe,re,oe.length-re),ce.writeByte(0),ce.writeString(";")}},se=function(ce){for(var oe=1<<ce,re=1+(1<<ce),he=ce+1,ye=de(),be=0;be<oe;be+=1)ye.add(String.fromCharCode(be));ye.add(String.fromCharCode(oe)),ye.add(String.fromCharCode(re));var ve,xe,ke,He=H(),qe=(ve=He,xe=0,ke=0,{write:function(Ie,le){if(Ie>>>le)throw"length over";for(;xe+le>=8;)ve.writeByte(255&(Ie<<xe|ke)),le-=8-xe,Ie>>>=8-xe,ke=0,xe=0;ke|=Ie<<xe,xe+=le},flush:function(){xe>0&&ve.writeByte(ke)}});qe.write(oe,he);var ze=0,Re=String.fromCharCode(ne[ze]);for(ze+=1;ze<ne.length;){var _e=String.fromCharCode(ne[ze]);ze+=1,ye.contains(Re+_e)?Re+=_e:(qe.write(ye.indexOf(Re),he),ye.size()<4095&&(ye.size()==1<<he&&(he+=1),ye.add(Re+_e)),Re=_e)}return qe.write(ye.indexOf(Re),he),qe.write(re,he),qe.flush(),He.toByteArray()},de=function(){var ce={},oe=0,re={add:function(he){if(re.contains(he))throw"dup key:"+he;ce[he]=oe,oe+=1},size:function(){return oe},indexOf:function(he){return ce[he]},contains:function(he){return ce[he]!==void 0}};return re};return ie})(W,F),g=0;g<F;g+=1)for(var C=0;C<W;C+=1)b.setPixel(C,g,$(C,g));var B=H();b.write(B);for(var x=(function(){var z=0,K=0,V=0,ee="",ne={},ie=function(de){ee+=String.fromCharCode(se(63&de))},se=function(de){if(!(de<0)){if(de<26)return 65+de;if(de<52)return de-26+97;if(de<62)return de-52+48;if(de==62)return 43;if(de==63)return 47}throw"n:"+de};return ne.writeByte=function(de){for(z=z<<8|255&de,K+=8,V+=1;K>=6;)ie(z>>>K-6),K-=6},ne.flush=function(){if(K>0&&(ie(z<<6-K),z=0,K=0),V%3!=0)for(var de=3-V%3,ce=0;ce<de;ce+=1)ee+="="},ne.toString=function(){return ee},ne})(),A=B.toByteArray(),U=0;U<A.length;U+=1)x.writeByte(A[U]);return x.flush(),"data:image/gif;base64,"+x};return p})();d.stringToBytesFuncs["UTF-8"]=function(p){return(function(f){for(var m=[],v=0;v<f.length;v++){var y=f.charCodeAt(v);y<128?m.push(y):y<2048?m.push(192|y>>6,128|63&y):y<55296||y>=57344?m.push(224|y>>12,128|y>>6&63,128|63&y):(v++,y=65536+((1023&y)<<10|1023&f.charCodeAt(v)),m.push(240|y>>18,128|y>>12&63,128|y>>6&63,128|63&y))}return m})(p)},(u=typeof(c=function(){return d})=="function"?c.apply(s,[]):c)===void 0||(o.exports=u)}},r={};function i(o){var s=r[o];if(s!==void 0)return s.exports;var c=r[o]={exports:{}};return n[o](c,c.exports,i),c.exports}i.n=o=>{var s=o&&o.__esModule?()=>o.default:()=>o;return i.d(s,{a:s}),s},i.d=(o,s)=>{for(var c in s)i.o(s,c)&&!i.o(o,c)&&Object.defineProperty(o,c,{enumerable:!0,get:s[c]})},i.o=(o,s)=>Object.prototype.hasOwnProperty.call(o,s);var a={};return(()=>{i.d(a,{default:()=>F});const o=$=>!!$&&typeof $=="object"&&!Array.isArray($);function s($,...b){if(!b.length)return $;const g=b.shift();return g!==void 0&&o($)&&o(g)?($=Object.assign({},$),Object.keys(g).forEach((C=>{const B=$[C],x=g[C];Array.isArray(B)&&Array.isArray(x)?$[C]=x:o(B)&&o(x)?$[C]=s(Object.assign({},B),x):$[C]=x})),s($,...b)):$}function c($,b){const g=document.createElement("a");g.download=b,g.href=$,document.body.appendChild(g),g.click(),document.body.removeChild(g)}const u={L:.07,M:.15,Q:.25,H:.3};class d{constructor({svg:b,type:g,window:C}){this._svg=b,this._type=g,this._window=C}draw(b,g,C,B){let x;switch(this._type){case"dots":x=this._drawDot;break;case"classy":x=this._drawClassy;break;case"classy-rounded":x=this._drawClassyRounded;break;case"rounded":x=this._drawRounded;break;case"extra-rounded":x=this._drawExtraRounded;break;default:x=this._drawSquare}x.call(this,{x:b,y:g,size:C,getNeighbor:B})}_rotateFigure({x:b,y:g,size:C,rotation:B=0,draw:x}){var A;const U=b+C/2,z=g+C/2;x(),(A=this._element)===null||A===void 0||A.setAttribute("transform",`rotate(${180*B/Math.PI},${U},${z})`)}_basicDot(b){const{size:g,x:C,y:B}=b;this._rotateFigure(Object.assign(Object.assign({},b),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(C+g/2)),this._element.setAttribute("cy",String(B+g/2)),this._element.setAttribute("r",String(g/2))}}))}_basicSquare(b){const{size:g,x:C,y:B}=b;this._rotateFigure(Object.assign(Object.assign({},b),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(C)),this._element.setAttribute("y",String(B)),this._element.setAttribute("width",String(g)),this._element.setAttribute("height",String(g))}}))}_basicSideRounded(b){const{size:g,x:C,y:B}=b;this._rotateFigure(Object.assign(Object.assign({},b),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${C} ${B}v ${g}h `+g/2+`a ${g/2} ${g/2}, 0, 0, 0, 0 ${-g}`)}}))}_basicCornerRounded(b){const{size:g,x:C,y:B}=b;this._rotateFigure(Object.assign(Object.assign({},b),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${C} ${B}v ${g}h ${g}v `+-g/2+`a ${g/2} ${g/2}, 0, 0, 0, ${-g/2} ${-g/2}`)}}))}_basicCornerExtraRounded(b){const{size:g,x:C,y:B}=b;this._rotateFigure(Object.assign(Object.assign({},b),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${C} ${B}v ${g}h ${g}a ${g} ${g}, 0, 0, 0, ${-g} ${-g}`)}}))}_basicCornersRounded(b){const{size:g,x:C,y:B}=b;this._rotateFigure(Object.assign(Object.assign({},b),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("d",`M ${C} ${B}v `+g/2+`a ${g/2} ${g/2}, 0, 0, 0, ${g/2} ${g/2}h `+g/2+"v "+-g/2+`a ${g/2} ${g/2}, 0, 0, 0, ${-g/2} ${-g/2}`)}}))}_drawDot({x:b,y:g,size:C}){this._basicDot({x:b,y:g,size:C,rotation:0})}_drawSquare({x:b,y:g,size:C}){this._basicSquare({x:b,y:g,size:C,rotation:0})}_drawRounded({x:b,y:g,size:C,getNeighbor:B}){const x=B?+B(-1,0):0,A=B?+B(1,0):0,U=B?+B(0,-1):0,z=B?+B(0,1):0,K=x+A+U+z;if(K!==0)if(K>2||x&&A||U&&z)this._basicSquare({x:b,y:g,size:C,rotation:0});else{if(K===2){let V=0;x&&U?V=Math.PI/2:U&&A?V=Math.PI:A&&z&&(V=-Math.PI/2),this._basicCornerRounded({x:b,y:g,size:C,rotation:V});return}if(K===1){let V=0;U?V=Math.PI/2:A?V=Math.PI:z&&(V=-Math.PI/2),this._basicSideRounded({x:b,y:g,size:C,rotation:V});return}}else this._basicDot({x:b,y:g,size:C,rotation:0})}_drawExtraRounded({x:b,y:g,size:C,getNeighbor:B}){const x=B?+B(-1,0):0,A=B?+B(1,0):0,U=B?+B(0,-1):0,z=B?+B(0,1):0,K=x+A+U+z;if(K!==0)if(K>2||x&&A||U&&z)this._basicSquare({x:b,y:g,size:C,rotation:0});else{if(K===2){let V=0;x&&U?V=Math.PI/2:U&&A?V=Math.PI:A&&z&&(V=-Math.PI/2),this._basicCornerExtraRounded({x:b,y:g,size:C,rotation:V});return}if(K===1){let V=0;U?V=Math.PI/2:A?V=Math.PI:z&&(V=-Math.PI/2),this._basicSideRounded({x:b,y:g,size:C,rotation:V});return}}else this._basicDot({x:b,y:g,size:C,rotation:0})}_drawClassy({x:b,y:g,size:C,getNeighbor:B}){const x=B?+B(-1,0):0,A=B?+B(1,0):0,U=B?+B(0,-1):0,z=B?+B(0,1):0;x+A+U+z!==0?x||U?A||z?this._basicSquare({x:b,y:g,size:C,rotation:0}):this._basicCornerRounded({x:b,y:g,size:C,rotation:Math.PI/2}):this._basicCornerRounded({x:b,y:g,size:C,rotation:-Math.PI/2}):this._basicCornersRounded({x:b,y:g,size:C,rotation:Math.PI/2})}_drawClassyRounded({x:b,y:g,size:C,getNeighbor:B}){const x=B?+B(-1,0):0,A=B?+B(1,0):0,U=B?+B(0,-1):0,z=B?+B(0,1):0;x+A+U+z!==0?x||U?A||z?this._basicSquare({x:b,y:g,size:C,rotation:0}):this._basicCornerExtraRounded({x:b,y:g,size:C,rotation:Math.PI/2}):this._basicCornerExtraRounded({x:b,y:g,size:C,rotation:-Math.PI/2}):this._basicCornersRounded({x:b,y:g,size:C,rotation:Math.PI/2})}}const p={dot:"dot",square:"square",extraRounded:"extra-rounded"},f=Object.values(p);class m{constructor({svg:b,type:g,window:C}){this._svg=b,this._type=g,this._window=C}draw(b,g,C,B){let x;switch(this._type){case p.square:x=this._drawSquare;break;case p.extraRounded:x=this._drawExtraRounded;break;default:x=this._drawDot}x.call(this,{x:b,y:g,size:C,rotation:B})}_rotateFigure({x:b,y:g,size:C,rotation:B=0,draw:x}){var A;const U=b+C/2,z=g+C/2;x(),(A=this._element)===null||A===void 0||A.setAttribute("transform",`rotate(${180*B/Math.PI},${U},${z})`)}_basicDot(b){const{size:g,x:C,y:B}=b,x=g/7;this._rotateFigure(Object.assign(Object.assign({},b),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${C+g/2} ${B}a ${g/2} ${g/2} 0 1 0 0.1 0zm 0 ${x}a ${g/2-x} ${g/2-x} 0 1 1 -0.1 0Z`)}}))}_basicSquare(b){const{size:g,x:C,y:B}=b,x=g/7;this._rotateFigure(Object.assign(Object.assign({},b),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${C} ${B}v ${g}h ${g}v `+-g+`zM ${C+x} ${B+x}h `+(g-2*x)+"v "+(g-2*x)+"h "+(2*x-g)+"z")}}))}_basicExtraRounded(b){const{size:g,x:C,y:B}=b,x=g/7;this._rotateFigure(Object.assign(Object.assign({},b),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","path"),this._element.setAttribute("clip-rule","evenodd"),this._element.setAttribute("d",`M ${C} ${B+2.5*x}v `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*x}h `+2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*x} ${2.5*-x}v `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*-x}h `+-2*x+`a ${2.5*x} ${2.5*x}, 0, 0, 0, ${2.5*-x} ${2.5*x}M ${C+2.5*x} ${B+x}h `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*x}v `+2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*x}h `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*-x} ${1.5*-x}v `+-2*x+`a ${1.5*x} ${1.5*x}, 0, 0, 1, ${1.5*x} ${1.5*-x}`)}}))}_drawDot({x:b,y:g,size:C,rotation:B}){this._basicDot({x:b,y:g,size:C,rotation:B})}_drawSquare({x:b,y:g,size:C,rotation:B}){this._basicSquare({x:b,y:g,size:C,rotation:B})}_drawExtraRounded({x:b,y:g,size:C,rotation:B}){this._basicExtraRounded({x:b,y:g,size:C,rotation:B})}}const v={dot:"dot",square:"square"},y=Object.values(v);class E{constructor({svg:b,type:g,window:C}){this._svg=b,this._type=g,this._window=C}draw(b,g,C,B){let x;x=this._type===v.square?this._drawSquare:this._drawDot,x.call(this,{x:b,y:g,size:C,rotation:B})}_rotateFigure({x:b,y:g,size:C,rotation:B=0,draw:x}){var A;const U=b+C/2,z=g+C/2;x(),(A=this._element)===null||A===void 0||A.setAttribute("transform",`rotate(${180*B/Math.PI},${U},${z})`)}_basicDot(b){const{size:g,x:C,y:B}=b;this._rotateFigure(Object.assign(Object.assign({},b),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","circle"),this._element.setAttribute("cx",String(C+g/2)),this._element.setAttribute("cy",String(B+g/2)),this._element.setAttribute("r",String(g/2))}}))}_basicSquare(b){const{size:g,x:C,y:B}=b;this._rotateFigure(Object.assign(Object.assign({},b),{draw:()=>{this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect"),this._element.setAttribute("x",String(C)),this._element.setAttribute("y",String(B)),this._element.setAttribute("width",String(g)),this._element.setAttribute("height",String(g))}}))}_drawDot({x:b,y:g,size:C,rotation:B}){this._basicDot({x:b,y:g,size:C,rotation:B})}_drawSquare({x:b,y:g,size:C,rotation:B}){this._basicSquare({x:b,y:g,size:C,rotation:B})}}const I="circle",w=[[1,1,1,1,1,1,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,0,0,0,0,0,1],[1,1,1,1,1,1,1]],j=[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,1,1,1,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]];class _{constructor(b,g){this._roundSize=C=>this._options.dotsOptions.roundSize?Math.floor(C):C,this._window=g,this._element=this._window.document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("width",String(b.width)),this._element.setAttribute("height",String(b.height)),this._element.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),b.dotsOptions.roundSize||this._element.setAttribute("shape-rendering","crispEdges"),this._element.setAttribute("viewBox",`0 0 ${b.width} ${b.height}`),this._defs=this._window.document.createElementNS("http://www.w3.org/2000/svg","defs"),this._element.appendChild(this._defs),this._imageUri=b.image,this._instanceId=_.instanceCount++,this._options=b}get width(){return this._options.width}get height(){return this._options.height}getElement(){return this._element}async drawQR(b){const g=b.getModuleCount(),C=Math.min(this._options.width,this._options.height)-2*this._options.margin,B=this._options.shape===I?C/Math.sqrt(2):C,x=this._roundSize(B/g);let A={hideXDots:0,hideYDots:0,width:0,height:0};if(this._qr=b,this._options.image){if(await this.loadImage(),!this._image)return;const{imageOptions:U,qrOptions:z}=this._options,K=U.imageSize*u[z.errorCorrectionLevel],V=Math.floor(K*g*g);A=(function({originalHeight:ee,originalWidth:ne,maxHiddenDots:ie,maxHiddenAxisDots:se,dotSize:de}){const ce={x:0,y:0},oe={x:0,y:0};if(ee<=0||ne<=0||ie<=0||de<=0)return{height:0,width:0,hideYDots:0,hideXDots:0};const re=ee/ne;return ce.x=Math.floor(Math.sqrt(ie/re)),ce.x<=0&&(ce.x=1),se&&se<ce.x&&(ce.x=se),ce.x%2==0&&ce.x--,oe.x=ce.x*de,ce.y=1+2*Math.ceil((ce.x*re-1)/2),oe.y=Math.round(oe.x*re),(ce.y*ce.x>ie||se&&se<ce.y)&&(se&&se<ce.y?(ce.y=se,ce.y%2==0&&ce.x--):ce.y-=2,oe.y=ce.y*de,ce.x=1+2*Math.ceil((ce.y/re-1)/2),oe.x=Math.round(oe.y/re)),{height:oe.y,width:oe.x,hideYDots:ce.y,hideXDots:ce.x}})({originalWidth:this._image.width,originalHeight:this._image.height,maxHiddenDots:V,maxHiddenAxisDots:g-14,dotSize:x})}this.drawBackground(),this.drawDots(((U,z)=>{var K,V,ee,ne,ie,se;return!(this._options.imageOptions.hideBackgroundDots&&U>=(g-A.hideYDots)/2&&U<(g+A.hideYDots)/2&&z>=(g-A.hideXDots)/2&&z<(g+A.hideXDots)/2||!((K=w[U])===null||K===void 0)&&K[z]||!((V=w[U-g+7])===null||V===void 0)&&V[z]||!((ee=w[U])===null||ee===void 0)&&ee[z-g+7]||!((ne=j[U])===null||ne===void 0)&&ne[z]||!((ie=j[U-g+7])===null||ie===void 0)&&ie[z]||!((se=j[U])===null||se===void 0)&&se[z-g+7])})),this.drawCorners(),this._options.image&&await this.drawImage({width:A.width,height:A.height,count:g,dotSize:x})}drawBackground(){var b,g,C;const B=this._element,x=this._options;if(B){const A=(b=x.backgroundOptions)===null||b===void 0?void 0:b.gradient,U=(g=x.backgroundOptions)===null||g===void 0?void 0:g.color;let z=x.height,K=x.width;if(A||U){const V=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");this._backgroundClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._backgroundClipPath.setAttribute("id",`clip-path-background-color-${this._instanceId}`),this._defs.appendChild(this._backgroundClipPath),!((C=x.backgroundOptions)===null||C===void 0)&&C.round&&(z=K=Math.min(x.width,x.height),V.setAttribute("rx",String(z/2*x.backgroundOptions.round))),V.setAttribute("x",String(this._roundSize((x.width-K)/2))),V.setAttribute("y",String(this._roundSize((x.height-z)/2))),V.setAttribute("width",String(K)),V.setAttribute("height",String(z)),this._backgroundClipPath.appendChild(V),this._createColor({options:A,color:U,additionalRotation:0,x:0,y:0,height:x.height,width:x.width,name:`background-color-${this._instanceId}`})}}}drawDots(b){var g,C;if(!this._qr)throw"QR code is not defined";const B=this._options,x=this._qr.getModuleCount();if(x>B.width||x>B.height)throw"The canvas is too small.";const A=Math.min(B.width,B.height)-2*B.margin,U=B.shape===I?A/Math.sqrt(2):A,z=this._roundSize(U/x),K=this._roundSize((B.width-x*z)/2),V=this._roundSize((B.height-x*z)/2),ee=new d({svg:this._element,type:B.dotsOptions.type,window:this._window});this._dotsClipPath=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),this._dotsClipPath.setAttribute("id",`clip-path-dot-color-${this._instanceId}`),this._defs.appendChild(this._dotsClipPath),this._createColor({options:(g=B.dotsOptions)===null||g===void 0?void 0:g.gradient,color:B.dotsOptions.color,additionalRotation:0,x:0,y:0,height:B.height,width:B.width,name:`dot-color-${this._instanceId}`});for(let ne=0;ne<x;ne++)for(let ie=0;ie<x;ie++)b&&!b(ne,ie)||!((C=this._qr)===null||C===void 0)&&C.isDark(ne,ie)&&(ee.draw(K+ie*z,V+ne*z,z,((se,de)=>!(ie+se<0||ne+de<0||ie+se>=x||ne+de>=x)&&!(b&&!b(ne+de,ie+se))&&!!this._qr&&this._qr.isDark(ne+de,ie+se))),ee._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(ee._element));if(B.shape===I){const ne=this._roundSize((A/z-x)/2),ie=x+2*ne,se=K-ne*z,de=V-ne*z,ce=[],oe=this._roundSize(ie/2);for(let re=0;re<ie;re++){ce[re]=[];for(let he=0;he<ie;he++)re>=ne-1&&re<=ie-ne&&he>=ne-1&&he<=ie-ne||Math.sqrt((re-oe)*(re-oe)+(he-oe)*(he-oe))>oe?ce[re][he]=0:ce[re][he]=this._qr.isDark(he-2*ne<0?he:he>=x?he-2*ne:he-ne,re-2*ne<0?re:re>=x?re-2*ne:re-ne)?1:0}for(let re=0;re<ie;re++)for(let he=0;he<ie;he++)ce[re][he]&&(ee.draw(se+he*z,de+re*z,z,((ye,be)=>{var ve;return!!(!((ve=ce[re+be])===null||ve===void 0)&&ve[he+ye])})),ee._element&&this._dotsClipPath&&this._dotsClipPath.appendChild(ee._element))}}drawCorners(){if(!this._qr)throw"QR code is not defined";const b=this._element,g=this._options;if(!b)throw"Element code is not defined";const C=this._qr.getModuleCount(),B=Math.min(g.width,g.height)-2*g.margin,x=g.shape===I?B/Math.sqrt(2):B,A=this._roundSize(x/C),U=7*A,z=3*A,K=this._roundSize((g.width-C*A)/2),V=this._roundSize((g.height-C*A)/2);[[0,0,0],[1,0,Math.PI/2],[0,1,-Math.PI/2]].forEach((([ee,ne,ie])=>{var se,de,ce,oe,re,he,ye,be,ve,xe,ke,He,qe,ze;const Re=K+ee*A*(C-7),_e=V+ne*A*(C-7);let Ie=this._dotsClipPath,le=this._dotsClipPath;if((!((se=g.cornersSquareOptions)===null||se===void 0)&&se.gradient||!((de=g.cornersSquareOptions)===null||de===void 0)&&de.color)&&(Ie=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),Ie.setAttribute("id",`clip-path-corners-square-color-${ee}-${ne}-${this._instanceId}`),this._defs.appendChild(Ie),this._cornersSquareClipPath=this._cornersDotClipPath=le=Ie,this._createColor({options:(ce=g.cornersSquareOptions)===null||ce===void 0?void 0:ce.gradient,color:(oe=g.cornersSquareOptions)===null||oe===void 0?void 0:oe.color,additionalRotation:ie,x:Re,y:_e,height:U,width:U,name:`corners-square-color-${ee}-${ne}-${this._instanceId}`})),((re=g.cornersSquareOptions)===null||re===void 0?void 0:re.type)&&f.includes(g.cornersSquareOptions.type)){const J=new m({svg:this._element,type:g.cornersSquareOptions.type,window:this._window});J.draw(Re,_e,U,ie),J._element&&Ie&&Ie.appendChild(J._element)}else{const J=new d({svg:this._element,type:((he=g.cornersSquareOptions)===null||he===void 0?void 0:he.type)||g.dotsOptions.type,window:this._window});for(let te=0;te<w.length;te++)for(let ge=0;ge<w[te].length;ge++)!((ye=w[te])===null||ye===void 0)&&ye[ge]&&(J.draw(Re+ge*A,_e+te*A,A,((Ae,Pe)=>{var Oe;return!!(!((Oe=w[te+Pe])===null||Oe===void 0)&&Oe[ge+Ae])})),J._element&&Ie&&Ie.appendChild(J._element))}if((!((be=g.cornersDotOptions)===null||be===void 0)&&be.gradient||!((ve=g.cornersDotOptions)===null||ve===void 0)&&ve.color)&&(le=this._window.document.createElementNS("http://www.w3.org/2000/svg","clipPath"),le.setAttribute("id",`clip-path-corners-dot-color-${ee}-${ne}-${this._instanceId}`),this._defs.appendChild(le),this._cornersDotClipPath=le,this._createColor({options:(xe=g.cornersDotOptions)===null||xe===void 0?void 0:xe.gradient,color:(ke=g.cornersDotOptions)===null||ke===void 0?void 0:ke.color,additionalRotation:ie,x:Re+2*A,y:_e+2*A,height:z,width:z,name:`corners-dot-color-${ee}-${ne}-${this._instanceId}`})),((He=g.cornersDotOptions)===null||He===void 0?void 0:He.type)&&y.includes(g.cornersDotOptions.type)){const J=new E({svg:this._element,type:g.cornersDotOptions.type,window:this._window});J.draw(Re+2*A,_e+2*A,z,ie),J._element&&le&&le.appendChild(J._element)}else{const J=new d({svg:this._element,type:((qe=g.cornersDotOptions)===null||qe===void 0?void 0:qe.type)||g.dotsOptions.type,window:this._window});for(let te=0;te<j.length;te++)for(let ge=0;ge<j[te].length;ge++)!((ze=j[te])===null||ze===void 0)&&ze[ge]&&(J.draw(Re+ge*A,_e+te*A,A,((Ae,Pe)=>{var Oe;return!!(!((Oe=j[te+Pe])===null||Oe===void 0)&&Oe[ge+Ae])})),J._element&&le&&le.appendChild(J._element))}}))}loadImage(){return new Promise(((b,g)=>{var C;const B=this._options;if(!B.image)return g("Image is not defined");if(!((C=B.nodeCanvas)===null||C===void 0)&&C.loadImage)B.nodeCanvas.loadImage(B.image).then((x=>{var A,U;if(this._image=x,this._options.imageOptions.saveAsBlob){const z=(A=B.nodeCanvas)===null||A===void 0?void 0:A.createCanvas(this._image.width,this._image.height);(U=z?.getContext("2d"))===null||U===void 0||U.drawImage(x,0,0),this._imageUri=z?.toDataURL()}b()})).catch(g);else{const x=new this._window.Image;typeof B.imageOptions.crossOrigin=="string"&&(x.crossOrigin=B.imageOptions.crossOrigin),this._image=x,x.onload=async()=>{this._options.imageOptions.saveAsBlob&&(this._imageUri=await(async function(A,U){return new Promise((z=>{const K=new U.XMLHttpRequest;K.onload=function(){const V=new U.FileReader;V.onloadend=function(){z(V.result)},V.readAsDataURL(K.response)},K.open("GET",A),K.responseType="blob",K.send()}))})(B.image||"",this._window)),b()},x.src=B.image}}))}async drawImage({width:b,height:g,count:C,dotSize:B}){const x=this._options,A=this._roundSize((x.width-C*B)/2),U=this._roundSize((x.height-C*B)/2),z=A+this._roundSize(x.imageOptions.margin+(C*B-b)/2),K=U+this._roundSize(x.imageOptions.margin+(C*B-g)/2),V=b-2*x.imageOptions.margin,ee=g-2*x.imageOptions.margin,ne=this._window.document.createElementNS("http://www.w3.org/2000/svg","image");ne.setAttribute("href",this._imageUri||""),ne.setAttribute("xlink:href",this._imageUri||""),ne.setAttribute("x",String(z)),ne.setAttribute("y",String(K)),ne.setAttribute("width",`${V}px`),ne.setAttribute("height",`${ee}px`),this._element.appendChild(ne)}_createColor({options:b,color:g,additionalRotation:C,x:B,y:x,height:A,width:U,name:z}){const K=U>A?U:A,V=this._window.document.createElementNS("http://www.w3.org/2000/svg","rect");if(V.setAttribute("x",String(B)),V.setAttribute("y",String(x)),V.setAttribute("height",String(A)),V.setAttribute("width",String(U)),V.setAttribute("clip-path",`url('#clip-path-${z}')`),b){let ee;if(b.type==="radial")ee=this._window.document.createElementNS("http://www.w3.org/2000/svg","radialGradient"),ee.setAttribute("id",z),ee.setAttribute("gradientUnits","userSpaceOnUse"),ee.setAttribute("fx",String(B+U/2)),ee.setAttribute("fy",String(x+A/2)),ee.setAttribute("cx",String(B+U/2)),ee.setAttribute("cy",String(x+A/2)),ee.setAttribute("r",String(K/2));else{const ne=((b.rotation||0)+C)%(2*Math.PI),ie=(ne+2*Math.PI)%(2*Math.PI);let se=B+U/2,de=x+A/2,ce=B+U/2,oe=x+A/2;ie>=0&&ie<=.25*Math.PI||ie>1.75*Math.PI&&ie<=2*Math.PI?(se-=U/2,de-=A/2*Math.tan(ne),ce+=U/2,oe+=A/2*Math.tan(ne)):ie>.25*Math.PI&&ie<=.75*Math.PI?(de-=A/2,se-=U/2/Math.tan(ne),oe+=A/2,ce+=U/2/Math.tan(ne)):ie>.75*Math.PI&&ie<=1.25*Math.PI?(se+=U/2,de+=A/2*Math.tan(ne),ce-=U/2,oe-=A/2*Math.tan(ne)):ie>1.25*Math.PI&&ie<=1.75*Math.PI&&(de+=A/2,se+=U/2/Math.tan(ne),oe-=A/2,ce-=U/2/Math.tan(ne)),ee=this._window.document.createElementNS("http://www.w3.org/2000/svg","linearGradient"),ee.setAttribute("id",z),ee.setAttribute("gradientUnits","userSpaceOnUse"),ee.setAttribute("x1",String(Math.round(se))),ee.setAttribute("y1",String(Math.round(de))),ee.setAttribute("x2",String(Math.round(ce))),ee.setAttribute("y2",String(Math.round(oe)))}b.colorStops.forEach((({offset:ne,color:ie})=>{const se=this._window.document.createElementNS("http://www.w3.org/2000/svg","stop");se.setAttribute("offset",100*ne+"%"),se.setAttribute("stop-color",ie),ee.appendChild(se)})),V.setAttribute("fill",`url('#${z}')`),this._defs.appendChild(ee)}else g&&V.setAttribute("fill",g);this._element.appendChild(V)}}_.instanceCount=0;const O=_,R="canvas",P={};for(let $=0;$<=40;$++)P[$]=$;const k={type:R,shape:"square",width:300,height:300,data:"",margin:0,qrOptions:{typeNumber:P[0],mode:void 0,errorCorrectionLevel:"Q"},imageOptions:{saveAsBlob:!0,hideBackgroundDots:!0,imageSize:.4,crossOrigin:void 0,margin:0},dotsOptions:{type:"square",color:"#000",roundSize:!0},backgroundOptions:{round:0,color:"#fff"}};function M($){const b=Object.assign({},$);if(!b.colorStops||!b.colorStops.length)throw"Field 'colorStops' is required in gradient";return b.rotation?b.rotation=Number(b.rotation):b.rotation=0,b.colorStops=b.colorStops.map((g=>Object.assign(Object.assign({},g),{offset:Number(g.offset)}))),b}function L($){const b=Object.assign({},$);return b.width=Number(b.width),b.height=Number(b.height),b.margin=Number(b.margin),b.imageOptions=Object.assign(Object.assign({},b.imageOptions),{hideBackgroundDots:!!b.imageOptions.hideBackgroundDots,imageSize:Number(b.imageOptions.imageSize),margin:Number(b.imageOptions.margin)}),b.margin>Math.min(b.width,b.height)&&(b.margin=Math.min(b.width,b.height)),b.dotsOptions=Object.assign({},b.dotsOptions),b.dotsOptions.gradient&&(b.dotsOptions.gradient=M(b.dotsOptions.gradient)),b.cornersSquareOptions&&(b.cornersSquareOptions=Object.assign({},b.cornersSquareOptions),b.cornersSquareOptions.gradient&&(b.cornersSquareOptions.gradient=M(b.cornersSquareOptions.gradient))),b.cornersDotOptions&&(b.cornersDotOptions=Object.assign({},b.cornersDotOptions),b.cornersDotOptions.gradient&&(b.cornersDotOptions.gradient=M(b.cornersDotOptions.gradient))),b.backgroundOptions&&(b.backgroundOptions=Object.assign({},b.backgroundOptions),b.backgroundOptions.gradient&&(b.backgroundOptions.gradient=M(b.backgroundOptions.gradient))),b}var H=i(873),G=i.n(H);function q($){if(!$)throw new Error("Extension must be defined");$[0]==="."&&($=$.substring(1));const b={bmp:"image/bmp",gif:"image/gif",ico:"image/vnd.microsoft.icon",jpeg:"image/jpeg",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tif:"image/tiff",tiff:"image/tiff",webp:"image/webp",pdf:"application/pdf"}[$.toLowerCase()];if(!b)throw new Error(`Extension "${$}" is not supported`);return b}class W{constructor(b){b?.jsdom?this._window=new b.jsdom("",{resources:"usable"}).window:this._window=window,this._options=b?L(s(k,b)):k,this.update()}static _clearContainer(b){b&&(b.innerHTML="")}_setupSvg(){if(!this._qr)return;const b=new O(this._options,this._window);this._svg=b.getElement(),this._svgDrawingPromise=b.drawQR(this._qr).then((()=>{var g;this._svg&&((g=this._extension)===null||g===void 0||g.call(this,b.getElement(),this._options))}))}_setupCanvas(){var b,g;this._qr&&(!((b=this._options.nodeCanvas)===null||b===void 0)&&b.createCanvas?(this._nodeCanvas=this._options.nodeCanvas.createCanvas(this._options.width,this._options.height),this._nodeCanvas.width=this._options.width,this._nodeCanvas.height=this._options.height):(this._domCanvas=document.createElement("canvas"),this._domCanvas.width=this._options.width,this._domCanvas.height=this._options.height),this._setupSvg(),this._canvasDrawingPromise=(g=this._svgDrawingPromise)===null||g===void 0?void 0:g.then((()=>{var C;if(!this._svg)return;const B=this._svg,x=new this._window.XMLSerializer().serializeToString(B),A=btoa(x),U=`data:${q("svg")};base64,${A}`;if(!((C=this._options.nodeCanvas)===null||C===void 0)&&C.loadImage)return this._options.nodeCanvas.loadImage(U).then((z=>{var K,V;z.width=this._options.width,z.height=this._options.height,(V=(K=this._nodeCanvas)===null||K===void 0?void 0:K.getContext("2d"))===null||V===void 0||V.drawImage(z,0,0)}));{const z=new this._window.Image;return new Promise((K=>{z.onload=()=>{var V,ee;(ee=(V=this._domCanvas)===null||V===void 0?void 0:V.getContext("2d"))===null||ee===void 0||ee.drawImage(z,0,0),K()},z.src=U}))}})))}async _getElement(b="png"){if(!this._qr)throw"QR code is empty";return b.toLowerCase()==="svg"?(this._svg&&this._svgDrawingPromise||this._setupSvg(),await this._svgDrawingPromise,this._svg):((this._domCanvas||this._nodeCanvas)&&this._canvasDrawingPromise||this._setupCanvas(),await this._canvasDrawingPromise,this._domCanvas||this._nodeCanvas)}update(b){W._clearContainer(this._container),this._options=b?L(s(this._options,b)):this._options,this._options.data&&(this._qr=G()(this._options.qrOptions.typeNumber,this._options.qrOptions.errorCorrectionLevel),this._qr.addData(this._options.data,this._options.qrOptions.mode||(function(g){switch(!0){case/^[0-9]*$/.test(g):return"Numeric";case/^[0-9A-Z $%*+\-./:]*$/.test(g):return"Alphanumeric";default:return"Byte"}})(this._options.data)),this._qr.make(),this._options.type===R?this._setupCanvas():this._setupSvg(),this.append(this._container))}append(b){if(b){if(typeof b.appendChild!="function")throw"Container should be a single DOM node";this._options.type===R?this._domCanvas&&b.appendChild(this._domCanvas):this._svg&&b.appendChild(this._svg),this._container=b}}applyExtension(b){if(!b)throw"Extension function should be defined.";this._extension=b,this.update()}deleteExtension(){this._extension=void 0,this.update()}async getRawData(b="png"){if(!this._qr)throw"QR code is empty";const g=await this._getElement(b),C=q(b);if(!g)return null;if(b.toLowerCase()==="svg"){const B=`<?xml version="1.0" standalone="no"?>\r
1763
1763
  ${new this._window.XMLSerializer().serializeToString(g)}`;return typeof Blob>"u"||this._options.jsdom?Buffer.from(B):new Blob([B],{type:C})}return new Promise((B=>{const x=g;if("toBuffer"in x)if(C==="image/png")B(x.toBuffer(C));else if(C==="image/jpeg")B(x.toBuffer(C));else{if(C!=="application/pdf")throw Error("Unsupported extension");B(x.toBuffer(C))}else"toBlob"in x&&x.toBlob(B,C,1)}))}async download(b){if(!this._qr)throw"QR code is empty";if(typeof Blob>"u")throw"Cannot download in Node.js, call getRawData instead.";let g="png",C="qr";typeof b=="string"?(g=b,console.warn("Extension is deprecated as argument for 'download' method, please pass object { name: '...', extension: '...' } as argument")):typeof b=="object"&&b!==null&&(b.name&&(C=b.name),b.extension&&(g=b.extension));const B=await this._getElement(g);if(B)if(g.toLowerCase()==="svg"){let x=new XMLSerializer().serializeToString(B);x=`<?xml version="1.0" standalone="no"?>\r
1764
- `+x,c(`data:${q(g)};charset=utf-8,${encodeURIComponent(x)}`,`${C}.svg`)}else c(B.toDataURL(q(g)),`${C}.${g}`)}}const F=W})(),a.default})()))})(OW),Nwe=irt(OW.exports),ej={CONNECT_WITH_METAMASK:"Connect with Metamask",USE_EXTENSION:"Use extension",USE_MOBILE:"Use mobile",ONE_CLICK_CONNECT:"Connect in one click to the MetaMask extension.",CONNECT_WITH_EXTENSION:"Connect With Extension",SCAN_TO_CONNECT:"Scan to connect with the MetaMask mobile app.",DESKTOP:"Desktop",MOBILE:"Mobile",META_MASK_MOBILE_APP:"MetaMask mobile app",INSTALL_MODAL:{TRUSTED_BY_USERS:"Trusted by over 30 million users to buy, store, send and swap crypto securely",LEADING_CRYPTO_WALLET:"The leading crypto wallet & gateway to blockchain apps built on Ethereum Mainnet, Polygon, Optimism, and many other networks",CONTROL_DIGITAL_INTERACTIONS:"Puts you in control of your digital interactions by making power of cryptography more accessible",INSTALL_META_MASK_EXTENSION_BUTTON:"Install MetaMask Extension",INSTALL_META_MASK_EXTENSION_TEXT:"Install and try the MetaMask browser extension."},PENDING_MODAL:{OPEN_META_MASK_SELECT_CODE:"Please open the MetaMask wallet app and select the code on the screen OR disconnect",OPEN_META_MASK_CONTINUE:"Open the MetaMask app to continue with your session.",NUMBER_AFTER_OPEN_NOTICE:"If a number doesn't appear after opening MetaMask, please click disconnect and re-scan the QRCode.",DISCONNECT:"Disconnect"},SELECT_MODAL:{CRYPTO_TAKE_CONTROL_TEXT:"Take control of your crypto and explore the blockchain with the wallet trusted by over 30 million people worldwide"},META_MASK_MODAL:{ADDRESS_COPIED:"Address copied to clipboard!",DISCONNECT:"Disconnect",ACTIVE_NETWORK:"Active Network"}},MW=class{constructor(e){var t;this.translations=ej,this.supportedLocales=["es","fr","he","it","pt","tr"],this.baseUrl=(t=e?.baseUrl)!==null&&t!==void 0?t:"https://raw.githubusercontent.com/MetaMask/metamask-sdk/refs/heads/gh-pages/locales"}getBrowserLanguage(){if((navigator.languages||[navigator.language]).some(t=>t.toLowerCase().startsWith("en")))return"en";const e=navigator.language.toLowerCase().split("-")[0];return this.supportedLocales.includes(e)?e:"en"}async init(e){const t=this.getBrowserLanguage()||e.fallbackLng;await this.loadTranslations(t)}async loadTranslations(e){const t=e.split("-")[0];if(t==="en"||!this.supportedLocales.includes(t)){this.translations=ej;return}try{const n=`${this.baseUrl}/${t}.json`,r=await fetch(n);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);this.translations=await r.json()}catch(n){console.warn(`❌ Failed to load ${t} translations, falling back to English:`,n),this.translations=ej}}t(e){return this.getNestedTranslation(e,this.translations)||e}getNestedTranslation(e,t){const n=e.split(".");let r=t;for(const i of n){if(typeof r!="object")return"";r=r[i]}return typeof r=="string"?r:""}},Lwe="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAxNDIgMTM3Ij4KICA8cGF0aCBmaWxsPSIjRkY1QzE2IiBkPSJtMTMyLjI0IDEzMS43NTEtMzAuNDgxLTkuMDc2LTIyLjk4NiAxMy43NDEtMTYuMDM4LS4wMDctMjMtMTMuNzM0LTMwLjQ2NyA5LjA3NkwwIDEwMC40NjVsOS4yNjgtMzQuNzIzTDAgMzYuMzg1IDkuMjY4IDBsNDcuNjA3IDI4LjQ0M2gyNy43NTdMMTMyLjI0IDBsOS4yNjggMzYuMzg1LTkuMjY4IDI5LjM1NyA5LjI2OCAzNC43MjMtOS4yNjggMzEuMjg2WiIvPgogIDxwYXRoIGZpbGw9IiNGRjVDMTYiIGQ9Im05LjI3NCAwIDQ3LjYwOCAyOC40NjMtMS44OTMgMTkuNTM0TDkuMjc0IDBabTMwLjQ2OCAxMDAuNDc4IDIwLjk0NyAxNS45NTctMjAuOTQ3IDYuMjR2LTIyLjE5N1ptMTkuMjczLTI2LjM4MUw1NC45ODkgNDguMDFsLTI1Ljc3IDE3Ljc0LS4wMTQtLjAwN3YuMDEzbC4wOCAxOC4yNiAxMC40NS05LjkxOGgxOS4yOFpNMTMyLjI0IDAgODQuNjMyIDI4LjQ2M2wxLjg4NyAxOS41MzRMMTMyLjI0IDBabS0zMC40NjcgMTAwLjQ3OC0yMC45NDggMTUuOTU3IDIwLjk0OCA2LjI0di0yMi4xOTdabTEwLjUyOS0zNC43MjNoLjAwNy0uMDA3di0uMDEzbC0uMDA2LjAwNy0yNS43Ny0xNy43MzlMODIuNSA3NC4wOTdoMTkuMjcybDEwLjQ1NyA5LjkxNy4wNzMtMTguMjU5WiIvPgogIDxwYXRoIGZpbGw9IiNFMzQ4MDciIGQ9Im0zOS43MzUgMTIyLjY3NS0zMC40NjcgOS4wNzZMMCAxMDAuNDc4aDM5LjczNXYyMi4xOTdaTTU5LjAwOCA3NC4wOWw1LjgyIDM3LjcxNC04LjA2Ni0yMC45Ny0yNy40OS02LjgyIDEwLjQ1Ni05LjkyM2gxOS4yOFptNDIuNzY0IDQ4LjU4NSAzMC40NjggOS4wNzYgOS4yNjgtMzEuMjczaC0zOS43MzZ2MjIuMTk3Wk04Mi41IDc0LjA5bC01LjgyIDM3LjcxNCA4LjA2NS0yMC45NyAyNy40OTEtNi44Mi0xMC40NjMtOS45MjNIODIuNVoiLz4KICA8cGF0aCBmaWxsPSIjRkY4RDVEIiBkPSJtMCAxMDAuNDY1IDkuMjY4LTM0LjcyM2gxOS45M2wuMDczIDE4LjI2NiAyNy40OTIgNi44MiA4LjA2NSAyMC45NjktNC4xNDYgNC42MTgtMjAuOTQ3LTE1Ljk1N0gwdi4wMDdabTE0MS41MDggMC05LjI2OC0zNC43MjNoLTE5LjkzMWwtLjA3MyAxOC4yNjYtMjcuNDkgNi44Mi04LjA2NiAyMC45NjkgNC4xNDUgNC42MTggMjAuOTQ4LTE1Ljk1N2gzOS43MzV2LjAwN1pNODQuNjMyIDI4LjQ0M0g1Ni44NzVMNTQuOTkgNDcuOTc3bDkuODM5IDYzLjhINzYuNjhsOS44NDUtNjMuOC0xLjg5My0xOS41MzRaIi8+CiAgPHBhdGggZmlsbD0iIzY2MTgwMCIgZD0iTTkuMjY4IDAgMCAzNi4zODVsOS4yNjggMjkuMzU3aDE5LjkzbDI1Ljc4NC0xNy43NDVMOS4yNjggMFptNDMuOTggODEuNjY1aC05LjAyOWwtNC45MTYgNC44MTkgMTcuNDY2IDQuMzMtMy41MjEtOS4xNTV2LjAwNlpNMTMyLjI0IDBsOS4yNjggMzYuMzg1LTkuMjY4IDI5LjM1N2gtMTkuOTMxTDg2LjUyNiA0Ny45OTcgMTMyLjI0IDBaTTg4LjI3MyA4MS42NjVoOS4wNDJsNC45MTYgNC44MjUtMTcuNDg2IDQuMzM4IDMuNTI4LTkuMTd2LjAwN1ptLTkuNTA3IDQyLjMwNSAyLjA2LTcuNTQyLTQuMTQ2LTQuNjE4SDY0LjgybC00LjE0NSA0LjYxOCAyLjA1OSA3LjU0MiIvPgogIDxwYXRoIGZpbGw9IiNDMEM0Q0QiIGQ9Ik03OC43NjYgMTIzLjk2OXYxMi40NTNINjIuNzM1di0xMi40NTNoMTYuMDNaIi8+CiAgPHBhdGggZmlsbD0iI0U3RUJGNiIgZD0ibTM5Ljc0MiAxMjIuNjYyIDIzLjAwNiAxMy43NTR2LTEyLjQ1M2wtMi4wNi03LjU0MS0yMC45NDYgNi4yNFptNjIuMDMxIDAtMjMuMDA3IDEzLjc1NHYtMTIuNDUzbDIuMDYtNy41NDEgMjAuOTQ3IDYuMjRaIi8+Cjwvc3ZnPgo=",Dwe="@font-face{font-family:'Euclid Circular B';src:url('../assets/fonts/Euclid Circular B Regular.ttf') format('truetype');font-weight:400;font-style:normal;font-display:swap}.flexContainer{display:flex;justify-content:center;align-items:center;flex-direction:row}.flexItem11{flex:11;justify-content:center;align-items:center}.flexItem1{flex:1;justify-content:center;align-items:center}.button{margin-top:41.5px;margin-bottom:20px;width:100%;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px 20px;background:#0376C9;border-radius:32px;color:white;border:0;font-size:14px;cursor:pointer}.backdrop{visibility:visible;position:fixed;top:0;left:0;right:0;bottom:0;width:100%;z-index:99998;background:rgba(0, 0, 0, 0.87);opacity:0.3}.modal{visibility:visible;position:fixed;left:50%;transform:translate(-50%, -50%);z-index:99999;background:white;padding:20px;border-radius:8px;top:50%;max-width:360px;width:460px;min-width:300px;box-shadow:rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;-webkit-font-smoothing:antialiased}.sectionDivider{height:1px;background-color:#B7BBC866;margin-top:17px;margin-bottom:10px}.closeButtonContainer{position:absolute;right:15px;top:15px;padding:10px;user-select:none}.buttonText{margin-left:10px}.closeButton{color:#BBC0C5;cursor:pointer;user-select:none}.right{display:flex;align-items:center;justify-content:right}#sdk-mm-qrcode{margin-top:10px;margin-bottom:10px;display:flex;justify-content:center;align-items:center;border:none !important;outline:none !important;box-shadow:none !important}#sdk-mm-qrcode svg{width:100% !important;height:auto !important;border:none !important;outline:none !important;box-shadow:none !important;stroke:none !important;stroke-width:0 !important;background:transparent !important}*{font-family:'Euclid Circular B', sans-serif}.modalTitle{font-size:16px;font-weight:700;letter-spacing:0px;line-height:24px;color:#141618;margin-top:4px;text-align:center;user-select:none}.sectionTitle{text-align:center;font-size:14px;font-weight:500;margin-bottom:0px;margin-top:20px;font-weight:bold}.sectionDescription{text-align:center;font-size:14px;font-weight:400;margin-top:5px;color:#6A737D}.extensionButton{padding:15px 20px;margin-top:15px;margin-bottom:0px}.qrContainer{display:flex;justify-content:center;align-items:center;width:100%}.qrCode{margin:0 auto;display:flex;justify-content:center;align-items:center}",RW=class{constructor(e){NW(this,e),this.close=W1(this,"close",7),this.startDesktopOnboarding=W1(this,"startDesktopOnboarding",7),this.updateLink=W1(this,"updateLink",7),this.updateExpiresIn=W1(this,"updateExpiresIn",7),this.link=void 0,this.expiresIn=void 0,this.showInstallModal=void 0,this.translationsLoaded=!1,this.onClose=this.onClose.bind(this),this.onStartDesktopOnboardingHandler=this.onStartDesktopOnboardingHandler.bind(this),this.render=this.render.bind(this),this.i18nInstance=new MW}componentDidLoad(){this.generateQRCode(this.link)}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}generateQRCode(e){if(!this.qrCodeContainer)return;const t=new Nwe({data:e,type:"svg",image:Lwe,imageOptions:{hideBackgroundDots:!0,crossOrigin:void 0,imageSize:.3,saveAsBlob:!1},dotsOptions:{color:"#222222",type:"square",gradient:void 0,roundSize:!1},cornersSquareOptions:{color:"#222222",type:"square",gradient:void 0},cornersDotOptions:{color:"#ff5c16"},backgroundOptions:{color:"transparent"},qrOptions:{typeNumber:0,mode:"Byte",errorCorrectionLevel:"Q"}});this.qrCodeContainer.innerHTML="",t.append(this.qrCodeContainer)}onClose(e=!1){this.close.emit({shouldTerminate:e})}onStartDesktopOnboardingHandler(){this.startDesktopOnboarding.emit()}updateLinkHandler(e){this.generateQRCode(e)}updateExpiresInHandler(e){console.debug("QRCode expires in:",e)}render(){if(!this.translationsLoaded)return null;const e=n=>this.i18nInstance.t(n),t=this.showInstallModal;return Ht(jW,{className:"install-model"},Ht("div",{class:"backdrop",onClick:()=>this.onClose(!0)}),Ht("div",{class:"modal"},Ht("div",{class:"closeButtonContainer"},Ht("div",{class:"right"},Ht("span",{class:"closeButton",onClick:()=>this.onClose(!0)},Ht(PW,null)))),Ht("div",{class:"modalHeader"},Ht("h2",{class:"modalTitle"},e("CONNECT_WITH_METAMASK"))),Ht("div",{class:"modalContent"},t?Ht("div",null,Ht("div",{class:"connectionSection"},Ht("h3",{class:"sectionTitle"},e("USE_EXTENSION")),Ht("p",{class:"sectionDescription"},e("ONE_CLICK_CONNECT")),Ht("button",{class:"button extensionButton",onClick:()=>this.onStartDesktopOnboardingHandler()},Ht(Jk,null),Ht("span",{class:"buttonText"},e("CONNECT_WITH_EXTENSION")))),Ht("div",{class:"sectionDivider"}),Ht("div",{class:"connectionSection"},Ht("h3",{class:"sectionTitle"},e("USE_MOBILE")),Ht("p",{class:"sectionDescription"},e("SCAN_TO_CONNECT")),Ht("div",{class:"qrContainer"},Ht("div",{id:"sdk-mm-qrcode",class:"qrCode",ref:n=>{n&&(this.qrCodeContainer=n)}})))):Ht("div",null,Ht("div",{class:"connectionSection"},Ht("h3",{class:"sectionTitle"},e("USE_MOBILE")),Ht("p",{class:"sectionDescription"},e("SCAN_TO_CONNECT")),Ht("div",{class:"qrContainer"},Ht("div",{id:"sdk-mm-qrcode",class:"qrCode",ref:n=>{n&&(this.qrCodeContainer=n)}}))),Ht("div",{class:"sectionDivider"}),Ht("div",{class:"connectionSection"},Ht("h3",{class:"sectionTitle"},e("USE_EXTENSION")),Ht("p",{class:"sectionDescription"},e("INSTALL_MODAL.INSTALL_META_MASK_EXTENSION_TEXT")),Ht("button",{class:"button extensionButton",onClick:()=>this.onStartDesktopOnboardingHandler()},Ht(Jk,null),Ht("span",{class:"buttonText"},e("INSTALL_MODAL.INSTALL_META_MASK_EXTENSION_BUTTON"))))))))}get el(){return cj(this)}static get watchers(){return{link:["updateLinkHandler"],expiresIn:["updateExpiresInHandler"]}}},RW.style=Dwe,Uwe="@font-face{font-family:'Euclid Circular B';src:url('../assets/fonts/Euclid Circular B Regular.ttf') format('truetype');font-weight:400;font-style:normal;font-display:swap}.flexContainer{display:flex;justify-content:center;align-items:center;flex-direction:row}.flexItem11{flex:11;justify-content:center;align-items:center}.flexItem1{flex:1;justify-content:center;align-items:center}.button{margin-top:41.5px;margin-bottom:20px;width:100%;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px 20px;background:#0376C9;border-radius:32px;color:white;border:0;font-size:14px;cursor:pointer}.backdrop{visibility:visible;position:fixed;top:0;left:0;right:0;bottom:0;width:100%;z-index:99998;background:rgba(0, 0, 0, 0.87);opacity:0.3}.modal{visibility:visible;position:fixed;left:50%;transform:translate(-50%, -50%);z-index:99999;background:white;padding:20px;border-radius:8px;top:50%;max-width:360px;width:460px;min-width:300px;box-shadow:rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;-webkit-font-smoothing:antialiased}.sectionDivider{height:1px;background-color:#B7BBC866;margin-top:17px;margin-bottom:10px}.closeButtonContainer{position:absolute;right:15px;top:15px;padding:10px;user-select:none}.buttonText{margin-left:10px}.closeButton{color:#BBC0C5;cursor:pointer;user-select:none}.right{display:flex;align-items:center;justify-content:right}#sdk-mm-qrcode{margin-top:10px;margin-bottom:10px;display:flex;justify-content:center;align-items:center;border:none !important;outline:none !important;box-shadow:none !important}#sdk-mm-qrcode svg{width:100% !important;height:auto !important;border:none !important;outline:none !important;box-shadow:none !important;stroke:none !important;stroke-width:0 !important;background:transparent !important}*{font-family:'Euclid Circular B', sans-serif}.modalTitle{font-size:16px;font-weight:700;letter-spacing:0px;line-height:24px;color:#141618;margin-top:4px;text-align:center;user-select:none}.sectionTitle{text-align:center;font-size:14px;font-weight:500;margin-bottom:0px;margin-top:20px;font-weight:bold}.sectionDescription{text-align:center;font-size:14px;font-weight:400;margin-top:5px;color:#6A737D}.extensionButton{padding:15px 20px;margin-top:15px;margin-bottom:0px}.qrContainer{display:flex;justify-content:center;align-items:center;width:100%}.qrCode{margin:0 auto;display:flex;justify-content:center;align-items:center}",BW=class{constructor(e){NW(this,e),this.close=W1(this,"close",7),this.disconnect=W1(this,"disconnect",7),this.updateOTPCode=W1(this,"updateOTPCode",7),this.displayOTP=void 0,this.otpCode=void 0,this.translationsLoaded=!1,this.i18nInstance=new MW}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}onClose(){this.close.emit()}onDisconnect(){this.disconnect.emit()}onUpdateOTPValueHandler(e){this.updateOTPCode.emit({otpCode:e})}disconnectedCallback(){this.onClose()}render(){var e;if(!this.translationsLoaded)return null;const t=(e=this.displayOTP)!==null&&e!==void 0?e:!0,n=r=>this.i18nInstance.t(r);return Ht(jW,{className:"pending-modal"},Ht("div",{class:"backdrop",onClick:()=>this.onClose()}),Ht("div",{class:"modal"},Ht("div",{class:"closeButtonContainer"},Ht("div",{class:"right"},Ht("span",{class:"closeButton",onClick:()=>this.onClose()},Ht(PW,null)))),Ht("div",{class:"logoContainer"},Ht(Jk,null)),Ht("div",null,Ht("div",{class:"flexContainer",style:{flexDirection:"column",color:"black"}},Ht("div",{class:"flexItem",style:{textAlign:"center",marginTop:"30px",marginBottom:"30px",fontSize:"16px"}},n(t?"PENDING_MODAL.OPEN_META_MASK_SELECT_CODE":"PENDING_MODAL.OPEN_META_MASK_CONTINUE")),Ht("div",{id:"sdk-mm-otp-value",style:{padding:"10px",fontSize:"32px",display:this.otpCode?"block":"none"}},this.otpCode),t&&Ht("div",{class:"notice"},"* ",n("PENDING_MODAL.NUMBER_AFTER_OPEN_NOTICE"))),Ht("div",{style:{marginTop:"20px"}},Ht("button",{class:"button blue",style:{marginTop:"5px",color:"#0376C9",borderColor:"#0376C9",borderWidth:"1px",borderStyle:"solid",backgroundColor:"white"},onClick:()=>this.onDisconnect()},n("PENDING_MODAL.DISCONNECT"))))))}get el(){return cj(this)}},BW.style=Uwe}));function Fwe(e){var t,n,r;return(r=(n=(t=e.head)==null?void 0:t.querySelector('meta[name="csp-nonce"]'))==null?void 0:n.getAttribute("content"))!=null?r:void 0}function ort(e,t){if(e.isOk){const n=t(e.value);return n instanceof Promise?n.then(r=>sj(r)):sj(n)}if(e.isErr){const n=e.value;return qW(n)}throw"should never get here"}function zwe(e){return e.includes("ref")?[...e.filter(t=>t!=="ref"),"ref"]:e}var $we,e5,Hwe,qwe,tj,P0,NW,Gwe,LW,V1,nj,Vwe,J4,Wwe,DW,e8,Ml,Ba,Zwe,UW,rj,FW,zW,Kwe,$W,ij,aj,Ywe,HW,Qwe,Xwe,Jwe,oj,sj,qW,e4e,t4e,rf,n4e,Ht,t8,r4e,i4e,a4e,GW,o4e,s4e,cj,W1,VW,WW,c4e,u4e,l4e,ZW,KW,d4e,YW,QW,f4e,XW,uj,JW,eZ,Ws,lj,tZ,nZ,h4e,n8,t5,rZ,r8,p4e,iZ,dj,m4e,g4e,b4e,y4e,v4e,_4e,aZ,fj,oZ,w4e,E4e,sZ,S4e,hj,C4e,cZ,A4e,T4e,x4e,I4e=Z((()=>{$we="sdk-install-modal-web",e5={allRenderFn:!0,appendChildSlotFix:!1,asyncLoading:!0,asyncQueue:!1,attachStyles:!0,cloneNodeFix:!1,cmpDidLoad:!0,cmpDidRender:!1,cmpDidUnload:!1,cmpDidUpdate:!1,cmpShouldUpdate:!1,cmpWillLoad:!1,cmpWillRender:!1,cmpWillUpdate:!1,connectedCallback:!0,constructableCSS:!0,cssAnnotations:!0,devTools:!1,disconnectedCallback:!0,element:!1,event:!0,experimentalScopedSlotChanges:!1,experimentalSlotFixes:!1,formAssociated:!1,hasRenderFn:!0,hostListener:!1,hostListenerTarget:!1,hostListenerTargetBody:!1,hostListenerTargetDocument:!1,hostListenerTargetParent:!1,hostListenerTargetWindow:!1,hotModuleReplacement:!1,hydrateClientSide:!1,hydrateServerSide:!1,hydratedAttribute:!1,hydratedClass:!0,hydratedSelectorName:"hydrated",initializeNextTick:!1,invisiblePrehydration:!0,isDebug:!1,isDev:!1,isTesting:!1,lazyLoad:!0,lifecycle:!0,lifecycleDOMEvents:!1,member:!0,method:!1,mode:!1,observeAttribute:!0,profile:!1,prop:!0,propBoolean:!0,propMutable:!1,propNumber:!0,propString:!0,reflect:!1,scoped:!1,scopedSlotTextContentFix:!1,scriptDataOpts:!1,shadowDelegatesFocus:!1,shadowDom:!0,slot:!1,slotChildNodesFix:!1,slotRelocation:!1,state:!0,style:!0,svg:!0,taskQueue:!0,transformTagName:!1,updatable:!0,vdomAttribute:!0,vdomClass:!0,vdomFunctional:!0,vdomKey:!1,vdomListener:!0,vdomPropOrAttr:!0,vdomRef:!0,vdomRender:!0,vdomStyle:!0,vdomText:!0,vdomXlink:!1,watchCallback:!0},Hwe=Object.defineProperty,qwe=(e,t)=>{for(var n in t)Hwe(e,n,{get:t[n],enumerable:!0})},tj=new WeakMap,P0=e=>tj.get(e),NW=(e,t)=>tj.set(t.$lazyInstance$=e,t),Gwe=(e,t)=>{const n={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};return n.$onReadyPromise$=new Promise(r=>n.$onReadyResolve$=r),e["s-p"]=[],e["s-rc"]=[],tj.set(e,n)},LW=(e,t)=>t in e,V1=(e,t)=>(0,console.error)(e,t),nj=new Map,Vwe=(e,t,n)=>{const r=e.$tagName$.replace(/-/g,"_"),i=e.$lazyBundleId$;if(!i)return;const a=nj.get(i);if(a)return a[r];if(!n||!e5.hotModuleReplacement){const o=s=>(nj.set(i,s),s[r]);if(i==="mm-install-modal_2")return Promise.resolve().then(()=>(art(),rrt)).then(o,V1)}return import(`./${i}.entry.js`).then(o=>(nj.set(i,o),o[r]),V1)},J4=new Map,Wwe="{visibility:hidden}.hydrated{visibility:inherit}",DW="slot-fb{display:contents}slot-fb[hidden]{display:none}",e8=typeof window<"u"?window:{},Ml=e8.document||{head:{}},Ba={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,r)=>e.addEventListener(t,n,r),rel:(e,t,n,r)=>e.removeEventListener(t,n,r),ce:(e,t)=>new CustomEvent(e,t)},Zwe=e=>Promise.resolve(e),UW=(()=>{try{return new CSSStyleSheet,typeof new CSSStyleSheet().replaceSync=="function"}catch{}return!1})(),rj=!1,FW=[],zW=[],Kwe=(e,t)=>n=>{e.push(n),rj||(rj=!0,t&&Ba.$flags$&4?aj(ij):Ba.raf(ij))},$W=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(n){V1(n)}e.length=0},ij=()=>{$W(FW),$W(zW),(rj=FW.length>0)&&Ba.raf(ij)},aj=e=>Zwe().then(e),Ywe=Kwe(zW,!0),HW={},Qwe="http://www.w3.org/2000/svg",Xwe="http://www.w3.org/1999/xhtml",Jwe=e=>e!=null,oj=e=>(e=typeof e,e==="object"||e==="function"),qwe({},{err:()=>qW,map:()=>ort,ok:()=>sj,unwrap:()=>e4e,unwrapErr:()=>t4e}),sj=e=>({isOk:!0,isErr:!1,value:e}),qW=e=>({isOk:!1,isErr:!0,value:e}),e4e=e=>{if(e.isOk)return e.value;throw e.value},t4e=e=>{if(e.isErr)return e.value;throw e.value},rf=(e,t="")=>()=>{},n4e=(e,t)=>()=>{},Ht=(e,t,...n)=>{let r=null,i=!1,a=!1;const o=[],s=u=>{for(let d=0;d<u.length;d++)r=u[d],Array.isArray(r)?s(r):r!=null&&typeof r!="boolean"&&((i=typeof e!="function"&&!oj(r))&&(r=String(r)),i&&a?o[o.length-1].$text$+=r:o.push(i?t8(null,r):r),a=i)};if(s(n),t){const u=t.className||t.class;u&&(t.class=typeof u!="object"?u:Object.keys(u).filter(d=>u[d]).join(" "))}if(typeof e=="function")return e(t===null?{}:t,o,a4e);const c=t8(e,null);return c.$attrs$=t,o.length>0&&(c.$children$=o),c},t8=(e,t)=>{const n={$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null};return n.$attrs$=null,n},r4e={},i4e=e=>e&&e.$tag$===r4e,a4e={forEach:(e,t)=>e.map(GW).forEach(t),map:(e,t)=>e.map(GW).map(t).map(o4e)},GW=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),o4e=e=>{if(typeof e.vtag=="function"){const n={...e.vattrs};return e.vkey&&(n.key=e.vkey),e.vname&&(n.name=e.vname),Ht(e.vtag,n,...e.vchildren||[])}const t=t8(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},s4e=(e,t)=>e!=null&&!oj(e)?t&4?e==="false"?!1:e===""||!!e:t&2?parseFloat(e):t&1?String(e):e:e,cj=e=>P0(e).$hostElement$,W1=(e,t,n)=>{const r=cj(e);return{emit:i=>VW(r,t,{bubbles:!!(n&4),composed:!!(n&2),cancelable:!!(n&1),detail:i})}},VW=(e,t,n)=>{const r=Ba.ce(t,n);return e.dispatchEvent(r),r},WW=new WeakMap,c4e=(e,t,n)=>{let r=J4.get(e);UW&&n?(r=r||new CSSStyleSheet,typeof r=="string"?r=t:r.replaceSync(t)):r=t,J4.set(e,r)},u4e=(e,t,n)=>{var r;const i=ZW(t),a=J4.get(i);if(e=e.nodeType===11?e:Ml,a)if(typeof a=="string"){e=e.head||e;let o=WW.get(e),s;if(o||WW.set(e,o=new Set),!o.has(i)){{s=Ml.createElement("style"),s.innerHTML=a;const c=(r=Ba.$nonce$)!=null?r:Fwe(Ml);if(c!=null&&s.setAttribute("nonce",c),!(t.$flags$&1))if(e.nodeName==="HEAD"){const u=e.querySelectorAll("link[rel=preconnect]"),d=u.length>0?u[u.length-1].nextSibling:e.querySelector("style");e.insertBefore(s,d)}else if("host"in e)if(UW){const u=new CSSStyleSheet;u.replaceSync(a),e.adoptedStyleSheets=[u,...e.adoptedStyleSheets]}else{const u=e.querySelector("style");u?u.innerHTML=a+u.innerHTML:e.prepend(s)}else e.append(s);t.$flags$&1&&e.nodeName!=="HEAD"&&e.insertBefore(s,null)}t.$flags$&4&&(s.innerHTML+=DW),o&&o.add(i)}}else e.adoptedStyleSheets.includes(a)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,a]);return i},l4e=e=>{const t=e.$cmpMeta$,n=e.$hostElement$,r=t.$flags$,i=rf("attachStyles",t.$tagName$),a=u4e(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);r&10&&r&2&&(n["s-sc"]=a,n.classList.add(a+"-h")),i()},ZW=(e,t)=>"sc-"+e.$tagName$,KW=(e,t,n,r,i,a)=>{if(n!==r){let o=LW(e,t),s=t.toLowerCase();if(t==="class"){const c=e.classList,u=YW(n),d=YW(r);c.remove(...u.filter(p=>p&&!d.includes(p))),c.add(...d.filter(p=>p&&!u.includes(p)))}else if(t==="style"){for(const c in n)(!r||r[c]==null)&&(c.includes("-")?e.style.removeProperty(c):e.style[c]="");for(const c in r)(!n||r[c]!==n[c])&&(c.includes("-")?e.style.setProperty(c,r[c]):e.style[c]=r[c])}else if(t==="ref")r&&r(e);else if(!o&&t[0]==="o"&&t[1]==="n"){if(t[2]==="-"?t=t.slice(3):LW(e8,s)?t=s.slice(2):t=s[2]+t.slice(3),n||r){const c=t.endsWith(QW);t=t.replace(f4e,""),n&&Ba.rel(e,t,n,c),r&&Ba.ael(e,t,r,c)}}else{const c=oj(r);if((o||c&&r!==null)&&!i)try{if(e.tagName.includes("-"))e[t]=r;else{const u=r??"";t==="list"?o=!1:(n==null||e[t]!=u)&&(typeof e.__lookupSetter__(t)=="function"?e[t]=u:e.setAttribute(t,u))}}catch{}r==null||r===!1?(r!==!1||e.getAttribute(t)==="")&&e.removeAttribute(t):(!o||a&4||i)&&!c&&(r=r===!0?"":r,e.setAttribute(t,r))}}},d4e=/\s/,YW=e=>e?e.split(d4e):[],QW="Capture",f4e=new RegExp(QW+"$"),XW=(e,t,n)=>{const r=t.$elm$.nodeType===11&&t.$elm$.host?t.$elm$.host:t.$elm$,i=e&&e.$attrs$||HW,a=t.$attrs$||HW;for(const o of zwe(Object.keys(i)))o in a||KW(r,o,i[o],void 0,n,t.$flags$);for(const o of zwe(Object.keys(a)))KW(r,o,i[o],a[o],n,t.$flags$)},eZ=!1,Ws=!1,lj=(e,t,n,r)=>{const i=t.$children$[n];let a=0,o,s;if(i.$text$!==null)o=i.$elm$=Ml.createTextNode(i.$text$);else{if(Ws||(Ws=i.$tag$==="svg"),o=i.$elm$=Ml.createElementNS(Ws?Qwe:Xwe,!eZ&&e5.slotRelocation&&i.$flags$&2?"slot-fb":i.$tag$),Ws&&i.$tag$==="foreignObject"&&(Ws=!1),XW(null,i,Ws),o.getRootNode().querySelector("body")&&e5.scoped&&Jwe(uj)&&o["s-si"]!==uj&&o.classList.add(o["s-si"]=uj),i.$children$)for(a=0;a<i.$children$.length;++a)s=lj(e,i,a),s&&o.appendChild(s);i.$tag$==="svg"?Ws=!1:o.tagName==="foreignObject"&&(Ws=!0)}return o["s-hn"]=JW,o},tZ=(e,t,n,r,i,a)=>{let o=e,s;for(o.shadowRoot&&o.tagName===JW&&(o=o.shadowRoot);i<=a;++i)r[i]&&(s=lj(null,n,i),s&&(r[i].$elm$=s,r8(o,s,t)))},nZ=(e,t,n)=>{for(let r=t;r<=n;++r){const i=e[r];if(i){const a=i.$elm$;rZ(i),a&&a.remove()}}},h4e=(e,t,n,r,i=!1)=>{let a=0,o=0,s=t.length-1,c=t[0],u=t[s],d=r.length-1,p=r[0],f=r[d],m;for(;a<=s&&o<=d;)c==null?c=t[++a]:u==null?u=t[--s]:p==null?p=r[++o]:f==null?f=r[--d]:n8(c,p,i)?(t5(c,p,i),c=t[++a],p=r[++o]):n8(u,f,i)?(t5(u,f,i),u=t[--s],f=r[--d]):n8(c,f,i)?(t5(c,f,i),r8(e,c.$elm$,u.$elm$.nextSibling),c=t[++a],f=r[--d]):n8(u,p,i)?(t5(u,p,i),r8(e,u.$elm$,c.$elm$),u=t[--s],p=r[++o]):(m=lj(t&&t[o],n,o),p=r[++o],m&&r8(c.$elm$.parentNode,m,c.$elm$));a>s?tZ(e,r[d+1]==null?null:r[d+1].$elm$,n,r,o,d):o>d&&nZ(t,a,s)},n8=(e,t,n=!1)=>e.$tag$===t.$tag$,t5=(e,t,n=!1)=>{const r=t.$elm$=e.$elm$,i=e.$children$,a=t.$children$,o=t.$tag$,s=t.$text$;s===null?(Ws=o==="svg"?!0:o==="foreignObject"?!1:Ws,XW(e,t,Ws),i!==null&&a!==null?h4e(r,i,t,a,n):a!==null?(e.$text$!==null&&(r.textContent=""),tZ(r,null,t,a,0,a.length-1)):!n&&e5.updatable&&i!==null&&nZ(i,0,i.length-1),Ws&&o==="svg"&&(Ws=!1)):e.$text$!==s&&(r.data=s)},rZ=e=>{e.$attrs$&&e.$attrs$.ref&&e.$attrs$.ref(null),e.$children$&&e.$children$.map(rZ)},r8=(e,t,n)=>e?.insertBefore(t,n),p4e=(e,t,n=!1)=>{const r=e.$hostElement$,i=e.$cmpMeta$,a=e.$vnode$||t8(null,null),o=i4e(t)?t:Ht(null,null,t);if(JW=r.tagName,n&&o.$attrs$)for(const s of Object.keys(o.$attrs$))r.hasAttribute(s)&&!["key","ref","style","class"].includes(s)&&(o.$attrs$[s]=r[s]);o.$tag$=null,o.$flags$|=4,e.$vnode$=o,o.$elm$=a.$elm$=r.shadowRoot||r,uj=r["s-sc"],eZ=(i.$flags$&1)!==0,t5(a,o,n)},iZ=(e,t)=>{t&&!e.$onRenderResolve$&&t["s-p"]&&t["s-p"].push(new Promise(n=>e.$onRenderResolve$=n))},dj=(e,t)=>{if(e.$flags$|=16,e.$flags$&4){e.$flags$|=512;return}return iZ(e,e.$ancestorComponent$),Ywe(()=>m4e(e,t))},m4e=(e,t)=>{const n=e.$hostElement$,r=rf("scheduleUpdate",e.$cmpMeta$.$tagName$),i=e.$lazyInstance$;if(!i)throw new Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let a;return r(),g4e(a,()=>y4e(e,i,t))},g4e=(e,t)=>b4e(e)?e.then(t).catch(n=>{console.error(n),t()}):t(),b4e=e=>e instanceof Promise||e&&e.then&&typeof e.then=="function",y4e=async(e,t,n)=>{var r;const i=e.$hostElement$,a=rf("update",e.$cmpMeta$.$tagName$),o=i["s-rc"];n&&l4e(e);const s=rf("render",e.$cmpMeta$.$tagName$);v4e(e,t,i,n),o&&(o.map(c=>c()),i["s-rc"]=void 0),s(),a();{const c=(r=i["s-p"])!=null?r:[],u=()=>_4e(e);c.length===0?u():(Promise.all(c).then(u),e.$flags$|=4,c.length=0)}},v4e=(e,t,n,r)=>{try{t=t.render(),e.$flags$&=-17,e.$flags$|=2,p4e(e,t,r)}catch(i){V1(i,e.$hostElement$)}return null},_4e=e=>{const t=e.$cmpMeta$.$tagName$,n=e.$hostElement$,r=rf("postUpdate",t),i=e.$lazyInstance$,a=e.$ancestorComponent$;e.$flags$&64?r():(e.$flags$|=64,oZ(n),fj(i,"componentDidLoad"),r(),e.$onReadyResolve$(n),a||aZ()),e.$onRenderResolve$&&(e.$onRenderResolve$(),e.$onRenderResolve$=void 0),e.$flags$&512&&aj(()=>dj(e,!1)),e.$flags$&=-517},aZ=e=>{oZ(Ml.documentElement),aj(()=>VW(e8,"appload",{detail:{namespace:$we}}))},fj=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(r){V1(r)}},oZ=e=>{var t;return e.classList.add((t=e5.hydratedSelectorName)!=null?t:"hydrated")},w4e=(e,t)=>P0(e).$instanceValues$.get(t),E4e=(e,t,n,r)=>{const i=P0(e);if(!i)throw new Error(`Couldn't find host element for "${r.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`);const a=i.$hostElement$,o=i.$instanceValues$.get(t),s=i.$flags$,c=i.$lazyInstance$;n=s4e(n,r.$members$[t][0]);const u=n!==o&&!(Number.isNaN(o)&&Number.isNaN(n));if((!(s&8)||o===void 0)&&u&&(i.$instanceValues$.set(t,n),c)){if(r.$watchers$&&s&128){const d=r.$watchers$[t];d&&d.map(p=>{try{c[p](n,o,t)}catch(f){V1(f,a)}})}(s&18)===2&&dj(i,!1)}},sZ=(e,t,n)=>{var r,i;const a=e.prototype;if(t.$members$||t.$watchers$||e.watchers){e.watchers&&!t.$watchers$&&(t.$watchers$=e.watchers);const o=Object.entries((r=t.$members$)!=null?r:{});if(o.map(([s,[c]])=>{(c&31||n&2&&c&32)&&Object.defineProperty(a,s,{get(){return w4e(this,s)},set(u){E4e(this,s,u,t)},configurable:!0,enumerable:!0})}),n&1){const s=new Map;a.attributeChangedCallback=function(c,u,d){Ba.jmp(()=>{var p;const f=s.get(c);if(this.hasOwnProperty(f))d=this[f],delete this[f];else{if(a.hasOwnProperty(f)&&typeof this[f]=="number"&&this[f]==d)return;if(f==null){const m=P0(this),v=m?.$flags$;if(v&&!(v&8)&&v&128&&d!==u){const y=m.$lazyInstance$;((p=t.$watchers$)==null?void 0:p[c])?.forEach(E=>{y[E]!=null&&y[E].call(y,d,u,c)})}return}}this[f]=d===null&&typeof this[f]=="boolean"?!1:d})},e.observedAttributes=Array.from(new Set([...Object.keys((i=t.$watchers$)!=null?i:{}),...o.filter(([c,u])=>u[0]&15).map(([c,u])=>{const d=u[1]||c;return s.set(d,c),d})]))}}return e},S4e=async(e,t,n,r)=>{let i;if((t.$flags$&32)===0){if(t.$flags$|=32,n.$lazyBundleId$){const s=Vwe(n);if(s&&"then"in s){const u=n4e();i=await s,u()}else i=s;if(!i)throw new Error(`Constructor for "${n.$tagName$}#${t.$modeName$}" was not found`);i.isProxied||(n.$watchers$=i.watchers,sZ(i,n,2),i.isProxied=!0);const c=rf("createInstance",n.$tagName$);t.$flags$|=8;try{new i(t)}catch(u){V1(u)}t.$flags$&=-9,t.$flags$|=128,c(),hj(t.$lazyInstance$)}else{i=e.constructor;const s=e.localName;customElements.whenDefined(s).then(()=>t.$flags$|=128)}if(i&&i.style){let s;typeof i.style=="string"&&(s=i.style);const c=ZW(n);if(!J4.has(c)){const u=rf("registerStyles",n.$tagName$);c4e(c,s,!!(n.$flags$&1)),u()}}}const a=t.$ancestorComponent$,o=()=>dj(t,!0);a&&a["s-rc"]?a["s-rc"].push(o):o()},hj=e=>{fj(e,"connectedCallback")},C4e=e=>{if((Ba.$flags$&1)===0){const t=P0(e),n=t.$cmpMeta$,r=rf("connectedCallback",n.$tagName$);if(t.$flags$&1)t?.$lazyInstance$?hj(t.$lazyInstance$):t?.$onReadyPromise$&&t.$onReadyPromise$.then(()=>hj(t.$lazyInstance$));else{t.$flags$|=1;{let i=e;for(;i=i.parentNode||i.host;)if(i["s-p"]){iZ(t,t.$ancestorComponent$=i);break}}n.$members$&&Object.entries(n.$members$).map(([i,[a]])=>{if(a&31&&e.hasOwnProperty(i)){const o=e[i];delete e[i],e[i]=o}}),S4e(e,t,n)}r()}},cZ=e=>{fj(e,"disconnectedCallback")},A4e=async e=>{if((Ba.$flags$&1)===0){const t=P0(e);t?.$lazyInstance$?cZ(t.$lazyInstance$):t?.$onReadyPromise$&&t.$onReadyPromise$.then(()=>cZ(t.$lazyInstance$))}},T4e=(e,t={})=>{var n;const r=rf(),i=[],a=t.exclude||[],o=e8.customElements,s=Ml.head,c=s.querySelector("meta[charset]"),u=Ml.createElement("style"),d=[];let p,f=!0;Object.assign(Ba,t),Ba.$resourcesUrl$=new URL(t.resourcesUrl||"./",Ml.baseURI).href;let m=!1;if(e.map(v=>{v[1].map(y=>{var E;const I={$flags$:y[0],$tagName$:y[1],$members$:y[2],$listeners$:y[3]};I.$flags$&4&&(m=!0),I.$members$=y[2],I.$watchers$=(E=y[4])!=null?E:{};const w=I.$tagName$,j=class extends HTMLElement{constructor(_){if(super(_),this.hasRegisteredEventListeners=!1,_=this,Gwe(_,I),I.$flags$&1){if(!_.shadowRoot)_.attachShadow({mode:"open"});else if(_.shadowRoot.mode!=="open")throw new Error(`Unable to re-use existing shadow root for ${I.$tagName$}! Mode is set to ${_.shadowRoot.mode} but Stencil only supports open shadow roots.`)}}connectedCallback(){P0(this),this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0),p&&(clearTimeout(p),p=null),f?d.push(this):Ba.jmp(()=>C4e(this))}disconnectedCallback(){Ba.jmp(()=>A4e(this))}componentOnReady(){return P0(this).$onReadyPromise$}};I.$lazyBundleId$=v[0],!a.includes(w)&&!o.get(w)&&(i.push(w),o.define(w,sZ(j,I,1)))})}),i.length>0&&(m&&(u.textContent+=DW),u.textContent+=i.sort()+Wwe,u.innerHTML.length)){u.setAttribute("data-styles","");const v=(n=Ba.$nonce$)!=null?n:Fwe(Ml);v!=null&&u.setAttribute("nonce",v),s.insertBefore(u,c?c.nextSibling:s.firstChild)}f=!1,d.length?d.map(v=>v.connectedCallback()):Ba.jmp(()=>p=setTimeout(aZ,30)),r()},x4e=e=>Ba.$nonce$=e})),k4e,srt=Z((()=>{k4e=()=>{}})),j4e,crt=Z((()=>{I4e(),srt(),j4e=async(e,t)=>{if(!(typeof window>"u"))return await k4e(),T4e([["mm-install-modal_2",[[1,"mm-install-modal",{link:[1],expiresIn:[2,"expires-in"],showInstallModal:[4,"show-install-modal"],translationsLoaded:[32]},null,{link:["updateLinkHandler"],expiresIn:["updateExpiresInHandler"]}],[1,"mm-otp-modal",{displayOTP:[4,"display-o-t-p"],otpCode:[1,"otp-code"],translationsLoaded:[32]}]]]],t)}})),urt=$c({defineCustomElements:()=>j4e,setNonce:()=>x4e}),lrt=Z((()=>{crt(),(function(){if(typeof window<"u"&&window.Reflect!==void 0&&window.customElements!==void 0){var e=HTMLElement;window.HTMLElement=function(){return Reflect.construct(e,[],this.constructor)},HTMLElement.prototype=e.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,e)}})()}));function P4e(e,t){return e.includes(t)||e.includes("metamask-sdk:*")||e.includes("*")}function drt({infuraApiKey:e,caipChainIds:t}){return(t&&t.length>0?t:Object.keys(OZ)).reduce((n,r)=>{const i=OZ[r];return i&&(n[r]=`${i}${e}`),n},{})}function frt(e){switch(e){case"browser":return"browser";case"mwp":return"mwp";default:return"unknown"}}function hrt(){return typeof window>"u"||!window?.navigator?!0:navigator?.product==="ReactNative"}function O4e(){var e,t;return typeof globalThis<"u"&&((e=globalThis?.navigator)==null?void 0:e.product)==="ReactNative"?!0:typeof window<"u"&&window.navigator!==void 0&&((t=window.navigator)==null?void 0:t.product)==="ReactNative"}function prt(){return typeof window<"u"&&!!window.ReactNativeWebView&&!!window.navigator.userAgent.endsWith("MetaMaskMobile")}function mrt(){if(window.navigator.maxTouchPoints>1&&/Macintosh/.test(window.navigator.userAgent))return!0;var e,t;const n=U4e.default.parse(window.navigator.userAgent);return((e=n?.platform)==null?void 0:e.type)==="mobile"||((t=n?.platform)==null?void 0:t.type)==="tablet"}function af(){return O4e()?"react-native":hrt()?"nodejs":prt()?"in-app-browser":mrt()?"web-mobile":"web-desktop"}function pj(){const e=af();return O4e()||e==="web-mobile"}function uZ(){return dt(this,null,function*(){return o8e})}function grt(e){if(!e)return;let t=e;for(const{pattern:n,replacement:r}of h8e)t=t.replace(n,r);return t.length>DZ&&(t=`${t.slice(0,DZ-1)}…`),t}function lZ(e){var t,n,r,i;if(typeof e!="object"||e===null)return{code:void 0,message:""};if(e instanceof o8)return{code:(t=e.rpcCode)!=null?t:e.code,message:(r=(n=e.rpcMessage)!=null?n:e.message)!=null?r:""};const a=e;return{code:a.code,message:(i=a.message)!=null?i:""}}function dZ(e){if(typeof e!="object"||e===null)return!1;const{code:t,message:n}=lZ(e),r=n.toLowerCase();return t===4001||r.includes("reject")||r.includes("denied")||r.includes("cancel")||r.includes("user rejected")||r.includes("user denied")||r.includes("user cancelled")||r.includes("user canceled")}function brt(e){var t,n;if(typeof e!="object"||e===null)return"unknown";const r=e,i=(t=r.name)!=null?t:"",a=(n=r.message)!=null?n:"",o=a.toLowerCase(),{code:s}=lZ(e);if(typeof s=="number"){if(s===-32601)return"wallet_method_unsupported";if(s===-32602)return"wallet_invalid_params";if(s===-32603||s<=-32e3&&s>=-32099)return"wallet_internal_error";if(s===4100)return"wallet_unauthorized";if(s===4200)return"wallet_method_unsupported";if(s===4902)return"unrecognized_chain"}return i==="TransportTimeoutError"||a==="Request timeout"||o.includes("timed out")||o.includes("timeout")?"transport_timeout":i==="TransportError"||o.includes("not connected")||o.includes("transport disconnect")||o.includes("connection lost")||o.includes("socket closed")?"transport_disconnect":"unknown"}function M4e(e){const t=brt(e),{code:n,message:r}=lZ(e),i=grt(r);return on(on({failure_reason:t},typeof n=="number"?{error_code:n}:{}),i?{error_message_sample:i}:{})}function fZ(e,t){return dt(this,null,function*(){var n;const r=hZ(e.dapp),i=af(),a=yield t.getAnonId();return{mmconnect_versions:(n=e.versions)!=null?n:{},dapp_id:r,platform:i,anon_id:a}})}function Wg(e,t,n,r,i){return dt(this,null,function*(){var a;const o=hZ(e.dapp),s=yield t.getAnonId();return on(on(on({mmconnect_versions:(a=e.versions)!=null?a:{},dapp_id:o,method:n.request.method,caip_chain_id:n.scope,anon_id:s,transport_type:r},i?.failure_reason?{failure_reason:i.failure_reason}:{}),typeof i?.error_code=="number"?{error_code:i.error_code}:{}),i?.error_message_sample?{error_message_sample:i.error_message_sample}:{})})}function n5(){return p8e}function R4e(){if(typeof globalThis<"u"||typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;throw new Error("Unable to locate global object")}function yrt(e){if(typeof btoa<"u")return btoa(e);if(typeof Buffer<"u")return Buffer.from(e).toString("base64");throw new Error("No base64 encoding method available")}function B4e(e){const t=O_e(e);return yrt(String.fromCharCode.apply(null,Array.from(t)))}function hZ(e){var t;return(t=e.url)!=null?t:e.name}function mj(e,t,n){var r;const{mobile:i}=e;if((r=i?.useDeeplink)==null||r)typeof window<"u"&&(window.location.href=t);else if(typeof document<"u"){const a=document.createElement("a");a.href=n,a.target="_self",a.rel="noreferrer noopener",a.click()}}function vrt(e,t,n,r){const i=Object.keys(e.sessionScopes),a=[];return Object.values(e.sessionScopes).forEach(o=>{o?.accounts&&Array.isArray(o.accounts)&&o.accounts.forEach(s=>{a.push(s)})}),{mergedScopes:Array.from(new Set([...i,...t])),mergedCaipAccountIds:Array.from(new Set([...a,...n])),mergedSessionProperties:on(on({},e.sessionProperties),r)}}function gj(e){return e.reduce((t,n)=>qi(on({},t),{[n]:{methods:[],notifications:[],accounts:[]}}),{})}function _rt(e){var t;if(/^https?:\/\//u.test(e))return;const n=e.match(/^([^:]*):\/\//u);return{url:`https://${(((t=n?.[1])!=null?t:e).toLowerCase().replace(/[^a-z0-9-]/gu,"-").replace(/^-+|-+$/gu,"")||"unknown").slice(0,63).replace(/-+$/u,"")}.rn.dapp.local`,nativeScheme:e}}function wrt(e){var t,n;const r=af(),i=r==="web-desktop"||r==="web-mobile"||r==="in-app-browser";if(!((t=e.dapp)!=null&&t.name))throw new Error("You must provide dapp name");if(i&&(e.dapp=qi(on({},e.dapp),{url:`${window.location.protocol}//${window.location.host}`})),!((n=e.dapp)!=null&&n.url))throw new Error("You must provide dapp url");if(r==="react-native"&&e.dapp.url){const s=_rt(e.dapp.url);s&&(console.info(`Normalizing dapp URL for React Native: "${e.dapp.url}" -> "${s.url}"`),e.dapp=qi(on({},e.dapp),{url:s.url,nativeScheme:s.nativeScheme}))}const a=163400,o=/^(http|https):\/\/[^\s]*$/u;if(e.dapp){"iconUrl"in e.dapp&&e.dapp.iconUrl&&!o.test(e.dapp.iconUrl)&&(console.warn("Invalid dappMetadata.iconUrl: URL must start with http:// or https://"),e.dapp.iconUrl=void 0),"base64Icon"in e.dapp&&e.dapp.base64Icon&&e.dapp.base64Icon.length>a&&(console.warn("Invalid dappMetadata.base64Icon: Base64-encoded icon string length must be less than 163400 characters"),e.dapp.base64Icon=void 0),e.dapp.url&&!o.test(e.dapp.url)&&console.warn("Invalid dappMetadata.url: URL must start with http:// or https://");const s=g8e();if(s&&!("iconUrl"in e.dapp)&&!("base64Icon"in e.dapp)){const c=`${window.location.protocol}//${window.location.host}${s}`;e.dapp.iconUrl=c}}return e}function N4e(e,t,n,r){if(!(e.every(a=>t.includes(a))&&t.every(a=>e.includes(a))))return!1;const i=Object.values(n.sessionScopes).filter(({accounts:a})=>!!a).flatMap(({accounts:a})=>a??[]);return r.every(a=>i.includes(a))}function bj(e){return e.reduce((t,n)=>{try{return[...t,b5e(n)]}catch(r){const i=JSON.stringify(n);return console.error(`Invalid CAIP account ID: ${i}`,r),t}},[])}function yj(e,t){var n;if(!e||!t?.length)return e;const r=Object.fromEntries(Object.entries(e).map(([a,o])=>{var s,c,u;return[a,{methods:[...(s=o?.methods)!=null?s:[]],notifications:[...(c=o?.notifications)!=null?c:[]],accounts:[...(u=o?.accounts)!=null?u:[]]}]})),i=new Map;for(const a of t){const o=`${a.chain.namespace}:${a.chain.reference}`,s=`${a.chainId}:${a.address}`;i.has(o)||i.set(o,[]),(n=i.get(o))==null||n.push(s)}for(const[a,o]of Object.entries(r))if(o?.accounts)try{const s=sG(a),c=`${s.namespace}:${s.reference}`,u=i.get(c);if(u){const d=new Set(o.accounts),p=u.filter(f=>!d.has(f));o.accounts.push(...p)}}catch(s){console.error(`Invalid scope format: ${a}`,s)}return r}function Ert(){return dt(this,null,function*(){const{decrypt:e,encrypt:t,PrivateKey:n,PublicKey:r}=yield Promise.resolve().then(()=>nt(Xtt(),1));return{generateKeyPair(){const i=new n;return{privateKey:new Uint8Array(i.secret),publicKey:i.publicKey.toBytes(!0)}},encrypt(i,a){return dt(this,null,function*(){return t(a,Buffer.from(i,"utf8")).toString("base64")})},decrypt(i,a){return dt(this,null,function*(){const o=yield e(a,Buffer.from(i,"base64"));return Buffer.from(o).toString("utf8")})},validatePeerKey(i){r.fromHex(Buffer.from(i).toString("hex"))}}})}function Srt(e){return e<=0?"EXPIRED":`${Math.floor(e/1e3)}s`}function Crt(e){return e<=10?!0:e<=30?e%5===0:e<=60?e%10===0:e<=300?e%30===0:e%60===0}function Art(){return VZ+=1,VZ}function L4e(e){if(typeof e=="object"&&e!==null)return e}function Trt(e){return typeof e=="number"?e:void 0}function pZ(e){return typeof e=="string"&&e.length>0?e:void 0}function xrt(e){return e!==void 0&&kv(e)?e:void 0}function mZ(e){for(const t of e){const n=pZ(t);if(n!==void 0)return n}}function Irt(e){const t=[];let n=e;for(let r=0;n!==void 0&&r<H8e;r+=1)t.push(n),n=L4e(n.cause);return t}function krt(e){const t=Trt(e?.code);if(t===void 0)return;const n=pZ(e?.message),r=xrt(e?.data);return on(on({code:t},n===void 0?{}:{message:n}),r===void 0?{}:{data:r})}function jrt(e){var t,n,r,i;const a=Irt(L4e(e)),o=pZ(e);for(const[s,c]of a.entries()){const u=krt(c);if(u){const d=a.slice(s+1),p=a.slice(0,s),f=mZ(d.map(v=>v.message)),m=mZ([o,...p.map(v=>v.message)]);return on(on({reason:(r=(n=(t=u.message)!=null?t:f)!=null?n:m)!=null?r:"Unknown error",rpcCode:u.code},u.message===void 0?{}:{rpcMessage:u.message}),u.data===void 0?{}:{rpcData:u.data})}}return{reason:(i=o??mZ(a.map(s=>s.message)))!=null?i:"Unknown error"}}function gZ(e){if(e instanceof o8)return e;const{reason:t,rpcCode:n,rpcMessage:r,rpcData:i}=jrt(e);return new o8(t,n,r,i)}function Prt(e){var t;return qi(on({},e??{}),{enabled:(t=e?.enabled)!=null?t:!0,integrationType:e?.integrationType||"direct"})}function i8(e){var t;return((t=e.analytics)==null?void 0:t.enabled)!==!1}function D4e(e,t,n){return dt(this,null,function*(){var r,i;if(!i8(e)){n?.(void 0),ta.disable();return}const a=af();if(!(a==="in-app-browser"||a==="web-desktop"||a==="web-mobile")&&a!=="react-native")return;const o=hZ(e.dapp),s=yield t.getAnonId();n?.(s);const{integrationType:c}=(r=e.analytics)!=null?r:{integrationType:""};ta.setGlobalProperty("mmconnect_versions",(i=e.versions)!=null?i:{}),ta.setGlobalProperty("dapp_id",o),ta.setGlobalProperty("anon_id",s),ta.setGlobalProperty("platform",a),c&&ta.setGlobalProperty("integration_types",[c]),ta.enable()})}function Ort(){return dt(this,null,function*(){if(!(typeof document>"u"))try{const{defineCustomElements:e}=yield Promise.resolve().then(()=>(lrt(),urt));e()}catch(e){console.error("Failed to load customElements:",e)}})}var bZ,U4e,F4e,z4e,yZ,$4e,H4e,q4e,vZ,G4e,V4e,_Z,wZ,on,qi,gr,a8,vj,kt,qr,dr,Lt,dt,Z1,EZ,SZ,CZ,AZ,W4e,TZ,xZ,IZ,o8,Z4e,K4e,K1,kZ,jZ,s8,c8,Y4e,PZ,OZ,Q4e,X4e,J4e,MZ,e8e,t8e,n8e,RZ,r8e,_j,i8e,a8e,o8e,BZ,s8e,c8e,u8e,NZ,l8e,LZ,d8e,f8e,DZ,h8e,wj,p8e,m8e,Zs,g8e,UZ,Ej,r5,O0,FZ,b8e,Sj,zZ,y8e,v8e,_8e,Y1,i5,a5,Cj,w8e,E8e,Aj,u8,S8e,C8e,A8e,T8e,$Z,HZ,x8e,I8e,l8,o5,d8,k8e,j8e,P8e,O8e,M8e,R8e,B8e,N8e,qZ,L8e,GZ,Tj,D8e,U8e,F8e,z8e,f8,xj,VZ,WZ,$8e,H8e,Q1,q8e,G8e,V8e,W8e,Z8e,K8e,Y8e,Q8e,h8,Zg,X1,s5,p8,Ij,ys,kj,ZZ,KZ,X8e,J8e,YZ,QZ,XZ,c5,J1,u5,e9e,t9e,n9e,r9e,i9e,m8,jj,a9e,Pj,M0,ba,Kg,l5,vs,ep,g8,xn,tp,JZ,eK,b8,o9e,s9e,y8,c9e,tK,u9e,l9e,d9e,f9e,h9e,p9e,Oj,m9e,d5,nK,g9e,b9e,y9e,rK,v8,iK,Mj,aK,Rj,v9e,_9e,w9e,E9e,Mrt=Z((()=>{Mve(),bZ=nt(Nq(),1),U4e=nt(Rve(),1),uk(),Pet(),qet(),ttt(),F4e=Ite(),s3e(),z4e=nt(ctt(),1),h3e(),mtt(),yZ=Object.defineProperty,$4e=Object.defineProperties,H4e=Object.getOwnPropertyDescriptors,q4e=Object.getOwnPropertyNames,vZ=Object.getOwnPropertySymbols,G4e=Object.prototype.hasOwnProperty,V4e=Object.prototype.propertyIsEnumerable,_Z=e=>{throw TypeError(e)},wZ=(e,t,n)=>t in e?yZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,on=(e,t)=>{for(var n in t||(t={}))G4e.call(t,n)&&wZ(e,n,t[n]);if(vZ)for(var n of vZ(t))V4e.call(t,n)&&wZ(e,n,t[n]);return e},qi=(e,t)=>$4e(e,H4e(t)),gr=(e,t)=>function(){return e&&(t=(0,e[q4e(e)[0]])(e=0)),t},a8=(e,t)=>{for(var n in t)yZ(e,n,{get:t[n],enumerable:!0})},vj=(e,t,n)=>t.has(e)||_Z("Cannot "+n),kt=(e,t,n)=>(vj(e,t,"read from private field"),n?n.call(e):t.get(e)),qr=(e,t,n)=>t.has(e)?_Z("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),dr=(e,t,n,r)=>(vj(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Lt=(e,t,n)=>(vj(e,t,"access private method"),n),dt=(e,t,n)=>new Promise((r,i)=>{var a=c=>{try{s(n.next(c))}catch(u){i(u)}},o=c=>{try{s(n.throw(c))}catch(u){i(u)}},s=c=>c.done?r(c.value):Promise.resolve(c.value).then(a,o);s((n=n.apply(e,t)).next())}),EZ=gr({"src/domain/errors/base.ts"(){"use strict";Z1=class extends Error{constructor(e,t){super(e),this.message=e,this.code=t}}}}),Z4e=gr({"src/domain/errors/rpc.ts"(){"use strict";EZ(),SZ=class WJ extends Z1{constructor(t,n,r){super(`RPCErr${WJ.code}: ${r} on ${t} for method ${n}`,WJ.code),this.rpcEndpoint=t,this.method=n,this.httpStatus=r}},SZ.code=50,CZ=SZ,AZ=class ZJ extends Z1{constructor(t){super(`RPCErr${ZJ.code}: RPC Client response reason ${t}`,ZJ.code),this.reason=t}},AZ.code=51,W4e=AZ,TZ=class KJ extends Z1{constructor(t){super(`RPCErr${KJ.code}: RPC Client fetch reason ${t}`,KJ.code),this.reason=t}},TZ.code=52,xZ=TZ,IZ=class YJ extends Z1{constructor(t,n,r,i){super(`RPCErr${YJ.code}: RPC Client invoke method reason (${t})`,YJ.code),this.reason=t,this.rpcCode=n,this.rpcMessage=r,this.rpcData=i}},IZ.code=53,o8=IZ}}),K4e=gr({"src/domain/errors/index.ts"(){"use strict";Z4e()}}),jZ=gr({"src/domain/events/index.ts"(){"use strict";kZ=class{constructor(){qr(this,K1,new Bq.default)}emit(e,...t){kt(this,K1).emit(e,...t)}on(e,t){return kt(this,K1).on(e,t),()=>{this.off(e,t)}}off(e,t){kt(this,K1).off(e,t)}removeListener(e,t){kt(this,K1).off(e,t)}once(e,t){return kt(this,K1).once(e,t),()=>{this.off(e,t)}}listenerCount(e){return kt(this,K1).listenerCount(e)}},K1=new WeakMap}}),PZ=gr({"src/domain/logger/index.ts"(){"use strict";s8=(e="metamask-sdk",t="214")=>{const n=(0,bZ.default)(e);return n.color=t,n},c8=(e="metamask-sdk")=>{bZ.default.enable(e)},Y4e=(e,t)=>dt(null,null,function*(){var n;if("process"in globalThis&&((n=process==null?void 0:process.env)!=null&&n.DEBUG)){const{DEBUG:i}=process.env;return P4e(i,e)}const r=yield t.getDebug();return r?P4e(r,e):!1})}}),MZ=gr({"src/domain/multichain/api/constants.ts"(){"use strict";OZ={"eip155:1":"https://mainnet.infura.io/v3/","eip155:11155111":"https://sepolia.infura.io/v3/","eip155:560048":"https://hoodi.infura.io/v3/","eip155:59144":"https://linea-mainnet.infura.io/v3/","eip155:59141":"https://linea-sepolia.infura.io/v3/","eip155:137":"https://polygon-mainnet.infura.io/v3/","eip155:80002":"https://polygon-amoy.infura.io/v3/","eip155:10":"https://optimism-mainnet.infura.io/v3/","eip155:11155420":"https://optimism-sepolia.infura.io/v3/","eip155:42161":"https://arbitrum-mainnet.infura.io/v3/","eip155:421614":"https://arbitrum-sepolia.infura.io/v3/","eip155:8453":"https://base-mainnet.infura.io/v3/","eip155:84532":"https://base-sepolia.infura.io/v3/","eip155:81457":"https://blast-mainnet.infura.io/v3/","eip155:168587773":"https://blast-sepolia.infura.io/v3/","eip155:324":"https://zksync-mainnet.infura.io/v3/","eip155:300":"https://zksync-sepolia.infura.io/v3/","eip155:56":"https://bsc-mainnet.infura.io/v3/","eip155:97":"https://bsc-testnet.infura.io/v3/","eip155:204":"https://opbnb-mainnet.infura.io/v3/","eip155:5611":"https://opbnb-testnet.infura.io/v3/","eip155:534352":"https://scroll-mainnet.infura.io/v3/","eip155:534351":"https://scroll-sepolia.infura.io/v3/","eip155:5000":"https://mantle-mainnet.infura.io/v3/","eip155:5003":"https://mantle-sepolia.infura.io/v3/","eip155:1329":"https://sei-mainnet.infura.io/v3/","eip155:713715":"https://sei-testnet.infura.io/v3/","eip155:1923":"https://swellchain-mainnet.infura.io/v3/","eip155:1924":"https://swellchain-testnet.infura.io/v3/","eip155:130":"https://unichain-mainnet.infura.io/v3/","eip155:1301":"https://unichain-sepolia.infura.io/v3/","eip155:43111":"https://hemi-mainnet.infura.io/v3/","eip155:743111":"https://hemi-testnet.infura.io/v3/","eip155:6342":"https://megaeth-mainnet.infura.io/v3/","eip155:6342001":"https://megaeth-testnet.infura.io/v3/","eip155:143":"https://monad-mainnet.infura.io/v3/","eip155:10143":"https://monad-testnet.infura.io/v3/","eip155:11297108109":"https://palm-mainnet.infura.io/v3/","eip155:43114":"https://avalanche-mainnet.infura.io/v3/","eip155:43113":"https://avalanche-fuji.infura.io/v3/","eip155:42220":"https://celo-mainnet.infura.io/v3/","eip155:44787":"https://celo-sepolia.infura.io/v3/","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":"https://solana-mainnet.infura.io/v3/","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1":"https://solana-devnet.infura.io/v3/"},Q4e=new Set(["eth_blockNumber","eth_gasPrice","eth_maxPriorityFeePerGas","eth_blobBaseFee","eth_feeHistory","eth_getBalance","eth_getCode","eth_getStorageAt","eth_call","eth_estimateGas","eth_getLogs","eth_getProof","eth_getTransactionCount","eth_getBlockByNumber","eth_getBlockByHash","eth_getBlockTransactionCountByNumber","eth_getBlockTransactionCountByHash","eth_getUncleCountByBlockNumber","eth_getUncleCountByBlockHash","eth_getTransactionByHash","eth_getTransactionByBlockNumberAndIndex","eth_getTransactionByBlockHashAndIndex","eth_getTransactionReceipt","eth_getUncleByBlockNumberAndIndex","eth_getUncleByBlockHashAndIndex","eth_getFilterChanges","eth_getFilterLogs","eth_newBlockFilter","eth_newFilter","eth_newPendingTransactionFilter","eth_sendRawTransaction","eth_syncing","eth_uninstallFilter"]),X4e=new Set(["eth_accounts","eth_chainId","wallet_getCapabilities"]),J4e=new Set(["wallet_addEthereumChain","wallet_switchEthereumChain","eth_accounts"])}}),e8e=gr({"src/domain/multichain/api/infura.ts"(){"use strict";MZ()}}),n8e=gr({"src/domain/multichain/api/types.ts"(){"use strict";t8e="eip155Capabilities"}}),_j=gr({"src/domain/multichain/index.ts"(){"use strict";jZ(),MZ(),e8e(),n8e(),RZ=(e=>(e.Browser="browser",e.MWP="mwp",e.UNKNOWN="unknown",e))(RZ||{}),r8e=class extends kZ{constructor(e){super(),this.options=e}mergeOptions(e){var t,n,r,i,a,o,s,c,u,d,p,f,m,v,y,E,I;const w=this.options,j=on(on({},w.analytics),(t=e.analytics)!=null?t:{});((n=w.analytics)==null?void 0:n.enabled)===!1&&(j.enabled=!1),this.options=qi(on({},w),{api:qi(on({},w.api),{supportedNetworks:on(on({},w.api.supportedNetworks),(i=(r=e.api)==null?void 0:r.supportedNetworks)!=null?i:{})}),versions:on(on({},w.versions),(a=e.versions)!=null?a:{}),analytics:on({},j),ui:qi(on({},w.ui),{headless:(s=(o=e.ui)==null?void 0:o.headless)!=null?s:w.ui.headless,preferExtension:(u=(c=e.ui)==null?void 0:c.preferExtension)!=null?u:w.ui.preferExtension,showInstallModal:(p=(d=e.ui)==null?void 0:d.showInstallModal)!=null?p:w.ui.showInstallModal}),mobile:on(on({},w.mobile),(f=e.mobile)!=null?f:{}),transport:qi(on({},(m=w.transport)!=null?m:{}),{extensionId:(E=(v=e.transport)==null?void 0:v.extensionId)!=null?E:(y=w.transport)==null?void 0:y.extensionId}),debug:(I=e.debug)!=null?I:w.debug})}}}}),BZ=gr({"src/domain/platform/index.ts"(){"use strict";i8e=(e=>(e.NonBrowser="nodejs",e.MetaMaskMobileWebview="in-app-browser",e.DesktopWeb="web-desktop",e.MobileWeb="web-mobile",e.ReactNative="react-native",e))(i8e||{}),a8e=new Set(["io.metamask","io.metamask.mobile","io.metamask.flask"]),o8e=dt(null,null,function*(){const e=af();return e==="nodejs"||e==="react-native"?Promise.resolve(!1):new Promise(t=>{const n=[],r=window,i=a=>{var o,s;(s=(o=a?.detail)==null?void 0:o.info)!=null&&s.rdns&&n.push(a.detail)};r.addEventListener("eip6963:announceProvider",i),r.dispatchEvent(new Event("eip6963:requestProvider")),setTimeout(()=>{try{typeof r?.removeEventListener=="function"&&r.removeEventListener("eip6963:announceProvider",i),t(n.some(a=>{var o;return typeof((o=a?.info)==null?void 0:o.rdns)=="string"&&a8e.has(a.info.rdns)}))}catch{t(!1)}},300)})})}}),c8e=gr({"src/domain/store/adapter.ts"(){"use strict";s8e=class{constructor(e){this.options=e}}}}),NZ=gr({"src/domain/store/client.ts"(){"use strict";u8e=class{}}}),l8e=gr({"src/domain/store/index.ts"(){"use strict";c8e(),NZ()}}),d8e=gr({"src/domain/ui/types.ts"(){"use strict";LZ=class{constructor(e){this.options=e}get isMounted(){return this.instance!==void 0}get data(){if(typeof this.options=="object"&&this.options&&"link"in this.options)return this.options.link;if(typeof this.options=="object"&&this.options&&"otpCode"in this.options)return this.options.otpCode;throw new Error("Invalid options")}set data(e){typeof this.options=="object"&&this.options&&"link"in this.options&&(this.options.link=e),typeof this.options=="object"&&this.options&&"otpCode"in this.options&&(this.options.otpCode=e)}}}}),f8e=gr({"src/domain/ui/index.ts"(){"use strict";d8e()}}),wj=gr({"src/multichain/utils/analytics.ts"(){"use strict";O0(),Zs(),DZ=200,h8e=[{pattern:/0x[a-fA-F0-9]{40}/gu,replacement:"<addr>"},{pattern:/(?:0x)?[a-fA-F0-9]{16,}/gu,replacement:"<hex>"},{pattern:/https?:\/\/[^\s"')]+/gu,replacement:"<url>"},{pattern:/\b[a-z]{1,10}1[ac-hj-np-z02-9]{38,}\b/gu,replacement:"<addr>"},{pattern:/\b[1-9A-HJ-NP-Za-km-z]{32,}\b/gu,replacement:"<addr>"},{pattern:/\d{10,}/gu,replacement:"<num>"}]}}),m8e=gr({"src/domain/utils/index.ts"(){"use strict";wj(),p8e="1.2.0"}}),Zs=gr({"src/domain/index.ts"(){"use strict";K4e(),jZ(),PZ(),_j(),BZ(),l8e(),f8e(),m8e()}}),O0=gr({"src/multichain/utils/index.ts"(){"use strict";Zs(),g8e=()=>{var e;if(typeof document>"u")return;let t;const n=document.getElementsByTagName("link");for(let r=0;r<n.length;r++)(n[r].getAttribute("rel")==="icon"||n[r].getAttribute("rel")==="shortcut icon")&&(t=(e=n[r].getAttribute("href"))!=null?e:void 0);return t},UZ=4294967295,Ej=Math.floor(Math.random()*UZ),r5=()=>(Ej=(Ej+1)%UZ,Ej)}}),b8e=gr({"src/multichain/transports/constants.ts"(){"use strict";FZ="metamask-multichain-provider"}}),Sj={},a8(Sj,{MWPTransport:()=>T8e}),$Z=gr({"src/multichain/transports/mwp/index.ts"(){"use strict";Zs(),O0(),b8e(),zZ=600*1e3,y8e=60*1e3,v8e=zZ+y8e,_8e=10*1e3,Y1="cache_wallet_getSession",i5="cache_eth_accounts",a5="cache_eth_chainId",Cj="pending_session_request",w8e=["wallet_getSession","wallet_createSession","wallet_sessionChanged"],E8e=["wallet_revokeSession","wallet_revokePermissions"],Aj=s8("metamask-sdk:transport"),T8e=class{constructor(e,t,n={requestTimeout:zZ,connectionTimeout:v8e,resumeTimeout:_8e}){this.dappClient=e,this.kvstore=t,this.options=n,qr(this,u8),this.__pendingRequests=new Map,this.notificationCallbacks=new Set,this.dappClient.on("message",this.handleMessage.bind(this)),this.dappClient.on("session_request",r=>{this.currentSessionRequest=r,this.kvstore.set(Cj,JSON.stringify(r)).catch(i=>{Aj("Failed to store pending session request",i)})}),typeof window<"u"&&typeof window.addEventListener<"u"&&(this.windowFocusHandler=this.onWindowFocus.bind(this),window.addEventListener("focus",this.windowFocusHandler))}get pendingRequests(){return this.__pendingRequests}set pendingRequests(e){this.__pendingRequests=e}get sessionRequest(){return this.currentSessionRequest}getStoredPendingSessionRequest(){return dt(this,null,function*(){try{const e=yield this.kvstore.get(Cj);return e?JSON.parse(e):null}catch{return null}})}removeStoredPendingSessionRequest(){return dt(this,null,function*(){yield this.kvstore.delete(Cj)})}onWindowFocus(){this.isConnected()||this.dappClient.reconnect()}notifyCallbacks(e){this.notificationCallbacks.forEach(t=>t(e))}rejectRequest(e,t=new Error("Request rejected")){const n=this.pendingRequests.get(e);n&&(this.pendingRequests.delete(e),clearTimeout(n.timeout),n.reject(t))}parseWalletError(e){const t=e;if(typeof t.code=="number"&&typeof t.message=="string"){const{code:r,message:i}=t,a=t.data,o=kv(a)?a:void 0;return r>=1e3&&r<=4999?Uk.custom({code:r,message:i,data:o}):new Dk(r,i,o)}const n=e instanceof Error?e.message:JSON.stringify(e);return Z_e.internal({message:n})}getResponseError(e){if("error"in e&&e.error)return e.error;const{result:t}=e;if(typeof t=="object"&&t!==null&&"error"in t&&t.error&&this.isErrorPayload(t.error))return t.error}isErrorPayload(e){if(e instanceof Error)return!0;const t=e;return typeof t?.code=="number"&&typeof t?.message=="string"}handleMessage(e){if(typeof e=="object"&&e!==null&&"data"in e){const t=e.data;if("id"in t&&typeof t.id=="string"){const n=this.pendingRequests.get(t.id);if(n){clearTimeout(n.timeout);const r=this.getResponseError(t);if(r){this.pendingRequests.delete(t.id),n.reject(this.parseWalletError(r));return}const i=qi(on({},t),{method:n.method==="wallet_getSession"||n.method==="wallet_createSession"?"wallet_sessionChanged":n.method}),a=qi(on({},t),{method:n.method==="wallet_getSession"||n.method==="wallet_createSession"?"wallet_sessionChanged":n.method,params:i.result});this.notifyCallbacks(a),n.resolve(i),this.pendingRequests.delete(t.id)}}else{if(e.data.method==="metamask_chainChanged"&&this.kvstore.set(a5,JSON.stringify(e.data.params.chainId)),e.data.method==="metamask_accountsChanged"&&this.kvstore.set(i5,JSON.stringify(e.data.params)),e.data.method==="wallet_sessionChanged"){const n={result:e.data.params};this.kvstore.set(Y1,JSON.stringify(n))}this.notifyCallbacks(e.data)}}}init(){return dt(this,null,function*(){})}sendEip1193Message(e,t){return dt(this,null,function*(){const n=on({jsonrpc:"2.0",id:String(r5())},e),r=yield this.getCachedResponse(n);return r?(this.notifyCallbacks(r),r):new Promise((i,a)=>{var o;const s=setTimeout(()=>{this.rejectRequest(n.id,new $1)},(o=t?.timeout)!=null?o:this.options.requestTimeout);this.pendingRequests.set(n.id,{request:n,method:n.method,resolve:c=>dt(this,null,function*(){return yield this.storeWalletSession(n,c),i(c)}),reject:a,timeout:s}),this.dappClient.sendRequest({name:"metamask-provider",data:n}).catch(a)})})}connect(e){return dt(this,null,function*(){const t=yield this.getActiveSession();return t&&Aj("active session found",{id:t.id,channel:t.channel,expiresAt:t.expiresAt}),(t?Lt(this,u8,C8e).call(this,t,e):Lt(this,u8,A8e).call(this,e)).catch(n=>dt(this,null,function*(){throw yield this.dappClient.disconnect(),n})).finally(()=>{this.removeStoredPendingSessionRequest()})})}disconnect(){return dt(this,arguments,function*(e=[]){var t;const n=yield this.getCachedSession(),r=(t=n?.sessionScopes)!=null?t:{},i=e.length===0?[]:Object.keys(r).filter(o=>!e.includes(o)),a=Object.fromEntries(Object.entries(r).filter(([o])=>i.includes(o)));this.request({method:"wallet_revokeSession",params:{scopes:e}}).catch(o=>{console.error("error revoking session",o)}),i.some(o=>o.includes("eip155"))||(this.kvstore.delete(i5),this.kvstore.delete(a5)),i.length>0?this.kvstore.set(Y1,JSON.stringify({result:qi(on({},n),{sessionScopes:a})})):(this.kvstore.delete(Y1),typeof window<"u"&&typeof window.removeEventListener<"u"&&this.windowFocusHandler&&(window.removeEventListener("focus",this.windowFocusHandler),this.windowFocusHandler=void 0),yield this.dappClient.disconnect()),this.notifyCallbacks({method:"wallet_sessionChanged",params:{sessionScopes:a}})})}isConnected(){return this.dappClient.state==="CONNECTED"}attemptResumeSession(){return dt(this,null,function*(){try{yield this.dappClient.reconnect(),yield new Promise((e,t)=>{const n=setTimeout(()=>{t(new Error("Resume timeout"))},2e3);this.isConnected()?(clearTimeout(n),e()):this.dappClient.once("connected",()=>{clearTimeout(n),e()})})}catch(e){return Promise.reject(new Error(`Failed to resume session: ${e.message}`))}})}getCachedResponse(e){return dt(this,null,function*(){var t;if(e.method==="wallet_getSession"){const n=yield this.kvstore.get(Y1);if(n){const r=JSON.parse(n);return{id:e.id,jsonrpc:"2.0",result:(t=r.params)!=null?t:r.result,method:e.method}}}else if(e.method==="eth_accounts"){const n=yield this.kvstore.get(i5);if(n)return{id:e.id,jsonrpc:"2.0",result:JSON.parse(n),method:e.method}}else if(e.method==="eth_chainId"){const n=yield this.kvstore.get(a5);if(n)return{id:e.id,jsonrpc:"2.0",result:JSON.parse(n),method:e.method}}})}storeWalletSession(e,t){return dt(this,null,function*(){t.error||(w8e.includes(e.method)?yield this.kvstore.set(Y1,JSON.stringify(t)):e.method==="eth_accounts"?yield this.kvstore.set(i5,JSON.stringify(t.result)):e.method==="eth_chainId"?yield this.kvstore.set(a5,JSON.stringify(t.result)):E8e.includes(e.method)&&(yield this.kvstore.delete(Y1),yield this.kvstore.delete(i5),yield this.kvstore.delete(a5)))})}getCachedSession(){return dt(this,null,function*(){const e=yield this.getCachedResponse({jsonrpc:"2.0",id:"0",method:"wallet_getSession"});return e?.result})}request(e,t){return dt(this,null,function*(){const n=on({jsonrpc:"2.0",id:String(r5())},e),r=yield this.getCachedResponse(n);return r?(this.notifyCallbacks(r),r):(this.isConnected()||(yield this.attemptResumeSession()),new Promise((i,a)=>{var o;const s=setTimeout(()=>{this.rejectRequest(n.id,new $1)},(o=t?.timeout)!=null?o:this.options.requestTimeout);this.pendingRequests.set(n.id,{request:n,method:n.method,resolve:c=>dt(this,null,function*(){return yield this.storeWalletSession(n,c),i(c)}),reject:a,timeout:s}),this.dappClient.sendRequest({name:FZ,data:n}).catch(a)}))})}onNotification(e){return this.notificationCallbacks.add(e),()=>{this.notificationCallbacks.delete(e)}}getActiveSession(){return dt(this,null,function*(){const{kvstore:e}=this,{SessionStore:t}=yield Promise.resolve().then(()=>nt(Gg(),1)),n=yield t.create(e);try{const[r]=yield n.list();return r}catch(r){Aj("error getting active session",r);return}})}waitForWalletSessionIfNotCached(){return dt(this,null,function*(){if(yield this.kvstore.get(Y1))return;let e;const t=new Promise(r=>{e=this.onNotification(i=>{if(typeof i=="object"&&i!==null&&"data"in i){const a=i.data;(a.method==="wallet_getSession"||a.method==="wallet_sessionChanged")&&(e(),r())}})}),n=new Promise((r,i)=>{setTimeout(()=>{e(),this.removeStoredPendingSessionRequest(),i(new $1)},this.options.resumeTimeout)});return Promise.race([t,n])})}},u8=new WeakSet,S8e=function(e){return dt(this,null,function*(){var t,n,r,i,a,o,s;yield this.waitForWalletSessionIfNotCached();const c=yield this.request({method:"wallet_getSession"});if(c.error)throw new Error(c.error.message);let u=c.result;if(u&&e){const d=Object.keys((t=u?.sessionScopes)!=null?t:{}),p=(n=e?.scopes)!=null?n:[],f=(r=e?.caipAccountIds)!=null?r:[],m=N4e(d,p,u,f);if(e.forceRequest||!m){const v={optionalScopes:yj(gj((i=e?.scopes)!=null?i:[]),bj((a=e?.caipAccountIds)!=null?a:[]))},y=yield this.request({method:"wallet_createSession",params:v});if(y.error)throw new Error(y.error.message);u=y.result}}else if(!u){const d={optionalScopes:yj(gj((o=e?.scopes)!=null?o:[]),bj((s=e?.caipAccountIds)!=null?s:[]))},p=yield this.request({method:"wallet_createSession",params:d});if(p.error)throw new Error(p.error.message);u=p.result}yield this.removeStoredPendingSessionRequest(),this.notifyCallbacks({method:"wallet_sessionChanged",params:u})})},C8e=function(e,t){return dt(this,null,function*(){var n;const r=(yield this.getStoredPendingSessionRequest())!==null,i=Mv(),a=()=>dt(this,null,function*(){try{i.resolve(yield Lt(this,u8,S8e).call(this,t))}catch(u){i.reject(u)}});this.dappClient.state==="CONNECTED"?a():(this.dappClient.once("connected",a),this.dappClient.resume((n=e.id)!=null?n:"").catch(u=>i.reject(u)));const o=Mv(),s=setTimeout(()=>o.reject(new $1),r?this.options.resumeTimeout:t?this.options.connectionTimeout:120*1e3),c=()=>this.dappClient.off("connected",a);return Promise.race([i.promise,o.promise]).finally(()=>{clearTimeout(s),c()})})},A8e=function(e){return dt(this,null,function*(){var t,n;const{dappClient:r}=this,i=(yield this.getStoredPendingSessionRequest())!==null,a=Mv(),o={optionalScopes:yj(gj((t=e?.scopes)!=null?t:[]),bj((n=e?.caipAccountIds)!=null?n:[])),sessionProperties:e?.sessionProperties},s={jsonrpc:"2.0",id:String(r5()),method:"wallet_createSession",params:o};let c;const u=()=>{c&&(this.dappClient.off("message",c),c=void 0)};c=y=>dt(this,null,function*(){if(typeof y!="object"||y===null||!("data"in y))return;const E=y.data,I=E.id===s.id,w=E.method==="wallet_createSession"||E.method==="wallet_sessionChanged";if(!I&&!w)return;const j=this.getResponseError(E);if(j){a.reject(this.parseWalletError(j));return}yield this.storeWalletSession(s,E),yield this.removeStoredPendingSessionRequest(),this.notifyCallbacks(E),a.resolve()}),this.dappClient.on("message",c);const d=af(),p=["web-desktop","nodejs"].includes(d),f={name:FZ,data:s};r.connect({mode:"trusted",initialPayload:p?void 0:f}).then(()=>dt(this,null,function*(){if(p)return r.sendRequest(f)})).catch(y=>a.reject(y));const m=Mv(),v=setTimeout(()=>m.reject(new $1),i?this.options.resumeTimeout:this.options.connectionTimeout);return Promise.race([a.promise,m.promise]).finally(()=>{clearTimeout(v),u()})})}}}),HZ={},a8(HZ,{createKeyManager:()=>Ert}),x8e=gr({"src/multichain/transports/mwp/KeyManager.ts"(){"use strict"}}),I8e=gr({"src/ui/modals/base/utils.ts"(){"use strict"}}),j8e=gr({"src/ui/modals/base/AbstractInstallModal.ts"(){"use strict";I8e(),Zs(),l8=s8("metamask-sdk:ui"),k8e=class extends LZ{constructor(){super(...arguments),qr(this,o5,null),qr(this,d8,-1)}get link(){return this.data}set link(e){this.data=e}get connectionRequest(){return this.options.connectionRequest}set connectionRequest(e){this.options.connectionRequest=e}updateLink(e){this.link=e,this.instance&&(this.instance.link=e)}updateExpiresIn(e){e>=0&&this.instance&&(this.instance.expiresIn=e)}startExpirationCheck(e){this.stopExpirationCheck();let t=e;dr(this,o5,setInterval(()=>dt(this,null,function*(){const{sessionRequest:n}=t,r=Date.now(),i=n.expiresAt-r,a=Math.floor(i/1e3);if(i>0&&Crt(a)&&kt(this,d8)!==a){const o=Srt(i);l8(`[UI: InstallModal-nodejs()] QR code expires in: ${o} (${a}s)`),dr(this,d8,a)}if(r>=n.expiresAt){this.stopExpirationCheck(),l8("[UI: InstallModal-nodejs()] ⏰ QR code EXPIRED! Generating new one...");try{t=yield this.options.createConnectionRequest();const o=yield this.options.generateQRCode(t);dr(this,d8,-1),this.updateLink(o),this.updateExpiresIn(a),this.renderQRCode(o,t)}catch(o){l8(`[UI: InstallModal-nodejs()] ❌ Error generating new QR code: ${o}`)}}}),1e3))}stopExpirationCheck(){kt(this,o5)&&(clearInterval(kt(this,o5)),dr(this,o5,null),l8("[UI: InstallModal-nodejs()] 🛑 Stopped QR code expiration checking"))}},o5=new WeakMap,d8=new WeakMap}}),O8e=gr({"src/ui/modals/web/install.ts"(){"use strict";j8e(),P8e=class extends k8e{renderQRCode(){}mount(){var e;const{options:t}=this,n=document.createElement("mm-install-modal");n.showInstallModal=t.showInstallModal,n.addEventListener("close",r=>{const{detail:i}=r;t.onClose(i?.shouldTerminate)}),n.addEventListener("startDesktopOnboarding",t.startDesktopOnboarding),n.link=t.link,this.instance=n,(e=t.parentElement)==null||e.appendChild(n),this.startExpirationCheck(t.connectionRequest)}unmount(){var e;const{options:t,instance:n}=this;this.stopExpirationCheck(),n&&((e=t.parentElement)!=null&&e.contains(n))&&(t.parentElement.removeChild(n),this.instance=void 0)}}}}),R8e=gr({"src/ui/modals/base/AbstractOTPModal.ts"(){"use strict";Zs(),M8e=class extends LZ{get otpCode(){return this.data}set otpCode(e){this.data=e}updateOTPCode(e){this.otpCode=e,this.instance&&(this.instance.otpCode=e)}}}}),N8e=gr({"src/ui/modals/web/otp.ts"(){"use strict";R8e(),B8e=class extends M8e{mount(){}unmount(){}}}}),qZ={},a8(qZ,{InstallModal:()=>P8e,OTPCodeModal:()=>B8e}),L8e=gr({"src/ui/modals/web/index.ts"(){"use strict";O8e(),N8e()}}),GZ={},a8(GZ,{StoreAdapterWeb:()=>D8e}),U8e=gr({"src/store/adapters/web.ts"(){"use strict";Zs(),Tj=class mR extends s8e{constructor(t="-kv-store",n=mR.stores[0]){super(),this.storeName=n,this.platform="web";const r=`${mR.DB_NAME}${t}`;this.dbPromise=new Promise((i,a)=>{try{const o=this.internal.open(r,1);o.onerror=()=>a(new Error("Failed to open IndexedDB.")),o.onsuccess=()=>i(o.result),o.onupgradeneeded=()=>{const s=o.result;for(const c of mR.stores)s.objectStoreNames.contains(c)||s.createObjectStore(c)}}catch(o){a(o)}})}get internal(){if(typeof window>"u"||!window.indexedDB)throw new Error("indexedDB is not available in this environment");return window.indexedDB}get(t){return dt(this,null,function*(){const{storeName:n}=this,r=yield this.dbPromise;return new Promise((i,a)=>{try{const o=r.transaction(n,"readonly").objectStore(n).get(t);o.onerror=()=>a(new Error("Failed to get value from IndexedDB.")),o.onsuccess=()=>{var s;return i((s=o.result)!=null?s:null)}}catch(o){a(o)}})})}set(t,n){return dt(this,null,function*(){const{storeName:r}=this,i=yield this.dbPromise;return new Promise((a,o)=>{try{const s=i.transaction(r,"readwrite").objectStore(r).put(n,t);s.onerror=()=>o(new Error("Failed to set value in IndexedDB.")),s.onsuccess=()=>a()}catch(s){o(s)}})})}delete(t){return dt(this,null,function*(){const{storeName:n}=this,r=yield this.dbPromise;return new Promise((i,a)=>{try{const o=r.transaction(n,"readwrite").objectStore(n).delete(t);o.onerror=()=>a(new Error("Failed to delete value from IndexedDB.")),o.onsuccess=()=>i()}catch(o){a(o)}})})}},Tj.stores=["sdk-kv-store","key-value-pairs"],Tj.DB_NAME="mmconnect",D8e=Tj}}),O0(),F8e=R4e(),F8e.Buffer??=F4e.Buffer,Zs(),z8e="wss://mm-sdk-relay.api.cx.metamask.io/connection/websocket",f8="https://metamask.app.link/connect",xj="metamask://connect",Zs(),wj(),PZ(),_j(),BZ(),Zs(),VZ=1,WZ=class extends Error{},$8e=class{constructor(e,t){this.config=e,this.sdkInfo=t}request(e){return dt(this,null,function*(){const{request:t}=e,n=JSON.stringify({jsonrpc:"2.0",method:t.method,params:t.params,id:Art()}),r=this.getRpcEndpoint(e.scope),i=yield this.fetchWithTimeout(r,n,"POST",this.getHeaders(r),3e4);return yield this.parseResponse(i)})}getRpcEndpoint(e){var t,n,r;const i=((r=(n=(t=this.config)==null?void 0:t.api)==null?void 0:n.supportedNetworks)!=null?r:{})[e];if(!i)throw new WZ(`No RPC endpoint found for scope ${e}`);return i}fetchWithTimeout(e,t,n,r,i){return dt(this,null,function*(){const a=new AbortController,o=setTimeout(()=>a.abort(),i);try{const s=yield(0,z4e.default)(e,{method:n,headers:r,body:t,signal:a.signal});if(clearTimeout(o),!s.ok)throw new CZ(e,n,s.status);return s}catch(s){throw clearTimeout(o),s instanceof CZ?s:s instanceof Error&&s.name==="AbortError"?new xZ(`Request timeout after ${i}ms`):new xZ(s.message)}})}parseResponse(e){return dt(this,null,function*(){try{return(yield e.json()).result}catch(t){throw new W4e(t.message)}})}getHeaders(e){const t={Accept:"application/json","Content-Type":"application/json"};return e.includes("infura")?qi(on({},t),{"Metamask-Sdk-Info":this.sdkInfo}):t}},Zs(),O0(),wj(),Zs(),H8e=5,Y8e=class{constructor(e,t,n,r){this.transport=e,this.rpcClient=t,this.config=n,this.transportType=r,qr(this,Q1)}invokeMethod(e){return dt(this,null,function*(){const{method:t}=e.request;return J4e.has(t)?this.handleWithEip1193Passthrough(e):Q4e.has(t)?this.handleWithRpcNode(e):X4e.has(t)?this.handleWithSdkState(e):this.handleWithWallet(e)})}handleWithEip1193Passthrough(e){return dt(this,null,function*(){return(yield this.transport.sendEip1193Message({method:e.request.method,params:e.request.params})).result})}handleWithWallet(e){return dt(this,null,function*(){return Lt(this,Q1,G8e).call(this,e,()=>dt(this,null,function*(){const t=this.transport.request({method:"wallet_invokeMethod",params:e}),{ui:n,mobile:r}=this.config,{showInstallModal:i=!1}=n??{};pj()&&!i&&setTimeout(()=>dt(this,null,function*(){const o=yield this.transport.getActiveSession();if(!o)throw new Error("No active session found");const s=`${xj}/mwp?id=${encodeURIComponent(o.id)}`;r?.preferredOpenLink?r.preferredOpenLink(s,"_self"):mj(this.config,s,f8)}),10);const a=yield t;if(a.error)throw gZ(a.error);return a.result}))})}handleWithRpcNode(e){return dt(this,null,function*(){try{return yield this.rpcClient.request(e)}catch(t){if(t instanceof WZ)return this.handleWithWallet(e);throw t}})}handleWithSdkState(e){return dt(this,null,function*(){if(e.request.method==="wallet_getCapabilities"){if(this.transportType==="mwp"){const t=yield Lt(this,Q1,q8e).call(this,e);if(t!==void 0)return t}return this.handleWithWallet(e)}return console.warn(`Method "${e.request.method}" is configured for SDK state handling, but this is not yet implemented. Falling back to wallet passthrough.`),this.handleWithWallet(e)})}},Q1=new WeakSet,q8e=function(e){return dt(this,null,function*(){var t,n;const{params:r}=e.request;if(!Array.isArray(r))return;const[i,a]=r;if(typeof i!="string"||i.length===0||a!==void 0&&(!Array.isArray(a)||a.some(p=>typeof p!="string")))return;const o=a;if(!this.transport.getCachedSession)return;let s;try{s=yield this.transport.getCachedSession()}catch{return}const c=(t=s?.sessionProperties)==null?void 0:t[t8e];if(!c)return;const u=(n=Object.entries(c).find(([p])=>p.toLowerCase()===i.toLowerCase()))==null?void 0:n[1];if(!u)return;if(!o||o.length===0)return u;const d={};for(const p of o){const f=Object.entries(u).find(([m])=>m.toLowerCase()===p.toLowerCase());f&&(d[f[0]]=f[1])}return d})},G8e=function(e,t){return dt(this,null,function*(){var n;if(((n=this.config.analytics)==null?void 0:n.enabled)===!1)try{return yield t()}catch(r){throw gZ(r)}yield Lt(this,Q1,V8e).call(this,e);try{const r=yield t();return yield Lt(this,Q1,W8e).call(this,e),r}catch(r){const i=gZ(r),a=i.rpcCode===void 0?r:i;throw dZ(a)?yield Lt(this,Q1,K8e).call(this,e):yield Lt(this,Q1,Z8e).call(this,e,a),i}})},V8e=function(e){return dt(this,null,function*(){const t=yield Wg(this.config,this.config.storage,e,this.transportType);ta.track("mmconnect_wallet_action_requested",t)})},W8e=function(e){return dt(this,null,function*(){const t=yield Wg(this.config,this.config.storage,e,this.transportType);ta.track("mmconnect_wallet_action_succeeded",t)})},Z8e=function(e,t){return dt(this,null,function*(){const n=yield Wg(this.config,this.config.storage,e,this.transportType,M4e(t));ta.track("mmconnect_wallet_action_failed",n)})},K8e=function(e){return dt(this,null,function*(){const t=yield Wg(this.config,this.config.storage,e,this.transportType);ta.track("mmconnect_wallet_action_rejected",t)})},O0(),Q8e=60*1e3,XZ=class{constructor(){qr(this,ys),qr(this,h8,new Set),qr(this,Zg,Het()),qr(this,X1,{timeout:Q8e}),qr(this,s5,new Map),qr(this,p8),qr(this,Ij)}sendEip1193Message(e,t){return dt(this,null,function*(){Lt(this,ys,YZ).call(this);const n=String(r5()),r=on({jsonrpc:"2.0",id:n},e);return new Promise((i,a)=>{var o;const s=setTimeout(()=>{kt(this,s5).delete(n),a(new Error("Request timeout"))},(o=t?.timeout)!=null?o:kt(this,X1).timeout);kt(this,s5).set(n,{resolve:c=>{i(c)},reject:a,timeout:s}),window.postMessage({target:"metamask-contentscript",data:{name:"metamask-provider",data:r}},location.origin)})})}init(){return dt(this,null,function*(){yield Lt(this,ys,QZ).call(this);let e={sessionScopes:{}};try{e=(yield this.request({method:"wallet_getSession"},kt(this,X1))).result}catch{console.error("Failed to get wallet session during DefaultTransport init")}Lt(this,ys,kj).call(this,{method:"wallet_sessionChanged",params:e})})}connect(e){return dt(this,null,function*(){var t,n,r,i,a;yield Lt(this,ys,QZ).call(this);const o=yield this.request({method:"wallet_getSession"},kt(this,X1));if(o.error)throw new Error(o.error.message);let s=o.result;const c={optionalScopes:yj(gj((t=e?.scopes)!=null?t:[]),bj((n=e?.caipAccountIds)!=null?n:[])),sessionProperties:e?.sessionProperties};if(s&&e&&!e.forceRequest){const u=Object.keys((r=s?.sessionScopes)!=null?r:{}),d=(i=e?.scopes)!=null?i:[],p=(a=e?.caipAccountIds)!=null?a:[];if(!N4e(u,d,s,p)){const f=yield this.request({method:"wallet_createSession",params:c},kt(this,X1));if(f.error)throw new Error(f.error.message);s=f.result}}else if(!s||e?.forceRequest){const u=yield this.request({method:"wallet_createSession",params:c},kt(this,X1));if(u.error)throw new Error(u.error.message);s=u.result}Lt(this,ys,kj).call(this,{method:"wallet_sessionChanged",params:s})})}disconnect(){return dt(this,arguments,function*(e=[]){yield this.request({method:"wallet_revokeSession",params:{scopes:e}})})}isConnected(){return kt(this,Zg).isConnected()}request(e){return dt(this,arguments,function*(t,n=kt(this,X1)){const r=yield kt(this,Zg).request(t,n);if(r.error)throw Lt(this,ys,ZZ).call(this,r.error);return r})}onNotification(e){return kt(this,Zg).onNotification(e),kt(this,h8).add(e),()=>{kt(this,h8).delete(e)}}getActiveSession(){return dt(this,null,function*(){throw new Error("getActiveSession is purposely not implemented for the DefaultTransport")})}getStoredPendingSessionRequest(){return dt(this,null,function*(){throw new Error("getStoredPendingSessionRequest is purposely not implemented for the DefaultTransport")})}},h8=new WeakMap,Zg=new WeakMap,X1=new WeakMap,s5=new WeakMap,p8=new WeakMap,Ij=new WeakMap,ys=new WeakSet,kj=function(e){for(const t of kt(this,h8))try{t(e)}catch(n){console.log("[WindowPostMessageTransport] notifyCallbacks error:",n)}},ZZ=function(e){const t=e,n=new Error(typeof t.message=="string"?t.message:"Request failed");typeof t.code=="number"&&(n.code=t.code);const{data:r}=t;return kv(r)&&(n.data=r),n},KZ=function(e){var t,n;return((n=(t=e?.data)==null?void 0:t.data)==null?void 0:n.name)==="metamask-provider"&&e.origin===location.origin},X8e=function(e){var t,n;if(!Lt(this,ys,KZ).call(this,e))return;const r=(n=(t=e?.data)==null?void 0:t.data)==null?void 0:n.data;if(!(typeof r=="object"&&r!==null&&"method"in r)&&typeof r=="object"&&r!==null&&"id"in r&&("result"in r||"error"in r)){const i=String(r.id),a=kt(this,s5).get(i);if(a){clearTimeout(a.timeout),kt(this,s5).delete(i);const o=r;"error"in o&&o.error?a.reject(Lt(this,ys,ZZ).call(this,o.error)):a.resolve(o)}}},J8e=function(e){var t,n;if(!Lt(this,ys,KZ).call(this,e))return;const r=(n=(t=e?.data)==null?void 0:t.data)==null?void 0:n.data;typeof r=="object"&&r!==null&&"method"in r&&Lt(this,ys,kj).call(this,r)},YZ=function(){kt(this,p8)||(dr(this,p8,Lt(this,ys,X8e).bind(this)),dr(this,Ij,Lt(this,ys,J8e).bind(this)),window.addEventListener("message",kt(this,p8)),window.addEventListener("message",kt(this,Ij)))},QZ=function(){return dt(this,null,function*(){Lt(this,ys,YZ).call(this),kt(this,Zg).isConnected()||(yield kt(this,Zg).connect())})},O0(),i9e=class{constructor(e,t){this.metamaskConnectMultichain=e,qr(this,u5),qr(this,c5,new Set),qr(this,J1),dr(this,J1,t)}isTransportDefined(){return kt(this,J1).call(this)!==void 0}isTransportConnected(){var e,t;return(t=(e=kt(this,J1).call(this))==null?void 0:e.isConnected())!=null?t:!1}clearNotificationCallbacks(){kt(this,c5).clear()}notifyCallbacks(e){kt(this,c5).forEach(t=>{t(e)})}clearTransportNotificationListener(){var e;(e=this.notificationListener)==null||e.call(this),this.notificationListener=void 0}setupTransportNotificationListener(){const e=kt(this,J1).call(this);!e||this.notificationListener||(this.notificationListener=e.onNotification(this.notifyCallbacks.bind(this)))}connect(){return dt(this,null,function*(){return Promise.resolve()})}disconnect(){return dt(this,null,function*(){return Promise.resolve()})}isConnected(){return!0}request(e){return dt(this,arguments,function*(t,n={}){const r=on({id:r5(),jsonrpc:"2.0"},t);switch(r.method){case"wallet_createSession":return Lt(this,u5,e9e).call(this,r);case"wallet_getSession":return Lt(this,u5,t9e).call(this,r);case"wallet_revokeSession":return Lt(this,u5,n9e).call(this,r);case"wallet_invokeMethod":return Lt(this,u5,r9e).call(this,r);default:throw new Error(`Unsupported method: ${r.method}`)}})}onNotification(e){return this.setupTransportNotificationListener(),kt(this,c5).add(e),()=>{kt(this,c5).delete(e)}}},c5=new WeakMap,J1=new WeakMap,u5=new WeakSet,e9e=function(e){return dt(this,null,function*(){const t=e.params,n=Object.keys(on(on({},t.optionalScopes),t.requiredScopes)),r=[];n.forEach(o=>{var s,c,u,d;const p=(s=t.requiredScopes)==null?void 0:s[o],f=(c=t.optionalScopes)==null?void 0:c[o];p&&r.push(...(u=p.accounts)!=null?u:[]),f&&r.push(...(d=f.accounts)!=null?d:[])});const i=[...new Set(r)];yield this.metamaskConnectMultichain.connect(n,i,t.sessionProperties);const a=kt(this,J1).call(this);if(!a)throw new Error("Transport not initialized after connect");return a.request({method:"wallet_getSession"})})},t9e=function(e){return dt(this,null,function*(){const t=kt(this,J1).call(this);return t?.isConnected()?t.request({method:"wallet_getSession"}):{jsonrpc:"2.0",id:e.id,result:{sessionScopes:{}}}})},n9e=function(e){return dt(this,null,function*(){var t;const n=e.params,r=(t=n?.scopes)!=null?t:[];try{return yield this.metamaskConnectMultichain.disconnect(r),{jsonrpc:"2.0",id:e.id,result:!0}}catch{return{jsonrpc:"2.0",id:e.id,result:!1}}})},r9e=function(e){return dt(this,null,function*(){return this.isTransportConnected()?{result:this.metamaskConnectMultichain.invokeMethod(e.params)}:{error:Uk.unauthorized()}})},O0(),m8=s8("metamask-sdk:core"),jj="__METAMASK_CONNECT_MULTICHAIN_SINGLETON__",b9e=class QJ extends r8e{constructor(t){var n,r,i,a;const o=wrt(t),s=qi(on({},o),{ui:qi(on({},o.ui),{preferExtension:(n=o.ui.preferExtension)!=null?n:!0,showInstallModal:(r=o.ui.showInstallModal)!=null?r:!1,headless:(i=o.ui.headless)!=null?i:!1}),analytics:Prt(t.analytics),versions:on({"connect-multichain":n5()},(a=t.versions)!=null?a:{})});super(s),qr(this,xn),qr(this,Pj),qr(this,M0),qr(this,ba),qr(this,Kg),qr(this,l5),qr(this,vs),this._status="pending",qr(this,ep),qr(this,g8),qr(this,JZ,`Sdk/Javascript SdkVersion/${n5()} Platform/${af()} dApp/${(a9e=this.options.dapp.url)!=null?a9e:this.options.dapp.name} dAppTitle/${this.options.dapp.name}`),dr(this,M0,new i9e(this,()=>kt(this,ba))),dr(this,Pj,N_e({transport:kt(this,M0)}))}get status(){return this._status}set status(t){this._status!==t&&(this._status=t,this.emit("stateChanged",t))}get provider(){return kt(this,Pj)}get dappClient(){if(!kt(this,Kg))throw new Error("DappClient not initialized, establish connection first");return kt(this,Kg)}get transportType(){var t;return(t=kt(this,vs))!=null?t:"unknown"}get storage(){return this.options.storage}get version(){return n5()}static create(t){return dt(this,null,function*(){var n;const r=R4e(),i=r[jj];if(i){const o=yield i;return o.version!==n5()&&console.warn(`MetaMask Connect does not support using multiple versions of @metamask/connect-multichain. Attempted to create a new instance with version ${n5()}, but an existing ${o.version} singleton was already initialized. Using the existing ${o.version} singleton. This is NOT supported and may lead to unexpected behavior. Please ensure there is only one version of @metamask/connect-multichain package resolved in your application.`),o.mergeOptions(t),o instanceof QJ?yield Lt(n=o,xn,eK).call(n):yield D4e(o.options,o.storage),t.debug&&c8("metamask-sdk:*"),o}const a=dt(null,null,function*(){var o;const s=new QJ(t);return(yield Y4e("metamask-sdk:core",s.options.storage))&&c8("metamask-sdk:core"),yield Lt(o=s,xn,c9e).call(o),s}).catch(o=>{throw r[jj]=void 0,console.error("Error initializing MetaMaskConnectMultichain",o),o});return r[jj]=a,a})}connect(t,n,r,i){return dt(this,null,function*(){var a;if(this.status==="connecting"&&kt(this,vs)==="mwp")throw yield Lt(this,xn,g9e).call(this),new Error("Existing connection is pending. Please check your MetaMask Mobile app to continue.");const{ui:o}=this.options,s=af(),c=s==="in-app-browser"||s==="web-desktop",{preferExtension:u=!0,showInstallModal:d=!1}=o,p=pj(),f=yield uZ();let m;if(s==="in-app-browser"||c&&f&&u?m="browser":m="mwp",i8(this.options))try{const j=yield fZ(this.options,this.storage),_=Object.keys(this.options.api.supportedNetworks);ta.track("mmconnect_connection_initiated",qi(on({},j),{transport_type:m,dapp_configured_chains:_,dapp_requested_chains:t}))}catch(j){m8("Error tracking connection_initiated event",j)}const{mergedScopes:v,mergedCaipAccountIds:y,mergedSessionProperties:E}=vrt(yield Lt(this,xn,nK).call(this),t,n,r),I=Object.keys(E??{}).length>0?E:void 0;if((a=kt(this,ba))!=null&&a.isConnected()&&!p)return Lt(this,xn,d5).call(this,kt(this,ba).connect({scopes:v,caipAccountIds:y,sessionProperties:I,forceRequest:i}).then(()=>dt(this,null,function*(){return kt(this,vs)==="mwp"?this.storage.setTransportType("mwp"):this.storage.setTransportType("browser")})),t,m);if(s==="in-app-browser"){const j=yield Lt(this,xn,Oj).call(this);return Lt(this,xn,d5).call(this,j.connect({scopes:v,caipAccountIds:y,sessionProperties:I,forceRequest:i}),t,m)}if(c&&f&&u){const j=yield Lt(this,xn,Oj).call(this);return Lt(this,xn,d5).call(this,j.connect({scopes:v,caipAccountIds:y,sessionProperties:I,forceRequest:i}),t,m)}yield Lt(this,xn,u9e).call(this);const w=f?d:!u||d;return p&&!w?Lt(this,xn,d5).call(this,Lt(this,xn,m9e).call(this,v,y,I),t,m):Lt(this,xn,d5).call(this,Lt(this,xn,h9e).call(this,w,v,y,I),t,m)})}disconnect(){return dt(this,arguments,function*(t=[]){var n,r,i;const a=yield Lt(this,xn,nK).call(this),o=t.length===0?[]:Object.keys(a.sessionScopes).filter(s=>!t.includes(s));yield(n=kt(this,ba))==null?void 0:n.disconnect(t),o.length===0&&(yield this.storage.removeTransportType(),kt(this,vs)!=="browser"&&(yield(r=kt(this,ep))==null?void 0:r.call(this),(i=kt(this,l5))==null||i.call(this),dr(this,ep,void 0),dr(this,l5,void 0),dr(this,ba,void 0),dr(this,vs,void 0),kt(this,M0).clearTransportNotificationListener(),dr(this,Kg,void 0)),this.status="disconnected")})}invokeMethod(t){return dt(this,null,function*(){var n;const r=Lt(this,xn,tp).call(this),{options:i}=this;return new Y8e(r,new $8e(i,kt(this,JZ)),i,(n=kt(this,vs))!=null?n:"unknown").invokeMethod(t)})}openSimpleDeeplinkIfNeeded(){const{ui:t,mobile:n}=this.options,{showInstallModal:r=!1}=t??{};pj()&&!r&&setTimeout(()=>dt(this,null,function*(){const i=yield Lt(this,xn,tp).call(this).getActiveSession();if(!i)throw new Error("No active session found");const a=`${xj}/mwp?id=${encodeURIComponent(i.id)}`;n?.preferredOpenLink?n.preferredOpenLink(a,"_self"):mj(this.options,a,f8)}),10)}emitSessionChanged(){return dt(this,null,function*(){var t,n;const r={sessionScopes:{}};if(!((t=kt(this,ba))!=null&&t.isConnected())){this.emit("wallet_sessionChanged",r);return}const i=yield kt(this,ba).request({method:"wallet_getSession"});this.emit("wallet_sessionChanged",(n=i.result)!=null?n:r)})}},Pj=new WeakMap,M0=new WeakMap,ba=new WeakMap,Kg=new WeakMap,l5=new WeakMap,vs=new WeakMap,ep=new WeakMap,g8=new WeakMap,xn=new WeakSet,tp=function(){if(!kt(this,ba))throw new Error("Transport not initialized, establish connection first");return kt(this,ba)},JZ=new WeakMap,eK=function(){return dt(this,null,function*(){yield D4e(this.options,this.storage,e=>{dr(this,g8,e)})})},b8=function(e){return dt(this,null,function*(){var t,n,r;if(typeof e=="object"&&e!==null&&"method"in e){if(e.method==="wallet_sessionChanged"){const i=(n=(t=e.params)==null?void 0:t.sessionScopes)!=null?n:{},a=Object.keys(i).length>0;if(this.status==="loaded"&&!a)return;this.status=a?"connected":"disconnected"}this.emit(e.method,(r=e.params)!=null?r:e.result)}})},o9e=function(){return dt(this,null,function*(){const e=yield this.storage.getTransportType(),t=yield uZ();if(e){if(e==="browser"){if(t){const n=new XZ;return dr(this,ba,n),dr(this,vs,"browser"),kt(this,M0).setupTransportNotificationListener(),dr(this,ep,n.onNotification(Lt(this,xn,b8).bind(this))),n}}else if(e==="mwp"){const{adapter:n}=this.options.storage,r=yield Lt(this,xn,tK).call(this),{MWPTransport:i}=yield Promise.resolve().then(()=>($Z(),Sj)),a=new i(r,n);return dr(this,Kg,r),dr(this,ba,a),dr(this,vs,"mwp"),kt(this,M0).setupTransportNotificationListener(),dr(this,ep,a.onNotification(Lt(this,xn,b8).bind(this))),a}yield this.storage.removeTransportType()}})},s9e=function(){return dt(this,null,function*(){var e;const t=yield Lt(this,xn,o9e).call(this);if(t)t.isConnected()||(this.status="connecting",yield t.connect()),this.status="connected",kt(this,vs)==="mwp"?yield this.storage.setTransportType("mwp"):yield this.storage.setTransportType("browser");else{this.status="loaded";const n=yield uZ(),r=(e=this.options.ui.preferExtension)!=null?e:!0;if(n&&r){yield Lt(this,xn,Oj).call(this,{persist:!1});try{yield Lt(this,xn,tp).call(this).init()}catch(i){console.error("Passive init failed:",i)}}}})},y8=function(){const e={dapp:this.options.dapp,sdk:{version:n5(),platform:af()}};return i8(this.options)&&kt(this,g8)&&(e.analytics={remote_session_id:kt(this,g8)}),e},c9e=function(){return dt(this,null,function*(){try{yield Lt(this,xn,eK).call(this),yield Lt(this,xn,s9e).call(this)}catch(e){yield this.storage.removeTransportType(),this.status="pending",m8("MetaMaskSDK error during initialization",e)}})},tK=function(){return dt(this,null,function*(){const[e,{DappClient:t},{createKeyManager:n}]=yield Promise.all([Promise.resolve().then(()=>nt(Gg(),1)),Promise.resolve().then(()=>(trt(),ert)),Promise.resolve().then(()=>(x8e(),HZ))]),r=yield n(),{adapter:i}=this.options.storage,a=yield e.SessionStore.create(i),o=typeof window<"u"?WebSocket:(yield Promise.resolve().then(()=>nt(nrt(),1))).WebSocket;return new t({transport:yield e.WebSocketTransport.create({url:z8e,kvstore:i,websocket:o}),sessionstore:a,keymanager:r})})},u9e=function(){return dt(this,null,function*(){if(kt(this,vs)==="mwp")return;const{adapter:e}=this.options.storage,t=yield Lt(this,xn,tK).call(this);dr(this,Kg,t);const{MWPTransport:n}=yield Promise.resolve().then(()=>($Z(),Sj)),r=new n(t,e);dr(this,ba,r),dr(this,vs,"mwp"),kt(this,M0).setupTransportNotificationListener(),dr(this,ep,r.onNotification(Lt(this,xn,b8).bind(this))),yield this.storage.setTransportType("mwp")})},l9e=function(){return dt(this,null,function*(){var e;(e=this.options.ui.factory.modal)!=null&&e.isMounted&&(yield this.storage.removeTransportType())})},d9e=function(){const e=Lt(this,xn,l9e).bind(this);return typeof window<"u"&&typeof window.addEventListener<"u"&&window.addEventListener("beforeunload",e),()=>{typeof window<"u"&&typeof window.removeEventListener<"u"&&window.removeEventListener("beforeunload",e)}},f9e=function(e,t,n,r){return dt(this,null,function*(){const i=Mv(),a=()=>dt(this,null,function*(){(this.dappClient.state==="CONNECTED"||this.dappClient.state==="CONNECTING")&&(yield this.dappClient.disconnect());const o=Mv();return this.dappClient.on("session_request",s=>{o.resolve({sessionRequest:s,metadata:Lt(this,xn,y8).call(this)})}),Lt(this,xn,tp).call(this).connect({scopes:t,caipAccountIds:n,sessionProperties:r}).then(()=>dt(this,null,function*(){var s;yield this.options.ui.factory.unload(),(s=this.options.ui.factory.modal)==null||s.unmount(),this.status="connected",yield this.storage.setTransportType("mwp")})).catch(s=>dt(this,null,function*(){const{ProtocolError:c,ErrorCode:u}=yield Promise.resolve().then(()=>nt(Gg(),1));if(s instanceof c)s.code!==u.REQUEST_EXPIRED&&(this.status="disconnected",yield this.options.ui.factory.unload(s),i.reject(s));else{this.status="disconnected";const d=s instanceof Error?s:new Error(String(s));yield this.options.ui.factory.unload(d),i.reject(d)}})),o.promise});return this.options.ui.factory.renderInstallModal(e,a,o=>dt(this,null,function*(){o?(yield this.storage.removeTransportType(),i.reject(o)):(yield this.storage.setTransportType("mwp"),i.resolve())}),o=>{this.emit("display_uri",o)}).catch(o=>{i.reject(o instanceof Error?o:new Error(String(o)))}),i.promise})},h9e=function(e,t,n,r){return dt(this,null,function*(){kt(this,l5)??dr(this,l5,Lt(this,xn,d9e).call(this)),this.options.ui.headless?yield Lt(this,xn,p9e).call(this,t,n,r):yield Lt(this,xn,f9e).call(this,e,t,n,r)})},p9e=function(e,t,n){return dt(this,null,function*(){(this.dappClient.state==="CONNECTED"||this.dappClient.state==="CONNECTING")&&(yield this.dappClient.disconnect().catch(()=>{}));const r=i=>{const a={sessionRequest:i,metadata:Lt(this,xn,y8).call(this)},o=this.options.ui.factory.createConnectionDeeplink(a);this.emit("display_uri",o)};this.dappClient.on("session_request",r);try{yield Lt(this,xn,tp).call(this).connect({scopes:e,caipAccountIds:t,sessionProperties:n}),this.status="connected",yield this.storage.setTransportType("mwp")}catch(i){const{ProtocolError:a}=yield Promise.resolve().then(()=>nt(Gg(),1));throw this.status="disconnected",yield this.storage.removeTransportType(),i instanceof a||i instanceof Error?i:new Error(String(i))}finally{this.dappClient.off("session_request",r)}})},Oj=function(){return dt(this,arguments,function*(e={persist:!0}){if(kt(this,vs)==="browser")return kt(this,ba);e?.persist&&(yield this.storage.setTransportType("browser"));const t=new XZ;return dr(this,ep,t.onNotification(Lt(this,xn,b8).bind(this))),dr(this,ba,t),dr(this,vs,"browser"),kt(this,M0).setupTransportNotificationListener(),t})},m9e=function(e,t,n){return dt(this,null,function*(){return new Promise((r,i)=>dt(this,null,function*(){const a=s=>{var c;if(typeof s!="object"||s===null||!("data"in s))return;const u=s.data;typeof u=="object"&&u!==null&&(u.error&&(this.dappClient.off("message",a),i(u.error)),(c=u?.result)!=null&&c.sessionScopes&&this.dappClient.off("message",a))};this.dappClient.on("message",a);let o;return Lt(this,xn,tp).call(this).isConnected()?o=setTimeout(()=>{this.openSimpleDeeplinkIfNeeded()},250):this.dappClient.once("session_request",s=>{var c;const u={sessionRequest:s,metadata:Lt(this,xn,y8).call(this)},d=this.options.ui.factory.createConnectionDeeplink(u),p=this.options.ui.factory.createConnectionUniversalLink(u);this.emit("display_uri",d),(c=this.options.mobile)!=null&&c.preferredOpenLink?this.options.mobile.preferredOpenLink(d,"_self"):mj(this.options,d,p)}),Lt(this,xn,tp).call(this).connect({scopes:e,caipAccountIds:t,sessionProperties:n}).then(r).catch(s=>dt(this,null,function*(){yield this.storage.removeTransportType(),this.dappClient.off("message",a),i(s instanceof Error?s:new Error(String(s)))})).finally(()=>{o&&clearTimeout(o)})}))})},d5=function(e,t,n){return dt(this,null,function*(){return this.status="connecting",e.then(()=>dt(this,null,function*(){if(this.status="connected",i8(this.options))try{const r=yield fZ(this.options,this.storage);ta.track("mmconnect_connection_established",qi(on({},r),{transport_type:n,user_permissioned_chains:t}))}catch(r){m8("Error tracking connection_established event",r)}})).catch(r=>dt(this,null,function*(){if(this.status="disconnected",i8(this.options))try{const i=yield fZ(this.options,this.storage);dZ(r)?ta.track("mmconnect_connection_rejected",qi(on({},i),{transport_type:n})):ta.track("mmconnect_connection_failed",on(qi(on({},i),{transport_type:n}),M4e(r)))}catch{m8("Error tracking connection failed/rejected event",r)}throw r}))})},nK=function(){return dt(this,null,function*(){var e;let t={sessionScopes:{},sessionProperties:{}};if((e=kt(this,ba))!=null&&e.isConnected())try{const n=yield kt(this,ba).request({method:"wallet_getSession"});n.result&&(t=n.result)}catch{}return t})},g9e=function(){return dt(this,null,function*(){var e,t;const{ui:n}=this.options,{showInstallModal:r=!1}=n??{};if(!(pj()&&!r))return;const i=yield(e=kt(this,ba))==null?void 0:e.getStoredPendingSessionRequest();if(!i)return;const a={sessionRequest:i,metadata:Lt(this,xn,y8).call(this)},o=this.options.ui.factory.createConnectionDeeplink(a),s=this.options.ui.factory.createConnectionUniversalLink(a);(t=this.options.mobile)!=null&&t.preferredOpenLink?this.options.mobile.preferredOpenLink(o,"_self"):mj(this.options,o,s)})},y9e=b9e,EZ(),rK=class XJ extends Z1{constructor(t,n,r){super(`StorageErr${XJ.code}: ${t} storage get error in key: ${n} - ${r}`,XJ.code),this.platform=t,this.key=n,this.reason=r}},rK.code=60,v8=rK,iK=class JJ extends Z1{constructor(t,n,r){super(`StorageErr${JJ.code}: ${t} storage set error in key: ${n} - ${r}`,JJ.code),this.platform=t,this.key=n,this.reason=r}},iK.code=61,Mj=iK,aK=class eee extends Z1{constructor(t,n,r){super(`StorageErr${eee.code}: ${t} storage delete error in key: ${n} - ${r}`,eee.code),this.platform=t,this.key=n,this.reason=r}},aK.code=62,Rj=aK,_j(),NZ(),v9e=class extends u8e{constructor(e){super(),this.adapter=e}getTransportType(){return dt(this,null,function*(){try{const e=yield this.adapter.get("multichain-transport");return e?frt(e):null}catch(e){throw new v8(this.adapter.platform,"multichain-transport",e.message)}})}setTransportType(e){return dt(this,null,function*(){try{yield this.adapter.set("multichain-transport",e)}catch(t){throw new Mj(this.adapter.platform,"multichain-transport",t.message)}})}removeTransportType(){return dt(this,null,function*(){try{yield this.adapter.delete("multichain-transport")}catch(e){throw new Rj(this.adapter.platform,"multichain-transport",e.message)}})}getAnonId(){return dt(this,null,function*(){try{const e=yield this.adapter.get("anonId");if(e)return e;const t=f3e();return yield this.adapter.set("anonId",t),t}catch(e){throw new v8(this.adapter.platform,"anonId",e.message)}})}getExtensionId(){return dt(this,null,function*(){try{return yield this.adapter.get("extensionId")}catch(e){throw new v8(this.adapter.platform,"extensionId",e.message)}})}setAnonId(e){return dt(this,null,function*(){try{return yield this.adapter.set("anonId",e)}catch(t){throw new Mj(this.adapter.platform,"anonId",t.message)}})}setExtensionId(e){return dt(this,null,function*(){try{return yield this.adapter.set("extensionId",e)}catch(t){throw new Mj(this.adapter.platform,"extensionId",t.message)}})}removeExtensionId(){return dt(this,null,function*(){try{return yield this.adapter.delete("extensionId")}catch(e){throw new Rj(this.adapter.platform,"extensionId",e.message)}})}removeAnonId(){return dt(this,null,function*(){try{return yield this.adapter.delete("anonId")}catch(e){throw new Rj(this.adapter.platform,"anonId",e.message)}})}getDebug(){return dt(this,null,function*(){try{return yield this.adapter.get("DEBUG")}catch(e){throw new v8(this.adapter.platform,"DEBUG",e.message)}})}},Zs(),O0(),_9e=class{constructor(e){this.options=e,this.platform=af(),this.validateModals()}validateModals(){const e=["InstallModal","OTPCodeModal"].filter(t=>!this.options[t]);if(e.length>0)throw new Error(`Missing required modals: ${e.join(", ")}`)}unload(e){return dt(this,null,function*(){var t,n;(t=this.modal)==null||t.unmount(),yield(n=this.successCallback)==null?void 0:n.call(this,e)})}get isMobile(){return this.platform==="react-native"}get isNode(){return this.platform==="nodejs"}get isWeb(){return this.platform==="web-desktop"||this.platform==="in-app-browser"||this.platform==="web-mobile"}getContainer(){return typeof document>"u"?void 0:document.createElement("div")}getMountedContainer(){if(typeof document>"u")return;const e=this.getContainer();return e&&document.body.appendChild(e),e}createConnectionDeeplink(e){if(!e)throw new Error("createConnectionDeeplink can only be called with a connection request");const t=B4e(JSON.stringify(e));return`${xj}/mwp?p=${encodeURIComponent(t)}&c=1`}createConnectionUniversalLink(e){if(!e)return`${f8}`;const t=B4e(JSON.stringify(e));return`${f8}/mwp?p=${encodeURIComponent(t)}&c=1`}onCloseModal(e=!0){return dt(this,null,function*(){return this.unload(e?Uk.userRejectedRequest():void 0)})}onStartDesktopOnboarding(){new m3e().startOnboarding()}renderInstallModal(e,t,n,r){return dt(this,null,function*(){var i,a;(i=this.modal)==null||i.unmount(),yield this.preload(),this.successCallback=n,this.displayUriCallback=r;const o=this.getMountedContainer(),s=yield t(),c=this.createConnectionDeeplink(s);(a=this.displayUriCallback)==null||a.call(this,c);const u=new this.options.InstallModal({expiresIn:(s.sessionRequest.expiresAt-Date.now())/1e3,connectionRequest:s,parentElement:o,showInstallModal:e,link:c,generateQRCode:d=>dt(this,null,function*(){var p;const f=this.createConnectionDeeplink(d);return(p=this.displayUriCallback)==null||p.call(this,f),f}),onClose:d=>{this.onCloseModal(d).catch(p=>{console.error("Failed to close modal:",p)})},startDesktopOnboarding:this.onStartDesktopOnboarding.bind(this),createConnectionRequest:t,onDisplayUri:this.displayUriCallback});this.modal=u,u.mount()})}renderOTPCodeModal(e,t,n){return dt(this,null,function*(){var r;(r=this.modal)==null||r.unmount(),yield this.preload(),this.successCallback=t;const i=this.getMountedContainer(),a=yield e(),o=new this.options.OTPCodeModal({parentElement:i,otpCode:a,onClose:this.onCloseModal.bind(this),createOTPCode:e,updateOTPCode:s=>n(s,o)});this.modal=o,o.mount()})}},w9e=class extends _9e{preload(){return dt(this,null,function*(){return Ort()})}},Zs(),E9e=e=>dt(null,null,function*(){e.debug&&c8("metamask-sdk:*");const t=yield Promise.resolve().then(()=>(L8e(),qZ));let n;if(e.storage)n=e.storage;else{const{StoreAdapterWeb:i}=yield Promise.resolve().then(()=>(U8e(),GZ));n=new v9e(new i)}const r=new w9e(t);return y9e.create(qi(on({},e),{storage:n,ui:qi(on({},e.ui),{factory:r})}))})})),Rrt=$c({EIP6963_ANNOUNCE_PROVIDER_EVENT:()=>_8,EIP6963_REQUEST_PROVIDER_EVENT:()=>Nj,createEVMClient:()=>zrt,getInfuraRpcUrls:()=>k9e});function Brt(e){return e.method==="wallet_requestPermissions"||e.method==="eth_requestAccounts"}function Nrt(e){return e.method==="wallet_switchEthereumChain"}function Lrt(e){return e.method==="wallet_addEthereumChain"}function Drt(e){return e.method==="eth_accounts"||e.method==="eth_coinbase"}function Urt(e){return e.method==="eth_chainId"}function Frt(e,t){const n=[];for(const[r,i]of Object.entries(e))try{new URL(i)}catch{n.push(`${r}: ${i}`)}if(n.length>0)throw new Error(`${t} contains invalid URLs:
1764
+ `+x,c(`data:${q(g)};charset=utf-8,${encodeURIComponent(x)}`,`${C}.svg`)}else c(B.toDataURL(q(g)),`${C}.${g}`)}}const F=W})(),a.default})()))})(OW),Nwe=irt(OW.exports),ej={CONNECT_WITH_METAMASK:"Connect with Metamask",USE_EXTENSION:"Use extension",USE_MOBILE:"Use mobile",ONE_CLICK_CONNECT:"Connect in one click to the MetaMask extension.",CONNECT_WITH_EXTENSION:"Connect With Extension",SCAN_TO_CONNECT:"Scan to connect with the MetaMask mobile app.",DESKTOP:"Desktop",MOBILE:"Mobile",META_MASK_MOBILE_APP:"MetaMask mobile app",INSTALL_MODAL:{TRUSTED_BY_USERS:"Trusted by over 30 million users to buy, store, send and swap crypto securely",LEADING_CRYPTO_WALLET:"The leading crypto wallet & gateway to blockchain apps built on Ethereum Mainnet, Polygon, Optimism, and many other networks",CONTROL_DIGITAL_INTERACTIONS:"Puts you in control of your digital interactions by making power of cryptography more accessible",INSTALL_META_MASK_EXTENSION_BUTTON:"Install MetaMask Extension",INSTALL_META_MASK_EXTENSION_TEXT:"Install and try the MetaMask browser extension."},PENDING_MODAL:{OPEN_META_MASK_SELECT_CODE:"Please open the MetaMask wallet app and select the code on the screen OR disconnect",OPEN_META_MASK_CONTINUE:"Open the MetaMask app to continue with your session.",NUMBER_AFTER_OPEN_NOTICE:"If a number doesn't appear after opening MetaMask, please click disconnect and re-scan the QRCode.",DISCONNECT:"Disconnect"},SELECT_MODAL:{CRYPTO_TAKE_CONTROL_TEXT:"Take control of your crypto and explore the blockchain with the wallet trusted by over 30 million people worldwide"},META_MASK_MODAL:{ADDRESS_COPIED:"Address copied to clipboard!",DISCONNECT:"Disconnect",ACTIVE_NETWORK:"Active Network"}},MW=class{constructor(e){var t;this.translations=ej,this.supportedLocales=["es","fr","he","it","pt","tr"],this.baseUrl=(t=e?.baseUrl)!==null&&t!==void 0?t:"https://raw.githubusercontent.com/MetaMask/metamask-sdk/refs/heads/gh-pages/locales"}getBrowserLanguage(){if((navigator.languages||[navigator.language]).some(t=>t.toLowerCase().startsWith("en")))return"en";const e=navigator.language.toLowerCase().split("-")[0];return this.supportedLocales.includes(e)?e:"en"}async init(e){const t=this.getBrowserLanguage()||e.fallbackLng;await this.loadTranslations(t)}async loadTranslations(e){const t=e.split("-")[0];if(t==="en"||!this.supportedLocales.includes(t)){this.translations=ej;return}try{const n=`${this.baseUrl}/${t}.json`,r=await fetch(n);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);this.translations=await r.json()}catch(n){console.warn(`❌ Failed to load ${t} translations, falling back to English:`,n),this.translations=ej}}t(e){return this.getNestedTranslation(e,this.translations)||e}getNestedTranslation(e,t){const n=e.split(".");let r=t;for(const i of n){if(typeof r!="object")return"";r=r[i]}return typeof r=="string"?r:""}},Lwe="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAxNDIgMTM3Ij4KICA8cGF0aCBmaWxsPSIjRkY1QzE2IiBkPSJtMTMyLjI0IDEzMS43NTEtMzAuNDgxLTkuMDc2LTIyLjk4NiAxMy43NDEtMTYuMDM4LS4wMDctMjMtMTMuNzM0LTMwLjQ2NyA5LjA3NkwwIDEwMC40NjVsOS4yNjgtMzQuNzIzTDAgMzYuMzg1IDkuMjY4IDBsNDcuNjA3IDI4LjQ0M2gyNy43NTdMMTMyLjI0IDBsOS4yNjggMzYuMzg1LTkuMjY4IDI5LjM1NyA5LjI2OCAzNC43MjMtOS4yNjggMzEuMjg2WiIvPgogIDxwYXRoIGZpbGw9IiNGRjVDMTYiIGQ9Im05LjI3NCAwIDQ3LjYwOCAyOC40NjMtMS44OTMgMTkuNTM0TDkuMjc0IDBabTMwLjQ2OCAxMDAuNDc4IDIwLjk0NyAxNS45NTctMjAuOTQ3IDYuMjR2LTIyLjE5N1ptMTkuMjczLTI2LjM4MUw1NC45ODkgNDguMDFsLTI1Ljc3IDE3Ljc0LS4wMTQtLjAwN3YuMDEzbC4wOCAxOC4yNiAxMC40NS05LjkxOGgxOS4yOFpNMTMyLjI0IDAgODQuNjMyIDI4LjQ2M2wxLjg4NyAxOS41MzRMMTMyLjI0IDBabS0zMC40NjcgMTAwLjQ3OC0yMC45NDggMTUuOTU3IDIwLjk0OCA2LjI0di0yMi4xOTdabTEwLjUyOS0zNC43MjNoLjAwNy0uMDA3di0uMDEzbC0uMDA2LjAwNy0yNS43Ny0xNy43MzlMODIuNSA3NC4wOTdoMTkuMjcybDEwLjQ1NyA5LjkxNy4wNzMtMTguMjU5WiIvPgogIDxwYXRoIGZpbGw9IiNFMzQ4MDciIGQ9Im0zOS43MzUgMTIyLjY3NS0zMC40NjcgOS4wNzZMMCAxMDAuNDc4aDM5LjczNXYyMi4xOTdaTTU5LjAwOCA3NC4wOWw1LjgyIDM3LjcxNC04LjA2Ni0yMC45Ny0yNy40OS02LjgyIDEwLjQ1Ni05LjkyM2gxOS4yOFptNDIuNzY0IDQ4LjU4NSAzMC40NjggOS4wNzYgOS4yNjgtMzEuMjczaC0zOS43MzZ2MjIuMTk3Wk04Mi41IDc0LjA5bC01LjgyIDM3LjcxNCA4LjA2NS0yMC45NyAyNy40OTEtNi44Mi0xMC40NjMtOS45MjNIODIuNVoiLz4KICA8cGF0aCBmaWxsPSIjRkY4RDVEIiBkPSJtMCAxMDAuNDY1IDkuMjY4LTM0LjcyM2gxOS45M2wuMDczIDE4LjI2NiAyNy40OTIgNi44MiA4LjA2NSAyMC45NjktNC4xNDYgNC42MTgtMjAuOTQ3LTE1Ljk1N0gwdi4wMDdabTE0MS41MDggMC05LjI2OC0zNC43MjNoLTE5LjkzMWwtLjA3MyAxOC4yNjYtMjcuNDkgNi44Mi04LjA2NiAyMC45NjkgNC4xNDUgNC42MTggMjAuOTQ4LTE1Ljk1N2gzOS43MzV2LjAwN1pNODQuNjMyIDI4LjQ0M0g1Ni44NzVMNTQuOTkgNDcuOTc3bDkuODM5IDYzLjhINzYuNjhsOS44NDUtNjMuOC0xLjg5My0xOS41MzRaIi8+CiAgPHBhdGggZmlsbD0iIzY2MTgwMCIgZD0iTTkuMjY4IDAgMCAzNi4zODVsOS4yNjggMjkuMzU3aDE5LjkzbDI1Ljc4NC0xNy43NDVMOS4yNjggMFptNDMuOTggODEuNjY1aC05LjAyOWwtNC45MTYgNC44MTkgMTcuNDY2IDQuMzMtMy41MjEtOS4xNTV2LjAwNlpNMTMyLjI0IDBsOS4yNjggMzYuMzg1LTkuMjY4IDI5LjM1N2gtMTkuOTMxTDg2LjUyNiA0Ny45OTcgMTMyLjI0IDBaTTg4LjI3MyA4MS42NjVoOS4wNDJsNC45MTYgNC44MjUtMTcuNDg2IDQuMzM4IDMuNTI4LTkuMTd2LjAwN1ptLTkuNTA3IDQyLjMwNSAyLjA2LTcuNTQyLTQuMTQ2LTQuNjE4SDY0LjgybC00LjE0NSA0LjYxOCAyLjA1OSA3LjU0MiIvPgogIDxwYXRoIGZpbGw9IiNDMEM0Q0QiIGQ9Ik03OC43NjYgMTIzLjk2OXYxMi40NTNINjIuNzM1di0xMi40NTNoMTYuMDNaIi8+CiAgPHBhdGggZmlsbD0iI0U3RUJGNiIgZD0ibTM5Ljc0MiAxMjIuNjYyIDIzLjAwNiAxMy43NTR2LTEyLjQ1M2wtMi4wNi03LjU0MS0yMC45NDYgNi4yNFptNjIuMDMxIDAtMjMuMDA3IDEzLjc1NHYtMTIuNDUzbDIuMDYtNy41NDEgMjAuOTQ3IDYuMjRaIi8+Cjwvc3ZnPgo=",Dwe="@font-face{font-family:'Euclid Circular B';src:url('../assets/fonts/Euclid Circular B Regular.ttf') format('truetype');font-weight:400;font-style:normal;font-display:swap}.flexContainer{display:flex;justify-content:center;align-items:center;flex-direction:row}.flexItem11{flex:11;justify-content:center;align-items:center}.flexItem1{flex:1;justify-content:center;align-items:center}.button{margin-top:41.5px;margin-bottom:20px;width:100%;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px 20px;background:#0376C9;border-radius:32px;color:white;border:0;font-size:14px;cursor:pointer}.backdrop{visibility:visible;position:fixed;top:0;left:0;right:0;bottom:0;width:100%;z-index:99998;background:rgba(0, 0, 0, 0.87);opacity:0.3}.modal{visibility:visible;position:fixed;left:50%;transform:translate(-50%, -50%);z-index:99999;background:white;padding:20px;border-radius:8px;top:50%;max-width:360px;width:460px;min-width:300px;box-shadow:rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;-webkit-font-smoothing:antialiased}.sectionDivider{height:1px;background-color:#B7BBC866;margin-top:17px;margin-bottom:10px}.closeButtonContainer{position:absolute;right:15px;top:15px;padding:10px;user-select:none}.buttonText{margin-left:10px}.closeButton{color:#BBC0C5;cursor:pointer;user-select:none}.right{display:flex;align-items:center;justify-content:right}#sdk-mm-qrcode{margin-top:10px;margin-bottom:10px;display:flex;justify-content:center;align-items:center;border:none !important;outline:none !important;box-shadow:none !important}#sdk-mm-qrcode svg{width:100% !important;height:auto !important;border:none !important;outline:none !important;box-shadow:none !important;stroke:none !important;stroke-width:0 !important;background:transparent !important}*{font-family:'Euclid Circular B', sans-serif}.modalTitle{font-size:16px;font-weight:700;letter-spacing:0px;line-height:24px;color:#141618;margin-top:4px;text-align:center;user-select:none}.sectionTitle{text-align:center;font-size:14px;font-weight:500;margin-bottom:0px;margin-top:20px;font-weight:bold}.sectionDescription{text-align:center;font-size:14px;font-weight:400;margin-top:5px;color:#6A737D}.extensionButton{padding:15px 20px;margin-top:15px;margin-bottom:0px}.qrContainer{display:flex;justify-content:center;align-items:center;width:100%}.qrCode{margin:0 auto;display:flex;justify-content:center;align-items:center}",RW=class{constructor(e){NW(this,e),this.close=W1(this,"close",7),this.startDesktopOnboarding=W1(this,"startDesktopOnboarding",7),this.updateLink=W1(this,"updateLink",7),this.updateExpiresIn=W1(this,"updateExpiresIn",7),this.link=void 0,this.expiresIn=void 0,this.showInstallModal=void 0,this.translationsLoaded=!1,this.onClose=this.onClose.bind(this),this.onStartDesktopOnboardingHandler=this.onStartDesktopOnboardingHandler.bind(this),this.render=this.render.bind(this),this.i18nInstance=new MW}componentDidLoad(){this.generateQRCode(this.link)}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}generateQRCode(e){if(!this.qrCodeContainer)return;const t=new Nwe({data:e,type:"svg",image:Lwe,imageOptions:{hideBackgroundDots:!0,crossOrigin:void 0,imageSize:.3,saveAsBlob:!1},dotsOptions:{color:"#222222",type:"square",gradient:void 0,roundSize:!1},cornersSquareOptions:{color:"#222222",type:"square",gradient:void 0},cornersDotOptions:{color:"#ff5c16"},backgroundOptions:{color:"transparent"},qrOptions:{typeNumber:0,mode:"Byte",errorCorrectionLevel:"Q"}});this.qrCodeContainer.innerHTML="",t.append(this.qrCodeContainer)}onClose(e=!1){this.close.emit({shouldTerminate:e})}onStartDesktopOnboardingHandler(){this.startDesktopOnboarding.emit()}updateLinkHandler(e){this.generateQRCode(e)}updateExpiresInHandler(e){console.debug("QRCode expires in:",e)}render(){if(!this.translationsLoaded)return null;const e=n=>this.i18nInstance.t(n),t=this.showInstallModal;return Ht(jW,{className:"install-model"},Ht("div",{class:"backdrop",onClick:()=>this.onClose(!0)}),Ht("div",{class:"modal"},Ht("div",{class:"closeButtonContainer"},Ht("div",{class:"right"},Ht("span",{class:"closeButton",onClick:()=>this.onClose(!0)},Ht(PW,null)))),Ht("div",{class:"modalHeader"},Ht("h2",{class:"modalTitle"},e("CONNECT_WITH_METAMASK"))),Ht("div",{class:"modalContent"},t?Ht("div",null,Ht("div",{class:"connectionSection"},Ht("h3",{class:"sectionTitle"},e("USE_EXTENSION")),Ht("p",{class:"sectionDescription"},e("ONE_CLICK_CONNECT")),Ht("button",{class:"button extensionButton",onClick:()=>this.onStartDesktopOnboardingHandler()},Ht(Jk,null),Ht("span",{class:"buttonText"},e("CONNECT_WITH_EXTENSION")))),Ht("div",{class:"sectionDivider"}),Ht("div",{class:"connectionSection"},Ht("h3",{class:"sectionTitle"},e("USE_MOBILE")),Ht("p",{class:"sectionDescription"},e("SCAN_TO_CONNECT")),Ht("div",{class:"qrContainer"},Ht("div",{id:"sdk-mm-qrcode",class:"qrCode",ref:n=>{n&&(this.qrCodeContainer=n)}})))):Ht("div",null,Ht("div",{class:"connectionSection"},Ht("h3",{class:"sectionTitle"},e("USE_MOBILE")),Ht("p",{class:"sectionDescription"},e("SCAN_TO_CONNECT")),Ht("div",{class:"qrContainer"},Ht("div",{id:"sdk-mm-qrcode",class:"qrCode",ref:n=>{n&&(this.qrCodeContainer=n)}}))),Ht("div",{class:"sectionDivider"}),Ht("div",{class:"connectionSection"},Ht("h3",{class:"sectionTitle"},e("USE_EXTENSION")),Ht("p",{class:"sectionDescription"},e("INSTALL_MODAL.INSTALL_META_MASK_EXTENSION_TEXT")),Ht("button",{class:"button extensionButton",onClick:()=>this.onStartDesktopOnboardingHandler()},Ht(Jk,null),Ht("span",{class:"buttonText"},e("INSTALL_MODAL.INSTALL_META_MASK_EXTENSION_BUTTON"))))))))}get el(){return cj(this)}static get watchers(){return{link:["updateLinkHandler"],expiresIn:["updateExpiresInHandler"]}}},RW.style=Dwe,Uwe="@font-face{font-family:'Euclid Circular B';src:url('../assets/fonts/Euclid Circular B Regular.ttf') format('truetype');font-weight:400;font-style:normal;font-display:swap}.flexContainer{display:flex;justify-content:center;align-items:center;flex-direction:row}.flexItem11{flex:11;justify-content:center;align-items:center}.flexItem1{flex:1;justify-content:center;align-items:center}.button{margin-top:41.5px;margin-bottom:20px;width:100%;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px 20px;background:#0376C9;border-radius:32px;color:white;border:0;font-size:14px;cursor:pointer}.backdrop{visibility:visible;position:fixed;top:0;left:0;right:0;bottom:0;width:100%;z-index:99998;background:rgba(0, 0, 0, 0.87);opacity:0.3}.modal{visibility:visible;position:fixed;left:50%;transform:translate(-50%, -50%);z-index:99999;background:white;padding:20px;border-radius:8px;top:50%;max-width:360px;width:460px;min-width:300px;box-shadow:rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;-webkit-font-smoothing:antialiased}.sectionDivider{height:1px;background-color:#B7BBC866;margin-top:17px;margin-bottom:10px}.closeButtonContainer{position:absolute;right:15px;top:15px;padding:10px;user-select:none}.buttonText{margin-left:10px}.closeButton{color:#BBC0C5;cursor:pointer;user-select:none}.right{display:flex;align-items:center;justify-content:right}#sdk-mm-qrcode{margin-top:10px;margin-bottom:10px;display:flex;justify-content:center;align-items:center;border:none !important;outline:none !important;box-shadow:none !important}#sdk-mm-qrcode svg{width:100% !important;height:auto !important;border:none !important;outline:none !important;box-shadow:none !important;stroke:none !important;stroke-width:0 !important;background:transparent !important}*{font-family:'Euclid Circular B', sans-serif}.modalTitle{font-size:16px;font-weight:700;letter-spacing:0px;line-height:24px;color:#141618;margin-top:4px;text-align:center;user-select:none}.sectionTitle{text-align:center;font-size:14px;font-weight:500;margin-bottom:0px;margin-top:20px;font-weight:bold}.sectionDescription{text-align:center;font-size:14px;font-weight:400;margin-top:5px;color:#6A737D}.extensionButton{padding:15px 20px;margin-top:15px;margin-bottom:0px}.qrContainer{display:flex;justify-content:center;align-items:center;width:100%}.qrCode{margin:0 auto;display:flex;justify-content:center;align-items:center}",BW=class{constructor(e){NW(this,e),this.close=W1(this,"close",7),this.disconnect=W1(this,"disconnect",7),this.updateOTPCode=W1(this,"updateOTPCode",7),this.displayOTP=void 0,this.otpCode=void 0,this.translationsLoaded=!1,this.i18nInstance=new MW}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}onClose(){this.close.emit()}onDisconnect(){this.disconnect.emit()}onUpdateOTPValueHandler(e){this.updateOTPCode.emit({otpCode:e})}disconnectedCallback(){this.onClose()}render(){var e;if(!this.translationsLoaded)return null;const t=(e=this.displayOTP)!==null&&e!==void 0?e:!0,n=r=>this.i18nInstance.t(r);return Ht(jW,{className:"pending-modal"},Ht("div",{class:"backdrop",onClick:()=>this.onClose()}),Ht("div",{class:"modal"},Ht("div",{class:"closeButtonContainer"},Ht("div",{class:"right"},Ht("span",{class:"closeButton",onClick:()=>this.onClose()},Ht(PW,null)))),Ht("div",{class:"logoContainer"},Ht(Jk,null)),Ht("div",null,Ht("div",{class:"flexContainer",style:{flexDirection:"column",color:"black"}},Ht("div",{class:"flexItem",style:{textAlign:"center",marginTop:"30px",marginBottom:"30px",fontSize:"16px"}},n(t?"PENDING_MODAL.OPEN_META_MASK_SELECT_CODE":"PENDING_MODAL.OPEN_META_MASK_CONTINUE")),Ht("div",{id:"sdk-mm-otp-value",style:{padding:"10px",fontSize:"32px",display:this.otpCode?"block":"none"}},this.otpCode),t&&Ht("div",{class:"notice"},"* ",n("PENDING_MODAL.NUMBER_AFTER_OPEN_NOTICE"))),Ht("div",{style:{marginTop:"20px"}},Ht("button",{class:"button blue",style:{marginTop:"5px",color:"#0376C9",borderColor:"#0376C9",borderWidth:"1px",borderStyle:"solid",backgroundColor:"white"},onClick:()=>this.onDisconnect()},n("PENDING_MODAL.DISCONNECT"))))))}get el(){return cj(this)}},BW.style=Uwe}));function Fwe(e){var t,n,r;return(r=(n=(t=e.head)==null?void 0:t.querySelector('meta[name="csp-nonce"]'))==null?void 0:n.getAttribute("content"))!=null?r:void 0}function ort(e,t){if(e.isOk){const n=t(e.value);return n instanceof Promise?n.then(r=>sj(r)):sj(n)}if(e.isErr){const n=e.value;return qW(n)}throw"should never get here"}function zwe(e){return e.includes("ref")?[...e.filter(t=>t!=="ref"),"ref"]:e}var $we,e5,Hwe,qwe,tj,P0,NW,Gwe,LW,V1,nj,Vwe,J4,Wwe,DW,e8,Ml,Ba,Zwe,UW,rj,FW,zW,Kwe,$W,ij,aj,Ywe,HW,Qwe,Xwe,Jwe,oj,sj,qW,e4e,t4e,rf,n4e,Ht,t8,r4e,i4e,a4e,GW,o4e,s4e,cj,W1,VW,WW,c4e,u4e,l4e,ZW,KW,d4e,YW,QW,f4e,XW,uj,JW,eZ,Ws,lj,tZ,nZ,h4e,n8,t5,rZ,r8,p4e,iZ,dj,m4e,g4e,b4e,y4e,v4e,_4e,aZ,fj,oZ,w4e,E4e,sZ,S4e,hj,C4e,cZ,A4e,T4e,x4e,I4e=Z((()=>{$we="sdk-install-modal-web",e5={allRenderFn:!0,appendChildSlotFix:!1,asyncLoading:!0,asyncQueue:!1,attachStyles:!0,cloneNodeFix:!1,cmpDidLoad:!0,cmpDidRender:!1,cmpDidUnload:!1,cmpDidUpdate:!1,cmpShouldUpdate:!1,cmpWillLoad:!1,cmpWillRender:!1,cmpWillUpdate:!1,connectedCallback:!0,constructableCSS:!0,cssAnnotations:!0,devTools:!1,disconnectedCallback:!0,element:!1,event:!0,experimentalScopedSlotChanges:!1,experimentalSlotFixes:!1,formAssociated:!1,hasRenderFn:!0,hostListener:!1,hostListenerTarget:!1,hostListenerTargetBody:!1,hostListenerTargetDocument:!1,hostListenerTargetParent:!1,hostListenerTargetWindow:!1,hotModuleReplacement:!1,hydrateClientSide:!1,hydrateServerSide:!1,hydratedAttribute:!1,hydratedClass:!0,hydratedSelectorName:"hydrated",initializeNextTick:!1,invisiblePrehydration:!0,isDebug:!1,isDev:!1,isTesting:!1,lazyLoad:!0,lifecycle:!0,lifecycleDOMEvents:!1,member:!0,method:!1,mode:!1,observeAttribute:!0,profile:!1,prop:!0,propBoolean:!0,propMutable:!1,propNumber:!0,propString:!0,reflect:!1,scoped:!1,scopedSlotTextContentFix:!1,scriptDataOpts:!1,shadowDelegatesFocus:!1,shadowDom:!0,slot:!1,slotChildNodesFix:!1,slotRelocation:!1,state:!0,style:!0,svg:!0,taskQueue:!0,transformTagName:!1,updatable:!0,vdomAttribute:!0,vdomClass:!0,vdomFunctional:!0,vdomKey:!1,vdomListener:!0,vdomPropOrAttr:!0,vdomRef:!0,vdomRender:!0,vdomStyle:!0,vdomText:!0,vdomXlink:!1,watchCallback:!0},Hwe=Object.defineProperty,qwe=(e,t)=>{for(var n in t)Hwe(e,n,{get:t[n],enumerable:!0})},tj=new WeakMap,P0=e=>tj.get(e),NW=(e,t)=>tj.set(t.$lazyInstance$=e,t),Gwe=(e,t)=>{const n={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};return n.$onReadyPromise$=new Promise(r=>n.$onReadyResolve$=r),e["s-p"]=[],e["s-rc"]=[],tj.set(e,n)},LW=(e,t)=>t in e,V1=(e,t)=>(0,console.error)(e,t),nj=new Map,Vwe=(e,t,n)=>{const r=e.$tagName$.replace(/-/g,"_"),i=e.$lazyBundleId$;if(!i)return;const a=nj.get(i);if(a)return a[r];if(!n||!e5.hotModuleReplacement){const o=s=>(nj.set(i,s),s[r]);if(i==="mm-install-modal_2")return Promise.resolve().then(()=>(art(),rrt)).then(o,V1)}return import(`./${i}.entry.js`).then(o=>(nj.set(i,o),o[r]),V1)},J4=new Map,Wwe="{visibility:hidden}.hydrated{visibility:inherit}",DW="slot-fb{display:contents}slot-fb[hidden]{display:none}",e8=typeof window<"u"?window:{},Ml=e8.document||{head:{}},Ba={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,r)=>e.addEventListener(t,n,r),rel:(e,t,n,r)=>e.removeEventListener(t,n,r),ce:(e,t)=>new CustomEvent(e,t)},Zwe=e=>Promise.resolve(e),UW=(()=>{try{return new CSSStyleSheet,typeof new CSSStyleSheet().replaceSync=="function"}catch{}return!1})(),rj=!1,FW=[],zW=[],Kwe=(e,t)=>n=>{e.push(n),rj||(rj=!0,t&&Ba.$flags$&4?aj(ij):Ba.raf(ij))},$W=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(n){V1(n)}e.length=0},ij=()=>{$W(FW),$W(zW),(rj=FW.length>0)&&Ba.raf(ij)},aj=e=>Zwe().then(e),Ywe=Kwe(zW,!0),HW={},Qwe="http://www.w3.org/2000/svg",Xwe="http://www.w3.org/1999/xhtml",Jwe=e=>e!=null,oj=e=>(e=typeof e,e==="object"||e==="function"),qwe({},{err:()=>qW,map:()=>ort,ok:()=>sj,unwrap:()=>e4e,unwrapErr:()=>t4e}),sj=e=>({isOk:!0,isErr:!1,value:e}),qW=e=>({isOk:!1,isErr:!0,value:e}),e4e=e=>{if(e.isOk)return e.value;throw e.value},t4e=e=>{if(e.isErr)return e.value;throw e.value},rf=(e,t="")=>()=>{},n4e=(e,t)=>()=>{},Ht=(e,t,...n)=>{let r=null,i=!1,a=!1;const o=[],s=u=>{for(let d=0;d<u.length;d++)r=u[d],Array.isArray(r)?s(r):r!=null&&typeof r!="boolean"&&((i=typeof e!="function"&&!oj(r))&&(r=String(r)),i&&a?o[o.length-1].$text$+=r:o.push(i?t8(null,r):r),a=i)};if(s(n),t){const u=t.className||t.class;u&&(t.class=typeof u!="object"?u:Object.keys(u).filter(d=>u[d]).join(" "))}if(typeof e=="function")return e(t===null?{}:t,o,a4e);const c=t8(e,null);return c.$attrs$=t,o.length>0&&(c.$children$=o),c},t8=(e,t)=>{const n={$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null};return n.$attrs$=null,n},r4e={},i4e=e=>e&&e.$tag$===r4e,a4e={forEach:(e,t)=>e.map(GW).forEach(t),map:(e,t)=>e.map(GW).map(t).map(o4e)},GW=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),o4e=e=>{if(typeof e.vtag=="function"){const n={...e.vattrs};return e.vkey&&(n.key=e.vkey),e.vname&&(n.name=e.vname),Ht(e.vtag,n,...e.vchildren||[])}const t=t8(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},s4e=(e,t)=>e!=null&&!oj(e)?t&4?e==="false"?!1:e===""||!!e:t&2?parseFloat(e):t&1?String(e):e:e,cj=e=>P0(e).$hostElement$,W1=(e,t,n)=>{const r=cj(e);return{emit:i=>VW(r,t,{bubbles:!!(n&4),composed:!!(n&2),cancelable:!!(n&1),detail:i})}},VW=(e,t,n)=>{const r=Ba.ce(t,n);return e.dispatchEvent(r),r},WW=new WeakMap,c4e=(e,t,n)=>{let r=J4.get(e);UW&&n?(r=r||new CSSStyleSheet,typeof r=="string"?r=t:r.replaceSync(t)):r=t,J4.set(e,r)},u4e=(e,t,n)=>{var r;const i=ZW(t),a=J4.get(i);if(e=e.nodeType===11?e:Ml,a)if(typeof a=="string"){e=e.head||e;let o=WW.get(e),s;if(o||WW.set(e,o=new Set),!o.has(i)){{s=Ml.createElement("style"),s.innerHTML=a;const c=(r=Ba.$nonce$)!=null?r:Fwe(Ml);if(c!=null&&s.setAttribute("nonce",c),!(t.$flags$&1))if(e.nodeName==="HEAD"){const u=e.querySelectorAll("link[rel=preconnect]"),d=u.length>0?u[u.length-1].nextSibling:e.querySelector("style");e.insertBefore(s,d)}else if("host"in e)if(UW){const u=new CSSStyleSheet;u.replaceSync(a),e.adoptedStyleSheets=[u,...e.adoptedStyleSheets]}else{const u=e.querySelector("style");u?u.innerHTML=a+u.innerHTML:e.prepend(s)}else e.append(s);t.$flags$&1&&e.nodeName!=="HEAD"&&e.insertBefore(s,null)}t.$flags$&4&&(s.innerHTML+=DW),o&&o.add(i)}}else e.adoptedStyleSheets.includes(a)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,a]);return i},l4e=e=>{const t=e.$cmpMeta$,n=e.$hostElement$,r=t.$flags$,i=rf("attachStyles",t.$tagName$),a=u4e(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);r&10&&r&2&&(n["s-sc"]=a,n.classList.add(a+"-h")),i()},ZW=(e,t)=>"sc-"+e.$tagName$,KW=(e,t,n,r,i,a)=>{if(n!==r){let o=LW(e,t),s=t.toLowerCase();if(t==="class"){const c=e.classList,u=YW(n),d=YW(r);c.remove(...u.filter(p=>p&&!d.includes(p))),c.add(...d.filter(p=>p&&!u.includes(p)))}else if(t==="style"){for(const c in n)(!r||r[c]==null)&&(c.includes("-")?e.style.removeProperty(c):e.style[c]="");for(const c in r)(!n||r[c]!==n[c])&&(c.includes("-")?e.style.setProperty(c,r[c]):e.style[c]=r[c])}else if(t==="ref")r&&r(e);else if(!o&&t[0]==="o"&&t[1]==="n"){if(t[2]==="-"?t=t.slice(3):LW(e8,s)?t=s.slice(2):t=s[2]+t.slice(3),n||r){const c=t.endsWith(QW);t=t.replace(f4e,""),n&&Ba.rel(e,t,n,c),r&&Ba.ael(e,t,r,c)}}else{const c=oj(r);if((o||c&&r!==null)&&!i)try{if(e.tagName.includes("-"))e[t]=r;else{const u=r??"";t==="list"?o=!1:(n==null||e[t]!=u)&&(typeof e.__lookupSetter__(t)=="function"?e[t]=u:e.setAttribute(t,u))}}catch{}r==null||r===!1?(r!==!1||e.getAttribute(t)==="")&&e.removeAttribute(t):(!o||a&4||i)&&!c&&(r=r===!0?"":r,e.setAttribute(t,r))}}},d4e=/\s/,YW=e=>e?e.split(d4e):[],QW="Capture",f4e=new RegExp(QW+"$"),XW=(e,t,n)=>{const r=t.$elm$.nodeType===11&&t.$elm$.host?t.$elm$.host:t.$elm$,i=e&&e.$attrs$||HW,a=t.$attrs$||HW;for(const o of zwe(Object.keys(i)))o in a||KW(r,o,i[o],void 0,n,t.$flags$);for(const o of zwe(Object.keys(a)))KW(r,o,i[o],a[o],n,t.$flags$)},eZ=!1,Ws=!1,lj=(e,t,n,r)=>{const i=t.$children$[n];let a=0,o,s;if(i.$text$!==null)o=i.$elm$=Ml.createTextNode(i.$text$);else{if(Ws||(Ws=i.$tag$==="svg"),o=i.$elm$=Ml.createElementNS(Ws?Qwe:Xwe,!eZ&&e5.slotRelocation&&i.$flags$&2?"slot-fb":i.$tag$),Ws&&i.$tag$==="foreignObject"&&(Ws=!1),XW(null,i,Ws),o.getRootNode().querySelector("body")&&e5.scoped&&Jwe(uj)&&o["s-si"]!==uj&&o.classList.add(o["s-si"]=uj),i.$children$)for(a=0;a<i.$children$.length;++a)s=lj(e,i,a),s&&o.appendChild(s);i.$tag$==="svg"?Ws=!1:o.tagName==="foreignObject"&&(Ws=!0)}return o["s-hn"]=JW,o},tZ=(e,t,n,r,i,a)=>{let o=e,s;for(o.shadowRoot&&o.tagName===JW&&(o=o.shadowRoot);i<=a;++i)r[i]&&(s=lj(null,n,i),s&&(r[i].$elm$=s,r8(o,s,t)))},nZ=(e,t,n)=>{for(let r=t;r<=n;++r){const i=e[r];if(i){const a=i.$elm$;rZ(i),a&&a.remove()}}},h4e=(e,t,n,r,i=!1)=>{let a=0,o=0,s=t.length-1,c=t[0],u=t[s],d=r.length-1,p=r[0],f=r[d],m;for(;a<=s&&o<=d;)c==null?c=t[++a]:u==null?u=t[--s]:p==null?p=r[++o]:f==null?f=r[--d]:n8(c,p,i)?(t5(c,p,i),c=t[++a],p=r[++o]):n8(u,f,i)?(t5(u,f,i),u=t[--s],f=r[--d]):n8(c,f,i)?(t5(c,f,i),r8(e,c.$elm$,u.$elm$.nextSibling),c=t[++a],f=r[--d]):n8(u,p,i)?(t5(u,p,i),r8(e,u.$elm$,c.$elm$),u=t[--s],p=r[++o]):(m=lj(t&&t[o],n,o),p=r[++o],m&&r8(c.$elm$.parentNode,m,c.$elm$));a>s?tZ(e,r[d+1]==null?null:r[d+1].$elm$,n,r,o,d):o>d&&nZ(t,a,s)},n8=(e,t,n=!1)=>e.$tag$===t.$tag$,t5=(e,t,n=!1)=>{const r=t.$elm$=e.$elm$,i=e.$children$,a=t.$children$,o=t.$tag$,s=t.$text$;s===null?(Ws=o==="svg"?!0:o==="foreignObject"?!1:Ws,XW(e,t,Ws),i!==null&&a!==null?h4e(r,i,t,a,n):a!==null?(e.$text$!==null&&(r.textContent=""),tZ(r,null,t,a,0,a.length-1)):!n&&e5.updatable&&i!==null&&nZ(i,0,i.length-1),Ws&&o==="svg"&&(Ws=!1)):e.$text$!==s&&(r.data=s)},rZ=e=>{e.$attrs$&&e.$attrs$.ref&&e.$attrs$.ref(null),e.$children$&&e.$children$.map(rZ)},r8=(e,t,n)=>e?.insertBefore(t,n),p4e=(e,t,n=!1)=>{const r=e.$hostElement$,i=e.$cmpMeta$,a=e.$vnode$||t8(null,null),o=i4e(t)?t:Ht(null,null,t);if(JW=r.tagName,n&&o.$attrs$)for(const s of Object.keys(o.$attrs$))r.hasAttribute(s)&&!["key","ref","style","class"].includes(s)&&(o.$attrs$[s]=r[s]);o.$tag$=null,o.$flags$|=4,e.$vnode$=o,o.$elm$=a.$elm$=r.shadowRoot||r,uj=r["s-sc"],eZ=(i.$flags$&1)!==0,t5(a,o,n)},iZ=(e,t)=>{t&&!e.$onRenderResolve$&&t["s-p"]&&t["s-p"].push(new Promise(n=>e.$onRenderResolve$=n))},dj=(e,t)=>{if(e.$flags$|=16,e.$flags$&4){e.$flags$|=512;return}return iZ(e,e.$ancestorComponent$),Ywe(()=>m4e(e,t))},m4e=(e,t)=>{const n=e.$hostElement$,r=rf("scheduleUpdate",e.$cmpMeta$.$tagName$),i=e.$lazyInstance$;if(!i)throw new Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let a;return r(),g4e(a,()=>y4e(e,i,t))},g4e=(e,t)=>b4e(e)?e.then(t).catch(n=>{console.error(n),t()}):t(),b4e=e=>e instanceof Promise||e&&e.then&&typeof e.then=="function",y4e=async(e,t,n)=>{var r;const i=e.$hostElement$,a=rf("update",e.$cmpMeta$.$tagName$),o=i["s-rc"];n&&l4e(e);const s=rf("render",e.$cmpMeta$.$tagName$);v4e(e,t,i,n),o&&(o.map(c=>c()),i["s-rc"]=void 0),s(),a();{const c=(r=i["s-p"])!=null?r:[],u=()=>_4e(e);c.length===0?u():(Promise.all(c).then(u),e.$flags$|=4,c.length=0)}},v4e=(e,t,n,r)=>{try{t=t.render(),e.$flags$&=-17,e.$flags$|=2,p4e(e,t,r)}catch(i){V1(i,e.$hostElement$)}return null},_4e=e=>{const t=e.$cmpMeta$.$tagName$,n=e.$hostElement$,r=rf("postUpdate",t),i=e.$lazyInstance$,a=e.$ancestorComponent$;e.$flags$&64?r():(e.$flags$|=64,oZ(n),fj(i,"componentDidLoad"),r(),e.$onReadyResolve$(n),a||aZ()),e.$onRenderResolve$&&(e.$onRenderResolve$(),e.$onRenderResolve$=void 0),e.$flags$&512&&aj(()=>dj(e,!1)),e.$flags$&=-517},aZ=e=>{oZ(Ml.documentElement),aj(()=>VW(e8,"appload",{detail:{namespace:$we}}))},fj=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(r){V1(r)}},oZ=e=>{var t;return e.classList.add((t=e5.hydratedSelectorName)!=null?t:"hydrated")},w4e=(e,t)=>P0(e).$instanceValues$.get(t),E4e=(e,t,n,r)=>{const i=P0(e);if(!i)throw new Error(`Couldn't find host element for "${r.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`);const a=i.$hostElement$,o=i.$instanceValues$.get(t),s=i.$flags$,c=i.$lazyInstance$;n=s4e(n,r.$members$[t][0]);const u=n!==o&&!(Number.isNaN(o)&&Number.isNaN(n));if((!(s&8)||o===void 0)&&u&&(i.$instanceValues$.set(t,n),c)){if(r.$watchers$&&s&128){const d=r.$watchers$[t];d&&d.map(p=>{try{c[p](n,o,t)}catch(f){V1(f,a)}})}(s&18)===2&&dj(i,!1)}},sZ=(e,t,n)=>{var r,i;const a=e.prototype;if(t.$members$||t.$watchers$||e.watchers){e.watchers&&!t.$watchers$&&(t.$watchers$=e.watchers);const o=Object.entries((r=t.$members$)!=null?r:{});if(o.map(([s,[c]])=>{(c&31||n&2&&c&32)&&Object.defineProperty(a,s,{get(){return w4e(this,s)},set(u){E4e(this,s,u,t)},configurable:!0,enumerable:!0})}),n&1){const s=new Map;a.attributeChangedCallback=function(c,u,d){Ba.jmp(()=>{var p;const f=s.get(c);if(this.hasOwnProperty(f))d=this[f],delete this[f];else{if(a.hasOwnProperty(f)&&typeof this[f]=="number"&&this[f]==d)return;if(f==null){const m=P0(this),v=m?.$flags$;if(v&&!(v&8)&&v&128&&d!==u){const y=m.$lazyInstance$;((p=t.$watchers$)==null?void 0:p[c])?.forEach(E=>{y[E]!=null&&y[E].call(y,d,u,c)})}return}}this[f]=d===null&&typeof this[f]=="boolean"?!1:d})},e.observedAttributes=Array.from(new Set([...Object.keys((i=t.$watchers$)!=null?i:{}),...o.filter(([c,u])=>u[0]&15).map(([c,u])=>{const d=u[1]||c;return s.set(d,c),d})]))}}return e},S4e=async(e,t,n,r)=>{let i;if((t.$flags$&32)===0){if(t.$flags$|=32,n.$lazyBundleId$){const s=Vwe(n);if(s&&"then"in s){const u=n4e();i=await s,u()}else i=s;if(!i)throw new Error(`Constructor for "${n.$tagName$}#${t.$modeName$}" was not found`);i.isProxied||(n.$watchers$=i.watchers,sZ(i,n,2),i.isProxied=!0);const c=rf("createInstance",n.$tagName$);t.$flags$|=8;try{new i(t)}catch(u){V1(u)}t.$flags$&=-9,t.$flags$|=128,c(),hj(t.$lazyInstance$)}else{i=e.constructor;const s=e.localName;customElements.whenDefined(s).then(()=>t.$flags$|=128)}if(i&&i.style){let s;typeof i.style=="string"&&(s=i.style);const c=ZW(n);if(!J4.has(c)){const u=rf("registerStyles",n.$tagName$);c4e(c,s,!!(n.$flags$&1)),u()}}}const a=t.$ancestorComponent$,o=()=>dj(t,!0);a&&a["s-rc"]?a["s-rc"].push(o):o()},hj=e=>{fj(e,"connectedCallback")},C4e=e=>{if((Ba.$flags$&1)===0){const t=P0(e),n=t.$cmpMeta$,r=rf("connectedCallback",n.$tagName$);if(t.$flags$&1)t?.$lazyInstance$?hj(t.$lazyInstance$):t?.$onReadyPromise$&&t.$onReadyPromise$.then(()=>hj(t.$lazyInstance$));else{t.$flags$|=1;{let i=e;for(;i=i.parentNode||i.host;)if(i["s-p"]){iZ(t,t.$ancestorComponent$=i);break}}n.$members$&&Object.entries(n.$members$).map(([i,[a]])=>{if(a&31&&e.hasOwnProperty(i)){const o=e[i];delete e[i],e[i]=o}}),S4e(e,t,n)}r()}},cZ=e=>{fj(e,"disconnectedCallback")},A4e=async e=>{if((Ba.$flags$&1)===0){const t=P0(e);t?.$lazyInstance$?cZ(t.$lazyInstance$):t?.$onReadyPromise$&&t.$onReadyPromise$.then(()=>cZ(t.$lazyInstance$))}},T4e=(e,t={})=>{var n;const r=rf(),i=[],a=t.exclude||[],o=e8.customElements,s=Ml.head,c=s.querySelector("meta[charset]"),u=Ml.createElement("style"),d=[];let p,f=!0;Object.assign(Ba,t),Ba.$resourcesUrl$=new URL(t.resourcesUrl||"./",Ml.baseURI).href;let m=!1;if(e.map(v=>{v[1].map(y=>{var E;const I={$flags$:y[0],$tagName$:y[1],$members$:y[2],$listeners$:y[3]};I.$flags$&4&&(m=!0),I.$members$=y[2],I.$watchers$=(E=y[4])!=null?E:{};const w=I.$tagName$,j=class extends HTMLElement{constructor(_){if(super(_),this.hasRegisteredEventListeners=!1,_=this,Gwe(_,I),I.$flags$&1){if(!_.shadowRoot)_.attachShadow({mode:"open"});else if(_.shadowRoot.mode!=="open")throw new Error(`Unable to re-use existing shadow root for ${I.$tagName$}! Mode is set to ${_.shadowRoot.mode} but Stencil only supports open shadow roots.`)}}connectedCallback(){P0(this),this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0),p&&(clearTimeout(p),p=null),f?d.push(this):Ba.jmp(()=>C4e(this))}disconnectedCallback(){Ba.jmp(()=>A4e(this))}componentOnReady(){return P0(this).$onReadyPromise$}};I.$lazyBundleId$=v[0],!a.includes(w)&&!o.get(w)&&(i.push(w),o.define(w,sZ(j,I,1)))})}),i.length>0&&(m&&(u.textContent+=DW),u.textContent+=i.sort()+Wwe,u.innerHTML.length)){u.setAttribute("data-styles","");const v=(n=Ba.$nonce$)!=null?n:Fwe(Ml);v!=null&&u.setAttribute("nonce",v),s.insertBefore(u,c?c.nextSibling:s.firstChild)}f=!1,d.length?d.map(v=>v.connectedCallback()):Ba.jmp(()=>p=setTimeout(aZ,30)),r()},x4e=e=>Ba.$nonce$=e})),k4e,srt=Z((()=>{k4e=()=>{}})),j4e,crt=Z((()=>{I4e(),srt(),j4e=async(e,t)=>{if(!(typeof window>"u"))return await k4e(),T4e([["mm-install-modal_2",[[1,"mm-install-modal",{link:[1],expiresIn:[2,"expires-in"],showInstallModal:[4,"show-install-modal"],translationsLoaded:[32]},null,{link:["updateLinkHandler"],expiresIn:["updateExpiresInHandler"]}],[1,"mm-otp-modal",{displayOTP:[4,"display-o-t-p"],otpCode:[1,"otp-code"],translationsLoaded:[32]}]]]],t)}})),urt=$c({defineCustomElements:()=>j4e,setNonce:()=>x4e}),lrt=Z((()=>{crt(),(function(){if(typeof window<"u"&&window.Reflect!==void 0&&window.customElements!==void 0){var e=HTMLElement;window.HTMLElement=function(){return Reflect.construct(e,[],this.constructor)},HTMLElement.prototype=e.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,e)}})()}));function P4e(e,t){return e.includes(t)||e.includes("metamask-sdk:*")||e.includes("*")}function drt({infuraApiKey:e,caipChainIds:t}){return(t&&t.length>0?t:Object.keys(OZ)).reduce((n,r)=>{const i=OZ[r];return i&&(n[r]=`${i}${e}`),n},{})}function frt(e){switch(e){case"browser":return"browser";case"mwp":return"mwp";default:return"unknown"}}function hrt(){return typeof window>"u"||!window?.navigator?!0:navigator?.product==="ReactNative"}function O4e(){var e,t;return typeof globalThis<"u"&&((e=globalThis?.navigator)==null?void 0:e.product)==="ReactNative"?!0:typeof window<"u"&&window.navigator!==void 0&&((t=window.navigator)==null?void 0:t.product)==="ReactNative"}function prt(){return typeof window<"u"&&!!window.ReactNativeWebView&&!!window.navigator.userAgent.endsWith("MetaMaskMobile")}function mrt(){if(window.navigator.maxTouchPoints>1&&/Macintosh/.test(window.navigator.userAgent))return!0;var e,t;const n=U4e.default.parse(window.navigator.userAgent);return((e=n?.platform)==null?void 0:e.type)==="mobile"||((t=n?.platform)==null?void 0:t.type)==="tablet"}function af(){return O4e()?"react-native":hrt()?"nodejs":prt()?"in-app-browser":mrt()?"web-mobile":"web-desktop"}function pj(){const e=af();return O4e()||e==="web-mobile"}function uZ(){return dt(this,null,function*(){return o8e})}function grt(e){if(!e)return;let t=e;for(const{pattern:n,replacement:r}of h8e)t=t.replace(n,r);return t.length>DZ&&(t=`${t.slice(0,DZ-1)}…`),t}function lZ(e){var t,n,r,i;if(typeof e!="object"||e===null)return{code:void 0,message:""};if(e instanceof o8)return{code:(t=e.rpcCode)!=null?t:e.code,message:(r=(n=e.rpcMessage)!=null?n:e.message)!=null?r:""};const a=e;return{code:a.code,message:(i=a.message)!=null?i:""}}function dZ(e){if(typeof e!="object"||e===null)return!1;const{code:t,message:n}=lZ(e),r=n.toLowerCase();return t===4001||r.includes("reject")||r.includes("denied")||r.includes("cancel")||r.includes("user rejected")||r.includes("user denied")||r.includes("user cancelled")||r.includes("user canceled")}function brt(e){var t,n;if(typeof e!="object"||e===null)return"unknown";const r=e,i=(t=r.name)!=null?t:"",a=(n=r.message)!=null?n:"",o=a.toLowerCase(),{code:s}=lZ(e);if(typeof s=="number"){if(s===-32601)return"wallet_method_unsupported";if(s===-32602)return"wallet_invalid_params";if(s===-32603||s<=-32e3&&s>=-32099)return"wallet_internal_error";if(s===4100)return"wallet_unauthorized";if(s===4200)return"wallet_method_unsupported";if(s===4902)return"unrecognized_chain"}return i==="TransportTimeoutError"||a==="Request timeout"||o.includes("timed out")||o.includes("timeout")?"transport_timeout":i==="TransportError"||o.includes("not connected")||o.includes("transport disconnect")||o.includes("connection lost")||o.includes("socket closed")?"transport_disconnect":"unknown"}function M4e(e){const t=brt(e),{code:n,message:r}=lZ(e),i=grt(r);return on(on({failure_reason:t},typeof n=="number"?{error_code:n}:{}),i?{error_message_sample:i}:{})}function fZ(e,t){return dt(this,null,function*(){var n;const r=hZ(e.dapp),i=af(),a=yield t.getAnonId();return{mmconnect_versions:(n=e.versions)!=null?n:{},dapp_id:r,platform:i,anon_id:a}})}function Wg(e,t,n,r,i){return dt(this,null,function*(){var a;const o=hZ(e.dapp),s=yield t.getAnonId();return on(on(on({mmconnect_versions:(a=e.versions)!=null?a:{},dapp_id:o,method:n.request.method,caip_chain_id:n.scope,anon_id:s,transport_type:r},i?.failure_reason?{failure_reason:i.failure_reason}:{}),typeof i?.error_code=="number"?{error_code:i.error_code}:{}),i?.error_message_sample?{error_message_sample:i.error_message_sample}:{})})}function n5(){return p8e}function R4e(){if(typeof globalThis<"u"||typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;throw new Error("Unable to locate global object")}function yrt(e){if(typeof btoa<"u")return btoa(e);if(typeof Buffer<"u")return Buffer.from(e).toString("base64");throw new Error("No base64 encoding method available")}function B4e(e){const t=O_e(e);return yrt(String.fromCharCode.apply(null,Array.from(t)))}function hZ(e){var t;return(t=e.url)!=null?t:e.name}function mj(e,t,n){var r;const{mobile:i}=e;if((r=i?.useDeeplink)==null||r)typeof window<"u"&&(window.location.href=t);else if(typeof document<"u"){const a=document.createElement("a");a.href=n,a.target="_self",a.rel="noreferrer noopener",a.click()}}function vrt(e,t,n,r){const i=Object.keys(e.sessionScopes),a=[];return Object.values(e.sessionScopes).forEach(o=>{o?.accounts&&Array.isArray(o.accounts)&&o.accounts.forEach(s=>{a.push(s)})}),{mergedScopes:Array.from(new Set([...i,...t])),mergedCaipAccountIds:Array.from(new Set([...a,...n])),mergedSessionProperties:on(on({},e.sessionProperties),r)}}function gj(e){return e.reduce((t,n)=>qi(on({},t),{[n]:{methods:[],notifications:[],accounts:[]}}),{})}function _rt(e){var t;if(/^https?:\/\//u.test(e))return;const n=e.match(/^([^:]*):\/\//u);return{url:`https://${(((t=n?.[1])!=null?t:e).toLowerCase().replace(/[^a-z0-9-]/gu,"-").replace(/^-+|-+$/gu,"")||"unknown").slice(0,63).replace(/-+$/u,"")}.rn.dapp.local`,nativeScheme:e}}function wrt(e){var t,n;const r=af(),i=r==="web-desktop"||r==="web-mobile"||r==="in-app-browser";if(!((t=e.dapp)!=null&&t.name))throw new Error("You must provide dapp name");if(i&&(e.dapp=qi(on({},e.dapp),{url:`${window.location.protocol}//${window.location.host}`})),!((n=e.dapp)!=null&&n.url))throw new Error("You must provide dapp url");if(r==="react-native"&&e.dapp.url){const s=_rt(e.dapp.url);s&&(console.info(`Normalizing dapp URL for React Native: "${e.dapp.url}" -> "${s.url}"`),e.dapp=qi(on({},e.dapp),{url:s.url,nativeScheme:s.nativeScheme}))}const a=163400,o=/^(http|https):\/\/[^\s]*$/u;if(e.dapp){"iconUrl"in e.dapp&&e.dapp.iconUrl&&!o.test(e.dapp.iconUrl)&&(console.warn("Invalid dappMetadata.iconUrl: URL must start with http:// or https://"),e.dapp.iconUrl=void 0),"base64Icon"in e.dapp&&e.dapp.base64Icon&&e.dapp.base64Icon.length>a&&(console.warn("Invalid dappMetadata.base64Icon: Base64-encoded icon string length must be less than 163400 characters"),e.dapp.base64Icon=void 0),e.dapp.url&&!o.test(e.dapp.url)&&console.warn("Invalid dappMetadata.url: URL must start with http:// or https://");const s=g8e();if(s&&!("iconUrl"in e.dapp)&&!("base64Icon"in e.dapp)){const c=`${window.location.protocol}//${window.location.host}${s}`;e.dapp.iconUrl=c}}return e}function N4e(e,t,n,r){if(!(e.every(a=>t.includes(a))&&t.every(a=>e.includes(a))))return!1;const i=Object.values(n.sessionScopes).filter(({accounts:a})=>!!a).flatMap(({accounts:a})=>a??[]);return r.every(a=>i.includes(a))}function bj(e){return e.reduce((t,n)=>{try{return[...t,b5e(n)]}catch(r){const i=JSON.stringify(n);return console.error(`Invalid CAIP account ID: ${i}`,r),t}},[])}function yj(e,t){var n;if(!e||!t?.length)return e;const r=Object.fromEntries(Object.entries(e).map(([a,o])=>{var s,c,u;return[a,{methods:[...(s=o?.methods)!=null?s:[]],notifications:[...(c=o?.notifications)!=null?c:[]],accounts:[...(u=o?.accounts)!=null?u:[]]}]})),i=new Map;for(const a of t){const o=`${a.chain.namespace}:${a.chain.reference}`,s=`${a.chainId}:${a.address}`;i.has(o)||i.set(o,[]),(n=i.get(o))==null||n.push(s)}for(const[a,o]of Object.entries(r))if(o?.accounts)try{const s=sG(a),c=`${s.namespace}:${s.reference}`,u=i.get(c);if(u){const d=new Set(o.accounts),p=u.filter(f=>!d.has(f));o.accounts.push(...p)}}catch(s){console.error(`Invalid scope format: ${a}`,s)}return r}function Ert(){return dt(this,null,function*(){const{decrypt:e,encrypt:t,PrivateKey:n,PublicKey:r}=yield Promise.resolve().then(()=>nt(Xtt(),1));return{generateKeyPair(){const i=new n;return{privateKey:new Uint8Array(i.secret),publicKey:i.publicKey.toBytes(!0)}},encrypt(i,a){return dt(this,null,function*(){return t(a,Buffer.from(i,"utf8")).toString("base64")})},decrypt(i,a){return dt(this,null,function*(){const o=yield e(a,Buffer.from(i,"base64"));return Buffer.from(o).toString("utf8")})},validatePeerKey(i){r.fromHex(Buffer.from(i).toString("hex"))}}})}function Srt(e){return e<=0?"EXPIRED":`${Math.floor(e/1e3)}s`}function Crt(e){return e<=10?!0:e<=30?e%5===0:e<=60?e%10===0:e<=300?e%30===0:e%60===0}function Art(){return VZ+=1,VZ}function L4e(e){if(typeof e=="object"&&e!==null)return e}function Trt(e){return typeof e=="number"?e:void 0}function pZ(e){return typeof e=="string"&&e.length>0?e:void 0}function xrt(e){return e!==void 0&&kv(e)?e:void 0}function mZ(e){for(const t of e){const n=pZ(t);if(n!==void 0)return n}}function Irt(e){const t=[];let n=e;for(let r=0;n!==void 0&&r<H8e;r+=1)t.push(n),n=L4e(n.cause);return t}function krt(e){const t=Trt(e?.code);if(t===void 0)return;const n=pZ(e?.message),r=xrt(e?.data);return on(on({code:t},n===void 0?{}:{message:n}),r===void 0?{}:{data:r})}function jrt(e){var t,n,r,i;const a=Irt(L4e(e)),o=pZ(e);for(const[s,c]of a.entries()){const u=krt(c);if(u){const d=a.slice(s+1),p=a.slice(0,s),f=mZ(d.map(v=>v.message)),m=mZ([o,...p.map(v=>v.message)]);return on(on({reason:(r=(n=(t=u.message)!=null?t:f)!=null?n:m)!=null?r:"Unknown error",rpcCode:u.code},u.message===void 0?{}:{rpcMessage:u.message}),u.data===void 0?{}:{rpcData:u.data})}}return{reason:(i=o??mZ(a.map(s=>s.message)))!=null?i:"Unknown error"}}function gZ(e){if(e instanceof o8)return e;const{reason:t,rpcCode:n,rpcMessage:r,rpcData:i}=jrt(e);return new o8(t,n,r,i)}function Prt(e){var t;return qi(on({},e??{}),{enabled:(t=e?.enabled)!=null?t:!0,integrationType:e?.integrationType||"direct"})}function i8(e){var t;return((t=e.analytics)==null?void 0:t.enabled)!==!1}function D4e(e,t,n){return dt(this,null,function*(){var r,i;if(!i8(e)){n?.(void 0),ta.disable();return}const a=af();if(!(a==="in-app-browser"||a==="web-desktop"||a==="web-mobile")&&a!=="react-native")return;const o=hZ(e.dapp),s=yield t.getAnonId();n?.(s);const{integrationType:c}=(r=e.analytics)!=null?r:{integrationType:""};ta.setGlobalProperty("mmconnect_versions",(i=e.versions)!=null?i:{}),ta.setGlobalProperty("dapp_id",o),ta.setGlobalProperty("anon_id",s),ta.setGlobalProperty("platform",a),c&&ta.setGlobalProperty("integration_types",[c]),ta.enable()})}function Ort(){return dt(this,null,function*(){if(!(typeof document>"u"))try{const{defineCustomElements:e}=yield Promise.resolve().then(()=>(lrt(),urt));e()}catch(e){console.error("Failed to load customElements:",e)}})}var bZ,U4e,F4e,z4e,yZ,$4e,H4e,q4e,vZ,G4e,V4e,_Z,wZ,on,qi,gr,a8,vj,kt,qr,dr,Lt,dt,Z1,EZ,SZ,CZ,AZ,W4e,TZ,xZ,IZ,o8,Z4e,K4e,K1,kZ,jZ,s8,c8,Y4e,PZ,OZ,Q4e,X4e,J4e,MZ,e8e,t8e,n8e,RZ,r8e,_j,i8e,a8e,o8e,BZ,s8e,c8e,u8e,NZ,l8e,LZ,d8e,f8e,DZ,h8e,wj,p8e,m8e,Zs,g8e,UZ,Ej,r5,O0,FZ,b8e,Sj,zZ,y8e,v8e,_8e,Y1,i5,a5,Cj,w8e,E8e,Aj,u8,S8e,C8e,A8e,T8e,$Z,HZ,x8e,I8e,l8,o5,d8,k8e,j8e,P8e,O8e,M8e,R8e,B8e,N8e,qZ,L8e,GZ,Tj,D8e,U8e,F8e,z8e,f8,xj,VZ,WZ,$8e,H8e,Q1,q8e,G8e,V8e,W8e,Z8e,K8e,Y8e,Q8e,h8,Zg,X1,s5,p8,Ij,ys,kj,ZZ,KZ,X8e,J8e,YZ,QZ,XZ,c5,J1,u5,e9e,t9e,n9e,r9e,i9e,m8,jj,a9e,Pj,M0,ba,Kg,l5,vs,ep,g8,xn,tp,JZ,eK,b8,o9e,s9e,y8,c9e,tK,u9e,l9e,d9e,f9e,h9e,p9e,Oj,m9e,d5,nK,g9e,b9e,y9e,rK,v8,iK,Mj,aK,Rj,v9e,_9e,w9e,E9e,Mrt=Z((()=>{Mve(),bZ=nt(Nq(),1),U4e=nt(Rve(),1),uk(),Pet(),qet(),ttt(),F4e=Ite(),s3e(),z4e=nt(ctt(),1),h3e(),mtt(),yZ=Object.defineProperty,$4e=Object.defineProperties,H4e=Object.getOwnPropertyDescriptors,q4e=Object.getOwnPropertyNames,vZ=Object.getOwnPropertySymbols,G4e=Object.prototype.hasOwnProperty,V4e=Object.prototype.propertyIsEnumerable,_Z=e=>{throw TypeError(e)},wZ=(e,t,n)=>t in e?yZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,on=(e,t)=>{for(var n in t||(t={}))G4e.call(t,n)&&wZ(e,n,t[n]);if(vZ)for(var n of vZ(t))V4e.call(t,n)&&wZ(e,n,t[n]);return e},qi=(e,t)=>$4e(e,H4e(t)),gr=(e,t)=>function(){return e&&(t=(0,e[q4e(e)[0]])(e=0)),t},a8=(e,t)=>{for(var n in t)yZ(e,n,{get:t[n],enumerable:!0})},vj=(e,t,n)=>t.has(e)||_Z("Cannot "+n),kt=(e,t,n)=>(vj(e,t,"read from private field"),n?n.call(e):t.get(e)),qr=(e,t,n)=>t.has(e)?_Z("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),dr=(e,t,n,r)=>(vj(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Lt=(e,t,n)=>(vj(e,t,"access private method"),n),dt=(e,t,n)=>new Promise((r,i)=>{var a=c=>{try{s(n.next(c))}catch(u){i(u)}},o=c=>{try{s(n.throw(c))}catch(u){i(u)}},s=c=>c.done?r(c.value):Promise.resolve(c.value).then(a,o);s((n=n.apply(e,t)).next())}),EZ=gr({"src/domain/errors/base.ts"(){"use strict";Z1=class extends Error{constructor(e,t){super(e),this.message=e,this.code=t}}}}),Z4e=gr({"src/domain/errors/rpc.ts"(){"use strict";EZ(),SZ=class WJ extends Z1{constructor(t,n,r){super(`RPCErr${WJ.code}: ${r} on ${t} for method ${n}`,WJ.code),this.rpcEndpoint=t,this.method=n,this.httpStatus=r}},SZ.code=50,CZ=SZ,AZ=class ZJ extends Z1{constructor(t){super(`RPCErr${ZJ.code}: RPC Client response reason ${t}`,ZJ.code),this.reason=t}},AZ.code=51,W4e=AZ,TZ=class KJ extends Z1{constructor(t){super(`RPCErr${KJ.code}: RPC Client fetch reason ${t}`,KJ.code),this.reason=t}},TZ.code=52,xZ=TZ,IZ=class YJ extends Z1{constructor(t,n,r,i){super(`RPCErr${YJ.code}: RPC Client invoke method reason (${t})`,YJ.code),this.reason=t,this.rpcCode=n,this.rpcMessage=r,this.rpcData=i}},IZ.code=53,o8=IZ}}),K4e=gr({"src/domain/errors/index.ts"(){"use strict";Z4e()}}),jZ=gr({"src/domain/events/index.ts"(){"use strict";kZ=class{constructor(){qr(this,K1,new Bq.default)}emit(e,...t){kt(this,K1).emit(e,...t)}on(e,t){return kt(this,K1).on(e,t),()=>{this.off(e,t)}}off(e,t){kt(this,K1).off(e,t)}removeListener(e,t){kt(this,K1).off(e,t)}once(e,t){return kt(this,K1).once(e,t),()=>{this.off(e,t)}}listenerCount(e){return kt(this,K1).listenerCount(e)}},K1=new WeakMap}}),PZ=gr({"src/domain/logger/index.ts"(){"use strict";s8=(e="metamask-sdk",t="214")=>{const n=(0,bZ.default)(e);return n.color=t,n},c8=(e="metamask-sdk")=>{bZ.default.enable(e)},Y4e=(e,t)=>dt(null,null,function*(){var n;if("process"in globalThis&&((n=process==null?void 0:process.env)!=null&&n.DEBUG)){const{DEBUG:i}=process.env;return P4e(i,e)}const r=yield t.getDebug();return r?P4e(r,e):!1})}}),MZ=gr({"src/domain/multichain/api/constants.ts"(){"use strict";OZ={"eip155:1":"https://mainnet.infura.io/v3/","eip155:11155111":"https://sepolia.infura.io/v3/","eip155:560048":"https://hoodi.infura.io/v3/","eip155:59144":"https://linea-mainnet.infura.io/v3/","eip155:59141":"https://linea-sepolia.infura.io/v3/","eip155:137":"https://polygon-mainnet.infura.io/v3/","eip155:80002":"https://polygon-amoy.infura.io/v3/","eip155:10":"https://optimism-mainnet.infura.io/v3/","eip155:11155420":"https://optimism-sepolia.infura.io/v3/","eip155:42161":"https://arbitrum-mainnet.infura.io/v3/","eip155:421614":"https://arbitrum-sepolia.infura.io/v3/","eip155:8453":"https://base-mainnet.infura.io/v3/","eip155:84532":"https://base-sepolia.infura.io/v3/","eip155:81457":"https://blast-mainnet.infura.io/v3/","eip155:168587773":"https://blast-sepolia.infura.io/v3/","eip155:324":"https://zksync-mainnet.infura.io/v3/","eip155:300":"https://zksync-sepolia.infura.io/v3/","eip155:56":"https://bsc-mainnet.infura.io/v3/","eip155:97":"https://bsc-testnet.infura.io/v3/","eip155:204":"https://opbnb-mainnet.infura.io/v3/","eip155:5611":"https://opbnb-testnet.infura.io/v3/","eip155:534352":"https://scroll-mainnet.infura.io/v3/","eip155:534351":"https://scroll-sepolia.infura.io/v3/","eip155:5000":"https://mantle-mainnet.infura.io/v3/","eip155:5003":"https://mantle-sepolia.infura.io/v3/","eip155:1329":"https://sei-mainnet.infura.io/v3/","eip155:713715":"https://sei-testnet.infura.io/v3/","eip155:1923":"https://swellchain-mainnet.infura.io/v3/","eip155:1924":"https://swellchain-testnet.infura.io/v3/","eip155:130":"https://unichain-mainnet.infura.io/v3/","eip155:1301":"https://unichain-sepolia.infura.io/v3/","eip155:43111":"https://hemi-mainnet.infura.io/v3/","eip155:743111":"https://hemi-testnet.infura.io/v3/","eip155:6342":"https://megaeth-mainnet.infura.io/v3/","eip155:6342001":"https://megaeth-testnet.infura.io/v3/","eip155:143":"https://monad-mainnet.infura.io/v3/","eip155:10143":"https://monad-testnet.infura.io/v3/","eip155:11297108109":"https://palm-mainnet.infura.io/v3/","eip155:43114":"https://avalanche-mainnet.infura.io/v3/","eip155:43113":"https://avalanche-fuji.infura.io/v3/","eip155:42220":"https://celo-mainnet.infura.io/v3/","eip155:44787":"https://celo-sepolia.infura.io/v3/","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":"https://solana-mainnet.infura.io/v3/","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1":"https://solana-devnet.infura.io/v3/"},Q4e=new Set(["eth_blockNumber","eth_gasPrice","eth_maxPriorityFeePerGas","eth_blobBaseFee","eth_feeHistory","eth_getBalance","eth_getCode","eth_getStorageAt","eth_call","eth_estimateGas","eth_getLogs","eth_getProof","eth_getTransactionCount","eth_getBlockByNumber","eth_getBlockByHash","eth_getBlockTransactionCountByNumber","eth_getBlockTransactionCountByHash","eth_getUncleCountByBlockNumber","eth_getUncleCountByBlockHash","eth_getTransactionByHash","eth_getTransactionByBlockNumberAndIndex","eth_getTransactionByBlockHashAndIndex","eth_getTransactionReceipt","eth_getUncleByBlockNumberAndIndex","eth_getUncleByBlockHashAndIndex","eth_getFilterChanges","eth_getFilterLogs","eth_newBlockFilter","eth_newFilter","eth_newPendingTransactionFilter","eth_sendRawTransaction","eth_syncing","eth_uninstallFilter"]),X4e=new Set(["eth_accounts","eth_chainId","wallet_getCapabilities"]),J4e=new Set(["wallet_addEthereumChain","wallet_switchEthereumChain","eth_accounts"])}}),e8e=gr({"src/domain/multichain/api/infura.ts"(){"use strict";MZ()}}),n8e=gr({"src/domain/multichain/api/types.ts"(){"use strict";t8e="eip155Capabilities"}}),_j=gr({"src/domain/multichain/index.ts"(){"use strict";jZ(),MZ(),e8e(),n8e(),RZ=(e=>(e.Browser="browser",e.MWP="mwp",e.UNKNOWN="unknown",e))(RZ||{}),r8e=class extends kZ{constructor(e){super(),this.options=e}mergeOptions(e){var t,n,r,i,a,o,s,c,u,d,p,f,m,v,y,E,I;const w=this.options,j=on(on({},w.analytics),(t=e.analytics)!=null?t:{});((n=w.analytics)==null?void 0:n.enabled)===!1&&(j.enabled=!1),this.options=qi(on({},w),{api:qi(on({},w.api),{supportedNetworks:on(on({},w.api.supportedNetworks),(i=(r=e.api)==null?void 0:r.supportedNetworks)!=null?i:{})}),versions:on(on({},w.versions),(a=e.versions)!=null?a:{}),analytics:on({},j),ui:qi(on({},w.ui),{headless:(s=(o=e.ui)==null?void 0:o.headless)!=null?s:w.ui.headless,preferExtension:(u=(c=e.ui)==null?void 0:c.preferExtension)!=null?u:w.ui.preferExtension,showInstallModal:(p=(d=e.ui)==null?void 0:d.showInstallModal)!=null?p:w.ui.showInstallModal}),mobile:on(on({},w.mobile),(f=e.mobile)!=null?f:{}),transport:qi(on({},(m=w.transport)!=null?m:{}),{extensionId:(E=(v=e.transport)==null?void 0:v.extensionId)!=null?E:(y=w.transport)==null?void 0:y.extensionId}),debug:(I=e.debug)!=null?I:w.debug})}}}}),BZ=gr({"src/domain/platform/index.ts"(){"use strict";i8e=(e=>(e.NonBrowser="nodejs",e.MetaMaskMobileWebview="in-app-browser",e.DesktopWeb="web-desktop",e.MobileWeb="web-mobile",e.ReactNative="react-native",e))(i8e||{}),a8e=new Set(["io.metamask","io.metamask.mobile","io.metamask.flask"]),o8e=dt(null,null,function*(){const e=af();return e==="nodejs"||e==="react-native"?Promise.resolve(!1):new Promise(t=>{const n=[],r=window,i=a=>{var o,s;(s=(o=a?.detail)==null?void 0:o.info)!=null&&s.rdns&&n.push(a.detail)};r.addEventListener("eip6963:announceProvider",i),r.dispatchEvent(new Event("eip6963:requestProvider")),setTimeout(()=>{try{typeof r?.removeEventListener=="function"&&r.removeEventListener("eip6963:announceProvider",i),t(n.some(a=>{var o;return typeof((o=a?.info)==null?void 0:o.rdns)=="string"&&a8e.has(a.info.rdns)}))}catch{t(!1)}},300)})})}}),c8e=gr({"src/domain/store/adapter.ts"(){"use strict";s8e=class{constructor(e){this.options=e}}}}),NZ=gr({"src/domain/store/client.ts"(){"use strict";u8e=class{}}}),l8e=gr({"src/domain/store/index.ts"(){"use strict";c8e(),NZ()}}),d8e=gr({"src/domain/ui/types.ts"(){"use strict";LZ=class{constructor(e){this.options=e}get isMounted(){return this.instance!==void 0}get data(){if(typeof this.options=="object"&&this.options&&"link"in this.options)return this.options.link;if(typeof this.options=="object"&&this.options&&"otpCode"in this.options)return this.options.otpCode;throw new Error("Invalid options")}set data(e){typeof this.options=="object"&&this.options&&"link"in this.options&&(this.options.link=e),typeof this.options=="object"&&this.options&&"otpCode"in this.options&&(this.options.otpCode=e)}}}}),f8e=gr({"src/domain/ui/index.ts"(){"use strict";d8e()}}),wj=gr({"src/multichain/utils/analytics.ts"(){"use strict";O0(),Zs(),DZ=200,h8e=[{pattern:/0x[a-fA-F0-9]{40}/gu,replacement:"<addr>"},{pattern:/(?:0x)?[a-fA-F0-9]{16,}/gu,replacement:"<hex>"},{pattern:/https?:\/\/[^\s"')]+/gu,replacement:"<url>"},{pattern:/\b[a-z]{1,10}1[ac-hj-np-z02-9]{38,}\b/gu,replacement:"<addr>"},{pattern:/\b[1-9A-HJ-NP-Za-km-z]{32,}\b/gu,replacement:"<addr>"},{pattern:/\d{10,}/gu,replacement:"<num>"}]}}),m8e=gr({"src/domain/utils/index.ts"(){"use strict";wj(),p8e="1.2.0"}}),Zs=gr({"src/domain/index.ts"(){"use strict";K4e(),jZ(),PZ(),_j(),BZ(),l8e(),f8e(),m8e()}}),O0=gr({"src/multichain/utils/index.ts"(){"use strict";Zs(),g8e=()=>{var e;if(typeof document>"u")return;let t;const n=document.getElementsByTagName("link");for(let r=0;r<n.length;r++)(n[r].getAttribute("rel")==="icon"||n[r].getAttribute("rel")==="shortcut icon")&&(t=(e=n[r].getAttribute("href"))!=null?e:void 0);return t},UZ=4294967295,Ej=Math.floor(Math.random()*UZ),r5=()=>(Ej=(Ej+1)%UZ,Ej)}}),b8e=gr({"src/multichain/transports/constants.ts"(){"use strict";FZ="metamask-multichain-provider"}}),Sj={},a8(Sj,{MWPTransport:()=>T8e}),$Z=gr({"src/multichain/transports/mwp/index.ts"(){"use strict";Zs(),O0(),b8e(),zZ=600*1e3,y8e=60*1e3,v8e=zZ+y8e,_8e=10*1e3,Y1="cache_wallet_getSession",i5="cache_eth_accounts",a5="cache_eth_chainId",Cj="pending_session_request",w8e=["wallet_getSession","wallet_createSession","wallet_sessionChanged"],E8e=["wallet_revokeSession","wallet_revokePermissions"],Aj=s8("metamask-sdk:transport"),T8e=class{constructor(e,t,n={requestTimeout:zZ,connectionTimeout:v8e,resumeTimeout:_8e}){this.dappClient=e,this.kvstore=t,this.options=n,qr(this,u8),this.__pendingRequests=new Map,this.notificationCallbacks=new Set,this.dappClient.on("message",this.handleMessage.bind(this)),this.dappClient.on("session_request",r=>{this.currentSessionRequest=r,this.kvstore.set(Cj,JSON.stringify(r)).catch(i=>{Aj("Failed to store pending session request",i)})}),typeof window<"u"&&typeof window.addEventListener<"u"&&(this.windowFocusHandler=this.onWindowFocus.bind(this),window.addEventListener("focus",this.windowFocusHandler))}get pendingRequests(){return this.__pendingRequests}set pendingRequests(e){this.__pendingRequests=e}get sessionRequest(){return this.currentSessionRequest}getStoredPendingSessionRequest(){return dt(this,null,function*(){try{const e=yield this.kvstore.get(Cj);return e?JSON.parse(e):null}catch{return null}})}removeStoredPendingSessionRequest(){return dt(this,null,function*(){yield this.kvstore.delete(Cj)})}onWindowFocus(){this.isConnected()||this.dappClient.reconnect()}notifyCallbacks(e){this.notificationCallbacks.forEach(t=>t(e))}rejectRequest(e,t=new Error("Request rejected")){const n=this.pendingRequests.get(e);n&&(this.pendingRequests.delete(e),clearTimeout(n.timeout),n.reject(t))}parseWalletError(e){const t=e;if(typeof t.code=="number"&&typeof t.message=="string"){const{code:r,message:i}=t,a=t.data,o=kv(a)?a:void 0;return r>=1e3&&r<=4999?Uk.custom({code:r,message:i,data:o}):new Dk(r,i,o)}const n=e instanceof Error?e.message:JSON.stringify(e);return Z_e.internal({message:n})}getResponseError(e){if("error"in e&&e.error)return e.error;const{result:t}=e;if(typeof t=="object"&&t!==null&&"error"in t&&t.error&&this.isErrorPayload(t.error))return t.error}isErrorPayload(e){if(e instanceof Error)return!0;const t=e;return typeof t?.code=="number"&&typeof t?.message=="string"}handleMessage(e){if(typeof e=="object"&&e!==null&&"data"in e){const t=e.data;if("id"in t&&typeof t.id=="string"){const n=this.pendingRequests.get(t.id);if(n){clearTimeout(n.timeout);const r=this.getResponseError(t);if(r){this.pendingRequests.delete(t.id),n.reject(this.parseWalletError(r));return}const i=qi(on({},t),{method:n.method==="wallet_getSession"||n.method==="wallet_createSession"?"wallet_sessionChanged":n.method}),a=qi(on({},t),{method:n.method==="wallet_getSession"||n.method==="wallet_createSession"?"wallet_sessionChanged":n.method,params:i.result});this.notifyCallbacks(a),n.resolve(i),this.pendingRequests.delete(t.id)}}else{if(e.data.method==="metamask_chainChanged"&&this.kvstore.set(a5,JSON.stringify(e.data.params.chainId)),e.data.method==="metamask_accountsChanged"&&this.kvstore.set(i5,JSON.stringify(e.data.params)),e.data.method==="wallet_sessionChanged"){const n={result:e.data.params};this.kvstore.set(Y1,JSON.stringify(n))}this.notifyCallbacks(e.data)}}}init(){return dt(this,null,function*(){})}sendEip1193Message(e,t){return dt(this,null,function*(){const n=on({jsonrpc:"2.0",id:String(r5())},e),r=yield this.getCachedResponse(n);return r?(this.notifyCallbacks(r),r):new Promise((i,a)=>{var o;const s=setTimeout(()=>{this.rejectRequest(n.id,new $1)},(o=t?.timeout)!=null?o:this.options.requestTimeout);this.pendingRequests.set(n.id,{request:n,method:n.method,resolve:c=>dt(this,null,function*(){return yield this.storeWalletSession(n,c),i(c)}),reject:a,timeout:s}),this.dappClient.sendRequest({name:"metamask-provider",data:n}).catch(a)})})}connect(e){return dt(this,null,function*(){const t=yield this.getActiveSession();return t&&Aj("active session found",{id:t.id,channel:t.channel,expiresAt:t.expiresAt}),(t?Lt(this,u8,C8e).call(this,t,e):Lt(this,u8,A8e).call(this,e)).catch(n=>dt(this,null,function*(){throw yield this.dappClient.disconnect(),n})).finally(()=>{this.removeStoredPendingSessionRequest()})})}disconnect(){return dt(this,arguments,function*(e=[]){var t;const n=yield this.getCachedSession(),r=(t=n?.sessionScopes)!=null?t:{},i=e.length===0?[]:Object.keys(r).filter(o=>!e.includes(o)),a=Object.fromEntries(Object.entries(r).filter(([o])=>i.includes(o)));this.request({method:"wallet_revokeSession",params:{scopes:e}}).catch(o=>{console.error("error revoking session",o)}),i.some(o=>o.includes("eip155"))||(this.kvstore.delete(i5),this.kvstore.delete(a5)),i.length>0?this.kvstore.set(Y1,JSON.stringify({result:qi(on({},n),{sessionScopes:a})})):(this.kvstore.delete(Y1),typeof window<"u"&&typeof window.removeEventListener<"u"&&this.windowFocusHandler&&(window.removeEventListener("focus",this.windowFocusHandler),this.windowFocusHandler=void 0),yield this.dappClient.disconnect()),this.notifyCallbacks({method:"wallet_sessionChanged",params:{sessionScopes:a}})})}isConnected(){return this.dappClient.state==="CONNECTED"}attemptResumeSession(){return dt(this,null,function*(){try{yield this.dappClient.reconnect(),yield new Promise((e,t)=>{const n=setTimeout(()=>{t(new Error("Resume timeout"))},2e3);this.isConnected()?(clearTimeout(n),e()):this.dappClient.once("connected",()=>{clearTimeout(n),e()})})}catch(e){return Promise.reject(new Error(`Failed to resume session: ${e.message}`))}})}getCachedResponse(e){return dt(this,null,function*(){var t;if(e.method==="wallet_getSession"){const n=yield this.kvstore.get(Y1);if(n){const r=JSON.parse(n);return{id:e.id,jsonrpc:"2.0",result:(t=r.params)!=null?t:r.result,method:e.method}}}else if(e.method==="eth_accounts"){const n=yield this.kvstore.get(i5);if(n)return{id:e.id,jsonrpc:"2.0",result:JSON.parse(n),method:e.method}}else if(e.method==="eth_chainId"){const n=yield this.kvstore.get(a5);if(n)return{id:e.id,jsonrpc:"2.0",result:JSON.parse(n),method:e.method}}})}storeWalletSession(e,t){return dt(this,null,function*(){t.error||(w8e.includes(e.method)?yield this.kvstore.set(Y1,JSON.stringify(t)):e.method==="eth_accounts"?yield this.kvstore.set(i5,JSON.stringify(t.result)):e.method==="eth_chainId"?yield this.kvstore.set(a5,JSON.stringify(t.result)):E8e.includes(e.method)&&(yield this.kvstore.delete(Y1),yield this.kvstore.delete(i5),yield this.kvstore.delete(a5)))})}getCachedSession(){return dt(this,null,function*(){const e=yield this.getCachedResponse({jsonrpc:"2.0",id:"0",method:"wallet_getSession"});return e?.result})}request(e,t){return dt(this,null,function*(){const n=on({jsonrpc:"2.0",id:String(r5())},e),r=yield this.getCachedResponse(n);return r?(this.notifyCallbacks(r),r):(this.isConnected()||(yield this.attemptResumeSession()),new Promise((i,a)=>{var o;const s=setTimeout(()=>{this.rejectRequest(n.id,new $1)},(o=t?.timeout)!=null?o:this.options.requestTimeout);this.pendingRequests.set(n.id,{request:n,method:n.method,resolve:c=>dt(this,null,function*(){return yield this.storeWalletSession(n,c),i(c)}),reject:a,timeout:s}),this.dappClient.sendRequest({name:FZ,data:n}).catch(a)}))})}onNotification(e){return this.notificationCallbacks.add(e),()=>{this.notificationCallbacks.delete(e)}}getActiveSession(){return dt(this,null,function*(){const{kvstore:e}=this,{SessionStore:t}=yield Promise.resolve().then(()=>nt(Gg(),1)),n=yield t.create(e);try{const[r]=yield n.list();return r}catch(r){Aj("error getting active session",r);return}})}waitForWalletSessionIfNotCached(){return dt(this,null,function*(){if(yield this.kvstore.get(Y1))return;let e;const t=new Promise(r=>{e=this.onNotification(i=>{if(typeof i=="object"&&i!==null&&"data"in i){const a=i.data;(a.method==="wallet_getSession"||a.method==="wallet_sessionChanged")&&(e(),r())}})}),n=new Promise((r,i)=>{setTimeout(()=>{e(),this.removeStoredPendingSessionRequest(),i(new $1)},this.options.resumeTimeout)});return Promise.race([t,n])})}},u8=new WeakSet,S8e=function(e){return dt(this,null,function*(){var t,n,r,i,a,o,s;yield this.waitForWalletSessionIfNotCached();const c=yield this.request({method:"wallet_getSession"});if(c.error)throw new Error(c.error.message);let u=c.result;if(u&&e){const d=Object.keys((t=u?.sessionScopes)!=null?t:{}),p=(n=e?.scopes)!=null?n:[],f=(r=e?.caipAccountIds)!=null?r:[],m=N4e(d,p,u,f);if(e.forceRequest||!m){const v={optionalScopes:yj(gj((i=e?.scopes)!=null?i:[]),bj((a=e?.caipAccountIds)!=null?a:[]))},y=yield this.request({method:"wallet_createSession",params:v});if(y.error)throw new Error(y.error.message);u=y.result}}else if(!u){const d={optionalScopes:yj(gj((o=e?.scopes)!=null?o:[]),bj((s=e?.caipAccountIds)!=null?s:[]))},p=yield this.request({method:"wallet_createSession",params:d});if(p.error)throw new Error(p.error.message);u=p.result}yield this.removeStoredPendingSessionRequest(),this.notifyCallbacks({method:"wallet_sessionChanged",params:u})})},C8e=function(e,t){return dt(this,null,function*(){var n;const r=(yield this.getStoredPendingSessionRequest())!==null,i=Mv(),a=()=>dt(this,null,function*(){try{i.resolve(yield Lt(this,u8,S8e).call(this,t))}catch(u){i.reject(u)}});this.dappClient.state==="CONNECTED"?a():(this.dappClient.once("connected",a),this.dappClient.resume((n=e.id)!=null?n:"").catch(u=>i.reject(u)));const o=Mv(),s=setTimeout(()=>o.reject(new $1),r?this.options.resumeTimeout:t?this.options.connectionTimeout:120*1e3),c=()=>this.dappClient.off("connected",a);return Promise.race([i.promise,o.promise]).finally(()=>{clearTimeout(s),c()})})},A8e=function(e){return dt(this,null,function*(){var t,n;const{dappClient:r}=this,i=(yield this.getStoredPendingSessionRequest())!==null,a=Mv(),o={optionalScopes:yj(gj((t=e?.scopes)!=null?t:[]),bj((n=e?.caipAccountIds)!=null?n:[])),sessionProperties:e?.sessionProperties},s={jsonrpc:"2.0",id:String(r5()),method:"wallet_createSession",params:o};let c;const u=()=>{c&&(this.dappClient.off("message",c),c=void 0)};c=y=>dt(this,null,function*(){if(typeof y!="object"||y===null||!("data"in y))return;const E=y.data,I=E.id===s.id,w=E.method==="wallet_createSession"||E.method==="wallet_sessionChanged";if(!I&&!w)return;const j=this.getResponseError(E);if(j){a.reject(this.parseWalletError(j));return}yield this.storeWalletSession(s,E),yield this.removeStoredPendingSessionRequest(),this.notifyCallbacks(E),a.resolve()}),this.dappClient.on("message",c);const d=af(),p=["web-desktop","nodejs"].includes(d),f={name:FZ,data:s};r.connect({mode:"trusted",initialPayload:p?void 0:f}).then(()=>dt(this,null,function*(){if(p)return r.sendRequest(f)})).catch(y=>a.reject(y));const m=Mv(),v=setTimeout(()=>m.reject(new $1),i?this.options.resumeTimeout:this.options.connectionTimeout);return Promise.race([a.promise,m.promise]).finally(()=>{clearTimeout(v),u()})})}}}),HZ={},a8(HZ,{createKeyManager:()=>Ert}),x8e=gr({"src/multichain/transports/mwp/KeyManager.ts"(){"use strict"}}),I8e=gr({"src/ui/modals/base/utils.ts"(){"use strict"}}),j8e=gr({"src/ui/modals/base/AbstractInstallModal.ts"(){"use strict";I8e(),Zs(),l8=s8("metamask-sdk:ui"),k8e=class extends LZ{constructor(){super(...arguments),qr(this,o5,null),qr(this,d8,-1)}get link(){return this.data}set link(e){this.data=e}get connectionRequest(){return this.options.connectionRequest}set connectionRequest(e){this.options.connectionRequest=e}updateLink(e){this.link=e,this.instance&&(this.instance.link=e)}updateExpiresIn(e){e>=0&&this.instance&&(this.instance.expiresIn=e)}startExpirationCheck(e){this.stopExpirationCheck();let t=e;dr(this,o5,setInterval(()=>dt(this,null,function*(){const{sessionRequest:n}=t,r=Date.now(),i=n.expiresAt-r,a=Math.floor(i/1e3);if(i>0&&Crt(a)&&kt(this,d8)!==a){const o=Srt(i);l8(`[UI: InstallModal-nodejs()] QR code expires in: ${o} (${a}s)`),dr(this,d8,a)}if(r>=n.expiresAt){this.stopExpirationCheck(),l8("[UI: InstallModal-nodejs()] ⏰ QR code EXPIRED! Generating new one...");try{t=yield this.options.createConnectionRequest();const o=yield this.options.generateQRCode(t);dr(this,d8,-1),this.updateLink(o),this.updateExpiresIn(a),this.renderQRCode(o,t)}catch(o){l8(`[UI: InstallModal-nodejs()] ❌ Error generating new QR code: ${o}`)}}}),1e3))}stopExpirationCheck(){kt(this,o5)&&(clearInterval(kt(this,o5)),dr(this,o5,null),l8("[UI: InstallModal-nodejs()] 🛑 Stopped QR code expiration checking"))}},o5=new WeakMap,d8=new WeakMap}}),O8e=gr({"src/ui/modals/web/install.ts"(){"use strict";j8e(),P8e=class extends k8e{renderQRCode(){}mount(){var e;const{options:t}=this,n=document.createElement("mm-install-modal");n.showInstallModal=t.showInstallModal,n.addEventListener("close",r=>{const{detail:i}=r;t.onClose(i?.shouldTerminate)}),n.addEventListener("startDesktopOnboarding",t.startDesktopOnboarding),n.link=t.link,this.instance=n,(e=t.parentElement)==null||e.appendChild(n),this.startExpirationCheck(t.connectionRequest)}unmount(){var e;const{options:t,instance:n}=this;this.stopExpirationCheck(),n&&((e=t.parentElement)!=null&&e.contains(n))&&(t.parentElement.removeChild(n),this.instance=void 0)}}}}),R8e=gr({"src/ui/modals/base/AbstractOTPModal.ts"(){"use strict";Zs(),M8e=class extends LZ{get otpCode(){return this.data}set otpCode(e){this.data=e}updateOTPCode(e){this.otpCode=e,this.instance&&(this.instance.otpCode=e)}}}}),N8e=gr({"src/ui/modals/web/otp.ts"(){"use strict";R8e(),B8e=class extends M8e{mount(){}unmount(){}}}}),qZ={},a8(qZ,{InstallModal:()=>P8e,OTPCodeModal:()=>B8e}),L8e=gr({"src/ui/modals/web/index.ts"(){"use strict";O8e(),N8e()}}),GZ={},a8(GZ,{StoreAdapterWeb:()=>D8e}),U8e=gr({"src/store/adapters/web.ts"(){"use strict";Zs(),Tj=class mR extends s8e{constructor(t="-kv-store",n=mR.stores[0]){super(),this.storeName=n,this.platform="web";const r=`${mR.DB_NAME}${t}`;this.dbPromise=new Promise((i,a)=>{try{const o=this.internal.open(r,1);o.onerror=()=>a(new Error("Failed to open IndexedDB.")),o.onsuccess=()=>i(o.result),o.onupgradeneeded=()=>{const s=o.result;for(const c of mR.stores)s.objectStoreNames.contains(c)||s.createObjectStore(c)}}catch(o){a(o)}})}get internal(){if(typeof window>"u"||!window.indexedDB)throw new Error("indexedDB is not available in this environment");return window.indexedDB}get(t){return dt(this,null,function*(){const{storeName:n}=this,r=yield this.dbPromise;return new Promise((i,a)=>{try{const o=r.transaction(n,"readonly").objectStore(n).get(t);o.onerror=()=>a(new Error("Failed to get value from IndexedDB.")),o.onsuccess=()=>{var s;return i((s=o.result)!=null?s:null)}}catch(o){a(o)}})})}set(t,n){return dt(this,null,function*(){const{storeName:r}=this,i=yield this.dbPromise;return new Promise((a,o)=>{try{const s=i.transaction(r,"readwrite").objectStore(r).put(n,t);s.onerror=()=>o(new Error("Failed to set value in IndexedDB.")),s.onsuccess=()=>a()}catch(s){o(s)}})})}delete(t){return dt(this,null,function*(){const{storeName:n}=this,r=yield this.dbPromise;return new Promise((i,a)=>{try{const o=r.transaction(n,"readwrite").objectStore(n).delete(t);o.onerror=()=>a(new Error("Failed to delete value from IndexedDB.")),o.onsuccess=()=>i()}catch(o){a(o)}})})}},Tj.stores=["sdk-kv-store","key-value-pairs"],Tj.DB_NAME="mmconnect",D8e=Tj}}),O0(),F8e=R4e(),F8e.Buffer??=F4e.Buffer,Zs(),z8e="wss://mm-sdk-relay.api.cx.metamask.io/connection/websocket",f8="https://metamask.app.link/connect",xj="metamask://connect",Zs(),wj(),PZ(),_j(),BZ(),Zs(),VZ=1,WZ=class extends Error{},$8e=class{constructor(e,t){this.config=e,this.sdkInfo=t}request(e){return dt(this,null,function*(){const{request:t}=e,n=JSON.stringify({jsonrpc:"2.0",method:t.method,params:t.params,id:Art()}),r=this.getRpcEndpoint(e.scope),i=yield this.fetchWithTimeout(r,n,"POST",this.getHeaders(r),3e4);return yield this.parseResponse(i)})}getRpcEndpoint(e){var t,n,r;const i=((r=(n=(t=this.config)==null?void 0:t.api)==null?void 0:n.supportedNetworks)!=null?r:{})[e];if(!i)throw new WZ(`No RPC endpoint found for scope ${e}`);return i}fetchWithTimeout(e,t,n,r,i){return dt(this,null,function*(){const a=new AbortController,o=setTimeout(()=>a.abort(),i);try{const s=yield(0,z4e.default)(e,{method:n,headers:r,body:t,signal:a.signal});if(clearTimeout(o),!s.ok)throw new CZ(e,n,s.status);return s}catch(s){throw clearTimeout(o),s instanceof CZ?s:s instanceof Error&&s.name==="AbortError"?new xZ(`Request timeout after ${i}ms`):new xZ(s.message)}})}parseResponse(e){return dt(this,null,function*(){try{return(yield e.json()).result}catch(t){throw new W4e(t.message)}})}getHeaders(e){const t={Accept:"application/json","Content-Type":"application/json"};return e.includes("infura")?qi(on({},t),{"Metamask-Sdk-Info":this.sdkInfo}):t}},Zs(),O0(),wj(),Zs(),H8e=5,Y8e=class{constructor(e,t,n,r){this.transport=e,this.rpcClient=t,this.config=n,this.transportType=r,qr(this,Q1)}invokeMethod(e){return dt(this,null,function*(){const{method:t}=e.request;return J4e.has(t)?this.handleWithEip1193Passthrough(e):Q4e.has(t)?this.handleWithRpcNode(e):X4e.has(t)?this.handleWithSdkState(e):this.handleWithWallet(e)})}handleWithEip1193Passthrough(e){return dt(this,null,function*(){return(yield this.transport.sendEip1193Message({method:e.request.method,params:e.request.params})).result})}handleWithWallet(e){return dt(this,null,function*(){return Lt(this,Q1,G8e).call(this,e,()=>dt(this,null,function*(){const t=this.transport.request({method:"wallet_invokeMethod",params:e}),{ui:n,mobile:r}=this.config,{showInstallModal:i=!1}=n??{};pj()&&!i&&setTimeout(()=>dt(this,null,function*(){const o=yield this.transport.getActiveSession();if(!o)throw new Error("No active session found");const s=`${xj}/mwp?id=${encodeURIComponent(o.id)}`;r?.preferredOpenLink?r.preferredOpenLink(s,"_self"):mj(this.config,s,f8)}),10);const a=yield t;if(a.error)throw gZ(a.error);return a.result}))})}handleWithRpcNode(e){return dt(this,null,function*(){try{return yield this.rpcClient.request(e)}catch(t){if(t instanceof WZ)return this.handleWithWallet(e);throw t}})}handleWithSdkState(e){return dt(this,null,function*(){if(e.request.method==="wallet_getCapabilities"){if(this.transportType==="mwp"){const t=yield Lt(this,Q1,q8e).call(this,e);if(t!==void 0)return t}return this.handleWithWallet(e)}return console.warn(`Method "${e.request.method}" is configured for SDK state handling, but this is not yet implemented. Falling back to wallet passthrough.`),this.handleWithWallet(e)})}},Q1=new WeakSet,q8e=function(e){return dt(this,null,function*(){var t,n;const{params:r}=e.request;if(!Array.isArray(r))return;const[i,a]=r;if(typeof i!="string"||i.length===0||a!==void 0&&(!Array.isArray(a)||a.some(p=>typeof p!="string")))return;const o=a;if(!this.transport.getCachedSession)return;let s;try{s=yield this.transport.getCachedSession()}catch{return}const c=(t=s?.sessionProperties)==null?void 0:t[t8e];if(!c)return;const u=(n=Object.entries(c).find(([p])=>p.toLowerCase()===i.toLowerCase()))==null?void 0:n[1];if(!u)return;if(!o||o.length===0)return u;const d={};for(const p of o){const f=Object.entries(u).find(([m])=>m.toLowerCase()===p.toLowerCase());f&&(d[f[0]]=f[1])}return d})},G8e=function(e,t){return dt(this,null,function*(){var n;if(((n=this.config.analytics)==null?void 0:n.enabled)===!1)try{return yield t()}catch(r){throw gZ(r)}yield Lt(this,Q1,V8e).call(this,e);try{const r=yield t();return yield Lt(this,Q1,W8e).call(this,e),r}catch(r){const i=gZ(r),a=i.rpcCode===void 0?r:i;throw dZ(a)?yield Lt(this,Q1,K8e).call(this,e):yield Lt(this,Q1,Z8e).call(this,e,a),i}})},V8e=function(e){return dt(this,null,function*(){const t=yield Wg(this.config,this.config.storage,e,this.transportType);ta.track("mmconnect_wallet_action_requested",t)})},W8e=function(e){return dt(this,null,function*(){const t=yield Wg(this.config,this.config.storage,e,this.transportType);ta.track("mmconnect_wallet_action_succeeded",t)})},Z8e=function(e,t){return dt(this,null,function*(){const n=yield Wg(this.config,this.config.storage,e,this.transportType,M4e(t));ta.track("mmconnect_wallet_action_failed",n)})},K8e=function(e){return dt(this,null,function*(){const t=yield Wg(this.config,this.config.storage,e,this.transportType);ta.track("mmconnect_wallet_action_rejected",t)})},O0(),Q8e=600*1e3,XZ=class{constructor(){qr(this,ys),qr(this,h8,new Set),qr(this,Zg,Het()),qr(this,X1,{timeout:Q8e}),qr(this,s5,new Map),qr(this,p8),qr(this,Ij)}sendEip1193Message(e,t){return dt(this,null,function*(){Lt(this,ys,YZ).call(this);const n=String(r5()),r=on({jsonrpc:"2.0",id:n},e);return new Promise((i,a)=>{var o;const s=setTimeout(()=>{kt(this,s5).delete(n),a(new Error("Request timeout"))},(o=t?.timeout)!=null?o:kt(this,X1).timeout);kt(this,s5).set(n,{resolve:c=>{i(c)},reject:a,timeout:s}),window.postMessage({target:"metamask-contentscript",data:{name:"metamask-provider",data:r}},location.origin)})})}init(){return dt(this,null,function*(){yield Lt(this,ys,QZ).call(this);let e={sessionScopes:{}};try{e=(yield this.request({method:"wallet_getSession"},kt(this,X1))).result}catch{console.error("Failed to get wallet session during DefaultTransport init")}Lt(this,ys,kj).call(this,{method:"wallet_sessionChanged",params:e})})}connect(e){return dt(this,null,function*(){var t,n,r,i,a;yield Lt(this,ys,QZ).call(this);const o=yield this.request({method:"wallet_getSession"},kt(this,X1));if(o.error)throw new Error(o.error.message);let s=o.result;const c={optionalScopes:yj(gj((t=e?.scopes)!=null?t:[]),bj((n=e?.caipAccountIds)!=null?n:[])),sessionProperties:e?.sessionProperties};if(s&&e&&!e.forceRequest){const u=Object.keys((r=s?.sessionScopes)!=null?r:{}),d=(i=e?.scopes)!=null?i:[],p=(a=e?.caipAccountIds)!=null?a:[];if(!N4e(u,d,s,p)){const f=yield this.request({method:"wallet_createSession",params:c},kt(this,X1));if(f.error)throw new Error(f.error.message);s=f.result}}else if(!s||e?.forceRequest){const u=yield this.request({method:"wallet_createSession",params:c},kt(this,X1));if(u.error)throw new Error(u.error.message);s=u.result}Lt(this,ys,kj).call(this,{method:"wallet_sessionChanged",params:s})})}disconnect(){return dt(this,arguments,function*(e=[]){yield this.request({method:"wallet_revokeSession",params:{scopes:e}})})}isConnected(){return kt(this,Zg).isConnected()}request(e){return dt(this,arguments,function*(t,n=kt(this,X1)){const r=yield kt(this,Zg).request(t,n);if(r.error)throw Lt(this,ys,ZZ).call(this,r.error);return r})}onNotification(e){return kt(this,Zg).onNotification(e),kt(this,h8).add(e),()=>{kt(this,h8).delete(e)}}getActiveSession(){return dt(this,null,function*(){throw new Error("getActiveSession is purposely not implemented for the DefaultTransport")})}getStoredPendingSessionRequest(){return dt(this,null,function*(){throw new Error("getStoredPendingSessionRequest is purposely not implemented for the DefaultTransport")})}},h8=new WeakMap,Zg=new WeakMap,X1=new WeakMap,s5=new WeakMap,p8=new WeakMap,Ij=new WeakMap,ys=new WeakSet,kj=function(e){for(const t of kt(this,h8))try{t(e)}catch(n){console.log("[WindowPostMessageTransport] notifyCallbacks error:",n)}},ZZ=function(e){const t=e,n=new Error(typeof t.message=="string"?t.message:"Request failed");typeof t.code=="number"&&(n.code=t.code);const{data:r}=t;return kv(r)&&(n.data=r),n},KZ=function(e){var t,n;return((n=(t=e?.data)==null?void 0:t.data)==null?void 0:n.name)==="metamask-provider"&&e.origin===location.origin},X8e=function(e){var t,n;if(!Lt(this,ys,KZ).call(this,e))return;const r=(n=(t=e?.data)==null?void 0:t.data)==null?void 0:n.data;if(!(typeof r=="object"&&r!==null&&"method"in r)&&typeof r=="object"&&r!==null&&"id"in r&&("result"in r||"error"in r)){const i=String(r.id),a=kt(this,s5).get(i);if(a){clearTimeout(a.timeout),kt(this,s5).delete(i);const o=r;"error"in o&&o.error?a.reject(Lt(this,ys,ZZ).call(this,o.error)):a.resolve(o)}}},J8e=function(e){var t,n;if(!Lt(this,ys,KZ).call(this,e))return;const r=(n=(t=e?.data)==null?void 0:t.data)==null?void 0:n.data;typeof r=="object"&&r!==null&&"method"in r&&Lt(this,ys,kj).call(this,r)},YZ=function(){kt(this,p8)||(dr(this,p8,Lt(this,ys,X8e).bind(this)),dr(this,Ij,Lt(this,ys,J8e).bind(this)),window.addEventListener("message",kt(this,p8)),window.addEventListener("message",kt(this,Ij)))},QZ=function(){return dt(this,null,function*(){Lt(this,ys,YZ).call(this),kt(this,Zg).isConnected()||(yield kt(this,Zg).connect())})},O0(),i9e=class{constructor(e,t){this.metamaskConnectMultichain=e,qr(this,u5),qr(this,c5,new Set),qr(this,J1),dr(this,J1,t)}isTransportDefined(){return kt(this,J1).call(this)!==void 0}isTransportConnected(){var e,t;return(t=(e=kt(this,J1).call(this))==null?void 0:e.isConnected())!=null?t:!1}clearNotificationCallbacks(){kt(this,c5).clear()}notifyCallbacks(e){kt(this,c5).forEach(t=>{t(e)})}clearTransportNotificationListener(){var e;(e=this.notificationListener)==null||e.call(this),this.notificationListener=void 0}setupTransportNotificationListener(){const e=kt(this,J1).call(this);!e||this.notificationListener||(this.notificationListener=e.onNotification(this.notifyCallbacks.bind(this)))}connect(){return dt(this,null,function*(){return Promise.resolve()})}disconnect(){return dt(this,null,function*(){return Promise.resolve()})}isConnected(){return!0}request(e){return dt(this,arguments,function*(t,n={}){const r=on({id:r5(),jsonrpc:"2.0"},t);switch(r.method){case"wallet_createSession":return Lt(this,u5,e9e).call(this,r);case"wallet_getSession":return Lt(this,u5,t9e).call(this,r);case"wallet_revokeSession":return Lt(this,u5,n9e).call(this,r);case"wallet_invokeMethod":return Lt(this,u5,r9e).call(this,r);default:throw new Error(`Unsupported method: ${r.method}`)}})}onNotification(e){return this.setupTransportNotificationListener(),kt(this,c5).add(e),()=>{kt(this,c5).delete(e)}}},c5=new WeakMap,J1=new WeakMap,u5=new WeakSet,e9e=function(e){return dt(this,null,function*(){const t=e.params,n=Object.keys(on(on({},t.optionalScopes),t.requiredScopes)),r=[];n.forEach(o=>{var s,c,u,d;const p=(s=t.requiredScopes)==null?void 0:s[o],f=(c=t.optionalScopes)==null?void 0:c[o];p&&r.push(...(u=p.accounts)!=null?u:[]),f&&r.push(...(d=f.accounts)!=null?d:[])});const i=[...new Set(r)];yield this.metamaskConnectMultichain.connect(n,i,t.sessionProperties);const a=kt(this,J1).call(this);if(!a)throw new Error("Transport not initialized after connect");return a.request({method:"wallet_getSession"})})},t9e=function(e){return dt(this,null,function*(){const t=kt(this,J1).call(this);return t?.isConnected()?t.request({method:"wallet_getSession"}):{jsonrpc:"2.0",id:e.id,result:{sessionScopes:{}}}})},n9e=function(e){return dt(this,null,function*(){var t;const n=e.params,r=(t=n?.scopes)!=null?t:[];try{return yield this.metamaskConnectMultichain.disconnect(r),{jsonrpc:"2.0",id:e.id,result:!0}}catch{return{jsonrpc:"2.0",id:e.id,result:!1}}})},r9e=function(e){return dt(this,null,function*(){return this.isTransportConnected()?{result:this.metamaskConnectMultichain.invokeMethod(e.params)}:{error:Uk.unauthorized()}})},O0(),m8=s8("metamask-sdk:core"),jj="__METAMASK_CONNECT_MULTICHAIN_SINGLETON__",b9e=class QJ extends r8e{constructor(t){var n,r,i,a;const o=wrt(t),s=qi(on({},o),{ui:qi(on({},o.ui),{preferExtension:(n=o.ui.preferExtension)!=null?n:!0,showInstallModal:(r=o.ui.showInstallModal)!=null?r:!1,headless:(i=o.ui.headless)!=null?i:!1}),analytics:Prt(t.analytics),versions:on({"connect-multichain":n5()},(a=t.versions)!=null?a:{})});super(s),qr(this,xn),qr(this,Pj),qr(this,M0),qr(this,ba),qr(this,Kg),qr(this,l5),qr(this,vs),this._status="pending",qr(this,ep),qr(this,g8),qr(this,JZ,`Sdk/Javascript SdkVersion/${n5()} Platform/${af()} dApp/${(a9e=this.options.dapp.url)!=null?a9e:this.options.dapp.name} dAppTitle/${this.options.dapp.name}`),dr(this,M0,new i9e(this,()=>kt(this,ba))),dr(this,Pj,N_e({transport:kt(this,M0)}))}get status(){return this._status}set status(t){this._status!==t&&(this._status=t,this.emit("stateChanged",t))}get provider(){return kt(this,Pj)}get dappClient(){if(!kt(this,Kg))throw new Error("DappClient not initialized, establish connection first");return kt(this,Kg)}get transportType(){var t;return(t=kt(this,vs))!=null?t:"unknown"}get storage(){return this.options.storage}get version(){return n5()}static create(t){return dt(this,null,function*(){var n;const r=R4e(),i=r[jj];if(i){const o=yield i;return o.version!==n5()&&console.warn(`MetaMask Connect does not support using multiple versions of @metamask/connect-multichain. Attempted to create a new instance with version ${n5()}, but an existing ${o.version} singleton was already initialized. Using the existing ${o.version} singleton. This is NOT supported and may lead to unexpected behavior. Please ensure there is only one version of @metamask/connect-multichain package resolved in your application.`),o.mergeOptions(t),o instanceof QJ?yield Lt(n=o,xn,eK).call(n):yield D4e(o.options,o.storage),t.debug&&c8("metamask-sdk:*"),o}const a=dt(null,null,function*(){var o;const s=new QJ(t);return(yield Y4e("metamask-sdk:core",s.options.storage))&&c8("metamask-sdk:core"),yield Lt(o=s,xn,c9e).call(o),s}).catch(o=>{throw r[jj]=void 0,console.error("Error initializing MetaMaskConnectMultichain",o),o});return r[jj]=a,a})}connect(t,n,r,i){return dt(this,null,function*(){var a;if(this.status==="connecting"&&kt(this,vs)==="mwp")throw yield Lt(this,xn,g9e).call(this),new Error("Existing connection is pending. Please check your MetaMask Mobile app to continue.");const{ui:o}=this.options,s=af(),c=s==="in-app-browser"||s==="web-desktop",{preferExtension:u=!0,showInstallModal:d=!1}=o,p=pj(),f=yield uZ();let m;if(s==="in-app-browser"||c&&f&&u?m="browser":m="mwp",i8(this.options))try{const j=yield fZ(this.options,this.storage),_=Object.keys(this.options.api.supportedNetworks);ta.track("mmconnect_connection_initiated",qi(on({},j),{transport_type:m,dapp_configured_chains:_,dapp_requested_chains:t}))}catch(j){m8("Error tracking connection_initiated event",j)}const{mergedScopes:v,mergedCaipAccountIds:y,mergedSessionProperties:E}=vrt(yield Lt(this,xn,nK).call(this),t,n,r),I=Object.keys(E??{}).length>0?E:void 0;if((a=kt(this,ba))!=null&&a.isConnected()&&!p)return Lt(this,xn,d5).call(this,kt(this,ba).connect({scopes:v,caipAccountIds:y,sessionProperties:I,forceRequest:i}).then(()=>dt(this,null,function*(){return kt(this,vs)==="mwp"?this.storage.setTransportType("mwp"):this.storage.setTransportType("browser")})),t,m);if(s==="in-app-browser"){const j=yield Lt(this,xn,Oj).call(this);return Lt(this,xn,d5).call(this,j.connect({scopes:v,caipAccountIds:y,sessionProperties:I,forceRequest:i}),t,m)}if(c&&f&&u){const j=yield Lt(this,xn,Oj).call(this);return Lt(this,xn,d5).call(this,j.connect({scopes:v,caipAccountIds:y,sessionProperties:I,forceRequest:i}),t,m)}yield Lt(this,xn,u9e).call(this);const w=f?d:!u||d;return p&&!w?Lt(this,xn,d5).call(this,Lt(this,xn,m9e).call(this,v,y,I),t,m):Lt(this,xn,d5).call(this,Lt(this,xn,h9e).call(this,w,v,y,I),t,m)})}disconnect(){return dt(this,arguments,function*(t=[]){var n,r,i;const a=yield Lt(this,xn,nK).call(this),o=t.length===0?[]:Object.keys(a.sessionScopes).filter(s=>!t.includes(s));yield(n=kt(this,ba))==null?void 0:n.disconnect(t),o.length===0&&(yield this.storage.removeTransportType(),kt(this,vs)!=="browser"&&(yield(r=kt(this,ep))==null?void 0:r.call(this),(i=kt(this,l5))==null||i.call(this),dr(this,ep,void 0),dr(this,l5,void 0),dr(this,ba,void 0),dr(this,vs,void 0),kt(this,M0).clearTransportNotificationListener(),dr(this,Kg,void 0)),this.status="disconnected")})}invokeMethod(t){return dt(this,null,function*(){var n;const r=Lt(this,xn,tp).call(this),{options:i}=this;return new Y8e(r,new $8e(i,kt(this,JZ)),i,(n=kt(this,vs))!=null?n:"unknown").invokeMethod(t)})}openSimpleDeeplinkIfNeeded(){const{ui:t,mobile:n}=this.options,{showInstallModal:r=!1}=t??{};pj()&&!r&&setTimeout(()=>dt(this,null,function*(){const i=yield Lt(this,xn,tp).call(this).getActiveSession();if(!i)throw new Error("No active session found");const a=`${xj}/mwp?id=${encodeURIComponent(i.id)}`;n?.preferredOpenLink?n.preferredOpenLink(a,"_self"):mj(this.options,a,f8)}),10)}emitSessionChanged(){return dt(this,null,function*(){var t,n;const r={sessionScopes:{}};if(!((t=kt(this,ba))!=null&&t.isConnected())){this.emit("wallet_sessionChanged",r);return}const i=yield kt(this,ba).request({method:"wallet_getSession"});this.emit("wallet_sessionChanged",(n=i.result)!=null?n:r)})}},Pj=new WeakMap,M0=new WeakMap,ba=new WeakMap,Kg=new WeakMap,l5=new WeakMap,vs=new WeakMap,ep=new WeakMap,g8=new WeakMap,xn=new WeakSet,tp=function(){if(!kt(this,ba))throw new Error("Transport not initialized, establish connection first");return kt(this,ba)},JZ=new WeakMap,eK=function(){return dt(this,null,function*(){yield D4e(this.options,this.storage,e=>{dr(this,g8,e)})})},b8=function(e){return dt(this,null,function*(){var t,n,r;if(typeof e=="object"&&e!==null&&"method"in e){if(e.method==="wallet_sessionChanged"){const i=(n=(t=e.params)==null?void 0:t.sessionScopes)!=null?n:{},a=Object.keys(i).length>0;if(this.status==="loaded"&&!a)return;this.status=a?"connected":"disconnected"}this.emit(e.method,(r=e.params)!=null?r:e.result)}})},o9e=function(){return dt(this,null,function*(){const e=yield this.storage.getTransportType(),t=yield uZ();if(e){if(e==="browser"){if(t){const n=new XZ;return dr(this,ba,n),dr(this,vs,"browser"),kt(this,M0).setupTransportNotificationListener(),dr(this,ep,n.onNotification(Lt(this,xn,b8).bind(this))),n}}else if(e==="mwp"){const{adapter:n}=this.options.storage,r=yield Lt(this,xn,tK).call(this),{MWPTransport:i}=yield Promise.resolve().then(()=>($Z(),Sj)),a=new i(r,n);return dr(this,Kg,r),dr(this,ba,a),dr(this,vs,"mwp"),kt(this,M0).setupTransportNotificationListener(),dr(this,ep,a.onNotification(Lt(this,xn,b8).bind(this))),a}yield this.storage.removeTransportType()}})},s9e=function(){return dt(this,null,function*(){var e;const t=yield Lt(this,xn,o9e).call(this);if(t)t.isConnected()||(this.status="connecting",yield t.connect()),this.status="connected",kt(this,vs)==="mwp"?yield this.storage.setTransportType("mwp"):yield this.storage.setTransportType("browser");else{this.status="loaded";const n=yield uZ(),r=(e=this.options.ui.preferExtension)!=null?e:!0;if(n&&r){yield Lt(this,xn,Oj).call(this,{persist:!1});try{yield Lt(this,xn,tp).call(this).init()}catch(i){console.error("Passive init failed:",i)}}}})},y8=function(){const e={dapp:this.options.dapp,sdk:{version:n5(),platform:af()}};return i8(this.options)&&kt(this,g8)&&(e.analytics={remote_session_id:kt(this,g8)}),e},c9e=function(){return dt(this,null,function*(){try{yield Lt(this,xn,eK).call(this),yield Lt(this,xn,s9e).call(this)}catch(e){yield this.storage.removeTransportType(),this.status="pending",m8("MetaMaskSDK error during initialization",e)}})},tK=function(){return dt(this,null,function*(){const[e,{DappClient:t},{createKeyManager:n}]=yield Promise.all([Promise.resolve().then(()=>nt(Gg(),1)),Promise.resolve().then(()=>(trt(),ert)),Promise.resolve().then(()=>(x8e(),HZ))]),r=yield n(),{adapter:i}=this.options.storage,a=yield e.SessionStore.create(i),o=typeof window<"u"?WebSocket:(yield Promise.resolve().then(()=>nt(nrt(),1))).WebSocket;return new t({transport:yield e.WebSocketTransport.create({url:z8e,kvstore:i,websocket:o}),sessionstore:a,keymanager:r})})},u9e=function(){return dt(this,null,function*(){if(kt(this,vs)==="mwp")return;const{adapter:e}=this.options.storage,t=yield Lt(this,xn,tK).call(this);dr(this,Kg,t);const{MWPTransport:n}=yield Promise.resolve().then(()=>($Z(),Sj)),r=new n(t,e);dr(this,ba,r),dr(this,vs,"mwp"),kt(this,M0).setupTransportNotificationListener(),dr(this,ep,r.onNotification(Lt(this,xn,b8).bind(this))),yield this.storage.setTransportType("mwp")})},l9e=function(){return dt(this,null,function*(){var e;(e=this.options.ui.factory.modal)!=null&&e.isMounted&&(yield this.storage.removeTransportType())})},d9e=function(){const e=Lt(this,xn,l9e).bind(this);return typeof window<"u"&&typeof window.addEventListener<"u"&&window.addEventListener("beforeunload",e),()=>{typeof window<"u"&&typeof window.removeEventListener<"u"&&window.removeEventListener("beforeunload",e)}},f9e=function(e,t,n,r){return dt(this,null,function*(){const i=Mv(),a=()=>dt(this,null,function*(){(this.dappClient.state==="CONNECTED"||this.dappClient.state==="CONNECTING")&&(yield this.dappClient.disconnect());const o=Mv();return this.dappClient.on("session_request",s=>{o.resolve({sessionRequest:s,metadata:Lt(this,xn,y8).call(this)})}),Lt(this,xn,tp).call(this).connect({scopes:t,caipAccountIds:n,sessionProperties:r}).then(()=>dt(this,null,function*(){var s;yield this.options.ui.factory.unload(),(s=this.options.ui.factory.modal)==null||s.unmount(),this.status="connected",yield this.storage.setTransportType("mwp")})).catch(s=>dt(this,null,function*(){const{ProtocolError:c,ErrorCode:u}=yield Promise.resolve().then(()=>nt(Gg(),1));if(s instanceof c)s.code!==u.REQUEST_EXPIRED&&(this.status="disconnected",yield this.options.ui.factory.unload(s),i.reject(s));else{this.status="disconnected";const d=s instanceof Error?s:new Error(String(s));yield this.options.ui.factory.unload(d),i.reject(d)}})),o.promise});return this.options.ui.factory.renderInstallModal(e,a,o=>dt(this,null,function*(){o?(yield this.storage.removeTransportType(),i.reject(o)):(yield this.storage.setTransportType("mwp"),i.resolve())}),o=>{this.emit("display_uri",o)}).catch(o=>{i.reject(o instanceof Error?o:new Error(String(o)))}),i.promise})},h9e=function(e,t,n,r){return dt(this,null,function*(){kt(this,l5)??dr(this,l5,Lt(this,xn,d9e).call(this)),this.options.ui.headless?yield Lt(this,xn,p9e).call(this,t,n,r):yield Lt(this,xn,f9e).call(this,e,t,n,r)})},p9e=function(e,t,n){return dt(this,null,function*(){(this.dappClient.state==="CONNECTED"||this.dappClient.state==="CONNECTING")&&(yield this.dappClient.disconnect().catch(()=>{}));const r=i=>{const a={sessionRequest:i,metadata:Lt(this,xn,y8).call(this)},o=this.options.ui.factory.createConnectionDeeplink(a);this.emit("display_uri",o)};this.dappClient.on("session_request",r);try{yield Lt(this,xn,tp).call(this).connect({scopes:e,caipAccountIds:t,sessionProperties:n}),this.status="connected",yield this.storage.setTransportType("mwp")}catch(i){const{ProtocolError:a}=yield Promise.resolve().then(()=>nt(Gg(),1));throw this.status="disconnected",yield this.storage.removeTransportType(),i instanceof a||i instanceof Error?i:new Error(String(i))}finally{this.dappClient.off("session_request",r)}})},Oj=function(){return dt(this,arguments,function*(e={persist:!0}){if(kt(this,vs)==="browser")return kt(this,ba);e?.persist&&(yield this.storage.setTransportType("browser"));const t=new XZ;return dr(this,ep,t.onNotification(Lt(this,xn,b8).bind(this))),dr(this,ba,t),dr(this,vs,"browser"),kt(this,M0).setupTransportNotificationListener(),t})},m9e=function(e,t,n){return dt(this,null,function*(){return new Promise((r,i)=>dt(this,null,function*(){const a=s=>{var c;if(typeof s!="object"||s===null||!("data"in s))return;const u=s.data;typeof u=="object"&&u!==null&&(u.error&&(this.dappClient.off("message",a),i(u.error)),(c=u?.result)!=null&&c.sessionScopes&&this.dappClient.off("message",a))};this.dappClient.on("message",a);let o;return Lt(this,xn,tp).call(this).isConnected()?o=setTimeout(()=>{this.openSimpleDeeplinkIfNeeded()},250):this.dappClient.once("session_request",s=>{var c;const u={sessionRequest:s,metadata:Lt(this,xn,y8).call(this)},d=this.options.ui.factory.createConnectionDeeplink(u),p=this.options.ui.factory.createConnectionUniversalLink(u);this.emit("display_uri",d),(c=this.options.mobile)!=null&&c.preferredOpenLink?this.options.mobile.preferredOpenLink(d,"_self"):mj(this.options,d,p)}),Lt(this,xn,tp).call(this).connect({scopes:e,caipAccountIds:t,sessionProperties:n}).then(r).catch(s=>dt(this,null,function*(){yield this.storage.removeTransportType(),this.dappClient.off("message",a),i(s instanceof Error?s:new Error(String(s)))})).finally(()=>{o&&clearTimeout(o)})}))})},d5=function(e,t,n){return dt(this,null,function*(){return this.status="connecting",e.then(()=>dt(this,null,function*(){if(this.status="connected",i8(this.options))try{const r=yield fZ(this.options,this.storage);ta.track("mmconnect_connection_established",qi(on({},r),{transport_type:n,user_permissioned_chains:t}))}catch(r){m8("Error tracking connection_established event",r)}})).catch(r=>dt(this,null,function*(){if(this.status="disconnected",i8(this.options))try{const i=yield fZ(this.options,this.storage);dZ(r)?ta.track("mmconnect_connection_rejected",qi(on({},i),{transport_type:n})):ta.track("mmconnect_connection_failed",on(qi(on({},i),{transport_type:n}),M4e(r)))}catch{m8("Error tracking connection failed/rejected event",r)}throw r}))})},nK=function(){return dt(this,null,function*(){var e;let t={sessionScopes:{},sessionProperties:{}};if((e=kt(this,ba))!=null&&e.isConnected())try{const n=yield kt(this,ba).request({method:"wallet_getSession"});n.result&&(t=n.result)}catch{}return t})},g9e=function(){return dt(this,null,function*(){var e,t;const{ui:n}=this.options,{showInstallModal:r=!1}=n??{};if(!(pj()&&!r))return;const i=yield(e=kt(this,ba))==null?void 0:e.getStoredPendingSessionRequest();if(!i)return;const a={sessionRequest:i,metadata:Lt(this,xn,y8).call(this)},o=this.options.ui.factory.createConnectionDeeplink(a),s=this.options.ui.factory.createConnectionUniversalLink(a);(t=this.options.mobile)!=null&&t.preferredOpenLink?this.options.mobile.preferredOpenLink(o,"_self"):mj(this.options,o,s)})},y9e=b9e,EZ(),rK=class XJ extends Z1{constructor(t,n,r){super(`StorageErr${XJ.code}: ${t} storage get error in key: ${n} - ${r}`,XJ.code),this.platform=t,this.key=n,this.reason=r}},rK.code=60,v8=rK,iK=class JJ extends Z1{constructor(t,n,r){super(`StorageErr${JJ.code}: ${t} storage set error in key: ${n} - ${r}`,JJ.code),this.platform=t,this.key=n,this.reason=r}},iK.code=61,Mj=iK,aK=class eee extends Z1{constructor(t,n,r){super(`StorageErr${eee.code}: ${t} storage delete error in key: ${n} - ${r}`,eee.code),this.platform=t,this.key=n,this.reason=r}},aK.code=62,Rj=aK,_j(),NZ(),v9e=class extends u8e{constructor(e){super(),this.adapter=e}getTransportType(){return dt(this,null,function*(){try{const e=yield this.adapter.get("multichain-transport");return e?frt(e):null}catch(e){throw new v8(this.adapter.platform,"multichain-transport",e.message)}})}setTransportType(e){return dt(this,null,function*(){try{yield this.adapter.set("multichain-transport",e)}catch(t){throw new Mj(this.adapter.platform,"multichain-transport",t.message)}})}removeTransportType(){return dt(this,null,function*(){try{yield this.adapter.delete("multichain-transport")}catch(e){throw new Rj(this.adapter.platform,"multichain-transport",e.message)}})}getAnonId(){return dt(this,null,function*(){try{const e=yield this.adapter.get("anonId");if(e)return e;const t=f3e();return yield this.adapter.set("anonId",t),t}catch(e){throw new v8(this.adapter.platform,"anonId",e.message)}})}getExtensionId(){return dt(this,null,function*(){try{return yield this.adapter.get("extensionId")}catch(e){throw new v8(this.adapter.platform,"extensionId",e.message)}})}setAnonId(e){return dt(this,null,function*(){try{return yield this.adapter.set("anonId",e)}catch(t){throw new Mj(this.adapter.platform,"anonId",t.message)}})}setExtensionId(e){return dt(this,null,function*(){try{return yield this.adapter.set("extensionId",e)}catch(t){throw new Mj(this.adapter.platform,"extensionId",t.message)}})}removeExtensionId(){return dt(this,null,function*(){try{return yield this.adapter.delete("extensionId")}catch(e){throw new Rj(this.adapter.platform,"extensionId",e.message)}})}removeAnonId(){return dt(this,null,function*(){try{return yield this.adapter.delete("anonId")}catch(e){throw new Rj(this.adapter.platform,"anonId",e.message)}})}getDebug(){return dt(this,null,function*(){try{return yield this.adapter.get("DEBUG")}catch(e){throw new v8(this.adapter.platform,"DEBUG",e.message)}})}},Zs(),O0(),_9e=class{constructor(e){this.options=e,this.platform=af(),this.validateModals()}validateModals(){const e=["InstallModal","OTPCodeModal"].filter(t=>!this.options[t]);if(e.length>0)throw new Error(`Missing required modals: ${e.join(", ")}`)}unload(e){return dt(this,null,function*(){var t,n;(t=this.modal)==null||t.unmount(),yield(n=this.successCallback)==null?void 0:n.call(this,e)})}get isMobile(){return this.platform==="react-native"}get isNode(){return this.platform==="nodejs"}get isWeb(){return this.platform==="web-desktop"||this.platform==="in-app-browser"||this.platform==="web-mobile"}getContainer(){return typeof document>"u"?void 0:document.createElement("div")}getMountedContainer(){if(typeof document>"u")return;const e=this.getContainer();return e&&document.body.appendChild(e),e}createConnectionDeeplink(e){if(!e)throw new Error("createConnectionDeeplink can only be called with a connection request");const t=B4e(JSON.stringify(e));return`${xj}/mwp?p=${encodeURIComponent(t)}&c=1`}createConnectionUniversalLink(e){if(!e)return`${f8}`;const t=B4e(JSON.stringify(e));return`${f8}/mwp?p=${encodeURIComponent(t)}&c=1`}onCloseModal(e=!0){return dt(this,null,function*(){return this.unload(e?Uk.userRejectedRequest():void 0)})}onStartDesktopOnboarding(){new m3e().startOnboarding()}renderInstallModal(e,t,n,r){return dt(this,null,function*(){var i,a;(i=this.modal)==null||i.unmount(),yield this.preload(),this.successCallback=n,this.displayUriCallback=r;const o=this.getMountedContainer(),s=yield t(),c=this.createConnectionDeeplink(s);(a=this.displayUriCallback)==null||a.call(this,c);const u=new this.options.InstallModal({expiresIn:(s.sessionRequest.expiresAt-Date.now())/1e3,connectionRequest:s,parentElement:o,showInstallModal:e,link:c,generateQRCode:d=>dt(this,null,function*(){var p;const f=this.createConnectionDeeplink(d);return(p=this.displayUriCallback)==null||p.call(this,f),f}),onClose:d=>{this.onCloseModal(d).catch(p=>{console.error("Failed to close modal:",p)})},startDesktopOnboarding:this.onStartDesktopOnboarding.bind(this),createConnectionRequest:t,onDisplayUri:this.displayUriCallback});this.modal=u,u.mount()})}renderOTPCodeModal(e,t,n){return dt(this,null,function*(){var r;(r=this.modal)==null||r.unmount(),yield this.preload(),this.successCallback=t;const i=this.getMountedContainer(),a=yield e(),o=new this.options.OTPCodeModal({parentElement:i,otpCode:a,onClose:this.onCloseModal.bind(this),createOTPCode:e,updateOTPCode:s=>n(s,o)});this.modal=o,o.mount()})}},w9e=class extends _9e{preload(){return dt(this,null,function*(){return Ort()})}},Zs(),E9e=e=>dt(null,null,function*(){e.debug&&c8("metamask-sdk:*");const t=yield Promise.resolve().then(()=>(L8e(),qZ));let n;if(e.storage)n=e.storage;else{const{StoreAdapterWeb:i}=yield Promise.resolve().then(()=>(U8e(),GZ));n=new v9e(new i)}const r=new w9e(t);return y9e.create(qi(on({},e),{storage:n,ui:qi(on({},e.ui),{factory:r})}))})})),Rrt=$c({EIP6963_ANNOUNCE_PROVIDER_EVENT:()=>_8,EIP6963_REQUEST_PROVIDER_EVENT:()=>Nj,createEVMClient:()=>zrt,getInfuraRpcUrls:()=>k9e});function Brt(e){return e.method==="wallet_requestPermissions"||e.method==="eth_requestAccounts"}function Nrt(e){return e.method==="wallet_switchEthereumChain"}function Lrt(e){return e.method==="wallet_addEthereumChain"}function Drt(e){return e.method==="eth_accounts"||e.method==="eth_coinbase"}function Urt(e){return e.method==="eth_chainId"}function Frt(e,t){const n=[];for(const[r,i]of Object.entries(e))try{new URL(i)}catch{n.push(`${r}: ${i}`)}if(n.length>0)throw new Error(`${t} contains invalid URLs:
1765
1765
  ${n.join(`
1766
1766
  `)}`)}function oK(e){var t;return((t=e?.analytics)==null?void 0:t.enabled)!==!1}function zrt(e){return pi(this,null,function*(){var t,n,r;if(e.debug&&N9e(),or("Creating Metamask Connect/EVM with options:",e),!((t=e.api)!=null&&t.supportedNetworks)||Object.keys(e.api.supportedNetworks).length===0)throw new Error("supportedNetworks is required and must contain at least one chain configuration");Frt(e.api.supportedNetworks,"supportedNetworks");const i=Object.entries(e.api.supportedNetworks).reduce((a,[o,s])=>{const c=`eip155:${parseInt(o,16)}`;return a[c]=s,a},{});try{const a=yield E9e(dK(lK({},e),{api:{supportedNetworks:i},analytics:dK(lK({},(n=e.analytics)!=null?n:{}),{integrationType:((r=e.analytics)==null?void 0:r.integrationType)||"direct"}),versions:{"connect-evm":"2.1.1"}})),o="^1.2.0";o!=="unknown"&&o!==""&&!(0,S9e.satisfies)(a.version,o)&&console.warn(`@metamask/connect-evm expected @metamask/connect-multichain version ${o}, but got ${a.version}. This may lead to unexpected behavior.`);const s=yield hEe.create({core:a,eventHandlers:e.eventHandlers,supportedNetworks:e.api.supportedNetworks});return e.skipAutoAnnounce||s.announceProvider().catch(c=>{or("EIP-6963 provider announcement failed",c)}),s}catch(a){throw console.error("Error creating Metamask Connect/EVM",a),a}})}var S9e,C9e,A9e,T9e,sK,x9e,I9e,cK,uK,lK,dK,Bj,Et,Di,Gr,pn,pi,k9e,fK,j9e,P9e,O9e,M9e,R9e,B9e,hK,or,N9e,_8,Nj,L9e,D9e,U9e,F9e,z9e,w8,$9e,H9e,q9e,lo,G9e,V9e,W9e,Z9e,K9e,Y9e,Lj,f5,Dj,E8,h5,Yg,Q9e,X9e,Uj,J9e,S8,Fj,zj,p5,eEe,$j,tEe,pK,nEe,rEe,C8,Qg,mK,iEe,aEe,oEe,Vr,er,Hj,R0,yu,qj,Gj,m5,of,Xg,En,A8,Vj,Wj,Zj,Kj,sEe,cEe,uEe,gK,bK,T8,yK,g5,Yj,lEe,vK,dEe,fEe,hEe,$rt=Z((()=>{Mrt(),uk(),s3e(),S9e=nt(AG(),1),C9e=Object.defineProperty,A9e=Object.defineProperties,T9e=Object.getOwnPropertyDescriptors,sK=Object.getOwnPropertySymbols,x9e=Object.prototype.hasOwnProperty,I9e=Object.prototype.propertyIsEnumerable,cK=e=>{throw TypeError(e)},uK=(e,t,n)=>t in e?C9e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lK=(e,t)=>{for(var n in t||(t={}))x9e.call(t,n)&&uK(e,n,t[n]);if(sK)for(var n of sK(t))I9e.call(t,n)&&uK(e,n,t[n]);return e},dK=(e,t)=>A9e(e,T9e(t)),Bj=(e,t,n)=>t.has(e)||cK("Cannot "+n),Et=(e,t,n)=>(Bj(e,t,"read from private field"),n?n.call(e):t.get(e)),Di=(e,t,n)=>t.has(e)?cK("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Gr=(e,t,n,r)=>(Bj(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),pn=(e,t,n)=>(Bj(e,t,"access private method"),n),pi=(e,t,n)=>new Promise((r,i)=>{var a=c=>{try{s(n.next(c))}catch(u){i(u)}},o=c=>{try{s(n.throw(c))}catch(u){i(u)}},s=c=>c.done?r(c.value):Promise.resolve(c.value).then(a,o);s((n=n.apply(e,t)).next())}),k9e=({infuraApiKey:e,chainIds:t})=>{const n=drt({infuraApiKey:e,caipChainIds:t?.map(r=>`eip155:${R1(r)}`)});return Object.entries(n).reduce((r,[i,a])=>{const{namespace:o,reference:s}=sG(i);if(o!==M1.Eip155)return r;const c=j5e(parseInt(s,10));return r[c]=a,r},{})},fK=["metamask_getProviderState","metamask_sendDomainMetadata","metamask_logWeb3ShimUsage","wallet_registerOnboarding","net_version","wallet_getPermissions"],j9e=["wallet_requestPermissions","eth_requestAccounts"],P9e=["eth_accounts","eth_coinbase"],O9e=["eth_chainId"],M9e=[...P9e,...fK,...j9e,...O9e,"wallet_revokePermissions","wallet_switchEthereumChain","wallet_addEthereumChain"],R9e={"eip1193-compatible":!0},B9e='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 142 137">%0A <path fill="%23FF5C16" d="m132.24 131.751-30.481-9.076-22.986 13.741-16.038-.007-23-13.734-30.467 9.076L0 100.465l9.268-34.723L0 36.385 9.268 0l47.607 28.443h27.757L132.24 0l9.268 36.385-9.268 29.357 9.268 34.723-9.268 31.286Z"/>%0A <path fill="%23FF5C16" d="m9.274 0 47.608 28.463-1.893 19.534L9.274 0Zm30.468 100.478 20.947 15.957-20.947 6.24v-22.197Zm19.273-26.381L54.989 48.01l-25.77 17.74-.014-.007v.013l.08 18.26 10.45-9.918h19.28ZM132.24 0 84.632 28.463l1.887 19.534L132.24 0Zm-30.467 100.478-20.948 15.957 20.948 6.24v-22.197Zm10.529-34.723h.007-.007v-.013l-.006.007-25.77-17.739L82.5 74.097h19.272l10.457 9.917.073-18.259Z"/>%0A <path fill="%23E34807" d="m39.735 122.675-30.467 9.076L0 100.478h39.735v22.197ZM59.008 74.09l5.82 37.714-8.066-20.97-27.49-6.82 10.456-9.923h19.28Zm42.764 48.585 30.468 9.076 9.268-31.273h-39.736v22.197ZM82.5 74.09l-5.82 37.714 8.065-20.97 27.491-6.82-10.463-9.923H82.5Z"/>%0A <path fill="%23FF8D5D" d="m0 100.465 9.268-34.723h19.93l.073 18.266 27.492 6.82 8.065 20.969-4.146 4.618-20.947-15.957H0v.007Zm141.508 0-9.268-34.723h-19.931l-.073 18.266-27.49 6.82-8.066 20.969 4.145 4.618 20.948-15.957h39.735v.007ZM84.632 28.443H56.875L54.99 47.977l9.839 63.8H76.68l9.845-63.8-1.893-19.534Z"/>%0A <path fill="%23661800" d="M9.268 0 0 36.385l9.268 29.357h19.93l25.784-17.745L9.268 0Zm43.98 81.665h-9.029l-4.916 4.819 17.466 4.33-3.521-9.155v.006ZM132.24 0l9.268 36.385-9.268 29.357h-19.931L86.526 47.997 132.24 0ZM88.273 81.665h9.042l4.916 4.825-17.486 4.338 3.528-9.17v.007Zm-9.507 42.305 2.06-7.542-4.146-4.618H64.82l-4.145 4.618 2.059 7.542"/>%0A <path fill="%23C0C4CD" d="M78.766 123.969v12.453H62.735v-12.453h16.03Z"/>%0A <path fill="%23E7EBF6" d="m39.742 122.662 23.006 13.754v-12.453l-2.06-7.541-20.946 6.24Zm62.031 0-23.007 13.754v-12.453l2.06-7.541 20.947 6.24Z"/>%0A</svg>%0A',hK="metamask-connect:evm",or=s8(hK,"63"),N9e=()=>{c8(hK)},_8="eip6963:announceProvider",Nj="eip6963:requestProvider",L9e=300,D9e="MetaMask",U9e="io.metamask.mmc",F9e=["io.metamask","io.metamask.mobile","io.metamask.flask"],z9e=B9e,w8=()=>{const{window:e}=globalThis;return typeof e?.dispatchEvent=="function"?e:void 0},$9e=e=>pi(null,null,function*(){return yield new Promise(t=>setTimeout(t,e))}),H9e=e=>F9e.some(t=>t===e),q9e=e=>{var t;const{detail:n}=e,r=(t=n?.info)==null?void 0:t.rdns;return typeof r=="string"?r:void 0},lo=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),G9e=e=>(e[6]=e[6]%16+64,e[8]=e[8]%64+128,[lo[e[0]],lo[e[1]],lo[e[2]],lo[e[3]],"-",lo[e[4]],lo[e[5]],"-",lo[e[6]],lo[e[7]],"-",lo[e[8]],lo[e[9]],"-",lo[e[10]],lo[e[11]],lo[e[12]],lo[e[13]],lo[e[14]],lo[e[15]]].join("")),V9e=()=>{const{crypto:e}=globalThis;if(e?.randomUUID)return e.randomUUID();if(e?.getRandomValues){const t=new Uint8Array(16);return e.getRandomValues(t),G9e(t)}throw new Error("Web Crypto API is required for EIP-6963 announcement")},W9e=e=>{const{CustomEvent:t}=globalThis;return new t(_8,{detail:e})},Z9e=()=>{const{Event:e}=globalThis;return new e(Nj)},K9e=()=>Object.freeze({uuid:V9e(),name:D9e,icon:z9e,rdns:U9e}),Y9e=()=>pi(null,null,function*(){const e=w8();if(!e)return!1;const t=new Set,n=r=>{const i=q9e(r);i&&t.add(i)};e.addEventListener(_8,n);try{e.dispatchEvent(Z9e()),yield $9e(L9e)}finally{e.removeEventListener(_8,n)}return[...t].some(H9e)}),J9e=class{constructor(e){Di(this,Yg),Di(this,Lj),Di(this,f5),Di(this,Dj,!1),Di(this,E8),Di(this,h5),Gr(this,Lj,e)}announce(){return pi(this,null,function*(){try{if(Et(this,Dj))return;if(Et(this,f5)){pn(this,Yg,Uj).call(this);return}Et(this,h5)||Gr(this,h5,pn(this,Yg,Q9e).call(this).catch(e=>{or("EIP-6963 provider announcement failed",e)}).finally(()=>{Gr(this,h5,void 0)})),yield Et(this,h5)}catch(e){or("EIP-6963 provider announcement failed",e)}})}},Lj=new WeakMap,f5=new WeakMap,Dj=new WeakMap,E8=new WeakMap,h5=new WeakMap,Yg=new WeakSet,Q9e=function(){return pi(this,null,function*(){if(w8()){if(yield Y9e()){or("MetaMask EIP-6963 provider is already announced. Skipping..."),Gr(this,Dj,!0);return}Gr(this,f5,Object.freeze({info:K9e(),provider:Et(this,Lj)})),pn(this,Yg,X9e).call(this),pn(this,Yg,Uj).call(this)}})},X9e=function(){const e=w8();!e||Et(this,E8)||(Gr(this,E8,()=>{try{pn(this,Yg,Uj).call(this)}catch(t){or("EIP-6963 provider announcement failed",t)}}),e.addEventListener(Nj,Et(this,E8)))},Uj=function(){const e=w8();!e||!Et(this,f5)||e.dispatchEvent(W9e(Et(this,f5)))},eEe=class extends kZ{constructor(e,t){super(),Di(this,S8),Di(this,Fj),Di(this,zj,[]),Di(this,p5),Gr(this,S8,e),Gr(this,Fj,t),this.request=this.request.bind(this),this.sendAsync=this.sendAsync.bind(this),this.send=this.send.bind(this),this.on=this.on.bind(this),this.off=this.off.bind(this),this.emit=this.emit.bind(this),this.once=this.once.bind(this),this.removeListener=this.removeListener.bind(this),this.listenerCount=this.listenerCount.bind(this)}request(e){return pi(this,null,function*(){var t,n,r,i;if(or(`request: ${e.method} - chainId: ${this.selectedChainId}`,e.params),M9e.includes(e.method))return(t=Et(this,Fj))==null?void 0:t.call(this,e);if(!Et(this,p5))throw new Error("No chain ID selected");const a=`eip155:${R1(Et(this,p5))}`,o=Et(this,S8).options;if(!((r=(n=o?.api)==null?void 0:n.supportedNetworks)!=null?r:{})[a])throw new Error(`Chain ${a} is not configured in supportedNetworks. Requests cannot be made to chains not explicitly configured in supportedNetworks.`);try{return yield Et(this,S8).invokeMethod({scope:a,request:{method:e.method,params:e.params}})}catch(s){if(s instanceof o8&&s.rpcCode!==void 0){const c=s,u=new Error((i=s.rpcMessage)!=null?i:s.reason);throw u.code=s.rpcCode,c.rpcData!==void 0&&(u.data=c.rpcData),u}throw s}})}get selectedAccount(){return this.accounts[0]}set accounts(e){Gr(this,zj,e)}get accounts(){return Et(this,zj)}get selectedChainId(){return Et(this,p5)}set selectedChainId(e){Gr(this,p5,e)}get chainId(){return this.selectedChainId}sendAsync(e,t){return pi(this,null,function*(){var n;const r=(n=e.id)!=null?n:1,i=this.request({method:e.method,params:e.params}).then(a=>({id:r,jsonrpc:"2.0",result:a})).catch(a=>{var o,s;return{id:r,jsonrpc:"2.0",error:{code:(o=a.code)!=null?o:-32603,message:(s=a.message)!=null?s:"Internal error",data:a.data}}});if(t){i.then(a=>{a.error?t(new Error(a.error.message),a):t(null,a)}).catch(a=>{t(a,null)});return}return i})}send(e,t){this.sendAsync(e,t)}},S8=new WeakMap,Fj=new WeakMap,zj=new WeakMap,p5=new WeakMap,$j=e=>eJe(e)?{namespace:e}:JXe(e)?sG(e):{},tEe=e=>{const{namespace:t}=$j(e);return t===M1.Eip155||e===`${M1.Wallet}:${M1.Eip155}`},pK=e=>/^0x[0-9a-fA-F]+$/u.test(e),nEe=e=>pK(e)?e:`0x${BigInt(e).toString(16)}`,rEe=e=>{if(!e)return[];const t=[];for(const{accounts:n}of Object.values(e))if(n)for(const r of n){const{address:i,chainId:a}=b5e(r);tEe(a)&&pK(i)&&t.push(i)}return Array.from(new Set(t))},C8=e=>{if(!e)return[];const t=[];for(const n of Object.keys(e)){const{namespace:r,reference:i}=$j(n);r===M1.Eip155&&i&&t.push(nEe(i))}return Array.from(new Set(t))},Qg="0x1",mK="cache_eth_chainId",iEe=()=>{var e;return(e=globalThis.crypto)!=null&&e.randomUUID?globalThis.crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`},aEe=e=>{const{name:t,nativeScheme:n,url:r}=e.dapp,i=n??t;if(!r)return i;try{const{origin:a}=new URL(r);return a==="null"?i:a}catch{return i}},oEe=({accounts:e,chainIds:t,invoker:n})=>{const r=iEe(),i=Date.now();return[{id:r,parentCapability:"eth_accounts",invoker:n,caveats:[{type:"restrictReturnedAccounts",value:e}],date:i},{id:r,parentCapability:"endowment:permitted-chains",invoker:n,caveats:[{type:"restrictNetworkSwitching",value:t}],date:i}]},fEe=class cje{constructor({core:t,eventHandlers:n}){Di(this,En),Di(this,Vr),Di(this,er),Di(this,Hj),Di(this,R0,{}),Di(this,yu),Di(this,qj),Di(this,Gj),Di(this,m5),Di(this,of,"disconnected"),Di(this,Xg),Gr(this,Vr,t),Gr(this,er,new eEe(t,pn(this,En,cEe).bind(this))),Gr(this,Hj,new J9e(Et(this,er))),Gr(this,yu,n),Gr(this,qj,pn(this,En,yK).bind(this)),Et(this,Vr).on("wallet_sessionChanged",Et(this,qj)),Gr(this,Gj,pn(this,En,dEe).bind(this)),Et(this,Vr).on("display_uri",Et(this,Gj)),or("Connect/EVM constructor completed")}static create(t){return pi(this,null,function*(){var n;const r=new cje(t);let i;try{i=yield Et(r,Vr).provider.getSession()}catch{i={sessionScopes:{}}}return yield pn(n=r,En,yK).call(n,i),r})}connect(){return pi(this,arguments,function*({account:t,forceRequest:n,chainIds:r=[Qg]}={}){var i;if(or("request: connect",{account:t}),!r||r.length===0)throw new Error("chainIds must be an array of at least one chain ID");Gr(this,Xg,r[0]);const a=Array.from(new Set((i=r.concat(Qg))!=null?i:[Qg])).map(s=>`eip155:${R1(s)}`),o=t?a.map(s=>`${s}:${t}`):[];Gr(this,of,"connecting");try{const s=new Promise(c=>{Et(this,er).once("connect",({chainId:u,accounts:d})=>{or("fulfilled-request: connect",{chainId:u,accounts:d}),c({accounts:d,chainId:u})})});return yield Et(this,Vr).connect(a,o,R9e,n),yield s}catch(s){throw Gr(this,of,"disconnected"),or("Error connecting to wallet",s),s}finally{Gr(this,Xg,void 0)}})}connectAndSign(t){return pi(this,arguments,function*({message:n,chainIds:r}){var i,a;const{accounts:o,chainId:s}=yield this.connect({chainIds:r??[Qg]}),c=yield Et(this,er).request({method:"personal_sign",params:[o[0],n]});return(a=(i=Et(this,yu))==null?void 0:i.connectAndSign)==null||a.call(i,{accounts:o,chainId:s,signature:c}),{accounts:o,chainId:s,signature:c}})}connectWith(t){return pi(this,arguments,function*({method:n,params:r,chainIds:i,account:a,forceRequest:o}){var s,c;const{accounts:u,chainId:d}=yield this.connect({chainIds:i??[Qg],account:a,forceRequest:o}),p=typeof r=="function"?r(u[0]):r,f=yield Et(this,er).request({method:n,params:p});return(c=(s=Et(this,yu))==null?void 0:s.connectWith)==null||c.call(s,{accounts:u,chainId:d,result:f}),{accounts:u,chainId:d,result:f}})}disconnect(){return pi(this,null,function*(){var t;or("request: disconnect");const n=Et(this,R0),r=Object.keys(n).filter(i=>{const{namespace:a}=$j(i);return a==="eip155"});yield Et(this,Vr).disconnect(r),pn(this,En,vK).call(this),pn(this,En,uEe).call(this),(t=Et(this,m5))==null||t.call(this),Gr(this,m5,void 0),or("fulfilled-request: disconnect")})}switchChain(t){return pi(this,arguments,function*({chainId:n,chainConfiguration:r}){const i="wallet_switchEthereumChain",a=`eip155:${R1(n)}`,o=[{chainId:n}];if(this.selectedChainId===n)return Promise.resolve();if(C8(Et(this,R0)).includes(n)&&Et(this,Vr).transportType===RZ.MWP)return yield pn(this,En,T8).call(this,n),pn(this,En,g5).call(this,n),Promise.resolve();yield pn(this,En,Wj).call(this,i,a,o);try{const s=yield pn(this,En,bK).call(this,{scope:a,method:"wallet_switchEthereumChain",params:o});return yield pn(this,En,Zj).call(this,i,a,o),s===null&&(yield pn(this,En,T8).call(this,n),pn(this,En,g5).call(this,n)),Promise.resolve()}catch(s){if(yield pn(this,En,Kj).call(this,i,a,o,s),s.message.includes("Unrecognized chain ID")&&r)return pn(this,En,gK).call(this,r);throw s}})}getProvider(){return Et(this,er)}announceProvider(){return pi(this,null,function*(){yield Et(this,Hj).announce()})}getChainId(){return this.selectedChainId}getAccount(){return Et(this,er).selectedAccount}get accounts(){return Et(this,er).accounts}get selectedAccount(){return Et(this,er).selectedAccount}get selectedChainId(){return Et(this,er).selectedChainId}get status(){return Et(this,of)}},Vr=new WeakMap,er=new WeakMap,Hj=new WeakMap,R0=new WeakMap,yu=new WeakMap,qj=new WeakMap,Gj=new WeakMap,m5=new WeakMap,of=new WeakMap,Xg=new WeakMap,En=new WeakSet,A8=function(){return Et(this,Vr).options},Vj=function(e,t,n){return{scope:t,request:{method:e,params:n}}},Wj=function(e,t,n){return pi(this,null,function*(){const r=pn(this,En,A8).call(this);if(oK(r))try{const i=pn(this,En,Vj).call(this,e,t,n),a=yield Wg(r,Et(this,Vr).storage,i,Et(this,Vr).transportType);ta.track("mmconnect_wallet_action_requested",a)}catch(i){or("Error tracking mmconnect_wallet_action_requested event",i)}})},Zj=function(e,t,n){return pi(this,null,function*(){const r=pn(this,En,A8).call(this);if(oK(r))try{const i=pn(this,En,Vj).call(this,e,t,n),a=yield Wg(r,Et(this,Vr).storage,i,Et(this,Vr).transportType);ta.track("mmconnect_wallet_action_succeeded",a)}catch(i){or("Error tracking mmconnect_wallet_action_succeeded event",i)}})},Kj=function(e,t,n,r){return pi(this,null,function*(){const i=pn(this,En,A8).call(this);if(oK(i))try{const a=pn(this,En,Vj).call(this,e,t,n),o=yield Wg(i,Et(this,Vr).storage,a,Et(this,Vr).transportType);dZ(r)?ta.track("mmconnect_wallet_action_rejected",o):ta.track("mmconnect_wallet_action_failed",o)}catch{or("Error tracking wallet action rejected or failed event",r)}})},sEe=function(e){return pi(this,null,function*(){if(Et(this,Xg)&&e.includes(Et(this,Xg)))return Et(this,Xg);try{const t=yield Et(this,Vr).storage.adapter.get(mK);if(t){const n=JSON.parse(t);if(e.includes(n))return n}}catch(t){or("Error retrieving cached chainId",t)}return e[0]})},cEe=function(e){return pi(this,null,function*(){var t;if(or(`Intercepting request for method: ${e.method}`),fK.includes(e.method))return Promise.reject(new Error(`Method: ${e.method} is not supported by Metamask Connect/EVM`));if(e.method==="wallet_revokePermissions")return this.disconnect();if(Brt(e)){const n=e.method==="wallet_requestPermissions",{method:r,params:i}=e,a=C8(Et(this,R0));a.length===0&&a.push(Qg);const o=Et(this,er).selectedChainId,s=o&&a.includes(o)?o:a[0],c=[s,...a.filter(d=>d!==s)],u=`eip155:${R1(s)}`;yield pn(this,En,Wj).call(this,r,u,i);try{const d=yield this.connect({chainIds:c,forceRequest:n});return yield pn(this,En,Zj).call(this,r,u,i),e.method==="eth_requestAccounts"?d.accounts:e.method==="wallet_requestPermissions"?oEe({accounts:d.accounts,chainIds:C8(Et(this,R0)),invoker:aEe(pn(this,En,A8).call(this))}):d}catch(d){throw yield pn(this,En,Kj).call(this,r,u,i,d),d}}return Nrt(e)?(yield this.switchChain({chainId:e.params[0].chainId}),null):Lrt(e)?(yield pn(this,En,gK).call(this,e.params[0]),null):Drt(e)?e.method==="eth_coinbase"?(t=Et(this,er).selectedAccount)!=null?t:null:Et(this,er).accounts:Urt(e)?Et(this,er).selectedChainId:(or("Request not intercepted, forwarding to default handler",e),Promise.resolve())})},uEe=function(){Et(this,er).accounts=[],Et(this,er).selectedChainId=void 0},gK=function(e){return pi(this,null,function*(){or("addEthereumChain called",{chainConfiguration:e});const t="wallet_addEthereumChain";if(!e)throw new Error("No chain configuration found.");const n=e.chainId||Et(this,er).selectedChainId||"0x1",r=`eip155:${R1(n)}`,i=[e];yield pn(this,En,Wj).call(this,t,r,i);try{(yield pn(this,En,bK).call(this,{scope:r,method:"wallet_addEthereumChain",params:i}))===null&&(yield pn(this,En,T8).call(this,n),pn(this,En,g5).call(this,n)),yield pn(this,En,Zj).call(this,t,r,i)}catch(a){throw yield pn(this,En,Kj).call(this,t,r,i,a),a}})},bK=function(e){return pi(this,null,function*(){or("direct request to metamask-provider called",e);const t=Et(this,Vr).invokeMethod({scope:e.scope,request:{method:e.method,params:e.params}});return(e.method==="wallet_addEthereumChain"||e.method==="wallet_switchEthereumChain")&&Et(this,Vr).openSimpleDeeplinkIfNeeded(),t})},T8=function(e){return pi(this,null,function*(){try{yield Et(this,Vr).storage.adapter.set(mK,JSON.stringify(e))}catch(t){or("Error caching chainId",t)}})},yK=function(e){return pi(this,null,function*(){var t;or("event: wallet_sessionChanged",e),Gr(this,R0,(t=e?.sessionScopes)!=null?t:{});const n=C8(Et(this,R0));if(n.length===0)pn(this,En,vK).call(this);else{let r=[];Et(this,Vr).status==="connected"?r=yield Et(this,Vr).invokeMethod({scope:`eip155:${R1(n[0])}`,request:{method:"eth_accounts",params:[]}}):r=rEe(Et(this,R0));const i=yield pn(this,En,sEe).call(this,n);pn(this,En,lEe).call(this,{chainId:i,accounts:r})}})},g5=function(e){var t,n;e!==Et(this,er).selectedChainId&&(or("handler: chainChanged",{chainId:e}),Et(this,er).selectedChainId=e,Et(this,er).emit("chainChanged",e),(n=(t=Et(this,yu))==null?void 0:t.chainChanged)==null||n.call(t,e))},Yj=function(e){var t,n;e.length===Et(this,er).accounts.length&&e.every((r,i)=>r===Et(this,er).accounts[i])||(or("handler: accountsChanged",e),Et(this,er).accounts=e,Et(this,er).emit("accountsChanged",e),(n=(t=Et(this,yu))==null?void 0:t.accountsChanged)==null||n.call(t,e))},lEe=function({chainId:e,accounts:t}){var n,r,i,a,o,s,c;or("handler: connect",{chainId:e,accounts:t});const u={chainId:e,accounts:t};if(Et(this,of)==="connected"){pn(this,En,g5).call(this,e),pn(this,En,Yj).call(this,t);return}Et(this,er).selectedChainId=e,Et(this,er).accounts=t,Gr(this,of,"connected"),Et(this,er).emit("connect",u),(r=(n=Et(this,yu))==null?void 0:n.connect)==null||r.call(n,u),Et(this,er).emit("chainChanged",e),(a=(i=Et(this,yu))==null?void 0:i.chainChanged)==null||a.call(i,e),Et(this,er).emit("accountsChanged",t),(s=(o=Et(this,yu))==null?void 0:o.accountsChanged)==null||s.call(o,t),(c=Et(this,m5))==null||c.call(this);const d=f=>{or("core-event: accountsChanged",f),pn(this,En,Yj).call(this,f)},p=f=>{or("core-event: chainChanged",f.chainId),pn(this,En,T8).call(this,f.chainId).catch(m=>{or("Error caching chainId in notification handler",m)}),pn(this,En,g5).call(this,f.chainId)};Et(this,Vr).on("metamask_accountsChanged",d),Et(this,Vr).on("metamask_chainChanged",p),Gr(this,m5,()=>{Et(this,Vr).off("metamask_accountsChanged",d),Et(this,Vr).off("metamask_chainChanged",p)})},vK=function(){var e,t;Et(this,of)!=="disconnected"&&(Gr(this,of,"disconnected"),or("handler: disconnect"),Et(this,er).emit("disconnect"),(t=(e=Et(this,yu))==null?void 0:e.disconnect)==null||t.call(e),pn(this,En,Yj).call(this,[]))},dEe=function(e){var t,n;Et(this,of)==="connecting"&&(or("handler: display_uri",e),Et(this,er).emit("display_uri",e),(n=(t=Et(this,yu))==null?void 0:t.displayUri)==null||n.call(t,e))},hEe=fEe}));function pEe(e,t){const n={};for(const r of e){if(GI(r.id))continue;const i=Vrt(r,t)||r.rpcUrls.default?.http[0];i&&Wrt(i)&&(n[gt(r.id)]=i)}return n}function Hrt(e,t){const n=gt(_0.id);return e[n]?e:{...e,[n]:pEe([_0],t)[n]??_0.rpcUrls.default.http[0]}}function qrt(e,t){const n=e.selectedChainId;e.selectedChainId=gt(_0.id);try{return e.request(t)}finally{e.selectedChainId=n}}function Grt(e,t,n,r){const i=(async a=>{const o=t.getChainId(),s=o?gt(Number(o)):void 0;if(s&&!n[s]&&!gEe.has(a.method))throw Object.assign(new Error(`MetaMask is on chain ${Number(o)}, which this app does not list, so ${a.method} was not sent`),{code:4901});return s&&!r[s]&&a.method==="personal_sign"?qrt(e,a):e.request(a)});return new Proxy(e,{get(a,o){if(o==="request")return i;const s=Reflect.get(a,o);return typeof s=="function"?s.bind(a):s}})}function Vrt(e,t){const n=t?.[e.id]?.({chain:e});return(n?.value?.transports?.[0]??n)?.value?.url}function Wrt(e){try{return new URL(e),!0}catch{return!1}}function Zrt(e){return e.testnet===!0&&!bEe.has(e.id)}function Krt(e){const{code:t,message:n}=e??{};return t===4902||typeof n=="string"&&n.includes("Unrecognized chain")}function Yrt(e,t){const n=Object.keys(e);if(!t||GI(t))return n;const r=gt(t);return n.includes(r)?[r,...n.filter(i=>i!==r)]:n}function Qj(){y5.clear(),x8.clear(),yEe=void 0,v5=!1}function Qrt(e,t,n){const r=(i=>{const a=e.request(i);if(!vEe.has(i.method))return a;const o=a.then(s=>(v5=!0,s),s=>{throw s?.code===lr.code&&(v5=!0),s});return v5?o:CZe(o,t,n)});return new Proxy(e,{get(i,a){if(a==="request")return r;const o=Reflect.get(i,a);return typeof o=="function"?o.bind(i):o}})}function _K(e,t){let n;return Promise.race([e,new Promise((r,i)=>{n=setTimeout(()=>i(new Error(`timed out after ${t} ms`)),t)})]).finally(()=>clearTimeout(n))}function mEe(e){return(t,n)=>{yEe={url:t,open:e},e(t,n)}}function Xrt(e){typeof window<"u"&&(window.location.href=e)}function Jrt(e,t){return b5||(b5=Promise.resolve().then(()=>($rt(),Rrt)).then(({createEVMClient:n})=>n({dapp:{name:e.dapp.name,url:e.dapp.url??(typeof window<"u"?window.location.origin:"https://multiplatform.one"),...e.dapp.iconUrl?{iconUrl:e.dapp.iconUrl}:{}},api:{supportedNetworks:t},analytics:{enabled:!1},skipAutoAnnounce:!0,debug:e.debug,...e.headless?{ui:{headless:!0}}:{},mobile:{...e.preferredOpenLink?{preferredOpenLink:mEe(e.preferredOpenLink)}:e.useDeeplink===!1?{}:{preferredOpenLink:mEe(Xrt)},...e.useDeeplink!==void 0?{useDeeplink:e.useDeeplink}:{}},eventHandlers:{connect:({accounts:r,chainId:i})=>{r.length&&np?.emit("connect",{accounts:r.map(a=>xr(a)),chainId:Number(i)})},accountsChanged:r=>{r.length===0?(Qj(),np?.emit("disconnect")):np?.emit("change",{accounts:r.map(i=>xr(i))})},chainChanged:r=>{y5.add(Number(r)),np?.emit("change",{chainId:Number(r)})},disconnect:()=>{Qj(),np?.emit("disconnect")},displayUri:r=>{Xj+=1,np?.emit("message",{type:"display_uri",data:r})}}})),b5.catch(()=>{b5=void 0}),b5)}function eit(e){const t=e?.code;throw t===lr.code?new lr(e):t===tu.code?new tu(e):e}function wK(e){return t=>{np??=t.emitter;const n=pEe(t.chains,t.transports),r=Hrt(n,t.transports),i=Number(Object.keys(n)[0]??1),a=e.mobile??Ed(),o=e.addChainFirst??Zrt,s=a?e.restoredSessionTimeout:void 0,c=()=>Jrt(e,r);let u;const d=()=>(np=t.emitter,c()),p=v=>v.accounts.map(y=>xr(y)),f=v=>{const y=v.getChainId();return y?Number(y):i},m=()=>{if(I8)return I8;Qj(),t.emitter.emit("disconnect");const v=_K(SZe(),_Ee).catch(()=>{}).finally(()=>{k8===v&&(k8=void 0)});k8=v;const y=c().then(I=>I.disconnect()).catch(()=>{}).finally(()=>{j8===y&&(j8=void 0)});j8=y;const E=v.then(()=>_K(y,wEe)).catch(()=>{}).finally(()=>{I8===E&&(I8=void 0)});return I8=E,E};return{id:"metaMaskSDK",name:"MetaMask",rdns:["io.metamask","io.metamask.mobile"],type:wK.type,async setup(){await c().catch(()=>{})},async connect({chainId:v,isReconnecting:y}={}){k8&&await k8,j8&&await _K(j8,EEe).catch(()=>{});const E=await d();try{let I=y?p(E):[];if(!I.length){const j=Xj,_=await E.connect({chainIds:Yrt(n,v)});Xj!==j&&(v5=!0),I=_.accounts.map(O=>xr(O))}const w=f(E);return y5.add(w),{accounts:I,chainId:w}}catch(I){eit(I)}},async disconnect(){Qj(),await(await d()).disconnect()},async getAccounts(){return p(await d())},async getChainId(){return f(await d())},async getProvider(){const v=await d(),y=v.getProvider();if(u?.provider!==y){const E=Grt(y,v,n,r);u={provider:y,wrapped:s?Qrt(E,s,m):E}}return u.wrapped},async isAuthorized(){try{return p(await d()).length>0}catch{return!1}},async switchChain({addEthereumChainParameter:v,chainId:y}){const E=t.chains.find(j=>j.id===y);if(!E||!n[gt(y)])throw new _c(new v0);const I={chainId:gt(y),chainName:v?.chainName??E.name,nativeCurrency:v?.nativeCurrency??E.nativeCurrency,rpcUrls:v?.rpcUrls?[...v.rpcUrls]:[n[gt(y)]],...E.blockExplorers?.default.url?{blockExplorerUrls:[E.blockExplorers.default.url]}:{}},w=await d();if(w.getChainId()===gt(y))return E;try{return a?!y5.has(y)&&(x8.has(y)||o(E))?await w.getProvider().request({method:"wallet_addEthereumChain",params:[I]}):await w.switchChain({chainId:gt(y)}):await w.switchChain({chainId:gt(y),chainConfiguration:I}),y5.add(y),x8.delete(y),E}catch(j){throw j?.code===lr.code?new lr(j):a&&Krt(j)?(x8.add(y),new _c(Object.assign(new Error(`MetaMask does not have ${E.name} yet. Switch again from a tap to add it.`,{cause:j}),{code:4902}))):new _c(j)}},onAccountsChanged(v){v.length===0?t.emitter.emit("disconnect"):t.emitter.emit("change",{accounts:v.map(y=>xr(y))})},onChainChanged(v){t.emitter.emit("change",{chainId:Number(v)})},onDisconnect(){t.emitter.emit("disconnect")}}}}var gEe,bEe,b5,np,y5,x8,yEe,Xj,v5,vEe,_Ee,wEe,EEe,I8,k8,j8,tit=Z((()=>{nn(),ei(),Li(),nI(),v2e(),xv(),gEe=new Set(["personal_sign","eth_accounts","eth_coinbase","eth_chainId","eth_requestAccounts","net_version","wallet_getPermissions","wallet_requestPermissions","wallet_revokePermissions","wallet_switchEthereumChain","wallet_addEthereumChain","metamask_getProviderState","metamask_sendDomainMetadata","metamask_logWeb3ShimUsage","wallet_registerOnboarding"]),bEe=new Set([11155111,59141,10143,6342,6343]),y5=new Set,x8=new Set,Xj=0,v5=!1,vEe=new Set(["personal_sign","eth_sign","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","wallet_requestPermissions","wallet_addEthereumChain","wallet_watchAsset","wallet_sendCalls"]),_Ee=1500,wEe=5e3,EEe=1e3,wK.type="metaMask"}));function SEe(e=typeof window<"u"?window:void 0){return typeof e>"u"||!e?!1:!!(e.__TAURI_INTERNALS__||e.__TAURI__)}function nit(){return{useDeeplink:!1,headless:!0,preferredOpenLink:e=>{typeof window>"u"||/^https?:\/\//i.test(e)&&window.open(e,"_blank","noopener,noreferrer")}}}var CEe=Z((()=>{})),rit=$c({i:()=>xEe});function iit(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(r){if(r!=="default"&&!(r in e)){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}})}),Object.freeze(e)}function ait(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var AEe,EK,SK,TEe,CK,xEe,oit=Z((()=>{AEe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},EK={exports:{}},SK={exports:{}},(function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:AEe,(function(){return(function(n){var r={};function i(a){if(r[a])return r[a].exports;var o=r[a]={i:a,l:!1,exports:{}};return n[a].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=n,i.c=r,i.d=function(a,o,s){i.o(a,o)||Object.defineProperty(a,o,{enumerable:!0,get:s})},i.r=function(a){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})},i.t=function(a,o){if(1&o&&(a=i(a)),8&o||4&o&&typeof a=="object"&&a&&a.__esModule)return a;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:a}),2&o&&typeof a!="string")for(var c in a)i.d(s,c,function(u){return a[u]}.bind(null,c));return s},i.n=function(a){var o=a&&a.__esModule?function(){return a.default}:function(){return a};return i.d(o,"a",o),o},i.o=function(a,o){return{}.hasOwnProperty.call(a,o)},i.p="",i(i.s=0)})([function(n,r,i){i.r(r),i.d(r,"Promise",(function(){return C})),i.d(r,"TYPES",(function(){return Da})),i.d(r,"ProxyWindow",(function(){return mi})),i.d(r,"setup",(function(){return Ou})),i.d(r,"destroy",(function(){return Xs})),i.d(r,"serializeMessage",(function(){return Dl})),i.d(r,"deserializeMessage",(function(){return bf})),i.d(r,"createProxyWindow",(function(){return yf})),i.d(r,"toProxyWindow",(function(){return Mc})),i.d(r,"on",(function(){return Or})),i.d(r,"once",(function(){return As})),i.d(r,"send",(function(){return ra})),i.d(r,"markWindowKnown",(function(){return Oe})),i.d(r,"cleanUpWindow",(function(){return Js})),i.d(r,"bridge",(function(){}));function a(pe){return{}.toString.call(pe)==="[object RegExp]"}var o=`Call was rejected by callee.\r
1767
1767
  `;function s(pe){return pe===void 0&&(pe=window),pe.location.protocol}function c(pe){if(pe===void 0&&(pe=window),pe.mockDomain){var Te=pe.mockDomain.split("//")[0];if(Te)return Te}return s(pe)}function u(pe){return pe===void 0&&(pe=window),c(pe)==="about:"}function d(pe){if(pe===void 0&&(pe=window),pe)try{if(pe.parent&&pe.parent!==pe)return pe.parent}catch{}}function p(pe){if(pe===void 0&&(pe=window),pe&&!d(pe))try{return pe.opener}catch{}}function f(pe){try{return!0}catch{}return!1}function m(pe){pe===void 0&&(pe=window);var Te=pe.location;if(!Te)throw new Error("Can not read window location");var we=s(pe);if(!we)throw new Error("Can not read window protocol");if(we==="file:")return"file://";if(we==="about:"){var je=d(pe);return je&&f()?m(je):"about://"}var Be=Te.host;if(!Be)throw new Error("Can not read window host");return we+"//"+Be}function v(pe){pe===void 0&&(pe=window);var Te=m(pe);return Te&&pe.mockDomain&&pe.mockDomain.indexOf("mock:")===0?pe.mockDomain:Te}function y(pe){if(!(function(Te){try{if(Te===window)return!0}catch{}try{var we=Object.getOwnPropertyDescriptor(Te,"location");if(we&&we.enumerable===!1)return!1}catch{}try{if(u(Te)&&f())return!0}catch{}try{if((function(je){return je===void 0&&(je=window),c(je)==="mock:"})(Te)&&f())return!0}catch{}try{if(m(Te)===m(window))return!0}catch{}return!1})(pe))return!1;try{if(pe===window||u(pe)&&f()||v(window)===v(pe))return!0}catch{}return!1}function E(pe){if(!y(pe))throw new Error("Expected window to be same domain");return pe}function I(pe,Te){if(!pe||!Te)return!1;var we=d(Te);return we?we===pe:(function(je){var Be=[];try{for(;je.parent!==je;)Be.push(je.parent),je=je.parent}catch{}return Be})(Te).indexOf(pe)!==-1}function w(pe){var Te=[],we;try{we=pe.frames}catch{we=pe}var je;try{je=we.length}catch{}if(je===0)return Te;if(je){for(var Be=0;Be<je;Be++){var Ye=void 0;try{Ye=we[Be]}catch{continue}Te.push(Ye)}return Te}for(var rt=0;rt<100;rt++){var mt=void 0;try{mt=we[rt]}catch{return Te}if(!mt)return Te;Te.push(mt)}return Te}var j=[],_=[];function O(pe,Te){Te===void 0&&(Te=!0);try{if(pe===window)return!1}catch{return!0}try{if(!pe)return!0}catch{return!0}try{if(pe.closed)return!0}catch(Be){return!Be||Be.message!==o}if(Te&&y(pe))try{if(pe.mockclosed)return!0}catch{}try{if(!pe.parent||!pe.top)return!0}catch{}var we=(function(Be,Ye){for(var rt=0;rt<Be.length;rt++)try{if(Be[rt]===Ye)return rt}catch{}return-1})(j,pe);if(we!==-1){var je=_[we];if(je&&(function(Be){if(!Be.contentWindow||!Be.parentNode)return!0;var Ye=Be.ownerDocument;if(Ye&&Ye.documentElement&&!Ye.documentElement.contains(Be)){for(var rt=Be;rt.parentNode&&rt.parentNode!==rt;)rt=rt.parentNode;if(!rt.host||!Ye.documentElement.contains(rt.host))return!0}return!1})(je))return!0}return!1}function R(pe){return pe===void 0&&(pe=window),p(pe=pe||window)||d(pe)||void 0}function P(pe,Te){if(typeof pe=="string"){if(typeof Te=="string")return pe==="*"||Te===pe;if(a(Te)||Array.isArray(Te))return!1}return a(pe)?a(Te)?pe.toString()===Te.toString():!Array.isArray(Te)&&!!Te.match(pe):!!Array.isArray(pe)&&(Array.isArray(Te)?JSON.stringify(pe)===JSON.stringify(Te):!a(Te)&&pe.some((function(we){return P(we,Te)})))}function k(pe){try{if(pe===window)return!0}catch(Te){if(Te&&Te.message===o)return!0}try{if({}.toString.call(pe)==="[object Window]")return!0}catch(Te){if(Te&&Te.message===o)return!0}try{if(window.Window&&pe instanceof window.Window)return!0}catch(Te){if(Te&&Te.message===o)return!0}try{if(pe&&pe.self===pe)return!0}catch(Te){if(Te&&Te.message===o)return!0}try{if(pe&&pe.parent===pe)return!0}catch(Te){if(Te&&Te.message===o)return!0}try{if(pe&&pe.top===pe)return!0}catch(Te){if(Te&&Te.message===o)return!0}try{if(pe&&pe.__cross_domain_utils_window_check__==="__unlikely_value__")return!1}catch{return!0}try{if("postMessage"in pe&&"self"in pe&&"location"in pe)return!0}catch{}return!1}function M(pe){if(y(pe))return E(pe).frameElement;for(var Te=0,we=document.querySelectorAll("iframe");Te<we.length;Te++){var je=we[Te];if(je&&je.contentWindow&&je.contentWindow===pe)return je}}function L(pe){if((function(we){return we===void 0&&(we=window),!!d(we)})(pe)){var Te=M(pe);if(Te&&Te.parentElement){Te.parentElement.removeChild(Te);return}}try{pe.close()}catch{}}function H(pe){try{if(!pe)return!1;if(typeof Promise<"u"&&pe instanceof Promise)return!0;if(typeof window<"u"&&typeof window.Window=="function"&&pe instanceof window.Window||typeof window<"u"&&typeof window.constructor=="function"&&pe instanceof window.constructor)return!1;var Te={}.toString;if(Te){var we=Te.call(pe);if(we==="[object Window]"||we==="[object global]"||we==="[object DOMWindow]")return!1}if(typeof pe.then=="function")return!0}catch{return!1}return!1}var G=[],q=[],W=0,F;function $(){if(!W&&F){var pe=F;F=null,pe.resolve()}}function b(){W+=1}function g(){W-=1,$()}var C=(function(){function pe(we){var je=this;if(this.resolved=void 0,this.rejected=void 0,this.errorHandled=void 0,this.value=void 0,this.error=void 0,this.handlers=void 0,this.dispatching=void 0,this.stack=void 0,this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],we){var Be,Ye,rt=!1,mt=!1,at=!1;b();try{we((function(it){at?je.resolve(it):(rt=!0,Be=it)}),(function(it){at?je.reject(it):(mt=!0,Ye=it)}))}catch(it){g(),this.reject(it);return}g(),at=!0,rt?this.resolve(Be):mt&&this.reject(Ye)}}var Te=pe.prototype;return Te.resolve=function(we){if(this.resolved||this.rejected)return this;if(H(we))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=we,this.dispatch(),this},Te.reject=function(we){var je=this;if(this.resolved||this.rejected)return this;if(H(we))throw new Error("Can not reject promise with another promise");if(!we){var Be=we&&typeof we.toString=="function"?we.toString():{}.toString.call(we);we=new Error("Expected reject to be called with Error, got "+Be)}return this.rejected=!0,this.error=we,this.errorHandled||setTimeout((function(){je.errorHandled||(function(Ye,rt){if(G.indexOf(Ye)===-1){G.push(Ye),setTimeout((function(){throw Ye}),1);for(var mt=0;mt<q.length;mt++)q[mt](Ye,rt)}})(we,je)}),1),this.dispatch(),this},Te.asyncReject=function(we){return this.errorHandled=!0,this.reject(we),this},Te.dispatch=function(){var we=this.resolved,je=this.rejected,Be=this.handlers;if(!this.dispatching&&(we||je)){this.dispatching=!0,b();for(var Ye=function(At,en){return At.then((function(ln){en.resolve(ln)}),(function(ln){en.reject(ln)}))},rt=0;rt<Be.length;rt++){var mt=Be[rt],at=mt.onSuccess,it=mt.onError,xt=mt.promise,wt=void 0;if(we)try{wt=at?at(this.value):this.value}catch(At){xt.reject(At);continue}else if(je){if(!it){xt.reject(this.error);continue}try{wt=it(this.error)}catch(At){xt.reject(At);continue}}if(wt instanceof pe&&(wt.resolved||wt.rejected)){var Ct=wt;Ct.resolved?xt.resolve(Ct.value):xt.reject(Ct.error),Ct.errorHandled=!0}else H(wt)?wt instanceof pe&&(wt.resolved||wt.rejected)?wt.resolved?xt.resolve(wt.value):xt.reject(wt.error):Ye(wt,xt):xt.resolve(wt)}Be.length=0,this.dispatching=!1,g()}},Te.then=function(we,je){if(we&&typeof we!="function"&&!we.call)throw new Error("Promise.then expected a function for success handler");if(je&&typeof je!="function"&&!je.call)throw new Error("Promise.then expected a function for error handler");var Be=new pe;return this.handlers.push({promise:Be,onSuccess:we,onError:je}),this.errorHandled=!0,this.dispatch(),Be},Te.catch=function(we){return this.then(void 0,we)},Te.finally=function(we){if(we&&typeof we!="function"&&!we.call)throw new Error("Promise.finally expected a function");return this.then((function(je){return pe.try(we).then((function(){return je}))}),(function(je){return pe.try(we).then((function(){throw je}))}))},Te.timeout=function(we,je){var Be=this;if(this.resolved||this.rejected)return this;var Ye=setTimeout((function(){Be.resolved||Be.rejected||Be.reject(je||new Error("Promise timed out after "+we+"ms"))}),we);return this.then((function(rt){return clearTimeout(Ye),rt}))},Te.toPromise=function(){if(typeof Promise>"u")throw new TypeError("Could not find Promise");return Promise.resolve(this)},Te.lazy=function(){return this.errorHandled=!0,this},pe.resolve=function(we){return we instanceof pe?we:H(we)?new pe((function(je,Be){return we.then(je,Be)})):new pe().resolve(we)},pe.reject=function(we){return new pe().reject(we)},pe.asyncReject=function(we){return new pe().asyncReject(we)},pe.all=function(we){var je=new pe,Be=we.length,Ye=[].slice();if(!Be)return je.resolve(Ye),je;for(var rt=function(it,xt,wt){return xt.then((function(Ct){Ye[it]=Ct,(Be-=1)==0&&je.resolve(Ye)}),(function(Ct){wt.reject(Ct)}))},mt=0;mt<we.length;mt++){var at=we[mt];if(at instanceof pe){if(at.resolved){Ye[mt]=at.value,Be-=1;continue}}else if(!H(at)){Ye[mt]=at,Be-=1;continue}rt(mt,pe.resolve(at),je)}return Be===0&&je.resolve(Ye),je},pe.hash=function(we){var je={},Be=[],Ye=function(mt){if(we.hasOwnProperty(mt)){var at=we[mt];H(at)?Be.push(at.then((function(it){je[mt]=it}))):je[mt]=at}};for(var rt in we)Ye(rt);return pe.all(Be).then((function(){return je}))},pe.map=function(we,je){return pe.all(we.map(je))},pe.onPossiblyUnhandledException=function(we){return(function(je){return q.push(je),{cancel:function(){q.splice(q.indexOf(je),1)}}})(we)},pe.try=function(we,je,Be){if(we&&typeof we!="function"&&!we.call)throw new Error("Promise.try expected a function");var Ye;b();try{Ye=we.apply(je,Be||[])}catch(rt){return g(),pe.reject(rt)}return g(),pe.resolve(Ye)},pe.delay=function(we){return new pe((function(je){setTimeout(je,we)}))},pe.isPromise=function(we){return!!(we&&we instanceof pe)||H(we)},pe.flush=function(){return(function(we){var je=F=F||new we;return $(),je})(pe)},pe})();function B(pe,Te){for(var we=0;we<pe.length;we++)try{if(pe[we]===Te)return we}catch{}return-1}var x=(function(){function pe(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__",(function(){if(typeof WeakMap>"u"||Object.freeze===void 0)return!1;try{var we=new WeakMap,je={};return Object.freeze(je),we.set(je,"__testvalue__"),we.get(je)==="__testvalue__"}catch{return!1}})())try{this.weakmap=new WeakMap}catch{}this.keys=[],this.values=[]}var Te=pe.prototype;return Te._cleanupClosedWindows=function(){for(var we=this.weakmap,je=this.keys,Be=0;Be<je.length;Be++){var Ye=je[Be];if(k(Ye)&&O(Ye)){if(we)try{we.delete(Ye)}catch{}je.splice(Be,1),this.values.splice(Be,1),Be-=1}}},Te.isSafeToReadWrite=function(we){return!k(we)},Te.set=function(we,je){if(!we)throw new Error("WeakMap expected key");var Be=this.weakmap;if(Be)try{Be.set(we,je)}catch{delete this.weakmap}if(this.isSafeToReadWrite(we))try{var Ye=this.name,rt=we[Ye];rt&&rt[0]===we?rt[1]=je:Object.defineProperty(we,Ye,{value:[we,je],writable:!0});return}catch{}this._cleanupClosedWindows();var mt=this.keys,at=this.values,it=B(mt,we);it===-1?(mt.push(we),at.push(je)):at[it]=je},Te.get=function(we){if(!we)throw new Error("WeakMap expected key");var je=this.weakmap;if(je)try{if(je.has(we))return je.get(we)}catch{delete this.weakmap}if(this.isSafeToReadWrite(we))try{var Be=we[this.name];return Be&&Be[0]===we?Be[1]:void 0}catch{}this._cleanupClosedWindows();var Ye=B(this.keys,we);if(Ye!==-1)return this.values[Ye]},Te.delete=function(we){if(!we)throw new Error("WeakMap expected key");var je=this.weakmap;if(je)try{je.delete(we)}catch{delete this.weakmap}if(this.isSafeToReadWrite(we))try{var Be=we[this.name];Be&&Be[0]===we&&(Be[0]=Be[1]=void 0)}catch{}this._cleanupClosedWindows();var Ye=this.keys,rt=B(Ye,we);rt!==-1&&(Ye.splice(rt,1),this.values.splice(rt,1))},Te.has=function(we){if(!we)throw new Error("WeakMap expected key");var je=this.weakmap;if(je)try{if(je.has(we))return!0}catch{delete this.weakmap}if(this.isSafeToReadWrite(we))try{var Be=we[this.name];return!(!Be||Be[0]!==we)}catch{}return this._cleanupClosedWindows(),B(this.keys,we)!==-1},Te.getOrSet=function(we,je){if(this.has(we))return this.get(we);var Be=je();return this.set(we,Be),Be},pe})();function A(pe){return pe.name||pe.__name__||pe.displayName||"anonymous"}function U(pe,Te){try{delete pe.name,pe.name=Te}catch{}return pe.__name__=pe.displayName=Te,pe}function z(){var pe="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,(function(){return pe.charAt(Math.floor(Math.random()*pe.length))}))+"_"+(function(Te){if(typeof btoa=="function")return btoa(encodeURIComponent(Te).replace(/%([0-9A-F]{2})/g,(function(we,je){return String.fromCharCode(parseInt(je,16))}))).replace(/[=]/g,"");if(typeof Buffer<"u")return Buffer.from(Te,"utf8").toString("base64").replace(/[=]/g,"");throw new Error("Can not find window.btoa or Buffer")})(new Date().toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}var K;function V(pe){try{return JSON.stringify([].slice.call(pe),(function(Te,we){return typeof we=="function"?"memoize["+(function(je){if(K=K||new x,je==null||typeof je!="object"&&typeof je!="function")throw new Error("Invalid object");var Be=K.get(je);return Be||(Be=typeof je+":"+z(),K.set(je,Be)),Be})(we)+"]":typeof window<"u"&&we instanceof window.Element||we!==null&&typeof we=="object"&&we.nodeType===1&&typeof we.style=="object"&&typeof we.ownerDocument=="object"?{}:we}))}catch{throw new Error("Arguments not serializable -- can not be used to memoize")}}function ee(){return{}}var ne=0,ie=0;function se(pe,Te){Te===void 0&&(Te={});var we=Te.thisNamespace,je=we!==void 0&&we,Be=Te.time,Ye,rt,mt=ne;ne+=1;var at=function(){for(var it=arguments.length,xt=new Array(it),wt=0;wt<it;wt++)xt[wt]=arguments[wt];mt<ie&&(Ye=null,rt=null,mt=ne,ne+=1);var Ct=je?(rt=rt||new x).getOrSet(this,ee):Ye=Ye||{},At;try{At=V(xt)}catch{return pe.apply(this,arguments)}var en=Ct[At];if(en&&Be&&Date.now()-en.time<Be&&(delete Ct[At],en=null),en)return en.value;var ln=Date.now(),cn=pe.apply(this,arguments);return Ct[At]={time:ln,value:cn},cn};return at.reset=function(){Ye=null,rt=null},U(at,(Te.name||A(pe))+"::memoized")}se.clear=function(){ie=ne};function de(pe){var Te={};function we(){for(var je=arguments,Be=this,Ye=arguments.length,rt=new Array(Ye),mt=0;mt<Ye;mt++)rt[mt]=arguments[mt];var at=V(rt);return Te.hasOwnProperty(at)||(Te[at]=C.try((function(){return pe.apply(Be,je)})).finally((function(){delete Te[at]}))),Te[at]}return we.reset=function(){Te={}},U(we,A(pe)+"::promiseMemoized")}function ce(){}function oe(pe,Te){if(Te===void 0&&(Te=1),Te>=3)return"stringifyError stack overflow";try{if(!pe)return"<unknown error: "+{}.toString.call(pe)+">";if(typeof pe=="string")return pe;if(pe instanceof Error){var we=pe&&pe.stack,je=pe&&pe.message;if(we&&je)return we.indexOf(je)!==-1?we:je+`