@remotion/promo-pages 4.0.481 → 4.0.483

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.
@@ -22899,7 +22899,7 @@ var getComponentsToAddStacksTo = () => componentsToAddStacksTo;
22899
22899
  var addSequenceStackTraces = (component) => {
22900
22900
  componentsToAddStacksTo.push(component);
22901
22901
  };
22902
- var VERSION = "4.0.481";
22902
+ var VERSION = "4.0.483";
22903
22903
  var checkMultipleRemotionVersions = () => {
22904
22904
  if (typeof globalThis === "undefined") {
22905
22905
  return;
@@ -23299,6 +23299,77 @@ var transformSchema = {
23299
23299
  }
23300
23300
  };
23301
23301
  var sequenceVisualStyleSchema = transformSchema;
23302
+ var textSchema = {
23303
+ "style.color": {
23304
+ type: "color",
23305
+ default: undefined,
23306
+ description: "Color"
23307
+ },
23308
+ "style.fontSize": {
23309
+ type: "number",
23310
+ default: undefined,
23311
+ min: 0,
23312
+ step: 1,
23313
+ description: "Font size",
23314
+ hiddenFromList: false
23315
+ },
23316
+ "style.lineHeight": {
23317
+ type: "number",
23318
+ default: undefined,
23319
+ min: 0,
23320
+ step: 0.05,
23321
+ description: "Line height",
23322
+ hiddenFromList: false
23323
+ },
23324
+ "style.fontWeight": {
23325
+ type: "enum",
23326
+ default: "400",
23327
+ description: "Font weight",
23328
+ variants: {
23329
+ "100": {},
23330
+ "200": {},
23331
+ "300": {},
23332
+ "400": {},
23333
+ "500": {},
23334
+ "600": {},
23335
+ "700": {},
23336
+ "800": {},
23337
+ "900": {},
23338
+ normal: {},
23339
+ bold: {}
23340
+ }
23341
+ },
23342
+ "style.fontStyle": {
23343
+ type: "enum",
23344
+ default: "normal",
23345
+ description: "Font style",
23346
+ variants: {
23347
+ normal: {},
23348
+ italic: {},
23349
+ oblique: {}
23350
+ }
23351
+ },
23352
+ "style.textAlign": {
23353
+ type: "enum",
23354
+ default: "left",
23355
+ description: "Text align",
23356
+ variants: {
23357
+ left: {},
23358
+ center: {},
23359
+ right: {},
23360
+ justify: {},
23361
+ start: {},
23362
+ end: {}
23363
+ }
23364
+ },
23365
+ "style.letterSpacing": {
23366
+ type: "number",
23367
+ default: undefined,
23368
+ step: 0.1,
23369
+ description: "Letter spacing",
23370
+ hiddenFromList: false
23371
+ }
23372
+ };
23302
23373
  var premountSchema = {
23303
23374
  premountFor: {
23304
23375
  type: "number",
@@ -23357,6 +23428,13 @@ var fromField = {
23357
23428
  step: 1,
23358
23429
  hiddenFromList: true
23359
23430
  };
23431
+ var trimBeforeField = {
23432
+ type: "number",
23433
+ default: 0,
23434
+ min: 0,
23435
+ step: 1,
23436
+ hiddenFromList: true
23437
+ };
23360
23438
  var freezeField = {
23361
23439
  type: "number",
23362
23440
  default: null,
@@ -23366,6 +23444,7 @@ var freezeField = {
23366
23444
  var baseSchema = {
23367
23445
  durationInFrames: durationInFramesField,
23368
23446
  from: fromField,
23447
+ trimBefore: trimBeforeField,
23369
23448
  freeze: freezeField,
23370
23449
  hidden: hiddenField,
23371
23450
  name: sequenceNameField,
@@ -23385,6 +23464,7 @@ var sequenceSchema = {
23385
23464
  };
23386
23465
  var baseSchemaWithoutFrom = {
23387
23466
  durationInFrames: durationInFramesField,
23467
+ trimBefore: trimBeforeField,
23388
23468
  freeze: freezeField,
23389
23469
  hidden: hiddenField,
23390
23470
  name: sequenceNameField,
@@ -24035,6 +24115,35 @@ function findRange(input, inputRange) {
24035
24115
  return i - 1;
24036
24116
  }
24037
24117
  var defaultEasing = (num) => num;
24118
+ var shouldExtendRightForEasing = (easing) => {
24119
+ return easing.remotionShouldExtendRight === true;
24120
+ };
24121
+ var resolveEasingForSegment = ({
24122
+ easing,
24123
+ segmentIndex
24124
+ }) => {
24125
+ if (easing === undefined) {
24126
+ return defaultEasing;
24127
+ }
24128
+ if (typeof easing === "function") {
24129
+ return easing;
24130
+ }
24131
+ return easing[segmentIndex];
24132
+ };
24133
+ var interpolateSegment = ({
24134
+ input,
24135
+ inputRange,
24136
+ outputRange,
24137
+ easing,
24138
+ extrapolateLeft,
24139
+ extrapolateRight
24140
+ }) => {
24141
+ return interpolateFunction(input, inputRange, outputRange, {
24142
+ easing,
24143
+ extrapolateLeft,
24144
+ extrapolateRight: input > inputRange[1] && extrapolateRight === "clamp" && shouldExtendRightForEasing(easing) ? "extend" : extrapolateRight
24145
+ });
24146
+ };
24038
24147
  var interpolateNumber = ({
24039
24148
  input,
24040
24149
  inputRange,
@@ -24045,15 +24154,6 @@ var interpolateNumber = ({
24045
24154
  return outputRange[0];
24046
24155
  }
24047
24156
  const easingOption = options?.easing;
24048
- const resolveEasingForSegment = (segmentIndex) => {
24049
- if (easingOption === undefined) {
24050
- return defaultEasing;
24051
- }
24052
- if (typeof easingOption === "function") {
24053
- return easingOption;
24054
- }
24055
- return easingOption[segmentIndex];
24056
- };
24057
24157
  let extrapolateLeft = "extend";
24058
24158
  if (options?.extrapolateLeft !== undefined) {
24059
24159
  extrapolateLeft = options.extrapolateLeft;
@@ -24064,11 +24164,41 @@ var interpolateNumber = ({
24064
24164
  }
24065
24165
  const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
24066
24166
  const range = findRange(posterizedInput, inputRange);
24067
- return interpolateFunction(posterizedInput, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
24068
- easing: resolveEasingForSegment(range),
24167
+ const easing = resolveEasingForSegment({
24168
+ easing: easingOption,
24169
+ segmentIndex: range
24170
+ });
24171
+ let result = interpolateSegment({
24172
+ input: posterizedInput,
24173
+ inputRange: [inputRange[range], inputRange[range + 1]],
24174
+ outputRange: [outputRange[range], outputRange[range + 1]],
24175
+ easing,
24069
24176
  extrapolateLeft,
24070
24177
  extrapolateRight
24071
24178
  });
24179
+ for (let segmentIndex = 0;segmentIndex < range; segmentIndex++) {
24180
+ const previousEasing = resolveEasingForSegment({
24181
+ easing: easingOption,
24182
+ segmentIndex
24183
+ });
24184
+ if (!shouldExtendRightForEasing(previousEasing)) {
24185
+ continue;
24186
+ }
24187
+ const previousSegmentEnd = inputRange[segmentIndex + 1];
24188
+ if (posterizedInput <= previousSegmentEnd) {
24189
+ continue;
24190
+ }
24191
+ const continuedSegmentValue = interpolateSegment({
24192
+ input: posterizedInput,
24193
+ inputRange: [inputRange[segmentIndex], previousSegmentEnd],
24194
+ outputRange: [outputRange[segmentIndex], outputRange[segmentIndex + 1]],
24195
+ easing: previousEasing,
24196
+ extrapolateLeft,
24197
+ extrapolateRight: "extend"
24198
+ });
24199
+ result += continuedSegmentValue - outputRange[segmentIndex + 1];
24200
+ }
24201
+ return result;
24072
24202
  };
24073
24203
  var interpolateString = ({
24074
24204
  input,
@@ -24542,21 +24672,40 @@ class Easing {
24542
24672
  static back(s = 1.70158) {
24543
24673
  return (t) => t * t * ((s + 1) * t - s);
24544
24674
  }
24545
- static spring(config = {}) {
24546
- return (t) => {
24675
+ static spring({
24676
+ allowTail = false,
24677
+ durationRestThreshold,
24678
+ ...config
24679
+ } = {}) {
24680
+ const easing = (t) => {
24547
24681
  if (t <= 0) {
24548
24682
  return 0;
24549
24683
  }
24550
- if (t >= 1) {
24684
+ if (!allowTail && t >= 1) {
24551
24685
  return 1;
24552
24686
  }
24687
+ if (allowTail) {
24688
+ return spring({
24689
+ fps: springEasingDurationInFrames,
24690
+ frame: t * measureSpring({
24691
+ fps: springEasingDurationInFrames,
24692
+ config,
24693
+ threshold: durationRestThreshold
24694
+ }),
24695
+ config
24696
+ });
24697
+ }
24553
24698
  return spring({
24554
24699
  fps: springEasingDurationInFrames,
24555
24700
  frame: t * springEasingDurationInFrames,
24556
24701
  config,
24557
- durationInFrames: springEasingDurationInFrames
24702
+ durationInFrames: springEasingDurationInFrames,
24703
+ durationRestThreshold
24558
24704
  });
24559
24705
  };
24706
+ return Object.assign(easing, {
24707
+ remotionShouldExtendRight: allowTail
24708
+ });
24560
24709
  }
24561
24710
  static bounce(t) {
24562
24711
  const u = clampUnit(t);
@@ -25087,25 +25236,31 @@ var interpolateColors = (input, inputRange, outputRange, options) => {
25087
25236
  const processedOutputRange = outputRange.map((c2) => processColor(c2));
25088
25237
  return interpolateColorsRGB(input, inputRange, processedOutputRange, options);
25089
25238
  };
25090
- var easingToFn = (e) => {
25091
- switch (e.type) {
25239
+ var easingToFn = ({
25240
+ easing,
25241
+ forceSpringAllowTail
25242
+ }) => {
25243
+ switch (easing.type) {
25092
25244
  case "linear":
25093
25245
  return Easing.linear;
25094
25246
  case "spring":
25095
25247
  return Easing.spring({
25096
- damping: e.damping,
25097
- mass: e.mass,
25098
- overshootClamping: e.overshootClamping,
25099
- stiffness: e.stiffness
25248
+ allowTail: forceSpringAllowTail ?? easing.allowTail ?? undefined,
25249
+ damping: easing.damping,
25250
+ durationRestThreshold: easing.durationRestThreshold ?? undefined,
25251
+ mass: easing.mass,
25252
+ overshootClamping: easing.overshootClamping,
25253
+ stiffness: easing.stiffness
25100
25254
  });
25101
25255
  case "bezier":
25102
- return bezier(e.x1, e.y1, e.x2, e.y2);
25256
+ return bezier(easing.x1, easing.y1, easing.x2, easing.y2);
25103
25257
  default:
25104
- throw new TypeError(`Unsupported easing: ${JSON.stringify(e)}`);
25258
+ throw new TypeError(`Unsupported easing: ${JSON.stringify(easing)}`);
25105
25259
  }
25106
25260
  };
25107
25261
  var interpolateKeyframedStatus = ({
25108
25262
  frame,
25263
+ forceSpringAllowTail,
25109
25264
  status
25110
25265
  }) => {
25111
25266
  const { keyframes, easing, clamping, interpolationFunction } = status;
@@ -25124,7 +25279,7 @@ var interpolateKeyframedStatus = ({
25124
25279
  }
25125
25280
  try {
25126
25281
  return interpolateColors(frame, inputRange, outputs, {
25127
- easing: easing.map(easingToFn),
25282
+ easing: easing.map((e) => easingToFn({ easing: e, forceSpringAllowTail })),
25128
25283
  posterize: status.posterize
25129
25284
  });
25130
25285
  } catch {
@@ -25136,7 +25291,7 @@ var interpolateKeyframedStatus = ({
25136
25291
  }
25137
25292
  try {
25138
25293
  return interpolate(frame, inputRange, outputs, {
25139
- easing: easing.map(easingToFn),
25294
+ easing: easing.map((e) => easingToFn({ easing: e, forceSpringAllowTail })),
25140
25295
  extrapolateLeft: clamping.left,
25141
25296
  extrapolateRight: clamping.right,
25142
25297
  posterize: status.posterize
@@ -25159,6 +25314,7 @@ var resolveDragOverrideValue = ({
25159
25314
  return { type: "none" };
25160
25315
  }
25161
25316
  const interpolated = interpolateKeyframedStatus({
25317
+ forceSpringAllowTail: null,
25162
25318
  frame,
25163
25319
  status: dragOverrideValue.status
25164
25320
  });
@@ -25184,6 +25340,7 @@ var getEffectiveVisualModeValue = ({
25184
25340
  if (propStatus.status === "keyframed") {
25185
25341
  if (frame !== null) {
25186
25342
  return interpolateKeyframedStatus({
25343
+ forceSpringAllowTail: null,
25187
25344
  frame,
25188
25345
  status: propStatus
25189
25346
  });
@@ -25252,6 +25409,7 @@ var resolvePropStatusOverrides = (propStatus, frame) => {
25252
25409
  }
25253
25410
  if (status.status === "keyframed") {
25254
25411
  const value = interpolateKeyframedStatus({
25412
+ forceSpringAllowTail: null,
25255
25413
  frame,
25256
25414
  status
25257
25415
  });
@@ -25427,6 +25585,17 @@ var findPropsToDelete = ({
25427
25585
  var DEFAULT_LINEAR_EASING = {
25428
25586
  type: "linear"
25429
25587
  };
25588
+ var getEasingIndexToDuplicate = ({
25589
+ insertedKeyframeIndex,
25590
+ easingLength,
25591
+ keyframeCount
25592
+ }) => {
25593
+ const isSplittingExistingSegment = insertedKeyframeIndex > 0 && insertedKeyframeIndex < keyframeCount - 1;
25594
+ if (!isSplittingExistingSegment || easingLength === 0) {
25595
+ return null;
25596
+ }
25597
+ return Math.min(insertedKeyframeIndex - 1, easingLength - 1);
25598
+ };
25430
25599
  var makeStaticDragOverride = (value) => {
25431
25600
  return { type: "static", value };
25432
25601
  };
@@ -25438,6 +25607,16 @@ var makeKeyframedDragOverride = ({
25438
25607
  const existingIndex = status.keyframes.findIndex((keyframe) => keyframe.frame === frame);
25439
25608
  const keyframes = existingIndex === -1 ? [...status.keyframes, { frame, value }].sort((first, second) => first.frame - second.frame) : status.keyframes.map((keyframe, index) => index === existingIndex ? { frame, value } : keyframe);
25440
25609
  const easing = [...status.easing];
25610
+ if (existingIndex === -1) {
25611
+ const insertedKeyframeIndex = keyframes.findIndex((keyframe) => keyframe.frame === frame);
25612
+ const easingIndexToDuplicate = getEasingIndexToDuplicate({
25613
+ insertedKeyframeIndex,
25614
+ easingLength: easing.length,
25615
+ keyframeCount: keyframes.length
25616
+ });
25617
+ const easingToDuplicate = easingIndexToDuplicate === null ? DEFAULT_LINEAR_EASING : easing[easingIndexToDuplicate];
25618
+ easing.splice(insertedKeyframeIndex, 0, easingToDuplicate);
25619
+ }
25441
25620
  while (easing.length < keyframes.length - 1) {
25442
25621
  easing.push(DEFAULT_LINEAR_EASING);
25443
25622
  }
@@ -25509,6 +25688,7 @@ var computeEffectiveSchemaValuesDotNotation = ({
25509
25688
  value = dragOverride.value;
25510
25689
  } else if (frame !== null) {
25511
25690
  const interpolated = interpolateKeyframedStatus({
25691
+ forceSpringAllowTail: null,
25512
25692
  frame,
25513
25693
  status
25514
25694
  });
@@ -25686,6 +25866,7 @@ var withInteractivitySchema = ({
25686
25866
  var EMPTY_EFFECTS = [];
25687
25867
  var RegularSequenceRefForwardingFunction = ({
25688
25868
  from = 0,
25869
+ trimBefore = 0,
25689
25870
  freeze,
25690
25871
  durationInFrames = Infinity,
25691
25872
  children,
@@ -25710,7 +25891,6 @@ var RegularSequenceRefForwardingFunction = ({
25710
25891
  const parentSequence = useContext17(SequenceContext);
25711
25892
  const { rootId } = useTimelineContext();
25712
25893
  const cumulatedFrom = parentSequence ? parentSequence.cumulatedFrom + parentSequence.relativeFrom : 0;
25713
- const absoluteFrom = (parentSequence?.absoluteFrom ?? 0) + from;
25714
25894
  const nonce = useNonce();
25715
25895
  if (layout !== "absolute-fill" && layout !== "none") {
25716
25896
  throw new TypeError(`The layout prop of <Sequence /> expects either "absolute-fill" or "none", but you passed: ${layout}`);
@@ -25730,6 +25910,18 @@ var RegularSequenceRefForwardingFunction = ({
25730
25910
  if (!Number.isFinite(from)) {
25731
25911
  throw new TypeError(`The "from" prop of a sequence must be finite, but got ${from}.`);
25732
25912
  }
25913
+ if (typeof trimBefore !== "number") {
25914
+ throw new TypeError(`You passed to the "trimBefore" prop of your <Sequence> an argument of type ${typeof trimBefore}, but it must be a number.`);
25915
+ }
25916
+ if (trimBefore < 0) {
25917
+ throw new TypeError(`The "trimBefore" prop of <Sequence /> must be greater than or equal to 0, but got ${trimBefore}.`);
25918
+ }
25919
+ if (Number.isNaN(trimBefore)) {
25920
+ throw new TypeError('The "trimBefore" prop of <Sequence /> must be a real number, but it is NaN.');
25921
+ }
25922
+ if (!Number.isFinite(trimBefore)) {
25923
+ throw new TypeError(`The "trimBefore" prop of <Sequence /> must be finite, but it is ${trimBefore}.`);
25924
+ }
25733
25925
  if (typeof freeze !== "undefined" && freeze !== null) {
25734
25926
  if (typeof freeze !== "number") {
25735
25927
  throw new TypeError(`The "freeze" prop of <Sequence /> must be a number, but is of type ${typeof freeze}.`);
@@ -25743,7 +25935,9 @@ var RegularSequenceRefForwardingFunction = ({
25743
25935
  }
25744
25936
  const absoluteFrame = useTimelinePosition();
25745
25937
  const videoConfig = useVideoConfig();
25746
- const parentSequenceDuration = parentSequence ? Math.min(parentSequence.durationInFrames - from, durationInFrames) : durationInFrames;
25938
+ const effectiveRelativeFrom = from - trimBefore;
25939
+ const absoluteFrom = (parentSequence?.absoluteFrom ?? 0) + effectiveRelativeFrom;
25940
+ const parentSequenceDuration = parentSequence ? Math.min(parentSequence.durationInFrames - effectiveRelativeFrom, durationInFrames) : durationInFrames;
25747
25941
  const actualDurationInFrames = Math.max(0, Math.min(videoConfig.durationInFrames - from, parentSequenceDuration));
25748
25942
  const { registerSequence, unregisterSequence } = useContext17(SequenceManager);
25749
25943
  const wrapperRefForOutline = useRef6(null);
@@ -25754,7 +25948,7 @@ var RegularSequenceRefForwardingFunction = ({
25754
25948
  const postmounting = useMemo14(() => {
25755
25949
  return parentSequence?.postmounting || Boolean(other._remotionInternalIsPostmounting);
25756
25950
  }, [other._remotionInternalIsPostmounting, parentSequence?.postmounting]);
25757
- const currentSequenceStart = cumulatedFrom + from;
25951
+ const currentSequenceStart = cumulatedFrom + effectiveRelativeFrom;
25758
25952
  const parentSequenceStart = parentSequence ? parentSequence.cumulatedFrom + parentSequence.relativeFrom : 0;
25759
25953
  const parentFirstFrame = parentSequence ? parentSequenceStart - parentSequence.cumulatedNegativeFrom : 0;
25760
25954
  const firstFrame = Math.max(0, parentFirstFrame, currentSequenceStart);
@@ -25763,7 +25957,7 @@ var RegularSequenceRefForwardingFunction = ({
25763
25957
  return {
25764
25958
  absoluteFrom,
25765
25959
  cumulatedFrom,
25766
- relativeFrom: from,
25960
+ relativeFrom: effectiveRelativeFrom,
25767
25961
  cumulatedNegativeFrom,
25768
25962
  durationInFrames: actualDurationInFrames,
25769
25963
  parentFrom: parentSequence?.relativeFrom ?? 0,
@@ -25778,7 +25972,7 @@ var RegularSequenceRefForwardingFunction = ({
25778
25972
  }, [
25779
25973
  cumulatedFrom,
25780
25974
  absoluteFrom,
25781
- from,
25975
+ effectiveRelativeFrom,
25782
25976
  actualDurationInFrames,
25783
25977
  parentSequence,
25784
25978
  id,
@@ -25800,6 +25994,7 @@ var RegularSequenceRefForwardingFunction = ({
25800
25994
  const stackRef = useRef6(null);
25801
25995
  stackRef.current = stack ?? inheritedStack;
25802
25996
  const registeredFrozenFrame = typeof freeze === "number" ? freeze : null;
25997
+ const registeredTrimBefore = trimBefore === 0 ? null : trimBefore;
25803
25998
  const parentCumulatedNegativeFrom = parentSequence?.cumulatedNegativeFrom ?? 0;
25804
25999
  const startMediaFrom = isMedia && isMedia.type !== "image" ? isMedia.data.startMediaFrom + parentCumulatedNegativeFrom - cumulatedNegativeFrom : null;
25805
26000
  const mediaFrameAtSequenceZero = isMedia && isMedia.type !== "image" ? isMedia.data.startMediaFrom + parentCumulatedNegativeFrom : null;
@@ -25818,6 +26013,7 @@ var RegularSequenceRefForwardingFunction = ({
25818
26013
  documentationLink: resolvedDocumentationLink,
25819
26014
  duration: actualDurationInFrames,
25820
26015
  from,
26016
+ trimBefore: registeredTrimBefore,
25821
26017
  id,
25822
26018
  loopDisplay,
25823
26019
  nonce: nonce.get(),
@@ -25842,6 +26038,7 @@ var RegularSequenceRefForwardingFunction = ({
25842
26038
  doesVolumeChange: isMedia.data.doesVolumeChange,
25843
26039
  duration: actualDurationInFrames,
25844
26040
  from,
26041
+ trimBefore: registeredTrimBefore,
25845
26042
  id,
25846
26043
  loopDisplay,
25847
26044
  nonce: nonce.get(),
@@ -25867,6 +26064,7 @@ var RegularSequenceRefForwardingFunction = ({
25867
26064
  }
25868
26065
  registerSequence({
25869
26066
  from,
26067
+ trimBefore: registeredTrimBefore,
25870
26068
  duration: actualDurationInFrames,
25871
26069
  id,
25872
26070
  displayName: timelineClipName,
@@ -25900,6 +26098,8 @@ var RegularSequenceRefForwardingFunction = ({
25900
26098
  actualDurationInFrames,
25901
26099
  rootId,
25902
26100
  from,
26101
+ trimBefore,
26102
+ registeredTrimBefore,
25903
26103
  showInTimeline,
25904
26104
  nonce,
25905
26105
  loopDisplay,
@@ -27167,13 +27367,15 @@ var prefetch = (src, options) => {
27167
27367
  resolve = res;
27168
27368
  reject = rej;
27169
27369
  });
27370
+ waitUntilDone.catch(() => {
27371
+ return;
27372
+ });
27170
27373
  const controller = new AbortController;
27171
- let canBeAborted = true;
27374
+ let reader = null;
27172
27375
  fetch(srcWithoutHash, {
27173
27376
  signal: controller.signal,
27174
27377
  credentials: options?.credentials ?? undefined
27175
27378
  }).then((res) => {
27176
- canBeAborted = false;
27177
27379
  if (canceled) {
27178
27380
  return null;
27179
27381
  }
@@ -27189,15 +27391,16 @@ var prefetch = (src, options) => {
27189
27391
  if (!res.body) {
27190
27392
  throw new Error(`HTTP response of ${srcWithoutHash} has no body`);
27191
27393
  }
27192
- const reader = res.body.getReader();
27394
+ const responseReader = res.body.getReader();
27395
+ reader = responseReader;
27193
27396
  return getBlobFromReader({
27194
- reader,
27397
+ reader: responseReader,
27195
27398
  contentType: options?.contentType ?? headerContentType ?? null,
27196
27399
  contentLength: res.headers.get("Content-Length") ? parseInt(res.headers.get("Content-Length"), 10) : null,
27197
27400
  onProgress: options?.onProgress
27198
27401
  });
27199
27402
  }).then((buf) => {
27200
- if (!buf) {
27403
+ if (!buf || canceled) {
27201
27404
  return;
27202
27405
  }
27203
27406
  const actualBlob = options?.contentType ? new Blob([buf], { type: options.contentType }) : buf;
@@ -27245,12 +27448,18 @@ var prefetch = (src, options) => {
27245
27448
  return copy;
27246
27449
  });
27247
27450
  } else {
27248
- canceled = true;
27249
- if (canBeAborted) {
27250
- try {
27251
- controller.abort(new Error("free() called"));
27252
- } catch {}
27451
+ if (canceled) {
27452
+ return;
27253
27453
  }
27454
+ canceled = true;
27455
+ const cancellationError = new Error("free() called");
27456
+ reject(cancellationError);
27457
+ try {
27458
+ controller.abort(cancellationError);
27459
+ } catch {}
27460
+ reader?.cancel(cancellationError).catch(() => {
27461
+ return;
27462
+ });
27254
27463
  }
27255
27464
  },
27256
27465
  waitUntilDone: () => {
@@ -28422,6 +28631,7 @@ var useMediaInTimeline = ({
28422
28631
  id,
28423
28632
  duration,
28424
28633
  from: 0,
28634
+ trimBefore: null,
28425
28635
  parent: parentSequence?.id ?? null,
28426
28636
  displayName: finalDisplayName,
28427
28637
  documentationLink,
@@ -29284,11 +29494,11 @@ var useMediaTag = ({
29284
29494
  ]);
29285
29495
  };
29286
29496
  var MediaVolumeContext = createContext22({
29287
- mediaMuted: false,
29497
+ playerMuted: false,
29288
29498
  mediaVolume: 1
29289
29499
  });
29290
29500
  var SetMediaVolumeContext = createContext22({
29291
- setMediaMuted: () => {
29501
+ setPlayerMuted: () => {
29292
29502
  throw new Error("default");
29293
29503
  },
29294
29504
  setMediaVolume: () => {
@@ -29302,12 +29512,12 @@ var useMediaVolumeState = () => {
29302
29512
  return [mediaVolume, setMediaVolume];
29303
29513
  }, [mediaVolume, setMediaVolume]);
29304
29514
  };
29305
- var useMediaMutedState = () => {
29306
- const { mediaMuted } = useContext27(MediaVolumeContext);
29307
- const { setMediaMuted } = useContext27(SetMediaVolumeContext);
29515
+ var usePlayerMutedState = () => {
29516
+ const { playerMuted } = useContext27(MediaVolumeContext);
29517
+ const { setPlayerMuted } = useContext27(SetMediaVolumeContext);
29308
29518
  return useMemo26(() => {
29309
- return [mediaMuted, setMediaMuted];
29310
- }, [mediaMuted, setMediaMuted]);
29519
+ return [playerMuted, setPlayerMuted];
29520
+ }, [playerMuted, setPlayerMuted]);
29311
29521
  };
29312
29522
  var warnAboutTooHighVolume = (volume) => {
29313
29523
  if (volume >= 100) {
@@ -29353,7 +29563,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
29353
29563
  throw new Error("typecheck error");
29354
29564
  }
29355
29565
  const [mediaVolume] = useMediaVolumeState();
29356
- const [mediaMuted] = useMediaMutedState();
29566
+ const [playerMuted] = usePlayerMutedState();
29357
29567
  const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
29358
29568
  if (!src) {
29359
29569
  throw new TypeError("No 'src' was passed to <Html5Audio>.");
@@ -29374,7 +29584,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
29374
29584
  });
29375
29585
  const propsToPass = useMemo27(() => {
29376
29586
  return {
29377
- muted: muted || mediaMuted || userPreferredVolume <= 0,
29587
+ muted: muted || playerMuted || userPreferredVolume <= 0,
29378
29588
  src: preloadedSrc,
29379
29589
  loop: _remotionInternalNativeLoopPassed,
29380
29590
  crossOrigin: crossOriginValue,
@@ -29382,7 +29592,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
29382
29592
  };
29383
29593
  }, [
29384
29594
  _remotionInternalNativeLoopPassed,
29385
- mediaMuted,
29595
+ playerMuted,
29386
29596
  muted,
29387
29597
  nativeProps,
29388
29598
  preloadedSrc,
@@ -29630,6 +29840,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
29630
29840
  var AudioForRendering = forwardRef6(AudioForRenderingRefForwardingFunction);
29631
29841
  var AudioRefForwardingFunction = (props, ref) => {
29632
29842
  const audioTagsContext = useContext30(SharedAudioTagsContext);
29843
+ const propsWithFreeze = props;
29633
29844
  const {
29634
29845
  startFrom,
29635
29846
  endAt,
@@ -29640,14 +29851,18 @@ var AudioRefForwardingFunction = (props, ref) => {
29640
29851
  pauseWhenBuffering,
29641
29852
  showInTimeline,
29642
29853
  onError: onRemotionError,
29854
+ freeze,
29643
29855
  ...otherProps
29644
- } = props;
29645
- const { loop, ...propsOtherThanLoop } = props;
29856
+ } = propsWithFreeze;
29857
+ const { loop, freeze: _freeze, ...propsOtherThanLoop } = propsWithFreeze;
29646
29858
  const { fps } = useVideoConfig();
29647
29859
  const environment = useRemotionEnvironment();
29648
29860
  if (environment.isClientSideRendering) {
29649
29861
  throw new Error("<Html5Audio> is not supported in @remotion/web-renderer. Use <Audio> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");
29650
29862
  }
29863
+ if (typeof freeze !== "undefined") {
29864
+ throw new TypeError('The "freeze" prop is not supported on <Html5Audio />. Use <Sequence freeze={...}> to freeze media playback.');
29865
+ }
29651
29866
  const { durations, setDurations } = useContext30(DurationsContext);
29652
29867
  if (typeof props.src !== "string") {
29653
29868
  throw new TypeError(`The \`<Html5Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
@@ -29779,6 +29994,15 @@ var solidSchema = {
29779
29994
  description: "Height",
29780
29995
  hiddenFromList: false
29781
29996
  },
29997
+ pixelDensity: {
29998
+ type: "number",
29999
+ min: 1,
30000
+ max: 3,
30001
+ step: 0.1,
30002
+ default: 1,
30003
+ description: "Pixel density",
30004
+ hiddenFromList: false
30005
+ },
29782
30006
  ...transformSchema
29783
30007
  };
29784
30008
  var SolidInner = ({
@@ -29895,6 +30119,7 @@ var SolidOuter = forwardRef8(({
29895
30119
  style,
29896
30120
  name,
29897
30121
  from,
30122
+ trimBefore,
29898
30123
  freeze,
29899
30124
  hidden,
29900
30125
  showInTimeline,
@@ -29909,6 +30134,7 @@ var SolidOuter = forwardRef8(({
29909
30134
  return /* @__PURE__ */ jsx24(Sequence, {
29910
30135
  layout: "none",
29911
30136
  from,
30137
+ trimBefore,
29912
30138
  freeze,
29913
30139
  hidden,
29914
30140
  showInTimeline,
@@ -29975,6 +30201,10 @@ function resolveHtmlInCanvasPixelDensity(pixelDensity) {
29975
30201
  }
29976
30202
  return pixelDensity;
29977
30203
  }
30204
+ var isMissingPaintRecordError = (error2) => {
30205
+ return error2 instanceof DOMException && error2.name === "InvalidStateError";
30206
+ };
30207
+ var missingPaintRecordMessage = "HtmlInCanvas: Expected the element to be inside the viewport during rendering, but Chrome had no cached paint record for it.";
29978
30208
  var resizeOffscreenCanvas = ({
29979
30209
  offscreen,
29980
30210
  width,
@@ -30018,6 +30248,7 @@ var HtmlInCanvasContent = forwardRef9(({
30018
30248
  const canvasWidth = Math.ceil(width * resolvedPixelDensity);
30019
30249
  const canvasHeight = Math.ceil(height * resolvedPixelDensity);
30020
30250
  const { continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
30251
+ const { isRendering } = useRemotionEnvironment();
30021
30252
  if (!isHtmlInCanvasSupported()) {
30022
30253
  cancelRender2(new Error(HTML_IN_CANVAS_UNSUPPORTED_MESSAGE));
30023
30254
  }
@@ -30066,34 +30297,53 @@ var HtmlInCanvasContent = forwardRef9(({
30066
30297
  if (!placeholderCanvas) {
30067
30298
  throw new Error("Canvas not found");
30068
30299
  }
30069
- const offscreen2d = offscreen.getContext("2d");
30070
- if (!offscreen2d) {
30071
- throw new Error("Failed to acquire 2D context for <HtmlInCanvas> offscreen canvas");
30072
- }
30073
30300
  const handle = delayRender("onPaint");
30074
30301
  if (!initializedRef.current) {
30075
- initializedRef.current = true;
30076
- const initImage = placeholderCanvas.captureElementImage(element);
30077
- const currentOnInit = onInitRef.current;
30078
- if (currentOnInit) {
30079
- const cleanup = await currentOnInit({
30080
- canvas: offscreen,
30081
- element,
30082
- elementImage: initImage,
30083
- pixelDensity: resolvedPixelDensity
30084
- });
30085
- if (typeof cleanup !== "function") {
30086
- throw new Error("HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.");
30087
- }
30088
- if (unmountedRef.current) {
30089
- cleanup();
30302
+ let initImage = null;
30303
+ try {
30304
+ initImage = placeholderCanvas.captureElementImage(element);
30305
+ } catch (error2) {
30306
+ if (isMissingPaintRecordError(error2) && !isRendering) {} else if (isMissingPaintRecordError(error2)) {
30307
+ throw new Error(missingPaintRecordMessage);
30090
30308
  } else {
30091
- onInitCleanupRef.current = cleanup;
30309
+ throw error2;
30310
+ }
30311
+ }
30312
+ if (initImage) {
30313
+ initializedRef.current = true;
30314
+ const currentOnInit = onInitRef.current;
30315
+ if (currentOnInit) {
30316
+ const cleanup = await currentOnInit({
30317
+ canvas: offscreen,
30318
+ element,
30319
+ elementImage: initImage,
30320
+ pixelDensity: resolvedPixelDensity
30321
+ });
30322
+ if (typeof cleanup !== "function") {
30323
+ throw new Error("HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.");
30324
+ }
30325
+ if (unmountedRef.current) {
30326
+ cleanup();
30327
+ } else {
30328
+ onInitCleanupRef.current = cleanup;
30329
+ }
30092
30330
  }
30093
30331
  }
30094
30332
  }
30095
30333
  const handler = onPaintRef.current ?? defaultOnPaint;
30096
- const elImage = placeholderCanvas.captureElementImage(element);
30334
+ let elImage;
30335
+ try {
30336
+ elImage = placeholderCanvas.captureElementImage(element);
30337
+ } catch (error2) {
30338
+ if (isMissingPaintRecordError(error2) && !isRendering) {
30339
+ continueRender2(handle);
30340
+ return;
30341
+ }
30342
+ if (isMissingPaintRecordError(error2)) {
30343
+ throw new Error(missingPaintRecordMessage);
30344
+ }
30345
+ throw error2;
30346
+ }
30097
30347
  await handler({
30098
30348
  canvas: offscreen,
30099
30349
  element,
@@ -30118,7 +30368,8 @@ var HtmlInCanvasContent = forwardRef9(({
30118
30368
  chainState,
30119
30369
  continueRender2,
30120
30370
  cancelRender2,
30121
- resolvedPixelDensity
30371
+ resolvedPixelDensity,
30372
+ isRendering
30122
30373
  ]);
30123
30374
  useLayoutEffect9(() => {
30124
30375
  const placeholder = canvas2dRef.current;
@@ -30254,6 +30505,15 @@ var HtmlInCanvasInner = forwardRef9(({
30254
30505
  HtmlInCanvasInner.displayName = "HtmlInCanvas";
30255
30506
  var htmlInCanvasSchema = {
30256
30507
  ...baseSchema,
30508
+ pixelDensity: {
30509
+ type: "number",
30510
+ min: 1,
30511
+ max: 3,
30512
+ step: 0.1,
30513
+ default: 1,
30514
+ description: "Pixel density",
30515
+ hiddenFromList: false
30516
+ },
30257
30517
  ...transformSchema
30258
30518
  };
30259
30519
  var HtmlInCanvasWrapped = withInteractivitySchema({
@@ -30571,6 +30831,7 @@ var CanvasImageInner = forwardRef10(({
30571
30831
  delayRenderTimeoutInMilliseconds,
30572
30832
  durationInFrames,
30573
30833
  from,
30834
+ trimBefore,
30574
30835
  freeze,
30575
30836
  hidden,
30576
30837
  name,
@@ -30592,6 +30853,7 @@ var CanvasImageInner = forwardRef10(({
30592
30853
  return /* @__PURE__ */ jsx26(Sequence, {
30593
30854
  layout: "none",
30594
30855
  from: from ?? 0,
30856
+ trimBefore,
30595
30857
  durationInFrames: durationInFrames ?? Infinity,
30596
30858
  freeze,
30597
30859
  hidden,
@@ -30828,6 +31090,7 @@ var NativeImgInner = ({
30828
31090
  showInTimeline,
30829
31091
  src,
30830
31092
  from,
31093
+ trimBefore,
30831
31094
  durationInFrames,
30832
31095
  freeze,
30833
31096
  controls,
@@ -30840,6 +31103,7 @@ var NativeImgInner = ({
30840
31103
  return /* @__PURE__ */ jsx28(Sequence, {
30841
31104
  layout: "none",
30842
31105
  from: from ?? 0,
31106
+ trimBefore,
30843
31107
  durationInFrames: durationInFrames ?? Infinity,
30844
31108
  freeze,
30845
31109
  _remotionInternalStack: stack,
@@ -30913,6 +31177,7 @@ var ImgInner = ({
30913
31177
  showInTimeline,
30914
31178
  src,
30915
31179
  from,
31180
+ trimBefore,
30916
31181
  durationInFrames,
30917
31182
  freeze,
30918
31183
  controls,
@@ -30938,6 +31203,7 @@ var ImgInner = ({
30938
31203
  showInTimeline,
30939
31204
  src,
30940
31205
  from,
31206
+ trimBefore,
30941
31207
  durationInFrames,
30942
31208
  freeze,
30943
31209
  controls,
@@ -30980,6 +31246,7 @@ var ImgInner = ({
30980
31246
  delayRenderRetries,
30981
31247
  delayRenderTimeoutInMilliseconds,
30982
31248
  from,
31249
+ trimBefore,
30983
31250
  durationInFrames,
30984
31251
  freeze,
30985
31252
  hidden,
@@ -31002,7 +31269,8 @@ var Img = withInteractivitySchema({
31002
31269
  addSequenceStackTraces(Img);
31003
31270
  var interactiveElementSchema = {
31004
31271
  ...baseSchema,
31005
- ...transformSchema
31272
+ ...transformSchema,
31273
+ ...textSchema
31006
31274
  };
31007
31275
  var setRef = (ref, value) => {
31008
31276
  if (typeof ref === "function") {
@@ -31016,6 +31284,7 @@ var makeInteractiveElement = (tag, displayName) => {
31016
31284
  const {
31017
31285
  durationInFrames,
31018
31286
  from,
31287
+ trimBefore,
31019
31288
  freeze,
31020
31289
  hidden,
31021
31290
  name,
@@ -31032,6 +31301,7 @@ var makeInteractiveElement = (tag, displayName) => {
31032
31301
  return /* @__PURE__ */ jsx29(Sequence, {
31033
31302
  layout: "none",
31034
31303
  from: from ?? 0,
31304
+ trimBefore,
31035
31305
  durationInFrames: durationInFrames ?? Infinity,
31036
31306
  freeze,
31037
31307
  hidden,
@@ -31062,6 +31332,7 @@ var makeInteractiveElement = (tag, displayName) => {
31062
31332
  var Interactive = {
31063
31333
  baseSchema,
31064
31334
  transformSchema,
31335
+ textSchema,
31065
31336
  premountSchema,
31066
31337
  sequenceSchema,
31067
31338
  withSchema: withInteractivitySchema,
@@ -31891,7 +32162,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
31891
32162
  throw new Error("acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.");
31892
32163
  }
31893
32164
  const [mediaVolume] = useMediaVolumeState();
31894
- const [mediaMuted] = useMediaMutedState();
32165
+ const [playerMuted] = usePlayerMutedState();
31895
32166
  const userPreferredVolume = evaluateVolume({
31896
32167
  frame: volumePropFrame,
31897
32168
  volume,
@@ -32047,7 +32318,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
32047
32318
  return /* @__PURE__ */ jsx34("video", {
32048
32319
  ...nativeProps,
32049
32320
  ref: videoRef,
32050
- muted: muted || mediaMuted || userPreferredVolume <= 0,
32321
+ muted: muted || playerMuted || userPreferredVolume <= 0,
32051
32322
  playsInline: true,
32052
32323
  src: actualSrc,
32053
32324
  loop: _remotionInternalNativeLoopPassed,
@@ -32338,6 +32609,7 @@ var Internals = {
32338
32609
  sequenceStyleSchema,
32339
32610
  sequenceVisualStyleSchema,
32340
32611
  sequencePremountSchema,
32612
+ textSchema,
32341
32613
  transformSchema,
32342
32614
  premountSchema,
32343
32615
  flattenActiveSchema,
@@ -32347,7 +32619,7 @@ var Internals = {
32347
32619
  useVideo,
32348
32620
  getRoot,
32349
32621
  useMediaVolumeState,
32350
- useMediaMutedState,
32622
+ usePlayerMutedState,
32351
32623
  useMediaInTimeline,
32352
32624
  useLazyComponent,
32353
32625
  truthy,
@@ -33290,6 +33562,7 @@ var RenderSvg = ({
33290
33562
  pixelDensity,
33291
33563
  durationInFrames,
33292
33564
  from,
33565
+ trimBefore,
33293
33566
  freeze,
33294
33567
  hidden,
33295
33568
  name,
@@ -33399,6 +33672,7 @@ var RenderSvg = ({
33399
33672
  return /* @__PURE__ */ jsx40(Sequence, {
33400
33673
  layout: "none",
33401
33674
  from,
33675
+ trimBefore,
33402
33676
  freeze,
33403
33677
  hidden,
33404
33678
  showInTimeline,