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-ca24af84.js";import{u as v}from"./useForm-8dad0a2a.js";import{b as F,p as B}from"./env-198ff0f3.js";import{C}from"./Container-30ca10cd.js";import{T as c}from"./Typography-bfd9c243.js";import{C as T,D as j}from"./Divider-ff63ee91.js";import{F as D}from"./FormLabel-903e166f.js";import{I}from"./Input-1c187977.js";import{B as S}from"./Button-2d3d69fe.js";import"./createContainer-b0287129.js";import"./useThemeProps-95e03d4e.js";import"./toPropertyKey-4015efc6.js";import"./useSlot-32c61900.js";import"./ThemeProvider-230a01f4.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};
