Skip to content

Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.

Editor: restore cover follows the same open rule as the workspace

Bowen Xued06f56f2b8c3
diff --git a/scripts/test_freevideo_entry.mjs b/scripts/test_freevideo_entry.mjs
index 80c2d96..7a8bceb 100644
--- a/scripts/test_freevideo_entry.mjs
+++ b/scripts/test_freevideo_entry.mjs
@@ -29,6 +29,10 @@ class Element {
test('main browser entry registers both views and preserves node hooks', async t => {
const extensions = [], opened = [], installed = [], events = new EventTarget();
let refreshed = 0, compatibilityChecks = 0, updateChecks = 0, doneNotifyStarts = 0, rememberedView = null;
+ const openingEvents = [];
+ let restoreReleases = 0;
+ let launchReady = null;
+ const opening = {setName: name => openingEvents.push(['name', name]), cover: () => openingEvents.push(['cover']), finish: () => openingEvents.push(['finish'])};
const casts = [];
let progressView, progressOptions, realProgressFactory;
const app = {
@@ -73,6 +77,7 @@ test('main browser entry registers both views and preserves node hooks', async t
startDoneNotify: () => { doneNotifyStarts++; }, askDesktopPermission: () => {},
installNavigation: callback => installed.push(callback),
refreshNavigation: () => refreshed++, preferredView: () => rememberedView,
+ beginWorkspaceRestore: () => { openingEvents.push(['begin']); return opening; }, finishWorkspaceRestore: () => { restoreReleases++; }, waitForLauncherRestore: () => launchReady,
attachReferencePicker() {}, referenceItems: () => [], syncReferencePrompt() {},
shareButton: () => new Element('button'), reportFileName: () => 'FreeVideo-report-20261008-101530.json',
rememberPromptDraft() {}, savePromptDraft: async () => false, openImageEditor: async () => null, icon: () => '',
@@ -89,6 +94,7 @@ test('main browser entry registers both views and preserves node hooks', async t
}
try {
let source = await readFile(new URL('../web/freevideo.js', import.meta.url), 'utf8');
+ source = source.replace("import { beginWorkspaceRestore, finishWorkspaceRestore, waitForLauncherRestore } from './workspace_restore.js';", 'const {beginWorkspaceRestore,finishWorkspaceRestore,waitForLauncherRestore} = globalThis.__freevideoEntryTest;');
source = source.replace("import { openEditorView } from './editor_loader.js';", 'const openEditorView = (...args) => globalThis.__freevideoEntryTest.openEditorView?.(...args);');
source = source
.replace("import { createErrorPanel, errorText, createErrorReport, adviceFor } from './error_panel.js';", 'const {createErrorPanel,errorText,createErrorReport,adviceFor} = globalThis.__freevideoEntryTest;')
@@ -225,8 +231,10 @@ test('main browser entry registers both views and preserves node hooks', async t
assert.equal(node.widgets[0].value, 8, 'Migrate the previous private force-checkbox slot');
node.buttons[0].callback();
const quiet = opened.length;
+ const releasesBefore = restoreReleases;
extension.afterConfigureGraph();
assert.equal(opened.length, quiet, 'a tab restored with the page does not open the workspace on its own');
+ assert.equal(restoreReleases, releasesBefore + 1, 'the page-load cover is released when nothing opens');
events.dispatchEvent(new Event('pointerdown'));
extension.afterConfigureGraph();
assert.deepEqual(opened, [node, node]);
@@ -248,10 +256,21 @@ test('main browser entry registers both views and preserves node hooks', async t
assert.equal(workflows, 1); assert.equal(opened.length, before + 2);
rememberedView = 'editor';
const restored = [];
- dependencies.openEditorView = (value, options) => restored.push({node:value, studio:options.studio});
+ let finishLaunch, finishEditor;
+ launchReady = new Promise(resolve => { finishLaunch = resolve; });
+ const ready = new Promise(resolve => { finishEditor = resolve; });
+ dependencies.openEditorView = (value, options) => { restored.push({node:value, studio:options.studio}); options.onProjectLoaded({name: 'saved project'}); return {ready}; };
+ const beforeRestore = opened.length;
extension.afterConfigureGraph();
+ assert.equal(restored.length, 0, 'wait for launcher/session restoration before choosing the workspace');
+ finishLaunch(); await Promise.resolve(); await Promise.resolve();
assert.equal(restored[0].node, node);
- assert.ok(restored[0].studio, 'restore opens the studio before the editor');
+ assert.equal(restored[0].studio, undefined, 'restore enters the editor directly');
+ assert.equal(opened.length, beforeRestore, 'the creation panel never flashes during a successful recovery');
+ assert.deepEqual(openingEvents, [['begin'], ['name', 'saved project'], ['cover']]);
+ finishEditor(); await Promise.resolve(); await Promise.resolve();
+ assert.deepEqual(openingEvents.at(-1), ['finish'], 'keep the opening status and update suppression until editor.ready');
+ launchReady = null;
// The lazy loader owns failed imports: it notifies, reports through onFailure and resolves null.
dependencies.openEditorView = async (node, options) => { options.onFailure(new Error('editor unavailable')); return null; };
extension.afterConfigureGraph(); await Promise.resolve();
diff --git a/web/editor.js b/web/editor.js
index 3195f36..dafaabe 100644
--- a/web/editor.js
+++ b/web/editor.js
@@ -219,10 +219,15 @@ export function openEditor({api, app, from = null, panel = {}, components: given
let submissionFailure = null;
let blockStates = null, progressObserver = null, progressConnection = null;
function barJob(job) {
+ if (!job) return job;
const latest = [...runProgress.values()].filter(message => message.chain.id === job.id)
+ .filter(message => job.blocks?.some(block => block.id === message.chain.block && ['running', 'queued'].includes(block.state)))
.sort((a, b) => (a.received_at || 0) - (b.received_at || 0)).at(-1);
const words = panel.progressWords?.() || null;
- return latest ? {...job, chainProgress: latest.chain, words} : words ? {...job, words} : job;
+ const loadingClip = !job.blocks?.some(block => ['pending', 'queued', 'running'].includes(block.state))
+ && job.blocks?.some(block => block.state === 'done' && block.output && ['queued', 'running'].includes(model.attemptClip(state.record, block.id)?.pending));
+ return {...job, ...(loadingClip ? {state: 'running', loadingClip: true} : {}),
+ ...(latest ? {chainProgress: latest.chain, progressMessage: latest} : {}), words};
}
function paintJob(job) {
const messages = blockMessages([...runProgress.values()].filter(message => message.chain.id === job.id),
@@ -230,7 +235,9 @@ export function openEditor({api, app, from = null, panel = {}, components: given
const values = editorBlockStates(job, messages, blockStates);
for (const block of job.blocks || []) {
const clip = model.attemptClip(state.record, block.id); if (!clip || clip.job !== job.id) continue;
- const value = {...values[block.id], run: `${job.id}:${block.prompt_id || block.attempts || 0}`};
+ const loading = block.state === 'done' && block.output && ['queued', 'running'].includes(clip.pending);
+ const value = {...values[block.id], ...(loading ? {state: 'generating', fraction: .99} : {}), run: `${job.id}:${block.prompt_id || block.attempts || 0}`};
+ if (value.state === 'generating') value.fraction = Math.min(.99, value.fraction || 0);
for (const pair of model.pair(state.record, block.id)) { progress.set(pair.id, value); tracks?.setProgress(pair.id, value); }
}
}
@@ -492,6 +499,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given
return ['queued', 'running', 'cancelling'].includes(previous.state);
failures.reconcile(job, previous);
mostRecentJob = job.id; jobStatuses.set(job.id, job); paintJob(job);
+ genbar?.update(barJob(job));
const completed = new Set();
for (const block of job.blocks || []) {
const clip = model.attemptClip(state.record, block.id); if (!clip || clip.job !== job.id) continue;
@@ -551,6 +559,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given
value.held = waiting;
localStorage.setItem(viewPrefix + key, JSON.stringify({selection: value.selection, text: value.text, ...(waiting.length ? {held: waiting} : {})}));
if (state.record.id) localStorage.setItem('fv-editor-last', key);
+ localStorage.setItem('fv-editor-opening', JSON.stringify({id: key, name: state.record.name}));
} catch {}
// An untouched edit belongs to this tab until it has a saved identity.
lastDraft = !state.record.id && state.record.tracks.every(track => !track.clips.length) ? key : null;
@@ -570,6 +579,7 @@ export function openEditor({api, app, from = null, panel = {}, components: given
player.pause(); for (const stop of jobWatchers.values()) stop(); jobWatchers.clear(); jobStatuses.clear(); progress.clear(); runProgress.clear(); failures.clear(); progressConnection?.reset();
mostRecentJob = null; submissionFailure = null; genbar?.update(null); queue.reset(record); stopExport?.(); stopExport = null; exportStatus = exportSnapshot = null; exportButton.textContent = t('Export', '导出');
suppressSave = true; try { state.replace(record); savedContent = content(record); } finally { suppressSave = false; }
+ panel.onProjectLoaded?.(record);
const width = tracksHost.clientWidth - 148; if (width > 0) state.setZoom(model.openingZoom(width, record));
tracks?.setScrollLeft(0);
// An empty edit opens with one part's length selected at the start, ready to generate.
diff --git a/web/editor_entry.js b/web/editor_entry.js
index 2c9aab2..4b52140 100644
--- a/web/editor_entry.js
+++ b/web/editor_entry.js
@@ -23,9 +23,10 @@ function editorPanel(node) {
return {node: String(node.id), prompt: value.output, extra_data: {extra_pnginfo: {workflow: value.workflow || {}}}};
}};
}
-export function openEditorView(node, {studio, work = null, extend = false} = {}) {
+export function openEditorView(node, {studio, work = null, extend = false, onProjectLoaded} = {}) {
studio?.querySelectorAll('video,audio').forEach(media => media.pause());
const panel = editorPanel(node);
+ if (onProjectLoaded) panel.onProjectLoaded = onProjectLoaded;
const progressElement = studio?.querySelector('.fv-generation-progress');
if (progressElement) {
panel.progressElement = progressElement;
diff --git a/web/editor_genbar.js b/web/editor_genbar.js
index 728a6a4..a953c54 100644
--- a/web/editor_genbar.js
+++ b/web/editor_genbar.js
@@ -6,6 +6,35 @@ const el = (tag, cls, text) => { const e = document.createElement(tag); if (cls)
export const timeEstimate = (seconds, t) => seconds == null ? '' : seconds < 60
? t(`about ${Math.max(1, Math.ceil(seconds))} s`, `约 ${Math.max(1, Math.ceil(seconds))} 秒`)
: t(`about ${Math.ceil(seconds / 60)} minutes`, `约 ${Math.ceil(seconds / 60)} 分钟`);
+// Provisional copy keys for Iris; decode/save sentences follow Studio's stage vocabulary.
+export const CLIP_FINALIZATION_COPY = {
+ prepareDecode: ['Preparing video decoding', '正在准备解码视频'],
+ loadDecoder: ['Loading the video decoder', '正在载入视频解码器'],
+ decodeVideo: ['Decoding the video', '正在解码视频'],
+ decodeAudio: ['Decoding the audio', '正在解码音频'],
+ saveVideo: ['Saving the video', '正在保存视频'],
+ openClip: ['Loading the generated clip', '正在载入生成片段'],
+ joinClips: ['Combining the clips', '正在合成片段'],
+};
+export function clipFinalization(job) {
+ if (!job || !['running', 'queued'].includes(job.state)) return null;
+ const message = job.progressMessage || job.progress || {}, blocks = job.blocks || [];
+ const phase = message.phase || message.timing_phase, label = message.label || '';
+ let key;
+ if (job.joining) key = 'joinClips';
+ else if (job.loadingClip || phase === 'complete' || message.overall?.status === 'complete'
+ || blocks.some(block => block.state === 'running' && block.fraction >= 1)) key = 'openClip';
+ else if (phase === 'save' || /^Saving (MP4 and audio|decoded video|decoded audio)$/.test(label)) key = 'saveVideo';
+ else if (phase === 'sample_finalize') key = 'prepareDecode';
+ else if (phase === 'decode' || message.timing_phase === 'decode') key = /audio/i.test(label) && !/video and audio/i.test(label) ? 'decodeAudio'
+ : label === 'Loading video VAE' ? 'loadDecoder' : 'decodeVideo';
+ if (!key) return null;
+ // Decode/save and joining retain engine cancellation. A saved final part waiting
+ // for its receipt/media cannot be cancelled; later queued parts still can.
+ const current = message.chain?.block || blocks.find(block => block.state === 'running')?.id;
+ const later = blocks.some(block => block.id !== current && ['pending', 'queued', 'running'].includes(block.state));
+ return {key, cancelable: key !== 'openClip' || !job.loadingClip && later};
+}
// After the next frame is on screen; a page nobody sees has no frame to wait for.
const painted = () => typeof document === 'undefined' || document.visibilityState !== 'visible' || typeof requestAnimationFrame !== 'function' ? Promise.resolve()
: new Promise(resolve => requestAnimationFrame(() => { const {port1, port2} = new MessageChannel(); port1.onmessage = () => { port1.close(); resolve(); }; port2.postMessage(null); }));
@@ -88,7 +117,8 @@ export function createEditorGenbar(host, {state, t, actions, text = ''}) {
generate.classList.toggle('fv-primary', selected && !busy);
// A cancel already accepted is not offered again; the bar says it is stopping until the run ends.
const cancelling = status?.state === 'cancelling' && !held;
- cancel.hidden = !busy || opening || cancelling; resume.hidden = !stopped;
+ const finalization = clipFinalization(status);
+ cancel.hidden = !busy || opening || cancelling || !held && finalization?.cancelable === false; resume.hidden = !stopped;
const waiting = status?.state === 'queued' && !(status.blocks || []).some(block => ['queued', 'running'].includes(block.state) && block.prompt_id);
if (opening) hint.textContent = t('Starting…', '正在开始…');
else if (held || waiting) hint.textContent = t('Queued', '排队中');
@@ -103,8 +133,8 @@ export function createEditorGenbar(host, {state, t, actions, text = ''}) {
// A single part needs no number; with nothing else to say it reads "Preparing".
// The creation panel's own time when it has one, so the bar and the panel never differ; the job's sum until the panel has one.
const left = words?.over ? null : words?.left ?? remaining;
- const time = words?.stall || (words?.over ? t('Taking longer than expected', '比预计久,仍在生成') : words?.time || (left != null ? timeEstimate(left, t) : ''));
- const stage = words?.stage || (count === 1 && !time ? t('Preparing', '正在准备') : '');
+ const time = finalization ? '' : words?.stall || (words?.over ? t('Taking longer than expected', '比预计久,仍在生成') : words?.time || (left != null ? timeEstimate(left, t) : ''));
+ const stage = finalization ? t(...CLIP_FINALIZATION_COPY[finalization.key]) : words?.stage || (count === 1 && !time ? t('Preparing', '正在准备') : '');
const spans = [['fv-ed-gen-part', count > 1 ? t(`Part ${number}/${count}`, `第 ${number}/${count} 段`) : ''],
['fv-ed-gen-stage', stage], ['fv-ed-gen-time', time]];
const shown = spans.filter(([, text]) => text).map(([cls, text], index) => [cls, index ? ` · ${text}` : text]);
@@ -223,7 +253,7 @@ export function editorBlockStates(job, messages = [], resolve = null) {
: block.fraction;
return [block.id, {state: running && live ? 'generating' : states[block.state] || 'waiting',
...(['pending', 'queued'].includes(block.state) && !live ? {queued: true} : {}),
- fraction: Math.max(0, Math.min(1, fraction || 0)),
+ fraction: Math.max(0, Math.min(block.state === 'done' ? 1 : .99, fraction || 0)),
remainingSeconds: running && live ? live.remaining_seconds ?? live.overall?.remaining_seconds ?? block.remaining_seconds ?? null
: block.remaining_seconds ?? null}];
}));
diff --git a/web/freevideo.js b/web/freevideo.js
index 7365589..8afceb4 100644
--- a/web/freevideo.js
+++ b/web/freevideo.js
@@ -3,6 +3,7 @@ import { installNativeErrorGuard } from './native_errors.js';
import { app } from "../../scripts/app.js";
import { api } from "../../scripts/api.js";
import { openEditorView } from './editor_loader.js';
+import { beginWorkspaceRestore, finishWorkspaceRestore, waitForLauncherRestore } from './workspace_restore.js';
import { openStudio, loraPanel, loraWarning, promptGuide } from "./studio.js";
import { createGenerationProgress, referenceTrimText, thermalText, sharedGpuText, encoderFileText, encoderFilePath } from './generation_progress.js';
import { createProgressConnection } from './progress_connection.js';
@@ -797,16 +798,27 @@ app.registerExtension({
const rememberedView = preferredView();
const node = (app.graph?._nodes || []).find(isGenerate);
// The user's own workflow is shown as it is. A FreeVideo workflow opens its workspace once the
- // launcher or the user asked for it, never on its own for a tab restored with the page.
- if (!node) { collapseWorkspaces(); return; }
- if (app.graph?.extra?.freevideo_studio && rememberedView !== 'nodes' && (launchVisit || userActed)) {
- requestAnimationFrame(() => {
- const studio = showStudio(node);
- if (studio && rememberedView === 'editor') {
- void openEditorView(node, {studio, onFailure: error => health({type: 'error', where: 'editor', error})});
+ // launcher or the user asked for it, never on its own for a tab restored with the page. The startup
+ // cover follows this same decision and is always released here when the workspace will not open.
+ const opens = !!node && app.graph?.extra?.freevideo_studio && rememberedView !== 'nodes' && (launchVisit || userActed);
+ if (!opens) { finishWorkspaceRestore(); if (!node) collapseWorkspaces(); return; }
+ const opening = rememberedView === 'editor' ? beginWorkspaceRestore() : null, epoch = configuration;
+ requestAnimationFrame(async () => {
+ const launch = waitForLauncherRestore(); if (launch) await launch;
+ if (epoch !== configuration) return;
+ if (!opening) { showStudio(node); return; }
+ try {
+ const handle = await openEditorView(node, {isCurrent: () => epoch === configuration,
+ onProjectLoaded: record => opening.setName(record.name),
+ onFailure: error => health({type: 'error', where: 'editor', error})});
+ if (epoch !== configuration) return;
+ if (handle) { opening.cover(); await handle.ready; }
+ else {
+ const studio = showStudio(node), status = studio?.querySelector?.('.fv-status');
+ if (status) { status.dataset.error = 'true'; status.textContent = text('Could not complete. Try again.', '没有完成,请重试'); }
}
- });
- }
+ } finally { if (epoch === configuration) opening.finish(); }
+ });
},
onNodeOutputsUpdated(outputs) {
for (const [id, output] of Object.entries(outputs)) {
diff --git a/web/health.js b/web/health.js
index 071ada7..324ffcd 100644
--- a/web/health.js
+++ b/web/health.js
@@ -18,7 +18,7 @@ export const MODULES = ['agent_activity.js', 'agent_connect.js', 'agent_session.
'editor_loader.js', 'editor_text_coverage.js', 'editor_text.js', 'editor_toolbar_more.js', 'editor_text_model.js', 'editor_text_layout.js', 'editor_notes.js', 'editor_icons.js', 'dialog_keys.js', 'done_notify.js', 'failure_issue.js', 'feedback.js', 'frame_sizes.js', 'health.js', 'image_commands.js', 'image_editor.js', 'image_editor_engine.js', 'image_generation.js', 'launch_visit.js', 'launcher.js', 'length_plan.js', 'lora_triggers.js', 'lora_check.js', 'library.js', 'motion.js', 'native_errors.js', 'output_download.js', 'port_notice.js', 'preview_scene.js',
'progress_connection.js', 'prompt_draft.js', 'prompt_enhance.js', 'prompt_references.js', 'prompt_terms.js', 'request_assets.js', 'report_issue.js', 'studio_recent.js',
'result_actions.js', 'sampling_effort.js', 'setup.js', 'share.js', 'share_layout.js', 'studio.js', 'studio_chain.js', 'studio_extend.js', 'studio_length.js', 'first_frame_row.js', 'optional_inputs.js', 'studio_queue.js', 'studio_size.js',
- 'toolbar_position.js', 'updates.js', 'view_navigation.js', 'wordmark.js', 'cast_library.js', 'media_upload.js'];
+ 'toolbar_position.js', 'updates.js', 'view_navigation.js', 'wordmark.js', 'workspace_restore.js', 'cast_library.js', 'media_upload.js'];
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
let visibleAt = 0;
async function waitForVisible() {
@@ -368,6 +368,8 @@ function sheetLoaded(name) {
function workspaceProblem(app) {
// Scripts that never started are already named by the load check.
if (!window.FreeVideoUI?.ready || !hasGenerate(app.graph)) return null;
+ const opening = document.querySelector('dialog.fv-workspace-opening[open]');
+ if (opening && onScreen(opening)) return null;
// The editor shares the studio shell; either view replaces the floating toolbar.
const studio = document.querySelector('dialog.fv-editor[open]') || document.querySelector('dialog.fv-studio[open]');
if (studio) return onScreen(studio) ? null
diff --git a/web/launcher.js b/web/launcher.js
index 6b97960..2184a82 100644
--- a/web/launcher.js
+++ b/web/launcher.js
@@ -2,6 +2,7 @@ import { app } from '../../scripts/app.js';
import { api } from '../../scripts/api.js';
import { restorePromptDraft } from './prompt_draft.js';
import { takePortMarker } from './port_notice.js';
+import { launcherRestoreFinished } from './workspace_restore.js';
// health.js names what failed; files loaded before it queue their reports.
const health = item => (window.__freevideoHealth ||= []).push(item);
@@ -142,12 +143,14 @@ app.registerExtension({
} catch (error) {
console.error('FreeVideo launcher:', error);
health({type: 'launch', error});
+ launcherRestoreFinished();
return;
}
const opened = cached ? undefined : app.extensionManager?.workflow?.activeWorkflow;
- keepInFront(workflow, opened).then(() => health({type: 'launch'}), error => {
+ keepInFront(workflow, opened).then(() => { health({type: 'launch'}); launcherRestoreFinished(); }, error => {
console.error('FreeVideo launcher:', error);
health({type: 'launch', error});
+ launcherRestoreFinished();
});
},
});
diff --git a/web/workspace_restore.js b/web/workspace_restore.js
new file mode 100644
index 0000000..b315928
--- /dev/null
+++ b/web/workspace_restore.js
@@ -0,0 +1,54 @@
+import { isLaunchVisit } from './launch_visit.js';
+// Small, eager startup surface: no editing-module or host imports to delay its first paint.
+// Provisional copy keys for Iris. Keep project names as text, never markup.
+export const WORKSPACE_OPENING_COPY = {
+ opening: ['Opening', '正在打开'],
+ openingNamed: ['Opening {name}', '正在打开 {name}'],
+};
+let opening = null;
+const query = new URLSearchParams(typeof location === 'undefined' ? '' : location.search);
+const language = query.get('freevideo_lang');
+const cn = language === 'zh' || language !== 'en' && String(globalThis.navigator?.language || '').toLowerCase().startsWith('zh');
+let resolveLaunch;
+const launchReady = query.get('freevideo') === 'launch' ? new Promise(resolve => { resolveLaunch = resolve; }) : null;
+export const waitForLauncherRestore = () => launchReady;
+export function launcherRestoreFinished() { resolveLaunch?.(); resolveLaunch = null; }
+
+function cachedName() {
+ try {
+ const value = JSON.parse(localStorage.getItem('fv-editor-opening'));
+ return value?.id === localStorage.getItem('fv-editor-last') ? value.name : '';
+ } catch { return ''; }
+}
+export function beginWorkspaceRestore() {
+ if (opening) return opening;
+ const dialog = document.createElement('dialog'), label = document.createElement('span'), style = document.createElement('style');
+ dialog.className = 'fv-workspace-opening';
+ dialog.setAttribute('aria-busy', 'true'); label.setAttribute('role', 'status'); label.setAttribute('aria-live', 'polite');
+ // Inline sizing works before the product styles arrive. Suppress cached/live update
+ // banners until the recovered workspace is ready, without delaying update checks.
+ style.textContent = '.fv-workspace-opening[open]{position:fixed;inset:0;box-sizing:border-box;width:100vw;height:100vh;max-width:none;max-height:none;margin:0;border:0;padding:24px;display:grid;place-items:center;background:#10151e;color:#e6edf6;font:16px/1.6 system-ui,sans-serif}.fv-workspace-opening::backdrop{background:#10151e}.fv-update-notice{display:none!important}';
+ dialog.append(label); document.head.append(style); document.body.append(dialog);
+ const setName = name => {
+ const known = typeof name === 'string' ? name.trim() : '';
+ const words = WORKSPACE_OPENING_COPY[known ? 'openingNamed' : 'opening'];
+ label.textContent = words[cn ? 1 : 0].replace('{name}', () => known);
+ };
+ dialog.oncancel = event => event.preventDefault();
+ const handle = {setName, cover() {
+ // openEditor creates a native modal; keep this status above its unfinished UI.
+ if (opening !== handle) return;
+ if (dialog.open) dialog.close();
+ dialog.showModal();
+ }, finish() {
+ if (opening !== handle) return;
+ opening = null; if (dialog.open) dialog.close(); dialog.remove(); style.remove();
+ }};
+ opening = handle; setName(cachedName()); dialog.showModal();
+ return handle;
+}
+export function finishWorkspaceRestore() { opening?.finish(); }
+// ComfyUI loads extension modules before setup/session restoration. Show words at
+// this first opportunity, including ordinary refreshes after the launcher flag is gone.
+// Only a launcher visit opens the workspace on its own (see afterConfigureGraph), so only it is covered here.
+try { if (localStorage.getItem('freevideo.view') === 'editor' && isLaunchVisit(location.search, globalThis.sessionStorage)) beginWorkspaceRestore(); } catch { /* Storage may be unavailable. */ }