demoman 0.8.1 → 0.9.0
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.
- package/THIRD_PARTY_NOTICES +2 -1
- package/dist/demoman.mjs +24069 -16815
- package/dist/page/decode-probe-entry.js +44 -0
- package/dist/page/executor-entry.js +102 -17
- package/dist/page/mux-entry.js +184 -59
- package/dist/page/render-entry.js +941 -635
- package/dist/recipe.md +221 -255
- package/dist/skills/record-demo/SKILL.md +5 -4
- package/dist/studio/assets/editor-DNMFFNBB.js +4 -0
- package/dist/studio/assets/{editor-inline-7e387eed.css → editor-inline-07bcb316.css} +13 -0
- package/dist/studio/assets/library-Doev8wa8.js +1 -0
- package/dist/studio/assets/library-inline-1ca82571.css +1430 -0
- package/dist/studio/assets/settings-BRA8xkpS.js +1 -0
- package/dist/studio/assets/{settings-inline-7bb8bf61.css → settings-inline-2f59fbb0.css} +4 -0
- package/dist/studio/assets/state-B_PivD_k.js +2 -0
- package/dist/studio/assets/toast-Dg-G_N89.css +1 -0
- package/dist/studio/assets/toast-vpo2H1vK.js +72 -0
- package/dist/studio/assets/topbar-DW2VlQMA.js +1 -0
- package/dist/studio/assets/view-Oa5Fj9vk.js +1 -0
- package/dist/studio/editor.html +11 -10
- package/dist/studio/library.html +9 -8
- package/dist/studio/settings.html +8 -7
- package/dist/studio/studio-build.json +3 -3
- package/package.json +2 -1
- package/dist/studio/assets/confirm-dialog-B20ZVWlP.css +0 -1
- package/dist/studio/assets/confirm-dialog-DgJ946Hc.js +0 -72
- package/dist/studio/assets/editor-BC4sLdWT.js +0 -4
- package/dist/studio/assets/library-DVubUJtn.js +0 -1
- package/dist/studio/assets/library-inline-ff1b0c15.css +0 -635
- package/dist/studio/assets/settings-DLH9VoT0.js +0 -1
- package/dist/studio/assets/state-DyL2jOOv.js +0 -1
- package/dist/studio/assets/topbar-sSUyITjl.js +0 -1
- package/dist/studio/assets/view-Df6XUnyO.js +0 -1
|
@@ -842,165 +842,6 @@
|
|
|
842
842
|
}
|
|
843
843
|
});
|
|
844
844
|
|
|
845
|
-
// ../../packages/run-core/dist/logo.js
|
|
846
|
-
var SVG_RASTER_CACHE_SIZE = 4;
|
|
847
|
-
var frame = (image) => ({
|
|
848
|
-
image,
|
|
849
|
-
width: image.width,
|
|
850
|
-
height: image.height,
|
|
851
|
-
// A logo is branding, not a timeline sample — it has no source instant.
|
|
852
|
-
sourceTimeMs: 0
|
|
853
|
-
});
|
|
854
|
-
function parseSvg(text) {
|
|
855
|
-
const doc = new DOMParser().parseFromString(text, "image/svg+xml");
|
|
856
|
-
const root = doc.documentElement;
|
|
857
|
-
if (doc.querySelector("parsererror") !== null || root.nodeName.toLowerCase() !== "svg") {
|
|
858
|
-
throw new Error("the file is not an SVG");
|
|
859
|
-
}
|
|
860
|
-
return root;
|
|
861
|
-
}
|
|
862
|
-
var length = (value) => {
|
|
863
|
-
if (value === null)
|
|
864
|
-
return null;
|
|
865
|
-
const n = Number.parseFloat(value);
|
|
866
|
-
return Number.isFinite(n) && n > 0 && !value.trim().endsWith("%") ? n : null;
|
|
867
|
-
};
|
|
868
|
-
function svgAspect(svgText) {
|
|
869
|
-
const root = parseSvg(svgText);
|
|
870
|
-
const w = length(root.getAttribute("width"));
|
|
871
|
-
const h = length(root.getAttribute("height"));
|
|
872
|
-
if (w !== null && h !== null)
|
|
873
|
-
return w / h;
|
|
874
|
-
const box2 = root.getAttribute("viewBox")?.trim().split(/[\s,]+/).map(Number);
|
|
875
|
-
if (box2 && box2.length === 4 && box2[2] > 0 && box2[3] > 0) {
|
|
876
|
-
return box2[2] / box2[3];
|
|
877
|
-
}
|
|
878
|
-
throw new Error("the SVG has no width, height or viewBox, so there is no size to draw it at");
|
|
879
|
-
}
|
|
880
|
-
async function svgSource(bytes2) {
|
|
881
|
-
const text = new TextDecoder().decode(bytes2);
|
|
882
|
-
const aspect = svgAspect(text);
|
|
883
|
-
const cache = /* @__PURE__ */ new Map();
|
|
884
|
-
const render2 = async (heightPx) => {
|
|
885
|
-
const width = Math.max(1, Math.round(heightPx * aspect));
|
|
886
|
-
const height = Math.max(1, Math.round(heightPx));
|
|
887
|
-
const url3 = URL.createObjectURL(new Blob([bytes2.slice()], { type: "image/svg+xml" }));
|
|
888
|
-
try {
|
|
889
|
-
const img = new Image();
|
|
890
|
-
img.src = url3;
|
|
891
|
-
await img.decode().catch((error51) => {
|
|
892
|
-
throw new Error(`the SVG could not be decoded: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
893
|
-
});
|
|
894
|
-
const canvas = new OffscreenCanvas(width, height);
|
|
895
|
-
canvas.getContext("2d").drawImage(img, 0, 0, width, height);
|
|
896
|
-
return frame(await createImageBitmap(canvas));
|
|
897
|
-
} finally {
|
|
898
|
-
URL.revokeObjectURL(url3);
|
|
899
|
-
}
|
|
900
|
-
};
|
|
901
|
-
return {
|
|
902
|
-
contentType: "image/svg+xml",
|
|
903
|
-
aspect,
|
|
904
|
-
naturalHeight: null,
|
|
905
|
-
rasterAt(heightPx) {
|
|
906
|
-
const key = Math.max(1, Math.round(heightPx));
|
|
907
|
-
let hit = cache.get(key);
|
|
908
|
-
if (hit === void 0) {
|
|
909
|
-
const fresh = render2(key);
|
|
910
|
-
hit = fresh;
|
|
911
|
-
fresh.catch(() => {
|
|
912
|
-
if (cache.get(key) === fresh)
|
|
913
|
-
cache.delete(key);
|
|
914
|
-
});
|
|
915
|
-
} else {
|
|
916
|
-
cache.delete(key);
|
|
917
|
-
}
|
|
918
|
-
cache.set(key, hit);
|
|
919
|
-
while (cache.size > SVG_RASTER_CACHE_SIZE) {
|
|
920
|
-
cache.delete(cache.keys().next().value);
|
|
921
|
-
}
|
|
922
|
-
return hit;
|
|
923
|
-
}
|
|
924
|
-
};
|
|
925
|
-
}
|
|
926
|
-
async function decodeLogo(bytes2, contentType) {
|
|
927
|
-
if (contentType === "image/svg+xml") {
|
|
928
|
-
const source = await svgSource(bytes2);
|
|
929
|
-
await source.rasterAt(64);
|
|
930
|
-
return source;
|
|
931
|
-
}
|
|
932
|
-
let bitmap;
|
|
933
|
-
try {
|
|
934
|
-
bitmap = await createImageBitmap(new Blob([bytes2.slice()], { type: contentType }));
|
|
935
|
-
} catch (error51) {
|
|
936
|
-
throw new Error(`the ${contentType} could not be decoded: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
937
|
-
}
|
|
938
|
-
const image = frame(bitmap);
|
|
939
|
-
return {
|
|
940
|
-
contentType,
|
|
941
|
-
aspect: bitmap.width / bitmap.height,
|
|
942
|
-
naturalHeight: bitmap.height,
|
|
943
|
-
rasterAt: async () => image
|
|
944
|
-
};
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
// ../../packages/run-core/dist/render/mp4-cap.js
|
|
948
|
-
var HEADROOM = 0.92;
|
|
949
|
-
function fitBitrate(maxBytes, durationMs) {
|
|
950
|
-
return Math.round(maxBytes * HEADROOM * 8 / (durationMs / 1e3));
|
|
951
|
-
}
|
|
952
|
-
var sizeOf = (t) => ({ width: t.width, height: t.height });
|
|
953
|
-
function capLadder(asked, { share, floor }, fit) {
|
|
954
|
-
const rungs = [];
|
|
955
|
-
let at = asked;
|
|
956
|
-
if (at.fps > share.fps) {
|
|
957
|
-
const target = {
|
|
958
|
-
...at,
|
|
959
|
-
fps: share.fps,
|
|
960
|
-
bitrate: Math.round(at.bitrate * share.fps / at.fps)
|
|
961
|
-
};
|
|
962
|
-
rungs.push({ target, step: { kind: "fps", from: at.fps, to: share.fps } });
|
|
963
|
-
at = target;
|
|
964
|
-
}
|
|
965
|
-
const shareQuality = share.encoder?.quality;
|
|
966
|
-
const quality = at.encoder?.quality;
|
|
967
|
-
const atShare = at.width === share.width && at.height === share.height && (shareQuality === void 0 || quality !== void 0 && quality <= shareQuality);
|
|
968
|
-
if (!atShare) {
|
|
969
|
-
rungs.push({
|
|
970
|
-
target: share,
|
|
971
|
-
step: {
|
|
972
|
-
kind: "share",
|
|
973
|
-
from: sizeOf(at),
|
|
974
|
-
to: sizeOf(share),
|
|
975
|
-
...shareQuality === void 0 ? {} : { quality: shareQuality }
|
|
976
|
-
}
|
|
977
|
-
});
|
|
978
|
-
at = share;
|
|
979
|
-
}
|
|
980
|
-
if (at.width !== floor.width || at.height !== floor.height) {
|
|
981
|
-
rungs.push({
|
|
982
|
-
target: floor,
|
|
983
|
-
step: { kind: "frame", from: sizeOf(at), to: sizeOf(floor) }
|
|
984
|
-
});
|
|
985
|
-
}
|
|
986
|
-
const { quality: _byQuality, ...byBitrate } = floor.encoder ?? {};
|
|
987
|
-
rungs.push({
|
|
988
|
-
target: { ...floor, bitrate: fit.bitrate, encoder: byBitrate },
|
|
989
|
-
step: { kind: "fit", ...fit }
|
|
990
|
-
});
|
|
991
|
-
return rungs;
|
|
992
|
-
}
|
|
993
|
-
function fitRetry(fit, maxBytes, actualBytes) {
|
|
994
|
-
const bitrate = Math.round(fit.target.bitrate * maxBytes * HEADROOM / actualBytes);
|
|
995
|
-
if (fit.step.kind !== "fit") {
|
|
996
|
-
throw new Error(`fitRetry retries a fit rung, not a ${fit.step.kind} one`);
|
|
997
|
-
}
|
|
998
|
-
return {
|
|
999
|
-
target: { ...fit.target, bitrate },
|
|
1000
|
-
step: { kind: "fit", bitrate, durationMs: fit.step.durationMs }
|
|
1001
|
-
};
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
845
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
|
|
1005
846
|
var external_exports = {};
|
|
1006
847
|
__export(external_exports, {
|
|
@@ -15522,7 +15363,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15522
15363
|
moveTo: { cursorTravels: true, approach: "nearest" },
|
|
15523
15364
|
scrollTo: { cursorTravels: false, approach: "landing" },
|
|
15524
15365
|
waitFor: { cursorTravels: false, approach: "none" },
|
|
15525
|
-
drag: { cursorTravels: true, approach: "nearest" }
|
|
15366
|
+
drag: { cursorTravels: true, approach: "nearest" },
|
|
15367
|
+
press: { cursorTravels: false, approach: "none" }
|
|
15526
15368
|
};
|
|
15527
15369
|
|
|
15528
15370
|
// ../../packages/compositor/dist/bundle.js
|
|
@@ -16103,7 +15945,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16103
15945
|
var DEFAULT_WALLPAPER_ID = "muted-1";
|
|
16104
15946
|
|
|
16105
15947
|
// ../../packages/scene-schema/dist/document.js
|
|
16106
|
-
var CURRENT_SCHEMA_VERSION =
|
|
15948
|
+
var CURRENT_SCHEMA_VERSION = 15;
|
|
16107
15949
|
var Rect = external_exports.object({
|
|
16108
15950
|
x: external_exports.number(),
|
|
16109
15951
|
y: external_exports.number(),
|
|
@@ -16196,9 +16038,27 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16196
16038
|
signal: external_exports.enum(["mutation", "style"]).optional()
|
|
16197
16039
|
});
|
|
16198
16040
|
var TEXT_LINES_MAX = 200;
|
|
16041
|
+
var PRESS_KEYS = [
|
|
16042
|
+
"Enter",
|
|
16043
|
+
"Tab",
|
|
16044
|
+
"Escape",
|
|
16045
|
+
"Backspace",
|
|
16046
|
+
"Delete",
|
|
16047
|
+
"ArrowUp",
|
|
16048
|
+
"ArrowDown",
|
|
16049
|
+
"ArrowLeft",
|
|
16050
|
+
"ArrowRight",
|
|
16051
|
+
"Space"
|
|
16052
|
+
];
|
|
16053
|
+
var Spot = external_exports.object({
|
|
16054
|
+
x: external_exports.number().min(0).max(1),
|
|
16055
|
+
y: external_exports.number().min(0).max(1)
|
|
16056
|
+
});
|
|
16199
16057
|
var Click = external_exports.object({
|
|
16200
16058
|
...actionBase,
|
|
16201
16059
|
kind: external_exports.literal("click"),
|
|
16060
|
+
/** Where in the target's box the click lands, as fractions of it (v14); absent: its centre. */
|
|
16061
|
+
at: Spot.optional(),
|
|
16202
16062
|
button: external_exports.enum(["left", "middle", "right"]).optional(),
|
|
16203
16063
|
/**
|
|
16204
16064
|
* The lines of text on screen when the click was measured, in the space
|
|
@@ -16274,9 +16134,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16274
16134
|
kind: external_exports.literal("waitFor"),
|
|
16275
16135
|
condition: external_exports.enum(["visible", "hidden", "loaded"]).optional()
|
|
16276
16136
|
});
|
|
16277
|
-
var
|
|
16278
|
-
|
|
16279
|
-
|
|
16137
|
+
var Press = external_exports.object({
|
|
16138
|
+
...actionBase,
|
|
16139
|
+
anchorId: external_exports.null(),
|
|
16140
|
+
kind: external_exports.literal("press"),
|
|
16141
|
+
key: external_exports.enum(PRESS_KEYS)
|
|
16280
16142
|
});
|
|
16281
16143
|
var Drag = external_exports.object({
|
|
16282
16144
|
...actionBase,
|
|
@@ -16301,7 +16163,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16301
16163
|
TypeAction,
|
|
16302
16164
|
ScrollTo,
|
|
16303
16165
|
WaitFor,
|
|
16304
|
-
Drag
|
|
16166
|
+
Drag,
|
|
16167
|
+
Press
|
|
16305
16168
|
]);
|
|
16306
16169
|
var MarkerSchema2 = external_exports.object({
|
|
16307
16170
|
actionId: external_exports.string().min(1),
|
|
@@ -16326,14 +16189,35 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16326
16189
|
scale: external_exports.number().positive().optional(),
|
|
16327
16190
|
/** Why the aim is not what the click asked for (`aimFallback`), or
|
|
16328
16191
|
* anything else the editor owes the author about this zoom. */
|
|
16329
|
-
note: external_exports.string().optional()
|
|
16192
|
+
note: external_exports.string().optional(),
|
|
16193
|
+
/**
|
|
16194
|
+
* Where this zoom came from: `click` was generated for a click, `author`
|
|
16195
|
+
* was written by the author (the Studio's addZoom, or a click zoom the
|
|
16196
|
+
* author moved; a script's `zoom` stays `click` with `scaleSetBy: "script"`). The record that
|
|
16197
|
+
* write-back reads; never inferred from the event's shape. Absent on every
|
|
16198
|
+
* take saved before v15 — those are not guessed.
|
|
16199
|
+
*/
|
|
16200
|
+
source: external_exports.enum(["click", "author"]).optional(),
|
|
16201
|
+
/**
|
|
16202
|
+
* Who chose `scale`: `script` set it explicitly, `author` is the studio's
|
|
16203
|
+
* own edit. The record that write-back reads, never inferred from the
|
|
16204
|
+
* scale's value. Absent when the scale was the default.
|
|
16205
|
+
*/
|
|
16206
|
+
scaleSetBy: external_exports.enum(["script", "author"]).optional()
|
|
16330
16207
|
});
|
|
16331
16208
|
var ZoomSkipped = external_exports.union([
|
|
16332
16209
|
external_exports.object({
|
|
16333
16210
|
actionId: external_exports.string().min(1),
|
|
16334
16211
|
reason: external_exports.enum(["tooClose", "sameTarget"]),
|
|
16335
16212
|
afterActionId: external_exports.string().min(1),
|
|
16336
|
-
gapMs: external_exports.number()
|
|
16213
|
+
gapMs: external_exports.number(),
|
|
16214
|
+
/** The scale the script asked for on this click, which the gap refused.
|
|
16215
|
+
* The record that write-back reads, never inferred. */
|
|
16216
|
+
askedScale: external_exports.number().optional()
|
|
16217
|
+
}),
|
|
16218
|
+
external_exports.object({
|
|
16219
|
+
actionId: external_exports.string().min(1),
|
|
16220
|
+
reason: external_exports.literal("off")
|
|
16337
16221
|
}),
|
|
16338
16222
|
external_exports.object({
|
|
16339
16223
|
actionId: external_exports.string().min(1),
|
|
@@ -16813,8 +16697,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16813
16697
|
if (at === void 0) {
|
|
16814
16698
|
return { x: rect2.x + rect2.width / 2, y: rect2.y + rect2.height / 2 };
|
|
16815
16699
|
}
|
|
16816
|
-
return {
|
|
16700
|
+
return {
|
|
16701
|
+
x: inside(rect2.x, rect2.width, at.x),
|
|
16702
|
+
y: inside(rect2.y, rect2.height, at.y)
|
|
16703
|
+
};
|
|
16817
16704
|
}
|
|
16705
|
+
function inside(start, size, fraction) {
|
|
16706
|
+
const inset = Math.min(EDGE_INSET_PX, size / 2);
|
|
16707
|
+
return Math.min(Math.max(start + fraction * size, start + inset), start + size - inset);
|
|
16708
|
+
}
|
|
16709
|
+
var EDGE_INSET_PX = 0.5;
|
|
16818
16710
|
function dragEndPoint(start, to, toRect) {
|
|
16819
16711
|
if ("by" in to)
|
|
16820
16712
|
return { x: start.x + to.by.x, y: start.y + to.by.y };
|
|
@@ -16831,7 +16723,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16831
16723
|
// ../../packages/scene-schema/dist/removed.js
|
|
16832
16724
|
function stepsInsideRemoved(doc) {
|
|
16833
16725
|
const index = new Map(doc.actions.map((a, i) => [a.id, i]));
|
|
16834
|
-
const
|
|
16726
|
+
const inside2 = /* @__PURE__ */ new Set();
|
|
16835
16727
|
for (const range of doc.edits.removed ?? []) {
|
|
16836
16728
|
const s = range.start === null ? null : index.get(range.start.actionId);
|
|
16837
16729
|
const e = range.end === null ? null : index.get(range.end.actionId);
|
|
@@ -16841,10 +16733,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16841
16733
|
const afterStart = range.start === null || s === null || s < i || i === s && range.start.sourceOffsetMs <= 0;
|
|
16842
16734
|
const beforeEnd = range.end === null || e === null || i < e || i === e && range.end.sourceOffsetMs > 0;
|
|
16843
16735
|
if (afterStart && beforeEnd)
|
|
16844
|
-
|
|
16736
|
+
inside2.add(action.id);
|
|
16845
16737
|
});
|
|
16846
16738
|
}
|
|
16847
|
-
return
|
|
16739
|
+
return inside2;
|
|
16848
16740
|
}
|
|
16849
16741
|
|
|
16850
16742
|
// ../../packages/scene-schema/dist/script.js
|
|
@@ -16854,6 +16746,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16854
16746
|
var SCRIPT_VERSION_DEVICE = 4;
|
|
16855
16747
|
var SCRIPT_VERSION_ACCOUNT = 5;
|
|
16856
16748
|
var SCRIPT_VERSION_DRAG = 6;
|
|
16749
|
+
var SCRIPT_VERSION_PRESS = 7;
|
|
16750
|
+
var SCRIPT_VERSION_EDITS = 8;
|
|
16751
|
+
var ZOOM_MAX_SCALE = 2.5;
|
|
16857
16752
|
var ACCOUNT_NAME = /^[a-z0-9][a-z0-9_-]{0,63}$/;
|
|
16858
16753
|
var ACCOUNT_NAME_RULE = 'lower-case letters, digits, "-" and "_", starting with a letter or digit, at most 64 characters';
|
|
16859
16754
|
var ScriptTargetSchema = external_exports.union([
|
|
@@ -16871,10 +16766,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16871
16766
|
by: external_exports.object({ x: external_exports.number().finite(), y: external_exports.number().finite() }).strict()
|
|
16872
16767
|
}).strict()
|
|
16873
16768
|
]);
|
|
16769
|
+
var ZoomIntentSchema = external_exports.union([
|
|
16770
|
+
external_exports.literal(false),
|
|
16771
|
+
external_exports.object({
|
|
16772
|
+
scale: external_exports.number().gt(1, {
|
|
16773
|
+
message: "a zoom scale is over 1; use `zoom: false` for none"
|
|
16774
|
+
}).max(ZOOM_MAX_SCALE, {
|
|
16775
|
+
message: `a zoom scale is at most ${ZOOM_MAX_SCALE}, the camera's limit`
|
|
16776
|
+
})
|
|
16777
|
+
}).strict()
|
|
16778
|
+
]);
|
|
16874
16779
|
var ScriptStepSchema = external_exports.discriminatedUnion("do", [
|
|
16875
16780
|
external_exports.object({
|
|
16876
16781
|
do: external_exports.literal("click"),
|
|
16877
16782
|
on: ScriptTargetSchema,
|
|
16783
|
+
/** Where in the target's box to click (its centre if absent). */
|
|
16784
|
+
at: DragSpotSchema.optional(),
|
|
16785
|
+
zoom: ZoomIntentSchema.optional(),
|
|
16878
16786
|
/**
|
|
16879
16787
|
* The recorded action this step was derived from (`scriptFromTake` writes
|
|
16880
16788
|
* it). How the recording layer pairs a run's step with the author's —
|
|
@@ -16925,6 +16833,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16925
16833
|
do: external_exports.literal("drag"),
|
|
16926
16834
|
from: DragFromSchema,
|
|
16927
16835
|
to: DragToSchema,
|
|
16836
|
+
zoom: ZoomIntentSchema.optional(),
|
|
16837
|
+
recorded: RecordedSchema
|
|
16838
|
+
}).strict(),
|
|
16839
|
+
external_exports.object({
|
|
16840
|
+
do: external_exports.literal("press"),
|
|
16841
|
+
key: external_exports.enum(PRESS_KEYS),
|
|
16928
16842
|
recorded: RecordedSchema
|
|
16929
16843
|
}).strict(),
|
|
16930
16844
|
external_exports.object({ do: external_exports.literal("waitForLoad"), recorded: RecordedSchema }).strict(),
|
|
@@ -16937,21 +16851,56 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16937
16851
|
scrollTo: true,
|
|
16938
16852
|
waitFor: true,
|
|
16939
16853
|
drag: true,
|
|
16854
|
+
press: true,
|
|
16940
16855
|
waitForLoad: true,
|
|
16941
16856
|
pause: false
|
|
16942
16857
|
};
|
|
16858
|
+
var SHOWN_STEP = {
|
|
16859
|
+
click: true,
|
|
16860
|
+
type: true,
|
|
16861
|
+
hover: true,
|
|
16862
|
+
scrollTo: true,
|
|
16863
|
+
waitFor: false,
|
|
16864
|
+
drag: true,
|
|
16865
|
+
press: true,
|
|
16866
|
+
waitForLoad: false,
|
|
16867
|
+
pause: false
|
|
16868
|
+
};
|
|
16869
|
+
function trimStepIndex(script, side) {
|
|
16870
|
+
const step = script.trim?.[side]?.step;
|
|
16871
|
+
if (step !== void 0)
|
|
16872
|
+
return step - 1;
|
|
16873
|
+
const shown = script.steps.flatMap((s, i) => SHOWN_STEP[s.do] ? [i] : []);
|
|
16874
|
+
return (side === "start" ? shown[0] : shown.at(-1)) ?? null;
|
|
16875
|
+
}
|
|
16876
|
+
var ScriptTrimSchema = external_exports.object({
|
|
16877
|
+
start: external_exports.object({
|
|
16878
|
+
ms: external_exports.number().finite().nonnegative(),
|
|
16879
|
+
step: external_exports.number().int().positive().optional()
|
|
16880
|
+
}).strict().optional(),
|
|
16881
|
+
end: external_exports.object({
|
|
16882
|
+
ms: external_exports.number().finite().nonnegative(),
|
|
16883
|
+
step: external_exports.number().int().positive().optional(),
|
|
16884
|
+
after: external_exports.enum(["zoomOut", "action"]).optional()
|
|
16885
|
+
}).strict().optional()
|
|
16886
|
+
}).strict();
|
|
16943
16887
|
var ScriptBrandingSchema = BrandingSchema.extend({
|
|
16944
16888
|
padding: BrandingSchema.shape.padding.default(BRANDING_DEFAULTS.padding)
|
|
16945
16889
|
});
|
|
16890
|
+
var ScriptVersionSchema = external_exports.literal([
|
|
16891
|
+
SCRIPT_VERSION,
|
|
16892
|
+
SCRIPT_VERSION_KIT,
|
|
16893
|
+
SCRIPT_VERSION_MOTION,
|
|
16894
|
+
SCRIPT_VERSION_DEVICE,
|
|
16895
|
+
SCRIPT_VERSION_ACCOUNT,
|
|
16896
|
+
SCRIPT_VERSION_DRAG,
|
|
16897
|
+
SCRIPT_VERSION_PRESS,
|
|
16898
|
+
SCRIPT_VERSION_EDITS
|
|
16899
|
+
]);
|
|
16900
|
+
var laterVersion = (a, b) => b > a ? b : a;
|
|
16946
16901
|
var DemoScriptShape = external_exports.object({
|
|
16947
|
-
|
|
16948
|
-
|
|
16949
|
-
SCRIPT_VERSION_KIT,
|
|
16950
|
-
SCRIPT_VERSION_MOTION,
|
|
16951
|
-
SCRIPT_VERSION_DEVICE,
|
|
16952
|
-
SCRIPT_VERSION_ACCOUNT,
|
|
16953
|
-
SCRIPT_VERSION_DRAG
|
|
16954
|
-
]),
|
|
16902
|
+
/** Optional: Demoman sets it (see `minimumScriptVersion`); a lower one is raised. */
|
|
16903
|
+
scriptVersion: ScriptVersionSchema.optional(),
|
|
16955
16904
|
name: external_exports.string().min(1),
|
|
16956
16905
|
target: external_exports.url(),
|
|
16957
16906
|
/** Absent means the run's own window size, recorded into the document. */
|
|
@@ -16968,6 +16917,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16968
16917
|
message: `an account name is ${ACCOUNT_NAME_RULE}`
|
|
16969
16918
|
}).optional(),
|
|
16970
16919
|
steps: external_exports.array(ScriptStepSchema).min(1),
|
|
16920
|
+
/** Cut the film's start and end (`ScriptTrimSchema`). Absent: the whole take. */
|
|
16921
|
+
trim: ScriptTrimSchema.optional(),
|
|
16971
16922
|
/**
|
|
16972
16923
|
* The take that steps' `recorded` ids refer to (`scriptFromTake` writes it).
|
|
16973
16924
|
* Absent on a script nobody derived from a recording.
|
|
@@ -17002,13 +16953,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17002
16953
|
}).optional()
|
|
17003
16954
|
});
|
|
17004
16955
|
var DemoScriptSchema = DemoScriptShape.superRefine((script, ctx) => {
|
|
17005
|
-
if (script.look?.kit !== void 0 && script.scriptVersion < SCRIPT_VERSION_KIT) {
|
|
17006
|
-
ctx.addIssue({
|
|
17007
|
-
code: "custom",
|
|
17008
|
-
message: `a script that names look.kit declares scriptVersion ${SCRIPT_VERSION_KIT}: a build from before brand kits would drop the kit and record the default look`,
|
|
17009
|
-
path: ["scriptVersion"]
|
|
17010
|
-
});
|
|
17011
|
-
}
|
|
17012
16956
|
const bg = script.look?.branding?.background;
|
|
17013
16957
|
if (bg?.kind === "wallpaper" && !WALLPAPERS.some((w) => w.id === bg.id)) {
|
|
17014
16958
|
ctx.addIssue({
|
|
@@ -17017,44 +16961,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17017
16961
|
path: ["look", "branding", "background", "id"]
|
|
17018
16962
|
});
|
|
17019
16963
|
}
|
|
17020
|
-
if (script.look?.motion !== void 0 && script.scriptVersion < SCRIPT_VERSION_MOTION) {
|
|
17021
|
-
ctx.addIssue({
|
|
17022
|
-
code: "custom",
|
|
17023
|
-
message: `a script that names look.motion declares scriptVersion ${SCRIPT_VERSION_MOTION}: a build from before camera motion settings would drop them and record the default camera`,
|
|
17024
|
-
path: ["scriptVersion"]
|
|
17025
|
-
});
|
|
17026
|
-
}
|
|
17027
|
-
if (cursorPolishNamed(script.look?.cursor) && script.scriptVersion < SCRIPT_VERSION_MOTION) {
|
|
17028
|
-
ctx.addIssue({
|
|
17029
|
-
code: "custom",
|
|
17030
|
-
message: `a script that names look.cursor.tilt or look.cursor.clickBounce declares scriptVersion ${SCRIPT_VERSION_MOTION}: a build from before them would drop them and draw the default lean and press`,
|
|
17031
|
-
path: ["scriptVersion"]
|
|
17032
|
-
});
|
|
17033
|
-
}
|
|
17034
|
-
if (script.device !== void 0 && script.scriptVersion < SCRIPT_VERSION_DEVICE) {
|
|
17035
|
-
ctx.addIssue({
|
|
17036
|
-
code: "custom",
|
|
17037
|
-
message: `a script that names device declares scriptVersion ${SCRIPT_VERSION_DEVICE}: a build from before devices would drop it and record the desktop`,
|
|
17038
|
-
path: ["scriptVersion"]
|
|
17039
|
-
});
|
|
17040
|
-
}
|
|
17041
|
-
if (script.account !== void 0 && script.scriptVersion < SCRIPT_VERSION_ACCOUNT) {
|
|
17042
|
-
ctx.addIssue({
|
|
17043
|
-
code: "custom",
|
|
17044
|
-
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`,
|
|
17045
|
-
path: ["scriptVersion"]
|
|
17046
|
-
});
|
|
17047
|
-
}
|
|
17048
16964
|
script.steps.forEach((step, index) => {
|
|
17049
16965
|
if (step.do !== "drag")
|
|
17050
16966
|
return;
|
|
17051
|
-
if (script.scriptVersion < SCRIPT_VERSION_DRAG) {
|
|
17052
|
-
ctx.addIssue({
|
|
17053
|
-
code: "custom",
|
|
17054
|
-
message: `a script that uses drag declares scriptVersion ${SCRIPT_VERSION_DRAG}: a build from before drag would refuse the step`,
|
|
17055
|
-
path: ["scriptVersion"]
|
|
17056
|
-
});
|
|
17057
|
-
}
|
|
17058
16967
|
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);
|
|
17059
16968
|
if (nowhere) {
|
|
17060
16969
|
ctx.addIssue({
|
|
@@ -17091,6 +17000,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17091
17000
|
});
|
|
17092
17001
|
});
|
|
17093
17002
|
}
|
|
17003
|
+
if (script.trim)
|
|
17004
|
+
trimIssues(script, ctx);
|
|
17094
17005
|
if (script.steps.some((step) => ACTS_ON_THE_PAGE[step.do]))
|
|
17095
17006
|
return;
|
|
17096
17007
|
ctx.addIssue({
|
|
@@ -17098,11 +17009,424 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17098
17009
|
message: "a script needs at least one step that acts on the page; every step here is a pause, which is a duration and performs nothing, so this script can never produce a take",
|
|
17099
17010
|
path: ["steps"]
|
|
17100
17011
|
});
|
|
17101
|
-
})
|
|
17012
|
+
}).transform((script) => ({
|
|
17013
|
+
...script,
|
|
17014
|
+
scriptVersion: laterVersion(script.scriptVersion ?? SCRIPT_VERSION, minimumScriptVersion(script))
|
|
17015
|
+
}));
|
|
17016
|
+
function trimIssues(script, ctx) {
|
|
17017
|
+
const { steps, trim = {} } = script;
|
|
17018
|
+
let bad = false;
|
|
17019
|
+
for (const edge of ["start", "end"]) {
|
|
17020
|
+
const step = trim[edge]?.step;
|
|
17021
|
+
if (step === void 0)
|
|
17022
|
+
continue;
|
|
17023
|
+
const why = step > steps.length ? `trim.${edge}.step is ${step}, but the script has ${steps.length} steps` : steps[step - 1]?.do === "pause" ? `trim.${edge}.step is ${step}, a pause: name a step that does something` : void 0;
|
|
17024
|
+
if (!why)
|
|
17025
|
+
continue;
|
|
17026
|
+
bad = true;
|
|
17027
|
+
ctx.addIssue({
|
|
17028
|
+
code: "custom",
|
|
17029
|
+
message: why,
|
|
17030
|
+
path: ["trim", edge, "step"]
|
|
17031
|
+
});
|
|
17032
|
+
}
|
|
17033
|
+
const start = trimStepIndex(script, "start");
|
|
17034
|
+
const end = trimStepIndex(script, "end");
|
|
17035
|
+
if (!bad && start !== null && end !== null && start > end) {
|
|
17036
|
+
ctx.addIssue({
|
|
17037
|
+
code: "custom",
|
|
17038
|
+
message: `trim starts at step ${start + 1}, after the step it ends at (${end + 1}): the film would be empty`,
|
|
17039
|
+
path: ["trim", "start", "step"]
|
|
17040
|
+
});
|
|
17041
|
+
}
|
|
17042
|
+
}
|
|
17043
|
+
function minimumScriptVersion(script) {
|
|
17044
|
+
const rules = [
|
|
17045
|
+
[script.look?.kit !== void 0, SCRIPT_VERSION_KIT],
|
|
17046
|
+
[script.look?.motion !== void 0, SCRIPT_VERSION_MOTION],
|
|
17047
|
+
[cursorPolishNamed(script.look?.cursor), SCRIPT_VERSION_MOTION],
|
|
17048
|
+
[script.device !== void 0, SCRIPT_VERSION_DEVICE],
|
|
17049
|
+
[script.account !== void 0, SCRIPT_VERSION_ACCOUNT],
|
|
17050
|
+
[script.steps.some((step) => step.do === "drag"), SCRIPT_VERSION_DRAG],
|
|
17051
|
+
[
|
|
17052
|
+
script.trim !== void 0 || script.steps.some((step) => (step.do === "click" || step.do === "drag") && step.zoom !== void 0),
|
|
17053
|
+
SCRIPT_VERSION_EDITS
|
|
17054
|
+
],
|
|
17055
|
+
[
|
|
17056
|
+
script.steps.some((step) => step.do === "press" || step.do === "click" && step.at),
|
|
17057
|
+
SCRIPT_VERSION_PRESS
|
|
17058
|
+
]
|
|
17059
|
+
];
|
|
17060
|
+
return rules.filter(([on]) => on).map(([, v]) => v).reduce(laterVersion, SCRIPT_VERSION);
|
|
17061
|
+
}
|
|
17102
17062
|
function cursorPolishNamed(cursor) {
|
|
17103
17063
|
return cursor?.tilt !== void 0 || cursor?.clickBounce !== void 0;
|
|
17104
17064
|
}
|
|
17105
17065
|
|
|
17066
|
+
// ../../packages/compositor/dist/plan/smooth.js
|
|
17067
|
+
var CURSOR_SMOOTHING_MS = 30;
|
|
17068
|
+
var KERNEL_REACH_SIGMAS = 3;
|
|
17069
|
+
var CURSOR_REST_MS = 50;
|
|
17070
|
+
function bracketIndices(samples, times) {
|
|
17071
|
+
const out = /* @__PURE__ */ new Set();
|
|
17072
|
+
for (const t of times) {
|
|
17073
|
+
let before = null;
|
|
17074
|
+
let after = null;
|
|
17075
|
+
for (let i = 0; i < samples.length; i++) {
|
|
17076
|
+
const at = samples[i]?.sourceTimeMs;
|
|
17077
|
+
if (at === void 0)
|
|
17078
|
+
continue;
|
|
17079
|
+
if (at <= t)
|
|
17080
|
+
before = i;
|
|
17081
|
+
if (at >= t) {
|
|
17082
|
+
after = i;
|
|
17083
|
+
break;
|
|
17084
|
+
}
|
|
17085
|
+
}
|
|
17086
|
+
if (before !== null)
|
|
17087
|
+
out.add(before);
|
|
17088
|
+
if (after !== null)
|
|
17089
|
+
out.add(after);
|
|
17090
|
+
}
|
|
17091
|
+
return out;
|
|
17092
|
+
}
|
|
17093
|
+
function runBounds(samples, boundaryMs, gaps) {
|
|
17094
|
+
const start = new Array(samples.length).fill(0);
|
|
17095
|
+
const end = new Array(samples.length).fill(samples.length - 1);
|
|
17096
|
+
let runStart = 0;
|
|
17097
|
+
for (let i = 1; i <= samples.length; i++) {
|
|
17098
|
+
const previous = samples[i - 1];
|
|
17099
|
+
const current = samples[i];
|
|
17100
|
+
const broken = current === void 0 || previous === void 0 || current.sourceTimeMs - previous.sourceTimeMs > boundaryMs || overlapsGap(gaps, previous.sourceTimeMs, current.sourceTimeMs);
|
|
17101
|
+
if (!broken)
|
|
17102
|
+
continue;
|
|
17103
|
+
for (let j = runStart; j < i; j++) {
|
|
17104
|
+
start[j] = runStart;
|
|
17105
|
+
end[j] = i - 1;
|
|
17106
|
+
}
|
|
17107
|
+
runStart = i;
|
|
17108
|
+
}
|
|
17109
|
+
return { start, end };
|
|
17110
|
+
}
|
|
17111
|
+
function smoothCursor(samples, sigmaMs, pinnedMs = [], gaps = []) {
|
|
17112
|
+
if (sigmaMs <= 0 || samples.length < 3)
|
|
17113
|
+
return samples;
|
|
17114
|
+
const pinned = bracketIndices(samples, pinnedMs);
|
|
17115
|
+
const runs = runBounds(samples, CURSOR_REST_MS, gaps);
|
|
17116
|
+
const maxReach = KERNEL_REACH_SIGMAS * sigmaMs;
|
|
17117
|
+
const twoSigmaSquared = 2 * sigmaMs * sigmaMs;
|
|
17118
|
+
const SLACK_MS = 1e-6;
|
|
17119
|
+
let lo = 0;
|
|
17120
|
+
let hi = 0;
|
|
17121
|
+
let currentRun = -1;
|
|
17122
|
+
let cadence = 0;
|
|
17123
|
+
let padBefore = 0;
|
|
17124
|
+
let padAfter = 0;
|
|
17125
|
+
return samples.map((sample, i) => {
|
|
17126
|
+
const runStart = runs.start[i];
|
|
17127
|
+
const runEnd = runs.end[i];
|
|
17128
|
+
const first = samples[runStart];
|
|
17129
|
+
const last2 = samples[runEnd];
|
|
17130
|
+
if (runStart !== currentRun) {
|
|
17131
|
+
currentRun = runStart;
|
|
17132
|
+
lo = runStart;
|
|
17133
|
+
hi = runStart;
|
|
17134
|
+
const span = last2.sourceTimeMs - first.sourceTimeMs;
|
|
17135
|
+
cadence = runEnd > runStart ? span / (runEnd - runStart) : 0;
|
|
17136
|
+
const previousEnd = runStart > 0 ? samples[runStart - 1].sourceTimeMs : 0;
|
|
17137
|
+
const nextStart = runEnd < samples.length - 1 ? samples[runEnd + 1].sourceTimeMs : 0;
|
|
17138
|
+
const quietBefore = runStart > 0 && !overlapsGap(gaps, previousEnd, first.sourceTimeMs) ? first.sourceTimeMs - previousEnd : 0;
|
|
17139
|
+
const quietAfter = runEnd < samples.length - 1 && !overlapsGap(gaps, last2.sourceTimeMs, nextStart) ? nextStart - last2.sourceTimeMs : 0;
|
|
17140
|
+
padBefore = Math.min(maxReach, quietBefore);
|
|
17141
|
+
padAfter = Math.min(maxReach, quietAfter);
|
|
17142
|
+
}
|
|
17143
|
+
if (i === runStart || i === runEnd)
|
|
17144
|
+
return sample;
|
|
17145
|
+
if (pinned.has(i))
|
|
17146
|
+
return sample;
|
|
17147
|
+
const at = sample.sourceTimeMs;
|
|
17148
|
+
const reach = Math.min(maxReach, at - first.sourceTimeMs + padBefore, last2.sourceTimeMs - at + padAfter);
|
|
17149
|
+
if (reach <= 0)
|
|
17150
|
+
return sample;
|
|
17151
|
+
while (lo <= runEnd && at - samples[lo].sourceTimeMs > reach + SLACK_MS)
|
|
17152
|
+
lo++;
|
|
17153
|
+
if (hi < lo)
|
|
17154
|
+
hi = lo;
|
|
17155
|
+
while (hi <= runEnd && samples[hi].sourceTimeMs - at <= reach + SLACK_MS)
|
|
17156
|
+
hi++;
|
|
17157
|
+
let sx = 0;
|
|
17158
|
+
let sy = 0;
|
|
17159
|
+
let weight = 0;
|
|
17160
|
+
for (let j = lo; j < hi; j++) {
|
|
17161
|
+
const other = samples[j];
|
|
17162
|
+
if (!other)
|
|
17163
|
+
continue;
|
|
17164
|
+
const dt = other.sourceTimeMs - at;
|
|
17165
|
+
if (Math.abs(dt) > reach)
|
|
17166
|
+
continue;
|
|
17167
|
+
const w = Math.exp(-(dt * dt) / twoSigmaSquared);
|
|
17168
|
+
sx += other.x * w;
|
|
17169
|
+
sy += other.y * w;
|
|
17170
|
+
weight += w;
|
|
17171
|
+
}
|
|
17172
|
+
if (cadence > 0) {
|
|
17173
|
+
for (let step = cadence; step <= padBefore + SLACK_MS; step += cadence) {
|
|
17174
|
+
const dt = first.sourceTimeMs - step - at;
|
|
17175
|
+
if (-dt > reach + SLACK_MS)
|
|
17176
|
+
break;
|
|
17177
|
+
const w = Math.exp(-(dt * dt) / twoSigmaSquared);
|
|
17178
|
+
sx += first.x * w;
|
|
17179
|
+
sy += first.y * w;
|
|
17180
|
+
weight += w;
|
|
17181
|
+
}
|
|
17182
|
+
for (let step = cadence; step <= padAfter + SLACK_MS; step += cadence) {
|
|
17183
|
+
const dt = last2.sourceTimeMs + step - at;
|
|
17184
|
+
if (dt > reach + SLACK_MS)
|
|
17185
|
+
break;
|
|
17186
|
+
const w = Math.exp(-(dt * dt) / twoSigmaSquared);
|
|
17187
|
+
sx += last2.x * w;
|
|
17188
|
+
sy += last2.y * w;
|
|
17189
|
+
weight += w;
|
|
17190
|
+
}
|
|
17191
|
+
}
|
|
17192
|
+
return weight === 0 ? sample : { sourceTimeMs: at, x: sx / weight, y: sy / weight };
|
|
17193
|
+
});
|
|
17194
|
+
}
|
|
17195
|
+
|
|
17196
|
+
// ../../packages/compositor/dist/plan/cursor-spring.js
|
|
17197
|
+
var CURSOR_SPRING_TAU_MS = 55;
|
|
17198
|
+
function springLeadMs(tauMs) {
|
|
17199
|
+
return 2 * tauMs;
|
|
17200
|
+
}
|
|
17201
|
+
function springSettleMs(tauMs) {
|
|
17202
|
+
return 6 * tauMs;
|
|
17203
|
+
}
|
|
17204
|
+
function positionAt(samples, ms) {
|
|
17205
|
+
const first = samples[0];
|
|
17206
|
+
if (ms <= first.sourceTimeMs)
|
|
17207
|
+
return { x: first.x, y: first.y };
|
|
17208
|
+
for (let i = 1; i < samples.length; i++) {
|
|
17209
|
+
const to = samples[i];
|
|
17210
|
+
if (to.sourceTimeMs < ms)
|
|
17211
|
+
continue;
|
|
17212
|
+
const from = samples[i - 1];
|
|
17213
|
+
const span = to.sourceTimeMs - from.sourceTimeMs;
|
|
17214
|
+
const u = span === 0 ? 0 : (ms - from.sourceTimeMs) / span;
|
|
17215
|
+
return { x: from.x + (to.x - from.x) * u, y: from.y + (to.y - from.y) * u };
|
|
17216
|
+
}
|
|
17217
|
+
const last2 = samples[samples.length - 1];
|
|
17218
|
+
return { x: last2.x, y: last2.y };
|
|
17219
|
+
}
|
|
17220
|
+
function readerFor(samples) {
|
|
17221
|
+
let i = 1;
|
|
17222
|
+
return (ms) => {
|
|
17223
|
+
const first = samples[0];
|
|
17224
|
+
if (ms <= first.sourceTimeMs)
|
|
17225
|
+
return { x: first.x, y: first.y };
|
|
17226
|
+
while (i < samples.length && samples[i].sourceTimeMs < ms) {
|
|
17227
|
+
i++;
|
|
17228
|
+
}
|
|
17229
|
+
const to = samples[i];
|
|
17230
|
+
if (!to) {
|
|
17231
|
+
const last2 = samples[samples.length - 1];
|
|
17232
|
+
return { x: last2.x, y: last2.y };
|
|
17233
|
+
}
|
|
17234
|
+
const from = samples[i - 1];
|
|
17235
|
+
const span = to.sourceTimeMs - from.sourceTimeMs;
|
|
17236
|
+
const u = span === 0 ? 0 : (ms - from.sourceTimeMs) / span;
|
|
17237
|
+
return { x: from.x + (to.x - from.x) * u, y: from.y + (to.y - from.y) * u };
|
|
17238
|
+
};
|
|
17239
|
+
}
|
|
17240
|
+
var SPRING_GRID_MS = 8;
|
|
17241
|
+
function followWithSpring(samples, tauMs, anchorMs, gaps = []) {
|
|
17242
|
+
if (tauMs <= 0 || samples.length < 2)
|
|
17243
|
+
return samples;
|
|
17244
|
+
if (gaps.length === 0)
|
|
17245
|
+
return followOneStretch(samples, tauMs, anchorMs);
|
|
17246
|
+
const out = [];
|
|
17247
|
+
let start = 0;
|
|
17248
|
+
for (let i = 1; i <= samples.length; i++) {
|
|
17249
|
+
const current = samples[i];
|
|
17250
|
+
const previous = samples[i - 1];
|
|
17251
|
+
const broken = current === void 0 || overlapsGap(gaps, previous.sourceTimeMs, current.sourceTimeMs);
|
|
17252
|
+
if (!broken)
|
|
17253
|
+
continue;
|
|
17254
|
+
const stretch = samples.slice(start, i);
|
|
17255
|
+
const from = stretch[0];
|
|
17256
|
+
const to = stretch[stretch.length - 1];
|
|
17257
|
+
out.push(...stretch.length < 2 ? stretch : followOneStretch(stretch, tauMs, anchorMs.filter((ms) => ms >= from.sourceTimeMs && ms <= to.sourceTimeMs)));
|
|
17258
|
+
start = i;
|
|
17259
|
+
}
|
|
17260
|
+
return out;
|
|
17261
|
+
}
|
|
17262
|
+
function followOneStretch(samples, tauMs, anchorMs) {
|
|
17263
|
+
const omega = 1 / tauMs;
|
|
17264
|
+
const settleMs = springSettleMs(tauMs);
|
|
17265
|
+
const first = samples[0];
|
|
17266
|
+
const out = [{ ...first }];
|
|
17267
|
+
let x = first.x;
|
|
17268
|
+
let y = first.y;
|
|
17269
|
+
let vx = 0;
|
|
17270
|
+
let vy = 0;
|
|
17271
|
+
const advance = (dt, targetX, targetY, atMs) => {
|
|
17272
|
+
if (dt <= 0) {
|
|
17273
|
+
out.push({ sourceTimeMs: atMs, x, y });
|
|
17274
|
+
return;
|
|
17275
|
+
}
|
|
17276
|
+
const decay = Math.exp(-omega * dt);
|
|
17277
|
+
const ex = x - targetX;
|
|
17278
|
+
const ey = y - targetY;
|
|
17279
|
+
const bx = vx + omega * ex;
|
|
17280
|
+
const by = vy + omega * ey;
|
|
17281
|
+
const nx = (ex + bx * dt) * decay;
|
|
17282
|
+
const ny = (ey + by * dt) * decay;
|
|
17283
|
+
vx = (bx - omega * (ex + bx * dt)) * decay;
|
|
17284
|
+
vy = (by - omega * (ey + by * dt)) * decay;
|
|
17285
|
+
x = targetX + nx;
|
|
17286
|
+
y = targetY + ny;
|
|
17287
|
+
out.push({ sourceTimeMs: atMs, x, y });
|
|
17288
|
+
};
|
|
17289
|
+
const lead = springLeadMs(tauMs);
|
|
17290
|
+
const times = [];
|
|
17291
|
+
for (let i = 1; i < samples.length; i++) {
|
|
17292
|
+
const from = samples[i - 1];
|
|
17293
|
+
const to = samples[i];
|
|
17294
|
+
if (to.sourceTimeMs - from.sourceTimeMs > CURSOR_REST_MS) {
|
|
17295
|
+
const headUntil = Math.min(to.sourceTimeMs, from.sourceTimeMs + settleMs);
|
|
17296
|
+
const tailFrom = Math.max(from.sourceTimeMs, to.sourceTimeMs - lead - settleMs);
|
|
17297
|
+
for (let ms = from.sourceTimeMs + SPRING_GRID_MS; ms < to.sourceTimeMs; ms += SPRING_GRID_MS) {
|
|
17298
|
+
if (ms < headUntil || ms >= tailFrom)
|
|
17299
|
+
times.push(ms);
|
|
17300
|
+
}
|
|
17301
|
+
}
|
|
17302
|
+
times.push(to.sourceTimeMs);
|
|
17303
|
+
}
|
|
17304
|
+
const read = readerFor(samples);
|
|
17305
|
+
let previous = first.sourceTimeMs;
|
|
17306
|
+
for (const ms of times) {
|
|
17307
|
+
const target = read((previous + ms) / 2 + lead);
|
|
17308
|
+
advance(ms - previous, target.x, target.y, ms);
|
|
17309
|
+
previous = ms;
|
|
17310
|
+
}
|
|
17311
|
+
const last2 = samples[samples.length - 1];
|
|
17312
|
+
for (let ms = previous + SPRING_GRID_MS; ms <= last2.sourceTimeMs + settleMs; ms += SPRING_GRID_MS) {
|
|
17313
|
+
advance(ms - previous, last2.x, last2.y, ms);
|
|
17314
|
+
previous = ms;
|
|
17315
|
+
}
|
|
17316
|
+
return anchor(out, samples, anchorMs, settleMs);
|
|
17317
|
+
}
|
|
17318
|
+
function anchor(drawn, target, anchorMs, shoulderMs) {
|
|
17319
|
+
const anchors = [...new Set(anchorMs)].sort((a, b) => a - b);
|
|
17320
|
+
if (anchors.length === 0 || shoulderMs <= 0)
|
|
17321
|
+
return drawn;
|
|
17322
|
+
const out = drawn.map((s) => ({ ...s }));
|
|
17323
|
+
for (const [index, ms] of anchors.entries()) {
|
|
17324
|
+
const previous = anchors[index - 1];
|
|
17325
|
+
const next = anchors[index + 1];
|
|
17326
|
+
const room = Math.min(previous === void 0 ? Number.POSITIVE_INFINITY : (ms - previous) / 2, next === void 0 ? Number.POSITIVE_INFINITY : (next - ms) / 2);
|
|
17327
|
+
const shoulder = Math.min(shoulderMs, room);
|
|
17328
|
+
if (!Number.isFinite(shoulder) || shoulder <= 0)
|
|
17329
|
+
continue;
|
|
17330
|
+
const truth = positionAt(target, ms);
|
|
17331
|
+
const here = positionAt(out, ms);
|
|
17332
|
+
const dx = truth.x - here.x;
|
|
17333
|
+
const dy = truth.y - here.y;
|
|
17334
|
+
if (dx === 0 && dy === 0)
|
|
17335
|
+
continue;
|
|
17336
|
+
for (const sample of out) {
|
|
17337
|
+
const away = Math.abs(sample.sourceTimeMs - ms);
|
|
17338
|
+
if (away > shoulder)
|
|
17339
|
+
continue;
|
|
17340
|
+
const weight = 0.5 * (1 + Math.cos(Math.PI * away / shoulder));
|
|
17341
|
+
sample.x += dx * weight;
|
|
17342
|
+
sample.y += dy * weight;
|
|
17343
|
+
}
|
|
17344
|
+
}
|
|
17345
|
+
return out;
|
|
17346
|
+
}
|
|
17347
|
+
|
|
17348
|
+
// ../../packages/compositor/dist/plan/screen-space.js
|
|
17349
|
+
function transformAt(transforms, sourceTimeMs) {
|
|
17350
|
+
let at = transforms[0] ?? null;
|
|
17351
|
+
for (const t of transforms) {
|
|
17352
|
+
if (t.sourceTimeMs > sourceTimeMs)
|
|
17353
|
+
break;
|
|
17354
|
+
at = t;
|
|
17355
|
+
}
|
|
17356
|
+
return at;
|
|
17357
|
+
}
|
|
17358
|
+
var point = (p, t) => ({
|
|
17359
|
+
x: (p.x - t.offsetX) * t.scale,
|
|
17360
|
+
y: (p.y - t.offsetY) * t.scale
|
|
17361
|
+
});
|
|
17362
|
+
var rect = (r, t) => ({
|
|
17363
|
+
...r,
|
|
17364
|
+
...point(r, t),
|
|
17365
|
+
width: r.width * t.scale,
|
|
17366
|
+
height: r.height * t.scale
|
|
17367
|
+
});
|
|
17368
|
+
var isIdentity = (t) => t.scale === 1 && t.offsetX === 0 && t.offsetY === 0;
|
|
17369
|
+
function inScreenSpace(bundle, scene) {
|
|
17370
|
+
const transforms = bundle.viewportTransforms ?? [];
|
|
17371
|
+
if (transforms.every(isIdentity)) {
|
|
17372
|
+
return transforms.length === 0 ? { bundle, scene } : { bundle: { ...bundle, viewportTransforms: [] }, scene };
|
|
17373
|
+
}
|
|
17374
|
+
const markerMs = new Map(bundle.markers.map((m) => [m.actionId, m.sourceTimeMs]));
|
|
17375
|
+
const at = (ms) => transformAt(transforms, ms);
|
|
17376
|
+
const atAction = (actionId) => at((actionId === void 0 ? void 0 : markerMs.get(actionId)) ?? 0);
|
|
17377
|
+
const converted = {
|
|
17378
|
+
...bundle,
|
|
17379
|
+
viewportTransforms: [],
|
|
17380
|
+
cursorSamples: bundle.cursorSamples.map((s) => ({
|
|
17381
|
+
...s,
|
|
17382
|
+
...point(s, at(s.sourceTimeMs))
|
|
17383
|
+
})),
|
|
17384
|
+
anchorRects: bundle.anchorRects.map((e) => ({
|
|
17385
|
+
...e,
|
|
17386
|
+
rect: rect(e.rect, atAction(e.actionId))
|
|
17387
|
+
}))
|
|
17388
|
+
};
|
|
17389
|
+
if (scene === void 0)
|
|
17390
|
+
return { bundle: converted, scene };
|
|
17391
|
+
const firstSeen = /* @__PURE__ */ new Map();
|
|
17392
|
+
for (const action of scene.actions) {
|
|
17393
|
+
const anchorId = "anchorId" in action ? action.anchorId : void 0;
|
|
17394
|
+
if (typeof anchorId === "string" && !firstSeen.has(anchorId)) {
|
|
17395
|
+
firstSeen.set(anchorId, action.id);
|
|
17396
|
+
}
|
|
17397
|
+
}
|
|
17398
|
+
const sceneOut = {
|
|
17399
|
+
...scene,
|
|
17400
|
+
actions: scene.actions.map((a) => "rect" in a && a.rect !== void 0 ? { ...a, rect: rect(a.rect, atAction(a.id)) } : a),
|
|
17401
|
+
anchors: scene.anchors.map((anchor2) => {
|
|
17402
|
+
const r = anchor2.fingerprint.boundingRect;
|
|
17403
|
+
if (!r)
|
|
17404
|
+
return anchor2;
|
|
17405
|
+
return {
|
|
17406
|
+
...anchor2,
|
|
17407
|
+
fingerprint: {
|
|
17408
|
+
...anchor2.fingerprint,
|
|
17409
|
+
boundingRect: rect(r, atAction(firstSeen.get(anchor2.id)))
|
|
17410
|
+
}
|
|
17411
|
+
};
|
|
17412
|
+
})
|
|
17413
|
+
};
|
|
17414
|
+
return { bundle: converted, scene: sceneOut };
|
|
17415
|
+
}
|
|
17416
|
+
function segmentsInScreenSpace(segments, transforms, markerSourceMs) {
|
|
17417
|
+
if (transforms.every(isIdentity))
|
|
17418
|
+
return [...segments];
|
|
17419
|
+
return segments.map((s) => {
|
|
17420
|
+
const t = transformAt(transforms, markerSourceMs.get(s.toActionId) ?? 0);
|
|
17421
|
+
return {
|
|
17422
|
+
...s,
|
|
17423
|
+
from: point(s.from, t),
|
|
17424
|
+
to: point(s.to, t),
|
|
17425
|
+
via: s.via.map((v) => point(v, t))
|
|
17426
|
+
};
|
|
17427
|
+
});
|
|
17428
|
+
}
|
|
17429
|
+
|
|
17106
17430
|
// ../../packages/compositor/dist/plan/timeline.js
|
|
17107
17431
|
function merge2(spans) {
|
|
17108
17432
|
const sorted = [...spans].filter((s) => s.endMs > s.startMs).sort((a, b) => a.startMs - b.startMs);
|
|
@@ -17361,10 +17685,32 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17361
17685
|
}
|
|
17362
17686
|
return merge2(out);
|
|
17363
17687
|
}
|
|
17688
|
+
var CURSOR_MOTION_EPSILON_PX = 0.5;
|
|
17689
|
+
function cursorMotionSpans(samples) {
|
|
17690
|
+
const spans = [];
|
|
17691
|
+
for (let i = 1; i < samples.length; i++) {
|
|
17692
|
+
const from = samples[i - 1];
|
|
17693
|
+
const to = samples[i];
|
|
17694
|
+
if (!from || !to)
|
|
17695
|
+
continue;
|
|
17696
|
+
if (to.sourceTimeMs <= from.sourceTimeMs)
|
|
17697
|
+
continue;
|
|
17698
|
+
if (Math.hypot(to.x - from.x, to.y - from.y) < CURSOR_MOTION_EPSILON_PX) {
|
|
17699
|
+
continue;
|
|
17700
|
+
}
|
|
17701
|
+
spans.push({ startMs: from.sourceTimeMs, endMs: to.sourceTimeMs });
|
|
17702
|
+
}
|
|
17703
|
+
return spans;
|
|
17704
|
+
}
|
|
17705
|
+
function sourceDurationOf(bundle) {
|
|
17706
|
+
const lastKeyframe = bundle.keyframes[bundle.keyframes.length - 1];
|
|
17707
|
+
const travel = cursorMotionSpans(inScreenSpace(bundle, void 0).bundle.cursorSamples).at(-1);
|
|
17708
|
+
const settleMs = bundle.source === "capture" ? springSettleMs(CURSOR_SPRING_TAU_MS) : 0;
|
|
17709
|
+
return Math.max(lastKeyframe?.sourceTimeMs ?? 0, ...bundle.markers.map((m) => m.sourceTimeMs), ...motionSpansOf(bundle).map((m) => m.endMs), travel === void 0 ? 0 : travel.endMs + settleMs);
|
|
17710
|
+
}
|
|
17364
17711
|
function buildTimeline(plan, bundle, hints = []) {
|
|
17365
17712
|
const motion = motionSpansOf(bundle, hints);
|
|
17366
|
-
const
|
|
17367
|
-
const sourceDurationMs = Math.max(lastKeyframe?.sourceTimeMs ?? 0, ...bundle.markers.map((m) => m.sourceTimeMs), ...motion.map((m) => m.endMs));
|
|
17713
|
+
const sourceDurationMs = sourceDurationOf(bundle);
|
|
17368
17714
|
const { cuts, unplacedCuts } = cutRanges(plan, bundle, sourceDurationMs);
|
|
17369
17715
|
const interruptions = interruptionsOf(bundle, cuts);
|
|
17370
17716
|
const removed = [
|
|
@@ -17795,6 +18141,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17795
18141
|
const { minPlateauMs } = CAMERA_DEFAULTS.neutral;
|
|
17796
18142
|
return nextArrivalMs - timings.zoomInMs - minPlateauMs >= heldUntilMs + minPlateauMs + timings.zoomOutMs;
|
|
17797
18143
|
}
|
|
18144
|
+
function pullOutLandsAt(heldUntilMs, timings) {
|
|
18145
|
+
return heldUntilMs + CAMERA_DEFAULTS.neutral.zoomHoldMs + timings.zoomOutMs;
|
|
18146
|
+
}
|
|
17798
18147
|
function insertNeutralKeys(seeds, outputDurationMs, timings, holds = []) {
|
|
17799
18148
|
const { neutral } = CAMERA_DEFAULTS;
|
|
17800
18149
|
const { zoomOutMs } = timings;
|
|
@@ -17823,7 +18172,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17823
18172
|
const next = seeds[i + 1];
|
|
17824
18173
|
const heldUntil = heldUntilOf(seed, next?.actionMs ?? Number.POSITIVE_INFINITY, holds);
|
|
17825
18174
|
const earliestMs = heldUntil + neutral.minPlateauMs + zoomOutMs;
|
|
17826
|
-
const idealMs = heldUntil
|
|
18175
|
+
const idealMs = pullOutLandsAt(heldUntil, timings);
|
|
17827
18176
|
const wantedMs = seed.authoredEndMs ?? idealMs;
|
|
17828
18177
|
const resolvedAuthored = seed.authoredEndMs !== null;
|
|
17829
18178
|
const authored = resolvedAuthored || seed.endUnplaced;
|
|
@@ -18115,7 +18464,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18115
18464
|
return [];
|
|
18116
18465
|
}
|
|
18117
18466
|
const rect2 = rectOf(action.anchorId, action.id);
|
|
18118
|
-
return rect2 ? [
|
|
18467
|
+
return rect2 ? [
|
|
18468
|
+
{
|
|
18469
|
+
action,
|
|
18470
|
+
point: spotIn(rect2, action.kind === "click" ? action.at : void 0)
|
|
18471
|
+
}
|
|
18472
|
+
] : [];
|
|
18119
18473
|
});
|
|
18120
18474
|
if (targets.length === 0)
|
|
18121
18475
|
return [];
|
|
@@ -18139,288 +18493,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18139
18493
|
});
|
|
18140
18494
|
}
|
|
18141
18495
|
|
|
18142
|
-
// ../../packages/compositor/dist/plan/smooth.js
|
|
18143
|
-
var CURSOR_SMOOTHING_MS = 30;
|
|
18144
|
-
var KERNEL_REACH_SIGMAS = 3;
|
|
18145
|
-
var CURSOR_REST_MS = 50;
|
|
18146
|
-
function bracketIndices(samples, times) {
|
|
18147
|
-
const out = /* @__PURE__ */ new Set();
|
|
18148
|
-
for (const t of times) {
|
|
18149
|
-
let before = null;
|
|
18150
|
-
let after = null;
|
|
18151
|
-
for (let i = 0; i < samples.length; i++) {
|
|
18152
|
-
const at = samples[i]?.sourceTimeMs;
|
|
18153
|
-
if (at === void 0)
|
|
18154
|
-
continue;
|
|
18155
|
-
if (at <= t)
|
|
18156
|
-
before = i;
|
|
18157
|
-
if (at >= t) {
|
|
18158
|
-
after = i;
|
|
18159
|
-
break;
|
|
18160
|
-
}
|
|
18161
|
-
}
|
|
18162
|
-
if (before !== null)
|
|
18163
|
-
out.add(before);
|
|
18164
|
-
if (after !== null)
|
|
18165
|
-
out.add(after);
|
|
18166
|
-
}
|
|
18167
|
-
return out;
|
|
18168
|
-
}
|
|
18169
|
-
function runBounds(samples, boundaryMs, gaps) {
|
|
18170
|
-
const start = new Array(samples.length).fill(0);
|
|
18171
|
-
const end = new Array(samples.length).fill(samples.length - 1);
|
|
18172
|
-
let runStart = 0;
|
|
18173
|
-
for (let i = 1; i <= samples.length; i++) {
|
|
18174
|
-
const previous = samples[i - 1];
|
|
18175
|
-
const current = samples[i];
|
|
18176
|
-
const broken = current === void 0 || previous === void 0 || current.sourceTimeMs - previous.sourceTimeMs > boundaryMs || overlapsGap(gaps, previous.sourceTimeMs, current.sourceTimeMs);
|
|
18177
|
-
if (!broken)
|
|
18178
|
-
continue;
|
|
18179
|
-
for (let j = runStart; j < i; j++) {
|
|
18180
|
-
start[j] = runStart;
|
|
18181
|
-
end[j] = i - 1;
|
|
18182
|
-
}
|
|
18183
|
-
runStart = i;
|
|
18184
|
-
}
|
|
18185
|
-
return { start, end };
|
|
18186
|
-
}
|
|
18187
|
-
function smoothCursor(samples, sigmaMs, pinnedMs = [], gaps = []) {
|
|
18188
|
-
if (sigmaMs <= 0 || samples.length < 3)
|
|
18189
|
-
return samples;
|
|
18190
|
-
const pinned = bracketIndices(samples, pinnedMs);
|
|
18191
|
-
const runs = runBounds(samples, CURSOR_REST_MS, gaps);
|
|
18192
|
-
const maxReach = KERNEL_REACH_SIGMAS * sigmaMs;
|
|
18193
|
-
const twoSigmaSquared = 2 * sigmaMs * sigmaMs;
|
|
18194
|
-
const SLACK_MS = 1e-6;
|
|
18195
|
-
let lo = 0;
|
|
18196
|
-
let hi = 0;
|
|
18197
|
-
let currentRun = -1;
|
|
18198
|
-
let cadence = 0;
|
|
18199
|
-
let padBefore = 0;
|
|
18200
|
-
let padAfter = 0;
|
|
18201
|
-
return samples.map((sample, i) => {
|
|
18202
|
-
const runStart = runs.start[i];
|
|
18203
|
-
const runEnd = runs.end[i];
|
|
18204
|
-
const first = samples[runStart];
|
|
18205
|
-
const last2 = samples[runEnd];
|
|
18206
|
-
if (runStart !== currentRun) {
|
|
18207
|
-
currentRun = runStart;
|
|
18208
|
-
lo = runStart;
|
|
18209
|
-
hi = runStart;
|
|
18210
|
-
const span = last2.sourceTimeMs - first.sourceTimeMs;
|
|
18211
|
-
cadence = runEnd > runStart ? span / (runEnd - runStart) : 0;
|
|
18212
|
-
const previousEnd = runStart > 0 ? samples[runStart - 1].sourceTimeMs : 0;
|
|
18213
|
-
const nextStart = runEnd < samples.length - 1 ? samples[runEnd + 1].sourceTimeMs : 0;
|
|
18214
|
-
const quietBefore = runStart > 0 && !overlapsGap(gaps, previousEnd, first.sourceTimeMs) ? first.sourceTimeMs - previousEnd : 0;
|
|
18215
|
-
const quietAfter = runEnd < samples.length - 1 && !overlapsGap(gaps, last2.sourceTimeMs, nextStart) ? nextStart - last2.sourceTimeMs : 0;
|
|
18216
|
-
padBefore = Math.min(maxReach, quietBefore);
|
|
18217
|
-
padAfter = Math.min(maxReach, quietAfter);
|
|
18218
|
-
}
|
|
18219
|
-
if (i === runStart || i === runEnd)
|
|
18220
|
-
return sample;
|
|
18221
|
-
if (pinned.has(i))
|
|
18222
|
-
return sample;
|
|
18223
|
-
const at = sample.sourceTimeMs;
|
|
18224
|
-
const reach = Math.min(maxReach, at - first.sourceTimeMs + padBefore, last2.sourceTimeMs - at + padAfter);
|
|
18225
|
-
if (reach <= 0)
|
|
18226
|
-
return sample;
|
|
18227
|
-
while (lo <= runEnd && at - samples[lo].sourceTimeMs > reach + SLACK_MS)
|
|
18228
|
-
lo++;
|
|
18229
|
-
if (hi < lo)
|
|
18230
|
-
hi = lo;
|
|
18231
|
-
while (hi <= runEnd && samples[hi].sourceTimeMs - at <= reach + SLACK_MS)
|
|
18232
|
-
hi++;
|
|
18233
|
-
let sx = 0;
|
|
18234
|
-
let sy = 0;
|
|
18235
|
-
let weight = 0;
|
|
18236
|
-
for (let j = lo; j < hi; j++) {
|
|
18237
|
-
const other = samples[j];
|
|
18238
|
-
if (!other)
|
|
18239
|
-
continue;
|
|
18240
|
-
const dt = other.sourceTimeMs - at;
|
|
18241
|
-
if (Math.abs(dt) > reach)
|
|
18242
|
-
continue;
|
|
18243
|
-
const w = Math.exp(-(dt * dt) / twoSigmaSquared);
|
|
18244
|
-
sx += other.x * w;
|
|
18245
|
-
sy += other.y * w;
|
|
18246
|
-
weight += w;
|
|
18247
|
-
}
|
|
18248
|
-
if (cadence > 0) {
|
|
18249
|
-
for (let step = cadence; step <= padBefore + SLACK_MS; step += cadence) {
|
|
18250
|
-
const dt = first.sourceTimeMs - step - at;
|
|
18251
|
-
if (-dt > reach + SLACK_MS)
|
|
18252
|
-
break;
|
|
18253
|
-
const w = Math.exp(-(dt * dt) / twoSigmaSquared);
|
|
18254
|
-
sx += first.x * w;
|
|
18255
|
-
sy += first.y * w;
|
|
18256
|
-
weight += w;
|
|
18257
|
-
}
|
|
18258
|
-
for (let step = cadence; step <= padAfter + SLACK_MS; step += cadence) {
|
|
18259
|
-
const dt = last2.sourceTimeMs + step - at;
|
|
18260
|
-
if (dt > reach + SLACK_MS)
|
|
18261
|
-
break;
|
|
18262
|
-
const w = Math.exp(-(dt * dt) / twoSigmaSquared);
|
|
18263
|
-
sx += last2.x * w;
|
|
18264
|
-
sy += last2.y * w;
|
|
18265
|
-
weight += w;
|
|
18266
|
-
}
|
|
18267
|
-
}
|
|
18268
|
-
return weight === 0 ? sample : { sourceTimeMs: at, x: sx / weight, y: sy / weight };
|
|
18269
|
-
});
|
|
18270
|
-
}
|
|
18271
|
-
|
|
18272
|
-
// ../../packages/compositor/dist/plan/cursor-spring.js
|
|
18273
|
-
var CURSOR_SPRING_TAU_MS = 55;
|
|
18274
|
-
function springLeadMs(tauMs) {
|
|
18275
|
-
return 2 * tauMs;
|
|
18276
|
-
}
|
|
18277
|
-
function springSettleMs(tauMs) {
|
|
18278
|
-
return 6 * tauMs;
|
|
18279
|
-
}
|
|
18280
|
-
function positionAt(samples, ms) {
|
|
18281
|
-
const first = samples[0];
|
|
18282
|
-
if (ms <= first.sourceTimeMs)
|
|
18283
|
-
return { x: first.x, y: first.y };
|
|
18284
|
-
for (let i = 1; i < samples.length; i++) {
|
|
18285
|
-
const to = samples[i];
|
|
18286
|
-
if (to.sourceTimeMs < ms)
|
|
18287
|
-
continue;
|
|
18288
|
-
const from = samples[i - 1];
|
|
18289
|
-
const span = to.sourceTimeMs - from.sourceTimeMs;
|
|
18290
|
-
const u = span === 0 ? 0 : (ms - from.sourceTimeMs) / span;
|
|
18291
|
-
return { x: from.x + (to.x - from.x) * u, y: from.y + (to.y - from.y) * u };
|
|
18292
|
-
}
|
|
18293
|
-
const last2 = samples[samples.length - 1];
|
|
18294
|
-
return { x: last2.x, y: last2.y };
|
|
18295
|
-
}
|
|
18296
|
-
function readerFor(samples) {
|
|
18297
|
-
let i = 1;
|
|
18298
|
-
return (ms) => {
|
|
18299
|
-
const first = samples[0];
|
|
18300
|
-
if (ms <= first.sourceTimeMs)
|
|
18301
|
-
return { x: first.x, y: first.y };
|
|
18302
|
-
while (i < samples.length && samples[i].sourceTimeMs < ms) {
|
|
18303
|
-
i++;
|
|
18304
|
-
}
|
|
18305
|
-
const to = samples[i];
|
|
18306
|
-
if (!to) {
|
|
18307
|
-
const last2 = samples[samples.length - 1];
|
|
18308
|
-
return { x: last2.x, y: last2.y };
|
|
18309
|
-
}
|
|
18310
|
-
const from = samples[i - 1];
|
|
18311
|
-
const span = to.sourceTimeMs - from.sourceTimeMs;
|
|
18312
|
-
const u = span === 0 ? 0 : (ms - from.sourceTimeMs) / span;
|
|
18313
|
-
return { x: from.x + (to.x - from.x) * u, y: from.y + (to.y - from.y) * u };
|
|
18314
|
-
};
|
|
18315
|
-
}
|
|
18316
|
-
var SPRING_GRID_MS = 8;
|
|
18317
|
-
function followWithSpring(samples, tauMs, anchorMs, gaps = []) {
|
|
18318
|
-
if (tauMs <= 0 || samples.length < 2)
|
|
18319
|
-
return samples;
|
|
18320
|
-
if (gaps.length === 0)
|
|
18321
|
-
return followOneStretch(samples, tauMs, anchorMs);
|
|
18322
|
-
const out = [];
|
|
18323
|
-
let start = 0;
|
|
18324
|
-
for (let i = 1; i <= samples.length; i++) {
|
|
18325
|
-
const current = samples[i];
|
|
18326
|
-
const previous = samples[i - 1];
|
|
18327
|
-
const broken = current === void 0 || overlapsGap(gaps, previous.sourceTimeMs, current.sourceTimeMs);
|
|
18328
|
-
if (!broken)
|
|
18329
|
-
continue;
|
|
18330
|
-
const stretch = samples.slice(start, i);
|
|
18331
|
-
const from = stretch[0];
|
|
18332
|
-
const to = stretch[stretch.length - 1];
|
|
18333
|
-
out.push(...stretch.length < 2 ? stretch : followOneStretch(stretch, tauMs, anchorMs.filter((ms) => ms >= from.sourceTimeMs && ms <= to.sourceTimeMs)));
|
|
18334
|
-
start = i;
|
|
18335
|
-
}
|
|
18336
|
-
return out;
|
|
18337
|
-
}
|
|
18338
|
-
function followOneStretch(samples, tauMs, anchorMs) {
|
|
18339
|
-
const omega = 1 / tauMs;
|
|
18340
|
-
const settleMs = springSettleMs(tauMs);
|
|
18341
|
-
const first = samples[0];
|
|
18342
|
-
const out = [{ ...first }];
|
|
18343
|
-
let x = first.x;
|
|
18344
|
-
let y = first.y;
|
|
18345
|
-
let vx = 0;
|
|
18346
|
-
let vy = 0;
|
|
18347
|
-
const advance = (dt, targetX, targetY, atMs) => {
|
|
18348
|
-
if (dt <= 0) {
|
|
18349
|
-
out.push({ sourceTimeMs: atMs, x, y });
|
|
18350
|
-
return;
|
|
18351
|
-
}
|
|
18352
|
-
const decay = Math.exp(-omega * dt);
|
|
18353
|
-
const ex = x - targetX;
|
|
18354
|
-
const ey = y - targetY;
|
|
18355
|
-
const bx = vx + omega * ex;
|
|
18356
|
-
const by = vy + omega * ey;
|
|
18357
|
-
const nx = (ex + bx * dt) * decay;
|
|
18358
|
-
const ny = (ey + by * dt) * decay;
|
|
18359
|
-
vx = (bx - omega * (ex + bx * dt)) * decay;
|
|
18360
|
-
vy = (by - omega * (ey + by * dt)) * decay;
|
|
18361
|
-
x = targetX + nx;
|
|
18362
|
-
y = targetY + ny;
|
|
18363
|
-
out.push({ sourceTimeMs: atMs, x, y });
|
|
18364
|
-
};
|
|
18365
|
-
const lead = springLeadMs(tauMs);
|
|
18366
|
-
const times = [];
|
|
18367
|
-
for (let i = 1; i < samples.length; i++) {
|
|
18368
|
-
const from = samples[i - 1];
|
|
18369
|
-
const to = samples[i];
|
|
18370
|
-
if (to.sourceTimeMs - from.sourceTimeMs > CURSOR_REST_MS) {
|
|
18371
|
-
const headUntil = Math.min(to.sourceTimeMs, from.sourceTimeMs + settleMs);
|
|
18372
|
-
const tailFrom = Math.max(from.sourceTimeMs, to.sourceTimeMs - lead - settleMs);
|
|
18373
|
-
for (let ms = from.sourceTimeMs + SPRING_GRID_MS; ms < to.sourceTimeMs; ms += SPRING_GRID_MS) {
|
|
18374
|
-
if (ms < headUntil || ms >= tailFrom)
|
|
18375
|
-
times.push(ms);
|
|
18376
|
-
}
|
|
18377
|
-
}
|
|
18378
|
-
times.push(to.sourceTimeMs);
|
|
18379
|
-
}
|
|
18380
|
-
const read = readerFor(samples);
|
|
18381
|
-
let previous = first.sourceTimeMs;
|
|
18382
|
-
for (const ms of times) {
|
|
18383
|
-
const target = read((previous + ms) / 2 + lead);
|
|
18384
|
-
advance(ms - previous, target.x, target.y, ms);
|
|
18385
|
-
previous = ms;
|
|
18386
|
-
}
|
|
18387
|
-
const last2 = samples[samples.length - 1];
|
|
18388
|
-
for (let ms = previous + SPRING_GRID_MS; ms <= last2.sourceTimeMs + settleMs; ms += SPRING_GRID_MS) {
|
|
18389
|
-
advance(ms - previous, last2.x, last2.y, ms);
|
|
18390
|
-
previous = ms;
|
|
18391
|
-
}
|
|
18392
|
-
return anchor(out, samples, anchorMs, settleMs);
|
|
18393
|
-
}
|
|
18394
|
-
function anchor(drawn, target, anchorMs, shoulderMs) {
|
|
18395
|
-
const anchors = [...new Set(anchorMs)].sort((a, b) => a - b);
|
|
18396
|
-
if (anchors.length === 0 || shoulderMs <= 0)
|
|
18397
|
-
return drawn;
|
|
18398
|
-
const out = drawn.map((s) => ({ ...s }));
|
|
18399
|
-
for (const [index, ms] of anchors.entries()) {
|
|
18400
|
-
const previous = anchors[index - 1];
|
|
18401
|
-
const next = anchors[index + 1];
|
|
18402
|
-
const room = Math.min(previous === void 0 ? Number.POSITIVE_INFINITY : (ms - previous) / 2, next === void 0 ? Number.POSITIVE_INFINITY : (next - ms) / 2);
|
|
18403
|
-
const shoulder = Math.min(shoulderMs, room);
|
|
18404
|
-
if (!Number.isFinite(shoulder) || shoulder <= 0)
|
|
18405
|
-
continue;
|
|
18406
|
-
const truth = positionAt(target, ms);
|
|
18407
|
-
const here = positionAt(out, ms);
|
|
18408
|
-
const dx = truth.x - here.x;
|
|
18409
|
-
const dy = truth.y - here.y;
|
|
18410
|
-
if (dx === 0 && dy === 0)
|
|
18411
|
-
continue;
|
|
18412
|
-
for (const sample of out) {
|
|
18413
|
-
const away = Math.abs(sample.sourceTimeMs - ms);
|
|
18414
|
-
if (away > shoulder)
|
|
18415
|
-
continue;
|
|
18416
|
-
const weight = 0.5 * (1 + Math.cos(Math.PI * away / shoulder));
|
|
18417
|
-
sample.x += dx * weight;
|
|
18418
|
-
sample.y += dy * weight;
|
|
18419
|
-
}
|
|
18420
|
-
}
|
|
18421
|
-
return out;
|
|
18422
|
-
}
|
|
18423
|
-
|
|
18424
18496
|
// ../../packages/compositor/dist/plan/cursor-timing.js
|
|
18425
18497
|
function arcLengths(samples, start, end) {
|
|
18426
18498
|
const s = [0];
|
|
@@ -18578,8 +18650,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18578
18650
|
var OFF_PAGE_MARGIN = 0.25;
|
|
18579
18651
|
function offPageDirection(at, velocity, viewport) {
|
|
18580
18652
|
const speed = Math.hypot(velocity.x, velocity.y);
|
|
18581
|
-
const
|
|
18582
|
-
if (
|
|
18653
|
+
const inside2 = at.x >= 0 && at.x <= viewport.width && at.y >= 0 && at.y <= viewport.height;
|
|
18654
|
+
if (inside2 && speed >= MIN_HEADING_SPEED) {
|
|
18583
18655
|
const heading = { x: velocity.x / speed, y: velocity.y / speed };
|
|
18584
18656
|
const reach = OFF_PAGE_EDGE_PX + speed * OFF_PAGE_REACH_MS;
|
|
18585
18657
|
if (distanceToEdge(at, heading, viewport) <= reach)
|
|
@@ -18600,8 +18672,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18600
18672
|
function distanceToEdge(at, heading, viewport) {
|
|
18601
18673
|
const toBound = (p, d2, size) => d2 > 0 ? (size - p) / d2 : d2 < 0 ? -p / d2 : Number.POSITIVE_INFINITY;
|
|
18602
18674
|
const d = Math.min(toBound(at.x, heading.x, viewport.width), toBound(at.y, heading.y, viewport.height));
|
|
18603
|
-
const
|
|
18604
|
-
return
|
|
18675
|
+
const inside2 = at.x >= 0 && at.x <= viewport.width && at.y >= 0 && at.y <= viewport.height;
|
|
18676
|
+
return inside2 ? Math.max(0, d) : 0;
|
|
18605
18677
|
}
|
|
18606
18678
|
function sightingBeside(observed, ms, side) {
|
|
18607
18679
|
if (side === "before") {
|
|
@@ -18844,88 +18916,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18844
18916
|
};
|
|
18845
18917
|
}
|
|
18846
18918
|
|
|
18847
|
-
// ../../packages/compositor/dist/plan/screen-space.js
|
|
18848
|
-
function transformAt(transforms, sourceTimeMs) {
|
|
18849
|
-
let at = transforms[0] ?? null;
|
|
18850
|
-
for (const t of transforms) {
|
|
18851
|
-
if (t.sourceTimeMs > sourceTimeMs)
|
|
18852
|
-
break;
|
|
18853
|
-
at = t;
|
|
18854
|
-
}
|
|
18855
|
-
return at;
|
|
18856
|
-
}
|
|
18857
|
-
var point = (p, t) => ({
|
|
18858
|
-
x: (p.x - t.offsetX) * t.scale,
|
|
18859
|
-
y: (p.y - t.offsetY) * t.scale
|
|
18860
|
-
});
|
|
18861
|
-
var rect = (r, t) => ({
|
|
18862
|
-
...r,
|
|
18863
|
-
...point(r, t),
|
|
18864
|
-
width: r.width * t.scale,
|
|
18865
|
-
height: r.height * t.scale
|
|
18866
|
-
});
|
|
18867
|
-
var isIdentity = (t) => t.scale === 1 && t.offsetX === 0 && t.offsetY === 0;
|
|
18868
|
-
function inScreenSpace(bundle, scene) {
|
|
18869
|
-
const transforms = bundle.viewportTransforms ?? [];
|
|
18870
|
-
if (transforms.every(isIdentity)) {
|
|
18871
|
-
return transforms.length === 0 ? { bundle, scene } : { bundle: { ...bundle, viewportTransforms: [] }, scene };
|
|
18872
|
-
}
|
|
18873
|
-
const markerMs = new Map(bundle.markers.map((m) => [m.actionId, m.sourceTimeMs]));
|
|
18874
|
-
const at = (ms) => transformAt(transforms, ms);
|
|
18875
|
-
const atAction = (actionId) => at((actionId === void 0 ? void 0 : markerMs.get(actionId)) ?? 0);
|
|
18876
|
-
const converted = {
|
|
18877
|
-
...bundle,
|
|
18878
|
-
viewportTransforms: [],
|
|
18879
|
-
cursorSamples: bundle.cursorSamples.map((s) => ({
|
|
18880
|
-
...s,
|
|
18881
|
-
...point(s, at(s.sourceTimeMs))
|
|
18882
|
-
})),
|
|
18883
|
-
anchorRects: bundle.anchorRects.map((e) => ({
|
|
18884
|
-
...e,
|
|
18885
|
-
rect: rect(e.rect, atAction(e.actionId))
|
|
18886
|
-
}))
|
|
18887
|
-
};
|
|
18888
|
-
if (scene === void 0)
|
|
18889
|
-
return { bundle: converted, scene };
|
|
18890
|
-
const firstSeen = /* @__PURE__ */ new Map();
|
|
18891
|
-
for (const action of scene.actions) {
|
|
18892
|
-
const anchorId = "anchorId" in action ? action.anchorId : void 0;
|
|
18893
|
-
if (typeof anchorId === "string" && !firstSeen.has(anchorId)) {
|
|
18894
|
-
firstSeen.set(anchorId, action.id);
|
|
18895
|
-
}
|
|
18896
|
-
}
|
|
18897
|
-
const sceneOut = {
|
|
18898
|
-
...scene,
|
|
18899
|
-
actions: scene.actions.map((a) => "rect" in a && a.rect !== void 0 ? { ...a, rect: rect(a.rect, atAction(a.id)) } : a),
|
|
18900
|
-
anchors: scene.anchors.map((anchor2) => {
|
|
18901
|
-
const r = anchor2.fingerprint.boundingRect;
|
|
18902
|
-
if (!r)
|
|
18903
|
-
return anchor2;
|
|
18904
|
-
return {
|
|
18905
|
-
...anchor2,
|
|
18906
|
-
fingerprint: {
|
|
18907
|
-
...anchor2.fingerprint,
|
|
18908
|
-
boundingRect: rect(r, atAction(firstSeen.get(anchor2.id)))
|
|
18909
|
-
}
|
|
18910
|
-
};
|
|
18911
|
-
})
|
|
18912
|
-
};
|
|
18913
|
-
return { bundle: converted, scene: sceneOut };
|
|
18914
|
-
}
|
|
18915
|
-
function segmentsInScreenSpace(segments, transforms, markerSourceMs) {
|
|
18916
|
-
if (transforms.every(isIdentity))
|
|
18917
|
-
return [...segments];
|
|
18918
|
-
return segments.map((s) => {
|
|
18919
|
-
const t = transformAt(transforms, markerSourceMs.get(s.toActionId) ?? 0);
|
|
18920
|
-
return {
|
|
18921
|
-
...s,
|
|
18922
|
-
from: point(s.from, t),
|
|
18923
|
-
to: point(s.to, t),
|
|
18924
|
-
via: s.via.map((v) => point(v, t))
|
|
18925
|
-
};
|
|
18926
|
-
});
|
|
18927
|
-
}
|
|
18928
|
-
|
|
18929
18919
|
// ../../packages/compositor/dist/plan/resolve.js
|
|
18930
18920
|
function sampleCursor(samples, sourceMs) {
|
|
18931
18921
|
const first = samples[0];
|
|
@@ -19022,23 +19012,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19022
19012
|
}
|
|
19023
19013
|
return samples.sort((a, b) => a.sourceTimeMs - b.sourceTimeMs);
|
|
19024
19014
|
}
|
|
19025
|
-
var CURSOR_MOTION_EPSILON_PX = 0.5;
|
|
19026
|
-
function cursorMotionSpans(samples) {
|
|
19027
|
-
const spans = [];
|
|
19028
|
-
for (let i = 1; i < samples.length; i++) {
|
|
19029
|
-
const from = samples[i - 1];
|
|
19030
|
-
const to = samples[i];
|
|
19031
|
-
if (!from || !to)
|
|
19032
|
-
continue;
|
|
19033
|
-
if (to.sourceTimeMs <= from.sourceTimeMs)
|
|
19034
|
-
continue;
|
|
19035
|
-
if (Math.hypot(to.x - from.x, to.y - from.y) < CURSOR_MOTION_EPSILON_PX) {
|
|
19036
|
-
continue;
|
|
19037
|
-
}
|
|
19038
|
-
spans.push({ startMs: from.sourceTimeMs, endMs: to.sourceTimeMs });
|
|
19039
|
-
}
|
|
19040
|
-
return spans;
|
|
19041
|
-
}
|
|
19042
19015
|
var CURSOR_IDLE_HIDE_MS = 1e3;
|
|
19043
19016
|
var CURSOR_IDLE_FADE_MS = 250;
|
|
19044
19017
|
var CUT_BRIDGE_MS = 250;
|
|
@@ -19263,7 +19236,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
19263
19236
|
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`
|
|
19264
19237
|
});
|
|
19265
19238
|
}
|
|
19266
|
-
const clickKinds = new Set(bundle.source === "replay" ? ["click", "type", "drag"] : ["click"]);
|
|
19239
|
+
const clickKinds = new Set(bundle.source === "replay" ? ["click", "type", "drag", "press"] : ["click"]);
|
|
19267
19240
|
const clickActionIds = new Set((scene?.actions ?? []).filter((a) => clickKinds.has(a.kind)).map((a) => a.id));
|
|
19268
19241
|
const clickOutputMs = bundle.markers.filter((m) => clickActionIds.has(m.actionId)).map((m) => toOutputMs(timeline, m.sourceTimeMs)).sort((a, b) => a - b);
|
|
19269
19242
|
const touch = scene?.meta.capture.device?.touch === true;
|
|
@@ -47231,6 +47204,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
47231
47204
|
|
|
47232
47205
|
// ../../packages/compositor/dist/ports/sink-mp4.js
|
|
47233
47206
|
var ENCODER_USED_GLOBAL = "__demomanMp4Encoder";
|
|
47207
|
+
var SINK_TIMES_GLOBAL = "__demomanMp4SinkTimes";
|
|
47208
|
+
var sinkTimes = () => globalThis[SINK_TIMES_GLOBAL];
|
|
47234
47209
|
function createMp4Sink(target) {
|
|
47235
47210
|
const output = new Output({
|
|
47236
47211
|
format: new Mp4OutputFormat(),
|
|
@@ -47268,13 +47243,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
47268
47243
|
throw new Error("sink already finish()ed; cannot accept more frames");
|
|
47269
47244
|
started ??= output.start();
|
|
47270
47245
|
await started;
|
|
47246
|
+
const times = sinkTimes();
|
|
47247
|
+
const t0 = performance.now();
|
|
47271
47248
|
const sample = new VideoSample(canvas, {
|
|
47272
47249
|
timestamp: timestampSec,
|
|
47273
47250
|
duration: durationSec
|
|
47274
47251
|
});
|
|
47252
|
+
const t1 = performance.now();
|
|
47275
47253
|
await source.add(sample);
|
|
47276
47254
|
sample.close();
|
|
47277
47255
|
frames += 1;
|
|
47256
|
+
if (times !== void 0) {
|
|
47257
|
+
times.copyMs += t1 - t0;
|
|
47258
|
+
times.encodeMs += performance.now() - t1;
|
|
47259
|
+
times.frames += 1;
|
|
47260
|
+
}
|
|
47278
47261
|
},
|
|
47279
47262
|
// Bytes or a reason, never an empty array: a 0-byte file stored as a
|
|
47280
47263
|
// successful output is a Download button that does nothing, and the
|
|
@@ -47287,7 +47270,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
47287
47270
|
}
|
|
47288
47271
|
started ??= output.start();
|
|
47289
47272
|
await started;
|
|
47273
|
+
const t = performance.now();
|
|
47290
47274
|
await output.finalize();
|
|
47275
|
+
const times = sinkTimes();
|
|
47276
|
+
if (times !== void 0)
|
|
47277
|
+
times.finishMs += performance.now() - t;
|
|
47291
47278
|
const buffer = output.target.buffer;
|
|
47292
47279
|
if (!buffer) {
|
|
47293
47280
|
throw new Error(`mp4 muxer produced no bytes after ${frames} frame${frames === 1 ? "" : "s"}`);
|
|
@@ -47619,11 +47606,33 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
47619
47606
|
const image = presentation.wallpaper;
|
|
47620
47607
|
if (image === null || bg.kind === "solid" || bg.kind === "gradient")
|
|
47621
47608
|
return;
|
|
47622
|
-
const { sx, sy, sw, sh } = coverRect(image, target);
|
|
47623
47609
|
ctx.imageSmoothingEnabled = true;
|
|
47624
47610
|
ctx.imageSmoothingQuality = "high";
|
|
47611
|
+
const m = ctx.getTransform();
|
|
47612
|
+
if (m.a === 1 && m.d === 1 && m.b === 0 && m.c === 0) {
|
|
47613
|
+
ctx.drawImage(unzoomedCopy(image, target), 0, 0);
|
|
47614
|
+
return;
|
|
47615
|
+
}
|
|
47616
|
+
const { sx, sy, sw, sh } = coverRect(image, target);
|
|
47625
47617
|
ctx.drawImage(image.image, sx, sy, sw, sh, 0, 0, target.width, target.height);
|
|
47626
47618
|
}
|
|
47619
|
+
var unzoomedCopies = /* @__PURE__ */ new WeakMap();
|
|
47620
|
+
function unzoomedCopy(image, target) {
|
|
47621
|
+
const held = unzoomedCopies.get(image.image);
|
|
47622
|
+
if (held?.width === target.width && held.height === target.height) {
|
|
47623
|
+
return held;
|
|
47624
|
+
}
|
|
47625
|
+
const copy = new OffscreenCanvas(target.width, target.height);
|
|
47626
|
+
const g = copy.getContext("2d");
|
|
47627
|
+
if (g === null)
|
|
47628
|
+
throw new Error("the wallpaper's copy has no 2D context");
|
|
47629
|
+
const { sx, sy, sw, sh } = coverRect(image, target);
|
|
47630
|
+
g.imageSmoothingEnabled = true;
|
|
47631
|
+
g.imageSmoothingQuality = "high";
|
|
47632
|
+
g.drawImage(image.image, sx, sy, sw, sh, 0, 0, target.width, target.height);
|
|
47633
|
+
unzoomedCopies.set(image.image, copy);
|
|
47634
|
+
return copy;
|
|
47635
|
+
}
|
|
47627
47636
|
function framePath(ctx, presentation) {
|
|
47628
47637
|
const { frameRect: r, cornerRadius } = presentation;
|
|
47629
47638
|
const radius = Math.min(cornerRadius, r.width / 2, r.height / 2);
|
|
@@ -48013,13 +48022,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
48013
48022
|
if (!sink) {
|
|
48014
48023
|
throw new Error(`render target "${target.format}" needs a matching ${target.format === "mp4" ? "video sink" : `${target.format} sink`}`);
|
|
48015
48024
|
}
|
|
48016
|
-
const
|
|
48017
|
-
const { resolved: composed, presentation, violations } = composeForTarget({
|
|
48025
|
+
const { resolved: composed, presentation, violations } = await composeLikeRender({
|
|
48018
48026
|
plan,
|
|
48019
48027
|
bundle,
|
|
48020
48028
|
scene,
|
|
48021
48029
|
target,
|
|
48022
|
-
|
|
48030
|
+
ports,
|
|
48023
48031
|
logo,
|
|
48024
48032
|
wallpaper
|
|
48025
48033
|
});
|
|
@@ -48060,24 +48068,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
48060
48068
|
}
|
|
48061
48069
|
onFrame?.(i + 1, frameCount);
|
|
48062
48070
|
}
|
|
48063
|
-
const
|
|
48064
|
-
const r = (v) => Math.round(v * 100) / 100;
|
|
48065
|
-
const screens = {
|
|
48066
|
-
...found,
|
|
48067
|
-
moments: found.moments.map((m) => {
|
|
48068
|
-
const w = windowOnScreen(presentation, sceneCameraAt(composed, presentation, target, startMs + m.ms));
|
|
48069
|
-
return {
|
|
48070
|
-
...m,
|
|
48071
|
-
window: {
|
|
48072
|
-
x: r(w.x),
|
|
48073
|
-
y: r(w.y),
|
|
48074
|
-
width: r(w.width),
|
|
48075
|
-
height: r(w.height),
|
|
48076
|
-
radius: r(w.radius)
|
|
48077
|
-
}
|
|
48078
|
-
};
|
|
48079
|
-
})
|
|
48080
|
-
};
|
|
48071
|
+
const screens = screensWithWindows(composed, presentation, target, scene, bundle, startMs);
|
|
48081
48072
|
const bytes2 = await (async () => {
|
|
48082
48073
|
if (target.format === "mp4" && ports.video)
|
|
48083
48074
|
return ports.video.finish();
|
|
@@ -48102,6 +48093,88 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
48102
48093
|
deepestScale: composed.cameraKeys.reduce((m, k) => Math.max(m, k.scale), 1)
|
|
48103
48094
|
};
|
|
48104
48095
|
}
|
|
48096
|
+
async function composeLikeRender(args) {
|
|
48097
|
+
const { plan, bundle, scene, target, ports, logo, wallpaper } = args;
|
|
48098
|
+
const hints = target.format === "png" ? [] : await detectKeyframeMotion(bundle, ports.frames, plan.retiming.motionDiffThreshold);
|
|
48099
|
+
return composeForTarget({
|
|
48100
|
+
plan,
|
|
48101
|
+
bundle,
|
|
48102
|
+
scene,
|
|
48103
|
+
target,
|
|
48104
|
+
hints,
|
|
48105
|
+
logo,
|
|
48106
|
+
wallpaper
|
|
48107
|
+
});
|
|
48108
|
+
}
|
|
48109
|
+
function screensWithWindows(composed, presentation, target, scene, bundle, startMs) {
|
|
48110
|
+
const found = scene ? screenMoments(composed, scene, bundle) : { steps: 0, moments: [] };
|
|
48111
|
+
const r = (v) => Math.round(v * 100) / 100;
|
|
48112
|
+
return {
|
|
48113
|
+
...found,
|
|
48114
|
+
moments: found.moments.map((m) => {
|
|
48115
|
+
const w = windowOnScreen(presentation, sceneCameraAt(composed, presentation, target, startMs + m.ms));
|
|
48116
|
+
return {
|
|
48117
|
+
...m,
|
|
48118
|
+
window: {
|
|
48119
|
+
x: r(w.x),
|
|
48120
|
+
y: r(w.y),
|
|
48121
|
+
width: r(w.width),
|
|
48122
|
+
height: r(w.height),
|
|
48123
|
+
radius: r(w.radius)
|
|
48124
|
+
}
|
|
48125
|
+
};
|
|
48126
|
+
})
|
|
48127
|
+
};
|
|
48128
|
+
}
|
|
48129
|
+
async function renderScreens(args) {
|
|
48130
|
+
const { plan, bundle, scene, target, ports } = args;
|
|
48131
|
+
const { logo = null, wallpaper = null } = args;
|
|
48132
|
+
const sink = ports.images;
|
|
48133
|
+
if (!sink)
|
|
48134
|
+
throw new Error("renderScreens needs an image sink");
|
|
48135
|
+
const { resolved, presentation, violations } = await composeLikeRender({
|
|
48136
|
+
plan,
|
|
48137
|
+
bundle,
|
|
48138
|
+
scene,
|
|
48139
|
+
target,
|
|
48140
|
+
ports,
|
|
48141
|
+
logo,
|
|
48142
|
+
wallpaper
|
|
48143
|
+
});
|
|
48144
|
+
const { startMs } = resolved.range;
|
|
48145
|
+
const screens = screensWithWindows(resolved, presentation, target, scene, bundle, startMs);
|
|
48146
|
+
const canvas = ports.surface.create(target.width, target.height);
|
|
48147
|
+
const ctx = canvas.getContext("2d");
|
|
48148
|
+
for (const [i, m] of screens.moments.entries()) {
|
|
48149
|
+
const outputTimeMs = startMs + m.ms;
|
|
48150
|
+
const image = await ports.frames.at(toSourceMs(resolved.timeline, outputTimeMs));
|
|
48151
|
+
await renderFrame({
|
|
48152
|
+
resolved,
|
|
48153
|
+
target,
|
|
48154
|
+
presentation,
|
|
48155
|
+
frames: {
|
|
48156
|
+
at: async () => image,
|
|
48157
|
+
describe: () => ports.frames.describe()
|
|
48158
|
+
},
|
|
48159
|
+
ctx,
|
|
48160
|
+
outputTimeMs
|
|
48161
|
+
});
|
|
48162
|
+
await sink.add(canvas, `screen-${i}.png`);
|
|
48163
|
+
}
|
|
48164
|
+
const files = await sink.finish();
|
|
48165
|
+
if (files.length !== screens.moments.length) {
|
|
48166
|
+
throw new Error(`${screens.moments.length} screens drawn but the image sink returned ${files.length} files`);
|
|
48167
|
+
}
|
|
48168
|
+
return {
|
|
48169
|
+
screens,
|
|
48170
|
+
images: screens.moments.map((m, i) => ({
|
|
48171
|
+
step: m.step,
|
|
48172
|
+
bytes: files[i].bytes
|
|
48173
|
+
})),
|
|
48174
|
+
detailViolations: violations,
|
|
48175
|
+
unavailableSpans: ports.frames.unavailable?.() ?? []
|
|
48176
|
+
};
|
|
48177
|
+
}
|
|
48105
48178
|
function stillSourceMs(bundle, marker) {
|
|
48106
48179
|
const keyframe = bundle.keyframes.find((k) => k.actionId === marker.actionId);
|
|
48107
48180
|
return keyframe ? keyframe.sourceTimeMs : marker.sourceTimeMs;
|
|
@@ -48260,6 +48333,165 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
48260
48333
|
return { ...image, image: out.transferToImageBitmap() };
|
|
48261
48334
|
}
|
|
48262
48335
|
|
|
48336
|
+
// ../../packages/run-core/dist/logo.js
|
|
48337
|
+
var SVG_RASTER_CACHE_SIZE = 4;
|
|
48338
|
+
var frame = (image) => ({
|
|
48339
|
+
image,
|
|
48340
|
+
width: image.width,
|
|
48341
|
+
height: image.height,
|
|
48342
|
+
// A logo is branding, not a timeline sample — it has no source instant.
|
|
48343
|
+
sourceTimeMs: 0
|
|
48344
|
+
});
|
|
48345
|
+
function parseSvg(text) {
|
|
48346
|
+
const doc = new DOMParser().parseFromString(text, "image/svg+xml");
|
|
48347
|
+
const root = doc.documentElement;
|
|
48348
|
+
if (doc.querySelector("parsererror") !== null || root.nodeName.toLowerCase() !== "svg") {
|
|
48349
|
+
throw new Error("the file is not an SVG");
|
|
48350
|
+
}
|
|
48351
|
+
return root;
|
|
48352
|
+
}
|
|
48353
|
+
var length = (value) => {
|
|
48354
|
+
if (value === null)
|
|
48355
|
+
return null;
|
|
48356
|
+
const n = Number.parseFloat(value);
|
|
48357
|
+
return Number.isFinite(n) && n > 0 && !value.trim().endsWith("%") ? n : null;
|
|
48358
|
+
};
|
|
48359
|
+
function svgAspect(svgText) {
|
|
48360
|
+
const root = parseSvg(svgText);
|
|
48361
|
+
const w = length(root.getAttribute("width"));
|
|
48362
|
+
const h = length(root.getAttribute("height"));
|
|
48363
|
+
if (w !== null && h !== null)
|
|
48364
|
+
return w / h;
|
|
48365
|
+
const box2 = root.getAttribute("viewBox")?.trim().split(/[\s,]+/).map(Number);
|
|
48366
|
+
if (box2 && box2.length === 4 && box2[2] > 0 && box2[3] > 0) {
|
|
48367
|
+
return box2[2] / box2[3];
|
|
48368
|
+
}
|
|
48369
|
+
throw new Error("the SVG has no width, height or viewBox, so there is no size to draw it at");
|
|
48370
|
+
}
|
|
48371
|
+
async function svgSource(bytes2) {
|
|
48372
|
+
const text = new TextDecoder().decode(bytes2);
|
|
48373
|
+
const aspect = svgAspect(text);
|
|
48374
|
+
const cache = /* @__PURE__ */ new Map();
|
|
48375
|
+
const render2 = async (heightPx) => {
|
|
48376
|
+
const width = Math.max(1, Math.round(heightPx * aspect));
|
|
48377
|
+
const height = Math.max(1, Math.round(heightPx));
|
|
48378
|
+
const url3 = URL.createObjectURL(new Blob([bytes2.slice()], { type: "image/svg+xml" }));
|
|
48379
|
+
try {
|
|
48380
|
+
const img = new Image();
|
|
48381
|
+
img.src = url3;
|
|
48382
|
+
await img.decode().catch((error51) => {
|
|
48383
|
+
throw new Error(`the SVG could not be decoded: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
48384
|
+
});
|
|
48385
|
+
const canvas = new OffscreenCanvas(width, height);
|
|
48386
|
+
canvas.getContext("2d").drawImage(img, 0, 0, width, height);
|
|
48387
|
+
return frame(await createImageBitmap(canvas));
|
|
48388
|
+
} finally {
|
|
48389
|
+
URL.revokeObjectURL(url3);
|
|
48390
|
+
}
|
|
48391
|
+
};
|
|
48392
|
+
return {
|
|
48393
|
+
contentType: "image/svg+xml",
|
|
48394
|
+
aspect,
|
|
48395
|
+
naturalHeight: null,
|
|
48396
|
+
rasterAt(heightPx) {
|
|
48397
|
+
const key = Math.max(1, Math.round(heightPx));
|
|
48398
|
+
let hit = cache.get(key);
|
|
48399
|
+
if (hit === void 0) {
|
|
48400
|
+
const fresh = render2(key);
|
|
48401
|
+
hit = fresh;
|
|
48402
|
+
fresh.catch(() => {
|
|
48403
|
+
if (cache.get(key) === fresh)
|
|
48404
|
+
cache.delete(key);
|
|
48405
|
+
});
|
|
48406
|
+
} else {
|
|
48407
|
+
cache.delete(key);
|
|
48408
|
+
}
|
|
48409
|
+
cache.set(key, hit);
|
|
48410
|
+
while (cache.size > SVG_RASTER_CACHE_SIZE) {
|
|
48411
|
+
cache.delete(cache.keys().next().value);
|
|
48412
|
+
}
|
|
48413
|
+
return hit;
|
|
48414
|
+
}
|
|
48415
|
+
};
|
|
48416
|
+
}
|
|
48417
|
+
async function decodeLogo(bytes2, contentType) {
|
|
48418
|
+
if (contentType === "image/svg+xml") {
|
|
48419
|
+
const source = await svgSource(bytes2);
|
|
48420
|
+
await source.rasterAt(64);
|
|
48421
|
+
return source;
|
|
48422
|
+
}
|
|
48423
|
+
let bitmap;
|
|
48424
|
+
try {
|
|
48425
|
+
bitmap = await createImageBitmap(new Blob([bytes2.slice()], { type: contentType }));
|
|
48426
|
+
} catch (error51) {
|
|
48427
|
+
throw new Error(`the ${contentType} could not be decoded: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
48428
|
+
}
|
|
48429
|
+
const image = frame(bitmap);
|
|
48430
|
+
return {
|
|
48431
|
+
contentType,
|
|
48432
|
+
aspect: bitmap.width / bitmap.height,
|
|
48433
|
+
naturalHeight: bitmap.height,
|
|
48434
|
+
rasterAt: async () => image
|
|
48435
|
+
};
|
|
48436
|
+
}
|
|
48437
|
+
|
|
48438
|
+
// ../../packages/run-core/dist/render/mp4-cap.js
|
|
48439
|
+
var HEADROOM = 0.92;
|
|
48440
|
+
function fitBitrate(maxBytes, durationMs) {
|
|
48441
|
+
return Math.round(maxBytes * HEADROOM * 8 / (durationMs / 1e3));
|
|
48442
|
+
}
|
|
48443
|
+
var sizeOf = (t) => ({ width: t.width, height: t.height });
|
|
48444
|
+
function capLadder(asked, { share, floor }, fit) {
|
|
48445
|
+
const rungs = [];
|
|
48446
|
+
let at = asked;
|
|
48447
|
+
if (at.fps > share.fps) {
|
|
48448
|
+
const target = {
|
|
48449
|
+
...at,
|
|
48450
|
+
fps: share.fps,
|
|
48451
|
+
bitrate: Math.round(at.bitrate * share.fps / at.fps)
|
|
48452
|
+
};
|
|
48453
|
+
rungs.push({ target, step: { kind: "fps", from: at.fps, to: share.fps } });
|
|
48454
|
+
at = target;
|
|
48455
|
+
}
|
|
48456
|
+
const shareQuality = share.encoder?.quality;
|
|
48457
|
+
const quality = at.encoder?.quality;
|
|
48458
|
+
const atShare = at.width === share.width && at.height === share.height && (shareQuality === void 0 || quality !== void 0 && quality <= shareQuality);
|
|
48459
|
+
if (!atShare) {
|
|
48460
|
+
rungs.push({
|
|
48461
|
+
target: share,
|
|
48462
|
+
step: {
|
|
48463
|
+
kind: "share",
|
|
48464
|
+
from: sizeOf(at),
|
|
48465
|
+
to: sizeOf(share),
|
|
48466
|
+
...shareQuality === void 0 ? {} : { quality: shareQuality }
|
|
48467
|
+
}
|
|
48468
|
+
});
|
|
48469
|
+
at = share;
|
|
48470
|
+
}
|
|
48471
|
+
if (at.width !== floor.width || at.height !== floor.height) {
|
|
48472
|
+
rungs.push({
|
|
48473
|
+
target: floor,
|
|
48474
|
+
step: { kind: "frame", from: sizeOf(at), to: sizeOf(floor) }
|
|
48475
|
+
});
|
|
48476
|
+
}
|
|
48477
|
+
const { quality: _byQuality, ...byBitrate } = floor.encoder ?? {};
|
|
48478
|
+
rungs.push({
|
|
48479
|
+
target: { ...floor, bitrate: fit.bitrate, encoder: byBitrate },
|
|
48480
|
+
step: { kind: "fit", ...fit }
|
|
48481
|
+
});
|
|
48482
|
+
return rungs;
|
|
48483
|
+
}
|
|
48484
|
+
function fitRetry(fit, maxBytes, actualBytes) {
|
|
48485
|
+
const bitrate = Math.round(fit.target.bitrate * maxBytes * HEADROOM / actualBytes);
|
|
48486
|
+
if (fit.step.kind !== "fit") {
|
|
48487
|
+
throw new Error(`fitRetry retries a fit rung, not a ${fit.step.kind} one`);
|
|
48488
|
+
}
|
|
48489
|
+
return {
|
|
48490
|
+
target: { ...fit.target, bitrate },
|
|
48491
|
+
step: { kind: "fit", bitrate, durationMs: fit.step.durationMs }
|
|
48492
|
+
};
|
|
48493
|
+
}
|
|
48494
|
+
|
|
48263
48495
|
// ../../packages/run-core/dist/export/target.js
|
|
48264
48496
|
var MAX_STILL_SIDE = 3840;
|
|
48265
48497
|
|
|
@@ -48329,8 +48561,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
48329
48561
|
return true;
|
|
48330
48562
|
});
|
|
48331
48563
|
}
|
|
48564
|
+
function screenImageName(step) {
|
|
48565
|
+
return step === null ? "final.png" : `step-${step}.png`;
|
|
48566
|
+
}
|
|
48567
|
+
async function scaledPng(bytes2, width) {
|
|
48568
|
+
const bitmap = await createImageBitmap(new Blob([bytes2]));
|
|
48569
|
+
try {
|
|
48570
|
+
const canvas = new OffscreenCanvas(width, Math.round(bitmap.height * width / bitmap.width));
|
|
48571
|
+
canvas.getContext("2d").drawImage(bitmap, 0, 0, canvas.width, canvas.height);
|
|
48572
|
+
const blob = await canvas.convertToBlob({ type: "image/png" });
|
|
48573
|
+
return new Uint8Array(await blob.arrayBuffer());
|
|
48574
|
+
} finally {
|
|
48575
|
+
bitmap.close();
|
|
48576
|
+
}
|
|
48577
|
+
}
|
|
48332
48578
|
async function renderOutput(input) {
|
|
48333
48579
|
const { fileType, target, scene, bundle, frames, onFrame } = input;
|
|
48580
|
+
if (input.screensOnly !== void 0 && fileType === "stills") {
|
|
48581
|
+
throw new Error("screensOnly applies to an mp4 or gif output, not stills");
|
|
48582
|
+
}
|
|
48334
48583
|
const logoAt = async (at2) => {
|
|
48335
48584
|
if (input.logo === null)
|
|
48336
48585
|
return { logo: null, logoWarning: null };
|
|
@@ -48467,6 +48716,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
48467
48716
|
logo,
|
|
48468
48717
|
wallpaper: wallpaper.image,
|
|
48469
48718
|
...camera === void 0 ? {} : { camera },
|
|
48719
|
+
...input.outputTimesMs === void 0 ? {} : { outputTimesMs: input.outputTimesMs },
|
|
48470
48720
|
...onFrame === void 0 ? {} : { onFrame }
|
|
48471
48721
|
});
|
|
48472
48722
|
} finally {
|
|
@@ -48493,6 +48743,57 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
48493
48743
|
}
|
|
48494
48744
|
};
|
|
48495
48745
|
}
|
|
48746
|
+
if (input.screensOnly !== void 0) {
|
|
48747
|
+
const { width } = input.screensOnly;
|
|
48748
|
+
const { logo, logoWarning: logoWarning2 } = await logoAt(target);
|
|
48749
|
+
const wallpaper = await wallpaperAt(target);
|
|
48750
|
+
let result2;
|
|
48751
|
+
try {
|
|
48752
|
+
result2 = await renderScreens({
|
|
48753
|
+
plan,
|
|
48754
|
+
bundle,
|
|
48755
|
+
scene,
|
|
48756
|
+
target,
|
|
48757
|
+
ports: { frames, surface, images: createPngSink() },
|
|
48758
|
+
logo,
|
|
48759
|
+
wallpaper: wallpaper.image
|
|
48760
|
+
});
|
|
48761
|
+
} finally {
|
|
48762
|
+
release(wallpaper.image, wallpaper.held ?? null);
|
|
48763
|
+
}
|
|
48764
|
+
const deepest = input.wallpaper?.ok !== true ? 1 : composeForTarget({
|
|
48765
|
+
plan,
|
|
48766
|
+
bundle,
|
|
48767
|
+
scene,
|
|
48768
|
+
target
|
|
48769
|
+
}).resolved.cameraKeys.reduce((m, k) => Math.max(m, k.scale), 1);
|
|
48770
|
+
const files = [];
|
|
48771
|
+
for (const image of result2.images) {
|
|
48772
|
+
files.push({
|
|
48773
|
+
name: screenImageName(image.step),
|
|
48774
|
+
bytes: await scaledPng(image.bytes, width)
|
|
48775
|
+
});
|
|
48776
|
+
}
|
|
48777
|
+
return {
|
|
48778
|
+
files,
|
|
48779
|
+
facts: {
|
|
48780
|
+
detailViolations: result2.detailViolations,
|
|
48781
|
+
unavailableSpans: [...result2.unavailableSpans, ...reclaimed],
|
|
48782
|
+
unplacedStills: [],
|
|
48783
|
+
loweredZooms: [],
|
|
48784
|
+
logoWarning: logoWarning2,
|
|
48785
|
+
wallpaperWarning: wallpaperWarning(target, deepest, wallpaper.failed),
|
|
48786
|
+
clampedRanges: [],
|
|
48787
|
+
// The target's own size: the screens' windows are measured in it.
|
|
48788
|
+
rendered: {
|
|
48789
|
+
width: target.width,
|
|
48790
|
+
height: target.height,
|
|
48791
|
+
fps: target.fps
|
|
48792
|
+
},
|
|
48793
|
+
screens: result2.screens
|
|
48794
|
+
}
|
|
48795
|
+
};
|
|
48796
|
+
}
|
|
48496
48797
|
const renderAt = async (at2, maxBytes, saysWidth = false, pass) => {
|
|
48497
48798
|
const { logo, logoWarning: logoWarning2 } = await logoAt(at2);
|
|
48498
48799
|
const wallpaper = await wallpaperAt(at2);
|
|
@@ -48849,6 +49150,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
48849
49150
|
}
|
|
48850
49151
|
}
|
|
48851
49152
|
const report = globalThis[RENDER_PROGRESS_BINDING];
|
|
49153
|
+
const sink = { copyMs: 0, encodeMs: 0, finishMs: 0, frames: 0 };
|
|
49154
|
+
globalThis[SINK_TIMES_GLOBAL] = sink;
|
|
48852
49155
|
const started = performance.now();
|
|
48853
49156
|
const source = await framesFor(bundle, load);
|
|
48854
49157
|
let framesMs = 0;
|
|
@@ -48885,6 +49188,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
48885
49188
|
}
|
|
48886
49189
|
},
|
|
48887
49190
|
...manifest.stills === void 0 ? {} : { stills: manifest.stills },
|
|
49191
|
+
...manifest.outputTimesMs === void 0 ? {} : { outputTimesMs: manifest.outputTimesMs },
|
|
49192
|
+
...manifest.screensOnly === void 0 ? {} : { screensOnly: manifest.screensOnly },
|
|
48888
49193
|
onFrame: wholePercent((done, total, width, pass) => width === void 0 ? report?.(done, total) : pass === void 0 ? report?.(done, total, width) : report?.(done, total, width, pass))
|
|
48889
49194
|
// The decoded image is freed once every output is rendered: the GIF
|
|
48890
49195
|
// ladder and the MP4 cap re-render inside this call.
|
|
@@ -48899,7 +49204,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
48899
49204
|
timing: {
|
|
48900
49205
|
renderMs: performance.now() - started,
|
|
48901
49206
|
framesMs,
|
|
48902
|
-
frameReads
|
|
49207
|
+
frameReads,
|
|
49208
|
+
sink: fileType === "mp4" ? sink : null
|
|
48903
49209
|
}
|
|
48904
49210
|
};
|
|
48905
49211
|
}
|