module.exports=[31570,a=>{"use strict";var b=a.i(37936),c=a.i(18558),d=a.i(45618),e=a.i(13095);let f=(0,d.createClient)("https://ixrgjfluwrwkzpxoaocw.supabase.co",process.env.SUPABASE_SERVICE_ROLE_KEY,{auth:{autoRefreshToken:!1,persistSession:!1}});async function g(a){try{let{data:b,error:d}=await f.from("profiles").select("id").eq("correo",a.email).single();if(d||!b)return{success:!1,error:"No se encontró un perfil registrado con este correo. Debes tener acceso a la plataforma."};let e=`PQR-${Math.floor(1e3+9e3*Math.random())}`,{error:g}=await f.from("pqrs").insert([{ticket_number:e,estudiante_id:b.id,categoria:a.categoria,mensaje:a.mensaje,estado:"Abierto"}]);if(g)throw Error("Error guardando PQR: "+g.message);return console.log(`[NOTIFICACI\xd3N] Nueva PQR ${e} de ${a.email} - Categor\xeda: ${a.categoria}`),(0,c.revalidatePath)("/estudiante/pqrs"),(0,c.revalidatePath)("/gestion-corpadein/pqrs"),{success:!0,ticketNumber:e}}catch(a){return console.error("Error creating PQR:",a),{success:!1,error:a.message}}}async function h(a,b){try{let{error:d}=await f.from("pqrs").update({estado:b,updated_at:new Date().toISOString()}).eq("id",a);if(d)throw Error(d.message);return(0,c.revalidatePath)("/estudiante/pqrs"),(0,c.revalidatePath)("/gestion-corpadein/pqrs"),{success:!0}}catch(a){return console.error("Error updating PQR:",a),{success:!1,error:a.message}}}async function i(a,b){let{error:d}=await f.from("pqrs").update({assigned_to:b}).eq("id",a);return d?{success:!1,error:d.message}:((0,c.revalidatePath)("/gestion-corpadein/pqrs"),{success:!0})}async function j(a){let{data:b}=await f.from("pqr_comments").select("*, profiles(nombre, role)").eq("pqr_id",a).order("created_at",{ascending:!0});return b||[]}async function k(a,b,d){let{error:e}=await f.from("pqr_comments").insert({pqr_id:a,author_id:b,content:d});return e?{success:!1,error:e.message}:(await f.from("pqrs").update({updated_at:new Date().toISOString()}).eq("id",a),(0,c.revalidatePath)("/gestion-corpadein/pqrs"),{success:!0})}async function l(a,b,c){return b?k(a,b,c):{success:!1,error:"No author ID provided"}}(0,e.ensureServerEntryExports)([g,h,i,j,k,l]),(0,b.registerServerReference)(g,"40aac1caa2bd0e53e4fd3a40c6ba71fd2d364cc4a7",null),(0,b.registerServerReference)(h,"6060b71de04a423c5e606db27740e0b5ade8f4b52c",null),(0,b.registerServerReference)(i,"6001a04f2618470043e5c0528dd8164dbe1b17d747",null),(0,b.registerServerReference)(j,"40871d4cbf591e319e53ef5bc1c4c9227e2de6a45c",null),(0,b.registerServerReference)(k,"70fd32e351f1c86cdbf173df453071104cc2ff409d",null),(0,b.registerServerReference)(l,"7007f92f2636f677e39ae97a0fb27864e2a2e1f471",null),a.s(["addPqrCommentAction",()=>l,"assignPqrTo",()=>i,"createPqr",()=>g,"getPqrComments",()=>j,"updatePqrStatus",()=>h])},15478,a=>{"use strict";var b=a.i(54143),c=a.i(31570);a.s([],3719),a.i(3719),a.s(["408752d41840a9129533a279989e29f571a78e21c2",()=>b.getSiteSettings,"40aac1caa2bd0e53e4fd3a40c6ba71fd2d364cc4a7",()=>c.createPqr],15478)}];

//# sourceMappingURL=_24217e20._.js.map