@remotion/promo-pages 4.0.461 → 4.0.463

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 (279) hide show
  1. package/dist/Homepage.js +1496 -953
  2. package/dist/design.js +1837 -1416
  3. package/dist/experts/experts-data.js +5 -16
  4. package/dist/experts.js +1624 -1203
  5. package/dist/homepage/Pricing.js +1865 -1444
  6. package/dist/prompts/PromptsGallery.js +1709 -1288
  7. package/dist/prompts/PromptsShow.js +1379 -958
  8. package/dist/prompts/PromptsSubmit.js +1381 -960
  9. package/dist/team.js +1705 -1284
  10. package/dist/template-modal-content.js +1715 -1294
  11. package/dist/templates.js +1706 -1284
  12. package/package.json +17 -17
  13. package/dist/cn.d.ts +0 -2
  14. package/dist/cn.js +0 -5
  15. package/dist/components/3DEngine/ButtonDemo.d.ts +0 -2
  16. package/dist/components/3DEngine/ButtonDemo.js +0 -43
  17. package/dist/components/3DEngine/Faces.d.ts +0 -5
  18. package/dist/components/3DEngine/Faces.js +0 -7
  19. package/dist/components/3DEngine/Outer.d.ts +0 -8
  20. package/dist/components/3DEngine/Outer.js +0 -56
  21. package/dist/components/3DEngine/Switch.d.ts +0 -4
  22. package/dist/components/3DEngine/Switch.js +0 -4
  23. package/dist/components/3DEngine/get-child-node-from.d.ts +0 -1
  24. package/dist/components/3DEngine/get-child-node-from.js +0 -14
  25. package/dist/components/3DEngine/hover-transforms.d.ts +0 -9
  26. package/dist/components/3DEngine/hover-transforms.js +0 -177
  27. package/dist/components/BackButton.d.ts +0 -6
  28. package/dist/components/BackButton.js +0 -9
  29. package/dist/components/CommandCopyButton.d.ts +0 -5
  30. package/dist/components/CommandCopyButton.js +0 -4
  31. package/dist/components/Homepage.d.ts +0 -6
  32. package/dist/components/Homepage.js +0 -20
  33. package/dist/components/ManageTeamMembers.d.ts +0 -2
  34. package/dist/components/ManageTeamMembers.js +0 -42
  35. package/dist/components/Spinner.d.ts +0 -3
  36. package/dist/components/Spinner.js +0 -4
  37. package/dist/components/TeamPicture.d.ts +0 -1
  38. package/dist/components/TeamPicture.js +0 -4
  39. package/dist/components/design.d.ts +0 -1
  40. package/dist/components/design.js +0 -33
  41. package/dist/components/experts/ExpertsPage.d.ts +0 -11
  42. package/dist/components/experts/ExpertsPage.js +0 -50
  43. package/dist/components/experts/experts-data.d.ts +0 -15
  44. package/dist/components/experts/experts-data.js +0 -289
  45. package/dist/components/experts/experts-icons.d.ts +0 -7
  46. package/dist/components/experts/experts-icons.js +0 -36
  47. package/dist/components/experts.d.ts +0 -3
  48. package/dist/components/experts.js +0 -2
  49. package/dist/components/homepage/BackgroundAnimation.d.ts +0 -2
  50. package/dist/components/homepage/BackgroundAnimation.js +0 -66
  51. package/dist/components/homepage/ChooseTemplate.d.ts +0 -2
  52. package/dist/components/homepage/ChooseTemplate.js +0 -25
  53. package/dist/components/homepage/CommunityStats.d.ts +0 -3
  54. package/dist/components/homepage/CommunityStats.js +0 -6
  55. package/dist/components/homepage/CommunityStatsItems.d.ts +0 -7
  56. package/dist/components/homepage/CommunityStatsItems.js +0 -58
  57. package/dist/components/homepage/Demo/Card.d.ts +0 -15
  58. package/dist/components/homepage/Demo/Card.js +0 -174
  59. package/dist/components/homepage/Demo/Cards.d.ts +0 -15
  60. package/dist/components/homepage/Demo/Cards.js +0 -57
  61. package/dist/components/homepage/Demo/Comp.d.ts +0 -38
  62. package/dist/components/homepage/Demo/Comp.js +0 -72
  63. package/dist/components/homepage/Demo/CurrentCountry.d.ts +0 -9
  64. package/dist/components/homepage/Demo/CurrentCountry.js +0 -48
  65. package/dist/components/homepage/Demo/DemoError.d.ts +0 -2
  66. package/dist/components/homepage/Demo/DemoError.js +0 -10
  67. package/dist/components/homepage/Demo/DemoErrorIcon.d.ts +0 -2
  68. package/dist/components/homepage/Demo/DemoErrorIcon.js +0 -16
  69. package/dist/components/homepage/Demo/DemoRender.d.ts +0 -33
  70. package/dist/components/homepage/Demo/DemoRender.js +0 -107
  71. package/dist/components/homepage/Demo/DigitWheel.d.ts +0 -9
  72. package/dist/components/homepage/Demo/DigitWheel.js +0 -94
  73. package/dist/components/homepage/Demo/DisplayedEmoji.d.ts +0 -5
  74. package/dist/components/homepage/Demo/DisplayedEmoji.js +0 -59
  75. package/dist/components/homepage/Demo/DoneCheckmark.d.ts +0 -2
  76. package/dist/components/homepage/Demo/DoneCheckmark.js +0 -20
  77. package/dist/components/homepage/Demo/DownloadNudge.d.ts +0 -2
  78. package/dist/components/homepage/Demo/DownloadNudge.js +0 -27
  79. package/dist/components/homepage/Demo/DragAndDropNudge.d.ts +0 -3
  80. package/dist/components/homepage/Demo/DragAndDropNudge.js +0 -26
  81. package/dist/components/homepage/Demo/EmojiCard.d.ts +0 -10
  82. package/dist/components/homepage/Demo/EmojiCard.js +0 -120
  83. package/dist/components/homepage/Demo/Minus.d.ts +0 -5
  84. package/dist/components/homepage/Demo/Minus.js +0 -11
  85. package/dist/components/homepage/Demo/PlayPauseButton.d.ts +0 -5
  86. package/dist/components/homepage/Demo/PlayPauseButton.js +0 -47
  87. package/dist/components/homepage/Demo/PlayerControls.d.ts +0 -8
  88. package/dist/components/homepage/Demo/PlayerControls.js +0 -15
  89. package/dist/components/homepage/Demo/PlayerSeekBar.d.ts +0 -11
  90. package/dist/components/homepage/Demo/PlayerSeekBar.js +0 -216
  91. package/dist/components/homepage/Demo/PlayerVolume.d.ts +0 -5
  92. package/dist/components/homepage/Demo/PlayerVolume.js +0 -53
  93. package/dist/components/homepage/Demo/Progress.d.ts +0 -4
  94. package/dist/components/homepage/Demo/Progress.js +0 -14
  95. package/dist/components/homepage/Demo/Spinner.d.ts +0 -5
  96. package/dist/components/homepage/Demo/Spinner.js +0 -37
  97. package/dist/components/homepage/Demo/Switcher.d.ts +0 -6
  98. package/dist/components/homepage/Demo/Switcher.js +0 -25
  99. package/dist/components/homepage/Demo/Temperature.d.ts +0 -6
  100. package/dist/components/homepage/Demo/Temperature.js +0 -21
  101. package/dist/components/homepage/Demo/TemperatureNumber.d.ts +0 -5
  102. package/dist/components/homepage/Demo/TemperatureNumber.js +0 -36
  103. package/dist/components/homepage/Demo/ThemeNudge.d.ts +0 -3
  104. package/dist/components/homepage/Demo/ThemeNudge.js +0 -35
  105. package/dist/components/homepage/Demo/TimeDisplay.d.ts +0 -6
  106. package/dist/components/homepage/Demo/TimeDisplay.js +0 -27
  107. package/dist/components/homepage/Demo/TrendingRepos.d.ts +0 -6
  108. package/dist/components/homepage/Demo/TrendingRepos.js +0 -65
  109. package/dist/components/homepage/Demo/icons.d.ts +0 -10
  110. package/dist/components/homepage/Demo/icons.js +0 -22
  111. package/dist/components/homepage/Demo/index.d.ts +0 -2
  112. package/dist/components/homepage/Demo/index.js +0 -95
  113. package/dist/components/homepage/Demo/math.d.ts +0 -10
  114. package/dist/components/homepage/Demo/math.js +0 -29
  115. package/dist/components/homepage/Demo/types.d.ts +0 -6
  116. package/dist/components/homepage/Demo/types.js +0 -0
  117. package/dist/components/homepage/EditorStarterSection.d.ts +0 -3
  118. package/dist/components/homepage/EditorStarterSection.js +0 -8
  119. package/dist/components/homepage/EvaluateRemotion.d.ts +0 -3
  120. package/dist/components/homepage/EvaluateRemotion.js +0 -21
  121. package/dist/components/homepage/FreePricing.d.ts +0 -4
  122. package/dist/components/homepage/FreePricing.js +0 -133
  123. package/dist/components/homepage/GetStartedStrip.d.ts +0 -2
  124. package/dist/components/homepage/GetStartedStrip.js +0 -14
  125. package/dist/components/homepage/GitHubButton.d.ts +0 -2
  126. package/dist/components/homepage/GitHubButton.js +0 -7
  127. package/dist/components/homepage/IconForTemplate.d.ts +0 -6
  128. package/dist/components/homepage/IconForTemplate.js +0 -105
  129. package/dist/components/homepage/IfYouKnowReact.d.ts +0 -3
  130. package/dist/components/homepage/IfYouKnowReact.js +0 -23
  131. package/dist/components/homepage/MoreTemplatesButton.d.ts +0 -2
  132. package/dist/components/homepage/MoreTemplatesButton.js +0 -11
  133. package/dist/components/homepage/MuxVideo.d.ts +0 -7
  134. package/dist/components/homepage/MuxVideo.js +0 -45
  135. package/dist/components/homepage/NewsletterButton.d.ts +0 -2
  136. package/dist/components/homepage/NewsletterButton.js +0 -38
  137. package/dist/components/homepage/ParameterizeAndEdit.d.ts +0 -2
  138. package/dist/components/homepage/ParameterizeAndEdit.js +0 -22
  139. package/dist/components/homepage/Pricing.d.ts +0 -2
  140. package/dist/components/homepage/Pricing.js +0 -15
  141. package/dist/components/homepage/PricingBulletPoint.d.ts +0 -6
  142. package/dist/components/homepage/PricingBulletPoint.js +0 -19
  143. package/dist/components/homepage/RealMp4Videos.d.ts +0 -2
  144. package/dist/components/homepage/RealMp4Videos.js +0 -41
  145. package/dist/components/homepage/Spacer.d.ts +0 -2
  146. package/dist/components/homepage/Spacer.js +0 -4
  147. package/dist/components/homepage/TemplateIcon.d.ts +0 -5
  148. package/dist/components/homepage/TemplateIcon.js +0 -24
  149. package/dist/components/homepage/TextInput.d.ts +0 -7
  150. package/dist/components/homepage/TextInput.js +0 -34
  151. package/dist/components/homepage/TrustedByBanner.d.ts +0 -2
  152. package/dist/components/homepage/TrustedByBanner.js +0 -27
  153. package/dist/components/homepage/VideoApps.d.ts +0 -4
  154. package/dist/components/homepage/VideoApps.js +0 -72
  155. package/dist/components/homepage/VideoAppsShowcase.d.ts +0 -3
  156. package/dist/components/homepage/VideoAppsShowcase.js +0 -139
  157. package/dist/components/homepage/VideoAppsTitle.d.ts +0 -4
  158. package/dist/components/homepage/VideoAppsTitle.js +0 -4
  159. package/dist/components/homepage/VideoPlayerWithControls.d.ts +0 -20
  160. package/dist/components/homepage/VideoPlayerWithControls.js +0 -105
  161. package/dist/components/homepage/WriteInReact.d.ts +0 -2
  162. package/dist/components/homepage/WriteInReact.js +0 -10
  163. package/dist/components/homepage/YouAreHere.d.ts +0 -2
  164. package/dist/components/homepage/YouAreHere.js +0 -23
  165. package/dist/components/homepage/layout/Button.d.ts +0 -22
  166. package/dist/components/homepage/layout/Button.js +0 -30
  167. package/dist/components/homepage/layout/colors.d.ts +0 -13
  168. package/dist/components/homepage/layout/colors.js +0 -14
  169. package/dist/components/homepage/layout/use-color-mode.d.ts +0 -21
  170. package/dist/components/homepage/layout/use-color-mode.js +0 -22
  171. package/dist/components/homepage/layout/use-el-size.d.ts +0 -5
  172. package/dist/components/homepage/layout/use-el-size.js +0 -40
  173. package/dist/components/homepage/layout/use-mobile-layout.d.ts +0 -1
  174. package/dist/components/homepage/layout/use-mobile-layout.js +0 -6
  175. package/dist/components/icons/blank.d.ts +0 -3
  176. package/dist/components/icons/blank.js +0 -4
  177. package/dist/components/icons/brain.d.ts +0 -2
  178. package/dist/components/icons/brain.js +0 -4
  179. package/dist/components/icons/clone.d.ts +0 -2
  180. package/dist/components/icons/clone.js +0 -2
  181. package/dist/components/icons/code-hike.d.ts +0 -3
  182. package/dist/components/icons/code-hike.js +0 -4
  183. package/dist/components/icons/cubes.d.ts +0 -3
  184. package/dist/components/icons/cubes.js +0 -4
  185. package/dist/components/icons/editor.d.ts +0 -3
  186. package/dist/components/icons/editor.js +0 -4
  187. package/dist/components/icons/electron.d.ts +0 -4
  188. package/dist/components/icons/electron.js +0 -4
  189. package/dist/components/icons/js.d.ts +0 -3
  190. package/dist/components/icons/js.js +0 -4
  191. package/dist/components/icons/music.d.ts +0 -2
  192. package/dist/components/icons/music.js +0 -4
  193. package/dist/components/icons/next.d.ts +0 -4
  194. package/dist/components/icons/next.js +0 -4
  195. package/dist/components/icons/overlay.d.ts +0 -3
  196. package/dist/components/icons/overlay.js +0 -4
  197. package/dist/components/icons/prompt-to-video.d.ts +0 -2
  198. package/dist/components/icons/prompt-to-video.js +0 -4
  199. package/dist/components/icons/recorder.d.ts +0 -3
  200. package/dist/components/icons/recorder.js +0 -4
  201. package/dist/components/icons/remix.d.ts +0 -3
  202. package/dist/components/icons/remix.js +0 -4
  203. package/dist/components/icons/render-server.d.ts +0 -3
  204. package/dist/components/icons/render-server.js +0 -4
  205. package/dist/components/icons/skia.d.ts +0 -3
  206. package/dist/components/icons/skia.js +0 -4
  207. package/dist/components/icons/stargazer.d.ts +0 -3
  208. package/dist/components/icons/stargazer.js +0 -4
  209. package/dist/components/icons/still.d.ts +0 -3
  210. package/dist/components/icons/still.js +0 -4
  211. package/dist/components/icons/tailwind.d.ts +0 -3
  212. package/dist/components/icons/tailwind.js +0 -4
  213. package/dist/components/icons/tiktok.d.ts +0 -3
  214. package/dist/components/icons/tiktok.js +0 -4
  215. package/dist/components/icons/timeline.d.ts +0 -3
  216. package/dist/components/icons/timeline.js +0 -4
  217. package/dist/components/icons/ts.d.ts +0 -3
  218. package/dist/components/icons/ts.js +0 -4
  219. package/dist/components/icons/undo.d.ts +0 -3
  220. package/dist/components/icons/undo.js +0 -2
  221. package/dist/components/icons/vercel.d.ts +0 -4
  222. package/dist/components/icons/vercel.js +0 -4
  223. package/dist/components/icons/waveform.d.ts +0 -3
  224. package/dist/components/icons/waveform.js +0 -4
  225. package/dist/components/prompts/CardLikeButton.d.ts +0 -5
  226. package/dist/components/prompts/CardLikeButton.js +0 -49
  227. package/dist/components/prompts/ClipboardIcon.d.ts +0 -5
  228. package/dist/components/prompts/ClipboardIcon.js +0 -4
  229. package/dist/components/prompts/CopyPromptButton.d.ts +0 -4
  230. package/dist/components/prompts/CopyPromptButton.js +0 -13
  231. package/dist/components/prompts/LikeButton.d.ts +0 -5
  232. package/dist/components/prompts/LikeButton.js +0 -49
  233. package/dist/components/prompts/MuxPlayer.d.ts +0 -8
  234. package/dist/components/prompts/MuxPlayer.js +0 -21
  235. package/dist/components/prompts/NewBackButton.d.ts +0 -5
  236. package/dist/components/prompts/NewBackButton.js +0 -8
  237. package/dist/components/prompts/Page.d.ts +0 -8
  238. package/dist/components/prompts/Page.js +0 -7
  239. package/dist/components/prompts/PromptsGallery.d.ts +0 -7
  240. package/dist/components/prompts/PromptsGallery.js +0 -60
  241. package/dist/components/prompts/PromptsShow.d.ts +0 -5
  242. package/dist/components/prompts/PromptsShow.js +0 -17
  243. package/dist/components/prompts/PromptsSubmit.d.ts +0 -2
  244. package/dist/components/prompts/PromptsSubmit.js +0 -173
  245. package/dist/components/prompts/config.d.ts +0 -1
  246. package/dist/components/prompts/config.js +0 -1
  247. package/dist/components/prompts/prompt-helpers.d.ts +0 -8
  248. package/dist/components/prompts/prompt-helpers.js +0 -76
  249. package/dist/components/prompts/prompt-types.d.ts +0 -14
  250. package/dist/components/prompts/prompt-types.js +0 -0
  251. package/dist/components/prompts/use-heart-animation.d.ts +0 -5
  252. package/dist/components/prompts/use-heart-animation.js +0 -29
  253. package/dist/components/team/TeamCards.d.ts +0 -6
  254. package/dist/components/team/TeamCards.js +0 -19
  255. package/dist/components/team/TitleTeamCards.d.ts +0 -2
  256. package/dist/components/team/TitleTeamCards.js +0 -6
  257. package/dist/components/team/TrustSection.d.ts +0 -2
  258. package/dist/components/team/TrustSection.js +0 -59
  259. package/dist/components/team.d.ts +0 -3
  260. package/dist/components/team.js +0 -15
  261. package/dist/components/template-modal-content.d.ts +0 -5
  262. package/dist/components/template-modal-content.js +0 -73
  263. package/dist/components/templates.d.ts +0 -2
  264. package/dist/components/templates.js +0 -27
  265. package/dist/helpers/mobile-layout.d.ts +0 -1
  266. package/dist/helpers/mobile-layout.js +0 -6
  267. package/dist/helpers/use-el-size.d.ts +0 -5
  268. package/dist/helpers/use-el-size.js +0 -40
  269. package/dist/main.d.ts +0 -1
  270. package/dist/main.js +0 -6
  271. package/dist/prompts/PromptsShow.css +0 -2578
  272. package/dist/prompts-show.d.ts +0 -1
  273. package/dist/prompts-show.js +0 -20
  274. package/dist/prompts-submit.d.ts +0 -1
  275. package/dist/prompts-submit.js +0 -6
  276. package/dist/prompts.d.ts +0 -1
  277. package/dist/prompts.js +0 -6
  278. package/dist/team.d.ts +0 -1
  279. package/dist/template-modal-content.css +0 -35
package/dist/experts.js CHANGED
@@ -1,26 +1,15 @@
1
- var __create = Object.create;
2
- var __getProtoOf = Object.getPrototypeOf;
3
1
  var __defProp = Object.defineProperty;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __toESM = (mod, isNodeMode, target) => {
7
- target = mod != null ? __create(__getProtoOf(mod)) : {};
8
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
9
- for (let key of __getOwnPropNames(mod))
10
- if (!__hasOwnProp.call(to, key))
11
- __defProp(to, key, {
12
- get: () => mod[key],
13
- enumerable: true
14
- });
15
- return to;
16
- };
2
+ var __returnValue = (v) => v;
3
+ function __exportSetter(name, newValue) {
4
+ this[name] = __returnValue.bind(null, newValue);
5
+ }
17
6
  var __export = (target, all) => {
18
7
  for (var name in all)
19
8
  __defProp(target, name, {
20
9
  get: all[name],
21
10
  enumerable: true,
22
11
  configurable: true,
23
- set: (newValue) => all[name] = () => newValue
12
+ set: __exportSetter.bind(all, name)
24
13
  });
25
14
  };
26
15
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
@@ -941,8 +930,21 @@ import * as React6 from "react";
941
930
  import React7, { useMemo as useMemo6, useRef as useRef2 } from "react";
942
931
  import { useContext as useContext8, useMemo as useMemo7 } from "react";
943
932
  import { jsx as jsx7 } from "react/jsx-runtime";
944
- import { useEffect as useEffect4, useMemo as useMemo11, useState as useState3 } from "react";
945
- import { useContext as useContext11 } from "react";
933
+ import {
934
+ forwardRef as forwardRef4,
935
+ useCallback as useCallback6,
936
+ useEffect as useEffect5,
937
+ useMemo as useMemo16,
938
+ useState as useState6
939
+ } from "react";
940
+ import {
941
+ forwardRef as forwardRef3,
942
+ useContext as useContext17,
943
+ useEffect as useEffect3,
944
+ useMemo as useMemo14,
945
+ useState as useState5
946
+ } from "react";
947
+ import { useContext as useContext14, useMemo as useMemo11 } from "react";
946
948
  import { createContext as createContext12 } from "react";
947
949
  import { useContext as useContext10, useMemo as useMemo9 } from "react";
948
950
  import {
@@ -953,52 +955,45 @@ import {
953
955
  useState as useState2
954
956
  } from "react";
955
957
  import { jsx as jsx8 } from "react/jsx-runtime";
956
- import { useEffect as useEffect3, useMemo as useMemo10, useRef as useRef4 } from "react";
957
- import { useRef as useRef5 } from "react";
958
- import { jsx as jsx9 } from "react/jsx-runtime";
959
- import {
960
- forwardRef as forwardRef3,
961
- useContext as useContext16,
962
- useEffect as useEffect5,
963
- useMemo as useMemo16,
964
- useState as useState6
965
- } from "react";
966
- import { useContext as useContext14, useMemo as useMemo13 } from "react";
958
+ import { useContext as useContext11 } from "react";
967
959
  import { useContext as useContext13 } from "react";
968
- import { useContext as useContext12, useMemo as useMemo12 } from "react";
969
- import { jsx as jsx10 } from "react/jsx-runtime";
960
+ import { useContext as useContext12, useMemo as useMemo10 } from "react";
961
+ import { jsx as jsx9 } from "react/jsx-runtime";
970
962
  import { createContext as createContext14 } from "react";
971
- import React12, { useCallback as useCallback5, useMemo as useMemo14, useRef as useRef6, useState as useState4 } from "react";
972
- import { jsx as jsx11 } from "react/jsx-runtime";
973
- import React13, { forwardRef as forwardRef2, useState as useState5, useContext as useContext15, useMemo as useMemo15 } from "react";
963
+ import React11, { useCallback as useCallback5, useMemo as useMemo12, useRef as useRef4, useState as useState3 } from "react";
964
+ import { jsx as jsx10 } from "react/jsx-runtime";
965
+ import React12, { forwardRef as forwardRef2, useState as useState4, useContext as useContext16, useMemo as useMemo13 } from "react";
966
+ import { useContext as useContext15, useRef as useRef5 } from "react";
974
967
  import { createContext as createContext15 } from "react";
968
+ import { jsx as jsx11 } from "react/jsx-runtime";
969
+ import { useEffect as useEffect4, useMemo as useMemo15, useRef as useRef6 } from "react";
975
970
  import { jsx as jsx12 } from "react/jsx-runtime";
976
971
  import {
977
- forwardRef as forwardRef4,
972
+ forwardRef as forwardRef5,
978
973
  useEffect as useEffect6,
979
974
  useImperativeHandle as useImperativeHandle2,
980
975
  useLayoutEffect as useLayoutEffect2,
981
976
  useRef as useRef8,
982
977
  useState as useState7
983
978
  } from "react";
984
- import React15, { useCallback as useCallback6, useImperativeHandle, useRef as useRef7 } from "react";
979
+ import React15, { useCallback as useCallback7, useImperativeHandle, useRef as useRef7 } from "react";
985
980
  import { jsx as jsx13 } from "react/jsx-runtime";
986
981
  import { jsx as jsx14 } from "react/jsx-runtime";
987
982
  import {
988
983
  createContext as createContext16,
989
- forwardRef as forwardRef5,
990
- useCallback as useCallback7,
991
- useContext as useContext17,
984
+ forwardRef as forwardRef6,
985
+ useCallback as useCallback8,
986
+ useContext as useContext18,
992
987
  useLayoutEffect as useLayoutEffect3,
993
988
  useMemo as useMemo17,
994
989
  useRef as useRef9,
995
990
  useState as useState8
996
991
  } from "react";
997
992
  import { jsx as jsx15 } from "react/jsx-runtime";
998
- import { useContext as useContext18, useLayoutEffect as useLayoutEffect5, useState as useState10 } from "react";
993
+ import { useContext as useContext19, useLayoutEffect as useLayoutEffect5, useState as useState10 } from "react";
999
994
  import {
1000
995
  createContext as createContext17,
1001
- useCallback as useCallback8,
996
+ useCallback as useCallback9,
1002
997
  useImperativeHandle as useImperativeHandle3,
1003
998
  useLayoutEffect as useLayoutEffect4,
1004
999
  useMemo as useMemo18,
@@ -1006,29 +1001,29 @@ import {
1006
1001
  useState as useState9
1007
1002
  } from "react";
1008
1003
  import { jsx as jsx16 } from "react/jsx-runtime";
1009
- import { forwardRef as forwardRef8, useCallback as useCallback13, useContext as useContext30 } from "react";
1004
+ import { forwardRef as forwardRef9, useCallback as useCallback14, useContext as useContext31 } from "react";
1010
1005
  import React17, { createContext as createContext18, useMemo as useMemo19 } from "react";
1011
1006
  import { jsx as jsx17 } from "react/jsx-runtime";
1012
- import { useContext as useContext19 } from "react";
1007
+ import { useContext as useContext20 } from "react";
1013
1008
  import { createContext as createContext19, useEffect as useEffect7, useState as useState11 } from "react";
1014
1009
  import { jsx as jsx18 } from "react/jsx-runtime";
1015
1010
  import { createContext as createContext20, useMemo as useMemo20, useReducer } from "react";
1016
1011
  import { jsx as jsx19 } from "react/jsx-runtime";
1017
1012
  import React23, {
1018
- forwardRef as forwardRef6,
1019
- useContext as useContext28,
1013
+ forwardRef as forwardRef7,
1014
+ useContext as useContext29,
1020
1015
  useEffect as useEffect14,
1021
1016
  useImperativeHandle as useImperativeHandle4,
1022
1017
  useMemo as useMemo28,
1023
1018
  useRef as useRef18,
1024
1019
  useState as useState16
1025
1020
  } from "react";
1026
- import { useContext as useContext21, useLayoutEffect as useLayoutEffect6, useRef as useRef13 } from "react";
1021
+ import { useContext as useContext22, useLayoutEffect as useLayoutEffect6, useRef as useRef13 } from "react";
1027
1022
  import React20, {
1028
1023
  createContext as createContext21,
1029
1024
  createRef as createRef2,
1030
- useCallback as useCallback9,
1031
- useContext as useContext20,
1025
+ useCallback as useCallback10,
1026
+ useContext as useContext21,
1032
1027
  useMemo as useMemo22,
1033
1028
  useRef as useRef11,
1034
1029
  useState as useState12
@@ -1036,20 +1031,20 @@ import React20, {
1036
1031
  import { useMemo as useMemo21 } from "react";
1037
1032
  import { jsx as jsx20, jsxs as jsxs22 } from "react/jsx-runtime";
1038
1033
  import { useRef as useRef12 } from "react";
1039
- import { useContext as useContext23, useEffect as useEffect8, useMemo as useMemo23, useState as useState13 } from "react";
1040
- import { useContext as useContext22 } from "react";
1034
+ import { useContext as useContext24, useEffect as useEffect8, useMemo as useMemo23, useState as useState13 } from "react";
1035
+ import { useContext as useContext23 } from "react";
1041
1036
  import {
1042
- useCallback as useCallback12,
1043
- useContext as useContext26,
1037
+ useCallback as useCallback13,
1038
+ useContext as useContext27,
1044
1039
  useEffect as useEffect12,
1045
1040
  useLayoutEffect as useLayoutEffect8,
1046
1041
  useRef as useRef17
1047
1042
  } from "react";
1048
- import { useCallback as useCallback11, useMemo as useMemo26, useRef as useRef15 } from "react";
1049
- import { useContext as useContext25, useMemo as useMemo25 } from "react";
1043
+ import { useCallback as useCallback12, useMemo as useMemo26, useRef as useRef15 } from "react";
1044
+ import { useContext as useContext26, useMemo as useMemo25 } from "react";
1050
1045
  import React21, {
1051
- useCallback as useCallback10,
1052
- useContext as useContext24,
1046
+ useCallback as useCallback11,
1047
+ useContext as useContext25,
1053
1048
  useEffect as useEffect9,
1054
1049
  useLayoutEffect as useLayoutEffect7,
1055
1050
  useMemo as useMemo24,
@@ -1061,11 +1056,11 @@ import React22 from "react";
1061
1056
  import { useEffect as useEffect10, useState as useState15 } from "react";
1062
1057
  import { useEffect as useEffect11, useRef as useRef16 } from "react";
1063
1058
  import { useEffect as useEffect13 } from "react";
1064
- import { createContext as createContext22, useContext as useContext27, useMemo as useMemo27 } from "react";
1059
+ import { createContext as createContext22, useContext as useContext28, useMemo as useMemo27 } from "react";
1065
1060
  import { jsx as jsx222 } from "react/jsx-runtime";
1066
1061
  import {
1067
- forwardRef as forwardRef7,
1068
- useContext as useContext29,
1062
+ forwardRef as forwardRef8,
1063
+ useContext as useContext30,
1069
1064
  useEffect as useEffect15,
1070
1065
  useImperativeHandle as useImperativeHandle5,
1071
1066
  useLayoutEffect as useLayoutEffect9,
@@ -1074,11 +1069,11 @@ import {
1074
1069
  } from "react";
1075
1070
  import { jsx as jsx23 } from "react/jsx-runtime";
1076
1071
  import { jsx as jsx24 } from "react/jsx-runtime";
1077
- import { forwardRef as forwardRef9, useCallback as useCallback14, useState as useState17 } from "react";
1072
+ import { forwardRef as forwardRef10, useCallback as useCallback15, useState as useState17 } from "react";
1078
1073
  import { jsx as jsx25 } from "react/jsx-runtime";
1079
1074
  import {
1080
- useCallback as useCallback15,
1081
- useContext as useContext31,
1075
+ useCallback as useCallback16,
1076
+ useContext as useContext32,
1082
1077
  useImperativeHandle as useImperativeHandle6,
1083
1078
  useLayoutEffect as useLayoutEffect10,
1084
1079
  useRef as useRef20,
@@ -1088,7 +1083,7 @@ import { jsx as jsx26 } from "react/jsx-runtime";
1088
1083
  import { createRef as createRef3 } from "react";
1089
1084
  import React28 from "react";
1090
1085
  import {
1091
- useCallback as useCallback16,
1086
+ useCallback as useCallback17,
1092
1087
  useImperativeHandle as useImperativeHandle7,
1093
1088
  useMemo as useMemo30,
1094
1089
  useRef as useRef21,
@@ -1097,15 +1092,15 @@ import {
1097
1092
  import { jsx as jsx27 } from "react/jsx-runtime";
1098
1093
  import React29 from "react";
1099
1094
  import { useMemo as useMemo32 } from "react";
1100
- import { createContext as createContext23, useContext as useContext32, useMemo as useMemo31 } from "react";
1095
+ import { createContext as createContext23, useContext as useContext33, useMemo as useMemo31 } from "react";
1101
1096
  import { jsx as jsx28 } from "react/jsx-runtime";
1102
1097
  import { jsx as jsx29 } from "react/jsx-runtime";
1103
1098
  import React31 from "react";
1104
1099
  import React32, { createContext as createContext24 } from "react";
1105
- import { useCallback as useCallback18 } from "react";
1100
+ import { useCallback as useCallback19 } from "react";
1106
1101
  import {
1107
- useCallback as useCallback17,
1108
- useContext as useContext33,
1102
+ useCallback as useCallback18,
1103
+ useContext as useContext34,
1109
1104
  useEffect as useEffect16,
1110
1105
  useLayoutEffect as useLayoutEffect11,
1111
1106
  useMemo as useMemo33,
@@ -1113,8 +1108,8 @@ import {
1113
1108
  } from "react";
1114
1109
  import { jsx as jsx30 } from "react/jsx-runtime";
1115
1110
  import React34, {
1116
- forwardRef as forwardRef10,
1117
- useContext as useContext34,
1111
+ forwardRef as forwardRef11,
1112
+ useContext as useContext35,
1118
1113
  useEffect as useEffect18,
1119
1114
  useImperativeHandle as useImperativeHandle8,
1120
1115
  useMemo as useMemo34,
@@ -1126,16 +1121,16 @@ import { jsx as jsx31 } from "react/jsx-runtime";
1126
1121
  import { jsx as jsx32 } from "react/jsx-runtime";
1127
1122
  import React36, { useMemo as useMemo35 } from "react";
1128
1123
  import { jsx as jsx33 } from "react/jsx-runtime";
1129
- import { Children, forwardRef as forwardRef11, useMemo as useMemo36 } from "react";
1124
+ import { Children, forwardRef as forwardRef12, useMemo as useMemo36 } from "react";
1130
1125
  import React37 from "react";
1131
1126
  import React38, { createContext as createContext25 } from "react";
1132
1127
  import { jsx as jsx34 } from "react/jsx-runtime";
1133
1128
  import { jsx as jsx35 } from "react/jsx-runtime";
1134
1129
  import React40 from "react";
1135
- import { forwardRef as forwardRef13, useCallback as useCallback19, useContext as useContext36 } from "react";
1130
+ import { forwardRef as forwardRef14, useCallback as useCallback20, useContext as useContext37 } from "react";
1136
1131
  import {
1137
- forwardRef as forwardRef12,
1138
- useContext as useContext35,
1132
+ forwardRef as forwardRef13,
1133
+ useContext as useContext36,
1139
1134
  useEffect as useEffect19,
1140
1135
  useImperativeHandle as useImperativeHandle9,
1141
1136
  useLayoutEffect as useLayoutEffect12,
@@ -1145,13 +1140,17 @@ import {
1145
1140
  import { jsx as jsx36 } from "react/jsx-runtime";
1146
1141
  import { jsx as jsx37 } from "react/jsx-runtime";
1147
1142
  var __defProp2 = Object.defineProperty;
1143
+ var __returnValue2 = (v) => v;
1144
+ function __exportSetter2(name, newValue) {
1145
+ this[name] = __returnValue2.bind(null, newValue);
1146
+ }
1148
1147
  var __export2 = (target, all) => {
1149
1148
  for (var name in all)
1150
1149
  __defProp2(target, name, {
1151
1150
  get: all[name],
1152
1151
  enumerable: true,
1153
1152
  configurable: true,
1154
- set: (newValue) => all[name] = () => newValue
1153
+ set: __exportSetter2.bind(all, name)
1155
1154
  });
1156
1155
  };
1157
1156
  if (typeof createContext !== "function") {
@@ -2211,6 +2210,81 @@ var Composition = (props) => {
2211
2210
  ...props
2212
2211
  });
2213
2212
  };
2213
+ var componentsToAddStacksTo = [];
2214
+ var getComponentsToAddStacksTo = () => componentsToAddStacksTo;
2215
+ var addSequenceStackTraces = (component) => {
2216
+ componentsToAddStacksTo.push(component);
2217
+ };
2218
+ var sequenceStyleSchema = {
2219
+ "style.translate": {
2220
+ type: "translate",
2221
+ step: 1,
2222
+ default: "0px 0px",
2223
+ description: "Offset"
2224
+ },
2225
+ "style.scale": {
2226
+ type: "number",
2227
+ min: 0.05,
2228
+ max: 100,
2229
+ step: 0.01,
2230
+ default: 1,
2231
+ description: "Scale"
2232
+ },
2233
+ "style.rotate": {
2234
+ type: "rotation",
2235
+ step: 1,
2236
+ default: "0deg",
2237
+ description: "Rotation"
2238
+ },
2239
+ "style.opacity": {
2240
+ type: "number",
2241
+ min: 0,
2242
+ max: 1,
2243
+ step: 0.01,
2244
+ default: 1,
2245
+ description: "Opacity"
2246
+ },
2247
+ premountFor: {
2248
+ type: "number",
2249
+ default: 0,
2250
+ description: "Premount For",
2251
+ min: 0,
2252
+ step: 1
2253
+ },
2254
+ postmountFor: {
2255
+ type: "hidden"
2256
+ },
2257
+ styleWhilePremounted: {
2258
+ type: "hidden"
2259
+ },
2260
+ styleWhilePostmounted: {
2261
+ type: "hidden"
2262
+ }
2263
+ };
2264
+ var hiddenField = {
2265
+ type: "boolean",
2266
+ default: false,
2267
+ description: "Hidden"
2268
+ };
2269
+ var sequenceSchema = {
2270
+ hidden: hiddenField,
2271
+ layout: {
2272
+ type: "enum",
2273
+ default: "absolute-fill",
2274
+ description: "Layout",
2275
+ variants: {
2276
+ "absolute-fill": sequenceStyleSchema,
2277
+ none: {}
2278
+ }
2279
+ }
2280
+ };
2281
+ var sequenceSchemaDefaultLayoutNone = {
2282
+ ...sequenceSchema,
2283
+ layout: {
2284
+ ...sequenceSchema.layout,
2285
+ default: "none"
2286
+ }
2287
+ };
2214
2288
  var SequenceContext = createContext12(null);
2215
2289
  var exports_timeline_position_state = {};
2216
2290
  __export2(exports_timeline_position_state, {
@@ -2416,1014 +2490,786 @@ var useCurrentFrame = () => {
2416
2490
  const contextOffset = context ? context.cumulatedFrom + context.relativeFrom : 0;
2417
2491
  return frame - contextOffset;
2418
2492
  };
2419
- var flattenEffects = (effects) => {
2420
- const out = [];
2421
- for (const item of effects) {
2422
- if (Array.isArray(item)) {
2423
- for (const inner of item) {
2424
- out.push(inner);
2425
- }
2426
- } else {
2427
- out.push(item);
2493
+ var useUnsafeVideoConfig = () => {
2494
+ const context = useContext12(SequenceContext);
2495
+ const ctxWidth = context?.width ?? null;
2496
+ const ctxHeight = context?.height ?? null;
2497
+ const ctxDuration = context?.durationInFrames ?? null;
2498
+ const video = useVideo();
2499
+ return useMemo10(() => {
2500
+ if (!video) {
2501
+ return null;
2428
2502
  }
2429
- }
2430
- return out;
2503
+ const {
2504
+ id,
2505
+ durationInFrames,
2506
+ fps,
2507
+ height,
2508
+ width,
2509
+ defaultProps,
2510
+ props,
2511
+ defaultCodec,
2512
+ defaultOutName,
2513
+ defaultVideoImageFormat,
2514
+ defaultPixelFormat,
2515
+ defaultProResProfile,
2516
+ defaultSampleRate
2517
+ } = video;
2518
+ return {
2519
+ id,
2520
+ width: ctxWidth ?? width,
2521
+ height: ctxHeight ?? height,
2522
+ fps,
2523
+ durationInFrames: ctxDuration ?? durationInFrames,
2524
+ defaultProps,
2525
+ props,
2526
+ defaultCodec,
2527
+ defaultOutName,
2528
+ defaultVideoImageFormat,
2529
+ defaultPixelFormat,
2530
+ defaultProResProfile,
2531
+ defaultSampleRate
2532
+ };
2533
+ }, [ctxDuration, ctxHeight, ctxWidth, video]);
2431
2534
  };
2432
- var groupByBackend = (effects) => {
2433
- const runs = [];
2434
- let current = [];
2435
- let currentBackend = null;
2436
- for (const eff of effects) {
2437
- const { backend } = eff.definition;
2438
- if (currentBackend === null || backend === currentBackend) {
2439
- current.push(eff);
2440
- currentBackend = backend;
2441
- } else {
2442
- runs.push({ backend: currentBackend, effects: current });
2443
- current = [eff];
2444
- currentBackend = backend;
2535
+ var useVideoConfig = () => {
2536
+ const videoConfig = useUnsafeVideoConfig();
2537
+ const context = useContext13(CanUseRemotionHooks);
2538
+ const isPlayer = useIsPlayer();
2539
+ if (!videoConfig) {
2540
+ if (typeof window !== "undefined" && window.remotion_isPlayer || isPlayer) {
2541
+ throw new Error([
2542
+ "No video config found. Likely reasons:",
2543
+ "- You are probably calling useVideoConfig() from outside the component passed to <Player />. See https://www.remotion.dev/docs/player/examples for how to set up the Player correctly.",
2544
+ "- You have multiple versions of Remotion installed which causes the React context to get lost."
2545
+ ].join("-"));
2445
2546
  }
2547
+ throw new Error("No video config found. You are probably calling useVideoConfig() from a component which has not been registered as a <Composition />. See https://www.remotion.dev/docs/the-fundamentals#defining-compositions for more information.");
2446
2548
  }
2447
- if (currentBackend !== null && current.length > 0) {
2448
- runs.push({ backend: currentBackend, effects: current });
2549
+ if (!context) {
2550
+ throw new Error("Called useVideoConfig() outside a Remotion composition.");
2449
2551
  }
2450
- return runs;
2552
+ return videoConfig;
2451
2553
  };
2452
-
2453
- class CanvasPool {
2454
- width;
2455
- height;
2456
- pairs = new Map;
2457
- lostContexts = new Set;
2458
- constructor(width, height) {
2459
- this.width = width;
2460
- this.height = height;
2554
+ var Freeze = ({
2555
+ frame: frameToFreeze,
2556
+ children,
2557
+ active = true
2558
+ }) => {
2559
+ const frame = useCurrentFrame();
2560
+ const videoConfig = useVideoConfig();
2561
+ if (typeof frameToFreeze === "undefined") {
2562
+ throw new Error(`The <Freeze /> component requires a 'frame' prop, but none was passed.`);
2461
2563
  }
2462
- getPair(backend) {
2463
- const existing = this.pairs.get(backend);
2464
- if (existing) {
2465
- return existing;
2466
- }
2467
- const pair = [
2468
- this.allocateCanvas(backend),
2469
- this.allocateCanvas(backend)
2470
- ];
2471
- this.pairs.set(backend, pair);
2472
- return pair;
2564
+ if (typeof frameToFreeze !== "number") {
2565
+ throw new Error(`The 'frame' prop of <Freeze /> must be a number, but is of type ${typeof frameToFreeze}`);
2473
2566
  }
2474
- assertContextNotLost(canvas) {
2475
- if (this.lostContexts.has(canvas)) {
2476
- throw new Error("WebGL context was lost during canvas effect rendering. " + "This typically happens in headless or memory-constrained environments (e.g. Remotion Lambda). " + "Try reducing concurrency or increasing the Lambda function memory.");
2477
- }
2567
+ if (Number.isNaN(frameToFreeze)) {
2568
+ throw new Error(`The 'frame' prop of <Freeze /> must be a real number, but it is NaN.`);
2478
2569
  }
2479
- allocateCanvas(backend) {
2480
- const canvas = document.createElement("canvas");
2481
- canvas.width = this.width;
2482
- canvas.height = this.height;
2483
- switch (backend) {
2484
- case "2d": {
2485
- const ctx = canvas.getContext("2d", {
2486
- colorSpace: "srgb"
2487
- });
2488
- if (!ctx) {
2489
- throw new Error("Failed to acquire 2D context for canvas effect");
2490
- }
2491
- return canvas;
2492
- }
2493
- case "webgl2": {
2494
- const ctx = canvas.getContext("webgl2", {
2495
- premultipliedAlpha: true,
2496
- alpha: true,
2497
- preserveDrawingBuffer: true
2498
- });
2499
- if (!ctx) {
2500
- throw new Error("Failed to acquire WebGL2 context for canvas effect");
2501
- }
2502
- canvas.addEventListener("webglcontextlost", (e) => {
2503
- e.preventDefault();
2504
- this.lostContexts.add(canvas);
2505
- });
2506
- canvas.addEventListener("webglcontextrestored", () => {
2507
- this.lostContexts.delete(canvas);
2508
- });
2509
- ctx.pixelStorei(ctx.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
2510
- return canvas;
2570
+ if (!Number.isFinite(frameToFreeze)) {
2571
+ throw new Error(`The 'frame' prop of <Freeze /> must be a finite number, but it is ${frameToFreeze}.`);
2572
+ }
2573
+ const isActive = useMemo11(() => {
2574
+ if (typeof active === "boolean") {
2575
+ return active;
2576
+ }
2577
+ if (typeof active === "function") {
2578
+ return active(frame);
2579
+ }
2580
+ }, [active, frame]);
2581
+ const timelineContext = useTimelineContext();
2582
+ const sequenceContext = useContext14(SequenceContext);
2583
+ const relativeFrom = sequenceContext?.relativeFrom ?? 0;
2584
+ const timelineValue = useMemo11(() => {
2585
+ if (!isActive) {
2586
+ return timelineContext;
2587
+ }
2588
+ return {
2589
+ ...timelineContext,
2590
+ playing: false,
2591
+ imperativePlaying: {
2592
+ current: false
2593
+ },
2594
+ frame: {
2595
+ [videoConfig.id]: frameToFreeze + relativeFrom
2511
2596
  }
2512
- case "webgpu": {
2513
- if (typeof navigator === "undefined" || !("gpu" in navigator)) {
2514
- throw new Error("WebGPU is not available in this environment for canvas effect");
2597
+ };
2598
+ }, [isActive, timelineContext, videoConfig.id, frameToFreeze, relativeFrom]);
2599
+ const newSequenceContext = useMemo11(() => {
2600
+ if (!sequenceContext) {
2601
+ return null;
2602
+ }
2603
+ if (!isActive) {
2604
+ return sequenceContext;
2605
+ }
2606
+ return {
2607
+ ...sequenceContext,
2608
+ cumulatedFrom: 0
2609
+ };
2610
+ }, [sequenceContext, isActive]);
2611
+ return /* @__PURE__ */ jsx9(TimelineContext.Provider, {
2612
+ value: timelineValue,
2613
+ children: /* @__PURE__ */ jsx9(SequenceContext.Provider, {
2614
+ value: newSequenceContext,
2615
+ children
2616
+ })
2617
+ });
2618
+ };
2619
+ var PremountContext = createContext14({
2620
+ premountFramesRemaining: 0
2621
+ });
2622
+ var SequenceManager = React11.createContext({
2623
+ registerSequence: () => {
2624
+ throw new Error("SequenceManagerContext not initialized");
2625
+ },
2626
+ unregisterSequence: () => {
2627
+ throw new Error("SequenceManagerContext not initialized");
2628
+ },
2629
+ sequences: []
2630
+ });
2631
+ var makeSequencePropsSubscriptionKey = (key) => {
2632
+ return `${key.nodePath.join(".")}.${key.sequenceKeys.join(".")}.${key.effectKeys.map((keys) => keys.join(".")).join(".")}`;
2633
+ };
2634
+ var VisualModeCodeValuesContext = React11.createContext({
2635
+ codeValues: {}
2636
+ });
2637
+ var VisualModeDragOverridesContext = React11.createContext({
2638
+ getDragOverrides: () => {
2639
+ throw new Error("VisualModeDragOverridesContext not initialized");
2640
+ },
2641
+ getEffectDragOverrides: () => {
2642
+ throw new Error("VisualModeDragOverridesContext not initialized");
2643
+ }
2644
+ });
2645
+ var VisualModeSettersContext = React11.createContext({
2646
+ setDragOverrides: () => {
2647
+ throw new Error("VisualModeSettersContext not initialized");
2648
+ },
2649
+ clearDragOverrides: () => {
2650
+ throw new Error("VisualModeSettersContext not initialized");
2651
+ },
2652
+ setEffectDragOverrides: () => {
2653
+ throw new Error("VisualModeSettersContext not initialized");
2654
+ },
2655
+ clearEffectDragOverrides: () => {
2656
+ throw new Error("VisualModeSettersContext not initialized");
2657
+ },
2658
+ setCodeValues: () => {
2659
+ throw new Error("VisualModeSettersContext not initialized");
2660
+ }
2661
+ });
2662
+ var effectDragOverridesKey = (nodePath, effectIndex) => `${makeSequencePropsSubscriptionKey(nodePath)}.effects.${effectIndex}`;
2663
+ var SequenceManagerProvider = ({ children }) => {
2664
+ const [sequences, setSequences] = useState3([]);
2665
+ const [dragOverrides, setControlOverrides] = useState3({});
2666
+ const controlOverridesRef = useRef4(dragOverrides);
2667
+ controlOverridesRef.current = dragOverrides;
2668
+ const [effectDragOverridesState, setEffectDragOverridesState] = useState3({});
2669
+ const [codeValues, setCodeValuesMapState] = useState3({});
2670
+ const setDragOverrides = useCallback5((nodePath, key, value) => {
2671
+ setControlOverrides((prev) => ({
2672
+ ...prev,
2673
+ [makeSequencePropsSubscriptionKey(nodePath)]: {
2674
+ ...prev[makeSequencePropsSubscriptionKey(nodePath)],
2675
+ [key]: value
2676
+ }
2677
+ }));
2678
+ }, []);
2679
+ const clearDragOverrides = useCallback5((nodePath) => {
2680
+ setControlOverrides((prev) => {
2681
+ const key = makeSequencePropsSubscriptionKey(nodePath);
2682
+ if (!prev[key]) {
2683
+ return prev;
2684
+ }
2685
+ const next = { ...prev };
2686
+ delete next[key];
2687
+ return next;
2688
+ });
2689
+ }, []);
2690
+ const setEffectDragOverrides = useCallback5((nodePath, effectIndex, key, value) => {
2691
+ setEffectDragOverridesState((prev) => {
2692
+ const mapKey = effectDragOverridesKey(nodePath, effectIndex);
2693
+ return {
2694
+ ...prev,
2695
+ [mapKey]: {
2696
+ ...prev[mapKey],
2697
+ [key]: value
2515
2698
  }
2516
- return canvas;
2699
+ };
2700
+ });
2701
+ }, []);
2702
+ const clearEffectDragOverrides = useCallback5((nodePath, effectIndex) => {
2703
+ setEffectDragOverridesState((prev) => {
2704
+ const mapKey = effectDragOverridesKey(nodePath, effectIndex);
2705
+ if (!prev[mapKey]) {
2706
+ return prev;
2517
2707
  }
2518
- default: {
2519
- const exhaustive = backend;
2520
- throw new Error(`Unknown effect backend: ${exhaustive}`);
2708
+ const next = { ...prev };
2709
+ delete next[mapKey];
2710
+ return next;
2711
+ });
2712
+ }, []);
2713
+ const setCodeValues = useCallback5((nodePath, values) => {
2714
+ setCodeValuesMapState((prev) => {
2715
+ const key = makeSequencePropsSubscriptionKey(nodePath);
2716
+ const prevKey = prev[key];
2717
+ const newKey = values(prevKey);
2718
+ if (prevKey === newKey) {
2719
+ return prev;
2720
+ }
2721
+ return { ...prev, [key]: newKey };
2722
+ });
2723
+ }, []);
2724
+ const registerSequence = useCallback5((seq) => {
2725
+ setSequences((seqs) => {
2726
+ return [...seqs, seq];
2727
+ });
2728
+ }, []);
2729
+ const unregisterSequence = useCallback5((seq) => {
2730
+ setSequences((seqs) => seqs.filter((s) => s.id !== seq));
2731
+ }, []);
2732
+ const sequenceContext = useMemo12(() => {
2733
+ return {
2734
+ registerSequence,
2735
+ sequences,
2736
+ unregisterSequence
2737
+ };
2738
+ }, [registerSequence, sequences, unregisterSequence]);
2739
+ const getDragOverrides = useCallback5((nodePath) => {
2740
+ return dragOverrides[makeSequencePropsSubscriptionKey(nodePath)] ?? {};
2741
+ }, [dragOverrides]);
2742
+ const getEffectDragOverrides = useCallback5((nodePath, effectIndex) => {
2743
+ return effectDragOverridesState[effectDragOverridesKey(nodePath, effectIndex)] ?? {};
2744
+ }, [effectDragOverridesState]);
2745
+ const codeValuesContext = useMemo12(() => {
2746
+ return {
2747
+ codeValues
2748
+ };
2749
+ }, [codeValues]);
2750
+ const dragOverridesContext = useMemo12(() => {
2751
+ return {
2752
+ getDragOverrides,
2753
+ getEffectDragOverrides
2754
+ };
2755
+ }, [getDragOverrides, getEffectDragOverrides]);
2756
+ const settersContext = useMemo12(() => {
2757
+ return {
2758
+ setDragOverrides,
2759
+ clearDragOverrides,
2760
+ setEffectDragOverrides,
2761
+ clearEffectDragOverrides,
2762
+ setCodeValues
2763
+ };
2764
+ }, [
2765
+ setDragOverrides,
2766
+ clearDragOverrides,
2767
+ setEffectDragOverrides,
2768
+ clearEffectDragOverrides,
2769
+ setCodeValues
2770
+ ]);
2771
+ return /* @__PURE__ */ jsx10(SequenceManager.Provider, {
2772
+ value: sequenceContext,
2773
+ children: /* @__PURE__ */ jsx10(VisualModeCodeValuesContext.Provider, {
2774
+ value: codeValuesContext,
2775
+ children: /* @__PURE__ */ jsx10(VisualModeDragOverridesContext.Provider, {
2776
+ value: dragOverridesContext,
2777
+ children: /* @__PURE__ */ jsx10(VisualModeSettersContext.Provider, {
2778
+ value: settersContext,
2779
+ children
2780
+ })
2781
+ })
2782
+ })
2783
+ });
2784
+ };
2785
+ var ENABLE_V5_BREAKING_CHANGES = false;
2786
+ var deleteNestedKey = (obj, keysToRemove) => {
2787
+ for (const key of keysToRemove) {
2788
+ const parts = key.split(".");
2789
+ const parents = [obj];
2790
+ let current = obj;
2791
+ for (let i = 0;i < parts.length - 1; i++) {
2792
+ const part = parts[i];
2793
+ const next = current[part];
2794
+ if (next === undefined || next === null) {
2795
+ current = null;
2796
+ break;
2797
+ }
2798
+ current = next;
2799
+ parents.push(current);
2800
+ }
2801
+ if (current === null) {
2802
+ continue;
2803
+ }
2804
+ delete current[parts[parts.length - 1]];
2805
+ for (let i = parents.length - 1;i > 0; i--) {
2806
+ const parent = parents[i];
2807
+ if (Object.keys(parent).length === 0) {
2808
+ const parentKey = parts[i - 1];
2809
+ delete parents[i - 1][parentKey];
2810
+ } else {
2811
+ break;
2521
2812
  }
2522
2813
  }
2523
2814
  }
2524
- }
2525
- var devicePromise = null;
2526
- var getGpuDevice = () => {
2527
- if (devicePromise) {
2528
- return devicePromise;
2815
+ return obj;
2816
+ };
2817
+ var OverrideIdsToNodePathsGettersContext = createContext15({
2818
+ overrideIdToNodePathMappings: {}
2819
+ });
2820
+ var OverrideIdsToNodePathsSettersContext = createContext15({
2821
+ setOverrideIdToNodePath: () => {
2822
+ throw new Error("OverrideIdsToNodePathsSettersContext not initialized");
2529
2823
  }
2530
- devicePromise = (async () => {
2531
- if (typeof navigator === "undefined" || !("gpu" in navigator)) {
2532
- throw new Error("WebGPU is not available in this environment");
2824
+ });
2825
+ var mergeOverrides = ({
2826
+ descriptor,
2827
+ codeOverrides,
2828
+ dragOverrides
2829
+ }) => {
2830
+ if (!codeOverrides && !dragOverrides) {
2831
+ return { params: descriptor.params, effectKey: descriptor.effectKey };
2832
+ }
2833
+ const merged = {
2834
+ ...descriptor.params
2835
+ };
2836
+ if (codeOverrides) {
2837
+ for (const [key, value] of Object.entries(codeOverrides)) {
2838
+ if (value !== undefined) {
2839
+ merged[key] = value;
2840
+ }
2533
2841
  }
2534
- const { gpu } = navigator;
2535
- const adapter = await gpu.requestAdapter();
2536
- if (!adapter) {
2537
- throw new Error("No WebGPU adapter available");
2842
+ }
2843
+ if (dragOverrides) {
2844
+ for (const [key, value] of Object.entries(dragOverrides)) {
2845
+ merged[key] = value;
2538
2846
  }
2539
- return adapter.requestDevice();
2540
- })();
2541
- return devicePromise;
2847
+ }
2848
+ return {
2849
+ params: merged,
2850
+ effectKey: descriptor.definition.calculateKey(merged)
2851
+ };
2542
2852
  };
2543
- var createEffectChainState = (width, height) => ({
2544
- pool: new CanvasPool(width, height),
2545
- setupCache: new WeakMap,
2546
- cleanupRegistry: [],
2547
- currentRunId: 0
2548
- });
2549
- var cleanupEffectChainState = (state) => {
2550
- state.currentRunId++;
2551
- for (const entry of state.cleanupRegistry) {
2552
- entry.definition.cleanup(entry.state);
2853
+ var extractCodeOverrides = (propStatus) => {
2854
+ if (!propStatus) {
2855
+ return null;
2856
+ }
2857
+ const out = {};
2858
+ let hasAny = false;
2859
+ for (const [key, status] of Object.entries(propStatus)) {
2860
+ if (status.canUpdate) {
2861
+ out[key] = status.codeValue;
2862
+ hasAny = true;
2863
+ }
2553
2864
  }
2865
+ return hasAny ? out : null;
2554
2866
  };
2555
- var ensureSetup = (state, def, target) => {
2556
- const widened = def;
2557
- if (state.setupCache.has(widened)) {
2558
- return state.setupCache.get(widened);
2867
+ var useMemoizedEffectDefinitions = (effects) => {
2868
+ const previousRef = useRef5(null);
2869
+ const definitions = effects.map((descriptor) => descriptor.definition);
2870
+ const previous = previousRef.current;
2871
+ const isSame = previous !== null && previous.length === definitions.length && previous.every((def, i) => def === definitions[i]);
2872
+ if (isSame) {
2873
+ return previous;
2559
2874
  }
2560
- const setupState = def.setup(target);
2561
- state.setupCache.set(widened, setupState);
2562
- state.cleanupRegistry.push({ definition: widened, state: setupState });
2563
- return setupState;
2875
+ previousRef.current = definitions;
2876
+ return definitions;
2564
2877
  };
2565
- var runEffectChain = async ({
2566
- state,
2567
- source,
2568
- effects,
2569
- output,
2570
- frame,
2571
- width,
2572
- height
2878
+ var getEffectCodeValuesCtx = ({
2879
+ codeValues,
2880
+ nodePath,
2881
+ effectIndex
2573
2882
  }) => {
2574
- const runId = ++state.currentRunId;
2575
- const isCancelled = () => state.currentRunId !== runId;
2576
- const runs = groupByBackend(effects);
2577
- let currentImage = source;
2578
- let lastTarget = null;
2579
- if (runs.length === 0) {
2580
- if (source === output) {
2581
- return true;
2582
- }
2583
- const ctx = output.getContext("2d");
2584
- if (!ctx) {
2585
- throw new Error("Failed to acquire 2D context for output canvas");
2586
- }
2587
- ctx.clearRect(0, 0, width, height);
2588
- ctx.drawImage(currentImage, 0, 0, width, height);
2589
- return true;
2883
+ const status = codeValues[makeSequencePropsSubscriptionKey(nodePath)];
2884
+ if (!status) {
2885
+ return { type: "cannot-update-sequence", reason: "not-found" };
2590
2886
  }
2591
- let needsGpuDevice = false;
2592
- for (const run of runs) {
2593
- if (run.backend === "webgpu") {
2594
- needsGpuDevice = true;
2595
- break;
2596
- }
2887
+ if (!status.canUpdate) {
2888
+ return { type: "cannot-update-sequence", reason: status.reason };
2597
2889
  }
2598
- const gpuDevice = needsGpuDevice ? await getGpuDevice() : null;
2599
- if (isCancelled()) {
2600
- return false;
2890
+ const effect = status.effects.find((e) => e.effectIndex === effectIndex);
2891
+ if (!effect) {
2892
+ return { type: "cannot-update-effect", reason: "not-found" };
2601
2893
  }
2602
- for (let runIndex = 0;runIndex < runs.length; runIndex++) {
2603
- const run = runs[runIndex];
2604
- const [a, b] = state.pool.getPair(run.backend);
2605
- let dst = a;
2606
- for (const eff of run.effects) {
2607
- const def = eff.definition;
2608
- const setupState = ensureSetup(state, def, dst);
2609
- def.apply({
2610
- source: currentImage,
2611
- target: dst,
2612
- state: setupState,
2613
- params: eff.params,
2614
- frame,
2615
- width,
2616
- height,
2617
- gpuDevice
2618
- });
2619
- if (run.backend === "webgl2") {
2620
- state.pool.assertContextNotLost(dst);
2621
- }
2622
- currentImage = dst;
2623
- dst = dst === a ? b : a;
2624
- }
2625
- lastTarget = currentImage ?? lastTarget;
2626
- const nextRun = runs[runIndex + 1];
2627
- if (nextRun && nextRun.backend !== run.backend && lastTarget) {
2628
- const bitmap = await createImageBitmap(lastTarget);
2629
- if (isCancelled()) {
2630
- bitmap.close();
2631
- return false;
2632
- }
2633
- currentImage = bitmap;
2634
- }
2894
+ if (!effect.canUpdate) {
2895
+ return { type: "cannot-update-effect", reason: effect.reason };
2635
2896
  }
2636
- if (!lastTarget) {
2637
- return true;
2897
+ return { type: "can-update-effect", props: effect.props };
2898
+ };
2899
+ var getCodeValuesCtx = (codeValues, nodePath) => {
2900
+ const status = codeValues[makeSequencePropsSubscriptionKey(nodePath)];
2901
+ if (!status) {
2902
+ return;
2638
2903
  }
2639
- const outCtx = output.getContext("2d");
2640
- if (!outCtx) {
2641
- throw new Error("Failed to acquire 2D context for output canvas");
2904
+ if (!status.canUpdate) {
2905
+ return;
2642
2906
  }
2643
- outCtx.clearRect(0, 0, width, height);
2644
- outCtx.drawImage(lastTarget, 0, 0, width, height);
2645
- return true;
2646
- };
2647
- var useEffectChainState = () => {
2648
- const chainStateRef = useRef4(null);
2649
- const sizeRef = useRef4(null);
2650
- useEffect3(() => {
2651
- return () => {
2652
- if (chainStateRef.current) {
2653
- cleanupEffectChainState(chainStateRef.current);
2654
- }
2655
- };
2656
- }, []);
2657
- return useMemo10(() => ({
2658
- get: (width, height) => {
2659
- if (!sizeRef.current || sizeRef.current.width !== width || sizeRef.current.height !== height) {
2660
- if (chainStateRef.current) {
2661
- cleanupEffectChainState(chainStateRef.current);
2662
- }
2663
- chainStateRef.current = createEffectChainState(width, height);
2664
- sizeRef.current = { width, height };
2665
- }
2666
- return chainStateRef.current;
2667
- }
2668
- }), []);
2907
+ return status.props;
2669
2908
  };
2670
- var useMemoizedEffects = (effects) => {
2909
+ var useMemoizedEffects = ({
2910
+ effects,
2911
+ overrideId
2912
+ }) => {
2671
2913
  const previousRef = useRef5(null);
2914
+ const { codeValues } = useContext15(VisualModeCodeValuesContext);
2915
+ const { getEffectDragOverrides } = useContext15(VisualModeDragOverridesContext);
2916
+ const { overrideIdToNodePathMappings } = useContext15(OverrideIdsToNodePathsGettersContext);
2672
2917
  const previous = previousRef.current;
2673
- const isSame = previous !== null && previous.length === effects.length && previous.every((p, i) => p.definition === effects[i].definition && p.effectKey === effects[i].effectKey);
2918
+ const nodePath = overrideId ? overrideIdToNodePathMappings[overrideId] ?? null : null;
2919
+ const resolved = effects.map((descriptor, index) => {
2920
+ if (nodePath === null) {
2921
+ return {
2922
+ descriptor,
2923
+ params: descriptor.params,
2924
+ effectKey: descriptor.effectKey
2925
+ };
2926
+ }
2927
+ const effectStatus = getEffectCodeValuesCtx({
2928
+ codeValues,
2929
+ nodePath,
2930
+ effectIndex: index
2931
+ });
2932
+ const codeOverrides = effectStatus.type === "can-update-effect" ? extractCodeOverrides(effectStatus.props) : null;
2933
+ const dragOverridesMap = getEffectDragOverrides(nodePath, index);
2934
+ const dragOverrides = Object.keys(dragOverridesMap).length === 0 ? null : dragOverridesMap;
2935
+ const { params, effectKey } = mergeOverrides({
2936
+ descriptor,
2937
+ codeOverrides,
2938
+ dragOverrides
2939
+ });
2940
+ return { descriptor, params, effectKey };
2941
+ });
2942
+ const isSame = previous !== null && previous.length === resolved.length && previous.every((p, i) => p.definition === resolved[i].descriptor.definition && p.effectKey === resolved[i].effectKey);
2674
2943
  if (isSame) {
2675
2944
  return previous;
2676
2945
  }
2677
- const next = effects.map((e) => ({
2678
- definition: e.definition,
2679
- stack: e.stack,
2680
- effectKey: e.effectKey,
2681
- params: e.params,
2946
+ const next = resolved.map(({ descriptor, params, effectKey }) => ({
2947
+ definition: descriptor.definition,
2948
+ effectKey,
2949
+ params,
2682
2950
  memoized: true
2683
2951
  }));
2684
2952
  previousRef.current = next;
2685
2953
  return next;
2686
2954
  };
2687
- var componentsToAddStacksTo = [];
2688
- var getComponentsToAddStacksTo = () => componentsToAddStacksTo;
2689
- var addSequenceStackTraces = (component) => {
2690
- componentsToAddStacksTo.push(component);
2691
- };
2692
- var VERSION = "4.0.461";
2693
- var checkMultipleRemotionVersions = () => {
2694
- if (typeof globalThis === "undefined") {
2695
- return;
2696
- }
2697
- const set = () => {
2698
- globalThis.remotion_imported = VERSION;
2699
- if (typeof window !== "undefined") {
2700
- window.remotion_imported = VERSION;
2701
- }
2702
- };
2703
- const alreadyImported = globalThis.remotion_imported || typeof window !== "undefined" && window.remotion_imported;
2704
- if (alreadyImported) {
2705
- if (alreadyImported === VERSION) {
2706
- return;
2707
- }
2708
- if (typeof alreadyImported === "string" && alreadyImported.includes("webcodecs")) {
2709
- set();
2710
- return;
2955
+ var flattenActiveSchema = (schema, resolve) => {
2956
+ const out = {};
2957
+ for (const key of Object.keys(schema)) {
2958
+ const field = schema[key];
2959
+ if (field.type === "hidden") {
2960
+ continue;
2961
+ } else if (field.type === "enum") {
2962
+ out[key] = field;
2963
+ const current = resolve(key) ?? field.default;
2964
+ const variant = field.variants[current];
2965
+ if (variant) {
2966
+ Object.assign(out, flattenActiveSchema(variant, resolve));
2967
+ }
2968
+ } else {
2969
+ out[key] = field;
2711
2970
  }
2712
- throw new TypeError(`\uD83D\uDEA8 Multiple versions of Remotion detected: ${[
2713
- VERSION,
2714
- typeof alreadyImported === "string" ? alreadyImported : "an older version"
2715
- ].filter(truthy).join(" and ")}. This will cause things to break in an unexpected way.
2716
- Check that all your Remotion packages are on the same version. If your dependencies depend on Remotion, make them peer dependencies. You can also run \`npx remotion versions\` from your terminal to see which versions are mismatching.`);
2717
2971
  }
2718
- set();
2972
+ return out;
2719
2973
  };
2720
- var useUnsafeVideoConfig = () => {
2721
- const context = useContext12(SequenceContext);
2722
- const ctxWidth = context?.width ?? null;
2723
- const ctxHeight = context?.height ?? null;
2724
- const ctxDuration = context?.durationInFrames ?? null;
2725
- const video = useVideo();
2726
- return useMemo12(() => {
2727
- if (!video) {
2728
- return null;
2974
+ var getFlatSchemaWithAllKeys = (schema) => {
2975
+ const out = {};
2976
+ const addKey = (key, field) => {
2977
+ if (key in out) {
2978
+ throw new Error(`Duplicate key "${key}" in schema: discriminated union variants must not share keys`);
2729
2979
  }
2730
- const {
2731
- id,
2732
- durationInFrames,
2733
- fps,
2734
- height,
2735
- width,
2736
- defaultProps,
2737
- props,
2738
- defaultCodec,
2739
- defaultOutName,
2740
- defaultVideoImageFormat,
2741
- defaultPixelFormat,
2742
- defaultProResProfile,
2743
- defaultSampleRate
2744
- } = video;
2745
- return {
2746
- id,
2747
- width: ctxWidth ?? width,
2748
- height: ctxHeight ?? height,
2749
- fps,
2750
- durationInFrames: ctxDuration ?? durationInFrames,
2751
- defaultProps,
2752
- props,
2753
- defaultCodec,
2754
- defaultOutName,
2755
- defaultVideoImageFormat,
2756
- defaultPixelFormat,
2757
- defaultProResProfile,
2758
- defaultSampleRate
2759
- };
2760
- }, [ctxDuration, ctxHeight, ctxWidth, video]);
2761
- };
2762
- var useVideoConfig = () => {
2763
- const videoConfig = useUnsafeVideoConfig();
2764
- const context = useContext13(CanUseRemotionHooks);
2765
- const isPlayer = useIsPlayer();
2766
- if (!videoConfig) {
2767
- if (typeof window !== "undefined" && window.remotion_isPlayer || isPlayer) {
2768
- throw new Error([
2769
- "No video config found. Likely reasons:",
2770
- "- You are probably calling useVideoConfig() from outside the component passed to <Player />. See https://www.remotion.dev/docs/player/examples for how to set up the Player correctly.",
2771
- "- You have multiple versions of Remotion installed which causes the React context to get lost."
2772
- ].join("-"));
2980
+ out[key] = field;
2981
+ };
2982
+ for (const key of Object.keys(schema)) {
2983
+ const field = schema[key];
2984
+ addKey(key, field);
2985
+ if (field.type === "enum") {
2986
+ for (const variant of Object.values(field.variants)) {
2987
+ const flatVariant = getFlatSchemaWithAllKeys(variant);
2988
+ for (const variantKey of Object.keys(flatVariant)) {
2989
+ addKey(variantKey, flatVariant[variantKey]);
2990
+ }
2991
+ }
2773
2992
  }
2774
- throw new Error("No video config found. You are probably calling useVideoConfig() from a component which has not been registered as a <Composition />. See https://www.remotion.dev/docs/the-fundamentals#defining-compositions for more information.");
2775
- }
2776
- if (!context) {
2777
- throw new Error("Called useVideoConfig() outside a Remotion composition.");
2778
2993
  }
2779
- return videoConfig;
2994
+ return out;
2780
2995
  };
2781
- var Freeze = ({
2782
- frame: frameToFreeze,
2783
- children,
2784
- active = true
2996
+ var findPropsToDelete = ({
2997
+ schema,
2998
+ key,
2999
+ value
2785
3000
  }) => {
2786
- const frame = useCurrentFrame();
2787
- const videoConfig = useVideoConfig();
2788
- if (typeof frameToFreeze === "undefined") {
2789
- throw new Error(`The <Freeze /> component requires a 'frame' prop, but none was passed.`);
3001
+ const fieldSchema = schema[key];
3002
+ if (!fieldSchema) {
3003
+ throw new Error("Key " + JSON.stringify(key) + " not found in schema");
2790
3004
  }
2791
- if (typeof frameToFreeze !== "number") {
2792
- throw new Error(`The 'frame' prop of <Freeze /> must be a number, but is of type ${typeof frameToFreeze}`);
3005
+ if (typeof value !== "string") {
3006
+ throw new Error("Value must be a string, but is " + JSON.stringify(value));
2793
3007
  }
2794
- if (Number.isNaN(frameToFreeze)) {
2795
- throw new Error(`The 'frame' prop of <Freeze /> must be a real number, but it is NaN.`);
3008
+ if (fieldSchema.type !== "enum") {
3009
+ throw new Error("Key " + JSON.stringify(key) + " is not an enum");
2796
3010
  }
2797
- if (!Number.isFinite(frameToFreeze)) {
2798
- throw new Error(`The 'frame' prop of <Freeze /> must be a finite number, but it is ${frameToFreeze}.`);
3011
+ const currentVariant = fieldSchema.variants[value];
3012
+ if (!currentVariant) {
3013
+ throw new Error("Value for " + JSON.stringify(key) + " must be one of " + Object.keys(fieldSchema.variants).map((v) => JSON.stringify(v)).join(", ") + ", got " + JSON.stringify(value));
2799
3014
  }
2800
- const isActive = useMemo13(() => {
2801
- if (typeof active === "boolean") {
2802
- return active;
2803
- }
2804
- if (typeof active === "function") {
2805
- return active(frame);
3015
+ const otherVariants = Object.keys(fieldSchema.variants).filter((v) => v !== value);
3016
+ const otherKeys = new Set;
3017
+ for (const variant of otherVariants) {
3018
+ const otherVariant = fieldSchema.variants[variant];
3019
+ const keys = Object.keys(otherVariant);
3020
+ for (const k of keys) {
3021
+ otherKeys.add(k);
2806
3022
  }
2807
- }, [active, frame]);
2808
- const timelineContext = useTimelineContext();
2809
- const sequenceContext = useContext14(SequenceContext);
2810
- const relativeFrom = sequenceContext?.relativeFrom ?? 0;
2811
- const timelineValue = useMemo13(() => {
2812
- if (!isActive) {
2813
- return timelineContext;
3023
+ }
3024
+ return [...otherKeys];
3025
+ };
3026
+ var getEffectiveVisualModeValue = ({
3027
+ codeValue,
3028
+ dragOverrideValue,
3029
+ defaultValue,
3030
+ shouldResortToDefaultValueIfUndefined = false
3031
+ }) => {
3032
+ if (dragOverrideValue !== undefined) {
3033
+ return dragOverrideValue;
3034
+ }
3035
+ if (codeValue.codeValue === undefined && shouldResortToDefaultValueIfUndefined) {
3036
+ return defaultValue;
3037
+ }
3038
+ return codeValue.codeValue;
3039
+ };
3040
+ var findFieldInSchema = (schema, key) => {
3041
+ if (key in schema) {
3042
+ return schema[key];
3043
+ }
3044
+ for (const field of Object.values(schema)) {
3045
+ if (field.type !== "enum") {
3046
+ continue;
2814
3047
  }
2815
- return {
2816
- ...timelineContext,
2817
- playing: false,
2818
- imperativePlaying: {
2819
- current: false
2820
- },
2821
- frame: {
2822
- [videoConfig.id]: frameToFreeze + relativeFrom
3048
+ for (const variant of Object.values(field.variants)) {
3049
+ const found = findFieldInSchema(variant, key);
3050
+ if (found) {
3051
+ return found;
2823
3052
  }
2824
- };
2825
- }, [isActive, timelineContext, videoConfig.id, frameToFreeze, relativeFrom]);
2826
- const newSequenceContext = useMemo13(() => {
2827
- if (!sequenceContext) {
2828
- return null;
2829
- }
2830
- if (!isActive) {
2831
- return sequenceContext;
2832
3053
  }
2833
- return {
2834
- ...sequenceContext,
2835
- cumulatedFrom: 0
2836
- };
2837
- }, [sequenceContext, isActive]);
2838
- return /* @__PURE__ */ jsx10(TimelineContext.Provider, {
2839
- value: timelineValue,
2840
- children: /* @__PURE__ */ jsx10(SequenceContext.Provider, {
2841
- value: newSequenceContext,
2842
- children
2843
- })
2844
- });
2845
- };
2846
- var PremountContext = createContext14({
2847
- premountFramesRemaining: 0
2848
- });
2849
- var sequenceStyleSchema = {
2850
- "style.translate": {
2851
- type: "translate",
2852
- step: 1,
2853
- default: "0px 0px",
2854
- description: "Offset"
2855
- },
2856
- "style.scale": {
2857
- type: "number",
2858
- min: 0.05,
2859
- max: 100,
2860
- step: 0.01,
2861
- default: 1,
2862
- description: "Scale"
2863
- },
2864
- "style.rotate": {
2865
- type: "rotation",
2866
- step: 1,
2867
- default: "0deg",
2868
- description: "Rotation"
2869
- },
2870
- "style.opacity": {
2871
- type: "number",
2872
- min: 0,
2873
- max: 1,
2874
- step: 0.01,
2875
- default: 1,
2876
- description: "Opacity"
2877
- },
2878
- premountFor: {
2879
- type: "number",
2880
- default: 0,
2881
- description: "Premount For",
2882
- min: 0,
2883
- step: 1
2884
- },
2885
- postmountFor: {
2886
- type: "hidden"
2887
- },
2888
- styleWhilePremounted: {
2889
- type: "hidden"
2890
- },
2891
- styleWhilePostmounted: {
2892
- type: "hidden"
2893
3054
  }
3055
+ return;
2894
3056
  };
2895
- var sequenceSchema = {
2896
- layout: {
2897
- type: "enum",
2898
- default: "absolute-fill",
2899
- description: "Layout",
2900
- variants: {
2901
- "absolute-fill": sequenceStyleSchema,
2902
- none: {}
3057
+ var computeEffectiveSchemaValuesDotNotation = ({
3058
+ schema,
3059
+ currentValue,
3060
+ overrideValues,
3061
+ propStatus
3062
+ }) => {
3063
+ const merged = {};
3064
+ const propsToDelete = new Set;
3065
+ for (const key of Object.keys(currentValue)) {
3066
+ const codeValueStatus = propStatus?.[key] ?? null;
3067
+ const field = findFieldInSchema(schema, key);
3068
+ if (field?.type === "hidden") {
3069
+ continue;
3070
+ }
3071
+ const value = codeValueStatus === null || codeValueStatus.canUpdate === false ? currentValue[key] : getEffectiveVisualModeValue({
3072
+ codeValue: codeValueStatus,
3073
+ dragOverrideValue: overrideValues[key],
3074
+ defaultValue: field?.default,
3075
+ shouldResortToDefaultValueIfUndefined: false
3076
+ });
3077
+ if (value === undefined) {
3078
+ propsToDelete.add(key);
2903
3079
  }
3080
+ merged[key] = value;
2904
3081
  }
2905
- };
2906
- var sequenceSchemaDefaultLayoutNone = {
2907
- ...sequenceSchema,
2908
- layout: {
2909
- ...sequenceSchema.layout,
2910
- default: "none"
3082
+ for (const key of Object.keys(overrideValues)) {
3083
+ if (schema[key]?.type === "enum") {
3084
+ const propsToDeleteForKey = findPropsToDelete({
3085
+ schema,
3086
+ key,
3087
+ value: merged[key]
3088
+ });
3089
+ for (const propToDelete of propsToDeleteForKey) {
3090
+ propsToDelete.add(propToDelete);
3091
+ }
3092
+ }
2911
3093
  }
3094
+ return { merged, propsToDelete };
2912
3095
  };
2913
- var nodePathToString = (nodePath) => {
2914
- return nodePath.join(".");
2915
- };
2916
- var SequenceManager = React12.createContext({
2917
- registerSequence: () => {
2918
- throw new Error("SequenceManagerContext not initialized");
2919
- },
2920
- unregisterSequence: () => {
2921
- throw new Error("SequenceManagerContext not initialized");
2922
- },
2923
- sequences: []
2924
- });
2925
- var SequenceVisibilityToggleContext = React12.createContext({
2926
- hidden: {},
2927
- setHidden: () => {
2928
- throw new Error("SequenceVisibilityToggle not initialized");
2929
- }
2930
- });
2931
- var getCodeValuesCtx = (codeValues, nodePath) => {
2932
- const status = codeValues[nodePathToString(nodePath)];
2933
- if (!status) {
2934
- return;
2935
- }
2936
- if (!status.canUpdate) {
2937
- return;
3096
+ var getNestedValue = (obj, key) => {
3097
+ const parts = key.split(".");
3098
+ let current = obj;
3099
+ for (const part of parts) {
3100
+ if (current === null || current === undefined || typeof current !== "object")
3101
+ return;
3102
+ current = current[part];
2938
3103
  }
2939
- return status.props;
3104
+ return current;
2940
3105
  };
2941
- var VisualModeCodeValuesContext = React12.createContext({
2942
- getCodeValues: () => {
2943
- throw new Error("VisualModeCodeValuesContext not initialized");
2944
- }
2945
- });
2946
- var VisualModeDragOverridesContext = React12.createContext({
2947
- getDragOverrides: () => {
2948
- throw new Error("VisualModeDragOverridesContext not initialized");
2949
- }
2950
- });
2951
- var VisualModeSettersContext = React12.createContext({
2952
- setDragOverrides: () => {
2953
- throw new Error("VisualModeSettersContext not initialized");
2954
- },
2955
- clearDragOverrides: () => {
2956
- throw new Error("VisualModeSettersContext not initialized");
2957
- },
2958
- setCodeValues: () => {
2959
- throw new Error("VisualModeSettersContext not initialized");
3106
+ var readValuesFromProps = (props, keys) => {
3107
+ const out = {};
3108
+ for (const key of keys) {
3109
+ out[key] = getNestedValue(props, key);
2960
3110
  }
2961
- });
2962
- var SequenceManagerProvider = ({ children }) => {
2963
- const [sequences, setSequences] = useState4([]);
2964
- const [hidden, setHidden] = useState4({});
2965
- const [dragOverrides, setControlOverrides] = useState4({});
2966
- const controlOverridesRef = useRef6(dragOverrides);
2967
- controlOverridesRef.current = dragOverrides;
2968
- const [codeValues, setCodeValuesMapState] = useState4({});
2969
- const setDragOverrides = useCallback5((nodePath, key, value) => {
2970
- setControlOverrides((prev) => ({
2971
- ...prev,
2972
- [nodePathToString(nodePath)]: {
2973
- ...prev[nodePathToString(nodePath)],
2974
- [key]: value
2975
- }
2976
- }));
2977
- }, []);
2978
- const clearDragOverrides = useCallback5((nodePath) => {
2979
- setControlOverrides((prev) => {
2980
- const key = nodePathToString(nodePath);
2981
- if (!prev[key]) {
2982
- return prev;
2983
- }
2984
- const next = { ...prev };
2985
- delete next[key];
2986
- return next;
2987
- });
2988
- }, []);
2989
- const setCodeValues = useCallback5((nodePath, values) => {
2990
- setCodeValuesMapState((prev) => {
2991
- const key = nodePathToString(nodePath);
2992
- const prevKey = prev[key];
2993
- const newKey = values(prevKey);
2994
- if (prevKey === newKey) {
2995
- return prev;
2996
- }
2997
- return { ...prev, [key]: newKey };
2998
- });
2999
- }, []);
3000
- const registerSequence = useCallback5((seq) => {
3001
- setSequences((seqs) => {
3002
- return [...seqs, seq];
3003
- });
3004
- }, []);
3005
- const unregisterSequence = useCallback5((seq) => {
3006
- setSequences((seqs) => seqs.filter((s) => s.id !== seq));
3007
- }, []);
3008
- const sequenceContext = useMemo14(() => {
3009
- return {
3010
- registerSequence,
3011
- sequences,
3012
- unregisterSequence
3013
- };
3014
- }, [registerSequence, sequences, unregisterSequence]);
3015
- const hiddenContext = useMemo14(() => {
3016
- return {
3017
- hidden,
3018
- setHidden
3019
- };
3020
- }, [hidden]);
3021
- const getDragOverrides = useCallback5((nodePath) => {
3022
- return dragOverrides[nodePathToString(nodePath)] ?? {};
3023
- }, [dragOverrides]);
3024
- const getCodeValues = useCallback5((nodePath) => {
3025
- return getCodeValuesCtx(codeValues, nodePath);
3026
- }, [codeValues]);
3027
- const codeValuesContext = useMemo14(() => {
3028
- return {
3029
- getCodeValues
3030
- };
3031
- }, [getCodeValues]);
3032
- const dragOverridesContext = useMemo14(() => {
3033
- return {
3034
- getDragOverrides
3035
- };
3036
- }, [getDragOverrides]);
3037
- const settersContext = useMemo14(() => {
3038
- return {
3039
- setDragOverrides,
3040
- clearDragOverrides,
3041
- setCodeValues
3042
- };
3043
- }, [setDragOverrides, clearDragOverrides, setCodeValues]);
3044
- return /* @__PURE__ */ jsx11(SequenceManager.Provider, {
3045
- value: sequenceContext,
3046
- children: /* @__PURE__ */ jsx11(SequenceVisibilityToggleContext.Provider, {
3047
- value: hiddenContext,
3048
- children: /* @__PURE__ */ jsx11(VisualModeCodeValuesContext.Provider, {
3049
- value: codeValuesContext,
3050
- children: /* @__PURE__ */ jsx11(VisualModeDragOverridesContext.Provider, {
3051
- value: dragOverridesContext,
3052
- children: /* @__PURE__ */ jsx11(VisualModeSettersContext.Provider, {
3053
- value: settersContext,
3054
- children
3055
- })
3056
- })
3057
- })
3058
- })
3059
- });
3060
- };
3061
- var ENABLE_V5_BREAKING_CHANGES = false;
3062
- var deleteNestedKey = (obj, keysToRemove) => {
3063
- for (const key of keysToRemove) {
3064
- const parts = key.split(".");
3065
- const parents = [obj];
3066
- let current = obj;
3067
- for (let i = 0;i < parts.length - 1; i++) {
3068
- const part = parts[i];
3069
- const next = current[part];
3070
- if (next === undefined || next === null) {
3071
- current = null;
3072
- break;
3073
- }
3074
- current = next;
3075
- parents.push(current);
3076
- }
3077
- if (current === null) {
3078
- continue;
3079
- }
3080
- delete current[parts[parts.length - 1]];
3081
- for (let i = parents.length - 1;i > 0; i--) {
3082
- const parent = parents[i];
3083
- if (Object.keys(parent).length === 0) {
3084
- const parentKey = parts[i - 1];
3085
- delete parents[i - 1][parentKey];
3086
- } else {
3087
- break;
3111
+ return out;
3112
+ };
3113
+ var selectActiveKeys = (schema, values) => {
3114
+ return Object.keys(flattenActiveSchema(schema, (key) => values[key]));
3115
+ };
3116
+ var mergeValues = ({
3117
+ props,
3118
+ valuesDotNotation,
3119
+ schemaKeys,
3120
+ propsToDelete
3121
+ }) => {
3122
+ const merged = { ...props };
3123
+ for (const key of schemaKeys) {
3124
+ const value = valuesDotNotation[key];
3125
+ const parts = key.split(".");
3126
+ if (parts.length === 1) {
3127
+ merged[key] = value;
3128
+ continue;
3129
+ }
3130
+ let current = merged;
3131
+ for (let i = 0;i < parts.length - 1; i++) {
3132
+ const part = parts[i];
3133
+ if (typeof current[part] === "object" && current[part] !== null) {
3134
+ current[part] = { ...current[part] };
3135
+ } else {
3136
+ current[part] = {};
3088
3137
  }
3138
+ current = current[part];
3089
3139
  }
3140
+ current[parts[parts.length - 1]] = value;
3090
3141
  }
3091
- return obj;
3142
+ deleteNestedKey(merged, propsToDelete);
3143
+ return merged;
3092
3144
  };
3093
- var flattenActiveSchema = (schema, resolve) => {
3094
- const out = {};
3095
- for (const key of Object.keys(schema)) {
3096
- const field = schema[key];
3097
- if (field.type === "hidden") {
3098
- continue;
3099
- } else if (field.type === "enum") {
3100
- out[key] = field;
3101
- const current = resolve(key) ?? field.default;
3102
- const variant = field.variants[current];
3103
- if (variant) {
3104
- Object.assign(out, flattenActiveSchema(variant, resolve));
3105
- }
3106
- } else {
3107
- out[key] = field;
3145
+ var stackToOverrideMap = {};
3146
+ var wrapInSchema = (Component, schema) => {
3147
+ const flatSchema = getFlatSchemaWithAllKeys(schema);
3148
+ const flatKeys = Object.keys(flatSchema);
3149
+ const Wrapped = forwardRef2((props, ref) => {
3150
+ const env = useRemotionEnvironment();
3151
+ if (!env.isStudio || env.isReadOnlyStudio || env.isRendering) {
3152
+ return React12.createElement(Component, {
3153
+ ...props,
3154
+ _experimentalControls: null,
3155
+ ref
3156
+ });
3108
3157
  }
3109
- }
3110
- return out;
3111
- };
3112
- var getFlatSchemaWithAllKeys = (schema) => {
3113
- const out = {};
3114
- const addKey = (key, field) => {
3115
- if (key in out) {
3116
- throw new Error(`Duplicate key "${key}" in schema: discriminated union variants must not share keys`);
3158
+ const { codeValues } = useContext16(VisualModeCodeValuesContext);
3159
+ const { getDragOverrides } = useContext16(VisualModeDragOverridesContext);
3160
+ const nodePathMapping = useContext16(OverrideIdsToNodePathsGettersContext);
3161
+ if (props._experimentalControls) {
3162
+ return React12.createElement(Component, {
3163
+ ...props,
3164
+ ref
3165
+ });
3117
3166
  }
3118
- out[key] = field;
3119
- };
3120
- for (const key of Object.keys(schema)) {
3121
- const field = schema[key];
3122
- addKey(key, field);
3123
- if (field.type === "enum") {
3124
- for (const variant of Object.values(field.variants)) {
3125
- const flatVariant = getFlatSchemaWithAllKeys(variant);
3126
- for (const variantKey of Object.keys(flatVariant)) {
3127
- addKey(variantKey, flatVariant[variantKey]);
3128
- }
3167
+ const [overrideId] = useState4(() => {
3168
+ const { stack } = props;
3169
+ if (!stack) {
3170
+ return String(Math.random());
3129
3171
  }
3130
- }
3131
- }
3132
- return out;
3172
+ const existingOverrideId = stackToOverrideMap[stack];
3173
+ if (existingOverrideId) {
3174
+ return existingOverrideId;
3175
+ }
3176
+ const newOverrideId = String(Math.random());
3177
+ stackToOverrideMap[stack] = newOverrideId;
3178
+ return newOverrideId;
3179
+ });
3180
+ const nodePath = nodePathMapping.overrideIdToNodePathMappings[overrideId] ?? null;
3181
+ const runtimeValues = flatKeys.map((k) => getNestedValue(props, k));
3182
+ const currentRuntimeValueDotNotation = useMemo13(() => readValuesFromProps(props, flatKeys), runtimeValues);
3183
+ const controls = useMemo13(() => {
3184
+ return {
3185
+ schema,
3186
+ currentRuntimeValueDotNotation,
3187
+ overrideId
3188
+ };
3189
+ }, [currentRuntimeValueDotNotation, overrideId]);
3190
+ const { merged: valuesDotNotation, propsToDelete } = useMemo13(() => {
3191
+ return computeEffectiveSchemaValuesDotNotation({
3192
+ schema,
3193
+ currentValue: currentRuntimeValueDotNotation,
3194
+ overrideValues: nodePath === null ? {} : getDragOverrides(nodePath),
3195
+ propStatus: nodePath === null ? undefined : getCodeValuesCtx(codeValues, nodePath)
3196
+ });
3197
+ }, [
3198
+ currentRuntimeValueDotNotation,
3199
+ getDragOverrides,
3200
+ nodePath,
3201
+ codeValues
3202
+ ]);
3203
+ const activeKeys = selectActiveKeys(schema, valuesDotNotation);
3204
+ const mergedProps = mergeValues({
3205
+ props,
3206
+ valuesDotNotation,
3207
+ schemaKeys: activeKeys,
3208
+ propsToDelete
3209
+ });
3210
+ return React12.createElement(Component, {
3211
+ ...mergedProps,
3212
+ _experimentalControls: controls,
3213
+ ref
3214
+ });
3215
+ });
3216
+ Wrapped.displayName = `wrapInSchema(${Component.displayName || Component.name || "Component"})`;
3217
+ return Wrapped;
3133
3218
  };
3134
- var OverrideIdsToNodePathsGettersContext = createContext15({
3135
- overrideIdToNodePathMappings: {}
3136
- });
3137
- var OverrideIdsToNodePathsSettersContext = createContext15({
3138
- setOverrideIdToNodePath: () => {
3139
- throw new Error("OverrideIdsToNodePathsSettersContext not initialized");
3140
- }
3141
- });
3142
- var findPropsToDelete = ({
3143
- schema,
3144
- key,
3145
- value
3146
- }) => {
3147
- const fieldSchema = schema[key];
3148
- if (!fieldSchema) {
3149
- throw new Error("Key " + JSON.stringify(key) + " not found in schema");
3150
- }
3151
- if (typeof value !== "string") {
3152
- throw new Error("Value must be a string, but is " + JSON.stringify(value));
3153
- }
3154
- if (fieldSchema.type !== "enum") {
3155
- throw new Error("Key " + JSON.stringify(key) + " is not an enum");
3156
- }
3157
- const currentVariant = fieldSchema.variants[value];
3158
- if (!currentVariant) {
3159
- throw new Error("Value for " + JSON.stringify(key) + " must be one of " + Object.keys(fieldSchema.variants).map((v) => JSON.stringify(v)).join(", ") + ", got " + JSON.stringify(value));
3219
+ var RegularSequenceRefForwardingFunction = ({
3220
+ from = 0,
3221
+ durationInFrames = Infinity,
3222
+ children,
3223
+ name,
3224
+ height,
3225
+ width,
3226
+ showInTimeline = true,
3227
+ hidden = false,
3228
+ _experimentalControls: controls,
3229
+ _experimentalEffects,
3230
+ _remotionInternalLoopDisplay: loopDisplay,
3231
+ _remotionInternalStack: stack,
3232
+ _remotionInternalPremountDisplay: premountDisplay,
3233
+ _remotionInternalPostmountDisplay: postmountDisplay,
3234
+ _remotionInternalIsMedia: isMedia,
3235
+ ...other
3236
+ }, ref) => {
3237
+ const { layout = "absolute-fill" } = other;
3238
+ const [id] = useState5(() => String(Math.random()));
3239
+ const parentSequence = useContext17(SequenceContext);
3240
+ const { rootId } = useTimelineContext();
3241
+ const cumulatedFrom = parentSequence ? parentSequence.cumulatedFrom + parentSequence.relativeFrom : 0;
3242
+ const nonce = useNonce();
3243
+ if (layout !== "absolute-fill" && layout !== "none") {
3244
+ throw new TypeError(`The layout prop of <Sequence /> expects either "absolute-fill" or "none", but you passed: ${layout}`);
3160
3245
  }
3161
- const otherVariants = Object.keys(fieldSchema.variants).filter((v) => v !== value);
3162
- const otherKeys = new Set;
3163
- for (const variant of otherVariants) {
3164
- const otherVariant = fieldSchema.variants[variant];
3165
- const keys = Object.keys(otherVariant);
3166
- for (const k of keys) {
3167
- otherKeys.add(k);
3168
- }
3246
+ if (layout === "none" && typeof other.style !== "undefined") {
3247
+ throw new TypeError('If layout="none", you may not pass a style. Passed: ' + JSON.stringify(other.style));
3169
3248
  }
3170
- return [...otherKeys];
3171
- };
3172
- var getEffectiveVisualModeValue = ({
3173
- codeValue,
3174
- runtimeValue,
3175
- dragOverrideValue,
3176
- defaultValue,
3177
- shouldResortToDefaultValueIfUndefined = false
3178
- }) => {
3179
- if (dragOverrideValue !== undefined) {
3180
- return dragOverrideValue;
3249
+ if (typeof durationInFrames !== "number") {
3250
+ throw new TypeError(`You passed to durationInFrames an argument of type ${typeof durationInFrames}, but it must be a number.`);
3181
3251
  }
3182
- if (!codeValue) {
3183
- return runtimeValue;
3252
+ if (durationInFrames <= 0) {
3253
+ throw new TypeError(`durationInFrames must be positive, but got ${durationInFrames}`);
3184
3254
  }
3185
- if (!codeValue.canUpdate) {
3186
- return runtimeValue;
3255
+ if (typeof from !== "number") {
3256
+ throw new TypeError(`You passed to the "from" props of your <Sequence> an argument of type ${typeof from}, but it must be a number.`);
3187
3257
  }
3188
- if (codeValue.codeValue === undefined && shouldResortToDefaultValueIfUndefined) {
3189
- return defaultValue;
3190
- }
3191
- return codeValue.codeValue;
3192
- };
3193
- var findFieldInSchema = (schema, key) => {
3194
- if (key in schema) {
3195
- return schema[key];
3196
- }
3197
- for (const field of Object.values(schema)) {
3198
- if (field.type !== "enum") {
3199
- continue;
3200
- }
3201
- for (const variant of Object.values(field.variants)) {
3202
- const found = findFieldInSchema(variant, key);
3203
- if (found) {
3204
- return found;
3205
- }
3206
- }
3207
- }
3208
- return;
3209
- };
3210
- var computeEffectiveSchemaValuesDotNotation = ({
3211
- schema,
3212
- currentValue,
3213
- overrideValues,
3214
- propStatus
3215
- }) => {
3216
- const merged = {};
3217
- const propsToDelete = new Set;
3218
- for (const key of Object.keys(currentValue)) {
3219
- const codeValueStatus = propStatus?.[key] ?? null;
3220
- const field = findFieldInSchema(schema, key);
3221
- if (field?.type === "hidden") {
3222
- continue;
3223
- }
3224
- const value = getEffectiveVisualModeValue({
3225
- codeValue: codeValueStatus,
3226
- runtimeValue: currentValue[key],
3227
- dragOverrideValue: overrideValues[key],
3228
- defaultValue: field?.default,
3229
- shouldResortToDefaultValueIfUndefined: false
3230
- });
3231
- if (value === undefined) {
3232
- propsToDelete.add(key);
3233
- }
3234
- merged[key] = value;
3235
- }
3236
- for (const key of Object.keys(overrideValues)) {
3237
- if (schema[key]?.type === "enum") {
3238
- const propsToDeleteForKey = findPropsToDelete({
3239
- schema,
3240
- key,
3241
- value: merged[key]
3242
- });
3243
- for (const propToDelete of propsToDeleteForKey) {
3244
- propsToDelete.add(propToDelete);
3245
- }
3246
- }
3247
- }
3248
- return { merged, propsToDelete };
3249
- };
3250
- var getNestedValue = (obj, key) => {
3251
- const parts = key.split(".");
3252
- let current = obj;
3253
- for (const part of parts) {
3254
- if (current === null || current === undefined || typeof current !== "object")
3255
- return;
3256
- current = current[part];
3257
- }
3258
- return current;
3259
- };
3260
- var readValuesFromProps = (props, keys) => {
3261
- const out = {};
3262
- for (const key of keys) {
3263
- out[key] = getNestedValue(props, key);
3264
- }
3265
- return out;
3266
- };
3267
- var selectActiveKeys = (schema, values) => {
3268
- return Object.keys(flattenActiveSchema(schema, (key) => values[key]));
3269
- };
3270
- var mergeValues = ({
3271
- props,
3272
- valuesDotNotation,
3273
- schemaKeys,
3274
- propsToDelete
3275
- }) => {
3276
- const merged = { ...props };
3277
- for (const key of schemaKeys) {
3278
- const value = valuesDotNotation[key];
3279
- const parts = key.split(".");
3280
- if (parts.length === 1) {
3281
- merged[key] = value;
3282
- continue;
3283
- }
3284
- let current = merged;
3285
- for (let i = 0;i < parts.length - 1; i++) {
3286
- const part = parts[i];
3287
- if (typeof current[part] === "object" && current[part] !== null) {
3288
- current[part] = { ...current[part] };
3289
- } else {
3290
- current[part] = {};
3291
- }
3292
- current = current[part];
3293
- }
3294
- current[parts[parts.length - 1]] = value;
3295
- }
3296
- deleteNestedKey(merged, propsToDelete);
3297
- return merged;
3298
- };
3299
- var stackToOverrideMap = {};
3300
- var wrapInSchema = (Component, schema) => {
3301
- const flatSchema = getFlatSchemaWithAllKeys(schema);
3302
- const flatKeys = Object.keys(flatSchema);
3303
- const Wrapped = forwardRef2((props, ref) => {
3304
- const env = useRemotionEnvironment();
3305
- if (!env.isStudio || env.isReadOnlyStudio || env.isRendering) {
3306
- return React13.createElement(Component, {
3307
- ...props,
3308
- _experimentalControls: null,
3309
- ref
3310
- });
3311
- }
3312
- const { getCodeValues } = useContext15(VisualModeCodeValuesContext);
3313
- const { getDragOverrides } = useContext15(VisualModeDragOverridesContext);
3314
- const nodePathMapping = useContext15(OverrideIdsToNodePathsGettersContext);
3315
- if (props._experimentalControls) {
3316
- return React13.createElement(Component, {
3317
- ...props,
3318
- ref
3319
- });
3320
- }
3321
- const [overrideId] = useState5(() => {
3322
- const { stack } = props;
3323
- if (!stack) {
3324
- return String(Math.random());
3325
- }
3326
- const existingOverrideId = stackToOverrideMap[stack];
3327
- if (existingOverrideId) {
3328
- return existingOverrideId;
3329
- }
3330
- const newOverrideId = String(Math.random());
3331
- stackToOverrideMap[stack] = newOverrideId;
3332
- return newOverrideId;
3333
- });
3334
- const nodePath = nodePathMapping.overrideIdToNodePathMappings[overrideId] ?? null;
3335
- const runtimeValues = flatKeys.map((k) => getNestedValue(props, k));
3336
- const currentRuntimeValueDotNotation = useMemo15(() => readValuesFromProps(props, flatKeys), runtimeValues);
3337
- const controls = useMemo15(() => {
3338
- return {
3339
- schema,
3340
- currentRuntimeValueDotNotation,
3341
- overrideId
3342
- };
3343
- }, [currentRuntimeValueDotNotation, overrideId]);
3344
- const { merged: valuesDotNotation, propsToDelete } = useMemo15(() => {
3345
- return computeEffectiveSchemaValuesDotNotation({
3346
- schema,
3347
- currentValue: currentRuntimeValueDotNotation,
3348
- overrideValues: nodePath === null ? {} : getDragOverrides(nodePath),
3349
- propStatus: nodePath === null ? undefined : getCodeValues(nodePath)
3350
- });
3351
- }, [
3352
- currentRuntimeValueDotNotation,
3353
- getDragOverrides,
3354
- nodePath,
3355
- getCodeValues
3356
- ]);
3357
- const activeKeys = selectActiveKeys(schema, valuesDotNotation);
3358
- const mergedProps = mergeValues({
3359
- props,
3360
- valuesDotNotation,
3361
- schemaKeys: activeKeys,
3362
- propsToDelete
3363
- });
3364
- return React13.createElement(Component, {
3365
- ...mergedProps,
3366
- _experimentalControls: controls,
3367
- ref
3368
- });
3369
- });
3370
- Wrapped.displayName = `wrapInSchema(${Component.displayName || Component.name || "Component"})`;
3371
- return Wrapped;
3372
- };
3373
- var RegularSequenceRefForwardingFunction = ({
3374
- from = 0,
3375
- durationInFrames = Infinity,
3376
- children,
3377
- name,
3378
- height,
3379
- width,
3380
- showInTimeline = true,
3381
- _experimentalControls: controls,
3382
- _experimentalEffects,
3383
- _remotionInternalLoopDisplay: loopDisplay,
3384
- _remotionInternalStack: stack,
3385
- _remotionInternalPremountDisplay: premountDisplay,
3386
- _remotionInternalPostmountDisplay: postmountDisplay,
3387
- _remotionInternalIsMedia: isMedia,
3388
- ...other
3389
- }, ref) => {
3390
- const { layout = "absolute-fill" } = other;
3391
- const [id] = useState6(() => String(Math.random()));
3392
- const parentSequence = useContext16(SequenceContext);
3393
- const { rootId } = useTimelineContext();
3394
- const cumulatedFrom = parentSequence ? parentSequence.cumulatedFrom + parentSequence.relativeFrom : 0;
3395
- const nonce = useNonce();
3396
- if (layout !== "absolute-fill" && layout !== "none") {
3397
- throw new TypeError(`The layout prop of <Sequence /> expects either "absolute-fill" or "none", but you passed: ${layout}`);
3398
- }
3399
- if (layout === "none" && typeof other.style !== "undefined") {
3400
- throw new TypeError('If layout="none", you may not pass a style. Passed: ' + JSON.stringify(other.style));
3401
- }
3402
- if (typeof durationInFrames !== "number") {
3403
- throw new TypeError(`You passed to durationInFrames an argument of type ${typeof durationInFrames}, but it must be a number.`);
3404
- }
3405
- if (durationInFrames <= 0) {
3406
- throw new TypeError(`durationInFrames must be positive, but got ${durationInFrames}`);
3407
- }
3408
- if (typeof from !== "number") {
3409
- throw new TypeError(`You passed to the "from" props of your <Sequence> an argument of type ${typeof from}, but it must be a number.`);
3410
- }
3411
- if (!Number.isFinite(from)) {
3412
- throw new TypeError(`The "from" prop of a sequence must be finite, but got ${from}.`);
3258
+ if (!Number.isFinite(from)) {
3259
+ throw new TypeError(`The "from" prop of a sequence must be finite, but got ${from}.`);
3413
3260
  }
3414
3261
  const absoluteFrame = useTimelinePosition();
3415
3262
  const videoConfig = useVideoConfig();
3416
3263
  const parentSequenceDuration = parentSequence ? Math.min(parentSequence.durationInFrames - from, durationInFrames) : durationInFrames;
3417
3264
  const actualDurationInFrames = Math.max(0, Math.min(videoConfig.durationInFrames - from, parentSequenceDuration));
3418
- const { registerSequence, unregisterSequence } = useContext16(SequenceManager);
3419
- const { hidden } = useContext16(SequenceVisibilityToggleContext);
3420
- const premounting = useMemo16(() => {
3265
+ const { registerSequence, unregisterSequence } = useContext17(SequenceManager);
3266
+ const premounting = useMemo14(() => {
3421
3267
  return parentSequence?.premounting || Boolean(other._remotionInternalIsPremounting);
3422
3268
  }, [other._remotionInternalIsPremounting, parentSequence?.premounting]);
3423
- const postmounting = useMemo16(() => {
3269
+ const postmounting = useMemo14(() => {
3424
3270
  return parentSequence?.postmounting || Boolean(other._remotionInternalIsPostmounting);
3425
3271
  }, [other._remotionInternalIsPostmounting, parentSequence?.postmounting]);
3426
- const contextValue = useMemo16(() => {
3272
+ const contextValue = useMemo14(() => {
3427
3273
  return {
3428
3274
  cumulatedFrom,
3429
3275
  relativeFrom: from,
@@ -3450,12 +3296,13 @@ var RegularSequenceRefForwardingFunction = ({
3450
3296
  premountDisplay,
3451
3297
  postmountDisplay
3452
3298
  ]);
3453
- const timelineClipName = useMemo16(() => {
3299
+ const timelineClipName = useMemo14(() => {
3454
3300
  return name ?? "";
3455
3301
  }, [name]);
3456
3302
  const env = useRemotionEnvironment();
3457
3303
  const inheritedStack = other?.stack ?? null;
3458
- useEffect5(() => {
3304
+ const [stackDoesntChange] = useState5(() => stack ?? inheritedStack);
3305
+ useEffect3(() => {
3459
3306
  if (!env.isStudio) {
3460
3307
  return;
3461
3308
  }
@@ -3478,7 +3325,7 @@ var RegularSequenceRefForwardingFunction = ({
3478
3325
  rootId,
3479
3326
  showInTimeline,
3480
3327
  src: isMedia.data.src,
3481
- stack: stack ?? inheritedStack,
3328
+ stack: stackDoesntChange,
3482
3329
  startMediaFrom: isMedia.data.startMediaFrom,
3483
3330
  volume: isMedia.data.volumes
3484
3331
  });
@@ -3497,7 +3344,7 @@ var RegularSequenceRefForwardingFunction = ({
3497
3344
  showInTimeline,
3498
3345
  nonce: nonce.get(),
3499
3346
  loopDisplay,
3500
- stack: stack ?? inheritedStack,
3347
+ stack: stackDoesntChange,
3501
3348
  premountDisplay: premountDisplay ?? null,
3502
3349
  postmountDisplay: postmountDisplay ?? null,
3503
3350
  controls: controls ?? null,
@@ -3520,11 +3367,10 @@ var RegularSequenceRefForwardingFunction = ({
3520
3367
  showInTimeline,
3521
3368
  nonce,
3522
3369
  loopDisplay,
3523
- stack,
3370
+ stackDoesntChange,
3524
3371
  premountDisplay,
3525
3372
  postmountDisplay,
3526
3373
  env.isStudio,
3527
- inheritedStack,
3528
3374
  controls,
3529
3375
  _experimentalEffects,
3530
3376
  isMedia
@@ -3532,7 +3378,7 @@ var RegularSequenceRefForwardingFunction = ({
3532
3378
  const endThreshold = Math.ceil(cumulatedFrom + from + durationInFrames - 1);
3533
3379
  const content = absoluteFrame < cumulatedFrom + from ? null : absoluteFrame > endThreshold ? null : children;
3534
3380
  const styleIfThere = other.layout === "none" ? undefined : other.style;
3535
- const defaultStyle = useMemo16(() => {
3381
+ const defaultStyle = useMemo14(() => {
3536
3382
  return {
3537
3383
  flexDirection: undefined,
3538
3384
  ...width ? { width } : {},
@@ -3543,13 +3389,12 @@ var RegularSequenceRefForwardingFunction = ({
3543
3389
  if (ref !== null && layout === "none") {
3544
3390
  throw new TypeError('It is not supported to pass both a `ref` and `layout="none"` to <Sequence />.');
3545
3391
  }
3546
- const isSequenceHidden = hidden[id] ?? false;
3547
- if (isSequenceHidden) {
3392
+ if (hidden) {
3548
3393
  return null;
3549
3394
  }
3550
- return /* @__PURE__ */ jsx12(SequenceContext.Provider, {
3395
+ return /* @__PURE__ */ jsx11(SequenceContext.Provider, {
3551
3396
  value: contextValue,
3552
- children: content === null ? null : other.layout === "none" ? content : /* @__PURE__ */ jsx12(AbsoluteFill, {
3397
+ children: content === null ? null : other.layout === "none" ? content : /* @__PURE__ */ jsx11(AbsoluteFill, {
3553
3398
  ref,
3554
3399
  style: defaultStyle,
3555
3400
  className: other.className,
@@ -3559,7 +3404,7 @@ var RegularSequenceRefForwardingFunction = ({
3559
3404
  };
3560
3405
  var RegularSequence = forwardRef3(RegularSequenceRefForwardingFunction);
3561
3406
  var PremountedPostmountedSequenceRefForwardingFunction = (props, ref) => {
3562
- const parentPremountContext = useContext16(PremountContext);
3407
+ const parentPremountContext = useContext17(PremountContext);
3563
3408
  const frame = useCurrentFrame() - parentPremountContext.premountFramesRemaining;
3564
3409
  if (props.layout === "none") {
3565
3410
  throw new Error('`<Sequence>` with `premountFor` and `postmountFor` props does not support layout="none"');
@@ -3579,7 +3424,7 @@ var PremountedPostmountedSequenceRefForwardingFunction = (props, ref) => {
3579
3424
  const postmountingActive = frame > endThreshold && frame <= endThreshold + postmountFor;
3580
3425
  const freezeFrame = premountingActive ? from : postmountingActive ? from + durationInFrames - 1 : 0;
3581
3426
  const isFreezingActive = premountingActive || postmountingActive;
3582
- const style = useMemo16(() => {
3427
+ const style = useMemo14(() => {
3583
3428
  return {
3584
3429
  ...passedStyle,
3585
3430
  opacity: premountingActive || postmountingActive ? 0 : 1,
@@ -3588,49 +3433,466 @@ var PremountedPostmountedSequenceRefForwardingFunction = (props, ref) => {
3588
3433
  ...postmountingActive ? styleWhilePostmounted : {}
3589
3434
  };
3590
3435
  }, [
3591
- passedStyle,
3592
- premountingActive,
3593
- postmountingActive,
3594
- styleWhilePremounted,
3595
- styleWhilePostmounted
3436
+ passedStyle,
3437
+ premountingActive,
3438
+ postmountingActive,
3439
+ styleWhilePremounted,
3440
+ styleWhilePostmounted
3441
+ ]);
3442
+ return /* @__PURE__ */ jsx11(Freeze, {
3443
+ frame: freezeFrame,
3444
+ active: isFreezingActive,
3445
+ children: /* @__PURE__ */ jsx11(SequenceInner, {
3446
+ ref,
3447
+ from,
3448
+ durationInFrames,
3449
+ style,
3450
+ _remotionInternalPremountDisplay: premountFor,
3451
+ _remotionInternalPostmountDisplay: postmountFor,
3452
+ _remotionInternalIsPremounting: premountingActive,
3453
+ _remotionInternalIsPostmounting: postmountingActive,
3454
+ ...otherProps
3455
+ })
3456
+ });
3457
+ };
3458
+ var PremountedPostmountedSequence = forwardRef3(PremountedPostmountedSequenceRefForwardingFunction);
3459
+ var SequenceRefForwardingFunction = (props, ref) => {
3460
+ const env = useRemotionEnvironment();
3461
+ const { fps } = useVideoConfig();
3462
+ if (props.layout !== "none" && !env.isRendering) {
3463
+ const effectivePremountFor = ENABLE_V5_BREAKING_CHANGES ? props.premountFor ?? fps : props.premountFor;
3464
+ if (effectivePremountFor || props.postmountFor) {
3465
+ return /* @__PURE__ */ jsx11(PremountedPostmountedSequence, {
3466
+ ref,
3467
+ ...props,
3468
+ premountFor: effectivePremountFor
3469
+ });
3470
+ }
3471
+ }
3472
+ return /* @__PURE__ */ jsx11(RegularSequence, {
3473
+ ...props,
3474
+ ref
3475
+ });
3476
+ };
3477
+ var SequenceInner = forwardRef3(SequenceRefForwardingFunction);
3478
+ var Sequence = wrapInSchema(SequenceInner, sequenceSchema);
3479
+
3480
+ class CanvasPool {
3481
+ width;
3482
+ height;
3483
+ pairs = new Map;
3484
+ lostContexts = new Set;
3485
+ constructor(width, height) {
3486
+ this.width = width;
3487
+ this.height = height;
3488
+ }
3489
+ getPair(backend) {
3490
+ const existing = this.pairs.get(backend);
3491
+ if (existing) {
3492
+ return existing;
3493
+ }
3494
+ const pair = [
3495
+ this.allocateCanvas(backend),
3496
+ this.allocateCanvas(backend)
3497
+ ];
3498
+ this.pairs.set(backend, pair);
3499
+ return pair;
3500
+ }
3501
+ assertContextNotLost(canvas) {
3502
+ if (this.lostContexts.has(canvas)) {
3503
+ throw new Error("WebGL context was lost during canvas effect rendering. " + "This typically happens in headless or memory-constrained environments (e.g. Remotion Lambda). " + "Try reducing concurrency or increasing the Lambda function memory.");
3504
+ }
3505
+ }
3506
+ allocateCanvas(backend) {
3507
+ const canvas = document.createElement("canvas");
3508
+ canvas.width = this.width;
3509
+ canvas.height = this.height;
3510
+ switch (backend) {
3511
+ case "2d": {
3512
+ const ctx = canvas.getContext("2d", {
3513
+ colorSpace: "srgb"
3514
+ });
3515
+ if (!ctx) {
3516
+ throw new Error("Failed to acquire 2D context for canvas effect");
3517
+ }
3518
+ return canvas;
3519
+ }
3520
+ case "webgl2": {
3521
+ const ctx = canvas.getContext("webgl2", {
3522
+ premultipliedAlpha: true,
3523
+ alpha: true,
3524
+ preserveDrawingBuffer: true
3525
+ });
3526
+ if (!ctx) {
3527
+ throw new Error("Failed to acquire WebGL2 context for canvas effect");
3528
+ }
3529
+ canvas.addEventListener("webglcontextlost", (e) => {
3530
+ e.preventDefault();
3531
+ this.lostContexts.add(canvas);
3532
+ });
3533
+ canvas.addEventListener("webglcontextrestored", () => {
3534
+ this.lostContexts.delete(canvas);
3535
+ });
3536
+ ctx.pixelStorei(ctx.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
3537
+ return canvas;
3538
+ }
3539
+ case "webgpu": {
3540
+ if (typeof navigator === "undefined" || !("gpu" in navigator)) {
3541
+ throw new Error("WebGPU is not available in this environment for canvas effect");
3542
+ }
3543
+ return canvas;
3544
+ }
3545
+ default: {
3546
+ const exhaustive = backend;
3547
+ throw new Error(`Unknown effect backend: ${exhaustive}`);
3548
+ }
3549
+ }
3550
+ }
3551
+ }
3552
+ var groupByBackend = (effects) => {
3553
+ const runs = [];
3554
+ let current = [];
3555
+ let currentBackend = null;
3556
+ for (const eff of effects) {
3557
+ const { backend } = eff.definition;
3558
+ if (currentBackend === null || backend === currentBackend) {
3559
+ current.push(eff);
3560
+ currentBackend = backend;
3561
+ } else {
3562
+ runs.push({ backend: currentBackend, effects: current });
3563
+ current = [eff];
3564
+ currentBackend = backend;
3565
+ }
3566
+ }
3567
+ if (currentBackend !== null && current.length > 0) {
3568
+ runs.push({ backend: currentBackend, effects: current });
3569
+ }
3570
+ return runs;
3571
+ };
3572
+ var devicePromise = null;
3573
+ var getGpuDevice = () => {
3574
+ if (devicePromise) {
3575
+ return devicePromise;
3576
+ }
3577
+ devicePromise = (async () => {
3578
+ if (typeof navigator === "undefined" || !("gpu" in navigator)) {
3579
+ throw new Error("WebGPU is not available in this environment");
3580
+ }
3581
+ const { gpu } = navigator;
3582
+ const adapter = await gpu.requestAdapter();
3583
+ if (!adapter) {
3584
+ throw new Error("No WebGPU adapter available");
3585
+ }
3586
+ return adapter.requestDevice();
3587
+ })();
3588
+ return devicePromise;
3589
+ };
3590
+ var createEffectChainState = (width, height) => ({
3591
+ pool: new CanvasPool(width, height),
3592
+ setupCache: new WeakMap,
3593
+ cleanupRegistry: [],
3594
+ currentRunId: 0
3595
+ });
3596
+ var cleanupEffectChainState = (state) => {
3597
+ state.currentRunId++;
3598
+ for (const entry of state.cleanupRegistry) {
3599
+ entry.definition.cleanup(entry.state);
3600
+ }
3601
+ };
3602
+ var ensureSetup = (state, def, target) => {
3603
+ const widened = def;
3604
+ if (state.setupCache.has(widened)) {
3605
+ return state.setupCache.get(widened);
3606
+ }
3607
+ const setupState = def.setup(target);
3608
+ state.setupCache.set(widened, setupState);
3609
+ state.cleanupRegistry.push({ definition: widened, state: setupState });
3610
+ return setupState;
3611
+ };
3612
+ var runEffectChain = async ({
3613
+ state,
3614
+ source,
3615
+ effects,
3616
+ output,
3617
+ width,
3618
+ height
3619
+ }) => {
3620
+ const runId = ++state.currentRunId;
3621
+ const isCancelled = () => state.currentRunId !== runId;
3622
+ const enabledEffects = effects.filter((e) => !e.params.disabled);
3623
+ const runs = groupByBackend(enabledEffects);
3624
+ let currentImage = source;
3625
+ let lastTarget = null;
3626
+ if (runs.length === 0) {
3627
+ if (source === output) {
3628
+ return true;
3629
+ }
3630
+ const ctx = output.getContext("2d");
3631
+ if (!ctx) {
3632
+ throw new Error("Failed to acquire 2D context for output canvas");
3633
+ }
3634
+ ctx.clearRect(0, 0, width, height);
3635
+ ctx.drawImage(currentImage, 0, 0, width, height);
3636
+ return true;
3637
+ }
3638
+ let needsGpuDevice = false;
3639
+ for (const run of runs) {
3640
+ if (run.backend === "webgpu") {
3641
+ needsGpuDevice = true;
3642
+ break;
3643
+ }
3644
+ }
3645
+ const gpuDevice = needsGpuDevice ? await getGpuDevice() : null;
3646
+ if (isCancelled()) {
3647
+ return false;
3648
+ }
3649
+ for (let runIndex = 0;runIndex < runs.length; runIndex++) {
3650
+ const run = runs[runIndex];
3651
+ const [a, b] = state.pool.getPair(run.backend);
3652
+ let dst = a;
3653
+ for (const eff of run.effects) {
3654
+ const def = eff.definition;
3655
+ const setupState = ensureSetup(state, def, dst);
3656
+ def.apply({
3657
+ source: currentImage,
3658
+ target: dst,
3659
+ state: setupState,
3660
+ params: eff.params,
3661
+ width,
3662
+ height,
3663
+ gpuDevice
3664
+ });
3665
+ if (run.backend === "webgl2") {
3666
+ state.pool.assertContextNotLost(dst);
3667
+ }
3668
+ currentImage = dst;
3669
+ dst = dst === a ? b : a;
3670
+ }
3671
+ lastTarget = currentImage ?? lastTarget;
3672
+ const nextRun = runs[runIndex + 1];
3673
+ if (nextRun && nextRun.backend !== run.backend && lastTarget) {
3674
+ const bitmap = await createImageBitmap(lastTarget);
3675
+ if (isCancelled()) {
3676
+ bitmap.close();
3677
+ return false;
3678
+ }
3679
+ currentImage = bitmap;
3680
+ }
3681
+ }
3682
+ if (!lastTarget) {
3683
+ return true;
3684
+ }
3685
+ const outCtx = output.getContext("2d");
3686
+ if (!outCtx) {
3687
+ throw new Error("Failed to acquire 2D context for output canvas");
3688
+ }
3689
+ outCtx.clearRect(0, 0, width, height);
3690
+ outCtx.drawImage(lastTarget, 0, 0, width, height);
3691
+ return true;
3692
+ };
3693
+ var useEffectChainState = () => {
3694
+ const chainStateRef = useRef6(null);
3695
+ const sizeRef = useRef6(null);
3696
+ useEffect4(() => {
3697
+ return () => {
3698
+ if (chainStateRef.current) {
3699
+ cleanupEffectChainState(chainStateRef.current);
3700
+ }
3701
+ };
3702
+ }, []);
3703
+ return useMemo15(() => ({
3704
+ get: (width, height) => {
3705
+ if (!sizeRef.current || sizeRef.current.width !== width || sizeRef.current.height !== height) {
3706
+ if (chainStateRef.current) {
3707
+ cleanupEffectChainState(chainStateRef.current);
3708
+ }
3709
+ chainStateRef.current = createEffectChainState(width, height);
3710
+ sizeRef.current = { width, height };
3711
+ }
3712
+ return chainStateRef.current;
3713
+ }
3714
+ }), []);
3715
+ };
3716
+ var solidSchema = {
3717
+ color: {
3718
+ type: "color",
3719
+ default: "#ffffff",
3720
+ description: "Color"
3721
+ },
3722
+ width: {
3723
+ type: "number",
3724
+ min: 1,
3725
+ step: 1,
3726
+ default: 1920,
3727
+ description: "Width"
3728
+ },
3729
+ height: {
3730
+ type: "number",
3731
+ min: 1,
3732
+ step: 1,
3733
+ default: 1080,
3734
+ description: "Height"
3735
+ },
3736
+ ...sequenceStyleSchema
3737
+ };
3738
+ var SolidInner = ({
3739
+ color,
3740
+ width,
3741
+ height,
3742
+ _experimentalEffects: experimentalEffects = [],
3743
+ className,
3744
+ style,
3745
+ overrideId,
3746
+ ref
3747
+ }) => {
3748
+ const { delayRender: delayRender2, continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
3749
+ const [outputCanvas, setOutputCanvas] = useState6(null);
3750
+ const memoizedEffects = useMemoizedEffects({
3751
+ effects: experimentalEffects,
3752
+ overrideId: overrideId ?? null
3753
+ });
3754
+ const sourceCanvas = useMemo16(() => {
3755
+ if (typeof document === "undefined") {
3756
+ return null;
3757
+ }
3758
+ const canvas = document.createElement("canvas");
3759
+ canvas.width = 1;
3760
+ canvas.height = 1;
3761
+ return canvas;
3762
+ }, []);
3763
+ const chainState = useEffectChainState();
3764
+ const canvasRef = useCallback6((canvas) => {
3765
+ setOutputCanvas(canvas);
3766
+ if (typeof ref === "function") {
3767
+ ref(canvas);
3768
+ } else if (ref) {
3769
+ ref.current = canvas;
3770
+ }
3771
+ }, [ref]);
3772
+ useEffect5(() => {
3773
+ if (!outputCanvas || !sourceCanvas) {
3774
+ return;
3775
+ }
3776
+ const handle = delayRender2("Solid effect chain");
3777
+ if (!chainState) {
3778
+ continueRender2(handle);
3779
+ return () => {
3780
+ continueRender2(handle);
3781
+ };
3782
+ }
3783
+ const ctx = sourceCanvas.getContext("2d", { colorSpace: "srgb" });
3784
+ if (!ctx) {
3785
+ cancelRender2(new Error("Failed to acquire 2D context for <Solid> source"));
3786
+ return;
3787
+ }
3788
+ ctx.fillStyle = color;
3789
+ ctx.fillRect(0, 0, 1, 1);
3790
+ runEffectChain({
3791
+ state: chainState.get(width, height),
3792
+ source: sourceCanvas,
3793
+ effects: memoizedEffects,
3794
+ output: outputCanvas,
3795
+ width,
3796
+ height
3797
+ }).then((completed) => {
3798
+ if (completed) {
3799
+ continueRender2(handle);
3800
+ }
3801
+ }).catch((err) => {
3802
+ cancelRender2(err);
3803
+ });
3804
+ return () => {
3805
+ continueRender2(handle);
3806
+ };
3807
+ }, [
3808
+ color,
3809
+ outputCanvas,
3810
+ sourceCanvas,
3811
+ chainState,
3812
+ width,
3813
+ height,
3814
+ delayRender2,
3815
+ continueRender2,
3816
+ cancelRender2,
3817
+ memoizedEffects
3596
3818
  ]);
3597
- return /* @__PURE__ */ jsx12(Freeze, {
3598
- frame: freezeFrame,
3599
- active: isFreezingActive,
3600
- children: /* @__PURE__ */ jsx12(SequenceInner, {
3819
+ return /* @__PURE__ */ jsx12("canvas", {
3820
+ ref: canvasRef,
3821
+ width,
3822
+ height,
3823
+ className,
3824
+ style
3825
+ });
3826
+ };
3827
+ var SolidOuter = forwardRef4(({
3828
+ _experimentalEffects = [],
3829
+ _experimentalControls: controls,
3830
+ color,
3831
+ height,
3832
+ width,
3833
+ className,
3834
+ durationInFrames,
3835
+ style,
3836
+ name,
3837
+ from,
3838
+ hidden,
3839
+ showInTimeline,
3840
+ ...props
3841
+ }, ref) => {
3842
+ const memoizedEffectDefinitions = useMemoizedEffectDefinitions(_experimentalEffects);
3843
+ return /* @__PURE__ */ jsx12(Sequence, {
3844
+ layout: "none",
3845
+ from,
3846
+ hidden,
3847
+ showInTimeline,
3848
+ _experimentalControls: controls,
3849
+ _experimentalEffects: memoizedEffectDefinitions,
3850
+ durationInFrames,
3851
+ name: name ?? "<Solid>",
3852
+ ...props,
3853
+ children: /* @__PURE__ */ jsx12(SolidInner, {
3601
3854
  ref,
3602
- from,
3603
- durationInFrames,
3855
+ overrideId: controls?.overrideId ?? null,
3856
+ color,
3857
+ height,
3858
+ width,
3859
+ className,
3604
3860
  style,
3605
- _remotionInternalPremountDisplay: premountFor,
3606
- _remotionInternalPostmountDisplay: postmountFor,
3607
- _remotionInternalIsPremounting: premountingActive,
3608
- _remotionInternalIsPostmounting: postmountingActive,
3609
- ...otherProps
3861
+ _experimentalEffects
3610
3862
  })
3611
3863
  });
3612
- };
3613
- var PremountedPostmountedSequence = forwardRef3(PremountedPostmountedSequenceRefForwardingFunction);
3614
- var SequenceRefForwardingFunction = (props, ref) => {
3615
- const env = useRemotionEnvironment();
3616
- const { fps } = useVideoConfig();
3617
- if (props.layout !== "none" && !env.isRendering) {
3618
- const effectivePremountFor = ENABLE_V5_BREAKING_CHANGES ? props.premountFor ?? fps : props.premountFor;
3619
- if (effectivePremountFor || props.postmountFor) {
3620
- return /* @__PURE__ */ jsx12(PremountedPostmountedSequence, {
3621
- ref,
3622
- ...props,
3623
- premountFor: effectivePremountFor
3624
- });
3864
+ });
3865
+ var Solid = wrapInSchema(SolidOuter, solidSchema);
3866
+ Solid.displayName = "Solid";
3867
+ addSequenceStackTraces(Solid);
3868
+ var VERSION = "4.0.463";
3869
+ var checkMultipleRemotionVersions = () => {
3870
+ if (typeof globalThis === "undefined") {
3871
+ return;
3872
+ }
3873
+ const set = () => {
3874
+ globalThis.remotion_imported = VERSION;
3875
+ if (typeof window !== "undefined") {
3876
+ window.remotion_imported = VERSION;
3877
+ }
3878
+ };
3879
+ const alreadyImported = globalThis.remotion_imported || typeof window !== "undefined" && window.remotion_imported;
3880
+ if (alreadyImported) {
3881
+ if (alreadyImported === VERSION) {
3882
+ return;
3883
+ }
3884
+ if (typeof alreadyImported === "string" && alreadyImported.includes("webcodecs")) {
3885
+ set();
3886
+ return;
3625
3887
  }
3888
+ throw new TypeError(`\uD83D\uDEA8 Multiple versions of Remotion detected: ${[
3889
+ VERSION,
3890
+ typeof alreadyImported === "string" ? alreadyImported : "an older version"
3891
+ ].filter(truthy).join(" and ")}. This will cause things to break in an unexpected way.
3892
+ Check that all your Remotion packages are on the same version. If your dependencies depend on Remotion, make them peer dependencies. You can also run \`npx remotion versions\` from your terminal to see which versions are mismatching.`);
3626
3893
  }
3627
- return /* @__PURE__ */ jsx12(RegularSequence, {
3628
- ...props,
3629
- ref
3630
- });
3894
+ set();
3631
3895
  };
3632
- var SequenceInner = forwardRef3(SequenceRefForwardingFunction);
3633
- var Sequence = wrapInSchema(SequenceInner, sequenceSchema);
3634
3896
  var calcArgs = (fit, frameSize, canvasSize) => {
3635
3897
  switch (fit) {
3636
3898
  case "fill": {
@@ -3681,7 +3943,7 @@ var calcArgs = (fit, frameSize, canvasSize) => {
3681
3943
  };
3682
3944
  var CanvasRefForwardingFunction = ({ width, height, fit, className, style }, ref) => {
3683
3945
  const canvasRef = useRef7(null);
3684
- const draw = useCallback6((imageData) => {
3946
+ const draw = useCallback7((imageData) => {
3685
3947
  const canvas = canvasRef.current;
3686
3948
  const canvasWidth = width ?? imageData.displayWidth;
3687
3949
  const canvasHeight = height ?? imageData.displayHeight;
@@ -3873,7 +4135,19 @@ var resolveAnimatedImageSource = (src) => {
3873
4135
  }
3874
4136
  return new URL(src, window.origin).href;
3875
4137
  };
3876
- var AnimatedImage = forwardRef4(({
4138
+ var animatedImageSchema = {
4139
+ playbackRate: {
4140
+ type: "number",
4141
+ min: 0,
4142
+ max: 10,
4143
+ step: 0.1,
4144
+ default: 1,
4145
+ description: "Playback Rate"
4146
+ },
4147
+ ...sequenceStyleSchema,
4148
+ hidden: hiddenField
4149
+ };
4150
+ var AnimatedImageContent = forwardRef5(({
3877
4151
  src,
3878
4152
  width,
3879
4153
  height,
@@ -3980,6 +4254,52 @@ var AnimatedImage = forwardRef4(({
3980
4254
  ...props
3981
4255
  });
3982
4256
  });
4257
+ AnimatedImageContent.displayName = "AnimatedImageContent";
4258
+ var AnimatedImageInner = ({
4259
+ src,
4260
+ width,
4261
+ height,
4262
+ onError,
4263
+ fit,
4264
+ playbackRate,
4265
+ loopBehavior,
4266
+ id,
4267
+ className,
4268
+ style,
4269
+ durationInFrames,
4270
+ _experimentalControls: controls,
4271
+ ref,
4272
+ ...sequenceProps
4273
+ }) => {
4274
+ const { durationInFrames: videoDuration } = useVideoConfig();
4275
+ const resolvedDuration = durationInFrames ?? videoDuration;
4276
+ const animatedImageProps = {
4277
+ src,
4278
+ width,
4279
+ height,
4280
+ onError,
4281
+ fit,
4282
+ playbackRate,
4283
+ loopBehavior,
4284
+ id,
4285
+ className,
4286
+ style
4287
+ };
4288
+ return /* @__PURE__ */ jsx14(Sequence, {
4289
+ layout: "none",
4290
+ durationInFrames: resolvedDuration,
4291
+ name: "<AnimatedImage>",
4292
+ _experimentalControls: controls,
4293
+ ...sequenceProps,
4294
+ children: /* @__PURE__ */ jsx14(AnimatedImageContent, {
4295
+ ...animatedImageProps,
4296
+ ref
4297
+ })
4298
+ });
4299
+ };
4300
+ var AnimatedImage = wrapInSchema(AnimatedImageInner, animatedImageSchema);
4301
+ AnimatedImage.displayName = "AnimatedImage";
4302
+ addSequenceStackTraces(AnimatedImage);
3983
4303
  var cachedSupport = null;
3984
4304
  var isHtmlInCanvasSupported = () => {
3985
4305
  if (cachedSupport !== null) {
@@ -3993,6 +4313,7 @@ var isHtmlInCanvasSupported = () => {
3993
4313
  cachedSupport = typeof ctx?.drawElementImage === "function" && typeof canvas.requestPaint === "function" && typeof canvas.captureElementImage === "function";
3994
4314
  return cachedSupport;
3995
4315
  };
4316
+ 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).";
3996
4317
  function assertHtmlInCanvasDimensions(width, height) {
3997
4318
  if (typeof width !== "number" || typeof height !== "number") {
3998
4319
  throw new Error(`HtmlInCanvas: \`width\` and \`height\` must be numbers. Received width=${String(width)}, height=${String(height)}.`);
@@ -4018,30 +4339,16 @@ var defaultOnPaint = ({
4018
4339
  element.style.transform = transform.toString();
4019
4340
  };
4020
4341
  var HtmlInCanvasAncestorContext = createContext16(false);
4021
- var HtmlInCanvasInner = forwardRef5(({
4022
- width,
4023
- height,
4024
- _experimentalEffects: effects = [],
4025
- children,
4026
- onPaint,
4027
- onInit,
4028
- _experimentalControls: controls,
4029
- style,
4030
- durationInFrames,
4031
- ...sequenceProps
4032
- }, ref) => {
4033
- const isInsideAncestorHtmlInCanvas = useContext17(HtmlInCanvasAncestorContext);
4342
+ var HtmlInCanvasContent = forwardRef6(({ width, height, effects, children, onPaint, onInit, controls, style }, ref) => {
4343
+ const isInsideAncestorHtmlInCanvas = useContext18(HtmlInCanvasAncestorContext);
4034
4344
  assertHtmlInCanvasDimensions(width, height);
4035
4345
  const { continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
4036
4346
  if (!isHtmlInCanvasSupported()) {
4037
- cancelRender2(new Error("HTML in Canvas is not supported. Open this page in Chrome Canary with chrome://flags/#canvas-draw-element enabled."));
4347
+ cancelRender2(new Error(HTML_IN_CANVAS_UNSUPPORTED_MESSAGE));
4038
4348
  }
4039
- const { durationInFrames: videoDuration } = useVideoConfig();
4040
- const resolvedDuration = durationInFrames ?? videoDuration;
4041
- const frame = useCurrentFrame();
4042
4349
  const canvas2dRef = useRef9(null);
4043
4350
  const divRef = useRef9(null);
4044
- const setLayoutCanvasRef = useCallback7((node) => {
4351
+ const setLayoutCanvasRef = useCallback8((node) => {
4045
4352
  canvas2dRef.current = node;
4046
4353
  if (typeof ref === "function") {
4047
4354
  ref(node);
@@ -4051,11 +4358,12 @@ var HtmlInCanvasInner = forwardRef5(({
4051
4358
  }, [ref]);
4052
4359
  const [offscreenCanvas] = useState8(() => new OffscreenCanvas(1, 1));
4053
4360
  const chainState = useEffectChainState();
4054
- const memoizedEffects = useMemoizedEffects(flattenEffects(effects));
4361
+ const memoizedEffects = useMemoizedEffects({
4362
+ effects,
4363
+ overrideId: controls?.overrideId ?? null
4364
+ });
4055
4365
  const effectsRef = useRef9(memoizedEffects);
4056
4366
  effectsRef.current = memoizedEffects;
4057
- const frameRef = useRef9(frame);
4058
- frameRef.current = frame;
4059
4367
  const onPaintRef = useRef9(onPaint);
4060
4368
  onPaintRef.current = onPaint;
4061
4369
  const onInitRef = useRef9(onInit);
@@ -4063,7 +4371,7 @@ var HtmlInCanvasInner = forwardRef5(({
4063
4371
  const initializedRef = useRef9(false);
4064
4372
  const onInitCleanupRef = useRef9(null);
4065
4373
  const unmountedRef = useRef9(false);
4066
- const onPaintCb = useCallback7(async () => {
4374
+ const onPaintCb = useCallback8(async () => {
4067
4375
  const element = divRef.current;
4068
4376
  if (!element) {
4069
4377
  throw new Error("Canvas or scene element not found");
@@ -4112,7 +4420,6 @@ var HtmlInCanvasInner = forwardRef5(({
4112
4420
  source: offscreenCanvas,
4113
4421
  effects: effectsRef.current,
4114
4422
  output: canvas2dRef.current,
4115
- frame: frameRef.current,
4116
4423
  width,
4117
4424
  height
4118
4425
  });
@@ -4176,31 +4483,64 @@ var HtmlInCanvasInner = forwardRef5(({
4176
4483
  if (isInsideAncestorHtmlInCanvas) {
4177
4484
  throw new Error("<HtmlInCanvas> effects cannot be nested together. Chrome will only display the outer effect. Consider merging the effects into one if you can.");
4178
4485
  }
4486
+ return /* @__PURE__ */ jsx15(HtmlInCanvasAncestorContext.Provider, {
4487
+ value: true,
4488
+ children: /* @__PURE__ */ jsx15("canvas", {
4489
+ ref: setLayoutCanvasRef,
4490
+ width,
4491
+ height,
4492
+ style,
4493
+ children: /* @__PURE__ */ jsx15("div", {
4494
+ ref: divRef,
4495
+ style: innerStyle,
4496
+ children
4497
+ })
4498
+ })
4499
+ });
4500
+ });
4501
+ HtmlInCanvasContent.displayName = "HtmlInCanvasContent";
4502
+ var HtmlInCanvasInner = forwardRef6(({
4503
+ width,
4504
+ height,
4505
+ _experimentalEffects: effects = [],
4506
+ children,
4507
+ onPaint,
4508
+ onInit,
4509
+ _experimentalControls: controls,
4510
+ style,
4511
+ durationInFrames,
4512
+ name,
4513
+ ...sequenceProps
4514
+ }, ref) => {
4515
+ const { durationInFrames: videoDuration } = useVideoConfig();
4516
+ const resolvedDuration = durationInFrames ?? videoDuration;
4517
+ const memoizedEffectDefinitions = useMemoizedEffectDefinitions(effects);
4179
4518
  return /* @__PURE__ */ jsx15(Sequence, {
4180
4519
  durationInFrames: resolvedDuration,
4181
- name: "<HtmlInCanvas>",
4520
+ name: name ?? "<HtmlInCanvas>",
4182
4521
  _experimentalControls: controls,
4183
- _experimentalEffects: memoizedEffects,
4522
+ _experimentalEffects: memoizedEffectDefinitions,
4184
4523
  layout: "none",
4185
4524
  ...sequenceProps,
4186
- children: /* @__PURE__ */ jsx15(HtmlInCanvasAncestorContext.Provider, {
4187
- value: true,
4188
- children: /* @__PURE__ */ jsx15("canvas", {
4189
- ref: setLayoutCanvasRef,
4190
- width,
4191
- height,
4192
- style,
4193
- children: /* @__PURE__ */ jsx15("div", {
4194
- ref: divRef,
4195
- style: innerStyle,
4196
- children
4197
- })
4198
- })
4525
+ children: /* @__PURE__ */ jsx15(HtmlInCanvasContent, {
4526
+ ref,
4527
+ width,
4528
+ height,
4529
+ effects,
4530
+ onPaint,
4531
+ onInit,
4532
+ controls,
4533
+ style,
4534
+ children
4199
4535
  })
4200
4536
  });
4201
4537
  });
4202
4538
  HtmlInCanvasInner.displayName = "HtmlInCanvas";
4203
- var HtmlInCanvasWrapped = wrapInSchema(HtmlInCanvasInner, sequenceStyleSchema);
4539
+ var htmlInCanvasSchema = {
4540
+ ...sequenceStyleSchema,
4541
+ hidden: hiddenField
4542
+ };
4543
+ var HtmlInCanvasWrapped = wrapInSchema(HtmlInCanvasInner, htmlInCanvasSchema);
4204
4544
  var HtmlInCanvas = Object.assign(HtmlInCanvasWrapped, {
4205
4545
  isSupported: isHtmlInCanvasSupported
4206
4546
  });
@@ -4247,7 +4587,7 @@ var RenderAssetManager = createContext17({
4247
4587
  var RenderAssetManagerProvider = ({ children, collectAssets }) => {
4248
4588
  const [renderAssets, setRenderAssets] = useState9([]);
4249
4589
  const renderAssetsRef = useRef10([]);
4250
- const registerRenderAsset = useCallback8((renderAsset) => {
4590
+ const registerRenderAsset = useCallback9((renderAsset) => {
4251
4591
  validateRenderAsset(renderAsset);
4252
4592
  renderAssetsRef.current = [...renderAssetsRef.current, renderAsset];
4253
4593
  setRenderAssets(renderAssetsRef.current);
@@ -4264,7 +4604,7 @@ var RenderAssetManagerProvider = ({ children, collectAssets }) => {
4264
4604
  };
4265
4605
  }, []);
4266
4606
  }
4267
- const unregisterRenderAsset = useCallback8((id) => {
4607
+ const unregisterRenderAsset = useCallback9((id) => {
4268
4608
  renderAssetsRef.current = renderAssetsRef.current.filter((a) => a.id !== id);
4269
4609
  setRenderAssets(renderAssetsRef.current);
4270
4610
  }, []);
@@ -4292,7 +4632,7 @@ var RenderAssetManagerProvider = ({ children, collectAssets }) => {
4292
4632
  };
4293
4633
  var ArtifactThumbnail = Symbol("Thumbnail");
4294
4634
  var Artifact = ({ filename, content, downloadBehavior }) => {
4295
- const { registerRenderAsset, unregisterRenderAsset } = useContext18(RenderAssetManager);
4635
+ const { registerRenderAsset, unregisterRenderAsset } = useContext19(RenderAssetManager);
4296
4636
  const env = useRemotionEnvironment();
4297
4637
  const frame = useCurrentFrame();
4298
4638
  const [id] = useState10(() => {
@@ -4482,7 +4822,7 @@ var getSrcWithoutHash = (src) => {
4482
4822
  return src.slice(0, hashIndex);
4483
4823
  };
4484
4824
  var usePreload = (src) => {
4485
- const preloads2 = useContext19(PreloadContext);
4825
+ const preloads2 = useContext20(PreloadContext);
4486
4826
  const hashFragmentIndex = removeAndGetHashFragment(src);
4487
4827
  const withoutHashFragment = getSrcWithoutHash(src);
4488
4828
  if (!preloads2[withoutHashFragment]) {
@@ -4664,6 +5004,9 @@ var validateMediaProps = (props, component) => {
4664
5004
  if (typeof props.playbackRate === "number" && (isNaN(props.playbackRate) || !Number.isFinite(props.playbackRate) || props.playbackRate <= 0)) {
4665
5005
  throw new TypeError(`You have passed a playbackRate of ${props.playbackRate} to your <${component} /> component. Playback rate must be a real number above 0.`);
4666
5006
  }
5007
+ if (typeof props.preservePitch !== "boolean" && typeof props.preservePitch !== "undefined") {
5008
+ throw new TypeError(`'preservePitch' must be a boolean or undefined but got '${typeof props.preservePitch}' instead`);
5009
+ }
4667
5010
  };
4668
5011
  var validateStartFromProps = (startFrom, endAt) => {
4669
5012
  if (typeof startFrom !== "undefined") {
@@ -5009,7 +5352,7 @@ var SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled })
5009
5352
  }, []);
5010
5353
  const prevEndTimes = useRef11({ scheduledEndTime: null, mediaEndTime: null });
5011
5354
  const nodesToResume = useRef11(new Map);
5012
- const unscheduleAudioNode = useCallback9((node) => {
5355
+ const unscheduleAudioNode = useCallback10((node) => {
5013
5356
  nodesToResume.current.delete(node);
5014
5357
  }, []);
5015
5358
  const scheduleAudioNode = useMemo22(() => {
@@ -5057,7 +5400,7 @@ var SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled })
5057
5400
  };
5058
5401
  };
5059
5402
  }, [ctxAndGain, logLevel]);
5060
- const resume = useCallback9(() => {
5403
+ const resume = useCallback10(() => {
5061
5404
  if (!ctxAndGain) {
5062
5405
  return Promise.resolve();
5063
5406
  }
@@ -5084,10 +5427,10 @@ var SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled })
5084
5427
  });
5085
5428
  return resumePromise.catch(() => {});
5086
5429
  }, [ctxAndGain, logLevel]);
5087
- const getIsResumingAudioContext = useCallback9(() => {
5430
+ const getIsResumingAudioContext = useCallback10(() => {
5088
5431
  return isResuming.current;
5089
5432
  }, []);
5090
- const suspend = useCallback9(() => {
5433
+ const suspend = useCallback10(() => {
5091
5434
  if (!ctxAndGain) {
5092
5435
  return;
5093
5436
  }
@@ -5133,7 +5476,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
5133
5476
  const logLevel = useLogLevel();
5134
5477
  const mountTime = useMountTime();
5135
5478
  const env = useRemotionEnvironment();
5136
- const audioCtx = useContext20(SharedAudioContext);
5479
+ const audioCtx = useContext21(SharedAudioContext);
5137
5480
  const audioContext = audioCtx?.audioContext ?? null;
5138
5481
  const resume = audioCtx?.resume;
5139
5482
  const refs = useMemo22(() => {
@@ -5160,7 +5503,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
5160
5503
  };
5161
5504
  }, [refs]);
5162
5505
  const takenAudios = useRef11(new Array(numberOfAudioTags).fill(false));
5163
- const rerenderAudios = useCallback9(() => {
5506
+ const rerenderAudios = useCallback10(() => {
5164
5507
  refs.forEach(({ ref, id }) => {
5165
5508
  const data = audios.current?.find((a) => a.id === id);
5166
5509
  const { current } = ref;
@@ -5181,7 +5524,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
5181
5524
  });
5182
5525
  });
5183
5526
  }, [refs]);
5184
- const registerAudio = useCallback9((options) => {
5527
+ const registerAudio = useCallback10((options) => {
5185
5528
  const { aud, audioId, premounting, postmounting } = options;
5186
5529
  const found = audios.current?.find((a) => a.audioId === audioId);
5187
5530
  if (found) {
@@ -5210,7 +5553,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
5210
5553
  rerenderAudios();
5211
5554
  return newElem;
5212
5555
  }, [numberOfAudioTags, refs, rerenderAudios]);
5213
- const unregisterAudio = useCallback9((id) => {
5556
+ const unregisterAudio = useCallback10((id) => {
5214
5557
  const cloned = [...takenAudios.current];
5215
5558
  const index = refs.findIndex((r) => r.id === id);
5216
5559
  if (index === -1) {
@@ -5221,7 +5564,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
5221
5564
  audios.current = audios.current?.filter((a) => a.id !== id);
5222
5565
  rerenderAudios();
5223
5566
  }, [refs, rerenderAudios]);
5224
- const updateAudio = useCallback9(({
5567
+ const updateAudio = useCallback10(({
5225
5568
  aud,
5226
5569
  audioId,
5227
5570
  id,
@@ -5255,7 +5598,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
5255
5598
  rerenderAudios();
5256
5599
  }
5257
5600
  }, [rerenderAudios]);
5258
- const playAllAudios = useCallback9(() => {
5601
+ const playAllAudios = useCallback10(() => {
5259
5602
  refs.forEach((ref) => {
5260
5603
  const audio = audios.current.find((a) => a.el === ref.ref);
5261
5604
  if (audio?.premounting) {
@@ -5308,8 +5651,8 @@ var useSharedAudio = ({
5308
5651
  premounting,
5309
5652
  postmounting
5310
5653
  }) => {
5311
- const audioCtx = useContext20(SharedAudioContext);
5312
- const tagsCtx = useContext20(SharedAudioTagsContext);
5654
+ const audioCtx = useContext21(SharedAudioContext);
5655
+ const tagsCtx = useContext21(SharedAudioTagsContext);
5313
5656
  const [elem] = useState12(() => {
5314
5657
  if (tagsCtx && tagsCtx.numberOfAudioTags > 0) {
5315
5658
  return tagsCtx.registerAudio({ aud, audioId, premounting, postmounting });
@@ -5488,7 +5831,7 @@ var useVolume = ({
5488
5831
  const audioStuffRef = useRef13(null);
5489
5832
  const currentVolumeRef = useRef13(volume);
5490
5833
  currentVolumeRef.current = volume;
5491
- const sharedAudioContext = useContext21(SharedAudioContext);
5834
+ const sharedAudioContext = useContext22(SharedAudioContext);
5492
5835
  if (!sharedAudioContext) {
5493
5836
  throw new Error("useAmplification must be used within a SharedAudioContext");
5494
5837
  }
@@ -5553,7 +5896,7 @@ var useVolume = ({
5553
5896
  return audioStuffRef;
5554
5897
  };
5555
5898
  var useMediaStartsAt = () => {
5556
- const parentSequence = useContext22(SequenceContext);
5899
+ const parentSequence = useContext23(SequenceContext);
5557
5900
  const startsAt = Math.min(0, parentSequence?.relativeFrom ?? 0);
5558
5901
  return startsAt;
5559
5902
  };
@@ -5642,7 +5985,7 @@ var useBasicMediaInTimeline = ({
5642
5985
  if (!src) {
5643
5986
  throw new Error("No src passed");
5644
5987
  }
5645
- const parentSequence = useContext23(SequenceContext);
5988
+ const parentSequence = useContext24(SequenceContext);
5646
5989
  const [initialVolume] = useState13(() => volume);
5647
5990
  const duration = getTimelineDuration({
5648
5991
  compositionDurationInFrames: sequenceDurationInFrames,
@@ -5709,8 +6052,8 @@ var useImageInTimeline = ({
5709
6052
  loopDisplay,
5710
6053
  controls
5711
6054
  }) => {
5712
- const parentSequence = useContext23(SequenceContext);
5713
- const { registerSequence, unregisterSequence } = useContext23(SequenceManager);
6055
+ const parentSequence = useContext24(SequenceContext);
6056
+ const { registerSequence, unregisterSequence } = useContext24(SequenceManager);
5714
6057
  const { durationInFrames } = useVideoConfig();
5715
6058
  const mediaStartsAt = useMediaStartsAt();
5716
6059
  const { duration, nonce, rootId, finalDisplayName } = useBasicMediaInTimeline({
@@ -5791,9 +6134,9 @@ var useMediaInTimeline = ({
5791
6134
  postmountDisplay,
5792
6135
  loopDisplay
5793
6136
  }) => {
5794
- const parentSequence = useContext23(SequenceContext);
6137
+ const parentSequence = useContext24(SequenceContext);
5795
6138
  const startsAt = useMediaStartsAt();
5796
- const { registerSequence, unregisterSequence } = useContext23(SequenceManager);
6139
+ const { registerSequence, unregisterSequence } = useContext24(SequenceManager);
5797
6140
  const { durationInFrames } = useVideoConfig();
5798
6141
  const mediaStartsAt = useMediaStartsAt();
5799
6142
  const { volumes, duration, doesVolumeChange, nonce, rootId, finalDisplayName } = useBasicMediaInTimeline({
@@ -5875,7 +6218,7 @@ var useBufferManager = (logLevel, mountTime) => {
5875
6218
  const env = useRemotionEnvironment();
5876
6219
  const rendering = env.isRendering;
5877
6220
  const buffering = useRef14(false);
5878
- const addBlock = useCallback10((block) => {
6221
+ const addBlock = useCallback11((block) => {
5879
6222
  if (rendering) {
5880
6223
  return {
5881
6224
  unblock: () => {
@@ -5901,7 +6244,7 @@ var useBufferManager = (logLevel, mountTime) => {
5901
6244
  }
5902
6245
  };
5903
6246
  }, [rendering]);
5904
- const listenForBuffering = useCallback10((callback) => {
6247
+ const listenForBuffering = useCallback11((callback) => {
5905
6248
  setOnBufferingCallbacks((c) => [...c, callback]);
5906
6249
  return {
5907
6250
  remove: () => {
@@ -5909,7 +6252,7 @@ var useBufferManager = (logLevel, mountTime) => {
5909
6252
  }
5910
6253
  };
5911
6254
  }, []);
5912
- const listenForResume = useCallback10((callback) => {
6255
+ const listenForResume = useCallback11((callback) => {
5913
6256
  setOnResumeCallbacks((c) => [...c, callback]);
5914
6257
  return {
5915
6258
  remove: () => {
@@ -5953,7 +6296,7 @@ var useBufferManager = (logLevel, mountTime) => {
5953
6296
  };
5954
6297
  var BufferingContextReact = React21.createContext(null);
5955
6298
  var BufferingProvider = ({ children }) => {
5956
- const { logLevel, mountTime } = useContext24(LogLevelContext);
6299
+ const { logLevel, mountTime } = useContext25(LogLevelContext);
5957
6300
  const bufferManager = useBufferManager(logLevel ?? "info", mountTime);
5958
6301
  return /* @__PURE__ */ jsx21(BufferingContextReact.Provider, {
5959
6302
  value: bufferManager,
@@ -5983,7 +6326,7 @@ var useIsPlayerBuffering = (bufferManager) => {
5983
6326
  return isBuffering;
5984
6327
  };
5985
6328
  var useBufferState = () => {
5986
- const buffer = useContext25(BufferingContextReact);
6329
+ const buffer = useContext26(BufferingContextReact);
5987
6330
  const logLevel = useLogLevel();
5988
6331
  const addBlock = buffer ? buffer.addBlock : null;
5989
6332
  return useMemo25(() => ({
@@ -6023,7 +6366,7 @@ var useBufferUntilFirstFrame = ({
6023
6366
  }) => {
6024
6367
  const bufferingRef = useRef15(false);
6025
6368
  const { delayPlayback } = useBufferState();
6026
- const bufferUntilFirstFrame = useCallback11((requestedTime) => {
6369
+ const bufferUntilFirstFrame = useCallback12((requestedTime) => {
6027
6370
  if (mediaType !== "video") {
6028
6371
  return;
6029
6372
  }
@@ -6394,6 +6737,23 @@ function checkInfiniteRange(name, arr) {
6394
6737
  }
6395
6738
  }
6396
6739
  }
6740
+ function assertValidInterpolateEasingOption(easing, inputRangeLength) {
6741
+ if (easing === undefined) {
6742
+ return;
6743
+ }
6744
+ if (typeof easing === "function") {
6745
+ return;
6746
+ }
6747
+ const expectedLength = inputRangeLength - 1;
6748
+ if (easing.length !== expectedLength) {
6749
+ throw new Error(`When easing is an array, it must have one entry per segment between keyframes (length inputRange.length - 1 = ${expectedLength}), but got length ${easing.length}`);
6750
+ }
6751
+ for (let i = 0;i < easing.length; i++) {
6752
+ if (typeof easing[i] !== "function") {
6753
+ throw new Error(`easing[${i}] must be a function`);
6754
+ }
6755
+ }
6756
+ }
6397
6757
  function interpolate(input, inputRange, outputRange, options) {
6398
6758
  if (typeof input === "undefined") {
6399
6759
  throw new Error("input can not be undefined");
@@ -6410,7 +6770,18 @@ function interpolate(input, inputRange, outputRange, options) {
6410
6770
  checkInfiniteRange("inputRange", inputRange);
6411
6771
  checkInfiniteRange("outputRange", outputRange);
6412
6772
  checkValidInputRange(inputRange);
6413
- const easing = options?.easing ?? ((num) => num);
6773
+ assertValidInterpolateEasingOption(options?.easing, inputRange.length);
6774
+ const easingOption = options?.easing;
6775
+ const defaultEasing = (num) => num;
6776
+ const resolveEasingForSegment = (segmentIndex) => {
6777
+ if (easingOption === undefined) {
6778
+ return defaultEasing;
6779
+ }
6780
+ if (typeof easingOption === "function") {
6781
+ return easingOption;
6782
+ }
6783
+ return easingOption[segmentIndex];
6784
+ };
6414
6785
  let extrapolateLeft = "extend";
6415
6786
  if (options?.extrapolateLeft !== undefined) {
6416
6787
  extrapolateLeft = options.extrapolateLeft;
@@ -6424,7 +6795,7 @@ function interpolate(input, inputRange, outputRange, options) {
6424
6795
  }
6425
6796
  const range = findRange(input, inputRange);
6426
6797
  return interpolateFunction(input, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
6427
- easing,
6798
+ easing: resolveEasingForSegment(range),
6428
6799
  extrapolateLeft,
6429
6800
  extrapolateRight
6430
6801
  });
@@ -6489,6 +6860,7 @@ var useMediaPlayback = ({
6489
6860
  src,
6490
6861
  mediaType,
6491
6862
  playbackRate: localPlaybackRate,
6863
+ preservePitch = true,
6492
6864
  onlyWarnForMediaSeekingError,
6493
6865
  acceptableTimeshift,
6494
6866
  pauseWhenBuffering,
@@ -6500,7 +6872,7 @@ var useMediaPlayback = ({
6500
6872
  const frame = useCurrentFrame();
6501
6873
  const absoluteFrame = useTimelinePosition();
6502
6874
  const [playing] = usePlayingState();
6503
- const buffering = useContext26(BufferingContextReact);
6875
+ const buffering = useContext27(BufferingContextReact);
6504
6876
  const { fps } = useVideoConfig();
6505
6877
  const mediaStartsAt = useMediaStartsAt();
6506
6878
  const lastSeekDueToShift = useRef17(null);
@@ -6511,7 +6883,7 @@ var useMediaPlayback = ({
6511
6883
  throw new Error("useMediaPlayback must be used inside a <BufferingContext>");
6512
6884
  }
6513
6885
  const isVariableFpsVideoMap = useRef17({});
6514
- const onVariableFpsVideoDetected = useCallback12(() => {
6886
+ const onVariableFpsVideoDetected = useCallback13(() => {
6515
6887
  if (!src) {
6516
6888
  return;
6517
6889
  }
@@ -6606,7 +6978,10 @@ var useMediaPlayback = ({
6606
6978
  if (mediaRef.current && mediaRef.current.playbackRate !== playbackRateToSet) {
6607
6979
  mediaRef.current.playbackRate = playbackRateToSet;
6608
6980
  }
6609
- }, [mediaRef, playbackRate]);
6981
+ if (mediaRef.current && mediaRef.current.preservesPitch !== preservePitch) {
6982
+ mediaRef.current.preservesPitch = preservePitch;
6983
+ }
6984
+ }, [mediaRef, playbackRate, preservePitch]);
6610
6985
  useEffect12(() => {
6611
6986
  const tagName = mediaType === "audio" ? "<Html5Audio>" : "<Html5Video>";
6612
6987
  if (!mediaRef.current) {
@@ -6788,15 +7163,15 @@ var SetMediaVolumeContext = createContext22({
6788
7163
  }
6789
7164
  });
6790
7165
  var useMediaVolumeState = () => {
6791
- const { mediaVolume } = useContext27(MediaVolumeContext);
6792
- const { setMediaVolume } = useContext27(SetMediaVolumeContext);
7166
+ const { mediaVolume } = useContext28(MediaVolumeContext);
7167
+ const { setMediaVolume } = useContext28(SetMediaVolumeContext);
6793
7168
  return useMemo27(() => {
6794
7169
  return [mediaVolume, setMediaVolume];
6795
7170
  }, [mediaVolume, setMediaVolume]);
6796
7171
  };
6797
7172
  var useMediaMutedState = () => {
6798
- const { mediaMuted } = useContext27(MediaVolumeContext);
6799
- const { setMediaMuted } = useContext27(SetMediaVolumeContext);
7173
+ const { mediaMuted } = useContext28(MediaVolumeContext);
7174
+ const { setMediaMuted } = useContext28(SetMediaVolumeContext);
6800
7175
  return useMemo27(() => {
6801
7176
  return [mediaMuted, setMediaMuted];
6802
7177
  }, [mediaMuted, setMediaMuted]);
@@ -6816,6 +7191,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
6816
7191
  volume,
6817
7192
  muted,
6818
7193
  playbackRate,
7194
+ preservePitch,
6819
7195
  shouldPreMountAudioTags,
6820
7196
  src,
6821
7197
  onDuration,
@@ -6846,14 +7222,12 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
6846
7222
  const [mediaVolume] = useMediaVolumeState();
6847
7223
  const [mediaMuted] = useMediaMutedState();
6848
7224
  const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
6849
- const { hidden } = useContext28(SequenceVisibilityToggleContext);
6850
7225
  if (!src) {
6851
7226
  throw new TypeError("No 'src' was passed to <Html5Audio>.");
6852
7227
  }
6853
7228
  const preloadedSrc = usePreload(src);
6854
- const sequenceContext = useContext28(SequenceContext);
7229
+ const sequenceContext = useContext29(SequenceContext);
6855
7230
  const [timelineId] = useState16(() => String(Math.random()));
6856
- const isSequenceHidden = hidden[timelineId] ?? false;
6857
7231
  const userPreferredVolume = evaluateVolume({
6858
7232
  frame: volumePropFrame,
6859
7233
  volume,
@@ -6867,7 +7241,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
6867
7241
  });
6868
7242
  const propsToPass = useMemo28(() => {
6869
7243
  return {
6870
- muted: muted || mediaMuted || isSequenceHidden || userPreferredVolume <= 0,
7244
+ muted: muted || mediaMuted || userPreferredVolume <= 0,
6871
7245
  src: preloadedSrc,
6872
7246
  loop: _remotionInternalNativeLoopPassed,
6873
7247
  crossOrigin: crossOriginValue,
@@ -6875,7 +7249,6 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
6875
7249
  };
6876
7250
  }, [
6877
7251
  _remotionInternalNativeLoopPassed,
6878
- isSequenceHidden,
6879
7252
  mediaMuted,
6880
7253
  muted,
6881
7254
  nativeProps,
@@ -6920,6 +7293,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
6920
7293
  src,
6921
7294
  mediaType: "audio",
6922
7295
  playbackRate: playbackRate ?? 1,
7296
+ preservePitch,
6923
7297
  onlyWarnForMediaSeekingError: false,
6924
7298
  acceptableTimeshift: acceptableTimeShiftInSeconds ?? null,
6925
7299
  isPremounting: Boolean(sequenceContext?.premounting),
@@ -6982,7 +7356,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
6982
7356
  ...propsToPass
6983
7357
  });
6984
7358
  };
6985
- var AudioForPreview = forwardRef6(AudioForDevelopmentForwardRefFunction);
7359
+ var AudioForPreview = forwardRef7(AudioForDevelopmentForwardRefFunction);
6986
7360
  var AudioForRenderingRefForwardingFunction = (props, ref) => {
6987
7361
  const audioRef = useRef19(null);
6988
7362
  const {
@@ -7001,13 +7375,14 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
7001
7375
  loopVolumeCurveBehavior,
7002
7376
  pauseWhenBuffering,
7003
7377
  audioStreamIndex,
7378
+ preservePitch: _preservePitch,
7004
7379
  ...nativeProps
7005
7380
  } = props;
7006
7381
  const absoluteFrame = useTimelinePosition();
7007
7382
  const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
7008
7383
  const frame = useCurrentFrame();
7009
- const sequenceContext = useContext29(SequenceContext);
7010
- const { registerRenderAsset, unregisterRenderAsset } = useContext29(RenderAssetManager);
7384
+ const sequenceContext = useContext30(SequenceContext);
7385
+ const { registerRenderAsset, unregisterRenderAsset } = useContext30(RenderAssetManager);
7011
7386
  const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
7012
7387
  const id = useMemo29(() => `audio-${random(props.src ?? "")}-${sequenceContext?.relativeFrom}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.durationInFrames}`, [
7013
7388
  props.src,
@@ -7114,9 +7489,9 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
7114
7489
  onError: onNativeError
7115
7490
  });
7116
7491
  };
7117
- var AudioForRendering = forwardRef7(AudioForRenderingRefForwardingFunction);
7492
+ var AudioForRendering = forwardRef8(AudioForRenderingRefForwardingFunction);
7118
7493
  var AudioRefForwardingFunction = (props, ref) => {
7119
- const audioTagsContext = useContext30(SharedAudioTagsContext);
7494
+ const audioTagsContext = useContext31(SharedAudioTagsContext);
7120
7495
  const {
7121
7496
  startFrom,
7122
7497
  endAt,
@@ -7135,12 +7510,12 @@ var AudioRefForwardingFunction = (props, ref) => {
7135
7510
  if (environment.isClientSideRendering) {
7136
7511
  throw new Error("<Html5Audio> is not supported in @remotion/web-renderer. Use <Audio> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");
7137
7512
  }
7138
- const { durations, setDurations } = useContext30(DurationsContext);
7513
+ const { durations, setDurations } = useContext31(DurationsContext);
7139
7514
  if (typeof props.src !== "string") {
7140
7515
  throw new TypeError(`The \`<Html5Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
7141
7516
  }
7142
7517
  const preloadedSrc = usePreload(props.src);
7143
- const onError = useCallback13((e) => {
7518
+ const onError = useCallback14((e) => {
7144
7519
  console.log(e.currentTarget.error);
7145
7520
  const errMessage = `Could not play audio with src ${preloadedSrc}: ${e.currentTarget.error}. See https://remotion.dev/docs/media-playback-error for help.`;
7146
7521
  if (loop) {
@@ -7154,7 +7529,7 @@ var AudioRefForwardingFunction = (props, ref) => {
7154
7529
  console.warn(errMessage);
7155
7530
  }
7156
7531
  }, [loop, onRemotionError, preloadedSrc]);
7157
- const onDuration = useCallback13((src, durationInSeconds) => {
7532
+ const onDuration = useCallback14((src, durationInSeconds) => {
7158
7533
  setDurations({ type: "got-duration", durationInSeconds, src });
7159
7534
  }, [setDurations]);
7160
7535
  const durationFetched = durations[getAbsoluteSrc(preloadedSrc)] ?? durations[getAbsoluteSrc(props.src)];
@@ -7204,7 +7579,11 @@ var AudioRefForwardingFunction = (props, ref) => {
7204
7579
  })
7205
7580
  });
7206
7581
  }
7207
- validateMediaProps({ playbackRate: props.playbackRate, volume: props.volume }, "Html5Audio");
7582
+ validateMediaProps({
7583
+ playbackRate: props.playbackRate,
7584
+ preservePitch: props.preservePitch,
7585
+ volume: props.volume
7586
+ }, "Html5Audio");
7208
7587
  if (environment.isRendering) {
7209
7588
  return /* @__PURE__ */ jsx24(AudioForRendering, {
7210
7589
  onDuration,
@@ -7227,7 +7606,7 @@ var AudioRefForwardingFunction = (props, ref) => {
7227
7606
  showInTimeline: showInTimeline ?? true
7228
7607
  });
7229
7608
  };
7230
- var Html5Audio = forwardRef8(AudioRefForwardingFunction);
7609
+ var Html5Audio = forwardRef9(AudioRefForwardingFunction);
7231
7610
  addSequenceStackTraces(Html5Audio);
7232
7611
  var Audio = Html5Audio;
7233
7612
  var kSplineTableSize = 11;
@@ -7244,11 +7623,11 @@ var IFrameRefForwarding = ({
7244
7623
  retries: delayRenderRetries ?? undefined,
7245
7624
  timeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined
7246
7625
  }));
7247
- const didLoad = useCallback14((e) => {
7626
+ const didLoad = useCallback15((e) => {
7248
7627
  continueRender2(handle);
7249
7628
  onLoad?.(e);
7250
7629
  }, [handle, onLoad, continueRender2]);
7251
- const didGetError = useCallback14((e) => {
7630
+ const didGetError = useCallback15((e) => {
7252
7631
  continueRender2(handle);
7253
7632
  if (onError) {
7254
7633
  onError(e);
@@ -7264,7 +7643,7 @@ var IFrameRefForwarding = ({
7264
7643
  onLoad: didLoad
7265
7644
  });
7266
7645
  };
7267
- var IFrame = forwardRef9(IFrameRefForwarding);
7646
+ var IFrame = forwardRef10(IFrameRefForwarding);
7268
7647
  function exponentialBackoff(errorCount) {
7269
7648
  return 1000 * 2 ** (errorCount - 1);
7270
7649
  }
@@ -7274,7 +7653,7 @@ function truncateSrcForLabel(src) {
7274
7653
  }
7275
7654
  return src;
7276
7655
  }
7277
- var ImgInner = ({
7656
+ var ImgContent = ({
7278
7657
  onError,
7279
7658
  maxRetries = 2,
7280
7659
  src,
@@ -7283,21 +7662,13 @@ var ImgInner = ({
7283
7662
  delayRenderTimeoutInMilliseconds,
7284
7663
  onImageFrame,
7285
7664
  crossOrigin,
7286
- showInTimeline,
7287
- name,
7288
- stack,
7289
7665
  ref,
7290
- _experimentalControls: controls,
7291
7666
  ...props2
7292
7667
  }) => {
7293
7668
  const imageRef = useRef20(null);
7294
7669
  const errors = useRef20({});
7295
7670
  const { delayPlayback } = useBufferState();
7296
- const sequenceContext = useContext31(SequenceContext);
7297
- const [timelineId] = useState18(() => String(Math.random()));
7298
- if (!src) {
7299
- throw new Error('No "src" prop was passed to <Img>.');
7300
- }
7671
+ const sequenceContext = useContext32(SequenceContext);
7301
7672
  const _propsValid = true;
7302
7673
  if (!_propsValid) {
7303
7674
  throw new Error("typecheck error");
@@ -7305,19 +7676,8 @@ var ImgInner = ({
7305
7676
  useImperativeHandle6(ref, () => {
7306
7677
  return imageRef.current;
7307
7678
  }, []);
7308
- useImageInTimeline({
7309
- src,
7310
- displayName: name ?? null,
7311
- id: timelineId,
7312
- stack: stack ?? null,
7313
- showInTimeline: showInTimeline ?? true,
7314
- premountDisplay: sequenceContext?.premountDisplay ?? null,
7315
- postmountDisplay: sequenceContext?.postmountDisplay ?? null,
7316
- loopDisplay: undefined,
7317
- controls: controls ?? null
7318
- });
7319
7679
  const actualSrc = usePreload(src);
7320
- const retryIn = useCallback15((timeout) => {
7680
+ const retryIn = useCallback16((timeout) => {
7321
7681
  if (!imageRef.current) {
7322
7682
  return;
7323
7683
  }
@@ -7335,7 +7695,7 @@ var ImgInner = ({
7335
7695
  }, timeout);
7336
7696
  }, []);
7337
7697
  const { delayRender: delayRender2, continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
7338
- const didGetError = useCallback15((e) => {
7698
+ const didGetError = useCallback16((e) => {
7339
7699
  if (!errors.current) {
7340
7700
  return;
7341
7701
  }
@@ -7437,7 +7797,44 @@ var ImgInner = ({
7437
7797
  decoding: "sync"
7438
7798
  });
7439
7799
  };
7440
- var Img = wrapInSchema(ImgInner, sequenceStyleSchema);
7800
+ var ImgInner = ({
7801
+ hidden,
7802
+ name,
7803
+ stack,
7804
+ showInTimeline,
7805
+ src,
7806
+ _experimentalControls: controls,
7807
+ ...props2
7808
+ }) => {
7809
+ const sequenceContext = useContext32(SequenceContext);
7810
+ const [timelineId] = useState18(() => String(Math.random()));
7811
+ if (!src) {
7812
+ throw new Error('No "src" prop was passed to <Img>.');
7813
+ }
7814
+ useImageInTimeline({
7815
+ src,
7816
+ displayName: name ?? null,
7817
+ id: timelineId,
7818
+ stack: stack ?? null,
7819
+ showInTimeline: showInTimeline ?? true,
7820
+ premountDisplay: sequenceContext?.premountDisplay ?? null,
7821
+ postmountDisplay: sequenceContext?.postmountDisplay ?? null,
7822
+ loopDisplay: undefined,
7823
+ controls: controls ?? null
7824
+ });
7825
+ if (hidden) {
7826
+ return null;
7827
+ }
7828
+ return /* @__PURE__ */ jsx26(ImgContent, {
7829
+ src,
7830
+ ...props2
7831
+ });
7832
+ };
7833
+ var imgSchema = {
7834
+ ...sequenceStyleSchema,
7835
+ hidden: hiddenField
7836
+ };
7837
+ var Img = wrapInSchema(ImgInner, imgSchema);
7441
7838
  addSequenceStackTraces(Img);
7442
7839
  var compositionsRef = React28.createRef();
7443
7840
  var CompositionManagerProvider = ({
@@ -7451,14 +7848,14 @@ var CompositionManagerProvider = ({
7451
7848
  const [canvasContent, setCanvasContent] = useState19(initialCanvasContent);
7452
7849
  const [compositions, setCompositions] = useState19(initialCompositions);
7453
7850
  const currentcompositionsRef = useRef21(compositions);
7454
- const updateCompositions = useCallback16((updateComps) => {
7851
+ const updateCompositions = useCallback17((updateComps) => {
7455
7852
  setCompositions((comps) => {
7456
7853
  const updated = updateComps(comps);
7457
7854
  currentcompositionsRef.current = updated;
7458
7855
  return updated;
7459
7856
  });
7460
7857
  }, []);
7461
- const registerComposition = useCallback16((comp) => {
7858
+ const registerComposition = useCallback17((comp) => {
7462
7859
  updateCompositions((comps) => {
7463
7860
  if (comps.find((c2) => c2.id === comp.id)) {
7464
7861
  throw new Error(`Multiple composition with id ${comp.id} are registered.`);
@@ -7466,12 +7863,12 @@ var CompositionManagerProvider = ({
7466
7863
  return [...comps, comp];
7467
7864
  });
7468
7865
  }, [updateCompositions]);
7469
- const unregisterComposition = useCallback16((id) => {
7866
+ const unregisterComposition = useCallback17((id) => {
7470
7867
  setCompositions((comps) => {
7471
7868
  return comps.filter((c2) => c2.id !== id);
7472
7869
  });
7473
7870
  }, []);
7474
- const registerFolder = useCallback16((name, parent, nonce) => {
7871
+ const registerFolder = useCallback17((name, parent, nonce) => {
7475
7872
  setFolders((prevFolders) => {
7476
7873
  return [
7477
7874
  ...prevFolders,
@@ -7483,7 +7880,7 @@ var CompositionManagerProvider = ({
7483
7880
  ];
7484
7881
  });
7485
7882
  }, []);
7486
- const unregisterFolder = useCallback16((name, parent) => {
7883
+ const unregisterFolder = useCallback17((name, parent) => {
7487
7884
  setFolders((prevFolders) => {
7488
7885
  return prevFolders.filter((p) => !(p.name === name && p.parent === parent));
7489
7886
  });
@@ -7583,16 +7980,31 @@ var makeDefaultPreviewCSS = (scope, backgroundColor) => {
7583
7980
  }
7584
7981
  `;
7585
7982
  };
7586
- var defineEffect = (definition) => definition;
7587
- var createDescriptor = (definition, params) => {
7588
- const widened = definition;
7589
- return {
7983
+ var disabledEffectField = {
7984
+ type: "boolean",
7985
+ default: false,
7986
+ description: "Disabled"
7987
+ };
7988
+ var createEffect = (definition) => {
7989
+ const userCalculateKey = definition.calculateKey;
7990
+ const widened = {
7991
+ ...definition,
7992
+ calculateKey: (params) => {
7993
+ const disabled = params.disabled ?? false;
7994
+ return `${userCalculateKey(params)}-disabled-${disabled}`;
7995
+ },
7996
+ schema: {
7997
+ disabled: disabledEffectField,
7998
+ ...definition.schema
7999
+ }
8000
+ };
8001
+ const factory = (params = {}) => ({
7590
8002
  definition: widened,
7591
8003
  params,
7592
- stack: new Error().stack,
7593
8004
  effectKey: widened.calculateKey(params),
7594
8005
  memoized: false
7595
- };
8006
+ });
8007
+ return factory;
7596
8008
  };
7597
8009
  var REMOTION_STUDIO_CONTAINER_ELEMENT = "__remotion-studio-container";
7598
8010
  var getPreviewDomElement = () => {
@@ -7618,7 +8030,7 @@ var waitForRoot = (fn) => {
7618
8030
  };
7619
8031
  var MediaEnabledContext = createContext23(null);
7620
8032
  var useVideoEnabled = () => {
7621
- const context = useContext32(MediaEnabledContext);
8033
+ const context = useContext33(MediaEnabledContext);
7622
8034
  if (!context) {
7623
8035
  return window.remotion_videoEnabled;
7624
8036
  }
@@ -7628,7 +8040,7 @@ var useVideoEnabled = () => {
7628
8040
  return context.videoEnabled;
7629
8041
  };
7630
8042
  var useAudioEnabled = () => {
7631
- const context = useContext32(MediaEnabledContext);
8043
+ const context = useContext33(MediaEnabledContext);
7632
8044
  if (!context) {
7633
8045
  return window.remotion_audioEnabled;
7634
8046
  }
@@ -7944,15 +8356,16 @@ var OffthreadVideoForRendering = ({
7944
8356
  onVideoFrame,
7945
8357
  crossOrigin,
7946
8358
  audioStreamIndex,
8359
+ preservePitch: _preservePitch,
7947
8360
  ...props2
7948
8361
  }) => {
7949
8362
  const absoluteFrame = useTimelinePosition();
7950
8363
  const frame = useCurrentFrame();
7951
8364
  const volumePropsFrame = useFrameForVolumeProp(loopVolumeCurveBehavior);
7952
8365
  const videoConfig = useUnsafeVideoConfig();
7953
- const sequenceContext = useContext33(SequenceContext);
8366
+ const sequenceContext = useContext34(SequenceContext);
7954
8367
  const mediaStartsAt = useMediaStartsAt();
7955
- const { registerRenderAsset, unregisterRenderAsset } = useContext33(RenderAssetManager);
8368
+ const { registerRenderAsset, unregisterRenderAsset } = useContext34(RenderAssetManager);
7956
8369
  if (!src) {
7957
8370
  throw new TypeError("No `src` was passed to <OffthreadVideo>.");
7958
8371
  }
@@ -8099,7 +8512,7 @@ var OffthreadVideoForRendering = ({
8099
8512
  continueRender2,
8100
8513
  delayRender2
8101
8514
  ]);
8102
- const onErr = useCallback17(() => {
8515
+ const onErr = useCallback18(() => {
8103
8516
  if (onError) {
8104
8517
  onError?.(new Error("Failed to load image with src " + imageSrc));
8105
8518
  } else {
@@ -8109,7 +8522,7 @@ var OffthreadVideoForRendering = ({
8109
8522
  const className = useMemo33(() => {
8110
8523
  return [OBJECTFIT_CONTAIN_CLASS_NAME, props2.className].filter(truthy).join(" ");
8111
8524
  }, [props2.className]);
8112
- const onImageFrame = useCallback17((img) => {
8525
+ const onImageFrame = useCallback18((img) => {
8113
8526
  if (onVideoFrame) {
8114
8527
  onVideoFrame(img);
8115
8528
  }
@@ -8164,7 +8577,7 @@ class MediaPlaybackError extends Error {
8164
8577
  }
8165
8578
  }
8166
8579
  var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
8167
- const context = useContext34(SharedAudioContext);
8580
+ const context = useContext35(SharedAudioContext);
8168
8581
  if (!context) {
8169
8582
  throw new Error("SharedAudioContext not found");
8170
8583
  }
@@ -8190,6 +8603,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
8190
8603
  volume,
8191
8604
  muted,
8192
8605
  playbackRate,
8606
+ preservePitch,
8193
8607
  onlyWarnForMediaSeekingError,
8194
8608
  src,
8195
8609
  onDuration,
@@ -8220,12 +8634,10 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
8220
8634
  }
8221
8635
  const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
8222
8636
  const { fps, durationInFrames } = useVideoConfig();
8223
- const parentSequence = useContext34(SequenceContext);
8224
- const { hidden } = useContext34(SequenceVisibilityToggleContext);
8637
+ const parentSequence = useContext35(SequenceContext);
8225
8638
  const logLevel = useLogLevel();
8226
8639
  const mountTime = useMountTime();
8227
8640
  const [timelineId] = useState21(() => String(Math.random()));
8228
- const isSequenceHidden = hidden[timelineId] ?? false;
8229
8641
  if (typeof acceptableTimeShift !== "undefined") {
8230
8642
  throw new Error("acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.");
8231
8643
  }
@@ -8256,6 +8668,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
8256
8668
  src,
8257
8669
  mediaType: "video",
8258
8670
  playbackRate: props2.playbackRate ?? 1,
8671
+ preservePitch,
8259
8672
  onlyWarnForMediaSeekingError,
8260
8673
  acceptableTimeshift: acceptableTimeShiftInSeconds ?? null,
8261
8674
  isPremounting: Boolean(parentSequence?.premounting),
@@ -8369,10 +8782,9 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
8369
8782
  }, []);
8370
8783
  const actualStyle = useMemo34(() => {
8371
8784
  return {
8372
- ...style,
8373
- opacity: isSequenceHidden ? 0 : style?.opacity ?? 1
8785
+ ...style
8374
8786
  };
8375
- }, [isSequenceHidden, style]);
8787
+ }, [style]);
8376
8788
  const crossOriginValue = getCrossOriginValue({
8377
8789
  crossOrigin,
8378
8790
  requestsVideoFrame: Boolean(onVideoFrame),
@@ -8380,7 +8792,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
8380
8792
  });
8381
8793
  return /* @__PURE__ */ jsx31("video", {
8382
8794
  ref: videoRef,
8383
- muted: muted || mediaMuted || isSequenceHidden || userPreferredVolume <= 0,
8795
+ muted: muted || mediaMuted || userPreferredVolume <= 0,
8384
8796
  playsInline: true,
8385
8797
  src: actualSrc,
8386
8798
  loop: _remotionInternalNativeLoopPassed,
@@ -8390,7 +8802,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
8390
8802
  ...nativeProps
8391
8803
  });
8392
8804
  };
8393
- var VideoForPreview = forwardRef10(VideoForDevelopmentRefForwardingFunction);
8805
+ var VideoForPreview = forwardRef11(VideoForDevelopmentRefForwardingFunction);
8394
8806
  var InnerOffthreadVideo = (props2) => {
8395
8807
  const {
8396
8808
  startFrom,
@@ -8407,7 +8819,7 @@ var InnerOffthreadVideo = (props2) => {
8407
8819
  if (environment.isClientSideRendering) {
8408
8820
  throw new Error("<OffthreadVideo> is not supported in @remotion/web-renderer. Use <Video> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");
8409
8821
  }
8410
- const onDuration = useCallback18(() => {
8822
+ const onDuration = useCallback19(() => {
8411
8823
  return;
8412
8824
  }, []);
8413
8825
  if (typeof props2.src !== "string") {
@@ -8495,6 +8907,7 @@ var OffthreadVideo = ({
8495
8907
  onVideoFrame,
8496
8908
  pauseWhenBuffering,
8497
8909
  playbackRate,
8910
+ preservePitch,
8498
8911
  showInTimeline,
8499
8912
  style,
8500
8913
  toneFrequency,
@@ -8530,6 +8943,7 @@ var OffthreadVideo = ({
8530
8943
  onVideoFrame,
8531
8944
  pauseWhenBuffering: pauseWhenBuffering ?? true,
8532
8945
  playbackRate: playbackRate ?? 1,
8946
+ preservePitch,
8533
8947
  toneFrequency: toneFrequency ?? 1,
8534
8948
  showInTimeline: showInTimeline ?? true,
8535
8949
  src,
@@ -8650,7 +9064,6 @@ var Internals = {
8650
9064
  VisualModeSettersContext,
8651
9065
  SequenceManager,
8652
9066
  SequenceStackTracesUpdateContext,
8653
- SequenceVisibilityToggleContext,
8654
9067
  wrapInSchema,
8655
9068
  sequenceSchema,
8656
9069
  sequenceStyleSchema,
@@ -8746,13 +9159,16 @@ var Internals = {
8746
9159
  useEffectChainState,
8747
9160
  runEffectChain,
8748
9161
  useMemoizedEffects,
8749
- defineEffect,
8750
- createDescriptor,
9162
+ useMemoizedEffectDefinitions,
9163
+ createEffect,
8751
9164
  computeEffectiveSchemaValuesDotNotation,
8752
9165
  OverrideIdsToNodePathsGettersContext,
8753
9166
  OverrideIdsToNodePathsSettersContext,
8754
9167
  findPropsToDelete,
8755
- flattenEffects
9168
+ makeSequencePropsSubscriptionKey,
9169
+ getCodeValuesCtx,
9170
+ getEffectCodeValuesCtx,
9171
+ hiddenField
8756
9172
  };
8757
9173
  var NUMBER = "[-+]?\\d*\\.?\\d+";
8758
9174
  var PERCENTAGE = NUMBER + "%";
@@ -8815,7 +9231,7 @@ var SeriesSequenceRefForwardingFunction = ({ children }, _ref) => {
8815
9231
  children
8816
9232
  });
8817
9233
  };
8818
- var SeriesSequence = forwardRef11(SeriesSequenceRefForwardingFunction);
9234
+ var SeriesSequence = forwardRef12(SeriesSequenceRefForwardingFunction);
8819
9235
  var SeriesInner = (props2) => {
8820
9236
  const childrenValue = useMemo36(() => {
8821
9237
  let startFrame = 0;
@@ -9340,6 +9756,7 @@ var VideoForRenderingForwardFunction = ({
9340
9756
  loopVolumeCurveBehavior,
9341
9757
  audioStreamIndex,
9342
9758
  onVideoFrame,
9759
+ preservePitch: _preservePitch,
9343
9760
  ...props2
9344
9761
  }, ref) => {
9345
9762
  const absoluteFrame = useTimelinePosition();
@@ -9347,13 +9764,13 @@ var VideoForRenderingForwardFunction = ({
9347
9764
  const volumePropsFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
9348
9765
  const videoConfig = useUnsafeVideoConfig();
9349
9766
  const videoRef = useRef23(null);
9350
- const sequenceContext = useContext35(SequenceContext);
9767
+ const sequenceContext = useContext36(SequenceContext);
9351
9768
  const mediaStartsAt = useMediaStartsAt();
9352
9769
  const environment = useRemotionEnvironment();
9353
9770
  const logLevel = useLogLevel();
9354
9771
  const mountTime = useMountTime();
9355
9772
  const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
9356
- const { registerRenderAsset, unregisterRenderAsset } = useContext35(RenderAssetManager);
9773
+ const { registerRenderAsset, unregisterRenderAsset } = useContext36(RenderAssetManager);
9357
9774
  const id = useMemo37(() => `video-${random(props2.src ?? "")}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
9358
9775
  props2.src,
9359
9776
  sequenceContext?.cumulatedFrom,
@@ -9542,7 +9959,7 @@ var VideoForRenderingForwardFunction = ({
9542
9959
  ...props2
9543
9960
  });
9544
9961
  };
9545
- var VideoForRendering = forwardRef12(VideoForRenderingForwardFunction);
9962
+ var VideoForRendering = forwardRef13(VideoForRenderingForwardFunction);
9546
9963
  var VideoForwardingFunction = (props2, ref) => {
9547
9964
  const {
9548
9965
  startFrom,
@@ -9563,7 +9980,7 @@ var VideoForwardingFunction = (props2, ref) => {
9563
9980
  if (environment.isClientSideRendering) {
9564
9981
  throw new Error("<Html5Video> is not supported in @remotion/web-renderer. Use <Video> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");
9565
9982
  }
9566
- const { durations, setDurations } = useContext36(DurationsContext);
9983
+ const { durations, setDurations } = useContext37(DurationsContext);
9567
9984
  if (typeof ref === "string") {
9568
9985
  throw new Error("string refs are not supported");
9569
9986
  }
@@ -9571,10 +9988,10 @@ var VideoForwardingFunction = (props2, ref) => {
9571
9988
  throw new TypeError(`The \`<Html5Video>\` tag requires a string for \`src\`, but got ${JSON.stringify(props2.src)} instead.`);
9572
9989
  }
9573
9990
  const preloadedSrc = usePreload(props2.src);
9574
- const onDuration = useCallback19((src, durationInSeconds) => {
9991
+ const onDuration = useCallback20((src, durationInSeconds) => {
9575
9992
  setDurations({ type: "got-duration", durationInSeconds, src });
9576
9993
  }, [setDurations]);
9577
- const onVideoFrame = useCallback19(() => {}, []);
9994
+ const onVideoFrame = useCallback20(() => {}, []);
9578
9995
  const durationFetched = durations[getAbsoluteSrc(preloadedSrc)] ?? durations[getAbsoluteSrc(props2.src)];
9579
9996
  validateMediaTrimProps({ startFrom, endAt, trimBefore, trimAfter });
9580
9997
  const { trimBeforeValue, trimAfterValue } = resolveTrimProps({
@@ -9626,7 +10043,11 @@ var VideoForwardingFunction = (props2, ref) => {
9626
10043
  })
9627
10044
  });
9628
10045
  }
9629
- validateMediaProps({ playbackRate: props2.playbackRate, volume: props2.volume }, "Html5Video");
10046
+ validateMediaProps({
10047
+ playbackRate: props2.playbackRate,
10048
+ preservePitch: props2.preservePitch,
10049
+ volume: props2.volume
10050
+ }, "Html5Video");
9630
10051
  if (environment.isRendering) {
9631
10052
  return /* @__PURE__ */ jsx37(VideoForRendering, {
9632
10053
  onDuration,
@@ -9648,7 +10069,7 @@ var VideoForwardingFunction = (props2, ref) => {
9648
10069
  onAutoPlayError: onAutoPlayError ?? undefined
9649
10070
  });
9650
10071
  };
9651
- var Html5Video = forwardRef13(VideoForwardingFunction);
10072
+ var Html5Video = forwardRef14(VideoForwardingFunction);
9652
10073
  addSequenceStackTraces(Html5Video);
9653
10074
  checkMultipleRemotionVersions();
9654
10075
  var proxyObj = {};