import{r as o,h as r,H as t}from"./p-d55626d1.js";import{c as a}from"./p-2fd22ed9.js";import"./p-0bc4f624.js";import"./p-9bfc48ee.js";import{r as s}from"./p-097729d8.js";import{a as e}from"./p-c1c5b589.js";import{s as m}from"./p-62c3d279.js";import{c as i}from"./p-c7f96882.js";const l=class{constructor(r){o(this,r),this.formId="login"}componentWillLoad(){e.identity&&s.router.push("/")}async formEventHandler({detail:o}){if(o.formId!=this.formId)return;const r=await a.client.mutate({mutation:m(i),variables:{email:o.email.value,password:o.password.value}});r.data.userAuthenticate?(e.identity=r.data.userAuthenticate,this.onSuccess?this.onSuccess():s.router.push("/")):this.onFail&&this.onFail()}render(){return r(t,null,r("corejam-box",{p:8,max:"md",mx:"auto",px:4,lgPx:0,flex:!0,direction:"col",justify:"between",mb:24},r("corejam-flash",null),r("corejam-box",{w:"5",mx:"auto"},r("corejam-form-container",{name:this.formId},r("corejam-box",null,r("corejam-form-input",{name:"email",type:"text",formId:this.formId,label:"Email"}),r("corejam-box",null,r("corejam-form-input",{name:"password",type:"password",formId:this.formId,label:"Password"})),r("corejam-box",{flex:!0,direction:"col"},r("corejam-box",null,r("corejam-form-submit",{formId:this.formId},r("button",{type:"submit"},"Login"))),r("corejam-box",null,r("corejam-base-link",{href:"/login/reset"},"Reset Password"))))))))}};export{l as auth_form_login}