import{c as Ci,d as Fe,e as yi}from"./chunk-TKCG4RR3.js";import{Ba as gi,Ca as hi,Da as vi,F as ye,Fa as Ie,G as _e,Ob as He,P as ci,Q as di,R as pi,S as qe,U as Te,Ua as be,Va as ke,Xa as je,Ya as We,Za as R,_a as M,c as pe,ca as mi,da as ui,e as x,ea as xe,f as me,g as ue,i as fe,k as Ue,l as U,lc as Ke,n as ge,na as fi,r as he,sa as Ge,u as ve,z as Ce}from"./chunk-W2ZDDUN5.js";import{$b as X,$f as $e,Ba as y,Bc as ri,Bf as Be,Ca as _,Cd as le,Ef as ce,Fa as Ye,Fd as Ve,Ff as Ne,Gd as H,Gf as Pe,Hb as d,Ib as s,Id as N,Jb as f,Kb as w,Kf as ai,Lb as S,Lf as de,Nb as z,Nc as Me,Of as P,Qc as j,Sb as T,Tb as h,Tf as ie,Tg as li,Uf as K,Wb as Y,Wc as W,Xa as Ee,Xf as Oe,Yf as si,Yg as Q,Zg as O,_a as o,_b as J,ac as Z,ag as te,bc as Xe,cc as p,d as ne,dc as Ze,dd as B,ec as m,fb as A,fc as ei,gh as E,ha as Le,hb as b,he as L,hh as $,ib as k,ic as ii,jc as ti,kc as ni,la as V,lb as Je,m as Se,n as oe,na as De,nb as C,nc as q,oc as G,pe as ee,ra as re,sa as I,tb as F,ua as ae,ub as l,uc as r,ue as D,va as u,vc as a,wb as se,wc as Re,yc as oi,yf as Ae}from"./chunk-5LB5MWMX.js";var ki=["loginForm"],_i=e=>({label:e}),Ti=()=>({cxRoute:"forgotPassword"});function Fi(e,v){e&1&&f(0,"cx-spinner",11)}function wi(e,v){if(e&1&&f(0,"input",13),e&2){let i=h(2);l("name",i.csrf.parameterName)}}function Si(e,v){if(e&1&&(w(0),C(1,wi,1,1,"input",12),S()),e&2){let i=h();o(),l("ngIf",i.csrf)}}var xi=()=>({cxRoute:"login"});function Li(e,v){if(e&1){let i=z();w(0),d(1,"div",3),p(2),r(3,"async"),s(),d(4,"cx-page-slot",4),T("cxDomChange",function(n){let c=y(i).ngIf,g=h(2);return _(g.onRootNavBtnAdded(n,c))}),s(),S()}if(e&2){let i=h(2);o(2),m(" ",a(3,1,i.greeting$)," ")}}function Di(e,v){if(e&1&&(w(0),C(1,Li,5,3,"ng-container",2),r(2,"async"),S()),e&2){let i=h();o(),l("ngIf",a(2,1,i.greeting$))}}function Ei(e,v){e&1&&(w(0),d(1,"a",5),r(2,"cxUrl"),p(3),r(4,"cxTranslate"),s(),S()),e&2&&(o(),l("routerLink",a(2,2,q(6,xi))),o(2),Ze(a(4,4,"miniLogin.signInRegister")))}function Ri(e,v){if(e&1&&C(0,Ei,5,7,"ng-container",2),e&2){let i=h();l("ngIf",!i.usingASMClient())}}var Mi=()=>({cxRoute:"logout"});function Vi(e,v){if(e&1&&(w(0),d(1,"div",2),p(2),s(),d(3,"a",3),r(4,"cxUrl"),p(5),r(6,"cxTranslate"),s(),S()),e&2){let i=v.ngIf;o(2),ei("",i.title,"",i.name,""),o(),l("routerLink",a(4,4,q(8,Mi))),o(2),m("",a(6,6,"myAccountV2User.signOut")," ")}}function Ai(e,v){e&1&&f(0,"cx-spinner",9)}var Bi=["noReceiveCodeLink"],Ni=["resendLink"],Pi=["verificationTokenForm"],Oi=e=>({seconds:e}),$i=e=>({"disabled-link":e}),Ui=e=>({waitTime:e});function qi(e,v){e&1&&f(0,"cx-spinner",16)}function Gi(e,v){if(e&1&&(d(0,"div",17),p(1),r(2,"cxTranslate"),s()),e&2){let i=h();o(),m(" ",Re(2,1,"register.rateLimitForRegistrationMessage",G(4,Oi,i.waitTimeForRateLimit))," ")}}function ji(e,v){if(e&1&&f(0,"input",19),e&2){let i=h(2);l("name",i.csrf.parameterName)}}function Wi(e,v){if(e&1&&(w(0),C(1,ji,1,1,"input",18),S()),e&2){let i=h();o(),l("ngIf",i.csrf)}}function Hi(e,v){if(e&1&&(w(0),p(1),r(2,"cxTranslate"),S()),e&2){let i=h(2);o(),m(" ",Re(2,1,"verificationTokenForm.sendRateLime",G(4,Ui,i.waitTime))," ")}}function Ki(e,v){if(e&1){let i=z();d(0,"div",20)(1,"div",21)(2,"span",22)(3,"a",23,1),T("keydown.enter",function(){y(i);let n=h();return _(n.resendOTP())})("keydown.space",function(){y(i);let n=h();return _(n.resendOTP())})("click",function(){y(i);let n=h();return _(n.resendOTP())}),p(5),r(6,"cxTranslate"),s(),C(7,Hi,3,6,"ng-container",24),s()(),d(8,"div",25)(9,"a",26,2),T("keydown",function(n){y(i);let c=h();return _(c.onOpenInfoDailogKeyDown(n))})("click",function(){y(i);let n=h();return _(n.openInfoDailog())}),p(11),r(12,"cxTranslate"),s()()()}if(e&2){let i=h();o(3),l("ngClass",G(8,$i,i.isResendDisabled)),o(2),m(" ",a(6,4,"verificationTokenForm.resend")," "),o(2),l("ngIf",i.isResendDisabled),o(4),m(" ",a(12,6,"verificationTokenForm.noReceiveCode")," ")}}var Qi=(()=>{class e{constructor(){this.featureConfigService=u(ee),this.windowRef=u(D),this.router=u(Ve),this.semanticPathService=u(ai)}getPath(){return this.semanticPathService.get("loginForm")}canActivate(){return this.featureConfigService.isEnabled("authorizationCodeFlowByDefault")&&this.windowRef.localStorage?.getItem(Ke)==="true"?(this.windowRef.localStorage.removeItem(Ke),oe(this.router.createUrlTree([this.getPath()],{queryParams:{forced:!0}}))):oe(!0)}static{this.\u0275fac=function(t){return new(t||e)}}static{this.\u0275prov=re({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})(),Qe=(()=>{class e{get csrf(){return this.csrfStateService.get()}constructor(i,t,n){this.auth=i,this.globalMessage=t,this.winRef=n,this.authConfigService=u(Ae),this.featureConfigService=u(ee),this.csrfStateService=u(Oe),this.router=u(Ve),this.activatedRoute=u(le),this.customFormValidErrors=["bad_credentials","account_disabled"],this.busy$=new ne(!1),this.isUpdating$=this.busy$.pipe(V(c=>{let g=this.winRef.nativeWindow?.history?.state?.newUid;g&&this.form.patchValue({userId:g}),c===!0?this.form.disable():this.form.enable()})),this.form=new fe({userId:new U("",[x.required,He.emailValidator]),password:new U("",x.required)}),this.featureConfigService.isEnabled("authorizationCodeFlowByDefault")&&this.initCustomLogin()}login(i){if(!this.form.valid){this.form.markAllAsTouched();return}this.featureConfigService.isEnabled("authorizationCodeFlowByDefault")&&i?(this.winRef.localStorage?.setItem(Pe,"true"),i.submit(),this.busy$.next(!0)):(this.busy$.next(!0),Se(this.auth.loginWithCredentials(this.form.value.userId.toLowerCase(),this.form.value.password)).pipe(De(this.auth.isUserLoggedIn()),V(([t,n])=>this.onSuccess(n))).subscribe())}handleCustomLoginError(){if(!this.featureConfigService.isEnabled("authorizationCodeFlowByDefault"))return;let i=this.activatedRoute.snapshot.queryParams.error;i&&(this.globalMessage.add({key:this.customFormValidErrors.includes(i)?`customLoginPage.badRequest.${i}`:"customLoginPage.badRequest.unknown_error"},ie.MSG_TYPE_ERROR),this.router.navigate([],{queryParams:{error:null}}))}onSuccess(i){i&&(this.globalMessage.remove(ie.MSG_TYPE_ERROR),this.form.reset()),this.busy$.next(!1)}initCustomLogin(){this.method="POST",this.action=this.authConfigService?.getCustomLoginFormEndpoint(),this.form.addControl("csrf",new Ue("",x.required)),this.form.get("csrf")?.setValue(this.csrf?.token)}static{this.\u0275fac=function(t){return new(t||e)(ae(P),ae(K),ae(D))}}static{this.\u0275prov=re({token:e,factory:e.\u0275fac})}}return e})(),zi=(()=>{class e{constructor(i){this.service=i,this.style=!0,this.form=this.service.form,this.isUpdating$=this.service.isUpdating$,this.csrf=this.service.csrf,this.action=this.service.action,this.method=this.service.method,Ne("a11yPasswordVisibliltyBtnValueOverflow"),this.service.handleCustomLoginError()}onSubmit(){this.service.login(this.loginForm?.nativeElement)}static{this.\u0275fac=function(t){return new(t||e)(A(Qe))}}static{this.\u0275cmp=b({type:e,selectors:[["cx-login-form"]],viewQuery:function(t,n){if(t&1&&J(ki,5),t&2){let c;X(c=Z())&&(n.loginForm=c.first)}},hostAttrs:["ngSkipHydration","true"],hostVars:2,hostBindings:function(t,n){t&2&&se("user-form",n.style)},standalone:!1,decls:33,vars:52,consts:[["loginForm",""],["class","overlay",4,"ngIf"],[3,"ngSubmit","formGroup"],[1,"label-content"],["required","true","type","email","formControlName","userId","name","username",1,"form-control",3,"placeholder"],["id","userIdError",3,"translationParams","control"],["required","true","type","password","formControlName","password","name","password","cxPasswordVisibilitySwitch","",1,"form-control",3,"placeholder"],["id","passwordError",3,"translationParams","control"],[4,"cxFeature"],[1,"btn-link",3,"routerLink"],["type","submit",1,"btn","btn-block","btn-primary",3,"disabled"],[1,"overlay"],["formControlName","csrf","type","hidden",3,"name",4,"ngIf"],["formControlName","csrf","type","hidden",3,"name"]],template:function(t,n){if(t&1){let c=z();C(0,Fi,1,0,"cx-spinner",1),r(1,"async"),d(2,"form",2,0),T("ngSubmit",function(){return y(c),_(n.onSubmit())}),f(4,"cx-form-required-legend"),d(5,"label")(6,"span",3),p(7),r(8,"cxTranslate"),f(9,"cx-form-required-asterisks"),s(),f(10,"input",4),r(11,"cxTranslate"),r(12,"cxTranslate"),f(13,"cx-form-errors",5),r(14,"cxTranslate"),s(),d(15,"label")(16,"span",3),p(17),r(18,"cxTranslate"),f(19,"cx-form-required-asterisks"),s(),f(20,"input",6),r(21,"cxTranslate"),r(22,"cxTranslate"),f(23,"cx-form-errors",7),r(24,"cxTranslate"),s(),C(25,Si,2,1,"ng-container",8),d(26,"a",9),r(27,"cxUrl"),p(28),r(29,"cxTranslate"),s(),d(30,"button",10),p(31),r(32,"cxTranslate"),s()()}if(t&2){let c,g;l("ngIf",a(1,23,n.isUpdating$)),o(2),l("formGroup",n.form),F("method",n.method)("action",n.action,Ee),o(5),m(" ",a(8,25,"loginForm.emailAddress.label")," "),o(3),Y("placeholder",a(11,27,"loginForm.emailAddress.placeholder")),F("aria-label",a(12,29,"loginForm.emailAddress.label"))("aria-invalid",((c=n.form.get("userId"))==null?null:c.touched)&&((c=n.form.get("userId"))==null?null:c.invalid))("aria-errormessage","userIdError"),o(3),l("translationParams",G(47,_i,a(14,31,"loginForm.emailAddress.label")))("control",n.form.get("userId")),o(4),m(" ",a(18,33,"loginForm.password.label")," "),o(3),Y("placeholder",a(21,35,"loginForm.password.placeholder")),F("aria-label",a(22,37,"loginForm.password.placeholder"))("aria-invalid",((g=n.form.get("password"))==null?null:g.touched)&&((g=n.form.get("password"))==null?null:g.invalid))("aria-errormessage","passwordError"),o(3),l("translationParams",G(49,_i,a(24,39,"loginForm.password.label")))("control",n.form.get("password")),o(2),l("cxFeature","authorizationCodeFlowByDefault"),o(),l("routerLink",a(27,41,q(51,Ti))),o(2),m(" ",a(29,43,"loginForm.forgotPassword")," "),o(2),l("disabled",n.form.disabled),o(),m(" ",a(32,45,"loginForm.signIn")," ")}},dependencies:[j,ge,pe,me,ue,Ce,he,ve,H,be,xe,je,Be,R,M,W,Q,E],encapsulation:2,changeDetection:0})}}return e})(),Yi=(()=>{class e{static{this.\u0275fac=function(t){return new(t||e)}}static{this.\u0275mod=k({type:e})}static{this.\u0275inj=I({providers:[L({cmsComponents:{ReturningCustomerLoginComponent:{component:zi,guards:[te,$e],providers:[{provide:Qe,useClass:Qe,deps:[P,K,D]}]}}})],imports:[B,ye,_e,N,O,$,ke,Ie,We,ce,R,M]})}}return e})(),Ji=(()=>{class e{constructor(i){this.activatedRoute=i,this.loginAsGuest=!1,this.routingService=u(de,{optional:!0})}ngOnInit(){this.loginAsGuest=this.activatedRoute.snapshot.queryParams.forced}navigateTo(i){this.routingService?.go({cxRoute:i})}static{this.\u0275fac=function(t){return new(t||e)(A(le))}}static{this.\u0275cmp=b({type:e,selectors:[["cx-login-register"]],standalone:!1,decls:7,vars:7,consts:[[1,"register"],[1,"cx-section-title"],[1,"btn","btn-block","btn-secondary",3,"click","ngClass"]],template:function(t,n){t&1&&(d(0,"div",0)(1,"p",1),p(2),r(3,"cxTranslate"),s(),d(4,"button",2),T("click",function(){return n.navigateTo(n.loginAsGuest?"checkoutLogin":"register")}),p(5),r(6,"cxTranslate"),s()()),t&2&&(o(2),m(" ",a(3,3,"loginForm.dontHaveAccount")," "),o(2),l("ngClass",n.loginAsGuest?"btn-guest":"btn-register"),o(),m(" ",a(6,5,n.loginAsGuest?"loginForm.guestCheckout":"loginForm.register")," "))},dependencies:[Me,E],encapsulation:2})}}return e})(),Xi=(()=>{class e{static{this.\u0275fac=function(t){return new(t||e)}}static{this.\u0275mod=k({type:e})}static{this.\u0275inj=I({providers:[L({cmsComponents:{ReturningCustomerRegisterComponent:{component:Ji,guards:[te,Qi]}}})],imports:[B,N,O,Ge,$,gi]})}}return e})(),Ii=(()=>{class e{constructor(i,t,n){this.auth=i,this.userAccount=t,this.translation=n}ngOnInit(){this.user$=this.auth.isUserLoggedIn().pipe(Le(i=>i?this.userAccount.get():oe(void 0))),this.greeting$=this.user$.pipe(Le(i=>this.translation.translate("miniLogin.userGreeting",{name:i?.name})))}onRootNavBtnAdded(i,t){i.target.setAttribute("aria-label",t)}usingASMClient(){return this.auth.usingASMClient()}static{this.\u0275fac=function(t){return new(t||e)(A(P),A(Ci),A(li))}}static{this.\u0275cmp=b({type:e,selectors:[["cx-login"]],standalone:!1,decls:4,vars:4,consts:[["login",""],[4,"ngIf","ngIfElse"],[4,"ngIf"],[1,"cx-login-greet"],["cxDomChangeTargetSelector","nav ul li:first-child button","id","account-nav","position","HeaderLinks",3,"cxDomChange"],["role","link",3,"routerLink"]],template:function(t,n){if(t&1&&(C(0,Di,3,3,"ng-container",1),r(1,"async"),C(2,Ri,1,1,"ng-template",null,0,oi)),t&2){let c=Xe(3);l("ngIf",a(1,2,n.user$))("ngIfElse",c)}},dependencies:[j,H,fi,hi,W,Q,E],encapsulation:2})}}return e})(),Zi=(()=>{class e{static{this.\u0275fac=function(t){return new(t||e)}}static{this.\u0275mod=k({type:e})}static{this.\u0275inj=I({providers:[L({cmsComponents:{LoginComponent:{component:Ii}}})],imports:[B,N,O,Ge,$,vi]})}}return e})(),et=(()=>{class e extends Ii{static{this.\u0275fac=(()=>{let i;return function(n){return(i||(i=Ye(e)))(n||e)}})()}static{this.\u0275cmp=b({type:e,selectors:[["cx-my-account-v2-user"]],standalone:!1,features:[Je],decls:3,vars:3,consts:[[1,"cx-my-account-v2-user"],[4,"ngIf"],[1,"cx-name"],[1,"cx-sign-out",3,"routerLink"]],template:function(t,n){t&1&&(d(0,"div",0),C(1,Vi,7,9,"ng-container",1),r(2,"async"),s()),t&2&&(o(),l("ngIf",a(2,1,n.user$)))},dependencies:[j,H,W,Q,E],encapsulation:2})}}return e})(),it=(()=>{class e{static{this.\u0275fac=function(t){return new(t||e)}}static{this.\u0275mod=k({type:e})}static{this.\u0275inj=I({providers:[L({cmsComponents:{MyAccountViewUserComponent:{component:et,guards:[si]}}})],imports:[B,N,O,$]})}}return e})(),bi="LOGIN",tt=(()=>{class e{constructor(){this.routingService=u(de),this.verificationTokenFacade=u(Fe),this.winRef=u(D),this.busy$=new ne(!1),this.isUpdating$=this.busy$.pipe(V(i=>{let t=this.winRef.nativeWindow?.history?.state?.newUid;t&&this.form.patchValue({userId:t}),i===!0?this.form.disable():this.form.enable()})),this.form=new fe({userId:new U("",[x.required,He.emailValidator]),password:new U("",x.required)}),this.style=!0,Ne("a11yPasswordVisibliltyBtnValueOverflow")}onSubmit(){if(!this.form.valid){this.form.markAllAsTouched();return}this.busy$.next(!0);let i=this.collectDataFromLoginForm();this.verificationTokenFacade.createVerificationToken(i).subscribe({next:t=>this.goToVerificationTokenForm(t,i),error:t=>{this.routingService.go({cxRoute:"verifyToken"},{state:{loginId:i.loginId,password:i.password,errorStatus:t.status}}),this.busy$.next(!1)},complete:()=>this.onCreateVerificationTokenComplete()})}goToVerificationTokenForm(i,t){this.routingService.go({cxRoute:"verifyToken"},{state:{loginId:t.loginId,password:t.password,tokenId:i.tokenId,expiresIn:i.expiresIn}})}onCreateVerificationTokenComplete(){this.form.reset(),this.busy$.next(!1)}collectDataFromLoginForm(){return{loginId:this.form.value.userId.toLowerCase(),password:this.form.value.password,purpose:bi}}static{this.\u0275fac=function(t){return new(t||e)}}static{this.\u0275cmp=b({type:e,selectors:[["cx-otp-login-form"]],hostAttrs:["ngSkipHydration","true"],hostVars:2,hostBindings:function(t,n){t&2&&se("user-form",n.style)},standalone:!1,decls:28,vars:36,consts:[["class","overlay",4,"ngIf"],[3,"ngSubmit","formGroup"],[1,"label-content"],["required","true","type","email","formControlName","userId",1,"form-control",3,"placeholder"],["id","userIdError",3,"control"],["required","true","type","password","formControlName","password","cxPasswordVisibilitySwitch","",1,"form-control",3,"placeholder"],["id","passwordError",3,"control"],[1,"btn-link",3,"routerLink"],["type","submit",1,"btn","btn-block","btn-primary",3,"disabled"],[1,"overlay"]],template:function(t,n){if(t&1&&(C(0,Ai,1,0,"cx-spinner",0),r(1,"async"),d(2,"form",1),T("ngSubmit",function(){return n.onSubmit()}),f(3,"cx-form-required-legend"),d(4,"label")(5,"span",2),p(6),r(7,"cxTranslate"),f(8,"cx-form-required-asterisks"),s(),f(9,"input",3),r(10,"cxTranslate"),f(11,"cx-form-errors",4),s(),d(12,"label")(13,"span",2),p(14),r(15,"cxTranslate"),f(16,"cx-form-required-asterisks"),s(),f(17,"input",5),r(18,"cxTranslate"),r(19,"cxTranslate"),f(20,"cx-form-errors",6),s(),d(21,"a",7),r(22,"cxUrl"),p(23),r(24,"cxTranslate"),s(),d(25,"button",8),p(26),r(27,"cxTranslate"),s()()),t&2){let c,g;l("ngIf",a(1,17,n.isUpdating$)),o(2),l("formGroup",n.form),o(4),m(" ",a(7,19,"loginForm.emailAddress.label")," "),o(3),Y("placeholder",a(10,21,"loginForm.emailAddress.placeholder")),F("aria-invalid",((c=n.form.get("userId"))==null?null:c.touched)&&((c=n.form.get("userId"))==null?null:c.invalid))("aria-errormessage","userIdError"),o(2),l("control",n.form.get("userId")),o(3),m(" ",a(15,23,"loginForm.password.label")," "),o(3),Y("placeholder",a(18,25,"loginForm.password.placeholder")),F("aria-label",a(19,27,"loginForm.password.placeholder"))("aria-invalid",((g=n.form.get("password"))==null?null:g.touched)&&((g=n.form.get("password"))==null?null:g.invalid))("aria-errormessage","passwordError"),o(3),l("control",n.form.get("password")),o(),l("routerLink",a(22,29,q(35,Ti))),o(2),m(" ",a(24,31,"loginForm.forgotPassword")," "),o(2),l("disabled",n.form.disabled),o(),m(" ",a(27,33,"loginForm.signIn")," ")}},dependencies:[j,ge,pe,me,ue,Ce,he,ve,H,be,xe,je,R,M,W,Q,E],encapsulation:2,changeDetection:0})}}return e})(),nt=(()=>{class e{static{this.\u0275fac=function(t){return new(t||e)}}static{this.\u0275mod=k({type:e})}static{this.\u0275inj=I({providers:[L({cmsComponents:{ReturningCustomerOTPLoginComponent:{component:tt,guards:[te]}}})],imports:[B,ye,_e,N,O,$,ke,Ie,We,ce,R,M]})}}return e})(),ot=(()=>{class e{constructor(i){this.launchDialogService=i,this.VERIFICATION_TOKEN_DIALOG_ACTION=yi,this.focusConfig={trap:!0,block:!0,autofocus:!0,focusOnEscape:!0}}closeModal(i){this.launchDialogService.closeDialog(i)}static{this.\u0275fac=function(t){return new(t||e)(A(Te))}}static{this.\u0275cmp=b({type:e,selectors:[["cx-verification-token-dialog"]],standalone:!1,decls:29,vars:22,consts:[["role","dialog","aria-labelledby","verification-token-dialog-title",1,"cx-verification-token-dialog","cx-modal-container","cx-asm-dialog",3,"esc","cxFocus"],[1,"cx-modal-content"],[1,"cx-dialog-header","modal-header"],[1,"info-icon"],["type","INFO"],["id","verification-token-dialog-title",1,"title","modal-title"],[1,"spliter"],[1,"cx-dialog-body","modal-body"],[1,"cx-dialog-row"],[1,"cx-dialog-item"],[1,"cx-dialog-footer","modal-footer"],["type","button",1,"btn","btn-primary",3,"click"]],template:function(t,n){t&1&&(d(0,"div",0),T("esc",function(){return n.closeModal(n.VERIFICATION_TOKEN_DIALOG_ACTION.OK)}),d(1,"div",1)(2,"div",2)(3,"div")(4,"span",3),f(5,"cx-icon",4),s(),d(6,"h3",5),p(7),r(8,"cxTranslate"),s()()(),f(9,"hr",6),d(10,"div",7)(11,"div",8)(12,"div",9),p(13),r(14,"cxTranslate"),s(),d(15,"div",9),p(16),r(17,"cxTranslate"),s(),d(18,"div",9),p(19),r(20,"cxTranslate"),s(),d(21,"div",9),p(22),r(23,"cxTranslate"),s()()(),d(24,"div",10)(25,"button",11),r(26,"cxTranslate"),T("click",function(){return n.closeModal(n.VERIFICATION_TOKEN_DIALOG_ACTION.OK)}),p(27),r(28,"cxTranslate"),s()()()()),t&2&&(l("cxFocus",n.focusConfig),o(7),m(" ",a(8,8,"verificationTokenDialog.title")," "),o(6),m(" ",a(14,10,"verificationTokenDialog.noReceiveCode")," "),o(3),m(" ",a(17,12,"verificationTokenDialog.contentLine1")," "),o(3),m(" ",a(20,14,"verificationTokenDialog.contentLine2")," "),o(3),m(" ",a(23,16,"verificationTokenDialog.contentLine3")," "),o(3),F("aria-label",a(26,18,"verificationTokenDialog.ok")),o(2),m(" ",a(28,20,"verificationTokenDialog.close")," "))},dependencies:[ci,mi,E],encapsulation:2})}}return e})(),rt={launch:{[qe.ACCOUNT_VERIFICATION_TOKEN]:{inlineRoot:!0,component:ot,dialogType:pi.DIALOG}}},at=1e4,ze=(()=>{class e{get csrf(){return this.csrfStateService.get()}constructor(){this.authConfigService=u(Ae),this.featureConfigService=u(ee),this.auth=u(P),this.csrfStateService=u(Oe),this.winRef=u(D),this.globalMessage=u(K),this.verificationTokenFacade=u(Fe),this.busy$=new ne(!1),this.isUpdating$=this.busy$.pipe(V(i=>{i===!0?this.form.disable():this.form.enable()})),this.form=new fe({tokenId:new U("",[x.required]),tokenCode:new U("",[x.required])}),this.featureConfigService.isEnabled("authorizationCodeFlowByDefault")&&this.initCustomLogin()}login(i){if(!this.form.valid){this.form.markAllAsTouched();return}this.featureConfigService.isEnabled("authorizationCodeFlowByDefault")&&i?(this.winRef.localStorage?.setItem(Pe,"true"),i.submit(),this.busy$.next(!0)):(this.busy$.next(!0),Se(this.auth.otpLoginWithCredentials(this.form.value.tokenId,this.form.value.tokenCode)).pipe(De(this.auth.isUserLoggedIn()),V(([t,n])=>this.onSuccess(n))).subscribe())}displayMessage(i,t){this.globalMessage.add({key:i,params:t},ie.MSG_TYPE_CONFIRMATION,at)}createVerificationToken(i,t,n){return this.verificationTokenFacade.createVerificationToken({loginId:i,password:t,purpose:n})}onSuccess(i){i&&(this.globalMessage.remove(ie.MSG_TYPE_ERROR),this.form.reset()),this.busy$.next(!1)}initCustomLogin(){this.method="POST",this.action=this.authConfigService?.getCustomLoginFormEndpoint(),this.form.addControl("csrf",new Ue("",x.required)),this.form.get("csrf")?.setValue(this.csrf?.token)}static{this.\u0275fac=function(t){return new(t||e)}}static{this.\u0275prov=re({token:e,factory:e.\u0275fac})}}return e})(),st=(()=>{class e{constructor(){this.featureConfigService=u(ee),this.service=u(ze),this.launchDialogService=u(Te),this.cdr=u(ri),this.routingService=u(de),this.waitTime=60,this.form=this.service.form,this.isUpdating$=this.service.isUpdating$,this.style=!0,this.isResendDisabled=!0,this.waitTimeForRateLimit=300,this.csrf=this.service.csrf,this.action=this.service.action,this.method=this.service.method}ngOnInit(){history.state&&(this.tokenId=history.state.tokenId,this.password=history.state.password,this.target=history.state.loginId,this.errorStatus=history.state.errorStatus,history.pushState({tokenId:"",password:"",loginId:"",errorStatus:""},"verifyToken"),this.errorStatus===400?(this.upToRateLimit=!0,this.tokenId="invalidTokenId",this.startRateLimitWaitTimeInterval()):!this.target||!this.password||!this.tokenId?(this.service.displayMessage("verificationTokenForm.needInputCredentials",{}),this.routingService.go(this.featureConfigService.isEnabled("authorizationCodeFlowByDefault")?{cxRoute:"login"}:["/login"])):(this.startWaitTimeInterval(),this.service.displayMessage("verificationTokenForm.createVerificationToken",{target:this.target})))}onSubmit(){this.service.login(this.verificationTokenForm?.nativeElement)}resendOTP(){this.isResendDisabled=!0,this.resendLink.nativeElement.tabIndex=-1,this.resendLink.nativeElement.blur(),this.waitTime=60,this.startWaitTimeInterval(),this.service.createVerificationToken(this.target,this.password,bi).subscribe({next:i=>this.tokenId=i.tokenId,complete:()=>this.service.displayMessage("verificationTokenForm.createVerificationToken",{target:this.target})})}startWaitTimeInterval(){let i=setInterval(()=>{this.waitTime--,this.cdr.detectChanges(),this.waitTime<=0&&(clearInterval(i),this.isResendDisabled=!1,this.resendLink.nativeElement.tabIndex=0,this.cdr.detectChanges())},1e3)}openInfoDailog(){this.launchDialogService.openDialogAndSubscribe(qe.ACCOUNT_VERIFICATION_TOKEN,this.element)}onOpenInfoDailogKeyDown(i){(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),this.openInfoDailog())}startRateLimitWaitTimeInterval(){let i=setInterval(()=>{this.waitTimeForRateLimit--,this.cdr.detectChanges(),this.waitTimeForRateLimit<=0&&(clearInterval(i),this.upToRateLimit=!1,this.isResendDisabled=!1,this.cdr.detectChanges())},1e3)}static{this.\u0275fac=function(t){return new(t||e)}}static{this.\u0275cmp=b({type:e,selectors:[["cx-verification-token-form"]],viewQuery:function(t,n){if(t&1&&(J(Bi,5),J(Ni,5),J(Pi,5)),t&2){let c;X(c=Z())&&(n.element=c.first),X(c=Z())&&(n.resendLink=c.first),X(c=Z())&&(n.verificationTokenForm=c.first)}},hostVars:2,hostBindings:function(t,n){t&2&&se("user-form",n.style)},standalone:!1,decls:28,vars:31,consts:[["verificationTokenForm",""],["resendLink",""],["noReceiveCodeLink",""],["class","overlay",4,"ngIf"],[3,"ngSubmit","formGroup"],[1,"label-content"],["required","true","formControlName","tokenCode","name","password","aria-describedby","tokenInputHint",1,"form-control",3,"placeholder"],[3,"control"],["class","rate-limit-error-display",4,"ngIf"],["id","tokenInputHint",1,"cx-visually-hidden"],["type","hidden","formControlName","tokenId","name","username",3,"ngModelChange","ngModel"],[4,"cxFeature"],["class","resend-link-text",4,"ngIf"],[1,"verify-container"],["type","submit",1,"btn","btn-block","btn-primary",3,"disabled"],[1,"btn","btn-block","btn-secondary","btn-register",3,"routerLink"],[1,"overlay"],[1,"rate-limit-error-display"],["formControlName","csrf","type","hidden",3,"name",4,"ngIf"],["formControlName","csrf","type","hidden",3,"name"],[1,"resend-link-text"],[1,"left-text"],["role","timer","aria-live","polite","aria-atomic","true"],["role","button","tabindex","-1",1,"btn-link",3,"keydown.enter","keydown.space","click","ngClass"],[4,"ngIf"],[1,"right-text"],["role","button","tabindex","0",1,"btn-link",3,"keydown","click"]],template:function(t,n){if(t&1){let c=z();C(0,qi,1,0,"cx-spinner",3),r(1,"async"),d(2,"form",4,0),T("ngSubmit",function(){return y(c),_(n.onSubmit())}),f(4,"cx-form-required-legend"),d(5,"label")(6,"span",5),p(7),r(8,"cxTranslate"),f(9,"cx-form-required-asterisks"),s(),f(10,"input",6),r(11,"cxTranslate"),f(12,"cx-form-errors",7),C(13,Gi,3,6,"div",8),s(),d(14,"span",9),p(15),r(16,"cxTranslate"),s(),d(17,"input",10),ni("ngModelChange",function(we){return y(c),ti(n.tokenId,we)||(n.tokenId=we),_(we)}),s(),C(18,Wi,2,1,"ng-container",11)(19,Ki,13,10,"div",12),d(20,"div",13)(21,"button",14),p(22),r(23,"cxTranslate"),s(),d(24,"button",15),r(25,"cxUrl"),p(26),r(27,"cxTranslate"),s()()()}t&2&&(l("ngIf",a(1,16,n.isUpdating$)),o(2),l("formGroup",n.form),F("method",n.method)("action",n.action,Ee),o(5),m(" ",a(8,18,"verificationTokenForm.verificationCode.label")," "),o(3),l("placeholder",a(11,20,"verificationTokenForm.verificationCode.placeholder")),o(2),l("control",n.form.get("tokenCode")),o(),l("ngIf",n.upToRateLimit),o(2),m(" ",a(16,22,"verificationTokenForm.tokenInputHint")," "),o(2),ii("ngModel",n.tokenId),o(),l("cxFeature","authorizationCodeFlowByDefault"),o(),l("ngIf",!n.upToRateLimit),o(2),l("disabled",n.form.disabled),o(),m(" ",a(23,24,"verificationTokenForm.verify")," "),o(2),l("routerLink",a(25,26,q(30,xi))),o(2),m(" ",a(27,28,"verificationTokenForm.back")," "))},dependencies:[Me,j,ge,pe,me,ue,Ce,he,ve,H,be,xe,Be,R,M,W,Q,E],encapsulation:2,changeDetection:0})}}return e})(),lt=(()=>{class e{static{this.\u0275fac=function(t){return new(t||e)}}static{this.\u0275mod=k({type:e})}static{this.\u0275inj=I({providers:[L({cmsComponents:{VerifyOTPTokenComponent:{component:st,guards:[te,$e],providers:[{provide:ze,useClass:ze,deps:[P,K,Fe,D]}]}}}),L(rt)],imports:[B,ye,di,_e,N,O,ui,$,ke,Ie,ce,R,M]})}}return e})(),Rt=(()=>{class e{static{this.\u0275fac=function(t){return new(t||e)}}static{this.\u0275mod=k({type:e})}static{this.\u0275inj=I({imports:[Zi,Yi,lt,Xi,it,nt]})}}return e})();export{Qi as a,Qe as b,zi as c,Ii as d,Rt as e};