@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.
package/dist/team.js CHANGED
@@ -5746,7 +5746,7 @@ var getComponentsToAddStacksTo = () => componentsToAddStacksTo;
5746
5746
  var addSequenceStackTraces = (component) => {
5747
5747
  componentsToAddStacksTo.push(component);
5748
5748
  };
5749
- var VERSION = "4.0.481";
5749
+ var VERSION = "4.0.483";
5750
5750
  var checkMultipleRemotionVersions = () => {
5751
5751
  if (typeof globalThis === "undefined") {
5752
5752
  return;
@@ -6146,6 +6146,77 @@ var transformSchema = {
6146
6146
  }
6147
6147
  };
6148
6148
  var sequenceVisualStyleSchema = transformSchema;
6149
+ var textSchema = {
6150
+ "style.color": {
6151
+ type: "color",
6152
+ default: undefined,
6153
+ description: "Color"
6154
+ },
6155
+ "style.fontSize": {
6156
+ type: "number",
6157
+ default: undefined,
6158
+ min: 0,
6159
+ step: 1,
6160
+ description: "Font size",
6161
+ hiddenFromList: false
6162
+ },
6163
+ "style.lineHeight": {
6164
+ type: "number",
6165
+ default: undefined,
6166
+ min: 0,
6167
+ step: 0.05,
6168
+ description: "Line height",
6169
+ hiddenFromList: false
6170
+ },
6171
+ "style.fontWeight": {
6172
+ type: "enum",
6173
+ default: "400",
6174
+ description: "Font weight",
6175
+ variants: {
6176
+ "100": {},
6177
+ "200": {},
6178
+ "300": {},
6179
+ "400": {},
6180
+ "500": {},
6181
+ "600": {},
6182
+ "700": {},
6183
+ "800": {},
6184
+ "900": {},
6185
+ normal: {},
6186
+ bold: {}
6187
+ }
6188
+ },
6189
+ "style.fontStyle": {
6190
+ type: "enum",
6191
+ default: "normal",
6192
+ description: "Font style",
6193
+ variants: {
6194
+ normal: {},
6195
+ italic: {},
6196
+ oblique: {}
6197
+ }
6198
+ },
6199
+ "style.textAlign": {
6200
+ type: "enum",
6201
+ default: "left",
6202
+ description: "Text align",
6203
+ variants: {
6204
+ left: {},
6205
+ center: {},
6206
+ right: {},
6207
+ justify: {},
6208
+ start: {},
6209
+ end: {}
6210
+ }
6211
+ },
6212
+ "style.letterSpacing": {
6213
+ type: "number",
6214
+ default: undefined,
6215
+ step: 0.1,
6216
+ description: "Letter spacing",
6217
+ hiddenFromList: false
6218
+ }
6219
+ };
6149
6220
  var premountSchema = {
6150
6221
  premountFor: {
6151
6222
  type: "number",
@@ -6204,6 +6275,13 @@ var fromField = {
6204
6275
  step: 1,
6205
6276
  hiddenFromList: true
6206
6277
  };
6278
+ var trimBeforeField = {
6279
+ type: "number",
6280
+ default: 0,
6281
+ min: 0,
6282
+ step: 1,
6283
+ hiddenFromList: true
6284
+ };
6207
6285
  var freezeField = {
6208
6286
  type: "number",
6209
6287
  default: null,
@@ -6213,6 +6291,7 @@ var freezeField = {
6213
6291
  var baseSchema = {
6214
6292
  durationInFrames: durationInFramesField,
6215
6293
  from: fromField,
6294
+ trimBefore: trimBeforeField,
6216
6295
  freeze: freezeField,
6217
6296
  hidden: hiddenField,
6218
6297
  name: sequenceNameField,
@@ -6232,6 +6311,7 @@ var sequenceSchema = {
6232
6311
  };
6233
6312
  var baseSchemaWithoutFrom = {
6234
6313
  durationInFrames: durationInFramesField,
6314
+ trimBefore: trimBeforeField,
6235
6315
  freeze: freezeField,
6236
6316
  hidden: hiddenField,
6237
6317
  name: sequenceNameField,
@@ -6882,6 +6962,35 @@ function findRange(input, inputRange) {
6882
6962
  return i - 1;
6883
6963
  }
6884
6964
  var defaultEasing = (num) => num;
6965
+ var shouldExtendRightForEasing = (easing) => {
6966
+ return easing.remotionShouldExtendRight === true;
6967
+ };
6968
+ var resolveEasingForSegment = ({
6969
+ easing,
6970
+ segmentIndex
6971
+ }) => {
6972
+ if (easing === undefined) {
6973
+ return defaultEasing;
6974
+ }
6975
+ if (typeof easing === "function") {
6976
+ return easing;
6977
+ }
6978
+ return easing[segmentIndex];
6979
+ };
6980
+ var interpolateSegment = ({
6981
+ input,
6982
+ inputRange,
6983
+ outputRange,
6984
+ easing,
6985
+ extrapolateLeft,
6986
+ extrapolateRight
6987
+ }) => {
6988
+ return interpolateFunction(input, inputRange, outputRange, {
6989
+ easing,
6990
+ extrapolateLeft,
6991
+ extrapolateRight: input > inputRange[1] && extrapolateRight === "clamp" && shouldExtendRightForEasing(easing) ? "extend" : extrapolateRight
6992
+ });
6993
+ };
6885
6994
  var interpolateNumber = ({
6886
6995
  input,
6887
6996
  inputRange,
@@ -6892,15 +7001,6 @@ var interpolateNumber = ({
6892
7001
  return outputRange[0];
6893
7002
  }
6894
7003
  const easingOption = options?.easing;
6895
- const resolveEasingForSegment = (segmentIndex) => {
6896
- if (easingOption === undefined) {
6897
- return defaultEasing;
6898
- }
6899
- if (typeof easingOption === "function") {
6900
- return easingOption;
6901
- }
6902
- return easingOption[segmentIndex];
6903
- };
6904
7004
  let extrapolateLeft = "extend";
6905
7005
  if (options?.extrapolateLeft !== undefined) {
6906
7006
  extrapolateLeft = options.extrapolateLeft;
@@ -6911,11 +7011,41 @@ var interpolateNumber = ({
6911
7011
  }
6912
7012
  const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
6913
7013
  const range = findRange(posterizedInput, inputRange);
6914
- return interpolateFunction(posterizedInput, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
6915
- easing: resolveEasingForSegment(range),
7014
+ const easing = resolveEasingForSegment({
7015
+ easing: easingOption,
7016
+ segmentIndex: range
7017
+ });
7018
+ let result = interpolateSegment({
7019
+ input: posterizedInput,
7020
+ inputRange: [inputRange[range], inputRange[range + 1]],
7021
+ outputRange: [outputRange[range], outputRange[range + 1]],
7022
+ easing,
6916
7023
  extrapolateLeft,
6917
7024
  extrapolateRight
6918
7025
  });
7026
+ for (let segmentIndex = 0;segmentIndex < range; segmentIndex++) {
7027
+ const previousEasing = resolveEasingForSegment({
7028
+ easing: easingOption,
7029
+ segmentIndex
7030
+ });
7031
+ if (!shouldExtendRightForEasing(previousEasing)) {
7032
+ continue;
7033
+ }
7034
+ const previousSegmentEnd = inputRange[segmentIndex + 1];
7035
+ if (posterizedInput <= previousSegmentEnd) {
7036
+ continue;
7037
+ }
7038
+ const continuedSegmentValue = interpolateSegment({
7039
+ input: posterizedInput,
7040
+ inputRange: [inputRange[segmentIndex], previousSegmentEnd],
7041
+ outputRange: [outputRange[segmentIndex], outputRange[segmentIndex + 1]],
7042
+ easing: previousEasing,
7043
+ extrapolateLeft,
7044
+ extrapolateRight: "extend"
7045
+ });
7046
+ result += continuedSegmentValue - outputRange[segmentIndex + 1];
7047
+ }
7048
+ return result;
6919
7049
  };
6920
7050
  var interpolateString = ({
6921
7051
  input,
@@ -7389,21 +7519,40 @@ class Easing {
7389
7519
  static back(s = 1.70158) {
7390
7520
  return (t) => t * t * ((s + 1) * t - s);
7391
7521
  }
7392
- static spring(config = {}) {
7393
- return (t) => {
7522
+ static spring({
7523
+ allowTail = false,
7524
+ durationRestThreshold,
7525
+ ...config
7526
+ } = {}) {
7527
+ const easing = (t) => {
7394
7528
  if (t <= 0) {
7395
7529
  return 0;
7396
7530
  }
7397
- if (t >= 1) {
7531
+ if (!allowTail && t >= 1) {
7398
7532
  return 1;
7399
7533
  }
7534
+ if (allowTail) {
7535
+ return spring({
7536
+ fps: springEasingDurationInFrames,
7537
+ frame: t * measureSpring({
7538
+ fps: springEasingDurationInFrames,
7539
+ config,
7540
+ threshold: durationRestThreshold
7541
+ }),
7542
+ config
7543
+ });
7544
+ }
7400
7545
  return spring({
7401
7546
  fps: springEasingDurationInFrames,
7402
7547
  frame: t * springEasingDurationInFrames,
7403
7548
  config,
7404
- durationInFrames: springEasingDurationInFrames
7549
+ durationInFrames: springEasingDurationInFrames,
7550
+ durationRestThreshold
7405
7551
  });
7406
7552
  };
7553
+ return Object.assign(easing, {
7554
+ remotionShouldExtendRight: allowTail
7555
+ });
7407
7556
  }
7408
7557
  static bounce(t) {
7409
7558
  const u = clampUnit(t);
@@ -7934,25 +8083,31 @@ var interpolateColors = (input, inputRange, outputRange, options) => {
7934
8083
  const processedOutputRange = outputRange.map((c2) => processColor(c2));
7935
8084
  return interpolateColorsRGB(input, inputRange, processedOutputRange, options);
7936
8085
  };
7937
- var easingToFn = (e) => {
7938
- switch (e.type) {
8086
+ var easingToFn = ({
8087
+ easing,
8088
+ forceSpringAllowTail
8089
+ }) => {
8090
+ switch (easing.type) {
7939
8091
  case "linear":
7940
8092
  return Easing.linear;
7941
8093
  case "spring":
7942
8094
  return Easing.spring({
7943
- damping: e.damping,
7944
- mass: e.mass,
7945
- overshootClamping: e.overshootClamping,
7946
- stiffness: e.stiffness
8095
+ allowTail: forceSpringAllowTail ?? easing.allowTail ?? undefined,
8096
+ damping: easing.damping,
8097
+ durationRestThreshold: easing.durationRestThreshold ?? undefined,
8098
+ mass: easing.mass,
8099
+ overshootClamping: easing.overshootClamping,
8100
+ stiffness: easing.stiffness
7947
8101
  });
7948
8102
  case "bezier":
7949
- return bezier(e.x1, e.y1, e.x2, e.y2);
8103
+ return bezier(easing.x1, easing.y1, easing.x2, easing.y2);
7950
8104
  default:
7951
- throw new TypeError(`Unsupported easing: ${JSON.stringify(e)}`);
8105
+ throw new TypeError(`Unsupported easing: ${JSON.stringify(easing)}`);
7952
8106
  }
7953
8107
  };
7954
8108
  var interpolateKeyframedStatus = ({
7955
8109
  frame,
8110
+ forceSpringAllowTail,
7956
8111
  status
7957
8112
  }) => {
7958
8113
  const { keyframes, easing, clamping, interpolationFunction } = status;
@@ -7971,7 +8126,7 @@ var interpolateKeyframedStatus = ({
7971
8126
  }
7972
8127
  try {
7973
8128
  return interpolateColors(frame, inputRange, outputs, {
7974
- easing: easing.map(easingToFn),
8129
+ easing: easing.map((e) => easingToFn({ easing: e, forceSpringAllowTail })),
7975
8130
  posterize: status.posterize
7976
8131
  });
7977
8132
  } catch {
@@ -7983,7 +8138,7 @@ var interpolateKeyframedStatus = ({
7983
8138
  }
7984
8139
  try {
7985
8140
  return interpolate(frame, inputRange, outputs, {
7986
- easing: easing.map(easingToFn),
8141
+ easing: easing.map((e) => easingToFn({ easing: e, forceSpringAllowTail })),
7987
8142
  extrapolateLeft: clamping.left,
7988
8143
  extrapolateRight: clamping.right,
7989
8144
  posterize: status.posterize
@@ -8006,6 +8161,7 @@ var resolveDragOverrideValue = ({
8006
8161
  return { type: "none" };
8007
8162
  }
8008
8163
  const interpolated = interpolateKeyframedStatus({
8164
+ forceSpringAllowTail: null,
8009
8165
  frame,
8010
8166
  status: dragOverrideValue.status
8011
8167
  });
@@ -8031,6 +8187,7 @@ var getEffectiveVisualModeValue = ({
8031
8187
  if (propStatus.status === "keyframed") {
8032
8188
  if (frame !== null) {
8033
8189
  return interpolateKeyframedStatus({
8190
+ forceSpringAllowTail: null,
8034
8191
  frame,
8035
8192
  status: propStatus
8036
8193
  });
@@ -8099,6 +8256,7 @@ var resolvePropStatusOverrides = (propStatus, frame) => {
8099
8256
  }
8100
8257
  if (status.status === "keyframed") {
8101
8258
  const value = interpolateKeyframedStatus({
8259
+ forceSpringAllowTail: null,
8102
8260
  frame,
8103
8261
  status
8104
8262
  });
@@ -8274,6 +8432,17 @@ var findPropsToDelete = ({
8274
8432
  var DEFAULT_LINEAR_EASING = {
8275
8433
  type: "linear"
8276
8434
  };
8435
+ var getEasingIndexToDuplicate = ({
8436
+ insertedKeyframeIndex,
8437
+ easingLength,
8438
+ keyframeCount
8439
+ }) => {
8440
+ const isSplittingExistingSegment = insertedKeyframeIndex > 0 && insertedKeyframeIndex < keyframeCount - 1;
8441
+ if (!isSplittingExistingSegment || easingLength === 0) {
8442
+ return null;
8443
+ }
8444
+ return Math.min(insertedKeyframeIndex - 1, easingLength - 1);
8445
+ };
8277
8446
  var makeStaticDragOverride = (value) => {
8278
8447
  return { type: "static", value };
8279
8448
  };
@@ -8285,6 +8454,16 @@ var makeKeyframedDragOverride = ({
8285
8454
  const existingIndex = status.keyframes.findIndex((keyframe) => keyframe.frame === frame);
8286
8455
  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);
8287
8456
  const easing = [...status.easing];
8457
+ if (existingIndex === -1) {
8458
+ const insertedKeyframeIndex = keyframes.findIndex((keyframe) => keyframe.frame === frame);
8459
+ const easingIndexToDuplicate = getEasingIndexToDuplicate({
8460
+ insertedKeyframeIndex,
8461
+ easingLength: easing.length,
8462
+ keyframeCount: keyframes.length
8463
+ });
8464
+ const easingToDuplicate = easingIndexToDuplicate === null ? DEFAULT_LINEAR_EASING : easing[easingIndexToDuplicate];
8465
+ easing.splice(insertedKeyframeIndex, 0, easingToDuplicate);
8466
+ }
8288
8467
  while (easing.length < keyframes.length - 1) {
8289
8468
  easing.push(DEFAULT_LINEAR_EASING);
8290
8469
  }
@@ -8356,6 +8535,7 @@ var computeEffectiveSchemaValuesDotNotation = ({
8356
8535
  value = dragOverride.value;
8357
8536
  } else if (frame !== null) {
8358
8537
  const interpolated = interpolateKeyframedStatus({
8538
+ forceSpringAllowTail: null,
8359
8539
  frame,
8360
8540
  status
8361
8541
  });
@@ -8533,6 +8713,7 @@ var withInteractivitySchema = ({
8533
8713
  var EMPTY_EFFECTS = [];
8534
8714
  var RegularSequenceRefForwardingFunction = ({
8535
8715
  from = 0,
8716
+ trimBefore = 0,
8536
8717
  freeze,
8537
8718
  durationInFrames = Infinity,
8538
8719
  children,
@@ -8557,7 +8738,6 @@ var RegularSequenceRefForwardingFunction = ({
8557
8738
  const parentSequence = useContext17(SequenceContext);
8558
8739
  const { rootId } = useTimelineContext();
8559
8740
  const cumulatedFrom = parentSequence ? parentSequence.cumulatedFrom + parentSequence.relativeFrom : 0;
8560
- const absoluteFrom = (parentSequence?.absoluteFrom ?? 0) + from;
8561
8741
  const nonce = useNonce();
8562
8742
  if (layout !== "absolute-fill" && layout !== "none") {
8563
8743
  throw new TypeError(`The layout prop of <Sequence /> expects either "absolute-fill" or "none", but you passed: ${layout}`);
@@ -8577,6 +8757,18 @@ var RegularSequenceRefForwardingFunction = ({
8577
8757
  if (!Number.isFinite(from)) {
8578
8758
  throw new TypeError(`The "from" prop of a sequence must be finite, but got ${from}.`);
8579
8759
  }
8760
+ if (typeof trimBefore !== "number") {
8761
+ throw new TypeError(`You passed to the "trimBefore" prop of your <Sequence> an argument of type ${typeof trimBefore}, but it must be a number.`);
8762
+ }
8763
+ if (trimBefore < 0) {
8764
+ throw new TypeError(`The "trimBefore" prop of <Sequence /> must be greater than or equal to 0, but got ${trimBefore}.`);
8765
+ }
8766
+ if (Number.isNaN(trimBefore)) {
8767
+ throw new TypeError('The "trimBefore" prop of <Sequence /> must be a real number, but it is NaN.');
8768
+ }
8769
+ if (!Number.isFinite(trimBefore)) {
8770
+ throw new TypeError(`The "trimBefore" prop of <Sequence /> must be finite, but it is ${trimBefore}.`);
8771
+ }
8580
8772
  if (typeof freeze !== "undefined" && freeze !== null) {
8581
8773
  if (typeof freeze !== "number") {
8582
8774
  throw new TypeError(`The "freeze" prop of <Sequence /> must be a number, but is of type ${typeof freeze}.`);
@@ -8590,7 +8782,9 @@ var RegularSequenceRefForwardingFunction = ({
8590
8782
  }
8591
8783
  const absoluteFrame = useTimelinePosition();
8592
8784
  const videoConfig = useVideoConfig();
8593
- const parentSequenceDuration = parentSequence ? Math.min(parentSequence.durationInFrames - from, durationInFrames) : durationInFrames;
8785
+ const effectiveRelativeFrom = from - trimBefore;
8786
+ const absoluteFrom = (parentSequence?.absoluteFrom ?? 0) + effectiveRelativeFrom;
8787
+ const parentSequenceDuration = parentSequence ? Math.min(parentSequence.durationInFrames - effectiveRelativeFrom, durationInFrames) : durationInFrames;
8594
8788
  const actualDurationInFrames = Math.max(0, Math.min(videoConfig.durationInFrames - from, parentSequenceDuration));
8595
8789
  const { registerSequence, unregisterSequence } = useContext17(SequenceManager);
8596
8790
  const wrapperRefForOutline = useRef6(null);
@@ -8601,7 +8795,7 @@ var RegularSequenceRefForwardingFunction = ({
8601
8795
  const postmounting = useMemo14(() => {
8602
8796
  return parentSequence?.postmounting || Boolean(other._remotionInternalIsPostmounting);
8603
8797
  }, [other._remotionInternalIsPostmounting, parentSequence?.postmounting]);
8604
- const currentSequenceStart = cumulatedFrom + from;
8798
+ const currentSequenceStart = cumulatedFrom + effectiveRelativeFrom;
8605
8799
  const parentSequenceStart = parentSequence ? parentSequence.cumulatedFrom + parentSequence.relativeFrom : 0;
8606
8800
  const parentFirstFrame = parentSequence ? parentSequenceStart - parentSequence.cumulatedNegativeFrom : 0;
8607
8801
  const firstFrame = Math.max(0, parentFirstFrame, currentSequenceStart);
@@ -8610,7 +8804,7 @@ var RegularSequenceRefForwardingFunction = ({
8610
8804
  return {
8611
8805
  absoluteFrom,
8612
8806
  cumulatedFrom,
8613
- relativeFrom: from,
8807
+ relativeFrom: effectiveRelativeFrom,
8614
8808
  cumulatedNegativeFrom,
8615
8809
  durationInFrames: actualDurationInFrames,
8616
8810
  parentFrom: parentSequence?.relativeFrom ?? 0,
@@ -8625,7 +8819,7 @@ var RegularSequenceRefForwardingFunction = ({
8625
8819
  }, [
8626
8820
  cumulatedFrom,
8627
8821
  absoluteFrom,
8628
- from,
8822
+ effectiveRelativeFrom,
8629
8823
  actualDurationInFrames,
8630
8824
  parentSequence,
8631
8825
  id,
@@ -8647,6 +8841,7 @@ var RegularSequenceRefForwardingFunction = ({
8647
8841
  const stackRef = useRef6(null);
8648
8842
  stackRef.current = stack ?? inheritedStack;
8649
8843
  const registeredFrozenFrame = typeof freeze === "number" ? freeze : null;
8844
+ const registeredTrimBefore = trimBefore === 0 ? null : trimBefore;
8650
8845
  const parentCumulatedNegativeFrom = parentSequence?.cumulatedNegativeFrom ?? 0;
8651
8846
  const startMediaFrom = isMedia && isMedia.type !== "image" ? isMedia.data.startMediaFrom + parentCumulatedNegativeFrom - cumulatedNegativeFrom : null;
8652
8847
  const mediaFrameAtSequenceZero = isMedia && isMedia.type !== "image" ? isMedia.data.startMediaFrom + parentCumulatedNegativeFrom : null;
@@ -8665,6 +8860,7 @@ var RegularSequenceRefForwardingFunction = ({
8665
8860
  documentationLink: resolvedDocumentationLink,
8666
8861
  duration: actualDurationInFrames,
8667
8862
  from,
8863
+ trimBefore: registeredTrimBefore,
8668
8864
  id,
8669
8865
  loopDisplay,
8670
8866
  nonce: nonce.get(),
@@ -8689,6 +8885,7 @@ var RegularSequenceRefForwardingFunction = ({
8689
8885
  doesVolumeChange: isMedia.data.doesVolumeChange,
8690
8886
  duration: actualDurationInFrames,
8691
8887
  from,
8888
+ trimBefore: registeredTrimBefore,
8692
8889
  id,
8693
8890
  loopDisplay,
8694
8891
  nonce: nonce.get(),
@@ -8714,6 +8911,7 @@ var RegularSequenceRefForwardingFunction = ({
8714
8911
  }
8715
8912
  registerSequence({
8716
8913
  from,
8914
+ trimBefore: registeredTrimBefore,
8717
8915
  duration: actualDurationInFrames,
8718
8916
  id,
8719
8917
  displayName: timelineClipName,
@@ -8747,6 +8945,8 @@ var RegularSequenceRefForwardingFunction = ({
8747
8945
  actualDurationInFrames,
8748
8946
  rootId,
8749
8947
  from,
8948
+ trimBefore,
8949
+ registeredTrimBefore,
8750
8950
  showInTimeline,
8751
8951
  nonce,
8752
8952
  loopDisplay,
@@ -10014,13 +10214,15 @@ var prefetch = (src, options) => {
10014
10214
  resolve = res;
10015
10215
  reject = rej;
10016
10216
  });
10217
+ waitUntilDone.catch(() => {
10218
+ return;
10219
+ });
10017
10220
  const controller = new AbortController;
10018
- let canBeAborted = true;
10221
+ let reader = null;
10019
10222
  fetch(srcWithoutHash, {
10020
10223
  signal: controller.signal,
10021
10224
  credentials: options?.credentials ?? undefined
10022
10225
  }).then((res) => {
10023
- canBeAborted = false;
10024
10226
  if (canceled) {
10025
10227
  return null;
10026
10228
  }
@@ -10036,15 +10238,16 @@ var prefetch = (src, options) => {
10036
10238
  if (!res.body) {
10037
10239
  throw new Error(`HTTP response of ${srcWithoutHash} has no body`);
10038
10240
  }
10039
- const reader = res.body.getReader();
10241
+ const responseReader = res.body.getReader();
10242
+ reader = responseReader;
10040
10243
  return getBlobFromReader({
10041
- reader,
10244
+ reader: responseReader,
10042
10245
  contentType: options?.contentType ?? headerContentType ?? null,
10043
10246
  contentLength: res.headers.get("Content-Length") ? parseInt(res.headers.get("Content-Length"), 10) : null,
10044
10247
  onProgress: options?.onProgress
10045
10248
  });
10046
10249
  }).then((buf) => {
10047
- if (!buf) {
10250
+ if (!buf || canceled) {
10048
10251
  return;
10049
10252
  }
10050
10253
  const actualBlob = options?.contentType ? new Blob([buf], { type: options.contentType }) : buf;
@@ -10092,12 +10295,18 @@ var prefetch = (src, options) => {
10092
10295
  return copy;
10093
10296
  });
10094
10297
  } else {
10095
- canceled = true;
10096
- if (canBeAborted) {
10097
- try {
10098
- controller.abort(new Error("free() called"));
10099
- } catch {}
10298
+ if (canceled) {
10299
+ return;
10100
10300
  }
10301
+ canceled = true;
10302
+ const cancellationError = new Error("free() called");
10303
+ reject(cancellationError);
10304
+ try {
10305
+ controller.abort(cancellationError);
10306
+ } catch {}
10307
+ reader?.cancel(cancellationError).catch(() => {
10308
+ return;
10309
+ });
10101
10310
  }
10102
10311
  },
10103
10312
  waitUntilDone: () => {
@@ -11269,6 +11478,7 @@ var useMediaInTimeline = ({
11269
11478
  id,
11270
11479
  duration,
11271
11480
  from: 0,
11481
+ trimBefore: null,
11272
11482
  parent: parentSequence?.id ?? null,
11273
11483
  displayName: finalDisplayName,
11274
11484
  documentationLink,
@@ -12131,11 +12341,11 @@ var useMediaTag = ({
12131
12341
  ]);
12132
12342
  };
12133
12343
  var MediaVolumeContext = createContext22({
12134
- mediaMuted: false,
12344
+ playerMuted: false,
12135
12345
  mediaVolume: 1
12136
12346
  });
12137
12347
  var SetMediaVolumeContext = createContext22({
12138
- setMediaMuted: () => {
12348
+ setPlayerMuted: () => {
12139
12349
  throw new Error("default");
12140
12350
  },
12141
12351
  setMediaVolume: () => {
@@ -12149,12 +12359,12 @@ var useMediaVolumeState = () => {
12149
12359
  return [mediaVolume, setMediaVolume];
12150
12360
  }, [mediaVolume, setMediaVolume]);
12151
12361
  };
12152
- var useMediaMutedState = () => {
12153
- const { mediaMuted } = useContext27(MediaVolumeContext);
12154
- const { setMediaMuted } = useContext27(SetMediaVolumeContext);
12362
+ var usePlayerMutedState = () => {
12363
+ const { playerMuted } = useContext27(MediaVolumeContext);
12364
+ const { setPlayerMuted } = useContext27(SetMediaVolumeContext);
12155
12365
  return useMemo26(() => {
12156
- return [mediaMuted, setMediaMuted];
12157
- }, [mediaMuted, setMediaMuted]);
12366
+ return [playerMuted, setPlayerMuted];
12367
+ }, [playerMuted, setPlayerMuted]);
12158
12368
  };
12159
12369
  var warnAboutTooHighVolume = (volume) => {
12160
12370
  if (volume >= 100) {
@@ -12200,7 +12410,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
12200
12410
  throw new Error("typecheck error");
12201
12411
  }
12202
12412
  const [mediaVolume] = useMediaVolumeState();
12203
- const [mediaMuted] = useMediaMutedState();
12413
+ const [playerMuted] = usePlayerMutedState();
12204
12414
  const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
12205
12415
  if (!src) {
12206
12416
  throw new TypeError("No 'src' was passed to <Html5Audio>.");
@@ -12221,7 +12431,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
12221
12431
  });
12222
12432
  const propsToPass = useMemo27(() => {
12223
12433
  return {
12224
- muted: muted || mediaMuted || userPreferredVolume <= 0,
12434
+ muted: muted || playerMuted || userPreferredVolume <= 0,
12225
12435
  src: preloadedSrc,
12226
12436
  loop: _remotionInternalNativeLoopPassed,
12227
12437
  crossOrigin: crossOriginValue,
@@ -12229,7 +12439,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
12229
12439
  };
12230
12440
  }, [
12231
12441
  _remotionInternalNativeLoopPassed,
12232
- mediaMuted,
12442
+ playerMuted,
12233
12443
  muted,
12234
12444
  nativeProps,
12235
12445
  preloadedSrc,
@@ -12477,6 +12687,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
12477
12687
  var AudioForRendering = forwardRef6(AudioForRenderingRefForwardingFunction);
12478
12688
  var AudioRefForwardingFunction = (props, ref) => {
12479
12689
  const audioTagsContext = useContext30(SharedAudioTagsContext);
12690
+ const propsWithFreeze = props;
12480
12691
  const {
12481
12692
  startFrom,
12482
12693
  endAt,
@@ -12487,14 +12698,18 @@ var AudioRefForwardingFunction = (props, ref) => {
12487
12698
  pauseWhenBuffering,
12488
12699
  showInTimeline,
12489
12700
  onError: onRemotionError,
12701
+ freeze,
12490
12702
  ...otherProps
12491
- } = props;
12492
- const { loop, ...propsOtherThanLoop } = props;
12703
+ } = propsWithFreeze;
12704
+ const { loop, freeze: _freeze, ...propsOtherThanLoop } = propsWithFreeze;
12493
12705
  const { fps } = useVideoConfig();
12494
12706
  const environment = useRemotionEnvironment();
12495
12707
  if (environment.isClientSideRendering) {
12496
12708
  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");
12497
12709
  }
12710
+ if (typeof freeze !== "undefined") {
12711
+ throw new TypeError('The "freeze" prop is not supported on <Html5Audio />. Use <Sequence freeze={...}> to freeze media playback.');
12712
+ }
12498
12713
  const { durations, setDurations } = useContext30(DurationsContext);
12499
12714
  if (typeof props.src !== "string") {
12500
12715
  throw new TypeError(`The \`<Html5Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
@@ -12626,6 +12841,15 @@ var solidSchema = {
12626
12841
  description: "Height",
12627
12842
  hiddenFromList: false
12628
12843
  },
12844
+ pixelDensity: {
12845
+ type: "number",
12846
+ min: 1,
12847
+ max: 3,
12848
+ step: 0.1,
12849
+ default: 1,
12850
+ description: "Pixel density",
12851
+ hiddenFromList: false
12852
+ },
12629
12853
  ...transformSchema
12630
12854
  };
12631
12855
  var SolidInner = ({
@@ -12742,6 +12966,7 @@ var SolidOuter = forwardRef8(({
12742
12966
  style,
12743
12967
  name,
12744
12968
  from,
12969
+ trimBefore,
12745
12970
  freeze,
12746
12971
  hidden,
12747
12972
  showInTimeline,
@@ -12756,6 +12981,7 @@ var SolidOuter = forwardRef8(({
12756
12981
  return /* @__PURE__ */ jsx24(Sequence, {
12757
12982
  layout: "none",
12758
12983
  from,
12984
+ trimBefore,
12759
12985
  freeze,
12760
12986
  hidden,
12761
12987
  showInTimeline,
@@ -12822,6 +13048,10 @@ function resolveHtmlInCanvasPixelDensity(pixelDensity) {
12822
13048
  }
12823
13049
  return pixelDensity;
12824
13050
  }
13051
+ var isMissingPaintRecordError = (error2) => {
13052
+ return error2 instanceof DOMException && error2.name === "InvalidStateError";
13053
+ };
13054
+ var missingPaintRecordMessage = "HtmlInCanvas: Expected the element to be inside the viewport during rendering, but Chrome had no cached paint record for it.";
12825
13055
  var resizeOffscreenCanvas = ({
12826
13056
  offscreen,
12827
13057
  width,
@@ -12865,6 +13095,7 @@ var HtmlInCanvasContent = forwardRef9(({
12865
13095
  const canvasWidth = Math.ceil(width * resolvedPixelDensity);
12866
13096
  const canvasHeight = Math.ceil(height * resolvedPixelDensity);
12867
13097
  const { continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
13098
+ const { isRendering } = useRemotionEnvironment();
12868
13099
  if (!isHtmlInCanvasSupported()) {
12869
13100
  cancelRender2(new Error(HTML_IN_CANVAS_UNSUPPORTED_MESSAGE));
12870
13101
  }
@@ -12913,34 +13144,53 @@ var HtmlInCanvasContent = forwardRef9(({
12913
13144
  if (!placeholderCanvas) {
12914
13145
  throw new Error("Canvas not found");
12915
13146
  }
12916
- const offscreen2d = offscreen.getContext("2d");
12917
- if (!offscreen2d) {
12918
- throw new Error("Failed to acquire 2D context for <HtmlInCanvas> offscreen canvas");
12919
- }
12920
13147
  const handle = delayRender("onPaint");
12921
13148
  if (!initializedRef.current) {
12922
- initializedRef.current = true;
12923
- const initImage = placeholderCanvas.captureElementImage(element);
12924
- const currentOnInit = onInitRef.current;
12925
- if (currentOnInit) {
12926
- const cleanup = await currentOnInit({
12927
- canvas: offscreen,
12928
- element,
12929
- elementImage: initImage,
12930
- pixelDensity: resolvedPixelDensity
12931
- });
12932
- if (typeof cleanup !== "function") {
12933
- throw new Error("HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.");
12934
- }
12935
- if (unmountedRef.current) {
12936
- cleanup();
13149
+ let initImage = null;
13150
+ try {
13151
+ initImage = placeholderCanvas.captureElementImage(element);
13152
+ } catch (error2) {
13153
+ if (isMissingPaintRecordError(error2) && !isRendering) {} else if (isMissingPaintRecordError(error2)) {
13154
+ throw new Error(missingPaintRecordMessage);
12937
13155
  } else {
12938
- onInitCleanupRef.current = cleanup;
13156
+ throw error2;
13157
+ }
13158
+ }
13159
+ if (initImage) {
13160
+ initializedRef.current = true;
13161
+ const currentOnInit = onInitRef.current;
13162
+ if (currentOnInit) {
13163
+ const cleanup = await currentOnInit({
13164
+ canvas: offscreen,
13165
+ element,
13166
+ elementImage: initImage,
13167
+ pixelDensity: resolvedPixelDensity
13168
+ });
13169
+ if (typeof cleanup !== "function") {
13170
+ throw new Error("HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.");
13171
+ }
13172
+ if (unmountedRef.current) {
13173
+ cleanup();
13174
+ } else {
13175
+ onInitCleanupRef.current = cleanup;
13176
+ }
12939
13177
  }
12940
13178
  }
12941
13179
  }
12942
13180
  const handler = onPaintRef.current ?? defaultOnPaint;
12943
- const elImage = placeholderCanvas.captureElementImage(element);
13181
+ let elImage;
13182
+ try {
13183
+ elImage = placeholderCanvas.captureElementImage(element);
13184
+ } catch (error2) {
13185
+ if (isMissingPaintRecordError(error2) && !isRendering) {
13186
+ continueRender2(handle);
13187
+ return;
13188
+ }
13189
+ if (isMissingPaintRecordError(error2)) {
13190
+ throw new Error(missingPaintRecordMessage);
13191
+ }
13192
+ throw error2;
13193
+ }
12944
13194
  await handler({
12945
13195
  canvas: offscreen,
12946
13196
  element,
@@ -12965,7 +13215,8 @@ var HtmlInCanvasContent = forwardRef9(({
12965
13215
  chainState,
12966
13216
  continueRender2,
12967
13217
  cancelRender2,
12968
- resolvedPixelDensity
13218
+ resolvedPixelDensity,
13219
+ isRendering
12969
13220
  ]);
12970
13221
  useLayoutEffect9(() => {
12971
13222
  const placeholder = canvas2dRef.current;
@@ -13101,6 +13352,15 @@ var HtmlInCanvasInner = forwardRef9(({
13101
13352
  HtmlInCanvasInner.displayName = "HtmlInCanvas";
13102
13353
  var htmlInCanvasSchema = {
13103
13354
  ...baseSchema,
13355
+ pixelDensity: {
13356
+ type: "number",
13357
+ min: 1,
13358
+ max: 3,
13359
+ step: 0.1,
13360
+ default: 1,
13361
+ description: "Pixel density",
13362
+ hiddenFromList: false
13363
+ },
13104
13364
  ...transformSchema
13105
13365
  };
13106
13366
  var HtmlInCanvasWrapped = withInteractivitySchema({
@@ -13418,6 +13678,7 @@ var CanvasImageInner = forwardRef10(({
13418
13678
  delayRenderTimeoutInMilliseconds,
13419
13679
  durationInFrames,
13420
13680
  from,
13681
+ trimBefore,
13421
13682
  freeze,
13422
13683
  hidden,
13423
13684
  name,
@@ -13439,6 +13700,7 @@ var CanvasImageInner = forwardRef10(({
13439
13700
  return /* @__PURE__ */ jsx26(Sequence, {
13440
13701
  layout: "none",
13441
13702
  from: from ?? 0,
13703
+ trimBefore,
13442
13704
  durationInFrames: durationInFrames ?? Infinity,
13443
13705
  freeze,
13444
13706
  hidden,
@@ -13675,6 +13937,7 @@ var NativeImgInner = ({
13675
13937
  showInTimeline,
13676
13938
  src,
13677
13939
  from,
13940
+ trimBefore,
13678
13941
  durationInFrames,
13679
13942
  freeze,
13680
13943
  controls,
@@ -13687,6 +13950,7 @@ var NativeImgInner = ({
13687
13950
  return /* @__PURE__ */ jsx28(Sequence, {
13688
13951
  layout: "none",
13689
13952
  from: from ?? 0,
13953
+ trimBefore,
13690
13954
  durationInFrames: durationInFrames ?? Infinity,
13691
13955
  freeze,
13692
13956
  _remotionInternalStack: stack,
@@ -13760,6 +14024,7 @@ var ImgInner = ({
13760
14024
  showInTimeline,
13761
14025
  src,
13762
14026
  from,
14027
+ trimBefore,
13763
14028
  durationInFrames,
13764
14029
  freeze,
13765
14030
  controls,
@@ -13785,6 +14050,7 @@ var ImgInner = ({
13785
14050
  showInTimeline,
13786
14051
  src,
13787
14052
  from,
14053
+ trimBefore,
13788
14054
  durationInFrames,
13789
14055
  freeze,
13790
14056
  controls,
@@ -13827,6 +14093,7 @@ var ImgInner = ({
13827
14093
  delayRenderRetries,
13828
14094
  delayRenderTimeoutInMilliseconds,
13829
14095
  from,
14096
+ trimBefore,
13830
14097
  durationInFrames,
13831
14098
  freeze,
13832
14099
  hidden,
@@ -13849,7 +14116,8 @@ var Img = withInteractivitySchema({
13849
14116
  addSequenceStackTraces(Img);
13850
14117
  var interactiveElementSchema = {
13851
14118
  ...baseSchema,
13852
- ...transformSchema
14119
+ ...transformSchema,
14120
+ ...textSchema
13853
14121
  };
13854
14122
  var setRef = (ref, value) => {
13855
14123
  if (typeof ref === "function") {
@@ -13863,6 +14131,7 @@ var makeInteractiveElement = (tag, displayName) => {
13863
14131
  const {
13864
14132
  durationInFrames,
13865
14133
  from,
14134
+ trimBefore,
13866
14135
  freeze,
13867
14136
  hidden,
13868
14137
  name,
@@ -13879,6 +14148,7 @@ var makeInteractiveElement = (tag, displayName) => {
13879
14148
  return /* @__PURE__ */ jsx29(Sequence, {
13880
14149
  layout: "none",
13881
14150
  from: from ?? 0,
14151
+ trimBefore,
13882
14152
  durationInFrames: durationInFrames ?? Infinity,
13883
14153
  freeze,
13884
14154
  hidden,
@@ -13909,6 +14179,7 @@ var makeInteractiveElement = (tag, displayName) => {
13909
14179
  var Interactive = {
13910
14180
  baseSchema,
13911
14181
  transformSchema,
14182
+ textSchema,
13912
14183
  premountSchema,
13913
14184
  sequenceSchema,
13914
14185
  withSchema: withInteractivitySchema,
@@ -14738,7 +15009,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
14738
15009
  throw new Error("acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.");
14739
15010
  }
14740
15011
  const [mediaVolume] = useMediaVolumeState();
14741
- const [mediaMuted] = useMediaMutedState();
15012
+ const [playerMuted] = usePlayerMutedState();
14742
15013
  const userPreferredVolume = evaluateVolume({
14743
15014
  frame: volumePropFrame,
14744
15015
  volume,
@@ -14894,7 +15165,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
14894
15165
  return /* @__PURE__ */ jsx34("video", {
14895
15166
  ...nativeProps,
14896
15167
  ref: videoRef,
14897
- muted: muted || mediaMuted || userPreferredVolume <= 0,
15168
+ muted: muted || playerMuted || userPreferredVolume <= 0,
14898
15169
  playsInline: true,
14899
15170
  src: actualSrc,
14900
15171
  loop: _remotionInternalNativeLoopPassed,
@@ -15185,6 +15456,7 @@ var Internals = {
15185
15456
  sequenceStyleSchema,
15186
15457
  sequenceVisualStyleSchema,
15187
15458
  sequencePremountSchema,
15459
+ textSchema,
15188
15460
  transformSchema,
15189
15461
  premountSchema,
15190
15462
  flattenActiveSchema,
@@ -15194,7 +15466,7 @@ var Internals = {
15194
15466
  useVideo,
15195
15467
  getRoot,
15196
15468
  useMediaVolumeState,
15197
- useMediaMutedState,
15469
+ usePlayerMutedState,
15198
15470
  useMediaInTimeline,
15199
15471
  useLazyComponent,
15200
15472
  truthy,
@@ -16137,6 +16409,7 @@ var RenderSvg = ({
16137
16409
  pixelDensity,
16138
16410
  durationInFrames,
16139
16411
  from,
16412
+ trimBefore,
16140
16413
  freeze,
16141
16414
  hidden,
16142
16415
  name,
@@ -16246,6 +16519,7 @@ var RenderSvg = ({
16246
16519
  return /* @__PURE__ */ jsx40(Sequence, {
16247
16520
  layout: "none",
16248
16521
  from,
16522
+ trimBefore,
16249
16523
  freeze,
16250
16524
  hidden,
16251
16525
  showInTimeline,