@remotion/lambda-client 4.0.508 → 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.
@@ -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 TypeError(`Cannot interpolate "${value}" because "${component}" is not a supported scale, translate, or rotate value`);
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]);
@@ -69740,6 +70235,52 @@ var interpolateString = ({
69740
70235
  axisRotation: hasAxisRotation
69741
70236
  });
69742
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
+ };
69743
70284
  var validateTupleOutputRange = (outputRange) => {
69744
70285
  const dimensions = outputRange[0]?.length;
69745
70286
  if (dimensions === undefined) {
@@ -69854,7 +70395,30 @@ function interpolate(input, inputRange, outputRange, options) {
69854
70395
  if (!outputRange.every((output) => typeof output === "string" || typeof output === "number")) {
69855
70396
  throw new TypeError("outputRange must contain only numbers, or supported scale, translate, and rotate strings");
69856
70397
  }
69857
- return interpolateString({ input, inputRange, outputRange, options });
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
+ }
69858
70422
  }
69859
70423
  if (outputRange.every((output) => Array.isArray(output))) {
69860
70424
  return interpolateTuple({ input, inputRange, outputRange, options });
@@ -69865,8 +70429,8 @@ function interpolate(input, inputRange, outputRange, options) {
69865
70429
  checkInfiniteRange("outputRange", outputRange);
69866
70430
  return interpolateNumber({ input, inputRange, outputRange, options });
69867
70431
  }
69868
- function mulberry32(a) {
69869
- let t = a + 1831565813;
70432
+ function mulberry32(a2) {
70433
+ let t = a2 + 1831565813;
69870
70434
  t = Math.imul(t ^ t >>> 15, t | 1);
69871
70435
  t ^= t + Math.imul(t ^ t >>> 7, t | 61);
69872
70436
  return ((t ^ t >>> 14) >>> 0) / 4294967296;
@@ -70355,8 +70919,8 @@ function hslToRgb(h, s, l) {
70355
70919
  const p = 2 * l - q;
70356
70920
  const r = hue2rgb(p, q, h + 1 / 3);
70357
70921
  const g = hue2rgb(p, q, h);
70358
- const b = hue2rgb(p, q, h - 1 / 3);
70359
- return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8;
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;
70360
70924
  }
70361
70925
  function parse255(str) {
70362
70926
  const int = Number.parseInt(str, 10);
@@ -70420,25 +70984,25 @@ function parseModernAlpha(str) {
70420
70984
  }
70421
70985
  return Math.max(0, Math.min(1, Number.parseFloat(str)));
70422
70986
  }
70423
- function linearToSrgb(c) {
70424
- if (c <= 0.0031308)
70425
- return 12.92 * c;
70426
- return 1.055 * c ** (1 / 2.4) - 0.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;
70427
70991
  }
70428
70992
  function clamp01(v) {
70429
70993
  return Math.max(0, Math.min(1, v));
70430
70994
  }
70431
- function rgbFloatToInt(r, g, b, alpha) {
70995
+ function rgbFloatToInt(r, g, b2, alpha) {
70432
70996
  const ri = Math.round(clamp01(r) * 255);
70433
70997
  const gi = Math.round(clamp01(g) * 255);
70434
- const bi = Math.round(clamp01(b) * 255);
70998
+ const bi = Math.round(clamp01(b2) * 255);
70435
70999
  const ai = Math.round(clamp01(alpha) * 255);
70436
71000
  return (ri << 24 | gi << 16 | bi << 8 | ai) >>> 0;
70437
71001
  }
70438
- function oklabToSrgb(L, a, b) {
70439
- const l_ = L + 0.3963377774 * a + 0.2158037573 * b;
70440
- const m_ = L - 0.1055613458 * a - 0.0638541728 * b;
70441
- const s_ = L - 0.0894841775 * a - 1.291485548 * b;
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;
70442
71006
  const l = l_ * l_ * l_;
70443
71007
  const m = m_ * m_ * m_;
70444
71008
  const s = s_ * s_ * s_;
@@ -70447,15 +71011,15 @@ function oklabToSrgb(L, a, b) {
70447
71011
  const bLin = -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s;
70448
71012
  return [linearToSrgb(rLin), linearToSrgb(gLin), linearToSrgb(bLin)];
70449
71013
  }
70450
- function labToSrgb(L, a, b) {
71014
+ function labToSrgb(L, a2, b2) {
70451
71015
  const epsilon = 216 / 24389;
70452
71016
  const kappa = 24389 / 27;
70453
71017
  const Xn = 0.95047;
70454
71018
  const Yn = 1;
70455
71019
  const Zn = 1.08883;
70456
71020
  const fy = (L + 16) / 116;
70457
- const fx = a / 500 + fy;
70458
- const fz = fy - b / 200;
71021
+ const fx = a2 / 500 + fy;
71022
+ const fz = fy - b2 / 200;
70459
71023
  const fx3 = fx * fx * fx;
70460
71024
  const fz3 = fz * fz * fz;
70461
71025
  const xr = fx3 > epsilon ? fx3 : (116 * fx - 16) / kappa;
@@ -70687,27 +71251,27 @@ function normalizeColor(color) {
70687
71251
  const H = parseHueAngle(match[3]);
70688
71252
  const alpha = parseModernAlpha(match[4]);
70689
71253
  const hRad = H * Math.PI / 180;
70690
- const [r, g, b] = oklabToSrgb(L, C * Math.cos(hRad), C * Math.sin(hRad));
70691
- return rgbFloatToInt(r, g, b, alpha);
71254
+ const [r, g, b2] = oklabToSrgb(L, C * Math.cos(hRad), C * Math.sin(hRad));
71255
+ return rgbFloatToInt(r, g, b2, alpha);
70692
71256
  }
70693
71257
  }
70694
71258
  if (matchers.oklab) {
70695
71259
  if (match = matchers.oklab.exec(color)) {
70696
71260
  const L = parseModernComponent(match[1], 1);
70697
- const a = parseModernComponent(match[2], 0.4);
70698
- const b = parseModernComponent(match[3], 0.4);
71261
+ const a2 = parseModernComponent(match[2], 0.4);
71262
+ const b2 = parseModernComponent(match[3], 0.4);
70699
71263
  const alpha = parseModernAlpha(match[4]);
70700
- const [r, g, bl] = oklabToSrgb(L, a, b);
71264
+ const [r, g, bl] = oklabToSrgb(L, a2, b2);
70701
71265
  return rgbFloatToInt(r, g, bl, alpha);
70702
71266
  }
70703
71267
  }
70704
71268
  if (matchers.lab) {
70705
71269
  if (match = matchers.lab.exec(color)) {
70706
71270
  const L = parseModernComponent(match[1], 100);
70707
- const a = parseModernComponent(match[2], 125);
70708
- const b = parseModernComponent(match[3], 125);
71271
+ const a2 = parseModernComponent(match[2], 125);
71272
+ const b2 = parseModernComponent(match[3], 125);
70709
71273
  const alpha = parseModernAlpha(match[4]);
70710
- const [r, g, bl] = labToSrgb(L, a, b);
71274
+ const [r, g, bl] = labToSrgb(L, a2, b2);
70711
71275
  return rgbFloatToInt(r, g, bl, alpha);
70712
71276
  }
70713
71277
  }
@@ -70786,30 +71350,6 @@ var serializeScaleValue = ([x, y, z]) => {
70786
71350
  return `${normalizedX} ${normalizedY} ${normalizedZ}`;
70787
71351
  };
70788
71352
  var ENABLE_V5_BREAKING_CHANGES = false;
70789
- var validateFrame = ({
70790
- allowFloats,
70791
- durationInFrames,
70792
- frame
70793
- }) => {
70794
- if (typeof frame === "undefined") {
70795
- throw new TypeError(`Argument missing for parameter "frame"`);
70796
- }
70797
- if (typeof frame !== "number") {
70798
- throw new TypeError(`Argument passed for "frame" is not a number: ${frame}`);
70799
- }
70800
- if (!Number.isFinite(frame)) {
70801
- throw new RangeError(`Frame ${frame} is not finite`);
70802
- }
70803
- if (frame % 1 !== 0 && !allowFloats) {
70804
- throw new RangeError(`Argument for frame must be an integer, but got ${frame}`);
70805
- }
70806
- if (frame < 0 && frame < -durationInFrames) {
70807
- throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the lowest frame that can be rendered is ${-durationInFrames}`);
70808
- }
70809
- if (frame > durationInFrames - 1) {
70810
- throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the highest frame that can be rendered is ${durationInFrames - 1}`);
70811
- }
70812
- };
70813
71353
  var validCodecs = [
70814
71354
  "h264",
70815
71355
  "h265",
@@ -70881,23 +71421,6 @@ function validateDurationInFrames(durationInFrames, options) {
70881
71421
  throw new TypeError(`The "durationInFrames" prop ${component} must be finite, but got ${durationInFrames}.`);
70882
71422
  }
70883
71423
  }
70884
- function validateFps(fps, location, isGif) {
70885
- if (typeof fps !== "number") {
70886
- throw new Error(`"fps" must be a number, but you passed a value of type ${typeof fps} ${location}`);
70887
- }
70888
- if (!Number.isFinite(fps)) {
70889
- throw new Error(`"fps" must be a finite, but you passed ${fps} ${location}`);
70890
- }
70891
- if (isNaN(fps)) {
70892
- throw new Error(`"fps" must not be NaN, but got ${fps} ${location}`);
70893
- }
70894
- if (fps <= 0) {
70895
- throw new TypeError(`"fps" must be positive, but got ${fps} ${location}`);
70896
- }
70897
- if (isGif && fps > 50) {
70898
- 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`);
70899
- }
70900
- }
70901
71424
  var getExpectedMediaFrameUncorrected = ({
70902
71425
  frame,
70903
71426
  playbackRate,
@@ -71018,7 +71541,7 @@ var validateDownloadBehavior = (downloadBehavior) => {
71018
71541
  }
71019
71542
  }
71020
71543
  };
71021
- var VERSION = "4.0.508";
71544
+ var VERSION = "4.0.509";
71022
71545
  var isColorSupported = () => {
71023
71546
  const env = process.env || {};
71024
71547
  const isForceDisabled = "NO_COLOR" in env;
@@ -71187,17 +71710,17 @@ var Log = {
71187
71710
  return [
71188
71711
  options.indent ? INDENT_TOKEN : null,
71189
71712
  options.tag ? verboseTag(options.tag) : null
71190
- ].filter(truthy2).concat(args.map((a) => {
71713
+ ].filter(truthy2).concat(args.map((a2) => {
71191
71714
  if (logLevel === "warn") {
71192
- return chalk.yellow(a);
71715
+ return chalk.yellow(a2);
71193
71716
  }
71194
71717
  if (logLevel === "error") {
71195
- return chalk.red(a);
71718
+ return chalk.red(a2);
71196
71719
  }
71197
71720
  if (logLevel === "verbose" || logLevel === "trace") {
71198
- return chalk.gray(a);
71721
+ return chalk.gray(a2);
71199
71722
  }
71200
- return a;
71723
+ return a2;
71201
71724
  }));
71202
71725
  },
71203
71726
  trace: (options, ...args) => {
@@ -71485,7 +72008,7 @@ var calculateBillingDuration = ({
71485
72008
  functionsInvoked,
71486
72009
  elapsedTimeOfUnfinishedChunks
71487
72010
  }) => {
71488
- const completedChunksDuration = timings.map((p) => Math.max(0, p.rendered - p.start) + OVERHEAD_TIME_PER_LAMBDA).reduce((a, b) => a + b, 0);
72011
+ const completedChunksDuration = timings.map((p) => Math.max(0, p.rendered - p.start) + OVERHEAD_TIME_PER_LAMBDA).reduce((a2, b2) => a2 + b2, 0);
71489
72012
  const unfinished = Math.max(0, functionsInvoked - timings.length);
71490
72013
  return completedChunksDuration + unfinished * elapsedTimeOfUnfinishedChunks;
71491
72014
  };
@@ -71532,7 +72055,7 @@ var calculateChunkTimes = ({
71532
72055
  const parsedTimings = timings;
71533
72056
  const absoluteTime = getAbsoluteTime(parsedTimings);
71534
72057
  if (type === "combined-time-for-cost-calculation") {
71535
- const totalEncodingTimings = parsedTimings.map((p) => Math.max(0, p.rendered - p.start)).reduce((a, b) => a + b, 0);
72058
+ const totalEncodingTimings = parsedTimings.map((p) => Math.max(0, p.rendered - p.start)).reduce((a2, b2) => a2 + b2, 0);
71536
72059
  return totalEncodingTimings + absoluteTime;
71537
72060
  }
71538
72061
  if (type === "absolute-time") {
@@ -71562,7 +72085,7 @@ var internalGetOrCreateBucket = async (params) => {
71562
72085
  requestHandler: params.requestHandler
71563
72086
  });
71564
72087
  if (remotionBuckets.length > 1) {
71565
- throw new Error(`You have multiple buckets (${remotionBuckets.map((b) => b.name)}) in your S3 region (${params.region}) starting with "${params.providerSpecifics.getBucketPrefix()}". Please see https://remotion.dev/docs/lambda/multiple-buckets.`);
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.`);
71566
72089
  }
71567
72090
  const { enableFolderExpiry, region } = params;
71568
72091
  if (remotionBuckets.length === 1) {
@@ -71651,7 +72174,7 @@ var getNeedsToUpload = ({
71651
72174
  }) => {
71652
72175
  const MARGIN = 5000 + MAX_WEBHOOK_CUSTOM_DATA_SIZE;
71653
72176
  const MAX_INLINE_PAYLOAD_SIZE = (type === "still" ? providerSpecifics.getMaxStillInlinePayloadSize() : providerSpecifics.getMaxNonInlinePayloadSizePerFunction()) - MARGIN;
71654
- const sizesAlreadyUsed = sizes.reduce((a, b) => a + b);
72177
+ const sizesAlreadyUsed = sizes.reduce((a2, b2) => a2 + b2);
71655
72178
  if (sizesAlreadyUsed > MAX_INLINE_PAYLOAD_SIZE) {
71656
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.`);
71657
72180
  return true;
@@ -72535,7 +73058,7 @@ var getOverallProgress = ({
72535
73058
  Boolean(invokedLambda),
72536
73059
  Boolean(visitedServeUrl),
72537
73060
  Boolean(gotComposition)
72538
- ].reduce((a, b) => Number(a) + Number(b), 0) / 3;
73061
+ ].reduce((a2, b2) => Number(a2) + Number(b2), 0) / 3;
72539
73062
  return evaluationProgress * weights.evaluating + encoding * weights.encoding + invoking * weights.invoking + frames * weights.frames + combining * weights.combining;
72540
73063
  };
72541
73064
  var MAX_MISSING_CHUNKS = 5;
@@ -72833,7 +73356,7 @@ var getProgress = async ({
72833
73356
  const allChunks = (overallProgress.chunks ?? []).length / chunkMultiplier === (renderMetadata.totalChunks ?? Infinity);
72834
73357
  const frameCount = NoReactAPIs.getFramesToRender(renderMetadata.frameRange, renderMetadata.everyNthFrame).length;
72835
73358
  const missingChunks = new Array(renderMetadata.totalChunks).fill(true).map((_, i) => i).filter((index) => {
72836
- return typeof (overallProgress.chunks ?? []).find((c) => c === index) === "undefined";
73359
+ return typeof (overallProgress.chunks ?? []).find((c2) => c2 === index) === "undefined";
72837
73360
  });
72838
73361
  const isBeyondTimeoutAndMissingChunks = Date.now() > renderMetadata.startedDate + timeoutInMilliseconds + 20000 && missingChunks && missingChunks.length > 0;
72839
73362
  const isBeyondTimeoutAndHasStitchTimeout = Date.now() > renderMetadata.startedDate + timeoutInMilliseconds * 2 + 20000;
@@ -74659,11 +75182,11 @@ var getRemotionBuckets = async ({
74659
75182
  if (!Buckets) {
74660
75183
  return [];
74661
75184
  }
74662
- const remotionBuckets = Buckets.filter((b) => {
75185
+ const remotionBuckets = Buckets.filter((b2) => {
74663
75186
  if (forceBucketName) {
74664
- return b.Name === forceBucketName;
75187
+ return b2.Name === forceBucketName;
74665
75188
  }
74666
- return b.Name?.startsWith(REMOTION_BUCKET_PREFIX);
75189
+ return b2.Name?.startsWith(REMOTION_BUCKET_PREFIX);
74667
75190
  });
74668
75191
  const locations = await Promise.all(remotionBuckets.map(async (bucket) => {
74669
75192
  const { region: parsedRegion } = parseBucketName(bucket.Name);
@@ -74693,7 +75216,7 @@ var getRemotionBuckets = async ({
74693
75216
  name: bucket.Name,
74694
75217
  region: locations[i]
74695
75218
  };
74696
- }).filter((b) => b.region);
75219
+ }).filter((b2) => b2.region);
74697
75220
  return bucketsWithLocation.filter((bucket) => {
74698
75221
  return bucket.region === region;
74699
75222
  });
@@ -75566,7 +76089,7 @@ If this is not correct, provide an override value by setting a number
75566
76089
  to input.params.ContentLength in bytes.
75567
76090
  `);
75568
76091
  }
75569
- this.uploadedParts.sort((a, b) => a.PartNumber - b.PartNumber);
76092
+ this.uploadedParts.sort((a2, b2) => a2.PartNumber - b2.PartNumber);
75570
76093
  const uploadCompleteParams = {
75571
76094
  ...this.params,
75572
76095
  Body: undefined,
@@ -75936,8 +76459,8 @@ var internalDeleteRender = async (input) => {
75936
76459
  });
75937
76460
  let totalSize = 0;
75938
76461
  while (files.length > 0) {
75939
- totalSize += files.reduce((a, b) => {
75940
- return a + (b.Size ?? 0);
76462
+ totalSize += files.reduce((a2, b2) => {
76463
+ return a2 + (b2.Size ?? 0);
75941
76464
  }, 0);
75942
76465
  await cleanItems({
75943
76466
  list: files.map((f) => f.Key),