commit 17fddc444a70dd5acf4bbdc0602add0cf1a2b081
parent 5b2de5c1bc1bd7a5c85da6fe87b79ab49b924d25
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 6 Nov 2026 01:22:45 -0500
Merge lane/scale-dial: the weight video's instruments -- a bathroom-scale dial (needle springs to each stated weight on its word, qualifier wedges, remembered-weight ghosts, the goal on the bezel), the lost-pounds odometer beside NET, the weight trail by date, and the dial finale; an instruments column in the deck, corner placement, needle motion and finale-ending variants, drawn the same by the render and Play (operator, 5 Nov: "Maybe a radial counter reminiscent of a scale for the weight?"; "all modules"; "Make variants for me to judge")
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
26 files changed, 2432 insertions(+), 42 deletions(-)
diff --git a/umtool/components/projects/OnscreenSection.tsx b/umtool/components/projects/OnscreenSection.tsx
@@ -2344,9 +2344,14 @@ export default function OnscreenSection({
// only inside it, as the build lays it at its own second; a whole-cut
// module's page is up for the whole cut and draws its own comings and goings.
// Laid over the deck's page (the build lays the deck first) and under the
-// finale (which the caller lays last).
+// finale (which the caller lays last) -- all but a module whose z is above
+// the finale's (FINALE_Z: the dial's finale, laid over the finale's page by
+// the build), which goes in a second layer over it.
// ---------------------------------------------------------------------------
+/** The finale's z (modules/finale.mjs): a play layer above it is laid over the finale's page. */
+const FINALE_Z = 90;
+
/** How long before its window a window layer's page is mounted, and how long after it stays. */
const LAYER_LEAD_S = 4;
const LAYER_TAIL_S = 1;
@@ -2363,7 +2368,8 @@ export function ModuleLayers({
testid?: string;
}) {
if (!layers?.length) return null;
- const rows: { key: string; layer: PlayLayer; segment: string | null; src?: string; error?: string; up: boolean }[] = [];
+ type Row = { key: string; layer: PlayLayer; segment: string | null; src?: string; error?: string; up: boolean };
+ const rows: Row[] = [];
for (const l of [...layers].sort((a, b) => a.z - b.z)) {
if (!l.geometry) continue;
if (Array.isArray(l.windows)) {
@@ -2375,27 +2381,36 @@ export function ModuleLayers({
rows.push({ key: `${l.id}:${l.src ?? "none"}`, layer: l, segment: null, src: l.src, error: l.error, up: true });
}
}
+ const draw = (r: Row) => (
+ <div
+ key={r.key}
+ className="pointer-events-none absolute inset-0"
+ data-play-layer={r.layer.id}
+ data-play-layer-segment={r.segment ?? undefined}
+ data-play-layer-up={r.up ? "1" : "0"}
+ style={{ opacity: r.up ? 1 : 0 }}
+ >
+ <FeedOverlay
+ feed={{ geometry: r.layer.geometry!, src: r.src, error: r.error }}
+ frame={g}
+ t={t}
+ ready={r.layer.ready}
+ testid={`${testid}-${r.layer.id}`}
+ name={r.layer.id}
+ />
+ </div>
+ );
+ const over = rows.filter((r) => r.layer.z > FINALE_Z);
return (
- <div className="pointer-events-none absolute inset-0" style={{ zIndex: 1 }} data-module-layers="">
- {rows.map((r) => (
- <div
- key={r.key}
- className="pointer-events-none absolute inset-0"
- data-play-layer={r.layer.id}
- data-play-layer-segment={r.segment ?? undefined}
- data-play-layer-up={r.up ? "1" : "0"}
- style={{ opacity: r.up ? 1 : 0 }}
- >
- <FeedOverlay
- feed={{ geometry: r.layer.geometry!, src: r.src, error: r.error }}
- frame={g}
- t={t}
- ready={r.layer.ready}
- testid={`${testid}-${r.layer.id}`}
- name={r.layer.id}
- />
+ <>
+ <div className="pointer-events-none absolute inset-0" style={{ zIndex: 1 }} data-module-layers="">
+ {rows.filter((r) => r.layer.z <= FINALE_Z).map(draw)}
+ </div>
+ {over.length > 0 && (
+ <div className="pointer-events-none absolute inset-0" style={{ zIndex: 3 }} data-module-layers="over-finale">
+ {over.map(draw)}
</div>
- ))}
- </div>
+ )}
+ </>
);
}
diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md
@@ -1514,9 +1514,13 @@ filter. A knob absent is its default, and a module whose knobs are all absent dr
| [Moving start](#moving-start) `peak` | The starting weight as he retells it: a tick per telling on a small scale, a count per repeat, the drift bracketed. (a page over the whole cut) | `render.chrome.deck.peak` |
| [Goal stack](#goal-stack) `goals` | Each goal he names as a sticky note on a pile -- a repeat merged with its count, a deadline counted down to the render date. (a page over the whole cut) | `render.chrome.deck.goals` |
| [Thread rail](#thread-rail) `threads` | A card per thread beside the footage, lit as its clips play. (a page over the whole cut) | `render.chrome.threads` |
+| [Scale dial](#scale-dial) `dial` | A bathroom-scale face: the needle swings to each weight he states, his remembered weights as ghosts, his goal on the bezel. (a page over the whole cut) | `render.chrome.deck.dial` |
+| [Lost odometer](#lost-odometer) `odometer` | Rolling digits of the pounds he says he has lost (only ever up), NET beside them. (a page over the whole cut) | `render.chrome.deck.odometer` |
+| [Weight trail](#weight-trail) `trail` | His stated weights by date, drawn up to the playhead, the 300 lb line and the times he says he is under it. (a page over the whole cut) | `render.chrome.deck.trail` |
| [Flips](#flips) `flips` | Pairs of what was said then and now, in the side panel. (a page over the whole cut) | `render.chrome.flips` |
| [Chapters](#chapters) `chapter` | A section bumper over the first seconds of the clip it opens: title, subtitle, date. (pages at their own seconds) | `render.chrome.chapter` |
| [Finale](#finale) `finale` | The cut's last clips under the rail redrawn large, the final totals and stats cards. (pages at their own seconds) | `render.chrome.deck.finale` |
+| [Dial finale](#dial-finale) `dial-finale` | The finale with the dial and the odometer large: the needle drops to his last stated weight, the wheels roll to the total, NET holds. (pages at their own seconds) | -- |
| [Promise clock](#promise-clock) `promise` | Days since a promise -- to the clip on screen, then to the render date -- with each check's words and whether it was kept. (a page over the whole cut) | `render.chrome.deck.promise` |
### Play the cut and the live preview
@@ -1529,7 +1533,7 @@ it can be seeked. `POST /api/report/chrome/preview` returns every such module th
build's predicate) as `layers: [{id, z, region, clock, ready, geometry, src | windows}]`; the client lays them
by z over the deck's page, a whole-cut page for the whole cut, a window module's page only inside each window.
-Declaring `play`: `stats`, `pair`, `status`, `fx`, `streak`, `diet`, `peak`, `goals`, `threads`, `flips`, `chapter`, `promise`.
+Declaring `play`: `stats`, `pair`, `status`, `fx`, `streak`, `diet`, `peak`, `goals`, `threads`, `dial`, `odometer`, `trail`, `flips`, `chapter`, `dial-finale`, `promise`.
Still drawn by their own paths (the response's `src`, `feed`, `posts`, `stamp` and `finale` keys), and what moving
each onto `play` needs: the deck (`shell`) -- its typed words patched in live (`deck:text`) and the `deck:ready`
@@ -1787,6 +1791,45 @@ A card per thread in the side panel beside the footage, lit as its clips play; a
|---|---|---|
| `render.chrome.threads.list[]` | `{id, label, outcome?: {verdict, label?}}`; a clip names its thread with `thread` | `umtool look <p> chrome.threads=…` (manifest) |
+### Scale dial
+
+A bathroom-scale face at the top of the instruments' column (the right of the frame; the clip moves to the left -- `instrumentsGeometry`, 1248×702 footage beside a 600 px column at 1920×1080). It reads the schedule's `measure` (the measure ledger's slice): the red needle swings to each STATED weight at its event's `t` (the spoken word) with a spring (`back.out`, 0.9 s) and rests there -- a frame at rest is reused, not captured again; a qualifier draws a wedge in pounds (≈ 3 under to 1 over, `>` 10 up, `<` 10 down); every REMEMBERED weight is a grey tick, the latest a long ghost needle with its as-of date; the latest goal is an amber tick on the bezel and its words under the digits. It comes and goes with the deck (a card, the finale). With any instrument on, the posts stay in the footage box (`posts.shift` does not apply), and the side panel (`threads`, `flips`) and the posts feed are refused.
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `deck.dial` | `true` · an object of the knobs below · absent or `false` off | `umtool look <p> deck.dial=true` |
+| `deck.dial.mark` | a weight, or `null` · default `300` (its tick and label in the accent) | `umtool look <p> deck.dial.mark=300` |
+| `deck.dial.ghosts`, `.goal` | bool · default `true` each | `umtool look <p> deck.dial.ghosts=false` |
+| `deck.dial.needle` | a #hex · default `#ff5a4e` | `umtool look <p> deck.dial.needle='"#ff5a4e"'` |
+| `deck.dial.label` | words over the digits, ≤ 40 · default `HE SAYS HE WEIGHS` | `umtool look <p> deck.dial.label='"…"'` |
+| `deck.dial.finale` | bool · default `true`: the dial and the odometer large in the finale (module `dial-finale`) | `umtool look <p> deck.dial.finale=false` |
+| `deck.dial.placement` | `column` `corner` · default `column`. A VARIANT: `corner` drops the column -- the footage stays where the deck puts it, the dial a `size` square over its lower-right corner, the odometer and the trail (at 4/5 size) stacked in its lower-left; the side panel is allowed there, the feed still refused | `umtool look <p> deck.dial.placement=corner` |
+| `deck.dial.size` | 200–540 px at 1920 wide · default `340` (the corner dial only) | `umtool look <p> deck.dial.size=300` |
+| `deck.dial.corner` | `bottom-right` `bottom-left` `top-right` `top-left` · default `bottom-right` (the corner only): the dial in that corner, the odometer and the trail up the same side. The measure extras stand at their own anchors in the footage (goals bottom-right, peak top-right, promise top-centre, diet bottom-left, streak bottom-centre): a corner instrument over one that is on is REFUSED by the build, naming it -- move one (`deck.goals.position`, …) or the corner; `top-left` is clear of all five | `umtool look <p> deck.dial.corner=top-left` |
+| `deck.dial.motion` | `spring` `ease` · default `spring`. A VARIANT: the needle's `back.out` overshoot and settle, or a plain `power2.inOut` (the finale's drop too) | `umtool look <p> deck.dial.motion=ease` |
+| `deck.dial.finaleEnd` | `odometer` `promise` · default `odometer`. A VARIANT: `promise` hands the finale's last beat to the promise clock (module `promise`) -- the instruments fade out once NET has held (`dialFinaleHandoff`); with no promise module on the cut it ends on the odometer | `umtool look <p> deck.dial.finaleEnd=promise` |
+
+### Lost odometer
+
+Under the dial: the measure's `state.lost.total` (the highest real-time loss claim in each run, summed) on mechanical wheels to a tenth, rolling forward at each claim that raises it (1.3 s) and never back -- a lower total is held at the highest so far. NET (`state.net`: the first stated weight of the record to the latest) in plain digits beside it, `−76.5 · 368 → 291.5`; `ACROSS 8 RUNS` under the wheels.
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `deck.odometer` | `true` · an object of the knobs below · absent or `false` off | `umtool look <p> deck.odometer=true` |
+| `deck.odometer.label` | words over the wheels, ≤ 40 · default `POUNDS HE SAYS HE'S LOST` | `umtool look <p> deck.odometer.label='"…"'` |
+| `deck.odometer.net`, `.runs` | bool · default `true` each | `umtool look <p> deck.odometer.net=false` |
+
+### Weight trail
+
+At the foot of the instruments' column: every STATED weight the cut shows, placed by the date he was weighed (its `asOf`, else its date) across the span of them, a dot appearing at its event's `t` and the line between two neighbours drawn once both are said; a red ring on the latest said. The `mark` line (300) dashed across; with `count` and the mark at 300, `UNDER 300 · SAID n×` counts the measure's `totals.under300` rows as the cut reaches each.
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `deck.trail` | `true` · an object of the knobs below · absent or `false` off | `umtool look <p> deck.trail=true` |
+| `deck.trail.mark` | a weight, or `null` · default `300` | `umtool look <p> deck.trail.mark=300` |
+| `deck.trail.count` | bool · default `true` | `umtool look <p> deck.trail.count=false` |
+| `deck.trail.label` | its title, ≤ 40 · default `WHAT HE SAYS HE WEIGHS, BY DATE` | `umtool look <p> deck.trail.label='"…"'` |
+
### Flips
Then-and-now pairs in the side panel (`render.chrome.flips`, flips.mjs); the thread rail and the flips share the panel: one or the other.
@@ -1814,6 +1857,14 @@ The full reference is [The finale](#the-finale-the-timeline-in-primary-view). It
| `deck.finale` | `{video, motion, totals, stats, statsTitle, railLabels, pips, timelineShare, claims}` | `umtool look <p> deck.finale='{…}'` |
| a clip's `layout` | `finale` on one run of clips at the end | `umtool set <p> <clip> layout=finale` |
+### Dial finale
+
+With the dial on (`deck.dial`) and a finale (a run of `layout: "finale"` clips), the finale's lower column -- beside the clip, under the finale's totals when it draws them -- carries the instruments large over the finale's window: in over the finale's grow, the needle dropping (1.8 s, `back.out`) from his highest remembered weight (the measure's `totals.peakDrift` and remembered weights) to his last stated one (`totals.net.to`), every ghost tick and the latest goal on the bezel; the odometer rolling up from zero to the whole record's `totals.lost` (the rows the cut never shows included) with `ACROSS N RUNS`; NET (`totals.net`) held beside it; out through the finale's dissolve. Laid over the finale (z 95), in Play too. It needs the lower column clear: a finale with stats cards (`deck.finale.stats`) is refused -- set `deck.dial.finale` false, or drop the cards.
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `deck.dial.finale` | bool · default `true` (with the dial on) | `umtool look <p> deck.dial.finale=false` |
+
### Promise clock
A days-since counter for a promise (`render.chrome.deck.promise`, measure-extras.mjs), from the promise's event on: "SCALE VIDEO OFFERED 23 OCT", the days from the day he said it to the in-record date of the latest event on screen, and "NONE POSTED" in red until a row says it was kept ("POSTED", green). Each promise check's words come in under it with a flash (`checks`: the row's `label`, or its transcript `quote`). From the finale's start -- else 4 s after the last event -- the days count on, a day a step, to `measure.asOfRender`. Another party on the promise (CONTRACT addendum: a ledger row with a `speaker`, a `promise_claim`) shows under the header -- "PAID 23 OCT BY @MadamSavvy" (`claimVerb`, her `paidOn` else the claim's date), with her picture from the manifest's `postAvatars` (`umtool posts avatar`; else a monogram) -- and her words flash under the clock in her ink (`claimColor`, or `speakers.<k>.color`), his in amber. An outcome (`promise_outcome`) is drawn too: `refunded` slams on a stamp "REFUNDED · by 31 Oct · no video" while the days keep counting to the render date, `withdrawn` likewise in grey, `kept` turns it green ("POSTED") and stops the count on the day. Laid over the finale (z 95) unless `finale: "hide"`.
diff --git a/umtool/e2e/fixtures/instruments-fixture.mjs b/umtool/e2e/fixtures/instruments-fixture.mjs
@@ -0,0 +1,58 @@
+// What instruments.spec.ts previews: the Play cut (play-cut-fixture.mjs) with the
+// measure's instruments on -- `deck.dial`, `deck.odometer`, `deck.trail` -- and
+// a BUILT schedule (out/sourced/schedule.json, the estimate's own timings) that
+// carries a measure slice, as the build writes one for a cut with a measure
+// ledger (the producer is lane measure-ledger's; until it lands the slice is
+// written here). The chrome preview without `estimate` reads that schedule;
+// Play the cut composes on the estimate's, which carries the measure once the
+// producer puts it there. Six rows of the instruments' fixture
+// (report-to-video/fixtures/measure-dial/measure.json), each at a second of
+// the cut, with the state after it:
+//
+// c01 +0.6 w07 stated >240 c01 +1.2 w21 remembered ≈390
+// c02 +0.4 w27 goal 250 c02 +1.0 w64 lost 31 (run 6)
+// c04 +0.2 w115 stated <300 c04 +0.6 w118 stated 291.5
+//
+// Real ledger rows (the weight project's measure slice), the fixture cut's seconds.
+import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+const MEASURE = path.join(HERE, "..", "..", "report-to-video", "fixtures", "measure-dial", "measure.json");
+
+/** The rows, and where each lands: [row, clip, seconds into the clip]. */
+export const INSTRUMENT_ROWS = Object.freeze([
+ ["w07", "c01", 0.6], ["w21", "c01", 1.2], ["w27", "c02", 0.4], ["w64", "c02", 1.0], ["w115", "c04", 0.2], ["w118", "c04", 0.6],
+]);
+
+export async function makeInstrumentsFixture({ reports, deckManifest, cachedWindow, makePlayCutFixture, name = "instruments-fixture" }) {
+ const { estimateSchedule } = await import("../../report-to-video/deck.mjs");
+ const { dir } = makePlayCutFixture({
+ reports, deckManifest, cachedWindow, name, title: "The Instruments Fixture",
+ chrome: {
+ deck: { dial: true, odometer: true, trail: true },
+ // The tally's word fitted to its cell, as play-modules-fixture's.
+ factcheck: { verdicts: { CORROBORATED: { label: "Seizures", tallyLabel: "Seized", color: "#6fa8dc" } }, stamp: { seconds: 1 } },
+ },
+ });
+ const file = path.join(dir, "video.manifest.json");
+ const manifest = JSON.parse(readFileSync(file, "utf8"));
+ const schedule = estimateSchedule(manifest);
+ const M = JSON.parse(readFileSync(MEASURE, "utf8"));
+ const startOf = new Map(schedule.segments.map((s) => [s.id, s.start]));
+ const r3 = (v) => Math.round(v * 1000) / 1000;
+ const events = [];
+ const state = [{ ...M.state[0], t: 0 }];
+ for (const [row, clip, at] of INSTRUMENT_ROWS) {
+ const i = M.events.findIndex((e) => e.row === row);
+ if (i < 0) throw new Error(`instruments-fixture: ${row} is not in ${MEASURE}`);
+ const t = r3(startOf.get(clip) + at);
+ events.push({ ...M.events[i], t, segment: clip });
+ state.push({ ...M.state[i + 1], t });
+ }
+ const measure = { ...M, events, state, _fixture: "instruments-fixture: six rows of measure-dial's fixture at seconds of the Play cut" };
+ mkdirSync(path.join(dir, "out", "sourced"), { recursive: true });
+ writeFileSync(path.join(dir, "out", "sourced", "schedule.json"), JSON.stringify({ ...schedule, measure }, null, 2) + "\n");
+ return { dir, schedule: { ...schedule, measure } };
+}
diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs
@@ -62,6 +62,7 @@ import { makeTakeItemsFixture } from "./take-items-fixture.mjs";
import { makePlayPreloadFixture } from "./play-preload-fixture.mjs";
import { makePostComboFixture } from "./post-combo-fixture.mjs";
import { makeMediaScenesFixture } from "./media-scenes-fixture.mjs";
+import { makeInstrumentsFixture } from "./instruments-fixture.mjs";
const CODE = path.resolve(path.dirname(new URL(import.meta.url).pathname), "..", "..", "song");
const dest = path.resolve(process.argv[2] ?? path.join(process.cwd(), ".e2e-song"));
@@ -2030,9 +2031,20 @@ pm.timeline = pm.timeline.map((e) => (e.id === "c03" ? { ...e, verdict: "incorre
writeFileSync(pmFile, JSON.stringify(pm, null, 2) + "\n");
}
+// The measure's instruments (instruments.spec.ts): the Play cut with the dial, the odometer and
+// the trail on, and a built schedule carrying a measure slice (instruments-fixture.mjs).
+await makeInstrumentsFixture({ reports, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), makePlayCutFixture });
+
// The same cut with a measure slice in its schedule (play-measure.spec.ts): the weight
// video's goal stack, moving start, promise clock and diet badge drawn in Play the cut.
await makeMeasureExtrasFixture({ reports, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4") });
+// The same ledger with the instruments on and the extras off (instruments.spec.ts): the dial, the odometer and
+// the trail in Play the cut, from the estimate's measure slice.
+await makeMeasureExtrasFixture({
+ reports, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"),
+ name: "play-instruments-fixture", title: "The Play Instruments Fixture",
+ deck: { dial: true, odometer: true, trail: true, goals: false, peak: false, promise: false, diet: false, streak: false },
+});
// Wrong speaker in Play the cut (play-modules.spec.ts), which WRITES (removes c02, then undoes):
// its own copy, so no other spec's cut moves under it.
diff --git a/umtool/e2e/fixtures/measure-extras-fixture.mjs b/umtool/e2e/fixtures/measure-extras-fixture.mjs
@@ -48,11 +48,13 @@ export const MEASURE_LEDGER = [
];
/**
- * @param {{ reports: string, deckManifest: Function, cachedWindow: string }} o
+ * @param {{ reports: string, deckManifest: Function, cachedWindow: string, name?: string, title?: string, deck?: Record<string, any> }} o
+ * `name`/`title`/`deck`: another copy with more deck keys (play-instruments-fixture: the dial, the odometer and
+ * the trail on, the extras off -- instruments.spec.ts).
*/
-export async function makeMeasureExtrasFixture({ reports, deckManifest, cachedWindow }) {
+export async function makeMeasureExtrasFixture({ reports, deckManifest, cachedWindow, name = "play-measure-fixture", title = "The Play Measure Fixture", deck = {} }) {
const { dir } = makePlayCutFixture({
- reports, deckManifest, cachedWindow, name: "play-measure-fixture", title: "The Play Measure Fixture",
+ reports, deckManifest, cachedWindow, name, title,
chrome: {
// The tally's word fitted to its cell (the Play cut's own "Seizures" overflows it, so its chrome never composes).
factcheck: { verdicts: { CORROBORATED: { label: "Seizures", tallyLabel: "Seized", color: "#6fa8dc" } }, stamp: { seconds: 1 } },
@@ -66,6 +68,7 @@ export async function makeMeasureExtrasFixture({ reports, deckManifest, cachedWi
...(m.render.chrome.deck ?? {}),
measure: { scopes: ["weight", "regime"], asOf: "2026-11-05" },
promise: { label: "scale video" },
+ ...deck,
};
writeFileSync(file, JSON.stringify(m, null, 2) + "\n");
return { dir };
diff --git a/umtool/e2e/instruments.spec.ts b/umtool/e2e/instruments.spec.ts
@@ -0,0 +1,206 @@
+import { test, expect, type APIRequestContext, type Page } from "@playwright/test";
+import { readFileSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import * as urls from "./urls";
+
+// ---------------------------------------------------------------------------
+// THE MEASURE'S INSTRUMENTS (umtool/docs/knobs.md, Modules: "Scale dial",
+// "Lost odometer", "Weight trail"): three deck modules that read the
+// schedule's measure slice and declare `play` -- each page composed for the
+// chrome preview, posting `<region>:ready`, seeked by `deck:seek` in the cut's
+// seconds; the same page the build captures.
+//
+// Fixture: e2e/fixtures/instruments-fixture.mjs -- the Play cut with
+// deck.dial/odometer/trail on and a built schedule carrying six rows of the
+// measure (w07 stated >240 0.6 s into c01, w21 remembered ≈390 at c01 +1.2,
+// w27 goal 250 at c02 +0.4, w64 lost 31 at c02 +1.0, w115 stated <300 at c04
+// +0.2, w118 stated 291.5 at c04 +0.6; the spec reads the seconds back from
+// the fixture's schedule). The chrome preview without `estimate` reads that
+// schedule. (Play the cut composes on the estimate's clock: the instruments
+// join it there once the build's measure producer puts the slice in the
+// estimate.)
+// ---------------------------------------------------------------------------
+
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+const PROJECT = "reports/instruments-fixture";
+const DIR = path.join(HERE, "..", ".e2e-song", "reports", "instruments-fixture");
+const manifest = () => JSON.parse(readFileSync(path.join(DIR, "video.manifest.json"), "utf8"));
+/** The fixture's schedule (its seconds are the estimate's on this machine's fixture render block). */
+const schedule = () => JSON.parse(readFileSync(path.join(DIR, "out", "sourced", "schedule.json"), "utf8")) as { total: number; measure: { events: { row: string; t: number }[] } };
+/** A cut second: a row's, plus `after`. */
+const tOf = (row: string, after = 0) => schedule().measure.events.find((e) => e.row === row)!.t + after;
+/** The cut's last moment. */
+const tEnd = () => schedule().total - 0.05;
+
+type Layer = { id: string; z?: number; region?: string; ready?: string; src?: string; error?: string; off?: string; geometry?: { x: number; y: number; width: number; height: number } };
+
+async function preview(request: APIRequestContext, data: Record<string, unknown>) {
+ const res = await request.post("/api/report/chrome/preview", { data: { project: PROJECT, ...data } });
+ expect(res.ok(), await res.text()).toBeTruthy();
+ return (await res.json()) as { layers: Layer[]; geometry: { footage: { x: number; width: number } } };
+}
+
+/**
+ * A harness page holding one layer's page in an iframe, as Play holds it: the
+ * messages it posts are kept in `window.__msgs`; `seek(t)` posts `deck:seek`.
+ */
+async function harness(page: Page, src: string, baseURL: string) {
+ const url = new URL(`${src}${src.includes("?") ? "&" : "?"}preview=1`, baseURL).toString();
+ await page.setContent(`<!doctype html><body style="margin:0;background:#0f1311">
+ <iframe id="f" src="${url}" style="border:0;width:600px;height:540px"></iframe>
+ <script>window.__msgs = []; addEventListener("message", (e) => window.__msgs.push(e.data));</script></body>`);
+ return {
+ frame: page.frameLocator("#f"),
+ messages: () => page.evaluate(() => (window as unknown as { __msgs: { type: string }[] }).__msgs.map((m) => m.type)),
+ seek: (t: number) => page.evaluate((v) => (document.getElementById("f") as HTMLIFrameElement).contentWindow!.postMessage({ type: "deck:seek", t: v }, "*"), t),
+ };
+}
+
+/** The readout block the dial shows: the one `cv` block that is visible. */
+const visibleReadout = (frame: ReturnType<Page["frameLocator"]>) =>
+ frame.locator(".read").evaluateAll((els) =>
+ els.filter((e) => getComputedStyle(e).visibility !== "hidden" && Number(getComputedStyle(e).opacity) > 0.5).map((e) => (e.querySelector(".big")?.textContent ?? "").trim()),
+ );
+
+/** The needle's rotation in degrees, read off its computed transform. */
+const needleDeg = (frame: ReturnType<Page["frameLocator"]>) =>
+ frame.locator('[data-k="nd"]').evaluate((el) => {
+ const m = new DOMMatrix(getComputedStyle(el).transform);
+ return Math.round((Math.atan2(m.b, m.a) * 180) / Math.PI);
+ });
+
+test.beforeEach(() => {
+ test.setTimeout(120_000);
+});
+
+test("the dial, the odometer and the trail are play layers of a cut with a measure, at the instruments' column", async ({ request }) => {
+ test.skip(!manifest().render.fontRegular, "the deck refuses to draw without its faces, and make-fixture.mjs found no font on this machine");
+ const full = await preview(request, {});
+ const by = Object.fromEntries(full.layers.map((l) => [l.id, l]));
+ for (const id of ["dial", "odometer", "trail"]) {
+ expect(by[id], `${id} is a play layer`).toBeTruthy();
+ expect(by[id].error ?? null).toBeNull();
+ expect(by[id].ready).toBe(`${id}:ready`);
+ expect(by[id].src).toContain(`${id}-preview/index.html`);
+ }
+ // The column at the frame's right, the footage moved to the left for it (1920x1080).
+ expect(by.dial.geometry).toEqual({ x: 1296, y: 24, width: 600, height: 540 });
+ expect(by.odometer.geometry).toEqual({ x: 1296, y: 576, width: 600, height: 140 });
+ expect(by.trail.geometry).toEqual({ x: 1296, y: 728, width: 600, height: 138 });
+ expect(full.geometry.footage.x).toBe(24);
+ expect(full.geometry.footage.x + full.geometry.footage.width).toBeLessThanOrEqual(1296 - 24);
+ // No finale in this cut: no dial finale.
+ expect(by["dial-finale"]).toBeUndefined();
+
+ // The page it serves is the instrument's own, drawn from the measure.
+ const dial = await (await request.get(by.dial.src!)).text();
+ expect(dial).toContain('id="dial-data"');
+ expect(dial).toContain(">240<i>LB</i>");
+ expect(dial).toContain("291.5<i>LB</i>");
+ const odo = await (await request.get(by.odometer.src!)).text();
+ expect(odo).toContain('id="odometer-data"');
+ expect(odo).toContain("POUNDS HE SAYS HE");
+});
+
+test("the dial's page posts dial:ready and is seeked in the cut's seconds: the needle and the readout land on each stated weight", async ({ page, request, baseURL }) => {
+ test.skip(!manifest().render.fontRegular, "the deck refuses to draw without its faces, and make-fixture.mjs found no font on this machine");
+ const { layers } = await preview(request, { layers: ["dial"] });
+ const dial = layers.find((l) => l.id === "dial")!;
+ expect(dial.src, dial.off ?? dial.error).toBeTruthy();
+ const h = await harness(page, dial.src!, baseURL!);
+ await expect.poll(h.messages, { timeout: 30_000 }).toContain("dial:ready");
+
+ // Before any stated weight: the dash, the needle at rest on the scale's foot (220 lb: -135°).
+ await h.seek(0.2);
+ await expect.poll(() => visibleReadout(h.frame)).toEqual(["—"]);
+ await expect.poll(() => needleDeg(h.frame)).toBe(-135);
+ // After "over 240" has settled (and the ≈390 is said): its weight, the needle at 240 (-105°), its wedge up.
+ const settled = tOf("w21", 0.9);
+ await h.seek(settled);
+ await expect.poll(() => visibleReadout(h.frame)).toEqual([">240LB"]);
+ await expect.poll(() => needleDeg(h.frame)).toBe(-105);
+ await expect(h.frame.locator('[data-k="q1"]')).toBeVisible();
+ // The remembered ≈390 is a ghost with its as-of date.
+ await expect(h.frame.locator('[data-k="gn"]')).toBeVisible();
+ await expect(h.frame.locator('[data-k="ga0"]')).toContainText("AS OF");
+ // The last stated weight: 291.5 (-27.75°), and back again -- a seek lands the same from either side.
+ await h.seek(tEnd());
+ await expect.poll(() => visibleReadout(h.frame)).toEqual(["291.5LB"]);
+ await expect.poll(() => needleDeg(h.frame)).toBe(-28);
+ await h.seek(settled);
+ await expect.poll(() => visibleReadout(h.frame)).toEqual([">240LB"]);
+ await page.screenshot({ path: test.info().outputPath("instruments-dial.png") });
+});
+
+test("the odometer and the trail post ready and seek: the wheels only roll up, the line draws by date", async ({ page, request, baseURL }) => {
+ test.skip(!manifest().render.fontRegular, "the deck refuses to draw without its faces, and make-fixture.mjs found no font on this machine");
+ const { layers } = await preview(request, { layers: ["odometer", "trail"] });
+ const by = Object.fromEntries(layers.map((l) => [l.id, l]));
+ const odo = await harness(page, by.odometer.src!, baseURL!);
+ await expect.poll(odo.messages, { timeout: 30_000 }).toContain("odometer:ready");
+ // A wheel's digit: which of its strip's cells stands in its window.
+ const digits = () => odo.frame.locator(".wheel").evaluateAll((ws) => ws.map((w) => {
+ const strip = w.querySelector(".strip") as HTMLElement;
+ const y = new DOMMatrix(getComputedStyle(strip).transform).f;
+ return Math.round(-y / w.getBoundingClientRect().height) % 10;
+ }).join(""));
+ await odo.seek(tEnd());
+ const end = await digits();
+ await odo.seek(0.1);
+ const start = await digits();
+ expect(Number(end)).toBeGreaterThan(Number(start));
+ await page.screenshot({ path: test.info().outputPath("instruments-odometer.png") });
+
+ const trail = await harness(page, by.trail.src!, baseURL!);
+ await expect.poll(trail.messages, { timeout: 30_000 }).toContain("trail:ready");
+ const shown = () => trail.frame.locator(".pt").evaluateAll((ps) => ps.filter((p) => Number(getComputedStyle(p).opacity) > 0.5).length);
+ await trail.seek(0.3);
+ await expect.poll(shown).toBe(0);
+ await trail.seek(tEnd());
+ await expect.poll(shown).toBe(3);
+ await expect(trail.frame.locator('[data-k="uc1"]')).toContainText("UNDER 300 · SAID 2×");
+ await expect(trail.frame.locator('[data-k="uc1"]')).toBeVisible();
+});
+
+test("Play the cut draws the dial, the odometer and the trail from the estimate's measure: laid at the column, ready, seeked to the playhead", async ({ page }) => {
+ test.skip(!manifest().render.fontRegular, "the deck refuses to draw without its faces, and make-fixture.mjs found no font on this machine");
+ // play-instruments-fixture: the extras' Play ledger (one stated weight, 291.5, on c03) with the instruments on.
+ const PLAY = "reports/play-instruments-fixture";
+ const root = page.locator("[data-play-cut]");
+ await page.setViewportSize({ width: 1366, height: 1000 });
+ await page.goto(urls.playHref(PLAY, { clip: "c04", at: 1 }));
+ await expect(root).toHaveAttribute("data-play-edges", "render", { timeout: 30_000 });
+ await expect(root).toHaveAttribute("data-play-item", "c04");
+ for (const id of ["dial", "odometer", "trail"]) {
+ await expect(page.locator(`[data-play-layer="${id}"]`)).toHaveAttribute("data-play-layer-up", "1", { timeout: 30_000 });
+ await expect(page.getByTestId(`play-layer-${id}`)).toHaveAttribute("data-feed-ready", "1", { timeout: 30_000 });
+ }
+ const dial = page.frameLocator('[data-testid="play-layer-dial-iframe"]');
+ await expect.poll(() => visibleReadout(dial), { timeout: 15_000 }).toEqual(["291.5LB"]);
+ await page.screenshot({ path: test.info().outputPath("instruments-play-c04.png") });
+ // Back to c01, before the weight is said: the dash.
+ await page.locator('[data-play-row="c01"]').press("Enter");
+ await expect(root).toHaveAttribute("data-play-item", "c01");
+ await expect.poll(() => visibleReadout(dial), { timeout: 15_000 }).toEqual(["—"]);
+});
+
+test("the module panel lists the instruments and previews the dial alone, seeked by its scrubber", async ({ page }) => {
+ test.skip(!manifest().render.fontRegular, "the deck refuses to draw without its faces, and make-fixture.mjs found no font on this machine");
+ await page.goto(urls.section(PROJECT, "onscreen"));
+ const panel = page.getByTestId("modules-panel");
+ await expect(panel.getByTestId("module-dial")).toBeAttached({ timeout: 60_000 });
+ await expect(panel.getByTestId("module-odometer")).toBeAttached();
+ await expect(panel.getByTestId("module-trail")).toBeAttached();
+ const card = page.getByTestId("module-dial");
+ await card.locator("summary").click();
+ await card.getByTestId("module-preview-dial").click();
+ const iframe = card.getByTestId("module-preview-iframe");
+ await expect(iframe).toHaveAttribute("src", /dial-preview\/index\.html/);
+ // The scrubber to the cut's end, as a person drags it (a key, so React hears the input).
+ await card.getByTestId("module-preview-scrub").focus();
+ await page.keyboard.press("End");
+ const frame = card.frameLocator('[data-testid="module-preview-iframe"]');
+ await expect.poll(() => visibleReadout(frame), { timeout: 30_000 }).toEqual(["291.5LB"]);
+ await page.screenshot({ path: test.info().outputPath("instruments-panel.png") });
+});
diff --git a/umtool/lib/report/serve.mjs b/umtool/lib/report/serve.mjs
@@ -979,8 +979,10 @@ export function previewDirFor(projectDir, variant, rest, segmentIds) {
// ---------------------------------------------------------------------------
/** The regions whose pages the panel previews alone. */
-// (Every module that declares `play` must be here, or Play's iframe of its page is a 404: the measure extras too.)
-export const LAYER_REGIONS = Object.freeze(["pair", "status", "chapter", "stats", "threads", "flips", "fx", "diet", "peak", "goals", "promise", "streak"]);
+// (Every module that declares `play` must be here, or Play's iframe of its page is a 404: the measure
+// extras and the instruments too -- the dial's finale is a window its module names `dial-finale-preview`,
+// never confused with the dial's `dial-preview-<segment>`.)
+export const LAYER_REGIONS = Object.freeze(["pair", "status", "chapter", "stats", "threads", "flips", "fx", "diet", "peak", "goals", "promise", "streak", "dial", "odometer", "trail", "dial-finale"]);
/** The project name a layer preview is served under, or null when `head` is not one. */
export function layerPreviewOf(head, segmentIds = []) {
diff --git a/umtool/report-to-video/chrome-instruments.mjs b/umtool/report-to-video/chrome-instruments.mjs
@@ -0,0 +1,635 @@
+// THE INSTRUMENTS' PAGES (instruments.mjs): the dial, the odometer, the trail
+// -- each one HyperFrames page for the whole cut, in its region of the
+// instruments' column (deck.mjs instrumentsGeometry) -- and the dial's finale,
+// a page over the finale's window in the finale's lower column.
+//
+// PURE, like chrome-stats.mjs: a schedule (its `measure`) and a render block in,
+// an HTML string out. compose-chrome.mjs copies the assets in beside it, writes
+// it and renders it; the build lays the frames over the cut. Play the cut and
+// the live preview load the same page (`?preview=1`) and seek it by message.
+//
+// Every page is a cue interpreter (measure-draw.mjs cueList, pageHtml): every
+// state is its own block shown over exactly its span, every move a cue that
+// states its from, so a seek lands on the same pixels from either side and a
+// frame whose values did not move keys as the frame before it -- the needle at
+// rest between two weights is captured once, not once a frame.
+import { cueTime, deckChoreography, even, instrumentsGeometry, railGap } from "./deck.mjs";
+import { mix, rgba } from "./chrome-deck.mjs";
+import { finaleLayout } from "./chrome-finale.mjs";
+import { FINALE_MOTION } from "./finale.mjs";
+import { resolveDial, resolveOdometer, resolveTrail } from "./instruments.mjs";
+import {
+ cueList, dayNumber, dialAngle, dialFaceSvg, DIAL_SWEEP, esc, fmtDate, fmtSigned, fmtWeight, INSTANT, measureTrack,
+ pageHtml, polar, qualifierMark, r4, sectorPath, wedgeRange, wheelCount, wheelRoll, wheelStrip,
+} from "./measure-draw.mjs";
+
+/** The motion's seconds: the needle's swing, a ghost's move, the odometer's roll, a block's fade. */
+export const INSTRUMENT_MOTION = Object.freeze({
+ needle: 0.9, needleEase: "back.out(1.7)", needlePlain: "power2.inOut", ghost: 0.7, goal: 0.6, roll: 1.3, fade: 0.25, point: 0.4, segment: 0.45,
+});
+
+/** The faces a measure page draws in: the deck's, and the manifest's display and condensed faces when it names them. */
+export const INSTRUMENT_FONTS = Object.freeze({ display: "MeasureDisplay", condensed: "MeasureCond" });
+
+const fontStack = (fonts, which) =>
+ which === "display"
+ ? `'${fonts.MeasureDisplay ? "MeasureDisplay" : "DeckSansBold"}', sans-serif`
+ : which === "condensed"
+ ? `'${fonts.MeasureCond ? "MeasureCond" : "DeckSans"}', sans-serif`
+ : which === "bold" ? "'DeckSansBold', sans-serif" : "'DeckSans', sans-serif";
+
+/** The palette roles every instrument draws in. */
+function colorsOf(render, dial = resolveDial(render)) {
+ const pal = render.palette ?? {};
+ const bg = pal.bg ?? "#0f1311", fg = pal.fg ?? "#edf0ec";
+ return {
+ bg, fg,
+ muted: pal.muted ?? "#98a29b",
+ accent: pal.accent ?? "#22ab83",
+ amber: pal.amber ?? "#e8a33f",
+ needle: dial?.needle ?? "#ff5a4e",
+ card: mix(bg, fg, 0.05),
+ rule: mix(bg, fg, 0.16),
+ face: mix(bg, fg, 0.07),
+ bezel: mix(bg, fg, 0.2),
+ ink: mix(bg, fg, 0.92),
+ ghost: pal.muted ?? "#98a29b",
+ };
+}
+
+/** The measure, or a sentence why the page cannot draw. */
+function measureOf(schedule, what) {
+ const m = schedule?.measure;
+ if (!m || !Array.isArray(m.state) || !m.scale) throw new Error(`${what}: the schedule has no measure (a measure ledger and render.chrome.deck.measure)`);
+ return m;
+}
+
+/** A whole-cut page's window of the cut (`from`/`duration`, a preview's), or null for the whole cut. */
+function windowOf(schedule, opts, what) {
+ const total = schedule.total;
+ const from = Number(opts.from ?? 0);
+ const dur = opts.duration != null ? r4(Number(opts.duration)) : r4(total - from);
+ if (!(dur > 0)) throw new Error(`${what}: nothing to render from ${from}s of a ${total}s cut`);
+ const windowed = from > 0 || Math.abs(dur - total) > 1e-6;
+ return windowed ? { from: r4(from), dur } : null;
+}
+
+/** The instruments come and go with the deck (a card, the finale): its root `k` on the deck's own visibility. */
+function withDeck(L, schedule, render, k) {
+ L.set(k, { autoAlpha: 1 });
+ for (const v of deckChoreography(schedule, render).visibility) {
+ const [a, b] = v.at;
+ L.add(k, a, Math.max(INSTANT, b - a), { autoAlpha: v.hide ? 0 : 1 }, v.hide ? "power1.in" : "power2.out");
+ }
+}
+
+/** Blocks shown one at a time: block j from `list[j].t` to the next one's. */
+function blocks(L, list, key, { fade = INSTANT, shown = (x) => true } = {}) {
+ list.forEach((x, j) => {
+ const k = `${key}${j}`;
+ // A block from the cut's first instant is up in init: a cue at 0 is at its own start there (opacity 0).
+ if (!shown(x)) { L.set(k, { autoAlpha: 0 }); return; }
+ if (x.t <= 0) L.set(k, { autoAlpha: 1 });
+ else {
+ L.set(k, { autoAlpha: 0 });
+ L.add(k, x.t, fade, { autoAlpha: 1 }, "power1.out");
+ }
+ const next = list[j + 1];
+ if (next) L.add(k, next.t, INSTANT, { autoAlpha: 0 });
+ });
+}
+
+const goalWords = (g) => {
+ if (!g) return "";
+ const loss = Number.isFinite(g.loss) ? Math.abs(g.loss) : null;
+ // A loss goal resolved against its run's start (`base`) reads as both: "GOAL 250 · LOSE 50".
+ const what = Number.isFinite(g.value)
+ ? `GOAL ${fmtWeight(g.value)}${loss !== null && g.base ? ` · LOSE ${fmtWeight(loss)}` : ""}`
+ : loss !== null ? `GOAL: LOSE ${fmtWeight(loss)}` : "GOAL";
+ const when = g.deadline ?? g.due ?? null;
+ return when ? `${what} · ${String(when).toUpperCase()}` : what;
+};
+
+// ---------------------------------------------------------------------------
+// The dial.
+// ---------------------------------------------------------------------------
+
+/**
+ * The dial's face and everything on it, `size` px square at (ox, oy) in the
+ * page: the static face, the ghosts, the wedges, the goal tick, the needles,
+ * the hub and the readout blocks. Shared by the column's dial and the
+ * finale's. Returns its markup and css; its cues are the caller's.
+ */
+function dialParts({ size, ox, oy, scale, cfg, colors, fonts, track, prefix = "" }) {
+ const face = dialFaceSvg({ size, scale, mark: cfg.mark, colors: { ...colors, mark: colors.accent }, labelFont: fontStack(fonts, "condensed") });
+ const { C, R, Rf, u } = face;
+ const px = (v) => Math.round(v * u * 100) / 100;
+ // Small words keep a floor: a corner dial is a third of the column's, and 8 px does not read.
+ const fpx = (v) => Math.max(12, px(v));
+ const layer = (k, inner, cls = "ly") => `<div class="${cls}" data-k="${prefix}${k}"><svg width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">${inner}</svg></div>`;
+ const parts = [];
+ parts.push(`<div class="ly face">${face.svg}</div>`);
+ if (cfg.ghosts) {
+ track.remembered.forEach((g, j) => {
+ parts.push(layer(`g${j}`, `<line x1="${C}" y1="${C - Rf + 6 * u}" x2="${C}" y2="${C - Rf + 46 * u}" stroke="${colors.ghost}" stroke-width="${px(3.5)}" stroke-linecap="round"/>`));
+ });
+ }
+ track.current.forEach((c, j) => {
+ const w = Number.isFinite(c.value) ? wedgeRange(c.value, c.qualifier) : null;
+ if (!w) return;
+ const a0 = dialAngle(w[0], scale), a1 = dialAngle(w[1], scale);
+ if (!(a1 > a0)) return;
+ parts.push(layer(`q${j}`, `<path d="${sectorPath(C, C, Rf - 38 * u, Rf - 4 * u, a0, a1)}" fill="${colors.accent}" fill-opacity="0.5" stroke="${colors.accent}" stroke-width="${px(1.5)}"/>`));
+ });
+ if (cfg.goal) {
+ parts.push(layer("gl", `<polygon points="${C - 11 * u},${C - R - 2 * u} ${C + 11 * u},${C - R - 2 * u} ${C},${C - Rf + 16 * u}" fill="${colors.amber}" stroke="${colors.bg}" stroke-width="${px(2)}"/>`));
+ }
+ if (cfg.ghosts && track.remembered.length) {
+ parts.push(layer("gn", `<line x1="${C}" y1="${C + 22 * u}" x2="${C}" y2="${C - Rf + 66 * u}" stroke="${colors.ghost}" stroke-width="${px(5)}" stroke-linecap="round"/>`));
+ }
+ // The needle: a tapered blade from a counterweight through the hub.
+ parts.push(layer("nd",
+ `<polygon points="${C - 6 * u},${C + 34 * u} ${C + 6 * u},${C + 34 * u} ${C + 1.8 * u},${C - Rf + 30 * u} ${C - 1.8 * u},${C - Rf + 30 * u}" fill="${colors.needle}"/>` +
+ `<circle cx="${C}" cy="${C + 34 * u}" r="${px(9)}" fill="${colors.needle}"/>`));
+ parts.push(`<div class="ly"><svg width="${size}" height="${size}" viewBox="0 0 ${size} ${size}"><circle cx="${C}" cy="${C}" r="${px(16)}" fill="${colors.needle}"/><circle cx="${C}" cy="${C}" r="${px(6)}" fill="${colors.face}"/></svg></div>`);
+ // The as-of labels, each by its ghost, up while it is the latest.
+ if (cfg.ghosts) {
+ track.remembered.forEach((g, j) => {
+ const a = dialAngle(g.value, scale);
+ // Along its ghost, but never down into the readout's words under the hub.
+ const [x, y0] = polar(C, C, Rf * 0.52, a);
+ const y = Math.min(y0, Math.round((C + 30 * u) * 100) / 100);
+ parts.push(`<div class="asof" data-k="${prefix}ga${j}" style="left:${x}px; top:${y}px"><b>${esc(qualifierMark(g.qualifier))}${esc(fmtWeight(g.value))}</b><span>${g.asOf ? `AS OF ${esc(fmtDate(g.asOf))}` : "REMEMBERED"}</span></div>`);
+ });
+ }
+ // The readout under the hub: the words, the weight, the weighing's date, the goal.
+ // Inside the face's open quarter: each line kept within the chord at its height.
+ parts.push(`<div class="rlab" style="top:${C + 72 * u}px">${esc(cfg.label)}</div>`);
+ track.current.forEach((c, j) => {
+ const has = Number.isFinite(c.value);
+ parts.push(`<div class="read" data-k="${prefix}cv${j}" style="top:${C + 86 * u}px"><div class="big">${has ? `${esc(qualifierMark(c.qualifier))}${esc(fmtWeight(c.value))}<i>LB</i>` : "—"}</div>${has && c.date ? `<div class="when" style="top:${78 * u}px">${esc(fmtDate(c.date))}</div>` : ""}</div>`);
+ });
+ if (cfg.goal) {
+ track.goals.forEach((g, j) => {
+ parts.push(`<div class="goalw" data-k="${prefix}gw${j}" style="top:${C + 188 * u}px">${esc(goalWords(g.goal))}</div>`);
+ });
+ }
+ const css = `
+ .dial { position: absolute; left: ${ox}px; top: ${oy}px; width: ${size}px; height: ${size}px; }
+ .dial .ly { position: absolute; left: 0; top: 0; width: ${size}px; height: ${size}px; transform-origin: ${C}px ${C}px; }
+ .dial .ly svg { display: block; }
+ .dial .asof { position: absolute; transform: translate(-50%, -50%); text-align: center; white-space: nowrap;
+ color: ${colors.ghost}; line-height: 1.05; padding: ${px(3)}px ${px(7)}px; border-radius: ${px(6)}px;
+ background: ${rgba(colors.face, 0.86)}; }
+ .dial .asof b { display: block; font-family: ${fontStack(fonts, "display")}; font-weight: 400; font-size: ${px(24)}px; }
+ .dial .asof span { display: block; font-family: ${fontStack(fonts, "condensed")}; font-size: ${fpx(13)}px; letter-spacing: 0.08em; }
+ .dial .rlab { position: absolute; left: 0; width: ${size}px; text-align: center; font-family: ${fontStack(fonts, "condensed")};
+ font-size: ${fpx(15)}px; letter-spacing: 0.14em; color: ${colors.muted}; }
+ .dial .read { position: absolute; left: 0; width: ${size}px; text-align: center; }
+ .dial .read .big { font-family: ${fontStack(fonts, "display")}; font-size: ${px(72)}px; line-height: ${px(76)}px; color: ${colors.fg};
+ font-variant-numeric: tabular-nums; white-space: nowrap; }
+ .dial .read .big i { font-style: normal; font-family: ${fontStack(fonts, "condensed")}; font-size: ${px(20)}px; letter-spacing: 0.1em;
+ color: ${colors.muted}; margin-left: ${px(6)}px; }
+ .dial .read .when { position: absolute; left: 0; width: ${size}px; font-family: ${fontStack(fonts, "condensed")}; font-size: ${fpx(16)}px;
+ line-height: ${Math.max(15, px(20))}px; letter-spacing: 0.1em; color: ${colors.muted}; }
+ .dial .goalw { position: absolute; left: 0; width: ${size}px; text-align: center; font-family: ${fontStack(fonts, "bold")};
+ font-size: ${fpx(17)}px; line-height: ${Math.max(15, px(20))}px; letter-spacing: 0.05em; color: ${colors.amber}; white-space: nowrap; }`;
+ return { html: `<div class="dial">${parts.join("\n ")}</div>`, css, face };
+}
+
+/** The needle's ease (`deck.dial.motion`): the spring's overshoot and settle, or a plain ease. */
+const needleEase = (cfg, spring = INSTRUMENT_MOTION.needleEase) => (cfg.motion === "ease" ? INSTRUMENT_MOTION.needlePlain : spring);
+
+/** The dial's cues over the cut: the needle on each stated weight, the ghosts, the wedges, the goal, the readout. */
+function dialCues(L, { track, scale, cfg, prefix = "", finale = false }) {
+ const M = INSTRUMENT_MOTION;
+ const a0 = DIAL_SWEEP.a0;
+ const k = (s) => `${prefix}${s}`;
+ // The finale drives its own needle (dialFinaleHtml).
+ if (!finale) L.set(k("nd"), { rotation: a0 });
+ track.current.forEach((c, j) => {
+ if (j > 0 && !finale) L.add(k("nd"), c.t, M.needle, { rotation: Number.isFinite(c.value) ? dialAngle(c.value, scale) : a0 }, needleEase(cfg));
+ // The wedge once the needle is all but there, gone with its state.
+ const w = Number.isFinite(c.value) ? wedgeRange(c.value, c.qualifier) : null;
+ if (w && dialAngle(w[1], scale) > dialAngle(w[0], scale)) {
+ L.set(k(`q${j}`), { autoAlpha: 0 });
+ L.add(k(`q${j}`), c.t + M.needle * 0.6, M.fade, { autoAlpha: 1 }, "power1.out");
+ const next = track.current[j + 1];
+ if (next) L.add(k(`q${j}`), next.t, M.fade * 0.6, { autoAlpha: 0 }, "power1.in");
+ }
+ });
+ blocks(L, track.current, k("cv"));
+ if (cfg.ghosts) {
+ track.remembered.forEach((g, j) => {
+ L.set(k(`g${j}`), { rotation: dialAngle(g.value, scale), autoAlpha: 0 });
+ L.add(k(`g${j}`), g.t, M.fade, { autoAlpha: 0.55 }, "power1.out");
+ });
+ if (track.remembered.length && finale) {
+ // All at once: the long ghost and its words on the last (the finale puts his highest there).
+ const last = track.remembered.length - 1;
+ const g = track.remembered[last];
+ L.set(k("gn"), { rotation: dialAngle(g.value, scale), autoAlpha: 0 });
+ L.add(k("gn"), g.t, M.fade, { autoAlpha: 0.9 }, "power1.out");
+ track.remembered.forEach((_, j) => L.set(k(`ga${j}`), { autoAlpha: 0 }));
+ L.add(k(`ga${last}`), g.t, M.fade, { autoAlpha: 1 }, "power1.out");
+ } else if (track.remembered.length) {
+ L.set(k("gn"), { rotation: dialAngle(track.remembered[0].value, scale), autoAlpha: 0 });
+ track.remembered.forEach((g, j) => {
+ if (j === 0) L.add(k("gn"), g.t, M.fade, { autoAlpha: 0.9 }, "power1.out");
+ else L.add(k("gn"), g.t, M.ghost, { rotation: dialAngle(g.value, scale) }, "power2.inOut");
+ });
+ blocks(L, track.remembered, k("ga"), { fade: M.fade });
+ }
+ }
+ if (cfg.goal) {
+ // A goal off the face (a loss resolved below the scale's foot: "lose 100" from 240) has no tick --
+ // pinned at the foot it would say a weight he never named. Its words stay under the digits.
+ const onFace = (v) => Number.isFinite(v) && v >= scale.min && v <= scale.max;
+ const first = track.goals.find((g) => onFace(g.goal?.value));
+ L.set(k("gl"), { rotation: first ? dialAngle(first.goal.value, scale) : a0, autoAlpha: 0 });
+ let up = false;
+ for (const g of track.goals) {
+ const v = g.goal?.value;
+ if (onFace(v)) {
+ if (!up) {
+ L.add(k("gl"), g.t, INSTANT, { rotation: dialAngle(v, scale) });
+ L.add(k("gl"), g.t, M.fade, { autoAlpha: 1 }, "power1.out");
+ } else L.add(k("gl"), g.t, M.goal, { rotation: dialAngle(v, scale) }, "power2.inOut");
+ up = true;
+ } else if (up) {
+ L.add(k("gl"), g.t, M.fade, { autoAlpha: 0 }, "power1.in");
+ up = false;
+ }
+ }
+ blocks(L, track.goals, k("gw"), { shown: (g) => !!g.goal });
+ }
+}
+
+/**
+ * The dial's page for the whole cut (or a window of it, `from`/`duration`).
+ * `fonts` = asset-relative paths by face name (DeckSans, DeckSansBold, and
+ * MeasureDisplay / MeasureCond when the manifest names them).
+ */
+export function dialHtml(schedule, render, opts = {}) {
+ const M = measureOf(schedule, "dial");
+ const cfg = resolveDial(render) ?? resolveDial({ chrome: { deck: { dial: true } } });
+ const geo = instrumentsGeometry(render).dial ?? instrumentsGeometry({ ...render, chrome: { ...render.chrome, deck: { ...render.chrome?.deck, dial: true } } }).dial;
+ const W = geo.width, H = geo.height;
+ const fps = schedule.fps ?? render.fps ?? 30;
+ const fonts = opts.fonts ?? {};
+ const colors = colorsOf(render, cfg);
+ const track = measureTrack(M);
+ const size = even(Math.min(W, H));
+ const parts = dialParts({ size, ox: Math.floor((W - size) / 2), oy: Math.floor((H - size) / 2), scale: M.scale, cfg, colors, fonts, track });
+ const L = cueList(fps);
+ withDeck(L, schedule, render, "rt");
+ dialCues(L, { track, scale: M.scale, cfg });
+ const { init, cues } = L.build();
+ return pageHtml({
+ id: "dial", W, H, fps, fonts, gsap: opts.gsap,
+ data: { total: r4(schedule.total), window: windowOf(schedule, opts, "dial"), init, cues },
+ css: `#rt { position: absolute; inset: 0; }${parts.css}`,
+ body: `<div id="rt" data-k="rt">${parts.html}</div>`,
+ });
+}
+
+// ---------------------------------------------------------------------------
+// The odometer.
+// ---------------------------------------------------------------------------
+
+/** The odometer's wheels and words, in a box `W`x`H`, scale `u` (1 at its column size). */
+function odometerParts({ W, H, u, cfg, colors, fonts, track, wheels, netList, prefix = "", big = false }) {
+ const px = (v) => Math.round(v * u * 100) / 100;
+ const wh = px(big ? 104 : 72), ww = px(big ? 74 : 52), gap = px(5);
+ const parts = [];
+ const strip = (i) => `<div class="wheel${i === wheels ? " tenth" : ""}"><div class="strip" data-k="${prefix}w${i}">${wheelStrip()}</div></div>`;
+ const ws = [];
+ for (let i = 0; i <= wheels; i += 1) {
+ if (i === wheels) ws.push(`<div class="dot"></div>`);
+ ws.push(strip(i));
+ }
+ const left = `<div class="lft"><div class="lab">${esc(cfg.label)}</div><div class="wheels">${ws.join("")}</div>${cfg.runs ? track.lost.map((x, j) => `<div class="runs" data-k="${prefix}rn${j}">${x.runs ? `ACROSS ${x.runs} RUN${x.runs === 1 ? "" : "S"}` : ""}</div>`).join("") : ""}</div>`;
+ parts.push(left);
+ if (cfg.net) {
+ const nets = netList.map((n, j) => {
+ const f = n.net?.from, to = n.net?.to;
+ const fv = typeof f === "number" ? f : f?.value, tv = typeof to === "number" ? to : to?.value;
+ const value = Number.isFinite(fv) && Number.isFinite(tv) ? fmtSigned(tv - fv) : "—";
+ const sub = Number.isFinite(fv) ? `${fmtWeight(fv)} → ${Number.isFinite(tv) ? fmtWeight(tv) : "?"}` : "";
+ return `<div class="net" data-k="${prefix}nt${j}"><div class="val">${esc(value)}</div><div class="sub">${esc(sub)}</div></div>`;
+ }).join("");
+ parts.push(`<div class="rgt" data-k="${prefix}net"><div class="lab">NET</div>${nets}</div>`);
+ }
+ const lw = cfg.net ? (big ? Math.round(W) : Math.round(W * 0.56)) : W;
+ const css = `
+ .odo { position: absolute; inset: 0; ${big ? "" : `border-radius: ${px(10)}px; background: ${colors.card};`} }
+ .odo .lft { position: absolute; left: ${big ? 0 : px(20)}px; top: ${big ? 0 : px(12)}px; width: ${lw - (big ? 0 : px(20))}px; }
+ .odo .lab { font-family: ${fontStack(fonts, "condensed")}; font-size: ${px(big ? 22 : 15)}px; letter-spacing: 0.12em; color: ${colors.muted};
+ white-space: nowrap; }
+ .odo .wheels { display: flex; align-items: flex-end; gap: ${gap}px; margin-top: ${px(big ? 10 : 7)}px; }
+ .odo .wheel { position: relative; width: ${ww}px; height: ${wh}px; overflow: hidden; border-radius: ${px(5)}px; background: ${colors.fg};
+ box-shadow: inset 0 ${px(8)}px ${px(10)}px rgba(0,0,0,0.28), inset 0 -${px(8)}px ${px(10)}px rgba(0,0,0,0.28); }
+ .odo .wheel.tenth { background: ${colors.needle}; }
+ .odo .strip { position: absolute; left: 0; top: 0; width: ${ww}px; }
+ .odo .dg { height: ${wh}px; line-height: ${wh}px; text-align: center; font-family: ${fontStack(fonts, "display")};
+ font-size: ${px(big ? 86 : 60)}px; color: ${colors.bg}; font-variant-numeric: tabular-nums; }
+ .odo .wheel.tenth .dg { color: #ffffff; }
+ .odo .dot { width: ${px(big ? 12 : 8)}px; height: ${px(big ? 12 : 8)}px; border-radius: 50%; background: ${colors.fg}; margin: 0 ${px(2)}px ${px(big ? 10 : 8)}px; }
+ .odo .runs { position: absolute; left: 0; top: ${px(big ? 152 : 104)}px; font-family: ${fontStack(fonts, "condensed")};
+ font-size: ${px(big ? 20 : 14)}px; letter-spacing: 0.12em; color: ${colors.muted}; white-space: nowrap; }
+ .odo .rgt { position: absolute; ${big ? `left: 0; top: ${px(210)}px;` : `left: ${Math.round(W * 0.6)}px; top: ${px(12)}px; border-left: ${px(2)}px solid ${colors.rule}; padding-left: ${px(18)}px; height: ${H - px(24)}px;`} right: ${big ? 0 : px(14)}px; }
+ .odo .net { position: absolute; left: ${big ? 0 : px(18)}px; top: ${px(big ? 28 : 22)}px; white-space: nowrap; }
+ .odo .net .val { font-family: ${fontStack(fonts, "display")}; font-size: ${px(big ? 96 : 58)}px; line-height: 1; color: ${colors.fg};
+ font-variant-numeric: tabular-nums; }
+ .odo .net .sub { font-family: ${fontStack(fonts, "condensed")}; font-size: ${px(big ? 24 : 17)}px; letter-spacing: 0.08em; color: ${colors.muted};
+ margin-top: ${px(big ? 6 : 4)}px; font-variant-numeric: tabular-nums; }`;
+ return { html: `<div class="odo">${parts.join("")}</div>`, css, wh };
+}
+
+/** The wheels rolled from `a` to `b` at `t` over `dur`, each settled back to its digit after. */
+function rollCues(L, { a, b, t, dur, wheels, wh, prefix = "", ease = "power2.inOut" }) {
+ wheelRoll(a, b, wheels).forEach((w, i) => {
+ if (w.to === w.from) return;
+ const k = `${prefix}w${i}`;
+ L.add(k, t, dur, { y: -w.to * wh }, ease);
+ if (w.settle !== null) L.add(k, t + dur, INSTANT, { y: -w.settle * wh });
+ });
+}
+
+/** The odometer's page for the whole cut (or a window of it). */
+export function odometerHtml(schedule, render, opts = {}) {
+ const M = measureOf(schedule, "odometer");
+ const cfg = resolveOdometer(render) ?? resolveOdometer({ chrome: { deck: { odometer: true } } });
+ const geo = instrumentsGeometry(render).odometer ?? instrumentsGeometry({ ...render, chrome: { ...render.chrome, deck: { ...render.chrome?.deck, odometer: true } } }).odometer;
+ const W = geo.width, H = geo.height;
+ const u = W / 600;
+ const fps = schedule.fps ?? render.fps ?? 30;
+ const fonts = opts.fonts ?? {};
+ const colors = colorsOf(render);
+ const track = measureTrack(M);
+ const top = Math.max(Number(M.totals?.lost) || 0, ...track.lost.map((x) => x.total));
+ const wheels = wheelCount(top);
+ const parts = odometerParts({ W, H, u, cfg, colors, fonts, track, wheels, netList: track.net });
+ const L = cueList(fps);
+ withDeck(L, schedule, render, "rt");
+ for (let i = 0; i <= wheels; i += 1) L.set(`w${i}`, { y: 0 });
+ track.lost.forEach((x, j) => {
+ if (j === 0) {
+ if (x.total > 0) rollCues(L, { a: 0, b: x.total, t: 0, dur: INSTANT, wheels, wh: parts.wh });
+ return;
+ }
+ const prev = track.lost[j - 1].total;
+ if (x.total > prev + 1e-9) rollCues(L, { a: prev, b: x.total, t: x.t, dur: INSTRUMENT_MOTION.roll, wheels, wh: parts.wh });
+ });
+ if (cfg.runs) blocks(L, track.lost, "rn");
+ if (cfg.net) blocks(L, track.net, "nt");
+ const { init, cues } = L.build();
+ return pageHtml({
+ id: "odometer", W, H, fps, fonts, gsap: opts.gsap,
+ data: { total: r4(schedule.total), window: windowOf(schedule, opts, "odometer"), init, cues },
+ css: `#rt { position: absolute; inset: 0; }${parts.css}`,
+ body: `<div id="rt" data-k="rt">${parts.html}</div>`,
+ });
+}
+
+// ---------------------------------------------------------------------------
+// The trail.
+// ---------------------------------------------------------------------------
+
+/** The trail's page for the whole cut (or a window of it). */
+export function trailHtml(schedule, render, opts = {}) {
+ const M = measureOf(schedule, "trail");
+ const cfg = resolveTrail(render) ?? resolveTrail({ chrome: { deck: { trail: true } } });
+ const geo = instrumentsGeometry(render).trail ?? instrumentsGeometry({ ...render, chrome: { ...render.chrome, deck: { ...render.chrome?.deck, trail: true } } }).trail;
+ const W = geo.width, H = geo.height;
+ const u = W / 600;
+ const px = (v) => Math.round(v * u * 100) / 100;
+ const fps = schedule.fps ?? render.fps ?? 30;
+ const fonts = opts.fonts ?? {};
+ const colors = colorsOf(render);
+ const track = measureTrack(M);
+ const mark = Number.isFinite(cfg.mark) ? cfg.mark : null;
+ // By date: each stated weight at the day it was weighed, in date order.
+ const pts = track.stated
+ .map((p, n) => ({ ...p, day: dayNumber(p.date), n }))
+ .filter((p) => Number.isFinite(p.day))
+ .sort((a, b) => a.day - b.day || a.n - b.n);
+ const x0 = px(54), x1 = W - px(18), y0 = px(38), y1 = H - px(26);
+ let d0 = pts.length ? pts[0].day : 0, d1 = pts.length ? pts[pts.length - 1].day : 1;
+ if (d1 - d0 < 60) { d0 -= 30; d1 += 30; }
+ const vals = pts.map((p) => p.value).concat(mark !== null ? [mark] : []);
+ const lo = vals.length ? Math.floor((Math.min(...vals) - 5) / 10) * 10 : M.scale.min;
+ const hi = vals.length ? Math.ceil((Math.max(...vals) + 5) / 10) * 10 : M.scale.max;
+ const X = (d) => r4(x0 + ((d - d0) / (d1 - d0)) * (x1 - x0));
+ const Y = (v) => r4(y1 - ((v - lo) / Math.max(1, hi - lo)) * (y1 - y0));
+ const parts = [];
+ // The years along the foot.
+ const yearOf = (d) => new Date(d * 86400000).getUTCFullYear();
+ for (let yr = yearOf(d0) + 1; yr <= yearOf(d1); yr += 1) {
+ const x = X(Date.UTC(yr, 0, 1) / 86400000);
+ parts.push(`<div class="yr" style="left:${x}px; top:${y1 + px(4)}px">${yr}</div><div class="ytick" style="left:${x}px; top:${y0}px; height:${y1 - y0}px"></div>`);
+ }
+ if (mark !== null && mark >= lo && mark <= hi) {
+ parts.push(`<div class="mark" style="left:${x0}px; top:${Y(mark)}px; width:${x1 - x0}px"></div><div class="marklab" style="left:${px(12)}px; top:${Y(mark)}px">${mark}</div>`);
+ }
+ parts.push(`<div class="lohi" style="left:${px(12)}px; top:${y0}px">${hi}</div><div class="lohi" style="left:${px(12)}px; top:${y1}px">${lo}</div>`);
+ const L = cueList(fps);
+ withDeck(L, schedule, render, "rt");
+ const M2 = INSTRUMENT_MOTION;
+ // The line: each pair of neighbours by date, drawn once both have been said.
+ for (let j = 0; j + 1 < pts.length; j += 1) {
+ const a = pts[j], b = pts[j + 1];
+ const xa = X(a.day), ya = Y(a.value), xb = X(b.day), yb = Y(b.value);
+ const len = r4(Math.hypot(xb - xa, yb - ya));
+ const ang = r4((Math.atan2(yb - ya, xb - xa) * 180) / Math.PI);
+ parts.push(`<div class="seg" data-k="s${j}" style="left:${xa}px; top:${ya}px; width:${len}px"></div>`);
+ L.set(`s${j}`, { rotation: ang, scaleX: 0, transformOrigin: "0% 50%" });
+ L.add(`s${j}`, Math.max(a.t, b.t), M2.segment, { scaleX: 1 }, "power2.out");
+ }
+ pts.forEach((p, j) => {
+ parts.push(`<div class="pt${p.qualifier ? " q" : ""}" data-k="p${j}" style="left:${X(p.day)}px; top:${Y(p.value)}px"></div>`);
+ L.set(`p${j}`, { autoAlpha: 0, scale: 0.3 });
+ L.add(`p${j}`, p.t, M2.point, { autoAlpha: 1, scale: 1 }, "back.out(2)");
+ });
+ // The latest said, ringed in the needle's red: it travels to each as it lands.
+ if (pts.length) {
+ parts.push(`<div class="ring" data-k="pl"></div>`);
+ const inCut = [...pts].sort((a, b) => a.t - b.t || a.n - b.n);
+ L.set("pl", { x: X(inCut[0].day), y: Y(inCut[0].value), autoAlpha: 0 });
+ inCut.forEach((p, j) => {
+ if (j === 0) L.add("pl", p.t, M2.point, { autoAlpha: 1 }, "power1.out");
+ else L.add("pl", p.t, M2.point, { x: X(p.day), y: Y(p.value) }, "power2.inOut");
+ });
+ }
+ // How many times he says he is under 300, counted as each lands.
+ const counts = cfg.count && mark === 300 ? track.under.slice().sort((a, b) => a.t - b.t).map((x, n) => ({ t: x.t, n: n + 1 })) : [];
+ counts.forEach((c) => parts.push(`<div class="cnt" data-k="uc${c.n - 1}">UNDER ${mark} · SAID ${c.n}×</div>`));
+ if (counts.length) blocks(L, counts, "uc");
+ const { init, cues } = L.build();
+ const css = `
+ #rt { position: absolute; inset: 0; }
+ .trail { position: absolute; inset: 0; border-radius: ${px(10)}px; background: ${colors.card}; }
+ .trail .lab { position: absolute; left: ${px(14)}px; top: ${px(10)}px; font-family: ${fontStack(fonts, "condensed")}; font-size: ${px(14)}px;
+ letter-spacing: 0.12em; color: ${colors.muted}; white-space: nowrap; }
+ .trail .cnt { position: absolute; right: ${px(16)}px; top: ${px(9)}px; font-family: ${fontStack(fonts, "bold")}; font-size: ${px(15)}px;
+ letter-spacing: 0.06em; color: ${colors.accent}; white-space: nowrap; }
+ .trail .yr { position: absolute; transform: translateX(-50%); font-family: ${fontStack(fonts, "condensed")}; font-size: ${px(13)}px;
+ color: ${colors.muted}; letter-spacing: 0.06em; }
+ .trail .ytick { position: absolute; width: 1px; background: ${colors.rule}; }
+ .trail .mark { position: absolute; height: 0; border-top: ${px(2)}px dashed ${rgba(colors.accent, 0.75)}; }
+ .trail .marklab, .trail .lohi { position: absolute; transform: translateY(-50%); font-family: ${fontStack(fonts, "condensed")};
+ font-size: ${px(13)}px; color: ${colors.muted}; }
+ .trail .marklab { color: ${colors.accent}; font-family: ${fontStack(fonts, "bold")}; }
+ .trail .seg { position: absolute; height: ${px(2.6)}px; margin-top: -${px(1.3)}px; background: ${colors.accent}; border-radius: ${px(2)}px; }
+ .trail .pt { position: absolute; width: ${px(10)}px; height: ${px(10)}px; margin: -${px(5)}px 0 0 -${px(5)}px; border-radius: 50%;
+ background: ${colors.accent}; border: ${px(2)}px solid ${colors.card}; }
+ .trail .pt.q { background: ${colors.card}; border: ${px(2.4)}px solid ${colors.accent}; }
+ .trail .ring { position: absolute; left: 0; top: 0; width: ${px(20)}px; height: ${px(20)}px; margin: -${px(10)}px 0 0 -${px(10)}px;
+ border-radius: 50%; border: ${px(3)}px solid ${colors.needle}; }`;
+ return pageHtml({
+ id: "trail", W, H, fps, fonts, gsap: opts.gsap,
+ data: { total: r4(schedule.total), window: windowOf(schedule, opts, "trail"), init, cues },
+ css,
+ body: `<div id="rt" data-k="rt"><div class="trail"><div class="lab">${esc(cfg.label)}</div>${parts.join("")}</div></div>`,
+ });
+}
+
+// ---------------------------------------------------------------------------
+// The dial's finale.
+// ---------------------------------------------------------------------------
+
+/**
+ * Where the dial's finale stands (frame px): the finale's lower column
+ * (finale.mjs finaleGeometry `column`), under its totals when it draws them --
+ * or null when that leaves no room (stats cards fill it, or under 260 px).
+ */
+export function dialFinaleGeometry(schedule, render) {
+ if (!schedule?.finale) return null;
+ const g = finaleLayout(schedule, render).geo;
+ if (g.stats) return null;
+ const kh = g.H / 1080;
+ const y = g.totals ? g.totals.y + g.totals.height + Math.round(28 * kh) : g.column.y;
+ const h = g.column.y + g.column.height - y;
+ if (h < 260 * kh || g.column.width < 520 * g.k) return null;
+ return { x: g.column.x, y, width: even(g.column.width), height: even(h) };
+}
+
+/** What the finale ends on: the last stated weight, the odometer's total, NET -- the whole record's (`totals`), else the cut's last. */
+export function finaleNumbers(measure) {
+ const track = measureTrack(measure);
+ const T = measure?.totals ?? {};
+ const n = T.net ?? {};
+ const val = (x) => (typeof x === "number" ? x : x?.value);
+ const lastCur = [...track.current].reverse().find((c) => Number.isFinite(c.value)) ?? null;
+ const lastNet = track.net[track.net.length - 1]?.net ?? null;
+ const from = Number.isFinite(val(n.from)) ? val(n.from) : val(lastNet?.from);
+ const to = Number.isFinite(val(n.to)) ? val(n.to) : Number.isFinite(val(lastNet?.to)) ? val(lastNet.to) : lastCur?.value;
+ const lost = Number.isFinite(T.lost) ? T.lost : track.lost[track.lost.length - 1]?.total ?? 0;
+ const runs = Number.isFinite(T.runs) ? T.runs : track.lost[track.lost.length - 1]?.runs ?? 0;
+ const peaks = (Array.isArray(T.peakDrift) ? T.peakDrift : []).concat(track.remembered.map((r) => r.value)).filter(Number.isFinite);
+ return {
+ weight: Number.isFinite(to) ? to : null,
+ qualifier: lastCur && lastCur.value === to ? lastCur.qualifier : null,
+ lost, runs, from: Number.isFinite(from) ? from : null,
+ peak: peaks.length ? Math.max(...peaks) : null,
+ goal: [...track.goals].reverse().find((g) => g.goal)?.goal ?? null,
+ };
+}
+
+/** The handoff to the promise clock: NET's beat (in at the grow + 3.2 s) held `hold` s, then a `fade`. */
+export const FINALE_HANDOFF = Object.freeze({ net: 3.2, hold: 2.3, fade: 0.5 });
+
+/**
+ * When the dial's finale hands the finale's lower column to the promise clock
+ * (cut seconds) -- `deck.dial.finaleEnd: "promise"` -- or null: it ends on the
+ * odometer, or the finale is too short to hold NET first. The promise module
+ * (measure-extras) reads it to come in as the instruments go. Whether a
+ * promise module is on the cut is the caller's to say (the dial-finale
+ * module's page asks the registry).
+ */
+export function dialFinaleHandoff(schedule, render) {
+ const fin = schedule?.finale;
+ if (!fin || resolveDial(render)?.finaleEnd !== "promise") return null;
+ // On the cue grid, so the promise clock's cue and the instruments' land on the same frame.
+ const at = cueTime(fin.from + FINALE_MOTION.grow + FINALE_HANDOFF.net + 0.5 + FINALE_HANDOFF.hold, schedule.fps ?? render.fps ?? 30);
+ return at + FINALE_HANDOFF.fade < fin.to ? at : null;
+}
+
+/**
+ * The dial's finale page over the finale's `window` (cut seconds; the
+ * finale's own, finale.mjs): the dial large, its needle dropping from his
+ * highest remembered weight to his last stated one; the odometer rolling up
+ * to the record's total; NET holding beside it. In over the finale's grow,
+ * out through its dissolve.
+ */
+export function dialFinaleHtml(schedule, render, window, opts = {}) {
+ const M = measureOf(schedule, "dial-finale");
+ const geo = dialFinaleGeometry(schedule, render);
+ if (!geo) throw new Error("dial-finale: the finale's lower column has no room (its stats cards fill it)");
+ const cfg = resolveDial(render) ?? resolveDial({ chrome: { deck: { dial: true } } });
+ const ocfg = resolveOdometer(render) ?? resolveOdometer({ chrome: { deck: { odometer: true } } });
+ const W = geo.width, H = geo.height;
+ const fps = schedule.fps ?? render.fps ?? 30;
+ const fonts = opts.fonts ?? {};
+ const colors = colorsOf(render, cfg);
+ const from = r4(Number(window.from));
+ const dur = r4(Number(window.to) - from);
+ if (!(dur > 0)) throw new Error("dial-finale: the window is empty");
+ const nums = finaleNumbers(M);
+ const full = measureTrack(M);
+ // The dial's track in the finale: every ghost already there, one state of the needle, the latest goal.
+ const A = from + FINALE_MOTION.grow;
+ // His highest remembered weight last, so the long ghost stands on it.
+ const rem = full.remembered.map((r, n) => ({ ...r, t: A, n }));
+ const peakAt = rem.reduce((b, r, n) => (r.value > rem[b].value ? n : b), 0);
+ const track = {
+ ...full,
+ current: [{ t: from, value: null }, { t: A + 0.4, value: nums.weight, qualifier: nums.qualifier, date: null }],
+ remembered: rem.length ? [...rem.filter((_, n) => n !== peakAt), rem[peakAt]] : [],
+ goals: nums.goal ? [{ t: from, goal: null }, { t: A + 0.4, goal: nums.goal }] : [{ t: from, goal: null }],
+ };
+ const size = even(Math.min(H, Math.round(W * 0.56)));
+ const k = size / 524;
+ const dial = dialParts({ size, ox: 0, oy: Math.floor((H - size) / 2), scale: M.scale, cfg, colors, fonts, track, prefix: "f" });
+ const rw = W - size - Math.round(40 * k);
+ const top = Math.max(Number(M.totals?.lost) || 0, nums.lost);
+ const wheels = wheelCount(top);
+ const ob = { x: size + Math.round(40 * k), y: Math.floor((H - size) / 2) + Math.round(24 * k), width: rw };
+ const odo = odometerParts({
+ W: rw, H: H - ob.y, u: Math.min(1, rw / 420), cfg: { ...ocfg, runs: true }, colors, fonts,
+ track: { lost: [{ t: from, total: 0, runs: 0 }, { t: A + 0.6, total: nums.lost, runs: nums.runs }] }, wheels,
+ netList: [{ t: from, net: null }, { t: A + 3.2, net: nums.from !== null && nums.weight !== null ? { from: nums.from, to: nums.weight } : null }],
+ prefix: "o", big: true,
+ });
+ const L = cueList(fps);
+ L.set("rt", { autoAlpha: 0 });
+ L.add("rt", A, 0.4, { autoAlpha: 1 }, "power2.out");
+ const D = Number(schedule.transition) || 0;
+ // The last beat: the promise clock's (deck.dial.finaleEnd "promise", a promise module on the cut) --
+ // the instruments go at the handoff and leave it the column -- else theirs, out through the dissolve.
+ const handoff = opts.promise ? dialFinaleHandoff(schedule, render) : null;
+ if (handoff !== null) L.add("rt", handoff, FINALE_HANDOFF.fade, { autoAlpha: 0 }, "power1.in");
+ else if (D > 0 && from + dur - D > A + 0.4) L.add("rt", from + dur - D, D, { autoAlpha: 0 }, "power1.in");
+ // The needle starts at his highest remembered weight (the scale's top without one) and drops.
+ const start = Number.isFinite(nums.peak) ? nums.peak : M.scale.max;
+ dialCues(L, { track, scale: M.scale, cfg, prefix: "f", finale: true });
+ L.set("fnd", { rotation: dialAngle(start, M.scale) });
+ if (Number.isFinite(nums.weight)) L.add("fnd", A + 0.4, 1.8, { rotation: dialAngle(nums.weight, M.scale) }, needleEase(cfg, "back.out(1.4)"));
+ for (let i = 0; i <= wheels; i += 1) L.set(`ow${i}`, { y: 0 });
+ rollCues(L, { a: 0, b: nums.lost, t: A + 0.6, dur: 2.6, wheels, wh: odo.wh, prefix: "o", ease: "power3.out" });
+ blocks(L, [{ t: from, runs: 0 }, { t: A + 0.6 + 2.6, runs: nums.runs }], "orn", { fade: 0.3, shown: (x) => x.runs > 0 });
+ blocks(L, [{ t: from }, { t: A + 3.2 }], "ont", { fade: 0.5, shown: (x) => x.t > from });
+ // NET comes in whole, its word with its number.
+ L.set("onet", { autoAlpha: 0 });
+ L.add("onet", A + 3.2, 0.5, { autoAlpha: 1 }, "power1.out");
+ const { init, cues } = L.build();
+ return pageHtml({
+ id: "dial-finale", W, H, fps, fonts, gsap: opts.gsap,
+ data: { from, dur, init, cues },
+ css: `#rt { position: absolute; inset: 0; }${dial.css}
+ .ob { position: absolute; left: ${ob.x}px; top: ${ob.y}px; width: ${ob.width}px; height: ${H - ob.y}px; }${odo.css}`,
+ body: `<div id="rt" data-k="rt">${dial.html}<div class="ob">${odo.html}</div></div>`,
+ });
+}
+
+export { railGap };
diff --git a/umtool/report-to-video/deck.mjs b/umtool/report-to-video/deck.mjs
@@ -29,6 +29,7 @@ import {
claimOf, marksOf, originalUrlAt, resolveFactcheck, roundStamps, stampSchedule, stampsWithFinale, tallyOf, tallyVerdicts, validateFactcheck,
} from "./factcheck.mjs";
import { resolveCounter } from "./counter.mjs";
+import { INSTRUMENT_COLUMN, instrumentsOn, instrumentsPlacement, instrumentsWanted, resolveDial } from "./instruments.mjs";
import { TRAILER_HIT_TIERS, TRAILER_SWELL } from "./trailer-hits.mjs";
import { DECK_PAD_X, COUNTER_CELL } from "./modules/design.mjs";
import {
@@ -116,6 +117,9 @@ export function resolveDeck(render) {
if (sh !== undefined && sh !== null) {
merged.posts = { ...merged.posts, shift: sh === false ? false : { ...DECK_DEFAULTS.posts.shift, ...sh } };
}
+ // The instruments' column (instruments.mjs) takes the frame's right side:
+ // the posts stay in the footage box, and nothing moves them over it.
+ if (instrumentsOn(render)) merged.posts = { ...merged.posts, shift: false };
return merged;
}
@@ -178,7 +182,8 @@ export function validateChrome(chrome, render = {}) {
// `sectionTitle` (section-title.mjs: the current section's name).
// So are `measure` (measure-slice.mjs: the measure ledger's slice for the
// instruments) and the measure extras' (`goals`, `peak`, `promise`,
- // `diet`, `streak`: measure-extras-settings.mjs) -- every deck key a
+ // `diet`, `streak`: measure-extras-settings.mjs) and the instruments' (`dial`,
+ // `odometer`, `trail`: instruments.mjs) -- every deck key a
// SETTINGS entry owns.
const owned = SETTINGS.filter((s) => s.deck && !s.whole).map((s) => s.key.slice("deck.".length));
unknownKeys(d, [...new Set([...Object.keys(DECK_DEFAULTS), "finale", "claims", "counter", "rail", "sectionTitle", "measure", ...owned])], w, errors);
@@ -196,6 +201,16 @@ export function validateChrome(chrome, render = {}) {
// sees the posts.
if (d.posts !== undefined && resolveDeck({ chrome }).posts.show) errors.push(...postsFitErrors({ ...render, chrome }));
const room = g.H - g.deck.height;
+ // The instruments take the frame's right side (instrumentsGeometry): the
+ // side panel would take the left and move the footage into them, and the
+ // feed is a column of its own.
+ const instruments = instrumentsWanted({ chrome });
+ if (instruments.length) {
+ const names = instruments.map((n) => `${w}.${n}`).join(", ");
+ // In the corner (deck.dial.placement) they stand in the footage: only the feed, which reframes it, is refused.
+ if (railOn({ chrome }) && instrumentsOn({ chrome })) errors.push(`${threadsOn({ chrome }) ? "render.chrome.threads" : "render.chrome.flips"} and ${names} both need the frame beside the footage: set one`);
+ if (resolveDeck({ chrome }).posts.layout === "feed") errors.push(`${names} need the popup posts, not the feed (${w}.posts.layout)`);
+ }
if (railOn({ chrome })) {
const which = threadsOn({ chrome }) ? "render.chrome.threads" : "render.chrome.flips";
if (resolveDeck({ chrome }).posts.layout === "feed") errors.push(`${which} needs the popup posts, not the feed`);
@@ -435,9 +450,14 @@ export function deckGeometry(render) {
// A two-line subtitle grows the band by its head line (subtitleBoxes):
// the footage box stands on the band's top edge wherever that is.
const dh = deck.height + subtitleBoxes(deck).extra;
- const fw = even(W * deck.footageScale);
+ // The instruments' column (instruments.mjs) takes the right: the footage
+ // gives it room and stands at the left edge, `railGap` in.
+ const inst = instrumentsOn(render);
+ const fw = inst
+ ? Math.min(even(W * deck.footageScale), even(W - INSTRUMENT_COLUMN * (W / 1920) - 3 * railGap(render)))
+ : even(W * deck.footageScale);
const fh = even((fw * H) / W);
- const fx = railOn(render) ? W - fw - railGap(render) : Math.floor((W - fw) / 2);
+ const fx = inst ? railGap(render) : railOn(render) ? W - fw - railGap(render) : Math.floor((W - fw) / 2);
return {
W, H,
footage: { x: fx, y: Math.floor((H - dh - fh) / 2), width: fw, height: fh },
@@ -464,6 +484,74 @@ export function threadsGeometry(render) {
};
}
+/**
+ * The instruments' column (instruments.mjs) and each instrument's region in it,
+ * frame px: from the footage's right edge `railGap` over to `railGap` short of
+ * the frame's, from `railGap` under the top to `railGap` over the deck. The
+ * instruments that are on stack in it top-down -- the dial, the odometer, the
+ * trail -- the odometer and the trail at their own heights, the dial taking
+ * what is left (a square face at most). An instrument that is off is null.
+ * At 1920x1080 with all three: footage 1248x702 at (24, 94), the column
+ * 600x842 at (1296, 24), the dial 600x540, the odometer 600x140, the trail
+ * 600x138.
+ *
+ * @returns {{ column: {x:number,y:number,width:number,height:number},
+ * dial: {x:number,y:number,width:number,height:number}|null,
+ * odometer: {x:number,y:number,width:number,height:number}|null,
+ * trail: {x:number,y:number,width:number,height:number}|null }}
+ */
+export function instrumentsGeometry(render) {
+ const { W, deck, footage } = deckGeometry(render);
+ const k = W / 1920;
+ const gap = railGap(render);
+ if (instrumentsPlacement(render) === "corner") return instrumentsCorner(render, { k, footage });
+ const x = footage.x + footage.width + gap;
+ const column = { x, y: gap, width: W - gap - x, height: deck.y - 2 * gap };
+ const on = instrumentsWanted(render);
+ const between = Math.round(12 * k);
+ const fixed = { odometer: Math.round(140 * k), trail: Math.round(138 * k) };
+ const out = { column, dial: null, odometer: null, trail: null };
+ const rest = column.height - on.filter((n) => n !== "dial").reduce((a, n) => a + fixed[n], 0) - between * (on.length - 1);
+ let y = column.y;
+ for (const n of on) {
+ const h = n === "dial" ? even(Math.max(0, Math.min(rest, column.width))) : fixed[n];
+ out[n] = { x: column.x, y, width: column.width, height: h };
+ y += h + between;
+ }
+ return out;
+}
+
+/**
+ * The instruments in the CORNER (`deck.dial.placement: "corner"`): over the
+ * footage box where the deck puts it, `inset` in from its edges -- the dial a
+ * `size` square in the `corner` (default the lower right), the odometer and
+ * the trail at four fifths of their column size stacked beside it toward the
+ * middle of the same side (the odometer next to the dial), all on that edge.
+ * `column` is the footage box they stand in.
+ */
+function instrumentsCorner(render, { k, footage: f }) {
+ const on = new Set(instrumentsWanted(render));
+ const dial = resolveDial(render);
+ const [v, h] = (dial?.corner ?? "bottom-right").split("-");
+ const inset = Math.round(28 * k);
+ const size = even(Math.min((dial?.size ?? 340) * k, f.height - 2 * inset, f.width / 2));
+ const ow = even(480 * k), oh = even(112 * k), th = even(110 * k), between = Math.round(10 * k);
+ const out = { column: { ...f }, dial: null, odometer: null, trail: null };
+ const xAt = (w) => (h === "right" ? f.x + f.width - inset - w : f.x + inset);
+ // Down the side from the corner: each box after the one before, toward the middle.
+ const bottom = v === "bottom";
+ let edge = bottom ? f.y + f.height - inset : f.y + inset;
+ const place = (w, ht) => {
+ const y = bottom ? edge - ht : edge;
+ edge = bottom ? y - between : y + ht + between;
+ return { x: xAt(w), y, width: w, height: ht };
+ };
+ if (on.has("dial")) out.dial = place(size, size);
+ if (on.has("odometer")) out.odometer = place(ow, oh);
+ if (on.has("trail")) out.trail = place(ow, th);
+ return out;
+}
+
/** The air the band keeps under its text block, px. */
export const BAND_FOOT = 0;
/** In a crowded band, the share of the width the title and byline keep at the left (the section title stays out of it). */
diff --git a/umtool/report-to-video/fixtures/measure-dial/make.mjs b/umtool/report-to-video/fixtures/measure-dial/make.mjs
@@ -0,0 +1,56 @@
+// The measure-dial fixture (lane scale-dial): a SMALL measure slice for the
+// instruments' tests, stills and e2e, cut from a real slice -- `umtool
+// measure` on a copy of the weight project (the producer's output: real
+// ledger rows, the cut's own seconds):
+//
+// node umtool/report-to-video/fixtures/measure-dial/make.mjs <measure-slice.json>
+//
+// Keeps the rows named in ROWS -- every kind the dial, the odometer and the
+// trail draw: stated weights with and without a qualifier, remembered
+// weights, goals (a loss goal resolved against its run's start), loss claims,
+// the "under 300" claims -- with the state after each, every `t` respread
+// over a 62 s cut (one every 1.75 s from 2 s), the quotes dropped; `totals`
+// as the slice has them (the whole record). Deterministic: the same input
+// writes the same file.
+import { readFileSync, writeFileSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+
+const ROWS = [
+ "w06", "w07", "w18", "w21", "w26", "w27", "w34", "w35", "w51", "w53", "w54", "w55", "w59", "w60", "w61", "w64", "w74",
+ "w75", "w76", "w77", "w78", "w79", "w85", "w86", "w87", "w89", "w93", "w101", "w102", "w107", "w110", "w115", "w116", "w118",
+];
+const STEP = 1.75;
+const FIRST = 2;
+
+const src = process.argv[2];
+if (!src) {
+ console.error("usage: make.mjs <measure-slice.fixture.json>");
+ process.exit(2);
+}
+const M = JSON.parse(readFileSync(src, "utf8"));
+const keep = new Set(ROWS);
+const idx = M.events.map((e, i) => [e, i]).filter(([e]) => keep.has(e.row));
+const missing = ROWS.filter((r) => !idx.some(([e]) => e.row === r));
+if (missing.length) throw new Error(`rows not in the slice: ${missing.join(", ")}`);
+const r2 = (v) => Math.round(v * 100) / 100;
+const slim = (e) => {
+ const { quote: _q, ...rest } = e;
+ return rest;
+};
+const events = idx.map(([e], n) => ({ ...slim(e), t: r2(FIRST + n * STEP) }));
+// The state after each kept event: the slice's state after it (state[i + 1]
+// follows events[i]), its goal ids and promises left out.
+const stateOf = (s, t) => {
+ const { goals: _g, promises: _p, diet: _d, ...rest } = s;
+ return { ...rest, t };
+};
+const state = [stateOf(M.state[0], 0), ...idx.map(([, i], n) => stateOf(M.state[i + 1], events[n].t))];
+const out = {
+ version: M.version, unit: M.unit, scale: M.scale, asOfRender: M.asOfRender, scopes: M.scopes,
+ events, hidden: [], state, totals: M.totals,
+ _fixture: "measure-dial: 34 rows of the weight project's measure slice (umtool measure on a copy, 5 Nov 2026), respread over a 62 s cut. make.mjs writes it.",
+};
+const file = path.join(path.dirname(fileURLToPath(import.meta.url)), "measure.json");
+writeFileSync(file, JSON.stringify(out) + "\n");
+console.log(`${file}: ${events.length} events, ${state.length} states`);
diff --git a/umtool/report-to-video/fixtures/measure-dial/measure.json b/umtool/report-to-video/fixtures/measure-dial/measure.json
@@ -0,0 +1 @@
+{"version":1,"unit":"lb","scale":{"min":220,"max":400},"asOfRender":"2026-11-05","scopes":["weight","regime"],"events":[{"t":2,"tFrom":"cues","segment":"c04","row":"w06","scope":"weight","date":"2021-09-14","asOf":null,"kind":"goalLoss","value":-100,"qualifier":null,"display":"lose 100","label":"needs to lose 100, at the first keto start","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":3.75,"tFrom":"cues","segment":"k09","row":"w07","scope":"weight","date":"2022-06-15","asOf":null,"kind":"stated","value":240,"qualifier":">","display":">240 lb","label":"'over 240' — said while covering an obese-woman story","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":5.5,"tFrom":"cues","segment":"c07","row":"w18","scope":"weight","date":"2023-07-26","asOf":null,"kind":"lost","value":-29,"qualifier":"≈","display":"≈-29","label":"the run stalls at 29","deadline":null,"due":null,"regime":null,"event":null,"run":2,"speaker":null,"outcome":null,"source":"clip"},{"t":7.25,"tFrom":"cues","segment":"c08","row":"w21","scope":"weight","date":"2023-09-29","asOf":"2023-07-01","kind":"remembered","value":390,"qualifier":"≈","display":"≈390 lb","label":"the scale that ruined a vacation","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":9,"tFrom":"cues","segment":"c13","row":"w26","scope":"weight","date":"2024-01-12","asOf":"2023-12-31","kind":"remembered","value":365.7,"qualifier":null,"display":"365.7 lb","label":"365.7 - the most precise number he ever gives","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":10.75,"tFrom":"cues","segment":"k32","row":"w27","scope":"weight","date":"2024-01-12","asOf":null,"kind":"goal","value":250,"qualifier":"≈","display":"≈250","label":"'I look good at like 250'","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":12.5,"tFrom":"cues","segment":"c15","row":"w34","scope":"weight","date":"2024-02-07","asOf":null,"kind":"lost","value":-19.4,"qualifier":null,"display":"-19.4","label":"19.4 - the 2024 run's high-water mark","deadline":null,"due":null,"regime":null,"event":null,"run":3,"speaker":null,"outcome":null,"source":"clip"},{"t":14.25,"tFrom":"cues","segment":"k34","row":"w35","scope":"weight","date":"2024-04-25","asOf":"2008-06-30","kind":"remembered","value":368,"qualifier":null,"display":"368 lb","label":"368 at his wedding","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":16,"tFrom":"cues","segment":"c21","row":"w51","scope":"weight","date":"2025-05-02","asOf":"2025-02-01","kind":"remembered","value":370,"qualifier":null,"display":"370 lb","label":"370 at the start of the 2025 run","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":17.75,"tFrom":"cues","segment":"k48","row":"w53","scope":"weight","date":"2025-06-06","asOf":null,"kind":"lost","value":-12,"qualifier":"≈","display":"≈-12","label":"twelve down, five weeks later","deadline":null,"due":null,"regime":null,"event":null,"run":6,"speaker":null,"outcome":null,"source":"clip"},{"t":19.5,"tFrom":"cues","segment":"k50","row":"w54","scope":"weight","date":"2025-06-06","asOf":null,"kind":"stated","value":300,"qualifier":">","display":">300 lb","label":"'over 300'","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":21.25,"tFrom":"cues","segment":"c22","row":"w55","scope":"weight","date":"2025-07-15","asOf":"2024-07-01","kind":"remembered","value":390,"qualifier":"≈","display":"≈390 lb","label":"390, 'last year'","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":23,"tFrom":"cues","segment":"c24","row":"w59","scope":"weight","date":"2025-08-15","asOf":null,"kind":"stated","value":351,"qualifier":null,"display":"351 lb","label":"351 - the first hard current weight in two years","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":24.75,"tFrom":"quote","segment":"k45","row":"w60","scope":"weight","date":"2025-08-15","asOf":"2025-04-15","kind":"remembered","value":387,"qualifier":null,"display":"387 lb","label":"387, four months earlier","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":26.5,"tFrom":"cues","segment":"k60","row":"w61","scope":"weight","date":"2025-08-15","asOf":"2026-04-01","kind":"goal","value":275,"qualifier":null,"display":"275","label":"275 by his birthday","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":28.25,"tFrom":"cues","segment":"c25","row":"w64","scope":"weight","date":"2025-10-03","asOf":null,"kind":"lost","value":-31,"qualifier":null,"display":"-31","label":"down 31","deadline":null,"due":null,"regime":null,"event":null,"run":6,"speaker":null,"outcome":null,"source":"clip"},{"t":30,"tFrom":"cues","segment":"c30","row":"w74","scope":"weight","date":"2026-01-09","asOf":null,"kind":"stated","value":339,"qualifier":null,"display":"339 lb","label":"339","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":31.75,"tFrom":"quote","segment":"c31","row":"w76","scope":"weight","date":"2026-01-16","asOf":null,"kind":"stated","value":337,"qualifier":null,"display":"337 lb","label":"337 - 'the lowest weight I've been in probably 10 years'","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":33.5,"tFrom":"cues","segment":"c31","row":"w75","scope":"weight","date":"2026-01-16","asOf":null,"kind":"lost","value":-43.7,"qualifier":null,"display":"-43.7","label":"43.7 - the largest loss the archive documents in real time","deadline":null,"due":null,"regime":null,"event":null,"run":7,"speaker":null,"outcome":null,"source":"clip"},{"t":35.25,"tFrom":"cues","segment":"k59","row":"w77","scope":"weight","date":"2026-01-16","asOf":"2026-04-01","kind":"goal","value":320,"qualifier":null,"display":"320","label":"320 by his birthday","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":37,"tFrom":"cues","segment":"k57","row":"w78","scope":"weight","date":"2026-01-16","asOf":null,"kind":"goal","value":240,"qualifier":"≈","display":"≈240","label":"the eventual target","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":38.75,"tFrom":"segment","segment":"k62","row":"w79","scope":"weight","date":"2026-07-05","asOf":null,"kind":"stated","value":300,"qualifier":null,"display":"300 lb","label":"'I carry around 300 lb all day, every day'","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":40.5,"tFrom":"cues","segment":"k65","row":"w85","scope":"weight","date":"2026-07-28","asOf":null,"kind":"goalLoss","value":-50,"qualifier":null,"display":"lose 50","label":"fifty by the end of 2026","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":42.25,"tFrom":"quote","segment":"c35","row":"w86","scope":"weight","date":"2026-07-31","asOf":null,"kind":"lost","value":-11,"qualifier":null,"display":"-11","label":"eleven, eleven days in","deadline":null,"due":null,"regime":null,"event":null,"run":8,"speaker":null,"outcome":null,"source":"clip"},{"t":44,"tFrom":"quote","segment":"c35","row":"w89","scope":"weight","date":"2026-07-31","asOf":"2025-02-01","kind":"remembered","value":390,"qualifier":null,"display":"390 lb","label":"390 on the scale, remembered again","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":45.75,"tFrom":"cues","segment":"c35","row":"w87","scope":"weight","date":"2026-07-31","asOf":null,"kind":"stated","value":338,"qualifier":null,"display":"338 lb","label":"338 - one pound above where January left him","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":47.5,"tFrom":"cues","segment":"c37","row":"w93","scope":"weight","date":"2026-08-03","asOf":null,"kind":"stated","value":335.5,"qualifier":null,"display":"335.5 lb","label":"335.5 this morning","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":49.25,"tFrom":"cues","segment":"c40","row":"w101","scope":"weight","date":"2026-08-25","asOf":null,"kind":"lost","value":-25,"qualifier":"≈","display":"≈-25","label":"\"just under 25\" - after \"that's why I don't take it\"","deadline":null,"due":null,"regime":null,"event":null,"run":8,"speaker":null,"outcome":null,"source":"clip"},{"t":51,"tFrom":"cues","segment":"c41","row":"w102","scope":"weight","date":"2026-08-28","asOf":null,"kind":"stated","value":320,"qualifier":null,"display":"320 lb","label":"320 - \"this is actually bonkers\"","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":52.75,"tFrom":"cues","segment":"c42","row":"w107","scope":"weight","date":"2026-09-15","asOf":null,"kind":"stated","value":300,"qualifier":">","display":">300 lb","label":"\"I haven't been under 300 since college\"","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":54.5,"tFrom":"cues","segment":"c43","row":"w110","scope":"weight","date":"2026-09-24","asOf":null,"kind":"stated","value":310.5,"qualifier":null,"display":"310.5 lb","label":"310.5 - \"the weight loss has slowed\"","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":56.25,"tFrom":"cues","segment":"c44","row":"w115","scope":"weight","date":"2026-10-15","asOf":null,"kind":"stated","value":300,"qualifier":"<","display":"<300 lb","label":"\"under three hundred for the first time since college\" - down 50.1","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":58,"tFrom":"cues","segment":"c45","row":"w116","scope":"weight","date":"2026-10-15","asOf":"2025-02-01","kind":"remembered","value":390,"qualifier":"≈","display":"≈390 lb","label":"\"almost 390 when I started my weight loss journey\"","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"},{"t":59.75,"tFrom":"cues","segment":"c46","row":"w118","scope":"weight","date":"2026-10-26","asOf":"2026-10-23","kind":"stated","value":291.5,"qualifier":null,"display":"291.5 lb","label":"291.5 on Friday - \"a new all time low\" then \"back up\"","deadline":null,"due":null,"regime":null,"event":null,"run":null,"speaker":null,"outcome":null,"source":"clip"}],"hidden":[],"state":[{"t":0,"current":null,"remembered":[],"goal":null,"lost":{"total":0,"runs":[]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":null,"value":null}},{"t":2,"current":null,"remembered":[],"goal":{"value":null,"loss":100,"deadline":null,"due":null,"row":"w06","display":"lose 100","base":null},"lost":{"total":0,"runs":[]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":null,"value":null}},{"t":3.75,"current":{"value":240,"qualifier":">","row":"w07","date":"2022-06-15"},"remembered":[],"goal":{"value":null,"loss":100,"deadline":null,"due":null,"row":"w06","display":"lose 100","base":null},"lost":{"total":0,"runs":[]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":240,"date":"2022-06-15","row":"w07"},"value":-128}},{"t":5.5,"current":{"value":240,"qualifier":">","row":"w07","date":"2022-06-15"},"remembered":[],"goal":{"value":165,"loss":75,"deadline":null,"due":null,"row":"w16","display":"165 lb","base":{"value":240,"row":"w07","from":"stated"}},"lost":{"total":29,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":240,"date":"2022-06-15","row":"w07"},"value":-128}},{"t":7.25,"current":{"value":240,"qualifier":">","row":"w07","date":"2022-06-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"}],"goal":{"value":165,"loss":75,"deadline":null,"due":null,"row":"w19","display":"165 lb","base":{"value":240,"row":"w07","from":"stated"}},"lost":{"total":29,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":240,"date":"2022-06-15","row":"w07"},"value":-128}},{"t":9,"current":{"value":240,"qualifier":">","row":"w07","date":"2022-06-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"}],"goal":{"value":140,"loss":100,"deadline":null,"due":null,"row":"w22","display":"140 lb","base":{"value":240,"row":"w07","from":"stated"}},"lost":{"total":29,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":240,"date":"2022-06-15","row":"w07"},"value":-128}},{"t":10.75,"current":{"value":240,"qualifier":">","row":"w07","date":"2022-06-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"}],"goal":{"value":250,"loss":null,"deadline":null,"due":null,"row":"w27","display":"250 lb","base":null},"lost":{"total":29,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":240,"date":"2022-06-15","row":"w07"},"value":-128}},{"t":12.5,"current":{"value":240,"qualifier":">","row":"w07","date":"2022-06-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"}],"goal":{"value":230,"loss":null,"deadline":null,"due":null,"row":"w32","display":"230 lb","base":null},"lost":{"total":48.4,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":240,"date":"2022-06-15","row":"w07"},"value":-128}},{"t":14.25,"current":{"value":240,"qualifier":">","row":"w07","date":"2022-06-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"}],"goal":{"value":230,"loss":null,"deadline":null,"due":null,"row":"w32","display":"230 lb","base":null},"lost":{"total":48.4,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":240,"date":"2022-06-15","row":"w07"},"value":-128}},{"t":16,"current":{"value":240,"qualifier":">","row":"w07","date":"2022-06-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"}],"goal":{"value":140,"loss":100,"deadline":null,"due":null,"row":"w50","display":"140 lb","base":{"value":240,"row":"w07","from":"stated"}},"lost":{"total":48.4,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":240,"date":"2022-06-15","row":"w07"},"value":-128}},{"t":17.75,"current":{"value":240,"qualifier":">","row":"w07","date":"2022-06-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"}],"goal":{"value":140,"loss":100,"deadline":null,"due":null,"row":"w50","display":"140 lb","base":{"value":240,"row":"w07","from":"stated"}},"lost":{"total":60.4,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":12,"row":"w53"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":240,"date":"2022-06-15","row":"w07"},"value":-128}},{"t":19.5,"current":{"value":300,"qualifier":">","row":"w54","date":"2025-06-06"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"}],"goal":{"value":140,"loss":100,"deadline":null,"due":null,"row":"w50","display":"140 lb","base":{"value":240,"row":"w07","from":"stated"}},"lost":{"total":60.4,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":12,"row":"w53"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":300,"date":"2025-06-06","row":"w54"},"value":-68}},{"t":21.25,"current":{"value":300,"qualifier":">","row":"w54","date":"2025-06-06"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"}],"goal":{"value":140,"loss":100,"deadline":null,"due":null,"row":"w50","display":"140 lb","base":{"value":240,"row":"w07","from":"stated"}},"lost":{"total":60.4,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":12,"row":"w53"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":300,"date":"2025-06-06","row":"w54"},"value":-68}},{"t":23,"current":{"value":351,"qualifier":null,"row":"w59","date":"2025-08-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"}],"goal":{"value":265,"loss":null,"deadline":null,"due":null,"row":"w57","display":"265 lb","base":null},"lost":{"total":60.4,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":12,"row":"w53"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":351,"date":"2025-08-15","row":"w59"},"value":-17}},{"t":24.75,"current":{"value":351,"qualifier":null,"row":"w59","date":"2025-08-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"}],"goal":{"value":265,"loss":null,"deadline":null,"due":null,"row":"w57","display":"265 lb","base":null},"lost":{"total":60.4,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":12,"row":"w53"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":351,"date":"2025-08-15","row":"w59"},"value":-17}},{"t":26.5,"current":{"value":351,"qualifier":null,"row":"w59","date":"2025-08-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"}],"goal":{"value":275,"loss":null,"deadline":null,"due":null,"row":"w61","display":"275 lb","base":null},"lost":{"total":60.4,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":12,"row":"w53"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":351,"date":"2025-08-15","row":"w59"},"value":-17}},{"t":28.25,"current":{"value":351,"qualifier":null,"row":"w59","date":"2025-08-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"}],"goal":{"value":275,"loss":null,"deadline":null,"due":null,"row":"w61","display":"275 lb","base":null},"lost":{"total":79.4,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":31,"row":"w64"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":351,"date":"2025-08-15","row":"w59"},"value":-17}},{"t":30,"current":{"value":339,"qualifier":null,"row":"w74","date":"2026-01-09"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"}],"goal":{"value":331,"loss":20,"deadline":null,"due":null,"row":"w72","display":"331 lb","base":{"value":351,"row":"w59","from":"stated"}},"lost":{"total":79.4,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":31,"row":"w64"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":339,"date":"2026-01-09","row":"w74"},"value":-29}},{"t":31.75,"current":{"value":337,"qualifier":null,"row":"w76","date":"2026-01-16"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"}],"goal":{"value":331,"loss":20,"deadline":null,"due":null,"row":"w72","display":"331 lb","base":{"value":351,"row":"w59","from":"stated"}},"lost":{"total":79.4,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":31,"row":"w64"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":337,"date":"2026-01-16","row":"w76"},"value":-31}},{"t":33.5,"current":{"value":337,"qualifier":null,"row":"w76","date":"2026-01-16"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"}],"goal":{"value":331,"loss":20,"deadline":null,"due":null,"row":"w72","display":"331 lb","base":{"value":351,"row":"w59","from":"stated"}},"lost":{"total":123.1,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":31,"row":"w64"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":337,"date":"2026-01-16","row":"w76"},"value":-31}},{"t":35.25,"current":{"value":337,"qualifier":null,"row":"w76","date":"2026-01-16"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"}],"goal":{"value":320,"loss":null,"deadline":null,"due":null,"row":"w77","display":"320 lb","base":null},"lost":{"total":123.1,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":31,"row":"w64"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":337,"date":"2026-01-16","row":"w76"},"value":-31}},{"t":37,"current":{"value":337,"qualifier":null,"row":"w76","date":"2026-01-16"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"}],"goal":{"value":240,"loss":null,"deadline":null,"due":null,"row":"w78","display":"240 lb","base":null},"lost":{"total":123.1,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":31,"row":"w64"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":337,"date":"2026-01-16","row":"w76"},"value":-31}},{"t":38.75,"current":{"value":300,"qualifier":null,"row":"w79","date":"2026-07-05"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"}],"goal":{"value":240,"loss":null,"deadline":null,"due":null,"row":"w78","display":"240 lb","base":null},"lost":{"total":123.1,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":31,"row":"w64"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":300,"date":"2026-07-05","row":"w79"},"value":-68}},{"t":40.5,"current":{"value":300,"qualifier":null,"row":"w79","date":"2026-07-05"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"}],"goal":{"value":250,"loss":50,"deadline":null,"due":null,"row":"w85","display":"250 lb","base":{"value":300,"row":"w80","from":"stated"}},"lost":{"total":123.1,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":31,"row":"w64"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":300,"date":"2026-07-05","row":"w79"},"value":-68}},{"t":42.25,"current":{"value":300,"qualifier":null,"row":"w79","date":"2026-07-05"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"}],"goal":{"value":250,"loss":50,"deadline":null,"due":null,"row":"w85","display":"250 lb","base":{"value":300,"row":"w80","from":"stated"}},"lost":{"total":134.1,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":31,"row":"w64"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":11,"row":"w86"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":300,"date":"2026-07-05","row":"w79"},"value":-68}},{"t":44,"current":{"value":300,"qualifier":null,"row":"w79","date":"2026-07-05"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"}],"goal":{"value":250,"loss":50,"deadline":null,"due":null,"row":"w85","display":"250 lb","base":{"value":300,"row":"w80","from":"stated"}},"lost":{"total":134.1,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":31,"row":"w64"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":11,"row":"w86"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":300,"date":"2026-07-05","row":"w79"},"value":-68}},{"t":45.75,"current":{"value":338,"qualifier":null,"row":"w87","date":"2026-07-31"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"}],"goal":{"value":250,"loss":50,"deadline":null,"due":null,"row":"w85","display":"250 lb","base":{"value":300,"row":"w80","from":"stated"}},"lost":{"total":134.1,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":31,"row":"w64"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":11,"row":"w86"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":338,"date":"2026-07-31","row":"w87"},"value":-30}},{"t":47.5,"current":{"value":335.5,"qualifier":null,"row":"w93","date":"2026-08-03"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"},{"value":349,"asOf":"2026-07-19","row":"w91","date":"2026-08-03"},{"value":342,"asOf":"2026-07-27","row":"w92","date":"2026-08-03"}],"goal":{"value":235,"loss":null,"deadline":null,"due":null,"row":"w90","display":"235 lb","base":null},"lost":{"total":134.1,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":31,"row":"w64"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":11,"row":"w86"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":335.5,"date":"2026-08-03","row":"w93"},"value":-32.5}},{"t":49.25,"current":{"value":335.5,"qualifier":null,"row":"w93","date":"2026-08-03"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"},{"value":349,"asOf":"2026-07-19","row":"w91","date":"2026-08-03"},{"value":342,"asOf":"2026-07-27","row":"w92","date":"2026-08-03"}],"goal":{"value":235,"loss":null,"deadline":null,"due":null,"row":"w90","display":"235 lb","base":null},"lost":{"total":148.1,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":31,"row":"w64"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":25,"row":"w101"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":335.5,"date":"2026-08-03","row":"w93"},"value":-32.5}},{"t":51,"current":{"value":320,"qualifier":null,"row":"w102","date":"2026-08-28"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"},{"value":349,"asOf":"2026-07-19","row":"w91","date":"2026-08-03"},{"value":342,"asOf":"2026-07-27","row":"w92","date":"2026-08-03"}],"goal":{"value":235,"loss":null,"deadline":null,"due":null,"row":"w90","display":"235 lb","base":null},"lost":{"total":148.1,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":31,"row":"w64"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":25,"row":"w101"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":320,"date":"2026-08-28","row":"w102"},"value":-48}},{"t":52.75,"current":{"value":300,"qualifier":">","row":"w107","date":"2026-09-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"},{"value":349,"asOf":"2026-07-19","row":"w91","date":"2026-08-03"},{"value":342,"asOf":"2026-07-27","row":"w92","date":"2026-08-03"}],"goal":{"value":235,"loss":null,"deadline":null,"due":null,"row":"w90","display":"235 lb","base":null},"lost":{"total":148.1,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":31,"row":"w64"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":25,"row":"w101"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":300,"date":"2026-09-15","row":"w107"},"value":-68}},{"t":54.5,"current":{"value":310.5,"qualifier":null,"row":"w110","date":"2026-09-24"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"},{"value":349,"asOf":"2026-07-19","row":"w91","date":"2026-08-03"},{"value":342,"asOf":"2026-07-27","row":"w92","date":"2026-08-03"}],"goal":{"value":235,"loss":null,"deadline":null,"due":null,"row":"w90","display":"235 lb","base":null},"lost":{"total":148.1,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":31,"row":"w64"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":25,"row":"w101"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":310.5,"date":"2026-09-24","row":"w110"},"value":-57.5}},{"t":56.25,"current":{"value":300,"qualifier":"<","row":"w115","date":"2026-10-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"},{"value":349,"asOf":"2026-07-19","row":"w91","date":"2026-08-03"},{"value":342,"asOf":"2026-07-27","row":"w92","date":"2026-08-03"}],"goal":{"value":235,"loss":null,"deadline":null,"due":null,"row":"w90","display":"235 lb","base":null},"lost":{"total":148.1,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":31,"row":"w64"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":25,"row":"w101"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":300,"date":"2026-10-15","row":"w115"},"value":-68}},{"t":58,"current":{"value":300,"qualifier":"<","row":"w115","date":"2026-10-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"},{"value":349,"asOf":"2026-07-19","row":"w91","date":"2026-08-03"},{"value":342,"asOf":"2026-07-27","row":"w92","date":"2026-08-03"},{"value":390,"asOf":"2025-02-01","row":"w116","date":"2026-10-15"}],"goal":{"value":235,"loss":null,"deadline":null,"due":null,"row":"w90","display":"235 lb","base":null},"lost":{"total":148.1,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":31,"row":"w64"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":25,"row":"w101"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":300,"date":"2026-10-15","row":"w115"},"value":-68}},{"t":59.75,"current":{"value":291.5,"qualifier":null,"row":"w118","date":"2026-10-26"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"},{"value":349,"asOf":"2026-07-19","row":"w91","date":"2026-08-03"},{"value":342,"asOf":"2026-07-27","row":"w92","date":"2026-08-03"},{"value":390,"asOf":"2025-02-01","row":"w116","date":"2026-10-15"}],"goal":{"value":235,"loss":null,"deadline":null,"due":null,"row":"w90","display":"235 lb","base":null},"lost":{"total":148.1,"runs":[{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-12","peak":19.4,"row":"w34"},{"run":6,"start":"2025-04-11","peak":31,"row":"w64"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":25,"row":"w101"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":291.5,"date":"2026-10-23","row":"w118"},"value":-76.5}}],"totals":{"lost":254.6,"lostRuns":[{"run":0,"start":"2018-02-20","end":"2018-02-20","peak":12,"row":"w01","rows":["w01"]},{"run":1,"start":"2021-04-30","end":"2021-04-30","peak":13.5,"row":"w04","rows":["w04"]},{"run":2,"start":"2023-05-09","end":"2023-07-26","peak":29,"row":"w18","rows":["w15","w17","w18"]},{"run":3,"start":"2024-01-12","end":"2024-02-07","peak":19.4,"row":"w34","rows":["w24","w28","w30","w33","w34"]},{"run":4,"start":"2024-05-09","end":"2024-05-09","peak":28,"row":"w36","rows":["w36"]},{"run":5,"start":"2024-11-15","end":"2024-11-15","peak":9,"row":"w43","rows":["w43"]},{"run":6,"start":"2025-04-11","end":"2025-10-10","peak":40,"row":"w62","rows":["w47","w52","w53","w58","w62","w63","w64","w67","w70"]},{"run":7,"start":"2026-01-16","end":"2026-01-16","peak":43.7,"row":"w75","rows":["w75"]},{"run":8,"start":"2026-07-23","end":"2026-11-03","peak":60,"row":"w119","rows":["w83","w84","w86","w94","w95","w97","w98","w100","w101","w104","w121","w105","w106","w108","w112","w113","w114","w119","w122"]}],"net":{"from":368,"to":291.5,"value":-76.5,"fromRow":"w35","toRow":"w118"},"runs":9,"goals":29,"goalRepeats":{"lose 100":7,"lose 50":4,"lose 30":2,"lose 75":2},"diets":53,"peakDrift":[365.7,370,385,387,390],"under300":{"said":3,"rows":["w115","w117","w118"]},"promises":[{"row":"p01","said":"2026-10-23","what":"post a video of the scale","due":null,"kept":false,"checks":["p02"],"claims":[],"outcome":null}],"span":{"from":"2008-06-30","to":"2026-11-03"}},"_fixture":"measure-dial: 34 rows of the weight project's measure slice (umtool measure on a copy, 5 Nov 2026), respread over a 62 s cut. make.mjs writes it."}
diff --git a/umtool/report-to-video/instruments.mjs b/umtool/report-to-video/instruments.mjs
@@ -0,0 +1,183 @@
+// THE INSTRUMENTS (rev 9 of the weight video, lane scale-dial): three deck
+// modules that read the schedule's MEASURE slice (`doc.measure`, written by the
+// build from a manifest's measure ledger) and stand in a column at the frame's
+// right, the clip moved to the left to make room for it:
+//
+// render.chrome.deck.dial an analog bathroom-scale face: a red needle to
+// every weight he states, on the word, with a
+// spring; his remembered weights as grey ghosts;
+// his latest goal as an amber tick on the bezel
+// render.chrome.deck.odometer rolling digits of the pounds he says he has
+// lost (only ever up), NET beside them
+// render.chrome.deck.trail his stated weights by DATE, a thin line drawn
+// up to the playhead, the 300 lb line, a count
+// of the times he says he is under it
+//
+// Each is `true` (its defaults), an object of its settings, or absent/false
+// (off). With any of them on the frame changes: the footage box moves to the
+// left edge and the column takes the right (deck.mjs deckGeometry,
+// instrumentsGeometry); the posts stay in the footage box (`posts.shift` does
+// not apply) and the side panel (threads, flips) and the feed are refused.
+// `deck.dial.finale` (default on) also draws the dial and the odometer large
+// in the finale's lower column (module `dial-finale`).
+//
+// A LEAF, like modules/settings.mjs: deck.mjs and settings.mjs import it, so it
+// imports neither.
+
+/** The column's width at 1920 wide (scaled with the frame): what the footage gives up. */
+export const INSTRUMENT_COLUMN = 600;
+
+/** The needle's red, the spec's (contract §Screen design). */
+export const NEEDLE_RED = "#ff5a4e";
+
+/** Each instrument's settings and their defaults. */
+export const DIAL_DEFAULTS = Object.freeze({
+ // The weight the face accents (its tick and label in the accent colour); null for none.
+ mark: 300,
+ // The remembered weights as ghost ticks, the latest a long ghost needle with its as-of date.
+ ghosts: true,
+ // The latest goal as an amber tick on the bezel, and its words under the digits.
+ goal: true,
+ // The needle's colour: a #hex.
+ needle: NEEDLE_RED,
+ // The dial and the odometer drawn large in the finale's lower column (module dial-finale).
+ finale: true,
+ // The words over the big digits.
+ label: "HE SAYS HE WEIGHS",
+ // Where the instruments stand (a variant to judge): "column" -- the frame's right
+ // column, the footage moved left for it -- or "corner": a smaller dial over one
+ // corner of the footage (`corner`, `size` px at 1920 wide), the odometer and the
+ // trail stacked beside it toward the middle of that side, the footage where the
+ // deck always puts it.
+ placement: "column",
+ size: 340,
+ corner: "bottom-right",
+ // The needle's move to a stated weight: "spring" (back.out, an overshoot and a
+ // settle, as a scale's) or "ease" (power2.inOut, no overshoot).
+ motion: "spring",
+ // The finale's last beat: "odometer" (the wheels roll, NET holds, to the end) or
+ // "promise" -- the instruments hand off to the promise clock (module `promise`):
+ // they fade out at the handoff (dialFinaleHandoff) and the clock takes the column.
+ // With no promise module on the cut it ends as "odometer".
+ finaleEnd: "odometer",
+});
+
+export const DIAL_PLACEMENTS = Object.freeze(["column", "corner"]);
+export const DIAL_CORNERS = Object.freeze(["bottom-right", "bottom-left", "top-right", "top-left"]);
+export const DIAL_MOTIONS = Object.freeze(["spring", "ease"]);
+export const DIAL_FINALE_ENDS = Object.freeze(["odometer", "promise"]);
+/** A corner dial's size bounds, px at 1920 wide. */
+export const DIAL_SIZE = Object.freeze([200, 540]);
+
+export const ODOMETER_DEFAULTS = Object.freeze({
+ label: "POUNDS HE SAYS HE'S LOST",
+ // NET (first stated weight of the record to the latest) in plain digits beside the wheels.
+ net: true,
+ // "ACROSS 8 RUNS" under the wheels.
+ runs: true,
+});
+
+export const TRAIL_DEFAULTS = Object.freeze({
+ // The weight drawn as a line across the trail; null for none.
+ mark: 300,
+ // How many times he says he is under 300 (the measure's `totals.under300` rows), as they land.
+ count: true,
+ label: "WHAT HE SAYS HE WEIGHS, BY DATE",
+});
+
+/** A label's characters at most. */
+export const INSTRUMENT_LABEL_MAX = 40;
+
+const isObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
+const HEX_RE = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
+const numIn = (v, lo, hi) => typeof v === "number" && Number.isFinite(v) && v >= lo && v <= hi;
+
+/** An instrument's settings, its defaults filled, or null when it is off. */
+function resolveOne(v, defaults) {
+ if (v === true) return { ...defaults };
+ if (!isObj(v)) return null;
+ return { ...defaults, ...v };
+}
+
+export const resolveDial = (render) => resolveOne(render?.chrome?.deck?.dial, DIAL_DEFAULTS);
+export const resolveOdometer = (render) => resolveOne(render?.chrome?.deck?.odometer, ODOMETER_DEFAULTS);
+export const resolveTrail = (render) => resolveOne(render?.chrome?.deck?.trail, TRAIL_DEFAULTS);
+
+/** Which instruments the render block asks for, in the column's order (top first). */
+export function instrumentsWanted(render) {
+ const out = [];
+ if (resolveDial(render)) out.push("dial");
+ if (resolveOdometer(render)) out.push("odometer");
+ if (resolveTrail(render)) out.push("trail");
+ return out;
+}
+
+/** Where the instruments stand: the dial's `placement` ("column" without a dial). */
+export const instrumentsPlacement = (render) => resolveDial(render)?.placement ?? "column";
+
+/**
+ * Is the instrument COLUMN on: any of the three asked for, placed in the column.
+ * The frame's layout changes with it (the footage moves left); in the corner it does not.
+ */
+export const instrumentsOn = (render) => instrumentsWanted(render).length > 0 && instrumentsPlacement(render) === "column";
+
+function labelProblem(v, where) {
+ if (typeof v !== "string") return `${where} must be text`;
+ if (/[\r\n]/.test(v)) return `${where} must be one line`;
+ if ([...v].length > INSTRUMENT_LABEL_MAX) return `${where} is ${[...v].length} characters (at most ${INSTRUMENT_LABEL_MAX})`;
+ return null;
+}
+
+/** The common shape: absent, true/false, or an object of known keys. */
+function shapeErrors(v, defaults, where) {
+ if (v === undefined || typeof v === "boolean") return { errors: [], obj: null };
+ if (!isObj(v)) return { errors: [`${where} must be true, false or { ${Object.keys(defaults).join(", ")} }`], obj: null };
+ const errors = [];
+ for (const k of Object.keys(v)) {
+ if (!Object.hasOwn(defaults, k)) errors.push(`${where}.${k} is not a setting of it (${Object.keys(defaults).join(", ")})`);
+ }
+ return { errors, obj: v };
+}
+
+const markProblem = (v, where) => (v === null || numIn(v, 0, 2000) ? null : `${where} must be a weight (0 to 2000) or null`);
+const boolProblem = (v, where) => (typeof v === "boolean" ? null : `${where} must be true or false`);
+
+/** `render.chrome.deck.dial`, as sentences. */
+export function validateDial(v, where = "render.chrome.deck.dial") {
+ const { errors, obj } = shapeErrors(v, DIAL_DEFAULTS, where);
+ if (!obj) return errors;
+ if (obj.mark !== undefined) { const p = markProblem(obj.mark, `${where}.mark`); if (p) errors.push(p); }
+ for (const k of ["ghosts", "goal", "finale"]) if (obj[k] !== undefined) { const p = boolProblem(obj[k], `${where}.${k}`); if (p) errors.push(p); }
+ if (obj.needle !== undefined && !(typeof obj.needle === "string" && HEX_RE.test(obj.needle))) errors.push(`${where}.needle must be a #hex colour`);
+ if (obj.label !== undefined) { const p = labelProblem(obj.label, `${where}.label`); if (p) errors.push(p); }
+ const oneOf = (k, list) => {
+ if (obj[k] !== undefined && !list.includes(obj[k])) errors.push(`${where}.${k} must be ${list.map((x) => `"${x}"`).join(" or ")}`);
+ };
+ oneOf("placement", DIAL_PLACEMENTS);
+ oneOf("motion", DIAL_MOTIONS);
+ oneOf("finaleEnd", DIAL_FINALE_ENDS);
+ oneOf("corner", DIAL_CORNERS);
+ if (obj.size !== undefined && !(Number.isInteger(obj.size) && numIn(obj.size, DIAL_SIZE[0], DIAL_SIZE[1]))) {
+ errors.push(`${where}.size must be a whole number of pixels from ${DIAL_SIZE[0]} to ${DIAL_SIZE[1]}`);
+ }
+ return errors;
+}
+
+/** `render.chrome.deck.odometer`, as sentences. */
+export function validateOdometer(v, where = "render.chrome.deck.odometer") {
+ const { errors, obj } = shapeErrors(v, ODOMETER_DEFAULTS, where);
+ if (!obj) return errors;
+ for (const k of ["net", "runs"]) if (obj[k] !== undefined) { const p = boolProblem(obj[k], `${where}.${k}`); if (p) errors.push(p); }
+ if (obj.label !== undefined) { const p = labelProblem(obj.label, `${where}.label`); if (p) errors.push(p); }
+ return errors;
+}
+
+/** `render.chrome.deck.trail`, as sentences. */
+export function validateTrail(v, where = "render.chrome.deck.trail") {
+ const { errors, obj } = shapeErrors(v, TRAIL_DEFAULTS, where);
+ if (!obj) return errors;
+ if (obj.mark !== undefined) { const p = markProblem(obj.mark, `${where}.mark`); if (p) errors.push(p); }
+ if (obj.count !== undefined) { const p = boolProblem(obj.count, `${where}.count`); if (p) errors.push(p); }
+ if (obj.label !== undefined) { const p = labelProblem(obj.label, `${where}.label`); if (p) errors.push(p); }
+ return errors;
+}
diff --git a/umtool/report-to-video/instruments.test.mjs b/umtool/report-to-video/instruments.test.mjs
@@ -0,0 +1,338 @@
+// The measure's instruments (instruments.mjs, chrome-instruments.mjs,
+// modules/dial|odometer|trail|dial-finale.mjs): their settings, the frame they
+// make room in, the pages and their frame keys -- and that a cut without them
+// draws exactly what it drew before they existed.
+import assert from "node:assert/strict";
+import { createHash } from "node:crypto";
+import { readFileSync } from "node:fs";
+import path from "node:path";
+import test from "node:test";
+import { fileURLToPath } from "node:url";
+
+import { deckGeometry, estimateSchedule, instrumentsGeometry, postsGeometry, resolveDeck, validateChrome } from "./deck.mjs";
+import { deckHtml } from "./chrome-deck.mjs";
+import { dialFinaleGeometry, dialFinaleHandoff, dialFinaleHtml, dialHtml, finaleNumbers, odometerHtml, trailHtml } from "./chrome-instruments.mjs";
+import { frameKeys } from "./frame-keys.mjs";
+import { instrumentsOn, resolveDial, validateDial } from "./instruments.mjs";
+import { dialAngle, fmtDate, fmtSigned, measureTrack, wheelDigits, wheelRoll } from "./measure-draw.mjs";
+import { deckOverlays, moduleById, moduleProblems, playModules, scheduleSlices } from "./modules/index.mjs";
+import { slotRect } from "./modules/layout.mjs";
+
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+const MEASURE = JSON.parse(readFileSync(path.join(HERE, "fixtures", "measure-dial", "measure.json"), "utf8"));
+const FPS = 30;
+
+const chromeWith = (deck = {}) => ({ engine: "hyperframes", layout: "deck", deck });
+const RENDER = {
+ width: 1920, height: 1080, fps: FPS, transition: 0.4,
+ palette: { bg: "#0F1312", fg: "#EDF0EC", muted: "#98A29B", accent: "#22AB83", amber: "#E8A33F" },
+ chrome: chromeWith({ dial: true, odometer: true, trail: true, qr: { show: false }, finale: { video: "side", totals: false } }),
+};
+
+/** A deck cut long enough for the fixture's 62 s, its last clip the finale, with the measure in its schedule. */
+function cut(render = RENDER) {
+ const timeline = Array.from({ length: 9 }, (_, i) => ({
+ type: "clip", id: `c${i + 1}`, video: "vidx", start: 10 * i, end: 10 * i + (i === 8 ? 14 : 8), cite: 1, section: 0,
+ quote: "q", onscreen: { title: `Clip ${i + 1}` }, ...(i === 8 ? { layout: "finale" } : {}),
+ }));
+ const manifest = { slug: "m", title: "M", provenance: {}, render, timeline };
+ return { manifest, schedule: { ...estimateSchedule(manifest), measure: MEASURE } };
+}
+
+// ---------------------------------------------------------------------------
+// A cut without them is the cut it was.
+// ---------------------------------------------------------------------------
+
+// What the release 28 kit's manifests drew on main before the instruments (c05e5314): the estimate's
+// schedule, the deck's page, the frame and every whole-cut overlay's region, hashed. Unchanged.
+const BEFORE = {
+ full: "0eeb6303e621af4b88c8e0eaae2eca7228da0e3dbae997c60fd45fdd5744e18a",
+ flips: "565472d4e03834bdf8f2fdd656d76f48d1bca37019be27f33422c0f27d6f270e",
+};
+
+test("a cut without the instruments draws exactly what it drew before them (the release 28 kit's manifests)", () => {
+ for (const name of ["full", "flips"]) {
+ const m = JSON.parse(readFileSync(path.join(HERE, "../../common/testing/draft/manifests", `${name}.video.manifest.json`), "utf8"));
+ const s = estimateSchedule(m);
+ const render = m.render;
+ const html = deckHtml(s, render, { fonts: { regular: "assets/r.ttf", bold: "assets/b.ttf" } });
+ const regions = deckOverlays().filter((mod) => mod.on(s, render) && mod.kind === "overlay-whole").map((mod) => [mod.id, mod.regions(s, { render, outDir: "/o" })]);
+ const doc = { s, html, g: deckGeometry(render), regions, slices: Object.keys(scheduleSlices(s)).sort() };
+ assert.equal(createHash("sha256").update(JSON.stringify(doc)).digest("hex"), BEFORE[name], name);
+ assert.ok(!regions.some(([id]) => ["dial", "odometer", "trail"].includes(id)));
+ assert.equal(instrumentsOn(render), false);
+ }
+});
+
+test("the deck's frame is moved only when an instrument is asked for", () => {
+ const plain = { width: 1920, height: 1080, chrome: chromeWith({}) };
+ assert.deepEqual(deckGeometry(plain).footage, { x: 173, y: 2, width: 1574, height: 886 });
+ for (const off of [{ dial: false }, { odometer: false, trail: false }]) {
+ assert.deepEqual(deckGeometry({ ...plain, chrome: chromeWith(off) }).footage, deckGeometry(plain).footage);
+ }
+ const g = deckGeometry(RENDER);
+ assert.deepEqual(g.footage, { x: 24, y: 94, width: 1248, height: 702 });
+ const ig = instrumentsGeometry(RENDER);
+ assert.deepEqual(ig.column, { x: 1296, y: 24, width: 600, height: 842 });
+ assert.deepEqual([ig.dial.height, ig.odometer.height, ig.trail.height], [540, 140, 138]);
+ assert.equal(ig.trail.y + ig.trail.height, g.deck.y - 24);
+ assert.deepEqual(slotRect("instruments", RENDER), ig.column);
+ // The dial alone takes a square face; an instrument that is off has no region.
+ const one = instrumentsGeometry({ ...RENDER, chrome: chromeWith({ odometer: true }) });
+ assert.equal(one.dial, null);
+ assert.equal(one.odometer.y, 24);
+});
+
+test("with the instruments the posts stay in the footage box: posts.shift does not apply", () => {
+ assert.ok(resolveDeck({ chrome: chromeWith({}) }).posts.shift);
+ assert.equal(resolveDeck(RENDER).posts.shift, false);
+ const p = postsGeometry(RENDER);
+ const f = deckGeometry(RENDER).footage;
+ assert.ok(p.x + p.width <= f.x + f.width, "the posts column is inside the footage, clear of the instruments");
+});
+
+// ---------------------------------------------------------------------------
+// Settings.
+// ---------------------------------------------------------------------------
+
+test("the instruments' settings: true, an object of known keys, or off; the side panel and the feed refused beside them", () => {
+ assert.deepEqual(validateChrome(RENDER.chrome, RENDER), []);
+ assert.deepEqual(validateChrome(chromeWith({ dial: { mark: 300, needle: "#ff0000", finale: false } }), {}), []);
+ assert.match(validateChrome(chromeWith({ dial: { marks: 3 } }), {})[0], /deck\.dial\.marks is not a setting of it/);
+ assert.match(validateChrome(chromeWith({ odometer: "yes" }), {})[0], /deck\.odometer must be true, false or/);
+ assert.match(validateChrome(chromeWith({ trail: { mark: "300" } }), {})[0], /deck\.trail\.mark must be a weight/);
+ assert.deepEqual(validateDial({ label: "x".repeat(41) }), ["render.chrome.deck.dial.label is 41 characters (at most 40)"]);
+ const feed = validateChrome(chromeWith({ dial: true, posts: { layout: "feed" } }), {});
+ assert.ok(feed.some((e) => /need the popup posts, not the feed/.test(e)), feed.join("\n"));
+ const side = validateChrome({ ...chromeWith({ trail: true }), threads: { list: [{ id: "a", label: "A" }] } }, {});
+ assert.ok(side.some((e) => /render\.chrome\.threads and render\.chrome\.deck\.trail both need the frame/.test(e)), side.join("\n"));
+ assert.deepEqual(resolveDial(RENDER), {
+ mark: 300, ghosts: true, goal: true, needle: "#ff5a4e", finale: true, label: "HE SAYS HE WEIGHS", placement: "column", size: 340, corner: "bottom-right", motion: "spring", finaleEnd: "odometer",
+ });
+ assert.match(validateDial({ placement: "left" })[0], /placement must be "column" or "corner"/);
+ assert.match(validateDial({ size: 100 })[0], /size must be a whole number of pixels from 200 to 540/);
+ assert.match(validateDial({ motion: "bounce" })[0], /motion must be "spring" or "ease"/);
+ assert.match(validateDial({ finaleEnd: "net" })[0], /finaleEnd must be "odometer" or "promise"/);
+ assert.equal(resolveDial({ chrome: chromeWith({ dial: false }) }), null);
+ assert.deepEqual(moduleProblems({ render: { ...RENDER, chrome: chromeWith({ dial: { ghost: true } }) } }).dial, ["render.chrome.deck.dial.ghost is not a setting of it (mark, ghosts, goal, needle, finale, label, placement, size, corner, motion, finaleEnd)"]);
+});
+
+// ---------------------------------------------------------------------------
+// The slice and the modules.
+// ---------------------------------------------------------------------------
+
+test("the measure is a slice only when the schedule has one; each instrument is on with its setting and the measure", () => {
+ const { schedule } = cut();
+ const { measure: _m, ...bare } = schedule;
+ assert.equal(scheduleSlices(schedule).measure, MEASURE);
+ assert.equal("measure" in scheduleSlices(bare), false);
+ for (const id of ["dial", "odometer", "trail"]) {
+ const m = moduleById(id);
+ assert.equal(m.on(schedule, RENDER), true, id);
+ assert.equal(m.on(bare, RENDER), false, id);
+ assert.equal(m.on(schedule, { ...RENDER, chrome: chromeWith({}) }), false, id);
+ assert.match(m.check(bare, RENDER), /needs a schedule with a measure/);
+ assert.equal(m.regions(schedule, { render: RENDER, outDir: "/o" })[0].frames, `/o/chrome/${id}-frames`);
+ assert.ok(playModules().includes(m), id);
+ }
+ const fin = moduleById("dial-finale");
+ assert.equal(fin.on(schedule, RENDER), true);
+ assert.equal(fin.on(schedule, { ...RENDER, chrome: chromeWith({ dial: { finale: false } }) }), false);
+ const [r] = fin.regions(schedule, { render: RENDER, outDir: "/o" });
+ assert.deepEqual([r.x, r.y, r.width, r.height], [48, 448, 1008, 596]);
+ assert.equal(r.offset, r.window.from);
+ // Stats cards fill the finale's lower column: no room, and it says so.
+ const crowded = { ...RENDER, chrome: chromeWith({ dial: true, finale: { video: "side", stats: [{ label: "A", value: "1" }] } }) };
+ assert.equal(dialFinaleGeometry(schedule, crowded), null);
+ assert.match(fin.check(schedule, crowded), /needs the finale's lower column clear/);
+});
+
+// ---------------------------------------------------------------------------
+// The measure, read.
+// ---------------------------------------------------------------------------
+
+test("measureTrack: the stated weights, the ghosts, a goal, and an odometer that only goes up", () => {
+ const t = measureTrack(MEASURE);
+ assert.equal(t.current[0].value, null);
+ assert.deepEqual(t.current.slice(1, 3).map((c) => [c.value, c.qualifier]), [[240, ">"], [300, ">"]]);
+ // A stated weight with an as-of is dated by its weighing: 291.5 "on Friday".
+ assert.equal(t.current.at(-1).date, "2026-10-23");
+ assert.equal(t.remembered.length, MEASURE.state.at(-1).remembered.length);
+ for (let i = 1; i < t.lost.length; i += 1) assert.ok(t.lost[i].total >= t.lost[i - 1].total);
+ // The cut's own total: the rows no clip shows yet are the record's (totals.lost), not the odometer's.
+ assert.equal(t.lost.at(-1).total, MEASURE.state.at(-1).lost.total);
+ assert.deepEqual(t.under.map((u) => u.row), ["w115", "w118"]);
+ assert.equal(t.stated.length, 13);
+ // A loss that would lower the total holds it at its highest.
+ const lower = { ...MEASURE, state: [...MEASURE.state, { ...MEASURE.state.at(-1), t: 61, lost: { total: 100, runs: MEASURE.state.at(-1).lost.runs } }] };
+ assert.equal(measureTrack(lower).lost.at(-1).total, MEASURE.state.at(-1).lost.total);
+});
+
+test("the dial's angles, the odometer's wheels, the words", () => {
+ const scale = { min: 220, max: 400 };
+ assert.deepEqual([dialAngle(220, scale), dialAngle(310, scale), dialAngle(400, scale), dialAngle(500, scale)], [-135, 0, 135, 135]);
+ assert.deepEqual(wheelDigits(212.8, 3), [2, 1, 2, 8]);
+ // 90.4 -> 122.9: the hundreds 0 -> 1, the tens 9 through 0 to 2, the lower wheels a turn more.
+ assert.deepEqual(wheelRoll(90.4, 122.9, 3), [
+ { from: 0, to: 1, settle: null }, { from: 9, to: 12, settle: 2 }, { from: 0, to: 12, settle: 2 }, { from: 4, to: 19, settle: 9 },
+ ]);
+ assert.equal(fmtDate("2026-10-26"), "26 OCT 2026");
+ assert.equal(fmtDate("2025-02-01"), "FEB 2025");
+ assert.equal(fmtSigned(-76.5), "−76.5");
+});
+
+// ---------------------------------------------------------------------------
+// The pages: cue interpreters the frame keys model.
+// ---------------------------------------------------------------------------
+
+const fonts = { DeckSans: "assets/DeckSans.ttf", DeckSansBold: "assets/DeckSansBold.ttf" };
+
+test("the dial's page: the needle swings on each stated weight and is keyed once at rest", () => {
+ const { schedule } = cut();
+ const html = dialHtml(schedule, RENDER, { fonts });
+ assert.match(html, /data-composition-id="dial"/);
+ assert.match(html, /dial:ready/);
+ assert.match(html, />>240<i>LB<\/i>/);
+ assert.match(html, /HE SAYS HE WEIGHS/);
+ // The state before any weight is up from the cut's first instant (the dash's block in init).
+ const data = JSON.parse(/<script id="dial-data" type="application\/json">(.*?)<\/script>/s.exec(html)[1]);
+ assert.deepEqual(data.init.cv0, { autoAlpha: 1 });
+ assert.ok(!data.cues.some((c) => c.k === "cv0" && c.to.autoAlpha === 1));
+ const frames = Math.round(schedule.total * FPS);
+ const keys = frameKeys({ html, region: "dial", fps: FPS, frames, version: "t" });
+ assert.ok(keys, "the frame keys model the dial's page");
+ const at = (s) => keys[Math.round(s * FPS)];
+ // Before the first stated weight (3.75 s) the needle rests: one key. During the swing every frame is new.
+ assert.equal(at(2.5), at(3.5));
+ assert.notEqual(at(3.85), at(4.05));
+ // After it settles (and its wedge is in), at rest again until the next row (5.5 s).
+ assert.equal(at(4.7), at(5.4));
+ const distinct = new Set(keys).size;
+ assert.ok(distinct < frames / 2, `${distinct} distinct frames of ${frames}: the needle at rest is reused`);
+});
+
+test("the odometer's and the trail's pages are modelled too, and draw what the measure says", () => {
+ const { schedule } = cut();
+ const frames = Math.round(schedule.total * FPS);
+ const odo = odometerHtml(schedule, RENDER, { fonts });
+ assert.match(odo, /POUNDS HE SAYS HE'S LOST|POUNDS HE SAYS HE'S LOST/);
+ assert.match(odo, /−76\.5/);
+ assert.match(odo, /368 → 291\.5/);
+ assert.match(odo, /ACROSS \d RUNS/);
+ const ok = frameKeys({ html: odo, region: "odometer", fps: FPS, frames, version: "t" });
+ assert.ok(ok);
+ assert.ok(new Set(ok).size < frames / 2);
+ const trail = trailHtml(schedule, RENDER, { fonts });
+ assert.match(trail, /UNDER 300 · SAID 2×/);
+ const tk = frameKeys({ html: trail, region: "trail", fps: FPS, frames, version: "t" });
+ assert.ok(tk);
+ assert.ok(new Set(tk).size < frames / 2);
+});
+
+test("the dial's finale: the record's numbers, a window page the frame keys model", () => {
+ const { schedule } = cut();
+ const n = finaleNumbers(MEASURE);
+ // The whole record's: 254.6 lb over 9 runs ("go by his words"), NET 368 -> 291.5, the remembered peak 390.
+ assert.deepEqual([n.weight, n.lost, n.runs, n.from, n.peak], [291.5, 254.6, 9, 368, 390]);
+ const fin = moduleById("dial-finale");
+ const win = fin.window(schedule, { fps: FPS, total: schedule.total });
+ const html = dialFinaleHtml(schedule, RENDER, win, { fonts });
+ assert.match(html, /data-composition-id="dial-finale"/);
+ assert.match(html, />291\.5<i>LB<\/i>/);
+ assert.match(html, /GOAL 235</);
+ const keys = frameKeys({ html, region: "dial-finale", fps: FPS, frames: win.frames, version: "t" });
+ assert.ok(keys);
+ // Held once the needle, the wheels and NET are in (by 4 s into the window): one key.
+ const at = (sec) => keys[Math.round((sec - win.from) * FPS)];
+ assert.equal(at(win.from + 6), at(win.from + 9));
+ assert.notEqual(at(win.from + 1.5), at(win.from + 1.6));
+});
+
+// ---------------------------------------------------------------------------
+// The variants (deck.dial.placement, .motion, .finaleEnd).
+// ---------------------------------------------------------------------------
+
+test("placement corner: the column dropped, the footage where the deck puts it, the instruments over its corners", () => {
+ const corner = { ...RENDER, chrome: chromeWith({ dial: { placement: "corner" }, odometer: true, trail: true }) };
+ const f = deckGeometry(corner).footage;
+ assert.deepEqual(f, { x: 173, y: 2, width: 1574, height: 886 });
+ assert.equal(instrumentsOn(corner), false);
+ assert.ok(resolveDeck(corner).posts.shift, "posts.shift applies again: the footage is the deck's own");
+ const g = instrumentsGeometry(corner);
+ assert.deepEqual(g.dial, { x: 173 + 1574 - 28 - 340, y: 2 + 886 - 28 - 340, width: 340, height: 340 });
+ // The odometer and the trail up the same side, on its edge: one corner's cluster.
+ assert.deepEqual(g.odometer, { x: 173 + 1574 - 28 - 480, y: g.dial.y - 10 - 112, width: 480, height: 112 });
+ assert.equal(g.trail.y + g.trail.height, g.odometer.y - 10);
+ const tl = instrumentsGeometry({ ...corner, chrome: chromeWith({ dial: { placement: "corner", corner: "top-left" }, odometer: true, trail: true }) });
+ assert.deepEqual([tl.dial.x, tl.dial.y, tl.odometer.y, tl.trail.y], [201, 30, 30 + 340 + 10, 30 + 340 + 10 + 112 + 10]);
+ assert.equal(instrumentsGeometry({ ...corner, chrome: chromeWith({ dial: { placement: "corner", size: 260 } }) }).dial.width, 260);
+ assert.deepEqual(validateChrome(corner.chrome, corner), []);
+ // In the corner the side panel may stand beside the footage; the feed still may not.
+ assert.deepEqual(validateChrome({ ...corner.chrome, threads: { list: [{ id: "a", label: "A" }] } }, corner).filter((e) => /both need the frame/.test(e)), []);
+ const { schedule } = cut(corner);
+ for (const id of ["dial", "odometer", "trail"]) {
+ const [r] = moduleById(id).regions(schedule, { render: corner, outDir: "/o" });
+ assert.deepEqual([r.x, r.y, r.width, r.height], [g[id].x, g[id].y, g[id].width, g[id].height], id);
+ }
+ const html = dialHtml(schedule, corner, { fonts });
+ assert.match(html, /width=340, height=340/);
+});
+
+test("motion ease: the needle moves on a plain ease, no overshoot; spring is back.out", () => {
+ const { schedule } = cut();
+ const spring = dialHtml(schedule, RENDER, { fonts });
+ const ease = dialHtml(schedule, { ...RENDER, chrome: chromeWith({ ...RENDER.chrome.deck, dial: { motion: "ease" } }) }, { fonts });
+ const needleEases = (html) => [...new Set(JSON.parse(/<script id="dial-data" type="application\/json">(.*?)<\/script>/s.exec(html)[1]).cues.filter((c) => c.k === "nd").map((c) => c.ease))];
+ assert.deepEqual(needleEases(spring), ["back.out(1.7)"]);
+ assert.deepEqual(needleEases(ease), ["power2.inOut"]);
+});
+
+test("finaleEnd promise: the instruments hand off to the promise clock once NET has held -- only when a promise module is on", () => {
+ const { schedule } = cut();
+ const promiseRender = { ...RENDER, chrome: chromeWith({ ...RENDER.chrome.deck, dial: { finaleEnd: "promise" } }) };
+ assert.equal(dialFinaleHandoff(schedule, RENDER), null);
+ const at = dialFinaleHandoff(schedule, promiseRender);
+ assert.ok(Math.abs(at - (schedule.finale.from + 0.8 + 3.2 + 0.5 + 2.3)) < 1 / (FPS * 8));
+ const win = moduleById("dial-finale").window(schedule, { fps: FPS, total: schedule.total });
+ const fadesOf = (opts) => {
+ const html = dialFinaleHtml(schedule, promiseRender, win, { fonts, ...opts });
+ const d = JSON.parse(/<script id="dial-finale-data" type="application\/json">(.*?)<\/script>/s.exec(html)[1]);
+ return d.cues.filter((c) => c.k === "rt" && c.to.autoAlpha === 0).map((c) => c.at);
+ };
+ assert.deepEqual(fadesOf({ promise: true }), [at]);
+ // No promise module drawing: it ends on the odometer, out through the dissolve.
+ assert.notDeepEqual(fadesOf({ promise: false }), [at]);
+});
+
+test("a loss goal resolved against its run's start reads as both", () => {
+ const t = measureTrack(MEASURE);
+ const resolved = t.goals.find((g) => g.goal?.base && Number.isFinite(g.goal.value));
+ assert.ok(resolved, "the fixture has one (w85: lose 50 from 300 -> 250)");
+ const { schedule } = cut();
+ assert.match(dialHtml(schedule, RENDER, { fonts }), /GOAL 250 · LOSE 50/);
+});
+
+test("the files route serves the instruments' preview projects by name", async () => {
+ const { layerPreviewOf } = await import("../lib/report/serve.mjs");
+ for (const n of ["dial-preview", "odometer-preview", "trail-preview", "dial-finale-preview"]) assert.equal(layerPreviewOf(n, []), n);
+ assert.equal(layerPreviewOf("dial-preview-c01", ["c01"]), "dial-preview-c01");
+ assert.equal(layerPreviewOf("dial-preview-zz", ["c01"]), null);
+});
+
+test("the corner never covers a measure extra silently: the build refuses with what to move; the column never meets them", () => {
+ const { schedule } = cut();
+ // The column (default): the extras stand in the footage, the instruments beside it.
+ for (const id of ["dial", "odometer", "trail"]) assert.equal(moduleById(id).check(schedule, RENDER), null, id);
+ // Bottom-right with the extras at their anchors: the dial covers the goal stack, and says how to move one.
+ const br = { ...RENDER, chrome: chromeWith({ dial: { placement: "corner" }, odometer: true, trail: true }) };
+ assert.match(moduleById("dial").check(schedule, br), /the corner dial .* covers the goals \(render\.chrome\.deck\.goals\.position bottom-right\): move one -- deck\.goals\.position, or deck\.dial\.corner/);
+ // The top-left corner is clear of every extra's default anchor.
+ const tl = { ...RENDER, chrome: chromeWith({ dial: { placement: "corner", corner: "top-left" }, odometer: true, trail: true }) };
+ for (const id of ["dial", "odometer", "trail"]) assert.equal(moduleById(id).check(schedule, tl), null, id);
+ // The dial alone in the lower right, the goal stack moved to the top left: clear.
+ const alone = { ...RENDER, chrome: chromeWith({ dial: { placement: "corner" }, goals: { position: "top-left" } }) };
+ assert.equal(moduleById("dial").check(schedule, alone), null);
+ // An extra switched off is not in the way.
+ const off = { ...RENDER, chrome: chromeWith({ dial: { placement: "corner" }, goals: false }) };
+ assert.equal(moduleById("dial").check(schedule, off), null);
+});
diff --git a/umtool/report-to-video/measure-draw.mjs b/umtool/report-to-video/measure-draw.mjs
@@ -0,0 +1,395 @@
+// THE MEASURE'S DRAWING KIT (lane scale-dial): the pure pieces the measure's
+// pages share -- the dial (chrome-instruments.mjs: `dial`, `dial-finale`), the
+// odometer, the trail, and any later module that reads `schedule.measure`
+// (measure-extras' goals, peak, promise and diet are meant to take them too):
+//
+// - cueList: a cue interpreter's `init` and `cues` (chrome-deck.mjs says why
+// a page is one), every cue with its FROM stated and clamped so no two run
+// on one element at once -- the shape frame-keys.mjs models, so a frame
+// whose values are a frame's before it is reused, not captured again;
+// - measureTrack: the measure's states read once into what changes when
+// (the stated weight, the remembered ones, the goal, the odometer's total,
+// NET, the "under 300" claims);
+// - the dial's face, its angles and the odometer's wheels, as markup;
+// - pageHtml: the page around them -- HyperFrames' root and clip, the data
+// script, and the interpreter with `?still=` and the preview's `deck:seek`.
+//
+// Pure: strings in, strings out. No fs.
+import { cueTime, pageDuration } from "./deck.mjs";
+
+/** Instant cues still take a millisecond: a zero-duration tween has its own seek rules. */
+export const INSTANT = 0.001;
+
+export const r4 = (v) => Math.round(v * 10000) / 10000;
+const r2 = (v) => Math.round(v * 100) / 100;
+
+export const esc = (s) =>
+ String(s ?? "")
+ .replace(/&/g, "&")
+ .replace(/</g, "<")
+ .replace(/>/g, ">")
+ .replace(/"/g, """);
+
+/**
+ * A cue list being built. `add(k, at, dur, to, ease)` asks for element `k`
+ * to reach `to` over [at, at + dur]; `build()` orders them, clamps each to
+ * start once the last cue on its element has finished (shortened to end
+ * where it would have), and states every FROM (the last `to` on that
+ * element, or its init). Times land on the deck's sub-frame grid (cueTime),
+ * so a moment the cut moved by whole frames draws exactly what it drew.
+ */
+export function cueList(fps) {
+ const init = {};
+ const ev = [];
+ return {
+ init,
+ set(k, props) {
+ init[k] = { ...(init[k] ?? {}), ...props };
+ },
+ add(k, at, dur, to, ease = "none") {
+ if (!Number.isFinite(at)) return;
+ const rounded = Object.fromEntries(Object.entries(to).map(([p, v]) => [p, typeof v === "number" ? r4(v) : v]));
+ ev.push({ k, at: cueTime(Math.max(0, at), fps), dur: r4(Math.max(INSTANT, dur)), to: rounded, ease, n: ev.length });
+ },
+ build() {
+ ev.sort((a, b) => a.at - b.at || a.n - b.n);
+ const state = Object.fromEntries(Object.entries(init).map(([k, v]) => [k, { ...v }]));
+ const freeAt = new Map();
+ const cues = [];
+ for (const e of ev) {
+ let { at, dur } = e;
+ const free = freeAt.get(e.k) ?? 0;
+ if (at < free) {
+ const end = at + dur;
+ at = r4(free);
+ dur = r4(Math.max(INSTANT, end - at));
+ }
+ const cur = state[e.k] ?? (state[e.k] = {});
+ const from = {};
+ for (const p of Object.keys(e.to)) from[p] = cur[p];
+ Object.assign(cur, e.to);
+ freeAt.set(e.k, r4(at + dur));
+ cues.push({ k: e.k, at, dur, from, to: e.to, ease: e.ease });
+ }
+ return { init, cues };
+ },
+ };
+}
+
+// ---------------------------------------------------------------------------
+// Words and numbers.
+// ---------------------------------------------------------------------------
+
+const MONTHS = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"];
+
+/** "2026-10-26" as "26 OCT 2026"; a first of the month (an approximate as-of) as "JUL 2023". */
+export function fmtDate(iso, { day = true } = {}) {
+ const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso ?? ""));
+ if (!m) return "";
+ const mon = MONTHS[Number(m[2]) - 1] ?? "";
+ return day && m[3] !== "01" ? `${Number(m[3])} ${mon} ${m[1]}` : `${mon} ${m[1]}`;
+}
+
+/** A weight as he gave it: whole when whole, else to a tenth. */
+export function fmtWeight(v) {
+ if (!Number.isFinite(v)) return "—";
+ const r = Math.round(v * 10) / 10;
+ return Number.isInteger(r) ? String(r) : r.toFixed(1);
+}
+
+/** A signed difference with a real minus: "−76.5", "+4". */
+export function fmtSigned(v) {
+ if (!Number.isFinite(v)) return "—";
+ const s = fmtWeight(Math.abs(v));
+ return v < 0 ? `−${s}` : v > 0 ? `+${s}` : "0";
+}
+
+/** The qualifier as the dial prints it before the digits. */
+export const qualifierMark = (q) => (q === "≈" ? "≈" : q === ">" ? ">" : q === "<" ? "<" : "");
+
+/** A day number for an ISO date (for spacing by date). */
+export const dayNumber = (iso) => {
+ const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso ?? ""));
+ return m ? Date.UTC(Number(m[1]), Number(m[2]) - 1, Number(m[3])) / 86400000 : NaN;
+};
+
+// ---------------------------------------------------------------------------
+// The measure, read into what changes when.
+// ---------------------------------------------------------------------------
+
+/** The index of the state in force at cut second `t` (the last with state.t <= t). */
+export function stateIndexAt(states, t) {
+ let lo = 0, hi = states.length - 1, ans = 0;
+ while (lo <= hi) {
+ const mid = (lo + hi) >> 1;
+ if (states[mid].t <= t + 1e-9) { ans = mid; lo = mid + 1; } else hi = mid - 1;
+ }
+ return ans;
+}
+
+const sameCurrent = (a, b) => (a?.row ?? null) === (b?.row ?? null) && (a?.value ?? null) === (b?.value ?? null) && (a?.qualifier ?? null) === (b?.qualifier ?? null);
+const sameGoal = (a, b) => (a?.row ?? null) === (b?.row ?? null) && (a?.value ?? null) === (b?.value ?? null);
+const sameNet = (a, b) => (a?.from?.row ?? null) === (b?.from?.row ?? null) && (a?.to?.row ?? null) === (b?.to?.row ?? null) &&
+ (a?.from?.value ?? null) === (b?.from?.value ?? null) && (a?.to?.value ?? null) === (b?.to?.value ?? null);
+
+/**
+ * The measure read once: each thing an instrument draws, as the list of times
+ * it changes, from the states (`measure.state`, sorted by t, the first at 0).
+ *
+ * - `current`: each stated weight in force, from its `t` (the first entry
+ * the state before any, `value: null`), with the date of the weighing
+ * (the event's `asOf`, else its date);
+ * - `remembered`: each remembered weight as it is first said;
+ * - `goals`: each latest goal (null when none), from its `t`;
+ * - `lost`: the odometer's total from each `t` -- the running HIGHEST, so it
+ * only ever goes up -- and its runs;
+ * - `net`: NET from each `t` it changes;
+ * - `under`: each "under 300" claim (`totals.under300.rows`) the cut shows;
+ * - `stated`: every stated weight the cut shows, for the trail (by date).
+ */
+export function measureTrack(measure) {
+ const states = Array.isArray(measure?.state) && measure.state.length ? measure.state : [{ t: 0 }];
+ const events = Array.isArray(measure?.events) ? measure.events : [];
+ const byRow = new Map(events.map((e) => [e.row, e]));
+ const current = [];
+ const remembered = [];
+ const goals = [];
+ const lost = [];
+ const net = [];
+ states.forEach((s, i) => {
+ const prev = i ? states[i - 1] : null;
+ const t = i ? Number(s.t) : 0;
+ if (!i || !sameCurrent(prev.current, s.current)) {
+ const c = s.current ?? null;
+ const ev = c ? byRow.get(c.row) : null;
+ current.push({ t, value: c?.value ?? null, qualifier: c?.qualifier ?? null, row: c?.row ?? null, date: ev?.asOf ?? c?.date ?? null });
+ }
+ const rem = Array.isArray(s.remembered) ? s.remembered : [];
+ const had = prev && Array.isArray(prev.remembered) ? prev.remembered.length : 0;
+ for (let j = had; j < rem.length; j += 1) {
+ const ev = byRow.get(rem[j].row);
+ remembered.push({ t, value: rem[j].value, asOf: rem[j].asOf ?? null, row: rem[j].row, qualifier: ev?.qualifier ?? null });
+ }
+ if (!i || !sameGoal(prev.goal, s.goal)) goals.push({ t, goal: s.goal ?? null });
+ const total = Number(s.lost?.total) || 0;
+ const top = lost.length ? lost[lost.length - 1].total : 0;
+ const runs = Array.isArray(s.lost?.runs) ? s.lost.runs.length : 0;
+ if (!i) lost.push({ t, total: Math.max(0, total), runs });
+ else if (total > top + 1e-9 || runs !== lost[lost.length - 1].runs) lost.push({ t, total: Math.max(top, total), runs });
+ if (!i || !sameNet(prev.net, s.net)) net.push({ t, net: s.net ?? null });
+ });
+ const underRows = new Set(measure?.totals?.under300?.rows ?? []);
+ const under = events.filter((e) => underRows.has(e.row) && Number.isFinite(e.t)).map((e) => ({ t: e.t, row: e.row }));
+ const stated = events
+ .filter((e) => e.kind === "stated" && Number.isFinite(e.value) && Number.isFinite(e.t))
+ .map((e) => ({ t: e.t, row: e.row, value: e.value, qualifier: e.qualifier ?? null, date: e.asOf ?? e.date }));
+ return { current, remembered, goals, lost, net, under, stated };
+}
+
+// ---------------------------------------------------------------------------
+// The dial.
+// ---------------------------------------------------------------------------
+
+/** The dial's sweep: the scale's min at A0, its max at A1, degrees clockwise from 12 o'clock. */
+export const DIAL_SWEEP = Object.freeze({ a0: -135, a1: 135 });
+
+/** A weight's angle on a dial of `scale` ({min, max}), clamped to the sweep. */
+export function dialAngle(v, scale) {
+ const { min, max } = scale;
+ const c = Math.max(min, Math.min(max, v));
+ return DIAL_SWEEP.a0 + ((c - min) / (max - min)) * (DIAL_SWEEP.a1 - DIAL_SWEEP.a0);
+}
+
+/** The point at `deg` (clockwise from 12 o'clock) and radius `r` about (cx, cy). */
+export function polar(cx, cy, r, deg) {
+ const a = ((deg - 90) * Math.PI) / 180;
+ return [r2(cx + r * Math.cos(a)), r2(cy + r * Math.sin(a))];
+}
+
+/** An annular sector's path, from `a0` to `a1` degrees between radii r0 < r1. */
+export function sectorPath(cx, cy, r0, r1, a0, a1) {
+ const [p, q] = [polar(cx, cy, r1, a0), polar(cx, cy, r1, a1)];
+ const [s, t] = [polar(cx, cy, r0, a1), polar(cx, cy, r0, a0)];
+ const lg = Math.abs(a1 - a0) > 180 ? 1 : 0;
+ return `M${p} A${r1},${r1} 0 ${lg} 1 ${q} L${s} A${r0},${r0} 0 ${lg} 0 ${t}Z`;
+}
+
+/** A qualifier's wedge, in pounds: "≈" 3 under to 1 over, ">" 10 up, "<" 10 down. */
+export function wedgeRange(value, q) {
+ if (q === "≈") return [value - 3, value + 1];
+ if (q === ">") return [value, value + 10];
+ if (q === "<") return [value - 10, value];
+ return null;
+}
+
+/**
+ * The dial face as SVG markup, `size` px square: the bezel, the face, a tick
+ * every 2 lb (longer every 10, longest every 20), a label every 20, the
+ * `mark` weight (300) accented. Static: nothing on it moves.
+ */
+export function dialFaceSvg({ size, scale, mark = 300, colors, labelFont = "sans-serif" }) {
+ const C = size / 2;
+ const R = C - Math.round(size * 0.012);
+ const Rf = R - Math.round(size * 0.026);
+ const u = size / 524;
+ const out = [];
+ out.push(`<circle cx="${C}" cy="${C}" r="${R}" fill="${colors.bezel}"/>`);
+ out.push(`<circle cx="${C}" cy="${C}" r="${Rf}" fill="${colors.face}"/>`);
+ const step = 2;
+ for (let v = Math.ceil(scale.min / step) * step; v <= scale.max + 1e-9; v += step) {
+ const a = dialAngle(v, scale);
+ const major = v % 20 === 0, mid = v % 10 === 0;
+ const [x1, y1] = polar(C, C, Rf - 6 * u, a);
+ const [x2, y2] = polar(C, C, Rf - (major ? 30 : mid ? 22 : 14) * u, a);
+ out.push(`<line x1="${x1}" y1="${y1}" x2="${x2}" y2="${y2}" stroke="${colors.ink}" stroke-width="${r2((major ? 3 : mid ? 2 : 1.2) * u)}" stroke-opacity="${major ? 1 : mid ? 0.85 : 0.6}"/>`);
+ }
+ for (let v = Math.ceil(scale.min / 20) * 20; v <= scale.max + 1e-9; v += 20) {
+ if (Number.isFinite(mark) && v === mark) continue;
+ const [x, y] = polar(C, C, Rf - 54 * u, dialAngle(v, scale));
+ out.push(`<text x="${x}" y="${r2(y + 8 * u)}" text-anchor="middle" font-family="${labelFont}" font-size="${r2(24 * u)}" fill="${colors.ink}">${v}</text>`);
+ }
+ if (Number.isFinite(mark) && mark >= scale.min && mark <= scale.max) {
+ const a = dialAngle(mark, scale);
+ const [x1, y1] = polar(C, C, Rf - 3 * u, a);
+ const [x2, y2] = polar(C, C, Rf - 36 * u, a);
+ out.push(`<line x1="${x1}" y1="${y1}" x2="${x2}" y2="${y2}" stroke="${colors.mark}" stroke-width="${r2(6 * u)}" stroke-linecap="round"/>`);
+ const [x, y] = polar(C, C, Rf - 58 * u, a);
+ out.push(`<text x="${x}" y="${r2(y + 9 * u)}" text-anchor="middle" font-family="${labelFont}" font-size="${r2(28 * u)}" fill="${colors.mark}">${mark}</text>`);
+ }
+ return { svg: `<svg width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">${out.join("")}</svg>`, C, R, Rf, u };
+}
+
+// ---------------------------------------------------------------------------
+// The odometer.
+// ---------------------------------------------------------------------------
+
+/** How many whole-number wheels a total needs (three at least: "000.0"). */
+export const wheelCount = (max) => Math.max(3, String(Math.floor(Math.max(0, max))).length);
+
+/** A total's digits, tenths last: 212.8 with 3 wheels -> [2, 1, 2, 8]. */
+export function wheelDigits(total, wheels) {
+ const tenths = Math.round(Math.max(0, total) * 10);
+ const s = String(tenths).padStart(wheels + 1, "0").slice(-(wheels + 1));
+ return [...s].map(Number);
+}
+
+/**
+ * The wheels' moves for a roll from `a` to `b` (b >= a): per wheel, its
+ * position (a digit, or past 9 to roll forward through 0) at the end, and
+ * whether it lands past 9 and so is set back to its digit the instant after.
+ * A wheel rolls a whole turn more for every ten of its place the total moved,
+ * one turn at most -- the lower wheels spin as a real counter's do.
+ */
+export function wheelRoll(a, b, wheels) {
+ const d0 = wheelDigits(a, wheels);
+ const d1 = wheelDigits(b, wheels);
+ const delta = Math.max(0, b - a);
+ return d1.map((d, i) => {
+ const place = 10 ** (wheels - 1 - i); // tenths last: place 0.1
+ const turns = (d < d0[i] ? 1 : 0) + (delta >= 10 * place && i > 0 ? 1 : 0);
+ const end = d + 10 * Math.min(2, turns);
+ return { from: d0[i], to: end, settle: end !== d ? d : null };
+ });
+}
+
+/** One wheel's strip: the digits 0-9 three times over, so a roll forward never runs out. */
+export const wheelStrip = (cls = "dg") =>
+ Array.from({ length: 30 }, (_, i) => `<div class="${cls}">${i % 10}</div>`).join("");
+
+// ---------------------------------------------------------------------------
+// The page.
+// ---------------------------------------------------------------------------
+
+/**
+ * A measure page: HyperFrames' root and clip `W`x`H` (transparent), `css`,
+ * `body`, and the interpreter over `data` (`init`, `cues`, `total`, and
+ * either `window` -- a whole-cut page's window of the cut, or null -- or
+ * `from`/`dur`, a window page whose cues are in the cut's clock). `id` names
+ * the region: its data script is `<id>-data`, its timeline
+ * `window.__timelines[id]`, and the preview's ready message `<id>:ready`.
+ */
+export function pageHtml({ id, W, H, fps, data, css, body, fonts = {}, gsap = "assets/gsap.min.js" }) {
+ const windowPage = Number.isFinite(data.from) && Number.isFinite(data.dur);
+ const dur = windowPage ? data.dur : data.window ? data.window.dur : data.total;
+ const json = JSON.stringify(data).replace(/</g, "\\u003c");
+ const faces = Object.entries(fonts)
+ .filter(([, src]) => src)
+ .map(([name, src]) => `@font-face { font-family: '${name}'; font-weight: 400; font-style: normal; src: url('${esc(src)}'); }`)
+ .join("\n ");
+ return `<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=${W}, height=${H}" />
+ <script src="${esc(gsap)}"></script>
+ <style>
+ ${faces}
+ * { margin: 0; padding: 0; box-sizing: border-box; }
+ html, body { width: ${W}px; height: ${H}px; overflow: hidden; background: transparent; }
+ body { font-synthesis: none; -webkit-font-smoothing: antialiased; text-rendering: geometricPrecision; }
+ #root { position: relative; width: ${W}px; height: ${H}px; overflow: hidden; }
+ #${id}-clip { position: absolute; left: 0; top: 0; width: ${W}px; height: ${H}px; }
+ ${css}
+ </style>
+ </head>
+ <body>
+ <div id="root" data-composition-id="${id}" data-start="0" data-duration="${pageDuration(dur, fps)}"
+ data-width="${W}" data-height="${H}">
+ <div id="${id}-clip" class="clip" data-start="0" data-duration="${pageDuration(dur, fps)}" data-track-index="1">
+ ${body}
+ </div>
+ </div>
+
+ <script id="${id}-data" type="application/json">${json}</script>
+ <script>
+ const S = JSON.parse(document.getElementById("${id}-data").textContent);
+ const byK = {};
+ for (const el of document.querySelectorAll("[data-k]")) byK[el.dataset.k] = el;
+ // t = 0, then the cues. Every cue states its from, so a seek from
+ // anywhere to anywhere lands on the same pixels.
+ for (const k of Object.keys(S.init)) if (byK[k]) gsap.set(byK[k], S.init[k]);
+ const inner = gsap.timeline({ paused: true });
+ for (const c of S.cues) {
+ const el = byK[c.k];
+ if (!el) continue;
+ inner.fromTo(el, c.from, { ...c.to, duration: c.dur, ease: c.ease, immediateRender: false }, c.at);
+ }
+ const WIN = Number.isFinite(S.from) ? { from: S.from, dur: S.dur } : S.window;
+ inner.set({}, {}, WIN ? WIN.from + WIN.dur : S.total);
+ let tl = inner;
+ if (WIN) {
+ tl = gsap.timeline({ paused: true });
+ tl.add(inner.tweenFromTo(WIN.from, WIN.from + WIN.dur, { duration: WIN.dur, ease: "none" }), 0);
+ // Primed (chrome-cues.mjs primeWindow): a window seeked to exactly 0 -- the renderer's first
+ // frame -- is no change to GSAP and would draw init, not the cut's state at its start.
+ tl.progress(1, true).progress(0, true);
+ }
+ window.__timelines = window.__timelines || {};
+ window.__timelines["${id}"] = tl;
+ const ready = document.fonts.ready.catch(() => {}).then(() => { document.documentElement.dataset.fit = "1"; });
+ const params = new URLSearchParams(location.search);
+ // In CUT seconds, a window's page seeked in its own.
+ const local = (t) => {
+ const v = Number(t) || 0;
+ return WIN ? Math.max(0, Math.min(WIN.dur, v - WIN.from)) : Math.max(0, v);
+ };
+ const still = params.get("still");
+ if (still !== null) {
+ tl.seek(local(still), false);
+ ready.then(() => tl.seek(local(still), false));
+ }
+ // umtool's live preview: the parent seeks in cut seconds, as it seeks the deck.
+ if (params.get("preview") === "1") {
+ window.addEventListener("message", (e) => {
+ const m = e.data || {};
+ if (m.type === "deck:seek") tl.seek(local(m.t), false);
+ });
+ ready.then(() => {
+ if (window.parent !== window) window.parent.postMessage({ type: "${id}:ready", total: S.total }, "*");
+ });
+ }
+ </script>
+ </body>
+</html>
+`;
+}
diff --git a/umtool/report-to-video/modules/contract.mjs b/umtool/report-to-video/modules/contract.mjs
@@ -51,9 +51,10 @@ export const MODULE_KINDS = Object.freeze([
* The layout slots a module may ask for (layout.mjs `slotRect`): the deck's
* band at the foot of the frame, the posts column, the stamp's box in the
* footage, the footage box itself, the side panel beside it, a popup column
- * over the footage, the whole frame, or `inline` (a part, in its host's slot).
+ * over the footage, the measure's instruments' column at the frame's right
+ * (instruments.mjs), the whole frame, or `inline` (a part, in its host's slot).
*/
-export const MODULE_SLOTS = Object.freeze(["footer", "column", "popup", "stamp", "panel", "footage", "side", "full", "inline"]);
+export const MODULE_SLOTS = Object.freeze(["footer", "column", "popup", "stamp", "panel", "footage", "side", "instruments", "full", "inline"]);
/**
* The clocks a module's live page is seeked on (`play.clock`): the cut's
diff --git a/umtool/report-to-video/modules/dial-finale.mjs b/umtool/report-to-video/modules/dial-finale.mjs
@@ -0,0 +1,77 @@
+// THE DIAL'S FINALE (module `dial-finale`, region `dial-finale`): the finale
+// (module `finale`) with the instruments large in its lower column -- the
+// dial's needle dropping from his highest remembered weight to his last
+// stated one, the odometer rolling up to the whole record's total, NET
+// holding beside it. A window over the finale's, laid OVER the finale (z 95):
+// the finale's ground covers the column's instruments while it is up. On with
+// the dial unless `deck.dial.finale` is false; it needs the finale's lower
+// column clear of stats cards (`deck.finale.stats`). chrome-instruments.mjs
+// writes the page.
+import path from "node:path";
+
+import { snapWindow } from "../deck.mjs";
+import { dialFinaleGeometry, dialFinaleHtml } from "../chrome-instruments.mjs";
+import { resolveDial } from "../instruments.mjs";
+import { assertRegion, defineModule } from "./contract.mjs";
+import { hasMeasure, instrumentFonts, noMeasure } from "./instruments-shared.mjs";
+
+const wanted = (render) => resolveDial(render)?.finale === true;
+
+export default defineModule({
+ id: "dial-finale",
+ version: 1,
+ z: 95,
+ kind: "overlay-window",
+ slot: "full",
+ title: "Dial finale",
+ summary: "The finale with the dial and the odometer large: the needle drops to his last stated weight, the wheels roll to the total, NET holds.",
+ docs: {
+ heading: "Dial finale",
+ intro: "With the dial on (`deck.dial`) and a finale (a run of `layout: \"finale\"` clips), the finale's lower column -- beside the clip, under the finale's totals when it draws them -- carries the instruments large over the finale's window: in over the finale's grow, the needle dropping (1.8 s, `back.out`) from his highest remembered weight (the measure's `totals.peakDrift` and remembered weights) to his last stated one (`totals.net.to`), every ghost tick and the latest goal on the bezel; the odometer rolling up from zero to the whole record's `totals.lost` (the rows the cut never shows included) with `ACROSS N RUNS`; NET (`totals.net`) held beside it; out through the finale's dissolve. Laid over the finale (z 95), in Play too. It needs the lower column clear: a finale with stats cards (`deck.finale.stats`) is refused -- set `deck.dial.finale` false, or drop the cards.",
+ rows: [
+ ["`deck.dial.finale`", "bool · default `true` (with the dial on)", "`umtool look <p> deck.dial.finale=false`"],
+ ],
+ },
+ region: "dial-finale",
+ workers: "narrow",
+ noun: "the dial finale's",
+ on: (schedule, render) => !!schedule?.finale && hasMeasure(schedule) && wanted(render),
+ check: (schedule, render) => {
+ if (!schedule.finale) return "the dial's finale needs a schedule with a finale (a clip with layout \"finale\")";
+ if (!hasMeasure(schedule)) return noMeasure("dial's finale");
+ if (!dialFinaleGeometry(schedule, render)) {
+ return "the dial's finale needs the finale's lower column clear: its stats cards (render.chrome.deck.finale.stats) fill it -- drop them, or set render.chrome.deck.dial.finale false";
+ }
+ return null;
+ },
+ window: (schedule, { fps, total }) => snapWindow({ segment: "dial-finale", from: schedule.finale.from, to: schedule.finale.to }, { fps, total }),
+ names: ({ preview }) => ({ project: `dial-finale${preview ? "-preview" : ""}`, stem: "dial-finale" }),
+ async page(ctx) {
+ // `deck.dial.finaleEnd: "promise"` hands off only to a promise module this cut draws (measure-extras').
+ const { moduleById } = await import("./index.mjs");
+ const promise = moduleById("promise");
+ const on = !!promise && (typeof promise.on !== "function" || !!promise.on(ctx.schedule, ctx.render));
+ return dialFinaleHtml(ctx.schedule, ctx.render, ctx.window, { fonts: await instrumentFonts(ctx), promise: on });
+ },
+ /** Over the finale's window, laid at its own second (the finale's own regions, finale.mjs). */
+ regions(schedule, { render, outDir, shift = 0, clip = null }) {
+ const f = schedule?.finale;
+ if (!f || !hasMeasure(schedule)) return [];
+ const g = dialFinaleGeometry(schedule, render);
+ if (!g) return [];
+ const fps = Number(schedule.fps ?? render.fps);
+ const s = snapWindow({ segment: "dial-finale", from: f.from, to: f.to }, { fps, total: schedule.total });
+ if (clip && !(s.from < clip.at + clip.dur && s.to > clip.at)) return [];
+ return [assertRegion({
+ name: "dial-finale",
+ frames: path.join(outDir, "chrome", "dial-finale-frames"),
+ ...g,
+ offset: s.from - shift,
+ frameCount: s.frames,
+ window: s,
+ }, "window")];
+ },
+ play: { clock: "cut", ready: "dial-finale:ready" },
+ // A window of the cut, as the finale's: its frame n is cut time `from` + n / fps.
+ frameKeys: { data: "dial-finale-data", omit: ["init", "cues", "from", "dur"], offset: "from" },
+});
diff --git a/umtool/report-to-video/modules/dial.mjs b/umtool/report-to-video/modules/dial.mjs
@@ -0,0 +1,74 @@
+// THE DIAL (module `dial`, region `dial`): an analog bathroom-scale face in
+// the instruments' column (instruments.mjs, deck.mjs instrumentsGeometry). A
+// red needle swings to every weight he states, on the word, overshoots and
+// settles; "almost", "over", "under" draw a wedge; his remembered weights are
+// grey ghost ticks, the latest a long ghost needle with its as-of date; his
+// latest goal an amber tick on the bezel; the 300 lb mark accented; the
+// weight in big digits under the hub. chrome-instruments.mjs writes the page.
+import path from "node:path";
+
+import { instrumentsGeometry } from "../deck.mjs";
+import { dialHtml } from "../chrome-instruments.mjs";
+import { DIAL_DEFAULTS, resolveDial } from "../instruments.mjs";
+import { assertRegion, defineModule } from "./contract.mjs";
+import { settingsOf } from "./settings.mjs";
+import { cornerCollision, hasMeasure, instrumentFonts, noMeasure, wholeCutKeys } from "./instruments-shared.mjs";
+
+export default defineModule({
+ id: "dial",
+ version: 1,
+ z: 74,
+ kind: "overlay-whole",
+ slot: "instruments",
+ title: "Scale dial",
+ summary: "A bathroom-scale face: the needle swings to each weight he states, his remembered weights as ghosts, his goal on the bezel.",
+ configKey: "render.chrome.deck.dial",
+ defaults: DIAL_DEFAULTS,
+ validate: settingsOf("dial").validate,
+ resolve: resolveDial,
+ ui: [
+ { key: "mark", type: "number", min: 0, max: 2000, step: 1, label: "Accented weight", default: 300 },
+ { key: "ghosts", type: "boolean", label: "Remembered weights as ghosts", default: true },
+ { key: "goal", type: "boolean", label: "The latest goal on the bezel", default: true },
+ { key: "finale", type: "boolean", label: "Large in the finale", default: true },
+ { key: "label", type: "text", label: "Over the digits", default: DIAL_DEFAULTS.label },
+ { key: "placement", type: "enum", options: ["column", "corner"], label: "Where the instruments stand", default: "column" },
+ { key: "size", type: "number", min: 200, max: 540, step: 10, label: "The corner dial's size (px at 1920)", default: 340 },
+ { key: "corner", type: "enum", options: ["bottom-right", "bottom-left", "top-right", "top-left"], label: "The corner", default: "bottom-right" },
+ { key: "motion", type: "enum", options: ["spring", "ease"], label: "The needle's move", default: "spring" },
+ { key: "finaleEnd", type: "enum", options: ["odometer", "promise"], label: "The finale's last beat", default: "odometer" },
+ ],
+ docs: {
+ heading: "Scale dial",
+ intro: "A bathroom-scale face at the top of the instruments' column (the right of the frame; the clip moves to the left -- `instrumentsGeometry`, 1248×702 footage beside a 600 px column at 1920×1080). It reads the schedule's `measure` (the measure ledger's slice): the red needle swings to each STATED weight at its event's `t` (the spoken word) with a spring (`back.out`, 0.9 s) and rests there -- a frame at rest is reused, not captured again; a qualifier draws a wedge in pounds (≈ 3 under to 1 over, `>` 10 up, `<` 10 down); every REMEMBERED weight is a grey tick, the latest a long ghost needle with its as-of date; the latest goal is an amber tick on the bezel and its words under the digits. It comes and goes with the deck (a card, the finale). With any instrument on, the posts stay in the footage box (`posts.shift` does not apply), and the side panel (`threads`, `flips`) and the posts feed are refused.",
+ rows: [
+ ["`deck.dial`", "`true` · an object of the knobs below · absent or `false` off", "`umtool look <p> deck.dial=true`"],
+ ["`deck.dial.mark`", "a weight, or `null` · default `300` (its tick and label in the accent)", "`umtool look <p> deck.dial.mark=300`"],
+ ["`deck.dial.ghosts`, `.goal`", "bool · default `true` each", "`umtool look <p> deck.dial.ghosts=false`"],
+ ["`deck.dial.needle`", "a #hex · default `#ff5a4e`", "`umtool look <p> deck.dial.needle='\"#ff5a4e\"'`"],
+ ["`deck.dial.label`", "words over the digits, ≤ 40 · default `HE SAYS HE WEIGHS`", "`umtool look <p> deck.dial.label='\"…\"'`"],
+ ["`deck.dial.finale`", "bool · default `true`: the dial and the odometer large in the finale (module `dial-finale`)", "`umtool look <p> deck.dial.finale=false`"],
+ ["`deck.dial.placement`", "`column` `corner` · default `column`. A VARIANT: `corner` drops the column -- the footage stays where the deck puts it, the dial a `size` square over its lower-right corner, the odometer and the trail (at 4/5 size) stacked in its lower-left; the side panel is allowed there, the feed still refused", "`umtool look <p> deck.dial.placement=corner`"],
+ ["`deck.dial.size`", "200–540 px at 1920 wide · default `340` (the corner dial only)", "`umtool look <p> deck.dial.size=300`"],
+ ["`deck.dial.corner`", "`bottom-right` `bottom-left` `top-right` `top-left` · default `bottom-right` (the corner only): the dial in that corner, the odometer and the trail up the same side. The measure extras stand at their own anchors in the footage (goals bottom-right, peak top-right, promise top-centre, diet bottom-left, streak bottom-centre): a corner instrument over one that is on is REFUSED by the build, naming it -- move one (`deck.goals.position`, …) or the corner; `top-left` is clear of all five", "`umtool look <p> deck.dial.corner=top-left`"],
+ ["`deck.dial.motion`", "`spring` `ease` · default `spring`. A VARIANT: the needle's `back.out` overshoot and settle, or a plain `power2.inOut` (the finale's drop too)", "`umtool look <p> deck.dial.motion=ease`"],
+ ["`deck.dial.finaleEnd`", "`odometer` `promise` · default `odometer`. A VARIANT: `promise` hands the finale's last beat to the promise clock (module `promise`) -- the instruments fade out once NET has held (`dialFinaleHandoff`); with no promise module on the cut it ends on the odometer", "`umtool look <p> deck.dial.finaleEnd=promise`"],
+ ],
+ },
+ region: "dial",
+ workers: "narrow",
+ noun: "the dial's",
+ on: (schedule, render) => hasMeasure(schedule) && !!resolveDial(render),
+ check: (schedule, render) => (hasMeasure(schedule) ? cornerCollision("dial", render) : noMeasure("dial")),
+ async page(ctx) {
+ return dialHtml(ctx.schedule, ctx.render, { fonts: await instrumentFonts(ctx), from: ctx.from, duration: ctx.duration });
+ },
+ regions(schedule, { render, outDir, frames = null }) {
+ const g = instrumentsGeometry(render).dial;
+ if (!g) return [];
+ return [assertRegion({ name: "dial", frames: frames ?? path.join(outDir, "chrome", "dial-frames"), ...g })];
+ },
+ // Its page is its live preview: Play the cut seeks it in the cut's seconds (contract.mjs, PLAY).
+ play: { clock: "cut", ready: "dial:ready" },
+ frameKeys: wholeCutKeys("dial"),
+});
diff --git a/umtool/report-to-video/modules/index.mjs b/umtool/report-to-video/modules/index.mjs
@@ -31,6 +31,10 @@ import chapter from "./chapter.mjs";
import status from "./status.mjs";
import chat from "./chat.mjs";
import sectionTitle from "./section-title.mjs";
+import dial from "./dial.mjs";
+import odometer from "./odometer.mjs";
+import trail from "./trail.mjs";
+import dialFinale from "./dial-finale.mjs";
import diet from "./diet.mjs";
import peak from "./peak.mjs";
import goals from "./goals.mjs";
@@ -41,7 +45,7 @@ export { assertRegion, defineModule, MODULE_KINDS, MODULE_SLOTS, PLAY_CLOCKS, RE
/** Every module, by z (stack order), then id. */
export const MODULES = Object.freeze(
- [chart, shell, subtitle, qr, rail, sectionTitle, counter, claims, feed, popupPosts, stamp, stats, fx, threads, flips, finale, teaser, intro, blur, pair, chapter, status, chat, diet, peak, goals, promise, streak]
+ [chart, shell, subtitle, qr, rail, sectionTitle, counter, claims, feed, popupPosts, stamp, stats, fx, threads, flips, finale, teaser, intro, blur, pair, chapter, status, chat, diet, peak, goals, promise, streak, dial, odometer, trail, dialFinale]
.sort((a, b) => a.z - b.z || a.id.localeCompare(b.id)),
);
diff --git a/umtool/report-to-video/modules/instruments-shared.mjs b/umtool/report-to-video/modules/instruments-shared.mjs
@@ -0,0 +1,63 @@
+// What the measure's instrument modules share (dial, odometer, trail,
+// dial-finale): their faces -- the deck's, plus the manifest's display and
+// condensed faces when it names them (`render.fontDisplay`,
+// `render.fontCondensed`) -- and their frame-key model.
+import { INSTRUMENT_FONTS } from "../chrome-instruments.mjs";
+import { instrumentsGeometry } from "../deck.mjs";
+import { instrumentsPlacement, resolveDial } from "../instruments.mjs";
+import { measureExtraGeometry } from "../measure-extras.mjs";
+import { MEASURE_EXTRAS, resolveMeasureExtra } from "./measure-extras-settings.mjs";
+
+/**
+ * The faces a measure page draws in, copied in beside it: `{ DeckSans,
+ * DeckSansBold, MeasureDisplay?, MeasureCond? }` asset paths. A display or
+ * condensed face that cannot be copied is left out, and the page falls back
+ * to the deck's bold or regular.
+ */
+export async function instrumentFonts(ctx) {
+ const deck = await ctx.fonts({ regular: "DeckSans", bold: "DeckSansBold" }, { strict: true });
+ const out = { DeckSans: deck.regular, DeckSansBold: deck.bold };
+ for (const [key, name] of [["fontDisplay", INSTRUMENT_FONTS.display], ["fontCondensed", INSTRUMENT_FONTS.condensed]]) {
+ const src = ctx.render?.[key];
+ if (typeof src !== "string" || !src) continue;
+ const ext = (/\.[A-Za-z0-9]+$/.exec(src)?.[0] ?? ".ttf").toLowerCase();
+ try {
+ out[name] = await ctx.asset(src, `${name}${ext}`);
+ } catch {
+ // The deck's face stands in.
+ }
+ }
+ return out;
+}
+
+/** A whole-cut cue interpreter's frame keys (frame-keys.mjs): its data less what is keyed per frame. */
+export const wholeCutKeys = (region) => ({ data: `${region}-data`, omit: ["init", "cues", "window", "total"] });
+
+/** Is the measure in the schedule: what every instrument draws from. */
+export const hasMeasure = (schedule) => !!(schedule?.measure && Array.isArray(schedule.measure.state) && schedule.measure.scale);
+
+/** The sentence a page refuses with when the schedule has no measure. */
+export const noMeasure = (what) =>
+ `the ${what} needs a schedule with a measure (a manifest with a measure ledger and render.chrome.deck.measure)`;
+
+/**
+ * In the corner (`deck.dial.placement: "corner"`) an instrument stands in the
+ * footage box, where the measure extras (goals, peak, promise, diet, streak;
+ * measure-extras.mjs) stand at their anchors: the sentence naming each one the
+ * instrument `id` would cover and how to move one, or null. The column never
+ * meets them (they are in the footage, it is beside it).
+ */
+export function cornerCollision(id, render) {
+ if (instrumentsPlacement(render) !== "corner") return null;
+ const mine = instrumentsGeometry(render)[id];
+ if (!mine) return null;
+ const hit = (a, b) => a.x < b.x + b.width && b.x < a.x + a.width && a.y < b.y + b.height && b.y < a.y + a.height;
+ const over = MEASURE_EXTRAS.filter((x) => {
+ const cfg = resolveMeasureExtra(x, render);
+ return cfg && cfg.show !== false && hit(mine, measureExtraGeometry(x, render));
+ });
+ if (!over.length) return null;
+ const corner = resolveDial(render)?.corner ?? "bottom-right";
+ return `the corner ${id} (render.chrome.deck.dial.placement "corner", ${corner}) covers ${over.map((x) => `the ${x} (render.chrome.deck.${x}.position ${resolveMeasureExtra(x, render).position})`).join(" and ")}: ` +
+ `move one -- deck.${over[0]}.position, or deck.dial.corner`;
+}
diff --git a/umtool/report-to-video/modules/layout.mjs b/umtool/report-to-video/modules/layout.mjs
@@ -9,7 +9,7 @@
// Pure. The numbers are deck.mjs's geometry functions' -- those stay the one
// arithmetic, and this file is the one place a module asks them.
import {
- deckGeometry, feedGeometry, fxGeometry, postsGeometry, stampGeometry, statsGeometry, threadsGeometry,
+ deckGeometry, feedGeometry, fxGeometry, instrumentsGeometry, postsGeometry, stampGeometry, statsGeometry, threadsGeometry,
} from "../deck.mjs";
import { MODULE_SLOTS } from "./contract.mjs";
import { DESIGN, designScale } from "./design.mjs";
@@ -28,6 +28,9 @@ export { DESIGN, designScale };
* - `stamp`: the fact-check stamp's box in the footage, at its position.
* - `panel`: the stats panel in the footage, at its position.
* - `side`: the side panel (the thread rail, the flips) beside the footage.
+ * - `instruments`: the measure's instruments' column at the frame's right
+ * (the dial, the odometer, the trail; instruments.mjs), the footage moved
+ * to the left for it.
* - `full`: the whole frame.
*
* @param {string} slot
@@ -53,6 +56,8 @@ export function slotRect(slot, render, { feed = false } = {}) {
const { cards: _c, ...box } = threadsGeometry(render);
return box;
}
+ case "instruments":
+ return { ...instrumentsGeometry(render).column };
case "full":
return { x: 0, y: 0, width: render?.width ?? DESIGN.width, height: render?.height ?? DESIGN.height };
default:
diff --git a/umtool/report-to-video/modules/odometer.mjs b/umtool/report-to-video/modules/odometer.mjs
@@ -0,0 +1,57 @@
+// THE ODOMETER (module `odometer`, region `odometer`): mechanical rolling
+// digits of the pounds he says he has lost, under the dial in the
+// instruments' column. The total is the measure's (the odometer rule: the
+// highest real-time claim in each run, summed -- "go by his words"), held to
+// its running highest so the wheels only ever roll up; NET beside it in plain
+// digits. chrome-instruments.mjs writes the page.
+import path from "node:path";
+
+import { instrumentsGeometry } from "../deck.mjs";
+import { odometerHtml } from "../chrome-instruments.mjs";
+import { ODOMETER_DEFAULTS, resolveOdometer } from "../instruments.mjs";
+import { assertRegion, defineModule } from "./contract.mjs";
+import { settingsOf } from "./settings.mjs";
+import { cornerCollision, hasMeasure, instrumentFonts, noMeasure, wholeCutKeys } from "./instruments-shared.mjs";
+
+export default defineModule({
+ id: "odometer",
+ version: 1,
+ z: 75,
+ kind: "overlay-whole",
+ slot: "instruments",
+ title: "Lost odometer",
+ summary: "Rolling digits of the pounds he says he has lost (only ever up), NET beside them.",
+ configKey: "render.chrome.deck.odometer",
+ defaults: ODOMETER_DEFAULTS,
+ validate: settingsOf("odometer").validate,
+ resolve: resolveOdometer,
+ ui: [
+ { key: "label", type: "text", label: "Over the wheels", default: ODOMETER_DEFAULTS.label },
+ { key: "net", type: "boolean", label: "NET beside them", default: true },
+ { key: "runs", type: "boolean", label: "How many runs", default: true },
+ ],
+ docs: {
+ heading: "Lost odometer",
+ intro: "Under the dial: the measure's `state.lost.total` (the highest real-time loss claim in each run, summed) on mechanical wheels to a tenth, rolling forward at each claim that raises it (1.3 s) and never back -- a lower total is held at the highest so far. NET (`state.net`: the first stated weight of the record to the latest) in plain digits beside it, `−76.5 · 368 → 291.5`; `ACROSS 8 RUNS` under the wheels.",
+ rows: [
+ ["`deck.odometer`", "`true` · an object of the knobs below · absent or `false` off", "`umtool look <p> deck.odometer=true`"],
+ ["`deck.odometer.label`", "words over the wheels, ≤ 40 · default `POUNDS HE SAYS HE'S LOST`", "`umtool look <p> deck.odometer.label='\"…\"'`"],
+ ["`deck.odometer.net`, `.runs`", "bool · default `true` each", "`umtool look <p> deck.odometer.net=false`"],
+ ],
+ },
+ region: "odometer",
+ workers: "narrow",
+ noun: "the odometer's",
+ on: (schedule, render) => hasMeasure(schedule) && !!resolveOdometer(render),
+ check: (schedule, render) => (hasMeasure(schedule) ? cornerCollision("odometer", render) : noMeasure("odometer")),
+ async page(ctx) {
+ return odometerHtml(ctx.schedule, ctx.render, { fonts: await instrumentFonts(ctx), from: ctx.from, duration: ctx.duration });
+ },
+ regions(schedule, { render, outDir, frames = null }) {
+ const g = instrumentsGeometry(render).odometer;
+ if (!g) return [];
+ return [assertRegion({ name: "odometer", frames: frames ?? path.join(outDir, "chrome", "odometer-frames"), ...g })];
+ },
+ play: { clock: "cut", ready: "odometer:ready" },
+ frameKeys: wholeCutKeys("odometer"),
+});
diff --git a/umtool/report-to-video/modules/panel.mjs b/umtool/report-to-video/modules/panel.mjs
@@ -42,6 +42,10 @@ const TOGGLES = Object.freeze({
intro: { style: "boot-dark", site: "auto" },
claims: null,
"section-title": {},
+ // The measure's instruments (instruments.mjs): on while `deck.<id>` is there.
+ dial: {},
+ odometer: {},
+ trail: {},
});
/** Is this module toggled by its object's presence, and what does turning it on write? */
diff --git a/umtool/report-to-video/modules/rail.test.mjs b/umtool/report-to-video/modules/rail.test.mjs
@@ -47,5 +47,5 @@ test("rail settings: spacing, pitch, and the deck's other keys refused by name",
assert.equal(resolveDeck(render({})).pip.pitch, undefined, "no pitch unless set: the deck resolves as it did");
assert.equal(rail.resolve(render({ spacing: "pitch" })).pip.pitch, 28);
assert.equal(rail.validate, settingsOf("rail").validate);
- assert.deepEqual(SETTINGS.map((s) => s.id), ["stamp", "threads", "flips", "stats", "fx", "chat", "pair", "chapter", "status", "finale", "claims", "measure", "counter", "shell", "rail", "section-title", "subtitle", "qr", "popup-posts", "diet", "peak", "goals", "promise", "streak"]);
+ assert.deepEqual(SETTINGS.map((s) => s.id), ["stamp", "threads", "flips", "stats", "fx", "chat", "pair", "chapter", "status", "finale", "claims", "measure", "counter", "shell", "rail", "section-title", "subtitle", "qr", "popup-posts", "dial", "odometer", "trail", "diet", "peak", "goals", "promise", "streak"]);
});
diff --git a/umtool/report-to-video/modules/registry.test.mjs b/umtool/report-to-video/modules/registry.test.mjs
@@ -46,9 +46,9 @@ test("the registry: unique ids and regions, sorted by z, the deck's overlays in
const ids = MODULES.map((m) => m.id);
assert.equal(new Set(ids).size, ids.length);
for (let i = 1; i < MODULES.length; i += 1) assert.ok(MODULES[i - 1].z <= MODULES[i].z);
- // The order the build has always laid them in: the finale last of all but the
- // promise clock, which is drawn over it (the measure extras, z 65-68 and 95).
- assert.deepEqual(deckOverlays().map((m) => m.region), ["deck", "feed", "posts", "stamp", "chat", "stats", "pair", "status", "fx", "streak", "diet", "peak", "goals", "threads", "flips", "chapter", "finale", "promise"]);
+ // The order the build has always laid them in, the measure's instruments beside the side panel; the
+ // finale over all of them but the dial's finale and the promise clock, drawn over it (z 95 both).
+ assert.deepEqual(deckOverlays().map((m) => m.region), ["deck", "feed", "posts", "stamp", "chat", "stats", "pair", "status", "fx", "streak", "diet", "peak", "goals", "threads", "dial", "odometer", "trail", "flips", "chapter", "finale", "dial-finale", "promise"]);
assert.equal(moduleOfRegion("deck").id, "shell");
assert.equal(regionModule("posts").id, "popup-posts");
assert.throws(() => regionModule("nope"), /unknown chrome region: nope/);
@@ -58,8 +58,8 @@ test("the registry: unique ids and regions, sorted by z, the deck's overlays in
});
test("placement and caching come from the module's kind", () => {
- for (const r of ["deck", "feed", "stamp", "chat", "stats", "fx", "threads", "flips"]) assert.equal(placementOf(r), "whole", r);
- for (const r of ["posts", "finale"]) assert.equal(placementOf(r), "window", r);
+ for (const r of ["deck", "feed", "stamp", "chat", "stats", "fx", "threads", "flips", "dial", "odometer", "trail"]) assert.equal(placementOf(r), "whole", r);
+ for (const r of ["posts", "finale", "dial-finale"]) assert.equal(placementOf(r), "window", r);
assert.equal(placementOf("chart"), null);
assert.equal(placementOf("teaser"), null);
assert.deepEqual(regionCaching("deck"), { keyed: true, wholeCut: true });
@@ -152,7 +152,7 @@ test("play: a live-preview contract only an overlay with a page and regions decl
assert.throws(() => defineModule({ ...base, play: { clock: "cut", ready: "x" } }), /play must be/);
assert.throws(() => defineModule({ ...base, page: undefined, play: { clock: "cut", ready: "x:ready" } }), /only an overlay with a page/);
assert.throws(() => defineModule({ ...base, kind: "segment", play: { clock: "cut", ready: "x:ready" } }), /only an overlay with a page/);
- assert.deepEqual(playModules().map((m) => m.id), ["stats", "pair", "status", "fx", "streak", "diet", "peak", "goals", "threads", "flips", "chapter", "promise"]);
+ assert.deepEqual(playModules().map((m) => m.id), ["stats", "pair", "status", "fx", "streak", "diet", "peak", "goals", "threads", "dial", "odometer", "trail", "flips", "chapter", "dial-finale", "promise"]);
for (const m of playModules()) assert.equal(m.play.ready, `${m.region}:ready`, m.id);
});
diff --git a/umtool/report-to-video/modules/settings.mjs b/umtool/report-to-video/modules/settings.mjs
@@ -19,6 +19,7 @@ import { validateFx } from "../fx.mjs";
import { validateChat } from "../chat.mjs";
import { validateChapter, validatePair, validateStatus } from "./story-settings.mjs";
import { MARKER_LEVELS, MARKER_LIMITS } from "../marker-limits.mjs";
+import { validateDial, validateOdometer, validateTrail } from "../instruments.mjs";
import { MEASURE_EXTRAS, validateMeasureExtra } from "./measure-extras-settings.mjs";
import { validateMeasureSettings } from "../measure-slice.mjs";
@@ -482,6 +483,10 @@ export const SETTINGS = Object.freeze([
{ id: "subtitle", key: "deck", configKey: "render.chrome.deck.subtitle", deck: true, whole: true, validate: validateSubtitleSettings },
{ id: "qr", key: "deck", configKey: "render.chrome.deck.qr", deck: true, whole: true, validate: validateQrSettings },
{ id: "popup-posts", key: "deck", configKey: "render.chrome.deck.posts", deck: true, whole: true, validate: validatePostsSettings },
+ // The measure's instruments (instruments.mjs): the dial, the odometer, the trail.
+ { id: "dial", key: "deck.dial", configKey: "render.chrome.deck.dial", deck: true, validate: (v, { where }) => validateDial(v, `${where}.dial`) },
+ { id: "odometer", key: "deck.odometer", configKey: "render.chrome.deck.odometer", deck: true, validate: (v, { where }) => validateOdometer(v, `${where}.odometer`) },
+ { id: "trail", key: "deck.trail", configKey: "render.chrome.deck.trail", deck: true, validate: (v, { where }) => validateTrail(v, `${where}.trail`) },
// The measure extras (measure-extras-settings.mjs): the goal stack, the moving
// start, the promise clock and the diet badge, each its own deck key.
...MEASURE_EXTRAS.map((id) => ({
diff --git a/umtool/report-to-video/modules/trail.mjs b/umtool/report-to-video/modules/trail.mjs
@@ -0,0 +1,57 @@
+// THE TRAIL (module `trail`, region `trail`): his stated weights as a thin
+// line by DATE (not cut time) at the foot of the instruments' column, each
+// point appearing as he says it and the line drawn between neighbours once
+// both are said; the 300 lb line; how many times he says he is under it.
+// chrome-instruments.mjs writes the page.
+import path from "node:path";
+
+import { instrumentsGeometry } from "../deck.mjs";
+import { trailHtml } from "../chrome-instruments.mjs";
+import { resolveTrail, TRAIL_DEFAULTS } from "../instruments.mjs";
+import { assertRegion, defineModule } from "./contract.mjs";
+import { settingsOf } from "./settings.mjs";
+import { cornerCollision, hasMeasure, instrumentFonts, noMeasure, wholeCutKeys } from "./instruments-shared.mjs";
+
+export default defineModule({
+ id: "trail",
+ version: 1,
+ z: 76,
+ kind: "overlay-whole",
+ slot: "instruments",
+ title: "Weight trail",
+ summary: "His stated weights by date, drawn up to the playhead, the 300 lb line and the times he says he is under it.",
+ configKey: "render.chrome.deck.trail",
+ defaults: TRAIL_DEFAULTS,
+ validate: settingsOf("trail").validate,
+ resolve: resolveTrail,
+ ui: [
+ { key: "mark", type: "number", min: 0, max: 2000, step: 1, label: "The line across", default: 300 },
+ { key: "count", type: "boolean", label: "Count the \"under 300\" claims", default: true },
+ { key: "label", type: "text", label: "Its title", default: TRAIL_DEFAULTS.label },
+ ],
+ docs: {
+ heading: "Weight trail",
+ intro: "At the foot of the instruments' column: every STATED weight the cut shows, placed by the date he was weighed (its `asOf`, else its date) across the span of them, a dot appearing at its event's `t` and the line between two neighbours drawn once both are said; a red ring on the latest said. The `mark` line (300) dashed across; with `count` and the mark at 300, `UNDER 300 · SAID n×` counts the measure's `totals.under300` rows as the cut reaches each.",
+ rows: [
+ ["`deck.trail`", "`true` · an object of the knobs below · absent or `false` off", "`umtool look <p> deck.trail=true`"],
+ ["`deck.trail.mark`", "a weight, or `null` · default `300`", "`umtool look <p> deck.trail.mark=300`"],
+ ["`deck.trail.count`", "bool · default `true`", "`umtool look <p> deck.trail.count=false`"],
+ ["`deck.trail.label`", "its title, ≤ 40 · default `WHAT HE SAYS HE WEIGHS, BY DATE`", "`umtool look <p> deck.trail.label='\"…\"'`"],
+ ],
+ },
+ region: "trail",
+ workers: "narrow",
+ noun: "the trail's",
+ on: (schedule, render) => hasMeasure(schedule) && !!resolveTrail(render),
+ check: (schedule, render) => (hasMeasure(schedule) ? cornerCollision("trail", render) : noMeasure("trail")),
+ async page(ctx) {
+ return trailHtml(ctx.schedule, ctx.render, { fonts: await instrumentFonts(ctx), from: ctx.from, duration: ctx.duration });
+ },
+ regions(schedule, { render, outDir, frames = null }) {
+ const g = instrumentsGeometry(render).trail;
+ if (!g) return [];
+ return [assertRegion({ name: "trail", frames: frames ?? path.join(outDir, "chrome", "trail-frames"), ...g })];
+ },
+ play: { clock: "cut", ready: "trail:ready" },
+ frameKeys: wholeCutKeys("trail"),
+});