Skip to content

OpenReel Video - Professional browser-based video editor. Open source CapCut alternative. 100% browser-based, no installation, no cloud uploads, no watermarks.

TypeScript

Improve caption workflows and discovery (#96)

Augustus Otu2566c34e0f8e
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 00000000..ac3c7254
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1 @@
+github: [Augani]
diff --git a/README.md b/README.md
index de0efd71..2fec315a 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ OpenReel Video is a fully-featured browser-based video editor that runs entirely
**[Try it Live](https://openreel.video)** | **[Documentation](CONTRIBUTING.md)** | **[Discussions](https://github.com/Augani/openreel-video/discussions)** | **[Twitter](https://x.com/python_xi)**
-![OpenReel Editor](https://img.shields.io/badge/Lines%20of%20Code-130k+-blue) ![License](https://img.shields.io/badge/License-MIT-green) ![Status](https://img.shields.io/badge/Status-Beta-orange) ![Open Source](https://img.shields.io/badge/Open%20Source-100%25-brightgreen)
+![OpenReel Editor](https://img.shields.io/badge/Lines%20of%20Code-130k+-blue) ![License](https://img.shields.io/badge/License-MIT-green) ![Status](https://img.shields.io/badge/Status-Beta-orange) ![Open Source](https://img.shields.io/badge/Open%20Source-100%25-brightgreen) [![Sponsor Augani](https://img.shields.io/github/sponsors/Augani?logo=githubsponsors&label=Sponsor&color=EA4AAA)](https://github.com/sponsors/Augani)
---
diff --git a/apps/web/package.json b/apps/web/package.json
index e839a804..51c7e60b 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -19,6 +19,7 @@
"@astryxdesign/core": "^0.1.1",
"@astryxdesign/theme-neutral": "^0.1.1",
"@gsap/react": "^2.1.2",
+ "@huggingface/transformers": "3.8.1",
"@openreel/agent": "workspace:*",
"@openreel/core": "workspace:*",
"@openreel/ui": "workspace:*",
diff --git a/apps/web/src/components/editor/EditorActionRail.test.tsx b/apps/web/src/components/editor/EditorActionRail.test.tsx
new file mode 100644
index 00000000..ebda6e49
--- /dev/null
+++ b/apps/web/src/components/editor/EditorActionRail.test.tsx
@@ -0,0 +1,30 @@
+import "../../test/install-local-storage-mock";
+import { cleanup, fireEvent, render, screen } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it } from "vitest";
+import { useThemeStore } from "../../stores/theme-store";
+import { EditorActionRail } from "./EditorActionRail";
+
+describe("EditorActionRail", () => {
+ beforeEach(() => {
+ useThemeStore.getState().setMode("light");
+ });
+
+ afterEach(() => cleanup());
+
+ it("exposes theme switching as a visible rail action", () => {
+ render(<EditorActionRail />);
+
+ fireEvent.click(
+ screen.getByRole("button", {
+ name: "Theme: Light. Switch to Dark",
+ }),
+ );
+
+ expect(useThemeStore.getState().mode).toBe("dark");
+ expect(
+ screen.getByRole("button", {
+ name: "Theme: Dark. Switch to System",
+ }),
+ ).toBeInTheDocument();
+ });
+});
diff --git a/apps/web/src/components/editor/EditorActionRail.tsx b/apps/web/src/components/editor/EditorActionRail.tsx
index 0a599d26..8c9af590 100644
--- a/apps/web/src/components/editor/EditorActionRail.tsx
+++ b/apps/web/src/components/editor/EditorActionRail.tsx
@@ -61,6 +61,22 @@ export const EditorActionRail: React.FC = () => {
const { openSettings } = useSettingsStore();
const { navigate } = useRouter();
+ const themeLabel =
+ themeMode === "auto"
+ ? "System"
+ : themeMode.charAt(0).toUpperCase() + themeMode.slice(1);
+ const nextThemeLabel =
+ themeMode === "light" ? "Dark" : themeMode === "dark" ? "System" : "Light";
+ const themeIcon =
+ themeMode === "light" ? (
+ <Sun size={16} aria-hidden />
+ ) : themeMode === "dark" ? (
+ <Moon size={16} aria-hidden />
+ ) : (
+ <SunMoon size={16} aria-hidden />
+ );
+ const themeActionLabel = `Theme: ${themeLabel}. Switch to ${nextThemeLabel}`;
+
const handleCreateMotionScene = useCallback(async () => {
const composition = await createMotionComposition("Motion Scene");
if (composition) {
@@ -152,6 +168,16 @@ export const EditorActionRail: React.FC = () => {
<div className="flex-1" />
+ <Tooltip content={themeActionLabel} placement="end">
+ <IconButton
+ label={themeActionLabel}
+ icon={themeIcon}
+ size="sm"
+ variant="secondary"
+ onClick={toggleTheme}
+ />
+ </Tooltip>
+
<DropdownMenu
placement="end"
button={{
@@ -164,18 +190,6 @@ export const EditorActionRail: React.FC = () => {
hasChevron={false}
menuWidth={224}
items={[
- {
- label: `Theme: ${themeMode}`,
- icon:
- themeMode === "light" ? (
- <Sun size={14} aria-hidden />
- ) : themeMode === "dark" ? (
- <Moon size={14} aria-hidden />
- ) : (
- <SunMoon size={14} aria-hidden />
- ),
- onClick: toggleTheme,
- },
{
label: "Settings & API keys",
icon: <Settings size={14} aria-hidden />,
diff --git a/apps/web/src/components/editor/InspectorPanel.tsx b/apps/web/src/components/editor/InspectorPanel.tsx
index abd8e7ad..47c61b6b 100644
--- a/apps/web/src/components/editor/InspectorPanel.tsx
+++ b/apps/web/src/components/editor/InspectorPanel.tsx
@@ -160,6 +160,7 @@ export const InspectorPanel: React.FC = () => {
useState<CaptionAnimationStyle>("word-highlight");
const [expandedRecipeApplicationId, setExpandedRecipeApplicationId] =
useState<string | null>(null);
+ const [captionWordsPerLine, setCaptionWordsPerLine] = useState(5);
const [recipeControlValues, setRecipeControlValues] = useState<
Record<string, Record<string, EditingTemplatePrimitive>>
>({});
@@ -650,27 +651,33 @@ export const InspectorPanel: React.FC = () => {
try {
const srtContent = await file.text();
- const result = await importSRT(srtContent);
+ const result = await importSRT(srtContent, {
+ sourceClipId: selectedTimelineClip?.id,
+ maxWordsPerLine: captionWordsPerLine,
+ });
if (result.success) {
if (result.errors.length > 0) {
toast.warning(
- "SRT imported with warnings",
+ "Captions imported with warnings",
`${result.errors.length} subtitle segment(s) were skipped.`,
);
} else {
- toast.success("SRT imported", "Subtitles were added to the Captions track.");
+ toast.success(
+ "Captions imported",
+ "Each cue is now an editable text clip on the Captions track.",
+ );
}
} else {
- toast.error("SRT import failed", result.errors[0] || "No valid subtitles found.");
+ toast.error("Caption import failed", result.errors[0] || "No valid captions found.");
}
} catch {
- toast.error("SRT import failed", "Could not read the selected subtitle file.");
+ toast.error("Caption import failed", "Could not read the selected subtitle file.");
} finally {
event.target.value = "";
}
},
- [importSRT],
+ [captionWordsPerLine, importSRT, selectedTimelineClip?.id],
);
const handleSubtitleFontUpload = useCallback(
@@ -1025,6 +1032,8 @@ export const InspectorPanel: React.FC = () => {
isEnhancingAudio={isEnhancingAudio}
audioEnhanced={audioEnhanced}
isApplyingSelectedClipEffect={isApplyingSelectedClipEffect}
+ captionWordsPerLine={captionWordsPerLine}
+ onCaptionWordsPerLineChange={setCaptionWordsPerLine}
/>
)}
</div>
diff --git a/apps/web/src/components/editor/Timeline.tsx b/apps/web/src/components/editor/Timeline.tsx
index 5679724f..474c957a 100644
--- a/apps/web/src/components/editor/Timeline.tsx
+++ b/apps/web/src/components/editor/Timeline.tsx
@@ -75,6 +75,11 @@ import {
type TrackLayerFilter,
} from "./timeline/track-layer-filter";
import { getTrackDragAutoScrollDelta } from "./timeline/track-drag-auto-scroll";
+import {
+ moveLinkedCaptions,
+ trimLinkedCaptions,
+} from "../../utils/linked-caption-edit";
+import { CaptionBatchSelectButton } from "./timeline/CaptionBatchSelectButton";
const TRACK_LAYER_FILTERS: readonly {
id: TrackLayerFilter;
@@ -756,7 +761,15 @@ export const Timeline: React.FC = () => {
startTime: newStartTime,
});
} else {
- await moveClip(clipId, newStartTime, targetTrackId);
+ const sourceClip = store.getClip(clipId);
+ const result = await moveClip(clipId, newStartTime, targetTrackId);
+ if (result.success && sourceClip) {
+ moveLinkedCaptions(
+ useProjectStore.getState(),
+ sourceClip,
+ newStartTime,
+ );
+ }
}
},
[moveClip],
@@ -866,6 +879,13 @@ export const Timeline: React.FC = () => {
modifiedAt: Date.now(),
},
}));
+ const newStartTime = edge === "left" ? newTime : clip.startTime;
+ trimLinkedCaptions(
+ useProjectStore.getState(),
+ clip,
+ newStartTime,
+ newStartTime + newDuration,
+ );
},
[tracks],
);
@@ -1289,6 +1309,8 @@ export const Timeline: React.FC = () => {
/>
</Popover>
+ <CaptionBatchSelectButton />
+
<div className="ml-auto flex items-center gap-3">
{/* Zoom control (mock: minus / emerald slider track + knob / plus) */}
<div className="flex items-center gap-2.5">
diff --git a/apps/web/src/components/editor/inspector/AutoCaptionPanel.tsx b/apps/web/src/components/editor/inspector/AutoCaptionPanel.tsx
index 11a1b8bc..52f5d4ec 100644
--- a/apps/web/src/components/editor/inspector/AutoCaptionPanel.tsx
+++ b/apps/web/src/components/editor/inspector/AutoCaptionPanel.tsx
@@ -1,294 +1,506 @@
-import React, { useState, useCallback, useMemo } from "react";
-import { ToolcraftButton as Button } from "@openreel/ui";
-import { ToolcraftCard as Card } from "@openreel/ui";
-import { ToolcraftSelectControl as Selector } from "@openreel/ui";
-import { ToolcraftText as Text } from "@openreel/ui";
-import { Mic, MicOff, Languages, AlertCircle } from "@/icons/lucide-compat";
-import { useEngineStore } from "../../../stores/engine-store";
-import { useProjectStore } from "../../../stores/project-store";
-import { SpeechToTextEngine } from "@openreel/core";
-import type {
- TranscriptionProgress,
- TranscriptionSegment,
+import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
+import {
+ SUBTITLE_STYLE_PRESETS,
+ splitCaptionIntoSingleLineCues,
+ type TranscriptionSegment,
} from "@openreel/core";
+import {
+ ToolcraftButton as Button,
+ ToolcraftCard as Card,
+ ToolcraftSelectControl as Selector,
+ ToolcraftText as Text,
+} from "@openreel/ui";
+import {
+ AlertCircle,
+ Check,
+ Download,
+ Languages,
+ Loader2,
+ Sparkles,
+} from "@/icons/lucide-compat";
+import { useProjectStore } from "../../../stores/project-store";
+import { useUIStore } from "../../../stores/ui-store";
+import { loadAudioBuffer } from "../../../utils/load-audio-buffer";
+import { audioBufferToWhisperSamples } from "../../../utils/whisper-audio";
+import {
+ DEFAULT_WHISPER_MODEL,
+ WHISPER_MODELS,
+ isWhisperModelKey,
+ type WhisperModelKey,
+} from "../../../workers/whisper-models";
-const CAPTION_STYLE_PRESETS = [
- {
- id: "default",
- name: "Default",
- description: "White text on dark background",
- },
- { id: "modern", name: "Modern", description: "Clean, minimal style" },
- { id: "bold", name: "Bold", description: "Large, impactful text" },
- { id: "cinematic", name: "Cinematic", description: "Film-style captions" },
- { id: "minimal", name: "Minimal", description: "Subtle, understated" },
-];
+const CAPTION_STYLE_PRESETS = ["default", "modern", "bold", "cinematic", "minimal"] as const;
+const WHISPER_LANGUAGES = [
+ { code: "en", name: "English" },
+ { code: "fr", name: "French" },
+ { code: "de", name: "German" },
+ { code: "es", name: "Spanish" },
+ { code: "it", name: "Italian" },
+ { code: "pt", name: "Portuguese" },
+ { code: "hi", name: "Hindi" },
+ { code: "ja", name: "Japanese" },
+ { code: "ko", name: "Korean" },
+ { code: "zh", name: "Chinese" },
+ { code: "ru", name: "Russian" },
+ { code: "tr", name: "Turkish" },
+ { code: "pl", name: "Polish" },
+ { code: "vi", name: "Vietnamese" },
+] as const;
-export const AutoCaptionPanel: React.FC = () => {
- const getSpeechToTextEngine = useEngineStore(
- (state) => state.getSpeechToTextEngine,
- );
- const addSubtitle = useProjectStore((state) => state.addSubtitle);
- const applySubtitleStylePreset = useProjectStore(
- (state) => state.applySubtitleStylePreset,
- );
+interface AutoCaptionPanelProps {
+ clipId?: string;
+ maxWordsPerLine?: number;
+}
+
+interface WorkerChunk {
+ text: string;
+ timestamp: [number | null, number | null];
+}
+type WorkerState = "idle" | "loading" | "ready";
+
+export const AutoCaptionPanel: React.FC<AutoCaptionPanelProps> = ({
+ clipId,
+ maxWordsPerLine = 5,
+}) => {
+ const getClip = useProjectStore((state) => state.getClip);
+ const getMediaItem = useProjectStore((state) => state.getMediaItem);
+ const addSubtitle = useProjectStore((state) => state.addSubtitle);
+ const workerRef = useRef<Worker | null>(null);
+ const [workerState, setWorkerState] = useState<WorkerState>("idle");
const [isTranscribing, setIsTranscribing] = useState(false);
- const [progress, setProgress] = useState<TranscriptionProgress | null>(null);
- const [selectedLanguage, setSelectedLanguage] = useState("en-US");
- const [selectedStyle, setSelectedStyle] = useState("default");
+ const [progress, setProgress] = useState(0);
+ const [progressMessage, setProgressMessage] = useState("");
+ const [selectedLanguage, setSelectedLanguage] = useState("en");
+ const [selectedStyle, setSelectedStyle] = useState<string>("default");
+ const [selectedModel, setSelectedModel] = useState<WhisperModelKey>(
+ DEFAULT_WHISPER_MODEL,
+ );
+ const [readyModels, setReadyModels] = useState<Set<WhisperModelKey>>(
+ () => new Set(),
+ );
+ const [modelBackends, setModelBackends] = useState<
+ Partial<Record<WhisperModelKey, "webgpu" | "wasm">>
+ >({});
const [segments, setSegments] = useState<TranscriptionSegment[]>([]);
const [error, setError] = useState<string | null>(null);
- const isSupported = useMemo(() => SpeechToTextEngine.isSupported(), []);
- const languages = useMemo(
- () => SpeechToTextEngine.getSupportedLanguages(),
- [],
+ const selectedItems = useUIStore((state) => state.selectedItems);
+ const resolvedClipId =
+ clipId ?? selectedItems.find((item) => item.type === "clip")?.id ?? "";
+ const clip = getClip(resolvedClipId);
+ const mediaItem = clip ? getMediaItem(clip.mediaId) : undefined;
+ const canTranscribe = Boolean(
+ clip && mediaItem && (mediaItem.type === "video" || mediaItem.type === "audio"),
);
- const handleStartTranscription = useCallback(async () => {
- setError(null);
- setSegments([]);
- setIsTranscribing(true);
-
- try {
- const speechEngine = await getSpeechToTextEngine();
-
- speechEngine.setOptions({ language: selectedLanguage });
+ useEffect(() => {
+ const worker = new Worker(
+ new URL("../../../workers/whisper-worker.ts", import.meta.url),
+ { type: "module" },
+ );
+ workerRef.current = worker;
+ return () => {
+ worker.terminate();
+ workerRef.current = null;
+ };
+ }, []);
- speechEngine.onProgress((prog) => {
- setProgress(prog);
+ const runWorker = useCallback(
+ (
+ type: "load" | "transcribe",
+ audio?: Float32Array,
+ ): Promise<{ text?: string; chunks?: WorkerChunk[] }> => {
+ const worker = workerRef.current;
+ if (!worker) return Promise.reject(new Error("Caption worker is not ready."));
+ const requestId = crypto.randomUUID();
+ return new Promise((resolve, reject) => {
+ const handleMessage = (event: MessageEvent<Record<string, unknown>>) => {
+ if (event.data.requestId !== requestId) return;
+ const messageType = event.data.type;
+ if (messageType === "model-progress") {
+ setWorkerState("loading");
+ const rawProgress = Number(event.data.progress ?? 0);
+ setProgress(rawProgress > 1 ? rawProgress / 100 : rawProgress);
+ const file = String(event.data.file ?? "caption model").split("/").pop();
+ setProgressMessage(`Downloading ${file || "caption model"}…`);
+ } else if (messageType === "transcription-progress") {
+ setWorkerState("ready");
+ setProgress(Number(event.data.progress ?? 0));
+ setProgressMessage("Transcribing selected clip locally…");
+ } else if (messageType === "ready") {
+ worker.removeEventListener("message", handleMessage);
+ setWorkerState("ready");
+ setReadyModels((current) => new Set(current).add(selectedModel));
+ const backend = event.data.backend;
+ if (backend === "webgpu" || backend === "wasm") {
+ setModelBackends((current) => ({
+ ...current,
+ [selectedModel]: backend,
+ }));
+ }
+ setProgress(1);
+ setProgressMessage("Offline caption model is ready");
+ resolve({});
+ } else if (messageType === "result") {
+ worker.removeEventListener("message", handleMessage);
+ setWorkerState("ready");
+ setReadyModels((current) => new Set(current).add(selectedModel));
+ const backend = event.data.backend;
+ if (backend === "webgpu" || backend === "wasm") {
+ setModelBackends((current) => ({
+ ...current,
+ [selectedModel]: backend,
+ }));
+ }
+ setProgress(1);
+ resolve({
+ text: String(event.data.text ?? ""),
+ chunks: (event.data.chunks ?? []) as WorkerChunk[],
+ });
+ } else if (messageType === "error") {
+ worker.removeEventListener("message", handleMessage);
+ reject(new Error(String(event.data.message ?? "Local transcription failed.")));
+ }
+ };
+ worker.addEventListener("message", handleMessage);
+ if (audio) {
+ worker.postMessage(
+ {
+ requestId,
+ type,
+ audio,
+ language: selectedLanguage,
+ model: selectedModel,
+ },
+ [audio.buffer],
+ );
+ } else {
+ worker.postMessage({
+ requestId,
+ type,
+ language: selectedLanguage,
+ model: selectedModel,
+ });
+ }
});
+ },
+ [selectedLanguage, selectedModel],
+ );
- speechEngine.onSegment((segment) => {
- setSegments((prev) => [...prev, segment]);
- });
+ const handleModelChange = useCallback(
+ (value: string) => {
+ if (!isWhisperModelKey(value)) return;
+ setSelectedModel(value);
+ setSegments([]);
+ setError(null);
+ setProgress(readyModels.has(value) ? 1 : 0);
+ setProgressMessage(readyModels.has(value) ? "Offline caption model is ready" : "");
+ setWorkerState(readyModels.has(value) ? "ready" : "idle");
+ },
+ [readyModels],
+ );
- await speechEngine.startLiveTranscription();
- } catch (err) {
- setError(
- err instanceof Error ? err.message : "Failed to start transcription",
- );
- setIsTranscribing(false);
+ const handlePrepareModel = useCallback(async () => {
+ setError(null);
+ setWorkerState("loading");
+ setProgress(0);
+ setProgressMessage("Preparing offline caption model…");
+ try {
+ await runWorker("load");
+ } catch (reason) {
+ setWorkerState("idle");
+ setError(reason instanceof Error ? reason.message : "Model download failed.");
}
- }, [getSpeechToTextEngine, selectedLanguage]);
+ }, [runWorker]);
- const handleStopTranscription = useCallback(async () => {
- const speechEngine = await getSpeechToTextEngine();
-
- const result = speechEngine.stopTranscription();
- setIsTranscribing(false);
- setProgress(null);
+ const handleTranscribe = useCallback(async () => {
+ if (!clip || !mediaItem) return;
+ setError(null);
+ setSegments([]);
+ setIsTranscribing(true);
+ setProgress(0);
+ setProgressMessage("Extracting selected clip audio…");
- if (result.success && result.segments.length > 0) {
- const subtitles = speechEngine.segmentsToSubtitles(result.segments);
- subtitles.forEach((subtitle) => {
- addSubtitle(subtitle);
+ let audioContext: AudioContext | null = null;
+ try {
+ const sourceBlob =
+ mediaItem.blob ??
+ (mediaItem.fileHandle ? await mediaItem.fileHandle.getFile() : null);
+ if (!sourceBlob) {
+ throw new Error("Reconnect the source media before creating captions.");
+ }
+ audioContext = new AudioContext();
+ const audioBuffer = await loadAudioBuffer(audioContext, sourceBlob, {
+ audioTrackIndex: clip.audioTrackIndex,
+ onProgress: (next) => {
+ setProgress(next.progress * 0.18);
+ setProgressMessage(next.message);
+ },
});
+ if (!audioBuffer) throw new Error("The selected clip audio could not be decoded.");
- if (selectedStyle !== "default") {
- await applySubtitleStylePreset(selectedStyle);
+ const sourceStart = Math.max(0, clip.inPoint ?? 0);
+ const sourceEnd = Math.min(
+ audioBuffer.duration,
+ clip.outPoint > sourceStart
+ ? clip.outPoint
+ : sourceStart + clip.duration * Math.max(clip.speed ?? 1, 0.01),
+ );
+ const samples = audioBufferToWhisperSamples(audioBuffer, sourceStart, sourceEnd);
+ setProgress(0.2);
+ setProgressMessage(
+ workerState === "ready"
+ ? `Transcribing with ${WHISPER_MODELS[selectedModel].shortLabel}…`
+ : `Downloading ${WHISPER_MODELS[selectedModel].shortLabel}, then transcribing…`,
+ );
+ const result = await runWorker("transcribe", samples);
+ const sourceDuration = Math.max(0.1, sourceEnd - sourceStart);
+ const playbackSpeed = Math.max(clip.speed ?? 1, 0.01);
+ const clipEndTime = clip.startTime + clip.duration;
+ const nextSegments: TranscriptionSegment[] = (result.chunks ?? [])
+ .map((chunk) => {
+ const start = Math.max(0, chunk.timestamp?.[0] ?? 0);
+ const end = Math.min(
+ sourceDuration,
+ chunk.timestamp?.[1] ?? Math.min(sourceDuration, start + 3),
+ );
+ return {
+ text: chunk.text.trim(),
+ startTime: Math.min(clipEndTime, clip.startTime + start / playbackSpeed),
+ endTime: Math.min(
+ clipEndTime,
+ clip.startTime + Math.max(start + 0.1, end) / playbackSpeed,
+ ),
+ confidence: 1,
+ };
+ })
+ .filter(
+ (segment) =>
+ segment.text.length > 0 && segment.endTime > segment.startTime,
+ );
+ if (nextSegments.length === 0 && result.text?.trim()) {
+ nextSegments.push({
+ text: result.text.trim(),
+ startTime: clip.startTime,
+ endTime: clipEndTime,
+ confidence: 1,
+ });
+ }
+ if (nextSegments.length === 0) {
+ throw new Error("No speech was detected in the selected clip.");
}
+ setSegments(nextSegments);
+ setProgressMessage("Captions are ready to add");
+ } catch (reason) {
+ setError(reason instanceof Error ? reason.message : "Local transcription failed.");
+ } finally {
+ await audioContext?.close().catch(() => undefined);
+ setIsTranscribing(false);
}
- }, [
- getSpeechToTextEngine,
- addSubtitle,
- applySubtitleStylePreset,
- selectedStyle,
- ]);
-
- const handleApplySegments = useCallback(async () => {
- if (segments.length === 0) return;
-
- const speechEngine = await getSpeechToTextEngine();
+ }, [clip, mediaItem, runWorker, selectedModel, workerState]);
- const subtitles = speechEngine.segmentsToSubtitles(segments);
- subtitles.forEach((subtitle) => {
- addSubtitle(subtitle);
- });
-
- if (selectedStyle !== "default") {
- await applySubtitleStylePreset(selectedStyle);
+ const handleAddToTimeline = useCallback(async () => {
+ if (!clip || segments.length === 0) return;
+ const style = SUBTITLE_STYLE_PRESETS[selectedStyle] ?? SUBTITLE_STYLE_PRESETS.default;
+ let addedCount = 0;
+ for (const segment of segments) {
+ const cues = splitCaptionIntoSingleLineCues(
+ segment.text,
+ segment.startTime,
+ segment.endTime,
+ maxWordsPerLine,
+ );
+ for (const cue of cues) {
+ await addSubtitle(
+ {
+ id: `whisper-${crypto.randomUUID()}`,
+ text: cue.text,
+ startTime: cue.startTime,
+ endTime: cue.endTime,
+ style,
+ },
+ {
+ captionSource: "whisper",
+ captionSourceClipId: clip.id,
+ captionMaxWordsPerLine: maxWordsPerLine,
+ captionWhisperModel: selectedModel,
+ },
+ );
+ addedCount += 1;
+ }
}
-
setSegments([]);
- }, [
- getSpeechToTextEngine,
- addSubtitle,
- applySubtitleStylePreset,
- segments,
- selectedStyle,
- ]);
+ setProgressMessage(`${addedCount} single-line caption clips added`);
+ }, [addSubtitle, clip, maxWordsPerLine, segments, selectedModel, selectedStyle]);
- if (!isSupported) {
- return (
- <div className="p-4 space-y-3">
- <div className="flex items-center gap-2 text-status-warning">
- <AlertCircle size={16} />
- <Text type="supporting" className="text-[11px] font-medium">
- Browser Not Supported
- </Text>
- </div>
- <Text type="supporting" color="secondary" className="text-[10px]">
- Auto-captions require Chrome or Edge browser with Speech Recognition
- API support.
- </Text>
- </div>
- );
- }
+ const modelStatus = useMemo(() => {
+ const model = WHISPER_MODELS[selectedModel];
+ if (workerState === "ready") {
+ const backend = modelBackends[selectedModel];
+ return `Downloaded and cached${backend ? ` · ${backend === "webgpu" ? "GPU" : "CPU"}` : ""}`;
+ }
+ if (workerState === "loading") return progressMessage || "Downloading model…";
+ return `${model.downloadSize} · ${model.description}`;
+ }, [modelBackends, progressMessage, selectedModel, workerState]);
return (
- <div className="space-y-4 w-full min-w-0 max-w-full">
- <Card variant="muted" padding={2} className="flex items-center gap-2 border border-primary/30 bg-primary/10">
- <Mic size={16} className="text-primary" />
- <div className="flex flex-col gap-0.5">
- <Text type="supporting" color="primary" className="block text-[11px] font-medium">
- Auto-Caption
- </Text>
- <Text type="supporting" color="secondary" className="block text-[9px]">
- Generate captions from speech
+ <div className="w-full min-w-0 space-y-3">
+ <Card variant="muted" padding={3} className="space-y-2 border border-primary/30 bg-primary/5">
+ <div className="flex items-center justify-between gap-2">
+ <Text type="supporting" color="secondary" className="text-[10px]">
+ Model quality
</Text>
+ <Selector
+ label="Local caption model"
+ isLabelHidden
+ size="sm"
+ width={176}
+ value={selectedModel}
+ onChange={handleModelChange}
+ isDisabled={workerState === "loading" || isTranscribing}
+ options={(
+ Object.entries(WHISPER_MODELS) as Array<
+ [WhisperModelKey, (typeof WHISPER_MODELS)[WhisperModelKey]]
+ >
+ ).map(([value, model]) => ({
+ label: model.label,
+ value,
+ }))}
+ />
</div>
+ <div className="flex items-start gap-2">
+ {workerState === "ready" ? (
+ <Check size={15} className="mt-0.5 text-primary" aria-hidden />
+ ) : (
+ <Download size={15} className="mt-0.5 text-primary" aria-hidden />
+ )}
+ <div className="min-w-0 flex-1">
+ <Text type="supporting" weight="bold" className="block text-[11px] text-fg">
+ {WHISPER_MODELS[selectedModel].shortLabel}
+ </Text>
+ <Text type="supporting" color="secondary" className="block text-[9px]">
+ {modelStatus}
+ </Text>
+ </div>
+ </div>
+ {workerState === "loading" && (
+ <div className="h-1.5 overflow-hidden rounded-full bg-bg-2">
+ <div
+ className="h-full bg-primary transition-[width]"
+ style={{ width: `${Math.max(3, Math.min(100, progress * 100))}%` }}
+ />
+ </div>
+ )}
+ {workerState === "idle" && (
+ <Button
+ label={`Download ${WHISPER_MODELS[selectedModel].shortLabel}`}
+ icon={<Download size={13} aria-hidden />}
+ variant="secondary"
+ size="sm"
+ onClick={handlePrepareModel}
+ className="w-full justify-center"
+ />
+ )}
+ <Text type="supporting" color="secondary" className="block text-[9px] leading-relaxed">
+ Stored in this browser after the first download. Media never leaves your device.
+ </Text>
</Card>
<Card variant="muted" padding={3} className="space-y-3">
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- <Languages size={14} className="text-fg-2" />
- <Text type="supporting" color="secondary" className="text-[10px]">
- Language
- </Text>
+ <div className="flex items-center justify-between gap-2">
+ <div className="flex items-center gap-1.5">
+ <Languages size={14} className="text-fg-2" aria-hidden />
+ <Text type="supporting" color="secondary" className="text-[10px]">Language</Text>
</div>
<Selector
- label="Language"
+ label="Caption language"
isLabelHidden
size="sm"
- width={140}
+ width={132}
value={selectedLanguage}
onChange={setSelectedLanguage}
isDisabled={isTranscribing}
- options={languages.map((lang) => ({
- label: lang.name,
- value: lang.code,
+ options={WHISPER_LANGUAGES.map((language) => ({
+ label: language.name,
+ value: language.code,
}))}
/>
</div>
-
- <div className="flex items-center justify-between">
- <Text type="supporting" color="secondary" className="text-[10px]">
- Caption Style
- </Text>
+ <div className="flex items-center justify-between gap-2">
+ <Text type="supporting" color="secondary" className="text-[10px]">Caption style</Text>
<Selector
- label="Caption Style"
+ label="Caption style"
isLabelHidden
size="sm"
- width={140}
+ width={132}
value={selectedStyle}
onChange={setSelectedStyle}
isDisabled={isTranscribing}
options={CAPTION_STYLE_PRESETS.map((preset) => ({
- label: preset.name,
- value: preset.id,
+ label: preset[0].toUpperCase() + preset.slice(1),
+ value: preset,
}))}
/>
</div>
</Card>
{error && (
- <Card variant="muted" padding={2} className="flex items-center gap-2 border border-red-500/30 bg-red-500/10">
- <AlertCircle size={14} className="text-red-400" />
- <Text type="supporting" className="text-[10px] text-red-400">
- {error}
- </Text>
+ <Card variant="muted" padding={2} className="flex items-start gap-2 border border-red-500/30 bg-red-500/10">
+ <AlertCircle size={14} className="mt-0.5 shrink-0 text-red-400" aria-hidden />
+ <Text type="supporting" className="text-[10px] text-red-400">{error}</Text>
</Card>
)}
- {isTranscribing && progress && (
- <Card variant="muted" padding={3} className="space-y-2">
- <div className="flex items-center justify-between">
- <Text type="supporting" color="secondary" className="text-[10px]">
- Status
- </Text>
- <div className="flex items-center gap-1">
- <div className="w-2 h-2 bg-red-500 rounded-full animate-pulse" />
- <Text type="supporting" className="text-[10px] text-red-400">
- Recording
- </Text>
- </div>
- </div>
- <div className="flex items-center justify-between">
- <Text type="supporting" color="secondary" className="text-[10px]">
- Segments Found
- </Text>
- <Text type="supporting" color="primary" className="font-mono text-[10px]">
- {progress.segmentsFound}
- </Text>
- </div>
+ {isTranscribing && (
+ <Card variant="muted" padding={3} className="flex items-center gap-2">
+ <Loader2 size={14} className="animate-spin text-primary" aria-hidden />
+ <Text type="supporting" color="secondary" className="text-[10px]">
+ {progressMessage}
+ </Text>
</Card>
)}
- {segments.length > 0 && !isTranscribing && (
+ {segments.length > 0 && (
<div className="space-y-2">
- <div className="flex items-center justify-between">
- <Text type="supporting" color="secondary" className="text-[10px]">
- {segments.length} caption{segments.length !== 1 ? "s" : ""}{" "}
- detected
- </Text>
- <Button
- label="Add to Timeline"
- variant="primary"
- size="sm"
- onClick={handleApplySegments}
- className="px-2 py-1 text-[10px] bg-primary text-white rounded hover:bg-primary/80 transition-colors"
- />
- </div>
- <div className="max-h-32 overflow-y-auto space-y-1">
+ <div className="max-h-36 space-y-1 overflow-y-auto">
{segments.map((segment, index) => (
- <Card
- key={index}
- variant="muted"
- padding={2}
- className="p-2 bg-bg-1 rounded text-[10px] text-fg"
- >
- <Text as="span" type="supporting" color="secondary" className="font-mono">
- [{segment.startTime.toFixed(1)}s -{" "}
- {segment.endTime.toFixed(1)}s]
- </Text>
- <Text as="span" type="supporting" color="primary" className="ml-2">
- {segment.text}
- </Text>
+ <Card key={`${segment.startTime}-${index}`} variant="muted" padding={2} className="text-[10px]">
+ <span className="font-mono text-fg-muted">{segment.startTime.toFixed(1)}s</span>
+ <span className="ml-2 text-fg">{segment.text}</span>
</Card>
))}
</div>
- </div>
- )}
-
- <div className="flex gap-2">
- {!isTranscribing ? (
- <Button
- label="Start Recording"
- icon={<Mic size={16} />}
- variant="primary"
- size="md"
- onClick={handleStartTranscription}
- className="flex-1 flex items-center justify-center gap-2 px-4 py-2.5 bg-primary text-white rounded-lg hover:bg-primary/80 transition-colors"
- />
- ) : (
<Button
- label="Stop Recording"
- icon={<MicOff size={16} />}
+ label={`Add ${segments.length} as Editable Text`}
variant="primary"
- size="md"
- onClick={handleStopTranscription}
- className="flex-1 flex items-center justify-center gap-2 px-4 py-2.5 bg-red-500 text-white rounded-lg hover:bg-red-600 transition-colors"
+ size="sm"
+ onClick={handleAddToTimeline}
+ className="w-full justify-center"
/>
- )}
- </div>
+ </div>
+ )}
- <Text type="supporting" color="secondary" className="text-center text-[9px]">
- Speak clearly into your microphone. Captions will be generated in
- real-time.
- </Text>
+ <Button
+ label={isTranscribing ? "Transcribing Locally…" : "Transcribe Selected Clip"}
+ icon={
+ isTranscribing ? (
+ <Loader2 size={14} className="animate-spin" aria-hidden />
+ ) : (
+ <Sparkles size={14} aria-hidden />
+ )
+ }
+ variant="primary"
+ size="md"
+ onClick={handleTranscribe}
+ isDisabled={!canTranscribe || isTranscribing}
+ className="w-full justify-center"
+ />
+ {!canTranscribe && (
+ <Text type="supporting" color="secondary" className="block text-center text-[9px]">
+ Select a connected video or audio clip first.
+ </Text>
+ )}
</div>
);
};
diff --git a/apps/web/src/components/editor/inspector/CaptionEditorPanel.test.tsx b/apps/web/src/components/editor/inspector/CaptionEditorPanel.test.tsx
new file mode 100644
index 00000000..3b75017f
--- /dev/null
+++ b/apps/web/src/components/editor/inspector/CaptionEditorPanel.test.tsx
@@ -0,0 +1,113 @@
+import "../../../test/install-local-storage-mock";
+import { afterEach, beforeEach, describe, expect, it } from "vitest";
+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import type { Project, TextClip } from "@openreel/core";
+import { createEmptyProject } from "../../../stores/project/project-helpers";
+import { useEngineStore } from "../../../stores/engine-store";
+import { useProjectStore } from "../../../stores/project-store";
+import { CaptionEditorPanel } from "./CaptionEditorPanel";
+
+const TRACK_ID = "caption-track";
+
+function caption(): TextClip {
+ return {
+ id: "caption-long",
+ trackId: TRACK_ID,
+ startTime: 10,
+ duration: 7,
+ text: "one two three four five six seven",
+ style: {
+ fontFamily: "Inter",
+ fontSize: 48,
+ fontWeight: "bold",
+ fontStyle: "normal",
+ color: "#ffffff",
+ textAlign: "center",
+ verticalAlign: "middle",
+ lineHeight: 1.2,
+ letterSpacing: 0,
+ },
+ transform: {
+ position: { x: 0.5, y: 0.8 },
+ scale: { x: 1, y: 1 },
+ rotation: 0,
+ anchor: { x: 0.5, y: 0.5 },
+ opacity: 1,
+ },
+ keyframes: [],
+ metadata: { captionSource: "srt" },
+ };
+}
+
+function project(textClip: TextClip): Project {
+ const empty = createEmptyProject("Single-line captions");
+ return {
+ ...empty,
+ textClips: [textClip],
+ timeline: {
+ ...empty.timeline,
+ duration: 20,
+ tracks: [
+ {
+ id: TRACK_ID,
+ type: "text",
+ name: "Captions",
+ clips: [],
+ transitions: [],
+ locked: false,
+ hidden: false,
+ muted: false,
+ solo: false,
+ },
+ ],
+ },
+ };
+}
+
+describe("CaptionEditorPanel", () => {
+ beforeEach(() => {
+ const textClip = caption();
+ useEngineStore.getState().getTitleEngine()?.clear();
+ useEngineStore.getState().getTitleEngine()?.loadTextClips([textClip]);
+ useProjectStore.setState({ hasOpenProject: true, project: project(textClip) });
+ });
+
+ afterEach(() => {
+ cleanup();
+ useEngineStore.getState().getTitleEngine()?.clear();
+ useProjectStore.setState({
+ hasOpenProject: false,
+ project: createEmptyProject("Reset"),
+ });
+ });
+
+ it("turns one long caption into sequential single-line clips", async () => {
+ render(
+ <CaptionEditorPanel
+ maxWordsPerLine={5}
+ onMaxWordsPerLineChange={() => undefined}
+ />,
+ );
+
+ fireEvent.click(
+ screen.getByRole("button", { name: "Make all 1 single-line" }),
+ );
+
+ await waitFor(() => {
+ const clips = useEngineStore
+ .getState()
+ .getTitleEngine()
+ ?.getAllTextClips()
+ .sort((left, right) => left.startTime - right.startTime);
+ expect(clips?.map((clip) => clip.text)).toEqual([
+ "one two three four five",
+ "six seven",
+ ]);
+ expect(clips?.map((clip) => [clip.startTime, clip.duration])).toEqual([
+ [10, 5],
+ [15, 2],
+ ]);
+ expect(clips?.every((clip) => !clip.text.includes("\n"))).toBe(true);
+ });
+ });
+});
diff --git a/apps/web/src/components/editor/inspector/CaptionEditorPanel.tsx b/apps/web/src/components/editor/inspector/CaptionEditorPanel.tsx
new file mode 100644
index 00000000..5bde5efd
--- /dev/null
+++ b/apps/web/src/components/editor/inspector/CaptionEditorPanel.tsx
@@ -0,0 +1,237 @@
+import React, { useEffect, useMemo, useState } from "react";
+import { splitCaptionIntoSingleLineCues } from "@openreel/core";
+import {
+ ToolcraftButton as Button,
+ ToolcraftCard as Card,
+ ToolcraftSelectControl as Selector,
+ ToolcraftText as Text,
+} from "@openreel/ui";
+import { Check, WrapText } from "@/icons/lucide-compat";
+import { useProjectStore } from "../../../stores/project-store";
+
+interface CaptionEditorPanelProps {
+ maxWordsPerLine: number;
+ onMaxWordsPerLineChange: (value: number) => void;
+}
+
+export const CaptionEditorPanel: React.FC<CaptionEditorPanelProps> = ({
+ maxWordsPerLine,
+ onMaxWordsPerLineChange,
+}) => {
+ const project = useProjectStore((state) => state.project);
+ const getAllTextClips = useProjectStore((state) => state.getAllTextClips);
+ const updateTextContent = useProjectStore((state) => state.updateTextContent);
+ const pasteOverlayClip = useProjectStore((state) => state.pasteOverlayClip);
+ const updateOverlayClipTiming = useProjectStore(
+ (state) => state.updateOverlayClipTiming,
+ );
+ const captionTrackIds = useMemo(
+ () =>
+ new Set(
+ project.timeline.tracks
+ .filter((track) => track.type === "text" && track.name === "Captions")
+ .map((track) => track.id),
+ ),
+ [project.timeline.tracks],
+ );
+ const projectRevision = project.modifiedAt;
+ const captions = useMemo(() => {
+ void projectRevision;
+ return getAllTextClips()
+ .filter(
+ (clip) =>
+ captionTrackIds.has(clip.trackId) ||
+ typeof clip.metadata?.captionSource === "string",
+ )
+ .sort((left, right) => left.startTime - right.startTime);
+ }, [captionTrackIds, getAllTextClips, projectRevision]);
+ const [selectedIds, setSelectedIds] = useState<Set<string>>(new Set());
+ const [drafts, setDrafts] = useState<Record<string, string>>({});
+
+ useEffect(() => {
+ setDrafts(
+ Object.fromEntries(captions.map((caption) => [caption.id, caption.text])),
+ );
+ setSelectedIds((current) => {
+ const available = new Set(captions.map((caption) => caption.id));
+ return new Set([...current].filter((id) => available.has(id)));
+ });
+ }, [captions]);
+
+ const selectedCount = selectedIds.size;
+ const allSelected = captions.length > 0 && selectedCount === captions.length;
+
+ const toggleAll = () => {
+ setSelectedIds(
+ allSelected ? new Set() : new Set(captions.map((caption) => caption.id)),
+ );
+ };
+
+ const toggleCaption = (captionId: string) => {
+ setSelectedIds((current) => {
+ const next = new Set(current);
+ if (next.has(captionId)) next.delete(captionId);
+ else next.add(captionId);
+ return next;
+ });
+ };
+
+ const commitDraft = (captionId: string) => {
+ const caption = captions.find((candidate) => candidate.id === captionId);
+ const draft = drafts[captionId]?.trim();
+ if (!caption || !draft || draft === caption.text) return;
+ updateTextContent(captionId, draft);
+ };
+
+ const splitSelectionIntoSingleLines = () => {
+ const targets = selectedCount > 0 ? selectedIds : new Set(captions.map((clip) => clip.id));
+ const history = useProjectStore.getState().actionExecutor.getHistory();
+ history.beginGroup("Split captions into single lines");
+ try {
+ for (const caption of captions) {
+ if (!targets.has(caption.id)) continue;
+ const cues = splitCaptionIntoSingleLineCues(
+ drafts[caption.id] ?? caption.text,
+ caption.startTime,
+ caption.startTime + caption.duration,
+ maxWordsPerLine,
+ );
+ const firstCue = cues[0];
+ if (!firstCue) continue;
+
+ updateTextContent(caption.id, firstCue.text);
+ updateOverlayClipTiming(caption.id, {
+ startTime: firstCue.startTime,
+ duration: firstCue.endTime - firstCue.startTime,
+ });
+
+ for (const cue of cues.slice(1)) {
+ const created = pasteOverlayClip(
+ "text",
+ caption,
+ cue.startTime,
+ caption.trackId,
+ );
+ if (!created || !("text" in created)) continue;
+ updateTextContent(created.id, cue.text);
+ updateOverlayClipTiming(created.id, {
+ startTime: cue.startTime,
+ duration: cue.endTime - cue.startTime,
+ });
+ }
+ }
+ } finally {
+ history.endGroup();
+ }
+ };
+
+ return (
+ <div className="space-y-3">
+ <Card variant="muted" padding={3} className="space-y-2 border border-border">
+ <div className="flex items-center justify-between gap-3">
+ <div>
+ <Text type="supporting" weight="bold" className="block text-[11px] text-fg">
+ Single-line captions
+ </Text>
+ <Text type="supporting" color="secondary" className="block text-[9px]">
+ Split each cue into timed clips for vertical video.
+ </Text>
+ </div>
+ <Selector
+ label="Maximum words per caption"
+ isLabelHidden
+ size="sm"
+ width={84}
+ value={String(maxWordsPerLine)}
+ onChange={(value) => onMaxWordsPerLineChange(Number(value))}
+ options={Array.from({ length: 10 }, (_, index) => ({
+ label: String(index + 2),
+ value: String(index + 2),
+ }))}
+ />
+ </div>
+ <Button
+ label={
+ selectedCount > 0
+ ? `Make ${selectedCount} selected single-line`
+ : `Make all ${captions.length} single-line`
+ }
+ icon={<WrapText size={13} aria-hidden />}
+ variant="secondary"
+ size="sm"
+ isDisabled={captions.length === 0}
+ onClick={splitSelectionIntoSingleLines}
+ className="w-full justify-center"
+ />
+ </Card>
+
+ {captions.length === 0 ? (
+ <Text type="supporting" color="secondary" className="block py-3 text-center text-[10px]">
+ Import SRT/VTT or transcribe the selected clip to create editable caption text.
+ </Text>
+ ) : (
+ <>
+ <div className="flex items-center justify-between">
+ <button
+ type="button"
+ onClick={toggleAll}
+ className="text-[10px] font-semibold text-accent hover:underline"
+ >
+ {allSelected ? "Clear selection" : "Select all"}
+ </button>
+ <Text type="supporting" color="secondary" className="text-[9px]">
+ {captions.length} editable text clip{captions.length === 1 ? "" : "s"}
+ </Text>
+ </div>
+ <div className="max-h-72 space-y-2 overflow-y-auto pr-1">
+ {captions.map((caption, index) => {
+ const selected = selectedIds.has(caption.id);
+ return (
+ <Card
+ key={caption.id}
+ variant="muted"
+ padding={2}
+ className={`border ${selected ? "border-accent/60 bg-accent-soft" : "border-border"}`}
+ >
+ <div className="mb-1.5 flex items-center justify-between gap-2">
+ <button
+ type="button"
+ aria-label={`${selected ? "Deselect" : "Select"} caption ${index + 1}`}
+ aria-pressed={selected}
+ onClick={() => toggleCaption(caption.id)}
+ className={`grid h-4 w-4 place-items-center rounded border ${
+ selected
+ ? "border-accent bg-accent text-white"
+ : "border-border bg-bg-1 text-transparent"
+ }`}
+ >
+ <Check size={11} aria-hidden />
+ </button>
+ <Text type="supporting" color="secondary" className="font-mono text-[9px]">
+ {caption.startTime.toFixed(1)}s–{(caption.startTime + caption.duration).toFixed(1)}s
+ </Text>
+ </div>
+ <textarea
+ aria-label={`Caption ${index + 1} text`}
+ rows={Math.max(2, (drafts[caption.id]?.split("\n").length ?? 1))}
+ value={drafts[caption.id] ?? caption.text}
+ onChange={(event) =>
+ setDrafts((current) => ({
+ ...current,
+ [caption.id]: event.currentTarget.value,
+ }))
+ }
+ onBlur={() => commitDraft(caption.id)}
+ className="w-full resize-y rounded-md border border-border bg-bg-1 px-2 py-1.5 text-[11px] leading-relaxed text-fg outline-none focus:border-accent"
+ />
+ </Card>
+ );
+ })}
+ </div>
+ </>
+ )}
+ </div>
+ );
+};
+
+export default CaptionEditorPanel;
diff --git a/apps/web/src/components/editor/inspector/tabs/AiTab.tsx b/apps/web/src/components/editor/inspector/tabs/AiTab.tsx
index 4969d0c9..c25c2051 100644
--- a/apps/web/src/components/editor/inspector/tabs/AiTab.tsx
+++ b/apps/web/src/components/editor/inspector/tabs/AiTab.tsx
@@ -13,6 +13,8 @@ import {
getAnimationStyleDisplayName,
} from "@openreel/core";
import { AutoReframeSection } from "../";
+import { AutoCaptionPanel } from "../AutoCaptionPanel";
+import { CaptionEditorPanel } from "../CaptionEditorPanel";
import { AutoEditPanel } from "../../panels/AutoEditPanel";
import { HighlightExtractorPanel } from "../../panels/HighlightExtractorPanel";
import { InspectorSection } from "../shell/InspectorSection";
@@ -51,6 +53,8 @@ export interface AiTabProps {
isEnhancingAudio: boolean;
audioEnhanced: boolean;
isApplyingSelectedClipEffect: boolean;
+ captionWordsPerLine: number;
+ onCaptionWordsPerLineChange: (value: number) => void;
}
export const AiTab: React.FC<AiTabProps> = ({
@@ -74,6 +78,8 @@ export const AiTab: React.FC<AiTabProps> = ({
isEnhancingAudio,
audioEnhanced,
isApplyingSelectedClipEffect,
+ captionWordsPerLine,
+ onCaptionWordsPerLineChange,
}) => {
const gpuClipMedia = asGpuClipMedia(clipType);
// On desktop the local transcription endpoint (cloud.openreel.video) is
@@ -96,17 +102,21 @@ export const AiTab: React.FC<AiTabProps> = ({
{clipType === "video" && (
<>
<InspectorSection
- title="AI Auto-Captions"
+ title="Local Auto-Captions"
sectionId="auto-captions"
defaultOpen={false}
>
<div className="space-y-3">
+ <AutoCaptionPanel
+ clipId={clipId}
+ maxWordsPerLine={captionWordsPerLine}
+ />
<FileInput
ref={srtInputRef}
- label="Import SRT file"
+ label="Import SRT or VTT file"
isLabelHidden
value={null}
- accept=".srt,text/srt,text/plain"
+ accept=".srt,.vtt,text/srt,text/vtt,text/plain"
onChange={(files) => {
const file = Array.isArray(files) ? files[0] : files;
if (!file) return;
@@ -210,7 +220,7 @@ export const AiTab: React.FC<AiTabProps> = ({
</>
)}
<Button
- label="Import SRT File"
+ label="Import SRT / VTT as Text"
onClick={() => srtInputRef.current?.click()}
isDisabled={isTranscribing}
variant="secondary"
@@ -223,6 +233,19 @@ export const AiTab: React.FC<AiTabProps> = ({
</>
)}
+ {clipType === "video" && (
+ <InspectorSection
+ title="Editable Captions"
+ sectionId="editable-captions"
+ defaultOpen={false}
+ >
+ <CaptionEditorPanel
+ maxWordsPerLine={captionWordsPerLine}
+ onMaxWordsPerLineChange={onCaptionWordsPerLineChange}
+ />
+ </InspectorSection>
+ )}
+
{clipType === "video" && (
<InspectorSection
title="Auto Reframe"
diff --git a/apps/web/src/components/editor/timeline/CaptionBatchSelectButton.test.tsx b/apps/web/src/components/editor/timeline/CaptionBatchSelectButton.test.tsx
new file mode 100644
index 00000000..97b669b8
--- /dev/null
+++ b/apps/web/src/components/editor/timeline/CaptionBatchSelectButton.test.tsx
@@ -0,0 +1,89 @@
+import "../../../test/install-local-storage-mock";
+import { cleanup, fireEvent, render, screen } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it } from "vitest";
+import type { Project, TextClip } from "@openreel/core";
+import { createEmptyProject } from "../../../stores/project/project-helpers";
+import { useProjectStore } from "../../../stores/project-store";
+import { useUIStore } from "../../../stores/ui-store";
+import { CaptionBatchSelectButton } from "./CaptionBatchSelectButton";
+
+const TRACK_ID = "caption-track";
+
+function caption(id: string, startTime: number): TextClip {
+ return {
+ id,
+ trackId: TRACK_ID,
+ startTime,
+ duration: 1,
+ text: id,
+ style: {
+ fontFamily: "Inter",
+ fontSize: 48,
+ fontWeight: "bold",
+ fontStyle: "normal",
+ color: "#ffffff",
+ textAlign: "center",
+ verticalAlign: "middle",
+ lineHeight: 1.2,
+ letterSpacing: 0,
+ },
+ transform: {
+ position: { x: 0.5, y: 0.8 },
+ scale: { x: 1, y: 1 },
+ rotation: 0,
+ anchor: { x: 0.5, y: 0.5 },
+ opacity: 1,
+ },
+ keyframes: [],
+ metadata: { captionSource: "whisper" },
+ };
+}
+
+function captionProject(): Project {
+ const empty = createEmptyProject("Caption selection");
+ return {
+ ...empty,
+ textClips: [caption("caption-a", 0), caption("caption-b", 2)],
+ timeline: {
+ ...empty.timeline,
+ tracks: [
+ {
+ id: TRACK_ID,
+ type: "text",
+ name: "Captions",
+ clips: [],
+ transitions: [],
+ locked: false,
+ hidden: false,
+ muted: false,
+ solo: false,
+ },
+ ],
+ },
+ };
+}
+
+describe("CaptionBatchSelectButton", () => {
+ beforeEach(() => {
+ useProjectStore.setState({ project: captionProject(), hasOpenProject: true });
+ useUIStore.getState().clearSelection();
+ });
+
+ afterEach(() => {
+ cleanup();
+ useUIStore.getState().clearSelection();
+ });
+
+ it("makes caption batch selection visible and selects every caption", () => {
+ render(<CaptionBatchSelectButton />);
+
+ fireEvent.click(
+ screen.getByRole("button", { name: "Select all captions (2)" }),
+ );
+
+ expect(useUIStore.getState().selectedItems).toEqual([
+ { id: "caption-a", trackId: TRACK_ID, type: "text-clip" },
+ { id: "caption-b", trackId: TRACK_ID, type: "text-clip" },
+ ]);
+ });
+});
diff --git a/apps/web/src/components/editor/timeline/CaptionBatchSelectButton.tsx b/apps/web/src/components/editor/timeline/CaptionBatchSelectButton.tsx
new file mode 100644
index 00000000..09f0dc01
--- /dev/null
+++ b/apps/web/src/components/editor/timeline/CaptionBatchSelectButton.tsx
@@ -0,0 +1,36 @@
+import React, { useMemo } from "react";
+import { ListChecks } from "@/icons/lucide-compat";
+import { ToolcraftButton as Button } from "@openreel/ui";
+import { useProjectStore } from "../../../stores/project-store";
+import { useUIStore } from "../../../stores/ui-store";
+import { getTimelineTrackSelection } from "../../../utils/timeline-item-actions";
+
+export const CaptionBatchSelectButton: React.FC = () => {
+ const project = useProjectStore((state) => state.project);
+ const selectMultiple = useUIStore((state) => state.selectMultiple);
+
+ const captionSelection = useMemo(() => {
+ const captionTrack = project.timeline.tracks.find(
+ (track) =>
+ track.type === "text" && track.name.trim().toLowerCase() === "captions",
+ );
+ return captionTrack
+ ? getTimelineTrackSelection(project, captionTrack.id)
+ : [];
+ }, [project]);
+
+ if (captionSelection.length < 2) return null;
+
+ return (
+ <Button
+ label={`Select all captions (${captionSelection.length})`}
+ icon={<ListChecks size={14} aria-hidden />}
+ size="sm"
+ variant="secondary"
+ onClick={() => selectMultiple(captionSelection)}
+ className="whitespace-nowrap"
+ />
+ );
+};
+
+export default CaptionBatchSelectButton;
diff --git a/apps/web/src/components/editor/timeline/ClipContextMenu.tsx b/apps/web/src/components/editor/timeline/ClipContextMenu.tsx
index 86f1a023..7f87dbd6 100644
--- a/apps/web/src/components/editor/timeline/ClipContextMenu.tsx
+++ b/apps/web/src/components/editor/timeline/ClipContextMenu.tsx
@@ -11,10 +11,13 @@ import {
Film,
Image,
ArrowLeftToLine,
+ ListChecks,
} from "@/icons/lucide-compat";
import type { Clip, Track } from "@openreel/core";
import { useProjectStore } from "../../../stores/project-store";
import { useTimelineStore } from "../../../stores/timeline-store";
+import { useUIStore } from "../../../stores/ui-store";
+import { getTimelineTrackSelection } from "../../../utils/timeline-item-actions";
interface ClipContextMenuProps {
clip: Clip;
@@ -41,6 +44,7 @@ export function useClipContextMenuItems({
closeGapBeforeClip,
} = useProjectStore();
const { playheadPosition } = useTimelineStore();
+ const selectMultiple = useUIStore((state) => state.selectMultiple);
const isPlayheadOnClip =
playheadPosition >= clip.startTime &&
@@ -78,6 +82,12 @@ export function useClipContextMenuItems({
onClose?.();
};
+ const handleSelectTrackClips = () => {
+ const project = useProjectStore.getState().project;
+ selectMultiple(getTimelineTrackSelection(project, track.id));
+ onClose?.();
+ };
+
const handleDelete = async () => {
await removeClip(clip.id);
onClose?.();
@@ -152,6 +162,11 @@ export function useClipContextMenuItems({
icon: <Layers size={14} aria-hidden />,
onClick: handleDuplicate,
},
+ {
+ label: "Select All Clips on Track",
+ icon: <ListChecks size={14} aria-hidden />,
+ onClick: handleSelectTrackClips,
+ },
{ type: "divider" },
{
label: "Split at Playhead",
diff --git a/apps/web/src/components/editor/timeline/GraphicsClipContextMenu.tsx b/apps/web/src/components/editor/timeline/GraphicsClipContextMenu.tsx
index 463b5b8e..92ab2f50 100644
--- a/apps/web/src/components/editor/timeline/GraphicsClipContextMenu.tsx
+++ b/apps/web/src/components/editor/timeline/GraphicsClipContextMenu.tsx
@@ -5,9 +5,12 @@ import {
Trash2,
Shapes,
Type,
+ ListChecks,
} from "@/icons/lucide-compat";
import type { ShapeClip, SVGClip, StickerClip, TextClip } from "@openreel/core";
import { useProjectStore } from "../../../stores/project-store";
+import { useUIStore } from "../../../stores/ui-store";
+import { getTimelineTrackSelection } from "../../../utils/timeline-item-actions";
type GraphicsClipType = ShapeClip | SVGClip | StickerClip | TextClip;
@@ -32,6 +35,18 @@ export function useGraphicsClipContextMenuItems({
deleteStickerClip,
deleteTextClip,
} = useProjectStore();
+ const selectMultiple = useUIStore((state) => state.selectMultiple);
+ const project = useProjectStore((state) => state.project);
+ const isCaption =
+ clipType === "text" &&
+ (project.timeline.tracks.some(
+ (track) =>
+ track.id === clip.trackId &&
+ track.type === "text" &&
+ track.name.trim().toLowerCase() === "captions",
+ ) ||
+ ("metadata" in clip &&
+ typeof clip.metadata?.captionSource === "string"));
const handleDelete = () => {
if (onDelete) {
@@ -61,6 +76,12 @@ export function useGraphicsClipContextMenuItems({
onClose?.();
};
+ const handleSelectTrackClips = () => {
+ const project = useProjectStore.getState().project;
+ selectMultiple(getTimelineTrackSelection(project, clip.trackId));
+ onClose?.();
+ };
+
const getClipTypeLabel = () => {
switch (clipType) {
case "shape":
@@ -113,6 +134,15 @@ export function useGraphicsClipContextMenuItems({
);
}
+ items.push(
+ {
+ label: isCaption ? "Select All Captions" : "Select All Clips on Track",
+ icon: <ListChecks size={14} aria-hidden />,
+ onClick: handleSelectTrackClips,
+ },
+ { type: "divider" },
+ );
+
items.push({
label: "Delete",
icon: <Trash2 size={14} aria-hidden />,
diff --git a/apps/web/src/components/editor/timeline/TrackClipSelectionMenu.test.tsx b/apps/web/src/components/editor/timeline/TrackClipSelectionMenu.test.tsx
new file mode 100644
index 00000000..a1820267
--- /dev/null
+++ b/apps/web/src/components/editor/timeline/TrackClipSelectionMenu.test.tsx
@@ -0,0 +1,151 @@
+import "../../../test/install-local-storage-mock";
+import { act, cleanup, renderHook } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it } from "vitest";
+import type { Clip, Project, TextClip, Track } from "@openreel/core";
+import type { ToolcraftContextMenuOption as ContextMenuOption } from "@openreel/ui";
+import { createEmptyProject } from "../../../stores/project/project-helpers";
+import { useProjectStore } from "../../../stores/project-store";
+import { useUIStore } from "../../../stores/ui-store";
+import { useClipContextMenuItems } from "./ClipContextMenu";
+import { useGraphicsClipContextMenuItems } from "./GraphicsClipContextMenu";
+
+const MEDIA_TRACK_ID = "video-track";
+const TEXT_TRACK_ID = "caption-track";
+
+function mediaClip(id: string, startTime: number): Clip {
+ return {
+ id,
+ mediaId: `media-${id}`,
+ trackId: MEDIA_TRACK_ID,
+ startTime,
+ duration: 2,
+ inPoint: 0,
+ outPoint: 2,
+ effects: [],
+ audioEffects: [],
+ transform: {
+ position: { x: 0, y: 0 },
+ scale: { x: 1, y: 1 },
+ rotation: 0,
+ anchor: { x: 0.5, y: 0.5 },
+ opacity: 1,
+ },
+ volume: 1,
+ keyframes: [],
+ };
+}
+
+function caption(id: string, startTime: number): TextClip {
+ return {
+ id,
+ trackId: TEXT_TRACK_ID,
+ startTime,
+ duration: 1,
+ text: id,
+ style: {
+ fontFamily: "Inter",
+ fontSize: 48,
+ fontWeight: "bold",
+ fontStyle: "normal",
+ color: "#ffffff",
+ textAlign: "center",
+ verticalAlign: "middle",
+ lineHeight: 1.2,
+ letterSpacing: 0,
+ },
+ transform: {
+ position: { x: 0.5, y: 0.8 },
+ scale: { x: 1, y: 1 },
+ rotation: 0,
+ anchor: { x: 0.5, y: 0.5 },
+ opacity: 1,
+ },
+ keyframes: [],
+ };
+}
+
+function testProject(): Project {
+ const empty = createEmptyProject("Track selection");
+ const mediaClips = [mediaClip("video-a", 0), mediaClip("video-b", 3)];
+ return {
+ ...empty,
+ timeline: {
+ ...empty.timeline,
+ tracks: [
+ {
+ id: MEDIA_TRACK_ID,
+ type: "video",
+ name: "Video",
+ clips: mediaClips,
+ transitions: [],
+ locked: false,
+ hidden: false,
+ muted: false,
+ solo: false,
+ },
+ {
+ id: TEXT_TRACK_ID,
+ type: "text",
+ name: "Captions",
+ clips: [],
+ transitions: [],
+ locked: false,
+ hidden: false,
+ muted: false,
+ solo: false,
+ },
+ ],
+ },
+ textClips: [caption("caption-a", 0), caption("caption-b", 2)],
+ };
+}
+
+function menuAction(items: ContextMenuOption[], label: string): () => void {
+ const item = items.find(
+ (candidate) => "label" in candidate && candidate.label === label,
+ );
+ if (!item || !("onClick" in item) || !item.onClick) {
+ throw new Error(`Missing menu action: ${label}`);
+ }
+ return item.onClick;
+}
+
+describe("select all clips on track context menu", () => {
+ beforeEach(() => {
+ useProjectStore.setState({ project: testProject(), hasOpenProject: true });
+ useUIStore.getState().clearSelection();
+ });
+
+ afterEach(() => {
+ cleanup();
+ useUIStore.getState().clearSelection();
+ });
+
+ it("selects all media clips from a media clip menu", () => {
+ const track = useProjectStore.getState().project.timeline.tracks[0] as Track;
+ const clip = track.clips[0];
+ const { result } = renderHook(() => useClipContextMenuItems({ clip, track }));
+
+ act(() => menuAction(result.current, "Select All Clips on Track")());
+
+ expect(useUIStore.getState().selectedItems).toEqual([
+ { id: "video-a", trackId: MEDIA_TRACK_ID, type: "clip" },
+ { id: "video-b", trackId: MEDIA_TRACK_ID, type: "clip" },
+ ]);
+ });
+
+ it("selects all editable captions from a caption menu", () => {
+ const clip = useProjectStore.getState().project.textClips?.[0];
+ if (!clip) throw new Error("Caption fixture was not created");
+ const { result } = renderHook(() =>
+ useGraphicsClipContextMenuItems({ clip, clipType: "text" }),
+ );
+
+ act(() => menuAction(result.current, "Select All Captions")());
+
+ expect(useUIStore.getState().selectedItems).toEqual([
+ { id: "caption-a", trackId: TEXT_TRACK_ID, type: "text-clip" },
+ { id: "caption-b", trackId: TEXT_TRACK_ID, type: "text-clip" },
+ ]);
+ });
+});
diff --git a/apps/web/src/components/editor/timeline/TrackHeader.tsx b/apps/web/src/components/editor/timeline/TrackHeader.tsx
index 6accd886..7cf4cd98 100644
--- a/apps/web/src/components/editor/timeline/TrackHeader.tsx
+++ b/apps/web/src/components/editor/timeline/TrackHeader.tsx
@@ -1,5 +1,5 @@
import React, { useState, useRef, useEffect } from "react";
-import { Eye, EyeOff, Volume2, VolumeX, Lock, Trash2, Pencil, AlignLeft } from "@/icons/lucide-compat";
+import { Eye, EyeOff, Volume2, VolumeX, Lock, Trash2, Pencil, AlignLeft, Link2, Unlink } from "@/icons/lucide-compat";
import {
ToolcraftContextMenu as ContextMenu,
type ToolcraftContextMenuOption as ContextMenuOption,
@@ -36,6 +36,7 @@ export const TrackHeader: React.FC<TrackHeaderProps> = ({
removeTrack,
renameTrack,
consolidateTrack,
+ groupTracks,
project,
} = useProjectStore();
const { getTrackHeight } = useTimelineStore();
@@ -56,6 +57,14 @@ export const TrackHeader: React.FC<TrackHeaderProps> = ({
);
const effectivelyMuted =
isAudio && (track.muted || (hasSoloedAudioTrack && !track.solo));
+ const groupCandidates = project.timeline.tracks.filter(
+ (candidate) =>
+ candidate.id !== track.id &&
+ candidate.groupId !== track.groupId &&
+ (track.type === "text"
+ ? candidate.type !== "text" && candidate.type !== "graphics"
+ : candidate.type === "text"),
+ );
const handleRemoveTrack = async () => {
await removeTrack(track.id);
@@ -111,6 +120,28 @@ export const TrackHeader: React.FC<TrackHeaderProps> = ({
isDisabled: !hasGaps,
onClick: handleRemoveGaps,
},
+ ...(track.groupId
+ ? [
+ {
+ label: "Ungroup Track",
+ icon: <Unlink size={14} aria-hidden />,
+ onClick: () => groupTracks(track.id),
+ } satisfies ContextMenuOption,
+ ]
+ : []),
+ ...(groupCandidates.length > 0
+ ? [
+ {
+ type: "section" as const,
+ title: "Move & trim together",
+ items: groupCandidates.map((candidate) => ({
+ label: `Group with ${candidate.name}`,
+ icon: <Link2 size={14} aria-hidden />,
+ onClick: () => groupTracks(track.id, candidate.id),
+ })),
+ } satisfies ContextMenuOption,
+ ]
+ : []),
{ type: "divider" },
{
label: "Delete Track",
@@ -163,6 +194,13 @@ export const TrackHeader: React.FC<TrackHeaderProps> = ({
</div>
<div className="flex items-center gap-2.5 shrink-0">
+ {track.groupId && (
+ <Link2
+ size={13}
+ className="text-accent"
+ aria-label="Track is grouped"
+ />
+ )}
{isVisual && (
<button
type="button"
diff --git a/apps/web/src/stores/project-store.test.ts b/apps/web/src/stores/project-store.test.ts
index a7f80134..670bb986 100644
--- a/apps/web/src/stores/project-store.test.ts
+++ b/apps/web/src/stores/project-store.test.ts
@@ -2083,6 +2083,44 @@ Ignored block`;
expect(captionClips).toHaveLength(1);
expect(captionClips[0]?.text).toBe("Hello world");
});
+
+ it("imports long SRT cues as sequential single-line caption clips", async () => {
+ const result = await useProjectStore.getState().importSRT(
+ `1
+00:00:10,000 --> 00:00:17,000
+one two three four five six seven`,
+ { maxWordsPerLine: 5 },
+ );
+
+ expect(result.success).toBe(true);
+ const captionClips = useProjectStore
+ .getState()
+ .getAllTextClips()
+ .sort((left, right) => left.startTime - right.startTime);
+ expect(captionClips).toHaveLength(2);
+ expect(captionClips.map((clip) => clip.text)).toEqual([
+ "one two three four five",
+ "six seven",
+ ]);
+ expect(captionClips.map((clip) => [clip.startTime, clip.duration])).toEqual([
+ [10, 5],
+ [15, 2],
+ ]);
+ expect(captionClips.every((clip) => !clip.text.includes("\n"))).toBe(true);
+ });
+
+ it("exports edited caption text clips back to SRT", async () => {
+ await useProjectStore.getState().importSRT(`1
+00:00:01,000 --> 00:00:03,000
+Original caption`);
+ const caption = useProjectStore.getState().getAllTextClips()[0];
+ useProjectStore.getState().updateTextContent(caption.id, "Edited caption");
+
+ const exported = await useProjectStore.getState().exportSRT();
+
+ expect(exported).toContain("00:00:01,000 --> 00:00:03,000");
+ expect(exported).toContain("Edited caption");
+ });
});
describe("ProjectStore - generated shader registry lifecycle", () => {
diff --git a/apps/web/src/stores/project-store.ts b/apps/web/src/stores/project-store.ts
index 2098f8bb..8de9a411 100644
--- a/apps/web/src/stores/project-store.ts
+++ b/apps/web/src/stores/project-store.ts
@@ -173,6 +173,7 @@ export interface ProjectState {
hideTrack: (trackId: string, hidden: boolean) => Promise<ActionResult>;
muteTrack: (trackId: string, muted: boolean) => Promise<ActionResult>;
soloTrack: (trackId: string, solo: boolean) => Promise<ActionResult>;
+ groupTracks: (trackId: string, partnerTrackId?: string) => boolean;
renameTrack: (trackId: string, name: string) => Promise<ActionResult>;
getTrack: (trackId: string) => Track | undefined;
@@ -330,6 +331,7 @@ export interface ProjectState {
text: string,
duration?: number,
style?: Partial<TextStyle>,
+ metadata?: import("@openreel/core").ClipMetadata,
) => TextClip | null;
updateTextContent: (clipId: string, text: string) => TextClip | null;
updateTextStyle: (
@@ -370,7 +372,10 @@ export interface ProjectState {
getAvailableAnimationPresets: () => TextAnimationPreset[];
// Subtitle actions - subtitles are created as text clips on a Captions track
- addSubtitle: (subtitle: import("@openreel/core").Subtitle) => Promise<void>;
+ addSubtitle: (
+ subtitle: import("@openreel/core").Subtitle,
+ metadata?: import("@openreel/core").ClipMetadata,
+ ) => Promise<void>;
removeSubtitle: (subtitleId: string) => void;
updateSubtitle: (
subtitleId: string,
@@ -380,7 +385,8 @@ export interface ProjectState {
subtitleId: string,
) => import("@openreel/core").Subtitle | undefined;
importSRT: (
- srtContent: string
+ srtContent: string,
+ options?: { sourceClipId?: string; maxWordsPerLine?: number },
) => Promise<{ success: boolean; errors: string[] }>;
exportSRT: () => Promise<string>;
applySubtitleStylePreset: (presetName: string) => Promise<boolean>;
diff --git a/apps/web/src/stores/project/subtitle-slice.ts b/apps/web/src/stores/project/subtitle-slice.ts
index 3b87f73a..c572256d 100644
--- a/apps/web/src/stores/project/subtitle-slice.ts
+++ b/apps/web/src/stores/project/subtitle-slice.ts
@@ -2,6 +2,7 @@ import { v4 as uuidv4 } from "uuid";
import type { StoreApi } from "zustand";
import type { ProjectState } from "../project-store";
import { useEngineStore } from "../engine-store";
+import { splitCaptionIntoSingleLineCues } from "@openreel/core";
type Get = StoreApi<ProjectState>["getState"];
type Set = StoreApi<ProjectState>["setState"];
@@ -20,7 +21,7 @@ export type SubtitleSlice = Pick<
export function createSubtitleSlice(set: Set, get: Get): SubtitleSlice {
return {
- addSubtitle: async (subtitle) => {
+ addSubtitle: async (subtitle, metadata) => {
const { project, addTrack, createTextClip } = get();
let captionsTrack = project.timeline.tracks.find(
@@ -73,7 +74,14 @@ export function createSubtitleSlice(set: Set, get: Get): SubtitleSlice {
backgroundColor: style.backgroundColor || undefined,
}
: undefined,
+ metadata,
);
+ if (typeof metadata?.captionSourceClipId === "string") {
+ const sourceTrack = get().project.timeline.tracks.find((track) =>
+ track.clips.some((clip) => clip.id === metadata.captionSourceClipId),
+ );
+ if (sourceTrack) get().groupTracks(sourceTrack.id, captionsTrack.id);
+ }
},
removeSubtitle: (subtitleId) => {
@@ -101,7 +109,10 @@ export function createSubtitleSlice(set: Set, get: Get): SubtitleSlice {
getSubtitle: (subtitleId) =>
get().project.timeline.subtitles.find((s) => s.id === subtitleId),
- importSRT: async (srtContent: string) => {
+ importSRT: async (
+ srtContent: string,
+ options?: { sourceClipId?: string; maxWordsPerLine?: number },
+ ) => {
const subtitleEngine = await useEngineStore
.getState()
.getSubtitleEngine();
@@ -123,7 +134,30 @@ export function createSubtitleSlice(set: Set, get: Get): SubtitleSlice {
}
for (const subtitle of result.subtitles) {
- await addSubtitle(subtitle);
+ const maxWordsPerLine = options?.maxWordsPerLine;
+ const cues = maxWordsPerLine
+ ? splitCaptionIntoSingleLineCues(
+ subtitle.text,
+ subtitle.startTime,
+ subtitle.endTime,
+ maxWordsPerLine,
+ )
+ : [subtitle];
+ for (const cue of cues) {
+ await addSubtitle(
+ {
+ ...subtitle,
+ text: cue.text,
+ startTime: cue.startTime,
+ endTime: cue.endTime,
+ },
+ {
+ captionSource: normalizedCaptionSource(srtContent),
+ captionSourceClipId: options?.sourceClipId,
+ captionMaxWordsPerLine: maxWordsPerLine,
+ },
+ );
+ }
}
return { success: true, errors: errorMessages };
@@ -133,7 +167,33 @@ export function createSubtitleSlice(set: Set, get: Get): SubtitleSlice {
const subtitleEngine = await useEngineStore
.getState()
.getSubtitleEngine();
- return subtitleEngine.exportSRT(get().project.timeline);
+ const { project } = get();
+ const captionsTrackIds = new Set(
+ project.timeline.tracks
+ .filter((track) => track.type === "text" && track.name === "Captions")
+ .map((track) => track.id),
+ );
+ const subtitles = get()
+ .getAllTextClips()
+ .filter(
+ (clip) =>
+ captionsTrackIds.has(clip.trackId) ||
+ typeof clip.metadata?.captionSource === "string",
+ )
+ .map((clip) => ({
+ id: clip.id,
+ text: clip.text,
+ startTime: clip.startTime,
+ endTime: clip.startTime + clip.duration,
+ style: {
+ fontFamily: clip.style.fontFamily,
+ fontSize: clip.style.fontSize,
+ color: clip.style.color,
+ backgroundColor: clip.style.backgroundColor ?? "transparent",
+ position: "bottom" as const,
+ },
+ }));
+ return subtitleEngine.exportSRT({ ...project.timeline, subtitles });
},
applySubtitleStylePreset: async (presetName: string) => {
@@ -141,44 +201,25 @@ export function createSubtitleSlice(set: Set, get: Get): SubtitleSlice {
.getState()
.getSubtitleEngine();
- const { project } = get();
- const result = subtitleEngine.applyStylePreset(
- project.timeline,
- presetName,
- );
-
- if ("error" in result) {
- console.error(result.error);
+ const preset = subtitleEngine.getStylePreset(presetName);
+ if (!preset) {
+ console.error(`Unknown style preset: ${presetName}`);
return false;
}
-
- const priorSubtitles = project.timeline.subtitles.map((s) => ({ ...s }));
- set({
- project: {
- ...project,
- timeline: result.timeline,
- modifiedAt: Date.now(),
- },
- clipRedoStack: [],
- templateRedoStack: [],
- });
- const actionId = uuidv4();
- get()
- .actionExecutor.getHistory()
- .push(
- {
- type: "subtitle/setAll",
- id: actionId,
- timestamp: Date.now(),
- params: { subtitles: result.timeline.subtitles },
- },
- {
- type: "subtitle/setAll",
- id: `inverse-${actionId}`,
- timestamp: Date.now(),
- params: { subtitles: priorSubtitles },
- },
- );
+ const captionsTrackIds = new Set(
+ get().project.timeline.tracks
+ .filter((track) => track.type === "text" && track.name === "Captions")
+ .map((track) => track.id),
+ );
+ for (const clip of get().getAllTextClips()) {
+ if (!captionsTrackIds.has(clip.trackId)) continue;
+ get().updateTextStyle(clip.id, {
+ fontFamily: preset.fontFamily,
+ fontSize: preset.fontSize,
+ color: preset.color,
+ backgroundColor: preset.backgroundColor,
+ });
+ }
return true;
},
@@ -190,3 +231,9 @@ export function createSubtitleSlice(set: Set, get: Get): SubtitleSlice {
},
};
}
+
+function normalizedCaptionSource(content: string): "srt" | "vtt" {
+ return content.replace(/^\uFEFF/, "").trimStart().startsWith("WEBVTT")
+ ? "vtt"
+ : "srt";
+}
diff --git a/apps/web/src/stores/project/text-graphics-slice.ts b/apps/web/src/stores/project/text-graphics-slice.ts
index 6bc5bbfe..93fdc395 100644
--- a/apps/web/src/stores/project/text-graphics-slice.ts
+++ b/apps/web/src/stores/project/text-graphics-slice.ts
@@ -194,7 +194,14 @@ export function createTextGraphicsSlice(
};
return {
- createTextClip: (trackId, startTime, text, duration = 5, style) => {
+ createTextClip: (
+ trackId,
+ startTime,
+ text,
+ duration = 5,
+ style,
+ metadata,
+ ) => {
const titleEngine = useEngineStore.getState().titleEngine;
if (!titleEngine) {
console.error("TitleEngine not available yet");
@@ -212,6 +219,7 @@ export function createTextGraphicsSlice(
text,
duration,
style,
+ metadata,
});
recordOverlayCreate("text", "textClips", textClip);
return textClip;
diff --git a/apps/web/src/stores/project/track-slice.ts b/apps/web/src/stores/project/track-slice.ts
index 6dab585e..f14ae330 100644
--- a/apps/web/src/stores/project/track-slice.ts
+++ b/apps/web/src/stores/project/track-slice.ts
@@ -17,6 +17,7 @@ export type TrackSlice = Pick<
| "hideTrack"
| "muteTrack"
| "soloTrack"
+ | "groupTracks"
| "getTrack"
| "consolidateTrack"
>;
@@ -189,6 +190,61 @@ export function createTrackSlice(set: Set, get: Get): TrackSlice {
return result;
},
+ groupTracks: (trackId, partnerTrackId) => {
+ const { project } = get();
+ const source = project.timeline.tracks.find((track) => track.id === trackId);
+ if (!source) return false;
+
+ if (!partnerTrackId) {
+ if (!source.groupId) return true;
+ const groupMembers = project.timeline.tracks.filter(
+ (track) => track.groupId === source.groupId,
+ );
+ set({
+ project: {
+ ...project,
+ timeline: {
+ ...project.timeline,
+ tracks: project.timeline.tracks.map((track) =>
+ track.id === trackId ||
+ (groupMembers.length === 2 && track.groupId === source.groupId)
+ ? { ...track, groupId: undefined }
+ : track,
+ ),
+ },
+ modifiedAt: Date.now(),
+ },
+ });
+ return true;
+ }
+
+ const partner = project.timeline.tracks.find(
+ (track) => track.id === partnerTrackId,
+ );
+ if (!partner || partner.id === source.id) return false;
+ const groupId = source.groupId ?? partner.groupId ?? `track-group-${uuidv4()}`;
+ const mergedGroupIds = new Set(
+ [source.groupId, partner.groupId].filter(Boolean) as string[],
+ );
+ set({
+ project: {
+ ...project,
+ timeline: {
+ ...project.timeline,
+ tracks: project.timeline.tracks.map((track) =>
+ track.id === source.id ||
+ track.id === partner.id ||
+ (track.groupId ? mergedGroupIds.has(track.groupId) : false)
+ ? { ...track, groupId }
+ : track,
+ ),
+ },
+ modifiedAt: Date.now(),
+ },
+ });
+ return true;
+ },
+
getTrack: (trackId) =>
get().project.timeline.tracks.find((track) => track.id === trackId),
diff --git a/apps/web/src/stores/project/types.ts b/apps/web/src/stores/project/types.ts
index 83b8a8e8..f8f16599 100644
--- a/apps/web/src/stores/project/types.ts
+++ b/apps/web/src/stores/project/types.ts
@@ -151,6 +151,7 @@ export interface ProjectState {
hideTrack: (trackId: string, hidden: boolean) => Promise<ActionResult>;
muteTrack: (trackId: string, muted: boolean) => Promise<ActionResult>;
soloTrack: (trackId: string, solo: boolean) => Promise<ActionResult>;
+ groupTracks: (trackId: string, partnerTrackId?: string) => boolean;
getTrack: (trackId: string) => Track | undefined;
addClip: (
@@ -248,6 +249,7 @@ export interface ProjectState {
text: string,
duration?: number,
style?: Partial<TextStyle>,
+ metadata?: import("@openreel/core").ClipMetadata,
) => TextClip | null;
updateTextContent: (clipId: string, text: string) => TextClip | null;
updateTextStyle: (
@@ -287,14 +289,20 @@ export interface ProjectState {
) => TextClip | null;
getAvailableAnimationPresets: () => TextAnimationPreset[];
- addSubtitle: (subtitle: Subtitle) => Promise<void>;
+ addSubtitle: (
+ subtitle: Subtitle,
+ metadata?: import("@openreel/core").ClipMetadata,
+ ) => Promise<void>;
removeSubtitle: (subtitleId: string) => void;
updateSubtitle: (subtitleId: string, updates: Partial<Subtitle>) => void;
getSubtitle: (subtitleId: string) => Subtitle | undefined;
- importSRT: (srtContent: string) => { success: boolean; errors: string[] };
- exportSRT: () => string;
- applySubtitleStylePreset: (presetName: string) => boolean;
- getSubtitleStylePresets: () => string[];
+ importSRT: (
+ srtContent: string,
+ options?: { sourceClipId?: string; maxWordsPerLine?: number },
+ ) => Promise<{ success: boolean; errors: string[] }>;
+ exportSRT: () => Promise<string>;
+ applySubtitleStylePreset: (presetName: string) => Promise<boolean>;
+ getSubtitleStylePresets: () => Promise<string[]>;
createShapeClip: (
trackId: string,
diff --git a/apps/web/src/utils/linked-caption-edit.test.ts b/apps/web/src/utils/linked-caption-edit.test.ts
new file mode 100644
index 00000000..18f27c5a
--- /dev/null
+++ b/apps/web/src/utils/linked-caption-edit.test.ts
@@ -0,0 +1,79 @@
+import { describe, expect, it, vi } from "vitest";
+import type { Clip, Project, TextClip } from "@openreel/core";
+import {
+ getLinkedCaptions,
+ moveLinkedCaptions,
+ trimLinkedCaptions,
+ type LinkedCaptionEditStore,
+} from "./linked-caption-edit";
+
+const source = {
+ id: "video-1",
+ trackId: "video-track",
+ startTime: 2,
+ duration: 8,
+} as Clip;
+const captions = [
+ { id: "c1", trackId: "captions", startTime: 2, duration: 2, metadata: {} },
+ { id: "c2", trackId: "captions", startTime: 8, duration: 2, metadata: {} },
+ {
+ id: "explicit",
+ trackId: "other-text",
+ startTime: 30,
+ duration: 2,
+ metadata: { captionSourceClipId: "video-1" },
+ },
+] as TextClip[];
+const project = {
+ timeline: {
+ tracks: [
+ { id: "video-track", groupId: "g1" },
+ { id: "captions", groupId: "g1" },
+ { id: "other-text" },
+ ],
+ },
+} as Project;
+
+function makeStore(): LinkedCaptionEditStore {
+ return {
+ project,
+ getAllTextClips: () => captions,
+ updateOverlayClipTiming: vi.fn(),
+ deleteTextClip: vi.fn(() => true),
+ };
+}
+
+describe("linked caption edits", () => {
+ it("finds grouped overlapping captions and explicit source links", () => {
+ expect(getLinkedCaptions(makeStore(), source).map((clip) => clip.id)).toEqual([
+ "c1",
+ "c2",
+ "explicit",
+ ]);
+ });
+
+ it("moves linked captions by the source clip delta", () => {
+ const store = makeStore();
+ moveLinkedCaptions(store, source, 5);
+ expect(store.updateOverlayClipTiming).toHaveBeenCalledWith("c1", {
+ startTime: 5,
+ });
+ expect(store.updateOverlayClipTiming).toHaveBeenCalledWith("c2", {
+ startTime: 11,
+ });
+ });
+
+ it("clips partial captions and removes captions outside a trim", () => {
+ const store = makeStore();
+ trimLinkedCaptions(store, source, 3, 8.5);
+ expect(store.updateOverlayClipTiming).toHaveBeenCalledWith("c1", {
+ startTime: 3,
+ duration: 1,
+ });
+ expect(store.updateOverlayClipTiming).toHaveBeenCalledWith("c2", {
+ startTime: 8,
+ duration: 0.5,
+ });
+ expect(store.deleteTextClip).toHaveBeenCalledWith("explicit");
+ });
+});
diff --git a/apps/web/src/utils/linked-caption-edit.ts b/apps/web/src/utils/linked-caption-edit.ts
new file mode 100644
index 00000000..fba7985e
--- /dev/null
+++ b/apps/web/src/utils/linked-caption-edit.ts
@@ -0,0 +1,81 @@
+import type { Clip, Project, TextClip } from "@openreel/core";
+
+export interface LinkedCaptionEditStore {
+ project: Project;
+ getAllTextClips: () => TextClip[];
+ updateOverlayClipTiming: (
+ clipId: string,
+ updates: { startTime?: number; duration?: number },
+ ) => unknown;
+ deleteTextClip: (clipId: string) => boolean;
+}
+
+const EPSILON = 0.001;
+
+export function getLinkedCaptions(
+ store: Pick<LinkedCaptionEditStore, "project" | "getAllTextClips">,
+ sourceClip: Clip,
+): TextClip[] {
+ const sourceTrack = store.project.timeline.tracks.find(
+ (track) => track.id === sourceClip.trackId,
+ );
+ const start = sourceClip.startTime;
+ const end = sourceClip.startTime + sourceClip.duration;
+
+ return store.getAllTextClips().filter((caption) => {
+ if (caption.metadata?.captionSourceClipId === sourceClip.id) return true;
+ if (!sourceTrack?.groupId) return false;
+ const captionTrack = store.project.timeline.tracks.find(
+ (track) => track.id === caption.trackId,
+ );
+ if (captionTrack?.groupId !== sourceTrack.groupId) return false;
+ const captionEnd = caption.startTime + caption.duration;
+ return caption.startTime < end - EPSILON && captionEnd > start + EPSILON;
+ });
+}
+
+export function moveLinkedCaptions(
+ store: LinkedCaptionEditStore,
+ sourceClip: Clip,
+ newStartTime: number,
+): number {
+ const delta = newStartTime - sourceClip.startTime;
+ if (Math.abs(delta) < EPSILON) return 0;
+ const captions = getLinkedCaptions(store, sourceClip);
+ for (const caption of captions) {
+ store.updateOverlayClipTiming(caption.id, {
+ startTime: Math.max(0, caption.startTime + delta),
+ });
+ }
+ return captions.length;
+}
+
+export function trimLinkedCaptions(
+ store: LinkedCaptionEditStore,
+ sourceClip: Clip,
+ newStartTime: number,
+ newEndTime: number,
+): { updated: number; removed: number } {
+ let updated = 0;
+ let removed = 0;
+ for (const caption of getLinkedCaptions(store, sourceClip)) {
+ const captionEnd = caption.startTime + caption.duration;
+ const clippedStart = Math.max(caption.startTime, newStartTime);
+ const clippedEnd = Math.min(captionEnd, newEndTime);
+ if (clippedEnd - clippedStart < 0.1) {
+ if (store.deleteTextClip(caption.id)) removed += 1;
+ continue;
+ }
+ if (
+ Math.abs(clippedStart - caption.startTime) >= EPSILON ||
+ Math.abs(clippedEnd - captionEnd) >= EPSILON
+ ) {
+ store.updateOverlayClipTiming(caption.id, {
+ startTime: clippedStart,
+ duration: clippedEnd - clippedStart,
+ });
+ updated += 1;
+ }
+ }
+ return { updated, removed };
+}
diff --git a/apps/web/src/utils/timeline-item-actions.test.ts b/apps/web/src/utils/timeline-item-actions.test.ts
index b7c5b863..d97bf7bc 100644
--- a/apps/web/src/utils/timeline-item-actions.test.ts
+++ b/apps/web/src/utils/timeline-item-actions.test.ts
@@ -8,6 +8,7 @@ import {
getSplittableTimelineItemIds,
getTimelineMarqueeSelection,
getTimelineSelectionItems,
+ getTimelineTrackSelection,
splitTimelineItem,
trimTimelineItemToPlayhead,
} from "./timeline-item-actions";
@@ -140,6 +141,66 @@ describe("timeline item actions", () => {
]);
});
+ it("selects every clip family on one track in timeline order", () => {
+ const project = {
+ timeline: {
+ tracks: [
+ {
+ id: "caption-track",
+ clips: [
+ {
+ id: "media-caption",
+ trackId: "caption-track",
+ startTime: 3,
+ duration: 1,
+ },
+ ],
+ },
+ {
+ id: "other-track",
+ clips: [
+ {
+ id: "other-media",
+ trackId: "other-track",
+ startTime: 0,
+ duration: 1,
+ },
+ ],
+ },
+ ],
+ },
+ textClips: [
+ {
+ id: "caption-late",
+ trackId: "caption-track",
+ startTime: 5,
+ duration: 1,
+ },
+ {
+ id: "caption-early",
+ trackId: "caption-track",
+ startTime: 1,
+ duration: 1,
+ },
+ ],
+ shapeClips: [
+ {
+ id: "caption-shape",
+ trackId: "caption-track",
+ startTime: 4,
+ duration: 1,
+ },
+ ],
+ } as unknown as Project;
+
+ expect(getTimelineTrackSelection(project, "caption-track")).toEqual([
+ { id: "caption-early", trackId: "caption-track", type: "text-clip" },
+ { id: "media-caption", trackId: "caption-track", type: "clip" },
+ { id: "caption-shape", trackId: "caption-track", type: "shape-clip" },
+ { id: "caption-late", trackId: "caption-track", type: "text-clip" },
+ ]);
+ });
+
it("finds every selected media or overlay item crossing the playhead", () => {
const project = {
timeline: {
diff --git a/apps/web/src/utils/timeline-item-actions.ts b/apps/web/src/utils/timeline-item-actions.ts
index 2a642041..27d6d20d 100644
--- a/apps/web/src/utils/timeline-item-actions.ts
+++ b/apps/web/src/utils/timeline-item-actions.ts
@@ -1,6 +1,7 @@
import type { Project } from "@openreel/core";
import type { ProjectState } from "../stores/project-store";
import type { SelectionItem } from "../stores/ui-store";
+import { trimLinkedCaptions } from "./linked-caption-edit";
export type TimelineItemKind =
| "media"
@@ -27,6 +28,9 @@ type TimelineActionStore = Pick<
| "splitOverlayClip"
| "trimToPlayhead"
| "trimOverlayToPlayhead"
+ | "project"
+ | "getAllTextClips"
+ | "updateOverlayClipTiming"
>;
export interface TimelineItemRange {
@@ -127,7 +131,18 @@ export async function trimTimelineItemToPlayhead(
trimStart: boolean,
): Promise<boolean> {
if (getTimelineItemKind(store, clipId) === "media") {
- return (await store.trimToPlayhead(clipId, playheadTime, trimStart)).success;
+ const sourceClip = store.getClip(clipId);
+ const result = await store.trimToPlayhead(clipId, playheadTime, trimStart);
+ const updatedClip = store.getClip(clipId);
+ if (result.success && sourceClip && updatedClip) {
+ trimLinkedCaptions(
+ store,
+ sourceClip,
+ updatedClip.startTime,
+ updatedClip.startTime + updatedClip.duration,
+ );
+ }
+ return result.success;
}
return store.trimOverlayToPlayhead(clipId, playheadTime, trimStart) !== null;
}
@@ -186,11 +201,30 @@ export function getSplittableTimelineItemIds(
}
export function getTimelineSelectionItems(project: Project): SelectionItem[] {
- return getTimelineItemRanges(project).map((item) => ({
+ return getTimelineItemRanges(project).map(toSelectionItem);
+}
+
+/** Select every media or overlay clip assigned to one timeline track. */
+export function getTimelineTrackSelection(
+ project: Project,
+ trackId: string,
+): SelectionItem[] {
+ return getTimelineItemRanges(project)
+ .filter((item) => item.trackId === trackId)
+ .sort((left, right) =>
+ left.startTime === right.startTime
+ ? left.id.localeCompare(right.id)
+ : left.startTime - right.startTime,
+ )
+ .map(toSelectionItem);
+}
+
+function toSelectionItem(item: TimelineItemRange): SelectionItem {
+ return {
id: item.id,
trackId: item.trackId,
type: item.kind === "media" ? "clip" : item.kind === "text" ? "text-clip" : "shape-clip",
- }));
+ };
}
export function getTimelineMarqueeSelection(
diff --git a/apps/web/src/utils/whisper-audio.test.ts b/apps/web/src/utils/whisper-audio.test.ts
new file mode 100644
index 00000000..42e6d80d
--- /dev/null
+++ b/apps/web/src/utils/whisper-audio.test.ts
@@ -0,0 +1,35 @@
+import { describe, expect, it } from "vitest";
+import { audioBufferToWhisperSamples } from "./whisper-audio";
+
+function fakeAudioBuffer(channels: number[][], sampleRate: number): AudioBuffer {
+ return {
+ sampleRate,
+ length: channels[0].length,
+ duration: channels[0].length / sampleRate,
+ numberOfChannels: channels.length,
+ getChannelData: (index: number) => new Float32Array(channels[index]),
+ } as AudioBuffer;
+}
+
+describe("audioBufferToWhisperSamples", () => {
+ it("mixes channels to mono", () => {
+ const samples = audioBufferToWhisperSamples(
+ fakeAudioBuffer(
+ [new Array(16_000).fill(1), new Array(16_000).fill(-0.5)],
+ 16_000,
+ ),
+ );
+ expect(samples).toHaveLength(16_000);
+ expect(samples[100]).toBeCloseTo(0.25);
+ });
+
+ it("resamples and crops the source range", () => {
+ const samples = audioBufferToWhisperSamples(
+ fakeAudioBuffer([new Array(48_000).fill(0.5)], 48_000),
+ 0.25,
+ 0.75,
+ );
+ expect(samples).toHaveLength(8_000);
+ expect(samples[4_000]).toBeCloseTo(0.5);
+ });
+});
diff --git a/apps/web/src/utils/whisper-audio.ts b/apps/web/src/utils/whisper-audio.ts
new file mode 100644
index 00000000..cb444eeb
--- /dev/null
+++ b/apps/web/src/utils/whisper-audio.ts
@@ -0,0 +1,49 @@
+const WHISPER_SAMPLE_RATE = 16_000;
+
+/** Mix an AudioBuffer to mono and resample only the selected source range. */
+export function audioBufferToWhisperSamples(
+ audioBuffer: AudioBuffer,
+ startTime = 0,
+ endTime = audioBuffer.duration,
+): Float32Array {
+ const sourceRate = audioBuffer.sampleRate;
+ const startFrame = Math.max(
+ 0,
+ Math.min(audioBuffer.length, Math.floor(startTime * sourceRate)),
+ );
+ const endFrame = Math.max(
+ startFrame,
+ Math.min(audioBuffer.length, Math.ceil(endTime * sourceRate)),
+ );
+ const sourceLength = endFrame - startFrame;
+ if (sourceLength === 0) return new Float32Array();
+
+ const outputLength = Math.max(
+ 1,
+ Math.round((sourceLength * WHISPER_SAMPLE_RATE) / sourceRate),
+ );
+ const output = new Float32Array(outputLength);
+ const channels = Array.from(
+ { length: audioBuffer.numberOfChannels },
+ (_, index) => audioBuffer.getChannelData(index),
+ );
+ const sourceFramesPerOutput = sourceRate / WHISPER_SAMPLE_RATE;
+
+ for (let outputIndex = 0; outputIndex < outputLength; outputIndex += 1) {
+ const sourcePosition = startFrame + outputIndex * sourceFramesPerOutput;
+ const leftIndex = Math.min(endFrame - 1, Math.floor(sourcePosition));
+ const rightIndex = Math.min(endFrame - 1, leftIndex + 1);
+ const fraction = sourcePosition - leftIndex;
+ let mixed = 0;
+ for (const channel of channels) {
+ mixed +=
+ channel[leftIndex] +
+ (channel[rightIndex] - channel[leftIndex]) * fraction;
+ }
+ output[outputIndex] = mixed / channels.length;
+ }
+
+ return output;
+}
+
+export { WHISPER_SAMPLE_RATE };
diff --git a/apps/web/src/workers/whisper-models.ts b/apps/web/src/workers/whisper-models.ts
new file mode 100644
index 00000000..b39dc658
--- /dev/null
+++ b/apps/web/src/workers/whisper-models.ts
@@ -0,0 +1,32 @@
+export type WhisperModelKey = "accurate" | "fast";
+
+export interface WhisperModelDefinition {
+ readonly id: string;
+ readonly label: string;
+ readonly shortLabel: string;
+ readonly downloadSize: string;
+ readonly description: string;
+}
+
+export const WHISPER_MODELS: Record<WhisperModelKey, WhisperModelDefinition> = {
+ accurate: {
+ id: "onnx-community/whisper-large-v3-turbo_timestamped",
+ label: "Accurate · Large V3 Turbo",
+ shortLabel: "Large V3 Turbo",
+ downloadSize: "About 760 MB",
+ description: "Best local accuracy; WebGPU recommended",
+ },
+ fast: {
+ id: "onnx-community/whisper-tiny",
+ label: "Fast · Whisper Tiny",
+ shortLabel: "Whisper Tiny",
+ downloadSize: "About 100 MB",
+ description: "Fastest option for drafts and lower-memory devices",
+ },
+};
+
+export const DEFAULT_WHISPER_MODEL: WhisperModelKey = "accurate";
+
+export function isWhisperModelKey(value: unknown): value is WhisperModelKey {
+ return value === "accurate" || value === "fast";
+}
diff --git a/apps/web/src/workers/whisper-worker.ts b/apps/web/src/workers/whisper-worker.ts
new file mode 100644
index 00000000..0445f318
--- /dev/null
+++ b/apps/web/src/workers/whisper-worker.ts
@@ -0,0 +1,159 @@
+/// <reference lib="webworker" />
+
+import { env, pipeline } from "@huggingface/transformers";
+import {
+ DEFAULT_WHISPER_MODEL,
+ WHISPER_MODELS,
+ isWhisperModelKey,
+ type WhisperModelKey,
+} from "./whisper-models";
+
+const MODEL_HOST = "https://media.openreel.video/models/";
+
+env.allowLocalModels = false;
+env.allowRemoteModels = true;
+env.remoteHost = MODEL_HOST;
+env.remotePathTemplate = "{model}/resolve/{revision}/";
+env.useBrowserCache = true;
+
+interface WhisperOutput {
+ text: string;
+ chunks?: Array<{
+ text: string;
+ timestamp: [number | null, number | null];
+ }>;
+}
+
+type WhisperPipeline = (
+ audio: Float32Array,
+ options: Record<string, unknown>,
+) => Promise<WhisperOutput | WhisperOutput[]>;
+const createPipeline = pipeline as unknown as (
+ task: string,
+ model: string,
+ options: Record<string, unknown>,
+) => Promise<WhisperPipeline>;
+interface LoadedWhisperModel {
+ readonly transcriber: WhisperPipeline;
+ readonly backend: "webgpu" | "wasm";
+}
+
+const transcriberPromises = new Map<
+ WhisperModelKey,
+ Promise<LoadedWhisperModel>
+>();
+
+function post(requestId: string, payload: Record<string, unknown>): void {
+ self.postMessage({ requestId, ...payload });
+}
+
+function progressCallback(requestId: string) {
+ return (event: Record<string, unknown>) => {
+ post(requestId, {
+ type: "model-progress",
+ status: event.status,
+ file: event.file,
+ progress: event.progress,
+ loaded: event.loaded,
+ total: event.total,
+ });
+ };
+}
+
+async function createWhisperModel(
+ requestId: string,
+ modelKey: WhisperModelKey,
+): Promise<LoadedWhisperModel> {
+ const modelId = WHISPER_MODELS[modelKey].id;
+ const canUseWebGPU = modelKey === "accurate" && "gpu" in navigator;
+
+ if (canUseWebGPU) {
+ try {
+ const transcriber = await createPipeline(
+ "automatic-speech-recognition",
+ modelId,
+ {
+ device: "webgpu",
+ dtype: "q4",
+ progress_callback: progressCallback(requestId),
+ },
+ );
+ return { transcriber, backend: "webgpu" };
+ } catch (error) {
+ console.warn("[Whisper] WebGPU unavailable; falling back to WASM", error);
+ }
+ }
+
+ const transcriber = await createPipeline(
+ "automatic-speech-recognition",
+ modelId,
+ {
+ device: "wasm",
+ dtype: "q4",
+ progress_callback: progressCallback(requestId),
+ },
+ );
+ return { transcriber, backend: "wasm" };
+}
+
+function loadModel(
+ requestId: string,
+ modelKey: WhisperModelKey,
+): Promise<LoadedWhisperModel> {
+ let modelPromise = transcriberPromises.get(modelKey);
+ if (!modelPromise) {
+ modelPromise = createWhisperModel(requestId, modelKey);
+ transcriberPromises.set(modelKey, modelPromise);
+ modelPromise.catch(() => {
+ transcriberPromises.delete(modelKey);
+ });
+ }
+ return modelPromise;
+}
+
+self.onmessage = async (
+ event: MessageEvent<{
+ requestId: string;
+ type: "load" | "transcribe";
+ audio?: Float32Array;
+ language?: string;
+ model?: WhisperModelKey;
+ }>,
+) => {
+ const { requestId, type, audio, language } = event.data;
+ const modelKey = isWhisperModelKey(event.data.model)
+ ? event.data.model
+ : DEFAULT_WHISPER_MODEL;
+ try {
+ const { transcriber, backend } = await loadModel(requestId, modelKey);
+ if (type === "load") {
+ post(requestId, { type: "ready", model: modelKey, backend });
+ return;
+ }
+ if (!audio?.length) throw new Error("The selected clip has no decodable audio.");
+
+ post(requestId, { type: "transcription-progress", progress: 0.05 });
+ const output = await transcriber(audio, {
+ language,
+ task: "transcribe",
+ return_timestamps: true,
+ chunk_length_s: 30,
+ stride_length_s: 5,
+ });
+ const result = Array.isArray(output) ? output[0] : output;
+ post(requestId, {
+ type: "result",
+ text: result.text,
+ chunks: result.chunks ?? [],
+ model: modelKey,
+ backend,
+ });
+ } catch (error) {
+ post(requestId, {
+ type: "error",
+ message: error instanceof Error ? error.message : "Local transcription failed.",
+ });
+ }
+};
+
+export {};
diff --git a/infra/cloudflare/openreel-r2-cors.json b/infra/cloudflare/openreel-r2-cors.json
new file mode 100644
index 00000000..1eecf4df
--- /dev/null
+++ b/infra/cloudflare/openreel-r2-cors.json
@@ -0,0 +1,17 @@
+{
+ "rules": [
+ {
+ "allowed": {
+ "origins": [
+ "https://app.openreel.video",
+ "http://localhost:5173",
+ "http://localhost:3000"
+ ],
+ "methods": ["GET", "HEAD"],
+ "headers": ["*"]
+ },
+ "exposeHeaders": ["Accept-Ranges", "Content-Length", "Content-Range", "ETag"],
+ "maxAgeSeconds": 86400
+ }
+ ]
+}
diff --git a/infra/cloudflare/whisper-tiny-r2.md b/infra/cloudflare/whisper-tiny-r2.md
new file mode 100644
index 00000000..94253cc6
--- /dev/null
+++ b/infra/cloudflare/whisper-tiny-r2.md
@@ -0,0 +1,17 @@
+# Browser caption models
+
+The web editor loads local caption models through Transformers.js from the
+`openreel` R2 bucket. Two quality tiers are mirrored:
+
+- Fast: `models/onnx-community/whisper-tiny/resolve/main/` (~100 MB)
+- Accurate: `models/onnx-community/whisper-large-v3-turbo_timestamped/resolve/main/`
+ (~760 MB)
+
+Only tokenizer/config files and the Q4 encoder/merged-decoder ONNX weights are
+mirrored. Both upstream Whisper models are Apache-2.0 licensed. Model binaries
+must not be committed to this repository.
+
+R2 objects use long-lived public cache headers. The web worker uses the browser
+cache after the first download and prefers WebGPU for the accurate tier, with a
+WASM fallback. Publish a versioned prefix and update
+`apps/web/src/workers/whisper-models.ts` when replacing the weights.
diff --git a/packages/core/src/text/subtitle-engine.test.ts b/packages/core/src/text/subtitle-engine.test.ts
new file mode 100644
index 00000000..8a266f77
--- /dev/null
+++ b/packages/core/src/text/subtitle-engine.test.ts
@@ -0,0 +1,84 @@
+import { describe, expect, it } from "vitest";
+import {
+ parseSRT,
+ parseSRTTimestamp,
+ reflowCaptionText,
+ splitCaptionIntoSingleLineCues,
+} from "./subtitle-engine";
+
+describe("subtitle parsing", () => {
+ it("parses indexed SRT captions", () => {
+ const result = parseSRT(
+ "1\n00:00:01,000 --> 00:00:03,250\nA first caption\n\n2\n00:00:04.5 --> 00:00:06.000\nA second caption",
+ );
+
+ expect(result.subtitles).toHaveLength(2);
+ expect(result.subtitles[0]).toMatchObject({
+ text: "A first caption",
+ startTime: 1,
+ endTime: 3.25,
+ });
+ expect(result.subtitles[1].startTime).toBe(4.5);
+ });
+
+ it("parses WEBVTT cue ids, cue settings, and plain-text markup", () => {
+ const result = parseSRT(
+ "WEBVTT\n\nintro\n00:01.000 --> 00:03.500 align:middle\n<v Alex>Hello &amp; <b>welcome</b></v>",
+ );
+
+ expect(result.errors).toEqual([]);
+ expect(result.subtitles).toHaveLength(1);
+ expect(result.subtitles[0]).toMatchObject({
+ text: "Hello & welcome",
+ startTime: 1,
+ endTime: 3.5,
+ });
+ });
+
+ it("rejects invalid time ranges but keeps valid cues", () => {
+ const result = parseSRT(
+ "1\n00:00:03,000 --> 00:00:02,000\nBad\n\n2\n00:00:04,000 --> 00:00:05,000\nGood",
+ );
+
+ expect(result.subtitles.map((subtitle) => subtitle.text)).toEqual(["Good"]);
+ expect(result.errors).toHaveLength(1);
+ });
+
+ it("supports VTT timestamps without hours", () => {
+ expect(parseSRTTimestamp("01:02.250")).toBe(62.25);
+ });
+});
+
+describe("caption reflow", () => {
+ it("wraps a caption to the selected number of words per line", () => {
+ expect(reflowCaptionText("one two three four five six seven", 5)).toBe(
+ "one two three four five\nsix seven",
+ );
+ });
+
+ it("normalizes existing line breaks while preserving words", () => {
+ expect(reflowCaptionText("one two\nthree four", 2)).toBe(
+ "one two\nthree four",
+ );
+ });
+
+ it("splits long captions into sequential single-line cues", () => {
+ expect(
+ splitCaptionIntoSingleLineCues(
+ "one two three four five six seven",
+ 10,
+ 17,
+ 5,
+ ),
+ ).toEqual([
+ { text: "one two three four five", startTime: 10, endTime: 15 },
+ { text: "six seven", startTime: 15, endTime: 17 },
+ ]);
+ });
+
+ it("removes embedded line breaks from a single cue", () => {
+ expect(splitCaptionIntoSingleLineCues("one two\nthree", 0, 3, 5)).toEqual([
+ { text: "one two three", startTime: 0, endTime: 3 },
+ ]);
+ });
+});
diff --git a/packages/core/src/text/subtitle-engine.ts b/packages/core/src/text/subtitle-engine.ts
index 002a95ef..b7f2eaa8 100644
--- a/packages/core/src/text/subtitle-engine.ts
+++ b/packages/core/src/text/subtitle-engine.ts
@@ -78,24 +78,24 @@ function generateSubtitleId(): string {
}
/**
- * Parses SRT timestamp format: HH:MM:SS,mmm (comma or period for milliseconds).
- * Both SRT standard (comma) and some variants (period) are supported.
+ * Parses SRT/VTT timestamp formats. SRT normally uses HH:MM:SS,mmm while
+ * WebVTT also permits MM:SS.mmm. One to three millisecond digits are accepted
+ * because several caption providers omit trailing zeroes.
* Returns null if format is invalid or time values are out of range.
*/
export function parseSRTTimestamp(timestamp: string): number | null {
- // Regex: 1-2 digit hours : 2 digit minutes : 2 digit seconds [,.]3 digit milliseconds
const match = timestamp
.trim()
- .match(/^(\d{1,2}):(\d{2}):(\d{2})[,.](\d{3})$/);
+ .match(/^(?:(\d{1,3}):)?(\d{2}):(\d{2})[,.](\d{1,3})$/);
if (!match) {
return null;
}
- const hours = parseInt(match[1], 10);
+ const hours = match[1] ? parseInt(match[1], 10) : 0;
const minutes = parseInt(match[2], 10);
const seconds = parseInt(match[3], 10);
- const milliseconds = parseInt(match[4], 10);
+ const milliseconds = parseInt(match[4].padEnd(3, "0"), 10);
// Validate ranges (minutes and seconds must be < 60)
if (minutes >= 60 || seconds >= 60) {
@@ -106,6 +106,70 @@ export function parseSRTTimestamp(timestamp: string): number | null {
return hours * 3600 + minutes * 60 + seconds + milliseconds / 1000;
}
+/** Convert caption markup to the plain text used by editable TextClips. */
+export function subtitleMarkupToText(value: string): string {
+ return value
+ .replace(/<br\s*\/?>/gi, "\n")
+ .replace(/<[^>]+>/g, "")
+ .replace(/&nbsp;/gi, " ")
+ .replace(/&amp;/gi, "&")
+ .replace(/&lt;/gi, "<")
+ .replace(/&gt;/gi, ">")
+ .replace(/&quot;/gi, '"')
+ .replace(/&#39;|&apos;/gi, "'")
+ .trim();
+}
+
+/** Rewrap editable caption text without changing its words. */
+export function reflowCaptionText(value: string, maxWordsPerLine: number): string {
+ const maxWords = Math.max(1, Math.floor(maxWordsPerLine));
+ const words = value.trim().split(/\s+/).filter(Boolean);
+ const lines: string[] = [];
+ for (let index = 0; index < words.length; index += maxWords) {
+ lines.push(words.slice(index, index + maxWords).join(" "));
+ }
+ return lines.join("\n");
+}
+
+export interface SingleLineCaptionCue {
+ readonly text: string;
+ readonly startTime: number;
+ readonly endTime: number;
+}
+
+/**
+ * Split one caption cue into sequential, single-line cues. Timing is divided
+ * proportionally by word count so the resulting cues remain contiguous.
+ */
+export function splitCaptionIntoSingleLineCues(
+ value: string,
+ startTime: number,
+ endTime: number,
+ maxWordsPerCue: number,
+): SingleLineCaptionCue[] {
+ const maxWords = Math.max(1, Math.floor(maxWordsPerCue));
+ const words = value.trim().split(/\s+/).filter(Boolean);
+ if (words.length === 0) return [];
+
+ const safeStart = Math.max(0, startTime);
+ const safeEnd = Math.max(safeStart + 0.1, endTime);
+ const duration = safeEnd - safeStart;
+ const cues: SingleLineCaptionCue[] = [];
+
+ for (let index = 0; index < words.length; index += maxWords) {
+ const cueWords = words.slice(index, index + maxWords);
+ const cueStart = safeStart + duration * (index / words.length);
+ const cueEnd = safeStart + duration * ((index + cueWords.length) / words.length);
+ cues.push({
+ text: cueWords.join(" "),
+ startTime: cueStart,
+ endTime: cueEnd,
+ });
+ }
+
+ return cues;
+}
+
export function formatSRTTimestamp(seconds: number): string {
if (seconds < 0 || !isFinite(seconds)) {
seconds = 0;
@@ -129,8 +193,10 @@ export function parseSRT(srtContent: string): SRTParseResult {
const errors: SRTParseError[] = [];
const normalizedContent = srtContent
+ .replace(/^\uFEFF/, "")
.replace(/\r\n/g, "\n")
.replace(/\r/g, "\n");
+ const isWebVTT = normalizedContent.trimStart().startsWith("WEBVTT");
const blocks = normalizedContent
.split(/\n\n+/)
.filter((block) => block.trim());
@@ -141,7 +207,12 @@ export function parseSRT(srtContent: string): SRTParseResult {
const block = blocks[i].trim();
const lines = block.split("\n");
- if (lines.length < 2) {
+ if (/^(WEBVTT(?:\s|$)|NOTE(?:\s|$)|STYLE\s*$|REGION\s*$)/i.test(lines[0].trim())) {
+ lineNumber += block.split("\n").length + 1;
+ continue;
+ }
+
+ if (lines.length < 2 && !lines[0]?.includes("-->")) {
errors.push({
line: lineNumber,
message: "Invalid subtitle block: insufficient lines",
@@ -151,27 +222,39 @@ export function parseSRT(srtContent: string): SRTParseResult {
continue;
}
- const indexLine = lines[0].trim();
- const index = parseInt(indexLine, 10);
-
- if (isNaN(index)) {
+ // SRT has a numeric index, while VTT has either a cue id or no id. Find
+ // the timing line instead of forcing one provider-specific layout.
+ const timestampLineIndex = lines.findIndex((line) => line.includes("-->"));
+ if (timestampLineIndex < 0) {
errors.push({
line: lineNumber,
- message: `Invalid subtitle index: "${indexLine}"`,
+ message: `Missing subtitle timestamp`,
segment: i + 1,
});
lineNumber += block.split("\n").length + 1;
continue;
}
-
- const timestampLine = lines[1].trim();
+ if (
+ !isWebVTT &&
+ timestampLineIndex > 0 &&
+ !/^\d+$/.test(lines[0].trim())
+ ) {
+ errors.push({
+ line: lineNumber,
+ message: `Invalid subtitle index: "${lines[0].trim()}"`,
+ segment: i + 1,
+ });
+ lineNumber += block.split("\n").length + 1;
+ continue;
+ }
+ const timestampLine = lines[timestampLineIndex].trim();
const timestampMatch = timestampLine.match(
/^(.+?)\s*-->\s*(.+?)(?:\s+.*)?$/,
);
if (!timestampMatch) {
errors.push({
- line: lineNumber + 1,
+ line: lineNumber + timestampLineIndex,
message: `Invalid timestamp format: "${timestampLine}"`,
segment: i + 1,
});
@@ -184,7 +267,7 @@ export function parseSRT(srtContent: string): SRTParseResult {
if (startTime === null) {
errors.push({
- line: lineNumber + 1,
+ line: lineNumber + timestampLineIndex,
message: `Invalid start timestamp: "${timestampMatch[1]}"`,
segment: i + 1,
});
@@ -194,7 +277,7 @@ export function parseSRT(srtContent: string): SRTParseResult {
if (endTime === null) {
errors.push({
- line: lineNumber + 1,
+ line: lineNumber + timestampLineIndex,
message: `Invalid end timestamp: "${timestampMatch[2]}"`,
segment: i + 1,
});
@@ -204,7 +287,7 @@ export function parseSRT(srtContent: string): SRTParseResult {
if (endTime <= startTime) {
errors.push({
- line: lineNumber + 1,
+ line: lineNumber + timestampLineIndex,
message: `End time must be greater than start time`,
segment: i + 1,
});
@@ -212,11 +295,13 @@ export function parseSRT(srtContent: string): SRTParseResult {
continue;
}
- const text = lines.slice(2).join("\n").trim();
+ const text = subtitleMarkupToText(
+ lines.slice(timestampLineIndex + 1).join("\n"),
+ );
if (!text) {
errors.push({
- line: lineNumber + 2,
+ line: lineNumber + timestampLineIndex + 1,
message: "Empty subtitle text",
segment: i + 1,
});
diff --git a/packages/core/src/types/timeline.ts b/packages/core/src/types/timeline.ts
index 0c3364ed..8cea5558 100644
--- a/packages/core/src/types/timeline.ts
+++ b/packages/core/src/types/timeline.ts
@@ -44,6 +44,8 @@ export interface Track {
readonly hidden: boolean;
readonly muted: boolean;
readonly solo: boolean;
+ /** Tracks with the same id move and trim their related items together. */
+ readonly groupId?: string;
}
export interface EditingTemplateApplicationSource {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 2c62aded..6b115fb2 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -301,6 +301,9 @@ importers:
'@gsap/react':
specifier: ^2.1.2
+ '@huggingface/transformers':
+ specifier: 3.8.1
+ version: 3.8.1
'@openreel/agent':
specifier: workspace:*
version: link:../../packages/agent
@@ -1557,6 +1560,13 @@ packages:
gsap: ^3.12.5
react: '>=17'
+ '@huggingface/[email protected]':
+ resolution: {integrity: sha512-uWTG+l3VJRsl7EXxYizuL3P+cCPoc3cRqbWWRcQN0FhejRfbdq0RNhCmbY/YDtnTcz9icdLYuLDjsnz4d8JMuw==}
+ engines: {node: '>=18'}
+
+ '@huggingface/[email protected]':
+ resolution: {integrity: sha512-tsTk4zVjImqdqjS8/AOZg2yNLd1z9S5v+7oUPpXaasDRwEDhB+xnglK1k5cad26lL5/ZIaeREgWWy0bs9y9pPA==}
+
'@humanfs/[email protected]':
resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==}
engines: {node: '>=18.18.0'}
@@ -1573,64 +1583,138 @@ packages:
resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==}
engines: {node: '>=18.18'}
+ resolution: {integrity: sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [arm64]
os: [darwin]
+ resolution: {integrity: sha512-imtQ3WMJXbMY4fxb/Ndp6HBTNVtWCUI0WdobyheGf5+ad6xX8VIDO8u2xE4qc/fr08CKG/7dDseFtn6M6g/r3w==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [arm64]
+ os: [darwin]
+
resolution: {integrity: sha512-fyHac4jIc1ANYGRDxtiqelIbdWkIuQaI84Mv45KvGRRxSAa7o7d1ZKAOBaYbnepLC1WqxfpimdeWfvqqSGwR2Q==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [x64]
os: [darwin]
+ resolution: {integrity: sha512-YNEFAF/4KQ/PeW0N+r+aVVsoIY0/qxxikF2SWdp+NRkmMB7y9LBZAVqQ4yhGCm/H3H270OSykqmQMKLBhBJDEw==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [x64]
+ os: [darwin]
+
resolution: {integrity: sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg==}
cpu: [arm64]
os: [darwin]
+ resolution: {integrity: sha512-zqjjo7RatFfFoP0MkQ51jfuFZBnVE2pRiaydKJ1G/rHZvnsrHAOcQALIi9sA5co5xenQdTugCvtb1cuf78Vf4g==}
+ cpu: [arm64]
+ os: [darwin]
+
resolution: {integrity: sha512-xnGR8YuZYfJGmWPvmlunFaWJsb9T/AO2ykoP3Fz/0X5XV2aoYBPkX6xqCQvUTKKiLddarLaxpzNe+b1hjeWHAQ==}
cpu: [x64]
os: [darwin]
+ resolution: {integrity: sha512-1IOd5xfVhlGwX+zXv2N93k0yMONvUlANylbJw1eTah8K/Jtpi15KC+WSiaX/nBmbm2HxRM1gZ0nSdjSsrZbGKg==}
+ cpu: [x64]
+ os: [darwin]
+
resolution: {integrity: sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA==}
cpu: [arm64]
os: [linux]
libc: [glibc]
+ resolution: {integrity: sha512-excjX8DfsIcJ10x1Kzr4RcWe1edC9PquDRRPx3YVCvQv+U5p7Yin2s32ftzikXojb1PIFc/9Mt28/y+iRklkrw==}
+ cpu: [arm64]
+ os: [linux]
+ libc: [glibc]
+
resolution: {integrity: sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g==}
cpu: [arm]
os: [linux]
libc: [glibc]
+ resolution: {integrity: sha512-bFI7xcKFELdiNCVov8e44Ia4u2byA+l3XtsAj+Q8tfCwO6BQ8iDojYdvoPMqsKDkuoOo+X6HZA0s0q11ANMQ8A==}
+ cpu: [arm]
+ os: [linux]
+ libc: [glibc]
+
+ resolution: {integrity: sha512-FMuvGijLDYG6lW+b/UvyilUWu5Ayu+3r2d1S8notiGCIyYU/76eig1UfMmkZ7vwgOrzKzlQbFSuQfgm7GYUPpA==}
+ cpu: [ppc64]
+ os: [linux]
+ libc: [glibc]
+
+ resolution: {integrity: sha512-oVDbcR4zUC0ce82teubSm+x6ETixtKZBh/qbREIOcI3cULzDyb18Sr/Wcyx7NRQeQzOiHTNbZFF1UwPS2scyGA==}
+ cpu: [riscv64]
+ os: [linux]
+ libc: [glibc]
+
resolution: {integrity: sha512-u7Wz6ntiSSgGSGcjZ55im6uvTrOxSIS8/dgoVMoiGE9I6JAfU50yH5BoDlYA1tcuGS7g/QNtetJnxA6QEsCVTA==}
cpu: [s390x]
os: [linux]
libc: [glibc]
+ resolution: {integrity: sha512-qmp9VrzgPgMoGZyPvrQHqk02uyjA0/QrTO26Tqk6l4ZV0MPWIW6LTkqOIov+J1yEu7MbFQaDpwdwJKhbJvuRxQ==}
+ cpu: [s390x]
+ os: [linux]
+ libc: [glibc]
+
resolution: {integrity: sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw==}
cpu: [x64]
os: [linux]
libc: [glibc]
+ resolution: {integrity: sha512-tJxiiLsmHc9Ax1bz3oaOYBURTXGIRDODBqhveVHonrHJ9/+k89qbLl0bcJns+e4t4rvaNBxaEZsFtSfAdquPrw==}
+ cpu: [x64]
+ os: [linux]
+ libc: [glibc]
+
resolution: {integrity: sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA==}
cpu: [arm64]
os: [linux]
libc: [musl]
+ resolution: {integrity: sha512-FVQHuwx1IIuNow9QAbYUzJ+En8KcVm9Lk5+uGUQJHaZmMECZmOlix9HnH7n1TRkXMS0pGxIJokIVB9SuqZGGXw==}
+ cpu: [arm64]
+ os: [linux]
+ libc: [musl]
+
resolution: {integrity: sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw==}
cpu: [x64]
os: [linux]
libc: [musl]
+ resolution: {integrity: sha512-+LpyBk7L44ZIXwz/VYfglaX/okxezESc6UxDSoyo2Ks6Jxc4Y7sGjpgU9s4PMgqgjj1gZCylTieNamqA1MF7Dg==}
+ cpu: [x64]
+ os: [linux]
+ libc: [musl]
+
resolution: {integrity: sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
@@ -1638,6 +1722,13 @@ packages:
os: [linux]
libc: [glibc]
+ resolution: {integrity: sha512-bKQzaJRY/bkPOXyKx5EVup7qkaojECG6NLYswgktOZjaXecSAeCWiZwwiFf3/Y+O1HrauiE3FVsGxFg8c24rZg==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [arm64]
+ os: [linux]
+ libc: [glibc]
+
resolution: {integrity: sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
@@ -1645,6 +1736,27 @@ packages:
os: [linux]
libc: [glibc]
+ resolution: {integrity: sha512-9dLqsvwtg1uuXBGZKsxem9595+ujv0sJ6Vi8wcTANSFpwV/GONat5eCkzQo/1O6zRIkh0m/8+5BjrRr7jDUSZw==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [arm]
+ os: [linux]
+ libc: [glibc]
+
+ resolution: {integrity: sha512-7zznwNaqW6YtsfrGGDA6BRkISKAAE1Jo0QdpNYXNMHu2+0dTrPflTLNkpc8l7MUP5M16ZJcUvysVWWrMefZquA==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [ppc64]
+ os: [linux]
+ libc: [glibc]
+
+ resolution: {integrity: sha512-51gJuLPTKa7piYPaVs8GmByo7/U7/7TZOq+cnXJIHZKavIRHAP77e3N2HEl3dgiqdD/w0yUfiJnII77PuDDFdw==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [riscv64]
+ os: [linux]
+ libc: [glibc]
+
resolution: {integrity: sha512-y/5PCd+mP4CA/sPDKl2961b+C9d+vPAveS33s6Z3zfASk2j5upL6fXVPZi7ztePZ5CuH+1kW8JtvxgbuXHRa4Q==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
@@ -1652,6 +1764,13 @@ packages:
os: [linux]
libc: [glibc]
+ resolution: {integrity: sha512-nQtCk0PdKfho3eC5MrbQoigJ2gd1CgddUMkabUj+rBevs8tZ2cULOx46E7oyX+04WGfABgIwmMC0VqieTiR4jg==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [s390x]
+ os: [linux]
+ libc: [glibc]
+
resolution: {integrity: sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
@@ -1659,6 +1778,13 @@ packages:
os: [linux]
libc: [glibc]
+ resolution: {integrity: sha512-MEzd8HPKxVxVenwAa+JRPwEC7QFjoPWuS5NZnBt6B3pu7EG2Ge0id1oLHZpPJdn3OQK+BQDiw9zStiHBTJQQQQ==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [x64]
+ os: [linux]
+ libc: [glibc]
+
resolution: {integrity: sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
@@ -1666,6 +1792,13 @@ packages:
os: [linux]
libc: [musl]
+ resolution: {integrity: sha512-fprJR6GtRsMt6Kyfq44IsChVZeGN97gTD331weR1ex1c1rypDEABN6Tm2xa1wE6lYb5DdEnk03NZPqA7Id21yg==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [arm64]
+ os: [linux]
+ libc: [musl]
+
resolution: {integrity: sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
@@ -1673,23 +1806,53 @@ packages:
os: [linux]
libc: [musl]
+ resolution: {integrity: sha512-Jg8wNT1MUzIvhBFxViqrEhWDGzqymo3sV7z7ZsaWbZNDLXRJZoRGrjulp60YYtV4wfY8VIKcWidjojlLcWrd8Q==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [x64]
+ os: [linux]
+ libc: [musl]
+
resolution: {integrity: sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [wasm32]
+ resolution: {integrity: sha512-OdWTEiVkY2PHwqkbBI8frFxQQFekHaSSkUIJkwzclWZe64O1X4UlUjqqqLaPbUpMOQk6FBu/HtlGXNblIs0huw==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [wasm32]
+
+ resolution: {integrity: sha512-WQ3AgWCWYSb2yt+IG8mnC6Jdk9Whs7O0gxphblsLvdhSpSTtmu69ZG1Gkb6NuvxsNACwiPV6cNSZNzt0KPsw7g==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [arm64]
+ os: [win32]
+
resolution: {integrity: sha512-T36PblLaTwuVJ/zw/LaH0PdZkRz5rd3SmMHX8GSmR7vtNSP5Z6bQkExdSK7xGWyxLw4sUknBuugTelgw2faBbQ==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [ia32]
os: [win32]
+ resolution: {integrity: sha512-FV9m/7NmeCmSHDD5j4+4pNI8Cp3aW+JvLoXcTUo0IqyjSfAZJ8dIUmijx1qaJsIiU+Hosw6xM5KijAWRJCSgNg==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [ia32]
+ os: [win32]
+
resolution: {integrity: sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [x64]
os: [win32]
+ resolution: {integrity: sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [x64]
+ os: [win32]
+
resolution: {integrity: sha512-/1ZryrMYg2ckIvJKoTu5Np50JfYMVffDMlVmppw/BdbN3pBTN7e6stI5/7E/LVh9DDzz6J588s7sWqul3fy5wA==}
peerDependencies:
@@ -1699,6 +1862,10 @@ packages:
resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==}
engines: {node: '>=12'}
+ '@isaacs/[email protected]':
+ resolution: {integrity: sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==}
+ engines: {node: '>=18.0.0'}
+
resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
@@ -2764,6 +2931,7 @@ packages:
'@xmldom/[email protected]':
resolution: {integrity: sha512-A9gOqLdi6cV4ibazAjcQufGj0B1y/vDqYrcuP6d/6x8P27gRS8643Dj9o1dEKtB6O7fwxb2FgBmJS2mX7gpvdw==}
engines: {node: '>=14.6'}
+ deprecated: this version has critical issues, please update to the latest version
resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==}
@@ -3052,6 +3220,10 @@ packages:
resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==}
engines: {node: '>=10'}
+ resolution: {integrity: sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-1R5Fho+jBq0DDydt+/vHWj5KJNJCKdARKOCwZUen84I5BreWoLqRLANH1U87eJy1tiASPtMnGqJJq0ZsLoRPOw==}
@@ -4232,6 +4404,10 @@ packages:
resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==}
engines: {node: '>= 8'}
+ resolution: {integrity: sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==}
+ engines: {node: '>= 18'}
+
resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==}
engines: {node: '>=10'}
@@ -4349,9 +4525,19 @@ packages:
resolution: {integrity: sha512-Q632iLLrtCAVOTO65dh2+mNbQir/QNTVBG3h/QdZBpns7mZ0RYbLRBgGABPbpU9351AgYy7SJf1WaeVwMrBFPQ==}
+ resolution: {integrity: sha512-vDJMkfCfb0b1A836rgHj+ORuZf4B4+cc2bASQtpeoJLueuFc5DuYwjIZUBrSvx/fO5IrLjLz+oTrB3pcGlhovQ==}
+
+ resolution: {integrity: sha512-NeaCX6WW2L8cRCSqy3bInlo5ojjQqu2fD3D+9W5qb5irwxhEyWKXeH2vZ8W9r6VxaMPUan+4/7NDwZMtouZxEw==}
+ os: [win32, darwin, linux]
+
resolution: {integrity: sha512-adzOe+7uI7lKz6pQNbAsLMQd2Fq5Jhmoxd8LZjJr8m3KvbFyiYyRxRiC57/XXD+jb18voppjeGAjoZmskXG+7A==}
+ resolution: {integrity: sha512-0uS76OPgH0hWCPrFKlL8kYVV7ckM7t/36HfbgoFw6Nd0CZVVbQC4PkrR8mBX8LtNUFZO25IQBqV2Hx2ho3FlbQ==}
+
resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==}
engines: {node: '>= 0.8.0'}
@@ -4815,6 +5001,10 @@ packages:
resolution: {integrity: sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ resolution: {integrity: sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+
resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
engines: {node: '>=8'}
@@ -4980,6 +5170,10 @@ packages:
engines: {node: '>=10'}
deprecated: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting [email protected]
+ resolution: {integrity: sha512-MFO/QzvtAOmJbkhOaCTvbGcFN9L9b+JunIsDwaKljSOdcLMea3NJ1k9Usz/rjdfSXTq4dfzfeS7W4p4YOAAHeA==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-C5tjlC/HCtVUOi3KWVokd4vHVViOmGjtLwIh4MuzPo/nMYTV/p1urt3RnMz2IWXDdKEGJH3k5+KPxtqRsUYGtg==}
@@ -5348,6 +5542,10 @@ packages:
resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==}
+ resolution: {integrity: sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==}
engines: {node: '>=12'}
@@ -6146,6 +6344,15 @@ snapshots:
gsap: 3.14.2
react: 19.2.7
+ '@huggingface/[email protected]': {}
+
+ '@huggingface/[email protected]':
+ dependencies:
+ '@huggingface/jinja': 0.5.9
+ onnxruntime-node: 1.21.0
+ onnxruntime-web: 1.22.0-dev.20250409-89f8206ba4
+ sharp: 0.34.5
+
'@humanfs/[email protected]': {}
'@humanfs/[email protected]':
@@ -6157,81 +6364,177 @@ snapshots:
'@humanwhocodes/[email protected]': {}
+ '@img/[email protected]': {}
+
optionalDependencies:
'@img/sharp-libvips-darwin-arm64': 1.0.4
optional: true
+ optionalDependencies:
+ '@img/sharp-libvips-darwin-arm64': 1.2.4
+ optional: true
+
optionalDependencies:
'@img/sharp-libvips-darwin-x64': 1.0.4
optional: true
+ optionalDependencies:
+ '@img/sharp-libvips-darwin-x64': 1.2.4
+ optional: true
+
optional: true
+ optional: true
+
optional: true
+ optional: true
+
optional: true
+ optional: true
+
optional: true
+ optional: true
+
+ optional: true
+
+ optional: true
+
optional: true
+ optional: true
+
optional: true
+ optional: true
+
optional: true
+ optional: true
+
optional: true
+ optional: true
+
optionalDependencies:
'@img/sharp-libvips-linux-arm64': 1.0.4
optional: true
+ optionalDependencies:
+ '@img/sharp-libvips-linux-arm64': 1.2.4
+ optional: true
+
optionalDependencies:
'@img/sharp-libvips-linux-arm': 1.0.5
optional: true
+ optionalDependencies:
+ '@img/sharp-libvips-linux-arm': 1.2.4
+ optional: true
+
+ optionalDependencies:
+ '@img/sharp-libvips-linux-ppc64': 1.2.4
+ optional: true
+
+ optionalDependencies:
+ '@img/sharp-libvips-linux-riscv64': 1.2.4
+ optional: true
+
optionalDependencies:
'@img/sharp-libvips-linux-s390x': 1.0.4
optional: true
+ optionalDependencies:
+ '@img/sharp-libvips-linux-s390x': 1.2.4
+ optional: true
+
optionalDependencies:
'@img/sharp-libvips-linux-x64': 1.0.4
optional: true
+ optionalDependencies:
+ '@img/sharp-libvips-linux-x64': 1.2.4
+ optional: true
+
optionalDependencies:
'@img/sharp-libvips-linuxmusl-arm64': 1.0.4
optional: true
+ optionalDependencies:
+ '@img/sharp-libvips-linuxmusl-arm64': 1.2.4
+ optional: true
+
optionalDependencies:
'@img/sharp-libvips-linuxmusl-x64': 1.0.4
optional: true
+ optionalDependencies:
+ '@img/sharp-libvips-linuxmusl-x64': 1.2.4
+ optional: true
+
dependencies:
'@emnapi/runtime': 1.8.1
optional: true
+ dependencies:
+ '@emnapi/runtime': 1.8.1
+ optional: true
+
+ optional: true
+
optional: true
+ optional: true
+
optional: true
+ optional: true
+
dependencies:
lodash-es: 4.17.23
@@ -6248,6 +6551,10 @@ snapshots:
wrap-ansi: 8.1.0
wrap-ansi-cjs: [email protected]
+ '@isaacs/[email protected]':
+ dependencies:
+ minipass: 7.1.3
+
dependencies:
'@sinclair/typebox': 0.27.8
@@ -7557,8 +7864,7 @@ snapshots:
- optional: true
dependencies:
@@ -7700,6 +8006,8 @@ snapshots:
+
@@ -7860,14 +8168,12 @@ snapshots:
es-define-property: 1.0.1
es-errors: 1.3.0
gopd: 1.2.0
- optional: true
dependencies:
define-data-property: 1.1.4
has-property-descriptors: 1.0.2
object-keys: 1.1.1
- optional: true
@@ -7875,13 +8181,11 @@ snapshots:
- optional: true
- optional: true
@@ -8037,8 +8341,7 @@ snapshots:
has-tostringtag: 1.0.2
hasown: 2.0.2
- optional: true
optionalDependencies:
@@ -8484,7 +8787,6 @@ snapshots:
roarr: 2.15.4
semver: 7.7.3
serialize-error: 7.0.1
- optional: true
@@ -8494,7 +8796,6 @@ snapshots:
dependencies:
define-properties: 1.2.1
gopd: 1.2.0
- optional: true
@@ -8523,7 +8824,6 @@ snapshots:
dependencies:
es-define-property: 1.0.1
- optional: true
@@ -8788,8 +9088,7 @@ snapshots:
- optional: true
@@ -8913,7 +9212,6 @@ snapshots:
dependencies:
escape-string-regexp: 4.0.0
- optional: true
@@ -8995,6 +9293,10 @@ snapshots:
minipass: 3.3.6
yallist: 4.0.0
+ dependencies:
+ minipass: 7.1.3
+
@@ -9071,8 +9373,7 @@ snapshots:
- optional: true
@@ -9086,6 +9387,14 @@ snapshots:
+
+ dependencies:
+ global-agent: 3.0.0
+ onnxruntime-common: 1.21.0
+ tar: 7.5.22
+
dependencies:
flatbuffers: 25.9.23
@@ -9095,6 +9404,15 @@ snapshots:
platform: 1.3.6
protobufjs: 7.5.4
+ dependencies:
+ flatbuffers: 25.9.23
+ guid-typescript: 1.0.9
+ long: 5.3.2
+ onnxruntime-common: 1.22.0-dev.20250409-89f8206ba4
+ platform: 1.3.6
+ protobufjs: 7.5.4
+
dependencies:
deep-is: 0.1.4
@@ -9490,7 +9808,6 @@ snapshots:
json-stringify-safe: 5.0.1
semver-compare: 1.0.0
sprintf-js: 1.1.3
- optional: true
@@ -9562,8 +9879,7 @@ snapshots:
- optional: true
@@ -9574,7 +9890,6 @@ snapshots:
dependencies:
type-fest: 0.13.1
- optional: true
dependencies:
@@ -9607,6 +9922,37 @@ snapshots:
'@img/sharp-win32-x64': 0.33.5
optional: true
+ dependencies:
+ '@img/colour': 1.1.0
+ detect-libc: 2.1.2
+ semver: 7.7.3
+ optionalDependencies:
+ '@img/sharp-darwin-arm64': 0.34.5
+ '@img/sharp-darwin-x64': 0.34.5
+ '@img/sharp-libvips-darwin-arm64': 1.2.4
+ '@img/sharp-libvips-darwin-x64': 1.2.4
+ '@img/sharp-libvips-linux-arm': 1.2.4
+ '@img/sharp-libvips-linux-arm64': 1.2.4
+ '@img/sharp-libvips-linux-ppc64': 1.2.4
+ '@img/sharp-libvips-linux-riscv64': 1.2.4
+ '@img/sharp-libvips-linux-s390x': 1.2.4
+ '@img/sharp-libvips-linux-x64': 1.2.4
+ '@img/sharp-libvips-linuxmusl-arm64': 1.2.4
+ '@img/sharp-libvips-linuxmusl-x64': 1.2.4
+ '@img/sharp-linux-arm': 0.34.5
+ '@img/sharp-linux-arm64': 0.34.5
+ '@img/sharp-linux-ppc64': 0.34.5
+ '@img/sharp-linux-riscv64': 0.34.5
+ '@img/sharp-linux-s390x': 0.34.5
+ '@img/sharp-linux-x64': 0.34.5
+ '@img/sharp-linuxmusl-arm64': 0.34.5
+ '@img/sharp-linuxmusl-x64': 0.34.5
+ '@img/sharp-wasm32': 0.34.5
+ '@img/sharp-win32-arm64': 0.34.5
+ '@img/sharp-win32-ia32': 0.34.5
+ '@img/sharp-win32-x64': 0.34.5
+
dependencies:
shebang-regex: 3.0.0
@@ -9662,8 +10008,7 @@ snapshots:
- optional: true
@@ -9795,6 +10140,14 @@ snapshots:
mkdirp: 1.0.4
yallist: 4.0.0
+ dependencies:
+ '@isaacs/fs-minipass': 4.0.1
+ chownr: 3.0.0
+ minipass: 7.1.3
+ minizlib: 3.1.0
+ yallist: 5.0.0
+
dependencies:
async-exit-hook: 2.0.1
@@ -9899,8 +10252,7 @@ snapshots:
- optional: true
@@ -10131,6 +10483,8 @@ snapshots:
+
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index bc6fa684..583a7b5c 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -9,6 +9,7 @@ onlyBuiltDependencies:
ignoredBuiltDependencies:
- core-js
- esbuild
+ - onnxruntime-node
- protobufjs
- sharp
- workerd
@@ -16,6 +17,7 @@ allowBuilds:
core-js: false
electron: true
esbuild: false
+ onnxruntime-node: false
protobufjs: false
sharp: false
workerd: false