{"version":3,"file":"AuthButton.DLAfT5FA.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/0OWx8rFs840l9qgHVKm5/MbmyWxI1MYXa2Vf5EzOL/AuthButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";export default function AuthButton(props){// 1. Extraemos las variables dinámicas del panel de Framer\nconst{buttonText,deviceVariant,fontSizeDesktop,fontSizeTablet,fontSizeMobile,letterSpacing,textColor,borderColor}=props;// ============================================================================\n// CORAZÓN DEL CÓDIGO (BACKEND Y ESTADOS) - INTACTO\n// ============================================================================\nconst[user,setUser]=useState(null);const[loading,setLoading]=useState(true);const domain_backend=`https://api.aura-fans.com`;useEffect(()=>{const fetchProfile=async()=>{const token=localStorage.getItem(\"token\");if(!token){setLoading(false);return;}try{const res=await fetch(`${domain_backend}/auth/profile`,{headers:{Authorization:`Bearer ${token}`}});if(res.ok){const data=await res.json();setUser(data);}}catch(e){console.error(e);}finally{setLoading(false);}};fetchProfile();},[]);if(loading)return null;// ============================================================================\n// 2. Lógica para adaptar el tamaño de la fuente según la variante elegida en Framer\nlet currentFontSize=fontSizeDesktop;if(deviceVariant===\"Tablet\")currentFontSize=fontSizeTablet;if(deviceVariant===\"Mobile\")currentFontSize=fontSizeMobile;// 3. Estilos dinámicos inyectados al botón\nconst dynamicRegisterStyle={...registerButtonStyle,fontSize:`${currentFontSize}px`,letterSpacing:`${letterSpacing}px`,color:textColor,border:`1px solid ${borderColor}`};return /*#__PURE__*/_jsx(\"div\",{style:containerStyle,children:user?/*#__PURE__*/_jsxs(\"div\",{style:userWrapperStyle,children:[/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"center\",gap:\"6px\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{color:\"white\",fontSize:\"14px\"},children:\"Hola\"}),/*#__PURE__*/_jsx(\"span\",{style:textStyle,children:user.first_name})]}),/*#__PURE__*/_jsx(\"div\",{style:avatarContainerStyle,children:user.avatar?/*#__PURE__*/_jsx(\"img\",{src:user.avatar,style:avatarImageStyle,alt:\"Avatar\",onError:e=>{e.currentTarget.style.display=\"none\";}}):/*#__PURE__*/_jsx(\"span\",{style:initialsStyle,children:user.first_name?.charAt(0).toUpperCase()})}),/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",alignItems:\"center\",gap:\"8px\"},children:/*#__PURE__*/_jsx(motion.button,{whileHover:{scale:1.1,backgroundColor:\"#f0f0f0\"},whileTap:{scale:.9},onClick:()=>{localStorage.removeItem(\"token\");window.location.href=\"/\";},style:logoutButtonStyle,title:\"Cerrar sesi\\xf3n\",children:/*#__PURE__*/_jsxs(\"svg\",{xmlns:\"http://www.w3.org/2000/svg\",width:\"14\",height:\"14\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"currentColor\",strokeWidth:\"2.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:[/*#__PURE__*/_jsx(\"path\",{d:\"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4\"}),/*#__PURE__*/_jsx(\"polyline\",{points:\"16 17 21 12 16 7\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"21\",y1:\"12\",x2:\"9\",y2:\"12\"})]})})})]}):/*#__PURE__*/_jsx(motion.a,{href:\"/login\",style:dynamicRegisterStyle,whileHover:{scale:1.05,backgroundColor:\"white\",boxShadow:\"0px 5px 15px rgba(0,0,0,0.1)\",color:\"black\"},whileTap:{scale:.95},transition:{type:\"spring\",stiffness:400,damping:17},children:buttonText})});}// ============================================================================\n// CONTROLES DE PROPIEDADES PARA EL PANEL DE FRAMER\n// ============================================================================\naddPropertyControls(AuthButton,{buttonText:{type:ControlType.String,title:\"Texto\",defaultValue:\"Ingresar\"},deviceVariant:{type:ControlType.Enum,title:\"Variante (Disp.)\",options:[\"Desktop\",\"Tablet\",\"Mobile\"],defaultValue:\"Desktop\"},fontSizeDesktop:{type:ControlType.Number,title:\"Tama\\xf1o Desktop\",defaultValue:20,min:8,max:100},fontSizeTablet:{type:ControlType.Number,title:\"Tama\\xf1o Tablet\",defaultValue:18,min:8,max:100},fontSizeMobile:{type:ControlType.Number,title:\"Tama\\xf1o Mobile\",defaultValue:16,min:8,max:100},letterSpacing:{type:ControlType.Number,title:\"Interletrado\",defaultValue:0,step:.5,displayStepper:true},textColor:{type:ControlType.Color,title:\"Color Texto\",defaultValue:\"#FFFFFF\"},borderColor:{type:ControlType.Color,title:\"Color Borde\",defaultValue:\"#FFFFFF\"}});// ============================================================================\n// ESTILOS ESTÁTICOS BASE\n// ============================================================================\nconst containerStyle={display:\"flex\",alignItems:\"center\",justifyContent:\"center\"};const userWrapperStyle={display:\"flex\",alignItems:\"center\",gap:\"12px\",color:\"white\",fontSize:\"12px\"};// NOTA: Se eliminaron fontSize, color y border de aquí, porque ahora se inyectan dinámicamente arriba.\nconst registerButtonStyle={cursor:\"pointer\",padding:\"8px 20px 8px 20px\",textDecoration:\"none\",backgroundColor:\"transparent\",borderRadius:\"999px\",fontWeight:400,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",textTransform:\"uppercase\"};const textStyle={fontSize:\"14px\",fontWeight:500,color:\"white\",textTransform:\"uppercase\"};const avatarContainerStyle={width:\"32px\",height:\"32px\",borderRadius:\"100%\",backgroundColor:\"#007AFF\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",overflow:\"hidden\",flexShrink:0};const avatarImageStyle={width:\"100%\",height:\"100%\",objectFit:\"cover\"};const initialsStyle={color:\"white\",fontSize:\"20px\",fontWeight:600,textTransform:\"uppercase\"};const logoutButtonStyle={cursor:\"pointer\",padding:\"6px 12px\",fontSize:\"20px\",background:\"#f5f5f5\",border:\"none\",borderRadius:\"8px\",color:\"#666\",fontWeight:500};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AuthButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\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