import { ResourceTracker } from '../core/resource-tracker.js'; import { el } from '../core/dom.js'; import { t } from '../core/i18n.js'; import { mountStudioRuntime } from './actions-studio-runtime.js'; const PAGE = 'actions-studio'; let tracker = null; let runtimeCleanup = null; function studioTemplate() { return `

BJORN Studio

Tips Drag background to pan, mouse wheel/pinch to zoom, connect ports to link nodes.
0N | 0L
Edit...
Success
Failure
Requires
Delete
`; } export function mount(container) { tracker = new ResourceTracker(PAGE); const root = el('div', { class: 'studio-container studio-runtime-host' }, [ el('div', { class: 'studio-loading' }, [t('common.loading')]), ]); container.appendChild(root); try { root.innerHTML = studioTemplate(); runtimeCleanup = mountStudioRuntime(root); } catch (err) { root.innerHTML = ''; root.appendChild(el('div', { class: 'card', style: 'margin:12px;padding:12px' }, [ el('h3', {}, [t('nav.actionsStudio')]), el('p', {}, [`Failed to initialize studio: ${err.message}`]), ])); } } export function unmount() { if (typeof runtimeCleanup === 'function') { try { runtimeCleanup(); } catch { /* noop */ } } runtimeCleanup = null; if (tracker) { tracker.cleanupAll(); tracker = null; } }