const formatMoney = (n) => n >= 1e6 ? `$${(n / 1e6).toFixed(2)}M` : n >= 1e3 ? `$${(n / 1e3).toFixed(1)}K` : `$${n?.toFixed(0) ?? 0}` const OUTCOME_MAP = { ipo: { ascii: '[IPO]', title: 'IPO_SUCCESS', cls: 'ipo' }, acquisition: { ascii: '[ACQ]', title: 'ACQUIRED', cls: 'acquisition' }, runway_exhausted: { ascii: '[DEAD]', title: 'BANKRUPTCY', cls: 'bankruptcy' }, finished_10: { ascii: '[DONE]', title: 'EPISODE_COMPLETE', cls: 'default' }, } const DIVIDER = '================================================' export default function EndScreen({ obs, onReplay }) { if (!obs) return null const { state } = obs const reason = state?.done_reason ?? 'finished_10' const { ascii, title, cls } = OUTCOME_MAP[reason] ?? OUTCOME_MAP['finished_10'] const history = state?.history ?? [] const roundsWon = history.filter(h => h.agent_won_vote).length return (