@adminide-stack/yantra-mobile 12.0.121 → 12.0.123-alpha.0
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/lib/features/apps/appArt.js +1 -1
- package/lib/features/apps/appArt.js.map +1 -1
- package/lib/features/apps/mobileAppCatalog.js +15 -11
- package/lib/features/apps/mobileAppCatalog.js.map +1 -1
- package/lib/features/canvas/CanvasAgentChatPane.js +82 -20
- package/lib/features/canvas/CanvasAgentChatPane.js.map +1 -1
- package/lib/features/canvas/CanvasBoardsGrid.js +291 -100
- package/lib/features/canvas/CanvasBoardsGrid.js.map +1 -1
- package/lib/features/canvas/CanvasEditToolsPanel.js +105 -12
- package/lib/features/canvas/CanvasEditToolsPanel.js.map +1 -1
- package/lib/features/canvas/CanvasExperience.js +266 -68
- package/lib/features/canvas/CanvasExperience.js.map +1 -1
- package/lib/features/canvas/CanvasGeneratePanel.js +204 -66
- package/lib/features/canvas/CanvasGeneratePanel.js.map +1 -1
- package/lib/features/canvas/CanvasLibrarySheet.js +31 -13
- package/lib/features/canvas/CanvasLibrarySheet.js.map +1 -1
- package/lib/features/canvas/CanvasModelPicker.js +176 -0
- package/lib/features/canvas/CanvasModelPicker.js.map +1 -0
- package/lib/features/canvas/CanvasTasksPanel.js +325 -29
- package/lib/features/canvas/CanvasTasksPanel.js.map +1 -1
- package/lib/features/canvas/CanvasTemplatesPanel.js +5 -4
- package/lib/features/canvas/CanvasTemplatesPanel.js.map +1 -1
- package/lib/features/canvas/CanvasToolDock.js +137 -61
- package/lib/features/canvas/CanvasToolDock.js.map +1 -1
- package/lib/features/canvas/FrameExtractorExperience.js +33 -2
- package/lib/features/canvas/FrameExtractorExperience.js.map +1 -1
- package/lib/features/canvas/GeneratorReferenceSlots.js +197 -0
- package/lib/features/canvas/GeneratorReferenceSlots.js.map +1 -0
- package/lib/features/canvas/NativeCanvasViewer.js +89 -11
- package/lib/features/canvas/NativeCanvasViewer.js.map +1 -1
- package/lib/features/canvas/PromoContextFields.js +55 -2
- package/lib/features/canvas/PromoContextFields.js.map +1 -1
- package/lib/features/canvas/SetStudioExperience.js +323 -13
- package/lib/features/canvas/SetStudioExperience.js.map +1 -1
- package/lib/features/canvas/VideoEditExperience.js +1 -53
- package/lib/features/canvas/VideoEditExperience.js.map +1 -1
- package/lib/features/canvas/VideoEditorExperience.js +697 -506
- package/lib/features/canvas/VideoEditorExperience.js.map +1 -1
- package/lib/features/canvas/VideoGeneratorExperience.js +22 -5
- package/lib/features/canvas/VideoGeneratorExperience.js.map +1 -1
- package/lib/features/canvas/canvasAgentChat.js +125 -11
- package/lib/features/canvas/canvasAgentChat.js.map +1 -1
- package/lib/features/canvas/canvasCore.js +117 -12
- package/lib/features/canvas/canvasCore.js.map +1 -1
- package/lib/features/canvas/canvasEditOps.js +148 -111
- package/lib/features/canvas/canvasEditOps.js.map +1 -1
- package/lib/features/canvas/canvasTaskSync.js +235 -0
- package/lib/features/canvas/canvasTaskSync.js.map +1 -0
- package/lib/features/canvas/canvasTasks.js +98 -11
- package/lib/features/canvas/canvasTasks.js.map +1 -1
- package/lib/features/canvas/createTiles.js +247 -0
- package/lib/features/canvas/createTiles.js.map +1 -0
- package/lib/features/canvas/deepLinks.js +83 -0
- package/lib/features/canvas/deepLinks.js.map +1 -0
- package/lib/features/canvas/frameExtract.js +13 -1
- package/lib/features/canvas/frameExtract.js.map +1 -1
- package/lib/features/canvas/generationModels.js +36 -8
- package/lib/features/canvas/generationModels.js.map +1 -1
- package/lib/features/canvas/generatorCommands.js +106 -0
- package/lib/features/canvas/generatorCommands.js.map +1 -0
- package/lib/features/canvas/generatorReferences.js +82 -0
- package/lib/features/canvas/generatorReferences.js.map +1 -0
- package/lib/features/canvas/homeWork.js +74 -0
- package/lib/features/canvas/homeWork.js.map +1 -0
- package/lib/features/canvas/linksRpc.js +130 -0
- package/lib/features/canvas/linksRpc.js.map +1 -0
- package/lib/features/canvas/mediaRecheck.js +176 -0
- package/lib/features/canvas/mediaRecheck.js.map +1 -0
- package/lib/features/canvas/mediaUrls.js +258 -0
- package/lib/features/canvas/mediaUrls.js.map +1 -0
- package/lib/features/canvas/nativeViewerRegistry.js.map +1 -1
- package/lib/features/canvas/promoProjectImport.js +80 -13
- package/lib/features/canvas/promoProjectImport.js.map +1 -1
- package/lib/features/canvas/promoVideo.js +106 -15
- package/lib/features/canvas/promoVideo.js.map +1 -1
- package/lib/features/canvas/reframe.js +228 -0
- package/lib/features/canvas/reframe.js.map +1 -0
- package/lib/features/canvas/serverTasks.js +697 -0
- package/lib/features/canvas/serverTasks.js.map +1 -0
- package/lib/features/canvas/set/SetViewportWebView.js +207 -28
- package/lib/features/canvas/set/SetViewportWebView.js.map +1 -1
- package/lib/features/canvas/set/agent/prompt.js +66 -0
- package/lib/features/canvas/set/agent/prompt.js.map +1 -0
- package/lib/features/canvas/set/agent/setOps.js +203 -0
- package/lib/features/canvas/set/agent/setOps.js.map +1 -0
- package/lib/features/canvas/set/agent/setTurn.js +128 -0
- package/lib/features/canvas/set/agent/setTurn.js.map +1 -0
- package/lib/features/canvas/set/agent/snapshot.js +43 -0
- package/lib/features/canvas/set/agent/snapshot.js.map +1 -0
- package/lib/features/canvas/set/agent/tools.js +580 -0
- package/lib/features/canvas/set/agent/tools.js.map +1 -0
- package/lib/features/canvas/set/setProject.js +43 -4
- package/lib/features/canvas/set/setProject.js.map +1 -1
- package/lib/features/canvas/set/supplyLibrary.js +397 -0
- package/lib/features/canvas/set/supplyLibrary.js.map +1 -0
- package/lib/features/canvas/storageLibrary.js +113 -52
- package/lib/features/canvas/storageLibrary.js.map +1 -1
- package/lib/features/canvas/studioCatalog.js +15 -2
- package/lib/features/canvas/studioCatalog.js.map +1 -1
- package/lib/features/canvas/studioLooks.js +1 -8
- package/lib/features/canvas/studioLooks.js.map +1 -1
- package/lib/features/canvas/useBoardMediaRefresh.js +66 -0
- package/lib/features/canvas/useBoardMediaRefresh.js.map +1 -0
- package/lib/features/canvas/useMediaSource.js +84 -0
- package/lib/features/canvas/useMediaSource.js.map +1 -0
- package/lib/features/canvas/video3d.js +11 -10
- package/lib/features/canvas/video3d.js.map +1 -1
- package/lib/features/canvas/videoEditor/BlurBoxOverlay.js +46 -0
- package/lib/features/canvas/videoEditor/BlurBoxOverlay.js.map +1 -0
- package/lib/features/canvas/videoEditor/ExportTaskCard.js +134 -0
- package/lib/features/canvas/videoEditor/ExportTaskCard.js.map +1 -0
- package/lib/features/canvas/videoEditor/agent/AgentCutPane.js +45 -7
- package/lib/features/canvas/videoEditor/agent/AgentCutPane.js.map +1 -1
- package/lib/features/canvas/videoEditor/agent/agentLoop.js +4 -2
- package/lib/features/canvas/videoEditor/agent/agentLoop.js.map +1 -1
- package/lib/features/canvas/videoEditor/agent/attachments.js +304 -0
- package/lib/features/canvas/videoEditor/agent/attachments.js.map +1 -0
- package/lib/features/canvas/videoEditor/agent/brainClient.js +3 -2
- package/lib/features/canvas/videoEditor/agent/brainClient.js.map +1 -1
- package/lib/features/canvas/videoEditor/agent/cutTools.js +207 -7
- package/lib/features/canvas/videoEditor/agent/cutTools.js.map +1 -1
- package/lib/features/canvas/videoEditor/blurBox.js +34 -0
- package/lib/features/canvas/videoEditor/blurBox.js.map +1 -0
- package/lib/features/canvas/videoEditor/compileTimeline.js +668 -0
- package/lib/features/canvas/videoEditor/compileTimeline.js.map +1 -0
- package/lib/features/canvas/videoEditor/editorModel.js +56 -22
- package/lib/features/canvas/videoEditor/editorModel.js.map +1 -1
- package/lib/features/canvas/videoEditor/exportPipeline.js +77 -0
- package/lib/features/canvas/videoEditor/exportPipeline.js.map +1 -0
- package/lib/features/canvas/videoEditor/exportRenderer.js +19 -12
- package/lib/features/canvas/videoEditor/exportRenderer.js.map +1 -1
- package/lib/features/canvas/videoEditor/exportTask.js +216 -0
- package/lib/features/canvas/videoEditor/exportTask.js.map +1 -0
- package/lib/features/canvas/videoEditor/formWidgets.js +142 -0
- package/lib/features/canvas/videoEditor/formWidgets.js.map +1 -0
- package/lib/features/canvas/videoEditor/produce/ProduceVideoSheet.js +195 -0
- package/lib/features/canvas/videoEditor/produce/ProduceVideoSheet.js.map +1 -0
- package/lib/features/canvas/videoEditor/produce/produceScenes.js +158 -0
- package/lib/features/canvas/videoEditor/produce/produceScenes.js.map +1 -0
- package/lib/features/canvas/videoEditor/remoteMediaClient.js +17 -5
- package/lib/features/canvas/videoEditor/remoteMediaClient.js.map +1 -1
- package/lib/features/canvas/videoEditor/renderTimeline.js +207 -0
- package/lib/features/canvas/videoEditor/renderTimeline.js.map +1 -0
- package/lib/features/canvas/videoEditor/renewLinks.js +64 -0
- package/lib/features/canvas/videoEditor/renewLinks.js.map +1 -0
- package/lib/features/canvas/videoEditor/sceneLayers.js +101 -0
- package/lib/features/canvas/videoEditor/sceneLayers.js.map +1 -0
- package/lib/features/canvas/videoEditor/tools/ToolsDrawer.js +283 -0
- package/lib/features/canvas/videoEditor/tools/ToolsDrawer.js.map +1 -0
- package/lib/features/canvas/videoEditor/tools/catalog.js +576 -0
- package/lib/features/canvas/videoEditor/tools/catalog.js.map +1 -0
- package/lib/features/canvas/videoEditor/videoProjectsStore.js +27 -3
- package/lib/features/canvas/videoEditor/videoProjectsStore.js.map +1 -1
- package/lib/features/webbuilder/WebBuilderExperience.js +29 -1
- package/lib/features/webbuilder/WebBuilderExperience.js.map +1 -1
- package/lib/features/webbuilder/buildFragments.js +8 -4
- package/lib/features/webbuilder/buildFragments.js.map +1 -1
- package/lib/features/webbuilder/codezenHandoff.js +108 -0
- package/lib/features/webbuilder/codezenHandoff.js.map +1 -0
- package/lib/features/webbuilder/workflow.js.map +1 -1
- package/lib/hooks/useChatApi.js +1 -2
- package/lib/hooks/useChatApi.js.map +1 -1
- package/lib/screens/CanvasBoard/index.js +12 -1
- package/lib/screens/CanvasBoard/index.js.map +1 -1
- package/lib/screens/Home/HomeScreen.js.map +1 -1
- package/lib/screens/Home/components/HomeSuggestions.js +3 -3
- package/lib/screens/Home/components/HomeSuggestions.js.map +1 -1
- package/lib/screens/WebBuilder/index.js +4 -2
- package/lib/screens/WebBuilder/index.js.map +1 -1
- package/lib/screens/WebBuilderNative/index.js +29 -2
- package/lib/screens/WebBuilderNative/index.js.map +1 -1
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js +30 -6
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js.map +1 -1
- package/package.json +4 -4
- /package/lib/assets/apps/{paper2poster.webp → poster.webp} +0 -0
|
@@ -0,0 +1,668 @@
|
|
|
1
|
+
import {DEFAULT_IMAGE_SEC}from'./editorModel.js';import {colorFromSolidSrc,solidColorPngDataUrl}from'./solidColorPng.js';var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
const MIN_HOLD_SLOWDOWN = 0.8;
|
|
18
|
+
const DEFAULT_CANVAS = {
|
|
19
|
+
width: 1280,
|
|
20
|
+
height: 720
|
|
21
|
+
};
|
|
22
|
+
const FILTER_GRADE = {
|
|
23
|
+
none: null,
|
|
24
|
+
cinematic: {
|
|
25
|
+
contrast: 1.12,
|
|
26
|
+
saturation: 0.92,
|
|
27
|
+
brightness: -0.04
|
|
28
|
+
},
|
|
29
|
+
film: {
|
|
30
|
+
saturation: 0.85,
|
|
31
|
+
gamma: 1.05,
|
|
32
|
+
brightness: 0.03
|
|
33
|
+
},
|
|
34
|
+
kodak: {
|
|
35
|
+
saturation: 1.15,
|
|
36
|
+
gamma: 0.95,
|
|
37
|
+
hue: 8
|
|
38
|
+
},
|
|
39
|
+
mono: {
|
|
40
|
+
saturation: 0,
|
|
41
|
+
contrast: 1.08
|
|
42
|
+
},
|
|
43
|
+
vivid: {
|
|
44
|
+
contrast: 1.15,
|
|
45
|
+
saturation: 1.35
|
|
46
|
+
},
|
|
47
|
+
warm: {
|
|
48
|
+
hue: -12,
|
|
49
|
+
saturation: 1.08,
|
|
50
|
+
brightness: 0.03
|
|
51
|
+
},
|
|
52
|
+
cool: {
|
|
53
|
+
hue: 12,
|
|
54
|
+
saturation: 0.95
|
|
55
|
+
},
|
|
56
|
+
dreamy: {
|
|
57
|
+
blur: 4,
|
|
58
|
+
brightness: 0.06,
|
|
59
|
+
saturation: 1.1
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const ZOOM_SCALE = {
|
|
63
|
+
subtle: 1.5,
|
|
64
|
+
moderate: 2,
|
|
65
|
+
strong: 2.6
|
|
66
|
+
};
|
|
67
|
+
const urlRef = (url) => ({
|
|
68
|
+
kind: "url",
|
|
69
|
+
url
|
|
70
|
+
});
|
|
71
|
+
const stepRef = (index) => ({
|
|
72
|
+
kind: "step",
|
|
73
|
+
index
|
|
74
|
+
});
|
|
75
|
+
const pctToPx = (pct, dim) => Math.round(pct / 100 * dim);
|
|
76
|
+
const evenPx = (px) => Math.max(2, Math.round(px / 2) * 2);
|
|
77
|
+
const clamp = (v, lo, hi) => Math.min(hi, Math.max(lo, v));
|
|
78
|
+
const r3 = (v) => Math.round(v * 1e3) / 1e3;
|
|
79
|
+
function specClipSec(clip) {
|
|
80
|
+
var _a, _b, _c;
|
|
81
|
+
if (clip.type === "image") return ((_a = clip.durationSec) != null ? _a : DEFAULT_IMAGE_SEC) / clip.speed;
|
|
82
|
+
const end = (_c = (_b = clip.trimEndSec) != null ? _b : clip.sourceDurationSec) != null ? _c : null;
|
|
83
|
+
if (end === null) return 0;
|
|
84
|
+
return Math.max(0, end - clip.trimStartSec) / clip.speed;
|
|
85
|
+
}
|
|
86
|
+
function canvasForAspect(width, height) {
|
|
87
|
+
if (!(width > 0) || !(height > 0)) return __spreadValues({}, DEFAULT_CANVAS);
|
|
88
|
+
const ratio = width / height;
|
|
89
|
+
if (ratio < 0.9) return {
|
|
90
|
+
width: 720,
|
|
91
|
+
height: 1280
|
|
92
|
+
};
|
|
93
|
+
if (ratio <= 1.1) return {
|
|
94
|
+
width: 1080,
|
|
95
|
+
height: 1080
|
|
96
|
+
};
|
|
97
|
+
return __spreadValues({}, DEFAULT_CANVAS);
|
|
98
|
+
}
|
|
99
|
+
function canvasForRatio(ratio) {
|
|
100
|
+
const m = /^(\d+(?:\.\d+)?)\s*[:x/]\s*(\d+(?:\.\d+)?)$/.exec((ratio != null ? ratio : "").trim());
|
|
101
|
+
return m ? canvasForAspect(Number(m[1]), Number(m[2])) : void 0;
|
|
102
|
+
}
|
|
103
|
+
function zoomWindow(z) {
|
|
104
|
+
var _a;
|
|
105
|
+
const side = 100 / ((_a = ZOOM_SCALE[z.depth]) != null ? _a : ZOOM_SCALE.moderate);
|
|
106
|
+
return {
|
|
107
|
+
x: z.x / 100 * (100 - side),
|
|
108
|
+
y: z.y / 100 * (100 - side),
|
|
109
|
+
width: side,
|
|
110
|
+
height: side
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
const segEnd = (s) => s.startSec + s.durationSec;
|
|
114
|
+
const covering = (segs, kind, t) => segs.find((s) => s.kind === kind && t >= s.startSec && t < segEnd(s));
|
|
115
|
+
function windowAt(segs, t) {
|
|
116
|
+
var _a, _b;
|
|
117
|
+
const z = (_a = covering(segs, "zoom", t)) == null ? void 0 : _a.zoom;
|
|
118
|
+
if (z) return zoomWindow(z);
|
|
119
|
+
const c = (_b = covering(segs, "crop", t)) == null ? void 0 : _b.crop;
|
|
120
|
+
if (!c) return null;
|
|
121
|
+
const width = clamp(c.width, 5, 100);
|
|
122
|
+
const height = clamp(c.height, 5, 100);
|
|
123
|
+
return {
|
|
124
|
+
x: clamp(c.x, 0, 100 - width),
|
|
125
|
+
y: clamp(c.y, 0, 100 - height),
|
|
126
|
+
width,
|
|
127
|
+
height
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function trimAt(segs, t) {
|
|
131
|
+
let end = null;
|
|
132
|
+
for (const s of [...segs].sort((a, b) => a.startSec - b.startSec)) {
|
|
133
|
+
const cursor = end != null ? end : t;
|
|
134
|
+
if (s.kind === "trim" && s.startSec <= cursor && cursor < segEnd(s)) end = segEnd(s);
|
|
135
|
+
}
|
|
136
|
+
return end;
|
|
137
|
+
}
|
|
138
|
+
function segmentPieces(segments, durationSec) {
|
|
139
|
+
var _a, _b;
|
|
140
|
+
const segs = segments.filter((s) => s.kind !== "blur" && s.durationSec > 0);
|
|
141
|
+
if (!segs.length || durationSec <= 0) return [];
|
|
142
|
+
const cuts = [.../* @__PURE__ */ new Set([0, durationSec, ...segs.flatMap((s) => [s.startSec, segEnd(s)])])].filter((t) => t >= 0 && t <= durationSec).sort((a, b) => a - b);
|
|
143
|
+
const out = [];
|
|
144
|
+
for (let i = 1; i < cuts.length; i++) {
|
|
145
|
+
const from = cuts[i - 1];
|
|
146
|
+
const to = cuts[i];
|
|
147
|
+
const mid = (from + to) / 2;
|
|
148
|
+
if (to <= from || trimAt(segs, mid) != null) continue;
|
|
149
|
+
const speed = (_b = (_a = covering(segs, "speed", mid)) == null ? void 0 : _a.speed) != null ? _b : 1;
|
|
150
|
+
const window = windowAt(segs, mid);
|
|
151
|
+
out.push(__spreadValues(__spreadValues({
|
|
152
|
+
from,
|
|
153
|
+
to
|
|
154
|
+
}, speed !== 1 ? {
|
|
155
|
+
speed
|
|
156
|
+
} : {}), window ? {
|
|
157
|
+
window
|
|
158
|
+
} : {}));
|
|
159
|
+
}
|
|
160
|
+
return out;
|
|
161
|
+
}
|
|
162
|
+
function compileTimeline(spec, options = {}) {
|
|
163
|
+
var _a, _b, _c;
|
|
164
|
+
const steps = [];
|
|
165
|
+
const warnings = [];
|
|
166
|
+
const push = (s) => steps.push(s) - 1;
|
|
167
|
+
const canvas = (_b = (_a = options.canvas) != null ? _a : spec.canvas) != null ? _b : DEFAULT_CANVAS;
|
|
168
|
+
const canvasW = evenPx(canvas.width);
|
|
169
|
+
const canvasH = evenPx(canvas.height);
|
|
170
|
+
const fps = spec.fps || 30;
|
|
171
|
+
const clips = spec.clips;
|
|
172
|
+
if (clips.length === 0) {
|
|
173
|
+
return {
|
|
174
|
+
steps: [],
|
|
175
|
+
finalRef: urlRef(""),
|
|
176
|
+
warnings: ["Nothing to render - add a scene first."]
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
const spans = [];
|
|
180
|
+
{
|
|
181
|
+
let cursor = 0;
|
|
182
|
+
for (const clip of clips) {
|
|
183
|
+
const len = specClipSec(clip);
|
|
184
|
+
spans.push({
|
|
185
|
+
start: cursor,
|
|
186
|
+
end: cursor + len
|
|
187
|
+
});
|
|
188
|
+
cursor += len;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
const totalSec = spans.length ? spans[spans.length - 1].end : 0;
|
|
192
|
+
if (clips.some((c) => c.type === "video" && specClipSec(c) === 0)) {
|
|
193
|
+
warnings.push("A video without a known length sits in the cut, so titles and segments after it may land early.");
|
|
194
|
+
}
|
|
195
|
+
const stillSrc = (clip) => {
|
|
196
|
+
const fill = clip.fillColor || colorFromSolidSrc(clip.src);
|
|
197
|
+
if (!fill) return clip.src;
|
|
198
|
+
const scale = 640 / Math.max(canvasW, canvasH);
|
|
199
|
+
return solidColorPngDataUrl(fill, Math.round(canvasW * scale), Math.round(canvasH * scale));
|
|
200
|
+
};
|
|
201
|
+
const holdMs = (index) => {
|
|
202
|
+
var _a2, _b2, _c2;
|
|
203
|
+
return (_c2 = (_b2 = (_a2 = clips[index + 1]) == null ? void 0 : _a2.transitionIn) == null ? void 0 : _b2.durationMs) != null ? _c2 : 0;
|
|
204
|
+
};
|
|
205
|
+
let unheldMs = 0;
|
|
206
|
+
const levelOps = (ref, clip) => {
|
|
207
|
+
if (clip.type !== "video") return ref;
|
|
208
|
+
if (clip.muted || clip.volume <= 0) {
|
|
209
|
+
return stepRef(push({
|
|
210
|
+
op: "mute",
|
|
211
|
+
label: "Mute",
|
|
212
|
+
primaryInput: ref,
|
|
213
|
+
params: {}
|
|
214
|
+
}));
|
|
215
|
+
}
|
|
216
|
+
if (clip.volume < 0.99) {
|
|
217
|
+
return stepRef(push({
|
|
218
|
+
op: "volume",
|
|
219
|
+
label: `Volume ${Math.round(clip.volume * 100)}%`,
|
|
220
|
+
primaryInput: ref,
|
|
221
|
+
params: {
|
|
222
|
+
level: clip.volume
|
|
223
|
+
}
|
|
224
|
+
}));
|
|
225
|
+
}
|
|
226
|
+
return ref;
|
|
227
|
+
};
|
|
228
|
+
const segmentRefs = clips.map((clip, index) => {
|
|
229
|
+
var _a2, _b2, _c2;
|
|
230
|
+
const hold = holdMs(index);
|
|
231
|
+
let ref;
|
|
232
|
+
if (clip.type === "image") {
|
|
233
|
+
const seconds = specClipSec(clip) + hold / 1e3;
|
|
234
|
+
if (clip.kenBurns) {
|
|
235
|
+
ref = stepRef(push({
|
|
236
|
+
op: "ken_burns",
|
|
237
|
+
label: `Ken Burns (${clip.kenBurns.direction})`,
|
|
238
|
+
primaryInput: urlRef(stillSrc(clip)),
|
|
239
|
+
params: {
|
|
240
|
+
width: canvasW,
|
|
241
|
+
height: canvasH,
|
|
242
|
+
fps,
|
|
243
|
+
duration_ms: Math.round(seconds * 1e3),
|
|
244
|
+
zoom_start: clip.kenBurns.zoomStart,
|
|
245
|
+
zoom_end: clip.kenBurns.zoomEnd,
|
|
246
|
+
direction: clip.kenBurns.direction
|
|
247
|
+
}
|
|
248
|
+
}));
|
|
249
|
+
} else {
|
|
250
|
+
ref = stepRef(push({
|
|
251
|
+
op: "slideshow",
|
|
252
|
+
label: `Image \u2192 ${seconds.toFixed(1)}s clip`,
|
|
253
|
+
primaryInput: urlRef(stillSrc(clip)),
|
|
254
|
+
params: {
|
|
255
|
+
duration_per_image: r3(seconds),
|
|
256
|
+
fps
|
|
257
|
+
}
|
|
258
|
+
}));
|
|
259
|
+
}
|
|
260
|
+
} else {
|
|
261
|
+
let trimEnd = clip.trimEndSec;
|
|
262
|
+
let speed = clip.speed;
|
|
263
|
+
if (hold > 0) {
|
|
264
|
+
const source = clip.sourceDurationSec;
|
|
265
|
+
const outPoint = (_a2 = trimEnd != null ? trimEnd : source) != null ? _a2 : null;
|
|
266
|
+
const extended = outPoint === null ? null : outPoint + hold / 1e3 * speed;
|
|
267
|
+
if (source && extended !== null && extended <= source + 1e-6) {
|
|
268
|
+
trimEnd = r3(extended);
|
|
269
|
+
} else if (source && outPoint !== null) {
|
|
270
|
+
const len = (outPoint - clip.trimStartSec) / speed;
|
|
271
|
+
const slowed = Math.floor((source - clip.trimStartSec) / (len + hold / 1e3) * 1e3) / 1e3;
|
|
272
|
+
if (slowed >= speed * MIN_HOLD_SLOWDOWN) {
|
|
273
|
+
trimEnd = source;
|
|
274
|
+
speed = slowed;
|
|
275
|
+
} else unheldMs += hold;
|
|
276
|
+
} else unheldMs += hold;
|
|
277
|
+
}
|
|
278
|
+
ref = urlRef(clip.src);
|
|
279
|
+
const coversSource = clip.trimStartSec <= 0 && (trimEnd === null || clip.sourceDurationSec != null && trimEnd >= clip.sourceDurationSec);
|
|
280
|
+
if (!coversSource) {
|
|
281
|
+
const end = (_b2 = trimEnd != null ? trimEnd : clip.sourceDurationSec) != null ? _b2 : null;
|
|
282
|
+
ref = stepRef(push({
|
|
283
|
+
op: "trim",
|
|
284
|
+
label: `Trim ${clip.trimStartSec.toFixed(1)}\u2013${end === null ? "end" : `${end.toFixed(1)}s`}`,
|
|
285
|
+
primaryInput: ref,
|
|
286
|
+
params: __spreadValues({
|
|
287
|
+
start_secs: clip.trimStartSec
|
|
288
|
+
}, end === null ? {} : {
|
|
289
|
+
end_secs: end
|
|
290
|
+
})
|
|
291
|
+
}));
|
|
292
|
+
}
|
|
293
|
+
if (speed !== 1) {
|
|
294
|
+
ref = stepRef(push({
|
|
295
|
+
op: "speed",
|
|
296
|
+
label: `Speed \xD7${speed}`,
|
|
297
|
+
primaryInput: ref,
|
|
298
|
+
params: {
|
|
299
|
+
factor: speed
|
|
300
|
+
}
|
|
301
|
+
}));
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
const grade = (_c2 = FILTER_GRADE[clip.filter]) != null ? _c2 : null;
|
|
305
|
+
if (grade) {
|
|
306
|
+
ref = stepRef(push({
|
|
307
|
+
op: "color_adjust",
|
|
308
|
+
label: `Grade (${clip.filter})`,
|
|
309
|
+
primaryInput: ref,
|
|
310
|
+
params: __spreadValues({}, grade)
|
|
311
|
+
}));
|
|
312
|
+
}
|
|
313
|
+
return levelOps(ref, clip);
|
|
314
|
+
});
|
|
315
|
+
const segments = (_c = spec.segments) != null ? _c : [];
|
|
316
|
+
const pieces = segmentPieces(segments, totalSec);
|
|
317
|
+
const blurs = segments.filter((s) => s.kind === "blur" && s.blur && s.durationSec > 0);
|
|
318
|
+
const mixedSources = new Set(clips.map((c) => `${c.fillColor || colorFromSolidSrc(c.src) ? "solid" : c.src}|${c.kenBurns ? "kb" : "raw"}`)).size > 1;
|
|
319
|
+
const normalized = clips.length > 1 && mixedSources || pieces.some((p) => p.window) || blurs.length > 0;
|
|
320
|
+
if (normalized) {
|
|
321
|
+
for (let i = 0; i < segmentRefs.length; i++) {
|
|
322
|
+
segmentRefs[i] = stepRef(push({
|
|
323
|
+
op: "letterbox",
|
|
324
|
+
label: `Fit scene ${i + 1} \u2192 ${canvasW}\xD7${canvasH}`,
|
|
325
|
+
primaryInput: segmentRefs[i],
|
|
326
|
+
params: {
|
|
327
|
+
width: canvasW,
|
|
328
|
+
height: canvasH,
|
|
329
|
+
color: "black"
|
|
330
|
+
}
|
|
331
|
+
}));
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
const textStep = (base, t, from, to) => stepRef(push({
|
|
335
|
+
op: "overlay_text",
|
|
336
|
+
label: `Text "${t.text.slice(0, 24)}"`,
|
|
337
|
+
primaryInput: base,
|
|
338
|
+
params: {
|
|
339
|
+
text: t.text,
|
|
340
|
+
// Normalized editor position -> ffmpeg expressions on the real frame, text-centre anchored.
|
|
341
|
+
x: `(w-text_w)*${t.x.toFixed(3)}`,
|
|
342
|
+
y: `(h-text_h)*${t.y.toFixed(3)}`,
|
|
343
|
+
font_size: 36,
|
|
344
|
+
font_color: "white",
|
|
345
|
+
start_secs: r3(Math.max(0, from)),
|
|
346
|
+
end_secs: r3(to)
|
|
347
|
+
}
|
|
348
|
+
}));
|
|
349
|
+
const sceneIndex = new Map(clips.map((c, i) => [c.id, i]).filter(([id]) => !!id));
|
|
350
|
+
const crosses = (i) => Boolean(clips[i].transitionIn) || holdMs(i) > 0;
|
|
351
|
+
const frame = 1 / fps;
|
|
352
|
+
const ridesScene = /* @__PURE__ */ new Set();
|
|
353
|
+
let cutAtTransition = 0;
|
|
354
|
+
const texts = spec.texts.filter((t) => t.text.trim() && t.durationSec > 0);
|
|
355
|
+
texts.forEach((t, k) => {
|
|
356
|
+
const i = t.sceneId == null ? void 0 : sceneIndex.get(t.sceneId);
|
|
357
|
+
if (i === void 0 || !crosses(i)) return;
|
|
358
|
+
const span = spans[i];
|
|
359
|
+
const end = t.startSec + t.durationSec;
|
|
360
|
+
const inside = t.startSec >= span.start - frame && end <= span.end + frame;
|
|
361
|
+
const covered = texts.slice(0, k).some((below) => !ridesScene.has(below.id) && below.startSec < end && below.startSec + below.durationSec > t.startSec);
|
|
362
|
+
if (!inside || covered) {
|
|
363
|
+
cutAtTransition += 1;
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
ridesScene.add(t.id);
|
|
367
|
+
const heldThroughCut = end >= span.end - frame;
|
|
368
|
+
segmentRefs[i] = textStep(segmentRefs[i], t, t.startSec - span.start, end - span.start + (heldThroughCut ? holdMs(i) / 1e3 : 0));
|
|
369
|
+
});
|
|
370
|
+
if (cutAtTransition > 0) {
|
|
371
|
+
warnings.push(`${cutAtTransition} title${cutAtTransition === 1 ? "" : "s"} of a scene with a transition run${cutAtTransition === 1 ? "s" : ""} past the scene, so ${cutAtTransition === 1 ? "it cuts" : "they cut"} at the transition instead of crossing it.`);
|
|
372
|
+
}
|
|
373
|
+
let baseRef = segmentRefs[0];
|
|
374
|
+
let pending = [];
|
|
375
|
+
const flush = () => {
|
|
376
|
+
if (!pending.length) return;
|
|
377
|
+
baseRef = stepRef(push({
|
|
378
|
+
op: "concat",
|
|
379
|
+
label: `Join ${pending.length + 1} clips`,
|
|
380
|
+
primaryInput: baseRef,
|
|
381
|
+
params: {
|
|
382
|
+
reencode: true
|
|
383
|
+
},
|
|
384
|
+
inputRefs: {
|
|
385
|
+
input_urls: pending
|
|
386
|
+
}
|
|
387
|
+
}));
|
|
388
|
+
pending = [];
|
|
389
|
+
};
|
|
390
|
+
for (let i = 1; i < segmentRefs.length; i++) {
|
|
391
|
+
const transition = clips[i].transitionIn;
|
|
392
|
+
if (!transition || !(transition.durationMs > 0)) {
|
|
393
|
+
pending.push(segmentRefs[i]);
|
|
394
|
+
continue;
|
|
395
|
+
}
|
|
396
|
+
flush();
|
|
397
|
+
baseRef = stepRef(push({
|
|
398
|
+
op: "transition",
|
|
399
|
+
label: `Transition (${transition.effect})`,
|
|
400
|
+
primaryInput: baseRef,
|
|
401
|
+
params: {
|
|
402
|
+
effect: transition.effect,
|
|
403
|
+
duration_ms: transition.durationMs
|
|
404
|
+
},
|
|
405
|
+
inputRefs: {
|
|
406
|
+
input2_url: segmentRefs[i]
|
|
407
|
+
}
|
|
408
|
+
}));
|
|
409
|
+
}
|
|
410
|
+
flush();
|
|
411
|
+
if (unheldMs > 0) {
|
|
412
|
+
warnings.push(`A transition after a video clip overlaps the two clips, so the export runs ${(unheldMs / 1e3).toFixed(1)}s shorter than the timeline and later titles land that much late; end that clip earlier in its source, put a still before it, or cut instead.`);
|
|
413
|
+
}
|
|
414
|
+
for (const t of texts) {
|
|
415
|
+
if (!ridesScene.has(t.id)) baseRef = textStep(baseRef, t, t.startSec, t.startSec + t.durationSec);
|
|
416
|
+
}
|
|
417
|
+
for (const seg of blurs) {
|
|
418
|
+
const b = seg.blur;
|
|
419
|
+
const x = Math.floor(pctToPx(b.x, canvasW) / 2) * 2;
|
|
420
|
+
const y = Math.floor(pctToPx(b.y, canvasH) / 2) * 2;
|
|
421
|
+
const span = stepRef(push({
|
|
422
|
+
op: "trim",
|
|
423
|
+
label: `Blur span ${seg.startSec.toFixed(1)}\u2013${segEnd(seg).toFixed(1)}s`,
|
|
424
|
+
primaryInput: baseRef,
|
|
425
|
+
params: {
|
|
426
|
+
start_secs: r3(seg.startSec),
|
|
427
|
+
end_secs: r3(segEnd(seg))
|
|
428
|
+
}
|
|
429
|
+
}));
|
|
430
|
+
const blurred = stepRef(push({
|
|
431
|
+
op: "blur",
|
|
432
|
+
label: `Blur ${b.radius}px`,
|
|
433
|
+
primaryInput: span,
|
|
434
|
+
params: {
|
|
435
|
+
radius: b.radius
|
|
436
|
+
}
|
|
437
|
+
}));
|
|
438
|
+
const box = stepRef(push({
|
|
439
|
+
op: "crop",
|
|
440
|
+
label: "Blur box",
|
|
441
|
+
primaryInput: blurred,
|
|
442
|
+
params: {
|
|
443
|
+
x: String(x),
|
|
444
|
+
y: String(y),
|
|
445
|
+
width: String(Math.min(evenPx(pctToPx(b.width, canvasW)), canvasW - x)),
|
|
446
|
+
height: String(Math.min(evenPx(pctToPx(b.height, canvasH)), canvasH - y))
|
|
447
|
+
}
|
|
448
|
+
}));
|
|
449
|
+
baseRef = stepRef(push({
|
|
450
|
+
op: "picture_in_picture",
|
|
451
|
+
label: `Paste ${seg.name || "blur"}`,
|
|
452
|
+
primaryInput: baseRef,
|
|
453
|
+
params: {
|
|
454
|
+
x,
|
|
455
|
+
y,
|
|
456
|
+
start_ms: Math.round(seg.startSec * 1e3),
|
|
457
|
+
end_ms: Math.round(segEnd(seg) * 1e3)
|
|
458
|
+
},
|
|
459
|
+
inputRefs: {
|
|
460
|
+
overlay_url: box
|
|
461
|
+
}
|
|
462
|
+
}));
|
|
463
|
+
}
|
|
464
|
+
baseRef = compileAudio(spec, baseRef, spans, push, warnings);
|
|
465
|
+
if (!pieces.length && segments.some((s) => s.kind === "trim" && s.durationSec > 0) && totalSec > 0) {
|
|
466
|
+
warnings.push("Trim segments cover the whole cut - nothing is left to export.");
|
|
467
|
+
}
|
|
468
|
+
const effective = pieces.length > 1 || pieces.some((p) => p.speed || p.window || p.from > 0 || p.to < totalSec);
|
|
469
|
+
if (effective) {
|
|
470
|
+
const refs = pieces.map((piece, i) => {
|
|
471
|
+
let ref = stepRef(push({
|
|
472
|
+
op: "trim",
|
|
473
|
+
label: `Segment ${i + 1}`,
|
|
474
|
+
primaryInput: baseRef,
|
|
475
|
+
params: {
|
|
476
|
+
start_secs: r3(piece.from),
|
|
477
|
+
end_secs: r3(piece.to)
|
|
478
|
+
}
|
|
479
|
+
}));
|
|
480
|
+
if (piece.window) {
|
|
481
|
+
const win = piece.window;
|
|
482
|
+
const w = evenPx(pctToPx(win.width, canvasW));
|
|
483
|
+
const h = evenPx(pctToPx(win.height, canvasH));
|
|
484
|
+
ref = stepRef(push({
|
|
485
|
+
op: "crop",
|
|
486
|
+
label: `Window ${w}\xD7${h}`,
|
|
487
|
+
primaryInput: ref,
|
|
488
|
+
params: {
|
|
489
|
+
x: String(pctToPx(win.x, canvasW)),
|
|
490
|
+
y: String(pctToPx(win.y, canvasH)),
|
|
491
|
+
width: String(w),
|
|
492
|
+
height: String(h)
|
|
493
|
+
}
|
|
494
|
+
}));
|
|
495
|
+
const fills = Math.abs(w / h - canvasW / canvasH) < 0.01;
|
|
496
|
+
ref = stepRef(push(fills ? {
|
|
497
|
+
op: "transcode",
|
|
498
|
+
label: `Window \u2192 ${canvasW}\xD7${canvasH}`,
|
|
499
|
+
primaryInput: ref,
|
|
500
|
+
params: {
|
|
501
|
+
resolution: `${canvasW}x${canvasH}`
|
|
502
|
+
}
|
|
503
|
+
} : {
|
|
504
|
+
op: "letterbox",
|
|
505
|
+
label: `Window \u2192 ${canvasW}\xD7${canvasH}`,
|
|
506
|
+
primaryInput: ref,
|
|
507
|
+
params: {
|
|
508
|
+
width: canvasW,
|
|
509
|
+
height: canvasH,
|
|
510
|
+
color: "black"
|
|
511
|
+
}
|
|
512
|
+
}));
|
|
513
|
+
}
|
|
514
|
+
if (piece.speed) {
|
|
515
|
+
ref = stepRef(push({
|
|
516
|
+
op: "speed",
|
|
517
|
+
label: `Speed \xD7${piece.speed}`,
|
|
518
|
+
primaryInput: ref,
|
|
519
|
+
params: {
|
|
520
|
+
factor: piece.speed
|
|
521
|
+
}
|
|
522
|
+
}));
|
|
523
|
+
}
|
|
524
|
+
return ref;
|
|
525
|
+
});
|
|
526
|
+
baseRef = refs.length > 1 ? stepRef(push({
|
|
527
|
+
op: "concat",
|
|
528
|
+
label: `Join ${refs.length} segments`,
|
|
529
|
+
primaryInput: refs[0],
|
|
530
|
+
params: {
|
|
531
|
+
reencode: true
|
|
532
|
+
},
|
|
533
|
+
inputRefs: {
|
|
534
|
+
input_urls: refs.slice(1)
|
|
535
|
+
}
|
|
536
|
+
})) : refs[0];
|
|
537
|
+
}
|
|
538
|
+
return {
|
|
539
|
+
steps,
|
|
540
|
+
finalRef: baseRef,
|
|
541
|
+
warnings
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
function compileAudio(spec, base, spans, push, warnings) {
|
|
545
|
+
var _a, _b, _c;
|
|
546
|
+
const sceneAudio = ((_a = spec.sceneAudio) != null ? _a : []).filter((a) => a.audioUrl);
|
|
547
|
+
let baseRef = base;
|
|
548
|
+
if (!sceneAudio.length) {
|
|
549
|
+
if (spec.soundtrack) {
|
|
550
|
+
baseRef = stepRef(push({
|
|
551
|
+
op: "add_audio",
|
|
552
|
+
label: "Soundtrack",
|
|
553
|
+
primaryInput: baseRef,
|
|
554
|
+
params: {
|
|
555
|
+
replace_existing: spec.soundtrack.mode === "replace"
|
|
556
|
+
},
|
|
557
|
+
inputRefs: {
|
|
558
|
+
audio_input_url: urlRef(spec.soundtrack.audioUrl)
|
|
559
|
+
}
|
|
560
|
+
}));
|
|
561
|
+
}
|
|
562
|
+
if (spec.voiceover) {
|
|
563
|
+
baseRef = stepRef(push({
|
|
564
|
+
op: "add_audio",
|
|
565
|
+
label: "Voiceover",
|
|
566
|
+
primaryInput: baseRef,
|
|
567
|
+
// A replace-mode voiceover must not erase the soundtrack muxed a step earlier.
|
|
568
|
+
params: {
|
|
569
|
+
replace_existing: spec.voiceover.mode === "replace" && !spec.soundtrack
|
|
570
|
+
},
|
|
571
|
+
inputRefs: {
|
|
572
|
+
audio_input_url: urlRef(spec.voiceover.audioUrl)
|
|
573
|
+
}
|
|
574
|
+
}));
|
|
575
|
+
}
|
|
576
|
+
return baseRef;
|
|
577
|
+
}
|
|
578
|
+
const refs = [];
|
|
579
|
+
const lane = (src, at, sliceFrom, sliceTo, level, label) => {
|
|
580
|
+
let ref = urlRef(src);
|
|
581
|
+
if (sliceFrom > 0 || sliceTo !== null) {
|
|
582
|
+
ref = stepRef(push({
|
|
583
|
+
op: "trim",
|
|
584
|
+
label: `Trim ${label}`,
|
|
585
|
+
primaryInput: ref,
|
|
586
|
+
params: __spreadValues({
|
|
587
|
+
start_secs: r3(sliceFrom)
|
|
588
|
+
}, sliceTo === null ? {} : {
|
|
589
|
+
end_secs: r3(sliceTo)
|
|
590
|
+
}),
|
|
591
|
+
audioOnly: true
|
|
592
|
+
}));
|
|
593
|
+
}
|
|
594
|
+
if (level < 0.99) {
|
|
595
|
+
ref = stepRef(push({
|
|
596
|
+
op: "volume",
|
|
597
|
+
label: `${label} ${Math.round(level * 100)}%`,
|
|
598
|
+
primaryInput: ref,
|
|
599
|
+
params: {
|
|
600
|
+
level
|
|
601
|
+
}
|
|
602
|
+
}));
|
|
603
|
+
}
|
|
604
|
+
if (at > 5e-4) {
|
|
605
|
+
ref = stepRef(push({
|
|
606
|
+
op: "audio_delay",
|
|
607
|
+
label: `${label} at ${at.toFixed(1)}s`,
|
|
608
|
+
primaryInput: ref,
|
|
609
|
+
params: {
|
|
610
|
+
delay_ms: Math.round(at * 1e3)
|
|
611
|
+
},
|
|
612
|
+
audioOnly: true
|
|
613
|
+
}));
|
|
614
|
+
}
|
|
615
|
+
refs.push(ref);
|
|
616
|
+
};
|
|
617
|
+
const replaced = ((_b = spec.soundtrack) == null ? void 0 : _b.mode) === "replace" || ((_c = spec.voiceover) == null ? void 0 : _c.mode) === "replace";
|
|
618
|
+
if (!replaced) {
|
|
619
|
+
let skipped = 0;
|
|
620
|
+
spec.clips.forEach((clip, i) => {
|
|
621
|
+
if (clip.type !== "video" || clip.muted || clip.volume <= 0 || clip.hasAudio === false) return;
|
|
622
|
+
const len = spans[i].end - spans[i].start;
|
|
623
|
+
if (clip.speed !== 1 || len <= 0) {
|
|
624
|
+
skipped += 1;
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
lane(clip.src, spans[i].start, clip.trimStartSec, clip.trimStartSec + len, clip.volume, `Scene ${i + 1} sound`);
|
|
628
|
+
});
|
|
629
|
+
if (skipped) {
|
|
630
|
+
warnings.push(`${skipped} sped-up or open-ended video scene${skipped === 1 ? "" : "s"} lose${skipped === 1 ? "s" : ""} its own sound where scene audio is mixed in.`);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
if (spec.soundtrack) lane(spec.soundtrack.audioUrl, 0, 0, null, 1, "Soundtrack");
|
|
634
|
+
if (spec.voiceover) lane(spec.voiceover.audioUrl, 0, 0, null, 1, "Voiceover");
|
|
635
|
+
sceneAudio.forEach((a, i) => {
|
|
636
|
+
var _a2, _b2;
|
|
637
|
+
return lane(a.audioUrl, a.startSec, 0, a.durationSec, (_a2 = a.volume) != null ? _a2 : 1, ((_b2 = a.label) == null ? void 0 : _b2.slice(0, 20)) || `Audio ${i + 1}`);
|
|
638
|
+
});
|
|
639
|
+
const [first, ...rest] = refs;
|
|
640
|
+
const mixRef = rest.length ? stepRef(push({
|
|
641
|
+
op: "audio_mix",
|
|
642
|
+
label: `Mix ${refs.length} audio clips`,
|
|
643
|
+
primaryInput: first,
|
|
644
|
+
params: {
|
|
645
|
+
duration: "longest",
|
|
646
|
+
normalize: false
|
|
647
|
+
},
|
|
648
|
+
inputRefs: {
|
|
649
|
+
input_urls: rest
|
|
650
|
+
},
|
|
651
|
+
audioOnly: true
|
|
652
|
+
})) : first;
|
|
653
|
+
return stepRef(push({
|
|
654
|
+
op: "add_audio",
|
|
655
|
+
label: "Set audio",
|
|
656
|
+
primaryInput: baseRef,
|
|
657
|
+
params: {
|
|
658
|
+
replace_existing: true
|
|
659
|
+
},
|
|
660
|
+
inputRefs: {
|
|
661
|
+
audio_input_url: mixRef
|
|
662
|
+
}
|
|
663
|
+
}));
|
|
664
|
+
}
|
|
665
|
+
function specMixesSceneAudio(spec) {
|
|
666
|
+
var _a;
|
|
667
|
+
return ((_a = spec.sceneAudio) != null ? _a : []).some((a) => a.audioUrl);
|
|
668
|
+
}export{DEFAULT_CANVAS,FILTER_GRADE,MIN_HOLD_SLOWDOWN,ZOOM_SCALE,canvasForAspect,canvasForRatio,compileTimeline,segmentPieces,specClipSec,specMixesSceneAudio,zoomWindow};//# sourceMappingURL=compileTimeline.js.map
|