1import{a as We}from"./chunk-ANTVCVZF.js";import{a as He}from"./chunk-RSZXPKVY.js";import{i as Ge}from"./chunk-A36COIJN.js";import{a as Qe,b as W}from"./chunk-Z5XG4XOC.js";import{fa as Pe,o as Fe}from"./chunk-AFY537I3.js";import{a as ke}from"./chunk-4Z5RL6QO.js";import{A as ze,E as Be,F as H,c as R,e as y,g as L,h as je,j as Oe,l as G,m as Ae,o as Ve,s as qe,t as Ue,u as Ne}from"./chunk-2QYSD5RO.js";import{a as Ie}from"./chunk-5PO4QCCX.js";import{m as Ee}from"./chunk-54W4P7NA.js";import{K as Se,L as _e,a as ye}from"./chunk-AJRHK7D2.js";import{d as Q}from"./chunk-VUDRL6AY.js";import{a as Re}from"./chunk-PNKQO6EM.js";import{a as De,b as Le}from"./chunk-3DSD7D2T.js";import{b as xe}from"./chunk-SVLM2ECX.js";import{c as D}from"./chunk-4NGQH4V6.js";import{e as P}from"./chunk-MHLI7EB3.js";import{Z as Ce,_ as we}from"./chunk-6K3X73CK.js";import{a as Te,b as Me}from"./chunk-U5TOGEJX.js";import{H as be,L as M,m as T}from"./chunk-OD4FXCMW.js";import{Ac as F,D as ee,E as A,Fa as _,Fc as b,Ga as I,Hc as p,Ib as v,Ja as le,Lc as ve,Mc as U,Nc as N,Ob as x,Pb as de,S as te,Tb as ue,Td as k,V as ie,Vc as z,Wa as ce,Wc as c,Xc as w,Y as re,aa as ne,cb as me,ec as pe,g as X,hc as m,jc as d,kd as B,la as E,lc as fe,mc as ge,na as oe,nc as he,o as O,oc as u,pc as s,qc as a,qd as C,rc as g,ta as ae,ua as se,vc as V,wc as q,xa as f,y as S,z as Z,zb as o}from"./chunk-T2TVCV7P.js";import{a as K,b as J}from"./chunk-BBHHUGUF.js";var it=t=>({"form-has-error-alert":t}),rt=t=>({"ng-invalid":t});function nt(t,i){if(t&1&&(s(0,"div",16),c(1),a()),t&2){let e=p(2);o(),w(e.formErrors.email)}}function ot(t,i){if(t&1&&(s(0,"div",16),c(1),a()),t&2){let e=i.$implicit;o(),w(e)}}function at(t,i){if(t&1&&(s(0,"div")(1,"p"),c(2,"Enter your email address below and we'll send you a link to reset your password."),a(),s(3,"div",13)(4,"label"),c(5,"Your Email"),a(),s(6,"div",14),g(7,"input",15),a(),m(8,nt,2,1,"div",16),ge(9,ot,2,1,"div",16,fe),a()()),t&2){let e=p();o(6),u("ngClass",C(4,it,e.formErrors.email||e.forgetPasswordError.length)),o(),u("ngClass",C(6,rt,e.forgetPasswordError.length))("validateFormControl",e.forgetPasswordForm.controls.email),o(),d(e.formErrors.email?8:-1),o(),he(e.forgetPasswordError)}}function st(t,i){t&1&&(s(0,"div")(1,"p"),c(2,"You will receive an email shortly containing the instructions to reset your password."),a()())}function lt(t,i){if(t&1){let e=F();s(0,"button",17),b("click",function(){_(e);let n=p();return I(n.login())}),c(1,"Log in"),a()}}function ct(t,i){t&1&&g(0,"ui-spinner",18)}function mt(t,i){if(t&1&&(s(0,"button",11),m(1,ct,1,0,"ui-spinner",18),c(2," Submit "),a()),t&2){let e=p();u("disabled",e.submittingRequest||!e.forgetPasswordForm.valid),o(),d(e.submittingRequest?1:-1)}}function dt(t,i){if(t&1){let e=F();s(0,"button",19),b("click",function(){_(e);let n=p();return I(n.close())}),c(1,"Done"),a()}}var $=class t extends xe(){constructor(e,r,n,l){super();this.dialogRef=e;this.cd=r;this.analytics=n;this.submittingRequest=!1;this.forgetPasswordError=[];this.forgetPasswordForm=new Oe({email:new Ae("",[y.required,y.email])});this.resetSuccess=!1;this.formErrors={email:""};this.validationMessages={email:{required:"Invalid entry. Please enter your email address.",email:'A valid email address has letters, numbers, "@" and "."'}};Object.assign(this,l)}ngOnInit(){this.forgetPasswordForm.controls.email.setValue(this.email),this.forgetPasswordForm.valueChanges.pipe(re(500)).subscribe(()=>{this.onValueChanged(),this.cd.markForCheck()}),this.onValueChanged()}onValueChanged(){if(!this.forgetPasswordForm)return;let e=this.forgetPasswordForm;for(let r in this.formErrors)if(this.formErrors.hasOwnProperty(r)){this.formErrors[r]="";let n=e.get(r);if(n&&!n.pristine&&!n.valid){let l=this.validationMessages[r];for(let h in n.errors)n.errors.hasOwnProperty(h)&&l[h]&&(this.formErrors[r]+=l[h]+" ")}}this.forgetPasswordForm.value.email||(this.forgetPasswordError=[])}forgetPassword(){this.forgetPasswordError=[],this.submittingRequest=!0,this.email=this.forgetPasswordForm.value,this.forgetPasswordForm.valid?this.resetEmailFunc(this.email).pipe(ke(e=>{this.cd.markForCheck()})).subscribe(()=>{this.analytics.track("A-password_reset-requested",{context:this.context}),this.submittingRequest=!1,this.resetSuccess=!0},e=>{this.submittingRequest=!1,e.error.message==="Cannot find any user registered with this email."?this.forgetPasswordError=["The email you entered doesn't appear to belong to an account.","Please check your email and try again."]:this.forgetPasswordError=e.error.message?[e.error.message]:["An error has occurred on our end. Please try again later."]}):this.onValueChanged()}close(){this.dialogRef.close()}login(){this.dialogRef.close({backToLogin:!0})}static{this.\u0275fac=function(r){return new(r||t)(v(Ce),v(k),v(D),v(we))}}static{this.\u0275cmp=x({type:t,selectors:[["ng-component"]],features:[ue],decls:16,vars:8,consts:[[3,"size","rounded"],[1,"mt-6","uic-header-margin",2,"min-height","48px"],[1,"f-3","mb-0"],["type","button","aria-label","Close",1,"btn","btn-quiet","uic-button-size","uic-right",3,"click"],["theme","bold","name","close","size","f-paragraph"],["name","forgetPasswordForm","id","forgetPasswordForm","novalidate","",3,"ngSubmit","formGroup"],[1,"ui-modal__main","uic-main-margin","text-neutral-800"],[1,"mt-2","pb-6"],["buttonLeftSlot",""],["type","button",1,"btn-quiet","btn","mr-2"],["buttonRightSlot",""],["type","submit","aria-label","submit form",1,"btn","btn-secondary",3,"disabled"],["type","button",1,"btn-default","btn","mr-2"],[1,"form-group","mb-6"],[3,"ngClass"],["cdkfocusinitial","","type","text","id","email","formControlName","email","placeholder","Enter your email address","required","","validateOnBlur","",1,"form-control",3,"ngClass","validateFormControl"],[1,"invalid-feedback"],["type","button",1,"btn-quiet","btn","mr-2",3,"click"],["color","light",1,"mr-2"],["type","button",1,"btn-default","btn","mr-2",3,"click"]],template:function(r,n){r&1&&(s(0,"ui-modal-2",0)(1,"ui-modal-header-2",1)(2,"h3",2),c(3,"Reset your password"),a(),s(4,"button",3),b("click",function(){return n.close()}),g(5,"ui-streamline-icon",4),a()(),s(6,"form",5),b("ngSubmit",function(){return n.forgetPassword()}),s(7,"div",6),m(8,at,11,8,"div"),m(9,st,3,0,"div"),a(),s(10,"ui-modal-buttons-2",7),V(11,8),m(12,lt,2,0,"button",9),q(),V(13,10),m(14,mt,3,2,"button",11),m(15,dt,2,0,"button",12),q(),a()()()),r&2&&(u("size","sm-prompt")("rounded",!0),o(6),u("formGroup",n.forgetPasswordForm),o(2),d(n.resetSuccess?-1:8),o(),d(n.resetSuccess?9:-1),o(3),d(!n.resetSuccess&&n.canBackToLogin?12:-1),o(2),d(n.resetSuccess?-1:14),o(),d(n.resetSuccess?15:-1))},dependencies:[Q,De,Re,Le,P,H,Ve,R,L,je,ze,Ne,Ue,T,W,Qe,Te],encapsulation:2,changeDetection:0})}},$e=class t{static{this.\u0275fac=function(e){return new(e||t)}}static{this.\u0275mod=de({type:t})}static{this.\u0275inj=se({imports:[be,Be,H,W,Me,Q,P,$]})}};var ut=["usernameInput"],pt=["passwordInput"],Ke=t=>({"form-has-error-alert":t}),ft=t=>({"field-inactive":t});function gt(t,i){if(t&1&&(s(0,"div",6),c(1),a()),t&2){let e=p();o(),w(e.formErrors.username)}}function ht(t,i){t&1&&g(0,"ui-streamline-icon",14)}function vt(t,i){t&1&&g(0,"ui-streamline-icon",15)}function bt(t,i){if(t&1){let e=F();s(0,"div",9),g(1,"input",11,1),s(3,"div",12)(4,"button",13),b("click",function(){_(e);let n=p();return I(n.togglePasswordVisibility())}),m(5,ht,1,0,"ui-streamline-icon",14),m(6,vt,1,0,"ui-streamline-icon",15),a()()()}if(t&2){let e=p();o(),u("type",e.showPassword?"text":"password")("formControl",e.controls.password),o(3),pe("aria-label",e.showPassword?"Hide password":"Show password"),o(),d(e.showPassword?-1:5),o(),d(e.showPassword?6:-1)}}function Ct(t,i){if(t&1&&g(0,"input",10,1),t&2){let e=p();u("formControl",e.controls.password)}}function wt(t,i){if(t&1&&(s(0,"div",6),c(1),a()),t&2){let e=p();o(),w(e.formErrors.password)}}var Je=class t{constructor(i){this.cd=i;this.labelSize="md";this.hasPwEye=!0;this.showPassword=!1;this.validationMessages={username:{required:"Please enter your email or username"},password:{required:"Please enter your password",minlength:"Wrong password \u2013 passwords are always at least 5 characters."}};this.revalidationSbj=new X}static parseValues(i){return J(K({},i),{username:i.username&&i.username.replace(/\s/g,"")})}
1ngOnChanges(i){if(i.controls){let e=this.controls;We(e,this.validationMessages,this.revalidationSbj).subscribe(r=>{this.formErrors=r,this.cd.markForCheck()})}if(i.focusOn){let e=this.focusOn;e==="username"&&this.usernameInputElRef.nativeElement.focus(),e==="password"&&setTimeout(()=>this.passwordInputElRef?.nativeElement?.focus())}}revalidate(){this.controls.username.markAsDirty(),this.controls.password.markAsDirty(),this.revalidationSbj.next(),this.cd.markForCheck()}togglePasswordVisibility(){this.showPassword=!this.showPassword,this.passwordInputElRef?.nativeElement?.focus()}static{this.\u0275fac=function(e){return new(e||t)(v(k))}}static{this.\u0275cmp=x({type:t,selectors:[["sign-in-fields"]],viewQuery:function(e,r){if(e&1&&ve(ut,7)(pt,5),e&2){let n;U(n=N())&&(r.usernameInputElRef=n.first),U(n=N())&&(r.passwordInputElRef=n.first)}},inputs:{controls:"controls",labelSize:"labelSize",focusOn:"focusOn",hidePasswordField:"hidePasswordField",isUsernameInactive:"isUsernameInactive",hasPwEye:"hasPwEye"},standalone:!1,features:[ce],decls:14,vars:20,consts:[["usernameInput",""],["passwordInput",""],[1,"form-group"],["for","username"],[3,"ngClass"],["type","text","id","username","name","username","placeholder","Email or Username",1,"form-control",3,"formControl","ngClass"],[1,"invalid-feedback"],[1,"form-group","mb-1",3,"hidden"],["for","password"],[1,"validation-group"],["type","password","id","password","name","password","placeholder","Password",1,"form-control",3,"formControl"],["id","password","name","password","placeholder","Password",1,"form-control","pr-6",3,"type","formControl"],[1,"validation-group__overlay"],["type","button",1,"btn","btn-quiet","p-0",3,"click"],["name","view-1","size","f-caption"],["name","view-off","theme","bold","size","f-caption"]],template:function(e,r){e&1&&(s(0,"div",2)(1,"label",3),c(2,"Email or Username"),a(),s(3,"div",4),g(4,"input",5,0),a(),m(6,gt,2,1,"div",6),a(),s(7,"div",7)(8,"label",8),c(9,"Password"),a(),s(10,"div",4),m(11,bt,7,5,"div",9)(12,Ct,2,1,"input",10),a(),m(13,wt,2,1,"div",6),a()),e&2&&(o(),z(B("label-",r.labelSize)),o(2),u("ngClass",C(14,Ke,r.formErrors.username)),o(),u("formControl",r.controls.username)("ngClass",C(16,ft,r.isUsernameInactive)),o(2),d(r.formErrors.username?6:-1),o(),u("hidden",r.hidePasswordField),o(),z(B("label-",r.labelSize)),o(2),u("ngClass",C(18,Ke,r.formErrors.password)),o(),d(r.hasPwEye?11:12),o(2),d(r.formErrors.password?13:-1))},dependencies:[T,R,L,qe,P],styles:[".field-inactive[_ngcontent-%COMP%]{background-color:#f0f0f0;color:#a0a0a0;cursor:not-allowed;border:1px solid #ccc;opacity:.7;pointer-events:none;-webkit-user-select:none;user-select:none}.field-inactive[_ngcontent-%COMP%]:focus{outline:none;box-shadow:none}.label-sm[_ngcontent-%COMP%]{font-size:.8rem}.label-md[_ngcontent-%COMP%]{font-size:1rem}"],changeDetection:0})}};function $t(t={}){return{username:new G(t.username,y.required),password:new G(t.password,y.required)}}var Xe=class t{constructor(i,e,r,n,l,h,j,Y,yt,St){this.auth=i;this.user=e;this.initialize=r;this.subscriptionService=n;this.qualService=l;this.analyticService=h;this.shareService=j;this.platformId=Y;this.libMarketService=yt;this.injector=St;this.resetPWEmail=i=>this.auth.resetPasswordEmail(i)}getLoginToken(i,e={}){return performance.mark("login-start"),this.auth.getLoginToken(i).pipe(ee(r=>({token:r,source:"main"})),te(r=>(this.analyticService.track("A-login-failed",{error:r.error.message,context:e.context}),Z(()=>this.handleLoginErrors(r)))))}handleLoginErrors(i){return i?.status===401||i?.status===406?(this.analyticService.track("A-error-occurred",{context:"sign-in",formField:"email + password",message:"Invalid username or password"}),{type:"credentials",message:i?.error?.message||"The username or password you've entered is incorrect. Please try again."}):{type:"server",message:"We're sorry, something's not right at our end. Please try again later."}}setToken(i){this.auth.setToken(i)}afterLogin(i,e,r={}){return S(null).pipe(E(()=>this._afterLogin2(e,r)))}_afterLogin2(i,e){let{fromUrl:r,context:n}=e;return A([i.source==="main"?this.shareService.getCouponSessionData().pipe(ie(1),E(l=>l.referralCode?(M(this.platformId)&&(window.location.href=`/referral/${l.referralCode}`,this.shareService.clearCouponSessionData()),O):l.couponCode?(M(this.platformId)&&(window.location.href=`/coupon/${l.couponCode}`,this.shareService.clearCouponSessionData()),O):S(null))):S(null),this.shareService.getToState().pipe(ne(),E(l=>(l||(r=r||(M(this.platformId)?ye(location.href).fromUrl:""),this.shareService.setToState({url:r||"/dashboard"})),this.initialize.initializeAsync({refreshSub:!1,refreshPP:!1})))),i.source==="main"?A([this.subscriptionService.fetchCachedCurrentSubs(!1),this.qualService.fetchCachedProfessionalProfiles(!1)]).pipe(oe(([l,h])=>{let j=Pe(this.injector,l,"trial"),Y={type:"initial",board:h[0]?h[0].boardModel.name:void 0,registrationCountry:h[0]?h[0].country:void 0,subscribed:j&&j.length>0,context:n};this.analyticService.track("A-login-succeeded",Y),this.libMarketService.track("A-login-succeeded",!0)})):S(null)])}static{this.\u0275fac=function(e){return new(e||t)(f(_e),f(Ie),f(Ge),f(Fe),f(Ee),f(D),f(Se),f(me),f(He),f(le))}}static{this.\u0275prov=ae({token:t,factory:t.\u0275fac,providedIn:"root"})}};export{Je as a,$t as b,$ as c,$e as d,Xe as e};
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.