/* ═══════════════════════════════════════════════════════════════════ INTEL BAR · top-strip market intelligence — live API wired Fear & Greed · BTC.D · Regime · Equity · Funding · UTC clock ═══════════════════════════════════════════════════════════════════ */ function IntelBar({ intel }) { /* UTC clock — only this re-renders every second */ const [utcStr, setUtcStr] = React.useState(() => { const n = new Date(); return String(n.getUTCHours()).padStart(2,'0') + ':' + String(n.getUTCMinutes()).padStart(2,'0') + ':' + String(n.getUTCSeconds()).padStart(2,'0'); }); React.useEffect(() => { const id = setInterval(() => { const n = new Date(); setUtcStr(String(n.getUTCHours()).padStart(2,'0') + ':' + String(n.getUTCMinutes()).padStart(2,'0') + ':' + String(n.getUTCSeconds()).padStart(2,'0')); }, 1000); return () => clearInterval(id); }, []); /* ── All intel values computed safely at top level — NO IIFEs ── */ const fg = Number(intel && intel.fear_greed != null ? intel.fear_greed : 25) || 25; const btcd = Number(intel && intel.btc_dominance != null ? intel.btc_dominance : 58.2) || 58.2; const mr = Number(intel && intel.macro_risk != null ? intel.macro_risk : 42) || 42; const fr = Number(intel && intel.funding_rate != null ? intel.funding_rate : 0.0042) || 0.0042; const eq = (intel && intel.equity_outlook) ? String(intel.equity_outlook) : 'BULLISH'; const regime = (intel && intel.regime) ? String(intel.regime) : 'BEARISH'; const flipNote = (intel && intel.regime_flip_note) ? intel.regime_flip_note : 'awaiting flip conditions'; /* Fear & Greed */ const fgColor = fg <= 25 ? ST.red : fg <= 45 ? ST.amber : fg <= 55 ? ST.ink3 : ST.green; const fgLabel = fg <= 25 ? 'EXTREME FEAR' : fg <= 45 ? 'FEAR' : fg <= 55 ? 'NEUTRAL' : fg <= 75 ? 'GREED' : 'EXTREME GREED'; /* BTC Dominance */ const btcdStr = isNaN(btcd) ? '58.2' : btcd.toFixed(1); /* Regime */ const regColor = regime === 'BULLISH' ? ST.green : regime === 'NEUTRAL' ? ST.ink3 : ST.amber; /* Equity */ const eqColor = eq === 'BULLISH' ? ST.green : eq === 'BEARISH' ? ST.red : ST.ink3; /* Funding */ const frSafe = isNaN(fr) ? 0.0042 : fr; const frPct = (frSafe * 100).toFixed(4); const frAPR = (frSafe * 100 * 3 * 365).toFixed(1); const frColor = Math.abs(frSafe) < 0.002 ? ST.ink3 : frSafe > 0 ? ST.green : ST.red; const frLabel = Math.abs(frSafe) < 0.002 ? 'NEUTRAL' : frSafe > 0 ? 'POSITIVE' : 'NEGATIVE'; /* Macro Risk */ const mrSafe = isNaN(mr) ? 42 : mr; const mrColor = mrSafe >= 60 ? ST.red : mrSafe >= 40 ? ST.amber : ST.green; const mrLabel = mrSafe >= 60 ? 'HIGH' : mrSafe >= 40 ? 'ELEVATED' : 'LOW'; return (
{/* Fear & Greed */}
{Math.round(fg)}
{fgLabel}
{/* BTC Dominance */}
{btcdStr}%
alts 56 ? ST.red : ST.green }}>{btcd > 56 ? 'weakening' : 'rotating'}
{/* Crypto Regime */}
{regime}
{flipNote}
{/* Equity Outlook */}
{eq}
stocks/crypto correlation
{/* Funding */}
{frLabel} {frSafe >= 0 ? '+' : ''}{frPct}%
APR {frAPR}%
{/* Macro Risk */}
{Math.round(mrSafe)} {mrLabel}
live macro index
{/* UTC clock */}
UTC · LIVE
{utcStr}
); } function IntelCell({ label, children, wide }) { return (
{label} {children}
); } function FearMeter({ value }) { const safeVal = Number(value) || 0; return (
); } function RegimePill({ c, children }) { return ( {children} ); } window.IntelBar = IntelBar;