import type { PlexShowDetail } from "./api"; // The ordered episode rating-keys of a show: season order, then episode order within each season — // the play-queue order the show/season pages and the collection Play-all all rely on. Kept in ONE // place so that invariant (and any future explicit sort, e.g. pushing season 0 "Specials" last) // lives at a single site rather than the three hand-rolled `seasons.flatMap(...)` copies it grew // into. `detail` is nullable so callers can pass an in-flight query's `data` straight through. export function showEpisodeKeys(detail: PlexShowDetail | null | undefined): string[] { return (detail?.seasons ?? []).flatMap((s) => s.episodes.map((e) => e.id)); }