"use client"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { buttonVariants } from "@/components/ui/button"; import { cn } from "@/lib/utils"; import { edgeClock } from "@/lib/report/clipEditorModel.mjs"; import type { EditorClip } from "@/lib/report/clipEditorTypes"; import { footageAt } from "@/lib/report/footage-move.mjs"; import { clipStamps, clockText, cutTimeAt, finaleUp, liveClock, stampAt, tallyAt } from "@/lib/report/liveClock.mjs"; import { tallyCellsFrom, VERDICTS } from "umtool-report-to-video/factcheck"; import { BLUR_CAPTION_DEFAULT, BLUR_STRENGTH } from "umtool-report-to-video/clip-blur"; import { drawFootage } from "./footageCanvas"; import { regionsAt } from "./CensorOverlay"; import { DeckFrame, FeedOverlay, ModuleLayers, PostsOverlay, postsWindowAt, type DeckPreviewDoc, type DeckTexts, type Rect } from "../OnscreenSection"; // --------------------------------------------------------------------------- // THE LIVE PREVIEW (plans/live-preview.md): the clip editor's playing source // with the cut's on-screen chrome composited over it, in this browser, in step // with the playhead -- so a clip is walked in its final look without waiting // on a build. // // THE COMPOSITION IS THE BUILD'S OWN PAGES, as the On-screen section's preview // is (OnscreenSection.tsx DeckFrame, FeedOverlay, PostsOverlay): the deck // (date title, subtitle, the rail with this clip's pip and the markers, the // tally, the QR), the posts feed or popups, the fact-check stamps and the // finale, each composed by compose-chrome from the manifest's ESTIMATED // schedule (POST /api/report/chrome/preview with `estimate: true`) and seeked // in the cut's seconds. The cut second is the source playhead mapped through // the clip's play window (lib/report/liveClock.mjs) -- the rule the estimate // and a stamp's `claim.at` both use, so the stamp lands on its source second // here as in the render. // // The footage is the editor's own