remotion 4.0.498 → 4.0.500

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.
Files changed (38) hide show
  1. package/dist/cjs/CompositionManager.d.ts +0 -1
  2. package/dist/cjs/HtmlInCanvas.d.ts +43 -3
  3. package/dist/cjs/HtmlInCanvas.js +29 -2
  4. package/dist/cjs/Img.d.ts +43 -3
  5. package/dist/cjs/Img.js +15 -5
  6. package/dist/cjs/Interactive.d.ts +118 -0
  7. package/dist/cjs/Interactive.js +28 -9
  8. package/dist/cjs/Sequence.d.ts +4 -0
  9. package/dist/cjs/Sequence.js +22 -7
  10. package/dist/cjs/TimelineContext.d.ts +0 -1
  11. package/dist/cjs/TimelineContext.js +1 -4
  12. package/dist/cjs/animated-image/AnimatedImage.d.ts +41 -1
  13. package/dist/cjs/animated-image/AnimatedImage.js +12 -2
  14. package/dist/cjs/animated-image/props.d.ts +2 -2
  15. package/dist/cjs/canvas-image/CanvasImage.d.ts +42 -1
  16. package/dist/cjs/canvas-image/CanvasImage.js +12 -2
  17. package/dist/cjs/canvas-image/props.d.ts +6 -2
  18. package/dist/cjs/effects/Solid.d.ts +43 -3
  19. package/dist/cjs/effects/Solid.js +12 -2
  20. package/dist/cjs/index.d.ts +1 -1
  21. package/dist/cjs/interactivity-schema.d.ts +239 -0
  22. package/dist/cjs/interactivity-schema.js +70 -1
  23. package/dist/cjs/internals.d.ts +127 -1
  24. package/dist/cjs/internals.js +5 -0
  25. package/dist/cjs/no-react.d.ts +40 -0
  26. package/dist/cjs/sequence-crop.d.ts +19 -0
  27. package/dist/cjs/sequence-crop.js +45 -0
  28. package/dist/cjs/use-crop-style.d.ts +6 -0
  29. package/dist/cjs/use-crop-style.js +19 -0
  30. package/dist/cjs/use-media-in-timeline.d.ts +0 -1
  31. package/dist/cjs/use-media-in-timeline.js +1 -7
  32. package/dist/cjs/version.d.ts +1 -1
  33. package/dist/cjs/version.js +1 -1
  34. package/dist/cjs/with-interactivity-schema.js +4 -2
  35. package/dist/esm/index.mjs +408 -140
  36. package/dist/esm/no-react.mjs +67 -0
  37. package/dist/esm/version.mjs +1 -1
  38. package/package.json +3 -3
@@ -1310,7 +1310,7 @@ var getSingleChildComponent = (children) => {
1310
1310
  };
1311
1311
 
1312
1312
  // src/version.ts
1313
- var VERSION = "4.0.498";
1313
+ var VERSION = "4.0.500";
1314
1314
 
1315
1315
  // src/multiple-versions-warning.ts
1316
1316
  var checkMultipleRemotionVersions = () => {
@@ -1388,42 +1388,6 @@ import {
1388
1388
  useRef as useRef3,
1389
1389
  useState as useState2
1390
1390
  } from "react";
1391
-
1392
- // src/random.ts
1393
- function mulberry32(a) {
1394
- let t = a + 1831565813;
1395
- t = Math.imul(t ^ t >>> 15, t | 1);
1396
- t ^= t + Math.imul(t ^ t >>> 7, t | 61);
1397
- return ((t ^ t >>> 14) >>> 0) / 4294967296;
1398
- }
1399
- function hashCode(str) {
1400
- let i = 0;
1401
- let chr = 0;
1402
- let hash = 0;
1403
- for (i = 0;i < str.length; i++) {
1404
- chr = str.charCodeAt(i);
1405
- hash = (hash << 5) - hash + chr;
1406
- hash |= 0;
1407
- }
1408
- return hash;
1409
- }
1410
- var random = (seed, dummy) => {
1411
- if (dummy !== undefined) {
1412
- throw new TypeError("random() takes only one argument");
1413
- }
1414
- if (seed === null) {
1415
- return Math.random();
1416
- }
1417
- if (typeof seed === "string") {
1418
- return mulberry32(hashCode(seed));
1419
- }
1420
- if (typeof seed === "number") {
1421
- return mulberry32(seed * 10000000000);
1422
- }
1423
- throw new Error("random() argument must be a number or a string");
1424
- };
1425
-
1426
- // src/TimelineContext.tsx
1427
1391
  import { jsx as jsx8 } from "react/jsx-runtime";
1428
1392
  var SetTimelineContext = createContext13({
1429
1393
  setFrame: () => {
@@ -1441,7 +1405,6 @@ var TimelineContextProvider = ({ children, frameState }) => {
1441
1405
  const imperativePlaying = useRef3(false);
1442
1406
  const [playbackRate, setPlaybackRate] = useState2(1);
1443
1407
  const audioAndVideoTags = useRef3([]);
1444
- const [remotionRootId] = useState2(() => String(random(null)));
1445
1408
  const [_frame, setFrame] = useState2(() => getInitialFrameState());
1446
1409
  const frame = frameState ?? _frame;
1447
1410
  const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
@@ -1476,10 +1439,9 @@ var TimelineContextProvider = ({ children, frameState }) => {
1476
1439
  frame,
1477
1440
  playing,
1478
1441
  imperativePlaying,
1479
- rootId: remotionRootId,
1480
1442
  audioAndVideoTags
1481
1443
  };
1482
- }, [frame, playing, remotionRootId]);
1444
+ }, [frame, playing]);
1483
1445
  const playbackRateContextValue = useMemo8(() => {
1484
1446
  return {
1485
1447
  playbackRate,
@@ -1886,6 +1848,29 @@ var backgroundSchema = {
1886
1848
  description: "Color"
1887
1849
  }
1888
1850
  };
1851
+ var svgStrokeSchema = {
1852
+ stroke: {
1853
+ type: "color",
1854
+ default: "none",
1855
+ description: "Stroke"
1856
+ },
1857
+ strokeWidth: {
1858
+ type: "number",
1859
+ default: 1,
1860
+ description: "Stroke width",
1861
+ min: 0,
1862
+ step: 1,
1863
+ hiddenFromList: false
1864
+ }
1865
+ };
1866
+ var svgPaintSchema = {
1867
+ fill: {
1868
+ type: "color",
1869
+ default: undefined,
1870
+ description: "Fill"
1871
+ },
1872
+ ...svgStrokeSchema
1873
+ };
1889
1874
  var textContentSchema = {
1890
1875
  children: {
1891
1876
  type: "text-content",
@@ -1916,7 +1901,51 @@ var premountSchema = {
1916
1901
  var sequencePremountSchema = {
1917
1902
  ...premountSchema
1918
1903
  };
1904
+ var cropSchema = {
1905
+ cropLeft: {
1906
+ type: "number",
1907
+ default: 0,
1908
+ description: "Crop left",
1909
+ min: 0,
1910
+ max: 1,
1911
+ step: 0.01,
1912
+ hiddenFromList: false,
1913
+ keyframable: true
1914
+ },
1915
+ cropRight: {
1916
+ type: "number",
1917
+ default: 0,
1918
+ description: "Crop right",
1919
+ min: 0,
1920
+ max: 1,
1921
+ step: 0.01,
1922
+ hiddenFromList: false,
1923
+ keyframable: true
1924
+ },
1925
+ cropTop: {
1926
+ type: "number",
1927
+ default: 0,
1928
+ description: "Crop top",
1929
+ min: 0,
1930
+ max: 1,
1931
+ step: 0.01,
1932
+ hiddenFromList: false,
1933
+ keyframable: true
1934
+ },
1935
+ cropBottom: {
1936
+ type: "number",
1937
+ default: 0,
1938
+ description: "Crop bottom",
1939
+ min: 0,
1940
+ max: 1,
1941
+ step: 0.01,
1942
+ hiddenFromList: false,
1943
+ keyframable: true
1944
+ }
1945
+ };
1946
+ var sequenceCropSchema = cropSchema;
1919
1947
  var sequenceStyleSchema = {
1948
+ ...sequenceCropSchema,
1920
1949
  ...transformSchema,
1921
1950
  ...backgroundSchema,
1922
1951
  ...borderSchema,
@@ -2006,6 +2035,56 @@ var sequenceSchemaDefaultLayoutNone = {
2006
2035
  }
2007
2036
  };
2008
2037
 
2038
+ // src/sequence-crop.ts
2039
+ var clampCrop = (value) => {
2040
+ return Math.min(1, Math.max(0, value ?? 0));
2041
+ };
2042
+ var resolveAxis = (start, end) => {
2043
+ const resolvedStart = clampCrop(start);
2044
+ const resolvedEnd = clampCrop(end);
2045
+ if (resolvedStart + resolvedEnd > 1) {
2046
+ return [0.5, 0.5];
2047
+ }
2048
+ return [resolvedStart, resolvedEnd];
2049
+ };
2050
+ var resolveSequenceCrop = ({
2051
+ cropLeft,
2052
+ cropRight,
2053
+ cropTop,
2054
+ cropBottom
2055
+ }) => {
2056
+ const [left, right] = resolveAxis(cropLeft, cropRight);
2057
+ const [top, bottom] = resolveAxis(cropTop, cropBottom);
2058
+ return { left, right, top, bottom };
2059
+ };
2060
+ var getSequenceCropClipPath = ({
2061
+ left,
2062
+ right,
2063
+ top,
2064
+ bottom,
2065
+ borderRadius
2066
+ }) => {
2067
+ if (left === 0 && right === 0 && top === 0 && bottom === 0) {
2068
+ return null;
2069
+ }
2070
+ const serializedBorderRadius = typeof borderRadius === "number" ? `${borderRadius}px` : borderRadius;
2071
+ const rounded = serializedBorderRadius ? ` round ${serializedBorderRadius}` : "";
2072
+ return `inset(${top * 100}% ${right * 100}% ${bottom * 100}% ${left * 100}%${rounded})`;
2073
+ };
2074
+ var validateSequenceCrop = (crop, componentName = "<Sequence />") => {
2075
+ for (const [name, value] of Object.entries(crop)) {
2076
+ if (value === undefined) {
2077
+ continue;
2078
+ }
2079
+ if (typeof value !== "number" || !Number.isFinite(value)) {
2080
+ throw new TypeError(`The "${name}" prop of ${componentName} must be a finite number, but got ${String(value)}.`);
2081
+ }
2082
+ if (value < 0 || value > 1) {
2083
+ throw new RangeError(`The "${name}" prop of ${componentName} must be between 0 and 1, but got ${value}.`);
2084
+ }
2085
+ }
2086
+ };
2087
+
2009
2088
  // src/SequenceManager.tsx
2010
2089
  import React12, { useCallback as useCallback5, useMemo as useMemo12, useRef as useRef4, useState as useState3 } from "react";
2011
2090
  import { jsx as jsx10 } from "react/jsx-runtime";
@@ -4487,7 +4566,7 @@ var withInteractivitySchema = ({
4487
4566
  const flatKeys = Object.keys(flatSchema);
4488
4567
  const Wrapped = forwardRef2((props, ref) => {
4489
4568
  const env = useRemotionEnvironment();
4490
- if (!env.isStudio || env.isReadOnlyStudio || env.isRendering) {
4569
+ if (!env.isStudio || env.isRendering) {
4491
4570
  return React14.createElement(Component, {
4492
4571
  ...props,
4493
4572
  controls: null,
@@ -4517,7 +4596,7 @@ var withInteractivitySchema = ({
4517
4596
  stackToOverrideMap[stack] = newOverrideId;
4518
4597
  return newOverrideId;
4519
4598
  });
4520
- const nodePath = nodePathMapping.overrideIdToNodePathMappings[overrideId] ?? null;
4599
+ const nodePath = env.isReadOnlyStudio ? null : nodePathMapping.overrideIdToNodePathMappings[overrideId] ?? null;
4521
4600
  const runtimeValues = flatKeys.map((key) => getRuntimeValueForSchemaKey({
4522
4601
  flatSchema,
4523
4602
  key,
@@ -4591,17 +4670,32 @@ var RegularSequenceRefForwardingFunction = ({
4591
4670
  _remotionInternalPostmountDisplay: postmountDisplay,
4592
4671
  _remotionInternalIsMedia: isMedia,
4593
4672
  outlineRef: passedRefForOutline,
4673
+ cropLeft,
4674
+ cropRight,
4675
+ cropTop,
4676
+ cropBottom,
4594
4677
  ...other
4595
4678
  }, ref) => {
4596
4679
  const { layout = "absolute-fill" } = other;
4597
4680
  const [id] = useState5(() => String(Math.random()));
4598
4681
  const parentSequence = useContext18(SequenceContext);
4599
- const { rootId } = useTimelineContext();
4600
4682
  const cumulatedFrom = parentSequence ? parentSequence.cumulatedFrom + parentSequence.relativeFrom : 0;
4601
4683
  const nonce = useNonce();
4602
4684
  if (layout !== "absolute-fill" && layout !== "none") {
4603
4685
  throw new TypeError(`The layout prop of <Sequence /> expects either "absolute-fill" or "none", but you passed: ${layout}`);
4604
4686
  }
4687
+ const cropProps = { cropLeft, cropRight, cropTop, cropBottom };
4688
+ const hasCropProp = Object.values(cropProps).some((value) => value !== undefined);
4689
+ if (layout === "none" && hasCropProp) {
4690
+ throw new TypeError('The cropLeft, cropRight, cropTop and cropBottom props of <Sequence /> are only supported with layout="absolute-fill".');
4691
+ }
4692
+ validateSequenceCrop(cropProps);
4693
+ const {
4694
+ left: resolvedCropLeft,
4695
+ right: resolvedCropRight,
4696
+ top: resolvedCropTop,
4697
+ bottom: resolvedCropBottom
4698
+ } = resolveSequenceCrop(cropProps);
4605
4699
  if (layout === "none" && typeof other.style !== "undefined") {
4606
4700
  throw new TypeError('If layout="none", you may not pass a style. Passed: ' + JSON.stringify(other.style));
4607
4701
  }
@@ -4727,7 +4821,6 @@ var RegularSequenceRefForwardingFunction = ({
4727
4821
  parent: parentSequence?.id ?? null,
4728
4822
  postmountDisplay: postmountDisplay ?? null,
4729
4823
  premountDisplay: premountDisplay ?? null,
4730
- rootId,
4731
4824
  showInTimeline,
4732
4825
  src: isMedia.src,
4733
4826
  getStack: () => stackRef.current,
@@ -4754,7 +4847,6 @@ var RegularSequenceRefForwardingFunction = ({
4754
4847
  playbackRate: isMedia.data.playbackRate,
4755
4848
  postmountDisplay: postmountDisplay ?? null,
4756
4849
  premountDisplay: premountDisplay ?? null,
4757
- rootId,
4758
4850
  showInTimeline,
4759
4851
  src: isMedia.data.src,
4760
4852
  getStack: () => stackRef.current,
@@ -4781,7 +4873,6 @@ var RegularSequenceRefForwardingFunction = ({
4781
4873
  documentationLink: resolvedDocumentationLink,
4782
4874
  parent: parentSequence?.id ?? null,
4783
4875
  type: "sequence",
4784
- rootId,
4785
4876
  showInTimeline,
4786
4877
  nonce: nonce.get(),
4787
4878
  loopDisplay,
@@ -4807,7 +4898,6 @@ var RegularSequenceRefForwardingFunction = ({
4807
4898
  unregisterSequence,
4808
4899
  parentSequence?.id,
4809
4900
  actualDurationInFrames,
4810
- rootId,
4811
4901
  from,
4812
4902
  trimBefore,
4813
4903
  registeredTrimBefore,
@@ -4836,6 +4926,13 @@ var RegularSequenceRefForwardingFunction = ({
4836
4926
  children: content
4837
4927
  });
4838
4928
  const styleIfThere = other.layout === "none" ? undefined : other.style;
4929
+ const cropClipPath = getSequenceCropClipPath({
4930
+ left: resolvedCropLeft,
4931
+ right: resolvedCropRight,
4932
+ top: resolvedCropTop,
4933
+ bottom: resolvedCropBottom,
4934
+ borderRadius: styleIfThere?.borderRadius
4935
+ });
4839
4936
  const sequenceRef = useCallback6((node) => {
4840
4937
  wrapperRefForOutline.current = node;
4841
4938
  if (typeof ref === "function") {
@@ -4849,9 +4946,12 @@ var RegularSequenceRefForwardingFunction = ({
4849
4946
  flexDirection: undefined,
4850
4947
  ...width ? { width } : {},
4851
4948
  ...height ? { height } : {},
4852
- ...styleIfThere ?? {}
4949
+ ...styleIfThere ?? {},
4950
+ ...cropClipPath ? {
4951
+ clipPath: cropClipPath
4952
+ } : {}
4853
4953
  };
4854
- }, [height, styleIfThere, width]);
4954
+ }, [cropClipPath, height, styleIfThere, width]);
4855
4955
  if (ref !== null && layout === "none") {
4856
4956
  throw new TypeError('It is not supported to pass both a `ref` and `layout="none"` to <Sequence />.');
4857
4957
  }
@@ -4960,8 +5060,31 @@ import {
4960
5060
  useState as useState6
4961
5061
  } from "react";
4962
5062
 
5063
+ // src/use-crop-style.ts
5064
+ import { useMemo as useMemo16 } from "react";
5065
+ var useCropStyle = ({
5066
+ cropLeft,
5067
+ cropRight,
5068
+ cropTop,
5069
+ cropBottom,
5070
+ style,
5071
+ componentName
5072
+ }) => {
5073
+ validateSequenceCrop({ cropLeft, cropRight, cropTop, cropBottom }, componentName);
5074
+ return useMemo16(() => {
5075
+ const cropClipPath = getSequenceCropClipPath({
5076
+ ...resolveSequenceCrop({ cropLeft, cropRight, cropTop, cropBottom }),
5077
+ borderRadius: style?.borderRadius
5078
+ });
5079
+ if (cropClipPath === null) {
5080
+ return style;
5081
+ }
5082
+ return { ...style, clipPath: cropClipPath };
5083
+ }, [cropBottom, cropLeft, cropRight, cropTop, style]);
5084
+ };
5085
+
4963
5086
  // src/animated-image/canvas.tsx
4964
- import React16, { useCallback as useCallback7, useImperativeHandle, useMemo as useMemo17, useRef as useRef8 } from "react";
5087
+ import React16, { useCallback as useCallback7, useImperativeHandle, useMemo as useMemo18, useRef as useRef8 } from "react";
4965
5088
 
4966
5089
  // src/calculate-image-fit.ts
4967
5090
  var calculateImageFit = (fit, imageSize, canvasSize) => {
@@ -5257,7 +5380,7 @@ var runEffectChain = async ({
5257
5380
  };
5258
5381
 
5259
5382
  // src/effects/use-effect-chain-state.ts
5260
- import { useEffect as useEffect4, useMemo as useMemo16, useRef as useRef7 } from "react";
5383
+ import { useEffect as useEffect4, useMemo as useMemo17, useRef as useRef7 } from "react";
5261
5384
  var useEffectChainState = () => {
5262
5385
  const chainStateRef = useRef7(null);
5263
5386
  const sizeRef = useRef7(null);
@@ -5268,7 +5391,7 @@ var useEffectChainState = () => {
5268
5391
  }
5269
5392
  };
5270
5393
  }, []);
5271
- return useMemo16(() => ({
5394
+ return useMemo17(() => ({
5272
5395
  get: (width, height) => {
5273
5396
  if (!sizeRef.current || sizeRef.current.width !== width || sizeRef.current.height !== height) {
5274
5397
  if (chainStateRef.current) {
@@ -5287,7 +5410,7 @@ import { jsx as jsx13 } from "react/jsx-runtime";
5287
5410
  var CanvasRefForwardingFunction = ({ width, height, fit, className, style, effects, ...props }, ref) => {
5288
5411
  const canvasRef = useRef8(null);
5289
5412
  const chainState = useEffectChainState();
5290
- const sourceCanvas = useMemo17(() => {
5413
+ const sourceCanvas = useMemo18(() => {
5291
5414
  if (typeof document === "undefined") {
5292
5415
  return null;
5293
5416
  }
@@ -5562,6 +5685,7 @@ var animatedImageSchema = {
5562
5685
  keyframable: false
5563
5686
  },
5564
5687
  ...baseSchema,
5688
+ ...cropSchema,
5565
5689
  ...premountSchema,
5566
5690
  playbackRate: {
5567
5691
  type: "number",
@@ -5756,6 +5880,10 @@ var AnimatedImageInner = ({
5756
5880
  postmountFor,
5757
5881
  styleWhilePremounted,
5758
5882
  styleWhilePostmounted,
5883
+ cropLeft,
5884
+ cropRight,
5885
+ cropTop,
5886
+ cropBottom,
5759
5887
  requestInit,
5760
5888
  effects = [],
5761
5889
  controls,
@@ -5785,6 +5913,14 @@ var AnimatedImageInner = ({
5785
5913
  styleWhilePostmounted: styleWhilePostmounted ?? null,
5786
5914
  hideWhilePremounted: "display-none"
5787
5915
  });
5916
+ const croppedStyle = useCropStyle({
5917
+ cropLeft,
5918
+ cropRight,
5919
+ cropTop,
5920
+ cropBottom,
5921
+ style: premountingStyle,
5922
+ componentName: "<AnimatedImage />"
5923
+ });
5788
5924
  const canvasProps = getCanvasPropsFromSequenceProps(sequenceProps);
5789
5925
  const animatedImageProps = {
5790
5926
  src,
@@ -5796,7 +5932,7 @@ var AnimatedImageInner = ({
5796
5932
  loopBehavior,
5797
5933
  id,
5798
5934
  className,
5799
- style: premountingStyle ?? undefined,
5935
+ style: croppedStyle ?? undefined,
5800
5936
  requestInit,
5801
5937
  ...canvasProps
5802
5938
  };
@@ -5875,7 +6011,7 @@ import {
5875
6011
  useCallback as useCallback8,
5876
6012
  useImperativeHandle as useImperativeHandle3,
5877
6013
  useLayoutEffect as useLayoutEffect3,
5878
- useMemo as useMemo18,
6014
+ useMemo as useMemo19,
5879
6015
  useRef as useRef10,
5880
6016
  useState as useState7
5881
6017
  } from "react";
@@ -5956,7 +6092,7 @@ var RenderAssetManagerProvider = ({ children, collectAssets }) => {
5956
6092
  };
5957
6093
  }
5958
6094
  }, []);
5959
- const contextValue = useMemo18(() => {
6095
+ const contextValue = useMemo19(() => {
5960
6096
  return {
5961
6097
  registerRenderAsset,
5962
6098
  unregisterRenderAsset,
@@ -6061,7 +6197,7 @@ var calculateMediaDuration = ({
6061
6197
  };
6062
6198
 
6063
6199
  // src/loop/index.tsx
6064
- import React17, { createContext as createContext18, useMemo as useMemo19 } from "react";
6200
+ import React17, { createContext as createContext18, useMemo as useMemo20 } from "react";
6065
6201
  import { jsx as jsx16 } from "react/jsx-runtime";
6066
6202
  var LoopContext = createContext18(null);
6067
6203
  var useLoop = () => {
@@ -6097,14 +6233,14 @@ var Loop = ({
6097
6233
  const iteration = Math.floor(currentFrame / durationInFrames);
6098
6234
  const start = iteration * durationInFrames;
6099
6235
  const from = Math.min(start, maxFrame);
6100
- const loopDisplay = useMemo19(() => {
6236
+ const loopDisplay = useMemo20(() => {
6101
6237
  return {
6102
6238
  numberOfTimes: Math.min(compDuration / durationInFrames, times),
6103
6239
  startOffset: -from,
6104
6240
  durationInFrames
6105
6241
  };
6106
6242
  }, [compDuration, durationInFrames, from, times]);
6107
- const loopContext = useMemo19(() => {
6243
+ const loopContext = useMemo20(() => {
6108
6244
  return {
6109
6245
  iteration: Math.floor(currentFrame / durationInFrames),
6110
6246
  durationInFrames
@@ -6469,7 +6605,7 @@ var resolveTrimProps = ({
6469
6605
  };
6470
6606
 
6471
6607
  // src/video/duration-state.tsx
6472
- import { createContext as createContext20, useMemo as useMemo20, useReducer } from "react";
6608
+ import { createContext as createContext20, useMemo as useMemo21, useReducer } from "react";
6473
6609
  import { jsx as jsx18 } from "react/jsx-runtime";
6474
6610
  var durationReducer = (state, action) => {
6475
6611
  switch (action.type) {
@@ -6495,7 +6631,7 @@ var DurationsContext = createContext20({
6495
6631
  });
6496
6632
  var DurationsContextProvider = ({ children }) => {
6497
6633
  const [durations, setDurations] = useReducer(durationReducer, {});
6498
- const value = useMemo20(() => {
6634
+ const value = useMemo21(() => {
6499
6635
  return {
6500
6636
  durations,
6501
6637
  setDurations
@@ -6514,7 +6650,7 @@ import React23, {
6514
6650
  useContext as useContext29,
6515
6651
  useEffect as useEffect14,
6516
6652
  useImperativeHandle as useImperativeHandle4,
6517
- useMemo as useMemo28,
6653
+ useMemo as useMemo29,
6518
6654
  useRef as useRef19,
6519
6655
  useState as useState14
6520
6656
  } from "react";
@@ -6537,6 +6673,40 @@ var getCrossOriginValue = ({
6537
6673
  return;
6538
6674
  };
6539
6675
 
6676
+ // src/random.ts
6677
+ function mulberry32(a2) {
6678
+ let t = a2 + 1831565813;
6679
+ t = Math.imul(t ^ t >>> 15, t | 1);
6680
+ t ^= t + Math.imul(t ^ t >>> 7, t | 61);
6681
+ return ((t ^ t >>> 14) >>> 0) / 4294967296;
6682
+ }
6683
+ function hashCode(str) {
6684
+ let i = 0;
6685
+ let chr = 0;
6686
+ let hash = 0;
6687
+ for (i = 0;i < str.length; i++) {
6688
+ chr = str.charCodeAt(i);
6689
+ hash = (hash << 5) - hash + chr;
6690
+ hash |= 0;
6691
+ }
6692
+ return hash;
6693
+ }
6694
+ var random = (seed, dummy) => {
6695
+ if (dummy !== undefined) {
6696
+ throw new TypeError("random() takes only one argument");
6697
+ }
6698
+ if (seed === null) {
6699
+ return Math.random();
6700
+ }
6701
+ if (typeof seed === "string") {
6702
+ return mulberry32(hashCode(seed));
6703
+ }
6704
+ if (typeof seed === "number") {
6705
+ return mulberry32(seed * 10000000000);
6706
+ }
6707
+ throw new Error("random() argument must be a number or a string");
6708
+ };
6709
+
6540
6710
  // src/use-amplification.ts
6541
6711
  import { useContext as useContext22, useLayoutEffect as useLayoutEffect5, useRef as useRef14 } from "react";
6542
6712
 
@@ -6547,7 +6717,7 @@ import React20, {
6547
6717
  useCallback as useCallback9,
6548
6718
  useContext as useContext21,
6549
6719
  useEffect as useEffect7,
6550
- useMemo as useMemo22,
6720
+ useMemo as useMemo23,
6551
6721
  useRef as useRef12,
6552
6722
  useState as useState10
6553
6723
  } from "react";
@@ -6652,7 +6822,7 @@ var makeSharedElementSourceNode = ({
6652
6822
  };
6653
6823
 
6654
6824
  // src/audio/use-audio-context.ts
6655
- import { useMemo as useMemo21, useRef as useRef11 } from "react";
6825
+ import { useMemo as useMemo22, useRef as useRef11 } from "react";
6656
6826
  var warned = false;
6657
6827
  var warnOnce = (logLevel) => {
6658
6828
  if (warned) {
@@ -6674,7 +6844,7 @@ var useSingletonAudioContext = ({
6674
6844
  if (sampleRate !== initialSampleRate.current) {
6675
6845
  throw new Error(`Changing the AudioContext sample rate dynamically is not supported. The sample rate was initialized with ${initialSampleRate.current} Hz, but ${sampleRate} Hz was passed later.`);
6676
6846
  }
6677
- const context = useMemo21(() => {
6847
+ const context = useMemo22(() => {
6678
6848
  if (env.isRendering) {
6679
6849
  return null;
6680
6850
  }
@@ -6813,9 +6983,9 @@ var SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled, pr
6813
6983
  });
6814
6984
  const audioContextIsPlayingEventually = useRef12(false);
6815
6985
  const isResuming = useRef12(null);
6816
- const audioSyncAnchor = useMemo22(() => ({ value: 0 }), []);
6986
+ const audioSyncAnchor = useMemo23(() => ({ value: 0 }), []);
6817
6987
  const audioSyncAnchorListeners = useRef12([]);
6818
- const audioSyncAnchorEmitter = useMemo22(() => {
6988
+ const audioSyncAnchorEmitter = useMemo23(() => {
6819
6989
  return {
6820
6990
  dispatch: (event) => {
6821
6991
  audioSyncAnchorListeners.current.forEach((l) => l(event));
@@ -6835,7 +7005,7 @@ var SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled, pr
6835
7005
  const unscheduleAudioNode = useCallback9((node) => {
6836
7006
  nodesToResume.current.delete(node);
6837
7007
  }, []);
6838
- const scheduleAudioNode = useMemo22(() => {
7008
+ const scheduleAudioNode = useMemo23(() => {
6839
7009
  return ({
6840
7010
  node,
6841
7011
  mediaTimestamp,
@@ -6927,7 +7097,7 @@ var SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled, pr
6927
7097
  audioContextIsPlayingEventually.current = false;
6928
7098
  return ctxAndGain.suspend();
6929
7099
  }, [ctxAndGain]);
6930
- const audioContextValue = useMemo22(() => {
7100
+ const audioContextValue = useMemo23(() => {
6931
7101
  return {
6932
7102
  audioContext: ctxAndGain?.audioContext ?? null,
6933
7103
  getAudioContextState: () => ctxAndGain?.getState() ?? null,
@@ -7109,7 +7279,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
7109
7279
  });
7110
7280
  resume?.();
7111
7281
  }, [logLevel, mountTime, refs, env.isPlayer, resume]);
7112
- const audioTagsValue = useMemo22(() => {
7282
+ const audioTagsValue = useMemo23(() => {
7113
7283
  return {
7114
7284
  registerAudio,
7115
7285
  unregisterAudio,
@@ -7124,7 +7294,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
7124
7294
  unregisterAudio,
7125
7295
  updateAudio
7126
7296
  ]);
7127
- const sharedAudioTagElements = useMemo22(() => {
7297
+ const sharedAudioTagElements = useMemo23(() => {
7128
7298
  return refs.map(({ id, ref }) => {
7129
7299
  return /* @__PURE__ */ jsx19("audio", {
7130
7300
  ref,
@@ -7401,7 +7571,7 @@ var useVolume = ({
7401
7571
  };
7402
7572
 
7403
7573
  // src/use-media-in-timeline.ts
7404
- import { useContext as useContext24, useEffect as useEffect8, useMemo as useMemo23, useState as useState11 } from "react";
7574
+ import { useContext as useContext24, useEffect as useEffect8, useMemo as useMemo24, useState as useState11 } from "react";
7405
7575
 
7406
7576
  // src/audio/use-audio-frame.ts
7407
7577
  import { useContext as useContext23 } from "react";
@@ -7513,7 +7683,7 @@ var useBasicMediaInTimeline = ({
7513
7683
  parentSequenceDurationInFrames: parentSequence?.durationInFrames ?? null,
7514
7684
  loop
7515
7685
  });
7516
- const volumes = useMemo23(() => {
7686
+ const volumes = useMemo24(() => {
7517
7687
  if (typeof volume === "number") {
7518
7688
  return volume;
7519
7689
  }
@@ -7532,15 +7702,13 @@ var useBasicMediaInTimeline = ({
7532
7702
  }, [initialVolume, mediaType, src, volume]);
7533
7703
  const doesVolumeChange = typeof volume === "function";
7534
7704
  const nonce = useNonce();
7535
- const { rootId } = useTimelineContext();
7536
7705
  const startMediaFrom = 0 - mediaStartsAt + (trimBefore ?? 0);
7537
- const memoizedResult = useMemo23(() => {
7706
+ const memoizedResult = useMemo24(() => {
7538
7707
  return {
7539
7708
  volumes,
7540
7709
  duration,
7541
7710
  doesVolumeChange,
7542
7711
  nonce,
7543
- rootId,
7544
7712
  finalDisplayName: displayName ?? getAssetDisplayName(src),
7545
7713
  startMediaFrom,
7546
7714
  src,
@@ -7551,7 +7719,6 @@ var useBasicMediaInTimeline = ({
7551
7719
  duration,
7552
7720
  doesVolumeChange,
7553
7721
  nonce,
7554
- rootId,
7555
7722
  displayName,
7556
7723
  src,
7557
7724
  startMediaFrom,
@@ -7580,7 +7747,7 @@ var useMediaInTimeline = ({
7580
7747
  const { registerSequence, unregisterSequence } = useContext24(SequenceManager);
7581
7748
  const { durationInFrames } = useVideoConfig();
7582
7749
  const mediaStartsAt = useMediaStartsAt();
7583
- const { volumes, duration, doesVolumeChange, nonce, rootId, finalDisplayName } = useBasicMediaInTimeline({
7750
+ const { volumes, duration, doesVolumeChange, nonce, finalDisplayName } = useBasicMediaInTimeline({
7584
7751
  volume,
7585
7752
  mediaVolume,
7586
7753
  mediaType,
@@ -7614,7 +7781,6 @@ var useMediaInTimeline = ({
7614
7781
  parent: parentSequence?.id ?? null,
7615
7782
  displayName: finalDisplayName,
7616
7783
  documentationLink,
7617
- rootId,
7618
7784
  volume: volumes,
7619
7785
  showInTimeline: true,
7620
7786
  nonce: nonce.get(),
@@ -7655,7 +7821,6 @@ var useMediaInTimeline = ({
7655
7821
  postmountDisplay,
7656
7822
  loopDisplay,
7657
7823
  documentationLink,
7658
- rootId,
7659
7824
  finalDisplayName,
7660
7825
  isStudio,
7661
7826
  refForOutline
@@ -7672,10 +7837,10 @@ import {
7672
7837
  } from "react";
7673
7838
 
7674
7839
  // src/buffer-until-first-frame.ts
7675
- import { useCallback as useCallback11, useMemo as useMemo26, useRef as useRef16 } from "react";
7840
+ import { useCallback as useCallback11, useMemo as useMemo27, useRef as useRef16 } from "react";
7676
7841
 
7677
7842
  // src/use-buffer-state.ts
7678
- import { useContext as useContext26, useMemo as useMemo25 } from "react";
7843
+ import { useContext as useContext26, useMemo as useMemo26 } from "react";
7679
7844
 
7680
7845
  // src/buffering.tsx
7681
7846
  import React21, {
@@ -7683,7 +7848,7 @@ import React21, {
7683
7848
  useContext as useContext25,
7684
7849
  useEffect as useEffect9,
7685
7850
  useLayoutEffect as useLayoutEffect6,
7686
- useMemo as useMemo24,
7851
+ useMemo as useMemo25,
7687
7852
  useRef as useRef15,
7688
7853
  useState as useState12
7689
7854
  } from "react";
@@ -7769,7 +7934,7 @@ var useBufferManager = (logLevel, mountTime) => {
7769
7934
  }
7770
7935
  }, [blocks]);
7771
7936
  }
7772
- return useMemo24(() => {
7937
+ return useMemo25(() => {
7773
7938
  return { addBlock, listenForBuffering, listenForResume, buffering };
7774
7939
  }, [addBlock, buffering, listenForBuffering, listenForResume]);
7775
7940
  };
@@ -7806,7 +7971,7 @@ var useBufferState = () => {
7806
7971
  const buffer = useContext26(BufferingContextReact);
7807
7972
  const logLevel = useLogLevel();
7808
7973
  const addBlock = buffer ? buffer.addBlock : null;
7809
- return useMemo25(() => ({
7974
+ return useMemo26(() => ({
7810
7975
  delayPlayback: () => {
7811
7976
  if (!addBlock) {
7812
7977
  throw new Error("Tried to enable the buffering state, but a Remotion context was not found. This API can only be called in a component that was passed to the Remotion Player or a <Composition>. Or you might have experienced a version mismatch - run `npx remotion versions` and ensure all packages have the same version. This error is thrown by the buffer state https://remotion.dev/docs/player/buffer-state");
@@ -7916,7 +8081,7 @@ var useBufferUntilFirstFrame = ({
7916
8081
  onVariableFpsVideoDetected,
7917
8082
  pauseWhenBuffering
7918
8083
  ]);
7919
- return useMemo26(() => {
8084
+ return useMemo27(() => {
7920
8085
  return {
7921
8086
  isBuffering: () => bufferingRef.current,
7922
8087
  bufferUntilFirstFrame
@@ -8596,7 +8761,7 @@ var useMediaTag = ({
8596
8761
  };
8597
8762
 
8598
8763
  // src/volume-position-state.ts
8599
- import { createContext as createContext22, useContext as useContext28, useMemo as useMemo27 } from "react";
8764
+ import { createContext as createContext22, useContext as useContext28, useMemo as useMemo28 } from "react";
8600
8765
  var MediaVolumeContext = createContext22({
8601
8766
  playerMuted: false,
8602
8767
  mediaVolume: 1
@@ -8612,14 +8777,14 @@ var SetMediaVolumeContext = createContext22({
8612
8777
  var useMediaVolumeState = () => {
8613
8778
  const { mediaVolume } = useContext28(MediaVolumeContext);
8614
8779
  const { setMediaVolume } = useContext28(SetMediaVolumeContext);
8615
- return useMemo27(() => {
8780
+ return useMemo28(() => {
8616
8781
  return [mediaVolume, setMediaVolume];
8617
8782
  }, [mediaVolume, setMediaVolume]);
8618
8783
  };
8619
8784
  var usePlayerMutedState = () => {
8620
8785
  const { playerMuted } = useContext28(MediaVolumeContext);
8621
8786
  const { setPlayerMuted } = useContext28(SetMediaVolumeContext);
8622
- return useMemo27(() => {
8787
+ return useMemo28(() => {
8623
8788
  return [playerMuted, setPlayerMuted];
8624
8789
  }, [playerMuted, setPlayerMuted]);
8625
8790
  };
@@ -8691,7 +8856,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
8691
8856
  requestsVideoFrame: false,
8692
8857
  isClientSideRendering: false
8693
8858
  });
8694
- const propsToPass = useMemo28(() => {
8859
+ const propsToPass = useMemo29(() => {
8695
8860
  return {
8696
8861
  muted: muted || playerMuted || userPreferredVolume <= 0,
8697
8862
  src: preloadedSrc,
@@ -8708,7 +8873,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
8708
8873
  userPreferredVolume,
8709
8874
  crossOriginValue
8710
8875
  ]);
8711
- const id = useMemo28(() => `audio-${random(src ?? "")}-${sequenceContext?.relativeFrom}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.durationInFrames}-muted:${props.muted}-loop:${props.loop}`, [
8876
+ const id = useMemo29(() => `audio-${random(src ?? "")}-${sequenceContext?.relativeFrom}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.durationInFrames}-muted:${props.muted}-loop:${props.loop}`, [
8712
8877
  src,
8713
8878
  sequenceContext?.relativeFrom,
8714
8879
  sequenceContext?.cumulatedFrom,
@@ -8822,7 +8987,7 @@ import {
8822
8987
  useEffect as useEffect15,
8823
8988
  useImperativeHandle as useImperativeHandle5,
8824
8989
  useLayoutEffect as useLayoutEffect8,
8825
- useMemo as useMemo29,
8990
+ useMemo as useMemo30,
8826
8991
  useRef as useRef20
8827
8992
  } from "react";
8828
8993
  import { jsx as jsx22 } from "react/jsx-runtime";
@@ -8853,7 +9018,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
8853
9018
  const sequenceContext = useContext30(SequenceContext);
8854
9019
  const { registerRenderAsset, unregisterRenderAsset } = useContext30(RenderAssetManager);
8855
9020
  const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
8856
- const id = useMemo29(() => `audio-${random(props.src ?? "")}-${sequenceContext?.relativeFrom}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.durationInFrames}`, [
9021
+ const id = useMemo30(() => `audio-${random(props.src ?? "")}-${sequenceContext?.relativeFrom}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.durationInFrames}`, [
8857
9022
  props.src,
8858
9023
  sequenceContext?.relativeFrom,
8859
9024
  sequenceContext?.cumulatedFrom,
@@ -9093,7 +9258,7 @@ import {
9093
9258
  useCallback as useCallback15,
9094
9259
  useEffect as useEffect16,
9095
9260
  useImperativeHandle as useImperativeHandle6,
9096
- useMemo as useMemo30,
9261
+ useMemo as useMemo31,
9097
9262
  useRef as useRef21,
9098
9263
  useState as useState15
9099
9264
  } from "react";
@@ -9141,7 +9306,8 @@ var solidSchema = {
9141
9306
  },
9142
9307
  ...transformSchema,
9143
9308
  ...backgroundSchema,
9144
- ...borderSchema
9309
+ ...borderSchema,
9310
+ ...cropSchema
9145
9311
  };
9146
9312
  var SolidInner = ({
9147
9313
  color,
@@ -9163,7 +9329,7 @@ var SolidInner = ({
9163
9329
  effects,
9164
9330
  overrideId: overrideId ?? null
9165
9331
  });
9166
- const sourceCanvas = useMemo30(() => {
9332
+ const sourceCanvas = useMemo31(() => {
9167
9333
  if (typeof document === "undefined") {
9168
9334
  return null;
9169
9335
  }
@@ -9231,7 +9397,7 @@ var SolidInner = ({
9231
9397
  cancelRender2,
9232
9398
  memoizedEffects
9233
9399
  ]);
9234
- const canvasStyle = useMemo30(() => {
9400
+ const canvasStyle = useMemo31(() => {
9235
9401
  return {
9236
9402
  width,
9237
9403
  height,
@@ -9262,6 +9428,10 @@ var SolidOuter = forwardRef8(({
9262
9428
  hidden,
9263
9429
  showInTimeline,
9264
9430
  pixelDensity,
9431
+ cropLeft,
9432
+ cropRight,
9433
+ cropTop,
9434
+ cropBottom,
9265
9435
  ...props2
9266
9436
  }, ref) => {
9267
9437
  const memoizedEffectDefinitions = useMemoizedEffectDefinitions(effects);
@@ -9269,6 +9439,14 @@ var SolidOuter = forwardRef8(({
9269
9439
  useImperativeHandle6(ref, () => {
9270
9440
  return actualRef.current;
9271
9441
  }, []);
9442
+ const croppedStyle = useCropStyle({
9443
+ cropLeft,
9444
+ cropRight,
9445
+ cropTop,
9446
+ cropBottom,
9447
+ style: style ?? null,
9448
+ componentName: "<Solid />"
9449
+ });
9272
9450
  return /* @__PURE__ */ jsx24(Sequence, {
9273
9451
  layout: "none",
9274
9452
  from,
@@ -9290,7 +9468,7 @@ var SolidOuter = forwardRef8(({
9290
9468
  height,
9291
9469
  width,
9292
9470
  className,
9293
- style,
9471
+ style: croppedStyle ?? undefined,
9294
9472
  effects,
9295
9473
  pixelDensity
9296
9474
  })
@@ -9312,7 +9490,7 @@ import {
9312
9490
  useCallback as useCallback16,
9313
9491
  useContext as useContext32,
9314
9492
  useLayoutEffect as useLayoutEffect9,
9315
- useMemo as useMemo31,
9493
+ useMemo as useMemo32,
9316
9494
  useRef as useRef22
9317
9495
  } from "react";
9318
9496
  import { jsx as jsx25 } from "react/jsx-runtime";
@@ -9330,6 +9508,17 @@ var isHtmlInCanvasSupported = () => {
9330
9508
  return cachedSupport;
9331
9509
  };
9332
9510
  var HTML_IN_CANVAS_UNSUPPORTED_MESSAGE = "HTML in Canvas is not supported. Two common causes: Chrome is older than version 148 (update Chrome), or the HTML-in-Canvas flag is disabled at chrome://flags/#canvas-draw-element (enable it and restart Chrome).";
9511
+ var MINIMUM_CHROME_VERSION_FOR_NESTED_HTML_IN_CANVAS = 152;
9512
+ var getChromeMajorVersion = () => {
9513
+ if (typeof navigator === "undefined") {
9514
+ return null;
9515
+ }
9516
+ const match = navigator.userAgent.match(/\b(?:HeadlessChrome|Chrome)\/(\d+)/);
9517
+ if (!match) {
9518
+ return null;
9519
+ }
9520
+ return Number(match[1]);
9521
+ };
9333
9522
  function assertHtmlInCanvasDimensions(width, height) {
9334
9523
  if (typeof width !== "number" || typeof height !== "number") {
9335
9524
  throw new Error(`HtmlInCanvas: \`width\` and \`height\` must be numbers. Received width=${String(width)}, height=${String(height)}.`);
@@ -9393,6 +9582,10 @@ var HtmlInCanvasContent = forwardRef9(({
9393
9582
  }, ref) => {
9394
9583
  const ancestor = useContext32(HtmlInCanvasAncestorContext);
9395
9584
  assertHtmlInCanvasDimensions(width, height);
9585
+ const chromeMajorVersion = getChromeMajorVersion();
9586
+ if (ancestor && chromeMajorVersion !== null && chromeMajorVersion < MINIMUM_CHROME_VERSION_FOR_NESTED_HTML_IN_CANVAS) {
9587
+ throw new Error(`Nested <HtmlInCanvas> components require Chrome ${MINIMUM_CHROME_VERSION_FOR_NESTED_HTML_IN_CANVAS} or newer, but the current browser is Chrome ${chromeMajorVersion}. Upgrade Chrome or avoid nesting components that use <HtmlInCanvas>, such as shapes with effects.`);
9588
+ }
9396
9589
  const resolvedPixelDensity = resolveHtmlInCanvasPixelDensity(pixelDensity);
9397
9590
  const canvasWidth = Math.ceil(width * resolvedPixelDensity);
9398
9591
  const canvasHeight = Math.ceil(height * resolvedPixelDensity);
@@ -9611,20 +9804,20 @@ var HtmlInCanvasContent = forwardRef9(({
9611
9804
  continueRender2(handle);
9612
9805
  };
9613
9806
  }, [width, height, continueRender2, delayRender2, canvasSizeKey]);
9614
- const innerStyle = useMemo31(() => {
9807
+ const innerStyle = useMemo32(() => {
9615
9808
  return {
9616
9809
  width,
9617
9810
  height
9618
9811
  };
9619
9812
  }, [width, height]);
9620
- const canvasStyle = useMemo31(() => {
9813
+ const canvasStyle = useMemo32(() => {
9621
9814
  return {
9622
9815
  width,
9623
9816
  height,
9624
9817
  ...style ?? {}
9625
9818
  };
9626
9819
  }, [height, style, width]);
9627
- const ancestorValue = useMemo31(() => {
9820
+ const ancestorValue = useMemo32(() => {
9628
9821
  return {
9629
9822
  requestParentPaint: () => {
9630
9823
  canvas2dRef.current?.requestPaint?.();
@@ -9657,6 +9850,10 @@ var HtmlInCanvasInner = forwardRef9(({
9657
9850
  pixelDensity,
9658
9851
  controls,
9659
9852
  style,
9853
+ cropLeft,
9854
+ cropRight,
9855
+ cropTop,
9856
+ cropBottom,
9660
9857
  durationInFrames,
9661
9858
  name,
9662
9859
  ...sequenceProps
@@ -9671,6 +9868,14 @@ var HtmlInCanvasInner = forwardRef9(({
9671
9868
  ref.current = node;
9672
9869
  }
9673
9870
  }, [ref]);
9871
+ const croppedStyle = useCropStyle({
9872
+ cropLeft,
9873
+ cropRight,
9874
+ cropTop,
9875
+ cropBottom,
9876
+ style: style ?? null,
9877
+ componentName: "<HtmlInCanvas />"
9878
+ });
9674
9879
  return /* @__PURE__ */ jsx25(Sequence, {
9675
9880
  durationInFrames,
9676
9881
  name: name ?? "<HtmlInCanvas>",
@@ -9689,7 +9894,7 @@ var HtmlInCanvasInner = forwardRef9(({
9689
9894
  onInit,
9690
9895
  pixelDensity,
9691
9896
  controls,
9692
- style,
9897
+ style: croppedStyle ?? undefined,
9693
9898
  children
9694
9899
  })
9695
9900
  });
@@ -9708,7 +9913,8 @@ var htmlInCanvasSchema = {
9708
9913
  },
9709
9914
  ...transformSchema,
9710
9915
  ...backgroundSchema,
9711
- ...borderSchema
9916
+ ...borderSchema,
9917
+ ...cropSchema
9712
9918
  };
9713
9919
  var HtmlInCanvasWrapped = withInteractivitySchema({
9714
9920
  Component: HtmlInCanvasInner,
@@ -9729,7 +9935,7 @@ import {
9729
9935
  useContext as useContext33,
9730
9936
  useImperativeHandle as useImperativeHandle7,
9731
9937
  useLayoutEffect as useLayoutEffect10,
9732
- useMemo as useMemo32,
9938
+ useMemo as useMemo33,
9733
9939
  useRef as useRef23,
9734
9940
  useState as useState16
9735
9941
  } from "react";
@@ -9746,6 +9952,7 @@ function truncateSrcForLabel(src) {
9746
9952
  import { jsx as jsx26 } from "react/jsx-runtime";
9747
9953
  var canvasImageSchema = {
9748
9954
  ...baseSchema,
9955
+ ...cropSchema,
9749
9956
  ...premountSchema,
9750
9957
  fit: {
9751
9958
  type: "enum",
@@ -9876,7 +10083,7 @@ var CanvasImageContent = forwardRef10(({
9876
10083
  continueRender2(pending.handle);
9877
10084
  pendingLoadDelayRef.current = null;
9878
10085
  }, [continueRender2]);
9879
- const sourceCanvas = useMemo32(() => {
10086
+ const sourceCanvas = useMemo33(() => {
9880
10087
  if (typeof document === "undefined") {
9881
10088
  return null;
9882
10089
  }
@@ -10090,9 +10297,14 @@ var CanvasImageInner = forwardRef10(({
10090
10297
  hidden,
10091
10298
  name,
10092
10299
  showInTimeline,
10300
+ cropLeft,
10301
+ cropRight,
10302
+ cropTop,
10303
+ cropBottom,
10093
10304
  stack,
10094
10305
  controls,
10095
10306
  _remotionInternalDocumentationLink,
10307
+ _remotionInternalCropComponentName,
10096
10308
  outlineRef,
10097
10309
  ...canvasProps
10098
10310
  }, ref) => {
@@ -10122,6 +10334,14 @@ var CanvasImageInner = forwardRef10(({
10122
10334
  styleWhilePostmounted: styleWhilePostmounted ?? null,
10123
10335
  hideWhilePremounted: "display-none"
10124
10336
  });
10337
+ const croppedStyle = useCropStyle({
10338
+ cropLeft,
10339
+ cropRight,
10340
+ cropTop,
10341
+ cropBottom,
10342
+ style: premountingStyle,
10343
+ componentName: _remotionInternalCropComponentName ?? "<CanvasImage />"
10344
+ });
10125
10345
  return /* @__PURE__ */ jsx26(Freeze, {
10126
10346
  frame: freezeFrame,
10127
10347
  active: isPremountingOrPostmounting,
@@ -10153,7 +10373,7 @@ var CanvasImageInner = forwardRef10(({
10153
10373
  effects,
10154
10374
  controls,
10155
10375
  className,
10156
- style: premountingStyle ?? undefined,
10376
+ style: croppedStyle ?? undefined,
10157
10377
  id,
10158
10378
  onError,
10159
10379
  pauseWhenLoading,
@@ -10427,6 +10647,10 @@ var NativeImgInner = ({
10427
10647
  style,
10428
10648
  styleWhilePremounted,
10429
10649
  styleWhilePostmounted,
10650
+ cropLeft,
10651
+ cropRight,
10652
+ cropTop,
10653
+ cropBottom,
10430
10654
  controls,
10431
10655
  outlineRef: refForOutline,
10432
10656
  ...props2
@@ -10452,6 +10676,14 @@ var NativeImgInner = ({
10452
10676
  styleWhilePostmounted: styleWhilePostmounted ?? null,
10453
10677
  hideWhilePremounted: "display-none"
10454
10678
  });
10679
+ const croppedStyle = useCropStyle({
10680
+ cropLeft,
10681
+ cropRight,
10682
+ cropTop,
10683
+ cropBottom,
10684
+ style: premountingStyle,
10685
+ componentName: "<Img />"
10686
+ });
10455
10687
  return /* @__PURE__ */ jsx28(Freeze, {
10456
10688
  frame: freezeFrame,
10457
10689
  active: isPremountingOrPostmounting,
@@ -10476,7 +10708,7 @@ var NativeImgInner = ({
10476
10708
  children: /* @__PURE__ */ jsx28(ImgContent, {
10477
10709
  src,
10478
10710
  refForOutline,
10479
- style: premountingStyle ?? undefined,
10711
+ style: croppedStyle ?? undefined,
10480
10712
  ...props2
10481
10713
  })
10482
10714
  })
@@ -10491,6 +10723,7 @@ var imgSchema = {
10491
10723
  keyframable: false
10492
10724
  },
10493
10725
  ...baseSchema,
10726
+ ...cropSchema,
10494
10727
  ...premountSchema,
10495
10728
  ...transformSchema,
10496
10729
  ...backgroundSchema,
@@ -10559,6 +10792,10 @@ var ImgInner = ({
10559
10792
  height,
10560
10793
  className,
10561
10794
  style,
10795
+ cropLeft,
10796
+ cropRight,
10797
+ cropTop,
10798
+ cropBottom,
10562
10799
  id,
10563
10800
  pauseWhenLoading,
10564
10801
  maxRetries,
@@ -10590,6 +10827,10 @@ var ImgInner = ({
10590
10827
  height,
10591
10828
  className,
10592
10829
  style,
10830
+ cropLeft,
10831
+ cropRight,
10832
+ cropTop,
10833
+ cropBottom,
10593
10834
  id,
10594
10835
  pauseWhenLoading: shouldPauseWhenLoading,
10595
10836
  maxRetries,
@@ -10619,6 +10860,10 @@ var ImgInner = ({
10619
10860
  effects,
10620
10861
  className,
10621
10862
  style,
10863
+ cropLeft,
10864
+ cropRight,
10865
+ cropTop,
10866
+ cropBottom,
10622
10867
  id,
10623
10868
  pauseWhenLoading: shouldPauseWhenLoading,
10624
10869
  maxRetries,
@@ -10637,6 +10882,7 @@ var ImgInner = ({
10637
10882
  showInTimeline,
10638
10883
  stack,
10639
10884
  _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/img",
10885
+ _remotionInternalCropComponentName: "<Img />",
10640
10886
  controls,
10641
10887
  outlineRef: refForOutline,
10642
10888
  ...canvasProps
@@ -10688,9 +10934,22 @@ var interactiveTextElementSchema = {
10688
10934
  };
10689
10935
  var interactiveSvgTextElementSchema = {
10690
10936
  ...interactiveElementSchema,
10937
+ ...svgPaintSchema,
10691
10938
  ...textSchema,
10692
10939
  ...textContentSchema
10693
10940
  };
10941
+ var interactiveSvgElementSchema = {
10942
+ ...interactiveElementSchema,
10943
+ ...svgPaintSchema
10944
+ };
10945
+ var interactiveSvgStrokeElementSchema = {
10946
+ ...interactiveElementSchema,
10947
+ ...svgStrokeSchema
10948
+ };
10949
+ var interactiveSvgRootElementSchema = {
10950
+ ...interactiveBorderElementSchema,
10951
+ ...svgPaintSchema
10952
+ };
10694
10953
  var setRef = (ref, value) => {
10695
10954
  if (typeof ref === "function") {
10696
10955
  ref(value);
@@ -10758,8 +11017,11 @@ var makeInteractiveElement = (tag, displayName, schema) => {
10758
11017
  var makeInteractiveTextElement = (tag, displayName) => {
10759
11018
  return makeInteractiveElement(tag, displayName, interactiveTextElementSchema);
10760
11019
  };
10761
- var makeInteractiveNonTextElement = (tag, displayName) => {
10762
- return makeInteractiveElement(tag, displayName, interactiveElementSchema);
11020
+ var makeInteractiveSvgElement = (tag, displayName) => {
11021
+ return makeInteractiveElement(tag, displayName, interactiveSvgElementSchema);
11022
+ };
11023
+ var makeInteractiveSvgStrokeElement = (tag, displayName) => {
11024
+ return makeInteractiveElement(tag, displayName, interactiveSvgStrokeElementSchema);
10763
11025
  };
10764
11026
  var Interactive = {
10765
11027
  baseSchema,
@@ -10767,6 +11029,9 @@ var Interactive = {
10767
11029
  textSchema,
10768
11030
  backgroundSchema,
10769
11031
  borderSchema,
11032
+ cropSchema,
11033
+ svgPaintSchema,
11034
+ svgStrokeSchema,
10770
11035
  premountSchema,
10771
11036
  sequenceSchema,
10772
11037
  withSchema,
@@ -10775,13 +11040,13 @@ var Interactive = {
10775
11040
  Article: makeInteractiveTextElement("article", "<Interactive.Article>"),
10776
11041
  Aside: makeInteractiveTextElement("aside", "<Interactive.Aside>"),
10777
11042
  Button: makeInteractiveTextElement("button", "<Interactive.Button>"),
10778
- Circle: makeInteractiveNonTextElement("circle", "<Interactive.Circle>"),
11043
+ Circle: makeInteractiveSvgElement("circle", "<Interactive.Circle>"),
10779
11044
  Code: makeInteractiveTextElement("code", "<Interactive.Code>"),
10780
11045
  Div: makeInteractiveTextElement("div", "<Interactive.Div>"),
10781
- Ellipse: makeInteractiveNonTextElement("ellipse", "<Interactive.Ellipse>"),
11046
+ Ellipse: makeInteractiveSvgElement("ellipse", "<Interactive.Ellipse>"),
10782
11047
  Em: makeInteractiveTextElement("em", "<Interactive.Em>"),
10783
11048
  Footer: makeInteractiveTextElement("footer", "<Interactive.Footer>"),
10784
- G: makeInteractiveNonTextElement("g", "<Interactive.G>"),
11049
+ G: makeInteractiveSvgElement("g", "<Interactive.G>"),
10785
11050
  H1: makeInteractiveTextElement("h1", "<Interactive.H1>"),
10786
11051
  H2: makeInteractiveTextElement("h2", "<Interactive.H2>"),
10787
11052
  H3: makeInteractiveTextElement("h3", "<Interactive.H3>"),
@@ -10791,19 +11056,19 @@ var Interactive = {
10791
11056
  Header: makeInteractiveTextElement("header", "<Interactive.Header>"),
10792
11057
  Label: makeInteractiveTextElement("label", "<Interactive.Label>"),
10793
11058
  Li: makeInteractiveTextElement("li", "<Interactive.Li>"),
10794
- Line: makeInteractiveNonTextElement("line", "<Interactive.Line>"),
11059
+ Line: makeInteractiveSvgStrokeElement("line", "<Interactive.Line>"),
10795
11060
  Main: makeInteractiveTextElement("main", "<Interactive.Main>"),
10796
11061
  Nav: makeInteractiveTextElement("nav", "<Interactive.Nav>"),
10797
11062
  Ol: makeInteractiveTextElement("ol", "<Interactive.Ol>"),
10798
11063
  P: makeInteractiveTextElement("p", "<Interactive.P>"),
10799
- Path: makeInteractiveNonTextElement("path", "<Interactive.Path>"),
11064
+ Path: makeInteractiveSvgElement("path", "<Interactive.Path>"),
10800
11065
  Pre: makeInteractiveTextElement("pre", "<Interactive.Pre>"),
10801
- Rect: makeInteractiveNonTextElement("rect", "<Interactive.Rect>"),
11066
+ Rect: makeInteractiveSvgElement("rect", "<Interactive.Rect>"),
10802
11067
  Section: makeInteractiveTextElement("section", "<Interactive.Section>"),
10803
11068
  Small: makeInteractiveTextElement("small", "<Interactive.Small>"),
10804
11069
  Span: makeInteractiveTextElement("span", "<Interactive.Span>"),
10805
11070
  Strong: makeInteractiveTextElement("strong", "<Interactive.Strong>"),
10806
- Svg: makeInteractiveElement("svg", "<Interactive.Svg>", interactiveBorderElementSchema),
11071
+ Svg: makeInteractiveElement("svg", "<Interactive.Svg>", interactiveSvgRootElementSchema),
10807
11072
  Text: makeInteractiveElement("text", "<Interactive.Text>", interactiveSvgTextElementSchema),
10808
11073
  Ul: makeInteractiveTextElement("ul", "<Interactive.Ul>")
10809
11074
  };
@@ -10849,7 +11114,7 @@ var compositionsRef = React31.createRef();
10849
11114
  import {
10850
11115
  useCallback as useCallback21,
10851
11116
  useImperativeHandle as useImperativeHandle8,
10852
- useMemo as useMemo33,
11117
+ useMemo as useMemo34,
10853
11118
  useRef as useRef26,
10854
11119
  useState as useState19
10855
11120
  } from "react";
@@ -10908,7 +11173,7 @@ var CompositionManagerProvider = ({
10908
11173
  getCompositions: () => currentcompositionsRef.current
10909
11174
  };
10910
11175
  }, []);
10911
- const compositionManagerSetters = useMemo33(() => {
11176
+ const compositionManagerSetters = useMemo34(() => {
10912
11177
  return {
10913
11178
  registerComposition,
10914
11179
  unregisterComposition,
@@ -10924,7 +11189,7 @@ var CompositionManagerProvider = ({
10924
11189
  unregisterFolder,
10925
11190
  onlyRenderComposition
10926
11191
  ]);
10927
- const compositionManagerContextValue = useMemo33(() => {
11192
+ const compositionManagerContextValue = useMemo34(() => {
10928
11193
  return {
10929
11194
  compositions,
10930
11195
  folders,
@@ -11043,10 +11308,10 @@ var waitForRoot = (fn) => {
11043
11308
  };
11044
11309
 
11045
11310
  // src/RemotionRoot.tsx
11046
- import { useMemo as useMemo35 } from "react";
11311
+ import { useMemo as useMemo36 } from "react";
11047
11312
 
11048
11313
  // src/use-media-enabled.tsx
11049
- import { createContext as createContext24, useContext as useContext35, useMemo as useMemo34 } from "react";
11314
+ import { createContext as createContext24, useContext as useContext35, useMemo as useMemo35 } from "react";
11050
11315
  import { jsx as jsx31 } from "react/jsx-runtime";
11051
11316
  var MediaEnabledContext = createContext24(null);
11052
11317
  var useVideoEnabled = () => {
@@ -11074,7 +11339,7 @@ var MediaEnabledProvider = ({
11074
11339
  videoEnabled,
11075
11340
  audioEnabled
11076
11341
  }) => {
11077
- const value = useMemo34(() => ({ videoEnabled, audioEnabled }), [videoEnabled, audioEnabled]);
11342
+ const value = useMemo35(() => ({ videoEnabled, audioEnabled }), [videoEnabled, audioEnabled]);
11078
11343
  return /* @__PURE__ */ jsx31(MediaEnabledContext.Provider, {
11079
11344
  value,
11080
11345
  children
@@ -11093,13 +11358,13 @@ var RemotionRootContexts = ({
11093
11358
  audioEnabled,
11094
11359
  frameState
11095
11360
  }) => {
11096
- const nonceContext = useMemo35(() => {
11361
+ const nonceContext = useMemo36(() => {
11097
11362
  let counter = 0;
11098
11363
  return {
11099
11364
  getNonce: () => counter++
11100
11365
  };
11101
11366
  }, []);
11102
- const logging = useMemo35(() => {
11367
+ const logging = useMemo36(() => {
11103
11368
  return { logLevel, mountTime: Date.now() };
11104
11369
  }, [logLevel]);
11105
11370
  return /* @__PURE__ */ jsx32(LogLevelContext.Provider, {
@@ -11448,7 +11713,7 @@ import {
11448
11713
  useContext as useContext37,
11449
11714
  useEffect as useEffect17,
11450
11715
  useLayoutEffect as useLayoutEffect12,
11451
- useMemo as useMemo36,
11716
+ useMemo as useMemo37,
11452
11717
  useState as useState20
11453
11718
  } from "react";
11454
11719
 
@@ -11494,7 +11759,7 @@ var OffthreadVideoForRendering = ({
11494
11759
  if (!src) {
11495
11760
  throw new TypeError("No `src` was passed to <OffthreadVideo>.");
11496
11761
  }
11497
- const id = useMemo36(() => `offthreadvideo-${random(src)}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
11762
+ const id = useMemo37(() => `offthreadvideo-${random(src)}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
11498
11763
  src,
11499
11764
  sequenceContext?.cumulatedFrom,
11500
11765
  sequenceContext?.relativeFrom,
@@ -11549,14 +11814,14 @@ var OffthreadVideoForRendering = ({
11549
11814
  sequenceContext?.cumulatedNegativeFrom,
11550
11815
  audioStreamIndex
11551
11816
  ]);
11552
- const currentTime = useMemo36(() => {
11817
+ const currentTime = useMemo37(() => {
11553
11818
  return getExpectedMediaFrameUncorrected({
11554
11819
  frame,
11555
11820
  playbackRate: playbackRate || 1,
11556
11821
  startFrom: -mediaStartsAt
11557
11822
  }) / videoConfig.fps;
11558
11823
  }, [frame, mediaStartsAt, playbackRate, videoConfig.fps]);
11559
- const actualSrc = useMemo36(() => {
11824
+ const actualSrc = useMemo37(() => {
11560
11825
  return getOffthreadVideoSource({
11561
11826
  src,
11562
11827
  currentTime,
@@ -11644,7 +11909,7 @@ var OffthreadVideoForRendering = ({
11644
11909
  cancelRender("Failed to load image with src " + imageSrc);
11645
11910
  }
11646
11911
  }, [imageSrc, onError]);
11647
- const className = useMemo36(() => {
11912
+ const className = useMemo37(() => {
11648
11913
  return [OBJECTFIT_CONTAIN_CLASS_NAME, props2.className].filter(truthy).join(" ");
11649
11914
  }, [props2.className]);
11650
11915
  const onImageFrame = useCallback22((img) => {
@@ -11674,7 +11939,7 @@ import React38, {
11674
11939
  useContext as useContext38,
11675
11940
  useEffect as useEffect19,
11676
11941
  useImperativeHandle as useImperativeHandle9,
11677
- useMemo as useMemo37,
11942
+ useMemo as useMemo38,
11678
11943
  useRef as useRef27,
11679
11944
  useState as useState21
11680
11945
  } from "react";
@@ -11732,7 +11997,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
11732
11997
  throw new Error("SharedAudioContext not found");
11733
11998
  }
11734
11999
  const videoRef = useRef27(null);
11735
- const sharedSource = useMemo37(() => {
12000
+ const sharedSource = useMemo38(() => {
11736
12001
  if (!context.audioContext) {
11737
12002
  return null;
11738
12003
  }
@@ -11935,7 +12200,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
11935
12200
  current.preload = "auto";
11936
12201
  }
11937
12202
  }, []);
11938
- const actualStyle = useMemo37(() => {
12203
+ const actualStyle = useMemo38(() => {
11939
12204
  return {
11940
12205
  ...style
11941
12206
  };
@@ -12158,7 +12423,7 @@ var watchStaticFile = (fileName, callback) => {
12158
12423
  };
12159
12424
 
12160
12425
  // src/wrap-remotion-context.tsx
12161
- import React40, { useMemo as useMemo38 } from "react";
12426
+ import React40, { useMemo as useMemo39 } from "react";
12162
12427
  import { jsx as jsx36 } from "react/jsx-runtime";
12163
12428
  function useRemotionContexts() {
12164
12429
  const compositionManagerCtx = React40.useContext(CompositionManager);
@@ -12175,7 +12440,7 @@ function useRemotionContexts() {
12175
12440
  const visualModePropStatusesRefContext = React40.useContext(VisualModePropStatusesRefContext);
12176
12441
  const bufferManagerContext = React40.useContext(BufferingContextReact);
12177
12442
  const logLevelContext = React40.useContext(LogLevelContext);
12178
- return useMemo38(() => ({
12443
+ return useMemo39(() => ({
12179
12444
  compositionManagerCtx,
12180
12445
  timelineContext,
12181
12446
  setTimelineContext,
@@ -12286,6 +12551,7 @@ var Internals = {
12286
12551
  sequenceStyleSchema,
12287
12552
  sequenceVisualStyleSchema,
12288
12553
  sequencePremountSchema,
12554
+ sequenceCropSchema,
12289
12555
  textSchema,
12290
12556
  transformSchema,
12291
12557
  premountSchema,
@@ -12409,12 +12675,14 @@ var Internals = {
12409
12675
  hiddenField,
12410
12676
  durationInFramesField,
12411
12677
  freezeField,
12412
- fromField
12678
+ fromField,
12679
+ resolveSequenceCrop,
12680
+ useCropStyle
12413
12681
  };
12414
12682
  // src/series/index.tsx
12415
12683
  import React42, {
12416
12684
  forwardRef as forwardRef14,
12417
- useMemo as useMemo39
12685
+ useMemo as useMemo40
12418
12686
  } from "react";
12419
12687
 
12420
12688
  // src/series/flatten-children.tsx
@@ -12490,7 +12758,7 @@ var validateSeriesSequenceProps = ({
12490
12758
  return offset;
12491
12759
  };
12492
12760
  var SeriesInner = (props2) => {
12493
- const childrenValue = useMemo39(() => {
12761
+ const childrenValue = useMemo40(() => {
12494
12762
  const flattenedChildren = flattenChildren(props2.children);
12495
12763
  const renderChildren = (i, startFrame) => {
12496
12764
  if (i === flattenedChildren.length) {
@@ -12688,7 +12956,7 @@ import {
12688
12956
  useEffect as useEffect20,
12689
12957
  useImperativeHandle as useImperativeHandle10,
12690
12958
  useLayoutEffect as useLayoutEffect13,
12691
- useMemo as useMemo40,
12959
+ useMemo as useMemo41,
12692
12960
  useRef as useRef28
12693
12961
  } from "react";
12694
12962
 
@@ -12847,7 +13115,7 @@ var VideoForRenderingForwardFunction = ({
12847
13115
  const mountTime = useMountTime();
12848
13116
  const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
12849
13117
  const { registerRenderAsset, unregisterRenderAsset } = useContext39(RenderAssetManager);
12850
- const id = useMemo40(() => `video-${random(props2.src ?? "")}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
13118
+ const id = useMemo41(() => `video-${random(props2.src ?? "")}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
12851
13119
  props2.src,
12852
13120
  sequenceContext?.cumulatedFrom,
12853
13121
  sequenceContext?.relativeFrom,