@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/Homepage.js CHANGED
@@ -2335,7 +2335,7 @@ var getComponentsToAddStacksTo = () => componentsToAddStacksTo;
2335
2335
  var addSequenceStackTraces = (component) => {
2336
2336
  componentsToAddStacksTo.push(component);
2337
2337
  };
2338
- var VERSION = "4.0.481";
2338
+ var VERSION = "4.0.483";
2339
2339
  var checkMultipleRemotionVersions = () => {
2340
2340
  if (typeof globalThis === "undefined") {
2341
2341
  return;
@@ -2735,6 +2735,77 @@ var transformSchema = {
2735
2735
  }
2736
2736
  };
2737
2737
  var sequenceVisualStyleSchema = transformSchema;
2738
+ var textSchema = {
2739
+ "style.color": {
2740
+ type: "color",
2741
+ default: undefined,
2742
+ description: "Color"
2743
+ },
2744
+ "style.fontSize": {
2745
+ type: "number",
2746
+ default: undefined,
2747
+ min: 0,
2748
+ step: 1,
2749
+ description: "Font size",
2750
+ hiddenFromList: false
2751
+ },
2752
+ "style.lineHeight": {
2753
+ type: "number",
2754
+ default: undefined,
2755
+ min: 0,
2756
+ step: 0.05,
2757
+ description: "Line height",
2758
+ hiddenFromList: false
2759
+ },
2760
+ "style.fontWeight": {
2761
+ type: "enum",
2762
+ default: "400",
2763
+ description: "Font weight",
2764
+ variants: {
2765
+ "100": {},
2766
+ "200": {},
2767
+ "300": {},
2768
+ "400": {},
2769
+ "500": {},
2770
+ "600": {},
2771
+ "700": {},
2772
+ "800": {},
2773
+ "900": {},
2774
+ normal: {},
2775
+ bold: {}
2776
+ }
2777
+ },
2778
+ "style.fontStyle": {
2779
+ type: "enum",
2780
+ default: "normal",
2781
+ description: "Font style",
2782
+ variants: {
2783
+ normal: {},
2784
+ italic: {},
2785
+ oblique: {}
2786
+ }
2787
+ },
2788
+ "style.textAlign": {
2789
+ type: "enum",
2790
+ default: "left",
2791
+ description: "Text align",
2792
+ variants: {
2793
+ left: {},
2794
+ center: {},
2795
+ right: {},
2796
+ justify: {},
2797
+ start: {},
2798
+ end: {}
2799
+ }
2800
+ },
2801
+ "style.letterSpacing": {
2802
+ type: "number",
2803
+ default: undefined,
2804
+ step: 0.1,
2805
+ description: "Letter spacing",
2806
+ hiddenFromList: false
2807
+ }
2808
+ };
2738
2809
  var premountSchema = {
2739
2810
  premountFor: {
2740
2811
  type: "number",
@@ -2793,6 +2864,13 @@ var fromField = {
2793
2864
  step: 1,
2794
2865
  hiddenFromList: true
2795
2866
  };
2867
+ var trimBeforeField = {
2868
+ type: "number",
2869
+ default: 0,
2870
+ min: 0,
2871
+ step: 1,
2872
+ hiddenFromList: true
2873
+ };
2796
2874
  var freezeField = {
2797
2875
  type: "number",
2798
2876
  default: null,
@@ -2802,6 +2880,7 @@ var freezeField = {
2802
2880
  var baseSchema = {
2803
2881
  durationInFrames: durationInFramesField,
2804
2882
  from: fromField,
2883
+ trimBefore: trimBeforeField,
2805
2884
  freeze: freezeField,
2806
2885
  hidden: hiddenField,
2807
2886
  name: sequenceNameField,
@@ -2821,6 +2900,7 @@ var sequenceSchema = {
2821
2900
  };
2822
2901
  var baseSchemaWithoutFrom = {
2823
2902
  durationInFrames: durationInFramesField,
2903
+ trimBefore: trimBeforeField,
2824
2904
  freeze: freezeField,
2825
2905
  hidden: hiddenField,
2826
2906
  name: sequenceNameField,
@@ -3471,6 +3551,35 @@ function findRange(input, inputRange) {
3471
3551
  return i - 1;
3472
3552
  }
3473
3553
  var defaultEasing = (num) => num;
3554
+ var shouldExtendRightForEasing = (easing) => {
3555
+ return easing.remotionShouldExtendRight === true;
3556
+ };
3557
+ var resolveEasingForSegment = ({
3558
+ easing,
3559
+ segmentIndex
3560
+ }) => {
3561
+ if (easing === undefined) {
3562
+ return defaultEasing;
3563
+ }
3564
+ if (typeof easing === "function") {
3565
+ return easing;
3566
+ }
3567
+ return easing[segmentIndex];
3568
+ };
3569
+ var interpolateSegment = ({
3570
+ input,
3571
+ inputRange,
3572
+ outputRange,
3573
+ easing,
3574
+ extrapolateLeft,
3575
+ extrapolateRight
3576
+ }) => {
3577
+ return interpolateFunction(input, inputRange, outputRange, {
3578
+ easing,
3579
+ extrapolateLeft,
3580
+ extrapolateRight: input > inputRange[1] && extrapolateRight === "clamp" && shouldExtendRightForEasing(easing) ? "extend" : extrapolateRight
3581
+ });
3582
+ };
3474
3583
  var interpolateNumber = ({
3475
3584
  input,
3476
3585
  inputRange,
@@ -3481,15 +3590,6 @@ var interpolateNumber = ({
3481
3590
  return outputRange[0];
3482
3591
  }
3483
3592
  const easingOption = options?.easing;
3484
- const resolveEasingForSegment = (segmentIndex) => {
3485
- if (easingOption === undefined) {
3486
- return defaultEasing;
3487
- }
3488
- if (typeof easingOption === "function") {
3489
- return easingOption;
3490
- }
3491
- return easingOption[segmentIndex];
3492
- };
3493
3593
  let extrapolateLeft = "extend";
3494
3594
  if (options?.extrapolateLeft !== undefined) {
3495
3595
  extrapolateLeft = options.extrapolateLeft;
@@ -3500,11 +3600,41 @@ var interpolateNumber = ({
3500
3600
  }
3501
3601
  const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
3502
3602
  const range = findRange(posterizedInput, inputRange);
3503
- return interpolateFunction(posterizedInput, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
3504
- easing: resolveEasingForSegment(range),
3603
+ const easing = resolveEasingForSegment({
3604
+ easing: easingOption,
3605
+ segmentIndex: range
3606
+ });
3607
+ let result = interpolateSegment({
3608
+ input: posterizedInput,
3609
+ inputRange: [inputRange[range], inputRange[range + 1]],
3610
+ outputRange: [outputRange[range], outputRange[range + 1]],
3611
+ easing,
3505
3612
  extrapolateLeft,
3506
3613
  extrapolateRight
3507
3614
  });
3615
+ for (let segmentIndex = 0;segmentIndex < range; segmentIndex++) {
3616
+ const previousEasing = resolveEasingForSegment({
3617
+ easing: easingOption,
3618
+ segmentIndex
3619
+ });
3620
+ if (!shouldExtendRightForEasing(previousEasing)) {
3621
+ continue;
3622
+ }
3623
+ const previousSegmentEnd = inputRange[segmentIndex + 1];
3624
+ if (posterizedInput <= previousSegmentEnd) {
3625
+ continue;
3626
+ }
3627
+ const continuedSegmentValue = interpolateSegment({
3628
+ input: posterizedInput,
3629
+ inputRange: [inputRange[segmentIndex], previousSegmentEnd],
3630
+ outputRange: [outputRange[segmentIndex], outputRange[segmentIndex + 1]],
3631
+ easing: previousEasing,
3632
+ extrapolateLeft,
3633
+ extrapolateRight: "extend"
3634
+ });
3635
+ result += continuedSegmentValue - outputRange[segmentIndex + 1];
3636
+ }
3637
+ return result;
3508
3638
  };
3509
3639
  var interpolateString = ({
3510
3640
  input,
@@ -3978,21 +4108,40 @@ class Easing {
3978
4108
  static back(s = 1.70158) {
3979
4109
  return (t) => t * t * ((s + 1) * t - s);
3980
4110
  }
3981
- static spring(config = {}) {
3982
- return (t) => {
4111
+ static spring({
4112
+ allowTail = false,
4113
+ durationRestThreshold,
4114
+ ...config
4115
+ } = {}) {
4116
+ const easing = (t) => {
3983
4117
  if (t <= 0) {
3984
4118
  return 0;
3985
4119
  }
3986
- if (t >= 1) {
4120
+ if (!allowTail && t >= 1) {
3987
4121
  return 1;
3988
4122
  }
4123
+ if (allowTail) {
4124
+ return spring({
4125
+ fps: springEasingDurationInFrames,
4126
+ frame: t * measureSpring({
4127
+ fps: springEasingDurationInFrames,
4128
+ config,
4129
+ threshold: durationRestThreshold
4130
+ }),
4131
+ config
4132
+ });
4133
+ }
3989
4134
  return spring({
3990
4135
  fps: springEasingDurationInFrames,
3991
4136
  frame: t * springEasingDurationInFrames,
3992
4137
  config,
3993
- durationInFrames: springEasingDurationInFrames
4138
+ durationInFrames: springEasingDurationInFrames,
4139
+ durationRestThreshold
3994
4140
  });
3995
4141
  };
4142
+ return Object.assign(easing, {
4143
+ remotionShouldExtendRight: allowTail
4144
+ });
3996
4145
  }
3997
4146
  static bounce(t) {
3998
4147
  const u = clampUnit(t);
@@ -4523,25 +4672,31 @@ var interpolateColors = (input, inputRange, outputRange, options) => {
4523
4672
  const processedOutputRange = outputRange.map((c2) => processColor(c2));
4524
4673
  return interpolateColorsRGB(input, inputRange, processedOutputRange, options);
4525
4674
  };
4526
- var easingToFn = (e) => {
4527
- switch (e.type) {
4675
+ var easingToFn = ({
4676
+ easing,
4677
+ forceSpringAllowTail
4678
+ }) => {
4679
+ switch (easing.type) {
4528
4680
  case "linear":
4529
4681
  return Easing.linear;
4530
4682
  case "spring":
4531
4683
  return Easing.spring({
4532
- damping: e.damping,
4533
- mass: e.mass,
4534
- overshootClamping: e.overshootClamping,
4535
- stiffness: e.stiffness
4684
+ allowTail: forceSpringAllowTail ?? easing.allowTail ?? undefined,
4685
+ damping: easing.damping,
4686
+ durationRestThreshold: easing.durationRestThreshold ?? undefined,
4687
+ mass: easing.mass,
4688
+ overshootClamping: easing.overshootClamping,
4689
+ stiffness: easing.stiffness
4536
4690
  });
4537
4691
  case "bezier":
4538
- return bezier(e.x1, e.y1, e.x2, e.y2);
4692
+ return bezier(easing.x1, easing.y1, easing.x2, easing.y2);
4539
4693
  default:
4540
- throw new TypeError(`Unsupported easing: ${JSON.stringify(e)}`);
4694
+ throw new TypeError(`Unsupported easing: ${JSON.stringify(easing)}`);
4541
4695
  }
4542
4696
  };
4543
4697
  var interpolateKeyframedStatus = ({
4544
4698
  frame,
4699
+ forceSpringAllowTail,
4545
4700
  status
4546
4701
  }) => {
4547
4702
  const { keyframes, easing, clamping, interpolationFunction } = status;
@@ -4560,7 +4715,7 @@ var interpolateKeyframedStatus = ({
4560
4715
  }
4561
4716
  try {
4562
4717
  return interpolateColors(frame, inputRange, outputs, {
4563
- easing: easing.map(easingToFn),
4718
+ easing: easing.map((e) => easingToFn({ easing: e, forceSpringAllowTail })),
4564
4719
  posterize: status.posterize
4565
4720
  });
4566
4721
  } catch {
@@ -4572,7 +4727,7 @@ var interpolateKeyframedStatus = ({
4572
4727
  }
4573
4728
  try {
4574
4729
  return interpolate(frame, inputRange, outputs, {
4575
- easing: easing.map(easingToFn),
4730
+ easing: easing.map((e) => easingToFn({ easing: e, forceSpringAllowTail })),
4576
4731
  extrapolateLeft: clamping.left,
4577
4732
  extrapolateRight: clamping.right,
4578
4733
  posterize: status.posterize
@@ -4595,6 +4750,7 @@ var resolveDragOverrideValue = ({
4595
4750
  return { type: "none" };
4596
4751
  }
4597
4752
  const interpolated = interpolateKeyframedStatus({
4753
+ forceSpringAllowTail: null,
4598
4754
  frame,
4599
4755
  status: dragOverrideValue.status
4600
4756
  });
@@ -4620,6 +4776,7 @@ var getEffectiveVisualModeValue = ({
4620
4776
  if (propStatus.status === "keyframed") {
4621
4777
  if (frame !== null) {
4622
4778
  return interpolateKeyframedStatus({
4779
+ forceSpringAllowTail: null,
4623
4780
  frame,
4624
4781
  status: propStatus
4625
4782
  });
@@ -4688,6 +4845,7 @@ var resolvePropStatusOverrides = (propStatus, frame) => {
4688
4845
  }
4689
4846
  if (status.status === "keyframed") {
4690
4847
  const value = interpolateKeyframedStatus({
4848
+ forceSpringAllowTail: null,
4691
4849
  frame,
4692
4850
  status
4693
4851
  });
@@ -4863,6 +5021,17 @@ var findPropsToDelete = ({
4863
5021
  var DEFAULT_LINEAR_EASING = {
4864
5022
  type: "linear"
4865
5023
  };
5024
+ var getEasingIndexToDuplicate = ({
5025
+ insertedKeyframeIndex,
5026
+ easingLength,
5027
+ keyframeCount
5028
+ }) => {
5029
+ const isSplittingExistingSegment = insertedKeyframeIndex > 0 && insertedKeyframeIndex < keyframeCount - 1;
5030
+ if (!isSplittingExistingSegment || easingLength === 0) {
5031
+ return null;
5032
+ }
5033
+ return Math.min(insertedKeyframeIndex - 1, easingLength - 1);
5034
+ };
4866
5035
  var makeStaticDragOverride = (value) => {
4867
5036
  return { type: "static", value };
4868
5037
  };
@@ -4874,6 +5043,16 @@ var makeKeyframedDragOverride = ({
4874
5043
  const existingIndex = status.keyframes.findIndex((keyframe) => keyframe.frame === frame);
4875
5044
  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);
4876
5045
  const easing = [...status.easing];
5046
+ if (existingIndex === -1) {
5047
+ const insertedKeyframeIndex = keyframes.findIndex((keyframe) => keyframe.frame === frame);
5048
+ const easingIndexToDuplicate = getEasingIndexToDuplicate({
5049
+ insertedKeyframeIndex,
5050
+ easingLength: easing.length,
5051
+ keyframeCount: keyframes.length
5052
+ });
5053
+ const easingToDuplicate = easingIndexToDuplicate === null ? DEFAULT_LINEAR_EASING : easing[easingIndexToDuplicate];
5054
+ easing.splice(insertedKeyframeIndex, 0, easingToDuplicate);
5055
+ }
4877
5056
  while (easing.length < keyframes.length - 1) {
4878
5057
  easing.push(DEFAULT_LINEAR_EASING);
4879
5058
  }
@@ -4945,6 +5124,7 @@ var computeEffectiveSchemaValuesDotNotation = ({
4945
5124
  value = dragOverride.value;
4946
5125
  } else if (frame !== null) {
4947
5126
  const interpolated = interpolateKeyframedStatus({
5127
+ forceSpringAllowTail: null,
4948
5128
  frame,
4949
5129
  status
4950
5130
  });
@@ -5122,6 +5302,7 @@ var withInteractivitySchema = ({
5122
5302
  var EMPTY_EFFECTS = [];
5123
5303
  var RegularSequenceRefForwardingFunction = ({
5124
5304
  from = 0,
5305
+ trimBefore = 0,
5125
5306
  freeze,
5126
5307
  durationInFrames = Infinity,
5127
5308
  children,
@@ -5146,7 +5327,6 @@ var RegularSequenceRefForwardingFunction = ({
5146
5327
  const parentSequence = useContext17(SequenceContext);
5147
5328
  const { rootId } = useTimelineContext();
5148
5329
  const cumulatedFrom = parentSequence ? parentSequence.cumulatedFrom + parentSequence.relativeFrom : 0;
5149
- const absoluteFrom = (parentSequence?.absoluteFrom ?? 0) + from;
5150
5330
  const nonce = useNonce();
5151
5331
  if (layout !== "absolute-fill" && layout !== "none") {
5152
5332
  throw new TypeError(`The layout prop of <Sequence /> expects either "absolute-fill" or "none", but you passed: ${layout}`);
@@ -5166,6 +5346,18 @@ var RegularSequenceRefForwardingFunction = ({
5166
5346
  if (!Number.isFinite(from)) {
5167
5347
  throw new TypeError(`The "from" prop of a sequence must be finite, but got ${from}.`);
5168
5348
  }
5349
+ if (typeof trimBefore !== "number") {
5350
+ throw new TypeError(`You passed to the "trimBefore" prop of your <Sequence> an argument of type ${typeof trimBefore}, but it must be a number.`);
5351
+ }
5352
+ if (trimBefore < 0) {
5353
+ throw new TypeError(`The "trimBefore" prop of <Sequence /> must be greater than or equal to 0, but got ${trimBefore}.`);
5354
+ }
5355
+ if (Number.isNaN(trimBefore)) {
5356
+ throw new TypeError('The "trimBefore" prop of <Sequence /> must be a real number, but it is NaN.');
5357
+ }
5358
+ if (!Number.isFinite(trimBefore)) {
5359
+ throw new TypeError(`The "trimBefore" prop of <Sequence /> must be finite, but it is ${trimBefore}.`);
5360
+ }
5169
5361
  if (typeof freeze !== "undefined" && freeze !== null) {
5170
5362
  if (typeof freeze !== "number") {
5171
5363
  throw new TypeError(`The "freeze" prop of <Sequence /> must be a number, but is of type ${typeof freeze}.`);
@@ -5179,7 +5371,9 @@ var RegularSequenceRefForwardingFunction = ({
5179
5371
  }
5180
5372
  const absoluteFrame = useTimelinePosition();
5181
5373
  const videoConfig = useVideoConfig();
5182
- const parentSequenceDuration = parentSequence ? Math.min(parentSequence.durationInFrames - from, durationInFrames) : durationInFrames;
5374
+ const effectiveRelativeFrom = from - trimBefore;
5375
+ const absoluteFrom = (parentSequence?.absoluteFrom ?? 0) + effectiveRelativeFrom;
5376
+ const parentSequenceDuration = parentSequence ? Math.min(parentSequence.durationInFrames - effectiveRelativeFrom, durationInFrames) : durationInFrames;
5183
5377
  const actualDurationInFrames = Math.max(0, Math.min(videoConfig.durationInFrames - from, parentSequenceDuration));
5184
5378
  const { registerSequence, unregisterSequence } = useContext17(SequenceManager);
5185
5379
  const wrapperRefForOutline = useRef6(null);
@@ -5190,7 +5384,7 @@ var RegularSequenceRefForwardingFunction = ({
5190
5384
  const postmounting = useMemo14(() => {
5191
5385
  return parentSequence?.postmounting || Boolean(other._remotionInternalIsPostmounting);
5192
5386
  }, [other._remotionInternalIsPostmounting, parentSequence?.postmounting]);
5193
- const currentSequenceStart = cumulatedFrom + from;
5387
+ const currentSequenceStart = cumulatedFrom + effectiveRelativeFrom;
5194
5388
  const parentSequenceStart = parentSequence ? parentSequence.cumulatedFrom + parentSequence.relativeFrom : 0;
5195
5389
  const parentFirstFrame = parentSequence ? parentSequenceStart - parentSequence.cumulatedNegativeFrom : 0;
5196
5390
  const firstFrame = Math.max(0, parentFirstFrame, currentSequenceStart);
@@ -5199,7 +5393,7 @@ var RegularSequenceRefForwardingFunction = ({
5199
5393
  return {
5200
5394
  absoluteFrom,
5201
5395
  cumulatedFrom,
5202
- relativeFrom: from,
5396
+ relativeFrom: effectiveRelativeFrom,
5203
5397
  cumulatedNegativeFrom,
5204
5398
  durationInFrames: actualDurationInFrames,
5205
5399
  parentFrom: parentSequence?.relativeFrom ?? 0,
@@ -5214,7 +5408,7 @@ var RegularSequenceRefForwardingFunction = ({
5214
5408
  }, [
5215
5409
  cumulatedFrom,
5216
5410
  absoluteFrom,
5217
- from,
5411
+ effectiveRelativeFrom,
5218
5412
  actualDurationInFrames,
5219
5413
  parentSequence,
5220
5414
  id,
@@ -5236,6 +5430,7 @@ var RegularSequenceRefForwardingFunction = ({
5236
5430
  const stackRef = useRef6(null);
5237
5431
  stackRef.current = stack ?? inheritedStack;
5238
5432
  const registeredFrozenFrame = typeof freeze === "number" ? freeze : null;
5433
+ const registeredTrimBefore = trimBefore === 0 ? null : trimBefore;
5239
5434
  const parentCumulatedNegativeFrom = parentSequence?.cumulatedNegativeFrom ?? 0;
5240
5435
  const startMediaFrom = isMedia && isMedia.type !== "image" ? isMedia.data.startMediaFrom + parentCumulatedNegativeFrom - cumulatedNegativeFrom : null;
5241
5436
  const mediaFrameAtSequenceZero = isMedia && isMedia.type !== "image" ? isMedia.data.startMediaFrom + parentCumulatedNegativeFrom : null;
@@ -5254,6 +5449,7 @@ var RegularSequenceRefForwardingFunction = ({
5254
5449
  documentationLink: resolvedDocumentationLink,
5255
5450
  duration: actualDurationInFrames,
5256
5451
  from,
5452
+ trimBefore: registeredTrimBefore,
5257
5453
  id,
5258
5454
  loopDisplay,
5259
5455
  nonce: nonce.get(),
@@ -5278,6 +5474,7 @@ var RegularSequenceRefForwardingFunction = ({
5278
5474
  doesVolumeChange: isMedia.data.doesVolumeChange,
5279
5475
  duration: actualDurationInFrames,
5280
5476
  from,
5477
+ trimBefore: registeredTrimBefore,
5281
5478
  id,
5282
5479
  loopDisplay,
5283
5480
  nonce: nonce.get(),
@@ -5303,6 +5500,7 @@ var RegularSequenceRefForwardingFunction = ({
5303
5500
  }
5304
5501
  registerSequence({
5305
5502
  from,
5503
+ trimBefore: registeredTrimBefore,
5306
5504
  duration: actualDurationInFrames,
5307
5505
  id,
5308
5506
  displayName: timelineClipName,
@@ -5336,6 +5534,8 @@ var RegularSequenceRefForwardingFunction = ({
5336
5534
  actualDurationInFrames,
5337
5535
  rootId,
5338
5536
  from,
5537
+ trimBefore,
5538
+ registeredTrimBefore,
5339
5539
  showInTimeline,
5340
5540
  nonce,
5341
5541
  loopDisplay,
@@ -6603,13 +6803,15 @@ var prefetch = (src, options) => {
6603
6803
  resolve = res;
6604
6804
  reject = rej;
6605
6805
  });
6806
+ waitUntilDone.catch(() => {
6807
+ return;
6808
+ });
6606
6809
  const controller = new AbortController;
6607
- let canBeAborted = true;
6810
+ let reader = null;
6608
6811
  fetch(srcWithoutHash, {
6609
6812
  signal: controller.signal,
6610
6813
  credentials: options?.credentials ?? undefined
6611
6814
  }).then((res) => {
6612
- canBeAborted = false;
6613
6815
  if (canceled) {
6614
6816
  return null;
6615
6817
  }
@@ -6625,15 +6827,16 @@ var prefetch = (src, options) => {
6625
6827
  if (!res.body) {
6626
6828
  throw new Error(`HTTP response of ${srcWithoutHash} has no body`);
6627
6829
  }
6628
- const reader = res.body.getReader();
6830
+ const responseReader = res.body.getReader();
6831
+ reader = responseReader;
6629
6832
  return getBlobFromReader({
6630
- reader,
6833
+ reader: responseReader,
6631
6834
  contentType: options?.contentType ?? headerContentType ?? null,
6632
6835
  contentLength: res.headers.get("Content-Length") ? parseInt(res.headers.get("Content-Length"), 10) : null,
6633
6836
  onProgress: options?.onProgress
6634
6837
  });
6635
6838
  }).then((buf) => {
6636
- if (!buf) {
6839
+ if (!buf || canceled) {
6637
6840
  return;
6638
6841
  }
6639
6842
  const actualBlob = options?.contentType ? new Blob([buf], { type: options.contentType }) : buf;
@@ -6681,12 +6884,18 @@ var prefetch = (src, options) => {
6681
6884
  return copy;
6682
6885
  });
6683
6886
  } else {
6684
- canceled = true;
6685
- if (canBeAborted) {
6686
- try {
6687
- controller.abort(new Error("free() called"));
6688
- } catch {}
6887
+ if (canceled) {
6888
+ return;
6689
6889
  }
6890
+ canceled = true;
6891
+ const cancellationError = new Error("free() called");
6892
+ reject(cancellationError);
6893
+ try {
6894
+ controller.abort(cancellationError);
6895
+ } catch {}
6896
+ reader?.cancel(cancellationError).catch(() => {
6897
+ return;
6898
+ });
6690
6899
  }
6691
6900
  },
6692
6901
  waitUntilDone: () => {
@@ -7858,6 +8067,7 @@ var useMediaInTimeline = ({
7858
8067
  id,
7859
8068
  duration,
7860
8069
  from: 0,
8070
+ trimBefore: null,
7861
8071
  parent: parentSequence?.id ?? null,
7862
8072
  displayName: finalDisplayName,
7863
8073
  documentationLink,
@@ -8720,11 +8930,11 @@ var useMediaTag = ({
8720
8930
  ]);
8721
8931
  };
8722
8932
  var MediaVolumeContext = createContext22({
8723
- mediaMuted: false,
8933
+ playerMuted: false,
8724
8934
  mediaVolume: 1
8725
8935
  });
8726
8936
  var SetMediaVolumeContext = createContext22({
8727
- setMediaMuted: () => {
8937
+ setPlayerMuted: () => {
8728
8938
  throw new Error("default");
8729
8939
  },
8730
8940
  setMediaVolume: () => {
@@ -8738,12 +8948,12 @@ var useMediaVolumeState = () => {
8738
8948
  return [mediaVolume, setMediaVolume];
8739
8949
  }, [mediaVolume, setMediaVolume]);
8740
8950
  };
8741
- var useMediaMutedState = () => {
8742
- const { mediaMuted } = useContext27(MediaVolumeContext);
8743
- const { setMediaMuted } = useContext27(SetMediaVolumeContext);
8951
+ var usePlayerMutedState = () => {
8952
+ const { playerMuted } = useContext27(MediaVolumeContext);
8953
+ const { setPlayerMuted } = useContext27(SetMediaVolumeContext);
8744
8954
  return useMemo26(() => {
8745
- return [mediaMuted, setMediaMuted];
8746
- }, [mediaMuted, setMediaMuted]);
8955
+ return [playerMuted, setPlayerMuted];
8956
+ }, [playerMuted, setPlayerMuted]);
8747
8957
  };
8748
8958
  var warnAboutTooHighVolume = (volume) => {
8749
8959
  if (volume >= 100) {
@@ -8789,7 +8999,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
8789
8999
  throw new Error("typecheck error");
8790
9000
  }
8791
9001
  const [mediaVolume] = useMediaVolumeState();
8792
- const [mediaMuted] = useMediaMutedState();
9002
+ const [playerMuted] = usePlayerMutedState();
8793
9003
  const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
8794
9004
  if (!src) {
8795
9005
  throw new TypeError("No 'src' was passed to <Html5Audio>.");
@@ -8810,7 +9020,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
8810
9020
  });
8811
9021
  const propsToPass = useMemo27(() => {
8812
9022
  return {
8813
- muted: muted || mediaMuted || userPreferredVolume <= 0,
9023
+ muted: muted || playerMuted || userPreferredVolume <= 0,
8814
9024
  src: preloadedSrc,
8815
9025
  loop: _remotionInternalNativeLoopPassed,
8816
9026
  crossOrigin: crossOriginValue,
@@ -8818,7 +9028,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
8818
9028
  };
8819
9029
  }, [
8820
9030
  _remotionInternalNativeLoopPassed,
8821
- mediaMuted,
9031
+ playerMuted,
8822
9032
  muted,
8823
9033
  nativeProps,
8824
9034
  preloadedSrc,
@@ -9066,6 +9276,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
9066
9276
  var AudioForRendering = forwardRef6(AudioForRenderingRefForwardingFunction);
9067
9277
  var AudioRefForwardingFunction = (props, ref) => {
9068
9278
  const audioTagsContext = useContext30(SharedAudioTagsContext);
9279
+ const propsWithFreeze = props;
9069
9280
  const {
9070
9281
  startFrom,
9071
9282
  endAt,
@@ -9076,14 +9287,18 @@ var AudioRefForwardingFunction = (props, ref) => {
9076
9287
  pauseWhenBuffering,
9077
9288
  showInTimeline,
9078
9289
  onError: onRemotionError,
9290
+ freeze,
9079
9291
  ...otherProps
9080
- } = props;
9081
- const { loop, ...propsOtherThanLoop } = props;
9292
+ } = propsWithFreeze;
9293
+ const { loop, freeze: _freeze, ...propsOtherThanLoop } = propsWithFreeze;
9082
9294
  const { fps } = useVideoConfig();
9083
9295
  const environment = useRemotionEnvironment();
9084
9296
  if (environment.isClientSideRendering) {
9085
9297
  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");
9086
9298
  }
9299
+ if (typeof freeze !== "undefined") {
9300
+ throw new TypeError('The "freeze" prop is not supported on <Html5Audio />. Use <Sequence freeze={...}> to freeze media playback.');
9301
+ }
9087
9302
  const { durations, setDurations } = useContext30(DurationsContext);
9088
9303
  if (typeof props.src !== "string") {
9089
9304
  throw new TypeError(`The \`<Html5Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
@@ -9215,6 +9430,15 @@ var solidSchema = {
9215
9430
  description: "Height",
9216
9431
  hiddenFromList: false
9217
9432
  },
9433
+ pixelDensity: {
9434
+ type: "number",
9435
+ min: 1,
9436
+ max: 3,
9437
+ step: 0.1,
9438
+ default: 1,
9439
+ description: "Pixel density",
9440
+ hiddenFromList: false
9441
+ },
9218
9442
  ...transformSchema
9219
9443
  };
9220
9444
  var SolidInner = ({
@@ -9331,6 +9555,7 @@ var SolidOuter = forwardRef8(({
9331
9555
  style,
9332
9556
  name,
9333
9557
  from,
9558
+ trimBefore,
9334
9559
  freeze,
9335
9560
  hidden,
9336
9561
  showInTimeline,
@@ -9345,6 +9570,7 @@ var SolidOuter = forwardRef8(({
9345
9570
  return /* @__PURE__ */ jsx24(Sequence, {
9346
9571
  layout: "none",
9347
9572
  from,
9573
+ trimBefore,
9348
9574
  freeze,
9349
9575
  hidden,
9350
9576
  showInTimeline,
@@ -9411,6 +9637,10 @@ function resolveHtmlInCanvasPixelDensity(pixelDensity) {
9411
9637
  }
9412
9638
  return pixelDensity;
9413
9639
  }
9640
+ var isMissingPaintRecordError = (error2) => {
9641
+ return error2 instanceof DOMException && error2.name === "InvalidStateError";
9642
+ };
9643
+ var missingPaintRecordMessage = "HtmlInCanvas: Expected the element to be inside the viewport during rendering, but Chrome had no cached paint record for it.";
9414
9644
  var resizeOffscreenCanvas = ({
9415
9645
  offscreen,
9416
9646
  width,
@@ -9454,6 +9684,7 @@ var HtmlInCanvasContent = forwardRef9(({
9454
9684
  const canvasWidth = Math.ceil(width * resolvedPixelDensity);
9455
9685
  const canvasHeight = Math.ceil(height * resolvedPixelDensity);
9456
9686
  const { continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
9687
+ const { isRendering } = useRemotionEnvironment();
9457
9688
  if (!isHtmlInCanvasSupported()) {
9458
9689
  cancelRender2(new Error(HTML_IN_CANVAS_UNSUPPORTED_MESSAGE));
9459
9690
  }
@@ -9502,34 +9733,53 @@ var HtmlInCanvasContent = forwardRef9(({
9502
9733
  if (!placeholderCanvas) {
9503
9734
  throw new Error("Canvas not found");
9504
9735
  }
9505
- const offscreen2d = offscreen.getContext("2d");
9506
- if (!offscreen2d) {
9507
- throw new Error("Failed to acquire 2D context for <HtmlInCanvas> offscreen canvas");
9508
- }
9509
9736
  const handle = delayRender("onPaint");
9510
9737
  if (!initializedRef.current) {
9511
- initializedRef.current = true;
9512
- const initImage = placeholderCanvas.captureElementImage(element);
9513
- const currentOnInit = onInitRef.current;
9514
- if (currentOnInit) {
9515
- const cleanup = await currentOnInit({
9516
- canvas: offscreen,
9517
- element,
9518
- elementImage: initImage,
9519
- pixelDensity: resolvedPixelDensity
9520
- });
9521
- if (typeof cleanup !== "function") {
9522
- throw new Error("HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.");
9523
- }
9524
- if (unmountedRef.current) {
9525
- cleanup();
9738
+ let initImage = null;
9739
+ try {
9740
+ initImage = placeholderCanvas.captureElementImage(element);
9741
+ } catch (error2) {
9742
+ if (isMissingPaintRecordError(error2) && !isRendering) {} else if (isMissingPaintRecordError(error2)) {
9743
+ throw new Error(missingPaintRecordMessage);
9526
9744
  } else {
9527
- onInitCleanupRef.current = cleanup;
9745
+ throw error2;
9746
+ }
9747
+ }
9748
+ if (initImage) {
9749
+ initializedRef.current = true;
9750
+ const currentOnInit = onInitRef.current;
9751
+ if (currentOnInit) {
9752
+ const cleanup = await currentOnInit({
9753
+ canvas: offscreen,
9754
+ element,
9755
+ elementImage: initImage,
9756
+ pixelDensity: resolvedPixelDensity
9757
+ });
9758
+ if (typeof cleanup !== "function") {
9759
+ throw new Error("HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.");
9760
+ }
9761
+ if (unmountedRef.current) {
9762
+ cleanup();
9763
+ } else {
9764
+ onInitCleanupRef.current = cleanup;
9765
+ }
9528
9766
  }
9529
9767
  }
9530
9768
  }
9531
9769
  const handler = onPaintRef.current ?? defaultOnPaint;
9532
- const elImage = placeholderCanvas.captureElementImage(element);
9770
+ let elImage;
9771
+ try {
9772
+ elImage = placeholderCanvas.captureElementImage(element);
9773
+ } catch (error2) {
9774
+ if (isMissingPaintRecordError(error2) && !isRendering) {
9775
+ continueRender2(handle);
9776
+ return;
9777
+ }
9778
+ if (isMissingPaintRecordError(error2)) {
9779
+ throw new Error(missingPaintRecordMessage);
9780
+ }
9781
+ throw error2;
9782
+ }
9533
9783
  await handler({
9534
9784
  canvas: offscreen,
9535
9785
  element,
@@ -9554,7 +9804,8 @@ var HtmlInCanvasContent = forwardRef9(({
9554
9804
  chainState,
9555
9805
  continueRender2,
9556
9806
  cancelRender2,
9557
- resolvedPixelDensity
9807
+ resolvedPixelDensity,
9808
+ isRendering
9558
9809
  ]);
9559
9810
  useLayoutEffect9(() => {
9560
9811
  const placeholder = canvas2dRef.current;
@@ -9690,6 +9941,15 @@ var HtmlInCanvasInner = forwardRef9(({
9690
9941
  HtmlInCanvasInner.displayName = "HtmlInCanvas";
9691
9942
  var htmlInCanvasSchema = {
9692
9943
  ...baseSchema,
9944
+ pixelDensity: {
9945
+ type: "number",
9946
+ min: 1,
9947
+ max: 3,
9948
+ step: 0.1,
9949
+ default: 1,
9950
+ description: "Pixel density",
9951
+ hiddenFromList: false
9952
+ },
9693
9953
  ...transformSchema
9694
9954
  };
9695
9955
  var HtmlInCanvasWrapped = withInteractivitySchema({
@@ -10007,6 +10267,7 @@ var CanvasImageInner = forwardRef10(({
10007
10267
  delayRenderTimeoutInMilliseconds,
10008
10268
  durationInFrames,
10009
10269
  from,
10270
+ trimBefore,
10010
10271
  freeze,
10011
10272
  hidden,
10012
10273
  name,
@@ -10028,6 +10289,7 @@ var CanvasImageInner = forwardRef10(({
10028
10289
  return /* @__PURE__ */ jsx26(Sequence, {
10029
10290
  layout: "none",
10030
10291
  from: from ?? 0,
10292
+ trimBefore,
10031
10293
  durationInFrames: durationInFrames ?? Infinity,
10032
10294
  freeze,
10033
10295
  hidden,
@@ -10264,6 +10526,7 @@ var NativeImgInner = ({
10264
10526
  showInTimeline,
10265
10527
  src,
10266
10528
  from,
10529
+ trimBefore,
10267
10530
  durationInFrames,
10268
10531
  freeze,
10269
10532
  controls,
@@ -10276,6 +10539,7 @@ var NativeImgInner = ({
10276
10539
  return /* @__PURE__ */ jsx28(Sequence, {
10277
10540
  layout: "none",
10278
10541
  from: from ?? 0,
10542
+ trimBefore,
10279
10543
  durationInFrames: durationInFrames ?? Infinity,
10280
10544
  freeze,
10281
10545
  _remotionInternalStack: stack,
@@ -10349,6 +10613,7 @@ var ImgInner = ({
10349
10613
  showInTimeline,
10350
10614
  src,
10351
10615
  from,
10616
+ trimBefore,
10352
10617
  durationInFrames,
10353
10618
  freeze,
10354
10619
  controls,
@@ -10374,6 +10639,7 @@ var ImgInner = ({
10374
10639
  showInTimeline,
10375
10640
  src,
10376
10641
  from,
10642
+ trimBefore,
10377
10643
  durationInFrames,
10378
10644
  freeze,
10379
10645
  controls,
@@ -10416,6 +10682,7 @@ var ImgInner = ({
10416
10682
  delayRenderRetries,
10417
10683
  delayRenderTimeoutInMilliseconds,
10418
10684
  from,
10685
+ trimBefore,
10419
10686
  durationInFrames,
10420
10687
  freeze,
10421
10688
  hidden,
@@ -10438,7 +10705,8 @@ var Img = withInteractivitySchema({
10438
10705
  addSequenceStackTraces(Img);
10439
10706
  var interactiveElementSchema = {
10440
10707
  ...baseSchema,
10441
- ...transformSchema
10708
+ ...transformSchema,
10709
+ ...textSchema
10442
10710
  };
10443
10711
  var setRef = (ref, value) => {
10444
10712
  if (typeof ref === "function") {
@@ -10452,6 +10720,7 @@ var makeInteractiveElement = (tag, displayName) => {
10452
10720
  const {
10453
10721
  durationInFrames,
10454
10722
  from,
10723
+ trimBefore,
10455
10724
  freeze,
10456
10725
  hidden,
10457
10726
  name,
@@ -10468,6 +10737,7 @@ var makeInteractiveElement = (tag, displayName) => {
10468
10737
  return /* @__PURE__ */ jsx29(Sequence, {
10469
10738
  layout: "none",
10470
10739
  from: from ?? 0,
10740
+ trimBefore,
10471
10741
  durationInFrames: durationInFrames ?? Infinity,
10472
10742
  freeze,
10473
10743
  hidden,
@@ -10498,6 +10768,7 @@ var makeInteractiveElement = (tag, displayName) => {
10498
10768
  var Interactive = {
10499
10769
  baseSchema,
10500
10770
  transformSchema,
10771
+ textSchema,
10501
10772
  premountSchema,
10502
10773
  sequenceSchema,
10503
10774
  withSchema: withInteractivitySchema,
@@ -11327,7 +11598,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
11327
11598
  throw new Error("acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.");
11328
11599
  }
11329
11600
  const [mediaVolume] = useMediaVolumeState();
11330
- const [mediaMuted] = useMediaMutedState();
11601
+ const [playerMuted] = usePlayerMutedState();
11331
11602
  const userPreferredVolume = evaluateVolume({
11332
11603
  frame: volumePropFrame,
11333
11604
  volume,
@@ -11483,7 +11754,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
11483
11754
  return /* @__PURE__ */ jsx34("video", {
11484
11755
  ...nativeProps,
11485
11756
  ref: videoRef,
11486
- muted: muted || mediaMuted || userPreferredVolume <= 0,
11757
+ muted: muted || playerMuted || userPreferredVolume <= 0,
11487
11758
  playsInline: true,
11488
11759
  src: actualSrc,
11489
11760
  loop: _remotionInternalNativeLoopPassed,
@@ -11774,6 +12045,7 @@ var Internals = {
11774
12045
  sequenceStyleSchema,
11775
12046
  sequenceVisualStyleSchema,
11776
12047
  sequencePremountSchema,
12048
+ textSchema,
11777
12049
  transformSchema,
11778
12050
  premountSchema,
11779
12051
  flattenActiveSchema,
@@ -11783,7 +12055,7 @@ var Internals = {
11783
12055
  useVideo,
11784
12056
  getRoot,
11785
12057
  useMediaVolumeState,
11786
- useMediaMutedState,
12058
+ usePlayerMutedState,
11787
12059
  useMediaInTimeline,
11788
12060
  useLazyComponent,
11789
12061
  truthy,
@@ -17272,6 +17544,7 @@ var RenderSvg = ({
17272
17544
  pixelDensity,
17273
17545
  durationInFrames,
17274
17546
  from,
17547
+ trimBefore,
17275
17548
  freeze,
17276
17549
  hidden,
17277
17550
  name,
@@ -17381,6 +17654,7 @@ var RenderSvg = ({
17381
17654
  return /* @__PURE__ */ jsx44(Sequence, {
17382
17655
  layout: "none",
17383
17656
  from,
17657
+ trimBefore,
17384
17658
  freeze,
17385
17659
  hidden,
17386
17660
  showInTimeline,
@@ -29248,7 +29522,7 @@ var GitHubStars = () => {
29248
29522
  width: "45px"
29249
29523
  }),
29250
29524
  /* @__PURE__ */ jsx57(StatItemContent, {
29251
- content: "50K",
29525
+ content: "51K",
29252
29526
  width: "80px",
29253
29527
  fontSize: "2.5rem",
29254
29528
  fontWeight: "bold"
@@ -29778,6 +30052,35 @@ function findRange2(input, inputRange) {
29778
30052
  return i - 1;
29779
30053
  }
29780
30054
  var defaultEasing2 = (num) => num;
30055
+ var shouldExtendRightForEasing2 = (easing) => {
30056
+ return easing.remotionShouldExtendRight === true;
30057
+ };
30058
+ var resolveEasingForSegment2 = ({
30059
+ easing,
30060
+ segmentIndex
30061
+ }) => {
30062
+ if (easing === undefined) {
30063
+ return defaultEasing2;
30064
+ }
30065
+ if (typeof easing === "function") {
30066
+ return easing;
30067
+ }
30068
+ return easing[segmentIndex];
30069
+ };
30070
+ var interpolateSegment2 = ({
30071
+ input,
30072
+ inputRange,
30073
+ outputRange,
30074
+ easing,
30075
+ extrapolateLeft,
30076
+ extrapolateRight
30077
+ }) => {
30078
+ return interpolateFunction2(input, inputRange, outputRange, {
30079
+ easing,
30080
+ extrapolateLeft,
30081
+ extrapolateRight: input > inputRange[1] && extrapolateRight === "clamp" && shouldExtendRightForEasing2(easing) ? "extend" : extrapolateRight
30082
+ });
30083
+ };
29781
30084
  var interpolateNumber2 = ({
29782
30085
  input,
29783
30086
  inputRange,
@@ -29788,15 +30091,6 @@ var interpolateNumber2 = ({
29788
30091
  return outputRange[0];
29789
30092
  }
29790
30093
  const easingOption = options2?.easing;
29791
- const resolveEasingForSegment = (segmentIndex) => {
29792
- if (easingOption === undefined) {
29793
- return defaultEasing2;
29794
- }
29795
- if (typeof easingOption === "function") {
29796
- return easingOption;
29797
- }
29798
- return easingOption[segmentIndex];
29799
- };
29800
30094
  let extrapolateLeft = "extend";
29801
30095
  if (options2?.extrapolateLeft !== undefined) {
29802
30096
  extrapolateLeft = options2.extrapolateLeft;
@@ -29807,11 +30101,41 @@ var interpolateNumber2 = ({
29807
30101
  }
29808
30102
  const posterizedInput = options2?.posterize === undefined ? input : Math.floor(input / options2.posterize) * options2.posterize;
29809
30103
  const range = findRange2(posterizedInput, inputRange);
29810
- return interpolateFunction2(posterizedInput, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
29811
- easing: resolveEasingForSegment(range),
30104
+ const easing = resolveEasingForSegment2({
30105
+ easing: easingOption,
30106
+ segmentIndex: range
30107
+ });
30108
+ let result = interpolateSegment2({
30109
+ input: posterizedInput,
30110
+ inputRange: [inputRange[range], inputRange[range + 1]],
30111
+ outputRange: [outputRange[range], outputRange[range + 1]],
30112
+ easing,
29812
30113
  extrapolateLeft,
29813
30114
  extrapolateRight
29814
30115
  });
30116
+ for (let segmentIndex = 0;segmentIndex < range; segmentIndex++) {
30117
+ const previousEasing = resolveEasingForSegment2({
30118
+ easing: easingOption,
30119
+ segmentIndex
30120
+ });
30121
+ if (!shouldExtendRightForEasing2(previousEasing)) {
30122
+ continue;
30123
+ }
30124
+ const previousSegmentEnd = inputRange[segmentIndex + 1];
30125
+ if (posterizedInput <= previousSegmentEnd) {
30126
+ continue;
30127
+ }
30128
+ const continuedSegmentValue = interpolateSegment2({
30129
+ input: posterizedInput,
30130
+ inputRange: [inputRange[segmentIndex], previousSegmentEnd],
30131
+ outputRange: [outputRange[segmentIndex], outputRange[segmentIndex + 1]],
30132
+ easing: previousEasing,
30133
+ extrapolateLeft,
30134
+ extrapolateRight: "extend"
30135
+ });
30136
+ result += continuedSegmentValue - outputRange[segmentIndex + 1];
30137
+ }
30138
+ return result;
29815
30139
  };
29816
30140
  var interpolateString2 = ({
29817
30141
  input,
@@ -30164,6 +30488,13 @@ var fromField2 = {
30164
30488
  step: 1,
30165
30489
  hiddenFromList: true
30166
30490
  };
30491
+ var trimBeforeField2 = {
30492
+ type: "number",
30493
+ default: 0,
30494
+ min: 0,
30495
+ step: 1,
30496
+ hiddenFromList: true
30497
+ };
30167
30498
  var freezeField2 = {
30168
30499
  type: "number",
30169
30500
  default: null,
@@ -30173,6 +30504,7 @@ var freezeField2 = {
30173
30504
  var baseSchema2 = {
30174
30505
  durationInFrames: durationInFramesField2,
30175
30506
  from: fromField2,
30507
+ trimBefore: trimBeforeField2,
30176
30508
  freeze: freezeField2,
30177
30509
  hidden: hiddenField2,
30178
30510
  name: sequenceNameField2,
@@ -30192,6 +30524,7 @@ var sequenceSchema2 = {
30192
30524
  };
30193
30525
  var baseSchemaWithoutFrom2 = {
30194
30526
  durationInFrames: durationInFramesField2,
30527
+ trimBefore: trimBeforeField2,
30195
30528
  freeze: freezeField2,
30196
30529
  hidden: hiddenField2,
30197
30530
  name: sequenceNameField2,
@@ -32380,7 +32713,7 @@ var renderDefaultVolumeSlider = (props) => {
32380
32713
  };
32381
32714
  var VOLUME_SLIDER_WIDTH = 100;
32382
32715
  var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, renderVolumeSlider }) => {
32383
- const [mediaMuted, setMediaMuted] = Internals.useMediaMutedState();
32716
+ const [playerMuted, setPlayerMuted] = Internals.usePlayerMutedState();
32384
32717
  const [mediaVolume, setMediaVolume] = Internals.useMediaVolumeState();
32385
32718
  const [focused, setFocused] = useState62(false);
32386
32719
  const parentDivRef = useRef52(null);
@@ -32397,11 +32730,11 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
32397
32730
  const onClick = useCallback42(() => {
32398
32731
  if (isVolume0) {
32399
32732
  setMediaVolume(1);
32400
- setMediaMuted(false);
32733
+ setPlayerMuted(false);
32401
32734
  return;
32402
32735
  }
32403
- setMediaMuted((mute) => !mute);
32404
- }, [isVolume0, setMediaMuted, setMediaVolume]);
32736
+ setPlayerMuted((mute) => !mute);
32737
+ }, [isVolume0, setPlayerMuted, setMediaVolume]);
32405
32738
  const parentDivStyle = useMemo410(() => {
32406
32739
  return {
32407
32740
  display: "inline-flex",
@@ -32439,10 +32772,10 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
32439
32772
  });
32440
32773
  }, [onBlur, onClick, volumeContainer]);
32441
32774
  const muteButton = useMemo410(() => {
32442
- return renderMuteButton ? renderMuteButton({ muted: mediaMuted, volume: mediaVolume }) : renderDefaultMuteButton({ muted: mediaMuted, volume: mediaVolume });
32443
- }, [mediaMuted, mediaVolume, renderDefaultMuteButton, renderMuteButton]);
32775
+ return renderMuteButton ? renderMuteButton({ muted: playerMuted, volume: mediaVolume }) : renderDefaultMuteButton({ muted: playerMuted, volume: mediaVolume });
32776
+ }, [playerMuted, mediaVolume, renderDefaultMuteButton, renderMuteButton]);
32444
32777
  const volumeSlider = useMemo410(() => {
32445
- return (focused || hover) && !mediaMuted && !Internals.isIosSafari() ? (renderVolumeSlider ?? renderDefaultVolumeSlider)({
32778
+ return (focused || hover) && !playerMuted && !Internals.isIosSafari() ? (renderVolumeSlider ?? renderDefaultVolumeSlider)({
32446
32779
  isVertical: displayVerticalVolumeSlider,
32447
32780
  volume: mediaVolume,
32448
32781
  onBlur: () => setFocused(false),
@@ -32453,7 +32786,7 @@ var MediaVolumeSlider = ({ displayVerticalVolumeSlider, renderMuteButton, render
32453
32786
  displayVerticalVolumeSlider,
32454
32787
  focused,
32455
32788
  hover,
32456
- mediaMuted,
32789
+ playerMuted,
32457
32790
  mediaVolume,
32458
32791
  renderVolumeSlider,
32459
32792
  setMediaVolume
@@ -33326,11 +33659,11 @@ var PlayerUI = ({
33326
33659
  }, []);
33327
33660
  const player = usePlayer();
33328
33661
  const playerToggle = player.toggle;
33329
- const { mediaMuted, mediaVolume } = useContext52(Internals.MediaVolumeContext);
33662
+ const { playerMuted, mediaVolume } = useContext52(Internals.MediaVolumeContext);
33330
33663
  useEffect122(() => {
33331
33664
  player.emitter.dispatchVolumeChange(mediaVolume);
33332
33665
  }, [player.emitter, mediaVolume]);
33333
- const isMuted = mediaMuted || mediaVolume === 0;
33666
+ const isMuted = playerMuted || mediaVolume === 0;
33334
33667
  useEffect122(() => {
33335
33668
  player.emitter.dispatchMuteChange({
33336
33669
  isMuted
@@ -33439,7 +33772,7 @@ var PlayerUI = ({
33439
33772
  }
33440
33773
  player.emitter.dispatchScaleChange(scale);
33441
33774
  }, [player.emitter, scale]);
33442
- const { setMediaVolume, setMediaMuted } = useContext52(Internals.SetMediaVolumeContext);
33775
+ const { setMediaVolume, setPlayerMuted } = useContext52(Internals.SetMediaVolumeContext);
33443
33776
  const [showBufferIndicator, setShowBufferState] = useState113(false);
33444
33777
  useEffect122(() => {
33445
33778
  let timeout = null;
@@ -33513,7 +33846,7 @@ var PlayerUI = ({
33513
33846
  requestFullscreen,
33514
33847
  exitFullscreen,
33515
33848
  getVolume: () => {
33516
- if (mediaMuted) {
33849
+ if (playerMuted) {
33517
33850
  return 0;
33518
33851
  }
33519
33852
  return mediaVolume;
@@ -33532,10 +33865,10 @@ var PlayerUI = ({
33532
33865
  },
33533
33866
  isMuted: () => isMuted,
33534
33867
  mute: () => {
33535
- setMediaMuted(true);
33868
+ setPlayerMuted(true);
33536
33869
  },
33537
33870
  unmute: () => {
33538
- setMediaMuted(false);
33871
+ setPlayerMuted(false);
33539
33872
  },
33540
33873
  getScale: () => scale,
33541
33874
  pauseAndReturnToPlayStart: () => {
@@ -33547,12 +33880,12 @@ var PlayerUI = ({
33547
33880
  durationInFrames,
33548
33881
  exitFullscreen,
33549
33882
  loop,
33550
- mediaMuted,
33883
+ playerMuted,
33551
33884
  isMuted,
33552
33885
  mediaVolume,
33553
33886
  player,
33554
33887
  requestFullscreen,
33555
- setMediaMuted,
33888
+ setPlayerMuted,
33556
33889
  setMediaVolume,
33557
33890
  toggle,
33558
33891
  scale
@@ -33831,14 +34164,15 @@ var SharedPlayerContexts = ({
33831
34164
  fps,
33832
34165
  inputProps
33833
34166
  ]);
33834
- const [mediaMuted, setMediaMuted] = useState122(() => initiallyMuted);
34167
+ const [playerMuted, setPlayerMuted] = useState122(() => initiallyMuted);
33835
34168
  const [mediaVolume, setMediaVolume] = useState122(() => persistVolumeToStorage ? getPreferredVolume(volumePersistenceKey ?? null) : initialVolume);
33836
34169
  const mediaVolumeContextValue = useMemo132(() => {
33837
34170
  return {
33838
- mediaMuted,
34171
+ playerMuted,
33839
34172
  mediaVolume
33840
34173
  };
33841
- }, [mediaMuted, mediaVolume]);
34174
+ }, [playerMuted, mediaVolume]);
34175
+ const shouldCreateAudioContext = audioEnabled && !playerMuted && mediaVolume > 0;
33842
34176
  const setMediaVolumeAndPersist = useCallback112((vol) => {
33843
34177
  setMediaVolume(vol);
33844
34178
  if (persistVolumeToStorage) {
@@ -33847,7 +34181,7 @@ var SharedPlayerContexts = ({
33847
34181
  }, [persistVolumeToStorage, logLevel, volumePersistenceKey]);
33848
34182
  const setMediaVolumeContextValue = useMemo132(() => {
33849
34183
  return {
33850
- setMediaMuted,
34184
+ setPlayerMuted,
33851
34185
  setMediaVolume: setMediaVolumeAndPersist
33852
34186
  };
33853
34187
  }, [setMediaVolumeAndPersist]);
@@ -33888,7 +34222,7 @@ var SharedPlayerContexts = ({
33888
34222
  children: /* @__PURE__ */ jsx133(Internals.BufferingProvider, {
33889
34223
  children: /* @__PURE__ */ jsx133(Internals.SharedAudioContextProvider, {
33890
34224
  audioLatencyHint,
33891
- audioEnabled,
34225
+ audioEnabled: shouldCreateAudioContext,
33892
34226
  previewSampleRate: sampleRate,
33893
34227
  children: /* @__PURE__ */ jsx133(Internals.SharedAudioTagsContextProvider, {
33894
34228
  numberOfAudioTags: numberOfSharedAudioTags,
@@ -35623,9 +35957,14 @@ class StaleWaiterError extends Error {
35623
35957
  var CONCURRENCY = 1;
35624
35958
  var waiters = [];
35625
35959
  var running = 0;
35960
+ var runningEntry = null;
35626
35961
  var processNext = () => {
35627
35962
  if (running >= CONCURRENCY) {
35628
- return;
35963
+ if (runningEntry?.waiter.getPriority() === null) {
35964
+ runningEntry.cancel();
35965
+ } else {
35966
+ return;
35967
+ }
35629
35968
  }
35630
35969
  const staleWaiters = [];
35631
35970
  for (let i = waiters.length - 1;i >= 0; i--) {
@@ -35660,11 +35999,37 @@ var processNext = () => {
35660
35999
  }
35661
36000
  const [next] = waiters.splice(bestIndex, 1);
35662
36001
  running++;
36002
+ let settled = false;
36003
+ let cancelled = false;
36004
+ const entry = {
36005
+ waiter: next,
36006
+ cancel: () => {
36007
+ cancelled = true;
36008
+ entry.settle();
36009
+ },
36010
+ settle: () => {
36011
+ if (settled) {
36012
+ return;
36013
+ }
36014
+ settled = true;
36015
+ running--;
36016
+ if (runningEntry === entry) {
36017
+ runningEntry = null;
36018
+ }
36019
+ }
36020
+ };
36021
+ runningEntry = entry;
35663
36022
  next.fn().then((value) => {
35664
- running--;
36023
+ entry.settle();
36024
+ if (cancelled) {
36025
+ return;
36026
+ }
35665
36027
  next.onDone(value, processNext);
35666
36028
  }, (err) => {
35667
- running--;
36029
+ entry.settle();
36030
+ if (cancelled) {
36031
+ return;
36032
+ }
35668
36033
  next.onError(err);
35669
36034
  });
35670
36035
  };
@@ -37376,7 +37741,7 @@ var {
37376
37741
  useUnsafeVideoConfig: useUnsafeVideoConfig2,
37377
37742
  Timeline,
37378
37743
  SharedAudioContext: SharedAudioContext2,
37379
- useMediaMutedState: useMediaMutedState2,
37744
+ usePlayerMutedState: usePlayerMutedState2,
37380
37745
  useMediaVolumeState: useMediaVolumeState2,
37381
37746
  useFrameForVolumeProp: useFrameForVolumeProp2,
37382
37747
  evaluateVolume: evaluateVolume2,
@@ -37418,7 +37783,7 @@ var AudioForPreviewAssertedShowing = ({
37418
37783
  const { playbackRate: globalPlaybackRate } = Internals.usePlaybackRate();
37419
37784
  const sharedAudioContext = useContext212(SharedAudioContext2);
37420
37785
  const buffer = useBufferState();
37421
- const [mediaMuted] = useMediaMutedState2();
37786
+ const [playerMuted] = usePlayerMutedState2();
37422
37787
  const [mediaVolume] = useMediaVolumeState2();
37423
37788
  const volumePropFrame = useFrameForVolumeProp2(loopVolumeCurveBehavior ?? "repeat");
37424
37789
  const userPreferredVolume = evaluateVolume2({
@@ -37445,7 +37810,7 @@ var AudioForPreviewAssertedShowing = ({
37445
37810
  if (!bufferingContext) {
37446
37811
  throw new Error("useMediaPlayback must be used inside a <BufferingContext>");
37447
37812
  }
37448
- const effectiveMuted = muted || mediaMuted || userPreferredVolume <= 0;
37813
+ const effectiveMuted = muted || playerMuted || userPreferredVolume <= 0;
37449
37814
  const isPlayerBuffering = Internals.useIsPlayerBuffering(bufferingContext);
37450
37815
  const initialPlaying = useRef50(playing && !isPlayerBuffering);
37451
37816
  const initialIsPremounting = useRef50(isPremounting);
@@ -38818,7 +39183,7 @@ var getFormatOrNullOrNetworkError = async (input) => {
38818
39183
  return null;
38819
39184
  }
38820
39185
  };
38821
- var getSinks = async (src, credentials, requestInit) => {
39186
+ var getSinks = async (src, logLevel, credentials, requestInit) => {
38822
39187
  const resolvedRequestInit = resolveRequestInit({ credentials, requestInit });
38823
39188
  const input = new Input22({
38824
39189
  formats: ALL_FORMATS2,
@@ -38857,7 +39222,7 @@ var getSinks = async (src, credentials, requestInit) => {
38857
39222
  });
38858
39223
  const hasAlpha = startPacket?.sideData.alpha;
38859
39224
  if (hasAlpha && !canBrowserUseWebGl2()) {
38860
- return "cannot-decode-alpha";
39225
+ Internals.Log.warn({ logLevel, tag: "@remotion/media" }, `WebGL2 is not available, using the non-fast CPU path to decode alpha for ${src}.`);
38861
39226
  }
38862
39227
  return {
38863
39228
  sampleSink
@@ -38940,7 +39305,7 @@ var getSink = (src, logLevel, credentials, requestInit) => {
38940
39305
  logLevel,
38941
39306
  tag: "@remotion/media"
38942
39307
  }, `Sink for ${src} was not found, creating new sink`);
38943
- promise = getSinks(src, credentials, normalizedRequestInit);
39308
+ promise = getSinks(src, logLevel, credentials, normalizedRequestInit);
38944
39309
  sinkPromises[cacheKey] = promise;
38945
39310
  }
38946
39311
  return promise;
@@ -39898,7 +40263,7 @@ var {
39898
40263
  useUnsafeVideoConfig: useUnsafeVideoConfig22,
39899
40264
  Timeline: Timeline2,
39900
40265
  SharedAudioContext: SharedAudioContext22,
39901
- useMediaMutedState: useMediaMutedState22,
40266
+ usePlayerMutedState: usePlayerMutedState22,
39902
40267
  useMediaVolumeState: useMediaVolumeState22,
39903
40268
  useFrameForVolumeProp: useFrameForVolumeProp22,
39904
40269
  evaluateVolume: evaluateVolume22,
@@ -39959,7 +40324,7 @@ var VideoForPreviewAssertedShowing = ({
39959
40324
  const fallbackVideoRef = useCallback40((video) => {
39960
40325
  refForOutline.current = video;
39961
40326
  }, [refForOutline]);
39962
- const [mediaMuted] = useMediaMutedState22();
40327
+ const [playerMuted] = usePlayerMutedState22();
39963
40328
  const [mediaVolume] = useMediaVolumeState22();
39964
40329
  const volumePropFrame = useFrameForVolumeProp22(loopVolumeCurveBehavior);
39965
40330
  const userPreferredVolume = evaluateVolume22({
@@ -39988,7 +40353,7 @@ var VideoForPreviewAssertedShowing = ({
39988
40353
  if (!buffering) {
39989
40354
  throw new Error("useMediaPlayback must be used inside a <BufferingContext>");
39990
40355
  }
39991
- const effectiveMuted = muted || mediaMuted || userPreferredVolume <= 0;
40356
+ const effectiveMuted = muted || playerMuted || userPreferredVolume <= 0;
39992
40357
  const isPlayerBuffering = Internals.useIsPlayerBuffering(buffering);
39993
40358
  const initialPlaying = useRef213(playing && !isPlayerBuffering);
39994
40359
  const initialIsPremounting = useRef213(isPremounting);
@@ -42200,7 +42565,7 @@ import {
42200
42565
  import { BufferTarget, StreamTarget } from "mediabunny";
42201
42566
 
42202
42567
  // ../core/dist/esm/version.mjs
42203
- var VERSION2 = "4.0.481";
42568
+ var VERSION2 = "4.0.483";
42204
42569
 
42205
42570
  // ../web-renderer/dist/esm/index.mjs
42206
42571
  import { AudioSample, VideoSample } from "mediabunny";
@@ -43527,7 +43892,7 @@ var turnSvgIntoDrawable = (svg) => {
43527
43892
  svg.style.marginBottom = "0";
43528
43893
  svg.style.fill = fill;
43529
43894
  svg.style.color = color;
43530
- const svgData = new XMLSerializer().serializeToString(svg);
43895
+ const svgData = new XMLSerializer().serializeToString(svg).replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g, "");
43531
43896
  svg.style.marginLeft = originalMarginLeft;
43532
43897
  svg.style.marginRight = originalMarginRight;
43533
43898
  svg.style.marginTop = originalMarginTop;
@@ -50393,7 +50758,7 @@ var GithubButton = () => {
50393
50758
  " ",
50394
50759
  /* @__PURE__ */ jsx167("div", {
50395
50760
  className: "text-xs inline-block ml-2 leading-none mt-[3px] self-center",
50396
- children: "50k"
50761
+ children: "51k"
50397
50762
  })
50398
50763
  ]
50399
50764
  });