demoman 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +7 -6
  2. package/THIRD_PARTY_NOTICES +155 -29
  3. package/dist/demoman.mjs +2196 -1146
  4. package/dist/page/executor-entry.js +16 -3
  5. package/dist/page/mux-entry.js +192 -81
  6. package/dist/page/render-entry.js +602 -613
  7. package/dist/page/resolve-entry.js +16 -3
  8. package/dist/recipe.md +70 -59
  9. package/dist/studio/assets/confirm-dialog-CN_GqXY_.js +72 -0
  10. package/dist/studio/assets/confirm-dialog-Dd_hs1Bv.css +1 -0
  11. package/dist/studio/assets/editor-Cy1V14-4.js +4 -0
  12. package/dist/studio/assets/{editor-inline-3529c61f.css → editor-inline-7e387eed.css} +65 -1
  13. package/dist/studio/assets/library-CQtDqEvE.js +1 -0
  14. package/dist/studio/assets/settings-C4OPkolR.js +1 -0
  15. package/dist/studio/assets/{settings-inline-081bd3f0.css → settings-inline-ff6d2eee.css} +2 -142
  16. package/dist/studio/assets/topbar-sSUyITjl.js +1 -0
  17. package/dist/studio/assets/view-DsZQo9AJ.js +1 -0
  18. package/dist/studio/editor.html +5 -6
  19. package/dist/studio/icon/32.png +0 -0
  20. package/dist/studio/images/icon.svg +3 -6
  21. package/dist/studio/images/lockup_dark.svg +10 -13
  22. package/dist/studio/images/lockup_light.svg +10 -13
  23. package/dist/studio/images/logomark.svg +2 -8
  24. package/dist/studio/library.html +4 -9
  25. package/dist/studio/settings.html +6 -11
  26. package/dist/studio/studio-build.json +3 -3
  27. package/package.json +10 -1
  28. package/dist/studio/assets/editor-BTGqbeOf.js +0 -4
  29. package/dist/studio/assets/library-BgPfg1Id.js +0 -1
  30. package/dist/studio/assets/settings-Bq1e7Iz8.js +0 -1
  31. package/dist/studio/assets/switch-Bn7Uwnf1.js +0 -1
  32. package/dist/studio/assets/theme-D59pt_a-.js +0 -72
  33. package/dist/studio/assets/theme-D6wPSXx4.css +0 -1
  34. package/dist/studio/assets/topbar-Dq9UrNEm.js +0 -1
  35. package/dist/studio/icon/128.png +0 -0
  36. package/dist/studio/icon/16.png +0 -0
  37. package/dist/studio/icon/48.png +0 -0
  38. package/dist/studio/icon/recording/128.png +0 -0
  39. package/dist/studio/icon/recording/16.png +0 -0
  40. package/dist/studio/icon/recording/32.png +0 -0
  41. package/dist/studio/icon/recording/48.png +0 -0
@@ -15464,7 +15464,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15464
15464
  type: { cursorTravels: true, approach: "nearest" },
15465
15465
  moveTo: { cursorTravels: true, approach: "nearest" },
15466
15466
  scrollTo: { cursorTravels: false, approach: "landing" },
15467
- waitFor: { cursorTravels: false, approach: "none" }
15467
+ waitFor: { cursorTravels: false, approach: "none" },
15468
+ drag: { cursorTravels: true, approach: "nearest" }
15468
15469
  };
15469
15470
 
15470
15471
  // ../../packages/compositor/dist/bundle.js
@@ -15507,7 +15508,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15507
15508
  var AnchorRectSchema = external_exports.object({
15508
15509
  actionId: external_exports.string().min(1),
15509
15510
  anchorId: external_exports.string().min(1),
15510
- rect: RectSchema
15511
+ rect: RectSchema,
15512
+ /** A drag's end, measured with its start; absent for every other verb. */
15513
+ end: RectSchema.optional()
15514
+ });
15515
+ var HeldPressSchema = external_exports.object({
15516
+ actionId: external_exports.string().min(1),
15517
+ pressMs: external_exports.number().nonnegative(),
15518
+ releaseMs: external_exports.number().nonnegative()
15511
15519
  });
15512
15520
  var ViewportTransformSchema = external_exports.object({
15513
15521
  sourceTimeMs: external_exports.number().nonnegative(),
@@ -15550,7 +15558,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15550
15558
  /** The typed text; null for every verb that types nothing, and for a
15551
15559
  * redacted field whose value was never recorded. */
15552
15560
  text: external_exports.string().nullable(),
15553
- cut: external_exports.boolean()
15561
+ cut: external_exports.boolean().optional()
15554
15562
  });
15555
15563
  var DegradationSchema = external_exports.object({
15556
15564
  startMs: external_exports.number().nonnegative(),
@@ -15625,7 +15633,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15625
15633
  // `buildLaneModel` turns a nonzero count into a capture-lane clip and a
15626
15634
  // lane-label chip under this name. Named here so the two surfaces share
15627
15635
  // one word for one condition.
15628
- "pacingUnplaced"
15636
+ "pacingUnplaced",
15637
+ // A drag whose press and release both arrived and that changed nothing
15638
+ // on screen: no native drag began and the pixels between its ends were
15639
+ // the same after as before. The page ignored it, so the step is listed
15640
+ // as diverged rather than read as done (2026-10-21).
15641
+ "notDragged",
15642
+ // A native drag's picture could not be drawn in the page (the element
15643
+ // the page named for it was gone, or copying it threw). The drag still
15644
+ // ran; the film shows the card jump to its drop instead of travelling.
15645
+ "dragPictureMissing"
15629
15646
  ]),
15630
15647
  note: external_exports.string()
15631
15648
  });
@@ -15681,6 +15698,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15681
15698
  // written without this field, and they are all still readable.
15682
15699
  cursorGaps: external_exports.array(CursorGapSchema).default([]),
15683
15700
  anchorRects: external_exports.array(AnchorRectSchema),
15701
+ // Optional, and absent is none: only a run with a drag writes any.
15702
+ heldPresses: external_exports.array(HeldPressSchema).optional(),
15684
15703
  // Optional, and absent is identity: every bundle written before
15685
15704
  // 2026-10-11 carries none, and identity is what they were drawn as.
15686
15705
  // See `ViewportTransformSchema`.
@@ -15960,7 +15979,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15960
15979
  });
15961
15980
 
15962
15981
  // ../../packages/scene-schema/dist/document.js
15963
- var CURRENT_SCHEMA_VERSION = 10;
15982
+ var CURRENT_SCHEMA_VERSION = 12;
15964
15983
  var Rect = external_exports.object({
15965
15984
  x: external_exports.number(),
15966
15985
  y: external_exports.number(),
@@ -16131,17 +16150,43 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16131
16150
  kind: external_exports.literal("waitFor"),
16132
16151
  condition: external_exports.enum(["visible", "hidden", "loaded"]).optional()
16133
16152
  });
16153
+ var Spot = external_exports.object({
16154
+ x: external_exports.number().min(0).max(1),
16155
+ y: external_exports.number().min(0).max(1)
16156
+ });
16157
+ var Drag = external_exports.object({
16158
+ ...actionBase,
16159
+ kind: external_exports.literal("drag"),
16160
+ /** Null when the end was an offset, which names no element. */
16161
+ toAnchorId: external_exports.string().min(1).nullable(),
16162
+ toRect: Rect.optional(),
16163
+ fromAt: Spot.optional(),
16164
+ /** Where it pressed when the walk chose the spot itself — a native
16165
+ * range's thumb, where a press at the centre would jump its value — as a
16166
+ * spot in `rect`. Absent: `fromAt`, else the centre. Never written back
16167
+ * into a script: a re-run reads the thumb afresh. */
16168
+ pressedAt: Spot.optional(),
16169
+ to: external_exports.union([
16170
+ external_exports.object({ at: Spot.optional() }).strict(),
16171
+ external_exports.object({ by: external_exports.object({ x: external_exports.number(), y: external_exports.number() }) }).strict()
16172
+ ])
16173
+ });
16134
16174
  var Action = external_exports.discriminatedUnion("kind", [
16135
16175
  MoveTo,
16136
16176
  Click,
16137
16177
  TypeAction,
16138
16178
  ScrollTo,
16139
- WaitFor
16179
+ WaitFor,
16180
+ Drag
16140
16181
  ]);
16141
16182
  var MarkerSchema2 = external_exports.object({
16142
16183
  actionId: external_exports.string().min(1),
16143
16184
  offsetMs: external_exports.number()
16144
16185
  });
16186
+ var SourcePointSchema = external_exports.object({
16187
+ actionId: external_exports.string().min(1),
16188
+ sourceOffsetMs: external_exports.number()
16189
+ });
16145
16190
  var Point = external_exports.object({ x: external_exports.number(), y: external_exports.number() });
16146
16191
  var CameraEvent = external_exports.object({
16147
16192
  id: external_exports.string().min(1),
@@ -16178,12 +16223,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16178
16223
  named.push(["afterActionId", skip.afterActionId]);
16179
16224
  return named;
16180
16225
  }
16181
- var Replacement = external_exports.object({
16182
- id: external_exports.string().min(1),
16183
- targetAnchorId: external_exports.string().min(1).nullable(),
16184
- find: external_exports.string().nullable(),
16185
- replace: external_exports.string()
16186
- });
16187
16226
  var Mask = external_exports.object({
16188
16227
  id: external_exports.string().min(1),
16189
16228
  rect: Rect,
@@ -16203,12 +16242,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16203
16242
  afterActionId: external_exports.string().min(1),
16204
16243
  durationMs: external_exports.number().nonnegative()
16205
16244
  });
16206
- var Cut = external_exports.object({
16207
- id: external_exports.string().min(1),
16208
- actionId: external_exports.string().min(1),
16209
- /** The author chose to keep a jump rather than have export rebuild it. */
16210
- keepJump: external_exports.literal(true).optional()
16211
- });
16212
16245
  var NetworkEntry = external_exports.object({
16213
16246
  id: external_exports.string().min(1),
16214
16247
  method: external_exports.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]),
@@ -16392,8 +16425,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16392
16425
  background: NEUTRAL_BACKGROUND,
16393
16426
  logo: null,
16394
16427
  /**
16395
- * 8%: Screen Studio's margin, near enough (measured 8.4% on 2026-10-05),
16396
- * and the smallest padding that draws the default logo at full size.
16428
+ * 8%: the margin of a polished recording, near enough (8.4% measured on
16429
+ * 2026-10-05), and the smallest padding that draws the default logo at
16430
+ * full size.
16397
16431
  * `placeLogo` keeps a mark 0.02 × short in from the edge and clear of the
16398
16432
  * recording, so a logo of size `s` fits only when the padding is at least
16399
16433
  * `s + 0.02`, and `LOGO_DEFAULTS.size` is 0.06.
@@ -16418,11 +16452,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16418
16452
  /** See `ZoomSkipped`. */
16419
16453
  zoomsSkipped: external_exports.array(ZoomSkipped).optional(),
16420
16454
  edits: external_exports.object({
16421
- replacements: external_exports.array(Replacement),
16422
16455
  masks: external_exports.array(Mask),
16423
16456
  holds: external_exports.array(Hold),
16424
16457
  gaps: external_exports.array(Gap).default([]),
16425
- cuts: external_exports.array(Cut).default([]),
16458
+ /** Where the author split the clip. A split alone removes nothing. */
16459
+ splits: external_exports.array(external_exports.object({ id: external_exports.string().min(1), at: SourcePointSchema })).default([]),
16460
+ /**
16461
+ * Stretches of the frames the author removed. A null side is that end
16462
+ * of the take. Its edits stay in the document; what it removes is
16463
+ * resolved against the frames by the compositor.
16464
+ */
16465
+ removed: external_exports.array(external_exports.object({
16466
+ id: external_exports.string().min(1),
16467
+ start: SourcePointSchema.nullable(),
16468
+ end: SourcePointSchema.nullable()
16469
+ })).default([]),
16426
16470
  /**
16427
16471
  * A cut on the OUTPUT axis, never on the action log: a step outside
16428
16472
  * the trim still exists and a Rebuild still performs it (that is what
@@ -16473,19 +16517,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16473
16517
  unique(doc.edits.holds, "hold", ["edits", "holds"]);
16474
16518
  unique(doc.edits.gaps, "gap", ["edits", "gaps"]);
16475
16519
  unique(doc.edits.gaps.map((g) => ({ id: g.afterActionId })), "gap for an action", ["edits", "gaps"]);
16476
- unique(doc.edits.cuts, "cut", ["edits", "cuts"]);
16477
- unique(doc.edits.cuts.map((c) => ({ id: c.actionId })), "cut for an action", ["edits", "cuts"]);
16520
+ unique(doc.edits.splits, "split", ["edits", "splits"]);
16521
+ unique(doc.edits.removed, "removed piece", ["edits", "removed"]);
16478
16522
  const anchorIds = new Set(doc.anchors.map((a) => a.id));
16479
16523
  const actionIds = new Set(doc.actions.map((a) => a.id));
16480
- doc.edits.cuts.forEach((c, i) => {
16481
- if (!actionIds.has(c.actionId)) {
16482
- ctx.addIssue({
16483
- code: "custom",
16484
- message: `unknown action "${c.actionId}"`,
16485
- path: ["edits", "cuts", i, "actionId"]
16486
- });
16487
- }
16488
- });
16489
16524
  doc.actions.forEach((a, i) => {
16490
16525
  if (a.anchorId !== null && !anchorIds.has(a.anchorId)) {
16491
16526
  ctx.addIssue({
@@ -16575,24 +16610,36 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16575
16610
  });
16576
16611
  }
16577
16612
  }
16578
- doc.edits.replacements.forEach((r, i) => {
16579
- if (r.targetAnchorId !== null && !anchorIds.has(r.targetAnchorId)) {
16613
+ doc.edits.holds.forEach((h, i) => {
16614
+ if (!actionIds.has(h.marker.actionId)) {
16580
16615
  ctx.addIssue({
16581
16616
  code: "custom",
16582
- message: `unknown anchor "${r.targetAnchorId}"`,
16583
- path: ["edits", "replacements", i, "targetAnchorId"]
16617
+ message: `unknown action "${h.marker.actionId}"`,
16618
+ path: ["edits", "holds", i, "marker", "actionId"]
16584
16619
  });
16585
16620
  }
16586
16621
  });
16587
- doc.edits.holds.forEach((h, i) => {
16588
- if (!actionIds.has(h.marker.actionId)) {
16622
+ (doc.edits.splits ?? []).forEach((split, i) => {
16623
+ if (!actionIds.has(split.at.actionId)) {
16589
16624
  ctx.addIssue({
16590
16625
  code: "custom",
16591
- message: `unknown action "${h.marker.actionId}"`,
16592
- path: ["edits", "holds", i, "marker", "actionId"]
16626
+ message: `unknown action "${split.at.actionId}"`,
16627
+ path: ["edits", "splits", i, "at", "actionId"]
16593
16628
  });
16594
16629
  }
16595
16630
  });
16631
+ (doc.edits.removed ?? []).forEach((range, i) => {
16632
+ for (const side of ["start", "end"]) {
16633
+ const point2 = range[side];
16634
+ if (point2 !== null && !actionIds.has(point2.actionId)) {
16635
+ ctx.addIssue({
16636
+ code: "custom",
16637
+ message: `unknown action "${point2.actionId}"`,
16638
+ path: ["edits", "removed", i, side, "actionId"]
16639
+ });
16640
+ }
16641
+ }
16642
+ });
16596
16643
  doc.edits.gaps.forEach((g, i) => {
16597
16644
  if (!actionIds.has(g.afterActionId)) {
16598
16645
  ctx.addIssue({
@@ -16604,12 +16651,52 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16604
16651
  });
16605
16652
  });
16606
16653
 
16654
+ // ../../packages/scene-schema/dist/drag.js
16655
+ function spotIn(rect2, at) {
16656
+ if (at === void 0) {
16657
+ return { x: rect2.x + rect2.width / 2, y: rect2.y + rect2.height / 2 };
16658
+ }
16659
+ return { x: rect2.x + at.x * rect2.width, y: rect2.y + at.y * rect2.height };
16660
+ }
16661
+ function dragEndPoint(start, to, toRect) {
16662
+ if ("by" in to)
16663
+ return { x: start.x + to.by.x, y: start.y + to.by.y };
16664
+ return toRect == null ? null : spotIn(toRect, to.at);
16665
+ }
16666
+ function dragPoints(action, rect2, toRect) {
16667
+ if (rect2 === void 0)
16668
+ return null;
16669
+ const start = spotIn(rect2, action.pressedAt ?? action.fromAt);
16670
+ const end = dragEndPoint(start, action.to, toRect);
16671
+ return end === null ? null : { start, end };
16672
+ }
16673
+
16674
+ // ../../packages/scene-schema/dist/removed.js
16675
+ function stepsInsideRemoved(doc) {
16676
+ const index = new Map(doc.actions.map((a, i) => [a.id, i]));
16677
+ const inside = /* @__PURE__ */ new Set();
16678
+ for (const range of doc.edits.removed ?? []) {
16679
+ const s = range.start === null ? null : index.get(range.start.actionId);
16680
+ const e = range.end === null ? null : index.get(range.end.actionId);
16681
+ if (s === void 0 || e === void 0)
16682
+ continue;
16683
+ doc.actions.forEach((action, i) => {
16684
+ const afterStart = range.start === null || s === null || s < i || i === s && range.start.sourceOffsetMs <= 0;
16685
+ const beforeEnd = range.end === null || e === null || i < e || i === e && range.end.sourceOffsetMs > 0;
16686
+ if (afterStart && beforeEnd)
16687
+ inside.add(action.id);
16688
+ });
16689
+ }
16690
+ return inside;
16691
+ }
16692
+
16607
16693
  // ../../packages/scene-schema/dist/script.js
16608
16694
  var SCRIPT_VERSION = 1;
16609
16695
  var SCRIPT_VERSION_KIT = 2;
16610
16696
  var SCRIPT_VERSION_MOTION = 3;
16611
16697
  var SCRIPT_VERSION_DEVICE = 4;
16612
16698
  var SCRIPT_VERSION_ACCOUNT = 5;
16699
+ var SCRIPT_VERSION_DRAG = 6;
16613
16700
  var ACCOUNT_NAME = /^[a-z0-9][a-z0-9_-]{0,63}$/;
16614
16701
  var ACCOUNT_NAME_RULE = 'lower-case letters, digits, "-" and "_", starting with a letter or digit, at most 64 characters';
16615
16702
  var ScriptTargetSchema = external_exports.union([
@@ -16619,6 +16706,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16619
16706
  external_exports.object({ treePath: external_exports.string().min(1) }).strict()
16620
16707
  ]);
16621
16708
  var RecordedSchema = external_exports.string().min(1).optional();
16709
+ var DragSpotSchema = external_exports.object({ x: external_exports.number().min(0).max(1), y: external_exports.number().min(0).max(1) }).strict();
16710
+ var DragFromSchema = external_exports.object({ on: ScriptTargetSchema, at: DragSpotSchema.optional() }).strict();
16711
+ var DragToSchema = external_exports.union([
16712
+ DragFromSchema,
16713
+ external_exports.object({
16714
+ by: external_exports.object({ x: external_exports.number().finite(), y: external_exports.number().finite() }).strict()
16715
+ }).strict()
16716
+ ]);
16622
16717
  var ScriptStepSchema = external_exports.discriminatedUnion("do", [
16623
16718
  external_exports.object({
16624
16719
  do: external_exports.literal("click"),
@@ -16669,6 +16764,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16669
16764
  until: external_exports.enum(["visible", "hidden"]),
16670
16765
  recorded: RecordedSchema
16671
16766
  }).strict(),
16767
+ external_exports.object({
16768
+ do: external_exports.literal("drag"),
16769
+ from: DragFromSchema,
16770
+ to: DragToSchema,
16771
+ recorded: RecordedSchema
16772
+ }).strict(),
16672
16773
  external_exports.object({ do: external_exports.literal("waitForLoad"), recorded: RecordedSchema }).strict(),
16673
16774
  external_exports.object({ do: external_exports.literal("pause"), ms: external_exports.number().positive() }).strict()
16674
16775
  ]);
@@ -16678,6 +16779,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16678
16779
  hover: true,
16679
16780
  scrollTo: true,
16680
16781
  waitFor: true,
16782
+ drag: true,
16681
16783
  waitForLoad: true,
16682
16784
  pause: false
16683
16785
  };
@@ -16690,7 +16792,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16690
16792
  SCRIPT_VERSION_KIT,
16691
16793
  SCRIPT_VERSION_MOTION,
16692
16794
  SCRIPT_VERSION_DEVICE,
16693
- SCRIPT_VERSION_ACCOUNT
16795
+ SCRIPT_VERSION_ACCOUNT,
16796
+ SCRIPT_VERSION_DRAG
16694
16797
  ]),
16695
16798
  name: external_exports.string().min(1),
16696
16799
  target: external_exports.url(),
@@ -16766,17 +16869,36 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16766
16869
  if (script.device !== void 0 && script.scriptVersion < SCRIPT_VERSION_DEVICE) {
16767
16870
  ctx.addIssue({
16768
16871
  code: "custom",
16769
- message: `a script that names device declares scriptVersion ${SCRIPT_VERSION_DEVICE}: a build from before devices would drop it and film the desktop`,
16872
+ message: `a script that names device declares scriptVersion ${SCRIPT_VERSION_DEVICE}: a build from before devices would drop it and record the desktop`,
16770
16873
  path: ["scriptVersion"]
16771
16874
  });
16772
16875
  }
16773
16876
  if (script.account !== void 0 && script.scriptVersion < SCRIPT_VERSION_ACCOUNT) {
16774
16877
  ctx.addIssue({
16775
16878
  code: "custom",
16776
- message: `a script that names account declares scriptVersion ${SCRIPT_VERSION_ACCOUNT}: a build from before accounts would drop it and film as whoever is signed in`,
16879
+ message: `a script that names account declares scriptVersion ${SCRIPT_VERSION_ACCOUNT}: a build from before accounts would drop it and record as whoever is signed in`,
16777
16880
  path: ["scriptVersion"]
16778
16881
  });
16779
16882
  }
16883
+ script.steps.forEach((step, index) => {
16884
+ if (step.do !== "drag")
16885
+ return;
16886
+ if (script.scriptVersion < SCRIPT_VERSION_DRAG) {
16887
+ ctx.addIssue({
16888
+ code: "custom",
16889
+ message: `a script that uses drag declares scriptVersion ${SCRIPT_VERSION_DRAG}: a build from before drag would refuse the step`,
16890
+ path: ["scriptVersion"]
16891
+ });
16892
+ }
16893
+ const nowhere = "by" in step.to ? step.to.by.x === 0 && step.to.by.y === 0 : JSON.stringify(step.to.on) === JSON.stringify(step.from.on) && (step.to.at?.x ?? 0.5) === (step.from.at?.x ?? 0.5) && (step.to.at?.y ?? 0.5) === (step.from.at?.y ?? 0.5);
16894
+ if (nowhere) {
16895
+ ctx.addIssue({
16896
+ code: "custom",
16897
+ message: `step ${index + 1} is a drag that starts and ends at the same point: give \`to\` another target, spot or offset, or make it a click`,
16898
+ path: ["steps", index, "to"]
16899
+ });
16900
+ }
16901
+ });
16780
16902
  script.steps.forEach((step, index) => {
16781
16903
  if (step.do !== "type" || !/\{secret:/.test(step.text))
16782
16904
  return;
@@ -16844,55 +16966,48 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16844
16966
  const markerAt = new Map(bundle.markers.map((m) => [m.actionId, m.sourceTimeMs]));
16845
16967
  const resolved = [];
16846
16968
  const unplacedCuts = [];
16847
- for (const run of plan.cuts ?? []) {
16848
- const { ids, actionIds } = run;
16849
- const first = actionIds[0];
16850
- const unplaced = (reason) => {
16851
- unplacedCuts.push({ ids, actionIds, reason });
16969
+ for (const piece of plan.removed ?? []) {
16970
+ const ids = [piece.id];
16971
+ const sourceOf = (point2, ifNull) => {
16972
+ if (point2 === null)
16973
+ return ifNull;
16974
+ const marker = markerAt.get(point2.actionId);
16975
+ if (marker === void 0) {
16976
+ return `these frames carry no marker for "${point2.actionId}", so where this piece ${ifNull === 0 ? "starts" : "ends"} is unknown and no frames were removed`;
16977
+ }
16978
+ return clamp(marker + point2.sourceOffsetMs, 0, sourceDurationMs);
16852
16979
  };
16853
- if (first === void 0) {
16854
- unplaced("this cut names no step");
16855
- continue;
16856
- }
16857
- const srcStartMs = markerAt.get(first);
16858
- if (srcStartMs === void 0) {
16859
- unplaced(`these frames carry no marker for "${first}", so they never contained that step and no frames were removed`);
16980
+ const start = sourceOf(piece.start, 0);
16981
+ const end = sourceOf(piece.end, sourceDurationMs);
16982
+ if (typeof start === "string" || typeof end === "string") {
16983
+ unplacedCuts.push({
16984
+ ids,
16985
+ reason: typeof start === "string" ? start : end
16986
+ });
16860
16987
  continue;
16861
16988
  }
16862
- let srcEndMs;
16863
- if (run.untilActionId === null) {
16864
- srcEndMs = sourceDurationMs;
16865
- } else {
16866
- const end = markerAt.get(run.untilActionId);
16867
- if (end === void 0) {
16868
- unplaced(`these frames carry no marker for "${run.untilActionId}", the step this cut runs up to, so where the cut ends is unknown and no frames were removed`);
16869
- continue;
16870
- }
16871
- srcEndMs = end;
16872
- }
16873
- if (srcEndMs <= srcStartMs) {
16874
- unplaced(`this cut's two markers land at the same instant (${Math.round(srcStartMs)}ms) or out of order, so it covers no frames`);
16989
+ if (end <= start) {
16990
+ unplacedCuts.push({
16991
+ ids,
16992
+ reason: `this piece's two ends land at the same instant (${Math.round(start)}ms) or out of order, so it covers no frames`
16993
+ });
16875
16994
  continue;
16876
16995
  }
16877
16996
  resolved.push({
16878
16997
  ids,
16879
- actionIds,
16880
- srcStartMs,
16881
- srcEndMs,
16882
- keepJump: run.keepJump,
16883
- trailing: run.untilActionId === null
16998
+ srcStartMs: start,
16999
+ srcEndMs: end,
17000
+ trailing: end >= sourceDurationMs
16884
17001
  });
16885
17002
  }
16886
17003
  resolved.sort((a, b) => a.srcStartMs - b.srcStartMs);
16887
17004
  const cuts = [];
16888
17005
  for (const cut of resolved) {
16889
17006
  const previous = cuts[cuts.length - 1];
16890
- if (previous && cut.srcStartMs < previous.srcEndMs) {
16891
- unplacedCuts.push({
16892
- ids: cut.ids,
16893
- actionIds: cut.actionIds,
16894
- reason: `this cut's frames overlap the cut before it (${Math.round(previous.srcStartMs)}\u2013${Math.round(previous.srcEndMs)}ms), which means these frames run the take's steps out of order \u2014 nothing was removed for it`
16895
- });
17007
+ if (previous && cut.srcStartMs <= previous.srcEndMs) {
17008
+ previous.ids.push(...cut.ids);
17009
+ previous.srcEndMs = Math.max(previous.srcEndMs, cut.srcEndMs);
17010
+ previous.trailing ||= cut.trailing;
16896
17011
  continue;
16897
17012
  }
16898
17013
  cuts.push(cut);
@@ -17091,10 +17206,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17091
17206
  ...cuts,
17092
17207
  ...interruptions.map((span) => ({
17093
17208
  ids: [],
17094
- actionIds: [],
17095
17209
  srcStartMs: span.startMs,
17096
17210
  srcEndMs: span.endMs,
17097
- keepJump: false,
17098
17211
  trailing: false
17099
17212
  }))
17100
17213
  ].sort((a, b) => a.srcStartMs - b.srcStartMs);
@@ -17251,7 +17364,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17251
17364
  stiffness: lerp(8, 5.5, smoothness),
17252
17365
  zoomInMs: lerp(1e3, 1600, smoothness),
17253
17366
  zoomOutMs: lerp(700, 1150, smoothness),
17254
- followPanMs: lerp(500, 900, smoothness)
17367
+ followRatePerS: lerp(13, 7, smoothness)
17255
17368
  };
17256
17369
  }
17257
17370
  var DEFAULT_TIMINGS = motionTimings(MOTION_DEFAULTS.smoothness);
@@ -17343,6 +17456,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17343
17456
  };
17344
17457
  function planCameraIntents(scene, cutSteps, attached) {
17345
17458
  const order = new Map(scene.actions.map((a, i) => [a.id, i]));
17459
+ const actionOf = new Map(scene.actions.map((a) => [a.id, a]));
17460
+ const fitOf = (event) => {
17461
+ const action = actionOf.get(event.marker.actionId);
17462
+ if (event.point === void 0 || action?.kind !== "drag")
17463
+ return {};
17464
+ const ends = dragPoints(action, action.rect, action.toRect);
17465
+ if (ends === null)
17466
+ return {};
17467
+ const x = Math.min(ends.start.x, ends.end.x);
17468
+ const y = Math.min(ends.start.y, ends.end.y);
17469
+ return {
17470
+ fit: {
17471
+ x,
17472
+ y,
17473
+ width: Math.max(ends.start.x, ends.end.x) - x,
17474
+ height: Math.max(ends.start.y, ends.end.y) - y
17475
+ }
17476
+ };
17477
+ };
17346
17478
  return scene.camera.flatMap((event) => {
17347
17479
  if (cutSteps.has(event.marker.actionId)) {
17348
17480
  attached.push({
@@ -17361,16 +17493,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17361
17493
  actionId: event.marker.actionId,
17362
17494
  offsetMs: event.marker.offsetMs,
17363
17495
  scale: clamp(event.scale ?? 1, 1, CAMERA_DEFAULTS.maxScale),
17364
- end: event.end ?? null
17496
+ end: event.end ?? null,
17497
+ ...fitOf(event)
17365
17498
  })).filter((intent) => intent.scale > 1).sort((a, b) => {
17366
17499
  const byAction = (order.get(a.actionId) ?? 0) - (order.get(b.actionId) ?? 0);
17367
17500
  return byAction !== 0 ? byAction : a.offsetMs - b.offsetMs;
17368
17501
  });
17369
17502
  }
17370
- function solveCamera(intents, rectOf, timeline, markerSourceMs, viewport, fitWindow = null, motion = MOTION_DEFAULTS, actEnds = /* @__PURE__ */ new Map()) {
17503
+ function solveCamera(intents, rectOf, timeline, markerSourceMs, viewport, fitWindow = null, motion = MOTION_DEFAULTS, actEnds = /* @__PURE__ */ new Map(), holds = []) {
17371
17504
  const timings = motionTimings(motion.smoothness);
17372
17505
  const neutral = { x: viewport.width / 2, y: viewport.height / 2 };
17373
17506
  const seeds = [];
17507
+ const actEndOf = /* @__PURE__ */ new Map();
17374
17508
  for (const intent of intents) {
17375
17509
  const rect2 = intent.point ? { x: intent.point.x, y: intent.point.y, width: 0, height: 0 } : intent.anchorId ? rectOf(intent.anchorId, intent.actionId) : null;
17376
17510
  if (!rect2)
@@ -17383,21 +17517,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17383
17517
  const resolvedEndMs = intent.end ? markerOutputMs(intent.end, timeline, markerSourceMs) : null;
17384
17518
  const asked = clamp(intent.scale, 1, CAMERA_DEFAULTS.maxScale);
17385
17519
  const requested = Math.max(asked, clamp(intent.requestedScale ?? intent.scale, 1, CAMERA_DEFAULTS.maxScale));
17386
- const scale = fitWindow === null ? asked : clamp(fitScaleFor(rect2, fitWindow), 1, asked);
17387
- let notBeforeMs = Number.NEGATIVE_INFINITY;
17520
+ const scale = fitWindow === null ? asked : clamp(fitScaleFor(intent.fit ?? rect2, fitWindow), 1, asked);
17521
+ let actEndMs = Number.NEGATIVE_INFINITY;
17388
17522
  for (const [actionId, endMs] of actEnds) {
17389
17523
  const at = markerSourceMs.get(actionId);
17390
17524
  if (at === void 0 || at >= sourceMs)
17391
17525
  continue;
17392
- notBeforeMs = Math.max(notBeforeMs, toOutputMs(timeline, endMs) + CAMERA_DEFAULTS.actSettleMs);
17526
+ actEndMs = Math.max(actEndMs, toOutputMs(timeline, endMs));
17393
17527
  }
17394
- const transitionMs = outputMs - timings.zoomInMs < notBeforeMs ? Math.max(MIN_PAN_MS, Math.min(timings.zoomInMs, outputMs - notBeforeMs)) : timings.zoomInMs;
17395
- seeds.push({
17528
+ const seed = {
17396
17529
  id: intent.id,
17397
17530
  outputTimeMs: outputMs,
17398
17531
  center: rectCenter(rect2),
17399
17532
  scale,
17400
- transitionMs,
17533
+ // Shortened below for an earlier act, once every seed is known.
17534
+ transitionMs: timings.zoomInMs,
17401
17535
  stiffness: timings.stiffness,
17402
17536
  zoom: true,
17403
17537
  authoredEndMs: resolvedEndMs,
@@ -17409,7 +17543,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17409
17543
  } : null,
17410
17544
  actionMs,
17411
17545
  plannedTransitionMs: timings.zoomInMs
17412
- });
17546
+ };
17547
+ seeds.push(seed);
17548
+ actEndOf.set(seed, actEndMs);
17549
+ }
17550
+ seeds.sort((a, b) => a.outputTimeMs - b.outputTimeMs);
17551
+ for (const [i, seed] of seeds.entries()) {
17552
+ const before = seeds[i - 1];
17553
+ const pans = before !== void 0 && !returnsBetween(heldUntilOf(before, seed.actionMs, holds), seed.outputTimeMs, timings);
17554
+ const notBeforeMs = (actEndOf.get(seed) ?? Number.NEGATIVE_INFINITY) + (pans ? 0 : CAMERA_DEFAULTS.actSettleMs);
17555
+ if (seed.outputTimeMs - timings.zoomInMs < notBeforeMs) {
17556
+ seed.transitionMs = Math.max(MIN_PAN_MS, Math.min(timings.zoomInMs, seed.outputTimeMs - notBeforeMs));
17557
+ }
17413
17558
  }
17414
17559
  return insertNeutralKeys([
17415
17560
  {
@@ -17429,7 +17574,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17429
17574
  plannedTransitionMs: 0
17430
17575
  },
17431
17576
  ...seeds
17432
- ].sort((a, b) => a.outputTimeMs - b.outputTimeMs), timeline.outputDurationMs, timings);
17577
+ ].sort((a, b) => a.outputTimeMs - b.outputTimeMs), timeline.outputDurationMs, timings, holds);
17433
17578
  }
17434
17579
  function fitScaleFor(rect2, window2) {
17435
17580
  const margin = 2 * CAMERA_DEFAULTS.fitMarginPx;
@@ -17437,7 +17582,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17437
17582
  return Math.floor(fit * 100) / 100;
17438
17583
  }
17439
17584
  var MIN_PAN_MS = 150;
17440
- function insertNeutralKeys(seeds, outputDurationMs, timings) {
17585
+ function heldUntilOf(seed, nextActionMs, holds) {
17586
+ const outBy = Math.min(seed.outputTimeMs + CAMERA_DEFAULTS.neutral.zoomHoldMs, nextActionMs);
17587
+ return Math.max(seed.outputTimeMs, ...holds.filter((h) => h.startMs >= seed.actionMs && h.startMs < outBy).map((h) => h.endMs));
17588
+ }
17589
+ function returnsBetween(heldUntilMs, nextArrivalMs, timings) {
17590
+ const { minPlateauMs } = CAMERA_DEFAULTS.neutral;
17591
+ return nextArrivalMs - timings.zoomInMs - minPlateauMs >= heldUntilMs + minPlateauMs + timings.zoomOutMs;
17592
+ }
17593
+ function insertNeutralKeys(seeds, outputDurationMs, timings, holds = []) {
17441
17594
  const { neutral } = CAMERA_DEFAULTS;
17442
17595
  const { zoomOutMs } = timings;
17443
17596
  const keys = [];
@@ -17457,21 +17610,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17457
17610
  stiffness: timings.stiffness
17458
17611
  });
17459
17612
  for (const [i, seed] of seeds.entries()) {
17613
+ const previousMs = keys[keys.length - 1]?.outputTimeMs ?? seed.outputTimeMs;
17614
+ const departMs = Math.max(previousMs, seed.outputTimeMs - seed.transitionMs);
17460
17615
  keys.push(strip(seed));
17461
17616
  if (!seed.zoom)
17462
17617
  continue;
17463
- const earliestMs = seed.outputTimeMs + neutral.minPlateauMs + zoomOutMs;
17464
- const idealMs = seed.outputTimeMs + neutral.zoomHoldMs + zoomOutMs;
17618
+ const next = seeds[i + 1];
17619
+ const heldUntil = heldUntilOf(seed, next?.actionMs ?? Number.POSITIVE_INFINITY, holds);
17620
+ const earliestMs = heldUntil + neutral.minPlateauMs + zoomOutMs;
17621
+ const idealMs = heldUntil + neutral.zoomHoldMs + zoomOutMs;
17465
17622
  const wantedMs = seed.authoredEndMs ?? idealMs;
17466
17623
  const resolvedAuthored = seed.authoredEndMs !== null;
17467
17624
  const authored = resolvedAuthored || seed.endUnplaced;
17468
17625
  const movedFromWanted = (endMs) => resolvedAuthored && Math.abs(endMs - wantedMs) > 1e-6;
17469
- const next = seeds[i + 1];
17470
17626
  if (!next) {
17471
17627
  const atMs2 = Math.min(Math.max(wantedMs, earliestMs), outputDurationMs);
17472
17628
  if (atMs2 <= seed.outputTimeMs) {
17473
17629
  segments.push({
17474
17630
  id: seed.id,
17631
+ departMs,
17475
17632
  startMs: seed.outputTimeMs,
17476
17633
  endMs: outputDurationMs,
17477
17634
  endAuthored: authored,
@@ -17484,6 +17641,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17484
17641
  keys.push(pullOut(atMs2, seed.center));
17485
17642
  segments.push({
17486
17643
  id: seed.id,
17644
+ departMs,
17487
17645
  startMs: seed.outputTimeMs,
17488
17646
  endMs: atMs2,
17489
17647
  endAuthored: authored,
@@ -17494,14 +17652,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17494
17652
  continue;
17495
17653
  }
17496
17654
  const latestMs = next.outputTimeMs - next.plannedTransitionMs - neutral.minPlateauMs;
17497
- if (latestMs < earliestMs) {
17498
- const settledMs = Math.max(seed.outputTimeMs, seed.actionMs) + neutral.minPlateauMs;
17655
+ if (!returnsBetween(heldUntil, next.outputTimeMs, {
17656
+ zoomInMs: next.plannedTransitionMs,
17657
+ zoomOutMs
17658
+ })) {
17659
+ const settledMs = Math.max(seed.outputTimeMs, seed.actionMs, heldUntil) + neutral.minPlateauMs;
17499
17660
  seeds[i + 1] = {
17500
17661
  ...next,
17501
17662
  transitionMs: Math.max(MIN_PAN_MS, Math.min(next.transitionMs, next.outputTimeMs - settledMs))
17502
17663
  };
17503
17664
  segments.push({
17504
17665
  id: seed.id,
17666
+ departMs,
17505
17667
  startMs: seed.outputTimeMs,
17506
17668
  endMs: next.outputTimeMs,
17507
17669
  endAuthored: authored,
@@ -17515,6 +17677,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17515
17677
  keys.push(pullOut(atMs, lerpVec(seed.center, next.center, 0.5)));
17516
17678
  segments.push({
17517
17679
  id: seed.id,
17680
+ departMs,
17518
17681
  startMs: seed.outputTimeMs,
17519
17682
  endMs: atMs,
17520
17683
  endAuthored: authored,
@@ -17593,6 +17756,89 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17593
17756
  return { center: last2.center, scale: last2.scale };
17594
17757
  }
17595
17758
 
17759
+ // ../../packages/compositor/dist/plan/camera-follow.js
17760
+ var FOLLOW_STEP_MS = 8;
17761
+ function departs(keys, i) {
17762
+ const key = keys[i];
17763
+ const before = keys[i - 1];
17764
+ if (!before)
17765
+ return key.outputTimeMs;
17766
+ return key.outputTimeMs - Math.min(key.transitionMs, key.outputTimeMs - before.outputTimeMs);
17767
+ }
17768
+ function solveFollow(args) {
17769
+ const { keys, cursorAt, holds, outputDurationMs } = args;
17770
+ const omega = args.rate / 1e3;
17771
+ const held = (t) => holds.some((h) => h.startMs <= t && t < h.endMs);
17772
+ const stretches = [];
17773
+ for (let i = 1; i < keys.length; i++) {
17774
+ const landing = keys[i];
17775
+ if (landing.scale <= 1 || keys[i - 1].scale > 1)
17776
+ continue;
17777
+ let last2 = i;
17778
+ while ((keys[last2 + 1]?.scale ?? 0) > 1)
17779
+ last2++;
17780
+ const out = last2 + 1 < keys.length ? last2 + 1 : null;
17781
+ const endMs = out === null ? outputDurationMs : keys[out].outputTimeMs;
17782
+ const pullOutDepartMs = out === null ? outputDurationMs : departs(keys, out);
17783
+ const departures = keys.slice(i + 1, last2 + 1).map((key, k) => ({ at: departs(keys, i + 1 + k), center: key.center }));
17784
+ let aimed = -1;
17785
+ const aimAt = (t) => {
17786
+ while (aimed + 1 < departures.length && (departures[aimed + 1]?.at ?? Number.POSITIVE_INFINITY) <= t) {
17787
+ aimed++;
17788
+ }
17789
+ return departures[aimed]?.center ?? landing.center;
17790
+ };
17791
+ const targetAt = (t) => (cursorAt !== null && !held(t) ? cursorAt(t) : null) ?? aimAt(t);
17792
+ let x = landing.center;
17793
+ let v = { x: 0, y: 0 };
17794
+ const centers = [x];
17795
+ for (let t = landing.outputTimeMs; t < endMs; t += FOLLOW_STEP_MS) {
17796
+ const target = targetAt(t);
17797
+ const dt = Math.min(FOLLOW_STEP_MS, endMs - t);
17798
+ const e = Math.exp(-omega * dt);
17799
+ const step = (y, vel) => {
17800
+ const k = vel + omega * y;
17801
+ return { y: (y + k * dt) * e, v: (vel - omega * k * dt) * e };
17802
+ };
17803
+ const sx = step(x.x - target.x, v.x);
17804
+ const sy = step(x.y - target.y, v.y);
17805
+ x = { x: target.x + sx.y, y: target.y + sy.y };
17806
+ v = { x: sx.v, y: sy.v };
17807
+ centers.push(x);
17808
+ }
17809
+ stretches.push({
17810
+ startMs: landing.outputTimeMs,
17811
+ pullOutDepartMs,
17812
+ endMs,
17813
+ centers
17814
+ });
17815
+ i = last2;
17816
+ }
17817
+ return stretches;
17818
+ }
17819
+ function sampleTrack(track, outputTimeMs) {
17820
+ const base = sampleCamera(track.cameraKeys, outputTimeMs);
17821
+ if (base.scale <= 1)
17822
+ return base;
17823
+ const stretch = track.cameraFollow.find((s) => s.startMs <= outputTimeMs && outputTimeMs <= s.endMs);
17824
+ if (!stretch)
17825
+ return base;
17826
+ const last2 = stretch.centers.length - 1;
17827
+ const i = Math.min(Math.floor((outputTimeMs - stretch.startMs) / FOLLOW_STEP_MS), last2);
17828
+ const timeOf = (k) => Math.min(stretch.startMs + k * FOLLOW_STEP_MS, stretch.endMs);
17829
+ const here = stretch.centers[i];
17830
+ const next = stretch.centers[i + 1];
17831
+ const spring = next === void 0 ? here : lerpVec(here, next, (outputTimeMs - timeOf(i)) / (timeOf(i + 1) - timeOf(i)));
17832
+ if (outputTimeMs < stretch.pullOutDepartMs) {
17833
+ return { center: spring, scale: base.scale };
17834
+ }
17835
+ const from = sampleCamera(track.cameraKeys, stretch.pullOutDepartMs).scale;
17836
+ if (from <= 1)
17837
+ return base;
17838
+ const w = (base.scale - 1) / (from - 1);
17839
+ return { center: lerpVec(base.center, spring, w), scale: base.scale };
17840
+ }
17841
+
17596
17842
  // ../../packages/compositor/dist/plan/cursor.js
17597
17843
  var CURSOR_DEFAULTS2 = {
17598
17844
  // Half the pace these once set (240-700ms, 180ms + 0.35ms/px): the author
@@ -17679,170 +17925,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17679
17925
  // ../../packages/compositor/dist/version.js
17680
17926
  var COMPOSITOR_VERSION = "1.1.0";
17681
17927
 
17682
- // ../../packages/compositor/dist/plan/scene-walk.js
17683
- function nextKeptActionId(scene, actionId, cutSteps) {
17684
- const idx = scene.actions.findIndex((a) => a.id === actionId);
17685
- if (idx === -1)
17686
- return null;
17687
- for (let i = idx + 1; i < scene.actions.length; i++) {
17688
- const action = scene.actions[i];
17689
- if (action && !cutSteps.has(action.id))
17690
- return action.id;
17691
- }
17692
- return null;
17693
- }
17694
- function pageKey(url3) {
17695
- const hash2 = url3.indexOf("#");
17696
- return hash2 === -1 ? url3 : url3.slice(0, hash2);
17697
- }
17698
- function pageChangeAfter(scene, actionId) {
17699
- const index = scene.actions.findIndex((a) => a.id === actionId);
17700
- const step = scene.actions[index];
17701
- if (step === void 0)
17702
- return null;
17703
- const trace = scene.sideChannels.urlTrace;
17704
- let here = scene.meta.capture.originUrl;
17705
- for (const entry2 of trace)
17706
- if (entry2.timestamp <= step.timestamp)
17707
- here = entry2.url;
17708
- const anchorPage = (anchorId) => anchorId === null ? null : scene.anchors.find((a) => a.id === anchorId)?.resolution.url ?? null;
17709
- const stepPage = anchorPage(step.anchorId);
17710
- const nav = trace.find((entry2) => entry2.timestamp > step.timestamp && pageKey(entry2.url) !== pageKey(here));
17711
- let leaveAt = nav === void 0 ? null : nav.timestamp;
17712
- if (stepPage !== null) {
17713
- for (let i = index + 1; i < scene.actions.length; i++) {
17714
- const later = scene.actions[i];
17715
- if (later === void 0)
17716
- continue;
17717
- const page = anchorPage(later.anchorId);
17718
- if (page !== null && pageKey(page) !== pageKey(stepPage)) {
17719
- if (leaveAt === null || later.timestamp < leaveAt)
17720
- leaveAt = later.timestamp;
17721
- break;
17722
- }
17723
- }
17724
- }
17725
- if (leaveAt === null)
17726
- return null;
17727
- let from = step;
17728
- for (let i = index + 1; i < scene.actions.length; i++) {
17729
- const later = scene.actions[i];
17730
- if (later === void 0 || later.timestamp > leaveAt)
17731
- break;
17732
- from = later;
17733
- }
17734
- return { actionId: from.id, offsetMs: Math.max(0, leaveAt - from.timestamp) };
17735
- }
17736
-
17737
17928
  // ../../packages/compositor/dist/plan/cosmetics.js
17738
- function planCosmetics(scene, cutSteps, attached, overlays) {
17739
- const replacements = scene.edits.replacements.filter((r) => r.targetAnchorId !== null).map((r) => ({
17740
- id: r.id,
17741
- kind: "replacement",
17742
- anchorId: r.targetAnchorId,
17743
- rect: null,
17744
- text: r.replace,
17745
- range: null,
17746
- reveal: null
17747
- }));
17748
- const retexts = overlays.flatMap((overlay) => {
17749
- if (cutSteps.has(overlay.actionId)) {
17750
- attached.push({
17751
- id: `retext:${overlay.actionId}`,
17752
- kind: "retext",
17753
- actionId: overlay.actionId
17754
- });
17755
- return [];
17756
- }
17757
- const until = nextKeptActionId(scene, overlay.actionId, cutSteps);
17758
- return [
17759
- {
17760
- id: `retext:${overlay.actionId}`,
17761
- kind: "replacement",
17762
- anchorId: overlay.anchorId,
17763
- rect: null,
17764
- text: overlay.text,
17765
- // From the step until the take leaves its page: the field holds its
17766
- // value while it is on screen, and not a moment after — the end of
17767
- // the video only when the take never leaves (`pageChangeAfter`).
17768
- range: {
17769
- start: { actionId: overlay.actionId, offsetMs: 0 },
17770
- end: pageChangeAfter(scene, overlay.actionId)
17771
- },
17772
- // Typed across the step's own stretch — the same span a cut of this
17773
- // step would remove, and the closest thing the take has to "how long
17774
- // the author spent typing".
17775
- reveal: {
17776
- start: { actionId: overlay.actionId, offsetMs: 0 },
17777
- end: until === null ? null : { actionId: until, offsetMs: 0 }
17778
- }
17779
- }
17780
- ];
17781
- });
17782
- const masks = scene.edits.masks.flatMap((m) => {
17929
+ function planCosmetics(scene, cutSteps, attached) {
17930
+ return scene.edits.masks.flatMap((m) => {
17783
17931
  const range = m.start && m.end ? { start: m.start, end: m.end } : null;
17784
17932
  if (range && cutSteps.has(range.start.actionId)) {
17785
17933
  attached.push({ id: m.id, kind: "mask", actionId: range.start.actionId });
17786
17934
  return [];
17787
17935
  }
17788
- return [
17789
- {
17790
- id: m.id,
17791
- kind: "mask",
17792
- anchorId: null,
17793
- rect: m.rect,
17794
- text: null,
17795
- range,
17796
- reveal: null
17797
- }
17798
- ];
17936
+ return [{ id: m.id, kind: "mask", rect: m.rect, range }];
17799
17937
  });
17800
- return [...replacements, ...retexts, ...masks];
17801
17938
  }
17802
17939
 
17803
17940
  // ../../packages/compositor/dist/plan/plan.js
17804
17941
  var RETIMING_DEFAULTS = {
17805
17942
  motionDiffThreshold: 0.02
17806
17943
  };
17807
- function planCuts(scene) {
17808
- const cutOf = new Map((scene.edits.cuts ?? []).map((cut) => [cut.actionId, cut]));
17809
- if (cutOf.size === 0)
17810
- return [];
17811
- const cutSteps = new Set(cutOf.keys());
17812
- const runs = [];
17813
- const { actions } = scene;
17814
- let i = 0;
17815
- while (i < actions.length) {
17816
- const here = actions[i];
17817
- if (!here || !cutOf.has(here.id)) {
17818
- i += 1;
17819
- continue;
17820
- }
17821
- let j = i;
17822
- const ids = [];
17823
- const actionIds = [];
17824
- let keepJump = true;
17825
- while (j < actions.length) {
17826
- const step = actions[j];
17827
- const cut = step ? cutOf.get(step.id) : void 0;
17828
- if (!step || !cut)
17829
- break;
17830
- ids.push(cut.id);
17831
- actionIds.push(step.id);
17832
- keepJump &&= cut.keepJump === true;
17833
- j += 1;
17834
- }
17835
- const lastActionId = actionIds[actionIds.length - 1];
17836
- runs.push({
17837
- ids,
17838
- actionIds,
17839
- untilActionId: lastActionId === void 0 ? null : nextKeptActionId(scene, lastActionId, cutSteps),
17840
- keepJump
17841
- });
17842
- i = j;
17843
- }
17844
- return runs;
17845
- }
17846
17944
  function planScene(scene, opts = {}) {
17847
17945
  const anchorRects = /* @__PURE__ */ new Map();
17848
17946
  for (const anchor2 of scene.anchors) {
@@ -17857,8 +17955,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17857
17955
  }
17858
17956
  const rectOf = (anchorId, actionId) => actionRects.get(actionId) ?? anchorRects.get(anchorId) ?? null;
17859
17957
  const lastAction = scene.actions[scene.actions.length - 1];
17860
- const cuts = planCuts(scene);
17861
- const cutSteps = new Set(cuts.flatMap((run) => run.actionIds));
17958
+ const removed = scene.edits.removed ?? [];
17959
+ const cutSteps = stepsInsideRemoved(scene);
17862
17960
  const attachedToCuts = [];
17863
17961
  const gapAfter = new Map((scene.edits.gaps ?? []).map((gap) => [gap.afterActionId, gap]));
17864
17962
  const paces = [];
@@ -17909,7 +18007,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17909
18007
  // the author never recorded.
17910
18008
  cursorSegments: planCursorSegments(scene, rectOf),
17911
18009
  cameraIntents: planCameraIntents(scene, cutSteps, attachedToCuts),
17912
- cosmetics: planCosmetics(scene, cutSteps, attachedToCuts, opts.retexts ?? []),
18010
+ cosmetics: planCosmetics(scene, cutSteps, attachedToCuts),
17913
18011
  holds: (scene.edits.holds ?? []).flatMap((hold) => {
17914
18012
  if (cutSteps.has(hold.marker.actionId)) {
17915
18013
  attachedToCuts.push({
@@ -17929,7 +18027,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17929
18027
  ];
17930
18028
  }),
17931
18029
  paces,
17932
- cuts,
18030
+ removed,
18031
+ removedSteps: [...cutSteps],
17933
18032
  attachedToCuts,
17934
18033
  trim: {
17935
18034
  head: scene.edits.trim?.head ?? null,
@@ -17941,186 +18040,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17941
18040
  };
17942
18041
  }
17943
18042
 
17944
- // ../../packages/compositor/dist/render/draw-cursor.js
17945
- var PULSE_DURATION_MS = 400;
17946
- var PRESS_DURATION_MS = 110;
17947
- var CURSOR_UPRIGHT = Object.freeze({
17948
- press: 1,
17949
- angleRad: 0
17950
- });
17951
- var ARROW = [
17952
- { x: 0, y: 0 },
17953
- { x: 0, y: 0.75 },
17954
- { x: 0.19, y: 0.58 },
17955
- { x: 0.31, y: 0.87 },
17956
- { x: 0.45, y: 0.81 },
17957
- { x: 0.33, y: 0.53 },
17958
- { x: 0.56, y: 0.52 }
17959
- ];
17960
- var TOUCH_RADIUS = 0.42;
17961
- var CURSOR_ART = {
17962
- light: { height: 40, hotspot: { x: 0, y: 0 }, ink: bounds(ARROW) },
17963
- dark: { height: 40, hotspot: { x: 0, y: 0 }, ink: bounds(ARROW) },
17964
- touch: {
17965
- height: 40,
17966
- hotspot: { x: 0.5, y: 0.5 },
17967
- ink: {
17968
- min: { x: 0.5 - TOUCH_RADIUS, y: 0.5 - TOUCH_RADIUS },
17969
- max: { x: 0.5 + TOUCH_RADIUS, y: 0.5 + TOUCH_RADIUS }
17970
- }
17971
- }
17972
- };
17973
- function bounds(points) {
17974
- const xs = points.map((p) => p.x);
17975
- const ys = points.map((p) => p.y);
17976
- return {
17977
- min: { x: Math.min(...xs), y: Math.min(...ys) },
17978
- max: { x: Math.max(...xs), y: Math.max(...ys) }
17979
- };
17980
- }
17981
- var INK = {
17982
- light: { fill: "#ffffff", stroke: "#111827" },
17983
- dark: { fill: "#111827", stroke: "#ffffff" },
17984
- touch: { fill: "rgba(255, 255, 255, 0.45)", stroke: "#111827" }
17985
- };
17986
- function drawCursor(ctx, at, scale, pose, style = "light") {
17987
- const size = CURSOR_ART[style].height * scale * pose.press;
17988
- const ink = INK[style];
17989
- ctx.save();
17990
- ctx.translate(at.x, at.y);
17991
- if (style !== "touch" && pose.angleRad !== 0)
17992
- ctx.rotate(pose.angleRad);
17993
- ctx.beginPath();
17994
- if (style === "touch") {
17995
- ctx.arc(0, 0, size * TOUCH_RADIUS, 0, Math.PI * 2);
17996
- } else {
17997
- const first = ARROW[0];
17998
- if (first) {
17999
- ctx.moveTo(first.x * size, first.y * size);
18000
- for (const point2 of ARROW.slice(1))
18001
- ctx.lineTo(point2.x * size, point2.y * size);
18002
- }
18003
- }
18004
- ctx.closePath();
18005
- ctx.shadowColor = "rgba(15, 23, 42, 0.35)";
18006
- ctx.shadowBlur = 3 * scale;
18007
- ctx.shadowOffsetY = 1.5 * scale;
18008
- ctx.fillStyle = ink.fill;
18009
- ctx.fill();
18010
- ctx.shadowColor = "transparent";
18011
- ctx.lineWidth = Math.max(1, 1.4 * scale);
18012
- ctx.lineJoin = "round";
18013
- ctx.strokeStyle = ink.stroke;
18014
- ctx.stroke();
18015
- ctx.restore();
18016
- }
18017
- var CURSOR_EXPOSURE_MS = 32;
18018
- var CURSOR_TRAIL_MIN_TRAVEL_PX = 1;
18019
- var TRAIL_PEAK_ALPHA = 0.55;
18020
- function cursorTrailStamps(motionBlur) {
18021
- if (motionBlur <= 0)
18022
- return 0;
18023
- return Math.ceil(2 + 8 * clamp(motionBlur, 0, 1));
18024
- }
18025
- function drawCursorTrail(ctx, positions, scale, style) {
18026
- if (positions.length === 0)
18027
- return;
18028
- const priorAlpha = ctx.globalAlpha;
18029
- positions.forEach((position, i) => {
18030
- const t = (i + 1) / (positions.length + 1);
18031
- ctx.globalAlpha = priorAlpha * t * t * TRAIL_PEAK_ALPHA;
18032
- const pose = { press: 1, angleRad: position.angleRad ?? 0 };
18033
- drawCursor(ctx, position, scale, pose, style);
18034
- });
18035
- ctx.globalAlpha = priorAlpha;
18036
- }
18037
- function drawClickPulse(ctx, at, scale, t) {
18038
- if (t < 0 || t > 1)
18039
- return;
18040
- const eased = 1 - (1 - t) ** 3;
18041
- const radius = 16 * scale * (1 + 2.2 * eased);
18042
- const alpha = 1 - t;
18043
- const core = Math.max(1, 2.5 * scale);
18044
- const edge = Math.max(0.75, 1.25 * scale);
18045
- const offset = (core + edge) / 2;
18046
- ctx.save();
18047
- ring(ctx, at, radius - offset, edge, `rgba(15, 23, 42, ${0.75 * alpha})`);
18048
- ring(ctx, at, radius + offset, edge, `rgba(15, 23, 42, ${0.75 * alpha})`);
18049
- ring(ctx, at, radius, core, `rgba(255, 255, 255, ${0.95 * alpha})`);
18050
- ctx.restore();
18051
- }
18052
- function ring(ctx, at, radius, width, style) {
18053
- if (radius <= 0)
18054
- return;
18055
- ctx.beginPath();
18056
- ctx.arc(at.x, at.y, radius, 0, Math.PI * 2);
18057
- ctx.lineWidth = width;
18058
- ctx.strokeStyle = style;
18059
- ctx.stroke();
18060
- }
18061
-
18062
- // ../../packages/compositor/dist/plan/camera-follow.js
18063
- var FOLLOW_STEP_MS = 33;
18064
- var FOLLOW_SAFE_INSET = 0.25;
18065
- var FOLLOW_MIN_MOVE_PX = 4;
18066
- var FOLLOW_CLICK_LEAD_MS = 100;
18067
- function followCursor(args) {
18068
- const { keys, cursorAt, outputDurationMs, viewport, timings, minPlateauMs } = args;
18069
- const shown = args.fitWindow ?? viewport;
18070
- const panMs = timings.followPanMs;
18071
- const crossesClick = (startMs) => args.clickOutputMs.some((click) => startMs < click + PULSE_DURATION_MS && startMs + panMs > click - FOLLOW_CLICK_LEAD_MS);
18072
- const out = [];
18073
- for (const [i, key] of keys.entries()) {
18074
- out.push(key);
18075
- if (key.scale <= 1)
18076
- continue;
18077
- const next = keys[i + 1];
18078
- const plateauEndMs = next ? next.outputTimeMs - Math.min(next.transitionMs, next.outputTimeMs - key.outputTimeMs) : outputDurationMs;
18079
- const window2 = {
18080
- width: shown.width / key.scale,
18081
- height: shown.height / key.scale
18082
- };
18083
- const halfWidth = Math.min(window2.width, viewport.width) / 2;
18084
- const halfHeight = Math.min(window2.height, viewport.height) / 2;
18085
- const inside = (p) => ({
18086
- x: clamp(p.x, halfWidth, viewport.width - halfWidth),
18087
- y: clamp(p.y, halfHeight, viewport.height - halfHeight)
18088
- });
18089
- const safeX = window2.width * (0.5 - FOLLOW_SAFE_INSET);
18090
- const safeY = window2.height * (0.5 - FOLLOW_SAFE_INSET);
18091
- let zone = inside(key.center);
18092
- let held = key.center;
18093
- let t = key.outputTimeMs;
18094
- while (t + panMs + minPlateauMs <= plateauEndMs) {
18095
- const pointer = cursorAt(t);
18096
- if (pointer === null)
18097
- break;
18098
- const leftX = Math.abs(pointer.x - zone.x) > safeX;
18099
- const leftY = Math.abs(pointer.y - zone.y) > safeY;
18100
- const wanted = inside(pointer);
18101
- if (!(leftX || leftY) || Math.hypot(wanted.x - zone.x, wanted.y - zone.y) < FOLLOW_MIN_MOVE_PX || crossesClick(t)) {
18102
- t += FOLLOW_STEP_MS;
18103
- continue;
18104
- }
18105
- t += panMs;
18106
- held = {
18107
- x: leftX ? wanted.x : held.x + (wanted.x - zone.x),
18108
- y: leftY ? wanted.y : held.y + (wanted.y - zone.y)
18109
- };
18110
- zone = wanted;
18111
- out.push({
18112
- outputTimeMs: t,
18113
- center: held,
18114
- scale: key.scale,
18115
- transitionMs: panMs,
18116
- stiffness: timings.stiffness,
18117
- followPan: true
18118
- });
18119
- }
18120
- }
18121
- return out;
18122
- }
18123
-
18124
18043
  // ../../packages/compositor/dist/plan/smooth.js
18125
18044
  var CURSOR_SMOOTHING_MS = 30;
18126
18045
  var KERNEL_REACH_SIGMAS = 3;
@@ -18912,7 +18831,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18912
18831
  return samples;
18913
18832
  const bridges = [];
18914
18833
  for (const cut of timeline.cuts) {
18915
- if (cut.trailing)
18834
+ if (cut.trailing || cut.srcStartMs <= 0)
18916
18835
  continue;
18917
18836
  const from = sampleCursor(samples, cut.srcStartMs);
18918
18837
  if (from === null)
@@ -19003,7 +18922,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19003
18922
  function scaleText(scale) {
19004
18923
  return String(Number(scale.toFixed(2)));
19005
18924
  }
19006
- function resolvePlan(plan, given, givenScene, hints = [], cameraFitWindow = null) {
18925
+ function resolveCameraFollow(args) {
18926
+ const { keys, plan, bundle, timeline, cursor, motion } = args;
18927
+ const zoomedActions = new Set(plan.cameraIntents.map((i) => i.actionId));
18928
+ return solveFollow({
18929
+ keys,
18930
+ cursorAt: motion.follow && args.drawsPointer ? (outputMs) => sampleCursor(cursor, toSourceMs(timeline, outputMs)) : null,
18931
+ holds: (bundle.heldPresses ?? []).filter((h) => zoomedActions.has(h.actionId)).map((h) => ({
18932
+ startMs: toOutputMs(timeline, h.pressMs),
18933
+ endMs: toOutputMs(timeline, h.releaseMs)
18934
+ })),
18935
+ outputDurationMs: timeline.outputDurationMs,
18936
+ rate: motionTimings(motion.smoothness).followRatePerS
18937
+ });
18938
+ }
18939
+ function resolvePlan(givenPlan, given, givenScene, hints = [], cameraFitWindow = null) {
18940
+ let plan = givenPlan;
19007
18941
  const { bundle, scene } = inScreenSpace(given, givenScene);
19008
18942
  const anchorRects = /* @__PURE__ */ new Map();
19009
18943
  for (const anchor2 of scene?.anchors ?? []) {
@@ -19036,13 +18970,33 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19036
18970
  ) : travelled;
19037
18971
  const settleMs = bundle.source === "capture" ? springSettleMs(CURSOR_SPRING_TAU_MS) : 0;
19038
18972
  const leadMs = bundle.source === "capture" ? springLeadMs(CURSOR_SPRING_TAU_MS) : 0;
19039
- const timeline = buildTimeline(plan, bundle, [
18973
+ const motionHints = [
19040
18974
  ...hints,
19041
18975
  ...cursorMotionSpans(travelled).map((span) => ({
19042
18976
  startMs: Math.max(0, span.startMs - leadMs),
19043
18977
  endMs: span.endMs + settleMs
19044
18978
  }))
19045
- ]);
18979
+ ];
18980
+ let timeline = buildTimeline(plan, bundle, motionHints);
18981
+ const unplacedIds = new Set(timeline.unplacedCuts.flatMap((u) => u.ids));
18982
+ if (unplacedIds.size > 0 && givenScene !== void 0) {
18983
+ const kept = planScene({
18984
+ ...givenScene,
18985
+ edits: {
18986
+ ...givenScene.edits,
18987
+ removed: (givenScene.edits.removed ?? []).filter((r) => !unplacedIds.has(r.id))
18988
+ }
18989
+ }, { retiming: plan.retiming });
18990
+ plan = {
18991
+ ...plan,
18992
+ cameraIntents: kept.cameraIntents,
18993
+ cosmetics: kept.cosmetics,
18994
+ holds: kept.holds,
18995
+ removedSteps: kept.removedSteps,
18996
+ attachedToCuts: kept.attachedToCuts
18997
+ };
18998
+ timeline = buildTimeline(plan, bundle, motionHints);
18999
+ }
19046
19000
  const bridged = bridgeCutSeams(cursor, timeline, CUT_BRIDGE_MS);
19047
19001
  const trim = resolveRange({
19048
19002
  id: "trim",
@@ -19054,9 +19008,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19054
19008
  });
19055
19009
  const clampedRanges = trim.clamped ? [trim.clamped] : [];
19056
19010
  const motion = scene?.motion ?? MOTION_DEFAULTS;
19057
- const cutIds = new Set(plan.cuts.flatMap((run) => run.actionIds));
19011
+ const cutIds = new Set(plan.removedSteps ?? []);
19058
19012
  const actEnds = new Map(bundle.markers.flatMap((m) => m.actEndSourceTimeMs === void 0 || cutIds.has(m.actionId) ? [] : [[m.actionId, m.actEndSourceTimeMs]]));
19059
- const camera = solveCamera(plan.cameraIntents, rectOf, timeline, markerSourceMs, plan.viewport, cameraFitWindow, motion, actEnds);
19013
+ const holdOutputMs = (bundle.heldPresses ?? []).map((h) => ({
19014
+ startMs: toOutputMs(timeline, h.pressMs),
19015
+ endMs: toOutputMs(timeline, h.releaseMs)
19016
+ }));
19017
+ const camera = solveCamera(plan.cameraIntents, rectOf, timeline, markerSourceMs, plan.viewport, cameraFitWindow, motion, actEnds, holdOutputMs);
19060
19018
  const intentAction = new Map(plan.cameraIntents.map((intent) => [intent.id, intent.actionId]));
19061
19019
  const loweredZooms = [];
19062
19020
  for (const segment of camera.segments) {
@@ -19089,7 +19047,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19089
19047
  note: `zoom "${segment.id}" was asked to end at an instant the camera cannot reach \u2014 too close to its own push-in or to the next zoom \u2014 so it returns at ${Math.round(segment.endMs)}ms instead`
19090
19048
  });
19091
19049
  }
19092
- const clickKinds = new Set(bundle.source === "replay" ? ["click", "type"] : ["click"]);
19050
+ const clickKinds = new Set(bundle.source === "replay" ? ["click", "type", "drag"] : ["click"]);
19093
19051
  const clickActionIds = new Set((scene?.actions ?? []).filter((a) => clickKinds.has(a.kind)).map((a) => a.id));
19094
19052
  const clickOutputMs = bundle.markers.filter((m) => clickActionIds.has(m.actionId)).map((m) => toOutputMs(timeline, m.sourceTimeMs)).sort((a, b) => a - b);
19095
19053
  const touch = scene?.meta.capture.device?.touch === true;
@@ -19097,36 +19055,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19097
19055
  const at = sampleCursor(bridged, m.sourceTimeMs);
19098
19056
  return at === null ? [] : [{ outputMs: toOutputMs(timeline, m.sourceTimeMs), at }];
19099
19057
  }).sort((a, b) => a.outputMs - b.outputMs) : [];
19100
- const cameraKeys = motion.follow ? followCursor({
19058
+ const cameraFollow = resolveCameraFollow({
19101
19059
  keys: camera.keys,
19102
- cursorAt: (outputMs) => sampleCursor(bridged, toSourceMs(timeline, outputMs)),
19103
- outputDurationMs: timeline.outputDurationMs,
19104
- viewport: plan.viewport,
19105
- fitWindow: cameraFitWindow,
19106
- timings: motionTimings(motion.smoothness),
19107
- minPlateauMs: CAMERA_DEFAULTS.neutral.minPlateauMs,
19108
- clickOutputMs
19109
- }) : camera.keys;
19110
- const cosmetics = plan.cosmetics.flatMap((binding) => {
19111
- const rectStep = binding.kind === "replacement" ? binding.range?.start?.actionId ?? "" : "";
19112
- const rect2 = binding.rect ?? (binding.anchorId ? rectOf(binding.anchorId, rectStep) : null);
19113
- if (!rect2) {
19114
- clampedRanges.push({
19115
- id: binding.id,
19116
- kind: binding.kind === "mask" ? "mask" : binding.range !== null ? "retext" : "replacement",
19117
- note: `${binding.kind === "mask" ? "mask" : binding.range !== null ? "retext" : "replacement"} "${binding.id}" is not drawn: nothing recorded where its element is on screen`
19118
- });
19119
- return [];
19120
- }
19060
+ plan,
19061
+ bundle,
19062
+ timeline,
19063
+ cursor: bridged,
19064
+ motion,
19065
+ drawsPointer: !touch && !(scene?.cursor ?? CURSOR_DEFAULTS).hidden
19066
+ });
19067
+ const cosmetics = plan.cosmetics.map((binding) => {
19121
19068
  let range = null;
19122
19069
  let unplaced = [];
19123
19070
  if (binding.range) {
19124
19071
  const resolved = resolveRange({
19125
19072
  id: binding.id,
19126
- // A replacement carrying a range is a retext overlay — the only
19127
- // shape that pairs the two (`plan/types.ts`) — so it reports under
19128
- // its own name rather than as a mask.
19129
- kind: binding.kind === "mask" ? "mask" : "retext",
19073
+ kind: "mask",
19130
19074
  start: binding.range.start,
19131
19075
  end: binding.range.end,
19132
19076
  timeline,
@@ -19137,39 +19081,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19137
19081
  unplaced = resolved.unplaced;
19138
19082
  range = resolved.range;
19139
19083
  }
19140
- let reveal = null;
19141
- if (binding.reveal) {
19142
- const resolved = resolveRange({
19143
- id: binding.id,
19144
- kind: "retext",
19145
- start: binding.reveal.start,
19146
- end: binding.reveal.end,
19147
- timeline,
19148
- markerSourceMs
19149
- });
19150
- if (resolved.clamped)
19151
- clampedRanges.push(resolved.clamped);
19152
- reveal = resolved.range;
19153
- }
19154
- return [
19155
- {
19156
- id: binding.id,
19157
- kind: binding.kind,
19158
- rect: rect2,
19159
- text: binding.text,
19160
- range,
19161
- unplaced,
19162
- reveal
19163
- }
19164
- ];
19084
+ return {
19085
+ id: binding.id,
19086
+ kind: "mask",
19087
+ rect: binding.rect,
19088
+ range,
19089
+ unplaced
19090
+ };
19165
19091
  });
19166
19092
  return {
19167
19093
  plan,
19168
19094
  timeline,
19169
- cameraKeys,
19095
+ cameraKeys: camera.keys,
19096
+ cameraFollow,
19170
19097
  cameraSegments: camera.segments,
19171
19098
  cursor: bridged,
19172
19099
  clickOutputMs,
19100
+ holdOutputMs,
19173
19101
  touch,
19174
19102
  taps,
19175
19103
  cursorLook: scene?.cursor ?? CURSOR_DEFAULTS,
@@ -46891,7 +46819,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
46891
46819
  { x: canvas.width, y: canvas.height }
46892
46820
  ];
46893
46821
  const passAt = (at) => {
46894
- const then = frameCamera(sampleCamera(args.keys, at), args.base, frameRect, args.viewport, canvas);
46822
+ const then = frameCamera(sampleTrack(args.camera, at), args.base, frameRect, args.viewport, canvas);
46895
46823
  const r = then.scale / current.scale;
46896
46824
  return {
46897
46825
  scale: r,
@@ -46977,6 +46905,124 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
46977
46905
  ctx.restore();
46978
46906
  }
46979
46907
 
46908
+ // ../../packages/compositor/dist/render/draw-cursor.js
46909
+ var PULSE_DURATION_MS = 400;
46910
+ var PRESS_DURATION_MS = 110;
46911
+ var CURSOR_UPRIGHT = Object.freeze({
46912
+ press: 1,
46913
+ angleRad: 0
46914
+ });
46915
+ var ARROW = [
46916
+ { x: 0, y: 0 },
46917
+ { x: 0, y: 0.75 },
46918
+ { x: 0.19, y: 0.58 },
46919
+ { x: 0.31, y: 0.87 },
46920
+ { x: 0.45, y: 0.81 },
46921
+ { x: 0.33, y: 0.53 },
46922
+ { x: 0.56, y: 0.52 }
46923
+ ];
46924
+ var TOUCH_RADIUS = 0.42;
46925
+ var CURSOR_ART = {
46926
+ light: { height: 40, hotspot: { x: 0, y: 0 }, ink: bounds(ARROW) },
46927
+ dark: { height: 40, hotspot: { x: 0, y: 0 }, ink: bounds(ARROW) },
46928
+ touch: {
46929
+ height: 40,
46930
+ hotspot: { x: 0.5, y: 0.5 },
46931
+ ink: {
46932
+ min: { x: 0.5 - TOUCH_RADIUS, y: 0.5 - TOUCH_RADIUS },
46933
+ max: { x: 0.5 + TOUCH_RADIUS, y: 0.5 + TOUCH_RADIUS }
46934
+ }
46935
+ }
46936
+ };
46937
+ function bounds(points) {
46938
+ const xs = points.map((p) => p.x);
46939
+ const ys = points.map((p) => p.y);
46940
+ return {
46941
+ min: { x: Math.min(...xs), y: Math.min(...ys) },
46942
+ max: { x: Math.max(...xs), y: Math.max(...ys) }
46943
+ };
46944
+ }
46945
+ var INK = {
46946
+ light: { fill: "#ffffff", stroke: "#111827" },
46947
+ dark: { fill: "#111827", stroke: "#ffffff" },
46948
+ touch: { fill: "rgba(255, 255, 255, 0.45)", stroke: "#111827" }
46949
+ };
46950
+ function drawCursor(ctx, at, scale, pose, style = "light") {
46951
+ const size = CURSOR_ART[style].height * scale * pose.press;
46952
+ const ink = INK[style];
46953
+ ctx.save();
46954
+ ctx.translate(at.x, at.y);
46955
+ if (style !== "touch" && pose.angleRad !== 0)
46956
+ ctx.rotate(pose.angleRad);
46957
+ ctx.beginPath();
46958
+ if (style === "touch") {
46959
+ ctx.arc(0, 0, size * TOUCH_RADIUS, 0, Math.PI * 2);
46960
+ } else {
46961
+ const first = ARROW[0];
46962
+ if (first) {
46963
+ ctx.moveTo(first.x * size, first.y * size);
46964
+ for (const point2 of ARROW.slice(1))
46965
+ ctx.lineTo(point2.x * size, point2.y * size);
46966
+ }
46967
+ }
46968
+ ctx.closePath();
46969
+ ctx.shadowColor = "rgba(15, 23, 42, 0.35)";
46970
+ ctx.shadowBlur = 3 * scale;
46971
+ ctx.shadowOffsetY = 1.5 * scale;
46972
+ ctx.fillStyle = ink.fill;
46973
+ ctx.fill();
46974
+ ctx.shadowColor = "transparent";
46975
+ ctx.lineWidth = Math.max(1, 1.4 * scale);
46976
+ ctx.lineJoin = "round";
46977
+ ctx.strokeStyle = ink.stroke;
46978
+ ctx.stroke();
46979
+ ctx.restore();
46980
+ }
46981
+ var CURSOR_EXPOSURE_MS = 32;
46982
+ var CURSOR_TRAIL_MIN_TRAVEL_PX = 1;
46983
+ var TRAIL_PEAK_ALPHA = 0.55;
46984
+ function cursorTrailStamps(motionBlur) {
46985
+ if (motionBlur <= 0)
46986
+ return 0;
46987
+ return Math.ceil(2 + 8 * clamp(motionBlur, 0, 1));
46988
+ }
46989
+ function drawCursorTrail(ctx, positions, scale, style) {
46990
+ if (positions.length === 0)
46991
+ return;
46992
+ const priorAlpha = ctx.globalAlpha;
46993
+ positions.forEach((position, i) => {
46994
+ const t = (i + 1) / (positions.length + 1);
46995
+ ctx.globalAlpha = priorAlpha * t * t * TRAIL_PEAK_ALPHA;
46996
+ const pose = { press: 1, angleRad: position.angleRad ?? 0 };
46997
+ drawCursor(ctx, position, scale, pose, style);
46998
+ });
46999
+ ctx.globalAlpha = priorAlpha;
47000
+ }
47001
+ function drawClickPulse(ctx, at, scale, t) {
47002
+ if (t < 0 || t > 1)
47003
+ return;
47004
+ const eased = 1 - (1 - t) ** 3;
47005
+ const radius = 16 * scale * (1 + 2.2 * eased);
47006
+ const alpha = 1 - t;
47007
+ const core = Math.max(1, 2.5 * scale);
47008
+ const edge = Math.max(0.75, 1.25 * scale);
47009
+ const offset = (core + edge) / 2;
47010
+ ctx.save();
47011
+ ring(ctx, at, radius - offset, edge, `rgba(15, 23, 42, ${0.75 * alpha})`);
47012
+ ring(ctx, at, radius + offset, edge, `rgba(15, 23, 42, ${0.75 * alpha})`);
47013
+ ring(ctx, at, radius, core, `rgba(255, 255, 255, ${0.95 * alpha})`);
47014
+ ctx.restore();
47015
+ }
47016
+ function ring(ctx, at, radius, width, style) {
47017
+ if (radius <= 0)
47018
+ return;
47019
+ ctx.beginPath();
47020
+ ctx.arc(at.x, at.y, radius, 0, Math.PI * 2);
47021
+ ctx.lineWidth = width;
47022
+ ctx.strokeStyle = style;
47023
+ ctx.stroke();
47024
+ }
47025
+
46980
47026
  // ../../packages/compositor/dist/render/cursor-pose.js
46981
47027
  var PRESS_DEPTH = 0.14;
46982
47028
  var RELEASE_DECAY_MS = 80;
@@ -46986,13 +47032,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
46986
47032
  const x = clamp(u, 0, 1);
46987
47033
  return x * x * (3 - 2 * x);
46988
47034
  };
46989
- function cursorPressScale(outputTimeMs, clickOutputMs, bounce) {
47035
+ function cursorPressScale(outputTimeMs, clickOutputMs, bounce, holds = []) {
46990
47036
  const depth = PRESS_DEPTH * clamp(bounce, 0, 2);
46991
47037
  if (depth <= 0)
46992
47038
  return 1;
47039
+ if (holds.some((h) => outputTimeMs >= h.startMs && outputTimeMs < h.endMs)) {
47040
+ return 1 - depth;
47041
+ }
46993
47042
  let previous = Number.NEGATIVE_INFINITY;
46994
47043
  let next = Number.POSITIVE_INFINITY;
46995
- for (const click of clickOutputMs) {
47044
+ for (const click of [...clickOutputMs, ...holds.map((h) => h.endMs)]) {
46996
47045
  if (click <= outputTimeMs)
46997
47046
  previous = Math.max(previous, click);
46998
47047
  else
@@ -47058,89 +47107,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
47058
47107
  return sum / weights;
47059
47108
  }
47060
47109
 
47061
- // ../../packages/compositor/dist/render/retext.js
47062
- function revealedText(text, reveal, outputTimeMs) {
47063
- if (reveal === null)
47064
- return text;
47065
- const span = reveal.endMs - reveal.startMs;
47066
- if (span <= 0)
47067
- return text;
47068
- if (outputTimeMs >= reveal.endMs)
47069
- return text;
47070
- if (outputTimeMs <= reveal.startMs)
47071
- return "";
47072
- const chars = [...text];
47073
- const shown = Math.ceil(chars.length * (outputTimeMs - reveal.startMs) / span);
47074
- return chars.slice(0, shown).join("");
47075
- }
47076
-
47077
47110
  // ../../packages/compositor/dist/render/draw-cosmetics.js
47078
47111
  var MASK_FILL = "#4b5563";
47079
- var TEXT_INK = "#111827";
47080
- var TEXT_FONT = "system-ui, -apple-system, 'Segoe UI', sans-serif";
47081
- function sampleEdgeColor(ctx, rect2) {
47082
- const inset = 3;
47083
- const probes = [
47084
- [rect2.x - inset, rect2.y + rect2.height / 2],
47085
- [rect2.x + rect2.width + inset, rect2.y + rect2.height / 2],
47086
- [rect2.x + rect2.width / 2, rect2.y - inset],
47087
- [rect2.x + rect2.width / 2, rect2.y + rect2.height + inset]
47088
- ];
47089
- let r = 0;
47090
- let g = 0;
47091
- let b = 0;
47092
- let n = 0;
47093
- for (const [px, py] of probes) {
47094
- if (px < 0 || py < 0 || px >= ctx.canvas.width || py >= ctx.canvas.height)
47095
- continue;
47096
- const data = ctx.getImageData(Math.round(px), Math.round(py), 1, 1).data;
47097
- r += data[0];
47098
- g += data[1];
47099
- b += data[2];
47100
- n++;
47101
- }
47102
- if (n === 0)
47103
- return "rgb(255, 255, 255)";
47104
- return `rgb(${Math.round(r / n)}, ${Math.round(g / n)}, ${Math.round(b / n)})`;
47105
- }
47106
- function drawReplacement(ctx, rect2, text) {
47107
- ctx.save();
47108
- ctx.fillStyle = sampleEdgeColor(ctx, rect2);
47109
- ctx.fillRect(rect2.x, rect2.y, rect2.width, rect2.height);
47110
- let fontSize = Math.max(8, rect2.height * 0.62);
47111
- const padding = rect2.height * 0.15;
47112
- const maxWidth = Math.max(1, rect2.width - padding * 2);
47113
- ctx.textBaseline = "middle";
47114
- ctx.textAlign = "left";
47115
- for (let i = 0; i < 24; i++) {
47116
- ctx.font = `${fontSize}px ${TEXT_FONT}`;
47117
- if (ctx.measureText(text).width <= maxWidth || fontSize <= 8)
47118
- break;
47119
- fontSize *= 0.9;
47120
- }
47121
- ctx.fillStyle = TEXT_INK;
47122
- ctx.fillText(text, rect2.x + padding, rect2.y + rect2.height / 2, maxWidth);
47123
- ctx.restore();
47124
- }
47125
47112
  function drawMask(ctx, rect2) {
47126
47113
  ctx.save();
47127
47114
  ctx.fillStyle = MASK_FILL;
47128
47115
  ctx.fillRect(rect2.x, rect2.y, rect2.width, rect2.height);
47129
47116
  ctx.restore();
47130
47117
  }
47131
- function drawCosmetics(ctx, cosmetics, toOutput, outputTimeMs) {
47132
- const ordered = [
47133
- ...cosmetics.filter((c) => c.kind === "replacement"),
47134
- ...cosmetics.filter((c) => c.kind === "mask")
47135
- ];
47136
- for (const cosmetic of ordered) {
47137
- const rect2 = toOutput(cosmetic.rect);
47138
- if (cosmetic.kind === "mask")
47139
- drawMask(ctx, rect2);
47140
- else if (cosmetic.text !== null) {
47141
- drawReplacement(ctx, rect2, revealedText(cosmetic.text, cosmetic.reveal, outputTimeMs));
47142
- }
47143
- }
47118
+ function drawCosmetics(ctx, cosmetics, toOutput) {
47119
+ for (const cosmetic of cosmetics)
47120
+ drawMask(ctx, toOutput(cosmetic.rect));
47144
47121
  }
47145
47122
 
47146
47123
  // ../../packages/compositor/dist/render/presentation.js
@@ -47337,7 +47314,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
47337
47314
  const { frameRect } = presentation;
47338
47315
  const sourceMs = toSourceMs(resolved.timeline, outputTimeMs);
47339
47316
  const base = contentScale(frameRect, viewport);
47340
- const camera = frameCamera(sampleCamera(resolved.cameraKeys, outputTimeMs), base, frameRect, viewport, target);
47317
+ const camera = frameCamera(sampleTrack(resolved, outputTimeMs), base, frameRect, viewport, target);
47341
47318
  const fetchStartedAt = args.onStage ? performance.now() : 0;
47342
47319
  const frame2 = await frames.at(sourceMs);
47343
47320
  args.onStage?.("fetch", performance.now() - fetchStartedAt);
@@ -47367,8 +47344,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
47367
47344
  // A ranged cosmetic paints inside its range only: `[startMs, endMs)`
47368
47345
  // on the untrimmed output axis, the same clock `outputTimeMs` is on.
47369
47346
  resolved.cosmetics.filter((c) => c.range === null || outputTimeMs >= c.range.startMs && outputTimeMs < c.range.endMs),
47370
- (rect2) => cssRectToOutput(rect2, camera, frameRect, viewport),
47371
- outputTimeMs
47347
+ (rect2) => cssRectToOutput(rect2, camera, frameRect, viewport)
47372
47348
  ));
47373
47349
  ctx.restore();
47374
47350
  ctx.save();
@@ -47376,7 +47352,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
47376
47352
  stage("logo", () => drawLogo(ctx, target, presentation));
47377
47353
  ctx.restore();
47378
47354
  stage("blur", () => paintCameraBlur(ctx, cameraBlurTransforms({
47379
- keys: resolved.cameraKeys,
47355
+ camera: resolved,
47380
47356
  outputTimeMs,
47381
47357
  blur: resolved.motion.blur,
47382
47358
  current: camera,
@@ -47413,7 +47389,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
47413
47389
  drawClickPulse(ctx, at, uiScale, t);
47414
47390
  }
47415
47391
  drawCursor(ctx, at, uiScale, {
47416
- press: cursorPressScale(outputTimeMs, resolved.clickOutputMs, look.clickBounce ?? CURSOR_POLISH_DEFAULTS.clickBounce),
47392
+ press: cursorPressScale(outputTimeMs, resolved.clickOutputMs, look.clickBounce ?? CURSOR_POLISH_DEFAULTS.clickBounce, resolved.holdOutputMs),
47417
47393
  angleRad
47418
47394
  }, look.style);
47419
47395
  ctx.globalAlpha = priorAlpha;
@@ -47450,22 +47426,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
47450
47426
  function clampToSourceDetail(args) {
47451
47427
  const { keys, timeline, bundle, outputPxPerCssPx, viewport } = args;
47452
47428
  const violations = [];
47453
- const clampKey = (key, before) => {
47429
+ const clampKey = (key) => {
47454
47430
  const sourceWidth = sourceWidthAt(bundle, toSourceMs(timeline, key.outputTimeMs));
47455
- if (key.followPan && before) {
47456
- const granted2 = Math.min(key.scale, before.scale);
47457
- const neededWidth2 = outputPxPerCssPx * granted2 * viewport.width;
47458
- if (sourceWidth !== 0 && sourceWidth < neededWidth2) {
47459
- violations.push({
47460
- outputTimeMs: key.outputTimeMs,
47461
- requestedScale: granted2,
47462
- grantedScale: granted2,
47463
- sourceWidth,
47464
- neededWidth: neededWidth2
47465
- });
47466
- }
47467
- return { ...key, scale: granted2 };
47468
- }
47469
47431
  if (sourceWidth === 0)
47470
47432
  return key;
47471
47433
  const stillWidth = keyframeAt(bundle, toSourceMs(timeline, key.outputTimeMs))?.width;
@@ -47490,10 +47452,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
47490
47452
  }
47491
47453
  return { ...key, scale: granted };
47492
47454
  };
47493
- const clamped = [];
47494
- for (const key of keys) {
47495
- clamped.push(clampKey(key, clamped[clamped.length - 1]));
47496
- }
47455
+ const clamped = keys.map(clampKey);
47497
47456
  violations.push(...spansUnderZoom(clamped, violations, timeline, bundle, outputPxPerCssPx, viewport));
47498
47457
  return { keys: clamped, violations };
47499
47458
  }
@@ -47535,6 +47494,32 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
47535
47494
  }
47536
47495
 
47537
47496
  // ../../packages/compositor/dist/render/target.js
47497
+ var LANDSCAPE_1440P = {
47498
+ format: "mp4",
47499
+ width: 2560,
47500
+ height: 1440,
47501
+ fps: 60,
47502
+ bitrate: 18e6,
47503
+ cornerRadius: 24,
47504
+ fit: "contain"
47505
+ };
47506
+ var VERTICAL_1080 = {
47507
+ format: "mp4",
47508
+ width: 1080,
47509
+ height: 1920,
47510
+ fps: 60,
47511
+ bitrate: 12e6,
47512
+ cornerRadius: 24,
47513
+ fit: "cover"
47514
+ };
47515
+ var HIGH_LANDSCAPE = {
47516
+ ...LANDSCAPE_1440P,
47517
+ bitrate: 8e6
47518
+ };
47519
+ var HIGH_VERTICAL = {
47520
+ ...VERTICAL_1080,
47521
+ bitrate: HIGH_LANDSCAPE.bitrate
47522
+ };
47538
47523
  var SHARE_QUALITY_FLOOR = 0.35;
47539
47524
  function verticalCameraIntents(intents) {
47540
47525
  return intents.map((intent) => {
@@ -47575,7 +47560,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
47575
47560
  viewport: plan.viewport
47576
47561
  });
47577
47562
  return {
47578
- resolved: { ...resolved, cameraKeys: detail.keys },
47563
+ resolved: {
47564
+ ...resolved,
47565
+ cameraKeys: detail.keys,
47566
+ cameraFollow: resolveCameraFollow({
47567
+ keys: detail.keys,
47568
+ plan: resolved.plan,
47569
+ bundle,
47570
+ timeline: resolved.timeline,
47571
+ cursor: resolved.cursor,
47572
+ motion: resolved.motion,
47573
+ drawsPointer: !resolved.touch && !resolved.cursorLook.hidden
47574
+ })
47575
+ },
47579
47576
  presentation,
47580
47577
  violations: detail.violations
47581
47578
  };
@@ -47639,9 +47636,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
47639
47636
  const ctx = canvas.getContext("2d");
47640
47637
  const step = 1e3 / target.fps;
47641
47638
  if (composed.timeline.outputDurationMs === 0 && composed.timeline.cuts.length > 0) {
47642
- const steps = composed.timeline.cuts.flatMap((c) => c.actionIds);
47643
- const plural = steps.length === 1 ? "is" : "are";
47644
- throw new Error(`nothing left to render: ${steps.join(", ")} ${plural} cut, and that leaves no frames at all. Restore a step to export it.`);
47639
+ throw new Error("nothing left to render: the removed pieces leave no frames. Restore one to export it.");
47645
47640
  }
47646
47641
  const { startMs, endMs } = composed.range;
47647
47642
  if (composed.timeline.outputDurationMs > 0 && endMs <= startMs) {
@@ -47693,8 +47688,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
47693
47688
  detailViolations: violations,
47694
47689
  unavailableSpans: ports.frames.unavailable?.() ?? [],
47695
47690
  loweredZooms: composed.loweredZooms,
47696
- clampedRanges: composed.clampedRanges,
47697
- cosmeticIds: composed.cosmetics.map((c) => c.id)
47691
+ clampedRanges: composed.clampedRanges
47698
47692
  };
47699
47693
  }
47700
47694
  function stillSourceMs(bundle, marker) {
@@ -47704,14 +47698,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
47704
47698
  var STILL_SEAM_NUDGE_MS = 1e-3;
47705
47699
  var STILL_PLACEMENT_TOLERANCE_MS = 1;
47706
47700
  function stillBeats(bundle, timeline) {
47707
- const cutSteps = new Set(timeline.cuts.flatMap((c) => c.actionIds));
47708
47701
  const beats = [];
47709
47702
  const unplaced = [];
47710
47703
  for (const marker of bundle.markers) {
47711
- if (cutSteps.has(marker.actionId)) {
47704
+ const ms = marker.sourceTimeMs;
47705
+ if (timeline.cuts.some((c) => ms >= c.srcStartMs && ms < c.srcEndMs)) {
47712
47706
  unplaced.push({
47713
47707
  actionId: marker.actionId,
47714
- reason: "the step is cut, so the video holds none of its frames"
47708
+ reason: "the step is in a removed piece, so the video holds none of its frames"
47715
47709
  });
47716
47710
  continue;
47717
47711
  }
@@ -47749,7 +47743,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
47749
47743
  const times = supplied ?? beats.map((b) => b.outputTimeMs);
47750
47744
  if (atMarkers && times.length === 0) {
47751
47745
  const why = unplaced.map((u) => `${u.actionId} (${u.reason})`).join(", ");
47752
- throw new Error(unplaced.length === 0 ? "nothing left to render: this take has no steps, so there is no still to take of it." : `nothing left to render: no step in this take has a still left \u2014 ${why}. Restore a step, or rebuild the take, to export stills.`);
47746
+ throw new Error(unplaced.length === 0 ? "nothing left to render: this take has no steps, so there is no still to take of it." : `nothing left to render: no step in this take has a still left \u2014 ${why}. Restore a removed piece to export stills.`);
47753
47747
  }
47754
47748
  const unsmeared = {
47755
47749
  ...composed,
@@ -47766,13 +47760,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
47766
47760
  transitionMs: 0,
47767
47761
  stiffness: composed.cameraKeys[0]?.stiffness ?? 0
47768
47762
  };
47769
- return { ...unsmeared, cameraKeys: [key] };
47763
+ return { ...unsmeared, cameraKeys: [key], cameraFollow: [] };
47770
47764
  };
47771
47765
  const drawnShort = /* @__PURE__ */ new Map();
47772
47766
  const framed = (actionId, outputTimeMs) => {
47773
47767
  if (framing === "video")
47774
47768
  return unsmeared;
47775
- const keys = composed.cameraKeys;
47776
47769
  const segments = composed.cameraSegments;
47777
47770
  const zoom = (actionId === void 0 ? void 0 : segments.find((s) => stepOf.get(s.id) === actionId)) ?? segments.find((s) => s.startMs <= outputTimeMs && outputTimeMs < s.endMs);
47778
47771
  if (framing === "step" && zoom !== void 0) {
@@ -47780,7 +47773,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
47780
47773
  if (v.outputTimeMs === zoom.startMs)
47781
47774
  drawnShort.set(v.outputTimeMs, v);
47782
47775
  }
47783
- return held(sampleCamera(keys, zoom.startMs));
47776
+ return held(sampleCamera(composed.cameraKeys, zoom.startMs));
47784
47777
  }
47785
47778
  const sourceWidth = sourceWidthAt(bundle, toSourceMs(composed.timeline, outputTimeMs));
47786
47779
  const neededWidth = contentScale(presentation.frameRect, plan.viewport) * plan.viewport.width;
@@ -47799,7 +47792,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
47799
47792
  scale: 1
47800
47793
  });
47801
47794
  }
47802
- const at = sampleCamera(keys, zoom?.startMs ?? outputTimeMs);
47795
+ const at = sampleCamera(composed.cameraKeys, zoom?.startMs ?? outputTimeMs);
47803
47796
  return held({ center: at.center, scale: 1 });
47804
47797
  };
47805
47798
  for (const [i, outputTimeMs] of times.entries()) {
@@ -47822,8 +47815,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
47822
47815
  unavailableSpans: ports.frames.unavailable?.() ?? [],
47823
47816
  unplacedStills: unplaced,
47824
47817
  loweredZooms: composed.loweredZooms,
47825
- clampedRanges: composed.clampedRanges,
47826
- cosmeticIds: composed.cosmetics.map((c) => c.id)
47818
+ clampedRanges: composed.clampedRanges
47827
47819
  };
47828
47820
  }
47829
47821
 
@@ -47958,7 +47950,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
47958
47950
  };
47959
47951
  }
47960
47952
  };
47961
- const plan = planScene(scene, { retexts: input.retexts });
47953
+ const plan = planScene(scene);
47962
47954
  const surface = createOffscreenSurface();
47963
47955
  const reclaimed = bundle.degradations.filter((d) => d.kind === "motionReclaimed").map((d) => ({
47964
47956
  ref: `${d.startMs}-${d.endMs}ms`,
@@ -47997,7 +47989,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
47997
47989
  loweredZooms: result2.loweredZooms,
47998
47990
  logoWarning: logoWarning2,
47999
47991
  clampedRanges: result2.clampedRanges,
48000
- cosmeticIds: result2.cosmeticIds,
48001
47992
  rendered: { width: at2.width, height: at2.height, fps: at2.fps },
48002
47993
  ...sized.cappedFrom === null ? {} : { stillsCapped: { askedWidth: sized.cappedFrom } }
48003
47994
  }
@@ -48121,7 +48112,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
48121
48112
  loweredZooms: result.loweredZooms,
48122
48113
  logoWarning,
48123
48114
  clampedRanges: result.clampedRanges,
48124
- cosmeticIds: result.cosmeticIds,
48125
48115
  rendered: { width: at.width, height: at.height, fps: at.fps },
48126
48116
  ...budget === void 0 ? {} : {
48127
48117
  gifBudget: {
@@ -48187,7 +48177,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
48187
48177
  bundle,
48188
48178
  frames: await framesFor(bundle, load),
48189
48179
  logo,
48190
- retexts: manifest.retexts,
48191
48180
  ...manifest.gifBudget === void 0 ? {} : { gifBudget: manifest.gifBudget },
48192
48181
  ...manifest.mp4Cap === void 0 ? {} : { mp4Cap: manifest.mp4Cap },
48193
48182
  ...manifest.stills === void 0 ? {} : { stills: manifest.stills },