1import{r as x,j as e}from"./index-CCp-S6KE.js";function j(){const[n,c]=x.useState({nome:"",rg:"",cpf:"",cep:"",email:"",telefone:"",endereco:"",numero:"",complemento:"",bairro:"",cidade:"",estado:""});function d(a){return a.replace(/\D/g,"").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})/,"$1-$2").replace(/(-\d{2})\d+?$/,"$1")}function t(a){return a.replace(/\D/g,"").replace(/(\d{5})(\d)/,"$1-$2").replace(/(-\d{3})\d+?$/,"$1")}function s(a){return a.replace(/\D/g,"").replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{5})(\d)/,"$1-$2").replace(/(-\d{4})\d+?$/,"$1")}function m(a){return a.replace(/\D/g,"").replace(/(\d{2})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1})/,"$1-$2").replace(/(-\d{1})\d+?$/,"$1")}function l(a){const{name:o,value:r}=a.target;let i=r;o==="cpf"&&(i=d(r)),o==="cep"&&(i=t(r)),o==="telefone"&&(i=s(r)),o==="rg"&&(i=m(r)),c({...n,[o]:i})}function u(){const a=n.cpf.replace(/\D/g,""),o=n.cep.replace(/\D/g,""),r=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return n.nome?r.test(n.email)?a.length!==11?"CPF inválido":o.length!==8?"CEP inválido":!n.telefone||n.telefone.replace(/\D/g,"").length<10?"Telefone inválido":null:"E-mail inválido":"Nome obrigatório"}async function p(){const a=n.cep.replace(/\D/g,"");if(a.length===8)try{const r=await(await fetch(`https://viacep.com.br/ws/${a}/json/`)).json();r.erro||c(i=>({...i,endereco:r.logradouro||"",bairro:r.bairro||"",cidade:r.localidade||"",estado:r.uf||""}))}catch{console.error("Erro ao buscar CEP")}}function h(){const a=u();if(a){alert(a);return}const o=`Olá, meu nome é ${n.nome} 2E-mail: ${n.email} 3Telefone: ${n.telefone} 4 5RG: ${n.rg} 6CPF: ${n.cpf} 7 8Endereço: 9${n.endereco}, ${n.numero} 10${n.complemento||""} 11${n.bairro} 12${n.cidade} - ${n.estado} 13CEP: ${n.cep}`,i=`https://wa.me/5508004445799?text=${encodeURIComponent(o)}`;window.open(i,"_blank")}return e.jsx("div",{className:"container-form-mundiale",children:e.jsxs("div",{className:"form-mundiale",children:[e.jsx("div",{children:"Dados Mundiale"}),e.jsxs("div",{children:[e.jsx("label",{children:"Nome"}),e.jsx("input",{name:"nome",value:n.nome,onChange:l})]}),e.jsxs("div",{children:[e.jsx("label",{children:"E-mail"}),e.jsx("input",{name:"email",value:n.email,onChange:l})]}),e.jsxs("div",{children:[e.jsx("label",{children:"Telefone"}),e.jsx("input",{name:"telefone",value:n.telefone,onChange:l,maxLength:15})]}),e.jsxs("div",{children:[e.jsx("label",{children:"RG"}),e.jsx("input",{name:"rg",value:n.rg,onChange:l})]}),e.jsxs("div",{children:[e.jsx("label",{children:"CPF"}),e.jsx("input",{name:"cpf",value:n.cpf,onChange:l,maxLength:14})]}),e.jsxs("div",{children:[e.jsx("label",{children:"CEP"}),e.jsx("input",{name:"cep",value:n.cep,onChange:l,onBlur:p,maxLength:9})]}),e.jsxs("div",{children:[e.jsx("label",{children:"Endereço"}),e.jsx("input",{name:"endereco",value:n.endereco,onChange:l})]}),e.jsxs("div",{children:[e.jsx("label",{children:"Número"}),e.jsx("input",{name:"numero",value:n.numero,onChange:l})]}),e.jsxs("div",{children:[e.jsx("label",{children:"Complemento"}),e.jsx("input",{name:"complemento",value:n.complemento,onChange:l})]}),e.jsxs("div",{children:[e.jsx("label",{children:"Bairro"}),e.jsx("input",{name:"bairro",value:n.bairro,onChange:l})]}),e.jsxs("div",{children:[e.jsx("label",{children:"Cidade"}),e.jsx("input",{name:"cidade",value:n.cidade,onChange:l})]}),e.jsxs("div",{children:[e.jsx("label",{children:"Estado"}),e.jsx("input",{name:"estado",value:n.estado,onChange:l})]}),e.jsx("button",{onClick:h,children:"Enviar"})]})})}export{j as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.