@tonconnect/ui 2.0.0-beta.0 → 2.0.0-beta.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.
- package/dist/tonconnect-ui.min.js +3 -3
- package/dist/tonconnect-ui.min.js.map +1 -1
- package/lib/index.js +7 -8
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +7 -8
- package/lib/index.umd.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__publicField=(e,t,n)=>(__defNormalProp(e,"symbol"!=typeof t?t+"":t,n),n),__async=(e,t,n)=>new Promise(((r,o)=>{var i=e=>{try{a(n.next(e))}catch(t){o(t)}},s=e=>{try{a(n.throw(e))}catch(t){o(t)}},a=e=>e.done?r(e.value):Promise.resolve(e.value).then(i,s);a((n=n.apply(e,t)).next())}));!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TON_CONNECT_UI={})}(this,(function(e){var t,n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e){var t=e.default;if("function"==typeof t){var n=function(){return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}var o,i,s,a={exports:{}};i=n,s=function(){var e={};function t(e){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(e){if("string"!=typeof e)throw new TypeError("expected string");var t,n=unescape(encodeURIComponent(e)),r=new Uint8Array(n.length);for(t=0;t<n.length;t++)r[t]=n.charCodeAt(t);return r},e.encodeUTF8=function(e){var t,n=[];for(t=0;t<e.length;t++)n.push(String.fromCharCode(e[t]));return decodeURIComponent(escape(n.join("")))},"undefined"==typeof atob?void 0!==Buffer.from?(e.encodeBase64=function(e){return Buffer.from(e).toString("base64")},e.decodeBase64=function(e){return t(e),new Uint8Array(Array.prototype.slice.call(Buffer.from(e,"base64"),0))}):(e.encodeBase64=function(e){return new Buffer(e).toString("base64")},e.decodeBase64=function(e){return t(e),new Uint8Array(Array.prototype.slice.call(new Buffer(e,"base64"),0))}):(e.encodeBase64=function(e){var t,n=[],r=e.length;for(t=0;t<r;t++)n.push(String.fromCharCode(e[t]));return btoa(n.join(""))},e.decodeBase64=function(e){t(e);var n,r=atob(e),o=new Uint8Array(r.length);for(n=0;n<r.length;n++)o[n]=r.charCodeAt(n);return o}),e},(o=a).exports?o.exports=s():(i.nacl||(i.nacl={}),i.nacl.util=s());const l=a.exports;function c(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var u={exports:{}};const d=r(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));!function(e){!function(e){var t=function(e){var t,n=new Float64Array(16);if(e)for(t=0;t<e.length;t++)n[t]=e[t];return n},n=function(){throw new Error("no PRNG")},r=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var i=t(),s=t([1]),a=t([56129,1]),l=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),u=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),h=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),f=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),g=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function p(e,t,n,r){e[t]=n>>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n,e[t+4]=r>>24&255,e[t+5]=r>>16&255,e[t+6]=r>>8&255,e[t+7]=255&r}function w(e,t,n,r,o){var i,s=0;for(i=0;i<o;i++)s|=e[t+i]^n[r+i];return(1&s-1>>>8)-1}function m(e,t,n,r){return w(e,t,n,r,16)}function v(e,t,n,r){return w(e,t,n,r,32)}function y(e,t,n,r){!function(e,t,n,r){for(var o,i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,l=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,c=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,u=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,d=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,h=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,f=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,g=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,p=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,w=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,m=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,v=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,y=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,b=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,C=i,x=s,_=a,k=l,S=c,E=u,L=d,R=h,A=f,T=g,M=p,O=w,$=m,P=v,I=y,N=b,U=0;U<20;U+=2)C^=(o=($^=(o=(A^=(o=(S^=(o=C+$|0)<<7|o>>>25)+C|0)<<9|o>>>23)+S|0)<<13|o>>>19)+A|0)<<18|o>>>14,E^=(o=(x^=(o=(P^=(o=(T^=(o=E+x|0)<<7|o>>>25)+E|0)<<9|o>>>23)+T|0)<<13|o>>>19)+P|0)<<18|o>>>14,M^=(o=(L^=(o=(_^=(o=(I^=(o=M+L|0)<<7|o>>>25)+M|0)<<9|o>>>23)+I|0)<<13|o>>>19)+_|0)<<18|o>>>14,N^=(o=(O^=(o=(R^=(o=(k^=(o=N+O|0)<<7|o>>>25)+N|0)<<9|o>>>23)+k|0)<<13|o>>>19)+R|0)<<18|o>>>14,C^=(o=(k^=(o=(_^=(o=(x^=(o=C+k|0)<<7|o>>>25)+C|0)<<9|o>>>23)+x|0)<<13|o>>>19)+_|0)<<18|o>>>14,E^=(o=(S^=(o=(R^=(o=(L^=(o=E+S|0)<<7|o>>>25)+E|0)<<9|o>>>23)+L|0)<<13|o>>>19)+R|0)<<18|o>>>14,M^=(o=(T^=(o=(A^=(o=(O^=(o=M+T|0)<<7|o>>>25)+M|0)<<9|o>>>23)+O|0)<<13|o>>>19)+A|0)<<18|o>>>14,N^=(o=(I^=(o=(P^=(o=($^=(o=N+I|0)<<7|o>>>25)+N|0)<<9|o>>>23)+$|0)<<13|o>>>19)+P|0)<<18|o>>>14;C=C+i|0,x=x+s|0,_=_+a|0,k=k+l|0,S=S+c|0,E=E+u|0,L=L+d|0,R=R+h|0,A=A+f|0,T=T+g|0,M=M+p|0,O=O+w|0,$=$+m|0,P=P+v|0,I=I+y|0,N=N+b|0,e[0]=C>>>0&255,e[1]=C>>>8&255,e[2]=C>>>16&255,e[3]=C>>>24&255,e[4]=x>>>0&255,e[5]=x>>>8&255,e[6]=x>>>16&255,e[7]=x>>>24&255,e[8]=_>>>0&255,e[9]=_>>>8&255,e[10]=_>>>16&255,e[11]=_>>>24&255,e[12]=k>>>0&255,e[13]=k>>>8&255,e[14]=k>>>16&255,e[15]=k>>>24&255,e[16]=S>>>0&255,e[17]=S>>>8&255,e[18]=S>>>16&255,e[19]=S>>>24&255,e[20]=E>>>0&255,e[21]=E>>>8&255,e[22]=E>>>16&255,e[23]=E>>>24&255,e[24]=L>>>0&255,e[25]=L>>>8&255,e[26]=L>>>16&255,e[27]=L>>>24&255,e[28]=R>>>0&255,e[29]=R>>>8&255,e[30]=R>>>16&255,e[31]=R>>>24&255,e[32]=A>>>0&255,e[33]=A>>>8&255,e[34]=A>>>16&255,e[35]=A>>>24&255,e[36]=T>>>0&255,e[37]=T>>>8&255,e[38]=T>>>16&255,e[39]=T>>>24&255,e[40]=M>>>0&255,e[41]=M>>>8&255,e[42]=M>>>16&255,e[43]=M>>>24&255,e[44]=O>>>0&255,e[45]=O>>>8&255,e[46]=O>>>16&255,e[47]=O>>>24&255,e[48]=$>>>0&255,e[49]=$>>>8&255,e[50]=$>>>16&255,e[51]=$>>>24&255,e[52]=P>>>0&255,e[53]=P>>>8&255,e[54]=P>>>16&255,e[55]=P>>>24&255,e[56]=I>>>0&255,e[57]=I>>>8&255,e[58]=I>>>16&255,e[59]=I>>>24&255,e[60]=N>>>0&255,e[61]=N>>>8&255,e[62]=N>>>16&255,e[63]=N>>>24&255}(e,t,n,r)}function b(e,t,n,r){!function(e,t,n,r){for(var o,i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,l=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,c=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,u=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,d=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,h=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,f=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,g=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,p=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,w=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,m=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,v=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,y=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,b=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,C=0;C<20;C+=2)i^=(o=(m^=(o=(f^=(o=(c^=(o=i+m|0)<<7|o>>>25)+i|0)<<9|o>>>23)+c|0)<<13|o>>>19)+f|0)<<18|o>>>14,u^=(o=(s^=(o=(v^=(o=(g^=(o=u+s|0)<<7|o>>>25)+u|0)<<9|o>>>23)+g|0)<<13|o>>>19)+v|0)<<18|o>>>14,p^=(o=(d^=(o=(a^=(o=(y^=(o=p+d|0)<<7|o>>>25)+p|0)<<9|o>>>23)+y|0)<<13|o>>>19)+a|0)<<18|o>>>14,b^=(o=(w^=(o=(h^=(o=(l^=(o=b+w|0)<<7|o>>>25)+b|0)<<9|o>>>23)+l|0)<<13|o>>>19)+h|0)<<18|o>>>14,i^=(o=(l^=(o=(a^=(o=(s^=(o=i+l|0)<<7|o>>>25)+i|0)<<9|o>>>23)+s|0)<<13|o>>>19)+a|0)<<18|o>>>14,u^=(o=(c^=(o=(h^=(o=(d^=(o=u+c|0)<<7|o>>>25)+u|0)<<9|o>>>23)+d|0)<<13|o>>>19)+h|0)<<18|o>>>14,p^=(o=(g^=(o=(f^=(o=(w^=(o=p+g|0)<<7|o>>>25)+p|0)<<9|o>>>23)+w|0)<<13|o>>>19)+f|0)<<18|o>>>14,b^=(o=(y^=(o=(v^=(o=(m^=(o=b+y|0)<<7|o>>>25)+b|0)<<9|o>>>23)+m|0)<<13|o>>>19)+v|0)<<18|o>>>14;e[0]=i>>>0&255,e[1]=i>>>8&255,e[2]=i>>>16&255,e[3]=i>>>24&255,e[4]=u>>>0&255,e[5]=u>>>8&255,e[6]=u>>>16&255,e[7]=u>>>24&255,e[8]=p>>>0&255,e[9]=p>>>8&255,e[10]=p>>>16&255,e[11]=p>>>24&255,e[12]=b>>>0&255,e[13]=b>>>8&255,e[14]=b>>>16&255,e[15]=b>>>24&255,e[16]=d>>>0&255,e[17]=d>>>8&255,e[18]=d>>>16&255,e[19]=d>>>24&255,e[20]=h>>>0&255,e[21]=h>>>8&255,e[22]=h>>>16&255,e[23]=h>>>24&255,e[24]=f>>>0&255,e[25]=f>>>8&255,e[26]=f>>>16&255,e[27]=f>>>24&255,e[28]=g>>>0&255,e[29]=g>>>8&255,e[30]=g>>>16&255,e[31]=g>>>24&255}(e,t,n,r)}var C=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function x(e,t,n,r,o,i,s){var a,l,c=new Uint8Array(16),u=new Uint8Array(64);for(l=0;l<16;l++)c[l]=0;for(l=0;l<8;l++)c[l]=i[l];for(;o>=64;){for(y(u,c,s,C),l=0;l<64;l++)e[t+l]=n[r+l]^u[l];for(a=1,l=8;l<16;l++)a=a+(255&c[l])|0,c[l]=255&a,a>>>=8;o-=64,t+=64,r+=64}if(o>0)for(y(u,c,s,C),l=0;l<o;l++)e[t+l]=n[r+l]^u[l];return 0}function _(e,t,n,r,o){var i,s,a=new Uint8Array(16),l=new Uint8Array(64);for(s=0;s<16;s++)a[s]=0;for(s=0;s<8;s++)a[s]=r[s];for(;n>=64;){for(y(l,a,o,C),s=0;s<64;s++)e[t+s]=l[s];for(i=1,s=8;s<16;s++)i=i+(255&a[s])|0,a[s]=255&i,i>>>=8;n-=64,t+=64}if(n>0)for(y(l,a,o,C),s=0;s<n;s++)e[t+s]=l[s];return 0}function k(e,t,n,r,o){var i=new Uint8Array(32);b(i,r,o,C);for(var s=new Uint8Array(8),a=0;a<8;a++)s[a]=r[a+16];return _(e,t,n,s,i)}function S(e,t,n,r,o,i,s){var a=new Uint8Array(32);b(a,i,s,C);for(var l=new Uint8Array(8),c=0;c<8;c++)l[c]=i[c+16];return x(e,t,n,r,o,l,a)}var E=function(e){var t,n,r,o,i,s,a,l;this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0,t=255&e[0]|(255&e[1])<<8,this.r[0]=8191&t,n=255&e[2]|(255&e[3])<<8,this.r[1]=8191&(t>>>13|n<<3),r=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(n>>>10|r<<6),o=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(r>>>7|o<<9),i=255&e[8]|(255&e[9])<<8,this.r[4]=255&(o>>>4|i<<12),this.r[5]=i>>>1&8190,s=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(i>>>14|s<<2),a=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(s>>>11|a<<5),l=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(a>>>8|l<<8),this.r[9]=l>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function L(e,t,n,r,o,i){var s=new E(i);return s.update(n,r,o),s.finish(e,t),0}function R(e,t,n,r,o,i){var s=new Uint8Array(16);return L(s,0,n,r,o,i),m(e,t,s,0)}function A(e,t,n,r,o){var i;if(n<32)return-1;for(S(e,0,t,0,n,r,o),L(e,16,e,32,n-32,e),i=0;i<16;i++)e[i]=0;return 0}function T(e,t,n,r,o){var i,s=new Uint8Array(32);if(n<32)return-1;if(k(s,0,32,r,o),0!==R(t,16,t,32,n-32,s))return-1;for(S(e,0,t,0,n,r,o),i=0;i<32;i++)e[i]=0;return 0}function M(e,t){var n;for(n=0;n<16;n++)e[n]=0|t[n]}function O(e){var t,n,r=1;for(t=0;t<16;t++)n=e[t]+r+65535,r=Math.floor(n/65536),e[t]=n-65536*r;e[0]+=r-1+37*(r-1)}function $(e,t,n){for(var r,o=~(n-1),i=0;i<16;i++)r=o&(e[i]^t[i]),e[i]^=r,t[i]^=r}function P(e,n){var r,o,i,s=t(),a=t();for(r=0;r<16;r++)a[r]=n[r];for(O(a),O(a),O(a),o=0;o<2;o++){for(s[0]=a[0]-65517,r=1;r<15;r++)s[r]=a[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),i=s[15]>>16&1,s[14]&=65535,$(a,s,1-i)}for(r=0;r<16;r++)e[2*r]=255&a[r],e[2*r+1]=a[r]>>8}function I(e,t){var n=new Uint8Array(32),r=new Uint8Array(32);return P(n,e),P(r,t),v(n,0,r,0)}function N(e){var t=new Uint8Array(32);return P(t,e),1&t[0]}function U(e,t){var n;for(n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function W(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]+n[r]}function j(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]-n[r]}function B(e,t,n){var r,o,i=0,s=0,a=0,l=0,c=0,u=0,d=0,h=0,f=0,g=0,p=0,w=0,m=0,v=0,y=0,b=0,C=0,x=0,_=0,k=0,S=0,E=0,L=0,R=0,A=0,T=0,M=0,O=0,$=0,P=0,I=0,N=n[0],U=n[1],W=n[2],j=n[3],B=n[4],H=n[5],K=n[6],V=n[7],D=n[8],F=n[9],q=n[10],z=n[11],Z=n[12],G=n[13],Y=n[14],Q=n[15];i+=(r=t[0])*N,s+=r*U,a+=r*W,l+=r*j,c+=r*B,u+=r*H,d+=r*K,h+=r*V,f+=r*D,g+=r*F,p+=r*q,w+=r*z,m+=r*Z,v+=r*G,y+=r*Y,b+=r*Q,s+=(r=t[1])*N,a+=r*U,l+=r*W,c+=r*j,u+=r*B,d+=r*H,h+=r*K,f+=r*V,g+=r*D,p+=r*F,w+=r*q,m+=r*z,v+=r*Z,y+=r*G,b+=r*Y,C+=r*Q,a+=(r=t[2])*N,l+=r*U,c+=r*W,u+=r*j,d+=r*B,h+=r*H,f+=r*K,g+=r*V,p+=r*D,w+=r*F,m+=r*q,v+=r*z,y+=r*Z,b+=r*G,C+=r*Y,x+=r*Q,l+=(r=t[3])*N,c+=r*U,u+=r*W,d+=r*j,h+=r*B,f+=r*H,g+=r*K,p+=r*V,w+=r*D,m+=r*F,v+=r*q,y+=r*z,b+=r*Z,C+=r*G,x+=r*Y,_+=r*Q,c+=(r=t[4])*N,u+=r*U,d+=r*W,h+=r*j,f+=r*B,g+=r*H,p+=r*K,w+=r*V,m+=r*D,v+=r*F,y+=r*q,b+=r*z,C+=r*Z,x+=r*G,_+=r*Y,k+=r*Q,u+=(r=t[5])*N,d+=r*U,h+=r*W,f+=r*j,g+=r*B,p+=r*H,w+=r*K,m+=r*V,v+=r*D,y+=r*F,b+=r*q,C+=r*z,x+=r*Z,_+=r*G,k+=r*Y,S+=r*Q,d+=(r=t[6])*N,h+=r*U,f+=r*W,g+=r*j,p+=r*B,w+=r*H,m+=r*K,v+=r*V,y+=r*D,b+=r*F,C+=r*q,x+=r*z,_+=r*Z,k+=r*G,S+=r*Y,E+=r*Q,h+=(r=t[7])*N,f+=r*U,g+=r*W,p+=r*j,w+=r*B,m+=r*H,v+=r*K,y+=r*V,b+=r*D,C+=r*F,x+=r*q,_+=r*z,k+=r*Z,S+=r*G,E+=r*Y,L+=r*Q,f+=(r=t[8])*N,g+=r*U,p+=r*W,w+=r*j,m+=r*B,v+=r*H,y+=r*K,b+=r*V,C+=r*D,x+=r*F,_+=r*q,k+=r*z,S+=r*Z,E+=r*G,L+=r*Y,R+=r*Q,g+=(r=t[9])*N,p+=r*U,w+=r*W,m+=r*j,v+=r*B,y+=r*H,b+=r*K,C+=r*V,x+=r*D,_+=r*F,k+=r*q,S+=r*z,E+=r*Z,L+=r*G,R+=r*Y,A+=r*Q,p+=(r=t[10])*N,w+=r*U,m+=r*W,v+=r*j,y+=r*B,b+=r*H,C+=r*K,x+=r*V,_+=r*D,k+=r*F,S+=r*q,E+=r*z,L+=r*Z,R+=r*G,A+=r*Y,T+=r*Q,w+=(r=t[11])*N,m+=r*U,v+=r*W,y+=r*j,b+=r*B,C+=r*H,x+=r*K,_+=r*V,k+=r*D,S+=r*F,E+=r*q,L+=r*z,R+=r*Z,A+=r*G,T+=r*Y,M+=r*Q,m+=(r=t[12])*N,v+=r*U,y+=r*W,b+=r*j,C+=r*B,x+=r*H,_+=r*K,k+=r*V,S+=r*D,E+=r*F,L+=r*q,R+=r*z,A+=r*Z,T+=r*G,M+=r*Y,O+=r*Q,v+=(r=t[13])*N,y+=r*U,b+=r*W,C+=r*j,x+=r*B,_+=r*H,k+=r*K,S+=r*V,E+=r*D,L+=r*F,R+=r*q,A+=r*z,T+=r*Z,M+=r*G,O+=r*Y,$+=r*Q,y+=(r=t[14])*N,b+=r*U,C+=r*W,x+=r*j,_+=r*B,k+=r*H,S+=r*K,E+=r*V,L+=r*D,R+=r*F,A+=r*q,T+=r*z,M+=r*Z,O+=r*G,$+=r*Y,P+=r*Q,b+=(r=t[15])*N,s+=38*(x+=r*W),a+=38*(_+=r*j),l+=38*(k+=r*B),c+=38*(S+=r*H),u+=38*(E+=r*K),d+=38*(L+=r*V),h+=38*(R+=r*D),f+=38*(A+=r*F),g+=38*(T+=r*q),p+=38*(M+=r*z),w+=38*(O+=r*Z),m+=38*($+=r*G),v+=38*(P+=r*Y),y+=38*(I+=r*Q),i=(r=(i+=38*(C+=r*U))+(o=1)+65535)-65536*(o=Math.floor(r/65536)),s=(r=s+o+65535)-65536*(o=Math.floor(r/65536)),a=(r=a+o+65535)-65536*(o=Math.floor(r/65536)),l=(r=l+o+65535)-65536*(o=Math.floor(r/65536)),c=(r=c+o+65535)-65536*(o=Math.floor(r/65536)),u=(r=u+o+65535)-65536*(o=Math.floor(r/65536)),d=(r=d+o+65535)-65536*(o=Math.floor(r/65536)),h=(r=h+o+65535)-65536*(o=Math.floor(r/65536)),f=(r=f+o+65535)-65536*(o=Math.floor(r/65536)),g=(r=g+o+65535)-65536*(o=Math.floor(r/65536)),p=(r=p+o+65535)-65536*(o=Math.floor(r/65536)),w=(r=w+o+65535)-65536*(o=Math.floor(r/65536)),m=(r=m+o+65535)-65536*(o=Math.floor(r/65536)),v=(r=v+o+65535)-65536*(o=Math.floor(r/65536)),y=(r=y+o+65535)-65536*(o=Math.floor(r/65536)),b=(r=b+o+65535)-65536*(o=Math.floor(r/65536)),i=(r=(i+=o-1+37*(o-1))+(o=1)+65535)-65536*(o=Math.floor(r/65536)),s=(r=s+o+65535)-65536*(o=Math.floor(r/65536)),a=(r=a+o+65535)-65536*(o=Math.floor(r/65536)),l=(r=l+o+65535)-65536*(o=Math.floor(r/65536)),c=(r=c+o+65535)-65536*(o=Math.floor(r/65536)),u=(r=u+o+65535)-65536*(o=Math.floor(r/65536)),d=(r=d+o+65535)-65536*(o=Math.floor(r/65536)),h=(r=h+o+65535)-65536*(o=Math.floor(r/65536)),f=(r=f+o+65535)-65536*(o=Math.floor(r/65536)),g=(r=g+o+65535)-65536*(o=Math.floor(r/65536)),p=(r=p+o+65535)-65536*(o=Math.floor(r/65536)),w=(r=w+o+65535)-65536*(o=Math.floor(r/65536)),m=(r=m+o+65535)-65536*(o=Math.floor(r/65536)),v=(r=v+o+65535)-65536*(o=Math.floor(r/65536)),y=(r=y+o+65535)-65536*(o=Math.floor(r/65536)),b=(r=b+o+65535)-65536*(o=Math.floor(r/65536)),i+=o-1+37*(o-1),e[0]=i,e[1]=s,e[2]=a,e[3]=l,e[4]=c,e[5]=u,e[6]=d,e[7]=h,e[8]=f,e[9]=g,e[10]=p,e[11]=w,e[12]=m,e[13]=v,e[14]=y,e[15]=b}function H(e,t){B(e,t,t)}function K(e,n){var r,o=t();for(r=0;r<16;r++)o[r]=n[r];for(r=253;r>=0;r--)H(o,o),2!==r&&4!==r&&B(o,o,n);for(r=0;r<16;r++)e[r]=o[r]}function V(e,n){var r,o=t();for(r=0;r<16;r++)o[r]=n[r];for(r=250;r>=0;r--)H(o,o),1!==r&&B(o,o,n);for(r=0;r<16;r++)e[r]=o[r]}function D(e,n,r){var o,i,s=new Uint8Array(32),l=new Float64Array(80),c=t(),u=t(),d=t(),h=t(),f=t(),g=t();for(i=0;i<31;i++)s[i]=n[i];for(s[31]=127&n[31]|64,s[0]&=248,U(l,r),i=0;i<16;i++)u[i]=l[i],h[i]=c[i]=d[i]=0;for(c[0]=h[0]=1,i=254;i>=0;--i)$(c,u,o=s[i>>>3]>>>(7&i)&1),$(d,h,o),W(f,c,d),j(c,c,d),W(d,u,h),j(u,u,h),H(h,f),H(g,c),B(c,d,c),B(d,u,f),W(f,c,d),j(c,c,d),H(u,c),j(d,h,g),B(c,d,a),W(c,c,h),B(d,d,c),B(c,h,g),B(h,u,l),H(u,f),$(c,u,o),$(d,h,o);for(i=0;i<16;i++)l[i+16]=c[i],l[i+32]=d[i],l[i+48]=u[i],l[i+64]=h[i];var p=l.subarray(32),w=l.subarray(16);return K(p,p),B(w,w,p),P(e,w),0}function F(e,t){return D(e,t,o)}function q(e,t){return n(t,32),F(e,t)}function z(e,t,n){var o=new Uint8Array(32);return D(o,n,t),b(e,r,o,C)}E.prototype.blocks=function(e,t,n){for(var r,o,i,s,a,l,c,u,d,h,f,g,p,w,m,v,y,b,C,x=this.fin?0:2048,_=this.h[0],k=this.h[1],S=this.h[2],E=this.h[3],L=this.h[4],R=this.h[5],A=this.h[6],T=this.h[7],M=this.h[8],O=this.h[9],$=this.r[0],P=this.r[1],I=this.r[2],N=this.r[3],U=this.r[4],W=this.r[5],j=this.r[6],B=this.r[7],H=this.r[8],K=this.r[9];n>=16;)h=d=0,h+=(_+=8191&(r=255&e[t+0]|(255&e[t+1])<<8))*$,h+=(k+=8191&(r>>>13|(o=255&e[t+2]|(255&e[t+3])<<8)<<3))*(5*K),h+=(S+=8191&(o>>>10|(i=255&e[t+4]|(255&e[t+5])<<8)<<6))*(5*H),h+=(E+=8191&(i>>>7|(s=255&e[t+6]|(255&e[t+7])<<8)<<9))*(5*B),d=(h+=(L+=8191&(s>>>4|(a=255&e[t+8]|(255&e[t+9])<<8)<<12))*(5*j))>>>13,h&=8191,h+=(R+=a>>>1&8191)*(5*W),h+=(A+=8191&(a>>>14|(l=255&e[t+10]|(255&e[t+11])<<8)<<2))*(5*U),h+=(T+=8191&(l>>>11|(c=255&e[t+12]|(255&e[t+13])<<8)<<5))*(5*N),h+=(M+=8191&(c>>>8|(u=255&e[t+14]|(255&e[t+15])<<8)<<8))*(5*I),f=d+=(h+=(O+=u>>>5|x)*(5*P))>>>13,f+=_*P,f+=k*$,f+=S*(5*K),f+=E*(5*H),d=(f+=L*(5*B))>>>13,f&=8191,f+=R*(5*j),f+=A*(5*W),f+=T*(5*U),f+=M*(5*N),d+=(f+=O*(5*I))>>>13,f&=8191,g=d,g+=_*I,g+=k*P,g+=S*$,g+=E*(5*K),d=(g+=L*(5*H))>>>13,g&=8191,g+=R*(5*B),g+=A*(5*j),g+=T*(5*W),g+=M*(5*U),p=d+=(g+=O*(5*N))>>>13,p+=_*N,p+=k*I,p+=S*P,p+=E*$,d=(p+=L*(5*K))>>>13,p&=8191,p+=R*(5*H),p+=A*(5*B),p+=T*(5*j),p+=M*(5*W),w=d+=(p+=O*(5*U))>>>13,w+=_*U,w+=k*N,w+=S*I,w+=E*P,d=(w+=L*$)>>>13,w&=8191,w+=R*(5*K),w+=A*(5*H),w+=T*(5*B),w+=M*(5*j),m=d+=(w+=O*(5*W))>>>13,m+=_*W,m+=k*U,m+=S*N,m+=E*I,d=(m+=L*P)>>>13,m&=8191,m+=R*$,m+=A*(5*K),m+=T*(5*H),m+=M*(5*B),v=d+=(m+=O*(5*j))>>>13,v+=_*j,v+=k*W,v+=S*U,v+=E*N,d=(v+=L*I)>>>13,v&=8191,v+=R*P,v+=A*$,v+=T*(5*K),v+=M*(5*H),y=d+=(v+=O*(5*B))>>>13,y+=_*B,y+=k*j,y+=S*W,y+=E*U,d=(y+=L*N)>>>13,y&=8191,y+=R*I,y+=A*P,y+=T*$,y+=M*(5*K),b=d+=(y+=O*(5*H))>>>13,b+=_*H,b+=k*B,b+=S*j,b+=E*W,d=(b+=L*U)>>>13,b&=8191,b+=R*N,b+=A*I,b+=T*P,b+=M*$,C=d+=(b+=O*(5*K))>>>13,C+=_*K,C+=k*H,C+=S*B,C+=E*j,d=(C+=L*W)>>>13,C&=8191,C+=R*U,C+=A*N,C+=T*I,C+=M*P,_=h=8191&(d=(d=((d+=(C+=O*$)>>>13)<<2)+d|0)+(h&=8191)|0),k=f+=d>>>=13,S=g&=8191,E=p&=8191,L=w&=8191,R=m&=8191,A=v&=8191,T=y&=8191,M=b&=8191,O=C&=8191,t+=16,n-=16;this.h[0]=_,this.h[1]=k,this.h[2]=S,this.h[3]=E,this.h[4]=L,this.h[5]=R,this.h[6]=A,this.h[7]=T,this.h[8]=M,this.h[9]=O},E.prototype.finish=function(e,t){var n,r,o,i,s=new Uint16Array(10);if(this.leftover){for(i=this.leftover,this.buffer[i++]=1;i<16;i++)this.buffer[i]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(n=this.h[1]>>>13,this.h[1]&=8191,i=2;i<10;i++)this.h[i]+=n,n=this.h[i]>>>13,this.h[i]&=8191;for(this.h[0]+=5*n,n=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=n,n=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=n,s[0]=this.h[0]+5,n=s[0]>>>13,s[0]&=8191,i=1;i<10;i++)s[i]=this.h[i]+n,n=s[i]>>>13,s[i]&=8191;for(s[9]-=8192,r=(1^n)-1,i=0;i<10;i++)s[i]&=r;for(r=~r,i=0;i<10;i++)this.h[i]=this.h[i]&r|s[i];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,i=1;i<8;i++)o=(this.h[i]+this.pad[i]|0)+(o>>>16)|0,this.h[i]=65535&o;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},E.prototype.update=function(e,t,n){var r,o;if(this.leftover){for((o=16-this.leftover)>n&&(o=n),r=0;r<o;r++)this.buffer[this.leftover+r]=e[t+r];if(n-=o,t+=o,this.leftover+=o,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(n>=16&&(o=n-n%16,this.blocks(e,t,o),t+=o,n-=o),n){for(r=0;r<n;r++)this.buffer[this.leftover+r]=e[t+r];this.leftover+=n}};var Z=A,G=T;var Y=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Q(e,t,n,r){for(var o,i,s,a,l,c,u,d,h,f,g,p,w,m,v,y,b,C,x,_,k,S,E,L,R,A,T=new Int32Array(16),M=new Int32Array(16),O=e[0],$=e[1],P=e[2],I=e[3],N=e[4],U=e[5],W=e[6],j=e[7],B=t[0],H=t[1],K=t[2],V=t[3],D=t[4],F=t[5],q=t[6],z=t[7],Z=0;r>=128;){for(x=0;x<16;x++)_=8*x+Z,T[x]=n[_+0]<<24|n[_+1]<<16|n[_+2]<<8|n[_+3],M[x]=n[_+4]<<24|n[_+5]<<16|n[_+6]<<8|n[_+7];for(x=0;x<80;x++)if(o=O,i=$,s=P,a=I,l=N,c=U,u=W,j,h=B,f=H,g=K,p=V,w=D,m=F,v=q,z,E=65535&(S=z),L=S>>>16,R=65535&(k=j),A=k>>>16,E+=65535&(S=(D>>>14|N<<18)^(D>>>18|N<<14)^(N>>>9|D<<23)),L+=S>>>16,R+=65535&(k=(N>>>14|D<<18)^(N>>>18|D<<14)^(D>>>9|N<<23)),A+=k>>>16,E+=65535&(S=D&F^~D&q),L+=S>>>16,R+=65535&(k=N&U^~N&W),A+=k>>>16,k=Y[2*x],E+=65535&(S=Y[2*x+1]),L+=S>>>16,R+=65535&k,A+=k>>>16,k=T[x%16],L+=(S=M[x%16])>>>16,R+=65535&k,A+=k>>>16,R+=(L+=(E+=65535&S)>>>16)>>>16,E=65535&(S=C=65535&E|L<<16),L=S>>>16,R=65535&(k=b=65535&R|(A+=R>>>16)<<16),A=k>>>16,E+=65535&(S=(B>>>28|O<<4)^(O>>>2|B<<30)^(O>>>7|B<<25)),L+=S>>>16,R+=65535&(k=(O>>>28|B<<4)^(B>>>2|O<<30)^(B>>>7|O<<25)),A+=k>>>16,L+=(S=B&H^B&K^H&K)>>>16,R+=65535&(k=O&$^O&P^$&P),A+=k>>>16,d=65535&(R+=(L+=(E+=65535&S)>>>16)>>>16)|(A+=R>>>16)<<16,y=65535&E|L<<16,E=65535&(S=p),L=S>>>16,R=65535&(k=a),A=k>>>16,L+=(S=C)>>>16,R+=65535&(k=b),A+=k>>>16,$=o,P=i,I=s,N=a=65535&(R+=(L+=(E+=65535&S)>>>16)>>>16)|(A+=R>>>16)<<16,U=l,W=c,j=u,O=d,H=h,K=f,V=g,D=p=65535&E|L<<16,F=w,q=m,z=v,B=y,x%16==15)for(_=0;_<16;_++)k=T[_],E=65535&(S=M[_]),L=S>>>16,R=65535&k,A=k>>>16,k=T[(_+9)%16],E+=65535&(S=M[(_+9)%16]),L+=S>>>16,R+=65535&k,A+=k>>>16,b=T[(_+1)%16],E+=65535&(S=((C=M[(_+1)%16])>>>1|b<<31)^(C>>>8|b<<24)^(C>>>7|b<<25)),L+=S>>>16,R+=65535&(k=(b>>>1|C<<31)^(b>>>8|C<<24)^b>>>7),A+=k>>>16,b=T[(_+14)%16],L+=(S=((C=M[(_+14)%16])>>>19|b<<13)^(b>>>29|C<<3)^(C>>>6|b<<26))>>>16,R+=65535&(k=(b>>>19|C<<13)^(C>>>29|b<<3)^b>>>6),A+=k>>>16,A+=(R+=(L+=(E+=65535&S)>>>16)>>>16)>>>16,T[_]=65535&R|A<<16,M[_]=65535&E|L<<16;E=65535&(S=B),L=S>>>16,R=65535&(k=O),A=k>>>16,k=e[0],L+=(S=t[0])>>>16,R+=65535&k,A+=k>>>16,A+=(R+=(L+=(E+=65535&S)>>>16)>>>16)>>>16,e[0]=O=65535&R|A<<16,t[0]=B=65535&E|L<<16,E=65535&(S=H),L=S>>>16,R=65535&(k=$),A=k>>>16,k=e[1],L+=(S=t[1])>>>16,R+=65535&k,A+=k>>>16,A+=(R+=(L+=(E+=65535&S)>>>16)>>>16)>>>16,e[1]=$=65535&R|A<<16,t[1]=H=65535&E|L<<16,E=65535&(S=K),L=S>>>16,R=65535&(k=P),A=k>>>16,k=e[2],L+=(S=t[2])>>>16,R+=65535&k,A+=k>>>16,A+=(R+=(L+=(E+=65535&S)>>>16)>>>16)>>>16,e[2]=P=65535&R|A<<16,t[2]=K=65535&E|L<<16,E=65535&(S=V),L=S>>>16,R=65535&(k=I),A=k>>>16,k=e[3],L+=(S=t[3])>>>16,R+=65535&k,A+=k>>>16,A+=(R+=(L+=(E+=65535&S)>>>16)>>>16)>>>16,e[3]=I=65535&R|A<<16,t[3]=V=65535&E|L<<16,E=65535&(S=D),L=S>>>16,R=65535&(k=N),A=k>>>16,k=e[4],L+=(S=t[4])>>>16,R+=65535&k,A+=k>>>16,A+=(R+=(L+=(E+=65535&S)>>>16)>>>16)>>>16,e[4]=N=65535&R|A<<16,t[4]=D=65535&E|L<<16,E=65535&(S=F),L=S>>>16,R=65535&(k=U),A=k>>>16,k=e[5],L+=(S=t[5])>>>16,R+=65535&k,A+=k>>>16,A+=(R+=(L+=(E+=65535&S)>>>16)>>>16)>>>16,e[5]=U=65535&R|A<<16,t[5]=F=65535&E|L<<16,E=65535&(S=q),L=S>>>16,R=65535&(k=W),A=k>>>16,k=e[6],L+=(S=t[6])>>>16,R+=65535&k,A+=k>>>16,A+=(R+=(L+=(E+=65535&S)>>>16)>>>16)>>>16,e[6]=W=65535&R|A<<16,t[6]=q=65535&E|L<<16,E=65535&(S=z),L=S>>>16,R=65535&(k=j),A=k>>>16,k=e[7],L+=(S=t[7])>>>16,R+=65535&k,A+=k>>>16,A+=(R+=(L+=(E+=65535&S)>>>16)>>>16)>>>16,e[7]=j=65535&R|A<<16,t[7]=z=65535&E|L<<16,Z+=128,r-=128}return r}function J(e,t,n){var r,o=new Int32Array(8),i=new Int32Array(8),s=new Uint8Array(256),a=n;for(o[0]=1779033703,o[1]=3144134277,o[2]=1013904242,o[3]=2773480762,o[4]=1359893119,o[5]=2600822924,o[6]=528734635,o[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,Q(o,i,t,n),n%=128,r=0;r<n;r++)s[r]=t[a-n+r];for(s[n]=128,s[(n=256-128*(n<112?1:0))-9]=0,p(s,n-8,a/536870912|0,a<<3),Q(o,i,s,n),r=0;r<8;r++)p(e,8*r,o[r],i[r]);return 0}function X(e,n){var r=t(),o=t(),i=t(),s=t(),a=t(),l=t(),c=t(),d=t(),h=t();j(r,e[1],e[0]),j(h,n[1],n[0]),B(r,r,h),W(o,e[0],e[1]),W(h,n[0],n[1]),B(o,o,h),B(i,e[3],n[3]),B(i,i,u),B(s,e[2],n[2]),W(s,s,s),j(a,o,r),j(l,s,i),W(c,s,i),W(d,o,r),B(e[0],a,l),B(e[1],d,c),B(e[2],c,l),B(e[3],a,d)}function ee(e,t,n){var r;for(r=0;r<4;r++)$(e[r],t[r],n)}function te(e,n){var r=t(),o=t(),i=t();K(i,n[2]),B(r,n[0],i),B(o,n[1],i),P(e,o),e[31]^=N(r)<<7}function ne(e,t,n){var r,o;for(M(e[0],i),M(e[1],s),M(e[2],s),M(e[3],i),o=255;o>=0;--o)ee(e,t,r=n[o/8|0]>>(7&o)&1),X(t,e),X(e,e),ee(e,t,r)}function re(e,n){var r=[t(),t(),t(),t()];M(r[0],h),M(r[1],f),M(r[2],s),B(r[3],h,f),ne(e,r,n)}function oe(e,r,o){var i,s=new Uint8Array(64),a=[t(),t(),t(),t()];for(o||n(r,32),J(s,r,32),s[0]&=248,s[31]&=127,s[31]|=64,re(a,s),te(e,a),i=0;i<32;i++)r[i+32]=e[i];return 0}var ie=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function se(e,t){var n,r,o,i;for(r=63;r>=32;--r){for(n=0,o=r-32,i=r-12;o<i;++o)t[o]+=n-16*t[r]*ie[o-(r-32)],n=Math.floor((t[o]+128)/256),t[o]-=256*n;t[o]+=n,t[r]=0}for(n=0,o=0;o<32;o++)t[o]+=n-(t[31]>>4)*ie[o],n=t[o]>>8,t[o]&=255;for(o=0;o<32;o++)t[o]-=n*ie[o];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=255&t[r]}function ae(e){var t,n=new Float64Array(64);for(t=0;t<64;t++)n[t]=e[t];for(t=0;t<64;t++)e[t]=0;se(e,n)}function le(e,n,r,o){var i,s,a=new Uint8Array(64),l=new Uint8Array(64),c=new Uint8Array(64),u=new Float64Array(64),d=[t(),t(),t(),t()];J(a,o,32),a[0]&=248,a[31]&=127,a[31]|=64;var h=r+64;for(i=0;i<r;i++)e[64+i]=n[i];for(i=0;i<32;i++)e[32+i]=a[32+i];for(J(c,e.subarray(32),r+32),ae(c),re(d,c),te(e,d),i=32;i<64;i++)e[i]=o[i];for(J(l,e,r+64),ae(l),i=0;i<64;i++)u[i]=0;for(i=0;i<32;i++)u[i]=c[i];for(i=0;i<32;i++)for(s=0;s<32;s++)u[i+s]+=l[i]*a[s];return se(e.subarray(32),u),h}function ce(e,n,r,o){var a,c=new Uint8Array(32),u=new Uint8Array(64),d=[t(),t(),t(),t()],h=[t(),t(),t(),t()];if(r<64)return-1;if(function(e,n){var r=t(),o=t(),a=t(),c=t(),u=t(),d=t(),h=t();return M(e[2],s),U(e[1],n),H(a,e[1]),B(c,a,l),j(a,a,e[2]),W(c,e[2],c),H(u,c),H(d,u),B(h,d,u),B(r,h,a),B(r,r,c),V(r,r),B(r,r,a),B(r,r,c),B(r,r,c),B(e[0],r,c),H(o,e[0]),B(o,o,c),I(o,a)&&B(e[0],e[0],g),H(o,e[0]),B(o,o,c),I(o,a)?-1:(N(e[0])===n[31]>>7&&j(e[0],i,e[0]),B(e[3],e[0],e[1]),0)}(h,o))return-1;for(a=0;a<r;a++)e[a]=n[a];for(a=0;a<32;a++)e[a+32]=o[a];if(J(u,e,r),ae(u),ne(d,h,u),re(h,n.subarray(32)),X(d,h),te(c,d),r-=64,v(n,0,c,0)){for(a=0;a<r;a++)e[a]=0;return-1}for(a=0;a<r;a++)e[a]=n[a+64];return r}var ue=32,de=24,he=16,fe=32,ge=32,pe=de,we=64,me=32,ve=64;function ye(e,t){if(e.length!==ue)throw new Error("bad key size");if(t.length!==de)throw new Error("bad nonce size")}function be(){for(var e=0;e<arguments.length;e++)if(!(arguments[e]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Ce(e){for(var t=0;t<e.length;t++)e[t]=0}e.lowlevel={crypto_core_hsalsa20:b,crypto_stream_xor:S,crypto_stream:k,crypto_stream_salsa20_xor:x,crypto_stream_salsa20:_,crypto_onetimeauth:L,crypto_onetimeauth_verify:R,crypto_verify_16:m,crypto_verify_32:v,crypto_secretbox:A,crypto_secretbox_open:T,crypto_scalarmult:D,crypto_scalarmult_base:F,crypto_box_beforenm:z,crypto_box_afternm:Z,crypto_box:function(e,t,n,r,o,i){var s=new Uint8Array(32);return z(s,o,i),Z(e,t,n,r,s)},crypto_box_open:function(e,t,n,r,o,i){var s=new Uint8Array(32);return z(s,o,i),G(e,t,n,r,s)},crypto_box_keypair:q,crypto_hash:J,crypto_sign:le,crypto_sign_keypair:oe,crypto_sign_open:ce,crypto_secretbox_KEYBYTES:ue,crypto_secretbox_NONCEBYTES:de,crypto_secretbox_ZEROBYTES:32,crypto_secretbox_BOXZEROBYTES:he,crypto_scalarmult_BYTES:32,crypto_scalarmult_SCALARBYTES:32,crypto_box_PUBLICKEYBYTES:fe,crypto_box_SECRETKEYBYTES:ge,crypto_box_BEFORENMBYTES:32,crypto_box_NONCEBYTES:pe,crypto_box_ZEROBYTES:32,crypto_box_BOXZEROBYTES:16,crypto_sign_BYTES:we,crypto_sign_PUBLICKEYBYTES:me,crypto_sign_SECRETKEYBYTES:ve,crypto_sign_SEEDBYTES:32,crypto_hash_BYTES:64,gf:t,D:l,L:ie,pack25519:P,unpack25519:U,M:B,A:W,S:H,Z:j,pow2523:V,add:X,set25519:M,modL:se,scalarmult:ne,scalarbase:re},e.randomBytes=function(e){var t=new Uint8Array(e);return n(t,e),t},e.secretbox=function(e,t,n){be(e,t,n),ye(n,t);for(var r=new Uint8Array(32+e.length),o=new Uint8Array(r.length),i=0;i<e.length;i++)r[i+32]=e[i];return A(o,r,r.length,t,n),o.subarray(he)},e.secretbox.open=function(e,t,n){be(e,t,n),ye(n,t);for(var r=new Uint8Array(he+e.length),o=new Uint8Array(r.length),i=0;i<e.length;i++)r[i+he]=e[i];return r.length<32||0!==T(o,r,r.length,t,n)?null:o.subarray(32)},e.secretbox.keyLength=ue,e.secretbox.nonceLength=de,e.secretbox.overheadLength=he,e.scalarMult=function(e,t){if(be(e,t),32!==e.length)throw new Error("bad n size");if(32!==t.length)throw new Error("bad p size");var n=new Uint8Array(32);return D(n,e,t),n},e.scalarMult.base=function(e){if(be(e),32!==e.length)throw new Error("bad n size");var t=new Uint8Array(32);return F(t,e),t},e.scalarMult.scalarLength=32,e.scalarMult.groupElementLength=32,e.box=function(t,n,r,o){var i=e.box.before(r,o);return e.secretbox(t,n,i)},e.box.before=function(e,t){be(e,t),function(e,t){if(e.length!==fe)throw new Error("bad public key size");if(t.length!==ge)throw new Error("bad secret key size")}(e,t);var n=new Uint8Array(32);return z(n,e,t),n},e.box.after=e.secretbox,e.box.open=function(t,n,r,o){var i=e.box.before(r,o);return e.secretbox.open(t,n,i)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var e=new Uint8Array(fe),t=new Uint8Array(ge);return q(e,t),{publicKey:e,secretKey:t}},e.box.keyPair.fromSecretKey=function(e){if(be(e),e.length!==ge)throw new Error("bad secret key size");var t=new Uint8Array(fe);return F(t,e),{publicKey:t,secretKey:new Uint8Array(e)}},e.box.publicKeyLength=fe,e.box.secretKeyLength=ge,e.box.sharedKeyLength=32,e.box.nonceLength=pe,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(e,t){if(be(e,t),t.length!==ve)throw new Error("bad secret key size");var n=new Uint8Array(we+e.length);return le(n,e,e.length,t),n},e.sign.open=function(e,t){if(be(e,t),t.length!==me)throw new Error("bad public key size");var n=new Uint8Array(e.length),r=ce(n,e,e.length,t);if(r<0)return null;for(var o=new Uint8Array(r),i=0;i<o.length;i++)o[i]=n[i];return o},e.sign.detached=function(t,n){for(var r=e.sign(t,n),o=new Uint8Array(we),i=0;i<o.length;i++)o[i]=r[i];return o},e.sign.detached.verify=function(e,t,n){if(be(e,t,n),t.length!==we)throw new Error("bad signature size");if(n.length!==me)throw new Error("bad public key size");var r,o=new Uint8Array(we+e.length),i=new Uint8Array(we+e.length);for(r=0;r<we;r++)o[r]=t[r];for(r=0;r<e.length;r++)o[r+we]=e[r];return ce(i,o,o.length,n)>=0},e.sign.keyPair=function(){var e=new Uint8Array(me),t=new Uint8Array(ve);return oe(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(be(e),e.length!==ve)throw new Error("bad secret key size");for(var t=new Uint8Array(me),n=0;n<t.length;n++)t[n]=e[32+n];return{publicKey:t,secretKey:new Uint8Array(e)}},e.sign.keyPair.fromSeed=function(e){if(be(e),32!==e.length)throw new Error("bad seed size");for(var t=new Uint8Array(me),n=new Uint8Array(ve),r=0;r<32;r++)n[r]=e[r];return oe(t,n,!0),{publicKey:t,secretKey:n}},e.sign.publicKeyLength=me,e.sign.secretKeyLength=ve,e.sign.seedLength=32,e.sign.signatureLength=we,e.hash=function(e){be(e);var t=new Uint8Array(64);return J(t,e,e.length),t},e.hash.hashLength=64,e.verify=function(e,t){return be(e,t),0!==e.length&&0!==t.length&&(e.length===t.length&&0===w(e,0,t,0,e.length))},e.setPRNG=function(e){n=e},function(){var t="undefined"!=typeof self?self.crypto||self.msCrypto:null;if(t&&t.getRandomValues){e.setPRNG((function(e,n){var r,o=new Uint8Array(n);for(r=0;r<n;r+=65536)t.getRandomValues(o.subarray(r,r+Math.min(n-r,65536)));for(r=0;r<n;r++)e[r]=o[r];Ce(o)}))}else void 0!==c&&(t=d)&&t.randomBytes&&e.setPRNG((function(e,n){var r,o=t.randomBytes(n);for(r=0;r<n;r++)e[r]=o[r];Ce(o)}))}()}(e.exports?e.exports:self.nacl=self.nacl||{})}(u);const h=u.exports;var f,g,p,w,m,v,y,b,C,x;(g=f||(f={}))[g.UNKNOWN_ERROR=0]="UNKNOWN_ERROR",g[g.BAD_REQUEST_ERROR=1]="BAD_REQUEST_ERROR",g[g.MANIFEST_NOT_FOUND_ERROR=2]="MANIFEST_NOT_FOUND_ERROR",g[g.MANIFEST_CONTENT_ERROR=3]="MANIFEST_CONTENT_ERROR",g[g.UNKNOWN_APP_ERROR=100]="UNKNOWN_APP_ERROR",g[g.USER_REJECTS_ERROR=300]="USER_REJECTS_ERROR",g[g.METHOD_NOT_SUPPORTED=400]="METHOD_NOT_SUPPORTED",e.CONNECT_ITEM_ERROR_CODES=void 0,(p=e.CONNECT_ITEM_ERROR_CODES||(e.CONNECT_ITEM_ERROR_CODES={}))[p.UNKNOWN_ERROR=0]="UNKNOWN_ERROR",p[p.METHOD_NOT_SUPPORTED=400]="METHOD_NOT_SUPPORTED",(m=w||(w={}))[m.UNKNOWN_ERROR=0]="UNKNOWN_ERROR",m[m.BAD_REQUEST_ERROR=1]="BAD_REQUEST_ERROR",m[m.UNKNOWN_APP_ERROR=100]="UNKNOWN_APP_ERROR",m[m.USER_REJECTS_ERROR=300]="USER_REJECTS_ERROR",m[m.METHOD_NOT_SUPPORTED=400]="METHOD_NOT_SUPPORTED",(y=v||(v={}))[y.UNKNOWN_ERROR=0]="UNKNOWN_ERROR",y[y.BAD_REQUEST_ERROR=1]="BAD_REQUEST_ERROR",y[y.UNKNOWN_APP_ERROR=100]="UNKNOWN_APP_ERROR",y[y.USER_REJECTS_ERROR=300]="USER_REJECTS_ERROR",y[y.METHOD_NOT_SUPPORTED=400]="METHOD_NOT_SUPPORTED",(C=b||(b={}))[C.UNKNOWN_ERROR=0]="UNKNOWN_ERROR",C[C.BAD_REQUEST_ERROR=1]="BAD_REQUEST_ERROR",C[C.UNKNOWN_APP_ERROR=100]="UNKNOWN_APP_ERROR",C[C.METHOD_NOT_SUPPORTED=400]="METHOD_NOT_SUPPORTED",e.CHAIN=void 0,(x=e.CHAIN||(e.CHAIN={})).MAINNET="-239",x.TESTNET="-3";const _={encode:function(e,t=!1){let n;return e instanceof Uint8Array?n=e:("string"!=typeof e&&(e=JSON.stringify(e)),n=l.decodeUTF8(e)),function(e,t){const n=l.encodeBase64(e);return t?encodeURIComponent(n):n}(n,t)},decode:function(e,t=!1){const n=function(e,t){return t&&(e=decodeURIComponent(e)),l.decodeBase64(e)}(e,t);return{toString:()=>l.encodeUTF8(n),toObject(){try{return JSON.parse(l.encodeUTF8(n))}catch(e){return null}},toUint8Array:()=>n}}};function k(e){let t="";return e.forEach((e=>{t+=("0"+(255&e).toString(16)).slice(-2)})),t}function S(e){if(e.length%2!=0)throw new Error(`Cannot convert ${e} to bytesArray`);const t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n/2]=parseInt(e.slice(n,n+2),16);return t}class E{constructor(e){this.nonceLength=24,this.keyPair=e?this.createKeypairFromString(e):this.createKeypair(),this.sessionId=k(this.keyPair.publicKey)}createKeypair(){return h.box.keyPair()}createKeypairFromString(e){return{publicKey:S(e.publicKey),secretKey:S(e.secretKey)}}createNonce(){return h.randomBytes(this.nonceLength)}encrypt(e,t){const n=(new TextEncoder).encode(e),r=this.createNonce();return function(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}(r,h.box(n,r,t,this.keyPair.secretKey))}decrypt(e,t){const[n,r]=function(e,t){if(t>=e.length)throw new Error("Index is out of buffer");return[e.slice(0,t),e.slice(t)]}(e,this.nonceLength),o=h.box.open(r,n,t,this.keyPair.secretKey);if(!o)throw new Error(`Decryption error: \n message: ${e.toString()} \n sender pubkey: ${t.toString()} \n keypair pubkey: ${this.keyPair.publicKey.toString()} \n keypair secretkey: ${this.keyPair.secretKey.toString()}`);return(new TextDecoder).decode(o)}stringifyKeypair(){return{publicKey:k(this.keyPair.publicKey),secretKey:k(this.keyPair.secretKey)}}}function L(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{l(r.next(e))}catch(t){i(t)}}function a(e){try{l(r.throw(e))}catch(t){i(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))}class R extends Error{constructor(e,t){super(e,t),this.message=`${R.prefix} ${this.constructor.name}${this.info?": "+this.info:""}${e?"\n"+e:""}`,Object.setPrototypeOf(this,R.prototype)}get info(){return""}}R.prefix="[TON_CONNECT_SDK_ERROR]";class A extends R{get info(){return"Passed DappMetadata is in incorrect format."}constructor(...e){super(...e),Object.setPrototypeOf(this,A.prototype)}}class T extends R{get info(){return"Passed `tonconnect-manifest.json` contains errors. Check format of your manifest. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"}constructor(...e){super(...e),Object.setPrototypeOf(this,T.prototype)}}class M extends R{get info(){return"Manifest not found. Make sure you added `tonconnect-manifest.json` to the root of your app or passed correct manifestUrl. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"}constructor(...e){super(...e),Object.setPrototypeOf(this,M.prototype)}}class O extends R{get info(){return"Wallet connection called but wallet already connected. To avoid the error, disconnect the wallet before doing a new connection."}constructor(...e){super(...e),Object.setPrototypeOf(this,O.prototype)}}class $ extends R{get info(){return"Send transaction or other protocol methods called while wallet is not connected."}constructor(...e){super(...e),Object.setPrototypeOf(this,$.prototype)}}class P extends R{get info(){return"User rejects the action in the wallet."}constructor(...e){super(...e),Object.setPrototypeOf(this,P.prototype)}}class I extends R{get info(){return"Request to the wallet contains errors."}constructor(...e){super(...e),Object.setPrototypeOf(this,I.prototype)}}class N extends R{get info(){return"App tries to send rpc request to the injected wallet while not connected."}constructor(...e){super(...e),Object.setPrototypeOf(this,N.prototype)}}class U extends R{get info(){return"There is an attempt to connect to the injected wallet while it is not exists in the webpage."}constructor(...e){super(...e),Object.setPrototypeOf(this,U.prototype)}}class W extends R{get info(){return"Storage was not specified in the `DappMetadata` and default `localStorage` was not detected in the environment."}constructor(...e){super(...e),Object.setPrototypeOf(this,W.prototype)}}class j extends R{get info(){return"An error occurred while fetching the wallets list."}constructor(...e){super(...e),Object.setPrototypeOf(this,j.prototype)}}class B extends R{get info(){return"Passed address is in incorrect format."}constructor(...e){super(...e),Object.setPrototypeOf(this,B.prototype)}}class H extends R{get info(){return"Passed hex is in incorrect format."}constructor(...e){super(...e),Object.setPrototypeOf(this,H.prototype)}}class K extends R{constructor(...e){super(...e),Object.setPrototypeOf(this,K.prototype)}}const V={[f.UNKNOWN_ERROR]:K,[f.USER_REJECTS_ERROR]:P,[f.BAD_REQUEST_ERROR]:I,[f.UNKNOWN_APP_ERROR]:N,[f.MANIFEST_NOT_FOUND_ERROR]:M,[f.MANIFEST_CONTENT_ERROR]:T};const D=new class{parseError(e){let t=K;return e.code in V&&(t=V[e.code]||K),new t(e.message)}};class F{isError(e){return"error"in e}}const q={[w.UNKNOWN_ERROR]:K,[w.USER_REJECTS_ERROR]:P,[w.BAD_REQUEST_ERROR]:I,[w.UNKNOWN_APP_ERROR]:N};const z=new class extends F{convertToRpcRequest(e){return{method:"sendTransaction",params:[JSON.stringify(e)]}}parseAndThrowError(e){let t=K;throw e.error.code in q&&(t=q[e.error.code]||K),new t(e.error.message)}convertFromRpcResponse(e){return{boc:e.result}}};class Z{constructor(e,t){this.storage=e,this.storeKey="ton-connect-storage_http-bridge-gateway::"+t}storeLastEventId(e){return L(this,void 0,void 0,(function*(){return this.storage.setItem(this.storeKey,e)}))}removeLastEventId(){return L(this,void 0,void 0,(function*(){return this.storage.removeItem(this.storeKey)}))}getLastEventId(){return L(this,void 0,void 0,(function*(){const e=yield this.storage.getItem(this.storeKey);return e||null}))}}function G(e,t){return function(e){return"/"===e.slice(-1)?e.slice(0,-1):e}(e)+"/"+t}function Y(e){const t=new URL(e);return"tg:"===t.protocol||"t.me"===t.hostname}function Q(e){return e.replaceAll(".","%2E").replaceAll("-","%2D").replaceAll("_","%5F").replaceAll("&","-").replaceAll("=","__").replaceAll("%","--")}class J{constructor(e,t,n,r,o){this.bridgeUrl=t,this.sessionId=n,this.listener=r,this.errorsListener=o,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.isClosed=!1,this.bridgeGatewayStorage=new Z(e,t)}registerSession(){return L(this,void 0,void 0,(function*(){const e=new URL(G(this.bridgeUrl,this.ssePath));e.searchParams.append("client_id",this.sessionId);const t=yield this.bridgeGatewayStorage.getLastEventId();if(!this.isClosed)return t&&e.searchParams.append("last_event_id",t),this.eventSource=new EventSource(e.toString()),new Promise(((e,t)=>{this.eventSource.onerror=t,this.eventSource.onopen=()=>{this.eventSource.onerror=this.errorsHandler.bind(this),this.eventSource.onmessage=this.messagesHandler.bind(this),e()}}))}))}send(e,t,n,r){return L(this,void 0,void 0,(function*(){const o=new URL(G(this.bridgeUrl,this.postPath));o.searchParams.append("client_id",this.sessionId),o.searchParams.append("to",t),o.searchParams.append("ttl",(r||this.defaultTtl).toString()),o.searchParams.append("topic",n),yield fetch(o,{method:"post",body:_.encode(e)})}))}pause(){var e;null===(e=this.eventSource)||void 0===e||e.close()}unPause(){return this.registerSession()}close(){var e;this.isClosed=!0,null===(e=this.eventSource)||void 0===e||e.close()}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}errorsHandler(e){var t,n;if(!this.isClosed){if((null===(t=this.eventSource)||void 0===t?void 0:t.readyState)===EventSource.CLOSED)return this.eventSource.close(),void this.registerSession();if((null===(n=this.eventSource)||void 0===n?void 0:n.readyState)===EventSource.CONNECTING)return void console.debug("[TON_CONNET_SDK_ERROR]: Bridge error",JSON.stringify(e));this.errorsListener(e)}}messagesHandler(e){return L(this,void 0,void 0,(function*(){if(e.data!==this.heartbeatMessage&&(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),!this.isClosed)){let n;try{n=JSON.parse(e.data)}catch(t){throw new R(`Bridge message parse failed, message ${t.data}`)}this.listener(n)}}))}}function X(e){return!("connectEvent"in e)}class ee{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return L(this,void 0,void 0,(function*(){if("injected"===e.type)return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!X(e)){const t={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},n={type:"http",connectEvent:e.connectEvent,session:t,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(n))}const t={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(t))}))}removeConnection(){return L(this,void 0,void 0,(function*(){return this.storage.removeItem(this.storeKey)}))}getConnection(){return L(this,void 0,void 0,(function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const t=JSON.parse(e);if("injected"===t.type)return t;if("connectEvent"in t){const e=new E(t.session.sessionKeyPair);return{type:"http",connectEvent:t.connectEvent,lastWalletEventId:t.lastWalletEventId,nextRpcRequestId:t.nextRpcRequestId,session:{sessionCrypto:e,bridgeUrl:t.session.bridgeUrl,walletPublicKey:t.session.walletPublicKey}}}return{type:"http",sessionCrypto:new E(t.sessionCrypto),connectionSource:t.connectionSource}}))}getHttpConnection(){return L(this,void 0,void 0,(function*(){const e=yield this.getConnection();if(!e)throw new R("Trying to read HTTP connection source while nothing is stored");if("injected"===e.type)throw new R("Trying to read HTTP connection source while injected connection is stored");return e}))}getHttpPendingConnection(){return L(this,void 0,void 0,(function*(){const e=yield this.getConnection();if(!e)throw new R("Trying to read HTTP connection source while nothing is stored");if("injected"===e.type)throw new R("Trying to read HTTP connection source while injected connection is stored");if(!X(e))throw new R("Trying to read HTTP-pending connection while http connection is stored");return e}))}getInjectedConnection(){return L(this,void 0,void 0,(function*(){const e=yield this.getConnection();if(!e)throw new R("Trying to read Injected bridge connection source while nothing is stored");if("http"===(null==e?void 0:e.type))throw new R("Trying to read Injected bridge connection source while HTTP connection is stored");return e}))}storedConnectionType(){return L(this,void 0,void 0,(function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;return JSON.parse(e).type}))}storeLastWalletEventId(e){return L(this,void 0,void 0,(function*(){const t=yield this.getConnection();if(t&&"http"===t.type&&!X(t))return t.lastWalletEventId=e,this.storeConnection(t)}))}getLastWalletEventId(){return L(this,void 0,void 0,(function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId}))}increaseNextRpcRequestId(){return L(this,void 0,void 0,(function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const t=e.nextRpcRequestId||0;return e.nextRpcRequestId=t+1,this.storeConnection(e)}}))}getNextRpcRequestId(){return L(this,void 0,void 0,(function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0}))}}function te(...e){try{console.debug("[TON_CONNECT_SDK]",...e)}catch(t){}}function ne(...e){try{console.error("[TON_CONNECT_SDK]",...e)}catch(t){}}class re{constructor(e,t){this.storage=e,this.walletConnectionSource=t,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.connectionStorage=new ee(e)}static fromStorage(e){return L(this,void 0,void 0,(function*(){const t=new ee(e),n=yield t.getHttpConnection();return X(n)?new re(e,n.connectionSource):new re(e,{bridgeUrl:n.session.bridgeUrl})}))}connect(e){this.closeGateways();const t=new E;this.session={sessionCrypto:t,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:t}).then((()=>this.openGateways(t)));const n="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(n,e)}restoreConnection(){return L(this,void 0,void 0,(function*(){this.closeGateways();const e=yield this.connectionStorage.getHttpConnection();if(e){if(X(e))return this.session={sessionCrypto:e.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.openGateways(e.sessionCrypto);if(Array.isArray(this.walletConnectionSource))throw new R("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");this.session=e.session,this.gateway=new J(this.storage,this.walletConnectionSource.bridgeUrl,e.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),yield this.gateway.registerSession(),this.listeners.forEach((t=>t(e.connectEvent)))}}))}sendRequest(e,t){return new Promise(((n,r)=>L(this,void 0,void 0,(function*(){if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new R("Trying to send bridge request without session");const o=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),te("Send http-bridge request:",Object.assign(Object.assign({},e),{id:o}));const i=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:o})),S(this.session.walletPublicKey));this.gateway.send(i,this.session.walletPublicKey,e.method).catch(r),this.pendingRequests.set(o.toString(),n),null==t||t()}))))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(){return L(this,void 0,void 0,(function*(){return new Promise((e=>L(this,void 0,void 0,(function*(){let t=!1;const n=()=>{t=!0,this.removeBridgeAndSession().then(e)};try{yield this.sendRequest({method:"disconnect",params:[]},n)}catch(r){console.debug(r),t||this.removeBridgeAndSession().then(e)}}))))}))}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter((t=>t!==e))}pause(){var e;null===(e=this.gateway)||void 0===e||e.pause(),this.pendingGateways.forEach((e=>e.pause()))}unPause(){return L(this,void 0,void 0,(function*(){const e=this.pendingGateways.map((e=>e.unPause()));this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)}))}pendingGatewaysListener(e,t,n){return L(this,void 0,void 0,(function*(){if(this.pendingGateways.includes(e))return this.closeGateways({except:e}),this.session.bridgeUrl=t,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n);e.close()}))}gatewayListener(e){return L(this,void 0,void 0,(function*(){const t=JSON.parse(this.session.sessionCrypto.decrypt(_.decode(e.message).toUint8Array(),S(e.from)));if(te("Wallet message received:",t),!("event"in t)){const e=t.id.toString(),n=this.pendingRequests.get(e);return n?(n(t),void this.pendingRequests.delete(e)):void te(`Response id ${e} doesn't match any request's id`)}if(void 0!==t.id){const e=yield this.connectionStorage.getLastWalletEventId();if(void 0!==e&&t.id<=e)return void ne(`Received event id (=${t.id}) must be greater than stored last wallet event id (=${e}) `);"connect"!==t.event&&(yield this.connectionStorage.storeLastWalletEventId(t.id))}const n=this.listeners;"connect"===t.event&&(yield this.updateSession(t,e.from)),"disconnect"===t.event&&(yield this.removeBridgeAndSession()),n.forEach((e=>e(t)))}))}gatewayErrorsListener(e){return L(this,void 0,void 0,(function*(){throw new R(`Bridge error ${JSON.stringify(e)}`)}))}updateSession(e,t){return L(this,void 0,void 0,(function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:t});const n=e.payload.items.find((e=>"ton_addr"===e.name)),r=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:r,nextRpcRequestId:0})}))}removeBridgeAndSession(){return L(this,void 0,void 0,(function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()}))}generateUniversalLink(e,t){return Y(e)?this.generateTGUniversalLink(e,t):this.generateRegularUniversalLink(e,t)}generateRegularUniversalLink(e,t){const n=new URL(e);return n.searchParams.append("v",2..toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(t)),n.toString()}generateTGUniversalLink(e,t){const n="tonconnect-"+Q(this.generateRegularUniversalLink("about:blank",t).split("?")[1]),r=new URL(e);return r.searchParams.append("startattach",n),r.toString()}openGateways(e){return L(this,void 0,void 0,(function*(){return Array.isArray(this.walletConnectionSource)?(this.pendingGateways=this.walletConnectionSource.map((t=>{const n=new J(this.storage,t.bridgeUrl,e.sessionId,(()=>{}),(e=>{console.error(e)}));return n.setListener((e=>this.pendingGatewaysListener(n,t.bridgeUrl,e))),n})),void(yield Promise.race(this.pendingGateways.map((e=>e.registerSession()))))):(this.gateway=new J(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),this.gateway.registerSession())}))}closeGateways(e){var t;null===(t=this.gateway)||void 0===t||t.close(),this.pendingGateways.filter((t=>t!==(null==e?void 0:e.except))).forEach((e=>e.close())),this.pendingGateways=[]}}function oe(e,t){return ie(e,[t])}function ie(e,t){return!(!e||"object"!=typeof e)&&t.every((t=>t in e))}function se(){if("undefined"!=typeof window)return window}function ae(){var e;const t=null===(e=se())||void 0===e?void 0:e.location.origin;return t?t+"/tonconnect-manifest.json":""}class le{constructor(e,t){this.injectedWalletKey=t,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=le.window;if(!le.isWindowContainsWallet(n,t))throw new U;this.connectionStorage=new ee(e),this.injectedWallet=n[t].tonconnect}static fromStorage(e){return L(this,void 0,void 0,(function*(){const t=new ee(e),n=yield t.getInjectedConnection();return new le(e,n.jsBridgeKey)}))}static isWalletInjected(e){return le.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return!!le.isWindowContainsWallet(this.window,e)&&this.window[e].tonconnect.isWalletBrowser}static getCurrentlyInjectedWallets(){if(!this.window)return[];return Object.entries(this.window).filter((([e,t])=>function(e){try{return!(!oe(e,"tonconnect")||!oe(e.tonconnect,"walletInfo"))&&ie(e.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch(t){return!1}}(t))).map((([e,t])=>({name:t.tonconnect.walletInfo.name,appName:t.tonconnect.walletInfo.app_name,aboutUrl:t.tonconnect.walletInfo.about_url,imageUrl:t.tonconnect.walletInfo.image,tondns:t.tonconnect.walletInfo.tondns,jsBridgeKey:e,injected:!0,embedded:t.tonconnect.isWalletBrowser,platforms:t.tonconnect.walletInfo.platforms})))}static isWindowContainsWallet(e,t){return!!e&&t in e&&"object"==typeof e[t]&&"tonconnect"in e[t]}connect(e){this._connect(2,e)}restoreConnection(){return L(this,void 0,void 0,(function*(){try{te("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();te("Injected Provider restoring connection response",e),"connect"===e.event?(this.makeSubscriptions(),this.listeners.forEach((t=>t(e)))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}}))}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return L(this,void 0,void 0,(function*(){return new Promise((e=>{const t=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),t()}catch(n){te(n),this.sendRequest({method:"disconnect",params:[]},t)}}))}))}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],null===(e=this.unsubscribeCallback)||void 0===e||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter((t=>t!==e))}sendRequest(e,t){return L(this,void 0,void 0,(function*(){const n=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),te("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:n}));const r=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:n}));return r.then((e=>te("Wallet message received:",e))),null==t||t(),r}))}_connect(e,t){return L(this,void 0,void 0,(function*(){try{te(`Injected Provider connect request: protocolVersion: ${e}, message:`,t);const n=yield this.injectedWallet.connect(e,t);te("Injected Provider connect response:",n),"connect"===n.event&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach((e=>e(n)))}catch(n){te(n);const e={event:"connect_error",payload:{code:0,message:null==n?void 0:n.toString()}};this.listeners.forEach((t=>t(e)))}}))}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen((e=>{te("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach((t=>t(e))),"disconnect"===e.event&&this.disconnect()}))}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}le.window=se();class ce{constructor(){const e=se();if(!(null==e?void 0:e.localStorage))throw new W;this.window=e}getItem(e){return L(this,void 0,void 0,(function*(){return Promise.resolve(this.window.localStorage.getItem(e))}))}removeItem(e){return L(this,void 0,void 0,(function*(){return this.window.localStorage.removeItem(e),Promise.resolve()}))}setItem(e,t){return this.window.localStorage.setItem(e,t),Promise.resolve()}}function ue(e){return he(e)&&e.injected}function de(e){return ue(e)&&e.embedded}function he(e){return"jsBridgeKey"in e}function fe(e){return"bridgeUrl"in e}const ge=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"tonflow",name:"TonFlow",image:"https://tonflow.net/assets/images/tonflow_ico_192.png",about_url:"https://tonflow.net",bridge:[{type:"js",key:"tonflow"}],platforms:["chrome"]},{app_name:"dewallet",name:"DeWallet",image:"https://app.delabwallet.com/logo_black.png",about_url:"https://delabwallet.com",bridge:[{type:"js",key:"dewallet"}],platforms:["chrome"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]}];class pe{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",(null==e?void 0:e.walletsListSource)&&(this.walletsListSource=e.walletsListSource),(null==e?void 0:e.cacheTTLMs)&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return L(this,void 0,void 0,(function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then((()=>{this.walletsListCacheCreationTimestamp=Date.now()})).catch((()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null}))),this.walletsListCache}))}getEmbeddedWallet(){return L(this,void 0,void 0,(function*(){const e=(yield this.getWallets()).filter(de);return 1!==e.length?null:e[0]}))}fetchWalletsList(){return L(this,void 0,void 0,(function*(){let e=[];try{const t=yield fetch(this.walletsListSource);if(e=yield t.json(),!Array.isArray(e))throw new j("Wrong wallets list format, wallets list must be an array.");const n=e.filter((e=>!this.isCorrectWalletConfigDTO(e)));n.length&&(ne(`Wallet(s) ${n.map((e=>e.name)).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter((e=>this.isCorrectWalletConfigDTO(e))))}catch(n){ne(n),e=ge}let t=[];try{t=le.getCurrentlyInjectedWallets()}catch(n){ne(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),t)}))}walletConfigDTOListToWalletConfigList(e){return e.map((e=>{const t={name:e.name,appName:e.app_name,imageUrl:e.image,aboutUrl:e.about_url,tondns:e.tondns,platforms:e.platforms};return e.bridge.forEach((n=>{if("sse"===n.type&&(t.bridgeUrl=n.url,t.universalLink=e.universal_url,t.deepLink=e.deepLink),"js"===n.type){const e=n.key;t.jsBridgeKey=e,t.injected=le.isWalletInjected(e),t.embedded=le.isInsideWalletBrowser(e)}})),t}))}mergeWalletsLists(e,t){return[...new Set(e.concat(t).map((e=>e.name))).values()].map((n=>{const r=e.find((e=>e.name===n)),o=t.find((e=>e.name===n));return Object.assign(Object.assign({},r&&Object.assign({},r)),o&&Object.assign({},o))}))}isCorrectWalletConfigDTO(e){if(!e||"object"!=typeof e)return!1;if(!("name"in e&&"image"in e&&"about_url"in e&&"platforms"in e&&"app_name"in e))return!1;if(!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length)return!1;if(!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const t=e.bridge;if(t.some((e=>!e||"object"!=typeof e||!("type"in e))))return!1;const n=t.find((e=>"sse"===e.type));if(n&&(!("url"in n)||!n.url||!e.universal_url))return!1;const r=t.find((e=>"js"===e.type));return!!(!r||"key"in r&&r.key)}}class we extends R{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,we.prototype)}}function me(e,t){const n=e.includes("SendTransaction"),r=e.find((e=>e&&"object"==typeof e&&"SendTransaction"===e.name));if(!n&&!r)throw new we("Wallet doesn't support SendTransaction feature.");if(r&&void 0!==r.maxMessages){if(r.maxMessages<t.requiredMessagesNumber)throw new we(`Wallet is not able to handle such SendTransaction request. Max support messages number is ${r.maxMessages}, but ${t.requiredMessagesNumber} is required.`)}else!function(...e){try{console.warn("[TON_CONNECT_SDK]",...e)}catch(t){}}("Connected wallet didn't provide information about max allowed messages in the SendTransaction request. Request may be rejected by the wallet.")}class ve{constructor(e){if(this.walletsList=new pe,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(null==e?void 0:e.manifestUrl)||ae(),storage:(null==e?void 0:e.storage)||new ce},this.walletsList=new pe({walletsListSource:null==e?void 0:e.walletsListSource,cacheTTLMs:null==e?void 0:e.walletsListCacheTTLMs}),!this.dappSettings.manifestUrl)throw new A("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new ee(this.dappSettings.storage),(null==e?void 0:e.disableAutoPauseConnection)||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return null!==this._wallet}get account(){var e;return(null===(e=this._wallet)||void 0===e?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach((e=>e(this._wallet)))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,t){return this.statusChangeSubscriptions.push(e),t&&this.statusChangeErrorSubscriptions.push(t),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter((t=>t!==e)),t&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter((e=>e!==t)))}}connect(e,t){var n;if(this.connected)throw new O;return null===(n=this.provider)||void 0===n||n.closeConnection(),this.provider=this.createProvider(e),this.provider.connect(this.createConnectRequest(t))}restoreConnection(){return L(this,void 0,void 0,(function*(){const[e,t]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);try{switch(e){case"http":this.provider=yield re.fromStorage(this.dappSettings.storage);break;case"injected":this.provider=yield le.fromStorage(this.dappSettings.storage);break;default:if(!t)return;this.provider=yield this.createProvider(t)}}catch(n){return yield this.bridgeConnectionStorage.removeConnection(),void(this.provider=null)}return this.provider.listen(this.walletEventsListener.bind(this)),this.provider.restoreConnection()}))}sendTransaction(e){return L(this,void 0,void 0,(function*(){this.checkConnection(),me(this.wallet.device.features,{requiredMessagesNumber:e.messages.length});const{validUntil:t}=e,n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["validUntil"]),r=e.from||this.account.address,o=e.network||this.account.chain,i=yield this.provider.sendRequest(z.convertToRpcRequest(Object.assign(Object.assign({},n),{valid_until:t,from:r,network:o})));return z.isError(i)?z.parseAndThrowError(i):z.convertFromRpcResponse(i)}))}disconnect(){return L(this,void 0,void 0,(function*(){if(!this.connected)throw new $;yield this.provider.disconnect(),this.onWalletDisconnected()}))}pauseConnection(){var e;"http"===(null===(e=this.provider)||void 0===e?void 0:e.type)&&this.provider.pause()}unPauseConnection(){var e;return"http"!==(null===(e=this.provider)||void 0===e?void 0:e.type)?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=function(){if("undefined"!=typeof document)return document}();if(e)try{e.addEventListener("visibilitychange",(()=>{e.hidden?this.pauseConnection():this.unPauseConnection()}))}catch(t){console.error("Cannot subscribe to the document.visibilitychange: ",t)}}createProvider(e){let t;return t=!Array.isArray(e)&&"jsBridgeKey"in e?new le(this.dappSettings.storage,e.jsBridgeKey):new re(this.dappSettings.storage,e),t.listen(this.walletEventsListener.bind(this)),t}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected()}}onWalletConnected(e){const t=e.items.find((e=>"ton_addr"===e.name)),n=e.items.find((e=>"ton_proof"===e.name));if(!t)throw new R("ton_addr connection item was not found");const r={device:e.device,provider:this.provider.type,account:{address:t.address,chain:t.network,walletStateInit:t.walletStateInit,publicKey:t.publicKey}};n&&(r.connectItems={tonProof:n}),this.wallet=r}onWalletConnectError(e){const t=D.parseError(e);if(this.statusChangeErrorSubscriptions.forEach((e=>e(t))),console.debug(t),t instanceof M||t instanceof T)throw console.error(t),t}onWalletDisconnected(){this.wallet=null}checkConnection(){if(!this.connected)throw new $}createConnectRequest(e){const t=[{name:"ton_addr"}];return(null==e?void 0:e.tonProof)&&t.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:t}}}ve.walletsList=new pe,ve.isWalletInjected=e=>le.isWalletInjected(e),ve.isInsideWalletBrowser=e=>le.isInsideWalletBrowser(e);const ye=17,be=128;function Ce(e,t=!1){const{wc:n,hex:r}=function(e){if(!e.includes(":"))throw new B(`Wrong address ${e}. Address must include ":".`);const t=e.split(":");if(2!==t.length)throw new B(`Wrong address ${e}. Address must include ":" only once.`);const n=parseInt(t[0]);if(0!==n&&-1!==n)throw new B(`Wrong address ${e}. WC must be eq 0 or -1, but ${n} received.`);const r=t[1];if(64!==(null==r?void 0:r.length))throw new B(`Wrong address ${e}. Hex part must be 64bytes length, but ${null==r?void 0:r.length} received.`);return{wc:n,hex:_e(r)}}(e);let o=ye;t&&(o|=be);const i=new Int8Array(34);i[0]=o,i[1]=n,i.set(r,2);const s=new Uint8Array(36);return s.set(i),s.set(function(e){const t=4129;let n=0;const r=new Uint8Array(e.length+2);r.set(e);for(let o of r){let e=128;for(;e>0;)n<<=1,o&e&&(n+=1),e>>=1,n>65535&&(n&=65535,n^=t)}return new Uint8Array([Math.floor(n/256),n%256])}(i),34),_.encode(s).replace(/\+/g,"-").replace(/\//g,"_")}const xe={};for(let kc=0;kc<=255;kc++){let e=kc.toString(16);e.length<2&&(e="0"+e),xe[e]=kc}function _e(e){const t=(e=e.toLowerCase()).length;if(t%2!=0)throw new H("Hex string must have length a multiple of 2: "+e);const n=t/2,r=new Uint8Array(n);for(let o=0;o<n;o++){const t=2*o,n=e.substring(t,t+2);if(!xe.hasOwnProperty(n))throw new H("Invalid hex character: "+n);r[o]=xe[n]}return r}const ke={};const Se=Symbol("solid-proxy"),Ee=Symbol("solid-track"),Le={equals:(e,t)=>e===t};let Re=st;const Ae=1,Te=2,Me={owned:null,cleanups:null,context:null,owner:null},Oe={};var $e=null;let Pe,Ie=null,Ne=null,Ue=null,We=null,je=0;function Be(e,t){const n=Ne,r=$e,o=0===e.length,i=o?Me:{owned:null,cleanups:null,context:null,owner:void 0===t?r:t},s=o?e:()=>e((()=>Ze((()=>ut(i)))));$e=i,Ne=null;try{return it(s,!0)}finally{Ne=n,$e=r}}function He(e,t){const n={value:e,observers:null,observerSlots:null,comparator:(t=t?Object.assign({},Le,t):Le).equals||void 0};return[et.bind(n),e=>("function"==typeof e&&(e=e(n.value)),tt(n,e))]}function Ke(e,t,n){nt(rt(e,t,!0,Ae))}function Ve(e,t,n){nt(rt(e,t,!1,Ae))}function De(e,t,n){Re=at;const r=rt(e,t,!1,Ae);r.user=!0,We?We.push(r):nt(r)}function Fe(e,t,n){n=n?Object.assign({},Le,n):Le;const r=rt(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,nt(r),et.bind(r)}function qe(e,t,n){let r,o,i;2===arguments.length&&"object"==typeof t||1===arguments.length?(r=!0,o=e,i=t||{}):(r=e,o=t,i=n||{});let s=null,a=Oe,l=null,c=!1,u="initialValue"in i,d="function"==typeof r&&Fe(r);const h=new Set,[f,g]=(i.storage||He)(i.initialValue),[p,w]=He(void 0),[m,v]=He(void 0,{equals:!1}),[y,b]=He(u?"ready":"unresolved");if(ke.context){let e;l=`${ke.context.id}${ke.context.count++}`,"initial"===i.ssrLoadFrom?a=i.initialValue:ke.load&&(e=ke.load(l))&&(a=e[0])}function C(e,t,n,r){return s===e&&(s=null,u=!0,e!==a&&t!==a||!i.onHydrated||queueMicrotask((()=>i.onHydrated(r,{value:t}))),a=Oe,function(e,t){it((()=>{void 0===t&&g((()=>e)),b(void 0!==t?"errored":"ready"),w(t);for(const e of h.keys())e.decrement();h.clear()}),!1)}(t,n)),t}function x(){const e=Pe,t=f(),n=p();if(void 0!==n&&!s)throw n;return Ne&&!Ne.user&&e&&Ke((()=>{m(),s&&(e.resolved||h.has(e)||(e.increment(),h.add(e)))})),t}function _(e=!0){if(!1!==e&&c)return;c=!1;const t=d?d():r;if(null==t||!1===t)return void C(s,Ze(f));const n=a!==Oe?a:Ze((()=>o(t,{value:f(),refetching:e})));return"object"==typeof n&&n&&"then"in n?(s=n,c=!0,queueMicrotask((()=>c=!1)),it((()=>{b(u?"refreshing":"pending"),v()}),!1),n.then((e=>C(n,e,void 0,t)),(e=>C(n,void 0,dt(e),t)))):(C(s,n,void 0,t),n)}return Object.defineProperties(x,{state:{get:()=>y()},error:{get:()=>p()},loading:{get(){const e=y();return"pending"===e||"refreshing"===e}},latest:{get(){if(!u)return x();const e=p();if(e&&!s)throw e;return f()}}}),d?Ke((()=>_(!1))):_(!1),[x,{refetch:_,mutate:g}]}function ze(e){return it(e,!1)}function Ze(e){if(null===Ne)return e();const t=Ne;Ne=null;try{return e()}finally{Ne=t}}function Ge(e){return null===$e||(null===$e.cleanups?$e.cleanups=[e]:$e.cleanups.push(e)),e}function Ye(){return Ne}function Qe(e,t){const n=Symbol("context");return{id:n,Provider:pt(n),defaultValue:e}}function Je(e){let t;return void 0!==(t=ft($e,e.id))?t:e.defaultValue}function Xe(e){const t=Fe(e),n=Fe((()=>gt(t())));return n.toArray=()=>{const e=n();return Array.isArray(e)?e:null!=e?[e]:[]},n}function et(){const e=Ie;if(this.sources&&(this.state||e))if(this.state===Ae||e)nt(this);else{const e=Ue;Ue=null,it((()=>lt(this)),!1),Ue=e}if(Ne){const e=this.observers?this.observers.length:0;Ne.sources?(Ne.sources.push(this),Ne.sourceSlots.push(e)):(Ne.sources=[this],Ne.sourceSlots=[e]),this.observers?(this.observers.push(Ne),this.observerSlots.push(Ne.sources.length-1)):(this.observers=[Ne],this.observerSlots=[Ne.sources.length-1])}return this.value}function tt(e,t,n){let r=e.value;return e.comparator&&e.comparator(r,t)||(e.value=t,e.observers&&e.observers.length&&it((()=>{for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t],r=Ie&&Ie.running;r&&Ie.disposed.has(n),(r&&!n.tState||!r&&!n.state)&&(n.pure?Ue.push(n):We.push(n),n.observers&&ct(n)),r||(n.state=Ae)}if(Ue.length>1e6)throw Ue=[],new Error}),!1)),t}function nt(e){if(!e.fn)return;ut(e);const t=$e,n=Ne,r=je;Ne=$e=e,function(e,t,n){let r;try{r=e.fn(t)}catch(o){e.pure&&(e.state=Ae,e.owned&&e.owned.forEach(ut),e.owned=null),ht(o)}(!e.updatedAt||e.updatedAt<=n)&&(null!=e.updatedAt&&"observers"in e?tt(e,r):e.value=r,e.updatedAt=n)}(e,e.value,r),Ne=n,$e=t}function rt(e,t,n,r=Ae,o){const i={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:$e,context:null,pure:n};return null===$e||$e!==Me&&($e.owned?$e.owned.push(i):$e.owned=[i]),i}function ot(e){const t=Ie;if(0===e.state||t)return;if(e.state===Te||t)return lt(e);if(e.suspense&&Ze(e.suspense.inFallback))return e.suspense.effects.push(e);const n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<je);)(e.state||t)&&n.push(e);for(let r=n.length-1;r>=0;r--)if((e=n[r]).state===Ae||t)nt(e);else if(e.state===Te||t){const t=Ue;Ue=null,it((()=>lt(e,n[0])),!1),Ue=t}}function it(e,t){if(Ue)return e();let n=!1;t||(Ue=[]),We?n=!0:We=[],je++;try{const t=e();return function(e){Ue&&(st(Ue),Ue=null);if(e)return;const t=We;We=null,t.length&&it((()=>Re(t)),!1)}(n),t}catch(r){n||(We=null),Ue=null,ht(r)}}function st(e){for(let t=0;t<e.length;t++)ot(e[t])}function at(e){let t,n=0;for(t=0;t<e.length;t++){const r=e[t];r.user?e[n++]=r:ot(r)}var r;for(ke.context&&(ke.context=r),t=0;t<n;t++)ot(e[t])}function lt(e,t){const n=Ie;e.state=0;for(let r=0;r<e.sources.length;r+=1){const o=e.sources[r];o.sources&&(o.state===Ae||n?o!==t&&ot(o):(o.state===Te||n)&<(o,t))}}function ct(e){const t=Ie;for(let n=0;n<e.observers.length;n+=1){const r=e.observers[n];r.state&&!t||(r.state=Te,r.pure?Ue.push(r):We.push(r),r.observers&&ct(r))}}function ut(e){let t;if(e.sources)for(;e.sources.length;){const t=e.sources.pop(),n=e.sourceSlots.pop(),r=t.observers;if(r&&r.length){const e=r.pop(),o=t.observerSlots.pop();n<r.length&&(e.sourceSlots[o]=n,r[n]=e,t.observerSlots[n]=o)}}if(e.owned){for(t=0;t<e.owned.length;t++)ut(e.owned[t]);e.owned=null}if(e.cleanups){for(t=0;t<e.cleanups.length;t++)e.cleanups[t]();e.cleanups=null}e.state=0,e.context=null}function dt(e){return e instanceof Error||"string"==typeof e?e:new Error("Unknown error")}function ht(e){throw e=dt(e)}function ft(e,t){return e?e.context&&void 0!==e.context[t]?e.context[t]:ft(e.owner,t):void 0}function gt(e){if("function"==typeof e&&!e.length)return gt(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const r=gt(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function pt(e,t){return function(t){let n;return Ve((()=>n=Ze((()=>($e.context={[e]:t.value},Xe((()=>t.children)))))),void 0),n}}const wt=Symbol("fallback");function mt(e){for(let t=0;t<e.length;t++)e[t]()}function vt(e,t){return Ze((()=>e(t||{})))}function yt(){return!0}const bt={get:(e,t,n)=>t===Se?n:e.get(t),has:(e,t)=>t===Se||e.has(t),set:yt,deleteProperty:yt,getOwnPropertyDescriptor:(e,t)=>({configurable:!0,enumerable:!0,get:()=>e.get(t),set:yt,deleteProperty:yt}),ownKeys:e=>e.keys()};function Ct(e){return(e="function"==typeof e?e():e)?e:{}}function xt(...e){let t=!1;for(let r=0;r<e.length;r++){const n=e[r];t=t||!!n&&Se in n,e[r]="function"==typeof n?(t=!0,Fe(n)):n}if(t)return new Proxy({get(t){for(let n=e.length-1;n>=0;n--){const r=Ct(e[n])[t];if(void 0!==r)return r}},has(t){for(let n=e.length-1;n>=0;n--)if(t in Ct(e[n]))return!0;return!1},keys(){const t=[];for(let n=0;n<e.length;n++)t.push(...Object.keys(Ct(e[n])));return[...new Set(t)]}},bt);const n={};for(let r=e.length-1;r>=0;r--)if(e[r]){const t=Object.getOwnPropertyDescriptors(e[r]);for(const r in t)r in n||Object.defineProperty(n,r,{enumerable:!0,get(){for(let t=e.length-1;t>=0;t--){const n=(e[t]||{})[r];if(void 0!==n)return n}}})}return n}function _t(e,...t){const n=new Set(t.flat());if(Se in e){const r=t.map((t=>new Proxy({get:n=>t.includes(n)?e[n]:void 0,has:n=>t.includes(n)&&n in e,keys:()=>t.filter((t=>t in e))},bt)));return r.push(new Proxy({get:t=>n.has(t)?void 0:e[t],has:t=>!n.has(t)&&t in e,keys:()=>Object.keys(e).filter((e=>!n.has(e)))},bt)),r}const r=Object.getOwnPropertyDescriptors(e);return t.push(Object.keys(r).filter((e=>!n.has(e)))),t.map((t=>{const n={};for(let o=0;o<t.length;o++){const i=t[o];i in e&&Object.defineProperty(n,i,r[i]?r[i]:{get:()=>e[i],set:()=>!0,enumerable:!0})}return n}))}function kt(e){const t="fallback"in e&&{fallback:()=>e.fallback};return Fe(function(e,t,n={}){let r=[],o=[],i=[],s=0,a=t.length>1?[]:null;return Ge((()=>mt(i))),()=>{let l,c,u=e()||[];return u[Ee],Ze((()=>{let e,t,h,f,g,p,w,m,v,y=u.length;if(0===y)0!==s&&(mt(i),i=[],r=[],o=[],s=0,a&&(a=[])),n.fallback&&(r=[wt],o[0]=Be((e=>(i[0]=e,n.fallback()))),s=1);else if(0===s){for(o=new Array(y),c=0;c<y;c++)r[c]=u[c],o[c]=Be(d);s=y}else{for(h=new Array(y),f=new Array(y),a&&(g=new Array(y)),p=0,w=Math.min(s,y);p<w&&r[p]===u[p];p++);for(w=s-1,m=y-1;w>=p&&m>=p&&r[w]===u[m];w--,m--)h[m]=o[w],f[m]=i[w],a&&(g[m]=a[w]);for(e=new Map,t=new Array(m+1),c=m;c>=p;c--)v=u[c],l=e.get(v),t[c]=void 0===l?-1:l,e.set(v,c);for(l=p;l<=w;l++)v=r[l],c=e.get(v),void 0!==c&&-1!==c?(h[c]=o[l],f[c]=i[l],a&&(g[c]=a[l]),c=t[c],e.set(v,c)):i[l]();for(c=p;c<y;c++)c in h?(o[c]=h[c],i[c]=f[c],a&&(a[c]=g[c],a[c](c))):o[c]=Be(d);o=o.slice(0,s=y),r=u.slice(0)}return o}));function d(e){if(i[c]=e,a){const[e,n]=He(c);return a[c]=n,t(u[c],e)}return t(u[c])}}}((()=>e.each),e.children,t||void 0))}function St(e){let t=!1;const n=e.keyed,r=Fe((()=>e.when),void 0,{equals:(e,n)=>t?e===n:!e==!n});return Fe((()=>{const o=r();if(o){const r=e.children,i="function"==typeof r&&r.length>0;return t=n||i,i?Ze((()=>r(o))):r}return e.fallback}),void 0,void 0)}function Et(e){let t=!1,n=!1;const r=Xe((()=>e.children)),o=Fe((()=>{let e=r();Array.isArray(e)||(e=[e]);for(let t=0;t<e.length;t++){const r=e[t].when;if(r)return n=!!e[t].keyed,[t,r,e[t]]}return[-1]}),void 0,{equals:(e,n)=>e[0]===n[0]&&(t?e[1]===n[1]:!e[1]==!n[1])&&e[2]===n[2]});return Fe((()=>{const[r,i,s]=o();if(r<0)return e.fallback;const a=s.children,l="function"==typeof a&&a.length>0;return t=n||l,l?Ze((()=>a(i))):a}),void 0,void 0)}function Lt(e){return e}const Rt=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline","allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"]),At=new Set(["innerHTML","textContent","innerText","children"]),Tt=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),Mt=Object.assign(Object.create(null),{class:"className",formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly"}),Ot=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),$t=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),Pt={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};const It="_$DX_DELEGATE";function Nt(e,t,n){const r=document.createElement("template");r.innerHTML=e;let o=r.content.firstChild;return n&&(o=o.firstChild),o}function Ut(e,t,n){null==n?e.removeAttribute(t):e.setAttribute(t,n)}function Wt(e,t){null==t?e.removeAttribute("class"):e.className=t}function jt(e,t={},n,r){const o={};return r||Ve((()=>o.children=qt(e,t.children,o.children))),Ve((()=>t.ref&&t.ref(e))),Ve((()=>function(e,t,n,r,o={},i=!1){t||(t={});for(const s in o)if(!(s in t)){if("children"===s)continue;o[s]=Dt(e,s,null,o[s],n,i)}for(const s in t){if("children"===s){r||qt(e,t.children);continue}const a=t[s];o[s]=Dt(e,s,a,o[s],n,i)}}(e,t,n,!0,o,!0))),o}function Bt(e,t,n){return Ze((()=>e(t,n)))}function Ht(e,t,n,r){if(void 0===n||r||(r=[]),"function"!=typeof t)return qt(e,t,r,n);Ve((r=>qt(e,t(),r,n)),r)}function Kt(e){let t,n;return ke.context&&(t=ke.registry.get(n=function(){const e=ke.context;return`${e.id}${e.count++}`}()))?(ke.completed&&ke.completed.add(t),ke.registry.delete(n),t):e.cloneNode(!0)}function Vt(e,t,n){const r=t.trim().split(/\s+/);for(let o=0,i=r.length;o<i;o++)e.classList.toggle(r[o],n)}function Dt(e,t,n,r,o,i){let s,a,l;if("style"===t)return function(e,t,n){if(!t)return n?Ut(e,"style"):t;const r=e.style;if("string"==typeof t)return r.cssText=t;let o,i;for(i in"string"==typeof n&&(r.cssText=n=void 0),n||(n={}),t||(t={}),n)null==t[i]&&r.removeProperty(i),delete n[i];for(i in t)o=t[i],o!==n[i]&&(r.setProperty(i,o),n[i]=o);return n}(e,n,r);if("classList"===t)return function(e,t,n={}){const r=Object.keys(t||{}),o=Object.keys(n);let i,s;for(i=0,s=o.length;i<s;i++){const r=o[i];r&&"undefined"!==r&&!t[r]&&(Vt(e,r,!1),delete n[r])}for(i=0,s=r.length;i<s;i++){const o=r[i],s=!!t[o];o&&"undefined"!==o&&n[o]!==s&&s&&(Vt(e,o,!0),n[o]=s)}return n}(e,n,r);if(n===r)return r;if("ref"===t)i||n(e);else if("on:"===t.slice(0,3)){const o=t.slice(3);r&&e.removeEventListener(o,r),n&&e.addEventListener(o,n)}else if("oncapture:"===t.slice(0,10)){const o=t.slice(10);r&&e.removeEventListener(o,r,!0),n&&e.addEventListener(o,n,!0)}else if("on"===t.slice(0,2)){const o=t.slice(2).toLowerCase(),i=Ot.has(o);if(!i&&r){const t=Array.isArray(r)?r[0]:r;e.removeEventListener(o,t)}(i||n)&&(function(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){const r=n[0];e.addEventListener(t,n[0]=t=>r.call(e,n[1],t))}else e.addEventListener(t,n)}(e,o,n,i),i&&function(e,t=window.document){const n=t[It]||(t[It]=new Set);for(let r=0,o=e.length;r<o;r++){const o=e[r];n.has(o)||(n.add(o),t.addEventListener(o,Ft))}}([o]))}else if((l=At.has(t))||!o&&(Mt[t]||(a=Rt.has(t)))||(s=e.nodeName.includes("-")))"class"===t||"className"===t?Wt(e,n):!s||a||l?e[Mt[t]||t]=n:e[(c=t,c.toLowerCase().replace(/-([a-z])/g,((e,t)=>t.toUpperCase())))]=n;else{const r=o&&t.indexOf(":")>-1&&Pt[t.split(":")[0]];r?function(e,t,n,r){null==r?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r)}(e,r,t,n):Ut(e,Tt[t]||t,n)}var c;return n}function Ft(e){const t=`$$${e.type}`;let n=e.composedPath&&e.composedPath()[0]||e.target;for(e.target!==n&&Object.defineProperty(e,"target",{configurable:!0,value:n}),Object.defineProperty(e,"currentTarget",{configurable:!0,get:()=>n||document}),ke.registry&&!ke.done&&(ke.done=!0,document.querySelectorAll("[id^=pl-]").forEach((t=>{for(;t&&8!==t.nodeType&&t.nodeValue!=="pl-"+e;){let e=t.nextSibling;t.remove(),t=e}t&&t.remove()})));n;){const r=n[t];if(r&&!n.disabled){const o=n[`${t}Data`];if(void 0!==o?r.call(n,o,e):r.call(n,e),e.cancelBubble)return}n=n._$host||n.parentNode||n.host}}function qt(e,t,n,r,o){for(ke.context&&!n&&(n=[...e.childNodes]);"function"==typeof n;)n=n();if(t===n)return n;const i=typeof t,s=void 0!==r;if(e=s&&n[0]&&n[0].parentNode||e,"string"===i||"number"===i){if(ke.context)return n;if("number"===i&&(t=t.toString()),s){let o=n[0];o&&3===o.nodeType?o.data=t:o=document.createTextNode(t),n=Gt(e,n,r,o)}else n=""!==n&&"string"==typeof n?e.firstChild.data=t:e.textContent=t}else if(null==t||"boolean"===i){if(ke.context)return n;n=Gt(e,n,r)}else{if("function"===i)return Ve((()=>{let o=t();for(;"function"==typeof o;)o=o();n=qt(e,o,n,r)})),()=>n;if(Array.isArray(t)){const i=[],a=n&&Array.isArray(n);if(zt(i,t,n,o))return Ve((()=>n=qt(e,i,n,r,!0))),()=>n;if(ke.context){if(!i.length)return n;for(let e=0;e<i.length;e++)if(i[e].parentNode)return n=i}if(0===i.length){if(n=Gt(e,n,r),s)return n}else a?0===n.length?Zt(e,i,r):function(e,t,n){let r=n.length,o=t.length,i=r,s=0,a=0,l=t[o-1].nextSibling,c=null;for(;s<o||a<i;)if(t[s]!==n[a]){for(;t[o-1]===n[i-1];)o--,i--;if(o===s){const t=i<r?a?n[a-1].nextSibling:n[i-a]:l;for(;a<i;)e.insertBefore(n[a++],t)}else if(i===a)for(;s<o;)c&&c.has(t[s])||t[s].remove(),s++;else if(t[s]===n[i-1]&&n[a]===t[o-1]){const r=t[--o].nextSibling;e.insertBefore(n[a++],t[s++].nextSibling),e.insertBefore(n[--i],r),t[o]=n[i]}else{if(!c){c=new Map;let e=a;for(;e<i;)c.set(n[e],e++)}const r=c.get(t[s]);if(null!=r)if(a<r&&r<i){let l,u=s,d=1;for(;++u<o&&u<i&&null!=(l=c.get(t[u]))&&l===r+d;)d++;if(d>r-a){const o=t[s];for(;a<r;)e.insertBefore(n[a++],o)}else e.replaceChild(n[a++],t[s++])}else s++;else t[s++].remove()}}else s++,a++}(e,n,i):(n&&Gt(e),Zt(e,i));n=i}else if(t instanceof Node){if(ke.context&&t.parentNode)return n=s?[t]:t;if(Array.isArray(n)){if(s)return n=Gt(e,n,r,t);Gt(e,n,null,t)}else null!=n&&""!==n&&e.firstChild?e.replaceChild(t,e.firstChild):e.appendChild(t);n=t}}return n}function zt(e,t,n,r){let o=!1;for(let i=0,s=t.length;i<s;i++){let s=t[i],a=n&&n[i];if(s instanceof Node)e.push(s);else if(null==s||!0===s||!1===s);else if(Array.isArray(s))o=zt(e,s,a)||o;else if("function"==typeof s)if(r){for(;"function"==typeof s;)s=s();o=zt(e,Array.isArray(s)?s:[s],Array.isArray(a)?a:[a])||o}else e.push(s),o=!0;else{const t=String(s);a&&3===a.nodeType&&a.data===t?e.push(a):e.push(document.createTextNode(t))}}return o}function Zt(e,t,n=null){for(let r=0,o=t.length;r<o;r++)e.insertBefore(t[r],n)}function Gt(e,t,n,r){if(void 0===n)return e.textContent="";const o=r||document.createTextNode("");if(t.length){let r=!1;for(let i=t.length-1;i>=0;i--){const s=t[i];if(o!==s){const t=s.parentNode===e;r||i?t&&s.remove():t?e.replaceChild(o,s):e.insertBefore(o,n)}else r=!0}}else e.insertBefore(o,n);return[o]}const Yt="http://www.w3.org/2000/svg";function Qt(e,t=!1){return t?document.createElementNS(Yt,e):document.createElement(e)}function Jt(e){const{useShadow:t}=e,n=document.createTextNode(""),r=e.mount||document.body;function o(){if(ke.context){const[t,n]=He(!1);return queueMicrotask((()=>n(!0))),()=>t()&&e.children}return()=>e.children}if(r instanceof HTMLHeadElement){const[e,t]=He(!1),n=()=>t(!0);Be((t=>Ht(r,(()=>e()?t():o()()),null))),Ge((()=>{ke.context?queueMicrotask(n):n()}))}else{const i=Qt(e.isSVG?"g":"div",e.isSVG),s=t&&i.attachShadow?i.attachShadow({mode:"open"}):i;Object.defineProperty(i,"_$host",{get:()=>n.parentNode,configurable:!0}),Ht(s,o()),r.appendChild(i),e.ref&&e.ref(i),Ge((()=>r.removeChild(i)))}return n}function Xt(e){const[t,n]=_t(e,["component"]),r=Fe((()=>t.component));return Fe((()=>{const e=r();switch(typeof e){case"function":return Ze((()=>e(n)));case"string":const t=$t.has(e),r=ke.context?Kt():Qt(e,t);return jt(r,n,t),r}}))}var en=(e=>(e.DARK="DARK",e.LIGHT="LIGHT",e))(en||{});let tn={data:""},nn=e=>"object"==typeof window?((e?e.querySelector("#_goober"):window._goober)||Object.assign((e||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:e||tn,rn=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,on=/\/\*[^]*?\*\/| +/g,sn=/\n+/g,an=(e,t)=>{let n="",r="",o="";for(let i in e){let s=e[i];"@"==i[0]?"i"==i[1]?n=i+" "+s+";":r+="f"==i[1]?an(s,i):i+"{"+an(s,"k"==i[1]?"":t)+"}":"object"==typeof s?r+=an(s,t?t.replace(/([^,])+/g,(e=>i.replace(/(^:.*)|([^,])+/g,(t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)))):i):null!=s&&(i=/^--/.test(i)?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),o+=an.p?an.p(i,s):i+":"+s+";")}return n+(t&&o?t+"{"+o+"}":o)+r},ln={},cn=e=>{if("object"==typeof e){let t="";for(let n in e)t+=n+cn(e[n]);return t}return e},un=(e,t,n,r,o)=>{let i=cn(e),s=ln[i]||(ln[i]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return"go"+n})(i));if(!ln[s]){let t=i!==e?e:(e=>{let t,n,r=[{}];for(;t=rn.exec(e.replace(on,""));)t[4]?r.shift():t[3]?(n=t[3].replace(sn," ").trim(),r.unshift(r[0][n]=r[0][n]||{})):r[0][t[1]]=t[2].replace(sn," ").trim();return r[0]})(e);ln[s]=an(o?{["@keyframes "+s]:t}:t,n?"":"."+s)}let a=n&&ln.g?ln.g:null;return n&&(ln.g=ln[s]),l=ln[s],c=t,u=r,(d=a)?c.data=c.data.replace(d,l):-1===c.data.indexOf(l)&&(c.data=u?l+c.data:c.data+l),s;var l,c,u,d},dn=(e,t,n)=>e.reduce(((e,r,o)=>{let i=t[o];if(i&&i.call){let e=i(n),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;i=t?"."+t:e&&"object"==typeof e?e.props?"":an(e,""):!1===e?"":e}return e+r+(null==i?"":i)}),"");function hn(e){let t=this||{},n=e.call?e(t.p):e;return un(n.unshift?n.raw?dn(n,[].slice.call(arguments,1),t.p):n.reduce(((e,n)=>Object.assign(e,n&&n.call?n(t.p):n)),{}):n,nn(t.target),t.g,t.o,t.k)}hn.bind({g:1});let fn=hn.bind({k:1});const gn=Qe();function pn(e){return vt(gn.Provider,{value:e.theme,get children(){return e.children}})}function wn(){return Je(gn)}function mn(e){let t=this||{};return(...n)=>{const r=r=>{const o=xt(r,{theme:Je(gn)}),i=xt(o,{get class(){const e=o.class,r="class"in o&&/^go[0-9]+/.test(e);return[e,hn.apply({target:t.target,o:r,p:o,g:t.g},n)].filter(Boolean).join(" ")}}),[s,a]=_t(i,["as","theme"]),l=a,c=s.as||e;let u;return"function"==typeof c?u=c(l):1==t.g?(u=document.createElement(c),jt(u,l)):u=Xt(xt({component:c},l)),u};return r.class=e=>Ze((()=>hn.apply({target:t.target,p:e,g:t.g},n))),r}}const vn=new Proxy(mn,{get:(e,t)=>e(t)});function yn(){const e=mn.call({g:1},"div").apply(null,arguments);return function(t){return e(t),null}}const bn="tc-root",Cn="tc-disable-scroll",xn="tc-using-mouse",_n=()=>{document.body.addEventListener("mousedown",(()=>document.body.classList.add(xn))),document.body.addEventListener("keydown",(e=>{"Tab"===e.key&&document.body.classList.remove(xn)}));return vt(yn`
|
|
1
|
+
var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__publicField=(e,t,n)=>(__defNormalProp(e,"symbol"!=typeof t?t+"":t,n),n),__async=(e,t,n)=>new Promise(((r,o)=>{var i=e=>{try{a(n.next(e))}catch(t){o(t)}},s=e=>{try{a(n.throw(e))}catch(t){o(t)}},a=e=>e.done?r(e.value):Promise.resolve(e.value).then(i,s);a((n=n.apply(e,t)).next())}));!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TON_CONNECT_UI={})}(this,(function(e){var t,n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e){var t=e.default;if("function"==typeof t){var n=function(){return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}var o,i,s,a={exports:{}};i=n,s=function(){var e={};function t(e){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e))throw new TypeError("invalid encoding")}return e.decodeUTF8=function(e){if("string"!=typeof e)throw new TypeError("expected string");var t,n=unescape(encodeURIComponent(e)),r=new Uint8Array(n.length);for(t=0;t<n.length;t++)r[t]=n.charCodeAt(t);return r},e.encodeUTF8=function(e){var t,n=[];for(t=0;t<e.length;t++)n.push(String.fromCharCode(e[t]));return decodeURIComponent(escape(n.join("")))},"undefined"==typeof atob?void 0!==Buffer.from?(e.encodeBase64=function(e){return Buffer.from(e).toString("base64")},e.decodeBase64=function(e){return t(e),new Uint8Array(Array.prototype.slice.call(Buffer.from(e,"base64"),0))}):(e.encodeBase64=function(e){return new Buffer(e).toString("base64")},e.decodeBase64=function(e){return t(e),new Uint8Array(Array.prototype.slice.call(new Buffer(e,"base64"),0))}):(e.encodeBase64=function(e){var t,n=[],r=e.length;for(t=0;t<r;t++)n.push(String.fromCharCode(e[t]));return btoa(n.join(""))},e.decodeBase64=function(e){t(e);var n,r=atob(e),o=new Uint8Array(r.length);for(n=0;n<r.length;n++)o[n]=r.charCodeAt(n);return o}),e},(o=a).exports?o.exports=s():(i.nacl||(i.nacl={}),i.nacl.util=s());const l=a.exports;function c(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var u={exports:{}};const d=r(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));!function(e){!function(e){var t=function(e){var t,n=new Float64Array(16);if(e)for(t=0;t<e.length;t++)n[t]=e[t];return n},n=function(){throw new Error("no PRNG")},r=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var i=t(),s=t([1]),a=t([56129,1]),l=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),u=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),h=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),f=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),g=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function p(e,t,n,r){e[t]=n>>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n,e[t+4]=r>>24&255,e[t+5]=r>>16&255,e[t+6]=r>>8&255,e[t+7]=255&r}function w(e,t,n,r,o){var i,s=0;for(i=0;i<o;i++)s|=e[t+i]^n[r+i];return(1&s-1>>>8)-1}function m(e,t,n,r){return w(e,t,n,r,16)}function v(e,t,n,r){return w(e,t,n,r,32)}function y(e,t,n,r){!function(e,t,n,r){for(var o,i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,l=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,c=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,u=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,d=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,h=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,f=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,g=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,p=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,w=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,m=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,v=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,y=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,b=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,C=i,x=s,_=a,k=l,S=c,E=u,L=d,R=h,A=f,T=g,M=p,O=w,$=m,P=v,I=y,N=b,U=0;U<20;U+=2)C^=(o=($^=(o=(A^=(o=(S^=(o=C+$|0)<<7|o>>>25)+C|0)<<9|o>>>23)+S|0)<<13|o>>>19)+A|0)<<18|o>>>14,E^=(o=(x^=(o=(P^=(o=(T^=(o=E+x|0)<<7|o>>>25)+E|0)<<9|o>>>23)+T|0)<<13|o>>>19)+P|0)<<18|o>>>14,M^=(o=(L^=(o=(_^=(o=(I^=(o=M+L|0)<<7|o>>>25)+M|0)<<9|o>>>23)+I|0)<<13|o>>>19)+_|0)<<18|o>>>14,N^=(o=(O^=(o=(R^=(o=(k^=(o=N+O|0)<<7|o>>>25)+N|0)<<9|o>>>23)+k|0)<<13|o>>>19)+R|0)<<18|o>>>14,C^=(o=(k^=(o=(_^=(o=(x^=(o=C+k|0)<<7|o>>>25)+C|0)<<9|o>>>23)+x|0)<<13|o>>>19)+_|0)<<18|o>>>14,E^=(o=(S^=(o=(R^=(o=(L^=(o=E+S|0)<<7|o>>>25)+E|0)<<9|o>>>23)+L|0)<<13|o>>>19)+R|0)<<18|o>>>14,M^=(o=(T^=(o=(A^=(o=(O^=(o=M+T|0)<<7|o>>>25)+M|0)<<9|o>>>23)+O|0)<<13|o>>>19)+A|0)<<18|o>>>14,N^=(o=(I^=(o=(P^=(o=($^=(o=N+I|0)<<7|o>>>25)+N|0)<<9|o>>>23)+$|0)<<13|o>>>19)+P|0)<<18|o>>>14;C=C+i|0,x=x+s|0,_=_+a|0,k=k+l|0,S=S+c|0,E=E+u|0,L=L+d|0,R=R+h|0,A=A+f|0,T=T+g|0,M=M+p|0,O=O+w|0,$=$+m|0,P=P+v|0,I=I+y|0,N=N+b|0,e[0]=C>>>0&255,e[1]=C>>>8&255,e[2]=C>>>16&255,e[3]=C>>>24&255,e[4]=x>>>0&255,e[5]=x>>>8&255,e[6]=x>>>16&255,e[7]=x>>>24&255,e[8]=_>>>0&255,e[9]=_>>>8&255,e[10]=_>>>16&255,e[11]=_>>>24&255,e[12]=k>>>0&255,e[13]=k>>>8&255,e[14]=k>>>16&255,e[15]=k>>>24&255,e[16]=S>>>0&255,e[17]=S>>>8&255,e[18]=S>>>16&255,e[19]=S>>>24&255,e[20]=E>>>0&255,e[21]=E>>>8&255,e[22]=E>>>16&255,e[23]=E>>>24&255,e[24]=L>>>0&255,e[25]=L>>>8&255,e[26]=L>>>16&255,e[27]=L>>>24&255,e[28]=R>>>0&255,e[29]=R>>>8&255,e[30]=R>>>16&255,e[31]=R>>>24&255,e[32]=A>>>0&255,e[33]=A>>>8&255,e[34]=A>>>16&255,e[35]=A>>>24&255,e[36]=T>>>0&255,e[37]=T>>>8&255,e[38]=T>>>16&255,e[39]=T>>>24&255,e[40]=M>>>0&255,e[41]=M>>>8&255,e[42]=M>>>16&255,e[43]=M>>>24&255,e[44]=O>>>0&255,e[45]=O>>>8&255,e[46]=O>>>16&255,e[47]=O>>>24&255,e[48]=$>>>0&255,e[49]=$>>>8&255,e[50]=$>>>16&255,e[51]=$>>>24&255,e[52]=P>>>0&255,e[53]=P>>>8&255,e[54]=P>>>16&255,e[55]=P>>>24&255,e[56]=I>>>0&255,e[57]=I>>>8&255,e[58]=I>>>16&255,e[59]=I>>>24&255,e[60]=N>>>0&255,e[61]=N>>>8&255,e[62]=N>>>16&255,e[63]=N>>>24&255}(e,t,n,r)}function b(e,t,n,r){!function(e,t,n,r){for(var o,i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,l=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,c=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,u=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,d=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,h=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,f=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,g=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,p=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,w=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,m=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,v=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,y=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,b=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,C=0;C<20;C+=2)i^=(o=(m^=(o=(f^=(o=(c^=(o=i+m|0)<<7|o>>>25)+i|0)<<9|o>>>23)+c|0)<<13|o>>>19)+f|0)<<18|o>>>14,u^=(o=(s^=(o=(v^=(o=(g^=(o=u+s|0)<<7|o>>>25)+u|0)<<9|o>>>23)+g|0)<<13|o>>>19)+v|0)<<18|o>>>14,p^=(o=(d^=(o=(a^=(o=(y^=(o=p+d|0)<<7|o>>>25)+p|0)<<9|o>>>23)+y|0)<<13|o>>>19)+a|0)<<18|o>>>14,b^=(o=(w^=(o=(h^=(o=(l^=(o=b+w|0)<<7|o>>>25)+b|0)<<9|o>>>23)+l|0)<<13|o>>>19)+h|0)<<18|o>>>14,i^=(o=(l^=(o=(a^=(o=(s^=(o=i+l|0)<<7|o>>>25)+i|0)<<9|o>>>23)+s|0)<<13|o>>>19)+a|0)<<18|o>>>14,u^=(o=(c^=(o=(h^=(o=(d^=(o=u+c|0)<<7|o>>>25)+u|0)<<9|o>>>23)+d|0)<<13|o>>>19)+h|0)<<18|o>>>14,p^=(o=(g^=(o=(f^=(o=(w^=(o=p+g|0)<<7|o>>>25)+p|0)<<9|o>>>23)+w|0)<<13|o>>>19)+f|0)<<18|o>>>14,b^=(o=(y^=(o=(v^=(o=(m^=(o=b+y|0)<<7|o>>>25)+b|0)<<9|o>>>23)+m|0)<<13|o>>>19)+v|0)<<18|o>>>14;e[0]=i>>>0&255,e[1]=i>>>8&255,e[2]=i>>>16&255,e[3]=i>>>24&255,e[4]=u>>>0&255,e[5]=u>>>8&255,e[6]=u>>>16&255,e[7]=u>>>24&255,e[8]=p>>>0&255,e[9]=p>>>8&255,e[10]=p>>>16&255,e[11]=p>>>24&255,e[12]=b>>>0&255,e[13]=b>>>8&255,e[14]=b>>>16&255,e[15]=b>>>24&255,e[16]=d>>>0&255,e[17]=d>>>8&255,e[18]=d>>>16&255,e[19]=d>>>24&255,e[20]=h>>>0&255,e[21]=h>>>8&255,e[22]=h>>>16&255,e[23]=h>>>24&255,e[24]=f>>>0&255,e[25]=f>>>8&255,e[26]=f>>>16&255,e[27]=f>>>24&255,e[28]=g>>>0&255,e[29]=g>>>8&255,e[30]=g>>>16&255,e[31]=g>>>24&255}(e,t,n,r)}var C=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function x(e,t,n,r,o,i,s){var a,l,c=new Uint8Array(16),u=new Uint8Array(64);for(l=0;l<16;l++)c[l]=0;for(l=0;l<8;l++)c[l]=i[l];for(;o>=64;){for(y(u,c,s,C),l=0;l<64;l++)e[t+l]=n[r+l]^u[l];for(a=1,l=8;l<16;l++)a=a+(255&c[l])|0,c[l]=255&a,a>>>=8;o-=64,t+=64,r+=64}if(o>0)for(y(u,c,s,C),l=0;l<o;l++)e[t+l]=n[r+l]^u[l];return 0}function _(e,t,n,r,o){var i,s,a=new Uint8Array(16),l=new Uint8Array(64);for(s=0;s<16;s++)a[s]=0;for(s=0;s<8;s++)a[s]=r[s];for(;n>=64;){for(y(l,a,o,C),s=0;s<64;s++)e[t+s]=l[s];for(i=1,s=8;s<16;s++)i=i+(255&a[s])|0,a[s]=255&i,i>>>=8;n-=64,t+=64}if(n>0)for(y(l,a,o,C),s=0;s<n;s++)e[t+s]=l[s];return 0}function k(e,t,n,r,o){var i=new Uint8Array(32);b(i,r,o,C);for(var s=new Uint8Array(8),a=0;a<8;a++)s[a]=r[a+16];return _(e,t,n,s,i)}function S(e,t,n,r,o,i,s){var a=new Uint8Array(32);b(a,i,s,C);for(var l=new Uint8Array(8),c=0;c<8;c++)l[c]=i[c+16];return x(e,t,n,r,o,l,a)}var E=function(e){var t,n,r,o,i,s,a,l;this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0,t=255&e[0]|(255&e[1])<<8,this.r[0]=8191&t,n=255&e[2]|(255&e[3])<<8,this.r[1]=8191&(t>>>13|n<<3),r=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(n>>>10|r<<6),o=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(r>>>7|o<<9),i=255&e[8]|(255&e[9])<<8,this.r[4]=255&(o>>>4|i<<12),this.r[5]=i>>>1&8190,s=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(i>>>14|s<<2),a=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(s>>>11|a<<5),l=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(a>>>8|l<<8),this.r[9]=l>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function L(e,t,n,r,o,i){var s=new E(i);return s.update(n,r,o),s.finish(e,t),0}function R(e,t,n,r,o,i){var s=new Uint8Array(16);return L(s,0,n,r,o,i),m(e,t,s,0)}function A(e,t,n,r,o){var i;if(n<32)return-1;for(S(e,0,t,0,n,r,o),L(e,16,e,32,n-32,e),i=0;i<16;i++)e[i]=0;return 0}function T(e,t,n,r,o){var i,s=new Uint8Array(32);if(n<32)return-1;if(k(s,0,32,r,o),0!==R(t,16,t,32,n-32,s))return-1;for(S(e,0,t,0,n,r,o),i=0;i<32;i++)e[i]=0;return 0}function M(e,t){var n;for(n=0;n<16;n++)e[n]=0|t[n]}function O(e){var t,n,r=1;for(t=0;t<16;t++)n=e[t]+r+65535,r=Math.floor(n/65536),e[t]=n-65536*r;e[0]+=r-1+37*(r-1)}function $(e,t,n){for(var r,o=~(n-1),i=0;i<16;i++)r=o&(e[i]^t[i]),e[i]^=r,t[i]^=r}function P(e,n){var r,o,i,s=t(),a=t();for(r=0;r<16;r++)a[r]=n[r];for(O(a),O(a),O(a),o=0;o<2;o++){for(s[0]=a[0]-65517,r=1;r<15;r++)s[r]=a[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),i=s[15]>>16&1,s[14]&=65535,$(a,s,1-i)}for(r=0;r<16;r++)e[2*r]=255&a[r],e[2*r+1]=a[r]>>8}function I(e,t){var n=new Uint8Array(32),r=new Uint8Array(32);return P(n,e),P(r,t),v(n,0,r,0)}function N(e){var t=new Uint8Array(32);return P(t,e),1&t[0]}function U(e,t){var n;for(n=0;n<16;n++)e[n]=t[2*n]+(t[2*n+1]<<8);e[15]&=32767}function W(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]+n[r]}function j(e,t,n){for(var r=0;r<16;r++)e[r]=t[r]-n[r]}function B(e,t,n){var r,o,i=0,s=0,a=0,l=0,c=0,u=0,d=0,h=0,f=0,g=0,p=0,w=0,m=0,v=0,y=0,b=0,C=0,x=0,_=0,k=0,S=0,E=0,L=0,R=0,A=0,T=0,M=0,O=0,$=0,P=0,I=0,N=n[0],U=n[1],W=n[2],j=n[3],B=n[4],H=n[5],K=n[6],V=n[7],D=n[8],F=n[9],q=n[10],z=n[11],Z=n[12],G=n[13],Y=n[14],Q=n[15];i+=(r=t[0])*N,s+=r*U,a+=r*W,l+=r*j,c+=r*B,u+=r*H,d+=r*K,h+=r*V,f+=r*D,g+=r*F,p+=r*q,w+=r*z,m+=r*Z,v+=r*G,y+=r*Y,b+=r*Q,s+=(r=t[1])*N,a+=r*U,l+=r*W,c+=r*j,u+=r*B,d+=r*H,h+=r*K,f+=r*V,g+=r*D,p+=r*F,w+=r*q,m+=r*z,v+=r*Z,y+=r*G,b+=r*Y,C+=r*Q,a+=(r=t[2])*N,l+=r*U,c+=r*W,u+=r*j,d+=r*B,h+=r*H,f+=r*K,g+=r*V,p+=r*D,w+=r*F,m+=r*q,v+=r*z,y+=r*Z,b+=r*G,C+=r*Y,x+=r*Q,l+=(r=t[3])*N,c+=r*U,u+=r*W,d+=r*j,h+=r*B,f+=r*H,g+=r*K,p+=r*V,w+=r*D,m+=r*F,v+=r*q,y+=r*z,b+=r*Z,C+=r*G,x+=r*Y,_+=r*Q,c+=(r=t[4])*N,u+=r*U,d+=r*W,h+=r*j,f+=r*B,g+=r*H,p+=r*K,w+=r*V,m+=r*D,v+=r*F,y+=r*q,b+=r*z,C+=r*Z,x+=r*G,_+=r*Y,k+=r*Q,u+=(r=t[5])*N,d+=r*U,h+=r*W,f+=r*j,g+=r*B,p+=r*H,w+=r*K,m+=r*V,v+=r*D,y+=r*F,b+=r*q,C+=r*z,x+=r*Z,_+=r*G,k+=r*Y,S+=r*Q,d+=(r=t[6])*N,h+=r*U,f+=r*W,g+=r*j,p+=r*B,w+=r*H,m+=r*K,v+=r*V,y+=r*D,b+=r*F,C+=r*q,x+=r*z,_+=r*Z,k+=r*G,S+=r*Y,E+=r*Q,h+=(r=t[7])*N,f+=r*U,g+=r*W,p+=r*j,w+=r*B,m+=r*H,v+=r*K,y+=r*V,b+=r*D,C+=r*F,x+=r*q,_+=r*z,k+=r*Z,S+=r*G,E+=r*Y,L+=r*Q,f+=(r=t[8])*N,g+=r*U,p+=r*W,w+=r*j,m+=r*B,v+=r*H,y+=r*K,b+=r*V,C+=r*D,x+=r*F,_+=r*q,k+=r*z,S+=r*Z,E+=r*G,L+=r*Y,R+=r*Q,g+=(r=t[9])*N,p+=r*U,w+=r*W,m+=r*j,v+=r*B,y+=r*H,b+=r*K,C+=r*V,x+=r*D,_+=r*F,k+=r*q,S+=r*z,E+=r*Z,L+=r*G,R+=r*Y,A+=r*Q,p+=(r=t[10])*N,w+=r*U,m+=r*W,v+=r*j,y+=r*B,b+=r*H,C+=r*K,x+=r*V,_+=r*D,k+=r*F,S+=r*q,E+=r*z,L+=r*Z,R+=r*G,A+=r*Y,T+=r*Q,w+=(r=t[11])*N,m+=r*U,v+=r*W,y+=r*j,b+=r*B,C+=r*H,x+=r*K,_+=r*V,k+=r*D,S+=r*F,E+=r*q,L+=r*z,R+=r*Z,A+=r*G,T+=r*Y,M+=r*Q,m+=(r=t[12])*N,v+=r*U,y+=r*W,b+=r*j,C+=r*B,x+=r*H,_+=r*K,k+=r*V,S+=r*D,E+=r*F,L+=r*q,R+=r*z,A+=r*Z,T+=r*G,M+=r*Y,O+=r*Q,v+=(r=t[13])*N,y+=r*U,b+=r*W,C+=r*j,x+=r*B,_+=r*H,k+=r*K,S+=r*V,E+=r*D,L+=r*F,R+=r*q,A+=r*z,T+=r*Z,M+=r*G,O+=r*Y,$+=r*Q,y+=(r=t[14])*N,b+=r*U,C+=r*W,x+=r*j,_+=r*B,k+=r*H,S+=r*K,E+=r*V,L+=r*D,R+=r*F,A+=r*q,T+=r*z,M+=r*Z,O+=r*G,$+=r*Y,P+=r*Q,b+=(r=t[15])*N,s+=38*(x+=r*W),a+=38*(_+=r*j),l+=38*(k+=r*B),c+=38*(S+=r*H),u+=38*(E+=r*K),d+=38*(L+=r*V),h+=38*(R+=r*D),f+=38*(A+=r*F),g+=38*(T+=r*q),p+=38*(M+=r*z),w+=38*(O+=r*Z),m+=38*($+=r*G),v+=38*(P+=r*Y),y+=38*(I+=r*Q),i=(r=(i+=38*(C+=r*U))+(o=1)+65535)-65536*(o=Math.floor(r/65536)),s=(r=s+o+65535)-65536*(o=Math.floor(r/65536)),a=(r=a+o+65535)-65536*(o=Math.floor(r/65536)),l=(r=l+o+65535)-65536*(o=Math.floor(r/65536)),c=(r=c+o+65535)-65536*(o=Math.floor(r/65536)),u=(r=u+o+65535)-65536*(o=Math.floor(r/65536)),d=(r=d+o+65535)-65536*(o=Math.floor(r/65536)),h=(r=h+o+65535)-65536*(o=Math.floor(r/65536)),f=(r=f+o+65535)-65536*(o=Math.floor(r/65536)),g=(r=g+o+65535)-65536*(o=Math.floor(r/65536)),p=(r=p+o+65535)-65536*(o=Math.floor(r/65536)),w=(r=w+o+65535)-65536*(o=Math.floor(r/65536)),m=(r=m+o+65535)-65536*(o=Math.floor(r/65536)),v=(r=v+o+65535)-65536*(o=Math.floor(r/65536)),y=(r=y+o+65535)-65536*(o=Math.floor(r/65536)),b=(r=b+o+65535)-65536*(o=Math.floor(r/65536)),i=(r=(i+=o-1+37*(o-1))+(o=1)+65535)-65536*(o=Math.floor(r/65536)),s=(r=s+o+65535)-65536*(o=Math.floor(r/65536)),a=(r=a+o+65535)-65536*(o=Math.floor(r/65536)),l=(r=l+o+65535)-65536*(o=Math.floor(r/65536)),c=(r=c+o+65535)-65536*(o=Math.floor(r/65536)),u=(r=u+o+65535)-65536*(o=Math.floor(r/65536)),d=(r=d+o+65535)-65536*(o=Math.floor(r/65536)),h=(r=h+o+65535)-65536*(o=Math.floor(r/65536)),f=(r=f+o+65535)-65536*(o=Math.floor(r/65536)),g=(r=g+o+65535)-65536*(o=Math.floor(r/65536)),p=(r=p+o+65535)-65536*(o=Math.floor(r/65536)),w=(r=w+o+65535)-65536*(o=Math.floor(r/65536)),m=(r=m+o+65535)-65536*(o=Math.floor(r/65536)),v=(r=v+o+65535)-65536*(o=Math.floor(r/65536)),y=(r=y+o+65535)-65536*(o=Math.floor(r/65536)),b=(r=b+o+65535)-65536*(o=Math.floor(r/65536)),i+=o-1+37*(o-1),e[0]=i,e[1]=s,e[2]=a,e[3]=l,e[4]=c,e[5]=u,e[6]=d,e[7]=h,e[8]=f,e[9]=g,e[10]=p,e[11]=w,e[12]=m,e[13]=v,e[14]=y,e[15]=b}function H(e,t){B(e,t,t)}function K(e,n){var r,o=t();for(r=0;r<16;r++)o[r]=n[r];for(r=253;r>=0;r--)H(o,o),2!==r&&4!==r&&B(o,o,n);for(r=0;r<16;r++)e[r]=o[r]}function V(e,n){var r,o=t();for(r=0;r<16;r++)o[r]=n[r];for(r=250;r>=0;r--)H(o,o),1!==r&&B(o,o,n);for(r=0;r<16;r++)e[r]=o[r]}function D(e,n,r){var o,i,s=new Uint8Array(32),l=new Float64Array(80),c=t(),u=t(),d=t(),h=t(),f=t(),g=t();for(i=0;i<31;i++)s[i]=n[i];for(s[31]=127&n[31]|64,s[0]&=248,U(l,r),i=0;i<16;i++)u[i]=l[i],h[i]=c[i]=d[i]=0;for(c[0]=h[0]=1,i=254;i>=0;--i)$(c,u,o=s[i>>>3]>>>(7&i)&1),$(d,h,o),W(f,c,d),j(c,c,d),W(d,u,h),j(u,u,h),H(h,f),H(g,c),B(c,d,c),B(d,u,f),W(f,c,d),j(c,c,d),H(u,c),j(d,h,g),B(c,d,a),W(c,c,h),B(d,d,c),B(c,h,g),B(h,u,l),H(u,f),$(c,u,o),$(d,h,o);for(i=0;i<16;i++)l[i+16]=c[i],l[i+32]=d[i],l[i+48]=u[i],l[i+64]=h[i];var p=l.subarray(32),w=l.subarray(16);return K(p,p),B(w,w,p),P(e,w),0}function F(e,t){return D(e,t,o)}function q(e,t){return n(t,32),F(e,t)}function z(e,t,n){var o=new Uint8Array(32);return D(o,n,t),b(e,r,o,C)}E.prototype.blocks=function(e,t,n){for(var r,o,i,s,a,l,c,u,d,h,f,g,p,w,m,v,y,b,C,x=this.fin?0:2048,_=this.h[0],k=this.h[1],S=this.h[2],E=this.h[3],L=this.h[4],R=this.h[5],A=this.h[6],T=this.h[7],M=this.h[8],O=this.h[9],$=this.r[0],P=this.r[1],I=this.r[2],N=this.r[3],U=this.r[4],W=this.r[5],j=this.r[6],B=this.r[7],H=this.r[8],K=this.r[9];n>=16;)h=d=0,h+=(_+=8191&(r=255&e[t+0]|(255&e[t+1])<<8))*$,h+=(k+=8191&(r>>>13|(o=255&e[t+2]|(255&e[t+3])<<8)<<3))*(5*K),h+=(S+=8191&(o>>>10|(i=255&e[t+4]|(255&e[t+5])<<8)<<6))*(5*H),h+=(E+=8191&(i>>>7|(s=255&e[t+6]|(255&e[t+7])<<8)<<9))*(5*B),d=(h+=(L+=8191&(s>>>4|(a=255&e[t+8]|(255&e[t+9])<<8)<<12))*(5*j))>>>13,h&=8191,h+=(R+=a>>>1&8191)*(5*W),h+=(A+=8191&(a>>>14|(l=255&e[t+10]|(255&e[t+11])<<8)<<2))*(5*U),h+=(T+=8191&(l>>>11|(c=255&e[t+12]|(255&e[t+13])<<8)<<5))*(5*N),h+=(M+=8191&(c>>>8|(u=255&e[t+14]|(255&e[t+15])<<8)<<8))*(5*I),f=d+=(h+=(O+=u>>>5|x)*(5*P))>>>13,f+=_*P,f+=k*$,f+=S*(5*K),f+=E*(5*H),d=(f+=L*(5*B))>>>13,f&=8191,f+=R*(5*j),f+=A*(5*W),f+=T*(5*U),f+=M*(5*N),d+=(f+=O*(5*I))>>>13,f&=8191,g=d,g+=_*I,g+=k*P,g+=S*$,g+=E*(5*K),d=(g+=L*(5*H))>>>13,g&=8191,g+=R*(5*B),g+=A*(5*j),g+=T*(5*W),g+=M*(5*U),p=d+=(g+=O*(5*N))>>>13,p+=_*N,p+=k*I,p+=S*P,p+=E*$,d=(p+=L*(5*K))>>>13,p&=8191,p+=R*(5*H),p+=A*(5*B),p+=T*(5*j),p+=M*(5*W),w=d+=(p+=O*(5*U))>>>13,w+=_*U,w+=k*N,w+=S*I,w+=E*P,d=(w+=L*$)>>>13,w&=8191,w+=R*(5*K),w+=A*(5*H),w+=T*(5*B),w+=M*(5*j),m=d+=(w+=O*(5*W))>>>13,m+=_*W,m+=k*U,m+=S*N,m+=E*I,d=(m+=L*P)>>>13,m&=8191,m+=R*$,m+=A*(5*K),m+=T*(5*H),m+=M*(5*B),v=d+=(m+=O*(5*j))>>>13,v+=_*j,v+=k*W,v+=S*U,v+=E*N,d=(v+=L*I)>>>13,v&=8191,v+=R*P,v+=A*$,v+=T*(5*K),v+=M*(5*H),y=d+=(v+=O*(5*B))>>>13,y+=_*B,y+=k*j,y+=S*W,y+=E*U,d=(y+=L*N)>>>13,y&=8191,y+=R*I,y+=A*P,y+=T*$,y+=M*(5*K),b=d+=(y+=O*(5*H))>>>13,b+=_*H,b+=k*B,b+=S*j,b+=E*W,d=(b+=L*U)>>>13,b&=8191,b+=R*N,b+=A*I,b+=T*P,b+=M*$,C=d+=(b+=O*(5*K))>>>13,C+=_*K,C+=k*H,C+=S*B,C+=E*j,d=(C+=L*W)>>>13,C&=8191,C+=R*U,C+=A*N,C+=T*I,C+=M*P,_=h=8191&(d=(d=((d+=(C+=O*$)>>>13)<<2)+d|0)+(h&=8191)|0),k=f+=d>>>=13,S=g&=8191,E=p&=8191,L=w&=8191,R=m&=8191,A=v&=8191,T=y&=8191,M=b&=8191,O=C&=8191,t+=16,n-=16;this.h[0]=_,this.h[1]=k,this.h[2]=S,this.h[3]=E,this.h[4]=L,this.h[5]=R,this.h[6]=A,this.h[7]=T,this.h[8]=M,this.h[9]=O},E.prototype.finish=function(e,t){var n,r,o,i,s=new Uint16Array(10);if(this.leftover){for(i=this.leftover,this.buffer[i++]=1;i<16;i++)this.buffer[i]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(n=this.h[1]>>>13,this.h[1]&=8191,i=2;i<10;i++)this.h[i]+=n,n=this.h[i]>>>13,this.h[i]&=8191;for(this.h[0]+=5*n,n=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=n,n=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=n,s[0]=this.h[0]+5,n=s[0]>>>13,s[0]&=8191,i=1;i<10;i++)s[i]=this.h[i]+n,n=s[i]>>>13,s[i]&=8191;for(s[9]-=8192,r=(1^n)-1,i=0;i<10;i++)s[i]&=r;for(r=~r,i=0;i<10;i++)this.h[i]=this.h[i]&r|s[i];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,i=1;i<8;i++)o=(this.h[i]+this.pad[i]|0)+(o>>>16)|0,this.h[i]=65535&o;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},E.prototype.update=function(e,t,n){var r,o;if(this.leftover){for((o=16-this.leftover)>n&&(o=n),r=0;r<o;r++)this.buffer[this.leftover+r]=e[t+r];if(n-=o,t+=o,this.leftover+=o,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(n>=16&&(o=n-n%16,this.blocks(e,t,o),t+=o,n-=o),n){for(r=0;r<n;r++)this.buffer[this.leftover+r]=e[t+r];this.leftover+=n}};var Z=A,G=T;var Y=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Q(e,t,n,r){for(var o,i,s,a,l,c,u,d,h,f,g,p,w,m,v,y,b,C,x,_,k,S,E,L,R,A,T=new Int32Array(16),M=new Int32Array(16),O=e[0],$=e[1],P=e[2],I=e[3],N=e[4],U=e[5],W=e[6],j=e[7],B=t[0],H=t[1],K=t[2],V=t[3],D=t[4],F=t[5],q=t[6],z=t[7],Z=0;r>=128;){for(x=0;x<16;x++)_=8*x+Z,T[x]=n[_+0]<<24|n[_+1]<<16|n[_+2]<<8|n[_+3],M[x]=n[_+4]<<24|n[_+5]<<16|n[_+6]<<8|n[_+7];for(x=0;x<80;x++)if(o=O,i=$,s=P,a=I,l=N,c=U,u=W,j,h=B,f=H,g=K,p=V,w=D,m=F,v=q,z,E=65535&(S=z),L=S>>>16,R=65535&(k=j),A=k>>>16,E+=65535&(S=(D>>>14|N<<18)^(D>>>18|N<<14)^(N>>>9|D<<23)),L+=S>>>16,R+=65535&(k=(N>>>14|D<<18)^(N>>>18|D<<14)^(D>>>9|N<<23)),A+=k>>>16,E+=65535&(S=D&F^~D&q),L+=S>>>16,R+=65535&(k=N&U^~N&W),A+=k>>>16,k=Y[2*x],E+=65535&(S=Y[2*x+1]),L+=S>>>16,R+=65535&k,A+=k>>>16,k=T[x%16],L+=(S=M[x%16])>>>16,R+=65535&k,A+=k>>>16,R+=(L+=(E+=65535&S)>>>16)>>>16,E=65535&(S=C=65535&E|L<<16),L=S>>>16,R=65535&(k=b=65535&R|(A+=R>>>16)<<16),A=k>>>16,E+=65535&(S=(B>>>28|O<<4)^(O>>>2|B<<30)^(O>>>7|B<<25)),L+=S>>>16,R+=65535&(k=(O>>>28|B<<4)^(B>>>2|O<<30)^(B>>>7|O<<25)),A+=k>>>16,L+=(S=B&H^B&K^H&K)>>>16,R+=65535&(k=O&$^O&P^$&P),A+=k>>>16,d=65535&(R+=(L+=(E+=65535&S)>>>16)>>>16)|(A+=R>>>16)<<16,y=65535&E|L<<16,E=65535&(S=p),L=S>>>16,R=65535&(k=a),A=k>>>16,L+=(S=C)>>>16,R+=65535&(k=b),A+=k>>>16,$=o,P=i,I=s,N=a=65535&(R+=(L+=(E+=65535&S)>>>16)>>>16)|(A+=R>>>16)<<16,U=l,W=c,j=u,O=d,H=h,K=f,V=g,D=p=65535&E|L<<16,F=w,q=m,z=v,B=y,x%16==15)for(_=0;_<16;_++)k=T[_],E=65535&(S=M[_]),L=S>>>16,R=65535&k,A=k>>>16,k=T[(_+9)%16],E+=65535&(S=M[(_+9)%16]),L+=S>>>16,R+=65535&k,A+=k>>>16,b=T[(_+1)%16],E+=65535&(S=((C=M[(_+1)%16])>>>1|b<<31)^(C>>>8|b<<24)^(C>>>7|b<<25)),L+=S>>>16,R+=65535&(k=(b>>>1|C<<31)^(b>>>8|C<<24)^b>>>7),A+=k>>>16,b=T[(_+14)%16],L+=(S=((C=M[(_+14)%16])>>>19|b<<13)^(b>>>29|C<<3)^(C>>>6|b<<26))>>>16,R+=65535&(k=(b>>>19|C<<13)^(C>>>29|b<<3)^b>>>6),A+=k>>>16,A+=(R+=(L+=(E+=65535&S)>>>16)>>>16)>>>16,T[_]=65535&R|A<<16,M[_]=65535&E|L<<16;E=65535&(S=B),L=S>>>16,R=65535&(k=O),A=k>>>16,k=e[0],L+=(S=t[0])>>>16,R+=65535&k,A+=k>>>16,A+=(R+=(L+=(E+=65535&S)>>>16)>>>16)>>>16,e[0]=O=65535&R|A<<16,t[0]=B=65535&E|L<<16,E=65535&(S=H),L=S>>>16,R=65535&(k=$),A=k>>>16,k=e[1],L+=(S=t[1])>>>16,R+=65535&k,A+=k>>>16,A+=(R+=(L+=(E+=65535&S)>>>16)>>>16)>>>16,e[1]=$=65535&R|A<<16,t[1]=H=65535&E|L<<16,E=65535&(S=K),L=S>>>16,R=65535&(k=P),A=k>>>16,k=e[2],L+=(S=t[2])>>>16,R+=65535&k,A+=k>>>16,A+=(R+=(L+=(E+=65535&S)>>>16)>>>16)>>>16,e[2]=P=65535&R|A<<16,t[2]=K=65535&E|L<<16,E=65535&(S=V),L=S>>>16,R=65535&(k=I),A=k>>>16,k=e[3],L+=(S=t[3])>>>16,R+=65535&k,A+=k>>>16,A+=(R+=(L+=(E+=65535&S)>>>16)>>>16)>>>16,e[3]=I=65535&R|A<<16,t[3]=V=65535&E|L<<16,E=65535&(S=D),L=S>>>16,R=65535&(k=N),A=k>>>16,k=e[4],L+=(S=t[4])>>>16,R+=65535&k,A+=k>>>16,A+=(R+=(L+=(E+=65535&S)>>>16)>>>16)>>>16,e[4]=N=65535&R|A<<16,t[4]=D=65535&E|L<<16,E=65535&(S=F),L=S>>>16,R=65535&(k=U),A=k>>>16,k=e[5],L+=(S=t[5])>>>16,R+=65535&k,A+=k>>>16,A+=(R+=(L+=(E+=65535&S)>>>16)>>>16)>>>16,e[5]=U=65535&R|A<<16,t[5]=F=65535&E|L<<16,E=65535&(S=q),L=S>>>16,R=65535&(k=W),A=k>>>16,k=e[6],L+=(S=t[6])>>>16,R+=65535&k,A+=k>>>16,A+=(R+=(L+=(E+=65535&S)>>>16)>>>16)>>>16,e[6]=W=65535&R|A<<16,t[6]=q=65535&E|L<<16,E=65535&(S=z),L=S>>>16,R=65535&(k=j),A=k>>>16,k=e[7],L+=(S=t[7])>>>16,R+=65535&k,A+=k>>>16,A+=(R+=(L+=(E+=65535&S)>>>16)>>>16)>>>16,e[7]=j=65535&R|A<<16,t[7]=z=65535&E|L<<16,Z+=128,r-=128}return r}function J(e,t,n){var r,o=new Int32Array(8),i=new Int32Array(8),s=new Uint8Array(256),a=n;for(o[0]=1779033703,o[1]=3144134277,o[2]=1013904242,o[3]=2773480762,o[4]=1359893119,o[5]=2600822924,o[6]=528734635,o[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,Q(o,i,t,n),n%=128,r=0;r<n;r++)s[r]=t[a-n+r];for(s[n]=128,s[(n=256-128*(n<112?1:0))-9]=0,p(s,n-8,a/536870912|0,a<<3),Q(o,i,s,n),r=0;r<8;r++)p(e,8*r,o[r],i[r]);return 0}function X(e,n){var r=t(),o=t(),i=t(),s=t(),a=t(),l=t(),c=t(),d=t(),h=t();j(r,e[1],e[0]),j(h,n[1],n[0]),B(r,r,h),W(o,e[0],e[1]),W(h,n[0],n[1]),B(o,o,h),B(i,e[3],n[3]),B(i,i,u),B(s,e[2],n[2]),W(s,s,s),j(a,o,r),j(l,s,i),W(c,s,i),W(d,o,r),B(e[0],a,l),B(e[1],d,c),B(e[2],c,l),B(e[3],a,d)}function ee(e,t,n){var r;for(r=0;r<4;r++)$(e[r],t[r],n)}function te(e,n){var r=t(),o=t(),i=t();K(i,n[2]),B(r,n[0],i),B(o,n[1],i),P(e,o),e[31]^=N(r)<<7}function ne(e,t,n){var r,o;for(M(e[0],i),M(e[1],s),M(e[2],s),M(e[3],i),o=255;o>=0;--o)ee(e,t,r=n[o/8|0]>>(7&o)&1),X(t,e),X(e,e),ee(e,t,r)}function re(e,n){var r=[t(),t(),t(),t()];M(r[0],h),M(r[1],f),M(r[2],s),B(r[3],h,f),ne(e,r,n)}function oe(e,r,o){var i,s=new Uint8Array(64),a=[t(),t(),t(),t()];for(o||n(r,32),J(s,r,32),s[0]&=248,s[31]&=127,s[31]|=64,re(a,s),te(e,a),i=0;i<32;i++)r[i+32]=e[i];return 0}var ie=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function se(e,t){var n,r,o,i;for(r=63;r>=32;--r){for(n=0,o=r-32,i=r-12;o<i;++o)t[o]+=n-16*t[r]*ie[o-(r-32)],n=Math.floor((t[o]+128)/256),t[o]-=256*n;t[o]+=n,t[r]=0}for(n=0,o=0;o<32;o++)t[o]+=n-(t[31]>>4)*ie[o],n=t[o]>>8,t[o]&=255;for(o=0;o<32;o++)t[o]-=n*ie[o];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=255&t[r]}function ae(e){var t,n=new Float64Array(64);for(t=0;t<64;t++)n[t]=e[t];for(t=0;t<64;t++)e[t]=0;se(e,n)}function le(e,n,r,o){var i,s,a=new Uint8Array(64),l=new Uint8Array(64),c=new Uint8Array(64),u=new Float64Array(64),d=[t(),t(),t(),t()];J(a,o,32),a[0]&=248,a[31]&=127,a[31]|=64;var h=r+64;for(i=0;i<r;i++)e[64+i]=n[i];for(i=0;i<32;i++)e[32+i]=a[32+i];for(J(c,e.subarray(32),r+32),ae(c),re(d,c),te(e,d),i=32;i<64;i++)e[i]=o[i];for(J(l,e,r+64),ae(l),i=0;i<64;i++)u[i]=0;for(i=0;i<32;i++)u[i]=c[i];for(i=0;i<32;i++)for(s=0;s<32;s++)u[i+s]+=l[i]*a[s];return se(e.subarray(32),u),h}function ce(e,n,r,o){var a,c=new Uint8Array(32),u=new Uint8Array(64),d=[t(),t(),t(),t()],h=[t(),t(),t(),t()];if(r<64)return-1;if(function(e,n){var r=t(),o=t(),a=t(),c=t(),u=t(),d=t(),h=t();return M(e[2],s),U(e[1],n),H(a,e[1]),B(c,a,l),j(a,a,e[2]),W(c,e[2],c),H(u,c),H(d,u),B(h,d,u),B(r,h,a),B(r,r,c),V(r,r),B(r,r,a),B(r,r,c),B(r,r,c),B(e[0],r,c),H(o,e[0]),B(o,o,c),I(o,a)&&B(e[0],e[0],g),H(o,e[0]),B(o,o,c),I(o,a)?-1:(N(e[0])===n[31]>>7&&j(e[0],i,e[0]),B(e[3],e[0],e[1]),0)}(h,o))return-1;for(a=0;a<r;a++)e[a]=n[a];for(a=0;a<32;a++)e[a+32]=o[a];if(J(u,e,r),ae(u),ne(d,h,u),re(h,n.subarray(32)),X(d,h),te(c,d),r-=64,v(n,0,c,0)){for(a=0;a<r;a++)e[a]=0;return-1}for(a=0;a<r;a++)e[a]=n[a+64];return r}var ue=32,de=24,he=16,fe=32,ge=32,pe=de,we=64,me=32,ve=64;function ye(e,t){if(e.length!==ue)throw new Error("bad key size");if(t.length!==de)throw new Error("bad nonce size")}function be(){for(var e=0;e<arguments.length;e++)if(!(arguments[e]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Ce(e){for(var t=0;t<e.length;t++)e[t]=0}e.lowlevel={crypto_core_hsalsa20:b,crypto_stream_xor:S,crypto_stream:k,crypto_stream_salsa20_xor:x,crypto_stream_salsa20:_,crypto_onetimeauth:L,crypto_onetimeauth_verify:R,crypto_verify_16:m,crypto_verify_32:v,crypto_secretbox:A,crypto_secretbox_open:T,crypto_scalarmult:D,crypto_scalarmult_base:F,crypto_box_beforenm:z,crypto_box_afternm:Z,crypto_box:function(e,t,n,r,o,i){var s=new Uint8Array(32);return z(s,o,i),Z(e,t,n,r,s)},crypto_box_open:function(e,t,n,r,o,i){var s=new Uint8Array(32);return z(s,o,i),G(e,t,n,r,s)},crypto_box_keypair:q,crypto_hash:J,crypto_sign:le,crypto_sign_keypair:oe,crypto_sign_open:ce,crypto_secretbox_KEYBYTES:ue,crypto_secretbox_NONCEBYTES:de,crypto_secretbox_ZEROBYTES:32,crypto_secretbox_BOXZEROBYTES:he,crypto_scalarmult_BYTES:32,crypto_scalarmult_SCALARBYTES:32,crypto_box_PUBLICKEYBYTES:fe,crypto_box_SECRETKEYBYTES:ge,crypto_box_BEFORENMBYTES:32,crypto_box_NONCEBYTES:pe,crypto_box_ZEROBYTES:32,crypto_box_BOXZEROBYTES:16,crypto_sign_BYTES:we,crypto_sign_PUBLICKEYBYTES:me,crypto_sign_SECRETKEYBYTES:ve,crypto_sign_SEEDBYTES:32,crypto_hash_BYTES:64,gf:t,D:l,L:ie,pack25519:P,unpack25519:U,M:B,A:W,S:H,Z:j,pow2523:V,add:X,set25519:M,modL:se,scalarmult:ne,scalarbase:re},e.randomBytes=function(e){var t=new Uint8Array(e);return n(t,e),t},e.secretbox=function(e,t,n){be(e,t,n),ye(n,t);for(var r=new Uint8Array(32+e.length),o=new Uint8Array(r.length),i=0;i<e.length;i++)r[i+32]=e[i];return A(o,r,r.length,t,n),o.subarray(he)},e.secretbox.open=function(e,t,n){be(e,t,n),ye(n,t);for(var r=new Uint8Array(he+e.length),o=new Uint8Array(r.length),i=0;i<e.length;i++)r[i+he]=e[i];return r.length<32||0!==T(o,r,r.length,t,n)?null:o.subarray(32)},e.secretbox.keyLength=ue,e.secretbox.nonceLength=de,e.secretbox.overheadLength=he,e.scalarMult=function(e,t){if(be(e,t),32!==e.length)throw new Error("bad n size");if(32!==t.length)throw new Error("bad p size");var n=new Uint8Array(32);return D(n,e,t),n},e.scalarMult.base=function(e){if(be(e),32!==e.length)throw new Error("bad n size");var t=new Uint8Array(32);return F(t,e),t},e.scalarMult.scalarLength=32,e.scalarMult.groupElementLength=32,e.box=function(t,n,r,o){var i=e.box.before(r,o);return e.secretbox(t,n,i)},e.box.before=function(e,t){be(e,t),function(e,t){if(e.length!==fe)throw new Error("bad public key size");if(t.length!==ge)throw new Error("bad secret key size")}(e,t);var n=new Uint8Array(32);return z(n,e,t),n},e.box.after=e.secretbox,e.box.open=function(t,n,r,o){var i=e.box.before(r,o);return e.secretbox.open(t,n,i)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var e=new Uint8Array(fe),t=new Uint8Array(ge);return q(e,t),{publicKey:e,secretKey:t}},e.box.keyPair.fromSecretKey=function(e){if(be(e),e.length!==ge)throw new Error("bad secret key size");var t=new Uint8Array(fe);return F(t,e),{publicKey:t,secretKey:new Uint8Array(e)}},e.box.publicKeyLength=fe,e.box.secretKeyLength=ge,e.box.sharedKeyLength=32,e.box.nonceLength=pe,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(e,t){if(be(e,t),t.length!==ve)throw new Error("bad secret key size");var n=new Uint8Array(we+e.length);return le(n,e,e.length,t),n},e.sign.open=function(e,t){if(be(e,t),t.length!==me)throw new Error("bad public key size");var n=new Uint8Array(e.length),r=ce(n,e,e.length,t);if(r<0)return null;for(var o=new Uint8Array(r),i=0;i<o.length;i++)o[i]=n[i];return o},e.sign.detached=function(t,n){for(var r=e.sign(t,n),o=new Uint8Array(we),i=0;i<o.length;i++)o[i]=r[i];return o},e.sign.detached.verify=function(e,t,n){if(be(e,t,n),t.length!==we)throw new Error("bad signature size");if(n.length!==me)throw new Error("bad public key size");var r,o=new Uint8Array(we+e.length),i=new Uint8Array(we+e.length);for(r=0;r<we;r++)o[r]=t[r];for(r=0;r<e.length;r++)o[r+we]=e[r];return ce(i,o,o.length,n)>=0},e.sign.keyPair=function(){var e=new Uint8Array(me),t=new Uint8Array(ve);return oe(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(be(e),e.length!==ve)throw new Error("bad secret key size");for(var t=new Uint8Array(me),n=0;n<t.length;n++)t[n]=e[32+n];return{publicKey:t,secretKey:new Uint8Array(e)}},e.sign.keyPair.fromSeed=function(e){if(be(e),32!==e.length)throw new Error("bad seed size");for(var t=new Uint8Array(me),n=new Uint8Array(ve),r=0;r<32;r++)n[r]=e[r];return oe(t,n,!0),{publicKey:t,secretKey:n}},e.sign.publicKeyLength=me,e.sign.secretKeyLength=ve,e.sign.seedLength=32,e.sign.signatureLength=we,e.hash=function(e){be(e);var t=new Uint8Array(64);return J(t,e,e.length),t},e.hash.hashLength=64,e.verify=function(e,t){return be(e,t),0!==e.length&&0!==t.length&&(e.length===t.length&&0===w(e,0,t,0,e.length))},e.setPRNG=function(e){n=e},function(){var t="undefined"!=typeof self?self.crypto||self.msCrypto:null;if(t&&t.getRandomValues){e.setPRNG((function(e,n){var r,o=new Uint8Array(n);for(r=0;r<n;r+=65536)t.getRandomValues(o.subarray(r,r+Math.min(n-r,65536)));for(r=0;r<n;r++)e[r]=o[r];Ce(o)}))}else void 0!==c&&(t=d)&&t.randomBytes&&e.setPRNG((function(e,n){var r,o=t.randomBytes(n);for(r=0;r<n;r++)e[r]=o[r];Ce(o)}))}()}(e.exports?e.exports:self.nacl=self.nacl||{})}(u);const h=u.exports;var f,g,p,w,m,v,y,b,C,x;(g=f||(f={}))[g.UNKNOWN_ERROR=0]="UNKNOWN_ERROR",g[g.BAD_REQUEST_ERROR=1]="BAD_REQUEST_ERROR",g[g.MANIFEST_NOT_FOUND_ERROR=2]="MANIFEST_NOT_FOUND_ERROR",g[g.MANIFEST_CONTENT_ERROR=3]="MANIFEST_CONTENT_ERROR",g[g.UNKNOWN_APP_ERROR=100]="UNKNOWN_APP_ERROR",g[g.USER_REJECTS_ERROR=300]="USER_REJECTS_ERROR",g[g.METHOD_NOT_SUPPORTED=400]="METHOD_NOT_SUPPORTED",e.CONNECT_ITEM_ERROR_CODES=void 0,(p=e.CONNECT_ITEM_ERROR_CODES||(e.CONNECT_ITEM_ERROR_CODES={}))[p.UNKNOWN_ERROR=0]="UNKNOWN_ERROR",p[p.METHOD_NOT_SUPPORTED=400]="METHOD_NOT_SUPPORTED",(m=w||(w={}))[m.UNKNOWN_ERROR=0]="UNKNOWN_ERROR",m[m.BAD_REQUEST_ERROR=1]="BAD_REQUEST_ERROR",m[m.UNKNOWN_APP_ERROR=100]="UNKNOWN_APP_ERROR",m[m.USER_REJECTS_ERROR=300]="USER_REJECTS_ERROR",m[m.METHOD_NOT_SUPPORTED=400]="METHOD_NOT_SUPPORTED",(y=v||(v={}))[y.UNKNOWN_ERROR=0]="UNKNOWN_ERROR",y[y.BAD_REQUEST_ERROR=1]="BAD_REQUEST_ERROR",y[y.UNKNOWN_APP_ERROR=100]="UNKNOWN_APP_ERROR",y[y.USER_REJECTS_ERROR=300]="USER_REJECTS_ERROR",y[y.METHOD_NOT_SUPPORTED=400]="METHOD_NOT_SUPPORTED",(C=b||(b={}))[C.UNKNOWN_ERROR=0]="UNKNOWN_ERROR",C[C.BAD_REQUEST_ERROR=1]="BAD_REQUEST_ERROR",C[C.UNKNOWN_APP_ERROR=100]="UNKNOWN_APP_ERROR",C[C.METHOD_NOT_SUPPORTED=400]="METHOD_NOT_SUPPORTED",e.CHAIN=void 0,(x=e.CHAIN||(e.CHAIN={})).MAINNET="-239",x.TESTNET="-3";const _={encode:function(e,t=!1){let n;return e instanceof Uint8Array?n=e:("string"!=typeof e&&(e=JSON.stringify(e)),n=l.decodeUTF8(e)),function(e,t){const n=l.encodeBase64(e);return t?encodeURIComponent(n):n}(n,t)},decode:function(e,t=!1){const n=function(e,t){return t&&(e=decodeURIComponent(e)),l.decodeBase64(e)}(e,t);return{toString:()=>l.encodeUTF8(n),toObject(){try{return JSON.parse(l.encodeUTF8(n))}catch(e){return null}},toUint8Array:()=>n}}};function k(e){let t="";return e.forEach((e=>{t+=("0"+(255&e).toString(16)).slice(-2)})),t}function S(e){if(e.length%2!=0)throw new Error(`Cannot convert ${e} to bytesArray`);const t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n/2]=parseInt(e.slice(n,n+2),16);return t}class E{constructor(e){this.nonceLength=24,this.keyPair=e?this.createKeypairFromString(e):this.createKeypair(),this.sessionId=k(this.keyPair.publicKey)}createKeypair(){return h.box.keyPair()}createKeypairFromString(e){return{publicKey:S(e.publicKey),secretKey:S(e.secretKey)}}createNonce(){return h.randomBytes(this.nonceLength)}encrypt(e,t){const n=(new TextEncoder).encode(e),r=this.createNonce();return function(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}(r,h.box(n,r,t,this.keyPair.secretKey))}decrypt(e,t){const[n,r]=function(e,t){if(t>=e.length)throw new Error("Index is out of buffer");return[e.slice(0,t),e.slice(t)]}(e,this.nonceLength),o=h.box.open(r,n,t,this.keyPair.secretKey);if(!o)throw new Error(`Decryption error: \n message: ${e.toString()} \n sender pubkey: ${t.toString()} \n keypair pubkey: ${this.keyPair.publicKey.toString()} \n keypair secretkey: ${this.keyPair.secretKey.toString()}`);return(new TextDecoder).decode(o)}stringifyKeypair(){return{publicKey:k(this.keyPair.publicKey),secretKey:k(this.keyPair.secretKey)}}}function L(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{l(r.next(e))}catch(t){i(t)}}function a(e){try{l(r.throw(e))}catch(t){i(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))}class R extends Error{constructor(e,t){super(e,t),this.message=`${R.prefix} ${this.constructor.name}${this.info?": "+this.info:""}${e?"\n"+e:""}`,Object.setPrototypeOf(this,R.prototype)}get info(){return""}}R.prefix="[TON_CONNECT_SDK_ERROR]";class A extends R{get info(){return"Passed DappMetadata is in incorrect format."}constructor(...e){super(...e),Object.setPrototypeOf(this,A.prototype)}}class T extends R{get info(){return"Passed `tonconnect-manifest.json` contains errors. Check format of your manifest. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"}constructor(...e){super(...e),Object.setPrototypeOf(this,T.prototype)}}class M extends R{get info(){return"Manifest not found. Make sure you added `tonconnect-manifest.json` to the root of your app or passed correct manifestUrl. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest"}constructor(...e){super(...e),Object.setPrototypeOf(this,M.prototype)}}class O extends R{get info(){return"Wallet connection called but wallet already connected. To avoid the error, disconnect the wallet before doing a new connection."}constructor(...e){super(...e),Object.setPrototypeOf(this,O.prototype)}}class $ extends R{get info(){return"Send transaction or other protocol methods called while wallet is not connected."}constructor(...e){super(...e),Object.setPrototypeOf(this,$.prototype)}}class P extends R{get info(){return"User rejects the action in the wallet."}constructor(...e){super(...e),Object.setPrototypeOf(this,P.prototype)}}class I extends R{get info(){return"Request to the wallet contains errors."}constructor(...e){super(...e),Object.setPrototypeOf(this,I.prototype)}}class N extends R{get info(){return"App tries to send rpc request to the injected wallet while not connected."}constructor(...e){super(...e),Object.setPrototypeOf(this,N.prototype)}}class U extends R{get info(){return"There is an attempt to connect to the injected wallet while it is not exists in the webpage."}constructor(...e){super(...e),Object.setPrototypeOf(this,U.prototype)}}class W extends R{get info(){return"Storage was not specified in the `DappMetadata` and default `localStorage` was not detected in the environment."}constructor(...e){super(...e),Object.setPrototypeOf(this,W.prototype)}}class j extends R{get info(){return"An error occurred while fetching the wallets list."}constructor(...e){super(...e),Object.setPrototypeOf(this,j.prototype)}}class B extends R{get info(){return"Passed address is in incorrect format."}constructor(...e){super(...e),Object.setPrototypeOf(this,B.prototype)}}class H extends R{get info(){return"Passed hex is in incorrect format."}constructor(...e){super(...e),Object.setPrototypeOf(this,H.prototype)}}class K extends R{constructor(...e){super(...e),Object.setPrototypeOf(this,K.prototype)}}const V={[f.UNKNOWN_ERROR]:K,[f.USER_REJECTS_ERROR]:P,[f.BAD_REQUEST_ERROR]:I,[f.UNKNOWN_APP_ERROR]:N,[f.MANIFEST_NOT_FOUND_ERROR]:M,[f.MANIFEST_CONTENT_ERROR]:T};const D=new class{parseError(e){let t=K;return e.code in V&&(t=V[e.code]||K),new t(e.message)}};class F{isError(e){return"error"in e}}const q={[w.UNKNOWN_ERROR]:K,[w.USER_REJECTS_ERROR]:P,[w.BAD_REQUEST_ERROR]:I,[w.UNKNOWN_APP_ERROR]:N};const z=new class extends F{convertToRpcRequest(e){return{method:"sendTransaction",params:[JSON.stringify(e)]}}parseAndThrowError(e){let t=K;throw e.error.code in q&&(t=q[e.error.code]||K),new t(e.error.message)}convertFromRpcResponse(e){return{boc:e.result}}};class Z{constructor(e,t){this.storage=e,this.storeKey="ton-connect-storage_http-bridge-gateway::"+t}storeLastEventId(e){return L(this,void 0,void 0,(function*(){return this.storage.setItem(this.storeKey,e)}))}removeLastEventId(){return L(this,void 0,void 0,(function*(){return this.storage.removeItem(this.storeKey)}))}getLastEventId(){return L(this,void 0,void 0,(function*(){const e=yield this.storage.getItem(this.storeKey);return e||null}))}}function G(e,t){return function(e){return"/"===e.slice(-1)?e.slice(0,-1):e}(e)+"/"+t}function Y(e){const t=new URL(e);return"tg:"===t.protocol||"t.me"===t.hostname}function Q(e){return e.replaceAll(".","%2E").replaceAll("-","%2D").replaceAll("_","%5F").replaceAll("&","-").replaceAll("=","__").replaceAll("%","--")}class J{constructor(e,t,n,r,o){this.bridgeUrl=t,this.sessionId=n,this.listener=r,this.errorsListener=o,this.ssePath="events",this.postPath="message",this.heartbeatMessage="heartbeat",this.defaultTtl=300,this.isClosed=!1,this.bridgeGatewayStorage=new Z(e,t)}registerSession(e){return L(this,void 0,void 0,(function*(){const t=new URL(G(this.bridgeUrl,this.ssePath));t.searchParams.append("client_id",this.sessionId);const n=yield this.bridgeGatewayStorage.getLastEventId();if(!this.isClosed)return n&&t.searchParams.append("last_event_id",n),this.eventSource=new EventSource(t.toString()),new Promise(((t,n)=>{const r=(null==e?void 0:e.openingDeadlineMS)?setTimeout((()=>{var e;(null===(e=this.eventSource)||void 0===e?void 0:e.readyState)!==EventSource.OPEN&&(n(new R("Bridge connection timeout")),this.close())}),e.openingDeadlineMS):void 0;this.eventSource.onerror=()=>n,this.eventSource.onopen=()=>{clearTimeout(r),this.isClosed=!1,this.eventSource.onerror=this.errorsHandler.bind(this),this.eventSource.onmessage=this.messagesHandler.bind(this),t()}}))}))}send(e,t,n,r){return L(this,void 0,void 0,(function*(){const o=new URL(G(this.bridgeUrl,this.postPath));o.searchParams.append("client_id",this.sessionId),o.searchParams.append("to",t),o.searchParams.append("ttl",(r||this.defaultTtl).toString()),o.searchParams.append("topic",n),yield fetch(o,{method:"post",body:_.encode(e)})}))}pause(){var e;null===(e=this.eventSource)||void 0===e||e.close()}unPause(){return this.registerSession()}close(){var e;this.isClosed=!0,null===(e=this.eventSource)||void 0===e||e.close()}setListener(e){this.listener=e}setErrorsListener(e){this.errorsListener=e}errorsHandler(e){var t,n;if(!this.isClosed){if((null===(t=this.eventSource)||void 0===t?void 0:t.readyState)===EventSource.CLOSED)return this.eventSource.close(),void this.registerSession();if((null===(n=this.eventSource)||void 0===n?void 0:n.readyState)===EventSource.CONNECTING)return void console.debug("[TON_CONNET_SDK_ERROR]: Bridge error",JSON.stringify(e));this.errorsListener(e)}}messagesHandler(e){return L(this,void 0,void 0,(function*(){if(e.data!==this.heartbeatMessage&&(yield this.bridgeGatewayStorage.storeLastEventId(e.lastEventId),!this.isClosed)){let n;try{n=JSON.parse(e.data)}catch(t){throw new R(`Bridge message parse failed, message ${t.data}`)}this.listener(n)}}))}}function X(e){return!("connectEvent"in e)}class ee{constructor(e){this.storage=e,this.storeKey="ton-connect-storage_bridge-connection"}storeConnection(e){return L(this,void 0,void 0,(function*(){if("injected"===e.type)return this.storage.setItem(this.storeKey,JSON.stringify(e));if(!X(e)){const t={sessionKeyPair:e.session.sessionCrypto.stringifyKeypair(),walletPublicKey:e.session.walletPublicKey,bridgeUrl:e.session.bridgeUrl},n={type:"http",connectEvent:e.connectEvent,session:t,lastWalletEventId:e.lastWalletEventId,nextRpcRequestId:e.nextRpcRequestId};return this.storage.setItem(this.storeKey,JSON.stringify(n))}const t={type:"http",connectionSource:e.connectionSource,sessionCrypto:e.sessionCrypto.stringifyKeypair()};return this.storage.setItem(this.storeKey,JSON.stringify(t))}))}removeConnection(){return L(this,void 0,void 0,(function*(){return this.storage.removeItem(this.storeKey)}))}getConnection(){return L(this,void 0,void 0,(function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;const t=JSON.parse(e);if("injected"===t.type)return t;if("connectEvent"in t){const e=new E(t.session.sessionKeyPair);return{type:"http",connectEvent:t.connectEvent,lastWalletEventId:t.lastWalletEventId,nextRpcRequestId:t.nextRpcRequestId,session:{sessionCrypto:e,bridgeUrl:t.session.bridgeUrl,walletPublicKey:t.session.walletPublicKey}}}return{type:"http",sessionCrypto:new E(t.sessionCrypto),connectionSource:t.connectionSource}}))}getHttpConnection(){return L(this,void 0,void 0,(function*(){const e=yield this.getConnection();if(!e)throw new R("Trying to read HTTP connection source while nothing is stored");if("injected"===e.type)throw new R("Trying to read HTTP connection source while injected connection is stored");return e}))}getHttpPendingConnection(){return L(this,void 0,void 0,(function*(){const e=yield this.getConnection();if(!e)throw new R("Trying to read HTTP connection source while nothing is stored");if("injected"===e.type)throw new R("Trying to read HTTP connection source while injected connection is stored");if(!X(e))throw new R("Trying to read HTTP-pending connection while http connection is stored");return e}))}getInjectedConnection(){return L(this,void 0,void 0,(function*(){const e=yield this.getConnection();if(!e)throw new R("Trying to read Injected bridge connection source while nothing is stored");if("http"===(null==e?void 0:e.type))throw new R("Trying to read Injected bridge connection source while HTTP connection is stored");return e}))}storedConnectionType(){return L(this,void 0,void 0,(function*(){const e=yield this.storage.getItem(this.storeKey);if(!e)return null;return JSON.parse(e).type}))}storeLastWalletEventId(e){return L(this,void 0,void 0,(function*(){const t=yield this.getConnection();if(t&&"http"===t.type&&!X(t))return t.lastWalletEventId=e,this.storeConnection(t)}))}getLastWalletEventId(){return L(this,void 0,void 0,(function*(){const e=yield this.getConnection();if(e&&"lastWalletEventId"in e)return e.lastWalletEventId}))}increaseNextRpcRequestId(){return L(this,void 0,void 0,(function*(){const e=yield this.getConnection();if(e&&"nextRpcRequestId"in e){const t=e.nextRpcRequestId||0;return e.nextRpcRequestId=t+1,this.storeConnection(e)}}))}getNextRpcRequestId(){return L(this,void 0,void 0,(function*(){const e=yield this.getConnection();return e&&"nextRpcRequestId"in e&&e.nextRpcRequestId||0}))}}function te(...e){try{console.debug("[TON_CONNECT_SDK]",...e)}catch(t){}}function ne(...e){try{console.error("[TON_CONNECT_SDK]",...e)}catch(t){}}class re{constructor(e,t){this.storage=e,this.walletConnectionSource=t,this.type="http",this.standardUniversalLink="tc://",this.pendingRequests=new Map,this.session=null,this.gateway=null,this.pendingGateways=[],this.listeners=[],this.connectionStorage=new ee(e)}static fromStorage(e){return L(this,void 0,void 0,(function*(){const t=new ee(e),n=yield t.getHttpConnection();return X(n)?new re(e,n.connectionSource):new re(e,{bridgeUrl:n.session.bridgeUrl})}))}connect(e){this.closeGateways();const t=new E;this.session={sessionCrypto:t,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.connectionStorage.storeConnection({type:"http",connectionSource:this.walletConnectionSource,sessionCrypto:t}).then((()=>this.openGateways(t)));const n="universalLink"in this.walletConnectionSource&&this.walletConnectionSource.universalLink?this.walletConnectionSource.universalLink:this.standardUniversalLink;return this.generateUniversalLink(n,e)}restoreConnection(){return L(this,void 0,void 0,(function*(){this.closeGateways();const e=yield this.connectionStorage.getHttpConnection();if(e){if(X(e))return this.session={sessionCrypto:e.sessionCrypto,bridgeUrl:"bridgeUrl"in this.walletConnectionSource?this.walletConnectionSource.bridgeUrl:""},this.openGateways(e.sessionCrypto,{openingDeadlineMS:5e3});if(Array.isArray(this.walletConnectionSource))throw new R("Internal error. Connection source is array while WalletConnectionSourceHTTP was expected.");this.session=e.session,this.gateway=new J(this.storage,this.walletConnectionSource.bridgeUrl,e.session.sessionCrypto.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this));try{yield this.gateway.registerSession({openingDeadlineMS:5e3})}catch(t){return void(yield this.disconnect())}this.listeners.forEach((t=>t(e.connectEvent)))}}))}sendRequest(e,t){return new Promise(((n,r)=>L(this,void 0,void 0,(function*(){if(!this.gateway||!this.session||!("walletPublicKey"in this.session))throw new R("Trying to send bridge request without session");const o=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),te("Send http-bridge request:",Object.assign(Object.assign({},e),{id:o}));const i=this.session.sessionCrypto.encrypt(JSON.stringify(Object.assign(Object.assign({},e),{id:o})),S(this.session.walletPublicKey));this.gateway.send(i,this.session.walletPublicKey,e.method).catch(r),this.pendingRequests.set(o.toString(),n),null==t||t()}))))}closeConnection(){this.closeGateways(),this.listeners=[],this.session=null,this.gateway=null}disconnect(){return L(this,void 0,void 0,(function*(){return new Promise((e=>L(this,void 0,void 0,(function*(){let t=!1;const n=()=>{t=!0,this.removeBridgeAndSession().then(e)};try{yield this.sendRequest({method:"disconnect",params:[]},n)}catch(r){console.debug(r),t||this.removeBridgeAndSession().then(e)}}))))}))}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter((t=>t!==e))}pause(){var e;null===(e=this.gateway)||void 0===e||e.pause(),this.pendingGateways.forEach((e=>e.pause()))}unPause(){return L(this,void 0,void 0,(function*(){const e=this.pendingGateways.map((e=>e.unPause()));this.gateway&&e.push(this.gateway.unPause()),yield Promise.all(e)}))}pendingGatewaysListener(e,t,n){return L(this,void 0,void 0,(function*(){if(this.pendingGateways.includes(e))return this.closeGateways({except:e}),this.session.bridgeUrl=t,this.gateway=e,this.gateway.setErrorsListener(this.gatewayErrorsListener.bind(this)),this.gateway.setListener(this.gatewayListener.bind(this)),this.gatewayListener(n);e.close()}))}gatewayListener(e){return L(this,void 0,void 0,(function*(){const t=JSON.parse(this.session.sessionCrypto.decrypt(_.decode(e.message).toUint8Array(),S(e.from)));if(te("Wallet message received:",t),!("event"in t)){const e=t.id.toString(),n=this.pendingRequests.get(e);return n?(n(t),void this.pendingRequests.delete(e)):void te(`Response id ${e} doesn't match any request's id`)}if(void 0!==t.id){const e=yield this.connectionStorage.getLastWalletEventId();if(void 0!==e&&t.id<=e)return void ne(`Received event id (=${t.id}) must be greater than stored last wallet event id (=${e}) `);"connect"!==t.event&&(yield this.connectionStorage.storeLastWalletEventId(t.id))}const n=this.listeners;"connect"===t.event&&(yield this.updateSession(t,e.from)),"disconnect"===t.event&&(yield this.removeBridgeAndSession()),n.forEach((e=>e(t)))}))}gatewayErrorsListener(e){return L(this,void 0,void 0,(function*(){throw new R(`Bridge error ${JSON.stringify(e)}`)}))}updateSession(e,t){return L(this,void 0,void 0,(function*(){this.session=Object.assign(Object.assign({},this.session),{walletPublicKey:t});const n=e.payload.items.find((e=>"ton_addr"===e.name)),r=Object.assign(Object.assign({},e),{payload:Object.assign(Object.assign({},e.payload),{items:[n]})});yield this.connectionStorage.storeConnection({type:"http",session:this.session,lastWalletEventId:e.id,connectEvent:r,nextRpcRequestId:0})}))}removeBridgeAndSession(){return L(this,void 0,void 0,(function*(){this.closeConnection(),yield this.connectionStorage.removeConnection()}))}generateUniversalLink(e,t){return Y(e)?this.generateTGUniversalLink(e,t):this.generateRegularUniversalLink(e,t)}generateRegularUniversalLink(e,t){const n=new URL(e);return n.searchParams.append("v",2..toString()),n.searchParams.append("id",this.session.sessionCrypto.sessionId),n.searchParams.append("r",JSON.stringify(t)),n.toString()}generateTGUniversalLink(e,t){const n="tonconnect-"+Q(this.generateRegularUniversalLink("about:blank",t).split("?")[1]),r=new URL(e);return r.searchParams.append("startattach",n),r.toString()}openGateways(e,t){return L(this,void 0,void 0,(function*(){return Array.isArray(this.walletConnectionSource)?(this.pendingGateways=this.walletConnectionSource.map((t=>{const n=new J(this.storage,t.bridgeUrl,e.sessionId,(()=>{}),(e=>{console.error(e)}));return n.setListener((e=>this.pendingGatewaysListener(n,t.bridgeUrl,e))),n})),void(yield Promise.allSettled(this.pendingGateways.map((e=>e.registerSession(t)))))):(this.gateway=new J(this.storage,this.walletConnectionSource.bridgeUrl,e.sessionId,this.gatewayListener.bind(this),this.gatewayErrorsListener.bind(this)),this.gateway.registerSession(t))}))}closeGateways(e){var t;null===(t=this.gateway)||void 0===t||t.close(),this.pendingGateways.filter((t=>t!==(null==e?void 0:e.except))).forEach((e=>e.close())),this.pendingGateways=[]}}function oe(e,t){return ie(e,[t])}function ie(e,t){return!(!e||"object"!=typeof e)&&t.every((t=>t in e))}function se(){if("undefined"!=typeof window)return window}function ae(){var e;const t=null===(e=se())||void 0===e?void 0:e.location.origin;return t?t+"/tonconnect-manifest.json":""}class le{constructor(e,t){this.injectedWalletKey=t,this.type="injected",this.unsubscribeCallback=null,this.listenSubscriptions=!1,this.listeners=[];const n=le.window;if(!le.isWindowContainsWallet(n,t))throw new U;this.connectionStorage=new ee(e),this.injectedWallet=n[t].tonconnect}static fromStorage(e){return L(this,void 0,void 0,(function*(){const t=new ee(e),n=yield t.getInjectedConnection();return new le(e,n.jsBridgeKey)}))}static isWalletInjected(e){return le.isWindowContainsWallet(this.window,e)}static isInsideWalletBrowser(e){return!!le.isWindowContainsWallet(this.window,e)&&this.window[e].tonconnect.isWalletBrowser}static getCurrentlyInjectedWallets(){if(!this.window)return[];return Object.entries(this.window).filter((([e,t])=>function(e){try{return!(!oe(e,"tonconnect")||!oe(e.tonconnect,"walletInfo"))&&ie(e.tonconnect.walletInfo,["name","app_name","image","about_url","platforms"])}catch(t){return!1}}(t))).map((([e,t])=>({name:t.tonconnect.walletInfo.name,appName:t.tonconnect.walletInfo.app_name,aboutUrl:t.tonconnect.walletInfo.about_url,imageUrl:t.tonconnect.walletInfo.image,tondns:t.tonconnect.walletInfo.tondns,jsBridgeKey:e,injected:!0,embedded:t.tonconnect.isWalletBrowser,platforms:t.tonconnect.walletInfo.platforms})))}static isWindowContainsWallet(e,t){return!!e&&t in e&&"object"==typeof e[t]&&"tonconnect"in e[t]}connect(e){this._connect(2,e)}restoreConnection(){return L(this,void 0,void 0,(function*(){try{te("Injected Provider restoring connection...");const e=yield this.injectedWallet.restoreConnection();te("Injected Provider restoring connection response",e),"connect"===e.event?(this.makeSubscriptions(),this.listeners.forEach((t=>t(e)))):yield this.connectionStorage.removeConnection()}catch(e){yield this.connectionStorage.removeConnection(),console.error(e)}}))}closeConnection(){this.listenSubscriptions&&this.injectedWallet.disconnect(),this.closeAllListeners()}disconnect(){return L(this,void 0,void 0,(function*(){return new Promise((e=>{const t=()=>{this.closeAllListeners(),this.connectionStorage.removeConnection().then(e)};try{this.injectedWallet.disconnect(),t()}catch(n){te(n),this.sendRequest({method:"disconnect",params:[]},t)}}))}))}closeAllListeners(){var e;this.listenSubscriptions=!1,this.listeners=[],null===(e=this.unsubscribeCallback)||void 0===e||e.call(this)}listen(e){return this.listeners.push(e),()=>this.listeners=this.listeners.filter((t=>t!==e))}sendRequest(e,t){return L(this,void 0,void 0,(function*(){const n=(yield this.connectionStorage.getNextRpcRequestId()).toString();yield this.connectionStorage.increaseNextRpcRequestId(),te("Send injected-bridge request:",Object.assign(Object.assign({},e),{id:n}));const r=this.injectedWallet.send(Object.assign(Object.assign({},e),{id:n}));return r.then((e=>te("Wallet message received:",e))),null==t||t(),r}))}_connect(e,t){return L(this,void 0,void 0,(function*(){try{te(`Injected Provider connect request: protocolVersion: ${e}, message:`,t);const n=yield this.injectedWallet.connect(e,t);te("Injected Provider connect response:",n),"connect"===n.event&&(yield this.updateSession(),this.makeSubscriptions()),this.listeners.forEach((e=>e(n)))}catch(n){te(n);const e={event:"connect_error",payload:{code:0,message:null==n?void 0:n.toString()}};this.listeners.forEach((t=>t(e)))}}))}makeSubscriptions(){this.listenSubscriptions=!0,this.unsubscribeCallback=this.injectedWallet.listen((e=>{te("Wallet message received:",e),this.listenSubscriptions&&this.listeners.forEach((t=>t(e))),"disconnect"===e.event&&this.disconnect()}))}updateSession(){return this.connectionStorage.storeConnection({type:"injected",jsBridgeKey:this.injectedWalletKey,nextRpcRequestId:0})}}le.window=se();class ce{constructor(){const e=se();if(!(null==e?void 0:e.localStorage))throw new W;this.window=e}getItem(e){return L(this,void 0,void 0,(function*(){return Promise.resolve(this.window.localStorage.getItem(e))}))}removeItem(e){return L(this,void 0,void 0,(function*(){return this.window.localStorage.removeItem(e),Promise.resolve()}))}setItem(e,t){return this.window.localStorage.setItem(e,t),Promise.resolve()}}function ue(e){return he(e)&&e.injected}function de(e){return ue(e)&&e.embedded}function he(e){return"jsBridgeKey"in e}function fe(e){return"bridgeUrl"in e}const ge=[{app_name:"telegram-wallet",name:"Wallet",image:"https://wallet.tg/images/logo-288.png",about_url:"https://wallet.tg/",universal_url:"https://t.me/wallet?attach=wallet",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"}],platforms:["ios","android","macos","windows","linux"]},{app_name:"tonkeeper",name:"Tonkeeper",image:"https://tonkeeper.com/assets/tonconnect-icon.png",tondns:"tonkeeper.ton",about_url:"https://tonkeeper.com",universal_url:"https://app.tonkeeper.com/ton-connect",bridge:[{type:"sse",url:"https://bridge.tonapi.io/bridge"},{type:"js",key:"tonkeeper"}],platforms:["ios","android","chrome","firefox"]},{app_name:"openmask",name:"OpenMask",image:"https://raw.githubusercontent.com/OpenProduct/openmask-extension/main/public/openmask-logo-288.png",about_url:"https://www.openmask.app/",bridge:[{type:"js",key:"openmask"}],platforms:["chrome"]},{app_name:"mytonwallet",name:"MyTonWallet",image:"https://mytonwallet.io/icon-256.png",about_url:"https://mytonwallet.io",universal_url:"https://connect.mytonwallet.org",bridge:[{type:"js",key:"mytonwallet"},{type:"sse",url:"https://tonconnectbridge.mytonwallet.org/bridge/"}],platforms:["chrome","windows","macos","linux"]},{app_name:"tonhub",name:"Tonhub",image:"https://tonhub.com/tonconnect_logo.png",about_url:"https://tonhub.com",universal_url:"https://tonhub.com/ton-connect",bridge:[{type:"js",key:"tonhub"},{type:"sse",url:"https://connect.tonhubapi.com/tonconnect"}],platforms:["ios","android"]},{app_name:"tonflow",name:"TonFlow",image:"https://tonflow.net/assets/images/tonflow_ico_192.png",about_url:"https://tonflow.net",bridge:[{type:"js",key:"tonflow"}],platforms:["chrome"]},{app_name:"dewallet",name:"DeWallet",image:"https://app.delabwallet.com/logo_black.png",about_url:"https://delabwallet.com",bridge:[{type:"js",key:"dewallet"}],platforms:["chrome"]},{app_name:"xtonwallet",name:"XTONWallet",image:"https://xtonwallet.com/assets/img/icon-256-back.png",about_url:"https://xtonwallet.com",bridge:[{type:"js",key:"xtonwallet"}],platforms:["chrome","firefox"]},{app_name:"tonwallet",name:"TON Wallet",image:"https://wallet.ton.org/assets/ui/qr-logo.png",about_url:"https://chrome.google.com/webstore/detail/ton-wallet/nphplpgoakhhjchkkhmiggakijnkhfnd",bridge:[{type:"js",key:"tonwallet"}],platforms:["chrome"]}];class pe{constructor(e){this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null,this.walletsListSource="https://raw.githubusercontent.com/ton-blockchain/wallets-list/main/wallets-v2.json",(null==e?void 0:e.walletsListSource)&&(this.walletsListSource=e.walletsListSource),(null==e?void 0:e.cacheTTLMs)&&(this.cacheTTLMs=e.cacheTTLMs)}getWallets(){return L(this,void 0,void 0,(function*(){return this.cacheTTLMs&&this.walletsListCacheCreationTimestamp&&Date.now()>this.walletsListCacheCreationTimestamp+this.cacheTTLMs&&(this.walletsListCache=null),this.walletsListCache||(this.walletsListCache=this.fetchWalletsList(),this.walletsListCache.then((()=>{this.walletsListCacheCreationTimestamp=Date.now()})).catch((()=>{this.walletsListCache=null,this.walletsListCacheCreationTimestamp=null}))),this.walletsListCache}))}getEmbeddedWallet(){return L(this,void 0,void 0,(function*(){const e=(yield this.getWallets()).filter(de);return 1!==e.length?null:e[0]}))}fetchWalletsList(){return L(this,void 0,void 0,(function*(){let e=[];try{const t=yield fetch(this.walletsListSource);if(e=yield t.json(),!Array.isArray(e))throw new j("Wrong wallets list format, wallets list must be an array.");const n=e.filter((e=>!this.isCorrectWalletConfigDTO(e)));n.length&&(ne(`Wallet(s) ${n.map((e=>e.name)).join(", ")} config format is wrong. They were removed from the wallets list.`),e=e.filter((e=>this.isCorrectWalletConfigDTO(e))))}catch(n){ne(n),e=ge}let t=[];try{t=le.getCurrentlyInjectedWallets()}catch(n){ne(n)}return this.mergeWalletsLists(this.walletConfigDTOListToWalletConfigList(e),t)}))}walletConfigDTOListToWalletConfigList(e){return e.map((e=>{const t={name:e.name,appName:e.app_name,imageUrl:e.image,aboutUrl:e.about_url,tondns:e.tondns,platforms:e.platforms};return e.bridge.forEach((n=>{if("sse"===n.type&&(t.bridgeUrl=n.url,t.universalLink=e.universal_url,t.deepLink=e.deepLink),"js"===n.type){const e=n.key;t.jsBridgeKey=e,t.injected=le.isWalletInjected(e),t.embedded=le.isInsideWalletBrowser(e)}})),t}))}mergeWalletsLists(e,t){return[...new Set(e.concat(t).map((e=>e.name))).values()].map((n=>{const r=e.find((e=>e.name===n)),o=t.find((e=>e.name===n));return Object.assign(Object.assign({},r&&Object.assign({},r)),o&&Object.assign({},o))}))}isCorrectWalletConfigDTO(e){if(!e||"object"!=typeof e)return!1;if(!("name"in e&&"image"in e&&"about_url"in e&&"platforms"in e&&"app_name"in e))return!1;if(!e.platforms||!Array.isArray(e.platforms)||!e.platforms.length)return!1;if(!("bridge"in e)||!Array.isArray(e.bridge)||!e.bridge.length)return!1;const t=e.bridge;if(t.some((e=>!e||"object"!=typeof e||!("type"in e))))return!1;const n=t.find((e=>"sse"===e.type));if(n&&(!("url"in n)||!n.url||!e.universal_url))return!1;const r=t.find((e=>"js"===e.type));return!!(!r||"key"in r&&r.key)}}class we extends R{get info(){return"Wallet doesn't support requested feature method."}constructor(...e){super(...e),Object.setPrototypeOf(this,we.prototype)}}function me(e,t){const n=e.includes("SendTransaction"),r=e.find((e=>e&&"object"==typeof e&&"SendTransaction"===e.name));if(!n&&!r)throw new we("Wallet doesn't support SendTransaction feature.");if(r&&void 0!==r.maxMessages){if(r.maxMessages<t.requiredMessagesNumber)throw new we(`Wallet is not able to handle such SendTransaction request. Max support messages number is ${r.maxMessages}, but ${t.requiredMessagesNumber} is required.`)}else!function(...e){try{console.warn("[TON_CONNECT_SDK]",...e)}catch(t){}}("Connected wallet didn't provide information about max allowed messages in the SendTransaction request. Request may be rejected by the wallet.")}class ve{constructor(e){if(this.walletsList=new pe,this._wallet=null,this.provider=null,this.statusChangeSubscriptions=[],this.statusChangeErrorSubscriptions=[],this.dappSettings={manifestUrl:(null==e?void 0:e.manifestUrl)||ae(),storage:(null==e?void 0:e.storage)||new ce},this.walletsList=new pe({walletsListSource:null==e?void 0:e.walletsListSource,cacheTTLMs:null==e?void 0:e.walletsListCacheTTLMs}),!this.dappSettings.manifestUrl)throw new A("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");this.bridgeConnectionStorage=new ee(this.dappSettings.storage),(null==e?void 0:e.disableAutoPauseConnection)||this.addWindowFocusAndBlurSubscriptions()}static getWallets(){return this.walletsList.getWallets()}get connected(){return null!==this._wallet}get account(){var e;return(null===(e=this._wallet)||void 0===e?void 0:e.account)||null}get wallet(){return this._wallet}set wallet(e){this._wallet=e,this.statusChangeSubscriptions.forEach((e=>e(this._wallet)))}getWallets(){return this.walletsList.getWallets()}onStatusChange(e,t){return this.statusChangeSubscriptions.push(e),t&&this.statusChangeErrorSubscriptions.push(t),()=>{this.statusChangeSubscriptions=this.statusChangeSubscriptions.filter((t=>t!==e)),t&&(this.statusChangeErrorSubscriptions=this.statusChangeErrorSubscriptions.filter((e=>e!==t)))}}connect(e,t){var n;if(this.connected)throw new O;return null===(n=this.provider)||void 0===n||n.closeConnection(),this.provider=this.createProvider(e),this.provider.connect(this.createConnectRequest(t))}restoreConnection(){return L(this,void 0,void 0,(function*(){const[e,t]=yield Promise.all([this.bridgeConnectionStorage.storedConnectionType(),this.walletsList.getEmbeddedWallet()]);try{switch(e){case"http":this.provider=yield re.fromStorage(this.dappSettings.storage);break;case"injected":this.provider=yield le.fromStorage(this.dappSettings.storage);break;default:if(!t)return;this.provider=yield this.createProvider(t)}}catch(n){return yield this.bridgeConnectionStorage.removeConnection(),void(this.provider=null)}return this.provider.listen(this.walletEventsListener.bind(this)),this.provider.restoreConnection()}))}sendTransaction(e){return L(this,void 0,void 0,(function*(){this.checkConnection(),me(this.wallet.device.features,{requiredMessagesNumber:e.messages.length});const{validUntil:t}=e,n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["validUntil"]),r=e.from||this.account.address,o=e.network||this.account.chain,i=yield this.provider.sendRequest(z.convertToRpcRequest(Object.assign(Object.assign({},n),{valid_until:t,from:r,network:o})));return z.isError(i)?z.parseAndThrowError(i):z.convertFromRpcResponse(i)}))}disconnect(){return L(this,void 0,void 0,(function*(){if(!this.connected)throw new $;yield this.provider.disconnect(),this.onWalletDisconnected()}))}pauseConnection(){var e;"http"===(null===(e=this.provider)||void 0===e?void 0:e.type)&&this.provider.pause()}unPauseConnection(){var e;return"http"!==(null===(e=this.provider)||void 0===e?void 0:e.type)?Promise.resolve():this.provider.unPause()}addWindowFocusAndBlurSubscriptions(){const e=function(){if("undefined"!=typeof document)return document}();if(e)try{e.addEventListener("visibilitychange",(()=>{e.hidden?this.pauseConnection():this.unPauseConnection()}))}catch(t){console.error("Cannot subscribe to the document.visibilitychange: ",t)}}createProvider(e){let t;return t=!Array.isArray(e)&&"jsBridgeKey"in e?new le(this.dappSettings.storage,e.jsBridgeKey):new re(this.dappSettings.storage,e),t.listen(this.walletEventsListener.bind(this)),t}walletEventsListener(e){switch(e.event){case"connect":this.onWalletConnected(e.payload);break;case"connect_error":this.onWalletConnectError(e.payload);break;case"disconnect":this.onWalletDisconnected()}}onWalletConnected(e){const t=e.items.find((e=>"ton_addr"===e.name)),n=e.items.find((e=>"ton_proof"===e.name));if(!t)throw new R("ton_addr connection item was not found");const r={device:e.device,provider:this.provider.type,account:{address:t.address,chain:t.network,walletStateInit:t.walletStateInit,publicKey:t.publicKey}};n&&(r.connectItems={tonProof:n}),this.wallet=r}onWalletConnectError(e){const t=D.parseError(e);if(this.statusChangeErrorSubscriptions.forEach((e=>e(t))),console.debug(t),t instanceof M||t instanceof T)throw console.error(t),t}onWalletDisconnected(){this.wallet=null}checkConnection(){if(!this.connected)throw new $}createConnectRequest(e){const t=[{name:"ton_addr"}];return(null==e?void 0:e.tonProof)&&t.push({name:"ton_proof",payload:e.tonProof}),{manifestUrl:this.dappSettings.manifestUrl,items:t}}}ve.walletsList=new pe,ve.isWalletInjected=e=>le.isWalletInjected(e),ve.isInsideWalletBrowser=e=>le.isInsideWalletBrowser(e);const ye=17,be=128;function Ce(e,t=!1){const{wc:n,hex:r}=function(e){if(!e.includes(":"))throw new B(`Wrong address ${e}. Address must include ":".`);const t=e.split(":");if(2!==t.length)throw new B(`Wrong address ${e}. Address must include ":" only once.`);const n=parseInt(t[0]);if(0!==n&&-1!==n)throw new B(`Wrong address ${e}. WC must be eq 0 or -1, but ${n} received.`);const r=t[1];if(64!==(null==r?void 0:r.length))throw new B(`Wrong address ${e}. Hex part must be 64bytes length, but ${null==r?void 0:r.length} received.`);return{wc:n,hex:_e(r)}}(e);let o=ye;t&&(o|=be);const i=new Int8Array(34);i[0]=o,i[1]=n,i.set(r,2);const s=new Uint8Array(36);return s.set(i),s.set(function(e){const t=4129;let n=0;const r=new Uint8Array(e.length+2);r.set(e);for(let o of r){let e=128;for(;e>0;)n<<=1,o&e&&(n+=1),e>>=1,n>65535&&(n&=65535,n^=t)}return new Uint8Array([Math.floor(n/256),n%256])}(i),34),_.encode(s).replace(/\+/g,"-").replace(/\//g,"_")}const xe={};for(let kc=0;kc<=255;kc++){let e=kc.toString(16);e.length<2&&(e="0"+e),xe[e]=kc}function _e(e){const t=(e=e.toLowerCase()).length;if(t%2!=0)throw new H("Hex string must have length a multiple of 2: "+e);const n=t/2,r=new Uint8Array(n);for(let o=0;o<n;o++){const t=2*o,n=e.substring(t,t+2);if(!xe.hasOwnProperty(n))throw new H("Invalid hex character: "+n);r[o]=xe[n]}return r}const ke={};const Se=Symbol("solid-proxy"),Ee=Symbol("solid-track"),Le={equals:(e,t)=>e===t};let Re=st;const Ae=1,Te=2,Me={owned:null,cleanups:null,context:null,owner:null},Oe={};var $e=null;let Pe,Ie=null,Ne=null,Ue=null,We=null,je=0;function Be(e,t){const n=Ne,r=$e,o=0===e.length,i=o?Me:{owned:null,cleanups:null,context:null,owner:void 0===t?r:t},s=o?e:()=>e((()=>Ze((()=>ut(i)))));$e=i,Ne=null;try{return it(s,!0)}finally{Ne=n,$e=r}}function He(e,t){const n={value:e,observers:null,observerSlots:null,comparator:(t=t?Object.assign({},Le,t):Le).equals||void 0};return[et.bind(n),e=>("function"==typeof e&&(e=e(n.value)),tt(n,e))]}function Ke(e,t,n){nt(rt(e,t,!0,Ae))}function Ve(e,t,n){nt(rt(e,t,!1,Ae))}function De(e,t,n){Re=at;const r=rt(e,t,!1,Ae);r.user=!0,We?We.push(r):nt(r)}function Fe(e,t,n){n=n?Object.assign({},Le,n):Le;const r=rt(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,nt(r),et.bind(r)}function qe(e,t,n){let r,o,i;2===arguments.length&&"object"==typeof t||1===arguments.length?(r=!0,o=e,i=t||{}):(r=e,o=t,i=n||{});let s=null,a=Oe,l=null,c=!1,u="initialValue"in i,d="function"==typeof r&&Fe(r);const h=new Set,[f,g]=(i.storage||He)(i.initialValue),[p,w]=He(void 0),[m,v]=He(void 0,{equals:!1}),[y,b]=He(u?"ready":"unresolved");if(ke.context){let e;l=`${ke.context.id}${ke.context.count++}`,"initial"===i.ssrLoadFrom?a=i.initialValue:ke.load&&(e=ke.load(l))&&(a=e[0])}function C(e,t,n,r){return s===e&&(s=null,u=!0,e!==a&&t!==a||!i.onHydrated||queueMicrotask((()=>i.onHydrated(r,{value:t}))),a=Oe,function(e,t){it((()=>{void 0===t&&g((()=>e)),b(void 0!==t?"errored":"ready"),w(t);for(const e of h.keys())e.decrement();h.clear()}),!1)}(t,n)),t}function x(){const e=Pe,t=f(),n=p();if(void 0!==n&&!s)throw n;return Ne&&!Ne.user&&e&&Ke((()=>{m(),s&&(e.resolved||h.has(e)||(e.increment(),h.add(e)))})),t}function _(e=!0){if(!1!==e&&c)return;c=!1;const t=d?d():r;if(null==t||!1===t)return void C(s,Ze(f));const n=a!==Oe?a:Ze((()=>o(t,{value:f(),refetching:e})));return"object"==typeof n&&n&&"then"in n?(s=n,c=!0,queueMicrotask((()=>c=!1)),it((()=>{b(u?"refreshing":"pending"),v()}),!1),n.then((e=>C(n,e,void 0,t)),(e=>C(n,void 0,dt(e),t)))):(C(s,n,void 0,t),n)}return Object.defineProperties(x,{state:{get:()=>y()},error:{get:()=>p()},loading:{get(){const e=y();return"pending"===e||"refreshing"===e}},latest:{get(){if(!u)return x();const e=p();if(e&&!s)throw e;return f()}}}),d?Ke((()=>_(!1))):_(!1),[x,{refetch:_,mutate:g}]}function ze(e){return it(e,!1)}function Ze(e){if(null===Ne)return e();const t=Ne;Ne=null;try{return e()}finally{Ne=t}}function Ge(e){return null===$e||(null===$e.cleanups?$e.cleanups=[e]:$e.cleanups.push(e)),e}function Ye(){return Ne}function Qe(e,t){const n=Symbol("context");return{id:n,Provider:pt(n),defaultValue:e}}function Je(e){let t;return void 0!==(t=ft($e,e.id))?t:e.defaultValue}function Xe(e){const t=Fe(e),n=Fe((()=>gt(t())));return n.toArray=()=>{const e=n();return Array.isArray(e)?e:null!=e?[e]:[]},n}function et(){const e=Ie;if(this.sources&&(this.state||e))if(this.state===Ae||e)nt(this);else{const e=Ue;Ue=null,it((()=>lt(this)),!1),Ue=e}if(Ne){const e=this.observers?this.observers.length:0;Ne.sources?(Ne.sources.push(this),Ne.sourceSlots.push(e)):(Ne.sources=[this],Ne.sourceSlots=[e]),this.observers?(this.observers.push(Ne),this.observerSlots.push(Ne.sources.length-1)):(this.observers=[Ne],this.observerSlots=[Ne.sources.length-1])}return this.value}function tt(e,t,n){let r=e.value;return e.comparator&&e.comparator(r,t)||(e.value=t,e.observers&&e.observers.length&&it((()=>{for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t],r=Ie&&Ie.running;r&&Ie.disposed.has(n),(r&&!n.tState||!r&&!n.state)&&(n.pure?Ue.push(n):We.push(n),n.observers&&ct(n)),r||(n.state=Ae)}if(Ue.length>1e6)throw Ue=[],new Error}),!1)),t}function nt(e){if(!e.fn)return;ut(e);const t=$e,n=Ne,r=je;Ne=$e=e,function(e,t,n){let r;try{r=e.fn(t)}catch(o){e.pure&&(e.state=Ae,e.owned&&e.owned.forEach(ut),e.owned=null),ht(o)}(!e.updatedAt||e.updatedAt<=n)&&(null!=e.updatedAt&&"observers"in e?tt(e,r):e.value=r,e.updatedAt=n)}(e,e.value,r),Ne=n,$e=t}function rt(e,t,n,r=Ae,o){const i={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:$e,context:null,pure:n};return null===$e||$e!==Me&&($e.owned?$e.owned.push(i):$e.owned=[i]),i}function ot(e){const t=Ie;if(0===e.state||t)return;if(e.state===Te||t)return lt(e);if(e.suspense&&Ze(e.suspense.inFallback))return e.suspense.effects.push(e);const n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<je);)(e.state||t)&&n.push(e);for(let r=n.length-1;r>=0;r--)if((e=n[r]).state===Ae||t)nt(e);else if(e.state===Te||t){const t=Ue;Ue=null,it((()=>lt(e,n[0])),!1),Ue=t}}function it(e,t){if(Ue)return e();let n=!1;t||(Ue=[]),We?n=!0:We=[],je++;try{const t=e();return function(e){Ue&&(st(Ue),Ue=null);if(e)return;const t=We;We=null,t.length&&it((()=>Re(t)),!1)}(n),t}catch(r){n||(We=null),Ue=null,ht(r)}}function st(e){for(let t=0;t<e.length;t++)ot(e[t])}function at(e){let t,n=0;for(t=0;t<e.length;t++){const r=e[t];r.user?e[n++]=r:ot(r)}var r;for(ke.context&&(ke.context=r),t=0;t<n;t++)ot(e[t])}function lt(e,t){const n=Ie;e.state=0;for(let r=0;r<e.sources.length;r+=1){const o=e.sources[r];o.sources&&(o.state===Ae||n?o!==t&&ot(o):(o.state===Te||n)&<(o,t))}}function ct(e){const t=Ie;for(let n=0;n<e.observers.length;n+=1){const r=e.observers[n];r.state&&!t||(r.state=Te,r.pure?Ue.push(r):We.push(r),r.observers&&ct(r))}}function ut(e){let t;if(e.sources)for(;e.sources.length;){const t=e.sources.pop(),n=e.sourceSlots.pop(),r=t.observers;if(r&&r.length){const e=r.pop(),o=t.observerSlots.pop();n<r.length&&(e.sourceSlots[o]=n,r[n]=e,t.observerSlots[n]=o)}}if(e.owned){for(t=0;t<e.owned.length;t++)ut(e.owned[t]);e.owned=null}if(e.cleanups){for(t=0;t<e.cleanups.length;t++)e.cleanups[t]();e.cleanups=null}e.state=0,e.context=null}function dt(e){return e instanceof Error||"string"==typeof e?e:new Error("Unknown error")}function ht(e){throw e=dt(e)}function ft(e,t){return e?e.context&&void 0!==e.context[t]?e.context[t]:ft(e.owner,t):void 0}function gt(e){if("function"==typeof e&&!e.length)return gt(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const r=gt(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function pt(e,t){return function(t){let n;return Ve((()=>n=Ze((()=>($e.context={[e]:t.value},Xe((()=>t.children)))))),void 0),n}}const wt=Symbol("fallback");function mt(e){for(let t=0;t<e.length;t++)e[t]()}function vt(e,t){return Ze((()=>e(t||{})))}function yt(){return!0}const bt={get:(e,t,n)=>t===Se?n:e.get(t),has:(e,t)=>t===Se||e.has(t),set:yt,deleteProperty:yt,getOwnPropertyDescriptor:(e,t)=>({configurable:!0,enumerable:!0,get:()=>e.get(t),set:yt,deleteProperty:yt}),ownKeys:e=>e.keys()};function Ct(e){return(e="function"==typeof e?e():e)?e:{}}function xt(...e){let t=!1;for(let r=0;r<e.length;r++){const n=e[r];t=t||!!n&&Se in n,e[r]="function"==typeof n?(t=!0,Fe(n)):n}if(t)return new Proxy({get(t){for(let n=e.length-1;n>=0;n--){const r=Ct(e[n])[t];if(void 0!==r)return r}},has(t){for(let n=e.length-1;n>=0;n--)if(t in Ct(e[n]))return!0;return!1},keys(){const t=[];for(let n=0;n<e.length;n++)t.push(...Object.keys(Ct(e[n])));return[...new Set(t)]}},bt);const n={};for(let r=e.length-1;r>=0;r--)if(e[r]){const t=Object.getOwnPropertyDescriptors(e[r]);for(const r in t)r in n||Object.defineProperty(n,r,{enumerable:!0,get(){for(let t=e.length-1;t>=0;t--){const n=(e[t]||{})[r];if(void 0!==n)return n}}})}return n}function _t(e,...t){const n=new Set(t.flat());if(Se in e){const r=t.map((t=>new Proxy({get:n=>t.includes(n)?e[n]:void 0,has:n=>t.includes(n)&&n in e,keys:()=>t.filter((t=>t in e))},bt)));return r.push(new Proxy({get:t=>n.has(t)?void 0:e[t],has:t=>!n.has(t)&&t in e,keys:()=>Object.keys(e).filter((e=>!n.has(e)))},bt)),r}const r=Object.getOwnPropertyDescriptors(e);return t.push(Object.keys(r).filter((e=>!n.has(e)))),t.map((t=>{const n={};for(let o=0;o<t.length;o++){const i=t[o];i in e&&Object.defineProperty(n,i,r[i]?r[i]:{get:()=>e[i],set:()=>!0,enumerable:!0})}return n}))}function kt(e){const t="fallback"in e&&{fallback:()=>e.fallback};return Fe(function(e,t,n={}){let r=[],o=[],i=[],s=0,a=t.length>1?[]:null;return Ge((()=>mt(i))),()=>{let l,c,u=e()||[];return u[Ee],Ze((()=>{let e,t,h,f,g,p,w,m,v,y=u.length;if(0===y)0!==s&&(mt(i),i=[],r=[],o=[],s=0,a&&(a=[])),n.fallback&&(r=[wt],o[0]=Be((e=>(i[0]=e,n.fallback()))),s=1);else if(0===s){for(o=new Array(y),c=0;c<y;c++)r[c]=u[c],o[c]=Be(d);s=y}else{for(h=new Array(y),f=new Array(y),a&&(g=new Array(y)),p=0,w=Math.min(s,y);p<w&&r[p]===u[p];p++);for(w=s-1,m=y-1;w>=p&&m>=p&&r[w]===u[m];w--,m--)h[m]=o[w],f[m]=i[w],a&&(g[m]=a[w]);for(e=new Map,t=new Array(m+1),c=m;c>=p;c--)v=u[c],l=e.get(v),t[c]=void 0===l?-1:l,e.set(v,c);for(l=p;l<=w;l++)v=r[l],c=e.get(v),void 0!==c&&-1!==c?(h[c]=o[l],f[c]=i[l],a&&(g[c]=a[l]),c=t[c],e.set(v,c)):i[l]();for(c=p;c<y;c++)c in h?(o[c]=h[c],i[c]=f[c],a&&(a[c]=g[c],a[c](c))):o[c]=Be(d);o=o.slice(0,s=y),r=u.slice(0)}return o}));function d(e){if(i[c]=e,a){const[e,n]=He(c);return a[c]=n,t(u[c],e)}return t(u[c])}}}((()=>e.each),e.children,t||void 0))}function St(e){let t=!1;const n=e.keyed,r=Fe((()=>e.when),void 0,{equals:(e,n)=>t?e===n:!e==!n});return Fe((()=>{const o=r();if(o){const r=e.children,i="function"==typeof r&&r.length>0;return t=n||i,i?Ze((()=>r(o))):r}return e.fallback}),void 0,void 0)}function Et(e){let t=!1,n=!1;const r=Xe((()=>e.children)),o=Fe((()=>{let e=r();Array.isArray(e)||(e=[e]);for(let t=0;t<e.length;t++){const r=e[t].when;if(r)return n=!!e[t].keyed,[t,r,e[t]]}return[-1]}),void 0,{equals:(e,n)=>e[0]===n[0]&&(t?e[1]===n[1]:!e[1]==!n[1])&&e[2]===n[2]});return Fe((()=>{const[r,i,s]=o();if(r<0)return e.fallback;const a=s.children,l="function"==typeof a&&a.length>0;return t=n||l,l?Ze((()=>a(i))):a}),void 0,void 0)}function Lt(e){return e}const Rt=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline","allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"]),At=new Set(["innerHTML","textContent","innerText","children"]),Tt=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),Mt=Object.assign(Object.create(null),{class:"className",formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly"}),Ot=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),$t=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),Pt={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};const It="_$DX_DELEGATE";function Nt(e,t,n){const r=document.createElement("template");r.innerHTML=e;let o=r.content.firstChild;return n&&(o=o.firstChild),o}function Ut(e,t,n){null==n?e.removeAttribute(t):e.setAttribute(t,n)}function Wt(e,t){null==t?e.removeAttribute("class"):e.className=t}function jt(e,t={},n,r){const o={};return r||Ve((()=>o.children=qt(e,t.children,o.children))),Ve((()=>t.ref&&t.ref(e))),Ve((()=>function(e,t,n,r,o={},i=!1){t||(t={});for(const s in o)if(!(s in t)){if("children"===s)continue;o[s]=Dt(e,s,null,o[s],n,i)}for(const s in t){if("children"===s){r||qt(e,t.children);continue}const a=t[s];o[s]=Dt(e,s,a,o[s],n,i)}}(e,t,n,!0,o,!0))),o}function Bt(e,t,n){return Ze((()=>e(t,n)))}function Ht(e,t,n,r){if(void 0===n||r||(r=[]),"function"!=typeof t)return qt(e,t,r,n);Ve((r=>qt(e,t(),r,n)),r)}function Kt(e){let t,n;return ke.context&&(t=ke.registry.get(n=function(){const e=ke.context;return`${e.id}${e.count++}`}()))?(ke.completed&&ke.completed.add(t),ke.registry.delete(n),t):e.cloneNode(!0)}function Vt(e,t,n){const r=t.trim().split(/\s+/);for(let o=0,i=r.length;o<i;o++)e.classList.toggle(r[o],n)}function Dt(e,t,n,r,o,i){let s,a,l;if("style"===t)return function(e,t,n){if(!t)return n?Ut(e,"style"):t;const r=e.style;if("string"==typeof t)return r.cssText=t;let o,i;for(i in"string"==typeof n&&(r.cssText=n=void 0),n||(n={}),t||(t={}),n)null==t[i]&&r.removeProperty(i),delete n[i];for(i in t)o=t[i],o!==n[i]&&(r.setProperty(i,o),n[i]=o);return n}(e,n,r);if("classList"===t)return function(e,t,n={}){const r=Object.keys(t||{}),o=Object.keys(n);let i,s;for(i=0,s=o.length;i<s;i++){const r=o[i];r&&"undefined"!==r&&!t[r]&&(Vt(e,r,!1),delete n[r])}for(i=0,s=r.length;i<s;i++){const o=r[i],s=!!t[o];o&&"undefined"!==o&&n[o]!==s&&s&&(Vt(e,o,!0),n[o]=s)}return n}(e,n,r);if(n===r)return r;if("ref"===t)i||n(e);else if("on:"===t.slice(0,3)){const o=t.slice(3);r&&e.removeEventListener(o,r),n&&e.addEventListener(o,n)}else if("oncapture:"===t.slice(0,10)){const o=t.slice(10);r&&e.removeEventListener(o,r,!0),n&&e.addEventListener(o,n,!0)}else if("on"===t.slice(0,2)){const o=t.slice(2).toLowerCase(),i=Ot.has(o);if(!i&&r){const t=Array.isArray(r)?r[0]:r;e.removeEventListener(o,t)}(i||n)&&(function(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){const r=n[0];e.addEventListener(t,n[0]=t=>r.call(e,n[1],t))}else e.addEventListener(t,n)}(e,o,n,i),i&&function(e,t=window.document){const n=t[It]||(t[It]=new Set);for(let r=0,o=e.length;r<o;r++){const o=e[r];n.has(o)||(n.add(o),t.addEventListener(o,Ft))}}([o]))}else if((l=At.has(t))||!o&&(Mt[t]||(a=Rt.has(t)))||(s=e.nodeName.includes("-")))"class"===t||"className"===t?Wt(e,n):!s||a||l?e[Mt[t]||t]=n:e[(c=t,c.toLowerCase().replace(/-([a-z])/g,((e,t)=>t.toUpperCase())))]=n;else{const r=o&&t.indexOf(":")>-1&&Pt[t.split(":")[0]];r?function(e,t,n,r){null==r?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r)}(e,r,t,n):Ut(e,Tt[t]||t,n)}var c;return n}function Ft(e){const t=`$$${e.type}`;let n=e.composedPath&&e.composedPath()[0]||e.target;for(e.target!==n&&Object.defineProperty(e,"target",{configurable:!0,value:n}),Object.defineProperty(e,"currentTarget",{configurable:!0,get:()=>n||document}),ke.registry&&!ke.done&&(ke.done=!0,document.querySelectorAll("[id^=pl-]").forEach((t=>{for(;t&&8!==t.nodeType&&t.nodeValue!=="pl-"+e;){let e=t.nextSibling;t.remove(),t=e}t&&t.remove()})));n;){const r=n[t];if(r&&!n.disabled){const o=n[`${t}Data`];if(void 0!==o?r.call(n,o,e):r.call(n,e),e.cancelBubble)return}n=n._$host||n.parentNode||n.host}}function qt(e,t,n,r,o){for(ke.context&&!n&&(n=[...e.childNodes]);"function"==typeof n;)n=n();if(t===n)return n;const i=typeof t,s=void 0!==r;if(e=s&&n[0]&&n[0].parentNode||e,"string"===i||"number"===i){if(ke.context)return n;if("number"===i&&(t=t.toString()),s){let o=n[0];o&&3===o.nodeType?o.data=t:o=document.createTextNode(t),n=Gt(e,n,r,o)}else n=""!==n&&"string"==typeof n?e.firstChild.data=t:e.textContent=t}else if(null==t||"boolean"===i){if(ke.context)return n;n=Gt(e,n,r)}else{if("function"===i)return Ve((()=>{let o=t();for(;"function"==typeof o;)o=o();n=qt(e,o,n,r)})),()=>n;if(Array.isArray(t)){const i=[],a=n&&Array.isArray(n);if(zt(i,t,n,o))return Ve((()=>n=qt(e,i,n,r,!0))),()=>n;if(ke.context){if(!i.length)return n;for(let e=0;e<i.length;e++)if(i[e].parentNode)return n=i}if(0===i.length){if(n=Gt(e,n,r),s)return n}else a?0===n.length?Zt(e,i,r):function(e,t,n){let r=n.length,o=t.length,i=r,s=0,a=0,l=t[o-1].nextSibling,c=null;for(;s<o||a<i;)if(t[s]!==n[a]){for(;t[o-1]===n[i-1];)o--,i--;if(o===s){const t=i<r?a?n[a-1].nextSibling:n[i-a]:l;for(;a<i;)e.insertBefore(n[a++],t)}else if(i===a)for(;s<o;)c&&c.has(t[s])||t[s].remove(),s++;else if(t[s]===n[i-1]&&n[a]===t[o-1]){const r=t[--o].nextSibling;e.insertBefore(n[a++],t[s++].nextSibling),e.insertBefore(n[--i],r),t[o]=n[i]}else{if(!c){c=new Map;let e=a;for(;e<i;)c.set(n[e],e++)}const r=c.get(t[s]);if(null!=r)if(a<r&&r<i){let l,u=s,d=1;for(;++u<o&&u<i&&null!=(l=c.get(t[u]))&&l===r+d;)d++;if(d>r-a){const o=t[s];for(;a<r;)e.insertBefore(n[a++],o)}else e.replaceChild(n[a++],t[s++])}else s++;else t[s++].remove()}}else s++,a++}(e,n,i):(n&&Gt(e),Zt(e,i));n=i}else if(t instanceof Node){if(ke.context&&t.parentNode)return n=s?[t]:t;if(Array.isArray(n)){if(s)return n=Gt(e,n,r,t);Gt(e,n,null,t)}else null!=n&&""!==n&&e.firstChild?e.replaceChild(t,e.firstChild):e.appendChild(t);n=t}}return n}function zt(e,t,n,r){let o=!1;for(let i=0,s=t.length;i<s;i++){let s=t[i],a=n&&n[i];if(s instanceof Node)e.push(s);else if(null==s||!0===s||!1===s);else if(Array.isArray(s))o=zt(e,s,a)||o;else if("function"==typeof s)if(r){for(;"function"==typeof s;)s=s();o=zt(e,Array.isArray(s)?s:[s],Array.isArray(a)?a:[a])||o}else e.push(s),o=!0;else{const t=String(s);a&&3===a.nodeType&&a.data===t?e.push(a):e.push(document.createTextNode(t))}}return o}function Zt(e,t,n=null){for(let r=0,o=t.length;r<o;r++)e.insertBefore(t[r],n)}function Gt(e,t,n,r){if(void 0===n)return e.textContent="";const o=r||document.createTextNode("");if(t.length){let r=!1;for(let i=t.length-1;i>=0;i--){const s=t[i];if(o!==s){const t=s.parentNode===e;r||i?t&&s.remove():t?e.replaceChild(o,s):e.insertBefore(o,n)}else r=!0}}else e.insertBefore(o,n);return[o]}const Yt="http://www.w3.org/2000/svg";function Qt(e,t=!1){return t?document.createElementNS(Yt,e):document.createElement(e)}function Jt(e){const{useShadow:t}=e,n=document.createTextNode(""),r=e.mount||document.body;function o(){if(ke.context){const[t,n]=He(!1);return queueMicrotask((()=>n(!0))),()=>t()&&e.children}return()=>e.children}if(r instanceof HTMLHeadElement){const[e,t]=He(!1),n=()=>t(!0);Be((t=>Ht(r,(()=>e()?t():o()()),null))),Ge((()=>{ke.context?queueMicrotask(n):n()}))}else{const i=Qt(e.isSVG?"g":"div",e.isSVG),s=t&&i.attachShadow?i.attachShadow({mode:"open"}):i;Object.defineProperty(i,"_$host",{get:()=>n.parentNode,configurable:!0}),Ht(s,o()),r.appendChild(i),e.ref&&e.ref(i),Ge((()=>r.removeChild(i)))}return n}function Xt(e){const[t,n]=_t(e,["component"]),r=Fe((()=>t.component));return Fe((()=>{const e=r();switch(typeof e){case"function":return Ze((()=>e(n)));case"string":const t=$t.has(e),r=ke.context?Kt():Qt(e,t);return jt(r,n,t),r}}))}var en=(e=>(e.DARK="DARK",e.LIGHT="LIGHT",e))(en||{});let tn={data:""},nn=e=>"object"==typeof window?((e?e.querySelector("#_goober"):window._goober)||Object.assign((e||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:e||tn,rn=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,on=/\/\*[^]*?\*\/| +/g,sn=/\n+/g,an=(e,t)=>{let n="",r="",o="";for(let i in e){let s=e[i];"@"==i[0]?"i"==i[1]?n=i+" "+s+";":r+="f"==i[1]?an(s,i):i+"{"+an(s,"k"==i[1]?"":t)+"}":"object"==typeof s?r+=an(s,t?t.replace(/([^,])+/g,(e=>i.replace(/(^:.*)|([^,])+/g,(t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)))):i):null!=s&&(i=/^--/.test(i)?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),o+=an.p?an.p(i,s):i+":"+s+";")}return n+(t&&o?t+"{"+o+"}":o)+r},ln={},cn=e=>{if("object"==typeof e){let t="";for(let n in e)t+=n+cn(e[n]);return t}return e},un=(e,t,n,r,o)=>{let i=cn(e),s=ln[i]||(ln[i]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return"go"+n})(i));if(!ln[s]){let t=i!==e?e:(e=>{let t,n,r=[{}];for(;t=rn.exec(e.replace(on,""));)t[4]?r.shift():t[3]?(n=t[3].replace(sn," ").trim(),r.unshift(r[0][n]=r[0][n]||{})):r[0][t[1]]=t[2].replace(sn," ").trim();return r[0]})(e);ln[s]=an(o?{["@keyframes "+s]:t}:t,n?"":"."+s)}let a=n&&ln.g?ln.g:null;return n&&(ln.g=ln[s]),l=ln[s],c=t,u=r,(d=a)?c.data=c.data.replace(d,l):-1===c.data.indexOf(l)&&(c.data=u?l+c.data:c.data+l),s;var l,c,u,d},dn=(e,t,n)=>e.reduce(((e,r,o)=>{let i=t[o];if(i&&i.call){let e=i(n),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;i=t?"."+t:e&&"object"==typeof e?e.props?"":an(e,""):!1===e?"":e}return e+r+(null==i?"":i)}),"");function hn(e){let t=this||{},n=e.call?e(t.p):e;return un(n.unshift?n.raw?dn(n,[].slice.call(arguments,1),t.p):n.reduce(((e,n)=>Object.assign(e,n&&n.call?n(t.p):n)),{}):n,nn(t.target),t.g,t.o,t.k)}hn.bind({g:1});let fn=hn.bind({k:1});const gn=Qe();function pn(e){return vt(gn.Provider,{value:e.theme,get children(){return e.children}})}function wn(){return Je(gn)}function mn(e){let t=this||{};return(...n)=>{const r=r=>{const o=xt(r,{theme:Je(gn)}),i=xt(o,{get class(){const e=o.class,r="class"in o&&/^go[0-9]+/.test(e);return[e,hn.apply({target:t.target,o:r,p:o,g:t.g},n)].filter(Boolean).join(" ")}}),[s,a]=_t(i,["as","theme"]),l=a,c=s.as||e;let u;return"function"==typeof c?u=c(l):1==t.g?(u=document.createElement(c),jt(u,l)):u=Xt(xt({component:c},l)),u};return r.class=e=>Ze((()=>hn.apply({target:t.target,p:e,g:t.g},n))),r}}const vn=new Proxy(mn,{get:(e,t)=>e(t)});function yn(){const e=mn.call({g:1},"div").apply(null,arguments);return function(t){return e(t),null}}const bn="tc-root",Cn="tc-disable-scroll",xn="tc-using-mouse",_n=()=>{document.body.addEventListener("mousedown",(()=>document.body.classList.add(xn))),document.body.addEventListener("keydown",(e=>{"Tab"===e.key&&document.body.classList.remove(xn)}));return vt(yn`
|
|
2
2
|
${bn} * {
|
|
3
3
|
margin: 0;
|
|
4
4
|
padding: 0;
|
|
@@ -915,7 +915,7 @@ var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnP
|
|
|
915
915
|
padding: 0 64px;
|
|
916
916
|
`,zl=vn.div`
|
|
917
917
|
padding: 0 24px 24px;
|
|
918
|
-
`,Zl=e=>[vt(Fl,{translationKey:"walletModal.mobileUniversalModal.connectYourWallet",children:"Connect your wallet"}),vt(ql,{translationKey:"walletModal.mobileUniversalModal.scan",children:"Scan with your mobile wallet"}),vt(zl,{get children(){return vt(Ao,{get imageUrl(){return Qi},get sourceUrl(){return Tn(e.universalLink,"none")},disableCopy:!0})}})],Gl=Nt("<li></li>"),Yl=Nt('<div data-tc-wallets-modal-universal-mobile="true"></div>'),Ql=e=>{const[t,n]=He(!1),r=Aa.connector,o=()=>e.walletsList.filter((e=>Pa(e)&&e.appName!==Yi)),i=()=>o().length>7,s=Fe((()=>r.connect(e.walletsList.filter(fe).map((e=>({bridgeUrl:e
|
|
918
|
+
`,Zl=e=>[vt(Fl,{translationKey:"walletModal.mobileUniversalModal.connectYourWallet",children:"Connect your wallet"}),vt(ql,{translationKey:"walletModal.mobileUniversalModal.scan",children:"Scan with your mobile wallet"}),vt(zl,{get children(){return vt(Ao,{get imageUrl(){return Qi},get sourceUrl(){return Tn(e.universalLink,"none")},disableCopy:!0})}})],Gl=Nt("<li></li>"),Yl=Nt('<div data-tc-wallets-modal-universal-mobile="true"></div>'),Ql=e=>{const[t,n]=He(!1),r=Aa.connector,o=()=>e.walletsList.filter((e=>Pa(e)&&e.appName!==Yi)),i=()=>o().length>7,s=Fe((()=>r.connect([...new Set(e.walletsList.filter(fe).map((e=>e.bridgeUrl))).values()].map((e=>({bridgeUrl:e}))),e.additionalRequest)));Kn({openMethod:"universal-link"});const[a,l]=He(void 0),c=()=>__async(this,null,(function*(){void 0!==a()&&clearTimeout(a()),yield Lo(s());const e=setTimeout((()=>l(void 0)),1500);l(e)})),u=()=>{An(Tn(s(),Aa.returnStrategy))},d=()=>{const t=e.walletsList.find((e=>e.appName===Yi));if(!t||!fe(t))throw new En("@wallet bot not found in the wallets list");An(Tn(r.connect({bridgeUrl:t.bridgeUrl,universalLink:t.universalLink},e.additionalRequest),{returnStrategy:Aa.returnStrategy,twaReturnUrl:Aa.twaReturnUrl}))},h=()=>{n(!0),Kn({openMethod:"qrcode"})},f=()=>{n(!1),Kn({openMethod:"universal-link"})};return(()=>{const n=Yl.cloneNode(!0);return Ht(n,vt(St,{get when(){return t()},get children(){return[vt(Dl,{icon:"arrow",onClick:f}),vt(Zl,{get universalLink(){return s()}})]}}),null),Ht(n,vt(St,{get when(){return!t()},get children(){return[vt(Dl,{get icon(){return vt(Di,{})},onClick:h}),vt(Bl,{translationKey:"walletModal.mobileUniversalModal.connectYourWallet",children:"Connect your wallet"}),vt(Hl,{translationKey:"walletModal.mobileUniversalModal.openWalletOnTelegramOrSelect",children:"Open Wallet on Telegram or select your wallet to connect"}),vt(Kl,{get leftIcon(){return vt(Wi,{})},get rightIcon(){return vt(Vl,{get src(){return Ji}})},onClick:d,scale:"s",get children(){return vt(sl,{translationKey:"walletModal.mobileUniversalModal.openWalletOnTelegram",children:"Open Wallet on Telegram"})}}),vt(Nl,{get children(){return[vt(kt,{get each(){return Fe((()=>!!i()))()?o().slice(0,4):o()},children:t=>(()=>{const n=Gl.cloneNode(!0);return Ht(n,vt(qo,{get icon(){return t.imageUrl},get name(){return t.name},onClick:()=>e.onSelect(t)})),n})()}),vt(St,{get when(){return i()},get children(){const t=Gl.cloneNode(!0);return Ht(t,vt(Gi,{labelLine1:"View all",labelLine2:"wallets",get images(){return o().slice(3,7).map((e=>e.imageUrl))},onClick:()=>e.onSelectAllWallets()})),t}}),vt(Wl,{children:" "}),vt(Ul,{onClick:u,get children(){return[vt(jl,{get children(){return vt(ei,{})}}),vt(Io,{fontWeight:590,translationKey:"walletModal.mobileUniversalModal.openLink",children:"Open Link"})]}}),vt(Ul,{onClick:c,get children(){return[vt(jl,{get children(){return Fe((()=>void 0!==a()))()?vt(Bi,{}):vt(Ki,{})}}),vt(Io,{fontWeight:590,get translationKey(){return void 0!==a()?"common.copied":"common.copyLink"},get children(){return void 0!==a()?"Copied":"Copy Link"}})]}})]}})]}}),null),n})()},Jl={m:"16px",s:"8px",none:"0"},Xl={m:"8px",s:"4px",none:"0"},ec=vn.div`
|
|
919
919
|
display: flex;
|
|
920
920
|
flex-direction: column;
|
|
921
921
|
align-items: center;
|
|
@@ -996,7 +996,7 @@ var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnP
|
|
|
996
996
|
`,vn(Io)`
|
|
997
997
|
color: ${e=>e.theme.colors.text.secondary};
|
|
998
998
|
font-size: 16px;
|
|
999
|
-
`;const ic=Nt("<li></li>"),sc=e=>{const[t,n]=He(!1),r=Aa.connector
|
|
999
|
+
`;const ic=Nt("<li></li>"),sc=e=>{const[t,n]=He(!1),r=Aa.connector;Kn({openMethod:"qrcode"});const o=Fe((()=>r.connect([...new Set(e.walletsList.filter(fe).map((e=>e.bridgeUrl))).values()].map((e=>({bridgeUrl:e}))),e.additionalRequest)));return vt(ec,{onClick:()=>n(!1),"data-tc-wallets-modal-universal-desktop":"true",get children(){return[vt(Zo,{translationKey:"walletModal.desktopUniversalModal.connectYourWallet",children:"Connect your wallet"}),vt(tc,{translationKey:"walletModal.desktopUniversalModal.scan",children:"Scan with your mobile wallet"}),vt(rc,{get sourceUrl(){return Tn(o(),"none")},get disableCopy(){return t()},get imageUrl(){return Qi}}),vt(nc,{translationKey:"walletModal.desktopUniversalModal.availableWallets",children:"Available wallets"}),vt(oc,{get children(){return[vt(kt,{get each(){return e.walletsList.slice(0,3)},children:t=>(()=>{const n=ic.cloneNode(!0);return Ht(n,vt(Xi,{wallet:t,onClick:()=>e.onSelect(t)})),n})()}),vt(Gi,{labelLine1:"View all",labelLine2:"wallets",get images(){return e.walletsList.slice(3,7).map((e=>e.imageUrl))},onClick:()=>e.onSelectAllWallets()})]}})]}})},ac=()=>{const{locale:e}=$o()[1];De((()=>e(Aa.language)));const t=Je(Zn),n=Je(cs),[r]=qe((()=>n.getWallets())),[o,i]=He(null),[s,a]=He("universal"),[l,c]=He(!1),u=Fe((()=>{if("ready"!==r.state)return null;let e=Oa(r(),Aa.walletsListConfiguration);const t=e.filter(ue),n=e.filter((e=>!ue(e)));e=(t||[]).concat(n);const o=Aa.preferredWalletAppName,i=e.find((e=>Na(e,o))),s=e.filter((e=>Na(e,o))).length>=2;o&&i&&!s&&(e=[__spreadProps(__spreadValues({},i),{isPreferred:!0})].concat(e.filter((e=>!Na(e,o)))));const a=e.find((e=>Na(e,Yi)));return a&&(e=[a].concat(e.filter((e=>!Na(e,Yi))))),e})),d=()=>{var e;return"loading"===(null==(e=Aa.connectRequestParameters)?void 0:e.state)},h=Fe((()=>{var e;if(!d())return null==(e=Aa.connectRequestParameters)?void 0:e.value})),f=()=>{Wn(!1),i(null),c(!1)};return Ge(t.onStatusChange((e=>{e&&f()}))),vt(Ea,{get opened(){return Un()},onClose:f,onClickQuestion:()=>c((e=>!e)),"data-tc-wallets-modal-container":"true",get children(){return[vt(St,{get when(){return l()},get children(){return vt(ml,{onBackClick:()=>c(!1)})}}),vt(St,{get when(){return!l()},get children(){return[vt(St,{get when(){return d()||!u()},get children(){return[vt(La,{translationKey:"walletModal.loading",children:"Wallets list is loading"}),vt(Ra,{get children(){return vt(gi,{size:"m"})}})]}}),vt(St,{get when(){return Fe((()=>!d()))()&&u()},get children(){return vt(Et,{get children(){return[vt(Lt,{get when(){return o()},get children(){return vt(Xt,{get component(){return os()?$l:al},get wallet(){return o()},get additionalRequest(){return h()},onBackClick:()=>i(null)})}}),vt(Lt,{get when(){return"universal"===s()},get children(){return vt(Xt,{get component(){return os()?Ql:sc},onSelect:i,get walletsList(){return u()},get additionalRequest(){return h()},onSelectAllWallets:()=>a("all-wallets")})}}),vt(Lt,{get when(){return"all-wallets"===s()},get children(){return vt(Va,{get walletsList(){return u()},onBack:()=>a("universal"),onSelect:i})}})]}})}})]}})]}})},lc=vn.div`
|
|
1000
1000
|
display: flex;
|
|
1001
1001
|
flex-direction: column;
|
|
1002
1002
|
align-items: center;
|