| 12 |
- import{z as N,C as b,D as _,E as q,u as H,F as O,G as I,n as W,H as R,J as $,K as U,I as z,L as G,M as B,e as V,N as j,O as J,Q as K,j as Q}from"./index-D_EGaVbS.js";function Y(){const e=N("back");return e.addEventListener("click",async()=>{await b.set({should_animate_main:1});const t=_(await b.get("previous_account"));await b.delete("previous_account");const i=document.getElementById("auth-pages");i.classList.add("auth-pages-exit"),await q(),i.classList.add("auth-pages-exiting"),await H(200),O(t)}),e}function T(e,t){return z.isRTL&&(e=-e),`translate3d(${e}px, ${t}px, 0)`}const Z={callback:(e,t,i)=>{const d=t.getBoundingClientRect().width,o=[e,t];return i&&o.reverse(),o[0].style.filter="brightness(80%)",o[0].style.transform=T(-d*.25,0),o[1].style.transform=T(d,0),e.classList.add("active"),e.offsetWidth,e.style.transform="",e.style.filter="",()=>{t.style.transform=t.style.filter=""}},animateFirst:!1},X={callback:(e,t,i)=>{const d=t.getBoundingClientRect().width,o=[e,t];return i&&o.reverse(),o[0].style.transform=T(-d,0),o[1].style.transform=T(d,0),e.classList.add("active"),e.offsetWidth,e.style.transform="",()=>{t.style.transform=""}},animateFirst:!1},C={callback:(e,t,i)=>{const d=t.getBoundingClientRect().width,o=[e,t],u=["slide-right","slide-left"];return i&&(o.reverse(),u.reverse()),o[0].style.transform=T(-d,0),o[1].style.transform=T(d,0),e.classList.add("active",u[0]),t.classList.add(u[1]),e.offsetWidth,e.style.transform="",e.classList.remove(u[0]),()=>{t.style.transform="",t.classList.remove(u[1])}},animateFirst:!1},tt={navigation:Z,premiumTabs:C,tabs:X},et=e=>{let{content:t,type:i,transitionTime:d,onTransitionEnd:o,onTransitionStart:u,onTransitionStartAfter:S,isHeavy:y=!0,once:A=!1,withAnimationListener:L=!0,listenerSetter:w,animateFirst:P=!1}=e;const v=i,{callback:l,animateFirst:n}=tt[v]||{};t.dataset.animation=v,n!==void 0&&(P=n);const m=new Map;let c,a=null;if(L){const s=l?"transitionend":"animationend",f=p=>{W(p),!(p.target.parentElement!==t||(m.get(p.target)?.(),p.target!==a))&&(!c&&y||(c&&(c.resolve(),c=void 0),o?.(g.prevId()),t.classList.remove("animating","backwards","disable-hover"),A&&(w?w.removeManual(t,s,f):t.removeEventListener(s,f),a=c=void 0,m.clear())))};w?w.add(t)(s,f):t.addEventListener(s,f)}function g(s,f=!0,p){p&&(a=p),s instanceof HTMLElement&&(s=I(s));const E=g.prevId();if(s===E)return!1;u?.(s);const r=t.children[s];if((!R.isAvailable("animations")||E===-1&&!P)&&(f=!1),!L){const h=t.dataset.timeout;h!==void 0&&clearTimeout(+h),delete t.dataset.timeout}if(!f){a?a.classList.remove("active","to","from"):r&&m.get(r)?.(),r&&(r.classList.remove("to","from"),r.classList.add("active")),t.classList.remove("animating","backwards","disable-hover"),a=r,o?.(s);return}L||(t.dataset.timeout=""+window.setTimeout(()=>{r.classList.remove("to"),a&&a.classList.remove("from"),t.classList.remove("animating","backwards","disable-hover"),delete t.dataset.timeout},d)),a&&(a.classList.remove("to"),a.classList.add("from")),t.classList.add("animating");const F=E<s;t.classList.toggle("backwards",!F);let D;if(r&&(l?D=l(r,a,F):r.classList.add("active"),S?.(s),r.classList.remove("from"),r.classList.add("to")),r){const h=r.dataset.transitionTimeout;h&&clearTimeout(+h),m.set(r,()=>{r.classList.remove("to"),m.delete(r)})}if(a){let h;const k=a,M=()=>{clearTimeout(h),k.classList.remove("active","from"),D?.(),m.delete(k)};r?(h=window.setTimeout(M,d+100),m.set(k,M)):(h=window.setTimeout(M,d+100),m.set(k,()=>{clearTimeout(h),m.delete(k)})),k.dataset.transitionTimeout=""+h,y&&(c||(c=$()),U(c,d*2))}a=r}return g.prevId=()=>a?I(a):-1,g.getFrom=()=>a,g.setFrom=s=>a=s,g};function st(e,t,i,d,o=200,u,S){const y=et({content:t,type:e||t.dataset.animation==="tabs"?"tabs":"navigation",transitionTime:o,onTransitionEnd:d,listenerSetter:S});if(!e)return y;const A=new Proxy(y,{apply:(v,l,n)=>{const m=n[1]!==void 0?n[1]:!0;let c,a;n[0]instanceof HTMLElement?(c=I(n[0]),a=n[0]):(c=+n[0],a=e.querySelector(`[data-tab="${c}"]`)||e.children[c]),L(a,c,m)}}),L=async(v,l,n=!0)=>{const m=t.children[l];if(i){const s=i(l,m,n),f=s instanceof Promise?await s:s;if(f!==void 0&&!f)return}u&&u.scrollIntoViewNew({element:v.parentElement.children[l],position:"center",forceDirection:n?void 0:G.Static,forceDuration:o,axis:"x"}),R.isAvailable("animations")||(n=!1);const c=y.prevId();if(v.classList.contains("active")||l===c)return!1;const a=n?B:s=>s(),g=e.querySelector(P.toLowerCase()+".active");g&&a(()=>{g.classList.remove("active")}),w&&c!==-1&&n&&a(()=>{const s=v.querySelector("i"),f=v.parentElement.children[c].querySelector("i");f.classList.remove("animate"),s.classList.remove("animate");const p=f.parentElement.parentElement.offsetLeft-s.parentElement.parentElement.offsetLeft,E=f.clientWidth/s.clientWidth;s.style.transform=`translate3d(${p}px, 0, 0) scale3d(${E}, 1, 1)`,B(()=>{s.classList.add("animate"),s.style.transform="none"})}),a(()=>{v.classList.add("active")}),y(l,n)},w=!e.classList.contains("no-stripe"),P=e.firstElementChild.tagName;return V(e,v=>{let l=v.target;if(l=j(l,e),!l)return!1;let n;if(l.dataset.tab){if(n=+l.dataset.tab,n===-1)return!1}else n=I(l);L(l,n)},{listenerSetter:S}),A}class it{constructor(){this.pageId=-1,this.pagesDiv=document.getElementById("auth-pages"),this.scrollableDiv=this.pagesDiv.querySelector(".scrollable"),this.selectTab=st(null,this.scrollableDiv.querySelector(".tabs-container"),null,()=>{this.page?.onShown&&this.page.onShown()})}setPage(t){if(t.isAuthPage){this.pagesDiv.style.display="";const i=I(t.pageEl);if(this.pageId===i)return;this.selectTab(i),this.pageId=i,this.scrollableDiv&&K({container:this.scrollableDiv,element:this.scrollableDiv.firstElementChild,position:"start"})}else this.pagesDiv.style.display="none",t.pageEl.style.display="",this.pageId=-1;this.page=t}}const x=new it;J.pagesManager=x;class nt{constructor(t,i,d,o,u){this.isAuthPage=i,this.onFirstMount=d,this.onMount=o,this.onShown=u,this.pageEl=document.body.querySelector("."+t)}async mount(...t){if(this.onMount){const i=this.onMount(...t);i instanceof Promise&&await i}this.installPromise??(this.installPromise=this.install(...t)),await this.installPromise,x.setPage(this)}async install(...t){if(this.onFirstMount)try{const i=this.onFirstMount(...t);i instanceof Promise&&await i}catch(i){console.error("PAGE MOUNT ERROR:",i)}this.mountBackButtonIfAuth()}mountBackButtonIfAuth(){if(!this.isAuthPage||Q()===1)return;const t=document.getElementById("auth-pages-close");t?.style.removeProperty("display"),t?.replaceChildren(),t?.append(Y())}}export{nt as P,et as T,st as h};
- //# sourceMappingURL=page-C6VUMrJP.js.map
|