1import{a as J}from"./chunk-ASA3O2ST.js";import{a as H,b as v,c as G,d as B,f as $,h as z,i as Z,k as W,m as Q}from"./chunk-37OI2YLY.js";import{j as O}from"./chunk-6RICMBCH.js";import"./chunk-ARZ4VLXF.js";import{$ as i,A as E,Aa as A,C as m,J as a,N as V,Qa as j,Ra as L,T as S,U as l,V as c,X as F,Y as I,Z as y,_ as o,aa as u,ea as N,ga as g,ia as p,m as P,o as M,oa as w,qa as s,ra as R,sa as _,t as x,u as q,v as D,w as h}from"./chunk-WEBT6TDS.js";function U(e,t){let n=!t?.manualCleanup?t?.injector?.get(E)??x(E):null,d=re(t?.equal),f;t?.requireSync?f=m({kind:0},{equal:d}):f=m({kind:1,value:t?.initialValue},{equal:d});let k,T=e.subscribe({next:b=>f.set({kind:1,value:b}),error:b=>{f.set({kind:2,error:b}),k?.()},complete:()=>{k?.()}});if(t?.requireSync&&f().kind===0)throw new M(601,!1);return k=n?.onDestroy(T.unsubscribe.bind(T)),A(()=>{let b=f();switch(b.kind){case 1:return b.value;case 2:throw b.error;case 0:throw new M(601,!1)}},{equal:t?.equal})}function re(e=Object.is){return(t,r)=>t.kind===1&&r.kind===1&&e(t.value,r.value)}var C=[{key:"minLength",label:"Minimum of 8 characters long",shortLabel:"At least 8 characters",test:e=>e.length>=8},{key:"mixedCase",label:"A mix of uppercase and lowercase letters (A-Z a-z)",shortLabel:"Upper & lowercase letters",test:e=>/[A-Z]/.test(e)&&/[a-z]/.test(e)},{key:"digit",label:"At least one digit (0-9)",shortLabel:"At least one number",test:e=>/\d/.test(e)},{key:"special",label:"At least one special character (e.g. @;!$.)",shortLabel:"At least one special character",test:e=>/[^A-Za-z0-9]/.test(e)}];function K(e){let t=String(e.value??"");if(!t)return null;let r={};for(let n of C)n.test(t)||(r[n.key]=!0);return Object.keys(r).length>0?r:null}function X(e){let t=e.get("password")?.value,r=e.get("confirmPassword")?.value;return t===r?null:{passwordMismatch:!0}}function Y(e,t){return e.length>0&&t.length>0&&e===t}function ee(e){return e?e.minLength?"Password must be at least 8 characters long.":e.mixedCase?"Password must include both uppercase and lowercase letters.":e.digit?"Password must include at least one digit.":e.special?"Password must include at least one special character.":"Password does not meet the requirements below.":"Password does not meet the requirements below."}var ne=(e,t)=>t.key;function ie(e,t){e&1&&s(0," Name is required. ")}function oe(e,t){e&1&&s(0," Name must be at least 2 characters. ")}function ae(e,t){if(e&1&&(o(0,"p",15),l(1,ie,1,0)(2,oe,1,0),i()),e&2){let r=p();a(),c(r.form.controls.name.errors!=null&&r.form.controls.name.errors.required?1:2)}}function se(e,t){e&1&&s(0," Email is required. ")}function de(e,t){e&1&&s(0," Enter a valid email address. ")}function le(e,t){if(e&1&&(o(0,"p",15),l(1,se,1,0)(2,de,1,0),i()),e&2){let r=p();a(),c(r.form.controls.email.errors!=null&&r.form.controls.email.errors.required?1:2)}}function ce(e,t){e&1&&(h(),o(0,"svg",23),u(1,"path",33)(2,"path",34)(3,"line",35),i())}function ue(e,t){e&1&&(h(),o(0,"svg",23),u(1,"path",36)(2,"circle",37),i())}function me(e,t){e&1&&(h(),o(0,"svg",42),u(1,"path",44),i())}function pe(e,t){e&1&&u(0,"span",43)}function fe(e,t){if(e&1&&(o(0,"li",40)(1,"span",41),l(2,me,2,0,":svg:svg",42)(3,pe,1,0,"span",43),i(),o(4,"span"),s(5),i()()),e&2){let r=t.$implicit,n=p(2);a(),w("bg-emerald-100",n.requirementMet(r.key))("text-emerald-700",n.requirementMet(r.key))("dark:bg-emerald-950/60",n.requirementMet(r.key))("dark:text-emerald-400",n.requirementMet(r.key))("bg-gray-100",!n.requirementMet(r.key))("text-gray-400",!n.requirementMet(r.key))("dark:bg-slate-700",!n.requirementMet(r.key))("dark:text-slate-500",!n.requirementMet(r.key)),a(),c(n.requirementMet(r.key)?2:3),a(2),w("text-emerald-700",n.requirementMet(r.key))("dark:text-emerald-400",n.requirementMet(r.key))("text-gray-600",!n.requirementMet(r.key))("dark:text-slate-400",!n.requirementMet(r.key)),a(),_(" ",r.shortLabel," ")}}function ge(e,t){if(e&1&&(o(0,"div",24)(1,"p",38),s(2,"Password must include:"),i(),o(3,"ul",39),F(4,fe,6,26,"li",40,ne),i()()),e&2){let r=p();a(4),I(r.passwordRequirements)}}function we(e,t){e&1&&s(0," Password is required. ")}function be(e,t){if(e&1&&s(0),e&2){let r=p(2);_(" ",r.passwordErrorMessage()," ")}}function he(e,t){if(e&1&&(o(0,"p",15),l(1,we,1,0)(2,be,1,1),i()),e&2){let r=p();a(),c(r.form.controls.password.errors!=null&&r.form.controls.password.errors.required?1:2)}}function ve(e,t){e&1&&(h(),o(0,"svg",23),u(1,"path",33)(2,"path",34)(3,"line",35),i())}function xe(e,t){e&1&&(h(),o(0,"svg",23),u(1,"path",36)(2,"circle",37),i())}function ye(e,t){e&1&&s(0," Please confirm your password. ")}function _e(e,t){e&1&&s(0," Passwords do not match. ")}function Se(e,t){if(e&1&&(o(0,"p",15),l(1,ye,1,0)(2,_e,1,0),i()),e&2){let r=p();a(),c(r.form.controls.confirmPassword.errors!=null&&r.form.controls.confirmPassword.errors.required?1:2)}}function Ce(e,t){e&1&&(h(),o(0,"svg",42),u(1,"path",44),i())}function ke(e,t){e&1&&u(0,"span",43)}function Pe(e,t){if(e&1&&(o(0,"p",45)(1,"span",41),l(2,Ce,2,0,":svg:svg",42)(3,ke,1,0,"span",43),i(),s(4),i()),e&2){let r=p();w("text-emerald-700",r.passwordsMatch())("dark:text-emerald-400",r.passwordsMatch())("text-gray-500",!r.passwordsMatch())("dark:text-slate-400",!r.passwordsMatch()),a(),w("bg-emerald-100",r.passwordsMatch())("text-emerald-700",r.passwordsMatch())("dark:bg-emerald-950/60",r.passwordsMatch())("dark:text-emerald-400",r.passwordsMatch())("bg-gray-100",!r.passwordsMatch())("text-gray-400",!r.passwordsMatch())("dark:bg-slate-700",!r.passwordsMatch()),a(),c(r.passwordsMatch()?2:3),a(2),_(" ",r.passwordsMatch()?"Passwords match":"Passwords must match"," ")}}function Me(e,t){if(e&1){let r=N();o(0,"div",28)(1,"p"),s(2),i(),o(3,"button",46),g("click",function(){q(r);let d=p();return D(d.goToVerification())}),s(4," Enter verification code "),i()()}if(e&2){let r=p();
1a(2),R(r.verificationNotice())}}function Ee(e,t){if(e&1&&(o(0,"p",29),s(1),i()),e&2){let r=p();a(),_(" ",r.errorMessage()," ")}}function Ue(e,t){e&1&&s(0," Creating account... ")}function Te(e,t){e&1&&s(0," Create Account ")}var te=class e{fb=x(W);authService=x(O);router=x(j);isSubmitting=m(!1);errorMessage=m(null);verificationNotice=m(null);passwordRequirements=C;passwordFieldFocused=m(!1);confirmPasswordFocused=m(!1);forceShowPasswordHints=m(!1);showPassword=m(!1);showConfirmPassword=m(!1);form=this.fb.group({name:["",[v.required,v.minLength(2)]],email:["",[v.required,v.email]],password:["",[v.required,K]],confirmPassword:["",[v.required]]},{validators:X});passwordValue=U(this.form.controls.password.valueChanges.pipe(P(this.form.controls.password.value)),{initialValue:""});confirmPasswordValue=U(this.form.controls.confirmPassword.valueChanges.pipe(P(this.form.controls.confirmPassword.value)),{initialValue:""});get nameInvalid(){let t=this.form.controls.name;return t.invalid&&t.touched}get emailInvalid(){let t=this.form.controls.email;return t.invalid&&t.touched}get passwordInvalid(){let t=this.form.controls.password;return t.invalid&&t.touched}get confirmPasswordInvalid(){let t=this.form.controls.confirmPassword;return t.invalid&&t.touched||this.form.touched&&!!this.form.errors?.passwordMismatch}requirementMet(t){let r=C.find(n=>n.key===t);return r?r.test(this.passwordValue()):!1}passwordsMatch(){return Y(this.passwordValue(),this.confirmPasswordValue())}shouldShowPasswordHints(){let t=this.form.controls.password;return t.valid&&this.passwordValue().length>0?!1:this.passwordFieldFocused()||this.forceShowPasswordHints()||t.touched&&t.invalid&&this.passwordValue().length>0}shouldShowPasswordMatchHint(){return this.confirmPasswordFocused()||this.confirmPasswordValue().length>0}onPasswordFocus(){this.passwordFieldFocused.set(!0)}onPasswordBlur(){this.passwordFieldFocused.set(!1),this.hidePassword(),this.form.controls.password.valid&&this.forceShowPasswordHints.set(!1)}onPasswordFieldMouseLeave(){this.hidePassword()}onPasswordInput(){this.form.controls.password.valid&&this.forceShowPasswordHints.set(!1)}onConfirmPasswordFocus(){this.confirmPasswordFocused.set(!0)}onConfirmPasswordBlur(){this.confirmPasswordFocused.set(!1),this.hideConfirmPassword()}onConfirmPasswordFieldMouseLeave(){this.hideConfirmPassword()}togglePasswordVisibility(){this.showPassword.update(t=>!t)}toggleConfirmPasswordVisibility(){this.showConfirmPassword.update(t=>!t)}isPasswordRevealed(){return this.showPassword()&&this.passwordFieldFocused()}isConfirmPasswordRevealed(){return this.showConfirmPassword()&&this.confirmPasswordFocused()}hidePassword(){this.showPassword.set(!1)}hideConfirmPassword(){this.showConfirmPassword.set(!1)}passwordErrorMessage(){return ee(this.form.controls.password.errors)}async onSubmit(){if(this.form.markAllAsTouched(),this.form.invalid){this.form.controls.password.invalid&&this.forceShowPasswordHints.set(!0);return}this.isSubmitting.set(!0),this.errorMessage.set(null),this.verificationNotice.set(null);let{name:t,email:r,password:n}=this.form.getRawValue();try{await this.authService.signUp({username:r,password:n,options:{userAttributes:{email:r,name:t}}}),this.authService.setPendingSignUpCredentials({email:r,password:n,name:t}),this.authService.setPendingVerificationEmail(r),await this.router.navigate(["/auth/verify"])}catch(d){if(d instanceof Error&&d.name==="UsernameExistsException"){await this.handleExistingAccount(r);return}this.errorMessage.set(this.resolveErrorMessage(d))}finally{this.isSubmitting.set(!1)}}async goToVerification(){let{name:t,email:r,password:n}=this.form.getRawValue();r.trim()&&(n&&this.authService.setPendingSignUpCredentials({email:r.trim(),password:n,name:t.trim()||r.trim()}),await this.router.navigate(["/auth/verify"],{queryParams:{email:r}}))}async handleExistingAccount(t){this.authService.setPendingVerificationEmail(t);let{password:r,name:n}=this.form.getRawValue();r&&this.authService.setPendingSignUpCredentials({email:t,password:r,name:n.trim()||t});try{await this.authService.resendVerificationCode(t),this.verificationNotice.set(`An account with this email already exists but is not verified. A verification code has been sent to ${t}.`)}catch(d){if(d instanceof Error&&d.name==="InvalidParameterException"){this.errorMessage.set("An account with this email already exists. Please sign in.");return}this.verificationNotice.set(`An account with this email already exists but is not verified. Please verify ${t} to continue.`)}}resolveErrorMessage(t){return t instanceof Error&&t.message||"Unable to create account. Please try again."}static \u0275fac=function(r){return new(r||e)};static \u0275cmp=V({type:e,selectors:[["app-sign-up"]],decls:60,vars:27,consts:[[1,"rounded-2xl","border","border-gray-200","bg-white","p-8","shadow-sm","dar
1k:border-slate-700","dark:bg-slate-900"],[1,"text-2xl","font-bold","text-gray-900","dark:text-white"],[1,"mt-2","text-sm","text-gray-600","dark:text-slate-400"],["mode","sign-up",1,"mt-8","block"],[1,"mt-4","text-center","text-xs","leading-relaxed","text-gray-500","dark:text-slate-400"],["routerLink","/terms-of-service",1,"font-medium","text-emerald-600","underline","underline-offset-2","hover:text-emerald-700","dark:text-emerald-400","dark:hover:text-emerald-300"],["routerLink","/privacy-policy",1,"font-medium","text-emerald-600","underline","underline-offset-2","hover:text-emerald-700","dark:text-emerald-400","dark:hover:text-emerald-300"],[1,"relative","my-8"],["aria-hidden","true",1,"absolute","inset-0","flex","items-center"],[1,"w-full","border-t","border-gray-200","dark:border-slate-700"],[1,"relative","flex","justify-center","text-xs","uppercase","tracking-wide"],[1,"bg-white","px-3","text-gray-500","dark:bg-slate-900","dark:text-slate-400"],[1,"space-y-5",3,"ngSubmit","formGroup"],["for","name",1,"mb-1.5","block","text-sm","font-medium","text-gray-700","dark:text-slate-300"],["id","name","type","text","formControlName","name","autocomplete","name","placeholder","Jane Doe",1,"w-full","rounded-lg","border","border-gray-300","bg-white","px-4","py-2.5","text-sm","outline-none","transition","focus:border-emerald-500","focus:ring-2","focus:ring-emerald-500/20","dark:border-slate-600","dark:bg-slate-800","dark:text-white"],["role","alert",1,"mt-1.5","text-xs","text-red-600"],["for","email",1,"mb-1.5","block","text-sm","font-medium","text-gray-700","dark:text-slate-300"],["id","email","type","email","formControlName","email","autocomplete","email","placeholder","[email protected]",1,"w-full","rounded-lg","border","border-gray-300","bg-white","px-4","py-2.5","text-sm","outline-none","transition","focus:border-emerald-500","focus:ring-2","focus:ring-emerald-500/20","dark:border-slate-600","dark:bg-slate-800","dark:text-white"],[1,"relative"],["for","password",1,"mb-1.5","block","text-sm","font-medium","text-gray-700","dark:text-slate-300"],[1,"relative",3,"mouseleave"],["id","password","formControlName","password","autocomplete","new-password","placeholder","Create a password",1,"w-full","rounded-lg","border","border-gray-300","bg-white","py-2.5","pl-4","pr-11","text-sm","outline-none","transition","focus:border-emerald-500","focus:ring-2","focus:ring-emerald-500/20","dark:border-slate-600","dark:bg-slate-800","dark:text-white",3,"focus","blur","input","type"],["type","button",1,"absolute","inset-y-0","right-0","flex","w-11","items-center","justify-center","rounded-r-lg","text-gray-400","transition","hover:text-gray-600","dark:text-slate-500","dark:hover:text-slate-300",3,"mousedown","click"],["xmlns","http://www.w3.org/2000/svg","width","18","height","18","viewBox","0 0 24 24","fill","none","stroke","currentColor","stroke-width","2","aria-hidden","true"],["id","password-requirements","role","tooltip",1,"absolute","left-0","right-0","top-full","z-10","mt-2","rounded-lg","border","border-gray-200","bg-white","p-3","shadow-lg","dar
1k:border-slate-600","dark:bg-slate-800"],["for","confirmPassword",1,"mb-1.5","block","text-sm","font-medium","text-gray-700","dark:text-slate-300"],["id","confirmPassword","formControlName","confirmPassword","autocomplete","new-password","placeholder","Re-enter your password",1,"w-full","rounded-lg","border","border-gray-300","bg-white","py-2.5","pl-4","pr-11","text-sm","outline-none","transition","focus:border-emerald-500","focus:ring-2","focus:ring-emerald-500/20","dark:border-slate-600","dark:bg-slate-800","dark:text-white",3,"focus","blur","type"],["role","status",1,"mt-2","flex","items-center","gap-2","text-xs",3,"text-emerald-700","dark:text-emerald-400","text-gray-500","dark:text-slate-400"],["role","status",1,"rounded-lg","border","border-amber-200","bg-amber-50","px-4","py-3","text-sm","text-amber-900","dark:border-amber-900","dark:bg-amber-950/40","dark:text-amber-200"],["role","alert",1,"rounded-lg","bg-red-50","px-4","py-3","text-sm","text-red-700","dark:bg-red-950/50","dark:text-red-400"],["type","submit",1,"w-full","rounded-lg","bg-emerald-600","py-2.5","text-sm","font-semibold","text-white","transition","hover:bg-emerald-700","disabled:cursor-not-allowed","disabled:opacity-60",3,"disabled"],[1,"mt-6","text-center","text-sm","text-gray-600","dark:text-slate-400"],["routerLink","/auth/sign-in",1,"font-semibold","text-emerald-600","hover:text-emerald-700","dark:text-emerald-400"],["d","M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94"],["d","M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19"],["x1","1","x2","23","y1","1","y2","23"],["d","M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"],["cx","12","cy","12","r","3"],[1,"mb-2","text-xs","font-medium","text-gray-700","dark:text-slate-300"],[1,"space-y-1.5"],[1,"flex","items-center","gap-2","text-xs"],["aria-hidden","true",1,"flex","h-4","w-4","shrink-0","items-center","justify-center","rounded-full"],["xmlns","http://www.w3.org/2000/svg","width","10","height","10","viewBox","0 0 24 24","fill","none","stroke","currentColor","stroke-width","3"],[1,"h-1.5","w-1.5","rounded-full","bg-current"],["d","M20 6 9 17l-5-5"],["role","status",1,"mt-2","flex","items-center","gap-2","text-xs"],["type","button",1,"mt-3","font-semibold","text-emerald-700","hover:text-emerald-800","dark:text-emerald-400","dark:hover:text-emerald-300",3,"click"]],template:function(r,n){r&1&&(o(0,"div",0)(1,"h1",1),s(2,"Create your account"),i(),o(3,"p",2),s(4," Find current offers across your selected credit cards at any store. "),i(),u(5,"app-social-auth-buttons",3),o(6,"p",4),s(7," By creating an account or using Google or Apple sign-in, you agree to our "),o(8,"a",5),s(9," Terms of Service "),i(),s(10," and "),o(11,"a",6),s(12," Privacy Policy "),i(),s(13,". "),i(),o(14,"div",7)(15,"div",8),u(16,"div",9),i(),o(17,"div",10)(18,"span",11),s(19,"Or sign up with email"),i()()(),o(20,"form",12),g("ngSubmit",function(){return n.onSubmit()}),o(21,"div")(22,"label",13),s(23," Full name "),i(),u(24,"input",14),l(25,ae,3,1,"p",15),i(),o(26,"div")(27,"label",16),s(28," Email "),i(),u(29,"input",17),l(30,le,3,1,"p",15),i(),o(31,"div",18)(32,"label",19),s(33," Password "),i(),o(34,"div",20),g("mouseleave",function(){return n.onPasswordFieldMouseLeave()}),o(35,"input",21),g("focus",function(){return n.onPasswordFocus()})("blur",function(){return n.onPasswordBlur()})("input",function(){return n.onPasswordInput()}),i(),o(36,"button",22),g("mousedown",function(f){return f.preventDefault()})("click",function(){return n.togglePasswordVisibility()}),l(37,ce,4,0,":svg:svg",23)(38,ue,3,0,":svg:svg",23),i()(),l(39,ge,6,0,"div",24),l(40,he,3,1,"p",15),i(),o(41,"div")(42,"label",25),s(43," Confirm password "),i(),o(44,"div",20),g("mouseleave",function(){return n.onConfirmPasswordFieldMouseLeave()}),o(45,"input",26),g("focus",function(){return n.onConfirmPasswordFocus()})("blur",function(){return n.onConfirmPasswordBlur()}),i(),o(46,"button",22),g("mousedown",function(f){return f.preventDefault()})("click",function(){return n.toggleConfirmPasswordVisibility()}),l(47,ve,4,0,":svg:svg",23)(48,xe,3,0,":svg:svg",23),i()(),l(49,Se,3,1,"p",15)(50,Pe,5,24,"p",27),i(),l(51,Me,5,1,"div",28),l(52,Ee,2,1,"p",29),o(53,"button",30),l(54,Ue,1,0)(55,Te,1,0),i()(),o(56,"p",31),s(57," Already have an account? "),o(58,"a",32),s(59," Sign in "),i()()()),r&2&&(a(20),y("formGroup",n.form),a(4),w("border-red-500",n.nameInvalid),a(),c(n.nameInvalid?25:-1),a(4),w("border-red-500",n.emailInvalid),a(),c(n.emailInvalid?30:-1),a(5),w("border-red-500",n.passwordInvalid),y("type",n.isPasswordRevealed()?"text":"password"),S("aria-describedby",n.shouldShowPasswordHints()?"password-requirements":null),a(),S("aria-label",n.isPasswordRevealed()?"Hide password":"Show password")("aria-pressed",n.isPasswordRevealed()),a(),c(n.isPasswordRevealed()?37:38),a(2),c(n.shouldShowPasswordHints()?39:-1),a(),c(n.passwordInvalid?40:-1),a(5),w("border-red-500",n.confirmPasswordInvalid),y("type",n.isConfirmPasswordRevealed()?"text":"password"),a(),S("aria-label",n.isConfirmPasswordRevealed()?"Hide password":"Show password")("aria-pressed",n.isConfirmPasswordRevealed()),a(),c(n.isConfirmPasswordRevealed()?47:48),a(2),c(n.confirmPasswordInvalid?49:n.shouldShowPasswordMatchHint()?50:-1),a(2),c(n.verificationNotice()?51:-1),a(),c(n.errorMessage()?52:-1),a(),y("disabled",n.isSubmitting()),a(),c(n.isSubmitting()?54:55))},dependencies:[Q,$,H,G,B,Z,z,L,J],encapsulation:2,changeDetection:0})};export{te as SignUp};
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.