@templatical/editor 0.16.4 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AiChatSidebar-CYAbVB2G.js → AiChatSidebar-LxCHMdcj.js} +1 -1
- package/dist/{AiFeatureMenu-BPCkrHAS.js → AiFeatureMenu-zwSmx9ZW.js} +3 -3
- package/dist/{BlockIssueBadge-BLytBabN.js → BlockIssueBadge-BQ1yB1me.js} +2 -2
- package/dist/{CloudEditor-v8ARYaFW.js → CloudEditor-5ahgKRX8.js} +11 -10
- package/dist/{CollaboratorBar-BQzKZ2zo.js → CollaboratorBar-6PtX-1AS.js} +2 -2
- package/dist/{ColorPicker-Cab6U2sH.js → ColorPicker-DfzDyNKe.js} +57 -58
- package/dist/{CommentsSidebar-C_XLBbo3.js → CommentsSidebar-Cl93TN96.js} +3 -3
- package/dist/{CountdownBlock-173fiO5Z.js → CountdownBlock-DbXfzwae.js} +1 -1
- package/dist/{CountdownToolbar-q3umZ7TZ.js → CountdownToolbar-BqaMWRyB.js} +3 -3
- package/dist/{DesignReferenceSidebar-Bh9uAZ4B.js → DesignReferenceSidebar-jVrdS8wW.js} +2 -2
- package/dist/{IssuesPanel-DltSuU6H.js → IssuesPanel-Bq3yXg6M.js} +2 -2
- package/dist/{MergeTagSuggestion-DrT3LiZ4.js → MergeTagSuggestion-jIpT_jmz.js} +7 -5
- package/dist/{ModuleBrowserModal-CzzChPmN.js → ModuleBrowserModal-B5IH3-1I.js} +7 -7
- package/dist/{ModulePreviewCanvas-C0Q2n3FL.js → ModulePreviewCanvas-CYOLWoZ9.js} +2 -2
- package/dist/{NumberWithSuffix-Bhm2ByHs.js → NumberWithSuffix-9FG7mNnn.js} +1 -1
- package/dist/{ParagraphEditor-BhsBi8p8.js → ParagraphEditor-duWYA6Vv.js} +38 -39
- package/dist/{RichTextEditorContent-ef0fdj6e.js → RichTextEditorContent-DCzmVeyb.js} +13 -13
- package/dist/{SaveModuleDialog-BNN3dcxD.js → SaveModuleDialog-BPUly5h3.js} +6 -6
- package/dist/{SnapshotHistory-tWvgMCe6.js → SnapshotHistory-CmwU3nlN.js} +4 -4
- package/dist/{TemplateScoringPanel-ZhObHWeb.js → TemplateScoringPanel-CMrfa9Rd.js} +3 -3
- package/dist/{TestEmailModal-EdwEcsrD.js → TestEmailModal-zfomMz9i.js} +3 -3
- package/dist/{TitleEditor-DdvRepBq.js → TitleEditor-v0gtezZE.js} +18 -18
- package/dist/{TplModal-Niu4Y96-.js → TplModal-eGFG7k-y.js} +4 -4
- package/dist/{blockTypeIcons-DHcYPMB8.js → blockTypeIcons-Dd0w4T0I.js} +1 -1
- package/dist/bundle-stats.json +7 -7
- package/dist/{ca-DI1ViqMa.js → ca-CSl--oWR.js} +1 -1
- package/dist/cdn/chunks/{AiFeatureMenu-AoUwsqor.js → AiFeatureMenu-CtXsam7G.js} +6 -6
- package/dist/cdn/chunks/{AiFeatureMenu-AoUwsqor.js.map → AiFeatureMenu-CtXsam7G.js.map} +1 -1
- package/dist/cdn/chunks/{BlockIssueBadge-DZU3CfEN.js → BlockIssueBadge-DR7cpDfQ.js} +4 -4
- package/dist/cdn/chunks/{BlockIssueBadge-DZU3CfEN.js.map → BlockIssueBadge-DR7cpDfQ.js.map} +1 -1
- package/dist/cdn/chunks/{CloudEditor-BrZLF_m1.js → CloudEditor-YC5y3AwC.js} +131 -130
- package/dist/cdn/chunks/CloudEditor-YC5y3AwC.js.map +1 -0
- package/dist/cdn/chunks/{CollaboratorBar-BAC56ez6.js → CollaboratorBar-BOD2j8Kl.js} +3 -3
- package/dist/cdn/chunks/{CollaboratorBar-BAC56ez6.js.map → CollaboratorBar-BOD2j8Kl.js.map} +1 -1
- package/dist/cdn/chunks/{ColorPicker-DLEoT419.js → ColorPicker-CPMWLHpa.js} +144 -144
- package/dist/cdn/chunks/ColorPicker-CPMWLHpa.js.map +1 -0
- package/dist/cdn/chunks/{CountdownBlock-BOF9aTXF.js → CountdownBlock-BmGqb7Zi.js} +4 -4
- package/dist/cdn/chunks/{CountdownBlock-BOF9aTXF.js.map → CountdownBlock-BmGqb7Zi.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownToolbar-C9bQ5k4E.js → CountdownToolbar-BBwsdGbV.js} +4 -4
- package/dist/cdn/chunks/{CountdownToolbar-C9bQ5k4E.js.map → CountdownToolbar-BBwsdGbV.js.map} +1 -1
- package/dist/cdn/chunks/{IssuesPanel-CHwYahKK.js → IssuesPanel-G0z-j3JS.js} +7 -7
- package/dist/cdn/chunks/{IssuesPanel-CHwYahKK.js.map → IssuesPanel-G0z-j3JS.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagSuggestion-jesxS7An.js → MergeTagSuggestion-rpZ6Ol-i.js} +8 -6
- package/dist/cdn/chunks/MergeTagSuggestion-rpZ6Ol-i.js.map +1 -0
- package/dist/cdn/chunks/{ModuleBrowserModal-iSXXpAUk.js → ModuleBrowserModal-DiLTY0ec.js} +8 -8
- package/dist/cdn/chunks/{ModuleBrowserModal-iSXXpAUk.js.map → ModuleBrowserModal-DiLTY0ec.js.map} +1 -1
- package/dist/cdn/chunks/{ModulePreviewCanvas-DIy0MZj2.js → ModulePreviewCanvas-CdV5mEQ6.js} +32 -32
- package/dist/cdn/chunks/{ModulePreviewCanvas-DIy0MZj2.js.map → ModulePreviewCanvas-CdV5mEQ6.js.map} +1 -1
- package/dist/cdn/chunks/{NumberWithSuffix-vPdOG2lO.js → NumberWithSuffix-lqQlf0Uk.js} +2 -2
- package/dist/cdn/chunks/{NumberWithSuffix-vPdOG2lO.js.map → NumberWithSuffix-lqQlf0Uk.js.map} +1 -1
- package/dist/cdn/chunks/{ParagraphEditor-D7znI_X1.js → ParagraphEditor-BYoZfURd.js} +75 -75
- package/dist/cdn/chunks/ParagraphEditor-BYoZfURd.js.map +1 -0
- package/dist/cdn/chunks/{RichTextEditorContent-DVwGHbO6.js → RichTextEditorContent-BnPRnXxy.js} +6 -6
- package/dist/cdn/chunks/{RichTextEditorContent-DVwGHbO6.js.map → RichTextEditorContent-BnPRnXxy.js.map} +1 -1
- package/dist/cdn/chunks/{SaveModuleDialog-D2_qPtE9.js → SaveModuleDialog-C9hUeWyG.js} +20 -20
- package/dist/cdn/chunks/{SaveModuleDialog-D2_qPtE9.js.map → SaveModuleDialog-C9hUeWyG.js.map} +1 -1
- package/dist/cdn/chunks/{TitleEditor-CKjZ6Cgp.js → TitleEditor-wFvnU3Jr.js} +9 -9
- package/dist/cdn/chunks/TitleEditor-wFvnU3Jr.js.map +1 -0
- package/dist/cdn/chunks/{blockTypeIcons-BKecgdgr.js → blockTypeIcons-DNMvDz5B.js} +7 -7
- package/dist/cdn/chunks/{blockTypeIcons-BKecgdgr.js.map → blockTypeIcons-DNMvDz5B.js.map} +1 -1
- package/dist/cdn/chunks/{ca-DI1ViqMa.js → ca-CSl--oWR.js} +2 -2
- package/dist/cdn/chunks/ca-CSl--oWR.js.map +1 -0
- package/dist/cdn/chunks/{de-q9lTCMre.js → de-ZaffrKDP.js} +2 -2
- package/dist/cdn/chunks/de-ZaffrKDP.js.map +1 -0
- package/dist/cdn/chunks/{en-CR4LItrX.js → en-CHuXeJDt.js} +2 -2
- package/dist/cdn/chunks/en-CHuXeJDt.js.map +1 -0
- package/dist/cdn/chunks/{es-CEt-lrGd.js → es-CaC8VQjO.js} +2 -2
- package/dist/cdn/chunks/es-CaC8VQjO.js.map +1 -0
- package/dist/cdn/chunks/{extensions-OZTN_skA.js → extensions-DxcxIlwT.js} +29 -29
- package/dist/cdn/chunks/{extensions-OZTN_skA.js.map → extensions-DxcxIlwT.js.map} +1 -1
- package/dist/cdn/chunks/{features-Bo7H8WNI.js → features-B3qgDBHf.js} +727 -677
- package/dist/cdn/chunks/features-B3qgDBHf.js.map +1 -0
- package/dist/cdn/chunks/{icons-BrNSrnyT.js → icons-kiMqh99T.js} +2 -2
- package/dist/cdn/chunks/{icons-BrNSrnyT.js.map → icons-kiMqh99T.js.map} +1 -1
- package/dist/cdn/chunks/{media-library-Cec5DMR3.js → media-library-C5ogiZ4f.js} +451 -451
- package/dist/cdn/chunks/{media-library-Cec5DMR3.js.map → media-library-C5ogiZ4f.js.map} +1 -1
- package/dist/cdn/chunks/{pt-BR-DvBHY0AA.js → pt-BR-C74zfEWH.js} +2 -2
- package/dist/cdn/chunks/pt-BR-C74zfEWH.js.map +1 -0
- package/dist/cdn/chunks/{quality-Dd2iYgRf.js → quality-BftAn_AJ.js} +512 -512
- package/dist/cdn/chunks/{quality-Dd2iYgRf.js.map → quality-BftAn_AJ.js.map} +1 -1
- package/dist/cdn/chunks/{renderer-Br-qXdnQ.js → renderer-Cdlo4MVX.js} +16 -16
- package/dist/cdn/chunks/{renderer-Br-qXdnQ.js.map → renderer-Cdlo4MVX.js.map} +1 -1
- package/dist/cdn/chunks/{src-BH8PABpF.js → src-GBA8oUL2.js} +6 -6
- package/dist/cdn/chunks/{src-BH8PABpF.js.map → src-GBA8oUL2.js.map} +1 -1
- package/dist/cdn/chunks/{styles-nqo5BynI.js → styles-B6rdq9JB.js} +219 -219
- package/dist/cdn/chunks/styles-B6rdq9JB.js.map +1 -0
- package/dist/cdn/editor.css +1 -1
- package/dist/cdn/editor.js +53 -52
- package/dist/cdn/editor.js.map +1 -1
- package/dist/{de-q9lTCMre.js → de-ZaffrKDP.js} +1 -1
- package/dist/{en-CR4LItrX.js → en-CHuXeJDt.js} +1 -1
- package/dist/{es-CEt-lrGd.js → es-CaC8VQjO.js} +1 -1
- package/dist/{extensions-B2poxDIo.js → extensions-B4lu0KkE.js} +3 -3
- package/dist/index.d.ts +56 -0
- package/dist/keys-WVNarXg8.js +10 -0
- package/dist/{pt-BR-DvBHY0AA.js → pt-BR-C74zfEWH.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{styles-DN4J7w-C.js → styles-mBSbDYeX.js} +98 -98
- package/dist/templatical-editor.js +11 -10
- package/dist/{useCloudI18n-WbfVWq5k.js → useCloudI18n-CIKI0hCd.js} +1 -1
- package/dist/{useEditorCore-DBq2689h.js → useEditorCore-CaaHPKjm.js} +715 -684
- package/dist/{useI18n-eR1yVW0v.js → useI18n-0EU_JVe7.js} +1 -1
- package/dist/{useMergeTag-C3GfSktg.js → useMergeTag-C7v6MVah.js} +2 -2
- package/dist/usePopoverPosition-BDqqnMeo.js +281 -0
- package/package.json +7 -7
- package/dist/cdn/chunks/CloudEditor-BrZLF_m1.js.map +0 -1
- package/dist/cdn/chunks/ColorPicker-DLEoT419.js.map +0 -1
- package/dist/cdn/chunks/MergeTagSuggestion-jesxS7An.js.map +0 -1
- package/dist/cdn/chunks/ParagraphEditor-D7znI_X1.js.map +0 -1
- package/dist/cdn/chunks/TitleEditor-CKjZ6Cgp.js.map +0 -1
- package/dist/cdn/chunks/ca-DI1ViqMa.js.map +0 -1
- package/dist/cdn/chunks/de-q9lTCMre.js.map +0 -1
- package/dist/cdn/chunks/en-CR4LItrX.js.map +0 -1
- package/dist/cdn/chunks/es-CEt-lrGd.js.map +0 -1
- package/dist/cdn/chunks/features-Bo7H8WNI.js.map +0 -1
- package/dist/cdn/chunks/pt-BR-DvBHY0AA.js.map +0 -1
- package/dist/cdn/chunks/styles-nqo5BynI.js.map +0 -1
- package/dist/color-DhoxCSMv.js +0 -259
- package/dist/keys-BbDgCU6K.js +0 -10
- package/dist/usePopoverRoot-C1j0D7cc.js +0 -8
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CloudEditor-BrZLF_m1.js","names":["$emit"],"sources":["../../../src/cloud/composables/useSnapshotPreview.ts","../../../src/cloud/composables/useCloudPanelState.ts","../../../src/cloud/composables/useCollabUndoWarning.ts","../../../src/cloud/composables/useCloudFeatureFlags.ts","../../../src/cloud/composables/useCloudMediaLibrary.ts","../../../src/cloud/composables/useCloudInitialization.ts","../../../src/utils/preRenderCustomBlocks.ts","../../../src/cloud/composables/useCloudLifecycle.ts","../../../src/cloud/composables/useCloudSaveGate.ts","../../../src/cloud/components/CloudSaveGateModal.vue","../../../src/cloud/components/CloudSaveGateModal.vue","../../../src/cloud/components/CloudHeader.vue","../../../src/cloud/components/CloudHeader.vue","../../../src/cloud/components/CloudPanels.vue","../../../src/cloud/components/CloudPanels.vue","../../../src/cloud/components/CloudLoadingOverlay.vue","../../../src/cloud/components/CloudLoadingOverlay.vue","../../../src/cloud/components/CloudErrorOverlay.vue","../../../src/cloud/components/CloudErrorOverlay.vue","../../../src/cloud/components/SnapshotPreviewBanner.vue","../../../src/cloud/components/SnapshotPreviewBanner.vue","../../../src/cloud/components/CollabUndoToast.vue","../../../src/cloud/components/CollabUndoToast.vue","../../../src/cloud/CloudEditor.vue","../../../src/cloud/CloudEditor.vue"],"sourcesContent":["import {\n computed,\n onScopeDispose,\n shallowRef,\n ref,\n type ComputedRef,\n type Ref,\n} from \"vue\";\nimport type { TemplateContent, TemplateSnapshot } from \"@templatical/types\";\nimport type {\n UseHistoryReturn,\n UseConditionPreviewReturn,\n UseAutoSaveReturn,\n} from \"@templatical/core\";\nimport {\n useSnapshotHistory,\n type AuthManager,\n type UseSnapshotHistoryReturn,\n} from \"@templatical/core/cloud\";\nimport type { BaseEditorReturn } from \"../../composables/useEditorCore\";\n\nexport interface UseSnapshotPreviewOptions {\n authManager: AuthManager;\n editor: BaseEditorReturn & {\n hasTemplate: () => boolean;\n createSnapshot: () => Promise<void>;\n };\n history: UseHistoryReturn;\n conditionPreview: UseConditionPreviewReturn;\n autoSave: UseAutoSaveReturn | null;\n onError?: (error: Error) => void;\n}\n\nexport interface UseSnapshotPreviewReturn {\n snapshotHistoryInstance: Ref<UseSnapshotHistoryReturn | null>;\n previewingSnapshot: Ref<TemplateSnapshot | null>;\n contentBeforePreview: Ref<TemplateContent | null>;\n isPreviewingSnapshot: ComputedRef<boolean>;\n snapshotHistorySnapshots: ComputedRef<TemplateSnapshot[]>;\n snapshotHistoryIsLoading: ComputedRef<boolean>;\n snapshotHistoryIsRestoring: ComputedRef<boolean>;\n initSnapshotHistory: () => void;\n handleRestore: (template: { content: TemplateContent }) => void;\n handleSnapshotNavigate: (snapshot: TemplateSnapshot) => Promise<void>;\n confirmRestoreSnapshot: () => Promise<void>;\n cancelPreview: () => void;\n loadSnapshotHistory: () => Promise<void>;\n}\n\nexport function useSnapshotPreview(\n options: UseSnapshotPreviewOptions,\n): UseSnapshotPreviewReturn {\n const { authManager, editor, history, conditionPreview, autoSave, onError } =\n options;\n\n const snapshotHistoryInstance = shallowRef<UseSnapshotHistoryReturn | null>(\n null,\n );\n const previewingSnapshot = ref<TemplateSnapshot | null>(null);\n const contentBeforePreview = ref<TemplateContent | null>(null);\n\n // Per CLAUDE.md, async functions must guard against post-unmount execution\n // after every `await` so we don't write to dead refs or fire side effects\n // (autoSave.pause, setContent) on a torn-down component.\n let destroyed = false;\n onScopeDispose(() => {\n destroyed = true;\n });\n\n const isPreviewingSnapshot = computed(\n () => previewingSnapshot.value !== null,\n );\n const snapshotHistorySnapshots = computed(\n () => snapshotHistoryInstance.value?.snapshots.value ?? [],\n );\n const snapshotHistoryIsLoading = computed(\n () => snapshotHistoryInstance.value?.isLoading.value ?? false,\n );\n const snapshotHistoryIsRestoring = computed(\n () => snapshotHistoryInstance.value?.isRestoring.value ?? false,\n );\n\n function initSnapshotHistory(): void {\n if (editor.state.template?.id && !snapshotHistoryInstance.value) {\n snapshotHistoryInstance.value = useSnapshotHistory({\n authManager,\n templateId: editor.state.template.id,\n onRestore: handleRestore,\n onError,\n });\n snapshotHistoryInstance.value.loadSnapshots();\n }\n }\n\n function handleRestore(template: { content: TemplateContent }): void {\n editor.setContent(template.content, false);\n history.clear();\n conditionPreview.reset();\n }\n\n async function handleSnapshotNavigate(\n snapshot: TemplateSnapshot,\n ): Promise<void> {\n if (destroyed) return;\n\n if (previewingSnapshot.value) {\n previewingSnapshot.value = snapshot;\n editor.setContent(snapshot.content, false);\n return;\n }\n\n if (editor.state.isDirty && editor.hasTemplate()) {\n await editor.createSnapshot();\n if (destroyed) return;\n }\n\n contentBeforePreview.value = structuredClone(editor.content.value);\n\n autoSave?.pause();\n previewingSnapshot.value = snapshot;\n editor.setContent(snapshot.content, false);\n }\n\n async function confirmRestoreSnapshot(): Promise<void> {\n if (!previewingSnapshot.value || !snapshotHistoryInstance.value) return;\n\n try {\n await snapshotHistoryInstance.value.restoreSnapshot(\n previewingSnapshot.value.id,\n );\n if (destroyed) return;\n await snapshotHistoryInstance.value.loadSnapshots();\n if (destroyed) return;\n } catch (error) {\n // Restore failed. The editor is still showing the previewed snapshot\n // content (set in handleSnapshotNavigate), so roll back to the\n // pre-preview content before the finally discards the backup — otherwise\n // the user is silently left editing the un-restored snapshot with the\n // banner gone, and the next autosave persists the wrong content.\n if (!destroyed && contentBeforePreview.value) {\n editor.setContent(contentBeforePreview.value, false);\n }\n throw error;\n } finally {\n if (!destroyed) {\n previewingSnapshot.value = null;\n contentBeforePreview.value = null;\n autoSave?.resume();\n }\n }\n }\n\n function cancelPreview(): void {\n if (!previewingSnapshot.value || !contentBeforePreview.value) return;\n\n editor.setContent(contentBeforePreview.value, false);\n\n previewingSnapshot.value = null;\n contentBeforePreview.value = null;\n\n autoSave?.resume();\n }\n\n async function loadSnapshotHistory(): Promise<void> {\n if (destroyed) return;\n if (snapshotHistoryInstance.value) {\n await snapshotHistoryInstance.value.loadSnapshots();\n }\n }\n\n return {\n snapshotHistoryInstance,\n previewingSnapshot,\n contentBeforePreview,\n isPreviewingSnapshot,\n snapshotHistorySnapshots,\n snapshotHistoryIsLoading,\n snapshotHistoryIsRestoring,\n initSnapshotHistory,\n handleRestore,\n handleSnapshotNavigate,\n confirmRestoreSnapshot,\n cancelPreview,\n loadSnapshotHistory,\n };\n}\n","import { computed, ref, type ComputedRef, type Ref } from \"vue\";\nimport { onClickOutside } from \"@vueuse/core\";\nimport type { AiFeature } from \"../components/AiFeatureMenu.vue\";\nimport type { MediaCategory } from \"@templatical/media-library\";\n\nexport interface UseCloudPanelStateReturn {\n activePanel: Ref<RightPanel | null>;\n aiChatOpen: ComputedRef<boolean> & { value: boolean };\n scoringPanelOpen: ComputedRef<boolean> & { value: boolean };\n designReferenceOpen: ComputedRef<boolean> & { value: boolean };\n commentsOpen: ComputedRef<boolean> & { value: boolean };\n testEmailModalOpen: Ref<boolean>;\n mediaLibraryOpen: Ref<boolean>;\n mediaLibraryAccept: Ref<MediaCategory[] | undefined>;\n aiMenuOpen: Ref<boolean>;\n aiMenuRef: Ref<HTMLElement | null>;\n rightPanelOpen: ComputedRef<boolean>;\n activeAiFeature: ComputedRef<AiFeature | null>;\n aiButtonActive: ComputedRef<boolean>;\n toggleAiMenu: () => void;\n handleAiFeatureSelect: (feature: AiFeature) => void;\n}\n\ntype RightPanel = \"ai-chat\" | \"scoring\" | \"design-reference\" | \"comments\";\n\nexport function useCloudPanelState(): UseCloudPanelStateReturn {\n const activePanel = ref<RightPanel | null>(null);\n\n const aiChatOpen = computed({\n get: () => activePanel.value === \"ai-chat\",\n set: (v) => (activePanel.value = v ? \"ai-chat\" : null),\n });\n const scoringPanelOpen = computed({\n get: () => activePanel.value === \"scoring\",\n set: (v) => (activePanel.value = v ? \"scoring\" : null),\n });\n const designReferenceOpen = computed({\n get: () => activePanel.value === \"design-reference\",\n set: (v) => (activePanel.value = v ? \"design-reference\" : null),\n });\n const commentsOpen = computed({\n get: () => activePanel.value === \"comments\",\n set: (v) => (activePanel.value = v ? \"comments\" : null),\n });\n\n const testEmailModalOpen = ref(false);\n const mediaLibraryOpen = ref(false);\n const mediaLibraryAccept = ref<MediaCategory[] | undefined>(undefined);\n const aiMenuOpen = ref(false);\n const aiMenuRef = ref<HTMLElement | null>(null);\n\n const rightPanelOpen = computed(() => activePanel.value !== null);\n\n const activeAiFeature = computed<AiFeature | null>(() => {\n const p = activePanel.value;\n if (p === \"ai-chat\" || p === \"design-reference\" || p === \"scoring\")\n return p;\n return null;\n });\n\n const aiButtonActive = computed(\n () =>\n aiMenuOpen.value ||\n activePanel.value === \"ai-chat\" ||\n activePanel.value === \"design-reference\" ||\n activePanel.value === \"scoring\",\n );\n\n function toggleAiMenu(): void {\n aiMenuOpen.value = !aiMenuOpen.value;\n }\n\n function handleAiFeatureSelect(feature: AiFeature): void {\n aiMenuOpen.value = false;\n activePanel.value = activePanel.value === feature ? null : feature;\n }\n\n onClickOutside(aiMenuRef, () => {\n aiMenuOpen.value = false;\n });\n\n return {\n activePanel,\n aiChatOpen,\n scoringPanelOpen,\n designReferenceOpen,\n commentsOpen,\n testEmailModalOpen,\n mediaLibraryOpen,\n mediaLibraryAccept,\n aiMenuOpen,\n aiMenuRef,\n rightPanelOpen,\n activeAiFeature,\n aiButtonActive,\n toggleAiMenu,\n handleAiFeatureSelect,\n };\n}\n","import { type ComputedRef, type Ref, ref } from \"vue\";\nimport { useTimeoutFn } from \"@vueuse/core\";\nimport { COLLAB_UNDO_WARNING_MS } from \"../../constants/timeouts\";\n\nexport interface UseCollabUndoWarningOptions {\n /** Whether collaboration is currently enabled (reactive). */\n isCollaborationEnabled: ComputedRef<boolean>;\n /** Returns the current list of collaborators. */\n getCollaboratorCount: () => number;\n /** Whether the history stack has entries to undo. */\n canUndo: ComputedRef<boolean>;\n}\n\nexport interface UseCollabUndoWarningReturn {\n collabUndoWarningVisible: Ref<boolean>;\n showCollabUndoWarning: () => void;\n}\n\nexport function useCollabUndoWarning(\n options: UseCollabUndoWarningOptions,\n): UseCollabUndoWarningReturn {\n const { isCollaborationEnabled, getCollaboratorCount, canUndo } = options;\n\n const collabUndoWarningFired = ref(false);\n const collabUndoWarningVisible = ref(false);\n\n const { start: startCollabUndoWarningTimeout } = useTimeoutFn(\n () => {\n collabUndoWarningVisible.value = false;\n },\n COLLAB_UNDO_WARNING_MS,\n { immediate: false },\n );\n\n function showCollabUndoWarning(): void {\n if (\n collabUndoWarningFired.value ||\n !isCollaborationEnabled.value ||\n getCollaboratorCount() === 0 ||\n !canUndo.value\n ) {\n return;\n }\n\n collabUndoWarningFired.value = true;\n collabUndoWarningVisible.value = true;\n startCollabUndoWarningTimeout();\n }\n\n return {\n collabUndoWarningVisible,\n showCollabUndoWarning,\n };\n}\n","import { computed, ref, type ComputedRef, type Ref } from \"vue\";\nimport { useTimeoutFn } from \"@vueuse/core\";\nimport type {\n UsePlanConfigReturn,\n UseAiConfigReturn,\n} from \"@templatical/core/cloud\";\n\nexport interface UseCloudFeatureFlagsOptions {\n planConfigInstance: UsePlanConfigReturn;\n aiConfig: UseAiConfigReturn;\n editor: {\n state: {\n readonly template?: { id: string } | null;\n };\n };\n}\n\nexport interface UseCloudFeatureFlagsReturn {\n canUseAiGeneration: ComputedRef<boolean>;\n canSendTestEmail: ComputedRef<boolean>;\n hasTemplateSaved: ComputedRef<boolean>;\n isWhiteLabeled: ComputedRef<boolean>;\n templateLimit: ComputedRef<number | null>;\n templateCount: ComputedRef<number>;\n isSaveExporting: Ref<boolean>;\n saveStatus: Ref<\"idle\" | \"saved\" | \"error\">;\n saveErrorMessage: Ref<string>;\n startSaveStatusClear: () => void;\n}\n\nexport function useCloudFeatureFlags(\n options: UseCloudFeatureFlagsOptions,\n): UseCloudFeatureFlagsReturn {\n const { planConfigInstance, aiConfig, editor } = options;\n\n const canUseAiGeneration = computed(\n () =>\n planConfigInstance.hasFeature(\"ai_generation\") &&\n aiConfig.hasAnyMenuFeature.value,\n );\n const canSendTestEmail = computed(() =>\n planConfigInstance.hasFeature(\"test_email\"),\n );\n const hasTemplateSaved = computed(() => !!editor.state.template?.id);\n const isWhiteLabeled = computed(() =>\n planConfigInstance.hasFeature(\"white_label\"),\n );\n const templateLimit = computed(\n () => planConfigInstance.config.value?.limits.max_templates ?? null,\n );\n const templateCount = computed(\n () => planConfigInstance.config.value?.template_count ?? 0,\n );\n\n const isSaveExporting = ref(false);\n const saveStatus = ref<\"idle\" | \"saved\" | \"error\">(\"idle\");\n const saveErrorMessage = ref(\"\");\n\n const { start: startSaveStatusClear } = useTimeoutFn(\n () => {\n saveStatus.value = \"idle\";\n },\n 3000,\n { immediate: false },\n );\n\n return {\n canUseAiGeneration,\n canSendTestEmail,\n hasTemplateSaved,\n isWhiteLabeled,\n templateLimit,\n templateCount,\n isSaveExporting,\n saveStatus,\n saveErrorMessage,\n startSaveStatusClear,\n };\n}\n","import { onScopeDispose, type Ref } from \"vue\";\nimport type {\n MediaCategory,\n MediaConfig,\n MediaItem,\n MediaRequestContext,\n} from \"@templatical/media-library\";\nimport type { AuthManager } from \"@templatical/core/cloud\";\nimport type { MediaResult } from \"@templatical/types\";\n\nexport interface UseCloudMediaLibraryOptions {\n onRequestMedia?: (context: MediaRequestContext) => Promise<MediaItem | null>;\n mediaLibraryOpen: Ref<boolean>;\n mediaLibraryAccept: Ref<MediaCategory[] | undefined>;\n /** Auth used by the built-in drag-and-drop upload (#229). */\n authManager: AuthManager;\n /**\n * Active plan's media config, read at upload time for a client-side\n * pre-check (MIME + size) before hitting the network. Returns `null` until\n * the plan config has loaded; the server stays the authoritative validator.\n */\n getMediaConfig?: () => MediaConfig | null;\n /** Surface upload/validation failures to the consumer's error handler. */\n onError?: (error: Error) => void;\n}\n\nexport interface UseCloudMediaLibraryReturn {\n handleRequestMedia: (\n context?: MediaRequestContext,\n ) => Promise<MediaResult | null>;\n handleMediaSelect: (item: MediaItem) => void;\n handleMediaLibraryClose: () => void;\n}\n\nexport function useCloudMediaLibrary(\n options: UseCloudMediaLibraryOptions,\n): UseCloudMediaLibraryReturn {\n const {\n onRequestMedia,\n mediaLibraryOpen,\n mediaLibraryAccept,\n authManager,\n getMediaConfig,\n onError,\n } = options;\n\n let mediaResolve: ((result: MediaResult | null) => void) | null = null;\n\n function toMediaResult(item: MediaItem): MediaResult {\n return { url: item.url, alt: item.alt_text || undefined };\n }\n\n async function handleRequestMedia(\n context?: MediaRequestContext,\n ): Promise<MediaResult | null> {\n const accept = context?.accept ?? [\"images\"];\n\n // Drag-and-drop upload path (#229). A dropped file is forwarded to a\n // consumer handler if one is configured; otherwise it's uploaded directly\n // to the cloud and the resulting media item becomes the block's image.\n if (context?.files?.length) {\n if (onRequestMedia) {\n const item = await onRequestMedia({ accept, files: context.files });\n return item ? toMediaResult(item) : null;\n }\n return uploadDroppedFile(context.files[0]);\n }\n\n // If consumer provides a custom media handler, use it.\n if (onRequestMedia) {\n const item = await onRequestMedia({ accept });\n return item ? toMediaResult(item) : null;\n }\n\n // Otherwise open the built-in media library. If a previous request\n // is still pending (e.g. consumer fired two requests back-to-back),\n // settle it with null so its caller doesn't hang forever.\n if (mediaResolve) {\n mediaResolve(null);\n mediaResolve = null;\n }\n mediaLibraryAccept.value = accept;\n mediaLibraryOpen.value = true;\n return new Promise<MediaResult | null>((resolve) => {\n mediaResolve = (result) => {\n resolve(result);\n };\n });\n }\n\n async function uploadDroppedFile(file: File): Promise<MediaResult | null> {\n const validationError = validateFile(file);\n if (validationError) {\n onError?.(validationError);\n return null;\n }\n try {\n // media-library is an optional, cloud-only peer — import lazily so OSS\n // bundles never pull it in. Cloud consumers always have it installed.\n const { MediaApiClient } = await import(\"@templatical/media-library\");\n const item = await new MediaApiClient(authManager).uploadMedia(file);\n return toMediaResult(item);\n } catch (error) {\n onError?.(error as Error);\n return null;\n }\n }\n\n function validateFile(file: File): Error | null {\n const media = getMediaConfig?.() ?? null;\n if (!media) return null; // config not loaded yet → defer to server.\n const acceptedTypes = media.categories?.images?.mime_types ?? [];\n if (acceptedTypes.length > 0 && !acceptedTypes.includes(file.type)) {\n return new Error(\n `Unsupported image type: ${file.type || \"unknown\"}. Accepted: ${acceptedTypes.join(\", \")}.`,\n );\n }\n if (media.max_file_size > 0 && file.size > media.max_file_size) {\n return new Error(\n `Image is too large (${file.size} bytes). Maximum allowed is ${media.max_file_size} bytes.`,\n );\n }\n return null;\n }\n\n function handleMediaSelect(item: MediaItem): void {\n mediaLibraryOpen.value = false;\n mediaResolve?.(toMediaResult(item));\n mediaResolve = null;\n }\n\n function handleMediaLibraryClose(): void {\n mediaLibraryOpen.value = false;\n mediaResolve?.(null);\n mediaResolve = null;\n }\n\n onScopeDispose(() => {\n if (mediaResolve) {\n mediaResolve(null);\n mediaResolve = null;\n }\n });\n\n return {\n handleRequestMedia,\n handleMediaSelect,\n handleMediaLibraryClose,\n };\n}\n","import { computed, provide, ref, watch, type ComputedRef, type Ref } from \"vue\";\nimport {\n AuthManager,\n performHealthCheck,\n useAiConfig,\n useCollaboration,\n useCollaborationBroadcast,\n useCommentListener,\n useComments,\n useEditor,\n useExport,\n useMcpListener,\n usePlanConfig,\n useSavedModules,\n useTemplateScoring,\n useTestEmail,\n useWebSocket,\n type UseAiConfigReturn,\n type UseCollaborationReturn,\n type UseCommentsReturn,\n type UseExportReturn,\n type UsePlanConfigReturn,\n type UseSavedModulesReturn,\n type UseTemplateScoringReturn,\n type UseTestEmailReturn,\n type UseWebSocketReturn,\n type UseEditorReturn as CloudUseEditorReturn,\n} from \"@templatical/core/cloud\";\nimport type {\n McpOperationPayload,\n ThemeOverrides,\n UiTheme,\n} from \"@templatical/types\";\n\nimport {\n useEditorCore,\n type UseEditorCoreReturn,\n} from \"../../composables/useEditorCore\";\nimport { resolveLintOptions } from \"../../utils/resolveLintOptions\";\nimport { useDragDrop } from \"../../composables/useDragDrop\";\nimport type { UseFontsReturn } from \"../../composables/useFonts\";\nimport type { Translations } from \"../../i18n\";\nimport type { EditorCapabilities } from \"../../types/editor-capabilities\";\nimport {\n ON_REQUEST_MEDIA_KEY,\n AUTH_MANAGER_KEY,\n AI_CONFIG_KEY,\n COMMENTS_KEY,\n SAVED_MODULES_HEADLESS_KEY,\n SCORING_KEY,\n CAPABILITIES_KEY,\n} from \"../../keys\";\nimport { DEFAULT_AUTO_SAVE_DEBOUNCE_MS } from \"../../constants/timeouts\";\nimport { logger } from \"../../utils/logger\";\n\nimport {\n useSnapshotPreview,\n type UseSnapshotPreviewReturn,\n} from \"./useSnapshotPreview\";\nimport {\n useCloudPanelState,\n type UseCloudPanelStateReturn,\n} from \"./useCloudPanelState\";\nimport { useCollabUndoWarning } from \"./useCollabUndoWarning\";\nimport {\n useCloudFeatureFlags,\n type UseCloudFeatureFlagsReturn,\n} from \"./useCloudFeatureFlags\";\nimport {\n useCloudMediaLibrary,\n type UseCloudMediaLibraryReturn,\n} from \"./useCloudMediaLibrary\";\n\nimport type { TemplaticalCloudEditorConfig } from \"../cloudConfig\";\n\n/** Minimal interface of the CommentsSidebar-filter target. */\ninterface CommentsSidebarInstance {\n filterByBlock: (blockId: string) => void;\n}\n\n/** Getter for the target — evaluated lazily so the sidebar can mount later. */\ntype CommentsSidebarGetter = () => CommentsSidebarInstance | null;\n\ntype CollaborationInstance = UseCollaborationReturn & {\n _broadcastOperation: (payload: McpOperationPayload) => void;\n _isProcessingRemoteOperation: () => boolean;\n};\n\nexport interface UseCloudInitializationOptions {\n config: TemplaticalCloudEditorConfig;\n translations: Translations;\n fontsManager: UseFontsReturn;\n emit: (event: \"ready\") => void;\n /** Lazy getter for the CommentsSidebar-filter target (for block-filter). */\n getCommentsSidebar: CommentsSidebarGetter;\n /**\n * Effective DOM root passed through to `useEditorCore`. Set when the\n * cloud editor is mounted inside a shadow root (`shadowDom: true`).\n */\n editorRoot?: Document | ShadowRoot;\n /**\n * Outer `.tpl` container ref forwarded to `useEditorCore` for\n * multi-editor keyboard routing.\n */\n containerEl?: Ref<HTMLElement | null>;\n}\n\nexport interface UseCloudInitializationReturn {\n // Init state\n isInitializing: Ref<boolean>;\n isAuthReady: Ref<boolean>;\n initError: Ref<Error | null>;\n isDestroyed: () => boolean;\n\n // Infrastructure\n authManager: AuthManager;\n planConfigInstance: UsePlanConfigReturn;\n websocket: UseWebSocketReturn;\n collaboration: CollaborationInstance | null;\n isCollaborationEnabled: ComputedRef<boolean>;\n\n // Editor + core\n editor: CloudUseEditorReturn;\n core: UseEditorCoreReturn;\n\n // Cloud composables\n aiConfig: UseAiConfigReturn;\n featureFlags: UseCloudFeatureFlagsReturn;\n mediaLib: UseCloudMediaLibraryReturn;\n exporter: UseExportReturn;\n testEmail: UseTestEmailReturn;\n commentsInstance: UseCommentsReturn;\n savedModulesHeadless: UseSavedModulesReturn;\n scoringInstance: UseTemplateScoringReturn;\n panelState: UseCloudPanelStateReturn;\n snapshotPreview: UseSnapshotPreviewReturn;\n collabWarning: ReturnType<typeof useCollabUndoWarning>;\n\n // Local UI state surfaced through capabilities\n showSaveModuleDialog: Ref<boolean>;\n showModuleBrowserModal: Ref<boolean>;\n saveModulePreSelectedBlockId: Ref<string | null>;\n\n // Late-bound save hook — set by `useCloudLifecycle` after it wires saveTemplate.\n // The `onSave` keyboard shortcut + `useEditorCore` autoSave both route here.\n onSaveHook: { value: (() => Promise<unknown>) | null };\n\n // Methods\n initialize: () => Promise<void>;\n destroy: () => void;\n setThemeOverrides: (overrides: ThemeOverrides) => void;\n setUiTheme: (theme: UiTheme) => void;\n openCommentsForBlock: (blockId: string) => void;\n}\n\n/**\n * Owns the entire CloudEditor.vue initialization dance:\n * 1. AuthManager + PlanConfig\n * 2. Collaboration locked-blocks forward-ref\n * 3. Cloud editor\n * 4. WebSocket + MCP listener\n * 5. Collaboration (wraps editor methods — MUST precede useEditorCore)\n * 6. useEditorCore (provides all shared keys)\n * 7. Collab undo warning (needs core.history.canUndo)\n * 8. Snapshot preview (needs core.autoSave)\n * 9. Remaining cloud composables (aiConfig, exporter, testEmail, etc.)\n * 10. Cloud-only provides (including CAPABILITIES_KEY override)\n *\n * Forward-ref pattern for `snapshotPreview` / `collabWarning` is contained\n * here instead of leaking to the parent.\n */\nexport function useCloudInitialization(\n options: UseCloudInitializationOptions,\n): UseCloudInitializationReturn {\n const { config, translations, fontsManager, emit, getCommentsSidebar } =\n options;\n\n // --- Init state ---\n const isInitializing = ref(true);\n const isAuthReady = ref(false);\n const initError = ref<Error | null>(null);\n let _destroyed = false;\n\n // --- Late-bound save hook (filled in by useCloudLifecycle) ---\n const onSaveHook: { value: (() => Promise<unknown>) | null } = {\n value: null,\n };\n\n // --- Forward refs for circular composable dependencies ---\n let snapshotPreviewRef: UseSnapshotPreviewReturn | null = null;\n let collabWarningRef: ReturnType<typeof useCollabUndoWarning> | null = null;\n\n // --- 1. AuthManager + PlanConfig ---\n const authManager = new AuthManager({\n ...config.auth,\n onError: config.onError,\n });\n\n const planConfigInstance = usePlanConfig({\n authManager,\n onError: config.onError,\n });\n\n // --- 2. Collaboration locked blocks ref (forward-declared for step 3) ---\n const collaborationLockedBlocks = ref<Map<string, unknown>>(new Map());\n\n // --- 3. Cloud editor ---\n const editor = useEditor({\n authManager,\n defaultFontFamily: config.fonts?.defaultFont,\n templateDefaults: config.templateDefaults,\n onError: config.onError,\n lockedBlocks: collaborationLockedBlocks,\n });\n\n // --- 4. WebSocket + MCP listener ---\n const websocket = useWebSocket({\n authManager,\n onError: config.onError,\n });\n\n if (config.mcp?.enabled) {\n useMcpListener({\n editor,\n channel: websocket.channel,\n onOperation: config.mcp.onOperation,\n });\n }\n\n // --- 5. Collaboration (MUST precede useEditorCore) ---\n //\n // Order: `useCollaborationBroadcast` wraps editor mutation methods so they\n // broadcast to peers. Step 6's `useHistoryInterceptor` then wraps them\n // AGAIN to push history entries. Reversing would push history for remote\n // operations, causing local/remote state drift.\n let collaboration: CollaborationInstance | null = null;\n\n if (config.collaboration?.enabled) {\n collaboration = useCollaboration({\n authManager,\n editor,\n channel: websocket.channel,\n onError: config.onError,\n onCollaboratorJoined: config.collaboration.onCollaboratorJoined,\n onCollaboratorLeft: config.collaboration.onCollaboratorLeft,\n onBlockLocked: config.collaboration.onBlockLocked,\n onBlockUnlocked: config.collaboration.onBlockUnlocked,\n }) as CollaborationInstance;\n\n watch(\n () => collaboration!.lockedBlocks.value,\n (newLockedBlocks) => {\n collaborationLockedBlocks.value = newLockedBlocks;\n },\n { immediate: true },\n );\n\n useCollaborationBroadcast(editor, collaboration);\n }\n\n const isCollaborationEnabled = computed(\n () =>\n !!config.collaboration?.enabled &&\n planConfigInstance.hasFeature(\"collaboration\"),\n );\n\n // --- 6. useEditorCore ---\n const core = useEditorCore({\n editor,\n config: {\n uiTheme: config.uiTheme,\n theme: undefined, // applied in initialize() after plan check\n blockDefaults: config.blockDefaults,\n customBlocks: [], // deferred to initialize()\n paletteBlocks: config.paletteBlocks,\n mergeTags: config.mergeTags,\n logicTags: config.logicTags,\n displayConditions: config.displayConditions,\n onRequestMedia: null, // cloud handles via mediaLib.handleRequestMedia\n lint: resolveLintOptions(config),\n onSave: () => {\n onSaveHook.value?.().catch((err) => {\n config.onError?.(err as Error);\n });\n },\n },\n translations,\n fontsManager,\n historyOptions: collaboration\n ? {\n isRemoteOperation: () =>\n collaboration!._isProcessingRemoteOperation(),\n }\n : undefined,\n autoSaveOptions: {\n onChange: async () => {\n if (editor.hasTemplate()) {\n await editor.createSnapshot();\n snapshotPreviewRef?.snapshotHistoryInstance.value?.loadSnapshots();\n }\n },\n debounce: config.autoSaveDebounce ?? DEFAULT_AUTO_SAVE_DEBOUNCE_MS,\n enabled: () =>\n config.autoSave !== false && planConfigInstance.hasFeature(\"auto_save\"),\n },\n themeExtraStyles: () => ({\n \"--tpl-drop-text\": `\"${translations.canvas.dropHere}\"`,\n }),\n keyboardOptions: {\n onBeforeUndo: () => collabWarningRef?.showCollabUndoWarning(),\n },\n editorRoot: options.editorRoot,\n containerEl: options.containerEl,\n });\n\n // --- 7. Collab undo warning ---\n const collabWarning = useCollabUndoWarning({\n isCollaborationEnabled,\n getCollaboratorCount: () => collaboration?.collaborators.value.length ?? 0,\n canUndo: core.history.canUndo,\n });\n collabWarningRef = collabWarning;\n\n // --- 8. Snapshot preview ---\n const snapshotPreview = useSnapshotPreview({\n authManager,\n editor,\n history: core.history,\n conditionPreview: core.conditionPreview,\n autoSave: core.autoSave,\n onError: config.onError,\n });\n snapshotPreviewRef = snapshotPreview;\n\n // --- 9. Remaining cloud composables ---\n const panelState = useCloudPanelState();\n const aiConfig = useAiConfig(config.ai);\n\n const featureFlags = useCloudFeatureFlags({\n planConfigInstance,\n aiConfig,\n editor,\n });\n\n const mediaLib = useCloudMediaLibrary({\n onRequestMedia: config.onRequestMedia,\n mediaLibraryOpen: panelState.mediaLibraryOpen,\n mediaLibraryAccept: panelState.mediaLibraryAccept,\n authManager,\n getMediaConfig: () => planConfigInstance.config.value?.media ?? null,\n onError: config.onError,\n });\n\n // Install drag-drop listeners (no return value needed).\n useDragDrop({\n onBlockMove: editor.moveBlock,\n onBlockAdd: editor.addBlock,\n });\n\n const exporter = useExport({\n authManager,\n getFontsConfig: () => config.fonts,\n canUseCustomFonts: () => planConfigInstance.hasFeature(\"custom_fonts\"),\n });\n\n const testEmail = useTestEmail({\n authManager,\n getTemplateId: () => editor.state.template?.id ?? null,\n save: () => editor.save(),\n exportHtml: (templateId: string) => exporter.exportHtml(templateId),\n onError: config.onError,\n isAuthReady,\n onBeforeTestEmail: config.onBeforeTestEmail,\n });\n\n const commentsInstance = useComments({\n authManager,\n getTemplateId: () => editor.state.template?.id ?? null,\n getSocketId: () => websocket.getSocketId(),\n onComment: config.onComment,\n onError: config.onError,\n isAuthReady,\n hasCommentingFeature: () =>\n config.commenting !== false &&\n planConfigInstance.hasFeature(\"commenting\"),\n });\n\n useCommentListener({\n comments: commentsInstance,\n channel: websocket.channel,\n });\n\n const savedModulesHeadless = useSavedModules({\n authManager,\n onError: config.onError,\n });\n const showSaveModuleDialog = ref(false);\n const saveModulePreSelectedBlockId = ref<string | null>(null);\n const showModuleBrowserModal = ref(false);\n\n const scoringInstance = useTemplateScoring({\n authManager,\n getTemplateId: () => editor.state.template?.id ?? null,\n });\n\n // --- Comments block-filter bridge ---\n function openCommentsForBlock(blockId: string): void {\n panelState.commentsOpen.value = true;\n // Sidebar may not be mounted yet (async component); defer look-up.\n queueMicrotask(() => {\n getCommentsSidebar()?.filterByBlock(blockId);\n });\n }\n\n // --- 10. Cloud-only provides ---\n provide(ON_REQUEST_MEDIA_KEY, mediaLib.handleRequestMedia);\n provide(AUTH_MANAGER_KEY, authManager);\n provide(AI_CONFIG_KEY, aiConfig);\n provide(COMMENTS_KEY, commentsInstance);\n provide(SAVED_MODULES_HEADLESS_KEY, savedModulesHeadless);\n provide(SCORING_KEY, scoringInstance);\n\n // Override default capabilities from useEditorCore with cloud capabilities.\n provide(CAPABILITIES_KEY, {\n plan: planConfigInstance,\n ai: aiConfig,\n comments: {\n getBlockCount: (blockId: string) =>\n commentsInstance.commentCountByBlock.value.get(blockId) ?? 0,\n openForBlock: openCommentsForBlock,\n },\n savedModules: {\n openSaveDialog: (blockId: string) => {\n saveModulePreSelectedBlockId.value = blockId ?? null;\n showSaveModuleDialog.value = true;\n },\n openBrowser: () => {\n showModuleBrowserModal.value = true;\n },\n moduleCount: computed(() => savedModulesHeadless.modules.value.length),\n },\n } satisfies EditorCapabilities);\n\n // --- Theme setters (plan-gated) ---\n function setThemeOverrides(overrides: ThemeOverrides): void {\n if (!planConfigInstance.hasFeature(\"theme_customization\")) return;\n core.themeOverrides.value = overrides;\n }\n\n function setUiTheme(theme: UiTheme): void {\n editor.setUiTheme(theme);\n }\n\n // --- Initialize (async bootstrap) ---\n async function initialize(): Promise<void> {\n isInitializing.value = true;\n initError.value = null;\n\n try {\n await authManager.initialize();\n if (_destroyed) return;\n isAuthReady.value = true;\n\n const healthResult = await performHealthCheck({ authManager });\n if (_destroyed) return;\n\n if (!healthResult.api.ok) {\n throw new Error(\"Health check failed: API is not reachable\");\n }\n\n if (!healthResult.auth.ok) {\n throw new Error(\n `Health check failed: authentication error${healthResult.auth.error ? ` - ${healthResult.auth.error}` : \"\"}`,\n );\n }\n\n if (!healthResult.websocket.ok) {\n logger.warn(\n \"WebSocket health check failed:\",\n healthResult.websocket.error ?? \"unknown error\",\n \"-- real-time features will be disabled.\",\n );\n }\n\n await planConfigInstance.fetchConfig();\n if (_destroyed) return;\n\n fontsManager.setCustomFontsEnabled(\n planConfigInstance.hasFeature(\"custom_fonts\"),\n );\n\n if (\n config.customBlocks?.length &&\n planConfigInstance.hasFeature(\"custom_blocks\")\n ) {\n core.registerCustomBlocks(config.customBlocks);\n }\n\n if (\n config.theme &&\n planConfigInstance.hasFeature(\"theme_customization\")\n ) {\n core.themeOverrides.value = config.theme;\n }\n\n if (\n config.modules !== false &&\n planConfigInstance.hasFeature(\"saved_modules\")\n ) {\n savedModulesHeadless.loadModules();\n }\n\n emit(\"ready\");\n } catch (error) {\n if (_destroyed) return;\n const wrappedError =\n error instanceof Error\n ? error\n : new Error(\"Initialization failed\", { cause: error });\n initError.value = wrappedError;\n config.onError?.(wrappedError);\n } finally {\n if (!_destroyed) {\n isInitializing.value = false;\n }\n }\n }\n\n function destroy(): void {\n _destroyed = true;\n fontsManager.cleanupFontLinks();\n websocket.disconnect();\n core.destroy();\n config.onUnmount?.();\n }\n\n return {\n isInitializing,\n isAuthReady,\n initError,\n isDestroyed: () => _destroyed,\n\n authManager,\n planConfigInstance,\n websocket,\n collaboration,\n isCollaborationEnabled,\n\n editor,\n core,\n\n aiConfig,\n featureFlags,\n mediaLib,\n exporter,\n testEmail,\n commentsInstance,\n savedModulesHeadless,\n scoringInstance,\n panelState,\n snapshotPreview,\n collabWarning,\n\n showSaveModuleDialog,\n showModuleBrowserModal,\n saveModulePreSelectedBlockId,\n\n onSaveHook,\n\n initialize,\n destroy,\n setThemeOverrides,\n setUiTheme,\n openCommentsForBlock,\n };\n}\n","import type { Block, CustomBlock, TemplateContent } from \"@templatical/types\";\nimport { isCustomBlock } from \"@templatical/types\";\nimport type { UseBlockRegistryReturn } from \"../composables/useBlockRegistry\";\n\n/**\n * Renders every custom block in the content tree to its HTML representation\n * and stores the result on `block.renderedHtml`. Called before save so the\n * backend can include custom-block output in its MJML export.\n *\n * Failures per-block are swallowed (and replaced with a comment placeholder)\n * so one broken block doesn't block the save of the rest.\n */\nexport async function preRenderCustomBlocks(\n content: TemplateContent,\n registry: UseBlockRegistryReturn,\n): Promise<void> {\n const renderBlock = async (block: Block): Promise<void> => {\n if (isCustomBlock(block)) {\n const customBlock = block as CustomBlock;\n try {\n customBlock.renderedHtml =\n await registry.renderCustomBlock(customBlock);\n } catch {\n customBlock.renderedHtml = `<!-- Custom block render error: ${customBlock.customType} -->`;\n }\n }\n\n if (block.type === \"section\" && \"children\" in block) {\n const sectionBlock = block as { children: Block[][] };\n for (const column of sectionBlock.children) {\n for (const child of column) {\n await renderBlock(child);\n }\n }\n }\n };\n\n for (const block of content.blocks) {\n await renderBlock(block);\n }\n}\n","import {\n resolveWebSocketConfig,\n type UseExportReturn,\n type UsePlanConfigReturn,\n type UseWebSocketReturn,\n type UseEditorReturn as CloudUseEditorReturn,\n} from \"@templatical/core/cloud\";\nimport type { SaveResult, Template, TemplateContent } from \"@templatical/types\";\n\nimport type { UseEditorCoreReturn } from \"../../composables/useEditorCore\";\nimport { preRenderCustomBlocks } from \"../../utils/preRenderCustomBlocks\";\n\nimport type { UseSnapshotPreviewReturn } from \"./useSnapshotPreview\";\nimport type { UseCloudFeatureFlagsReturn } from \"./useCloudFeatureFlags\";\nimport type { TemplaticalCloudEditorConfig } from \"../cloudConfig\";\n\nexport interface UseCloudLifecycleOptions {\n config: TemplaticalCloudEditorConfig;\n editor: CloudUseEditorReturn;\n websocket: UseWebSocketReturn;\n planConfigInstance: UsePlanConfigReturn;\n snapshotPreview: UseSnapshotPreviewReturn;\n core: UseEditorCoreReturn;\n exporter: UseExportReturn;\n featureFlags: UseCloudFeatureFlagsReturn;\n isDestroyed: () => boolean;\n}\n\nexport interface UseCloudLifecycleReturn {\n createTemplate: (content?: TemplateContent) => Promise<Template>;\n loadTemplate: (templateId: string) => Promise<Template>;\n saveTemplate: () => Promise<SaveResult>;\n}\n\n/**\n * Template-level operations on a cloud editor: create/load/save.\n * Each guards against post-unmount execution via `isDestroyed()`.\n */\nexport function useCloudLifecycle(\n options: UseCloudLifecycleOptions,\n): UseCloudLifecycleReturn {\n const {\n config,\n editor,\n websocket,\n planConfigInstance,\n snapshotPreview,\n core,\n exporter,\n featureFlags,\n isDestroyed,\n } = options;\n\n function getWebSocketConfig() {\n return resolveWebSocketConfig(planConfigInstance.config.value!.websocket);\n }\n\n async function createTemplate(content?: TemplateContent): Promise<Template> {\n const template = await editor.create(content);\n if (isDestroyed()) return template;\n config.onCreate?.(template);\n snapshotPreview.initSnapshotHistory();\n websocket.connect(template.id, getWebSocketConfig());\n return template;\n }\n\n async function loadTemplate(templateId: string): Promise<Template> {\n const template = await editor.load(templateId);\n if (isDestroyed()) return template;\n config.onLoad?.(template);\n snapshotPreview.initSnapshotHistory();\n websocket.connect(template.id, getWebSocketConfig());\n return template;\n }\n\n async function saveTemplate(): Promise<SaveResult> {\n featureFlags.isSaveExporting.value = true;\n featureFlags.saveStatus.value = \"idle\";\n try {\n // Pre-render custom blocks so backend can include them in MJML export.\n await preRenderCustomBlocks(editor.content.value, core.registry);\n if (isDestroyed()) throw new Error(\"Component unmounted during save\");\n\n const template = await editor.save();\n if (isDestroyed()) throw new Error(\"Component unmounted during save\");\n\n snapshotPreview.initSnapshotHistory();\n snapshotPreview.snapshotHistoryInstance.value?.loadSnapshots();\n\n const exportResult = await exporter.exportHtml(template.id);\n if (isDestroyed()) throw new Error(\"Component unmounted during save\");\n\n const saveResult: SaveResult = {\n templateId: template.id,\n html: exportResult.html,\n mjml: exportResult.mjml,\n content: template.content,\n };\n\n config.onSave?.(saveResult);\n\n featureFlags.saveStatus.value = \"saved\";\n featureFlags.startSaveStatusClear();\n\n return saveResult;\n } catch (error) {\n if (!isDestroyed()) {\n featureFlags.saveStatus.value = \"error\";\n featureFlags.saveErrorMessage.value =\n error instanceof Error ? error.message : \"Save failed\";\n }\n throw error;\n } finally {\n if (!isDestroyed()) {\n featureFlags.isSaveExporting.value = false;\n }\n }\n }\n\n return { createTemplate, loadTemplate, saveTemplate };\n}\n","import { computed, ref, type ComputedRef, type Ref } from \"vue\";\nimport type { PlanConfig } from \"@templatical/types\";\nimport type { LintIssue } from \"../../composables/useTemplateLint\";\n\nexport interface UseCloudSaveGateOptions {\n /** Reactive accessibility issues from `useTemplateLint`. */\n issues: Ref<LintIssue[]>;\n /** Reactive plan config from the server. */\n planConfig: Ref<PlanConfig | null>;\n}\n\nexport interface UseCloudSaveGateReturn {\n /** True when the gate would block a save click given current state. */\n shouldBlock: ComputedRef<boolean>;\n /** Errors that would block the save. Empty when `shouldBlock` is false. */\n blockingIssues: ComputedRef<LintIssue[]>;\n /** Modal visibility — toggled by `tryRunSave` and `cancel`. */\n modalOpen: Ref<boolean>;\n /**\n * Wraps a save callback. Returns `true` when the save was invoked\n * (blocking disabled or no errors), `false` when the modal opened\n * instead. Caller can `await` the returned promise to know when the\n * save settled.\n */\n tryRunSave: (run: () => Promise<unknown> | unknown) => Promise<boolean>;\n /** Force-run the pending save, bypassing the gate. */\n confirmAndSave: () => Promise<void>;\n /** Dismiss the modal without saving. */\n cancel: () => void;\n}\n\n/**\n * Cloud-only save-gate. When `planConfig.accessibility.blockOnError === true`\n * and the linter reports any error-severity issues, intercept the save\n * click and surface a confirmation modal listing the blockers. The user\n * can dismiss to fix issues, or click \"Save anyway\" to bypass — the gate\n * does NOT enforce a hard block, it surfaces a deliberate choice.\n *\n * Server policy is the source of truth for `blockOnError`; consumer-side\n * `accessibility` options can't override it.\n */\nexport function useCloudSaveGate(\n opts: UseCloudSaveGateOptions,\n): UseCloudSaveGateReturn {\n const modalOpen = ref(false);\n let pending: (() => Promise<unknown> | unknown) | null = null;\n\n const blockOnError = computed(\n () => opts.planConfig.value?.accessibility?.blockOnError === true,\n );\n\n const blockingIssues = computed(() =>\n blockOnError.value\n ? opts.issues.value.filter((i) => i.severity === \"error\")\n : [],\n );\n\n const shouldBlock = computed(() => blockingIssues.value.length > 0);\n\n async function tryRunSave(\n run: () => Promise<unknown> | unknown,\n ): Promise<boolean> {\n if (!shouldBlock.value) {\n await run();\n return true;\n }\n pending = run;\n modalOpen.value = true;\n return false;\n }\n\n async function confirmAndSave(): Promise<void> {\n const run = pending;\n pending = null;\n modalOpen.value = false;\n if (run) {\n await run();\n }\n }\n\n function cancel(): void {\n pending = null;\n modalOpen.value = false;\n }\n\n return {\n shouldBlock,\n blockingIssues,\n modalOpen,\n tryRunSave,\n confirmAndSave,\n cancel,\n };\n}\n","<script setup lang=\"ts\">\nimport { AlertTriangle } from \"@lucide/vue\";\nimport { useCloudI18nStrict } from \"../../composables/useCloudI18n\";\nimport type { LintIssue } from \"../../composables/useTemplateLint\";\n\ndefineProps<{\n open: boolean;\n issues: LintIssue[];\n}>();\n\nconst emit = defineEmits<{\n (e: \"cancel\"): void;\n (e: \"confirm\"): void;\n}>();\n\nconst { t: cloudT } = useCloudI18nStrict();\n</script>\n\n<template>\n <Transition\n enter-active-class=\"tpl:transition-opacity tpl:duration-150\"\n leave-active-class=\"tpl:transition-opacity tpl:duration-150\"\n enter-from-class=\"tpl:opacity-0\"\n leave-to-class=\"tpl:opacity-0\"\n >\n <div\n v-if=\"open\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-label=\"cloudT.saveGate.title\"\n class=\"tpl:fixed tpl:inset-0 tpl:z-50 tpl:flex tpl:items-center tpl:justify-center tpl:bg-black/40 tpl:p-6\"\n @click.self=\"emit('cancel')\"\n >\n <div\n class=\"tpl:flex tpl:max-h-[80vh] tpl:w-full tpl:max-w-md tpl:flex-col tpl:gap-4 tpl:rounded-lg tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:p-5 tpl:shadow-[var(--tpl-shadow-md)]\"\n >\n <header class=\"tpl:flex tpl:items-center tpl:gap-2\">\n <AlertTriangle\n :size=\"18\"\n :stroke-width=\"2\"\n class=\"tpl:text-[var(--tpl-warning)]\"\n />\n <h2\n class=\"tpl:m-0 tpl:text-base tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ cloudT.saveGate.title }}\n </h2>\n </header>\n\n <p class=\"tpl:m-0 tpl:text-sm tpl:text-[var(--tpl-text-muted)]\">\n {{ cloudT.saveGate.body }}\n </p>\n\n <ul\n class=\"tpl:m-0 tpl:flex tpl:max-h-64 tpl:list-none tpl:flex-col tpl:gap-1.5 tpl:overflow-y-auto tpl:rounded-md tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:p-2\"\n >\n <li\n v-for=\"issue in issues\"\n :key=\"`${issue.ruleId}-${issue.blockId ?? 'template'}`\"\n class=\"tpl:flex tpl:flex-col tpl:gap-0.5 tpl:rounded tpl:px-2 tpl:py-1.5\"\n >\n <span class=\"tpl:text-xs tpl:text-[var(--tpl-text)]\">\n {{ issue.message }}\n </span>\n <span\n class=\"tpl:font-mono tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ issue.ruleId }}\n </span>\n </li>\n </ul>\n\n <footer class=\"tpl:flex tpl:justify-end tpl:gap-2\">\n <button\n type=\"button\"\n class=\"tpl:rounded-md tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:text-[var(--tpl-text)]\"\n @click=\"emit('cancel')\"\n >\n {{ cloudT.saveGate.cancel }}\n </button>\n <button\n type=\"button\"\n class=\"tpl:rounded-md tpl:bg-[var(--tpl-danger)] tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:text-white\"\n @click=\"emit('confirm')\"\n >\n {{ cloudT.saveGate.confirm }}\n </button>\n </footer>\n </div>\n </div>\n </Transition>\n</template>\n","<script setup lang=\"ts\">\nimport { AlertTriangle } from \"@lucide/vue\";\nimport { useCloudI18nStrict } from \"../../composables/useCloudI18n\";\nimport type { LintIssue } from \"../../composables/useTemplateLint\";\n\ndefineProps<{\n open: boolean;\n issues: LintIssue[];\n}>();\n\nconst emit = defineEmits<{\n (e: \"cancel\"): void;\n (e: \"confirm\"): void;\n}>();\n\nconst { t: cloudT } = useCloudI18nStrict();\n</script>\n\n<template>\n <Transition\n enter-active-class=\"tpl:transition-opacity tpl:duration-150\"\n leave-active-class=\"tpl:transition-opacity tpl:duration-150\"\n enter-from-class=\"tpl:opacity-0\"\n leave-to-class=\"tpl:opacity-0\"\n >\n <div\n v-if=\"open\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-label=\"cloudT.saveGate.title\"\n class=\"tpl:fixed tpl:inset-0 tpl:z-50 tpl:flex tpl:items-center tpl:justify-center tpl:bg-black/40 tpl:p-6\"\n @click.self=\"emit('cancel')\"\n >\n <div\n class=\"tpl:flex tpl:max-h-[80vh] tpl:w-full tpl:max-w-md tpl:flex-col tpl:gap-4 tpl:rounded-lg tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:p-5 tpl:shadow-[var(--tpl-shadow-md)]\"\n >\n <header class=\"tpl:flex tpl:items-center tpl:gap-2\">\n <AlertTriangle\n :size=\"18\"\n :stroke-width=\"2\"\n class=\"tpl:text-[var(--tpl-warning)]\"\n />\n <h2\n class=\"tpl:m-0 tpl:text-base tpl:font-semibold tpl:text-[var(--tpl-text)]\"\n >\n {{ cloudT.saveGate.title }}\n </h2>\n </header>\n\n <p class=\"tpl:m-0 tpl:text-sm tpl:text-[var(--tpl-text-muted)]\">\n {{ cloudT.saveGate.body }}\n </p>\n\n <ul\n class=\"tpl:m-0 tpl:flex tpl:max-h-64 tpl:list-none tpl:flex-col tpl:gap-1.5 tpl:overflow-y-auto tpl:rounded-md tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:p-2\"\n >\n <li\n v-for=\"issue in issues\"\n :key=\"`${issue.ruleId}-${issue.blockId ?? 'template'}`\"\n class=\"tpl:flex tpl:flex-col tpl:gap-0.5 tpl:rounded tpl:px-2 tpl:py-1.5\"\n >\n <span class=\"tpl:text-xs tpl:text-[var(--tpl-text)]\">\n {{ issue.message }}\n </span>\n <span\n class=\"tpl:font-mono tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]\"\n >\n {{ issue.ruleId }}\n </span>\n </li>\n </ul>\n\n <footer class=\"tpl:flex tpl:justify-end tpl:gap-2\">\n <button\n type=\"button\"\n class=\"tpl:rounded-md tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:text-[var(--tpl-text)]\"\n @click=\"emit('cancel')\"\n >\n {{ cloudT.saveGate.cancel }}\n </button>\n <button\n type=\"button\"\n class=\"tpl:rounded-md tpl:bg-[var(--tpl-danger)] tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:text-white\"\n @click=\"emit('confirm')\"\n >\n {{ cloudT.saveGate.confirm }}\n </button>\n </footer>\n </div>\n </div>\n </Transition>\n</template>\n","<script setup lang=\"ts\">\nimport {\n Check,\n CircleAlert,\n LoaderCircle,\n MessageCircle,\n Save,\n Send,\n Sparkles,\n} from \"@lucide/vue\";\nimport { defineAsyncComponent } from \"vue\";\nimport type {\n UseCommentsReturn,\n UseTestEmailReturn,\n UseWebSocketReturn,\n UseEditorReturn as CloudUseEditorReturn,\n} from \"@templatical/core/cloud\";\n\nimport type { UseEditorCoreReturn } from \"../../composables/useEditorCore\";\nimport { useCloudI18nStrict } from \"../../composables/useCloudI18n\";\nimport { headerBtnClass } from \"../../constants/styleConstants\";\nimport ViewportToggle from \"../../components/ViewportToggle.vue\";\nimport PreviewToggle from \"../../components/PreviewToggle.vue\";\nimport DarkModeToggle from \"../../components/DarkModeToggle.vue\";\nimport type { UseCloudFeatureFlagsReturn } from \"../composables/useCloudFeatureFlags\";\nimport type { UseCloudPanelStateReturn } from \"../composables/useCloudPanelState\";\nimport type { UseSnapshotPreviewReturn } from \"../composables/useSnapshotPreview\";\nimport type { UseCloudInitializationReturn } from \"../composables/useCloudInitialization\";\n\nconst CollaboratorBar = defineAsyncComponent(\n () => import(\"./CollaboratorBar.vue\"),\n);\nconst SnapshotHistory = defineAsyncComponent(\n () => import(\"./SnapshotHistory.vue\"),\n);\nconst AiFeatureMenu = defineAsyncComponent(() => import(\"./AiFeatureMenu.vue\"));\n\ndefineProps<{\n editor: CloudUseEditorReturn;\n core: UseEditorCoreReturn;\n featureFlags: UseCloudFeatureFlagsReturn;\n panelState: UseCloudPanelStateReturn;\n snapshotPreview: UseSnapshotPreviewReturn;\n commentsInstance: UseCommentsReturn;\n testEmail: UseTestEmailReturn;\n websocket: UseWebSocketReturn;\n collaboration: UseCloudInitializationReturn[\"collaboration\"];\n isCollaborationEnabled: boolean;\n isSaveDisabled: boolean;\n isSaving: boolean;\n}>();\n\ndefineEmits<{\n (e: \"save\"): void;\n}>();\n\nconst { t: cloudT, format: cloudFormat } = useCloudI18nStrict();\n</script>\n\n<template>\n <header\n class=\"tpl-header tpl:absolute tpl:top-0 tpl:right-0 tpl:left-0 tpl:z-50 tpl:grid tpl:h-14 tpl:grid-cols-[1fr_auto_1fr] tpl:items-center tpl:px-4\"\n style=\"\n background-color: color-mix(in srgb, var(--tpl-bg) 80%, transparent);\n backdrop-filter: blur(12px);\n -webkit-backdrop-filter: blur(12px);\n box-shadow: var(--tpl-shadow-md);\n border-bottom: 1px solid var(--tpl-border);\n \"\n >\n <!-- Left: Logo + template count -->\n <div\n class=\"tpl-header-left tpl:flex tpl:min-w-[200px] tpl:items-center tpl:gap-3\"\n >\n <span\n v-if=\"featureFlags.templateLimit.value !== null\"\n class=\"tpl:text-xs tpl:opacity-60 tpl:text-[var(--tpl-text-muted)]\"\n >\n {{\n cloudFormat(cloudT.header.templatesUsed, {\n used: featureFlags.templateCount.value,\n max: featureFlags.templateLimit.value,\n })\n }}\n </span>\n </div>\n\n <!-- Center: viewport + preview + dark mode + collaboration + snapshots -->\n <div\n class=\"tpl-header-center tpl:flex tpl:items-center tpl:justify-center tpl:gap-10\"\n >\n <ViewportToggle\n :viewport=\"editor.state.viewport\"\n @change=\"editor.setViewport\"\n />\n <DarkModeToggle\n :dark-mode=\"editor.state.darkMode\"\n @change=\"editor.setDarkMode\"\n />\n <PreviewToggle\n :preview-mode=\"editor.state.previewMode\"\n @change=\"editor.setPreviewMode\"\n />\n <CollaboratorBar\n v-if=\"collaboration && isCollaborationEnabled\"\n :collaborators=\"collaboration.collaborators.value\"\n :is-connected=\"websocket.isConnected.value\"\n />\n <SnapshotHistory\n v-if=\"snapshotPreview.snapshotHistoryInstance.value\"\n :snapshots=\"snapshotPreview.snapshotHistorySnapshots.value\"\n :is-loading=\"snapshotPreview.snapshotHistoryIsLoading.value\"\n :is-restoring=\"snapshotPreview.snapshotHistoryIsRestoring.value\"\n @load=\"snapshotPreview.loadSnapshotHistory\"\n @navigate=\"snapshotPreview.handleSnapshotNavigate\"\n />\n </div>\n\n <!-- Right: Cloud actions -->\n <div\n class=\"tpl-header-right tpl:flex tpl:min-w-[200px] tpl:items-center tpl:justify-end tpl:gap-3\"\n >\n <!-- Save status indicator -->\n <div\n v-if=\"featureFlags.saveStatus.value === 'error'\"\n aria-live=\"assertive\"\n class=\"tpl-tooltip tpl-status tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-danger)]\"\n :data-tooltip=\"featureFlags.saveErrorMessage.value\"\n >\n <CircleAlert :size=\"12\" :stroke-width=\"2.5\" />\n {{ cloudT.header.saveFailed }}\n </div>\n <div\n v-else-if=\"featureFlags.saveStatus.value === 'saved'\"\n aria-live=\"polite\"\n class=\"tpl-status tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-success)]\"\n >\n <Check :size=\"12\" :stroke-width=\"2.5\" />\n {{ cloudT.header.saved }}\n </div>\n <div\n v-else-if=\"editor.state.isDirty\"\n aria-live=\"polite\"\n class=\"tpl-status tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-text-muted)]\"\n >\n <span\n class=\"tpl-pulse tpl:size-1.5 tpl:rounded-full tpl:bg-[var(--tpl-primary)]\"\n ></span>\n {{ cloudT.header.unsaved }}\n </div>\n\n <!-- Comments button -->\n <button\n v-if=\"\n commentsInstance.isEnabled.value &&\n featureFlags.hasTemplateSaved.value\n \"\n :aria-label=\"\n commentsInstance.unresolvedCount.value > 0\n ? `${cloudT.comments.button} (${commentsInstance.unresolvedCount.value})`\n : cloudT.comments.button\n \"\n :aria-expanded=\"panelState.commentsOpen.value\"\n :class=\"headerBtnClass\"\n :style=\"{\n backgroundColor: panelState.commentsOpen.value\n ? 'var(--tpl-primary)'\n : 'transparent',\n color: panelState.commentsOpen.value\n ? 'var(--tpl-bg)'\n : 'var(--tpl-primary)',\n borderColor: 'var(--tpl-primary)',\n }\"\n @click=\"panelState.commentsOpen.value = !panelState.commentsOpen.value\"\n >\n <MessageCircle :size=\"16\" :stroke-width=\"2\" />\n {{ cloudT.comments.button }}\n <span\n v-if=\"\n commentsInstance.unresolvedCount.value > 0 &&\n !panelState.commentsOpen.value\n \"\n class=\"tpl:inline-flex tpl:size-4.5 tpl:items-center tpl:justify-center tpl:rounded-full tpl:text-[10px] tpl:font-semibold tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]\"\n >\n {{ commentsInstance.unresolvedCount.value }}\n </span>\n </button>\n\n <!-- AI button + menu -->\n <div\n v-if=\"\n featureFlags.canUseAiGeneration.value &&\n featureFlags.hasTemplateSaved.value\n \"\n :ref=\"(el) => (panelState.aiMenuRef.value = el as HTMLElement | null)\"\n class=\"tpl:relative\"\n >\n <button\n :aria-expanded=\"panelState.aiMenuOpen.value\"\n class=\"tpl-ai-btn tpl:inline-flex tpl:items-center tpl:gap-1.5 tpl:rounded-[var(--tpl-radius-sm)] tpl:border-none tpl:px-4 tpl:py-2 tpl:text-sm tpl:font-semibold tpl:whitespace-nowrap tpl:transition-all tpl:duration-200\"\n :class=\"\n panelState.aiButtonActive.value\n ? 'tpl-ai-btn--active'\n : 'tpl-ai-btn--idle'\n \"\n @click.stop=\"panelState.toggleAiMenu\"\n >\n <Sparkles :size=\"16\" :stroke-width=\"2\" class=\"tpl-ai-btn-icon\" />\n {{ cloudT.aiChat.button }}\n </button>\n <Transition\n enter-active-class=\"tpl:transition-all tpl:duration-150 tpl:ease-out\"\n enter-from-class=\"tpl:scale-95 tpl:opacity-0\"\n enter-to-class=\"tpl:scale-100 tpl:opacity-100\"\n leave-active-class=\"tpl:transition-all tpl:duration-100 tpl:ease-in\"\n leave-from-class=\"tpl:scale-100 tpl:opacity-100\"\n leave-to-class=\"tpl:scale-95 tpl:opacity-0\"\n >\n <div\n v-if=\"panelState.aiMenuOpen.value\"\n class=\"tpl:absolute tpl:right-0 tpl:top-full tpl:z-50 tpl:mt-1 tpl:origin-top-right\"\n >\n <AiFeatureMenu\n :active-feature=\"panelState.activeAiFeature.value\"\n @select=\"panelState.handleAiFeatureSelect\"\n />\n </div>\n </Transition>\n </div>\n\n <!-- Test email button -->\n <button\n v-if=\"testEmail.isEnabled.value && featureFlags.canSendTestEmail.value\"\n :class=\"headerBtnClass\"\n style=\"\n background-color: transparent;\n color: var(--tpl-primary);\n border-color: var(--tpl-primary);\n \"\n :disabled=\"\n testEmail.isSending.value || !featureFlags.hasTemplateSaved.value\n \"\n @click=\"panelState.testEmailModalOpen.value = true\"\n >\n <Send v-if=\"!testEmail.isSending.value\" :size=\"16\" :stroke-width=\"2\" />\n <LoaderCircle v-else class=\"tpl-spinner\" :size=\"16\" :stroke-width=\"2\" />\n {{ cloudT.testEmail.button }}\n </button>\n\n <!-- Save button -->\n <button\n :class=\"headerBtnClass\"\n style=\"\n background-color: transparent;\n color: var(--tpl-primary);\n border-color: var(--tpl-primary);\n \"\n :disabled=\"isSaveDisabled\"\n @click=\"$emit('save')\"\n >\n <Save v-if=\"!isSaving\" :size=\"16\" :stroke-width=\"2\" />\n <LoaderCircle v-else class=\"tpl-spinner\" :size=\"16\" :stroke-width=\"2\" />\n {{ isSaving ? cloudT.header.saving : cloudT.header.save }}\n </button>\n </div>\n </header>\n</template>\n","<script setup lang=\"ts\">\nimport {\n Check,\n CircleAlert,\n LoaderCircle,\n MessageCircle,\n Save,\n Send,\n Sparkles,\n} from \"@lucide/vue\";\nimport { defineAsyncComponent } from \"vue\";\nimport type {\n UseCommentsReturn,\n UseTestEmailReturn,\n UseWebSocketReturn,\n UseEditorReturn as CloudUseEditorReturn,\n} from \"@templatical/core/cloud\";\n\nimport type { UseEditorCoreReturn } from \"../../composables/useEditorCore\";\nimport { useCloudI18nStrict } from \"../../composables/useCloudI18n\";\nimport { headerBtnClass } from \"../../constants/styleConstants\";\nimport ViewportToggle from \"../../components/ViewportToggle.vue\";\nimport PreviewToggle from \"../../components/PreviewToggle.vue\";\nimport DarkModeToggle from \"../../components/DarkModeToggle.vue\";\nimport type { UseCloudFeatureFlagsReturn } from \"../composables/useCloudFeatureFlags\";\nimport type { UseCloudPanelStateReturn } from \"../composables/useCloudPanelState\";\nimport type { UseSnapshotPreviewReturn } from \"../composables/useSnapshotPreview\";\nimport type { UseCloudInitializationReturn } from \"../composables/useCloudInitialization\";\n\nconst CollaboratorBar = defineAsyncComponent(\n () => import(\"./CollaboratorBar.vue\"),\n);\nconst SnapshotHistory = defineAsyncComponent(\n () => import(\"./SnapshotHistory.vue\"),\n);\nconst AiFeatureMenu = defineAsyncComponent(() => import(\"./AiFeatureMenu.vue\"));\n\ndefineProps<{\n editor: CloudUseEditorReturn;\n core: UseEditorCoreReturn;\n featureFlags: UseCloudFeatureFlagsReturn;\n panelState: UseCloudPanelStateReturn;\n snapshotPreview: UseSnapshotPreviewReturn;\n commentsInstance: UseCommentsReturn;\n testEmail: UseTestEmailReturn;\n websocket: UseWebSocketReturn;\n collaboration: UseCloudInitializationReturn[\"collaboration\"];\n isCollaborationEnabled: boolean;\n isSaveDisabled: boolean;\n isSaving: boolean;\n}>();\n\ndefineEmits<{\n (e: \"save\"): void;\n}>();\n\nconst { t: cloudT, format: cloudFormat } = useCloudI18nStrict();\n</script>\n\n<template>\n <header\n class=\"tpl-header tpl:absolute tpl:top-0 tpl:right-0 tpl:left-0 tpl:z-50 tpl:grid tpl:h-14 tpl:grid-cols-[1fr_auto_1fr] tpl:items-center tpl:px-4\"\n style=\"\n background-color: color-mix(in srgb, var(--tpl-bg) 80%, transparent);\n backdrop-filter: blur(12px);\n -webkit-backdrop-filter: blur(12px);\n box-shadow: var(--tpl-shadow-md);\n border-bottom: 1px solid var(--tpl-border);\n \"\n >\n <!-- Left: Logo + template count -->\n <div\n class=\"tpl-header-left tpl:flex tpl:min-w-[200px] tpl:items-center tpl:gap-3\"\n >\n <span\n v-if=\"featureFlags.templateLimit.value !== null\"\n class=\"tpl:text-xs tpl:opacity-60 tpl:text-[var(--tpl-text-muted)]\"\n >\n {{\n cloudFormat(cloudT.header.templatesUsed, {\n used: featureFlags.templateCount.value,\n max: featureFlags.templateLimit.value,\n })\n }}\n </span>\n </div>\n\n <!-- Center: viewport + preview + dark mode + collaboration + snapshots -->\n <div\n class=\"tpl-header-center tpl:flex tpl:items-center tpl:justify-center tpl:gap-10\"\n >\n <ViewportToggle\n :viewport=\"editor.state.viewport\"\n @change=\"editor.setViewport\"\n />\n <DarkModeToggle\n :dark-mode=\"editor.state.darkMode\"\n @change=\"editor.setDarkMode\"\n />\n <PreviewToggle\n :preview-mode=\"editor.state.previewMode\"\n @change=\"editor.setPreviewMode\"\n />\n <CollaboratorBar\n v-if=\"collaboration && isCollaborationEnabled\"\n :collaborators=\"collaboration.collaborators.value\"\n :is-connected=\"websocket.isConnected.value\"\n />\n <SnapshotHistory\n v-if=\"snapshotPreview.snapshotHistoryInstance.value\"\n :snapshots=\"snapshotPreview.snapshotHistorySnapshots.value\"\n :is-loading=\"snapshotPreview.snapshotHistoryIsLoading.value\"\n :is-restoring=\"snapshotPreview.snapshotHistoryIsRestoring.value\"\n @load=\"snapshotPreview.loadSnapshotHistory\"\n @navigate=\"snapshotPreview.handleSnapshotNavigate\"\n />\n </div>\n\n <!-- Right: Cloud actions -->\n <div\n class=\"tpl-header-right tpl:flex tpl:min-w-[200px] tpl:items-center tpl:justify-end tpl:gap-3\"\n >\n <!-- Save status indicator -->\n <div\n v-if=\"featureFlags.saveStatus.value === 'error'\"\n aria-live=\"assertive\"\n class=\"tpl-tooltip tpl-status tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-danger)]\"\n :data-tooltip=\"featureFlags.saveErrorMessage.value\"\n >\n <CircleAlert :size=\"12\" :stroke-width=\"2.5\" />\n {{ cloudT.header.saveFailed }}\n </div>\n <div\n v-else-if=\"featureFlags.saveStatus.value === 'saved'\"\n aria-live=\"polite\"\n class=\"tpl-status tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-success)]\"\n >\n <Check :size=\"12\" :stroke-width=\"2.5\" />\n {{ cloudT.header.saved }}\n </div>\n <div\n v-else-if=\"editor.state.isDirty\"\n aria-live=\"polite\"\n class=\"tpl-status tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-text-muted)]\"\n >\n <span\n class=\"tpl-pulse tpl:size-1.5 tpl:rounded-full tpl:bg-[var(--tpl-primary)]\"\n ></span>\n {{ cloudT.header.unsaved }}\n </div>\n\n <!-- Comments button -->\n <button\n v-if=\"\n commentsInstance.isEnabled.value &&\n featureFlags.hasTemplateSaved.value\n \"\n :aria-label=\"\n commentsInstance.unresolvedCount.value > 0\n ? `${cloudT.comments.button} (${commentsInstance.unresolvedCount.value})`\n : cloudT.comments.button\n \"\n :aria-expanded=\"panelState.commentsOpen.value\"\n :class=\"headerBtnClass\"\n :style=\"{\n backgroundColor: panelState.commentsOpen.value\n ? 'var(--tpl-primary)'\n : 'transparent',\n color: panelState.commentsOpen.value\n ? 'var(--tpl-bg)'\n : 'var(--tpl-primary)',\n borderColor: 'var(--tpl-primary)',\n }\"\n @click=\"panelState.commentsOpen.value = !panelState.commentsOpen.value\"\n >\n <MessageCircle :size=\"16\" :stroke-width=\"2\" />\n {{ cloudT.comments.button }}\n <span\n v-if=\"\n commentsInstance.unresolvedCount.value > 0 &&\n !panelState.commentsOpen.value\n \"\n class=\"tpl:inline-flex tpl:size-4.5 tpl:items-center tpl:justify-center tpl:rounded-full tpl:text-[10px] tpl:font-semibold tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]\"\n >\n {{ commentsInstance.unresolvedCount.value }}\n </span>\n </button>\n\n <!-- AI button + menu -->\n <div\n v-if=\"\n featureFlags.canUseAiGeneration.value &&\n featureFlags.hasTemplateSaved.value\n \"\n :ref=\"(el) => (panelState.aiMenuRef.value = el as HTMLElement | null)\"\n class=\"tpl:relative\"\n >\n <button\n :aria-expanded=\"panelState.aiMenuOpen.value\"\n class=\"tpl-ai-btn tpl:inline-flex tpl:items-center tpl:gap-1.5 tpl:rounded-[var(--tpl-radius-sm)] tpl:border-none tpl:px-4 tpl:py-2 tpl:text-sm tpl:font-semibold tpl:whitespace-nowrap tpl:transition-all tpl:duration-200\"\n :class=\"\n panelState.aiButtonActive.value\n ? 'tpl-ai-btn--active'\n : 'tpl-ai-btn--idle'\n \"\n @click.stop=\"panelState.toggleAiMenu\"\n >\n <Sparkles :size=\"16\" :stroke-width=\"2\" class=\"tpl-ai-btn-icon\" />\n {{ cloudT.aiChat.button }}\n </button>\n <Transition\n enter-active-class=\"tpl:transition-all tpl:duration-150 tpl:ease-out\"\n enter-from-class=\"tpl:scale-95 tpl:opacity-0\"\n enter-to-class=\"tpl:scale-100 tpl:opacity-100\"\n leave-active-class=\"tpl:transition-all tpl:duration-100 tpl:ease-in\"\n leave-from-class=\"tpl:scale-100 tpl:opacity-100\"\n leave-to-class=\"tpl:scale-95 tpl:opacity-0\"\n >\n <div\n v-if=\"panelState.aiMenuOpen.value\"\n class=\"tpl:absolute tpl:right-0 tpl:top-full tpl:z-50 tpl:mt-1 tpl:origin-top-right\"\n >\n <AiFeatureMenu\n :active-feature=\"panelState.activeAiFeature.value\"\n @select=\"panelState.handleAiFeatureSelect\"\n />\n </div>\n </Transition>\n </div>\n\n <!-- Test email button -->\n <button\n v-if=\"testEmail.isEnabled.value && featureFlags.canSendTestEmail.value\"\n :class=\"headerBtnClass\"\n style=\"\n background-color: transparent;\n color: var(--tpl-primary);\n border-color: var(--tpl-primary);\n \"\n :disabled=\"\n testEmail.isSending.value || !featureFlags.hasTemplateSaved.value\n \"\n @click=\"panelState.testEmailModalOpen.value = true\"\n >\n <Send v-if=\"!testEmail.isSending.value\" :size=\"16\" :stroke-width=\"2\" />\n <LoaderCircle v-else class=\"tpl-spinner\" :size=\"16\" :stroke-width=\"2\" />\n {{ cloudT.testEmail.button }}\n </button>\n\n <!-- Save button -->\n <button\n :class=\"headerBtnClass\"\n style=\"\n background-color: transparent;\n color: var(--tpl-primary);\n border-color: var(--tpl-primary);\n \"\n :disabled=\"isSaveDisabled\"\n @click=\"$emit('save')\"\n >\n <Save v-if=\"!isSaving\" :size=\"16\" :stroke-width=\"2\" />\n <LoaderCircle v-else class=\"tpl-spinner\" :size=\"16\" :stroke-width=\"2\" />\n {{ isSaving ? cloudT.header.saving : cloudT.header.save }}\n </button>\n </div>\n </header>\n</template>\n","<script setup lang=\"ts\">\nimport { defineAsyncComponent, ref } from \"vue\";\nimport type { Block, TemplateContent } from \"@templatical/types\";\nimport type {\n UsePlanConfigReturn,\n UseTestEmailReturn,\n UseEditorReturn as CloudUseEditorReturn,\n} from \"@templatical/core/cloud\";\n\nimport type { UseEditorCoreReturn } from \"../../composables/useEditorCore\";\nimport type { UseCloudPanelStateReturn } from \"../composables/useCloudPanelState\";\nimport type { UseCloudMediaLibraryReturn } from \"../composables/useCloudMediaLibrary\";\nimport type { UseCloudInitializationReturn } from \"../composables/useCloudInitialization\";\nimport type { TemplaticalCloudEditorConfig } from \"../cloudConfig\";\n\nconst AiChatSidebar = defineAsyncComponent(() => import(\"./AiChatSidebar.vue\"));\nconst CommentsSidebar = defineAsyncComponent(\n () => import(\"./CommentsSidebar.vue\"),\n);\nconst DesignReferenceSidebar = defineAsyncComponent(\n () => import(\"./DesignReferenceSidebar.vue\"),\n);\nconst TemplateScoringPanel = defineAsyncComponent(\n () => import(\"./TemplateScoringPanel.vue\"),\n);\nconst TestEmailModal = defineAsyncComponent(\n () => import(\"./TestEmailModal.vue\"),\n);\nconst SaveModuleDialog = defineAsyncComponent(\n () => import(\"./SaveModuleDialog.vue\"),\n);\nconst ModuleBrowserModal = defineAsyncComponent(\n () => import(\"./ModuleBrowserModal.vue\"),\n);\nconst MediaLibraryModal = defineAsyncComponent(async () => {\n // try/catch downgrades Webpack's \"Module not found\" from error to warning\n // when the optional peer isn't installed. Cloud consumers always install it.\n try {\n const m = await import(\"@templatical/media-library\");\n return m.MediaLibraryModal;\n } catch {\n throw new Error(\n \"[Templatical] Cloud media library requires the optional peer dependency '@templatical/media-library'. Please install it.\",\n );\n }\n});\n\ndefineProps<{\n config: TemplaticalCloudEditorConfig;\n editor: CloudUseEditorReturn;\n core: UseEditorCoreReturn;\n panelState: UseCloudPanelStateReturn;\n planConfigInstance: UsePlanConfigReturn;\n testEmail: UseTestEmailReturn;\n mediaLib: UseCloudMediaLibraryReturn;\n savedModulesHeadless: UseCloudInitializationReturn[\"savedModulesHeadless\"];\n showSaveModuleDialog: boolean;\n saveModulePreSelectedBlockId: string | null;\n showModuleBrowserModal: boolean;\n}>();\n\nconst emit = defineEmits<{\n (e: \"update:showSaveModuleDialog\", value: boolean): void;\n (e: \"update:saveModulePreSelectedBlockId\", value: string | null): void;\n (e: \"update:showModuleBrowserModal\", value: boolean): void;\n (e: \"send-test-email\", recipient: string): void;\n (\n e: \"module-insert\",\n module: { content: Block[] },\n insertIndex: number | undefined,\n ): void;\n}>();\n\nfunction applyContent(\n content: TemplateContent,\n core: UseEditorCoreReturn,\n editor: CloudUseEditorReturn,\n): void {\n core.history.record();\n editor.setContent(content);\n core.conditionPreview.reset();\n}\n\nfunction handleModuleInsert(\n mod: { content: Block[] },\n idx: number | undefined,\n): void {\n emit(\"module-insert\", mod, idx);\n}\n\ninterface CommentsSidebarInstance {\n filterByBlock: (blockId: string) => void;\n}\n\nconst commentsSidebar = ref<CommentsSidebarInstance | null>(null);\n\n/** Delegates to the CommentsSidebar's filterByBlock method once it's mounted. */\nfunction filterCommentsByBlock(blockId: string): void {\n commentsSidebar.value?.filterByBlock(blockId);\n}\n\ndefineExpose({ filterCommentsByBlock });\n</script>\n\n<template>\n <AiChatSidebar\n :visible=\"panelState.aiChatOpen.value\"\n :on-apply=\"(c: TemplateContent) => applyContent(c, core, editor)\"\n @close=\"panelState.aiChatOpen.value = false\"\n />\n\n <TemplateScoringPanel\n :visible=\"panelState.scoringPanelOpen.value\"\n @close=\"panelState.scoringPanelOpen.value = false\"\n />\n\n <DesignReferenceSidebar\n :visible=\"panelState.designReferenceOpen.value\"\n :has-existing-blocks=\"editor.content.value.blocks.length > 0\"\n @close=\"panelState.designReferenceOpen.value = false\"\n @apply=\"(c: TemplateContent) => applyContent(c, core, editor)\"\n />\n\n <CommentsSidebar\n ref=\"commentsSidebar\"\n :visible=\"panelState.commentsOpen.value\"\n @close=\"panelState.commentsOpen.value = false\"\n />\n\n <TestEmailModal\n :visible=\"panelState.testEmailModalOpen.value\"\n :allowed-emails=\"testEmail.allowedEmails.value\"\n :is-sending=\"testEmail.isSending.value\"\n :error=\"testEmail.error.value\"\n @send=\"(recipient: string) => emit('send-test-email', recipient)\"\n @close=\"panelState.testEmailModalOpen.value = false\"\n />\n\n <SaveModuleDialog\n v-if=\"\n planConfigInstance.hasFeature('saved_modules') && config.modules !== false\n \"\n :visible=\"showSaveModuleDialog\"\n :pre-selected-block-id=\"saveModulePreSelectedBlockId\"\n @close=\"\n emit('update:showSaveModuleDialog', false);\n emit('update:saveModulePreSelectedBlockId', null);\n \"\n @saved=\"savedModulesHeadless.loadModules()\"\n />\n\n <ModuleBrowserModal\n v-if=\"\n planConfigInstance.hasFeature('saved_modules') && config.modules !== false\n \"\n :visible=\"showModuleBrowserModal\"\n @close=\"emit('update:showModuleBrowserModal', false)\"\n @insert=\"handleModuleInsert\"\n />\n\n <MediaLibraryModal\n :visible=\"panelState.mediaLibraryOpen.value\"\n :accept=\"panelState.mediaLibraryAccept.value\"\n :popover-target=\"core.popoverRoot.value\"\n @select=\"mediaLib.handleMediaSelect\"\n @close=\"mediaLib.handleMediaLibraryClose\"\n />\n</template>\n","<script setup lang=\"ts\">\nimport { defineAsyncComponent, ref } from \"vue\";\nimport type { Block, TemplateContent } from \"@templatical/types\";\nimport type {\n UsePlanConfigReturn,\n UseTestEmailReturn,\n UseEditorReturn as CloudUseEditorReturn,\n} from \"@templatical/core/cloud\";\n\nimport type { UseEditorCoreReturn } from \"../../composables/useEditorCore\";\nimport type { UseCloudPanelStateReturn } from \"../composables/useCloudPanelState\";\nimport type { UseCloudMediaLibraryReturn } from \"../composables/useCloudMediaLibrary\";\nimport type { UseCloudInitializationReturn } from \"../composables/useCloudInitialization\";\nimport type { TemplaticalCloudEditorConfig } from \"../cloudConfig\";\n\nconst AiChatSidebar = defineAsyncComponent(() => import(\"./AiChatSidebar.vue\"));\nconst CommentsSidebar = defineAsyncComponent(\n () => import(\"./CommentsSidebar.vue\"),\n);\nconst DesignReferenceSidebar = defineAsyncComponent(\n () => import(\"./DesignReferenceSidebar.vue\"),\n);\nconst TemplateScoringPanel = defineAsyncComponent(\n () => import(\"./TemplateScoringPanel.vue\"),\n);\nconst TestEmailModal = defineAsyncComponent(\n () => import(\"./TestEmailModal.vue\"),\n);\nconst SaveModuleDialog = defineAsyncComponent(\n () => import(\"./SaveModuleDialog.vue\"),\n);\nconst ModuleBrowserModal = defineAsyncComponent(\n () => import(\"./ModuleBrowserModal.vue\"),\n);\nconst MediaLibraryModal = defineAsyncComponent(async () => {\n // try/catch downgrades Webpack's \"Module not found\" from error to warning\n // when the optional peer isn't installed. Cloud consumers always install it.\n try {\n const m = await import(\"@templatical/media-library\");\n return m.MediaLibraryModal;\n } catch {\n throw new Error(\n \"[Templatical] Cloud media library requires the optional peer dependency '@templatical/media-library'. Please install it.\",\n );\n }\n});\n\ndefineProps<{\n config: TemplaticalCloudEditorConfig;\n editor: CloudUseEditorReturn;\n core: UseEditorCoreReturn;\n panelState: UseCloudPanelStateReturn;\n planConfigInstance: UsePlanConfigReturn;\n testEmail: UseTestEmailReturn;\n mediaLib: UseCloudMediaLibraryReturn;\n savedModulesHeadless: UseCloudInitializationReturn[\"savedModulesHeadless\"];\n showSaveModuleDialog: boolean;\n saveModulePreSelectedBlockId: string | null;\n showModuleBrowserModal: boolean;\n}>();\n\nconst emit = defineEmits<{\n (e: \"update:showSaveModuleDialog\", value: boolean): void;\n (e: \"update:saveModulePreSelectedBlockId\", value: string | null): void;\n (e: \"update:showModuleBrowserModal\", value: boolean): void;\n (e: \"send-test-email\", recipient: string): void;\n (\n e: \"module-insert\",\n module: { content: Block[] },\n insertIndex: number | undefined,\n ): void;\n}>();\n\nfunction applyContent(\n content: TemplateContent,\n core: UseEditorCoreReturn,\n editor: CloudUseEditorReturn,\n): void {\n core.history.record();\n editor.setContent(content);\n core.conditionPreview.reset();\n}\n\nfunction handleModuleInsert(\n mod: { content: Block[] },\n idx: number | undefined,\n): void {\n emit(\"module-insert\", mod, idx);\n}\n\ninterface CommentsSidebarInstance {\n filterByBlock: (blockId: string) => void;\n}\n\nconst commentsSidebar = ref<CommentsSidebarInstance | null>(null);\n\n/** Delegates to the CommentsSidebar's filterByBlock method once it's mounted. */\nfunction filterCommentsByBlock(blockId: string): void {\n commentsSidebar.value?.filterByBlock(blockId);\n}\n\ndefineExpose({ filterCommentsByBlock });\n</script>\n\n<template>\n <AiChatSidebar\n :visible=\"panelState.aiChatOpen.value\"\n :on-apply=\"(c: TemplateContent) => applyContent(c, core, editor)\"\n @close=\"panelState.aiChatOpen.value = false\"\n />\n\n <TemplateScoringPanel\n :visible=\"panelState.scoringPanelOpen.value\"\n @close=\"panelState.scoringPanelOpen.value = false\"\n />\n\n <DesignReferenceSidebar\n :visible=\"panelState.designReferenceOpen.value\"\n :has-existing-blocks=\"editor.content.value.blocks.length > 0\"\n @close=\"panelState.designReferenceOpen.value = false\"\n @apply=\"(c: TemplateContent) => applyContent(c, core, editor)\"\n />\n\n <CommentsSidebar\n ref=\"commentsSidebar\"\n :visible=\"panelState.commentsOpen.value\"\n @close=\"panelState.commentsOpen.value = false\"\n />\n\n <TestEmailModal\n :visible=\"panelState.testEmailModalOpen.value\"\n :allowed-emails=\"testEmail.allowedEmails.value\"\n :is-sending=\"testEmail.isSending.value\"\n :error=\"testEmail.error.value\"\n @send=\"(recipient: string) => emit('send-test-email', recipient)\"\n @close=\"panelState.testEmailModalOpen.value = false\"\n />\n\n <SaveModuleDialog\n v-if=\"\n planConfigInstance.hasFeature('saved_modules') && config.modules !== false\n \"\n :visible=\"showSaveModuleDialog\"\n :pre-selected-block-id=\"saveModulePreSelectedBlockId\"\n @close=\"\n emit('update:showSaveModuleDialog', false);\n emit('update:saveModulePreSelectedBlockId', null);\n \"\n @saved=\"savedModulesHeadless.loadModules()\"\n />\n\n <ModuleBrowserModal\n v-if=\"\n planConfigInstance.hasFeature('saved_modules') && config.modules !== false\n \"\n :visible=\"showModuleBrowserModal\"\n @close=\"emit('update:showModuleBrowserModal', false)\"\n @insert=\"handleModuleInsert\"\n />\n\n <MediaLibraryModal\n :visible=\"panelState.mediaLibraryOpen.value\"\n :accept=\"panelState.mediaLibraryAccept.value\"\n :popover-target=\"core.popoverRoot.value\"\n @select=\"mediaLib.handleMediaSelect\"\n @close=\"mediaLib.handleMediaLibraryClose\"\n />\n</template>\n","<script setup lang=\"ts\">\ndefineProps<{\n visible: boolean;\n}>();\n</script>\n\n<template>\n <div\n v-if=\"visible\"\n class=\"tpl-loading tpl:absolute tpl:inset-0 tpl:z-overlay tpl:flex tpl:flex-col tpl:bg-[var(--tpl-bg)]\"\n >\n <!-- Skeleton header -->\n <div\n class=\"tpl:flex tpl:h-14 tpl:shrink-0 tpl:items-center tpl:justify-between tpl:px-4 tpl:border-b tpl:border-[var(--tpl-border)]\"\n >\n <div\n class=\"tpl-shimmer tpl:h-5 tpl:w-28 tpl:rounded-[var(--tpl-radius-sm)]\"\n ></div>\n <div class=\"tpl:flex tpl:gap-3\">\n <div\n class=\"tpl-shimmer tpl:h-8 tpl:w-20 tpl:rounded-[var(--tpl-radius-sm)]\"\n ></div>\n <div\n class=\"tpl-shimmer tpl:h-8 tpl:w-20 tpl:rounded-[var(--tpl-radius-sm)]\"\n ></div>\n </div>\n </div>\n <!-- Skeleton body -->\n <div class=\"tpl:flex tpl:flex-1 tpl:overflow-hidden\">\n <!-- Left sidebar rail -->\n <div\n class=\"tpl:flex tpl:w-12 tpl:shrink-0 tpl:flex-col tpl:items-center tpl:gap-4 tpl:py-5 tpl:border-r tpl:border-[var(--tpl-border)]\"\n >\n <div\n v-for=\"n in 5\"\n :key=\"n\"\n class=\"tpl-shimmer tpl:size-7 tpl:rounded-[var(--tpl-radius-sm)]\"\n ></div>\n </div>\n <!-- Canvas area -->\n <div\n class=\"tpl:flex tpl:flex-1 tpl:items-start tpl:justify-center tpl:overflow-auto tpl:p-8 tpl:bg-[var(--tpl-canvas-bg)]\"\n >\n <div\n class=\"tpl:w-full tpl:max-w-[600px] tpl:rounded-[var(--tpl-radius)] tpl:p-6 tpl:bg-[var(--tpl-bg)] tpl:shadow-[var(--tpl-shadow-sm)]\"\n >\n <div class=\"tpl:space-y-2 tpl:py-4\">\n <div class=\"tpl-shimmer tpl:h-3 tpl:w-3/4 tpl:rounded\"></div>\n <div class=\"tpl-shimmer tpl:h-3 tpl:w-full tpl:rounded\"></div>\n <div class=\"tpl-shimmer tpl:h-3 tpl:w-5/6 tpl:rounded\"></div>\n </div>\n <div class=\"tpl:py-4\">\n <div\n class=\"tpl-shimmer tpl:h-44 tpl:w-full tpl:rounded-[var(--tpl-radius-sm)]\"\n ></div>\n </div>\n <div class=\"tpl:space-y-2 tpl:py-4\">\n <div class=\"tpl-shimmer tpl:h-3 tpl:w-full tpl:rounded\"></div>\n <div class=\"tpl-shimmer tpl:h-3 tpl:w-2/3 tpl:rounded\"></div>\n </div>\n <div class=\"tpl:flex tpl:justify-center tpl:py-4\">\n <div\n class=\"tpl-shimmer tpl:h-10 tpl:w-36 tpl:rounded-[var(--tpl-radius-sm)]\"\n ></div>\n </div>\n <div class=\"tpl:space-y-2 tpl:py-4\">\n <div\n class=\"tpl-shimmer tpl:mx-auto tpl:h-2.5 tpl:w-1/2 tpl:rounded\"\n ></div>\n <div\n class=\"tpl-shimmer tpl:mx-auto tpl:h-2.5 tpl:w-1/3 tpl:rounded\"\n ></div>\n </div>\n </div>\n </div>\n <!-- Right panel -->\n <div\n class=\"tpl:flex tpl:w-[320px] tpl:shrink-0 tpl:flex-col tpl:gap-4 tpl:p-4 tpl:border-l tpl:border-[var(--tpl-border)]\"\n >\n <div\n class=\"tpl-shimmer tpl:h-8 tpl:rounded-[var(--tpl-radius-sm)]\"\n ></div>\n <div class=\"tpl-shimmer tpl:h-32 tpl:rounded-[var(--tpl-radius)]\"></div>\n <div class=\"tpl-shimmer tpl:h-32 tpl:rounded-[var(--tpl-radius)]\"></div>\n </div>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\ndefineProps<{\n visible: boolean;\n}>();\n</script>\n\n<template>\n <div\n v-if=\"visible\"\n class=\"tpl-loading tpl:absolute tpl:inset-0 tpl:z-overlay tpl:flex tpl:flex-col tpl:bg-[var(--tpl-bg)]\"\n >\n <!-- Skeleton header -->\n <div\n class=\"tpl:flex tpl:h-14 tpl:shrink-0 tpl:items-center tpl:justify-between tpl:px-4 tpl:border-b tpl:border-[var(--tpl-border)]\"\n >\n <div\n class=\"tpl-shimmer tpl:h-5 tpl:w-28 tpl:rounded-[var(--tpl-radius-sm)]\"\n ></div>\n <div class=\"tpl:flex tpl:gap-3\">\n <div\n class=\"tpl-shimmer tpl:h-8 tpl:w-20 tpl:rounded-[var(--tpl-radius-sm)]\"\n ></div>\n <div\n class=\"tpl-shimmer tpl:h-8 tpl:w-20 tpl:rounded-[var(--tpl-radius-sm)]\"\n ></div>\n </div>\n </div>\n <!-- Skeleton body -->\n <div class=\"tpl:flex tpl:flex-1 tpl:overflow-hidden\">\n <!-- Left sidebar rail -->\n <div\n class=\"tpl:flex tpl:w-12 tpl:shrink-0 tpl:flex-col tpl:items-center tpl:gap-4 tpl:py-5 tpl:border-r tpl:border-[var(--tpl-border)]\"\n >\n <div\n v-for=\"n in 5\"\n :key=\"n\"\n class=\"tpl-shimmer tpl:size-7 tpl:rounded-[var(--tpl-radius-sm)]\"\n ></div>\n </div>\n <!-- Canvas area -->\n <div\n class=\"tpl:flex tpl:flex-1 tpl:items-start tpl:justify-center tpl:overflow-auto tpl:p-8 tpl:bg-[var(--tpl-canvas-bg)]\"\n >\n <div\n class=\"tpl:w-full tpl:max-w-[600px] tpl:rounded-[var(--tpl-radius)] tpl:p-6 tpl:bg-[var(--tpl-bg)] tpl:shadow-[var(--tpl-shadow-sm)]\"\n >\n <div class=\"tpl:space-y-2 tpl:py-4\">\n <div class=\"tpl-shimmer tpl:h-3 tpl:w-3/4 tpl:rounded\"></div>\n <div class=\"tpl-shimmer tpl:h-3 tpl:w-full tpl:rounded\"></div>\n <div class=\"tpl-shimmer tpl:h-3 tpl:w-5/6 tpl:rounded\"></div>\n </div>\n <div class=\"tpl:py-4\">\n <div\n class=\"tpl-shimmer tpl:h-44 tpl:w-full tpl:rounded-[var(--tpl-radius-sm)]\"\n ></div>\n </div>\n <div class=\"tpl:space-y-2 tpl:py-4\">\n <div class=\"tpl-shimmer tpl:h-3 tpl:w-full tpl:rounded\"></div>\n <div class=\"tpl-shimmer tpl:h-3 tpl:w-2/3 tpl:rounded\"></div>\n </div>\n <div class=\"tpl:flex tpl:justify-center tpl:py-4\">\n <div\n class=\"tpl-shimmer tpl:h-10 tpl:w-36 tpl:rounded-[var(--tpl-radius-sm)]\"\n ></div>\n </div>\n <div class=\"tpl:space-y-2 tpl:py-4\">\n <div\n class=\"tpl-shimmer tpl:mx-auto tpl:h-2.5 tpl:w-1/2 tpl:rounded\"\n ></div>\n <div\n class=\"tpl-shimmer tpl:mx-auto tpl:h-2.5 tpl:w-1/3 tpl:rounded\"\n ></div>\n </div>\n </div>\n </div>\n <!-- Right panel -->\n <div\n class=\"tpl:flex tpl:w-[320px] tpl:shrink-0 tpl:flex-col tpl:gap-4 tpl:p-4 tpl:border-l tpl:border-[var(--tpl-border)]\"\n >\n <div\n class=\"tpl-shimmer tpl:h-8 tpl:rounded-[var(--tpl-radius-sm)]\"\n ></div>\n <div class=\"tpl-shimmer tpl:h-32 tpl:rounded-[var(--tpl-radius)]\"></div>\n <div class=\"tpl-shimmer tpl:h-32 tpl:rounded-[var(--tpl-radius)]\"></div>\n </div>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { CircleAlert } from \"@lucide/vue\";\nimport { useCloudI18nStrict } from \"../../composables/useCloudI18n\";\n\ndefineProps<{\n error: Error | null;\n visible: boolean;\n}>();\n\nconst emit = defineEmits<{\n (e: \"retry\"): void;\n}>();\n\nconst { t: cloudT } = useCloudI18nStrict();\n\nfunction getErrorMessage(error: Error): string {\n if (\n \"isUnauthorized\" in error &&\n (error as { isUnauthorized: boolean }).isUnauthorized\n ) {\n return cloudT.error.authFailed;\n }\n if (\"isNotFound\" in error && (error as { isNotFound: boolean }).isNotFound) {\n return cloudT.error.templateNotFound;\n }\n return cloudT.error.defaultMessage;\n}\n\nfunction isNotFoundError(error: Error): boolean {\n return (\n \"isNotFound\" in error && !!(error as { isNotFound: boolean }).isNotFound\n );\n}\n</script>\n\n<template>\n <div\n v-if=\"visible && error\"\n role=\"alert\"\n class=\"tpl-error tpl:absolute tpl:inset-0 tpl:z-overlay tpl:flex tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-6 tpl:px-8 tpl:bg-[var(--tpl-bg)]\"\n >\n <div\n class=\"tpl:flex tpl:size-16 tpl:items-center tpl:justify-center tpl:rounded-full tpl:bg-[var(--tpl-danger-light)]\"\n >\n <CircleAlert\n :size=\"32\"\n :stroke-width=\"1.5\"\n class=\"tpl:text-[var(--tpl-danger)]\"\n />\n </div>\n <div\n class=\"tpl:flex tpl:flex-col tpl:items-center tpl:gap-2 tpl:text-center\"\n >\n <h2 class=\"tpl:text-lg tpl:font-semibold tpl:text-[var(--tpl-text)]\">\n {{ cloudT.error.title }}\n </h2>\n <p class=\"tpl:max-w-md tpl:text-sm tpl:text-[var(--tpl-text-muted)]\">\n {{ getErrorMessage(error) }}\n </p>\n </div>\n <button\n v-if=\"!isNotFoundError(error)\"\n class=\"tpl-btn tpl-btn-primary tpl:inline-flex tpl:items-center tpl:gap-2 tpl:rounded-md tpl:px-4 tpl:py-2.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]\"\n @click=\"emit('retry')\"\n >\n {{ cloudT.error.retry }}\n </button>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { CircleAlert } from \"@lucide/vue\";\nimport { useCloudI18nStrict } from \"../../composables/useCloudI18n\";\n\ndefineProps<{\n error: Error | null;\n visible: boolean;\n}>();\n\nconst emit = defineEmits<{\n (e: \"retry\"): void;\n}>();\n\nconst { t: cloudT } = useCloudI18nStrict();\n\nfunction getErrorMessage(error: Error): string {\n if (\n \"isUnauthorized\" in error &&\n (error as { isUnauthorized: boolean }).isUnauthorized\n ) {\n return cloudT.error.authFailed;\n }\n if (\"isNotFound\" in error && (error as { isNotFound: boolean }).isNotFound) {\n return cloudT.error.templateNotFound;\n }\n return cloudT.error.defaultMessage;\n}\n\nfunction isNotFoundError(error: Error): boolean {\n return (\n \"isNotFound\" in error && !!(error as { isNotFound: boolean }).isNotFound\n );\n}\n</script>\n\n<template>\n <div\n v-if=\"visible && error\"\n role=\"alert\"\n class=\"tpl-error tpl:absolute tpl:inset-0 tpl:z-overlay tpl:flex tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-6 tpl:px-8 tpl:bg-[var(--tpl-bg)]\"\n >\n <div\n class=\"tpl:flex tpl:size-16 tpl:items-center tpl:justify-center tpl:rounded-full tpl:bg-[var(--tpl-danger-light)]\"\n >\n <CircleAlert\n :size=\"32\"\n :stroke-width=\"1.5\"\n class=\"tpl:text-[var(--tpl-danger)]\"\n />\n </div>\n <div\n class=\"tpl:flex tpl:flex-col tpl:items-center tpl:gap-2 tpl:text-center\"\n >\n <h2 class=\"tpl:text-lg tpl:font-semibold tpl:text-[var(--tpl-text)]\">\n {{ cloudT.error.title }}\n </h2>\n <p class=\"tpl:max-w-md tpl:text-sm tpl:text-[var(--tpl-text-muted)]\">\n {{ getErrorMessage(error) }}\n </p>\n </div>\n <button\n v-if=\"!isNotFoundError(error)\"\n class=\"tpl-btn tpl-btn-primary tpl:inline-flex tpl:items-center tpl:gap-2 tpl:rounded-md tpl:px-4 tpl:py-2.5 tpl:text-sm tpl:font-medium tpl:shadow-xs tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]\"\n @click=\"emit('retry')\"\n >\n {{ cloudT.error.retry }}\n </button>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { Clock } from \"@lucide/vue\";\nimport { useCloudI18nStrict } from \"../../composables/useCloudI18n\";\n\ndefineProps<{\n visible: boolean;\n}>();\n\nconst emit = defineEmits<{\n (e: \"cancel\"): void;\n (e: \"confirm\"): void;\n}>();\n\nconst { t: cloudT } = useCloudI18nStrict();\n</script>\n\n<template>\n <div\n v-if=\"visible\"\n class=\"tpl-preview-banner tpl:absolute tpl:top-14 tpl:right-0 tpl:left-0 tpl:z-40 tpl:flex tpl:items-center tpl:justify-center tpl:gap-4 tpl:px-4 tpl:py-3 tpl:bg-[var(--tpl-primary-light)] tpl:border-b tpl:border-[var(--tpl-primary)]\"\n >\n <div\n class=\"tpl:flex tpl:items-center tpl:gap-2 tpl:text-sm tpl:text-[var(--tpl-text)]\"\n >\n <Clock\n :size=\"18\"\n :stroke-width=\"2\"\n class=\"tpl:text-[var(--tpl-primary)]\"\n />\n <span>{{ cloudT.snapshotPreview.message }}</span>\n </div>\n <div class=\"tpl:flex tpl:items-center tpl:gap-2\">\n <button\n class=\"tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:transition-all tpl:duration-150 tpl:text-[var(--tpl-text-muted)] tpl:border tpl:border-[var(--tpl-border)]\"\n style=\"background-color: transparent\"\n @click=\"emit('cancel')\"\n >\n {{ cloudT.snapshotPreview.cancel }}\n </button>\n <button\n class=\"tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]\"\n @click=\"emit('confirm')\"\n >\n {{ cloudT.snapshotPreview.restore }}\n </button>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { Clock } from \"@lucide/vue\";\nimport { useCloudI18nStrict } from \"../../composables/useCloudI18n\";\n\ndefineProps<{\n visible: boolean;\n}>();\n\nconst emit = defineEmits<{\n (e: \"cancel\"): void;\n (e: \"confirm\"): void;\n}>();\n\nconst { t: cloudT } = useCloudI18nStrict();\n</script>\n\n<template>\n <div\n v-if=\"visible\"\n class=\"tpl-preview-banner tpl:absolute tpl:top-14 tpl:right-0 tpl:left-0 tpl:z-40 tpl:flex tpl:items-center tpl:justify-center tpl:gap-4 tpl:px-4 tpl:py-3 tpl:bg-[var(--tpl-primary-light)] tpl:border-b tpl:border-[var(--tpl-primary)]\"\n >\n <div\n class=\"tpl:flex tpl:items-center tpl:gap-2 tpl:text-sm tpl:text-[var(--tpl-text)]\"\n >\n <Clock\n :size=\"18\"\n :stroke-width=\"2\"\n class=\"tpl:text-[var(--tpl-primary)]\"\n />\n <span>{{ cloudT.snapshotPreview.message }}</span>\n </div>\n <div class=\"tpl:flex tpl:items-center tpl:gap-2\">\n <button\n class=\"tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:transition-all tpl:duration-150 tpl:text-[var(--tpl-text-muted)] tpl:border tpl:border-[var(--tpl-border)]\"\n style=\"background-color: transparent\"\n @click=\"emit('cancel')\"\n >\n {{ cloudT.snapshotPreview.cancel }}\n </button>\n <button\n class=\"tpl:rounded-md tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:transition-all tpl:duration-150 tpl:hover:opacity-90 tpl:bg-[var(--tpl-primary)] tpl:text-[var(--tpl-bg)]\"\n @click=\"emit('confirm')\"\n >\n {{ cloudT.snapshotPreview.restore }}\n </button>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { useI18n } from \"../../composables/useI18n\";\n\ndefineProps<{\n visible: boolean;\n}>();\n\nconst { t } = useI18n();\n</script>\n\n<template>\n <div\n v-if=\"visible\"\n role=\"status\"\n aria-live=\"polite\"\n class=\"tpl:absolute tpl:top-16 tpl:left-1/2 tpl:z-toast tpl:-translate-x-1/2 tpl:rounded-[var(--tpl-radius)] tpl:px-4 tpl:py-2.5 tpl:text-sm tpl:shadow-lg\"\n style=\"\n background-color: var(--tpl-warning-light);\n color: var(--tpl-text);\n border: 1px solid var(--tpl-warning);\n \"\n >\n {{ t.history.collabWarning }}\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { useI18n } from \"../../composables/useI18n\";\n\ndefineProps<{\n visible: boolean;\n}>();\n\nconst { t } = useI18n();\n</script>\n\n<template>\n <div\n v-if=\"visible\"\n role=\"status\"\n aria-live=\"polite\"\n class=\"tpl:absolute tpl:top-16 tpl:left-1/2 tpl:z-toast tpl:-translate-x-1/2 tpl:rounded-[var(--tpl-radius)] tpl:px-4 tpl:py-2.5 tpl:text-sm tpl:shadow-lg\"\n style=\"\n background-color: var(--tpl-warning-light);\n color: var(--tpl-text);\n border: 1px solid var(--tpl-warning);\n \"\n >\n {{ t.history.collabWarning }}\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport type { Block, TemplateContent } from \"@templatical/types\";\nimport { cloneBlock } from \"@templatical/types\";\n\nimport type { UseFontsReturn } from \"../composables/useFonts\";\nimport { onMounted, onUnmounted, ref } from \"vue\";\nimport { RotateCcw } from \"@lucide/vue\";\nimport type { Translations, CloudTranslations } from \"../i18n\";\nimport { provide } from \"vue\";\nimport { CLOUD_TRANSLATIONS_KEY } from \"../keys\";\n\nimport { useSmallScreenNotice } from \"../composables/useSmallScreenNotice\";\nimport { useCloudInitialization } from \"./composables/useCloudInitialization\";\nimport { useCloudLifecycle } from \"./composables/useCloudLifecycle\";\nimport { useCloudSaveGate } from \"./composables/useCloudSaveGate\";\nimport CloudSaveGateModal from \"./components/CloudSaveGateModal.vue\";\nimport CloudHeader from \"./components/CloudHeader.vue\";\nimport CloudPanels from \"./components/CloudPanels.vue\";\nimport EditorFooter from \"../components/EditorFooter.vue\";\n\nimport Canvas from \"../components/Canvas.vue\";\nimport CustomBlockStylesheets from \"../components/CustomBlockStylesheets.vue\";\nimport Sidebar from \"../components/Sidebar.vue\";\nimport RightSidebar from \"../components/RightSidebar.vue\";\nimport SmallScreenNotice from \"../components/SmallScreenNotice.vue\";\nimport CloudLoadingOverlay from \"./components/CloudLoadingOverlay.vue\";\nimport CloudErrorOverlay from \"./components/CloudErrorOverlay.vue\";\nimport SnapshotPreviewBanner from \"./components/SnapshotPreviewBanner.vue\";\nimport CollabUndoToast from \"./components/CollabUndoToast.vue\";\nimport MergeTagPickerModal from \"../components/MergeTagPickerModal.vue\";\nimport LogicTagPickerModal from \"../components/LogicTagPickerModal.vue\";\nimport \"../styles/index.css\";\n\nexport type { TemplaticalCloudEditorConfig } from \"./cloudConfig\";\nimport type { TemplaticalCloudEditorConfig } from \"./cloudConfig\";\n\nconst props = defineProps<{\n config: TemplaticalCloudEditorConfig;\n translations: Translations;\n cloudTranslations: CloudTranslations;\n fontsManager: UseFontsReturn;\n /**\n * Shadow root the cloud editor is mounted into. Supplied by `initCloud()`\n * when `shadowDom: true`; undefined in light-DOM mode. Plumbed through\n * `useCloudInitialization` → `useEditorCore`.\n */\n shadowRoot?: ShadowRoot;\n}>();\n\nprovide(CLOUD_TRANSLATIONS_KEY, props.cloudTranslations);\nconst emit = defineEmits<{\n (e: \"ready\"): void;\n}>();\n\n// Template ref for CloudPanels. Its `filterCommentsByBlock()` method is what\n// init.openCommentsForBlock() bridges to once the panel mounts.\nconst cloudPanelsRef = ref<{\n filterCommentsByBlock: (blockId: string) => void;\n} | null>(null);\n\n// Outer `.tpl` ref forwarded to `useEditorCore` (via `useCloudInitialization`)\n// for multi-editor keyboard routing.\nconst rootEl = ref<HTMLElement | null>(null);\n\nconst init = useCloudInitialization({\n config: props.config,\n translations: props.translations,\n fontsManager: props.fontsManager,\n emit,\n getCommentsSidebar: () =>\n cloudPanelsRef.value\n ? { filterByBlock: cloudPanelsRef.value.filterCommentsByBlock }\n : null,\n editorRoot: props.shadowRoot,\n containerEl: rootEl,\n});\n\n// Destructure heavily-used members for template readability.\nconst {\n isInitializing,\n isAuthReady,\n initError,\n planConfigInstance,\n websocket,\n collaboration,\n isCollaborationEnabled,\n editor,\n core,\n featureFlags,\n mediaLib,\n exporter,\n testEmail,\n commentsInstance,\n savedModulesHeadless,\n panelState,\n snapshotPreview,\n collabWarning,\n showSaveModuleDialog,\n showModuleBrowserModal,\n saveModulePreSelectedBlockId,\n setThemeOverrides,\n setUiTheme,\n} = init;\n\n// --- Small-screen gate (#235) ---\n// Below ~768px the three-pane chrome can't lay out usably; show a notice\n// instead. Opt out with `config.smallScreenNotice: false`. The cloud session\n// (auth/websocket) stays connected behind the notice, so rotating back to a\n// wide viewport restores the live editor without re-initializing.\nconst { showNotice: showSmallScreenNotice } = useSmallScreenNotice(\n () => props.config.smallScreenNotice,\n);\n\n// ---------------------------------------------------------------------------\n// Test email handler\n// ---------------------------------------------------------------------------\n\nasync function handleSendTestEmail(recipient: string): Promise<void> {\n try {\n await testEmail.sendTestEmail(recipient);\n panelState.testEmailModalOpen.value = false;\n } catch {\n // Error is already handled in the composable\n }\n}\n\nasync function handleConfirmRestoreSnapshot(): Promise<void> {\n try {\n await snapshotPreview.confirmRestoreSnapshot();\n } catch {\n // Restore failure is already surfaced via onError, and the composable\n // rolls the editor content back to the pre-preview state. Swallow here so\n // the rejected promise from the event binding isn't an unhandled rejection.\n }\n}\n\n// ---------------------------------------------------------------------------\n// Module insert handler\n// ---------------------------------------------------------------------------\n\nfunction handleModuleInsert(\n module: { content: Block[] },\n insertIndex: number | undefined,\n): void {\n for (let i = 0; i < module.content.length; i++) {\n const cloned = cloneBlock(module.content[i]);\n const position = insertIndex !== undefined ? insertIndex + i : undefined;\n editor.addBlock(cloned, undefined, undefined, position);\n }\n showModuleBrowserModal.value = false;\n}\n\n// ---------------------------------------------------------------------------\n// Template lifecycle (create/load/save)\n// ---------------------------------------------------------------------------\n\nconst lifecycle = useCloudLifecycle({\n config: props.config,\n editor,\n websocket,\n planConfigInstance,\n snapshotPreview,\n core,\n exporter,\n featureFlags,\n isDestroyed: init.isDestroyed,\n});\n\n// --- Lint save-gate ---\nconst saveGate = useCloudSaveGate({\n issues: core.templateLint ? core.templateLint.issues : ref([]),\n planConfig: planConfigInstance.config,\n});\n\nasync function gatedSave(): Promise<void> {\n await saveGate.tryRunSave(() =>\n lifecycle.saveTemplate().catch((err: Error) => props.config.onError?.(err)),\n );\n}\n\n// Route the keyboard Save hook through the gate so Cmd+S also triggers the\n// modal when the plan policy says so.\ninit.onSaveHook.value = gatedSave;\n\n// ---------------------------------------------------------------------------\n// Lifecycle\n// ---------------------------------------------------------------------------\n\nonMounted(() => {\n init.initialize();\n});\n\nonUnmounted(() => {\n init.destroy();\n});\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\ndefineExpose({\n getContent: () => editor.content.value,\n setContent: (content: TemplateContent) => editor.setContent(content),\n setTheme: setUiTheme,\n setThemeOverrides: setThemeOverrides,\n create: lifecycle.createTemplate,\n load: lifecycle.loadTemplate,\n save: lifecycle.saveTemplate,\n sendTestEmail: testEmail.sendTestEmail,\n});\n</script>\n\n<template>\n <!-- @dragover/@drop.prevent: a file dropped outside an image drop zone would\n otherwise make the browser navigate to the file:// URL and destroy the\n editor session. Image zones (useImageDrop) handle their own drops; this\n only neutralizes the default action everywhere else (#229). -->\n <div\n ref=\"rootEl\"\n class=\"tpl tpl:relative tpl:h-full tpl:overflow-hidden\"\n :class=\"{ 'tpl:dark': editor.state.darkMode }\"\n :data-tpl-theme=\"core.resolvedTheme.value\"\n :style=\"core.themeStyles.value\"\n @dragover.prevent\n @drop.prevent\n >\n <!-- Reactive `<style>` tags for custom-block definition stylesheets in\n use. Sits at the top so its rules apply to the canvas below. -->\n <CustomBlockStylesheets />\n <!-- Loading overlay -->\n <Transition\n enter-active-class=\"tpl:transition-opacity tpl:duration-200\"\n enter-from-class=\"tpl:opacity-100\"\n enter-to-class=\"tpl:opacity-100\"\n leave-active-class=\"tpl:transition-opacity tpl:duration-300\"\n leave-from-class=\"tpl:opacity-100\"\n leave-to-class=\"tpl:opacity-0\"\n >\n <CloudLoadingOverlay\n :visible=\"isInitializing || editor.state.isLoading\"\n />\n </Transition>\n\n <!-- Error overlay -->\n <Transition\n enter-active-class=\"tpl:transition-opacity tpl:duration-200\"\n enter-from-class=\"tpl:opacity-0\"\n enter-to-class=\"tpl:opacity-100\"\n leave-active-class=\"tpl:transition-opacity tpl:duration-300\"\n leave-from-class=\"tpl:opacity-100\"\n leave-to-class=\"tpl:opacity-0\"\n >\n <CloudErrorOverlay\n :error=\"initError\"\n :visible=\"!!initError && !isInitializing\"\n @retry=\"init.initialize\"\n />\n </Transition>\n\n <CloudHeader\n :editor=\"editor\"\n :core=\"core\"\n :feature-flags=\"featureFlags\"\n :panel-state=\"panelState\"\n :snapshot-preview=\"snapshotPreview\"\n :comments-instance=\"commentsInstance\"\n :test-email=\"testEmail\"\n :websocket=\"websocket\"\n :collaboration=\"collaboration\"\n :is-collaboration-enabled=\"isCollaborationEnabled\"\n :is-saving=\"editor.state.isSaving || featureFlags.isSaveExporting.value\"\n :is-save-disabled=\"\n editor.state.isSaving ||\n featureFlags.isSaveExporting.value ||\n !editor.state.isDirty\n \"\n @save=\"gatedSave\"\n />\n\n <CloudSaveGateModal\n :open=\"saveGate.modalOpen.value\"\n :issues=\"saveGate.blockingIssues.value\"\n @cancel=\"saveGate.cancel\"\n @confirm=\"saveGate.confirmAndSave\"\n />\n\n <!-- Snapshot preview banner -->\n <SnapshotPreviewBanner\n :visible=\"snapshotPreview.isPreviewingSnapshot.value\"\n @cancel=\"snapshotPreview.cancelPreview\"\n @confirm=\"handleConfirmRestoreSnapshot\"\n />\n\n <!-- Collaboration undo warning toast -->\n <Transition\n enter-active-class=\"tpl:transition-all tpl:duration-200 tpl:ease-out\"\n enter-from-class=\"tpl:translate-y-[-8px] tpl:opacity-0\"\n enter-to-class=\"tpl:translate-y-0 tpl:opacity-100\"\n leave-active-class=\"tpl:transition-all tpl:duration-300 tpl:ease-in\"\n leave-from-class=\"tpl:translate-y-0 tpl:opacity-100\"\n leave-to-class=\"tpl:translate-y-[-8px] tpl:opacity-0\"\n >\n <CollabUndoToast\n :visible=\"collabWarning.collabUndoWarningVisible.value\"\n />\n </Transition>\n\n <!-- Left sidebar -->\n <Sidebar v-show=\"!editor.state.previewMode\" />\n\n <!-- Canvas body -->\n <div\n class=\"tpl-body tpl:absolute tpl:bottom-0 tpl:overflow-auto\"\n style=\"\n transition: all 300ms cubic-bezier(0.34, 1.56, 0.64, 1);\n background-color: var(--tpl-canvas-bg);\n \"\n :class=\"[\n editor.state.previewMode\n ? 'tpl:left-0 tpl:right-0'\n : panelState.rightPanelOpen.value\n ? 'tpl:left-12 tpl:right-[680px]'\n : 'tpl:left-12 tpl:right-[320px]',\n snapshotPreview.isPreviewingSnapshot.value\n ? 'tpl:top-[104px]'\n : 'tpl:top-14',\n ]\"\n >\n <!-- Restore hidden blocks button -->\n <div class=\"tpl:sticky tpl:top-0 tpl:z-40 tpl:h-0\">\n <Transition name=\"tpl-restore-btn\">\n <button\n v-if=\"core.conditionPreview.hasHiddenBlocks.value\"\n class=\"tpl:absolute tpl:left-1/2 tpl:top-2 tpl:-translate-x-1/2 tpl:inline-flex tpl:items-center tpl:gap-1.5 tpl:rounded-full tpl:border tpl:px-3.5 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:whitespace-nowrap tpl:shadow-md tpl:hover:opacity-80\"\n style=\"\n background-color: var(--tpl-warning-light);\n color: var(--tpl-warning);\n border-color: var(--tpl-warning);\n backdrop-filter: blur(8px);\n \"\n @click=\"core.conditionPreview.reset()\"\n >\n <RotateCcw :size=\"13\" :stroke-width=\"2\" />\n {{ core.t.blockSettings.restoreHiddenBlocks }}\n </button>\n </Transition>\n </div>\n <main class=\"tpl-main tpl:flex tpl:justify-center tpl:p-8\">\n <Canvas\n :viewport=\"editor.state.viewport\"\n :content=\"editor.content.value\"\n :selected-block-id=\"editor.state.selectedBlockId\"\n :dark-mode=\"editor.state.darkMode\"\n :preview-mode=\"editor.state.previewMode\"\n :locked-blocks=\"collaboration?.lockedBlocks.value ?? undefined\"\n @select-block=\"editor.selectBlock\"\n @open-ai-chat=\"panelState.aiChatOpen.value = true\"\n @open-design-reference=\"panelState.designReferenceOpen.value = true\"\n />\n </main>\n </div>\n\n <EditorFooter\n v-if=\"config.branding !== false && !featureFlags.isWhiteLabeled.value\"\n :position-class=\"[\n editor.state.previewMode\n ? 'tpl:left-0 tpl:right-0'\n : panelState.rightPanelOpen.value\n ? 'tpl:left-12 tpl:right-[680px]'\n : 'tpl:left-12 tpl:right-[320px]',\n ]\"\n />\n\n <!-- Keyboard reorder announcement region (visually hidden, screen-reader live) -->\n <div\n class=\"tpl-sr-only\"\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n :aria-label=\"core.t.landmarks.reorderAnnouncements\"\n >\n {{ core.keyboardReorder.announcement.value }}\n </div>\n\n <!-- Right sidebar — persisted with v-show -->\n <RightSidebar\n v-show=\"!editor.state.previewMode\"\n :selected-block=\"editor.selectedBlock.value\"\n :settings=\"editor.content.value.settings\"\n :shifted-left=\"panelState.rightPanelOpen.value\"\n @update-block=\"\n (updates) => editor.updateBlock(editor.selectedBlock.value!.id, updates)\n \"\n @delete-block=\"\n core.blockActions.deleteBlock(editor.selectedBlock.value!.id)\n \"\n @duplicate-block=\"\n core.blockActions.duplicateBlock(editor.selectedBlock.value!)\n \"\n @update-settings=\"editor.updateSettings\"\n />\n\n <!-- Cloud sidebars + modals — only mount after cloud init completes -->\n <CloudPanels\n v-if=\"!isInitializing && isAuthReady\"\n ref=\"cloudPanelsRef\"\n :config=\"props.config\"\n :editor=\"editor\"\n :core=\"core\"\n :panel-state=\"panelState\"\n :plan-config-instance=\"planConfigInstance\"\n :test-email=\"testEmail\"\n :media-lib=\"mediaLib\"\n :saved-modules-headless=\"savedModulesHeadless\"\n :show-save-module-dialog=\"showSaveModuleDialog\"\n :save-module-pre-selected-block-id=\"saveModulePreSelectedBlockId\"\n :show-module-browser-modal=\"showModuleBrowserModal\"\n @update:show-save-module-dialog=\"showSaveModuleDialog = $event\"\n @update:save-module-pre-selected-block-id=\"\n saveModulePreSelectedBlockId = $event\n \"\n @update:show-module-browser-modal=\"showModuleBrowserModal = $event\"\n @send-test-email=\"handleSendTestEmail\"\n @module-insert=\"handleModuleInsert\"\n />\n\n <!-- Popover mount — Teleport target for toolbars, link dialog, modal.\n Replaces the historical body-level teleport pattern so popups\n render inside the editor's effective DOM root (shadow-aware). -->\n <div\n :ref=\"(el) => (core.popoverRoot.value = el as HTMLElement | null)\"\n class=\"tpl-popover-root\"\n />\n\n <!-- Built-in merge tag picker modal. Reads picker state via injection;\n renders nothing until `picker.isOpen` flips true. -->\n <MergeTagPickerModal />\n\n <!-- Built-in logic picker modal (standalone logic feature). -->\n <LogicTagPickerModal />\n\n <!-- Small-screen gate (#235). Last child + a literal z-index above the\n chrome and `.tpl-popover-root`, so the opaque notice covers everything\n below the breakpoint. -->\n <SmallScreenNotice v-if=\"showSmallScreenNotice\" />\n </div>\n</template>\n\n<style scoped>\n.tpl-restore-btn-enter-active {\n transition:\n opacity 200ms cubic-bezier(0.16, 1, 0.3, 1),\n transform 200ms cubic-bezier(0.16, 1, 0.3, 1);\n}\n\n.tpl-restore-btn-leave-active {\n transition:\n opacity 150ms ease-in,\n transform 150ms ease-in;\n}\n\n.tpl-restore-btn-enter-from,\n.tpl-restore-btn-leave-to {\n opacity: 0;\n transform: translateY(-8px) scale(0.9);\n}\n\n.tpl-restore-btn-enter-to,\n.tpl-restore-btn-leave-from {\n opacity: 1;\n transform: translateY(0) scale(1);\n}\n</style>\n","<script setup lang=\"ts\">\nimport type { Block, TemplateContent } from \"@templatical/types\";\nimport { cloneBlock } from \"@templatical/types\";\n\nimport type { UseFontsReturn } from \"../composables/useFonts\";\nimport { onMounted, onUnmounted, ref } from \"vue\";\nimport { RotateCcw } from \"@lucide/vue\";\nimport type { Translations, CloudTranslations } from \"../i18n\";\nimport { provide } from \"vue\";\nimport { CLOUD_TRANSLATIONS_KEY } from \"../keys\";\n\nimport { useSmallScreenNotice } from \"../composables/useSmallScreenNotice\";\nimport { useCloudInitialization } from \"./composables/useCloudInitialization\";\nimport { useCloudLifecycle } from \"./composables/useCloudLifecycle\";\nimport { useCloudSaveGate } from \"./composables/useCloudSaveGate\";\nimport CloudSaveGateModal from \"./components/CloudSaveGateModal.vue\";\nimport CloudHeader from \"./components/CloudHeader.vue\";\nimport CloudPanels from \"./components/CloudPanels.vue\";\nimport EditorFooter from \"../components/EditorFooter.vue\";\n\nimport Canvas from \"../components/Canvas.vue\";\nimport CustomBlockStylesheets from \"../components/CustomBlockStylesheets.vue\";\nimport Sidebar from \"../components/Sidebar.vue\";\nimport RightSidebar from \"../components/RightSidebar.vue\";\nimport SmallScreenNotice from \"../components/SmallScreenNotice.vue\";\nimport CloudLoadingOverlay from \"./components/CloudLoadingOverlay.vue\";\nimport CloudErrorOverlay from \"./components/CloudErrorOverlay.vue\";\nimport SnapshotPreviewBanner from \"./components/SnapshotPreviewBanner.vue\";\nimport CollabUndoToast from \"./components/CollabUndoToast.vue\";\nimport MergeTagPickerModal from \"../components/MergeTagPickerModal.vue\";\nimport LogicTagPickerModal from \"../components/LogicTagPickerModal.vue\";\nimport \"../styles/index.css\";\n\nexport type { TemplaticalCloudEditorConfig } from \"./cloudConfig\";\nimport type { TemplaticalCloudEditorConfig } from \"./cloudConfig\";\n\nconst props = defineProps<{\n config: TemplaticalCloudEditorConfig;\n translations: Translations;\n cloudTranslations: CloudTranslations;\n fontsManager: UseFontsReturn;\n /**\n * Shadow root the cloud editor is mounted into. Supplied by `initCloud()`\n * when `shadowDom: true`; undefined in light-DOM mode. Plumbed through\n * `useCloudInitialization` → `useEditorCore`.\n */\n shadowRoot?: ShadowRoot;\n}>();\n\nprovide(CLOUD_TRANSLATIONS_KEY, props.cloudTranslations);\nconst emit = defineEmits<{\n (e: \"ready\"): void;\n}>();\n\n// Template ref for CloudPanels. Its `filterCommentsByBlock()` method is what\n// init.openCommentsForBlock() bridges to once the panel mounts.\nconst cloudPanelsRef = ref<{\n filterCommentsByBlock: (blockId: string) => void;\n} | null>(null);\n\n// Outer `.tpl` ref forwarded to `useEditorCore` (via `useCloudInitialization`)\n// for multi-editor keyboard routing.\nconst rootEl = ref<HTMLElement | null>(null);\n\nconst init = useCloudInitialization({\n config: props.config,\n translations: props.translations,\n fontsManager: props.fontsManager,\n emit,\n getCommentsSidebar: () =>\n cloudPanelsRef.value\n ? { filterByBlock: cloudPanelsRef.value.filterCommentsByBlock }\n : null,\n editorRoot: props.shadowRoot,\n containerEl: rootEl,\n});\n\n// Destructure heavily-used members for template readability.\nconst {\n isInitializing,\n isAuthReady,\n initError,\n planConfigInstance,\n websocket,\n collaboration,\n isCollaborationEnabled,\n editor,\n core,\n featureFlags,\n mediaLib,\n exporter,\n testEmail,\n commentsInstance,\n savedModulesHeadless,\n panelState,\n snapshotPreview,\n collabWarning,\n showSaveModuleDialog,\n showModuleBrowserModal,\n saveModulePreSelectedBlockId,\n setThemeOverrides,\n setUiTheme,\n} = init;\n\n// --- Small-screen gate (#235) ---\n// Below ~768px the three-pane chrome can't lay out usably; show a notice\n// instead. Opt out with `config.smallScreenNotice: false`. The cloud session\n// (auth/websocket) stays connected behind the notice, so rotating back to a\n// wide viewport restores the live editor without re-initializing.\nconst { showNotice: showSmallScreenNotice } = useSmallScreenNotice(\n () => props.config.smallScreenNotice,\n);\n\n// ---------------------------------------------------------------------------\n// Test email handler\n// ---------------------------------------------------------------------------\n\nasync function handleSendTestEmail(recipient: string): Promise<void> {\n try {\n await testEmail.sendTestEmail(recipient);\n panelState.testEmailModalOpen.value = false;\n } catch {\n // Error is already handled in the composable\n }\n}\n\nasync function handleConfirmRestoreSnapshot(): Promise<void> {\n try {\n await snapshotPreview.confirmRestoreSnapshot();\n } catch {\n // Restore failure is already surfaced via onError, and the composable\n // rolls the editor content back to the pre-preview state. Swallow here so\n // the rejected promise from the event binding isn't an unhandled rejection.\n }\n}\n\n// ---------------------------------------------------------------------------\n// Module insert handler\n// ---------------------------------------------------------------------------\n\nfunction handleModuleInsert(\n module: { content: Block[] },\n insertIndex: number | undefined,\n): void {\n for (let i = 0; i < module.content.length; i++) {\n const cloned = cloneBlock(module.content[i]);\n const position = insertIndex !== undefined ? insertIndex + i : undefined;\n editor.addBlock(cloned, undefined, undefined, position);\n }\n showModuleBrowserModal.value = false;\n}\n\n// ---------------------------------------------------------------------------\n// Template lifecycle (create/load/save)\n// ---------------------------------------------------------------------------\n\nconst lifecycle = useCloudLifecycle({\n config: props.config,\n editor,\n websocket,\n planConfigInstance,\n snapshotPreview,\n core,\n exporter,\n featureFlags,\n isDestroyed: init.isDestroyed,\n});\n\n// --- Lint save-gate ---\nconst saveGate = useCloudSaveGate({\n issues: core.templateLint ? core.templateLint.issues : ref([]),\n planConfig: planConfigInstance.config,\n});\n\nasync function gatedSave(): Promise<void> {\n await saveGate.tryRunSave(() =>\n lifecycle.saveTemplate().catch((err: Error) => props.config.onError?.(err)),\n );\n}\n\n// Route the keyboard Save hook through the gate so Cmd+S also triggers the\n// modal when the plan policy says so.\ninit.onSaveHook.value = gatedSave;\n\n// ---------------------------------------------------------------------------\n// Lifecycle\n// ---------------------------------------------------------------------------\n\nonMounted(() => {\n init.initialize();\n});\n\nonUnmounted(() => {\n init.destroy();\n});\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\ndefineExpose({\n getContent: () => editor.content.value,\n setContent: (content: TemplateContent) => editor.setContent(content),\n setTheme: setUiTheme,\n setThemeOverrides: setThemeOverrides,\n create: lifecycle.createTemplate,\n load: lifecycle.loadTemplate,\n save: lifecycle.saveTemplate,\n sendTestEmail: testEmail.sendTestEmail,\n});\n</script>\n\n<template>\n <!-- @dragover/@drop.prevent: a file dropped outside an image drop zone would\n otherwise make the browser navigate to the file:// URL and destroy the\n editor session. Image zones (useImageDrop) handle their own drops; this\n only neutralizes the default action everywhere else (#229). -->\n <div\n ref=\"rootEl\"\n class=\"tpl tpl:relative tpl:h-full tpl:overflow-hidden\"\n :class=\"{ 'tpl:dark': editor.state.darkMode }\"\n :data-tpl-theme=\"core.resolvedTheme.value\"\n :style=\"core.themeStyles.value\"\n @dragover.prevent\n @drop.prevent\n >\n <!-- Reactive `<style>` tags for custom-block definition stylesheets in\n use. Sits at the top so its rules apply to the canvas below. -->\n <CustomBlockStylesheets />\n <!-- Loading overlay -->\n <Transition\n enter-active-class=\"tpl:transition-opacity tpl:duration-200\"\n enter-from-class=\"tpl:opacity-100\"\n enter-to-class=\"tpl:opacity-100\"\n leave-active-class=\"tpl:transition-opacity tpl:duration-300\"\n leave-from-class=\"tpl:opacity-100\"\n leave-to-class=\"tpl:opacity-0\"\n >\n <CloudLoadingOverlay\n :visible=\"isInitializing || editor.state.isLoading\"\n />\n </Transition>\n\n <!-- Error overlay -->\n <Transition\n enter-active-class=\"tpl:transition-opacity tpl:duration-200\"\n enter-from-class=\"tpl:opacity-0\"\n enter-to-class=\"tpl:opacity-100\"\n leave-active-class=\"tpl:transition-opacity tpl:duration-300\"\n leave-from-class=\"tpl:opacity-100\"\n leave-to-class=\"tpl:opacity-0\"\n >\n <CloudErrorOverlay\n :error=\"initError\"\n :visible=\"!!initError && !isInitializing\"\n @retry=\"init.initialize\"\n />\n </Transition>\n\n <CloudHeader\n :editor=\"editor\"\n :core=\"core\"\n :feature-flags=\"featureFlags\"\n :panel-state=\"panelState\"\n :snapshot-preview=\"snapshotPreview\"\n :comments-instance=\"commentsInstance\"\n :test-email=\"testEmail\"\n :websocket=\"websocket\"\n :collaboration=\"collaboration\"\n :is-collaboration-enabled=\"isCollaborationEnabled\"\n :is-saving=\"editor.state.isSaving || featureFlags.isSaveExporting.value\"\n :is-save-disabled=\"\n editor.state.isSaving ||\n featureFlags.isSaveExporting.value ||\n !editor.state.isDirty\n \"\n @save=\"gatedSave\"\n />\n\n <CloudSaveGateModal\n :open=\"saveGate.modalOpen.value\"\n :issues=\"saveGate.blockingIssues.value\"\n @cancel=\"saveGate.cancel\"\n @confirm=\"saveGate.confirmAndSave\"\n />\n\n <!-- Snapshot preview banner -->\n <SnapshotPreviewBanner\n :visible=\"snapshotPreview.isPreviewingSnapshot.value\"\n @cancel=\"snapshotPreview.cancelPreview\"\n @confirm=\"handleConfirmRestoreSnapshot\"\n />\n\n <!-- Collaboration undo warning toast -->\n <Transition\n enter-active-class=\"tpl:transition-all tpl:duration-200 tpl:ease-out\"\n enter-from-class=\"tpl:translate-y-[-8px] tpl:opacity-0\"\n enter-to-class=\"tpl:translate-y-0 tpl:opacity-100\"\n leave-active-class=\"tpl:transition-all tpl:duration-300 tpl:ease-in\"\n leave-from-class=\"tpl:translate-y-0 tpl:opacity-100\"\n leave-to-class=\"tpl:translate-y-[-8px] tpl:opacity-0\"\n >\n <CollabUndoToast\n :visible=\"collabWarning.collabUndoWarningVisible.value\"\n />\n </Transition>\n\n <!-- Left sidebar -->\n <Sidebar v-show=\"!editor.state.previewMode\" />\n\n <!-- Canvas body -->\n <div\n class=\"tpl-body tpl:absolute tpl:bottom-0 tpl:overflow-auto\"\n style=\"\n transition: all 300ms cubic-bezier(0.34, 1.56, 0.64, 1);\n background-color: var(--tpl-canvas-bg);\n \"\n :class=\"[\n editor.state.previewMode\n ? 'tpl:left-0 tpl:right-0'\n : panelState.rightPanelOpen.value\n ? 'tpl:left-12 tpl:right-[680px]'\n : 'tpl:left-12 tpl:right-[320px]',\n snapshotPreview.isPreviewingSnapshot.value\n ? 'tpl:top-[104px]'\n : 'tpl:top-14',\n ]\"\n >\n <!-- Restore hidden blocks button -->\n <div class=\"tpl:sticky tpl:top-0 tpl:z-40 tpl:h-0\">\n <Transition name=\"tpl-restore-btn\">\n <button\n v-if=\"core.conditionPreview.hasHiddenBlocks.value\"\n class=\"tpl:absolute tpl:left-1/2 tpl:top-2 tpl:-translate-x-1/2 tpl:inline-flex tpl:items-center tpl:gap-1.5 tpl:rounded-full tpl:border tpl:px-3.5 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:whitespace-nowrap tpl:shadow-md tpl:hover:opacity-80\"\n style=\"\n background-color: var(--tpl-warning-light);\n color: var(--tpl-warning);\n border-color: var(--tpl-warning);\n backdrop-filter: blur(8px);\n \"\n @click=\"core.conditionPreview.reset()\"\n >\n <RotateCcw :size=\"13\" :stroke-width=\"2\" />\n {{ core.t.blockSettings.restoreHiddenBlocks }}\n </button>\n </Transition>\n </div>\n <main class=\"tpl-main tpl:flex tpl:justify-center tpl:p-8\">\n <Canvas\n :viewport=\"editor.state.viewport\"\n :content=\"editor.content.value\"\n :selected-block-id=\"editor.state.selectedBlockId\"\n :dark-mode=\"editor.state.darkMode\"\n :preview-mode=\"editor.state.previewMode\"\n :locked-blocks=\"collaboration?.lockedBlocks.value ?? undefined\"\n @select-block=\"editor.selectBlock\"\n @open-ai-chat=\"panelState.aiChatOpen.value = true\"\n @open-design-reference=\"panelState.designReferenceOpen.value = true\"\n />\n </main>\n </div>\n\n <EditorFooter\n v-if=\"config.branding !== false && !featureFlags.isWhiteLabeled.value\"\n :position-class=\"[\n editor.state.previewMode\n ? 'tpl:left-0 tpl:right-0'\n : panelState.rightPanelOpen.value\n ? 'tpl:left-12 tpl:right-[680px]'\n : 'tpl:left-12 tpl:right-[320px]',\n ]\"\n />\n\n <!-- Keyboard reorder announcement region (visually hidden, screen-reader live) -->\n <div\n class=\"tpl-sr-only\"\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n :aria-label=\"core.t.landmarks.reorderAnnouncements\"\n >\n {{ core.keyboardReorder.announcement.value }}\n </div>\n\n <!-- Right sidebar — persisted with v-show -->\n <RightSidebar\n v-show=\"!editor.state.previewMode\"\n :selected-block=\"editor.selectedBlock.value\"\n :settings=\"editor.content.value.settings\"\n :shifted-left=\"panelState.rightPanelOpen.value\"\n @update-block=\"\n (updates) => editor.updateBlock(editor.selectedBlock.value!.id, updates)\n \"\n @delete-block=\"\n core.blockActions.deleteBlock(editor.selectedBlock.value!.id)\n \"\n @duplicate-block=\"\n core.blockActions.duplicateBlock(editor.selectedBlock.value!)\n \"\n @update-settings=\"editor.updateSettings\"\n />\n\n <!-- Cloud sidebars + modals — only mount after cloud init completes -->\n <CloudPanels\n v-if=\"!isInitializing && isAuthReady\"\n ref=\"cloudPanelsRef\"\n :config=\"props.config\"\n :editor=\"editor\"\n :core=\"core\"\n :panel-state=\"panelState\"\n :plan-config-instance=\"planConfigInstance\"\n :test-email=\"testEmail\"\n :media-lib=\"mediaLib\"\n :saved-modules-headless=\"savedModulesHeadless\"\n :show-save-module-dialog=\"showSaveModuleDialog\"\n :save-module-pre-selected-block-id=\"saveModulePreSelectedBlockId\"\n :show-module-browser-modal=\"showModuleBrowserModal\"\n @update:show-save-module-dialog=\"showSaveModuleDialog = $event\"\n @update:save-module-pre-selected-block-id=\"\n saveModulePreSelectedBlockId = $event\n \"\n @update:show-module-browser-modal=\"showModuleBrowserModal = $event\"\n @send-test-email=\"handleSendTestEmail\"\n @module-insert=\"handleModuleInsert\"\n />\n\n <!-- Popover mount — Teleport target for toolbars, link dialog, modal.\n Replaces the historical body-level teleport pattern so popups\n render inside the editor's effective DOM root (shadow-aware). -->\n <div\n :ref=\"(el) => (core.popoverRoot.value = el as HTMLElement | null)\"\n class=\"tpl-popover-root\"\n />\n\n <!-- Built-in merge tag picker modal. Reads picker state via injection;\n renders nothing until `picker.isOpen` flips true. -->\n <MergeTagPickerModal />\n\n <!-- Built-in logic picker modal (standalone logic feature). -->\n <LogicTagPickerModal />\n\n <!-- Small-screen gate (#235). Last child + a literal z-index above the\n chrome and `.tpl-popover-root`, so the opaque notice covers everything\n below the breakpoint. -->\n <SmallScreenNotice v-if=\"showSmallScreenNotice\" />\n </div>\n</template>\n\n<style scoped>\n.tpl-restore-btn-enter-active {\n transition:\n opacity 200ms cubic-bezier(0.16, 1, 0.3, 1),\n transform 200ms cubic-bezier(0.16, 1, 0.3, 1);\n}\n\n.tpl-restore-btn-leave-active {\n transition:\n opacity 150ms ease-in,\n transform 150ms ease-in;\n}\n\n.tpl-restore-btn-enter-from,\n.tpl-restore-btn-leave-to {\n opacity: 0;\n transform: translateY(-8px) scale(0.9);\n}\n\n.tpl-restore-btn-enter-to,\n.tpl-restore-btn-leave-from {\n opacity: 1;\n transform: translateY(0) scale(1);\n}\n</style>\n"],"mappings":";;;;;;AAiDA,SAAgB,GACd,GAC0B;CAC1B,IAAM,EAAE,gBAAa,WAAQ,YAAS,qBAAkB,aAAU,eAChE,GAEI,IAA0B,EAC9B,IACF,GACM,IAAqB,EAA6B,IAAI,GACtD,IAAuB,EAA4B,IAAI,GAKzD,IAAY;CAChB,QAAqB;EACnB,IAAY;CACd,CAAC;CAED,IAAM,IAAuB,QACrB,EAAmB,UAAU,IACrC,GACM,IAA2B,QACzB,EAAwB,OAAO,UAAU,SAAS,CAAC,CAC3D,GACM,IAA2B,QACzB,EAAwB,OAAO,UAAU,SAAS,EAC1D,GACM,IAA6B,QAC3B,EAAwB,OAAO,YAAY,SAAS,EAC5D;CAEA,SAAS,IAA4B;EACnC,AAAI,EAAO,MAAM,UAAU,MAAM,CAAC,EAAwB,UACxD,EAAwB,QAAQ,EAAmB;GACjD;GACA,YAAY,EAAO,MAAM,SAAS;GAClC,WAAW;GACX;EACF,CAAC,GACD,EAAwB,MAAM,cAAc;CAEhD;CAEA,SAAS,EAAc,GAA8C;EAGnE,AAFA,EAAO,WAAW,EAAS,SAAS,EAAK,GACzC,EAAQ,MAAM,GACd,EAAiB,MAAM;CACzB;CAEA,eAAe,EACb,GACe;EACX,QAEJ;OAAI,EAAmB,OAAO;IAE5B,AADA,EAAmB,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","../../../../../node_modules/.pnpm/vanilla-colorful@0.7.2/node_modules/vanilla-colorful/lib/utils/math.js","../../../../../node_modules/.pnpm/vanilla-colorful@0.7.2/node_modules/vanilla-colorful/lib/utils/convert.js","../../../../../node_modules/.pnpm/vanilla-colorful@0.7.2/node_modules/vanilla-colorful/lib/utils/compare.js","../../../../../node_modules/.pnpm/vanilla-colorful@0.7.2/node_modules/vanilla-colorful/lib/utils/dom.js","../../../../../node_modules/.pnpm/vanilla-colorful@0.7.2/node_modules/vanilla-colorful/lib/components/slider.js","../../../../../node_modules/.pnpm/vanilla-colorful@0.7.2/node_modules/vanilla-colorful/lib/components/hue.js","../../../../../node_modules/.pnpm/vanilla-colorful@0.7.2/node_modules/vanilla-colorful/lib/components/saturation.js","../../../../../node_modules/.pnpm/vanilla-colorful@0.7.2/node_modules/vanilla-colorful/lib/styles/color-picker.js","../../../../../node_modules/.pnpm/vanilla-colorful@0.7.2/node_modules/vanilla-colorful/lib/styles/hue.js","../../../../../node_modules/.pnpm/vanilla-colorful@0.7.2/node_modules/vanilla-colorful/lib/styles/saturation.js","../../../../../node_modules/.pnpm/vanilla-colorful@0.7.2/node_modules/vanilla-colorful/lib/components/color-picker.js","../../../../../node_modules/.pnpm/vanilla-colorful@0.7.2/node_modules/vanilla-colorful/lib/entrypoints/hex.js","../../../../../node_modules/.pnpm/vanilla-colorful@0.7.2/node_modules/vanilla-colorful/hex-color-picker.js","../../../src/components/ColorPicker.vue","../../../src/components/ColorPicker.vue"],"sourcesContent":["export const labelClass =\n \"tpl:block tpl:mb-1.5 tpl:text-sm tpl:font-medium tpl:text-[var(--tpl-text-muted)]\";\n\nexport const inputClass =\n \"tpl:w-full tpl:h-10 tpl:px-3.5 tpl:py-1.5 tpl:text-sm tpl:border tpl:rounded-[var(--tpl-radius-sm)] tpl:shadow-xs tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)] tpl:border-[var(--tpl-border)] tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)] tpl:outline-none focus:tpl:border-[var(--tpl-primary)] focus:tpl:shadow-[var(--tpl-ring)] placeholder:tpl:text-[var(--tpl-text-dim)]\";\n\nexport const inputGroupInputClass =\n \"tpl:w-full tpl:h-10 tpl:px-3.5 tpl:py-1.5 tpl:text-sm tpl:border tpl:rounded-l-[var(--tpl-radius-sm)] tpl:rounded-r-none tpl:border-r-0 tpl:shadow-xs tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)] tpl:border-[var(--tpl-border)] tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)] tpl:outline-none focus:tpl:border-[var(--tpl-primary)] focus:tpl:shadow-[var(--tpl-ring)] placeholder:tpl:text-[var(--tpl-text-dim)]\";\n\nexport const inputSuffixClass =\n \"tpl:flex tpl:items-center tpl:px-2.5 tpl:text-xs tpl:border tpl:border-l-0 tpl:text-[var(--tpl-text-dim)] tpl:bg-[var(--tpl-bg-hover)] tpl:border-[var(--tpl-border)] tpl:rounded-r-[var(--tpl-radius-sm)]\";\n\nexport const colorInputClass =\n \"tpl:w-10 tpl:shrink-0 tpl:h-10 tpl:p-0.5 tpl:border tpl:rounded-[var(--tpl-radius-sm)] tpl:cursor-pointer tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)]\";\n\nexport const colorTextClass =\n \"tpl:flex-1 tpl:h-10 tpl:px-3.5 tpl:py-1.5 tpl:text-xs tpl:font-mono tpl:border tpl:rounded-[var(--tpl-radius-sm)] tpl:shadow-xs tpl:text-[var(--tpl-text)] tpl:bg-[var(--tpl-bg)] tpl:border-[var(--tpl-border)] tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)] tpl:outline-none focus:tpl:border-[var(--tpl-primary)] focus:tpl:shadow-[var(--tpl-ring)]\";\n\nexport const btnClass =\n \"tpl:flex-1 tpl:px-2.5 tpl:py-[7px] tpl:text-sm tpl:font-medium tpl:cursor-pointer tpl:flex tpl:items-center tpl:justify-center tpl:rounded-[var(--tpl-radius-sm)] tpl:text-[var(--tpl-text-muted)] tpl:bg-transparent tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)] hover:tpl:bg-[var(--tpl-bg-hover)] hover:tpl:text-[var(--tpl-text)]\";\n\nexport const btnActiveClass =\n \"tpl:flex-1 tpl:px-2.5 tpl:py-[7px] tpl:text-sm tpl:font-medium tpl:cursor-pointer tpl:flex tpl:items-center tpl:justify-center tpl:rounded-[var(--tpl-radius-sm)] tpl:text-[var(--tpl-primary)] tpl:bg-[var(--tpl-primary-light)]\";\n\nexport const cardClass =\n \"tpl:rounded-[var(--tpl-radius)] tpl:bg-[var(--tpl-bg-elevated)] tpl:p-4 tpl:border tpl:border-[var(--tpl-border)] tpl:transition-colors tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)] hover:tpl:bg-[var(--tpl-bg-hover)]\";\n\nexport const outlineBtnClass =\n \"tpl:px-3 tpl:py-1.5 tpl:text-sm tpl:font-medium tpl:border tpl:cursor-pointer tpl:inline-flex tpl:items-center tpl:gap-1.5 tpl:rounded-[var(--tpl-radius-sm)] tpl:text-[var(--tpl-primary)] tpl:bg-transparent tpl:border-[var(--tpl-primary)] tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)] hover:tpl:bg-[var(--tpl-primary)] hover:tpl:text-[var(--tpl-bg)]\";\n\nexport const removeItemBtnClass =\n \"tpl:flex tpl:size-8 tpl:shrink-0 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-md tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:text-[var(--tpl-text-muted)] tpl:transition-all tpl:duration-150 tpl:hover:border-[var(--tpl-danger)] tpl:hover:bg-[var(--tpl-danger-light)] tpl:hover:text-[var(--tpl-danger)]\";\n\nexport const addItemBtnClass =\n \"tpl:flex tpl:w-full tpl:items-center tpl:justify-center tpl:gap-1.5 tpl:rounded-md tpl:border tpl:border-dashed tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:px-3 tpl:py-2 tpl:text-xs tpl:font-medium tpl:text-[var(--tpl-text-muted)] tpl:transition-all tpl:duration-150 tpl:hover:border-[var(--tpl-primary)] tpl:hover:text-[var(--tpl-primary)]\";\n\nexport const monoTextareaClass =\n \"tpl:w-full tpl:resize-y tpl:rounded-md tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:px-2.5 tpl:py-2 tpl:font-mono tpl:text-xs tpl:text-[var(--tpl-text)] tpl:outline-none tpl:transition-all tpl:duration-150 tpl:placeholder:text-[var(--tpl-text-dim)] tpl:focus:border-[var(--tpl-primary)] tpl:focus:shadow-[0_0_0_3px_var(--tpl-primary-light)]\";\n\nexport const headerBtnClass =\n \"tpl-btn tpl:inline-flex tpl:items-center tpl:gap-1.5 tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:px-3.5 tpl:py-2 tpl:text-sm tpl:font-medium tpl:whitespace-nowrap tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)] hover:tpl:bg-[var(--tpl-primary)] hover:tpl:text-[var(--tpl-bg)] tpl:disabled:cursor-not-allowed tpl:disabled:opacity-50\";\n\n// Rich text toolbar presets\nexport const FONT_SIZE_OPTIONS = [\n \"10px\",\n \"12px\",\n \"14px\",\n \"16px\",\n \"18px\",\n \"20px\",\n \"24px\",\n \"28px\",\n \"32px\",\n \"36px\",\n \"48px\",\n \"64px\",\n];\n\nexport const LINE_HEIGHT_OPTIONS = [\n \"1\",\n \"1.2\",\n \"1.4\",\n \"1.5\",\n \"1.6\",\n \"1.8\",\n \"2\",\n \"2.5\",\n];\n\nexport const LETTER_SPACING_OPTIONS = [\n { label: \"Normal\", value: \"normal\" },\n { label: \"-0.5px\", value: \"-0.5px\" },\n { label: \"0.5px\", value: \"0.5px\" },\n { label: \"1px\", value: \"1px\" },\n { label: \"1.5px\", value: \"1.5px\" },\n { label: \"2px\", value: \"2px\" },\n { label: \"3px\", value: \"3px\" },\n];\n\n// Default color constants\nexport const DEFAULT_TEXT_COLOR = \"#000000\";\nexport const DEFAULT_BG_COLOR = \"#ffffff\";\nexport const DEFAULT_HIGHLIGHT_COLOR = \"#ffff00\";\nexport const DEFAULT_TABLE_ROW_BG = \"#f2f2f2\";\n","// Clamps a value between an upper and lower bound.\n// We use ternary operators because it makes the minified code\n// 2 times shorter then `Math.min(Math.max(a,b),c)`\nexport const clamp = (number, min = 0, max = 1) => {\n return number > max ? max : number < min ? min : number;\n};\nexport const round = (number, digits = 0, base = Math.pow(10, digits)) => {\n return Math.round(base * number) / base;\n};\n//# sourceMappingURL=math.js.map","import { round } from './math.js';\n/**\n * Valid CSS <angle> units.\n * https://developer.mozilla.org/en-US/docs/Web/CSS/angle\n */\nconst angleUnits = {\n grad: 360 / 400,\n turn: 360,\n rad: 360 / (Math.PI * 2)\n};\nexport const hexToHsva = (hex) => rgbaToHsva(hexToRgba(hex));\nexport const hexToRgba = (hex) => {\n if (hex[0] === '#')\n hex = hex.substring(1);\n if (hex.length < 6) {\n return {\n r: parseInt(hex[0] + hex[0], 16),\n g: parseInt(hex[1] + hex[1], 16),\n b: parseInt(hex[2] + hex[2], 16),\n a: hex.length === 4 ? round(parseInt(hex[3] + hex[3], 16) / 255, 2) : 1\n };\n }\n return {\n r: parseInt(hex.substring(0, 2), 16),\n g: parseInt(hex.substring(2, 4), 16),\n b: parseInt(hex.substring(4, 6), 16),\n a: hex.length === 8 ? round(parseInt(hex.substring(6, 8), 16) / 255, 2) : 1\n };\n};\nexport const parseHue = (value, unit = 'deg') => {\n return Number(value) * (angleUnits[unit] || 1);\n};\nexport const hslaStringToHsva = (hslString) => {\n const matcher = /hsla?\\(?\\s*(-?\\d*\\.?\\d+)(deg|rad|grad|turn)?[,\\s]+(-?\\d*\\.?\\d+)%?[,\\s]+(-?\\d*\\.?\\d+)%?,?\\s*[/\\s]*(-?\\d*\\.?\\d+)?(%)?\\s*\\)?/i;\n const match = matcher.exec(hslString);\n if (!match)\n return { h: 0, s: 0, v: 0, a: 1 };\n return hslaToHsva({\n h: parseHue(match[1], match[2]),\n s: Number(match[3]),\n l: Number(match[4]),\n a: match[5] === undefined ? 1 : Number(match[5]) / (match[6] ? 100 : 1)\n });\n};\nexport const hslStringToHsva = hslaStringToHsva;\nexport const hslaToHsva = ({ h, s, l, a }) => {\n s *= (l < 50 ? l : 100 - l) / 100;\n return {\n h: h,\n s: s > 0 ? ((2 * s) / (l + s)) * 100 : 0,\n v: l + s,\n a\n };\n};\nexport const hsvaToHex = (hsva) => rgbaToHex(hsvaToRgba(hsva));\nexport const hsvaToHsla = ({ h, s, v, a }) => {\n const hh = ((200 - s) * v) / 100;\n return {\n h: round(h),\n s: round(hh > 0 && hh < 200 ? ((s * v) / 100 / (hh <= 100 ? hh : 200 - hh)) * 100 : 0),\n l: round(hh / 2),\n a: round(a, 2)\n };\n};\nexport const hsvaToHsvString = (hsva) => {\n const { h, s, v } = roundHsva(hsva);\n return `hsv(${h}, ${s}%, ${v}%)`;\n};\nexport const hsvaToHsvaString = (hsva) => {\n const { h, s, v, a } = roundHsva(hsva);\n return `hsva(${h}, ${s}%, ${v}%, ${a})`;\n};\nexport const hsvaToHslString = (hsva) => {\n const { h, s, l } = hsvaToHsla(hsva);\n return `hsl(${h}, ${s}%, ${l}%)`;\n};\nexport const hsvaToHslaString = (hsva) => {\n const { h, s, l, a } = hsvaToHsla(hsva);\n return `hsla(${h}, ${s}%, ${l}%, ${a})`;\n};\nexport const hsvaToRgba = ({ h, s, v, a }) => {\n h = (h / 360) * 6;\n s = s / 100;\n v = v / 100;\n const hh = Math.floor(h), b = v * (1 - s), c = v * (1 - (h - hh) * s), d = v * (1 - (1 - h + hh) * s), module = hh % 6;\n return {\n r: round([v, c, b, b, d, v][module] * 255),\n g: round([d, v, v, c, b, b][module] * 255),\n b: round([b, b, d, v, v, c][module] * 255),\n a: round(a, 2)\n };\n};\nexport const hsvaToRgbString = (hsva) => {\n const { r, g, b } = hsvaToRgba(hsva);\n return `rgb(${r}, ${g}, ${b})`;\n};\nexport const hsvaToRgbaString = (hsva) => {\n const { r, g, b, a } = hsvaToRgba(hsva);\n return `rgba(${r}, ${g}, ${b}, ${a})`;\n};\nexport const hsvaStringToHsva = (hsvString) => {\n const matcher = /hsva?\\(?\\s*(-?\\d*\\.?\\d+)(deg|rad|grad|turn)?[,\\s]+(-?\\d*\\.?\\d+)%?[,\\s]+(-?\\d*\\.?\\d+)%?,?\\s*[/\\s]*(-?\\d*\\.?\\d+)?(%)?\\s*\\)?/i;\n const match = matcher.exec(hsvString);\n if (!match)\n return { h: 0, s: 0, v: 0, a: 1 };\n return roundHsva({\n h: parseHue(match[1], match[2]),\n s: Number(match[3]),\n v: Number(match[4]),\n a: match[5] === undefined ? 1 : Number(match[5]) / (match[6] ? 100 : 1)\n });\n};\nexport const hsvStringToHsva = hsvaStringToHsva;\nexport const rgbaStringToHsva = (rgbaString) => {\n const matcher = /rgba?\\(?\\s*(-?\\d*\\.?\\d+)(%)?[,\\s]+(-?\\d*\\.?\\d+)(%)?[,\\s]+(-?\\d*\\.?\\d+)(%)?,?\\s*[/\\s]*(-?\\d*\\.?\\d+)?(%)?\\s*\\)?/i;\n const match = matcher.exec(rgbaString);\n if (!match)\n return { h: 0, s: 0, v: 0, a: 1 };\n return rgbaToHsva({\n r: Number(match[1]) / (match[2] ? 100 / 255 : 1),\n g: Number(match[3]) / (match[4] ? 100 / 255 : 1),\n b: Number(match[5]) / (match[6] ? 100 / 255 : 1),\n a: match[7] === undefined ? 1 : Number(match[7]) / (match[8] ? 100 : 1)\n });\n};\nexport const rgbStringToHsva = rgbaStringToHsva;\nconst format = (number) => {\n const hex = number.toString(16);\n return hex.length < 2 ? '0' + hex : hex;\n};\nexport const rgbaToHex = ({ r, g, b, a }) => {\n const alphaHex = a < 1 ? format(round(a * 255)) : '';\n return '#' + format(r) + format(g) + format(b) + alphaHex;\n};\nexport const rgbaToHsva = ({ r, g, b, a }) => {\n const max = Math.max(r, g, b);\n const delta = max - Math.min(r, g, b);\n // prettier-ignore\n const hh = delta\n ? max === r\n ? (g - b) / delta\n : max === g\n ? 2 + (b - r) / delta\n : 4 + (r - g) / delta\n : 0;\n return {\n h: round(60 * (hh < 0 ? hh + 6 : hh)),\n s: round(max ? (delta / max) * 100 : 0),\n v: round((max / 255) * 100),\n a\n };\n};\nexport const roundHsva = (hsva) => ({\n h: round(hsva.h),\n s: round(hsva.s),\n v: round(hsva.v),\n a: round(hsva.a, 2)\n});\nexport const rgbaToRgb = ({ r, g, b }) => ({ r, g, b });\nexport const hslaToHsl = ({ h, s, l }) => ({ h, s, l });\nexport const hsvaToHsv = (hsva) => {\n const { h, s, v } = roundHsva(hsva);\n return { h, s, v };\n};\n//# sourceMappingURL=convert.js.map","import { hexToRgba } from './convert.js';\nexport const equalColorObjects = (first, second) => {\n if (first === second)\n return true;\n for (const prop in first) {\n // The following allows for a type-safe calling of this function (first & second have to be HSL, HSV, or RGB)\n // with type-unsafe iterating over object keys. TS does not allow this without an index (`[key: string]: number`)\n // on an object to define how iteration is normally done. To ensure extra keys are not allowed on our types,\n // we must cast our object to unknown (as RGB demands `r` be a key, while `Record<string, x>` does not care if\n // there is or not), and then as a type TS can iterate over.\n if (first[prop] !==\n second[prop])\n return false;\n }\n return true;\n};\nexport const equalColorString = (first, second) => {\n return first.replace(/\\s/g, '') === second.replace(/\\s/g, '');\n};\nexport const equalHex = (first, second) => {\n if (first.toLowerCase() === second.toLowerCase())\n return true;\n // To compare colors like `#FFF` and `ffffff` we convert them into RGB objects\n return equalColorObjects(hexToRgba(first), hexToRgba(second));\n};\n//# sourceMappingURL=compare.js.map","const cache = {};\nexport const tpl = (html) => {\n let template = cache[html];\n if (!template) {\n template = document.createElement('template');\n template.innerHTML = html;\n cache[html] = template;\n }\n return template;\n};\nexport const fire = (target, type, detail) => {\n target.dispatchEvent(new CustomEvent(type, {\n bubbles: true,\n detail\n }));\n};\n//# sourceMappingURL=dom.js.map","import { fire, tpl } from '../utils/dom.js';\nimport { clamp } from '../utils/math.js';\nlet hasTouched = false;\n// Check if an event was triggered by touch\nconst isTouch = (e) => 'touches' in e;\n// Prevent mobile browsers from handling mouse events (conflicting with touch ones).\n// If we detected a touch interaction before, we prefer reacting to touch events only.\nconst isValid = (event) => {\n if (hasTouched && !isTouch(event))\n return false;\n if (!hasTouched)\n hasTouched = isTouch(event);\n return true;\n};\nconst pointerMove = (target, event) => {\n const pointer = isTouch(event) ? event.touches[0] : event;\n const rect = target.el.getBoundingClientRect();\n fire(target.el, 'move', target.getMove({\n x: clamp((pointer.pageX - (rect.left + window.pageXOffset)) / rect.width),\n y: clamp((pointer.pageY - (rect.top + window.pageYOffset)) / rect.height)\n }));\n};\nconst keyMove = (target, event) => {\n // We use `keyCode` instead of `key` to reduce the size of the library.\n const keyCode = event.keyCode;\n // Ignore all keys except arrow ones, Page Up, Page Down, Home and End.\n if (keyCode > 40 || (target.xy && keyCode < 37) || keyCode < 33)\n return;\n // Do not scroll page by keys when color picker element has focus.\n event.preventDefault();\n // Send relative offset to the parent component.\n fire(target.el, 'move', target.getMove({\n x: keyCode === 39 // Arrow Right\n ? 0.01\n : keyCode === 37 // Arrow Left\n ? -0.01\n : keyCode === 34 // Page Down\n ? 0.05\n : keyCode === 33 // Page Up\n ? -0.05\n : keyCode === 35 // End\n ? 1\n : keyCode === 36 // Home\n ? -1\n : 0,\n y: keyCode === 40 // Arrow down\n ? 0.01\n : keyCode === 38 // Arrow Up\n ? -0.01\n : 0\n }, true));\n};\nexport class Slider {\n constructor(root, part, aria, xy) {\n const template = tpl(`<div role=\"slider\" tabindex=\"0\" part=\"${part}\" ${aria}><div part=\"${part}-pointer\"></div></div>`);\n root.appendChild(template.content.cloneNode(true));\n const el = root.querySelector(`[part=${part}]`);\n el.addEventListener('mousedown', this);\n el.addEventListener('touchstart', this);\n el.addEventListener('keydown', this);\n this.el = el;\n this.xy = xy;\n this.nodes = [el.firstChild, el];\n }\n set dragging(state) {\n const toggleEvent = state ? document.addEventListener : document.removeEventListener;\n toggleEvent(hasTouched ? 'touchmove' : 'mousemove', this);\n toggleEvent(hasTouched ? 'touchend' : 'mouseup', this);\n }\n handleEvent(event) {\n switch (event.type) {\n case 'mousedown':\n case 'touchstart':\n event.preventDefault();\n // event.button is 0 in mousedown for left button activation\n if (!isValid(event) || (!hasTouched && event.button != 0))\n return;\n this.el.focus();\n pointerMove(this, event);\n this.dragging = true;\n break;\n case 'mousemove':\n case 'touchmove':\n event.preventDefault();\n pointerMove(this, event);\n break;\n case 'mouseup':\n case 'touchend':\n this.dragging = false;\n break;\n case 'keydown':\n keyMove(this, event);\n break;\n }\n }\n style(styles) {\n styles.forEach((style, i) => {\n for (const p in style) {\n this.nodes[i].style.setProperty(p, style[p]);\n }\n });\n }\n}\n//# sourceMappingURL=slider.js.map","import { Slider } from './slider.js';\nimport { hsvaToHslString } from '../utils/convert.js';\nimport { clamp, round } from '../utils/math.js';\nexport class Hue extends Slider {\n constructor(root) {\n super(root, 'hue', 'aria-label=\"Hue\" aria-valuemin=\"0\" aria-valuemax=\"360\"', false);\n }\n update({ h }) {\n this.h = h;\n this.style([\n {\n left: `${(h / 360) * 100}%`,\n color: hsvaToHslString({ h, s: 100, v: 100, a: 1 })\n }\n ]);\n this.el.setAttribute('aria-valuenow', `${round(h)}`);\n }\n getMove(offset, key) {\n // Hue measured in degrees of the color circle ranging from 0 to 360\n return { h: key ? clamp(this.h + offset.x * 360, 0, 360) : 360 * offset.x };\n }\n}\n//# sourceMappingURL=hue.js.map","import { Slider } from './slider.js';\nimport { hsvaToHslString } from '../utils/convert.js';\nimport { clamp, round } from '../utils/math.js';\nexport class Saturation extends Slider {\n constructor(root) {\n super(root, 'saturation', 'aria-label=\"Color\"', true);\n }\n update(hsva) {\n this.hsva = hsva;\n this.style([\n {\n top: `${100 - hsva.v}%`,\n left: `${hsva.s}%`,\n color: hsvaToHslString(hsva)\n },\n {\n 'background-color': hsvaToHslString({ h: hsva.h, s: 100, v: 100, a: 1 })\n }\n ]);\n this.el.setAttribute('aria-valuetext', `Saturation ${round(hsva.s)}%, Brightness ${round(hsva.v)}%`);\n }\n getMove(offset, key) {\n // Saturation and brightness always fit into [0, 100] range\n return {\n s: key ? clamp(this.hsva.s + offset.x * 100, 0, 100) : offset.x * 100,\n v: key ? clamp(this.hsva.v - offset.y * 100, 0, 100) : Math.round(100 - offset.y * 100)\n };\n }\n}\n//# sourceMappingURL=saturation.js.map","export default `:host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:\"\";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}`;\n//# sourceMappingURL=color-picker.js.map","export default `[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}`;\n//# sourceMappingURL=hue.js.map","export default `[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}`;\n//# sourceMappingURL=saturation.js.map","import { equalColorObjects } from '../utils/compare.js';\nimport { fire, tpl } from '../utils/dom.js';\nimport { Hue } from './hue.js';\nimport { Saturation } from './saturation.js';\nimport css from '../styles/color-picker.js';\nimport hueCss from '../styles/hue.js';\nimport saturationCss from '../styles/saturation.js';\nconst $isSame = Symbol('same');\nconst $color = Symbol('color');\nconst $hsva = Symbol('hsva');\nconst $update = Symbol('update');\nconst $parts = Symbol('parts');\nexport const $css = Symbol('css');\nexport const $sliders = Symbol('sliders');\nexport class ColorPicker extends HTMLElement {\n static get observedAttributes() {\n return ['color'];\n }\n get [$css]() {\n return [css, hueCss, saturationCss];\n }\n get [$sliders]() {\n return [Saturation, Hue];\n }\n get color() {\n return this[$color];\n }\n set color(newColor) {\n if (!this[$isSame](newColor)) {\n const newHsva = this.colorModel.toHsva(newColor);\n this[$update](newHsva);\n this[$color] = newColor;\n }\n }\n constructor() {\n super();\n const template = tpl(`<style>${this[$css].join('')}</style>`);\n const root = this.attachShadow({ mode: 'open' });\n root.appendChild(template.content.cloneNode(true));\n root.addEventListener('move', this);\n this[$parts] = this[$sliders].map((slider) => new slider(root));\n }\n connectedCallback() {\n // A user may set a property on an _instance_ of an element,\n // before its prototype has been connected to this class.\n // If so, we need to run it through the proper class setter.\n if (this.hasOwnProperty('color')) {\n const value = this.color;\n delete this['color'];\n this.color = value;\n }\n else if (!this.color) {\n this.color = this.colorModel.defaultColor;\n }\n }\n attributeChangedCallback(_attr, _oldVal, newVal) {\n const color = this.colorModel.fromAttr(newVal);\n if (!this[$isSame](color)) {\n this.color = color;\n }\n }\n handleEvent(event) {\n // Merge the current HSV color object with updated params.\n const oldHsva = this[$hsva];\n const newHsva = { ...oldHsva, ...event.detail };\n this[$update](newHsva);\n let newColor;\n if (!equalColorObjects(newHsva, oldHsva) &&\n !this[$isSame]((newColor = this.colorModel.fromHsva(newHsva)))) {\n this[$color] = newColor;\n fire(this, 'color-changed', { value: newColor });\n }\n }\n [$isSame](color) {\n return this.color && this.colorModel.equal(color, this.color);\n }\n [$update](hsva) {\n this[$hsva] = hsva;\n this[$parts].forEach((part) => part.update(hsva));\n }\n}\n//# sourceMappingURL=color-picker.js.map","import { ColorPicker } from '../components/color-picker.js';\nimport { hexToHsva, hsvaToHex } from '../utils/convert.js';\nimport { equalHex } from '../utils/compare.js';\nconst colorModel = {\n defaultColor: '#000',\n toHsva: hexToHsva,\n fromHsva: ({ h, s, v }) => hsvaToHex({ h, s, v, a: 1 }),\n equal: equalHex,\n fromAttr: (color) => color\n};\nexport class HexBase extends ColorPicker {\n get colorModel() {\n return colorModel;\n }\n}\n//# sourceMappingURL=hex.js.map","import { HexBase } from './lib/entrypoints/hex.js';\n/**\n * A color picker custom element that uses HEX format.\n *\n * @element hex-color-picker\n *\n * @prop {string} color - Selected color in HEX format.\n * @attr {string} color - Selected color in HEX format.\n *\n * @fires color-changed - Event fired when color property changes.\n *\n * @csspart hue - A hue selector container.\n * @csspart saturation - A saturation selector container\n * @csspart hue-pointer - A hue pointer element.\n * @csspart saturation-pointer - A saturation pointer element.\n */\nexport class HexColorPicker extends HexBase {\n}\ncustomElements.define('hex-color-picker', HexColorPicker);\n//# sourceMappingURL=hex-color-picker.js.map","<script setup lang=\"ts\">\nimport { computed, inject, ref } from \"vue\";\nimport { onClickOutside } from \"@vueuse/core\";\nimport { X } from \"@lucide/vue\";\nimport { useI18n } from \"../composables/useI18n\";\nimport { usePopoverRoot } from \"../composables/usePopoverRoot\";\nimport { colorTextClass } from \"../constants/styleConstants\";\nimport { normalizeColorToHex } from \"../utils/color\";\nimport { THEME_STYLES_KEY, UI_THEME_KEY } from \"../keys\";\nimport \"vanilla-colorful\";\n\nconst props = withDefaults(\n defineProps<{\n modelValue: string;\n placeholder?: string;\n /**\n * Color the picker wheel opens on while the field is unset. It only\n * positions the wheel — it never paints the swatch or fills the input,\n * so an unset field still reads as \"not set\".\n */\n seedColor?: string;\n swatchOnly?: boolean;\n disabled?: boolean;\n /**\n * Swatch trigger size. `\"md\"` (40px) is the default for sidebar panels;\n * `\"sm\"` (32px) matches the compact rich-text floating toolbar controls.\n */\n size?: \"sm\" | \"md\";\n /**\n * Accessible label (and hover title) for the swatch trigger. Falls back to\n * the generic \"pick color\" label. Set it when several pickers sit side by\n * side and must be told apart (e.g. text color vs highlight in the toolbar).\n */\n ariaLabel?: string;\n }>(),\n {\n placeholder: \"\",\n seedColor: \"#ffffff\",\n swatchOnly: false,\n disabled: false,\n size: \"md\",\n ariaLabel: \"\",\n },\n);\n\nconst emit = defineEmits<{\n (e: \"update:modelValue\", value: string): void;\n}>();\n\nconst { t } = useI18n();\n\nconst open = ref(false);\nconst popoverRef = ref<HTMLElement>();\nconst swatchRef = ref<HTMLElement>();\n\n// Whether the picker emitted a real change during the current pointer gesture.\n// vanilla-colorful only fires `color-changed` when the chosen color differs\n// from the one the wheel was seeded with — so picking a color equal to the\n// seed emits nothing. When the field is still unset after such a no-change\n// pick, we commit the seed ourselves on pointerup so the value persists\n// (otherwise e.g. white on an empty background can never be set — issue #282).\nconst pickerTouched = ref(false);\n\nonClickOutside(\n popoverRef,\n () => {\n open.value = false;\n },\n { ignore: [swatchRef] },\n);\n\nconst isUnset = computed(() => !props.modelValue);\n\n// vanilla-colorful and the hex field are hex-only, but a stored value read back\n// from the DOM (e.g. a TipTap textStyle/highlight color) can be `rgb(...)`. Show\n// and seed the wheel with the hex form; the raw value still drives unset/emit.\nconst displayValue = computed(() => normalizeColorToHex(props.modelValue));\n\n// The color handed to the wheel: the stored value, or the seed when unset.\nconst seed = computed(() =>\n normalizeColorToHex(props.modelValue || props.seedColor),\n);\n\n// The clear (×) sits inside whichever hex field is active — the inline field in\n// full mode, or the popover field in swatch-only mode — shown only when a value\n// is set. Not gated on swatchOnly: each field renders only in its own mode.\nconst showClear = computed(() => !props.disabled && !isUnset.value);\n\nfunction onPickerChange(e: Event): void {\n pickerTouched.value = true;\n emit(\"update:modelValue\", (e as CustomEvent).detail.value);\n}\n\nfunction onPickerPointerDown(): void {\n pickerTouched.value = false;\n}\n\nfunction onPickerPointerUp(): void {\n // A deliberate pick equal to the seed fires no `color-changed`; commit it.\n if (!pickerTouched.value && isUnset.value) {\n emit(\"update:modelValue\", seed.value);\n }\n}\n\nfunction onTextInput(e: Event): void {\n emit(\"update:modelValue\", (e.target as HTMLInputElement).value);\n}\n\nfunction clear(): void {\n emit(\"update:modelValue\", \"\");\n}\n\n// The popover teleports to the shared popover root so it escapes any clipping /\n// overflow-hidden ancestor (e.g. the link dialog's card, where clicking the\n// clipped wheel landed on the backdrop and closed the modal). Position is\n// captured from the swatch on open and applied as `fixed`.\nconst popoverRoot = usePopoverRoot();\nconst themeStyles = inject(THEME_STYLES_KEY, null);\nconst tplUiTheme = inject(UI_THEME_KEY, null);\nconst popoverPosition = ref({ top: 0, left: 0 });\n\nfunction toggleOpen(): void {\n if (props.disabled) return;\n if (!open.value) {\n const rect = swatchRef.value?.getBoundingClientRect();\n if (rect) {\n const PICKER_HEIGHT = 240; // wheel + hue slider + padding, approx\n const gap = 8;\n // Open below the swatch, or flip above when it would overflow the viewport\n // bottom — the popover is `fixed`, so it can't scroll into view otherwise.\n const fitsBelow = rect.bottom + gap + PICKER_HEIGHT <= window.innerHeight;\n popoverPosition.value = {\n top: fitsBelow\n ? rect.bottom + gap\n : Math.max(gap, rect.top - PICKER_HEIGHT - gap),\n left: rect.left,\n };\n }\n }\n open.value = !open.value;\n}\n</script>\n\n<template>\n <div\n :class=\"[\n 'tpl:flex tpl:items-center tpl:gap-2 tpl:relative',\n disabled && 'tpl:opacity-60 tpl:cursor-not-allowed',\n ]\"\n >\n <button\n ref=\"swatchRef\"\n type=\"button\"\n :disabled=\"disabled\"\n :aria-label=\"ariaLabel || t.colorPicker.pickColor\"\n :title=\"ariaLabel || undefined\"\n :aria-expanded=\"open\"\n :class=\"[\n 'tpl:shrink-0 tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:p-0.5 tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)]',\n disabled ? 'tpl:cursor-not-allowed' : 'tpl:cursor-pointer',\n open\n ? 'tpl:border-[var(--tpl-primary)] tpl:shadow-[var(--tpl-ring)]'\n : !disabled && 'hover:tpl:border-[var(--tpl-text-dim)]',\n size === 'sm' ? 'tpl:size-8' : 'tpl:size-10',\n ]\"\n @click=\"toggleOpen\"\n >\n <span\n class=\"tpl:block tpl:size-full tpl:rounded-[calc(var(--tpl-radius-sm)-2px)]\"\n :class=\"{ 'tpl-color-swatch-empty': isUnset }\"\n :style=\"isUnset ? undefined : { backgroundColor: displayValue }\"\n />\n </button>\n <div v-if=\"!swatchOnly\" class=\"tpl:relative tpl:flex-1\">\n <input\n type=\"text\"\n :class=\"[colorTextClass, 'tpl:w-full']\"\n :style=\"showClear ? { paddingRight: '2.25rem' } : undefined\"\n :value=\"displayValue\"\n :placeholder=\"placeholder || t.colorPicker.notSet\"\n :disabled=\"disabled\"\n :aria-label=\"t.colorPicker.hexValue\"\n @input=\"onTextInput\"\n />\n <button\n v-if=\"showClear\"\n type=\"button\"\n :aria-label=\"t.colorPicker.clear\"\n :title=\"t.colorPicker.clear\"\n class=\"tpl:absolute tpl:right-2 tpl:top-1/2 tpl:flex tpl:size-6 tpl:-translate-y-1/2 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-[var(--tpl-radius-sm)] tpl:text-[var(--tpl-text-dim)] tpl:transition-colors tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)] hover:tpl:bg-[var(--tpl-bg-hover)] hover:tpl:text-[var(--tpl-text)]\"\n @click=\"clear\"\n >\n <X :size=\"14\" :stroke-width=\"1.5\" />\n </button>\n </div>\n <Teleport :to=\"popoverRoot\" :disabled=\"!popoverRoot\">\n <Transition\n enter-active-class=\"tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)]\"\n enter-from-class=\"tpl:opacity-0 tpl:scale-95 tpl:translate-y-1\"\n enter-to-class=\"tpl:opacity-100 tpl:scale-100 tpl:translate-y-0\"\n leave-active-class=\"tpl:transition-all tpl:duration-[80ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)]\"\n leave-from-class=\"tpl:opacity-100 tpl:scale-100 tpl:translate-y-0\"\n leave-to-class=\"tpl:opacity-0 tpl:scale-95 tpl:translate-y-1\"\n >\n <div\n v-if=\"open\"\n ref=\"popoverRef\"\n :data-tpl-theme=\"tplUiTheme\"\n class=\"tpl-color-popover tpl:fixed tpl:z-modal tpl:rounded-[var(--tpl-radius)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:p-3 tpl:shadow-lg\"\n :style=\"{\n top: `${popoverPosition.top}px`,\n left: `${popoverPosition.left}px`,\n ...themeStyles,\n }\"\n >\n <hex-color-picker\n :color=\"seed\"\n :aria-label=\"t.colorPicker.pickColor\"\n @color-changed=\"onPickerChange\"\n @pointerdown=\"onPickerPointerDown\"\n @pointerup=\"onPickerPointerUp\"\n @keydown.escape=\"open = false\"\n />\n <!-- Swatch-only mode has no inline field beside the swatch, so the\n popover carries the manual hex field (+ inline × clear) — the same\n control as the full-mode sidebar field. It commits on change/Enter,\n NOT @input: in the rich-text toolbar every emit calls\n editor.chain().focus().setColor(), and focusing the canvas mid-type\n would steal focus after the first character. Shown even when unset\n so a first color can be typed; the × appears only once a value is set. -->\n <div v-if=\"swatchOnly\" class=\"tpl:relative tpl:mt-2\">\n <input\n type=\"text\"\n :class=\"[colorTextClass, 'tpl:w-full']\"\n :style=\"showClear ? { paddingRight: '2.25rem' } : undefined\"\n :value=\"displayValue\"\n :placeholder=\"placeholder || t.colorPicker.notSet\"\n :disabled=\"disabled\"\n :aria-label=\"t.colorPicker.hexValue\"\n @change=\"onTextInput\"\n @keydown.enter.prevent=\"\n ($event.target as HTMLInputElement).blur()\n \"\n />\n <button\n v-if=\"showClear\"\n type=\"button\"\n :aria-label=\"t.colorPicker.clear\"\n :title=\"t.colorPicker.clear\"\n class=\"tpl:absolute tpl:right-2 tpl:top-1/2 tpl:flex tpl:size-6 tpl:-translate-y-1/2 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-[var(--tpl-radius-sm)] tpl:text-[var(--tpl-text-dim)] tpl:transition-colors tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)] hover:tpl:bg-[var(--tpl-bg-hover)] hover:tpl:text-[var(--tpl-text)]\"\n @click=\"clear\"\n >\n <X :size=\"14\" :stroke-width=\"1.5\" />\n </button>\n </div>\n </div>\n </Transition>\n </Teleport>\n </div>\n</template>\n\n<style>\nhex-color-picker {\n --hcp-width: 200px;\n}\n\nhex-color-picker::part(hue) {\n border-radius: var(--tpl-radius-sm, 7px);\n}\n\nhex-color-picker::part(saturation) {\n border-radius: var(--tpl-radius-sm, 7px) var(--tpl-radius-sm, 7px) 0 0;\n}\n\n/* Unset swatch: paper with a single thin diagonal slash = \"no color set\".\n A neutral non-color signal — never Signal Amber (intent) or Danger. */\n.tpl-color-swatch-empty {\n background-color: var(--tpl-bg);\n background-image: linear-gradient(\n to top right,\n transparent calc(50% - 0.75px),\n var(--tpl-text-dim) calc(50% - 0.75px),\n var(--tpl-text-dim) calc(50% + 0.75px),\n transparent calc(50% + 0.75px)\n );\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, inject, ref } from \"vue\";\nimport { onClickOutside } from \"@vueuse/core\";\nimport { X } from \"@lucide/vue\";\nimport { useI18n } from \"../composables/useI18n\";\nimport { usePopoverRoot } from \"../composables/usePopoverRoot\";\nimport { colorTextClass } from \"../constants/styleConstants\";\nimport { normalizeColorToHex } from \"../utils/color\";\nimport { THEME_STYLES_KEY, UI_THEME_KEY } from \"../keys\";\nimport \"vanilla-colorful\";\n\nconst props = withDefaults(\n defineProps<{\n modelValue: string;\n placeholder?: string;\n /**\n * Color the picker wheel opens on while the field is unset. It only\n * positions the wheel — it never paints the swatch or fills the input,\n * so an unset field still reads as \"not set\".\n */\n seedColor?: string;\n swatchOnly?: boolean;\n disabled?: boolean;\n /**\n * Swatch trigger size. `\"md\"` (40px) is the default for sidebar panels;\n * `\"sm\"` (32px) matches the compact rich-text floating toolbar controls.\n */\n size?: \"sm\" | \"md\";\n /**\n * Accessible label (and hover title) for the swatch trigger. Falls back to\n * the generic \"pick color\" label. Set it when several pickers sit side by\n * side and must be told apart (e.g. text color vs highlight in the toolbar).\n */\n ariaLabel?: string;\n }>(),\n {\n placeholder: \"\",\n seedColor: \"#ffffff\",\n swatchOnly: false,\n disabled: false,\n size: \"md\",\n ariaLabel: \"\",\n },\n);\n\nconst emit = defineEmits<{\n (e: \"update:modelValue\", value: string): void;\n}>();\n\nconst { t } = useI18n();\n\nconst open = ref(false);\nconst popoverRef = ref<HTMLElement>();\nconst swatchRef = ref<HTMLElement>();\n\n// Whether the picker emitted a real change during the current pointer gesture.\n// vanilla-colorful only fires `color-changed` when the chosen color differs\n// from the one the wheel was seeded with — so picking a color equal to the\n// seed emits nothing. When the field is still unset after such a no-change\n// pick, we commit the seed ourselves on pointerup so the value persists\n// (otherwise e.g. white on an empty background can never be set — issue #282).\nconst pickerTouched = ref(false);\n\nonClickOutside(\n popoverRef,\n () => {\n open.value = false;\n },\n { ignore: [swatchRef] },\n);\n\nconst isUnset = computed(() => !props.modelValue);\n\n// vanilla-colorful and the hex field are hex-only, but a stored value read back\n// from the DOM (e.g. a TipTap textStyle/highlight color) can be `rgb(...)`. Show\n// and seed the wheel with the hex form; the raw value still drives unset/emit.\nconst displayValue = computed(() => normalizeColorToHex(props.modelValue));\n\n// The color handed to the wheel: the stored value, or the seed when unset.\nconst seed = computed(() =>\n normalizeColorToHex(props.modelValue || props.seedColor),\n);\n\n// The clear (×) sits inside whichever hex field is active — the inline field in\n// full mode, or the popover field in swatch-only mode — shown only when a value\n// is set. Not gated on swatchOnly: each field renders only in its own mode.\nconst showClear = computed(() => !props.disabled && !isUnset.value);\n\nfunction onPickerChange(e: Event): void {\n pickerTouched.value = true;\n emit(\"update:modelValue\", (e as CustomEvent).detail.value);\n}\n\nfunction onPickerPointerDown(): void {\n pickerTouched.value = false;\n}\n\nfunction onPickerPointerUp(): void {\n // A deliberate pick equal to the seed fires no `color-changed`; commit it.\n if (!pickerTouched.value && isUnset.value) {\n emit(\"update:modelValue\", seed.value);\n }\n}\n\nfunction onTextInput(e: Event): void {\n emit(\"update:modelValue\", (e.target as HTMLInputElement).value);\n}\n\nfunction clear(): void {\n emit(\"update:modelValue\", \"\");\n}\n\n// The popover teleports to the shared popover root so it escapes any clipping /\n// overflow-hidden ancestor (e.g. the link dialog's card, where clicking the\n// clipped wheel landed on the backdrop and closed the modal). Position is\n// captured from the swatch on open and applied as `fixed`.\nconst popoverRoot = usePopoverRoot();\nconst themeStyles = inject(THEME_STYLES_KEY, null);\nconst tplUiTheme = inject(UI_THEME_KEY, null);\nconst popoverPosition = ref({ top: 0, left: 0 });\n\nfunction toggleOpen(): void {\n if (props.disabled) return;\n if (!open.value) {\n const rect = swatchRef.value?.getBoundingClientRect();\n if (rect) {\n const PICKER_HEIGHT = 240; // wheel + hue slider + padding, approx\n const gap = 8;\n // Open below the swatch, or flip above when it would overflow the viewport\n // bottom — the popover is `fixed`, so it can't scroll into view otherwise.\n const fitsBelow = rect.bottom + gap + PICKER_HEIGHT <= window.innerHeight;\n popoverPosition.value = {\n top: fitsBelow\n ? rect.bottom + gap\n : Math.max(gap, rect.top - PICKER_HEIGHT - gap),\n left: rect.left,\n };\n }\n }\n open.value = !open.value;\n}\n</script>\n\n<template>\n <div\n :class=\"[\n 'tpl:flex tpl:items-center tpl:gap-2 tpl:relative',\n disabled && 'tpl:opacity-60 tpl:cursor-not-allowed',\n ]\"\n >\n <button\n ref=\"swatchRef\"\n type=\"button\"\n :disabled=\"disabled\"\n :aria-label=\"ariaLabel || t.colorPicker.pickColor\"\n :title=\"ariaLabel || undefined\"\n :aria-expanded=\"open\"\n :class=\"[\n 'tpl:shrink-0 tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:p-0.5 tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)]',\n disabled ? 'tpl:cursor-not-allowed' : 'tpl:cursor-pointer',\n open\n ? 'tpl:border-[var(--tpl-primary)] tpl:shadow-[var(--tpl-ring)]'\n : !disabled && 'hover:tpl:border-[var(--tpl-text-dim)]',\n size === 'sm' ? 'tpl:size-8' : 'tpl:size-10',\n ]\"\n @click=\"toggleOpen\"\n >\n <span\n class=\"tpl:block tpl:size-full tpl:rounded-[calc(var(--tpl-radius-sm)-2px)]\"\n :class=\"{ 'tpl-color-swatch-empty': isUnset }\"\n :style=\"isUnset ? undefined : { backgroundColor: displayValue }\"\n />\n </button>\n <div v-if=\"!swatchOnly\" class=\"tpl:relative tpl:flex-1\">\n <input\n type=\"text\"\n :class=\"[colorTextClass, 'tpl:w-full']\"\n :style=\"showClear ? { paddingRight: '2.25rem' } : undefined\"\n :value=\"displayValue\"\n :placeholder=\"placeholder || t.colorPicker.notSet\"\n :disabled=\"disabled\"\n :aria-label=\"t.colorPicker.hexValue\"\n @input=\"onTextInput\"\n />\n <button\n v-if=\"showClear\"\n type=\"button\"\n :aria-label=\"t.colorPicker.clear\"\n :title=\"t.colorPicker.clear\"\n class=\"tpl:absolute tpl:right-2 tpl:top-1/2 tpl:flex tpl:size-6 tpl:-translate-y-1/2 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-[var(--tpl-radius-sm)] tpl:text-[var(--tpl-text-dim)] tpl:transition-colors tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)] hover:tpl:bg-[var(--tpl-bg-hover)] hover:tpl:text-[var(--tpl-text)]\"\n @click=\"clear\"\n >\n <X :size=\"14\" :stroke-width=\"1.5\" />\n </button>\n </div>\n <Teleport :to=\"popoverRoot\" :disabled=\"!popoverRoot\">\n <Transition\n enter-active-class=\"tpl:transition-all tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)]\"\n enter-from-class=\"tpl:opacity-0 tpl:scale-95 tpl:translate-y-1\"\n enter-to-class=\"tpl:opacity-100 tpl:scale-100 tpl:translate-y-0\"\n leave-active-class=\"tpl:transition-all tpl:duration-[80ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)]\"\n leave-from-class=\"tpl:opacity-100 tpl:scale-100 tpl:translate-y-0\"\n leave-to-class=\"tpl:opacity-0 tpl:scale-95 tpl:translate-y-1\"\n >\n <div\n v-if=\"open\"\n ref=\"popoverRef\"\n :data-tpl-theme=\"tplUiTheme\"\n class=\"tpl-color-popover tpl:fixed tpl:z-modal tpl:rounded-[var(--tpl-radius)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:p-3 tpl:shadow-lg\"\n :style=\"{\n top: `${popoverPosition.top}px`,\n left: `${popoverPosition.left}px`,\n ...themeStyles,\n }\"\n >\n <hex-color-picker\n :color=\"seed\"\n :aria-label=\"t.colorPicker.pickColor\"\n @color-changed=\"onPickerChange\"\n @pointerdown=\"onPickerPointerDown\"\n @pointerup=\"onPickerPointerUp\"\n @keydown.escape=\"open = false\"\n />\n <!-- Swatch-only mode has no inline field beside the swatch, so the\n popover carries the manual hex field (+ inline × clear) — the same\n control as the full-mode sidebar field. It commits on change/Enter,\n NOT @input: in the rich-text toolbar every emit calls\n editor.chain().focus().setColor(), and focusing the canvas mid-type\n would steal focus after the first character. Shown even when unset\n so a first color can be typed; the × appears only once a value is set. -->\n <div v-if=\"swatchOnly\" class=\"tpl:relative tpl:mt-2\">\n <input\n type=\"text\"\n :class=\"[colorTextClass, 'tpl:w-full']\"\n :style=\"showClear ? { paddingRight: '2.25rem' } : undefined\"\n :value=\"displayValue\"\n :placeholder=\"placeholder || t.colorPicker.notSet\"\n :disabled=\"disabled\"\n :aria-label=\"t.colorPicker.hexValue\"\n @change=\"onTextInput\"\n @keydown.enter.prevent=\"\n ($event.target as HTMLInputElement).blur()\n \"\n />\n <button\n v-if=\"showClear\"\n type=\"button\"\n :aria-label=\"t.colorPicker.clear\"\n :title=\"t.colorPicker.clear\"\n class=\"tpl:absolute tpl:right-2 tpl:top-1/2 tpl:flex tpl:size-6 tpl:-translate-y-1/2 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-[var(--tpl-radius-sm)] tpl:text-[var(--tpl-text-dim)] tpl:transition-colors tpl:duration-[120ms] tpl:ease-[cubic-bezier(0.16,1,0.3,1)] hover:tpl:bg-[var(--tpl-bg-hover)] hover:tpl:text-[var(--tpl-text)]\"\n @click=\"clear\"\n >\n <X :size=\"14\" :stroke-width=\"1.5\" />\n </button>\n </div>\n </div>\n </Transition>\n </Teleport>\n </div>\n</template>\n\n<style>\nhex-color-picker {\n --hcp-width: 200px;\n}\n\nhex-color-picker::part(hue) {\n border-radius: var(--tpl-radius-sm, 7px);\n}\n\nhex-color-picker::part(saturation) {\n border-radius: var(--tpl-radius-sm, 7px) var(--tpl-radius-sm, 7px) 0 0;\n}\n\n/* Unset swatch: paper with a single thin diagonal slash = \"no color set\".\n A neutral non-color signal — never Signal Amber (intent) or Danger. */\n.tpl-color-swatch-empty {\n background-color: var(--tpl-bg);\n background-image: linear-gradient(\n to top right,\n transparent calc(50% - 0.75px),\n var(--tpl-text-dim) calc(50% - 0.75px),\n var(--tpl-text-dim) calc(50% + 0.75px),\n transparent calc(50% + 0.75px)\n );\n}\n</style>\n"],"x_google_ignoreList":[1,2,3,4,5,6,7,8,9,10,11,12,13],"mappings":";;;AAAA,IAAa,IACX,qFAEW,IACX,yZAEW,IACX,6bAEW,IACX,8MAKW,IACX,4XAQW,IACX,yOAKW,IACX,+VAEW,IACX,sWAEW,IACX,gXAEW,IACX,mXAGW,IAAoB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAEa,IAAsB;CACjC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAEa,IAAyB;CACpC;EAAE,OAAO;EAAU,OAAO;CAAS;CACnC;EAAE,OAAO;EAAU,OAAO;CAAS;CACnC;EAAE,OA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