@remotion/promo-pages 4.0.496 → 4.0.498

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
@@ -2349,7 +2349,7 @@ var getSingleChildComponent = (children) => {
2349
2349
  }
2350
2350
  return child.type;
2351
2351
  };
2352
- var VERSION = "4.0.496";
2352
+ var VERSION = "4.0.498";
2353
2353
  var checkMultipleRemotionVersions = () => {
2354
2354
  if (typeof globalThis === "undefined") {
2355
2355
  return;
@@ -2827,6 +2827,45 @@ var textSchema = {
2827
2827
  hiddenFromList: false
2828
2828
  }
2829
2829
  };
2830
+ var borderSchema = {
2831
+ "style.borderWidth": {
2832
+ type: "number",
2833
+ default: undefined,
2834
+ min: 0,
2835
+ step: 1,
2836
+ description: "Border width",
2837
+ hiddenFromList: false
2838
+ },
2839
+ "style.borderStyle": {
2840
+ type: "enum",
2841
+ default: "none",
2842
+ description: "Border style",
2843
+ variants: {
2844
+ none: {},
2845
+ hidden: {},
2846
+ solid: {},
2847
+ dashed: {},
2848
+ dotted: {},
2849
+ double: {},
2850
+ groove: {},
2851
+ ridge: {},
2852
+ inset: {},
2853
+ outset: {}
2854
+ }
2855
+ },
2856
+ "style.borderColor": {
2857
+ type: "color",
2858
+ default: undefined,
2859
+ description: "Border color"
2860
+ }
2861
+ };
2862
+ var backgroundSchema = {
2863
+ "style.backgroundColor": {
2864
+ type: "color",
2865
+ default: "transparent",
2866
+ description: "Color"
2867
+ }
2868
+ };
2830
2869
  var textContentSchema = {
2831
2870
  children: {
2832
2871
  type: "text-content",
@@ -2854,20 +2893,13 @@ var premountSchema = {
2854
2893
  keyframable: false
2855
2894
  }
2856
2895
  };
2857
- var premountStyleSchema = {
2858
- styleWhilePremounted: {
2859
- type: "hidden"
2860
- },
2861
- styleWhilePostmounted: {
2862
- type: "hidden"
2863
- }
2864
- };
2865
2896
  var sequencePremountSchema = {
2866
- ...premountSchema,
2867
- ...premountStyleSchema
2897
+ ...premountSchema
2868
2898
  };
2869
2899
  var sequenceStyleSchema = {
2870
2900
  ...transformSchema,
2901
+ ...backgroundSchema,
2902
+ ...borderSchema,
2871
2903
  ...sequencePremountSchema
2872
2904
  };
2873
2905
  var hiddenField = {
@@ -3155,6 +3187,9 @@ var PremountContext = createContext15({
3155
3187
  premountFramesRemaining: 0
3156
3188
  });
3157
3189
  var ENABLE_V5_BREAKING_CHANGES = false;
3190
+ var resolveV5Default = (value) => {
3191
+ return value ?? ENABLE_V5_BREAKING_CHANGES;
3192
+ };
3158
3193
  var usePremounting = ({
3159
3194
  from,
3160
3195
  durationInFrames,
@@ -6203,38 +6238,53 @@ var CanvasRefForwardingFunction = ({ width, height, fit, className, style, effec
6203
6238
  });
6204
6239
  };
6205
6240
  var Canvas = React16.forwardRef(CanvasRefForwardingFunction);
6206
- var CACHE_SIZE = 5;
6207
- var getActualTime = ({
6208
- loopBehavior,
6209
- durationFound,
6210
- timeInSec
6211
- }) => {
6212
- return loopBehavior === "loop" ? durationFound ? timeInSec % durationFound : timeInSec : Math.min(timeInSec, durationFound || Infinity);
6213
- };
6214
- var decodeImage = async ({
6241
+ var createImageDecoder = async ({
6215
6242
  resolvedSrc,
6216
6243
  signal,
6217
6244
  requestInit,
6218
- currentTime,
6219
- initialLoopBehavior
6245
+ contentType
6220
6246
  }) => {
6221
6247
  if (typeof ImageDecoder === "undefined") {
6222
6248
  throw new Error("Your browser does not support the WebCodecs ImageDecoder API.");
6223
6249
  }
6224
- const res = await fetch(resolvedSrc, { ...requestInit, signal });
6225
- const { body } = res;
6250
+ const response = await fetch(resolvedSrc, { ...requestInit, signal });
6251
+ const { body } = response;
6226
6252
  if (!body) {
6227
6253
  throw new Error("Got no body");
6228
6254
  }
6229
6255
  const decoder = new ImageDecoder({
6230
6256
  data: body,
6231
- type: res.headers.get("Content-Type") || "image/gif"
6257
+ type: contentType ?? response.headers.get("Content-Type") ?? "image/gif"
6232
6258
  });
6233
- await decoder.completed;
6259
+ await Promise.all([decoder.completed, decoder.tracks.ready]);
6234
6260
  const { selectedTrack } = decoder.tracks;
6235
6261
  if (!selectedTrack) {
6262
+ decoder.close();
6236
6263
  throw new Error("No selected track");
6237
6264
  }
6265
+ return { decoder, selectedTrack };
6266
+ };
6267
+ var CACHE_SIZE = 5;
6268
+ var getActualTime = ({
6269
+ loopBehavior,
6270
+ durationFound,
6271
+ timeInSec
6272
+ }) => {
6273
+ return loopBehavior === "loop" ? durationFound ? timeInSec % durationFound : timeInSec : Math.min(timeInSec, durationFound || Infinity);
6274
+ };
6275
+ var decodeImage = async ({
6276
+ resolvedSrc,
6277
+ signal,
6278
+ requestInit,
6279
+ currentTime,
6280
+ initialLoopBehavior
6281
+ }) => {
6282
+ const { decoder, selectedTrack } = await createImageDecoder({
6283
+ resolvedSrc,
6284
+ signal,
6285
+ requestInit,
6286
+ contentType: null
6287
+ });
6238
6288
  const cache2 = [];
6239
6289
  let durationFound = null;
6240
6290
  const getFrameByIndex = async (frameIndex) => {
@@ -6340,6 +6390,13 @@ var decodeImage = async ({
6340
6390
  return closest;
6341
6391
  };
6342
6392
  return {
6393
+ close: () => {
6394
+ for (const item of cache2) {
6395
+ item.frame?.close();
6396
+ item.frame = null;
6397
+ }
6398
+ decoder.close();
6399
+ },
6343
6400
  getFrame,
6344
6401
  frameCount: selectedTrack.frameCount
6345
6402
  };
@@ -6377,6 +6434,7 @@ var animatedImageSchema = {
6377
6434
  keyframable: false
6378
6435
  },
6379
6436
  ...baseSchema,
6437
+ ...premountSchema,
6380
6438
  playbackRate: {
6381
6439
  type: "number",
6382
6440
  min: 0,
@@ -6387,7 +6445,9 @@ var animatedImageSchema = {
6387
6445
  hiddenFromList: false,
6388
6446
  keyframable: false
6389
6447
  },
6390
- ...transformSchema
6448
+ ...transformSchema,
6449
+ ...backgroundSchema,
6450
+ ...borderSchema
6391
6451
  };
6392
6452
  var getCanvasPropsFromSequenceProps = (props) => {
6393
6453
  const canvasProps = {};
@@ -6439,6 +6499,15 @@ var AnimatedImageContent = forwardRef4(({
6439
6499
  const [initialLoopBehavior] = useState6(() => loopBehavior);
6440
6500
  useEffect5(() => {
6441
6501
  const controller = new AbortController;
6502
+ let cancelled = false;
6503
+ let continued = false;
6504
+ const continueRenderOnce = () => {
6505
+ if (continued) {
6506
+ return;
6507
+ }
6508
+ continued = true;
6509
+ continueRender2(decodeHandle);
6510
+ };
6442
6511
  decodeImage({
6443
6512
  resolvedSrc,
6444
6513
  signal: controller.signal,
@@ -6446,22 +6515,31 @@ var AnimatedImageContent = forwardRef4(({
6446
6515
  currentTime: currentTimeRef.current,
6447
6516
  initialLoopBehavior
6448
6517
  }).then((d) => {
6518
+ if (cancelled) {
6519
+ d.close();
6520
+ return;
6521
+ }
6449
6522
  setImageDecoder(d);
6450
- continueRender2(decodeHandle);
6523
+ continueRenderOnce();
6451
6524
  }).catch((err) => {
6525
+ if (cancelled) {
6526
+ return;
6527
+ }
6452
6528
  if (err.name === "AbortError") {
6453
- continueRender2(decodeHandle);
6529
+ continueRenderOnce();
6454
6530
  return;
6455
6531
  }
6456
6532
  if (onError) {
6457
6533
  onError?.(err);
6458
- continueRender2(decodeHandle);
6534
+ continueRenderOnce();
6459
6535
  } else {
6460
6536
  cancelRender(err);
6461
6537
  }
6462
6538
  });
6463
6539
  return () => {
6540
+ cancelled = true;
6464
6541
  controller.abort();
6542
+ continueRenderOnce();
6465
6543
  };
6466
6544
  }, [
6467
6545
  resolvedSrc,
@@ -6471,6 +6549,11 @@ var AnimatedImageContent = forwardRef4(({
6471
6549
  initialLoopBehavior,
6472
6550
  continueRender2
6473
6551
  ]);
6552
+ useEffect5(() => {
6553
+ return () => {
6554
+ imageDecoder?.close();
6555
+ };
6556
+ }, [imageDecoder]);
6474
6557
  useLayoutEffect2(() => {
6475
6558
  if (!imageDecoder) {
6476
6559
  return;
@@ -6540,6 +6623,11 @@ var AnimatedImageInner = ({
6540
6623
  className,
6541
6624
  style,
6542
6625
  durationInFrames,
6626
+ from,
6627
+ premountFor,
6628
+ postmountFor,
6629
+ styleWhilePremounted,
6630
+ styleWhilePostmounted,
6543
6631
  requestInit,
6544
6632
  effects = [],
6545
6633
  controls,
@@ -6551,6 +6639,24 @@ var AnimatedImageInner = ({
6551
6639
  useImperativeHandle2(ref, () => {
6552
6640
  return actualRef.current;
6553
6641
  }, []);
6642
+ const {
6643
+ effectivePostmountFor,
6644
+ effectivePremountFor,
6645
+ freezeFrame,
6646
+ isPremountingOrPostmounting,
6647
+ postmountingActive,
6648
+ premountingActive,
6649
+ premountingStyle
6650
+ } = usePremounting({
6651
+ from: from ?? 0,
6652
+ durationInFrames: durationInFrames ?? Infinity,
6653
+ premountFor: premountFor ?? null,
6654
+ postmountFor: postmountFor ?? null,
6655
+ style: style ?? null,
6656
+ styleWhilePremounted: styleWhilePremounted ?? null,
6657
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
6658
+ hideWhilePremounted: "display-none"
6659
+ });
6554
6660
  const canvasProps = getCanvasPropsFromSequenceProps(sequenceProps);
6555
6661
  const animatedImageProps = {
6556
6662
  src,
@@ -6562,24 +6668,33 @@ var AnimatedImageInner = ({
6562
6668
  loopBehavior,
6563
6669
  id,
6564
6670
  className,
6565
- style,
6671
+ style: premountingStyle ?? undefined,
6566
6672
  requestInit,
6567
6673
  ...canvasProps
6568
6674
  };
6569
- return /* @__PURE__ */ jsx14(Sequence, {
6570
- layout: "none",
6571
- durationInFrames,
6572
- name: "<AnimatedImage>",
6573
- _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage",
6574
- controls,
6575
- _remotionInternalEffects: memoizedEffectDefinitions,
6576
- ...sequenceProps,
6577
- outlineRef: actualRef,
6578
- children: /* @__PURE__ */ jsx14(AnimatedImageContent, {
6579
- ...animatedImageProps,
6580
- ref: actualRef,
6581
- effects,
6582
- controls
6675
+ return /* @__PURE__ */ jsx14(Freeze, {
6676
+ frame: freezeFrame,
6677
+ active: isPremountingOrPostmounting,
6678
+ children: /* @__PURE__ */ jsx14(Sequence, {
6679
+ layout: "none",
6680
+ from: from ?? 0,
6681
+ durationInFrames: durationInFrames ?? Infinity,
6682
+ name: "<AnimatedImage>",
6683
+ _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage",
6684
+ controls,
6685
+ _remotionInternalEffects: memoizedEffectDefinitions,
6686
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
6687
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
6688
+ _remotionInternalIsPremounting: premountingActive,
6689
+ _remotionInternalIsPostmounting: postmountingActive,
6690
+ ...sequenceProps,
6691
+ outlineRef: actualRef,
6692
+ children: /* @__PURE__ */ jsx14(AnimatedImageContent, {
6693
+ ...animatedImageProps,
6694
+ ref: actualRef,
6695
+ effects,
6696
+ controls
6697
+ })
6583
6698
  })
6584
6699
  });
6585
6700
  };
@@ -7295,13 +7410,17 @@ var makeSharedElementSourceNode = ({
7295
7410
  }) => {
7296
7411
  let connected = null;
7297
7412
  let disposed = false;
7413
+ let currentAudioContext = audioContext;
7298
7414
  return {
7415
+ setAudioContext: (newAudioContext) => {
7416
+ currentAudioContext = newAudioContext;
7417
+ },
7299
7418
  attemptToConnect: () => {
7300
7419
  if (disposed) {
7301
7420
  throw new Error("SharedElementSourceNode has been disposed");
7302
7421
  }
7303
- if (!connected && ref.current) {
7304
- const mediaElementSourceNode = audioContext.createMediaElementSource(ref.current);
7422
+ if (!connected && ref.current && currentAudioContext) {
7423
+ const mediaElementSourceNode = currentAudioContext.createMediaElementSource(ref.current);
7305
7424
  connected = mediaElementSourceNode;
7306
7425
  }
7307
7426
  },
@@ -7629,19 +7748,22 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
7629
7748
  const audioCtx = useContext21(SharedAudioContext);
7630
7749
  const audioContext = audioCtx?.audioContext ?? null;
7631
7750
  const resume = audioCtx?.resume;
7632
- const refs = useMemo22(() => {
7751
+ const [refs] = useState10(() => {
7633
7752
  return new Array(numberOfAudioTags).fill(true).map(() => {
7634
7753
  const ref = createRef2();
7635
7754
  return {
7636
7755
  id: Math.random(),
7637
7756
  ref,
7638
- mediaElementSourceNode: audioContext ? makeSharedElementSourceNode({
7757
+ mediaElementSourceNode: makeSharedElementSourceNode({
7639
7758
  audioContext,
7640
7759
  ref
7641
- }) : null
7760
+ })
7642
7761
  };
7643
7762
  });
7644
- }, [audioContext, numberOfAudioTags]);
7763
+ });
7764
+ for (const { mediaElementSourceNode } of refs) {
7765
+ mediaElementSourceNode?.setAudioContext(audioContext);
7766
+ }
7645
7767
  const effectToUse = React20.useInsertionEffect ?? React20.useLayoutEffect;
7646
7768
  effectToUse(() => {
7647
7769
  return () => {
@@ -7709,7 +7831,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
7709
7831
  const cloned = [...takenAudios.current];
7710
7832
  const index = refs.findIndex((r) => r.id === id);
7711
7833
  if (index === -1) {
7712
- throw new TypeError("Error occured in ");
7834
+ throw new TypeError(`Unknown audio ref ${id}; refs: ${refs.map((r) => r.id).join(", ")}`);
7713
7835
  }
7714
7836
  cloned[index] = false;
7715
7837
  takenAudios.current = cloned;
@@ -7813,10 +7935,10 @@ var useSharedAudio = ({
7813
7935
  return tagsCtx.registerAudio({ aud, audioId, premounting, postmounting });
7814
7936
  }
7815
7937
  const el = React20.createRef();
7816
- const mediaElementSourceNode = audioCtx?.audioContext ? makeSharedElementSourceNode({
7817
- audioContext: audioCtx.audioContext,
7938
+ const mediaElementSourceNode = makeSharedElementSourceNode({
7939
+ audioContext: audioCtx?.audioContext ?? null,
7818
7940
  ref: el
7819
- }) : null;
7941
+ });
7820
7942
  return {
7821
7943
  el,
7822
7944
  id: Math.random(),
@@ -7831,6 +7953,7 @@ var useSharedAudio = ({
7831
7953
  }
7832
7954
  };
7833
7955
  });
7956
+ elem.mediaElementSourceNode?.setAudioContext(audioCtx?.audioContext ?? null);
7834
7957
  const effectToUse = React20.useInsertionEffect ?? React20.useLayoutEffect;
7835
7958
  if (typeof document !== "undefined") {
7836
7959
  effectToUse(() => {
@@ -9542,6 +9665,7 @@ var AudioRefForwardingFunction = (props, ref) => {
9542
9665
  const { loop, freeze: _freeze, ...propsOtherThanLoop } = propsWithFreeze;
9543
9666
  const { fps } = useVideoConfig();
9544
9667
  const environment = useRemotionEnvironment();
9668
+ const shouldPauseWhenBuffering = resolveV5Default(pauseWhenBuffering);
9545
9669
  if (environment.isClientSideRendering) {
9546
9670
  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");
9547
9671
  }
@@ -9611,7 +9735,7 @@ var AudioRefForwardingFunction = (props, ref) => {
9611
9735
  name,
9612
9736
  children: /* @__PURE__ */ jsx23(Html5Audio, {
9613
9737
  _remotionInternalNeedsDurationCalculation: Boolean(loop),
9614
- pauseWhenBuffering: pauseWhenBuffering ?? false,
9738
+ pauseWhenBuffering: shouldPauseWhenBuffering,
9615
9739
  ...otherProps,
9616
9740
  ref
9617
9741
  })
@@ -9639,7 +9763,7 @@ var AudioRefForwardingFunction = (props, ref) => {
9639
9763
  ref,
9640
9764
  onNativeError: onError,
9641
9765
  onDuration,
9642
- pauseWhenBuffering: pauseWhenBuffering ?? false,
9766
+ pauseWhenBuffering: shouldPauseWhenBuffering,
9643
9767
  _remotionInternalNeedsDurationCalculation: Boolean(loop),
9644
9768
  showInTimeline: showInTimeline ?? true
9645
9769
  });
@@ -9688,7 +9812,9 @@ var solidSchema = {
9688
9812
  description: "Pixel density",
9689
9813
  hiddenFromList: false
9690
9814
  },
9691
- ...transformSchema
9815
+ ...transformSchema,
9816
+ ...backgroundSchema,
9817
+ ...borderSchema
9692
9818
  };
9693
9819
  var SolidInner = ({
9694
9820
  color,
@@ -10242,7 +10368,9 @@ var htmlInCanvasSchema = {
10242
10368
  description: "Pixel density",
10243
10369
  hiddenFromList: false
10244
10370
  },
10245
- ...transformSchema
10371
+ ...transformSchema,
10372
+ ...backgroundSchema,
10373
+ ...borderSchema
10246
10374
  };
10247
10375
  var HtmlInCanvasWrapped = withInteractivitySchema({
10248
10376
  Component: HtmlInCanvasInner,
@@ -10264,6 +10392,7 @@ function truncateSrcForLabel(src) {
10264
10392
  }
10265
10393
  var canvasImageSchema = {
10266
10394
  ...baseSchema,
10395
+ ...premountSchema,
10267
10396
  fit: {
10268
10397
  type: "enum",
10269
10398
  default: "fill",
@@ -10274,7 +10403,9 @@ var canvasImageSchema = {
10274
10403
  cover: {}
10275
10404
  }
10276
10405
  },
10277
- ...transformSchema
10406
+ ...transformSchema,
10407
+ ...backgroundSchema,
10408
+ ...borderSchema
10278
10409
  };
10279
10410
  var makeAbortError = () => {
10280
10411
  if (typeof DOMException !== "undefined") {
@@ -10598,6 +10729,10 @@ var CanvasImageInner = forwardRef10(({
10598
10729
  from,
10599
10730
  trimBefore,
10600
10731
  freeze,
10732
+ premountFor,
10733
+ postmountFor,
10734
+ styleWhilePremounted,
10735
+ styleWhilePostmounted,
10601
10736
  hidden,
10602
10737
  name,
10603
10738
  showInTimeline,
@@ -10615,39 +10750,65 @@ var CanvasImageInner = forwardRef10(({
10615
10750
  useImperativeHandle7(ref, () => {
10616
10751
  return actualRef.current;
10617
10752
  }, []);
10618
- return /* @__PURE__ */ jsx26(Sequence, {
10619
- layout: "none",
10753
+ const {
10754
+ effectivePostmountFor,
10755
+ effectivePremountFor,
10756
+ freezeFrame,
10757
+ isPremountingOrPostmounting,
10758
+ postmountingActive,
10759
+ premountingActive,
10760
+ premountingStyle
10761
+ } = usePremounting({
10620
10762
  from: from ?? 0,
10621
- trimBefore,
10622
10763
  durationInFrames: durationInFrames ?? Infinity,
10623
- freeze,
10624
- hidden,
10625
- showInTimeline: showInTimeline ?? true,
10626
- name: name ?? "<CanvasImage>",
10627
- _remotionInternalDocumentationLink: _remotionInternalDocumentationLink ?? "https://www.remotion.dev/docs/canvasimage",
10628
- controls,
10629
- _remotionInternalEffects: memoizedEffectDefinitions,
10630
- _remotionInternalIsMedia: { type: "image", src },
10631
- _remotionInternalStack: stack,
10632
- outlineRef: outlineRef ?? actualRef,
10633
- children: /* @__PURE__ */ jsx26(CanvasImageContent, {
10634
- ref: actualRef,
10635
- src,
10636
- width,
10637
- height,
10638
- fit,
10639
- effects,
10764
+ premountFor: premountFor ?? null,
10765
+ postmountFor: postmountFor ?? null,
10766
+ style: style ?? null,
10767
+ styleWhilePremounted: styleWhilePremounted ?? null,
10768
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
10769
+ hideWhilePremounted: "display-none"
10770
+ });
10771
+ return /* @__PURE__ */ jsx26(Freeze, {
10772
+ frame: freezeFrame,
10773
+ active: isPremountingOrPostmounting,
10774
+ children: /* @__PURE__ */ jsx26(Sequence, {
10775
+ layout: "none",
10776
+ from: from ?? 0,
10777
+ trimBefore,
10778
+ durationInFrames: durationInFrames ?? Infinity,
10779
+ freeze,
10780
+ hidden,
10781
+ showInTimeline: showInTimeline ?? true,
10782
+ name: name ?? "<CanvasImage>",
10783
+ _remotionInternalDocumentationLink: _remotionInternalDocumentationLink ?? "https://www.remotion.dev/docs/canvasimage",
10640
10784
  controls,
10641
- className,
10642
- style,
10643
- id,
10644
- onError,
10645
- pauseWhenLoading,
10646
- maxRetries,
10647
- delayRenderRetries,
10648
- delayRenderTimeoutInMilliseconds,
10649
- refForOutline: outlineRef ?? null,
10650
- ...canvasProps
10785
+ _remotionInternalEffects: memoizedEffectDefinitions,
10786
+ _remotionInternalIsMedia: { type: "image", src },
10787
+ _remotionInternalStack: stack,
10788
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
10789
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
10790
+ _remotionInternalIsPremounting: premountingActive,
10791
+ _remotionInternalIsPostmounting: postmountingActive,
10792
+ outlineRef: outlineRef ?? actualRef,
10793
+ children: /* @__PURE__ */ jsx26(CanvasImageContent, {
10794
+ ref: actualRef,
10795
+ src,
10796
+ width,
10797
+ height,
10798
+ fit,
10799
+ effects,
10800
+ controls,
10801
+ className,
10802
+ style: premountingStyle ?? undefined,
10803
+ id,
10804
+ onError,
10805
+ pauseWhenLoading,
10806
+ maxRetries,
10807
+ delayRenderRetries,
10808
+ delayRenderTimeoutInMilliseconds,
10809
+ refForOutline: outlineRef ?? null,
10810
+ ...canvasProps
10811
+ })
10651
10812
  })
10652
10813
  });
10653
10814
  });
@@ -10864,6 +11025,11 @@ var NativeImgInner = ({
10864
11025
  trimBefore,
10865
11026
  durationInFrames,
10866
11027
  freeze,
11028
+ premountFor,
11029
+ postmountFor,
11030
+ style,
11031
+ styleWhilePremounted,
11032
+ styleWhilePostmounted,
10867
11033
  controls,
10868
11034
  outlineRef: refForOutline,
10869
11035
  ...props2
@@ -10871,24 +11037,51 @@ var NativeImgInner = ({
10871
11037
  if (!src) {
10872
11038
  throw new Error('No "src" prop was passed to <Img>.');
10873
11039
  }
10874
- return /* @__PURE__ */ jsx28(Sequence, {
10875
- layout: "none",
11040
+ const {
11041
+ effectivePostmountFor,
11042
+ effectivePremountFor,
11043
+ freezeFrame,
11044
+ isPremountingOrPostmounting,
11045
+ postmountingActive,
11046
+ premountingActive,
11047
+ premountingStyle
11048
+ } = usePremounting({
10876
11049
  from: from ?? 0,
10877
- trimBefore,
10878
11050
  durationInFrames: durationInFrames ?? Infinity,
10879
- freeze,
10880
- _remotionInternalStack: stack,
10881
- _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img",
10882
- _remotionInternalIsMedia: { type: "image", src },
10883
- name: name ?? "<Img>",
10884
- controls,
10885
- showInTimeline: showInTimeline ?? true,
10886
- hidden,
10887
- outlineRef: refForOutline,
10888
- children: /* @__PURE__ */ jsx28(ImgContent, {
10889
- src,
10890
- refForOutline,
10891
- ...props2
11051
+ premountFor: premountFor ?? null,
11052
+ postmountFor: postmountFor ?? null,
11053
+ style: style ?? null,
11054
+ styleWhilePremounted: styleWhilePremounted ?? null,
11055
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
11056
+ hideWhilePremounted: "display-none"
11057
+ });
11058
+ return /* @__PURE__ */ jsx28(Freeze, {
11059
+ frame: freezeFrame,
11060
+ active: isPremountingOrPostmounting,
11061
+ children: /* @__PURE__ */ jsx28(Sequence, {
11062
+ layout: "none",
11063
+ from: from ?? 0,
11064
+ trimBefore,
11065
+ durationInFrames: durationInFrames ?? Infinity,
11066
+ freeze,
11067
+ _remotionInternalStack: stack,
11068
+ _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img",
11069
+ _remotionInternalIsMedia: { type: "image", src },
11070
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
11071
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
11072
+ _remotionInternalIsPremounting: premountingActive,
11073
+ _remotionInternalIsPostmounting: postmountingActive,
11074
+ name: name ?? "<Img>",
11075
+ controls,
11076
+ showInTimeline: showInTimeline ?? true,
11077
+ hidden,
11078
+ outlineRef: refForOutline,
11079
+ children: /* @__PURE__ */ jsx28(ImgContent, {
11080
+ src,
11081
+ refForOutline,
11082
+ style: premountingStyle ?? undefined,
11083
+ ...props2
11084
+ })
10892
11085
  })
10893
11086
  });
10894
11087
  };
@@ -10901,7 +11094,10 @@ var imgSchema = {
10901
11094
  keyframable: false
10902
11095
  },
10903
11096
  ...baseSchema,
10904
- ...transformSchema
11097
+ ...premountSchema,
11098
+ ...transformSchema,
11099
+ ...backgroundSchema,
11100
+ ...borderSchema
10905
11101
  };
10906
11102
  var imgCanvasFallbackIncompatibleProps = new Set([
10907
11103
  "alt",
@@ -10957,6 +11153,10 @@ var ImgInner = ({
10957
11153
  trimBefore,
10958
11154
  durationInFrames,
10959
11155
  freeze,
11156
+ premountFor,
11157
+ postmountFor,
11158
+ styleWhilePremounted,
11159
+ styleWhilePostmounted,
10960
11160
  controls,
10961
11161
  width,
10962
11162
  height,
@@ -10970,6 +11170,7 @@ var ImgInner = ({
10970
11170
  ...props2
10971
11171
  }) => {
10972
11172
  const refForOutline = useRef24(null);
11173
+ const shouldPauseWhenLoading = resolveV5Default(pauseWhenLoading);
10973
11174
  if (effects.length === 0) {
10974
11175
  return /* @__PURE__ */ jsx28(NativeImgInner, {
10975
11176
  ...props2,
@@ -10983,13 +11184,17 @@ var ImgInner = ({
10983
11184
  trimBefore,
10984
11185
  durationInFrames,
10985
11186
  freeze,
11187
+ premountFor,
11188
+ postmountFor,
11189
+ styleWhilePremounted,
11190
+ styleWhilePostmounted,
10986
11191
  controls,
10987
11192
  width,
10988
11193
  height,
10989
11194
  className,
10990
11195
  style,
10991
11196
  id,
10992
- pauseWhenLoading,
11197
+ pauseWhenLoading: shouldPauseWhenLoading,
10993
11198
  maxRetries,
10994
11199
  delayRenderRetries,
10995
11200
  delayRenderTimeoutInMilliseconds,
@@ -11018,7 +11223,7 @@ var ImgInner = ({
11018
11223
  className,
11019
11224
  style,
11020
11225
  id,
11021
- pauseWhenLoading,
11226
+ pauseWhenLoading: shouldPauseWhenLoading,
11022
11227
  maxRetries,
11023
11228
  delayRenderRetries,
11024
11229
  delayRenderTimeoutInMilliseconds,
@@ -11026,6 +11231,10 @@ var ImgInner = ({
11026
11231
  trimBefore,
11027
11232
  durationInFrames,
11028
11233
  freeze,
11234
+ premountFor,
11235
+ postmountFor,
11236
+ styleWhilePremounted,
11237
+ styleWhilePostmounted,
11029
11238
  hidden,
11030
11239
  name: name ?? "<Img>",
11031
11240
  showInTimeline,
@@ -11064,7 +11273,20 @@ var interactiveElementSchema = {
11064
11273
  ...baseSchema,
11065
11274
  ...transformSchema
11066
11275
  };
11276
+ var interactiveBackgroundElementSchema = {
11277
+ ...interactiveElementSchema,
11278
+ ...backgroundSchema
11279
+ };
11280
+ var interactiveBorderElementSchema = {
11281
+ ...interactiveBackgroundElementSchema,
11282
+ ...borderSchema
11283
+ };
11067
11284
  var interactiveTextElementSchema = {
11285
+ ...interactiveBorderElementSchema,
11286
+ ...textSchema,
11287
+ ...textContentSchema
11288
+ };
11289
+ var interactiveSvgTextElementSchema = {
11068
11290
  ...interactiveElementSchema,
11069
11291
  ...textSchema,
11070
11292
  ...textContentSchema
@@ -11143,6 +11365,8 @@ var Interactive = {
11143
11365
  baseSchema,
11144
11366
  transformSchema,
11145
11367
  textSchema,
11368
+ backgroundSchema,
11369
+ borderSchema,
11146
11370
  premountSchema,
11147
11371
  sequenceSchema,
11148
11372
  withSchema,
@@ -11179,10 +11403,39 @@ var Interactive = {
11179
11403
  Small: makeInteractiveTextElement("small", "<Interactive.Small>"),
11180
11404
  Span: makeInteractiveTextElement("span", "<Interactive.Span>"),
11181
11405
  Strong: makeInteractiveTextElement("strong", "<Interactive.Strong>"),
11182
- Svg: makeInteractiveNonTextElement("svg", "<Interactive.Svg>"),
11183
- Text: makeInteractiveTextElement("text", "<Interactive.Text>"),
11406
+ Svg: makeInteractiveElement("svg", "<Interactive.Svg>", interactiveBorderElementSchema),
11407
+ Text: makeInteractiveElement("text", "<Interactive.Text>", interactiveSvgTextElementSchema),
11184
11408
  Ul: makeInteractiveTextElement("ul", "<Interactive.Ul>")
11185
11409
  };
11410
+ var getAnimatedImageDurationInSeconds = async ({
11411
+ resolvedSrc,
11412
+ signal,
11413
+ requestInit,
11414
+ contentType
11415
+ }) => {
11416
+ const { decoder, selectedTrack } = await createImageDecoder({
11417
+ resolvedSrc,
11418
+ signal,
11419
+ requestInit,
11420
+ contentType
11421
+ });
11422
+ try {
11423
+ const { image } = await decoder.decode({
11424
+ frameIndex: selectedTrack.frameCount - 1,
11425
+ completeFramesOnly: true
11426
+ });
11427
+ try {
11428
+ if (image.duration === null) {
11429
+ throw new Error("Could not determine animated image duration");
11430
+ }
11431
+ return (image.timestamp + image.duration) / 1e6;
11432
+ } finally {
11433
+ image.close();
11434
+ }
11435
+ } finally {
11436
+ decoder.close();
11437
+ }
11438
+ };
11186
11439
  var compositionsRef = React31.createRef();
11187
11440
  var CompositionManagerProvider = ({
11188
11441
  children,
@@ -12164,6 +12417,7 @@ var InnerOffthreadVideo = (props2) => {
12164
12417
  ...otherProps
12165
12418
  } = props2;
12166
12419
  const environment = useRemotionEnvironment();
12420
+ const shouldPauseWhenBuffering = resolveV5Default(pauseWhenBuffering);
12167
12421
  if (environment.isClientSideRendering) {
12168
12422
  throw new Error("<OffthreadVideo> is not supported in @remotion/web-renderer. Use <Video> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");
12169
12423
  }
@@ -12188,7 +12442,7 @@ var InnerOffthreadVideo = (props2) => {
12188
12442
  durationInFrames: trimAfterValue,
12189
12443
  name,
12190
12444
  children: /* @__PURE__ */ jsx35(InnerOffthreadVideo, {
12191
- pauseWhenBuffering: pauseWhenBuffering ?? false,
12445
+ pauseWhenBuffering: shouldPauseWhenBuffering,
12192
12446
  ...otherProps,
12193
12447
  trimAfter: undefined,
12194
12448
  name: undefined,
@@ -12203,7 +12457,7 @@ var InnerOffthreadVideo = (props2) => {
12203
12457
  validateMediaProps(props2, "Video");
12204
12458
  if (environment.isRendering) {
12205
12459
  return /* @__PURE__ */ jsx35(OffthreadVideoForRendering, {
12206
- pauseWhenBuffering: pauseWhenBuffering ?? false,
12460
+ pauseWhenBuffering: shouldPauseWhenBuffering,
12207
12461
  ...otherProps,
12208
12462
  trimAfter: undefined,
12209
12463
  name: undefined,
@@ -12228,7 +12482,7 @@ var InnerOffthreadVideo = (props2) => {
12228
12482
  _remotionInternalStack: stack ?? null,
12229
12483
  onDuration,
12230
12484
  onlyWarnForMediaSeekingError: true,
12231
- pauseWhenBuffering: pauseWhenBuffering ?? false,
12485
+ pauseWhenBuffering: shouldPauseWhenBuffering,
12232
12486
  showInTimeline: showInTimeline ?? true,
12233
12487
  onAutoPlayError: onAutoPlayError ?? undefined,
12234
12488
  onVideoFrame: onVideoFrame ?? null,
@@ -12286,7 +12540,7 @@ var OffthreadVideo = ({
12286
12540
  onAutoPlayError: onAutoPlayError ?? null,
12287
12541
  onError,
12288
12542
  onVideoFrame,
12289
- pauseWhenBuffering: pauseWhenBuffering ?? true,
12543
+ pauseWhenBuffering: resolveV5Default(pauseWhenBuffering),
12290
12544
  playbackRate: playbackRate ?? 1,
12291
12545
  preservePitch,
12292
12546
  toneFrequency: toneFrequency ?? 1,
@@ -12410,6 +12664,7 @@ var Internals = {
12410
12664
  useAbsoluteTimelinePosition,
12411
12665
  evaluateVolume,
12412
12666
  getAbsoluteSrc,
12667
+ getAnimatedImageDurationInSeconds,
12413
12668
  getAssetDisplayName,
12414
12669
  Timeline: exports_timeline_position_state,
12415
12670
  validateMediaTrimProps,
@@ -12434,7 +12689,6 @@ var Internals = {
12434
12689
  textSchema,
12435
12690
  transformSchema,
12436
12691
  premountSchema,
12437
- premountStyleSchema,
12438
12692
  flattenActiveSchema,
12439
12693
  getFlatSchemaWithAllKeys,
12440
12694
  RemotionRootContexts,
@@ -12573,6 +12827,7 @@ var seriesSequenceSchema = {
12573
12827
  hidden: Interactive.sequenceSchema.hidden,
12574
12828
  showInTimeline: Interactive.sequenceSchema.showInTimeline,
12575
12829
  freeze: Interactive.baseSchema.freeze,
12830
+ trimBefore: Interactive.sequenceSchema.trimBefore,
12576
12831
  layout: Interactive.sequenceSchema.layout
12577
12832
  };
12578
12833
  var SeriesSequenceInner = forwardRef14(({
@@ -13168,6 +13423,7 @@ var VideoForwardingFunction = (props2, ref) => {
13168
13423
  const { loop, ...propsOtherThanLoop } = props2;
13169
13424
  const { fps } = useVideoConfig();
13170
13425
  const environment = useRemotionEnvironment();
13426
+ const shouldPauseWhenBuffering = resolveV5Default(pauseWhenBuffering);
13171
13427
  if (environment.isClientSideRendering) {
13172
13428
  throw new Error("<Html5Video> is not supported in @remotion/web-renderer. Use <Video> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");
13173
13429
  }
@@ -13226,7 +13482,7 @@ var VideoForwardingFunction = (props2, ref) => {
13226
13482
  durationInFrames: trimAfterValue === undefined ? undefined : trimAfterValue / (props2.playbackRate ?? 1),
13227
13483
  name,
13228
13484
  children: /* @__PURE__ */ jsx39(Html5Video, {
13229
- pauseWhenBuffering: pauseWhenBuffering ?? false,
13485
+ pauseWhenBuffering: shouldPauseWhenBuffering,
13230
13486
  onVideoFrame,
13231
13487
  ...otherProps,
13232
13488
  ref,
@@ -13252,7 +13508,7 @@ var VideoForwardingFunction = (props2, ref) => {
13252
13508
  ...otherProps,
13253
13509
  ref,
13254
13510
  onVideoFrame: onVideoFrame ?? null,
13255
- pauseWhenBuffering: pauseWhenBuffering ?? false,
13511
+ pauseWhenBuffering: shouldPauseWhenBuffering,
13256
13512
  onDuration,
13257
13513
  _remotionInternalStack: stack ?? null,
13258
13514
  _remotionInternalNativeLoopPassed: _remotionInternalNativeLoopPassed ?? false,
@@ -18194,7 +18450,9 @@ var makeShapeSchema = (shapeFields) => {
18194
18450
  defaultValue: "#0b84ff",
18195
18451
  description: "Fill"
18196
18452
  }),
18197
- ...Internals.transformSchema
18453
+ ...Internals.transformSchema,
18454
+ ...Interactive.backgroundSchema,
18455
+ ...Interactive.borderSchema
18198
18456
  };
18199
18457
  };
18200
18458
  var arrowSchema = makeShapeSchema({
@@ -29997,7 +30255,7 @@ var GitHubStars = () => {
29997
30255
  width: "45px"
29998
30256
  }),
29999
30257
  /* @__PURE__ */ jsx57(StatItemContent, {
30000
- content: "53K",
30258
+ content: "54K",
30001
30259
  width: "80px",
30002
30260
  fontSize: "2.5rem",
30003
30261
  fontWeight: "bold"
@@ -30950,6 +31208,45 @@ var transformSchema2 = {
30950
31208
  hiddenFromList: false
30951
31209
  }
30952
31210
  };
31211
+ var borderSchema2 = {
31212
+ "style.borderWidth": {
31213
+ type: "number",
31214
+ default: undefined,
31215
+ min: 0,
31216
+ step: 1,
31217
+ description: "Border width",
31218
+ hiddenFromList: false
31219
+ },
31220
+ "style.borderStyle": {
31221
+ type: "enum",
31222
+ default: "none",
31223
+ description: "Border style",
31224
+ variants: {
31225
+ none: {},
31226
+ hidden: {},
31227
+ solid: {},
31228
+ dashed: {},
31229
+ dotted: {},
31230
+ double: {},
31231
+ groove: {},
31232
+ ridge: {},
31233
+ inset: {},
31234
+ outset: {}
31235
+ }
31236
+ },
31237
+ "style.borderColor": {
31238
+ type: "color",
31239
+ default: undefined,
31240
+ description: "Border color"
31241
+ }
31242
+ };
31243
+ var backgroundSchema2 = {
31244
+ "style.backgroundColor": {
31245
+ type: "color",
31246
+ default: "transparent",
31247
+ description: "Color"
31248
+ }
31249
+ };
30953
31250
  var premountSchema2 = {
30954
31251
  premountFor: {
30955
31252
  type: "number",
@@ -30969,20 +31266,13 @@ var premountSchema2 = {
30969
31266
  keyframable: false
30970
31267
  }
30971
31268
  };
30972
- var premountStyleSchema2 = {
30973
- styleWhilePremounted: {
30974
- type: "hidden"
30975
- },
30976
- styleWhilePostmounted: {
30977
- type: "hidden"
30978
- }
30979
- };
30980
31269
  var sequencePremountSchema2 = {
30981
- ...premountSchema2,
30982
- ...premountStyleSchema2
31270
+ ...premountSchema2
30983
31271
  };
30984
31272
  var sequenceStyleSchema2 = {
30985
31273
  ...transformSchema2,
31274
+ ...backgroundSchema2,
31275
+ ...borderSchema2,
30986
31276
  ...sequencePremountSchema2
30987
31277
  };
30988
31278
  var hiddenField2 = {
@@ -31714,8 +32004,9 @@ var NoReactInternals = {
31714
32004
  getOffthreadVideoSource: getOffthreadVideoSource2,
31715
32005
  getExpectedMediaFrameUncorrected: getExpectedMediaFrameUncorrected2,
31716
32006
  ENABLE_V5_BREAKING_CHANGES: ENABLE_V5_BREAKING_CHANGES2,
31717
- MIN_NODE_VERSION: ENABLE_V5_BREAKING_CHANGES2 ? 18 : 16,
32007
+ MIN_NODE_VERSION: ENABLE_V5_BREAKING_CHANGES2 ? 22 : 16,
31718
32008
  MIN_BUN_VERSION: ENABLE_V5_BREAKING_CHANGES2 ? "1.1.3" : "1.0.3",
32009
+ MIN_ESLINT_VERSION: ENABLE_V5_BREAKING_CHANGES2 ? "8.57.0" : "7.15.0",
31719
32010
  colorNames: colorNames2,
31720
32011
  DATE_TOKEN: DATE_TOKEN2,
31721
32012
  FILE_TOKEN: FILE_TOKEN2,
@@ -36542,6 +36833,10 @@ async function* makeLoopingIterator({
36542
36833
  passStartInSeconds = loopStartInSeconds;
36543
36834
  }
36544
36835
  }
36836
+ var MINIMUM_AUDIO_BUFFERING_TIME_SECONDS = 0.1;
36837
+ var hasEnoughAudioToStartPlayback = (bufferedDuration) => {
36838
+ return bufferedDuration >= MINIMUM_AUDIO_BUFFERING_TIME_SECONDS;
36839
+ };
36545
36840
  var anchorToContinuousTime = ({
36546
36841
  anchor,
36547
36842
  unloopedTimeInSeconds,
@@ -36724,7 +37019,7 @@ var audioIteratorManager = ({
36724
37019
  onDone();
36725
37020
  return;
36726
37021
  }
36727
- onScheduled(result.value.timelineTimestamp);
37022
+ onScheduled(result.value.sourceDurationInSeconds);
36728
37023
  notifyNodeScheduled();
36729
37024
  onAudioChunk({
36730
37025
  buffer: result.value,
@@ -36806,24 +37101,32 @@ var audioIteratorManager = ({
36806
37101
  });
36807
37102
  audioIteratorsCreated++;
36808
37103
  audioBufferIterator = iterator;
36809
- let chunksScheduled = 0;
37104
+ let bufferedDuration = 0;
37105
+ let hasUnblockedPlayback = false;
37106
+ const unblockPlayback = () => {
37107
+ if (hasUnblockedPlayback) {
37108
+ return;
37109
+ }
37110
+ hasUnblockedPlayback = true;
37111
+ delayHandle.unblock();
37112
+ };
36810
37113
  proceedScheduling({
36811
37114
  iterator,
36812
37115
  nonce,
36813
37116
  getTargetTime,
36814
37117
  playbackRate,
36815
37118
  scheduleAudioNode,
36816
- onScheduled: () => {
36817
- chunksScheduled++;
36818
- if (chunksScheduled === 6) {
36819
- delayHandle.unblock();
37119
+ onScheduled: (sourceDurationInSeconds) => {
37120
+ bufferedDuration += sourceDurationInSeconds;
37121
+ if (hasEnoughAudioToStartPlayback(bufferedDuration)) {
37122
+ unblockPlayback();
36820
37123
  }
36821
37124
  },
36822
37125
  onDestroyed: () => {
36823
- delayHandle.unblock();
37126
+ unblockPlayback();
36824
37127
  },
36825
37128
  onDone: () => {
36826
- delayHandle.unblock();
37129
+ unblockPlayback();
36827
37130
  },
36828
37131
  logLevel,
36829
37132
  currentTime: sharedAudioContext.audioContext.currentTime,
@@ -37362,7 +37665,6 @@ var makePrewarmedVideoIteratorCache = (videoSink) => {
37362
37665
  destroy
37363
37666
  };
37364
37667
  };
37365
- var MAXIMUM_AWAITED_PEEK_DISTANCE_SECONDS = 0.05;
37366
37668
  var createVideoIterator = async (timeToSeek, cache2) => {
37367
37669
  let destroyed = false;
37368
37670
  const iterator = cache2.makeIteratorOrUsePrewarmed(timeToSeek);
@@ -37400,22 +37702,12 @@ var createVideoIterator = async (timeToSeek, cache2) => {
37400
37702
  wait: next.wait
37401
37703
  };
37402
37704
  };
37403
- const peek = async () => {
37404
- const peeked = peekIfReady();
37405
- if (peeked.type === "ready") {
37406
- return peeked.frame;
37407
- }
37408
- return setPeekedFrame(await peeked.wait());
37409
- };
37410
37705
  const getFrameEndTimestampFromPeek = (frame) => {
37411
37706
  return frame ? roundTo4Digits(frame.timestamp) : Infinity;
37412
37707
  };
37413
- const getFrameEndTimestamp = async () => {
37414
- return getFrameEndTimestampFromPeek(await peek());
37415
- };
37416
- const getFrameEndTimestampIfCloseEnough = async ({
37417
- timestamp,
37418
- frameTimestamp
37708
+ const getFrameEndTimestamp = async ({
37709
+ pendingFrameBehavior,
37710
+ shouldContinue
37419
37711
  }) => {
37420
37712
  const peeked = peekIfReady();
37421
37713
  if (peeked.type === "ready") {
@@ -37424,10 +37716,16 @@ var createVideoIterator = async (timeToSeek, cache2) => {
37424
37716
  timestamp: getFrameEndTimestampFromPeek(peeked.frame)
37425
37717
  };
37426
37718
  }
37427
- if (timestamp - frameTimestamp > MAXIMUM_AWAITED_PEEK_DISTANCE_SECONDS) {
37719
+ if (pendingFrameBehavior === "restart-iterator") {
37428
37720
  return { type: "pending" };
37429
37721
  }
37722
+ if (!shouldContinue()) {
37723
+ return { type: "cancelled" };
37724
+ }
37430
37725
  const awaitedPeeked = setPeekedFrame(await peeked.wait());
37726
+ if (!shouldContinue()) {
37727
+ return { type: "cancelled" };
37728
+ }
37431
37729
  return {
37432
37730
  type: "ready",
37433
37731
  timestamp: getFrameEndTimestampFromPeek(awaitedPeeked)
@@ -37481,7 +37779,13 @@ var createVideoIterator = async (timeToSeek, cache2) => {
37481
37779
  return;
37482
37780
  });
37483
37781
  };
37484
- const tryToSatisfySeek = async (time) => {
37782
+ const tryToSatisfySeek = async (time, options2) => {
37783
+ if (!options2.shouldContinue()) {
37784
+ return {
37785
+ type: "not-satisfied",
37786
+ reason: "seek was superseded"
37787
+ };
37788
+ }
37485
37789
  const timestamp = roundTo4Digits(time);
37486
37790
  if (lastReturnedFrame) {
37487
37791
  const frameTimestamp = roundTo4Digits(lastReturnedFrame.timestamp);
@@ -37499,8 +37803,23 @@ var createVideoIterator = async (timeToSeek, cache2) => {
37499
37803
  reason: `iterator is too far, most recently returned ${frameTimestamp}`
37500
37804
  };
37501
37805
  }
37502
- const frameEndTimestamp = await getFrameEndTimestamp();
37503
- if (frameTimestamp <= timestamp && frameEndTimestamp > timestamp) {
37806
+ const frameEndTimestamp = await getFrameEndTimestamp({
37807
+ pendingFrameBehavior: options2.pendingFrameBehavior,
37808
+ shouldContinue: options2.shouldContinue
37809
+ });
37810
+ if (frameEndTimestamp.type === "cancelled") {
37811
+ return {
37812
+ type: "not-satisfied",
37813
+ reason: "seek was superseded"
37814
+ };
37815
+ }
37816
+ if (frameEndTimestamp.type === "pending") {
37817
+ return {
37818
+ type: "not-satisfied",
37819
+ reason: "iterator did not have next frame ready"
37820
+ };
37821
+ }
37822
+ if (frameTimestamp <= timestamp && frameEndTimestamp.timestamp > timestamp) {
37504
37823
  return {
37505
37824
  type: "satisfied",
37506
37825
  frame: lastReturnedFrame
@@ -37520,6 +37839,12 @@ var createVideoIterator = async (timeToSeek, cache2) => {
37520
37839
  };
37521
37840
  }
37522
37841
  while (true) {
37842
+ if (!options2.shouldContinue()) {
37843
+ return {
37844
+ type: "not-satisfied",
37845
+ reason: "seek was superseded"
37846
+ };
37847
+ }
37523
37848
  const frame = getNextOrNullIfNotAvailable();
37524
37849
  if (frame.type === "need-to-wait-for-it") {
37525
37850
  return {
@@ -37542,10 +37867,16 @@ var createVideoIterator = async (timeToSeek, cache2) => {
37542
37867
  };
37543
37868
  }
37544
37869
  const frameTimestamp = roundTo4Digits(frame.frame.timestamp);
37545
- const frameEndTimestamp = await getFrameEndTimestampIfCloseEnough({
37546
- frameTimestamp,
37547
- timestamp
37870
+ const frameEndTimestamp = await getFrameEndTimestamp({
37871
+ pendingFrameBehavior: options2.pendingFrameBehavior,
37872
+ shouldContinue: options2.shouldContinue
37548
37873
  });
37874
+ if (frameEndTimestamp.type === "cancelled") {
37875
+ return {
37876
+ type: "not-satisfied",
37877
+ reason: "seek was superseded"
37878
+ };
37879
+ }
37549
37880
  if (frameEndTimestamp.type === "pending") {
37550
37881
  return {
37551
37882
  type: "not-satisfied",
@@ -37573,6 +37904,19 @@ var createVideoIterator = async (timeToSeek, cache2) => {
37573
37904
  };
37574
37905
  };
37575
37906
  var { runEffectChain: runEffectChain2 } = Internals;
37907
+ var isSequentialMediaTimeAdvance = ({
37908
+ previousTime,
37909
+ newTime,
37910
+ fps,
37911
+ playbackRate,
37912
+ isPlaying
37913
+ }) => {
37914
+ if (!isPlaying || newTime < previousTime) {
37915
+ return false;
37916
+ }
37917
+ const maximumSequentialAdvance = Math.abs(playbackRate) / fps;
37918
+ return roundTo4Digits(newTime - previousTime) <= roundTo4Digits(maximumSequentialAdvance);
37919
+ };
37576
37920
  var videoIteratorManager = async ({
37577
37921
  delayPlaybackHandleIfNotPremounting,
37578
37922
  canvas,
@@ -37682,13 +38026,20 @@ var videoIteratorManager = async ({
37682
38026
  __callDispose(__stack, _err, _hasErr);
37683
38027
  }
37684
38028
  };
37685
- const seek2 = async ({ newTime, nonce }) => {
38029
+ const seek2 = async ({
38030
+ newTime,
38031
+ nonce,
38032
+ fps,
38033
+ playbackRate,
38034
+ isPlaying
38035
+ }) => {
37686
38036
  if (!videoFrameIterator) {
37687
38037
  return;
37688
38038
  }
37689
38039
  if (currentSeek !== null && roundTo4Digits(currentSeek) === roundTo4Digits(newTime)) {
37690
38040
  return;
37691
38041
  }
38042
+ const previousTime = currentSeek;
37692
38043
  currentSeek = newTime;
37693
38044
  if (getIsLooping()) {
37694
38045
  if (getLoopSegmentMediaEndTimestamp() - newTime < 1) {
@@ -37697,7 +38048,17 @@ var videoIteratorManager = async ({
37697
38048
  });
37698
38049
  }
37699
38050
  }
37700
- const videoSatisfyResult = await videoFrameIterator.tryToSatisfySeek(newTime);
38051
+ const pendingFrameBehavior = previousTime !== null && isSequentialMediaTimeAdvance({
38052
+ previousTime,
38053
+ newTime,
38054
+ fps,
38055
+ playbackRate,
38056
+ isPlaying
38057
+ }) ? "wait" : "restart-iterator";
38058
+ const videoSatisfyResult = await videoFrameIterator.tryToSatisfySeek(newTime, {
38059
+ pendingFrameBehavior,
38060
+ shouldContinue: () => !nonce.isStale()
38061
+ });
37701
38062
  if (videoSatisfyResult.type === "satisfied") {
37702
38063
  await drawFrame(videoSatisfyResult.frame);
37703
38064
  return;
@@ -38031,7 +38392,10 @@ class MediaPlayer {
38031
38392
  await Promise.all([
38032
38393
  this.videoIteratorManager?.seek({
38033
38394
  newTime,
38034
- nonce
38395
+ nonce,
38396
+ fps: this.fps,
38397
+ playbackRate: this.playbackRate,
38398
+ isPlaying: this.playing
38035
38399
  }),
38036
38400
  this.audioIteratorManager?.seek({
38037
38401
  newTime,
@@ -41817,7 +42181,6 @@ var videoSchema = {
41817
42181
  },
41818
42182
  ...Internals.baseSchema,
41819
42183
  ...Internals.premountSchema,
41820
- ...Internals.premountStyleSchema,
41821
42184
  volume: {
41822
42185
  type: "number",
41823
42186
  min: 0,
@@ -41838,7 +42201,9 @@ var videoSchema = {
41838
42201
  },
41839
42202
  muted: { type: "boolean", default: false, description: "Muted" },
41840
42203
  loop: { type: "boolean", default: false, description: "Loop" },
41841
- ...Internals.transformSchema
42204
+ ...Internals.transformSchema,
42205
+ ...Interactive.backgroundSchema,
42206
+ ...Interactive.borderSchema
41842
42207
  };
41843
42208
  var InnerVideo = ({
41844
42209
  src,
@@ -43441,7 +43806,7 @@ import {
43441
43806
  import { BufferTarget, StreamTarget } from "mediabunny";
43442
43807
 
43443
43808
  // ../core/dist/esm/version.mjs
43444
- var VERSION2 = "4.0.496";
43809
+ var VERSION2 = "4.0.498";
43445
43810
 
43446
43811
  // ../web-renderer/dist/esm/index.mjs
43447
43812
  import { AudioSample, VideoSample } from "mediabunny";
@@ -45074,6 +45439,67 @@ var hasScaleCssValue = (style2) => {
45074
45439
  var hasAnyTransformCssValue = (style2) => {
45075
45440
  return hasTransformCssValue(style2) || hasRotateCssValue(style2) || hasScaleCssValue(style2);
45076
45441
  };
45442
+ var parseScaleComponent = (component) => {
45443
+ if (component.endsWith("%")) {
45444
+ return Number(component.slice(0, -1)) / 100;
45445
+ }
45446
+ return Number(component);
45447
+ };
45448
+ var parseScale = (transform) => {
45449
+ const match = /^scale\((.*)\)$/.exec(transform);
45450
+ if (!match) {
45451
+ return null;
45452
+ }
45453
+ const scaleValue = match[1].trim();
45454
+ if (scaleValue === "") {
45455
+ return null;
45456
+ }
45457
+ const components = scaleValue.split(/\s+/).map(parseScaleComponent);
45458
+ if (components.length < 1 || components.length > 3 || components.some((component) => !Number.isFinite(component))) {
45459
+ return null;
45460
+ }
45461
+ return {
45462
+ x: components[0],
45463
+ y: components[1] ?? components[0],
45464
+ z: components[2] ?? 1
45465
+ };
45466
+ };
45467
+ var parseAxisRotate = (transform) => {
45468
+ const match = /^rotate\((.*)\)$/.exec(transform);
45469
+ if (!match) {
45470
+ return null;
45471
+ }
45472
+ const rotateValue = match[1].trim();
45473
+ const keywordAxis = /^(x|y|z)\s+(.+)$/i.exec(rotateValue);
45474
+ if (keywordAxis) {
45475
+ const axisKeyword = keywordAxis[1].toLowerCase();
45476
+ const angle = keywordAxis[2];
45477
+ const rotateFunction = axisKeyword === "x" ? "rotateX" : axisKeyword === "y" ? "rotateY" : "rotate";
45478
+ return `${rotateFunction}(${angle})`;
45479
+ }
45480
+ const vectorAxis = /^(\S+)\s+(\S+)\s+(\S+)\s+(.+)$/.exec(rotateValue);
45481
+ if (!vectorAxis) {
45482
+ return null;
45483
+ }
45484
+ const axisVector = vectorAxis.slice(1, 4).map(Number);
45485
+ if (axisVector.some((component) => !Number.isFinite(component))) {
45486
+ return null;
45487
+ }
45488
+ return `rotate3d(${axisVector.join(", ")}, ${vectorAxis[4]})`;
45489
+ };
45490
+ var makeDOMMatrix = (transform) => {
45491
+ if (transform) {
45492
+ const scale = parseScale(transform);
45493
+ if (scale) {
45494
+ return new DOMMatrix().scale(scale.x, scale.y, scale.z);
45495
+ }
45496
+ const axisRotate = parseAxisRotate(transform);
45497
+ if (axisRotate) {
45498
+ return new DOMMatrix(axisRotate);
45499
+ }
45500
+ }
45501
+ return new DOMMatrix(transform);
45502
+ };
45077
45503
  var isValidColor = (color) => {
45078
45504
  try {
45079
45505
  const result = NoReactInternals.processColor(color);
@@ -45471,15 +45897,15 @@ var calculateTransforms = ({
45471
45897
  const hasApplicableTransformCssValue = canApplyCssTransforms({ computedStyle: transformStyle, element: parent }) && hasAnyTransformCssValue(transformStyle);
45472
45898
  if (hasApplicableTransformCssValue || parent === element) {
45473
45899
  const toParse = hasApplicableTransformCssValue && hasTransformCssValue(transformStyle) ? transformStyle.transform : undefined;
45474
- const matrix = new DOMMatrix(toParse);
45900
+ const matrix = makeDOMMatrix(toParse);
45475
45901
  const resetTransforms = makeTransformResetter(parent);
45476
45902
  const { scale, rotate: rotate2 } = parent.style;
45477
45903
  const additionalMatrices = [];
45478
45904
  if (hasApplicableTransformCssValue && rotate2 !== "" && rotate2 !== "none") {
45479
- additionalMatrices.push(new DOMMatrix(`rotate(${rotate2})`));
45905
+ additionalMatrices.push(makeDOMMatrix(`rotate(${rotate2})`));
45480
45906
  }
45481
45907
  if (hasApplicableTransformCssValue && scale !== "" && scale !== "none") {
45482
- additionalMatrices.push(new DOMMatrix(`scale(${scale})`));
45908
+ additionalMatrices.push(makeDOMMatrix(`scale(${scale})`));
45483
45909
  }
45484
45910
  additionalMatrices.push(matrix);
45485
45911
  const cleanup = resetTransforms(hasApplicableTransformCssValue);
@@ -50763,7 +51189,7 @@ var GithubButton = () => {
50763
51189
  " ",
50764
51190
  /* @__PURE__ */ jsx134("div", {
50765
51191
  className: "text-xs inline-block ml-2 leading-none mt-[3px] self-center",
50766
- children: "53k"
51192
+ children: "54k"
50767
51193
  })
50768
51194
  ]
50769
51195
  });