/* AUTH · Orgullo Millonario — login / register / forgot · Liquid Glass
Route guards + sesión demo en OM-Auth (localStorage). */
const {useState,useRef,useEffect}=React;
const PAGE=document.body.dataset.page||'login';
const I={
user:<>>,
mail:<>>,
lock:<>>,
eye:<>>,
eyeoff:<>>,
arrow:,
back:,
};
const Ic=({n,s=18,c=""})=>;
function Field({icon,type='text',value,onChange,placeholder,reveal,onReveal,onEnter}){
return ;
}
function Shell({children,title,sub}){
return
;
}
const btnPrimary={background:'linear-gradient(160deg,#ff2e3e,#8d0917)',boxShadow:'0 12px 30px -8px rgba(224,30,47,.6)'};
function SocialRow(){
const toast=t=>{const el=document.getElementById('mini-toast');el.textContent=t;el.style.opacity=1;clearTimeout(window.__mt);window.__mt=setTimeout(()=>el.style.opacity=0,2200);};
return <>
O CONTINUÁ CON
{[['Google','G'],['Apple','']].map(([n,g])=>(
))}
>;
}
function Login(){
const [email,setEmail]=useState('');const [pass,setPass]=useState('');const [show,setShow]=useState(false);
const [err,setErr]=useState('');const [loading,setLoading]=useState(false);
const submit=()=>{setErr('');setLoading(true);
setTimeout(()=>{const r=OMAuth.login(email,pass);if(r.ok){location.href='dashboard.html';}else{setErr(r.error);setLoading(false);}},350);};
return
setShow(!show)} onEnter={submit}/>
{err&&{err}
}
¿No tenés cuenta? Registrate
;
}
function Register(){
const [nombre,setNombre]=useState('');const [email,setEmail]=useState('');const [pass,setPass]=useState('');const [show,setShow]=useState(false);
const [err,setErr]=useState('');const [loading,setLoading]=useState(false);
const submit=()=>{setErr('');setLoading(true);
const ref=new URLSearchParams(location.search).get('ref')||'';
setTimeout(()=>{const r=OMAuth.register({nombre,email,pass,ref});if(r.ok){location.href='dashboard.html';}else{setErr(r.error);setLoading(false);}},350);};
const refCode=new URLSearchParams(location.search).get('ref');
return
{refCode&&🎁Invitación de {refCode} — registrate y recibís 1.000 créditos de bienvenida.
}
setShow(!show)} onEnter={submit}/>
{err&&{err}
}
¿Ya sos parte? Iniciá sesión
;
}
function Forgot(){
const [email,setEmail]=useState('');const [sent,setSent]=useState(false);
const submit=()=>{if(/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(email))setSent(true);};
return
{sent
?
:}
;
}
const PAGES={login:Login,register:Register,forgot:Forgot};
const Comp=PAGES[PAGE]||Login;
ReactDOM.createRoot(document.getElementById('root')).render(<>>);