hyperframes 0.8.21 → 0.8.23

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.
@@ -60438,6 +60438,11 @@ var init_evenDimensions = __esm({
60438
60438
 
60439
60439
  // ../engine/src/utils/runFfmpeg.ts
60440
60440
  import { spawn as spawn2 } from "child_process";
60441
+ function isExternalFfmpegInterruption(result) {
60442
+ if (result.terminationReason !== "exit" || result.exitCode === 0) return false;
60443
+ if (result.signal === "SIGTERM") return true;
60444
+ return result.exitCode === 255 && FFMPEG_SIGTERM_EXIT_LINE.test(result.stderr);
60445
+ }
60441
60446
  function formatWindowsFfmpegExit(exitCode) {
60442
60447
  if (process.platform !== "win32" || exitCode === null) return void 0;
60443
60448
  if (exitCode === 3221225781 || exitCode === -1073741515) {
@@ -60477,22 +60482,28 @@ async function runFfmpeg(args, opts) {
60477
60482
  onStderr: opts?.onStderr
60478
60483
  });
60479
60484
  const outcome = await managed.wait();
60480
- return {
60485
+ const result = {
60481
60486
  success: outcome.reason === "exit" && outcome.exitCode === 0,
60482
60487
  exitCode: outcome.exitCode,
60488
+ signal: outcome.signal,
60483
60489
  stderr: outcome.stderr,
60484
60490
  durationMs: outcome.durationMs,
60485
60491
  terminationReason: outcome.reason,
60486
60492
  error: outcome.error
60487
60493
  };
60494
+ if (isExternalFfmpegInterruption(result)) {
60495
+ result.failureReason = "external_interruption";
60496
+ }
60497
+ return result;
60488
60498
  }
60489
- var DEFAULT_TIMEOUT, DEFAULT_STDERR_TAIL_LINES;
60499
+ var FFMPEG_SIGTERM_EXIT_LINE, DEFAULT_TIMEOUT, DEFAULT_STDERR_TAIL_LINES;
60490
60500
  var init_runFfmpeg = __esm({
60491
60501
  "../engine/src/utils/runFfmpeg.ts"() {
60492
60502
  "use strict";
60493
60503
  init_ffmpegBinaries();
60494
60504
  init_processTracker();
60495
60505
  init_managedChildProcess();
60506
+ FFMPEG_SIGTERM_EXIT_LINE = /^Exiting normally, received signal 15\.?\r?$/m;
60496
60507
  DEFAULT_TIMEOUT = 3e5;
60497
60508
  DEFAULT_STDERR_TAIL_LINES = 15;
60498
60509
  }
@@ -61441,7 +61452,8 @@ async function encodeFramesFromDir(framesDir, framePattern, outputPath, options,
61441
61452
  formatFfmpegError(result.exitCode, result.stderr),
61442
61453
  result.terminationReason === "deadline",
61443
61454
  encodeTimeout
61444
- )
61455
+ ),
61456
+ failureReason: isExternalFfmpegInterruption(result) ? "external_interruption" : void 0
61445
61457
  };
61446
61458
  }
61447
61459
  const fileSize = existsSync6(outputPath) ? statSync2(outputPath).size : 0;
@@ -61517,7 +61529,8 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
61517
61529
  durationMs: Date.now() - start,
61518
61530
  framesEncoded: 0,
61519
61531
  fileSize: 0,
61520
- error: chunkResult.error
61532
+ error: chunkResult.error,
61533
+ failureReason: isExternalFfmpegInterruption(processResult) ? "external_interruption" : void 0
61521
61534
  };
61522
61535
  }
61523
61536
  chunkPaths.push(chunkPath);
@@ -61545,7 +61558,8 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
61545
61558
  durationMs: Date.now() - start,
61546
61559
  framesEncoded: 0,
61547
61560
  fileSize: 0,
61548
- error: concatResult.error
61561
+ error: concatResult.error,
61562
+ failureReason: isExternalFfmpegInterruption(concatProcessResult) ? "external_interruption" : void 0
61549
61563
  };
61550
61564
  }
61551
61565
  const fileSize = existsSync6(outputPath) ? statSync2(outputPath).size : 0;
@@ -61598,7 +61612,8 @@ async function muxVideoWithAudio(videoPath, audioPath, outputPath, signal, confi
61598
61612
  success: result.success,
61599
61613
  outputPath,
61600
61614
  durationMs: result.durationMs,
61601
- error: !result.success ? formatFfmpegError(result.exitCode, result.stderr) : void 0
61615
+ error: !result.success ? formatFfmpegError(result.exitCode, result.stderr) : void 0,
61616
+ failureReason: result.failureReason
61602
61617
  };
61603
61618
  }
61604
61619
  async function applyFaststart(inputPath, outputPath, signal, config, fps) {
@@ -61626,7 +61641,8 @@ async function applyFaststart(inputPath, outputPath, signal, config, fps) {
61626
61641
  success: result.success,
61627
61642
  outputPath,
61628
61643
  durationMs: result.durationMs,
61629
- error: !result.success ? formatFfmpegError(result.exitCode, result.stderr) : void 0
61644
+ error: !result.success ? formatFfmpegError(result.exitCode, result.stderr) : void 0,
61645
+ failureReason: result.failureReason
61630
61646
  };
61631
61647
  }
61632
61648
  var ENCODER_PRESETS, KNOWN_NON_AAC_AUDIO_EXTENSIONS;
@@ -61916,6 +61932,7 @@ async function spawnStreamingEncoder(outputPath, options, signal, config) {
61916
61932
  let exitStatus = "running";
61917
61933
  let stderr = "";
61918
61934
  let exitCode = null;
61935
+ let exitSignal = null;
61919
61936
  let terminationReason = "exit";
61920
61937
  ffmpeg.stdin?.on("error", () => {
61921
61938
  });
@@ -61928,6 +61945,7 @@ async function spawnStreamingEncoder(outputPath, options, signal, config) {
61928
61945
  });
61929
61946
  const exitPromise = managed.wait().then((outcome) => {
61930
61947
  exitCode = outcome.exitCode;
61948
+ exitSignal = outcome.signal;
61931
61949
  stderr = outcome.stderr;
61932
61950
  terminationReason = outcome.reason;
61933
61951
  exitStatus = outcome.reason === "exit" && outcome.exitCode === 0 ? "success" : "error";
@@ -61959,7 +61977,11 @@ async function spawnStreamingEncoder(outputPath, options, signal, config) {
61959
61977
  const encoder = {
61960
61978
  writeFrame: async (buffer) => {
61961
61979
  const stdin = ffmpeg.stdin;
61962
- if (exitStatus !== "running" || !stdin || stdin.destroyed) {
61980
+ if (exitStatus !== "running") {
61981
+ return false;
61982
+ }
61983
+ if (!stdin || stdin.destroyed) {
61984
+ await exitPromise;
61963
61985
  return false;
61964
61986
  }
61965
61987
  const copy = Buffer.from(buffer);
@@ -61999,7 +62021,13 @@ FFmpeg stopped after ${streamingTimeout} ms without consuming a frame.` : "";
61999
62021
  success: false,
62000
62022
  durationMs,
62001
62023
  fileSize: 0,
62002
- error: `${formatFfmpegError(exitCode, stderr)}${inactivitySuffix}`
62024
+ error: `${formatFfmpegError(exitCode, stderr)}${inactivitySuffix}`,
62025
+ failureReason: isExternalFfmpegInterruption({
62026
+ exitCode,
62027
+ signal: exitSignal,
62028
+ stderr,
62029
+ terminationReason
62030
+ }) ? "external_interruption" : void 0
62003
62031
  };
62004
62032
  }
62005
62033
  const fileSize = existsSync7(outputPath) ? statSync3(outputPath).size : 0;
@@ -62009,6 +62037,15 @@ FFmpeg stopped after ${streamingTimeout} ms without consuming a frame.` : "";
62009
62037
  getExitError: () => {
62010
62038
  if (exitStatus !== "error") return void 0;
62011
62039
  return formatFfmpegError(exitCode, stderr);
62040
+ },
62041
+ getExitFailureReason: () => {
62042
+ if (exitStatus !== "error") return void 0;
62043
+ return isExternalFfmpegInterruption({
62044
+ exitCode,
62045
+ signal: exitSignal,
62046
+ stderr,
62047
+ terminationReason
62048
+ }) ? "external_interruption" : void 0;
62012
62049
  }
62013
62050
  };
62014
62051
  return encoder;
@@ -72716,6 +72753,47 @@ ${other.raw}`)
72716
72753
  }
72717
72754
  return findings;
72718
72755
  },
72756
+ // gsap_timeline_return_used_as_tween — `tl.to()` returns the TIMELINE, not the tween it just
72757
+ // created. `gsap.to()` returns a Tween, so the two read identically and behave nothing alike.
72758
+ // Capturing the timeline's return and later treating it as an individual animation aims a
72759
+ // tween-scoped call at the whole composition: `.kill()` on it interrupts the master timeline
72760
+ // and detaches it from its parent, which stops a parent-driven seek dead while leaving an
72761
+ // explicit `tl.progress()` still working -- so a render of the packaged defaults looks fine
72762
+ // and only live playback breaks. A rebuild that collected these to discard them also leaves
72763
+ // every previous keyframe in place and stacks the new ones on top.
72764
+ ({ scripts }) => {
72765
+ const findings = [];
72766
+ for (const script of scripts) {
72767
+ const source = stripJsComments(script.content);
72768
+ const timelineVars = collectTimelineVarNames(source);
72769
+ if (timelineVars.length === 0) continue;
72770
+ const receivers = timelineVars.map(escapeRegExp22).join("|");
72771
+ const pattern = new RegExp(
72772
+ String.raw`(?:\.push\s*\(\s*|(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*)(?:${receivers})\s*\.\s*(to|from|fromTo|set|call|add)\s*\(`,
72773
+ "g"
72774
+ );
72775
+ let match;
72776
+ while ((match = pattern.exec(source)) !== null) {
72777
+ const boundName = match[1];
72778
+ const method = match[2];
72779
+ if (boundName) {
72780
+ const treatedAsTween = new RegExp(
72781
+ String.raw`\b${escapeRegExp22(boundName)}\s*\.\s*(?:kill|revert|invalidate|pause|resume|restart|seek|progress|timeScale)\s*\(`
72782
+ );
72783
+ if (!treatedAsTween.test(source)) continue;
72784
+ }
72785
+ const contextStart = Math.max(0, match.index - 40);
72786
+ findings.push({
72787
+ code: "gsap_timeline_return_used_as_tween",
72788
+ severity: "error",
72789
+ message: `\`${match[0].includes(".push") ? "push" : boundName}\` captures the return of \`.${method}()\` on timeline \`${timelineVars[0]}\`, but a timeline's \`.to()\`/\`.from()\`/\`.set()\` returns THE TIMELINE ITSELF, not the tween it created. Every captured value is the same master timeline, so a tween-scoped call on it \u2014 \`.kill()\` above all \u2014 hits the whole composition: it interrupts the timeline and detaches it from its parent, which freezes a parent-driven seek while an explicit \`tl.progress()\` keeps working. Only \`gsap.to()\` returns a tween.`,
72790
+ fixHint: "To build a group of keyframes you can later discard, put them in a nested timeline: `const nested = gsap.timeline(); nested.to(...); tl.add(nested, 0);` \u2014 then `nested.kill()` replaces exactly those keyframes and cannot reach `tl`. Children keep their absolute times when the nest is added at 0. To hold a single real tween, create it with `gsap.to(...)` and place it with `tl.add(tween, at)`.",
72791
+ snippet: truncateSnippet(source.slice(contextStart, match.index + match[0].length + 60))
72792
+ });
72793
+ }
72794
+ }
72795
+ return findings;
72796
+ },
72719
72797
  // gsap_group_selector_keyframes
72720
72798
  ({ scripts }) => {
72721
72799
  const findings = [];
@@ -75236,6 +75314,14 @@ async function extractVideoFramesRange(videoPath, videoId, startTime, duration,
75236
75314
  if (format === "png") args.push("-compression_level", "1");
75237
75315
  args.push("-y", outputPattern);
75238
75316
  const processResult = await runFfmpeg(args, { signal, timeout: ffmpegProcessTimeout });
75317
+ if (processResult.failureReason === "external_interruption") {
75318
+ throw new VideoSourceExtractionError(
75319
+ "external_interruption",
75320
+ true,
75321
+ "Video frame extraction interrupted by host lifecycle",
75322
+ `FFmpeg exited with code ${processResult.exitCode}: ${processResult.stderr.slice(-500)}`
75323
+ );
75324
+ }
75239
75325
  if (processResult.terminationReason === "abort") {
75240
75326
  throw new VideoSourceExtractionError("cancelled", false, "Video extraction cancelled");
75241
75327
  }
@@ -77448,7 +77534,10 @@ function ffmpegFailure(stage, result, elementId) {
77448
77534
  let reason = "ffmpeg_failed";
77449
77535
  let owner = "system";
77450
77536
  let retryable = false;
77451
- if (result.terminationReason === "abort") {
77537
+ if (result.failureReason === "external_interruption") {
77538
+ reason = "external_interruption";
77539
+ retryable = true;
77540
+ } else if (result.terminationReason === "abort") {
77452
77541
  reason = "cancelled";
77453
77542
  owner = "user";
77454
77543
  } else if (result.terminationReason === "deadline" || result.terminationReason === "inactivity") {
@@ -77773,7 +77862,7 @@ async function mixAudioTracks(tracks, outputPath, totalDuration, signal, config)
77773
77862
  let result = await runMix(false);
77774
77863
  let degradedAutomation = false;
77775
77864
  const hasAutomation = tracks.some((track) => (track.volumeKeyframes?.length ?? 0) > 0);
77776
- if (!result.success && !signal?.aborted && hasAutomation) {
77865
+ if (!result.success && result.failureReason !== "external_interruption" && !signal?.aborted && hasAutomation) {
77777
77866
  const retry = await runMix(true);
77778
77867
  if (retry.success) {
77779
77868
  result = retry;
@@ -80723,6 +80812,7 @@ __export(src_exports, {
80723
80812
  initializeSession: () => initializeSession,
80724
80813
  injectVideoFramesBatch: () => injectVideoFramesBatch,
80725
80814
  isDrawElementVerificationError: () => isDrawElementVerificationError,
80815
+ isExternalFfmpegInterruption: () => isExternalFfmpegInterruption,
80726
80816
  isFatalCaptureFailure: () => isFatalCaptureFailure,
80727
80817
  isHdrColorSpace: () => isHdrColorSpace,
80728
80818
  isHttpUrl: () => isHttpUrl,
@@ -85147,6 +85237,25 @@ function publishRenderFailure(job, failure, onProgress) {
85147
85237
  updateJobStatus(job, "failed", `Failed: ${failure.error}`, job.progress, onProgress);
85148
85238
  }
85149
85239
 
85240
+ // ../producer/src/services/render/encoderInterruption.ts
85241
+ var ENCODER_INTERRUPTED = "ENCODER_INTERRUPTED";
85242
+ var EncoderInterruptedError = class extends Error {
85243
+ code = ENCODER_INTERRUPTED;
85244
+ owner = "system";
85245
+ retryable = true;
85246
+ /** Retained inside the producer for diagnostics; never copied to the wire envelope. */
85247
+ diagnosticMessage;
85248
+ constructor(prefix, diagnosticMessage) {
85249
+ super(`${prefix}: encoder process was interrupted by the host lifecycle`);
85250
+ this.name = "EncoderInterruptedError";
85251
+ this.diagnosticMessage = diagnosticMessage;
85252
+ }
85253
+ };
85254
+ function encoderFailureError(prefix, result) {
85255
+ const message = `${prefix}: ${result.error ?? "unknown encoder failure"}`;
85256
+ return result.failureReason === "external_interruption" ? new EncoderInterruptedError(prefix, message) : new Error(message);
85257
+ }
85258
+
85150
85259
  // ../producer/src/services/render/renderExecutionContext.ts
85151
85260
  function scopedLogger(logger, fields) {
85152
85261
  const merge = (meta) => ({ ...fields, ...meta });
@@ -85859,7 +85968,7 @@ var CaptureStageError = class extends CaptureFailure {
85859
85968
  }
85860
85969
  };
85861
85970
  function wrapCaptureStageError(error, browserConsole) {
85862
- if (error instanceof CaptureStageError) return error;
85971
+ if (error instanceof CaptureStageError || error instanceof EncoderInterruptedError) return error;
85863
85972
  return new CaptureStageError({ cause: error, browserConsole });
85864
85973
  }
85865
85974
  function getCaptureStageBrowserConsole(error) {
@@ -87921,6 +88030,12 @@ async function runAnimatedGifTranscode(request) {
87921
88030
  const timeout = request.timeoutMs ?? 3e5;
87922
88031
  const result = await runFfmpeg(request.args, { timeout });
87923
88032
  if (result.success) return;
88033
+ if (result.failureReason === "external_interruption") {
88034
+ throw encoderFailureError("Animated GIF transcode failed", {
88035
+ error: `exit ${result.exitCode}: ${result.stderr.slice(-500)}`,
88036
+ failureReason: result.failureReason
88037
+ });
88038
+ }
87924
88039
  if (result.terminationReason === "deadline") {
87925
88040
  throw new Error(`Animated GIF transcode timed out after ${timeout}ms`);
87926
88041
  }
@@ -90716,6 +90831,14 @@ var VideoExtractionStageError = class extends Error {
90716
90831
  retryable;
90717
90832
  failures;
90718
90833
  };
90834
+ function throwIfEncoderInterrupted(result) {
90835
+ const interrupted = result.errors.find((failure) => failure.kind === "external_interruption");
90836
+ if (!interrupted) return;
90837
+ throw encoderFailureError("Video frame extraction failed", {
90838
+ error: String(interrupted.error),
90839
+ failureReason: "external_interruption"
90840
+ });
90841
+ }
90719
90842
  function buildVideoExtractionStageError(result) {
90720
90843
  if (result.success && result.errors.length === 0) return null;
90721
90844
  const counts = /* @__PURE__ */ new Map();
@@ -90753,6 +90876,15 @@ function isHdrProbeFailure(failure) {
90753
90876
  }
90754
90877
  function throwHdrProbeFailures(failures, mode) {
90755
90878
  if (failures.length === 0) return;
90879
+ const interrupted = failures.find(
90880
+ (failure) => failure.classified.kind === "external_interruption"
90881
+ );
90882
+ if (interrupted) {
90883
+ throw encoderFailureError("Video HDR probe failed", {
90884
+ error: interrupted.error instanceof Error ? interrupted.error.message : String(interrupted.error),
90885
+ failureReason: "external_interruption"
90886
+ });
90887
+ }
90756
90888
  if (mode === "enforce") {
90757
90889
  throw buildHdrProbeStageError(failures.map((failure) => failure.classified));
90758
90890
  }
@@ -90885,6 +91017,7 @@ async function runExtractVideosStage(input) {
90885
91017
  );
90886
91018
  extractionResult.phaseBreakdown.transientRetries = (extractionResult.phaseBreakdown.transientRetries ?? 0) + hdrProbeTransientRetries;
90887
91019
  assertNotAborted();
91020
+ throwIfEncoderInterrupted(extractionResult);
90888
91021
  failureToEnforce = applyVideoExtractionFailurePolicy(extractionResult, extractionPolicy, log);
90889
91022
  materializeExtractedFramesForCompiledDir(extractionResult.extracted, compiledDir, {
90890
91023
  materializeSymlinks
@@ -90996,6 +91129,15 @@ async function runAudioStage(input) {
90996
91129
  };
90997
91130
  }
90998
91131
  assertNotAborted();
91132
+ const interrupted = audioResult.failures?.find(
91133
+ (failure) => failure.reason === "external_interruption"
91134
+ );
91135
+ if (interrupted) {
91136
+ throw encoderFailureError("Audio processing failed", {
91137
+ error: interrupted.detail,
91138
+ failureReason: "external_interruption"
91139
+ });
91140
+ }
90999
91141
  hasAudio = audioResult.success;
91000
91142
  audioFailures = audioResult.failures;
91001
91143
  if (!hasAudio) {
@@ -91941,9 +92083,10 @@ async function extractHdrVideoFrames(args) {
91941
92083
  srcPath,
91942
92084
  stderr: result.stderr.slice(-400)
91943
92085
  });
91944
- throw new Error(
91945
- `HDR frame extraction failed for video "${videoId}". Aborting render to avoid shipping black HDR layers.`
91946
- );
92086
+ throw encoderFailureError(`HDR frame extraction failed for video "${videoId}"`, {
92087
+ error: `Aborting render to avoid shipping black HDR layers: ${result.stderr.slice(-400)}`,
92088
+ failureReason: result.failureReason
92089
+ });
91947
92090
  }
91948
92091
  const frameSize = dims.width * dims.height * 6;
91949
92092
  const fd = openSync4(rawPath, constants2.O_RDONLY | NO_FOLLOW_FLAG);
@@ -92232,7 +92375,10 @@ function ensureFrameWritten(frameWritten, frameIndex, encoder) {
92232
92375
  if (frameWritten) return;
92233
92376
  const reason = encoder?.getExitError();
92234
92377
  const base2 = `Streaming encoder exited before frame ${frameIndex} was written`;
92235
- throw new Error(reason ? `${base2}: ${reason}` : base2);
92378
+ throw encoderFailureError(base2, {
92379
+ error: reason,
92380
+ failureReason: encoder?.getExitFailureReason?.()
92381
+ });
92236
92382
  }
92237
92383
  function cleanupEndedHdrVideos(args) {
92238
92384
  if (process.env.KEEP_TEMP === "1") return;
@@ -92737,7 +92883,7 @@ async function runCaptureStreamingStage(input) {
92737
92883
  streamingEncoderClosed = true;
92738
92884
  assertNotAborted();
92739
92885
  if (!encodeResult.success) {
92740
- throw new Error(`Streaming encode failed: ${encodeResult.error}`);
92886
+ throw encoderFailureError("Streaming encode failed", encodeResult);
92741
92887
  }
92742
92888
  return {
92743
92889
  success: true,
@@ -93671,7 +93817,7 @@ async function runCaptureHdrStage(input) {
93671
93817
  hdrEncoderClosed = true;
93672
93818
  assertNotAborted();
93673
93819
  if (!hdrEncodeResult.success) {
93674
- throw new Error(`HDR encode failed: ${hdrEncodeResult.error}`);
93820
+ throw encoderFailureError("HDR encode failed", hdrEncodeResult);
93675
93821
  }
93676
93822
  captureDurationMs = Date.now() - stageStart;
93677
93823
  encodeMs = hdrEncodeResult.durationMs;
@@ -93797,7 +93943,8 @@ async function encodeGifFromDir(framesDir, framePattern, outputPath, input) {
93797
93943
  durationMs: Date.now() - startTime,
93798
93944
  framesEncoded: 0,
93799
93945
  fileSize: 0,
93800
- error: formatFfmpegError(paletteResult.exitCode, paletteResult.stderr)
93946
+ error: formatFfmpegError(paletteResult.exitCode, paletteResult.stderr),
93947
+ failureReason: paletteResult.failureReason
93801
93948
  };
93802
93949
  }
93803
93950
  const gifResult = await runFfmpeg(buildGifPaletteuseArgs(argsInput), {
@@ -93811,7 +93958,8 @@ async function encodeGifFromDir(framesDir, framePattern, outputPath, input) {
93811
93958
  durationMs: Date.now() - startTime,
93812
93959
  framesEncoded: 0,
93813
93960
  fileSize: 0,
93814
- error: formatFfmpegError(gifResult.exitCode, gifResult.stderr)
93961
+ error: formatFfmpegError(gifResult.exitCode, gifResult.stderr),
93962
+ failureReason: gifResult.failureReason
93815
93963
  };
93816
93964
  }
93817
93965
  const fileSize = existsSync29(outputPath) ? statSync9(outputPath).size : 0;
@@ -93890,7 +94038,7 @@ async function runEncodeStage(input) {
93890
94038
  });
93891
94039
  assertNotAborted();
93892
94040
  if (!encodeResult2.success) {
93893
- throw new Error(`Encoding failed: ${encodeResult2.error}`);
94041
+ throw encoderFailureError("Encoding failed", encodeResult2);
93894
94042
  }
93895
94043
  return { encodeMs: Date.now() - stage5Start };
93896
94044
  }
@@ -93935,7 +94083,7 @@ async function runEncodeStage(input) {
93935
94083
  );
93936
94084
  assertNotAborted();
93937
94085
  if (!encodeResult.success) {
93938
- throw new Error(`Encoding failed: ${encodeResult.error}`);
94086
+ throw encoderFailureError("Encoding failed", encodeResult);
93939
94087
  }
93940
94088
  return { encodeMs: Date.now() - stage5Start };
93941
94089
  }
@@ -94078,7 +94226,8 @@ async function padOrTrimAudioToVideoFrameCount(input) {
94078
94226
  targetDurationSeconds,
94079
94227
  sourceDurationSeconds: audioInfo.durationSeconds,
94080
94228
  operation: plan2.operation,
94081
- error: ffmpegResult.error
94229
+ error: ffmpegResult.error,
94230
+ failureReason: ffmpegResult.failureReason
94082
94231
  };
94083
94232
  }
94084
94233
  }
@@ -94180,7 +94329,8 @@ async function defaultRunFfmpeg(args, signal) {
94180
94329
  if (result.success) return { success: true };
94181
94330
  return {
94182
94331
  success: false,
94183
- error: `[audioPadTrim] ${formatFfmpegError(result.exitCode, result.stderr)}`
94332
+ error: `[audioPadTrim] ${formatFfmpegError(result.exitCode, result.stderr)}`,
94333
+ failureReason: result.failureReason
94184
94334
  };
94185
94335
  }
94186
94336
  async function runFfprobeJson(args, signal) {
@@ -94237,11 +94387,12 @@ async function runAssembleStage(input) {
94237
94387
  const normalizeResult = await padOrTrimAudioToVideoFrameCount({
94238
94388
  videoPath: videoOnlyPath,
94239
94389
  audioPath: audioOutputPath,
94240
- outputPath: normalizedAudioPath
94390
+ outputPath: normalizedAudioPath,
94391
+ signal: abortSignal
94241
94392
  });
94242
94393
  assertNotAborted();
94243
94394
  if (!normalizeResult.success) {
94244
- throw new Error(`Audio duration normalization failed: ${normalizeResult.error}`);
94395
+ throw encoderFailureError("Audio duration normalization failed", normalizeResult);
94245
94396
  }
94246
94397
  const muxResult = await muxVideoWithAudio(
94247
94398
  videoOnlyPath,
@@ -94255,7 +94406,7 @@ async function runAssembleStage(input) {
94255
94406
  );
94256
94407
  assertNotAborted();
94257
94408
  if (!muxResult.success) {
94258
- throw new Error(`Audio muxing failed: ${muxResult.error}`);
94409
+ throw encoderFailureError("Audio muxing failed", muxResult);
94259
94410
  }
94260
94411
  } else {
94261
94412
  const faststartResult = await applyFaststart(
@@ -94267,7 +94418,7 @@ async function runAssembleStage(input) {
94267
94418
  );
94268
94419
  assertNotAborted();
94269
94420
  if (!faststartResult.success) {
94270
- throw new Error(`Faststart failed: ${faststartResult.error}`);
94421
+ throw encoderFailureError("Faststart failed", faststartResult);
94271
94422
  }
94272
94423
  }
94273
94424
  return { assembleMs: Date.now() - stage6Start };
@@ -94822,7 +94973,7 @@ function resolveParallelRouterRetryPlan(args) {
94822
94973
  };
94823
94974
  }
94824
94975
  function shouldRetryViaPinnedFallback(args) {
94825
- if (args.isCancellation) return false;
94976
+ if (args.isCancellation || args.isEncoderInterrupted) return false;
94826
94977
  if (args.isVerifyError) return true;
94827
94978
  return args.deWorkerInversion === "inverted" || args.deParallelRouter === "routed";
94828
94979
  }
@@ -95903,6 +96054,7 @@ async function executeRenderPipeline(input) {
95903
96054
  if (!shouldRetryViaPinnedFallback({
95904
96055
  isVerifyError,
95905
96056
  isCancellation,
96057
+ isEncoderInterrupted: err instanceof EncoderInterruptedError,
95906
96058
  deWorkerInversion,
95907
96059
  deParallelRouter
95908
96060
  }))
@@ -96254,6 +96406,12 @@ async function executeRenderPipeline(input) {
96254
96406
  await eventPublisher.flush();
96255
96407
  throw error instanceof RenderCancelledError ? error : new RenderCancelledError("render_cancelled");
96256
96408
  }
96409
+ if (error instanceof EncoderInterruptedError) {
96410
+ log.warn("[Render] encoder process interrupted by host lifecycle", {
96411
+ code: error.code,
96412
+ diagnostic: error.diagnosticMessage.slice(-2e3)
96413
+ });
96414
+ }
96257
96415
  const memoryGuidance = describeMemoryExhaustion(error, {
96258
96416
  width: captureCompositionWidth,
96259
96417
  height: captureCompositionHeight,
@@ -96770,7 +96928,8 @@ var SAFE_RENDER_ERROR_CODES = /* @__PURE__ */ new Set([
96770
96928
  "NOT_MEDIA_PAYLOAD",
96771
96929
  "INVALID_VIDEO_METADATA",
96772
96930
  "VIDEO_SOURCE_UNRENDERABLE",
96773
- "VIDEO_EXTRACTION_FAILED"
96931
+ "VIDEO_EXTRACTION_FAILED",
96932
+ "ENCODER_INTERRUPTED"
96774
96933
  ]);
96775
96934
  function extractSafeRenderErrorCode(error) {
96776
96935
  if (typeof error !== "object" || error === null || !("code" in error)) return void 0;
@@ -97589,8 +97748,8 @@ async function runFontLocalize(io, localize) {
97589
97748
  }
97590
97749
 
97591
97750
  // src/version.ts
97592
- var VERSION = true ? "0.8.21" : "0.0.0-dev";
97593
- var PRODUCER_VERSION = true ? "0.8.21" : "0.0.0-dev";
97751
+ var VERSION = true ? "0.8.23" : "0.0.0-dev";
97752
+ var PRODUCER_VERSION = true ? "0.8.23" : "0.0.0-dev";
97594
97753
 
97595
97754
  // src/fontLocalizeCli.ts
97596
97755
  async function readStdin() {
@@ -1,4 +1,4 @@
1
- "use strict";var HyperframesPlayer=(()=>{var ee=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var it=Object.prototype.hasOwnProperty;var rt=(r,e)=>{for(var t in e)ee(r,t,{get:e[t],enumerable:!0})},nt=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of tt(e))!it.call(r,n)&&n!==t&&ee(r,n,{get:()=>e[n],enumerable:!(i=et(e,n))||i.enumerable});return r};var ot=r=>nt(ee({},"__esModule",{value:!0}),r);var Ht={};rt(Ht,{HyperframesPlayer:()=>K,SPEED_PRESETS:()=>re,formatSpeed:()=>O,formatTime:()=>q});function we(r){return r.hasRuntime||r.runtimeInjected?!1:!!(r.hasNestedCompositions||r.hasTimelines&&r.attempts>=5)}function P(r){return typeof r=="object"&&r!==null}function Ae(r){return P(r)&&typeof r.getDuration=="function"}function Ce(r){return P(r)&&typeof r.duration=="function"&&typeof r.time=="function"&&typeof r.seek=="function"&&typeof r.play=="function"&&typeof r.pause=="function"}var k="https://cdn.jsdelivr.net/npm/@hyperframes/core@0.8.21/dist/hyperframe.runtime.iife.js";function N(r){if(r===null)return null;let e=Number.parseInt(r,10);return Number.isFinite(e)&&e>0?e:null}function at(r){let e=r?.querySelector("[data-composition-id][data-width][data-height]")??r?.querySelector("[data-width][data-height]");if(!e)return null;let t=N(e.getAttribute("data-width")),i=N(e.getAttribute("data-height"));return t!==null&&i!==null?{width:t,height:i}:null}var W=class{constructor(e,t){this._iframe=e;this._callbacks=t}_iframe;_callbacks;_interval=null;_runtimeInjected=!1;get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._runtimeInjected=!1;let e=0;this._interval=setInterval(()=>{e++;try{let t=this._iframe.contentWindow;if(!t)return;let i=!!(t.__hf||t.__player),n=!!(t.__timelines&&Object.keys(t.__timelines).length>0),o=!!this._iframe.contentDocument?.querySelector("[data-composition-src]");if(we({hasRuntime:i,hasTimelines:n,hasNestedCompositions:o,runtimeInjected:this._runtimeInjected,attempts:e})){this._injectRuntime();return}if(this._runtimeInjected&&!i)return;let d=this._resolvePlaybackDurationAdapter(t);if(d&&d.getDuration()>0){this.stop();let s=at(this._iframe.contentDocument);this._callbacks.onReady({duration:d.getDuration(),adapter:d,compositionSize:s});return}}catch{}e>=40&&(this.stop(),this._callbacks.onError("Composition timeline not found after 8s"))},200)}stop(){this._interval!==null&&(clearInterval(this._interval),this._interval=null)}resolveDirectTimelineAdapter(){try{let e=this._iframe.contentWindow;return e?this._resolveDirectTimelineAdapterFromWindow(e):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(e){return this._resolveDirectTimelineAdapterFromWindow(e)}hasRuntimeBridge(e){return Reflect.get(e,"__hf")!==void 0||P(Reflect.get(e,"__player"))}_injectRuntime(){this._runtimeInjected=!0;try{let e=this._iframe.contentDocument;if(!e)return;let t=e.createElement("script");t.src=k,(e.head||e.documentElement).appendChild(t),this._callbacks.onRuntimeInjected?.()}catch{}}_resolveDirectTimelineAdapterFromWindow(e){if(this.hasRuntimeBridge(e))return null;let t=Reflect.get(e,"__timelines");if(!P(t))return null;let i=Object.keys(t);if(i.length===0)return null;let n=this._iframe.contentDocument?.querySelector("[data-composition-id]")?.getAttribute("data-composition-id"),o=n&&n in t?n:i[i.length-1],d=t[o];return Ce(d)?d:null}_resolvePlaybackDurationAdapter(e){let t=Reflect.get(e,"__player");if(Ae(t))return{kind:"runtime",getDuration:()=>t.getDuration()};let i=this._resolveDirectTimelineAdapterFromWindow(e);return i?{kind:"direct-timeline",timeline:i,getDuration:()=>i.duration()}:null}};var Re=`
1
+ "use strict";var HyperframesPlayer=(()=>{var ee=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var it=Object.prototype.hasOwnProperty;var rt=(r,e)=>{for(var t in e)ee(r,t,{get:e[t],enumerable:!0})},nt=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of tt(e))!it.call(r,n)&&n!==t&&ee(r,n,{get:()=>e[n],enumerable:!(i=et(e,n))||i.enumerable});return r};var ot=r=>nt(ee({},"__esModule",{value:!0}),r);var Ht={};rt(Ht,{HyperframesPlayer:()=>K,SPEED_PRESETS:()=>re,formatSpeed:()=>O,formatTime:()=>q});function we(r){return r.hasRuntime||r.runtimeInjected?!1:!!(r.hasNestedCompositions||r.hasTimelines&&r.attempts>=5)}function P(r){return typeof r=="object"&&r!==null}function Ae(r){return P(r)&&typeof r.getDuration=="function"}function Ce(r){return P(r)&&typeof r.duration=="function"&&typeof r.time=="function"&&typeof r.seek=="function"&&typeof r.play=="function"&&typeof r.pause=="function"}var k="https://cdn.jsdelivr.net/npm/@hyperframes/core@0.8.23/dist/hyperframe.runtime.iife.js";function N(r){if(r===null)return null;let e=Number.parseInt(r,10);return Number.isFinite(e)&&e>0?e:null}function at(r){let e=r?.querySelector("[data-composition-id][data-width][data-height]")??r?.querySelector("[data-width][data-height]");if(!e)return null;let t=N(e.getAttribute("data-width")),i=N(e.getAttribute("data-height"));return t!==null&&i!==null?{width:t,height:i}:null}var W=class{constructor(e,t){this._iframe=e;this._callbacks=t}_iframe;_callbacks;_interval=null;_runtimeInjected=!1;get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._runtimeInjected=!1;let e=0;this._interval=setInterval(()=>{e++;try{let t=this._iframe.contentWindow;if(!t)return;let i=!!(t.__hf||t.__player),n=!!(t.__timelines&&Object.keys(t.__timelines).length>0),o=!!this._iframe.contentDocument?.querySelector("[data-composition-src]");if(we({hasRuntime:i,hasTimelines:n,hasNestedCompositions:o,runtimeInjected:this._runtimeInjected,attempts:e})){this._injectRuntime();return}if(this._runtimeInjected&&!i)return;let d=this._resolvePlaybackDurationAdapter(t);if(d&&d.getDuration()>0){this.stop();let s=at(this._iframe.contentDocument);this._callbacks.onReady({duration:d.getDuration(),adapter:d,compositionSize:s});return}}catch{}e>=40&&(this.stop(),this._callbacks.onError("Composition timeline not found after 8s"))},200)}stop(){this._interval!==null&&(clearInterval(this._interval),this._interval=null)}resolveDirectTimelineAdapter(){try{let e=this._iframe.contentWindow;return e?this._resolveDirectTimelineAdapterFromWindow(e):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(e){return this._resolveDirectTimelineAdapterFromWindow(e)}hasRuntimeBridge(e){return Reflect.get(e,"__hf")!==void 0||P(Reflect.get(e,"__player"))}_injectRuntime(){this._runtimeInjected=!0;try{let e=this._iframe.contentDocument;if(!e)return;let t=e.createElement("script");t.src=k,(e.head||e.documentElement).appendChild(t),this._callbacks.onRuntimeInjected?.()}catch{}}_resolveDirectTimelineAdapterFromWindow(e){if(this.hasRuntimeBridge(e))return null;let t=Reflect.get(e,"__timelines");if(!P(t))return null;let i=Object.keys(t);if(i.length===0)return null;let n=this._iframe.contentDocument?.querySelector("[data-composition-id]")?.getAttribute("data-composition-id"),o=n&&n in t?n:i[i.length-1],d=t[o];return Ce(d)?d:null}_resolvePlaybackDurationAdapter(e){let t=Reflect.get(e,"__player");if(Ae(t))return{kind:"runtime",getDuration:()=>t.getDuration()};let i=this._resolveDirectTimelineAdapterFromWindow(e);return i?{kind:"direct-timeline",timeline:i,getDuration:()=>i.duration()}:null}};var Re=`
2
2
  :host {
3
3
  display: block;
4
4
  position: relative;
@@ -67,7 +67,7 @@ npx hyperframes check --caption-zone "x0=0;y0=.82;x1=1;y1=1;severity=error;seek=
67
67
  npx hyperframes check --frame-check # media (img/svg/video/canvas) out-of-frame detection
68
68
  ```
69
69
 
70
- `--caption-zone` takes fractional band geometry (`x0/y0/x1/y1` required, 0-1 fractions of the composition's own canvas, portrait included) with optional `severity` and comma-separated `seek` fractions; it flags content whose center sits inside the band. Waive intentional lower-third copy with `data-layout-allow-caption-zone` on the element or its nearest wrapper (see Escape hatches). `--frame-check` reports media elements breaching the canvas beyond `max(120px, 6% of the min canvas dimension)`.
70
+ `--caption-zone` takes fractional band geometry (`x0/y0/x1/y1` required, 0-1 fractions of the composition's own canvas, portrait included) with optional `severity` and comma-separated `seek` fractions; it flags a text element's DOM box (`getBoundingClientRect`) that overlaps the band. Waive intentional lower-third copy with `data-layout-allow-caption-zone` on the element or its nearest wrapper (see Escape hatches). `--frame-check` reports media elements breaching the canvas beyond `max(120px, 6% of the min canvas dimension)`.
71
71
 
72
72
  **Fixing contrast errors** — thresholds are 4.5:1 for normal text, 3:1 for large text (24px+, or 19px+ bold). The finding's `suggestedColor` already picks the nearest compliant color in the right direction (brighten on dark backgrounds, darken on light); apply it or adjust within the palette family, then re-run `check`.
73
73
 
@@ -1,4 +1,4 @@
1
- var ve=Object.defineProperty;var be=(n,i,e)=>i in n?ve(n,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[i]=e;var u=(n,i,e)=>be(n,typeof i!="symbol"?i+"":i,e);import{r as le,i as we,a as Ae}from"./index-CgGY8dAv.js";function Ee(n){return n.hasRuntime||n.runtimeInjected?!1:!!(n.hasNestedCompositions||n.hasTimelines&&n.attempts>=5)}function V(n){return typeof n=="object"&&n!==null}function Ce(n){return V(n)&&typeof n.getDuration=="function"}function Te(n){return V(n)&&typeof n.duration=="function"&&typeof n.time=="function"&&typeof n.seek=="function"&&typeof n.play=="function"&&typeof n.pause=="function"}function Se(n){if(!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(n))throw new Error(`Invalid HyperFrames runtime version: ${n}`);return`https://cdn.jsdelivr.net/npm/@hyperframes/core@${n}/dist/hyperframe.runtime.iife.js`}const H=typeof __HYPERFRAMES_RUNTIME_CDN_URL__=="string"?__HYPERFRAMES_RUNTIME_CDN_URL__:Se("0.0.0-dev");function $(n){if(n===null)return null;const i=Number.parseInt(n,10);return Number.isFinite(i)&&i>0?i:null}function Re(n){const i=(n==null?void 0:n.querySelector("[data-composition-id][data-width][data-height]"))??(n==null?void 0:n.querySelector("[data-width][data-height]"));if(!i)return null;const e=$(i.getAttribute("data-width")),t=$(i.getAttribute("data-height"));return e!==null&&t!==null?{width:e,height:t}:null}class xe{constructor(i,e){u(this,"_interval",null);u(this,"_runtimeInjected",!1);this._iframe=i,this._callbacks=e}get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._runtimeInjected=!1;let i=0;this._interval=setInterval(()=>{var e;i++;try{const t=this._iframe.contentWindow;if(!t)return;const r=!!(t.__hf||t.__player),s=!!(t.__timelines&&Object.keys(t.__timelines).length>0),o=!!((e=this._iframe.contentDocument)!=null&&e.querySelector("[data-composition-src]"));if(Ee({hasRuntime:r,hasTimelines:s,hasNestedCompositions:o,runtimeInjected:this._runtimeInjected,attempts:i})){this._injectRuntime();return}if(this._runtimeInjected&&!r)return;const d=this._resolvePlaybackDurationAdapter(t);if(d&&d.getDuration()>0){this.stop();const p=Re(this._iframe.contentDocument);this._callbacks.onReady({duration:d.getDuration(),adapter:d,compositionSize:p});return}}catch{}i>=40&&(this.stop(),this._callbacks.onError("Composition timeline not found after 8s"))},200)}stop(){this._interval!==null&&(clearInterval(this._interval),this._interval=null)}resolveDirectTimelineAdapter(){try{const i=this._iframe.contentWindow;return i?this._resolveDirectTimelineAdapterFromWindow(i):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(i){return this._resolveDirectTimelineAdapterFromWindow(i)}hasRuntimeBridge(i){return Reflect.get(i,"__hf")!==void 0||V(Reflect.get(i,"__player"))}_injectRuntime(){var i,e;this._runtimeInjected=!0;try{const t=this._iframe.contentDocument;if(!t)return;const r=t.createElement("script");r.src=H,(t.head||t.documentElement).appendChild(r),(e=(i=this._callbacks).onRuntimeInjected)==null||e.call(i)}catch{}}_resolveDirectTimelineAdapterFromWindow(i){var d,p;if(this.hasRuntimeBridge(i))return null;const e=Reflect.get(i,"__timelines");if(!V(e))return null;const t=Object.keys(e);if(t.length===0)return null;const r=(p=(d=this._iframe.contentDocument)==null?void 0:d.querySelector("[data-composition-id]"))==null?void 0:p.getAttribute("data-composition-id"),s=r&&r in e?r:t[t.length-1],o=e[s];return Te(o)?o:null}_resolvePlaybackDurationAdapter(i){const e=Reflect.get(i,"__player");if(Ce(e))return{kind:"runtime",getDuration:()=>e.getDuration()};const t=this._resolveDirectTimelineAdapterFromWindow(i);return t?{kind:"direct-timeline",timeline:t,getDuration:()=>t.duration()}:null}}const Me=`
1
+ var ve=Object.defineProperty;var be=(n,i,e)=>i in n?ve(n,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[i]=e;var u=(n,i,e)=>be(n,typeof i!="symbol"?i+"":i,e);import{r as le,i as we,a as Ae}from"./index-Tiu74FPg.js";function Ee(n){return n.hasRuntime||n.runtimeInjected?!1:!!(n.hasNestedCompositions||n.hasTimelines&&n.attempts>=5)}function V(n){return typeof n=="object"&&n!==null}function Ce(n){return V(n)&&typeof n.getDuration=="function"}function Te(n){return V(n)&&typeof n.duration=="function"&&typeof n.time=="function"&&typeof n.seek=="function"&&typeof n.play=="function"&&typeof n.pause=="function"}function Se(n){if(!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(n))throw new Error(`Invalid HyperFrames runtime version: ${n}`);return`https://cdn.jsdelivr.net/npm/@hyperframes/core@${n}/dist/hyperframe.runtime.iife.js`}const H=typeof __HYPERFRAMES_RUNTIME_CDN_URL__=="string"?__HYPERFRAMES_RUNTIME_CDN_URL__:Se("0.0.0-dev");function $(n){if(n===null)return null;const i=Number.parseInt(n,10);return Number.isFinite(i)&&i>0?i:null}function Re(n){const i=(n==null?void 0:n.querySelector("[data-composition-id][data-width][data-height]"))??(n==null?void 0:n.querySelector("[data-width][data-height]"));if(!i)return null;const e=$(i.getAttribute("data-width")),t=$(i.getAttribute("data-height"));return e!==null&&t!==null?{width:e,height:t}:null}class xe{constructor(i,e){u(this,"_interval",null);u(this,"_runtimeInjected",!1);this._iframe=i,this._callbacks=e}get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._runtimeInjected=!1;let i=0;this._interval=setInterval(()=>{var e;i++;try{const t=this._iframe.contentWindow;if(!t)return;const r=!!(t.__hf||t.__player),s=!!(t.__timelines&&Object.keys(t.__timelines).length>0),o=!!((e=this._iframe.contentDocument)!=null&&e.querySelector("[data-composition-src]"));if(Ee({hasRuntime:r,hasTimelines:s,hasNestedCompositions:o,runtimeInjected:this._runtimeInjected,attempts:i})){this._injectRuntime();return}if(this._runtimeInjected&&!r)return;const d=this._resolvePlaybackDurationAdapter(t);if(d&&d.getDuration()>0){this.stop();const p=Re(this._iframe.contentDocument);this._callbacks.onReady({duration:d.getDuration(),adapter:d,compositionSize:p});return}}catch{}i>=40&&(this.stop(),this._callbacks.onError("Composition timeline not found after 8s"))},200)}stop(){this._interval!==null&&(clearInterval(this._interval),this._interval=null)}resolveDirectTimelineAdapter(){try{const i=this._iframe.contentWindow;return i?this._resolveDirectTimelineAdapterFromWindow(i):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(i){return this._resolveDirectTimelineAdapterFromWindow(i)}hasRuntimeBridge(i){return Reflect.get(i,"__hf")!==void 0||V(Reflect.get(i,"__player"))}_injectRuntime(){var i,e;this._runtimeInjected=!0;try{const t=this._iframe.contentDocument;if(!t)return;const r=t.createElement("script");r.src=H,(t.head||t.documentElement).appendChild(r),(e=(i=this._callbacks).onRuntimeInjected)==null||e.call(i)}catch{}}_resolveDirectTimelineAdapterFromWindow(i){var d,p;if(this.hasRuntimeBridge(i))return null;const e=Reflect.get(i,"__timelines");if(!V(e))return null;const t=Object.keys(e);if(t.length===0)return null;const r=(p=(d=this._iframe.contentDocument)==null?void 0:d.querySelector("[data-composition-id]"))==null?void 0:p.getAttribute("data-composition-id"),s=r&&r in e?r:t[t.length-1],o=e[s];return Te(o)?o:null}_resolvePlaybackDurationAdapter(i){const e=Reflect.get(i,"__player");if(Ce(e))return{kind:"runtime",getDuration:()=>e.getDuration()};const t=this._resolveDirectTimelineAdapterFromWindow(i);return t?{kind:"direct-timeline",timeline:t,getDuration:()=>t.duration()}:null}}const Me=`
2
2
  :host {
3
3
  display: block;
4
4
  position: relative;
@@ -1 +1 @@
1
- import{g as P}from"./index-CgGY8dAv.js";function j(c,d){for(var s=0;s<d.length;s++){const a=d[s];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in c)){const l=Object.getOwnPropertyDescriptor(a,i);l&&Object.defineProperty(c,i,l.get?l:{enumerable:!0,get:()=>a[i]})}}}return Object.freeze(Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}))}var v={},w;function k(){if(w)return v;w=1,Object.defineProperty(v,"__esModule",{value:!0}),v.default=d;var c=window.OfflineAudioContext||window.webkitOfflineAudioContext;function d(e){var r=a(e);return r.start(0),[i,y,O(e.sampleRate),s].reduce(function(t,o){return o(t)},r.buffer.getChannelData(0))}function s(e){return e.sort(function(r,t){return t.count-r.count}).splice(0,5)[0].tempo}function a(e){var r=e.length,t=e.numberOfChannels,o=e.sampleRate,n=new c(t,r,o),u=n.createBufferSource();u.buffer=e;var f=n.createBiquadFilter();return f.type="lowpass",u.connect(f),f.connect(n.destination),u}function i(e){for(var r=[],t=.9,o=.3,n=15;r.length<n&&t>=o;)r=l(e,t),t-=.05;if(r.length<n)throw new Error("Could not find enough samples for a reliable detection.");return r}function l(e,r){for(var t=[],o=0,n=e.length;o<n;o+=1)e[o]>r&&(t.push(o),o+=1e4);return t}function y(e){var r=[];return e.forEach(function(t,o){for(var n=function(x){var g=e[o+x]-t,_=r.some(function(h){if(h.interval===g)return h.count+=1});_||r.push({interval:g,count:1})},u=0;u<10;u+=1)n(u)}),r}function O(e){return function(r){var t=[];return r.forEach(function(o){if(o.interval!==0){for(var n=60/(o.interval/e);n<90;)n*=2;for(;n>180;)n/=2;n=Math.round(n);var u=t.some(function(f){if(f.tempo===n)return f.count+=o.count});u||t.push({tempo:n,count:o.count})}}),t}}return v}var p,b;function q(){return b||(b=1,p=k().default),p}var m=q();const A=P(m),D=j({__proto__:null,default:A},[m]);export{D as i};
1
+ import{g as P}from"./index-Tiu74FPg.js";function j(c,d){for(var s=0;s<d.length;s++){const a=d[s];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in c)){const l=Object.getOwnPropertyDescriptor(a,i);l&&Object.defineProperty(c,i,l.get?l:{enumerable:!0,get:()=>a[i]})}}}return Object.freeze(Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}))}var v={},w;function k(){if(w)return v;w=1,Object.defineProperty(v,"__esModule",{value:!0}),v.default=d;var c=window.OfflineAudioContext||window.webkitOfflineAudioContext;function d(e){var r=a(e);return r.start(0),[i,y,O(e.sampleRate),s].reduce(function(t,o){return o(t)},r.buffer.getChannelData(0))}function s(e){return e.sort(function(r,t){return t.count-r.count}).splice(0,5)[0].tempo}function a(e){var r=e.length,t=e.numberOfChannels,o=e.sampleRate,n=new c(t,r,o),u=n.createBufferSource();u.buffer=e;var f=n.createBiquadFilter();return f.type="lowpass",u.connect(f),f.connect(n.destination),u}function i(e){for(var r=[],t=.9,o=.3,n=15;r.length<n&&t>=o;)r=l(e,t),t-=.05;if(r.length<n)throw new Error("Could not find enough samples for a reliable detection.");return r}function l(e,r){for(var t=[],o=0,n=e.length;o<n;o+=1)e[o]>r&&(t.push(o),o+=1e4);return t}function y(e){var r=[];return e.forEach(function(t,o){for(var n=function(x){var g=e[o+x]-t,_=r.some(function(h){if(h.interval===g)return h.count+=1});_||r.push({interval:g,count:1})},u=0;u<10;u+=1)n(u)}),r}function O(e){return function(r){var t=[];return r.forEach(function(o){if(o.interval!==0){for(var n=60/(o.interval/e);n<90;)n*=2;for(;n>180;)n/=2;n=Math.round(n);var u=t.some(function(f){if(f.tempo===n)return f.count+=o.count});u||t.push({tempo:n,count:o.count})}}),t}}return v}var p,b;function q(){return b||(b=1,p=k().default),p}var m=q();const A=P(m),D=j({__proto__:null,default:A},[m]);export{D as i};