@remotion/promo-pages 4.0.462 → 4.0.464

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 (277) hide show
  1. package/dist/Homepage.js +1582 -1186
  2. package/dist/design.js +1544 -1196
  3. package/dist/experts.js +1408 -1060
  4. package/dist/homepage/Pricing.js +1536 -1188
  5. package/dist/prompts/PromptsGallery.js +1542 -1194
  6. package/dist/prompts/PromptsShow.js +1446 -1098
  7. package/dist/prompts/PromptsSubmit.js +1453 -1105
  8. package/dist/tailwind.css +6 -4
  9. package/dist/team.js +1529 -1181
  10. package/dist/template-modal-content.js +1547 -1199
  11. package/dist/templates.js +1542 -1193
  12. package/package.json +13 -13
  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 -19
  44. package/dist/components/experts/experts-data.js +0 -391
  45. package/dist/components/experts/experts-icons.d.ts +0 -8
  46. package/dist/components/experts/experts-icons.js +0 -42
  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-show.d.ts +0 -1
  272. package/dist/prompts-show.js +0 -20
  273. package/dist/prompts-submit.d.ts +0 -1
  274. package/dist/prompts-submit.js +0 -6
  275. package/dist/prompts.d.ts +0 -1
  276. package/dist/prompts.js +0 -6
  277. package/dist/team.d.ts +0 -1
package/dist/design.js CHANGED
@@ -36,7 +36,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
36
36
  import * as React24 from "react";
37
37
  import * as React3 from "react";
38
38
  import { Fragment as Fragment2, jsx as jsx38 } from "react/jsx-runtime";
39
- import React52, { useCallback as useCallback22, useRef as useRef24, useState as useState22 } from "react";
39
+ import React52, { useCallback as useCallback24, useRef as useRef25, useState as useState22 } from "react";
40
40
 
41
41
  // ../../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
42
42
  function r(e) {
@@ -1378,7 +1378,7 @@ var getDefaultConfig = () => {
1378
1378
  var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
1379
1379
 
1380
1380
  // ../design/dist/esm/index.mjs
1381
- import React33, { useEffect as useEffect20, useMemo as useMemo38, useState as useState23 } from "react";
1381
+ import React33, { useEffect as useEffect20, useMemo as useMemo39, useState as useState21 } from "react";
1382
1382
 
1383
1383
  // ../paths/dist/esm/index.mjs
1384
1384
  var cutLInstruction = ({
@@ -5743,8 +5743,15 @@ import * as React6 from "react";
5743
5743
  import React7, { useMemo as useMemo6, useRef as useRef2 } from "react";
5744
5744
  import { useContext as useContext8, useMemo as useMemo7 } from "react";
5745
5745
  import { jsx as jsx72 } from "react/jsx-runtime";
5746
- import { useEffect as useEffect4, useMemo as useMemo12, useState as useState4 } from "react";
5747
- import { useContext as useContext11 } from "react";
5746
+ import {
5747
+ forwardRef as forwardRef3,
5748
+ useContext as useContext17,
5749
+ useEffect as useEffect3,
5750
+ useMemo as useMemo14,
5751
+ useState as useState5
5752
+ } from "react";
5753
+ import { useRef as useRef6 } from "react";
5754
+ import { useContext as useContext14, useMemo as useMemo11 } from "react";
5748
5755
  import { createContext as createContext12 } from "react";
5749
5756
  import { useContext as useContext10, useMemo as useMemo9 } from "react";
5750
5757
  import {
@@ -5755,194 +5762,195 @@ import {
5755
5762
  useState as useState2
5756
5763
  } from "react";
5757
5764
  import { jsx as jsx82 } from "react/jsx-runtime";
5758
- import { useEffect as useEffect3, useMemo as useMemo10, useRef as useRef4 } from "react";
5759
- import { useContext as useContext12, useRef as useRef6 } from "react";
5760
- import { createContext as createContext14 } from "react";
5761
- import React10, { useCallback as useCallback5, useMemo as useMemo11, useRef as useRef5, useState as useState3 } from "react";
5765
+ import { useContext as useContext11 } from "react";
5766
+ import { useContext as useContext13 } from "react";
5767
+ import { useContext as useContext12, useMemo as useMemo10 } from "react";
5762
5768
  import { jsx as jsx92 } from "react/jsx-runtime";
5769
+ import { createContext as createContext14 } from "react";
5770
+ import React11, { useCallback as useCallback5, useMemo as useMemo12, useRef as useRef4, useState as useState3 } from "react";
5763
5771
  import { jsx as jsx102 } from "react/jsx-runtime";
5772
+ import React12, { forwardRef as forwardRef2, useState as useState4, useContext as useContext16, useMemo as useMemo13 } from "react";
5773
+ import { useContext as useContext15, useRef as useRef5 } from "react";
5774
+ import { createContext as createContext15 } from "react";
5775
+ import { jsx as jsx112 } from "react/jsx-runtime";
5764
5776
  import {
5765
- forwardRef as forwardRef3,
5766
- useContext as useContext17,
5777
+ forwardRef as forwardRef4,
5767
5778
  useEffect as useEffect5,
5768
- useMemo as useMemo16,
5779
+ useImperativeHandle as useImperativeHandle2,
5780
+ useLayoutEffect as useLayoutEffect2,
5781
+ useRef as useRef9,
5769
5782
  useState as useState6
5770
5783
  } from "react";
5771
- import { useContext as useContext15, useMemo as useMemo14 } from "react";
5772
- import { useContext as useContext14 } from "react";
5773
- import { useContext as useContext13, useMemo as useMemo13 } from "react";
5774
- import { jsx as jsx112 } from "react/jsx-runtime";
5775
- import { createContext as createContext15 } from "react";
5776
- import React13, { forwardRef as forwardRef2, useState as useState5, useContext as useContext16, useMemo as useMemo15 } from "react";
5784
+ import React14, { useCallback as useCallback6, useImperativeHandle, useMemo as useMemo16, useRef as useRef8 } from "react";
5785
+ import { useEffect as useEffect4, useMemo as useMemo15, useRef as useRef7 } from "react";
5777
5786
  import { jsx as jsx12 } from "react/jsx-runtime";
5787
+ import { jsx as jsx13 } from "react/jsx-runtime";
5778
5788
  import {
5779
- forwardRef as forwardRef4,
5789
+ forwardRef as forwardRef5,
5790
+ useCallback as useCallback7,
5780
5791
  useEffect as useEffect6,
5781
- useImperativeHandle as useImperativeHandle2,
5782
- useLayoutEffect as useLayoutEffect2,
5783
- useRef as useRef8,
5792
+ useMemo as useMemo17,
5784
5793
  useState as useState7
5785
5794
  } from "react";
5786
- import React15, { useCallback as useCallback6, useImperativeHandle, useRef as useRef7 } from "react";
5787
- import { jsx as jsx13 } from "react/jsx-runtime";
5788
5795
  import { jsx as jsx14 } from "react/jsx-runtime";
5789
5796
  import {
5790
5797
  createContext as createContext16,
5791
- forwardRef as forwardRef5,
5792
- useCallback as useCallback7,
5798
+ forwardRef as forwardRef6,
5799
+ useCallback as useCallback8,
5793
5800
  useContext as useContext18,
5794
5801
  useLayoutEffect as useLayoutEffect3,
5795
- useMemo as useMemo17,
5796
- useRef as useRef9,
5797
- useState as useState8
5802
+ useMemo as useMemo18,
5803
+ useRef as useRef10
5798
5804
  } from "react";
5799
5805
  import { jsx as jsx15 } from "react/jsx-runtime";
5800
- import { useContext as useContext19, useLayoutEffect as useLayoutEffect5, useState as useState10 } from "react";
5806
+ import { useContext as useContext19, useLayoutEffect as useLayoutEffect5, useState as useState9 } from "react";
5801
5807
  import {
5802
5808
  createContext as createContext17,
5803
- useCallback as useCallback8,
5809
+ useCallback as useCallback9,
5804
5810
  useImperativeHandle as useImperativeHandle3,
5805
5811
  useLayoutEffect as useLayoutEffect4,
5806
- useMemo as useMemo18,
5807
- useRef as useRef10,
5808
- useState as useState9
5812
+ useMemo as useMemo19,
5813
+ useRef as useRef11,
5814
+ useState as useState8
5809
5815
  } from "react";
5810
5816
  import { jsx as jsx16 } from "react/jsx-runtime";
5811
- import { forwardRef as forwardRef8, useCallback as useCallback13, useContext as useContext31 } from "react";
5812
- import React17, { createContext as createContext18, useMemo as useMemo19 } from "react";
5817
+ import { forwardRef as forwardRef9, useCallback as useCallback15, useContext as useContext31 } from "react";
5818
+ import React17, { createContext as createContext18, useMemo as useMemo20 } from "react";
5813
5819
  import { jsx as jsx17 } from "react/jsx-runtime";
5814
5820
  import { useContext as useContext20 } from "react";
5815
- import { createContext as createContext19, useEffect as useEffect7, useState as useState11 } from "react";
5821
+ import { createContext as createContext19, useEffect as useEffect7, useState as useState10 } from "react";
5816
5822
  import { jsx as jsx18 } from "react/jsx-runtime";
5817
- import { createContext as createContext20, useMemo as useMemo20, useReducer } from "react";
5823
+ import { createContext as createContext20, useMemo as useMemo21, useReducer } from "react";
5818
5824
  import { jsx as jsx19 } from "react/jsx-runtime";
5825
+ import { useCallback as useCallback14 } from "react";
5819
5826
  import React23, {
5820
- forwardRef as forwardRef6,
5827
+ forwardRef as forwardRef7,
5821
5828
  useContext as useContext29,
5822
5829
  useEffect as useEffect14,
5823
5830
  useImperativeHandle as useImperativeHandle4,
5824
- useMemo as useMemo28,
5825
- useRef as useRef18,
5826
- useState as useState16
5831
+ useMemo as useMemo29,
5832
+ useRef as useRef19,
5833
+ useState as useState15
5827
5834
  } from "react";
5828
- import { useContext as useContext22, useLayoutEffect as useLayoutEffect6, useRef as useRef13 } from "react";
5835
+ import { useContext as useContext22, useLayoutEffect as useLayoutEffect6, useRef as useRef14 } from "react";
5829
5836
  import React20, {
5830
5837
  createContext as createContext21,
5831
5838
  createRef as createRef2,
5832
- useCallback as useCallback9,
5839
+ useCallback as useCallback10,
5833
5840
  useContext as useContext21,
5834
- useMemo as useMemo22,
5835
- useRef as useRef11,
5836
- useState as useState12
5841
+ useMemo as useMemo23,
5842
+ useRef as useRef12,
5843
+ useState as useState11
5837
5844
  } from "react";
5838
- import { useMemo as useMemo21 } from "react";
5845
+ import { useMemo as useMemo22 } from "react";
5839
5846
  import { jsx as jsx20, jsxs as jsxs22 } from "react/jsx-runtime";
5840
- import { useRef as useRef12 } from "react";
5841
- import { useContext as useContext24, useEffect as useEffect8, useMemo as useMemo23, useState as useState13 } from "react";
5847
+ import { useRef as useRef13 } from "react";
5848
+ import { useContext as useContext24, useEffect as useEffect8, useMemo as useMemo24, useState as useState12 } from "react";
5842
5849
  import { useContext as useContext23 } from "react";
5843
5850
  import {
5844
- useCallback as useCallback12,
5851
+ useCallback as useCallback13,
5845
5852
  useContext as useContext27,
5846
5853
  useEffect as useEffect12,
5847
5854
  useLayoutEffect as useLayoutEffect8,
5848
- useRef as useRef17
5855
+ useRef as useRef18
5849
5856
  } from "react";
5850
- import { useCallback as useCallback11, useMemo as useMemo26, useRef as useRef15 } from "react";
5851
- import { useContext as useContext26, useMemo as useMemo25 } from "react";
5857
+ import { useCallback as useCallback12, useMemo as useMemo27, useRef as useRef16 } from "react";
5858
+ import { useContext as useContext26, useMemo as useMemo26 } from "react";
5852
5859
  import React21, {
5853
- useCallback as useCallback10,
5860
+ useCallback as useCallback11,
5854
5861
  useContext as useContext25,
5855
5862
  useEffect as useEffect9,
5856
5863
  useLayoutEffect as useLayoutEffect7,
5857
- useMemo as useMemo24,
5858
- useRef as useRef14,
5859
- useState as useState14
5864
+ useMemo as useMemo25,
5865
+ useRef as useRef15,
5866
+ useState as useState13
5860
5867
  } from "react";
5861
5868
  import { jsx as jsx21 } from "react/jsx-runtime";
5862
5869
  import React22 from "react";
5863
- import { useEffect as useEffect10, useState as useState15 } from "react";
5864
- import { useEffect as useEffect11, useRef as useRef16 } from "react";
5870
+ import { useEffect as useEffect10, useState as useState14 } from "react";
5871
+ import { useEffect as useEffect11, useRef as useRef17 } from "react";
5865
5872
  import { useEffect as useEffect13 } from "react";
5866
- import { createContext as createContext22, useContext as useContext28, useMemo as useMemo27 } from "react";
5873
+ import { createContext as createContext22, useContext as useContext28, useMemo as useMemo28 } from "react";
5867
5874
  import { jsx as jsx222 } from "react/jsx-runtime";
5868
5875
  import {
5869
- forwardRef as forwardRef7,
5876
+ forwardRef as forwardRef8,
5870
5877
  useContext as useContext30,
5871
5878
  useEffect as useEffect15,
5872
5879
  useImperativeHandle as useImperativeHandle5,
5873
5880
  useLayoutEffect as useLayoutEffect9,
5874
- useMemo as useMemo29,
5875
- useRef as useRef19
5881
+ useMemo as useMemo30,
5882
+ useRef as useRef20
5876
5883
  } from "react";
5877
5884
  import { jsx as jsx23 } from "react/jsx-runtime";
5878
5885
  import { jsx as jsx24 } from "react/jsx-runtime";
5879
- import { forwardRef as forwardRef9, useCallback as useCallback14, useState as useState17 } from "react";
5886
+ import { forwardRef as forwardRef10, useCallback as useCallback16, useState as useState16 } from "react";
5880
5887
  import { jsx as jsx25 } from "react/jsx-runtime";
5881
5888
  import {
5882
- useCallback as useCallback15,
5889
+ useCallback as useCallback17,
5883
5890
  useContext as useContext32,
5884
5891
  useImperativeHandle as useImperativeHandle6,
5885
5892
  useLayoutEffect as useLayoutEffect10,
5886
- useRef as useRef20,
5887
- useState as useState18
5893
+ useRef as useRef21,
5894
+ useState as useState17
5888
5895
  } from "react";
5889
5896
  import { jsx as jsx26 } from "react/jsx-runtime";
5890
5897
  import { createRef as createRef3 } from "react";
5891
5898
  import React28 from "react";
5892
5899
  import {
5893
- useCallback as useCallback16,
5900
+ useCallback as useCallback18,
5894
5901
  useImperativeHandle as useImperativeHandle7,
5895
- useMemo as useMemo30,
5896
- useRef as useRef21,
5897
- useState as useState19
5902
+ useMemo as useMemo31,
5903
+ useRef as useRef22,
5904
+ useState as useState18
5898
5905
  } from "react";
5899
5906
  import { jsx as jsx27 } from "react/jsx-runtime";
5900
5907
  import React29 from "react";
5901
- import { useMemo as useMemo322 } from "react";
5902
- import { createContext as createContext23, useContext as useContext33, useMemo as useMemo31 } from "react";
5908
+ import { useMemo as useMemo33 } from "react";
5909
+ import { createContext as createContext23, useContext as useContext33, useMemo as useMemo322 } from "react";
5903
5910
  import { jsx as jsx28 } from "react/jsx-runtime";
5904
5911
  import { jsx as jsx29 } from "react/jsx-runtime";
5905
5912
  import React31 from "react";
5906
5913
  import React32, { createContext as createContext24 } from "react";
5907
- import { useCallback as useCallback18 } from "react";
5914
+ import { useCallback as useCallback21 } from "react";
5908
5915
  import {
5909
- useCallback as useCallback17,
5916
+ useCallback as useCallback19,
5910
5917
  useContext as useContext34,
5911
5918
  useEffect as useEffect16,
5912
5919
  useLayoutEffect as useLayoutEffect11,
5913
- useMemo as useMemo33,
5914
- useState as useState20
5920
+ useMemo as useMemo34,
5921
+ useState as useState19
5915
5922
  } from "react";
5916
5923
  import { jsx as jsx30 } from "react/jsx-runtime";
5917
5924
  import React34, {
5918
- forwardRef as forwardRef10,
5925
+ forwardRef as forwardRef11,
5919
5926
  useContext as useContext35,
5920
5927
  useEffect as useEffect18,
5921
5928
  useImperativeHandle as useImperativeHandle8,
5922
- useMemo as useMemo34,
5923
- useRef as useRef22,
5924
- useState as useState21
5929
+ useMemo as useMemo35,
5930
+ useRef as useRef23,
5931
+ useState as useState20,
5932
+ useCallback as useCallback20
5925
5933
  } from "react";
5926
5934
  import { useEffect as useEffect17 } from "react";
5927
5935
  import { jsx as jsx31 } from "react/jsx-runtime";
5928
5936
  import { jsx as jsx322 } from "react/jsx-runtime";
5929
- import React36, { useMemo as useMemo35 } from "react";
5937
+ import React36, { useMemo as useMemo36 } from "react";
5930
5938
  import { jsx as jsx33 } from "react/jsx-runtime";
5931
- import { Children, forwardRef as forwardRef11, useMemo as useMemo36 } from "react";
5939
+ import { Children, forwardRef as forwardRef12, useMemo as useMemo37 } from "react";
5932
5940
  import React37 from "react";
5933
5941
  import React38, { createContext as createContext25 } from "react";
5934
5942
  import { jsx as jsx34 } from "react/jsx-runtime";
5935
5943
  import { jsx as jsx35 } from "react/jsx-runtime";
5936
5944
  import React40 from "react";
5937
- import { forwardRef as forwardRef13, useCallback as useCallback19, useContext as useContext37 } from "react";
5945
+ import { forwardRef as forwardRef14, useCallback as useCallback22, useContext as useContext37 } from "react";
5938
5946
  import {
5939
- forwardRef as forwardRef12,
5947
+ forwardRef as forwardRef13,
5940
5948
  useContext as useContext36,
5941
5949
  useEffect as useEffect19,
5942
5950
  useImperativeHandle as useImperativeHandle9,
5943
5951
  useLayoutEffect as useLayoutEffect12,
5944
- useMemo as useMemo37,
5945
- useRef as useRef23
5952
+ useMemo as useMemo38,
5953
+ useRef as useRef24
5946
5954
  } from "react";
5947
5955
  import { jsx as jsx36 } from "react/jsx-runtime";
5948
5956
  import { jsx as jsx37 } from "react/jsx-runtime";
@@ -7013,6 +7021,39 @@ var Composition = (props) => {
7013
7021
  ...props
7014
7022
  });
7015
7023
  };
7024
+ var componentsToAddStacksTo = [];
7025
+ var getComponentsToAddStacksTo = () => componentsToAddStacksTo;
7026
+ var addSequenceStackTraces = (component) => {
7027
+ componentsToAddStacksTo.push(component);
7028
+ };
7029
+ var VERSION = "4.0.464";
7030
+ var checkMultipleRemotionVersions = () => {
7031
+ if (typeof globalThis === "undefined") {
7032
+ return;
7033
+ }
7034
+ const set = () => {
7035
+ globalThis.remotion_imported = VERSION;
7036
+ if (typeof window !== "undefined") {
7037
+ window.remotion_imported = VERSION;
7038
+ }
7039
+ };
7040
+ const alreadyImported = globalThis.remotion_imported || typeof window !== "undefined" && window.remotion_imported;
7041
+ if (alreadyImported) {
7042
+ if (alreadyImported === VERSION) {
7043
+ return;
7044
+ }
7045
+ if (typeof alreadyImported === "string" && alreadyImported.includes("webcodecs")) {
7046
+ set();
7047
+ return;
7048
+ }
7049
+ throw new TypeError(`\uD83D\uDEA8 Multiple versions of Remotion detected: ${[
7050
+ VERSION,
7051
+ typeof alreadyImported === "string" ? alreadyImported : "an older version"
7052
+ ].filter(truthy2).join(" and ")}. This will cause things to break in an unexpected way.
7053
+ 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.`);
7054
+ }
7055
+ set();
7056
+ };
7016
7057
  var SequenceContext = createContext12(null);
7017
7058
  var exports_timeline_position_state = {};
7018
7059
  __export2(exports_timeline_position_state, {
@@ -7218,253 +7259,212 @@ var useCurrentFrame = () => {
7218
7259
  const contextOffset = context ? context.cumulatedFrom + context.relativeFrom : 0;
7219
7260
  return frame - contextOffset;
7220
7261
  };
7221
-
7222
- class CanvasPool {
7223
- width;
7224
- height;
7225
- pairs = new Map;
7226
- lostContexts = new Set;
7227
- constructor(width, height) {
7228
- this.width = width;
7229
- this.height = height;
7230
- }
7231
- getPair(backend) {
7232
- const existing = this.pairs.get(backend);
7233
- if (existing) {
7234
- return existing;
7262
+ var useUnsafeVideoConfig = () => {
7263
+ const context = useContext12(SequenceContext);
7264
+ const ctxWidth = context?.width ?? null;
7265
+ const ctxHeight = context?.height ?? null;
7266
+ const ctxDuration = context?.durationInFrames ?? null;
7267
+ const video = useVideo();
7268
+ return useMemo10(() => {
7269
+ if (!video) {
7270
+ return null;
7235
7271
  }
7236
- const pair = [
7237
- this.allocateCanvas(backend),
7238
- this.allocateCanvas(backend)
7239
- ];
7240
- this.pairs.set(backend, pair);
7241
- return pair;
7242
- }
7243
- assertContextNotLost(canvas) {
7244
- if (this.lostContexts.has(canvas)) {
7245
- 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.");
7272
+ const {
7273
+ id,
7274
+ durationInFrames,
7275
+ fps,
7276
+ height,
7277
+ width,
7278
+ defaultProps,
7279
+ props,
7280
+ defaultCodec,
7281
+ defaultOutName,
7282
+ defaultVideoImageFormat,
7283
+ defaultPixelFormat,
7284
+ defaultProResProfile,
7285
+ defaultSampleRate
7286
+ } = video;
7287
+ return {
7288
+ id,
7289
+ width: ctxWidth ?? width,
7290
+ height: ctxHeight ?? height,
7291
+ fps,
7292
+ durationInFrames: ctxDuration ?? durationInFrames,
7293
+ defaultProps,
7294
+ props,
7295
+ defaultCodec,
7296
+ defaultOutName,
7297
+ defaultVideoImageFormat,
7298
+ defaultPixelFormat,
7299
+ defaultProResProfile,
7300
+ defaultSampleRate
7301
+ };
7302
+ }, [ctxDuration, ctxHeight, ctxWidth, video]);
7303
+ };
7304
+ var useVideoConfig = () => {
7305
+ const videoConfig = useUnsafeVideoConfig();
7306
+ const context = useContext13(CanUseRemotionHooks);
7307
+ const isPlayer = useIsPlayer();
7308
+ if (!videoConfig) {
7309
+ if (typeof window !== "undefined" && window.remotion_isPlayer || isPlayer) {
7310
+ throw new Error([
7311
+ "No video config found. Likely reasons:",
7312
+ "- 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.",
7313
+ "- You have multiple versions of Remotion installed which causes the React context to get lost."
7314
+ ].join("-"));
7246
7315
  }
7316
+ 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.");
7247
7317
  }
7248
- allocateCanvas(backend) {
7249
- const canvas = document.createElement("canvas");
7250
- canvas.width = this.width;
7251
- canvas.height = this.height;
7252
- switch (backend) {
7253
- case "2d": {
7254
- const ctx = canvas.getContext("2d", {
7255
- colorSpace: "srgb"
7256
- });
7257
- if (!ctx) {
7258
- throw new Error("Failed to acquire 2D context for canvas effect");
7259
- }
7260
- return canvas;
7261
- }
7262
- case "webgl2": {
7263
- const ctx = canvas.getContext("webgl2", {
7264
- premultipliedAlpha: true,
7265
- alpha: true,
7266
- preserveDrawingBuffer: true
7267
- });
7268
- if (!ctx) {
7269
- throw new Error("Failed to acquire WebGL2 context for canvas effect");
7270
- }
7271
- canvas.addEventListener("webglcontextlost", (e) => {
7272
- e.preventDefault();
7273
- this.lostContexts.add(canvas);
7274
- });
7275
- canvas.addEventListener("webglcontextrestored", () => {
7276
- this.lostContexts.delete(canvas);
7277
- });
7278
- ctx.pixelStorei(ctx.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
7279
- return canvas;
7280
- }
7281
- case "webgpu": {
7282
- if (typeof navigator === "undefined" || !("gpu" in navigator)) {
7283
- throw new Error("WebGPU is not available in this environment for canvas effect");
7284
- }
7285
- return canvas;
7286
- }
7287
- default: {
7288
- const exhaustive = backend;
7289
- throw new Error(`Unknown effect backend: ${exhaustive}`);
7290
- }
7291
- }
7318
+ if (!context) {
7319
+ throw new Error("Called useVideoConfig() outside a Remotion composition.");
7292
7320
  }
7293
- }
7294
- var groupByBackend = (effects) => {
7295
- const runs = [];
7296
- let current = [];
7297
- let currentBackend = null;
7298
- for (const eff of effects) {
7299
- const { backend } = eff.definition;
7300
- if (currentBackend === null || backend === currentBackend) {
7301
- current.push(eff);
7302
- currentBackend = backend;
7303
- } else {
7304
- runs.push({ backend: currentBackend, effects: current });
7305
- current = [eff];
7306
- currentBackend = backend;
7307
- }
7321
+ return videoConfig;
7322
+ };
7323
+ var Freeze = ({
7324
+ frame: frameToFreeze,
7325
+ children,
7326
+ active = true
7327
+ }) => {
7328
+ const frame = useCurrentFrame();
7329
+ const videoConfig = useVideoConfig();
7330
+ if (typeof frameToFreeze === "undefined") {
7331
+ throw new Error(`The <Freeze /> component requires a 'frame' prop, but none was passed.`);
7308
7332
  }
7309
- if (currentBackend !== null && current.length > 0) {
7310
- runs.push({ backend: currentBackend, effects: current });
7333
+ if (typeof frameToFreeze !== "number") {
7334
+ throw new Error(`The 'frame' prop of <Freeze /> must be a number, but is of type ${typeof frameToFreeze}`);
7311
7335
  }
7312
- return runs;
7313
- };
7314
- var devicePromise = null;
7315
- var getGpuDevice = () => {
7316
- if (devicePromise) {
7317
- return devicePromise;
7336
+ if (Number.isNaN(frameToFreeze)) {
7337
+ throw new Error(`The 'frame' prop of <Freeze /> must be a real number, but it is NaN.`);
7318
7338
  }
7319
- devicePromise = (async () => {
7320
- if (typeof navigator === "undefined" || !("gpu" in navigator)) {
7321
- throw new Error("WebGPU is not available in this environment");
7322
- }
7323
- const { gpu } = navigator;
7324
- const adapter = await gpu.requestAdapter();
7325
- if (!adapter) {
7326
- throw new Error("No WebGPU adapter available");
7327
- }
7328
- return adapter.requestDevice();
7329
- })();
7330
- return devicePromise;
7331
- };
7332
- var createEffectChainState = (width, height) => ({
7333
- pool: new CanvasPool(width, height),
7334
- setupCache: new WeakMap,
7335
- cleanupRegistry: [],
7336
- currentRunId: 0
7337
- });
7338
- var cleanupEffectChainState = (state) => {
7339
- state.currentRunId++;
7340
- for (const entry of state.cleanupRegistry) {
7341
- entry.definition.cleanup(entry.state);
7342
- }
7343
- };
7344
- var ensureSetup = (state, def, target) => {
7345
- const widened = def;
7346
- if (state.setupCache.has(widened)) {
7347
- return state.setupCache.get(widened);
7339
+ if (!Number.isFinite(frameToFreeze)) {
7340
+ throw new Error(`The 'frame' prop of <Freeze /> must be a finite number, but it is ${frameToFreeze}.`);
7348
7341
  }
7349
- const setupState = def.setup(target);
7350
- state.setupCache.set(widened, setupState);
7351
- state.cleanupRegistry.push({ definition: widened, state: setupState });
7352
- return setupState;
7353
- };
7354
- var runEffectChain = async ({
7355
- state,
7356
- source,
7357
- effects,
7358
- output,
7359
- frame,
7360
- width,
7361
- height
7362
- }) => {
7363
- const runId = ++state.currentRunId;
7364
- const isCancelled = () => state.currentRunId !== runId;
7365
- const runs = groupByBackend(effects);
7366
- let currentImage = source;
7367
- let lastTarget = null;
7368
- if (runs.length === 0) {
7369
- if (source === output) {
7370
- return true;
7342
+ const isActive = useMemo11(() => {
7343
+ if (typeof active === "boolean") {
7344
+ return active;
7371
7345
  }
7372
- const ctx = output.getContext("2d");
7373
- if (!ctx) {
7374
- throw new Error("Failed to acquire 2D context for output canvas");
7346
+ if (typeof active === "function") {
7347
+ return active(frame);
7375
7348
  }
7376
- ctx.clearRect(0, 0, width, height);
7377
- ctx.drawImage(currentImage, 0, 0, width, height);
7378
- return true;
7379
- }
7380
- let needsGpuDevice = false;
7381
- for (const run of runs) {
7382
- if (run.backend === "webgpu") {
7383
- needsGpuDevice = true;
7384
- break;
7349
+ }, [active, frame]);
7350
+ const timelineContext = useTimelineContext();
7351
+ const sequenceContext = useContext14(SequenceContext);
7352
+ const relativeFrom = sequenceContext?.relativeFrom ?? 0;
7353
+ const timelineValue = useMemo11(() => {
7354
+ if (!isActive) {
7355
+ return timelineContext;
7385
7356
  }
7386
- }
7387
- const gpuDevice = needsGpuDevice ? await getGpuDevice() : null;
7388
- if (isCancelled()) {
7389
- return false;
7390
- }
7391
- for (let runIndex = 0;runIndex < runs.length; runIndex++) {
7392
- const run = runs[runIndex];
7393
- const [a, b] = state.pool.getPair(run.backend);
7394
- let dst = a;
7395
- for (const eff of run.effects) {
7396
- const def = eff.definition;
7397
- const setupState = ensureSetup(state, def, dst);
7398
- def.apply({
7399
- source: currentImage,
7400
- target: dst,
7401
- state: setupState,
7402
- params: eff.params,
7403
- frame,
7404
- width,
7405
- height,
7406
- gpuDevice
7407
- });
7408
- if (run.backend === "webgl2") {
7409
- state.pool.assertContextNotLost(dst);
7357
+ return {
7358
+ ...timelineContext,
7359
+ playing: false,
7360
+ imperativePlaying: {
7361
+ current: false
7362
+ },
7363
+ frame: {
7364
+ [videoConfig.id]: frameToFreeze + relativeFrom
7410
7365
  }
7411
- currentImage = dst;
7412
- dst = dst === a ? b : a;
7366
+ };
7367
+ }, [isActive, timelineContext, videoConfig.id, frameToFreeze, relativeFrom]);
7368
+ const newSequenceContext = useMemo11(() => {
7369
+ if (!sequenceContext) {
7370
+ return null;
7413
7371
  }
7414
- lastTarget = currentImage ?? lastTarget;
7415
- const nextRun = runs[runIndex + 1];
7416
- if (nextRun && nextRun.backend !== run.backend && lastTarget) {
7417
- const bitmap = await createImageBitmap(lastTarget);
7418
- if (isCancelled()) {
7419
- bitmap.close();
7420
- return false;
7421
- }
7422
- currentImage = bitmap;
7372
+ if (!isActive) {
7373
+ return sequenceContext;
7423
7374
  }
7375
+ return {
7376
+ ...sequenceContext,
7377
+ cumulatedFrom: 0
7378
+ };
7379
+ }, [sequenceContext, isActive]);
7380
+ return /* @__PURE__ */ jsx92(TimelineContext.Provider, {
7381
+ value: timelineValue,
7382
+ children: /* @__PURE__ */ jsx92(SequenceContext.Provider, {
7383
+ value: newSequenceContext,
7384
+ children
7385
+ })
7386
+ });
7387
+ };
7388
+ var PremountContext = createContext14({
7389
+ premountFramesRemaining: 0
7390
+ });
7391
+ var sequenceVisualStyleSchema = {
7392
+ "style.translate": {
7393
+ type: "translate",
7394
+ step: 1,
7395
+ default: "0px 0px",
7396
+ description: "Offset"
7397
+ },
7398
+ "style.scale": {
7399
+ type: "number",
7400
+ min: 0.05,
7401
+ max: 100,
7402
+ step: 0.01,
7403
+ default: 1,
7404
+ description: "Scale"
7405
+ },
7406
+ "style.rotate": {
7407
+ type: "rotation",
7408
+ step: 1,
7409
+ default: "0deg",
7410
+ description: "Rotation"
7411
+ },
7412
+ "style.opacity": {
7413
+ type: "number",
7414
+ min: 0,
7415
+ max: 1,
7416
+ step: 0.01,
7417
+ default: 1,
7418
+ description: "Opacity"
7424
7419
  }
7425
- if (!lastTarget) {
7426
- return true;
7427
- }
7428
- const outCtx = output.getContext("2d");
7429
- if (!outCtx) {
7430
- throw new Error("Failed to acquire 2D context for output canvas");
7420
+ };
7421
+ var sequencePremountSchema = {
7422
+ premountFor: {
7423
+ type: "number",
7424
+ default: 0,
7425
+ description: "Premount For",
7426
+ min: 0,
7427
+ step: 1
7428
+ },
7429
+ postmountFor: {
7430
+ type: "hidden"
7431
+ },
7432
+ styleWhilePremounted: {
7433
+ type: "hidden"
7434
+ },
7435
+ styleWhilePostmounted: {
7436
+ type: "hidden"
7431
7437
  }
7432
- outCtx.clearRect(0, 0, width, height);
7433
- outCtx.drawImage(lastTarget, 0, 0, width, height);
7434
- return true;
7435
7438
  };
7436
- var useEffectChainState = () => {
7437
- const chainStateRef = useRef4(null);
7438
- const sizeRef = useRef4(null);
7439
- useEffect3(() => {
7440
- return () => {
7441
- if (chainStateRef.current) {
7442
- cleanupEffectChainState(chainStateRef.current);
7443
- }
7444
- };
7445
- }, []);
7446
- return useMemo10(() => ({
7447
- get: (width, height) => {
7448
- if (!sizeRef.current || sizeRef.current.width !== width || sizeRef.current.height !== height) {
7449
- if (chainStateRef.current) {
7450
- cleanupEffectChainState(chainStateRef.current);
7451
- }
7452
- chainStateRef.current = createEffectChainState(width, height);
7453
- sizeRef.current = { width, height };
7454
- }
7455
- return chainStateRef.current;
7439
+ var sequenceStyleSchema = {
7440
+ ...sequenceVisualStyleSchema,
7441
+ ...sequencePremountSchema
7442
+ };
7443
+ var hiddenField = {
7444
+ type: "boolean",
7445
+ default: false,
7446
+ description: "Hidden"
7447
+ };
7448
+ var sequenceSchema = {
7449
+ hidden: hiddenField,
7450
+ layout: {
7451
+ type: "enum",
7452
+ default: "absolute-fill",
7453
+ description: "Layout",
7454
+ variants: {
7455
+ "absolute-fill": sequenceStyleSchema,
7456
+ none: {}
7456
7457
  }
7457
- }), []);
7458
+ }
7458
7459
  };
7459
- var OverrideIdsToNodePathsGettersContext = createContext14({
7460
- overrideIdToNodePathMappings: {}
7461
- });
7462
- var OverrideIdsToNodePathsSettersContext = createContext14({
7463
- setOverrideIdToNodePath: () => {
7464
- throw new Error("OverrideIdsToNodePathsSettersContext not initialized");
7460
+ var sequenceSchemaDefaultLayoutNone = {
7461
+ ...sequenceSchema,
7462
+ layout: {
7463
+ ...sequenceSchema.layout,
7464
+ default: "none"
7465
7465
  }
7466
- });
7467
- var SequenceManager = React10.createContext({
7466
+ };
7467
+ var SequenceManager = React11.createContext({
7468
7468
  registerSequence: () => {
7469
7469
  throw new Error("SequenceManagerContext not initialized");
7470
7470
  },
@@ -7473,19 +7473,13 @@ var SequenceManager = React10.createContext({
7473
7473
  },
7474
7474
  sequences: []
7475
7475
  });
7476
- var SequenceVisibilityToggleContext = React10.createContext({
7477
- hidden: {},
7478
- setHidden: () => {
7479
- throw new Error("SequenceVisibilityToggle not initialized");
7480
- }
7481
- });
7482
7476
  var makeSequencePropsSubscriptionKey = (key) => {
7483
7477
  return `${key.nodePath.join(".")}.${key.sequenceKeys.join(".")}.${key.effectKeys.map((keys) => keys.join(".")).join(".")}`;
7484
7478
  };
7485
- var VisualModeCodeValuesContext = React10.createContext({
7479
+ var VisualModeCodeValuesContext = React11.createContext({
7486
7480
  codeValues: {}
7487
7481
  });
7488
- var VisualModeDragOverridesContext = React10.createContext({
7482
+ var VisualModeDragOverridesContext = React11.createContext({
7489
7483
  getDragOverrides: () => {
7490
7484
  throw new Error("VisualModeDragOverridesContext not initialized");
7491
7485
  },
@@ -7493,7 +7487,7 @@ var VisualModeDragOverridesContext = React10.createContext({
7493
7487
  throw new Error("VisualModeDragOverridesContext not initialized");
7494
7488
  }
7495
7489
  });
7496
- var VisualModeSettersContext = React10.createContext({
7490
+ var VisualModeSettersContext = React11.createContext({
7497
7491
  setDragOverrides: () => {
7498
7492
  throw new Error("VisualModeSettersContext not initialized");
7499
7493
  },
@@ -7513,9 +7507,8 @@ var VisualModeSettersContext = React10.createContext({
7513
7507
  var effectDragOverridesKey = (nodePath, effectIndex) => `${makeSequencePropsSubscriptionKey(nodePath)}.effects.${effectIndex}`;
7514
7508
  var SequenceManagerProvider = ({ children }) => {
7515
7509
  const [sequences, setSequences] = useState3([]);
7516
- const [hidden, setHidden] = useState3({});
7517
7510
  const [dragOverrides, setControlOverrides] = useState3({});
7518
- const controlOverridesRef = useRef5(dragOverrides);
7511
+ const controlOverridesRef = useRef4(dragOverrides);
7519
7512
  controlOverridesRef.current = dragOverrides;
7520
7513
  const [effectDragOverridesState, setEffectDragOverridesState] = useState3({});
7521
7514
  const [codeValues, setCodeValuesMapState] = useState3({});
@@ -7581,37 +7574,31 @@ var SequenceManagerProvider = ({ children }) => {
7581
7574
  const unregisterSequence = useCallback5((seq) => {
7582
7575
  setSequences((seqs) => seqs.filter((s) => s.id !== seq));
7583
7576
  }, []);
7584
- const sequenceContext = useMemo11(() => {
7577
+ const sequenceContext = useMemo12(() => {
7585
7578
  return {
7586
7579
  registerSequence,
7587
7580
  sequences,
7588
7581
  unregisterSequence
7589
7582
  };
7590
7583
  }, [registerSequence, sequences, unregisterSequence]);
7591
- const hiddenContext = useMemo11(() => {
7592
- return {
7593
- hidden,
7594
- setHidden
7595
- };
7596
- }, [hidden]);
7597
7584
  const getDragOverrides = useCallback5((nodePath) => {
7598
7585
  return dragOverrides[makeSequencePropsSubscriptionKey(nodePath)] ?? {};
7599
7586
  }, [dragOverrides]);
7600
7587
  const getEffectDragOverrides = useCallback5((nodePath, effectIndex) => {
7601
7588
  return effectDragOverridesState[effectDragOverridesKey(nodePath, effectIndex)] ?? {};
7602
7589
  }, [effectDragOverridesState]);
7603
- const codeValuesContext = useMemo11(() => {
7590
+ const codeValuesContext = useMemo12(() => {
7604
7591
  return {
7605
7592
  codeValues
7606
7593
  };
7607
7594
  }, [codeValues]);
7608
- const dragOverridesContext = useMemo11(() => {
7595
+ const dragOverridesContext = useMemo12(() => {
7609
7596
  return {
7610
7597
  getDragOverrides,
7611
7598
  getEffectDragOverrides
7612
7599
  };
7613
7600
  }, [getDragOverrides, getEffectDragOverrides]);
7614
- const settersContext = useMemo11(() => {
7601
+ const settersContext = useMemo12(() => {
7615
7602
  return {
7616
7603
  setDragOverrides,
7617
7604
  clearDragOverrides,
@@ -7626,38 +7613,75 @@ var SequenceManagerProvider = ({ children }) => {
7626
7613
  clearEffectDragOverrides,
7627
7614
  setCodeValues
7628
7615
  ]);
7629
- return /* @__PURE__ */ jsx92(SequenceManager.Provider, {
7616
+ return /* @__PURE__ */ jsx102(SequenceManager.Provider, {
7630
7617
  value: sequenceContext,
7631
- children: /* @__PURE__ */ jsx92(SequenceVisibilityToggleContext.Provider, {
7632
- value: hiddenContext,
7633
- children: /* @__PURE__ */ jsx92(VisualModeCodeValuesContext.Provider, {
7634
- value: codeValuesContext,
7635
- children: /* @__PURE__ */ jsx92(VisualModeDragOverridesContext.Provider, {
7636
- value: dragOverridesContext,
7637
- children: /* @__PURE__ */ jsx92(VisualModeSettersContext.Provider, {
7638
- value: settersContext,
7639
- children
7640
- })
7618
+ children: /* @__PURE__ */ jsx102(VisualModeCodeValuesContext.Provider, {
7619
+ value: codeValuesContext,
7620
+ children: /* @__PURE__ */ jsx102(VisualModeDragOverridesContext.Provider, {
7621
+ value: dragOverridesContext,
7622
+ children: /* @__PURE__ */ jsx102(VisualModeSettersContext.Provider, {
7623
+ value: settersContext,
7624
+ children
7641
7625
  })
7642
7626
  })
7643
7627
  })
7644
7628
  });
7645
7629
  };
7646
- var mergeOverrides = ({
7647
- descriptor,
7648
- codeOverrides,
7649
- dragOverrides
7650
- }) => {
7651
- if (!codeOverrides && !dragOverrides) {
7652
- return { params: descriptor.params, effectKey: descriptor.effectKey };
7653
- }
7654
- const merged = {
7655
- ...descriptor.params
7656
- };
7657
- if (codeOverrides) {
7658
- for (const [key, value] of Object.entries(codeOverrides)) {
7659
- if (value !== undefined) {
7660
- merged[key] = value;
7630
+ var ENABLE_V5_BREAKING_CHANGES = false;
7631
+ var deleteNestedKey = (obj, keysToRemove) => {
7632
+ for (const key of keysToRemove) {
7633
+ const parts = key.split(".");
7634
+ const parents = [obj];
7635
+ let current = obj;
7636
+ for (let i = 0;i < parts.length - 1; i++) {
7637
+ const part = parts[i];
7638
+ const next = current[part];
7639
+ if (next === undefined || next === null) {
7640
+ current = null;
7641
+ break;
7642
+ }
7643
+ current = next;
7644
+ parents.push(current);
7645
+ }
7646
+ if (current === null) {
7647
+ continue;
7648
+ }
7649
+ delete current[parts[parts.length - 1]];
7650
+ for (let i = parents.length - 1;i > 0; i--) {
7651
+ const parent = parents[i];
7652
+ if (Object.keys(parent).length === 0) {
7653
+ const parentKey = parts[i - 1];
7654
+ delete parents[i - 1][parentKey];
7655
+ } else {
7656
+ break;
7657
+ }
7658
+ }
7659
+ }
7660
+ return obj;
7661
+ };
7662
+ var OverrideIdsToNodePathsGettersContext = createContext15({
7663
+ overrideIdToNodePathMappings: {}
7664
+ });
7665
+ var OverrideIdsToNodePathsSettersContext = createContext15({
7666
+ setOverrideIdToNodePath: () => {
7667
+ throw new Error("OverrideIdsToNodePathsSettersContext not initialized");
7668
+ }
7669
+ });
7670
+ var mergeOverrides = ({
7671
+ descriptor,
7672
+ codeOverrides,
7673
+ dragOverrides
7674
+ }) => {
7675
+ if (!codeOverrides && !dragOverrides) {
7676
+ return { params: descriptor.params, effectKey: descriptor.effectKey };
7677
+ }
7678
+ const merged = {
7679
+ ...descriptor.params
7680
+ };
7681
+ if (codeOverrides) {
7682
+ for (const [key, value] of Object.entries(codeOverrides)) {
7683
+ if (value !== undefined) {
7684
+ merged[key] = value;
7661
7685
  }
7662
7686
  }
7663
7687
  }
@@ -7686,7 +7710,7 @@ var extractCodeOverrides = (propStatus) => {
7686
7710
  return hasAny ? out : null;
7687
7711
  };
7688
7712
  var useMemoizedEffectDefinitions = (effects) => {
7689
- const previousRef = useRef6(null);
7713
+ const previousRef = useRef5(null);
7690
7714
  const definitions = effects.map((descriptor) => descriptor.definition);
7691
7715
  const previous = previousRef.current;
7692
7716
  const isSame = previous !== null && previous.length === definitions.length && previous.every((def, i) => def === definitions[i]);
@@ -7731,10 +7755,10 @@ var useMemoizedEffects = ({
7731
7755
  effects,
7732
7756
  overrideId
7733
7757
  }) => {
7734
- const previousRef = useRef6(null);
7735
- const { codeValues } = useContext12(VisualModeCodeValuesContext);
7736
- const { getEffectDragOverrides } = useContext12(VisualModeDragOverridesContext);
7737
- const { overrideIdToNodePathMappings } = useContext12(OverrideIdsToNodePathsGettersContext);
7758
+ const previousRef = useRef5(null);
7759
+ const { codeValues } = useContext15(VisualModeCodeValuesContext);
7760
+ const { getEffectDragOverrides } = useContext15(VisualModeDragOverridesContext);
7761
+ const { overrideIdToNodePathMappings } = useContext15(OverrideIdsToNodePathsGettersContext);
7738
7762
  const previous = previousRef.current;
7739
7763
  const nodePath = overrideId ? overrideIdToNodePathMappings[overrideId] ?? null : null;
7740
7764
  const resolved = effects.map((descriptor, index) => {
@@ -7773,361 +7797,103 @@ var useMemoizedEffects = ({
7773
7797
  previousRef.current = next;
7774
7798
  return next;
7775
7799
  };
7776
- var componentsToAddStacksTo = [];
7777
- var getComponentsToAddStacksTo = () => componentsToAddStacksTo;
7778
- var addSequenceStackTraces = (component) => {
7779
- componentsToAddStacksTo.push(component);
7780
- };
7781
- var VERSION = "4.0.462";
7782
- var checkMultipleRemotionVersions = () => {
7783
- if (typeof globalThis === "undefined") {
7784
- return;
7785
- }
7786
- const set = () => {
7787
- globalThis.remotion_imported = VERSION;
7788
- if (typeof window !== "undefined") {
7789
- window.remotion_imported = VERSION;
7790
- }
7791
- };
7792
- const alreadyImported = globalThis.remotion_imported || typeof window !== "undefined" && window.remotion_imported;
7793
- if (alreadyImported) {
7794
- if (alreadyImported === VERSION) {
7795
- return;
7796
- }
7797
- if (typeof alreadyImported === "string" && alreadyImported.includes("webcodecs")) {
7798
- set();
7799
- return;
7800
+ var flattenActiveSchema = (schema, resolve) => {
7801
+ const out = {};
7802
+ for (const key of Object.keys(schema)) {
7803
+ const field = schema[key];
7804
+ if (field.type === "hidden") {
7805
+ continue;
7806
+ } else if (field.type === "enum") {
7807
+ out[key] = field;
7808
+ const current = resolve(key) ?? field.default;
7809
+ const variant = field.variants[current];
7810
+ if (variant) {
7811
+ Object.assign(out, flattenActiveSchema(variant, resolve));
7812
+ }
7813
+ } else {
7814
+ out[key] = field;
7800
7815
  }
7801
- throw new TypeError(`\uD83D\uDEA8 Multiple versions of Remotion detected: ${[
7802
- VERSION,
7803
- typeof alreadyImported === "string" ? alreadyImported : "an older version"
7804
- ].filter(truthy2).join(" and ")}. This will cause things to break in an unexpected way.
7805
- 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.`);
7806
7816
  }
7807
- set();
7817
+ return out;
7808
7818
  };
7809
- var useUnsafeVideoConfig = () => {
7810
- const context = useContext13(SequenceContext);
7811
- const ctxWidth = context?.width ?? null;
7812
- const ctxHeight = context?.height ?? null;
7813
- const ctxDuration = context?.durationInFrames ?? null;
7814
- const video = useVideo();
7815
- return useMemo13(() => {
7816
- if (!video) {
7817
- return null;
7819
+ var getFlatSchemaWithAllKeys = (schema) => {
7820
+ const out = {};
7821
+ const addKey = (key, field) => {
7822
+ if (key in out) {
7823
+ throw new Error(`Duplicate key "${key}" in schema: discriminated union variants must not share keys`);
7818
7824
  }
7819
- const {
7820
- id,
7821
- durationInFrames,
7822
- fps,
7823
- height,
7824
- width,
7825
- defaultProps,
7826
- props,
7827
- defaultCodec,
7828
- defaultOutName,
7829
- defaultVideoImageFormat,
7830
- defaultPixelFormat,
7831
- defaultProResProfile,
7832
- defaultSampleRate
7833
- } = video;
7834
- return {
7835
- id,
7836
- width: ctxWidth ?? width,
7837
- height: ctxHeight ?? height,
7838
- fps,
7839
- durationInFrames: ctxDuration ?? durationInFrames,
7840
- defaultProps,
7841
- props,
7842
- defaultCodec,
7843
- defaultOutName,
7844
- defaultVideoImageFormat,
7845
- defaultPixelFormat,
7846
- defaultProResProfile,
7847
- defaultSampleRate
7848
- };
7849
- }, [ctxDuration, ctxHeight, ctxWidth, video]);
7850
- };
7851
- var useVideoConfig = () => {
7852
- const videoConfig = useUnsafeVideoConfig();
7853
- const context = useContext14(CanUseRemotionHooks);
7854
- const isPlayer = useIsPlayer();
7855
- if (!videoConfig) {
7856
- if (typeof window !== "undefined" && window.remotion_isPlayer || isPlayer) {
7857
- throw new Error([
7858
- "No video config found. Likely reasons:",
7859
- "- 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.",
7860
- "- You have multiple versions of Remotion installed which causes the React context to get lost."
7861
- ].join("-"));
7825
+ out[key] = field;
7826
+ };
7827
+ for (const key of Object.keys(schema)) {
7828
+ const field = schema[key];
7829
+ addKey(key, field);
7830
+ if (field.type === "enum") {
7831
+ for (const variant of Object.values(field.variants)) {
7832
+ const flatVariant = getFlatSchemaWithAllKeys(variant);
7833
+ for (const variantKey of Object.keys(flatVariant)) {
7834
+ addKey(variantKey, flatVariant[variantKey]);
7835
+ }
7836
+ }
7862
7837
  }
7863
- 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.");
7864
- }
7865
- if (!context) {
7866
- throw new Error("Called useVideoConfig() outside a Remotion composition.");
7867
7838
  }
7868
- return videoConfig;
7839
+ return out;
7869
7840
  };
7870
- var Freeze = ({
7871
- frame: frameToFreeze,
7872
- children,
7873
- active = true
7841
+ var findPropsToDelete = ({
7842
+ schema,
7843
+ key,
7844
+ value
7874
7845
  }) => {
7875
- const frame = useCurrentFrame();
7876
- const videoConfig = useVideoConfig();
7877
- if (typeof frameToFreeze === "undefined") {
7878
- throw new Error(`The <Freeze /> component requires a 'frame' prop, but none was passed.`);
7846
+ const fieldSchema = schema[key];
7847
+ if (!fieldSchema) {
7848
+ throw new Error("Key " + JSON.stringify(key) + " not found in schema");
7879
7849
  }
7880
- if (typeof frameToFreeze !== "number") {
7881
- throw new Error(`The 'frame' prop of <Freeze /> must be a number, but is of type ${typeof frameToFreeze}`);
7850
+ if (typeof value !== "string") {
7851
+ throw new Error("Value must be a string, but is " + JSON.stringify(value));
7882
7852
  }
7883
- if (Number.isNaN(frameToFreeze)) {
7884
- throw new Error(`The 'frame' prop of <Freeze /> must be a real number, but it is NaN.`);
7853
+ if (fieldSchema.type !== "enum") {
7854
+ throw new Error("Key " + JSON.stringify(key) + " is not an enum");
7885
7855
  }
7886
- if (!Number.isFinite(frameToFreeze)) {
7887
- throw new Error(`The 'frame' prop of <Freeze /> must be a finite number, but it is ${frameToFreeze}.`);
7856
+ const currentVariant = fieldSchema.variants[value];
7857
+ if (!currentVariant) {
7858
+ 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));
7888
7859
  }
7889
- const isActive = useMemo14(() => {
7890
- if (typeof active === "boolean") {
7891
- return active;
7892
- }
7893
- if (typeof active === "function") {
7894
- return active(frame);
7860
+ const otherVariants = Object.keys(fieldSchema.variants).filter((v) => v !== value);
7861
+ const otherKeys = new Set;
7862
+ for (const variant of otherVariants) {
7863
+ const otherVariant = fieldSchema.variants[variant];
7864
+ const keys = Object.keys(otherVariant);
7865
+ for (const k of keys) {
7866
+ otherKeys.add(k);
7895
7867
  }
7896
- }, [active, frame]);
7897
- const timelineContext = useTimelineContext();
7898
- const sequenceContext = useContext15(SequenceContext);
7899
- const relativeFrom = sequenceContext?.relativeFrom ?? 0;
7900
- const timelineValue = useMemo14(() => {
7901
- if (!isActive) {
7902
- return timelineContext;
7868
+ }
7869
+ return [...otherKeys];
7870
+ };
7871
+ var getEffectiveVisualModeValue = ({
7872
+ codeValue,
7873
+ dragOverrideValue,
7874
+ defaultValue,
7875
+ shouldResortToDefaultValueIfUndefined = false
7876
+ }) => {
7877
+ if (dragOverrideValue !== undefined) {
7878
+ return dragOverrideValue;
7879
+ }
7880
+ if (codeValue.codeValue === undefined && shouldResortToDefaultValueIfUndefined) {
7881
+ return defaultValue;
7882
+ }
7883
+ return codeValue.codeValue;
7884
+ };
7885
+ var findFieldInSchema = (schema, key) => {
7886
+ if (key in schema) {
7887
+ return schema[key];
7888
+ }
7889
+ for (const field of Object.values(schema)) {
7890
+ if (field.type !== "enum") {
7891
+ continue;
7903
7892
  }
7904
- return {
7905
- ...timelineContext,
7906
- playing: false,
7907
- imperativePlaying: {
7908
- current: false
7909
- },
7910
- frame: {
7911
- [videoConfig.id]: frameToFreeze + relativeFrom
7912
- }
7913
- };
7914
- }, [isActive, timelineContext, videoConfig.id, frameToFreeze, relativeFrom]);
7915
- const newSequenceContext = useMemo14(() => {
7916
- if (!sequenceContext) {
7917
- return null;
7918
- }
7919
- if (!isActive) {
7920
- return sequenceContext;
7921
- }
7922
- return {
7923
- ...sequenceContext,
7924
- cumulatedFrom: 0
7925
- };
7926
- }, [sequenceContext, isActive]);
7927
- return /* @__PURE__ */ jsx112(TimelineContext.Provider, {
7928
- value: timelineValue,
7929
- children: /* @__PURE__ */ jsx112(SequenceContext.Provider, {
7930
- value: newSequenceContext,
7931
- children
7932
- })
7933
- });
7934
- };
7935
- var PremountContext = createContext15({
7936
- premountFramesRemaining: 0
7937
- });
7938
- var sequenceStyleSchema = {
7939
- "style.translate": {
7940
- type: "translate",
7941
- step: 1,
7942
- default: "0px 0px",
7943
- description: "Offset"
7944
- },
7945
- "style.scale": {
7946
- type: "number",
7947
- min: 0.05,
7948
- max: 100,
7949
- step: 0.01,
7950
- default: 1,
7951
- description: "Scale"
7952
- },
7953
- "style.rotate": {
7954
- type: "rotation",
7955
- step: 1,
7956
- default: "0deg",
7957
- description: "Rotation"
7958
- },
7959
- "style.opacity": {
7960
- type: "number",
7961
- min: 0,
7962
- max: 1,
7963
- step: 0.01,
7964
- default: 1,
7965
- description: "Opacity"
7966
- },
7967
- premountFor: {
7968
- type: "number",
7969
- default: 0,
7970
- description: "Premount For",
7971
- min: 0,
7972
- step: 1
7973
- },
7974
- postmountFor: {
7975
- type: "hidden"
7976
- },
7977
- styleWhilePremounted: {
7978
- type: "hidden"
7979
- },
7980
- styleWhilePostmounted: {
7981
- type: "hidden"
7982
- }
7983
- };
7984
- var sequenceSchema = {
7985
- layout: {
7986
- type: "enum",
7987
- default: "absolute-fill",
7988
- description: "Layout",
7989
- variants: {
7990
- "absolute-fill": sequenceStyleSchema,
7991
- none: {}
7992
- }
7993
- }
7994
- };
7995
- var sequenceSchemaDefaultLayoutNone = {
7996
- ...sequenceSchema,
7997
- layout: {
7998
- ...sequenceSchema.layout,
7999
- default: "none"
8000
- }
8001
- };
8002
- var ENABLE_V5_BREAKING_CHANGES = false;
8003
- var deleteNestedKey = (obj, keysToRemove) => {
8004
- for (const key of keysToRemove) {
8005
- const parts = key.split(".");
8006
- const parents = [obj];
8007
- let current = obj;
8008
- for (let i = 0;i < parts.length - 1; i++) {
8009
- const part = parts[i];
8010
- const next = current[part];
8011
- if (next === undefined || next === null) {
8012
- current = null;
8013
- break;
8014
- }
8015
- current = next;
8016
- parents.push(current);
8017
- }
8018
- if (current === null) {
8019
- continue;
8020
- }
8021
- delete current[parts[parts.length - 1]];
8022
- for (let i = parents.length - 1;i > 0; i--) {
8023
- const parent = parents[i];
8024
- if (Object.keys(parent).length === 0) {
8025
- const parentKey = parts[i - 1];
8026
- delete parents[i - 1][parentKey];
8027
- } else {
8028
- break;
8029
- }
8030
- }
8031
- }
8032
- return obj;
8033
- };
8034
- var flattenActiveSchema = (schema, resolve) => {
8035
- const out = {};
8036
- for (const key of Object.keys(schema)) {
8037
- const field = schema[key];
8038
- if (field.type === "hidden") {
8039
- continue;
8040
- } else if (field.type === "enum") {
8041
- out[key] = field;
8042
- const current = resolve(key) ?? field.default;
8043
- const variant = field.variants[current];
8044
- if (variant) {
8045
- Object.assign(out, flattenActiveSchema(variant, resolve));
8046
- }
8047
- } else {
8048
- out[key] = field;
8049
- }
8050
- }
8051
- return out;
8052
- };
8053
- var getFlatSchemaWithAllKeys = (schema) => {
8054
- const out = {};
8055
- const addKey = (key, field) => {
8056
- if (key in out) {
8057
- throw new Error(`Duplicate key "${key}" in schema: discriminated union variants must not share keys`);
8058
- }
8059
- out[key] = field;
8060
- };
8061
- for (const key of Object.keys(schema)) {
8062
- const field = schema[key];
8063
- addKey(key, field);
8064
- if (field.type === "enum") {
8065
- for (const variant of Object.values(field.variants)) {
8066
- const flatVariant = getFlatSchemaWithAllKeys(variant);
8067
- for (const variantKey of Object.keys(flatVariant)) {
8068
- addKey(variantKey, flatVariant[variantKey]);
8069
- }
8070
- }
8071
- }
8072
- }
8073
- return out;
8074
- };
8075
- var findPropsToDelete = ({
8076
- schema,
8077
- key,
8078
- value
8079
- }) => {
8080
- const fieldSchema = schema[key];
8081
- if (!fieldSchema) {
8082
- throw new Error("Key " + JSON.stringify(key) + " not found in schema");
8083
- }
8084
- if (typeof value !== "string") {
8085
- throw new Error("Value must be a string, but is " + JSON.stringify(value));
8086
- }
8087
- if (fieldSchema.type !== "enum") {
8088
- throw new Error("Key " + JSON.stringify(key) + " is not an enum");
8089
- }
8090
- const currentVariant = fieldSchema.variants[value];
8091
- if (!currentVariant) {
8092
- 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));
8093
- }
8094
- const otherVariants = Object.keys(fieldSchema.variants).filter((v) => v !== value);
8095
- const otherKeys = new Set;
8096
- for (const variant of otherVariants) {
8097
- const otherVariant = fieldSchema.variants[variant];
8098
- const keys = Object.keys(otherVariant);
8099
- for (const k of keys) {
8100
- otherKeys.add(k);
8101
- }
8102
- }
8103
- return [...otherKeys];
8104
- };
8105
- var getEffectiveVisualModeValue = ({
8106
- codeValue,
8107
- dragOverrideValue,
8108
- defaultValue,
8109
- shouldResortToDefaultValueIfUndefined = false
8110
- }) => {
8111
- if (dragOverrideValue !== undefined) {
8112
- return dragOverrideValue;
8113
- }
8114
- if (codeValue.codeValue === undefined && shouldResortToDefaultValueIfUndefined) {
8115
- return defaultValue;
8116
- }
8117
- return codeValue.codeValue;
8118
- };
8119
- var findFieldInSchema = (schema, key) => {
8120
- if (key in schema) {
8121
- return schema[key];
8122
- }
8123
- for (const field of Object.values(schema)) {
8124
- if (field.type !== "enum") {
8125
- continue;
8126
- }
8127
- for (const variant of Object.values(field.variants)) {
8128
- const found = findFieldInSchema(variant, key);
8129
- if (found) {
8130
- return found;
7893
+ for (const variant of Object.values(field.variants)) {
7894
+ const found = findFieldInSchema(variant, key);
7895
+ if (found) {
7896
+ return found;
8131
7897
  }
8132
7898
  }
8133
7899
  }
@@ -8228,7 +7994,7 @@ var wrapInSchema = (Component, schema) => {
8228
7994
  const Wrapped = forwardRef2((props, ref) => {
8229
7995
  const env = useRemotionEnvironment();
8230
7996
  if (!env.isStudio || env.isReadOnlyStudio || env.isRendering) {
8231
- return React13.createElement(Component, {
7997
+ return React12.createElement(Component, {
8232
7998
  ...props,
8233
7999
  _experimentalControls: null,
8234
8000
  ref
@@ -8238,12 +8004,12 @@ var wrapInSchema = (Component, schema) => {
8238
8004
  const { getDragOverrides } = useContext16(VisualModeDragOverridesContext);
8239
8005
  const nodePathMapping = useContext16(OverrideIdsToNodePathsGettersContext);
8240
8006
  if (props._experimentalControls) {
8241
- return React13.createElement(Component, {
8007
+ return React12.createElement(Component, {
8242
8008
  ...props,
8243
8009
  ref
8244
8010
  });
8245
8011
  }
8246
- const [overrideId] = useState5(() => {
8012
+ const [overrideId] = useState4(() => {
8247
8013
  const { stack } = props;
8248
8014
  if (!stack) {
8249
8015
  return String(Math.random());
@@ -8258,15 +8024,15 @@ var wrapInSchema = (Component, schema) => {
8258
8024
  });
8259
8025
  const nodePath = nodePathMapping.overrideIdToNodePathMappings[overrideId] ?? null;
8260
8026
  const runtimeValues = flatKeys.map((k) => getNestedValue(props, k));
8261
- const currentRuntimeValueDotNotation = useMemo15(() => readValuesFromProps(props, flatKeys), runtimeValues);
8262
- const controls = useMemo15(() => {
8027
+ const currentRuntimeValueDotNotation = useMemo13(() => readValuesFromProps(props, flatKeys), runtimeValues);
8028
+ const controls = useMemo13(() => {
8263
8029
  return {
8264
8030
  schema,
8265
8031
  currentRuntimeValueDotNotation,
8266
8032
  overrideId
8267
8033
  };
8268
8034
  }, [currentRuntimeValueDotNotation, overrideId]);
8269
- const { merged: valuesDotNotation, propsToDelete } = useMemo15(() => {
8035
+ const { merged: valuesDotNotation, propsToDelete } = useMemo13(() => {
8270
8036
  return computeEffectiveSchemaValuesDotNotation({
8271
8037
  schema,
8272
8038
  currentValue: currentRuntimeValueDotNotation,
@@ -8286,7 +8052,7 @@ var wrapInSchema = (Component, schema) => {
8286
8052
  schemaKeys: activeKeys,
8287
8053
  propsToDelete
8288
8054
  });
8289
- return React13.createElement(Component, {
8055
+ return React12.createElement(Component, {
8290
8056
  ...mergedProps,
8291
8057
  _experimentalControls: controls,
8292
8058
  ref
@@ -8303,6 +8069,7 @@ var RegularSequenceRefForwardingFunction = ({
8303
8069
  height,
8304
8070
  width,
8305
8071
  showInTimeline = true,
8072
+ hidden = false,
8306
8073
  _experimentalControls: controls,
8307
8074
  _experimentalEffects,
8308
8075
  _remotionInternalLoopDisplay: loopDisplay,
@@ -8313,7 +8080,7 @@ var RegularSequenceRefForwardingFunction = ({
8313
8080
  ...other
8314
8081
  }, ref) => {
8315
8082
  const { layout = "absolute-fill" } = other;
8316
- const [id] = useState6(() => String(Math.random()));
8083
+ const [id] = useState5(() => String(Math.random()));
8317
8084
  const parentSequence = useContext17(SequenceContext);
8318
8085
  const { rootId } = useTimelineContext();
8319
8086
  const cumulatedFrom = parentSequence ? parentSequence.cumulatedFrom + parentSequence.relativeFrom : 0;
@@ -8341,14 +8108,13 @@ var RegularSequenceRefForwardingFunction = ({
8341
8108
  const parentSequenceDuration = parentSequence ? Math.min(parentSequence.durationInFrames - from, durationInFrames) : durationInFrames;
8342
8109
  const actualDurationInFrames = Math.max(0, Math.min(videoConfig.durationInFrames - from, parentSequenceDuration));
8343
8110
  const { registerSequence, unregisterSequence } = useContext17(SequenceManager);
8344
- const { hidden } = useContext17(SequenceVisibilityToggleContext);
8345
- const premounting = useMemo16(() => {
8111
+ const premounting = useMemo14(() => {
8346
8112
  return parentSequence?.premounting || Boolean(other._remotionInternalIsPremounting);
8347
8113
  }, [other._remotionInternalIsPremounting, parentSequence?.premounting]);
8348
- const postmounting = useMemo16(() => {
8114
+ const postmounting = useMemo14(() => {
8349
8115
  return parentSequence?.postmounting || Boolean(other._remotionInternalIsPostmounting);
8350
8116
  }, [other._remotionInternalIsPostmounting, parentSequence?.postmounting]);
8351
- const contextValue = useMemo16(() => {
8117
+ const contextValue = useMemo14(() => {
8352
8118
  return {
8353
8119
  cumulatedFrom,
8354
8120
  relativeFrom: from,
@@ -8375,12 +8141,14 @@ var RegularSequenceRefForwardingFunction = ({
8375
8141
  premountDisplay,
8376
8142
  postmountDisplay
8377
8143
  ]);
8378
- const timelineClipName = useMemo16(() => {
8144
+ const timelineClipName = useMemo14(() => {
8379
8145
  return name ?? "";
8380
8146
  }, [name]);
8381
8147
  const env = useRemotionEnvironment();
8382
8148
  const inheritedStack = other?.stack ?? null;
8383
- useEffect5(() => {
8149
+ const stackRef = useRef6(null);
8150
+ stackRef.current = stack ?? inheritedStack;
8151
+ useEffect3(() => {
8384
8152
  if (!env.isStudio) {
8385
8153
  return;
8386
8154
  }
@@ -8403,7 +8171,7 @@ var RegularSequenceRefForwardingFunction = ({
8403
8171
  rootId,
8404
8172
  showInTimeline,
8405
8173
  src: isMedia.data.src,
8406
- stack: stack ?? inheritedStack,
8174
+ getStack: () => stackRef.current,
8407
8175
  startMediaFrom: isMedia.data.startMediaFrom,
8408
8176
  volume: isMedia.data.volumes
8409
8177
  });
@@ -8422,7 +8190,7 @@ var RegularSequenceRefForwardingFunction = ({
8422
8190
  showInTimeline,
8423
8191
  nonce: nonce.get(),
8424
8192
  loopDisplay,
8425
- stack: stack ?? inheritedStack,
8193
+ getStack: () => stackRef.current,
8426
8194
  premountDisplay: premountDisplay ?? null,
8427
8195
  postmountDisplay: postmountDisplay ?? null,
8428
8196
  controls: controls ?? null,
@@ -8445,11 +8213,9 @@ var RegularSequenceRefForwardingFunction = ({
8445
8213
  showInTimeline,
8446
8214
  nonce,
8447
8215
  loopDisplay,
8448
- stack,
8449
8216
  premountDisplay,
8450
8217
  postmountDisplay,
8451
8218
  env.isStudio,
8452
- inheritedStack,
8453
8219
  controls,
8454
8220
  _experimentalEffects,
8455
8221
  isMedia
@@ -8457,7 +8223,7 @@ var RegularSequenceRefForwardingFunction = ({
8457
8223
  const endThreshold = Math.ceil(cumulatedFrom + from + durationInFrames - 1);
8458
8224
  const content = absoluteFrame < cumulatedFrom + from ? null : absoluteFrame > endThreshold ? null : children;
8459
8225
  const styleIfThere = other.layout === "none" ? undefined : other.style;
8460
- const defaultStyle = useMemo16(() => {
8226
+ const defaultStyle = useMemo14(() => {
8461
8227
  return {
8462
8228
  flexDirection: undefined,
8463
8229
  ...width ? { width } : {},
@@ -8468,94 +8234,334 @@ var RegularSequenceRefForwardingFunction = ({
8468
8234
  if (ref !== null && layout === "none") {
8469
8235
  throw new TypeError('It is not supported to pass both a `ref` and `layout="none"` to <Sequence />.');
8470
8236
  }
8471
- const isSequenceHidden = hidden[id] ?? false;
8472
- if (isSequenceHidden) {
8473
- return null;
8237
+ if (hidden) {
8238
+ return null;
8239
+ }
8240
+ return /* @__PURE__ */ jsx112(SequenceContext.Provider, {
8241
+ value: contextValue,
8242
+ children: content === null ? null : other.layout === "none" ? content : /* @__PURE__ */ jsx112(AbsoluteFill, {
8243
+ ref,
8244
+ style: defaultStyle,
8245
+ className: other.className,
8246
+ children: content
8247
+ })
8248
+ });
8249
+ };
8250
+ var RegularSequence = forwardRef3(RegularSequenceRefForwardingFunction);
8251
+ var PremountedPostmountedSequenceRefForwardingFunction = (props, ref) => {
8252
+ const parentPremountContext = useContext17(PremountContext);
8253
+ const frame = useCurrentFrame() - parentPremountContext.premountFramesRemaining;
8254
+ if (props.layout === "none") {
8255
+ throw new Error('`<Sequence>` with `premountFor` and `postmountFor` props does not support layout="none"');
8256
+ }
8257
+ const {
8258
+ style: passedStyle,
8259
+ from = 0,
8260
+ durationInFrames = Infinity,
8261
+ premountFor = 0,
8262
+ postmountFor = 0,
8263
+ styleWhilePremounted,
8264
+ styleWhilePostmounted,
8265
+ ...otherProps
8266
+ } = props;
8267
+ const endThreshold = Math.ceil(from + durationInFrames - 1);
8268
+ const premountingActive = frame < from && frame >= from - premountFor;
8269
+ const postmountingActive = frame > endThreshold && frame <= endThreshold + postmountFor;
8270
+ const freezeFrame = premountingActive ? from : postmountingActive ? from + durationInFrames - 1 : 0;
8271
+ const isFreezingActive = premountingActive || postmountingActive;
8272
+ const style = useMemo14(() => {
8273
+ return {
8274
+ ...passedStyle,
8275
+ opacity: premountingActive || postmountingActive ? 0 : 1,
8276
+ pointerEvents: premountingActive || postmountingActive ? "none" : passedStyle?.pointerEvents ?? undefined,
8277
+ ...premountingActive ? styleWhilePremounted : {},
8278
+ ...postmountingActive ? styleWhilePostmounted : {}
8279
+ };
8280
+ }, [
8281
+ passedStyle,
8282
+ premountingActive,
8283
+ postmountingActive,
8284
+ styleWhilePremounted,
8285
+ styleWhilePostmounted
8286
+ ]);
8287
+ return /* @__PURE__ */ jsx112(Freeze, {
8288
+ frame: freezeFrame,
8289
+ active: isFreezingActive,
8290
+ children: /* @__PURE__ */ jsx112(SequenceInner, {
8291
+ ref,
8292
+ from,
8293
+ durationInFrames,
8294
+ style,
8295
+ _remotionInternalPremountDisplay: premountFor,
8296
+ _remotionInternalPostmountDisplay: postmountFor,
8297
+ _remotionInternalIsPremounting: premountingActive,
8298
+ _remotionInternalIsPostmounting: postmountingActive,
8299
+ ...otherProps
8300
+ })
8301
+ });
8302
+ };
8303
+ var PremountedPostmountedSequence = forwardRef3(PremountedPostmountedSequenceRefForwardingFunction);
8304
+ var SequenceRefForwardingFunction = (props, ref) => {
8305
+ const env = useRemotionEnvironment();
8306
+ const { fps } = useVideoConfig();
8307
+ if (props.layout !== "none" && !env.isRendering) {
8308
+ const effectivePremountFor = ENABLE_V5_BREAKING_CHANGES ? props.premountFor ?? fps : props.premountFor;
8309
+ if (effectivePremountFor || props.postmountFor) {
8310
+ return /* @__PURE__ */ jsx112(PremountedPostmountedSequence, {
8311
+ ref,
8312
+ ...props,
8313
+ premountFor: effectivePremountFor
8314
+ });
8315
+ }
8316
+ }
8317
+ return /* @__PURE__ */ jsx112(RegularSequence, {
8318
+ ...props,
8319
+ ref
8320
+ });
8321
+ };
8322
+ var SequenceInner = forwardRef3(SequenceRefForwardingFunction);
8323
+ var Sequence = wrapInSchema(SequenceInner, sequenceSchema);
8324
+ var WEBGL_CONTEXT_DOCS_URL = "https://remotion.dev/docs/troubleshooting/webgl2-context";
8325
+ var webGlContextErrorMessage = (versionLabel, effectName) => `Failed to acquire ${versionLabel} context for ${effectName}. ` + 'Pass --gl=angle when using the CLI, set chromiumOptions: { gl: "angle" } when using SSR APIs, ' + 'or set "OpenGL render backend" to "angle" in the Advanced section when rendering in the Studio. ' + `See ${WEBGL_CONTEXT_DOCS_URL}`;
8326
+ var createWebGLContextError = (effectName) => new Error(webGlContextErrorMessage("WebGL", effectName));
8327
+ var createWebGL2ContextError = (effectName) => new Error(webGlContextErrorMessage("WebGL2", effectName));
8328
+
8329
+ class CanvasPool {
8330
+ width;
8331
+ height;
8332
+ pairs = new Map;
8333
+ lostContexts = new Set;
8334
+ constructor(width, height) {
8335
+ this.width = width;
8336
+ this.height = height;
8337
+ }
8338
+ getPair(backend) {
8339
+ const existing = this.pairs.get(backend);
8340
+ if (existing) {
8341
+ return existing;
8342
+ }
8343
+ const pair = [
8344
+ this.allocateCanvas(backend),
8345
+ this.allocateCanvas(backend)
8346
+ ];
8347
+ this.pairs.set(backend, pair);
8348
+ return pair;
8349
+ }
8350
+ assertContextNotLost(canvas) {
8351
+ if (this.lostContexts.has(canvas)) {
8352
+ 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.");
8353
+ }
8354
+ }
8355
+ allocateCanvas(backend) {
8356
+ const canvas = document.createElement("canvas");
8357
+ canvas.width = this.width;
8358
+ canvas.height = this.height;
8359
+ switch (backend) {
8360
+ case "2d": {
8361
+ const ctx = canvas.getContext("2d", {
8362
+ colorSpace: "srgb"
8363
+ });
8364
+ if (!ctx) {
8365
+ throw new Error("Failed to acquire 2D context for canvas effect");
8366
+ }
8367
+ return canvas;
8368
+ }
8369
+ case "webgl2": {
8370
+ const ctx = canvas.getContext("webgl2", {
8371
+ premultipliedAlpha: true,
8372
+ alpha: true,
8373
+ preserveDrawingBuffer: true
8374
+ });
8375
+ if (!ctx) {
8376
+ throw createWebGL2ContextError("canvas effect");
8377
+ }
8378
+ canvas.addEventListener("webglcontextlost", (e) => {
8379
+ e.preventDefault();
8380
+ this.lostContexts.add(canvas);
8381
+ });
8382
+ canvas.addEventListener("webglcontextrestored", () => {
8383
+ this.lostContexts.delete(canvas);
8384
+ });
8385
+ ctx.pixelStorei(ctx.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
8386
+ return canvas;
8387
+ }
8388
+ case "webgpu": {
8389
+ if (typeof navigator === "undefined" || !("gpu" in navigator)) {
8390
+ throw new Error("WebGPU is not available in this environment for canvas effect");
8391
+ }
8392
+ return canvas;
8393
+ }
8394
+ default: {
8395
+ const exhaustive = backend;
8396
+ throw new Error(`Unknown effect backend: ${exhaustive}`);
8397
+ }
8398
+ }
8399
+ }
8400
+ }
8401
+ var groupByBackend = (effects) => {
8402
+ const runs = [];
8403
+ let current = [];
8404
+ let currentBackend = null;
8405
+ for (const eff of effects) {
8406
+ const { backend } = eff.definition;
8407
+ if (currentBackend === null || backend === currentBackend) {
8408
+ current.push(eff);
8409
+ currentBackend = backend;
8410
+ } else {
8411
+ runs.push({ backend: currentBackend, effects: current });
8412
+ current = [eff];
8413
+ currentBackend = backend;
8414
+ }
8415
+ }
8416
+ if (currentBackend !== null && current.length > 0) {
8417
+ runs.push({ backend: currentBackend, effects: current });
8418
+ }
8419
+ return runs;
8420
+ };
8421
+ var devicePromise = null;
8422
+ var getGpuDevice = () => {
8423
+ if (devicePromise) {
8424
+ return devicePromise;
8425
+ }
8426
+ devicePromise = (async () => {
8427
+ if (typeof navigator === "undefined" || !("gpu" in navigator)) {
8428
+ throw new Error("WebGPU is not available in this environment");
8429
+ }
8430
+ const { gpu } = navigator;
8431
+ const adapter = await gpu.requestAdapter();
8432
+ if (!adapter) {
8433
+ throw new Error("No WebGPU adapter available");
8434
+ }
8435
+ return adapter.requestDevice();
8436
+ })();
8437
+ return devicePromise;
8438
+ };
8439
+ var createEffectChainState = (width, height) => ({
8440
+ pool: new CanvasPool(width, height),
8441
+ setupCache: new WeakMap,
8442
+ cleanupRegistry: [],
8443
+ currentRunId: 0
8444
+ });
8445
+ var cleanupEffectChainState = (state) => {
8446
+ state.currentRunId++;
8447
+ for (const entry of state.cleanupRegistry) {
8448
+ entry.definition.cleanup(entry.state);
8449
+ }
8450
+ };
8451
+ var ensureSetup = (state, def, target) => {
8452
+ const widened = def;
8453
+ if (state.setupCache.has(widened)) {
8454
+ return state.setupCache.get(widened);
8455
+ }
8456
+ const setupState = def.setup(target);
8457
+ state.setupCache.set(widened, setupState);
8458
+ state.cleanupRegistry.push({ definition: widened, state: setupState });
8459
+ return setupState;
8460
+ };
8461
+ var runEffectChain = async ({
8462
+ state,
8463
+ source,
8464
+ effects,
8465
+ output,
8466
+ width,
8467
+ height
8468
+ }) => {
8469
+ const runId = ++state.currentRunId;
8470
+ const isCancelled = () => state.currentRunId !== runId;
8471
+ const enabledEffects = effects.filter((e) => !e.params.disabled);
8472
+ const runs = groupByBackend(enabledEffects);
8473
+ let currentImage = source;
8474
+ let lastTarget = null;
8475
+ if (runs.length === 0) {
8476
+ if (source === output) {
8477
+ return true;
8478
+ }
8479
+ const ctx = output.getContext("2d");
8480
+ if (!ctx) {
8481
+ throw new Error("Failed to acquire 2D context for output canvas");
8482
+ }
8483
+ ctx.clearRect(0, 0, width, height);
8484
+ ctx.drawImage(currentImage, 0, 0, width, height);
8485
+ return true;
8486
+ }
8487
+ let needsGpuDevice = false;
8488
+ for (const run of runs) {
8489
+ if (run.backend === "webgpu") {
8490
+ needsGpuDevice = true;
8491
+ break;
8492
+ }
8493
+ }
8494
+ const gpuDevice = needsGpuDevice ? await getGpuDevice() : null;
8495
+ if (isCancelled()) {
8496
+ return false;
8497
+ }
8498
+ for (let runIndex = 0;runIndex < runs.length; runIndex++) {
8499
+ const run = runs[runIndex];
8500
+ const [a, b] = state.pool.getPair(run.backend);
8501
+ let dst = a;
8502
+ for (const eff of run.effects) {
8503
+ const def = eff.definition;
8504
+ const setupState = ensureSetup(state, def, dst);
8505
+ def.apply({
8506
+ source: currentImage,
8507
+ target: dst,
8508
+ state: setupState,
8509
+ params: eff.params,
8510
+ width,
8511
+ height,
8512
+ gpuDevice
8513
+ });
8514
+ if (run.backend === "webgl2") {
8515
+ state.pool.assertContextNotLost(dst);
8516
+ }
8517
+ currentImage = dst;
8518
+ dst = dst === a ? b : a;
8519
+ }
8520
+ lastTarget = currentImage ?? lastTarget;
8521
+ const nextRun = runs[runIndex + 1];
8522
+ if (nextRun && nextRun.backend !== run.backend && lastTarget) {
8523
+ const bitmap = await createImageBitmap(lastTarget);
8524
+ if (isCancelled()) {
8525
+ bitmap.close();
8526
+ return false;
8527
+ }
8528
+ currentImage = bitmap;
8529
+ }
8530
+ }
8531
+ if (!lastTarget) {
8532
+ return true;
8474
8533
  }
8475
- return /* @__PURE__ */ jsx12(SequenceContext.Provider, {
8476
- value: contextValue,
8477
- children: content === null ? null : other.layout === "none" ? content : /* @__PURE__ */ jsx12(AbsoluteFill, {
8478
- ref,
8479
- style: defaultStyle,
8480
- className: other.className,
8481
- children: content
8482
- })
8483
- });
8484
- };
8485
- var RegularSequence = forwardRef3(RegularSequenceRefForwardingFunction);
8486
- var PremountedPostmountedSequenceRefForwardingFunction = (props, ref) => {
8487
- const parentPremountContext = useContext17(PremountContext);
8488
- const frame = useCurrentFrame() - parentPremountContext.premountFramesRemaining;
8489
- if (props.layout === "none") {
8490
- throw new Error('`<Sequence>` with `premountFor` and `postmountFor` props does not support layout="none"');
8534
+ const outCtx = output.getContext("2d");
8535
+ if (!outCtx) {
8536
+ throw new Error("Failed to acquire 2D context for output canvas");
8491
8537
  }
8492
- const {
8493
- style: passedStyle,
8494
- from = 0,
8495
- durationInFrames = Infinity,
8496
- premountFor = 0,
8497
- postmountFor = 0,
8498
- styleWhilePremounted,
8499
- styleWhilePostmounted,
8500
- ...otherProps
8501
- } = props;
8502
- const endThreshold = Math.ceil(from + durationInFrames - 1);
8503
- const premountingActive = frame < from && frame >= from - premountFor;
8504
- const postmountingActive = frame > endThreshold && frame <= endThreshold + postmountFor;
8505
- const freezeFrame = premountingActive ? from : postmountingActive ? from + durationInFrames - 1 : 0;
8506
- const isFreezingActive = premountingActive || postmountingActive;
8507
- const style = useMemo16(() => {
8508
- return {
8509
- ...passedStyle,
8510
- opacity: premountingActive || postmountingActive ? 0 : 1,
8511
- pointerEvents: premountingActive || postmountingActive ? "none" : passedStyle?.pointerEvents ?? undefined,
8512
- ...premountingActive ? styleWhilePremounted : {},
8513
- ...postmountingActive ? styleWhilePostmounted : {}
8514
- };
8515
- }, [
8516
- passedStyle,
8517
- premountingActive,
8518
- postmountingActive,
8519
- styleWhilePremounted,
8520
- styleWhilePostmounted
8521
- ]);
8522
- return /* @__PURE__ */ jsx12(Freeze, {
8523
- frame: freezeFrame,
8524
- active: isFreezingActive,
8525
- children: /* @__PURE__ */ jsx12(SequenceInner, {
8526
- ref,
8527
- from,
8528
- durationInFrames,
8529
- style,
8530
- _remotionInternalPremountDisplay: premountFor,
8531
- _remotionInternalPostmountDisplay: postmountFor,
8532
- _remotionInternalIsPremounting: premountingActive,
8533
- _remotionInternalIsPostmounting: postmountingActive,
8534
- ...otherProps
8535
- })
8536
- });
8538
+ outCtx.clearRect(0, 0, width, height);
8539
+ outCtx.drawImage(lastTarget, 0, 0, width, height);
8540
+ return true;
8537
8541
  };
8538
- var PremountedPostmountedSequence = forwardRef3(PremountedPostmountedSequenceRefForwardingFunction);
8539
- var SequenceRefForwardingFunction = (props, ref) => {
8540
- const env = useRemotionEnvironment();
8541
- const { fps } = useVideoConfig();
8542
- if (props.layout !== "none" && !env.isRendering) {
8543
- const effectivePremountFor = ENABLE_V5_BREAKING_CHANGES ? props.premountFor ?? fps : props.premountFor;
8544
- if (effectivePremountFor || props.postmountFor) {
8545
- return /* @__PURE__ */ jsx12(PremountedPostmountedSequence, {
8546
- ref,
8547
- ...props,
8548
- premountFor: effectivePremountFor
8549
- });
8542
+ var useEffectChainState = () => {
8543
+ const chainStateRef = useRef7(null);
8544
+ const sizeRef = useRef7(null);
8545
+ useEffect4(() => {
8546
+ return () => {
8547
+ if (chainStateRef.current) {
8548
+ cleanupEffectChainState(chainStateRef.current);
8549
+ }
8550
+ };
8551
+ }, []);
8552
+ return useMemo15(() => ({
8553
+ get: (width, height) => {
8554
+ if (!sizeRef.current || sizeRef.current.width !== width || sizeRef.current.height !== height) {
8555
+ if (chainStateRef.current) {
8556
+ cleanupEffectChainState(chainStateRef.current);
8557
+ }
8558
+ chainStateRef.current = createEffectChainState(width, height);
8559
+ sizeRef.current = { width, height };
8560
+ }
8561
+ return chainStateRef.current;
8550
8562
  }
8551
- }
8552
- return /* @__PURE__ */ jsx12(RegularSequence, {
8553
- ...props,
8554
- ref
8555
- });
8563
+ }), []);
8556
8564
  };
8557
- var SequenceInner = forwardRef3(SequenceRefForwardingFunction);
8558
- var Sequence = wrapInSchema(SequenceInner, sequenceSchema);
8559
8565
  var calcArgs = (fit, frameSize, canvasSize) => {
8560
8566
  switch (fit) {
8561
8567
  case "fill": {
@@ -8604,29 +8610,49 @@ var calcArgs = (fit, frameSize, canvasSize) => {
8604
8610
  throw new Error("Unknown fit: " + fit);
8605
8611
  }
8606
8612
  };
8607
- var CanvasRefForwardingFunction = ({ width, height, fit, className, style }, ref) => {
8608
- const canvasRef = useRef7(null);
8609
- const draw = useCallback6((imageData) => {
8613
+ var CanvasRefForwardingFunction = ({ width, height, fit, className, style, effects }, ref) => {
8614
+ const canvasRef = useRef8(null);
8615
+ const chainState = useEffectChainState();
8616
+ const sourceCanvas = useMemo16(() => {
8617
+ if (typeof document === "undefined") {
8618
+ return null;
8619
+ }
8620
+ return document.createElement("canvas");
8621
+ }, []);
8622
+ const draw = useCallback6(async (imageData) => {
8610
8623
  const canvas = canvasRef.current;
8611
8624
  const canvasWidth = width ?? imageData.displayWidth;
8612
8625
  const canvasHeight = height ?? imageData.displayHeight;
8613
8626
  if (!canvas) {
8614
8627
  throw new Error("Canvas ref is not set");
8615
8628
  }
8616
- const ctx = canvasRef.current?.getContext("2d");
8617
- if (!ctx) {
8618
- throw new Error("Could not get 2d context");
8629
+ if (!sourceCanvas) {
8630
+ throw new Error("Source canvas is not available");
8619
8631
  }
8620
- canvas.width = canvasWidth;
8621
- canvas.height = canvasHeight;
8622
- ctx.drawImage(imageData, ...calcArgs(fit, {
8632
+ sourceCanvas.width = canvasWidth;
8633
+ sourceCanvas.height = canvasHeight;
8634
+ const sourceCtx = sourceCanvas.getContext("2d");
8635
+ if (!sourceCtx) {
8636
+ throw new Error("Could not get 2d context for source canvas");
8637
+ }
8638
+ sourceCtx.drawImage(imageData, ...calcArgs(fit, {
8623
8639
  height: imageData.displayHeight,
8624
8640
  width: imageData.displayWidth
8625
8641
  }, {
8626
8642
  width: canvasWidth,
8627
8643
  height: canvasHeight
8628
8644
  }));
8629
- }, [fit, height, width]);
8645
+ canvas.width = canvasWidth;
8646
+ canvas.height = canvasHeight;
8647
+ return runEffectChain({
8648
+ state: chainState.get(canvasWidth, canvasHeight),
8649
+ source: sourceCanvas,
8650
+ effects,
8651
+ output: canvas,
8652
+ width: canvasWidth,
8653
+ height: canvasHeight
8654
+ });
8655
+ }, [chainState, effects, fit, height, sourceCanvas, width]);
8630
8656
  useImperativeHandle(ref, () => {
8631
8657
  return {
8632
8658
  draw,
@@ -8645,13 +8671,13 @@ var CanvasRefForwardingFunction = ({ width, height, fit, className, style }, ref
8645
8671
  }
8646
8672
  };
8647
8673
  }, [draw]);
8648
- return /* @__PURE__ */ jsx13("canvas", {
8674
+ return /* @__PURE__ */ jsx12("canvas", {
8649
8675
  ref: canvasRef,
8650
8676
  className,
8651
8677
  style
8652
8678
  });
8653
8679
  };
8654
- var Canvas = React15.forwardRef(CanvasRefForwardingFunction);
8680
+ var Canvas = React14.forwardRef(CanvasRefForwardingFunction);
8655
8681
  var CACHE_SIZE = 5;
8656
8682
  var getActualTime = ({
8657
8683
  loopBehavior,
@@ -8798,7 +8824,19 @@ var resolveAnimatedImageSource = (src) => {
8798
8824
  }
8799
8825
  return new URL(src, window.origin).href;
8800
8826
  };
8801
- var AnimatedImage = forwardRef4(({
8827
+ var animatedImageSchema = {
8828
+ playbackRate: {
8829
+ type: "number",
8830
+ min: 0,
8831
+ max: 10,
8832
+ step: 0.1,
8833
+ default: 1,
8834
+ description: "Playback Rate"
8835
+ },
8836
+ ...sequenceVisualStyleSchema,
8837
+ hidden: hiddenField
8838
+ };
8839
+ var AnimatedImageContent = forwardRef4(({
8802
8840
  src,
8803
8841
  width,
8804
8842
  height,
@@ -8806,105 +8844,326 @@ var AnimatedImage = forwardRef4(({
8806
8844
  loopBehavior = "loop",
8807
8845
  playbackRate = 1,
8808
8846
  fit = "fill",
8847
+ effects,
8848
+ controls,
8809
8849
  ...props
8810
8850
  }, canvasRef) => {
8811
- const mountState = useRef8({ isMounted: true });
8812
- useEffect6(() => {
8813
- const { current } = mountState;
8814
- current.isMounted = true;
8815
- return () => {
8816
- current.isMounted = false;
8817
- };
8818
- }, []);
8819
8851
  const resolvedSrc = resolveAnimatedImageSource(src);
8820
- const [imageDecoder, setImageDecoder] = useState7(null);
8852
+ const [imageDecoder, setImageDecoder] = useState6(null);
8821
8853
  const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
8822
- const [decodeHandle] = useState7(() => delayRender2(`Rendering <AnimatedImage/> with src="${resolvedSrc}"`));
8854
+ const [decodeHandle] = useState6(() => delayRender2(`Rendering <AnimatedImage/> with src="${resolvedSrc}"`));
8823
8855
  const frame = useCurrentFrame();
8824
8856
  const { fps } = useVideoConfig();
8825
8857
  const currentTime = frame / playbackRate / fps;
8826
- const currentTimeRef = useRef8(currentTime);
8858
+ const currentTimeRef = useRef9(currentTime);
8827
8859
  currentTimeRef.current = currentTime;
8828
- const ref = useRef8(null);
8860
+ const ref = useRef9(null);
8861
+ const memoizedEffects = useMemoizedEffects({
8862
+ effects,
8863
+ overrideId: controls?.overrideId ?? null
8864
+ });
8829
8865
  useImperativeHandle2(canvasRef, () => {
8830
8866
  const c = ref.current?.getCanvas();
8831
8867
  if (!c) {
8832
8868
  throw new Error("Canvas ref is not set");
8833
8869
  }
8834
- return c;
8870
+ return c;
8871
+ }, []);
8872
+ const [initialLoopBehavior] = useState6(() => loopBehavior);
8873
+ useEffect5(() => {
8874
+ const controller = new AbortController;
8875
+ decodeImage({
8876
+ resolvedSrc,
8877
+ signal: controller.signal,
8878
+ currentTime: currentTimeRef.current,
8879
+ initialLoopBehavior
8880
+ }).then((d) => {
8881
+ setImageDecoder(d);
8882
+ continueRender2(decodeHandle);
8883
+ }).catch((err) => {
8884
+ if (err.name === "AbortError") {
8885
+ continueRender2(decodeHandle);
8886
+ return;
8887
+ }
8888
+ if (onError) {
8889
+ onError?.(err);
8890
+ continueRender2(decodeHandle);
8891
+ } else {
8892
+ cancelRender(err);
8893
+ }
8894
+ });
8895
+ return () => {
8896
+ controller.abort();
8897
+ };
8898
+ }, [
8899
+ resolvedSrc,
8900
+ decodeHandle,
8901
+ onError,
8902
+ initialLoopBehavior,
8903
+ continueRender2
8904
+ ]);
8905
+ useLayoutEffect2(() => {
8906
+ if (!imageDecoder) {
8907
+ return;
8908
+ }
8909
+ const delay = delayRender2(`Rendering frame at ${currentTime} of <AnimatedImage src="${src}"/>`);
8910
+ let cancelled = false;
8911
+ imageDecoder.getFrame(currentTime, loopBehavior).then(async (videoFrame) => {
8912
+ if (cancelled) {
8913
+ return;
8914
+ }
8915
+ if (videoFrame === null) {
8916
+ ref.current?.clear();
8917
+ continueRender2(delay);
8918
+ return;
8919
+ }
8920
+ const completed = await ref.current?.draw(videoFrame.frame);
8921
+ if (completed && !cancelled) {
8922
+ continueRender2(delay);
8923
+ }
8924
+ }).catch((err) => {
8925
+ if (cancelled) {
8926
+ return;
8927
+ }
8928
+ if (onError) {
8929
+ onError(err);
8930
+ continueRender2(delay);
8931
+ } else {
8932
+ cancelRender(err);
8933
+ }
8934
+ });
8935
+ return () => {
8936
+ cancelled = true;
8937
+ continueRender2(delay);
8938
+ };
8939
+ }, [
8940
+ currentTime,
8941
+ imageDecoder,
8942
+ loopBehavior,
8943
+ onError,
8944
+ src,
8945
+ continueRender2,
8946
+ delayRender2,
8947
+ memoizedEffects,
8948
+ fit,
8949
+ width,
8950
+ height
8951
+ ]);
8952
+ return /* @__PURE__ */ jsx13(Canvas, {
8953
+ ref,
8954
+ width,
8955
+ height,
8956
+ fit,
8957
+ effects: memoizedEffects,
8958
+ ...props
8959
+ });
8960
+ });
8961
+ AnimatedImageContent.displayName = "AnimatedImageContent";
8962
+ var AnimatedImageInner = ({
8963
+ src,
8964
+ width,
8965
+ height,
8966
+ onError,
8967
+ fit,
8968
+ playbackRate,
8969
+ loopBehavior,
8970
+ id,
8971
+ className,
8972
+ style,
8973
+ durationInFrames,
8974
+ _experimentalEffects: effects = [],
8975
+ _experimentalControls: controls,
8976
+ ref,
8977
+ ...sequenceProps
8978
+ }) => {
8979
+ const { durationInFrames: videoDuration } = useVideoConfig();
8980
+ const resolvedDuration = durationInFrames ?? videoDuration;
8981
+ const memoizedEffectDefinitions = useMemoizedEffectDefinitions(effects);
8982
+ const animatedImageProps = {
8983
+ src,
8984
+ width,
8985
+ height,
8986
+ onError,
8987
+ fit,
8988
+ playbackRate,
8989
+ loopBehavior,
8990
+ id,
8991
+ className,
8992
+ style
8993
+ };
8994
+ return /* @__PURE__ */ jsx13(Sequence, {
8995
+ layout: "none",
8996
+ durationInFrames: resolvedDuration,
8997
+ name: "<AnimatedImage>",
8998
+ _experimentalControls: controls,
8999
+ _experimentalEffects: memoizedEffectDefinitions,
9000
+ ...sequenceProps,
9001
+ children: /* @__PURE__ */ jsx13(AnimatedImageContent, {
9002
+ ...animatedImageProps,
9003
+ ref,
9004
+ effects,
9005
+ controls
9006
+ })
9007
+ });
9008
+ };
9009
+ var AnimatedImage = wrapInSchema(AnimatedImageInner, animatedImageSchema);
9010
+ AnimatedImage.displayName = "AnimatedImage";
9011
+ addSequenceStackTraces(AnimatedImage);
9012
+ var solidSchema = {
9013
+ color: {
9014
+ type: "color",
9015
+ default: "transparent",
9016
+ description: "Color"
9017
+ },
9018
+ width: {
9019
+ type: "number",
9020
+ min: 1,
9021
+ step: 1,
9022
+ default: 1920,
9023
+ description: "Width"
9024
+ },
9025
+ height: {
9026
+ type: "number",
9027
+ min: 1,
9028
+ step: 1,
9029
+ default: 1080,
9030
+ description: "Height"
9031
+ },
9032
+ ...sequenceVisualStyleSchema
9033
+ };
9034
+ var SolidInner = ({
9035
+ color,
9036
+ width,
9037
+ height,
9038
+ _experimentalEffects: experimentalEffects = [],
9039
+ className,
9040
+ style,
9041
+ overrideId,
9042
+ ref
9043
+ }) => {
9044
+ const { delayRender: delayRender2, continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
9045
+ const [outputCanvas, setOutputCanvas] = useState7(null);
9046
+ const memoizedEffects = useMemoizedEffects({
9047
+ effects: experimentalEffects,
9048
+ overrideId: overrideId ?? null
9049
+ });
9050
+ const sourceCanvas = useMemo17(() => {
9051
+ if (typeof document === "undefined") {
9052
+ return null;
9053
+ }
9054
+ const canvas = document.createElement("canvas");
9055
+ canvas.width = 1;
9056
+ canvas.height = 1;
9057
+ return canvas;
8835
9058
  }, []);
8836
- const [initialLoopBehavior] = useState7(() => loopBehavior);
9059
+ const chainState = useEffectChainState();
9060
+ const canvasRef = useCallback7((canvas) => {
9061
+ setOutputCanvas(canvas);
9062
+ if (typeof ref === "function") {
9063
+ ref(canvas);
9064
+ } else if (ref) {
9065
+ ref.current = canvas;
9066
+ }
9067
+ }, [ref]);
8837
9068
  useEffect6(() => {
8838
- const controller = new AbortController;
8839
- decodeImage({
8840
- resolvedSrc,
8841
- signal: controller.signal,
8842
- currentTime: currentTimeRef.current,
8843
- initialLoopBehavior
8844
- }).then((d) => {
8845
- setImageDecoder(d);
8846
- continueRender2(decodeHandle);
8847
- }).catch((err) => {
8848
- if (err.name === "AbortError") {
8849
- continueRender2(decodeHandle);
8850
- return;
8851
- }
8852
- if (onError) {
8853
- onError?.(err);
8854
- continueRender2(decodeHandle);
8855
- } else {
8856
- cancelRender(err);
8857
- }
8858
- });
8859
- return () => {
8860
- controller.abort();
8861
- };
8862
- }, [
8863
- resolvedSrc,
8864
- decodeHandle,
8865
- onError,
8866
- initialLoopBehavior,
8867
- continueRender2
8868
- ]);
8869
- useLayoutEffect2(() => {
8870
- if (!imageDecoder) {
9069
+ if (!outputCanvas || !sourceCanvas) {
8871
9070
  return;
8872
9071
  }
8873
- const delay = delayRender2(`Rendering frame at ${currentTime} of <AnimatedImage src="${src}"/>`);
8874
- imageDecoder.getFrame(currentTime, loopBehavior).then((videoFrame) => {
8875
- if (mountState.current.isMounted) {
8876
- if (videoFrame === null) {
8877
- ref.current?.clear();
8878
- } else {
8879
- ref.current?.draw(videoFrame.frame);
8880
- }
9072
+ const handle = delayRender2("Solid effect chain");
9073
+ if (!chainState) {
9074
+ continueRender2(handle);
9075
+ return () => {
9076
+ continueRender2(handle);
9077
+ };
9078
+ }
9079
+ const ctx = sourceCanvas.getContext("2d", { colorSpace: "srgb" });
9080
+ if (!ctx) {
9081
+ cancelRender2(new Error("Failed to acquire 2D context for <Solid> source"));
9082
+ return;
9083
+ }
9084
+ ctx.clearRect(0, 0, 1, 1);
9085
+ if (color !== undefined) {
9086
+ ctx.fillStyle = color;
9087
+ ctx.fillRect(0, 0, 1, 1);
9088
+ }
9089
+ runEffectChain({
9090
+ state: chainState.get(width, height),
9091
+ source: sourceCanvas,
9092
+ effects: memoizedEffects,
9093
+ output: outputCanvas,
9094
+ width,
9095
+ height
9096
+ }).then((completed) => {
9097
+ if (completed) {
9098
+ continueRender2(handle);
8881
9099
  }
8882
- continueRender2(delay);
8883
9100
  }).catch((err) => {
8884
- if (onError) {
8885
- onError(err);
8886
- continueRender2(delay);
8887
- } else {
8888
- cancelRender(err);
8889
- }
9101
+ cancelRender2(err);
8890
9102
  });
9103
+ return () => {
9104
+ continueRender2(handle);
9105
+ };
8891
9106
  }, [
8892
- currentTime,
8893
- imageDecoder,
8894
- loopBehavior,
8895
- onError,
8896
- src,
9107
+ color,
9108
+ outputCanvas,
9109
+ sourceCanvas,
9110
+ chainState,
9111
+ width,
9112
+ height,
9113
+ delayRender2,
8897
9114
  continueRender2,
8898
- delayRender2
9115
+ cancelRender2,
9116
+ memoizedEffects
8899
9117
  ]);
8900
- return /* @__PURE__ */ jsx14(Canvas, {
8901
- ref,
9118
+ return /* @__PURE__ */ jsx14("canvas", {
9119
+ ref: canvasRef,
8902
9120
  width,
8903
9121
  height,
8904
- fit,
8905
- ...props
9122
+ className,
9123
+ style
9124
+ });
9125
+ };
9126
+ var SolidOuter = forwardRef5(({
9127
+ _experimentalEffects = [],
9128
+ _experimentalControls: controls,
9129
+ color,
9130
+ height,
9131
+ width,
9132
+ className,
9133
+ durationInFrames,
9134
+ style,
9135
+ name,
9136
+ from,
9137
+ hidden,
9138
+ showInTimeline,
9139
+ ...props
9140
+ }, ref) => {
9141
+ const memoizedEffectDefinitions = useMemoizedEffectDefinitions(_experimentalEffects);
9142
+ return /* @__PURE__ */ jsx14(Sequence, {
9143
+ layout: "none",
9144
+ from,
9145
+ hidden,
9146
+ showInTimeline,
9147
+ _experimentalControls: controls,
9148
+ _experimentalEffects: memoizedEffectDefinitions,
9149
+ durationInFrames,
9150
+ name: name ?? "<Solid>",
9151
+ ...props,
9152
+ children: /* @__PURE__ */ jsx14(SolidInner, {
9153
+ ref,
9154
+ overrideId: controls?.overrideId ?? null,
9155
+ color,
9156
+ height,
9157
+ width,
9158
+ className,
9159
+ style,
9160
+ _experimentalEffects
9161
+ })
8906
9162
  });
8907
9163
  });
9164
+ var Solid = wrapInSchema(SolidOuter, solidSchema);
9165
+ Solid.displayName = "Solid";
9166
+ addSequenceStackTraces(Solid);
8908
9167
  var cachedSupport = null;
8909
9168
  var isHtmlInCanvasSupported = () => {
8910
9169
  if (cachedSupport !== null) {
@@ -8915,7 +9174,7 @@ var isHtmlInCanvasSupported = () => {
8915
9174
  }
8916
9175
  const canvas = document.createElement("canvas");
8917
9176
  const ctx = canvas.getContext("2d");
8918
- cachedSupport = typeof ctx?.drawElementImage === "function" && typeof canvas.requestPaint === "function" && typeof canvas.captureElementImage === "function";
9177
+ cachedSupport = typeof ctx?.drawElementImage === "function" && typeof canvas.requestPaint === "function" && typeof canvas.captureElementImage === "function" && "transferControlToOffscreen" in HTMLCanvasElement.prototype;
8919
9178
  return cachedSupport;
8920
9179
  };
8921
9180
  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).";
@@ -8944,30 +9203,18 @@ var defaultOnPaint = ({
8944
9203
  element.style.transform = transform.toString();
8945
9204
  };
8946
9205
  var HtmlInCanvasAncestorContext = createContext16(false);
8947
- var HtmlInCanvasInner = forwardRef5(({
8948
- width,
8949
- height,
8950
- _experimentalEffects: effects = [],
8951
- children,
8952
- onPaint,
8953
- onInit,
8954
- _experimentalControls: controls,
8955
- style,
8956
- durationInFrames,
8957
- ...sequenceProps
8958
- }, ref) => {
9206
+ var HtmlInCanvasContent = forwardRef6(({ width, height, effects, children, onPaint, onInit, controls, style }, ref) => {
8959
9207
  const isInsideAncestorHtmlInCanvas = useContext18(HtmlInCanvasAncestorContext);
8960
9208
  assertHtmlInCanvasDimensions(width, height);
8961
9209
  const { continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
8962
9210
  if (!isHtmlInCanvasSupported()) {
8963
9211
  cancelRender2(new Error(HTML_IN_CANVAS_UNSUPPORTED_MESSAGE));
8964
9212
  }
8965
- const { durationInFrames: videoDuration } = useVideoConfig();
8966
- const resolvedDuration = durationInFrames ?? videoDuration;
8967
- const frame = useCurrentFrame();
8968
- const canvas2dRef = useRef9(null);
8969
- const divRef = useRef9(null);
8970
- const setLayoutCanvasRef = useCallback7((node) => {
9213
+ const canvas2dRef = useRef10(null);
9214
+ const offscreenRef = useRef10(null);
9215
+ const divRef = useRef10(null);
9216
+ const canvasSizeKey = `${width}x${height}`;
9217
+ const setLayoutCanvasRef = useCallback8((node) => {
8971
9218
  canvas2dRef.current = node;
8972
9219
  if (typeof ref === "function") {
8973
9220
  ref(node);
@@ -8975,48 +9222,48 @@ var HtmlInCanvasInner = forwardRef5(({
8975
9222
  ref.current = node;
8976
9223
  }
8977
9224
  }, [ref]);
8978
- const [offscreenCanvas] = useState8(() => new OffscreenCanvas(1, 1));
8979
9225
  const chainState = useEffectChainState();
8980
9226
  const memoizedEffects = useMemoizedEffects({
8981
9227
  effects,
8982
9228
  overrideId: controls?.overrideId ?? null
8983
9229
  });
8984
- const memoizedEffectDefinitions = useMemoizedEffectDefinitions(effects);
8985
- const effectsRef = useRef9(memoizedEffects);
9230
+ const effectsRef = useRef10(memoizedEffects);
8986
9231
  effectsRef.current = memoizedEffects;
8987
- const frameRef = useRef9(frame);
8988
- frameRef.current = frame;
8989
- const onPaintRef = useRef9(onPaint);
9232
+ const onPaintRef = useRef10(onPaint);
8990
9233
  onPaintRef.current = onPaint;
8991
- const onInitRef = useRef9(onInit);
9234
+ const onInitRef = useRef10(onInit);
8992
9235
  onInitRef.current = onInit;
8993
- const initializedRef = useRef9(false);
8994
- const onInitCleanupRef = useRef9(null);
8995
- const unmountedRef = useRef9(false);
8996
- const onPaintCb = useCallback7(async () => {
9236
+ const initializedRef = useRef10(false);
9237
+ const onInitCleanupRef = useRef10(null);
9238
+ const unmountedRef = useRef10(false);
9239
+ const onPaintCb = useCallback8(async () => {
8997
9240
  const element = divRef.current;
8998
9241
  if (!element) {
8999
9242
  throw new Error("Canvas or scene element not found");
9000
9243
  }
9001
- offscreenCanvas.width = width;
9002
- offscreenCanvas.height = height;
9244
+ const offscreen = offscreenRef.current;
9245
+ if (!offscreen) {
9246
+ throw new Error("HtmlInCanvas: offscreen canvas not ready (transferControlToOffscreen failed or canvas is remounting)");
9247
+ }
9248
+ offscreen.width = width;
9249
+ offscreen.height = height;
9003
9250
  try {
9004
- const layoutCanvas = canvas2dRef.current;
9005
- if (!layoutCanvas) {
9251
+ const placeholderCanvas = canvas2dRef.current;
9252
+ if (!placeholderCanvas) {
9006
9253
  throw new Error("Canvas not found");
9007
9254
  }
9008
- const layout2d = layoutCanvas.getContext("2d");
9009
- if (!layout2d) {
9010
- throw new Error("Failed to acquire 2D context for <HtmlInCanvas> layout canvas");
9255
+ const offscreen2d = offscreen.getContext("2d");
9256
+ if (!offscreen2d) {
9257
+ throw new Error("Failed to acquire 2D context for <HtmlInCanvas> offscreen canvas");
9011
9258
  }
9012
9259
  const handle = delayRender("onPaint");
9013
9260
  if (!initializedRef.current) {
9014
9261
  initializedRef.current = true;
9015
- const initImage = layoutCanvas.captureElementImage(element);
9262
+ const initImage = placeholderCanvas.captureElementImage(element);
9016
9263
  const currentOnInit = onInitRef.current;
9017
9264
  if (currentOnInit) {
9018
9265
  const cleanup = await currentOnInit({
9019
- canvas: offscreenCanvas,
9266
+ canvas: offscreen,
9020
9267
  element,
9021
9268
  elementImage: initImage
9022
9269
  });
@@ -9031,18 +9278,17 @@ var HtmlInCanvasInner = forwardRef5(({
9031
9278
  }
9032
9279
  }
9033
9280
  const handler = onPaintRef.current ?? defaultOnPaint;
9034
- const elImage = layoutCanvas.captureElementImage(element);
9281
+ const elImage = placeholderCanvas.captureElementImage(element);
9035
9282
  await handler({
9036
- canvas: offscreenCanvas,
9283
+ canvas: offscreen,
9037
9284
  element,
9038
9285
  elementImage: elImage
9039
9286
  });
9040
9287
  await runEffectChain({
9041
9288
  state: chainState.get(width, height),
9042
- source: offscreenCanvas,
9289
+ source: offscreen,
9043
9290
  effects: effectsRef.current,
9044
- output: canvas2dRef.current,
9045
- frame: frameRef.current,
9291
+ output: offscreen,
9046
9292
  width,
9047
9293
  height
9048
9294
  });
@@ -9050,29 +9296,30 @@ var HtmlInCanvasInner = forwardRef5(({
9050
9296
  } catch (error2) {
9051
9297
  cancelRender2(error2);
9052
9298
  }
9053
- }, [
9054
- chainState,
9055
- continueRender2,
9056
- cancelRender2,
9057
- width,
9058
- height,
9059
- offscreenCanvas
9060
- ]);
9299
+ }, [chainState, continueRender2, cancelRender2, width, height]);
9061
9300
  useLayoutEffect3(() => {
9062
- const canvas = canvas2dRef.current;
9063
- if (!canvas) {
9301
+ const placeholder = canvas2dRef.current;
9302
+ if (!placeholder) {
9064
9303
  throw new Error("Canvas not found");
9065
9304
  }
9066
- canvas.layoutSubtree = true;
9067
- canvas.addEventListener("paint", onPaintCb);
9305
+ placeholder.layoutSubtree = true;
9306
+ const offscreen = placeholder.transferControlToOffscreen();
9307
+ offscreenRef.current = offscreen;
9308
+ offscreen.width = width;
9309
+ offscreen.height = height;
9310
+ initializedRef.current = false;
9311
+ unmountedRef.current = false;
9312
+ placeholder.addEventListener("paint", onPaintCb);
9068
9313
  return () => {
9069
- canvas.removeEventListener("paint", onPaintCb);
9314
+ placeholder.removeEventListener("paint", onPaintCb);
9315
+ offscreenRef.current = null;
9316
+ initializedRef.current = false;
9070
9317
  unmountedRef.current = true;
9071
9318
  onInitCleanupRef.current?.();
9072
9319
  onInitCleanupRef.current = null;
9073
9320
  };
9074
- }, [onPaintCb, cancelRender2]);
9075
- const onPaintChangedRef = useRef9(false);
9321
+ }, [onPaintCb, cancelRender2, width, height]);
9322
+ const onPaintChangedRef = useRef10(false);
9076
9323
  useLayoutEffect3(() => {
9077
9324
  if (!onPaintChangedRef.current) {
9078
9325
  onPaintChangedRef.current = true;
@@ -9096,8 +9343,8 @@ var HtmlInCanvasInner = forwardRef5(({
9096
9343
  return () => {
9097
9344
  continueRender2(handle);
9098
9345
  };
9099
- }, [width, height, continueRender2]);
9100
- const innerStyle = useMemo17(() => {
9346
+ }, [width, height, continueRender2, canvasSizeKey]);
9347
+ const innerStyle = useMemo18(() => {
9101
9348
  return {
9102
9349
  width,
9103
9350
  height
@@ -9106,31 +9353,64 @@ var HtmlInCanvasInner = forwardRef5(({
9106
9353
  if (isInsideAncestorHtmlInCanvas) {
9107
9354
  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.");
9108
9355
  }
9356
+ return /* @__PURE__ */ jsx15(HtmlInCanvasAncestorContext.Provider, {
9357
+ value: true,
9358
+ children: /* @__PURE__ */ jsx15("canvas", {
9359
+ ref: setLayoutCanvasRef,
9360
+ width,
9361
+ height,
9362
+ style,
9363
+ children: /* @__PURE__ */ jsx15("div", {
9364
+ ref: divRef,
9365
+ style: innerStyle,
9366
+ children
9367
+ })
9368
+ }, canvasSizeKey)
9369
+ });
9370
+ });
9371
+ HtmlInCanvasContent.displayName = "HtmlInCanvasContent";
9372
+ var HtmlInCanvasInner = forwardRef6(({
9373
+ width,
9374
+ height,
9375
+ _experimentalEffects: effects = [],
9376
+ children,
9377
+ onPaint,
9378
+ onInit,
9379
+ _experimentalControls: controls,
9380
+ style,
9381
+ durationInFrames,
9382
+ name,
9383
+ ...sequenceProps
9384
+ }, ref) => {
9385
+ const { durationInFrames: videoDuration } = useVideoConfig();
9386
+ const resolvedDuration = durationInFrames ?? videoDuration;
9387
+ const memoizedEffectDefinitions = useMemoizedEffectDefinitions(effects);
9109
9388
  return /* @__PURE__ */ jsx15(Sequence, {
9110
9389
  durationInFrames: resolvedDuration,
9111
- name: "<HtmlInCanvas>",
9390
+ name: name ?? "<HtmlInCanvas>",
9112
9391
  _experimentalControls: controls,
9113
9392
  _experimentalEffects: memoizedEffectDefinitions,
9114
9393
  layout: "none",
9115
9394
  ...sequenceProps,
9116
- children: /* @__PURE__ */ jsx15(HtmlInCanvasAncestorContext.Provider, {
9117
- value: true,
9118
- children: /* @__PURE__ */ jsx15("canvas", {
9119
- ref: setLayoutCanvasRef,
9120
- width,
9121
- height,
9122
- style,
9123
- children: /* @__PURE__ */ jsx15("div", {
9124
- ref: divRef,
9125
- style: innerStyle,
9126
- children
9127
- })
9128
- })
9395
+ children: /* @__PURE__ */ jsx15(HtmlInCanvasContent, {
9396
+ ref,
9397
+ width,
9398
+ height,
9399
+ effects,
9400
+ onPaint,
9401
+ onInit,
9402
+ controls,
9403
+ style,
9404
+ children
9129
9405
  })
9130
9406
  });
9131
9407
  });
9132
9408
  HtmlInCanvasInner.displayName = "HtmlInCanvas";
9133
- var HtmlInCanvasWrapped = wrapInSchema(HtmlInCanvasInner, sequenceStyleSchema);
9409
+ var htmlInCanvasSchema = {
9410
+ ...sequenceVisualStyleSchema,
9411
+ hidden: hiddenField
9412
+ };
9413
+ var HtmlInCanvasWrapped = wrapInSchema(HtmlInCanvasInner, htmlInCanvasSchema);
9134
9414
  var HtmlInCanvas = Object.assign(HtmlInCanvasWrapped, {
9135
9415
  isSupported: isHtmlInCanvasSupported
9136
9416
  });
@@ -9175,9 +9455,9 @@ var RenderAssetManager = createContext17({
9175
9455
  renderAssets: []
9176
9456
  });
9177
9457
  var RenderAssetManagerProvider = ({ children, collectAssets }) => {
9178
- const [renderAssets, setRenderAssets] = useState9([]);
9179
- const renderAssetsRef = useRef10([]);
9180
- const registerRenderAsset = useCallback8((renderAsset) => {
9458
+ const [renderAssets, setRenderAssets] = useState8([]);
9459
+ const renderAssetsRef = useRef11([]);
9460
+ const registerRenderAsset = useCallback9((renderAsset) => {
9181
9461
  validateRenderAsset(renderAsset);
9182
9462
  renderAssetsRef.current = [...renderAssetsRef.current, renderAsset];
9183
9463
  setRenderAssets(renderAssetsRef.current);
@@ -9194,7 +9474,7 @@ var RenderAssetManagerProvider = ({ children, collectAssets }) => {
9194
9474
  };
9195
9475
  }, []);
9196
9476
  }
9197
- const unregisterRenderAsset = useCallback8((id) => {
9477
+ const unregisterRenderAsset = useCallback9((id) => {
9198
9478
  renderAssetsRef.current = renderAssetsRef.current.filter((a) => a.id !== id);
9199
9479
  setRenderAssets(renderAssetsRef.current);
9200
9480
  }, []);
@@ -9208,7 +9488,7 @@ var RenderAssetManagerProvider = ({ children, collectAssets }) => {
9208
9488
  };
9209
9489
  }
9210
9490
  }, []);
9211
- const contextValue = useMemo18(() => {
9491
+ const contextValue = useMemo19(() => {
9212
9492
  return {
9213
9493
  registerRenderAsset,
9214
9494
  unregisterRenderAsset,
@@ -9225,7 +9505,7 @@ var Artifact = ({ filename, content, downloadBehavior }) => {
9225
9505
  const { registerRenderAsset, unregisterRenderAsset } = useContext19(RenderAssetManager);
9226
9506
  const env = useRemotionEnvironment();
9227
9507
  const frame = useCurrentFrame();
9228
- const [id] = useState10(() => {
9508
+ const [id] = useState9(() => {
9229
9509
  return String(Math.random());
9230
9510
  });
9231
9511
  useLayoutEffect5(() => {
@@ -9337,14 +9617,14 @@ var Loop = ({
9337
9617
  const iteration = Math.floor(currentFrame / durationInFrames);
9338
9618
  const start = iteration * durationInFrames;
9339
9619
  const from = Math.min(start, maxFrame);
9340
- const loopDisplay = useMemo19(() => {
9620
+ const loopDisplay = useMemo20(() => {
9341
9621
  return {
9342
9622
  numberOfTimes: Math.min(compDuration / durationInFrames, times),
9343
9623
  startOffset: -from,
9344
9624
  durationInFrames
9345
9625
  };
9346
9626
  }, [compDuration, durationInFrames, from, times]);
9347
- const loopContext = useMemo19(() => {
9627
+ const loopContext = useMemo20(() => {
9348
9628
  return {
9349
9629
  iteration: Math.floor(currentFrame / durationInFrames),
9350
9630
  durationInFrames
@@ -9382,7 +9662,7 @@ var setPreloads = (updater) => {
9382
9662
  updaters.forEach((u) => u());
9383
9663
  };
9384
9664
  var PrefetchProvider = ({ children }) => {
9385
- const [_preloads, _setPreloads] = useState11(() => preloads);
9665
+ const [_preloads, _setPreloads] = useState10(() => preloads);
9386
9666
  useEffect7(() => {
9387
9667
  const updaterFunction = () => {
9388
9668
  _setPreloads(preloads);
@@ -9594,6 +9874,9 @@ var validateMediaProps = (props, component) => {
9594
9874
  if (typeof props.playbackRate === "number" && (isNaN(props.playbackRate) || !Number.isFinite(props.playbackRate) || props.playbackRate <= 0)) {
9595
9875
  throw new TypeError(`You have passed a playbackRate of ${props.playbackRate} to your <${component} /> component. Playback rate must be a real number above 0.`);
9596
9876
  }
9877
+ if (typeof props.preservePitch !== "boolean" && typeof props.preservePitch !== "undefined") {
9878
+ throw new TypeError(`'preservePitch' must be a boolean or undefined but got '${typeof props.preservePitch}' instead`);
9879
+ }
9597
9880
  };
9598
9881
  var validateStartFromProps = (startFrom, endAt) => {
9599
9882
  if (typeof startFrom !== "undefined") {
@@ -9703,7 +9986,7 @@ var DurationsContext = createContext20({
9703
9986
  });
9704
9987
  var DurationsContextProvider = ({ children }) => {
9705
9988
  const [durations, setDurations] = useReducer(durationReducer, {});
9706
- const value = useMemo20(() => {
9989
+ const value = useMemo21(() => {
9707
9990
  return {
9708
9991
  durations,
9709
9992
  setDurations
@@ -9837,7 +10120,7 @@ var useSingletonAudioContext = ({
9837
10120
  audioEnabled
9838
10121
  }) => {
9839
10122
  const env = useRemotionEnvironment();
9840
- const context = useMemo21(() => {
10123
+ const context = useMemo22(() => {
9841
10124
  if (env.isRendering) {
9842
10125
  return null;
9843
10126
  }
@@ -9918,11 +10201,11 @@ var SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled })
9918
10201
  latencyHint: audioLatencyHint,
9919
10202
  audioEnabled
9920
10203
  });
9921
- const audioContextIsPlayingEventually = useRef11(false);
9922
- const isResuming = useRef11(null);
9923
- const audioSyncAnchor = useMemo22(() => ({ value: 0 }), []);
9924
- const audioSyncAnchorListeners = useRef11([]);
9925
- const audioSyncAnchorEmitter = useMemo22(() => {
10204
+ const audioContextIsPlayingEventually = useRef12(false);
10205
+ const isResuming = useRef12(null);
10206
+ const audioSyncAnchor = useMemo23(() => ({ value: 0 }), []);
10207
+ const audioSyncAnchorListeners = useRef12([]);
10208
+ const audioSyncAnchorEmitter = useMemo23(() => {
9926
10209
  return {
9927
10210
  dispatch: (event) => {
9928
10211
  audioSyncAnchorListeners.current.forEach((l) => l(event));
@@ -9937,12 +10220,12 @@ var SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled })
9937
10220
  }
9938
10221
  };
9939
10222
  }, []);
9940
- const prevEndTimes = useRef11({ scheduledEndTime: null, mediaEndTime: null });
9941
- const nodesToResume = useRef11(new Map);
9942
- const unscheduleAudioNode = useCallback9((node) => {
10223
+ const prevEndTimes = useRef12({ scheduledEndTime: null, mediaEndTime: null });
10224
+ const nodesToResume = useRef12(new Map);
10225
+ const unscheduleAudioNode = useCallback10((node) => {
9943
10226
  nodesToResume.current.delete(node);
9944
10227
  }, []);
9945
- const scheduleAudioNode = useMemo22(() => {
10228
+ const scheduleAudioNode = useMemo23(() => {
9946
10229
  return ({
9947
10230
  node,
9948
10231
  mediaTimestamp,
@@ -9987,7 +10270,7 @@ var SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled })
9987
10270
  };
9988
10271
  };
9989
10272
  }, [ctxAndGain, logLevel]);
9990
- const resume = useCallback9(() => {
10273
+ const resume = useCallback10(() => {
9991
10274
  if (!ctxAndGain) {
9992
10275
  return Promise.resolve();
9993
10276
  }
@@ -10014,10 +10297,10 @@ var SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled })
10014
10297
  });
10015
10298
  return resumePromise.catch(() => {});
10016
10299
  }, [ctxAndGain, logLevel]);
10017
- const getIsResumingAudioContext = useCallback9(() => {
10300
+ const getIsResumingAudioContext = useCallback10(() => {
10018
10301
  return isResuming.current;
10019
10302
  }, []);
10020
- const suspend = useCallback9(() => {
10303
+ const suspend = useCallback10(() => {
10021
10304
  if (!ctxAndGain) {
10022
10305
  return;
10023
10306
  }
@@ -10027,7 +10310,7 @@ var SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled })
10027
10310
  audioContextIsPlayingEventually.current = false;
10028
10311
  ctxAndGain.audioContext.suspend();
10029
10312
  }, [ctxAndGain]);
10030
- const audioContextValue = useMemo22(() => {
10313
+ const audioContextValue = useMemo23(() => {
10031
10314
  return {
10032
10315
  audioContext: ctxAndGain?.audioContext ?? null,
10033
10316
  gainNode: ctxAndGain?.gainNode ?? null,
@@ -10055,8 +10338,8 @@ var SharedAudioContextProvider = ({ children, audioLatencyHint, audioEnabled })
10055
10338
  });
10056
10339
  };
10057
10340
  var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
10058
- const audios = useRef11([]);
10059
- const [initialNumberOfAudioTags] = useState12(numberOfAudioTags);
10341
+ const audios = useRef12([]);
10342
+ const [initialNumberOfAudioTags] = useState11(numberOfAudioTags);
10060
10343
  if (numberOfAudioTags !== initialNumberOfAudioTags) {
10061
10344
  throw new Error("The number of shared audio tags has changed dynamically. Once you have set this property, you cannot change it afterwards.");
10062
10345
  }
@@ -10066,7 +10349,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
10066
10349
  const audioCtx = useContext21(SharedAudioContext);
10067
10350
  const audioContext = audioCtx?.audioContext ?? null;
10068
10351
  const resume = audioCtx?.resume;
10069
- const refs = useMemo22(() => {
10352
+ const refs = useMemo23(() => {
10070
10353
  return new Array(numberOfAudioTags).fill(true).map(() => {
10071
10354
  const ref = createRef2();
10072
10355
  return {
@@ -10089,8 +10372,8 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
10089
10372
  });
10090
10373
  };
10091
10374
  }, [refs]);
10092
- const takenAudios = useRef11(new Array(numberOfAudioTags).fill(false));
10093
- const rerenderAudios = useCallback9(() => {
10375
+ const takenAudios = useRef12(new Array(numberOfAudioTags).fill(false));
10376
+ const rerenderAudios = useCallback10(() => {
10094
10377
  refs.forEach(({ ref, id }) => {
10095
10378
  const data = audios.current?.find((a) => a.id === id);
10096
10379
  const { current } = ref;
@@ -10111,7 +10394,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
10111
10394
  });
10112
10395
  });
10113
10396
  }, [refs]);
10114
- const registerAudio = useCallback9((options) => {
10397
+ const registerAudio = useCallback10((options) => {
10115
10398
  const { aud, audioId, premounting, postmounting } = options;
10116
10399
  const found = audios.current?.find((a) => a.audioId === audioId);
10117
10400
  if (found) {
@@ -10140,7 +10423,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
10140
10423
  rerenderAudios();
10141
10424
  return newElem;
10142
10425
  }, [numberOfAudioTags, refs, rerenderAudios]);
10143
- const unregisterAudio = useCallback9((id) => {
10426
+ const unregisterAudio = useCallback10((id) => {
10144
10427
  const cloned = [...takenAudios.current];
10145
10428
  const index = refs.findIndex((r2) => r2.id === id);
10146
10429
  if (index === -1) {
@@ -10151,7 +10434,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
10151
10434
  audios.current = audios.current?.filter((a) => a.id !== id);
10152
10435
  rerenderAudios();
10153
10436
  }, [refs, rerenderAudios]);
10154
- const updateAudio = useCallback9(({
10437
+ const updateAudio = useCallback10(({
10155
10438
  aud,
10156
10439
  audioId,
10157
10440
  id,
@@ -10185,7 +10468,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
10185
10468
  rerenderAudios();
10186
10469
  }
10187
10470
  }, [rerenderAudios]);
10188
- const playAllAudios = useCallback9(() => {
10471
+ const playAllAudios = useCallback10(() => {
10189
10472
  refs.forEach((ref) => {
10190
10473
  const audio = audios.current.find((a) => a.el === ref.ref);
10191
10474
  if (audio?.premounting) {
@@ -10203,7 +10486,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
10203
10486
  });
10204
10487
  resume?.();
10205
10488
  }, [logLevel, mountTime, refs, env.isPlayer, resume]);
10206
- const audioTagsValue = useMemo22(() => {
10489
+ const audioTagsValue = useMemo23(() => {
10207
10490
  return {
10208
10491
  registerAudio,
10209
10492
  unregisterAudio,
@@ -10240,7 +10523,7 @@ var useSharedAudio = ({
10240
10523
  }) => {
10241
10524
  const audioCtx = useContext21(SharedAudioContext);
10242
10525
  const tagsCtx = useContext21(SharedAudioTagsContext);
10243
- const [elem] = useState12(() => {
10526
+ const [elem] = useState11(() => {
10244
10527
  if (tagsCtx && tagsCtx.numberOfAudioTags > 0) {
10245
10528
  return tagsCtx.registerAudio({ aud, audioId, premounting, postmounting });
10246
10529
  }
@@ -10376,9 +10659,9 @@ var useAppendVideoFragment = ({
10376
10659
  duration: initialDuration,
10377
10660
  fps
10378
10661
  }) => {
10379
- const actualFromRef = useRef12(initialActualFrom);
10380
- const actualDuration = useRef12(initialDuration);
10381
- const actualSrc = useRef12(initialActualSrc);
10662
+ const actualFromRef = useRef13(initialActualFrom);
10663
+ const actualDuration = useRef13(initialDuration);
10664
+ const actualSrc = useRef13(initialActualSrc);
10382
10665
  if (!isSubsetOfDuration({
10383
10666
  prevStartFrom: actualFromRef.current,
10384
10667
  newStartFrom: initialActualFrom,
@@ -10415,8 +10698,8 @@ var useVolume = ({
10415
10698
  source,
10416
10699
  shouldUseWebAudioApi
10417
10700
  }) => {
10418
- const audioStuffRef = useRef13(null);
10419
- const currentVolumeRef = useRef13(volume);
10701
+ const audioStuffRef = useRef14(null);
10702
+ const currentVolumeRef = useRef14(volume);
10420
10703
  currentVolumeRef.current = volume;
10421
10704
  const sharedAudioContext = useContext22(SharedAudioContext);
10422
10705
  if (!sharedAudioContext) {
@@ -10573,7 +10856,7 @@ var useBasicMediaInTimeline = ({
10573
10856
  throw new Error("No src passed");
10574
10857
  }
10575
10858
  const parentSequence = useContext24(SequenceContext);
10576
- const [initialVolume] = useState13(() => volume);
10859
+ const [initialVolume] = useState12(() => volume);
10577
10860
  const duration = getTimelineDuration({
10578
10861
  compositionDurationInFrames: sequenceDurationInFrames,
10579
10862
  playbackRate,
@@ -10582,7 +10865,7 @@ var useBasicMediaInTimeline = ({
10582
10865
  parentSequenceDurationInFrames: parentSequence?.durationInFrames ?? null,
10583
10866
  loop
10584
10867
  });
10585
- const volumes = useMemo23(() => {
10868
+ const volumes = useMemo24(() => {
10586
10869
  if (typeof volume === "number") {
10587
10870
  return volume;
10588
10871
  }
@@ -10603,7 +10886,7 @@ var useBasicMediaInTimeline = ({
10603
10886
  const nonce = useNonce();
10604
10887
  const { rootId } = useTimelineContext();
10605
10888
  const startMediaFrom = 0 - mediaStartsAt + (trimBefore ?? 0);
10606
- const memoizedResult = useMemo23(() => {
10889
+ const memoizedResult = useMemo24(() => {
10607
10890
  return {
10608
10891
  volumes,
10609
10892
  duration,
@@ -10632,7 +10915,7 @@ var useImageInTimeline = ({
10632
10915
  src,
10633
10916
  displayName,
10634
10917
  id,
10635
- stack,
10918
+ getStack,
10636
10919
  showInTimeline,
10637
10920
  premountDisplay,
10638
10921
  postmountDisplay,
@@ -10679,7 +10962,7 @@ var useImageInTimeline = ({
10679
10962
  showInTimeline: true,
10680
10963
  nonce: nonce.get(),
10681
10964
  loopDisplay,
10682
- stack,
10965
+ getStack,
10683
10966
  premountDisplay,
10684
10967
  postmountDisplay,
10685
10968
  controls,
@@ -10696,7 +10979,7 @@ var useImageInTimeline = ({
10696
10979
  registerSequence,
10697
10980
  unregisterSequence,
10698
10981
  nonce,
10699
- stack,
10982
+ getStack,
10700
10983
  showInTimeline,
10701
10984
  premountDisplay,
10702
10985
  postmountDisplay,
@@ -10715,7 +10998,7 @@ var useMediaInTimeline = ({
10715
10998
  playbackRate,
10716
10999
  displayName,
10717
11000
  id,
10718
- stack,
11001
+ getStack,
10719
11002
  showInTimeline,
10720
11003
  premountDisplay,
10721
11004
  postmountDisplay,
@@ -10766,7 +11049,7 @@ var useMediaInTimeline = ({
10766
11049
  doesVolumeChange,
10767
11050
  loopDisplay,
10768
11051
  playbackRate,
10769
- stack,
11052
+ getStack,
10770
11053
  premountDisplay,
10771
11054
  postmountDisplay,
10772
11055
  controls: null,
@@ -10788,7 +11071,7 @@ var useMediaInTimeline = ({
10788
11071
  mediaType,
10789
11072
  startsAt,
10790
11073
  playbackRate,
10791
- stack,
11074
+ getStack,
10792
11075
  showInTimeline,
10793
11076
  premountDisplay,
10794
11077
  postmountDisplay,
@@ -10799,13 +11082,13 @@ var useMediaInTimeline = ({
10799
11082
  ]);
10800
11083
  };
10801
11084
  var useBufferManager = (logLevel, mountTime) => {
10802
- const [blocks, setBlocks] = useState14([]);
10803
- const [onBufferingCallbacks, setOnBufferingCallbacks] = useState14([]);
10804
- const [onResumeCallbacks, setOnResumeCallbacks] = useState14([]);
11085
+ const [blocks, setBlocks] = useState13([]);
11086
+ const [onBufferingCallbacks, setOnBufferingCallbacks] = useState13([]);
11087
+ const [onResumeCallbacks, setOnResumeCallbacks] = useState13([]);
10805
11088
  const env = useRemotionEnvironment();
10806
11089
  const rendering = env.isRendering;
10807
- const buffering = useRef14(false);
10808
- const addBlock = useCallback10((block) => {
11090
+ const buffering = useRef15(false);
11091
+ const addBlock = useCallback11((block) => {
10809
11092
  if (rendering) {
10810
11093
  return {
10811
11094
  unblock: () => {
@@ -10831,7 +11114,7 @@ var useBufferManager = (logLevel, mountTime) => {
10831
11114
  }
10832
11115
  };
10833
11116
  }, [rendering]);
10834
- const listenForBuffering = useCallback10((callback) => {
11117
+ const listenForBuffering = useCallback11((callback) => {
10835
11118
  setOnBufferingCallbacks((c) => [...c, callback]);
10836
11119
  return {
10837
11120
  remove: () => {
@@ -10839,7 +11122,7 @@ var useBufferManager = (logLevel, mountTime) => {
10839
11122
  }
10840
11123
  };
10841
11124
  }, []);
10842
- const listenForResume = useCallback10((callback) => {
11125
+ const listenForResume = useCallback11((callback) => {
10843
11126
  setOnResumeCallbacks((c) => [...c, callback]);
10844
11127
  return {
10845
11128
  remove: () => {
@@ -10877,7 +11160,7 @@ var useBufferManager = (logLevel, mountTime) => {
10877
11160
  }
10878
11161
  }, [blocks]);
10879
11162
  }
10880
- return useMemo24(() => {
11163
+ return useMemo25(() => {
10881
11164
  return { addBlock, listenForBuffering, listenForResume, buffering };
10882
11165
  }, [addBlock, buffering, listenForBuffering, listenForResume]);
10883
11166
  };
@@ -10891,7 +11174,7 @@ var BufferingProvider = ({ children }) => {
10891
11174
  });
10892
11175
  };
10893
11176
  var useIsPlayerBuffering = (bufferManager) => {
10894
- const [isBuffering, setIsBuffering] = useState14(bufferManager.buffering.current);
11177
+ const [isBuffering, setIsBuffering] = useState13(bufferManager.buffering.current);
10895
11178
  useEffect9(() => {
10896
11179
  const onBuffer = () => {
10897
11180
  setIsBuffering(true);
@@ -10916,7 +11199,7 @@ var useBufferState = () => {
10916
11199
  const buffer = useContext26(BufferingContextReact);
10917
11200
  const logLevel = useLogLevel();
10918
11201
  const addBlock = buffer ? buffer.addBlock : null;
10919
- return useMemo25(() => ({
11202
+ return useMemo26(() => ({
10920
11203
  delayPlayback: () => {
10921
11204
  if (!addBlock) {
10922
11205
  throw new Error("Tried to enable the buffering state, but a Remotion context was not found. This API can only be called in a component that was passed to the Remotion Player or a <Composition>. Or you might have experienced a version mismatch - run `npx remotion versions` and ensure all packages have the same version. This error is thrown by the buffer state https://remotion.dev/docs/player/buffer-state");
@@ -10951,9 +11234,9 @@ var useBufferUntilFirstFrame = ({
10951
11234
  logLevel,
10952
11235
  mountTime
10953
11236
  }) => {
10954
- const bufferingRef = useRef15(false);
11237
+ const bufferingRef = useRef16(false);
10955
11238
  const { delayPlayback } = useBufferState();
10956
- const bufferUntilFirstFrame = useCallback11((requestedTime) => {
11239
+ const bufferUntilFirstFrame = useCallback12((requestedTime) => {
10957
11240
  if (mediaType !== "video") {
10958
11241
  return;
10959
11242
  }
@@ -11024,7 +11307,7 @@ var useBufferUntilFirstFrame = ({
11024
11307
  onVariableFpsVideoDetected,
11025
11308
  pauseWhenBuffering
11026
11309
  ]);
11027
- return useMemo26(() => {
11310
+ return useMemo27(() => {
11028
11311
  return {
11029
11312
  isBuffering: () => bufferingRef.current,
11030
11313
  bufferUntilFirstFrame
@@ -11072,7 +11355,7 @@ var useMediaBuffering = ({
11072
11355
  src
11073
11356
  }) => {
11074
11357
  const buffer = useBufferState();
11075
- const [isBuffering, setIsBuffering] = useState15(false);
11358
+ const [isBuffering, setIsBuffering] = useState14(false);
11076
11359
  useEffect10(() => {
11077
11360
  let cleanupFns = [];
11078
11361
  const { current } = element;
@@ -11205,7 +11488,7 @@ var useRequestVideoCallbackTime = ({
11205
11488
  lastSeek,
11206
11489
  onVariableFpsVideoDetected
11207
11490
  }) => {
11208
- const currentTime = useRef16(null);
11491
+ const currentTime = useRef17(null);
11209
11492
  useEffect11(() => {
11210
11493
  const { current } = mediaRef;
11211
11494
  if (current) {
@@ -11447,6 +11730,7 @@ var useMediaPlayback = ({
11447
11730
  src,
11448
11731
  mediaType,
11449
11732
  playbackRate: localPlaybackRate,
11733
+ preservePitch = true,
11450
11734
  onlyWarnForMediaSeekingError,
11451
11735
  acceptableTimeshift,
11452
11736
  pauseWhenBuffering,
@@ -11461,15 +11745,15 @@ var useMediaPlayback = ({
11461
11745
  const buffering = useContext27(BufferingContextReact);
11462
11746
  const { fps } = useVideoConfig();
11463
11747
  const mediaStartsAt = useMediaStartsAt();
11464
- const lastSeekDueToShift = useRef17(null);
11465
- const lastSeek = useRef17(null);
11748
+ const lastSeekDueToShift = useRef18(null);
11749
+ const lastSeek = useRef18(null);
11466
11750
  const logLevel = useLogLevel();
11467
11751
  const mountTime = useMountTime();
11468
11752
  if (!buffering) {
11469
11753
  throw new Error("useMediaPlayback must be used inside a <BufferingContext>");
11470
11754
  }
11471
- const isVariableFpsVideoMap = useRef17({});
11472
- const onVariableFpsVideoDetected = useCallback12(() => {
11755
+ const isVariableFpsVideoMap = useRef18({});
11756
+ const onVariableFpsVideoDetected = useCallback13(() => {
11473
11757
  if (!src) {
11474
11758
  return;
11475
11759
  }
@@ -11564,7 +11848,10 @@ var useMediaPlayback = ({
11564
11848
  if (mediaRef.current && mediaRef.current.playbackRate !== playbackRateToSet) {
11565
11849
  mediaRef.current.playbackRate = playbackRateToSet;
11566
11850
  }
11567
- }, [mediaRef, playbackRate]);
11851
+ if (mediaRef.current && mediaRef.current.preservesPitch !== preservePitch) {
11852
+ mediaRef.current.preservesPitch = preservePitch;
11853
+ }
11854
+ }, [mediaRef, playbackRate, preservePitch]);
11568
11855
  useEffect12(() => {
11569
11856
  const tagName = mediaType === "audio" ? "<Html5Audio>" : "<Html5Video>";
11570
11857
  if (!mediaRef.current) {
@@ -11748,14 +12035,14 @@ var SetMediaVolumeContext = createContext22({
11748
12035
  var useMediaVolumeState = () => {
11749
12036
  const { mediaVolume } = useContext28(MediaVolumeContext);
11750
12037
  const { setMediaVolume } = useContext28(SetMediaVolumeContext);
11751
- return useMemo27(() => {
12038
+ return useMemo28(() => {
11752
12039
  return [mediaVolume, setMediaVolume];
11753
12040
  }, [mediaVolume, setMediaVolume]);
11754
12041
  };
11755
12042
  var useMediaMutedState = () => {
11756
12043
  const { mediaMuted } = useContext28(MediaVolumeContext);
11757
12044
  const { setMediaMuted } = useContext28(SetMediaVolumeContext);
11758
- return useMemo27(() => {
12045
+ return useMemo28(() => {
11759
12046
  return [mediaMuted, setMediaMuted];
11760
12047
  }, [mediaMuted, setMediaMuted]);
11761
12048
  };
@@ -11765,7 +12052,7 @@ var warnAboutTooHighVolume = (volume) => {
11765
12052
  }
11766
12053
  };
11767
12054
  var AudioForDevelopmentForwardRefFunction = (props, ref) => {
11768
- const [initialShouldPreMountAudioElements] = useState16(props.shouldPreMountAudioTags);
12055
+ const [initialShouldPreMountAudioElements] = useState15(props.shouldPreMountAudioTags);
11769
12056
  if (props.shouldPreMountAudioTags !== initialShouldPreMountAudioElements) {
11770
12057
  throw new Error("Cannot change the behavior for pre-mounting audio tags dynamically.");
11771
12058
  }
@@ -11774,6 +12061,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
11774
12061
  volume,
11775
12062
  muted,
11776
12063
  playbackRate,
12064
+ preservePitch,
11777
12065
  shouldPreMountAudioTags,
11778
12066
  src,
11779
12067
  onDuration,
@@ -11804,14 +12092,12 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
11804
12092
  const [mediaVolume] = useMediaVolumeState();
11805
12093
  const [mediaMuted] = useMediaMutedState();
11806
12094
  const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
11807
- const { hidden } = useContext29(SequenceVisibilityToggleContext);
11808
12095
  if (!src) {
11809
12096
  throw new TypeError("No 'src' was passed to <Html5Audio>.");
11810
12097
  }
11811
12098
  const preloadedSrc = usePreload(src);
11812
12099
  const sequenceContext = useContext29(SequenceContext);
11813
- const [timelineId] = useState16(() => String(Math.random()));
11814
- const isSequenceHidden = hidden[timelineId] ?? false;
12100
+ const [timelineId] = useState15(() => String(Math.random()));
11815
12101
  const userPreferredVolume = evaluateVolume({
11816
12102
  frame: volumePropFrame,
11817
12103
  volume,
@@ -11823,9 +12109,9 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
11823
12109
  requestsVideoFrame: false,
11824
12110
  isClientSideRendering: false
11825
12111
  });
11826
- const propsToPass = useMemo28(() => {
12112
+ const propsToPass = useMemo29(() => {
11827
12113
  return {
11828
- muted: muted || mediaMuted || isSequenceHidden || userPreferredVolume <= 0,
12114
+ muted: muted || mediaMuted || userPreferredVolume <= 0,
11829
12115
  src: preloadedSrc,
11830
12116
  loop: _remotionInternalNativeLoopPassed,
11831
12117
  crossOrigin: crossOriginValue,
@@ -11833,7 +12119,6 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
11833
12119
  };
11834
12120
  }, [
11835
12121
  _remotionInternalNativeLoopPassed,
11836
- isSequenceHidden,
11837
12122
  mediaMuted,
11838
12123
  muted,
11839
12124
  nativeProps,
@@ -11841,7 +12126,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
11841
12126
  userPreferredVolume,
11842
12127
  crossOriginValue
11843
12128
  ]);
11844
- const id = useMemo28(() => `audio-${random(src ?? "")}-${sequenceContext?.relativeFrom}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.durationInFrames}-muted:${props.muted}-loop:${props.loop}`, [
12129
+ const id = useMemo29(() => `audio-${random(src ?? "")}-${sequenceContext?.relativeFrom}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.durationInFrames}-muted:${props.muted}-loop:${props.loop}`, [
11845
12130
  src,
11846
12131
  sequenceContext?.relativeFrom,
11847
12132
  sequenceContext?.cumulatedFrom,
@@ -11859,6 +12144,9 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
11859
12144
  premounting: Boolean(sequenceContext?.premounting),
11860
12145
  postmounting: Boolean(sequenceContext?.postmounting)
11861
12146
  });
12147
+ const getStack = useCallback14(() => {
12148
+ return _remotionInternalStack ?? null;
12149
+ }, [_remotionInternalStack]);
11862
12150
  useMediaInTimeline({
11863
12151
  volume,
11864
12152
  mediaVolume,
@@ -11867,7 +12155,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
11867
12155
  playbackRate: playbackRate ?? 1,
11868
12156
  displayName: name ?? null,
11869
12157
  id: timelineId,
11870
- stack: _remotionInternalStack,
12158
+ getStack,
11871
12159
  showInTimeline,
11872
12160
  premountDisplay: sequenceContext?.premountDisplay ?? null,
11873
12161
  postmountDisplay: sequenceContext?.postmountDisplay ?? null,
@@ -11878,6 +12166,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
11878
12166
  src,
11879
12167
  mediaType: "audio",
11880
12168
  playbackRate: playbackRate ?? 1,
12169
+ preservePitch,
11881
12170
  onlyWarnForMediaSeekingError: false,
11882
12171
  acceptableTimeshift: acceptableTimeShiftInSeconds ?? null,
11883
12172
  isPremounting: Boolean(sequenceContext?.premounting),
@@ -11911,7 +12200,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
11911
12200
  useImperativeHandle4(ref, () => {
11912
12201
  return audioRef.current;
11913
12202
  }, [audioRef]);
11914
- const currentOnDurationCallback = useRef18(onDuration);
12203
+ const currentOnDurationCallback = useRef19(onDuration);
11915
12204
  currentOnDurationCallback.current = onDuration;
11916
12205
  useEffect14(() => {
11917
12206
  const { current } = audioRef;
@@ -11940,9 +12229,9 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
11940
12229
  ...propsToPass
11941
12230
  });
11942
12231
  };
11943
- var AudioForPreview = forwardRef6(AudioForDevelopmentForwardRefFunction);
12232
+ var AudioForPreview = forwardRef7(AudioForDevelopmentForwardRefFunction);
11944
12233
  var AudioForRenderingRefForwardingFunction = (props, ref) => {
11945
- const audioRef = useRef19(null);
12234
+ const audioRef = useRef20(null);
11946
12235
  const {
11947
12236
  volume: volumeProp,
11948
12237
  playbackRate,
@@ -11959,6 +12248,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
11959
12248
  loopVolumeCurveBehavior,
11960
12249
  pauseWhenBuffering,
11961
12250
  audioStreamIndex,
12251
+ preservePitch: _preservePitch,
11962
12252
  ...nativeProps
11963
12253
  } = props;
11964
12254
  const absoluteFrame = useTimelinePosition();
@@ -11967,7 +12257,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
11967
12257
  const sequenceContext = useContext30(SequenceContext);
11968
12258
  const { registerRenderAsset, unregisterRenderAsset } = useContext30(RenderAssetManager);
11969
12259
  const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
11970
- const id = useMemo29(() => `audio-${random(props.src ?? "")}-${sequenceContext?.relativeFrom}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.durationInFrames}`, [
12260
+ const id = useMemo30(() => `audio-${random(props.src ?? "")}-${sequenceContext?.relativeFrom}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.durationInFrames}`, [
11971
12261
  props.src,
11972
12262
  sequenceContext?.relativeFrom,
11973
12263
  sequenceContext?.cumulatedFrom,
@@ -12072,7 +12362,7 @@ var AudioForRenderingRefForwardingFunction = (props, ref) => {
12072
12362
  onError: onNativeError
12073
12363
  });
12074
12364
  };
12075
- var AudioForRendering = forwardRef7(AudioForRenderingRefForwardingFunction);
12365
+ var AudioForRendering = forwardRef8(AudioForRenderingRefForwardingFunction);
12076
12366
  var AudioRefForwardingFunction = (props, ref) => {
12077
12367
  const audioTagsContext = useContext31(SharedAudioTagsContext);
12078
12368
  const {
@@ -12098,7 +12388,7 @@ var AudioRefForwardingFunction = (props, ref) => {
12098
12388
  throw new TypeError(`The \`<Html5Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
12099
12389
  }
12100
12390
  const preloadedSrc = usePreload(props.src);
12101
- const onError = useCallback13((e) => {
12391
+ const onError = useCallback15((e) => {
12102
12392
  console.log(e.currentTarget.error);
12103
12393
  const errMessage = `Could not play audio with src ${preloadedSrc}: ${e.currentTarget.error}. See https://remotion.dev/docs/media-playback-error for help.`;
12104
12394
  if (loop) {
@@ -12112,7 +12402,7 @@ var AudioRefForwardingFunction = (props, ref) => {
12112
12402
  console.warn(errMessage);
12113
12403
  }
12114
12404
  }, [loop, onRemotionError, preloadedSrc]);
12115
- const onDuration = useCallback13((src, durationInSeconds) => {
12405
+ const onDuration = useCallback15((src, durationInSeconds) => {
12116
12406
  setDurations({ type: "got-duration", durationInSeconds, src });
12117
12407
  }, [setDurations]);
12118
12408
  const durationFetched = durations[getAbsoluteSrc(preloadedSrc)] ?? durations[getAbsoluteSrc(props.src)];
@@ -12162,7 +12452,11 @@ var AudioRefForwardingFunction = (props, ref) => {
12162
12452
  })
12163
12453
  });
12164
12454
  }
12165
- validateMediaProps({ playbackRate: props.playbackRate, volume: props.volume }, "Html5Audio");
12455
+ validateMediaProps({
12456
+ playbackRate: props.playbackRate,
12457
+ preservePitch: props.preservePitch,
12458
+ volume: props.volume
12459
+ }, "Html5Audio");
12166
12460
  if (environment.isRendering) {
12167
12461
  return /* @__PURE__ */ jsx24(AudioForRendering, {
12168
12462
  onDuration,
@@ -12185,7 +12479,7 @@ var AudioRefForwardingFunction = (props, ref) => {
12185
12479
  showInTimeline: showInTimeline ?? true
12186
12480
  });
12187
12481
  };
12188
- var Html5Audio = forwardRef8(AudioRefForwardingFunction);
12482
+ var Html5Audio = forwardRef9(AudioRefForwardingFunction);
12189
12483
  addSequenceStackTraces(Html5Audio);
12190
12484
  var Audio = Html5Audio;
12191
12485
  var kSplineTableSize = 11;
@@ -12198,15 +12492,15 @@ var IFrameRefForwarding = ({
12198
12492
  ...props2
12199
12493
  }, ref) => {
12200
12494
  const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
12201
- const [handle] = useState17(() => delayRender2(`Loading <IFrame> with source ${props2.src}`, {
12495
+ const [handle] = useState16(() => delayRender2(`Loading <IFrame> with source ${props2.src}`, {
12202
12496
  retries: delayRenderRetries ?? undefined,
12203
12497
  timeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined
12204
12498
  }));
12205
- const didLoad = useCallback14((e) => {
12499
+ const didLoad = useCallback16((e) => {
12206
12500
  continueRender2(handle);
12207
12501
  onLoad?.(e);
12208
12502
  }, [handle, onLoad, continueRender2]);
12209
- const didGetError = useCallback14((e) => {
12503
+ const didGetError = useCallback16((e) => {
12210
12504
  continueRender2(handle);
12211
12505
  if (onError) {
12212
12506
  onError(e);
@@ -12222,7 +12516,7 @@ var IFrameRefForwarding = ({
12222
12516
  onLoad: didLoad
12223
12517
  });
12224
12518
  };
12225
- var IFrame = forwardRef9(IFrameRefForwarding);
12519
+ var IFrame = forwardRef10(IFrameRefForwarding);
12226
12520
  function exponentialBackoff(errorCount) {
12227
12521
  return 1000 * 2 ** (errorCount - 1);
12228
12522
  }
@@ -12232,7 +12526,7 @@ function truncateSrcForLabel(src) {
12232
12526
  }
12233
12527
  return src;
12234
12528
  }
12235
- var ImgInner = ({
12529
+ var ImgContent = ({
12236
12530
  onError,
12237
12531
  maxRetries = 2,
12238
12532
  src,
@@ -12241,21 +12535,13 @@ var ImgInner = ({
12241
12535
  delayRenderTimeoutInMilliseconds,
12242
12536
  onImageFrame,
12243
12537
  crossOrigin,
12244
- showInTimeline,
12245
- name,
12246
- stack,
12247
12538
  ref,
12248
- _experimentalControls: controls,
12249
12539
  ...props2
12250
12540
  }) => {
12251
- const imageRef = useRef20(null);
12252
- const errors = useRef20({});
12541
+ const imageRef = useRef21(null);
12542
+ const errors = useRef21({});
12253
12543
  const { delayPlayback } = useBufferState();
12254
12544
  const sequenceContext = useContext32(SequenceContext);
12255
- const [timelineId] = useState18(() => String(Math.random()));
12256
- if (!src) {
12257
- throw new Error('No "src" prop was passed to <Img>.');
12258
- }
12259
12545
  const _propsValid = true;
12260
12546
  if (!_propsValid) {
12261
12547
  throw new Error("typecheck error");
@@ -12263,19 +12549,8 @@ var ImgInner = ({
12263
12549
  useImperativeHandle6(ref, () => {
12264
12550
  return imageRef.current;
12265
12551
  }, []);
12266
- useImageInTimeline({
12267
- src,
12268
- displayName: name ?? null,
12269
- id: timelineId,
12270
- stack: stack ?? null,
12271
- showInTimeline: showInTimeline ?? true,
12272
- premountDisplay: sequenceContext?.premountDisplay ?? null,
12273
- postmountDisplay: sequenceContext?.postmountDisplay ?? null,
12274
- loopDisplay: undefined,
12275
- controls: controls ?? null
12276
- });
12277
12552
  const actualSrc = usePreload(src);
12278
- const retryIn = useCallback15((timeout) => {
12553
+ const retryIn = useCallback17((timeout) => {
12279
12554
  if (!imageRef.current) {
12280
12555
  return;
12281
12556
  }
@@ -12293,7 +12568,7 @@ var ImgInner = ({
12293
12568
  }, timeout);
12294
12569
  }, []);
12295
12570
  const { delayRender: delayRender2, continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
12296
- const didGetError = useCallback15((e) => {
12571
+ const didGetError = useCallback17((e) => {
12297
12572
  if (!errors.current) {
12298
12573
  return;
12299
12574
  }
@@ -12395,7 +12670,47 @@ var ImgInner = ({
12395
12670
  decoding: "sync"
12396
12671
  });
12397
12672
  };
12398
- var Img = wrapInSchema(ImgInner, sequenceStyleSchema);
12673
+ var ImgInner = ({
12674
+ hidden,
12675
+ name,
12676
+ stack,
12677
+ showInTimeline,
12678
+ src,
12679
+ _experimentalControls: controls,
12680
+ ...props2
12681
+ }) => {
12682
+ const sequenceContext = useContext32(SequenceContext);
12683
+ const [timelineId] = useState17(() => String(Math.random()));
12684
+ if (!src) {
12685
+ throw new Error('No "src" prop was passed to <Img>.');
12686
+ }
12687
+ const stackRef = useRef21(null);
12688
+ stackRef.current = stack ?? null;
12689
+ const getStack = useCallback17(() => stackRef.current, []);
12690
+ useImageInTimeline({
12691
+ src,
12692
+ displayName: name ?? null,
12693
+ id: timelineId,
12694
+ getStack,
12695
+ showInTimeline: showInTimeline ?? true,
12696
+ premountDisplay: sequenceContext?.premountDisplay ?? null,
12697
+ postmountDisplay: sequenceContext?.postmountDisplay ?? null,
12698
+ loopDisplay: undefined,
12699
+ controls: controls ?? null
12700
+ });
12701
+ if (hidden) {
12702
+ return null;
12703
+ }
12704
+ return /* @__PURE__ */ jsx26(ImgContent, {
12705
+ src,
12706
+ ...props2
12707
+ });
12708
+ };
12709
+ var imgSchema = {
12710
+ ...sequenceVisualStyleSchema,
12711
+ hidden: hiddenField
12712
+ };
12713
+ var Img = wrapInSchema(ImgInner, imgSchema);
12399
12714
  addSequenceStackTraces(Img);
12400
12715
  var compositionsRef = React28.createRef();
12401
12716
  var CompositionManagerProvider = ({
@@ -12405,18 +12720,18 @@ var CompositionManagerProvider = ({
12405
12720
  initialCompositions,
12406
12721
  initialCanvasContent
12407
12722
  }) => {
12408
- const [folders, setFolders] = useState19([]);
12409
- const [canvasContent, setCanvasContent] = useState19(initialCanvasContent);
12410
- const [compositions, setCompositions] = useState19(initialCompositions);
12411
- const currentcompositionsRef = useRef21(compositions);
12412
- const updateCompositions = useCallback16((updateComps) => {
12723
+ const [folders, setFolders] = useState18([]);
12724
+ const [canvasContent, setCanvasContent] = useState18(initialCanvasContent);
12725
+ const [compositions, setCompositions] = useState18(initialCompositions);
12726
+ const currentcompositionsRef = useRef22(compositions);
12727
+ const updateCompositions = useCallback18((updateComps) => {
12413
12728
  setCompositions((comps) => {
12414
12729
  const updated = updateComps(comps);
12415
12730
  currentcompositionsRef.current = updated;
12416
12731
  return updated;
12417
12732
  });
12418
12733
  }, []);
12419
- const registerComposition = useCallback16((comp) => {
12734
+ const registerComposition = useCallback18((comp) => {
12420
12735
  updateCompositions((comps) => {
12421
12736
  if (comps.find((c2) => c2.id === comp.id)) {
12422
12737
  throw new Error(`Multiple composition with id ${comp.id} are registered.`);
@@ -12424,12 +12739,12 @@ var CompositionManagerProvider = ({
12424
12739
  return [...comps, comp];
12425
12740
  });
12426
12741
  }, [updateCompositions]);
12427
- const unregisterComposition = useCallback16((id) => {
12742
+ const unregisterComposition = useCallback18((id) => {
12428
12743
  setCompositions((comps) => {
12429
12744
  return comps.filter((c2) => c2.id !== id);
12430
12745
  });
12431
12746
  }, []);
12432
- const registerFolder = useCallback16((name, parent, nonce) => {
12747
+ const registerFolder = useCallback18((name, parent, nonce) => {
12433
12748
  setFolders((prevFolders) => {
12434
12749
  return [
12435
12750
  ...prevFolders,
@@ -12441,7 +12756,7 @@ var CompositionManagerProvider = ({
12441
12756
  ];
12442
12757
  });
12443
12758
  }, []);
12444
- const unregisterFolder = useCallback16((name, parent) => {
12759
+ const unregisterFolder = useCallback18((name, parent) => {
12445
12760
  setFolders((prevFolders) => {
12446
12761
  return prevFolders.filter((p) => !(p.name === name && p.parent === parent));
12447
12762
  });
@@ -12451,7 +12766,7 @@ var CompositionManagerProvider = ({
12451
12766
  getCompositions: () => currentcompositionsRef.current
12452
12767
  };
12453
12768
  }, []);
12454
- const compositionManagerSetters = useMemo30(() => {
12769
+ const compositionManagerSetters = useMemo31(() => {
12455
12770
  return {
12456
12771
  registerComposition,
12457
12772
  unregisterComposition,
@@ -12467,7 +12782,7 @@ var CompositionManagerProvider = ({
12467
12782
  unregisterFolder,
12468
12783
  onlyRenderComposition
12469
12784
  ]);
12470
- const compositionManagerContextValue = useMemo30(() => {
12785
+ const compositionManagerContextValue = useMemo31(() => {
12471
12786
  return {
12472
12787
  compositions,
12473
12788
  folders,
@@ -12541,14 +12856,33 @@ var makeDefaultPreviewCSS = (scope, backgroundColor) => {
12541
12856
  }
12542
12857
  `;
12543
12858
  };
12859
+ var disabledEffectField = {
12860
+ type: "boolean",
12861
+ default: false,
12862
+ description: "Disabled"
12863
+ };
12544
12864
  var createEffect = (definition) => {
12545
- const widened = definition;
12546
- const factory = (params = {}) => ({
12547
- definition: widened,
12548
- params,
12549
- effectKey: widened.calculateKey(params),
12550
- memoized: false
12551
- });
12865
+ const { calculateKey: userCalculateKey, validateParams } = definition;
12866
+ const widened = {
12867
+ ...definition,
12868
+ calculateKey: (params) => {
12869
+ const disabled = params.disabled ?? false;
12870
+ return `${userCalculateKey(params)}-disabled-${disabled}`;
12871
+ },
12872
+ schema: {
12873
+ disabled: disabledEffectField,
12874
+ ...definition.schema
12875
+ }
12876
+ };
12877
+ const factory = (params = {}) => {
12878
+ validateParams(params);
12879
+ return {
12880
+ definition: widened,
12881
+ params,
12882
+ effectKey: widened.calculateKey(params),
12883
+ memoized: false
12884
+ };
12885
+ };
12552
12886
  return factory;
12553
12887
  };
12554
12888
  var REMOTION_STUDIO_CONTAINER_ELEMENT = "__remotion-studio-container";
@@ -12599,7 +12933,7 @@ var MediaEnabledProvider = ({
12599
12933
  videoEnabled,
12600
12934
  audioEnabled
12601
12935
  }) => {
12602
- const value = useMemo31(() => ({ videoEnabled, audioEnabled }), [videoEnabled, audioEnabled]);
12936
+ const value = useMemo322(() => ({ videoEnabled, audioEnabled }), [videoEnabled, audioEnabled]);
12603
12937
  return /* @__PURE__ */ jsx28(MediaEnabledContext.Provider, {
12604
12938
  value,
12605
12939
  children
@@ -12614,13 +12948,13 @@ var RemotionRootContexts = ({
12614
12948
  audioEnabled,
12615
12949
  frameState
12616
12950
  }) => {
12617
- const nonceContext = useMemo322(() => {
12951
+ const nonceContext = useMemo33(() => {
12618
12952
  let counter = 0;
12619
12953
  return {
12620
12954
  getNonce: () => counter++
12621
12955
  };
12622
12956
  }, []);
12623
- const logging = useMemo322(() => {
12957
+ const logging = useMemo33(() => {
12624
12958
  return { logLevel, mountTime: Date.now() };
12625
12959
  }, [logLevel]);
12626
12960
  return /* @__PURE__ */ jsx29(LogLevelContext.Provider, {
@@ -12901,6 +13235,7 @@ var OffthreadVideoForRendering = ({
12901
13235
  onVideoFrame,
12902
13236
  crossOrigin,
12903
13237
  audioStreamIndex,
13238
+ preservePitch: _preservePitch,
12904
13239
  ...props2
12905
13240
  }) => {
12906
13241
  const absoluteFrame = useTimelinePosition();
@@ -12913,7 +13248,7 @@ var OffthreadVideoForRendering = ({
12913
13248
  if (!src) {
12914
13249
  throw new TypeError("No `src` was passed to <OffthreadVideo>.");
12915
13250
  }
12916
- const id = useMemo33(() => `offthreadvideo-${random(src)}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
13251
+ const id = useMemo34(() => `offthreadvideo-${random(src)}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
12917
13252
  src,
12918
13253
  sequenceContext?.cumulatedFrom,
12919
13254
  sequenceContext?.relativeFrom,
@@ -12968,14 +13303,14 @@ var OffthreadVideoForRendering = ({
12968
13303
  sequenceContext?.relativeFrom,
12969
13304
  audioStreamIndex
12970
13305
  ]);
12971
- const currentTime = useMemo33(() => {
13306
+ const currentTime = useMemo34(() => {
12972
13307
  return getExpectedMediaFrameUncorrected({
12973
13308
  frame,
12974
13309
  playbackRate: playbackRate || 1,
12975
13310
  startFrom: -mediaStartsAt
12976
13311
  }) / videoConfig.fps;
12977
13312
  }, [frame, mediaStartsAt, playbackRate, videoConfig.fps]);
12978
- const actualSrc = useMemo33(() => {
13313
+ const actualSrc = useMemo34(() => {
12979
13314
  return getOffthreadVideoSource({
12980
13315
  src,
12981
13316
  currentTime,
@@ -12983,7 +13318,7 @@ var OffthreadVideoForRendering = ({
12983
13318
  toneMapped
12984
13319
  });
12985
13320
  }, [toneMapped, currentTime, src, transparent]);
12986
- const [imageSrc, setImageSrc] = useState20(null);
13321
+ const [imageSrc, setImageSrc] = useState19(null);
12987
13322
  const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
12988
13323
  useLayoutEffect11(() => {
12989
13324
  if (!window.remotion_videoEnabled) {
@@ -13056,17 +13391,17 @@ var OffthreadVideoForRendering = ({
13056
13391
  continueRender2,
13057
13392
  delayRender2
13058
13393
  ]);
13059
- const onErr = useCallback17(() => {
13394
+ const onErr = useCallback19(() => {
13060
13395
  if (onError) {
13061
13396
  onError?.(new Error("Failed to load image with src " + imageSrc));
13062
13397
  } else {
13063
13398
  cancelRender("Failed to load image with src " + imageSrc);
13064
13399
  }
13065
13400
  }, [imageSrc, onError]);
13066
- const className = useMemo33(() => {
13401
+ const className = useMemo34(() => {
13067
13402
  return [OBJECTFIT_CONTAIN_CLASS_NAME, props2.className].filter(truthy2).join(" ");
13068
13403
  }, [props2.className]);
13069
- const onImageFrame = useCallback17((img) => {
13404
+ const onImageFrame = useCallback19((img) => {
13070
13405
  if (onVideoFrame) {
13071
13406
  onVideoFrame(img);
13072
13407
  }
@@ -13125,8 +13460,8 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
13125
13460
  if (!context) {
13126
13461
  throw new Error("SharedAudioContext not found");
13127
13462
  }
13128
- const videoRef = useRef22(null);
13129
- const sharedSource = useMemo34(() => {
13463
+ const videoRef = useRef23(null);
13464
+ const sharedSource = useMemo35(() => {
13130
13465
  if (!context.audioContext) {
13131
13466
  return null;
13132
13467
  }
@@ -13147,6 +13482,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
13147
13482
  volume,
13148
13483
  muted,
13149
13484
  playbackRate,
13485
+ preservePitch,
13150
13486
  onlyWarnForMediaSeekingError,
13151
13487
  src,
13152
13488
  onDuration,
@@ -13178,11 +13514,9 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
13178
13514
  const volumePropFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
13179
13515
  const { fps, durationInFrames } = useVideoConfig();
13180
13516
  const parentSequence = useContext35(SequenceContext);
13181
- const { hidden } = useContext35(SequenceVisibilityToggleContext);
13182
13517
  const logLevel = useLogLevel();
13183
13518
  const mountTime = useMountTime();
13184
- const [timelineId] = useState21(() => String(Math.random()));
13185
- const isSequenceHidden = hidden[timelineId] ?? false;
13519
+ const [timelineId] = useState20(() => String(Math.random()));
13186
13520
  if (typeof acceptableTimeShift !== "undefined") {
13187
13521
  throw new Error("acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.");
13188
13522
  }
@@ -13194,6 +13528,9 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
13194
13528
  mediaVolume
13195
13529
  });
13196
13530
  warnAboutTooHighVolume(userPreferredVolume);
13531
+ const getStack = useCallback20(() => {
13532
+ return _remotionInternalStack ?? null;
13533
+ }, [_remotionInternalStack]);
13197
13534
  useMediaInTimeline({
13198
13535
  volume,
13199
13536
  mediaVolume,
@@ -13202,7 +13539,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
13202
13539
  playbackRate: props2.playbackRate ?? 1,
13203
13540
  displayName: name ?? null,
13204
13541
  id: timelineId,
13205
- stack: _remotionInternalStack,
13542
+ getStack,
13206
13543
  showInTimeline,
13207
13544
  premountDisplay: parentSequence?.premountDisplay ?? null,
13208
13545
  postmountDisplay: parentSequence?.postmountDisplay ?? null,
@@ -13213,6 +13550,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
13213
13550
  src,
13214
13551
  mediaType: "video",
13215
13552
  playbackRate: props2.playbackRate ?? 1,
13553
+ preservePitch,
13216
13554
  onlyWarnForMediaSeekingError,
13217
13555
  acceptableTimeshift: acceptableTimeShiftInSeconds ?? null,
13218
13556
  isPremounting: Boolean(parentSequence?.premounting),
@@ -13247,7 +13585,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
13247
13585
  useImperativeHandle8(ref, () => {
13248
13586
  return videoRef.current;
13249
13587
  }, []);
13250
- useState21(() => playbackLogging({
13588
+ useState20(() => playbackLogging({
13251
13589
  logLevel,
13252
13590
  message: `Mounting video with source = ${actualSrc}, v=${VERSION}, user agent=${typeof navigator === "undefined" ? "server" : navigator.userAgent}`,
13253
13591
  tag: "video",
@@ -13293,7 +13631,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
13293
13631
  current.removeEventListener("error", errorHandler);
13294
13632
  };
13295
13633
  }, [onError, src]);
13296
- const currentOnDurationCallback = useRef22(onDuration);
13634
+ const currentOnDurationCallback = useRef23(onDuration);
13297
13635
  currentOnDurationCallback.current = onDuration;
13298
13636
  useEmitVideoFrame({ ref: videoRef, onVideoFrame });
13299
13637
  useEffect18(() => {
@@ -13324,12 +13662,11 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
13324
13662
  current.preload = "auto";
13325
13663
  }
13326
13664
  }, []);
13327
- const actualStyle = useMemo34(() => {
13665
+ const actualStyle = useMemo35(() => {
13328
13666
  return {
13329
- ...style,
13330
- opacity: isSequenceHidden ? 0 : style?.opacity ?? 1
13667
+ ...style
13331
13668
  };
13332
- }, [isSequenceHidden, style]);
13669
+ }, [style]);
13333
13670
  const crossOriginValue = getCrossOriginValue({
13334
13671
  crossOrigin,
13335
13672
  requestsVideoFrame: Boolean(onVideoFrame),
@@ -13337,7 +13674,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
13337
13674
  });
13338
13675
  return /* @__PURE__ */ jsx31("video", {
13339
13676
  ref: videoRef,
13340
- muted: muted || mediaMuted || isSequenceHidden || userPreferredVolume <= 0,
13677
+ muted: muted || mediaMuted || userPreferredVolume <= 0,
13341
13678
  playsInline: true,
13342
13679
  src: actualSrc,
13343
13680
  loop: _remotionInternalNativeLoopPassed,
@@ -13347,7 +13684,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
13347
13684
  ...nativeProps
13348
13685
  });
13349
13686
  };
13350
- var VideoForPreview = forwardRef10(VideoForDevelopmentRefForwardingFunction);
13687
+ var VideoForPreview = forwardRef11(VideoForDevelopmentRefForwardingFunction);
13351
13688
  var InnerOffthreadVideo = (props2) => {
13352
13689
  const {
13353
13690
  startFrom,
@@ -13364,7 +13701,7 @@ var InnerOffthreadVideo = (props2) => {
13364
13701
  if (environment.isClientSideRendering) {
13365
13702
  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");
13366
13703
  }
13367
- const onDuration = useCallback18(() => {
13704
+ const onDuration = useCallback21(() => {
13368
13705
  return;
13369
13706
  }, []);
13370
13707
  if (typeof props2.src !== "string") {
@@ -13452,6 +13789,7 @@ var OffthreadVideo = ({
13452
13789
  onVideoFrame,
13453
13790
  pauseWhenBuffering,
13454
13791
  playbackRate,
13792
+ preservePitch,
13455
13793
  showInTimeline,
13456
13794
  style,
13457
13795
  toneFrequency,
@@ -13487,6 +13825,7 @@ var OffthreadVideo = ({
13487
13825
  onVideoFrame,
13488
13826
  pauseWhenBuffering: pauseWhenBuffering ?? true,
13489
13827
  playbackRate: playbackRate ?? 1,
13828
+ preservePitch,
13490
13829
  toneFrequency: toneFrequency ?? 1,
13491
13830
  showInTimeline: showInTimeline ?? true,
13492
13831
  src,
@@ -13518,7 +13857,7 @@ function useRemotionContexts() {
13518
13857
  const sequenceManagerContext = React36.useContext(SequenceManager);
13519
13858
  const bufferManagerContext = React36.useContext(BufferingContextReact);
13520
13859
  const logLevelContext = React36.useContext(LogLevelContext);
13521
- return useMemo35(() => ({
13860
+ return useMemo36(() => ({
13522
13861
  compositionManagerCtx,
13523
13862
  timelineContext,
13524
13863
  setTimelineContext,
@@ -13607,10 +13946,11 @@ var Internals = {
13607
13946
  VisualModeSettersContext,
13608
13947
  SequenceManager,
13609
13948
  SequenceStackTracesUpdateContext,
13610
- SequenceVisibilityToggleContext,
13611
13949
  wrapInSchema,
13612
13950
  sequenceSchema,
13613
13951
  sequenceStyleSchema,
13952
+ sequenceVisualStyleSchema,
13953
+ sequencePremountSchema,
13614
13954
  flattenActiveSchema,
13615
13955
  getFlatSchemaWithAllKeys,
13616
13956
  RemotionRootContexts,
@@ -13705,13 +14045,16 @@ var Internals = {
13705
14045
  useMemoizedEffects,
13706
14046
  useMemoizedEffectDefinitions,
13707
14047
  createEffect,
14048
+ createWebGLContextError,
14049
+ createWebGL2ContextError,
13708
14050
  computeEffectiveSchemaValuesDotNotation,
13709
14051
  OverrideIdsToNodePathsGettersContext,
13710
14052
  OverrideIdsToNodePathsSettersContext,
13711
14053
  findPropsToDelete,
13712
14054
  makeSequencePropsSubscriptionKey,
13713
14055
  getCodeValuesCtx,
13714
- getEffectCodeValuesCtx
14056
+ getEffectCodeValuesCtx,
14057
+ hiddenField
13715
14058
  };
13716
14059
  var NUMBER = "[-+]?\\d*\\.?\\d+";
13717
14060
  var PERCENTAGE = NUMBER + "%";
@@ -13774,9 +14117,9 @@ var SeriesSequenceRefForwardingFunction = ({ children }, _ref) => {
13774
14117
  children
13775
14118
  });
13776
14119
  };
13777
- var SeriesSequence = forwardRef11(SeriesSequenceRefForwardingFunction);
14120
+ var SeriesSequence = forwardRef12(SeriesSequenceRefForwardingFunction);
13778
14121
  var SeriesInner = (props2) => {
13779
- const childrenValue = useMemo36(() => {
14122
+ const childrenValue = useMemo37(() => {
13780
14123
  let startFrame = 0;
13781
14124
  const flattenedChildren = flattenChildren(props2.children);
13782
14125
  return Children.map(flattenedChildren, (child, i) => {
@@ -14299,13 +14642,14 @@ var VideoForRenderingForwardFunction = ({
14299
14642
  loopVolumeCurveBehavior,
14300
14643
  audioStreamIndex,
14301
14644
  onVideoFrame,
14645
+ preservePitch: _preservePitch,
14302
14646
  ...props2
14303
14647
  }, ref) => {
14304
14648
  const absoluteFrame = useTimelinePosition();
14305
14649
  const frame = useCurrentFrame();
14306
14650
  const volumePropsFrame = useFrameForVolumeProp(loopVolumeCurveBehavior ?? "repeat");
14307
14651
  const videoConfig = useUnsafeVideoConfig();
14308
- const videoRef = useRef23(null);
14652
+ const videoRef = useRef24(null);
14309
14653
  const sequenceContext = useContext36(SequenceContext);
14310
14654
  const mediaStartsAt = useMediaStartsAt();
14311
14655
  const environment = useRemotionEnvironment();
@@ -14313,7 +14657,7 @@ var VideoForRenderingForwardFunction = ({
14313
14657
  const mountTime = useMountTime();
14314
14658
  const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
14315
14659
  const { registerRenderAsset, unregisterRenderAsset } = useContext36(RenderAssetManager);
14316
- const id = useMemo37(() => `video-${random(props2.src ?? "")}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
14660
+ const id = useMemo38(() => `video-${random(props2.src ?? "")}-${sequenceContext?.cumulatedFrom}-${sequenceContext?.relativeFrom}-${sequenceContext?.durationInFrames}`, [
14317
14661
  props2.src,
14318
14662
  sequenceContext?.cumulatedFrom,
14319
14663
  sequenceContext?.relativeFrom,
@@ -14501,7 +14845,7 @@ var VideoForRenderingForwardFunction = ({
14501
14845
  ...props2
14502
14846
  });
14503
14847
  };
14504
- var VideoForRendering = forwardRef12(VideoForRenderingForwardFunction);
14848
+ var VideoForRendering = forwardRef13(VideoForRenderingForwardFunction);
14505
14849
  var VideoForwardingFunction = (props2, ref) => {
14506
14850
  const {
14507
14851
  startFrom,
@@ -14530,10 +14874,10 @@ var VideoForwardingFunction = (props2, ref) => {
14530
14874
  throw new TypeError(`The \`<Html5Video>\` tag requires a string for \`src\`, but got ${JSON.stringify(props2.src)} instead.`);
14531
14875
  }
14532
14876
  const preloadedSrc = usePreload(props2.src);
14533
- const onDuration = useCallback19((src, durationInSeconds) => {
14877
+ const onDuration = useCallback22((src, durationInSeconds) => {
14534
14878
  setDurations({ type: "got-duration", durationInSeconds, src });
14535
14879
  }, [setDurations]);
14536
- const onVideoFrame = useCallback19(() => {}, []);
14880
+ const onVideoFrame = useCallback22(() => {}, []);
14537
14881
  const durationFetched = durations[getAbsoluteSrc(preloadedSrc)] ?? durations[getAbsoluteSrc(props2.src)];
14538
14882
  validateMediaTrimProps({ startFrom, endAt, trimBefore, trimAfter });
14539
14883
  const { trimBeforeValue, trimAfterValue } = resolveTrimProps({
@@ -14585,7 +14929,11 @@ var VideoForwardingFunction = (props2, ref) => {
14585
14929
  })
14586
14930
  });
14587
14931
  }
14588
- validateMediaProps({ playbackRate: props2.playbackRate, volume: props2.volume }, "Html5Video");
14932
+ validateMediaProps({
14933
+ playbackRate: props2.playbackRate,
14934
+ preservePitch: props2.preservePitch,
14935
+ volume: props2.volume
14936
+ }, "Html5Video");
14589
14937
  if (environment.isRendering) {
14590
14938
  return /* @__PURE__ */ jsx37(VideoForRendering, {
14591
14939
  onDuration,
@@ -14607,7 +14955,7 @@ var VideoForwardingFunction = (props2, ref) => {
14607
14955
  onAutoPlayError: onAutoPlayError ?? undefined
14608
14956
  });
14609
14957
  };
14610
- var Html5Video = forwardRef13(VideoForwardingFunction);
14958
+ var Html5Video = forwardRef14(VideoForwardingFunction);
14611
14959
  addSequenceStackTraces(Html5Video);
14612
14960
  checkMultipleRemotionVersions();
14613
14961
  var proxyObj = {};
@@ -14637,7 +14985,7 @@ addSequenceStackTraces(Composition);
14637
14985
  // ../design/dist/esm/index.mjs
14638
14986
  import { jsx as jsx210, Fragment as Fragment3 } from "react/jsx-runtime";
14639
14987
  import { jsx as jsx39, jsxs as jsxs3 } from "react/jsx-runtime";
14640
- import { useEffect as useEffect22, useMemo as useMemo210, useRef as useRef25 } from "react";
14988
+ import { useEffect as useEffect22, useMemo as useMemo210, useRef as useRef26 } from "react";
14641
14989
  import { jsx as jsx43 } from "react/jsx-runtime";
14642
14990
  import { jsx as jsx53, jsxs as jsxs23 } from "react/jsx-runtime";
14643
14991
  import React62 from "react";
@@ -14651,21 +14999,21 @@ import { jsx as jsx113 } from "react/jsx-runtime";
14651
14999
  import { jsx as jsx122 } from "react/jsx-runtime";
14652
15000
  import * as React362 from "react";
14653
15001
  import * as ReactDOM4 from "react-dom";
14654
- import React11 from "react";
15002
+ import React112 from "react";
14655
15003
  import * as React8 from "react";
14656
15004
  import { jsx as jsx132 } from "react/jsx-runtime";
14657
15005
  import * as React9 from "react";
14658
- import * as React102 from "react";
15006
+ import * as React10 from "react";
14659
15007
  import { Fragment as Fragment5, jsx as jsx142 } from "react/jsx-runtime";
14660
15008
  import { jsx as jsx152 } from "react/jsx-runtime";
14661
- import * as React12 from "react";
15009
+ import * as React122 from "react";
14662
15010
  import { jsx as jsx162 } from "react/jsx-runtime";
14663
15011
  import * as React16 from "react";
14664
- import * as React132 from "react";
15012
+ import * as React13 from "react";
14665
15013
  import * as ReactDOM from "react-dom";
14666
15014
  import { jsx as jsx172 } from "react/jsx-runtime";
14667
- import * as React14 from "react";
14668
- import * as React152 from "react";
15015
+ import * as React142 from "react";
15016
+ import * as React15 from "react";
14669
15017
  import { jsx as jsx182 } from "react/jsx-runtime";
14670
15018
  import * as React172 from "react";
14671
15019
  import * as React18 from "react";
@@ -14891,7 +15239,7 @@ var useHoverTransforms = (ref, disabled) => {
14891
15239
  progress: 0,
14892
15240
  isActive: false
14893
15241
  });
14894
- const eventTarget = useMemo38(() => new EventTarget, []);
15242
+ const eventTarget = useMemo39(() => new EventTarget, []);
14895
15243
  useEffect20(() => {
14896
15244
  if (disabled) {
14897
15245
  eventTarget.dispatchEvent(new Event("disabled"));
@@ -15038,7 +15386,7 @@ var getAngle = (ref, coordinates) => {
15038
15386
  };
15039
15387
  var lastCoordinates = null;
15040
15388
  var useMousePosition = (ref) => {
15041
- const [angle, setAngle] = useState23(getAngle(ref.current, lastCoordinates));
15389
+ const [angle, setAngle] = useState21(getAngle(ref.current, lastCoordinates));
15042
15390
  useEffect20(() => {
15043
15391
  const element = ref.current;
15044
15392
  if (!element) {
@@ -15159,7 +15507,7 @@ var Spinner = ({ size, duration }) => {
15159
15507
  height: size
15160
15508
  };
15161
15509
  }, [size]);
15162
- const pathsRef = useRef25([]);
15510
+ const pathsRef = useRef26([]);
15163
15511
  useEffect22(() => {
15164
15512
  const animate = () => {
15165
15513
  const now = performance.now();
@@ -15205,9 +15553,9 @@ var Button = ({
15205
15553
  ...rest
15206
15554
  }) => {
15207
15555
  const [dimensions, setDimensions] = useState22(null);
15208
- const ref = useRef24(null);
15556
+ const ref = useRef25(null);
15209
15557
  const { isActive, progress } = useHoverTransforms(ref, Boolean(disabled || loading));
15210
- const onPointerEnter = useCallback22((e) => {
15558
+ const onPointerEnter = useCallback24((e) => {
15211
15559
  if (e.pointerType !== "mouse") {
15212
15560
  return;
15213
15561
  }
@@ -15244,7 +15592,7 @@ var Button = ({
15244
15592
  const isDisabled = disabled || loading;
15245
15593
  const isAnchor = !asChild && "href" in rest && rest.href !== undefined;
15246
15594
  const sharedClasses = cn("text-text", "inline-flex", "justify-center", "bg-button-bg", "items-center", "font-brand", "border-solid", "text-[1em]", "rounded-lg", "border-black", "border-2", "border-b-4", "cursor-pointer", "px-4", "h-12", "flex-row", "items-center", "relative", "overflow-hidden", isDisabled && "cursor-default opacity-50", className);
15247
- const preventInteraction = useCallback22((e) => {
15595
+ const preventInteraction = useCallback24((e) => {
15248
15596
  e.preventDefault();
15249
15597
  e.stopPropagation();
15250
15598
  }, []);
@@ -15553,43 +15901,43 @@ function composeRefs2(...refs) {
15553
15901
  function useComposedRefs2(...refs) {
15554
15902
  return React9.useCallback(composeRefs2(...refs), refs);
15555
15903
  }
15556
- var Slot2 = React102.forwardRef((props, forwardedRef) => {
15904
+ var Slot2 = React10.forwardRef((props, forwardedRef) => {
15557
15905
  const { children, ...slotProps } = props;
15558
- const childrenArray = React102.Children.toArray(children);
15906
+ const childrenArray = React10.Children.toArray(children);
15559
15907
  const slottable = childrenArray.find(isSlottable2);
15560
15908
  if (slottable) {
15561
15909
  const newElement = slottable.props.children;
15562
15910
  const newChildren = childrenArray.map((child) => {
15563
15911
  if (child === slottable) {
15564
- if (React102.Children.count(newElement) > 1)
15565
- return React102.Children.only(null);
15566
- return React102.isValidElement(newElement) ? newElement.props.children : null;
15912
+ if (React10.Children.count(newElement) > 1)
15913
+ return React10.Children.only(null);
15914
+ return React10.isValidElement(newElement) ? newElement.props.children : null;
15567
15915
  } else {
15568
15916
  return child;
15569
15917
  }
15570
15918
  });
15571
- return /* @__PURE__ */ jsx142(SlotClone, { ...slotProps, ref: forwardedRef, children: React102.isValidElement(newElement) ? React102.cloneElement(newElement, undefined, newChildren) : null });
15919
+ return /* @__PURE__ */ jsx142(SlotClone, { ...slotProps, ref: forwardedRef, children: React10.isValidElement(newElement) ? React10.cloneElement(newElement, undefined, newChildren) : null });
15572
15920
  }
15573
15921
  return /* @__PURE__ */ jsx142(SlotClone, { ...slotProps, ref: forwardedRef, children });
15574
15922
  });
15575
15923
  Slot2.displayName = "Slot";
15576
- var SlotClone = React102.forwardRef((props, forwardedRef) => {
15924
+ var SlotClone = React10.forwardRef((props, forwardedRef) => {
15577
15925
  const { children, ...slotProps } = props;
15578
- if (React102.isValidElement(children)) {
15926
+ if (React10.isValidElement(children)) {
15579
15927
  const childrenRef = getElementRef2(children);
15580
- return React102.cloneElement(children, {
15928
+ return React10.cloneElement(children, {
15581
15929
  ...mergeProps2(slotProps, children.props),
15582
15930
  ref: forwardedRef ? composeRefs2(forwardedRef, childrenRef) : childrenRef
15583
15931
  });
15584
15932
  }
15585
- return React102.Children.count(children) > 1 ? React102.Children.only(null) : null;
15933
+ return React10.Children.count(children) > 1 ? React10.Children.only(null) : null;
15586
15934
  });
15587
15935
  SlotClone.displayName = "SlotClone";
15588
15936
  var Slottable2 = ({ children }) => {
15589
15937
  return /* @__PURE__ */ jsx142(Fragment5, { children });
15590
15938
  };
15591
15939
  function isSlottable2(child) {
15592
- return React102.isValidElement(child) && child.type === Slottable2;
15940
+ return React10.isValidElement(child) && child.type === Slottable2;
15593
15941
  }
15594
15942
  function mergeProps2(slotProps, childProps) {
15595
15943
  const overrideProps = { ...childProps };
@@ -15633,13 +15981,13 @@ function createCollection(name) {
15633
15981
  const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map });
15634
15982
  const CollectionProvider = (props) => {
15635
15983
  const { scope, children } = props;
15636
- const ref = React11.useRef(null);
15637
- const itemMap = React11.useRef(/* @__PURE__ */ new Map).current;
15984
+ const ref = React112.useRef(null);
15985
+ const itemMap = React112.useRef(/* @__PURE__ */ new Map).current;
15638
15986
  return /* @__PURE__ */ jsx152(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
15639
15987
  };
15640
15988
  CollectionProvider.displayName = PROVIDER_NAME;
15641
15989
  const COLLECTION_SLOT_NAME = name + "CollectionSlot";
15642
- const CollectionSlot = React11.forwardRef((props, forwardedRef) => {
15990
+ const CollectionSlot = React112.forwardRef((props, forwardedRef) => {
15643
15991
  const { scope, children } = props;
15644
15992
  const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
15645
15993
  const composedRefs = useComposedRefs2(forwardedRef, context.collectionRef);
@@ -15648,12 +15996,12 @@ function createCollection(name) {
15648
15996
  CollectionSlot.displayName = COLLECTION_SLOT_NAME;
15649
15997
  const ITEM_SLOT_NAME = name + "CollectionItemSlot";
15650
15998
  const ITEM_DATA_ATTR = "data-radix-collection-item";
15651
- const CollectionItemSlot = React11.forwardRef((props, forwardedRef) => {
15999
+ const CollectionItemSlot = React112.forwardRef((props, forwardedRef) => {
15652
16000
  const { scope, children, ...itemData } = props;
15653
- const ref = React11.useRef(null);
16001
+ const ref = React112.useRef(null);
15654
16002
  const composedRefs = useComposedRefs2(forwardedRef, ref);
15655
16003
  const context = useCollectionContext(ITEM_SLOT_NAME, scope);
15656
- React11.useEffect(() => {
16004
+ React112.useEffect(() => {
15657
16005
  context.itemMap.set(ref, { ref, ...itemData });
15658
16006
  return () => void context.itemMap.delete(ref);
15659
16007
  });
@@ -15662,7 +16010,7 @@ function createCollection(name) {
15662
16010
  CollectionItemSlot.displayName = ITEM_SLOT_NAME;
15663
16011
  function useCollection(scope) {
15664
16012
  const context = useCollectionContext(name + "CollectionConsumer", scope);
15665
- const getItems = React11.useCallback(() => {
16013
+ const getItems = React112.useCallback(() => {
15666
16014
  const collectionNode = context.collectionRef.current;
15667
16015
  if (!collectionNode)
15668
16016
  return [];
@@ -15679,9 +16027,9 @@ function createCollection(name) {
15679
16027
  createCollectionScope
15680
16028
  ];
15681
16029
  }
15682
- var DirectionContext = React12.createContext(undefined);
16030
+ var DirectionContext = React122.createContext(undefined);
15683
16031
  function useDirection(localDir) {
15684
- const globalDir = React12.useContext(DirectionContext);
16032
+ const globalDir = React122.useContext(DirectionContext);
15685
16033
  return localDir || globalDir || "ltr";
15686
16034
  }
15687
16035
  var NODES = [
@@ -15703,7 +16051,7 @@ var NODES = [
15703
16051
  "ul"
15704
16052
  ];
15705
16053
  var Primitive = NODES.reduce((primitive, node) => {
15706
- const Node2 = React132.forwardRef((props, forwardedRef) => {
16054
+ const Node2 = React13.forwardRef((props, forwardedRef) => {
15707
16055
  const { asChild, ...primitiveProps } = props;
15708
16056
  const Comp = asChild ? Slot2 : node;
15709
16057
  if (typeof window !== "undefined") {
@@ -15719,15 +16067,15 @@ function dispatchDiscreteCustomEvent(target, event) {
15719
16067
  ReactDOM.flushSync(() => target.dispatchEvent(event));
15720
16068
  }
15721
16069
  function useCallbackRef(callback) {
15722
- const callbackRef = React14.useRef(callback);
15723
- React14.useEffect(() => {
16070
+ const callbackRef = React142.useRef(callback);
16071
+ React142.useEffect(() => {
15724
16072
  callbackRef.current = callback;
15725
16073
  });
15726
- return React14.useMemo(() => (...args) => callbackRef.current?.(...args), []);
16074
+ return React142.useMemo(() => (...args) => callbackRef.current?.(...args), []);
15727
16075
  }
15728
16076
  function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
15729
16077
  const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
15730
- React152.useEffect(() => {
16078
+ React15.useEffect(() => {
15731
16079
  const handleKeyDown = (event) => {
15732
16080
  if (event.key === "Escape") {
15733
16081
  onEscapeKeyDown(event);
@@ -21338,10 +21686,10 @@ var Triangle2 = (props) => {
21338
21686
  };
21339
21687
 
21340
21688
  // src/components/design.tsx
21341
- import { useCallback as useCallback34, useState as useState41 } from "react";
21689
+ import { useCallback as useCallback35, useState as useState39 } from "react";
21342
21690
 
21343
21691
  // src/components/ManageTeamMembers.tsx
21344
- import React53, { useCallback as useCallback33, useState as useState40 } from "react";
21692
+ import React53, { useCallback as useCallback34, useState as useState38 } from "react";
21345
21693
  import { jsx as jsx40, jsxs as jsxs6, Fragment as Fragment9 } from "react/jsx-runtime";
21346
21694
  function generateId() {
21347
21695
  return Math.random().toString(36).substr(2, 9);
@@ -21385,9 +21733,9 @@ var Row = ({ value, onChange, onDelete, disableDelete }) => {
21385
21733
  });
21386
21734
  };
21387
21735
  var ManageTeamMembers = () => {
21388
- const [members, setMembers] = useState40(initialMembers);
21736
+ const [members, setMembers] = useState38(initialMembers);
21389
21737
  const displayedMembers = [...members, { id: "NEW", name: "" }];
21390
- const updateMember = useCallback33((idx, value) => {
21738
+ const updateMember = useCallback34((idx, value) => {
21391
21739
  if (idx === members.length) {
21392
21740
  if (value.trim() !== "") {
21393
21741
  setMembers((prev) => [...prev, { id: generateId(), name: value }]);
@@ -21396,11 +21744,11 @@ var ManageTeamMembers = () => {
21396
21744
  setMembers((prev) => prev.map((m, i) => i === idx ? { ...m, name: value } : m));
21397
21745
  }
21398
21746
  }, [members.length]);
21399
- const deleteMember = useCallback33((idx) => {
21747
+ const deleteMember = useCallback34((idx) => {
21400
21748
  setMembers((prev) => prev.filter((_, i) => i !== idx));
21401
21749
  }, []);
21402
- const [loading, setLoading] = useState40(false);
21403
- const save = useCallback33(() => {
21750
+ const [loading, setLoading] = useState38(false);
21751
+ const save = useCallback34(() => {
21404
21752
  setLoading(true);
21405
21753
  setTimeout(() => {
21406
21754
  setLoading(false);
@@ -21455,24 +21803,24 @@ var Explainer = ({ children }) => {
21455
21803
  });
21456
21804
  };
21457
21805
  var DesignPage = () => {
21458
- const [count4, setCount] = useState41(10);
21459
- const [active, setActive] = useState41(false);
21460
- const [submitButtonActive, setSubmitButtonActive] = useState41(true);
21461
- const [submitButtonPrimaryActive, setSubmitButtonPrimaryActive] = useState41(true);
21462
- const onClick = useCallback34(() => {
21806
+ const [count4, setCount] = useState39(10);
21807
+ const [active, setActive] = useState39(false);
21808
+ const [submitButtonActive, setSubmitButtonActive] = useState39(true);
21809
+ const [submitButtonPrimaryActive, setSubmitButtonPrimaryActive] = useState39(true);
21810
+ const onClick = useCallback35(() => {
21463
21811
  setSubmitButtonActive(false);
21464
21812
  setTimeout(() => {
21465
21813
  setSubmitButtonActive(true);
21466
21814
  }, 1000);
21467
21815
  }, []);
21468
- const onClickPrimary = useCallback34(() => {
21816
+ const onClickPrimary = useCallback35(() => {
21469
21817
  setSubmitButtonPrimaryActive(false);
21470
21818
  setTimeout(() => {
21471
21819
  setSubmitButtonPrimaryActive(true);
21472
21820
  }, 1000);
21473
21821
  }, []);
21474
- const [saving, setSaving] = useState41(false);
21475
- const save = useCallback34(() => {
21822
+ const [saving, setSaving] = useState39(false);
21823
+ const save = useCallback35(() => {
21476
21824
  setSaving(true);
21477
21825
  setTimeout(() => {
21478
21826
  setSaving(false);