text: import{a as m}from"../chunk-PBMLQVPD.js";import{d as s,j as n,k as o,l as c}from"../chunk-PSRONZ2A.js";import{a}from"../chunk-YJ2DKIZS.js";var r=class{node=null;titleElem=null;emailInputElem=null;passwordInputElem=null;passwordLabelElem=null;signUpBtn=null;signInBtn=null;cancelBtn=null;authService=null;signUpBtnClickHandler;cancelBtnClickHandler;formSubmitHandler;static get instance(){return r.page||(r.page=new r),r.page}constructor(){this.formSubmitHandler=t=>{t.preventDefault();let l=this.node?.querySelector(".main-card form"),i=new FormData(l);console.log("Form submited: "),i.forEach((e,d)=>{console.log(d+":",e)})},this.signUpBtnClickHandler=t=>o(t,this.signUpBtn),this.cancelBtnClickHandler=t=>o(t,this.cancelBtn)}get elem(){return this.node}async init(t,l){let i=await c(t,l,[]);this.node=i.querySelector('[data-page="signin-page"]')||null;let e=this.node?.querySelector(".main-card form");return this.titleElem=this.node?.querySelector('[data-title="main"]')||null,this.emailInputElem=e?.querySelector("#email")||null,this.passwordInputElem=e?.querySelector("#password")||null,this.passwordLabelElem=e?.querySelector("#password-label")||null,this.signUpBtn=e?.querySelector('[data-button="sign-up"]')||null,this.signInBtn=e?.querySelector('[data-button="sign-in"]')||null,this.cancelBtn=e?.querySelector('[data-button="cancel"]')||null,this.authService=new m,await this.authService.init(this,l),i}async mount(){this.node?.querySelector(".main-card form")?.addEventListener("submit",this.formSubmitHandler),this.signUpBtn?.addEventListener("click",this.signUpBtnClickHandler),this.cancelBtn?.addEventListener("click",this.cancelBtnClickHandler)}async unmount(){this.node?.querySelector(".main-card form")?.removeEventListener("submit",this.formSubmitHandler),this.signUpBtn?.removeEventListener("click",this.signUpBtnClickHandler),this.cancelBtn?.removeEventListener("click",this.cancelBtnClickHandler)}async load(t,l,i){this.titleElem&&(this.titleElem.textContent=n.tr("Sign In")),this.passwordInputElem&&(this.passwordInputElem.placeholder=n.tr("Password")+"*"),this.passwordLabelElem&&(this.passwordLabelElem.textContent=n.tr("Password")+"*"),this.signUpBtn&&(this.signUpBtn.textContent=n.tr("Sign Up")),this.signInBtn&&(this.signInBtn.textContent=n.tr("Sign In")),this.cancelBtn&&(this.cancelBtn.textContent=n.tr("Cancel")),this.signUpBtn?.setAttribute("href",(t===s?"":`/${t}`)+"/sign-up"),this.cancelBtn?.setAttribute("href",(t===s?"":`/${t}`)+"/"),await this.authService?.load?.(t,l,i)}},u=r;a(u,"page",null);export{u as SignInPage};
  