@tonconnect/ui 2.0.4 → 2.0.6

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.
@@ -596,7 +596,7 @@ var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnP
596
596
  > div:first-child {
597
597
  margin-top: 20px;
598
598
  }
599
- `;function Ya(e){return e.split("-")[0]}function Qa(e,t,n){let{reference:r,floating:o}=e;const i=r.x+r.width/2-o.width/2,s=r.y+r.height/2-o.height/2,a=function(e){return["top","bottom"].includes(Ya(e))?"x":"y"}(t),l="y"===a?"height":"width";const c=r[l]/2-o[l]/2,u="x"===a;let d;switch(Ya(t)){case"top":d={x:i,y:r.y-o.height};break;case"bottom":d={x:i,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:s};break;case"left":d={x:r.x-o.width,y:s};break;default:d={x:r.x,y:r.y}}switch(function(e){return e.split("-")[1]}(t)){case"start":d[a]-=c*(n&&u?-1:1);break;case"end":d[a]+=c*(n&&u?-1:1)}return d}const Ja=(e,t,n)=>__async(this,null,(function*(){const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=yield null==s.isRTL?void 0:s.isRTL(t);if("production"!==process.env.NODE_ENV){if(null==s&&console.error(["Floating UI: `platform` property was not passed to config. If you","want to use Floating UI on the web, install @floating-ui/dom","instead of the /core package. Otherwise, you can create your own","`platform`: https://floating-ui.com/docs/platform"].join(" ")),a.filter((e=>{let{name:t}=e;return"autoPlacement"===t||"flip"===t})).length>1)throw new Error(["Floating UI: duplicate `flip` and/or `autoPlacement` middleware","detected. This will lead to an infinite loop. Ensure only one of","either has been passed to the `middleware` array."].join(" "));e&&t||console.error(["Floating UI: The reference and/or floating element was not defined","when `computePosition()` was called. Ensure that both elements have","been created and can be measured."].join(" "))}let c=yield s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=Qa(c,r,l),h=r,f={},g=0;for(let n=0;n<a.length;n++){const{name:i,fn:p}=a[n],{x:w,y:m,data:v,reset:y}=yield p({x:u,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:f,rects:c,platform:s,elements:{reference:e,floating:t}});u=null!=w?w:u,d=null!=m?m:d,f=__spreadProps(__spreadValues({},f),{[i]:__spreadValues(__spreadValues({},f[i]),v)}),"production"!==process.env.NODE_ENV&&g>50&&console.warn(["Floating UI: The middleware lifecycle appears to be running in an","infinite loop. This is usually caused by a `reset` continually","being returned without a break condition."].join(" ")),y&&g<=50&&(g++,"object"==typeof y&&(y.placement&&(h=y.placement),y.rects&&(c=!0===y.rects?yield s.getElementRects({reference:e,floating:t,strategy:o}):y.rects),({x:u,y:d}=Qa(c,h,l))),n=-1)}return{x:u,y:d,placement:h,strategy:o,middlewareData:f}}));function Xa(e){return __spreadProps(__spreadValues({},e),{top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height})}function el(e){var t;return(null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function tl(e){return el(e).getComputedStyle(e)}function nl(e){return al(e)?(e.nodeName||"").toLowerCase():""}let rl;function ol(){if(rl)return rl;const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?(rl=e.brands.map((e=>e.brand+"/"+e.version)).join(" "),rl):navigator.userAgent}function il(e){return e instanceof el(e).HTMLElement}function sl(e){return e instanceof el(e).Element}function al(e){return e instanceof el(e).Node}function ll(e){if("undefined"==typeof ShadowRoot)return!1;return e instanceof el(e).ShadowRoot||e instanceof ShadowRoot}function cl(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=tl(e);return/auto|scroll|overlay|hidden/.test(t+r+n)&&!["inline","contents"].includes(o)}function ul(e){return["table","td","th"].includes(nl(e))}function dl(e){const t=/firefox/i.test(ol()),n=tl(e),r=n.backdropFilter||n.WebkitBackdropFilter;return"none"!==n.transform||"none"!==n.perspective||!!r&&"none"!==r||t&&"filter"===n.willChange||t&&!!n.filter&&"none"!==n.filter||["transform","perspective"].some((e=>n.willChange.includes(e)))||["paint","layout","strict","content"].some((e=>{const t=n.contain;return null!=t&&t.includes(e)}))}function hl(){return!/^((?!chrome|android).)*safari/i.test(ol())}function fl(e){return["html","body","#document"].includes(nl(e))}const gl=Math.min,pl=Math.max,wl=Math.round,ml={x:1,y:1};function vl(e){const t=!sl(e)&&e.contextElement?e.contextElement:sl(e)?e:null;if(!t)return ml;const n=t.getBoundingClientRect(),r=tl(t);if("border-box"!==r.boxSizing)return il(t)?{x:t.offsetWidth>0&&wl(n.width)/t.offsetWidth||1,y:t.offsetHeight>0&&wl(n.height)/t.offsetHeight||1}:ml;let o=n.width/parseFloat(r.width),i=n.height/parseFloat(r.height);return o&&Number.isFinite(o)||(o=1),i&&Number.isFinite(i)||(i=1),{x:o,y:i}}function yl(e,t,n,r){var o,i,s,a;void 0===t&&(t=!1),void 0===n&&(n=!1);const l=e.getBoundingClientRect();let c=ml;t&&(r?sl(r)&&(c=vl(r)):c=vl(e));const u=sl(e)?el(e):window,d=!hl()&&n,h=(l.left+(d&&null!=(o=null==(i=u.visualViewport)?void 0:i.offsetLeft)?o:0))/c.x,f=(l.top+(d&&null!=(s=null==(a=u.visualViewport)?void 0:a.offsetTop)?s:0))/c.y,g=l.width/c.x,p=l.height/c.y;return{width:g,height:p,top:f,right:h+g,bottom:f+p,left:h,x:h,y:f}}function bl(e){return((al(e)?e.ownerDocument:e.document)||window.document).documentElement}function Cl(e){return sl(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function xl(e){return yl(bl(e)).left+Cl(e).scrollLeft}function _l(e,t,n){const r=il(t),o=bl(t),i=yl(e,!0,"fixed"===n,t);let s={scrollLeft:0,scrollTop:0};const a={x:0,y:0};if(r||!r&&"fixed"!==n)if(("body"!==nl(t)||cl(o))&&(s=Cl(t)),il(t)){const e=yl(t,!0);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else o&&(a.x=xl(o));return{x:i.left+s.scrollLeft-a.x,y:i.top+s.scrollTop-a.y,width:i.width,height:i.height}}function kl(e){if("html"===nl(e))return e;const t=e.assignedSlot||e.parentNode||(ll(e)?e.host:null)||bl(e);return ll(t)?t.host:t}function Sl(e){return il(e)&&"fixed"!==tl(e).position?e.offsetParent:null}function El(e){const t=el(e);let n=Sl(e);for(;n&&ul(n)&&"static"===tl(n).position;)n=Sl(n);return n&&("html"===nl(n)||"body"===nl(n)&&"static"===tl(n).position&&!dl(n))?t:n||function(e){let t=kl(e);for(;il(t)&&!fl(t);){if(dl(t))return t;t=kl(t)}return null}(e)||t}function Rl(e){const t=kl(e);return fl(t)?e.ownerDocument.body:il(t)&&cl(t)?t:Rl(t)}function Tl(e,t){var n;void 0===t&&(t=[]);const r=Rl(e),o=r===(null==(n=e.ownerDocument)?void 0:n.body),i=el(r);return o?t.concat(i,i.visualViewport||[],cl(r)?r:[]):t.concat(r,Tl(r))}function Ll(e,t,n){return"viewport"===t?Xa(function(e,t){const n=el(e),r=bl(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const e=hl();(e||!e&&"fixed"===t)&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}(e,n)):sl(t)?function(e,t){const n=yl(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=il(e)?vl(e):{x:1,y:1},s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{top:c,left:l,right:l+s,bottom:c+a,x:l,y:c,width:s,height:a}}(t,n):Xa(function(e){var t;const n=bl(e),r=Cl(e),o=null==(t=e.ownerDocument)?void 0:t.body,i=pl(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),s=pl(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0);let a=-r.scrollLeft+xl(e);const l=-r.scrollTop;return"rtl"===tl(o||n).direction&&(a+=pl(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:s,x:a,y:l}}(bl(e)))}const Al={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let r=Tl(e).filter((e=>sl(e)&&"body"!==nl(e))),o=null;const i="fixed"===tl(e).position;let s=i?kl(e):e;for(;sl(s)&&!fl(s);){const e=tl(s),t=dl(s);(i?t||o:t||"static"!==e.position||!o||!["absolute","fixed"].includes(o.position))?o=e:r=r.filter((e=>e!==s)),s=kl(s)}return t.set(e,r),r}(t,this._c):[].concat(n),r],s=i[0],a=i.reduce(((e,n)=>{const r=Ll(t,n,o);return e.top=pl(r.top,e.top),e.right=gl(r.right,e.right),e.bottom=gl(r.bottom,e.bottom),e.left=pl(r.left,e.left),e}),Ll(t,s,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=il(n),i=bl(n);if(n===i)return t;let s={scrollLeft:0,scrollTop:0},a={x:1,y:1};const l={x:0,y:0};if((o||!o&&"fixed"!==r)&&(("body"!==nl(n)||cl(i))&&(s=Cl(n)),il(n))){const e=yl(n);a=vl(n),l.x=e.x+n.clientLeft,l.y=e.y+n.clientTop}return{width:t.width*a.x,height:t.height*a.y,x:t.x*a.x-s.scrollLeft*a.x+l.x,y:t.y*a.y-s.scrollTop*a.y+l.y}},isElement:sl,getDimensions:function(e){if(il(e))return{width:e.offsetWidth,height:e.offsetHeight};const t=yl(e);return{width:t.width,height:t.height}},getOffsetParent:El,getDocumentElement:bl,getScale:vl,getElementRects(e){return __async(this,null,(function*(){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||El,i=this.getDimensions;return{reference:_l(t,yield o(n),r),floating:__spreadValues({x:0,y:0},yield i(n))}}))},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>"rtl"===tl(e).direction};function Ol(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=!0,animationFrame:a=!1}=r,l=o&&!a,c=l||i?[...sl(e)?Tl(e):e.contextElement?Tl(e.contextElement):[],...Tl(t)]:[];c.forEach((e=>{l&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));let u,d=null;if(s){let r=!0;d=new ResizeObserver((()=>{r||n(),r=!1})),sl(e)&&!a&&d.observe(e),sl(e)||!e.contextElement||a||d.observe(e.contextElement),d.observe(t)}let h=a?yl(e):null;return a&&function t(){const r=yl(e);!h||r.x===h.x&&r.y===h.y&&r.width===h.width&&r.height===h.height||n();h=r,u=requestAnimationFrame(t)}(),n(),()=>{var e;c.forEach((e=>{l&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==(e=d)||e.disconnect(),d=null,a&&cancelAnimationFrame(u)}}const Ml=(e,t,n)=>{const r=new Map,o=__spreadValues({platform:Al},n),i=__spreadProps(__spreadValues({},o.platform),{_c:r});return Ja(e,t,__spreadProps(__spreadValues({},o),{platform:i}))};const Nl=un('<tc-root data-tc-dropdown-container="true"></tc-root>'),Pl=()=>{const t=Vn(),n=St($r),r=St(ga),[o,i]=gt(!1),[s,a]=gt(n.account),[l,c]=gt(!n.account);let u;const[d,h]=gt(),[f,g]=gt(),p=function(e,t,n){let r=()=>{var e;return null!=(e=null==n?void 0:n.placement)?e:"bottom"},o=()=>{var e;return null!=(e=null==n?void 0:n.strategy)?e:"absolute"},[i,s]=gt({x:null,y:null,placement:r(),strategy:o(),middlewareData:{}}),[a,l]=gt();mt((()=>{let e=a();if(e)throw e.value}));let c=vt((()=>(e(),t(),{})));function u(){let i=e(),a=t();if(i&&a){let e=c();Ml(i,a,{middleware:null==n?void 0:n.middleware,placement:r(),strategy:o()}).then((t=>{e===c()&&s(t)}),(e=>{l(e)}))}}return mt((()=>{let i=e(),s=t();if(null==n||n.middleware,r(),o(),i&&s)if(null!=n&&n.whileElementsMounted){let e=n.whileElementsMounted(i,s,u);e&&xt(e)}else u()})),{get x(){return i().x},get y(){return i().y},get placement(){return i().placement},get strategy(){return i().strategy},get middlewareData(){return i().middlewareData},update:u}}(f,d,{whileElementsMounted:Ol,placement:"bottom-end"});r.connectionRestored.then((()=>c(!1)));const w=n.onStatusChange((e=>{if(!e)return i(!1),a(null),void c(!1);a(e.account),c(!1)})),m=e=>{if(!s()||!o())return;const t=f().contains(e.target),n=u.contains(e.target);t||n||i(!1)};var v;return v=()=>{document.body.addEventListener("click",m)},mt((()=>Ct(v))),xt((()=>{document.body.removeEventListener("click",m),w()})),Ft(Rn,{component:zn,get children(){return[Ft(Jt,{get when(){return l()},get children(){return Ft(Fa,{disabled:!0,"data-tc-connect-button-loading":"true",get children(){return Ft(qa,{})}})}}),Ft(Jt,{get when(){return!l()},get children(){return[Ft(Jt,{get when(){return!s()},get children(){return Ft(Va,{onClick:()=>r.openModal(),"data-tc-connect-button":"true",scale:"s",get children(){return[Ft(ss,{get fill(){return t.colors.connectButton.foreground}}),Ft(ji,{translationKey:"button.connectWallet",fontSize:"15px",lineHeight:"18px",fontWeight:"590",get color(){return t.colors.connectButton.foreground},children:"Connect wallet"})]}})}}),Ft(Jt,{get when(){return s()},get children(){return Ft(za,{get children(){return[Ft(Ka,{onClick:()=>i((e=>!e)),ref:g,"data-tc-dropdown-button":"true",scale:"s",get children(){return[Ft(ji,{fontSize:"15px",fontWeight:"590",lineHeight:"18px",get children(){return(()=>{const t=s();if(t){const n=Ze(t.address,t.chain===e.CHAIN.TESTNET);return n.slice(0,4)+"…"+n.slice(-4)}return""})()}}),Ft(Zo,{direction:"bottom"})]}}),Ft(En,{get children(){const e=Ct((()=>document.importNode(Nl,!0)));return gn(h,e),e.style.setProperty("z-index","999"),e._$owner=st,pn(e,Ft(Do,{onBeforeEnter:e=>{ci(e,[{opacity:0,transform:"translateY(-8px)"},{opacity:1,transform:"translateY(0)"}],{duration:150})},onExit:(e,t)=>{ci(e,[{opacity:1,transform:"translateY(0)"},{opacity:0,transform:"translateY(-8px)"}],{duration:150}).finished.then(t)},get children(){return Ft(Jt,{get when(){return o()},get children(){return Ft(Za,{get hidden(){return!o()},onClose:()=>i(!1),ref(e){"function"==typeof u?u(e):u=e}})}})}}),null),pn(e,Ft(Ga,{}),null),wt((t=>{var n,r;const o=p.strategy,i=`${null!=(n=p.y)?n:0}px`,s=`${null!=(r=p.x)?r:0}px`;return o!==t._v$&&e.style.setProperty("position",t._v$=o),i!==t._v$2&&e.style.setProperty("top",t._v$2=i),s!==t._v$3&&e.style.setProperty("left",t._v$3=s),t}),{_v$:void 0,_v$2:void 0,_v$3:void 0}),e}})]}})}})]}})]}})},$l=Fn(gi)`
599
+ `;function Ya(e){return e.split("-")[0]}function Qa(e,t,n){let{reference:r,floating:o}=e;const i=r.x+r.width/2-o.width/2,s=r.y+r.height/2-o.height/2,a=function(e){return["top","bottom"].includes(Ya(e))?"x":"y"}(t),l="y"===a?"height":"width";const c=r[l]/2-o[l]/2,u="x"===a;let d;switch(Ya(t)){case"top":d={x:i,y:r.y-o.height};break;case"bottom":d={x:i,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:s};break;case"left":d={x:r.x-o.width,y:s};break;default:d={x:r.x,y:r.y}}switch(function(e){return e.split("-")[1]}(t)){case"start":d[a]-=c*(n&&u?-1:1);break;case"end":d[a]+=c*(n&&u?-1:1)}return d}const Ja=(e,t,n)=>__async(this,null,(function*(){const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=yield null==s.isRTL?void 0:s.isRTL(t);if("production"!=={}.NODE_ENV){if(null==s&&console.error(["Floating UI: `platform` property was not passed to config. If you","want to use Floating UI on the web, install @floating-ui/dom","instead of the /core package. Otherwise, you can create your own","`platform`: https://floating-ui.com/docs/platform"].join(" ")),a.filter((e=>{let{name:t}=e;return"autoPlacement"===t||"flip"===t})).length>1)throw new Error(["Floating UI: duplicate `flip` and/or `autoPlacement` middleware","detected. This will lead to an infinite loop. Ensure only one of","either has been passed to the `middleware` array."].join(" "));e&&t||console.error(["Floating UI: The reference and/or floating element was not defined","when `computePosition()` was called. Ensure that both elements have","been created and can be measured."].join(" "))}let c=yield s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=Qa(c,r,l),h=r,f={},g=0;for(let n=0;n<a.length;n++){const{name:i,fn:p}=a[n],{x:w,y:m,data:v,reset:y}=yield p({x:u,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:f,rects:c,platform:s,elements:{reference:e,floating:t}});u=null!=w?w:u,d=null!=m?m:d,f=__spreadProps(__spreadValues({},f),{[i]:__spreadValues(__spreadValues({},f[i]),v)}),"production"!=={}.NODE_ENV&&g>50&&console.warn(["Floating UI: The middleware lifecycle appears to be running in an","infinite loop. This is usually caused by a `reset` continually","being returned without a break condition."].join(" ")),y&&g<=50&&(g++,"object"==typeof y&&(y.placement&&(h=y.placement),y.rects&&(c=!0===y.rects?yield s.getElementRects({reference:e,floating:t,strategy:o}):y.rects),({x:u,y:d}=Qa(c,h,l))),n=-1)}return{x:u,y:d,placement:h,strategy:o,middlewareData:f}}));function Xa(e){return __spreadProps(__spreadValues({},e),{top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height})}function el(e){var t;return(null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function tl(e){return el(e).getComputedStyle(e)}function nl(e){return al(e)?(e.nodeName||"").toLowerCase():""}let rl;function ol(){if(rl)return rl;const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?(rl=e.brands.map((e=>e.brand+"/"+e.version)).join(" "),rl):navigator.userAgent}function il(e){return e instanceof el(e).HTMLElement}function sl(e){return e instanceof el(e).Element}function al(e){return e instanceof el(e).Node}function ll(e){if("undefined"==typeof ShadowRoot)return!1;return e instanceof el(e).ShadowRoot||e instanceof ShadowRoot}function cl(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=tl(e);return/auto|scroll|overlay|hidden/.test(t+r+n)&&!["inline","contents"].includes(o)}function ul(e){return["table","td","th"].includes(nl(e))}function dl(e){const t=/firefox/i.test(ol()),n=tl(e),r=n.backdropFilter||n.WebkitBackdropFilter;return"none"!==n.transform||"none"!==n.perspective||!!r&&"none"!==r||t&&"filter"===n.willChange||t&&!!n.filter&&"none"!==n.filter||["transform","perspective"].some((e=>n.willChange.includes(e)))||["paint","layout","strict","content"].some((e=>{const t=n.contain;return null!=t&&t.includes(e)}))}function hl(){return!/^((?!chrome|android).)*safari/i.test(ol())}function fl(e){return["html","body","#document"].includes(nl(e))}const gl=Math.min,pl=Math.max,wl=Math.round,ml={x:1,y:1};function vl(e){const t=!sl(e)&&e.contextElement?e.contextElement:sl(e)?e:null;if(!t)return ml;const n=t.getBoundingClientRect(),r=tl(t);if("border-box"!==r.boxSizing)return il(t)?{x:t.offsetWidth>0&&wl(n.width)/t.offsetWidth||1,y:t.offsetHeight>0&&wl(n.height)/t.offsetHeight||1}:ml;let o=n.width/parseFloat(r.width),i=n.height/parseFloat(r.height);return o&&Number.isFinite(o)||(o=1),i&&Number.isFinite(i)||(i=1),{x:o,y:i}}function yl(e,t,n,r){var o,i,s,a;void 0===t&&(t=!1),void 0===n&&(n=!1);const l=e.getBoundingClientRect();let c=ml;t&&(r?sl(r)&&(c=vl(r)):c=vl(e));const u=sl(e)?el(e):window,d=!hl()&&n,h=(l.left+(d&&null!=(o=null==(i=u.visualViewport)?void 0:i.offsetLeft)?o:0))/c.x,f=(l.top+(d&&null!=(s=null==(a=u.visualViewport)?void 0:a.offsetTop)?s:0))/c.y,g=l.width/c.x,p=l.height/c.y;return{width:g,height:p,top:f,right:h+g,bottom:f+p,left:h,x:h,y:f}}function bl(e){return((al(e)?e.ownerDocument:e.document)||window.document).documentElement}function Cl(e){return sl(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function xl(e){return yl(bl(e)).left+Cl(e).scrollLeft}function _l(e,t,n){const r=il(t),o=bl(t),i=yl(e,!0,"fixed"===n,t);let s={scrollLeft:0,scrollTop:0};const a={x:0,y:0};if(r||!r&&"fixed"!==n)if(("body"!==nl(t)||cl(o))&&(s=Cl(t)),il(t)){const e=yl(t,!0);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else o&&(a.x=xl(o));return{x:i.left+s.scrollLeft-a.x,y:i.top+s.scrollTop-a.y,width:i.width,height:i.height}}function kl(e){if("html"===nl(e))return e;const t=e.assignedSlot||e.parentNode||(ll(e)?e.host:null)||bl(e);return ll(t)?t.host:t}function Sl(e){return il(e)&&"fixed"!==tl(e).position?e.offsetParent:null}function El(e){const t=el(e);let n=Sl(e);for(;n&&ul(n)&&"static"===tl(n).position;)n=Sl(n);return n&&("html"===nl(n)||"body"===nl(n)&&"static"===tl(n).position&&!dl(n))?t:n||function(e){let t=kl(e);for(;il(t)&&!fl(t);){if(dl(t))return t;t=kl(t)}return null}(e)||t}function Rl(e){const t=kl(e);return fl(t)?e.ownerDocument.body:il(t)&&cl(t)?t:Rl(t)}function Tl(e,t){var n;void 0===t&&(t=[]);const r=Rl(e),o=r===(null==(n=e.ownerDocument)?void 0:n.body),i=el(r);return o?t.concat(i,i.visualViewport||[],cl(r)?r:[]):t.concat(r,Tl(r))}function Ll(e,t,n){return"viewport"===t?Xa(function(e,t){const n=el(e),r=bl(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const e=hl();(e||!e&&"fixed"===t)&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}(e,n)):sl(t)?function(e,t){const n=yl(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=il(e)?vl(e):{x:1,y:1},s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{top:c,left:l,right:l+s,bottom:c+a,x:l,y:c,width:s,height:a}}(t,n):Xa(function(e){var t;const n=bl(e),r=Cl(e),o=null==(t=e.ownerDocument)?void 0:t.body,i=pl(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),s=pl(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0);let a=-r.scrollLeft+xl(e);const l=-r.scrollTop;return"rtl"===tl(o||n).direction&&(a+=pl(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:s,x:a,y:l}}(bl(e)))}const Al={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let r=Tl(e).filter((e=>sl(e)&&"body"!==nl(e))),o=null;const i="fixed"===tl(e).position;let s=i?kl(e):e;for(;sl(s)&&!fl(s);){const e=tl(s),t=dl(s);(i?t||o:t||"static"!==e.position||!o||!["absolute","fixed"].includes(o.position))?o=e:r=r.filter((e=>e!==s)),s=kl(s)}return t.set(e,r),r}(t,this._c):[].concat(n),r],s=i[0],a=i.reduce(((e,n)=>{const r=Ll(t,n,o);return e.top=pl(r.top,e.top),e.right=gl(r.right,e.right),e.bottom=gl(r.bottom,e.bottom),e.left=pl(r.left,e.left),e}),Ll(t,s,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=il(n),i=bl(n);if(n===i)return t;let s={scrollLeft:0,scrollTop:0},a={x:1,y:1};const l={x:0,y:0};if((o||!o&&"fixed"!==r)&&(("body"!==nl(n)||cl(i))&&(s=Cl(n)),il(n))){const e=yl(n);a=vl(n),l.x=e.x+n.clientLeft,l.y=e.y+n.clientTop}return{width:t.width*a.x,height:t.height*a.y,x:t.x*a.x-s.scrollLeft*a.x+l.x,y:t.y*a.y-s.scrollTop*a.y+l.y}},isElement:sl,getDimensions:function(e){if(il(e))return{width:e.offsetWidth,height:e.offsetHeight};const t=yl(e);return{width:t.width,height:t.height}},getOffsetParent:El,getDocumentElement:bl,getScale:vl,getElementRects(e){return __async(this,null,(function*(){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||El,i=this.getDimensions;return{reference:_l(t,yield o(n),r),floating:__spreadValues({x:0,y:0},yield i(n))}}))},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>"rtl"===tl(e).direction};function Ol(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=!0,animationFrame:a=!1}=r,l=o&&!a,c=l||i?[...sl(e)?Tl(e):e.contextElement?Tl(e.contextElement):[],...Tl(t)]:[];c.forEach((e=>{l&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));let u,d=null;if(s){let r=!0;d=new ResizeObserver((()=>{r||n(),r=!1})),sl(e)&&!a&&d.observe(e),sl(e)||!e.contextElement||a||d.observe(e.contextElement),d.observe(t)}let h=a?yl(e):null;return a&&function t(){const r=yl(e);!h||r.x===h.x&&r.y===h.y&&r.width===h.width&&r.height===h.height||n();h=r,u=requestAnimationFrame(t)}(),n(),()=>{var e;c.forEach((e=>{l&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==(e=d)||e.disconnect(),d=null,a&&cancelAnimationFrame(u)}}const Ml=(e,t,n)=>{const r=new Map,o=__spreadValues({platform:Al},n),i=__spreadProps(__spreadValues({},o.platform),{_c:r});return Ja(e,t,__spreadProps(__spreadValues({},o),{platform:i}))};const Nl=un('<tc-root data-tc-dropdown-container="true"></tc-root>'),Pl=()=>{const t=Vn(),n=St($r),r=St(ga),[o,i]=gt(!1),[s,a]=gt(n.account),[l,c]=gt(!n.account);let u;const[d,h]=gt(),[f,g]=gt(),p=function(e,t,n){let r=()=>{var e;return null!=(e=null==n?void 0:n.placement)?e:"bottom"},o=()=>{var e;return null!=(e=null==n?void 0:n.strategy)?e:"absolute"},[i,s]=gt({x:null,y:null,placement:r(),strategy:o(),middlewareData:{}}),[a,l]=gt();mt((()=>{let e=a();if(e)throw e.value}));let c=vt((()=>(e(),t(),{})));function u(){let i=e(),a=t();if(i&&a){let e=c();Ml(i,a,{middleware:null==n?void 0:n.middleware,placement:r(),strategy:o()}).then((t=>{e===c()&&s(t)}),(e=>{l(e)}))}}return mt((()=>{let i=e(),s=t();if(null==n||n.middleware,r(),o(),i&&s)if(null!=n&&n.whileElementsMounted){let e=n.whileElementsMounted(i,s,u);e&&xt(e)}else u()})),{get x(){return i().x},get y(){return i().y},get placement(){return i().placement},get strategy(){return i().strategy},get middlewareData(){return i().middlewareData},update:u}}(f,d,{whileElementsMounted:Ol,placement:"bottom-end"});r.connectionRestored.then((()=>c(!1)));const w=n.onStatusChange((e=>{if(!e)return i(!1),a(null),void c(!1);a(e.account),c(!1)})),m=e=>{if(!s()||!o())return;const t=f().contains(e.target),n=u.contains(e.target);t||n||i(!1)};var v;return v=()=>{document.body.addEventListener("click",m)},mt((()=>Ct(v))),xt((()=>{document.body.removeEventListener("click",m),w()})),Ft(Rn,{component:zn,get children(){return[Ft(Jt,{get when(){return l()},get children(){return Ft(Fa,{disabled:!0,"data-tc-connect-button-loading":"true",get children(){return Ft(qa,{})}})}}),Ft(Jt,{get when(){return!l()},get children(){return[Ft(Jt,{get when(){return!s()},get children(){return Ft(Va,{onClick:()=>r.openModal(),"data-tc-connect-button":"true",scale:"s",get children(){return[Ft(ss,{get fill(){return t.colors.connectButton.foreground}}),Ft(ji,{translationKey:"button.connectWallet",fontSize:"15px",lineHeight:"18px",fontWeight:"590",get color(){return t.colors.connectButton.foreground},children:"Connect wallet"})]}})}}),Ft(Jt,{get when(){return s()},get children(){return Ft(za,{get children(){return[Ft(Ka,{onClick:()=>i((e=>!e)),ref:g,"data-tc-dropdown-button":"true",scale:"s",get children(){return[Ft(ji,{fontSize:"15px",fontWeight:"590",lineHeight:"18px",get children(){return(()=>{const t=s();if(t){const n=Ze(t.address,t.chain===e.CHAIN.TESTNET);return n.slice(0,4)+"…"+n.slice(-4)}return""})()}}),Ft(Zo,{direction:"bottom"})]}}),Ft(En,{get children(){const e=Ct((()=>document.importNode(Nl,!0)));return gn(h,e),e.style.setProperty("z-index","999"),e._$owner=st,pn(e,Ft(Do,{onBeforeEnter:e=>{ci(e,[{opacity:0,transform:"translateY(-8px)"},{opacity:1,transform:"translateY(0)"}],{duration:150})},onExit:(e,t)=>{ci(e,[{opacity:1,transform:"translateY(0)"},{opacity:0,transform:"translateY(-8px)"}],{duration:150}).finished.then(t)},get children(){return Ft(Jt,{get when(){return o()},get children(){return Ft(Za,{get hidden(){return!o()},onClose:()=>i(!1),ref(e){"function"==typeof u?u(e):u=e}})}})}}),null),pn(e,Ft(Ga,{}),null),wt((t=>{var n,r;const o=p.strategy,i=`${null!=(n=p.y)?n:0}px`,s=`${null!=(r=p.x)?r:0}px`;return o!==t._v$&&e.style.setProperty("position",t._v$=o),i!==t._v$2&&e.style.setProperty("top",t._v$2=i),s!==t._v$3&&e.style.setProperty("left",t._v$3=s),t}),{_v$:void 0,_v$2:void 0,_v$3:void 0}),e}})]}})}})]}})]}})},$l=Fn(gi)`
600
600
  padding-left: 24px;
601
601
  padding-right: 24px;
602
602
  padding-top: 18px;
@@ -916,7 +916,7 @@ var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnP
916
916
  padding: 0 64px;
917
917
  `,su=Fn.div`
918
918
  padding: 0 24px 24px;
919
- `,au=e=>[Ft(ou,{translationKey:"walletModal.mobileUniversalModal.connectYourWallet",children:"Connect your wallet"}),Ft(iu,{translationKey:"walletModal.mobileUniversalModal.scan",children:"Scan with your mobile wallet"}),Ft(su,{get children(){return Ft(Ni,{get imageUrl(){return ta},get sourceUrl(){return wc(e.universalLink,"none")},disableCopy:!0})}})];function lu(e){const t=new Set(e.filter(_e).map((e=>e.bridgeUrl)));return Array.from(t).map((e=>({bridgeUrl:e})))}function cu(e,t){const n=new Set(null==e?void 0:e.map((e=>e.bridgeUrl))),r=new Set(null==t?void 0:t.map((e=>e.bridgeUrl)));return n.size===r.size&&[...n].every((e=>r.has(e)))}const uu=un("<li></li>"),du=un('<div data-tc-wallets-modal-universal-mobile="true"></div>'),hu=e=>{const[t,n]=gt(!1),[r,o]=gt(!0),i=Wl.connector,s=()=>e.walletsList.filter((e=>Vl(e)&&e.appName!==ea)),a=()=>s().length>7,l=vt((()=>lu(e.walletsList)),null,{equals:cu}),c=vt((()=>i.connect(l(),e.additionalRequest)));Lr({openMethod:"universal-link"});const[u,d]=gt(void 0),h=()=>__async(this,null,(function*(){void 0!==u()&&clearTimeout(u()),yield Oi(c());const e=setTimeout((()=>d(void 0)),1500);d(e)})),f=()=>{const e=!r();o(!1),vc(c(),void 0,{returnStrategy:Wl.returnStrategy,forceRedirect:e},(e=>{Lr({openMethod:e})}))},g=()=>{const t=e.walletsList.find((e=>e.appName===ea));if(!t||!_e(t))throw new rr("@wallet bot not found in the wallets list");const n=i.connect({bridgeUrl:t.bridgeUrl,universalLink:t.universalLink},e.additionalRequest),s=!r();o(!1),mc(n,{returnStrategy:Wl.returnStrategy,twaReturnUrl:Wl.twaReturnUrl,forceRedirect:s})},p=()=>{n(!0),Lr({openMethod:"qrcode"})},w=()=>{n(!1),Lr({openMethod:"universal-link"})};return(()=>{const n=du.cloneNode(!0);return pn(n,Ft(Jt,{get when(){return t()},get children(){return[Ft(ru,{icon:"arrow",onClick:w}),Ft(au,{get universalLink(){return c()}})]}}),null),pn(n,Ft(Jt,{get when(){return!t()},get children(){return[Ft(ru,{get icon(){return Ft(Zs,{})},onClick:p}),Ft(Xc,{translationKey:"walletModal.mobileUniversalModal.connectYourWallet",children:"Connect your wallet"}),Ft(eu,{translationKey:"walletModal.mobileUniversalModal.openWalletOnTelegramOrSelect",children:"Open Wallet in Telegram or select your wallet to connect"}),Ft(tu,{get leftIcon(){return Ft(Hs,{})},get rightIcon(){return Ft(nu,{get src(){return na}})},onClick:g,scale:"s",get children(){return Ft(pc,{translationKey:"walletModal.mobileUniversalModal.openWalletOnTelegram",children:"Open Wallet in Telegram"})}}),Ft(Gc,{get children(){return[Ft(Qt,{get each(){return vt((()=>!!a()))()?s().slice(0,4):s()},children:t=>(()=>{const n=uu.cloneNode(!0);return pn(n,Ft(Yi,{get icon(){return t.imageUrl},get name(){return t.name},onClick:()=>e.onSelect(t)})),n})()}),Ft(Jt,{get when(){return a()},get children(){const t=uu.cloneNode(!0);return pn(t,Ft(Xs,{labelLine1:"View all",labelLine2:"wallets",get images(){return s().slice(3,7).map((e=>e.imageUrl))},onClick:()=>e.onSelectAllWallets()})),t}}),Ft(Qc,{children:" "}),Ft(Yc,{onClick:f,get children(){return[Ft(Jc,{get children(){return Ft(os,{})}}),Ft(ji,{fontWeight:590,translationKey:"walletModal.mobileUniversalModal.openLink",children:"Open Link"})]}}),Ft(Yc,{onClick:h,get children(){return[Ft(Jc,{get children(){return vt((()=>void 0!==u()))()?Ft(Ks,{}):Ft(qs,{})}}),Ft(ji,{fontWeight:590,get translationKey(){return void 0!==u()?"common.copied":"common.copyLink"},get children(){return void 0!==u()?"Copied":"Copy Link"}})]}})]}})]}}),null),n})()},fu={m:"16px",s:"8px",none:"0"},gu={m:"8px",s:"4px",none:"0"},pu=Fn.div`
919
+ `,au=e=>[Ft(ou,{translationKey:"walletModal.mobileUniversalModal.connectYourWallet",children:"Connect your wallet"}),Ft(iu,{translationKey:"walletModal.mobileUniversalModal.scan",children:"Scan with your mobile wallet"}),Ft(su,{get children(){return Ft(Ni,{get imageUrl(){return ta},get sourceUrl(){return wc(e.universalLink,"none")},disableCopy:!0})}})];function lu(e){const t=new Set(e.filter(_e).map((e=>e.bridgeUrl)));return Array.from(t).map((e=>({bridgeUrl:e})))}function cu(e,t){const n=new Set(null==e?void 0:e.map((e=>e.bridgeUrl))),r=new Set(null==t?void 0:t.map((e=>e.bridgeUrl)));return n.size===r.size&&[...n].every((e=>r.has(e)))}const uu=un("<li></li>"),du=un('<div data-tc-wallets-modal-universal-mobile="true"></div>'),hu=e=>{const[t,n]=gt(!1),[r,o]=gt(!0),[i,s]=gt(null),a=Wl.connector,l=()=>e.walletsList.filter((e=>Vl(e)&&e.appName!==ea)),c=()=>l().length>7,u=vt((()=>lu(e.walletsList)),null,{equals:cu}),d=()=>(i()||s(a.connect(u(),e.additionalRequest)),i());Lr({openMethod:"universal-link"});const[h,f]=gt(void 0),g=()=>__async(this,null,(function*(){void 0!==h()&&clearTimeout(h()),yield Oi(d());const e=setTimeout((()=>f(void 0)),1500);f(e)})),p=()=>{const e=!r();o(!1),vc(d(),void 0,{returnStrategy:Wl.returnStrategy,forceRedirect:e},(e=>{Lr({openMethod:e})}))},w=()=>{s(null);const t=e.walletsList.find((e=>e.appName===ea));if(!t||!_e(t))throw new rr("@wallet bot not found in the wallets list");const n=a.connect({bridgeUrl:t.bridgeUrl,universalLink:t.universalLink},e.additionalRequest),i=!r();o(!1),mc(n,{returnStrategy:Wl.returnStrategy,twaReturnUrl:Wl.twaReturnUrl,forceRedirect:i})},m=()=>{n(!0),Lr({openMethod:"qrcode"})},v=()=>{n(!1),Lr({openMethod:"universal-link"})};return(()=>{const n=du.cloneNode(!0);return pn(n,Ft(Jt,{get when(){return t()},get children(){return[Ft(ru,{icon:"arrow",onClick:v}),Ft(au,{get universalLink(){return d()}})]}}),null),pn(n,Ft(Jt,{get when(){return!t()},get children(){return[Ft(ru,{get icon(){return Ft(Zs,{})},onClick:m}),Ft(Xc,{translationKey:"walletModal.mobileUniversalModal.connectYourWallet",children:"Connect your wallet"}),Ft(eu,{translationKey:"walletModal.mobileUniversalModal.openWalletOnTelegramOrSelect",children:"Open Wallet in Telegram or select your wallet to connect"}),Ft(tu,{get leftIcon(){return Ft(Hs,{})},get rightIcon(){return Ft(nu,{get src(){return na}})},onClick:w,scale:"s",get children(){return Ft(pc,{translationKey:"walletModal.mobileUniversalModal.openWalletOnTelegram",children:"Open Wallet in Telegram"})}}),Ft(Gc,{get children(){return[Ft(Qt,{get each(){return vt((()=>!!c()))()?l().slice(0,4):l()},children:t=>(()=>{const n=uu.cloneNode(!0);return pn(n,Ft(Yi,{get icon(){return t.imageUrl},get name(){return t.name},onClick:()=>e.onSelect(t)})),n})()}),Ft(Jt,{get when(){return c()},get children(){const t=uu.cloneNode(!0);return pn(t,Ft(Xs,{labelLine1:"View all",labelLine2:"wallets",get images(){return l().slice(3,7).map((e=>e.imageUrl))},onClick:()=>e.onSelectAllWallets()})),t}}),Ft(Qc,{children:" "}),Ft(Yc,{onClick:p,get children(){return[Ft(Jc,{get children(){return Ft(os,{})}}),Ft(ji,{fontWeight:590,translationKey:"walletModal.mobileUniversalModal.openLink",children:"Open Link"})]}}),Ft(Yc,{onClick:g,get children(){return[Ft(Jc,{get children(){return vt((()=>void 0!==h()))()?Ft(Ks,{}):Ft(qs,{})}}),Ft(ji,{fontWeight:590,get translationKey(){return void 0!==h()?"common.copied":"common.copyLink"},get children(){return void 0!==h()?"Copied":"Copy Link"}})]}})]}})]}}),null),n})()},fu={m:"16px",s:"8px",none:"0"},gu={m:"8px",s:"4px",none:"0"},pu=Fn.div`
920
920
  display: flex;
921
921
  flex-direction: column;
922
922
  align-items: center;
@@ -1020,5 +1020,5 @@ var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnP
1020
1020
  width: 16px;
1021
1021
  `,Tu=Fn(Uo)`
1022
1022
  margin-top: 32px;
1023
- `,Lu=e=>{const t=Io(e),n=St(ga),[r,o]=gt(!0),[i,s]=gt(!1);let a,l;mt((()=>{const e=Ar();s(!!e&&"sent"in e&&e.sent)})),(null==n?void 0:n.wallet)&&"universalLink"in n.wallet&&("universal-link"===n.wallet.openMethod||te(n.wallet.universalLink)&&xo())&&(a=n.wallet.universalLink),(null==n?void 0:n.wallet)&&"deepLink"in n.wallet&&("custom-deeplink"===n.wallet.openMethod||te(n.wallet.deepLink)&&xo())&&(l=n.wallet.deepLink);const c=()=>{const e=Ar(),t="returnStrategy"in e?e.returnStrategy:Wl.returnStrategy,n=!r();o(!1),te(a)?mc(a,{returnStrategy:t,twaReturnUrl:"twaReturnUrl"in e?e.twaReturnUrl:Wl.twaReturnUrl,forceRedirect:n}):vc(a,l,{returnStrategy:t,forceRedirect:n},(()=>{}))};return Ft(_u,Gt(t,{get children(){return[vt((()=>e.icon)),Ft(ku,{get translationKey(){return e.headerTranslationKey},get translationValues(){return e.headerTranslationValues}}),Ft(Su,{get translationKey(){return e.textTranslationKey},get translationValues(){return e.textTranslationValues}}),Ft(Jt,{get when(){return!i()&&("open-wallet"===e.showButton&&a||"open-wallet"!==e.showButton)},get children(){return Ft(Eu,{disabled:!0,"data-tc-connect-button-loading":"true",get children(){return Ft(Ru,{})}})}}),Ft(Jt,{get when(){return i()},get children(){return[Ft(Jt,{get when(){return"open-wallet"!==e.showButton},get children(){return Ft(Tu,{onClick:()=>e.onClose(),get children(){return Ft(pc,{translationKey:"common.close",children:"Close"})}})}}),Ft(Jt,{get when(){return"open-wallet"===e.showButton&&a},get children(){return Ft(Tu,{onClick:c,get children(){return Ft(pc,{translationKey:"common.openWallet",children:"Open wallet"})}})}})]}})]}}))},Au=e=>{const t=St(ga),[n]=Ui();return Ft(Lu,{headerTranslationKey:"actionModal.confirmTransaction.header",get headerTranslationValues(){return{name:t.wallet&&"name"in t.wallet?t.wallet.name:n("common.yourWallet",{},"Your wallet")}},textTranslationKey:"actionModal.confirmTransaction.text",get icon(){return Ft(vs,{size:"m"})},onClose:()=>e.onClose(),showButton:"open-wallet","data-tc-confirm-modal":"true"})},Ou=e=>Ft(Lu,{headerTranslationKey:"actionModal.transactionCanceled.header",textTranslationKey:"actionModal.transactionCanceled.text",get icon(){return Ft(gs,{size:"m"})},onClose:()=>e.onClose(),"data-tc-transaction-canceled-modal":"true"}),Mu=e=>Ft(Lu,{headerTranslationKey:"actionModal.transactionSent.header",textTranslationKey:"actionModal.transactionSent.text",get icon(){return Ft(us,{size:"m"})},onClose:()=>e.onClose(),"data-tc-transaction-sent-modal":"true"}),Nu=()=>Ft(gi,{get opened(){var e;return vt((()=>null!==Ar()))()&&!0===(null==(e=Ar())?void 0:e.openModal)},get enableAndroidBackHandler(){return Wl.enableAndroidBackHandler},onClose:()=>Or(null),"data-tc-actions-modal-container":"true",get children(){return Ft(Xt,{get children(){return[Ft(en,{get when(){return"transaction-sent"===Ar().name},get children(){return Ft(Mu,{onClose:()=>Or(null)})}}),Ft(en,{get when(){return"transaction-canceled"===Ar().name},get children(){return Ft(Ou,{onClose:()=>Or(null)})}}),Ft(en,{get when(){return"confirm-transaction"===Ar().name},get children(){return Ft(Au,{onClose:()=>Or(null)})}})]}})}}),Pu=()=>{const{locale:e}=Ui()[1];mt((()=>e(Wl.language))),mt((()=>{kr()&&ua()}));const t=St($r),n=St(ga),[r,o]=gt(!1),i=()=>{var e;return"loading"===(null==(e=Wl.connectRequestParameters)?void 0:e.state)},s=vt((()=>{var e;if(!i())return null==(e=Wl.connectRequestParameters)?void 0:e.value})),a=e=>{n.closeSingleWalletModal(e)};return xt(t.onStatusChange((e=>{e&&a("wallet-selected")}))),xt((()=>{o(!1)})),Ft($l,{get opened(){return kr()},get enableAndroidBackHandler(){return Wl.enableAndroidBackHandler},onClose:()=>a("action-cancelled"),onClickQuestion:()=>o((e=>!e)),"data-tc-wallets-modal-container":"true",get children(){return[Ft(Jt,{get when(){return r()},get children(){return Ft(Ac,{onBackClick:()=>o(!1)})}}),Ft(Jt,{get when(){return!r()},get children(){return[Ft(Jt,{get when(){return i()},get children(){return[Ft(Il,{translationKey:"walletModal.loading",children:"Wallets list is loading"}),Ft(Ul,{get children(){return Ft(vs,{size:"m"})}})]}}),Ft(Jt,{get when(){return!i()},get children(){return Ft(Rn,{get component(){return la()?qc:bc},get wallet(){return Sr()},get additionalRequest(){return s()},onBackClick:()=>{},backDisabled:!0})}})]}})]}})},$u=e=>{const t=$i(Nr,Wl.language);return customElements.define(zn,class extends HTMLElement{}),document.body.hasAttribute("ontouchstart")||document.body.setAttribute("ontouchstart",""),Ft(Ii.Provider,{value:t,get children(){return Ft(ga.Provider,{get value(){return e.tonConnectUI},get children(){return Ft($r.Provider,{get value(){return Wl.connector},get children(){return[Ft(Yn,{}),Ft(Hn,{theme:uo,get children(){return[Ft(Jt,{get when(){return Wl.buttonRootId},get children(){return Ft(En,{get mount(){return document.getElementById(Wl.buttonRootId)},get children(){return Ft(Pl,{})}})}}),Ft(Rn,{component:zn,get children(){return[Ft(xu,{}),Ft(Pu,{}),Ft(Nu,{})]}})]}})]}})}})}})},Iu=()=>{setTimeout((()=>br({status:"opened",closeReason:null})))},Uu=e=>{setTimeout((()=>br({status:"closed",closeReason:e})))},Wu=e=>{setTimeout((()=>_r({status:"opened",closeReason:null,walletInfo:e})))},ju=e=>{setTimeout((()=>_r({status:"closed",closeReason:e})))},Bu=e=>{setTimeout((()=>Or(e)))},Du=()=>{setTimeout((()=>Or(null)))},Hu=()=>Rr(),Vu=()=>Lr(null),Ku=(e,t)=>function(e,t,n,r={}){let o;return ft((r=>{o=r,t===document?e():pn(t,e(),t.firstChild?null:void 0,n)}),r.owner),()=>{o(),t.textContent=""}}((()=>Ft($u,{tonConnectUI:t})),document.getElementById(e));class Fu{constructor(e){__publicField(this,"connector"),__publicField(this,"setConnectRequestParametersCallback"),__publicField(this,"consumers",[]),__publicField(this,"tracker"),__publicField(this,"state",yr()),this.connector=e.connector,this.tracker=e.tracker,this.setConnectRequestParametersCallback=e.setConnectRequestParametersCallback,mt((()=>{const e=yr();this.state=e,this.consumers.forEach((t=>t(e)))}))}open(){return __async(this,null,(function*(){this.tracker.trackConnectionStarted();const e=(yield this.connector.getWallets()).find(Ce);return e?this.connectEmbeddedWallet(e):this.openWalletsModal()}))}close(e="action-cancelled"){"action-cancelled"===e&&this.tracker.trackConnectionError("Connection was cancelled"),Uu(e)}onStateChange(e){return this.consumers.push(e),()=>{this.consumers=this.consumers.filter((t=>t!==e))}}connectEmbeddedWallet(e){const t=t=>{Lr(e),this.connector.connect({jsBridgeKey:e.jsBridgeKey},t)},n=Wl.connectRequestParameters;"loading"===(null==n?void 0:n.state)?this.setConnectRequestParametersCallback(t):t(null==n?void 0:n.value)}openWalletsModal(){return __async(this,null,(function*(){return xo()&&_o(),Iu(),new Promise((e=>{const t=this.onStateChange((n=>{const{status:r}=n;"opened"===r&&(t(),e())}))}))}))}}class qu{constructor(e){__publicField(this,"connector"),__publicField(this,"consumers",[]),this.connector=e.connector,mt((()=>{const e=Ar();this.consumers.forEach((t=>t(e)))}))}onStateChange(e){return this.consumers.push(e),()=>{this.consumers=this.consumers.filter((t=>t!==e))}}}class zu{constructor(e){__publicField(this,"connector"),__publicField(this,"setConnectRequestParametersCallback"),__publicField(this,"consumers",[]),__publicField(this,"tracker"),__publicField(this,"state",xr()),this.connector=e.connector,this.tracker=e.tracker,this.setConnectRequestParametersCallback=e.setConnectRequestParametersCallback,mt((()=>{const e=xr();this.state=e,this.consumers.forEach((t=>t(e)))}))}open(e){return __async(this,null,(function*(){this.tracker.trackConnectionStarted();const t=Dl(yield this.connector.getWallets(),Wl.walletsListConfiguration),n=t.find(Ce);if(!!n)return this.connectEmbeddedWallet(n);const r=t.filter(_e).find((t=>Fl(t,e)));if(!!r)return this.openSingleWalletModal(r);const o=`Trying to open modal window with unknown wallet "${e}".`;throw this.tracker.trackConnectionError(o),new rr(o)}))}close(e="action-cancelled"){"action-cancelled"===e&&this.tracker.trackConnectionError("Connection was cancelled"),ju("action-cancelled")}onStateChange(e){return this.consumers.push(e),()=>{this.consumers=this.consumers.filter((t=>t!==e))}}connectEmbeddedWallet(e){const t=t=>{Lr(e),this.connector.connect({jsBridgeKey:e.jsBridgeKey},t)},n=Wl.connectRequestParameters;"loading"===(null==n?void 0:n.state)?this.setConnectRequestParametersCallback(t):t(null==n?void 0:n.value)}openSingleWalletModal(e){return __async(this,null,(function*(){return xo()&&_o(),Wu(e),new Promise((e=>{const t=this.onStateChange((n=>{const{status:r}=n;"opened"===r&&(t(),e())}))}))}))}}class Zu{constructor(e){var t;__publicField(this,"eventPrefix","ton-connect-ui-"),__publicField(this,"tonConnectUiVersion"),__publicField(this,"tonConnectSdkVersion",null),__publicField(this,"eventDispatcher"),this.eventDispatcher=null!=(t=null==e?void 0:e.eventDispatcher)?t:new Ve,this.tonConnectUiVersion=e.tonConnectUiVersion,this.init().catch()}get version(){return Ae({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return __async(this,null,(function*(){try{yield this.setRequestVersionHandler(),this.tonConnectSdkVersion=yield this.requestTonConnectSdkVersion()}catch(Gu){}}))}setRequestVersionHandler(){return __async(this,null,(function*(){yield this.eventDispatcher.addEventListener("ton-connect-ui-request-version",(()=>__async(this,null,(function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-ui-response-version",Le(this.tonConnectUiVersion))}))))}))}requestTonConnectSdkVersion(){return __async(this,null,(function*(){return new Promise(((e,t)=>__async(this,null,(function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-response-version",(t=>{e(t.detail.version)}),{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-request-version",{type:"request-version"})}catch(Gu){t(Gu)}}))))}))}dispatchUserActionEvent(e){var t;try{null==(t=this.eventDispatcher)||t.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch(Gu){}}trackConnectionStarted(...e){try{const t=Me(this.version,...e);this.dispatchUserActionEvent(t)}catch(Gu){}}trackConnectionCompleted(...e){try{const t=Ne(this.version,...e);this.dispatchUserActionEvent(t)}catch(Gu){}}trackConnectionError(...e){try{const t=Pe(this.version,...e);this.dispatchUserActionEvent(t)}catch(Gu){}}trackConnectionRestoringStarted(...e){try{const t=$e(this.version,...e);this.dispatchUserActionEvent(t)}catch(Gu){}}trackConnectionRestoringCompleted(...e){try{const t=Ie(this.version,...e);this.dispatchUserActionEvent(t)}catch(Gu){}}trackConnectionRestoringError(...e){try{const t=Ue(this.version,...e);this.dispatchUserActionEvent(t)}catch(Gu){}}trackDisconnection(...e){try{const t=He(this.version,...e);this.dispatchUserActionEvent(t)}catch(Gu){}}trackTransactionSentForSignature(...e){try{const t=je(this.version,...e);this.dispatchUserActionEvent(t)}catch(Gu){}}trackTransactionSigned(...e){try{const t=Be(this.version,...e);this.dispatchUserActionEvent(t)}catch(Gu){}}trackTransactionSigningFailed(...e){try{const t=De(this.version,...e);this.dispatchUserActionEvent(t)}catch(Gu){}}}e.BadRequestError=B,e.BrowserEventDispatcher=Ve,e.FetchWalletsError=K,e.LocalstorageNotFoundError=V,e.ParseHexError=q,e.THEME=Tn,e.TonConnect=Fe,e.TonConnectError=N,e.TonConnectUI=class{constructor(e){if(__publicField(this,"walletInfoStorage",new wr),__publicField(this,"preferredWalletStorage",new mr),__publicField(this,"tracker"),__publicField(this,"walletInfo",null),__publicField(this,"systemThemeChangeUnsubscribe",null),__publicField(this,"actionsConfiguration"),__publicField(this,"walletsList"),__publicField(this,"connectRequestParametersCallback"),__publicField(this,"connector"),__publicField(this,"modal"),__publicField(this,"singleWalletModal"),__publicField(this,"transactionModal"),__publicField(this,"connectionRestored",Promise.resolve(!1)),e&&"connector"in e&&e.connector)this.connector=e.connector;else{if(!(e&&"manifestUrl"in e&&e.manifestUrl))throw new rr("You have to specify a `manifestUrl` or a `connector` in the options.");this.connector=new Fe({manifestUrl:e.manifestUrl,eventDispatcher:null==e?void 0:e.eventDispatcher})}this.tracker=new Zu({eventDispatcher:null==e?void 0:e.eventDispatcher,tonConnectUiVersion:"2.0.4"}),this.modal=new Fu({connector:this.connector,tracker:this.tracker,setConnectRequestParametersCallback:e=>{this.connectRequestParametersCallback=e}}),this.singleWalletModal=new zu({connector:this.connector,tracker:this.tracker,setConnectRequestParametersCallback:e=>{this.connectRequestParametersCallback=e}}),this.transactionModal=new qu({connector:this.connector}),this.walletsList=this.getWallets(),this.walletsList.then((e=>{return cr((t=e.map((e=>e.imageUrl)),[...new Set(t)]));var t}));const t=this.normalizeWidgetRoot(null==e?void 0:e.widgetRootId);this.subscribeToWalletChange(),!1!==(null==e?void 0:e.restoreConnection)&&(this.connectionRestored=function(e){return __async(this,null,(function*(){return yield new Promise((e=>requestAnimationFrame(e))),e()}))}((()=>__async(this,null,(function*(){return this.tracker.trackConnectionRestoringStarted(),yield this.connector.restoreConnection(),this.connector.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):(this.tracker.trackConnectionRestoringError("Connection was not restored"),this.walletInfoStorage.removeWalletInfo()),this.connector.connected}))))),this.uiOptions=co(e,{uiPreferences:{theme:"SYSTEM"}});const n=this.preferredWalletStorage.getPreferredWalletAppName();jl({connector:this.connector,preferredWalletAppName:n}),Ku(t,this)}static getWallets(){return Fe.getWallets()}get connected(){return this.connector.connected}get account(){return this.connector.account}get wallet(){return this.connector.wallet?__spreadValues(__spreadValues({},this.connector.wallet),this.walletInfo):null}set uiOptions(e){var t,n,r,o,i,s,a;this.checkButtonRootExist(e.buttonRootId),this.actionsConfiguration=e.actionsConfiguration,(null==(t=e.uiPreferences)?void 0:t.theme)?"SYSTEM"!==(null==(n=e.uiPreferences)?void 0:n.theme)?(null==(r=this.systemThemeChangeUnsubscribe)||r.call(this),po(e.uiPreferences.theme,e.uiPreferences.colorsSet)):(po(window.matchMedia&&window.matchMedia("(prefers-color-scheme: light)").matches?Tn.LIGHT:Tn.DARK,e.uiPreferences.colorsSet),this.systemThemeChangeUnsubscribe||(this.systemThemeChangeUnsubscribe=function(e){const t=t=>e(t.matches?Tn.DARK:Tn.LIGHT);return window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",t),()=>window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change",t)}(po))):(null==(o=e.uiPreferences)?void 0:o.colorsSet)&&(s=e.uiPreferences.colorsSet,go[Tn.DARK]=co(s[Tn.DARK],go[Tn.DARK]),go[Tn.LIGHT]=co(s[Tn.LIGHT],go[Tn.LIGHT]),ho((e=>({colors:co(go[e.theme],fo[e.theme])})))),(null==(i=e.uiPreferences)?void 0:i.borderRadius)&&(a=e.uiPreferences.borderRadius,ho({borderRadius:a})),jl((t=>{var n,r;const o=co(__spreadValues(__spreadValues(__spreadValues(__spreadValues({},e.language&&{language:e.language}),!!(null==(n=e.actionsConfiguration)?void 0:n.returnStrategy)&&{returnStrategy:e.actionsConfiguration.returnStrategy}),!!(null==(r=e.actionsConfiguration)?void 0:r.twaReturnUrl)&&{twaReturnUrl:e.actionsConfiguration.twaReturnUrl}),!!e.walletsListConfiguration&&{walletsListConfiguration:e.walletsListConfiguration}),Dr(t));return void 0!==e.buttonRootId&&(o.buttonRootId=e.buttonRootId),void 0!==e.enableAndroidBackHandler&&(o.enableAndroidBackHandler=e.enableAndroidBackHandler),o}))}setConnectRequestParameters(e){var t;jl({connectRequestParameters:e}),"ready"!==(null==e?void 0:e.state)&&e||null==(t=this.connectRequestParametersCallback)||t.call(this,null==e?void 0:e.value)}getWallets(){return __async(this,null,(function*(){return this.connector.getWallets()}))}onStatusChange(e,t){return this.connector.onStatusChange((t=>__async(this,null,(function*(){if(t){const n=yield this.getSelectedWalletInfo(t);e(__spreadValues(__spreadValues({},t),n||this.walletInfoStorage.getWalletInfo()))}else e(t)}))),t)}openModal(){return __async(this,null,(function*(){return this.modal.open()}))}closeModal(e){this.modal.close(e)}onModalStateChange(e){return this.modal.onStateChange(e)}get modalState(){return this.modal.state}openSingleWalletModal(e){return __async(this,null,(function*(){return this.singleWalletModal.open(e)}))}closeSingleWalletModal(e){this.singleWalletModal.close(e)}onSingleWalletModalStateChange(e){return this.singleWalletModal.onStateChange(e)}get singleWalletModalState(){return this.singleWalletModal.state}connectWallet(){return __async(this,null,(function*(){const e=(yield this.getWallets()).find(Ce);return e?yield this.connectEmbeddedWallet(e):yield this.connectExternalWallet()}))}disconnect(){return this.tracker.trackDisconnection(this.wallet,"dapp"),Du(),Vu(),this.walletInfoStorage.removeWalletInfo(),this.connector.disconnect()}sendTransaction(e,t){return __async(this,null,(function*(){if(this.tracker.trackTransactionSentForSignature(this.wallet,e),!this.connected)throw this.tracker.trackTransactionSigningFailed(this.wallet,e,"Wallet was not connected"),new rr("Connect wallet to send a transaction.");xo()&&_o();const{notifications:n,modals:r,returnStrategy:o,twaReturnUrl:i,skipRedirectToWallet:s}=this.getModalsAndNotificationsConfiguration(t);Bu({name:"confirm-transaction",showNotification:n.includes("before"),openModal:r.includes("before"),sent:!1});const a=()=>{l.signal.aborted||(Bu({name:"confirm-transaction",showNotification:n.includes("before"),openModal:r.includes("before"),sent:!0}),this.walletInfo&&"universalLink"in this.walletInfo&&("universal-link"===this.walletInfo.openMethod||"custom-deeplink"===this.walletInfo.openMethod)&&(te(this.walletInfo.universalLink)?mc(this.walletInfo.universalLink,{returnStrategy:o,twaReturnUrl:i||Wl.twaReturnUrl,forceRedirect:!1}):vc(this.walletInfo.universalLink,this.walletInfo.deepLink,{returnStrategy:o,forceRedirect:!1},(()=>{}))))},l=new AbortController,c=this.onTransactionModalStateChange((e=>{(null==e?void 0:e.openModal)||(c(),e||l.abort())}));try{const t=yield this.waitForSendTransaction({transaction:e,signal:l.signal},a);return this.tracker.trackTransactionSigned(this.wallet,e,t),Bu({name:"transaction-sent",showNotification:n.includes("success"),openModal:r.includes("success")}),t}catch(Gu){throw Bu({name:"transaction-canceled",showNotification:n.includes("error"),openModal:r.includes("error")}),Gu instanceof N?Gu:(console.error(Gu),new rr("Unhandled error:"+Gu))}finally{c()}}))}connectEmbeddedWallet(e){return __async(this,null,(function*(){const t=t=>{Lr(e),this.connector.connect({jsBridgeKey:e.jsBridgeKey},t)},n=Wl.connectRequestParameters;return"loading"===(null==n?void 0:n.state)?this.connectRequestParametersCallback=t:t(null==n?void 0:n.value),yield this.waitForWalletConnection({ignoreErrors:!1})}))}connectExternalWallet(){return __async(this,null,(function*(){const e=new AbortController;Iu();const t=this.onModalStateChange((n=>{const{status:r,closeReason:o}=n;"opened"!==r&&(t(),"action-cancelled"===o&&e.abort())}));return yield this.waitForWalletConnection({ignoreErrors:!0,signal:e.signal})}))}waitForWalletConnection(e){return __async(this,null,(function*(){return new Promise(((t,n)=>{this.tracker.trackConnectionStarted();const{ignoreErrors:r=!1,signal:o=null}=e;if(o&&o.aborted)return this.tracker.trackConnectionError("Connection was cancelled"),n(new rr("Wallet was not connected"));const i=e=>__async(this,null,(function*(){if(e)this.tracker.trackConnectionCompleted(e),a(),t(e);else{if(this.tracker.trackConnectionError("Connection was cancelled"),r)return;a(),n(new rr("Wallet was not connected"))}})),s=e=>{this.tracker.trackConnectionError(e.message),r||(a(),n(e))},a=this.onStatusChange((e=>i(e)),(e=>s(e)));o&&o.addEventListener("abort",(()=>{a(),n(new rr("Wallet was not connected"))}),{once:!0})}))}))}waitForSendTransaction(e,t){return __async(this,null,(function*(){return new Promise(((n,r)=>{const{transaction:o,signal:i}=e;if(i.aborted)return this.tracker.trackTransactionSigningFailed(this.wallet,o,"Transaction was cancelled"),r(new rr("Transaction was not sent"));const s=e=>__async(this,null,(function*(){n(e)})),a=()=>{this.tracker.trackTransactionSigningFailed(this.wallet,o,"Transaction was cancelled"),r(new rr("Transaction was not sent"))};i.addEventListener("abort",a,{once:!0}),this.connector.sendTransaction(o,{onRequestSent:t,signal:i}).then((e=>(i.removeEventListener("abort",a),s(e)))).catch((e=>(i.removeEventListener("abort",a),(e=>{r(e)})(e))))}))}))}onTransactionModalStateChange(e){return this.transactionModal.onStateChange(e)}subscribeToWalletChange(){this.connector.onStatusChange((e=>__async(this,null,(function*(){var t;e?(yield this.updateWalletInfo(e),this.setPreferredWalletAppName((null==(t=this.walletInfo)?void 0:t.appName)||e.device.appName)):this.walletInfoStorage.removeWalletInfo()}))))}setPreferredWalletAppName(e){this.preferredWalletStorage.setPreferredWalletAppName(e),jl({preferredWalletAppName:e})}getSelectedWalletInfo(e){return __async(this,null,(function*(){let t,n=Hu();if(!n)return null;if("name"in n)t=n;else{const r=Dl(yield this.walletsList,Wl.walletsListConfiguration).find((t=>Fl(t,e.device.appName)));if(!r)throw new rr(`Cannot find WalletInfo for the '${e.device.appName}' wallet`);t=__spreadValues(__spreadValues({},r),n)}return t}))}updateWalletInfo(e){return __async(this,null,(function*(){const t=yield this.getSelectedWalletInfo(e);if(t)return this.walletInfo=t,void this.walletInfoStorage.setWalletInfo(t);const n=this.walletInfoStorage.getWalletInfo();this.walletInfo=n||((yield this.walletsList).find((t=>Fl(t,e.device.appName)))||null)}))}normalizeWidgetRoot(e){if(!e||!document.getElementById(e)){e="tc-widget-root";const t=document.createElement("div");t.id=e,document.body.appendChild(t)}return e}checkButtonRootExist(e){if(null!=e&&!document.getElementById(e))throw new rr(`${e} element not found in the document.`)}getModalsAndNotificationsConfiguration(e){var t,n,r,o,i,s;const a=["before","success","error"];let l=a;(null==(t=this.actionsConfiguration)?void 0:t.notifications)&&"all"!==(null==(n=this.actionsConfiguration)?void 0:n.notifications)&&(l=this.actionsConfiguration.notifications),(null==e?void 0:e.notifications)&&(l="all"===e.notifications?a:e.notifications);let c=["before"];(null==(r=this.actionsConfiguration)?void 0:r.modals)&&(c="all"===this.actionsConfiguration.modals?a:this.actionsConfiguration.modals),(null==e?void 0:e.modals)&&(c="all"===e.modals?a:e.modals);const u=(null==e?void 0:e.returnStrategy)||(null==(o=this.actionsConfiguration)?void 0:o.returnStrategy)||"back",d=(null==e?void 0:e.twaReturnUrl)||(null==(i=this.actionsConfiguration)?void 0:i.twaReturnUrl);let h=(null==e?void 0:e.skipRedirectToWallet)||(null==(s=this.actionsConfiguration)?void 0:s.skipRedirectToWallet)||"ios";return xo()&&(h="never"),{notifications:l,modals:c,returnStrategy:u,twaReturnUrl:d,skipRedirectToWallet:h}}},e.TonConnectUIError=rr,e.UnknownAppError=D,e.UnknownError=z,e.UserRejectsError=j,e.WalletAlreadyConnectedError=U,e.WalletNotConnectedError=W,e.WalletNotInjectedError=H,e.WalletsListManager=Se,e.WrongAddressError=F,e.createConnectionCompletedEvent=Ne,e.createConnectionErrorEvent=Pe,e.createConnectionRestoringCompletedEvent=Ie,e.createConnectionRestoringErrorEvent=Ue,e.createConnectionRestoringStartedEvent=$e,e.createConnectionStartedEvent=Me,e.createDisconnectionEvent=He,e.createRequestVersionEvent=Te,e.createResponseVersionEvent=Le,e.createTransactionSentForSignatureEvent=je,e.createTransactionSignedEvent=Be,e.createTransactionSigningFailedEvent=De,e.createVersionInfo=Ae,e.encodeTelegramUrlParameters=ne,e.isTelegramUrl=te,e.isWalletInfoCurrentlyEmbedded=Ce,e.isWalletInfoCurrentlyInjected=be,e.isWalletInfoInjectable=xe,e.isWalletInfoInjected=function(e){return"jsBridgeKey"in e},e.isWalletInfoRemote=_e,e.toUserFriendlyAddress=Ze,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1023
+ `,Lu=e=>{const t=Io(e),n=St(ga),[r,o]=gt(!0),[i,s]=gt(!1);let a,l;mt((()=>{const e=Ar();s(!!e&&"sent"in e&&e.sent)})),(null==n?void 0:n.wallet)&&"universalLink"in n.wallet&&("universal-link"===n.wallet.openMethod||te(n.wallet.universalLink)&&xo())&&(a=n.wallet.universalLink),(null==n?void 0:n.wallet)&&"deepLink"in n.wallet&&("custom-deeplink"===n.wallet.openMethod||te(n.wallet.deepLink)&&xo())&&(l=n.wallet.deepLink);const c=()=>{const e=Ar(),t="returnStrategy"in e?e.returnStrategy:Wl.returnStrategy,n=!r();o(!1),te(a)?mc(a,{returnStrategy:t,twaReturnUrl:"twaReturnUrl"in e?e.twaReturnUrl:Wl.twaReturnUrl,forceRedirect:n}):vc(a,l,{returnStrategy:t,forceRedirect:n},(()=>{}))};return Ft(_u,Gt(t,{get children(){return[vt((()=>e.icon)),Ft(ku,{get translationKey(){return e.headerTranslationKey},get translationValues(){return e.headerTranslationValues}}),Ft(Su,{get translationKey(){return e.textTranslationKey},get translationValues(){return e.textTranslationValues}}),Ft(Jt,{get when(){return!i()&&("open-wallet"===e.showButton&&a||"open-wallet"!==e.showButton)},get children(){return Ft(Eu,{disabled:!0,"data-tc-connect-button-loading":"true",get children(){return Ft(Ru,{})}})}}),Ft(Jt,{get when(){return i()},get children(){return[Ft(Jt,{get when(){return"open-wallet"!==e.showButton},get children(){return Ft(Tu,{onClick:()=>e.onClose(),get children(){return Ft(pc,{translationKey:"common.close",children:"Close"})}})}}),Ft(Jt,{get when(){return"open-wallet"===e.showButton&&a},get children(){return Ft(Tu,{onClick:c,get children(){return Ft(pc,{translationKey:"common.openWallet",children:"Open wallet"})}})}})]}})]}}))},Au=e=>{const t=St(ga),[n]=Ui();return Ft(Lu,{headerTranslationKey:"actionModal.confirmTransaction.header",get headerTranslationValues(){return{name:t.wallet&&"name"in t.wallet?t.wallet.name:n("common.yourWallet",{},"Your wallet")}},textTranslationKey:"actionModal.confirmTransaction.text",get icon(){return Ft(vs,{size:"m"})},onClose:()=>e.onClose(),showButton:"open-wallet","data-tc-confirm-modal":"true"})},Ou=e=>Ft(Lu,{headerTranslationKey:"actionModal.transactionCanceled.header",textTranslationKey:"actionModal.transactionCanceled.text",get icon(){return Ft(gs,{size:"m"})},onClose:()=>e.onClose(),"data-tc-transaction-canceled-modal":"true"}),Mu=e=>Ft(Lu,{headerTranslationKey:"actionModal.transactionSent.header",textTranslationKey:"actionModal.transactionSent.text",get icon(){return Ft(us,{size:"m"})},onClose:()=>e.onClose(),"data-tc-transaction-sent-modal":"true"}),Nu=()=>Ft(gi,{get opened(){var e;return vt((()=>null!==Ar()))()&&!0===(null==(e=Ar())?void 0:e.openModal)},get enableAndroidBackHandler(){return Wl.enableAndroidBackHandler},onClose:()=>Or(null),"data-tc-actions-modal-container":"true",get children(){return Ft(Xt,{get children(){return[Ft(en,{get when(){return"transaction-sent"===Ar().name},get children(){return Ft(Mu,{onClose:()=>Or(null)})}}),Ft(en,{get when(){return"transaction-canceled"===Ar().name},get children(){return Ft(Ou,{onClose:()=>Or(null)})}}),Ft(en,{get when(){return"confirm-transaction"===Ar().name},get children(){return Ft(Au,{onClose:()=>Or(null)})}})]}})}}),Pu=()=>{const{locale:e}=Ui()[1];mt((()=>e(Wl.language))),mt((()=>{kr()&&ua()}));const t=St($r),n=St(ga),[r,o]=gt(!1),i=()=>{var e;return"loading"===(null==(e=Wl.connectRequestParameters)?void 0:e.state)},s=vt((()=>{var e;if(!i())return null==(e=Wl.connectRequestParameters)?void 0:e.value})),a=e=>{n.closeSingleWalletModal(e)};return xt(t.onStatusChange((e=>{e&&a("wallet-selected")}))),xt((()=>{o(!1)})),Ft($l,{get opened(){return kr()},get enableAndroidBackHandler(){return Wl.enableAndroidBackHandler},onClose:()=>a("action-cancelled"),onClickQuestion:()=>o((e=>!e)),"data-tc-wallets-modal-container":"true",get children(){return[Ft(Jt,{get when(){return r()},get children(){return Ft(Ac,{onBackClick:()=>o(!1)})}}),Ft(Jt,{get when(){return!r()},get children(){return[Ft(Jt,{get when(){return i()},get children(){return[Ft(Il,{translationKey:"walletModal.loading",children:"Wallets list is loading"}),Ft(Ul,{get children(){return Ft(vs,{size:"m"})}})]}}),Ft(Jt,{get when(){return!i()},get children(){return Ft(Rn,{get component(){return la()?qc:bc},get wallet(){return Sr()},get additionalRequest(){return s()},onBackClick:()=>{},backDisabled:!0})}})]}})]}})},$u=e=>{const t=$i(Nr,Wl.language);return customElements.define(zn,class extends HTMLElement{}),document.body.hasAttribute("ontouchstart")||document.body.setAttribute("ontouchstart",""),Ft(Ii.Provider,{value:t,get children(){return Ft(ga.Provider,{get value(){return e.tonConnectUI},get children(){return Ft($r.Provider,{get value(){return Wl.connector},get children(){return[Ft(Yn,{}),Ft(Hn,{theme:uo,get children(){return[Ft(Jt,{get when(){return Wl.buttonRootId},get children(){return Ft(En,{get mount(){return document.getElementById(Wl.buttonRootId)},get children(){return Ft(Pl,{})}})}}),Ft(Rn,{component:zn,get children(){return[Ft(xu,{}),Ft(Pu,{}),Ft(Nu,{})]}})]}})]}})}})}})},Iu=()=>{setTimeout((()=>br({status:"opened",closeReason:null})))},Uu=e=>{setTimeout((()=>br({status:"closed",closeReason:e})))},Wu=e=>{setTimeout((()=>_r({status:"opened",closeReason:null,walletInfo:e})))},ju=e=>{setTimeout((()=>_r({status:"closed",closeReason:e})))},Bu=e=>{setTimeout((()=>Or(e)))},Du=()=>{setTimeout((()=>Or(null)))},Hu=()=>Rr(),Vu=()=>Lr(null),Ku=(e,t)=>function(e,t,n,r={}){let o;return ft((r=>{o=r,t===document?e():pn(t,e(),t.firstChild?null:void 0,n)}),r.owner),()=>{o(),t.textContent=""}}((()=>Ft($u,{tonConnectUI:t})),document.getElementById(e));class Fu{constructor(e){__publicField(this,"connector"),__publicField(this,"setConnectRequestParametersCallback"),__publicField(this,"consumers",[]),__publicField(this,"tracker"),__publicField(this,"state",yr()),this.connector=e.connector,this.tracker=e.tracker,this.setConnectRequestParametersCallback=e.setConnectRequestParametersCallback,mt((()=>{const e=yr();this.state=e,this.consumers.forEach((t=>t(e)))}))}open(){return __async(this,null,(function*(){this.tracker.trackConnectionStarted();const e=(yield this.connector.getWallets()).find(Ce);return e?this.connectEmbeddedWallet(e):this.openWalletsModal()}))}close(e="action-cancelled"){"action-cancelled"===e&&this.tracker.trackConnectionError("Connection was cancelled"),Uu(e)}onStateChange(e){return this.consumers.push(e),()=>{this.consumers=this.consumers.filter((t=>t!==e))}}connectEmbeddedWallet(e){const t=t=>{Lr(e),this.connector.connect({jsBridgeKey:e.jsBridgeKey},t)},n=Wl.connectRequestParameters;"loading"===(null==n?void 0:n.state)?this.setConnectRequestParametersCallback(t):t(null==n?void 0:n.value)}openWalletsModal(){return __async(this,null,(function*(){return xo()&&_o(),Iu(),new Promise((e=>{const t=this.onStateChange((n=>{const{status:r}=n;"opened"===r&&(t(),e())}))}))}))}}class qu{constructor(e){__publicField(this,"connector"),__publicField(this,"consumers",[]),this.connector=e.connector,mt((()=>{const e=Ar();this.consumers.forEach((t=>t(e)))}))}onStateChange(e){return this.consumers.push(e),()=>{this.consumers=this.consumers.filter((t=>t!==e))}}}class zu{constructor(e){__publicField(this,"connector"),__publicField(this,"setConnectRequestParametersCallback"),__publicField(this,"consumers",[]),__publicField(this,"tracker"),__publicField(this,"state",xr()),this.connector=e.connector,this.tracker=e.tracker,this.setConnectRequestParametersCallback=e.setConnectRequestParametersCallback,mt((()=>{const e=xr();this.state=e,this.consumers.forEach((t=>t(e)))}))}open(e){return __async(this,null,(function*(){this.tracker.trackConnectionStarted();const t=Dl(yield this.connector.getWallets(),Wl.walletsListConfiguration),n=t.find(Ce);if(!!n)return this.connectEmbeddedWallet(n);const r=t.filter(_e).find((t=>Fl(t,e)));if(!!r)return this.openSingleWalletModal(r);const o=`Trying to open modal window with unknown wallet "${e}".`;throw this.tracker.trackConnectionError(o),new rr(o)}))}close(e="action-cancelled"){"action-cancelled"===e&&this.tracker.trackConnectionError("Connection was cancelled"),ju("action-cancelled")}onStateChange(e){return this.consumers.push(e),()=>{this.consumers=this.consumers.filter((t=>t!==e))}}connectEmbeddedWallet(e){const t=t=>{Lr(e),this.connector.connect({jsBridgeKey:e.jsBridgeKey},t)},n=Wl.connectRequestParameters;"loading"===(null==n?void 0:n.state)?this.setConnectRequestParametersCallback(t):t(null==n?void 0:n.value)}openSingleWalletModal(e){return __async(this,null,(function*(){return xo()&&_o(),Wu(e),new Promise((e=>{const t=this.onStateChange((n=>{const{status:r}=n;"opened"===r&&(t(),e())}))}))}))}}class Zu{constructor(e){var t;__publicField(this,"eventPrefix","ton-connect-ui-"),__publicField(this,"tonConnectUiVersion"),__publicField(this,"tonConnectSdkVersion",null),__publicField(this,"eventDispatcher"),this.eventDispatcher=null!=(t=null==e?void 0:e.eventDispatcher)?t:new Ve,this.tonConnectUiVersion=e.tonConnectUiVersion,this.init().catch()}get version(){return Ae({ton_connect_sdk_lib:this.tonConnectSdkVersion,ton_connect_ui_lib:this.tonConnectUiVersion})}init(){return __async(this,null,(function*(){try{yield this.setRequestVersionHandler(),this.tonConnectSdkVersion=yield this.requestTonConnectSdkVersion()}catch(Gu){}}))}setRequestVersionHandler(){return __async(this,null,(function*(){yield this.eventDispatcher.addEventListener("ton-connect-ui-request-version",(()=>__async(this,null,(function*(){yield this.eventDispatcher.dispatchEvent("ton-connect-ui-response-version",Le(this.tonConnectUiVersion))}))))}))}requestTonConnectSdkVersion(){return __async(this,null,(function*(){return new Promise(((e,t)=>__async(this,null,(function*(){try{yield this.eventDispatcher.addEventListener("ton-connect-response-version",(t=>{e(t.detail.version)}),{once:!0}),yield this.eventDispatcher.dispatchEvent("ton-connect-request-version",{type:"request-version"})}catch(Gu){t(Gu)}}))))}))}dispatchUserActionEvent(e){var t;try{null==(t=this.eventDispatcher)||t.dispatchEvent(`${this.eventPrefix}${e.type}`,e).catch()}catch(Gu){}}trackConnectionStarted(...e){try{const t=Me(this.version,...e);this.dispatchUserActionEvent(t)}catch(Gu){}}trackConnectionCompleted(...e){try{const t=Ne(this.version,...e);this.dispatchUserActionEvent(t)}catch(Gu){}}trackConnectionError(...e){try{const t=Pe(this.version,...e);this.dispatchUserActionEvent(t)}catch(Gu){}}trackConnectionRestoringStarted(...e){try{const t=$e(this.version,...e);this.dispatchUserActionEvent(t)}catch(Gu){}}trackConnectionRestoringCompleted(...e){try{const t=Ie(this.version,...e);this.dispatchUserActionEvent(t)}catch(Gu){}}trackConnectionRestoringError(...e){try{const t=Ue(this.version,...e);this.dispatchUserActionEvent(t)}catch(Gu){}}trackDisconnection(...e){try{const t=He(this.version,...e);this.dispatchUserActionEvent(t)}catch(Gu){}}trackTransactionSentForSignature(...e){try{const t=je(this.version,...e);this.dispatchUserActionEvent(t)}catch(Gu){}}trackTransactionSigned(...e){try{const t=Be(this.version,...e);this.dispatchUserActionEvent(t)}catch(Gu){}}trackTransactionSigningFailed(...e){try{const t=De(this.version,...e);this.dispatchUserActionEvent(t)}catch(Gu){}}}e.BadRequestError=B,e.BrowserEventDispatcher=Ve,e.FetchWalletsError=K,e.LocalstorageNotFoundError=V,e.ParseHexError=q,e.THEME=Tn,e.TonConnect=Fe,e.TonConnectError=N,e.TonConnectUI=class{constructor(e){if(__publicField(this,"walletInfoStorage",new wr),__publicField(this,"preferredWalletStorage",new mr),__publicField(this,"tracker"),__publicField(this,"walletInfo",null),__publicField(this,"systemThemeChangeUnsubscribe",null),__publicField(this,"actionsConfiguration"),__publicField(this,"walletsList"),__publicField(this,"connectRequestParametersCallback"),__publicField(this,"connector"),__publicField(this,"modal"),__publicField(this,"singleWalletModal"),__publicField(this,"transactionModal"),__publicField(this,"connectionRestored",Promise.resolve(!1)),e&&"connector"in e&&e.connector)this.connector=e.connector;else{if(!(e&&"manifestUrl"in e&&e.manifestUrl))throw new rr("You have to specify a `manifestUrl` or a `connector` in the options.");this.connector=new Fe({manifestUrl:e.manifestUrl,eventDispatcher:null==e?void 0:e.eventDispatcher})}this.tracker=new Zu({eventDispatcher:null==e?void 0:e.eventDispatcher,tonConnectUiVersion:"2.0.5"}),this.modal=new Fu({connector:this.connector,tracker:this.tracker,setConnectRequestParametersCallback:e=>{this.connectRequestParametersCallback=e}}),this.singleWalletModal=new zu({connector:this.connector,tracker:this.tracker,setConnectRequestParametersCallback:e=>{this.connectRequestParametersCallback=e}}),this.transactionModal=new qu({connector:this.connector}),this.walletsList=this.getWallets(),this.walletsList.then((e=>{return cr((t=e.map((e=>e.imageUrl)),[...new Set(t)]));var t}));const t=this.normalizeWidgetRoot(null==e?void 0:e.widgetRootId);this.subscribeToWalletChange(),!1!==(null==e?void 0:e.restoreConnection)&&(this.connectionRestored=function(e){return __async(this,null,(function*(){return yield new Promise((e=>requestAnimationFrame(e))),e()}))}((()=>__async(this,null,(function*(){return this.tracker.trackConnectionRestoringStarted(),yield this.connector.restoreConnection(),this.connector.connected?this.tracker.trackConnectionRestoringCompleted(this.wallet):(this.tracker.trackConnectionRestoringError("Connection was not restored"),this.walletInfoStorage.removeWalletInfo()),this.connector.connected}))))),this.uiOptions=co(e,{uiPreferences:{theme:"SYSTEM"}});const n=this.preferredWalletStorage.getPreferredWalletAppName();jl({connector:this.connector,preferredWalletAppName:n}),Ku(t,this)}static getWallets(){return Fe.getWallets()}get connected(){return this.connector.connected}get account(){return this.connector.account}get wallet(){return this.connector.wallet?__spreadValues(__spreadValues({},this.connector.wallet),this.walletInfo):null}set uiOptions(e){var t,n,r,o,i,s,a;this.checkButtonRootExist(e.buttonRootId),this.actionsConfiguration=e.actionsConfiguration,(null==(t=e.uiPreferences)?void 0:t.theme)?"SYSTEM"!==(null==(n=e.uiPreferences)?void 0:n.theme)?(null==(r=this.systemThemeChangeUnsubscribe)||r.call(this),po(e.uiPreferences.theme,e.uiPreferences.colorsSet)):(po(window.matchMedia&&window.matchMedia("(prefers-color-scheme: light)").matches?Tn.LIGHT:Tn.DARK,e.uiPreferences.colorsSet),this.systemThemeChangeUnsubscribe||(this.systemThemeChangeUnsubscribe=function(e){const t=t=>e(t.matches?Tn.DARK:Tn.LIGHT);return window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",t),()=>window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change",t)}(po))):(null==(o=e.uiPreferences)?void 0:o.colorsSet)&&(s=e.uiPreferences.colorsSet,go[Tn.DARK]=co(s[Tn.DARK],go[Tn.DARK]),go[Tn.LIGHT]=co(s[Tn.LIGHT],go[Tn.LIGHT]),ho((e=>({colors:co(go[e.theme],fo[e.theme])})))),(null==(i=e.uiPreferences)?void 0:i.borderRadius)&&(a=e.uiPreferences.borderRadius,ho({borderRadius:a})),jl((t=>{var n,r;const o=co(__spreadValues(__spreadValues(__spreadValues(__spreadValues({},e.language&&{language:e.language}),!!(null==(n=e.actionsConfiguration)?void 0:n.returnStrategy)&&{returnStrategy:e.actionsConfiguration.returnStrategy}),!!(null==(r=e.actionsConfiguration)?void 0:r.twaReturnUrl)&&{twaReturnUrl:e.actionsConfiguration.twaReturnUrl}),!!e.walletsListConfiguration&&{walletsListConfiguration:e.walletsListConfiguration}),Dr(t));return void 0!==e.buttonRootId&&(o.buttonRootId=e.buttonRootId),void 0!==e.enableAndroidBackHandler&&(o.enableAndroidBackHandler=e.enableAndroidBackHandler),o}))}setConnectRequestParameters(e){var t;jl({connectRequestParameters:e}),"ready"!==(null==e?void 0:e.state)&&e||null==(t=this.connectRequestParametersCallback)||t.call(this,null==e?void 0:e.value)}getWallets(){return __async(this,null,(function*(){return this.connector.getWallets()}))}onStatusChange(e,t){return this.connector.onStatusChange((t=>__async(this,null,(function*(){if(t){const n=yield this.getSelectedWalletInfo(t);e(__spreadValues(__spreadValues({},t),n||this.walletInfoStorage.getWalletInfo()))}else e(t)}))),t)}openModal(){return __async(this,null,(function*(){return this.modal.open()}))}closeModal(e){this.modal.close(e)}onModalStateChange(e){return this.modal.onStateChange(e)}get modalState(){return this.modal.state}openSingleWalletModal(e){return __async(this,null,(function*(){return this.singleWalletModal.open(e)}))}closeSingleWalletModal(e){this.singleWalletModal.close(e)}onSingleWalletModalStateChange(e){return this.singleWalletModal.onStateChange(e)}get singleWalletModalState(){return this.singleWalletModal.state}connectWallet(){return __async(this,null,(function*(){const e=(yield this.getWallets()).find(Ce);return e?yield this.connectEmbeddedWallet(e):yield this.connectExternalWallet()}))}disconnect(){return this.tracker.trackDisconnection(this.wallet,"dapp"),Du(),Vu(),this.walletInfoStorage.removeWalletInfo(),this.connector.disconnect()}sendTransaction(e,t){return __async(this,null,(function*(){if(this.tracker.trackTransactionSentForSignature(this.wallet,e),!this.connected)throw this.tracker.trackTransactionSigningFailed(this.wallet,e,"Wallet was not connected"),new rr("Connect wallet to send a transaction.");xo()&&_o();const{notifications:n,modals:r,returnStrategy:o,twaReturnUrl:i,skipRedirectToWallet:s}=this.getModalsAndNotificationsConfiguration(t);Bu({name:"confirm-transaction",showNotification:n.includes("before"),openModal:r.includes("before"),sent:!1});const a=()=>{l.signal.aborted||(Bu({name:"confirm-transaction",showNotification:n.includes("before"),openModal:r.includes("before"),sent:!0}),this.walletInfo&&"universalLink"in this.walletInfo&&("universal-link"===this.walletInfo.openMethod||"custom-deeplink"===this.walletInfo.openMethod)&&(te(this.walletInfo.universalLink)?mc(this.walletInfo.universalLink,{returnStrategy:o,twaReturnUrl:i||Wl.twaReturnUrl,forceRedirect:!1}):vc(this.walletInfo.universalLink,this.walletInfo.deepLink,{returnStrategy:o,forceRedirect:!1},(()=>{}))))},l=new AbortController,c=this.onTransactionModalStateChange((e=>{(null==e?void 0:e.openModal)||(c(),e||l.abort())}));try{const t=yield this.waitForSendTransaction({transaction:e,signal:l.signal},a);return this.tracker.trackTransactionSigned(this.wallet,e,t),Bu({name:"transaction-sent",showNotification:n.includes("success"),openModal:r.includes("success")}),t}catch(Gu){throw Bu({name:"transaction-canceled",showNotification:n.includes("error"),openModal:r.includes("error")}),Gu instanceof N?Gu:(console.error(Gu),new rr("Unhandled error:"+Gu))}finally{c()}}))}connectEmbeddedWallet(e){return __async(this,null,(function*(){const t=t=>{Lr(e),this.connector.connect({jsBridgeKey:e.jsBridgeKey},t)},n=Wl.connectRequestParameters;return"loading"===(null==n?void 0:n.state)?this.connectRequestParametersCallback=t:t(null==n?void 0:n.value),yield this.waitForWalletConnection({ignoreErrors:!1})}))}connectExternalWallet(){return __async(this,null,(function*(){const e=new AbortController;Iu();const t=this.onModalStateChange((n=>{const{status:r,closeReason:o}=n;"opened"!==r&&(t(),"action-cancelled"===o&&e.abort())}));return yield this.waitForWalletConnection({ignoreErrors:!0,signal:e.signal})}))}waitForWalletConnection(e){return __async(this,null,(function*(){return new Promise(((t,n)=>{this.tracker.trackConnectionStarted();const{ignoreErrors:r=!1,signal:o=null}=e;if(o&&o.aborted)return this.tracker.trackConnectionError("Connection was cancelled"),n(new rr("Wallet was not connected"));const i=e=>__async(this,null,(function*(){if(e)this.tracker.trackConnectionCompleted(e),a(),t(e);else{if(this.tracker.trackConnectionError("Connection was cancelled"),r)return;a(),n(new rr("Wallet was not connected"))}})),s=e=>{this.tracker.trackConnectionError(e.message),r||(a(),n(e))},a=this.onStatusChange((e=>i(e)),(e=>s(e)));o&&o.addEventListener("abort",(()=>{a(),n(new rr("Wallet was not connected"))}),{once:!0})}))}))}waitForSendTransaction(e,t){return __async(this,null,(function*(){return new Promise(((n,r)=>{const{transaction:o,signal:i}=e;if(i.aborted)return this.tracker.trackTransactionSigningFailed(this.wallet,o,"Transaction was cancelled"),r(new rr("Transaction was not sent"));const s=e=>__async(this,null,(function*(){n(e)})),a=()=>{this.tracker.trackTransactionSigningFailed(this.wallet,o,"Transaction was cancelled"),r(new rr("Transaction was not sent"))};i.addEventListener("abort",a,{once:!0}),this.connector.sendTransaction(o,{onRequestSent:t,signal:i}).then((e=>(i.removeEventListener("abort",a),s(e)))).catch((e=>(i.removeEventListener("abort",a),(e=>{r(e)})(e))))}))}))}onTransactionModalStateChange(e){return this.transactionModal.onStateChange(e)}subscribeToWalletChange(){this.connector.onStatusChange((e=>__async(this,null,(function*(){var t;e?(yield this.updateWalletInfo(e),this.setPreferredWalletAppName((null==(t=this.walletInfo)?void 0:t.appName)||e.device.appName)):this.walletInfoStorage.removeWalletInfo()}))))}setPreferredWalletAppName(e){this.preferredWalletStorage.setPreferredWalletAppName(e),jl({preferredWalletAppName:e})}getSelectedWalletInfo(e){return __async(this,null,(function*(){let t,n=Hu();if(!n)return null;if("name"in n)t=n;else{const r=Dl(yield this.walletsList,Wl.walletsListConfiguration).find((t=>Fl(t,e.device.appName)));if(!r)throw new rr(`Cannot find WalletInfo for the '${e.device.appName}' wallet`);t=__spreadValues(__spreadValues({},r),n)}return t}))}updateWalletInfo(e){return __async(this,null,(function*(){const t=yield this.getSelectedWalletInfo(e);if(t)return this.walletInfo=t,void this.walletInfoStorage.setWalletInfo(t);const n=this.walletInfoStorage.getWalletInfo();this.walletInfo=n||((yield this.walletsList).find((t=>Fl(t,e.device.appName)))||null)}))}normalizeWidgetRoot(e){if(!e||!document.getElementById(e)){e="tc-widget-root";const t=document.createElement("div");t.id=e,document.body.appendChild(t)}return e}checkButtonRootExist(e){if(null!=e&&!document.getElementById(e))throw new rr(`${e} element not found in the document.`)}getModalsAndNotificationsConfiguration(e){var t,n,r,o,i,s;const a=["before","success","error"];let l=a;(null==(t=this.actionsConfiguration)?void 0:t.notifications)&&"all"!==(null==(n=this.actionsConfiguration)?void 0:n.notifications)&&(l=this.actionsConfiguration.notifications),(null==e?void 0:e.notifications)&&(l="all"===e.notifications?a:e.notifications);let c=["before"];(null==(r=this.actionsConfiguration)?void 0:r.modals)&&(c="all"===this.actionsConfiguration.modals?a:this.actionsConfiguration.modals),(null==e?void 0:e.modals)&&(c="all"===e.modals?a:e.modals);const u=(null==e?void 0:e.returnStrategy)||(null==(o=this.actionsConfiguration)?void 0:o.returnStrategy)||"back",d=(null==e?void 0:e.twaReturnUrl)||(null==(i=this.actionsConfiguration)?void 0:i.twaReturnUrl);let h=(null==e?void 0:e.skipRedirectToWallet)||(null==(s=this.actionsConfiguration)?void 0:s.skipRedirectToWallet)||"ios";return xo()&&(h="never"),{notifications:l,modals:c,returnStrategy:u,twaReturnUrl:d,skipRedirectToWallet:h}}},e.TonConnectUIError=rr,e.UnknownAppError=D,e.UnknownError=z,e.UserRejectsError=j,e.WalletAlreadyConnectedError=U,e.WalletNotConnectedError=W,e.WalletNotInjectedError=H,e.WalletsListManager=Se,e.WrongAddressError=F,e.createConnectionCompletedEvent=Ne,e.createConnectionErrorEvent=Pe,e.createConnectionRestoringCompletedEvent=Ie,e.createConnectionRestoringErrorEvent=Ue,e.createConnectionRestoringStartedEvent=$e,e.createConnectionStartedEvent=Me,e.createDisconnectionEvent=He,e.createRequestVersionEvent=Te,e.createResponseVersionEvent=Le,e.createTransactionSentForSignatureEvent=je,e.createTransactionSignedEvent=Be,e.createTransactionSigningFailedEvent=De,e.createVersionInfo=Ae,e.encodeTelegramUrlParameters=ne,e.isTelegramUrl=te,e.isWalletInfoCurrentlyEmbedded=Ce,e.isWalletInfoCurrentlyInjected=be,e.isWalletInfoInjectable=xe,e.isWalletInfoInjected=function(e){return"jsBridgeKey"in e},e.isWalletInfoRemote=_e,e.toUserFriendlyAddress=Ze,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1024
1024
  //# sourceMappingURL=tonconnect-ui.min.js.map