import{_ as W}from"./Icon.DriN-LnI.js";import{u as D,_ as ee,a as ae}from"./FormGroup.DRCajoHu.js";import{u as te}from"./id.yqACRMVh.js";import{$ as F,a0 as _,_ as T,f as j,a1 as A,Z as re,A as O,a3 as oe,a4 as ne,o as i,c as f,a as h,am as G,aq as le,a2 as R,l as g,H as q,d as C,t as w,m as y,X as se,F as ie,v as de,k as S,w as p,q as M,r as V,E as ue,g as P,ar as me,j as o,b as c}from"./entry.DV6a5_Hb.js";import{u as B,g as U}from"./selectMenu.BTWQNRd7.js";import{_ as ce}from"./Button.CpdQ1HRJ.js";import{_ as pe}from"./Form.aw325rpi.js";import{_ as fe}from"./nuxt-link.CTQSpHdB.js";import{_ as ge}from"./Card.UdqPYTty.js";import{u as be}from"./useDatalayer.DeAqW70C.js";const ve={wrapper:"relative flex items-start",fieldset:"",legend:"text-sm font-medium text-gray-700 dark:text-gray-200 mb-1",default:{color:"primary"}},J={wrapper:"relative flex items-start",container:"flex items-center h-5",base:"h-4 w-4 dark:checked:bg-current dark:checked:border-transparent disabled:opacity-50 disabled:cursor-not-allowed focus:ring-0 focus:ring-transparent focus:ring-offset-transparent",form:"form-radio",color:"text-{color}-500 dark:text-{color}-400",background:"bg-white dark:bg-gray-900",border:"border border-gray-300 dark:border-gray-700",ring:"focus-visible:ring-2 focus-visible:ring-{color}-500 dark:focus-visible:ring-{color}-400 focus-visible:ring-offset-2 focus-visible:ring-offset-white dark:focus-visible:ring-offset-gray-900",inner:"ms-3 flex flex-col",label:"text-sm font-medium text-gray-700 dark:text-gray-200",required:"text-sm text-red-500 dark:text-red-400",help:"text-sm text-gray-500 dark:text-gray-400",default:{color:"primary"}},N=F(_.ui.strategy,_.ui.radio,J),ye=j({inheritAttrs:!1,props:{id:{type:String,default:null},value:{type:[String,Number,Boolean],default:null},modelValue:{type:[String,Number,Boolean,Object],default:null},name:{type:String,default:null},disabled:{type:Boolean,default:!1},help:{type:String,default:null},label:{type:String,default:null},required:{type:Boolean,default:!1},color:{type:String,default:()=>N.default.color,validator(e){return _.ui.colors.includes(e)}},inputClass:{type:String,default:null},class:{type:[String,Object,Array],default:()=>""},ui:{type:Object,default:()=>({})}},emits:["update:modelValue","change"],setup(e,{emit:a}){const{ui:n,attrs:u}=B("radio",A(e,"ui"),N,A(e,"class")),r=e.id??te("$9ml2Pv5YlC"),d=re("radio-group",null),{emitFormChange:m,color:s,name:b}=d??D(e,N),x=O({get(){return e.modelValue},set(t){a("update:modelValue",t),d||m()}});function $(t){a("change",t.target.value)}const k=O(()=>oe(ne(n.value.base,n.value.form,n.value.background,n.value.border,s.value&&n.value.ring.replaceAll("{color}",s.value),s.value&&n.value.color.replaceAll("{color}",s.value)),e.inputClass));return{inputId:r,ui:n,attrs:u,pick:x,name:b,inputClass:k,onChange:$}}}),he=["data-n-ids"],_e=["id","name","required","value","disabled"],xe=["for"];function ke(e,a,n,u,r,d){return i(),f("div",{class:g(e.ui.wrapper),"data-n-ids":e.attrs["data-n-ids"]},[h("div",{class:g(e.ui.container)},[G(h("input",R({id:e.inputId,"onUpdate:modelValue":a[0]||(a[0]=m=>e.pick=m),name:e.name,required:e.required,value:e.value,disabled:e.disabled,type:"radio",class:e.inputClass},e.attrs,{onChange:a[1]||(a[1]=(...m)=>e.onChange&&e.onChange(...m))}),null,16,_e),[[le,e.pick]])],2),e.label||e.$slots.label?(i(),f("div",{key:0,class:g(e.ui.inner)},[h("label",{for:e.inputId,class:g(e.ui.label)},[q(e.$slots,"label",{},()=>[C(w(e.label),1)]),e.required?(i(),f("span",{key:0,class:g(e.ui.required)},"*",2)):y("",!0)],10,xe),e.help?(i(),f("p",{key:0,class:g(e.ui.help)},w(e.help),3)):y("",!0)],2)):y("",!0)],10,he)}const L=T(ye,[["render",ke]]),I=F(_.ui.strategy,_.ui.radioGroup,ve),$e=F(_.ui.strategy,_.ui.radio,J),Ce=j({components:{URadio:L},inheritAttrs:!1,props:{modelValue:{type:[String,Number,Object],default:""},name:{type:String,default:null},legend:{type:String,default:null},options:{type:Array,default:()=>[]},optionAttribute:{type:String,default:"label"},valueAttribute:{type:String,default:"value"},disabled:{type:Boolean,default:!1},color:{type:String,default:()=>I.default.color,validator(e){return _.ui.colors.includes(e)}},class:{type:[String,Object,Array],default:()=>""},ui:{type:Object,default:()=>({})},uiRadio:{type:Object,default:()=>({})}},emits:["update:modelValue","change"],setup(e,{emit:a}){const{ui:n,attrs:u}=B("radioGroup",A(e,"ui"),I,A(e,"class")),{ui:r}=B("radio",A(e,"uiRadio"),$e),{emitFormChange:d,color:m,name:s}=D(e,I);se("radio-group",{color:m,name:s});const b=l=>{a("update:modelValue",l),a("change",l),d()},x=l=>U(l,e.valueAttribute,U(l,e.optionAttribute)),$=l=>U(l,e.optionAttribute,U(l,e.valueAttribute)),k=l=>["string","number","boolean"].includes(typeof l)?{value:l,label:l}:{...l,value:x(l),label:$(l)},t=O(()=>e.options.map(l=>k(l)));return{ui:n,uiRadio:r,attrs:u,normalizedOptions:t,onUpdate:b}}});function Se(e,a,n,u,r,d){const m=L;return i(),f("div",{class:g(e.ui.wrapper)},[h("fieldset",R(e.attrs,{class:e.ui.fieldset}),[e.legend||e.$slots.legend?(i(),f("legend",{key:0,class:g(e.ui.legend)},[q(e.$slots,"legend",{},()=>[C(w(e.legend),1)])],2)):y("",!0),(i(!0),f(ie,null,de(e.normalizedOptions,s=>(i(),S(m,{key:s.value,label:s.label,"model-value":e.modelValue,value:s.value,help:s.help,disabled:s.disabled||e.disabled,ui:e.uiRadio,onChange:b=>e.onUpdate(s.value)},{label:p(()=>[q(e.$slots,"label",R({ref_for:!0},{option:s}))]),_:2},1032,["label","model-value","value","help","disabled","ui","onChange"]))),128))],16)],2)}const Ve=T(Ce,[["render",Se]]),Ae=e=>{const a=M.get(e),n=V("idle"),u=V(!1);V();const r=ue({email:"",name:"",phone:"",unity:""}),d=V([]),m=/^[a-z0-9._]+@[a-z0-9]+\.[a-z]+(\.[a-z]+)?$/,s=/^[A-Za-záàâãéèêíïóôõöúçñÁÀÂÃÉÈÍÏÓÔÕÖÚÇÑ ]+$/,b=async()=>(d.value=[],(!r.name||r.name.split(" ").length<2||r.name.length<3||!s.test(r.name))&&d.value.push({path:"name",message:"Nome e Sobrenome são obrigatórios"}),(!r.email||!m.test(r.email))&&d.value.push({path:"email",message:"Email é obrigatório"}),(!r.phone||r.phone.length!=16)&&d.value.push({path:"phone",message:"Telefone é obrigatório"}),!r.unity&&a.salesforceId=="6"&&d.value.push({path:"unity",message:"Unidade é obrigatória"}),d.value);async function x(k){try{u.value=!0,(await fetch("https://d7k0k9t9ed.execute-api.us-east-1.amazonaws.com/v1/create-lead-medicina",{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":"HdAPoQ&%e2X1d45xE3*aT*"},body:JSON.stringify({firstName:r.name.split(" ")[0],lastName:r.name.split(" ")[1],email:r.email,mobilePhone:r.phone.replace(/[\s()-]/g,""),originLead:"Pop_up_lpconversao",institution:a.salesforceId,unity:r.unity?r.unity:""})})).status===201?n.value="success":n.value="error",u.value=!0}catch{u.value=!0,n.value="error",u.value=!1}u.value=!1}return{state:r,formStatus:n,validate:b,onSubmit:x,onError:k=>{const t=document.getElementById(k.errors[0].id);return t==null||t.focus(),t==null||t.scrollIntoView({behavior:"smooth",block:"center"}),n.value="error","error"},loading:u}},Ee={key:0},Ue={class:"mb-5 font-bold text-[var(--text-light-primary)] text-base dark:text-[var(--text-dark-primary)]"},we={key:0},ze={key:1},Ne={class:"max-sm:block gap-4 max-md:grid grid-cols-2"},Ie={key:2,class:"text-[var(--text-light-primary)]"},Oe=h("p",{class:"mb-2 font-bold text-xl"},"Dados recebidos com sucesso!",-1),Re=h("p",{class:"mb-0"}," Aproveite e descubra tudo que a nossa plataforma de cursos têm a oferecer. ",-1),qe=[Oe,Re],Be={key:3,class:"mt-4 mb-0 font-medium text-[10px] text-[var(--text-light-secondary)] dark:text-[var(--text-dark-primary)]"},He=j({__name:"FormCatalead",props:{header:{type:Boolean},setStyle:{}},setup(e){const{state:a,formStatus:n,validate:u,onSubmit:r,onError:d,loading:m}=Ae(P().public.ie),s=e,b=V([{value:"MEDJACOBINA",label:"Jacobina"},{value:"MEDIRECE",label:"Irecê"}]),x=M.get(P().public.ie),{trackEvent:$}=be();return(k,t)=>{const l=W,z=ee,E=ae,X=Ve,H=ce,Z=pe,K=fe,Q=ge,Y=me("maska");return i(),S(Q,{class:"bg-[#DCDCE0] my-10 p-0 faqForm",ui:{body:{padding:s.setStyle}}},{default:p(()=>[s.header?(i(),f("header",Ee,[h("p",Ue,[o(n)==="idle"?(i(),f("span",we," É muito fácil! Preencha o formulário e nós entraremos em contato com você! ")):o(n)==="error"?(i(),f("span",ze," Erro no envio dos dados. Por favor, tente novamente. ")):y("",!0)])])):y("",!0),o(n)!=="success"?(i(),S(Z,{key:1,ref:"form",validate:o(u),state:o(a),onSubmit:o(r),onError:o(d)},{default:p(()=>[h("div",Ne,[c(E,{class:"col-start-1 col-end-3",name:"name",label:"Nome Completo",ui:{label:{base:"hidden label-name text-base relative"}}},{default:p(()=>[c(z,{modelValue:o(a).name,"onUpdate:modelValue":t[0]||(t[0]=v=>o(a).name=v),size:"xl",variant:"none",class:g(` dark:text-[var(--text-dark-primary)] inputForm mt-0 sm:mt-0 text-[var(--text-light-secondary)] [&>span]:pr-1 after:content-['Nome'] after:absolute block after:transition-transform after:left-1 transition-top after:duration-150 after:ease-linear after:-z-10 ${o(a).name?"after:!-translate-y-14 text-sm":"after:!-translate-y-7"} [&+p]:mb-2`),ui:{base:"placeholder:text-[var(--text-light-secondary)] !pl-1 border-b-[1px] !rounded-none focus:border-[var(--light-primary)] invalid:p-10 "},trailing:"",placeholder:""},{trailing:p(()=>[c(l,{name:"i-mingcute-user-3-line",class:"text-[var(--text-light-secondary)] text-2xl",dynamic:""})]),_:1},8,["modelValue","class","ui"])]),_:1}),c(E,{name:"email",type:"email",label:"E-mail",ui:{label:{base:"hidden label-email text-base relative"}}},{default:p(()=>[c(z,{modelValue:o(a).email,"onUpdate:modelValue":t[1]||(t[1]=v=>o(a).email=v),size:"xl",variant:"none",class:g(`dark:text-[var(--text-dark-primary)] inputForm mt-7 text-[var(--text-light-secondary)] [&>span]:pr-1 after:content-['E-mail'] after:absolute block after:transition-transform after:left-1 transition-top after:duration-150 after:ease-linear after:-z-10 ${o(a).email?"after:!-translate-y-14 text-sm":"after:!-translate-y-7"} [&+p]:mb-2`),ui:{base:"placeholder:text-[var(--text-light-secondary)] !pl-1 border-b-[1px] !rounded-none focus:border-[var(--light-primary)] invalid:p-10 "},trailing:"",placeholder:""},{trailing:p(()=>[c(l,{name:"i-gravity-ui-envelope",class:"text-[var(--text-light-secondary)] text-2xl",dynamic:""})]),_:1},8,["modelValue","class","ui"])]),_:1}),c(E,{name:"phone",label:"Telefone",ui:{label:{base:"hidden label-phone text-base relative"}}},{default:p(()=>[G((i(),S(z,{type:"tel",modelValue:o(a).phone,"onUpdate:modelValue":t[2]||(t[2]=v=>o(a).phone=v),"data-maska":"(##) # ####-####",size:"xl",nu:"",variant:"none",class:g(`dark:text-[var(--text-dark-primary)] inputForm mt-7 text-[var(--text-light-secondary)] [&>span]:pr-1 after:content-['Telefone'] after:absolute block after:transition-transform after:left-1 transition-top after:duration-150 after:ease-linear after:-z-10 ${o(a).phone?"after:!-translate-y-14 text-sm":"after:!-translate-y-7"} [&+p]:mb-0`),ui:{base:"placeholder:text-[var(--text-light-secondary)] !pl-1 border-b-[1px] !rounded-none focus:border-[var(--light-primary)] invalid:p-10 "},trailing:"",placeholder:""},{trailing:p(()=>[c(l,{name:"i-ic-outline-call",class:"text-[var(--text-light-secondary)] text-2xl",dynamic:""})]),_:1},8,["modelValue","class","ui"])),[[Y]])]),_:1})]),o(x).salesforceId=="6"?(i(),S(E,{key:0,name:"unity"},{default:p(()=>[c(X,{modelValue:o(a).unity,"onUpdate:modelValue":t[3]||(t[3]=v=>o(a).unity=v),options:o(b),ui:{label:{base:"hidden"}},class:"flex pt-2"},null,8,["modelValue","options"])]),_:1})):y("",!0),c(H,{type:"submit",loading:o(m),onClick:t[4]||(t[4]=v=>o($)({event:"measure_click",content:"formulário"})),class:"justify-center border-[var(--light-primary)] bg-[var(--light-primary)] hover:bg-[var(--light-hover)] dark:hover:bg-[var(--light-hover)] active:bg-[var(--light-pressed)] dark:bg-[var(--light-primary)] mt-6 p-3 md:p-4 rounded-lg w-full font-bold text-[var(--text-dark-primary)] dark:text-[var(--text-dark-primary)] hover:transition-all"},{default:p(()=>[C(w(o(n)==="error"?"Enviar Novamente":"Enviar")+" ",1),c(l,{name:"i-heroicons-arrow-long-right-16-solid",class:"[var(--text-dark-primary)] text-2xl",dynamic:""})]),_:1},8,["loading"])]),_:1},8,["validate","state","onSubmit","onError"])):(i(),f("div",Ie,qe)),o(n)!=="success"?(i(),f("p",Be,[C(" Prometemos não te mandar SPAM. Usaremos seus dados para compartilhar informações solicitadas através deste formulário. Você pode cancelar o envio da divulgação a qualquer momento, diretamente nas mensagens encaminhadas por nós através do nosso "),c(K,{to:"/canal-de-privacidade/",external:"",target:"_blank",class:"font-bold dark:text-[var(--text-dark-primary)]"},{default:p(()=>[C(" canal de privacidade")]),_:1}),C(". ")])):y("",!0)]),_:1},8,["ui"])}}});export{He as _};