import{d as m,u as y,c as o,a as e,b as a,t as f,e as x,w as g,f as c,v as b,g as v,r as u,o as s}from"./index-BaNRFt4f.js";const w={class:"min-h-screen flex items-center justify-center bg-gray-100 px-4"},h={class:"w-full max-w-sm"},k={class:"bg-white rounded-lg shadow-sm border border-gray-200 p-6 sm:p-8"},C={key:0,class:"mb-4 px-3 py-2.5 text-sm text-red-700 bg-red-50 border border-red-200 rounded-md"},_={class:"relative"},M=["type"],B={key:0,class:"w-5 h-5",fill:"none",stroke:"currentColor","stroke-width":"1.5",viewBox:"0 0 24 24"},L={key:1,class:"w-5 h-5",fill:"none",stroke:"currentColor","stroke-width":"1.5",viewBox:"0 0 24 24"},V=["disabled"],D={key:0,class:"animate-spin h-4 w-4 mx-auto text-white",fill:"none",viewBox:"0 0 24 24"},j={key:1},A=m({__name:"LoginView",setup(I){const r=y(),i=u(""),d=u(""),n=u(!1);async function p(){try{await r.login(i.value,d.value)}catch{}}return(N,t)=>(s(),o("div",w,[e("div",h,[e("div",k,[t[8]||(t[8]=e("div",{class:"text-center mb-6"},[e("h1",{class:"text-xl font-semibold text-gray-900"},"Elecciones"),e("p",{class:"text-sm text-gray-500 mt-1"},"Inicia sesión para continuar")],-1)),a(r).error?(s(),o("div",C,f(a(r).error),1)):x("",!0),e("form",{onSubmit:g(p,["prevent"]),class:"space-y-4"},[e("div",null,[t[3]||(t[3]=e("label",{for:"credential",class:"block text-sm font-medium text-gray-700 mb-1"}," Correo electrónico o DNI ",-1)),c(e("input",{id:"credential","onUpdate:modelValue":t[0]||(t[0]=l=>i.value=l),type:"text",placeholder:"admin@gmail.com o 12345678",required:"",autocomplete:"username",class:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500 transition"},null,512),[[b,i.value]])]),e("div",null,[t[6]||(t[6]=e("label",{for:"password",class:"block text-sm font-medium text-gray-700 mb-1"}," Contraseña ",-1)),e("div",_,[c(e("input",{id:"password","onUpdate:modelValue":t[1]||(t[1]=l=>d.value=l),type:n.value?"text":"password",placeholder:"••••••••",required:"",autocomplete:"current-password",class:"w-full px-3 py-2 pr-10 border border-gray-300 rounded-md text-sm placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500 transition"},null,8,M),[[v,d.value]]),e("button",{type:"button",class:"absolute right-2.5 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 transition",onClick:t[2]||(t[2]=l=>n.value=!n.value)},[n.value?(s(),o("svg",L,[...t[5]||(t[5]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.98 8.223A10.477 10.477 0 001.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"},null,-1)])])):(s(),o("svg",B,[...t[4]||(t[4]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"},null,-1),e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"},null,-1)])]))])])]),e("button",{type:"submit",disabled:a(r).loading,class:"w-full py-2.5 px-4 bg-primary-600 text-white text-sm font-medium rounded-md hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed transition"},[a(r).loading?(s(),o("svg",D,[...t[7]||(t[7]=[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"},null,-1)])])):(s(),o("span",j,"Iniciar sesión"))],8,V)],32),t[9]||(t[9]=e("p",{class:"mt-4 text-center text-xs text-gray-400"},"Los personeros pueden ingresar con su número de DNI",-1))])])]))}});export{A as default};
