hyperframes 0.8.72 → 0.8.74

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.
@@ -17022,7 +17022,7 @@ var require_util = __commonJS({
17022
17022
  return path;
17023
17023
  }
17024
17024
  exports.normalize = normalize;
17025
- function join62(aRoot, aPath) {
17025
+ function join63(aRoot, aPath) {
17026
17026
  if (aRoot === "") {
17027
17027
  aRoot = ".";
17028
17028
  }
@@ -17054,7 +17054,7 @@ var require_util = __commonJS({
17054
17054
  }
17055
17055
  return joined;
17056
17056
  }
17057
- exports.join = join62;
17057
+ exports.join = join63;
17058
17058
  exports.isAbsolute = function(aPath) {
17059
17059
  return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
17060
17060
  };
@@ -17227,7 +17227,7 @@ var require_util = __commonJS({
17227
17227
  parsed.path = parsed.path.substring(0, index + 1);
17228
17228
  }
17229
17229
  }
17230
- sourceURL = join62(urlGenerate(parsed), sourceURL);
17230
+ sourceURL = join63(urlGenerate(parsed), sourceURL);
17231
17231
  }
17232
17232
  return normalize(sourceURL);
17233
17233
  }
@@ -60748,7 +60748,7 @@ async function pollHfReady(page, timeoutMs, intervalMs = 100) {
60748
60748
  State: __hf=${diag.hasHf}, seek=${diag.hasSeek}, player=${diag.hasPlayer}, renderReady=${diag.renderReady}, duration=${diag.duration}`
60749
60749
  );
60750
60750
  }
60751
- async function pollSubCompositionTimelines(page, timeoutMs, intervalMs = 150, getScriptLoadFailures, scriptFailureGraceMs = 2e3) {
60751
+ async function pollSubCompositionTimelines(page, timeoutMs, intervalMs = 150, getScriptLoadFailures, scriptFailureGraceMs = 2e3, onPending) {
60752
60752
  const expression = `(function() {
60753
60753
  var hosts = document.querySelectorAll("[data-composition-id]");
60754
60754
  if (hosts.length === 0) return true;
@@ -60788,7 +60788,7 @@ async function pollSubCompositionTimelines(page, timeoutMs, intervalMs = 150, ge
60788
60788
  })()`);
60789
60789
  return "ready";
60790
60790
  }
60791
- const missing = await page.evaluate(`(function() {
60791
+ const evaluated = await page.evaluate(`(function() {
60792
60792
  var hosts = document.querySelectorAll("[data-composition-id]");
60793
60793
  var timelines = window.__timelines || {};
60794
60794
  var m = [];
@@ -60797,8 +60797,11 @@ async function pollSubCompositionTimelines(page, timeoutMs, intervalMs = 150, ge
60797
60797
  var id = hosts[i].getAttribute("data-composition-id");
60798
60798
  if (id && !timelines[id]) m.push(id);
60799
60799
  }
60800
- return m.join(", ");
60800
+ return m;
60801
60801
  })()`);
60802
+ const pendingIds = Array.isArray(evaluated) ? evaluated.map((id) => String(id)) : [];
60803
+ onPending?.(pendingIds);
60804
+ const missing = pendingIds.join(", ");
60802
60805
  if (scriptFailureBail) {
60803
60806
  console.warn(`[FrameCapture] Composition(s) still waiting on the failed script: ${missing}.`);
60804
60807
  } else {
@@ -60912,11 +60915,17 @@ function recordSubTimelineWarning(session, timeoutMs) {
60912
60915
  if (session.subTimelineWaitOutcome === "ready" || !session.subTimelineWaitOutcome) return;
60913
60916
  const scriptFailure = session.subTimelineWaitOutcome === "script_failure";
60914
60917
  const hasRuntimeErrors = session.scriptLoadFailures.some((f) => f.startsWith("runtime-error:"));
60918
+ const pending = session.pendingTimelineIds ?? [];
60919
+ const pendingSuffix = pending.length > 0 ? ` (still unregistered: ${pending.join(", ")})` : "";
60915
60920
  recordCaptureWarnings(session, [
60916
60921
  {
60917
60922
  code: scriptFailure ? "sub_timeline_script_failure" : "sub_timeline_readiness_timeout",
60918
- message: scriptFailure ? hasRuntimeErrors ? `A sub-composition script threw during execution \u2014 timeline registration never arrived (${session.scriptLoadFailures.join(", ")})` : `A sub-composition timeline script failed to load (${session.scriptLoadFailures.join(", ")})` : `Sub-composition timelines did not become ready within ${timeoutMs}ms`,
60919
- details: { timeoutMs, sources: [...session.scriptLoadFailures] }
60923
+ message: scriptFailure ? hasRuntimeErrors ? `A sub-composition script threw during execution \u2014 timeline registration never arrived (${session.scriptLoadFailures.join(", ")})` : `A sub-composition timeline script failed to load (${session.scriptLoadFailures.join(", ")})` : `Sub-composition timelines did not become ready within ${timeoutMs}ms${pendingSuffix}. This can be intentional: a composition driven by CSS animations or rAF never registers window.__timelines[id], and marking its host with data-no-timeline skips the wait entirely. Otherwise, a composition that sets up asynchronously must register window.__timelines[id] once setup completes.`,
60924
+ details: {
60925
+ timeoutMs,
60926
+ sources: [...session.scriptLoadFailures],
60927
+ pendingCompositionIds: [...pending]
60928
+ }
60920
60929
  }
60921
60930
  ]);
60922
60931
  }
@@ -61105,7 +61114,11 @@ async function initializeSession(session) {
61105
61114
  page,
61106
61115
  pageReadyTimeout2,
61107
61116
  void 0,
61108
- () => session.scriptLoadFailures
61117
+ () => session.scriptLoadFailures,
61118
+ void 0,
61119
+ (ids) => {
61120
+ session.pendingTimelineIds = [...ids];
61121
+ }
61109
61122
  );
61110
61123
  logInitPhase(`pollSubCompositionTimelines complete (${session.subTimelineWaitOutcome})`);
61111
61124
  recordSubTimelineWarning(session, pageReadyTimeout2);
@@ -61219,7 +61232,11 @@ async function initializeSession(session) {
61219
61232
  page,
61220
61233
  pageReadyTimeout,
61221
61234
  void 0,
61222
- () => session.scriptLoadFailures
61235
+ () => session.scriptLoadFailures,
61236
+ void 0,
61237
+ (ids) => {
61238
+ session.pendingTimelineIds = [...ids];
61239
+ }
61223
61240
  );
61224
61241
  logInitPhase(`pollSubCompositionTimelines complete (${session.subTimelineWaitOutcome})`);
61225
61242
  recordSubTimelineWarning(session, pageReadyTimeout);
@@ -63808,13 +63825,42 @@ var init_ffprobe = __esm({
63808
63825
  });
63809
63826
 
63810
63827
  // ../engine/src/utils/renderProvenance.ts
63811
- import { createRequire } from "module";
63828
+ import { readFileSync as readFileSync3 } from "fs";
63829
+ import { dirname as dirname4, join as join7 } from "path";
63830
+ import { fileURLToPath as fileURLToPath2 } from "url";
63831
+ function resolveOwnVersionFrom(startDir) {
63832
+ let dir = startDir;
63833
+ for (let depth = 0; depth < MAX_WALK_DEPTH; depth++) {
63834
+ const candidate = join7(dir, "package.json");
63835
+ let pkg;
63836
+ try {
63837
+ pkg = JSON.parse(readFileSync3(candidate, "utf8"));
63838
+ } catch {
63839
+ pkg = void 0;
63840
+ }
63841
+ if (pkg && typeof pkg.name === "string" && OWN_PACKAGE_NAME.test(pkg.name)) {
63842
+ if (typeof pkg.version === "string" && pkg.version.length > 0) return pkg.version;
63843
+ reportUnresolved(`found ${pkg.name} at ${candidate} but it declares no version`);
63844
+ return UNRESOLVED_VERSION;
63845
+ }
63846
+ const parent = dirname4(dir);
63847
+ if (parent === dir) break;
63848
+ dir = parent;
63849
+ }
63850
+ reportUnresolved(`no package.json matching ${OWN_PACKAGE_NAME} within ${MAX_WALK_DEPTH} levels`);
63851
+ return UNRESOLVED_VERSION;
63852
+ }
63853
+ function reportUnresolved(reason) {
63854
+ console.warn(
63855
+ `[renderProvenance] could not resolve the engine version (${reason}); stamping ${PROVENANCE_VERSION_TAG}="${UNRESOLVED_VERSION}". This is a lookup failure, not a version - do not treat it as one.`
63856
+ );
63857
+ }
63812
63858
  function readEngineVersion() {
63813
63859
  try {
63814
- const version2 = createRequire(import.meta.url)("../../package.json").version;
63815
- return typeof version2 === "string" && version2.length > 0 ? version2 : UNKNOWN_VERSION;
63860
+ return resolveOwnVersionFrom(dirname4(fileURLToPath2(import.meta.url)));
63816
63861
  } catch {
63817
- return UNKNOWN_VERSION;
63862
+ reportUnresolved("import.meta.url is not a file URL");
63863
+ return UNRESOLVED_VERSION;
63818
63864
  }
63819
63865
  }
63820
63866
  function isMovFamilyContainer(outputPath) {
@@ -63841,7 +63887,7 @@ function readRenderProvenance(tags) {
63841
63887
  if (renderer === "") return null;
63842
63888
  return { renderer, version: readTagCI(tags, PROVENANCE_VERSION_TAG) };
63843
63889
  }
63844
- var PROVENANCE_RENDERER_TAG, PROVENANCE_VERSION_TAG, PROVENANCE_RENDERER_NAME, UNKNOWN_VERSION, PROVENANCE_VERSION;
63890
+ var PROVENANCE_RENDERER_TAG, PROVENANCE_VERSION_TAG, PROVENANCE_RENDERER_NAME, UNRESOLVED_VERSION, OWN_PACKAGE_NAME, MAX_WALK_DEPTH, PROVENANCE_VERSION;
63845
63891
  var init_renderProvenance = __esm({
63846
63892
  "../engine/src/utils/renderProvenance.ts"() {
63847
63893
  "use strict";
@@ -63849,7 +63895,9 @@ var init_renderProvenance = __esm({
63849
63895
  PROVENANCE_RENDERER_TAG = "hyperframes_renderer";
63850
63896
  PROVENANCE_VERSION_TAG = "hyperframes_version";
63851
63897
  PROVENANCE_RENDERER_NAME = "hyperframes";
63852
- UNKNOWN_VERSION = "0.0.0-dev";
63898
+ UNRESOLVED_VERSION = "unresolved";
63899
+ OWN_PACKAGE_NAME = /^(?:hyperframes|@hyperframes\/[^/]+)$/;
63900
+ MAX_WALK_DEPTH = 12;
63853
63901
  PROVENANCE_VERSION = readEngineVersion();
63854
63902
  }
63855
63903
  });
@@ -63863,13 +63911,13 @@ import {
63863
63911
  mkdirSync as mkdirSync2,
63864
63912
  mkdtempSync,
63865
63913
  openSync,
63866
- readFileSync as readFileSync3,
63914
+ readFileSync as readFileSync4,
63867
63915
  readdirSync as readdirSync2,
63868
63916
  statSync as statSync2,
63869
63917
  writeFileSync as writeFileSync2,
63870
63918
  writeSync
63871
63919
  } from "fs";
63872
- import { join as join7, dirname as dirname4, extname } from "path";
63920
+ import { join as join8, dirname as dirname5, extname } from "path";
63873
63921
  function appendEncodeTimeoutMessage(error, timedOut, timeoutMs) {
63874
63922
  if (!timedOut) return error;
63875
63923
  return `${error}
@@ -64110,7 +64158,7 @@ function buildEncoderArgs(options, inputArgs, outputPath, gpuEncoder = null) {
64110
64158
  }
64111
64159
  async function encodeFramesFromDir(framesDir, framePattern, outputPath, options, signal, config) {
64112
64160
  const startTime = Date.now();
64113
- const outputDir = dirname4(outputPath);
64161
+ const outputDir = dirname5(outputPath);
64114
64162
  if (!existsSync6(outputDir)) mkdirSync2(outputDir, { recursive: true });
64115
64163
  const files = readdirSync2(framesDir).filter((f) => f.match(/\.(jpg|jpeg|png)$/i));
64116
64164
  const frameCount = files.length;
@@ -64128,7 +64176,7 @@ async function encodeFramesFromDir(framesDir, framePattern, outputPath, options,
64128
64176
  if (options.useGpu) {
64129
64177
  gpuEncoder = await getCachedGpuEncoder();
64130
64178
  }
64131
- const inputPath = join7(framesDir, framePattern);
64179
+ const inputPath = join8(framesDir, framePattern);
64132
64180
  const inputArgs = ["-framerate", fpsToFfmpegArg(options.fps), "-i", inputPath];
64133
64181
  const args = buildEncoderArgs(options, inputArgs, outputPath, gpuEncoder);
64134
64182
  const encodeTimeout = config?.ffmpegEncodeTimeout ?? DEFAULT_CONFIG.ffmpegEncodeTimeout;
@@ -64175,7 +64223,7 @@ function buildConcatArgs(concatListPath, outputPath) {
64175
64223
  }
64176
64224
  function writeConcatList(dir, inputPaths) {
64177
64225
  concatListSeq += 1;
64178
- const listPath = join7(dir, `concat-list-${process.pid}-${concatListSeq}.txt`);
64226
+ const listPath = join8(dir, `concat-list-${process.pid}-${concatListSeq}.txt`);
64179
64227
  const body = inputPaths.map((p) => `file '${p.replace(/'/g, "'\\''")}'`).join("\n");
64180
64228
  writeFileSync2(listPath, body, "utf-8");
64181
64229
  return listPath;
@@ -64185,8 +64233,8 @@ async function concatVideoFiles(inputPaths, outputPath, signal, config) {
64185
64233
  if (firstInput === void 0) {
64186
64234
  return { success: false, error: "concatVideoFiles: no inputs", externalInterruption: false };
64187
64235
  }
64188
- mkdirSync2(dirname4(outputPath), { recursive: true });
64189
- const listPath = writeConcatList(dirname4(firstInput), inputPaths);
64236
+ mkdirSync2(dirname5(outputPath), { recursive: true });
64237
+ const listPath = writeConcatList(dirname5(firstInput), inputPaths);
64190
64238
  const encodeTimeout = config?.ffmpegEncodeTimeout ?? DEFAULT_CONFIG.ffmpegEncodeTimeout;
64191
64239
  const result = await runFfmpeg(buildConcatArgs(listPath, outputPath), {
64192
64240
  signal,
@@ -64218,8 +64266,8 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
64218
64266
  }
64219
64267
  const chunkSize = Math.max(30, Math.floor(chunkSizeFrames));
64220
64268
  const chunkCount = Math.ceil(files.length / chunkSize);
64221
- mkdirSync2(dirname4(outputPath), { recursive: true });
64222
- const chunkDir = mkdtempSync(join7(dirname4(outputPath), "chunk-encode-"));
64269
+ mkdirSync2(dirname5(outputPath), { recursive: true });
64270
+ const chunkDir = mkdtempSync(join8(dirname5(outputPath), "chunk-encode-"));
64223
64271
  const chunkPaths = [];
64224
64272
  for (let i = 0; i < chunkCount; i++) {
64225
64273
  if (signal?.aborted) {
@@ -64235,8 +64283,8 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
64235
64283
  const startNumber = i * chunkSize;
64236
64284
  const framesInChunk = Math.min(chunkSize, files.length - startNumber);
64237
64285
  const ext = outputPath.endsWith(".webm") ? ".webm" : outputPath.endsWith(".mov") ? ".mov" : ".mp4";
64238
- const chunkPath = join7(chunkDir, `chunk_${String(i).padStart(4, "0")}${ext}`);
64239
- const inputPath = join7(framesDir, framePattern);
64286
+ const chunkPath = join8(chunkDir, `chunk_${String(i).padStart(4, "0")}${ext}`);
64287
+ const inputPath = join8(framesDir, framePattern);
64240
64288
  const inputArgs = [
64241
64289
  "-framerate",
64242
64290
  fpsToFfmpegArg(options.fps),
@@ -64295,7 +64343,7 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
64295
64343
  };
64296
64344
  }
64297
64345
  async function muxVideoWithAudio(videoPath, audioPath, outputPath, signal, config, fps) {
64298
- const outputDir = dirname4(outputPath);
64346
+ const outputDir = dirname5(outputPath);
64299
64347
  if (!existsSync6(outputDir)) mkdirSync2(outputDir, { recursive: true });
64300
64348
  const isWebm = outputPath.endsWith(".webm");
64301
64349
  const isMov = outputPath.endsWith(".mov");
@@ -64384,14 +64432,14 @@ async function packageHls(videoPath, audioPath, outputDir, options) {
64384
64432
  "-master_pl_name",
64385
64433
  HLS_MASTER_PLAYLIST,
64386
64434
  "-hls_segment_filename",
64387
- join7(outputDir, "%v_%05d.ts"),
64435
+ join8(outputDir, "%v_%05d.ts"),
64388
64436
  // Without these the mpegts muxer starts the stream at PTS 1.4 s.
64389
64437
  "-muxdelay",
64390
64438
  "0",
64391
64439
  "-muxpreload",
64392
64440
  "0"
64393
64441
  );
64394
- args.push("-y", join7(outputDir, "%v.m3u8"));
64442
+ args.push("-y", join8(outputDir, "%v.m3u8"));
64395
64443
  const processTimeout = options.ffmpegProcessTimeout ?? DEFAULT_CONFIG.ffmpegProcessTimeout;
64396
64444
  const result = await runFfmpeg(args, { signal, timeout: processTimeout });
64397
64445
  if (signal?.aborted) {
@@ -64403,7 +64451,7 @@ async function packageHls(videoPath, audioPath, outputDir, options) {
64403
64451
  };
64404
64452
  }
64405
64453
  if (result.success && hasAudio) {
64406
- const masterPath = join7(outputDir, HLS_MASTER_PLAYLIST);
64454
+ const masterPath = join8(outputDir, HLS_MASTER_PLAYLIST);
64407
64455
  let master;
64408
64456
  try {
64409
64457
  master = openSync(masterPath, "r+", 384);
@@ -64412,7 +64460,7 @@ async function packageHls(videoPath, audioPath, outputDir, options) {
64412
64460
  }
64413
64461
  if (master !== void 0) {
64414
64462
  try {
64415
- const stripped = stripAudioOnlyVariants(readFileSync3(master, "utf-8"));
64463
+ const stripped = stripAudioOnlyVariants(readFileSync4(master, "utf-8"));
64416
64464
  ftruncateSync(master, 0);
64417
64465
  writeSync(master, stripped, 0, "utf-8");
64418
64466
  } finally {
@@ -64546,7 +64594,7 @@ var init_jpegInput = __esm({
64546
64594
  import { spawn as spawn4 } from "child_process";
64547
64595
  import { once } from "events";
64548
64596
  import { existsSync as existsSync7, mkdirSync as mkdirSync3, statSync as statSync3 } from "fs";
64549
- import { dirname as dirname5 } from "path";
64597
+ import { dirname as dirname6 } from "path";
64550
64598
  function createFrameReorderBuffer(startFrame, endFrame) {
64551
64599
  let cursor = startFrame;
64552
64600
  let aborted = null;
@@ -64788,7 +64836,7 @@ function buildStreamingArgs(options, outputPath, gpuEncoder = null) {
64788
64836
  return args;
64789
64837
  }
64790
64838
  async function spawnStreamingEncoder(outputPath, options, signal, config) {
64791
- const outputDir = dirname5(outputPath);
64839
+ const outputDir = dirname6(outputPath);
64792
64840
  if (!existsSync7(outputDir)) mkdirSync3(outputDir, { recursive: true });
64793
64841
  let gpuEncoder = null;
64794
64842
  if (options.useGpu) {
@@ -64950,7 +64998,7 @@ var init_streamingEncoder = __esm({
64950
64998
 
64951
64999
  // ../parsers/dist/assetResolution.js
64952
65000
  import { existsSync as existsSync8 } from "fs";
64953
- import { isAbsolute, join as join8, posix as posix2, relative, resolve as resolve5, sep as sep2 } from "path";
65001
+ import { isAbsolute, join as join9, posix as posix2, relative, resolve as resolve5, sep as sep2 } from "path";
64954
65002
  function decodeUrlPathVariants2(path) {
64955
65003
  const variants = [path];
64956
65004
  try {
@@ -64976,11 +65024,11 @@ function isWithinProjectRoot(projectDir, candidate, pathModule = { resolve: reso
64976
65024
  }
64977
65025
  function reanchoredCandidates(variant, baseDir, compiledDir) {
64978
65026
  const baseAbs = resolve5(baseDir);
64979
- const joinedAbs = resolve5(join8(baseDir, variant));
65027
+ const joinedAbs = resolve5(join9(baseDir, variant));
64980
65028
  if (joinedAbs === baseAbs || joinedAbs.startsWith(baseAbs + sep2)) return [];
64981
65029
  const stripped = posix2.normalize(variant.replace(/\\/g, "/")).replace(/^(\.\.\/)+/, "");
64982
65030
  if (!stripped || stripped === variant || stripped.startsWith("..")) return [];
64983
- return compiledDir ? [join8(compiledDir, stripped), join8(baseDir, stripped)] : [join8(baseDir, stripped)];
65031
+ return compiledDir ? [join9(compiledDir, stripped), join9(baseDir, stripped)] : [join9(baseDir, stripped)];
64984
65032
  }
64985
65033
  function resolveProjectRelativeSrc(src, baseDir, compiledDir) {
64986
65034
  const cleanSrc = cleanAssetUrl(src);
@@ -64990,10 +65038,10 @@ function resolveProjectRelativeSrc(src, baseDir, compiledDir) {
64990
65038
  for (const candidate of reanchoredCandidates(variant, baseDir, compiledDir)) {
64991
65039
  candidates.add(candidate);
64992
65040
  }
64993
- if (compiledDir) candidates.add(join8(compiledDir, variant));
64994
- candidates.add(join8(baseDir, variant));
65041
+ if (compiledDir) candidates.add(join9(compiledDir, variant));
65042
+ candidates.add(join9(baseDir, variant));
64995
65043
  }
64996
- return [...candidates].find(existsSync8) ?? join8(baseDir, cleanSrc);
65044
+ return [...candidates].find(existsSync8) ?? join9(baseDir, cleanSrc);
64997
65045
  }
64998
65046
  var init_assetResolution = __esm({
64999
65047
  "../parsers/dist/assetResolution.js"() {
@@ -65087,7 +65135,7 @@ import {
65087
65135
  } from "fs";
65088
65136
  import { createHash, randomUUID } from "crypto";
65089
65137
  import { BlockList, isIP } from "net";
65090
- import { dirname as dirname6, extname as extname2, join as join9 } from "path";
65138
+ import { dirname as dirname7, extname as extname2, join as join10 } from "path";
65091
65139
  import { Readable, Transform } from "stream";
65092
65140
  import { pipeline } from "stream/promises";
65093
65141
  function signalScopeKey(signal) {
@@ -65139,7 +65187,7 @@ function classifyDownloadFailure(error) {
65139
65187
  return new UrlDownloadError(
65140
65188
  "network",
65141
65189
  true,
65142
- "Download failed due to a transient network error"
65190
+ `Download failed due to a transient network error${describeCause(current2)}`
65143
65191
  );
65144
65192
  }
65145
65193
  current2 = typeof current2 === "object" && current2 !== null && "cause" in current2 ? current2.cause : void 0;
@@ -65147,9 +65195,16 @@ function classifyDownloadFailure(error) {
65147
65195
  return new UrlDownloadError(
65148
65196
  "filesystem",
65149
65197
  false,
65150
- "Download failed while writing the local artifact"
65198
+ `Download failed while writing the local artifact${describeCause(error)}`
65151
65199
  );
65152
65200
  }
65201
+ function describeCause(error) {
65202
+ const name = error instanceof Error && /^[A-Za-z]{1,40}$/.test(error.name) ? error.name : "";
65203
+ const rawCode = typeof error === "object" && error !== null && "code" in error ? error.code : void 0;
65204
+ const code = typeof rawCode === "string" && /^[A-Z0-9_]{1,40}$/.test(rawCode) ? rawCode : "";
65205
+ const tag = [name, code].filter(Boolean).join(" ");
65206
+ return tag ? ` (${tag})` : "";
65207
+ }
65153
65208
  function isRetryableNetworkCause(error) {
65154
65209
  const message = error instanceof Error ? error.message : String(error);
65155
65210
  const code = typeof error === "object" && error !== null && "code" in error && typeof error.code === "string" ? error.code : "";
@@ -65215,7 +65270,7 @@ function removeCacheLockDirectoryIfEmpty(lockPath) {
65215
65270
  }
65216
65271
  function releaseOwnedCachePathLock(lockPath, owner) {
65217
65272
  try {
65218
- rmdirSync(join9(lockPath, owner));
65273
+ rmdirSync(join10(lockPath, owner));
65219
65274
  } catch (error) {
65220
65275
  if (error.code === "ENOENT") return;
65221
65276
  throw error;
@@ -65256,12 +65311,12 @@ async function acquireCachePathLock(localPath, timeoutMs, signal) {
65256
65311
  if (createdLock) {
65257
65312
  const owner = `${CACHE_LOCK_OWNER_PREFIX}${randomUUID()}`;
65258
65313
  try {
65259
- mkdirSync4(join9(lockPath, owner));
65314
+ mkdirSync4(join10(lockPath, owner));
65260
65315
  const entries2 = readdirSync3(lockPath);
65261
65316
  if (entries2.length === 1 && entries2[0] === owner) {
65262
65317
  return () => releaseOwnedCachePathLock(lockPath, owner);
65263
65318
  }
65264
- rmdirSync(join9(lockPath, owner));
65319
+ rmdirSync(join10(lockPath, owner));
65265
65320
  removeCacheLockDirectoryIfEmpty(lockPath);
65266
65321
  continue;
65267
65322
  } catch (error) {
@@ -65279,7 +65334,7 @@ async function acquireCachePathLock(localPath, timeoutMs, signal) {
65279
65334
  if (Date.now() - observedLock.stats.mtimeMs > CACHE_LOCK_STALE_MS) {
65280
65335
  if (observedLock.owner) {
65281
65336
  try {
65282
- rmdirSync(join9(lockPath, observedLock.owner));
65337
+ rmdirSync(join10(lockPath, observedLock.owner));
65283
65338
  } catch (error) {
65284
65339
  if (error.code === "ENOENT") continue;
65285
65340
  throw error;
@@ -65287,7 +65342,7 @@ async function acquireCachePathLock(localPath, timeoutMs, signal) {
65287
65342
  removeCacheLockDirectoryIfEmpty(lockPath);
65288
65343
  continue;
65289
65344
  }
65290
- const reclaimPath = join9(lockPath, CACHE_LOCK_RECLAIM_NAME);
65345
+ const reclaimPath = join10(lockPath, CACHE_LOCK_RECLAIM_NAME);
65291
65346
  try {
65292
65347
  mkdirSync4(reclaimPath);
65293
65348
  } catch (error) {
@@ -65725,8 +65780,8 @@ function emitDownloadTelemetry(options, event) {
65725
65780
  }
65726
65781
  }
65727
65782
  async function runDownloadAttempt(url, localPath, timeoutMs, attempt, options, signal) {
65728
- const attemptDir = mkdtempSync2(join9(dirname6(localPath), ".hf-download-"));
65729
- const partialPath = join9(attemptDir, "payload");
65783
+ const attemptDir = mkdtempSync2(join10(dirname7(localPath), ".hf-download-"));
65784
+ const partialPath = join10(attemptDir, "payload");
65730
65785
  const controller = new AbortController();
65731
65786
  let timedOut = false;
65732
65787
  let callerAborted = signal?.aborted ?? false;
@@ -65962,7 +66017,7 @@ async function downloadToTemp(url, destDir, timeoutMs = 3e5, signal, onTransient
65962
66017
  mkdirSync4(destDir, { recursive: true });
65963
66018
  }
65964
66019
  const filename = getFilenameFromUrl(url, validationScope);
65965
- const localPath = join9(destDir, filename);
66020
+ const localPath = join10(destDir, filename);
65966
66021
  const downloadPromise = (async () => {
65967
66022
  const cacheStartedAt = Date.now();
65968
66023
  const reused = await reuseOrInvalidateCachedFile(
@@ -74060,6 +74115,80 @@ function rootClassStyledSelectors(styles, rootClasses) {
74060
74115
  }
74061
74116
  return offenders;
74062
74117
  }
74118
+ function isIdentityZoom(rawValue) {
74119
+ const value = rawValue.trim().replace(/!\s*important\s*$/i, "").trim().toLowerCase();
74120
+ return value === "" || value === "normal" || value === "unset" || value === "initial" || value === "revert" || value === "1" || value === "1.0" || value === "100%";
74121
+ }
74122
+ function firstRescalingZoom(css) {
74123
+ ZOOM_DECLARATION.lastIndex = 0;
74124
+ let match;
74125
+ while ((match = ZOOM_DECLARATION.exec(css)) !== null) {
74126
+ const value = (match[1] ?? "").trim();
74127
+ if (!isIdentityZoom(value)) return value.replace(/!\s*important\s*$/i, "").trim();
74128
+ }
74129
+ return null;
74130
+ }
74131
+ function targetsCanvasRoot(selector, rootId, rootClasses) {
74132
+ const leftmost = selector.trim().split(/[\s>+~]+/)[0] ?? "";
74133
+ const bare = leftmost.toLowerCase();
74134
+ if (bare === "html" || bare === "body" || bare === ":root" || bare === "*") return true;
74135
+ if (rootId && leftmostCompoundId(selector) === rootId) return true;
74136
+ return leftmostCompoundClasses(selector).some((cls) => rootClasses.includes(cls));
74137
+ }
74138
+ function inlineCanvasZoomHits(rootTag, tags) {
74139
+ const hits = [];
74140
+ const htmlTag = findHtmlTag(tags);
74141
+ const bodyTag = tags.find((tag) => tag.name.toLowerCase() === "body");
74142
+ for (const [label, tag] of [
74143
+ ["the root element's inline style", rootTag],
74144
+ ["<html>'s inline style", htmlTag],
74145
+ ["<body>'s inline style", bodyTag]
74146
+ ]) {
74147
+ if (!tag) continue;
74148
+ const inline = readAttr(tag.raw, "style");
74149
+ const value = inline ? firstRescalingZoom(inline) : null;
74150
+ if (value) hits.push({ where: label, value, snippet: truncateSnippet(tag.raw) });
74151
+ }
74152
+ return hits;
74153
+ }
74154
+ function firstCanvasSelector(header, rootId, rootClasses) {
74155
+ for (const selector of header.split(",")) {
74156
+ const trimmed = selector.trim();
74157
+ if (trimmed && targetsCanvasRoot(trimmed, rootId, rootClasses)) return trimmed;
74158
+ }
74159
+ return null;
74160
+ }
74161
+ function canvasZoomInRule(header, body, rootId, rootClasses) {
74162
+ const trimmedHeader = header.trim();
74163
+ if (!trimmedHeader || trimmedHeader.startsWith("@")) return null;
74164
+ const value = firstRescalingZoom(body);
74165
+ if (!value) return null;
74166
+ const selector = firstCanvasSelector(trimmedHeader, rootId, rootClasses);
74167
+ if (!selector) return null;
74168
+ return {
74169
+ where: `\`${selector}\``,
74170
+ value,
74171
+ snippet: truncateSnippet(`${selector} { zoom: ${value} }`)
74172
+ };
74173
+ }
74174
+ function stylesheetCanvasZoomHits(styles, rootId, rootClasses) {
74175
+ const hits = [];
74176
+ for (const style of styles) {
74177
+ const ruleWithBody = /([^{}]+)\{([^{}]*)\}/g;
74178
+ let match;
74179
+ while ((match = ruleWithBody.exec(stripCssComments(style.content))) !== null) {
74180
+ const hit = canvasZoomInRule(match[1] ?? "", match[2] ?? "", rootId, rootClasses);
74181
+ if (hit) hits.push(hit);
74182
+ }
74183
+ }
74184
+ return hits;
74185
+ }
74186
+ function canvasZoomHits(rootTag, tags, styles, rootId, rootClasses) {
74187
+ return [
74188
+ ...inlineCanvasZoomHits(rootTag, tags),
74189
+ ...stylesheetCanvasZoomHits(styles, rootId, rootClasses)
74190
+ ];
74191
+ }
74063
74192
  function collectDeclaredVariableIds(htmlTagRaw) {
74064
74193
  const declared = /* @__PURE__ */ new Set();
74065
74194
  const raw = readJsonAttr(htmlTagRaw, "data-composition-variables");
@@ -74098,6 +74227,28 @@ function isInsideInertTemplate(tag, tags) {
74098
74227
  (candidate) => candidate.name === "template" && candidate.closeIndex != null && tag.index > candidate.index && tag.index < candidate.closeIndex
74099
74228
  );
74100
74229
  }
74230
+ function cssOwnerSelector(content, matchIndex) {
74231
+ const blockStart = content.lastIndexOf("{", matchIndex);
74232
+ if (blockStart === -1) return void 0;
74233
+ const previousBlockEnd = content.lastIndexOf("}", blockStart);
74234
+ const lines = content.slice(previousBlockEnd + 1, blockStart).trim().split("\n");
74235
+ return lines[lines.length - 1]?.trim() || void 0;
74236
+ }
74237
+ function elementSelector(tag) {
74238
+ const elementId = readAttr(tag.raw, "id");
74239
+ return elementId ? `#${elementId}` : void 0;
74240
+ }
74241
+ function negativeZIndexFinding(match, selector) {
74242
+ const level = match[1] ?? "";
74243
+ return {
74244
+ code: "negative_z_index",
74245
+ severity: "warning",
74246
+ ...selector ? { selector } : {},
74247
+ message: `\`z-index: -${level}\` paints the element behind its nearest stacking context's own content. With no stacking-context ancestor that context is the composition root itself, so an opaque background there hides it entirely: in the DOM, laid out, and absent from the picture. A transparent root leaves it visible. Siblings at \`z-index: 0\` or above are unaffected.`,
74248
+ fixHint: "Give the element's parent a stacking context - `isolation: isolate` is the cheapest, and `transform`, `filter`, `opacity` below 1, `contain: paint` and `will-change` all work too. The negative-z child then paints above that parent's background and renders normally. Or express paint order through DOM order - an earlier sibling paints behind a later one - and raise the elements that should sit in front rather than lowering this one.",
74249
+ snippet: truncateSnippet(match[0])
74250
+ };
74251
+ }
74101
74252
  function deriveDurationFromClips(tags, rootTag) {
74102
74253
  const clipEnds = [];
74103
74254
  for (const tag of tags) {
@@ -75173,7 +75324,7 @@ async function lintHyperframeHtml(html, options = {}) {
75173
75324
  timings: { totalMs: performance.now() - startedAt, ...timings }
75174
75325
  };
75175
75326
  }
75176
- var import_postcss_selector_parser, COMPOSITION_ID_IN_CSS_PATTERN, TIMELINE_REGISTRY_INIT_PATTERN, TIMELINE_REGISTRY_OBJECT_LITERAL_PATTERN, TIMELINE_REGISTRY_ASSIGN_PATTERN, WINDOW_TIMELINE_ASSIGN_PATTERN, INVALID_SCRIPT_CLOSE_PATTERN, TIMELINE_REGISTRY_KEY_PATTERN, TIMELINE_REGISTRY_OBJECT_OPEN_PATTERN, TIMELINE_REGISTRY_OBJECT_ENTRY_PATTERN, REGEX_ALLOWED_BEFORE, REGEX_ALLOWED_KEYWORDS, WORD_CHAR, CodeContext, VISIBLE_MARKUP_COMMENT_PATTERN, VISIBLE_MARKUP_COMMENT_PROTECTED_BLOCK_PATTERN, coreRules, IMAGE_SRC_EXT, VIDEO_SRC_EXT, AUDIO_SRC_EXT, SRC_KIND_NOUN, mediaRules, AUDIO_GROUP_TIMING_ATTRS, callIndexes, MAX_COMPOSITION_LINES, MAX_TIMED_ELEMENTS_PER_TRACK, TRACK_DENSITY_EXEMPT_TAGS, CAPTION_CUE_TOKEN, HEAVY_OVERLAY_ELEMENT_COUNT_WARN, HEAVY_OVERLAY_EXEMPT_TAGS, HEAVY_OVERLAY_CSS_PATTERN, INLINE_STYLE_DISPLAY_NONE_PATTERN, compositionRules, CLIP_MEDIA_TAGS, SCENE_BOUNDARY_EPSILON_SECONDS, UNRESOLVED_TARGET, gsapWindowsCache, CONFLICTING_TRANSLATE_PROPS, CONFLICTING_SCALE_PROPS, RELATIVE_TWEEN_VALUE, TRANSFORM_SENSITIVE_READ, TRANSFORM_INVARIANT_READ, CALLBACK_MEASUREMENT_PATTERN, NUMBER_METHODS, gsapRules, captionRules, adapterRules, TEXTURE_BASE_CLASS, TEXTURE_CLASS_PREFIX, textureRules, GENERIC_FAMILIES, fontRules, slideshowRules, INLINE_TEXT_TAGS, OPAQUE_TAGS, NON_LAYOUT_TAGS, MEDIA_TAGS2, NODE_ATTRS, describe, structureRules, RULE_GROUPS, LINT_RULE_COUNT, LINT_RULE_GROUP_COUNTS;
75327
+ var import_postcss_selector_parser, COMPOSITION_ID_IN_CSS_PATTERN, TIMELINE_REGISTRY_INIT_PATTERN, TIMELINE_REGISTRY_OBJECT_LITERAL_PATTERN, TIMELINE_REGISTRY_ASSIGN_PATTERN, WINDOW_TIMELINE_ASSIGN_PATTERN, INVALID_SCRIPT_CLOSE_PATTERN, TIMELINE_REGISTRY_KEY_PATTERN, TIMELINE_REGISTRY_OBJECT_OPEN_PATTERN, TIMELINE_REGISTRY_OBJECT_ENTRY_PATTERN, REGEX_ALLOWED_BEFORE, REGEX_ALLOWED_KEYWORDS, WORD_CHAR, CodeContext, VISIBLE_MARKUP_COMMENT_PATTERN, VISIBLE_MARKUP_COMMENT_PROTECTED_BLOCK_PATTERN, coreRules, IMAGE_SRC_EXT, VIDEO_SRC_EXT, AUDIO_SRC_EXT, SRC_KIND_NOUN, mediaRules, AUDIO_GROUP_TIMING_ATTRS, callIndexes, INSPECTION_VIEWPORT_CAP, MAX_COMPOSITION_LINES, MAX_TIMED_ELEMENTS_PER_TRACK, TRACK_DENSITY_EXEMPT_TAGS, CAPTION_CUE_TOKEN, HEAVY_OVERLAY_ELEMENT_COUNT_WARN, HEAVY_OVERLAY_EXEMPT_TAGS, HEAVY_OVERLAY_CSS_PATTERN, INLINE_STYLE_DISPLAY_NONE_PATTERN, ZOOM_DECLARATION, NEGATIVE_Z_INDEX, compositionRules, CLIP_MEDIA_TAGS, SCENE_BOUNDARY_EPSILON_SECONDS, UNRESOLVED_TARGET, gsapWindowsCache, CONFLICTING_TRANSLATE_PROPS, CONFLICTING_SCALE_PROPS, RELATIVE_TWEEN_VALUE, TRANSFORM_SENSITIVE_READ, TRANSFORM_INVARIANT_READ, CALLBACK_MEASUREMENT_PATTERN, NUMBER_METHODS, gsapRules, captionRules, adapterRules, TEXTURE_BASE_CLASS, TEXTURE_CLASS_PREFIX, textureRules, GENERIC_FAMILIES, fontRules, slideshowRules, INLINE_TEXT_TAGS, OPAQUE_TAGS, NON_LAYOUT_TAGS, MEDIA_TAGS2, NODE_ATTRS, describe, structureRules, RULE_GROUPS, LINT_RULE_COUNT, LINT_RULE_GROUP_COUNTS;
75177
75328
  var init_dist3 = __esm({
75178
75329
  "../lint/dist/index.js"() {
75179
75330
  "use strict";
@@ -76054,6 +76205,7 @@ var init_dist3 = __esm({
76054
76205
  ];
76055
76206
  AUDIO_GROUP_TIMING_ATTRS = ["data-start", "data-duration", "data-track-index"];
76056
76207
  callIndexes = /* @__PURE__ */ new WeakMap();
76208
+ INSPECTION_VIEWPORT_CAP = 4096;
76057
76209
  MAX_COMPOSITION_LINES = 300;
76058
76210
  MAX_TIMED_ELEMENTS_PER_TRACK = 3;
76059
76211
  TRACK_DENSITY_EXEMPT_TAGS = /* @__PURE__ */ new Set(["audio", "script", "style", "video"]);
@@ -76079,6 +76231,8 @@ var init_dist3 = __esm({
76079
76231
  ]);
76080
76232
  HEAVY_OVERLAY_CSS_PATTERN = /(?:filter\s*:[^;}]*\bblur\s*\()|(?:clip-path\s*:(?!\s*(?:none|inherit|initial|unset)\b)\s*[^;}]+)|(?:radial-gradient\s*\()/i;
76081
76233
  INLINE_STYLE_DISPLAY_NONE_PATTERN = /(?:^|;)\s*display\s*:\s*none\b/i;
76234
+ ZOOM_DECLARATION = /(?<![\w-])zoom\s*:\s*([^;}]+)/gi;
76235
+ NEGATIVE_Z_INDEX = /(?<![\w-])z-index\s*:\s*-(?!0(?:\s*[;}]|\s*$))([\d.]+)/g;
76082
76236
  compositionRules = [
76083
76237
  // duplicate_composition_id catches meta-tag/root collisions that create duplicate composition entries.
76084
76238
  ({ tags }) => {
@@ -76369,6 +76523,59 @@ var init_dist3 = __esm({
76369
76523
  }
76370
76524
  ];
76371
76525
  },
76526
+ // negative_z_index
76527
+ // An element at a negative z-index is silently absent from both `snapshot`
76528
+ // and `render`, while siblings differing only in the sign of z-index render
76529
+ // exactly (heygen-com/hyperframes#4366). lint, validate and render all exit 0
76530
+ // and report nothing, so the first suspicion falls on the author's own CSS.
76531
+ // NOT A RENDERER DEFECT -- ORDINARY CSS PAINTING ORDER, measured at 0.8.72.
76532
+ // The element is PAINTED; it is simply painted beneath something opaque. Remove
76533
+ // every opaque background above it and the same `z-index: -1` band renders at
76534
+ // full coverage, identically to the same band with `z-index` deleted. A negative-z
76535
+ // descendant paints at step 2 of its nearest stacking context -- above that
76536
+ // context root's own background, but below the context's positioned in-flow
76537
+ // content -- so a `position: relative` composition root with an opaque background
76538
+ // paints over it. That is the shape #4366 reports; nothing is dropped and the
76539
+ // renderer has no say in it.
76540
+ //
76541
+ // Kept as a warning because authors hit it and nothing explains why: the element
76542
+ // is in the DOM, laid out, and invisible. The message therefore names the CAUSE
76543
+ // and the remedy rather than implying the tool failed.
76544
+ //
76545
+ // THE CONDITION IS LOAD-BEARING AND THE MESSAGE STATES IT. The element is only
76546
+ // dropped when its nearest ancestor stacking context is the composition root,
76547
+ // which is the shape #4366 reports. Give any ancestor a stacking context and it
76548
+ // renders correctly: measured at 0.8.72 on ONE frame carrying the same
76549
+ // `z-index: -1` band under six triggers -- isolation:isolate, transform,
76550
+ // opacity below 1, filter, contain:paint, will-change -- all six PRESENT at full
76551
+ // coverage, against the no-stacking-context control ABSENT at zero coverage.
76552
+ // That is ordinary CSS painting order: a negative-z child paints above its
76553
+ // stacking context root's own background, so only the root case is hidden.
76554
+ //
76555
+ // This rule matches CSS TEXT and does not resolve the cascade, so it cannot know
76556
+ // whether an ancestor forms a stacking context and fires on both shapes. That is
76557
+ // why the message is CONDITIONAL rather than an assertion of absence: an
76558
+ // unconditional "silently dropped" is false for every isolated case, and a lint
76559
+ // message that overclaims is how authors learn to disregard the rule.
76560
+ ({ tags, styles }) => {
76561
+ const findings = [];
76562
+ for (const style of styles) {
76563
+ const content = stripCssComments(style.content);
76564
+ NEGATIVE_Z_INDEX.lastIndex = 0;
76565
+ let match;
76566
+ while ((match = NEGATIVE_Z_INDEX.exec(content)) !== null) {
76567
+ findings.push(negativeZIndexFinding(match, cssOwnerSelector(content, match.index)));
76568
+ }
76569
+ }
76570
+ for (const tag of tags) {
76571
+ const inline = readAttr(tag.raw, "style");
76572
+ if (!inline) continue;
76573
+ NEGATIVE_Z_INDEX.lastIndex = 0;
76574
+ const match = NEGATIVE_Z_INDEX.exec(inline);
76575
+ if (match) findings.push(negativeZIndexFinding(match, elementSelector(tag)));
76576
+ }
76577
+ return findings;
76578
+ },
76372
76579
  // requestanimationframe_in_composition
76373
76580
  ({ scripts, rawSource, options }) => {
76374
76581
  if (isRegistrySourceFile(options.filePath) || isRegistryInstalledFile(rawSource)) return [];
@@ -76788,6 +76995,96 @@ ${allInlineStyles}`.replace(/\/\*[\s\S]*?\*\//g, "");
76788
76995
  fixHint: `${splitTarget} and concat the pieces (FFmpeg or the runtime's slideshow) so each capture only sees a small subset of heavy overlays at once. Even hidden overlays (opacity:0 / visibility:hidden) contribute \u2014 either remove truly unused ones from the source or scope them into their own per-transition sub-composition. If an overlay is genuinely inert for the whole clip, use display:none so it never enters the render tree. Field ref ts=1784040753 (#hyperframes-cli-feedback).`
76789
76996
  }
76790
76997
  ];
76998
+ },
76999
+ // root_zoom_rescales_a_fixed_canvas
77000
+ //
77001
+ // The capture frame is sized from the root's data-width/data-height, which are
77002
+ // LAYOUT pixels. CSS `zoom` on the canvas itself (the root, or html/body above
77003
+ // it) rescales the painted content inside that frame without changing the frame,
77004
+ // so the two disagree and the author gets neither of the two things they might
77005
+ // have meant.
77006
+ //
77007
+ // Measured at 0.8.71 on an 800x400 composition holding two 100x100 boxes at
77008
+ // left:100 and left:600, rendered to a PNG sequence and the boxes located by
77009
+ // colour:
77010
+ //
77011
+ // root zoom:0.5 canvas stays 800x400; boxes paint at (50,25) and (300,25),
77012
+ // each 50x50 -- the composition occupies the top-left quarter
77013
+ // and the rest of every frame is dead space.
77014
+ // root zoom:2 canvas stays 800x400; the left:100 box paints at (200,100)
77015
+ // at 200x200, and the left:600 box renders ZERO PIXELS --
77016
+ // scaled to x=1200, outside a frame that is still 800 wide.
77017
+ //
77018
+ // The second case is the one worth an error: content that is inside the declared
77019
+ // composition silently does not exist in the output, with nothing else in lint,
77020
+ // check or the render log naming it.
77021
+ //
77022
+ // Deliberately NOT flagged: `zoom` on a descendant. Measured in the same run --
77023
+ // a child at left:100 with zoom:2 paints at (200,100) at 200x200, which is
77024
+ // exactly what CSS `zoom` specifies. It is honoured, not ignored, so a rule that
77025
+ // fired on every `zoom` would be flagging correct authoring.
77026
+ ({ rootTag, tags, styles }) => {
77027
+ if (!rootTag) return [];
77028
+ const rootId = readAttr(rootTag.raw, "id");
77029
+ const rootClasses = (readAttr(rootTag.raw, "class") || "").split(/\s+/).filter(Boolean);
77030
+ const hits = canvasZoomHits(rootTag, tags, styles, rootId, rootClasses);
77031
+ const hit = hits[0];
77032
+ if (!hit) return [];
77033
+ const enlarging = !hit.value.startsWith("-") && parseFloat(hit.value) > (hit.value.includes("%") ? 100 : 1);
77034
+ return [
77035
+ {
77036
+ code: "root_zoom_rescales_a_fixed_canvas",
77037
+ severity: "error",
77038
+ message: `\`zoom: ${hit.value}\` on ${hit.where} rescales the painted composition inside a frame that does not rescale with it. The capture frame is sized from the root's data-width/data-height in LAYOUT pixels, and \`zoom\` changes only what is painted inside it, so ` + (enlarging ? `content past the frame's edge renders zero pixels \u2014 it is inside the declared composition and absent from the output, with nothing else reporting it.` : `the composition paints into part of the frame and the remainder of every output frame is dead space.`),
77039
+ fixHint: `Author the composition at its real size \u2014 set data-width/data-height (and the root's width/height) to the dimensions you want \u2014 and drop the canvas-level \`zoom\`. To scale the OUTPUT without changing layout, pass \`--output-resolution\` to render, which supersamples. \`zoom\` on descendants is fine and is not flagged: it is honoured exactly as specified.`,
77040
+ snippet: hit.snippet
77041
+ }
77042
+ ];
77043
+ },
77044
+ // composition_exceeds_inspection_viewport_cap
77045
+ //
77046
+ // packages/cli/src/utils/compositionViewport.ts caps a parsed data-width /
77047
+ // data-height at MAX_VIEWPORT_DIMENSION (4096) with a plain Math.min and no
77048
+ // warning. captureCompositionFrame resolves its viewport through that helper,
77049
+ // and check, validate, snapshot, compare and layout all capture through it;
77050
+ // layout and motionShot carry their own independent Math.min(..., 4096).
77051
+ //
77052
+ // `render` does NOT go through it, and that asymmetry is the whole finding.
77053
+ // Measured at 0.8.71 on a 5000x400 composition with 100x100 boxes at left:100
77054
+ // and left:4500:
77055
+ //
77056
+ // render -> 5000x400 output, both boxes present.
77057
+ // snapshot -> 4096x400 frame, the left:4500 box ABSENT.
77058
+ //
77059
+ // So the video is correct and the tools an author would reach for to check it
77060
+ // silently cannot see the last 904 px. The failure direction is the awkward
77061
+ // one: `check` comes back clean on a region it never rendered, and someone
77062
+ // debugging a missing element through `snapshot` chases a difference that
77063
+ // exists only in the instrument.
77064
+ //
77065
+ // A warning, not an error: the deliverable is fine, and a composition wider
77066
+ // than 4096 can be entirely deliberate.
77067
+ ({ rootTag }) => {
77068
+ if (!rootTag) return [];
77069
+ const over = [];
77070
+ for (const attr of ["data-width", "data-height"]) {
77071
+ const raw = readAttr(rootTag.raw, attr);
77072
+ if (!raw) continue;
77073
+ const value = Number.parseInt(raw, 10);
77074
+ if (Number.isFinite(value) && value > INSPECTION_VIEWPORT_CAP) {
77075
+ over.push(`${attr}=${value}`);
77076
+ }
77077
+ }
77078
+ if (over.length === 0) return [];
77079
+ return [
77080
+ {
77081
+ code: "composition_exceeds_inspection_viewport_cap",
77082
+ severity: "warning",
77083
+ message: `${over.join(" and ")} exceeds the ${INSPECTION_VIEWPORT_CAP}px viewport cap that check, validate, snapshot, compare and layout clamp to. render is unaffected and produces the full size, so the video is correct \u2014 but every inspection command captures a ${INSPECTION_VIEWPORT_CAP}px-wide frame, and anything beyond that is missing from what they report. Measured at 0.8.71: a 5000x400 composition renders 5000x400 with all content, while snapshot returns 4096x400 with the element at left:4500 absent.`,
77084
+ fixHint: `Keep the authored size if the output needs it, and verify the region past ${INSPECTION_VIEWPORT_CAP}px from a render rather than from check/snapshot/compare \u2014 a clean inspection result does not cover it. If the large canvas is only there to gain resolution, author at the layout size and pass \`--output-resolution\` to render instead, which supersamples without changing layout.`,
77085
+ snippet: truncateSnippet(rootTag.raw)
77086
+ }
77087
+ ];
76791
77088
  }
76792
77089
  ];
76793
77090
  CLIP_MEDIA_TAGS = /* @__PURE__ */ new Set(["img", "video", "audio"]);
@@ -78900,7 +79197,7 @@ var init_htmlTemplate = __esm({
78900
79197
 
78901
79198
  // ../engine/src/services/extractedFrameIndex.ts
78902
79199
  import { readdirSync as readdirSync4 } from "fs";
78903
- import { join as join10 } from "path";
79200
+ import { join as join11 } from "path";
78904
79201
  function extractedFrameIndex(file, format) {
78905
79202
  const match = new RegExp(`^${FRAME_FILENAME_PREFIX}(\\d+)\\.${format}$`).exec(file);
78906
79203
  if (!match) {
@@ -78923,7 +79220,7 @@ function framePathsFromDirectory(outputDir, format) {
78923
79220
  `Duplicate extracted frame index ${index}: ${indexed.get(index)} and ${file}`
78924
79221
  );
78925
79222
  }
78926
- indexed.set(index, join10(outputDir, file));
79223
+ indexed.set(index, join11(outputDir, file));
78927
79224
  }
78928
79225
  const ordered = /* @__PURE__ */ new Map();
78929
79226
  for (let index = 0; index < indexed.size; index += 1) {
@@ -78964,7 +79261,7 @@ import {
78964
79261
  utimesSync,
78965
79262
  writeFileSync as writeFileSync3
78966
79263
  } from "fs";
78967
- import { join as join11 } from "path";
79264
+ import { join as join12 } from "path";
78968
79265
  function readKeyStat(videoPath) {
78969
79266
  try {
78970
79267
  const stat = statSync5(videoPath);
@@ -79002,8 +79299,8 @@ function hasFrameFiles(dir) {
79002
79299
  }
79003
79300
  function lookupCacheEntry(rootDir, input) {
79004
79301
  const keyHash = computeCacheKey(input);
79005
- const dir = join11(rootDir, cacheEntryDirName(keyHash));
79006
- const complete = existsSync10(join11(dir, COMPLETE_SENTINEL)) && hasFrameFiles(dir);
79302
+ const dir = join12(rootDir, cacheEntryDirName(keyHash));
79303
+ const complete = existsSync10(join12(dir, COMPLETE_SENTINEL)) && hasFrameFiles(dir);
79007
79304
  return { entry: { dir, keyHash }, hit: complete };
79008
79305
  }
79009
79306
  function partialCacheEntryDir(entry) {
@@ -79014,13 +79311,13 @@ function isTargetExistsRenameError(err) {
79014
79311
  return code === "EEXIST" || code === "ENOTEMPTY" || code === "EPERM";
79015
79312
  }
79016
79313
  function adoptPublishedWinner(entry, partialDir) {
79017
- if (!existsSync10(join11(entry.dir, COMPLETE_SENTINEL))) return null;
79314
+ if (!existsSync10(join12(entry.dir, COMPLETE_SENTINEL))) return null;
79018
79315
  removeDir(partialDir);
79019
79316
  return { dir: entry.dir, published: true };
79020
79317
  }
79021
79318
  function publishCacheEntry(entry, partialDir) {
79022
79319
  try {
79023
- writeFileSync3(join11(partialDir, COMPLETE_SENTINEL), "", "utf-8");
79320
+ writeFileSync3(join12(partialDir, COMPLETE_SENTINEL), "", "utf-8");
79024
79321
  } catch {
79025
79322
  return { dir: partialDir, published: false };
79026
79323
  }
@@ -79051,7 +79348,7 @@ function touchCacheDir(dir) {
79051
79348
  } catch {
79052
79349
  }
79053
79350
  try {
79054
- utimesSync(join11(dir, COMPLETE_SENTINEL), now, now);
79351
+ utimesSync(join12(dir, COMPLETE_SENTINEL), now, now);
79055
79352
  } catch {
79056
79353
  }
79057
79354
  }
@@ -79079,7 +79376,7 @@ function directorySizeBytes(path) {
79079
79376
  return 0;
79080
79377
  }
79081
79378
  for (const child of children) {
79082
- const childPath = join11(path, child);
79379
+ const childPath = join12(path, child);
79083
79380
  try {
79084
79381
  const stat = lstatSync3(childPath);
79085
79382
  if (stat.isDirectory()) {
@@ -79108,7 +79405,7 @@ function collectGcEntry(dir, name, now, minAgeMs, stats) {
79108
79405
  }
79109
79406
  let lastUseMs = dirStat.mtimeMs;
79110
79407
  try {
79111
- lastUseMs = statSync5(join11(dir, COMPLETE_SENTINEL)).mtimeMs;
79408
+ lastUseMs = statSync5(join12(dir, COMPLETE_SENTINEL)).mtimeMs;
79112
79409
  } catch {
79113
79410
  }
79114
79411
  return { dir, size: directorySizeBytes(dir), lastUseMs, ageMs: now - lastUseMs };
@@ -79118,7 +79415,7 @@ function collectGcEntry(dir, name, now, minAgeMs, stats) {
79118
79415
  }
79119
79416
  function gcSweepDue(rootDir, maxAgeMs) {
79120
79417
  try {
79121
- return Date.now() - statSync5(join11(rootDir, GC_MARKER)).mtimeMs > maxAgeMs;
79418
+ return Date.now() - statSync5(join12(rootDir, GC_MARKER)).mtimeMs > maxAgeMs;
79122
79419
  } catch {
79123
79420
  return true;
79124
79421
  }
@@ -79126,7 +79423,7 @@ function gcSweepDue(rootDir, maxAgeMs) {
79126
79423
  function gcExtractionCache(rootDir, opts) {
79127
79424
  const stats = { evictedEntries: 0, evictedBytes: 0, agedPartialsRemoved: 0 };
79128
79425
  try {
79129
- writeFileSync3(join11(rootDir, GC_MARKER), "", "utf-8");
79426
+ writeFileSync3(join12(rootDir, GC_MARKER), "", "utf-8");
79130
79427
  } catch {
79131
79428
  }
79132
79429
  try {
@@ -79135,7 +79432,7 @@ function gcExtractionCache(rootDir, opts) {
79135
79432
  for (const child of readdirSync5(rootDir, { withFileTypes: true })) {
79136
79433
  if (!child.isDirectory() || !isCacheLikeChild(child.name)) continue;
79137
79434
  const entry = collectGcEntry(
79138
- join11(rootDir, child.name),
79435
+ join12(rootDir, child.name),
79139
79436
  child.name,
79140
79437
  now,
79141
79438
  opts.minAgeMs,
@@ -79188,7 +79485,7 @@ var init_extractionCache = __esm({
79188
79485
 
79189
79486
  // ../engine/src/services/videoFrameExtractor.ts
79190
79487
  import { copyFileSync as copyFileSync2, existsSync as existsSync11, linkSync as linkSync2, mkdirSync as mkdirSync6, rmSync as rmSync3 } from "fs";
79191
- import { join as join12 } from "path";
79488
+ import { join as join13 } from "path";
79192
79489
  function isVideoFrameFormat(value) {
79193
79490
  return typeof value === "string" && VIDEO_FRAME_FORMATS.includes(value);
79194
79491
  }
@@ -79534,7 +79831,7 @@ async function extractVideoFramesRange(videoPath, videoId, startTime, duration,
79534
79831
  const normalizedFps = toFps(options.fps);
79535
79832
  const fps = fpsToNumber(normalizedFps);
79536
79833
  const ffmpegFps = fpsToFfmpegArg(normalizedFps);
79537
- const videoOutputDir = outputDirOverride ?? join12(outputDir, videoId);
79834
+ const videoOutputDir = outputDirOverride ?? join13(outputDir, videoId);
79538
79835
  if (!existsSync11(videoOutputDir)) mkdirSync6(videoOutputDir, { recursive: true });
79539
79836
  let metadata;
79540
79837
  try {
@@ -79561,7 +79858,7 @@ async function extractVideoFramesRange(videoPath, videoId, startTime, duration,
79561
79858
  }
79562
79859
  const format = resolveFrameFormat(metadata, options.format);
79563
79860
  const framePattern = `${FRAME_FILENAME_PREFIX}%05d.${format}`;
79564
- const outputPattern = join12(videoOutputDir, framePattern);
79861
+ const outputPattern = join13(videoOutputDir, framePattern);
79565
79862
  const isHdr = isHdrColorSpace(metadata.colorSpace);
79566
79863
  const isMacOS = process.platform === "darwin";
79567
79864
  const args = [];
@@ -79994,7 +80291,7 @@ function sliceSupersetMember(member, superset, outputDir, fps, configuredFps) {
79994
80291
  for (let i = 0; i < frameCount; i += 1) {
79995
80292
  const sourceFrame = superset.framePaths.get(member.offsetFrames + i);
79996
80293
  if (!sourceFrame) throw new Error(`superset frame ${member.offsetFrames + i} missing`);
79997
- linkOrCopyFrame(sourceFrame, join12(outputDir, frameFileName(i + 1, work.format)));
80294
+ linkOrCopyFrame(sourceFrame, join13(outputDir, frameFileName(i + 1, work.format)));
79998
80295
  }
79999
80296
  return extractedFramesFromDirectory(work, outputDir, work.videoPath, fps);
80000
80297
  }
@@ -80043,7 +80340,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
80043
80340
  videoPath = resolveProjectRelativeSrc(video.src, baseDir, compiledDir);
80044
80341
  }
80045
80342
  if (isHttpUrl(videoPath)) {
80046
- const downloadDir = join12(options.outputDir, "_downloads");
80343
+ const downloadDir = join13(options.outputDir, "_downloads");
80047
80344
  mkdirSync6(downloadDir, { recursive: true });
80048
80345
  videoPath = await downloadToTemp(
80049
80346
  videoPath,
@@ -80254,7 +80551,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
80254
80551
  async function extractDirectMiss(miss, maxTransientRetries = options.maxTransientRetries ?? 0) {
80255
80552
  const { work, cacheTarget } = miss;
80256
80553
  if (!cacheTarget) {
80257
- const outputDir = join12(options.outputDir, work.video.id);
80554
+ const outputDir = join13(options.outputDir, work.video.id);
80258
80555
  const attempted2 = await runVideoExtractionWithRetry(
80259
80556
  () => extractVideoFramesRange(
80260
80557
  work.videoPath,
@@ -80322,7 +80619,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
80322
80619
  return sliceSupersetMember(
80323
80620
  member,
80324
80621
  superset,
80325
- join12(options.outputDir, work.video.id),
80622
+ join13(options.outputDir, work.video.id),
80326
80623
  fps,
80327
80624
  configuredFps
80328
80625
  );
@@ -80339,7 +80636,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
80339
80636
  async function executeSupersetGroup(group) {
80340
80637
  const first = group.members[0]?.miss.work;
80341
80638
  if (!first) return [];
80342
- const tempDir = cacheRootDir ? join12(cacheRootDir, `${group.groupId}.partial-${process.pid}`) : join12(options.outputDir, group.groupId);
80639
+ const tempDir = cacheRootDir ? join13(cacheRootDir, `${group.groupId}.partial-${process.pid}`) : join13(options.outputDir, group.groupId);
80343
80640
  try {
80344
80641
  rmSync3(tempDir, { recursive: true, force: true });
80345
80642
  const superset = await extractVideoFramesRange(
@@ -80719,7 +81016,7 @@ var init_videoFrameExtractor = __esm({
80719
81016
 
80720
81017
  // ../engine/src/services/videoFrameInjector.ts
80721
81018
  import { promises as fs } from "fs";
80722
- import { dirname as dirname7 } from "path";
81019
+ import { dirname as dirname8 } from "path";
80723
81020
  function createFrameSourceCache(entryLimit, bytesLimit, frameSrcResolver) {
80724
81021
  const cache2 = /* @__PURE__ */ new Map();
80725
81022
  const inFlight = /* @__PURE__ */ new Map();
@@ -80801,7 +81098,7 @@ function createVideoFrameInjector(frameLookup, config) {
80801
81098
  const lastInjectedFrameByVideo = /* @__PURE__ */ new Map();
80802
81099
  const lastCacheTouchByDir = /* @__PURE__ */ new Map();
80803
81100
  function renewCacheLease(framePath) {
80804
- const cacheDir = dirname7(framePath);
81101
+ const cacheDir = dirname8(framePath);
80805
81102
  const now = Date.now();
80806
81103
  const lastTouch = lastCacheTouchByDir.get(cacheDir);
80807
81104
  if (lastTouch !== void 0 && now - lastTouch < CACHE_TOUCH_THROTTLE_MS) return;
@@ -81344,8 +81641,8 @@ var init_wavChunks = __esm({
81344
81641
  });
81345
81642
 
81346
81643
  // ../engine/src/services/audioVolumeEnvelope.ts
81347
- import { mkdtempSync as mkdtempSync3, readFileSync as readFileSync4, renameSync as renameSync2, rmSync as rmSync4, writeFileSync as writeFileSync4 } from "fs";
81348
- import { dirname as dirname8, join as join13 } from "path";
81644
+ import { mkdtempSync as mkdtempSync3, readFileSync as readFileSync5, renameSync as renameSync2, rmSync as rmSync4, writeFileSync as writeFileSync4 } from "fs";
81645
+ import { dirname as dirname9, join as join14 } from "path";
81349
81646
  function readFmtChunk(buffer, body, size) {
81350
81647
  const format = wavFormatTag(buffer, body, size);
81351
81648
  const bits = buffer.readUInt16LE(body + 14);
@@ -81413,12 +81710,12 @@ function applyVolumeEnvelopeToWav(wavPath, keyframes, trackStart, baseVolume) {
81413
81710
  if (!gainAt) return false;
81414
81711
  let stagingDir;
81415
81712
  try {
81416
- const buffer = readFileSync4(wavPath);
81713
+ const buffer = readFileSync5(wavPath);
81417
81714
  const layout2 = parseWavLayout(buffer);
81418
81715
  if (!layout2) return false;
81419
81716
  scaleSamples(buffer, layout2, gainAt);
81420
- stagingDir = mkdtempSync3(join13(dirname8(wavPath), ".hf-volume-"));
81421
- const tempPath = join13(stagingDir, "audio.wav");
81717
+ stagingDir = mkdtempSync3(join14(dirname9(wavPath), ".hf-volume-"));
81718
+ const tempPath = join14(stagingDir, "audio.wav");
81422
81719
  writeFileSync4(tempPath, buffer, { flag: "wx" });
81423
81720
  renameSync2(tempPath, wavPath);
81424
81721
  return true;
@@ -81519,9 +81816,9 @@ var init_audio_fx_runtime_inline = __esm({
81519
81816
  });
81520
81817
 
81521
81818
  // ../engine/src/services/audioFxRender.ts
81522
- import { existsSync as existsSync12, mkdtempSync as mkdtempSync4, readFileSync as readFileSync5, rmSync as rmSync5, writeFileSync as writeFileSync5 } from "fs";
81819
+ import { existsSync as existsSync12, mkdtempSync as mkdtempSync4, readFileSync as readFileSync6, rmSync as rmSync5, writeFileSync as writeFileSync5 } from "fs";
81523
81820
  import { tmpdir as tmpdir2 } from "os";
81524
- import { join as join14 } from "path";
81821
+ import { join as join15 } from "path";
81525
81822
  import { pathToFileURL } from "url";
81526
81823
  function readWavChunks(buf) {
81527
81824
  const head = { format: 1, channels: 1, sampleRate: 48e3, bits: 16 };
@@ -81542,7 +81839,7 @@ function readWavChunks(buf) {
81542
81839
  return { ...head, data: data2 };
81543
81840
  }
81544
81841
  function readWav(path) {
81545
- const buf = readFileSync5(path);
81842
+ const buf = readFileSync6(path);
81546
81843
  if (buf.length < 44 || buf.toString("ascii", 0, 4) !== "RIFF") {
81547
81844
  throw new AudioFxRenderError(`Not a WAV file: ${path}`);
81548
81845
  }
@@ -81636,7 +81933,7 @@ async function applyAudioFxChain(inputWav, chain, outputWav, options) {
81636
81933
  const { samples, sampleRate, channels, float } = readWav(inputWav);
81637
81934
  const planes = deinterleave(samples, channels);
81638
81935
  if ((planes[0]?.length ?? 0) === 0) return { path: inputWav, envelopeBaked: false };
81639
- const hostDir = mkdtempSync4(join14(tmpdir2(), "hf-fx-host-"));
81936
+ const hostDir = mkdtempSync4(join15(tmpdir2(), "hf-fx-host-"));
81640
81937
  let lease = null;
81641
81938
  try {
81642
81939
  if (options.signal?.aborted) {
@@ -81645,7 +81942,7 @@ async function applyAudioFxChain(inputWav, chain, outputWav, options) {
81645
81942
  lease = await acquireBrowser(["--no-sandbox", "--autoplay-policy=no-user-gesture-required"]);
81646
81943
  const page = await lease.browser.newPage();
81647
81944
  try {
81648
- const hostPage = join14(hostDir, "audio-fx.html");
81945
+ const hostPage = join15(hostDir, "audio-fx.html");
81649
81946
  writeFileSync5(hostPage, "<!doctype html><meta charset=utf-8><title>audio fx</title>");
81650
81947
  await page.goto(pathToFileURL(hostPage).href, { waitUntil: "domcontentloaded" });
81651
81948
  await page.addScriptTag({ content: getAudioFxRuntimeScript() });
@@ -81782,7 +82079,7 @@ var init_audioFxRender = __esm({
81782
82079
 
81783
82080
  // ../engine/src/services/audioMixer.ts
81784
82081
  import { closeSync as closeSync3, existsSync as existsSync13, mkdirSync as mkdirSync7, mkdtempSync as mkdtempSync5, openSync as openSync3, rmSync as rmSync6, writeFileSync as writeFileSync6 } from "fs";
81785
- import { join as join15, dirname as dirname9, isAbsolute as isAbsolute2, relative as relative2 } from "path";
82082
+ import { join as join16, dirname as dirname10, isAbsolute as isAbsolute2, relative as relative2 } from "path";
81786
82083
  function memberGroupKey(el) {
81787
82084
  return el.getAttribute(AUDIO_GROUP_RENDER_ID_ATTR) ?? el.getAttribute(HF_AUDIO_GROUP_ATTR);
81788
82085
  }
@@ -82139,7 +82436,7 @@ function parseAudioElements(html) {
82139
82436
  }
82140
82437
  async function extractAudioFromVideo(videoPath, outputPath, options, signal, config) {
82141
82438
  const ffmpegProcessTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG.ffmpegProcessTimeout;
82142
- const outputDir = dirname9(outputPath);
82439
+ const outputDir = dirname10(outputPath);
82143
82440
  if (!existsSync13(outputDir)) mkdirSync7(outputDir, { recursive: true });
82144
82441
  const playbackRate = normalizeRateSpec(options?.playbackRate);
82145
82442
  const args = [];
@@ -82185,7 +82482,7 @@ async function extractAudioFromVideo(videoPath, outputPath, options, signal, con
82185
82482
  }
82186
82483
  async function prepareAudioTrack(srcPath, outputPath, mediaStart, duration, playbackRate = 1, signal, config) {
82187
82484
  const ffmpegProcessTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG.ffmpegProcessTimeout;
82188
- const outputDir = dirname9(outputPath);
82485
+ const outputDir = dirname10(outputPath);
82189
82486
  if (!existsSync13(outputDir)) mkdirSync7(outputDir, { recursive: true });
82190
82487
  const normalizedPlaybackRate = normalizeRateSpec(playbackRate);
82191
82488
  const outputArgs = await preparedAudioOutputArgs(srcPath, normalizedPlaybackRate, duration);
@@ -82232,7 +82529,7 @@ async function prepareAudioTrack(srcPath, outputPath, mediaStart, duration, play
82232
82529
  }
82233
82530
  async function generateSilence(outputPath, duration, signal, config) {
82234
82531
  const ffmpegProcessTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG.ffmpegProcessTimeout;
82235
- const outputDir = dirname9(outputPath);
82532
+ const outputDir = dirname10(outputPath);
82236
82533
  if (!existsSync13(outputDir)) mkdirSync7(outputDir, { recursive: true });
82237
82534
  const args = [
82238
82535
  "-f",
@@ -82286,7 +82583,7 @@ async function mixAudioTracks(tracks, outputPath, totalDuration, signal, config)
82286
82583
  failures: result2.failure ? [result2.failure] : void 0
82287
82584
  };
82288
82585
  }
82289
- const outputDir = dirname9(outputPath);
82586
+ const outputDir = dirname10(outputPath);
82290
82587
  if (!existsSync13(outputDir)) mkdirSync7(outputDir, { recursive: true });
82291
82588
  const buildFilterComplex = (ignoreAutomation) => {
82292
82589
  const filterParts = [];
@@ -82303,8 +82600,8 @@ async function mixAudioTracks(tracks, outputPath, totalDuration, signal, config)
82303
82600
  const runMix = async (ignoreAutomation) => {
82304
82601
  const inputs = [];
82305
82602
  tracks.forEach((track) => inputs.push("-i", track.srcPath));
82306
- const scriptDir = mkdtempSync5(join15(outputDir, ".filter-complex-"));
82307
- const scriptPath = join15(scriptDir, "graph.txt");
82603
+ const scriptDir = mkdtempSync5(join16(outputDir, ".filter-complex-"));
82604
+ const scriptPath = join16(scriptDir, "graph.txt");
82308
82605
  const fd = openSync3(scriptPath, "wx", 384);
82309
82606
  try {
82310
82607
  writeFileSync6(fd, buildFilterComplex(ignoreAutomation));
@@ -82390,7 +82687,7 @@ function groupNormalizeOptionUnsupported(stderr) {
82390
82687
  }
82391
82688
  async function mixGroupMembers(memberTracks, outputPath, totalDuration, signal, config) {
82392
82689
  const ffmpegProcessTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG.ffmpegProcessTimeout;
82393
- const outputDir = dirname9(outputPath);
82690
+ const outputDir = dirname10(outputPath);
82394
82691
  if (!existsSync13(outputDir)) mkdirSync7(outputDir, { recursive: true });
82395
82692
  const buildInputFilters = (ignoreKeyframes) => memberTracks.map((track, i) => {
82396
82693
  const volumeFilter = buildVolumeExpression(track, ignoreKeyframes);
@@ -82408,8 +82705,8 @@ async function mixGroupMembers(memberTracks, outputPath, totalDuration, signal,
82408
82705
  `${mixInputs}amix=inputs=${memberTracks.length}:duration=longest:dropout_transition=0[mixed];[mixed]volume=${formatFilterNumber(memberTracks.length)}[out]`
82409
82706
  );
82410
82707
  const filterComplex = [...inputFilters, mixFilter].join(";");
82411
- const scriptDir = mkdtempSync5(join15(outputDir, ".group-filter-complex-"));
82412
- const scriptPath = join15(scriptDir, "graph.txt");
82708
+ const scriptDir = mkdtempSync5(join16(outputDir, ".group-filter-complex-"));
82709
+ const scriptPath = join16(scriptDir, "graph.txt");
82413
82710
  const fd = openSync3(scriptPath, "wx", 384);
82414
82711
  try {
82415
82712
  writeFileSync6(fd, filterComplex);
@@ -82562,7 +82859,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
82562
82859
  }
82563
82860
  let audioSrcPath = srcPath;
82564
82861
  if (element.type === "video") {
82565
- const extractedPath = join15(workDir, `${element.id}-extracted.wav`);
82862
+ const extractedPath = join16(workDir, `${element.id}-extracted.wav`);
82566
82863
  const extractResult = await extractAudioFromVideo(
82567
82864
  srcPath,
82568
82865
  extractedPath,
@@ -82589,7 +82886,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
82589
82886
  }
82590
82887
  audioSrcPath = extractedPath;
82591
82888
  } else {
82592
- const trimmedPath = join15(workDir, `${element.id}-trimmed.wav`);
82889
+ const trimmedPath = join16(workDir, `${element.id}-trimmed.wav`);
82593
82890
  const prepResult = await prepareAudioTrack(
82594
82891
  srcPath,
82595
82892
  trimmedPath,
@@ -82633,7 +82930,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
82633
82930
  const fxResult = await applyAudioFxChain(
82634
82931
  audioSrcPath,
82635
82932
  chain,
82636
- join15(workDir, `${element.id}-fx.wav`),
82933
+ join16(workDir, `${element.id}-fx.wav`),
82637
82934
  {
82638
82935
  trackId: element.id,
82639
82936
  signal: effectiveSignal,
@@ -82726,7 +83023,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
82726
83023
  const meta = groupMeta.get(groupId);
82727
83024
  if (!meta) continue;
82728
83025
  const pathId = safePathSegment(groupId, groupIndex);
82729
- const groupWavPath = join15(workDir, `group-${pathId}.wav`);
83026
+ const groupWavPath = join16(workDir, `group-${pathId}.wav`);
82730
83027
  try {
82731
83028
  const subMix = await mixGroupMembers(
82732
83029
  memberTracks,
@@ -82762,7 +83059,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
82762
83059
  const fxResult = await applyAudioFxChain(
82763
83060
  groupSrcPath,
82764
83061
  chain,
82765
- join15(workDir, `group-${pathId}-fx.wav`),
83062
+ join16(workDir, `group-${pathId}-fx.wav`),
82766
83063
  {
82767
83064
  trackId: groupId,
82768
83065
  signal: effectiveSignal,
@@ -82863,14 +83160,14 @@ var init_audioMixer = __esm({
82863
83160
  import { execFile as execFile3 } from "child_process";
82864
83161
  import { mkdtemp, rm, writeFile } from "fs/promises";
82865
83162
  import { tmpdir as tmpdir3 } from "os";
82866
- import { join as join16 } from "path";
83163
+ import { join as join17 } from "path";
82867
83164
  import { promisify as promisify3 } from "util";
82868
83165
  async function psnrDb(a, b) {
82869
83166
  const execFileP = promisify3(execFile3);
82870
- const dir = await mkdtemp(join16(tmpdir3(), "hf-de-verify-"));
83167
+ const dir = await mkdtemp(join17(tmpdir3(), "hf-de-verify-"));
82871
83168
  try {
82872
- const pa = join16(dir, "a.jpg");
82873
- const pb = join16(dir, "b.jpg");
83169
+ const pa = join17(dir, "a.jpg");
83170
+ const pb = join17(dir, "b.jpg");
82874
83171
  await Promise.all([writeFile(pa, a), writeFile(pb, b)]);
82875
83172
  const { stderr } = await execFileP(
82876
83173
  getFfmpegBinary(),
@@ -82981,7 +83278,7 @@ var init_readWebGlVendorInfoFromCanvas = __esm({
82981
83278
  import { cpus, freemem } from "os";
82982
83279
  import { existsSync as existsSync14, mkdirSync as mkdirSync8, readdirSync as readdirSync6 } from "fs";
82983
83280
  import { copyFile, readFile as readFile2, rename } from "fs/promises";
82984
- import { join as join17 } from "path";
83281
+ import { join as join18 } from "path";
82985
83282
  import { getHeapStatistics } from "v8";
82986
83283
  function defaultSafeMaxWorkers() {
82987
83284
  return Math.max(6, Math.min(16, Math.floor(cpus().length / 8)));
@@ -83110,7 +83407,7 @@ function distributeFrames(totalFrames, workerCount, workDir, rangeStart = 0) {
83110
83407
  workerId: i,
83111
83408
  startFrame,
83112
83409
  endFrame,
83113
- outputDir: join17(workDir, `worker-${i}`),
83410
+ outputDir: join18(workDir, `worker-${i}`),
83114
83411
  outputFrameOffset: rangeStart
83115
83412
  });
83116
83413
  }
@@ -83124,7 +83421,7 @@ function distributeFramesInterleaved(totalFrames, workerCount, workDir, rangeSta
83124
83421
  startFrame: rangeStart + i,
83125
83422
  endFrame: rangeStart + totalFrames,
83126
83423
  frameStride: workerCount,
83127
- outputDir: join17(workDir, `worker-${i}`),
83424
+ outputDir: join18(workDir, `worker-${i}`),
83128
83425
  outputFrameOffset: rangeStart
83129
83426
  });
83130
83427
  }
@@ -83323,7 +83620,7 @@ async function verifyDiskDrawElementSamples(session, task, streaming) {
83323
83620
  for (const idx of selectVerifySampleIndicesForTask(truths.keys(), task)) {
83324
83621
  const truth = truths.get(idx);
83325
83622
  if (!truth) continue;
83326
- const framePath = join17(task.outputDir, `frame_${String(idx - offset3).padStart(6, "0")}.${ext}`);
83623
+ const framePath = join18(task.outputDir, `frame_${String(idx - offset3).padStart(6, "0")}.${ext}`);
83327
83624
  const db = await psnrForDiskSample(framePath, truth, task.workerId, idx);
83328
83625
  if (db === null) continue;
83329
83626
  assertDiskSampleAboveFloor(db, verifyMinDb, idx, task.workerId);
@@ -83560,8 +83857,8 @@ async function mergeWorkerFrames(workDir, tasks, outputDir) {
83560
83857
  }
83561
83858
  const files = readdirSync6(task.outputDir).filter((f) => f.startsWith("frame_") && (f.endsWith(".jpg") || f.endsWith(".png"))).sort();
83562
83859
  const copyTasks = files.map(async (file) => {
83563
- const sourcePath = join17(task.outputDir, file);
83564
- const targetPath = join17(outputDir, file);
83860
+ const sourcePath = join18(task.outputDir, file);
83861
+ const targetPath = join18(outputDir, file);
83565
83862
  try {
83566
83863
  await rename(sourcePath, targetPath);
83567
83864
  } catch {
@@ -83606,8 +83903,8 @@ var init_parallelCoordinator = __esm({
83606
83903
  // ../engine/src/services/fileServer.ts
83607
83904
  import { Hono } from "hono";
83608
83905
  import { serve } from "@hono/node-server";
83609
- import { readFileSync as readFileSync6, openSync as openSync4, fstatSync, closeSync as closeSync4, statSync as statSync6, constants as constants2 } from "fs";
83610
- import { join as join18, extname as extname3 } from "path";
83906
+ import { readFileSync as readFileSync7, openSync as openSync4, fstatSync, closeSync as closeSync4, statSync as statSync6, constants as constants2 } from "fs";
83907
+ import { join as join19, extname as extname3 } from "path";
83611
83908
  function readRegularFile(filePath) {
83612
83909
  let fd;
83613
83910
  try {
@@ -83620,16 +83917,16 @@ function readRegularFile(filePath) {
83620
83917
  }
83621
83918
  try {
83622
83919
  if (!fstatSync(fd).isFile()) return null;
83623
- return readFileSync6(fd);
83920
+ return readFileSync7(fd);
83624
83921
  } finally {
83625
83922
  closeSync4(fd);
83626
83923
  }
83627
83924
  }
83628
83925
  function resolveContainedPaths(projectDir, compiledDir, relativePath) {
83629
- const projectPath = join18(projectDir, relativePath);
83926
+ const projectPath = join19(projectDir, relativePath);
83630
83927
  if (!isWithinProjectRoot(projectDir, projectPath)) return null;
83631
83928
  if (!compiledDir) return { projectPath, compiledPath: null };
83632
- const compiledPath = join18(compiledDir, relativePath);
83929
+ const compiledPath = join19(compiledDir, relativePath);
83633
83930
  if (!isWithinProjectRoot(compiledDir, compiledPath)) return null;
83634
83931
  return { projectPath, compiledPath };
83635
83932
  }
@@ -84543,7 +84840,7 @@ var init_shaderTransitions = __esm({
84543
84840
 
84544
84841
  // ../engine/src/services/hdrCapture.ts
84545
84842
  import { existsSync as existsSync15, readdirSync as readdirSync7 } from "fs";
84546
- import { join as join19 } from "path";
84843
+ import { join as join20 } from "path";
84547
84844
  import { homedir as homedir2 } from "os";
84548
84845
  function linearToPQ(L) {
84549
84846
  const Lp = Math.max(0, L * SDR_NITS / PQ_MAX_NITS);
@@ -84659,12 +84956,12 @@ function float16ToPqRgb(rawBuffer, bytesPerRow, width, height) {
84659
84956
  return output;
84660
84957
  }
84661
84958
  function resolveHeadedChromePath() {
84662
- const baseDir = join19(homedir2(), ".cache", "puppeteer", "chrome");
84959
+ const baseDir = join20(homedir2(), ".cache", "puppeteer", "chrome");
84663
84960
  if (!existsSync15(baseDir)) return void 0;
84664
84961
  const versions = readdirSync7(baseDir).sort().reverse();
84665
84962
  for (const version2 of versions) {
84666
84963
  const candidates = [
84667
- join19(
84964
+ join20(
84668
84965
  baseDir,
84669
84966
  version2,
84670
84967
  "chrome-mac-arm64",
@@ -84673,7 +84970,7 @@ function resolveHeadedChromePath() {
84673
84970
  "MacOS",
84674
84971
  "Google Chrome for Testing"
84675
84972
  ),
84676
- join19(
84973
+ join20(
84677
84974
  baseDir,
84678
84975
  version2,
84679
84976
  "chrome-mac-x64",
@@ -84682,8 +84979,8 @@ function resolveHeadedChromePath() {
84682
84979
  "MacOS",
84683
84980
  "Google Chrome for Testing"
84684
84981
  ),
84685
- join19(baseDir, version2, "chrome-linux64", "chrome"),
84686
- join19(baseDir, version2, "chrome-win64", "chrome.exe")
84982
+ join20(baseDir, version2, "chrome-linux64", "chrome"),
84983
+ join20(baseDir, version2, "chrome-win64", "chrome.exe")
84687
84984
  ];
84688
84985
  for (const binary of candidates) {
84689
84986
  if (existsSync15(binary)) return binary;
@@ -88189,13 +88486,13 @@ import {
88189
88486
  existsSync as existsSync23,
88190
88487
  mkdirSync as mkdirSync13,
88191
88488
  mkdtempSync as mkdtempSync8,
88192
- readFileSync as readFileSync10,
88489
+ readFileSync as readFileSync11,
88193
88490
  renameSync as renameSync5,
88194
88491
  rmSync as rmSync11,
88195
88492
  writeFileSync as writeFileSync9
88196
88493
  } from "fs";
88197
88494
  import { homedir as homedir4, tmpdir as tmpdir5 } from "os";
88198
- import { dirname as dirname13, join as join31 } from "path";
88495
+ import { dirname as dirname14, join as join32 } from "path";
88199
88496
  async function compressToWoff2(input) {
88200
88497
  return Buffer.from(await compress(input));
88201
88498
  }
@@ -88203,17 +88500,17 @@ function rawMimeType(format) {
88203
88500
  return RAW_MIME_TYPES[format] ?? "font/ttf";
88204
88501
  }
88205
88502
  function defaultCacheDir() {
88206
- const root = process.env.HYPERFRAMES_FONT_CACHE_DIR ?? (process.env.AWS_LAMBDA_FUNCTION_NAME ? join31(tmpdir5(), "hyperframes", "fonts") : join31(homedir4(), ".cache", "hyperframes", "fonts"));
88207
- return join31(root, "local-compression-v1");
88503
+ const root = process.env.HYPERFRAMES_FONT_CACHE_DIR ?? (process.env.AWS_LAMBDA_FUNCTION_NAME ? join32(tmpdir5(), "hyperframes", "fonts") : join32(homedir4(), ".cache", "hyperframes", "fonts"));
88504
+ return join32(root, "local-compression-v1");
88208
88505
  }
88209
88506
  function cachedCompressionPath(input, originalFormat, cacheDir) {
88210
88507
  const digest = createHash7("sha256").update("hyperframes-local-font-compression-v1\0").update(originalFormat).update("\0").update(input).digest("hex");
88211
- return join31(cacheDir, `${digest}.woff2`);
88508
+ return join32(cacheDir, `${digest}.woff2`);
88212
88509
  }
88213
88510
  function readCachedCompression(path) {
88214
88511
  try {
88215
88512
  if (!existsSync23(path)) return null;
88216
- const cached2 = readFileSync10(path);
88513
+ const cached2 = readFileSync11(path);
88217
88514
  return cached2.length > 0 ? cached2 : null;
88218
88515
  } catch {
88219
88516
  return null;
@@ -88222,9 +88519,9 @@ function readCachedCompression(path) {
88222
88519
  function cacheCompression(path, compressed) {
88223
88520
  let tempDir;
88224
88521
  try {
88225
- mkdirSync13(dirname13(path), { recursive: true });
88226
- tempDir = mkdtempSync8(join31(dirname13(path), ".compression-"));
88227
- const tmpPath = join31(tempDir, "font.woff2");
88522
+ mkdirSync13(dirname14(path), { recursive: true });
88523
+ tempDir = mkdtempSync8(join32(dirname14(path), ".compression-"));
88524
+ const tmpPath = join32(tempDir, "font.woff2");
88228
88525
  writeFileSync9(tmpPath, compressed, { flag: "wx", mode: 420 });
88229
88526
  renameSync5(tmpPath, path);
88230
88527
  } catch {
@@ -88283,7 +88580,7 @@ import {
88283
88580
  existsSync as existsSync33,
88284
88581
  mkdirSync as mkdirSync19,
88285
88582
  mkdtempSync as mkdtempSync11,
88286
- readFileSync as readFileSync14,
88583
+ readFileSync as readFileSync15,
88287
88584
  readdirSync as readdirSync12,
88288
88585
  rmSync as rmSync15,
88289
88586
  statSync as statSync12,
@@ -88292,10 +88589,10 @@ import {
88292
88589
  appendFileSync
88293
88590
  } from "fs";
88294
88591
  import { tmpdir as tmpdir7 } from "os";
88295
- import { join as join47, dirname as dirname19, resolve as resolve13 } from "path";
88592
+ import { join as join48, dirname as dirname20, resolve as resolve13 } from "path";
88296
88593
  import { totalmem as totalmem3 } from "os";
88297
88594
  import { randomUUID as randomUUID3 } from "crypto";
88298
- import { fileURLToPath as fileURLToPath5 } from "url";
88595
+ import { fileURLToPath as fileURLToPath6 } from "url";
88299
88596
 
88300
88597
  // ../producer/src/services/fileServer.ts
88301
88598
  init_compiler();
@@ -88315,14 +88612,14 @@ import {
88315
88612
  } from "fs";
88316
88613
  import { promisify as promisify4 } from "util";
88317
88614
  import { Readable as Readable2 } from "stream";
88318
- import { join as join20, extname as extname4, resolve as resolve7, sep as sep3 } from "path";
88615
+ import { join as join21, extname as extname4, resolve as resolve7, sep as sep3 } from "path";
88319
88616
 
88320
88617
  // ../producer/src/services/hyperframeRuntimeLoader.ts
88321
88618
  import { createHash as createHash4 } from "crypto";
88322
- import { existsSync as existsSync16, readFileSync as readFileSync7 } from "fs";
88323
- import { dirname as dirname10, resolve as resolve6 } from "path";
88324
- import { fileURLToPath as fileURLToPath2 } from "url";
88325
- var PRODUCER_DIR = dirname10(fileURLToPath2(import.meta.url));
88619
+ import { existsSync as existsSync16, readFileSync as readFileSync8 } from "fs";
88620
+ import { dirname as dirname11, resolve as resolve6 } from "path";
88621
+ import { fileURLToPath as fileURLToPath3 } from "url";
88622
+ var PRODUCER_DIR = dirname11(fileURLToPath3(import.meta.url));
88326
88623
  var SIBLING_MANIFEST_PATH = resolve6(PRODUCER_DIR, "hyperframe.manifest.json");
88327
88624
  var MODULE_RELATIVE_MANIFEST_PATH = resolve6(
88328
88625
  PRODUCER_DIR,
@@ -88357,7 +88654,7 @@ function resolveVerifiedHyperframeRuntime() {
88357
88654
  `[HyperframeRuntimeLoader] Missing manifest. Tried: ${tried}. Searched from cwd=${process.cwd()}. Build core runtime artifacts before rendering.`
88358
88655
  );
88359
88656
  }
88360
- const manifestRaw = readFileSync7(manifestPath, "utf8");
88657
+ const manifestRaw = readFileSync8(manifestPath, "utf8");
88361
88658
  const manifest = JSON.parse(manifestRaw);
88362
88659
  const runtimeFileName = manifest.artifacts?.iife;
88363
88660
  if (!runtimeFileName || !manifest.sha256) {
@@ -88365,11 +88662,11 @@ function resolveVerifiedHyperframeRuntime() {
88365
88662
  `[HyperframeRuntimeLoader] Invalid manifest at ${manifestPath}; missing iife artifact or sha256.`
88366
88663
  );
88367
88664
  }
88368
- const runtimePath = resolve6(dirname10(manifestPath), runtimeFileName);
88665
+ const runtimePath = resolve6(dirname11(manifestPath), runtimeFileName);
88369
88666
  if (!existsSync16(runtimePath)) {
88370
88667
  throw new Error(`[HyperframeRuntimeLoader] Missing runtime artifact at ${runtimePath}.`);
88371
88668
  }
88372
- const runtimeSource = readFileSync7(runtimePath, "utf8");
88669
+ const runtimeSource = readFileSync8(runtimePath, "utf8");
88373
88670
  const runtimeSha = createHash4("sha256").update(runtimeSource, "utf8").digest("hex");
88374
88671
  if (runtimeSha !== manifest.sha256) {
88375
88672
  throw new Error(
@@ -88931,7 +89228,7 @@ function createFileServer2(options) {
88931
89228
  }).join("/");
88932
89229
  let file = null;
88933
89230
  for (const root of compiledDir ? [compiledDir, projectDir] : [projectDir]) {
88934
- const candidate = join20(root, relativePath);
89231
+ const candidate = join21(root, relativePath);
88935
89232
  if (isPathInside2(candidate, root)) file = openRegularFile(candidate);
88936
89233
  if (file) break;
88937
89234
  }
@@ -89078,20 +89375,20 @@ import {
89078
89375
  symlinkSync,
89079
89376
  writeFileSync as writeFileSync7
89080
89377
  } from "fs";
89081
- import { basename as basename4, dirname as dirname11, isAbsolute as isAbsolute3, join as join22, relative as relative3, resolve as resolve8 } from "path";
89378
+ import { basename as basename4, dirname as dirname12, isAbsolute as isAbsolute3, join as join23, relative as relative3, resolve as resolve8 } from "path";
89082
89379
 
89083
89380
  // ../producer/src/utils/paths.ts
89084
89381
  import {
89085
89382
  basename as basename3,
89086
- join as join21,
89383
+ join as join22,
89087
89384
  resolve as nodeResolve,
89088
89385
  relative as nodeRelative,
89089
89386
  isAbsolute as nodeIsAbsolute
89090
89387
  } from "path";
89091
- import { fileURLToPath as fileURLToPath3 } from "url";
89388
+ import { fileURLToPath as fileURLToPath4 } from "url";
89092
89389
  var DEFAULT_RENDERS_DIR = process.env.PRODUCER_RENDERS_DIR ?? // fileURLToPath (not URL.pathname): on Windows .pathname is "/D:/..." which
89093
89390
  // resolves to a bogus renders dir.
89094
- nodeResolve(fileURLToPath3(import.meta.url), "../../..", "renders");
89391
+ nodeResolve(fileURLToPath4(import.meta.url), "../../..", "renders");
89095
89392
  function isPathInside3(childPath, parentPath, options = {}) {
89096
89393
  const resolvePath = options.pathModule?.resolve ?? nodeResolve;
89097
89394
  const relativePath = options.pathModule?.relative ?? nodeRelative;
@@ -89121,7 +89418,7 @@ function formatExportFrameName(index, ext) {
89121
89418
  function resolveRenderPaths(projectDir, outputPath, rendersDir = DEFAULT_RENDERS_DIR) {
89122
89419
  const absoluteProjectDir = nodeResolve(projectDir);
89123
89420
  const projectName = basename3(absoluteProjectDir);
89124
- const resolvedOutputPath = outputPath ?? join21(rendersDir, `${projectName}.mp4`);
89421
+ const resolvedOutputPath = outputPath ?? join22(rendersDir, `${projectName}.mp4`);
89125
89422
  const absoluteOutputPath = nodeResolve(resolvedOutputPath);
89126
89423
  return { absoluteProjectDir, absoluteOutputPath };
89127
89424
  }
@@ -89158,21 +89455,21 @@ function resolveDeviceScaleFactor(input) {
89158
89455
  return target.width / input.compositionWidth;
89159
89456
  }
89160
89457
  function writeCompiledArtifacts(compiled, workDir, includeSummary) {
89161
- const compileDir = join22(workDir, "compiled");
89458
+ const compileDir = join23(workDir, "compiled");
89162
89459
  mkdirSync9(compileDir, { recursive: true });
89163
- writeFileSync7(join22(compileDir, "index.html"), compiled.html, "utf-8");
89460
+ writeFileSync7(join23(compileDir, "index.html"), compiled.html, "utf-8");
89164
89461
  for (const [srcPath, html] of compiled.subCompositions) {
89165
- const outPath = join22(compileDir, srcPath);
89166
- mkdirSync9(dirname11(outPath), { recursive: true });
89462
+ const outPath = join23(compileDir, srcPath);
89463
+ mkdirSync9(dirname12(outPath), { recursive: true });
89167
89464
  writeFileSync7(outPath, html, "utf-8");
89168
89465
  }
89169
89466
  for (const [relativePath, absolutePath] of compiled.externalAssets) {
89170
- const outPath = resolve8(join22(compileDir, relativePath));
89467
+ const outPath = resolve8(join23(compileDir, relativePath));
89171
89468
  if (!isPathInside3(outPath, compileDir)) {
89172
89469
  console.warn(`[Render] Skipping external asset with unsafe path: ${relativePath}`);
89173
89470
  continue;
89174
89471
  }
89175
- mkdirSync9(dirname11(outPath), { recursive: true });
89472
+ mkdirSync9(dirname12(outPath), { recursive: true });
89176
89473
  copyFileSync3(absolutePath, outPath);
89177
89474
  }
89178
89475
  if (includeSummary) {
@@ -89198,7 +89495,7 @@ function writeCompiledArtifacts(compiled, workDir, includeSummary) {
89198
89495
  renderModeHints: compiled.renderModeHints,
89199
89496
  hasShaderTransitions: compiled.hasShaderTransitions
89200
89497
  };
89201
- writeFileSync7(join22(compileDir, "summary.json"), JSON.stringify(summary, null, 2), "utf-8");
89498
+ writeFileSync7(join23(compileDir, "summary.json"), JSON.stringify(summary, null, 2), "utf-8");
89202
89499
  }
89203
89500
  }
89204
89501
  function applyRenderModeHints(alreadyForced, compiled, log = defaultLogger) {
@@ -89223,10 +89520,42 @@ function updateJobStatus(job, status, stage, progress, onProgress) {
89223
89520
  }
89224
89521
  if (onProgress) void onProgress(job, stage);
89225
89522
  }
89523
+ var PROGRESS_REPORT_INTERVAL_MS = 250;
89524
+ var lastFrameReportAt = /* @__PURE__ */ new WeakMap();
89525
+ var lastStartupReportAt = /* @__PURE__ */ new WeakMap();
89526
+ function reportThrottled(lastReportAt, job, stage, progress, onProgress, force) {
89527
+ const now = Date.now();
89528
+ const last = lastReportAt.get(job);
89529
+ const due = force || last === void 0 || now - last >= PROGRESS_REPORT_INTERVAL_MS;
89530
+ if (due) lastReportAt.set(job, now);
89531
+ updateJobStatus(job, "rendering", stage, progress, due ? onProgress : void 0);
89532
+ }
89533
+ function reportFrameProgress(job, stage, progress, onProgress, isLastFrame) {
89534
+ reportThrottled(lastFrameReportAt, job, stage, progress, onProgress, isLastFrame);
89535
+ }
89536
+ var workerPhasesByJob = /* @__PURE__ */ new WeakMap();
89537
+ function reportWorkerStartup(job, progress, onProgress) {
89538
+ const phase = progress.latestWorkerPhase;
89539
+ if (!phase) return;
89540
+ const phases = workerPhasesByJob.get(job) ?? /* @__PURE__ */ new Map();
89541
+ workerPhasesByJob.set(job, phases);
89542
+ phases.set(phase.workerId, phase.phase);
89543
+ const ready = [...phases].filter(
89544
+ ([id, p]) => id < progress.activeWorkers && (p === "frame_capture" || p === "frame_encode")
89545
+ ).length;
89546
+ reportThrottled(
89547
+ lastStartupReportAt,
89548
+ job,
89549
+ `Starting browsers (${ready}/${progress.activeWorkers} ready)`,
89550
+ job.progress,
89551
+ onProgress,
89552
+ false
89553
+ );
89554
+ }
89226
89555
  var materializePathModule = {
89227
89556
  resolve: resolve8,
89228
- join: join22,
89229
- dirname: dirname11,
89557
+ join: join23,
89558
+ dirname: dirname12,
89230
89559
  basename: basename4,
89231
89560
  relative: relative3,
89232
89561
  isAbsolute: isAbsolute3
@@ -89529,7 +89858,7 @@ import {
89529
89858
  renameSync as renameSync3,
89530
89859
  rmSync as rmSync8
89531
89860
  } from "fs";
89532
- import { basename as basename5, dirname as dirname12, extname as extname5, join as join23, resolve as resolve9 } from "path";
89861
+ import { basename as basename5, dirname as dirname13, extname as extname5, join as join24, resolve as resolve9 } from "path";
89533
89862
 
89534
89863
  // ../producer/src/utils/ffprobe.ts
89535
89864
  init_src();
@@ -89563,10 +89892,10 @@ function buildArtifactExpectation(input) {
89563
89892
  };
89564
89893
  }
89565
89894
  function createSiblingTransactionDirectory(destination) {
89566
- const parent = dirname12(destination);
89895
+ const parent = dirname13(destination);
89567
89896
  const extension = extname5(destination);
89568
89897
  const stem = extension ? basename5(destination, extension) : basename5(destination);
89569
- return mkdtempSync6(join23(parent, `.${stem}.hf-transaction-`));
89898
+ return mkdtempSync6(join24(parent, `.${stem}.hf-transaction-`));
89570
89899
  }
89571
89900
  function assertReadableNonEmptyFile(path) {
89572
89901
  const fd = openSync6(path, "r");
@@ -89584,7 +89913,7 @@ function collectDirectoryFiles(root) {
89584
89913
  const files = [];
89585
89914
  const visit = (directory) => {
89586
89915
  for (const entry of readdirSync8(directory, { withFileTypes: true })) {
89587
- const path = join23(directory, entry.name);
89916
+ const path = join24(directory, entry.name);
89588
89917
  if (entry.isDirectory()) visit(path);
89589
89918
  else if (entry.isFile()) files.push(path);
89590
89919
  }
@@ -89627,8 +89956,8 @@ var ArtifactTransaction = class {
89627
89956
  this.fileSystem = fileSystem;
89628
89957
  this.destinationPath = resolve9(destinationPath);
89629
89958
  this.transactionDirectory = createSiblingTransactionDirectory(this.destinationPath);
89630
- this.stagingPath = join23(this.transactionDirectory, basename5(this.destinationPath));
89631
- this.backupPath = join23(this.transactionDirectory, "backup");
89959
+ this.stagingPath = join24(this.transactionDirectory, basename5(this.destinationPath));
89960
+ this.backupPath = join24(this.transactionDirectory, "backup");
89632
89961
  this.durationProbe = durationProbe;
89633
89962
  }
89634
89963
  kind;
@@ -89669,14 +89998,14 @@ var ArtifactTransaction = class {
89669
89998
  */
89670
89999
  async assertDirectoryExpectation(expected) {
89671
90000
  for (const required of expected.requiredFiles ?? []) {
89672
- const path = join23(this.stagingPath, required);
90001
+ const path = join24(this.stagingPath, required);
89673
90002
  if (!existsSync19(path)) {
89674
90003
  throw new Error(`Render artifact directory is missing ${required}: ${this.stagingPath}`);
89675
90004
  }
89676
90005
  assertReadableNonEmptyFile(path);
89677
90006
  }
89678
90007
  if (expected.probeTarget === void 0) return;
89679
- await this.assertArtifactDuration(expected, join23(this.stagingPath, expected.probeTarget));
90008
+ await this.assertArtifactDuration(expected, join24(this.stagingPath, expected.probeTarget));
89680
90009
  }
89681
90010
  async assertArtifactDuration(expected, probePath = this.stagingPath) {
89682
90011
  const expectedSeconds = expected.expectedDurationSeconds;
@@ -89890,7 +90219,7 @@ function replanAfterFailure(plan2, failure) {
89890
90219
  // ../producer/src/services/render/stages/captureSegmentedStage.ts
89891
90220
  init_src();
89892
90221
  import { existsSync as existsSync20, mkdirSync as mkdirSync11, rmSync as rmSync10, statSync as statSync8 } from "fs";
89893
- import { join as join27 } from "path";
90222
+ import { join as join28 } from "path";
89894
90223
 
89895
90224
  // ../producer/src/services/render/captureStageError.ts
89896
90225
  init_src();
@@ -89926,7 +90255,7 @@ init_src();
89926
90255
  // ../producer/src/services/hdrCompositor.ts
89927
90256
  init_src();
89928
90257
  import { readSync as readSync2, closeSync as closeSync7 } from "fs";
89929
- import { join as join24 } from "path";
90258
+ import { join as join25 } from "path";
89930
90259
 
89931
90260
  // ../producer/src/services/render/hdrPerf.ts
89932
90261
  function createHdrPerfCollector() {
@@ -90438,7 +90767,7 @@ async function compositeHdrFrame(ctx, canvas, time, fullStacking, elementFilter,
90438
90767
  if (shouldLog && debugDumpDir) {
90439
90768
  const after2 = countNonZeroRgb48(canvas);
90440
90769
  const dumpName = `frame_${String(debugFrameIndex).padStart(4, "0")}_layer_${String(layerIdx).padStart(2, "0")}_dom.png`;
90441
- const dumpPath = join24(debugDumpDir, dumpName);
90770
+ const dumpPath = join25(debugDumpDir, dumpName);
90442
90771
  writeFileExclusiveSync(dumpPath, domPng);
90443
90772
  log.info("[diag] dom layer blit", {
90444
90773
  frame: debugFrameIndex,
@@ -90482,11 +90811,11 @@ import {
90482
90811
  mkdirSync as mkdirSync10,
90483
90812
  mkdtempSync as mkdtempSync7,
90484
90813
  openSync as openSync7,
90485
- readFileSync as readFileSync8,
90814
+ readFileSync as readFileSync9,
90486
90815
  rmSync as rmSync9,
90487
90816
  statfsSync
90488
90817
  } from "fs";
90489
- import { join as join25 } from "path";
90818
+ import { join as join26 } from "path";
90490
90819
  var NO_FOLLOW_FLAG = constants4.O_NOFOLLOW ?? 0;
90491
90820
  function tempDirSafePrefix(id) {
90492
90821
  const safe = id.replace(/[^A-Za-z0-9_.-]/g, "_").slice(0, 80);
@@ -90730,10 +91059,10 @@ async function extractHdrVideoFrames(args) {
90730
91059
  const window3 = extractionWindows.get(videoId);
90731
91060
  if (!video || !window3) continue;
90732
91061
  mkdirSync10(framesDir, { recursive: true });
90733
- const frameDir = mkdtempSync7(join25(framesDir, `hdr_${tempDirSafePrefix(videoId)}-`));
91062
+ const frameDir = mkdtempSync7(join26(framesDir, `hdr_${tempDirSafePrefix(videoId)}-`));
90734
91063
  createdFrameDirs.add(frameDir);
90735
91064
  const dims = prep.hdrExtractionDims.get(videoId) ?? { width, height };
90736
- const rawPath = join25(frameDir, "frames.rgb48le");
91065
+ const rawPath = join26(frameDir, "frames.rgb48le");
90737
91066
  const extractionStart = String(window3.extractionMediaStart ?? window3.mediaStart);
90738
91067
  const ffmpegArgs = [];
90739
91068
  if (window3.finalFrameOnly) {
@@ -90819,7 +91148,7 @@ function decodeHdrImageBuffers(args) {
90819
91148
  const out = /* @__PURE__ */ new Map();
90820
91149
  for (const [imageId, srcPath] of hdrImageSrcPaths) {
90821
91150
  try {
90822
- const decoded = decodePngToRgb48le(readFileSync8(srcPath));
91151
+ const decoded = decodePngToRgb48le(readFileSync9(srcPath));
90823
91152
  const layout2 = prep.hdrExtractionDims.get(imageId);
90824
91153
  const fitInfo = prep.hdrImageFitInfo.get(imageId);
90825
91154
  if (layout2 && (layout2.width !== decoded.width || layout2.height !== decoded.height)) {
@@ -91148,7 +91477,7 @@ function isTargetLossError(error) {
91148
91477
  init_src();
91149
91478
  import { mkdtemp as mkdtemp2, writeFile as writeFile2 } from "fs/promises";
91150
91479
  import { tmpdir as tmpdir4 } from "os";
91151
- import { join as join26 } from "path";
91480
+ import { join as join27 } from "path";
91152
91481
 
91153
91482
  // ../producer/src/services/render/perfSummary.ts
91154
91483
  init_dist2();
@@ -91496,11 +91825,11 @@ function createDrainFrameGuard(args) {
91496
91825
  return buf;
91497
91826
  }
91498
91827
  if (db < verifyMinDb) {
91499
- const dumpDir = await mkdtemp2(join26(tmpdir4(), "hf-de-verify-fail-")).catch(() => null);
91828
+ const dumpDir = await mkdtemp2(join27(tmpdir4(), "hf-de-verify-fail-")).catch(() => null);
91500
91829
  if (dumpDir) {
91501
91830
  await Promise.all([
91502
- writeFile2(join26(dumpDir, `frame-${idx}-de.jpg`), buf),
91503
- writeFile2(join26(dumpDir, `frame-${idx}-truth.jpg`), truth)
91831
+ writeFile2(join27(dumpDir, `frame-${idx}-de.jpg`), buf),
91832
+ writeFile2(join27(dumpDir, `frame-${idx}-truth.jpg`), truth)
91504
91833
  ]).catch(() => {
91505
91834
  });
91506
91835
  }
@@ -91541,12 +91870,12 @@ async function runWorkerEncodePipelineLoop(session, totalFrames, job, currentEnc
91541
91870
  reorderBuffer.advanceTo(prev.idx + 1);
91542
91871
  job.framesRendered = prev.idx + 1;
91543
91872
  lastProgressAt = Date.now();
91544
- updateJobStatus(
91873
+ reportFrameProgress(
91545
91874
  job,
91546
- "rendering",
91547
91875
  `Streaming frame ${prev.idx + 1}/${totalFrames}`,
91548
91876
  Math.round(25 + (prev.idx + 1) / totalFrames * 55),
91549
- onProgress
91877
+ onProgress,
91878
+ prev.idx + 1 === totalFrames
91550
91879
  );
91551
91880
  };
91552
91881
  const batchNRaw = Number(process.env.HF_DE_BATCH ?? "4");
@@ -91560,12 +91889,12 @@ async function runWorkerEncodePipelineLoop(session, totalFrames, job, currentEnc
91560
91889
  reorderBuffer.advanceTo(item.idx + 1);
91561
91890
  job.framesRendered = item.idx + 1;
91562
91891
  lastProgressAt = Date.now();
91563
- updateJobStatus(
91892
+ reportFrameProgress(
91564
91893
  job,
91565
- "rendering",
91566
91894
  `Streaming frame ${item.idx + 1}/${totalFrames}`,
91567
91895
  Math.round(25 + (item.idx + 1) / totalFrames * 55),
91568
- onProgress
91896
+ onProgress,
91897
+ item.idx + 1 === totalFrames
91569
91898
  );
91570
91899
  }
91571
91900
  };
@@ -91762,6 +92091,7 @@ async function runCaptureStreamingStage(input) {
91762
92091
  canvasDrawElement: phase.canvasDrawElement,
91763
92092
  gpuBackend: phase.gpuBackend
91764
92093
  });
92094
+ if (progress.capturedFrames === 0) reportWorkerStartup(job, progress, onProgress);
91765
92095
  return;
91766
92096
  }
91767
92097
  if (progress.capturedFrames > lastCapturedFrames) {
@@ -91771,16 +92101,13 @@ async function runCaptureStreamingStage(input) {
91771
92101
  }
91772
92102
  job.framesRendered = progress.capturedFrames;
91773
92103
  const frameProgress = progress.capturedFrames / progress.totalFrames;
91774
- const progressPct = 25 + frameProgress * 55;
91775
- if (progress.capturedFrames % 30 === 0 || progress.capturedFrames === progress.totalFrames) {
91776
- updateJobStatus(
91777
- job,
91778
- "rendering",
91779
- `Streaming frame ${progress.capturedFrames}/${progress.totalFrames} (${workerCount} workers)`,
91780
- Math.round(progressPct),
91781
- onProgress
91782
- );
91783
- }
92104
+ reportFrameProgress(
92105
+ job,
92106
+ `Streaming frame ${progress.capturedFrames}/${progress.totalFrames} (${workerCount} workers)`,
92107
+ Math.round(25 + frameProgress * 55),
92108
+ onProgress,
92109
+ progress.capturedFrames === progress.totalFrames
92110
+ );
91784
92111
  },
91785
92112
  onFrameBuffer,
91786
92113
  // Interleaved DE workers each need their own browser PROCESS:
@@ -91892,12 +92219,12 @@ async function runCaptureStreamingStage(input) {
91892
92219
  lastProgressAt = Date.now();
91893
92220
  const frameProgress = (i + 1) / totalFrames;
91894
92221
  const progress = 25 + frameProgress * 55;
91895
- updateJobStatus(
92222
+ reportFrameProgress(
91896
92223
  job,
91897
- "rendering",
91898
92224
  `Streaming frame ${i + 1}/${totalFrames}`,
91899
92225
  Math.round(progress),
91900
- onProgress
92226
+ onProgress,
92227
+ i + 1 === totalFrames
91901
92228
  );
91902
92229
  }
91903
92230
  }
@@ -91940,7 +92267,7 @@ async function runCaptureStreamingStage(input) {
91940
92267
 
91941
92268
  // ../producer/src/services/render/stages/captureSegmentedStage.ts
91942
92269
  function segmentOutputPath(segmentDir, index) {
91943
- return join27(segmentDir, `segment_${String(index).padStart(5, "0")}.mp4`);
92270
+ return join28(segmentDir, `segment_${String(index).padStart(5, "0")}.mp4`);
91944
92271
  }
91945
92272
  function segmentEncoderOptions(base2, segment) {
91946
92273
  return {
@@ -91976,12 +92303,12 @@ async function captureSegmentFrames(ctx, segment, encoder) {
91976
92303
  ensureFrameWritten(await encoder.writeFrame(buffer), i, encoder);
91977
92304
  ctx.job.framesRendered = i + 1;
91978
92305
  lastProgressAt = Date.now();
91979
- updateJobStatus(
92306
+ reportFrameProgress(
91980
92307
  ctx.job,
91981
- "rendering",
91982
92308
  `Streaming frame ${i + 1}/${ctx.totalFrames} (segment ${segment.index + 1}/${ctx.segmentCount}` + (ctx.skipped > 0 ? `, skipped ${ctx.skipped}` : "") + ")",
91983
92309
  Math.round(25 + (i + 1) / ctx.totalFrames * 55),
91984
- ctx.onProgress
92310
+ ctx.onProgress,
92311
+ i + 1 === ctx.totalFrames
91985
92312
  );
91986
92313
  }
91987
92314
  }
@@ -92186,7 +92513,7 @@ async function runCaptureSegmentedStage(input) {
92186
92513
  const { log, dedupPerfs, assertNotAborted } = input;
92187
92514
  const deps = { ...DEFAULT_DEPS, ...input.deps };
92188
92515
  const segments = planSegments(input.totalFrames, input.segmentFrames);
92189
- const segmentDir = input.segmentDir ?? join27(input.workDir, "segments");
92516
+ const segmentDir = input.segmentDir ?? join28(input.workDir, "segments");
92190
92517
  mkdirSync11(segmentDir, { recursive: true });
92191
92518
  const skip = input.completedSegments ?? /* @__PURE__ */ new Set();
92192
92519
  const pending = segments.filter((s) => !skip.has(s.index));
@@ -92258,8 +92585,8 @@ async function runCaptureSegmentedStage(input) {
92258
92585
 
92259
92586
  // ../producer/src/services/render/segmentManifest.ts
92260
92587
  import { createHash as createHash5 } from "crypto";
92261
- import { existsSync as existsSync21, mkdirSync as mkdirSync12, readFileSync as readFileSync9, renameSync as renameSync4, statSync as statSync9, writeFileSync as writeFileSync8 } from "fs";
92262
- import { join as join28 } from "path";
92588
+ import { existsSync as existsSync21, mkdirSync as mkdirSync12, readFileSync as readFileSync10, renameSync as renameSync4, statSync as statSync9, writeFileSync as writeFileSync8 } from "fs";
92589
+ import { join as join29 } from "path";
92263
92590
  var MANIFEST_FILENAME = "segments.json";
92264
92591
  function computeSegmentPlanHash(input) {
92265
92592
  const ordered = [
@@ -92282,7 +92609,7 @@ function computeSegmentPlanHash(input) {
92282
92609
  return createHash5("sha256").update(ordered).digest("hex").slice(0, 16);
92283
92610
  }
92284
92611
  function segmentDirFor(projectRendersDir, planHash) {
92285
- return join28(projectRendersDir, ".hf-segments", planHash);
92612
+ return join29(projectRendersDir, ".hf-segments", planHash);
92286
92613
  }
92287
92614
  function hasNumber(value, key2) {
92288
92615
  return key2 in value && typeof Reflect.get(value, key2) === "number";
@@ -92300,10 +92627,10 @@ function isManifest2(value) {
92300
92627
  return Reflect.get(value, "version") === 1 && hasString(value, "planHash") && hasNumber(value, "totalFrames") && hasNumber(value, "segmentFrames") && Array.isArray(completed) && completed.every(isEntry);
92301
92628
  }
92302
92629
  function readSegmentManifest(segmentDir) {
92303
- const path = join28(segmentDir, MANIFEST_FILENAME);
92630
+ const path = join29(segmentDir, MANIFEST_FILENAME);
92304
92631
  if (!existsSync21(path)) return null;
92305
92632
  try {
92306
- const parsed = JSON.parse(readFileSync9(path, "utf-8"));
92633
+ const parsed = JSON.parse(readFileSync10(path, "utf-8"));
92307
92634
  return isManifest2(parsed) ? parsed : null;
92308
92635
  } catch {
92309
92636
  return null;
@@ -92311,9 +92638,9 @@ function readSegmentManifest(segmentDir) {
92311
92638
  }
92312
92639
  function writeSegmentManifest(segmentDir, manifest) {
92313
92640
  mkdirSync12(segmentDir, { recursive: true });
92314
- const tmp = join28(segmentDir, `${MANIFEST_FILENAME}.${process.pid}.tmp`);
92641
+ const tmp = join29(segmentDir, `${MANIFEST_FILENAME}.${process.pid}.tmp`);
92315
92642
  writeFileSync8(tmp, JSON.stringify(manifest, null, 2), "utf-8");
92316
- renameSync4(tmp, join28(segmentDir, MANIFEST_FILENAME));
92643
+ renameSync4(tmp, join29(segmentDir, MANIFEST_FILENAME));
92317
92644
  }
92318
92645
  async function probeSegmentFrameCount(path, probe2) {
92319
92646
  try {
@@ -92421,7 +92748,7 @@ function resolveVideoCaptureBeyondViewport(videoCount) {
92421
92748
  // ../producer/src/services/render/captureCost.ts
92422
92749
  init_dist2();
92423
92750
  init_src();
92424
- import { join as join29 } from "path";
92751
+ import { join as join30 } from "path";
92425
92752
  var CAPTURE_CALIBRATION_TARGET_MS = 600;
92426
92753
  var MAX_MEASURED_CAPTURE_COST_MULTIPLIER = 8;
92427
92754
  var CAPTURE_CALIBRATION_PROTOCOL_TIMEOUT_MS = 3e4;
@@ -92657,7 +92984,7 @@ async function runCaptureCalibration(input) {
92657
92984
  });
92658
92985
  let calibration;
92659
92986
  try {
92660
- calibration = await runOneCalibration(join29(workDir, "capture-calibration"), calibrationCfg);
92987
+ calibration = await runOneCalibration(join30(workDir, "capture-calibration"), calibrationCfg);
92661
92988
  } catch (error) {
92662
92989
  const shouldFallback = !forceScreenshot && shouldFallbackToScreenshotAfterCalibrationError(error);
92663
92990
  if (!shouldFallback) {
@@ -92690,7 +93017,7 @@ async function runCaptureCalibration(input) {
92690
93017
  const screenshotCfg = createCaptureCalibrationConfig({ ...cfg, forceScreenshot: true });
92691
93018
  try {
92692
93019
  calibration = await runOneCalibration(
92693
- join29(workDir, "capture-calibration-screenshot"),
93020
+ join30(workDir, "capture-calibration-screenshot"),
92694
93021
  screenshotCfg
92695
93022
  );
92696
93023
  } catch (fallbackError) {
@@ -93115,7 +93442,7 @@ function countAuthoredTimedClips(html) {
93115
93442
 
93116
93443
  // ../producer/src/services/render/stages/compileStage.ts
93117
93444
  init_dist2();
93118
- import { join as join35 } from "path";
93445
+ import { join as join36 } from "path";
93119
93446
 
93120
93447
  // ../producer/src/services/htmlCompiler.ts
93121
93448
  init_esm10();
@@ -93125,8 +93452,8 @@ init_compiler();
93125
93452
  init_subCompositionValidity();
93126
93453
  init_assetResolution();
93127
93454
  import { createHash as createHash10 } from "crypto";
93128
- import { createReadStream as createReadStream4, existsSync as existsSync27, mkdirSync as mkdirSync16, readFileSync as readFileSync13 } from "fs";
93129
- import { join as join34, dirname as dirname15, resolve as resolve12, basename as basename6, relative as relative4 } from "path";
93455
+ import { createReadStream as createReadStream4, existsSync as existsSync27, mkdirSync as mkdirSync16, readFileSync as readFileSync14 } from "fs";
93456
+ import { join as join35, dirname as dirname16, resolve as resolve12, basename as basename6, relative as relative4 } from "path";
93130
93457
 
93131
93458
  // ../producer/src/services/renderMediaCollector.ts
93132
93459
  init_esm10();
@@ -93229,9 +93556,9 @@ init_src();
93229
93556
 
93230
93557
  // ../producer/src/services/deterministicFonts.ts
93231
93558
  import { createHash as createHash8 } from "crypto";
93232
- import { existsSync as existsSync24, mkdirSync as mkdirSync14, mkdtempSync as mkdtempSync9, readFileSync as readFileSync11, writeFileSync as writeFileSync10 } from "fs";
93559
+ import { existsSync as existsSync24, mkdirSync as mkdirSync14, mkdtempSync as mkdtempSync9, readFileSync as readFileSync12, writeFileSync as writeFileSync10 } from "fs";
93233
93560
  import { homedir as homedir5, tmpdir as tmpdir6 } from "os";
93234
- import { join as join32 } from "path";
93561
+ import { join as join33 } from "path";
93235
93562
 
93236
93563
  // ../core/dist/fonts/aliases.js
93237
93564
  init_dist();
@@ -93240,7 +93567,7 @@ init_dist();
93240
93567
  import { execFileSync as execFileSync2 } from "child_process";
93241
93568
  import { existsSync as existsSync22, lstatSync as lstatSync4, readdirSync as readdirSync9, realpathSync as realpathSync3 } from "fs";
93242
93569
  import { homedir as homedir3, platform as platform2 } from "os";
93243
- import { join as join30, resolve as resolve10 } from "path";
93570
+ import { join as join31, resolve as resolve10 } from "path";
93244
93571
  var SYSTEM_FONT_SIZE_LIMIT = 5 * 1024 * 1024;
93245
93572
  var PROFILER_TIMEOUT_MS = 5e3;
93246
93573
  var FONT_EXT_RE = /\.(otf|ttf|ttc|woff2?)$/i;
@@ -93337,7 +93664,7 @@ function fontDirectories() {
93337
93664
  const home = homedir3();
93338
93665
  if (platform2() === "darwin") {
93339
93666
  return [
93340
- join30(home, "Library", "Fonts"),
93667
+ join31(home, "Library", "Fonts"),
93341
93668
  "/Library/Fonts",
93342
93669
  "/System/Library/Fonts",
93343
93670
  "/System/Library/Fonts/Supplemental"
@@ -93345,13 +93672,13 @@ function fontDirectories() {
93345
93672
  }
93346
93673
  if (platform2() === "win32") {
93347
93674
  return [
93348
- join30(process.env.WINDIR || "C:\\Windows", "Fonts"),
93349
- join30(process.env.LOCALAPPDATA || join30(homedir3(), "AppData", "Local"), "Microsoft", "Windows", "Fonts")
93675
+ join31(process.env.WINDIR || "C:\\Windows", "Fonts"),
93676
+ join31(process.env.LOCALAPPDATA || join31(homedir3(), "AppData", "Local"), "Microsoft", "Windows", "Fonts")
93350
93677
  ];
93351
93678
  }
93352
93679
  return [
93353
- join30(home, ".fonts"),
93354
- join30(home, ".local", "share", "fonts"),
93680
+ join31(home, ".fonts"),
93681
+ join31(home, ".local", "share", "fonts"),
93355
93682
  "/usr/local/share/fonts",
93356
93683
  "/usr/share/fonts"
93357
93684
  ];
@@ -93362,7 +93689,7 @@ function collectFontFileEntries(dir, depth = 0) {
93362
93689
  const entries2 = [];
93363
93690
  try {
93364
93691
  for (const entry of readdirSync9(dir, { withFileTypes: true })) {
93365
- const fullPath = join30(dir, entry.name);
93692
+ const fullPath = join31(dir, entry.name);
93366
93693
  if (entry.isDirectory()) {
93367
93694
  entries2.push(...collectFontFileEntries(fullPath, depth + 1));
93368
93695
  continue;
@@ -93989,7 +94316,7 @@ async function buildFontFaceCss(requestedFamilies, options, fontText) {
93989
94316
  if (variants.length > 0) {
93990
94317
  let totalBytes = 0;
93991
94318
  for (const variant of variants) {
93992
- const fontBuffer = readFileSync11(variant.path);
94319
+ const fontBuffer = readFileSync12(variant.path);
93993
94320
  totalBytes += fontBuffer.length;
93994
94321
  const dataUri = await fontToDataUri(fontBuffer, variant.format);
93995
94322
  rules.push(buildFontFaceRule(originalCaseFamily, dataUri, variant.weight, variant.style));
@@ -94035,10 +94362,10 @@ function resolveFontCacheRoot() {
94035
94362
  return process.env.HYPERFRAMES_FONT_CACHE_DIR;
94036
94363
  }
94037
94364
  if (process.env.AWS_LAMBDA_FUNCTION_NAME) {
94038
- lambdaFontCacheRoot ??= mkdtempSync9(join32(tmpdir6(), "hyperframes-fonts-"));
94365
+ lambdaFontCacheRoot ??= mkdtempSync9(join33(tmpdir6(), "hyperframes-fonts-"));
94039
94366
  return lambdaFontCacheRoot;
94040
94367
  }
94041
- return join32(homedir5(), ".cache", "hyperframes", "fonts");
94368
+ return join33(homedir5(), ".cache", "hyperframes", "fonts");
94042
94369
  }
94043
94370
  var WOFF2_USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36";
94044
94371
  function fontSlug(familyName) {
@@ -94046,14 +94373,14 @@ function fontSlug(familyName) {
94046
94373
  }
94047
94374
  var ephemeralFontCacheRoot;
94048
94375
  function fontCacheDir(slug) {
94049
- const dir = join32(resolveFontCacheRoot(), slug);
94376
+ const dir = join33(resolveFontCacheRoot(), slug);
94050
94377
  if (!existsSync24(dir)) {
94051
94378
  try {
94052
94379
  mkdirSync14(dir, { recursive: true });
94053
94380
  } catch {
94054
94381
  const firstFallback = ephemeralFontCacheRoot === void 0;
94055
- ephemeralFontCacheRoot ??= mkdtempSync9(join32(tmpdir6(), "hyperframes-fonts-"));
94056
- const fallback = join32(ephemeralFontCacheRoot, slug);
94382
+ ephemeralFontCacheRoot ??= mkdtempSync9(join33(tmpdir6(), "hyperframes-fonts-"));
94383
+ const fallback = join33(ephemeralFontCacheRoot, slug);
94057
94384
  mkdirSync14(fallback, { recursive: true });
94058
94385
  if (firstFallback) {
94059
94386
  defaultLogger.warn(
@@ -94069,7 +94396,7 @@ function subsetToken(woff2Url) {
94069
94396
  return createHash8("sha1").update(woff2Url).digest("hex").slice(0, 12);
94070
94397
  }
94071
94398
  function cachedWoff2Path(slug, weight, style, subset) {
94072
- return join32(fontCacheDir(slug), `${weight}-${style}-${subset}.woff2`);
94399
+ return join33(fontCacheDir(slug), `${weight}-${style}-${subset}.woff2`);
94073
94400
  }
94074
94401
  var FONT_FETCH_FAILED = "FONT_FETCH_FAILED";
94075
94402
  var FONT_FETCH_UNAVAILABLE = "FONT_FETCH_UNAVAILABLE";
@@ -94196,7 +94523,7 @@ async function fetchFontResource(url, init, readBody, familyName, what, options)
94196
94523
  }
94197
94524
  async function ensureWoff2DataUri(cachePath, woff2Url, familyName, weight, style, options) {
94198
94525
  try {
94199
- return `data:font/woff2;base64,${readFileSync11(cachePath).toString("base64")}`;
94526
+ return `data:font/woff2;base64,${readFileSync12(cachePath).toString("base64")}`;
94200
94527
  } catch {
94201
94528
  }
94202
94529
  const woff2What = `Google Fonts woff2 (${weight}/${style})`;
@@ -94221,7 +94548,7 @@ async function ensureWoff2DataUri(cachePath, woff2Url, familyName, weight, style
94221
94548
  return null;
94222
94549
  }
94223
94550
  }
94224
- return `data:font/woff2;base64,${readFileSync11(cachePath).toString("base64")}`;
94551
+ return `data:font/woff2;base64,${readFileSync12(cachePath).toString("base64")}`;
94225
94552
  }
94226
94553
  var googleFontCssCache = /* @__PURE__ */ new Map();
94227
94554
  function raceAgainstAbort(promise, signal) {
@@ -94502,12 +94829,12 @@ import {
94502
94829
  copyFileSync as copyFileSync4,
94503
94830
  existsSync as existsSync25,
94504
94831
  mkdirSync as mkdirSync15,
94505
- readFileSync as readFileSync12,
94832
+ readFileSync as readFileSync13,
94506
94833
  renameSync as renameSync6,
94507
94834
  rmSync as rmSync12,
94508
94835
  statSync as statSync10
94509
94836
  } from "fs";
94510
- import { dirname as dirname14, isAbsolute as isAbsolute4, join as join33, resolve as resolve11 } from "path";
94837
+ import { dirname as dirname15, isAbsolute as isAbsolute4, join as join34, resolve as resolve11 } from "path";
94511
94838
  var PREPARED_GIF_SUBDIR = "_animated_gif";
94512
94839
  var CACHE_SCHEMA = "hfgif-v1";
94513
94840
  function splitUrlSuffix(src) {
@@ -94660,11 +94987,11 @@ async function runAnimatedGifTranscode(request) {
94660
94987
  throw result.error ?? new Error(`Animated GIF transcode failed (${result.exitCode}): ${result.stderr.slice(-500)}`);
94661
94988
  }
94662
94989
  async function ensurePreparedWebm(input) {
94663
- if (!existsSync25(dirname14(input.cachePath))) {
94664
- mkdirSync15(dirname14(input.cachePath), { recursive: true });
94990
+ if (!existsSync25(dirname15(input.cachePath))) {
94991
+ mkdirSync15(dirname15(input.cachePath), { recursive: true });
94665
94992
  }
94666
- if (!existsSync25(dirname14(input.outputPath))) {
94667
- mkdirSync15(dirname14(input.outputPath), { recursive: true });
94993
+ if (!existsSync25(dirname15(input.outputPath))) {
94994
+ mkdirSync15(dirname15(input.outputPath), { recursive: true });
94668
94995
  }
94669
94996
  if (!isUsableFile(input.cachePath)) {
94670
94997
  const tmpPath = `${input.cachePath}.tmp-${process.pid}-${Date.now()}`;
@@ -94747,7 +95074,7 @@ function replaceImageWithVideo(input) {
94747
95074
  return video;
94748
95075
  }
94749
95076
  async function prepareAnimatedGifInputs(html, options) {
94750
- const outputDir = options.outputDir ?? join33(options.downloadDir, PREPARED_GIF_SUBDIR);
95077
+ const outputDir = options.outputDir ?? join34(options.downloadDir, PREPARED_GIF_SUBDIR);
94751
95078
  const outputSrcPrefix = normalizeRelPath(options.outputSrcPrefix ?? PREPARED_GIF_SUBDIR);
94752
95079
  const cacheDir = options.cacheDir ?? outputDir;
94753
95080
  const { document: document2 } = parseHTML(html);
@@ -94761,7 +95088,7 @@ async function prepareAnimatedGifInputs(html, options) {
94761
95088
  if (!hasGifExtension(src)) continue;
94762
95089
  const sourcePath = resolveGifSourcePath(src, options);
94763
95090
  if (!sourcePath) continue;
94764
- const bytes = readFileSync12(sourcePath);
95091
+ const bytes = readFileSync13(sourcePath);
94765
95092
  const metadata = parseAnimatedGifMetadata(bytes);
94766
95093
  if (!metadata?.animated) continue;
94767
95094
  const loop = resolveLoop(metadata, readLoopOverride(img));
@@ -94769,8 +95096,8 @@ async function prepareAnimatedGifInputs(html, options) {
94769
95096
  const { loopIterations, padSeconds } = resolvePreparedPlayback(metadata, loop, windowSeconds);
94770
95097
  const hash2 = computePreparedGifHash(bytes, loopIterations, padSeconds);
94771
95098
  const filename = `${CACHE_SCHEMA}-${hash2.slice(0, 24)}.webm`;
94772
- const cachePath = join33(cacheDir, filename);
94773
- const outputPath = join33(outputDir, filename);
95099
+ const cachePath = join34(cacheDir, filename);
95100
+ const outputPath = join34(outputDir, filename);
94774
95101
  const outputSrc = `${outputSrcPrefix}/${filename}`;
94775
95102
  await ensurePreparedWebm({
94776
95103
  sourcePath,
@@ -95301,7 +95628,7 @@ function assertSubCompositionsUsable(html, projectDir, visited = /* @__PURE__ */
95301
95628
  problems.push({ srcPath, detail: "the file does not exist" });
95302
95629
  continue;
95303
95630
  }
95304
- const fileHtml = readFileSync13(filePath, "utf-8");
95631
+ const fileHtml = readFileSync14(filePath, "utf-8");
95305
95632
  const validity = checkSubCompositionUsability(fileHtml, parseSubCompHtmlForValidity);
95306
95633
  if (!validity.ok) {
95307
95634
  problems.push({
@@ -95440,7 +95767,7 @@ async function resolveMediaDuration2(src, mediaStart, playbackRate, baseDir, dow
95440
95767
  return { duration: null, resolvedPath: src };
95441
95768
  }
95442
95769
  } else if (!filePath.startsWith("/")) {
95443
- filePath = join34(baseDir, filePath);
95770
+ filePath = join35(baseDir, filePath);
95444
95771
  }
95445
95772
  if (!existsSync27(filePath)) {
95446
95773
  return { duration: null, resolvedPath: filePath };
@@ -95578,7 +95905,7 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
95578
95905
  if (!existsSync27(filePath)) {
95579
95906
  continue;
95580
95907
  }
95581
- const rawSubHtml = readFileSync13(filePath, "utf-8");
95908
+ const rawSubHtml = readFileSync14(filePath, "utf-8");
95582
95909
  const nestedVisited = new Set(visited);
95583
95910
  nestedVisited.add(filePath);
95584
95911
  workItems.push({ srcPath, filePath, rawSubHtml, nestedVisited });
@@ -95587,7 +95914,7 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
95587
95914
  workItems.map(async (item) => {
95588
95915
  const { html: compiledSub } = await compileHtmlFile(
95589
95916
  item.rawSubHtml,
95590
- dirname15(item.filePath),
95917
+ dirname16(item.filePath),
95591
95918
  downloadDir
95592
95919
  );
95593
95920
  const nested = await parseSubCompositions(
@@ -95762,7 +96089,7 @@ function inlineSubCompositions2(html, subCompositions, projectDir, variableOverr
95762
96089
  if (!compHtml) {
95763
96090
  const filePath = resolve12(projectDir, srcPath);
95764
96091
  if (existsSync27(filePath)) {
95765
- compHtml = readFileSync13(filePath, "utf-8");
96092
+ compHtml = readFileSync14(filePath, "utf-8");
95766
96093
  }
95767
96094
  }
95768
96095
  return compHtml;
@@ -95819,17 +96146,33 @@ function inlineSubCompositions2(html, subCompositions, projectDir, variableOverr
95819
96146
  styleEl.textContent = result.styles.join("\n\n");
95820
96147
  head.appendChild(styleEl);
95821
96148
  }
96149
+ const isHoisted = (item) => Boolean(item.integrity?.trim()) || isNonRelativeUrl(item.src);
95822
96150
  if (body) {
95823
96151
  for (const item of result.scriptItems) {
95824
- if (item.kind === "external") ensureExternalScriptTag(document2, item.src, item);
96152
+ if (item.kind === "external" && isHoisted(item)) {
96153
+ ensureExternalScriptTag(document2, item.src, item);
96154
+ }
95825
96155
  }
95826
96156
  }
95827
96157
  const variablesByCompScript = buildVariablesByCompScript(result.variablesByComp);
95828
- const inlineScripts = variablesByCompScript ? [variablesByCompScript, ...result.scripts] : result.scripts;
95829
- if (inlineScripts.length && body) {
95830
- const scriptEl = document2.createElement("script");
95831
- scriptEl.textContent = inlineScripts.join("\n;\n");
95832
- body.appendChild(scriptEl);
96158
+ if (body) {
96159
+ let pending = variablesByCompScript ? [variablesByCompScript] : [];
96160
+ const flushInline = () => {
96161
+ if (!pending.length) return;
96162
+ const scriptEl = document2.createElement("script");
96163
+ scriptEl.textContent = pending.join("\n;\n");
96164
+ body.appendChild(scriptEl);
96165
+ pending = [];
96166
+ };
96167
+ for (const item of result.scriptItems) {
96168
+ if (item.kind === "inline") {
96169
+ pending.push(item.content);
96170
+ } else if (!isHoisted(item)) {
96171
+ flushInline();
96172
+ ensureExternalScriptTag(document2, item.src, item);
96173
+ }
96174
+ }
96175
+ flushInline();
95833
96176
  }
95834
96177
  emitRootCompositionVariableStyles(
95835
96178
  document2,
@@ -96042,7 +96385,7 @@ async function localizeRemoteMediaSources(html, downloadDir) {
96042
96385
  return downloadAndRewriteUrls(
96043
96386
  urlSet,
96044
96387
  html,
96045
- join34(downloadDir, REMOTE_MEDIA_SUBDIR),
96388
+ join35(downloadDir, REMOTE_MEDIA_SUBDIR),
96046
96389
  "Remote media download failed",
96047
96390
  "Localized remote media source(s)"
96048
96391
  );
@@ -96057,7 +96400,7 @@ async function localizeRemoteImageSources(html, downloadDir) {
96057
96400
  return downloadAndRewriteUrls(
96058
96401
  urlSet,
96059
96402
  html,
96060
- join34(downloadDir, REMOTE_MEDIA_SUBDIR),
96403
+ join35(downloadDir, REMOTE_MEDIA_SUBDIR),
96061
96404
  "Remote image download failed",
96062
96405
  "Localized remote image source(s)"
96063
96406
  );
@@ -96073,7 +96416,7 @@ async function localizeRemoteBackgroundImages(html, downloadDir) {
96073
96416
  return downloadAndRewriteUrls(
96074
96417
  urlSet,
96075
96418
  html,
96076
- join34(downloadDir, REMOTE_MEDIA_SUBDIR),
96419
+ join35(downloadDir, REMOTE_MEDIA_SUBDIR),
96077
96420
  "Remote background-image download failed",
96078
96421
  "Localized remote background-image(s)",
96079
96422
  // Quoted url('..')/url("..") are rewritten by downloadAndRewriteUrls' default
@@ -96208,7 +96551,7 @@ async function localizeRemoteFontFaces(html, downloadDir) {
96208
96551
  return downloadAndRewriteUrls(
96209
96552
  urlSet,
96210
96553
  processed,
96211
- join34(downloadDir, REMOTE_MEDIA_SUBDIR),
96554
+ join35(downloadDir, REMOTE_MEDIA_SUBDIR),
96212
96555
  "Remote font download failed",
96213
96556
  "Localized remote font face(s)",
96214
96557
  (h, url, relPath) => h.replaceAll(`url(${url})`, `url("${relPath}")`)
@@ -96332,7 +96675,7 @@ function rebaseDirectEntryAssetPaths(html, projectDir, htmlPath) {
96332
96675
  }
96333
96676
  async function compileForRender(projectDir, htmlPath, downloadDir, options = {}) {
96334
96677
  const entryHtml = rebaseDirectEntryAssetPaths(
96335
- readFileSync13(htmlPath, "utf-8"),
96678
+ readFileSync14(htmlPath, "utf-8"),
96336
96679
  projectDir,
96337
96680
  htmlPath
96338
96681
  );
@@ -96823,13 +97166,13 @@ async function runCompileStage(input) {
96823
97166
  abortSignal
96824
97167
  } = input;
96825
97168
  const compileStart = Date.now();
96826
- const compiled = await compileForRender(projectDir, htmlPath, join35(workDir, "downloads"), {
97169
+ const compiled = await compileForRender(projectDir, htmlPath, join36(workDir, "downloads"), {
96827
97170
  log,
96828
97171
  failClosedFontFetch: failClosedFontFetch === true,
96829
97172
  allowSystemFontCapture,
96830
97173
  abortSignal,
96831
97174
  variables: input.variables,
96832
- animatedGifCacheDir: cfg.extractCacheDir ? join35(cfg.extractCacheDir, "animated-gif") : void 0,
97175
+ animatedGifCacheDir: cfg.extractCacheDir ? join36(cfg.extractCacheDir, "animated-gif") : void 0,
96833
97176
  ffmpegProcessTimeout: cfg.ffmpegProcessTimeout
96834
97177
  });
96835
97178
  assertNotAborted();
@@ -96891,7 +97234,7 @@ async function runCompileStage(input) {
96891
97234
  };
96892
97235
  await preflightCompositionAssetMediaTypes({
96893
97236
  projectDir,
96894
- compiledDir: join35(workDir, "compiled"),
97237
+ compiledDir: join36(workDir, "compiled"),
96895
97238
  composition,
96896
97239
  signal: abortSignal
96897
97240
  });
@@ -96940,7 +97283,7 @@ init_esm10();
96940
97283
  init_src();
96941
97284
  init_dist2();
96942
97285
  init_dist();
96943
- import { join as join36 } from "path";
97286
+ import { join as join37 } from "path";
96944
97287
 
96945
97288
  // ../producer/src/services/render/stages/probeFailures.ts
96946
97289
  var NETWORK_FAILURE_PATTERN = /404|ERR_NAME_NOT_RESOLVED|ERR_CONNECTION_REFUSED|net::ERR_/i;
@@ -97073,7 +97416,7 @@ async function runProbeStage(input) {
97073
97416
  });
97074
97417
  fileServer = await createFileServer2({
97075
97418
  projectDir,
97076
- compiledDir: join36(workDir, "compiled"),
97419
+ compiledDir: join37(workDir, "compiled"),
97077
97420
  port: 0,
97078
97421
  preHeadScripts: [VIRTUAL_TIME_SHIM],
97079
97422
  fps: job.config.fps
@@ -97099,7 +97442,7 @@ async function runProbeStage(input) {
97099
97442
  log.info("Creating capture session...", { attempt, maxAttempts: PROBE_MAX_ATTEMPTS });
97100
97443
  probeSession = await createCaptureSession(
97101
97444
  fileServer.url,
97102
- join36(workDir, "probe"),
97445
+ join37(workDir, "probe"),
97103
97446
  captureOpts,
97104
97447
  null,
97105
97448
  probeCfg
@@ -97184,7 +97527,7 @@ async function runProbeStage(input) {
97184
97527
  });
97185
97528
  probeSession = await createCaptureSession(
97186
97529
  fileServer.url,
97187
- join36(workDir, "probe-screenshot"),
97530
+ join37(workDir, "probe-screenshot"),
97188
97531
  captureOpts,
97189
97532
  null,
97190
97533
  { ...probeCfg, forceScreenshot: true }
@@ -97220,7 +97563,7 @@ async function runProbeStage(input) {
97220
97563
  compiled,
97221
97564
  resolutions,
97222
97565
  projectDir,
97223
- join36(workDir, "downloads")
97566
+ join37(workDir, "downloads")
97224
97567
  );
97225
97568
  assertNotAborted();
97226
97569
  composition.videos = compiled.videos;
@@ -97399,7 +97742,7 @@ async function runProbeStage(input) {
97399
97742
  try {
97400
97743
  await preflightCompositionAssetMediaTypes({
97401
97744
  projectDir,
97402
- compiledDir: join36(workDir, "compiled"),
97745
+ compiledDir: join37(workDir, "compiled"),
97403
97746
  composition,
97404
97747
  signal: abortSignal
97405
97748
  });
@@ -97527,7 +97870,7 @@ function validateRenderDuration(input) {
97527
97870
  // ../producer/src/services/render/stages/extractVideosStage.ts
97528
97871
  init_src();
97529
97872
  import { existsSync as existsSync28 } from "fs";
97530
- import { join as join37 } from "path";
97873
+ import { join as join38 } from "path";
97531
97874
 
97532
97875
  // ../producer/src/services/render/extractionFailureMetadata.ts
97533
97876
  function stringOrEmpty(value) {
@@ -97820,7 +98163,7 @@ async function runExtractVideosStage(input) {
97820
98163
  // because short boundary counts can differ by one frame.
97821
98164
  {
97822
98165
  fps: job.config.fps,
97823
- outputDir: join37(compiledDir, "__hyperframes_video_frames"),
98166
+ outputDir: join38(compiledDir, "__hyperframes_video_frames"),
97824
98167
  format: job.config.videoFrameFormat ?? "auto",
97825
98168
  toneMapHdrToSdr: job.config.hdrMode === "force-sdr",
97826
98169
  timelineEnd: composition.duration,
@@ -97886,7 +98229,7 @@ function appendAutoDetectedVideoAudio(composition, extracted) {
97886
98229
 
97887
98230
  // ../producer/src/services/render/stages/audioStage.ts
97888
98231
  init_src();
97889
- import { join as join38 } from "path";
98232
+ import { join as join39 } from "path";
97890
98233
  async function runAudioStage(input) {
97891
98234
  const {
97892
98235
  projectDir,
@@ -97901,7 +98244,7 @@ async function runAudioStage(input) {
97901
98244
  log
97902
98245
  } = input;
97903
98246
  const stage3Start = Date.now();
97904
- const audioOutputPath = join38(workDir, MIXED_AUDIO_FILENAME);
98247
+ const audioOutputPath = join39(workDir, MIXED_AUDIO_FILENAME);
97905
98248
  let hasAudio = false;
97906
98249
  let audioError;
97907
98250
  let audioFailures;
@@ -97911,7 +98254,7 @@ async function runAudioStage(input) {
97911
98254
  audioResult = await processCompositionAudio(
97912
98255
  audios,
97913
98256
  projectDir,
97914
- join38(workDir, "audio-work"),
98257
+ join39(workDir, "audio-work"),
97915
98258
  audioOutputPath,
97916
98259
  duration,
97917
98260
  abortSignal,
@@ -97983,7 +98326,7 @@ async function runAudioStage(input) {
97983
98326
  // ../producer/src/services/render/stages/captureStage.ts
97984
98327
  init_src();
97985
98328
  import { existsSync as existsSync29, readdirSync as readdirSync10, statfsSync as statfsSync2 } from "fs";
97986
- import { join as join39 } from "path";
98329
+ import { join as join40 } from "path";
97987
98330
  function shouldAllowAdaptiveCaptureRetry(workerCount, _explicitlyConfigured) {
97988
98331
  return workerCount > 1;
97989
98332
  }
@@ -98038,13 +98381,13 @@ function measureCaptureFrameBytes(workDir, framesDir) {
98038
98381
  if (!existsSync29(workDir)) return total;
98039
98382
  for (const attempt of readdirSync10(workDir)) {
98040
98383
  if (/^retry-\d+-batch-\d+-worker-\d+$/.test(attempt)) {
98041
- total += sampleDirectoryBytes(join39(workDir, attempt));
98384
+ total += sampleDirectoryBytes(join40(workDir, attempt));
98042
98385
  continue;
98043
98386
  }
98044
98387
  if (!/^capture-attempt-\d+$/.test(attempt)) continue;
98045
- const attemptDir = join39(workDir, attempt);
98388
+ const attemptDir = join40(workDir, attempt);
98046
98389
  for (const name of readdirSync10(attemptDir)) {
98047
- if (/^worker-\d+$/.test(name)) total += sampleDirectoryBytes(join39(attemptDir, name));
98390
+ if (/^worker-\d+$/.test(name)) total += sampleDirectoryBytes(join40(attemptDir, name));
98048
98391
  }
98049
98392
  }
98050
98393
  return total;
@@ -98125,19 +98468,20 @@ async function runCaptureStage(input) {
98125
98468
  frameRangeStart: frameRange?.startFrame,
98126
98469
  dedupPerfs,
98127
98470
  onProgress: (progress) => {
98471
+ if (progress.latestWorkerPhase) {
98472
+ if (progress.capturedFrames === 0) reportWorkerStartup(job, progress, onProgress);
98473
+ return;
98474
+ }
98128
98475
  job.framesRendered = progress.capturedFrames;
98129
98476
  checkDiskProjection(progress.capturedFrames);
98130
98477
  const frameProgress = progress.capturedFrames / progress.totalFrames;
98131
- const progressPct = 25 + frameProgress * 45;
98132
- if (progress.capturedFrames % 30 === 0 || progress.capturedFrames === progress.totalFrames) {
98133
- updateJobStatus(
98134
- job,
98135
- "rendering",
98136
- `Capturing frame ${progress.capturedFrames}/${progress.totalFrames} (${progress.activeWorkers} workers)`,
98137
- Math.round(progressPct),
98138
- onProgress
98139
- );
98140
- }
98478
+ reportFrameProgress(
98479
+ job,
98480
+ `Capturing frame ${progress.capturedFrames}/${progress.totalFrames} (${progress.activeWorkers} workers)`,
98481
+ Math.round(25 + frameProgress * 45),
98482
+ onProgress,
98483
+ progress.capturedFrames === progress.totalFrames
98484
+ );
98141
98485
  },
98142
98486
  cfg: captureCfg,
98143
98487
  log
@@ -98267,12 +98611,12 @@ async function captureSessionFrames(session, { input, rangeStart, rangeEnd, resu
98267
98611
  const reportFrame = (fileIndex) => {
98268
98612
  job.framesRendered = fileIndex + 1;
98269
98613
  checkDiskProjection(fileIndex + 1);
98270
- updateJobStatus(
98614
+ reportFrameProgress(
98271
98615
  job,
98272
- "rendering",
98273
98616
  `Capturing frame ${fileIndex + 1}/${rangeFrames}`,
98274
98617
  Math.round(25 + (fileIndex + 1) / rangeFrames * 45),
98275
- onProgress
98618
+ onProgress,
98619
+ fileIndex + 1 === rangeFrames
98276
98620
  );
98277
98621
  };
98278
98622
  if (session.workerEncodeEnabled) {
@@ -98320,7 +98664,7 @@ async function captureSessionFrames(session, { input, rangeStart, rangeEnd, resu
98320
98664
  init_src();
98321
98665
  init_dist2();
98322
98666
  import { existsSync as existsSync31, mkdirSync as mkdirSync17 } from "fs";
98323
- import { join as join43 } from "path";
98667
+ import { join as join44 } from "path";
98324
98668
 
98325
98669
  // ../producer/src/services/hdrImageTransferCache.ts
98326
98670
  init_src();
@@ -98384,7 +98728,7 @@ function createHdrImageTransferCache(options = {}) {
98384
98728
 
98385
98729
  // ../producer/src/services/render/stages/captureHdrSequentialLoop.ts
98386
98730
  init_src();
98387
- import { join as join40 } from "path";
98731
+ import { join as join41 } from "path";
98388
98732
  async function runSequentialLayeredFrameLoop(input) {
98389
98733
  const {
98390
98734
  job,
@@ -98505,7 +98849,7 @@ async function runSequentialLayeredFrameLoop(input) {
98505
98849
  );
98506
98850
  if (debugDumpEnabled && debugDumpDir && i % 30 === 0) {
98507
98851
  writeFileExclusiveSync(
98508
- join40(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
98852
+ join41(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
98509
98853
  normalCanvas
98510
98854
  );
98511
98855
  }
@@ -98525,28 +98869,25 @@ async function runSequentialLayeredFrameLoop(input) {
98525
98869
  log
98526
98870
  });
98527
98871
  job.framesRendered = i + 1;
98528
- if ((i + 1) % 10 === 0 || i + 1 === totalFrames) {
98529
- const frameProgress = (i + 1) / totalFrames;
98530
- updateJobStatus(
98531
- job,
98532
- "rendering",
98533
- `Layered composite frame ${i + 1}/${job.totalFrames}`,
98534
- Math.round(25 + frameProgress * 55),
98535
- onProgress
98536
- );
98537
- }
98872
+ reportFrameProgress(
98873
+ job,
98874
+ `Layered composite frame ${i + 1}/${job.totalFrames}`,
98875
+ Math.round(25 + (i + 1) / totalFrames * 55),
98876
+ onProgress,
98877
+ i + 1 === totalFrames
98878
+ );
98538
98879
  }
98539
98880
  }
98540
98881
 
98541
98882
  // ../producer/src/services/render/stages/captureHdrHybridLoop.ts
98542
98883
  init_src();
98543
- import { join as join42 } from "path";
98884
+ import { join as join43 } from "path";
98544
98885
 
98545
98886
  // ../producer/src/services/shaderTransitionWorkerPool.ts
98546
98887
  import { Worker as Worker2 } from "worker_threads";
98547
- import { fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL2 } from "url";
98548
- import { dirname as dirname16, join as join41 } from "path";
98549
- import { createRequire as createRequire2 } from "module";
98888
+ import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL2 } from "url";
98889
+ import { dirname as dirname17, join as join42 } from "path";
98890
+ import { createRequire } from "module";
98550
98891
  import { existsSync as existsSync30 } from "fs";
98551
98892
  import { cpus as cpus3 } from "os";
98552
98893
  function resolveWorkerEntry(explicit) {
@@ -98558,10 +98899,10 @@ function resolveWorkerEntry(explicit) {
98558
98899
  const isTs = override.endsWith(".ts");
98559
98900
  return { path: override, isTs };
98560
98901
  }
98561
- const moduleDir = dirname16(fileURLToPath4(import.meta.url));
98562
- const jsPath = join41(moduleDir, "shaderTransitionWorker.js");
98902
+ const moduleDir = dirname17(fileURLToPath5(import.meta.url));
98903
+ const jsPath = join42(moduleDir, "shaderTransitionWorker.js");
98563
98904
  if (existsSync30(jsPath)) return { path: jsPath, isTs: false };
98564
- const tsPath = join41(moduleDir, "shaderTransitionWorker.ts");
98905
+ const tsPath = join42(moduleDir, "shaderTransitionWorker.ts");
98565
98906
  return { path: tsPath, isTs: true };
98566
98907
  }
98567
98908
  function buildExecArgv(entryIsTs) {
@@ -98572,7 +98913,7 @@ function buildExecArgv(entryIsTs) {
98572
98913
  );
98573
98914
  if (hasLoader) return inherited;
98574
98915
  try {
98575
- const require2 = createRequire2(import.meta.url);
98916
+ const require2 = createRequire(import.meta.url);
98576
98917
  const tsxEsm = require2.resolve("tsx/esm");
98577
98918
  inherited.push("--import", pathToFileURL2(tsxEsm).href);
98578
98919
  } catch {
@@ -98826,16 +99167,13 @@ async function runHybridLayeredFrameLoop(input) {
98826
99167
  reorderBuffer.advanceTo(frameIdx + 1);
98827
99168
  framesWritten += 1;
98828
99169
  job.framesRendered = framesWritten;
98829
- if (framesWritten % 10 === 0 || framesWritten === totalFrames) {
98830
- const frameProgress = framesWritten / totalFrames;
98831
- updateJobStatus(
98832
- job,
98833
- "rendering",
98834
- `Layered composite frame ${framesWritten}/${job.totalFrames}`,
98835
- Math.round(25 + frameProgress * 55),
98836
- onProgress
98837
- );
98838
- }
99170
+ reportFrameProgress(
99171
+ job,
99172
+ `Layered composite frame ${framesWritten}/${job.totalFrames}`,
99173
+ Math.round(25 + framesWritten / totalFrames * 55),
99174
+ onProgress,
99175
+ framesWritten === totalFrames
99176
+ );
98839
99177
  };
98840
99178
  const poolRef = shaderPool;
98841
99179
  const workerTaskOf = async (w) => {
@@ -98931,7 +99269,7 @@ async function runHybridLayeredFrameLoop(input) {
98931
99269
  );
98932
99270
  if (debugDumpEnabled && debugDumpDir && i % 30 === 0) {
98933
99271
  writeFileExclusiveSync(
98934
- join42(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
99272
+ join43(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
98935
99273
  canvas
98936
99274
  );
98937
99275
  }
@@ -99117,7 +99455,7 @@ async function runCaptureHdrStage(input) {
99117
99455
  if (hdrVideoFrameSources.has(v.id)) hdrVideoEndTimes.set(v.id, v.end);
99118
99456
  }
99119
99457
  const debugDumpEnabled = process.env.KEEP_TEMP === "1";
99120
- const debugDumpDir = debugDumpEnabled ? join43(framesDir, "debug-composite") : null;
99458
+ const debugDumpDir = debugDumpEnabled ? join44(framesDir, "debug-composite") : null;
99121
99459
  if (debugDumpDir && !existsSync31(debugDumpDir)) {
99122
99460
  mkdirSync17(debugDumpDir, { recursive: true });
99123
99461
  }
@@ -99269,10 +99607,10 @@ async function runCaptureHdrStage(input) {
99269
99607
  // ../producer/src/services/render/stages/encodeStage.ts
99270
99608
  init_src();
99271
99609
  import { copyFileSync as copyFileSync5, existsSync as existsSync32, mkdirSync as mkdirSync18, readdirSync as readdirSync11, rmSync as rmSync13, statSync as statSync11 } from "fs";
99272
- import { dirname as dirname17, join as join45 } from "path";
99610
+ import { dirname as dirname18, join as join46 } from "path";
99273
99611
 
99274
99612
  // ../producer/src/services/render/stages/gifEncodeArgs.ts
99275
- import { join as join44 } from "path";
99613
+ import { join as join45 } from "path";
99276
99614
  function fpsToFfmpegArg2(fps) {
99277
99615
  return fps.den === 1 ? String(fps.num) : `${fps.num}/${fps.den}`;
99278
99616
  }
@@ -99284,7 +99622,7 @@ function buildGifPalettegenArgs(input) {
99284
99622
  "-framerate",
99285
99623
  fpsArg,
99286
99624
  "-i",
99287
- join44(input.framesDir, input.framePattern),
99625
+ join45(input.framesDir, input.framePattern),
99288
99626
  "-vf",
99289
99627
  `fps=${fpsArg},palettegen=stats_mode=diff${transparency}`,
99290
99628
  input.palettePath
@@ -99298,7 +99636,7 @@ function buildGifPaletteuseArgs(input) {
99298
99636
  "-framerate",
99299
99637
  fpsArg,
99300
99638
  "-i",
99301
- join44(input.framesDir, input.framePattern),
99639
+ join45(input.framesDir, input.framePattern),
99302
99640
  "-i",
99303
99641
  input.palettePath,
99304
99642
  "-lavfi",
@@ -99418,11 +99756,11 @@ async function runEncodeStage(input) {
99418
99756
  );
99419
99757
  }
99420
99758
  captured.forEach((name, i) => {
99421
- const dst = join45(outputPath, formatExportFrameName(i, "png"));
99422
- copyFileSync5(join45(framesDir, name), dst);
99759
+ const dst = join46(outputPath, formatExportFrameName(i, "png"));
99760
+ copyFileSync5(join46(framesDir, name), dst);
99423
99761
  });
99424
99762
  if (hasAudio && audioOutputPath && existsSync32(audioOutputPath)) {
99425
- copyFileSync5(audioOutputPath, join45(outputPath, MIXED_AUDIO_FILENAME));
99763
+ copyFileSync5(audioOutputPath, join46(outputPath, MIXED_AUDIO_FILENAME));
99426
99764
  log.info(
99427
99765
  `[Render] png-sequence: ${MIXED_AUDIO_FILENAME} sidecar written to ${outputPath}/${MIXED_AUDIO_FILENAME}`
99428
99766
  );
@@ -99441,7 +99779,7 @@ async function runEncodeStage(input) {
99441
99779
  const encodeResult2 = await encodeGifFromDir(framesDir, framePattern2, outputPath, {
99442
99780
  fps: job.config.fps,
99443
99781
  loop,
99444
- palettePath: join45(dirname17(videoOnlyPath), "gif-palette.png"),
99782
+ palettePath: join46(dirname18(videoOnlyPath), "gif-palette.png"),
99445
99783
  preserveAlpha: needsAlpha,
99446
99784
  signal: abortSignal,
99447
99785
  timeout: engineCfg.ffmpegEncodeTimeout
@@ -99508,7 +99846,7 @@ init_src();
99508
99846
  init_dist2();
99509
99847
  import { spawn as spawn5 } from "child_process";
99510
99848
  import { mkdtempSync as mkdtempSync10, renameSync as renameSync7, rmSync as rmSync14 } from "fs";
99511
- import { dirname as dirname18, join as join46 } from "path";
99849
+ import { dirname as dirname19, join as join47 } from "path";
99512
99850
  var AUDIO_DURATION_TOLERANCE_SECONDS = 1e-3;
99513
99851
  var AAC_DELIVERY_TRUE_PEAK_DBFS = -1;
99514
99852
  var AAC_TRUE_PEAK_CORRECTION_HEADROOM_DB = 0.5;
@@ -99709,8 +100047,8 @@ async function padOrTrimAudioToVideoFrameCount(input) {
99709
100047
  async function enforceAacTruePeak(input) {
99710
100048
  let scratchDir;
99711
100049
  try {
99712
- scratchDir = mkdtempSync10(join46(dirname18(input.audioPath), ".true-peak-"));
99713
- const correctedPath = join46(scratchDir, "audio.m4a");
100050
+ scratchDir = mkdtempSync10(join47(dirname19(input.audioPath), ".true-peak-"));
100051
+ const correctedPath = join47(scratchDir, "audio.m4a");
99714
100052
  const correctionTargetDbfs = AAC_DELIVERY_TRUE_PEAK_DBFS - AAC_TRUE_PEAK_CORRECTION_HEADROOM_DB;
99715
100053
  const measurements = [];
99716
100054
  let attenuationDb = 0;
@@ -100013,7 +100351,7 @@ function sampleDirectoryBytes(dir) {
100013
100351
  continue;
100014
100352
  }
100015
100353
  for (const name of entries2) {
100016
- const full2 = join47(current2, name);
100354
+ const full2 = join48(current2, name);
100017
100355
  try {
100018
100356
  const st = statSync12(full2);
100019
100357
  if (st.isDirectory()) {
@@ -100162,7 +100500,7 @@ function findMissingFrameRanges(totalFrames, framesDir, frameExt) {
100162
100500
  const ranges = [];
100163
100501
  let rangeStart = null;
100164
100502
  for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
100165
- const framePath = join47(framesDir, formatCaptureFrameName(frameIndex, frameExt));
100503
+ const framePath = join48(framesDir, formatCaptureFrameName(frameIndex, frameExt));
100166
100504
  const missing = !existsSync33(framePath) || statSync12(framePath).size <= 8;
100167
100505
  if (missing && rangeStart === null) {
100168
100506
  rangeStart = frameIndex;
@@ -100185,7 +100523,7 @@ function buildMissingFrameRetryBatches(ranges, maxWorkers, workDir, attempt, ran
100185
100523
  workerId,
100186
100524
  startFrame: rangeStart + range.startFrame,
100187
100525
  endFrame: rangeStart + range.endFrame,
100188
- outputDir: join47(workDir, `retry-${attempt}-batch-${batchIndex}-worker-${workerId}`),
100526
+ outputDir: join48(workDir, `retry-${attempt}-batch-${batchIndex}-worker-${workerId}`),
100189
100527
  outputFrameOffset: rangeStart
100190
100528
  }));
100191
100529
  batches.push(batch);
@@ -100213,8 +100551,8 @@ function getNextRetryWorkerCount(currentWorkers) {
100213
100551
  return Math.max(1, Math.floor(currentWorkers / 2));
100214
100552
  }
100215
100553
  function resolveRenderWorkDirPrefix(outputPath, jobId, platform3 = process.platform, systemTempDir = tmpdir7()) {
100216
- if (platform3 === "win32") return join47(systemTempDir, "hf-render-");
100217
- return join47(dirname19(outputPath), `work-${jobId}-`);
100554
+ if (platform3 === "win32") return join48(systemTempDir, "hf-render-");
100555
+ return join48(dirname20(outputPath), `work-${jobId}-`);
100218
100556
  }
100219
100557
  var MAX_TRANSIENT_CAPTURE_RETRIES = 1;
100220
100558
  function isTransientCaptureRetryEligible(failureKind, missing, retriesUsed) {
@@ -100246,7 +100584,7 @@ The composition is too large for the available memory. To reduce memory pressure
100246
100584
  function countCapturedFrames(totalFrames, framesDir, frameExt) {
100247
100585
  let captured = 0;
100248
100586
  for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
100249
- const framePath = join47(framesDir, formatCaptureFrameName(frameIndex, frameExt));
100587
+ const framePath = join48(framesDir, formatCaptureFrameName(frameIndex, frameExt));
100250
100588
  if (existsSync33(framePath)) captured++;
100251
100589
  }
100252
100590
  return captured;
@@ -100272,7 +100610,7 @@ async function executeDiskCaptureWithAdaptiveRetry(options) {
100272
100610
  reason: attempt === 0 ? "initial" : pendingTransientRetry ? "transient-retry" : "retry"
100273
100611
  });
100274
100612
  pendingTransientRetry = false;
100275
- const attemptWorkDir = join47(options.workDir, `capture-attempt-${attempt}`);
100613
+ const attemptWorkDir = join48(options.workDir, `capture-attempt-${attempt}`);
100276
100614
  const batches = missingRanges ? buildMissingFrameRetryBatches(
100277
100615
  missingRanges,
100278
100616
  currentWorkers,
@@ -100886,15 +101224,15 @@ function deVerifyFallbackTelemetry(err) {
100886
101224
  }
100887
101225
  async function executeRenderJob(job, projectDir, outputPath, progressSink, abortSignal, assertRenderActive) {
100888
101226
  validateHlsRenderConfig(job.config);
100889
- const moduleDir = dirname19(fileURLToPath5(import.meta.url));
101227
+ const moduleDir = dirname20(fileURLToPath6(import.meta.url));
100890
101228
  const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve13(process.env.PRODUCER_RENDERS_DIR, "..") : resolve13(moduleDir, "../..");
100891
- const debugDir = join47(producerRoot, ".debug");
100892
- const outputDir = dirname19(outputPath);
101229
+ const debugDir = join48(producerRoot, ".debug");
101230
+ const outputDir = dirname20(outputPath);
100893
101231
  if (!existsSync33(outputDir)) mkdirSync19(outputDir, { recursive: true });
100894
- const workDir = job.config.debug ? join47(debugDir, job.id) : mkdtempSync11(resolveRenderWorkDirPrefix(outputPath, job.id));
101232
+ const workDir = job.config.debug ? join48(debugDir, job.id) : mkdtempSync11(resolveRenderWorkDirPrefix(outputPath, job.id));
100895
101233
  const pipelineStart = Date.now();
100896
101234
  const baseLog = job.config.logger ?? defaultLogger;
100897
- const logPath = job.config.debug ? join47(workDir, "render.log") : null;
101235
+ const logPath = job.config.debug ? join48(workDir, "render.log") : null;
100898
101236
  const execution = new RenderExecutionContext({
100899
101237
  request: { renderJobId: job.id, projectDir, outputPath },
100900
101238
  logger: logPath ? createRenderFileLogger(logPath, baseLog) : baseLog,
@@ -100952,7 +101290,7 @@ async function executeRenderPipeline(input) {
100952
101290
  imageDecodeFailures: 0
100953
101291
  };
100954
101292
  let hdrPerf;
100955
- const perfOutputPath = join47(workDir, "perf-summary.json");
101293
+ const perfOutputPath = join48(workDir, "perf-summary.json");
100956
101294
  const cfg = { ...job.config.producerConfig ?? resolveConfig() };
100957
101295
  const observability = new RenderObservabilityRecorder({
100958
101296
  pipelineStartMs: pipelineStart,
@@ -101051,22 +101389,22 @@ async function executeRenderPipeline(input) {
101051
101389
  requestedWorkers: job.config.workers ?? "auto"
101052
101390
  });
101053
101391
  const entryFile = job.config.entryFile || "index.html";
101054
- let htmlPath = join47(projectDir, entryFile);
101392
+ let htmlPath = join48(projectDir, entryFile);
101055
101393
  if (!existsSync33(htmlPath)) {
101056
101394
  throw new Error(`Entry file not found: ${htmlPath}`);
101057
101395
  }
101058
101396
  assertNotAborted();
101059
- const rawEntry = readFileSync14(htmlPath, "utf-8");
101397
+ const rawEntry = readFileSync15(htmlPath, "utf-8");
101060
101398
  if (entryFile !== "index.html" && rawEntry.trimStart().startsWith("<template")) {
101061
- const wrapperPath = join47(workDir, "standalone-entry.html");
101062
- const projectIndexPath = join47(projectDir, "index.html");
101399
+ const wrapperPath = join48(workDir, "standalone-entry.html");
101400
+ const projectIndexPath = join48(projectDir, "index.html");
101063
101401
  if (!existsSync33(projectIndexPath)) {
101064
101402
  throw new Error(
101065
101403
  `Template entry file "${entryFile}" requires a project index.html to extract its render shell.`
101066
101404
  );
101067
101405
  }
101068
101406
  const standaloneHtml = extractStandaloneEntryFromIndex(
101069
- readFileSync14(projectIndexPath, "utf-8"),
101407
+ readFileSync15(projectIndexPath, "utf-8"),
101070
101408
  entryFile,
101071
101409
  rawEntry
101072
101410
  );
@@ -101215,7 +101553,7 @@ async function executeRenderPipeline(input) {
101215
101553
  beginFrameStalled: probeResult.beginFrameStalled
101216
101554
  });
101217
101555
  updateJobStatus(job, "preprocessing", "Extracting video frames", 10, onProgress);
101218
- const compiledDir = join47(workDir, "compiled");
101556
+ const compiledDir = join48(workDir, "compiled");
101219
101557
  const extractResult = await observeRenderStage(
101220
101558
  observability,
101221
101559
  "video_extract",
@@ -101341,7 +101679,7 @@ async function executeRenderPipeline(input) {
101341
101679
  try {
101342
101680
  fileServer = await createFileServer2({
101343
101681
  projectDir,
101344
- compiledDir: join47(workDir, "compiled"),
101682
+ compiledDir: join48(workDir, "compiled"),
101345
101683
  port: 0,
101346
101684
  preHeadScripts: [VIRTUAL_TIME_SHIM],
101347
101685
  fps: job.config.fps
@@ -101359,8 +101697,9 @@ async function executeRenderPipeline(input) {
101359
101697
  if (!activeFileServer) {
101360
101698
  throw new Error("File server failed to initialize before frame capture");
101361
101699
  }
101362
- const framesDir = join47(workDir, "captured-frames");
101700
+ const framesDir = join48(workDir, "captured-frames");
101363
101701
  if (!existsSync33(framesDir)) mkdirSync19(framesDir, { recursive: true });
101702
+ updateJobStatus(job, "rendering", "Checking browser GPU", 25, onProgress);
101364
101703
  const resolvedBrowserGpuMode = await resolveBrowserGpuMode(cfg.browserGpuMode, {
101365
101704
  chromePath: resolveHeadlessShellPath(cfg),
101366
101705
  browserTimeout: cfg.browserTimeout
@@ -101553,6 +101892,7 @@ async function executeRenderPipeline(input) {
101553
101892
  }
101554
101893
  });
101555
101894
  if (job.config.workers === void 0 && totalFrames >= 60 && !htmlInCanvasDetected && !cfg.lowMemoryMode && !deInversionEligible && !deParallelRouterEligible) {
101895
+ updateJobStatus(job, "rendering", "Measuring capture speed", 25, onProgress);
101556
101896
  const outcome = await observeRenderStage(
101557
101897
  observability,
101558
101898
  "capture_calibration",
@@ -101768,7 +102108,7 @@ async function executeRenderPipeline(input) {
101768
102108
  hls: ".mp4"
101769
102109
  };
101770
102110
  const videoExt = FORMAT_EXT[outputFormat] ?? ".mp4";
101771
- const videoOnlyPath = join47(workDir, `video-only${videoExt}`);
102111
+ const videoOnlyPath = join48(workDir, `video-only${videoExt}`);
101772
102112
  const usePageSideCompositingForTransitions = (cfg.enablePageSideCompositing || isGif) && compiled.hasShaderTransitions && !hasHdrContent && outputSupportsPageSideShaderCompositing(outputFormat);
101773
102113
  if (usePageSideCompositingForTransitions) {
101774
102114
  activeFileServer.addPreHeadScript(HF_PAGE_SIDE_COMPOSITING_STUB);
@@ -102010,7 +102350,7 @@ async function executeRenderPipeline(input) {
102010
102350
  outputHeight: captureCompositionHeight ?? height,
102011
102351
  motionBlur: job.config.motionBlur ? JSON.stringify(job.config.motionBlur) : ""
102012
102352
  });
102013
- const segmentDir = segmentDirFor(join47(projectDir, "renders"), segmentPlanHash);
102353
+ const segmentDir = segmentDirFor(join48(projectDir, "renders"), segmentPlanHash);
102014
102354
  let completedSegments = /* @__PURE__ */ new Set();
102015
102355
  if (job.config.resumeSegments === true) {
102016
102356
  const existing = readSegmentManifest(segmentDir);
@@ -102557,7 +102897,7 @@ async function executeRenderPipeline(input) {
102557
102897
  }
102558
102898
  if (job.config.debug) {
102559
102899
  if (!isPngSequence && !isHls && existsSync33(stagedOutputPath)) {
102560
- const debugOutput = join47(workDir, `output${videoExt}`);
102900
+ const debugOutput = join48(workDir, `output${videoExt}`);
102561
102901
  copyFileSync6(stagedOutputPath, debugOutput);
102562
102902
  }
102563
102903
  }
@@ -102904,7 +103244,7 @@ import {
102904
103244
  rmSync as rmSync16,
102905
103245
  createReadStream as createReadStream5
102906
103246
  } from "fs";
102907
- import { resolve as resolve15, dirname as dirname21, join as join50 } from "path";
103247
+ import { resolve as resolve15, dirname as dirname22, join as join51 } from "path";
102908
103248
  import { tmpdir as tmpdir8 } from "os";
102909
103249
  import { parseArgs } from "util";
102910
103250
  import crypto from "crypto";
@@ -102916,14 +103256,14 @@ import { serve as serve3 } from "@hono/node-server";
102916
103256
  init_dist3();
102917
103257
  import {
102918
103258
  existsSync as existsSync34,
102919
- readFileSync as readFileSync15,
103259
+ readFileSync as readFileSync16,
102920
103260
  statSync as statSync13,
102921
103261
  openSync as openSync8,
102922
103262
  fstatSync as fstatSync5,
102923
103263
  closeSync as closeSync9,
102924
103264
  constants as constants5
102925
103265
  } from "fs";
102926
- import { resolve as resolve14, join as join48, relative as relative5, isAbsolute as isAbsolute5, sep as sep4 } from "path";
103266
+ import { resolve as resolve14, join as join49, relative as relative5, isAbsolute as isAbsolute5, sep as sep4 } from "path";
102927
103267
  function isStringRecord(value) {
102928
103268
  if (!value || typeof value !== "object" || Array.isArray(value)) {
102929
103269
  return false;
@@ -102961,7 +103301,7 @@ function readEntryHtml(filePath) {
102961
103301
  }
102962
103302
  try {
102963
103303
  if (!fstatSync5(fd).isFile()) return null;
102964
- return readFileSync15(fd, "utf-8");
103304
+ return readFileSync16(fd, "utf-8");
102965
103305
  } finally {
102966
103306
  closeSync9(fd);
102967
103307
  }
@@ -102990,7 +103330,7 @@ function readProjectEntryFile(projectDir, preferredEntryFile) {
102990
103330
  }
102991
103331
  }
102992
103332
  return {
102993
- error: `No HTML entry file found in project directory: ${join48(absProjectDir, preferredEntryFile || "index.html")}`
103333
+ error: `No HTML entry file found in project directory: ${join49(absProjectDir, preferredEntryFile || "index.html")}`
102994
103334
  };
102995
103335
  }
102996
103336
  function prepareHyperframeLintBody(body) {
@@ -103032,8 +103372,8 @@ async function runHyperframeLint(prepared) {
103032
103372
 
103033
103373
  // ../producer/src/services/healthWorker.ts
103034
103374
  import { Worker as Worker3 } from "worker_threads";
103035
- import { fileURLToPath as fileURLToPath6 } from "url";
103036
- import { dirname as dirname20, join as join49 } from "path";
103375
+ import { fileURLToPath as fileURLToPath7 } from "url";
103376
+ import { dirname as dirname21, join as join50 } from "path";
103037
103377
  import { existsSync as existsSync35 } from "fs";
103038
103378
  var DEFAULT_HEALTH_PORT = 9848;
103039
103379
  async function startHealthWorker(options = {}) {
@@ -103108,8 +103448,8 @@ function defaultLogger2() {
103108
103448
  };
103109
103449
  }
103110
103450
  function resolveWorkerEntry2() {
103111
- const here = dirname20(fileURLToPath6(import.meta.url));
103112
- const candidates = [join49(here, "healthWorkerThread.js"), join49(here, "healthWorkerThread.ts")];
103451
+ const here = dirname21(fileURLToPath7(import.meta.url));
103452
+ const candidates = [join50(here, "healthWorkerThread.js"), join50(here, "healthWorkerThread.ts")];
103113
103453
  for (const candidate of candidates) {
103114
103454
  if (existsSync35(candidate)) return candidate;
103115
103455
  }
@@ -103246,7 +103586,7 @@ function buildRenderJobConfig(input, outputPath, log) {
103246
103586
  function resolvePreparedRenderOutput(prepared, rendersDir, log) {
103247
103587
  const { input, cleanupProjectDir } = prepared;
103248
103588
  const absoluteOutputPath = resolveOutputPath(input.projectDir, input.outputPath, rendersDir, log);
103249
- const outputDir = dirname21(absoluteOutputPath);
103589
+ const outputDir = dirname22(absoluteOutputPath);
103250
103590
  if (!existsSync36(outputDir)) mkdirSync20(outputDir, { recursive: true });
103251
103591
  return { input, cleanupProjectDir, absoluteOutputPath };
103252
103592
  }
@@ -103314,8 +103654,8 @@ async function resolveInlineRenderHtml(body) {
103314
103654
  }
103315
103655
  function materializeInlineProject(html, options) {
103316
103656
  const tempRoot = process.env.PRODUCER_TMP_PROJECT_DIR || tmpdir8();
103317
- const tempProjectDir = mkdtempSync12(join50(tempRoot, "producer-project-"));
103318
- writeFileSync12(join50(tempProjectDir, "index.html"), html, "utf-8");
103657
+ const tempProjectDir = mkdtempSync12(join51(tempRoot, "producer-project-"));
103658
+ writeFileSync12(join51(tempProjectDir, "index.html"), html, "utf-8");
103319
103659
  return {
103320
103660
  prepared: {
103321
103661
  input: { projectDir: tempProjectDir, ...options },
@@ -103766,11 +104106,11 @@ init_src();
103766
104106
  init_dist2();
103767
104107
  init_src();
103768
104108
  import { cpSync as cpSync2, existsSync as existsSync39, mkdirSync as mkdirSync22, renameSync as renameSync8, rmSync as rmSync17, writeFileSync as writeFileSync14 } from "fs";
103769
- import { join as join54, relative as relative8, sep as sep5 } from "path";
104109
+ import { join as join55, relative as relative8, sep as sep5 } from "path";
103770
104110
 
103771
104111
  // ../producer/src/services/render/stages/freezePlan.ts
103772
- import { existsSync as existsSync37, mkdirSync as mkdirSync21, readFileSync as readFileSync16, readdirSync as readdirSync13, writeFileSync as writeFileSync13 } from "fs";
103773
- import { join as join51, relative as relative6, resolve as resolve16 } from "path";
104112
+ import { existsSync as existsSync37, mkdirSync as mkdirSync21, readFileSync as readFileSync17, readdirSync as readdirSync13, writeFileSync as writeFileSync13 } from "fs";
104113
+ import { join as join52, relative as relative6, resolve as resolve16 } from "path";
103774
104114
 
103775
104115
  // ../producer/src/services/distributed/planProtocol.ts
103776
104116
  var PLAN_SCHEMA_VERSION = 1;
@@ -103812,9 +104152,9 @@ var FIELD_DELIMITER = Buffer.from([0]);
103812
104152
  // ../producer/src/services/distributed/shared.ts
103813
104153
  init_src();
103814
104154
  import { execFile as execFileCallback } from "child_process";
103815
- import { dirname as dirname22, join as join52 } from "path";
103816
- import { existsSync as existsSync38, readFileSync as readFileSync17 } from "fs";
103817
- import { fileURLToPath as fileURLToPath7 } from "url";
104155
+ import { dirname as dirname23, join as join53 } from "path";
104156
+ import { existsSync as existsSync38, readFileSync as readFileSync18 } from "fs";
104157
+ import { fileURLToPath as fileURLToPath8 } from "url";
103818
104158
  import { promisify as promisify5 } from "util";
103819
104159
  var PLAN_AUDIO_RELATIVE_PATH = MIXED_AUDIO_FILENAME;
103820
104160
  var execFile4 = promisify5(execFileCallback);
@@ -103822,7 +104162,7 @@ var execFile4 = promisify5(execFileCallback);
103822
104162
  // ../producer/src/services/distributed/planSize.ts
103823
104163
  import { createHash as createHash12 } from "crypto";
103824
104164
  import { lstatSync as lstatSync5, readdirSync as readdirSync14 } from "fs";
103825
- import { extname as extname7, join as join53, relative as relative7 } from "path";
104165
+ import { extname as extname7, join as join54, relative as relative7 } from "path";
103826
104166
  var PLAN_ROOT_CATEGORY = {
103827
104167
  compiled: "compiled",
103828
104168
  [PLAN_AUDIO_RELATIVE_PATH]: "audio",
@@ -103834,9 +104174,9 @@ var PLAN_ROOT_CATEGORY = {
103834
104174
  var PLAN_DIR_SIZE_LIMIT_BYTES = 2 * 1024 * 1024 * 1024;
103835
104175
  var FREEZE_OWNED_PLAN_FILES = [
103836
104176
  "plan.json",
103837
- join54("meta", "composition.json"),
103838
- join54("meta", "encoder.json"),
103839
- join54("meta", "chunks.json")
104177
+ join55("meta", "composition.json"),
104178
+ join55("meta", "encoder.json"),
104179
+ join55("meta", "chunks.json")
103840
104180
  ];
103841
104181
 
103842
104182
  // ../producer/src/services/distributed/planV2.ts
@@ -103849,7 +104189,7 @@ import {
103849
104189
  mkdirSync as mkdirSync24,
103850
104190
  mkdtempSync as mkdtempSync14,
103851
104191
  openSync as openSync9,
103852
- readFileSync as readFileSync18,
104192
+ readFileSync as readFileSync19,
103853
104193
  readSync as readSync3,
103854
104194
  readdirSync as readdirSync15,
103855
104195
  renameSync as renameSync10,
@@ -103859,7 +104199,7 @@ import {
103859
104199
  } from "fs";
103860
104200
  import { createHash as createHash13 } from "crypto";
103861
104201
  import { tmpdir as tmpdir9 } from "os";
103862
- import { dirname as dirname24, isAbsolute as isAbsolute6, join as join57, relative as relative9, resolve as resolve17, sep as sep6 } from "path";
104202
+ import { dirname as dirname25, isAbsolute as isAbsolute6, join as join58, relative as relative9, resolve as resolve17, sep as sep6 } from "path";
103863
104203
 
103864
104204
  // ../producer/src/services/distributed/planV2Publisher.ts
103865
104205
  import {
@@ -103873,15 +104213,15 @@ import {
103873
104213
  statSync as statSync15,
103874
104214
  writeFileSync as writeFileSync15
103875
104215
  } from "fs";
103876
- import { dirname as dirname23, join as join56 } from "path";
104216
+ import { dirname as dirname24, join as join57 } from "path";
103877
104217
 
103878
104218
  // ../producer/src/services/distributed/planV2Layout.ts
103879
- import { join as join55 } from "path";
104219
+ import { join as join56 } from "path";
103880
104220
 
103881
104221
  // ../producer/src/services/distributed/planV2Execution.ts
103882
104222
  import { mkdtempSync as mkdtempSync16, rmSync as rmSync22 } from "fs";
103883
104223
  import { tmpdir as tmpdir10 } from "os";
103884
- import { join as join60 } from "path";
104224
+ import { join as join61 } from "path";
103885
104225
 
103886
104226
  // ../producer/src/services/distributed/assemble.ts
103887
104227
  init_src();
@@ -103891,25 +104231,25 @@ import {
103891
104231
  existsSync as existsSync42,
103892
104232
  mkdirSync as mkdirSync25,
103893
104233
  mkdtempSync as mkdtempSync15,
103894
- readFileSync as readFileSync19,
104234
+ readFileSync as readFileSync20,
103895
104235
  readdirSync as readdirSync16,
103896
104236
  rmSync as rmSync20,
103897
104237
  statSync as statSync17,
103898
104238
  writeFileSync as writeFileSync17
103899
104239
  } from "fs";
103900
- import { dirname as dirname25, join as join58 } from "path";
104240
+ import { dirname as dirname26, join as join59 } from "path";
103901
104241
 
103902
104242
  // ../producer/src/services/distributed/renderChunk.ts
103903
104243
  init_src();
103904
104244
  import { randomBytes } from "crypto";
103905
- import { existsSync as existsSync43, mkdirSync as mkdirSync26, readFileSync as readFileSync20, readdirSync as readdirSync17, rmSync as rmSync21, writeFileSync as writeFileSync18 } from "fs";
103906
- import { extname as extname8, join as join59 } from "path";
104245
+ import { existsSync as existsSync43, mkdirSync as mkdirSync26, readFileSync as readFileSync21, readdirSync as readdirSync17, rmSync as rmSync21, writeFileSync as writeFileSync18 } from "fs";
104246
+ import { extname as extname8, join as join60 } from "path";
103907
104247
  init_src();
103908
104248
 
103909
104249
  // ../producer/src/services/distributed/projectHash.ts
103910
- import { readdirSync as readdirSync18, readFileSync as readFileSync21 } from "fs";
104250
+ import { readdirSync as readdirSync18, readFileSync as readFileSync22 } from "fs";
103911
104251
  import { createHash as createHash14 } from "crypto";
103912
- import { join as join61, relative as relative10 } from "path";
104252
+ import { join as join62, relative as relative10 } from "path";
103913
104253
 
103914
104254
  // src/fontLocalize.ts
103915
104255
  function safeVersion(version2) {
@@ -103950,8 +104290,8 @@ async function runFontLocalize(io, localize) {
103950
104290
  }
103951
104291
 
103952
104292
  // src/version.ts
103953
- var VERSION = true ? "0.8.72" : "0.0.0-dev";
103954
- var PRODUCER_VERSION = true ? "0.8.72" : "0.0.0-dev";
104293
+ var VERSION = true ? "0.8.74" : "0.0.0-dev";
104294
+ var PRODUCER_VERSION = true ? "0.8.74" : "0.0.0-dev";
103955
104295
 
103956
104296
  // src/fontLocalizeCli.ts
103957
104297
  async function readStdin() {