1import{r as A,D as w,C as y,q as o,a1 as p,a2 as P,a5 as m,a3 as N,a4 as f,a7 as q}from"./entry.IIfaLaf7.js";const u=[{id:"pionero-360",name:"Pionero 360",icon:"ti-flag-alt",description:"De los primeros en unirse a la comunidad",requirement:"Registrarse entre los primeros miembros"},{id:"nuevo-miembro",name:"Nuevo Fan",icon:"ti-star",description:"Bienvenido a la comunidad",requirement:"Crear una cuenta"},{id:"activo",name:"Activo",icon:"ti-bolt",description:"Usuario activo en la plataforma",requirement:"Acumular 50 puntos",pointsRequired:50},{id:"compartidor",name:"Compartidor",icon:"ti-share",description:"Interactúas constantemente",requirement:"Acumular 100 puntos",pointsRequired:100},{id:"top-10",name:"Top 10",icon:"ti-crown",description:"Eres de los más activos",requirement:"Acumular 200 puntos",pointsRequired:200},{id:"super-fan",name:"Super Fan",icon:"ti-heart",description:"Fan dedicado",requirement:"Acumular 500 puntos",pointsRequired:500}],C={LISTEN_PODCAST:20,WATCH_INTERVIEW:15,SHARE_CONTENT:10,VISIT_SOCIAL:5,DAILY_LOGIN:3,COMPLETE_PROFILE:25},U={youtube:{name:"YouTube",icon:"fab fa-youtube"},spotify:{name:"Spotify",icon:"fab fa-spotify"},apple:{name:"Apple Podcasts",icon:"fab fa-apple"},instagram:{name:"Instagram",icon:"fab fa-instagram"},twitter:{name:"X/Twitter",icon:"fab fa-twitter"},tiktok:{name:"TikTok",icon:"fab fa-tiktok"}},t=A(null),g=A(!1),l=A(null),B=()=>{const{db:s}=w(),{userId:n,isAuthenticated:k}=y(),c=o(()=>t.value?Math.floor(t.value.points/100)+1:1),T=o(()=>t.value?((c.value-1)*100,c.value*100-t.value.points):100),I=o(()=>{if(!t.value)return 0;const e=(c.value-1)*100,r=t.value.points-e;return Math.min(r/100*100,100)}),S=o(()=>t.value?u.filter(e=>t.value.badges.includes(e.id)):[]),h=o(()=>t.value?u.filter(e=>!t.value.badges.includes(e.id)):u),L=o(()=>{var r,a;if(!((r=t.value)!=null&&r.displayName)){const{user:i}=y(),E=(a=i.value)==null?void 0:a.displayName;if(E){const d=E.split(" ");return d.length>=2?(d[0][0]+d[1][0]).toUpperCase():d[0].substring(0,2).toUpperCase()}return"JC"}const e=t.value.displayName.split(" ");return e.length>=2?e[0][0]+e[1][0]:e[0].substring(0,2).toUpperCase()}),v=async e=>{const r=e||n.value;if(!s||!r)return l.value="No se puede cargar el perfil",null;g.value=!0,l.value=null;try{const a=p(s,"users",r),i=await P(a);return i.exists()?(t.value=i.data(),t.value):(l.value="Perfil no encontrado",null)}catch(a){return console.error("Error cargando perfil:",a),l.value="Error al cargar el perfil",null}finally{g.value=!1}},R=async(e,r)=>{if(!s||!n.value)return{success:!1,error:"Usuario no autenticado"};try{const a=p(s,"users",n.value);return(await P(a)).exists()?await m(a,{points:N(e),lastActivity:f()}):await q(a,{uid:n.value,points:e,level:1,badges:["nuevo-miembro"],createdAt:f(),lastActivity:f()}),await v(),await b(),{success:!0,pointsAdded:e,reason:r}}catch(a){return console.error("Error añadiendo puntos:",a.code),{success:!1,error:"Error al añadir puntos"}}},b=async()=>{if(!s||!n.value||!t.value)return;const e=t.value.badges||[],r=[];for(const a of u)a.pointsRequired&&t.value.points>=a.pointsRequired&&!e.includes(a.id)&&r.push(a.id);if(r.length>0){const a=p(s,"users",n.value);
1await m(a,{badges:[...e,...r]}),t.value.badges=[...e,...r]}return r};return{profile:t,loadingProfile:g,profileError:l,userLevel:c,pointsToNextLevel:T,levelProgress:I,userBadges:S,lockedBadges:h,userInitials:L,AVAILABLE_BADGES:u,POINTS_SYSTEM:C,SOCIAL_NETWORKS:U,loadProfile:v,addPoints:R,checkAndUnlockBadges:b,updateUserProfile:async e=>{if(!s||!n.value)return{success:!1,error:"Usuario no autenticado"};try{const r=p(s,"users",n.value);return await m(r,{...e,lastActivity:f()}),await v(),{success:!0}}catch(r){return console.error("Error actualizando perfil:",r),{success:!1,error:"Error al actualizar perfil"}}}}};export{u as A,C as P,B as u};
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.