// Holding-tank readiness on the tank cards (Marty 2026-11-18, stage 1 of the tank warm-up). The server attaches `rd` to each waiting // lead from the network hub: { entry: {reason, site, at, detail}, stage, heat: {score, band, label, trend}, last: {kind, site, at} }. // A lead without `rd` (the hub is down) renders exactly as before. Shared by InstantAdPay and LinkSpin (same file in both). (function () { const esc = s => String(s == null ? '' : s).replace(/[&<>"]/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c])); const SITES = { iap: 'InstantAdPay', instantadpay: 'InstantAdPay', linkspin: 'LinkSpin', bannerline: 'Downline Banners', dlb: 'Downline Banners', vbb: 'ViralBannerBlitz', vab: 'ViralAdBlitz', viraladblitz: 'ViralAdBlitz', fivex: '5xYourTeam', dh: 'DownlineHydra', downlinehydra: 'DownlineHydra', hydra: 'DownlineHydra', ypb: 'YourProgramBuilder', yourprogrambuilder: 'YourProgramBuilder', vas: 'ViralAdSource', viraladsource: 'ViralAdSource', ctb: 'CryptoTeamBuild', stackpol: 'Stack POL', earnerscorner: 'Earners Corner', polhunter: 'PolHunter', btc4hits: 'BTC4Hits' }; const site = s => (s ? SITES[String(s).toLowerCase()] || String(s) : ''); const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; const day = t => { if (!t) return ''; const d = new Date(t); return MON[d.getMonth()] + ' ' + d.getDate() + (d.getFullYear() !== new Date().getFullYear() ? ', ' + d.getFullYear() : ''); }; const month = t => { if (!t) return ''; const d = new Date(t); return MON[d.getMonth()] + ' ' + d.getFullYear(); }; const ago = t => { if (!t) return ''; const ms = Date.now() - t; if (ms < 3600e3) return Math.max(1, Math.round(ms / 60e3)) + ' min ago'; if (ms < 86400e3) return Math.round(ms / 3600e3) + 'h ago'; const d = Math.floor(ms / 86400e3); return d === 1 ? 'yesterday' : d + ' days ago'; }; const who = d => (d && d.from ? ' @' + d.from : ''); function entryText(e) { if (!e || !e.reason || e.reason === 'unknown') return 'How they got here: unknown'; const d = e.detail || {}; switch (e.reason) { case 'joined': { const src = [d.via ? 'via ' + d.via : '', d.ref && d.ref !== 'direct' ? 'from ' + d.ref : d.ref === 'direct' ? 'typed in directly' : ''].filter(Boolean).join(', '); return 'Joined ' + (site(e.site) || 'the network') + ' ' + day(e.at) + ' with no sponsor' + (src ? ' (' + src + ')' : ''); } case 'imported': return 'Imported old member of ' + (site(d.oldSite) || 'an older network site') + (d.memberSince ? ', member since ' + month(d.memberSince) : '') + (d.lastSeenOld ? ', last seen there ' + month(d.lastSeenOld) : '') + (e.at ? ' (in the tank since ' + day(e.at) + ')' : ''); case 'rescued': return 'Moved here ' + day(e.at) + ': their sponsor' + who(d) + ' did not reach them in 14 days'; case 'released': return d.note ? 'Released ' + day(e.at) + ' by' + (who(d) || ' the member') + ' who had adopted them' : 'Released by their sponsor' + who(d) + ' ' + day(e.at); case 'sponsor_gone': return 'Their sponsor left or was blocked (in the tank since ' + day(e.at) + ')'; case 'returned': return 'Back in the tank ' + day(e.at) + ': an adoption' + (d.from ? ' by @' + d.from : '') + ' ended before they got started'; default: return 'How they got here: unknown'; } } const STAGE = { new: ['New', 'Nothing yet beyond joining'], warming: ['Warming', 'Visited or clicked a tracked link'], engaged: ['Engaged', 'Signed in or replied'], activated: ['Activated', 'Wallet linked'], ready: ['Ready', 'Bought something'] }; const VERB = { signin: 'signed in', visit: 'visited', click: 'clicked a tracked link', wallet: 'linked a wallet', purchase: 'bought a package', upgrade: 'upgraded', message: 'replied to a message', share: 'shared a link' }; function lastText(l) { if (!l) return 'no activity yet'; return (VERB[l.kind] || l.kind) + (l.site ? ' on ' + site(l.site) : '') + ', ' + ago(l.at); } // the block that goes under the lead's name: stage chip, heat, last action, entry reason function html(rd) { if (!rd) return ''; const st = STAGE[rd.stage] || STAGE.new; const h = rd.heat || { score: 0, band: 'cold', label: 'Cold' }; const tr = h.trend === 'up' ? ' ↗' : h.trend === 'down' ? ' ↘' : ''; return '' + esc(st[0]) + '' + '' + Number(h.score || 0) + ' · ' + esc(h.label || '') + tr + '' + '' + esc(lastText(rd.last)) + '' + '' + esc(entryText(rd.entry)) + ''; } const score = m => (m && m.rd && m.rd.heat ? Number(m.rd.heat.score) || 0 : -1); window.TankReady = { html, entryText, lastText, score, stageLabel: s => (STAGE[s] || STAGE.new)[0] }; })();