import{y as h,r as f,u as g,k as x,j as e,N as y,e as b,B as t,f as a,n as d}from"./index-7ecf457b.js";import{u as v}from"./useForm-26d3e0f9.js";import{b as F,p as B}from"./env-198ff0f3.js";import{C}from"./Container-74bcd912.js";import{T as c}from"./Typography-5fdc26ed.js";import{C as T,D as j}from"./Divider-3cc10c1d.js";import{F as D}from"./FormLabel-12cee925.js";import{I}from"./Input-362a0c7f.js";import{B as S}from"./Button-f52e6177.js";import"./createContainer-f29fb9c0.js";import"./useThemeProps-71110af6.js";import"./toPropertyKey-4015efc6.js";import"./useSlot-2c8854f2.js";import"./ThemeProvider-6c805d26.js";const $=async o=>{const{data:i}=await h.post(`${F}/${B}/rest/firma/login`,{dni:o});return i},K=()=>{const[o,i]=f.useState(!1),{authenticateSignature:l,authFirma:s}=g(),n=x();if(s)return e(y,{to:`/firma/${s.idFirma}`});const{dni:m,codigo:w,handleChange:p}=v({dni:"",codigo:""});return b({typography:{fontFamily:["Poppins","sans-serif"].join(",")}}),e(T,{children:e(t,{children:e(C,{maxWidth:"xl",children:e(t,{sx:{},children:a(t,{sx:{paddingTop:"2em"},children:[e(c,{level:"h1",gutterBottom:!0,component:"h1",children:"Verificación de acceso"}),e(j,{}),e(t,{width:"100%",sx:{display:"flex",alignItems:"center",justifyContent:"center",padding:"1em",marginTop:"2em"},children:a("div",{style:{backgroundColor:"#FFF",padding:"2rem",borderRadius:"8px"},children:[e(c,{level:"h2",gutterBottom:!0,component:"h2",children:"Ingresá los datos solicitados."}),a("form",{style:{marginTop:"1em"},onSubmit:async u=>{i(!0),u.preventDefault();const r=await $(m);r.success?(d.success("Verificado!"),l(r),r.firmado?n("/firmados",{replace:!0}):n(`/firma/${r.idFirma}`,{replace:!0})):d.error(r.msg)},children:[e(D,{children:"Documento"}),e(I,{sx:{marginTop:"5px"},type:"number",fullWidth:!0,name:"dni",required:!0,value:m,onChange:p,placeholder:"Ingresa tu numero de documento"}),e(S,{sx:{marginTop:"1em"},fullWidth:!0,variant:"solid",type:"submit",children:"Ingresar"})]})]})})]})})})})})};export{K as default};
