PageSourceSearch

https://funcaes-etfi-70.created.app/_next/static/chunks/9253.de6bfc3381953504.js

js funcaes-etfi-70.created.app collected 2026-10-03 03:11:01 UTC 36,297 bytes, 5 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9253],{39253:(e,r,a)=>{a.d(r,{A:()=>_});var t=a(95155),s=a(12115),l=a(42869),o=a(11951),n=a(97810),i=a(1610),c=a(92451),d=a(48368),g=a(94514),m=a(60468),u=a(92289),x=a(85118),b=a(24538),h=a(57420),p=a(66614),y=a(89974),f=a(17243),N=a(55559),j=a(13545),w=a(76498),v=a(41641),k=a(21362),$=a(89270);function _({initialRequestType:e,onSubmit:r,onCancel:a}){let{theme:A}=(0,$.D)(),[R,F]=(0,s.useState)(e?2:1),[C,E]=(0,s.useState)(e||"professional"),[O,S]=(0,s.useState)([]),[T,M]=(0,s.useState)([]),[I,D]=(0,s.useState)({request_type:"professional",full_name:"",identification_number:"",email:"",phone:"",country_id:0,specialty:"",course_id:void 0,center_name:"",legal_name:"",address:"",city:"",director_name:"",website_url:"",coverage_area:"",birth_date:"",home_address:"",profession:"",training_center:"",graduation_date:"",certificate_id:void 0,current_certificate_number:"",expiry_date:"",recertification_type:"",membership_type:"",membership_duration:""}),[L,P]=(0,s.useState)(!1),[U,q]=(0,s.useState)(!1),[B,G]=(0,s.useState)(null),[V,X]=(0,s.useState)(!1),[J,W]=(0,s.useState)(null);(0,s.useEffect)(()=>{z()},[]),(0,s.useEffect)(()=>{D(e=>({...e,request_type:C,course_id:void 0,center_name:"",legal_name:"",address:"",city:"",director_name:"",website_url:"",coverage_area:""})),"certification"!==C&&"enrollment"!==C&&(M([]),G(null)),R>1&&F(2)},[C]),(0,s.useEffect)(()=>{3!==R||"certification"!==C&&"enrollment"!==C||0!==T.length||U||(console.log("\uD83D\uDFE2 AUTO-LOAD: Automatically loading courses for step 3"),H())},[R,C]);let z=async()=>{try{let e=await fetch("/api/countries");if(!e.ok)throw Error("Error loading countries");let r=await e.json();S(r)}catch(e){console.error("Error fetching countries:",e)}},H=async()=>{let e=new Date().toISOString();console.log(`🟢🟢🟢 FORM [${e}]: ===== STARTING FETCH COURSES =====`),console.log(`🟢 FORM [${e}]: Window location:`,window.location.href),q(!0),G(null);try{let r,a=`${Date.now()}-${Math.random()}`,t=`/api/courses/approved?nocache=${a}`;console.log(`🟢 FORM [${e}]: Calling URL: ${t}`);let s=new AbortController,l=setTimeout(()=>s.abort(),3e4),o=await fetch(t,{method:"GET",cache:"no-store",signal:s.signal,headers:{"Cache-Control":"no-store, no-cache, must-revalidate, max-age=0",Pragma:"no-cache",Expires:"0"}});if(clearTimeout(l),console.log(`🟢 FORM [${e}]: Response status:`,o.status),console.log(`🟢 FORM [${e}]: Response headers:`,Object.fromEntries(o.headers.entries())),!o.ok){let r=await o.text();throw console.error(`🔴 FORM [${e}]: Error response:`,r),Error(`Error HTTP ${o.status}: ${o.statusText}. Por favor verifique su conexi\xf3n a internet.`)}let n=await o.text();console.log(`🟢 FORM [${e}]: Raw response length:`,n.length),console.log(`🟢 FORM [${e}]: First 100 chars:`,n.substring(0,100));try{r=JSON.parse(n)}catch(r){throw console.error(`🔴 FORM [${e}]: JSON parse error:`,r),console.error(`🔴 FORM [${e}]: Raw text was:`,n.substring(0,500)),Error("Error al parsear respuesta del servidor. Datos recibidos: "+n.substring(0,100))}if(console.log(`🟢 FORM [${e}]: Parsed ${Array.isArray(r)?r.length:0} courses`),console.log(`🟢 FORM [${e}]: Data type:`,typeof r,Array.isArray(r)?"IS ARRAY":"NOT ARRAY"),!Array.isArray(r))throw console.error(`🔴 FORM [${e}]: Not an array, got:`,typeof r,r),Error("Formato de respuesta inv\xe1lido del servidor. Se esperaba una lista de cursos.");if(0===r.length){console.warn(`🟡 FORM [${e}]: No courses returned from server`),G("No hay cursos aprobados disponibles. Por favor contacte al administrador."),M([]);return}console.log(`🟢 FORM [${e}]: Setting ${r.length} courses in state`),console.log(`🟢 FORM [${e}]: Course titles:`,r.map(e=>e.title)),M(r),console.log(`🟢 FORM [${e}]: State updated successfully`)}catch(a){console.error(`🔴 FORM [${e}]: Error:`,a);let r="Error desconocido al cargar los cursos";a instanceof Error&&(r="AbortError"===a.name?"La solicitud tard\xf3 demasiado tiempo. Verifique su conexi\xf3n a internet y vuelva a intentar.":a.message),console.error(`🔴 FORM [${e}]: Final error message:`,r),G(r),M([]),window.confirm(`Error cargando cursos:
2
3${r}
4
5\xbfDesea ver los detalles t\xe9cnicos en la consola?`)&&console.log("Error completo:",a)}finally{console.log(`🟢 FORM [${e}]: Finished, setting loading=false`),q(!1)}},Y=async(e,r)=>{X(!0),W(null);try{let a=new FormData;a.append("image",e);let t=await fetch("/api/upload/application-image",{method:"POST",body:a});if(!t.ok){let e=await t.json();
5throw Error(e.error||"Error al cargar la imagen")}let s=await t.json();D(e=>({...e,[r]:s.imageUrl}))}catch(e){console.error("Error uploading image:",e),W(e instanceof Error?e.message:"Error al cargar la imagen"),alert("Error al cargar la imagen: "+(e instanceof Error?e.message:"Error desconocido"))}finally{X(!1)}},K=async()=>{if(console.log("\uD83D\uDFE2\uD83D\uDFE2\uD83D\uDFE2 FINAL SUBMIT: START"),console.log("\uD83D\uDFE2 FINAL SUBMIT: Request type:",C),console.log("\uD83D\uDFE2 FINAL SUBMIT: Current step:",R),console.log("\uD83D\uDFE2 FINAL SUBMIT: Form data:",JSON.stringify(I,null,2)),console.log("\uD83D\uDFE2 FINAL SUBMIT: isSubmitting:",L),console.log("\uD83D\uDFE2 FINAL SUBMIT: canProceed:",ea()),L)return void console.log("\uD83D\uDFE1 FINAL SUBMIT: Already submitting, blocking duplicate");P(!0);try{console.log("\uD83D\uDFE2 FINAL SUBMIT: Calling parent onSubmit handler..."),await r(I),console.log("\uD83D\uDFE2\uD83D\uDFE2\uD83D\uDFE2 FINAL SUBMIT: SUCCESS - Request sent successfully")}catch(e){console.error("\uD83D\uDD34\uD83D\uDD34\uD83D\uDD34 FINAL SUBMIT: ERROR:",e),console.error("\uD83D\uDD34 Error stack:",e instanceof Error?e.stack:"No stack"),alert("Error al enviar la solicitud. Por favor intente nuevamente.")}finally{console.log("\uD83D\uDFE2 FINAL SUBMIT: Resetting isSubmitting to false"),P(!1)}},Q=async()=>{let e=R+1;if(console.log("\uD83D\uDFE2 FRONTEND FORM: Moving to step",e),console.log("\uD83D\uDFE2 FRONTEND FORM: Current request type:",C),console.log("\uD83D\uDFE2 FRONTEND FORM: Should load courses?",3===e&&("certification"===C||"enrollment"===C)),F(e),3===e&&("certification"===C||"enrollment"===C)){console.log("\uD83D\uDFE2 FRONTEND FORM: Step 3 reached - loading courses NOW"),console.log("\uD83D\uDFE2 FRONTEND FORM: Current courses count:",T.length);try{await H(),console.log("\uD83D\uDFE2 FRONTEND FORM: Fetch completed")}catch(e){console.error("\uD83D\uDD34 FRONTEND FORM: Fetch failed:",e),alert("Error al cargar cursos: "+(e instanceof Error?e.message:String(e)))}}},Z=T.reduce((e,r)=>{let a=r.category_name||"Sin categor\xeda";return e[a]||(e[a]=[]),e[a].push(r),e},{}),ee="certification"===C||"enrollment"===C,er=e=>{switch(e){case"professional":return{icon:l.A,title:"Registro Profesional",description:"Reg\xedstrese como profesional certificado"};case"certification":return{icon:o.A,title:"Certificaci\xf3n",description:"Solicite certificaci\xf3n en un curso"};case"enrollment":return{icon:n.A,title:"Inscripci\xf3n",description:"Inscr\xedbase a un curso de capacitaci\xf3n"};case"recertification":return{icon:o.A,title:"Recertificaci\xf3n",description:"Renueve su certificaci\xf3n vigente"};case"membership":return{icon:l.A,title:"Membres\xeda",description:"Suscr\xedbase como miembro activo"};case"training_center":return{icon:i.A,title:"Centro de Entrenamiento",description:"Registre su centro de capacitaci\xf3n"};case"representative_agency":return{icon:c.A,title:"Agencia Representante",description:"Convi\xe9rtase en representante FUNCAES ETFI"};default:return{icon:d.A,title:"Solicitud",description:""}}},ea=()=>{if(console.log("\uD83D\uDFE2 VALIDATION: Checking step",R,"for type",C),1===R)return!0;if(2===R){let e=I.full_name&&I.identification_number&&I.email&&I.country_id>0;if("training_center"===C||"representative_agency"===C){let r=e&&I.center_name&&I.legal_name;return console.log("\uD83D\uDFE2 VALIDATION: Step 2 (center/agency):",r,{hasBasicInfo:e,center_name:I.center_name,legal_name:I.legal_name}),r}return console.log("\uD83D\uDFE2 VALIDATION: Step 2 (standard):",e,{full_name:I.full_name,email:I.email,country_id:I.country_id}),e}if(3===R){if(ee){let e=!!I.course_id;return console.log("\uD83D\uDFE2 VALIDATION: Step 3 (course required):",e,{course_id:I.course_id}),e}let e=I.full_name&&I.identification_number&&I.email&&I.country_id>0;return console.log("\uD83D\uDFE2 VALIDATION: Step 3 (no course):",e),e}return console.log("\uD83D\uDFE2 VALIDATION: Default true for step",R),!0},et=()=>"training_center"===C||"representative_agency"===C||"recertification"===C||"membership"===C||ee?3:2,es=er(C),el=es.icon;return(0,t.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center p-2 sm:p-4 z-50 overflow-y-auto",children:(0,t.jsxs)("div",{className:`${"dark"===A?"bg-gray-800":"bg-white"} rounded-xl sm:rounded-2xl shadow-2xl max-w-3xl w-full my-2 sm:my-4 lg:my-8 max-h-[95vh] sm:max-h-[90vh] flex flex-col`,children:[(0,t.jsxs)("div",{className:`p-4 sm:p-6 border-b ${"dark"===A?"border-gray-700":"border-gray-200"}`,children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 sm:gap-3 mb-2 sm:mb-3",children:[(0,t.jsx)(el,{className:`w-6 h-6 sm:w-8 sm:h-8 ${"dark"===A?"text-blue-400":"text-blue-600"} flex-shrink-0`}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("h2",{className:`text-lg sm:text-2xl font-bold ${"dark"===A?"text-white":"text-gray-900"} truncate`,children:es.title}),(0,t.jsx)("p",{className:`text-xs sm:text-sm ${"dark"===A?"text-gray-400":"text-gray-600"} line-clamp-1`,children:es.description})]})]}),(0,t.jsx)("div",{className:"flex items-center justify-between mt-3 sm:mt-4",children:[...Array(et())].map((e,r)=>{let a=r+1,s=a===R,l=a<R;return(0,t.jsxs)("div",{className:"flex items-center flex-1",children:[(0,t.jsx)("div",{className:`flex items-center justify-center w-7 h-7 sm:w-8 sm:h-8 rounded-full border-2 transition-all text-xs sm:text-base ${l?`${"dark"===A?"bg-blue-500 border-blue-500":"bg-blue-600 border-blue-600"} text-white`:s?`${"dark"===A?"border-blue-400 text-blue-400":"border-blue-600 text-blue-600"}`:`${"dark"===A?"border-gray-600 text-gray-600":"border-gray-300 text-gray-400"}`}`,children:l?(0,t.jsx)(g.A,{className:"w-3 h-3 sm:w-4 sm:h-4"}):a}),a<et()&&(0,t.jsx)("div",{className:`flex-1 h-0.5 mx-1 sm:mx-2 ${l?`${"dark"===A?"bg-blue-500":"bg-blue-600"}`:`${"dark"===A?"bg-gray-700":"bg-gray-300"}`}`})]},a)})})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 sm:p-6 space-y-4 sm:sp
5ace-y-6",children:[1===R&&(0,t.jsxs)("div",{className:"space-y-3 sm:space-y-4",children:[(0,t.jsx)("h3",{className:`text-base sm:text-lg font-semibold ${"dark"===A?"text-white":"text-gray-900"}`,children:"Seleccione el Tipo de Solicitud"}),(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4",children:["professional","certification","enrollment","recertification","membership","training_center","representative_agency"].map(e=>{let r=er(e),a=r.icon;return(0,t.jsxs)("button",{type:"button",onClick:()=>E(e),className:`p-3 sm:p-4 rounded-lg sm:rounded-xl border-2 transition-all text-left ${C===e?`${"dark"===A?"border-blue-500 bg-blue-500/20":"border-blue-600 bg-blue-50"}`:`${"dark"===A?"border-gray-600 hover:border-gray-500":"border-gray-200 hover:border-gray-300"}`}`,children:[(0,t.jsx)(a,{className:`w-6 h-6 sm:w-8 sm:h-8 mb-1.5 sm:mb-2 ${C===e?`${"dark"===A?"text-blue-400":"text-blue-600"}`:`${"dark"===A?"text-gray-400":"text-gray-500"}`}`}),(0,t.jsx)("h4",{className:`text-sm sm:text-base font-medium mb-0.5 sm:mb-1 ${"dark"===A?"text-white":"text-gray-900"}`,children:r.title}),(0,t.jsx)("p",{className:`text-[10px] sm:text-xs ${"dark"===A?"text-gray-400":"text-gray-500"} line-clamp-2`,children:r.description})]},e)})})]}),2===R&&(0,t.jsxs)("div",{className:"space-y-3 sm:space-y-4",children:[(0,t.jsxs)("h3",{className:`text-base sm:text-lg font-semibold ${"dark"===A?"text-white":"text-gray-900"}`,children:["Informaci\xf3n ","training_center"===C||"representative_agency"===C?"del Responsable":"Personal"]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:`block text-xs sm:text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-1.5 sm:mb-2`,children:[(0,t.jsx)(l.A,{className:"w-3 h-3 sm:w-4 sm:h-4 inline mr-1"}),"training_center"===C||"representative_agency"===C?"Nombre del Responsable *":"Nombre Completo *"]}),(0,t.jsx)("input",{type:"text",required:!0,value:I.full_name,onChange:e=>D({...I,full_name:e.target.value}),className:`w-full px-3 sm:px-4 py-2 sm:py-2.5 text-sm sm:text-base border ${"dark"===A?"bg-gray-700 border-gray-600 text-white placeholder-gray-400":"bg-white border-gray-300 text-gray-900 placeholder-gray-500"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`,placeholder:"Ingrese el nombre completo"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:`block text-xs sm:text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-1.5 sm:mb-2`,children:[(0,t.jsx)(m.A,{className:"w-3 h-3 sm:w-4 sm:h-4 inline mr-1"}),"N\xfamero de Identificaci\xf3n *"]}),(0,t.jsx)("input",{type:"text",required:!0,value:I.identification_number,onChange:e=>D({...I,identification_number:e.target.value}),className:`w-full px-3 sm:px-4 py-2 sm:py-2.5 text-sm sm:text-base border ${"dark"===A?"bg-gray-700 border-gray-600 text-white placeholder-gray-400":"bg-white border-gray-300 text-gray-900 placeholder-gray-500"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`,placeholder:"CI, Pasaporte, RUC, etc."})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:`block text-xs sm:text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-1.5 sm:mb-2`,children:[(0,t.jsx)(u.A,{className:"w-3 h-3 sm:w-4 sm:h-4 inline mr-1"}),"Correo Electr\xf3nico *"]}),(0,t.jsx)("input",{type:"email",required:!0,value:I.email,onChange:e=>D({...I,email:e.target.value}),className:`w-full px-3 sm:px-4 py-2 sm:py-2.5 text-sm sm:text-base border ${"dark"===A?"bg-gray-700 border-gray-600 text-white placeholder-gray-400":"bg-white border-gray-300 text-gray-900 placeholder-gray-500"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`,placeholder:"[email protected]"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:`block text-xs sm:text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-1.5 sm:mb-2`,children:[(0,t.jsx)(x.A,{className:"w-3 h-3 sm:w-4 sm:h-4 inline mr-1"}),"Tel\xe9fono"]}),(0,t.jsx)("input",{type:"tel",value:I.phone,onChange:e=>D({...I,phone:e.target.value}),className:`w-full px-3 sm:px-4 py-2 sm:py-2.5 text-sm sm:text-base border ${"dark"===A?"bg-gray-700 border-gray-600 text-white placeholder-gray-400":"bg-white border-gray-300 text-gray-900 placeholder-gray-500"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`,placeholder:"+57 300 123 4567"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:`block text-xs sm:text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-1.5 sm:mb-2`,children:[(0,t.jsx)(b.A,{className:"w-3 h-3 sm:w-4 sm:h-4 inline mr-1"}),"Pa\xeds *"]}
5),(0,t.jsxs)("select",{required:!0,value:I.country_id,onChange:e=>D({...I,country_id:Number(e.target.value)}),className:`w-full px-3 sm:px-4 py-2 sm:py-2.5 text-sm sm:text-base border ${"dark"===A?"bg-gray-700 border-gray-600 text-white":"bg-white border-gray-300 text-gray-900"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`,children:[(0,t.jsx)("option",{value:0,children:"Seleccione un pa\xeds"}),O.map(e=>(0,t.jsx)("option",{value:e.id,children:e.name},e.id))]})]}),"professional"===C&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:`block text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-2`,children:[(0,t.jsx)(h.A,{className:"w-4 h-4 inline mr-1"}),"Fecha de Nacimiento"]}),(0,t.jsx)("input",{type:"date",value:I.birth_date,onChange:e=>D({...I,birth_date:e.target.value}),className:`w-full px-4 py-2.5 border ${"dark"===A?"bg-gray-700 border-gray-600 text-white placeholder-gray-400":"bg-white border-gray-300 text-gray-900 placeholder-gray-500"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:`block text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-2`,children:[(0,t.jsx)(p.A,{className:"w-4 h-4 inline mr-1"}),"Direcci\xf3n de Habitaci\xf3n"]}),(0,t.jsx)("input",{type:"text",value:I.home_address,onChange:e=>D({...I,home_address:e.target.value}),className:`w-full px-4 py-2.5 border ${"dark"===A?"bg-gray-700 border-gray-600 text-white placeholder-gray-400":"bg-white border-gray-300 text-gray-900 placeholder-gray-500"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`,placeholder:"Calle, n\xfamero, ciudad"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:`block text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-2`,children:[(0,t.jsx)(y.A,{className:"w-4 h-4 inline mr-1"}),"Profesi\xf3n"]}),(0,t.jsx)("input",{type:"text",value:I.profession,onChange:e=>D({...I,profession:e.target.value}),className:`w-full px-4 py-2.5 border ${"dark"===A?"bg-gray-700 border-gray-600 text-white placeholder-gray-400":"bg-white border-gray-300 text-gray-900 placeholder-gray-500"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`,placeholder:"Ej: Ingeniero Civil"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:`block text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-2`,children:[(0,t.jsx)(i.A,{className:"w-4 h-4 inline mr-1"}),"Centro de Formaci\xf3n"]}),(0,t.jsx)("input",{type:"text",value:I.training_center,onChange:e=>D({...I,training_center:e.target.value}),className:`w-full px-4 py-2.5 border ${"dark"===A?"bg-gray-700 border-gray-600 text-white placeholder-gray-400":"bg-white border-gray-300 text-gray-900 placeholder-gray-500"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`,placeholder:"Universidad o instituto"})]}),(0,t.jsxs)("div",{className:"md:col-span-2",children:[(0,t.jsxs)("label",{className:`block text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-2`,children:[(0,t.jsx)(f.A,{className:"w-4 h-4 inline mr-1"}),"Foto de Perfil"]}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)("input",{type:"file",accept:"image/*",onChange:e=>{let r=e.target.files?.[0];r&&Y(r,"photo_url")},className:`flex-1 px-4 py-2.5 border ${"dark"===A?"bg-gray-700 border-gray-600 text-white":"bg-white border-gray-300 text-gray-900"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`,disabled:V}),V&&(0,t.jsx)("span",{className:`text-sm ${"dark"===A?"text-blue-400":"text-blue-600"}`,children:"Cargando..."}),I.photo_url&&!V&&(0,t.jsx)("img",{src:I.photo_url,alt:"Vista previa",className:"w-16 h-16 rounded-lg object-cover border-2 border-green-500"})]}),J&&(0,t.jsx)("p",{className:"text-sm text-red-600 mt-1",children:J}),(0,t.jsx)("p",{className:`text-xs ${"dark"===A?"text-gray-400":"text-gray-500"} mt-1`,children:"Formatos permitidos: JPEG, PNG, GIF, WebP. M\xe1ximo 5MB"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:`block text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-2`,children:[(0,t.jsx)(h.A,{className:"w-4 h-4 inline mr-1"}),"Fecha de Graduaci\xf3n"]}),(0,t.jsx)("input",{type:"date",value:I.graduation_date,onChange:e=>D({...I,graduation_date:e.target.value}),className:`w-full px-4 py-2.5 border ${"dark"===A?"bg-gray-700 border-gray-600 text-white placeholder-gray-400":"bg-white border-gray-300 text-gray-900 placeholder-gray-500"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:`block text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-2`,children:[(0,t.jsx)(N.A,{className:"w-4 h-4 inline mr-1"}),"Especialidad"]}
5),(0,t.jsx)("input",{type:"text",value:I.specialty,onChange:e=>D({...I,specialty:e.target.value}),className:`w-full px-4 py-2.5 border ${"dark"===A?"bg-gray-700 border-gray-600 text-white placeholder-gray-400":"bg-white border-gray-300 text-gray-900 placeholder-gray-500"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`,placeholder:"Ej: Ingenier\xeda El\xe9ctrica"})]})]}),("training_center"===C||"representative_agency"===C)&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:`block text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-2`,children:[(0,t.jsx)(i.A,{className:"w-4 h-4 inline mr-1"}),"training_center"===C?"Nombre del Centro *":"Nombre de la Agencia *"]}),(0,t.jsx)("input",{type:"text",required:!0,value:I.center_name||"",onChange:e=>D({...I,center_name:e.target.value}),className:`w-full px-4 py-2.5 border ${"dark"===A?"bg-gray-700 border-gray-600 text-white placeholder-gray-400":"bg-white border-gray-300 text-gray-900 placeholder-gray-500"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`,placeholder:"Nombre comercial"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:`block text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-2`,children:[(0,t.jsx)(d.A,{className:"w-4 h-4 inline mr-1"}),"Nombre Legal/Jur\xeddico *"]}),(0,t.jsx)("input",{type:"text",required:!0,value:I.legal_name||"",onChange:e=>D({...I,legal_name:e.target.value}),className:`w-full px-4 py-2.5 border ${"dark"===A?"bg-gray-700 border-gray-600 text-white placeholder-gray-400":"bg-white border-gray-300 text-gray-900 placeholder-gray-500"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`,placeholder:"Raz\xf3n social"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:`block text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-2`,children:[(0,t.jsx)(b.A,{className:"w-4 h-4 inline mr-1"}),"Ciudad"]}),(0,t.jsx)("input",{type:"text",value:I.city||"",onChange:e=>D({...I,city:e.target.value}),className:`w-full px-4 py-2.5 border ${"dark"===A?"bg-gray-700 border-gray-600 text-white placeholder-gray-400":"bg-white border-gray-300 text-gray-900 placeholder-gray-500"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`,placeholder:"Ciudad principal"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:`block text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-2`,children:[(0,t.jsx)(c.A,{className:"w-4 h-4 inline mr-1"}),"Sitio Web"]}),(0,t.jsx)("input",{type:"url",value:I.website_url||"",onChange:e=>D({...I,website_url:e.target.value}),className:`w-full px-4 py-2.5 border ${"dark"===A?"bg-gray-700 border-gray-600 text-white placeholder-gray-400":"bg-white border-gray-300 text-gray-900 placeholder-gray-500"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`,placeholder:"https://www.ejemplo.com"})]}),(0,t.jsxs)("div",{className:"md:col-span-2",children:[(0,t.jsxs)("label",{className:`block text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-2`,children:[(0,t.jsx)(b.A,{className:"w-4 h-4 inline mr-1"}),"Direcci\xf3n Completa"]}),(0,t.jsx)("input",{type:"text",value:I.address||"",onChange:e=>D({...I,address:e.target.value}),className:`w-full px-4 py-2.5 border ${"dark"===A?"bg-gray-700 border-gray-600 text-white placeholder-gray-400":"bg-white border-gray-300 text-gray-900 placeholder-gray-500"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`,placeholder:"Calle, n\xfamero, ciudad"})]}),(0,t.jsxs)("div",{className:"md:col-span-2",children:[(0,t.jsxs)("label",{className:`block text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-2`,children:[(0,t.jsx)(f.A,{className:"w-4 h-4 inline mr-1"}),"Logo de la ","training_center"===C?"Instituci\xf3n":"Agencia"]}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)("input",{type:"file",accept:"image/*",onChange:e=>{let r=e.target.files?.[0];r&&Y(r,"logo_url")},className:`flex-1 px-4 py-2.5 border ${"dark"===A?"bg-gray-700 border-gray-600 text-white":"bg-white border-gray-300 text-gray-900"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`,disabled:V}),V&&(0,t.jsx)("span",{className:`text-sm ${"dark"===A?"text-blue-400":"text-blue-600"}`,children:"Cargando..."}),I.logo_url&&!V&&(0,t.jsx)("img",{src:I.logo_url,alt:"Logo",className:"w-16 h-16 rounded-lg object-cover border-2 border-green-500"})]}),J&&(0,t.jsx)("p",{className:"text-sm text-red-600 mt-1",children:J}),(0,t.jsx)("p",{className:`text-xs ${"dark"===A?"text-gray-400":"text-gray-500"} mt-1`,children:"Formatos permitidos: JPEG, PNG, GIF, WebP. M\xe1ximo 5MB"})]})]})]})]}),3===R&&"recertification"===C&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("h3",{className:`text-lg font-semibold ${"dark"===A?"text-white":"text-gray-900"}`,children:"Datos de Recertificaci\xf3n"}),(0,t.jsxs)("div",{className:"grid md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:`block text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-2`,children:[(0,t.jsx)(o.A,{className:"w-4 h-4 inline mr-1"}),"N\xfamero de Certificado Actual"]}),(0,t.jsx)("input",{type:"text",value:I.current_certificate_number||"",onChange:e=>D({...I,current_certificate_number:e.target.value}),className:`w-full px-4 py-2.5 border ${"dark"===A?"bg-gray-700 border-gray-600 text-white placeholder-gray-400":"bg-white border-gray-300 text-gray-900 placeholder-gray-500"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`,placeholder:"CERT-XXXX-XXXX"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:`block text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-2`,children:[(0,t.jsx)(h.A,{className:"w-4 h-4 inline mr-1"}),"Fecha de Vencimiento"]}),(0,t.jsx)("input",{type:"date",value:I.expiry_date||"",onChange:e=>D({...I,expiry_date:e.target.value}),className:`w-full px-4 py-2.5 border ${"dark"===A?"bg-gray-700 border-gray-600 text-white":"bg-white border-gray-300 text-gray-900"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`})]}),(0,t.jsxs)("div",{className:"md:col-span-2",children:[(0,t.jsx)("label",{className:`block text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-2`,children:"Tipo de Recertificaci\xf3n"}),(0,t.jsxs)("select",{value:I.recertification_type||"",onChange:e=>D({...I,recertification_type:e.target.value}),className:`w-full px-4 py-2.5 border ${"dark"===A?"bg-gray-700 border-gray-600 text-white":"bg-white border-gray-300 text-gray-900"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`,children:[(0,t.jsx)("option",{value:"",children:"Seleccione tipo"}),(0,t.jsx)("option",{value:"renewal",children:"Renovaci\xf3n Regular"}),(0,t.jsx)("option",{value:"upgrade",children:"Actualizaci\xf3n de Nivel"}),(0,t.jsx)("option",{value:"revalidation",children:"Revalidaci\xf3n"})]})]})]})]}),3===R&&"membership"===C&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("h3",{className:`text-lg font-semibold ${"dark"===A?"text-white":"text-gray-900"}`,children:"Detalles de Membres\xeda"}),(0,t.jsxs)("div",{className:"grid md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"md:col-span-2",children:[(0,t.jsxs)("label",{className:`block text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-2`,children:[(0,t.jsx)(o.A,{className:"w-4 h-4 inline mr-1"}),"Tipo de Membres\xeda *"]}
5),(0,t.jsxs)("select",{required:!0,value:I.membership_type||"",onChange:e=>D({...I,membership_type:e.target.value}),className:`w-full px-4 py-2.5 border ${"dark"===A?"bg-gray-700 border-gray-600 text-white":"bg-white border-gray-300 text-gray-900"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`,children:[(0,t.jsx)("option",{value:"",children:"Seleccione tipo"}),(0,t.jsx)("option",{value:"individual",children:"Individual - $50/a\xf1o"}),(0,t.jsx)("option",{value:"corporate",children:"Corporativa - $200/a\xf1o"}),(0,t.jsx)("option",{value:"student",children:"Estudiante - $25/a\xf1o"}),(0,t.jsx)("option",{value:"institutional",children:"Institucional - $500/a\xf1o"})]})]}),(0,t.jsxs)("div",{className:"md:col-span-2",children:[(0,t.jsxs)("label",{className:`block text-sm font-medium ${"dark"===A?"text-gray-300":"text-gray-700"} mb-2`,children:[(0,t.jsx)(h.A,{className:"w-4 h-4 inline mr-1"}),"Duraci\xf3n *"]}),(0,t.jsxs)("select",{required:!0,value:I.membership_duration||"",onChange:e=>D({...I,membership_duration:e.target.value}),className:`w-full px-4 py-2.5 border ${"dark"===A?"bg-gray-700 border-gray-600 text-white":"bg-white border-gray-300 text-gray-900"} rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent`,children:[(0,t.jsx)("option",{value:"",children:"Seleccione duraci\xf3n"}),(0,t.jsx)("option",{value:"annual",children:"Anual"}),(0,t.jsx)("option",{value:"biennial",children:"Bienal (10% descuento)"})]})]})]})]}),3===R&&ee&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsx)("h3",{className:`text-lg font-semibold ${"dark"===A?"text-white":"text-gray-900"}`,children:"Seleccione el Curso"}),(0,t.jsx)("button",{onClick:()=>{console.log("\uD83D\uDFE2\uD83D\uDFE2\uD83D\uDFE2 RELOAD BUTTON CLICKED AT:",new Date().toISOString()),console.log("\uD83D\uDFE2 isLoadingCourses:",U),console.log("\uD83D\uDFE2 courses.length:",T.length),console.log("\uD83D\uDFE2 Calling fetchCourses()..."),H().then(()=>{console.log("\uD83D\uDFE2 fetchCourses() COMPLETED")}).catch(e=>{console.error("\uD83D\uDD34 fetchCourses() ERROR:",e),alert("Error cr\xedtico: "+String(e))})},type:"button",disabled:U,className:"text-sm px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:U?"Cargando...":"Recargar Cursos"})]}),U?(0,t.jsxs)("div",{className:`p-8 ${"dark"===A?"bg-blue-900/30 border border-blue-600":"bg-blue-50 border border-blue-200"} rounded-lg text-center`,children:[(0,t.jsx)(n.A,{className:`w-12 h-12 mx-auto mb-3 ${"dark"===A?"text-blue-400":"text-blue-600"} animate-pulse`}),(0,t.jsx)("p",{className:`${"dark"===A?"text-blue-400":"text-blue-700"} font-medium mb-2`,children:"Cargando cursos disponibles..."}),(0,t.jsx)("p",{className:`text-xs ${"dark"===A?"text-blue-300":"text-blue-600"}`,children:"Conectando con el servidor..."})]}):B?(0,t.jsxs)("div",{className:`p-8 ${"dark"===A?"bg-red-900/30 border border-red-600":"bg-red-50 border border-red-200"} rounded-lg text-center`,children:[(0,t.jsx)(j.A,{className:`w-12 h-12 mx-auto mb-3 ${"dark"===A?"text-red-400":"text-red-600"}`}),(0,t.jsx)("p",{className:`${"dark"===A?"text-red-400":"text-red-700"} font-medium mb-2`,children:"Error al cargar los cursos"}),(0,t.jsx)("p",{className:`text-sm ${"dark"===A?"text-red-300":"text-red-600"} mb-3`,children:B}),(0,t.jsx)("button",{onClick:H,type:"button",className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors",children:"Reintentar"})]}):0===T.length?(0,t.jsxs)("div",{className:`p-8 ${"dark"===A?"bg-yellow-900/30 border border-yellow-600":"bg-yellow-50 border border-yellow-200"} rounded-lg text-center`,children:[(0,t.jsx)(n.A,{className:`w-12 h-12 mx-auto mb-3 ${"dark"===A?"text-yellow-400":"text-yellow-600"}`}),(0,t.jsx)("p",{className:`${"dark"===A?"text-yellow-400":"text-yellow-700"} font-medium mb-2`,children:"No hay cursos disponibles"}),(0,t.jsx)("p",{className:`text-sm ${"dark"===A?"text-yellow-300":"text-yellow-600"}`,children:"Por favor contacte al administrador"})]}):(0,t.jsx)("div",{className:"space-y-3 max-h-96 overflow-y-auto pr-2",children:Object.entries(Z).map(([e,r])=>(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:`font-semibold ${"dark"===A?"text-white":"text-gray-900"} mb-2 px-1`,children:e}),(0,t.jsx)("div",{className:"space-y-2",children:r.map(e=>{let r=!e.offer_valid_until||new Date(e.offer_valid_until)>new Date,a=1===e.is_on_offer&&e.discounted_price_usd&&r;return(0,t.jsxs)("label",{className:`flex items-start gap-3 cursor-pointer p-3 rounded-lg border transition-all ${I.course_id===e.id?`${"dark"===A?"border-blue-500 bg-blue-900/20 shadow-lg":"border-blue-500 bg-blue-50 shadow-md"}`:`${"dark"===A?"border-gray-700 hover:border-gray-600 hover:bg-gray-700/50":"border-gray-200 hover:border-gray-300 hover:bg-gray-50"}`}`,children:[(0,t.jsx)("input",{type:"radio",name:"course_id",value:e.id,checked:I.course_id===e.id,onChange:e=>D({...I,course_id:Number(e.target.value)}),className:"mt-1 w-4 h-4 text-blue-600 focus:ring-blue-500 flex-shrink-0"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("p",{className:`font-medium ${"dark"===A?"text-white":"text-gray-900"} mb-1`,children:e.title}),e.base_price_usd&&(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(w.A,{className:`w-4 h-4 ${"dark"===A?"text-green-400":"text-green-600"}`}),a?(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("span",{className:"line-through text-gray-500 text-sm",children:["$",e.base_price_usd]}),(0,t.jsxs)("span",{className:`font-bold text-lg ${"dark"===A?"text-green-400":"text-green-600"}`,children:["$",e.discounted_price_usd]}),(0,t.jsx)("span",{className:`text-xs ${"dark"===A?"text-red-400":"text-red-500"} font-medium px-2 py-0.5 rounded ${"dark"===A?"bg-red-900/30":"bg-red-100"}`,children:"\xa1OFERTA!"})]}):(0,t.jsxs)("span",{className:`font-bold ${"dark"===A?"text-green-400":"text-green-600"}`,children:["$",e.base_price_usd]})]}),e.duration_hours&&(0,t.jsxs)("span",{className:`inline-block text-xs ${"dark"===A?"text-blue-400 bg-blue-900/30":"text-blue-600 bg-blue-100"} px-2 py-1 rounded mr-2`,children:[e.duration_hours," horas"]})]})]},e.id)})})]},e))})]})]}),(0,t.jsxs)("div",{className:`p-4 sm:p-6 border-t ${"dark"===A?"border-gray-700":"border-gray-200"} flex justify-between items-center gap-2`,children:[(0,t.jsxs)("button",{type:"button",onClick:()=>{1===R?a():F(R-1)},className:`flex items-center gap-1 sm:gap-2 px-3 sm:px-6 py-2 sm:py-2.5 text-sm sm:text-base ${"dark"===A?"text-gray-300 bg-gray-700 hover:bg-gray-600":"text-gray-700 bg-gray-100 hover:bg-gray-200"} rounded-lg font-medium transition-colors`,children:[(0,t.jsx)(v.A,{className:"w-3 h-3 sm:w-4 sm:h-4"}),1===R?"Cancelar":"Anterior"]}),R<et()?(0,t.jsxs)("button",{type:"button",onClick:()=>{console.log("\uD83D\uDFE2 FRONTEND FORM: Next button clicked"),console.log("\uD83D\uDFE2 FRONTEND FORM: canProceedToNextStep:",ea()),Q()},disabled:!ea(),className:`flex items-center gap-1 sm:gap-2 px-3 sm:px-6 py-2 sm:py-2.5 text-sm sm:text-base ${"dark"===A?"bg-blue-600 hover:bg-blue-700":"bg-gradient-to-r from-blue-900 to-blue-700 hover:shadow-lg"} text-white rounded-lg font-medium disabled:opacity-50 disabled:cursor-not-allowed transition-all`,children:["Siguiente",(0,t.jsx)(k.A,{className:"w-3 h-3 sm:w-4 sm:h-4"})]}):(0,t.jsx)("button",{type:"button",onClick:()=>{console.log("\uD83D\uDFE2 FRONTEND FORM: Submit button clicked!"),console.log("\uD83D\uDFE2 FRONTEND FORM: isSubmitting:",L),console.log("\uD83D\uDFE2 FRONTEND FORM: canProceedToNextStep:",ea()),console.log("\uD83D\uDFE2 FRONTEND FORM: Button disabled?",L||!ea()),K()},disabled:L||!ea(),className:`flex items-center gap-1 sm:gap-2 px-3 sm:px-6 py-2 sm:py-2.5 text-sm sm:text-base ${"dark"===A?"bg-green-600 hover:bg-green-700":"bg-gradient-to-r from-green-600 to-green-700 hover:shadow-lg"} text-white rounded-lg font-medium disabled:opacity-50 disabled:cursor-not-allowed transition-all whitespace-nowrap`,children:L?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"animate-spin rounded-full h-3 w-3 sm:h-4 sm:w-4 border-2 border-white border-t-transparent"}),(0,t.jsx)("span",{className:"hidden sm:inline",children:"Enviando..."}),(0,t.jsx)("span",{className:"sm:hidden",children:"Enviando"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(g.A,{className:"w-3 h-3 sm:w-4 sm:h-4"}),(0,t.jsx)("span",{className:"hidden sm:inline",children:"Enviar Solicitud"}),(0,t.jsx)("span",{className:"sm:hidden",children:"Enviar"})]})})]})]})})}}}]);

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.