@remotion/promo-pages 4.0.488 → 4.0.490

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/Homepage.js +291 -153
  2. package/dist/components/Homepage.js +5 -21
  3. package/dist/components/homepage/CommunityStatsItems.js +2 -2
  4. package/dist/components/homepage/Demo/DemoRender.d.ts +1 -1
  5. package/dist/components/homepage/Demo/DisplayedEmoji.js +5 -3
  6. package/dist/components/homepage/Demo/math.d.ts +1 -1
  7. package/dist/components/homepage/GitHubButton.js +1 -1
  8. package/dist/components/homepage/MakeVideosAgentically.d.ts +1 -0
  9. package/dist/components/homepage/MakeVideosAgentically.js +4 -6
  10. package/dist/components/homepage/MakeVideosInteractively.d.ts +2 -0
  11. package/dist/components/homepage/MakeVideosInteractively.js +3 -6
  12. package/dist/components/homepage/MakeVideosLinks.js +1 -1
  13. package/dist/components/homepage/MakeVideosProgrammatically.d.ts +2 -0
  14. package/dist/components/homepage/MakeVideosProgrammatically.js +2 -5
  15. package/dist/components/homepage/Pricing.d.ts +3 -1
  16. package/dist/components/homepage/Pricing.js +6 -2
  17. package/dist/components/homepage/WriteInReact.js +2 -1
  18. package/dist/components/team/TrustSection.js +1 -1
  19. package/dist/design.js +94 -48
  20. package/dist/experts.js +94 -37
  21. package/dist/homepage/Pricing.js +94 -48
  22. package/dist/prompts/PromptsGallery.js +94 -48
  23. package/dist/prompts/PromptsShow.js +94 -48
  24. package/dist/prompts/PromptsSubmit.js +94 -48
  25. package/dist/team.js +94 -48
  26. package/dist/template-modal-content.js +94 -48
  27. package/dist/templates.js +95 -48
  28. package/package.json +13 -13
  29. package/dist/components/homepage/CanvasSectionTitle.d.ts +0 -4
  30. package/dist/components/homepage/CanvasSectionTitle.js +0 -14
  31. package/dist/components/homepage/EditorStarterSection.d.ts +0 -3
  32. package/dist/components/homepage/EditorStarterSection.js +0 -8
package/dist/Homepage.js CHANGED
@@ -2049,26 +2049,20 @@ var continueRenderInternal = ({
2049
2049
  if (typeof handle !== "number") {
2050
2050
  throw new TypeError("The parameter passed into continueRender() must be the return value of delayRender() which is a number. Got: " + JSON.stringify(handle));
2051
2051
  }
2052
- scope.remotion_delayRenderHandles = scope.remotion_delayRenderHandles.filter((h) => {
2053
- if (h === handle) {
2054
- if (environment.isRendering && scope !== undefined) {
2055
- if (!scope.remotion_delayRenderTimeouts[handle]) {
2056
- return false;
2057
- }
2058
- const { label: label2, startTime, timeout } = scope.remotion_delayRenderTimeouts[handle];
2059
- clearTimeout(timeout);
2060
- const message = [
2061
- label2 ? `"${label2}"` : "A handle",
2062
- DELAY_RENDER_CLEAR_TOKEN,
2063
- `${Date.now() - startTime}ms`
2064
- ].filter(truthy).join(" ");
2065
- Log.verbose({ logLevel, tag: "delayRender()" }, message);
2066
- delete scope.remotion_delayRenderTimeouts[handle];
2067
- }
2068
- return false;
2069
- }
2070
- return true;
2071
- });
2052
+ const handleExists = scope.remotion_delayRenderHandles.includes(handle);
2053
+ const timeoutEntry = scope.remotion_delayRenderTimeouts[handle];
2054
+ if (handleExists && environment.isRendering && timeoutEntry) {
2055
+ const { label: label2, startTime, timeout } = timeoutEntry;
2056
+ clearTimeout(timeout);
2057
+ const message = [
2058
+ label2 ? `"${label2}"` : "A handle",
2059
+ DELAY_RENDER_CLEAR_TOKEN,
2060
+ `${Date.now() - startTime}ms`
2061
+ ].filter(truthy).join(" ");
2062
+ Log.verbose({ logLevel, tag: "delayRender()" }, message);
2063
+ delete scope.remotion_delayRenderTimeouts[handle];
2064
+ }
2065
+ scope.remotion_delayRenderHandles = scope.remotion_delayRenderHandles.filter((h) => h !== handle);
2072
2066
  if (scope.remotion_delayRenderHandles.length === 0) {
2073
2067
  scope.remotion_renderReady = true;
2074
2068
  }
@@ -2341,7 +2335,7 @@ var getComponentsToAddStacksTo = () => componentsToAddStacksTo;
2341
2335
  var addSequenceStackTraces = (component) => {
2342
2336
  componentsToAddStacksTo.push(component);
2343
2337
  };
2344
- var VERSION = "4.0.488";
2338
+ var VERSION = "4.0.490";
2345
2339
  var checkMultipleRemotionVersions = () => {
2346
2340
  if (typeof globalThis === "undefined") {
2347
2341
  return;
@@ -2722,7 +2716,8 @@ var transformSchema = {
2722
2716
  max: 100,
2723
2717
  step: 0.01,
2724
2718
  default: 1,
2725
- description: "Scale"
2719
+ description: "Scale",
2720
+ defaultKeyframeOutput: "perceptual-scale"
2726
2721
  },
2727
2722
  "style.rotate": {
2728
2723
  type: "rotation-css",
@@ -3526,8 +3521,20 @@ var serializeStringInterpolationValue = ({
3526
3521
  }
3527
3522
  return values.slice(0, dimensions).map((value, index) => `${stringifyNumber(value)}${units[index]}`).join(" ");
3528
3523
  };
3524
+ var toSignedArea = (scale) => {
3525
+ if (scale === 0) {
3526
+ return 0;
3527
+ }
3528
+ return Math.sign(scale) * scale * scale;
3529
+ };
3530
+ var fromSignedArea = (area) => {
3531
+ if (area === 0) {
3532
+ return 0;
3533
+ }
3534
+ return Math.sign(area) * Math.sqrt(Math.abs(area));
3535
+ };
3529
3536
  function interpolateFunction(input, inputRange, outputRange, options) {
3530
- const { extrapolateLeft, extrapolateRight, easing } = options;
3537
+ const { extrapolateLeft, extrapolateRight, easing, output } = options;
3531
3538
  let result = input;
3532
3539
  const [inputMin, inputMax] = inputRange;
3533
3540
  const [outputMin, outputMax] = outputRange;
@@ -3558,7 +3565,13 @@ function interpolateFunction(input, inputRange, outputRange, options) {
3558
3565
  }
3559
3566
  result = (result - inputMin) / (inputMax - inputMin);
3560
3567
  result = easing(result);
3561
- result = result * (outputMax - outputMin) + outputMin;
3568
+ if (output === "perceptual-scale") {
3569
+ const signedAreaMin = toSignedArea(outputMin);
3570
+ const signedAreaMax = toSignedArea(outputMax);
3571
+ result = fromSignedArea(result * (signedAreaMax - signedAreaMin) + signedAreaMin);
3572
+ } else {
3573
+ result = result * (outputMax - outputMin) + outputMin;
3574
+ }
3562
3575
  return result;
3563
3576
  }
3564
3577
  function findRange(input, inputRange) {
@@ -3571,6 +3584,9 @@ function findRange(input, inputRange) {
3571
3584
  return i - 1;
3572
3585
  }
3573
3586
  var defaultEasing = (num) => num;
3587
+ var resolveOutputOption = (output) => {
3588
+ return output ?? "linear";
3589
+ };
3574
3590
  var shouldExtendRightForEasing = (easing) => {
3575
3591
  return easing.remotionShouldExtendRight === true;
3576
3592
  };
@@ -3592,12 +3608,14 @@ var interpolateSegment = ({
3592
3608
  outputRange,
3593
3609
  easing,
3594
3610
  extrapolateLeft,
3595
- extrapolateRight
3611
+ extrapolateRight,
3612
+ output
3596
3613
  }) => {
3597
3614
  return interpolateFunction(input, inputRange, outputRange, {
3598
3615
  easing,
3599
3616
  extrapolateLeft,
3600
- extrapolateRight: input > inputRange[1] && extrapolateRight === "clamp" && shouldExtendRightForEasing(easing) ? "extend" : extrapolateRight
3617
+ extrapolateRight: input > inputRange[1] && extrapolateRight === "clamp" && shouldExtendRightForEasing(easing) ? "extend" : extrapolateRight,
3618
+ output
3601
3619
  });
3602
3620
  };
3603
3621
  var interpolateNumber = ({
@@ -3606,6 +3624,7 @@ var interpolateNumber = ({
3606
3624
  outputRange,
3607
3625
  options
3608
3626
  }) => {
3627
+ const output = resolveOutputOption(options?.output);
3609
3628
  if (inputRange.length === 1) {
3610
3629
  return outputRange[0];
3611
3630
  }
@@ -3630,7 +3649,8 @@ var interpolateNumber = ({
3630
3649
  outputRange: [outputRange[range], outputRange[range + 1]],
3631
3650
  easing,
3632
3651
  extrapolateLeft,
3633
- extrapolateRight
3652
+ extrapolateRight,
3653
+ output
3634
3654
  });
3635
3655
  for (let segmentIndex = 0;segmentIndex < range; segmentIndex++) {
3636
3656
  const previousEasing = resolveEasingForSegment({
@@ -3650,7 +3670,8 @@ var interpolateNumber = ({
3650
3670
  outputRange: [outputRange[segmentIndex], outputRange[segmentIndex + 1]],
3651
3671
  easing: previousEasing,
3652
3672
  extrapolateLeft,
3653
- extrapolateRight: "extend"
3673
+ extrapolateRight: "extend",
3674
+ output
3654
3675
  });
3655
3676
  result += continuedSegmentValue - outputRange[segmentIndex + 1];
3656
3677
  }
@@ -3698,14 +3719,18 @@ var interpolateString = ({
3698
3719
  }
3699
3720
  }
3700
3721
  }
3701
- return serializeStringInterpolationValue({
3702
- kind,
3703
- values: [0, 0, 0].map((_, axis) => interpolateNumber({
3722
+ const values = [0, 0, 0];
3723
+ for (let axis = 0;axis < dimensions; axis++) {
3724
+ values[axis] = interpolateNumber({
3704
3725
  input,
3705
3726
  inputRange,
3706
3727
  outputRange: parsedOutputRange.map((parsed) => parsed.values[axis]),
3707
3728
  options
3708
- })),
3729
+ });
3730
+ }
3731
+ return serializeStringInterpolationValue({
3732
+ kind,
3733
+ values,
3709
3734
  units,
3710
3735
  dimensions
3711
3736
  });
@@ -3789,6 +3814,12 @@ function assertValidInterpolatePosterizeOption(posterize) {
3789
3814
  throw new Error(`posterize must be a positive finite number, but got ${posterize}`);
3790
3815
  }
3791
3816
  }
3817
+ function assertValidInterpolateOutputOption(output) {
3818
+ if (output === undefined || output === "linear" || output === "perceptual-scale") {
3819
+ return;
3820
+ }
3821
+ throw new Error(`output must be "linear" or "perceptual-scale", but got ${String(output)}`);
3822
+ }
3792
3823
  function interpolate(input, inputRange, outputRange, options) {
3793
3824
  if (typeof input === "undefined") {
3794
3825
  throw new Error("input can not be undefined");
@@ -3806,6 +3837,7 @@ function interpolate(input, inputRange, outputRange, options) {
3806
3837
  checkValidInputRange(inputRange);
3807
3838
  assertValidInterpolateEasingOption(options?.easing, inputRange.length);
3808
3839
  assertValidInterpolatePosterizeOption(options?.posterize);
3840
+ assertValidInterpolateOutputOption(options?.output);
3809
3841
  if (typeof input !== "number") {
3810
3842
  throw new TypeError("Cannot interpolate an input which is not a number");
3811
3843
  }
@@ -4750,6 +4782,7 @@ var interpolateKeyframedStatus = ({
4750
4782
  easing: easing.map((e) => easingToFn({ easing: e, forceSpringAllowTail })),
4751
4783
  extrapolateLeft: clamping.left,
4752
4784
  extrapolateRight: clamping.right,
4785
+ output: status.output,
4753
4786
  posterize: status.posterize
4754
4787
  });
4755
4788
  } catch {
@@ -4990,7 +5023,7 @@ var getFlatSchemaWithAllKeys = (schema) => {
4990
5023
  const out = {};
4991
5024
  const addKey = (key, field) => {
4992
5025
  if (key in out) {
4993
- throw new Error(`Duplicate key "${key}" in schema: discriminated union variants must not share keys`);
5026
+ return;
4994
5027
  }
4995
5028
  out[key] = field;
4996
5029
  };
@@ -10869,6 +10902,22 @@ var Img = withInteractivitySchema({
10869
10902
  supportsEffects: true
10870
10903
  });
10871
10904
  addSequenceStackTraces(Img);
10905
+ var sourcePathToIdentityPrefix = (packageName) => {
10906
+ if (packageName === "remotion") {
10907
+ return "dev.remotion.remotion";
10908
+ }
10909
+ if (packageName.startsWith("@remotion/")) {
10910
+ const normalizedPackageName = packageName.slice("@remotion/".length).replace(/-([a-z])/g, (_, char) => char.toUpperCase());
10911
+ return `dev.remotion.${normalizedPackageName}`;
10912
+ }
10913
+ throw new Error(`Unsupported Remotion package name: ${packageName}`);
10914
+ };
10915
+ var makeRemotionComponentIdentity = ({
10916
+ packageName,
10917
+ componentName
10918
+ }) => {
10919
+ return `${sourcePathToIdentityPrefix(packageName)}.${componentName}`;
10920
+ };
10872
10921
  var interactiveElementSchema = {
10873
10922
  ...baseSchema,
10874
10923
  ...transformSchema,
@@ -10882,6 +10931,11 @@ var setRef = (ref, value) => {
10882
10931
  ref.current = value;
10883
10932
  }
10884
10933
  };
10934
+ var withSchema = (options) => {
10935
+ const Wrapped = withInteractivitySchema(options);
10936
+ addSequenceStackTraces(Wrapped);
10937
+ return Wrapped;
10938
+ };
10885
10939
  var makeInteractiveElement = (tag, displayName) => {
10886
10940
  const Inner = forwardRef12((propsWithControls, ref) => {
10887
10941
  const {
@@ -10921,15 +10975,17 @@ var makeInteractiveElement = (tag, displayName) => {
10921
10975
  });
10922
10976
  });
10923
10977
  Inner.displayName = displayName;
10924
- const Wrapped = withInteractivitySchema({
10978
+ const Wrapped = withSchema({
10925
10979
  Component: Inner,
10926
10980
  componentName: displayName,
10927
- componentIdentity: `dev.remotion.remotion.${displayName.slice(1, -1)}`,
10981
+ componentIdentity: makeRemotionComponentIdentity({
10982
+ packageName: "remotion",
10983
+ componentName: displayName.slice(1, -1)
10984
+ }),
10928
10985
  schema: interactiveElementSchema,
10929
10986
  supportsEffects: false
10930
10987
  });
10931
10988
  Wrapped.displayName = displayName;
10932
- addSequenceStackTraces(Wrapped);
10933
10989
  return Wrapped;
10934
10990
  };
10935
10991
  var Interactive = {
@@ -10938,7 +10994,8 @@ var Interactive = {
10938
10994
  textSchema,
10939
10995
  premountSchema,
10940
10996
  sequenceSchema,
10941
- withSchema: withInteractivitySchema,
10997
+ withSchema,
10998
+ _internalMakeRemotionComponentIdentity: makeRemotionComponentIdentity,
10942
10999
  A: makeInteractiveElement("a", "<Interactive.A>"),
10943
11000
  Article: makeInteractiveElement("article", "<Interactive.Article>"),
10944
11001
  Aside: makeInteractiveElement("aside", "<Interactive.Aside>"),
@@ -17970,7 +18027,6 @@ var Arrow = Interactive.withSchema({
17970
18027
  schema: arrowSchema,
17971
18028
  supportsEffects: true
17972
18029
  });
17973
- Internals.addSequenceStackTraces(Arrow);
17974
18030
  var shortenVector = (vector, radius) => {
17975
18031
  const [x, y] = vector;
17976
18032
  const currentLength = Math.sqrt(x * x + y * y);
@@ -18395,7 +18451,6 @@ var Callout = Interactive.withSchema({
18395
18451
  schema: calloutSchema,
18396
18452
  supportsEffects: true
18397
18453
  });
18398
- Internals.addSequenceStackTraces(Callout);
18399
18454
  var makeCircle = ({ radius }) => {
18400
18455
  const instructions = [
18401
18456
  {
@@ -18458,7 +18513,6 @@ var Circle = Interactive.withSchema({
18458
18513
  schema: circleSchema,
18459
18514
  supportsEffects: true
18460
18515
  });
18461
- Internals.addSequenceStackTraces(Circle);
18462
18516
  var makeEllipse = ({ rx, ry }) => {
18463
18517
  const instructions = [
18464
18518
  {
@@ -18516,7 +18570,6 @@ var Ellipse = Interactive.withSchema({
18516
18570
  schema: ellipseSchema,
18517
18571
  supportsEffects: true
18518
18572
  });
18519
- Internals.addSequenceStackTraces(Ellipse);
18520
18573
  var makeHeart = ({
18521
18574
  height,
18522
18575
  aspectRatio = 1.1,
@@ -18655,7 +18708,6 @@ var Heart = Interactive.withSchema({
18655
18708
  schema: heartSchema,
18656
18709
  supportsEffects: true
18657
18710
  });
18658
- Internals.addSequenceStackTraces(Heart);
18659
18711
  var getCoord = ({
18660
18712
  counterClockwise,
18661
18713
  actualProgress,
@@ -18810,7 +18862,6 @@ var Pie = Interactive.withSchema({
18810
18862
  schema: pieSchema,
18811
18863
  supportsEffects: true
18812
18864
  });
18813
- Internals.addSequenceStackTraces(Pie);
18814
18865
  function polygon({
18815
18866
  points,
18816
18867
  radius,
@@ -18910,7 +18961,6 @@ var Polygon = Interactive.withSchema({
18910
18961
  schema: polygonSchema,
18911
18962
  supportsEffects: true
18912
18963
  });
18913
- Internals.addSequenceStackTraces(Polygon);
18914
18964
  var makeRect = ({
18915
18965
  width,
18916
18966
  height,
@@ -18977,7 +19027,6 @@ var Rect = Interactive.withSchema({
18977
19027
  schema: rectSchema,
18978
19028
  supportsEffects: true
18979
19029
  });
18980
- Internals.addSequenceStackTraces(Rect);
18981
19030
  var KAPPA = 0.5522847498307936;
18982
19031
  var CAP_HANDLE = 4 / 3;
18983
19032
  var curve = ({
@@ -19189,7 +19238,6 @@ var Spark = Interactive.withSchema({
19189
19238
  schema: sparkSchema,
19190
19239
  supportsEffects: true
19191
19240
  });
19192
- Internals.addSequenceStackTraces(Spark);
19193
19241
  var star = ({
19194
19242
  centerX,
19195
19243
  centerY,
@@ -19300,7 +19348,6 @@ var Star = Interactive.withSchema({
19300
19348
  schema: starSchema,
19301
19349
  supportsEffects: true
19302
19350
  });
19303
- Internals.addSequenceStackTraces(Star);
19304
19351
  var makeTriangle = ({
19305
19352
  length: length2,
19306
19353
  direction = "right",
@@ -19407,7 +19454,6 @@ var Triangle = Interactive.withSchema({
19407
19454
  schema: triangleSchema,
19408
19455
  supportsEffects: true
19409
19456
  });
19410
- Internals.addSequenceStackTraces(Triangle);
19411
19457
 
19412
19458
  // ../svg-3d-engine/dist/esm/index.mjs
19413
19459
  function truthy2(value) {
@@ -29719,7 +29765,7 @@ var GitHubStars = () => {
29719
29765
  width: "45px"
29720
29766
  }),
29721
29767
  /* @__PURE__ */ jsx57(StatItemContent, {
29722
- content: "52K",
29768
+ content: "53K",
29723
29769
  width: "80px",
29724
29770
  fontSize: "2.5rem",
29725
29771
  fontWeight: "bold"
@@ -29914,7 +29960,7 @@ import {
29914
29960
  useImperativeHandle as useImperativeHandle22,
29915
29961
  useLayoutEffect as useLayoutEffect33,
29916
29962
  useMemo as useMemo142,
29917
- useRef as useRef112,
29963
+ useRef as useRef122,
29918
29964
  useState as useState132
29919
29965
  } from "react";
29920
29966
  import React102, {
@@ -29950,7 +29996,7 @@ import { jsx as jsx114, jsxs as jsxs82, Fragment as Fragment23 } from "react/jsx
29950
29996
  import { useCallback as useCallback92, useMemo as useMemo112 } from "react";
29951
29997
  import { useCallback as useCallback82, useMemo as useMemo102, useRef as useRef92 } from "react";
29952
29998
  import { jsx as jsx124, jsxs as jsxs92, Fragment as Fragment32 } from "react/jsx-runtime";
29953
- import { useCallback as useCallback112, useMemo as useMemo132, useState as useState122 } from "react";
29999
+ import { useCallback as useCallback112, useMemo as useMemo132, useRef as useRef112, useState as useState122 } from "react";
29954
30000
  import { jsx as jsx133 } from "react/jsx-runtime";
29955
30001
 
29956
30002
  // ../core/dist/esm/no-react.mjs
@@ -30204,8 +30250,20 @@ var serializeStringInterpolationValue2 = ({
30204
30250
  }
30205
30251
  return values.slice(0, dimensions).map((value, index2) => `${stringifyNumber2(value)}${units[index2]}`).join(" ");
30206
30252
  };
30253
+ var toSignedArea2 = (scale) => {
30254
+ if (scale === 0) {
30255
+ return 0;
30256
+ }
30257
+ return Math.sign(scale) * scale * scale;
30258
+ };
30259
+ var fromSignedArea2 = (area) => {
30260
+ if (area === 0) {
30261
+ return 0;
30262
+ }
30263
+ return Math.sign(area) * Math.sqrt(Math.abs(area));
30264
+ };
30207
30265
  function interpolateFunction2(input, inputRange, outputRange, options2) {
30208
- const { extrapolateLeft, extrapolateRight, easing } = options2;
30266
+ const { extrapolateLeft, extrapolateRight, easing, output } = options2;
30209
30267
  let result = input;
30210
30268
  const [inputMin, inputMax] = inputRange;
30211
30269
  const [outputMin, outputMax] = outputRange;
@@ -30236,7 +30294,13 @@ function interpolateFunction2(input, inputRange, outputRange, options2) {
30236
30294
  }
30237
30295
  result = (result - inputMin) / (inputMax - inputMin);
30238
30296
  result = easing(result);
30239
- result = result * (outputMax - outputMin) + outputMin;
30297
+ if (output === "perceptual-scale") {
30298
+ const signedAreaMin = toSignedArea2(outputMin);
30299
+ const signedAreaMax = toSignedArea2(outputMax);
30300
+ result = fromSignedArea2(result * (signedAreaMax - signedAreaMin) + signedAreaMin);
30301
+ } else {
30302
+ result = result * (outputMax - outputMin) + outputMin;
30303
+ }
30240
30304
  return result;
30241
30305
  }
30242
30306
  function findRange2(input, inputRange) {
@@ -30249,6 +30313,9 @@ function findRange2(input, inputRange) {
30249
30313
  return i - 1;
30250
30314
  }
30251
30315
  var defaultEasing2 = (num) => num;
30316
+ var resolveOutputOption2 = (output) => {
30317
+ return output ?? "linear";
30318
+ };
30252
30319
  var shouldExtendRightForEasing2 = (easing) => {
30253
30320
  return easing.remotionShouldExtendRight === true;
30254
30321
  };
@@ -30270,12 +30337,14 @@ var interpolateSegment2 = ({
30270
30337
  outputRange,
30271
30338
  easing,
30272
30339
  extrapolateLeft,
30273
- extrapolateRight
30340
+ extrapolateRight,
30341
+ output
30274
30342
  }) => {
30275
30343
  return interpolateFunction2(input, inputRange, outputRange, {
30276
30344
  easing,
30277
30345
  extrapolateLeft,
30278
- extrapolateRight: input > inputRange[1] && extrapolateRight === "clamp" && shouldExtendRightForEasing2(easing) ? "extend" : extrapolateRight
30346
+ extrapolateRight: input > inputRange[1] && extrapolateRight === "clamp" && shouldExtendRightForEasing2(easing) ? "extend" : extrapolateRight,
30347
+ output
30279
30348
  });
30280
30349
  };
30281
30350
  var interpolateNumber2 = ({
@@ -30284,6 +30353,7 @@ var interpolateNumber2 = ({
30284
30353
  outputRange,
30285
30354
  options: options2
30286
30355
  }) => {
30356
+ const output = resolveOutputOption2(options2?.output);
30287
30357
  if (inputRange.length === 1) {
30288
30358
  return outputRange[0];
30289
30359
  }
@@ -30308,7 +30378,8 @@ var interpolateNumber2 = ({
30308
30378
  outputRange: [outputRange[range], outputRange[range + 1]],
30309
30379
  easing,
30310
30380
  extrapolateLeft,
30311
- extrapolateRight
30381
+ extrapolateRight,
30382
+ output
30312
30383
  });
30313
30384
  for (let segmentIndex = 0;segmentIndex < range; segmentIndex++) {
30314
30385
  const previousEasing = resolveEasingForSegment2({
@@ -30328,7 +30399,8 @@ var interpolateNumber2 = ({
30328
30399
  outputRange: [outputRange[segmentIndex], outputRange[segmentIndex + 1]],
30329
30400
  easing: previousEasing,
30330
30401
  extrapolateLeft,
30331
- extrapolateRight: "extend"
30402
+ extrapolateRight: "extend",
30403
+ output
30332
30404
  });
30333
30405
  result += continuedSegmentValue - outputRange[segmentIndex + 1];
30334
30406
  }
@@ -30376,14 +30448,18 @@ var interpolateString2 = ({
30376
30448
  }
30377
30449
  }
30378
30450
  }
30379
- return serializeStringInterpolationValue2({
30380
- kind,
30381
- values: [0, 0, 0].map((_, axis) => interpolateNumber2({
30451
+ const values = [0, 0, 0];
30452
+ for (let axis = 0;axis < dimensions; axis++) {
30453
+ values[axis] = interpolateNumber2({
30382
30454
  input,
30383
30455
  inputRange,
30384
30456
  outputRange: parsedOutputRange.map((parsed) => parsed.values[axis]),
30385
30457
  options: options2
30386
- })),
30458
+ });
30459
+ }
30460
+ return serializeStringInterpolationValue2({
30461
+ kind,
30462
+ values,
30387
30463
  units,
30388
30464
  dimensions
30389
30465
  });
@@ -30467,6 +30543,12 @@ function assertValidInterpolatePosterizeOption2(posterize) {
30467
30543
  throw new Error(`posterize must be a positive finite number, but got ${posterize}`);
30468
30544
  }
30469
30545
  }
30546
+ function assertValidInterpolateOutputOption2(output) {
30547
+ if (output === undefined || output === "linear" || output === "perceptual-scale") {
30548
+ return;
30549
+ }
30550
+ throw new Error(`output must be "linear" or "perceptual-scale", but got ${String(output)}`);
30551
+ }
30470
30552
  function interpolate3(input, inputRange, outputRange, options2) {
30471
30553
  if (typeof input === "undefined") {
30472
30554
  throw new Error("input can not be undefined");
@@ -30484,6 +30566,7 @@ function interpolate3(input, inputRange, outputRange, options2) {
30484
30566
  checkValidInputRange2(inputRange);
30485
30567
  assertValidInterpolateEasingOption2(options2?.easing, inputRange.length);
30486
30568
  assertValidInterpolatePosterizeOption2(options2?.posterize);
30569
+ assertValidInterpolateOutputOption2(options2?.output);
30487
30570
  if (typeof input !== "number") {
30488
30571
  throw new TypeError("Cannot interpolate an input which is not a number");
30489
30572
  }
@@ -30616,7 +30699,8 @@ var transformSchema2 = {
30616
30699
  max: 100,
30617
30700
  step: 0.01,
30618
30701
  default: 1,
30619
- description: "Scale"
30702
+ description: "Scale",
30703
+ defaultKeyframeOutput: "perceptual-scale"
30620
30704
  },
30621
30705
  "style.rotate": {
30622
30706
  type: "rotation-css",
@@ -31410,7 +31494,7 @@ import {
31410
31494
  useImperativeHandle as useImperativeHandle42,
31411
31495
  useLayoutEffect as useLayoutEffect42,
31412
31496
  useMemo as useMemo172,
31413
- useRef as useRef132,
31497
+ useRef as useRef142,
31414
31498
  useState as useState142
31415
31499
  } from "react";
31416
31500
  import React133, {
@@ -31419,7 +31503,7 @@ import React133, {
31419
31503
  useCallback as useCallback122,
31420
31504
  useImperativeHandle as useImperativeHandle32,
31421
31505
  useMemo as useMemo162,
31422
- useRef as useRef122
31506
+ useRef as useRef132
31423
31507
  } from "react";
31424
31508
  import { useContext as useContext62, useMemo as useMemo152 } from "react";
31425
31509
  import { jsx as jsx153 } from "react/jsx-runtime";
@@ -34369,7 +34453,9 @@ var SharedPlayerContexts = ({
34369
34453
  mediaVolume
34370
34454
  };
34371
34455
  }, [playerMuted, mediaVolume]);
34372
- const shouldCreateAudioContext = audioEnabled && !playerMuted && mediaVolume > 0;
34456
+ const audioContextWasCreated = useRef112(false);
34457
+ const shouldCreateAudioContext = audioContextWasCreated.current || audioEnabled && !playerMuted && mediaVolume > 0;
34458
+ audioContextWasCreated.current = shouldCreateAudioContext;
34373
34459
  const setMediaVolumeAndPersist = useCallback112((vol) => {
34374
34460
  setMediaVolume(vol);
34375
34461
  if (persistVolumeToStorage) {
@@ -34623,9 +34709,9 @@ var PlayerFn = ({
34623
34709
  }));
34624
34710
  const [playing, setPlaying] = useState132(false);
34625
34711
  const [rootId] = useState132("player-comp");
34626
- const rootRef = useRef112(null);
34627
- const audioAndVideoTags = useRef112([]);
34628
- const imperativePlaying = useRef112(false);
34712
+ const rootRef = useRef122(null);
34713
+ const audioAndVideoTags = useRef122([]);
34714
+ const imperativePlaying = useRef122(false);
34629
34715
  const [currentPlaybackRate, setCurrentPlaybackRate] = useState132(playbackRate);
34630
34716
  if (typeof compositionHeight !== "number") {
34631
34717
  throw new TypeError(`'compositionHeight' must be a number but got '${typeof compositionHeight}' instead`);
@@ -34826,7 +34912,7 @@ var ThumbnailUI = ({
34826
34912
  }, ref) => {
34827
34913
  const config = Internals.useUnsafeVideoConfig();
34828
34914
  const video = Internals.useVideo();
34829
- const container4 = useRef122(null);
34915
+ const container4 = useRef132(null);
34830
34916
  const canvasSize = useElementSize(container4, {
34831
34917
  triggerOnWindowResize: false,
34832
34918
  shouldApplyCssTransforms: false
@@ -34952,7 +35038,7 @@ var ThumbnailFn = ({
34952
35038
  }, []);
34953
35039
  }
34954
35040
  const [thumbnailId] = useState142(() => String(random(null)));
34955
- const rootRef = useRef132(null);
35041
+ const rootRef = useRef142(null);
34956
35042
  const timelineState = useMemo172(() => {
34957
35043
  const value = {
34958
35044
  playing: false,
@@ -35803,11 +35889,11 @@ function useColorMode() {
35803
35889
  // ../media/dist/esm/index.mjs
35804
35890
  import { useMemo as useMemo312, useState as useState312 } from "react";
35805
35891
  import { useContext as useContext212, useEffect as useEffect43, useMemo as useMemo58, useRef as useRef50, useState as useState41 } from "react";
35806
- import { ALL_FORMATS, Input as Input2, UrlSource } from "mediabunny";
35807
35892
  import {
35808
35893
  AudioBufferSink,
35809
35894
  InputDisposedError
35810
35895
  } from "mediabunny";
35896
+ import { ALL_FORMATS, Input as Input2, UrlSource } from "mediabunny";
35811
35897
  import { CanvasSink } from "mediabunny";
35812
35898
  import { useContext as useContext50, useLayoutEffect as useLayoutEffect19 } from "react";
35813
35899
  import { jsx as jsx61 } from "react/jsx-runtime";
@@ -36649,6 +36735,120 @@ var getDurationOrCompute = async (input) => {
36649
36735
  skipLiveWait: true
36650
36736
  }) ?? input.computeDuration(undefined, { skipLiveWait: true });
36651
36737
  };
36738
+ var normalizeMediaHeaders = (headers) => {
36739
+ if (!headers) {
36740
+ return;
36741
+ }
36742
+ const entries = [];
36743
+ if (headers instanceof Headers) {
36744
+ headers.forEach((value, key) => {
36745
+ entries.push([key.toLowerCase(), value]);
36746
+ });
36747
+ } else if (Array.isArray(headers)) {
36748
+ for (const [key, value] of headers) {
36749
+ entries.push([key.toLowerCase(), value]);
36750
+ }
36751
+ } else {
36752
+ for (const [key, value] of Object.entries(headers)) {
36753
+ entries.push([key.toLowerCase(), value]);
36754
+ }
36755
+ }
36756
+ entries.sort(([a2], [b2]) => a2 < b2 ? -1 : a2 > b2 ? 1 : 0);
36757
+ return entries;
36758
+ };
36759
+ var normalizeMediaRequestInit = (requestInit) => {
36760
+ if (!requestInit) {
36761
+ return;
36762
+ }
36763
+ const headers = normalizeMediaHeaders(requestInit.headers);
36764
+ const normalized = {
36765
+ ...requestInit.cache === undefined ? null : { cache: requestInit.cache },
36766
+ ...requestInit.credentials === undefined ? null : { credentials: requestInit.credentials },
36767
+ ...headers === undefined ? null : { headers },
36768
+ ...requestInit.integrity === undefined ? null : { integrity: requestInit.integrity },
36769
+ ...requestInit.mode === undefined ? null : { mode: requestInit.mode },
36770
+ ...requestInit.redirect === undefined ? null : { redirect: requestInit.redirect },
36771
+ ...requestInit.referrer === undefined ? null : { referrer: requestInit.referrer },
36772
+ ...requestInit.referrerPolicy === undefined ? null : { referrerPolicy: requestInit.referrerPolicy }
36773
+ };
36774
+ return Object.keys(normalized).length === 0 ? undefined : normalized;
36775
+ };
36776
+ var getMediaRequestInitFingerprint = (requestInit) => {
36777
+ const normalized = normalizeMediaRequestInit(requestInit);
36778
+ if (!normalized) {
36779
+ return null;
36780
+ }
36781
+ return [
36782
+ normalized.cache ?? null,
36783
+ normalized.credentials ?? null,
36784
+ normalized.integrity ?? null,
36785
+ normalized.mode ?? null,
36786
+ normalized.redirect ?? null,
36787
+ normalized.referrer ?? null,
36788
+ normalized.referrerPolicy ?? null,
36789
+ normalized.headers ?? null
36790
+ ];
36791
+ };
36792
+ var resolveRequestInit = ({
36793
+ credentials,
36794
+ requestInit
36795
+ }) => {
36796
+ if (credentials === undefined) {
36797
+ return normalizeMediaRequestInit(requestInit);
36798
+ }
36799
+ return normalizeMediaRequestInit({
36800
+ credentials,
36801
+ ...requestInit
36802
+ });
36803
+ };
36804
+ var sharedInputs = {};
36805
+ var getSharedInputCacheKey = ({
36806
+ src,
36807
+ credentials,
36808
+ requestInit
36809
+ }) => JSON.stringify([
36810
+ src,
36811
+ credentials ?? null,
36812
+ getMediaRequestInitFingerprint(requestInit)
36813
+ ]);
36814
+ var acquireSharedInput = ({
36815
+ src,
36816
+ credentials,
36817
+ requestInit
36818
+ }) => {
36819
+ const normalizedRequestInit = normalizeMediaRequestInit(requestInit);
36820
+ const cacheKey = getSharedInputCacheKey({
36821
+ src,
36822
+ credentials,
36823
+ requestInit: normalizedRequestInit
36824
+ });
36825
+ const existing = sharedInputs[cacheKey];
36826
+ if (existing) {
36827
+ existing.refCount++;
36828
+ return { input: existing.input, cacheKey };
36829
+ }
36830
+ const resolvedRequestInit = resolveRequestInit({
36831
+ credentials,
36832
+ requestInit: normalizedRequestInit
36833
+ });
36834
+ const input = new Input2({
36835
+ source: new UrlSource(src, resolvedRequestInit ? { requestInit: resolvedRequestInit } : undefined),
36836
+ formats: ALL_FORMATS
36837
+ });
36838
+ sharedInputs[cacheKey] = { input, refCount: 1 };
36839
+ return { input, cacheKey };
36840
+ };
36841
+ var releaseSharedInput = (cacheKey) => {
36842
+ const entry = sharedInputs[cacheKey];
36843
+ if (!entry) {
36844
+ return;
36845
+ }
36846
+ entry.refCount--;
36847
+ if (entry.refCount <= 0) {
36848
+ delete sharedInputs[cacheKey];
36849
+ entry.input.dispose();
36850
+ }
36851
+ };
36652
36852
  var resolveAudioTrack = async ({
36653
36853
  videoTrack,
36654
36854
  audioTracks,
@@ -36761,72 +36961,6 @@ class PremountAwareDelayPlayback {
36761
36961
  };
36762
36962
  }
36763
36963
  }
36764
- var normalizeMediaHeaders = (headers) => {
36765
- if (!headers) {
36766
- return;
36767
- }
36768
- const entries = [];
36769
- if (headers instanceof Headers) {
36770
- headers.forEach((value, key) => {
36771
- entries.push([key.toLowerCase(), value]);
36772
- });
36773
- } else if (Array.isArray(headers)) {
36774
- for (const [key, value] of headers) {
36775
- entries.push([key.toLowerCase(), value]);
36776
- }
36777
- } else {
36778
- for (const [key, value] of Object.entries(headers)) {
36779
- entries.push([key.toLowerCase(), value]);
36780
- }
36781
- }
36782
- entries.sort(([a2], [b2]) => a2 < b2 ? -1 : a2 > b2 ? 1 : 0);
36783
- return entries;
36784
- };
36785
- var normalizeMediaRequestInit = (requestInit) => {
36786
- if (!requestInit) {
36787
- return;
36788
- }
36789
- const headers = normalizeMediaHeaders(requestInit.headers);
36790
- const normalized = {
36791
- ...requestInit.cache === undefined ? null : { cache: requestInit.cache },
36792
- ...requestInit.credentials === undefined ? null : { credentials: requestInit.credentials },
36793
- ...headers === undefined ? null : { headers },
36794
- ...requestInit.integrity === undefined ? null : { integrity: requestInit.integrity },
36795
- ...requestInit.mode === undefined ? null : { mode: requestInit.mode },
36796
- ...requestInit.redirect === undefined ? null : { redirect: requestInit.redirect },
36797
- ...requestInit.referrer === undefined ? null : { referrer: requestInit.referrer },
36798
- ...requestInit.referrerPolicy === undefined ? null : { referrerPolicy: requestInit.referrerPolicy }
36799
- };
36800
- return Object.keys(normalized).length === 0 ? undefined : normalized;
36801
- };
36802
- var getMediaRequestInitFingerprint = (requestInit) => {
36803
- const normalized = normalizeMediaRequestInit(requestInit);
36804
- if (!normalized) {
36805
- return null;
36806
- }
36807
- return [
36808
- normalized.cache ?? null,
36809
- normalized.credentials ?? null,
36810
- normalized.integrity ?? null,
36811
- normalized.mode ?? null,
36812
- normalized.redirect ?? null,
36813
- normalized.referrer ?? null,
36814
- normalized.referrerPolicy ?? null,
36815
- normalized.headers ?? null
36816
- ];
36817
- };
36818
- var resolveRequestInit = ({
36819
- credentials,
36820
- requestInit
36821
- }) => {
36822
- if (credentials === undefined) {
36823
- return normalizeMediaRequestInit(requestInit);
36824
- }
36825
- return normalizeMediaRequestInit({
36826
- credentials,
36827
- ...requestInit
36828
- });
36829
- };
36830
36964
  var roundTo4Digits = (timestamp) => {
36831
36965
  return Math.round(timestamp * 1000) / 1000;
36832
36966
  };
@@ -37432,13 +37566,13 @@ class MediaPlayer {
37432
37566
  this.onVideoFrameCallback = onVideoFrameCallback;
37433
37567
  this.playing = playing;
37434
37568
  this.sequenceOffset = sequenceOffset;
37435
- const resolvedRequestInit = resolveRequestInit({ credentials, requestInit });
37436
- this.input = new Input2({
37437
- source: new UrlSource(this.src, resolvedRequestInit ? {
37438
- requestInit: resolvedRequestInit
37439
- } : undefined),
37440
- formats: ALL_FORMATS
37569
+ const { input, cacheKey } = acquireSharedInput({
37570
+ src: this.src,
37571
+ credentials,
37572
+ requestInit
37441
37573
  });
37574
+ this.input = input;
37575
+ this.inputCacheKey = cacheKey;
37442
37576
  this.tagType = tagType;
37443
37577
  this.getEffects = getEffects;
37444
37578
  this.getEffectChainState = getEffectChainState;
@@ -37456,8 +37590,10 @@ class MediaPlayer {
37456
37590
  }
37457
37591
  }
37458
37592
  input;
37593
+ inputCacheKey;
37594
+ disposed = false;
37459
37595
  isDisposalError() {
37460
- return this.input.disposed === true;
37596
+ return this.disposed || this.input.disposed === true;
37461
37597
  }
37462
37598
  initialize(startTimeUnresolved, initialMuted) {
37463
37599
  const promise = this._initialize(startTimeUnresolved, initialMuted);
@@ -37492,7 +37628,7 @@ class MediaPlayer {
37492
37628
  try {
37493
37629
  const _ = __using(__stack, this.delayPlaybackHandleIfNotPremounting(), 0);
37494
37630
  try {
37495
- if (this.input.disposed) {
37631
+ if (this.isDisposalError()) {
37496
37632
  return { type: "disposed" };
37497
37633
  }
37498
37634
  try {
@@ -37513,7 +37649,7 @@ class MediaPlayer {
37513
37649
  this.input.getPrimaryVideoTrack(),
37514
37650
  this.input.getAudioTracks()
37515
37651
  ]);
37516
- if (this.input.disposed) {
37652
+ if (this.isDisposalError()) {
37517
37653
  return { type: "disposed" };
37518
37654
  }
37519
37655
  this.totalDuration = durationInSeconds;
@@ -37536,7 +37672,7 @@ class MediaPlayer {
37536
37672
  if (!canDecode) {
37537
37673
  return { type: "cannot-decode" };
37538
37674
  }
37539
- if (this.input.disposed) {
37675
+ if (this.isDisposalError()) {
37540
37676
  return { type: "disposed" };
37541
37677
  }
37542
37678
  this.videoIteratorManager = await videoIteratorManager({
@@ -37569,7 +37705,7 @@ class MediaPlayer {
37569
37705
  if (!canDecode) {
37570
37706
  return { type: "cannot-decode" };
37571
37707
  }
37572
- if (this.input.disposed) {
37708
+ if (this.isDisposalError()) {
37573
37709
  return { type: "disposed" };
37574
37710
  }
37575
37711
  this.audioIteratorManager = audioIteratorManager({
@@ -37788,6 +37924,10 @@ class MediaPlayer {
37788
37924
  }
37789
37925
  }
37790
37926
  async dispose() {
37927
+ if (this.disposed) {
37928
+ return;
37929
+ }
37930
+ this.disposed = true;
37791
37931
  if (this.initializationPromise) {
37792
37932
  try {
37793
37933
  await this.initializationPromise;
@@ -37796,7 +37936,7 @@ class MediaPlayer {
37796
37936
  this.nonceManager.createAsyncOperation();
37797
37937
  this.videoIteratorManager?.destroy();
37798
37938
  this.audioIteratorManager?.destroyIterator();
37799
- this.input.dispose();
37939
+ releaseSharedInput(this.inputCacheKey);
37800
37940
  }
37801
37941
  getTargetTime = (mediaTimestamp, currentTime) => {
37802
37942
  if (!this.sharedAudioContext) {
@@ -40553,7 +40693,6 @@ var Audio2 = Interactive.withSchema({
40553
40693
  schema: audioSchema,
40554
40694
  supportsEffects: false
40555
40695
  });
40556
- Internals.addSequenceStackTraces(Audio2);
40557
40696
  var cache2 = new Map;
40558
40697
  var cacheVideoFrame = (src, sourceCanvas) => {
40559
40698
  const { width, height } = sourceCanvas;
@@ -41583,7 +41722,6 @@ var Video = Interactive.withSchema({
41583
41722
  schema: videoSchema,
41584
41723
  supportsEffects: true
41585
41724
  });
41586
- Internals.addSequenceStackTraces(Video);
41587
41725
 
41588
41726
  // src/components/homepage/Demo/Comp.tsx
41589
41727
  import { useCallback as useCallback47, useEffect as useEffect49, useMemo as useMemo61, useState as useState48 } from "react";
@@ -42891,7 +43029,7 @@ import {
42891
43029
  import { BufferTarget, StreamTarget } from "mediabunny";
42892
43030
 
42893
43031
  // ../core/dist/esm/version.mjs
42894
- var VERSION2 = "4.0.488";
43032
+ var VERSION2 = "4.0.490";
42895
43033
 
42896
43034
  // ../web-renderer/dist/esm/index.mjs
42897
43035
  import { AudioSample, VideoSample } from "mediabunny";
@@ -50059,7 +50197,7 @@ var GithubButton = () => {
50059
50197
  " ",
50060
50198
  /* @__PURE__ */ jsx134("div", {
50061
50199
  className: "text-xs inline-block ml-2 leading-none mt-[3px] self-center",
50062
- children: "52k"
50200
+ children: "53k"
50063
50201
  })
50064
50202
  ]
50065
50203
  });