HTML 77.2%
TypeScript 10.5%
Python 9.6%
JavaScript 2.5%
1import { ImageResponse } from 'next/og';2import type { NextRequest } from 'next/server';3import { Wallpaper } from '@/components/brand/og';4import { todayUtc, validDay } from '@/components/temporal/dates';5import { apiD3, safe } from '@/lib/api';6import { fmtDate, fmtInt } from '@/lib/format';78export const runtime = 'nodejs';9export const revalidate = 3600;1011/** Dynamic OG image for /time-machine?date= — the date and the live as-of counters. */12export async function GET(req: NextRequest): Promise<Response> {13 const sp = req.nextUrl.searchParams;14 const date = validDay(sp.get('date')) ?? todayUtc();15 const tm = await safe(apiD3.timeMachine(date, 'all', 1));16 const counters: [string, string][] = tm ? [['Models', fmtInt(tm.models?.total)], ['Offers valid', fmtInt(tm.prices?.total)], ['Leaders', fmtInt(tm.benchmarks?.leaders?.length)], ['Basis', tm.reconstructed ? 'reconstructed' : 'observed']] : [];17 return new ImageResponse(<Wallpaper eyebrow="Time machine" title={`As of ${fmtDate(date)}`} subtitle={tm?.reconstructed ? 'Reconstructed from dated claims and release dates — before the observation history began.' : 'Models, prices, benchmark leaders and hardware as they were known that day.'} counters={counters} footer={`www.ai-atlas.co/time-machine?date=${date}`} markPx={220} />, { width: 1200, height: 630 });18}19