@templatical/editor 0.0.2 → 0.0.4

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.
Files changed (143) hide show
  1. package/dist/{AiChatSidebar-XBj5Rw2l.js → AiChatSidebar-CjfhTZwo.js} +1 -1
  2. package/dist/{AiFeatureMenu-my1mZ9DL.js → AiFeatureMenu-K44aZa_P.js} +3 -3
  3. package/dist/CloudEditor-DFyuRxUV.js +926 -0
  4. package/dist/{CollaboratorBar-BZq_Gv38.js → CollaboratorBar-BuCEcdbB.js} +25 -21
  5. package/dist/{CommentsSidebar-D9oxqO6l.js → CommentsSidebar-2lcqMfIP.js} +2 -2
  6. package/dist/{DesignReferenceSidebar-CyHq4SWt.js → DesignReferenceSidebar-CNMu4Zrx.js} +55 -54
  7. package/dist/{ModuleBrowserModal-Cus2Hdwl.js → ModuleBrowserModal-CvQ0xyQf.js} +6 -6
  8. package/dist/{ModulePreviewCanvas-DaByXKY_.js → ModulePreviewCanvas-Be2B3Y07.js} +3 -3
  9. package/dist/ParagraphEditor-CcMPnbDr.js +652 -0
  10. package/dist/{RichTextEditorContent-BRpjJ6SV.js → RichTextEditorContent-CHJlh7HJ.js} +8 -4
  11. package/dist/{SaveModuleDialog-BIZBQrd8.js → SaveModuleDialog-BaaeH5Xm.js} +5 -5
  12. package/dist/{SnapshotHistory-Ds1-QNbx.js → SnapshotHistory-BPfjiuu1.js} +2 -2
  13. package/dist/{TemplateScoringPanel-C8XSk_Ys.js → TemplateScoringPanel-D58A23Vq.js} +3 -3
  14. package/dist/{TestEmailModal-CCVfaFgV.js → TestEmailModal-DIAlB3e_.js} +3 -3
  15. package/dist/{TitleEditor-V4qaEULF.js → TitleEditor-D9DPjQkX.js} +7 -7
  16. package/dist/{TplModal-LT3FXlgs.js → TplModal-CmTSvCY-.js} +2 -2
  17. package/dist/{blockTypeIcons-BujoY5Dl.js → blockTypeIcons-D1RTWOkx.js} +1 -1
  18. package/dist/cdn/chunks/AiChatSidebar-CmPTbTFG.js +2 -0
  19. package/dist/cdn/chunks/AiFeatureMenu-lxVm1RjH.js +59 -0
  20. package/dist/cdn/chunks/AiFeatureMenu-lxVm1RjH.js.map +1 -0
  21. package/dist/cdn/chunks/CloudEditor-Bmp5IlWi.js +900 -0
  22. package/dist/cdn/chunks/CloudEditor-Bmp5IlWi.js.map +1 -0
  23. package/dist/cdn/chunks/CollaboratorBar-D2PKtlOw.js +51 -0
  24. package/dist/cdn/chunks/CollaboratorBar-D2PKtlOw.js.map +1 -0
  25. package/dist/cdn/chunks/CommentsSidebar-BOelj4Ca.js +2 -0
  26. package/dist/cdn/chunks/DesignReferenceSidebar-Bf6rg0A7.js +2 -0
  27. package/dist/cdn/chunks/ModuleBrowserModal-CxDXzkKS.js +195 -0
  28. package/dist/cdn/chunks/ModuleBrowserModal-CxDXzkKS.js.map +1 -0
  29. package/dist/cdn/chunks/ModulePreviewCanvas-DEfHampA.js +107 -0
  30. package/dist/cdn/chunks/ModulePreviewCanvas-DEfHampA.js.map +1 -0
  31. package/dist/cdn/chunks/ParagraphEditor-DHdu6lb3.js +503 -0
  32. package/dist/cdn/chunks/ParagraphEditor-DHdu6lb3.js.map +1 -0
  33. package/dist/cdn/chunks/RichTextEditorContent-DWUzizsC.js +106 -0
  34. package/dist/cdn/chunks/RichTextEditorContent-DWUzizsC.js.map +1 -0
  35. package/dist/cdn/chunks/SaveModuleDialog-DVna2xUl.js +119 -0
  36. package/dist/cdn/chunks/SaveModuleDialog-DVna2xUl.js.map +1 -0
  37. package/dist/cdn/chunks/SnapshotHistory-BFF2SsTN.js +2 -0
  38. package/dist/cdn/chunks/TemplateScoringPanel-gi8wc_m7.js +2 -0
  39. package/dist/cdn/chunks/TestEmailModal-Qtd6aC-6.js +2 -0
  40. package/dist/cdn/chunks/TitleEditor-DDf_OcHS.js +166 -0
  41. package/dist/cdn/chunks/TitleEditor-DDf_OcHS.js.map +1 -0
  42. package/dist/cdn/chunks/_rolldown_dynamic_import_helper-DMEI4TQ3.js +9 -0
  43. package/dist/cdn/chunks/blockTypeIcons-BnobReQm.js +22 -0
  44. package/dist/cdn/chunks/blockTypeIcons-BnobReQm.js.map +1 -0
  45. package/dist/cdn/chunks/de-BB3dgVOc.js +700 -0
  46. package/dist/cdn/chunks/de-BB3dgVOc.js.map +1 -0
  47. package/dist/cdn/chunks/de-BvYD17KT.js +89 -0
  48. package/dist/cdn/chunks/de-BvYD17KT.js.map +1 -0
  49. package/dist/cdn/chunks/dist-B6AUkMyh.js +2 -0
  50. package/dist/cdn/chunks/dist-B878xb_62.js +457 -0
  51. package/dist/cdn/chunks/dist-B878xb_62.js.map +1 -0
  52. package/dist/cdn/chunks/dist-Bf1Op9A1.js +2 -0
  53. package/dist/cdn/chunks/dist-BkETaOfw.js +2 -0
  54. package/dist/cdn/chunks/dist-CJcMnY7o.js +2 -0
  55. package/dist/cdn/chunks/dist-CWsl6S1K.js +2 -0
  56. package/dist/cdn/chunks/dist-CllLxIMQ.js +2 -0
  57. package/dist/cdn/chunks/dist-Cs0wFwdw.js +2 -0
  58. package/dist/cdn/chunks/dist-DLWHlekl.js +2 -0
  59. package/dist/cdn/chunks/dist-DS3_HVpX.js +2 -0
  60. package/dist/cdn/chunks/dist-DTXopj1a.js +2 -0
  61. package/dist/cdn/chunks/dist-DnwLoNLm.js +2 -0
  62. package/dist/cdn/chunks/draggable-BQNU47zu.js +11544 -0
  63. package/dist/cdn/chunks/{draggable-ClUwYCFL.js.map → draggable-BQNU47zu.js.map} +1 -1
  64. package/dist/cdn/chunks/emojiData-BVEJHcNH.js +19 -0
  65. package/dist/cdn/chunks/{emojiData-6fVLNqeH.js.map → emojiData-BVEJHcNH.js.map} +1 -1
  66. package/dist/cdn/chunks/en-CpotcOPr.js +89 -0
  67. package/dist/cdn/chunks/en-CpotcOPr.js.map +1 -0
  68. package/dist/cdn/chunks/en-DeDcpnoS.js +700 -0
  69. package/dist/cdn/chunks/en-DeDcpnoS.js.map +1 -0
  70. package/dist/cdn/chunks/extensions-B_kcV0tK.js +419 -0
  71. package/dist/cdn/chunks/{extensions-BfjbWqOx.js.map → extensions-B_kcV0tK.js.map} +1 -1
  72. package/dist/cdn/chunks/features-ofOGnSC0.js +6700 -0
  73. package/dist/cdn/chunks/features-ofOGnSC0.js.map +1 -0
  74. package/dist/cdn/chunks/icons-bIb7PBOE.js +653 -0
  75. package/dist/cdn/chunks/icons-bIb7PBOE.js.map +1 -0
  76. package/dist/cdn/chunks/liquid.browser-C1VIYISn.js +3272 -0
  77. package/dist/cdn/chunks/liquid.browser-C1VIYISn.js.map +1 -0
  78. package/dist/cdn/chunks/media-library-BIYzV2Y2.js +6005 -0
  79. package/dist/cdn/chunks/media-library-BIYzV2Y2.js.map +1 -0
  80. package/dist/cdn/chunks/pusher-DJPhQnE8.js +2505 -0
  81. package/dist/cdn/chunks/pusher-DJPhQnE8.js.map +1 -0
  82. package/dist/cdn/chunks/readableTextColor-Cd_cgWO_.js +32 -0
  83. package/dist/cdn/chunks/readableTextColor-Cd_cgWO_.js.map +1 -0
  84. package/dist/cdn/chunks/rolldown-runtime-DPITmOBR.js +20 -0
  85. package/dist/cdn/chunks/src-BuW9oYtm.js +494 -0
  86. package/dist/cdn/chunks/src-BuW9oYtm.js.map +1 -0
  87. package/dist/cdn/chunks/styleConstants-1KwsBMxJ.js +57 -0
  88. package/dist/cdn/chunks/{styleConstants-UTJ94gco.js.map → styleConstants-1KwsBMxJ.js.map} +1 -1
  89. package/dist/cdn/chunks/styles-DQFExz-T.js +3222 -0
  90. package/dist/cdn/chunks/styles-DQFExz-T.js.map +1 -0
  91. package/dist/cdn/chunks/tiptap-DplY-S-k.js +14208 -0
  92. package/dist/cdn/chunks/{tiptap-Cya4P9CN.js.map → tiptap-DplY-S-k.js.map} +1 -1
  93. package/dist/cdn/editor.css +2 -1
  94. package/dist/cdn/editor.js +260 -1
  95. package/dist/cdn/editor.js.map +1 -1
  96. package/dist/{de-B4Ob4vCo.js → de-D7TLGIPA.js} +20 -4
  97. package/dist/{dist-DNjZKe2Z.js → dist-BkIys9zn.js} +1 -1
  98. package/dist/{en-YXsspZJG.js → en-DvtiEMwP.js} +20 -4
  99. package/dist/{extensions-BA4NshZQ.js → extensions-DEjfEFhD.js} +3 -3
  100. package/dist/keys-C0MQRs8d.js +10 -0
  101. package/dist/readableTextColor-LDlmVEUv.js +30 -0
  102. package/dist/{styleConstants-CgtFM9hQ.js → styleConstants-D4SOZGBV.js} +53 -2
  103. package/dist/{styles-hQgJKM4i.js → styles-CgLaxDfu.js} +1091 -1069
  104. package/dist/templatical-editor.css +1 -1
  105. package/dist/templatical-editor.js +113 -89
  106. package/dist/templatical-editor.umd.cjs +59 -59
  107. package/dist/{useEditorCore-DVp5qmtC.js → useEditorCore-CjwRMl7K.js} +1185 -1043
  108. package/dist/{useI18n-DzH4KXDk.js → useI18n-D6m7ZUgY.js} +2 -2
  109. package/dist/{useMergeTag-D9zQVE-e.js → useMergeTag-BZ3X0bNr.js} +2 -2
  110. package/package.json +2 -2
  111. package/dist/CloudEditor-BVjgKwq3.js +0 -940
  112. package/dist/ParagraphEditor-BSyk5B6S.js +0 -670
  113. package/dist/cdn/chunks/ParagraphEditor-BkJQO-ZW.js +0 -3
  114. package/dist/cdn/chunks/ParagraphEditor-BkJQO-ZW.js.map +0 -1
  115. package/dist/cdn/chunks/RichTextEditorContent-UGQorJm_.js +0 -2
  116. package/dist/cdn/chunks/RichTextEditorContent-UGQorJm_.js.map +0 -1
  117. package/dist/cdn/chunks/TitleEditor-CC3Adjai.js +0 -3
  118. package/dist/cdn/chunks/TitleEditor-CC3Adjai.js.map +0 -1
  119. package/dist/cdn/chunks/dist-0UheN8rK.js +0 -1
  120. package/dist/cdn/chunks/dist-55mmbGQ9.js +0 -1
  121. package/dist/cdn/chunks/dist-B31mxKyP.js +0 -1
  122. package/dist/cdn/chunks/dist-B5JI9nIg.js +0 -1
  123. package/dist/cdn/chunks/dist-B93vLKhU.js +0 -1
  124. package/dist/cdn/chunks/dist-BDt3FJvj.js +0 -1
  125. package/dist/cdn/chunks/dist-BJRuFHmi.js +0 -1
  126. package/dist/cdn/chunks/dist-BKSzrf0L.js +0 -1
  127. package/dist/cdn/chunks/dist-BL8c5gYQ.js +0 -1
  128. package/dist/cdn/chunks/dist-CYThWMP5.js +0 -1
  129. package/dist/cdn/chunks/dist-DxZbPJYt.js +0 -1
  130. package/dist/cdn/chunks/draggable-ClUwYCFL.js +0 -17
  131. package/dist/cdn/chunks/emojiData-6fVLNqeH.js +0 -2
  132. package/dist/cdn/chunks/extensions-BfjbWqOx.js +0 -2
  133. package/dist/cdn/chunks/icons-vmLJTaJk.js +0 -2
  134. package/dist/cdn/chunks/icons-vmLJTaJk.js.map +0 -1
  135. package/dist/cdn/chunks/rolldown-runtime-BakkzWXw.js +0 -1
  136. package/dist/cdn/chunks/styleConstants-UTJ94gco.js +0 -2
  137. package/dist/cdn/chunks/tiptap-Cya4P9CN.js +0 -145
  138. package/dist/cdn/chunks/useEditorCore-DRhPKq_z.js +0 -2
  139. package/dist/cdn/chunks/useEditorCore-DRhPKq_z.js.map +0 -1
  140. package/dist/cdn/chunks/useMergeTag-CBSlcqnk.js +0 -2
  141. package/dist/cdn/chunks/useMergeTag-CBSlcqnk.js.map +0 -1
  142. package/dist/i18n-ikyi28RU.js +0 -23
  143. package/dist/keys-8B5MFafK.js +0 -4
@@ -0,0 +1,926 @@
1
+ import { S as e, t } from "./useEditorCore-CjwRMl7K.js";
2
+ import { t as n } from "./timeouts-CmBrLeZA.js";
3
+ import { s as r, t as i } from "./dist-CG-vEqSU.js";
4
+ import { b as a, c as o, r as s, s as c, t as l, v as u, x as d } from "./keys-C0MQRs8d.js";
5
+ import { t as f } from "./useI18n-D6m7ZUgY.js";
6
+ import { n as p, t as m } from "./_plugin-vue_export-helper-B1-bu7yR.js";
7
+ import { t as h } from "./check-B7kDuZmP.js";
8
+ import { t as g } from "./circle-alert-E2vYPs5r.js";
9
+ import { a as ee, i as te, n as ne, o as re, r as ie, s as ae, t as oe } from "./styles-CgLaxDfu.js";
10
+ import { t as se } from "./clock-lWIIQA3C.js";
11
+ import { t as ce } from "./loader-circle-BTQQxC3l.js";
12
+ import { t as le } from "./message-circle-Blgm6V_h.js";
13
+ import { t as ue } from "./send-C0ltAQrv.js";
14
+ import { t as de } from "./sparkles-KhBCGlqB.js";
15
+ import { u as _ } from "./styleConstants-D4SOZGBV.js";
16
+ import { Fragment as fe, Transition as v, computed as y, createBlock as b, createCommentVNode as x, createElementBlock as S, createElementVNode as C, createStaticVNode as w, createTextVNode as T, createVNode as E, defineAsyncComponent as D, defineComponent as O, nextTick as pe, normalizeClass as k, normalizeStyle as me, onMounted as he, onScopeDispose as ge, onUnmounted as _e, openBlock as A, provide as j, ref as M, renderList as ve, shallowRef as ye, toDisplayString as N, unref as P, vShow as be, watch as xe, withCtx as F, withDirectives as Se, withModifiers as Ce } from "vue";
17
+ import { cloneBlock as we, isCustomBlock as Te } from "@templatical/types";
18
+ import { AuthManager as Ee, performHealthCheck as De, resolveWebSocketConfig as Oe, useAiConfig as ke, useCollaboration as Ae, useCollaborationBroadcast as je, useCommentListener as Me, useComments as Ne, useEditor as Pe, useExport as Fe, useMcpListener as Ie, usePlanConfig as Le, useSavedModules as Re, useSnapshotHistory as ze, useTemplateScoring as Be, useTestEmail as Ve, useWebSocket as He } from "@templatical/core/cloud";
19
+ var Ue = p("save", [
20
+ ["path", {
21
+ d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
22
+ key: "1c8476"
23
+ }],
24
+ ["path", {
25
+ d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",
26
+ key: "1ydtos"
27
+ }],
28
+ ["path", {
29
+ d: "M7 3v4a1 1 0 0 0 1 1h7",
30
+ key: "t51u73"
31
+ }]
32
+ ]);
33
+ //#endregion
34
+ //#region src/cloud/composables/useSnapshotPreview.ts
35
+ function We(e) {
36
+ let { authManager: t, editor: n, history: r, conditionPreview: i, autoSave: a, onError: o } = e, s = ye(null), c = M(null), l = M(null), u = y(() => c.value !== null), d = y(() => s.value?.snapshots.value ?? []), f = y(() => s.value?.isLoading.value ?? !1), p = y(() => s.value?.isRestoring.value ?? !1);
37
+ function m() {
38
+ n.state.template?.id && !s.value && (s.value = ze({
39
+ authManager: t,
40
+ templateId: n.state.template.id,
41
+ onRestore: h,
42
+ onError: o
43
+ }), s.value.loadSnapshots());
44
+ }
45
+ function h(e) {
46
+ n.setContent(e.content, !1), r.clear(), i.reset();
47
+ }
48
+ async function g(e) {
49
+ if (c.value) {
50
+ c.value = e, n.setContent(e.content, !1);
51
+ return;
52
+ }
53
+ n.state.isDirty && n.hasTemplate() && await n.createSnapshot(), l.value = structuredClone(n.content.value), a?.pause(), c.value = e, n.setContent(e.content, !1);
54
+ }
55
+ async function ee() {
56
+ if (!(!c.value || !s.value)) try {
57
+ await s.value.restoreSnapshot(c.value.id), await s.value.loadSnapshots();
58
+ } finally {
59
+ c.value = null, l.value = null, a?.resume();
60
+ }
61
+ }
62
+ function te() {
63
+ !c.value || !l.value || (n.setContent(l.value, !1), c.value = null, l.value = null, a?.resume());
64
+ }
65
+ async function ne() {
66
+ s.value && await s.value.loadSnapshots();
67
+ }
68
+ return {
69
+ snapshotHistoryInstance: s,
70
+ previewingSnapshot: c,
71
+ contentBeforePreview: l,
72
+ isPreviewingSnapshot: u,
73
+ snapshotHistorySnapshots: d,
74
+ snapshotHistoryIsLoading: f,
75
+ snapshotHistoryIsRestoring: p,
76
+ initSnapshotHistory: m,
77
+ handleRestore: h,
78
+ handleSnapshotNavigate: g,
79
+ confirmRestoreSnapshot: ee,
80
+ cancelPreview: te,
81
+ loadSnapshotHistory: ne
82
+ };
83
+ }
84
+ //#endregion
85
+ //#region src/cloud/composables/useCloudPanelState.ts
86
+ function Ge() {
87
+ let e = M(null), t = y({
88
+ get: () => e.value === "ai-chat",
89
+ set: (t) => e.value = t ? "ai-chat" : null
90
+ }), n = y({
91
+ get: () => e.value === "scoring",
92
+ set: (t) => e.value = t ? "scoring" : null
93
+ }), r = y({
94
+ get: () => e.value === "design-reference",
95
+ set: (t) => e.value = t ? "design-reference" : null
96
+ }), a = y({
97
+ get: () => e.value === "comments",
98
+ set: (t) => e.value = t ? "comments" : null
99
+ }), o = M(!1), s = M(!1), c = M(void 0), l = M(!1), u = M(null), d = y(() => e.value !== null), f = y(() => {
100
+ let t = e.value;
101
+ return t === "ai-chat" || t === "design-reference" || t === "scoring" ? t : null;
102
+ }), p = y(() => l.value || e.value === "ai-chat" || e.value === "design-reference" || e.value === "scoring");
103
+ function m() {
104
+ l.value = !l.value;
105
+ }
106
+ function h(t) {
107
+ l.value = !1, e.value = e.value === t ? null : t;
108
+ }
109
+ return i(u, () => {
110
+ l.value = !1;
111
+ }), {
112
+ activePanel: e,
113
+ aiChatOpen: t,
114
+ scoringPanelOpen: n,
115
+ designReferenceOpen: r,
116
+ commentsOpen: a,
117
+ testEmailModalOpen: o,
118
+ mediaLibraryOpen: s,
119
+ mediaLibraryAccept: c,
120
+ aiMenuOpen: l,
121
+ aiMenuRef: u,
122
+ rightPanelOpen: d,
123
+ activeAiFeature: f,
124
+ aiButtonActive: p,
125
+ toggleAiMenu: m,
126
+ handleAiFeatureSelect: h
127
+ };
128
+ }
129
+ //#endregion
130
+ //#region src/cloud/composables/useCollabUndoWarning.ts
131
+ function Ke(e) {
132
+ let { isCollaborationEnabled: t, getCollaboratorCount: i, canUndo: a } = e, o = M(!1), s = M(!1), { start: c } = r(() => {
133
+ s.value = !1;
134
+ }, n, { immediate: !1 });
135
+ function l() {
136
+ o.value || !t.value || i() === 0 || !a.value || (o.value = !0, s.value = !0, c());
137
+ }
138
+ return {
139
+ collabUndoWarningVisible: s,
140
+ showCollabUndoWarning: l
141
+ };
142
+ }
143
+ //#endregion
144
+ //#region src/cloud/composables/useCloudFeatureFlags.ts
145
+ function qe(e) {
146
+ let { planConfigInstance: t, aiConfig: n, editor: i } = e, a = y(() => t.hasFeature("ai_generation") && n.hasAnyMenuFeature.value), o = y(() => t.hasFeature("test_email")), s = y(() => !!i.state.template?.id), c = y(() => t.hasFeature("white_label")), l = y(() => t.config.value?.limits.max_templates ?? null), u = y(() => t.config.value?.template_count ?? 0), d = M(!1), f = M("idle"), p = M(""), { start: m } = r(() => {
147
+ f.value = "idle";
148
+ }, 3e3, { immediate: !1 });
149
+ return {
150
+ canUseAiGeneration: a,
151
+ canSendTestEmail: o,
152
+ hasTemplateSaved: s,
153
+ isWhiteLabeled: c,
154
+ templateLimit: l,
155
+ templateCount: u,
156
+ isSaveExporting: d,
157
+ saveStatus: f,
158
+ saveErrorMessage: p,
159
+ startSaveStatusClear: m
160
+ };
161
+ }
162
+ //#endregion
163
+ //#region src/cloud/composables/useCloudMediaLibrary.ts
164
+ function Je(e) {
165
+ let { onRequestMedia: t, mediaLibraryOpen: n, mediaLibraryAccept: r } = e, i = null;
166
+ async function a() {
167
+ if (t) {
168
+ let e = await t({ accept: ["images"] });
169
+ return e ? {
170
+ url: e.url,
171
+ alt: e.alt_text || void 0
172
+ } : null;
173
+ }
174
+ return r.value = ["images"], n.value = !0, new Promise((e) => {
175
+ i = (t) => {
176
+ e(t);
177
+ };
178
+ });
179
+ }
180
+ function o(e) {
181
+ n.value = !1, i?.({
182
+ url: e.url,
183
+ alt: e.alt_text || void 0
184
+ }), i = null;
185
+ }
186
+ function s() {
187
+ n.value = !1, i?.(null), i = null;
188
+ }
189
+ return ge(() => {
190
+ i &&= (i(null), null);
191
+ }), {
192
+ handleRequestMedia: a,
193
+ handleMediaSelect: o,
194
+ handleMediaLibraryClose: s
195
+ };
196
+ }
197
+ //#endregion
198
+ //#region src/cloud/components/CloudLoadingOverlay.vue?vue&type=script&setup=true&lang.ts
199
+ var Ye = {
200
+ key: 0,
201
+ class: "tpl-loading tpl:absolute tpl:inset-0 tpl:z-overlay tpl:flex tpl:flex-col tpl:bg-[var(--tpl-bg)]"
202
+ }, I = { class: "tpl:flex tpl:flex-1 tpl:overflow-hidden" }, Xe = { 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)]" }, Ze = /* @__PURE__ */ O({
203
+ __name: "CloudLoadingOverlay",
204
+ props: { visible: { type: Boolean } },
205
+ setup(e) {
206
+ return (t, n) => e.visible ? (A(), S("div", Ye, [n[1] ||= w("<div 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)]\"><div class=\"tpl-shimmer tpl:h-5 tpl:w-28 tpl:rounded-[var(--tpl-radius-sm)]\"></div><div class=\"tpl:flex tpl:gap-3\"><div class=\"tpl-shimmer tpl:h-8 tpl:w-20 tpl:rounded-[var(--tpl-radius-sm)]\"></div><div class=\"tpl-shimmer tpl:h-8 tpl:w-20 tpl:rounded-[var(--tpl-radius-sm)]\"></div></div></div>", 1), C("div", I, [C("div", Xe, [(A(), S(fe, null, ve(5, (e) => C("div", {
207
+ key: e,
208
+ class: "tpl-shimmer tpl:size-7 tpl:rounded-[var(--tpl-radius-sm)]"
209
+ })), 64))]), n[0] ||= w("<div class=\"tpl:flex tpl:flex-1 tpl:items-start tpl:justify-center tpl:overflow-auto tpl:p-8 tpl:bg-[var(--tpl-canvas-bg)]\"><div 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)]\"><div class=\"tpl:space-y-2 tpl:py-4\"><div class=\"tpl-shimmer tpl:h-3 tpl:w-3/4 tpl:rounded\"></div><div class=\"tpl-shimmer tpl:h-3 tpl:w-full tpl:rounded\"></div><div class=\"tpl-shimmer tpl:h-3 tpl:w-5/6 tpl:rounded\"></div></div><div class=\"tpl:py-4\"><div class=\"tpl-shimmer tpl:h-44 tpl:w-full tpl:rounded-[var(--tpl-radius-sm)]\"></div></div><div class=\"tpl:space-y-2 tpl:py-4\"><div class=\"tpl-shimmer tpl:h-3 tpl:w-full tpl:rounded\"></div><div class=\"tpl-shimmer tpl:h-3 tpl:w-2/3 tpl:rounded\"></div></div><div class=\"tpl:flex tpl:justify-center tpl:py-4\"><div class=\"tpl-shimmer tpl:h-10 tpl:w-36 tpl:rounded-[var(--tpl-radius-sm)]\"></div></div><div class=\"tpl:space-y-2 tpl:py-4\"><div class=\"tpl-shimmer tpl:mx-auto tpl:h-2.5 tpl:w-1/2 tpl:rounded\"></div><div class=\"tpl-shimmer tpl:mx-auto tpl:h-2.5 tpl:w-1/3 tpl:rounded\"></div></div></div></div><div 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)]\"><div class=\"tpl-shimmer tpl:h-8 tpl:rounded-[var(--tpl-radius-sm)]\"></div><div class=\"tpl-shimmer tpl:h-32 tpl:rounded-[var(--tpl-radius)]\"></div><div class=\"tpl-shimmer tpl:h-32 tpl:rounded-[var(--tpl-radius)]\"></div></div>", 2)])])) : x("", !0);
210
+ }
211
+ }), L = {
212
+ key: 0,
213
+ role: "alert",
214
+ 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)]"
215
+ }, R = { class: "tpl:flex tpl:size-16 tpl:items-center tpl:justify-center tpl:rounded-full tpl:bg-[var(--tpl-danger-light)]" }, z = { class: "tpl:flex tpl:flex-col tpl:items-center tpl:gap-2 tpl:text-center" }, B = { class: "tpl:text-lg tpl:font-semibold tpl:text-[var(--tpl-text)]" }, V = { class: "tpl:max-w-md tpl:text-sm tpl:text-[var(--tpl-text-muted)]" }, Qe = /* @__PURE__ */ O({
216
+ __name: "CloudErrorOverlay",
217
+ props: {
218
+ error: {},
219
+ visible: { type: Boolean }
220
+ },
221
+ emits: ["retry"],
222
+ setup(e, { emit: t }) {
223
+ let n = t, { t: r } = f();
224
+ function i(e) {
225
+ return "isUnauthorized" in e && e.isUnauthorized ? r.error.authFailed : "isNotFound" in e && e.isNotFound ? r.error.templateNotFound : r.error.defaultMessage;
226
+ }
227
+ function a(e) {
228
+ return "isNotFound" in e && !!e.isNotFound;
229
+ }
230
+ return (t, o) => e.visible && e.error ? (A(), S("div", L, [
231
+ C("div", R, [E(P(g), {
232
+ size: 32,
233
+ "stroke-width": 1.5,
234
+ class: "tpl:text-[var(--tpl-danger)]"
235
+ })]),
236
+ C("div", z, [C("h2", B, N(P(r).error.title), 1), C("p", V, N(i(e.error)), 1)]),
237
+ a(e.error) ? x("", !0) : (A(), S("button", {
238
+ key: 0,
239
+ 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)]",
240
+ onClick: o[0] ||= (e) => n("retry")
241
+ }, N(P(r).error.retry), 1))
242
+ ])) : x("", !0);
243
+ }
244
+ }), H = {
245
+ key: 0,
246
+ 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)]"
247
+ }, $e = { class: "tpl:flex tpl:items-center tpl:gap-2 tpl:text-sm tpl:text-[var(--tpl-text)]" }, U = { class: "tpl:flex tpl:items-center tpl:gap-2" }, et = /* @__PURE__ */ O({
248
+ __name: "SnapshotPreviewBanner",
249
+ props: { visible: { type: Boolean } },
250
+ emits: ["cancel", "confirm"],
251
+ setup(e, { emit: t }) {
252
+ let n = t, { t: r } = f();
253
+ return (t, i) => e.visible ? (A(), S("div", H, [C("div", $e, [E(P(se), {
254
+ size: 18,
255
+ "stroke-width": 2,
256
+ class: "tpl:text-[var(--tpl-primary)]"
257
+ }), C("span", null, N(P(r).snapshotPreview.message), 1)]), C("div", U, [C("button", {
258
+ 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)]",
259
+ style: { "background-color": "transparent" },
260
+ onClick: i[0] ||= (e) => n("cancel")
261
+ }, N(P(r).snapshotPreview.cancel), 1), C("button", {
262
+ 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)]",
263
+ onClick: i[1] ||= (e) => n("confirm")
264
+ }, N(P(r).snapshotPreview.restore), 1)])])) : x("", !0);
265
+ }
266
+ }), W = {
267
+ key: 0,
268
+ role: "status",
269
+ "aria-live": "polite",
270
+ 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",
271
+ style: {
272
+ "background-color": "var(--tpl-warning-light)",
273
+ color: "var(--tpl-text)",
274
+ border: "1px solid var(--tpl-warning)"
275
+ }
276
+ }, tt = /* @__PURE__ */ O({
277
+ __name: "CollabUndoToast",
278
+ props: { visible: { type: Boolean } },
279
+ setup(e) {
280
+ let { t } = f();
281
+ return (n, r) => e.visible ? (A(), S("div", W, N(P(t).history.collabWarning), 1)) : x("", !0);
282
+ }
283
+ }), nt = ["data-tpl-theme"], rt = {
284
+ 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",
285
+ style: {
286
+ "background-color": "color-mix(in srgb, var(--tpl-bg) 80%, transparent)",
287
+ "backdrop-filter": "blur(12px)",
288
+ "-webkit-backdrop-filter": "blur(12px)",
289
+ "box-shadow": "var(--tpl-shadow-md)",
290
+ "border-bottom": "1px solid var(--tpl-border)"
291
+ }
292
+ }, it = { class: "tpl-header-left tpl:flex tpl:min-w-[200px] tpl:items-center tpl:gap-3" }, at = {
293
+ key: 0,
294
+ class: "tpl-logo tpl:flex tpl:items-center tpl:gap-2.5 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]"
295
+ }, ot = ["src"], st = { style: { "letter-spacing": "-0.01em" } }, ct = {
296
+ key: 1,
297
+ class: "tpl:text-xs tpl:opacity-60 tpl:text-[var(--tpl-text-muted)]"
298
+ }, lt = { class: "tpl-header-center tpl:flex tpl:items-center tpl:justify-center tpl:gap-10" }, ut = { class: "tpl-header-right tpl:flex tpl:min-w-[200px] tpl:items-center tpl:justify-end tpl:gap-3" }, dt = ["data-tooltip"], ft = {
299
+ key: 1,
300
+ "aria-live": "polite",
301
+ class: "tpl-status tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-success)]"
302
+ }, pt = {
303
+ key: 2,
304
+ "aria-live": "polite",
305
+ class: "tpl-status tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-text-muted)]"
306
+ }, mt = ["aria-label", "aria-expanded"], ht = {
307
+ key: 0,
308
+ 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)]"
309
+ }, gt = ["aria-expanded"], _t = {
310
+ key: 0,
311
+ class: "tpl:absolute tpl:right-0 tpl:top-full tpl:z-50 tpl:mt-1 tpl:origin-top-right"
312
+ }, vt = ["disabled"], yt = ["disabled"], bt = { class: "tpl:sticky tpl:top-0 tpl:z-40 tpl:h-0" }, xt = { class: "tpl-main tpl:flex tpl:justify-center tpl:p-8" }, St = {
313
+ class: "tpl:pointer-events-auto tpl:flex tpl:items-center tpl:gap-1.5 tpl:rounded-tl-lg tpl:p-1",
314
+ style: {
315
+ "background-color": "color-mix(\n in srgb,\n var(--tpl-canvas-bg) 85%,\n transparent\n )",
316
+ "backdrop-filter": "blur(8px)",
317
+ "-webkit-backdrop-filter": "blur(8px)"
318
+ }
319
+ }, Ct = {
320
+ href: "https://github.com/templatical/sdk",
321
+ target: "_blank",
322
+ rel: "noopener noreferrer",
323
+ class: "tpl:transition-colors tpl:duration-150 hover:tpl:opacity-80 tpl:text-[var(--tpl-text-dim)]",
324
+ style: { "text-decoration": "none" }
325
+ }, wt = ["aria-label"], G = /* @__PURE__ */ m(/* @__PURE__ */ O({
326
+ __name: "CloudEditor",
327
+ props: {
328
+ config: {},
329
+ translations: {},
330
+ fontsManager: {}
331
+ },
332
+ emits: ["ready"],
333
+ setup(n, { expose: r, emit: i }) {
334
+ let f = D(() => import("./AiChatSidebar-CjfhTZwo.js")), p = D(() => import("./CommentsSidebar-2lcqMfIP.js")), m = D(() => import("./DesignReferenceSidebar-CNMu4Zrx.js")), se = D(() => import("./TemplateScoringPanel-D58A23Vq.js")), w = D(() => import("./TestEmailModal-DIAlB3e_.js")), O = D(() => import("./SaveModuleDialog-BaaeH5Xm.js")), ge = D(() => import("./ModuleBrowserModal-CvQ0xyQf.js")), ve = D(() => import("./SnapshotHistory-BPfjiuu1.js")), ye = D(() => import("./CollaboratorBar-BuCEcdbB.js")), ze = D(() => import("./AiFeatureMenu-K44aZa_P.js")), Ye = D(async () => (await import("@templatical/media-library")).MediaLibraryModal), I = n, Xe = i, L = M(!0), R = M(!1), z = M(null), B = !1, V = new Ee({
335
+ ...I.config.auth,
336
+ onError: I.config.onError
337
+ }), H = Le({
338
+ authManager: V,
339
+ onError: I.config.onError
340
+ }), $e = M(/* @__PURE__ */ new Map()), U = Pe({
341
+ authManager: V,
342
+ defaultFontFamily: I.config.fonts?.defaultFont,
343
+ templateDefaults: I.config.templateDefaults,
344
+ onError: I.config.onError,
345
+ lockedBlocks: $e
346
+ }), W = He({
347
+ authManager: V,
348
+ onError: I.config.onError
349
+ });
350
+ I.config.mcp?.enabled && Ie({
351
+ editor: U,
352
+ channel: W.channel,
353
+ onOperation: I.config.mcp.onOperation
354
+ });
355
+ let G = null;
356
+ I.config.collaboration?.enabled && (G = Ae({
357
+ authManager: V,
358
+ editor: U,
359
+ channel: W.channel,
360
+ onError: I.config.onError,
361
+ onCollaboratorJoined: I.config.collaboration.onCollaboratorJoined,
362
+ onCollaboratorLeft: I.config.collaboration.onCollaboratorLeft,
363
+ onBlockLocked: I.config.collaboration.onBlockLocked,
364
+ onBlockUnlocked: I.config.collaboration.onBlockUnlocked
365
+ }), xe(() => G.lockedBlocks.value, (e) => {
366
+ $e.value = e;
367
+ }, { immediate: !0 }), je(U, G));
368
+ let Tt = y(() => !!I.config.collaboration?.enabled && H.hasFeature("collaboration")), Et = null, Dt = null, K = t({
369
+ editor: U,
370
+ config: {
371
+ uiTheme: I.config.uiTheme,
372
+ theme: void 0,
373
+ blockDefaults: I.config.blockDefaults,
374
+ customBlocks: [],
375
+ mergeTags: I.config.mergeTags,
376
+ displayConditions: I.config.displayConditions,
377
+ onRequestMedia: null,
378
+ onSave: () => {
379
+ Kt().catch((e) => {
380
+ I.config.onError?.(e);
381
+ });
382
+ }
383
+ },
384
+ translations: I.translations,
385
+ fontsManager: I.fontsManager,
386
+ historyOptions: G ? { isRemoteOperation: () => G._isProcessingRemoteOperation() } : void 0,
387
+ autoSaveOptions: {
388
+ onChange: async () => {
389
+ U.hasTemplate() && (await U.createSnapshot(), Et?.snapshotHistoryInstance.value?.loadSnapshots());
390
+ },
391
+ debounce: I.config.autoSaveDebounce ?? 5e3,
392
+ enabled: () => I.config.autoSave !== !1 && H.hasFeature("auto_save")
393
+ },
394
+ themeExtraStyles: () => ({ "--tpl-drop-text": `"${I.translations.canvas.dropHere}"` }),
395
+ keyboardOptions: { onBeforeUndo: () => Dt?.showCollabUndoWarning() }
396
+ }), Ot = Ke({
397
+ isCollaborationEnabled: Tt,
398
+ getCollaboratorCount: () => G?.collaborators.value.length ?? 0,
399
+ canUndo: K.history.canUndo
400
+ });
401
+ Dt = Ot;
402
+ let q = We({
403
+ authManager: V,
404
+ editor: U,
405
+ history: K.history,
406
+ conditionPreview: K.conditionPreview,
407
+ autoSave: K.autoSave,
408
+ onError: I.config.onError
409
+ });
410
+ Et = q;
411
+ let J = Ge(), kt = ke(I.config.ai), Y = qe({
412
+ planConfigInstance: H,
413
+ aiConfig: kt,
414
+ editor: U
415
+ }), At = Je({
416
+ onRequestMedia: I.config.onRequestMedia,
417
+ mediaLibraryOpen: J.mediaLibraryOpen,
418
+ mediaLibraryAccept: J.mediaLibraryAccept
419
+ });
420
+ e({
421
+ onBlockMove: U.moveBlock,
422
+ onBlockAdd: U.addBlock
423
+ });
424
+ let jt = Fe({
425
+ authManager: V,
426
+ getFontsConfig: () => I.config.fonts,
427
+ canUseCustomFonts: () => H.hasFeature("custom_fonts")
428
+ }), X = Ve({
429
+ authManager: V,
430
+ getTemplateId: () => U.state.template?.id ?? null,
431
+ save: () => U.save(),
432
+ exportHtml: (e) => jt.exportHtml(e),
433
+ onError: I.config.onError,
434
+ isAuthReady: R,
435
+ onBeforeTestEmail: I.config.onBeforeTestEmail
436
+ }), Z = Ne({
437
+ authManager: V,
438
+ getTemplateId: () => U.state.template?.id ?? null,
439
+ getSocketId: () => W.getSocketId(),
440
+ onComment: I.config.onComment,
441
+ onError: I.config.onError,
442
+ isAuthReady: R,
443
+ hasCommentingFeature: () => I.config.commenting !== !1 && H.hasFeature("commenting")
444
+ });
445
+ Me({
446
+ comments: Z,
447
+ channel: W.channel
448
+ });
449
+ let Q = Re({
450
+ authManager: V,
451
+ onError: I.config.onError
452
+ }), Mt = M(!1), Nt = M(null), $ = M(!1), Pt = Be({
453
+ authManager: V,
454
+ getTemplateId: () => U.state.template?.id ?? null
455
+ });
456
+ j(u, At.handleRequestMedia), j(s, V), j(l, kt), j(o, Z), j(a, Q), j(d, Pt), j(c, {
457
+ plan: H,
458
+ ai: kt,
459
+ comments: {
460
+ getBlockCount: (e) => Z.commentCountByBlock.value.get(e) ?? 0,
461
+ openForBlock: Rt
462
+ },
463
+ savedModules: {
464
+ openSaveDialog: (e) => {
465
+ Nt.value = e ?? null, Mt.value = !0;
466
+ },
467
+ openBrowser: () => {
468
+ $.value = !0;
469
+ },
470
+ moduleCount: y(() => Q.modules.value.length)
471
+ }
472
+ });
473
+ function Ft(e) {
474
+ H.hasFeature("theme_customization") && (K.themeOverrides.value = e);
475
+ }
476
+ function It(e) {
477
+ U.setUiTheme(e);
478
+ }
479
+ let Lt = M(null);
480
+ function Rt(e) {
481
+ J.commentsOpen.value = !0, pe(() => {
482
+ Lt.value?.filterByBlock(e);
483
+ });
484
+ }
485
+ async function zt(e) {
486
+ try {
487
+ await X.sendTestEmail(e), J.testEmailModalOpen.value = !1;
488
+ } catch {}
489
+ }
490
+ function Bt(e, t) {
491
+ for (let n = 0; n < e.content.length; n++) {
492
+ let r = we(e.content[n]), i = t === void 0 ? void 0 : t + n;
493
+ U.addBlock(r, void 0, void 0, i);
494
+ }
495
+ $.value = !1;
496
+ }
497
+ async function Vt(e) {
498
+ let t = async (e) => {
499
+ if (Te(e)) {
500
+ let t = e;
501
+ try {
502
+ t.renderedHtml = await K.registry.renderCustomBlock(t);
503
+ } catch {
504
+ t.renderedHtml = `<!-- Custom block render error: ${t.customType} -->`;
505
+ }
506
+ }
507
+ if (e.type === "section" && "children" in e) {
508
+ let n = e;
509
+ for (let e of n.children) for (let n of e) await t(n);
510
+ }
511
+ };
512
+ for (let n of e.blocks) await t(n);
513
+ }
514
+ async function Ht() {
515
+ L.value = !0, z.value = null;
516
+ try {
517
+ if (await V.initialize(), B) return;
518
+ R.value = !0;
519
+ let e = await De({ authManager: V });
520
+ if (B) return;
521
+ if (!e.api.ok) throw Error("Health check failed: API is not reachable");
522
+ if (!e.auth.ok) throw Error(`Health check failed: authentication error${e.auth.error ? ` - ${e.auth.error}` : ""}`);
523
+ if (e.websocket.ok || console.warn("[Templatical] WebSocket health check failed:", e.websocket.error ?? "unknown error", "-- real-time features will be disabled."), await H.fetchConfig(), B) return;
524
+ I.fontsManager.setCustomFontsEnabled(H.hasFeature("custom_fonts")), I.config.customBlocks?.length && H.hasFeature("custom_blocks") && K.registerCustomBlocks(I.config.customBlocks), I.config.theme && H.hasFeature("theme_customization") && (K.themeOverrides.value = I.config.theme), I.config.modules !== !1 && H.hasFeature("saved_modules") && Q.loadModules(), Xe("ready");
525
+ } catch (e) {
526
+ if (B) return;
527
+ let t = e instanceof Error ? e : Error("Initialization failed", { cause: e });
528
+ z.value = t, I.config.onError?.(t);
529
+ } finally {
530
+ B || (L.value = !1);
531
+ }
532
+ }
533
+ function Ut() {
534
+ return Oe(H.config.value.websocket);
535
+ }
536
+ async function Wt(e) {
537
+ let t = await U.create(e);
538
+ return B ? t : (I.config.onCreate?.(t), q.initSnapshotHistory(), W.connect(t.id, Ut()), t);
539
+ }
540
+ async function Gt(e) {
541
+ let t = await U.load(e);
542
+ return B ? t : (I.config.onLoad?.(t), q.initSnapshotHistory(), W.connect(t.id, Ut()), t);
543
+ }
544
+ async function Kt() {
545
+ Y.isSaveExporting.value = !0, Y.saveStatus.value = "idle";
546
+ try {
547
+ if (await Vt(U.content.value), B) throw Error("Component unmounted during save");
548
+ let e = await U.save();
549
+ if (B) throw Error("Component unmounted during save");
550
+ q.initSnapshotHistory(), q.snapshotHistoryInstance.value && q.snapshotHistoryInstance.value.loadSnapshots();
551
+ let t = await jt.exportHtml(e.id);
552
+ if (B) throw Error("Component unmounted during save");
553
+ let n = {
554
+ templateId: e.id,
555
+ html: t.html,
556
+ mjml: t.mjml,
557
+ content: e.content
558
+ };
559
+ return I.config.onSave?.(n), Y.saveStatus.value = "saved", Y.startSaveStatusClear(), n;
560
+ } catch (e) {
561
+ throw B || (Y.saveStatus.value = "error", Y.saveErrorMessage.value = e instanceof Error ? e.message : "Save failed"), e;
562
+ } finally {
563
+ B || (Y.isSaveExporting.value = !1);
564
+ }
565
+ }
566
+ return he(() => {
567
+ Ht();
568
+ }), _e(() => {
569
+ B = !0, I.fontsManager.cleanupFontLinks(), W.disconnect(), K.destroy(), I.config.onUnmount?.();
570
+ }), r({
571
+ getContent: () => U.content.value,
572
+ setContent: (e) => U.setContent(e),
573
+ setTheme: It,
574
+ setThemeOverrides: Ft,
575
+ create: Wt,
576
+ load: Gt,
577
+ save: Kt,
578
+ sendTestEmail: X.sendTestEmail
579
+ }), (e, t) => (A(), S("div", {
580
+ class: k(["tpl tpl:relative tpl:h-full tpl:overflow-hidden", { "tpl:dark": P(U).state.darkMode }]),
581
+ "data-tpl-theme": P(K).resolvedTheme.value,
582
+ style: me(P(K).themeStyles.value)
583
+ }, [
584
+ E(v, {
585
+ "enter-active-class": "tpl:transition-opacity tpl:duration-200",
586
+ "enter-from-class": "tpl:opacity-100",
587
+ "enter-to-class": "tpl:opacity-100",
588
+ "leave-active-class": "tpl:transition-opacity tpl:duration-300",
589
+ "leave-from-class": "tpl:opacity-100",
590
+ "leave-to-class": "tpl:opacity-0"
591
+ }, {
592
+ default: F(() => [E(Ze, { visible: L.value || P(U).state.isLoading }, null, 8, ["visible"])]),
593
+ _: 1
594
+ }),
595
+ E(v, {
596
+ "enter-active-class": "tpl:transition-opacity tpl:duration-200",
597
+ "enter-from-class": "tpl:opacity-0",
598
+ "enter-to-class": "tpl:opacity-100",
599
+ "leave-active-class": "tpl:transition-opacity tpl:duration-300",
600
+ "leave-from-class": "tpl:opacity-100",
601
+ "leave-to-class": "tpl:opacity-0"
602
+ }, {
603
+ default: F(() => [E(Qe, {
604
+ error: z.value,
605
+ visible: !!z.value && !L.value,
606
+ onRetry: Ht
607
+ }, null, 8, ["error", "visible"])]),
608
+ _: 1
609
+ }),
610
+ C("header", rt, [
611
+ C("div", it, [P(Y).isWhiteLabeled.value ? x("", !0) : (A(), S("div", at, [C("img", {
612
+ src: P(V).resolveUrl("/logo.svg"),
613
+ alt: "Templatical",
614
+ width: "24",
615
+ height: "24",
616
+ class: "tpl:shrink-0"
617
+ }, null, 8, ot), C("span", st, N(P(K).t.header.title), 1)])), P(Y).templateLimit.value === null ? x("", !0) : (A(), S("span", ct, N(P(K).format(P(K).t.header.templatesUsed, {
618
+ used: P(Y).templateCount.value,
619
+ max: P(Y).templateLimit.value
620
+ })), 1))]),
621
+ C("div", lt, [
622
+ E(ie, {
623
+ viewport: P(U).state.viewport,
624
+ onChange: P(U).setViewport
625
+ }, null, 8, ["viewport", "onChange"]),
626
+ E(oe, {
627
+ "dark-mode": P(U).state.darkMode,
628
+ onChange: P(U).setDarkMode
629
+ }, null, 8, ["dark-mode", "onChange"]),
630
+ E(ne, {
631
+ "preview-mode": P(U).state.previewMode,
632
+ onChange: P(U).setPreviewMode
633
+ }, null, 8, ["preview-mode", "onChange"]),
634
+ P(G) && Tt.value ? (A(), b(P(ye), {
635
+ key: 0,
636
+ collaborators: P(G).collaborators.value,
637
+ "is-connected": P(W).isConnected.value
638
+ }, null, 8, ["collaborators", "is-connected"])) : x("", !0),
639
+ P(q).snapshotHistoryInstance.value ? (A(), b(P(ve), {
640
+ key: 1,
641
+ snapshots: P(q).snapshotHistorySnapshots.value,
642
+ "is-loading": P(q).snapshotHistoryIsLoading.value,
643
+ "is-restoring": P(q).snapshotHistoryIsRestoring.value,
644
+ onLoad: P(q).loadSnapshotHistory,
645
+ onNavigate: P(q).handleSnapshotNavigate
646
+ }, null, 8, [
647
+ "snapshots",
648
+ "is-loading",
649
+ "is-restoring",
650
+ "onLoad",
651
+ "onNavigate"
652
+ ])) : x("", !0)
653
+ ]),
654
+ C("div", ut, [
655
+ P(Y).saveStatus.value === "error" ? (A(), S("div", {
656
+ key: 0,
657
+ "aria-live": "assertive",
658
+ class: "tpl-tooltip tpl-status tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-danger)]",
659
+ "data-tooltip": P(Y).saveErrorMessage.value
660
+ }, [E(P(g), {
661
+ size: 12,
662
+ "stroke-width": 2.5
663
+ }), T(" " + N(P(K).t.header.saveFailed), 1)], 8, dt)) : P(Y).saveStatus.value === "saved" ? (A(), S("div", ft, [E(P(h), {
664
+ size: 12,
665
+ "stroke-width": 2.5
666
+ }), T(" " + N(P(K).t.header.saved), 1)])) : P(U).state.isDirty ? (A(), S("div", pt, [t[19] ||= C("span", { class: "tpl-pulse tpl:size-1.5 tpl:rounded-full tpl:bg-[var(--tpl-primary)]" }, null, -1), T(" " + N(P(K).t.header.unsaved), 1)])) : x("", !0),
667
+ P(Z).isEnabled.value && P(Y).hasTemplateSaved.value ? (A(), S("button", {
668
+ key: 3,
669
+ "aria-label": P(Z).unresolvedCount.value > 0 ? `${P(K).t.comments.button} (${P(Z).unresolvedCount.value})` : P(K).t.comments.button,
670
+ "aria-expanded": P(J).commentsOpen.value,
671
+ class: k(P(_)),
672
+ style: me({
673
+ backgroundColor: P(J).commentsOpen.value ? "var(--tpl-primary)" : "transparent",
674
+ color: P(J).commentsOpen.value ? "var(--tpl-bg)" : "var(--tpl-primary)",
675
+ borderColor: "var(--tpl-primary)"
676
+ }),
677
+ onClick: t[0] ||= (e) => P(J).commentsOpen.value = !P(J).commentsOpen.value
678
+ }, [
679
+ E(P(le), {
680
+ size: 16,
681
+ "stroke-width": 2
682
+ }),
683
+ T(" " + N(P(K).t.comments.button) + " ", 1),
684
+ P(Z).unresolvedCount.value > 0 && !P(J).commentsOpen.value ? (A(), S("span", ht, N(P(Z).unresolvedCount.value), 1)) : x("", !0)
685
+ ], 14, mt)) : x("", !0),
686
+ P(Y).canUseAiGeneration.value && P(Y).hasTemplateSaved.value ? (A(), S("div", {
687
+ key: 4,
688
+ ref: (e) => P(J).aiMenuRef.value = e,
689
+ class: "tpl:relative"
690
+ }, [C("button", {
691
+ "aria-expanded": P(J).aiMenuOpen.value,
692
+ class: k(["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", P(J).aiButtonActive.value ? "tpl-ai-btn--active" : "tpl-ai-btn--idle"]),
693
+ onClick: t[1] ||= Ce((...e) => P(J).toggleAiMenu && P(J).toggleAiMenu(...e), ["stop"])
694
+ }, [E(P(de), {
695
+ size: 16,
696
+ "stroke-width": 2,
697
+ class: "tpl-ai-btn-icon"
698
+ }), T(" " + N(P(K).t.aiChat.button), 1)], 10, gt), E(v, {
699
+ "enter-active-class": "tpl:transition-all tpl:duration-150 tpl:ease-out",
700
+ "enter-from-class": "tpl:scale-95 tpl:opacity-0",
701
+ "enter-to-class": "tpl:scale-100 tpl:opacity-100",
702
+ "leave-active-class": "tpl:transition-all tpl:duration-100 tpl:ease-in",
703
+ "leave-from-class": "tpl:scale-100 tpl:opacity-100",
704
+ "leave-to-class": "tpl:scale-95 tpl:opacity-0"
705
+ }, {
706
+ default: F(() => [P(J).aiMenuOpen.value ? (A(), S("div", _t, [E(P(ze), {
707
+ "active-feature": P(J).activeAiFeature.value,
708
+ onSelect: P(J).handleAiFeatureSelect
709
+ }, null, 8, ["active-feature", "onSelect"])])) : x("", !0)]),
710
+ _: 1
711
+ })], 512)) : x("", !0),
712
+ P(X).isEnabled.value && P(Y).canSendTestEmail.value ? (A(), S("button", {
713
+ key: 5,
714
+ class: k(P(_)),
715
+ style: {
716
+ "background-color": "transparent",
717
+ color: "var(--tpl-primary)",
718
+ "border-color": "var(--tpl-primary)"
719
+ },
720
+ disabled: P(X).isSending.value || !P(Y).hasTemplateSaved.value,
721
+ onClick: t[2] ||= (e) => P(J).testEmailModalOpen.value = !0
722
+ }, [P(X).isSending.value ? (A(), b(P(ce), {
723
+ key: 1,
724
+ class: "tpl-spinner",
725
+ size: 16,
726
+ "stroke-width": 2
727
+ })) : (A(), b(P(ue), {
728
+ key: 0,
729
+ size: 16,
730
+ "stroke-width": 2
731
+ })), T(" " + N(P(K).t.testEmail.button), 1)], 10, vt)) : x("", !0),
732
+ C("button", {
733
+ class: k(P(_)),
734
+ style: {
735
+ "background-color": "transparent",
736
+ color: "var(--tpl-primary)",
737
+ "border-color": "var(--tpl-primary)"
738
+ },
739
+ disabled: P(U).state.isSaving || P(Y).isSaveExporting.value || !P(U).state.isDirty,
740
+ onClick: t[3] ||= (e) => Kt().catch((e) => I.config.onError?.(e))
741
+ }, [!P(U).state.isSaving && !P(Y).isSaveExporting.value ? (A(), b(P(Ue), {
742
+ key: 0,
743
+ size: 16,
744
+ "stroke-width": 2
745
+ })) : (A(), b(P(ce), {
746
+ key: 1,
747
+ class: "tpl-spinner",
748
+ size: 16,
749
+ "stroke-width": 2
750
+ })), T(" " + N(P(U).state.isSaving || P(Y).isSaveExporting.value ? P(K).t.header.saving : P(K).t.header.save), 1)], 10, yt)
751
+ ])
752
+ ]),
753
+ E(et, {
754
+ visible: P(q).isPreviewingSnapshot.value,
755
+ onCancel: P(q).cancelPreview,
756
+ onConfirm: P(q).confirmRestoreSnapshot
757
+ }, null, 8, [
758
+ "visible",
759
+ "onCancel",
760
+ "onConfirm"
761
+ ]),
762
+ E(v, {
763
+ "enter-active-class": "tpl:transition-all tpl:duration-200 tpl:ease-out",
764
+ "enter-from-class": "tpl:translate-y-[-8px] tpl:opacity-0",
765
+ "enter-to-class": "tpl:translate-y-0 tpl:opacity-100",
766
+ "leave-active-class": "tpl:transition-all tpl:duration-300 tpl:ease-in",
767
+ "leave-from-class": "tpl:translate-y-0 tpl:opacity-100",
768
+ "leave-to-class": "tpl:translate-y-[-8px] tpl:opacity-0"
769
+ }, {
770
+ default: F(() => [E(tt, { visible: P(Ot).collabUndoWarningVisible.value }, null, 8, ["visible"])]),
771
+ _: 1
772
+ }),
773
+ Se(E(ee, null, null, 512), [[be, !P(U).state.previewMode]]),
774
+ C("div", {
775
+ class: k(["tpl-body tpl:absolute tpl:bottom-0 tpl:overflow-auto", [P(U).state.previewMode ? "tpl:left-0 tpl:right-0" : P(J).rightPanelOpen.value ? "tpl:left-12 tpl:right-[680px]" : "tpl:left-12 tpl:right-[320px]", P(q).isPreviewingSnapshot.value ? "tpl:top-[104px]" : "tpl:top-14"]]),
776
+ style: {
777
+ transition: "all 300ms cubic-bezier(0.34, 1.56, 0.64, 1)",
778
+ "background-color": "var(--tpl-canvas-bg)"
779
+ }
780
+ }, [C("div", bt, [E(v, { name: "tpl-restore-btn" }, {
781
+ default: F(() => [P(K).conditionPreview.hasHiddenBlocks.value ? (A(), S("button", {
782
+ key: 0,
783
+ 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",
784
+ style: {
785
+ "background-color": "var(--tpl-warning-light)",
786
+ color: "var(--tpl-warning)",
787
+ "border-color": "var(--tpl-warning)",
788
+ "backdrop-filter": "blur(8px)"
789
+ },
790
+ onClick: t[4] ||= (e) => P(K).conditionPreview.reset()
791
+ }, [E(P(ae), {
792
+ size: 13,
793
+ "stroke-width": 2
794
+ }), T(" " + N(P(K).t.blockSettings.restoreHiddenBlocks), 1)])) : x("", !0)]),
795
+ _: 1
796
+ })]), C("main", xt, [E(re, {
797
+ viewport: P(U).state.viewport,
798
+ content: P(U).content.value,
799
+ "selected-block-id": P(U).state.selectedBlockId,
800
+ "dark-mode": P(U).state.darkMode,
801
+ "preview-mode": P(U).state.previewMode,
802
+ "locked-blocks": P(G)?.lockedBlocks.value ?? void 0,
803
+ onSelectBlock: P(U).selectBlock,
804
+ onOpenAiChat: t[5] ||= (e) => P(J).aiChatOpen.value = !0,
805
+ onOpenDesignReference: t[6] ||= (e) => P(J).designReferenceOpen.value = !0
806
+ }, null, 8, [
807
+ "viewport",
808
+ "content",
809
+ "selected-block-id",
810
+ "dark-mode",
811
+ "preview-mode",
812
+ "locked-blocks",
813
+ "onSelectBlock"
814
+ ])])], 2),
815
+ P(Y).isWhiteLabeled.value ? x("", !0) : (A(), S("footer", {
816
+ key: 0,
817
+ class: k(["tpl:pointer-events-none tpl:absolute tpl:bottom-0 tpl:z-50 tpl:flex tpl:h-8 tpl:items-center tpl:justify-end tpl:pr-4 tpl:text-[9px] tpl:opacity-90 tpl:transition-all tpl:duration-300 tpl:text-[var(--tpl-text-dim)]", [P(U).state.previewMode ? "tpl:left-0 tpl:right-0" : P(J).rightPanelOpen.value ? "tpl:left-12 tpl:right-[680px]" : "tpl:left-12 tpl:right-[320px]"]])
818
+ }, [C("div", St, [
819
+ C("span", null, N(P(K).t.footer.poweredBy), 1),
820
+ t[20] ||= C("a", {
821
+ href: "https://templatical.com",
822
+ target: "_blank",
823
+ rel: "noopener noreferrer",
824
+ class: "tpl:inline-flex tpl:items-center tpl:gap-1 tpl:font-medium tpl:transition-colors tpl:duration-150 hover:tpl:opacity-80 tpl:text-[var(--tpl-text-muted)]",
825
+ style: { "text-decoration": "none" }
826
+ }, [C("img", {
827
+ width: "14",
828
+ height: "14",
829
+ src: "https://templatical.com/logo.svg",
830
+ alt: ""
831
+ }), T(" Templatical ")], -1),
832
+ t[21] ||= C("span", { class: "tpl:text-[var(--tpl-border)]" }, "·", -1),
833
+ C("a", Ct, N(P(K).t.footer.openSource), 1)
834
+ ])], 2)),
835
+ C("div", {
836
+ class: "tpl-sr-only",
837
+ role: "status",
838
+ "aria-live": "polite",
839
+ "aria-atomic": "true",
840
+ "aria-label": P(K).t.landmarks.reorderAnnouncements
841
+ }, N(P(K).keyboardReorder.announcement.value), 9, wt),
842
+ Se(E(te, {
843
+ "selected-block": P(U).selectedBlock.value,
844
+ settings: P(U).content.value.settings,
845
+ "shifted-left": P(J).rightPanelOpen.value,
846
+ onUpdateBlock: t[7] ||= (e) => P(U).updateBlock(P(U).selectedBlock.value.id, e),
847
+ onDeleteBlock: t[8] ||= (e) => P(K).blockActions.deleteBlock(P(U).selectedBlock.value.id),
848
+ onDuplicateBlock: t[9] ||= (e) => P(K).blockActions.duplicateBlock(P(U).selectedBlock.value),
849
+ onUpdateSettings: P(U).updateSettings
850
+ }, null, 8, [
851
+ "selected-block",
852
+ "settings",
853
+ "shifted-left",
854
+ "onUpdateSettings"
855
+ ]), [[be, !P(U).state.previewMode]]),
856
+ !L.value && R.value ? (A(), S(fe, { key: 1 }, [
857
+ E(P(f), {
858
+ visible: P(J).aiChatOpen.value,
859
+ "on-apply": (e) => {
860
+ P(K).history.record(), P(U).setContent(e), P(K).conditionPreview.reset();
861
+ },
862
+ onClose: t[10] ||= (e) => P(J).aiChatOpen.value = !1
863
+ }, null, 8, ["visible", "on-apply"]),
864
+ E(P(se), {
865
+ visible: P(J).scoringPanelOpen.value,
866
+ onClose: t[11] ||= (e) => P(J).scoringPanelOpen.value = !1
867
+ }, null, 8, ["visible"]),
868
+ E(P(m), {
869
+ visible: P(J).designReferenceOpen.value,
870
+ "has-existing-blocks": P(U).content.value.blocks.length > 0,
871
+ onClose: t[12] ||= (e) => P(J).designReferenceOpen.value = !1,
872
+ onApply: t[13] ||= (e) => {
873
+ P(K).history.record(), P(U).setContent(e), P(K).conditionPreview.reset();
874
+ }
875
+ }, null, 8, ["visible", "has-existing-blocks"]),
876
+ E(P(p), {
877
+ ref_key: "commentsSidebarRef",
878
+ ref: Lt,
879
+ visible: P(J).commentsOpen.value,
880
+ onClose: t[14] ||= (e) => P(J).commentsOpen.value = !1
881
+ }, null, 8, ["visible"]),
882
+ E(P(w), {
883
+ visible: P(J).testEmailModalOpen.value,
884
+ "allowed-emails": P(X).allowedEmails.value,
885
+ "is-sending": P(X).isSending.value,
886
+ error: P(X).error.value,
887
+ onSend: zt,
888
+ onClose: t[15] ||= (e) => P(J).testEmailModalOpen.value = !1
889
+ }, null, 8, [
890
+ "visible",
891
+ "allowed-emails",
892
+ "is-sending",
893
+ "error"
894
+ ]),
895
+ P(H).hasFeature("saved_modules") && I.config.modules !== !1 ? (A(), b(P(O), {
896
+ key: 0,
897
+ visible: Mt.value,
898
+ "pre-selected-block-id": Nt.value,
899
+ onClose: t[16] ||= (e) => {
900
+ Mt.value = !1, Nt.value = null;
901
+ },
902
+ onSaved: t[17] ||= (e) => P(Q).loadModules()
903
+ }, null, 8, ["visible", "pre-selected-block-id"])) : x("", !0),
904
+ P(H).hasFeature("saved_modules") && I.config.modules !== !1 ? (A(), b(P(ge), {
905
+ key: 1,
906
+ visible: $.value,
907
+ onClose: t[18] ||= (e) => $.value = !1,
908
+ onInsert: Bt
909
+ }, null, 8, ["visible"])) : x("", !0),
910
+ E(P(Ye), {
911
+ visible: P(J).mediaLibraryOpen.value,
912
+ accept: P(J).mediaLibraryAccept.value,
913
+ onSelect: P(At).handleMediaSelect,
914
+ onClose: P(At).handleMediaLibraryClose
915
+ }, null, 8, [
916
+ "visible",
917
+ "accept",
918
+ "onSelect",
919
+ "onClose"
920
+ ])
921
+ ], 64)) : x("", !0)
922
+ ], 14, nt));
923
+ }
924
+ }), [["__scopeId", "data-v-855e7645"]]);
925
+ //#endregion
926
+ export { G as default };