remotion 4.0.147 → 4.0.149

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.
@@ -1,789 +1,733 @@
1
- // Taken from https://github.com/facebook/react-native/blob/0b9ea60b4fee8cacc36e7160e31b91fc114dbc0d/Libraries/Animated/src/nodes/AnimatedInterpolation.js
2
- function interpolateFunction(input, inputRange, outputRange, options) {
3
- const { extrapolateLeft, extrapolateRight, easing } = options;
4
- let result = input;
5
- const [inputMin, inputMax] = inputRange;
6
- const [outputMin, outputMax] = outputRange;
7
- if (result < inputMin) {
8
- if (extrapolateLeft === 'identity') {
9
- return result;
10
- }
11
- if (extrapolateLeft === 'clamp') {
12
- result = inputMin;
13
- }
14
- else if (extrapolateLeft === 'wrap') {
15
- const range = inputMax - inputMin;
16
- result = ((((result - inputMin) % range) + range) % range) + inputMin;
17
- }
18
- else ;
19
- }
20
- if (result > inputMax) {
21
- if (extrapolateRight === 'identity') {
22
- return result;
23
- }
24
- if (extrapolateRight === 'clamp') {
25
- result = inputMax;
26
- }
27
- else if (extrapolateRight === 'wrap') {
28
- const range = inputMax - inputMin;
29
- result = ((((result - inputMin) % range) + range) % range) + inputMin;
30
- }
31
- else ;
32
- }
33
- if (outputMin === outputMax) {
34
- return outputMin;
35
- }
36
- // Input Range
37
- result = (result - inputMin) / (inputMax - inputMin);
38
- // Easing
39
- result = easing(result);
40
- // Output Range
41
- result = result * (outputMax - outputMin) + outputMin;
42
- return result;
43
- }
44
- function findRange(input, inputRange) {
45
- let i;
46
- for (i = 1; i < inputRange.length - 1; ++i) {
47
- if (inputRange[i] >= input) {
48
- break;
49
- }
50
- }
51
- return i - 1;
52
- }
53
- function checkValidInputRange(arr) {
54
- for (let i = 1; i < arr.length; ++i) {
55
- if (!(arr[i] > arr[i - 1])) {
56
- throw new Error(`inputRange must be strictly monotonically increasing but got [${arr.join(',')}]`);
57
- }
58
- }
59
- }
60
- function checkInfiniteRange(name, arr) {
61
- if (arr.length < 2) {
62
- throw new Error(name + ' must have at least 2 elements');
63
- }
64
- for (const index in arr) {
65
- if (typeof arr[index] !== 'number') {
66
- throw new Error(`${name} must contain only numbers`);
67
- }
68
- if (arr[index] === -Infinity || arr[index] === Infinity) {
69
- throw new Error(`${name} must contain only finite numbers, but got [${arr.join(',')}]`);
70
- }
1
+ // src/interpolate.ts
2
+ var interpolateFunction = function(input, inputRange, outputRange, options) {
3
+ const { extrapolateLeft, extrapolateRight, easing } = options;
4
+ let result = input;
5
+ const [inputMin, inputMax] = inputRange;
6
+ const [outputMin, outputMax] = outputRange;
7
+ if (result < inputMin) {
8
+ if (extrapolateLeft === "identity") {
9
+ return result;
10
+ }
11
+ if (extrapolateLeft === "clamp") {
12
+ result = inputMin;
13
+ } else if (extrapolateLeft === "wrap") {
14
+ const range = inputMax - inputMin;
15
+ result = ((result - inputMin) % range + range) % range + inputMin;
16
+ } else if (extrapolateLeft === "extend") {
17
+ }
18
+ }
19
+ if (result > inputMax) {
20
+ if (extrapolateRight === "identity") {
21
+ return result;
22
+ }
23
+ if (extrapolateRight === "clamp") {
24
+ result = inputMax;
25
+ } else if (extrapolateRight === "wrap") {
26
+ const range = inputMax - inputMin;
27
+ result = ((result - inputMin) % range + range) % range + inputMin;
28
+ } else if (extrapolateRight === "extend") {
29
+ }
30
+ }
31
+ if (outputMin === outputMax) {
32
+ return outputMin;
33
+ }
34
+ result = (result - inputMin) / (inputMax - inputMin);
35
+ result = easing(result);
36
+ result = result * (outputMax - outputMin) + outputMin;
37
+ return result;
38
+ };
39
+ var findRange = function(input, inputRange) {
40
+ let i;
41
+ for (i = 1;i < inputRange.length - 1; ++i) {
42
+ if (inputRange[i] >= input) {
43
+ break;
44
+ }
45
+ }
46
+ return i - 1;
47
+ };
48
+ var checkValidInputRange = function(arr) {
49
+ for (let i = 1;i < arr.length; ++i) {
50
+ if (!(arr[i] > arr[i - 1])) {
51
+ throw new Error(`inputRange must be strictly monotonically increasing but got [${arr.join(",")}]`);
71
52
  }
72
- }
73
- /**
74
- * Map a value from an input range to an output range.
75
- * @link https://www.remotion.dev/docs/interpolate
76
- * @param {!number} input value to interpolate
77
- * @param {!number[]} inputRange range of values that you expect the input to assume.
78
- * @param {!number[]} outputRange range of output values that you want the input to map to.
79
- * @param {?object} options
80
- * @param {?Function} options.easing easing function which allows you to customize the input, for example to apply a certain easing function. By default, the input is left unmodified, resulting in a pure linear interpolation {@link https://www.remotion.dev/docs/easing}
81
- * @param {string=} [options.extrapolateLeft="extend"] What should happen if the input value is outside left the input range, default: "extend" {@link https://www.remotion.dev/docs/interpolate#extrapolateleft}
82
- * @param {string=} [options.extrapolateRight="extend"] Same as extrapolateLeft, except for values outside right the input range {@link https://www.remotion.dev/docs/interpolate#extrapolateright}
83
- */
53
+ }
54
+ };
55
+ var checkInfiniteRange = function(name, arr) {
56
+ if (arr.length < 2) {
57
+ throw new Error(name + " must have at least 2 elements");
58
+ }
59
+ for (const index in arr) {
60
+ if (typeof arr[index] !== "number") {
61
+ throw new Error(`${name} must contain only numbers`);
62
+ }
63
+ if (arr[index] === (-Infinity) || arr[index] === Infinity) {
64
+ throw new Error(`${name} must contain only finite numbers, but got [${arr.join(",")}]`);
65
+ }
66
+ }
67
+ };
84
68
  function interpolate(input, inputRange, outputRange, options) {
85
- var _a;
86
- if (typeof input === 'undefined') {
87
- throw new Error('input can not be undefined');
88
- }
89
- if (typeof inputRange === 'undefined') {
90
- throw new Error('inputRange can not be undefined');
91
- }
92
- if (typeof outputRange === 'undefined') {
93
- throw new Error('outputRange can not be undefined');
94
- }
95
- if (inputRange.length !== outputRange.length) {
96
- throw new Error('inputRange (' +
97
- inputRange.length +
98
- ') and outputRange (' +
99
- outputRange.length +
100
- ') must have the same length');
101
- }
102
- checkInfiniteRange('inputRange', inputRange);
103
- checkInfiniteRange('outputRange', outputRange);
104
- checkValidInputRange(inputRange);
105
- const easing = (_a = options === null || options === void 0 ? void 0 : options.easing) !== null && _a !== void 0 ? _a : ((num) => num);
106
- let extrapolateLeft = 'extend';
107
- if ((options === null || options === void 0 ? void 0 : options.extrapolateLeft) !== undefined) {
108
- extrapolateLeft = options.extrapolateLeft;
109
- }
110
- let extrapolateRight = 'extend';
111
- if ((options === null || options === void 0 ? void 0 : options.extrapolateRight) !== undefined) {
112
- extrapolateRight = options.extrapolateRight;
113
- }
114
- if (typeof input !== 'number') {
115
- throw new TypeError('Cannot interpolate an input which is not a number');
116
- }
117
- const range = findRange(input, inputRange);
118
- return interpolateFunction(input, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
119
- easing,
120
- extrapolateLeft,
121
- extrapolateRight,
122
- });
123
- }
124
-
125
- /* eslint-disable no-bitwise */
126
- function mulberry32(a) {
127
- let t = a + 0x6d2b79f5;
128
- t = Math.imul(t ^ (t >>> 15), t | 1);
129
- t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
130
- return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
131
- }
132
- function hashCode(str) {
133
- let i = 0;
134
- let chr = 0;
135
- let hash = 0;
136
- for (i = 0; i < str.length; i++) {
137
- chr = str.charCodeAt(i);
138
- hash = (hash << 5) - hash + chr;
139
- hash |= 0; // Convert to 32bit integer
140
- }
141
- return hash;
69
+ if (typeof input === "undefined") {
70
+ throw new Error("input can not be undefined");
71
+ }
72
+ if (typeof inputRange === "undefined") {
73
+ throw new Error("inputRange can not be undefined");
74
+ }
75
+ if (typeof outputRange === "undefined") {
76
+ throw new Error("outputRange can not be undefined");
77
+ }
78
+ if (inputRange.length !== outputRange.length) {
79
+ throw new Error("inputRange (" + inputRange.length + ") and outputRange (" + outputRange.length + ") must have the same length");
80
+ }
81
+ checkInfiniteRange("inputRange", inputRange);
82
+ checkInfiniteRange("outputRange", outputRange);
83
+ checkValidInputRange(inputRange);
84
+ const easing = options?.easing ?? ((num) => num);
85
+ let extrapolateLeft = "extend";
86
+ if (options?.extrapolateLeft !== undefined) {
87
+ extrapolateLeft = options.extrapolateLeft;
88
+ }
89
+ let extrapolateRight = "extend";
90
+ if (options?.extrapolateRight !== undefined) {
91
+ extrapolateRight = options.extrapolateRight;
92
+ }
93
+ if (typeof input !== "number") {
94
+ throw new TypeError("Cannot interpolate an input which is not a number");
95
+ }
96
+ const range = findRange(input, inputRange);
97
+ return interpolateFunction(input, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
98
+ easing,
99
+ extrapolateLeft,
100
+ extrapolateRight
101
+ });
142
102
  }
143
- /**
144
- * @description A deterministic pseudo-random number generator. Pass in the same seed and get the same pseudorandom number.
145
- * @see [Documentation](https://remotion.dev/docs/random)
146
- */
147
- const random = (seed, dummy) => {
148
- if (dummy !== undefined) {
149
- throw new TypeError('random() takes only one argument');
150
- }
151
- if (seed === null) {
152
- return Math.random();
153
- }
154
- if (typeof seed === 'string') {
155
- return mulberry32(hashCode(seed));
156
- }
157
- if (typeof seed === 'number') {
158
- return mulberry32(seed * 10000000000);
159
- }
160
- throw new Error('random() argument must be a number or a string');
103
+ // src/random.ts
104
+ var mulberry32 = function(a) {
105
+ let t = a + 1831565813;
106
+ t = Math.imul(t ^ t >>> 15, t | 1);
107
+ t ^= t + Math.imul(t ^ t >>> 7, t | 61);
108
+ return ((t ^ t >>> 14) >>> 0) / 4294967296;
161
109
  };
162
-
110
+ var hashCode = function(str) {
111
+ let i = 0;
112
+ let chr = 0;
113
+ let hash = 0;
114
+ for (i = 0;i < str.length; i++) {
115
+ chr = str.charCodeAt(i);
116
+ hash = (hash << 5) - hash + chr;
117
+ hash |= 0;
118
+ }
119
+ return hash;
120
+ };
121
+ var random = (seed, dummy) => {
122
+ if (dummy !== undefined) {
123
+ throw new TypeError("random() takes only one argument");
124
+ }
125
+ if (seed === null) {
126
+ return Math.random();
127
+ }
128
+ if (typeof seed === "string") {
129
+ return mulberry32(hashCode(seed));
130
+ }
131
+ if (typeof seed === "number") {
132
+ return mulberry32(seed * 10000000000);
133
+ }
134
+ throw new Error("random() argument must be a number or a string");
135
+ };
136
+ // src/truthy.ts
163
137
  function truthy(value) {
164
- return Boolean(value);
138
+ return Boolean(value);
165
139
  }
166
140
 
167
- if (typeof window !== 'undefined') {
168
- window.remotion_renderReady = false;
141
+ // src/delay-render.ts
142
+ if (typeof window !== "undefined") {
143
+ window.remotion_renderReady = false;
169
144
  }
170
- if (typeof window !== 'undefined') {
171
- window.remotion_delayRenderTimeouts = {};
145
+ if (typeof window !== "undefined") {
146
+ window.remotion_delayRenderTimeouts = {};
172
147
  }
173
- const DELAY_RENDER_CALLSTACK_TOKEN = 'The delayRender was called:';
174
- const DELAY_RENDER_RETRIES_LEFT = 'Retries left: ';
175
- const DELAY_RENDER_RETRY_TOKEN = '- Rendering the frame will be retried.';
148
+ var DELAY_RENDER_CALLSTACK_TOKEN = "The delayRender was called:";
149
+ var DELAY_RENDER_RETRIES_LEFT = "Retries left: ";
150
+ var DELAY_RENDER_RETRY_TOKEN = "- Rendering the frame will be retried.";
176
151
 
177
- const problematicCharacters = {
178
- '%3A': ':',
179
- '%2F': '/',
180
- '%3F': '?',
181
- '%23': '#',
182
- '%5B': '[',
183
- '%5D': ']',
184
- '%40': '@',
185
- '%21': '!',
186
- '%24': '$',
187
- '%26': '&',
188
- '%27': "'",
189
- '%28': '(',
190
- '%29': ')',
191
- '%2A': '*',
192
- '%2B': '+',
193
- '%2C': ',',
194
- '%3B': ';',
195
- };
196
- const didWarn = {};
197
- const warnOnce = (message) => {
198
- if (didWarn[message]) {
199
- return;
200
- }
201
- // eslint-disable-next-line no-console
202
- console.warn(message);
203
- didWarn[message] = true;
204
- };
205
- const includesHexOfUnsafeChar = (path) => {
206
- for (const key of Object.keys(problematicCharacters)) {
207
- if (path.includes(key)) {
208
- return { containsHex: true, hexCode: key };
209
- }
210
- }
211
- return { containsHex: false };
152
+ // src/static-file.ts
153
+ var problematicCharacters = {
154
+ "%3A": ":",
155
+ "%2F": "/",
156
+ "%3F": "?",
157
+ "%23": "#",
158
+ "%5B": "[",
159
+ "%5D": "]",
160
+ "%40": "@",
161
+ "%21": "!",
162
+ "%24": "$",
163
+ "%26": "&",
164
+ "%27": "'",
165
+ "%28": "(",
166
+ "%29": ")",
167
+ "%2A": "*",
168
+ "%2B": "+",
169
+ "%2C": ",",
170
+ "%3B": ";"
212
171
  };
213
- const trimLeadingSlash = (path) => {
214
- if (path.startsWith('/')) {
215
- return trimLeadingSlash(path.substring(1));
216
- }
217
- return path;
218
- };
219
- const inner = (path) => {
220
- if (typeof window !== 'undefined' && window.remotion_staticBase) {
221
- if (path.startsWith(window.remotion_staticBase)) {
222
- throw new Error(`The value "${path}" is already prefixed with the static base ${window.remotion_staticBase}. You don't need to call staticFile() on it.`);
223
- }
224
- return `${window.remotion_staticBase}/${trimLeadingSlash(path)}`;
225
- }
226
- return `/${trimLeadingSlash(path)}`;
227
- };
228
- const encodeBySplitting = (path) => {
229
- const splitBySlash = path.split('/');
230
- const encodedArray = splitBySlash.map((element) => {
231
- return encodeURIComponent(element);
232
- });
233
- const merged = encodedArray.join('/');
234
- return merged;
235
- };
236
- /**
237
- * @description Reference a file from the public/ folder. If the file does not appear in the autocomplete, type the path manually.
238
- * @see [Documentation](https://www.remotion.dev/docs/staticfile)
239
- */
240
- const staticFile = (path) => {
241
- if (path.startsWith('http://') || path.startsWith('https://')) {
242
- throw new TypeError(`staticFile() does not support remote URLs - got "${path}". Instead, pass the URL without wrapping it in staticFile(). See: https://remotion.dev/docs/staticfile-remote-urls`);
243
- }
244
- if (path.startsWith('..') || path.startsWith('./')) {
245
- throw new TypeError(`staticFile() does not support relative paths - got "${path}". Instead, pass the name of a file that is inside the public/ folder. See: https://remotion.dev/docs/staticfile-relative-paths`);
246
- }
247
- if (path.startsWith('/Users') ||
248
- path.startsWith('/home') ||
249
- path.startsWith('/tmp') ||
250
- path.startsWith('/etc') ||
251
- path.startsWith('/opt') ||
252
- path.startsWith('/var') ||
253
- path.startsWith('C:') ||
254
- path.startsWith('D:') ||
255
- path.startsWith('E:')) {
256
- throw new TypeError(`staticFile() does not support absolute paths - got "${path}". Instead, pass the name of a file that is inside the public/ folder. See: https://remotion.dev/docs/staticfile-relative-paths`);
257
- }
258
- if (path.startsWith('public/')) {
259
- throw new TypeError(`Do not include the public/ prefix when using staticFile() - got "${path}". See: https://remotion.dev/docs/staticfile-relative-paths`);
260
- }
261
- const includesHex = includesHexOfUnsafeChar(path);
262
- if (includesHex.containsHex) {
263
- warnOnce(`WARNING: You seem to pass an already encoded path (path contains ${includesHex.hexCode}). Since Remotion 4.0, the encoding is done by staticFile() itself. You may want to remove a encodeURIComponent() wrapping.`);
264
- }
265
- const preprocessed = encodeBySplitting(path);
266
- const preparsed = inner(preprocessed);
267
- if (!preparsed.startsWith('/')) {
268
- return `/${preparsed}`;
172
+ var didWarn = {};
173
+ var warnOnce = (message) => {
174
+ if (didWarn[message]) {
175
+ return;
176
+ }
177
+ console.warn(message);
178
+ didWarn[message] = true;
179
+ };
180
+ var includesHexOfUnsafeChar = (path) => {
181
+ for (const key of Object.keys(problematicCharacters)) {
182
+ if (path.includes(key)) {
183
+ return { containsHex: true, hexCode: key };
269
184
  }
270
- return preparsed;
185
+ }
186
+ return { containsHex: false };
271
187
  };
272
-
273
- // Must keep this file in sync with the one in packages/lambda/src/shared/serialize-props.ts!
274
- const DATE_TOKEN = 'remotion-date:';
275
- const FILE_TOKEN = 'remotion-file:';
276
- const serializeJSONWithDate = ({ data, indent, staticBase, }) => {
277
- let customDateUsed = false;
278
- let customFileUsed = false;
279
- let mapUsed = false;
280
- let setUsed = false;
281
- const serializedString = JSON.stringify(data, function (key, value) {
282
- const item = this[key];
283
- if (item instanceof Date) {
284
- customDateUsed = true;
285
- return `${DATE_TOKEN}${item.toISOString()}`;
286
- }
287
- if (item instanceof Map) {
288
- mapUsed = true;
289
- return value;
290
- }
291
- if (item instanceof Set) {
292
- setUsed = true;
293
- return value;
294
- }
295
- if (typeof item === 'string' &&
296
- staticBase !== null &&
297
- item.startsWith(staticBase)) {
298
- customFileUsed = true;
299
- return `${FILE_TOKEN}${item.replace(staticBase + '/', '')}`;
300
- }
301
- return value;
302
- }, indent);
303
- return { serializedString, customDateUsed, customFileUsed, mapUsed, setUsed };
304
- };
305
- const deserializeJSONWithCustomFields = (data) => {
306
- return JSON.parse(data, (_, value) => {
307
- if (typeof value === 'string' && value.startsWith(DATE_TOKEN)) {
308
- return new Date(value.replace(DATE_TOKEN, ''));
309
- }
310
- if (typeof value === 'string' && value.startsWith(FILE_TOKEN)) {
311
- return staticFile(value.replace(FILE_TOKEN, ''));
312
- }
313
- return value;
314
- });
188
+ var trimLeadingSlash = (path) => {
189
+ if (path.startsWith("/")) {
190
+ return trimLeadingSlash(path.substring(1));
191
+ }
192
+ return path;
193
+ };
194
+ var inner = (path) => {
195
+ if (typeof window !== "undefined" && window.remotion_staticBase) {
196
+ if (path.startsWith(window.remotion_staticBase)) {
197
+ throw new Error(`The value "${path}" is already prefixed with the static base ${window.remotion_staticBase}. You don't need to call staticFile() on it.`);
198
+ }
199
+ return `${window.remotion_staticBase}/${trimLeadingSlash(path)}`;
200
+ }
201
+ return `/${trimLeadingSlash(path)}`;
202
+ };
203
+ var encodeBySplitting = (path) => {
204
+ const splitBySlash = path.split("/");
205
+ const encodedArray = splitBySlash.map((element) => {
206
+ return encodeURIComponent(element);
207
+ });
208
+ const merged = encodedArray.join("/");
209
+ return merged;
210
+ };
211
+ var staticFile = (path) => {
212
+ if (path.startsWith("http://") || path.startsWith("https://")) {
213
+ throw new TypeError(`staticFile() does not support remote URLs - got "${path}". Instead, pass the URL without wrapping it in staticFile(). See: https://remotion.dev/docs/staticfile-remote-urls`);
214
+ }
215
+ if (path.startsWith("..") || path.startsWith("./")) {
216
+ throw new TypeError(`staticFile() does not support relative paths - got "${path}". Instead, pass the name of a file that is inside the public/ folder. See: https://remotion.dev/docs/staticfile-relative-paths`);
217
+ }
218
+ if (path.startsWith("/Users") || path.startsWith("/home") || path.startsWith("/tmp") || path.startsWith("/etc") || path.startsWith("/opt") || path.startsWith("/var") || path.startsWith("C:") || path.startsWith("D:") || path.startsWith("E:")) {
219
+ throw new TypeError(`staticFile() does not support absolute paths - got "${path}". Instead, pass the name of a file that is inside the public/ folder. See: https://remotion.dev/docs/staticfile-relative-paths`);
220
+ }
221
+ if (path.startsWith("public/")) {
222
+ throw new TypeError(`Do not include the public/ prefix when using staticFile() - got "${path}". See: https://remotion.dev/docs/staticfile-relative-paths`);
223
+ }
224
+ const includesHex = includesHexOfUnsafeChar(path);
225
+ if (includesHex.containsHex) {
226
+ warnOnce(`WARNING: You seem to pass an already encoded path (path contains ${includesHex.hexCode}). Since Remotion 4.0, the encoding is done by staticFile() itself. You may want to remove a encodeURIComponent() wrapping.`);
227
+ }
228
+ const preprocessed = encodeBySplitting(path);
229
+ const preparsed = inner(preprocessed);
230
+ if (!preparsed.startsWith("/")) {
231
+ return `/${preparsed}`;
232
+ }
233
+ return preparsed;
315
234
  };
316
235
 
317
- /**
318
- * Copied from:
319
- * https://github.com/software-mansion/react-native-reanimated/blob/master/src/reanimated2/Colors.ts
320
- */
321
- // var INTEGER = '[-+]?\\d+';
322
- const NUMBER = '[-+]?\\d*\\.?\\d+';
323
- const PERCENTAGE = NUMBER + '%';
324
- function call(...args) {
325
- return '\\(\\s*(' + args.join(')\\s*,\\s*(') + ')\\s*\\)';
326
- }
327
- function getMatchers() {
328
- const cachedMatchers = {
329
- rgb: undefined,
330
- rgba: undefined,
331
- hsl: undefined,
332
- hsla: undefined,
333
- hex3: undefined,
334
- hex4: undefined,
335
- hex5: undefined,
336
- hex6: undefined,
337
- hex8: undefined,
338
- };
339
- if (cachedMatchers.rgb === undefined) {
340
- cachedMatchers.rgb = new RegExp('rgb' + call(NUMBER, NUMBER, NUMBER));
341
- cachedMatchers.rgba = new RegExp('rgba' + call(NUMBER, NUMBER, NUMBER, NUMBER));
342
- cachedMatchers.hsl = new RegExp('hsl' + call(NUMBER, PERCENTAGE, PERCENTAGE));
343
- cachedMatchers.hsla = new RegExp('hsla' + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER));
344
- cachedMatchers.hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
345
- cachedMatchers.hex4 =
346
- /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
347
- cachedMatchers.hex6 = /^#([0-9a-fA-F]{6})$/;
348
- cachedMatchers.hex8 = /^#([0-9a-fA-F]{8})$/;
349
- }
350
- return cachedMatchers;
351
- }
352
- function hue2rgb(p, q, t) {
353
- if (t < 0) {
354
- t += 1;
355
- }
356
- if (t > 1) {
357
- t -= 1;
358
- }
359
- if (t < 1 / 6) {
360
- return p + (q - p) * 6 * t;
361
- }
362
- if (t < 1 / 2) {
363
- return q;
364
- }
365
- if (t < 2 / 3) {
366
- return p + (q - p) * (2 / 3 - t) * 6;
367
- }
368
- return p;
369
- }
370
- function hslToRgb(h, s, l) {
371
- const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
372
- const p = 2 * l - q;
373
- const r = hue2rgb(p, q, h + 1 / 3);
374
- const g = hue2rgb(p, q, h);
375
- const b = hue2rgb(p, q, h - 1 / 3);
376
- return ((Math.round(r * 255) << 24) |
377
- (Math.round(g * 255) << 16) |
378
- (Math.round(b * 255) << 8));
379
- }
380
- function parse255(str) {
381
- const int = Number.parseInt(str, 10);
382
- if (int < 0) {
383
- return 0;
384
- }
385
- if (int > 255) {
386
- return 255;
387
- }
388
- return int;
389
- }
390
- function parse360(str) {
391
- const int = Number.parseFloat(str);
392
- return (((int % 360) + 360) % 360) / 360;
393
- }
394
- function parse1(str) {
395
- const num = Number.parseFloat(str);
396
- if (num < 0) {
397
- return 0;
398
- }
399
- if (num > 1) {
400
- return 255;
401
- }
402
- return Math.round(num * 255);
403
- }
404
- function parsePercentage(str) {
405
- // parseFloat conveniently ignores the final %
406
- const int = Number.parseFloat(str);
407
- if (int < 0) {
408
- return 0;
409
- }
410
- if (int > 100) {
411
- return 1;
412
- }
413
- return int / 100;
414
- }
415
- const colorNames = {
416
- transparent: 0x00000000,
417
- // http://www.w3.org/TR/css3-color/#svg-color
418
- aliceblue: 0xf0f8ffff,
419
- antiquewhite: 0xfaebd7ff,
420
- aqua: 0x00ffffff,
421
- aquamarine: 0x7fffd4ff,
422
- azure: 0xf0ffffff,
423
- beige: 0xf5f5dcff,
424
- bisque: 0xffe4c4ff,
425
- black: 0x000000ff,
426
- blanchedalmond: 0xffebcdff,
427
- blue: 0x0000ffff,
428
- blueviolet: 0x8a2be2ff,
429
- brown: 0xa52a2aff,
430
- burlywood: 0xdeb887ff,
431
- burntsienna: 0xea7e5dff,
432
- cadetblue: 0x5f9ea0ff,
433
- chartreuse: 0x7fff00ff,
434
- chocolate: 0xd2691eff,
435
- coral: 0xff7f50ff,
436
- cornflowerblue: 0x6495edff,
437
- cornsilk: 0xfff8dcff,
438
- crimson: 0xdc143cff,
439
- cyan: 0x00ffffff,
440
- darkblue: 0x00008bff,
441
- darkcyan: 0x008b8bff,
442
- darkgoldenrod: 0xb8860bff,
443
- darkgray: 0xa9a9a9ff,
444
- darkgreen: 0x006400ff,
445
- darkgrey: 0xa9a9a9ff,
446
- darkkhaki: 0xbdb76bff,
447
- darkmagenta: 0x8b008bff,
448
- darkolivegreen: 0x556b2fff,
449
- darkorange: 0xff8c00ff,
450
- darkorchid: 0x9932ccff,
451
- darkred: 0x8b0000ff,
452
- darksalmon: 0xe9967aff,
453
- darkseagreen: 0x8fbc8fff,
454
- darkslateblue: 0x483d8bff,
455
- darkslategray: 0x2f4f4fff,
456
- darkslategrey: 0x2f4f4fff,
457
- darkturquoise: 0x00ced1ff,
458
- darkviolet: 0x9400d3ff,
459
- deeppink: 0xff1493ff,
460
- deepskyblue: 0x00bfffff,
461
- dimgray: 0x696969ff,
462
- dimgrey: 0x696969ff,
463
- dodgerblue: 0x1e90ffff,
464
- firebrick: 0xb22222ff,
465
- floralwhite: 0xfffaf0ff,
466
- forestgreen: 0x228b22ff,
467
- fuchsia: 0xff00ffff,
468
- gainsboro: 0xdcdcdcff,
469
- ghostwhite: 0xf8f8ffff,
470
- gold: 0xffd700ff,
471
- goldenrod: 0xdaa520ff,
472
- gray: 0x808080ff,
473
- green: 0x008000ff,
474
- greenyellow: 0xadff2fff,
475
- grey: 0x808080ff,
476
- honeydew: 0xf0fff0ff,
477
- hotpink: 0xff69b4ff,
478
- indianred: 0xcd5c5cff,
479
- indigo: 0x4b0082ff,
480
- ivory: 0xfffff0ff,
481
- khaki: 0xf0e68cff,
482
- lavender: 0xe6e6faff,
483
- lavenderblush: 0xfff0f5ff,
484
- lawngreen: 0x7cfc00ff,
485
- lemonchiffon: 0xfffacdff,
486
- lightblue: 0xadd8e6ff,
487
- lightcoral: 0xf08080ff,
488
- lightcyan: 0xe0ffffff,
489
- lightgoldenrodyellow: 0xfafad2ff,
490
- lightgray: 0xd3d3d3ff,
491
- lightgreen: 0x90ee90ff,
492
- lightgrey: 0xd3d3d3ff,
493
- lightpink: 0xffb6c1ff,
494
- lightsalmon: 0xffa07aff,
495
- lightseagreen: 0x20b2aaff,
496
- lightskyblue: 0x87cefaff,
497
- lightslategray: 0x778899ff,
498
- lightslategrey: 0x778899ff,
499
- lightsteelblue: 0xb0c4deff,
500
- lightyellow: 0xffffe0ff,
501
- lime: 0x00ff00ff,
502
- limegreen: 0x32cd32ff,
503
- linen: 0xfaf0e6ff,
504
- magenta: 0xff00ffff,
505
- maroon: 0x800000ff,
506
- mediumaquamarine: 0x66cdaaff,
507
- mediumblue: 0x0000cdff,
508
- mediumorchid: 0xba55d3ff,
509
- mediumpurple: 0x9370dbff,
510
- mediumseagreen: 0x3cb371ff,
511
- mediumslateblue: 0x7b68eeff,
512
- mediumspringgreen: 0x00fa9aff,
513
- mediumturquoise: 0x48d1ccff,
514
- mediumvioletred: 0xc71585ff,
515
- midnightblue: 0x191970ff,
516
- mintcream: 0xf5fffaff,
517
- mistyrose: 0xffe4e1ff,
518
- moccasin: 0xffe4b5ff,
519
- navajowhite: 0xffdeadff,
520
- navy: 0x000080ff,
521
- oldlace: 0xfdf5e6ff,
522
- olive: 0x808000ff,
523
- olivedrab: 0x6b8e23ff,
524
- orange: 0xffa500ff,
525
- orangered: 0xff4500ff,
526
- orchid: 0xda70d6ff,
527
- palegoldenrod: 0xeee8aaff,
528
- palegreen: 0x98fb98ff,
529
- paleturquoise: 0xafeeeeff,
530
- palevioletred: 0xdb7093ff,
531
- papayawhip: 0xffefd5ff,
532
- peachpuff: 0xffdab9ff,
533
- peru: 0xcd853fff,
534
- pink: 0xffc0cbff,
535
- plum: 0xdda0ddff,
536
- powderblue: 0xb0e0e6ff,
537
- purple: 0x800080ff,
538
- rebeccapurple: 0x663399ff,
539
- red: 0xff0000ff,
540
- rosybrown: 0xbc8f8fff,
541
- royalblue: 0x4169e1ff,
542
- saddlebrown: 0x8b4513ff,
543
- salmon: 0xfa8072ff,
544
- sandybrown: 0xf4a460ff,
545
- seagreen: 0x2e8b57ff,
546
- seashell: 0xfff5eeff,
547
- sienna: 0xa0522dff,
548
- silver: 0xc0c0c0ff,
549
- skyblue: 0x87ceebff,
550
- slateblue: 0x6a5acdff,
551
- slategray: 0x708090ff,
552
- slategrey: 0x708090ff,
553
- snow: 0xfffafaff,
554
- springgreen: 0x00ff7fff,
555
- steelblue: 0x4682b4ff,
556
- tan: 0xd2b48cff,
557
- teal: 0x008080ff,
558
- thistle: 0xd8bfd8ff,
559
- tomato: 0xff6347ff,
560
- turquoise: 0x40e0d0ff,
561
- violet: 0xee82eeff,
562
- wheat: 0xf5deb3ff,
563
- white: 0xffffffff,
564
- whitesmoke: 0xf5f5f5ff,
565
- yellow: 0xffff00ff,
566
- yellowgreen: 0x9acd32ff,
567
- };
568
- function normalizeColor(color) {
569
- const matchers = getMatchers();
570
- let match;
571
- // Ordered based on occurrences on Facebook codebase
572
- if (matchers.hex6) {
573
- if ((match = matchers.hex6.exec(color))) {
574
- return Number.parseInt(match[1] + 'ff', 16) >>> 0;
575
- }
576
- }
577
- if (colorNames[color] !== undefined) {
578
- return colorNames[color];
579
- }
580
- if (matchers.rgb) {
581
- if ((match = matchers.rgb.exec(color))) {
582
- return (
583
- // b
584
- ((parse255(match[1]) << 24) | // r
585
- (parse255(match[2]) << 16) | // g
586
- (parse255(match[3]) << 8) |
587
- 0x000000ff) >>> // a
588
- 0);
589
- }
590
- }
591
- if (matchers.rgba) {
592
- if ((match = matchers.rgba.exec(color))) {
593
- return (
594
- // b
595
- ((parse255(match[1]) << 24) | // r
596
- (parse255(match[2]) << 16) | // g
597
- (parse255(match[3]) << 8) |
598
- parse1(match[4])) >>> // a
599
- 0);
600
- }
601
- }
602
- if (matchers.hex3) {
603
- if ((match = matchers.hex3.exec(color))) {
604
- return (Number.parseInt(match[1] +
605
- match[1] + // r
606
- match[2] +
607
- match[2] + // g
608
- match[3] +
609
- match[3] + // b
610
- 'ff', // a
611
- 16) >>> 0);
612
- }
613
- }
614
- // https://drafts.csswg.org/css-color-4/#hex-notation
615
- if (matchers.hex8) {
616
- if ((match = matchers.hex8.exec(color))) {
617
- return Number.parseInt(match[1], 16) >>> 0;
618
- }
619
- }
620
- if (matchers.hex4) {
621
- if ((match = matchers.hex4.exec(color))) {
622
- return (Number.parseInt(match[1] +
623
- match[1] + // r
624
- match[2] +
625
- match[2] + // g
626
- match[3] +
627
- match[3] + // b
628
- match[4] +
629
- match[4], // a
630
- 16) >>> 0);
631
- }
632
- }
633
- if (matchers.hsl) {
634
- if ((match = matchers.hsl.exec(color))) {
635
- return ((hslToRgb(parse360(match[1]), // h
636
- parsePercentage(match[2]), // s
637
- parsePercentage(match[3])) |
638
- 0x000000ff) >>> // a
639
- 0);
640
- }
236
+ // src/input-props-serialization.ts
237
+ var DATE_TOKEN = "remotion-date:";
238
+ var FILE_TOKEN = "remotion-file:";
239
+ var serializeJSONWithDate = ({
240
+ data,
241
+ indent,
242
+ staticBase
243
+ }) => {
244
+ let customDateUsed = false;
245
+ let customFileUsed = false;
246
+ let mapUsed = false;
247
+ let setUsed = false;
248
+ const serializedString = JSON.stringify(data, function(key, value) {
249
+ const item = this[key];
250
+ if (item instanceof Date) {
251
+ customDateUsed = true;
252
+ return `${DATE_TOKEN}${item.toISOString()}`;
253
+ }
254
+ if (item instanceof Map) {
255
+ mapUsed = true;
256
+ return value;
257
+ }
258
+ if (item instanceof Set) {
259
+ setUsed = true;
260
+ return value;
261
+ }
262
+ if (typeof item === "string" && staticBase !== null && item.startsWith(staticBase)) {
263
+ customFileUsed = true;
264
+ return `${FILE_TOKEN}${item.replace(staticBase + "/", "")}`;
265
+ }
266
+ return value;
267
+ }, indent);
268
+ return { serializedString, customDateUsed, customFileUsed, mapUsed, setUsed };
269
+ };
270
+ var deserializeJSONWithCustomFields = (data) => {
271
+ return JSON.parse(data, (_, value) => {
272
+ if (typeof value === "string" && value.startsWith(DATE_TOKEN)) {
273
+ return new Date(value.replace(DATE_TOKEN, ""));
641
274
  }
642
- if (matchers.hsla) {
643
- if ((match = matchers.hsla.exec(color))) {
644
- return ((hslToRgb(parse360(match[1]), // h
645
- parsePercentage(match[2]), // s
646
- parsePercentage(match[3])) |
647
- parse1(match[4])) >>> // a
648
- 0);
649
- }
275
+ if (typeof value === "string" && value.startsWith(FILE_TOKEN)) {
276
+ return staticFile(value.replace(FILE_TOKEN, ""));
650
277
  }
651
- throw new Error(`invalid color string ${color} provided`);
652
- }
278
+ return value;
279
+ });
280
+ };
281
+
282
+ // src/interpolate-colors.ts
283
+ var call = function(...args) {
284
+ return "\\(\\s*(" + args.join(")\\s*,\\s*(") + ")\\s*\\)";
285
+ };
286
+ var getMatchers = function() {
287
+ const cachedMatchers = {
288
+ rgb: undefined,
289
+ rgba: undefined,
290
+ hsl: undefined,
291
+ hsla: undefined,
292
+ hex3: undefined,
293
+ hex4: undefined,
294
+ hex5: undefined,
295
+ hex6: undefined,
296
+ hex8: undefined
297
+ };
298
+ if (cachedMatchers.rgb === undefined) {
299
+ cachedMatchers.rgb = new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER));
300
+ cachedMatchers.rgba = new RegExp("rgba" + call(NUMBER, NUMBER, NUMBER, NUMBER));
301
+ cachedMatchers.hsl = new RegExp("hsl" + call(NUMBER, PERCENTAGE, PERCENTAGE));
302
+ cachedMatchers.hsla = new RegExp("hsla" + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER));
303
+ cachedMatchers.hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
304
+ cachedMatchers.hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
305
+ cachedMatchers.hex6 = /^#([0-9a-fA-F]{6})$/;
306
+ cachedMatchers.hex8 = /^#([0-9a-fA-F]{8})$/;
307
+ }
308
+ return cachedMatchers;
309
+ };
310
+ var hue2rgb = function(p, q, t) {
311
+ if (t < 0) {
312
+ t += 1;
313
+ }
314
+ if (t > 1) {
315
+ t -= 1;
316
+ }
317
+ if (t < 0.16666666666666666) {
318
+ return p + (q - p) * 6 * t;
319
+ }
320
+ if (t < 0.5) {
321
+ return q;
322
+ }
323
+ if (t < 0.6666666666666666) {
324
+ return p + (q - p) * (0.6666666666666666 - t) * 6;
325
+ }
326
+ return p;
327
+ };
328
+ var hslToRgb = function(h, s, l) {
329
+ const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
330
+ const p = 2 * l - q;
331
+ const r = hue2rgb(p, q, h + 0.3333333333333333);
332
+ const g = hue2rgb(p, q, h);
333
+ const b = hue2rgb(p, q, h - 0.3333333333333333);
334
+ return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8;
335
+ };
336
+ var parse255 = function(str) {
337
+ const int = Number.parseInt(str, 10);
338
+ if (int < 0) {
339
+ return 0;
340
+ }
341
+ if (int > 255) {
342
+ return 255;
343
+ }
344
+ return int;
345
+ };
346
+ var parse360 = function(str) {
347
+ const int = Number.parseFloat(str);
348
+ return (int % 360 + 360) % 360 / 360;
349
+ };
350
+ var parse1 = function(str) {
351
+ const num = Number.parseFloat(str);
352
+ if (num < 0) {
353
+ return 0;
354
+ }
355
+ if (num > 1) {
356
+ return 255;
357
+ }
358
+ return Math.round(num * 255);
359
+ };
360
+ var parsePercentage = function(str) {
361
+ const int = Number.parseFloat(str);
362
+ if (int < 0) {
363
+ return 0;
364
+ }
365
+ if (int > 100) {
366
+ return 1;
367
+ }
368
+ return int / 100;
369
+ };
370
+ var normalizeColor = function(color) {
371
+ const matchers = getMatchers();
372
+ let match;
373
+ if (matchers.hex6) {
374
+ if (match = matchers.hex6.exec(color)) {
375
+ return Number.parseInt(match[1] + "ff", 16) >>> 0;
376
+ }
377
+ }
378
+ if (colorNames[color] !== undefined) {
379
+ return colorNames[color];
380
+ }
381
+ if (matchers.rgb) {
382
+ if (match = matchers.rgb.exec(color)) {
383
+ return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | 255) >>> 0;
384
+ }
385
+ }
386
+ if (matchers.rgba) {
387
+ if (match = matchers.rgba.exec(color)) {
388
+ return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | parse1(match[4])) >>> 0;
389
+ }
390
+ }
391
+ if (matchers.hex3) {
392
+ if (match = matchers.hex3.exec(color)) {
393
+ return Number.parseInt(match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + "ff", 16) >>> 0;
394
+ }
395
+ }
396
+ if (matchers.hex8) {
397
+ if (match = matchers.hex8.exec(color)) {
398
+ return Number.parseInt(match[1], 16) >>> 0;
399
+ }
400
+ }
401
+ if (matchers.hex4) {
402
+ if (match = matchers.hex4.exec(color)) {
403
+ return Number.parseInt(match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + match[4] + match[4], 16) >>> 0;
404
+ }
405
+ }
406
+ if (matchers.hsl) {
407
+ if (match = matchers.hsl.exec(color)) {
408
+ return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | 255) >>> 0;
409
+ }
410
+ }
411
+ if (matchers.hsla) {
412
+ if (match = matchers.hsla.exec(color)) {
413
+ return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | parse1(match[4])) >>> 0;
414
+ }
415
+ }
416
+ throw new Error(`invalid color string ${color} provided`);
417
+ };
653
418
  function processColor(color) {
654
- const normalizedColor = normalizeColor(color);
655
- return ((normalizedColor << 24) | (normalizedColor >>> 8)) >>> 0; // argb
419
+ const normalizedColor = normalizeColor(color);
420
+ return (normalizedColor << 24 | normalizedColor >>> 8) >>> 0;
656
421
  }
422
+ var NUMBER = "[-+]?\\d*\\.?\\d+";
423
+ var PERCENTAGE = NUMBER + "%";
424
+ var colorNames = {
425
+ transparent: 0,
426
+ aliceblue: 4042850303,
427
+ antiquewhite: 4209760255,
428
+ aqua: 16777215,
429
+ aquamarine: 2147472639,
430
+ azure: 4043309055,
431
+ beige: 4126530815,
432
+ bisque: 4293182719,
433
+ black: 255,
434
+ blanchedalmond: 4293643775,
435
+ blue: 65535,
436
+ blueviolet: 2318131967,
437
+ brown: 2771004159,
438
+ burlywood: 3736635391,
439
+ burntsienna: 3934150143,
440
+ cadetblue: 1604231423,
441
+ chartreuse: 2147418367,
442
+ chocolate: 3530104575,
443
+ coral: 4286533887,
444
+ cornflowerblue: 1687547391,
445
+ cornsilk: 4294499583,
446
+ crimson: 3692313855,
447
+ cyan: 16777215,
448
+ darkblue: 35839,
449
+ darkcyan: 9145343,
450
+ darkgoldenrod: 3095792639,
451
+ darkgray: 2846468607,
452
+ darkgreen: 6553855,
453
+ darkgrey: 2846468607,
454
+ darkkhaki: 3182914559,
455
+ darkmagenta: 2332068863,
456
+ darkolivegreen: 1433087999,
457
+ darkorange: 4287365375,
458
+ darkorchid: 2570243327,
459
+ darkred: 2332033279,
460
+ darksalmon: 3918953215,
461
+ darkseagreen: 2411499519,
462
+ darkslateblue: 1211993087,
463
+ darkslategray: 793726975,
464
+ darkslategrey: 793726975,
465
+ darkturquoise: 13554175,
466
+ darkviolet: 2483082239,
467
+ deeppink: 4279538687,
468
+ deepskyblue: 12582911,
469
+ dimgray: 1768516095,
470
+ dimgrey: 1768516095,
471
+ dodgerblue: 512819199,
472
+ firebrick: 2988581631,
473
+ floralwhite: 4294635775,
474
+ forestgreen: 579543807,
475
+ fuchsia: 4278255615,
476
+ gainsboro: 3705462015,
477
+ ghostwhite: 4177068031,
478
+ gold: 4292280575,
479
+ goldenrod: 3668254975,
480
+ gray: 2155905279,
481
+ green: 8388863,
482
+ greenyellow: 2919182335,
483
+ grey: 2155905279,
484
+ honeydew: 4043305215,
485
+ hotpink: 4285117695,
486
+ indianred: 3445382399,
487
+ indigo: 1258324735,
488
+ ivory: 4294963455,
489
+ khaki: 4041641215,
490
+ lavender: 3873897215,
491
+ lavenderblush: 4293981695,
492
+ lawngreen: 2096890111,
493
+ lemonchiffon: 4294626815,
494
+ lightblue: 2916673279,
495
+ lightcoral: 4034953471,
496
+ lightcyan: 3774873599,
497
+ lightgoldenrodyellow: 4210742015,
498
+ lightgray: 3553874943,
499
+ lightgreen: 2431553791,
500
+ lightgrey: 3553874943,
501
+ lightpink: 4290167295,
502
+ lightsalmon: 4288707327,
503
+ lightseagreen: 548580095,
504
+ lightskyblue: 2278488831,
505
+ lightslategray: 2005441023,
506
+ lightslategrey: 2005441023,
507
+ lightsteelblue: 2965692159,
508
+ lightyellow: 4294959359,
509
+ lime: 16711935,
510
+ limegreen: 852308735,
511
+ linen: 4210091775,
512
+ magenta: 4278255615,
513
+ maroon: 2147483903,
514
+ mediumaquamarine: 1724754687,
515
+ mediumblue: 52735,
516
+ mediumorchid: 3126187007,
517
+ mediumpurple: 2473647103,
518
+ mediumseagreen: 1018393087,
519
+ mediumslateblue: 2070474495,
520
+ mediumspringgreen: 16423679,
521
+ mediumturquoise: 1221709055,
522
+ mediumvioletred: 3340076543,
523
+ midnightblue: 421097727,
524
+ mintcream: 4127193855,
525
+ mistyrose: 4293190143,
526
+ moccasin: 4293178879,
527
+ navajowhite: 4292783615,
528
+ navy: 33023,
529
+ oldlace: 4260751103,
530
+ olive: 2155872511,
531
+ olivedrab: 1804477439,
532
+ orange: 4289003775,
533
+ orangered: 4282712319,
534
+ orchid: 3664828159,
535
+ palegoldenrod: 4008225535,
536
+ palegreen: 2566625535,
537
+ paleturquoise: 2951671551,
538
+ palevioletred: 3681588223,
539
+ papayawhip: 4293907967,
540
+ peachpuff: 4292524543,
541
+ peru: 3448061951,
542
+ pink: 4290825215,
543
+ plum: 3718307327,
544
+ powderblue: 2967529215,
545
+ purple: 2147516671,
546
+ rebeccapurple: 1714657791,
547
+ red: 4278190335,
548
+ rosybrown: 3163525119,
549
+ royalblue: 1097458175,
550
+ saddlebrown: 2336560127,
551
+ salmon: 4202722047,
552
+ sandybrown: 4104413439,
553
+ seagreen: 780883967,
554
+ seashell: 4294307583,
555
+ sienna: 2689740287,
556
+ silver: 3233857791,
557
+ skyblue: 2278484991,
558
+ slateblue: 1784335871,
559
+ slategray: 1887473919,
560
+ slategrey: 1887473919,
561
+ snow: 4294638335,
562
+ springgreen: 16744447,
563
+ steelblue: 1182971135,
564
+ tan: 3535047935,
565
+ teal: 8421631,
566
+ thistle: 3636451583,
567
+ tomato: 4284696575,
568
+ turquoise: 1088475391,
569
+ violet: 4001558271,
570
+ wheat: 4125012991,
571
+ white: 4294967295,
572
+ whitesmoke: 4126537215,
573
+ yellow: 4294902015,
574
+ yellowgreen: 2597139199
575
+ };
657
576
 
658
- const ENABLE_V5_BREAKING_CHANGES = false;
577
+ // src/v5-flag.ts
578
+ var ENABLE_V5_BREAKING_CHANGES = false;
659
579
 
660
- const validateFrame = ({ allowFloats, durationInFrames, frame, }) => {
661
- if (typeof frame === 'undefined') {
662
- throw new TypeError(`Argument missing for parameter "frame"`);
663
- }
664
- if (typeof frame !== 'number') {
665
- throw new TypeError(`Argument passed for "frame" is not a number: ${frame}`);
666
- }
667
- if (!Number.isFinite(frame)) {
668
- throw new RangeError(`Frame ${frame} is not finite`);
669
- }
670
- if (frame % 1 !== 0 && !allowFloats) {
671
- throw new RangeError(`Argument for frame must be an integer, but got ${frame}`);
672
- }
673
- if (frame < 0 && frame < -durationInFrames) {
674
- throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the lowest frame that can be rendered is ${-durationInFrames}`);
675
- }
676
- if (frame > durationInFrames - 1) {
677
- throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the highest frame that can be rendered is ${durationInFrames - 1}`);
678
- }
580
+ // src/validate-frame.ts
581
+ var validateFrame = ({
582
+ allowFloats,
583
+ durationInFrames,
584
+ frame
585
+ }) => {
586
+ if (typeof frame === "undefined") {
587
+ throw new TypeError(`Argument missing for parameter "frame"`);
588
+ }
589
+ if (typeof frame !== "number") {
590
+ throw new TypeError(`Argument passed for "frame" is not a number: ${frame}`);
591
+ }
592
+ if (!Number.isFinite(frame)) {
593
+ throw new RangeError(`Frame ${frame} is not finite`);
594
+ }
595
+ if (frame % 1 !== 0 && !allowFloats) {
596
+ throw new RangeError(`Argument for frame must be an integer, but got ${frame}`);
597
+ }
598
+ if (frame < 0 && frame < -durationInFrames) {
599
+ throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the lowest frame that can be rendered is ${-durationInFrames}`);
600
+ }
601
+ if (frame > durationInFrames - 1) {
602
+ throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the highest frame that can be rendered is ${durationInFrames - 1}`);
603
+ }
679
604
  };
680
605
 
681
- const validateDefaultAndInputProps = (defaultProps, name, compositionId) => {
682
- if (!defaultProps) {
683
- return;
684
- }
685
- if (typeof defaultProps !== 'object') {
686
- throw new Error(`"${name}" must be an object, but you passed a value of type ${typeof defaultProps}`);
687
- }
688
- if (Array.isArray(defaultProps)) {
689
- throw new Error(`"${name}" must be an object, an array was passed ${compositionId ? `for composition "${compositionId}"` : ''}`);
690
- }
606
+ // src/validation/validate-default-props.ts
607
+ var validateDefaultAndInputProps = (defaultProps, name, compositionId) => {
608
+ if (!defaultProps) {
609
+ return;
610
+ }
611
+ if (typeof defaultProps !== "object") {
612
+ throw new Error(`"${name}" must be an object, but you passed a value of type ${typeof defaultProps}`);
613
+ }
614
+ if (Array.isArray(defaultProps)) {
615
+ throw new Error(`"${name}" must be an object, an array was passed ${compositionId ? `for composition "${compositionId}"` : ""}`);
616
+ }
691
617
  };
692
618
 
619
+ // src/validation/validate-dimensions.ts
693
620
  function validateDimension(amount, nameOfProp, location) {
694
- if (typeof amount !== 'number') {
695
- throw new Error(`The "${nameOfProp}" prop ${location} must be a number, but you passed a value of type ${typeof amount}`);
696
- }
697
- if (isNaN(amount)) {
698
- throw new TypeError(`The "${nameOfProp}" prop ${location} must not be NaN, but is NaN.`);
699
- }
700
- if (!Number.isFinite(amount)) {
701
- throw new TypeError(`The "${nameOfProp}" prop ${location} must be finite, but is ${amount}.`);
702
- }
703
- if (amount % 1 !== 0) {
704
- throw new TypeError(`The "${nameOfProp}" prop ${location} must be an integer, but is ${amount}.`);
705
- }
706
- if (amount <= 0) {
707
- throw new TypeError(`The "${nameOfProp}" prop ${location} must be positive, but got ${amount}.`);
708
- }
621
+ if (typeof amount !== "number") {
622
+ throw new Error(`The "${nameOfProp}" prop ${location} must be a number, but you passed a value of type ${typeof amount}`);
623
+ }
624
+ if (isNaN(amount)) {
625
+ throw new TypeError(`The "${nameOfProp}" prop ${location} must not be NaN, but is NaN.`);
626
+ }
627
+ if (!Number.isFinite(amount)) {
628
+ throw new TypeError(`The "${nameOfProp}" prop ${location} must be finite, but is ${amount}.`);
629
+ }
630
+ if (amount % 1 !== 0) {
631
+ throw new TypeError(`The "${nameOfProp}" prop ${location} must be an integer, but is ${amount}.`);
632
+ }
633
+ if (amount <= 0) {
634
+ throw new TypeError(`The "${nameOfProp}" prop ${location} must be positive, but got ${amount}.`);
635
+ }
709
636
  }
710
637
 
638
+ // src/validation/validate-duration-in-frames.ts
711
639
  function validateDurationInFrames(durationInFrames, options) {
712
- const { allowFloats, component } = options;
713
- if (typeof durationInFrames === 'undefined') {
714
- throw new Error(`The "durationInFrames" prop ${component} is missing.`);
715
- }
716
- if (typeof durationInFrames !== 'number') {
717
- throw new Error(`The "durationInFrames" prop ${component} must be a number, but you passed a value of type ${typeof durationInFrames}`);
718
- }
719
- if (durationInFrames <= 0) {
720
- throw new TypeError(`The "durationInFrames" prop ${component} must be positive, but got ${durationInFrames}.`);
721
- }
722
- if (!allowFloats && durationInFrames % 1 !== 0) {
723
- throw new TypeError(`The "durationInFrames" prop ${component} must be an integer, but got ${durationInFrames}.`);
724
- }
725
- if (!Number.isFinite(durationInFrames)) {
726
- throw new TypeError(`The "durationInFrames" prop ${component} must be finite, but got ${durationInFrames}.`);
727
- }
640
+ const { allowFloats, component } = options;
641
+ if (typeof durationInFrames === "undefined") {
642
+ throw new Error(`The "durationInFrames" prop ${component} is missing.`);
643
+ }
644
+ if (typeof durationInFrames !== "number") {
645
+ throw new Error(`The "durationInFrames" prop ${component} must be a number, but you passed a value of type ${typeof durationInFrames}`);
646
+ }
647
+ if (durationInFrames <= 0) {
648
+ throw new TypeError(`The "durationInFrames" prop ${component} must be positive, but got ${durationInFrames}.`);
649
+ }
650
+ if (!allowFloats && durationInFrames % 1 !== 0) {
651
+ throw new TypeError(`The "durationInFrames" prop ${component} must be an integer, but got ${durationInFrames}.`);
652
+ }
653
+ if (!Number.isFinite(durationInFrames)) {
654
+ throw new TypeError(`The "durationInFrames" prop ${component} must be finite, but got ${durationInFrames}.`);
655
+ }
728
656
  }
729
657
 
658
+ // src/validation/validate-fps.ts
730
659
  function validateFps(fps, location, isGif) {
731
- if (typeof fps !== 'number') {
732
- throw new Error(`"fps" must be a number, but you passed a value of type ${typeof fps} ${location}`);
733
- }
734
- if (!Number.isFinite(fps)) {
735
- throw new Error(`"fps" must be a finite, but you passed ${fps} ${location}`);
736
- }
737
- if (isNaN(fps)) {
738
- throw new Error(`"fps" must not be NaN, but got ${fps} ${location}`);
739
- }
740
- if (fps <= 0) {
741
- throw new TypeError(`"fps" must be positive, but got ${fps} ${location}`);
742
- }
743
- if (isGif && fps > 50) {
744
- throw new TypeError(`The FPS for a GIF cannot be higher than 50. Use the --every-nth-frame option to lower the FPS: https://remotion.dev/docs/render-as-gif`);
745
- }
660
+ if (typeof fps !== "number") {
661
+ throw new Error(`"fps" must be a number, but you passed a value of type ${typeof fps} ${location}`);
662
+ }
663
+ if (!Number.isFinite(fps)) {
664
+ throw new Error(`"fps" must be a finite, but you passed ${fps} ${location}`);
665
+ }
666
+ if (isNaN(fps)) {
667
+ throw new Error(`"fps" must not be NaN, but got ${fps} ${location}`);
668
+ }
669
+ if (fps <= 0) {
670
+ throw new TypeError(`"fps" must be positive, but got ${fps} ${location}`);
671
+ }
672
+ if (isGif && fps > 50) {
673
+ throw new TypeError(`The FPS for a GIF cannot be higher than 50. Use the --every-nth-frame option to lower the FPS: https://remotion.dev/docs/render-as-gif`);
674
+ }
746
675
  }
747
676
 
748
- // Calculate the `.currentTime` of a video or audio element
749
- const getExpectedMediaFrameUncorrected = ({ frame, playbackRate, startFrom, }) => {
750
- return interpolate(frame, [-1, startFrom, startFrom + 1], [-1, startFrom, startFrom + playbackRate]);
677
+ // src/video/get-current-time.ts
678
+ var getExpectedMediaFrameUncorrected = ({
679
+ frame,
680
+ playbackRate,
681
+ startFrom
682
+ }) => {
683
+ return interpolate(frame, [-1, startFrom, startFrom + 1], [-1, startFrom, startFrom + playbackRate]);
751
684
  };
752
685
 
753
- const getAbsoluteSrc = (relativeSrc) => {
754
- if (typeof window === 'undefined') {
755
- return relativeSrc;
756
- }
757
- return new URL(relativeSrc, window.origin).href;
686
+ // src/absolute-src.ts
687
+ var getAbsoluteSrc = (relativeSrc) => {
688
+ if (typeof window === "undefined") {
689
+ return relativeSrc;
690
+ }
691
+ return new URL(relativeSrc, window.origin).href;
758
692
  };
759
693
 
760
- const getOffthreadVideoSource = ({ src, transparent, currentTime, toneMapped, }) => {
761
- return `http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent(getAbsoluteSrc(src))}&time=${encodeURIComponent(currentTime)}&transparent=${String(transparent)}&toneMapped=${String(toneMapped)}`;
694
+ // src/video/offthread-video-source.ts
695
+ var getOffthreadVideoSource = ({
696
+ src,
697
+ transparent,
698
+ currentTime,
699
+ toneMapped
700
+ }) => {
701
+ return `http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent(getAbsoluteSrc(src))}&time=${encodeURIComponent(currentTime)}&transparent=${String(transparent)}&toneMapped=${String(toneMapped)}`;
762
702
  };
763
703
 
764
- const NoReactInternals = {
765
- processColor,
766
- truthy,
767
- validateFps,
768
- validateDimension,
769
- validateDurationInFrames,
770
- validateDefaultAndInputProps,
771
- validateFrame,
772
- serializeJSONWithDate,
773
- bundleName: 'bundle.js',
774
- bundleMapName: 'bundle.js.map',
775
- deserializeJSONWithCustomFields,
776
- DELAY_RENDER_CALLSTACK_TOKEN,
777
- DELAY_RENDER_RETRY_TOKEN,
778
- DELAY_RENDER_ATTEMPT_TOKEN: DELAY_RENDER_RETRIES_LEFT,
779
- getOffthreadVideoSource,
780
- getExpectedMediaFrameUncorrected,
781
- ENABLE_V5_BREAKING_CHANGES,
782
- MIN_NODE_VERSION: 16,
783
- MIN_BUN_VERSION: '1.0.3',
784
- colorNames,
785
- DATE_TOKEN,
786
- FILE_TOKEN,
704
+ // src/no-react.ts
705
+ var NoReactInternals = {
706
+ processColor,
707
+ truthy,
708
+ validateFps,
709
+ validateDimension,
710
+ validateDurationInFrames,
711
+ validateDefaultAndInputProps,
712
+ validateFrame,
713
+ serializeJSONWithDate,
714
+ bundleName: "bundle.js",
715
+ bundleMapName: "bundle.js.map",
716
+ deserializeJSONWithCustomFields,
717
+ DELAY_RENDER_CALLSTACK_TOKEN,
718
+ DELAY_RENDER_RETRY_TOKEN,
719
+ DELAY_RENDER_ATTEMPT_TOKEN: DELAY_RENDER_RETRIES_LEFT,
720
+ getOffthreadVideoSource,
721
+ getExpectedMediaFrameUncorrected,
722
+ ENABLE_V5_BREAKING_CHANGES,
723
+ MIN_NODE_VERSION: ENABLE_V5_BREAKING_CHANGES ? 18 : 16,
724
+ MIN_BUN_VERSION: ENABLE_V5_BREAKING_CHANGES ? "1.1.3" : "1.0.3",
725
+ colorNames,
726
+ DATE_TOKEN,
727
+ FILE_TOKEN
728
+ };
729
+ export {
730
+ random,
731
+ interpolate,
732
+ NoReactInternals
787
733
  };
788
-
789
- export { NoReactInternals, interpolate, random };