@remotion/promo-pages 4.0.496 → 4.0.497

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.497";
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 = {
@@ -6203,38 +6235,53 @@ var CanvasRefForwardingFunction = ({ width, height, fit, className, style, effec
6203
6235
  });
6204
6236
  };
6205
6237
  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 ({
6238
+ var createImageDecoder = async ({
6215
6239
  resolvedSrc,
6216
6240
  signal,
6217
6241
  requestInit,
6218
- currentTime,
6219
- initialLoopBehavior
6242
+ contentType
6220
6243
  }) => {
6221
6244
  if (typeof ImageDecoder === "undefined") {
6222
6245
  throw new Error("Your browser does not support the WebCodecs ImageDecoder API.");
6223
6246
  }
6224
- const res = await fetch(resolvedSrc, { ...requestInit, signal });
6225
- const { body } = res;
6247
+ const response = await fetch(resolvedSrc, { ...requestInit, signal });
6248
+ const { body } = response;
6226
6249
  if (!body) {
6227
6250
  throw new Error("Got no body");
6228
6251
  }
6229
6252
  const decoder = new ImageDecoder({
6230
6253
  data: body,
6231
- type: res.headers.get("Content-Type") || "image/gif"
6254
+ type: contentType ?? response.headers.get("Content-Type") ?? "image/gif"
6232
6255
  });
6233
- await decoder.completed;
6256
+ await Promise.all([decoder.completed, decoder.tracks.ready]);
6234
6257
  const { selectedTrack } = decoder.tracks;
6235
6258
  if (!selectedTrack) {
6259
+ decoder.close();
6236
6260
  throw new Error("No selected track");
6237
6261
  }
6262
+ return { decoder, selectedTrack };
6263
+ };
6264
+ var CACHE_SIZE = 5;
6265
+ var getActualTime = ({
6266
+ loopBehavior,
6267
+ durationFound,
6268
+ timeInSec
6269
+ }) => {
6270
+ return loopBehavior === "loop" ? durationFound ? timeInSec % durationFound : timeInSec : Math.min(timeInSec, durationFound || Infinity);
6271
+ };
6272
+ var decodeImage = async ({
6273
+ resolvedSrc,
6274
+ signal,
6275
+ requestInit,
6276
+ currentTime,
6277
+ initialLoopBehavior
6278
+ }) => {
6279
+ const { decoder, selectedTrack } = await createImageDecoder({
6280
+ resolvedSrc,
6281
+ signal,
6282
+ requestInit,
6283
+ contentType: null
6284
+ });
6238
6285
  const cache2 = [];
6239
6286
  let durationFound = null;
6240
6287
  const getFrameByIndex = async (frameIndex) => {
@@ -6340,6 +6387,13 @@ var decodeImage = async ({
6340
6387
  return closest;
6341
6388
  };
6342
6389
  return {
6390
+ close: () => {
6391
+ for (const item of cache2) {
6392
+ item.frame?.close();
6393
+ item.frame = null;
6394
+ }
6395
+ decoder.close();
6396
+ },
6343
6397
  getFrame,
6344
6398
  frameCount: selectedTrack.frameCount
6345
6399
  };
@@ -6377,6 +6431,7 @@ var animatedImageSchema = {
6377
6431
  keyframable: false
6378
6432
  },
6379
6433
  ...baseSchema,
6434
+ ...premountSchema,
6380
6435
  playbackRate: {
6381
6436
  type: "number",
6382
6437
  min: 0,
@@ -6387,7 +6442,9 @@ var animatedImageSchema = {
6387
6442
  hiddenFromList: false,
6388
6443
  keyframable: false
6389
6444
  },
6390
- ...transformSchema
6445
+ ...transformSchema,
6446
+ ...backgroundSchema,
6447
+ ...borderSchema
6391
6448
  };
6392
6449
  var getCanvasPropsFromSequenceProps = (props) => {
6393
6450
  const canvasProps = {};
@@ -6439,6 +6496,15 @@ var AnimatedImageContent = forwardRef4(({
6439
6496
  const [initialLoopBehavior] = useState6(() => loopBehavior);
6440
6497
  useEffect5(() => {
6441
6498
  const controller = new AbortController;
6499
+ let cancelled = false;
6500
+ let continued = false;
6501
+ const continueRenderOnce = () => {
6502
+ if (continued) {
6503
+ return;
6504
+ }
6505
+ continued = true;
6506
+ continueRender2(decodeHandle);
6507
+ };
6442
6508
  decodeImage({
6443
6509
  resolvedSrc,
6444
6510
  signal: controller.signal,
@@ -6446,22 +6512,31 @@ var AnimatedImageContent = forwardRef4(({
6446
6512
  currentTime: currentTimeRef.current,
6447
6513
  initialLoopBehavior
6448
6514
  }).then((d) => {
6515
+ if (cancelled) {
6516
+ d.close();
6517
+ return;
6518
+ }
6449
6519
  setImageDecoder(d);
6450
- continueRender2(decodeHandle);
6520
+ continueRenderOnce();
6451
6521
  }).catch((err) => {
6522
+ if (cancelled) {
6523
+ return;
6524
+ }
6452
6525
  if (err.name === "AbortError") {
6453
- continueRender2(decodeHandle);
6526
+ continueRenderOnce();
6454
6527
  return;
6455
6528
  }
6456
6529
  if (onError) {
6457
6530
  onError?.(err);
6458
- continueRender2(decodeHandle);
6531
+ continueRenderOnce();
6459
6532
  } else {
6460
6533
  cancelRender(err);
6461
6534
  }
6462
6535
  });
6463
6536
  return () => {
6537
+ cancelled = true;
6464
6538
  controller.abort();
6539
+ continueRenderOnce();
6465
6540
  };
6466
6541
  }, [
6467
6542
  resolvedSrc,
@@ -6471,6 +6546,11 @@ var AnimatedImageContent = forwardRef4(({
6471
6546
  initialLoopBehavior,
6472
6547
  continueRender2
6473
6548
  ]);
6549
+ useEffect5(() => {
6550
+ return () => {
6551
+ imageDecoder?.close();
6552
+ };
6553
+ }, [imageDecoder]);
6474
6554
  useLayoutEffect2(() => {
6475
6555
  if (!imageDecoder) {
6476
6556
  return;
@@ -6540,6 +6620,11 @@ var AnimatedImageInner = ({
6540
6620
  className,
6541
6621
  style,
6542
6622
  durationInFrames,
6623
+ from,
6624
+ premountFor,
6625
+ postmountFor,
6626
+ styleWhilePremounted,
6627
+ styleWhilePostmounted,
6543
6628
  requestInit,
6544
6629
  effects = [],
6545
6630
  controls,
@@ -6551,6 +6636,24 @@ var AnimatedImageInner = ({
6551
6636
  useImperativeHandle2(ref, () => {
6552
6637
  return actualRef.current;
6553
6638
  }, []);
6639
+ const {
6640
+ effectivePostmountFor,
6641
+ effectivePremountFor,
6642
+ freezeFrame,
6643
+ isPremountingOrPostmounting,
6644
+ postmountingActive,
6645
+ premountingActive,
6646
+ premountingStyle
6647
+ } = usePremounting({
6648
+ from: from ?? 0,
6649
+ durationInFrames: durationInFrames ?? Infinity,
6650
+ premountFor: premountFor ?? null,
6651
+ postmountFor: postmountFor ?? null,
6652
+ style: style ?? null,
6653
+ styleWhilePremounted: styleWhilePremounted ?? null,
6654
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
6655
+ hideWhilePremounted: "display-none"
6656
+ });
6554
6657
  const canvasProps = getCanvasPropsFromSequenceProps(sequenceProps);
6555
6658
  const animatedImageProps = {
6556
6659
  src,
@@ -6562,24 +6665,33 @@ var AnimatedImageInner = ({
6562
6665
  loopBehavior,
6563
6666
  id,
6564
6667
  className,
6565
- style,
6668
+ style: premountingStyle ?? undefined,
6566
6669
  requestInit,
6567
6670
  ...canvasProps
6568
6671
  };
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
6672
+ return /* @__PURE__ */ jsx14(Freeze, {
6673
+ frame: freezeFrame,
6674
+ active: isPremountingOrPostmounting,
6675
+ children: /* @__PURE__ */ jsx14(Sequence, {
6676
+ layout: "none",
6677
+ from: from ?? 0,
6678
+ durationInFrames: durationInFrames ?? Infinity,
6679
+ name: "<AnimatedImage>",
6680
+ _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/animatedimage",
6681
+ controls,
6682
+ _remotionInternalEffects: memoizedEffectDefinitions,
6683
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
6684
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
6685
+ _remotionInternalIsPremounting: premountingActive,
6686
+ _remotionInternalIsPostmounting: postmountingActive,
6687
+ ...sequenceProps,
6688
+ outlineRef: actualRef,
6689
+ children: /* @__PURE__ */ jsx14(AnimatedImageContent, {
6690
+ ...animatedImageProps,
6691
+ ref: actualRef,
6692
+ effects,
6693
+ controls
6694
+ })
6583
6695
  })
6584
6696
  });
6585
6697
  };
@@ -7295,13 +7407,17 @@ var makeSharedElementSourceNode = ({
7295
7407
  }) => {
7296
7408
  let connected = null;
7297
7409
  let disposed = false;
7410
+ let currentAudioContext = audioContext;
7298
7411
  return {
7412
+ setAudioContext: (newAudioContext) => {
7413
+ currentAudioContext = newAudioContext;
7414
+ },
7299
7415
  attemptToConnect: () => {
7300
7416
  if (disposed) {
7301
7417
  throw new Error("SharedElementSourceNode has been disposed");
7302
7418
  }
7303
- if (!connected && ref.current) {
7304
- const mediaElementSourceNode = audioContext.createMediaElementSource(ref.current);
7419
+ if (!connected && ref.current && currentAudioContext) {
7420
+ const mediaElementSourceNode = currentAudioContext.createMediaElementSource(ref.current);
7305
7421
  connected = mediaElementSourceNode;
7306
7422
  }
7307
7423
  },
@@ -7629,19 +7745,22 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
7629
7745
  const audioCtx = useContext21(SharedAudioContext);
7630
7746
  const audioContext = audioCtx?.audioContext ?? null;
7631
7747
  const resume = audioCtx?.resume;
7632
- const refs = useMemo22(() => {
7748
+ const [refs] = useState10(() => {
7633
7749
  return new Array(numberOfAudioTags).fill(true).map(() => {
7634
7750
  const ref = createRef2();
7635
7751
  return {
7636
7752
  id: Math.random(),
7637
7753
  ref,
7638
- mediaElementSourceNode: audioContext ? makeSharedElementSourceNode({
7754
+ mediaElementSourceNode: makeSharedElementSourceNode({
7639
7755
  audioContext,
7640
7756
  ref
7641
- }) : null
7757
+ })
7642
7758
  };
7643
7759
  });
7644
- }, [audioContext, numberOfAudioTags]);
7760
+ });
7761
+ for (const { mediaElementSourceNode } of refs) {
7762
+ mediaElementSourceNode?.setAudioContext(audioContext);
7763
+ }
7645
7764
  const effectToUse = React20.useInsertionEffect ?? React20.useLayoutEffect;
7646
7765
  effectToUse(() => {
7647
7766
  return () => {
@@ -7709,7 +7828,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
7709
7828
  const cloned = [...takenAudios.current];
7710
7829
  const index = refs.findIndex((r) => r.id === id);
7711
7830
  if (index === -1) {
7712
- throw new TypeError("Error occured in ");
7831
+ throw new TypeError(`Unknown audio ref ${id}; refs: ${refs.map((r) => r.id).join(", ")}`);
7713
7832
  }
7714
7833
  cloned[index] = false;
7715
7834
  takenAudios.current = cloned;
@@ -7813,10 +7932,10 @@ var useSharedAudio = ({
7813
7932
  return tagsCtx.registerAudio({ aud, audioId, premounting, postmounting });
7814
7933
  }
7815
7934
  const el = React20.createRef();
7816
- const mediaElementSourceNode = audioCtx?.audioContext ? makeSharedElementSourceNode({
7817
- audioContext: audioCtx.audioContext,
7935
+ const mediaElementSourceNode = makeSharedElementSourceNode({
7936
+ audioContext: audioCtx?.audioContext ?? null,
7818
7937
  ref: el
7819
- }) : null;
7938
+ });
7820
7939
  return {
7821
7940
  el,
7822
7941
  id: Math.random(),
@@ -7831,6 +7950,7 @@ var useSharedAudio = ({
7831
7950
  }
7832
7951
  };
7833
7952
  });
7953
+ elem.mediaElementSourceNode?.setAudioContext(audioCtx?.audioContext ?? null);
7834
7954
  const effectToUse = React20.useInsertionEffect ?? React20.useLayoutEffect;
7835
7955
  if (typeof document !== "undefined") {
7836
7956
  effectToUse(() => {
@@ -9688,7 +9808,9 @@ var solidSchema = {
9688
9808
  description: "Pixel density",
9689
9809
  hiddenFromList: false
9690
9810
  },
9691
- ...transformSchema
9811
+ ...transformSchema,
9812
+ ...backgroundSchema,
9813
+ ...borderSchema
9692
9814
  };
9693
9815
  var SolidInner = ({
9694
9816
  color,
@@ -10242,7 +10364,9 @@ var htmlInCanvasSchema = {
10242
10364
  description: "Pixel density",
10243
10365
  hiddenFromList: false
10244
10366
  },
10245
- ...transformSchema
10367
+ ...transformSchema,
10368
+ ...backgroundSchema,
10369
+ ...borderSchema
10246
10370
  };
10247
10371
  var HtmlInCanvasWrapped = withInteractivitySchema({
10248
10372
  Component: HtmlInCanvasInner,
@@ -10264,6 +10388,7 @@ function truncateSrcForLabel(src) {
10264
10388
  }
10265
10389
  var canvasImageSchema = {
10266
10390
  ...baseSchema,
10391
+ ...premountSchema,
10267
10392
  fit: {
10268
10393
  type: "enum",
10269
10394
  default: "fill",
@@ -10274,7 +10399,9 @@ var canvasImageSchema = {
10274
10399
  cover: {}
10275
10400
  }
10276
10401
  },
10277
- ...transformSchema
10402
+ ...transformSchema,
10403
+ ...backgroundSchema,
10404
+ ...borderSchema
10278
10405
  };
10279
10406
  var makeAbortError = () => {
10280
10407
  if (typeof DOMException !== "undefined") {
@@ -10598,6 +10725,10 @@ var CanvasImageInner = forwardRef10(({
10598
10725
  from,
10599
10726
  trimBefore,
10600
10727
  freeze,
10728
+ premountFor,
10729
+ postmountFor,
10730
+ styleWhilePremounted,
10731
+ styleWhilePostmounted,
10601
10732
  hidden,
10602
10733
  name,
10603
10734
  showInTimeline,
@@ -10615,39 +10746,65 @@ var CanvasImageInner = forwardRef10(({
10615
10746
  useImperativeHandle7(ref, () => {
10616
10747
  return actualRef.current;
10617
10748
  }, []);
10618
- return /* @__PURE__ */ jsx26(Sequence, {
10619
- layout: "none",
10749
+ const {
10750
+ effectivePostmountFor,
10751
+ effectivePremountFor,
10752
+ freezeFrame,
10753
+ isPremountingOrPostmounting,
10754
+ postmountingActive,
10755
+ premountingActive,
10756
+ premountingStyle
10757
+ } = usePremounting({
10620
10758
  from: from ?? 0,
10621
- trimBefore,
10622
10759
  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,
10760
+ premountFor: premountFor ?? null,
10761
+ postmountFor: postmountFor ?? null,
10762
+ style: style ?? null,
10763
+ styleWhilePremounted: styleWhilePremounted ?? null,
10764
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
10765
+ hideWhilePremounted: "display-none"
10766
+ });
10767
+ return /* @__PURE__ */ jsx26(Freeze, {
10768
+ frame: freezeFrame,
10769
+ active: isPremountingOrPostmounting,
10770
+ children: /* @__PURE__ */ jsx26(Sequence, {
10771
+ layout: "none",
10772
+ from: from ?? 0,
10773
+ trimBefore,
10774
+ durationInFrames: durationInFrames ?? Infinity,
10775
+ freeze,
10776
+ hidden,
10777
+ showInTimeline: showInTimeline ?? true,
10778
+ name: name ?? "<CanvasImage>",
10779
+ _remotionInternalDocumentationLink: _remotionInternalDocumentationLink ?? "https://www.remotion.dev/docs/canvasimage",
10640
10780
  controls,
10641
- className,
10642
- style,
10643
- id,
10644
- onError,
10645
- pauseWhenLoading,
10646
- maxRetries,
10647
- delayRenderRetries,
10648
- delayRenderTimeoutInMilliseconds,
10649
- refForOutline: outlineRef ?? null,
10650
- ...canvasProps
10781
+ _remotionInternalEffects: memoizedEffectDefinitions,
10782
+ _remotionInternalIsMedia: { type: "image", src },
10783
+ _remotionInternalStack: stack,
10784
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
10785
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
10786
+ _remotionInternalIsPremounting: premountingActive,
10787
+ _remotionInternalIsPostmounting: postmountingActive,
10788
+ outlineRef: outlineRef ?? actualRef,
10789
+ children: /* @__PURE__ */ jsx26(CanvasImageContent, {
10790
+ ref: actualRef,
10791
+ src,
10792
+ width,
10793
+ height,
10794
+ fit,
10795
+ effects,
10796
+ controls,
10797
+ className,
10798
+ style: premountingStyle ?? undefined,
10799
+ id,
10800
+ onError,
10801
+ pauseWhenLoading,
10802
+ maxRetries,
10803
+ delayRenderRetries,
10804
+ delayRenderTimeoutInMilliseconds,
10805
+ refForOutline: outlineRef ?? null,
10806
+ ...canvasProps
10807
+ })
10651
10808
  })
10652
10809
  });
10653
10810
  });
@@ -10864,6 +11021,11 @@ var NativeImgInner = ({
10864
11021
  trimBefore,
10865
11022
  durationInFrames,
10866
11023
  freeze,
11024
+ premountFor,
11025
+ postmountFor,
11026
+ style,
11027
+ styleWhilePremounted,
11028
+ styleWhilePostmounted,
10867
11029
  controls,
10868
11030
  outlineRef: refForOutline,
10869
11031
  ...props2
@@ -10871,24 +11033,51 @@ var NativeImgInner = ({
10871
11033
  if (!src) {
10872
11034
  throw new Error('No "src" prop was passed to <Img>.');
10873
11035
  }
10874
- return /* @__PURE__ */ jsx28(Sequence, {
10875
- layout: "none",
11036
+ const {
11037
+ effectivePostmountFor,
11038
+ effectivePremountFor,
11039
+ freezeFrame,
11040
+ isPremountingOrPostmounting,
11041
+ postmountingActive,
11042
+ premountingActive,
11043
+ premountingStyle
11044
+ } = usePremounting({
10876
11045
  from: from ?? 0,
10877
- trimBefore,
10878
11046
  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
11047
+ premountFor: premountFor ?? null,
11048
+ postmountFor: postmountFor ?? null,
11049
+ style: style ?? null,
11050
+ styleWhilePremounted: styleWhilePremounted ?? null,
11051
+ styleWhilePostmounted: styleWhilePostmounted ?? null,
11052
+ hideWhilePremounted: "display-none"
11053
+ });
11054
+ return /* @__PURE__ */ jsx28(Freeze, {
11055
+ frame: freezeFrame,
11056
+ active: isPremountingOrPostmounting,
11057
+ children: /* @__PURE__ */ jsx28(Sequence, {
11058
+ layout: "none",
11059
+ from: from ?? 0,
11060
+ trimBefore,
11061
+ durationInFrames: durationInFrames ?? Infinity,
11062
+ freeze,
11063
+ _remotionInternalStack: stack,
11064
+ _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img",
11065
+ _remotionInternalIsMedia: { type: "image", src },
11066
+ _remotionInternalPremountDisplay: effectivePremountFor || null,
11067
+ _remotionInternalPostmountDisplay: effectivePostmountFor || null,
11068
+ _remotionInternalIsPremounting: premountingActive,
11069
+ _remotionInternalIsPostmounting: postmountingActive,
11070
+ name: name ?? "<Img>",
11071
+ controls,
11072
+ showInTimeline: showInTimeline ?? true,
11073
+ hidden,
11074
+ outlineRef: refForOutline,
11075
+ children: /* @__PURE__ */ jsx28(ImgContent, {
11076
+ src,
11077
+ refForOutline,
11078
+ style: premountingStyle ?? undefined,
11079
+ ...props2
11080
+ })
10892
11081
  })
10893
11082
  });
10894
11083
  };
@@ -10901,7 +11090,10 @@ var imgSchema = {
10901
11090
  keyframable: false
10902
11091
  },
10903
11092
  ...baseSchema,
10904
- ...transformSchema
11093
+ ...premountSchema,
11094
+ ...transformSchema,
11095
+ ...backgroundSchema,
11096
+ ...borderSchema
10905
11097
  };
10906
11098
  var imgCanvasFallbackIncompatibleProps = new Set([
10907
11099
  "alt",
@@ -10957,6 +11149,10 @@ var ImgInner = ({
10957
11149
  trimBefore,
10958
11150
  durationInFrames,
10959
11151
  freeze,
11152
+ premountFor,
11153
+ postmountFor,
11154
+ styleWhilePremounted,
11155
+ styleWhilePostmounted,
10960
11156
  controls,
10961
11157
  width,
10962
11158
  height,
@@ -10983,6 +11179,10 @@ var ImgInner = ({
10983
11179
  trimBefore,
10984
11180
  durationInFrames,
10985
11181
  freeze,
11182
+ premountFor,
11183
+ postmountFor,
11184
+ styleWhilePremounted,
11185
+ styleWhilePostmounted,
10986
11186
  controls,
10987
11187
  width,
10988
11188
  height,
@@ -11026,6 +11226,10 @@ var ImgInner = ({
11026
11226
  trimBefore,
11027
11227
  durationInFrames,
11028
11228
  freeze,
11229
+ premountFor,
11230
+ postmountFor,
11231
+ styleWhilePremounted,
11232
+ styleWhilePostmounted,
11029
11233
  hidden,
11030
11234
  name: name ?? "<Img>",
11031
11235
  showInTimeline,
@@ -11064,7 +11268,20 @@ var interactiveElementSchema = {
11064
11268
  ...baseSchema,
11065
11269
  ...transformSchema
11066
11270
  };
11271
+ var interactiveBackgroundElementSchema = {
11272
+ ...interactiveElementSchema,
11273
+ ...backgroundSchema
11274
+ };
11275
+ var interactiveBorderElementSchema = {
11276
+ ...interactiveBackgroundElementSchema,
11277
+ ...borderSchema
11278
+ };
11067
11279
  var interactiveTextElementSchema = {
11280
+ ...interactiveBorderElementSchema,
11281
+ ...textSchema,
11282
+ ...textContentSchema
11283
+ };
11284
+ var interactiveSvgTextElementSchema = {
11068
11285
  ...interactiveElementSchema,
11069
11286
  ...textSchema,
11070
11287
  ...textContentSchema
@@ -11143,6 +11360,8 @@ var Interactive = {
11143
11360
  baseSchema,
11144
11361
  transformSchema,
11145
11362
  textSchema,
11363
+ backgroundSchema,
11364
+ borderSchema,
11146
11365
  premountSchema,
11147
11366
  sequenceSchema,
11148
11367
  withSchema,
@@ -11179,10 +11398,39 @@ var Interactive = {
11179
11398
  Small: makeInteractiveTextElement("small", "<Interactive.Small>"),
11180
11399
  Span: makeInteractiveTextElement("span", "<Interactive.Span>"),
11181
11400
  Strong: makeInteractiveTextElement("strong", "<Interactive.Strong>"),
11182
- Svg: makeInteractiveNonTextElement("svg", "<Interactive.Svg>"),
11183
- Text: makeInteractiveTextElement("text", "<Interactive.Text>"),
11401
+ Svg: makeInteractiveElement("svg", "<Interactive.Svg>", interactiveBorderElementSchema),
11402
+ Text: makeInteractiveElement("text", "<Interactive.Text>", interactiveSvgTextElementSchema),
11184
11403
  Ul: makeInteractiveTextElement("ul", "<Interactive.Ul>")
11185
11404
  };
11405
+ var getAnimatedImageDurationInSeconds = async ({
11406
+ resolvedSrc,
11407
+ signal,
11408
+ requestInit,
11409
+ contentType
11410
+ }) => {
11411
+ const { decoder, selectedTrack } = await createImageDecoder({
11412
+ resolvedSrc,
11413
+ signal,
11414
+ requestInit,
11415
+ contentType
11416
+ });
11417
+ try {
11418
+ const { image } = await decoder.decode({
11419
+ frameIndex: selectedTrack.frameCount - 1,
11420
+ completeFramesOnly: true
11421
+ });
11422
+ try {
11423
+ if (image.duration === null) {
11424
+ throw new Error("Could not determine animated image duration");
11425
+ }
11426
+ return (image.timestamp + image.duration) / 1e6;
11427
+ } finally {
11428
+ image.close();
11429
+ }
11430
+ } finally {
11431
+ decoder.close();
11432
+ }
11433
+ };
11186
11434
  var compositionsRef = React31.createRef();
11187
11435
  var CompositionManagerProvider = ({
11188
11436
  children,
@@ -12410,6 +12658,7 @@ var Internals = {
12410
12658
  useAbsoluteTimelinePosition,
12411
12659
  evaluateVolume,
12412
12660
  getAbsoluteSrc,
12661
+ getAnimatedImageDurationInSeconds,
12413
12662
  getAssetDisplayName,
12414
12663
  Timeline: exports_timeline_position_state,
12415
12664
  validateMediaTrimProps,
@@ -12434,7 +12683,6 @@ var Internals = {
12434
12683
  textSchema,
12435
12684
  transformSchema,
12436
12685
  premountSchema,
12437
- premountStyleSchema,
12438
12686
  flattenActiveSchema,
12439
12687
  getFlatSchemaWithAllKeys,
12440
12688
  RemotionRootContexts,
@@ -12573,6 +12821,7 @@ var seriesSequenceSchema = {
12573
12821
  hidden: Interactive.sequenceSchema.hidden,
12574
12822
  showInTimeline: Interactive.sequenceSchema.showInTimeline,
12575
12823
  freeze: Interactive.baseSchema.freeze,
12824
+ trimBefore: Interactive.sequenceSchema.trimBefore,
12576
12825
  layout: Interactive.sequenceSchema.layout
12577
12826
  };
12578
12827
  var SeriesSequenceInner = forwardRef14(({
@@ -18194,7 +18443,9 @@ var makeShapeSchema = (shapeFields) => {
18194
18443
  defaultValue: "#0b84ff",
18195
18444
  description: "Fill"
18196
18445
  }),
18197
- ...Internals.transformSchema
18446
+ ...Internals.transformSchema,
18447
+ ...Interactive.backgroundSchema,
18448
+ ...Interactive.borderSchema
18198
18449
  };
18199
18450
  };
18200
18451
  var arrowSchema = makeShapeSchema({
@@ -30950,6 +31201,45 @@ var transformSchema2 = {
30950
31201
  hiddenFromList: false
30951
31202
  }
30952
31203
  };
31204
+ var borderSchema2 = {
31205
+ "style.borderWidth": {
31206
+ type: "number",
31207
+ default: undefined,
31208
+ min: 0,
31209
+ step: 1,
31210
+ description: "Border width",
31211
+ hiddenFromList: false
31212
+ },
31213
+ "style.borderStyle": {
31214
+ type: "enum",
31215
+ default: "none",
31216
+ description: "Border style",
31217
+ variants: {
31218
+ none: {},
31219
+ hidden: {},
31220
+ solid: {},
31221
+ dashed: {},
31222
+ dotted: {},
31223
+ double: {},
31224
+ groove: {},
31225
+ ridge: {},
31226
+ inset: {},
31227
+ outset: {}
31228
+ }
31229
+ },
31230
+ "style.borderColor": {
31231
+ type: "color",
31232
+ default: undefined,
31233
+ description: "Border color"
31234
+ }
31235
+ };
31236
+ var backgroundSchema2 = {
31237
+ "style.backgroundColor": {
31238
+ type: "color",
31239
+ default: "transparent",
31240
+ description: "Color"
31241
+ }
31242
+ };
30953
31243
  var premountSchema2 = {
30954
31244
  premountFor: {
30955
31245
  type: "number",
@@ -30969,20 +31259,13 @@ var premountSchema2 = {
30969
31259
  keyframable: false
30970
31260
  }
30971
31261
  };
30972
- var premountStyleSchema2 = {
30973
- styleWhilePremounted: {
30974
- type: "hidden"
30975
- },
30976
- styleWhilePostmounted: {
30977
- type: "hidden"
30978
- }
30979
- };
30980
31262
  var sequencePremountSchema2 = {
30981
- ...premountSchema2,
30982
- ...premountStyleSchema2
31263
+ ...premountSchema2
30983
31264
  };
30984
31265
  var sequenceStyleSchema2 = {
30985
31266
  ...transformSchema2,
31267
+ ...backgroundSchema2,
31268
+ ...borderSchema2,
30986
31269
  ...sequencePremountSchema2
30987
31270
  };
30988
31271
  var hiddenField2 = {
@@ -36542,6 +36825,10 @@ async function* makeLoopingIterator({
36542
36825
  passStartInSeconds = loopStartInSeconds;
36543
36826
  }
36544
36827
  }
36828
+ var MINIMUM_AUDIO_BUFFERING_TIME_SECONDS = 0.1;
36829
+ var hasEnoughAudioToStartPlayback = (bufferedDuration) => {
36830
+ return bufferedDuration >= MINIMUM_AUDIO_BUFFERING_TIME_SECONDS;
36831
+ };
36545
36832
  var anchorToContinuousTime = ({
36546
36833
  anchor,
36547
36834
  unloopedTimeInSeconds,
@@ -36724,7 +37011,7 @@ var audioIteratorManager = ({
36724
37011
  onDone();
36725
37012
  return;
36726
37013
  }
36727
- onScheduled(result.value.timelineTimestamp);
37014
+ onScheduled(result.value.sourceDurationInSeconds);
36728
37015
  notifyNodeScheduled();
36729
37016
  onAudioChunk({
36730
37017
  buffer: result.value,
@@ -36806,24 +37093,32 @@ var audioIteratorManager = ({
36806
37093
  });
36807
37094
  audioIteratorsCreated++;
36808
37095
  audioBufferIterator = iterator;
36809
- let chunksScheduled = 0;
37096
+ let bufferedDuration = 0;
37097
+ let hasUnblockedPlayback = false;
37098
+ const unblockPlayback = () => {
37099
+ if (hasUnblockedPlayback) {
37100
+ return;
37101
+ }
37102
+ hasUnblockedPlayback = true;
37103
+ delayHandle.unblock();
37104
+ };
36810
37105
  proceedScheduling({
36811
37106
  iterator,
36812
37107
  nonce,
36813
37108
  getTargetTime,
36814
37109
  playbackRate,
36815
37110
  scheduleAudioNode,
36816
- onScheduled: () => {
36817
- chunksScheduled++;
36818
- if (chunksScheduled === 6) {
36819
- delayHandle.unblock();
37111
+ onScheduled: (sourceDurationInSeconds) => {
37112
+ bufferedDuration += sourceDurationInSeconds;
37113
+ if (hasEnoughAudioToStartPlayback(bufferedDuration)) {
37114
+ unblockPlayback();
36820
37115
  }
36821
37116
  },
36822
37117
  onDestroyed: () => {
36823
- delayHandle.unblock();
37118
+ unblockPlayback();
36824
37119
  },
36825
37120
  onDone: () => {
36826
- delayHandle.unblock();
37121
+ unblockPlayback();
36827
37122
  },
36828
37123
  logLevel,
36829
37124
  currentTime: sharedAudioContext.audioContext.currentTime,
@@ -41817,7 +42112,6 @@ var videoSchema = {
41817
42112
  },
41818
42113
  ...Internals.baseSchema,
41819
42114
  ...Internals.premountSchema,
41820
- ...Internals.premountStyleSchema,
41821
42115
  volume: {
41822
42116
  type: "number",
41823
42117
  min: 0,
@@ -41838,7 +42132,9 @@ var videoSchema = {
41838
42132
  },
41839
42133
  muted: { type: "boolean", default: false, description: "Muted" },
41840
42134
  loop: { type: "boolean", default: false, description: "Loop" },
41841
- ...Internals.transformSchema
42135
+ ...Internals.transformSchema,
42136
+ ...Interactive.backgroundSchema,
42137
+ ...Interactive.borderSchema
41842
42138
  };
41843
42139
  var InnerVideo = ({
41844
42140
  src,
@@ -43441,7 +43737,7 @@ import {
43441
43737
  import { BufferTarget, StreamTarget } from "mediabunny";
43442
43738
 
43443
43739
  // ../core/dist/esm/version.mjs
43444
- var VERSION2 = "4.0.496";
43740
+ var VERSION2 = "4.0.497";
43445
43741
 
43446
43742
  // ../web-renderer/dist/esm/index.mjs
43447
43743
  import { AudioSample, VideoSample } from "mediabunny";
@@ -45074,6 +45370,67 @@ var hasScaleCssValue = (style2) => {
45074
45370
  var hasAnyTransformCssValue = (style2) => {
45075
45371
  return hasTransformCssValue(style2) || hasRotateCssValue(style2) || hasScaleCssValue(style2);
45076
45372
  };
45373
+ var parseScaleComponent = (component) => {
45374
+ if (component.endsWith("%")) {
45375
+ return Number(component.slice(0, -1)) / 100;
45376
+ }
45377
+ return Number(component);
45378
+ };
45379
+ var parseScale = (transform) => {
45380
+ const match = /^scale\((.*)\)$/.exec(transform);
45381
+ if (!match) {
45382
+ return null;
45383
+ }
45384
+ const scaleValue = match[1].trim();
45385
+ if (scaleValue === "") {
45386
+ return null;
45387
+ }
45388
+ const components = scaleValue.split(/\s+/).map(parseScaleComponent);
45389
+ if (components.length < 1 || components.length > 3 || components.some((component) => !Number.isFinite(component))) {
45390
+ return null;
45391
+ }
45392
+ return {
45393
+ x: components[0],
45394
+ y: components[1] ?? components[0],
45395
+ z: components[2] ?? 1
45396
+ };
45397
+ };
45398
+ var parseAxisRotate = (transform) => {
45399
+ const match = /^rotate\((.*)\)$/.exec(transform);
45400
+ if (!match) {
45401
+ return null;
45402
+ }
45403
+ const rotateValue = match[1].trim();
45404
+ const keywordAxis = /^(x|y|z)\s+(.+)$/i.exec(rotateValue);
45405
+ if (keywordAxis) {
45406
+ const axisKeyword = keywordAxis[1].toLowerCase();
45407
+ const angle = keywordAxis[2];
45408
+ const rotateFunction = axisKeyword === "x" ? "rotateX" : axisKeyword === "y" ? "rotateY" : "rotate";
45409
+ return `${rotateFunction}(${angle})`;
45410
+ }
45411
+ const vectorAxis = /^(\S+)\s+(\S+)\s+(\S+)\s+(.+)$/.exec(rotateValue);
45412
+ if (!vectorAxis) {
45413
+ return null;
45414
+ }
45415
+ const axisVector = vectorAxis.slice(1, 4).map(Number);
45416
+ if (axisVector.some((component) => !Number.isFinite(component))) {
45417
+ return null;
45418
+ }
45419
+ return `rotate3d(${axisVector.join(", ")}, ${vectorAxis[4]})`;
45420
+ };
45421
+ var makeDOMMatrix = (transform) => {
45422
+ if (transform) {
45423
+ const scale = parseScale(transform);
45424
+ if (scale) {
45425
+ return new DOMMatrix().scale(scale.x, scale.y, scale.z);
45426
+ }
45427
+ const axisRotate = parseAxisRotate(transform);
45428
+ if (axisRotate) {
45429
+ return new DOMMatrix(axisRotate);
45430
+ }
45431
+ }
45432
+ return new DOMMatrix(transform);
45433
+ };
45077
45434
  var isValidColor = (color) => {
45078
45435
  try {
45079
45436
  const result = NoReactInternals.processColor(color);
@@ -45471,15 +45828,15 @@ var calculateTransforms = ({
45471
45828
  const hasApplicableTransformCssValue = canApplyCssTransforms({ computedStyle: transformStyle, element: parent }) && hasAnyTransformCssValue(transformStyle);
45472
45829
  if (hasApplicableTransformCssValue || parent === element) {
45473
45830
  const toParse = hasApplicableTransformCssValue && hasTransformCssValue(transformStyle) ? transformStyle.transform : undefined;
45474
- const matrix = new DOMMatrix(toParse);
45831
+ const matrix = makeDOMMatrix(toParse);
45475
45832
  const resetTransforms = makeTransformResetter(parent);
45476
45833
  const { scale, rotate: rotate2 } = parent.style;
45477
45834
  const additionalMatrices = [];
45478
45835
  if (hasApplicableTransformCssValue && rotate2 !== "" && rotate2 !== "none") {
45479
- additionalMatrices.push(new DOMMatrix(`rotate(${rotate2})`));
45836
+ additionalMatrices.push(makeDOMMatrix(`rotate(${rotate2})`));
45480
45837
  }
45481
45838
  if (hasApplicableTransformCssValue && scale !== "" && scale !== "none") {
45482
- additionalMatrices.push(new DOMMatrix(`scale(${scale})`));
45839
+ additionalMatrices.push(makeDOMMatrix(`scale(${scale})`));
45483
45840
  }
45484
45841
  additionalMatrices.push(matrix);
45485
45842
  const cleanup = resetTransforms(hasApplicableTransformCssValue);