1import{b as q,c as G}from"./chunk-J6AYLYAP.js";import{a as H}from"./chunk-K3XWMAVN.js";import"./chunk-FZRSPJOY.js";import{b as R}from"./chunk-OJSZLP45.js";import{a as N}from"./chunk-FJODMKFF.js";import"./chunk-EYZBKYXI.js";import{a as A,c as I}from"./chunk-IRFE4S3G.js";import"./chunk-7GI3UHVV.js";import"./chunk-4OS3XI34.js";import{a as F}from"./chunk-4OLC42R2.js";import{a as z,b as X,c as Y}from"./chunk-53IM6ZZD.js";import{a as j,b as K}from"./chunk-DMT2HPWQ.js";import{c as W}from"./chunk-6MN5GHNC.js";import"./chunk-5RAZKGOK.js";import"./chunk-VZLSSRUN.js";import{m as L,o as O}from"./chunk-WLX3VRN2.js";import{na as U,oa as B}from"./chunk-EWQE2ILW.js";import"./chunk-YPIC2JXO.js";import{C as D,t as M,z as f}from"./chunk-OY4V5JEA.js";import{A as y,Da as C,Kb as x,L as b,Lb as v,Qb as P,Rb as e,Sb as i,Sc as T,Tb as h,W as V,Y as E,_b as _,ab as p,ac as u,cc as l,ha as d,ma as c,na as m,qc as r,rc as S,sb as k,wb as w,xa as g}from"./chunk-YVUFFV5V.js";import"./chunk-4CLCTAJ7.js";function Q(a,s){if(a&1){let n=_();e(0,"header",2)(1,"mat-icon",3),r(2,"error"),i(),e(3,"h1",4),r(4,"Something went wrong"),i(),e(5,"p",5),r(6),i()(),e(7,"button",6),u("click",function(){c(n);let t=l();return m(t.resendVerification())}),r(8,"Try again"),i()}if(a&2){let n=l();p(6),S(n.errorMessage())}}function Z(a,s){a&1&&(e(0,"header",2),h(1,"mat-progress-spinner",7),e(2,"p",5),r(3,"Sending verification email\u2026"),i()())}function $(a,s){a&1&&(e(0,"header",2),h(1,"mat-progress-spinner",7),e(2,"p",5),r(3,"Checking your verification status\u2026"),i()())}function ee(a,s){a&1&&(e(0,"header",2),h(1,"mat-progress-spinner",7),e(2,"p",5),r(3,"Clearing your unverified account\u2026"),i()())}function te(a,s){if(a&1){let n=_();e(0,"header",2)(1,"mat-icon",8),r(2,"hourglass_empty"),i(),e(3,"h1",4),r(4,"Still waiting?"),i(),e(5,"p",5),r(6," We stopped checking automatically after a while. Click below if you've already verified, or resend the link. "),i()(),e(7,"div",9)(8,"button",6),u("click",function(){c(n);let t=l();return m(t.checkNow())}),r(9,"I already verified my email"),i(),e(10,"button",10),u("click",function(){c(n);let t=l();return m(t.resendVerification())}),r(11,"Resend verification email"),i(),e(12,"button",11),u("click",function(){c(n);let t=l();return m(t.resumePolling())}),r(13,"Keep checking automatically"),i()(),e(14,"div",12)(15,"button",11),u("click",function(){c(n);let t=l();return m(t.continueToApp())}),r(16,"Back to TraceLog"),i(),e(17,"button",13),u("click",function(){c(n);let t=l();return m(t.startOverWithDifferentEmail())}),r(18,"Wrong email? Start over"),i(),e(19,"button",13),u("click",function(){c(n);let t=l();return m(t.goToLogin())}),r(20,"Or sign in with another account"),i()()}}function ie(a,s){a&1&&h(0,"tl-banner",16),a&2&&P("dismissible",!1)}function re(a,s){if(a&1){let n=_();e(0,"header",2)(1,"mat-icon",14),r(2,"mark_email_read"),i(),e(3,"h1",4),r(4,"Check your email"),i(),e(5,"p",5),r(6," We sent a verification link to "),e(7,"span",15),r(8),i(),r(9," \u2014 click it and we'll continue automatically. "),i(),x(10,ie,1,1,"tl-banner",16),i(),e(11,"div",9)(12,"button",10),u("click",function(){c(n);let t=l();return m(t.resendVerification())}),r(13,"Resend verification email"),i()(),e(14,"div",12)(15,"button",11),u("click",function(){c(n);let t=l();return m(t.continueToApp())}),r(16,"Back to TraceLog"),i(),e(17,"button",13),u("click",function(){c(n);let t=l();return m(t.startOverWithDifferentEmail())}),r(18,"Wrong email? Start over"),i(),e(19,"button",13),u("click",function(){c(n);let t=l();return m(t.goToLogin())}),r(20,"Or sign in with another account"),i()()}if(a&2){let n=l();p(8),S(n.email()),p(2),v(n.status()==="resent"?10:-1)}}var ne=5e3,ae=1800*1e3,J=class a extends W{authSrv=d(R);authApi=d(N);authIntentSrv=d(H);bootstrapStateSrv=d(D);trackingSrv=d(I);router=d(M);status=g("sent");email=T(()=>this.stateSrv.user()?.email??"your email");errorMessage=g("");pollSub;pollStartedAt=0;navigated=!1;ngOnInit(){this.startPolling()}resumePolling(){this.pollSub&&!this.pollSub.closed||(this.status.set("sent"),this.startPolling())}ngOnDestroy(){this.pollSub?.unsubscribe()}resendVerification(){this.status.set("resending"),this.authApi.resendVerification().pipe(f(this.destroyRef)).subscribe({next:()=>{this.status.set("resent"),this.toastSrv.success("Verification email sent")},error:s=>{this.errorMessage.set(this.getErrorMessage(s,"Couldn't send verification email")),this.status.set("error")}})}checkNow(){this.status.set("checking"),this.authSrv.refreshCurrentUser(!0).pipe(b(()=>{this.status()==="checking"&&!this.navigated&&this.status.set("sent")}),f(this.destroyRef)).subscribe({next:s=>{s.isVerified?this.handleVerified():this.navigated||this.toastSrv.info("Still waiting on the verification email. Check your inbox or resend it.")},error:()=>{}})}goToLogin(){this.pollSub?.unsubscribe(),this.authSrv.logout()}continueToApp(){this.router.navigateByUrl(q(this.bootstrapStateSrv.projects()))}startOverWithDifferentEmail(){this.status()!=="discarding"&&this.dialogSrv.confirm({title:"Use a different email",description:"We'll delete this unverified account. You can sign up again with the right email in 2 minutes.",confirmLabel:"Delete and start over",cancelLabel:"Keep this account",variant:"danger"}).pipe(f(this.destroyRef)).subscribe(s=>{s&&this.runDiscard()})}runDiscard(){this.pollSub?.unsubscribe(),this.status.set("discarding"),this.authApi.discardAccount().pipe(f(this.destroyRef)).subscribe({next:()=>{this.navigated=!0,this.toastSrv.success("Account cleared. Sign up with your correct email."),this.authSrv.logout("/auth/register")},error:s=>{this.errorMessage.set(this.getErrorMessage(s,"Couldn't delete this account")),this.status.set("error")}})}startPolling(){this.pollStartedAt=Date.now(),this.pollSub=y(ne).pipe(E(()=>!this.navigated&&Date.now()-this.pollStartedAt<ae),V(()=>this.authSrv.refreshCurrentUser(!0)),f(this.destroyRef)).subscribe({next:s=>{s.isVerified&&this.handleVerified()},error:()=>{},complete:()=>{this.navigated||this.status.set("idle")}})}handleVerified(){this.navigated||(this.navigated=!0,this.pollSub?.unsubscribe(),this.trackingSrv.track(A.EMAIL_VERIFIED),this.toastSrv.success("Email verified"),this.router.navigateByUrl(G(this.authIntentSrv.resolveUrl(),this.bootstrapStateSrv.projects())))}static \u0275fac=(()=>{let s;return function(o){return(s||(s=C(a)))(o||a)}})();static \u0275cmp=k({type:a,selectors:[["app-verify-email"]],features:[w],decls:9,vars:1,consts:[["appearance","outlined",1,"w-full"],[1,"flex","w-full","flex-col","gap-6"],[1,"flex","flex-col","items-center","gap-3","text-center"],[1,"material-symbols-outlined","icon-2xl","text-status-critical"],[1,"text-2xl","font-semibold","text-text-primary"],[1,"text-sm","text-text-secondary"],["mat-flat-button","",1,"w-full",3,"click"],["mode","indeterminate","diameter","32"],[1,"material-symbols-outlined","icon-2xl","text-status-warning"],[1,"flex","flex-col","gap-3"],["mat-stroked-button","",1,"w-full",3,"click"],["mat-button","",3,"click"],[1,"flex","flex-col","items-center","gap-1"],["mat-button","",1,"text-xs!",3,"click"],[1,"material-symbols-outlined","icon-2xl","text-primary-500"],[1,"font-medium","text-text-primary"],["variant","success","title","Verification email sent",3,"dismissible"]],template:function(n,o){if(n&1&&(e(0,"mat-card",0)(1,"mat-card-content")(2,"div",1),x(3,Q,9,1)(4,Z,4,0,"header",2)(5,$,4,0,"header",2)(6,ee,4,0,"header",2)(7,te,21,0)(8,re,21,2),i()()()),n&2){let t;p(3),v((t=o.status())==="error"?3:t==="resending"?4:t==="checking"?5:t==="discarding"?6:t==="idle"?7:8)}},dependencies:[O,L,Y,z,X,B,U,K,j,F],encapsulation:2,changeDetection:0})};export{J as VerifyEmailPage};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.