import{a as h,l as b,M as f,O as u,P as c,Q as m,H as w,b as x,q as d,R as L,U as y,h as e,k as C,y as T,x as R}from"./entry.30e55a5e.js";import{d as k}from"./component.bb17d696.js";import A from"./LoginSVG.e12a909b.js";import"./composables.a8da7a35.js";const P=()=>h().$ilingo,p=(t,s)=>P().getSync(`validation.${t}`,s,"en"),N=k({setup(){const t=b({name:"",password:""}),s=f({name:{required:u,minLength:c(3),maxLength:m(255)},password:{required:u,minLength:c(3),maxLength:m(255)}},t),i=w(),g=x(!1),l=async()=>{try{await i.login(t.name,t.password);const a=C(),{redirect:o,...r}=a.query;T({path:o||"/",query:r})}catch(a){a instanceof Error&&R().warning(a.message)}};Promise.resolve().then(i.logout);const v=()=>{const a=d({validationResult:s.value.name,validationTranslator:p,labelContent:"Name",value:t.name,onChange(n){t.name=n}}),o=d({validationResult:s.value.password,validationTranslator:p,labelContent:"Password",value:t.password,onChange(n){t.password=n},props:{type:"password"}}),r=L({validationResult:s.value,createText:"Login",createButtonClass:{value:"btn btn-sm btn-dark btn-block",presets:{[y.BOOTSTRAP_V5]:!1}},createIconClass:"fa-solid fa-right-to-bracket",submit:l,busy:g});return e("div",{class:"container"},[e("h4",[e("i",{class:"fa-solid fa-arrow-right-to-bracket pe-2"}),"Login"]),e("div",{class:"text-center"},[e(A,{height:320})]),e("form",{onSubmit(n){return n.preventDefault(),l.call(null)}},[a,o,r])])};return()=>v()}});export{N as default};
