document.addEventListener('DOMContentLoaded', () => { // 1. Mock Data const startups = [ { id: 1, name: "FinFlow", tagline: "Next-gen liquidity management for SMEs", irr: 25, pd: 5, fragility: 15, revenueConcentration: 20, sector: "Fintech", description: "FinFlow uses advanced AI to predict cash flow gaps and automate short-term financing for medium-sized enterprises. They have already secured partnerships with 3 major banks and have a growing user base.", growth: "15% MoM", funding: "$4.5M Series A", burnRate: "$150k/mo" }, { id: 2, name: "EcoPay", tagline: "Sustainable payments infrastructure", irr: 18, pd: 3, fragility: 10, revenueConcentration: 15, sector: "Payments", description: "EcoPay provides carbon-neutral payment processing. They offset the carbon footprint of every transaction and offer lower fees for green certified businesses.", growth: "8% MoM", funding: "$2.2M Seed", burnRate: "$60k/mo" }, { id: 3, name: "CyberShield", tagline: "Zero-trust cybersecurity for remote teams", irr: 30, pd: 12, fragility: 25, revenueConcentration: 40, sector: "Cybersecurity", description: "CyberShield offers a decentralized zero-trust network access (ZTNA) platform. High growth but operating in a highly competitive market with significant R&D spend.", growth: "25% MoM", funding: "$12M Series B", burnRate: "$450k/mo" }, { id: 4, name: "DataNexus", tagline: "Federated learning for enterprise data", irr: 22, pd: 7, fragility: 18, revenueConcentration: 25, sector: "Big Data/AI", description: "DataNexus enables companies to train machine learning models on sensitive data without moving it, preserving privacy and compliance.", growth: "12% MoM", funding: "$6M Series A", burnRate: "$200k/mo" }, { id: 5, name: "HealthBridge", tagline: "Telemedicine platform for rural healthcare", irr: 20, pd: 4, fragility: 12, revenueConcentration: 10, sector: "Healthtech", description: "HealthBridge connects rural clinics with specialist doctors via a low-bandwidth, high-security video and diagnostics platform.", growth: "10% MoM", funding: "$3.5M Series A", burnRate: "$110k/mo" } ]; // 2. Navigation Control const sections = ['hero', 'profile', 'results', 'detail']; const sidebar = document.getElementById('wrapper'); const sidebarToggle = document.getElementById('sidebarToggle'); const showSection = (sectionId) => { sections.forEach(s => { const el = document.getElementById(`${s}-section`); if (el) el.classList.add('d-none'); const navLink = document.querySelector(`.nav-link[data-section="${s}"]`); if (navLink) navLink.classList.remove('active'); }); const target = document.getElementById(`${sectionId}-section`); if (target) { target.classList.remove('d-none'); // Re-trigger fade-in animation target.style.animation = 'none'; target.offsetHeight; // trigger reflow target.style.animation = null; } const activeNav = document.querySelector(`.nav-link[data-section="${sectionId}"]`); if (activeNav) activeNav.classList.add('active'); // Scroll to top window.scrollTo(0, 0); }; // Sidebar Toggle if (sidebarToggle) { sidebarToggle.addEventListener('click', (e) => { e.preventDefault(); sidebar.classList.toggle('toggled'); }); } // Nav Link Clicks document.querySelectorAll('.nav-link, .navigate-btn').forEach(btn => { btn.addEventListener('click', (e) => { e.preventDefault(); const target = btn.dataset.section || btn.dataset.target; showSection(target); }); }); // 3. Profile Setup const minIrrInput = document.getElementById('min-irr'); const maxPdInput = document.getElementById('max-pd'); const irrValBadge = document.getElementById('irr-val'); const pdValBadge = document.getElementById('pd-val'); minIrrInput.addEventListener('input', () => { irrValBadge.textContent = `${minIrrInput.value}%`; }); maxPdInput.addEventListener('input', () => { pdValBadge.textContent = `${maxPdInput.value}%`; }); // 4. Matching Logic const matchBtn = document.getElementById('match-startups-btn'); const matchesContainer = document.getElementById('matches-container'); matchBtn.addEventListener('click', () => { const minIrr = parseFloat(minIrrInput.value); const maxPd = parseFloat(maxPdInput.value); // Filter & Calculate RAR let matches = startups.map(s => { return { ...s, rar: (s.irr * (1 - s.pd/100)).toFixed(2) }; }); // Filter based on user constraints matches = matches.filter(s => s.irr >= minIrr && s.pd <= maxPd); // Sort by RAR descending matches.sort((a, b) => b.rar - a.rar); // Take top 3 const topMatches = matches.slice(0, 3); renderMatches(topMatches); showSection('results'); }); const renderMatches = (matches) => { matchesContainer.innerHTML = ''; if (matches.length === 0) { matchesContainer.innerHTML = `
No startups match your current criteria.

Try lowering your IRR requirement or increasing your PD allowance.

`; return; } matches.forEach((s, index) => { const card = document.createElement('div'); card.className = 'col-md-4'; card.innerHTML = `
Match #${index + 1}

${s.name}

${s.sector}
RAR Score ${s.rar}%
Expected IRR ${s.irr}%
12M PD ${s.pd}%
`; matchesContainer.appendChild(card); }); // Attach listeners to "View Details" buttons document.querySelectorAll('.view-details-btn').forEach(btn => { btn.addEventListener('click', () => { const startupId = parseInt(btn.dataset.id); showStartupDetail(startupId); }); }); }; // 5. Detail View const detailContent = document.getElementById('startup-detail-content'); const showStartupDetail = (id) => { const s = startups.find(item => item.id === id); const rar = (s.irr * (1 - s.pd/100)).toFixed(2); detailContent.innerHTML = `

${s.name}

${s.tagline}

${s.sector}

Executive Summary

${s.description}

Growth ${s.growth}
Funding ${s.funding}
Burn Rate ${s.burnRate}
RAR Score ${rar}%

Stress-Test Performance

Simulated performance under varying market conditions (Fragility Score: ${s.fragility}).

Risk Metrics

Fragility Score ${s.fragility}
Revenue Concentration ${s.revenueConcentration}%
Expected 12M PD ${s.pd}%

Interested in ${s.name}?

Get direct access to their data room and contact the founding team.

`; showSection('detail'); renderStressChart(s); }; const renderStressChart = (startup) => { const ctx = document.getElementById('stressTestChart').getContext('2d'); // Generate mock stress data based on startup metrics const baseReturn = startup.irr; const labels = ['Stable', 'Moderate Volatility', 'High Volatility', 'Economic Downturn', 'Black Swan']; const data = [ baseReturn, baseReturn * (1 - startup.fragility/200), baseReturn * (1 - startup.fragility/100), baseReturn * (1 - startup.fragility/50), baseReturn * (1 - startup.fragility/25) ]; new Chart(ctx, { type: 'line', data: { labels: labels, datasets: [{ label: 'Projected IRR (%)', data: data, borderColor: '#0d6efd', backgroundColor: 'rgba(13, 110, 253, 0.1)', fill: true, tension: 0.4, pointRadius: 6, pointBackgroundColor: '#0d6efd', borderWidth: 3 }] }, options: { responsive: true, maintainAspectRatio: false, scales: { y: { beginAtZero: false, grid: { color: 'rgba(255, 255, 255, 0.05)' }, ticks: { color: '#8b949e' } }, x: { grid: { display: false }, ticks: { color: '#8b949e' } } }, plugins: { legend: { display: false } } } }); }; });