1import{r as u,j as e,s as P}from"./index-bMFZPluE.js";import{a as z}from"./emailApi-BQfIvn0G.js";import{e as q}from"./educationCatalog-pqwMnMBs.js";import{v as A,n as E}from"./phoneFormatting-bIoASOCT.js";import{f as $,P as g}from"./PrivacyPolicy-B2143qp5.js";import{C as T}from"./CompactPrivacyNotice-Dx4_VTkN.js";const R=q.filter(l=>l!=="Idiomas / Adultos"),h=(l,s)=>`${String(l||"").trim()} ${String(s||"").trim()}`.trim(),D=l=>String(l||"").trim().split(/\s+/)[0]||"",L=l=>{const s=l.toLowerCase();return s.includes("bach")?["Matemáticas Bach Ciencias","Matemáticas Bach Sociales","FÃsica","QuÃmica","Lengua","Inglés"]:s.includes("3º eso")||s.includes("4º eso")?["Matemáticas","FÃsica","QuÃmica","Lengua","Inglés","Apoyo general / Deberes"]:["Matemáticas","Lengua","Inglés","Ciencias","Apoyo general / Deberes"]},Q=()=>{const l=typeof window<"u"&&["localhost","127.0.0.1"].includes(window.location.hostname),[s,d]=u.useState(0),[p,c]=u.useState(!1),[m,f]=u.useState(!1),[a,r]=u.useState({course:"",subject_needed:[],studyTime:"",root_cause:"",help_type:"",previous_tutor:"",parent_first_name:"",parent_last_name:"",student_first_name:"",student_last_name:"",email:"",locality:"",province:"",modality:"Clases Online",phone:"+34 "}),o=()=>d(s+1),v=t=>{r({...a,previous_tutor:t}),d(7),setTimeout(()=>{d(8)},2500)},y=t=>{const n=a.subject_needed.includes(t);r({...a,subject_needed:n?a.subject_needed.filter(i=>i!==t):[...a.subject_needed,t]})},j=async t=>{if(t.preventDefault(),!m){alert("Antes de enviar el test, necesitamos que confirmes que has leido la informacion de privacidad.");return}if(c(!0),!a.parent_first_name.trim()||!a.parent_last_name.trim()||!a.student_first_name.trim()||!a.student_last_name.trim()){alert("Necesitamos nombre y apellidos del tutor y del alumno para dejar bien preparado el siguiente paso."),c(!1);return}const n=A(a.phone,"WhatsApp de contacto");if(!n.ok){alert(n.error),c(!1);return}if(l){d(9),c(!1);return}const i=a.subject_needed.join(", "),x=h(a.parent_first_name,a.parent_last_name),w=h(a.student_first_name,a.student_last_name),b=`Respuestas Test Web: 2- Curso: ${a.course} 3- Asignaturas: ${i} 4- Hábitos: ${a.studyTime} 5- Problema: ${a.root_cause} 6- Objetivo: ${a.help_type} 7- Experiencia previa: ${a.previous_tutor}`,_=["Entrada desde Test de Nivel de la web.",`[Tutor nombre] ${a.parent_first_name.trim()}`,`[Tutor apellidos] ${a.parent_last_name.trim()}`,`[Alumno nombre] ${a.student_first_name.trim()}`,`[Alumno apellidos] ${a.student_last_name.trim()}`,b,`[Privacidad] Informacion aceptada · version ${g} · ${new Date().toISOString()}`].join(` 8`),{data:k,error:C}=await P.rpc("submit_public_lead",{payload:{parent_name:x,student_name:w,email:a.email,phone:E(a.phone),locality:a.locality,province:a.province,modality:a.modality,level:a.course,subjects:i,subject_needed:i,quiz_result:b,notes:_,origin:"Test Web",privacy_confirmed:m,privacy_version:g,collection_context:"public"}});C?alert("Error al enviar. Por favor, revisa tu conexión."):(`${D(x)}${i}${a.modality}${a.phone}`,z({template:"lead_intake_confirmation",recordId:String(k||"")}).catch(S=>console.error("Aviso: Email automático no enviado",S)),d(9)),c(!1)},N=Math.min(100,s/6*100);return e.jsx("div",{className:"w-full bg-transparent font-sans p-1 sm:p-2",children:e.jsxs("div",{className:"bg-white w-full max-w-md mx-auto rounded-[24px] overflow-hidden relative border border-gray-100 shadow-sm",children:[e.jsxs("div",{className:"bg-gradient-to-br from-[#1c74e9] to-blue-800 p-8 text-center text-white relative",children:[e.jsx("div",{className:"w-16 h-16 bg-white/20 rounded-2xl mx-auto flex items-center justify-center text-3xl mb-4 shadow-inner border border-white/20 backdrop-blur-sm",children:"ð¯"}),e.jsx("h2",{className:"font-black text-2xl tracking-tight leading-none mb-1",children:"Test de Nivel"}),e.jsx("p",{className:"text-blue-200 text-[10px] font-bold uppercase tracking-widest",children:"Diagnóstico Educativo"})]}),s>0&&s<7&&e.jsx("div",{className:"w-full bg-gray-100 h-1.5",children:e.jsx("div",{className:"bg-orange-500 h-full transition-all duration-500 ease-out",style:{width:`${N}%`}})}),e.jsxs("div",{className:"p-6 sm:p-8 min-h-[300px] flex flex-col justify-center",children:[s===0&&e.jsxs("div",{className:"text-center animate-in fade-in",children:[e.jsx("h3",{className:"text-gray-900 font-black text-xl mb-3",children:"¿Aprobará el curso este año?"}),e.jsx("p",{className:"text-gray-500 text-sm mb-8 leading-relaxed",children:"Responde a 6 rápidas preguntas y nuestro equipo evaluará su situación académica para diseñar el plan de refuerzo ideal."}),e.jsx("button",{onClick:o,className:"w-full bg-[#1c74e9] text-white font-black uppercase text-xs tracking-widest py-4 rounded-2xl shadow-lg shadow-blue-500/30 active:scale-95 transition-transform",children:"Comenzar Diagnóstico â±ï¸"}),e.jsx("p",{className:"text-[9px] text-gray-400 mt-4 uppercase tracking-widest font-bold",children:"100% Gratuito y sin compromiso"})]}),s===1&&e.jsxs("div",{className:"animate-in slide-in-from-right",children:[e.jsx("p",{className:"text-[#1c74e9] text-[10px] font-black uppercase tracking-widest mb-2",children:"Pregunta 1 de 6"}),e.jsx("h3",{className:"text-gray-900 font-black text-lg mb-4",children:"¿En qué curso está actualmente?"}),e.jsx("div",{className:"grid grid-cols-1 gap-3",children:R.map(t=>e.jsx("button",{onClick:()=>{r({...a,course:t}),o()},className:"w-full text-left bg-gray-50 border border-gray-200 p-4 rounded-xl text-gray-700 font-bold text-sm hover:bg-blue-50 hover:border-[#1c74e9] transition-all active:scale-95",children:t},t))})]}),s===2&&e.jsxs("div",{className:"animate-in slide-in-from-right",children:[e.jsx("p",{className:"text-[#1c74e9] text-[10px] font-black uppercase tracking-widest mb-2",children:"Pregunta 2 de 6"}),e.jsxs("h3",{className:"text-gray-900 font-black text-lg mb-4",children:["¿Qué asignaturas
8necesita reforzar? ",e.jsx("span",{className:"text-gray-400 text-sm font-normal block mt-1",children:"(Puedes elegir varias)"})]}),e.jsx("div",{className:"grid grid-cols-1 gap-2.5 mb-5",children:L(a.course).map(t=>{const n=a.subject_needed.includes(t);return e.jsxs("button",{onClick:()=>y(t),className:`w-full text-left p-4 rounded-xl font-bold text-sm transition-all active:scale-95 flex justify-between items-center ${n?"bg-blue-50 border-[#1c74e9] text-[#1c74e9] border-2 shadow-sm":"bg-gray-50 border-gray-200 text-gray-700 hover:bg-blue-50 hover:border-blue-200 border"}`,children:[e.jsx("span",{children:t}),n?e.jsx("span",{className:"text-[#1c74e9]",children:"â
"}):e.jsx("span",{className:"opacity-30 border border-gray-300 rounded-full w-5 h-5 flex items-center justify-center pb-0.5",children:"+"})]},t)})}),e.jsx("button",{onClick:o,disabled:a.subject_needed.length===0,className:"w-full bg-[#1c74e9] text-white font-black uppercase text-xs tracking-widest py-4 rounded-2xl shadow-lg shadow-blue-500/30 active:scale-95 transition-transform disabled:opacity-50 disabled:cursor-not-allowed",children:"Continuar âº"})]}),s===3&&e.jsxs("div",{className:"animate-in slide-in-from-right",children:[e.jsx("p",{className:"text-[#1c74e9] text-[10px] font-black uppercase tracking-widest mb-2",children:"Pregunta 3 de 6"}),e.jsx("h3",{className:"text-gray-900 font-black text-lg mb-4",children:"¿Cuántas horas estudia en casa por las tardes?"}),e.jsx("div",{className:"grid grid-cols-1 gap-3",children:["Casi nada, hay que obligarle","Una horita, pero se distrae mucho","Más de 2 horas (Se esfuerza pero no rinde)"].map(t=>e.jsx("button",{onClick:()=>{r({...a,studyTime:t}),o()},className:"w-full text-left bg-gray-50 border border-gray-200 p-4 rounded-xl text-gray-700 font-bold text-sm hover:bg-blue-50 hover:border-[#1c74e9] transition-all active:scale-95",children:t},t))})]}),s===4&&e.jsxs("div",{className:"animate-in slide-in-from-right",children:[e.jsx("p",{className:"text-[#1c74e9] text-[10px] font-black uppercase tracking-widest mb-2",children:"Pregunta 4 de 6"}),e.jsx("h3",{className:"text-gray-900 font-black text-lg mb-4",children:"¿Cuál crees que es el motivo principal de sus notas?"}),e.jsx("div",{className:"grid grid-cols-1 gap-3",children:["Falta de base de años anteriores","Se distrae con el móvil / consola","Se bloquea en los exámenes","Falta de motivación total"].map(t=>e.jsx("button",{onClick:()=>{r({...a,root_cause:t}),o()},className:"w-full text-left bg-gray-50 border border-gray-200 p-4 rounded-xl text-gray-700 font-bold text-sm hover:bg-blue-50 hover:border-[#1c74e9] transition-all active:scale-95",children:t},t))})]}),s===5&&e.jsxs("div",{className:"animate-in slide-in-from-right",children:[e.jsx("p",{className:"text-[#1c74e9] text-[10px] font-black uppercase tracking-widest mb-2",children:"Pregunta 5 de 6"}),e.jsx("h3",{className:"text-gray-900 font-black text-lg mb-4",children:"¿Qué objetivo principal buscáis con las clases?"}),e.jsx("div",{className:"grid grid-cols-1 gap-3",children:["Aprobar exámenes inminentes","Recuperar base y entender la materia","Ayuda diaria con los deberes","Técnicas de estudio y organización"].map(t=>e.jsx("button",{onClick:()=>{r({...a,help_type:t}),o()},className:"w-full text-left bg-gray-50 border border-gray-200 p-4 rounded-xl text-gray-700 font-bold text-sm hover:bg-blue-50 hover:border-[#1c74e9] transition-all active:scale-95",children:t},t))})]}),s===6&&e.jsxs("div",{className:"animate-in slide-in-from-right",children:[e.jsx("p",{className:"text-[#1c74e9] text-[10px] font-black uppercase tracking-widest mb-2",children:"Pregunta 6 de 6"}),e.jsx("h3",{className:"text-gray-900 font-black text-lg mb-4",children:"¿Ha tenido profesores particulares antes?"}),e.jsx("div",{className:"grid grid-cols-1 gap-3",children:["SÃ, pero no funcionó como esperábamos","SÃ, en academia presencial (grupos grandes)","No, es la primera vez que buscamos apoyo"].map(t=>e.jsx("button",{onClick:()=>v(t),className:"w-full text-left bg-gray-50 border border-gray-200 p-4 rounded-xl text-gray-700 font-bold text-sm hover:bg-blue-50 hover:border-[#1c74e9] transition-all active:scale-95",children:t},t))})]}),s===7&&e.jsxs("div",{className:"text-center animate-in zoom-in py-10",children:[e.jsx("div",{className:"w-16 h-16 border-4 border-gray-100 border-t-[#1c74e9] rounded-full animate-spin mx-auto mb-6"}),e.jsx("h3",{className:"text-gray-900 font-black text-xl mb-2",children:"Evaluando perfil académico..."}),e.jsx("p",{className:"text-gray-500 text-sm animate-pulse",children:"Buscando el plan de refuerzo ideal en nuestra base de datos."})]}),s===8&&e.jsxs("div",{className:"animate-in slide-in-from-bottom duration-500",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("span",{className:"text-5xl block mb-3",children:"ð"}),e.jsx("h3",{className:"text-gray-900 font-black text-xl mb-1",children:"¡Diagnóstico Completado!"}),e.jsx("p",{className:"text-gray-500 text-xs",children:"Completa tus datos para enviarte el resultado y nuestra propuesta."})]}),e.jsxs("form",{onSubmit:j,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-black uppercase tracking-widest text-gray-400 ml-1",children:"Modalidad de Clases *"}),e.jsxs("div",{className:"relative group mt-1",children:[e.jsxs("select",{required:!0,value:a.modality,onChange:t=>r({...a,modality:t.target.value}),className:"w-full bg-blue-50 border-2 border-blue-100 p-4 rounded-xl text-sm font-black text-blue-900 outline-none focus:border-[#1c74e9] focus:bg-white transition-all appearance-none cursor-pointer shadow-sm group-hover:border-blue-200",children:[e.jsx("option",{value:"Clases Online",children:"ð» Clases Online (Recomendado)"}),e.jsx("option",{value:"Profe en casa (Domicilio)",children:"ð Clases a Domicilio"}),e.jsx("option",{value:"Academia Profe a 3",children:"ð¥ Profe a 3 (Grupos reducidos)"})]}),e.jsx("div",{className:"absolute inset-y-0 right-0 flex items-center pr-4 pointer-events-none",children:e.jsx("svg",{className:"h-5 w-5 text-blue-500 animate-pulse",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),e.jsx("p",{className:"text-[9px] text-blue-400 font-bold mt-1 ml-1 italic tracking-tight",children:"Pulsa arriba para cambiar la modalidad"})]}),e.jsxs("div",{className:"rounded-2xl border border-blue-100 bg-blue-50 px-4 py-3",children:[e.jsx("p",{className:"text-[10px] text-blue-700 font-black uppercase tracking-widest",children:"Paso final"}),e.jsx("p",{className:"text-[12px] text-blue-900 mt-1 leading-5",children:"Estos datos ya dejan el lead bien preparado para pasar despues a la ficha de familia sin tener que volver a pediros lo mismo."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-black uppercase tracking-widest text-gray-400 ml-1",children:"Nombre tutor *"}),e.jsx("input",{type:"text",required:!0,value:a.parent_first_name,onChange:t=>r({...a,parent_first_name:t.target.value}),className:"w-full mt-1 bg-white border border-gray-200 p-3.5 rounded-xl text-sm font-bold outline-none focus:border-[#1c74e9] transition-colors",placeholder:"Ej: MarÃa"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-black uppercase tracking-widest text-gray-400 ml-1",children:"Apellidos tutor *"}),e.jsx("input",{type:"text",required:!0,value:a.parent_last_name,onChange:t=>r({...a,parent_last_name:t.target.value}),className:"w-full mt-1 bg-white border border-gray-200 p-3.5 rounded-xl text-sm font-bold outline-none focus:border-[#1c74e9] transition-colors",placeholder:"Ej: GarcÃa López"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-black uppercase tracking-widest text-gray-400 ml-1",children:"Nombre alumno *"}),e.jsx("input",{type:"text",required:!0,value:a.student_first_name,onChange:t=>r({...a,student_first_name:t.target.value}),className:"w-full mt-1 bg-white border border-gray-200 p-3.5 rounded-xl text-sm font-bold outline-none focus:border-[#1c74e9] transition-colors",placeholder:"Ej: Javier"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-black uppercase tracking-widest text-gray-400 ml-1",children:"Apellidos alumno *"}),e.jsx("input",{type:"text",required:!0,value:a.student_last_name,onChange:t=>r({...a,student_last_name:t.target.value}),className:"w-full mt-1 bg-white border border-gray-200 p-3.5 rounded-xl text-sm font-bold outline-none focus:border-[#1c74e9] transition-colors",placeholder:"Ej: Pérez Ruiz"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-black uppercase tracking-widest text-gray-400 ml-1",children:"Email *"}),e.jsx("input",{type:"email",required:!0,value:a.email,onChange:t=>r({...a,email:t.target.value}),className:"w-full mt-1 bg-white border border-gray-200 p-3.5 rounded-xl text-sm font-bold outline-none focus:border-[#1c74e9] transition-colors",placeholder:"[email protected]"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-black uppercase tracking-widest text-gray-400 ml-1",children:"Localidad *"}),e.jsx("input",{type:"text",required:!0,value:a.locality,onChange:t=>r({...a,locality:t.target.value}),className:"w-full mt-1 bg-white border border-gray-200 p-3.5 rounded-xl text-sm font-bold outline-none focus:border-[#1c74e9] transition-colors",placeholder:"Ej: Madrid"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-black uppercase tracking-widest text-gray-400 ml-1",children:"Provincia *"}),e.jsx("input",{type:"text",required:!0,value:a.province,onChange:t=>r({...a,province:t.target.value}),className:"w-full mt-1 bg-white border border-gray-200 p-3.5 rounded-xl text-sm font-bold outline-none focus:border-[#1c74e9] transition-colors",placeholder:"Ej: Madrid"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-black uppercase tracking-widest text-gray-400 ml-1",children:"WhatsApp de contacto *"}
8),e.jsx("input",{type:"tel",required:!0,value:a.phone,onChange:t=>r({...a,phone:t.target.value}),className:"w-full mt-1 bg-green-50 border border-green-200 p-3.5 rounded-xl text-green-900 font-black text-sm outline-none focus:border-green-500 shadow-inner transition-colors",placeholder:"+34 600 000 000"})]}),e.jsx(T,{summary:$,accepted:m,onChange:f,consentText:"He leido la informacion de privacidad y acepto que Profe en Casa use estos datos para atender esta solicitud y ponerse en contacto conmigo.",footnote:"Puedes abrir la politica completa sin perder las respuestas ni los datos escritos.",compactHeightClass:"max-h-28"}),e.jsx("button",{type:"submit",disabled:p||!m,className:"w-full bg-[#1c74e9] hover:bg-blue-600 text-white font-black uppercase text-xs tracking-widest py-4 rounded-2xl shadow-lg shadow-blue-500/30 active:scale-95 transition-all mt-4 flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:p?"Enviando...":e.jsxs(e.Fragment,{children:["Recibir Propuesta ",e.jsx("span",{children:"ð"})]})})]})]}),s===9&&e.jsxs("div",{className:"text-center animate-in zoom-in py-8",children:[e.jsx("span",{className:"text-7xl block mb-6 animate-bounce",children:"â
"}),e.jsx("h3",{className:"text-gray-900 font-black text-2xl mb-2",children:"¡Todo listo!"}),e.jsx("p",{className:"text-gray-500 text-sm mb-6 leading-relaxed",children:l?"Prueba local completada. No se han guardado datos ni enviado correos.":"Hemos recibido la información. Coordinación revisará el caso y te contactará por WhatsApp o email para conocer mejor las necesidades y valorar las opciones disponibles."})]})]})]})})};export{Q as LeadMagnetWidget};
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.