@microfox/remotion 1.2.1 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -29,24 +29,32 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  // src/index.ts
30
30
  var index_exports = {};
31
31
  __export(index_exports, {
32
- AudioAtom: () => Atom5,
33
- AudioAtomConfig: () => config13,
32
+ AudioAtom: () => Atom6,
33
+ AudioAtomConfig: () => config15,
34
34
  BaseLayout: () => Layout,
35
- BaseLayoutConfig: () => config8,
35
+ BaseLayoutConfig: () => config10,
36
36
  BlurEffect: () => BlurEffect,
37
37
  BlurEffectConfig: () => config2,
38
+ CanvasAtom: () => Atom,
39
+ CanvasAtomConfig: () => config9,
40
+ CanvasContentAwareReveal: () => CanvasContentAwareReveal,
41
+ CanvasGlitchEffect: () => CanvasGlitchEffect,
42
+ CanvasParticleEffect: () => CanvasParticleEffect,
43
+ CanvasWipeReveal: () => CanvasWipeReveal,
38
44
  ComponentRenderer: () => ComponentRenderer,
39
45
  Composition: () => Composition,
40
46
  CompositionLayout: () => CompositionLayout,
41
47
  CompositionProvider: () => CompositionProvider,
42
48
  Frame: () => Frame,
43
49
  GenericEffectPresets: () => GenericEffectPresets,
44
- ImageAtom: () => Atom2,
45
- ImageAtomConfig: () => config10,
50
+ HTMLBlockAtom: () => Atom8,
51
+ HTMLBlockAtomConfig: () => config17,
52
+ ImageAtom: () => Atom3,
53
+ ImageAtomConfig: () => config12,
46
54
  LoopEffect: () => LoopEffect,
47
55
  LoopEffectConfig: () => config3,
48
- LottieAtom: () => Atom6,
49
- LottieAtomConfig: () => config14,
56
+ LottieAtom: () => Atom7,
57
+ LottieAtomConfig: () => config16,
50
58
  NextjsLogo: () => NextjsLogo,
51
59
  PanEffect: () => PanEffect,
52
60
  PanEffectConfig: () => config4,
@@ -56,19 +64,21 @@ __export(index_exports, {
56
64
  SceneFrame: () => SceneFrame,
57
65
  ShakeEffect: () => ShakeEffect,
58
66
  ShakeEffectConfig: () => config6,
59
- ShapeAtom: () => Atom,
60
- ShapeAtomConfig: () => config9,
67
+ ShapeAtom: () => Atom2,
68
+ ShapeAtomConfig: () => config11,
61
69
  StretchEffect: () => StretchEffect,
62
70
  StretchEffectConfig: () => config7,
63
- TextAtom: () => Atom3,
64
- TextAtomConfig: () => config11,
71
+ TextAtom: () => Atom4,
72
+ TextAtomConfig: () => config13,
65
73
  TextFade: () => TextFade,
66
74
  UniversalEffect: () => UniversalEffect,
67
75
  UniversalEffectProvider: () => UniversalEffectProvider,
68
- VideoAtom: () => Atom4,
69
- VideoAtomConfig: () => config12,
76
+ VideoAtom: () => Atom5,
77
+ VideoAtomConfig: () => config14,
70
78
  Waveform: () => Waveform,
71
79
  WaveformCircle: () => WaveformCircle,
80
+ WaveformEffect: () => WaveformEffect,
81
+ WaveformEffectConfig: () => config8,
72
82
  WaveformHistogram: () => WaveformHistogram,
73
83
  WaveformHistogramRanged: () => WaveformHistogramRanged,
74
84
  WaveformLine: () => WaveformLine,
@@ -135,21 +145,21 @@ var ComponentRegistryManager = class {
135
145
  this.registry = {};
136
146
  this.packageRegistry = {};
137
147
  }
138
- registerComponent(name, component, type, config15 = { displayName: "" }, packageName) {
139
- this.registry[name] = { component, config: config15 };
148
+ registerComponent(name, component, type, config18 = { displayName: "" }, packageName) {
149
+ this.registry[name] = { component, config: config18 };
140
150
  if (packageName) {
141
151
  if (!this.packageRegistry[packageName]) {
142
152
  this.packageRegistry[packageName] = {};
143
153
  }
144
- this.packageRegistry[packageName][name] = { component, config: config15 };
154
+ this.packageRegistry[packageName][name] = { component, config: config18 };
145
155
  }
146
156
  }
147
- registerEffect(name, component, config15 = { displayName: "" }, packageName) {
157
+ registerEffect(name, component, config18 = { displayName: "" }, packageName) {
148
158
  this.registerComponent(
149
159
  name?.includes("effect-") ? name : `effect-${name}`,
150
160
  component,
151
161
  "layout",
152
- config15,
162
+ config18,
153
163
  packageName
154
164
  );
155
165
  }
@@ -164,8 +174,8 @@ var ComponentRegistryManager = class {
164
174
  }
165
175
  registerPackage(packageName, components) {
166
176
  this.packageRegistry[packageName] = components;
167
- Object.entries(components).forEach(([name, { component, config: config15 }]) => {
168
- this.registry[`${packageName}:${name}`] = { component, config: config15 };
177
+ Object.entries(components).forEach(([name, { component, config: config18 }]) => {
178
+ this.registry[`${packageName}:${name}`] = { component, config: config18 };
169
179
  });
170
180
  }
171
181
  getPackageComponents(packageName) {
@@ -180,17 +190,17 @@ var ComponentRegistryManager = class {
180
190
  }
181
191
  };
182
192
  var componentRegistry = new ComponentRegistryManager();
183
- var registerComponent = (name, component, type, config15 = { displayName: "" }, packageName) => {
193
+ var registerComponent = (name, component, type, config18 = { displayName: "" }, packageName) => {
184
194
  componentRegistry.registerComponent(
185
195
  name,
186
196
  component,
187
197
  type,
188
- config15,
198
+ config18,
189
199
  packageName
190
200
  );
191
201
  };
192
- var registerEffect = (name, component, config15 = { displayName: "" }, packageName) => {
193
- componentRegistry.registerEffect(name, component, config15, packageName);
202
+ var registerEffect = (name, component, config18 = { displayName: "" }, packageName) => {
203
+ componentRegistry.registerEffect(name, component, config18, packageName);
194
204
  };
195
205
  var registerPackage = (packageName, components) => {
196
206
  componentRegistry.registerPackage(packageName, components);
@@ -273,9 +283,9 @@ var calculateComponentDuration = async (component) => {
273
283
  } else {
274
284
  }
275
285
  };
276
- var calculateDuration = async (childrenData, config15) => {
286
+ var calculateDuration = async (childrenData, config18) => {
277
287
  let calculatedDuration = void 0;
278
- const targetIds = Array.isArray(config15.fitDurationTo) ? config15.fitDurationTo : [config15.fitDurationTo];
288
+ const targetIds = Array.isArray(config18.fitDurationTo) ? config18.fitDurationTo : [config18.fitDurationTo];
279
289
  const matchingComponents = findMatchingComponents(
280
290
  childrenData || [],
281
291
  targetIds
@@ -629,8 +639,8 @@ var ComponentRenderer = ({
629
639
  context
630
640
  };
631
641
  if (type === "layout") {
632
- const config15 = getComponentConfig(componentId);
633
- const isInnerSequence = config15?.isInnerSequence;
642
+ const config18 = getComponentConfig(componentId);
643
+ const isInnerSequence = config18?.isInnerSequence;
634
644
  if (isInnerSequence) {
635
645
  return /* @__PURE__ */ import_react3.default.createElement(RenderContext.Provider, { value: newContext }, /* @__PURE__ */ import_react3.default.createElement(ComponentClass, { ...props }, effects && effects.length > 0 ? /* @__PURE__ */ import_react3.default.createElement(EffectWrapper, { effects, context: newContext }, childrenData?.map((child) => /* @__PURE__ */ import_react3.default.createElement(ComponentRenderer, { key: child.id, ...child }))) : childrenData?.map((child) => /* @__PURE__ */ import_react3.default.createElement(ComponentRenderer, { key: child.id, ...child }))));
636
646
  }
@@ -673,8 +683,8 @@ var SceneFrame = ({ children }) => {
673
683
  };
674
684
 
675
685
  // src/components/layouts/BaseLayout.tsx
676
- var import_react13 = __toESM(require("react"));
677
- var import_remotion9 = require("remotion");
686
+ var import_react20 = __toESM(require("react"));
687
+ var import_remotion14 = require("remotion");
678
688
 
679
689
  // src/components/effects/BlurEffect.tsx
680
690
  var import_react7 = __toESM(require("react"));
@@ -688,10 +698,45 @@ var parseFunctionsString = (functions) => {
688
698
  if (!functions) {
689
699
  return result;
690
700
  }
691
- const regex = /(\w+)\(([^)]*)\)/g;
692
- let match;
693
- while ((match = regex.exec(functions)) !== null) {
694
- result.set(match[1], match[0]);
701
+ let i = 0;
702
+ while (i < functions.length) {
703
+ while (i < functions.length && /\s/.test(functions[i])) {
704
+ i++;
705
+ }
706
+ if (i >= functions.length) break;
707
+ const nameStart = i;
708
+ while (i < functions.length && /[\w-]/.test(functions[i])) {
709
+ i++;
710
+ }
711
+ if (i === nameStart) break;
712
+ const functionName = functions.substring(nameStart, i);
713
+ while (i < functions.length && /\s/.test(functions[i])) {
714
+ i++;
715
+ }
716
+ if (i >= functions.length || functions[i] !== "(") {
717
+ break;
718
+ }
719
+ i++;
720
+ let depth = 1;
721
+ const contentStart = i;
722
+ while (i < functions.length && depth > 0) {
723
+ if (functions[i] === "(") {
724
+ depth++;
725
+ } else if (functions[i] === ")") {
726
+ depth--;
727
+ }
728
+ if (depth > 0) {
729
+ i++;
730
+ }
731
+ }
732
+ if (depth === 0) {
733
+ const content = functions.substring(contentStart, i);
734
+ const fullFunction = `${functionName}(${content})`;
735
+ result.set(functionName, fullFunction);
736
+ i++;
737
+ } else {
738
+ break;
739
+ }
695
740
  }
696
741
  return result;
697
742
  };
@@ -855,11 +900,20 @@ var parseHexColor = (hex) => {
855
900
  var parseRgbaColor = (rgba) => {
856
901
  const match = rgba.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/);
857
902
  if (match) {
903
+ let alpha = 1;
904
+ if (match[4]) {
905
+ const alphaValue = parseFloat(match[4]);
906
+ if (alphaValue > 1) {
907
+ alpha = Math.max(0, Math.min(1, alphaValue / 100));
908
+ } else {
909
+ alpha = Math.max(0, Math.min(1, alphaValue));
910
+ }
911
+ }
858
912
  return {
859
913
  r: Math.max(0, Math.min(255, parseInt(match[1], 10))),
860
914
  g: Math.max(0, Math.min(255, parseInt(match[2], 10))),
861
915
  b: Math.max(0, Math.min(255, parseInt(match[3], 10))),
862
- a: match[4] ? Math.max(0, Math.min(1, parseFloat(match[4]))) : 1
916
+ a: alpha
863
917
  };
864
918
  }
865
919
  return { r: 0, g: 0, b: 0, a: 1 };
@@ -873,14 +927,21 @@ var parseColor = (color) => {
873
927
  }
874
928
  return { r: 0, g: 0, b: 0, a: 1 };
875
929
  };
876
- var rgbaToString = (color) => {
877
- if (color.a === 1) {
878
- return `rgb(${Math.round(color.r)}, ${Math.round(color.g)}, ${Math.round(color.b)})`;
879
- } else {
880
- return `rgba(${Math.round(color.r)}, ${Math.round(color.g)}, ${Math.round(color.b)}, ${color.a})`;
930
+ var rgbaToString = (color, preserveFormat) => {
931
+ const r = Math.round(color.r);
932
+ const g = Math.round(color.g);
933
+ const b = Math.round(color.b);
934
+ const a = color.a;
935
+ if (preserveFormat) {
936
+ if (preserveFormat.hasSpaces) {
937
+ return `rgba(${r}, ${g}, ${b}, ${a})`;
938
+ } else {
939
+ return `rgba(${r},${g},${b},${a})`;
940
+ }
881
941
  }
942
+ return `rgba(${r}, ${g}, ${b}, ${a})`;
882
943
  };
883
- var interpolateColors = (color1, color2, progress) => {
944
+ var interpolateColors = (color1, color2, progress, preserveFormat) => {
884
945
  const parsedColor1 = parseColor(color1);
885
946
  const parsedColor2 = parseColor(color2);
886
947
  const interpolatedColor = {
@@ -889,7 +950,75 @@ var interpolateColors = (color1, color2, progress) => {
889
950
  b: (0, import_remotion4.interpolate)(progress, [0, 1], [parsedColor1.b, parsedColor2.b]),
890
951
  a: (0, import_remotion4.interpolate)(progress, [0, 1], [parsedColor1.a, parsedColor2.a])
891
952
  };
892
- return rgbaToString(interpolatedColor);
953
+ return rgbaToString(interpolatedColor, preserveFormat);
954
+ };
955
+ var findColorsInString = (str) => {
956
+ const matches = [];
957
+ const rgbaPattern = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/g;
958
+ let match;
959
+ rgbaPattern.lastIndex = 0;
960
+ while ((match = rgbaPattern.exec(str)) !== null) {
961
+ matches.push({
962
+ fullMatch: match[0],
963
+ color: match[0],
964
+ startIndex: match.index,
965
+ endIndex: match.index + match[0].length
966
+ });
967
+ }
968
+ const hexPattern = /#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})\b/g;
969
+ hexPattern.lastIndex = 0;
970
+ while ((match = hexPattern.exec(str)) !== null) {
971
+ matches.push({
972
+ fullMatch: match[0],
973
+ color: match[0],
974
+ startIndex: match.index,
975
+ endIndex: match.index + match[0].length
976
+ });
977
+ }
978
+ return matches.sort((a, b) => a.startIndex - b.startIndex);
979
+ };
980
+ var interpolateColorsInString = (str1, str2, progress) => {
981
+ const colors1 = findColorsInString(str1);
982
+ const colors2 = findColorsInString(str2);
983
+ if (colors1.length === 0 && colors2.length === 0) {
984
+ return str1;
985
+ }
986
+ if (colors1.length === 0 || colors2.length === 0) {
987
+ return str1;
988
+ }
989
+ const minLength = Math.min(colors1.length, colors2.length);
990
+ const replacements = [];
991
+ for (let i = 0; i < minLength; i++) {
992
+ const color1 = colors1[i];
993
+ const color2 = colors2[i];
994
+ const originalColor = color1.color;
995
+ const hasSpaces = originalColor.includes(", ");
996
+ const interpolatedColor = interpolateColors(color1.color, color2.color, progress, { hasSpaces });
997
+ replacements.push({
998
+ startIndex: color1.startIndex,
999
+ endIndex: color1.endIndex,
1000
+ replacement: interpolatedColor
1001
+ });
1002
+ }
1003
+ replacements.sort((a, b) => b.startIndex - a.startIndex);
1004
+ let result = str1;
1005
+ for (const replacement of replacements) {
1006
+ const originalSubstring = result.substring(replacement.startIndex, replacement.endIndex);
1007
+ const expectedColor = colors1.find((c) => c.startIndex === replacement.startIndex);
1008
+ if (expectedColor && (originalSubstring === expectedColor.color || originalSubstring.trim().match(/^rgba?\(/i))) {
1009
+ result = result.substring(0, replacement.startIndex) + replacement.replacement + result.substring(replacement.endIndex);
1010
+ } else {
1011
+ const currentColors = findColorsInString(result);
1012
+ const matchingColor = currentColors.find(
1013
+ (c) => Math.abs(c.startIndex - replacement.startIndex) < 30
1014
+ // Allow some offset
1015
+ );
1016
+ if (matchingColor) {
1017
+ result = result.substring(0, matchingColor.startIndex) + replacement.replacement + result.substring(matchingColor.endIndex);
1018
+ }
1019
+ }
1020
+ }
1021
+ return result;
893
1022
  };
894
1023
  var calculateAnimatedValue = (ranges, progress, key) => {
895
1024
  const sortedRanges = [...ranges].sort((a, b) => a.prog - b.prog);
@@ -925,6 +1054,11 @@ var calculateAnimatedValue = (ranges, progress, key) => {
925
1054
  if (isColor(currentValue) && isColor(nextValue)) {
926
1055
  return interpolateColors(currentValue, nextValue, localProgress);
927
1056
  }
1057
+ const colors1 = findColorsInString(currentValue);
1058
+ const colors2 = findColorsInString(nextValue);
1059
+ if (colors1.length > 0 || colors2.length > 0) {
1060
+ return interpolateColorsInString(currentValue, nextValue, localProgress);
1061
+ }
928
1062
  const getUnitAndValue = (str) => {
929
1063
  const units = ["vmax", "vmin", "rem", "deg", "bpm", "vh", "vw", "px", "em", "ms", "hz", "db", "fr", "s", "%"];
930
1064
  for (const unit of units) {
@@ -973,7 +1107,7 @@ var rangesToCSSProperties = (ranges, progress) => {
973
1107
  const value = calculateAnimatedValue(keyRanges, progress, key);
974
1108
  switch (key) {
975
1109
  case "scale":
976
- styles.transform = `scale(${value})`;
1110
+ styles.transform = `${styles.transform || ""} scale(${value})`.trim();
977
1111
  break;
978
1112
  case "rotate":
979
1113
  const rotateValue = typeof value === "string" && value.includes("deg") ? value : `${value}deg`;
@@ -1879,226 +2013,1743 @@ var config7 = {
1879
2013
  }
1880
2014
  };
1881
2015
 
1882
- // src/components/effects/GenericPresets.ts
1883
- var fadeInPreset = [
1884
- { key: "opacity", val: 0, prog: 0 },
1885
- { key: "opacity", val: 1, prog: 1 }
1886
- ];
1887
- var fadeOutPreset = [
1888
- { key: "opacity", val: 1, prog: 0 },
1889
- { key: "opacity", val: 0, prog: 1 }
1890
- ];
1891
- var scaleInPreset = [
1892
- { key: "scale", val: 0, prog: 0 },
1893
- { key: "scale", val: 1, prog: 1 }
1894
- ];
1895
- var scaleOutPreset = [
1896
- { key: "scale", val: 1, prog: 0 },
1897
- { key: "scale", val: 0, prog: 1 }
1898
- ];
1899
- var slideInLeftPreset = [
1900
- { key: "translateX", val: -100, prog: 0 },
1901
- { key: "translateX", val: 0, prog: 1 }
1902
- ];
1903
- var slideInRightPreset = [
1904
- { key: "translateX", val: 100, prog: 0 },
1905
- { key: "translateX", val: 0, prog: 1 }
1906
- ];
1907
- var slideInTopPreset = [
1908
- { key: "translateY", val: -100, prog: 0 },
1909
- { key: "translateY", val: 0, prog: 1 }
1910
- ];
1911
- var slideInBottomPreset = [
1912
- { key: "translateY", val: 100, prog: 0 },
1913
- { key: "translateY", val: 0, prog: 1 }
1914
- ];
1915
- var bouncePreset = [
1916
- { key: "scale", val: 0, prog: 0 },
1917
- { key: "scale", val: 1.2, prog: 0.6 },
1918
- { key: "scale", val: 1, prog: 1 }
1919
- ];
1920
- var pulsePreset = [
1921
- { key: "scale", val: 1, prog: 0 },
1922
- { key: "scale", val: 1.1, prog: 0.5 },
1923
- { key: "scale", val: 1, prog: 1 }
1924
- ];
1925
- var rotateInPreset = [
1926
- { key: "rotate", val: -180, prog: 0 },
1927
- { key: "rotate", val: 0, prog: 1 }
1928
- ];
1929
- var blurInPreset = [
1930
- { key: "blur", val: 10, prog: 0 },
1931
- { key: "blur", val: 0, prog: 1 }
1932
- ];
1933
- var fadeInScalePreset = [
1934
- { key: "opacity", val: 0, prog: 0 },
1935
- { key: "opacity", val: 1, prog: 1 },
1936
- { key: "scale", val: 0.8, prog: 0 },
1937
- { key: "scale", val: 1, prog: 1 }
1938
- ];
1939
- var slideInFadePreset = [
1940
- { key: "translateX", val: -50, prog: 0 },
1941
- { key: "translateX", val: 0, prog: 1 },
1942
- { key: "opacity", val: 0, prog: 0 },
1943
- { key: "opacity", val: 1, prog: 1 }
1944
- ];
1945
- var slideInLeftStringPreset = [
1946
- { key: "translateX", val: "-100px", prog: 0 },
1947
- { key: "translateX", val: "0px", prog: 1 }
1948
- ];
1949
- var slideInRightStringPreset = [
1950
- { key: "translateX", val: "100px", prog: 0 },
1951
- { key: "translateX", val: "0px", prog: 1 }
1952
- ];
1953
- var slideInTopStringPreset = [
1954
- { key: "translateY", val: "-100px", prog: 0 },
1955
- { key: "translateY", val: "0px", prog: 1 }
1956
- ];
1957
- var slideInBottomStringPreset = [
1958
- { key: "translateY", val: "100px", prog: 0 },
1959
- { key: "translateY", val: "0px", prog: 1 }
1960
- ];
1961
- var rotateInStringPreset = [
1962
- { key: "rotate", val: "-180deg", prog: 0 },
1963
- { key: "rotate", val: "0deg", prog: 1 }
1964
- ];
1965
- var blurInStringPreset = [
1966
- { key: "blur", val: "10px", prog: 0 },
1967
- { key: "blur", val: "0px", prog: 1 }
1968
- ];
1969
- var scaleInStringPreset = [
1970
- { key: "scale", val: 0, prog: 0 },
1971
- { key: "scale", val: 1, prog: 1 }
1972
- ];
1973
- var slideInLeftResponsivePreset = [
1974
- { key: "translateX", val: "-50vw", prog: 0 },
1975
- { key: "translateX", val: "0vw", prog: 1 }
1976
- ];
1977
- var slideInTopResponsivePreset = [
1978
- { key: "translateY", val: "-50vh", prog: 0 },
1979
- { key: "translateY", val: "0vh", prog: 1 }
1980
- ];
1981
- var backgroundColorPreset = [
1982
- { key: "backgroundColor", val: "#ff0000", prog: 0 },
1983
- { key: "backgroundColor", val: "#0000ff", prog: 1 }
1984
- ];
1985
- var borderRadiusPreset = [
1986
- { key: "borderRadius", val: "0px", prog: 0 },
1987
- { key: "borderRadius", val: "50px", prog: 1 }
1988
- ];
1989
- var boxShadowPreset = [
1990
- { key: "boxShadow", val: "0px 0px 0px rgba(0,0,0,0)", prog: 0 },
1991
- { key: "boxShadow", val: "10px 10px 20px rgba(0,0,0,0.5)", prog: 1 }
1992
- ];
1993
- var fontSizePreset = [
1994
- { key: "fontSize", val: "12px", prog: 0 },
1995
- { key: "fontSize", val: "24px", prog: 1 }
1996
- ];
1997
- var letterSpacingPreset = [
1998
- { key: "letterSpacing", val: "0px", prog: 0 },
1999
- { key: "letterSpacing", val: "5px", prog: 1 }
2000
- ];
2001
- var lineHeightPreset = [
2002
- { key: "lineHeight", val: "1", prog: 0 },
2003
- { key: "lineHeight", val: "2", prog: 1 }
2004
- ];
2005
- var textShadowPreset = [
2006
- { key: "textShadow", val: "0px 0px 0px rgba(0,0,0,0)", prog: 0 },
2007
- { key: "textShadow", val: "2px 2px 4px rgba(0,0,0,0.5)", prog: 1 }
2008
- ];
2009
- var widthPreset = [
2010
- { key: "width", val: "0px", prog: 0 },
2011
- { key: "width", val: "100%", prog: 1 }
2012
- ];
2013
- var heightPreset = [
2014
- { key: "height", val: "0px", prog: 0 },
2015
- { key: "height", val: "100%", prog: 1 }
2016
- ];
2017
- var marginPreset = [
2018
- { key: "margin", val: "0px", prog: 0 },
2019
- { key: "margin", val: "20px", prog: 1 }
2020
- ];
2021
- var paddingPreset = [
2022
- { key: "padding", val: "0px", prog: 0 },
2023
- { key: "padding", val: "20px", prog: 1 }
2024
- ];
2025
- var morphingCardPreset = [
2026
- { key: "borderRadius", val: "0px", prog: 0 },
2027
- { key: "borderRadius", val: "20px", prog: 0.5 },
2028
- { key: "borderRadius", val: "50px", prog: 1 },
2029
- { key: "boxShadow", val: "0px 0px 0px rgba(0,0,0,0)", prog: 0 },
2030
- { key: "boxShadow", val: "0px 10px 30px rgba(0,0,0,0.3)", prog: 1 },
2031
- { key: "backgroundColor", val: "#ffffff", prog: 0 },
2032
- { key: "backgroundColor", val: "#f0f0f0", prog: 1 }
2033
- ];
2034
- var textRevealPreset = [
2035
- { key: "opacity", val: 0, prog: 0 },
2036
- { key: "opacity", val: 1, prog: 1 },
2037
- { key: "letterSpacing", val: "10px", prog: 0 },
2038
- { key: "letterSpacing", val: "0px", prog: 1 },
2039
- { key: "textShadow", val: "0px 0px 0px rgba(0,0,0,0)", prog: 0 },
2040
- { key: "textShadow", val: "2px 2px 4px rgba(0,0,0,0.5)", prog: 1 }
2041
- ];
2042
- var GenericEffectPresets = {
2043
- fadeInPreset,
2044
- fadeOutPreset,
2045
- scaleInPreset,
2046
- scaleOutPreset,
2047
- slideInLeftPreset,
2048
- slideInRightPreset,
2049
- slideInTopPreset,
2050
- slideInBottomPreset,
2051
- bouncePreset,
2052
- pulsePreset,
2053
- rotateInPreset,
2054
- blurInPreset,
2055
- fadeInScalePreset,
2056
- slideInFadePreset,
2057
- // String-based presets
2058
- slideInLeftStringPreset,
2059
- slideInRightStringPreset,
2060
- slideInTopStringPreset,
2061
- slideInBottomStringPreset,
2062
- rotateInStringPreset,
2063
- blurInStringPreset,
2064
- scaleInStringPreset,
2065
- slideInLeftResponsivePreset,
2066
- slideInTopResponsivePreset,
2067
- // Custom CSS property presets
2068
- backgroundColorPreset,
2069
- borderRadiusPreset,
2070
- boxShadowPreset,
2071
- fontSizePreset,
2072
- letterSpacingPreset,
2073
- lineHeightPreset,
2074
- textShadowPreset,
2075
- widthPreset,
2076
- heightPreset,
2077
- marginPreset,
2078
- paddingPreset,
2079
- morphingCardPreset,
2080
- textRevealPreset
2081
- };
2082
-
2083
- // src/components/effects/index.ts
2084
- registerEffect(config2.displayName, BlurEffect, config2);
2085
- registerEffect(config3.displayName, LoopEffect, config3);
2086
- registerEffect(config4.displayName, PanEffect, config4);
2087
- registerEffect(config5.displayName, ZoomEffect, config5);
2088
- registerEffect("generic", UniversalEffect, config);
2089
- registerEffect(config6.displayName, ShakeEffect, config6);
2090
- registerEffect(
2091
- config7.displayName,
2092
- StretchEffect,
2093
- config7
2094
- );
2016
+ // src/components/effects/WaveformEffect.tsx
2017
+ var import_react14 = __toESM(require("react"));
2095
2018
 
2096
- // src/components/layouts/BaseLayout.tsx
2097
- var Layout = ({ id, children, data, context }) => {
2098
- const { containerProps = {}, childrenProps = [], repeatChildrenProps = {} } = data;
2099
- const overrideStyles = useAnimatedStyles(id);
2100
- const childrenArray = import_react13.Children.toArray(children);
2101
- const enhancedStyle = (0, import_react13.useMemo)(
2019
+ // src/templates/waveform/hooks/useWaveformData.ts
2020
+ var import_react13 = require("react");
2021
+ var import_media_utils = require("@remotion/media-utils");
2022
+ var import_remotion9 = require("remotion");
2023
+ var isValidPowerOfTwo = (num) => {
2024
+ return num > 0 && (num & num - 1) === 0;
2025
+ };
2026
+ var getClosestPowerOfTwo = (num) => {
2027
+ if (num <= 0) return 32;
2028
+ let power = 1;
2029
+ while (power < num) {
2030
+ power *= 2;
2031
+ }
2032
+ const lower = power / 2;
2033
+ const upper = power;
2034
+ return Math.abs(num - lower) < Math.abs(num - upper) ? lower : upper;
2035
+ };
2036
+ var useWaveformData = (config18) => {
2037
+ const {
2038
+ audioSrc,
2039
+ numberOfSamples,
2040
+ windowInSeconds,
2041
+ dataOffsetInSeconds = 0,
2042
+ normalize = false,
2043
+ frame,
2044
+ fps,
2045
+ posterize,
2046
+ includeFrequencyData = false,
2047
+ minDb = -100,
2048
+ maxDb = -30,
2049
+ smoothNormalisation = 1
2050
+ } = config18;
2051
+ const { root } = useComposition();
2052
+ const validatedNumberOfSamples = (0, import_react13.useMemo)(() => {
2053
+ if (!isValidPowerOfTwo(numberOfSamples)) {
2054
+ console.warn(
2055
+ `numberOfSamples must be a power of 2. Adjusting ${numberOfSamples} to ${getClosestPowerOfTwo(numberOfSamples)}`
2056
+ );
2057
+ return getClosestPowerOfTwo(numberOfSamples);
2058
+ }
2059
+ return numberOfSamples;
2060
+ }, [numberOfSamples]);
2061
+ const { source, audioStartsFrom } = (0, import_react13.useMemo)(() => {
2062
+ if (audioSrc.startsWith("http")) {
2063
+ return { source: audioSrc, audioStartsFrom: void 0 };
2064
+ }
2065
+ if (audioSrc.startsWith("ref:")) {
2066
+ const matchingComponent = findMatchingComponents(root, [
2067
+ audioSrc.replace("ref:", "")
2068
+ ]);
2069
+ if (matchingComponent.length > 0) {
2070
+ const firstMatchingComponent = matchingComponent[0];
2071
+ if (firstMatchingComponent.componentId === "AudioAtom") {
2072
+ return {
2073
+ source: firstMatchingComponent.data.src,
2074
+ audioStartsFrom: firstMatchingComponent.data?.startFrom ?? void 0
2075
+ };
2076
+ }
2077
+ if (firstMatchingComponent.type === "layout" || firstMatchingComponent.type === "scene") {
2078
+ const audioComponents = findMatchingComponentsByQuery(
2079
+ firstMatchingComponent.childrenData,
2080
+ { componentId: "AudioAtom" }
2081
+ );
2082
+ if (audioComponents.length > 0) {
2083
+ return {
2084
+ source: audioComponents[0].data.src,
2085
+ audioStartsFrom: audioComponents[0].data?.startFrom ?? void 0
2086
+ };
2087
+ }
2088
+ }
2089
+ }
2090
+ }
2091
+ return { source: (0, import_remotion9.staticFile)(audioSrc), audioStartsFrom: void 0 };
2092
+ }, [audioSrc]);
2093
+ const audioData = (0, import_media_utils.useAudioData)(source);
2094
+ const adjustedFrame = (0, import_react13.useMemo)(() => {
2095
+ if (posterize && posterize > 1) {
2096
+ return Math.round(frame / posterize) * posterize;
2097
+ }
2098
+ let offset = 0;
2099
+ if (audioStartsFrom && audioStartsFrom != 0) {
2100
+ offset += Math.round(audioStartsFrom * fps);
2101
+ }
2102
+ if (dataOffsetInSeconds != 0) {
2103
+ offset += Math.round(dataOffsetInSeconds * fps);
2104
+ }
2105
+ return frame + offset;
2106
+ }, [frame, posterize, dataOffsetInSeconds, audioStartsFrom]);
2107
+ const waveformData = (0, import_react13.useMemo)(() => {
2108
+ if (!audioData) return null;
2109
+ try {
2110
+ const baseSmoothingFrames = 3;
2111
+ const smoothingFrames = smoothNormalisation > 0 ? Math.floor(smoothNormalisation * baseSmoothingFrames) : 0;
2112
+ const samples = [];
2113
+ if (smoothingFrames === 0) {
2114
+ const waveform = (0, import_media_utils.visualizeAudioWaveform)({
2115
+ fps,
2116
+ frame: adjustedFrame,
2117
+ audioData,
2118
+ numberOfSamples: validatedNumberOfSamples,
2119
+ windowInSeconds,
2120
+ dataOffsetInSeconds: 0,
2121
+ normalize
2122
+ });
2123
+ return waveform;
2124
+ }
2125
+ for (let offset = -smoothingFrames; offset <= smoothingFrames; offset++) {
2126
+ const sampleFrame = adjustedFrame + offset;
2127
+ if (sampleFrame >= 0) {
2128
+ try {
2129
+ const waveform = (0, import_media_utils.visualizeAudioWaveform)({
2130
+ fps,
2131
+ frame: sampleFrame,
2132
+ audioData,
2133
+ numberOfSamples: validatedNumberOfSamples,
2134
+ windowInSeconds,
2135
+ dataOffsetInSeconds: 0,
2136
+ normalize
2137
+ });
2138
+ if (waveform && waveform.length > 0) {
2139
+ samples.push(waveform);
2140
+ }
2141
+ } catch (e) {
2142
+ }
2143
+ }
2144
+ }
2145
+ if (samples.length === 0) {
2146
+ const waveform = (0, import_media_utils.visualizeAudioWaveform)({
2147
+ fps,
2148
+ frame: adjustedFrame,
2149
+ audioData,
2150
+ numberOfSamples: validatedNumberOfSamples,
2151
+ windowInSeconds,
2152
+ dataOffsetInSeconds: 0,
2153
+ normalize
2154
+ });
2155
+ return waveform;
2156
+ }
2157
+ const averaged = new Array(validatedNumberOfSamples).fill(0);
2158
+ for (let i = 0; i < validatedNumberOfSamples; i++) {
2159
+ let sum = 0;
2160
+ let count = 0;
2161
+ for (const sample of samples) {
2162
+ if (sample[i] !== void 0) {
2163
+ sum += sample[i];
2164
+ count++;
2165
+ }
2166
+ }
2167
+ averaged[i] = count > 0 ? sum / count : 0;
2168
+ }
2169
+ return averaged;
2170
+ } catch (error2) {
2171
+ console.error("Error generating waveform:", error2);
2172
+ return null;
2173
+ }
2174
+ }, [
2175
+ audioData,
2176
+ adjustedFrame,
2177
+ fps,
2178
+ validatedNumberOfSamples,
2179
+ windowInSeconds,
2180
+ dataOffsetInSeconds,
2181
+ normalize,
2182
+ smoothNormalisation
2183
+ ]);
2184
+ const {
2185
+ frequencyData,
2186
+ amplitudes,
2187
+ bass,
2188
+ mid,
2189
+ treble,
2190
+ bassValues,
2191
+ midValues,
2192
+ trebleValues
2193
+ } = (0, import_react13.useMemo)(() => {
2194
+ if (!audioData || !includeFrequencyData) {
2195
+ return {
2196
+ frequencyData: null,
2197
+ amplitudes: null,
2198
+ bass: null,
2199
+ mid: null,
2200
+ treble: null,
2201
+ bassValues: null,
2202
+ midValues: null,
2203
+ trebleValues: null
2204
+ };
2205
+ }
2206
+ try {
2207
+ const baseSmoothingFrames = 3;
2208
+ const smoothingFrames = smoothNormalisation > 0 ? Math.floor(smoothNormalisation * baseSmoothingFrames) : 0;
2209
+ const frequencySamples = [];
2210
+ let frequencyData2;
2211
+ if (smoothingFrames === 0) {
2212
+ frequencyData2 = (0, import_media_utils.visualizeAudio)({
2213
+ fps,
2214
+ frame: adjustedFrame,
2215
+ audioData,
2216
+ numberOfSamples: validatedNumberOfSamples
2217
+ });
2218
+ } else {
2219
+ for (let offset = -smoothingFrames; offset <= smoothingFrames; offset++) {
2220
+ const sampleFrame = adjustedFrame + offset;
2221
+ if (sampleFrame >= 0) {
2222
+ try {
2223
+ const freqData = (0, import_media_utils.visualizeAudio)({
2224
+ fps,
2225
+ frame: sampleFrame,
2226
+ audioData,
2227
+ numberOfSamples: validatedNumberOfSamples
2228
+ });
2229
+ if (freqData && freqData.length > 0) {
2230
+ frequencySamples.push(freqData);
2231
+ }
2232
+ } catch (e) {
2233
+ }
2234
+ }
2235
+ }
2236
+ if (frequencySamples.length === 0) {
2237
+ frequencyData2 = (0, import_media_utils.visualizeAudio)({
2238
+ fps,
2239
+ frame: adjustedFrame,
2240
+ audioData,
2241
+ numberOfSamples: validatedNumberOfSamples
2242
+ });
2243
+ } else {
2244
+ frequencyData2 = new Array(validatedNumberOfSamples).fill(0);
2245
+ for (let i = 0; i < validatedNumberOfSamples; i++) {
2246
+ let sum = 0;
2247
+ let count = 0;
2248
+ for (const sample of frequencySamples) {
2249
+ if (sample[i] !== void 0) {
2250
+ sum += sample[i];
2251
+ count++;
2252
+ }
2253
+ }
2254
+ frequencyData2[i] = count > 0 ? sum / count : 0;
2255
+ }
2256
+ }
2257
+ }
2258
+ const { sampleRate } = audioData;
2259
+ const bassValues2 = [];
2260
+ const midValues2 = [];
2261
+ const trebleValues2 = [];
2262
+ for (let i = 0; i < frequencyData2.length; i++) {
2263
+ const freq = i * sampleRate / (2 * frequencyData2.length);
2264
+ const value = frequencyData2[i];
2265
+ if (freq >= 0 && freq < 250) {
2266
+ bassValues2.push(value * 2.5);
2267
+ } else if (freq >= 250 && freq < 4e3) {
2268
+ midValues2.push(value * 3);
2269
+ midValues2.push(value * 4.5);
2270
+ midValues2.push(value * 5);
2271
+ } else if (freq >= 4e3 && freq < sampleRate / 2) {
2272
+ trebleValues2.push(value * 30);
2273
+ }
2274
+ }
2275
+ const getAverage = (arr) => arr.length > 0 ? arr.reduce((a, b) => a + b, 0) / arr.length : 0;
2276
+ const bass2 = getAverage(bassValues2);
2277
+ const mid2 = getAverage(midValues2);
2278
+ const treble2 = getAverage(trebleValues2);
2279
+ const amplitudes2 = frequencyData2.map((value) => {
2280
+ const db = 20 * Math.log10(value);
2281
+ const scaled = (db - minDb) / (maxDb - minDb);
2282
+ return Math.max(0, Math.min(1, scaled));
2283
+ });
2284
+ return {
2285
+ frequencyData: frequencyData2,
2286
+ amplitudes: amplitudes2,
2287
+ bass: bass2,
2288
+ mid: mid2,
2289
+ treble: treble2,
2290
+ bassValues: bassValues2,
2291
+ midValues: midValues2,
2292
+ trebleValues: trebleValues2.reverse()
2293
+ };
2294
+ } catch (error2) {
2295
+ console.error("Error generating frequency data:", error2);
2296
+ return {
2297
+ frequencyData: null,
2298
+ amplitudes: null,
2299
+ bass: null,
2300
+ mid: null,
2301
+ treble: null
2302
+ };
2303
+ }
2304
+ }, [
2305
+ audioData,
2306
+ includeFrequencyData,
2307
+ adjustedFrame,
2308
+ fps,
2309
+ validatedNumberOfSamples,
2310
+ windowInSeconds,
2311
+ dataOffsetInSeconds,
2312
+ minDb,
2313
+ maxDb,
2314
+ smoothNormalisation
2315
+ ]);
2316
+ const isLoading = !audioData;
2317
+ const error = audioData === null && !isLoading ? "Failed to load audio data" : null;
2318
+ return {
2319
+ waveformData,
2320
+ frequencyData,
2321
+ amplitudes,
2322
+ audioData,
2323
+ isLoading,
2324
+ error,
2325
+ bass,
2326
+ bassValues,
2327
+ mid,
2328
+ midValues,
2329
+ treble,
2330
+ trebleValues
2331
+ };
2332
+ };
2333
+
2334
+ // src/components/effects/WaveformEffect.tsx
2335
+ var WaveformEffect = ({
2336
+ id,
2337
+ componentId,
2338
+ type,
2339
+ data,
2340
+ children,
2341
+ context
2342
+ }) => {
2343
+ const { progress, frame, mode, targetIds, effectData, fps } = useUniversalAnimation(data, context);
2344
+ const {
2345
+ audioSrc,
2346
+ numberOfSamples = 128,
2347
+ windowInSeconds,
2348
+ dataOffsetInSeconds = 0,
2349
+ normalize = false,
2350
+ useFrequencyData = true,
2351
+ audioProperty = "bass",
2352
+ sensitivity = 1,
2353
+ threshold = 0,
2354
+ smoothing = 0.5,
2355
+ smoothNormalisation = 1,
2356
+ effectType = "zoom",
2357
+ intensity = 1,
2358
+ minValue,
2359
+ maxValue,
2360
+ shakeAxis = "both",
2361
+ baseScale = 1,
2362
+ baseBrightness = 1,
2363
+ rotationRange = 15
2364
+ } = effectData;
2365
+ const parentContext = useUniversalEffectOptional();
2366
+ const analysisWindow = smoothNormalisation === 0 ? windowInSeconds || 1 / fps : windowInSeconds || Math.max(1 / fps, 0.05);
2367
+ const { bass, mid, treble, waveformData } = useWaveformData({
2368
+ audioSrc,
2369
+ numberOfSamples,
2370
+ windowInSeconds: analysisWindow,
2371
+ dataOffsetInSeconds,
2372
+ normalize,
2373
+ frame,
2374
+ fps,
2375
+ includeFrequencyData: useFrequencyData,
2376
+ smoothNormalisation
2377
+ });
2378
+ const audioIntensity = (0, import_react14.useMemo)(() => {
2379
+ let rawValue = 0;
2380
+ switch (audioProperty) {
2381
+ case "bass":
2382
+ rawValue = bass || 0;
2383
+ break;
2384
+ case "mid":
2385
+ rawValue = mid || 0;
2386
+ break;
2387
+ case "treble":
2388
+ rawValue = treble || 0;
2389
+ break;
2390
+ case "waveform":
2391
+ if (waveformData && waveformData.length > 0) {
2392
+ rawValue = waveformData.reduce((sum, val) => sum + Math.abs(val), 0) / waveformData.length;
2393
+ }
2394
+ break;
2395
+ case "frequency":
2396
+ rawValue = bass || 0;
2397
+ break;
2398
+ default:
2399
+ rawValue = bass || 0;
2400
+ }
2401
+ const thresholdedValue = Math.max(0, rawValue - threshold);
2402
+ const sensitizedValue = thresholdedValue * sensitivity;
2403
+ return Math.min(1, Math.max(0, sensitizedValue));
2404
+ }, [audioProperty, bass, mid, treble, waveformData, threshold, sensitivity]);
2405
+ const smoothedIntensity = (0, import_react14.useMemo)(() => {
2406
+ if (smoothNormalisation === 0) {
2407
+ return audioIntensity;
2408
+ }
2409
+ const smoothingPower = 1 + smoothing * 2;
2410
+ const smoothed = Math.pow(audioIntensity, smoothingPower);
2411
+ const baseline = 0.1;
2412
+ const filtered = smoothed * (1 - baseline * smoothing) + baseline * smoothing;
2413
+ return Math.min(1, Math.max(0, filtered));
2414
+ }, [audioIntensity, smoothing, smoothNormalisation]);
2415
+ const animatedStyles = (0, import_react14.useMemo)(() => {
2416
+ const intensityValue = smoothedIntensity || audioIntensity;
2417
+ let effectValue = intensityValue * intensity;
2418
+ if (minValue !== void 0 || maxValue !== void 0) {
2419
+ const defaultMin = effectType === "zoom" || effectType === "scale" ? baseScale : 0;
2420
+ const defaultMax = effectType === "zoom" || effectType === "scale" ? baseScale + intensity : intensity;
2421
+ const min = minValue !== void 0 ? minValue : defaultMin;
2422
+ const max = maxValue !== void 0 ? maxValue : defaultMax;
2423
+ effectValue = min + intensityValue * (max - min);
2424
+ } else {
2425
+ switch (effectType) {
2426
+ case "zoom":
2427
+ case "scale":
2428
+ effectValue = baseScale + intensityValue * intensity;
2429
+ break;
2430
+ case "exposure":
2431
+ effectValue = baseBrightness + intensityValue * intensity;
2432
+ break;
2433
+ case "blur":
2434
+ effectValue = intensityValue * intensity * 10;
2435
+ break;
2436
+ case "rotate":
2437
+ effectValue = (intensityValue - 0.5) * 2 * rotationRange;
2438
+ break;
2439
+ case "translateX":
2440
+ case "translateY":
2441
+ effectValue = (intensityValue - 0.5) * 2 * intensity * 50;
2442
+ break;
2443
+ default:
2444
+ effectValue = intensityValue * intensity;
2445
+ }
2446
+ }
2447
+ const styles = {};
2448
+ switch (effectType) {
2449
+ case "zoom":
2450
+ case "scale":
2451
+ styles.transform = `scale(${effectValue})`;
2452
+ break;
2453
+ case "shake":
2454
+ const shakeFrequency = 0.1;
2455
+ const shakeTime = frame * shakeFrequency;
2456
+ const shakeAmplitude = intensityValue * intensity * 20;
2457
+ const shakeX = shakeAxis === "x" || shakeAxis === "both" ? Math.sin(shakeTime * 2.3) * shakeAmplitude : 0;
2458
+ const shakeY = shakeAxis === "y" || shakeAxis === "both" ? Math.cos(shakeTime * 1.7) * shakeAmplitude : 0;
2459
+ styles.transform = `translateX(${shakeX}px) translateY(${shakeY}px)`;
2460
+ break;
2461
+ case "exposure":
2462
+ styles.filter = `brightness(${effectValue})`;
2463
+ break;
2464
+ case "blur":
2465
+ styles.filter = `blur(${effectValue}px)`;
2466
+ break;
2467
+ case "rotate":
2468
+ styles.transform = `rotate(${effectValue}deg)`;
2469
+ break;
2470
+ case "translateX":
2471
+ styles.transform = `translateX(${effectValue}px)`;
2472
+ break;
2473
+ case "translateY":
2474
+ styles.transform = `translateY(${effectValue}px)`;
2475
+ break;
2476
+ default:
2477
+ styles.transform = `scale(${effectValue})`;
2478
+ }
2479
+ if (parentContext && mode === "provider") {
2480
+ const combinedStyles = mergeCSSStyles_default(parentContext.animatedStyles, styles);
2481
+ return combinedStyles;
2482
+ }
2483
+ return styles;
2484
+ }, [
2485
+ smoothedIntensity,
2486
+ audioIntensity,
2487
+ effectType,
2488
+ intensity,
2489
+ minValue,
2490
+ maxValue,
2491
+ baseScale,
2492
+ baseBrightness,
2493
+ rotationRange,
2494
+ shakeAxis,
2495
+ mode,
2496
+ parentContext?.animatedStyles,
2497
+ frame
2498
+ // Add frame dependency for shake effect
2499
+ ]);
2500
+ const contextValue = (0, import_react14.useMemo)(
2501
+ () => ({
2502
+ animatedStyles,
2503
+ targetIds,
2504
+ effectType: "waveform"
2505
+ }),
2506
+ [animatedStyles, targetIds]
2507
+ );
2508
+ if (mode === "provider") {
2509
+ return /* @__PURE__ */ import_react14.default.createElement(UniversalEffectContext.Provider, { value: contextValue }, children);
2510
+ }
2511
+ return /* @__PURE__ */ import_react14.default.createElement("div", { ...effectData.props, style: animatedStyles }, children);
2512
+ };
2513
+ var config8 = {
2514
+ displayName: "waveform",
2515
+ description: "Waveform-driven effect that reacts to audio data (bass, mid, treble, waveform)",
2516
+ isInnerSequence: false,
2517
+ props: {
2518
+ audioSrc: {
2519
+ type: "string",
2520
+ required: true,
2521
+ description: "Audio source URL or ref:componentId"
2522
+ },
2523
+ audioProperty: {
2524
+ type: "enum",
2525
+ values: ["bass", "mid", "treble", "waveform", "frequency"],
2526
+ default: "bass",
2527
+ description: "Which audio property to react to"
2528
+ },
2529
+ effectType: {
2530
+ type: "enum",
2531
+ values: ["zoom", "shake", "exposure", "blur", "scale", "rotate", "translateX", "translateY"],
2532
+ default: "zoom",
2533
+ description: "Type of effect to apply"
2534
+ },
2535
+ intensity: {
2536
+ type: "number",
2537
+ default: 1,
2538
+ description: "Effect intensity multiplier"
2539
+ },
2540
+ sensitivity: {
2541
+ type: "number",
2542
+ default: 1,
2543
+ description: "Sensitivity multiplier for audio detection"
2544
+ },
2545
+ threshold: {
2546
+ type: "number",
2547
+ default: 0,
2548
+ description: "Minimum audio value to trigger effect"
2549
+ },
2550
+ smoothing: {
2551
+ type: "number",
2552
+ default: 0.5,
2553
+ description: "Smoothing factor (0-1) for audio data"
2554
+ },
2555
+ smoothNormalisation: {
2556
+ type: "number",
2557
+ default: 1,
2558
+ description: "Frame-based smoothing control (0 = no smoothing, 1 = default, >1 = more smoothing)"
2559
+ }
2560
+ }
2561
+ };
2562
+
2563
+ // src/components/effects/CanvasWipeReveal.tsx
2564
+ var import_react16 = __toESM(require("react"));
2565
+ var import_remotion10 = require("remotion");
2566
+ var import_zod3 = require("zod");
2567
+
2568
+ // src/components/atoms/CanvasAtom.tsx
2569
+ var import_react15 = __toESM(require("react"));
2570
+ var import_zod2 = require("zod");
2571
+ var CanvasAtomDataProps = import_zod2.z.object({
2572
+ className: import_zod2.z.string().optional(),
2573
+ style: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.any()).optional()
2574
+ });
2575
+ var Atom = import_react15.default.forwardRef(({ data, id }, ref) => {
2576
+ const { className, style } = data;
2577
+ return /* @__PURE__ */ import_react15.default.createElement("canvas", { ref, className, style, id });
2578
+ });
2579
+ var config9 = {
2580
+ displayName: "CanvasAtom",
2581
+ type: "atom",
2582
+ isInnerSequence: false,
2583
+ props: CanvasAtomDataProps
2584
+ // The config points to the Zod schema for data
2585
+ };
2586
+
2587
+ // src/components/effects/CanvasWipeReveal.tsx
2588
+ var mulberry32 = (seed) => {
2589
+ return () => {
2590
+ let t = seed += 1831565813;
2591
+ t = Math.imul(t ^ t >>> 15, t | 1);
2592
+ t ^= t + Math.imul(t ^ t >>> 7, t | 61);
2593
+ return ((t ^ t >>> 14) >>> 0) / 4294967296;
2594
+ };
2595
+ };
2596
+ var CanvasWipeRevealProps = import_zod3.z.object({
2597
+ imageUrl: import_zod3.z.string().url(),
2598
+ revealDurationInFrames: import_zod3.z.number().min(1),
2599
+ revealType: import_zod3.z.enum(["wipe", "radial"]).default("wipe"),
2600
+ angle: import_zod3.z.number().default(0),
2601
+ fit: import_zod3.z.enum(["cover", "contain"]).default("cover"),
2602
+ edgeStyle: import_zod3.z.enum(["straight", "organic", "burn"]).default("straight"),
2603
+ edgeWaviness: import_zod3.z.number().default(30),
2604
+ edgeFrequency: import_zod3.z.number().default(4),
2605
+ backgroundColor: import_zod3.z.string().default("rgba(0,0,0,0)"),
2606
+ burnGlow: import_zod3.z.boolean().default(true),
2607
+ burnGlowColor: import_zod3.z.string().default("#ff6600"),
2608
+ burnGlowIntensity: import_zod3.z.number().default(1),
2609
+ organicRandomAmplitude: import_zod3.z.boolean().default(true),
2610
+ organicRandomWavelength: import_zod3.z.boolean().default(false)
2611
+ });
2612
+ var CanvasWipeReveal = ({ data, id }) => {
2613
+ const {
2614
+ imageUrl,
2615
+ revealDurationInFrames,
2616
+ revealType,
2617
+ angle,
2618
+ fit,
2619
+ edgeStyle,
2620
+ edgeWaviness,
2621
+ edgeFrequency,
2622
+ backgroundColor,
2623
+ burnGlow,
2624
+ burnGlowColor,
2625
+ burnGlowIntensity,
2626
+ organicRandomAmplitude,
2627
+ organicRandomWavelength
2628
+ } = data;
2629
+ const frame = (0, import_remotion10.useCurrentFrame)();
2630
+ const { width, height } = (0, import_remotion10.useVideoConfig)();
2631
+ const canvasRef = (0, import_react16.useRef)(null);
2632
+ const [image, setImage] = (0, import_react16.useState)(null);
2633
+ (0, import_react16.useEffect)(() => {
2634
+ const img = new window.Image();
2635
+ img.crossOrigin = "Anonymous";
2636
+ img.src = imageUrl;
2637
+ img.onload = () => setImage(img);
2638
+ }, [imageUrl]);
2639
+ (0, import_react16.useEffect)(() => {
2640
+ if (!canvasRef.current || !image) return;
2641
+ const context = canvasRef.current.getContext("2d");
2642
+ if (!context) return;
2643
+ context.canvas.width = width;
2644
+ context.canvas.height = height;
2645
+ context.fillStyle = backgroundColor;
2646
+ context.fillRect(0, 0, width, height);
2647
+ const progress = Math.min(frame / revealDurationInFrames, 1);
2648
+ if (progress === 0 && backgroundColor === "rgba(0,0,0,0)") return;
2649
+ const seed = id.split("").reduce((acc, char) => acc + char.charCodeAt(0), 0);
2650
+ context.save();
2651
+ context.beginPath();
2652
+ if (revealType === "radial") {
2653
+ const baseRadius = Math.sqrt(width * width + height * height) / 2 * progress;
2654
+ if (edgeStyle === "organic") {
2655
+ const points = 120;
2656
+ const random = mulberry32(seed);
2657
+ const amplitudes = Array.from(
2658
+ { length: points + 1 },
2659
+ () => organicRandomAmplitude ? 0.5 + random() : 1
2660
+ );
2661
+ const wavelengths = Array.from(
2662
+ { length: points + 1 },
2663
+ () => organicRandomWavelength ? 0.5 + random() * 1.5 : 1
2664
+ );
2665
+ for (let i = 0; i <= points; i++) {
2666
+ const p = i / points;
2667
+ const angle2 = p * Math.PI * 2;
2668
+ const wave = Math.sin(
2669
+ p * Math.PI * edgeFrequency * wavelengths[i] + frame * 0.1
2670
+ ) * edgeWaviness * progress * amplitudes[i];
2671
+ const radius = baseRadius + wave;
2672
+ const x = width / 2 + Math.cos(angle2) * radius;
2673
+ const y = height / 2 + Math.sin(angle2) * radius;
2674
+ if (i === 0) context.moveTo(x, y);
2675
+ else context.lineTo(x, y);
2676
+ }
2677
+ context.closePath();
2678
+ } else if (edgeStyle === "burn") {
2679
+ const points = 120;
2680
+ const random = mulberry32(seed);
2681
+ const randomValues = Array.from({ length: points + 1 }, () => random());
2682
+ const phaseOffsets = Array.from(
2683
+ { length: points + 1 },
2684
+ () => random() * Math.PI * 2
2685
+ );
2686
+ const sparklePoints = [];
2687
+ for (let i = 0; i <= points; i++) {
2688
+ const p = i / points;
2689
+ const angle2 = p * Math.PI * 2;
2690
+ const flicker = Math.sin(frame * 0.3 + phaseOffsets[i]);
2691
+ const burnOffset = (randomValues[i] * 2 - 1) * flicker * edgeWaviness * progress;
2692
+ const radius = baseRadius + burnOffset;
2693
+ const x = width / 2 + Math.cos(angle2) * radius;
2694
+ const y = height / 2 + Math.sin(angle2) * radius;
2695
+ if (burnGlow && i % 5 === 0 && flicker > 0.3) {
2696
+ sparklePoints.push({ x, y, intensity: flicker });
2697
+ }
2698
+ if (i === 0) context.moveTo(x, y);
2699
+ else context.lineTo(x, y);
2700
+ }
2701
+ context.closePath();
2702
+ if (burnGlow && sparklePoints.length > 0) {
2703
+ sparklePoints.forEach((point) => {
2704
+ const glowSize = 3 + point.intensity * 5 * burnGlowIntensity;
2705
+ if (isFinite(point.x) && isFinite(point.y) && isFinite(glowSize) && glowSize > 0) {
2706
+ const gradient = context.createRadialGradient(
2707
+ point.x,
2708
+ point.y,
2709
+ 0,
2710
+ point.x,
2711
+ point.y,
2712
+ glowSize
2713
+ );
2714
+ gradient.addColorStop(0, burnGlowColor);
2715
+ gradient.addColorStop(0.5, burnGlowColor + "80");
2716
+ gradient.addColorStop(1, burnGlowColor + "00");
2717
+ context.fillStyle = gradient;
2718
+ context.fillRect(
2719
+ point.x - glowSize,
2720
+ point.y - glowSize,
2721
+ glowSize * 2,
2722
+ glowSize * 2
2723
+ );
2724
+ }
2725
+ });
2726
+ }
2727
+ } else {
2728
+ context.arc(width / 2, height / 2, baseRadius, 0, Math.PI * 2);
2729
+ }
2730
+ } else {
2731
+ const angleInRadians = angle * Math.PI / 180;
2732
+ const diagonal = Math.sqrt(width * width + height * height);
2733
+ context.translate(width / 2, height / 2);
2734
+ context.rotate(angleInRadians);
2735
+ const wipeEdgePosition = progress * diagonal - diagonal / 2;
2736
+ if (edgeStyle === "burn") {
2737
+ const points = 100;
2738
+ const random = mulberry32(seed);
2739
+ const randomValues = Array.from({ length: points + 1 }, () => random());
2740
+ const phaseOffsets = Array.from(
2741
+ { length: points + 1 },
2742
+ () => random() * Math.PI * 2
2743
+ );
2744
+ const edgePoints = [];
2745
+ context.moveTo(wipeEdgePosition, -diagonal / 2);
2746
+ for (let i = 0; i <= points; i++) {
2747
+ const p = i / points;
2748
+ const y = (p - 0.5) * diagonal;
2749
+ const flicker = Math.sin(frame * 0.3 + phaseOffsets[i]);
2750
+ const x = wipeEdgePosition + (randomValues[i] * 2 - 1) * flicker * edgeWaviness;
2751
+ context.lineTo(x, y);
2752
+ edgePoints.push({ x, y });
2753
+ }
2754
+ context.lineTo(wipeEdgePosition, diagonal / 2);
2755
+ context.lineTo(-diagonal / 2, diagonal / 2);
2756
+ context.lineTo(-diagonal / 2, -diagonal / 2);
2757
+ context.closePath();
2758
+ if (burnGlow && progress > 0.01) {
2759
+ const random2 = mulberry32(seed + frame);
2760
+ for (let i = 0; i < edgePoints.length; i += 3) {
2761
+ const point = edgePoints[i];
2762
+ const flicker = Math.sin(frame * 0.3 + phaseOffsets[i]);
2763
+ if (flicker > 0.2) {
2764
+ const glowSize = 4 + random2() * 6 * flicker * burnGlowIntensity;
2765
+ if (isFinite(point.x) && isFinite(point.y) && isFinite(glowSize) && glowSize > 0) {
2766
+ const gradient = context.createRadialGradient(
2767
+ point.x,
2768
+ point.y,
2769
+ 0,
2770
+ point.x,
2771
+ point.y,
2772
+ glowSize
2773
+ );
2774
+ gradient.addColorStop(0, burnGlowColor);
2775
+ gradient.addColorStop(0.4, burnGlowColor + "CC");
2776
+ gradient.addColorStop(1, burnGlowColor + "00");
2777
+ context.fillStyle = gradient;
2778
+ context.fillRect(
2779
+ point.x - glowSize,
2780
+ point.y - glowSize,
2781
+ glowSize * 2,
2782
+ glowSize * 2
2783
+ );
2784
+ if (random2() > 0.85) {
2785
+ const sparkleSize = 2 + random2() * 3;
2786
+ context.fillStyle = "#ffffff";
2787
+ context.fillRect(
2788
+ point.x - sparkleSize / 2,
2789
+ point.y - sparkleSize / 2,
2790
+ sparkleSize,
2791
+ sparkleSize
2792
+ );
2793
+ }
2794
+ }
2795
+ }
2796
+ }
2797
+ }
2798
+ } else if (edgeStyle === "organic") {
2799
+ const points = 100;
2800
+ const random = mulberry32(seed);
2801
+ const amplitudes = Array.from(
2802
+ { length: points + 1 },
2803
+ () => organicRandomAmplitude ? 0.5 + random() : 1
2804
+ );
2805
+ const wavelengths = Array.from(
2806
+ { length: points + 1 },
2807
+ () => organicRandomWavelength ? 0.5 + random() * 1.5 : 1
2808
+ );
2809
+ context.moveTo(wipeEdgePosition, -diagonal / 2);
2810
+ for (let i = 0; i <= points; i++) {
2811
+ const p = i / points;
2812
+ const y = (p - 0.5) * diagonal;
2813
+ const wave = Math.sin(
2814
+ p * edgeFrequency * wavelengths[i] * Math.PI + frame * 0.1
2815
+ ) * edgeWaviness * amplitudes[i];
2816
+ context.lineTo(wipeEdgePosition + wave, y);
2817
+ }
2818
+ context.lineTo(wipeEdgePosition, diagonal / 2);
2819
+ context.lineTo(-diagonal / 2, diagonal / 2);
2820
+ context.lineTo(-diagonal / 2, -diagonal / 2);
2821
+ context.closePath();
2822
+ } else {
2823
+ context.rect(
2824
+ -diagonal / 2,
2825
+ -diagonal / 2,
2826
+ wipeEdgePosition + diagonal / 2,
2827
+ diagonal
2828
+ );
2829
+ }
2830
+ context.rotate(-angleInRadians);
2831
+ context.translate(-width / 2, -height / 2);
2832
+ }
2833
+ context.clip();
2834
+ let sx = 0, sy = 0, sWidth = image.width, sHeight = image.height;
2835
+ if (fit === "cover") {
2836
+ const imgAspect = image.width / image.height;
2837
+ const canvasAspect = width / height;
2838
+ if (imgAspect > canvasAspect) {
2839
+ sWidth = image.height * canvasAspect;
2840
+ sx = (image.width - sWidth) / 2;
2841
+ } else {
2842
+ sHeight = image.width / canvasAspect;
2843
+ sy = (image.height - sHeight) / 2;
2844
+ }
2845
+ }
2846
+ context.drawImage(image, sx, sy, sWidth, sHeight, 0, 0, width, height);
2847
+ context.restore();
2848
+ }, [
2849
+ frame,
2850
+ image,
2851
+ width,
2852
+ height,
2853
+ revealDurationInFrames,
2854
+ fit,
2855
+ revealType,
2856
+ angle,
2857
+ edgeStyle,
2858
+ edgeWaviness,
2859
+ edgeFrequency,
2860
+ id,
2861
+ backgroundColor,
2862
+ burnGlow,
2863
+ burnGlowColor,
2864
+ burnGlowIntensity,
2865
+ organicRandomAmplitude,
2866
+ organicRandomWavelength
2867
+ ]);
2868
+ return /* @__PURE__ */ import_react16.default.createElement(Atom, { ref: canvasRef, data: { className: "w-full h-full" }, id });
2869
+ };
2870
+
2871
+ // src/components/effects/CanvasContentAwareReveal.tsx
2872
+ var import_react17 = __toESM(require("react"));
2873
+ var import_remotion11 = require("remotion");
2874
+ var import_zod4 = require("zod");
2875
+ var CanvasContentAwareRevealProps = import_zod4.z.object({
2876
+ imageUrl: import_zod4.z.string().url(),
2877
+ revealDurationInFrames: import_zod4.z.number().min(1),
2878
+ fit: import_zod4.z.enum(["cover", "contain"]).default("cover"),
2879
+ backgroundColor: import_zod4.z.string().default("rgba(0,0,0,0)"),
2880
+ burnColorOrder: import_zod4.z.enum(["vibgyor", "luminance", "random"]).default("vibgyor"),
2881
+ revealMode: import_zod4.z.enum(["color", "direction", "combined"]).default("combined").describe("Reveal mode: color-only, direction-only, or combined"),
2882
+ direction: import_zod4.z.enum(["horizontal", "vertical", "diagonal-down", "diagonal-up", "top-to-bottom"]).default("top-to-bottom"),
2883
+ directionLayers: import_zod4.z.number().default(10).describe("Number of layers for horizontal/vertical patterns")
2884
+ });
2885
+ var CanvasContentAwareReveal = ({ data, id }) => {
2886
+ const {
2887
+ imageUrl,
2888
+ revealDurationInFrames,
2889
+ fit,
2890
+ backgroundColor,
2891
+ burnColorOrder,
2892
+ revealMode,
2893
+ direction,
2894
+ directionLayers
2895
+ } = data;
2896
+ const frame = (0, import_remotion11.useCurrentFrame)();
2897
+ const { width, height } = (0, import_remotion11.useVideoConfig)();
2898
+ const canvasRef = (0, import_react17.useRef)(null);
2899
+ const [image, setImage] = (0, import_react17.useState)(null);
2900
+ const [pixelBurnMap, setPixelBurnMap] = (0, import_react17.useState)(null);
2901
+ const [isProcessing, setIsProcessing] = (0, import_react17.useState)(false);
2902
+ const burnMapGeneratedRef = (0, import_react17.useRef)(false);
2903
+ const rgbToHsv = (r, g, b) => {
2904
+ r /= 255;
2905
+ g /= 255;
2906
+ b /= 255;
2907
+ const max = Math.max(r, g, b), min = Math.min(r, g, b), delta = max - min;
2908
+ let h = 0;
2909
+ if (delta !== 0) {
2910
+ if (max === r) h = (g - b) / delta % 6;
2911
+ else if (max === g) h = (b - r) / delta + 2;
2912
+ else h = (r - g) / delta + 4;
2913
+ h *= 60;
2914
+ if (h < 0) h += 360;
2915
+ }
2916
+ return [h, max === 0 ? 0 : delta / max, max];
2917
+ };
2918
+ const getLuminance = (r, g, b) => 0.299 * r + 0.587 * g + 0.114 * b;
2919
+ const hueToVibgyorOrder = (hue) => {
2920
+ if (hue >= 260 && hue <= 290) return 0;
2921
+ if (hue >= 240 && hue < 260) return 0.15;
2922
+ if (hue >= 200 && hue < 240) return 0.3;
2923
+ if (hue >= 120 && hue < 200) return 0.5;
2924
+ if (hue >= 50 && hue < 120) return 0.65;
2925
+ if (hue >= 20 && hue < 50) return 0.8;
2926
+ if (hue >= 290 || hue < 20) return 1;
2927
+ return hue / 360;
2928
+ };
2929
+ (0, import_react17.useEffect)(() => {
2930
+ const img = new window.Image();
2931
+ img.crossOrigin = "Anonymous";
2932
+ img.src = imageUrl;
2933
+ img.onload = () => {
2934
+ setImage(img);
2935
+ burnMapGeneratedRef.current = false;
2936
+ };
2937
+ }, [imageUrl]);
2938
+ (0, import_react17.useEffect)(() => {
2939
+ if (!image || isProcessing || burnMapGeneratedRef.current) return;
2940
+ setIsProcessing(true);
2941
+ setTimeout(() => {
2942
+ try {
2943
+ const canvas = document.createElement("canvas");
2944
+ const ctx = canvas.getContext("2d");
2945
+ if (!ctx) return;
2946
+ canvas.width = image.width;
2947
+ canvas.height = image.height;
2948
+ ctx.drawImage(image, 0, 0);
2949
+ const imageData = ctx.getImageData(0, 0, image.width, image.height);
2950
+ const pixels = imageData.data;
2951
+ const burnMap = new Float32Array(image.width * image.height);
2952
+ const rawValues = [];
2953
+ for (let i = 0; i < pixels.length; i += 4) {
2954
+ const pixelIndex = i / 4;
2955
+ const [r, g, b] = [pixels[i], pixels[i + 1], pixels[i + 2]];
2956
+ let burnValue = 0;
2957
+ if (burnColorOrder === "vibgyor") {
2958
+ const [h, s] = rgbToHsv(r, g, b);
2959
+ burnValue = hueToVibgyorOrder(h) * s + 0.5 * (1 - s);
2960
+ } else if (burnColorOrder === "luminance") {
2961
+ burnValue = getLuminance(r, g, b) / 255;
2962
+ } else {
2963
+ burnValue = pixelIndex * 2654435761 % 2147483648 / 2147483648;
2964
+ }
2965
+ rawValues.push(burnValue);
2966
+ }
2967
+ const numBuckets = 200;
2968
+ const buckets = new Array(numBuckets).fill(0);
2969
+ rawValues.forEach((val) => {
2970
+ buckets[Math.min(Math.floor(val * numBuckets), numBuckets - 1)]++;
2971
+ });
2972
+ const cumulative = new Array(numBuckets);
2973
+ cumulative[0] = buckets[0];
2974
+ for (let i = 1; i < numBuckets; i++) {
2975
+ cumulative[i] = cumulative[i - 1] + buckets[i];
2976
+ }
2977
+ rawValues.forEach((val, idx) => {
2978
+ const bucket = Math.min(Math.floor(val * numBuckets), numBuckets - 1);
2979
+ burnMap[idx] = cumulative[bucket] / (image.width * image.height);
2980
+ });
2981
+ if (revealMode === "direction" || revealMode === "combined") {
2982
+ for (let idx = 0; idx < image.width * image.height; idx++) {
2983
+ const x = idx % image.width;
2984
+ const y = Math.floor(idx / image.width);
2985
+ let directionValue = 0;
2986
+ if (direction === "horizontal") {
2987
+ const layer = Math.floor(y / (image.height / directionLayers));
2988
+ const isReverse = layer % 2 === 1;
2989
+ const xNorm = isReverse ? (image.width - x) / image.width : x / image.width;
2990
+ directionValue = layer / directionLayers + xNorm / directionLayers;
2991
+ } else if (direction === "vertical") {
2992
+ const layer = Math.floor(x / (image.width / directionLayers));
2993
+ const isReverse = layer % 2 === 1;
2994
+ const yNorm = isReverse ? (image.height - y) / image.height : y / image.height;
2995
+ directionValue = layer / directionLayers + yNorm / directionLayers;
2996
+ } else if (direction === "top-to-bottom") {
2997
+ directionValue = y / image.height;
2998
+ } else if (direction === "diagonal-down") {
2999
+ directionValue = (x + y) / (image.width + image.height);
3000
+ } else {
3001
+ directionValue = (x + (image.height - y)) / (image.width + image.height);
3002
+ }
3003
+ burnMap[idx] = revealMode === "combined" ? burnMap[idx] * 0.6 + directionValue * 0.4 : directionValue;
3004
+ }
3005
+ let minVal = burnMap[0];
3006
+ let maxVal = burnMap[0];
3007
+ for (let i = 1; i < burnMap.length; i++) {
3008
+ if (burnMap[i] < minVal) minVal = burnMap[i];
3009
+ if (burnMap[i] > maxVal) maxVal = burnMap[i];
3010
+ }
3011
+ const range = maxVal - minVal;
3012
+ if (range > 0) {
3013
+ for (let i = 0; i < burnMap.length; i++) {
3014
+ burnMap[i] = (burnMap[i] - minVal) / range;
3015
+ }
3016
+ }
3017
+ }
3018
+ setPixelBurnMap(burnMap);
3019
+ burnMapGeneratedRef.current = true;
3020
+ } finally {
3021
+ setIsProcessing(false);
3022
+ }
3023
+ }, 0);
3024
+ }, [
3025
+ image,
3026
+ burnColorOrder,
3027
+ revealMode,
3028
+ direction,
3029
+ directionLayers
3030
+ ]);
3031
+ (0, import_react17.useEffect)(() => {
3032
+ if (!canvasRef.current || !image || !pixelBurnMap) return;
3033
+ const context = canvasRef.current.getContext("2d");
3034
+ if (!context) return;
3035
+ context.canvas.width = width;
3036
+ context.canvas.height = height;
3037
+ context.fillStyle = backgroundColor;
3038
+ context.fillRect(0, 0, width, height);
3039
+ const progress = Math.min(frame / revealDurationInFrames, 1);
3040
+ if (progress >= 1) {
3041
+ let sx2 = 0, sy2 = 0, sWidth2 = image.width, sHeight2 = image.height;
3042
+ if (fit === "cover") {
3043
+ const imgAspect = image.width / image.height;
3044
+ const canvasAspect = width / height;
3045
+ if (imgAspect > canvasAspect) {
3046
+ sWidth2 = image.height * canvasAspect;
3047
+ sx2 = (image.width - sWidth2) / 2;
3048
+ } else {
3049
+ sHeight2 = image.width / canvasAspect;
3050
+ sy2 = (image.height - sHeight2) / 2;
3051
+ }
3052
+ }
3053
+ context.drawImage(image, sx2, sy2, sWidth2, sHeight2, 0, 0, width, height);
3054
+ return;
3055
+ }
3056
+ const tempCanvas = document.createElement("canvas");
3057
+ tempCanvas.width = image.width;
3058
+ tempCanvas.height = image.height;
3059
+ const tempCtx = tempCanvas.getContext("2d");
3060
+ if (!tempCtx) return;
3061
+ tempCtx.drawImage(image, 0, 0);
3062
+ const imageData = tempCtx.getImageData(0, 0, image.width, image.height);
3063
+ const pixels = imageData.data;
3064
+ const transitionWidth = Math.max(
3065
+ 0.02,
3066
+ Math.min(0.15, 3 / (revealDurationInFrames / 100))
3067
+ );
3068
+ for (let i = 0; i < pixels.length; i += 4) {
3069
+ const pixelIndex = i / 4;
3070
+ const burnProgress = (progress - pixelBurnMap[pixelIndex]) / transitionWidth;
3071
+ pixels[i + 3] = Math.floor(
3072
+ pixels[i + 3] * Math.max(0, Math.min(1, burnProgress))
3073
+ );
3074
+ }
3075
+ tempCtx.putImageData(imageData, 0, 0);
3076
+ let sx = 0, sy = 0, sWidth = image.width, sHeight = image.height;
3077
+ if (fit === "cover") {
3078
+ const imgAspect = image.width / image.height;
3079
+ const canvasAspect = width / height;
3080
+ if (imgAspect > canvasAspect) {
3081
+ sWidth = image.height * canvasAspect;
3082
+ sx = (image.width - sWidth) / 2;
3083
+ } else {
3084
+ sHeight = image.width / canvasAspect;
3085
+ sy = (image.height - sHeight) / 2;
3086
+ }
3087
+ }
3088
+ context.drawImage(tempCanvas, sx, sy, sWidth, sHeight, 0, 0, width, height);
3089
+ }, [
3090
+ frame,
3091
+ image,
3092
+ width,
3093
+ height,
3094
+ pixelBurnMap,
3095
+ revealDurationInFrames,
3096
+ fit,
3097
+ backgroundColor
3098
+ ]);
3099
+ return /* @__PURE__ */ import_react17.default.createElement(Atom, { ref: canvasRef, data: { className: "w-full h-full" }, id });
3100
+ };
3101
+
3102
+ // src/components/effects/CanvasGlitchEffect.tsx
3103
+ var import_react18 = __toESM(require("react"));
3104
+ var import_remotion12 = require("remotion");
3105
+ var import_zod5 = require("zod");
3106
+ var CanvasGlitchEffectProps = import_zod5.z.object({
3107
+ imageUrl: import_zod5.z.string().url(),
3108
+ durationInFrames: import_zod5.z.number().min(1),
3109
+ fit: import_zod5.z.enum(["cover", "contain"]).default("cover"),
3110
+ backgroundColor: import_zod5.z.string().default("rgba(0,0,0,0)"),
3111
+ glitchType: import_zod5.z.enum(["rgb-shift", "slice", "corrupt", "static", "scan"]).default("rgb-shift"),
3112
+ intensity: import_zod5.z.number().default(10).describe("Intensity of glitch effect"),
3113
+ frequency: import_zod5.z.number().default(0.3).describe("How often glitches occur (0-1)"),
3114
+ continuous: import_zod5.z.boolean().default(false).describe("Continuous glitch vs periodic"),
3115
+ glitchStartFrame: import_zod5.z.number().default(0).describe("Frame to start glitching"),
3116
+ glitchEndFrame: import_zod5.z.number().default(-1).describe("Frame to end glitching (-1 = duration)")
3117
+ });
3118
+ var CanvasGlitchEffect = ({ data, id }) => {
3119
+ const {
3120
+ imageUrl,
3121
+ durationInFrames,
3122
+ fit,
3123
+ backgroundColor,
3124
+ glitchType,
3125
+ intensity,
3126
+ frequency,
3127
+ continuous,
3128
+ glitchStartFrame,
3129
+ glitchEndFrame
3130
+ } = data;
3131
+ const frame = (0, import_remotion12.useCurrentFrame)();
3132
+ const { width, height } = (0, import_remotion12.useVideoConfig)();
3133
+ const canvasRef = (0, import_react18.useRef)(null);
3134
+ const [image, setImage] = (0, import_react18.useState)(null);
3135
+ (0, import_react18.useEffect)(() => {
3136
+ const img = new window.Image();
3137
+ img.crossOrigin = "Anonymous";
3138
+ img.src = imageUrl;
3139
+ img.onload = () => setImage(img);
3140
+ }, [imageUrl]);
3141
+ (0, import_react18.useEffect)(() => {
3142
+ if (!canvasRef.current || !image) return;
3143
+ const context = canvasRef.current.getContext("2d");
3144
+ if (!context) return;
3145
+ context.canvas.width = width;
3146
+ context.canvas.height = height;
3147
+ context.fillStyle = backgroundColor;
3148
+ context.fillRect(0, 0, width, height);
3149
+ const endFrame = glitchEndFrame === -1 ? durationInFrames : glitchEndFrame;
3150
+ const isInGlitchRange = frame >= glitchStartFrame && frame <= endFrame;
3151
+ const seed = Math.floor(frame / 3);
3152
+ const random = (seed * 9301 + 49297) % 233280 / 233280;
3153
+ const isGlitching = isInGlitchRange && (continuous || random < frequency);
3154
+ let sx = 0, sy = 0, sWidth = image.width, sHeight = image.height;
3155
+ if (fit === "cover") {
3156
+ const imgAspect = image.width / image.height;
3157
+ const canvasAspect = width / height;
3158
+ if (imgAspect > canvasAspect) {
3159
+ sWidth = image.height * canvasAspect;
3160
+ sx = (image.width - sWidth) / 2;
3161
+ } else {
3162
+ sHeight = image.width / canvasAspect;
3163
+ sy = (image.height - sHeight) / 2;
3164
+ }
3165
+ }
3166
+ if (!isGlitching) {
3167
+ context.drawImage(image, sx, sy, sWidth, sHeight, 0, 0, width, height);
3168
+ return;
3169
+ }
3170
+ if (glitchType === "rgb-shift") {
3171
+ const tempCanvas = document.createElement("canvas");
3172
+ tempCanvas.width = image.width;
3173
+ tempCanvas.height = image.height;
3174
+ const tempCtx = tempCanvas.getContext("2d");
3175
+ if (!tempCtx) return;
3176
+ tempCtx.drawImage(image, 0, 0);
3177
+ const imageData = tempCtx.getImageData(0, 0, image.width, image.height);
3178
+ const pixels = imageData.data;
3179
+ const shift = intensity * (random * 2 - 1);
3180
+ const redData = tempCtx.createImageData(image.width, image.height);
3181
+ const greenData = tempCtx.createImageData(image.width, image.height);
3182
+ const blueData = tempCtx.createImageData(image.width, image.height);
3183
+ for (let i = 0; i < pixels.length; i += 4) {
3184
+ redData.data[i] = pixels[i];
3185
+ redData.data[i + 3] = pixels[i + 3];
3186
+ greenData.data[i + 1] = pixels[i + 1];
3187
+ greenData.data[i + 3] = pixels[i + 3];
3188
+ blueData.data[i + 2] = pixels[i + 2];
3189
+ blueData.data[i + 3] = pixels[i + 3];
3190
+ }
3191
+ context.save();
3192
+ context.globalCompositeOperation = "screen";
3193
+ tempCtx.putImageData(redData, 0, 0);
3194
+ context.drawImage(
3195
+ tempCanvas,
3196
+ sx + shift,
3197
+ sy,
3198
+ sWidth,
3199
+ sHeight,
3200
+ shift,
3201
+ 0,
3202
+ width,
3203
+ height
3204
+ );
3205
+ tempCtx.putImageData(greenData, 0, 0);
3206
+ context.drawImage(
3207
+ tempCanvas,
3208
+ sx,
3209
+ sy,
3210
+ sWidth,
3211
+ sHeight,
3212
+ 0,
3213
+ 0,
3214
+ width,
3215
+ height
3216
+ );
3217
+ tempCtx.putImageData(blueData, 0, 0);
3218
+ context.drawImage(
3219
+ tempCanvas,
3220
+ sx - shift,
3221
+ sy,
3222
+ sWidth,
3223
+ sHeight,
3224
+ -shift,
3225
+ 0,
3226
+ width,
3227
+ height
3228
+ );
3229
+ context.restore();
3230
+ } else if (glitchType === "slice") {
3231
+ const sliceCount = 20;
3232
+ const sliceHeight = height / sliceCount;
3233
+ for (let i = 0; i < sliceCount; i++) {
3234
+ const offset = (random * 2 - 1) * intensity * (i % 2 === 0 ? 1 : -1);
3235
+ const sy_slice = sy + sHeight / sliceCount * i;
3236
+ const dy = sliceHeight * i;
3237
+ context.drawImage(
3238
+ image,
3239
+ sx,
3240
+ sy_slice,
3241
+ sWidth,
3242
+ sHeight / sliceCount,
3243
+ offset,
3244
+ dy,
3245
+ width,
3246
+ sliceHeight
3247
+ );
3248
+ }
3249
+ } else if (glitchType === "corrupt") {
3250
+ context.drawImage(image, sx, sy, sWidth, sHeight, 0, 0, width, height);
3251
+ const blockCount = Math.floor(intensity / 2);
3252
+ for (let i = 0; i < blockCount; i++) {
3253
+ const blockW = Math.random() * width * 0.3;
3254
+ const blockH = Math.random() * height * 0.2;
3255
+ const blockX = Math.random() * (width - blockW);
3256
+ const blockY = Math.random() * (height - blockH);
3257
+ const sourceX = Math.random() * (width - blockW);
3258
+ const sourceY = Math.random() * (height - blockH);
3259
+ try {
3260
+ const imgData = context.getImageData(
3261
+ sourceX,
3262
+ sourceY,
3263
+ blockW,
3264
+ blockH
3265
+ );
3266
+ context.putImageData(imgData, blockX, blockY);
3267
+ } catch (e) {
3268
+ }
3269
+ }
3270
+ } else if (glitchType === "static") {
3271
+ context.drawImage(image, sx, sy, sWidth, sHeight, 0, 0, width, height);
3272
+ const imageData = context.getImageData(0, 0, width, height);
3273
+ const pixels = imageData.data;
3274
+ for (let i = 0; i < pixels.length; i += 4) {
3275
+ if (Math.random() < intensity / 100) {
3276
+ const noise = Math.random() * 255;
3277
+ pixels[i] = noise;
3278
+ pixels[i + 1] = noise;
3279
+ pixels[i + 2] = noise;
3280
+ }
3281
+ }
3282
+ context.putImageData(imageData, 0, 0);
3283
+ } else if (glitchType === "scan") {
3284
+ context.drawImage(image, sx, sy, sWidth, sHeight, 0, 0, width, height);
3285
+ const scanY = frame * 5 % height;
3286
+ context.fillStyle = `rgba(255, 255, 255, ${intensity / 100})`;
3287
+ context.fillRect(0, scanY, width, 3);
3288
+ const distortY = Math.max(0, scanY - 10);
3289
+ const distortHeight = Math.min(20, height - distortY);
3290
+ if (distortHeight > 0) {
3291
+ try {
3292
+ const imgData = context.getImageData(
3293
+ 0,
3294
+ distortY,
3295
+ width,
3296
+ distortHeight
3297
+ );
3298
+ const shiftAmount = intensity * (random * 2 - 1);
3299
+ context.putImageData(imgData, shiftAmount, distortY);
3300
+ } catch (e) {
3301
+ }
3302
+ }
3303
+ }
3304
+ }, [
3305
+ frame,
3306
+ image,
3307
+ width,
3308
+ height,
3309
+ durationInFrames,
3310
+ fit,
3311
+ backgroundColor,
3312
+ glitchType,
3313
+ intensity,
3314
+ frequency,
3315
+ continuous,
3316
+ glitchStartFrame,
3317
+ glitchEndFrame
3318
+ ]);
3319
+ return /* @__PURE__ */ import_react18.default.createElement(Atom, { ref: canvasRef, data: { className: "w-full h-full" }, id });
3320
+ };
3321
+
3322
+ // src/components/effects/CanvasParticleEffect.tsx
3323
+ var import_react19 = __toESM(require("react"));
3324
+ var import_remotion13 = require("remotion");
3325
+ var import_zod6 = require("zod");
3326
+ var CanvasParticleEffectProps = import_zod6.z.object({
3327
+ imageUrl: import_zod6.z.string().url(),
3328
+ revealDurationInFrames: import_zod6.z.number().min(1),
3329
+ fit: import_zod6.z.enum(["cover", "contain"]).default("cover"),
3330
+ backgroundColor: import_zod6.z.string().default("rgba(0,0,0,0)"),
3331
+ particleCount: import_zod6.z.number().default(2e3).describe("Number of particles"),
3332
+ particleSize: import_zod6.z.number().default(3).describe("Size of each particle"),
3333
+ particleEffect: import_zod6.z.enum(["assemble", "disassemble", "explode", "pixelate"]).default("assemble"),
3334
+ assembleFrom: import_zod6.z.enum(["center", "edges", "random", "bottom"]).default("random"),
3335
+ speed: import_zod6.z.number().default(1).describe("Animation speed multiplier"),
3336
+ rotation: import_zod6.z.boolean().default(false).describe("Add rotation to particles")
3337
+ });
3338
+ var CanvasParticleEffect = ({ data, id }) => {
3339
+ const {
3340
+ imageUrl,
3341
+ revealDurationInFrames,
3342
+ fit,
3343
+ backgroundColor,
3344
+ particleCount,
3345
+ particleSize,
3346
+ particleEffect,
3347
+ assembleFrom,
3348
+ speed,
3349
+ rotation
3350
+ } = data;
3351
+ const frame = (0, import_remotion13.useCurrentFrame)();
3352
+ const { width, height } = (0, import_remotion13.useVideoConfig)();
3353
+ const canvasRef = (0, import_react19.useRef)(null);
3354
+ const [image, setImage] = (0, import_react19.useState)(null);
3355
+ const [particles, setParticles] = (0, import_react19.useState)(null);
3356
+ (0, import_react19.useEffect)(() => {
3357
+ const img = new window.Image();
3358
+ img.crossOrigin = "Anonymous";
3359
+ img.src = imageUrl;
3360
+ img.onload = () => setImage(img);
3361
+ }, [imageUrl]);
3362
+ (0, import_react19.useEffect)(() => {
3363
+ if (!image) return;
3364
+ const canvas = document.createElement("canvas");
3365
+ const ctx = canvas.getContext("2d");
3366
+ if (!ctx) return;
3367
+ canvas.width = image.width;
3368
+ canvas.height = image.height;
3369
+ ctx.drawImage(image, 0, 0);
3370
+ const imageData = ctx.getImageData(0, 0, image.width, image.height);
3371
+ const pixels = imageData.data;
3372
+ const particleArray = [];
3373
+ const step = Math.floor(
3374
+ Math.sqrt(image.width * image.height / particleCount)
3375
+ );
3376
+ for (let y = 0; y < image.height; y += step) {
3377
+ for (let x = 0; x < image.width; x += step) {
3378
+ const i = (y * image.width + x) * 4;
3379
+ const [r, g, b, a] = [
3380
+ pixels[i],
3381
+ pixels[i + 1],
3382
+ pixels[i + 2],
3383
+ pixels[i + 3]
3384
+ ];
3385
+ if (a > 128) {
3386
+ const targetX = x;
3387
+ const targetY = y;
3388
+ let startX = targetX, startY = targetY;
3389
+ if (particleEffect === "assemble") {
3390
+ if (assembleFrom === "center") {
3391
+ startX = image.width / 2;
3392
+ startY = image.height / 2;
3393
+ } else if (assembleFrom === "edges") {
3394
+ const edge = Math.floor(Math.random() * 4);
3395
+ if (edge === 0) {
3396
+ startX = 0;
3397
+ startY = Math.random() * image.height;
3398
+ } else if (edge === 1) {
3399
+ startX = image.width;
3400
+ startY = Math.random() * image.height;
3401
+ } else if (edge === 2) {
3402
+ startX = Math.random() * image.width;
3403
+ startY = 0;
3404
+ } else {
3405
+ startX = Math.random() * image.width;
3406
+ startY = image.height;
3407
+ }
3408
+ } else if (assembleFrom === "bottom") {
3409
+ startX = targetX;
3410
+ startY = image.height + Math.random() * 200;
3411
+ } else {
3412
+ startX = Math.random() * image.width;
3413
+ startY = Math.random() * image.height;
3414
+ }
3415
+ }
3416
+ particleArray.push({
3417
+ x: startX,
3418
+ y: startY,
3419
+ targetX,
3420
+ targetY,
3421
+ color: `rgba(${r},${g},${b},${a / 255})`,
3422
+ startX,
3423
+ startY,
3424
+ angle: Math.random() * Math.PI * 2
3425
+ });
3426
+ }
3427
+ }
3428
+ }
3429
+ setParticles(particleArray);
3430
+ }, [image, particleCount, particleEffect, assembleFrom]);
3431
+ (0, import_react19.useEffect)(() => {
3432
+ if (!canvasRef.current || !image || !particles) return;
3433
+ const context = canvasRef.current.getContext("2d");
3434
+ if (!context) return;
3435
+ context.canvas.width = width;
3436
+ context.canvas.height = height;
3437
+ context.fillStyle = backgroundColor;
3438
+ context.fillRect(0, 0, width, height);
3439
+ const progress = Math.min(frame / revealDurationInFrames * speed, 1);
3440
+ if (progress >= 1 && particleEffect === "assemble") {
3441
+ const scaleX2 = width / image.width;
3442
+ const scaleY2 = height / image.height;
3443
+ let scale2 = scaleX2;
3444
+ let offsetX2 = 0, offsetY2 = 0;
3445
+ if (fit === "cover") {
3446
+ scale2 = Math.max(scaleX2, scaleY2);
3447
+ offsetX2 = (width - image.width * scale2) / 2;
3448
+ offsetY2 = (height - image.height * scale2) / 2;
3449
+ } else {
3450
+ scale2 = Math.min(scaleX2, scaleY2);
3451
+ offsetX2 = (width - image.width * scale2) / 2;
3452
+ offsetY2 = (height - image.height * scale2) / 2;
3453
+ }
3454
+ context.save();
3455
+ context.translate(offsetX2, offsetY2);
3456
+ context.scale(scale2, scale2);
3457
+ context.drawImage(image, 0, 0);
3458
+ context.restore();
3459
+ return;
3460
+ }
3461
+ const easeProgress = particleEffect === "explode" ? progress * progress * (3 - 2 * progress) : 1 - Math.pow(1 - progress, 3);
3462
+ const scaleX = width / image.width;
3463
+ const scaleY = height / image.height;
3464
+ let scale = scaleX;
3465
+ let offsetX = 0, offsetY = 0;
3466
+ if (fit === "cover") {
3467
+ scale = Math.max(scaleX, scaleY);
3468
+ offsetX = (width - image.width * scale) / 2;
3469
+ offsetY = (height - image.height * scale) / 2;
3470
+ } else {
3471
+ scale = Math.min(scaleX, scaleY);
3472
+ offsetX = (width - image.width * scale) / 2;
3473
+ offsetY = (height - image.height * scale) / 2;
3474
+ }
3475
+ particles.forEach((particle) => {
3476
+ let x, y;
3477
+ if (particleEffect === "assemble") {
3478
+ x = particle.startX + (particle.targetX - particle.startX) * easeProgress;
3479
+ y = particle.startY + (particle.targetY - particle.startY) * easeProgress;
3480
+ } else if (particleEffect === "disassemble") {
3481
+ const reverseProgress = 1 - easeProgress;
3482
+ x = particle.targetX + (particle.startX - particle.targetX) * (1 - reverseProgress);
3483
+ y = particle.targetY + (particle.startY - particle.targetY) * (1 - reverseProgress);
3484
+ } else if (particleEffect === "explode") {
3485
+ const dx = particle.targetX - image.width / 2;
3486
+ const dy = particle.targetY - image.height / 2;
3487
+ const dist = Math.sqrt(dx * dx + dy * dy);
3488
+ const explosionDist = dist * easeProgress * 3;
3489
+ x = particle.targetX + dx / dist * explosionDist;
3490
+ y = particle.targetY + dy / dist * explosionDist;
3491
+ } else {
3492
+ x = particle.targetX;
3493
+ y = particle.targetY;
3494
+ }
3495
+ const finalX = x * scale + offsetX;
3496
+ const finalY = y * scale + offsetY;
3497
+ context.save();
3498
+ context.translate(finalX, finalY);
3499
+ if (rotation && particleEffect !== "pixelate") {
3500
+ context.rotate(particle.angle * easeProgress);
3501
+ }
3502
+ const size = particleEffect === "pixelate" ? particleSize * (1 + (1 - easeProgress) * 3) : particleSize;
3503
+ context.fillStyle = particle.color;
3504
+ context.fillRect(-size / 2, -size / 2, size, size);
3505
+ context.restore();
3506
+ });
3507
+ }, [
3508
+ frame,
3509
+ image,
3510
+ width,
3511
+ height,
3512
+ particles,
3513
+ revealDurationInFrames,
3514
+ fit,
3515
+ backgroundColor,
3516
+ particleSize,
3517
+ particleEffect,
3518
+ speed,
3519
+ rotation
3520
+ ]);
3521
+ return /* @__PURE__ */ import_react19.default.createElement(Atom, { ref: canvasRef, data: { className: "w-full h-full" }, id });
3522
+ };
3523
+
3524
+ // src/components/effects/GenericPresets.ts
3525
+ var fadeInPreset = [
3526
+ { key: "opacity", val: 0, prog: 0 },
3527
+ { key: "opacity", val: 1, prog: 1 }
3528
+ ];
3529
+ var fadeOutPreset = [
3530
+ { key: "opacity", val: 1, prog: 0 },
3531
+ { key: "opacity", val: 0, prog: 1 }
3532
+ ];
3533
+ var scaleInPreset = [
3534
+ { key: "scale", val: 0, prog: 0 },
3535
+ { key: "scale", val: 1, prog: 1 }
3536
+ ];
3537
+ var scaleOutPreset = [
3538
+ { key: "scale", val: 1, prog: 0 },
3539
+ { key: "scale", val: 0, prog: 1 }
3540
+ ];
3541
+ var slideInLeftPreset = [
3542
+ { key: "translateX", val: -100, prog: 0 },
3543
+ { key: "translateX", val: 0, prog: 1 }
3544
+ ];
3545
+ var slideInRightPreset = [
3546
+ { key: "translateX", val: 100, prog: 0 },
3547
+ { key: "translateX", val: 0, prog: 1 }
3548
+ ];
3549
+ var slideInTopPreset = [
3550
+ { key: "translateY", val: -100, prog: 0 },
3551
+ { key: "translateY", val: 0, prog: 1 }
3552
+ ];
3553
+ var slideInBottomPreset = [
3554
+ { key: "translateY", val: 100, prog: 0 },
3555
+ { key: "translateY", val: 0, prog: 1 }
3556
+ ];
3557
+ var bouncePreset = [
3558
+ { key: "scale", val: 0, prog: 0 },
3559
+ { key: "scale", val: 1.2, prog: 0.6 },
3560
+ { key: "scale", val: 1, prog: 1 }
3561
+ ];
3562
+ var pulsePreset = [
3563
+ { key: "scale", val: 1, prog: 0 },
3564
+ { key: "scale", val: 1.1, prog: 0.5 },
3565
+ { key: "scale", val: 1, prog: 1 }
3566
+ ];
3567
+ var rotateInPreset = [
3568
+ { key: "rotate", val: -180, prog: 0 },
3569
+ { key: "rotate", val: 0, prog: 1 }
3570
+ ];
3571
+ var blurInPreset = [
3572
+ { key: "blur", val: 10, prog: 0 },
3573
+ { key: "blur", val: 0, prog: 1 }
3574
+ ];
3575
+ var fadeInScalePreset = [
3576
+ { key: "opacity", val: 0, prog: 0 },
3577
+ { key: "opacity", val: 1, prog: 1 },
3578
+ { key: "scale", val: 0.8, prog: 0 },
3579
+ { key: "scale", val: 1, prog: 1 }
3580
+ ];
3581
+ var slideInFadePreset = [
3582
+ { key: "translateX", val: -50, prog: 0 },
3583
+ { key: "translateX", val: 0, prog: 1 },
3584
+ { key: "opacity", val: 0, prog: 0 },
3585
+ { key: "opacity", val: 1, prog: 1 }
3586
+ ];
3587
+ var slideInLeftStringPreset = [
3588
+ { key: "translateX", val: "-100px", prog: 0 },
3589
+ { key: "translateX", val: "0px", prog: 1 }
3590
+ ];
3591
+ var slideInRightStringPreset = [
3592
+ { key: "translateX", val: "100px", prog: 0 },
3593
+ { key: "translateX", val: "0px", prog: 1 }
3594
+ ];
3595
+ var slideInTopStringPreset = [
3596
+ { key: "translateY", val: "-100px", prog: 0 },
3597
+ { key: "translateY", val: "0px", prog: 1 }
3598
+ ];
3599
+ var slideInBottomStringPreset = [
3600
+ { key: "translateY", val: "100px", prog: 0 },
3601
+ { key: "translateY", val: "0px", prog: 1 }
3602
+ ];
3603
+ var rotateInStringPreset = [
3604
+ { key: "rotate", val: "-180deg", prog: 0 },
3605
+ { key: "rotate", val: "0deg", prog: 1 }
3606
+ ];
3607
+ var blurInStringPreset = [
3608
+ { key: "blur", val: "10px", prog: 0 },
3609
+ { key: "blur", val: "0px", prog: 1 }
3610
+ ];
3611
+ var scaleInStringPreset = [
3612
+ { key: "scale", val: 0, prog: 0 },
3613
+ { key: "scale", val: 1, prog: 1 }
3614
+ ];
3615
+ var slideInLeftResponsivePreset = [
3616
+ { key: "translateX", val: "-50vw", prog: 0 },
3617
+ { key: "translateX", val: "0vw", prog: 1 }
3618
+ ];
3619
+ var slideInTopResponsivePreset = [
3620
+ { key: "translateY", val: "-50vh", prog: 0 },
3621
+ { key: "translateY", val: "0vh", prog: 1 }
3622
+ ];
3623
+ var backgroundColorPreset = [
3624
+ { key: "backgroundColor", val: "#ff0000", prog: 0 },
3625
+ { key: "backgroundColor", val: "#0000ff", prog: 1 }
3626
+ ];
3627
+ var borderRadiusPreset = [
3628
+ { key: "borderRadius", val: "0px", prog: 0 },
3629
+ { key: "borderRadius", val: "50px", prog: 1 }
3630
+ ];
3631
+ var boxShadowPreset = [
3632
+ { key: "boxShadow", val: "0px 0px 0px rgba(0,0,0,0)", prog: 0 },
3633
+ { key: "boxShadow", val: "10px 10px 20px rgba(0,0,0,0.5)", prog: 1 }
3634
+ ];
3635
+ var fontSizePreset = [
3636
+ { key: "fontSize", val: "12px", prog: 0 },
3637
+ { key: "fontSize", val: "24px", prog: 1 }
3638
+ ];
3639
+ var letterSpacingPreset = [
3640
+ { key: "letterSpacing", val: "0px", prog: 0 },
3641
+ { key: "letterSpacing", val: "5px", prog: 1 }
3642
+ ];
3643
+ var lineHeightPreset = [
3644
+ { key: "lineHeight", val: "1", prog: 0 },
3645
+ { key: "lineHeight", val: "2", prog: 1 }
3646
+ ];
3647
+ var textShadowPreset = [
3648
+ { key: "textShadow", val: "0px 0px 0px rgba(0,0,0,0)", prog: 0 },
3649
+ { key: "textShadow", val: "2px 2px 4px rgba(0,0,0,0.5)", prog: 1 }
3650
+ ];
3651
+ var widthPreset = [
3652
+ { key: "width", val: "0px", prog: 0 },
3653
+ { key: "width", val: "100%", prog: 1 }
3654
+ ];
3655
+ var heightPreset = [
3656
+ { key: "height", val: "0px", prog: 0 },
3657
+ { key: "height", val: "100%", prog: 1 }
3658
+ ];
3659
+ var marginPreset = [
3660
+ { key: "margin", val: "0px", prog: 0 },
3661
+ { key: "margin", val: "20px", prog: 1 }
3662
+ ];
3663
+ var paddingPreset = [
3664
+ { key: "padding", val: "0px", prog: 0 },
3665
+ { key: "padding", val: "20px", prog: 1 }
3666
+ ];
3667
+ var morphingCardPreset = [
3668
+ { key: "borderRadius", val: "0px", prog: 0 },
3669
+ { key: "borderRadius", val: "20px", prog: 0.5 },
3670
+ { key: "borderRadius", val: "50px", prog: 1 },
3671
+ { key: "boxShadow", val: "0px 0px 0px rgba(0,0,0,0)", prog: 0 },
3672
+ { key: "boxShadow", val: "0px 10px 30px rgba(0,0,0,0.3)", prog: 1 },
3673
+ { key: "backgroundColor", val: "#ffffff", prog: 0 },
3674
+ { key: "backgroundColor", val: "#f0f0f0", prog: 1 }
3675
+ ];
3676
+ var textRevealPreset = [
3677
+ { key: "opacity", val: 0, prog: 0 },
3678
+ { key: "opacity", val: 1, prog: 1 },
3679
+ { key: "letterSpacing", val: "10px", prog: 0 },
3680
+ { key: "letterSpacing", val: "0px", prog: 1 },
3681
+ { key: "textShadow", val: "0px 0px 0px rgba(0,0,0,0)", prog: 0 },
3682
+ { key: "textShadow", val: "2px 2px 4px rgba(0,0,0,0.5)", prog: 1 }
3683
+ ];
3684
+ var GenericEffectPresets = {
3685
+ fadeInPreset,
3686
+ fadeOutPreset,
3687
+ scaleInPreset,
3688
+ scaleOutPreset,
3689
+ slideInLeftPreset,
3690
+ slideInRightPreset,
3691
+ slideInTopPreset,
3692
+ slideInBottomPreset,
3693
+ bouncePreset,
3694
+ pulsePreset,
3695
+ rotateInPreset,
3696
+ blurInPreset,
3697
+ fadeInScalePreset,
3698
+ slideInFadePreset,
3699
+ // String-based presets
3700
+ slideInLeftStringPreset,
3701
+ slideInRightStringPreset,
3702
+ slideInTopStringPreset,
3703
+ slideInBottomStringPreset,
3704
+ rotateInStringPreset,
3705
+ blurInStringPreset,
3706
+ scaleInStringPreset,
3707
+ slideInLeftResponsivePreset,
3708
+ slideInTopResponsivePreset,
3709
+ // Custom CSS property presets
3710
+ backgroundColorPreset,
3711
+ borderRadiusPreset,
3712
+ boxShadowPreset,
3713
+ fontSizePreset,
3714
+ letterSpacingPreset,
3715
+ lineHeightPreset,
3716
+ textShadowPreset,
3717
+ widthPreset,
3718
+ heightPreset,
3719
+ marginPreset,
3720
+ paddingPreset,
3721
+ morphingCardPreset,
3722
+ textRevealPreset
3723
+ };
3724
+
3725
+ // src/components/effects/index.ts
3726
+ registerEffect(config2.displayName, BlurEffect, config2);
3727
+ registerEffect(config3.displayName, LoopEffect, config3);
3728
+ registerEffect(config4.displayName, PanEffect, config4);
3729
+ registerEffect(config5.displayName, ZoomEffect, config5);
3730
+ registerEffect("generic", UniversalEffect, config);
3731
+ registerEffect(config6.displayName, ShakeEffect, config6);
3732
+ registerEffect(
3733
+ config7.displayName,
3734
+ StretchEffect,
3735
+ config7
3736
+ );
3737
+ registerEffect(
3738
+ config8.displayName,
3739
+ WaveformEffect,
3740
+ config8
3741
+ );
3742
+ registerEffect("CanvasWipeReveal", CanvasWipeReveal);
3743
+ registerEffect("CanvasContentAwareReveal", CanvasContentAwareReveal);
3744
+ registerEffect("CanvasParticleEffect", CanvasParticleEffect);
3745
+ registerEffect("CanvasGlitchEffect", CanvasGlitchEffect);
3746
+
3747
+ // src/components/layouts/BaseLayout.tsx
3748
+ var Layout = ({ id, children, data, context }) => {
3749
+ const { containerProps = {}, childrenProps = [], repeatChildrenProps = {} } = data;
3750
+ const overrideStyles = useAnimatedStyles(id);
3751
+ const childrenArray = import_react20.Children.toArray(children);
3752
+ const enhancedStyle = (0, import_react20.useMemo)(
2102
3753
  () => ({
2103
3754
  ...!context?.boundaries?.reset ? context?.boundaries : {},
2104
3755
  ...containerProps.style,
@@ -2112,8 +3763,8 @@ var Layout = ({ id, children, data, context }) => {
2112
3763
  );
2113
3764
  if (Object.keys(repeatChildrenProps).length <= 0 && childrenProps.length <= 0) {
2114
3765
  if (data.isAbsoluteFill) {
2115
- return /* @__PURE__ */ import_react13.default.createElement(
2116
- import_remotion9.AbsoluteFill,
3766
+ return /* @__PURE__ */ import_react20.default.createElement(
3767
+ import_remotion14.AbsoluteFill,
2117
3768
  {
2118
3769
  ...containerProps,
2119
3770
  style: enhancedStyle
@@ -2121,25 +3772,25 @@ var Layout = ({ id, children, data, context }) => {
2121
3772
  childrenArray
2122
3773
  );
2123
3774
  }
2124
- return /* @__PURE__ */ import_react13.default.createElement(
3775
+ return /* @__PURE__ */ import_react20.default.createElement(
2125
3776
  "div",
2126
3777
  {
2127
3778
  id,
2128
3779
  ...containerProps,
2129
3780
  style: enhancedStyle
2130
3781
  },
2131
- childrenArray.map((child, index) => /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, { key: index }, child))
3782
+ childrenArray.map((child, index) => /* @__PURE__ */ import_react20.default.createElement(import_react20.default.Fragment, { key: index }, child))
2132
3783
  );
2133
3784
  }
2134
3785
  if (data.isAbsoluteFill) {
2135
- return /* @__PURE__ */ import_react13.default.createElement(
2136
- import_remotion9.AbsoluteFill,
3786
+ return /* @__PURE__ */ import_react20.default.createElement(
3787
+ import_remotion14.AbsoluteFill,
2137
3788
  {
2138
3789
  id,
2139
3790
  ...containerProps,
2140
3791
  style: enhancedStyle
2141
3792
  },
2142
- childrenArray.map((child, index) => /* @__PURE__ */ import_react13.default.createElement(
3793
+ childrenArray.map((child, index) => /* @__PURE__ */ import_react20.default.createElement(
2143
3794
  "div",
2144
3795
  {
2145
3796
  key: index,
@@ -2149,14 +3800,14 @@ var Layout = ({ id, children, data, context }) => {
2149
3800
  ))
2150
3801
  );
2151
3802
  }
2152
- return /* @__PURE__ */ import_react13.default.createElement(
3803
+ return /* @__PURE__ */ import_react20.default.createElement(
2153
3804
  "div",
2154
3805
  {
2155
3806
  id,
2156
3807
  ...containerProps,
2157
3808
  style: enhancedStyle
2158
3809
  },
2159
- childrenArray.map((child, index) => /* @__PURE__ */ import_react13.default.createElement(
3810
+ childrenArray.map((child, index) => /* @__PURE__ */ import_react20.default.createElement(
2160
3811
  "div",
2161
3812
  {
2162
3813
  key: index,
@@ -2166,7 +3817,7 @@ var Layout = ({ id, children, data, context }) => {
2166
3817
  ))
2167
3818
  );
2168
3819
  };
2169
- var config8 = {
3820
+ var config10 = {
2170
3821
  displayName: "BaseLayout",
2171
3822
  type: "layout",
2172
3823
  isInnerSequence: false
@@ -2174,27 +3825,27 @@ var config8 = {
2174
3825
 
2175
3826
  // src/components/layouts/index.ts
2176
3827
  registerComponent(
2177
- config8.displayName,
3828
+ config10.displayName,
2178
3829
  Layout,
2179
3830
  "layout",
2180
- config8
3831
+ config10
2181
3832
  );
2182
3833
 
2183
3834
  // src/components/atoms/ShapeAtom.tsx
2184
- var import_react14 = __toESM(require("react"));
2185
- var import_remotion10 = require("remotion");
2186
- var Atom = ({ data }) => {
2187
- const frame = (0, import_remotion10.useCurrentFrame)();
3835
+ var import_react21 = __toESM(require("react"));
3836
+ var import_remotion15 = require("remotion");
3837
+ var Atom2 = ({ data }) => {
3838
+ const frame = (0, import_remotion15.useCurrentFrame)();
2188
3839
  const { shape, color, rotation, style } = data;
2189
3840
  const rotationStyle = rotation ? {
2190
- transform: `rotate(${(0, import_remotion10.interpolate)(
3841
+ transform: `rotate(${(0, import_remotion15.interpolate)(
2191
3842
  frame % rotation.duration,
2192
3843
  [0, rotation.duration],
2193
3844
  [0, 360],
2194
3845
  {
2195
3846
  extrapolateLeft: "clamp",
2196
3847
  extrapolateRight: "clamp",
2197
- easing: import_remotion10.Easing.linear
3848
+ easing: import_remotion15.Easing.linear
2198
3849
  }
2199
3850
  )}deg)`
2200
3851
  } : {};
@@ -2206,22 +3857,22 @@ var Atom = ({ data }) => {
2206
3857
  };
2207
3858
  switch (shape) {
2208
3859
  case "circle":
2209
- return /* @__PURE__ */ import_react14.default.createElement("div", { style: { ...baseStyle, backgroundColor: color, borderRadius: "50%" } });
3860
+ return /* @__PURE__ */ import_react21.default.createElement("div", { style: { ...baseStyle, backgroundColor: color, borderRadius: "50%" } });
2210
3861
  case "rectangle":
2211
- return /* @__PURE__ */ import_react14.default.createElement("div", { style: { ...baseStyle, backgroundColor: color } });
3862
+ return /* @__PURE__ */ import_react21.default.createElement("div", { style: { ...baseStyle, backgroundColor: color } });
2212
3863
  default:
2213
3864
  return null;
2214
3865
  }
2215
3866
  };
2216
- var config9 = {
3867
+ var config11 = {
2217
3868
  displayName: "ShapeAtom",
2218
3869
  type: "atom",
2219
3870
  isInnerSequence: false
2220
3871
  };
2221
3872
 
2222
3873
  // src/components/atoms/ImageAtom.tsx
2223
- var import_react15 = __toESM(require("react"));
2224
- var import_remotion11 = require("remotion");
3874
+ var import_react22 = __toESM(require("react"));
3875
+ var import_remotion16 = require("remotion");
2225
3876
  var CORS_PROXIES = [
2226
3877
  "https://thingproxy.freeboard.io/fetch/",
2227
3878
  "https://api.allorigins.win/raw?url=",
@@ -2231,14 +3882,14 @@ var getCorsProxyUrl = (url) => {
2231
3882
  return `${CORS_PROXIES[0]}${encodeURIComponent(url)}`;
2232
3883
  };
2233
3884
  var useImageSource = (src, proxySrc) => {
2234
- const [imageSource, setImageSource] = (0, import_react15.useState)(src);
2235
- const [isLoading, setIsLoading] = (0, import_react15.useState)(false);
2236
- const [hasError, setHasError] = (0, import_react15.useState)(false);
2237
- const [handle] = (0, import_react15.useState)(() => (0, import_remotion11.delayRender)("Loading image"));
2238
- (0, import_react15.useEffect)(() => {
3885
+ const [imageSource, setImageSource] = (0, import_react22.useState)(src);
3886
+ const [isLoading, setIsLoading] = (0, import_react22.useState)(false);
3887
+ const [hasError, setHasError] = (0, import_react22.useState)(false);
3888
+ const [handle] = (0, import_react22.useState)(() => (0, import_remotion16.delayRender)("Loading image"));
3889
+ (0, import_react22.useEffect)(() => {
2239
3890
  if (!src.startsWith("http")) {
2240
3891
  setImageSource(src);
2241
- (0, import_remotion11.continueRender)(handle);
3892
+ (0, import_remotion16.continueRender)(handle);
2242
3893
  return;
2243
3894
  }
2244
3895
  setIsLoading(true);
@@ -2248,7 +3899,7 @@ var useImageSource = (src, proxySrc) => {
2248
3899
  const handleSuccess = () => {
2249
3900
  setImageSource(src);
2250
3901
  setIsLoading(false);
2251
- (0, import_remotion11.continueRender)(handle);
3902
+ (0, import_remotion16.continueRender)(handle);
2252
3903
  };
2253
3904
  const handleError = () => {
2254
3905
  let proxyUrl;
@@ -2259,7 +3910,7 @@ var useImageSource = (src, proxySrc) => {
2259
3910
  }
2260
3911
  setImageSource(proxyUrl);
2261
3912
  setIsLoading(false);
2262
- (0, import_remotion11.continueRender)(handle);
3913
+ (0, import_remotion16.continueRender)(handle);
2263
3914
  };
2264
3915
  testImage.onload = handleSuccess;
2265
3916
  testImage.onerror = handleError;
@@ -2271,21 +3922,21 @@ var useImageSource = (src, proxySrc) => {
2271
3922
  }, [src, proxySrc, handle]);
2272
3923
  return { imageSource, isLoading, hasError };
2273
3924
  };
2274
- var Atom2 = ({ data, id }) => {
3925
+ var Atom3 = ({ data, id }) => {
2275
3926
  const overrideStyles = useAnimatedStyles(id);
2276
3927
  const { imageSource, isLoading, hasError } = useImageSource(data.src, data.proxySrc);
2277
- const source = (0, import_react15.useMemo)(() => {
3928
+ const source = (0, import_react22.useMemo)(() => {
2278
3929
  if (data.src.startsWith("http")) {
2279
3930
  return imageSource;
2280
3931
  }
2281
- return (0, import_remotion11.staticFile)(data.src);
3932
+ return (0, import_remotion16.staticFile)(data.src);
2282
3933
  }, [data.src, imageSource]);
2283
- const enhancedStyle = (0, import_react15.useMemo)(() => ({
3934
+ const enhancedStyle = (0, import_react22.useMemo)(() => ({
2284
3935
  ...data.style,
2285
3936
  ...overrideStyles
2286
3937
  }), [data.style, overrideStyles, isLoading, hasError]);
2287
- return /* @__PURE__ */ import_react15.default.createElement(
2288
- import_remotion11.Img,
3938
+ return /* @__PURE__ */ import_react22.default.createElement(
3939
+ import_remotion16.Img,
2289
3940
  {
2290
3941
  className: data.className,
2291
3942
  src: source,
@@ -2298,19 +3949,19 @@ var Atom2 = ({ data, id }) => {
2298
3949
  }
2299
3950
  );
2300
3951
  };
2301
- var config10 = {
3952
+ var config12 = {
2302
3953
  displayName: "ImageAtom",
2303
3954
  type: "atom",
2304
3955
  isInnerSequence: false
2305
3956
  };
2306
3957
 
2307
3958
  // src/components/atoms/TextAtom.tsx
2308
- var import_react17 = __toESM(require("react"));
2309
- var import_remotion13 = require("remotion");
3959
+ var import_react24 = __toESM(require("react"));
3960
+ var import_remotion18 = require("remotion");
2310
3961
 
2311
3962
  // src/hooks/useFontLoader.ts
2312
- var import_react16 = require("react");
2313
- var import_remotion12 = require("remotion");
3963
+ var import_react23 = require("react");
3964
+ var import_remotion17 = require("remotion");
2314
3965
 
2315
3966
  // src/utils/fontUtils.ts
2316
3967
  var fontUtils = __toESM(require("@remotion/google-fonts"));
@@ -2451,12 +4102,12 @@ var getNormalizedFontName = (fontFamily) => {
2451
4102
 
2452
4103
  // src/hooks/useFontLoader.ts
2453
4104
  var useFontLoader = (options = {}) => {
2454
- const [state, setState] = (0, import_react16.useState)({
4105
+ const [state, setState] = (0, import_react23.useState)({
2455
4106
  loadedFonts: /* @__PURE__ */ new Map(),
2456
4107
  loadingFonts: /* @__PURE__ */ new Set(),
2457
4108
  errorFonts: /* @__PURE__ */ new Map()
2458
4109
  });
2459
- const loadFont = (0, import_react16.useCallback)(
4110
+ const loadFont = (0, import_react23.useCallback)(
2460
4111
  async (fontFamily, fontOptions = {}) => {
2461
4112
  const fontKey = `${fontFamily}-${JSON.stringify(fontOptions)}`;
2462
4113
  if (state.loadedFonts.has(fontKey) || state.loadingFonts.has(fontFamily)) {
@@ -2499,7 +4150,7 @@ var useFontLoader = (options = {}) => {
2499
4150
  },
2500
4151
  [state.loadedFonts, state.loadingFonts, options]
2501
4152
  );
2502
- const loadMultipleFonts2 = (0, import_react16.useCallback)(
4153
+ const loadMultipleFonts2 = (0, import_react23.useCallback)(
2503
4154
  async (fonts) => {
2504
4155
  const fontsToLoad = fonts.filter(({ family, options: options2 = {} }) => {
2505
4156
  const fontKey = `${family}-${JSON.stringify(options2)}`;
@@ -2558,14 +4209,14 @@ var useFontLoader = (options = {}) => {
2558
4209
  },
2559
4210
  [state.loadedFonts, state.loadingFonts, options]
2560
4211
  );
2561
- const isFontReady = (0, import_react16.useCallback)(
4212
+ const isFontReady = (0, import_react23.useCallback)(
2562
4213
  (fontFamily, options2 = {}) => {
2563
4214
  const fontKey = `${fontFamily}-${JSON.stringify(options2)}`;
2564
4215
  return state.loadedFonts.has(fontKey);
2565
4216
  },
2566
4217
  [state.loadedFonts]
2567
4218
  );
2568
- const areFontsReady = (0, import_react16.useCallback)(
4219
+ const areFontsReady = (0, import_react23.useCallback)(
2569
4220
  (fontFamilies) => {
2570
4221
  return fontFamilies.every(({ family, options: options2 = {} }) => {
2571
4222
  const fontKey = `${family}-${JSON.stringify(options2)}`;
@@ -2574,20 +4225,20 @@ var useFontLoader = (options = {}) => {
2574
4225
  },
2575
4226
  [state.loadedFonts]
2576
4227
  );
2577
- const getFontFamily = (0, import_react16.useCallback)(
4228
+ const getFontFamily = (0, import_react23.useCallback)(
2578
4229
  (fontFamily, options2 = {}) => {
2579
4230
  const fontKey = `${fontFamily}-${JSON.stringify(options2)}`;
2580
4231
  return state.loadedFonts.get(fontKey);
2581
4232
  },
2582
4233
  [state.loadedFonts]
2583
4234
  );
2584
- const getFontError = (0, import_react16.useCallback)(
4235
+ const getFontError = (0, import_react23.useCallback)(
2585
4236
  (fontFamily) => {
2586
4237
  return state.errorFonts.get(fontFamily);
2587
4238
  },
2588
4239
  [state.errorFonts]
2589
4240
  );
2590
- const clearErrors = (0, import_react16.useCallback)(() => {
4241
+ const clearErrors = (0, import_react23.useCallback)(() => {
2591
4242
  setState((prev) => ({
2592
4243
  ...prev,
2593
4244
  errorFonts: /* @__PURE__ */ new Map()
@@ -2610,25 +4261,25 @@ var useFontLoader = (options = {}) => {
2610
4261
  };
2611
4262
  var useFont = (fontFamily, options = {}) => {
2612
4263
  const { loadFont, isFontReady, getFontFamily, getFontError, ...rest } = useFontLoader(options);
2613
- const [isLoaded, setIsLoaded] = (0, import_react16.useState)(false);
2614
- const [error, setError] = (0, import_react16.useState)(null);
2615
- const [renderHandle] = (0, import_react16.useState)(
2616
- () => (0, import_remotion12.delayRender)(`Loading font: ${fontFamily}`)
4264
+ const [isLoaded, setIsLoaded] = (0, import_react23.useState)(false);
4265
+ const [error, setError] = (0, import_react23.useState)(null);
4266
+ const [renderHandle] = (0, import_react23.useState)(
4267
+ () => (0, import_remotion17.delayRender)(`Loading font: ${fontFamily}`)
2617
4268
  );
2618
4269
  const initialFontFamily = getFontFamily(fontFamily, options) || `"${fontFamily}", sans-serif`;
2619
- const [fontFamilyValue, setFontFamilyValue] = (0, import_react16.useState)(initialFontFamily);
2620
- (0, import_react16.useEffect)(() => {
4270
+ const [fontFamilyValue, setFontFamilyValue] = (0, import_react23.useState)(initialFontFamily);
4271
+ (0, import_react23.useEffect)(() => {
2621
4272
  const loadFontAsync = async () => {
2622
4273
  try {
2623
4274
  const cssValue = await loadFont(fontFamily, options);
2624
4275
  setFontFamilyValue(cssValue);
2625
4276
  setIsLoaded(true);
2626
4277
  setError(null);
2627
- (0, import_remotion12.continueRender)(renderHandle);
4278
+ (0, import_remotion17.continueRender)(renderHandle);
2628
4279
  } catch (err) {
2629
4280
  setError(err instanceof Error ? err : new Error(String(err)));
2630
4281
  setIsLoaded(false);
2631
- (0, import_remotion12.continueRender)(renderHandle);
4282
+ (0, import_remotion17.continueRender)(renderHandle);
2632
4283
  }
2633
4284
  };
2634
4285
  if (!isFontReady(fontFamily, options)) {
@@ -2639,7 +4290,7 @@ var useFont = (fontFamily, options = {}) => {
2639
4290
  setFontFamilyValue(cachedValue);
2640
4291
  }
2641
4292
  setIsLoaded(true);
2642
- (0, import_remotion12.continueRender)(renderHandle);
4293
+ (0, import_remotion17.continueRender)(renderHandle);
2643
4294
  }
2644
4295
  }, [fontFamily, loadFont, isFontReady, getFontFamily, options, renderHandle]);
2645
4296
  return {
@@ -2652,11 +4303,11 @@ var useFont = (fontFamily, options = {}) => {
2652
4303
  };
2653
4304
 
2654
4305
  // src/components/atoms/TextAtom.tsx
2655
- var Atom3 = ({ id, data }) => {
4306
+ var Atom4 = ({ id, data }) => {
2656
4307
  const overrideStyles = useAnimatedStyles(id);
2657
- const [isFontLoading, setIsFontLoading] = (0, import_react17.useState)(false);
2658
- const [renderHandle] = (0, import_react17.useState)(
2659
- () => (0, import_remotion13.delayRender)(`Loading font: ${data.font?.family}`)
4308
+ const [isFontLoading, setIsFontLoading] = (0, import_react24.useState)(false);
4309
+ const [renderHandle] = (0, import_react24.useState)(
4310
+ () => (0, import_remotion18.delayRender)(`Loading font: ${data.font?.family}`)
2660
4311
  );
2661
4312
  const { isLoaded, error, isReady, fontFamily } = useFont(
2662
4313
  data.font?.family || "Inter",
@@ -2667,15 +4318,15 @@ var Atom3 = ({ id, data }) => {
2667
4318
  preload: data.font?.preload !== false,
2668
4319
  onLoad: (family, cssValue) => {
2669
4320
  setIsFontLoading(false);
2670
- (0, import_remotion13.continueRender)(renderHandle);
4321
+ (0, import_remotion18.continueRender)(renderHandle);
2671
4322
  },
2672
4323
  onError: (family, error2) => {
2673
4324
  setIsFontLoading(false);
2674
- (0, import_remotion13.continueRender)(renderHandle);
4325
+ (0, import_remotion18.continueRender)(renderHandle);
2675
4326
  }
2676
4327
  }
2677
4328
  );
2678
- (0, import_react17.useEffect)(() => {
4329
+ (0, import_react24.useEffect)(() => {
2679
4330
  if (data.font?.family) {
2680
4331
  if (isReady || isLoaded) {
2681
4332
  setIsFontLoading(false);
@@ -2684,18 +4335,33 @@ var Atom3 = ({ id, data }) => {
2684
4335
  }
2685
4336
  }
2686
4337
  }, [data.font, isReady, isLoaded, error]);
2687
- const enhancedStyle = (0, import_react17.useMemo)(() => ({
2688
- fontFamily,
2689
- ...data.style,
2690
- ...overrideStyles
2691
- }), [fontFamily, data.style, overrideStyles]);
4338
+ const enhancedStyle = (0, import_react24.useMemo)(() => {
4339
+ const baseStyle = {
4340
+ fontFamily,
4341
+ ...data.style
4342
+ };
4343
+ if (data.gradient) {
4344
+ return {
4345
+ ...baseStyle,
4346
+ backgroundImage: data.gradient,
4347
+ backgroundClip: "text",
4348
+ WebkitBackgroundClip: "text",
4349
+ color: "transparent",
4350
+ ...overrideStyles
4351
+ };
4352
+ }
4353
+ return {
4354
+ ...baseStyle,
4355
+ ...overrideStyles
4356
+ };
4357
+ }, [fontFamily, data.style, data.gradient, overrideStyles]);
2692
4358
  if (isFontLoading && data.loadingState?.showLoadingIndicator) {
2693
- return /* @__PURE__ */ import_react17.default.createElement("div", { style: enhancedStyle, className: data.className }, /* @__PURE__ */ import_react17.default.createElement("span", { style: data.loadingState.loadingStyle }, data.loadingState.loadingText || "Loading..."));
4359
+ return /* @__PURE__ */ import_react24.default.createElement("div", { style: enhancedStyle, className: data.className }, /* @__PURE__ */ import_react24.default.createElement("span", { style: data.loadingState.loadingStyle }, data.loadingState.loadingText || "Loading..."));
2694
4360
  }
2695
4361
  if (error && data.errorState?.showErrorIndicator) {
2696
- return /* @__PURE__ */ import_react17.default.createElement("div", { style: enhancedStyle, className: data.className }, /* @__PURE__ */ import_react17.default.createElement("span", { style: data.errorState.errorStyle }, data.errorState.errorText || data.text));
4362
+ return /* @__PURE__ */ import_react24.default.createElement("div", { style: enhancedStyle, className: data.className }, /* @__PURE__ */ import_react24.default.createElement("span", { style: data.errorState.errorStyle }, data.errorState.errorText || data.text));
2697
4363
  }
2698
- return /* @__PURE__ */ import_react17.default.createElement(
4364
+ return /* @__PURE__ */ import_react24.default.createElement(
2699
4365
  "div",
2700
4366
  {
2701
4367
  style: enhancedStyle,
@@ -2708,60 +4374,60 @@ var Atom3 = ({ id, data }) => {
2708
4374
  data.text
2709
4375
  );
2710
4376
  };
2711
- var config11 = {
4377
+ var config13 = {
2712
4378
  displayName: "TextAtom",
2713
4379
  type: "atom",
2714
4380
  isInnerSequence: false
2715
4381
  };
2716
4382
 
2717
4383
  // src/components/atoms/VideoAtom.tsx
2718
- var import_react18 = __toESM(require("react"));
2719
- var import_remotion14 = require("remotion");
2720
- var import_zod2 = require("zod");
2721
- var VideoAtomDataProps = import_zod2.z.object({
2722
- src: import_zod2.z.string(),
4384
+ var import_react25 = __toESM(require("react"));
4385
+ var import_remotion19 = require("remotion");
4386
+ var import_zod7 = require("zod");
4387
+ var VideoAtomDataProps = import_zod7.z.object({
4388
+ src: import_zod7.z.string(),
2723
4389
  // Video source URL
2724
- srcDuration: import_zod2.z.number().optional(),
4390
+ srcDuration: import_zod7.z.number().optional(),
2725
4391
  // Video duration in seconds (or to say it more accurately, each iteration duration in a loop))
2726
- style: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.any()).optional(),
4392
+ style: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.any()).optional(),
2727
4393
  // CSS styles object
2728
- containerClassName: import_zod2.z.string().optional(),
4394
+ containerClassName: import_zod7.z.string().optional(),
2729
4395
  // CSS class names
2730
- className: import_zod2.z.string().optional(),
4396
+ className: import_zod7.z.string().optional(),
2731
4397
  // CSS class names
2732
- startFrom: import_zod2.z.number().optional(),
4398
+ startFrom: import_zod7.z.number().optional(),
2733
4399
  // Start playback from this time (seconds)
2734
- endAt: import_zod2.z.number().optional(),
4400
+ endAt: import_zod7.z.number().optional(),
2735
4401
  // End playback at this time (seconds)
2736
- playbackRate: import_zod2.z.number().optional(),
4402
+ playbackRate: import_zod7.z.number().optional(),
2737
4403
  // Playback speed multiplier
2738
- volume: import_zod2.z.number().optional(),
4404
+ volume: import_zod7.z.number().optional(),
2739
4405
  // Volume level (0-1)
2740
- muted: import_zod2.z.boolean().optional(),
4406
+ muted: import_zod7.z.boolean().optional(),
2741
4407
  // Mute video audio
2742
- loop: import_zod2.z.boolean().optional(),
4408
+ loop: import_zod7.z.boolean().optional(),
2743
4409
  // Whether to loop the video
2744
- fit: import_zod2.z.enum(["contain", "cover", "fill", "none", "scale-down"]).optional()
4410
+ fit: import_zod7.z.enum(["contain", "cover", "fill", "none", "scale-down"]).optional()
2745
4411
  // Object fit style
2746
4412
  });
2747
- var Atom4 = ({ data, id, context }) => {
2748
- const { fps } = (0, import_remotion14.useVideoConfig)();
4413
+ var Atom5 = ({ data, id, context }) => {
4414
+ const { fps } = (0, import_remotion19.useVideoConfig)();
2749
4415
  const overrideStyles = useAnimatedStyles(id);
2750
- const frame = (0, import_remotion14.useCurrentFrame)();
2751
- const source = (0, import_react18.useMemo)(() => {
4416
+ const frame = (0, import_remotion19.useCurrentFrame)();
4417
+ const source = (0, import_react25.useMemo)(() => {
2752
4418
  if (data.src.startsWith("http")) {
2753
4419
  return data.src;
2754
4420
  }
2755
- return (0, import_remotion14.staticFile)(data.src);
4421
+ return (0, import_remotion19.staticFile)(data.src);
2756
4422
  }, [data.src]);
2757
- const trimBefore = (0, import_react18.useMemo)(() => {
4423
+ const trimBefore = (0, import_react25.useMemo)(() => {
2758
4424
  return data.startFrom ? data.startFrom * fps : void 0;
2759
4425
  }, [data.startFrom, fps]);
2760
- const trimAfter = (0, import_react18.useMemo)(() => {
4426
+ const trimAfter = (0, import_react25.useMemo)(() => {
2761
4427
  return data.endAt ? data.endAt * fps : void 0;
2762
4428
  }, [data.endAt, fps]);
2763
- const videoComponent = /* @__PURE__ */ import_react18.default.createElement(
2764
- import_remotion14.OffthreadVideo,
4429
+ const videoComponent = /* @__PURE__ */ import_react25.default.createElement(
4430
+ import_remotion19.OffthreadVideo,
2765
4431
  {
2766
4432
  className: data.className,
2767
4433
  src: source,
@@ -2773,8 +4439,8 @@ var Atom4 = ({ data, id, context }) => {
2773
4439
  muted: data.muted
2774
4440
  }
2775
4441
  );
2776
- const videoWithStyles = data.containerClassName ? videoComponent : /* @__PURE__ */ import_react18.default.createElement(
2777
- import_remotion14.OffthreadVideo,
4442
+ const videoWithStyles = data.containerClassName ? videoComponent : /* @__PURE__ */ import_react25.default.createElement(
4443
+ import_remotion19.OffthreadVideo,
2778
4444
  {
2779
4445
  className: data.className,
2780
4446
  src: source,
@@ -2787,53 +4453,53 @@ var Atom4 = ({ data, id, context }) => {
2787
4453
  }
2788
4454
  );
2789
4455
  if (data.loop) {
2790
- return /* @__PURE__ */ import_react18.default.createElement(import_remotion14.Loop, { times: Infinity, durationInFrames: data.srcDuration ? data.srcDuration * fps : context.timing?.durationInFrames, layout: "none" }, data.containerClassName ? /* @__PURE__ */ import_react18.default.createElement("div", { className: data.containerClassName, style: overrideStyles }, videoComponent) : videoWithStyles);
4456
+ return /* @__PURE__ */ import_react25.default.createElement(import_remotion19.Loop, { times: Infinity, durationInFrames: data.srcDuration ? data.srcDuration * fps : context.timing?.durationInFrames, layout: "none" }, data.containerClassName ? /* @__PURE__ */ import_react25.default.createElement("div", { className: data.containerClassName, style: overrideStyles }, videoComponent) : videoWithStyles);
2791
4457
  }
2792
- return data.containerClassName ? /* @__PURE__ */ import_react18.default.createElement("div", { className: data.containerClassName, style: overrideStyles }, videoComponent) : videoWithStyles;
4458
+ return data.containerClassName ? /* @__PURE__ */ import_react25.default.createElement("div", { className: data.containerClassName, style: overrideStyles }, videoComponent) : videoWithStyles;
2793
4459
  };
2794
- var config12 = {
4460
+ var config14 = {
2795
4461
  displayName: "VideoAtom",
2796
4462
  type: "atom",
2797
4463
  isInnerSequence: false
2798
4464
  };
2799
4465
 
2800
4466
  // src/components/atoms/AudioAtom.tsx
2801
- var import_react19 = __toESM(require("react"));
2802
- var import_remotion15 = require("remotion");
2803
- var import_zod3 = require("zod");
2804
- var AudioAtomMutedRangeProps = import_zod3.z.object({
2805
- type: import_zod3.z.literal("range"),
2806
- values: import_zod3.z.array(import_zod3.z.object({
2807
- start: import_zod3.z.number(),
4467
+ var import_react26 = __toESM(require("react"));
4468
+ var import_remotion20 = require("remotion");
4469
+ var import_zod8 = require("zod");
4470
+ var AudioAtomMutedRangeProps = import_zod8.z.object({
4471
+ type: import_zod8.z.literal("range"),
4472
+ values: import_zod8.z.array(import_zod8.z.object({
4473
+ start: import_zod8.z.number(),
2808
4474
  // Start time in seconds
2809
- end: import_zod3.z.number()
4475
+ end: import_zod8.z.number()
2810
4476
  // End time in seconds
2811
4477
  }))
2812
4478
  });
2813
- var AudioAtomMutedFullProps = import_zod3.z.object({
2814
- type: import_zod3.z.literal("full"),
2815
- value: import_zod3.z.boolean()
4479
+ var AudioAtomMutedFullProps = import_zod8.z.object({
4480
+ type: import_zod8.z.literal("full"),
4481
+ value: import_zod8.z.boolean()
2816
4482
  // true = muted, false = unmuted
2817
4483
  });
2818
- var AudioAtomDataProps = import_zod3.z.object({
2819
- src: import_zod3.z.string(),
4484
+ var AudioAtomDataProps = import_zod8.z.object({
4485
+ src: import_zod8.z.string(),
2820
4486
  // Audio source URL
2821
- startFrom: import_zod3.z.number().optional(),
4487
+ startFrom: import_zod8.z.number().optional(),
2822
4488
  // Start playback from this time (seconds)
2823
- endAt: import_zod3.z.number().optional(),
4489
+ endAt: import_zod8.z.number().optional(),
2824
4490
  // End playback at this time (seconds)
2825
- volume: import_zod3.z.number().optional(),
4491
+ volume: import_zod8.z.number().optional(),
2826
4492
  // Volume level (0-1)
2827
- playbackRate: import_zod3.z.number().optional(),
4493
+ playbackRate: import_zod8.z.number().optional(),
2828
4494
  // Playback speed multiplier
2829
- muted: import_zod3.z.union([AudioAtomMutedFullProps, AudioAtomMutedRangeProps]).optional()
4495
+ muted: import_zod8.z.union([AudioAtomMutedFullProps, AudioAtomMutedRangeProps]).optional()
2830
4496
  // Mute configuration
2831
4497
  });
2832
- var Atom5 = ({ data }) => {
2833
- const { fps } = (0, import_remotion15.useVideoConfig)();
4498
+ var Atom6 = ({ data }) => {
4499
+ const { fps } = (0, import_remotion20.useVideoConfig)();
2834
4500
  const { muted } = data;
2835
- const frame = (0, import_remotion15.useCurrentFrame)();
2836
- const isMuted = (0, import_react19.useMemo)(() => {
4501
+ const frame = (0, import_remotion20.useCurrentFrame)();
4502
+ const isMuted = (0, import_react26.useMemo)(() => {
2837
4503
  if (muted?.type === "full") {
2838
4504
  return muted.value;
2839
4505
  }
@@ -2844,16 +4510,16 @@ var Atom5 = ({ data }) => {
2844
4510
  }
2845
4511
  return false;
2846
4512
  }, [muted, frame, fps]);
2847
- const source = (0, import_react19.useMemo)(() => {
4513
+ const source = (0, import_react26.useMemo)(() => {
2848
4514
  if (data.src.startsWith("http")) {
2849
4515
  return data.src;
2850
4516
  }
2851
- return (0, import_remotion15.staticFile)(data.src);
4517
+ return (0, import_remotion20.staticFile)(data.src);
2852
4518
  }, [data.src]);
2853
4519
  return (
2854
4520
  // @ts-ignore
2855
- /* @__PURE__ */ import_react19.default.createElement(
2856
- import_remotion15.Audio,
4521
+ /* @__PURE__ */ import_react26.default.createElement(
4522
+ import_remotion20.Audio,
2857
4523
  {
2858
4524
  src: source,
2859
4525
  trimBefore: data.startFrom ? data.startFrom * fps : void 0,
@@ -2865,47 +4531,47 @@ var Atom5 = ({ data }) => {
2865
4531
  )
2866
4532
  );
2867
4533
  };
2868
- var config13 = {
4534
+ var config15 = {
2869
4535
  displayName: "AudioAtom",
2870
4536
  type: "atom",
2871
4537
  isInnerSequence: false
2872
4538
  };
2873
4539
 
2874
4540
  // src/components/atoms/LottieAtom.tsx
2875
- var import_react20 = __toESM(require("react"));
2876
- var import_remotion16 = require("remotion");
4541
+ var import_react27 = __toESM(require("react"));
4542
+ var import_remotion21 = require("remotion");
2877
4543
  var import_lottie = require("@remotion/lottie");
2878
- var import_zod4 = require("zod");
2879
- var LottieAtomDataProps = import_zod4.z.object({
2880
- src: import_zod4.z.string(),
4544
+ var import_zod9 = require("zod");
4545
+ var LottieAtomDataProps = import_zod9.z.object({
4546
+ src: import_zod9.z.string(),
2881
4547
  // Lottie JSON source URL or local path
2882
- style: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.any()).optional(),
4548
+ style: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.any()).optional(),
2883
4549
  // CSS styles object
2884
- className: import_zod4.z.string().optional(),
4550
+ className: import_zod9.z.string().optional(),
2885
4551
  // CSS class names
2886
- loop: import_zod4.z.boolean().optional(),
4552
+ loop: import_zod9.z.boolean().optional(),
2887
4553
  // Whether to loop the animation (handled by Remotion timeline)
2888
- playbackRate: import_zod4.z.number().optional(),
4554
+ playbackRate: import_zod9.z.number().optional(),
2889
4555
  // Playback speed multiplier (default: 1)
2890
- direction: import_zod4.z.enum(["forward", "reverse"]).optional()
4556
+ direction: import_zod9.z.enum(["forward", "reverse"]).optional()
2891
4557
  // Animation direction
2892
4558
  });
2893
4559
  var useLottieData = (src) => {
2894
- const [animationData, setAnimationData] = (0, import_react20.useState)(null);
2895
- const [isLoading, setIsLoading] = (0, import_react20.useState)(true);
2896
- const [hasError, setHasError] = (0, import_react20.useState)(false);
2897
- const [handle] = (0, import_react20.useState)(() => (0, import_remotion16.delayRender)("Loading Lottie animation"));
2898
- (0, import_react20.useEffect)(() => {
4560
+ const [animationData, setAnimationData] = (0, import_react27.useState)(null);
4561
+ const [isLoading, setIsLoading] = (0, import_react27.useState)(true);
4562
+ const [hasError, setHasError] = (0, import_react27.useState)(false);
4563
+ const [handle] = (0, import_react27.useState)(() => (0, import_remotion21.delayRender)("Loading Lottie animation"));
4564
+ (0, import_react27.useEffect)(() => {
2899
4565
  if (!src) {
2900
4566
  console.error("LottieAtom: No source provided");
2901
4567
  setHasError(true);
2902
4568
  setIsLoading(false);
2903
- (0, import_remotion16.continueRender)(handle);
4569
+ (0, import_remotion21.continueRender)(handle);
2904
4570
  return;
2905
4571
  }
2906
4572
  setIsLoading(true);
2907
4573
  setHasError(false);
2908
- const sourceUrl = src.startsWith("http") ? src : (0, import_remotion16.staticFile)(src);
4574
+ const sourceUrl = src.startsWith("http") ? src : (0, import_remotion21.staticFile)(src);
2909
4575
  fetch(sourceUrl, {
2910
4576
  mode: "cors",
2911
4577
  credentials: "omit"
@@ -2920,24 +4586,24 @@ var useLottieData = (src) => {
2920
4586
  }
2921
4587
  setAnimationData(json);
2922
4588
  setIsLoading(false);
2923
- (0, import_remotion16.continueRender)(handle);
4589
+ (0, import_remotion21.continueRender)(handle);
2924
4590
  }).catch((error) => {
2925
4591
  console.error(`Failed to load Lottie animation from ${sourceUrl}:`, error.message || error);
2926
4592
  setHasError(true);
2927
4593
  setIsLoading(false);
2928
- (0, import_remotion16.continueRender)(handle);
4594
+ (0, import_remotion21.continueRender)(handle);
2929
4595
  });
2930
4596
  return () => {
2931
4597
  };
2932
4598
  }, [src, handle]);
2933
4599
  return { animationData, isLoading, hasError };
2934
4600
  };
2935
- var Atom6 = ({ data, id }) => {
2936
- const { fps } = (0, import_remotion16.useVideoConfig)();
2937
- const frame = (0, import_remotion16.useCurrentFrame)();
4601
+ var Atom7 = ({ data, id }) => {
4602
+ const { fps } = (0, import_remotion21.useVideoConfig)();
4603
+ const frame = (0, import_remotion21.useCurrentFrame)();
2938
4604
  const overrideStyles = useAnimatedStyles(id);
2939
4605
  const { animationData, isLoading, hasError } = useLottieData(data.src);
2940
- const effectiveFrame = (0, import_react20.useMemo)(() => {
4606
+ const effectiveFrame = (0, import_react27.useMemo)(() => {
2941
4607
  const playbackRate = data.playbackRate || 1;
2942
4608
  const direction = data.direction || "forward";
2943
4609
  if (direction === "reverse") {
@@ -2945,12 +4611,12 @@ var Atom6 = ({ data, id }) => {
2945
4611
  }
2946
4612
  return frame * playbackRate;
2947
4613
  }, [frame, data.playbackRate, data.direction]);
2948
- const enhancedStyle = (0, import_react20.useMemo)(() => ({
4614
+ const enhancedStyle = (0, import_react27.useMemo)(() => ({
2949
4615
  ...data.style,
2950
4616
  ...overrideStyles
2951
4617
  }), [data.style, overrideStyles]);
2952
4618
  if (isLoading) {
2953
- return /* @__PURE__ */ import_react20.default.createElement(
4619
+ return /* @__PURE__ */ import_react27.default.createElement(
2954
4620
  "div",
2955
4621
  {
2956
4622
  className: data.className,
@@ -2966,7 +4632,7 @@ var Atom6 = ({ data, id }) => {
2966
4632
  }
2967
4633
  if (hasError || !animationData) {
2968
4634
  console.warn(`LottieAtom: Failed to render animation from ${data.src}`);
2969
- return /* @__PURE__ */ import_react20.default.createElement(
4635
+ return /* @__PURE__ */ import_react27.default.createElement(
2970
4636
  "div",
2971
4637
  {
2972
4638
  className: data.className,
@@ -2986,58 +4652,93 @@ var Atom6 = ({ data, id }) => {
2986
4652
  "\u26A0\uFE0F Lottie Error"
2987
4653
  );
2988
4654
  }
2989
- return /* @__PURE__ */ import_react20.default.createElement(
4655
+ return /* @__PURE__ */ import_react27.default.createElement(
2990
4656
  import_lottie.Lottie,
2991
4657
  {
2992
- animationData,
2993
- style: enhancedStyle,
2994
- className: data.className
4658
+ animationData,
4659
+ style: enhancedStyle,
4660
+ className: data.className
4661
+ }
4662
+ );
4663
+ };
4664
+ var config16 = {
4665
+ displayName: "LottieAtom",
4666
+ type: "atom",
4667
+ isInnerSequence: false
4668
+ };
4669
+
4670
+ // src/components/atoms/HTMLBlockAtom.tsx
4671
+ var import_react28 = __toESM(require("react"));
4672
+ var Atom8 = ({ id, data }) => {
4673
+ const overrideStyles = useAnimatedStyles(id);
4674
+ const combinedStyle = {
4675
+ ...data.style,
4676
+ ...overrideStyles
4677
+ };
4678
+ return /* @__PURE__ */ import_react28.default.createElement(
4679
+ "div",
4680
+ {
4681
+ className: data.className,
4682
+ style: combinedStyle,
4683
+ dangerouslySetInnerHTML: { __html: data.html }
2995
4684
  }
2996
4685
  );
2997
4686
  };
2998
- var config14 = {
2999
- displayName: "LottieAtom",
4687
+ var config17 = {
4688
+ displayName: "HTMLBlockAtom",
3000
4689
  type: "atom",
3001
4690
  isInnerSequence: false
3002
4691
  };
3003
4692
 
3004
4693
  // src/components/atoms/index.ts
3005
4694
  registerComponent(
3006
- config9.displayName,
3007
- Atom,
3008
- "atom",
3009
- config9
3010
- );
3011
- registerComponent(
3012
- config10.displayName,
4695
+ config11.displayName,
3013
4696
  Atom2,
3014
4697
  "atom",
3015
- config10
4698
+ config11
3016
4699
  );
3017
- registerComponent(config11.displayName, Atom3, "atom", config11);
3018
4700
  registerComponent(
3019
4701
  config12.displayName,
3020
- Atom4,
4702
+ Atom3,
3021
4703
  "atom",
3022
4704
  config12
3023
4705
  );
4706
+ registerComponent(config13.displayName, Atom4, "atom", config13);
3024
4707
  registerComponent(
3025
- config13.displayName,
4708
+ config14.displayName,
3026
4709
  Atom5,
3027
4710
  "atom",
3028
- config13
4711
+ config14
3029
4712
  );
3030
4713
  registerComponent(
3031
- config14.displayName,
4714
+ config15.displayName,
3032
4715
  Atom6,
3033
4716
  "atom",
3034
- config14
4717
+ config15
4718
+ );
4719
+ registerComponent(
4720
+ config16.displayName,
4721
+ Atom7,
4722
+ "atom",
4723
+ config16
4724
+ );
4725
+ registerComponent(
4726
+ config9.displayName,
4727
+ Atom,
4728
+ "atom",
4729
+ config9
4730
+ );
4731
+ registerComponent(
4732
+ config17.displayName,
4733
+ Atom8,
4734
+ "atom",
4735
+ config17
3035
4736
  );
3036
4737
 
3037
4738
  // src/hooks/useComponentRegistry.ts
3038
- var import_react21 = require("react");
4739
+ var import_react29 = require("react");
3039
4740
  var useComponentRegistry = () => {
3040
- return (0, import_react21.useMemo)(() => {
4741
+ return (0, import_react29.useMemo)(() => {
3041
4742
  return {
3042
4743
  registerComponent: componentRegistry.registerComponent.bind(componentRegistry),
3043
4744
  registerPackage: componentRegistry.registerPackage.bind(componentRegistry),
@@ -3048,13 +4749,13 @@ var useComponentRegistry = () => {
3048
4749
  };
3049
4750
 
3050
4751
  // src/hooks/useBoundaryCalculation.ts
3051
- var import_react22 = require("react");
4752
+ var import_react30 = require("react");
3052
4753
  var useBoundaryCalculation = ({
3053
4754
  parentBoundaries,
3054
4755
  constraints,
3055
4756
  layout
3056
4757
  }) => {
3057
- return (0, import_react22.useMemo)(() => {
4758
+ return (0, import_react30.useMemo)(() => {
3058
4759
  const { x, y, width, height } = parentBoundaries;
3059
4760
  const calculatedX = typeof constraints.x === "number" ? constraints.x : x;
3060
4761
  const calculatedY = typeof constraints.y === "number" ? constraints.y : y;
@@ -3071,16 +4772,16 @@ var useBoundaryCalculation = ({
3071
4772
  };
3072
4773
 
3073
4774
  // src/hooks/buildTransitionHook.ts
3074
- var import_react24 = require("react");
4775
+ var import_react32 = require("react");
3075
4776
 
3076
4777
  // src/core/types/transition.types.ts
3077
- var import_react23 = require("react");
3078
- var LayoutContext = (0, import_react23.createContext)(null);
4778
+ var import_react31 = require("react");
4779
+ var LayoutContext = (0, import_react31.createContext)(null);
3079
4780
 
3080
4781
  // src/hooks/buildTransitionHook.ts
3081
4782
  function buildLayoutHook(schema, defaultValue) {
3082
4783
  return () => {
3083
- const context = (0, import_react24.useContext)(LayoutContext);
4784
+ const context = (0, import_react32.useContext)(LayoutContext);
3084
4785
  if (!context) {
3085
4786
  return defaultValue;
3086
4787
  }
@@ -3165,16 +4866,16 @@ var needsProxying = (url) => {
3165
4866
 
3166
4867
  // src/templates/rings/NextjsLogo.tsx
3167
4868
  var import_paths = require("@remotion/paths");
3168
- var import_react26 = __toESM(require("react"));
3169
- var import_remotion18 = require("remotion");
4869
+ var import_react34 = __toESM(require("react"));
4870
+ var import_remotion23 = require("remotion");
3170
4871
 
3171
4872
  // src/templates/rings/RippleOutLayout.tsx
3172
- var import_react25 = __toESM(require("react"));
3173
- var import_remotion17 = require("remotion");
3174
- var import_zod5 = require("zod");
3175
- var RippleOutTransitionSchema = import_zod5.z.object({
3176
- progress: import_zod5.z.number().min(0).max(1),
3177
- logoOut: import_zod5.z.number().min(0).max(1)
4873
+ var import_react33 = __toESM(require("react"));
4874
+ var import_remotion22 = require("remotion");
4875
+ var import_zod10 = require("zod");
4876
+ var RippleOutTransitionSchema = import_zod10.z.object({
4877
+ progress: import_zod10.z.number().min(0).max(1),
4878
+ logoOut: import_zod10.z.number().min(0).max(1)
3178
4879
  });
3179
4880
  var defaultRippleOutData = {
3180
4881
  progress: 0,
@@ -3192,10 +4893,10 @@ var RippleOutLayout = ({ data, context, children }) => {
3192
4893
  transitionStart,
3193
4894
  transitionDuration
3194
4895
  } = data || { transitionStart: 2, transitionDuration: 1 };
3195
- const frame = (0, import_remotion17.useCurrentFrame)();
3196
- const { fps } = (0, import_remotion17.useVideoConfig)();
4896
+ const frame = (0, import_remotion22.useCurrentFrame)();
4897
+ const { fps } = (0, import_remotion22.useVideoConfig)();
3197
4898
  const { hierarchy } = useRenderContext();
3198
- import_react25.default.useEffect(() => {
4899
+ import_react33.default.useEffect(() => {
3199
4900
  loadGoogleFont("Inter", {
3200
4901
  subsets: ["latin"],
3201
4902
  weights: ["400", "700"]
@@ -3203,7 +4904,7 @@ var RippleOutLayout = ({ data, context, children }) => {
3203
4904
  }, []);
3204
4905
  const transitionStartFrame = transitionStart * fps;
3205
4906
  const transitionDurationFrames = transitionDuration * fps;
3206
- const logoOut = (0, import_remotion17.spring)({
4907
+ const logoOut = (0, import_remotion22.spring)({
3207
4908
  fps,
3208
4909
  frame,
3209
4910
  config: {
@@ -3216,14 +4917,14 @@ var RippleOutLayout = ({ data, context, children }) => {
3216
4917
  progress: logoOut,
3217
4918
  logoOut
3218
4919
  };
3219
- const childrenArray = import_react25.default.Children.toArray(children).filter(
3220
- (child) => import_react25.default.isValidElement(child)
4920
+ const childrenArray = import_react33.default.Children.toArray(children).filter(
4921
+ (child) => import_react33.default.isValidElement(child)
3221
4922
  );
3222
4923
  const [from, to] = childrenArray;
3223
- return /* @__PURE__ */ import_react25.default.createElement(LayoutContext.Provider, { value: transitionData }, /* @__PURE__ */ import_react25.default.createElement(import_remotion17.AbsoluteFill, { style: {
4924
+ return /* @__PURE__ */ import_react33.default.createElement(LayoutContext.Provider, { value: transitionData }, /* @__PURE__ */ import_react33.default.createElement(import_remotion22.AbsoluteFill, { style: {
3224
4925
  ...container,
3225
4926
  ...context?.boundaries
3226
- } }, /* @__PURE__ */ import_react25.default.createElement(import_remotion17.Sequence, { name: from.props.componentId + " - " + from.props.id, from: 0, durationInFrames: transitionStartFrame + transitionDurationFrames }, from), /* @__PURE__ */ import_react25.default.createElement(import_remotion17.Sequence, { name: to.props.componentId + " - " + to.props.id, from: transitionStartFrame + transitionDurationFrames / 2 }, to)));
4927
+ } }, /* @__PURE__ */ import_react33.default.createElement(import_remotion22.Sequence, { name: from.props.componentId + " - " + from.props.id, from: 0, durationInFrames: transitionStartFrame + transitionDurationFrames }, from), /* @__PURE__ */ import_react33.default.createElement(import_remotion22.Sequence, { name: to.props.componentId + " - " + to.props.id, from: transitionStartFrame + transitionDurationFrames / 2 }, to)));
3227
4928
  };
3228
4929
  var rippleOutLayoutConfig = {
3229
4930
  displayName: "RippleOutLayout",
@@ -3239,23 +4940,23 @@ var nStroke = "M149.508 157.52L69.142 54H54V125.97H66.1136V69.3836L139.999 164.8
3239
4940
  var NextjsLogo = () => {
3240
4941
  const { logoOut } = useRippleOutLayout();
3241
4942
  const outProgress = logoOut;
3242
- const { fps } = (0, import_remotion18.useVideoConfig)();
3243
- const frame = (0, import_remotion18.useCurrentFrame)();
3244
- const evolve1 = (0, import_remotion18.spring)({
4943
+ const { fps } = (0, import_remotion23.useVideoConfig)();
4944
+ const frame = (0, import_remotion23.useCurrentFrame)();
4945
+ const evolve1 = (0, import_remotion23.spring)({
3245
4946
  fps,
3246
4947
  frame,
3247
4948
  config: {
3248
4949
  damping: 200
3249
4950
  }
3250
4951
  });
3251
- const evolve2 = (0, import_remotion18.spring)({
4952
+ const evolve2 = (0, import_remotion23.spring)({
3252
4953
  fps,
3253
4954
  frame: frame - 15,
3254
4955
  config: {
3255
4956
  damping: 200
3256
4957
  }
3257
4958
  });
3258
- const evolve3 = (0, import_remotion18.spring)({
4959
+ const evolve3 = (0, import_remotion23.spring)({
3259
4960
  fps,
3260
4961
  frame: frame - 30,
3261
4962
  config: {
@@ -3264,7 +4965,7 @@ var NextjsLogo = () => {
3264
4965
  },
3265
4966
  durationInFrames: 30
3266
4967
  });
3267
- const style = (0, import_react26.useMemo)(() => {
4968
+ const style = (0, import_react34.useMemo)(() => {
3268
4969
  return {
3269
4970
  height: 140,
3270
4971
  borderRadius: 70,
@@ -3277,10 +4978,10 @@ var NextjsLogo = () => {
3277
4978
  const evolution1 = (0, import_paths.evolvePath)(evolve1, firstPath);
3278
4979
  const evolution2 = (0, import_paths.evolvePath)(evolve2, secondPath);
3279
4980
  const evolution3 = (0, import_paths.evolvePath)(
3280
- (0, import_remotion18.interpolate)(evolve3, [0, 1], [0, 0.7]),
4981
+ (0, import_remotion23.interpolate)(evolve3, [0, 1], [0, 0.7]),
3281
4982
  thirdPath
3282
4983
  );
3283
- return /* @__PURE__ */ import_react26.default.createElement("svg", { style, fill: "none", viewBox: "0 0 180 180" }, /* @__PURE__ */ import_react26.default.createElement("mask", { height: "180", id: "mask", style: mask, width: "180", x: "0", y: "0" }, /* @__PURE__ */ import_react26.default.createElement("circle", { cx: "90", cy: "90", fill: "black", r: "90" })), /* @__PURE__ */ import_react26.default.createElement("mask", { id: "n-mask", style: mask }, /* @__PURE__ */ import_react26.default.createElement("path", { d: nStroke, fill: "black" })), /* @__PURE__ */ import_react26.default.createElement("g", { mask: "url(#mask)" }, /* @__PURE__ */ import_react26.default.createElement("circle", { cx: "90", cy: "90", fill: "black", r: "90" }), /* @__PURE__ */ import_react26.default.createElement("g", { stroke: "url(#gradient0)", mask: "url(#n-mask)" }, /* @__PURE__ */ import_react26.default.createElement(
4984
+ return /* @__PURE__ */ import_react34.default.createElement("svg", { style, fill: "none", viewBox: "0 0 180 180" }, /* @__PURE__ */ import_react34.default.createElement("mask", { height: "180", id: "mask", style: mask, width: "180", x: "0", y: "0" }, /* @__PURE__ */ import_react34.default.createElement("circle", { cx: "90", cy: "90", fill: "black", r: "90" })), /* @__PURE__ */ import_react34.default.createElement("mask", { id: "n-mask", style: mask }, /* @__PURE__ */ import_react34.default.createElement("path", { d: nStroke, fill: "black" })), /* @__PURE__ */ import_react34.default.createElement("g", { mask: "url(#mask)" }, /* @__PURE__ */ import_react34.default.createElement("circle", { cx: "90", cy: "90", fill: "black", r: "90" }), /* @__PURE__ */ import_react34.default.createElement("g", { stroke: "url(#gradient0)", mask: "url(#n-mask)" }, /* @__PURE__ */ import_react34.default.createElement(
3284
4985
  "path",
3285
4986
  {
3286
4987
  strokeWidth: "12.1136",
@@ -3288,7 +4989,7 @@ var NextjsLogo = () => {
3288
4989
  strokeDasharray: evolution1.strokeDasharray,
3289
4990
  strokeDashoffset: evolution1.strokeDashoffset
3290
4991
  }
3291
- ), /* @__PURE__ */ import_react26.default.createElement(
4992
+ ), /* @__PURE__ */ import_react34.default.createElement(
3292
4993
  "path",
3293
4994
  {
3294
4995
  strokeWidth: 12.1136,
@@ -3296,7 +4997,7 @@ var NextjsLogo = () => {
3296
4997
  strokeDasharray: evolution2.strokeDasharray,
3297
4998
  strokeDashoffset: evolution2.strokeDashoffset
3298
4999
  }
3299
- )), /* @__PURE__ */ import_react26.default.createElement(
5000
+ )), /* @__PURE__ */ import_react34.default.createElement(
3300
5001
  "path",
3301
5002
  {
3302
5003
  stroke: "url(#gradient1)",
@@ -3305,7 +5006,7 @@ var NextjsLogo = () => {
3305
5006
  strokeDashoffset: evolution3.strokeDashoffset,
3306
5007
  strokeWidth: "12"
3307
5008
  }
3308
- )), /* @__PURE__ */ import_react26.default.createElement("defs", null, /* @__PURE__ */ import_react26.default.createElement(
5009
+ )), /* @__PURE__ */ import_react34.default.createElement("defs", null, /* @__PURE__ */ import_react34.default.createElement(
3309
5010
  "linearGradient",
3310
5011
  {
3311
5012
  gradientUnits: "userSpaceOnUse",
@@ -3315,9 +5016,9 @@ var NextjsLogo = () => {
3315
5016
  y1: "116.5",
3316
5017
  y2: "160.5"
3317
5018
  },
3318
- /* @__PURE__ */ import_react26.default.createElement("stop", { stopColor: "white" }),
3319
- /* @__PURE__ */ import_react26.default.createElement("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })
3320
- ), /* @__PURE__ */ import_react26.default.createElement(
5019
+ /* @__PURE__ */ import_react34.default.createElement("stop", { stopColor: "white" }),
5020
+ /* @__PURE__ */ import_react34.default.createElement("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })
5021
+ ), /* @__PURE__ */ import_react34.default.createElement(
3321
5022
  "linearGradient",
3322
5023
  {
3323
5024
  gradientUnits: "userSpaceOnUse",
@@ -3327,8 +5028,8 @@ var NextjsLogo = () => {
3327
5028
  y1: "54",
3328
5029
  y2: "106.875"
3329
5030
  },
3330
- /* @__PURE__ */ import_react26.default.createElement("stop", { stopColor: "white" }),
3331
- /* @__PURE__ */ import_react26.default.createElement("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })
5031
+ /* @__PURE__ */ import_react34.default.createElement("stop", { stopColor: "white" }),
5032
+ /* @__PURE__ */ import_react34.default.createElement("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })
3332
5033
  )));
3333
5034
  };
3334
5035
  var nextjsLogoConfig = {
@@ -3338,22 +5039,22 @@ var nextjsLogoConfig = {
3338
5039
  };
3339
5040
 
3340
5041
  // src/templates/rings/Rings.tsx
3341
- var import_react27 = __toESM(require("react"));
3342
- var import_remotion19 = require("remotion");
5042
+ var import_react35 = __toESM(require("react"));
5043
+ var import_remotion24 = require("remotion");
3343
5044
  var RadialGradient = ({ radius, color }) => {
3344
5045
  const height = radius * 2;
3345
5046
  const width = radius * 2;
3346
5047
  return (
3347
5048
  // @ts-ignore
3348
- /* @__PURE__ */ import_react27.default.createElement(
3349
- import_remotion19.AbsoluteFill,
5049
+ /* @__PURE__ */ import_react35.default.createElement(
5050
+ import_remotion24.AbsoluteFill,
3350
5051
  {
3351
5052
  style: {
3352
5053
  justifyContent: "center",
3353
5054
  alignItems: "center"
3354
5055
  }
3355
5056
  },
3356
- /* @__PURE__ */ import_react27.default.createElement(
5057
+ /* @__PURE__ */ import_react35.default.createElement(
3357
5058
  "div",
3358
5059
  {
3359
5060
  style: {
@@ -3373,11 +5074,11 @@ var Rings = ({ context, data }) => {
3373
5074
  const { logoOut } = useRippleOutLayout();
3374
5075
  const outProgress = logoOut;
3375
5076
  const scale = 1 / (1 - outProgress);
3376
- const { height } = (0, import_remotion19.useVideoConfig)();
5077
+ const { height } = (0, import_remotion24.useVideoConfig)();
3377
5078
  return (
3378
5079
  // @ts-ignore
3379
- /* @__PURE__ */ import_react27.default.createElement(
3380
- import_remotion19.AbsoluteFill,
5080
+ /* @__PURE__ */ import_react35.default.createElement(
5081
+ import_remotion24.AbsoluteFill,
3381
5082
  {
3382
5083
  style: {
3383
5084
  transform: `scale(${scale})`,
@@ -3385,12 +5086,12 @@ var Rings = ({ context, data }) => {
3385
5086
  }
3386
5087
  },
3387
5088
  new Array(5).fill(true).map((_, i) => {
3388
- return /* @__PURE__ */ import_react27.default.createElement(
5089
+ return /* @__PURE__ */ import_react35.default.createElement(
3389
5090
  RadialGradient,
3390
5091
  {
3391
5092
  key: i,
3392
5093
  radius: height * 0.3 * i,
3393
- color: (0, import_remotion19.interpolateColors)(i, [0, 4], ["#fff", "#fff"])
5094
+ color: (0, import_remotion24.interpolateColors)(i, [0, 4], ["#fff", "#fff"])
3394
5095
  }
3395
5096
  );
3396
5097
  }).reverse()
@@ -3404,8 +5105,8 @@ var ringsConfig = {
3404
5105
  };
3405
5106
 
3406
5107
  // src/templates/rings/TextFade.tsx
3407
- var import_react28 = __toESM(require("react"));
3408
- var import_remotion20 = require("remotion");
5108
+ var import_react36 = __toESM(require("react"));
5109
+ var import_remotion25 = require("remotion");
3409
5110
  var TextFade = (props) => {
3410
5111
  const { children, context, data } = props;
3411
5112
  const { animation } = data || {
@@ -3413,9 +5114,9 @@ var TextFade = (props) => {
3413
5114
  duration: 1
3414
5115
  }
3415
5116
  };
3416
- const { fps } = (0, import_remotion20.useVideoConfig)();
3417
- const frame = (0, import_remotion20.useCurrentFrame)();
3418
- const progress = (0, import_remotion20.spring)({
5117
+ const { fps } = (0, import_remotion25.useVideoConfig)();
5118
+ const frame = (0, import_remotion25.useCurrentFrame)();
5119
+ const progress = (0, import_remotion25.spring)({
3419
5120
  fps,
3420
5121
  frame,
3421
5122
  config: {
@@ -3423,10 +5124,10 @@ var TextFade = (props) => {
3423
5124
  },
3424
5125
  durationInFrames: animation.duration * fps
3425
5126
  });
3426
- const rightStop = (0, import_remotion20.interpolate)(progress, [0, 1], [200, 0]);
5127
+ const rightStop = (0, import_remotion25.interpolate)(progress, [0, 1], [200, 0]);
3427
5128
  const leftStop = Math.max(0, rightStop - 60);
3428
5129
  const maskImage = `linear-gradient(-45deg, transparent ${leftStop}%, black ${rightStop}%)`;
3429
- const container2 = (0, import_react28.useMemo)(() => {
5130
+ const container2 = (0, import_react36.useMemo)(() => {
3430
5131
  return {
3431
5132
  width: "100%",
3432
5133
  height: "100%",
@@ -3434,7 +5135,7 @@ var TextFade = (props) => {
3434
5135
  alignItems: "center"
3435
5136
  };
3436
5137
  }, []);
3437
- const content = (0, import_react28.useMemo)(() => {
5138
+ const content = (0, import_react36.useMemo)(() => {
3438
5139
  return {
3439
5140
  ...context?.boundaries,
3440
5141
  maskImage,
@@ -3446,7 +5147,7 @@ var TextFade = (props) => {
3446
5147
  }, [maskImage]);
3447
5148
  return (
3448
5149
  // @ts-ignore
3449
- /* @__PURE__ */ import_react28.default.createElement(import_remotion20.AbsoluteFill, { style: container2 }, /* @__PURE__ */ import_react28.default.createElement("div", { style: content }, children))
5150
+ /* @__PURE__ */ import_react36.default.createElement(import_remotion25.AbsoluteFill, { style: container2 }, /* @__PURE__ */ import_react36.default.createElement("div", { style: content }, children))
3450
5151
  );
3451
5152
  };
3452
5153
  var textFadeConfig = {
@@ -3477,259 +5178,41 @@ registerComponent(
3477
5178
  );
3478
5179
 
3479
5180
  // src/templates/waveform/components/WaveformCircle.tsx
3480
- var import_react31 = __toESM(require("react"));
3481
-
3482
- // src/templates/waveform/Waveform.tsx
3483
- var import_react30 = __toESM(require("react"));
3484
- var import_remotion22 = require("remotion");
3485
-
3486
- // src/templates/waveform/hooks/useWaveformData.ts
3487
- var import_react29 = require("react");
3488
- var import_media_utils = require("@remotion/media-utils");
3489
- var import_remotion21 = require("remotion");
3490
- var isValidPowerOfTwo = (num) => {
3491
- return num > 0 && (num & num - 1) === 0;
3492
- };
3493
- var getClosestPowerOfTwo = (num) => {
3494
- if (num <= 0) return 32;
3495
- let power = 1;
3496
- while (power < num) {
3497
- power *= 2;
3498
- }
3499
- const lower = power / 2;
3500
- const upper = power;
3501
- return Math.abs(num - lower) < Math.abs(num - upper) ? lower : upper;
3502
- };
3503
- var useWaveformData = (config15) => {
3504
- const {
3505
- audioSrc,
3506
- numberOfSamples,
3507
- windowInSeconds,
3508
- dataOffsetInSeconds = 0,
3509
- normalize = false,
3510
- frame,
3511
- fps,
3512
- posterize,
3513
- includeFrequencyData = false,
3514
- minDb = -100,
3515
- maxDb = -30
3516
- } = config15;
3517
- const { root } = useComposition();
3518
- const validatedNumberOfSamples = (0, import_react29.useMemo)(() => {
3519
- if (!isValidPowerOfTwo(numberOfSamples)) {
3520
- console.warn(
3521
- `numberOfSamples must be a power of 2. Adjusting ${numberOfSamples} to ${getClosestPowerOfTwo(numberOfSamples)}`
3522
- );
3523
- return getClosestPowerOfTwo(numberOfSamples);
3524
- }
3525
- return numberOfSamples;
3526
- }, [numberOfSamples]);
3527
- const { source, audioStartsFrom } = (0, import_react29.useMemo)(() => {
3528
- if (audioSrc.startsWith("http")) {
3529
- return { source: audioSrc, audioStartsFrom: void 0 };
3530
- }
3531
- if (audioSrc.startsWith("ref:")) {
3532
- const matchingComponent = findMatchingComponents(root, [
3533
- audioSrc.replace("ref:", "")
3534
- ]);
3535
- if (matchingComponent.length > 0) {
3536
- const firstMatchingComponent = matchingComponent[0];
3537
- if (firstMatchingComponent.componentId === "AudioAtom") {
3538
- return {
3539
- source: firstMatchingComponent.data.src,
3540
- audioStartsFrom: firstMatchingComponent.data?.startFrom ?? void 0
3541
- };
3542
- }
3543
- if (firstMatchingComponent.type === "layout" || firstMatchingComponent.type === "scene") {
3544
- const audioComponents = findMatchingComponentsByQuery(
3545
- firstMatchingComponent.childrenData,
3546
- { componentId: "AudioAtom" }
3547
- );
3548
- if (audioComponents.length > 0) {
3549
- return {
3550
- source: audioComponents[0].data.src,
3551
- audioStartsFrom: audioComponents[0].data?.startFrom ?? void 0
3552
- };
3553
- }
3554
- }
3555
- }
3556
- }
3557
- return { source: (0, import_remotion21.staticFile)(audioSrc), audioStartsFrom: void 0 };
3558
- }, [audioSrc]);
3559
- const audioData = (0, import_media_utils.useAudioData)(source);
3560
- const adjustedFrame = (0, import_react29.useMemo)(() => {
3561
- if (posterize && posterize > 1) {
3562
- return Math.round(frame / posterize) * posterize;
3563
- }
3564
- let offset = 0;
3565
- if (audioStartsFrom && audioStartsFrom != 0) {
3566
- offset += Math.round(audioStartsFrom * fps);
3567
- }
3568
- if (dataOffsetInSeconds != 0) {
3569
- offset += Math.round(dataOffsetInSeconds * fps);
3570
- }
3571
- return frame + offset;
3572
- }, [frame, posterize, dataOffsetInSeconds, audioStartsFrom]);
3573
- const waveformData = (0, import_react29.useMemo)(() => {
3574
- if (!audioData) return null;
3575
- try {
3576
- const waveform = (0, import_media_utils.visualizeAudioWaveform)({
3577
- fps,
3578
- frame: adjustedFrame,
3579
- audioData,
3580
- numberOfSamples: validatedNumberOfSamples,
3581
- windowInSeconds,
3582
- dataOffsetInSeconds: 0,
3583
- normalize
3584
- });
3585
- return waveform;
3586
- } catch (error2) {
3587
- console.error("Error generating waveform:", error2);
3588
- return null;
3589
- }
3590
- }, [
3591
- audioData,
3592
- adjustedFrame,
3593
- fps,
3594
- validatedNumberOfSamples,
3595
- windowInSeconds,
3596
- dataOffsetInSeconds,
3597
- normalize
3598
- ]);
3599
- const {
3600
- frequencyData,
3601
- amplitudes,
3602
- bass,
3603
- mid,
3604
- treble,
3605
- bassValues,
3606
- midValues,
3607
- trebleValues
3608
- } = (0, import_react29.useMemo)(() => {
3609
- if (!audioData || !includeFrequencyData) {
3610
- return {
3611
- frequencyData: null,
3612
- amplitudes: null,
3613
- bass: null,
3614
- mid: null,
3615
- treble: null,
3616
- bassValues: null,
3617
- midValues: null,
3618
- trebleValues: null
3619
- };
3620
- }
3621
- try {
3622
- const frequencyData2 = (0, import_media_utils.visualizeAudio)({
3623
- fps,
3624
- frame: adjustedFrame,
3625
- audioData,
3626
- numberOfSamples: validatedNumberOfSamples
3627
- });
3628
- const { sampleRate } = audioData;
3629
- const bassValues2 = [];
3630
- const midValues2 = [];
3631
- const trebleValues2 = [];
3632
- for (let i = 0; i < frequencyData2.length; i++) {
3633
- const freq = i * sampleRate / (2 * frequencyData2.length);
3634
- const value = frequencyData2[i];
3635
- if (freq >= 0 && freq < 250) {
3636
- bassValues2.push(value * 2.5);
3637
- } else if (freq >= 250 && freq < 4e3) {
3638
- midValues2.push(value * 3);
3639
- midValues2.push(value * 4.5);
3640
- midValues2.push(value * 5);
3641
- } else if (freq >= 4e3 && freq < sampleRate / 2) {
3642
- trebleValues2.push(value * 30);
3643
- }
3644
- }
3645
- const getAverage = (arr) => arr.length > 0 ? arr.reduce((a, b) => a + b, 0) / arr.length : 0;
3646
- const bass2 = getAverage(bassValues2);
3647
- const mid2 = getAverage(midValues2);
3648
- const treble2 = getAverage(trebleValues2);
3649
- const amplitudes2 = frequencyData2.map((value) => {
3650
- const db = 20 * Math.log10(value);
3651
- const scaled = (db - minDb) / (maxDb - minDb);
3652
- return Math.max(0, Math.min(1, scaled));
3653
- });
3654
- return {
3655
- frequencyData: frequencyData2,
3656
- amplitudes: amplitudes2,
3657
- bass: bass2,
3658
- mid: mid2,
3659
- treble: treble2,
3660
- bassValues: bassValues2,
3661
- midValues: midValues2,
3662
- trebleValues: trebleValues2.reverse()
3663
- };
3664
- } catch (error2) {
3665
- console.error("Error generating frequency data:", error2);
3666
- return {
3667
- frequencyData: null,
3668
- amplitudes: null,
3669
- bass: null,
3670
- mid: null,
3671
- treble: null
3672
- };
3673
- }
3674
- }, [
3675
- audioData,
3676
- includeFrequencyData,
3677
- adjustedFrame,
3678
- fps,
3679
- validatedNumberOfSamples,
3680
- windowInSeconds,
3681
- dataOffsetInSeconds,
3682
- minDb,
3683
- maxDb
3684
- ]);
3685
- const isLoading = !audioData;
3686
- const error = audioData === null && !isLoading ? "Failed to load audio data" : null;
3687
- return {
3688
- waveformData,
3689
- frequencyData,
3690
- amplitudes,
3691
- audioData,
3692
- isLoading,
3693
- error,
3694
- bass,
3695
- bassValues,
3696
- mid,
3697
- midValues,
3698
- treble,
3699
- trebleValues
3700
- };
3701
- };
5181
+ var import_react38 = __toESM(require("react"));
3702
5182
 
3703
5183
  // src/templates/waveform/Waveform.tsx
3704
- var WaveformContext = (0, import_react30.createContext)(null);
5184
+ var import_react37 = __toESM(require("react"));
5185
+ var import_remotion26 = require("remotion");
5186
+ var WaveformContext = (0, import_react37.createContext)(null);
3705
5187
  var useWaveformContext = () => {
3706
- const context = (0, import_react30.useContext)(WaveformContext);
5188
+ const context = (0, import_react37.useContext)(WaveformContext);
3707
5189
  if (!context) {
3708
5190
  throw new Error("useWaveformContext must be used within a Waveform component");
3709
5191
  }
3710
5192
  return context;
3711
5193
  };
3712
5194
  var Waveform = ({
3713
- config: config15,
5195
+ config: config18,
3714
5196
  children,
3715
5197
  className = "",
3716
5198
  style = {}
3717
5199
  }) => {
3718
- const frame = (0, import_remotion22.useCurrentFrame)();
3719
- const { width: videoWidth, height: videoHeight, fps } = (0, import_remotion22.useVideoConfig)();
5200
+ const frame = (0, import_remotion26.useCurrentFrame)();
5201
+ const { width: videoWidth, height: videoHeight, fps } = (0, import_remotion26.useVideoConfig)();
3720
5202
  const { waveformData, frequencyData, amplitudes, audioData, bass, mid, treble, bassValues, midValues, trebleValues } = useWaveformData({
3721
- audioSrc: config15.audioSrc,
3722
- numberOfSamples: config15.numberOfSamples || 128,
3723
- windowInSeconds: config15.windowInSeconds || 1 / fps,
3724
- dataOffsetInSeconds: config15.dataOffsetInSeconds || 0,
3725
- normalize: config15.normalize || false,
5203
+ audioSrc: config18.audioSrc,
5204
+ numberOfSamples: config18.numberOfSamples || 128,
5205
+ windowInSeconds: config18.windowInSeconds || 1 / fps,
5206
+ dataOffsetInSeconds: config18.dataOffsetInSeconds || 0,
5207
+ normalize: config18.normalize || false,
3726
5208
  frame,
3727
5209
  fps,
3728
- posterize: config15.posterize,
3729
- includeFrequencyData: config15.useFrequencyData || false
5210
+ posterize: config18.posterize,
5211
+ includeFrequencyData: config18.useFrequencyData || false,
5212
+ smoothNormalisation: config18.smoothNormalisation
3730
5213
  });
3731
- const width = config15.width || videoWidth;
3732
- const height = config15.height || videoHeight;
5214
+ const width = config18.width || videoWidth;
5215
+ const height = config18.height || videoHeight;
3733
5216
  const contextValue = {
3734
5217
  waveformData,
3735
5218
  frequencyData,
@@ -3737,7 +5220,7 @@ var Waveform = ({
3737
5220
  audioData,
3738
5221
  frame,
3739
5222
  fps,
3740
- config: config15,
5223
+ config: config18,
3741
5224
  width,
3742
5225
  height,
3743
5226
  bass,
@@ -3747,7 +5230,7 @@ var Waveform = ({
3747
5230
  midValues,
3748
5231
  trebleValues
3749
5232
  };
3750
- return /* @__PURE__ */ import_react30.default.createElement(WaveformContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react30.default.createElement(
5233
+ return /* @__PURE__ */ import_react37.default.createElement(WaveformContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react37.default.createElement(
3751
5234
  "div",
3752
5235
  {
3753
5236
  className: `relative ${className}`,
@@ -3755,7 +5238,7 @@ var Waveform = ({
3755
5238
  width,
3756
5239
  height,
3757
5240
  position: "relative",
3758
- backgroundColor: config15.backgroundColor || "transparent",
5241
+ backgroundColor: config18.backgroundColor || "transparent",
3759
5242
  ...style
3760
5243
  }
3761
5244
  },
@@ -3766,7 +5249,7 @@ var Waveform = ({
3766
5249
  // src/templates/waveform/components/WaveformCircle.tsx
3767
5250
  var WaveformCircle = ({ data }) => {
3768
5251
  const {
3769
- config: config15,
5252
+ config: config18,
3770
5253
  className = "",
3771
5254
  style = {},
3772
5255
  strokeColor = "#FF6B6B",
@@ -3783,7 +5266,7 @@ var WaveformCircle = ({ data }) => {
3783
5266
  gradientStartColor,
3784
5267
  gradientEndColor
3785
5268
  } = data;
3786
- return /* @__PURE__ */ import_react31.default.createElement(Waveform, { config: config15, className, style }, /* @__PURE__ */ import_react31.default.createElement(
5269
+ return /* @__PURE__ */ import_react38.default.createElement(Waveform, { config: config18, className, style }, /* @__PURE__ */ import_react38.default.createElement(
3787
5270
  WaveformCircleContent,
3788
5271
  {
3789
5272
  strokeColor,
@@ -3822,7 +5305,7 @@ var WaveformCircleContent = ({
3822
5305
  const circleCenterX = width * (centerX || 50) / 100;
3823
5306
  const circleCenterY = height * (centerY || 50) / 100;
3824
5307
  const rotation = frame * (rotationSpeed || 0) % 360;
3825
- const circularPath = (0, import_react31.useMemo)(() => {
5308
+ const circularPath = (0, import_react38.useMemo)(() => {
3826
5309
  if (!waveformData) return "";
3827
5310
  const totalAngle = (endAngle || 360) - (startAngle || 0);
3828
5311
  const angleStep = totalAngle / waveformData.length;
@@ -3844,11 +5327,11 @@ var WaveformCircleContent = ({
3844
5327
  return path;
3845
5328
  }, [waveformData, circleRadius, circleCenterX, circleCenterY, startAngle, endAngle, rotation, amplitude]);
3846
5329
  if (!waveformData) {
3847
- return /* @__PURE__ */ import_react31.default.createElement("div", { className: "flex items-center justify-center w-full h-full text-gray-500" }, "Loading circular waveform...");
5330
+ return /* @__PURE__ */ import_react38.default.createElement("div", { className: "flex items-center justify-center w-full h-full text-gray-500" }, "Loading circular waveform...");
3848
5331
  }
3849
5332
  const gradientId = "circle-waveform-gradient";
3850
5333
  const hasGradient = gradientStartColor && gradientEndColor;
3851
- return /* @__PURE__ */ import_react31.default.createElement(
5334
+ return /* @__PURE__ */ import_react38.default.createElement(
3852
5335
  "svg",
3853
5336
  {
3854
5337
  width,
@@ -3856,8 +5339,8 @@ var WaveformCircleContent = ({
3856
5339
  className: "absolute inset-0",
3857
5340
  style: { pointerEvents: "none" }
3858
5341
  },
3859
- hasGradient && /* @__PURE__ */ import_react31.default.createElement("defs", null, /* @__PURE__ */ import_react31.default.createElement("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "0%" }, /* @__PURE__ */ import_react31.default.createElement("stop", { offset: "0%", stopColor: gradientStartColor }), /* @__PURE__ */ import_react31.default.createElement("stop", { offset: "100%", stopColor: gradientEndColor }))),
3860
- /* @__PURE__ */ import_react31.default.createElement(
5342
+ hasGradient && /* @__PURE__ */ import_react38.default.createElement("defs", null, /* @__PURE__ */ import_react38.default.createElement("linearGradient", { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "0%" }, /* @__PURE__ */ import_react38.default.createElement("stop", { offset: "0%", stopColor: gradientStartColor }), /* @__PURE__ */ import_react38.default.createElement("stop", { offset: "100%", stopColor: gradientEndColor }))),
5343
+ /* @__PURE__ */ import_react38.default.createElement(
3861
5344
  "path",
3862
5345
  {
3863
5346
  d: circularPath,
@@ -3873,10 +5356,10 @@ var WaveformCircleContent = ({
3873
5356
  };
3874
5357
 
3875
5358
  // src/templates/waveform/components/WaveformHistogram.tsx
3876
- var import_react32 = __toESM(require("react"));
5359
+ var import_react39 = __toESM(require("react"));
3877
5360
  var WaveformHistogram = ({ data }) => {
3878
5361
  const {
3879
- config: config15,
5362
+ config: config18,
3880
5363
  className = "",
3881
5364
  style = {},
3882
5365
  barColor = "#FF6B6B",
@@ -3895,7 +5378,7 @@ var WaveformHistogram = ({ data }) => {
3895
5378
  gradientStyle = "normal",
3896
5379
  waveDirection = "right-to-left"
3897
5380
  } = data;
3898
- return /* @__PURE__ */ import_react32.default.createElement(Waveform, { config: config15, className, style }, /* @__PURE__ */ import_react32.default.createElement(
5381
+ return /* @__PURE__ */ import_react39.default.createElement(Waveform, { config: config18, className, style }, /* @__PURE__ */ import_react39.default.createElement(
3899
5382
  WaveformHistogramContent,
3900
5383
  {
3901
5384
  barColor,
@@ -3936,7 +5419,7 @@ var WaveformHistogramContent = ({
3936
5419
  const { waveformData, frequencyData, amplitudes, width, height } = useWaveformContext();
3937
5420
  const dataToUse = amplitudes || waveformData;
3938
5421
  if (!dataToUse) {
3939
- return /* @__PURE__ */ import_react32.default.createElement("div", { className: "flex items-center justify-center w-full h-full text-gray-500" }, "Loading histogram...");
5422
+ return /* @__PURE__ */ import_react39.default.createElement("div", { className: "flex items-center justify-center w-full h-full text-gray-500" }, "Loading histogram...");
3940
5423
  }
3941
5424
  let directedData = waveDirection === "left-to-right" ? dataToUse.slice(1).reverse() : dataToUse;
3942
5425
  const frequencies = horizontalSymmetry ? [...directedData, ...directedData.slice(1).reverse()] : Array(multiplier).fill(directedData).flat();
@@ -3960,7 +5443,7 @@ var WaveformHistogramContent = ({
3960
5443
  },
3961
5444
  opacity: gradientStyle === "mirrored" && !growUpwards ? 0.25 : 1
3962
5445
  };
3963
- return /* @__PURE__ */ import_react32.default.createElement("div", { style: containerStyle2 }, frequencies.map((value, index) => /* @__PURE__ */ import_react32.default.createElement(
5446
+ return /* @__PURE__ */ import_react39.default.createElement("div", { style: containerStyle2 }, frequencies.map((value, index) => /* @__PURE__ */ import_react39.default.createElement(
3964
5447
  "div",
3965
5448
  {
3966
5449
  key: index,
@@ -3992,7 +5475,7 @@ var WaveformHistogramContent = ({
3992
5475
  width: "100%",
3993
5476
  left: 0
3994
5477
  };
3995
- return /* @__PURE__ */ import_react32.default.createElement(import_react32.default.Fragment, null, /* @__PURE__ */ import_react32.default.createElement("div", { style: topHalfStyle }, /* @__PURE__ */ import_react32.default.createElement(Bars, { growUpwards: true })), /* @__PURE__ */ import_react32.default.createElement("div", { style: bottomHalfStyle }, /* @__PURE__ */ import_react32.default.createElement(Bars, { growUpwards: false })));
5478
+ return /* @__PURE__ */ import_react39.default.createElement(import_react39.default.Fragment, null, /* @__PURE__ */ import_react39.default.createElement("div", { style: topHalfStyle }, /* @__PURE__ */ import_react39.default.createElement(Bars, { growUpwards: true })), /* @__PURE__ */ import_react39.default.createElement("div", { style: bottomHalfStyle }, /* @__PURE__ */ import_react39.default.createElement(Bars, { growUpwards: false })));
3996
5479
  }
3997
5480
  const containerStyle = {
3998
5481
  width: "100%",
@@ -4001,14 +5484,14 @@ var WaveformHistogramContent = ({
4001
5484
  height: `${height / 2}px`,
4002
5485
  left: 0
4003
5486
  };
4004
- return /* @__PURE__ */ import_react32.default.createElement("div", { style: containerStyle }, /* @__PURE__ */ import_react32.default.createElement(Bars, { growUpwards: true }));
5487
+ return /* @__PURE__ */ import_react39.default.createElement("div", { style: containerStyle }, /* @__PURE__ */ import_react39.default.createElement(Bars, { growUpwards: true }));
4005
5488
  };
4006
5489
 
4007
5490
  // src/templates/waveform/components/WaveformHistogramRanged.tsx
4008
- var import_react33 = __toESM(require("react"));
5491
+ var import_react40 = __toESM(require("react"));
4009
5492
  var WaveformHistogramRanged = ({ data }) => {
4010
5493
  const {
4011
- config: config15,
5494
+ config: config18,
4012
5495
  className = "",
4013
5496
  style = {},
4014
5497
  barColor = "#FF6B6B",
@@ -4032,7 +5515,7 @@ var WaveformHistogramRanged = ({ data }) => {
4032
5515
  horizontalSymmetry = false,
4033
5516
  waveDirection = "right-to-left"
4034
5517
  } = data;
4035
- return /* @__PURE__ */ import_react33.default.createElement(Waveform, { config: config15, className, style }, /* @__PURE__ */ import_react33.default.createElement(
5518
+ return /* @__PURE__ */ import_react40.default.createElement(Waveform, { config: config18, className, style }, /* @__PURE__ */ import_react40.default.createElement(
4036
5519
  WaveformHistogramRangedContent,
4037
5520
  {
4038
5521
  barColor,
@@ -4082,7 +5565,7 @@ var WaveformHistogramRangedContent = ({
4082
5565
  }) => {
4083
5566
  const { amplitudes, bassValues, midValues, trebleValues, height } = useWaveformContext();
4084
5567
  if (!amplitudes || !bassValues || !midValues || !trebleValues) {
4085
- return /* @__PURE__ */ import_react33.default.createElement("div", { className: "flex items-center justify-center w-full h-full text-gray-500" }, "Loading frequency data...");
5568
+ return /* @__PURE__ */ import_react40.default.createElement("div", { className: "flex items-center justify-center w-full h-full text-gray-500" }, "Loading frequency data...");
4086
5569
  }
4087
5570
  const bassFrequencies = bassValues;
4088
5571
  const midFrequencies = midValues;
@@ -4106,12 +5589,12 @@ var WaveformHistogramRangedContent = ({
4106
5589
  },
4107
5590
  opacity: gradientStyle === "mirrored" && !growUpwards ? 0.25 : 1
4108
5591
  };
4109
- return /* @__PURE__ */ import_react33.default.createElement("div", { style: containerStyle2 }, unifiedWaveform.map((value, index) => {
5592
+ return /* @__PURE__ */ import_react40.default.createElement("div", { style: containerStyle2 }, unifiedWaveform.map((value, index) => {
4110
5593
  const rangeName = index === 0 ? "Bass" : index === 1 ? "Mid" : "Treble";
4111
5594
  const styleGradientProp = gradientStartColor && gradientEndColor ? {
4112
5595
  background: `linear-gradient(${gradientDirection === "horizontal" ? gradientStyle === "mirrored" ? "to right" : growUpwards ? "to right" : "to left" : gradientStyle === "normal" ? growUpwards ? "to top" : "to bottom" : "to bottom"}, ${gradientStartColor}, ${gradientEndColor})`
4113
5596
  } : { backgroundColor: barColor };
4114
- return /* @__PURE__ */ import_react33.default.createElement(
5597
+ return /* @__PURE__ */ import_react40.default.createElement(
4115
5598
  "div",
4116
5599
  {
4117
5600
  key: index,
@@ -4129,7 +5612,7 @@ var WaveformHistogramRangedContent = ({
4129
5612
  },
4130
5613
  title: `${rangeName}: ${(value * 100).toFixed(1)}%`
4131
5614
  },
4132
- rangeLabels && /* @__PURE__ */ import_react33.default.createElement("div", { style: {
5615
+ rangeLabels && /* @__PURE__ */ import_react40.default.createElement("div", { style: {
4133
5616
  position: "absolute",
4134
5617
  bottom: growUpwards ? "-20px" : "auto",
4135
5618
  top: growUpwards ? "auto" : "-20px",
@@ -4157,7 +5640,7 @@ var WaveformHistogramRangedContent = ({
4157
5640
  width: "100%",
4158
5641
  left: 0
4159
5642
  };
4160
- return /* @__PURE__ */ import_react33.default.createElement(import_react33.default.Fragment, null, /* @__PURE__ */ import_react33.default.createElement("div", { style: topHalfStyle }, /* @__PURE__ */ import_react33.default.createElement(Bars, { growUpwards: true })), /* @__PURE__ */ import_react33.default.createElement("div", { style: bottomHalfStyle }, /* @__PURE__ */ import_react33.default.createElement(Bars, { growUpwards: false })));
5643
+ return /* @__PURE__ */ import_react40.default.createElement(import_react40.default.Fragment, null, /* @__PURE__ */ import_react40.default.createElement("div", { style: topHalfStyle }, /* @__PURE__ */ import_react40.default.createElement(Bars, { growUpwards: true })), /* @__PURE__ */ import_react40.default.createElement("div", { style: bottomHalfStyle }, /* @__PURE__ */ import_react40.default.createElement(Bars, { growUpwards: false })));
4161
5644
  }
4162
5645
  const containerStyle = {
4163
5646
  width: "100%",
@@ -4166,13 +5649,13 @@ var WaveformHistogramRangedContent = ({
4166
5649
  height: `${height / 2}px`,
4167
5650
  left: 0
4168
5651
  };
4169
- return /* @__PURE__ */ import_react33.default.createElement("div", { style: containerStyle }, /* @__PURE__ */ import_react33.default.createElement(Bars, { growUpwards: true }));
5652
+ return /* @__PURE__ */ import_react40.default.createElement("div", { style: containerStyle }, /* @__PURE__ */ import_react40.default.createElement(Bars, { growUpwards: true }));
4170
5653
  };
4171
5654
 
4172
5655
  // src/templates/waveform/components/WaveformLine.tsx
4173
- var import_react34 = __toESM(require("react"));
5656
+ var import_react41 = __toESM(require("react"));
4174
5657
  var import_media_utils2 = require("@remotion/media-utils");
4175
- var import_remotion23 = require("remotion");
5658
+ var import_remotion27 = require("remotion");
4176
5659
  var detectBeat = (frequencyData, amplitudes, threshold = 0.7, bpm, frame = 0, fps = 30) => {
4177
5660
  if (!frequencyData || !amplitudes || frequencyData.length === 0) return false;
4178
5661
  if (bpm) {
@@ -4204,7 +5687,7 @@ var easingFunctions = {
4204
5687
  };
4205
5688
  var WaveformLine = ({ data }) => {
4206
5689
  const {
4207
- config: config15,
5690
+ config: config18,
4208
5691
  className = "",
4209
5692
  style = {},
4210
5693
  strokeColor = "#FF6B6B",
@@ -4232,7 +5715,7 @@ var WaveformLine = ({ data }) => {
4232
5715
  pulseColor = "#FFD700",
4233
5716
  pulseScale = 1.2
4234
5717
  } = data;
4235
- return /* @__PURE__ */ import_react34.default.createElement(Waveform, { config: config15, className, style }, /* @__PURE__ */ import_react34.default.createElement(
5718
+ return /* @__PURE__ */ import_react41.default.createElement(Waveform, { config: config18, className, style }, /* @__PURE__ */ import_react41.default.createElement(
4236
5719
  WaveformLineContent,
4237
5720
  {
4238
5721
  strokeColor,
@@ -4288,14 +5771,14 @@ var WaveformLineContent = ({
4288
5771
  pulseColor,
4289
5772
  pulseScale
4290
5773
  }) => {
4291
- const { waveformData, frequencyData, amplitudes, width, height, config: config15, frame, fps } = useWaveformContext();
4292
- const currentFrame = (0, import_remotion23.useCurrentFrame)();
4293
- const videoConfig = (0, import_remotion23.useVideoConfig)();
4294
- const isBeat = (0, import_react34.useMemo)(() => {
5774
+ const { waveformData, frequencyData, amplitudes, width, height, config: config18, frame, fps } = useWaveformContext();
5775
+ const currentFrame = (0, import_remotion27.useCurrentFrame)();
5776
+ const videoConfig = (0, import_remotion27.useVideoConfig)();
5777
+ const isBeat = (0, import_react41.useMemo)(() => {
4295
5778
  if (!beatSync || !frequencyData || !amplitudes) return false;
4296
5779
  return detectBeat(frequencyData, amplitudes, beatThreshold, bpm, currentFrame, fps);
4297
5780
  }, [beatSync, frequencyData, amplitudes, beatThreshold, bpm, currentFrame, fps]);
4298
- const beatProgress = (0, import_react34.useMemo)(() => {
5781
+ const beatProgress = (0, import_react41.useMemo)(() => {
4299
5782
  if (!isBeat || !beatAnimationDuration) return 0;
4300
5783
  const beatStartFrame = Math.floor(currentFrame / beatAnimationDuration) * beatAnimationDuration;
4301
5784
  const progress = (currentFrame - beatStartFrame) / beatAnimationDuration;
@@ -4305,19 +5788,19 @@ var WaveformLineContent = ({
4305
5788
  }
4306
5789
  return clampedProgress;
4307
5790
  }, [isBeat, currentFrame, beatAnimationDuration, smoothAnimation]);
4308
- const currentBeatMultiplier = (0, import_react34.useMemo)(() => {
5791
+ const currentBeatMultiplier = (0, import_react41.useMemo)(() => {
4309
5792
  if (!beatSync || !isBeat || !beatAmplitudeMultiplier || !amplitudeCurve) return 1;
4310
5793
  const easing = easingFunctions[amplitudeCurve];
4311
5794
  const easedProgress = easing(beatProgress);
4312
5795
  return 1 + (beatAmplitudeMultiplier - 1) * (1 - easedProgress);
4313
5796
  }, [beatSync, isBeat, beatProgress, beatAmplitudeMultiplier, amplitudeCurve]);
4314
- const smoothFactor = (0, import_react34.useMemo)(() => {
5797
+ const smoothFactor = (0, import_react41.useMemo)(() => {
4315
5798
  if (!beatSync) {
4316
5799
  return 0.3;
4317
5800
  }
4318
5801
  return smoothAnimation ? 0.7 : 1;
4319
5802
  }, [beatSync, smoothAnimation]);
4320
- const waveformPaths = (0, import_react34.useMemo)(() => {
5803
+ const waveformPaths = (0, import_react41.useMemo)(() => {
4321
5804
  if (!waveformData) return [];
4322
5805
  const paths = [];
4323
5806
  const segments = waveSegments || 1;
@@ -4333,8 +5816,8 @@ var WaveformLineContent = ({
4333
5816
  const points = waveformData.map((y, index) => {
4334
5817
  const progress = index / (waveformData.length - 1);
4335
5818
  const x = segmentStart + progress * segmentDataWidth + offset;
4336
- let animatedAmplitude = y * (config15.amplitude || 1) * currentBeatMultiplier * speed;
4337
- const baseAmplitude = y * (config15.amplitude || 1) * speed;
5819
+ let animatedAmplitude = y * (config18.amplitude || 1) * currentBeatMultiplier * speed;
5820
+ const baseAmplitude = y * (config18.amplitude || 1) * speed;
4338
5821
  const beatAmplitude = animatedAmplitude - baseAmplitude;
4339
5822
  animatedAmplitude = baseAmplitude + beatAmplitude * smoothFactor;
4340
5823
  const yPos = waveDirection === "horizontal" ? animatedAmplitude * height / 2 + height / 2 : animatedAmplitude * width / 2 + width / 2;
@@ -4344,11 +5827,11 @@ var WaveformLineContent = ({
4344
5827
  paths.push({ path, segmentIndex: i });
4345
5828
  }
4346
5829
  return paths;
4347
- }, [waveformData, width, height, config15.amplitude, currentBeatMultiplier, animationSpeed, waveSegments, waveSpacing, waveOffset, waveDirection, smoothFactor]);
5830
+ }, [waveformData, width, height, config18.amplitude, currentBeatMultiplier, animationSpeed, waveSegments, waveSpacing, waveOffset, waveDirection, smoothFactor]);
4348
5831
  if (!waveformData) {
4349
- return /* @__PURE__ */ import_react34.default.createElement("div", { className: "flex items-center justify-center w-full h-full text-gray-500" }, "Loading waveform...");
5832
+ return /* @__PURE__ */ import_react41.default.createElement("div", { className: "flex items-center justify-center w-full h-full text-gray-500" }, "Loading waveform...");
4350
5833
  }
4351
- return /* @__PURE__ */ import_react34.default.createElement(
5834
+ return /* @__PURE__ */ import_react41.default.createElement(
4352
5835
  "svg",
4353
5836
  {
4354
5837
  width,
@@ -4356,7 +5839,7 @@ var WaveformLineContent = ({
4356
5839
  className: "absolute inset-0",
4357
5840
  style: { pointerEvents: "none" }
4358
5841
  },
4359
- centerLine && /* @__PURE__ */ import_react34.default.createElement(
5842
+ centerLine && /* @__PURE__ */ import_react41.default.createElement(
4360
5843
  "line",
4361
5844
  {
4362
5845
  x1: waveDirection === "horizontal" ? 0 : width / 2,
@@ -4368,7 +5851,7 @@ var WaveformLineContent = ({
4368
5851
  opacity: 0.3
4369
5852
  }
4370
5853
  ),
4371
- waveformPaths.map(({ path, segmentIndex }) => /* @__PURE__ */ import_react34.default.createElement("g", { key: segmentIndex }, pulseOnBeat && isBeat && /* @__PURE__ */ import_react34.default.createElement(
5854
+ waveformPaths.map(({ path, segmentIndex }) => /* @__PURE__ */ import_react41.default.createElement("g", { key: segmentIndex }, pulseOnBeat && isBeat && /* @__PURE__ */ import_react41.default.createElement(
4372
5855
  "path",
4373
5856
  {
4374
5857
  d: path,
@@ -4379,7 +5862,7 @@ var WaveformLineContent = ({
4379
5862
  fill: "none",
4380
5863
  opacity: (opacity || 1) * (1 - beatProgress)
4381
5864
  }
4382
- ), /* @__PURE__ */ import_react34.default.createElement(
5865
+ ), /* @__PURE__ */ import_react41.default.createElement(
4383
5866
  "path",
4384
5867
  {
4385
5868
  d: path,
@@ -4440,19 +5923,19 @@ registerComponent("WaveformCircle", WaveformCircle, "atom", {
4440
5923
 
4441
5924
  // src/components/Composition.tsx
4442
5925
  var import_player = require("@remotion/player");
4443
- var import_react35 = __toESM(require("react"));
4444
- var import_remotion24 = require("remotion");
4445
- var import_zod6 = __toESM(require("zod"));
4446
- var CompositionLayout = ({ childrenData, style, config: config15 }) => {
4447
- return /* @__PURE__ */ import_react35.default.createElement(
5926
+ var import_react42 = __toESM(require("react"));
5927
+ var import_remotion28 = require("remotion");
5928
+ var import_zod11 = __toESM(require("zod"));
5929
+ var CompositionLayout = ({ childrenData, style, config: config18 }) => {
5930
+ return /* @__PURE__ */ import_react42.default.createElement(
4448
5931
  CompositionProvider,
4449
5932
  {
4450
5933
  value: {
4451
5934
  root: childrenData,
4452
- duration: config15.duration
5935
+ duration: config18.duration
4453
5936
  }
4454
5937
  },
4455
- /* @__PURE__ */ import_react35.default.createElement(import_remotion24.AbsoluteFill, { style }, childrenData?.map((component) => /* @__PURE__ */ import_react35.default.createElement(
5938
+ /* @__PURE__ */ import_react42.default.createElement(import_remotion28.AbsoluteFill, { style }, childrenData?.map((component) => /* @__PURE__ */ import_react42.default.createElement(
4456
5939
  ComponentRenderer,
4457
5940
  {
4458
5941
  key: component.id,
@@ -4492,26 +5975,26 @@ var calculateCompositionLayoutMetadata = async ({ props, defaultProps, abortSign
4492
5975
  var Composition = ({
4493
5976
  id,
4494
5977
  childrenData,
4495
- config: config15,
5978
+ config: config18,
4496
5979
  style
4497
5980
  }) => {
4498
- return /* @__PURE__ */ import_react35.default.createElement(
4499
- import_remotion24.Composition,
5981
+ return /* @__PURE__ */ import_react42.default.createElement(
5982
+ import_remotion28.Composition,
4500
5983
  {
4501
5984
  id,
4502
5985
  component: CompositionLayout,
4503
- durationInFrames: Math.round(config15.duration * config15.fps),
4504
- fps: config15.fps,
4505
- width: config15.width ?? 1080,
4506
- height: config15.height ?? 1920,
4507
- defaultProps: { childrenData, style, config: config15 },
5986
+ durationInFrames: Math.round(config18.duration * config18.fps),
5987
+ fps: config18.fps,
5988
+ width: config18.width ?? 1080,
5989
+ height: config18.height ?? 1920,
5990
+ defaultProps: { childrenData, style, config: config18 },
4508
5991
  calculateMetadata: calculateCompositionLayoutMetadata,
4509
- schema: import_zod6.default.object({})
5992
+ schema: import_zod11.default.object({})
4510
5993
  }
4511
5994
  );
4512
5995
  };
4513
5996
  var Player = (props) => {
4514
- return /* @__PURE__ */ import_react35.default.createElement(
5997
+ return /* @__PURE__ */ import_react42.default.createElement(
4515
5998
  import_player.Player,
4516
5999
  {
4517
6000
  component: CompositionLayout,
@@ -4531,12 +6014,20 @@ var Player = (props) => {
4531
6014
  BaseLayoutConfig,
4532
6015
  BlurEffect,
4533
6016
  BlurEffectConfig,
6017
+ CanvasAtom,
6018
+ CanvasAtomConfig,
6019
+ CanvasContentAwareReveal,
6020
+ CanvasGlitchEffect,
6021
+ CanvasParticleEffect,
6022
+ CanvasWipeReveal,
4534
6023
  ComponentRenderer,
4535
6024
  Composition,
4536
6025
  CompositionLayout,
4537
6026
  CompositionProvider,
4538
6027
  Frame,
4539
6028
  GenericEffectPresets,
6029
+ HTMLBlockAtom,
6030
+ HTMLBlockAtomConfig,
4540
6031
  ImageAtom,
4541
6032
  ImageAtomConfig,
4542
6033
  LoopEffect,
@@ -4565,6 +6056,8 @@ var Player = (props) => {
4565
6056
  VideoAtomConfig,
4566
6057
  Waveform,
4567
6058
  WaveformCircle,
6059
+ WaveformEffect,
6060
+ WaveformEffectConfig,
4568
6061
  WaveformHistogram,
4569
6062
  WaveformHistogramRanged,
4570
6063
  WaveformLine,