@microfox/remotion 1.1.0 → 1.2.1

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 ADDED
@@ -0,0 +1,4626 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/index.ts
30
+ var index_exports = {};
31
+ __export(index_exports, {
32
+ AudioAtom: () => Atom5,
33
+ AudioAtomConfig: () => config13,
34
+ BaseLayout: () => Layout,
35
+ BaseLayoutConfig: () => config8,
36
+ BlurEffect: () => BlurEffect,
37
+ BlurEffectConfig: () => config2,
38
+ ComponentRenderer: () => ComponentRenderer,
39
+ Composition: () => Composition,
40
+ CompositionLayout: () => CompositionLayout,
41
+ CompositionProvider: () => CompositionProvider,
42
+ Frame: () => Frame,
43
+ GenericEffectPresets: () => GenericEffectPresets,
44
+ ImageAtom: () => Atom2,
45
+ ImageAtomConfig: () => config10,
46
+ LoopEffect: () => LoopEffect,
47
+ LoopEffectConfig: () => config3,
48
+ LottieAtom: () => Atom6,
49
+ LottieAtomConfig: () => config14,
50
+ NextjsLogo: () => NextjsLogo,
51
+ PanEffect: () => PanEffect,
52
+ PanEffectConfig: () => config4,
53
+ Player: () => Player,
54
+ Rings: () => Rings,
55
+ RippleOutLayout: () => RippleOutLayout,
56
+ SceneFrame: () => SceneFrame,
57
+ ShakeEffect: () => ShakeEffect,
58
+ ShakeEffectConfig: () => config6,
59
+ ShapeAtom: () => Atom,
60
+ ShapeAtomConfig: () => config9,
61
+ StretchEffect: () => StretchEffect,
62
+ StretchEffectConfig: () => config7,
63
+ TextAtom: () => Atom3,
64
+ TextAtomConfig: () => config11,
65
+ TextFade: () => TextFade,
66
+ UniversalEffect: () => UniversalEffect,
67
+ UniversalEffectProvider: () => UniversalEffectProvider,
68
+ VideoAtom: () => Atom4,
69
+ VideoAtomConfig: () => config12,
70
+ Waveform: () => Waveform,
71
+ WaveformCircle: () => WaveformCircle,
72
+ WaveformHistogram: () => WaveformHistogram,
73
+ WaveformHistogramRanged: () => WaveformHistogramRanged,
74
+ WaveformLine: () => WaveformLine,
75
+ WaveformPresets: () => WaveformPresets,
76
+ ZoomEffect: () => ZoomEffect,
77
+ ZoomEffectConfig: () => config5,
78
+ buildLayoutHook: () => buildLayoutHook,
79
+ calculateCircularPosition: () => calculateCircularPosition,
80
+ calculateComponentDuration: () => calculateComponentDuration,
81
+ calculateCompositionLayoutMetadata: () => calculateCompositionLayoutMetadata,
82
+ calculateDuration: () => calculateDuration,
83
+ calculateGridPosition: () => calculateGridPosition,
84
+ calculateHierarchy: () => calculateHierarchy,
85
+ calculateTimingWithInheritance: () => calculateTimingWithInheritance,
86
+ clearFontCache: () => clearFontCache,
87
+ componentRegistry: () => componentRegistry,
88
+ createImageDataWithProxy: () => createImageDataWithProxy,
89
+ createImageProxyUrl: () => createImageProxyUrl,
90
+ createRootContext: () => createRootContext,
91
+ findComponentById: () => findComponentById,
92
+ findMatchingComponents: () => findMatchingComponents,
93
+ findMatchingComponentsByQuery: () => findMatchingComponentsByQuery,
94
+ findParentComponent: () => findParentComponent,
95
+ getComponent: () => getComponent,
96
+ getComponentConfig: () => getComponentConfig,
97
+ getComponentWithConfig: () => getComponentWithConfig,
98
+ getLoadedFontFamily: () => getLoadedFontFamily,
99
+ getLoadedFonts: () => getLoadedFonts,
100
+ getNormalizedFontName: () => getNormalizedFontName,
101
+ isFontAvailable: () => isFontAvailable,
102
+ isFontLoaded: () => isFontLoaded,
103
+ loadGoogleFont: () => loadGoogleFont,
104
+ loadMultipleFonts: () => loadMultipleFonts,
105
+ mergeContexts: () => mergeContexts,
106
+ needsProxying: () => needsProxying,
107
+ nextjsLogoConfig: () => nextjsLogoConfig,
108
+ preloadCommonFonts: () => preloadCommonFonts,
109
+ registerComponent: () => registerComponent,
110
+ registerEffect: () => registerEffect,
111
+ registerPackage: () => registerPackage,
112
+ ringsConfig: () => ringsConfig,
113
+ rippleOutLayoutConfig: () => rippleOutLayoutConfig,
114
+ setDurationsInContext: () => setDurationsInContext,
115
+ textFadeConfig: () => textFadeConfig,
116
+ useAnimatedStyles: () => useAnimatedStyles,
117
+ useBoundaryCalculation: () => useBoundaryCalculation,
118
+ useComponentRegistry: () => useComponentRegistry,
119
+ useComposition: () => useComposition,
120
+ useFont: () => useFont,
121
+ useFontLoader: () => useFontLoader,
122
+ useHasUniversalEffectProvider: () => useHasUniversalEffectProvider,
123
+ useRenderContext: () => useRenderContext,
124
+ useRippleOutLayout: () => useRippleOutLayout,
125
+ useUniversalEffect: () => useUniversalEffect,
126
+ useUniversalEffectOptional: () => useUniversalEffectOptional,
127
+ useWaveformContext: () => useWaveformContext,
128
+ useWaveformData: () => useWaveformData
129
+ });
130
+ module.exports = __toCommonJS(index_exports);
131
+
132
+ // src/core/registry/componentRegistry.ts
133
+ var ComponentRegistryManager = class {
134
+ constructor() {
135
+ this.registry = {};
136
+ this.packageRegistry = {};
137
+ }
138
+ registerComponent(name, component, type, config15 = { displayName: "" }, packageName) {
139
+ this.registry[name] = { component, config: config15 };
140
+ if (packageName) {
141
+ if (!this.packageRegistry[packageName]) {
142
+ this.packageRegistry[packageName] = {};
143
+ }
144
+ this.packageRegistry[packageName][name] = { component, config: config15 };
145
+ }
146
+ }
147
+ registerEffect(name, component, config15 = { displayName: "" }, packageName) {
148
+ this.registerComponent(
149
+ name?.includes("effect-") ? name : `effect-${name}`,
150
+ component,
151
+ "layout",
152
+ config15,
153
+ packageName
154
+ );
155
+ }
156
+ getComponent(name) {
157
+ return this.registry[name]?.component;
158
+ }
159
+ getComponentConfig(name) {
160
+ return this.registry[name]?.config;
161
+ }
162
+ getComponentWithConfig(name) {
163
+ return this.registry[name];
164
+ }
165
+ registerPackage(packageName, components) {
166
+ this.packageRegistry[packageName] = components;
167
+ Object.entries(components).forEach(([name, { component, config: config15 }]) => {
168
+ this.registry[`${packageName}:${name}`] = { component, config: config15 };
169
+ });
170
+ }
171
+ getPackageComponents(packageName) {
172
+ return this.packageRegistry[packageName];
173
+ }
174
+ getAllComponents() {
175
+ return { ...this.registry };
176
+ }
177
+ clear() {
178
+ this.registry = {};
179
+ this.packageRegistry = {};
180
+ }
181
+ };
182
+ var componentRegistry = new ComponentRegistryManager();
183
+ var registerComponent = (name, component, type, config15 = { displayName: "" }, packageName) => {
184
+ componentRegistry.registerComponent(
185
+ name,
186
+ component,
187
+ type,
188
+ config15,
189
+ packageName
190
+ );
191
+ };
192
+ var registerEffect = (name, component, config15 = { displayName: "" }, packageName) => {
193
+ componentRegistry.registerEffect(name, component, config15, packageName);
194
+ };
195
+ var registerPackage = (packageName, components) => {
196
+ componentRegistry.registerPackage(packageName, components);
197
+ };
198
+ var getComponent = (name) => componentRegistry.getComponent(name);
199
+ var getComponentConfig = (name) => componentRegistry.getComponentConfig(name);
200
+ var getComponentWithConfig = (name) => componentRegistry.getComponentWithConfig(name);
201
+
202
+ // src/core/context/CompositionContext.tsx
203
+ var import_react = __toESM(require("react"));
204
+ var CompositionContext = (0, import_react.createContext)(null);
205
+ var CompositionProvider = ({ children, value }) => {
206
+ return /* @__PURE__ */ import_react.default.createElement(CompositionContext.Provider, { value }, children);
207
+ };
208
+ var useComposition = () => {
209
+ const context = (0, import_react.useContext)(CompositionContext);
210
+ if (!context) {
211
+ throw new Error("useComposition must be used within a CompositionProvider");
212
+ }
213
+ return context;
214
+ };
215
+
216
+ // src/core/context/timing.ts
217
+ var import_mediabunny = require("mediabunny");
218
+ var findMatchingComponents = (childrenData, targetIds) => {
219
+ const matches = [];
220
+ const searchRecursively = (components) => {
221
+ for (const component of components) {
222
+ if (targetIds.includes(component.id)) {
223
+ matches.push(component);
224
+ }
225
+ if (component.childrenData && component.childrenData.length > 0) {
226
+ searchRecursively(component.childrenData);
227
+ }
228
+ }
229
+ };
230
+ searchRecursively(childrenData);
231
+ return matches;
232
+ };
233
+ var findMatchingComponentsByQuery = (childrenData, query) => {
234
+ const matches = [];
235
+ const searchRecursively = (components) => {
236
+ for (const component of components) {
237
+ let matchesQuery = false;
238
+ if (query.type && component.type === query.type) {
239
+ matchesQuery = true;
240
+ }
241
+ if (query.componentId && component.componentId === query.componentId) {
242
+ matchesQuery = true;
243
+ }
244
+ if (query.type && query.componentId) {
245
+ matchesQuery = component.type === query.type && component.componentId === query.componentId;
246
+ }
247
+ if (matchesQuery) {
248
+ matches.push(component);
249
+ }
250
+ if (component.childrenData && component.childrenData.length > 0) {
251
+ searchRecursively(component.childrenData);
252
+ }
253
+ }
254
+ };
255
+ searchRecursively(childrenData);
256
+ return matches;
257
+ };
258
+ var calculateComponentDuration = async (component) => {
259
+ const src = component.data.src;
260
+ if (src.startsWith("http")) {
261
+ const audioInput = new import_mediabunny.Input({
262
+ formats: import_mediabunny.ALL_FORMATS,
263
+ source: new import_mediabunny.UrlSource(src)
264
+ });
265
+ const audioDuration = await audioInput.computeDuration();
266
+ let trimmedDuration = audioDuration;
267
+ if (component.data.startFrom || component.data.endAt) {
268
+ trimmedDuration = audioDuration - (component.data.startFrom || 0) - (component.data.endAt ? audioDuration - (component.data.endAt || 0) : 0);
269
+ }
270
+ const playbackRate = component.data.playbackRate || 1;
271
+ const effectiveDuration = trimmedDuration / playbackRate;
272
+ return effectiveDuration;
273
+ } else {
274
+ }
275
+ };
276
+ var calculateDuration = async (childrenData, config15) => {
277
+ let calculatedDuration = void 0;
278
+ const targetIds = Array.isArray(config15.fitDurationTo) ? config15.fitDurationTo : [config15.fitDurationTo];
279
+ const matchingComponents = findMatchingComponents(
280
+ childrenData || [],
281
+ targetIds
282
+ );
283
+ if (matchingComponents.length === 1) {
284
+ if (matchingComponents[0].type === "atom" && (matchingComponents[0].componentId === "AudioAtom" || matchingComponents[0].componentId === "VideoAtom")) {
285
+ calculatedDuration = await calculateComponentDuration(
286
+ matchingComponents[0]
287
+ );
288
+ }
289
+ if ((matchingComponents[0].type === "scene" || matchingComponents[0].type === "layout") && matchingComponents[0].context?.timing?.duration) {
290
+ calculatedDuration = matchingComponents[0].context.timing.duration;
291
+ }
292
+ }
293
+ return calculatedDuration;
294
+ };
295
+ var setDurationsInContext = async (root) => {
296
+ const iterateRecursively = async (components, onlyScene = false) => {
297
+ const updatedComponents = [];
298
+ for (const component of components) {
299
+ let updatedComponent = { ...component };
300
+ if (component.childrenData && component.childrenData.length > 0) {
301
+ updatedComponent.childrenData = await iterateRecursively(
302
+ component.childrenData,
303
+ onlyScene
304
+ );
305
+ }
306
+ if (updatedComponent.context?.timing?.fitDurationTo?.length > 0 && !onlyScene && updatedComponent.context?.timing?.fitDurationTo != updatedComponent.id && updatedComponent.context?.timing?.fitDurationTo != "this" && updatedComponent.context?.timing?.fitDurationTo != "fill") {
307
+ const duration = await calculateDuration(
308
+ updatedComponent.childrenData,
309
+ {
310
+ fitDurationTo: updatedComponent.context?.timing?.fitDurationTo
311
+ }
312
+ );
313
+ updatedComponent = {
314
+ ...updatedComponent,
315
+ context: {
316
+ ...updatedComponent.context,
317
+ timing: {
318
+ ...updatedComponent.context.timing,
319
+ duration
320
+ }
321
+ }
322
+ };
323
+ }
324
+ if ((updatedComponent.type === "scene" || updatedComponent.type === "layout") && onlyScene) {
325
+ let duration;
326
+ if (updatedComponent.context?.timing?.fitDurationTo && updatedComponent.context.timing.fitDurationTo !== updatedComponent.id && updatedComponent.context.timing.fitDurationTo !== "this") {
327
+ duration = await calculateDuration(updatedComponent.childrenData, {
328
+ fitDurationTo: updatedComponent.context.timing.fitDurationTo
329
+ });
330
+ } else if (!updatedComponent.context?.timing?.duration) {
331
+ duration = updatedComponent.childrenData.reduce(
332
+ (acc, child) => acc + (child.context?.timing?.duration ?? 0),
333
+ 0
334
+ ) ?? 10;
335
+ }
336
+ if (duration !== void 0) {
337
+ updatedComponent.context = {
338
+ ...updatedComponent.context || {},
339
+ timing: {
340
+ ...updatedComponent.context?.timing || {},
341
+ duration
342
+ }
343
+ };
344
+ }
345
+ }
346
+ if (updatedComponent.type === "atom" && !onlyScene) {
347
+ if (updatedComponent.componentId === "VideoAtom" || updatedComponent.componentId === "AudioAtom") {
348
+ const mediaDuration = await calculateComponentDuration(updatedComponent);
349
+ if (!updatedComponent.context?.timing?.fitDurationTo) {
350
+ updatedComponent.context = {
351
+ ...updatedComponent.context || {},
352
+ timing: {
353
+ ...updatedComponent.context?.timing || {},
354
+ duration: updatedComponent?.context?.timing?.duration || mediaDuration
355
+ }
356
+ };
357
+ updatedComponent.data = {
358
+ ...updatedComponent.data,
359
+ ...updatedComponent.data.loop ? { srcDuration: mediaDuration } : {}
360
+ };
361
+ } else if (updatedComponent.context?.timing?.fitDurationTo) {
362
+ updatedComponent.data = {
363
+ ...updatedComponent.data,
364
+ srcDuration: mediaDuration
365
+ };
366
+ }
367
+ }
368
+ }
369
+ updatedComponents.push(updatedComponent);
370
+ }
371
+ return updatedComponents;
372
+ };
373
+ let updatedChildrenData = await iterateRecursively(root.childrenData, false);
374
+ updatedChildrenData = await iterateRecursively(updatedChildrenData, true);
375
+ return {
376
+ ...root,
377
+ childrenData: updatedChildrenData
378
+ };
379
+ };
380
+
381
+ // src/components/base/ComponentRenderer.tsx
382
+ var import_react3 = __toESM(require("react"));
383
+ var import_remotion = require("remotion");
384
+
385
+ // src/core/utils/timing.ts
386
+ var calculateTiming = (type, context, videoConfig) => {
387
+ let newTiming;
388
+ if (type !== "atom" && context?.timing) {
389
+ const { start = 0, duration = 0 } = context.timing;
390
+ newTiming = {
391
+ startInFrames: Math.round(
392
+ context.timing?.startInFrames ? context.timing.startInFrames : type === "scene" ? start * videoConfig.fps : start * videoConfig.fps
393
+ ),
394
+ durationInFrames: Math.round(
395
+ context.timing?.durationInFrames ? context.timing.durationInFrames : type === "scene" ? duration * videoConfig.fps : duration * videoConfig.fps
396
+ ),
397
+ duration,
398
+ start
399
+ };
400
+ } else {
401
+ newTiming = {
402
+ startInFrames: context.timing?.startInFrames ? context.timing.startInFrames : context.timing?.start ? Math.round(videoConfig.fps * (context.timing.start || 0)) : 0,
403
+ durationInFrames: Math.round(
404
+ context.timing?.durationInFrames ? context.timing.durationInFrames : context.timing?.duration ? Math.round(videoConfig.fps * (context.timing.duration || 0)) : 0
405
+ ),
406
+ duration: context.timing?.duration,
407
+ start: context.timing?.start
408
+ };
409
+ }
410
+ return newTiming;
411
+ };
412
+
413
+ // src/core/utils/hierarchyUtils.ts
414
+ var findComponentById = (root, targetId) => {
415
+ if (!root) return null;
416
+ const search = (components) => {
417
+ for (const component of components) {
418
+ if (component.id === targetId) {
419
+ return component;
420
+ }
421
+ if (component.childrenData && component.childrenData.length > 0) {
422
+ const found = search(component.childrenData);
423
+ if (found) return found;
424
+ }
425
+ }
426
+ return null;
427
+ };
428
+ return search(root);
429
+ };
430
+ var findParentComponent = (root, targetId) => {
431
+ if (!root) return null;
432
+ const search = (components, parent) => {
433
+ for (const component of components) {
434
+ if (component.childrenData && component.childrenData.length > 0) {
435
+ const hasTargetChild = component.childrenData.some(
436
+ (child) => child.id === targetId
437
+ );
438
+ if (hasTargetChild) {
439
+ return component;
440
+ }
441
+ const found = search(component.childrenData, component);
442
+ if (found) return found;
443
+ }
444
+ }
445
+ return null;
446
+ };
447
+ return search(root, null);
448
+ };
449
+ var calculateHierarchy = (root, componentId, currentContext) => {
450
+ if (!root) {
451
+ return {
452
+ depth: (currentContext?.hierarchy?.depth || 0) + 1,
453
+ parentIds: [...currentContext?.hierarchy?.parentIds || [], componentId]
454
+ };
455
+ }
456
+ const parentIds = [];
457
+ let depth = 0;
458
+ const traverse = (components, currentDepth) => {
459
+ for (const component of components) {
460
+ if (component.id === componentId) {
461
+ depth = currentDepth;
462
+ return true;
463
+ }
464
+ if (component.childrenData && component.childrenData.length > 0) {
465
+ parentIds.push(component.id);
466
+ const found = traverse(component.childrenData, currentDepth + 1);
467
+ if (found) return true;
468
+ parentIds.pop();
469
+ }
470
+ }
471
+ return false;
472
+ };
473
+ traverse(root, 0);
474
+ return {
475
+ depth,
476
+ parentIds: [...parentIds]
477
+ };
478
+ };
479
+ var calculateTimingWithInheritance = (component, root, videoConfig) => {
480
+ const currentContext = component.context || {};
481
+ const baseTiming = calculateTiming(
482
+ component.type,
483
+ currentContext,
484
+ videoConfig
485
+ );
486
+ if (!baseTiming.durationInFrames || baseTiming.durationInFrames <= 0) {
487
+ const findParentWithTiming = (targetId) => {
488
+ const parent = findParentComponent(root, targetId);
489
+ if (!parent) return null;
490
+ const parentContext = parent.context || {};
491
+ const parentTiming = calculateTiming(
492
+ parent.type,
493
+ parentContext,
494
+ videoConfig
495
+ );
496
+ if (parentTiming.durationInFrames && parentTiming.durationInFrames > 0) {
497
+ return parentTiming;
498
+ }
499
+ return findParentWithTiming(parent.id);
500
+ };
501
+ const inheritedTiming = findParentWithTiming(component.id);
502
+ if (inheritedTiming) {
503
+ return {
504
+ ...baseTiming,
505
+ durationInFrames: inheritedTiming.durationInFrames ? inheritedTiming.durationInFrames : inheritedTiming.duration ? inheritedTiming.duration * videoConfig.fps : 0,
506
+ duration: inheritedTiming.duration
507
+ };
508
+ }
509
+ }
510
+ return baseTiming;
511
+ };
512
+
513
+ // src/components/base/EffectWrapper.tsx
514
+ var import_react2 = __toESM(require("react"));
515
+ var import_zod = require("zod");
516
+ var EffectWrapper = ({
517
+ effects,
518
+ children,
519
+ context
520
+ }) => {
521
+ if (!effects || effects.length === 0) {
522
+ return children;
523
+ }
524
+ let wrappedContent = children;
525
+ effects.forEach((effect, index) => {
526
+ const effectId = typeof effect === "string" ? `effect-${effect}` : `effect-${effect.componentId}`;
527
+ const EffectComponent = getComponent(effectId);
528
+ if (!EffectComponent) {
529
+ console.warn(`Effect component ${effectId} not found in registry`);
530
+ return;
531
+ }
532
+ const effectData = typeof effect === "string" ? {} : effect.data || {};
533
+ const effectContext = typeof effect === "string" ? context : effect.context || context;
534
+ const effectProps = {
535
+ id: typeof effect === "string" ? `effect-${(0, import_zod.nanoid)()}` : effect.id,
536
+ componentId: effectId,
537
+ type: "layout",
538
+ // Effects use the same rendering logic as layout
539
+ data: effectData,
540
+ context: effectContext,
541
+ children: wrappedContent
542
+ };
543
+ wrappedContent = /* @__PURE__ */ import_react2.default.createElement(EffectComponent, { ...effectProps });
544
+ });
545
+ return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, wrappedContent);
546
+ };
547
+
548
+ // src/components/base/ComponentRenderer.tsx
549
+ var RenderContext = (0, import_react3.createContext)(null);
550
+ var useRenderContext = () => {
551
+ const context = (0, import_react3.useContext)(RenderContext);
552
+ if (!context) {
553
+ throw new Error("useRenderContext must be used within a ComponentRenderer");
554
+ }
555
+ return context;
556
+ };
557
+ var ComponentRenderer = ({
558
+ id,
559
+ componentId,
560
+ type,
561
+ data,
562
+ childrenData,
563
+ context,
564
+ effects
565
+ }) => {
566
+ const videoConfig = (0, import_remotion.useVideoConfig)();
567
+ const { root } = useComposition();
568
+ const defaultContext = {
569
+ boundaries: {
570
+ left: 0,
571
+ top: 0,
572
+ width: videoConfig.width,
573
+ height: videoConfig.height,
574
+ zIndex: 0
575
+ },
576
+ timing: {
577
+ startInFrames: 0,
578
+ durationInFrames: videoConfig.durationInFrames
579
+ },
580
+ hierarchy: {
581
+ depth: 0,
582
+ parentIds: []
583
+ }
584
+ };
585
+ if (!context) {
586
+ context = {};
587
+ }
588
+ const newHierarchy = calculateHierarchy(root, id, context ?? defaultContext);
589
+ const componentData = {
590
+ id,
591
+ componentId,
592
+ type,
593
+ data,
594
+ childrenData,
595
+ context,
596
+ effects
597
+ };
598
+ let newTiming = calculateTimingWithInheritance(componentData, root, videoConfig);
599
+ const newContext = {
600
+ ...context,
601
+ boundaries: context?.boundaries,
602
+ hierarchy: newHierarchy,
603
+ timing: newTiming
604
+ };
605
+ const ComponentClass = getComponent(componentId);
606
+ if (type === "scene") {
607
+ return /* @__PURE__ */ import_react3.default.createElement(RenderContext.Provider, { value: newContext }, /* @__PURE__ */ import_react3.default.createElement(import_remotion.Series, null, childrenData?.map((child) => {
608
+ const childTiming = calculateTimingWithInheritance(child, root, videoConfig);
609
+ return /* @__PURE__ */ import_react3.default.createElement(
610
+ import_remotion.Series.Sequence,
611
+ {
612
+ key: child.id,
613
+ name: child.componentId + " - " + child.id,
614
+ offset: childTiming.startInFrames ?? 0,
615
+ durationInFrames: childTiming.durationInFrames ?? 0
616
+ },
617
+ child.effects && child.effects.length > 0 ? /* @__PURE__ */ import_react3.default.createElement(EffectWrapper, { effects: child.effects, context: newContext }, /* @__PURE__ */ import_react3.default.createElement(ComponentRenderer, { key: child.id, ...child })) : /* @__PURE__ */ import_react3.default.createElement(ComponentRenderer, { key: child.id, ...child })
618
+ );
619
+ })));
620
+ }
621
+ if (!ComponentClass) {
622
+ console.warn(`Component type ${id} not found in registry`);
623
+ return null;
624
+ }
625
+ const props = {
626
+ id,
627
+ componentId,
628
+ data,
629
+ context
630
+ };
631
+ if (type === "layout") {
632
+ const config15 = getComponentConfig(componentId);
633
+ const isInnerSequence = config15?.isInnerSequence;
634
+ if (isInnerSequence) {
635
+ 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
+ }
637
+ return /* @__PURE__ */ import_react3.default.createElement(RenderContext.Provider, { value: newContext }, /* @__PURE__ */ import_react3.default.createElement(import_remotion.Sequence, { layout: "none", name: componentId + " - " + id, from: newTiming.startInFrames, durationInFrames: newTiming.durationInFrames }, effects && effects.length > 0 ? /* @__PURE__ */ import_react3.default.createElement(EffectWrapper, { effects, context: newContext }, /* @__PURE__ */ import_react3.default.createElement(ComponentClass, { ...props }, childrenData?.map((child) => /* @__PURE__ */ import_react3.default.createElement(ComponentRenderer, { key: child.id, ...child })))) : /* @__PURE__ */ import_react3.default.createElement(ComponentClass, { ...props }, childrenData?.map((child) => /* @__PURE__ */ import_react3.default.createElement(ComponentRenderer, { key: child.id, ...child })))));
638
+ }
639
+ if (type === "atom") {
640
+ if (newTiming.durationInFrames && newTiming.durationInFrames > 0) {
641
+ return /* @__PURE__ */ import_react3.default.createElement(RenderContext.Provider, { value: newContext }, /* @__PURE__ */ import_react3.default.createElement(import_remotion.Sequence, { layout: "none", name: componentId + " - " + id, from: newTiming.startInFrames, durationInFrames: newTiming.durationInFrames }, effects && effects.length > 0 ? /* @__PURE__ */ import_react3.default.createElement(EffectWrapper, { effects, context: newContext }, /* @__PURE__ */ import_react3.default.createElement(ComponentClass, { ...{
642
+ ...props,
643
+ context: {
644
+ timing: {
645
+ durationInFrames: newTiming.durationInFrames
646
+ }
647
+ }
648
+ } })) : /* @__PURE__ */ import_react3.default.createElement(ComponentClass, { ...{
649
+ ...props,
650
+ context: {
651
+ timing: {
652
+ durationInFrames: newTiming.durationInFrames
653
+ }
654
+ }
655
+ } })));
656
+ }
657
+ return /* @__PURE__ */ import_react3.default.createElement(RenderContext.Provider, { value: newContext }, effects && effects.length > 0 ? /* @__PURE__ */ import_react3.default.createElement(EffectWrapper, { effects, context: newContext }, /* @__PURE__ */ import_react3.default.createElement(ComponentClass, { ...props })) : /* @__PURE__ */ import_react3.default.createElement(ComponentClass, { ...props }));
658
+ }
659
+ };
660
+
661
+ // src/components/frames/Frame.tsx
662
+ var import_react4 = __toESM(require("react"));
663
+ var import_remotion2 = require("remotion");
664
+ var Frame = ({ children, data }) => {
665
+ return /* @__PURE__ */ import_react4.default.createElement(import_remotion2.AbsoluteFill, { style: data?.style }, children);
666
+ };
667
+
668
+ // src/components/frames/SceneFrame.tsx
669
+ var import_react5 = __toESM(require("react"));
670
+ var import_remotion3 = require("remotion");
671
+ var SceneFrame = ({ children }) => {
672
+ return /* @__PURE__ */ import_react5.default.createElement(import_remotion3.AbsoluteFill, null, children);
673
+ };
674
+
675
+ // src/components/layouts/BaseLayout.tsx
676
+ var import_react13 = __toESM(require("react"));
677
+ var import_remotion9 = require("remotion");
678
+
679
+ // src/components/effects/BlurEffect.tsx
680
+ var import_react7 = __toESM(require("react"));
681
+
682
+ // src/components/effects/UniversalEffect.tsx
683
+ var import_react6 = __toESM(require("react"));
684
+
685
+ // src/components/effects/mergeCSSStyles.ts
686
+ var parseFunctionsString = (functions) => {
687
+ const result = /* @__PURE__ */ new Map();
688
+ if (!functions) {
689
+ return result;
690
+ }
691
+ const regex = /(\w+)\(([^)]*)\)/g;
692
+ let match;
693
+ while ((match = regex.exec(functions)) !== null) {
694
+ result.set(match[1], match[0]);
695
+ }
696
+ return result;
697
+ };
698
+ var mergeFunctionStrings = (parentValue, childValue, preferParentOnOverlap) => {
699
+ const parentFunctions = parseFunctionsString(parentValue);
700
+ const childFunctions = parseFunctionsString(childValue);
701
+ const orderedFunctionNames = [];
702
+ parentFunctions.forEach((_v, k) => orderedFunctionNames.push(k));
703
+ childFunctions.forEach((_v, k) => {
704
+ if (!orderedFunctionNames.includes(k)) {
705
+ orderedFunctionNames.push(k);
706
+ }
707
+ });
708
+ const finalFunctions = orderedFunctionNames.map((name) => {
709
+ if (preferParentOnOverlap && parentFunctions.has(name)) {
710
+ return parentFunctions.get(name);
711
+ }
712
+ return childFunctions.get(name) ?? parentFunctions.get(name);
713
+ });
714
+ return finalFunctions.join(" ").trim();
715
+ };
716
+ var mergeCSSStyles = (parent = {}, child = {}, options = {}) => {
717
+ const result = { ...parent };
718
+ const preferParentOnOverlap = Boolean(options.preferParentOnOverlap);
719
+ for (const key in child) {
720
+ if (Object.prototype.hasOwnProperty.call(child, key)) {
721
+ const pValue = result[key];
722
+ const cValue = child[key];
723
+ if (cValue === void 0 || cValue === null) {
724
+ continue;
725
+ }
726
+ switch (key) {
727
+ case "transform":
728
+ case "filter": {
729
+ result[key] = mergeFunctionStrings(
730
+ pValue,
731
+ cValue,
732
+ preferParentOnOverlap
733
+ );
734
+ break;
735
+ }
736
+ case "opacity":
737
+ if (preferParentOnOverlap && pValue !== void 0 && cValue !== void 0) {
738
+ const parentOpacity = typeof pValue === "number" && !isNaN(pValue) ? pValue : 1;
739
+ result.opacity = Math.max(0, Math.min(1, parentOpacity));
740
+ } else {
741
+ const parentOpacity = typeof pValue === "number" && !isNaN(pValue) ? pValue : 1;
742
+ const childOpacity = typeof cValue === "number" && !isNaN(cValue) ? cValue : 1;
743
+ result.opacity = Math.max(
744
+ 0,
745
+ Math.min(1, parentOpacity * childOpacity)
746
+ );
747
+ }
748
+ break;
749
+ case "transformOrigin":
750
+ result.transformOrigin = cValue;
751
+ break;
752
+ case "color":
753
+ case "backgroundColor":
754
+ result[key] = cValue;
755
+ break;
756
+ default:
757
+ if (preferParentOnOverlap && pValue !== void 0) {
758
+ result[key] = pValue;
759
+ } else {
760
+ result[key] = cValue;
761
+ }
762
+ break;
763
+ }
764
+ }
765
+ }
766
+ if (result.transform === "") {
767
+ delete result.transform;
768
+ }
769
+ if (result.filter === "") {
770
+ delete result.filter;
771
+ }
772
+ return result;
773
+ };
774
+ var mergeCSSStyles_default = mergeCSSStyles;
775
+
776
+ // src/components/effects/UniversalEffect.tsx
777
+ var import_remotion4 = require("remotion");
778
+ var UniversalEffectContext = (0, import_react6.createContext)(null);
779
+ var useUniversalEffect = () => {
780
+ const context = (0, import_react6.useContext)(UniversalEffectContext);
781
+ if (!context) {
782
+ throw new Error("useUniversalEffect must be used within a UniversalEffectProvider");
783
+ }
784
+ return context;
785
+ };
786
+ var useUniversalEffectOptional = () => {
787
+ return (0, import_react6.useContext)(UniversalEffectContext);
788
+ };
789
+ var useHasUniversalEffectProvider = () => {
790
+ const context = (0, import_react6.useContext)(UniversalEffectContext);
791
+ return context !== null;
792
+ };
793
+ var parseDuration = (duration, contextDuration, fps) => {
794
+ if (!duration) return contextDuration;
795
+ if (typeof duration === "number") {
796
+ return duration * fps;
797
+ }
798
+ if (typeof duration === "string" && duration.endsWith("%")) {
799
+ const percentage = parseFloat(duration.replace("%", "")) / 100;
800
+ return Math.floor(contextDuration * percentage);
801
+ }
802
+ return contextDuration;
803
+ };
804
+ var parseDelay = (delay, contextDuration, fps) => {
805
+ if (!delay) return 0;
806
+ if (typeof delay === "number") {
807
+ return delay * fps;
808
+ }
809
+ if (typeof delay === "string" && delay.endsWith("%")) {
810
+ const percentage = parseFloat(delay) / 100;
811
+ return Math.floor(contextDuration * percentage);
812
+ }
813
+ return 0;
814
+ };
815
+ var getEasingFunction = (type) => {
816
+ switch (type) {
817
+ case "linear":
818
+ return import_remotion4.Easing.linear;
819
+ case "ease-in":
820
+ return import_remotion4.Easing.in(import_remotion4.Easing.ease);
821
+ case "ease-out":
822
+ return import_remotion4.Easing.out(import_remotion4.Easing.ease);
823
+ case "ease-in-out":
824
+ return import_remotion4.Easing.inOut(import_remotion4.Easing.ease);
825
+ default:
826
+ return import_remotion4.Easing.linear;
827
+ }
828
+ };
829
+ var parseHexColor = (hex) => {
830
+ hex = hex.replace("#", "").toLowerCase();
831
+ if (!/^[0-9a-f]+$/.test(hex)) {
832
+ return { r: 0, g: 0, b: 0, a: 1 };
833
+ }
834
+ if (hex.length === 3) {
835
+ hex = hex.split("").map((char) => char + char).join("");
836
+ }
837
+ if (hex.length === 6) {
838
+ return {
839
+ r: Math.max(0, Math.min(255, parseInt(hex.substr(0, 2), 16))),
840
+ g: Math.max(0, Math.min(255, parseInt(hex.substr(2, 2), 16))),
841
+ b: Math.max(0, Math.min(255, parseInt(hex.substr(4, 2), 16))),
842
+ a: 1
843
+ };
844
+ }
845
+ if (hex.length === 8) {
846
+ return {
847
+ r: Math.max(0, Math.min(255, parseInt(hex.substr(0, 2), 16))),
848
+ g: Math.max(0, Math.min(255, parseInt(hex.substr(2, 2), 16))),
849
+ b: Math.max(0, Math.min(255, parseInt(hex.substr(4, 2), 16))),
850
+ a: Math.max(0, Math.min(1, parseInt(hex.substr(6, 2), 16) / 255))
851
+ };
852
+ }
853
+ return { r: 0, g: 0, b: 0, a: 1 };
854
+ };
855
+ var parseRgbaColor = (rgba) => {
856
+ const match = rgba.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/);
857
+ if (match) {
858
+ return {
859
+ r: Math.max(0, Math.min(255, parseInt(match[1], 10))),
860
+ g: Math.max(0, Math.min(255, parseInt(match[2], 10))),
861
+ 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
863
+ };
864
+ }
865
+ return { r: 0, g: 0, b: 0, a: 1 };
866
+ };
867
+ var parseColor = (color) => {
868
+ const trimmedColor = color.trim();
869
+ if (trimmedColor.startsWith("#")) {
870
+ return parseHexColor(trimmedColor);
871
+ } else if (trimmedColor.toLowerCase().startsWith("rgb")) {
872
+ return parseRgbaColor(trimmedColor);
873
+ }
874
+ return { r: 0, g: 0, b: 0, a: 1 };
875
+ };
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})`;
881
+ }
882
+ };
883
+ var interpolateColors = (color1, color2, progress) => {
884
+ const parsedColor1 = parseColor(color1);
885
+ const parsedColor2 = parseColor(color2);
886
+ const interpolatedColor = {
887
+ r: (0, import_remotion4.interpolate)(progress, [0, 1], [parsedColor1.r, parsedColor2.r]),
888
+ g: (0, import_remotion4.interpolate)(progress, [0, 1], [parsedColor1.g, parsedColor2.g]),
889
+ b: (0, import_remotion4.interpolate)(progress, [0, 1], [parsedColor1.b, parsedColor2.b]),
890
+ a: (0, import_remotion4.interpolate)(progress, [0, 1], [parsedColor1.a, parsedColor2.a])
891
+ };
892
+ return rgbaToString(interpolatedColor);
893
+ };
894
+ var calculateAnimatedValue = (ranges, progress, key) => {
895
+ const sortedRanges = [...ranges].sort((a, b) => a.prog - b.prog);
896
+ if (sortedRanges.length === 0) return 0;
897
+ if (sortedRanges.length === 1) return sortedRanges[0].val;
898
+ const clampedProgress = Math.max(0, Math.min(1, progress));
899
+ if (clampedProgress <= sortedRanges[0].prog) {
900
+ return sortedRanges[0].val;
901
+ }
902
+ if (clampedProgress >= sortedRanges[sortedRanges.length - 1].prog) {
903
+ return sortedRanges[sortedRanges.length - 1].val;
904
+ }
905
+ for (let i = 0; i < sortedRanges.length - 1; i++) {
906
+ const currentRange = sortedRanges[i];
907
+ const nextRange = sortedRanges[i + 1];
908
+ if (clampedProgress >= currentRange.prog && clampedProgress <= nextRange.prog) {
909
+ const localProgress = (clampedProgress - currentRange.prog) / (nextRange.prog - currentRange.prog);
910
+ const currentValue = currentRange.val;
911
+ const nextValue = nextRange.val;
912
+ if (typeof currentValue === "number" && typeof nextValue === "number") {
913
+ if (isFinite(currentValue) && isFinite(nextValue) && !isNaN(currentValue) && !isNaN(nextValue)) {
914
+ const interpolatedValue = currentValue + (nextValue - currentValue) * localProgress;
915
+ if (isFinite(interpolatedValue) && !isNaN(interpolatedValue)) {
916
+ return interpolatedValue;
917
+ }
918
+ }
919
+ return currentValue;
920
+ } else if (typeof currentValue === "string" && typeof nextValue === "string") {
921
+ const isColor = (str) => {
922
+ const trimmed = str.trim().toLowerCase();
923
+ return trimmed.startsWith("#") || trimmed.startsWith("rgb");
924
+ };
925
+ if (isColor(currentValue) && isColor(nextValue)) {
926
+ return interpolateColors(currentValue, nextValue, localProgress);
927
+ }
928
+ const getUnitAndValue = (str) => {
929
+ const units = ["vmax", "vmin", "rem", "deg", "bpm", "vh", "vw", "px", "em", "ms", "hz", "db", "fr", "s", "%"];
930
+ for (const unit of units) {
931
+ if (str.endsWith(unit)) {
932
+ const value2 = parseFloat(str.slice(0, -unit.length));
933
+ return {
934
+ value: isNaN(value2) ? 0 : value2,
935
+ unit
936
+ };
937
+ }
938
+ }
939
+ const value = parseFloat(str);
940
+ return {
941
+ value: isNaN(value) ? 0 : value,
942
+ unit: ""
943
+ };
944
+ };
945
+ const current = getUnitAndValue(currentValue);
946
+ const next = getUnitAndValue(nextValue);
947
+ if (current.unit === next.unit && isFinite(current.value) && isFinite(next.value)) {
948
+ const interpolatedValue = (0, import_remotion4.interpolate)(localProgress, [0, 1], [current.value, next.value]);
949
+ if (isFinite(interpolatedValue)) {
950
+ return current.unit ? `${interpolatedValue}${current.unit}` : interpolatedValue;
951
+ }
952
+ }
953
+ return currentValue;
954
+ }
955
+ return currentValue;
956
+ }
957
+ }
958
+ return sortedRanges[0]?.val || 0;
959
+ };
960
+ var rangesToCSSProperties = (ranges, progress) => {
961
+ const styles = {};
962
+ if (!ranges || !Array.isArray(ranges) || ranges.length === 0) {
963
+ return styles;
964
+ }
965
+ const rangesByKey = ranges.reduce((acc, range) => {
966
+ if (!acc[range.key]) {
967
+ acc[range.key] = [];
968
+ }
969
+ acc[range.key].push(range);
970
+ return acc;
971
+ }, {});
972
+ Object.entries(rangesByKey).forEach(([key, keyRanges]) => {
973
+ const value = calculateAnimatedValue(keyRanges, progress, key);
974
+ switch (key) {
975
+ case "scale":
976
+ styles.transform = `scale(${value})`;
977
+ break;
978
+ case "rotate":
979
+ const rotateValue = typeof value === "string" && value.includes("deg") ? value : `${value}deg`;
980
+ styles.transform = `${styles.transform || ""} rotate(${rotateValue})`.trim();
981
+ break;
982
+ case "translateX":
983
+ const translateXValue = typeof value === "string" && (value.includes("px") || value.includes("%") || value.includes("vw") || value.includes("vh")) ? value : `${value}px`;
984
+ styles.transform = `${styles.transform || ""} translateX(${translateXValue})`.trim();
985
+ break;
986
+ case "translateY":
987
+ const translateYValue = typeof value === "string" && (value.includes("px") || value.includes("%") || value.includes("vw") || value.includes("vh")) ? value : `${value}px`;
988
+ styles.transform = `${styles.transform || ""} translateY(${translateYValue})`.trim();
989
+ break;
990
+ case "opacity":
991
+ const opacityValue = typeof value === "number" ? Math.max(0, Math.min(1, isFinite(value) && !isNaN(value) ? Math.round(value * 1e3) / 1e3 : 1)) : 1;
992
+ styles.opacity = opacityValue;
993
+ break;
994
+ case "blur":
995
+ const blurValue = typeof value === "string" && (value.includes("px") || value.includes("rem") || value.includes("em")) ? value : `${value}px`;
996
+ styles.filter = `blur(${blurValue})`;
997
+ break;
998
+ case "brightness":
999
+ styles.filter = `${styles.filter || ""} brightness(${value})`.trim();
1000
+ break;
1001
+ case "contrast":
1002
+ styles.filter = `${styles.filter || ""} contrast(${value})`.trim();
1003
+ break;
1004
+ case "filter":
1005
+ styles.filter = value;
1006
+ break;
1007
+ case "color":
1008
+ styles.color = value;
1009
+ break;
1010
+ case "backgroundColor":
1011
+ styles.backgroundColor = value;
1012
+ break;
1013
+ default:
1014
+ styles[key] = value;
1015
+ }
1016
+ });
1017
+ return styles;
1018
+ };
1019
+ var useUniversalAnimation = (data, context) => {
1020
+ let frame = 0;
1021
+ let fps = 30;
1022
+ try {
1023
+ frame = (0, import_remotion4.useCurrentFrame)();
1024
+ const videoConfig = (0, import_remotion4.useVideoConfig)();
1025
+ fps = videoConfig.fps;
1026
+ } catch (error) {
1027
+ console.warn("useUniversalAnimation used outside Remotion context, using fallback values");
1028
+ }
1029
+ const effectData = data;
1030
+ const { timing } = context ?? {};
1031
+ const contextDuration = timing?.durationInFrames || 50;
1032
+ const start = parseDelay(effectData?.start, contextDuration, fps);
1033
+ const duration = parseDuration(effectData?.duration, contextDuration, fps);
1034
+ const type = effectData?.type || "linear";
1035
+ const ranges = effectData?.ranges || [];
1036
+ const targetIds = effectData?.targetIds || [];
1037
+ const mode = effectData?.mode || "wrapper";
1038
+ const easing = getEasingFunction(type);
1039
+ const progress = (0, import_remotion4.interpolate)(
1040
+ frame - start,
1041
+ [0, duration],
1042
+ [0, 1],
1043
+ {
1044
+ easing,
1045
+ extrapolateLeft: "clamp",
1046
+ extrapolateRight: "clamp"
1047
+ }
1048
+ );
1049
+ const isActive = frame >= start && frame <= start + duration;
1050
+ const isBeforeStart = frame < start;
1051
+ const isAfterEnd = frame > start + duration;
1052
+ return {
1053
+ frame,
1054
+ fps,
1055
+ progress,
1056
+ isActive,
1057
+ isBeforeStart,
1058
+ isAfterEnd,
1059
+ start,
1060
+ duration,
1061
+ type,
1062
+ ranges,
1063
+ targetIds,
1064
+ mode,
1065
+ effectData
1066
+ };
1067
+ };
1068
+ var UniversalEffect = ({
1069
+ id,
1070
+ data,
1071
+ children,
1072
+ context,
1073
+ effectType = "universal",
1074
+ customAnimationLogic
1075
+ }) => {
1076
+ const { progress, isActive, isBeforeStart, isAfterEnd, frame, ranges, mode, targetIds, effectData } = useUniversalAnimation(data, context);
1077
+ const parentContext = useUniversalEffectOptional();
1078
+ const animatedStyles = (0, import_react6.useMemo)(() => {
1079
+ const parentStyles = parentContext?.animatedStyles || {};
1080
+ let currentStyles = {};
1081
+ if (isActive) {
1082
+ if (customAnimationLogic) {
1083
+ currentStyles = customAnimationLogic(effectData, progress, frame);
1084
+ } else if (ranges.length > 0) {
1085
+ currentStyles = rangesToCSSProperties(ranges, progress);
1086
+ }
1087
+ } else if (isBeforeStart) {
1088
+ if (customAnimationLogic) {
1089
+ currentStyles = customAnimationLogic(effectData, 0, frame);
1090
+ } else if (ranges.length > 0) {
1091
+ currentStyles = rangesToCSSProperties(ranges, 0);
1092
+ }
1093
+ } else if (isAfterEnd) {
1094
+ if (customAnimationLogic) {
1095
+ currentStyles = customAnimationLogic(effectData, 1, frame);
1096
+ } else if (ranges.length > 0) {
1097
+ currentStyles = rangesToCSSProperties(ranges, 1);
1098
+ }
1099
+ }
1100
+ const preferParentOnOverlap = progress <= 0;
1101
+ if (parentContext && mode === "provider") {
1102
+ const combinedStyles = mergeCSSStyles_default(
1103
+ parentStyles,
1104
+ currentStyles,
1105
+ { preferParentOnOverlap: false }
1106
+ );
1107
+ return combinedStyles;
1108
+ }
1109
+ return currentStyles;
1110
+ }, [ranges, progress, parentContext?.animatedStyles, mode, customAnimationLogic, effectData, frame]);
1111
+ const contextValue = (0, import_react6.useMemo)(() => ({
1112
+ animatedStyles,
1113
+ targetIds,
1114
+ effectType
1115
+ }), [animatedStyles, targetIds, effectType]);
1116
+ if (mode === "provider") {
1117
+ return /* @__PURE__ */ import_react6.default.createElement(UniversalEffectContext.Provider, { value: contextValue }, children);
1118
+ } else {
1119
+ return /* @__PURE__ */ import_react6.default.createElement("div", { ...effectData.props, style: animatedStyles }, children);
1120
+ }
1121
+ };
1122
+ var UniversalEffectProvider = ({
1123
+ children,
1124
+ data,
1125
+ effectType = "universal",
1126
+ customAnimationLogic,
1127
+ id = "generic",
1128
+ componentId = "generic",
1129
+ type = "effect"
1130
+ }) => {
1131
+ return /* @__PURE__ */ import_react6.default.createElement(
1132
+ UniversalEffect,
1133
+ {
1134
+ id,
1135
+ componentId,
1136
+ type,
1137
+ data,
1138
+ context: void 0,
1139
+ effectType,
1140
+ customAnimationLogic
1141
+ },
1142
+ children
1143
+ );
1144
+ };
1145
+ var useAnimatedStyles = (componentId) => {
1146
+ const context = useUniversalEffectOptional();
1147
+ if (!context) {
1148
+ return {};
1149
+ }
1150
+ const { animatedStyles, targetIds } = context;
1151
+ if (targetIds.includes(componentId)) {
1152
+ return animatedStyles;
1153
+ }
1154
+ return {};
1155
+ };
1156
+ var config = {
1157
+ displayName: "generic",
1158
+ description: "Universal effect that can be extended for any effect type",
1159
+ isInnerSequence: false,
1160
+ props: {}
1161
+ };
1162
+
1163
+ // src/components/effects/BlurEffect.tsx
1164
+ var BlurEffect = ({
1165
+ id,
1166
+ componentId,
1167
+ type,
1168
+ data,
1169
+ children,
1170
+ context
1171
+ }) => {
1172
+ const { progress, mode, targetIds, effectData } = useUniversalAnimation(data, context);
1173
+ const { intensity = 10, direction = "in" } = effectData;
1174
+ const parentContext = useUniversalEffectOptional();
1175
+ const animatedStyles = (0, import_react7.useMemo)(() => {
1176
+ if (progress <= 0 || progress >= 1) {
1177
+ return {};
1178
+ }
1179
+ const blurValue = direction === "in" ? intensity * (1 - progress) : intensity * progress;
1180
+ const currentStyles = { filter: `blur(${blurValue}px)` };
1181
+ if (parentContext && mode === "provider") {
1182
+ const combinedStyles = mergeCSSStyles_default(parentContext.animatedStyles, currentStyles);
1183
+ return combinedStyles;
1184
+ }
1185
+ return currentStyles;
1186
+ }, [progress, intensity, direction, parentContext?.animatedStyles, mode]);
1187
+ const contextValue = (0, import_react7.useMemo)(() => ({
1188
+ animatedStyles,
1189
+ targetIds,
1190
+ effectType: "blur"
1191
+ }), [animatedStyles, targetIds]);
1192
+ if (mode === "provider") {
1193
+ return /* @__PURE__ */ import_react7.default.createElement(UniversalEffectContext.Provider, { value: contextValue }, children);
1194
+ }
1195
+ return /* @__PURE__ */ import_react7.default.createElement("div", { ...effectData.props, style: animatedStyles }, children);
1196
+ };
1197
+ var config2 = {
1198
+ displayName: "blur",
1199
+ description: "Blur effect with configurable intensity and direction",
1200
+ isInnerSequence: false,
1201
+ props: {
1202
+ intensity: {
1203
+ type: "number",
1204
+ default: 10,
1205
+ description: "Blur intensity in pixels"
1206
+ },
1207
+ direction: {
1208
+ type: "enum",
1209
+ values: ["in", "out"],
1210
+ default: "in",
1211
+ description: "Blur direction (in = start blurred, out = end blurred)"
1212
+ }
1213
+ }
1214
+ };
1215
+
1216
+ // src/components/effects/Loop.tsx
1217
+ var import_react8 = __toESM(require("react"));
1218
+ var import_remotion5 = require("remotion");
1219
+ var LoopEffect = ({
1220
+ data,
1221
+ children,
1222
+ context
1223
+ }) => {
1224
+ const { timing } = context ?? {};
1225
+ const loopData = data;
1226
+ const durationInFrames = loopData?.durationInFrames || timing?.durationInFrames || 50;
1227
+ const times = loopData?.times ?? Infinity;
1228
+ const layout = loopData?.layout || "absolute-fill";
1229
+ return (
1230
+ // @ts-ignore
1231
+ /* @__PURE__ */ import_react8.default.createElement(
1232
+ import_remotion5.Loop,
1233
+ {
1234
+ durationInFrames,
1235
+ times,
1236
+ layout
1237
+ },
1238
+ /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, children)
1239
+ )
1240
+ );
1241
+ };
1242
+ var config3 = {
1243
+ displayName: "loop",
1244
+ type: "layout",
1245
+ isInnerSequence: false,
1246
+ props: {
1247
+ durationInFrames: {
1248
+ type: "number",
1249
+ description: "How many frames one iteration of the loop should be long",
1250
+ default: 50
1251
+ },
1252
+ times: {
1253
+ type: "number",
1254
+ description: "How many times to loop the content (defaults to Infinity)",
1255
+ default: void 0
1256
+ },
1257
+ layout: {
1258
+ type: "string",
1259
+ description: 'Either "absolute-fill" (default) or "none"',
1260
+ default: "absolute-fill"
1261
+ }
1262
+ }
1263
+ };
1264
+
1265
+ // src/components/effects/Pan.tsx
1266
+ var import_react9 = __toESM(require("react"));
1267
+ var import_remotion6 = require("remotion");
1268
+ var parseDuration2 = (duration, contextDuration, fps) => {
1269
+ if (!duration) return contextDuration;
1270
+ if (typeof duration === "number") {
1271
+ return duration * fps;
1272
+ }
1273
+ if (typeof duration === "string" && duration.endsWith("%")) {
1274
+ const percentage = parseFloat(duration.replace("%", "")) / 100;
1275
+ return Math.floor(contextDuration * percentage);
1276
+ }
1277
+ return contextDuration;
1278
+ };
1279
+ var parseDelay2 = (delay, contextDuration, fps) => {
1280
+ if (!delay) return 0;
1281
+ if (typeof delay === "number") {
1282
+ return delay * fps;
1283
+ }
1284
+ if (typeof delay === "string" && delay.endsWith("%")) {
1285
+ const percentage = parseFloat(delay) / 100;
1286
+ return Math.floor(contextDuration * percentage);
1287
+ }
1288
+ return 0;
1289
+ };
1290
+ var getPanDistance = (progress, panDistance) => {
1291
+ if (typeof panDistance === "number") {
1292
+ return panDistance;
1293
+ }
1294
+ if (Array.isArray(panDistance)) {
1295
+ if (panDistance.length === 0) return 0;
1296
+ if (panDistance.length === 1) return panDistance[0][1];
1297
+ for (let i = 0; i < panDistance.length - 1; i++) {
1298
+ const [currentProgress, currentDistance] = panDistance[i];
1299
+ const [nextProgress, nextDistance] = panDistance[i + 1];
1300
+ if (progress >= currentProgress && progress <= nextProgress) {
1301
+ const localProgress = (progress - currentProgress) / (nextProgress - currentProgress);
1302
+ return (0, import_remotion6.interpolate)(localProgress, [0, 1], [currentDistance, nextDistance]);
1303
+ }
1304
+ }
1305
+ return panDistance[panDistance.length - 1][1];
1306
+ }
1307
+ return 0;
1308
+ };
1309
+ var getPosition = (position) => {
1310
+ if (!position) return [0.5, 0.5];
1311
+ if (Array.isArray(position)) {
1312
+ return position;
1313
+ }
1314
+ const positions = {
1315
+ "top-left": [0, 0],
1316
+ "top": [0.5, 0],
1317
+ "top-right": [1, 0],
1318
+ "left": [0, 0.5],
1319
+ "center": [0.5, 0.5],
1320
+ "right": [1, 0.5],
1321
+ "bottom-left": [0, 1],
1322
+ "bottom": [0.5, 1],
1323
+ "bottom-right": [1, 1]
1324
+ };
1325
+ return positions[position] || [0.5, 0.5];
1326
+ };
1327
+ var getEasingFunction2 = (animationType) => {
1328
+ switch (animationType) {
1329
+ case "linear":
1330
+ return import_remotion6.Easing.linear;
1331
+ case "ease-in":
1332
+ return import_remotion6.Easing.in(import_remotion6.Easing.ease);
1333
+ case "ease-out":
1334
+ return import_remotion6.Easing.out(import_remotion6.Easing.ease);
1335
+ case "ease-in-out":
1336
+ return import_remotion6.Easing.inOut(import_remotion6.Easing.ease);
1337
+ default:
1338
+ return import_remotion6.Easing.linear;
1339
+ }
1340
+ };
1341
+ var getPanVector = (direction, distance) => {
1342
+ switch (direction) {
1343
+ case "left":
1344
+ return [-distance, 0];
1345
+ case "right":
1346
+ return [distance, 0];
1347
+ case "up":
1348
+ return [0, -distance];
1349
+ case "down":
1350
+ return [0, distance];
1351
+ case "diagonal":
1352
+ return [distance * 0.707, distance * 0.707];
1353
+ // 45-degree diagonal
1354
+ default:
1355
+ return [0, 0];
1356
+ }
1357
+ };
1358
+ var PanEffect = ({
1359
+ data,
1360
+ children,
1361
+ context
1362
+ }) => {
1363
+ const frame = (0, import_remotion6.useCurrentFrame)();
1364
+ const { fps } = (0, import_remotion6.useVideoConfig)();
1365
+ const panData = data;
1366
+ const { timing } = context ?? {};
1367
+ const contextDuration = timing?.durationInFrames || 50;
1368
+ const effectTiming = panData?.effectTiming || "start";
1369
+ const panDuration = parseDuration2(panData?.panDuration, contextDuration, fps);
1370
+ const panStartDelay = parseDelay2(panData?.panStartDelay, contextDuration, fps);
1371
+ const panEndDelay = parseDelay2(panData?.panEndDelay, contextDuration, fps);
1372
+ const panDirection = panData?.panDirection || "right";
1373
+ let panDistance = panData?.panDistance || 100;
1374
+ const loopTimes = panData?.loopTimes || 0;
1375
+ const panStartPosition = getPosition(panData?.panStartPosition);
1376
+ const panEndPosition = getPosition(panData?.panEndPosition);
1377
+ const animationType = panData?.animationType || "linear";
1378
+ if (loopTimes > 0 && typeof panDistance === "number") {
1379
+ const loopedPanDistance = [];
1380
+ for (let i = 0; i < loopTimes; i++) {
1381
+ const loopProgress = i / loopTimes;
1382
+ const nextLoopProgress = (i + 1) / loopTimes;
1383
+ loopedPanDistance.push([loopProgress, 0]);
1384
+ loopedPanDistance.push([loopProgress + (nextLoopProgress - loopProgress) * 0.5, panDistance]);
1385
+ loopedPanDistance.push([nextLoopProgress, 0]);
1386
+ }
1387
+ panDistance = loopedPanDistance;
1388
+ }
1389
+ let progress;
1390
+ if (animationType === "spring") {
1391
+ progress = (0, import_remotion6.spring)({
1392
+ frame,
1393
+ fps,
1394
+ config: {
1395
+ stiffness: 100,
1396
+ damping: 10,
1397
+ mass: 1
1398
+ },
1399
+ durationInFrames: panDuration,
1400
+ delay: effectTiming === "start" ? panStartDelay : contextDuration - panEndDelay - panDuration
1401
+ });
1402
+ } else {
1403
+ let animationFrame;
1404
+ if (effectTiming === "start") {
1405
+ animationFrame = frame - panStartDelay;
1406
+ } else {
1407
+ animationFrame = frame - (contextDuration - panEndDelay - panDuration);
1408
+ }
1409
+ const easing = getEasingFunction2(animationType);
1410
+ progress = (0, import_remotion6.interpolate)(
1411
+ animationFrame,
1412
+ [0, panDuration],
1413
+ [0, 1],
1414
+ {
1415
+ easing,
1416
+ extrapolateLeft: "clamp",
1417
+ extrapolateRight: "clamp"
1418
+ }
1419
+ );
1420
+ }
1421
+ let panOffset;
1422
+ if (panDirection === "custom") {
1423
+ const [startX, startY] = panStartPosition;
1424
+ const [endX, endY] = panEndPosition;
1425
+ const offsetX = (endX - startX) * 100;
1426
+ const offsetY = (endY - startY) * 100;
1427
+ panOffset = [
1428
+ (0, import_remotion6.interpolate)(progress, [0, 1], [0, offsetX]),
1429
+ (0, import_remotion6.interpolate)(progress, [0, 1], [0, offsetY])
1430
+ ];
1431
+ } else {
1432
+ const distance = getPanDistance(progress, panDistance);
1433
+ const [vectorX, vectorY] = getPanVector(panDirection, distance);
1434
+ panOffset = [vectorX, vectorY];
1435
+ }
1436
+ const style = (0, import_react9.useMemo)(() => {
1437
+ return {
1438
+ width: "100%",
1439
+ height: "100%",
1440
+ transform: `translate(${panOffset[0]}px, ${panOffset[1]}px)`
1441
+ };
1442
+ }, [panOffset]);
1443
+ return /* @__PURE__ */ import_react9.default.createElement("div", { style }, children);
1444
+ };
1445
+ var config4 = {
1446
+ displayName: "pan",
1447
+ type: "layout",
1448
+ isInnerSequence: false,
1449
+ props: {
1450
+ effectTiming: {
1451
+ type: "string",
1452
+ description: 'When the pan effect should occur: "start" or "end"',
1453
+ default: "start"
1454
+ },
1455
+ panDuration: {
1456
+ type: "string",
1457
+ description: 'Duration of the pan animation in seconds or percentage (e.g., "2" or "50%")',
1458
+ default: void 0
1459
+ },
1460
+ panStart: {
1461
+ type: "number",
1462
+ description: "Start time of pan in seconds",
1463
+ default: 0
1464
+ },
1465
+ panEnd: {
1466
+ type: "number",
1467
+ description: "End time of pan in seconds",
1468
+ default: void 0
1469
+ },
1470
+ panStartDelay: {
1471
+ type: "string",
1472
+ description: "Delay before pan starts in seconds or percentage",
1473
+ default: 0
1474
+ },
1475
+ panEndDelay: {
1476
+ type: "string",
1477
+ description: "Delay before video ends in seconds or percentage",
1478
+ default: 0
1479
+ },
1480
+ panDirection: {
1481
+ type: "string",
1482
+ description: 'Direction of pan: "left", "right", "up", "down", "diagonal", or "custom"',
1483
+ default: "right"
1484
+ },
1485
+ panDistance: {
1486
+ type: "string",
1487
+ description: "Pan distance in pixels or array of [progress, distance] pairs",
1488
+ default: 100
1489
+ },
1490
+ panStartPosition: {
1491
+ type: "string",
1492
+ description: "Starting position: [x, y] coordinates or position string (top-left, center, etc.)",
1493
+ default: "center"
1494
+ },
1495
+ panEndPosition: {
1496
+ type: "string",
1497
+ description: "Ending position: [x, y] coordinates or position string (top-left, center, etc.)",
1498
+ default: "center"
1499
+ },
1500
+ animationType: {
1501
+ type: "string",
1502
+ description: 'Animation curve: "linear", "spring", "ease-in", "ease-out", "ease-in-out"',
1503
+ default: "linear"
1504
+ }
1505
+ }
1506
+ };
1507
+
1508
+ // src/components/effects/Zoom.tsx
1509
+ var import_react10 = __toESM(require("react"));
1510
+ var import_remotion7 = require("remotion");
1511
+ var parseDuration3 = (duration, contextDuration, fps) => {
1512
+ if (!duration) return contextDuration;
1513
+ if (typeof duration === "number") {
1514
+ return duration * fps;
1515
+ }
1516
+ if (typeof duration === "string" && duration.endsWith("%")) {
1517
+ const percentage = parseFloat(duration.replace("%", "")) / 100;
1518
+ return Math.floor(contextDuration * percentage);
1519
+ }
1520
+ return contextDuration;
1521
+ };
1522
+ var parseDelay3 = (delay, contextDuration, fps) => {
1523
+ if (!delay) return 0;
1524
+ if (typeof delay === "number") {
1525
+ return delay * fps;
1526
+ }
1527
+ if (typeof delay === "string" && delay.endsWith("%")) {
1528
+ const percentage = parseFloat(delay) / 100;
1529
+ return Math.floor(contextDuration * percentage);
1530
+ }
1531
+ return 0;
1532
+ };
1533
+ var getZoomScale = (progress, zoomDepth) => {
1534
+ if (typeof zoomDepth === "number") {
1535
+ return zoomDepth;
1536
+ }
1537
+ if (Array.isArray(zoomDepth)) {
1538
+ if (zoomDepth.length === 0) return 1;
1539
+ if (zoomDepth.length === 1) return zoomDepth[0][1];
1540
+ for (let i = 0; i < zoomDepth.length - 1; i++) {
1541
+ const [currentProgress, currentScale] = zoomDepth[i];
1542
+ const [nextProgress, nextScale] = zoomDepth[i + 1];
1543
+ if (progress >= currentProgress && progress <= nextProgress) {
1544
+ const localProgress = (progress - currentProgress) / (nextProgress - currentProgress);
1545
+ return (0, import_remotion7.interpolate)(localProgress, [0, 1], [currentScale, nextScale]);
1546
+ }
1547
+ }
1548
+ return zoomDepth[zoomDepth.length - 1][1];
1549
+ }
1550
+ return 1;
1551
+ };
1552
+ var getZoomPosition = (position) => {
1553
+ if (!position) return [0.5, 0.5];
1554
+ if (Array.isArray(position)) {
1555
+ return position;
1556
+ }
1557
+ const positions = {
1558
+ "top-left": [0, 0],
1559
+ "top": [0.5, 0],
1560
+ "top-right": [1, 0],
1561
+ "left": [0, 0.5],
1562
+ "center": [0.5, 0.5],
1563
+ "right": [1, 0.5],
1564
+ "bottom-left": [0, 1],
1565
+ "bottom": [0.5, 1],
1566
+ "bottom-right": [1, 1]
1567
+ };
1568
+ return positions[position] || [0.5, 0.5];
1569
+ };
1570
+ var getEasingFunction3 = (animationType) => {
1571
+ switch (animationType) {
1572
+ case "linear":
1573
+ return import_remotion7.Easing.linear;
1574
+ case "ease-in":
1575
+ return import_remotion7.Easing.in(import_remotion7.Easing.ease);
1576
+ case "ease-out":
1577
+ return import_remotion7.Easing.out(import_remotion7.Easing.ease);
1578
+ case "ease-in-out":
1579
+ return import_remotion7.Easing.inOut(import_remotion7.Easing.ease);
1580
+ default:
1581
+ return import_remotion7.Easing.linear;
1582
+ }
1583
+ };
1584
+ var ZoomEffect = ({
1585
+ data,
1586
+ children,
1587
+ context
1588
+ }) => {
1589
+ const frame = (0, import_remotion7.useCurrentFrame)();
1590
+ const { fps } = (0, import_remotion7.useVideoConfig)();
1591
+ const zoomData = data;
1592
+ const { timing } = context ?? {};
1593
+ const contextDuration = timing?.durationInFrames || 50;
1594
+ const effectTiming = zoomData?.effectTiming || "start";
1595
+ const zoomDuration = parseDuration3(zoomData?.zoomDuration, contextDuration, fps);
1596
+ const zoomStartDelay = parseDelay3(zoomData?.zoomStartDelay, contextDuration, fps);
1597
+ const zoomEndDelay = parseDelay3(zoomData?.zoomEndDelay, contextDuration, fps);
1598
+ const zoomDirection = zoomData?.zoomDirection || "in";
1599
+ let zoomDepth = zoomData?.zoomDepth || 1.5;
1600
+ const loopTimes = zoomData?.loopTimes || 0;
1601
+ if (loopTimes > 1 && Array.isArray(zoomDepth)) {
1602
+ const loopedZoomDepth = [];
1603
+ for (let i = 0; i < loopTimes; i++) {
1604
+ const loopProgress = i / loopTimes;
1605
+ const nextLoopProgress = (i + 1) / loopTimes;
1606
+ zoomDepth.forEach(([x, y]) => {
1607
+ const mappedX = loopProgress + x * (nextLoopProgress - loopProgress);
1608
+ loopedZoomDepth.push([mappedX, y]);
1609
+ });
1610
+ }
1611
+ zoomDepth = loopedZoomDepth;
1612
+ } else if (loopTimes > 0 && typeof zoomDepth === "number") {
1613
+ const loopedZoomDepth = [];
1614
+ for (let i = 0; i < loopTimes; i++) {
1615
+ const loopProgress = i / loopTimes;
1616
+ const nextLoopProgress = (i + 1) / loopTimes;
1617
+ loopedZoomDepth.push([loopProgress, 1]);
1618
+ loopedZoomDepth.push([loopProgress + (nextLoopProgress - loopProgress) * 0.5, zoomDepth]);
1619
+ loopedZoomDepth.push([nextLoopProgress, 1]);
1620
+ }
1621
+ zoomDepth = loopedZoomDepth;
1622
+ }
1623
+ const zoomPosition = getZoomPosition(zoomData?.zoomPosition);
1624
+ const animationType = zoomData?.animationType || "linear";
1625
+ let progress;
1626
+ if (animationType === "spring") {
1627
+ progress = (0, import_remotion7.spring)({
1628
+ frame,
1629
+ fps,
1630
+ config: {
1631
+ stiffness: 100,
1632
+ damping: 10,
1633
+ mass: 1
1634
+ },
1635
+ durationInFrames: zoomDuration,
1636
+ delay: effectTiming === "start" ? zoomStartDelay : contextDuration - zoomEndDelay - zoomDuration
1637
+ });
1638
+ } else {
1639
+ let animationFrame;
1640
+ if (effectTiming === "start") {
1641
+ animationFrame = frame - zoomStartDelay;
1642
+ } else {
1643
+ animationFrame = frame - (contextDuration - zoomEndDelay - zoomDuration);
1644
+ }
1645
+ const easing = getEasingFunction3(animationType);
1646
+ progress = (0, import_remotion7.interpolate)(
1647
+ animationFrame,
1648
+ [0, zoomDuration],
1649
+ [0, 1],
1650
+ {
1651
+ easing,
1652
+ extrapolateLeft: "clamp",
1653
+ extrapolateRight: "clamp"
1654
+ }
1655
+ );
1656
+ }
1657
+ let scale;
1658
+ if (typeof zoomDepth === "number") {
1659
+ const baseScale = zoomDirection === "in" ? 1 : zoomDepth;
1660
+ const targetScale = zoomDirection === "in" ? zoomDepth : 1;
1661
+ scale = (0, import_remotion7.interpolate)(progress, [0, 1], [baseScale, targetScale]);
1662
+ } else if (Array.isArray(zoomDepth)) {
1663
+ scale = getZoomScale(progress, zoomDepth);
1664
+ } else {
1665
+ const baseScale = zoomDirection === "in" ? 1 : 1.5;
1666
+ const targetScale = zoomDirection === "in" ? 1.5 : 1;
1667
+ scale = (0, import_remotion7.interpolate)(progress, [0, 1], [baseScale, targetScale]);
1668
+ }
1669
+ const [originX, originY] = zoomPosition;
1670
+ const transformOrigin = `${originX * 100}% ${originY * 100}%`;
1671
+ const style = (0, import_react10.useMemo)(() => {
1672
+ return {
1673
+ width: "100%",
1674
+ height: "100%",
1675
+ transform: `scale(${scale})`,
1676
+ transformOrigin
1677
+ };
1678
+ }, [scale, transformOrigin]);
1679
+ return /* @__PURE__ */ import_react10.default.createElement("div", { style }, children);
1680
+ };
1681
+ var config5 = {
1682
+ displayName: "zoom",
1683
+ type: "layout",
1684
+ isInnerSequence: false,
1685
+ props: {
1686
+ effectTiming: {
1687
+ type: "string",
1688
+ description: 'When the zoom effect should occur: "start" or "end"',
1689
+ default: "start"
1690
+ },
1691
+ zoomDuration: {
1692
+ type: "string",
1693
+ description: 'Duration of the zoom animation in seconds or percentage (e.g., "2" or "50%")',
1694
+ default: void 0
1695
+ },
1696
+ zoomStart: {
1697
+ type: "number",
1698
+ description: "Start time of zoom in seconds",
1699
+ default: 0
1700
+ },
1701
+ zoomEnd: {
1702
+ type: "number",
1703
+ description: "End time of zoom in seconds",
1704
+ default: void 0
1705
+ },
1706
+ zoomStartDelay: {
1707
+ type: "string",
1708
+ description: "Delay before zoom starts in seconds or percentage",
1709
+ default: 0
1710
+ },
1711
+ zoomEndDelay: {
1712
+ type: "string",
1713
+ description: "Delay before video ends in seconds or percentage",
1714
+ default: 0
1715
+ },
1716
+ zoomDirection: {
1717
+ type: "string",
1718
+ description: 'Direction of zoom: "in" or "out"',
1719
+ default: "in"
1720
+ },
1721
+ zoomDepth: {
1722
+ type: "string",
1723
+ description: "Zoom scale factor or array of [progress, scale] pairs",
1724
+ default: 1.5
1725
+ },
1726
+ zoomPosition: {
1727
+ type: "string",
1728
+ description: "Zoom anchor point: [x, y] coordinates or position string (top-left, center, etc.)",
1729
+ default: "center"
1730
+ },
1731
+ animationType: {
1732
+ type: "string",
1733
+ description: 'Animation curve: "linear", "spring", "ease-in", "ease-out", "ease-in-out"',
1734
+ default: "linear"
1735
+ }
1736
+ }
1737
+ };
1738
+
1739
+ // src/components/effects/Shake.tsx
1740
+ var import_react11 = __toESM(require("react"));
1741
+ var ShakeEffect = ({
1742
+ id,
1743
+ componentId,
1744
+ type,
1745
+ data,
1746
+ children,
1747
+ context
1748
+ }) => {
1749
+ const { progress, frame, mode, targetIds, effectData } = useUniversalAnimation(data, context);
1750
+ const { amplitude = 10, frequency = 0.1, decay = true, axis = "both" } = effectData;
1751
+ const parentContext = useUniversalEffectOptional();
1752
+ const animatedStyles = (0, import_react11.useMemo)(() => {
1753
+ if (progress <= 0 || progress >= 1) {
1754
+ return parentContext?.animatedStyles || {};
1755
+ }
1756
+ const decayFactor = decay ? 1 - progress : 1;
1757
+ const currentAmplitude = amplitude * decayFactor;
1758
+ const time = frame * frequency;
1759
+ const shakeX = axis === "x" || axis === "both" ? Math.sin(time) * currentAmplitude : 0;
1760
+ const shakeY = axis === "y" || axis === "both" ? Math.cos(time * 1.3) * currentAmplitude : 0;
1761
+ const styles = {};
1762
+ if (axis === "x" || axis === "both") {
1763
+ styles.transform = `translateX(${shakeX}px)`;
1764
+ }
1765
+ if (axis === "y" || axis === "both") {
1766
+ styles.transform = `${styles.transform || ""} translateY(${shakeY}px)`.trim();
1767
+ }
1768
+ if (parentContext && mode === "provider") {
1769
+ const combinedStyles = mergeCSSStyles_default(parentContext.animatedStyles, styles);
1770
+ return combinedStyles;
1771
+ }
1772
+ return styles;
1773
+ }, [progress, frame, amplitude, frequency, decay, axis, id, targetIds, mode, parentContext?.animatedStyles]);
1774
+ const contextValue = (0, import_react11.useMemo)(() => ({
1775
+ animatedStyles,
1776
+ targetIds,
1777
+ effectType: "shake"
1778
+ }), [animatedStyles, targetIds]);
1779
+ if (mode === "provider") {
1780
+ return /* @__PURE__ */ import_react11.default.createElement(UniversalEffectContext.Provider, { value: contextValue }, children);
1781
+ }
1782
+ return /* @__PURE__ */ import_react11.default.createElement("div", { ...effectData.props, style: animatedStyles }, children);
1783
+ };
1784
+ var config6 = {
1785
+ displayName: "shake",
1786
+ description: "Shake effect with configurable amplitude, frequency, and decay",
1787
+ isInnerSequence: false,
1788
+ props: {
1789
+ amplitude: {
1790
+ type: "number",
1791
+ default: 10,
1792
+ description: "Shake intensity in pixels"
1793
+ },
1794
+ frequency: {
1795
+ type: "number",
1796
+ default: 0.1,
1797
+ description: "Shake frequency (higher = faster shake)"
1798
+ },
1799
+ decay: {
1800
+ type: "boolean",
1801
+ default: true,
1802
+ description: "Whether shake should decay over time"
1803
+ },
1804
+ axis: {
1805
+ type: "enum",
1806
+ values: ["x", "y", "both"],
1807
+ default: "both",
1808
+ description: "Which axis to shake"
1809
+ }
1810
+ }
1811
+ };
1812
+
1813
+ // src/components/effects/StretchEffect.tsx
1814
+ var import_react12 = __toESM(require("react"));
1815
+ var import_remotion8 = require("remotion");
1816
+ var StretchEffect = ({
1817
+ id,
1818
+ componentId,
1819
+ type,
1820
+ data,
1821
+ children,
1822
+ context
1823
+ }) => {
1824
+ const { fps, frame, mode, targetIds, effectData, start, duration } = useUniversalAnimation(data, context);
1825
+ const { stretchFrom = 0.8, stretchTo = 1, springConfig } = effectData;
1826
+ const parentContext = useUniversalEffectOptional();
1827
+ const springProgress = (0, import_remotion8.spring)({
1828
+ fps,
1829
+ frame: frame - start,
1830
+ config: {
1831
+ stiffness: 100,
1832
+ damping: 10,
1833
+ mass: 1,
1834
+ ...springConfig
1835
+ },
1836
+ durationInFrames: duration
1837
+ });
1838
+ const animatedStyles = (0, import_react12.useMemo)(() => {
1839
+ if (springProgress <= 0 || springProgress >= 1) {
1840
+ return parentContext?.animatedStyles || {};
1841
+ }
1842
+ const scaleX = springProgress * (stretchTo - stretchFrom) + stretchFrom;
1843
+ const scaleY = 1 + (1 - scaleX) * 0.1;
1844
+ const currentStyles = {
1845
+ transform: `scaleX(${scaleX}) scaleY(${scaleY})`,
1846
+ transformOrigin: "center"
1847
+ };
1848
+ if (parentContext && mode === "provider") {
1849
+ const combinedStyles = mergeCSSStyles_default(parentContext.animatedStyles, currentStyles);
1850
+ return combinedStyles;
1851
+ }
1852
+ return currentStyles;
1853
+ }, [springProgress, stretchFrom, stretchTo, parentContext?.animatedStyles, mode]);
1854
+ const contextValue = (0, import_react12.useMemo)(() => ({
1855
+ animatedStyles,
1856
+ targetIds,
1857
+ effectType: "stretch"
1858
+ }), [animatedStyles, targetIds]);
1859
+ if (mode === "provider") {
1860
+ return /* @__PURE__ */ import_react12.default.createElement(UniversalEffectContext.Provider, { value: contextValue }, children);
1861
+ }
1862
+ return /* @__PURE__ */ import_react12.default.createElement("div", { ...effectData.props, style: animatedStyles }, children);
1863
+ };
1864
+ var config7 = {
1865
+ displayName: "stretch",
1866
+ description: "Stretches a component with a spring motion, ideal for subtitles.",
1867
+ isInnerSequence: false,
1868
+ props: {
1869
+ stretchFrom: {
1870
+ type: "number",
1871
+ default: 0.8,
1872
+ description: "The initial horizontal scale of the component."
1873
+ },
1874
+ stretchTo: {
1875
+ type: "number",
1876
+ default: 1,
1877
+ description: "The final horizontal scale of the component."
1878
+ }
1879
+ }
1880
+ };
1881
+
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
+ );
2095
+
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)(
2102
+ () => ({
2103
+ ...!context?.boundaries?.reset ? context?.boundaries : {},
2104
+ ...containerProps.style,
2105
+ ...overrideStyles
2106
+ }),
2107
+ [
2108
+ !context?.boundaries?.reset ? context?.boundaries : {},
2109
+ containerProps.style,
2110
+ overrideStyles
2111
+ ]
2112
+ );
2113
+ if (Object.keys(repeatChildrenProps).length <= 0 && childrenProps.length <= 0) {
2114
+ if (data.isAbsoluteFill) {
2115
+ return /* @__PURE__ */ import_react13.default.createElement(
2116
+ import_remotion9.AbsoluteFill,
2117
+ {
2118
+ ...containerProps,
2119
+ style: enhancedStyle
2120
+ },
2121
+ childrenArray
2122
+ );
2123
+ }
2124
+ return /* @__PURE__ */ import_react13.default.createElement(
2125
+ "div",
2126
+ {
2127
+ id,
2128
+ ...containerProps,
2129
+ style: enhancedStyle
2130
+ },
2131
+ childrenArray.map((child, index) => /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, { key: index }, child))
2132
+ );
2133
+ }
2134
+ if (data.isAbsoluteFill) {
2135
+ return /* @__PURE__ */ import_react13.default.createElement(
2136
+ import_remotion9.AbsoluteFill,
2137
+ {
2138
+ id,
2139
+ ...containerProps,
2140
+ style: enhancedStyle
2141
+ },
2142
+ childrenArray.map((child, index) => /* @__PURE__ */ import_react13.default.createElement(
2143
+ "div",
2144
+ {
2145
+ key: index,
2146
+ ...childrenProps.length > 0 && index < childrenProps.length ? childrenProps[index] : repeatChildrenProps ? repeatChildrenProps : {}
2147
+ },
2148
+ child
2149
+ ))
2150
+ );
2151
+ }
2152
+ return /* @__PURE__ */ import_react13.default.createElement(
2153
+ "div",
2154
+ {
2155
+ id,
2156
+ ...containerProps,
2157
+ style: enhancedStyle
2158
+ },
2159
+ childrenArray.map((child, index) => /* @__PURE__ */ import_react13.default.createElement(
2160
+ "div",
2161
+ {
2162
+ key: index,
2163
+ ...childrenProps.length > 0 && index < childrenProps.length ? childrenProps[index] : repeatChildrenProps ? repeatChildrenProps : {}
2164
+ },
2165
+ child
2166
+ ))
2167
+ );
2168
+ };
2169
+ var config8 = {
2170
+ displayName: "BaseLayout",
2171
+ type: "layout",
2172
+ isInnerSequence: false
2173
+ };
2174
+
2175
+ // src/components/layouts/index.ts
2176
+ registerComponent(
2177
+ config8.displayName,
2178
+ Layout,
2179
+ "layout",
2180
+ config8
2181
+ );
2182
+
2183
+ // 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)();
2188
+ const { shape, color, rotation, style } = data;
2189
+ const rotationStyle = rotation ? {
2190
+ transform: `rotate(${(0, import_remotion10.interpolate)(
2191
+ frame % rotation.duration,
2192
+ [0, rotation.duration],
2193
+ [0, 360],
2194
+ {
2195
+ extrapolateLeft: "clamp",
2196
+ extrapolateRight: "clamp",
2197
+ easing: import_remotion10.Easing.linear
2198
+ }
2199
+ )}deg)`
2200
+ } : {};
2201
+ const baseStyle = {
2202
+ width: "100%",
2203
+ height: "100%",
2204
+ ...style,
2205
+ ...rotationStyle
2206
+ };
2207
+ switch (shape) {
2208
+ case "circle":
2209
+ return /* @__PURE__ */ import_react14.default.createElement("div", { style: { ...baseStyle, backgroundColor: color, borderRadius: "50%" } });
2210
+ case "rectangle":
2211
+ return /* @__PURE__ */ import_react14.default.createElement("div", { style: { ...baseStyle, backgroundColor: color } });
2212
+ default:
2213
+ return null;
2214
+ }
2215
+ };
2216
+ var config9 = {
2217
+ displayName: "ShapeAtom",
2218
+ type: "atom",
2219
+ isInnerSequence: false
2220
+ };
2221
+
2222
+ // src/components/atoms/ImageAtom.tsx
2223
+ var import_react15 = __toESM(require("react"));
2224
+ var import_remotion11 = require("remotion");
2225
+ var CORS_PROXIES = [
2226
+ "https://thingproxy.freeboard.io/fetch/",
2227
+ "https://api.allorigins.win/raw?url=",
2228
+ "https://corsproxy.io/?"
2229
+ ];
2230
+ var getCorsProxyUrl = (url) => {
2231
+ return `${CORS_PROXIES[0]}${encodeURIComponent(url)}`;
2232
+ };
2233
+ 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)(() => {
2239
+ if (!src.startsWith("http")) {
2240
+ setImageSource(src);
2241
+ (0, import_remotion11.continueRender)(handle);
2242
+ return;
2243
+ }
2244
+ setIsLoading(true);
2245
+ setHasError(false);
2246
+ const testImage = new Image();
2247
+ testImage.crossOrigin = "anonymous";
2248
+ const handleSuccess = () => {
2249
+ setImageSource(src);
2250
+ setIsLoading(false);
2251
+ (0, import_remotion11.continueRender)(handle);
2252
+ };
2253
+ const handleError = () => {
2254
+ let proxyUrl;
2255
+ if (proxySrc) {
2256
+ proxyUrl = `${proxySrc}?url=${encodeURIComponent(src)}`;
2257
+ } else {
2258
+ proxyUrl = getCorsProxyUrl(src);
2259
+ }
2260
+ setImageSource(proxyUrl);
2261
+ setIsLoading(false);
2262
+ (0, import_remotion11.continueRender)(handle);
2263
+ };
2264
+ testImage.onload = handleSuccess;
2265
+ testImage.onerror = handleError;
2266
+ testImage.src = src;
2267
+ return () => {
2268
+ testImage.onload = null;
2269
+ testImage.onerror = null;
2270
+ };
2271
+ }, [src, proxySrc, handle]);
2272
+ return { imageSource, isLoading, hasError };
2273
+ };
2274
+ var Atom2 = ({ data, id }) => {
2275
+ const overrideStyles = useAnimatedStyles(id);
2276
+ const { imageSource, isLoading, hasError } = useImageSource(data.src, data.proxySrc);
2277
+ const source = (0, import_react15.useMemo)(() => {
2278
+ if (data.src.startsWith("http")) {
2279
+ return imageSource;
2280
+ }
2281
+ return (0, import_remotion11.staticFile)(data.src);
2282
+ }, [data.src, imageSource]);
2283
+ const enhancedStyle = (0, import_react15.useMemo)(() => ({
2284
+ ...data.style,
2285
+ ...overrideStyles
2286
+ }), [data.style, overrideStyles, isLoading, hasError]);
2287
+ return /* @__PURE__ */ import_react15.default.createElement(
2288
+ import_remotion11.Img,
2289
+ {
2290
+ className: data.className,
2291
+ src: source,
2292
+ style: enhancedStyle,
2293
+ crossOrigin: data.src.startsWith("http") ? "anonymous" : void 0,
2294
+ maxRetries: 4,
2295
+ onError: () => {
2296
+ console.warn(`Failed to load image: ${data.src}`);
2297
+ }
2298
+ }
2299
+ );
2300
+ };
2301
+ var config10 = {
2302
+ displayName: "ImageAtom",
2303
+ type: "atom",
2304
+ isInnerSequence: false
2305
+ };
2306
+
2307
+ // src/components/atoms/TextAtom.tsx
2308
+ var import_react17 = __toESM(require("react"));
2309
+ var import_remotion13 = require("remotion");
2310
+
2311
+ // src/hooks/useFontLoader.ts
2312
+ var import_react16 = require("react");
2313
+ var import_remotion12 = require("remotion");
2314
+
2315
+ // src/utils/fontUtils.ts
2316
+ var fontUtils = __toESM(require("@remotion/google-fonts"));
2317
+ var availableFonts = [];
2318
+ var getAvailableFonts2 = async () => {
2319
+ if (availableFonts.length === 0) {
2320
+ try {
2321
+ availableFonts = fontUtils.getAvailableFonts();
2322
+ } catch (error) {
2323
+ console.warn("Failed to load @remotion/google-fonts:", error);
2324
+ availableFonts = [];
2325
+ }
2326
+ }
2327
+ return availableFonts;
2328
+ };
2329
+ var loadedFonts = /* @__PURE__ */ new Map();
2330
+ var loadGoogleFont = async (fontFamily, options = {}) => {
2331
+ if (!fontFamily || typeof fontFamily !== "string" || fontFamily === "") {
2332
+ console.warn("Invalid fontFamily provided:", fontFamily);
2333
+ return "sans-serif";
2334
+ }
2335
+ const fontKey = `${fontFamily}-${JSON.stringify(options)}`;
2336
+ if (loadedFonts.has(fontKey)) {
2337
+ return loadedFonts.get(fontKey);
2338
+ }
2339
+ try {
2340
+ const fonts = await getAvailableFonts2();
2341
+ const thisFont = fonts.find((font) => font.importName === fontFamily);
2342
+ if (thisFont?.load) {
2343
+ const fontPackage = await thisFont.load();
2344
+ const allFontStuff = fontPackage.loadFont("normal", {
2345
+ subsets: options.subsets || ["latin"],
2346
+ weights: options.weights || ["400"]
2347
+ });
2348
+ await allFontStuff.waitUntilDone();
2349
+ loadedFonts.set(fontKey, allFontStuff.fontFamily);
2350
+ return allFontStuff.fontFamily;
2351
+ } else {
2352
+ throw new Error(
2353
+ `Font Package @remotion/google-fonts/${fontFamily} does not have loadFont method`
2354
+ );
2355
+ }
2356
+ } catch (error) {
2357
+ console.warn(`Failed to load font ${fontFamily}:`, error);
2358
+ try {
2359
+ const alternativeNames = [
2360
+ fontFamily.toLowerCase().replace(/\s+/g, ""),
2361
+ fontFamily.toLowerCase().replace(/\s+/g, "-"),
2362
+ fontFamily.toLowerCase().replace(/\s+/g, "_")
2363
+ ];
2364
+ for (const altName of alternativeNames) {
2365
+ if (altName === fontFamily.toLowerCase().replace(/\s+/g, "-")) {
2366
+ continue;
2367
+ }
2368
+ try {
2369
+ const altFontPackage = await import(`@remotion/google-fonts/${altName}`);
2370
+ if (altFontPackage.loadFont) {
2371
+ const { fontFamily: loadedFontFamily } = await altFontPackage.loadFont("normal", {
2372
+ subsets: options.subsets || ["latin"],
2373
+ weights: options.weights || ["400"],
2374
+ display: options.display || "swap",
2375
+ preload: options.preload !== false
2376
+ });
2377
+ loadedFonts.set(fontKey, loadedFontFamily);
2378
+ return loadedFontFamily;
2379
+ }
2380
+ } catch (altError) {
2381
+ continue;
2382
+ }
2383
+ }
2384
+ } catch (altError) {
2385
+ }
2386
+ const fallbackFontFamily = `"${fontFamily}"`;
2387
+ loadedFonts.set(fontKey, fallbackFontFamily);
2388
+ return fallbackFontFamily;
2389
+ }
2390
+ };
2391
+ var loadMultipleFonts = async (fonts) => {
2392
+ const loadPromises = fonts.map(async ({ family, options }) => {
2393
+ const fontFamily = await loadGoogleFont(family, options);
2394
+ return { family, fontFamily };
2395
+ });
2396
+ const results = await Promise.all(loadPromises);
2397
+ const fontMap = /* @__PURE__ */ new Map();
2398
+ results.forEach(({ family, fontFamily }) => {
2399
+ fontMap.set(family, fontFamily);
2400
+ });
2401
+ return fontMap;
2402
+ };
2403
+ var getLoadedFontFamily = (fontFamily, options = {}) => {
2404
+ const fontKey = `${fontFamily}-${JSON.stringify(options)}`;
2405
+ return loadedFonts.get(fontKey);
2406
+ };
2407
+ var preloadCommonFonts = async () => {
2408
+ const commonFonts = [
2409
+ { family: "Inter", options: { weights: ["400", "500", "600", "700"] } },
2410
+ { family: "Roboto", options: { weights: ["400", "500", "700"] } },
2411
+ { family: "Open Sans", options: { weights: ["400", "600", "700"] } },
2412
+ { family: "Lato", options: { weights: ["400", "700"] } }
2413
+ ];
2414
+ return await loadMultipleFonts(commonFonts);
2415
+ };
2416
+ var isFontLoaded = (fontFamily, options = {}) => {
2417
+ const fontKey = `${fontFamily}-${JSON.stringify(options)}`;
2418
+ return loadedFonts.has(fontKey);
2419
+ };
2420
+ var clearFontCache = () => {
2421
+ loadedFonts.clear();
2422
+ };
2423
+ var getLoadedFonts = () => {
2424
+ return new Map(loadedFonts);
2425
+ };
2426
+ var isFontAvailable = async (fontFamily) => {
2427
+ if (!fontFamily || typeof fontFamily !== "string") {
2428
+ return false;
2429
+ }
2430
+ try {
2431
+ const fonts = await getAvailableFonts2();
2432
+ const isInAvailableFonts = fonts.some(
2433
+ (font) => font.importName === fontFamily
2434
+ );
2435
+ if (isInAvailableFonts) {
2436
+ return true;
2437
+ }
2438
+ const normalizedFontName = fontFamily.trim().replace(/\s+/g, "-").toLowerCase();
2439
+ const fontPackage = await import(`@remotion/google-fonts/${normalizedFontName}`);
2440
+ return !!fontPackage.loadFont;
2441
+ } catch (error) {
2442
+ return false;
2443
+ }
2444
+ };
2445
+ var getNormalizedFontName = (fontFamily) => {
2446
+ if (!fontFamily || typeof fontFamily !== "string") {
2447
+ return "";
2448
+ }
2449
+ return fontFamily.trim().replace(/\s+/g, "-").toLowerCase();
2450
+ };
2451
+
2452
+ // src/hooks/useFontLoader.ts
2453
+ var useFontLoader = (options = {}) => {
2454
+ const [state, setState] = (0, import_react16.useState)({
2455
+ loadedFonts: /* @__PURE__ */ new Map(),
2456
+ loadingFonts: /* @__PURE__ */ new Set(),
2457
+ errorFonts: /* @__PURE__ */ new Map()
2458
+ });
2459
+ const loadFont = (0, import_react16.useCallback)(
2460
+ async (fontFamily, fontOptions = {}) => {
2461
+ const fontKey = `${fontFamily}-${JSON.stringify(fontOptions)}`;
2462
+ if (state.loadedFonts.has(fontKey) || state.loadingFonts.has(fontFamily)) {
2463
+ return state.loadedFonts.get(fontKey) || `"${fontFamily}", sans-serif`;
2464
+ }
2465
+ setState((prev) => ({
2466
+ ...prev,
2467
+ loadingFonts: new Set(prev.loadingFonts).add(fontFamily)
2468
+ }));
2469
+ try {
2470
+ const cssValue = await loadGoogleFont(fontFamily, fontOptions);
2471
+ if (cssValue !== null) {
2472
+ setState((prev) => ({
2473
+ ...prev,
2474
+ loadedFonts: new Map(prev.loadedFonts).set(fontKey, cssValue),
2475
+ loadingFonts: new Set(
2476
+ [...prev.loadingFonts].filter((f) => f !== fontFamily)
2477
+ )
2478
+ }));
2479
+ options.onLoad?.(fontFamily, cssValue);
2480
+ return cssValue;
2481
+ } else {
2482
+ throw new Error(
2483
+ `Font Package @remotion/google-fonts/${fontFamily} not found`
2484
+ );
2485
+ }
2486
+ } catch (error) {
2487
+ const errorObj = error instanceof Error ? error : new Error(String(error));
2488
+ setState((prev) => ({
2489
+ ...prev,
2490
+ errorFonts: new Map(prev.errorFonts).set(fontFamily, errorObj),
2491
+ loadingFonts: new Set(
2492
+ [...prev.loadingFonts].filter((f) => f !== fontFamily)
2493
+ )
2494
+ }));
2495
+ options.onError?.(fontFamily, errorObj);
2496
+ const fallbackValue = `"${fontFamily}", sans-serif`;
2497
+ return fallbackValue;
2498
+ }
2499
+ },
2500
+ [state.loadedFonts, state.loadingFonts, options]
2501
+ );
2502
+ const loadMultipleFonts2 = (0, import_react16.useCallback)(
2503
+ async (fonts) => {
2504
+ const fontsToLoad = fonts.filter(({ family, options: options2 = {} }) => {
2505
+ const fontKey = `${family}-${JSON.stringify(options2)}`;
2506
+ return !state.loadedFonts.has(fontKey) && !state.loadingFonts.has(family);
2507
+ });
2508
+ if (fontsToLoad.length === 0) {
2509
+ return state.loadedFonts;
2510
+ }
2511
+ setState((prev) => ({
2512
+ ...prev,
2513
+ loadingFonts: /* @__PURE__ */ new Set([
2514
+ ...prev.loadingFonts,
2515
+ ...fontsToLoad.map((f) => f.family)
2516
+ ])
2517
+ }));
2518
+ try {
2519
+ const fontMap = await loadMultipleFonts(fontsToLoad);
2520
+ const newFontsMap = /* @__PURE__ */ new Map();
2521
+ fontsToLoad.forEach(({ family, options: options2 = {} }) => {
2522
+ const fontKey = `${family}-${JSON.stringify(options2)}`;
2523
+ const cssValue = fontMap.get(family);
2524
+ if (cssValue) {
2525
+ newFontsMap.set(fontKey, cssValue);
2526
+ }
2527
+ });
2528
+ setState((prev) => ({
2529
+ ...prev,
2530
+ loadedFonts: new Map([...prev.loadedFonts, ...newFontsMap]),
2531
+ loadingFonts: new Set(
2532
+ [...prev.loadingFonts].filter(
2533
+ (f) => !fontsToLoad.some((ftl) => ftl.family === f)
2534
+ )
2535
+ )
2536
+ }));
2537
+ fontsToLoad.forEach(({ family }) => {
2538
+ const cssValue = fontMap.get(family);
2539
+ if (cssValue) {
2540
+ options.onLoad?.(family, cssValue);
2541
+ }
2542
+ });
2543
+ return fontMap;
2544
+ } catch (error) {
2545
+ const errorObj = error instanceof Error ? error : new Error(String(error));
2546
+ setState((prev) => ({
2547
+ ...prev,
2548
+ errorFonts: new Map(prev.errorFonts).set("multiple", errorObj),
2549
+ loadingFonts: new Set(
2550
+ [...prev.loadingFonts].filter(
2551
+ (f) => !fontsToLoad.some((ftl) => ftl.family === f)
2552
+ )
2553
+ )
2554
+ }));
2555
+ options.onError?.("multiple", errorObj);
2556
+ return state.loadedFonts;
2557
+ }
2558
+ },
2559
+ [state.loadedFonts, state.loadingFonts, options]
2560
+ );
2561
+ const isFontReady = (0, import_react16.useCallback)(
2562
+ (fontFamily, options2 = {}) => {
2563
+ const fontKey = `${fontFamily}-${JSON.stringify(options2)}`;
2564
+ return state.loadedFonts.has(fontKey);
2565
+ },
2566
+ [state.loadedFonts]
2567
+ );
2568
+ const areFontsReady = (0, import_react16.useCallback)(
2569
+ (fontFamilies) => {
2570
+ return fontFamilies.every(({ family, options: options2 = {} }) => {
2571
+ const fontKey = `${family}-${JSON.stringify(options2)}`;
2572
+ return state.loadedFonts.has(fontKey);
2573
+ });
2574
+ },
2575
+ [state.loadedFonts]
2576
+ );
2577
+ const getFontFamily = (0, import_react16.useCallback)(
2578
+ (fontFamily, options2 = {}) => {
2579
+ const fontKey = `${fontFamily}-${JSON.stringify(options2)}`;
2580
+ return state.loadedFonts.get(fontKey);
2581
+ },
2582
+ [state.loadedFonts]
2583
+ );
2584
+ const getFontError = (0, import_react16.useCallback)(
2585
+ (fontFamily) => {
2586
+ return state.errorFonts.get(fontFamily);
2587
+ },
2588
+ [state.errorFonts]
2589
+ );
2590
+ const clearErrors = (0, import_react16.useCallback)(() => {
2591
+ setState((prev) => ({
2592
+ ...prev,
2593
+ errorFonts: /* @__PURE__ */ new Map()
2594
+ }));
2595
+ }, []);
2596
+ return {
2597
+ // State
2598
+ loadedFonts: state.loadedFonts,
2599
+ loadingFonts: state.loadingFonts,
2600
+ errorFonts: state.errorFonts,
2601
+ // Actions
2602
+ loadFont,
2603
+ loadMultipleFonts: loadMultipleFonts2,
2604
+ isFontReady,
2605
+ areFontsReady,
2606
+ getFontFamily,
2607
+ getFontError,
2608
+ clearErrors
2609
+ };
2610
+ };
2611
+ var useFont = (fontFamily, options = {}) => {
2612
+ 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}`)
2617
+ );
2618
+ const initialFontFamily = getFontFamily(fontFamily, options) || `"${fontFamily}", sans-serif`;
2619
+ const [fontFamilyValue, setFontFamilyValue] = (0, import_react16.useState)(initialFontFamily);
2620
+ (0, import_react16.useEffect)(() => {
2621
+ const loadFontAsync = async () => {
2622
+ try {
2623
+ const cssValue = await loadFont(fontFamily, options);
2624
+ setFontFamilyValue(cssValue);
2625
+ setIsLoaded(true);
2626
+ setError(null);
2627
+ (0, import_remotion12.continueRender)(renderHandle);
2628
+ } catch (err) {
2629
+ setError(err instanceof Error ? err : new Error(String(err)));
2630
+ setIsLoaded(false);
2631
+ (0, import_remotion12.continueRender)(renderHandle);
2632
+ }
2633
+ };
2634
+ if (!isFontReady(fontFamily, options)) {
2635
+ loadFontAsync();
2636
+ } else {
2637
+ const cachedValue = getFontFamily(fontFamily, options);
2638
+ if (cachedValue) {
2639
+ setFontFamilyValue(cachedValue);
2640
+ }
2641
+ setIsLoaded(true);
2642
+ (0, import_remotion12.continueRender)(renderHandle);
2643
+ }
2644
+ }, [fontFamily, loadFont, isFontReady, getFontFamily, options, renderHandle]);
2645
+ return {
2646
+ isLoaded,
2647
+ error,
2648
+ isReady: isFontReady(fontFamily, options),
2649
+ fontFamily: fontFamilyValue,
2650
+ ...rest
2651
+ };
2652
+ };
2653
+
2654
+ // src/components/atoms/TextAtom.tsx
2655
+ var Atom3 = ({ id, data }) => {
2656
+ 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}`)
2660
+ );
2661
+ const { isLoaded, error, isReady, fontFamily } = useFont(
2662
+ data.font?.family || "Inter",
2663
+ {
2664
+ weights: data.font?.weights || ["400"],
2665
+ subsets: data.font?.subsets || ["latin"],
2666
+ display: data.font?.display || "swap",
2667
+ preload: data.font?.preload !== false,
2668
+ onLoad: (family, cssValue) => {
2669
+ setIsFontLoading(false);
2670
+ (0, import_remotion13.continueRender)(renderHandle);
2671
+ },
2672
+ onError: (family, error2) => {
2673
+ setIsFontLoading(false);
2674
+ (0, import_remotion13.continueRender)(renderHandle);
2675
+ }
2676
+ }
2677
+ );
2678
+ (0, import_react17.useEffect)(() => {
2679
+ if (data.font?.family) {
2680
+ if (isReady || isLoaded) {
2681
+ setIsFontLoading(false);
2682
+ } else if (!isReady && !isLoaded && !error) {
2683
+ setIsFontLoading(true);
2684
+ }
2685
+ }
2686
+ }, [data.font, isReady, isLoaded, error]);
2687
+ const enhancedStyle = (0, import_react17.useMemo)(() => ({
2688
+ fontFamily,
2689
+ ...data.style,
2690
+ ...overrideStyles
2691
+ }), [fontFamily, data.style, overrideStyles]);
2692
+ 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..."));
2694
+ }
2695
+ 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));
2697
+ }
2698
+ return /* @__PURE__ */ import_react17.default.createElement(
2699
+ "div",
2700
+ {
2701
+ style: enhancedStyle,
2702
+ className: data.className,
2703
+ "data-font-loading": isFontLoading,
2704
+ "data-font-loaded": isReady || isLoaded,
2705
+ "data-font-error": !!error,
2706
+ "data-font-family": data.font?.family || "system"
2707
+ },
2708
+ data.text
2709
+ );
2710
+ };
2711
+ var config11 = {
2712
+ displayName: "TextAtom",
2713
+ type: "atom",
2714
+ isInnerSequence: false
2715
+ };
2716
+
2717
+ // 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(),
2723
+ // Video source URL
2724
+ srcDuration: import_zod2.z.number().optional(),
2725
+ // 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(),
2727
+ // CSS styles object
2728
+ containerClassName: import_zod2.z.string().optional(),
2729
+ // CSS class names
2730
+ className: import_zod2.z.string().optional(),
2731
+ // CSS class names
2732
+ startFrom: import_zod2.z.number().optional(),
2733
+ // Start playback from this time (seconds)
2734
+ endAt: import_zod2.z.number().optional(),
2735
+ // End playback at this time (seconds)
2736
+ playbackRate: import_zod2.z.number().optional(),
2737
+ // Playback speed multiplier
2738
+ volume: import_zod2.z.number().optional(),
2739
+ // Volume level (0-1)
2740
+ muted: import_zod2.z.boolean().optional(),
2741
+ // Mute video audio
2742
+ loop: import_zod2.z.boolean().optional(),
2743
+ // Whether to loop the video
2744
+ fit: import_zod2.z.enum(["contain", "cover", "fill", "none", "scale-down"]).optional()
2745
+ // Object fit style
2746
+ });
2747
+ var Atom4 = ({ data, id, context }) => {
2748
+ const { fps } = (0, import_remotion14.useVideoConfig)();
2749
+ const overrideStyles = useAnimatedStyles(id);
2750
+ const frame = (0, import_remotion14.useCurrentFrame)();
2751
+ const source = (0, import_react18.useMemo)(() => {
2752
+ if (data.src.startsWith("http")) {
2753
+ return data.src;
2754
+ }
2755
+ return (0, import_remotion14.staticFile)(data.src);
2756
+ }, [data.src]);
2757
+ const trimBefore = (0, import_react18.useMemo)(() => {
2758
+ return data.startFrom ? data.startFrom * fps : void 0;
2759
+ }, [data.startFrom, fps]);
2760
+ const trimAfter = (0, import_react18.useMemo)(() => {
2761
+ return data.endAt ? data.endAt * fps : void 0;
2762
+ }, [data.endAt, fps]);
2763
+ const videoComponent = /* @__PURE__ */ import_react18.default.createElement(
2764
+ import_remotion14.OffthreadVideo,
2765
+ {
2766
+ className: data.className,
2767
+ src: source,
2768
+ style: data.style ? { ...data.style, ...data.fit ? { objectFit: data.fit } : {} } : {},
2769
+ trimBefore,
2770
+ trimAfter,
2771
+ playbackRate: data.playbackRate,
2772
+ volume: data.volume,
2773
+ muted: data.muted
2774
+ }
2775
+ );
2776
+ const videoWithStyles = data.containerClassName ? videoComponent : /* @__PURE__ */ import_react18.default.createElement(
2777
+ import_remotion14.OffthreadVideo,
2778
+ {
2779
+ className: data.className,
2780
+ src: source,
2781
+ style: data.style ? { ...data.style, ...data.fit ? { objectFit: data.fit } : {}, ...overrideStyles } : overrideStyles,
2782
+ trimBefore,
2783
+ trimAfter,
2784
+ playbackRate: data.playbackRate,
2785
+ volume: data.volume,
2786
+ muted: data.muted
2787
+ }
2788
+ );
2789
+ 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);
2791
+ }
2792
+ return data.containerClassName ? /* @__PURE__ */ import_react18.default.createElement("div", { className: data.containerClassName, style: overrideStyles }, videoComponent) : videoWithStyles;
2793
+ };
2794
+ var config12 = {
2795
+ displayName: "VideoAtom",
2796
+ type: "atom",
2797
+ isInnerSequence: false
2798
+ };
2799
+
2800
+ // 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(),
2808
+ // Start time in seconds
2809
+ end: import_zod3.z.number()
2810
+ // End time in seconds
2811
+ }))
2812
+ });
2813
+ var AudioAtomMutedFullProps = import_zod3.z.object({
2814
+ type: import_zod3.z.literal("full"),
2815
+ value: import_zod3.z.boolean()
2816
+ // true = muted, false = unmuted
2817
+ });
2818
+ var AudioAtomDataProps = import_zod3.z.object({
2819
+ src: import_zod3.z.string(),
2820
+ // Audio source URL
2821
+ startFrom: import_zod3.z.number().optional(),
2822
+ // Start playback from this time (seconds)
2823
+ endAt: import_zod3.z.number().optional(),
2824
+ // End playback at this time (seconds)
2825
+ volume: import_zod3.z.number().optional(),
2826
+ // Volume level (0-1)
2827
+ playbackRate: import_zod3.z.number().optional(),
2828
+ // Playback speed multiplier
2829
+ muted: import_zod3.z.union([AudioAtomMutedFullProps, AudioAtomMutedRangeProps]).optional()
2830
+ // Mute configuration
2831
+ });
2832
+ var Atom5 = ({ data }) => {
2833
+ const { fps } = (0, import_remotion15.useVideoConfig)();
2834
+ const { muted } = data;
2835
+ const frame = (0, import_remotion15.useCurrentFrame)();
2836
+ const isMuted = (0, import_react19.useMemo)(() => {
2837
+ if (muted?.type === "full") {
2838
+ return muted.value;
2839
+ }
2840
+ if (muted?.type === "range") {
2841
+ return muted?.values.some(
2842
+ (value) => frame >= value.start * fps && frame <= value.end * fps
2843
+ );
2844
+ }
2845
+ return false;
2846
+ }, [muted, frame, fps]);
2847
+ const source = (0, import_react19.useMemo)(() => {
2848
+ if (data.src.startsWith("http")) {
2849
+ return data.src;
2850
+ }
2851
+ return (0, import_remotion15.staticFile)(data.src);
2852
+ }, [data.src]);
2853
+ return (
2854
+ // @ts-ignore
2855
+ /* @__PURE__ */ import_react19.default.createElement(
2856
+ import_remotion15.Audio,
2857
+ {
2858
+ src: source,
2859
+ trimBefore: data.startFrom ? data.startFrom * fps : void 0,
2860
+ trimAfter: data.endAt ? data.endAt * fps : void 0,
2861
+ volume: data.volume,
2862
+ playbackRate: data.playbackRate,
2863
+ muted: isMuted
2864
+ }
2865
+ )
2866
+ );
2867
+ };
2868
+ var config13 = {
2869
+ displayName: "AudioAtom",
2870
+ type: "atom",
2871
+ isInnerSequence: false
2872
+ };
2873
+
2874
+ // src/components/atoms/LottieAtom.tsx
2875
+ var import_react20 = __toESM(require("react"));
2876
+ var import_remotion16 = require("remotion");
2877
+ 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(),
2881
+ // Lottie JSON source URL or local path
2882
+ style: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.any()).optional(),
2883
+ // CSS styles object
2884
+ className: import_zod4.z.string().optional(),
2885
+ // CSS class names
2886
+ loop: import_zod4.z.boolean().optional(),
2887
+ // Whether to loop the animation (handled by Remotion timeline)
2888
+ playbackRate: import_zod4.z.number().optional(),
2889
+ // Playback speed multiplier (default: 1)
2890
+ direction: import_zod4.z.enum(["forward", "reverse"]).optional()
2891
+ // Animation direction
2892
+ });
2893
+ 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)(() => {
2899
+ if (!src) {
2900
+ console.error("LottieAtom: No source provided");
2901
+ setHasError(true);
2902
+ setIsLoading(false);
2903
+ (0, import_remotion16.continueRender)(handle);
2904
+ return;
2905
+ }
2906
+ setIsLoading(true);
2907
+ setHasError(false);
2908
+ const sourceUrl = src.startsWith("http") ? src : (0, import_remotion16.staticFile)(src);
2909
+ fetch(sourceUrl, {
2910
+ mode: "cors",
2911
+ credentials: "omit"
2912
+ }).then((response) => {
2913
+ if (!response.ok) {
2914
+ throw new Error(`HTTP ${response.status}: ${response.statusText} for ${sourceUrl}`);
2915
+ }
2916
+ return response.json();
2917
+ }).then((json) => {
2918
+ if (!json || typeof json !== "object") {
2919
+ throw new Error("Invalid Lottie JSON data");
2920
+ }
2921
+ setAnimationData(json);
2922
+ setIsLoading(false);
2923
+ (0, import_remotion16.continueRender)(handle);
2924
+ }).catch((error) => {
2925
+ console.error(`Failed to load Lottie animation from ${sourceUrl}:`, error.message || error);
2926
+ setHasError(true);
2927
+ setIsLoading(false);
2928
+ (0, import_remotion16.continueRender)(handle);
2929
+ });
2930
+ return () => {
2931
+ };
2932
+ }, [src, handle]);
2933
+ return { animationData, isLoading, hasError };
2934
+ };
2935
+ var Atom6 = ({ data, id }) => {
2936
+ const { fps } = (0, import_remotion16.useVideoConfig)();
2937
+ const frame = (0, import_remotion16.useCurrentFrame)();
2938
+ const overrideStyles = useAnimatedStyles(id);
2939
+ const { animationData, isLoading, hasError } = useLottieData(data.src);
2940
+ const effectiveFrame = (0, import_react20.useMemo)(() => {
2941
+ const playbackRate = data.playbackRate || 1;
2942
+ const direction = data.direction || "forward";
2943
+ if (direction === "reverse") {
2944
+ return frame * playbackRate * -1;
2945
+ }
2946
+ return frame * playbackRate;
2947
+ }, [frame, data.playbackRate, data.direction]);
2948
+ const enhancedStyle = (0, import_react20.useMemo)(() => ({
2949
+ ...data.style,
2950
+ ...overrideStyles
2951
+ }), [data.style, overrideStyles]);
2952
+ if (isLoading) {
2953
+ return /* @__PURE__ */ import_react20.default.createElement(
2954
+ "div",
2955
+ {
2956
+ className: data.className,
2957
+ style: {
2958
+ ...enhancedStyle,
2959
+ display: "flex",
2960
+ alignItems: "center",
2961
+ justifyContent: "center",
2962
+ opacity: 0.5
2963
+ }
2964
+ }
2965
+ );
2966
+ }
2967
+ if (hasError || !animationData) {
2968
+ console.warn(`LottieAtom: Failed to render animation from ${data.src}`);
2969
+ return /* @__PURE__ */ import_react20.default.createElement(
2970
+ "div",
2971
+ {
2972
+ className: data.className,
2973
+ style: {
2974
+ ...enhancedStyle,
2975
+ display: "flex",
2976
+ alignItems: "center",
2977
+ justifyContent: "center",
2978
+ backgroundColor: "rgba(255, 0, 0, 0.1)",
2979
+ border: "2px dashed rgba(255, 0, 0, 0.3)",
2980
+ color: "red",
2981
+ fontSize: 12,
2982
+ textAlign: "center",
2983
+ padding: 10
2984
+ }
2985
+ },
2986
+ "\u26A0\uFE0F Lottie Error"
2987
+ );
2988
+ }
2989
+ return /* @__PURE__ */ import_react20.default.createElement(
2990
+ import_lottie.Lottie,
2991
+ {
2992
+ animationData,
2993
+ style: enhancedStyle,
2994
+ className: data.className
2995
+ }
2996
+ );
2997
+ };
2998
+ var config14 = {
2999
+ displayName: "LottieAtom",
3000
+ type: "atom",
3001
+ isInnerSequence: false
3002
+ };
3003
+
3004
+ // src/components/atoms/index.ts
3005
+ registerComponent(
3006
+ config9.displayName,
3007
+ Atom,
3008
+ "atom",
3009
+ config9
3010
+ );
3011
+ registerComponent(
3012
+ config10.displayName,
3013
+ Atom2,
3014
+ "atom",
3015
+ config10
3016
+ );
3017
+ registerComponent(config11.displayName, Atom3, "atom", config11);
3018
+ registerComponent(
3019
+ config12.displayName,
3020
+ Atom4,
3021
+ "atom",
3022
+ config12
3023
+ );
3024
+ registerComponent(
3025
+ config13.displayName,
3026
+ Atom5,
3027
+ "atom",
3028
+ config13
3029
+ );
3030
+ registerComponent(
3031
+ config14.displayName,
3032
+ Atom6,
3033
+ "atom",
3034
+ config14
3035
+ );
3036
+
3037
+ // src/hooks/useComponentRegistry.ts
3038
+ var import_react21 = require("react");
3039
+ var useComponentRegistry = () => {
3040
+ return (0, import_react21.useMemo)(() => {
3041
+ return {
3042
+ registerComponent: componentRegistry.registerComponent.bind(componentRegistry),
3043
+ registerPackage: componentRegistry.registerPackage.bind(componentRegistry),
3044
+ getComponent: componentRegistry.getComponent.bind(componentRegistry),
3045
+ getAllComponents: componentRegistry.getAllComponents.bind(componentRegistry)
3046
+ };
3047
+ }, []);
3048
+ };
3049
+
3050
+ // src/hooks/useBoundaryCalculation.ts
3051
+ var import_react22 = require("react");
3052
+ var useBoundaryCalculation = ({
3053
+ parentBoundaries,
3054
+ constraints,
3055
+ layout
3056
+ }) => {
3057
+ return (0, import_react22.useMemo)(() => {
3058
+ const { x, y, width, height } = parentBoundaries;
3059
+ const calculatedX = typeof constraints.x === "number" ? constraints.x : x;
3060
+ const calculatedY = typeof constraints.y === "number" ? constraints.y : y;
3061
+ const calculatedWidth = typeof constraints.width === "number" ? constraints.width : width;
3062
+ const calculatedHeight = typeof constraints.height === "number" ? constraints.height : height;
3063
+ return {
3064
+ x: calculatedX,
3065
+ y: calculatedY,
3066
+ width: calculatedWidth,
3067
+ height: calculatedHeight,
3068
+ zIndex: constraints.zIndex || 0
3069
+ };
3070
+ }, [parentBoundaries, constraints, layout]);
3071
+ };
3072
+
3073
+ // src/hooks/buildTransitionHook.ts
3074
+ var import_react24 = require("react");
3075
+
3076
+ // src/core/types/transition.types.ts
3077
+ var import_react23 = require("react");
3078
+ var LayoutContext = (0, import_react23.createContext)(null);
3079
+
3080
+ // src/hooks/buildTransitionHook.ts
3081
+ function buildLayoutHook(schema, defaultValue) {
3082
+ return () => {
3083
+ const context = (0, import_react24.useContext)(LayoutContext);
3084
+ if (!context) {
3085
+ return defaultValue;
3086
+ }
3087
+ try {
3088
+ const validatedData = schema.parse(context);
3089
+ return validatedData;
3090
+ } catch (error) {
3091
+ console.warn("Transition data validation failed, using defaults:", error);
3092
+ return defaultValue;
3093
+ }
3094
+ };
3095
+ }
3096
+
3097
+ // src/utils/contextUtils.ts
3098
+ var createRootContext = (width, height, duration, fps) => {
3099
+ return {
3100
+ boundaries: {
3101
+ left: 0,
3102
+ top: 0,
3103
+ width,
3104
+ height,
3105
+ zIndex: 0
3106
+ },
3107
+ timing: {
3108
+ startInFrames: 0,
3109
+ durationInFrames: duration
3110
+ },
3111
+ hierarchy: {
3112
+ depth: 0,
3113
+ parentIds: []
3114
+ }
3115
+ };
3116
+ };
3117
+ var mergeContexts = (parent, child) => {
3118
+ return {
3119
+ boundaries: {
3120
+ ...parent.boundaries,
3121
+ ...child.boundaries
3122
+ },
3123
+ timing: { ...parent.timing, ...child.timing },
3124
+ hierarchy: {
3125
+ depth: (parent.hierarchy?.depth || 0) + 1,
3126
+ parentIds: [...parent.hierarchy?.parentIds || [], "root"]
3127
+ }
3128
+ };
3129
+ };
3130
+
3131
+ // src/utils/boundaryUtils.ts
3132
+ var calculateGridPosition = (index, columns, cellWidth, cellHeight, spacing) => {
3133
+ const row = Math.floor(index / columns);
3134
+ const col = index % columns;
3135
+ return {
3136
+ x: col * (cellWidth + spacing),
3137
+ y: row * (cellHeight + spacing),
3138
+ width: cellWidth,
3139
+ height: cellHeight
3140
+ };
3141
+ };
3142
+ var calculateCircularPosition = (index, total, radius, centerX, centerY) => {
3143
+ const angle = index / total * 2 * Math.PI;
3144
+ return {
3145
+ x: centerX + radius * Math.cos(angle),
3146
+ y: centerY + radius * Math.sin(angle)
3147
+ };
3148
+ };
3149
+
3150
+ // src/utils/imageProxy.ts
3151
+ var createImageProxyUrl = (imageUrl, proxyEndpoint = "/api/proxy/image") => {
3152
+ return `${proxyEndpoint}?url=${encodeURIComponent(imageUrl)}`;
3153
+ };
3154
+ var createImageDataWithProxy = (src, proxyEndpoint) => {
3155
+ return {
3156
+ src,
3157
+ proxySrc: proxyEndpoint || "/api/proxy/image",
3158
+ style: {},
3159
+ className: ""
3160
+ };
3161
+ };
3162
+ var needsProxying = (url) => {
3163
+ return url.startsWith("http://") || url.startsWith("https://");
3164
+ };
3165
+
3166
+ // src/templates/rings/NextjsLogo.tsx
3167
+ var import_paths = require("@remotion/paths");
3168
+ var import_react26 = __toESM(require("react"));
3169
+ var import_remotion18 = require("remotion");
3170
+
3171
+ // 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)
3178
+ });
3179
+ var defaultRippleOutData = {
3180
+ progress: 0,
3181
+ logoOut: 0
3182
+ };
3183
+ var useRippleOutLayout = buildLayoutHook(
3184
+ RippleOutTransitionSchema,
3185
+ defaultRippleOutData
3186
+ );
3187
+ var container = {
3188
+ backgroundColor: "white"
3189
+ };
3190
+ var RippleOutLayout = ({ data, context, children }) => {
3191
+ const {
3192
+ transitionStart,
3193
+ transitionDuration
3194
+ } = data || { transitionStart: 2, transitionDuration: 1 };
3195
+ const frame = (0, import_remotion17.useCurrentFrame)();
3196
+ const { fps } = (0, import_remotion17.useVideoConfig)();
3197
+ const { hierarchy } = useRenderContext();
3198
+ import_react25.default.useEffect(() => {
3199
+ loadGoogleFont("Inter", {
3200
+ subsets: ["latin"],
3201
+ weights: ["400", "700"]
3202
+ }).catch(console.warn);
3203
+ }, []);
3204
+ const transitionStartFrame = transitionStart * fps;
3205
+ const transitionDurationFrames = transitionDuration * fps;
3206
+ const logoOut = (0, import_remotion17.spring)({
3207
+ fps,
3208
+ frame,
3209
+ config: {
3210
+ damping: 200
3211
+ },
3212
+ durationInFrames: transitionDurationFrames,
3213
+ delay: transitionStartFrame
3214
+ });
3215
+ const transitionData = {
3216
+ progress: logoOut,
3217
+ logoOut
3218
+ };
3219
+ const childrenArray = import_react25.default.Children.toArray(children).filter(
3220
+ (child) => import_react25.default.isValidElement(child)
3221
+ );
3222
+ const [from, to] = childrenArray;
3223
+ return /* @__PURE__ */ import_react25.default.createElement(LayoutContext.Provider, { value: transitionData }, /* @__PURE__ */ import_react25.default.createElement(import_remotion17.AbsoluteFill, { style: {
3224
+ ...container,
3225
+ ...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)));
3227
+ };
3228
+ var rippleOutLayoutConfig = {
3229
+ displayName: "RippleOutLayout",
3230
+ type: "layout",
3231
+ isInnerSequence: true
3232
+ };
3233
+
3234
+ // src/templates/rings/NextjsLogo.tsx
3235
+ var mask = {
3236
+ maskType: "alpha"
3237
+ };
3238
+ var nStroke = "M149.508 157.52L69.142 54H54V125.97H66.1136V69.3836L139.999 164.845C143.333 162.614 146.509 160.165 149.508 157.52Z";
3239
+ var NextjsLogo = () => {
3240
+ const { logoOut } = useRippleOutLayout();
3241
+ const outProgress = logoOut;
3242
+ const { fps } = (0, import_remotion18.useVideoConfig)();
3243
+ const frame = (0, import_remotion18.useCurrentFrame)();
3244
+ const evolve1 = (0, import_remotion18.spring)({
3245
+ fps,
3246
+ frame,
3247
+ config: {
3248
+ damping: 200
3249
+ }
3250
+ });
3251
+ const evolve2 = (0, import_remotion18.spring)({
3252
+ fps,
3253
+ frame: frame - 15,
3254
+ config: {
3255
+ damping: 200
3256
+ }
3257
+ });
3258
+ const evolve3 = (0, import_remotion18.spring)({
3259
+ fps,
3260
+ frame: frame - 30,
3261
+ config: {
3262
+ damping: 200,
3263
+ mass: 3
3264
+ },
3265
+ durationInFrames: 30
3266
+ });
3267
+ const style = (0, import_react26.useMemo)(() => {
3268
+ return {
3269
+ height: 140,
3270
+ borderRadius: 70,
3271
+ scale: String(1 - outProgress)
3272
+ };
3273
+ }, [outProgress]);
3274
+ const firstPath = `M 60.0568 54 v 71.97`;
3275
+ const secondPath = `M 63.47956 56.17496 L 144.7535 161.1825`;
3276
+ const thirdPath = `M 121 54 L 121 126`;
3277
+ const evolution1 = (0, import_paths.evolvePath)(evolve1, firstPath);
3278
+ const evolution2 = (0, import_paths.evolvePath)(evolve2, secondPath);
3279
+ const evolution3 = (0, import_paths.evolvePath)(
3280
+ (0, import_remotion18.interpolate)(evolve3, [0, 1], [0, 0.7]),
3281
+ thirdPath
3282
+ );
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(
3284
+ "path",
3285
+ {
3286
+ strokeWidth: "12.1136",
3287
+ d: firstPath,
3288
+ strokeDasharray: evolution1.strokeDasharray,
3289
+ strokeDashoffset: evolution1.strokeDashoffset
3290
+ }
3291
+ ), /* @__PURE__ */ import_react26.default.createElement(
3292
+ "path",
3293
+ {
3294
+ strokeWidth: 12.1136,
3295
+ d: secondPath,
3296
+ strokeDasharray: evolution2.strokeDasharray,
3297
+ strokeDashoffset: evolution2.strokeDashoffset
3298
+ }
3299
+ )), /* @__PURE__ */ import_react26.default.createElement(
3300
+ "path",
3301
+ {
3302
+ stroke: "url(#gradient1)",
3303
+ d: thirdPath,
3304
+ strokeDasharray: evolution3.strokeDasharray,
3305
+ strokeDashoffset: evolution3.strokeDashoffset,
3306
+ strokeWidth: "12"
3307
+ }
3308
+ )), /* @__PURE__ */ import_react26.default.createElement("defs", null, /* @__PURE__ */ import_react26.default.createElement(
3309
+ "linearGradient",
3310
+ {
3311
+ gradientUnits: "userSpaceOnUse",
3312
+ id: "gradient0",
3313
+ x1: "109",
3314
+ x2: "144.5",
3315
+ y1: "116.5",
3316
+ y2: "160.5"
3317
+ },
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(
3321
+ "linearGradient",
3322
+ {
3323
+ gradientUnits: "userSpaceOnUse",
3324
+ id: "gradient1",
3325
+ x1: "121",
3326
+ x2: "120.799",
3327
+ y1: "54",
3328
+ y2: "106.875"
3329
+ },
3330
+ /* @__PURE__ */ import_react26.default.createElement("stop", { stopColor: "white" }),
3331
+ /* @__PURE__ */ import_react26.default.createElement("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })
3332
+ )));
3333
+ };
3334
+ var nextjsLogoConfig = {
3335
+ displayName: "NextjsLogo",
3336
+ type: "atom",
3337
+ isInnerSequence: false
3338
+ };
3339
+
3340
+ // src/templates/rings/Rings.tsx
3341
+ var import_react27 = __toESM(require("react"));
3342
+ var import_remotion19 = require("remotion");
3343
+ var RadialGradient = ({ radius, color }) => {
3344
+ const height = radius * 2;
3345
+ const width = radius * 2;
3346
+ return (
3347
+ // @ts-ignore
3348
+ /* @__PURE__ */ import_react27.default.createElement(
3349
+ import_remotion19.AbsoluteFill,
3350
+ {
3351
+ style: {
3352
+ justifyContent: "center",
3353
+ alignItems: "center"
3354
+ }
3355
+ },
3356
+ /* @__PURE__ */ import_react27.default.createElement(
3357
+ "div",
3358
+ {
3359
+ style: {
3360
+ height,
3361
+ width,
3362
+ borderRadius: "50%",
3363
+ backgroundColor: color,
3364
+ position: "absolute",
3365
+ boxShadow: "0 0 100px rgba(0, 0, 0, 0.05)"
3366
+ }
3367
+ }
3368
+ )
3369
+ )
3370
+ );
3371
+ };
3372
+ var Rings = ({ context, data }) => {
3373
+ const { logoOut } = useRippleOutLayout();
3374
+ const outProgress = logoOut;
3375
+ const scale = 1 / (1 - outProgress);
3376
+ const { height } = (0, import_remotion19.useVideoConfig)();
3377
+ return (
3378
+ // @ts-ignore
3379
+ /* @__PURE__ */ import_react27.default.createElement(
3380
+ import_remotion19.AbsoluteFill,
3381
+ {
3382
+ style: {
3383
+ transform: `scale(${scale})`,
3384
+ ...context?.boundaries
3385
+ }
3386
+ },
3387
+ new Array(5).fill(true).map((_, i) => {
3388
+ return /* @__PURE__ */ import_react27.default.createElement(
3389
+ RadialGradient,
3390
+ {
3391
+ key: i,
3392
+ radius: height * 0.3 * i,
3393
+ color: (0, import_remotion19.interpolateColors)(i, [0, 4], ["#fff", "#fff"])
3394
+ }
3395
+ );
3396
+ }).reverse()
3397
+ )
3398
+ );
3399
+ };
3400
+ var ringsConfig = {
3401
+ displayName: "Rings",
3402
+ type: "atom",
3403
+ isInnerSequence: false
3404
+ };
3405
+
3406
+ // src/templates/rings/TextFade.tsx
3407
+ var import_react28 = __toESM(require("react"));
3408
+ var import_remotion20 = require("remotion");
3409
+ var TextFade = (props) => {
3410
+ const { children, context, data } = props;
3411
+ const { animation } = data || {
3412
+ animation: {
3413
+ duration: 1
3414
+ }
3415
+ };
3416
+ const { fps } = (0, import_remotion20.useVideoConfig)();
3417
+ const frame = (0, import_remotion20.useCurrentFrame)();
3418
+ const progress = (0, import_remotion20.spring)({
3419
+ fps,
3420
+ frame,
3421
+ config: {
3422
+ damping: 200
3423
+ },
3424
+ durationInFrames: animation.duration * fps
3425
+ });
3426
+ const rightStop = (0, import_remotion20.interpolate)(progress, [0, 1], [200, 0]);
3427
+ const leftStop = Math.max(0, rightStop - 60);
3428
+ const maskImage = `linear-gradient(-45deg, transparent ${leftStop}%, black ${rightStop}%)`;
3429
+ const container2 = (0, import_react28.useMemo)(() => {
3430
+ return {
3431
+ width: "100%",
3432
+ height: "100%",
3433
+ justifyContent: "center",
3434
+ alignItems: "center"
3435
+ };
3436
+ }, []);
3437
+ const content = (0, import_react28.useMemo)(() => {
3438
+ return {
3439
+ ...context?.boundaries,
3440
+ maskImage,
3441
+ WebkitMaskImage: maskImage,
3442
+ justifyContent: "center",
3443
+ alignItems: "center",
3444
+ display: "flex"
3445
+ };
3446
+ }, [maskImage]);
3447
+ return (
3448
+ // @ts-ignore
3449
+ /* @__PURE__ */ import_react28.default.createElement(import_remotion20.AbsoluteFill, { style: container2 }, /* @__PURE__ */ import_react28.default.createElement("div", { style: content }, children))
3450
+ );
3451
+ };
3452
+ var textFadeConfig = {
3453
+ displayName: "TextFade",
3454
+ type: "layout",
3455
+ isInnerSequence: false
3456
+ };
3457
+
3458
+ // src/templates/rings/index.ts
3459
+ registerComponent(
3460
+ nextjsLogoConfig.displayName,
3461
+ NextjsLogo,
3462
+ "atom",
3463
+ nextjsLogoConfig
3464
+ );
3465
+ registerComponent(
3466
+ textFadeConfig.displayName,
3467
+ TextFade,
3468
+ "layout",
3469
+ textFadeConfig
3470
+ );
3471
+ registerComponent(ringsConfig.displayName, Rings, "atom", ringsConfig);
3472
+ registerComponent(
3473
+ rippleOutLayoutConfig.displayName,
3474
+ RippleOutLayout,
3475
+ "layout",
3476
+ rippleOutLayoutConfig
3477
+ );
3478
+
3479
+ // 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
+ };
3702
+
3703
+ // src/templates/waveform/Waveform.tsx
3704
+ var WaveformContext = (0, import_react30.createContext)(null);
3705
+ var useWaveformContext = () => {
3706
+ const context = (0, import_react30.useContext)(WaveformContext);
3707
+ if (!context) {
3708
+ throw new Error("useWaveformContext must be used within a Waveform component");
3709
+ }
3710
+ return context;
3711
+ };
3712
+ var Waveform = ({
3713
+ config: config15,
3714
+ children,
3715
+ className = "",
3716
+ style = {}
3717
+ }) => {
3718
+ const frame = (0, import_remotion22.useCurrentFrame)();
3719
+ const { width: videoWidth, height: videoHeight, fps } = (0, import_remotion22.useVideoConfig)();
3720
+ 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,
3726
+ frame,
3727
+ fps,
3728
+ posterize: config15.posterize,
3729
+ includeFrequencyData: config15.useFrequencyData || false
3730
+ });
3731
+ const width = config15.width || videoWidth;
3732
+ const height = config15.height || videoHeight;
3733
+ const contextValue = {
3734
+ waveformData,
3735
+ frequencyData,
3736
+ amplitudes,
3737
+ audioData,
3738
+ frame,
3739
+ fps,
3740
+ config: config15,
3741
+ width,
3742
+ height,
3743
+ bass,
3744
+ mid,
3745
+ treble,
3746
+ bassValues,
3747
+ midValues,
3748
+ trebleValues
3749
+ };
3750
+ return /* @__PURE__ */ import_react30.default.createElement(WaveformContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react30.default.createElement(
3751
+ "div",
3752
+ {
3753
+ className: `relative ${className}`,
3754
+ style: {
3755
+ width,
3756
+ height,
3757
+ position: "relative",
3758
+ backgroundColor: config15.backgroundColor || "transparent",
3759
+ ...style
3760
+ }
3761
+ },
3762
+ children
3763
+ ));
3764
+ };
3765
+
3766
+ // src/templates/waveform/components/WaveformCircle.tsx
3767
+ var WaveformCircle = ({ data }) => {
3768
+ const {
3769
+ config: config15,
3770
+ className = "",
3771
+ style = {},
3772
+ strokeColor = "#FF6B6B",
3773
+ strokeWidth = 3,
3774
+ fill = "none",
3775
+ opacity = 1,
3776
+ radius = 80,
3777
+ centerX = 50,
3778
+ centerY = 50,
3779
+ startAngle = 0,
3780
+ endAngle = 360,
3781
+ amplitude = 1,
3782
+ rotationSpeed = 0,
3783
+ gradientStartColor,
3784
+ gradientEndColor
3785
+ } = data;
3786
+ return /* @__PURE__ */ import_react31.default.createElement(Waveform, { config: config15, className, style }, /* @__PURE__ */ import_react31.default.createElement(
3787
+ WaveformCircleContent,
3788
+ {
3789
+ strokeColor,
3790
+ strokeWidth,
3791
+ fill,
3792
+ opacity,
3793
+ radius,
3794
+ centerX,
3795
+ centerY,
3796
+ startAngle,
3797
+ endAngle,
3798
+ amplitude,
3799
+ rotationSpeed,
3800
+ gradientStartColor,
3801
+ gradientEndColor
3802
+ }
3803
+ ));
3804
+ };
3805
+ var WaveformCircleContent = ({
3806
+ strokeColor,
3807
+ strokeWidth,
3808
+ fill,
3809
+ opacity,
3810
+ radius,
3811
+ centerX,
3812
+ centerY,
3813
+ startAngle,
3814
+ endAngle,
3815
+ amplitude,
3816
+ rotationSpeed,
3817
+ gradientStartColor,
3818
+ gradientEndColor
3819
+ }) => {
3820
+ const { waveformData, width, height, frame } = useWaveformContext();
3821
+ const circleRadius = Math.min(width, height) * (radius || 80) / 100;
3822
+ const circleCenterX = width * (centerX || 50) / 100;
3823
+ const circleCenterY = height * (centerY || 50) / 100;
3824
+ const rotation = frame * (rotationSpeed || 0) % 360;
3825
+ const circularPath = (0, import_react31.useMemo)(() => {
3826
+ if (!waveformData) return "";
3827
+ const totalAngle = (endAngle || 360) - (startAngle || 0);
3828
+ const angleStep = totalAngle / waveformData.length;
3829
+ let path = "";
3830
+ waveformData.forEach((value, index) => {
3831
+ const angle = ((startAngle || 0) + index * angleStep + rotation) * (Math.PI / 180);
3832
+ const waveRadius = circleRadius + value * (amplitude || 1) * circleRadius * 0.3;
3833
+ const x = circleCenterX + waveRadius * Math.cos(angle);
3834
+ const y = circleCenterY + waveRadius * Math.sin(angle);
3835
+ if (index === 0) {
3836
+ path += `M ${x} ${y}`;
3837
+ } else {
3838
+ path += ` L ${x} ${y}`;
3839
+ }
3840
+ });
3841
+ if (Math.abs((endAngle || 360) - (startAngle || 0)) >= 360) {
3842
+ path += " Z";
3843
+ }
3844
+ return path;
3845
+ }, [waveformData, circleRadius, circleCenterX, circleCenterY, startAngle, endAngle, rotation, amplitude]);
3846
+ 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...");
3848
+ }
3849
+ const gradientId = "circle-waveform-gradient";
3850
+ const hasGradient = gradientStartColor && gradientEndColor;
3851
+ return /* @__PURE__ */ import_react31.default.createElement(
3852
+ "svg",
3853
+ {
3854
+ width,
3855
+ height,
3856
+ className: "absolute inset-0",
3857
+ style: { pointerEvents: "none" }
3858
+ },
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(
3861
+ "path",
3862
+ {
3863
+ d: circularPath,
3864
+ stroke: hasGradient ? `url(#${gradientId})` : strokeColor,
3865
+ strokeWidth,
3866
+ fill,
3867
+ opacity,
3868
+ strokeLinecap: "round",
3869
+ strokeLinejoin: "round"
3870
+ }
3871
+ )
3872
+ );
3873
+ };
3874
+
3875
+ // src/templates/waveform/components/WaveformHistogram.tsx
3876
+ var import_react32 = __toESM(require("react"));
3877
+ var WaveformHistogram = ({ data }) => {
3878
+ const {
3879
+ config: config15,
3880
+ className = "",
3881
+ style = {},
3882
+ barColor = "#FF6B6B",
3883
+ barWidth = 4,
3884
+ barSpacing = 2,
3885
+ barBorderRadius = 2,
3886
+ opacity = 1,
3887
+ horizontalSymmetry = true,
3888
+ verticalMirror = false,
3889
+ histogramStyle = "centered",
3890
+ amplitude = 1,
3891
+ multiplier = 1,
3892
+ gradientStartColor,
3893
+ gradientEndColor,
3894
+ gradientDirection = "vertical",
3895
+ gradientStyle = "normal",
3896
+ waveDirection = "right-to-left"
3897
+ } = data;
3898
+ return /* @__PURE__ */ import_react32.default.createElement(Waveform, { config: config15, className, style }, /* @__PURE__ */ import_react32.default.createElement(
3899
+ WaveformHistogramContent,
3900
+ {
3901
+ barColor,
3902
+ barWidth,
3903
+ barSpacing,
3904
+ barBorderRadius,
3905
+ opacity,
3906
+ horizontalSymmetry,
3907
+ verticalMirror,
3908
+ histogramStyle,
3909
+ amplitude,
3910
+ gradientStartColor,
3911
+ gradientEndColor,
3912
+ gradientDirection,
3913
+ multiplier,
3914
+ gradientStyle,
3915
+ waveDirection
3916
+ }
3917
+ ));
3918
+ };
3919
+ var WaveformHistogramContent = ({
3920
+ barColor,
3921
+ barWidth,
3922
+ barSpacing,
3923
+ barBorderRadius,
3924
+ opacity,
3925
+ horizontalSymmetry,
3926
+ verticalMirror,
3927
+ histogramStyle,
3928
+ amplitude,
3929
+ gradientStartColor,
3930
+ gradientEndColor,
3931
+ gradientDirection,
3932
+ multiplier,
3933
+ gradientStyle,
3934
+ waveDirection
3935
+ }) => {
3936
+ const { waveformData, frequencyData, amplitudes, width, height } = useWaveformContext();
3937
+ const dataToUse = amplitudes || waveformData;
3938
+ 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...");
3940
+ }
3941
+ let directedData = waveDirection === "left-to-right" ? dataToUse.slice(1).reverse() : dataToUse;
3942
+ const frequencies = horizontalSymmetry ? [...directedData, ...directedData.slice(1).reverse()] : Array(multiplier).fill(directedData).flat();
3943
+ const Bars = ({ growUpwards }) => {
3944
+ const styleGradientProp = gradientStartColor && gradientEndColor ? {
3945
+ 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})`
3946
+ } : { backgroundColor: barColor };
3947
+ const containerStyle2 = {
3948
+ display: "flex",
3949
+ flexDirection: "row",
3950
+ alignItems: growUpwards ? "flex-end" : "flex-start",
3951
+ height: "100%",
3952
+ width: "100%",
3953
+ ...histogramStyle === "centered" && {
3954
+ justifyContent: "center",
3955
+ gap: `${barSpacing}px`
3956
+ },
3957
+ ...histogramStyle === "full-width" && {
3958
+ gap: `${barSpacing}px`,
3959
+ justifyContent: "space-between"
3960
+ },
3961
+ opacity: gradientStyle === "mirrored" && !growUpwards ? 0.25 : 1
3962
+ };
3963
+ return /* @__PURE__ */ import_react32.default.createElement("div", { style: containerStyle2 }, frequencies.map((value, index) => /* @__PURE__ */ import_react32.default.createElement(
3964
+ "div",
3965
+ {
3966
+ key: index,
3967
+ style: {
3968
+ ...histogramStyle === "full-width" ? { width: `${barWidth}px` } : { width: `${barWidth}px` },
3969
+ ...styleGradientProp,
3970
+ height: `${Math.min(
3971
+ height / 2,
3972
+ Math.abs(value) * (height / 2) * (amplitude || 1)
3973
+ )}px`,
3974
+ borderRadius: growUpwards ? `${barBorderRadius}px ${barBorderRadius}px 0 0` : `0 0 ${barBorderRadius}px ${barBorderRadius}px`,
3975
+ opacity
3976
+ }
3977
+ }
3978
+ )));
3979
+ };
3980
+ if (verticalMirror) {
3981
+ const topHalfStyle = {
3982
+ position: "absolute",
3983
+ bottom: `calc(100% - ${height / 2}px)`,
3984
+ height: `${height / 2}px`,
3985
+ width: "100%",
3986
+ left: 0
3987
+ };
3988
+ const bottomHalfStyle = {
3989
+ position: "absolute",
3990
+ top: `${height / 2}px`,
3991
+ height: `${height / 2}px`,
3992
+ width: "100%",
3993
+ left: 0
3994
+ };
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 })));
3996
+ }
3997
+ const containerStyle = {
3998
+ width: "100%",
3999
+ position: "absolute",
4000
+ top: `${height / 2 - height / 4}px`,
4001
+ height: `${height / 2}px`,
4002
+ left: 0
4003
+ };
4004
+ return /* @__PURE__ */ import_react32.default.createElement("div", { style: containerStyle }, /* @__PURE__ */ import_react32.default.createElement(Bars, { growUpwards: true }));
4005
+ };
4006
+
4007
+ // src/templates/waveform/components/WaveformHistogramRanged.tsx
4008
+ var import_react33 = __toESM(require("react"));
4009
+ var WaveformHistogramRanged = ({ data }) => {
4010
+ const {
4011
+ config: config15,
4012
+ className = "",
4013
+ style = {},
4014
+ barColor = "#FF6B6B",
4015
+ barWidth = 4,
4016
+ barSpacing = 2,
4017
+ barBorderRadius = 2,
4018
+ opacity = 1,
4019
+ verticalMirror = false,
4020
+ histogramStyle = "centered",
4021
+ amplitude = 1,
4022
+ showFrequencyRanges = true,
4023
+ rangeDividerColor = "#666",
4024
+ rangeLabels = false,
4025
+ bassBarColor = "#5DADE2",
4026
+ midBarColor = "#58D68D",
4027
+ trebleBarColor = "#F5B041",
4028
+ gradientStartColor,
4029
+ gradientEndColor,
4030
+ gradientDirection = "vertical",
4031
+ gradientStyle = "normal",
4032
+ horizontalSymmetry = false,
4033
+ waveDirection = "right-to-left"
4034
+ } = data;
4035
+ return /* @__PURE__ */ import_react33.default.createElement(Waveform, { config: config15, className, style }, /* @__PURE__ */ import_react33.default.createElement(
4036
+ WaveformHistogramRangedContent,
4037
+ {
4038
+ barColor,
4039
+ barWidth,
4040
+ barSpacing,
4041
+ barBorderRadius,
4042
+ opacity,
4043
+ verticalMirror,
4044
+ histogramStyle,
4045
+ amplitude,
4046
+ showFrequencyRanges,
4047
+ rangeDividerColor,
4048
+ rangeLabels,
4049
+ bassBarColor,
4050
+ midBarColor,
4051
+ trebleBarColor,
4052
+ gradientStartColor,
4053
+ gradientEndColor,
4054
+ gradientDirection,
4055
+ gradientStyle,
4056
+ horizontalSymmetry,
4057
+ waveDirection
4058
+ }
4059
+ ));
4060
+ };
4061
+ var WaveformHistogramRangedContent = ({
4062
+ barColor,
4063
+ barWidth,
4064
+ barSpacing,
4065
+ barBorderRadius,
4066
+ opacity,
4067
+ verticalMirror,
4068
+ histogramStyle,
4069
+ amplitude,
4070
+ showFrequencyRanges,
4071
+ rangeDividerColor,
4072
+ rangeLabels,
4073
+ bassBarColor,
4074
+ midBarColor,
4075
+ trebleBarColor,
4076
+ gradientStartColor,
4077
+ gradientEndColor,
4078
+ gradientDirection,
4079
+ gradientStyle,
4080
+ horizontalSymmetry,
4081
+ waveDirection
4082
+ }) => {
4083
+ const { amplitudes, bassValues, midValues, trebleValues, height } = useWaveformContext();
4084
+ 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...");
4086
+ }
4087
+ const bassFrequencies = bassValues;
4088
+ const midFrequencies = midValues;
4089
+ const trebleFrequencies = trebleValues;
4090
+ const allFrequencies = waveDirection === "right-to-left" ? [bassFrequencies, midFrequencies, trebleFrequencies].flat() : [trebleFrequencies, midFrequencies, bassFrequencies].flat();
4091
+ const unifiedWaveform = horizontalSymmetry ? [...allFrequencies.slice(1).reverse(), ...allFrequencies] : allFrequencies;
4092
+ const Bars = ({ growUpwards }) => {
4093
+ const containerStyle2 = {
4094
+ display: "flex",
4095
+ flexDirection: "row",
4096
+ alignItems: growUpwards ? "flex-end" : "flex-start",
4097
+ height: "100%",
4098
+ width: "100%",
4099
+ ...histogramStyle === "centered" && {
4100
+ justifyContent: "center",
4101
+ gap: `${barSpacing}px`
4102
+ },
4103
+ ...histogramStyle === "full-width" && {
4104
+ gap: `${barSpacing}px`,
4105
+ justifyContent: "space-between"
4106
+ },
4107
+ opacity: gradientStyle === "mirrored" && !growUpwards ? 0.25 : 1
4108
+ };
4109
+ return /* @__PURE__ */ import_react33.default.createElement("div", { style: containerStyle2 }, unifiedWaveform.map((value, index) => {
4110
+ const rangeName = index === 0 ? "Bass" : index === 1 ? "Mid" : "Treble";
4111
+ const styleGradientProp = gradientStartColor && gradientEndColor ? {
4112
+ 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
+ } : { backgroundColor: barColor };
4114
+ return /* @__PURE__ */ import_react33.default.createElement(
4115
+ "div",
4116
+ {
4117
+ key: index,
4118
+ style: {
4119
+ width: `${barWidth || 4}px`,
4120
+ // Wider bars for the three ranges
4121
+ ...styleGradientProp,
4122
+ height: `${Math.min(
4123
+ height / 2,
4124
+ Math.abs(value) * (height / 2) * (amplitude || 1)
4125
+ )}px`,
4126
+ borderRadius: growUpwards ? `${barBorderRadius}px ${barBorderRadius}px 0 0` : `0 0 ${barBorderRadius}px ${barBorderRadius}px`,
4127
+ opacity,
4128
+ position: "relative"
4129
+ },
4130
+ title: `${rangeName}: ${(value * 100).toFixed(1)}%`
4131
+ },
4132
+ rangeLabels && /* @__PURE__ */ import_react33.default.createElement("div", { style: {
4133
+ position: "absolute",
4134
+ bottom: growUpwards ? "-20px" : "auto",
4135
+ top: growUpwards ? "auto" : "-20px",
4136
+ left: "50%",
4137
+ transform: "translateX(-50%)",
4138
+ fontSize: "10px",
4139
+ color: rangeDividerColor,
4140
+ whiteSpace: "nowrap"
4141
+ } }, rangeName)
4142
+ );
4143
+ }));
4144
+ };
4145
+ if (verticalMirror) {
4146
+ const topHalfStyle = {
4147
+ position: "absolute",
4148
+ bottom: `calc(100% - ${height / 2}px)`,
4149
+ height: `${height / 2}px`,
4150
+ width: "100%",
4151
+ left: 0
4152
+ };
4153
+ const bottomHalfStyle = {
4154
+ position: "absolute",
4155
+ top: `${height / 2}px`,
4156
+ height: `${height / 2}px`,
4157
+ width: "100%",
4158
+ left: 0
4159
+ };
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 })));
4161
+ }
4162
+ const containerStyle = {
4163
+ width: "100%",
4164
+ position: "absolute",
4165
+ top: `${height / 2 - height / 4}px`,
4166
+ height: `${height / 2}px`,
4167
+ left: 0
4168
+ };
4169
+ return /* @__PURE__ */ import_react33.default.createElement("div", { style: containerStyle }, /* @__PURE__ */ import_react33.default.createElement(Bars, { growUpwards: true }));
4170
+ };
4171
+
4172
+ // src/templates/waveform/components/WaveformLine.tsx
4173
+ var import_react34 = __toESM(require("react"));
4174
+ var import_media_utils2 = require("@remotion/media-utils");
4175
+ var import_remotion23 = require("remotion");
4176
+ var detectBeat = (frequencyData, amplitudes, threshold = 0.7, bpm, frame = 0, fps = 30) => {
4177
+ if (!frequencyData || !amplitudes || frequencyData.length === 0) return false;
4178
+ if (bpm) {
4179
+ const beatInterval = 60 / bpm * fps;
4180
+ const beatFrame = Math.round(frame / beatInterval) * beatInterval;
4181
+ return Math.abs(frame - beatFrame) < 2;
4182
+ }
4183
+ const bassFrequencies = amplitudes.slice(0, Math.floor(amplitudes.length * 0.15));
4184
+ const midFrequencies = amplitudes.slice(Math.floor(amplitudes.length * 0.15), Math.floor(amplitudes.length * 0.4));
4185
+ const bassEnergy = Math.sqrt(bassFrequencies.reduce((sum, val) => sum + val * val, 0) / bassFrequencies.length);
4186
+ const midEnergy = Math.sqrt(midFrequencies.reduce((sum, val) => sum + val * val, 0) / midFrequencies.length);
4187
+ const bassPeak = Math.max(...bassFrequencies);
4188
+ const midPeak = Math.max(...midFrequencies);
4189
+ const totalEnergy = bassEnergy * 0.6 + midEnergy * 0.2 + bassPeak * 0.15 + midPeak * 0.05;
4190
+ const normalizedEnergy = Math.min(totalEnergy, 1);
4191
+ return normalizedEnergy > threshold;
4192
+ };
4193
+ var easingFunctions = {
4194
+ linear: (t) => t,
4195
+ "ease-in": (t) => t * t,
4196
+ "ease-out": (t) => 1 - (1 - t) * (1 - t),
4197
+ "ease-in-out": (t) => t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2,
4198
+ bounce: (t) => {
4199
+ if (t < 1 / 2.75) return 7.5625 * t * t;
4200
+ if (t < 2 / 2.75) return 7.5625 * (t -= 1.5 / 2.75) * t + 0.75;
4201
+ if (t < 2.5 / 2.75) return 7.5625 * (t -= 2.25 / 2.75) * t + 0.9375;
4202
+ return 7.5625 * (t -= 2.625 / 2.75) * t + 0.984375;
4203
+ }
4204
+ };
4205
+ var WaveformLine = ({ data }) => {
4206
+ const {
4207
+ config: config15,
4208
+ className = "",
4209
+ style = {},
4210
+ strokeColor = "#FF6B6B",
4211
+ strokeWidth = 3,
4212
+ strokeLinecap = "round",
4213
+ strokeLinejoin = "round",
4214
+ fill = "none",
4215
+ opacity = 1,
4216
+ centerLine = false,
4217
+ centerLineColor = "#666",
4218
+ centerLineWidth = 1,
4219
+ beatSync = false,
4220
+ bpm,
4221
+ beatThreshold = 0.7,
4222
+ beatAmplitudeMultiplier = 1.2,
4223
+ beatAnimationDuration = 30,
4224
+ smoothAnimation = true,
4225
+ waveSpacing = 0.1,
4226
+ waveSegments = 1,
4227
+ waveOffset = 0,
4228
+ waveDirection = "horizontal",
4229
+ amplitudeCurve = "ease-out",
4230
+ animationSpeed = 0.5,
4231
+ pulseOnBeat = false,
4232
+ pulseColor = "#FFD700",
4233
+ pulseScale = 1.2
4234
+ } = data;
4235
+ return /* @__PURE__ */ import_react34.default.createElement(Waveform, { config: config15, className, style }, /* @__PURE__ */ import_react34.default.createElement(
4236
+ WaveformLineContent,
4237
+ {
4238
+ strokeColor,
4239
+ strokeWidth,
4240
+ strokeLinecap,
4241
+ strokeLinejoin,
4242
+ fill,
4243
+ opacity,
4244
+ centerLine,
4245
+ centerLineColor,
4246
+ centerLineWidth,
4247
+ beatSync,
4248
+ bpm,
4249
+ beatThreshold,
4250
+ beatAmplitudeMultiplier,
4251
+ beatAnimationDuration,
4252
+ smoothAnimation,
4253
+ waveSpacing,
4254
+ waveSegments,
4255
+ waveOffset,
4256
+ waveDirection,
4257
+ amplitudeCurve,
4258
+ animationSpeed,
4259
+ pulseOnBeat,
4260
+ pulseColor,
4261
+ pulseScale
4262
+ }
4263
+ ));
4264
+ };
4265
+ var WaveformLineContent = ({
4266
+ strokeColor,
4267
+ strokeWidth,
4268
+ strokeLinecap,
4269
+ strokeLinejoin,
4270
+ fill,
4271
+ opacity,
4272
+ centerLine,
4273
+ centerLineColor,
4274
+ centerLineWidth,
4275
+ beatSync,
4276
+ bpm,
4277
+ beatThreshold,
4278
+ beatAmplitudeMultiplier,
4279
+ beatAnimationDuration,
4280
+ smoothAnimation,
4281
+ waveSpacing,
4282
+ waveSegments,
4283
+ waveOffset,
4284
+ waveDirection,
4285
+ amplitudeCurve,
4286
+ animationSpeed,
4287
+ pulseOnBeat,
4288
+ pulseColor,
4289
+ pulseScale
4290
+ }) => {
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)(() => {
4295
+ if (!beatSync || !frequencyData || !amplitudes) return false;
4296
+ return detectBeat(frequencyData, amplitudes, beatThreshold, bpm, currentFrame, fps);
4297
+ }, [beatSync, frequencyData, amplitudes, beatThreshold, bpm, currentFrame, fps]);
4298
+ const beatProgress = (0, import_react34.useMemo)(() => {
4299
+ if (!isBeat || !beatAnimationDuration) return 0;
4300
+ const beatStartFrame = Math.floor(currentFrame / beatAnimationDuration) * beatAnimationDuration;
4301
+ const progress = (currentFrame - beatStartFrame) / beatAnimationDuration;
4302
+ const clampedProgress = Math.max(0, Math.min(1, progress));
4303
+ if (smoothAnimation) {
4304
+ return 1 - Math.pow(1 - clampedProgress, 3);
4305
+ }
4306
+ return clampedProgress;
4307
+ }, [isBeat, currentFrame, beatAnimationDuration, smoothAnimation]);
4308
+ const currentBeatMultiplier = (0, import_react34.useMemo)(() => {
4309
+ if (!beatSync || !isBeat || !beatAmplitudeMultiplier || !amplitudeCurve) return 1;
4310
+ const easing = easingFunctions[amplitudeCurve];
4311
+ const easedProgress = easing(beatProgress);
4312
+ return 1 + (beatAmplitudeMultiplier - 1) * (1 - easedProgress);
4313
+ }, [beatSync, isBeat, beatProgress, beatAmplitudeMultiplier, amplitudeCurve]);
4314
+ const smoothFactor = (0, import_react34.useMemo)(() => {
4315
+ if (!beatSync) {
4316
+ return 0.3;
4317
+ }
4318
+ return smoothAnimation ? 0.7 : 1;
4319
+ }, [beatSync, smoothAnimation]);
4320
+ const waveformPaths = (0, import_react34.useMemo)(() => {
4321
+ if (!waveformData) return [];
4322
+ const paths = [];
4323
+ const segments = waveSegments || 1;
4324
+ const spacing = waveSpacing || 0.1;
4325
+ const offset = waveOffset || 0;
4326
+ const speed = animationSpeed || 1;
4327
+ const segmentWidth = width / segments;
4328
+ const segmentSpacing = segmentWidth * spacing;
4329
+ for (let i = 0; i < segments; i++) {
4330
+ const segmentStart = i * segmentWidth;
4331
+ const segmentEnd = (i + 1) * segmentWidth;
4332
+ const segmentDataWidth = segmentEnd - segmentStart;
4333
+ const points = waveformData.map((y, index) => {
4334
+ const progress = index / (waveformData.length - 1);
4335
+ const x = segmentStart + progress * segmentDataWidth + offset;
4336
+ let animatedAmplitude = y * (config15.amplitude || 1) * currentBeatMultiplier * speed;
4337
+ const baseAmplitude = y * (config15.amplitude || 1) * speed;
4338
+ const beatAmplitude = animatedAmplitude - baseAmplitude;
4339
+ animatedAmplitude = baseAmplitude + beatAmplitude * smoothFactor;
4340
+ const yPos = waveDirection === "horizontal" ? animatedAmplitude * height / 2 + height / 2 : animatedAmplitude * width / 2 + width / 2;
4341
+ return waveDirection === "horizontal" ? { x, y: yPos } : { x: yPos, y: x };
4342
+ });
4343
+ const path = (0, import_media_utils2.createSmoothSvgPath)({ points });
4344
+ paths.push({ path, segmentIndex: i });
4345
+ }
4346
+ return paths;
4347
+ }, [waveformData, width, height, config15.amplitude, currentBeatMultiplier, animationSpeed, waveSegments, waveSpacing, waveOffset, waveDirection, smoothFactor]);
4348
+ 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...");
4350
+ }
4351
+ return /* @__PURE__ */ import_react34.default.createElement(
4352
+ "svg",
4353
+ {
4354
+ width,
4355
+ height,
4356
+ className: "absolute inset-0",
4357
+ style: { pointerEvents: "none" }
4358
+ },
4359
+ centerLine && /* @__PURE__ */ import_react34.default.createElement(
4360
+ "line",
4361
+ {
4362
+ x1: waveDirection === "horizontal" ? 0 : width / 2,
4363
+ y1: waveDirection === "horizontal" ? height / 2 : 0,
4364
+ x2: waveDirection === "horizontal" ? width : width / 2,
4365
+ y2: waveDirection === "horizontal" ? height / 2 : height,
4366
+ stroke: centerLineColor,
4367
+ strokeWidth: centerLineWidth,
4368
+ opacity: 0.3
4369
+ }
4370
+ ),
4371
+ waveformPaths.map(({ path, segmentIndex }) => /* @__PURE__ */ import_react34.default.createElement("g", { key: segmentIndex }, pulseOnBeat && isBeat && /* @__PURE__ */ import_react34.default.createElement(
4372
+ "path",
4373
+ {
4374
+ d: path,
4375
+ stroke: pulseColor,
4376
+ strokeWidth: (strokeWidth || 3) * (pulseScale || 1.2),
4377
+ strokeLinecap,
4378
+ strokeLinejoin,
4379
+ fill: "none",
4380
+ opacity: (opacity || 1) * (1 - beatProgress)
4381
+ }
4382
+ ), /* @__PURE__ */ import_react34.default.createElement(
4383
+ "path",
4384
+ {
4385
+ d: path,
4386
+ stroke: strokeColor,
4387
+ strokeWidth,
4388
+ strokeLinecap,
4389
+ strokeLinejoin,
4390
+ fill,
4391
+ opacity
4392
+ }
4393
+ )))
4394
+ );
4395
+ };
4396
+
4397
+ // src/templates/waveform/utils.ts
4398
+ var WaveformPresets = {
4399
+ stopgapLine: (props) => {
4400
+ return {
4401
+ componentId: "WaveformLine",
4402
+ type: "atom",
4403
+ data: {
4404
+ strokeColor: "#58C4DC",
4405
+ strokeWidth: 8,
4406
+ strokeLinecap: "round",
4407
+ opacity: 1,
4408
+ amplitudeCurve: "ease-in-out",
4409
+ animationSpeed: 0.15,
4410
+ smoothAnimation: true,
4411
+ ...props,
4412
+ config: {
4413
+ numberOfSamples: 64,
4414
+ // Increased for better frequency resolution
4415
+ windowInSeconds: 1 / 30,
4416
+ amplitude: 4,
4417
+ height: 300,
4418
+ width: 1920 * 3,
4419
+ posterize: 4,
4420
+ ...props.config
4421
+ }
4422
+ }
4423
+ };
4424
+ }
4425
+ };
4426
+
4427
+ // src/templates/waveform/index.ts
4428
+ registerComponent("WaveformLine", WaveformLine, "atom", {
4429
+ displayName: "WaveformLine"
4430
+ });
4431
+ registerComponent("WaveformHistogram", WaveformHistogram, "atom", {
4432
+ displayName: "WaveformHistogram"
4433
+ });
4434
+ registerComponent("WaveformHistogramRanged", WaveformHistogramRanged, "atom", {
4435
+ displayName: "WaveformHistogramRanged"
4436
+ });
4437
+ registerComponent("WaveformCircle", WaveformCircle, "atom", {
4438
+ displayName: "WaveformCircle"
4439
+ });
4440
+
4441
+ // src/components/Composition.tsx
4442
+ 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(
4448
+ CompositionProvider,
4449
+ {
4450
+ value: {
4451
+ root: childrenData,
4452
+ duration: config15.duration
4453
+ }
4454
+ },
4455
+ /* @__PURE__ */ import_react35.default.createElement(import_remotion24.AbsoluteFill, { style }, childrenData?.map((component) => /* @__PURE__ */ import_react35.default.createElement(
4456
+ ComponentRenderer,
4457
+ {
4458
+ key: component.id,
4459
+ ...component
4460
+ }
4461
+ )))
4462
+ );
4463
+ };
4464
+ var calculateCompositionLayoutMetadata = async ({ props, defaultProps, abortSignal, isRendering }) => {
4465
+ const updatedProps = await setDurationsInContext(props);
4466
+ let calculatedDuration = void 0;
4467
+ if (props.config?.fitDurationTo?.length > 0) {
4468
+ calculatedDuration = await calculateDuration(updatedProps.childrenData, {
4469
+ fitDurationTo: updatedProps.config.fitDurationTo
4470
+ });
4471
+ }
4472
+ const duration = calculatedDuration ?? props.config.duration ?? defaultProps.config.duration;
4473
+ const fps = props.config.fps ?? defaultProps.config.fps;
4474
+ const durationInFrames = Math.round(duration * fps);
4475
+ return {
4476
+ // Change the metadata
4477
+ durationInFrames,
4478
+ // or transform some props
4479
+ props: updatedProps,
4480
+ // // or add per-composition default codec
4481
+ // defaultCodec: 'h264',
4482
+ // // or add per-composition default video image format
4483
+ // defaultVideoImageFormat: 'png',
4484
+ // // or add per-composition default pixel format
4485
+ // defaultPixelFormat: 'yuv420p',
4486
+ width: props.config?.width || defaultProps.config.width,
4487
+ height: props.config?.height || defaultProps.config.height,
4488
+ fps,
4489
+ duration
4490
+ };
4491
+ };
4492
+ var Composition = ({
4493
+ id,
4494
+ childrenData,
4495
+ config: config15,
4496
+ style
4497
+ }) => {
4498
+ return /* @__PURE__ */ import_react35.default.createElement(
4499
+ import_remotion24.Composition,
4500
+ {
4501
+ id,
4502
+ 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 },
4508
+ calculateMetadata: calculateCompositionLayoutMetadata,
4509
+ schema: import_zod6.default.object({})
4510
+ }
4511
+ );
4512
+ };
4513
+ var Player = (props) => {
4514
+ return /* @__PURE__ */ import_react35.default.createElement(
4515
+ import_player.Player,
4516
+ {
4517
+ component: CompositionLayout,
4518
+ durationInFrames: props.durationInFrames > 0 ? props.durationInFrames : 20,
4519
+ compositionWidth: props.compositionWidth > 0 ? props.compositionWidth : 1920,
4520
+ compositionHeight: props.compositionHeight > 0 ? props.compositionHeight : 1080,
4521
+ fps: props.fps > 0 ? props.fps : 30,
4522
+ ...props
4523
+ }
4524
+ );
4525
+ };
4526
+ // Annotate the CommonJS export names for ESM import in node:
4527
+ 0 && (module.exports = {
4528
+ AudioAtom,
4529
+ AudioAtomConfig,
4530
+ BaseLayout,
4531
+ BaseLayoutConfig,
4532
+ BlurEffect,
4533
+ BlurEffectConfig,
4534
+ ComponentRenderer,
4535
+ Composition,
4536
+ CompositionLayout,
4537
+ CompositionProvider,
4538
+ Frame,
4539
+ GenericEffectPresets,
4540
+ ImageAtom,
4541
+ ImageAtomConfig,
4542
+ LoopEffect,
4543
+ LoopEffectConfig,
4544
+ LottieAtom,
4545
+ LottieAtomConfig,
4546
+ NextjsLogo,
4547
+ PanEffect,
4548
+ PanEffectConfig,
4549
+ Player,
4550
+ Rings,
4551
+ RippleOutLayout,
4552
+ SceneFrame,
4553
+ ShakeEffect,
4554
+ ShakeEffectConfig,
4555
+ ShapeAtom,
4556
+ ShapeAtomConfig,
4557
+ StretchEffect,
4558
+ StretchEffectConfig,
4559
+ TextAtom,
4560
+ TextAtomConfig,
4561
+ TextFade,
4562
+ UniversalEffect,
4563
+ UniversalEffectProvider,
4564
+ VideoAtom,
4565
+ VideoAtomConfig,
4566
+ Waveform,
4567
+ WaveformCircle,
4568
+ WaveformHistogram,
4569
+ WaveformHistogramRanged,
4570
+ WaveformLine,
4571
+ WaveformPresets,
4572
+ ZoomEffect,
4573
+ ZoomEffectConfig,
4574
+ buildLayoutHook,
4575
+ calculateCircularPosition,
4576
+ calculateComponentDuration,
4577
+ calculateCompositionLayoutMetadata,
4578
+ calculateDuration,
4579
+ calculateGridPosition,
4580
+ calculateHierarchy,
4581
+ calculateTimingWithInheritance,
4582
+ clearFontCache,
4583
+ componentRegistry,
4584
+ createImageDataWithProxy,
4585
+ createImageProxyUrl,
4586
+ createRootContext,
4587
+ findComponentById,
4588
+ findMatchingComponents,
4589
+ findMatchingComponentsByQuery,
4590
+ findParentComponent,
4591
+ getComponent,
4592
+ getComponentConfig,
4593
+ getComponentWithConfig,
4594
+ getLoadedFontFamily,
4595
+ getLoadedFonts,
4596
+ getNormalizedFontName,
4597
+ isFontAvailable,
4598
+ isFontLoaded,
4599
+ loadGoogleFont,
4600
+ loadMultipleFonts,
4601
+ mergeContexts,
4602
+ needsProxying,
4603
+ nextjsLogoConfig,
4604
+ preloadCommonFonts,
4605
+ registerComponent,
4606
+ registerEffect,
4607
+ registerPackage,
4608
+ ringsConfig,
4609
+ rippleOutLayoutConfig,
4610
+ setDurationsInContext,
4611
+ textFadeConfig,
4612
+ useAnimatedStyles,
4613
+ useBoundaryCalculation,
4614
+ useComponentRegistry,
4615
+ useComposition,
4616
+ useFont,
4617
+ useFontLoader,
4618
+ useHasUniversalEffectProvider,
4619
+ useRenderContext,
4620
+ useRippleOutLayout,
4621
+ useUniversalEffect,
4622
+ useUniversalEffectOptional,
4623
+ useWaveformContext,
4624
+ useWaveformData
4625
+ });
4626
+ //# sourceMappingURL=index.js.map