import Link from 'next/link'; import { Section } from '@/components/ui/section'; import { Unavailable } from '@/components/ui/unavailable'; import { fmtInt, num } from '@/lib/format'; import { routes } from '@/lib/site'; import type { BucketStat } from '@/lib/types'; const SPECIAL_ORDER = ['MEO', 'GEO', 'HEO', 'OTHER', 'UNKNOWN']; /** 0-200 … 1000-2000 by lower bound, then MEO, GEO, HEO, other/unknown. */ export function orderBuckets(buckets: BucketStat[]): BucketStat[] { const rank = (b: string) => { const m = /^(\d+)-/.exec(b); if (m) return Number(m[1]); const i = SPECIAL_ORDER.indexOf(b.toUpperCase()); return 1_000_000 + (i < 0 ? SPECIAL_ORDER.length : i); }; return [...buckets].sort((a, b) => rank(a.bucket) - rank(b.bucket)); } function label(b: string): string { return /^\d+-\d+$/.test(b) ? `${b} km` : b === 'UNKNOWN' ? 'Unknown' : b === 'OTHER' ? 'Other' : b; } const SEGMENTS: { key: keyof BucketStat; label: string; color: string }[] = [ { key: 'active_payloads', label: 'Active payloads', color: 'var(--series-1)' }, { key: 'payloads', label: 'Inactive payloads', color: 'var(--series-7)' }, { key: 'rocket_bodies', label: 'Rocket bodies', color: 'var(--series-4)' }, { key: 'debris', label: 'Debris', color: 'var(--series-8)' }, ]; /** Orbital density as a horizontal bar profile (one row per altitude shell), stacked by object category. */ export function OrbitalDensity({ buckets }: { buckets: BucketStat[] }) { const rows = orderBuckets(buckets); const max = Math.max(1, ...rows.map((b) => num(b.objects) ?? 0)); return (

Objects on orbit by altitude shell (perigee) and orbit regime. Derived from the latest element sets — see the methodology. Not a collision-risk metric.

{rows.length === 0 ? ( ) : ( <>
    {rows.map((b) => { const total = num(b.objects) ?? 0; const active = num(b.active_payloads) ?? 0; const payloads = Math.max(0, (num(b.payloads) ?? 0) - active); const parts = [active, payloads, num(b.rocket_bodies) ?? 0, num(b.debris) ?? 0]; return (
  1. {label(b.bucket)} {parts.map((v, i) => ( ))} {fmtInt(total)}
  2. ); })}
)}
); }