@remotion/lambda-client 4.0.507 → 4.0.509
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +702 -103
- package/dist/esm/index.mjs +702 -103
- package/package.json +3 -3
package/dist/esm/index.mjs
CHANGED
|
@@ -69200,6 +69200,498 @@ var import_client_sts = __toESM(require_dist_cjs81(), 1);
|
|
|
69200
69200
|
|
|
69201
69201
|
// ../serverless-client/dist/esm/index.mjs
|
|
69202
69202
|
import * as tty from "tty";
|
|
69203
|
+
var NEWTON_ITERATIONS = 4;
|
|
69204
|
+
var NEWTON_MIN_SLOPE = 0.001;
|
|
69205
|
+
var SUBDIVISION_PRECISION = 0.0000001;
|
|
69206
|
+
var SUBDIVISION_MAX_ITERATIONS = 10;
|
|
69207
|
+
var kSplineTableSize = 11;
|
|
69208
|
+
var kSampleStepSize = 1 / (kSplineTableSize - 1);
|
|
69209
|
+
var float32ArraySupported = typeof Float32Array === "function";
|
|
69210
|
+
function a(aA1, aA2) {
|
|
69211
|
+
return 1 - 3 * aA2 + 3 * aA1;
|
|
69212
|
+
}
|
|
69213
|
+
function b(aA1, aA2) {
|
|
69214
|
+
return 3 * aA2 - 6 * aA1;
|
|
69215
|
+
}
|
|
69216
|
+
function c(aA1) {
|
|
69217
|
+
return 3 * aA1;
|
|
69218
|
+
}
|
|
69219
|
+
function calcBezier(aT, aA1, aA2) {
|
|
69220
|
+
return ((a(aA1, aA2) * aT + b(aA1, aA2)) * aT + c(aA1)) * aT;
|
|
69221
|
+
}
|
|
69222
|
+
function getSlope(aT, aA1, aA2) {
|
|
69223
|
+
return 3 * a(aA1, aA2) * aT * aT + 2 * b(aA1, aA2) * aT + c(aA1);
|
|
69224
|
+
}
|
|
69225
|
+
function binarySubdivide({
|
|
69226
|
+
aX,
|
|
69227
|
+
_aA,
|
|
69228
|
+
_aB,
|
|
69229
|
+
mX1,
|
|
69230
|
+
mX2
|
|
69231
|
+
}) {
|
|
69232
|
+
let currentX;
|
|
69233
|
+
let currentT;
|
|
69234
|
+
let i = 0;
|
|
69235
|
+
let aA = _aA;
|
|
69236
|
+
let aB = _aB;
|
|
69237
|
+
do {
|
|
69238
|
+
currentT = aA + (aB - aA) / 2;
|
|
69239
|
+
currentX = calcBezier(currentT, mX1, mX2) - aX;
|
|
69240
|
+
if (currentX > 0) {
|
|
69241
|
+
aB = currentT;
|
|
69242
|
+
} else {
|
|
69243
|
+
aA = currentT;
|
|
69244
|
+
}
|
|
69245
|
+
} while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);
|
|
69246
|
+
return currentT;
|
|
69247
|
+
}
|
|
69248
|
+
function newtonRaphsonIterate(aX, _aGuessT, mX1, mX2) {
|
|
69249
|
+
let aGuessT = _aGuessT;
|
|
69250
|
+
for (let i = 0;i < NEWTON_ITERATIONS; ++i) {
|
|
69251
|
+
const currentSlope = getSlope(aGuessT, mX1, mX2);
|
|
69252
|
+
if (currentSlope === 0) {
|
|
69253
|
+
return aGuessT;
|
|
69254
|
+
}
|
|
69255
|
+
const currentX = calcBezier(aGuessT, mX1, mX2) - aX;
|
|
69256
|
+
aGuessT -= currentX / currentSlope;
|
|
69257
|
+
}
|
|
69258
|
+
return aGuessT;
|
|
69259
|
+
}
|
|
69260
|
+
function bezier(mX1, mY1, mX2, mY2) {
|
|
69261
|
+
if (!(mX1 >= 0 && mX1 <= 1 && mX2 >= 0 && mX2 <= 1)) {
|
|
69262
|
+
throw new Error("bezier x values must be in [0, 1] range");
|
|
69263
|
+
}
|
|
69264
|
+
const sampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);
|
|
69265
|
+
if (mX1 !== mY1 || mX2 !== mY2) {
|
|
69266
|
+
for (let i = 0;i < kSplineTableSize; ++i) {
|
|
69267
|
+
sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
|
|
69268
|
+
}
|
|
69269
|
+
}
|
|
69270
|
+
function getTForX(aX) {
|
|
69271
|
+
let intervalStart = 0;
|
|
69272
|
+
let currentSample = 1;
|
|
69273
|
+
const lastSample = kSplineTableSize - 1;
|
|
69274
|
+
for (;currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
|
|
69275
|
+
intervalStart += kSampleStepSize;
|
|
69276
|
+
}
|
|
69277
|
+
--currentSample;
|
|
69278
|
+
const dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
|
|
69279
|
+
const guessForT = intervalStart + dist * kSampleStepSize;
|
|
69280
|
+
const initialSlope = getSlope(guessForT, mX1, mX2);
|
|
69281
|
+
if (initialSlope >= NEWTON_MIN_SLOPE) {
|
|
69282
|
+
return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
|
|
69283
|
+
}
|
|
69284
|
+
if (initialSlope === 0) {
|
|
69285
|
+
return guessForT;
|
|
69286
|
+
}
|
|
69287
|
+
return binarySubdivide({
|
|
69288
|
+
aX,
|
|
69289
|
+
_aA: intervalStart,
|
|
69290
|
+
_aB: intervalStart + kSampleStepSize,
|
|
69291
|
+
mX1,
|
|
69292
|
+
mX2
|
|
69293
|
+
});
|
|
69294
|
+
}
|
|
69295
|
+
return function(x) {
|
|
69296
|
+
const clampedX = Math.min(1, Math.max(0, x));
|
|
69297
|
+
if (mX1 === mY1 && mX2 === mY2) {
|
|
69298
|
+
return clampedX;
|
|
69299
|
+
}
|
|
69300
|
+
if (clampedX === 0) {
|
|
69301
|
+
return 0;
|
|
69302
|
+
}
|
|
69303
|
+
if (clampedX === 1) {
|
|
69304
|
+
return 1;
|
|
69305
|
+
}
|
|
69306
|
+
return calcBezier(getTForX(clampedX), mY1, mY2);
|
|
69307
|
+
};
|
|
69308
|
+
}
|
|
69309
|
+
var validateFrame = ({
|
|
69310
|
+
allowFloats,
|
|
69311
|
+
durationInFrames,
|
|
69312
|
+
frame
|
|
69313
|
+
}) => {
|
|
69314
|
+
if (typeof frame === "undefined") {
|
|
69315
|
+
throw new TypeError(`Argument missing for parameter "frame"`);
|
|
69316
|
+
}
|
|
69317
|
+
if (typeof frame !== "number") {
|
|
69318
|
+
throw new TypeError(`Argument passed for "frame" is not a number: ${frame}`);
|
|
69319
|
+
}
|
|
69320
|
+
if (!Number.isFinite(frame)) {
|
|
69321
|
+
throw new RangeError(`Frame ${frame} is not finite`);
|
|
69322
|
+
}
|
|
69323
|
+
if (frame % 1 !== 0 && !allowFloats) {
|
|
69324
|
+
throw new RangeError(`Argument for frame must be an integer, but got ${frame}`);
|
|
69325
|
+
}
|
|
69326
|
+
if (frame < 0 && frame < -durationInFrames) {
|
|
69327
|
+
throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the lowest frame that can be rendered is ${-durationInFrames}`);
|
|
69328
|
+
}
|
|
69329
|
+
if (frame > durationInFrames - 1) {
|
|
69330
|
+
throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the highest frame that can be rendered is ${durationInFrames - 1}`);
|
|
69331
|
+
}
|
|
69332
|
+
};
|
|
69333
|
+
function validateFps(fps, location, isGif) {
|
|
69334
|
+
if (typeof fps !== "number") {
|
|
69335
|
+
throw new Error(`"fps" must be a number, but you passed a value of type ${typeof fps} ${location}`);
|
|
69336
|
+
}
|
|
69337
|
+
if (!Number.isFinite(fps)) {
|
|
69338
|
+
throw new Error(`"fps" must be a finite, but you passed ${fps} ${location}`);
|
|
69339
|
+
}
|
|
69340
|
+
if (isNaN(fps)) {
|
|
69341
|
+
throw new Error(`"fps" must not be NaN, but got ${fps} ${location}`);
|
|
69342
|
+
}
|
|
69343
|
+
if (fps <= 0) {
|
|
69344
|
+
throw new TypeError(`"fps" must be positive, but got ${fps} ${location}`);
|
|
69345
|
+
}
|
|
69346
|
+
if (isGif && fps > 50) {
|
|
69347
|
+
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`);
|
|
69348
|
+
}
|
|
69349
|
+
}
|
|
69350
|
+
var validateSpringDuration = (dur) => {
|
|
69351
|
+
if (typeof dur === "undefined") {
|
|
69352
|
+
return;
|
|
69353
|
+
}
|
|
69354
|
+
if (typeof dur !== "number") {
|
|
69355
|
+
throw new TypeError(`A "duration" of a spring must be a "number" but is "${typeof dur}"`);
|
|
69356
|
+
}
|
|
69357
|
+
if (Number.isNaN(dur)) {
|
|
69358
|
+
throw new TypeError('A "duration" of a spring is NaN, which it must not be');
|
|
69359
|
+
}
|
|
69360
|
+
if (!Number.isFinite(dur)) {
|
|
69361
|
+
throw new TypeError('A "duration" of a spring must be finite, but is ' + dur);
|
|
69362
|
+
}
|
|
69363
|
+
if (dur <= 0) {
|
|
69364
|
+
throw new TypeError('A "duration" of a spring must be positive, but is ' + dur);
|
|
69365
|
+
}
|
|
69366
|
+
};
|
|
69367
|
+
var defaultSpringConfig = {
|
|
69368
|
+
damping: 10,
|
|
69369
|
+
mass: 1,
|
|
69370
|
+
stiffness: 100,
|
|
69371
|
+
overshootClamping: false
|
|
69372
|
+
};
|
|
69373
|
+
var advanceCache = {};
|
|
69374
|
+
function advance({
|
|
69375
|
+
animation,
|
|
69376
|
+
now,
|
|
69377
|
+
config
|
|
69378
|
+
}) {
|
|
69379
|
+
const { toValue, lastTimestamp, current, velocity } = animation;
|
|
69380
|
+
const deltaTime = Math.min(now - lastTimestamp, 64);
|
|
69381
|
+
if (config.damping <= 0) {
|
|
69382
|
+
throw new Error("Spring damping must be greater than 0, otherwise the spring() animation will never end, causing an infinite loop.");
|
|
69383
|
+
}
|
|
69384
|
+
const c2 = config.damping;
|
|
69385
|
+
const m = config.mass;
|
|
69386
|
+
const k = config.stiffness;
|
|
69387
|
+
const cacheKey = [
|
|
69388
|
+
toValue,
|
|
69389
|
+
lastTimestamp,
|
|
69390
|
+
current,
|
|
69391
|
+
velocity,
|
|
69392
|
+
c2,
|
|
69393
|
+
m,
|
|
69394
|
+
k,
|
|
69395
|
+
now
|
|
69396
|
+
].join("-");
|
|
69397
|
+
if (advanceCache[cacheKey]) {
|
|
69398
|
+
return advanceCache[cacheKey];
|
|
69399
|
+
}
|
|
69400
|
+
const v0 = -velocity;
|
|
69401
|
+
const x0 = toValue - current;
|
|
69402
|
+
const zeta = c2 / (2 * Math.sqrt(k * m));
|
|
69403
|
+
const omega0 = Math.sqrt(k / m);
|
|
69404
|
+
const omega1 = omega0 * Math.sqrt(1 - zeta ** 2);
|
|
69405
|
+
const t = deltaTime / 1000;
|
|
69406
|
+
const sin1 = Math.sin(omega1 * t);
|
|
69407
|
+
const cos1 = Math.cos(omega1 * t);
|
|
69408
|
+
const underDampedEnvelope = Math.exp(-zeta * omega0 * t);
|
|
69409
|
+
const underDampedFrag1 = underDampedEnvelope * (sin1 * ((v0 + zeta * omega0 * x0) / omega1) + x0 * cos1);
|
|
69410
|
+
const underDampedPosition = toValue - underDampedFrag1;
|
|
69411
|
+
const underDampedVelocity = zeta * omega0 * underDampedFrag1 - underDampedEnvelope * (cos1 * (v0 + zeta * omega0 * x0) - omega1 * x0 * sin1);
|
|
69412
|
+
const criticallyDampedEnvelope = Math.exp(-omega0 * t);
|
|
69413
|
+
const criticallyDampedPosition = toValue - criticallyDampedEnvelope * (x0 + (v0 + omega0 * x0) * t);
|
|
69414
|
+
const criticallyDampedVelocity = criticallyDampedEnvelope * (v0 * (t * omega0 - 1) + t * x0 * omega0 * omega0);
|
|
69415
|
+
const animationNode = {
|
|
69416
|
+
toValue,
|
|
69417
|
+
prevPosition: current,
|
|
69418
|
+
lastTimestamp: now,
|
|
69419
|
+
current: zeta < 1 ? underDampedPosition : criticallyDampedPosition,
|
|
69420
|
+
velocity: zeta < 1 ? underDampedVelocity : criticallyDampedVelocity
|
|
69421
|
+
};
|
|
69422
|
+
advanceCache[cacheKey] = animationNode;
|
|
69423
|
+
return animationNode;
|
|
69424
|
+
}
|
|
69425
|
+
var calculationCache = {};
|
|
69426
|
+
function springCalculation({
|
|
69427
|
+
frame,
|
|
69428
|
+
fps,
|
|
69429
|
+
config = {}
|
|
69430
|
+
}) {
|
|
69431
|
+
const from = 0;
|
|
69432
|
+
const to = 1;
|
|
69433
|
+
const cacheKey = [
|
|
69434
|
+
frame,
|
|
69435
|
+
fps,
|
|
69436
|
+
config.damping,
|
|
69437
|
+
config.mass,
|
|
69438
|
+
config.overshootClamping,
|
|
69439
|
+
config.stiffness
|
|
69440
|
+
].join("-");
|
|
69441
|
+
if (calculationCache[cacheKey]) {
|
|
69442
|
+
return calculationCache[cacheKey];
|
|
69443
|
+
}
|
|
69444
|
+
let animation = {
|
|
69445
|
+
lastTimestamp: 0,
|
|
69446
|
+
current: from,
|
|
69447
|
+
toValue: to,
|
|
69448
|
+
velocity: 0,
|
|
69449
|
+
prevPosition: 0
|
|
69450
|
+
};
|
|
69451
|
+
const frameClamped = Math.max(0, frame);
|
|
69452
|
+
const unevenRest = frameClamped % 1;
|
|
69453
|
+
for (let f = 0;f <= Math.floor(frameClamped); f++) {
|
|
69454
|
+
if (f === Math.floor(frameClamped)) {
|
|
69455
|
+
f += unevenRest;
|
|
69456
|
+
}
|
|
69457
|
+
const time = f / fps * 1000;
|
|
69458
|
+
animation = advance({
|
|
69459
|
+
animation,
|
|
69460
|
+
now: time,
|
|
69461
|
+
config: {
|
|
69462
|
+
...defaultSpringConfig,
|
|
69463
|
+
...config
|
|
69464
|
+
}
|
|
69465
|
+
});
|
|
69466
|
+
}
|
|
69467
|
+
calculationCache[cacheKey] = animation;
|
|
69468
|
+
return animation;
|
|
69469
|
+
}
|
|
69470
|
+
var cache = new Map;
|
|
69471
|
+
function measureSpring({
|
|
69472
|
+
fps,
|
|
69473
|
+
config = {},
|
|
69474
|
+
threshold = 0.005
|
|
69475
|
+
}) {
|
|
69476
|
+
if (typeof threshold !== "number") {
|
|
69477
|
+
throw new TypeError(`threshold must be a number, got ${threshold} of type ${typeof threshold}`);
|
|
69478
|
+
}
|
|
69479
|
+
if (threshold === 0) {
|
|
69480
|
+
return Infinity;
|
|
69481
|
+
}
|
|
69482
|
+
if (threshold === 1) {
|
|
69483
|
+
return 0;
|
|
69484
|
+
}
|
|
69485
|
+
if (isNaN(threshold)) {
|
|
69486
|
+
throw new TypeError("Threshold is NaN");
|
|
69487
|
+
}
|
|
69488
|
+
if (!Number.isFinite(threshold)) {
|
|
69489
|
+
throw new TypeError("Threshold is not finite");
|
|
69490
|
+
}
|
|
69491
|
+
if (threshold < 0) {
|
|
69492
|
+
throw new TypeError("Threshold is below 0");
|
|
69493
|
+
}
|
|
69494
|
+
const cacheKey = [
|
|
69495
|
+
fps,
|
|
69496
|
+
config.damping,
|
|
69497
|
+
config.mass,
|
|
69498
|
+
config.overshootClamping,
|
|
69499
|
+
config.stiffness,
|
|
69500
|
+
threshold
|
|
69501
|
+
].join("-");
|
|
69502
|
+
if (cache.has(cacheKey)) {
|
|
69503
|
+
return cache.get(cacheKey);
|
|
69504
|
+
}
|
|
69505
|
+
validateFps(fps, "to the measureSpring() function", false);
|
|
69506
|
+
let frame = 0;
|
|
69507
|
+
let finishedFrame = 0;
|
|
69508
|
+
const calc = () => {
|
|
69509
|
+
return springCalculation({
|
|
69510
|
+
fps,
|
|
69511
|
+
frame,
|
|
69512
|
+
config
|
|
69513
|
+
});
|
|
69514
|
+
};
|
|
69515
|
+
let animation = calc();
|
|
69516
|
+
const calcDifference = () => {
|
|
69517
|
+
return Math.abs(animation.current - animation.toValue);
|
|
69518
|
+
};
|
|
69519
|
+
let difference = calcDifference();
|
|
69520
|
+
while (difference >= threshold) {
|
|
69521
|
+
frame++;
|
|
69522
|
+
animation = calc();
|
|
69523
|
+
difference = calcDifference();
|
|
69524
|
+
}
|
|
69525
|
+
finishedFrame = frame;
|
|
69526
|
+
for (let i = 0;i < 20; i++) {
|
|
69527
|
+
frame++;
|
|
69528
|
+
animation = calc();
|
|
69529
|
+
difference = calcDifference();
|
|
69530
|
+
if (difference >= threshold) {
|
|
69531
|
+
i = 0;
|
|
69532
|
+
finishedFrame = frame + 1;
|
|
69533
|
+
}
|
|
69534
|
+
}
|
|
69535
|
+
cache.set(cacheKey, finishedFrame);
|
|
69536
|
+
return finishedFrame;
|
|
69537
|
+
}
|
|
69538
|
+
function spring({
|
|
69539
|
+
frame: passedFrame,
|
|
69540
|
+
fps,
|
|
69541
|
+
config = {},
|
|
69542
|
+
from = 0,
|
|
69543
|
+
to = 1,
|
|
69544
|
+
durationInFrames: passedDurationInFrames,
|
|
69545
|
+
durationRestThreshold,
|
|
69546
|
+
delay = 0,
|
|
69547
|
+
reverse = false
|
|
69548
|
+
}) {
|
|
69549
|
+
validateSpringDuration(passedDurationInFrames);
|
|
69550
|
+
validateFrame({
|
|
69551
|
+
frame: passedFrame,
|
|
69552
|
+
durationInFrames: Infinity,
|
|
69553
|
+
allowFloats: true
|
|
69554
|
+
});
|
|
69555
|
+
validateFps(fps, "to spring()", false);
|
|
69556
|
+
const needsToCalculateNaturalDuration = reverse || typeof passedDurationInFrames !== "undefined";
|
|
69557
|
+
const naturalDuration = needsToCalculateNaturalDuration ? measureSpring({
|
|
69558
|
+
fps,
|
|
69559
|
+
config,
|
|
69560
|
+
threshold: durationRestThreshold
|
|
69561
|
+
}) : undefined;
|
|
69562
|
+
const naturalDurationGetter = needsToCalculateNaturalDuration ? {
|
|
69563
|
+
get: () => naturalDuration
|
|
69564
|
+
} : {
|
|
69565
|
+
get: () => {
|
|
69566
|
+
throw new Error("did not calculate natural duration, this is an error with Remotion. Please report");
|
|
69567
|
+
}
|
|
69568
|
+
};
|
|
69569
|
+
const reverseProcessed = reverse ? (passedDurationInFrames ?? naturalDurationGetter.get()) - passedFrame : passedFrame;
|
|
69570
|
+
const delayProcessed = reverseProcessed + (reverse ? delay : -delay);
|
|
69571
|
+
const durationProcessed = passedDurationInFrames === undefined ? delayProcessed : delayProcessed / (passedDurationInFrames / naturalDurationGetter.get());
|
|
69572
|
+
if (passedDurationInFrames && delayProcessed > passedDurationInFrames) {
|
|
69573
|
+
return to;
|
|
69574
|
+
}
|
|
69575
|
+
const spr = springCalculation({
|
|
69576
|
+
fps,
|
|
69577
|
+
frame: durationProcessed,
|
|
69578
|
+
config
|
|
69579
|
+
});
|
|
69580
|
+
const inner = config.overshootClamping ? to >= from ? Math.min(spr.current, to) : Math.max(spr.current, to) : spr.current;
|
|
69581
|
+
const interpolated = from === 0 && to === 1 ? inner : interpolate(inner, [0, 1], [from, to]);
|
|
69582
|
+
return interpolated;
|
|
69583
|
+
}
|
|
69584
|
+
var clampUnit = (t) => Math.min(1, Math.max(0, t));
|
|
69585
|
+
var springEasingDurationInFrames = 30;
|
|
69586
|
+
|
|
69587
|
+
class Easing {
|
|
69588
|
+
static step0(n) {
|
|
69589
|
+
return n > 0 ? 1 : 0;
|
|
69590
|
+
}
|
|
69591
|
+
static step1(n) {
|
|
69592
|
+
return n >= 1 ? 1 : 0;
|
|
69593
|
+
}
|
|
69594
|
+
static linear(t) {
|
|
69595
|
+
return t;
|
|
69596
|
+
}
|
|
69597
|
+
static ease(t) {
|
|
69598
|
+
return Easing.bezier(0.42, 0, 1, 1)(t);
|
|
69599
|
+
}
|
|
69600
|
+
static quad(t) {
|
|
69601
|
+
return t * t;
|
|
69602
|
+
}
|
|
69603
|
+
static cubic(t) {
|
|
69604
|
+
return t * t * t;
|
|
69605
|
+
}
|
|
69606
|
+
static poly(n) {
|
|
69607
|
+
return (t) => t ** n;
|
|
69608
|
+
}
|
|
69609
|
+
static sin(t) {
|
|
69610
|
+
return 1 - Math.cos(t * Math.PI / 2);
|
|
69611
|
+
}
|
|
69612
|
+
static circle(t) {
|
|
69613
|
+
const u = clampUnit(t);
|
|
69614
|
+
return 1 - Math.sqrt(1 - u * u);
|
|
69615
|
+
}
|
|
69616
|
+
static exp(t) {
|
|
69617
|
+
return 2 ** (10 * (t - 1));
|
|
69618
|
+
}
|
|
69619
|
+
static elastic(bounciness = 1) {
|
|
69620
|
+
const p = bounciness * Math.PI;
|
|
69621
|
+
return (t) => 1 - Math.cos(t * Math.PI / 2) ** 3 * Math.cos(t * p);
|
|
69622
|
+
}
|
|
69623
|
+
static back(s = 1.70158) {
|
|
69624
|
+
return (t) => t * t * ((s + 1) * t - s);
|
|
69625
|
+
}
|
|
69626
|
+
static spring({
|
|
69627
|
+
allowTail = false,
|
|
69628
|
+
durationRestThreshold,
|
|
69629
|
+
...config
|
|
69630
|
+
} = {}) {
|
|
69631
|
+
const easing = (t) => {
|
|
69632
|
+
if (t <= 0) {
|
|
69633
|
+
return 0;
|
|
69634
|
+
}
|
|
69635
|
+
if (!allowTail && t >= 1) {
|
|
69636
|
+
return 1;
|
|
69637
|
+
}
|
|
69638
|
+
if (allowTail) {
|
|
69639
|
+
return spring({
|
|
69640
|
+
fps: springEasingDurationInFrames,
|
|
69641
|
+
frame: t * measureSpring({
|
|
69642
|
+
fps: springEasingDurationInFrames,
|
|
69643
|
+
config,
|
|
69644
|
+
threshold: durationRestThreshold
|
|
69645
|
+
}),
|
|
69646
|
+
config
|
|
69647
|
+
});
|
|
69648
|
+
}
|
|
69649
|
+
return spring({
|
|
69650
|
+
fps: springEasingDurationInFrames,
|
|
69651
|
+
frame: t * springEasingDurationInFrames,
|
|
69652
|
+
config,
|
|
69653
|
+
durationInFrames: springEasingDurationInFrames,
|
|
69654
|
+
durationRestThreshold
|
|
69655
|
+
});
|
|
69656
|
+
};
|
|
69657
|
+
return Object.assign(easing, {
|
|
69658
|
+
remotionShouldExtendRight: allowTail
|
|
69659
|
+
});
|
|
69660
|
+
}
|
|
69661
|
+
static bounce(t) {
|
|
69662
|
+
const u = clampUnit(t);
|
|
69663
|
+
if (u < 1 / 2.75) {
|
|
69664
|
+
return 7.5625 * u * u;
|
|
69665
|
+
}
|
|
69666
|
+
if (u < 2 / 2.75) {
|
|
69667
|
+
const t2_ = u - 1.5 / 2.75;
|
|
69668
|
+
return 7.5625 * t2_ * t2_ + 0.75;
|
|
69669
|
+
}
|
|
69670
|
+
if (u < 2.5 / 2.75) {
|
|
69671
|
+
const t2_ = u - 2.25 / 2.75;
|
|
69672
|
+
return 7.5625 * t2_ * t2_ + 0.9375;
|
|
69673
|
+
}
|
|
69674
|
+
const t2 = u - 2.625 / 2.75;
|
|
69675
|
+
return 7.5625 * t2 * t2 + 0.984375;
|
|
69676
|
+
}
|
|
69677
|
+
static bezier(x1, y1, x2, y2) {
|
|
69678
|
+
return bezier(x1, y1, x2, y2);
|
|
69679
|
+
}
|
|
69680
|
+
static in(easing) {
|
|
69681
|
+
return easing;
|
|
69682
|
+
}
|
|
69683
|
+
static out(easing) {
|
|
69684
|
+
return (t) => 1 - easing(1 - t);
|
|
69685
|
+
}
|
|
69686
|
+
static inOut(easing) {
|
|
69687
|
+
return (t) => {
|
|
69688
|
+
if (t < 0.5) {
|
|
69689
|
+
return easing(t * 2) / 2;
|
|
69690
|
+
}
|
|
69691
|
+
return 1 - easing((1 - t) * 2) / 2;
|
|
69692
|
+
};
|
|
69693
|
+
}
|
|
69694
|
+
}
|
|
69203
69695
|
var normalizeNumber = (value) => {
|
|
69204
69696
|
return Math.round(value * 1e6) / 1e6;
|
|
69205
69697
|
};
|
|
@@ -69270,10 +69762,13 @@ var transformOriginCenter = { value: 50, unit: "%" };
|
|
|
69270
69762
|
var stringifyNumber = (value) => {
|
|
69271
69763
|
return String(normalizeNumber(value));
|
|
69272
69764
|
};
|
|
69765
|
+
|
|
69766
|
+
class UnsupportedStringInterpolationValueError extends TypeError {
|
|
69767
|
+
}
|
|
69273
69768
|
var parseStringInterpolationComponent = (component, value) => {
|
|
69274
69769
|
const match = cssNumberRegex.exec(component);
|
|
69275
69770
|
if (match === null) {
|
|
69276
|
-
throw new
|
|
69771
|
+
throw new UnsupportedStringInterpolationValueError(`Cannot interpolate "${value}" because "${component}" is not a supported scale, translate, or rotate value`);
|
|
69277
69772
|
}
|
|
69278
69773
|
const unit = match[2] ?? null;
|
|
69279
69774
|
const numberValue = Number(match[1]);
|
|
@@ -69390,9 +69885,45 @@ var parseTransformOriginValue = (output, parts) => {
|
|
|
69390
69885
|
});
|
|
69391
69886
|
return {
|
|
69392
69887
|
kind: "translate",
|
|
69393
|
-
values: [x.value, y.value, z.value],
|
|
69394
|
-
units: [x.unit, y.unit, z.unit],
|
|
69395
|
-
dimensions: parts[2] === undefined ? 2 : 3
|
|
69888
|
+
values: [x.value, y.value, z.value, 0],
|
|
69889
|
+
units: [x.unit, y.unit, z.unit, null],
|
|
69890
|
+
dimensions: parts[2] === undefined ? 2 : 3,
|
|
69891
|
+
axisRotation: false
|
|
69892
|
+
};
|
|
69893
|
+
};
|
|
69894
|
+
var parseAxisRotationValue = (output) => {
|
|
69895
|
+
const parts = output.trim().split(/\s+/);
|
|
69896
|
+
const keywordAxis = parts.length === 2 ? parts[0].toLowerCase() : null;
|
|
69897
|
+
if (keywordAxis === "x" || keywordAxis === "y" || keywordAxis === "z") {
|
|
69898
|
+
const keywordAngle = parseStringInterpolationComponent(parts[1], output);
|
|
69899
|
+
if (keywordAngle.kind !== "rotate") {
|
|
69900
|
+
return null;
|
|
69901
|
+
}
|
|
69902
|
+
return {
|
|
69903
|
+
kind: "rotate",
|
|
69904
|
+
values: keywordAxis === "x" ? [1, 0, 0, keywordAngle.value] : keywordAxis === "y" ? [0, 1, 0, keywordAngle.value] : [0, 0, 1, keywordAngle.value],
|
|
69905
|
+
units: [null, null, null, keywordAngle.unit],
|
|
69906
|
+
dimensions: 4,
|
|
69907
|
+
axisRotation: true
|
|
69908
|
+
};
|
|
69909
|
+
}
|
|
69910
|
+
if (parts.length !== 4) {
|
|
69911
|
+
return null;
|
|
69912
|
+
}
|
|
69913
|
+
const axis = parts.slice(0, 3).map(Number);
|
|
69914
|
+
if (!axis.every(Number.isFinite)) {
|
|
69915
|
+
return null;
|
|
69916
|
+
}
|
|
69917
|
+
const vectorAngle = parseStringInterpolationComponent(parts[3], output);
|
|
69918
|
+
if (vectorAngle.kind !== "rotate") {
|
|
69919
|
+
return null;
|
|
69920
|
+
}
|
|
69921
|
+
return {
|
|
69922
|
+
kind: "rotate",
|
|
69923
|
+
values: [axis[0], axis[1], axis[2], vectorAngle.value],
|
|
69924
|
+
units: [null, null, null, vectorAngle.unit],
|
|
69925
|
+
dimensions: 4,
|
|
69926
|
+
axisRotation: true
|
|
69396
69927
|
};
|
|
69397
69928
|
};
|
|
69398
69929
|
var parseStringInterpolationValue = (output) => {
|
|
@@ -69402,11 +69933,16 @@ var parseStringInterpolationValue = (output) => {
|
|
|
69402
69933
|
}
|
|
69403
69934
|
return {
|
|
69404
69935
|
kind: "scale",
|
|
69405
|
-
values: [output, output, 1],
|
|
69406
|
-
units: [null, null, null],
|
|
69407
|
-
dimensions: 1
|
|
69936
|
+
values: [output, output, 1, 0],
|
|
69937
|
+
units: [null, null, null, null],
|
|
69938
|
+
dimensions: 1,
|
|
69939
|
+
axisRotation: false
|
|
69408
69940
|
};
|
|
69409
69941
|
}
|
|
69942
|
+
const axisRotation = parseAxisRotationValue(output);
|
|
69943
|
+
if (axisRotation !== null) {
|
|
69944
|
+
return axisRotation;
|
|
69945
|
+
}
|
|
69410
69946
|
const parts = output.trim().split(/\s+/);
|
|
69411
69947
|
if (parts.length < 1 || parts.length > 3 || parts[0] === "") {
|
|
69412
69948
|
throw new TypeError(`String outputRange values must contain 1 to 3 components, but got "${output}"`);
|
|
@@ -69427,24 +69963,35 @@ var parseStringInterpolationValue = (output) => {
|
|
|
69427
69963
|
const z = parsed[2]?.value ?? 1;
|
|
69428
69964
|
return {
|
|
69429
69965
|
kind,
|
|
69430
|
-
values: [x, y, z],
|
|
69431
|
-
units: [null, null, null],
|
|
69432
|
-
dimensions: parsed.length
|
|
69966
|
+
values: [x, y, z, 0],
|
|
69967
|
+
units: [null, null, null, null],
|
|
69968
|
+
dimensions: parsed.length,
|
|
69969
|
+
axisRotation: false
|
|
69433
69970
|
};
|
|
69434
69971
|
}
|
|
69435
69972
|
return {
|
|
69436
69973
|
kind,
|
|
69437
|
-
values: [parsed[0].value, parsed[1]?.value ?? 0, parsed[2]?.value ?? 0],
|
|
69438
|
-
units: [
|
|
69439
|
-
|
|
69974
|
+
values: [parsed[0].value, parsed[1]?.value ?? 0, parsed[2]?.value ?? 0, 0],
|
|
69975
|
+
units: [
|
|
69976
|
+
parsed[0].unit,
|
|
69977
|
+
parsed[1]?.unit ?? null,
|
|
69978
|
+
parsed[2]?.unit ?? null,
|
|
69979
|
+
null
|
|
69980
|
+
],
|
|
69981
|
+
dimensions: parsed.length,
|
|
69982
|
+
axisRotation: false
|
|
69440
69983
|
};
|
|
69441
69984
|
};
|
|
69442
69985
|
var serializeStringInterpolationValue = ({
|
|
69443
69986
|
kind,
|
|
69444
69987
|
values,
|
|
69445
69988
|
units,
|
|
69446
|
-
dimensions
|
|
69989
|
+
dimensions,
|
|
69990
|
+
axisRotation
|
|
69447
69991
|
}) => {
|
|
69992
|
+
if (axisRotation) {
|
|
69993
|
+
return `${stringifyNumber(values[0])} ${stringifyNumber(values[1])} ${stringifyNumber(values[2])} ${stringifyNumber(values[3])}${units[3]}`;
|
|
69994
|
+
}
|
|
69448
69995
|
if (kind === "scale") {
|
|
69449
69996
|
return values.slice(0, dimensions).map((value) => stringifyNumber(value)).join(" ");
|
|
69450
69997
|
}
|
|
@@ -69612,7 +70159,26 @@ var interpolateString = ({
|
|
|
69612
70159
|
outputRange,
|
|
69613
70160
|
options
|
|
69614
70161
|
}) => {
|
|
69615
|
-
const
|
|
70162
|
+
const initiallyParsedOutputRange = outputRange.map(parseStringInterpolationValue);
|
|
70163
|
+
const hasAxisRotation = initiallyParsedOutputRange.some((parsed) => parsed.axisRotation);
|
|
70164
|
+
const parsedOutputRange = hasAxisRotation ? initiallyParsedOutputRange.map((parsed) => {
|
|
70165
|
+
if (parsed.kind !== "rotate") {
|
|
70166
|
+
return parsed;
|
|
70167
|
+
}
|
|
70168
|
+
if (parsed.axisRotation) {
|
|
70169
|
+
return parsed;
|
|
70170
|
+
}
|
|
70171
|
+
if (parsed.dimensions !== 1) {
|
|
70172
|
+
throw new TypeError("Cannot interpolate a multi-angle rotate value with an axis rotation");
|
|
70173
|
+
}
|
|
70174
|
+
return {
|
|
70175
|
+
kind: "rotate",
|
|
70176
|
+
values: [0, 0, 1, parsed.values[0]],
|
|
70177
|
+
units: [null, null, null, parsed.units[0]],
|
|
70178
|
+
dimensions: 4,
|
|
70179
|
+
axisRotation: true
|
|
70180
|
+
};
|
|
70181
|
+
}) : initiallyParsedOutputRange;
|
|
69616
70182
|
const kind = parsedOutputRange[0]?.kind;
|
|
69617
70183
|
if (kind === undefined) {
|
|
69618
70184
|
throw new Error("outputRange must have at least 1 element");
|
|
@@ -69624,12 +70190,16 @@ var interpolateString = ({
|
|
|
69624
70190
|
}
|
|
69625
70191
|
const dimensions = Math.max(...parsedOutputRange.map((parsed) => parsed.dimensions));
|
|
69626
70192
|
const units = [
|
|
70193
|
+
null,
|
|
69627
70194
|
null,
|
|
69628
70195
|
null,
|
|
69629
70196
|
null
|
|
69630
70197
|
];
|
|
69631
70198
|
if (kind !== "scale") {
|
|
69632
70199
|
for (let axis = 0;axis < dimensions; axis++) {
|
|
70200
|
+
if (hasAxisRotation && axis < 3) {
|
|
70201
|
+
continue;
|
|
70202
|
+
}
|
|
69633
70203
|
for (const parsed of parsedOutputRange) {
|
|
69634
70204
|
const unit = parsed.units[axis];
|
|
69635
70205
|
if (unit === null) {
|
|
@@ -69648,7 +70218,7 @@ var interpolateString = ({
|
|
|
69648
70218
|
}
|
|
69649
70219
|
}
|
|
69650
70220
|
}
|
|
69651
|
-
const values = [0, 0, 0];
|
|
70221
|
+
const values = [0, 0, 0, 0];
|
|
69652
70222
|
for (let axis = 0;axis < dimensions; axis++) {
|
|
69653
70223
|
values[axis] = interpolateNumber({
|
|
69654
70224
|
input,
|
|
@@ -69661,9 +70231,56 @@ var interpolateString = ({
|
|
|
69661
70231
|
kind,
|
|
69662
70232
|
values,
|
|
69663
70233
|
units,
|
|
69664
|
-
dimensions
|
|
70234
|
+
dimensions,
|
|
70235
|
+
axisRotation: hasAxisRotation
|
|
69665
70236
|
});
|
|
69666
70237
|
};
|
|
70238
|
+
var interpolateDiscreteString = ({
|
|
70239
|
+
input,
|
|
70240
|
+
inputRange,
|
|
70241
|
+
outputRange,
|
|
70242
|
+
options
|
|
70243
|
+
}) => {
|
|
70244
|
+
if (inputRange.length === 1) {
|
|
70245
|
+
return outputRange[0];
|
|
70246
|
+
}
|
|
70247
|
+
for (let segmentIndex = 0;segmentIndex < inputRange.length - 1; segmentIndex++) {
|
|
70248
|
+
if (resolveEasingForSegment({
|
|
70249
|
+
easing: options?.easing,
|
|
70250
|
+
segmentIndex
|
|
70251
|
+
}) !== Easing.step1) {
|
|
70252
|
+
throw new TypeError("Non-numeric strings can only be interpolated using Easing.step1");
|
|
70253
|
+
}
|
|
70254
|
+
}
|
|
70255
|
+
const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
|
|
70256
|
+
const inputMin = inputRange[0];
|
|
70257
|
+
const inputMax = inputRange[inputRange.length - 1];
|
|
70258
|
+
let resolvedInput = posterizedInput;
|
|
70259
|
+
if (resolvedInput < inputMin) {
|
|
70260
|
+
if (options?.extrapolateLeft === "identity") {
|
|
70261
|
+
throw new TypeError('extrapolateLeft: "identity" is not supported for non-numeric strings');
|
|
70262
|
+
}
|
|
70263
|
+
if (options?.extrapolateLeft === "wrap") {
|
|
70264
|
+
const wrapRange = inputMax - inputMin;
|
|
70265
|
+
resolvedInput = ((resolvedInput - inputMin) % wrapRange + wrapRange) % wrapRange + inputMin;
|
|
70266
|
+
} else {
|
|
70267
|
+
return outputRange[0];
|
|
70268
|
+
}
|
|
70269
|
+
}
|
|
70270
|
+
if (resolvedInput > inputMax) {
|
|
70271
|
+
if (options?.extrapolateRight === "identity") {
|
|
70272
|
+
throw new TypeError('extrapolateRight: "identity" is not supported for non-numeric strings');
|
|
70273
|
+
}
|
|
70274
|
+
if (options?.extrapolateRight === "wrap") {
|
|
70275
|
+
const wrapRange = inputMax - inputMin;
|
|
70276
|
+
resolvedInput = ((resolvedInput - inputMin) % wrapRange + wrapRange) % wrapRange + inputMin;
|
|
70277
|
+
} else {
|
|
70278
|
+
return outputRange[outputRange.length - 1];
|
|
70279
|
+
}
|
|
70280
|
+
}
|
|
70281
|
+
const range = findRange(resolvedInput, inputRange);
|
|
70282
|
+
return resolvedInput >= inputRange[range + 1] ? outputRange[range + 1] : outputRange[range];
|
|
70283
|
+
};
|
|
69667
70284
|
var validateTupleOutputRange = (outputRange) => {
|
|
69668
70285
|
const dimensions = outputRange[0]?.length;
|
|
69669
70286
|
if (dimensions === undefined) {
|
|
@@ -69778,7 +70395,30 @@ function interpolate(input, inputRange, outputRange, options) {
|
|
|
69778
70395
|
if (!outputRange.every((output) => typeof output === "string" || typeof output === "number")) {
|
|
69779
70396
|
throw new TypeError("outputRange must contain only numbers, or supported scale, translate, and rotate strings");
|
|
69780
70397
|
}
|
|
69781
|
-
|
|
70398
|
+
try {
|
|
70399
|
+
return interpolateString({ input, inputRange, outputRange, options });
|
|
70400
|
+
} catch (error) {
|
|
70401
|
+
if (!outputRange.every((output) => typeof output === "string")) {
|
|
70402
|
+
throw error;
|
|
70403
|
+
}
|
|
70404
|
+
const hasNonNumericString = outputRange.some((output) => {
|
|
70405
|
+
try {
|
|
70406
|
+
parseStringInterpolationValue(output);
|
|
70407
|
+
return false;
|
|
70408
|
+
} catch (parseError) {
|
|
70409
|
+
return parseError instanceof UnsupportedStringInterpolationValueError;
|
|
70410
|
+
}
|
|
70411
|
+
});
|
|
70412
|
+
if (!hasNonNumericString) {
|
|
70413
|
+
throw error;
|
|
70414
|
+
}
|
|
70415
|
+
return interpolateDiscreteString({
|
|
70416
|
+
input,
|
|
70417
|
+
inputRange,
|
|
70418
|
+
outputRange,
|
|
70419
|
+
options
|
|
70420
|
+
});
|
|
70421
|
+
}
|
|
69782
70422
|
}
|
|
69783
70423
|
if (outputRange.every((output) => Array.isArray(output))) {
|
|
69784
70424
|
return interpolateTuple({ input, inputRange, outputRange, options });
|
|
@@ -69789,8 +70429,8 @@ function interpolate(input, inputRange, outputRange, options) {
|
|
|
69789
70429
|
checkInfiniteRange("outputRange", outputRange);
|
|
69790
70430
|
return interpolateNumber({ input, inputRange, outputRange, options });
|
|
69791
70431
|
}
|
|
69792
|
-
function mulberry32(
|
|
69793
|
-
let t =
|
|
70432
|
+
function mulberry32(a2) {
|
|
70433
|
+
let t = a2 + 1831565813;
|
|
69794
70434
|
t = Math.imul(t ^ t >>> 15, t | 1);
|
|
69795
70435
|
t ^= t + Math.imul(t ^ t >>> 7, t | 61);
|
|
69796
70436
|
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
@@ -70279,8 +70919,8 @@ function hslToRgb(h, s, l) {
|
|
|
70279
70919
|
const p = 2 * l - q;
|
|
70280
70920
|
const r = hue2rgb(p, q, h + 1 / 3);
|
|
70281
70921
|
const g = hue2rgb(p, q, h);
|
|
70282
|
-
const
|
|
70283
|
-
return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(
|
|
70922
|
+
const b2 = hue2rgb(p, q, h - 1 / 3);
|
|
70923
|
+
return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b2 * 255) << 8;
|
|
70284
70924
|
}
|
|
70285
70925
|
function parse255(str) {
|
|
70286
70926
|
const int = Number.parseInt(str, 10);
|
|
@@ -70344,25 +70984,25 @@ function parseModernAlpha(str) {
|
|
|
70344
70984
|
}
|
|
70345
70985
|
return Math.max(0, Math.min(1, Number.parseFloat(str)));
|
|
70346
70986
|
}
|
|
70347
|
-
function linearToSrgb(
|
|
70348
|
-
if (
|
|
70349
|
-
return 12.92 *
|
|
70350
|
-
return 1.055 *
|
|
70987
|
+
function linearToSrgb(c2) {
|
|
70988
|
+
if (c2 <= 0.0031308)
|
|
70989
|
+
return 12.92 * c2;
|
|
70990
|
+
return 1.055 * c2 ** (1 / 2.4) - 0.055;
|
|
70351
70991
|
}
|
|
70352
70992
|
function clamp01(v) {
|
|
70353
70993
|
return Math.max(0, Math.min(1, v));
|
|
70354
70994
|
}
|
|
70355
|
-
function rgbFloatToInt(r, g,
|
|
70995
|
+
function rgbFloatToInt(r, g, b2, alpha) {
|
|
70356
70996
|
const ri = Math.round(clamp01(r) * 255);
|
|
70357
70997
|
const gi = Math.round(clamp01(g) * 255);
|
|
70358
|
-
const bi = Math.round(clamp01(
|
|
70998
|
+
const bi = Math.round(clamp01(b2) * 255);
|
|
70359
70999
|
const ai = Math.round(clamp01(alpha) * 255);
|
|
70360
71000
|
return (ri << 24 | gi << 16 | bi << 8 | ai) >>> 0;
|
|
70361
71001
|
}
|
|
70362
|
-
function oklabToSrgb(L,
|
|
70363
|
-
const l_ = L + 0.3963377774 *
|
|
70364
|
-
const m_ = L - 0.1055613458 *
|
|
70365
|
-
const s_ = L - 0.0894841775 *
|
|
71002
|
+
function oklabToSrgb(L, a2, b2) {
|
|
71003
|
+
const l_ = L + 0.3963377774 * a2 + 0.2158037573 * b2;
|
|
71004
|
+
const m_ = L - 0.1055613458 * a2 - 0.0638541728 * b2;
|
|
71005
|
+
const s_ = L - 0.0894841775 * a2 - 1.291485548 * b2;
|
|
70366
71006
|
const l = l_ * l_ * l_;
|
|
70367
71007
|
const m = m_ * m_ * m_;
|
|
70368
71008
|
const s = s_ * s_ * s_;
|
|
@@ -70371,15 +71011,15 @@ function oklabToSrgb(L, a, b) {
|
|
|
70371
71011
|
const bLin = -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s;
|
|
70372
71012
|
return [linearToSrgb(rLin), linearToSrgb(gLin), linearToSrgb(bLin)];
|
|
70373
71013
|
}
|
|
70374
|
-
function labToSrgb(L,
|
|
71014
|
+
function labToSrgb(L, a2, b2) {
|
|
70375
71015
|
const epsilon = 216 / 24389;
|
|
70376
71016
|
const kappa = 24389 / 27;
|
|
70377
71017
|
const Xn = 0.95047;
|
|
70378
71018
|
const Yn = 1;
|
|
70379
71019
|
const Zn = 1.08883;
|
|
70380
71020
|
const fy = (L + 16) / 116;
|
|
70381
|
-
const fx =
|
|
70382
|
-
const fz = fy -
|
|
71021
|
+
const fx = a2 / 500 + fy;
|
|
71022
|
+
const fz = fy - b2 / 200;
|
|
70383
71023
|
const fx3 = fx * fx * fx;
|
|
70384
71024
|
const fz3 = fz * fz * fz;
|
|
70385
71025
|
const xr = fx3 > epsilon ? fx3 : (116 * fx - 16) / kappa;
|
|
@@ -70611,27 +71251,27 @@ function normalizeColor(color) {
|
|
|
70611
71251
|
const H = parseHueAngle(match[3]);
|
|
70612
71252
|
const alpha = parseModernAlpha(match[4]);
|
|
70613
71253
|
const hRad = H * Math.PI / 180;
|
|
70614
|
-
const [r, g,
|
|
70615
|
-
return rgbFloatToInt(r, g,
|
|
71254
|
+
const [r, g, b2] = oklabToSrgb(L, C * Math.cos(hRad), C * Math.sin(hRad));
|
|
71255
|
+
return rgbFloatToInt(r, g, b2, alpha);
|
|
70616
71256
|
}
|
|
70617
71257
|
}
|
|
70618
71258
|
if (matchers.oklab) {
|
|
70619
71259
|
if (match = matchers.oklab.exec(color)) {
|
|
70620
71260
|
const L = parseModernComponent(match[1], 1);
|
|
70621
|
-
const
|
|
70622
|
-
const
|
|
71261
|
+
const a2 = parseModernComponent(match[2], 0.4);
|
|
71262
|
+
const b2 = parseModernComponent(match[3], 0.4);
|
|
70623
71263
|
const alpha = parseModernAlpha(match[4]);
|
|
70624
|
-
const [r, g, bl] = oklabToSrgb(L,
|
|
71264
|
+
const [r, g, bl] = oklabToSrgb(L, a2, b2);
|
|
70625
71265
|
return rgbFloatToInt(r, g, bl, alpha);
|
|
70626
71266
|
}
|
|
70627
71267
|
}
|
|
70628
71268
|
if (matchers.lab) {
|
|
70629
71269
|
if (match = matchers.lab.exec(color)) {
|
|
70630
71270
|
const L = parseModernComponent(match[1], 100);
|
|
70631
|
-
const
|
|
70632
|
-
const
|
|
71271
|
+
const a2 = parseModernComponent(match[2], 125);
|
|
71272
|
+
const b2 = parseModernComponent(match[3], 125);
|
|
70633
71273
|
const alpha = parseModernAlpha(match[4]);
|
|
70634
|
-
const [r, g, bl] = labToSrgb(L,
|
|
71274
|
+
const [r, g, bl] = labToSrgb(L, a2, b2);
|
|
70635
71275
|
return rgbFloatToInt(r, g, bl, alpha);
|
|
70636
71276
|
}
|
|
70637
71277
|
}
|
|
@@ -70710,30 +71350,6 @@ var serializeScaleValue = ([x, y, z]) => {
|
|
|
70710
71350
|
return `${normalizedX} ${normalizedY} ${normalizedZ}`;
|
|
70711
71351
|
};
|
|
70712
71352
|
var ENABLE_V5_BREAKING_CHANGES = false;
|
|
70713
|
-
var validateFrame = ({
|
|
70714
|
-
allowFloats,
|
|
70715
|
-
durationInFrames,
|
|
70716
|
-
frame
|
|
70717
|
-
}) => {
|
|
70718
|
-
if (typeof frame === "undefined") {
|
|
70719
|
-
throw new TypeError(`Argument missing for parameter "frame"`);
|
|
70720
|
-
}
|
|
70721
|
-
if (typeof frame !== "number") {
|
|
70722
|
-
throw new TypeError(`Argument passed for "frame" is not a number: ${frame}`);
|
|
70723
|
-
}
|
|
70724
|
-
if (!Number.isFinite(frame)) {
|
|
70725
|
-
throw new RangeError(`Frame ${frame} is not finite`);
|
|
70726
|
-
}
|
|
70727
|
-
if (frame % 1 !== 0 && !allowFloats) {
|
|
70728
|
-
throw new RangeError(`Argument for frame must be an integer, but got ${frame}`);
|
|
70729
|
-
}
|
|
70730
|
-
if (frame < 0 && frame < -durationInFrames) {
|
|
70731
|
-
throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the lowest frame that can be rendered is ${-durationInFrames}`);
|
|
70732
|
-
}
|
|
70733
|
-
if (frame > durationInFrames - 1) {
|
|
70734
|
-
throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the highest frame that can be rendered is ${durationInFrames - 1}`);
|
|
70735
|
-
}
|
|
70736
|
-
};
|
|
70737
71353
|
var validCodecs = [
|
|
70738
71354
|
"h264",
|
|
70739
71355
|
"h265",
|
|
@@ -70805,23 +71421,6 @@ function validateDurationInFrames(durationInFrames, options) {
|
|
|
70805
71421
|
throw new TypeError(`The "durationInFrames" prop ${component} must be finite, but got ${durationInFrames}.`);
|
|
70806
71422
|
}
|
|
70807
71423
|
}
|
|
70808
|
-
function validateFps(fps, location, isGif) {
|
|
70809
|
-
if (typeof fps !== "number") {
|
|
70810
|
-
throw new Error(`"fps" must be a number, but you passed a value of type ${typeof fps} ${location}`);
|
|
70811
|
-
}
|
|
70812
|
-
if (!Number.isFinite(fps)) {
|
|
70813
|
-
throw new Error(`"fps" must be a finite, but you passed ${fps} ${location}`);
|
|
70814
|
-
}
|
|
70815
|
-
if (isNaN(fps)) {
|
|
70816
|
-
throw new Error(`"fps" must not be NaN, but got ${fps} ${location}`);
|
|
70817
|
-
}
|
|
70818
|
-
if (fps <= 0) {
|
|
70819
|
-
throw new TypeError(`"fps" must be positive, but got ${fps} ${location}`);
|
|
70820
|
-
}
|
|
70821
|
-
if (isGif && fps > 50) {
|
|
70822
|
-
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`);
|
|
70823
|
-
}
|
|
70824
|
-
}
|
|
70825
71424
|
var getExpectedMediaFrameUncorrected = ({
|
|
70826
71425
|
frame,
|
|
70827
71426
|
playbackRate,
|
|
@@ -70942,7 +71541,7 @@ var validateDownloadBehavior = (downloadBehavior) => {
|
|
|
70942
71541
|
}
|
|
70943
71542
|
}
|
|
70944
71543
|
};
|
|
70945
|
-
var VERSION = "4.0.
|
|
71544
|
+
var VERSION = "4.0.509";
|
|
70946
71545
|
var isColorSupported = () => {
|
|
70947
71546
|
const env = process.env || {};
|
|
70948
71547
|
const isForceDisabled = "NO_COLOR" in env;
|
|
@@ -71111,17 +71710,17 @@ var Log = {
|
|
|
71111
71710
|
return [
|
|
71112
71711
|
options.indent ? INDENT_TOKEN : null,
|
|
71113
71712
|
options.tag ? verboseTag(options.tag) : null
|
|
71114
|
-
].filter(truthy2).concat(args.map((
|
|
71713
|
+
].filter(truthy2).concat(args.map((a2) => {
|
|
71115
71714
|
if (logLevel === "warn") {
|
|
71116
|
-
return chalk.yellow(
|
|
71715
|
+
return chalk.yellow(a2);
|
|
71117
71716
|
}
|
|
71118
71717
|
if (logLevel === "error") {
|
|
71119
|
-
return chalk.red(
|
|
71718
|
+
return chalk.red(a2);
|
|
71120
71719
|
}
|
|
71121
71720
|
if (logLevel === "verbose" || logLevel === "trace") {
|
|
71122
|
-
return chalk.gray(
|
|
71721
|
+
return chalk.gray(a2);
|
|
71123
71722
|
}
|
|
71124
|
-
return
|
|
71723
|
+
return a2;
|
|
71125
71724
|
}));
|
|
71126
71725
|
},
|
|
71127
71726
|
trace: (options, ...args) => {
|
|
@@ -71409,7 +72008,7 @@ var calculateBillingDuration = ({
|
|
|
71409
72008
|
functionsInvoked,
|
|
71410
72009
|
elapsedTimeOfUnfinishedChunks
|
|
71411
72010
|
}) => {
|
|
71412
|
-
const completedChunksDuration = timings.map((p) => Math.max(0, p.rendered - p.start) + OVERHEAD_TIME_PER_LAMBDA).reduce((
|
|
72011
|
+
const completedChunksDuration = timings.map((p) => Math.max(0, p.rendered - p.start) + OVERHEAD_TIME_PER_LAMBDA).reduce((a2, b2) => a2 + b2, 0);
|
|
71413
72012
|
const unfinished = Math.max(0, functionsInvoked - timings.length);
|
|
71414
72013
|
return completedChunksDuration + unfinished * elapsedTimeOfUnfinishedChunks;
|
|
71415
72014
|
};
|
|
@@ -71456,7 +72055,7 @@ var calculateChunkTimes = ({
|
|
|
71456
72055
|
const parsedTimings = timings;
|
|
71457
72056
|
const absoluteTime = getAbsoluteTime(parsedTimings);
|
|
71458
72057
|
if (type === "combined-time-for-cost-calculation") {
|
|
71459
|
-
const totalEncodingTimings = parsedTimings.map((p) => Math.max(0, p.rendered - p.start)).reduce((
|
|
72058
|
+
const totalEncodingTimings = parsedTimings.map((p) => Math.max(0, p.rendered - p.start)).reduce((a2, b2) => a2 + b2, 0);
|
|
71460
72059
|
return totalEncodingTimings + absoluteTime;
|
|
71461
72060
|
}
|
|
71462
72061
|
if (type === "absolute-time") {
|
|
@@ -71486,7 +72085,7 @@ var internalGetOrCreateBucket = async (params) => {
|
|
|
71486
72085
|
requestHandler: params.requestHandler
|
|
71487
72086
|
});
|
|
71488
72087
|
if (remotionBuckets.length > 1) {
|
|
71489
|
-
throw new Error(`You have multiple buckets (${remotionBuckets.map((
|
|
72088
|
+
throw new Error(`You have multiple buckets (${remotionBuckets.map((b2) => b2.name)}) in your S3 region (${params.region}) starting with "${params.providerSpecifics.getBucketPrefix()}". Please see https://remotion.dev/docs/lambda/multiple-buckets.`);
|
|
71490
72089
|
}
|
|
71491
72090
|
const { enableFolderExpiry, region } = params;
|
|
71492
72091
|
if (remotionBuckets.length === 1) {
|
|
@@ -71575,7 +72174,7 @@ var getNeedsToUpload = ({
|
|
|
71575
72174
|
}) => {
|
|
71576
72175
|
const MARGIN = 5000 + MAX_WEBHOOK_CUSTOM_DATA_SIZE;
|
|
71577
72176
|
const MAX_INLINE_PAYLOAD_SIZE = (type === "still" ? providerSpecifics.getMaxStillInlinePayloadSize() : providerSpecifics.getMaxNonInlinePayloadSizePerFunction()) - MARGIN;
|
|
71578
|
-
const sizesAlreadyUsed = sizes.reduce((
|
|
72177
|
+
const sizesAlreadyUsed = sizes.reduce((a2, b2) => a2 + b2);
|
|
71579
72178
|
if (sizesAlreadyUsed > MAX_INLINE_PAYLOAD_SIZE) {
|
|
71580
72179
|
console.warn(`Warning: The props are over ${Math.round(MAX_INLINE_PAYLOAD_SIZE / 1000)}KB (${Math.ceil(sizesAlreadyUsed / 1024)}KB) in size. Uploading them to ${providerSpecifics.serverStorageProductName()} to circumvent AWS Lambda payload size, which may lead to slowdown.`);
|
|
71581
72180
|
return true;
|
|
@@ -72459,7 +73058,7 @@ var getOverallProgress = ({
|
|
|
72459
73058
|
Boolean(invokedLambda),
|
|
72460
73059
|
Boolean(visitedServeUrl),
|
|
72461
73060
|
Boolean(gotComposition)
|
|
72462
|
-
].reduce((
|
|
73061
|
+
].reduce((a2, b2) => Number(a2) + Number(b2), 0) / 3;
|
|
72463
73062
|
return evaluationProgress * weights.evaluating + encoding * weights.encoding + invoking * weights.invoking + frames * weights.frames + combining * weights.combining;
|
|
72464
73063
|
};
|
|
72465
73064
|
var MAX_MISSING_CHUNKS = 5;
|
|
@@ -72757,7 +73356,7 @@ var getProgress = async ({
|
|
|
72757
73356
|
const allChunks = (overallProgress.chunks ?? []).length / chunkMultiplier === (renderMetadata.totalChunks ?? Infinity);
|
|
72758
73357
|
const frameCount = NoReactAPIs.getFramesToRender(renderMetadata.frameRange, renderMetadata.everyNthFrame).length;
|
|
72759
73358
|
const missingChunks = new Array(renderMetadata.totalChunks).fill(true).map((_, i) => i).filter((index) => {
|
|
72760
|
-
return typeof (overallProgress.chunks ?? []).find((
|
|
73359
|
+
return typeof (overallProgress.chunks ?? []).find((c2) => c2 === index) === "undefined";
|
|
72761
73360
|
});
|
|
72762
73361
|
const isBeyondTimeoutAndMissingChunks = Date.now() > renderMetadata.startedDate + timeoutInMilliseconds + 20000 && missingChunks && missingChunks.length > 0;
|
|
72763
73362
|
const isBeyondTimeoutAndHasStitchTimeout = Date.now() > renderMetadata.startedDate + timeoutInMilliseconds * 2 + 20000;
|
|
@@ -74583,11 +75182,11 @@ var getRemotionBuckets = async ({
|
|
|
74583
75182
|
if (!Buckets) {
|
|
74584
75183
|
return [];
|
|
74585
75184
|
}
|
|
74586
|
-
const remotionBuckets = Buckets.filter((
|
|
75185
|
+
const remotionBuckets = Buckets.filter((b2) => {
|
|
74587
75186
|
if (forceBucketName) {
|
|
74588
|
-
return
|
|
75187
|
+
return b2.Name === forceBucketName;
|
|
74589
75188
|
}
|
|
74590
|
-
return
|
|
75189
|
+
return b2.Name?.startsWith(REMOTION_BUCKET_PREFIX);
|
|
74591
75190
|
});
|
|
74592
75191
|
const locations = await Promise.all(remotionBuckets.map(async (bucket) => {
|
|
74593
75192
|
const { region: parsedRegion } = parseBucketName(bucket.Name);
|
|
@@ -74617,7 +75216,7 @@ var getRemotionBuckets = async ({
|
|
|
74617
75216
|
name: bucket.Name,
|
|
74618
75217
|
region: locations[i]
|
|
74619
75218
|
};
|
|
74620
|
-
}).filter((
|
|
75219
|
+
}).filter((b2) => b2.region);
|
|
74621
75220
|
return bucketsWithLocation.filter((bucket) => {
|
|
74622
75221
|
return bucket.region === region;
|
|
74623
75222
|
});
|
|
@@ -75490,7 +76089,7 @@ If this is not correct, provide an override value by setting a number
|
|
|
75490
76089
|
to input.params.ContentLength in bytes.
|
|
75491
76090
|
`);
|
|
75492
76091
|
}
|
|
75493
|
-
this.uploadedParts.sort((
|
|
76092
|
+
this.uploadedParts.sort((a2, b2) => a2.PartNumber - b2.PartNumber);
|
|
75494
76093
|
const uploadCompleteParams = {
|
|
75495
76094
|
...this.params,
|
|
75496
76095
|
Body: undefined,
|
|
@@ -75860,8 +76459,8 @@ var internalDeleteRender = async (input) => {
|
|
|
75860
76459
|
});
|
|
75861
76460
|
let totalSize = 0;
|
|
75862
76461
|
while (files.length > 0) {
|
|
75863
|
-
totalSize += files.reduce((
|
|
75864
|
-
return
|
|
76462
|
+
totalSize += files.reduce((a2, b2) => {
|
|
76463
|
+
return a2 + (b2.Size ?? 0);
|
|
75865
76464
|
}, 0);
|
|
75866
76465
|
await cleanItems({
|
|
75867
76466
|
list: files.map((f) => f.Key),
|