@remotion/lambda-client 4.0.508 → 4.0.510

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.510";
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") {
@@ -71542,10 +72065,11 @@ var calculateChunkTimes = ({
71542
72065
  };
71543
72066
  var checkBucketListing = async ({
71544
72067
  bucketName,
71545
- region
72068
+ region,
72069
+ dnsSuffix
71546
72070
  }) => {
71547
72071
  try {
71548
- const res = await fetch(`https://${bucketName}.s3.${region}.amazonaws.com/`);
72072
+ const res = await fetch(`https://${bucketName}.s3.${region}.${dnsSuffix}/`);
71549
72073
  if (res.status === 200) {
71550
72074
  console.warn(`Warning: Your bucket ${bucketName} allows public listing of its contents. See https://remotion.dev/docs/lambda/bucket-security for how to fix this.`);
71551
72075
  }
@@ -71562,7 +72086,7 @@ var internalGetOrCreateBucket = async (params) => {
71562
72086
  requestHandler: params.requestHandler
71563
72087
  });
71564
72088
  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.`);
72089
+ 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
72090
  }
71567
72091
  const { enableFolderExpiry, region } = params;
71568
72092
  if (remotionBuckets.length === 1) {
@@ -71575,7 +72099,11 @@ var internalGetOrCreateBucket = async (params) => {
71575
72099
  forcePathStyle: params.forcePathStyle,
71576
72100
  requestHandler: params.requestHandler
71577
72101
  });
71578
- await checkBucketListing({ bucketName: existingBucketName, region });
72102
+ await checkBucketListing({
72103
+ bucketName: existingBucketName,
72104
+ region,
72105
+ dnsSuffix: params.providerSpecifics.getServiceDnsSuffix(region)
72106
+ });
71579
72107
  return { bucketName: remotionBuckets[0].name, alreadyExisted: true };
71580
72108
  }
71581
72109
  const bucketName = makeBucketName(params.region, params.providerSpecifics);
@@ -71651,7 +72179,7 @@ var getNeedsToUpload = ({
71651
72179
  }) => {
71652
72180
  const MARGIN = 5000 + MAX_WEBHOOK_CUSTOM_DATA_SIZE;
71653
72181
  const MAX_INLINE_PAYLOAD_SIZE = (type === "still" ? providerSpecifics.getMaxStillInlinePayloadSize() : providerSpecifics.getMaxNonInlinePayloadSizePerFunction()) - MARGIN;
71654
- const sizesAlreadyUsed = sizes.reduce((a, b) => a + b);
72182
+ const sizesAlreadyUsed = sizes.reduce((a2, b2) => a2 + b2);
71655
72183
  if (sizesAlreadyUsed > MAX_INLINE_PAYLOAD_SIZE) {
71656
72184
  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
72185
  return true;
@@ -72432,22 +72960,22 @@ var findOutputFileInBucket = async ({
72432
72960
  throw err;
72433
72961
  }
72434
72962
  };
72435
- var display = (accrued) => {
72963
+ var display = (accrued, currency) => {
72436
72964
  if (accrued < 0.001) {
72437
- return "<$0.001";
72965
+ return `<${currency === "CNY" ? "¥" : "$"}0.001`;
72438
72966
  }
72439
72967
  return new Intl.NumberFormat("en-US", {
72440
- currency: "USD",
72968
+ currency,
72441
72969
  style: "currency",
72442
72970
  currencyDisplay: "narrowSymbol",
72443
72971
  minimumFractionDigits: 3
72444
72972
  }).format(accrued);
72445
72973
  };
72446
- var formatCostsInfo = (accrued) => {
72974
+ var formatCostsInfo = (accrued, currency = "USD") => {
72447
72975
  return {
72448
72976
  accruedSoFar: accrued,
72449
- displayCost: display(accrued),
72450
- currency: "USD",
72977
+ displayCost: display(accrued, currency),
72978
+ currency,
72451
72979
  disclaimer: "Estimated cost only. Does not include charges for other AWS services."
72452
72980
  };
72453
72981
  };
@@ -72535,7 +73063,7 @@ var getOverallProgress = ({
72535
73063
  Boolean(invokedLambda),
72536
73064
  Boolean(visitedServeUrl),
72537
73065
  Boolean(gotComposition)
72538
- ].reduce((a, b) => Number(a) + Number(b), 0) / 3;
73066
+ ].reduce((a2, b2) => Number(a2) + Number(b2), 0) / 3;
72539
73067
  return evaluationProgress * weights.evaluating + encoding * weights.encoding + invoking * weights.invoking + frames * weights.frames + combining * weights.combining;
72540
73068
  };
72541
73069
  var MAX_MISSING_CHUNKS = 5;
@@ -72682,6 +73210,7 @@ var getProgress = async ({
72682
73210
  functionName,
72683
73211
  requestHandler
72684
73212
  }) => {
73213
+ const billingCurrency = providerSpecifics.getBillingCurrency(region);
72685
73214
  const overallProgress = await getOverallProgressFromStorage({
72686
73215
  renderId,
72687
73216
  bucketName,
@@ -72777,7 +73306,7 @@ var getProgress = async ({
72777
73306
  timeToCombine: overallProgress.timeToCombine
72778
73307
  },
72779
73308
  timeToRenderFrames: overallProgress.timeToRenderFrames,
72780
- costs: formatCostsInfo(0),
73309
+ costs: formatCostsInfo(0, billingCurrency),
72781
73310
  renderId,
72782
73311
  renderMetadata,
72783
73312
  bucket: bucketName,
@@ -72833,7 +73362,7 @@ var getProgress = async ({
72833
73362
  const allChunks = (overallProgress.chunks ?? []).length / chunkMultiplier === (renderMetadata.totalChunks ?? Infinity);
72834
73363
  const frameCount = NoReactAPIs.getFramesToRender(renderMetadata.frameRange, renderMetadata.everyNthFrame).length;
72835
73364
  const missingChunks = new Array(renderMetadata.totalChunks).fill(true).map((_, i) => i).filter((index) => {
72836
- return typeof (overallProgress.chunks ?? []).find((c) => c === index) === "undefined";
73365
+ return typeof (overallProgress.chunks ?? []).find((c2) => c2 === index) === "undefined";
72837
73366
  });
72838
73367
  const isBeyondTimeoutAndMissingChunks = Date.now() > renderMetadata.startedDate + timeoutInMilliseconds + 20000 && missingChunks && missingChunks.length > 0;
72839
73368
  const isBeyondTimeoutAndHasStitchTimeout = Date.now() > renderMetadata.startedDate + timeoutInMilliseconds * 2 + 20000;
@@ -72871,7 +73400,7 @@ var getProgress = async ({
72871
73400
  filesDeleted: 0,
72872
73401
  minFilesToDelete: 0
72873
73402
  },
72874
- costs: priceFromBucket ? formatCostsInfo(priceFromBucket.accruedSoFar) : formatCostsInfo(0),
73403
+ costs: priceFromBucket ? formatCostsInfo(priceFromBucket.accruedSoFar, billingCurrency) : formatCostsInfo(0, billingCurrency),
72875
73404
  currentTime: now,
72876
73405
  done: true,
72877
73406
  encodingStatus: {
@@ -72929,7 +73458,7 @@ var getProgress = async ({
72929
73458
  timeToCombine: overallProgress.timeToCombine
72930
73459
  },
72931
73460
  timeToRenderFrames: overallProgress.timeToRenderFrames,
72932
- costs: priceFromBucket ? formatCostsInfo(priceFromBucket.accruedSoFar) : formatCostsInfo(0),
73461
+ costs: priceFromBucket ? formatCostsInfo(priceFromBucket.accruedSoFar, billingCurrency) : formatCostsInfo(0, billingCurrency),
72933
73462
  renderId,
72934
73463
  renderMetadata,
72935
73464
  bucket: bucketName,
@@ -73311,6 +73840,51 @@ function getStsClient(region, requestHandler) {
73311
73840
  // src/aws-provider.ts
73312
73841
  import { EventEmitter } from "node:events";
73313
73842
 
73843
+ // src/aws-region-metadata.ts
73844
+ var regionPartitions = {
73845
+ "af-south-1": "aws",
73846
+ "ap-east-1": "aws",
73847
+ "ap-northeast-1": "aws",
73848
+ "ap-northeast-2": "aws",
73849
+ "ap-northeast-3": "aws",
73850
+ "ap-south-1": "aws",
73851
+ "ap-southeast-1": "aws",
73852
+ "ap-southeast-2": "aws",
73853
+ "ap-southeast-4": "aws",
73854
+ "ap-southeast-5": "aws",
73855
+ "ca-central-1": "aws",
73856
+ "cn-north-1": "aws-cn",
73857
+ "cn-northwest-1": "aws-cn",
73858
+ "eu-central-1": "aws",
73859
+ "eu-central-2": "aws",
73860
+ "eu-north-1": "aws",
73861
+ "eu-south-1": "aws",
73862
+ "eu-west-1": "aws",
73863
+ "eu-west-2": "aws",
73864
+ "eu-west-3": "aws",
73865
+ "sa-east-1": "aws",
73866
+ "us-east-1": "aws",
73867
+ "us-east-2": "aws",
73868
+ "us-west-1": "aws",
73869
+ "us-west-2": "aws"
73870
+ };
73871
+ var partitionMetadata = {
73872
+ aws: {
73873
+ partition: "aws",
73874
+ dnsSuffix: "amazonaws.com",
73875
+ consoleDomain: "console.aws.amazon.com",
73876
+ billingCurrency: "USD"
73877
+ },
73878
+ "aws-cn": {
73879
+ partition: "aws-cn",
73880
+ dnsSuffix: "amazonaws.com.cn",
73881
+ consoleDomain: "console.amazonaws.cn",
73882
+ billingCurrency: "CNY"
73883
+ }
73884
+ };
73885
+ var getAwsPartitionMetadata = (partition) => partitionMetadata[partition];
73886
+ var getAwsRegionMetadata = (region) => getAwsPartitionMetadata(regionPartitions[region]);
73887
+
73314
73888
  // src/bucket-exists.ts
73315
73889
  var import_client_s32 = __toESM(require_dist_cjs79(), 1);
73316
73890
 
@@ -73458,7 +74032,8 @@ var callLambdaWithStreamingWithoutRetry = async ({
73458
74032
  }
73459
74033
  if (event.InvokeComplete) {
73460
74034
  if (event.InvokeComplete.ErrorCode) {
73461
- const logs = `https://${region}.console.aws.amazon.com/cloudwatch/home?region=${region}#logsV2:logs-insights$3FqueryDetail$3D~(end~0~start~-3600~timeType~'RELATIVE~unit~'seconds~editorString~'fields*20*40timestamp*2c*20*40requestId*2c*20*40message*0a*7c*20filter*20*40requestId*20like*20*${res.$metadata.requestId}*22*0a*7c*20sort*20*40timestamp*20asc~source~(~'*2faws*2flambda*2f${functionName}))`;
74035
+ const { consoleDomain } = getAwsRegionMetadata(region);
74036
+ const logs = `https://${region}.${consoleDomain}/cloudwatch/home?region=${region}#logsV2:logs-insights$3FqueryDetail$3D~(end~0~start~-3600~timeType~'RELATIVE~unit~'seconds~editorString~'fields*20*40timestamp*2c*20*40requestId*2c*20*40message*0a*7c*20filter*20*40requestId*20like*20*${res.$metadata.requestId}*22*0a*7c*20sort*20*40timestamp*20asc~source~(~'*2faws*2flambda*2f${functionName}))`;
73462
74037
  if (event.InvokeComplete.ErrorCode === "Unhandled") {
73463
74038
  throw new Error(`Lambda function ${functionName} failed with an unhandled error: ${event.InvokeComplete.ErrorDetails} See ${logs} to see the logs of this invocation.`);
73464
74039
  }
@@ -73555,7 +74130,8 @@ var convertToServeUrlImplementation = ({
73555
74130
  if (urlOrId.startsWith("http://") || urlOrId.startsWith("https://")) {
73556
74131
  return urlOrId;
73557
74132
  }
73558
- return `https://${bucketName}.s3.${region}.amazonaws.com/sites/${urlOrId}/index.html`;
74133
+ const { dnsSuffix } = getAwsRegionMetadata(region);
74134
+ return `https://${bucketName}.s3.${region}.${dnsSuffix}/sites/${urlOrId}/index.html`;
73559
74135
  };
73560
74136
 
73561
74137
  // src/create-bucket.ts
@@ -73601,6 +74177,7 @@ var createBucket = async ({ region, bucketName, forcePathStyle, requestHandler }
73601
74177
  }
73602
74178
  let usedBucketPolicy = false;
73603
74179
  try {
74180
+ const { partition } = getAwsRegionMetadata(region);
73604
74181
  const policy = JSON.stringify({
73605
74182
  Version: "2012-10-17",
73606
74183
  Statement: [
@@ -73609,7 +74186,7 @@ var createBucket = async ({ region, bucketName, forcePathStyle, requestHandler }
73609
74186
  Effect: "Allow",
73610
74187
  Principal: "*",
73611
74188
  Action: "s3:GetObject",
73612
- Resource: `arn:aws:s3:::${bucketName}/*`
74189
+ Resource: `arn:${partition}:s3:::${bucketName}/*`
73613
74190
  }
73614
74191
  ]
73615
74192
  });
@@ -73679,6 +74256,16 @@ var deleteFunction = async ({
73679
74256
 
73680
74257
  // src/price-per-1s.ts
73681
74258
  var pricing = {
74259
+ "cn-north-1": {
74260
+ "Lambda Requests": { price: "0.00000136" },
74261
+ "Lambda Duration-ARM": { price: "0.000090800" },
74262
+ "Lambda Storage-Duration-ARM": { price: "0.0000002303" }
74263
+ },
74264
+ "cn-northwest-1": {
74265
+ "Lambda Requests": { price: "0.00000136" },
74266
+ "Lambda Duration-ARM": { price: "0.000090800" },
74267
+ "Lambda Storage-Duration-ARM": { price: "0.0000002049" }
74268
+ },
73682
74269
  "af-south-1": {
73683
74270
  "Lambda Duration-Provisioned": {
73684
74271
  rateCode: "X7CK6KFXNWY9RF6Z.JRTCKXETXF.6YS6EN2CT7",
@@ -74487,6 +75074,8 @@ var AWS_REGIONS = [
74487
75074
  "ap-southeast-4",
74488
75075
  "ap-southeast-5",
74489
75076
  "ca-central-1",
75077
+ "cn-north-1",
75078
+ "cn-northwest-1",
74490
75079
  "sa-east-1"
74491
75080
  ];
74492
75081
 
@@ -74590,7 +75179,8 @@ var cloudWatchUrlWithQuery = ({
74590
75179
  functionNameToUse,
74591
75180
  query
74592
75181
  }) => {
74593
- return `https://${region}.console.aws.amazon.com/cloudwatch/home?region=${region}#logsV2:log-groups/log-group/$252Faws$252Flambda$252F${functionNameToUse}/log-events$3FfilterPattern$3D${encodeAwsUrlParams(query)}`;
75182
+ const { consoleDomain } = getAwsRegionMetadata(region);
75183
+ return `https://${region}.${consoleDomain}/cloudwatch/home?region=${region}#logsV2:log-groups/log-group/$252Faws$252Flambda$252F${functionNameToUse}/log-events$3FfilterPattern$3D${encodeAwsUrlParams(query)}`;
74594
75184
  };
74595
75185
  var getCloudwatchMethodUrl = ({
74596
75186
  region,
@@ -74607,7 +75197,8 @@ var getLambdaInsightsUrl = ({
74607
75197
  region,
74608
75198
  functionName
74609
75199
  }) => {
74610
- return `https://${region}.console.aws.amazon.com/cloudwatch/home?region=${region}#lambda-insights:functions/${functionName}`;
75200
+ const { consoleDomain } = getAwsRegionMetadata(region);
75201
+ return `https://${region}.${consoleDomain}/cloudwatch/home?region=${region}#lambda-insights:functions/${functionName}`;
74611
75202
  };
74612
75203
  var getCloudwatchRendererUrl = ({ region, functionName, renderId, rendererFunctionName, chunk }) => {
74613
75204
  const functionNameToUse = rendererFunctionName ?? functionName;
@@ -74619,14 +75210,31 @@ var getS3RenderUrl = ({
74619
75210
  region,
74620
75211
  bucketName
74621
75212
  }) => {
74622
- return `https://s3.console.aws.amazon.com/s3/buckets/${bucketName}?region=${region}&prefix=renders/${renderId}/`;
75213
+ const { consoleDomain, partition } = getAwsRegionMetadata(region);
75214
+ const consoleHost = partition === "aws" ? `s3.${consoleDomain}` : `${region}.${consoleDomain}`;
75215
+ return `https://${consoleHost}/s3/buckets/${bucketName}?region=${region}&prefix=renders/${renderId}/`;
74623
75216
  };
74624
75217
  var getProgressJsonUrl = ({
74625
75218
  region,
74626
75219
  bucketName,
74627
75220
  renderId
74628
75221
  }) => {
74629
- return `https://${region}.console.aws.amazon.com/s3/object/${bucketName}?region=${region}&bucketType=general&prefix=renders/${renderId}/progress.json`;
75222
+ const { consoleDomain } = getAwsRegionMetadata(region);
75223
+ return `https://${region}.${consoleDomain}/s3/object/${bucketName}?region=${region}&bucketType=general&prefix=renders/${renderId}/progress.json`;
75224
+ };
75225
+ var getLambdaFunctionUrl = ({
75226
+ region,
75227
+ functionName
75228
+ }) => {
75229
+ const { consoleDomain } = getAwsRegionMetadata(region);
75230
+ return `https://${region}.${consoleDomain}/lambda/home#/functions/${functionName}?tab=code`;
75231
+ };
75232
+ var getS3BucketUrl = ({
75233
+ region,
75234
+ bucketName
75235
+ }) => {
75236
+ const { consoleDomain } = getAwsRegionMetadata(region);
75237
+ return `https://${region}.${consoleDomain}/s3/buckets/${bucketName}/?region=${region}`;
74630
75238
  };
74631
75239
 
74632
75240
  // src/get-buckets.ts
@@ -74659,11 +75267,11 @@ var getRemotionBuckets = async ({
74659
75267
  if (!Buckets) {
74660
75268
  return [];
74661
75269
  }
74662
- const remotionBuckets = Buckets.filter((b) => {
75270
+ const remotionBuckets = Buckets.filter((b2) => {
74663
75271
  if (forceBucketName) {
74664
- return b.Name === forceBucketName;
75272
+ return b2.Name === forceBucketName;
74665
75273
  }
74666
- return b.Name?.startsWith(REMOTION_BUCKET_PREFIX);
75274
+ return b2.Name?.startsWith(REMOTION_BUCKET_PREFIX);
74667
75275
  });
74668
75276
  const locations = await Promise.all(remotionBuckets.map(async (bucket) => {
74669
75277
  const { region: parsedRegion } = parseBucketName(bucket.Name);
@@ -74693,7 +75301,7 @@ var getRemotionBuckets = async ({
74693
75301
  name: bucket.Name,
74694
75302
  region: locations[i]
74695
75303
  };
74696
- }).filter((b) => b.region);
75304
+ }).filter((b2) => b2.region);
74697
75305
  return bucketsWithLocation.filter((bucket) => {
74698
75306
  return bucket.region === region;
74699
75307
  });
@@ -74816,8 +75424,9 @@ var getOutputUrlFromMetadata = ({
74816
75424
  customCredentials,
74817
75425
  bucketNamePrefix: REMOTION_BUCKET_PREFIX
74818
75426
  });
75427
+ const { dnsSuffix } = getAwsRegionMetadata(currentRegion);
74819
75428
  return {
74820
- url: `https://s3.${currentRegion}.amazonaws.com/${renderBucketName}/${key}`,
75429
+ url: `https://s3.${currentRegion}.${dnsSuffix}/${renderBucketName}/${key}`,
74821
75430
  key
74822
75431
  };
74823
75432
  };
@@ -75566,7 +76175,7 @@ If this is not correct, provide an override value by setting a number
75566
76175
  to input.params.ContentLength in bytes.
75567
76176
  `);
75568
76177
  }
75569
- this.uploadedParts.sort((a, b) => a.PartNumber - b.PartNumber);
76178
+ this.uploadedParts.sort((a2, b2) => a2.PartNumber - b2.PartNumber);
75570
76179
  const uploadCompleteParams = {
75571
76180
  ...this.params,
75572
76181
  Body: undefined,
@@ -75801,6 +76410,9 @@ var awsImplementation = {
75801
76410
  return MAX_EPHEMERAL_STORAGE_IN_MB;
75802
76411
  },
75803
76412
  estimatePrice,
76413
+ getBillingCurrency: (region) => getAwsRegionMetadata(region).billingCurrency,
76414
+ getRendererFunctionTransport: (region) => getAwsRegionMetadata(region).partition === "aws-cn" ? "s3" : "response-streaming",
76415
+ getServiceDnsSuffix: (region) => getAwsRegionMetadata(region).dnsSuffix,
75804
76416
  getLoggingUrlForMethod: getCloudwatchMethodUrl,
75805
76417
  getLoggingUrlForRendererFunction: getCloudwatchRendererUrl,
75806
76418
  isFlakyError,
@@ -75936,8 +76548,8 @@ var internalDeleteRender = async (input) => {
75936
76548
  });
75937
76549
  let totalSize = 0;
75938
76550
  while (files.length > 0) {
75939
- totalSize += files.reduce((a, b) => {
75940
- return a + (b.Size ?? 0);
76551
+ totalSize += files.reduce((a2, b2) => {
76552
+ return a2 + (b2.Size ?? 0);
75941
76553
  }, 0);
75942
76554
  await cleanItems({
75943
76555
  list: files.map((f) => f.Key),
@@ -75980,7 +76592,8 @@ var makeS3ServeUrl = ({
75980
76592
  subFolder,
75981
76593
  region
75982
76594
  }) => {
75983
- return `https://${bucketName}.s3.${region}.amazonaws.com/${subFolder}/index.html`;
76595
+ const { dnsSuffix } = getAwsRegionMetadata(region);
76596
+ return `https://${bucketName}.s3.${region}.${dnsSuffix}/${subFolder}/index.html`;
75984
76597
  };
75985
76598
 
75986
76599
  // src/get-sites.ts
@@ -76342,7 +76955,7 @@ var makeLambdaRenderStillPayload = async ({
76342
76955
  offthreadVideoCacheSizeInBytes,
76343
76956
  deleteAfter,
76344
76957
  type: ServerlessRoutines.still,
76345
- streamed: true,
76958
+ streamed: awsImplementation.getRendererFunctionTransport(region) === "response-streaming",
76346
76959
  forcePathStyle,
76347
76960
  licenseKey: licenseKey ?? null,
76348
76961
  offthreadVideoThreads: offthreadVideoThreads ?? null,
@@ -76480,7 +77093,7 @@ var innerRenderStillOnLambda = async (input) => {
76480
77093
  const { functionName, region, onInit } = input;
76481
77094
  try {
76482
77095
  const payload = await makeLambdaRenderStillPayload(input);
76483
- const res = await new Promise((resolve, reject) => {
77096
+ const res = payload.streamed ? await new Promise((resolve, reject) => {
76484
77097
  awsImplementation.callFunctionStreaming({
76485
77098
  functionName,
76486
77099
  type: ServerlessRoutines.still,
@@ -76518,7 +77131,27 @@ var innerRenderStillOnLambda = async (input) => {
76518
77131
  }).catch((err) => {
76519
77132
  reject(err);
76520
77133
  });
77134
+ }) : await awsImplementation.callFunctionSync({
77135
+ functionName,
77136
+ type: ServerlessRoutines.still,
77137
+ payload,
77138
+ region,
77139
+ timeoutInTest: 120000,
77140
+ requestHandler: input.requestHandler
76521
77141
  });
77142
+ if (!payload.streamed) {
77143
+ onInit?.({
77144
+ renderId: res.renderId,
77145
+ cloudWatchLogs: getCloudwatchMethodUrl({
77146
+ functionName,
77147
+ method: ServerlessRoutines.still,
77148
+ region,
77149
+ rendererFunctionName: null,
77150
+ renderId: res.renderId
77151
+ }),
77152
+ lambdaInsightsUrl: getLambdaInsightsUrl({ functionName, region })
77153
+ });
77154
+ }
76522
77155
  return {
76523
77156
  estimatedPrice: res.estimatedPrice,
76524
77157
  url: res.output,
@@ -77148,6 +77781,8 @@ var LambdaClientInternals = {
77148
77781
  parseJsonOrThrowSource,
77149
77782
  getCloudwatchMethodUrl,
77150
77783
  getCloudwatchRendererUrl,
77784
+ getLambdaFunctionUrl,
77785
+ getS3BucketUrl,
77151
77786
  MAX_EPHEMERAL_STORAGE_IN_MB,
77152
77787
  parseFunctionName,
77153
77788
  isFlakyError,
@@ -77176,7 +77811,9 @@ var LambdaClientInternals = {
77176
77811
  cleanItems,
77177
77812
  makeLambdaRenderStillPayload,
77178
77813
  getRenderProgressPayload,
77179
- innerSpeculateFunctionName
77814
+ innerSpeculateFunctionName,
77815
+ getAwsPartitionMetadata,
77816
+ getAwsRegionMetadata
77180
77817
  };
77181
77818
  export {
77182
77819
  validateWebhookSignature,