import{U as h,r as f,u as g,x,j as e,N as y,e as b,B as t,l as i,t as d}from"./index-cc84e56a.js";import{u as v}from"./useForm-48439e2f.js";import{b as F,p as B}from"./env-198ff0f3.js";import{C}from"./Container-56e8d2d4.js";import{T as l}from"./Typography-436dee75.js";import{C as T,D as j}from"./Divider-eb6dacdd.js";import{F as D}from"./FormLabel-9467409c.js";import{I}from"./Input-01234fc2.js";import{B as S}from"./Button-aec6464b.js";import"./createContainer-a5dd8c1d.js";import"./useThemeProps-34ae68cb.js";import"./useSlot-ba206985.js";import"./ThemeProvider-223d3881.js";const $=async o=>{const{data:a}=await h.post(`${F}/${B}/rest/firma/login`,{dni:o});return a},J=()=>{const[o,a]=f.useState(!1),{authenticateSignature:c,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:i(t,{sx:{paddingTop:"2em"},children:[e(l,{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:i("div",{style:{backgroundColor:"#FFF",padding:"2rem",borderRadius:"8px"},children:[e(l,{level:"h2",gutterBottom:!0,component:"h2",children:"Ingresá los datos solicitados."}),i("form",{style:{marginTop:"1em"},onSubmit:async u=>{a(!0),u.preventDefault();const r=await $(m);r.success?(d.success("Verificado!"),c(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{J as default};
