@mevdragon/vidfarm-devcli 0.20.6 → 0.20.9
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/.agents/skills/editor-capabilities/SKILL.md +15 -1
- package/.agents/skills/vidfarm-director/SKILL.md +106 -0
- package/.agents/skills/vidfarm-director/recipes/find-and-fork-template.md +16 -0
- package/.agents/skills/vidfarm-director/recipes/local-edit-render-approve.md +13 -0
- package/.agents/skills/vidfarm-director/recipes/onboard-a-new-director.md +13 -0
- package/.agents/skills/vidfarm-director/recipes/retheme-template.md +17 -0
- package/.agents/skills/vidfarm-director/references/assets-and-sourcing.md +117 -0
- package/.agents/skills/vidfarm-director/references/automation-and-local-dev.md +245 -0
- package/.agents/skills/vidfarm-director/references/core-workflows.md +273 -0
- package/.agents/skills/vidfarm-director/references/editor-workflows.md +365 -0
- package/.agents/skills/vidfarm-director/references/onboarding.md +28 -0
- package/.agents/skills/vidfarm-director/references/primitives.md +308 -0
- package/SKILL.director.md +517 -250
- package/dist/src/cli.js +563 -99
- package/dist/src/devcli/clips.js +29 -12
- package/dist/src/devcli/doctor.js +2 -2
- package/dist/src/devcli/local-backend.js +46 -2
- package/dist/src/services/clip-curation/cost.js +5 -1
- package/dist/src/services/clip-curation/gemini.js +14 -2
- package/dist/src/services/clip-curation/hunt.js +56 -0
- package/dist/src/services/clip-curation/index.js +1 -1
- package/dist/src/services/clip-curation/scan.js +5 -3
- package/package.json +30 -10
- package/SKILL.platform.md +0 -432
- package/demo/README.md +0 -28
- package/demo/dist/app.css +0 -1
- package/demo/dist/app.js +0 -1850
- package/demo/dist/chunks/chunk-DXB73IDG.js +0 -1
- package/demo/dist/chunks/chunk-S7OWAJDS.js +0 -36
- package/demo/dist/chunks/chunk-VTIBZ6AN.js +0 -1
- package/demo/dist/chunks/dist-ADSJKBVE.js +0 -332
- package/demo/dist/chunks/domEditingLayers-VZMLL4AP-SGHWPND4.js +0 -1
- package/demo/dist/chunks/hyperframes-player-XB65TCD6.js +0 -425
- package/demo/dist/chunks/lib-XAQ37YOE.js +0 -1
- package/demo/dist/chunks/src-TJ2QYA4U.js +0 -207
- package/demo/dist/favicon.ico +0 -0
- package/demo/dist/icons/timeline/audio.svg +0 -7
- package/demo/dist/icons/timeline/captions.svg +0 -5
- package/demo/dist/icons/timeline/composition.svg +0 -12
- package/demo/dist/icons/timeline/image.svg +0 -18
- package/demo/dist/icons/timeline/music.svg +0 -10
- package/demo/dist/icons/timeline/text.svg +0 -3
- package/demo/dist/index.html +0 -15
- package/dist/src/account-pages-legacy.js +0 -9396
- package/dist/src/account-pages.js +0 -61
- package/dist/src/app.js +0 -21603
- package/dist/src/composition-runtime.js +0 -1053
- package/dist/src/config.js +0 -217
- package/dist/src/context.js +0 -447
- package/dist/src/dev-app-legacy.js +0 -739
- package/dist/src/dev-app.js +0 -6
- package/dist/src/devcli/migrate-local.js +0 -140
- package/dist/src/devcli/sync.js +0 -368
- package/dist/src/domain.js +0 -5
- package/dist/src/editor-chat-history.js +0 -82
- package/dist/src/editor-chat.js +0 -828
- package/dist/src/editor-dark-theme.js +0 -1128
- package/dist/src/frontend/debug.js +0 -71
- package/dist/src/frontend/discover-client.js +0 -130
- package/dist/src/frontend/discover-store.js +0 -23
- package/dist/src/frontend/file-directory.js +0 -1018
- package/dist/src/frontend/flockposter-cache-store.js +0 -124
- package/dist/src/frontend/homepage-client.js +0 -446
- package/dist/src/frontend/homepage-shared.js +0 -201
- package/dist/src/frontend/homepage-store.js +0 -66
- package/dist/src/frontend/homepage-view.js +0 -705
- package/dist/src/frontend/page-runtime-client.js +0 -132
- package/dist/src/frontend/page-runtime-store.js +0 -9
- package/dist/src/frontend/sentry.js +0 -42
- package/dist/src/frontend/template-editor-chat.js +0 -4181
- package/dist/src/help-page.js +0 -346
- package/dist/src/homepage.js +0 -1458
- package/dist/src/index.js +0 -16
- package/dist/src/instrument.js +0 -30
- package/dist/src/landing-page.js +0 -384
- package/dist/src/page-runtime.js +0 -2
- package/dist/src/page-shell.js +0 -1452
- package/dist/src/primitive-context.js +0 -416
- package/dist/src/primitive-registry.js +0 -3940
- package/dist/src/primitive-sdk.js +0 -4
- package/dist/src/primitives/hyperframes-media.js +0 -108
- package/dist/src/react-page-shell.js +0 -35
- package/dist/src/ready-post-schedule-component.js +0 -1540
- package/dist/src/registry.js +0 -296
- package/dist/src/reskin/agency-page.js +0 -299
- package/dist/src/reskin/calendar-page.js +0 -568
- package/dist/src/reskin/chat-page.js +0 -942
- package/dist/src/reskin/discover-page.js +0 -1788
- package/dist/src/reskin/document.js +0 -1587
- package/dist/src/reskin/help-page.js +0 -357
- package/dist/src/reskin/index-page.js +0 -62
- package/dist/src/reskin/inpaint-clipper-page.js +0 -890
- package/dist/src/reskin/inpaint-page.js +0 -2554
- package/dist/src/reskin/inpaint-video-page.js +0 -1339
- package/dist/src/reskin/job-runs-page.js +0 -477
- package/dist/src/reskin/library-page.js +0 -1634
- package/dist/src/reskin/login-page.js +0 -262
- package/dist/src/reskin/portfolio-page.js +0 -687
- package/dist/src/reskin/pricing-page.js +0 -390
- package/dist/src/reskin/settings-page.js +0 -732
- package/dist/src/reskin/theme.js +0 -711
- package/dist/src/runtime.js +0 -35
- package/dist/src/services/api-call-history.js +0 -249
- package/dist/src/services/auth.js +0 -152
- package/dist/src/services/billing-pricing.js +0 -39
- package/dist/src/services/billing.js +0 -241
- package/dist/src/services/cast.js +0 -127
- package/dist/src/services/chat-threads.js +0 -92
- package/dist/src/services/clip-records.js +0 -250
- package/dist/src/services/clip-search.js +0 -77
- package/dist/src/services/clip-vectors.js +0 -125
- package/dist/src/services/composition-sanitize.js +0 -124
- package/dist/src/services/composition-watch.js +0 -79
- package/dist/src/services/elevenlabs.js +0 -222
- package/dist/src/services/file-directory.js +0 -117
- package/dist/src/services/fork-access.js +0 -93
- package/dist/src/services/fork-manifest.js +0 -42
- package/dist/src/services/ghostcut.js +0 -179
- package/dist/src/services/hyperframes.js +0 -3654
- package/dist/src/services/job-capacity.js +0 -14
- package/dist/src/services/job-logs.js +0 -197
- package/dist/src/services/jobs.js +0 -136
- package/dist/src/services/local-dynamo.js +0 -0
- package/dist/src/services/media-processing.js +0 -766
- package/dist/src/services/primitive-media-lambda.js +0 -280
- package/dist/src/services/providers.js +0 -2748
- package/dist/src/services/rate-limits.js +0 -262
- package/dist/src/services/scene-annotations.js +0 -32
- package/dist/src/services/serverless-auth.js +0 -382
- package/dist/src/services/serverless-jobs.js +0 -1084
- package/dist/src/services/serverless-provider-keys.js +0 -409
- package/dist/src/services/serverless-records.js +0 -1515
- package/dist/src/services/serverless-template-configs.js +0 -75
- package/dist/src/services/storage.js +0 -461
- package/dist/src/services/swipe-customize.js +0 -437
- package/dist/src/services/template-certification.js +0 -413
- package/dist/src/services/template-loader.js +0 -99
- package/dist/src/services/template-runtime-bundles.js +0 -217
- package/dist/src/services/template-sources.js +0 -1017
- package/dist/src/services/upstream.js +0 -248
- package/dist/src/services/video-normalization.js +0 -2
- package/dist/src/services/webhooks.js +0 -62
- package/dist/src/template-editor-pages.js +0 -2576
- package/dist/src/template-editor-shell.js +0 -2893
- package/dist/src/template-sdk.js +0 -4
- package/dist/src/worker.js +0 -17
- package/public/assets/discover-client-app.js +0 -1
- package/public/assets/file-directory-app.js +0 -3
- package/public/assets/homepage-app.js +0 -54
- package/public/assets/homepage-client-app.js +0 -80
- package/public/assets/page-runtime-client-app.js +0 -94
- package/public/assets/placeholders/scene-placeholder.png +0 -0
- package/src/assets/SELLING_AWARENESS_STAGES.md +0 -579
- package/src/assets/SELLING_WITH_HOOKS.md +0 -377
- package/src/assets/SELLING_WITH_VSLS.md +0 -606
- package/src/assets/favicon.ico +0 -0
- package/src/assets/logo-vidfarm.png +0 -0
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
import { concatAudioAssets, concatVideoAssets, estimateNormalizationCostUsd, extractAudioFromVideoAsset, extractVideoFrameAsset, muteVideoAsset, normalizeAudioAsset, normalizeVideoAsset, probeMediaAsset, renderSlidesVideoAsset, replaceVideoAudioAsset, trimAudioAsset, trimVideoAsset } from "./media-processing.js";
|
|
2
|
-
import { config } from "../config.js";
|
|
3
|
-
export class PrimitiveMediaLambdaService {
|
|
4
|
-
async execute(input) {
|
|
5
|
-
if (config.VIDFARM_PRIMITIVE_MEDIA_LAMBDA_URL && config.VIDFARM_PRIMITIVE_MEDIA_LAMBDA_SECRET) {
|
|
6
|
-
return this.executeRemote(input);
|
|
7
|
-
}
|
|
8
|
-
return this.executeLocal(input);
|
|
9
|
-
}
|
|
10
|
-
async executeRemote(input) {
|
|
11
|
-
const response = await fetch(config.VIDFARM_PRIMITIVE_MEDIA_LAMBDA_URL, {
|
|
12
|
-
method: "POST",
|
|
13
|
-
headers: {
|
|
14
|
-
"content-type": "application/json",
|
|
15
|
-
"x-vidfarm-media-secret": config.VIDFARM_PRIMITIVE_MEDIA_LAMBDA_SECRET
|
|
16
|
-
},
|
|
17
|
-
body: JSON.stringify({
|
|
18
|
-
output_key: input.outputKey,
|
|
19
|
-
operation: input.operation,
|
|
20
|
-
payload: input.payload
|
|
21
|
-
})
|
|
22
|
-
});
|
|
23
|
-
const payload = await response.json().catch(() => null);
|
|
24
|
-
if (!response.ok || !payload?.storage_key || !payload.content_type) {
|
|
25
|
-
throw new Error(payload?.error || `Primitive media Lambda failed with HTTP ${response.status}.`);
|
|
26
|
-
}
|
|
27
|
-
const billingCostCenterSlug = input.operation === "video_normalize"
|
|
28
|
-
? "video_normalization"
|
|
29
|
-
: "primitive_media_lambda";
|
|
30
|
-
return {
|
|
31
|
-
storageKey: payload.storage_key,
|
|
32
|
-
publicUrl: payload.public_url ?? null,
|
|
33
|
-
contentType: payload.content_type,
|
|
34
|
-
bytes: Number(payload.bytes ?? 0),
|
|
35
|
-
metadata: payload.metadata ?? {},
|
|
36
|
-
billingCostUsd: Number(payload.billing?.cost_usd ?? 0),
|
|
37
|
-
billingCostCenterSlug,
|
|
38
|
-
billingMetadata: {
|
|
39
|
-
operation: input.operation,
|
|
40
|
-
mode: "lambda",
|
|
41
|
-
duration_ms: Number(payload.billing?.duration_ms ?? 0)
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
async executeLocal(input) {
|
|
46
|
-
const startedAt = Date.now();
|
|
47
|
-
const result = await runLocalPrimitiveMediaOperation(input.operation, input.payload);
|
|
48
|
-
const stored = await input.storeLocal(input.localOutputKey, result.bytes, result.contentType);
|
|
49
|
-
return {
|
|
50
|
-
storageKey: stored.key,
|
|
51
|
-
publicUrl: stored.url,
|
|
52
|
-
contentType: result.contentType,
|
|
53
|
-
bytes: result.bytes.byteLength,
|
|
54
|
-
metadata: result.metadata,
|
|
55
|
-
billingCostUsd: result.billingCostUsd ?? estimateLocalLambdaEquivalentUsd(Date.now() - startedAt),
|
|
56
|
-
billingCostCenterSlug: input.operation === "video_normalize" ? "video_normalization" : "primitive_media_lambda",
|
|
57
|
-
billingMetadata: {
|
|
58
|
-
operation: input.operation,
|
|
59
|
-
mode: "local_fallback",
|
|
60
|
-
duration_ms: Date.now() - startedAt
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
async function runLocalPrimitiveMediaOperation(operation, payload) {
|
|
66
|
-
switch (operation) {
|
|
67
|
-
case "video_normalize": {
|
|
68
|
-
const result = await normalizeVideoAsset({
|
|
69
|
-
sourceUrl: readRequiredUrl(payload.source_video_url ?? payload.sourceUrl),
|
|
70
|
-
maxWidth: readOptionalInt(payload.max_width ?? payload.maxWidth),
|
|
71
|
-
maxHeight: readOptionalInt(payload.max_height ?? payload.maxHeight),
|
|
72
|
-
crf: readOptionalInt(payload.crf),
|
|
73
|
-
preset: readOptionalPreset(payload.preset),
|
|
74
|
-
maxVideoBitrateKbps: readOptionalInt(payload.max_video_bitrate_kbps ?? payload.maxVideoBitrateKbps),
|
|
75
|
-
audioBitrateKbps: readOptionalInt(payload.audio_bitrate_kbps ?? payload.audioBitrateKbps)
|
|
76
|
-
});
|
|
77
|
-
return {
|
|
78
|
-
bytes: result.bytes,
|
|
79
|
-
contentType: result.contentType,
|
|
80
|
-
metadata: result.metadata,
|
|
81
|
-
billingCostUsd: estimateNormalizationCostUsd(result.metadata)
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
case "video_render_slides": {
|
|
85
|
-
const result = await renderSlidesVideoAsset({
|
|
86
|
-
slides: readSlides(payload.slides),
|
|
87
|
-
width: Math.max(16, readOptionalInt(payload.width) ?? 1080),
|
|
88
|
-
height: Math.max(16, readOptionalInt(payload.height) ?? 1920),
|
|
89
|
-
backgroundColor: readString(payload.background_color ?? payload.backgroundColor) || "#000000",
|
|
90
|
-
defaultFit: readOptionalFit(payload.default_fit ?? payload.defaultFit) ?? "cover"
|
|
91
|
-
});
|
|
92
|
-
return {
|
|
93
|
-
bytes: result.bytes,
|
|
94
|
-
contentType: result.contentType,
|
|
95
|
-
metadata: result.metadata
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
case "video_trim": {
|
|
99
|
-
const result = await trimVideoAsset({
|
|
100
|
-
sourceUrl: readRequiredUrl(payload.source_video_url ?? payload.sourceUrl),
|
|
101
|
-
startMs: readOptionalInt(payload.start_ms ?? payload.startMs),
|
|
102
|
-
endMs: readOptionalInt(payload.end_ms ?? payload.endMs),
|
|
103
|
-
durationMs: readOptionalInt(payload.duration_ms ?? payload.durationMs),
|
|
104
|
-
maxWidth: readOptionalInt(payload.max_width ?? payload.maxWidth),
|
|
105
|
-
maxHeight: readOptionalInt(payload.max_height ?? payload.maxHeight),
|
|
106
|
-
crf: readOptionalInt(payload.crf),
|
|
107
|
-
preset: readOptionalPreset(payload.preset),
|
|
108
|
-
audioBitrateKbps: readOptionalInt(payload.audio_bitrate_kbps ?? payload.audioBitrateKbps)
|
|
109
|
-
});
|
|
110
|
-
return { bytes: result.bytes, contentType: result.contentType, metadata: result.metadata };
|
|
111
|
-
}
|
|
112
|
-
case "video_extract_audio": {
|
|
113
|
-
const result = await extractAudioFromVideoAsset({
|
|
114
|
-
sourceUrl: readRequiredUrl(payload.source_video_url ?? payload.sourceUrl),
|
|
115
|
-
format: readOptionalAudioFormat(payload.output_format ?? payload.outputFormat),
|
|
116
|
-
bitrateKbps: readOptionalInt(payload.audio_bitrate_kbps ?? payload.audioBitrateKbps)
|
|
117
|
-
});
|
|
118
|
-
return { bytes: result.bytes, contentType: result.contentType, metadata: result.metadata };
|
|
119
|
-
}
|
|
120
|
-
case "audio_trim": {
|
|
121
|
-
const result = await trimAudioAsset({
|
|
122
|
-
sourceUrl: readRequiredUrl(payload.source_audio_url ?? payload.sourceUrl),
|
|
123
|
-
startMs: readOptionalInt(payload.start_ms ?? payload.startMs),
|
|
124
|
-
endMs: readOptionalInt(payload.end_ms ?? payload.endMs),
|
|
125
|
-
durationMs: readOptionalInt(payload.duration_ms ?? payload.durationMs),
|
|
126
|
-
format: readOptionalAudioFormat(payload.output_format ?? payload.outputFormat),
|
|
127
|
-
bitrateKbps: readOptionalInt(payload.audio_bitrate_kbps ?? payload.audioBitrateKbps)
|
|
128
|
-
});
|
|
129
|
-
return { bytes: result.bytes, contentType: result.contentType, metadata: result.metadata };
|
|
130
|
-
}
|
|
131
|
-
case "video_probe":
|
|
132
|
-
case "audio_probe": {
|
|
133
|
-
const result = await probeMediaAsset({
|
|
134
|
-
sourceUrl: readRequiredUrl(payload.source_video_url
|
|
135
|
-
?? payload.source_audio_url
|
|
136
|
-
?? payload.source_url
|
|
137
|
-
?? payload.sourceUrl)
|
|
138
|
-
});
|
|
139
|
-
return {
|
|
140
|
-
bytes: Buffer.from(JSON.stringify(result.metadata, null, 2), "utf8"),
|
|
141
|
-
contentType: "application/json",
|
|
142
|
-
metadata: result.metadata
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
case "video_extract_frame": {
|
|
146
|
-
const result = await extractVideoFrameAsset({
|
|
147
|
-
sourceUrl: readRequiredUrl(payload.source_video_url ?? payload.sourceUrl),
|
|
148
|
-
atMs: readOptionalInt(payload.at_ms ?? payload.atMs),
|
|
149
|
-
format: readOptionalImageFormat(payload.output_format ?? payload.outputFormat)
|
|
150
|
-
});
|
|
151
|
-
return { bytes: result.bytes, contentType: result.contentType, metadata: result.metadata };
|
|
152
|
-
}
|
|
153
|
-
case "video_mute": {
|
|
154
|
-
const result = await muteVideoAsset({ sourceUrl: readRequiredUrl(payload.source_video_url ?? payload.sourceUrl) });
|
|
155
|
-
return { bytes: result.bytes, contentType: result.contentType, metadata: result.metadata };
|
|
156
|
-
}
|
|
157
|
-
case "video_replace_audio": {
|
|
158
|
-
const result = await replaceVideoAudioAsset({
|
|
159
|
-
sourceVideoUrl: readRequiredUrl(payload.source_video_url ?? payload.sourceVideoUrl),
|
|
160
|
-
audioUrl: readRequiredUrl(payload.source_audio_url ?? payload.audio_url ?? payload.audioUrl),
|
|
161
|
-
audioBitrateKbps: readOptionalInt(payload.audio_bitrate_kbps ?? payload.audioBitrateKbps)
|
|
162
|
-
});
|
|
163
|
-
return { bytes: result.bytes, contentType: result.contentType, metadata: result.metadata };
|
|
164
|
-
}
|
|
165
|
-
case "video_concat": {
|
|
166
|
-
const result = await concatVideoAssets({
|
|
167
|
-
sourceUrls: readRequiredUrlArray(payload.source_video_urls ?? payload.sourceUrls),
|
|
168
|
-
width: readOptionalInt(payload.width),
|
|
169
|
-
height: readOptionalInt(payload.height),
|
|
170
|
-
fit: readOptionalFit(payload.fit),
|
|
171
|
-
backgroundColor: readString(payload.background_color ?? payload.backgroundColor) || undefined
|
|
172
|
-
});
|
|
173
|
-
return { bytes: result.bytes, contentType: result.contentType, metadata: result.metadata };
|
|
174
|
-
}
|
|
175
|
-
case "audio_concat": {
|
|
176
|
-
const result = await concatAudioAssets({
|
|
177
|
-
sourceUrls: readRequiredUrlArray(payload.source_audio_urls ?? payload.sourceUrls),
|
|
178
|
-
format: readOptionalAudioFormat(payload.output_format ?? payload.outputFormat),
|
|
179
|
-
bitrateKbps: readOptionalInt(payload.audio_bitrate_kbps ?? payload.audioBitrateKbps)
|
|
180
|
-
});
|
|
181
|
-
return { bytes: result.bytes, contentType: result.contentType, metadata: result.metadata };
|
|
182
|
-
}
|
|
183
|
-
case "audio_normalize": {
|
|
184
|
-
const result = await normalizeAudioAsset({
|
|
185
|
-
sourceUrl: readRequiredUrl(payload.source_audio_url ?? payload.sourceUrl),
|
|
186
|
-
format: readOptionalAudioFormat(payload.output_format ?? payload.outputFormat),
|
|
187
|
-
bitrateKbps: readOptionalInt(payload.audio_bitrate_kbps ?? payload.audioBitrateKbps),
|
|
188
|
-
sampleRateHz: readOptionalInt(payload.sample_rate_hz ?? payload.sampleRateHz)
|
|
189
|
-
});
|
|
190
|
-
return { bytes: result.bytes, contentType: result.contentType, metadata: result.metadata };
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
function estimateLocalLambdaEquivalentUsd(durationMs) {
|
|
195
|
-
const gbSeconds = 2 * (Math.max(1, durationMs) / 1000);
|
|
196
|
-
const computeCost = gbSeconds * 0.0000166667;
|
|
197
|
-
const requestCost = 0.20 / 1_000_000;
|
|
198
|
-
return Number((computeCost + requestCost).toFixed(6));
|
|
199
|
-
}
|
|
200
|
-
function readRequiredUrl(value) {
|
|
201
|
-
const text = readString(value);
|
|
202
|
-
if (!text) {
|
|
203
|
-
throw new Error("A source URL is required.");
|
|
204
|
-
}
|
|
205
|
-
new URL(text);
|
|
206
|
-
return text;
|
|
207
|
-
}
|
|
208
|
-
function readRequiredUrlArray(value) {
|
|
209
|
-
if (!Array.isArray(value) || !value.length) {
|
|
210
|
-
throw new Error("At least one source URL is required.");
|
|
211
|
-
}
|
|
212
|
-
return value.map((entry) => readRequiredUrl(entry));
|
|
213
|
-
}
|
|
214
|
-
function readOptionalInt(value) {
|
|
215
|
-
if (value == null || value === "")
|
|
216
|
-
return undefined;
|
|
217
|
-
const parsed = Number.parseInt(String(value), 10);
|
|
218
|
-
if (!Number.isFinite(parsed)) {
|
|
219
|
-
throw new Error(`Invalid integer value "${String(value)}".`);
|
|
220
|
-
}
|
|
221
|
-
return parsed;
|
|
222
|
-
}
|
|
223
|
-
function readOptionalPreset(value) {
|
|
224
|
-
const text = readString(value);
|
|
225
|
-
if (!text)
|
|
226
|
-
return undefined;
|
|
227
|
-
if (text === "veryfast" || text === "faster" || text === "fast" || text === "medium") {
|
|
228
|
-
return text;
|
|
229
|
-
}
|
|
230
|
-
throw new Error(`Unsupported preset "${text}".`);
|
|
231
|
-
}
|
|
232
|
-
function readOptionalFit(value) {
|
|
233
|
-
const text = readString(value);
|
|
234
|
-
if (!text)
|
|
235
|
-
return undefined;
|
|
236
|
-
if (text === "cover" || text === "contain" || text === "fill") {
|
|
237
|
-
return text;
|
|
238
|
-
}
|
|
239
|
-
throw new Error(`Unsupported fit "${text}".`);
|
|
240
|
-
}
|
|
241
|
-
function readOptionalAudioFormat(value) {
|
|
242
|
-
const text = readString(value);
|
|
243
|
-
if (!text)
|
|
244
|
-
return undefined;
|
|
245
|
-
if (text === "mp3" || text === "wav" || text === "m4a") {
|
|
246
|
-
return text;
|
|
247
|
-
}
|
|
248
|
-
throw new Error(`Unsupported audio format "${text}".`);
|
|
249
|
-
}
|
|
250
|
-
function readOptionalImageFormat(value) {
|
|
251
|
-
const text = readString(value);
|
|
252
|
-
if (!text)
|
|
253
|
-
return undefined;
|
|
254
|
-
if (text === "png" || text === "jpeg") {
|
|
255
|
-
return text;
|
|
256
|
-
}
|
|
257
|
-
throw new Error(`Unsupported image format "${text}".`);
|
|
258
|
-
}
|
|
259
|
-
function readSlides(value) {
|
|
260
|
-
if (!Array.isArray(value) || !value.length) {
|
|
261
|
-
throw new Error("At least one slide is required.");
|
|
262
|
-
}
|
|
263
|
-
return value.map((slide, index) => {
|
|
264
|
-
if (!slide || typeof slide !== "object" || Array.isArray(slide)) {
|
|
265
|
-
throw new Error(`Invalid slide at index ${index}.`);
|
|
266
|
-
}
|
|
267
|
-
const entry = slide;
|
|
268
|
-
return {
|
|
269
|
-
mediaUrl: readRequiredUrl(entry.media_url ?? entry.mediaUrl ?? entry.image_url ?? entry.imageUrl ?? entry.video_url ?? entry.videoUrl),
|
|
270
|
-
mediaType: readString(entry.media_type ?? entry.mediaType) === "video" ? "video" : "image",
|
|
271
|
-
durationMs: Math.max(100, readOptionalInt(entry.duration_ms ?? entry.durationMs) ?? 1000),
|
|
272
|
-
fit: readOptionalFit(entry.fit) ?? "cover",
|
|
273
|
-
backgroundColor: readString(entry.background_color ?? entry.backgroundColor) || "#000000"
|
|
274
|
-
};
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
function readString(value) {
|
|
278
|
-
return typeof value === "string" ? value.trim() : "";
|
|
279
|
-
}
|
|
280
|
-
//# sourceMappingURL=primitive-media-lambda.js.map
|