/* ─── RADAR: Live Intelligence Feed ─────────────── */ (function() { 'use strict'; const API = '/api/radar'; const REFRESH_INTERVAL = 15 * 60 * 1000; // 15 minutes let currentSource = 'all'; let allItems = []; let refreshTimer = null; // ─── Time Ago ────────────────────────────────── function timeAgo(dateStr) { if (!dateStr) return ''; const now = new Date(); const then = new Date(dateStr); const diff = Math.floor((now - then) / 1000); if (diff < 60) return diff + 's ago'; if (diff < 3600) return Math.floor(diff / 60) + 'm ago'; if (diff < 86400) return Math.floor(diff / 3600) + 'h ago'; if (diff < 604800) return Math.floor(diff / 86400) + 'd ago'; return Math.floor(diff / 604800) + 'w ago'; } // ─── Extract Domain ──────────────────────────── function extractDomain(url) { try { const u = new URL(url); return u.hostname.replace('www.', ''); } catch(e) { return ''; } } // ─── Escape HTML ─────────────────────────────── function esc(s) { const d = document.createElement('div'); d.textContent = s; return d.innerHTML; } // ─── Render Feed ─────────────────────────────── function renderFeed(items) { const feed = document.getElementById('radarFeed'); if (!items || items.length === 0) { feed.innerHTML = '