@templatical/editor 0.0.4 → 0.0.5

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 (108) hide show
  1. package/dist/{AiChatSidebar-CjfhTZwo.js → AiChatSidebar-DwME3f-a.js} +84 -70
  2. package/dist/{AiFeatureMenu-K44aZa_P.js → AiFeatureMenu-DJvWL1GZ.js} +23 -23
  3. package/dist/CloudEditor-Fe0ssRgi.js +1082 -0
  4. package/dist/{CollaboratorBar-BuCEcdbB.js → CollaboratorBar-DTT0EkZn.js} +1 -1
  5. package/dist/{CommentsSidebar-2lcqMfIP.js → CommentsSidebar-DrJhQRXK.js} +131 -131
  6. package/dist/{DesignReferenceSidebar-CNMu4Zrx.js → DesignReferenceSidebar-DdOht5zn.js} +49 -49
  7. package/dist/{ModuleBrowserModal-CvQ0xyQf.js → ModuleBrowserModal-CiV_jOEM.js} +58 -58
  8. package/dist/{ModulePreviewCanvas-Be2B3Y07.js → ModulePreviewCanvas-Bmy6Y1WE.js} +1 -1
  9. package/dist/ParagraphEditor-CoQ3NlS7.js +688 -0
  10. package/dist/{SaveModuleDialog-BaaeH5Xm.js → SaveModuleDialog-CD2ZYq1o.js} +25 -25
  11. package/dist/{SnapshotHistory-BPfjiuu1.js → SnapshotHistory-DltsKvhP.js} +1 -1
  12. package/dist/TemplateScoringPanel-DmnmUE3y.js +254 -0
  13. package/dist/{TestEmailModal-DIAlB3e_.js → TestEmailModal-Dl633j9o.js} +2 -2
  14. package/dist/{TitleEditor-D9DPjQkX.js → TitleEditor-C7fds2Nc.js} +3 -3
  15. package/dist/{TplModal-CmTSvCY-.js → TplModal-C5_CF-qn.js} +1 -1
  16. package/dist/{blockTypeIcons-D1RTWOkx.js → blockTypeIcons-BrKZB10B.js} +1 -1
  17. package/dist/cdn/chunks/AiChatSidebar-X_Bv3Qys.js +2 -0
  18. package/dist/cdn/chunks/{AiFeatureMenu-lxVm1RjH.js → AiFeatureMenu-C5UQmEgV.js} +16 -16
  19. package/dist/cdn/chunks/AiFeatureMenu-C5UQmEgV.js.map +1 -0
  20. package/dist/cdn/chunks/CloudEditor-DeTolKnf.js +1056 -0
  21. package/dist/cdn/chunks/CloudEditor-DeTolKnf.js.map +1 -0
  22. package/dist/cdn/chunks/{CollaboratorBar-D2PKtlOw.js → CollaboratorBar-DO1nxSrr.js} +3 -3
  23. package/dist/cdn/chunks/{CollaboratorBar-D2PKtlOw.js.map → CollaboratorBar-DO1nxSrr.js.map} +1 -1
  24. package/dist/cdn/chunks/CommentsSidebar-4MTw_hue.js +2 -0
  25. package/dist/cdn/chunks/DesignReferenceSidebar-Bswh4Yx4.js +2 -0
  26. package/dist/cdn/chunks/{ModuleBrowserModal-CxDXzkKS.js → ModuleBrowserModal-ChBr3aXj.js} +52 -52
  27. package/dist/cdn/chunks/ModuleBrowserModal-ChBr3aXj.js.map +1 -0
  28. package/dist/cdn/chunks/{ModulePreviewCanvas-DEfHampA.js → ModulePreviewCanvas-DkSvri9H.js} +2 -2
  29. package/dist/cdn/chunks/{ModulePreviewCanvas-DEfHampA.js.map → ModulePreviewCanvas-DkSvri9H.js.map} +1 -1
  30. package/dist/cdn/chunks/ParagraphEditor-DU3oUKA7.js +539 -0
  31. package/dist/cdn/chunks/ParagraphEditor-DU3oUKA7.js.map +1 -0
  32. package/dist/cdn/chunks/{RichTextEditorContent-DWUzizsC.js → RichTextEditorContent-BrsW1p9s.js} +4 -4
  33. package/dist/cdn/chunks/{RichTextEditorContent-DWUzizsC.js.map → RichTextEditorContent-BrsW1p9s.js.map} +1 -1
  34. package/dist/cdn/chunks/{SaveModuleDialog-DVna2xUl.js → SaveModuleDialog-CjqKkTEc.js} +24 -24
  35. package/dist/cdn/chunks/SaveModuleDialog-CjqKkTEc.js.map +1 -0
  36. package/dist/cdn/chunks/SnapshotHistory-KME4xmn_.js +2 -0
  37. package/dist/cdn/chunks/TemplateScoringPanel-DgB3xDN6.js +2 -0
  38. package/dist/cdn/chunks/TestEmailModal-DdpvRbYf.js +2 -0
  39. package/dist/cdn/chunks/{TitleEditor-DDf_OcHS.js → TitleEditor-C8FYbadT.js} +9 -9
  40. package/dist/cdn/chunks/{TitleEditor-DDf_OcHS.js.map → TitleEditor-C8FYbadT.js.map} +1 -1
  41. package/dist/cdn/chunks/{blockTypeIcons-BnobReQm.js → blockTypeIcons-5QwYklNq.js} +3 -3
  42. package/dist/cdn/chunks/{blockTypeIcons-BnobReQm.js.map → blockTypeIcons-5QwYklNq.js.map} +1 -1
  43. package/dist/cdn/chunks/{dist-CJcMnY7o.js → dist-BF5c3Dr-.js} +1 -1
  44. package/dist/cdn/chunks/dist-BGzvIxcJ.js +2 -0
  45. package/dist/cdn/chunks/dist-CFemF8rI.js +2 -0
  46. package/dist/cdn/chunks/dist-Co6uFhFK.js +2 -0
  47. package/dist/cdn/chunks/{dist-BkETaOfw.js → dist-DCikBY9K.js} +1 -1
  48. package/dist/cdn/chunks/dist-DUILafAC.js +2 -0
  49. package/dist/cdn/chunks/dist-DghiKH0A.js +2 -0
  50. package/dist/cdn/chunks/dist-Dw8ckvfK.js +2 -0
  51. package/dist/cdn/chunks/dist-H07p0KAw.js +2 -0
  52. package/dist/cdn/chunks/{dist-B878xb_62.js → dist-KYv9v_1z2.js} +11 -11
  53. package/dist/cdn/chunks/{dist-B878xb_62.js.map → dist-KYv9v_1z2.js.map} +1 -1
  54. package/dist/cdn/chunks/{dist-DLWHlekl.js → dist-MjnKIc0W.js} +1 -1
  55. package/dist/cdn/chunks/{dist-CllLxIMQ.js → dist-odp0vGRv.js} +1 -1
  56. package/dist/cdn/chunks/{extensions-B_kcV0tK.js → extensions-Bj7USRLr.js} +20 -20
  57. package/dist/cdn/chunks/{extensions-B_kcV0tK.js.map → extensions-Bj7USRLr.js.map} +1 -1
  58. package/dist/cdn/chunks/{features-ofOGnSC0.js → features-Ds0XUfte.js} +1235 -1198
  59. package/dist/cdn/chunks/features-Ds0XUfte.js.map +1 -0
  60. package/dist/cdn/chunks/{icons-bIb7PBOE.js → icons-fWsuSvgd.js} +2 -2
  61. package/dist/cdn/chunks/{icons-bIb7PBOE.js.map → icons-fWsuSvgd.js.map} +1 -1
  62. package/dist/cdn/chunks/{media-library-BIYzV2Y2.js → media-library-BGQm_OyC.js} +528 -528
  63. package/dist/cdn/chunks/{media-library-BIYzV2Y2.js.map → media-library-BGQm_OyC.js.map} +1 -1
  64. package/dist/cdn/chunks/{src-BuW9oYtm.js → src-3i8rPuqd.js} +4 -4
  65. package/dist/cdn/chunks/{src-BuW9oYtm.js.map → src-3i8rPuqd.js.map} +1 -1
  66. package/dist/cdn/chunks/{styleConstants-1KwsBMxJ.js → styleConstants-DFe3I4Op.js} +6 -6
  67. package/dist/cdn/chunks/{styleConstants-1KwsBMxJ.js.map → styleConstants-DFe3I4Op.js.map} +1 -1
  68. package/dist/cdn/chunks/{styles-DQFExz-T.js → styles-Dgijy53u.js} +1224 -1096
  69. package/dist/cdn/chunks/styles-Dgijy53u.js.map +1 -0
  70. package/dist/cdn/chunks/{tiptap-DplY-S-k.js → tiptap-BhxaWR8R.js} +2 -2
  71. package/dist/cdn/chunks/{tiptap-DplY-S-k.js.map → tiptap-BhxaWR8R.js.map} +1 -1
  72. package/dist/cdn/editor.css +1 -1
  73. package/dist/cdn/editor.js +110 -139
  74. package/dist/cdn/editor.js.map +1 -1
  75. package/dist/{dist-BkIys9zn.js → dist-Ci5lFuUy.js} +1 -1
  76. package/dist/{extensions-DEjfEFhD.js → extensions-DWx_jj8v.js} +1 -1
  77. package/dist/{styleConstants-D4SOZGBV.js → styleConstants-Cxw88naD.js} +5 -5
  78. package/dist/{styles-CgLaxDfu.js → styles-fdXNRqI3.js} +1341 -1213
  79. package/dist/templatical-editor.css +1 -1
  80. package/dist/templatical-editor.js +99 -129
  81. package/dist/templatical-editor.umd.cjs +55 -64
  82. package/dist/{useEditorCore-CjwRMl7K.js → useEditorCore-DUGD6pq_.js} +1054 -1033
  83. package/package.json +4 -2
  84. package/dist/CloudEditor-DFyuRxUV.js +0 -926
  85. package/dist/ParagraphEditor-CcMPnbDr.js +0 -652
  86. package/dist/TemplateScoringPanel-D58A23Vq.js +0 -249
  87. package/dist/cdn/chunks/AiChatSidebar-CmPTbTFG.js +0 -2
  88. package/dist/cdn/chunks/AiFeatureMenu-lxVm1RjH.js.map +0 -1
  89. package/dist/cdn/chunks/CloudEditor-Bmp5IlWi.js +0 -900
  90. package/dist/cdn/chunks/CloudEditor-Bmp5IlWi.js.map +0 -1
  91. package/dist/cdn/chunks/CommentsSidebar-BOelj4Ca.js +0 -2
  92. package/dist/cdn/chunks/DesignReferenceSidebar-Bf6rg0A7.js +0 -2
  93. package/dist/cdn/chunks/ModuleBrowserModal-CxDXzkKS.js.map +0 -1
  94. package/dist/cdn/chunks/ParagraphEditor-DHdu6lb3.js +0 -503
  95. package/dist/cdn/chunks/ParagraphEditor-DHdu6lb3.js.map +0 -1
  96. package/dist/cdn/chunks/SaveModuleDialog-DVna2xUl.js.map +0 -1
  97. package/dist/cdn/chunks/SnapshotHistory-BFF2SsTN.js +0 -2
  98. package/dist/cdn/chunks/TemplateScoringPanel-gi8wc_m7.js +0 -2
  99. package/dist/cdn/chunks/TestEmailModal-Qtd6aC-6.js +0 -2
  100. package/dist/cdn/chunks/dist-B6AUkMyh.js +0 -2
  101. package/dist/cdn/chunks/dist-Bf1Op9A1.js +0 -2
  102. package/dist/cdn/chunks/dist-CWsl6S1K.js +0 -2
  103. package/dist/cdn/chunks/dist-Cs0wFwdw.js +0 -2
  104. package/dist/cdn/chunks/dist-DS3_HVpX.js +0 -2
  105. package/dist/cdn/chunks/dist-DTXopj1a.js +0 -2
  106. package/dist/cdn/chunks/dist-DnwLoNLm.js +0 -2
  107. package/dist/cdn/chunks/features-ofOGnSC0.js.map +0 -1
  108. package/dist/cdn/chunks/styles-DQFExz-T.js.map +0 -1
@@ -0,0 +1,1056 @@
1
+ import { $ as e, B as t, F as n, H as r, M as i, N as a, P as o, S as s, U as c, X as l, _ as u, at as d, b as f, c as p, ct as m, d as h, g, h as _, j as v, lt as y, m as b, n as x, p as S, st as C, tt as w, u as T, v as E, x as D, y as O } from "./draggable-BQNU47zu.js";
2
+ import { $ as k, An as A, C as j, D as M, Gt as N, Kt as P, Lt as F, Mt as I, Pt as L, Rt as R, S as ee, St as z, Tt as B, Y as V, Zt as H, _ as U, _n as W, at as G, b as te, c as ne, ct as K, d as re, f as q, fn as J, ft as Y, g as ie, h as ae, in as X, jt as Z, k as oe, kt as se, l as ce, m as le, p as ue, pt as Q, qt as de, u as fe, v as pe, x as me, xt as he, y as ge } from "./features-Ds0XUfte.js";
3
+ import { S as _e, x as ve } from "./icons-fWsuSvgd.js";
4
+ import { a as ye, i as be, n as xe, o as Se, r as Ce, s as we, t as Te } from "./styles-Dgijy53u.js";
5
+ import { d as $ } from "./styleConstants-DFe3I4Op.js";
6
+ //#region src/cloud/composables/useSnapshotPreview.ts
7
+ function Ee(t) {
8
+ let { authManager: n, editor: r, history: i, conditionPreview: a, autoSave: o, onError: s } = t, c = w(null), l = e(null), u = e(null), d = S(() => l.value !== null), f = S(() => c.value?.snapshots.value ?? []), p = S(() => c.value?.isLoading.value ?? !1), m = S(() => c.value?.isRestoring.value ?? !1);
9
+ function h() {
10
+ r.state.template?.id && !c.value && (c.value = ue({
11
+ authManager: n,
12
+ templateId: r.state.template.id,
13
+ onRestore: g,
14
+ onError: s
15
+ }), c.value.loadSnapshots());
16
+ }
17
+ function g(e) {
18
+ r.setContent(e.content, !1), i.clear(), a.reset();
19
+ }
20
+ async function _(e) {
21
+ if (l.value) {
22
+ l.value = e, r.setContent(e.content, !1);
23
+ return;
24
+ }
25
+ r.state.isDirty && r.hasTemplate() && await r.createSnapshot(), u.value = structuredClone(r.content.value), o?.pause(), l.value = e, r.setContent(e.content, !1);
26
+ }
27
+ async function v() {
28
+ if (!(!l.value || !c.value)) try {
29
+ await c.value.restoreSnapshot(l.value.id), await c.value.loadSnapshots();
30
+ } finally {
31
+ l.value = null, u.value = null, o?.resume();
32
+ }
33
+ }
34
+ function y() {
35
+ !l.value || !u.value || (r.setContent(u.value, !1), l.value = null, u.value = null, o?.resume());
36
+ }
37
+ async function b() {
38
+ c.value && await c.value.loadSnapshots();
39
+ }
40
+ return {
41
+ snapshotHistoryInstance: c,
42
+ previewingSnapshot: l,
43
+ contentBeforePreview: u,
44
+ isPreviewingSnapshot: d,
45
+ snapshotHistorySnapshots: f,
46
+ snapshotHistoryIsLoading: p,
47
+ snapshotHistoryIsRestoring: m,
48
+ initSnapshotHistory: h,
49
+ handleRestore: g,
50
+ handleSnapshotNavigate: _,
51
+ confirmRestoreSnapshot: v,
52
+ cancelPreview: y,
53
+ loadSnapshotHistory: b
54
+ };
55
+ }
56
+ //#endregion
57
+ //#region src/cloud/composables/useCloudPanelState.ts
58
+ function De() {
59
+ let t = e(null), n = S({
60
+ get: () => t.value === "ai-chat",
61
+ set: (e) => t.value = e ? "ai-chat" : null
62
+ }), r = S({
63
+ get: () => t.value === "scoring",
64
+ set: (e) => t.value = e ? "scoring" : null
65
+ }), i = S({
66
+ get: () => t.value === "design-reference",
67
+ set: (e) => t.value = e ? "design-reference" : null
68
+ }), a = S({
69
+ get: () => t.value === "comments",
70
+ set: (e) => t.value = e ? "comments" : null
71
+ }), o = e(!1), s = e(!1), c = e(void 0), l = e(!1), u = e(null), d = S(() => t.value !== null), f = S(() => {
72
+ let e = t.value;
73
+ return e === "ai-chat" || e === "design-reference" || e === "scoring" ? e : null;
74
+ }), p = S(() => l.value || t.value === "ai-chat" || t.value === "design-reference" || t.value === "scoring");
75
+ function m() {
76
+ l.value = !l.value;
77
+ }
78
+ function h(e) {
79
+ l.value = !1, t.value = t.value === e ? null : e;
80
+ }
81
+ return H(u, () => {
82
+ l.value = !1;
83
+ }), {
84
+ activePanel: t,
85
+ aiChatOpen: n,
86
+ scoringPanelOpen: r,
87
+ designReferenceOpen: i,
88
+ commentsOpen: a,
89
+ testEmailModalOpen: o,
90
+ mediaLibraryOpen: s,
91
+ mediaLibraryAccept: c,
92
+ aiMenuOpen: l,
93
+ aiMenuRef: u,
94
+ rightPanelOpen: d,
95
+ activeAiFeature: f,
96
+ aiButtonActive: p,
97
+ toggleAiMenu: m,
98
+ handleAiFeatureSelect: h
99
+ };
100
+ }
101
+ //#endregion
102
+ //#region src/cloud/composables/useCollabUndoWarning.ts
103
+ function Oe(t) {
104
+ let { isCollaborationEnabled: n, getCollaboratorCount: r, canUndo: i } = t, a = e(!1), o = e(!1), { start: s } = X(() => {
105
+ o.value = !1;
106
+ }, A, { immediate: !1 });
107
+ function c() {
108
+ a.value || !n.value || r() === 0 || !i.value || (a.value = !0, o.value = !0, s());
109
+ }
110
+ return {
111
+ collabUndoWarningVisible: o,
112
+ showCollabUndoWarning: c
113
+ };
114
+ }
115
+ //#endregion
116
+ //#region src/cloud/composables/useCloudFeatureFlags.ts
117
+ function ke(t) {
118
+ let { planConfigInstance: n, aiConfig: r, editor: i } = t, a = S(() => n.hasFeature("ai_generation") && r.hasAnyMenuFeature.value), o = S(() => n.hasFeature("test_email")), s = S(() => !!i.state.template?.id), c = S(() => n.hasFeature("white_label")), l = S(() => n.config.value?.limits.max_templates ?? null), u = S(() => n.config.value?.template_count ?? 0), d = e(!1), f = e("idle"), p = e(""), { start: m } = X(() => {
119
+ f.value = "idle";
120
+ }, 3e3, { immediate: !1 });
121
+ return {
122
+ canUseAiGeneration: a,
123
+ canSendTestEmail: o,
124
+ hasTemplateSaved: s,
125
+ isWhiteLabeled: c,
126
+ templateLimit: l,
127
+ templateCount: u,
128
+ isSaveExporting: d,
129
+ saveStatus: f,
130
+ saveErrorMessage: p,
131
+ startSaveStatusClear: m
132
+ };
133
+ }
134
+ //#endregion
135
+ //#region src/cloud/composables/useCloudMediaLibrary.ts
136
+ function Ae(e) {
137
+ let { onRequestMedia: t, mediaLibraryOpen: n, mediaLibraryAccept: r } = e, i = null;
138
+ async function a() {
139
+ if (t) {
140
+ let e = await t({ accept: ["images"] });
141
+ return e ? {
142
+ url: e.url,
143
+ alt: e.alt_text || void 0
144
+ } : null;
145
+ }
146
+ return r.value = ["images"], n.value = !0, new Promise((e) => {
147
+ i = (t) => {
148
+ e(t);
149
+ };
150
+ });
151
+ }
152
+ function o(e) {
153
+ n.value = !1, i?.({
154
+ url: e.url,
155
+ alt: e.alt_text || void 0
156
+ }), i = null;
157
+ }
158
+ function s() {
159
+ n.value = !1, i?.(null), i = null;
160
+ }
161
+ return l(() => {
162
+ i &&= (i(null), null);
163
+ }), {
164
+ handleRequestMedia: a,
165
+ handleMediaSelect: o,
166
+ handleMediaLibraryClose: s
167
+ };
168
+ }
169
+ //#endregion
170
+ //#region src/cloud/composables/useCloudInitialization.ts
171
+ function je(n) {
172
+ let { config: r, translations: i, fontsManager: a, emit: s, getCommentsSidebar: c } = n, l = e(!0), u = e(!1), d = e(null), f = !1, p = { value: null }, m = null, h = null, g = new M({
173
+ ...r.auth,
174
+ onError: r.onError
175
+ }), _ = fe({
176
+ authManager: g,
177
+ onError: r.onError
178
+ }), v = e(/* @__PURE__ */ new Map()), y = ee({
179
+ authManager: g,
180
+ defaultFontFamily: r.fonts?.defaultFont,
181
+ templateDefaults: r.templateDefaults,
182
+ onError: r.onError,
183
+ lockedBlocks: v
184
+ }), b = ae({
185
+ authManager: g,
186
+ onError: r.onError
187
+ });
188
+ r.mcp?.enabled && ne({
189
+ editor: y,
190
+ channel: b.channel,
191
+ onOperation: r.mcp.onOperation
192
+ });
193
+ let x = null;
194
+ r.collaboration?.enabled && (x = U({
195
+ authManager: g,
196
+ editor: y,
197
+ channel: b.channel,
198
+ onError: r.onError,
199
+ onCollaboratorJoined: r.collaboration.onCollaboratorJoined,
200
+ onCollaboratorLeft: r.collaboration.onCollaboratorLeft,
201
+ onBlockLocked: r.collaboration.onBlockLocked,
202
+ onBlockUnlocked: r.collaboration.onBlockUnlocked
203
+ }), t(() => x.lockedBlocks.value, (e) => {
204
+ v.value = e;
205
+ }, { immediate: !0 }), ie(y, x));
206
+ let C = S(() => !!r.collaboration?.enabled && _.hasFeature("collaboration")), w = oe({
207
+ editor: y,
208
+ config: {
209
+ uiTheme: r.uiTheme,
210
+ theme: void 0,
211
+ blockDefaults: r.blockDefaults,
212
+ customBlocks: [],
213
+ mergeTags: r.mergeTags,
214
+ displayConditions: r.displayConditions,
215
+ onRequestMedia: null,
216
+ onSave: () => {
217
+ p.value?.().catch((e) => {
218
+ r.onError?.(e);
219
+ });
220
+ }
221
+ },
222
+ translations: i,
223
+ fontsManager: a,
224
+ historyOptions: x ? { isRemoteOperation: () => x._isProcessingRemoteOperation() } : void 0,
225
+ autoSaveOptions: {
226
+ onChange: async () => {
227
+ y.hasTemplate() && (await y.createSnapshot(), m?.snapshotHistoryInstance.value?.loadSnapshots());
228
+ },
229
+ debounce: r.autoSaveDebounce ?? 5e3,
230
+ enabled: () => r.autoSave !== !1 && _.hasFeature("auto_save")
231
+ },
232
+ themeExtraStyles: () => ({ "--tpl-drop-text": `"${i.canvas.dropHere}"` }),
233
+ keyboardOptions: { onBeforeUndo: () => h?.showCollabUndoWarning() }
234
+ }), T = Oe({
235
+ isCollaborationEnabled: C,
236
+ getCollaboratorCount: () => x?.collaborators.value.length ?? 0,
237
+ canUndo: w.history.canUndo
238
+ });
239
+ h = T;
240
+ let E = Ee({
241
+ authManager: g,
242
+ editor: y,
243
+ history: w.history,
244
+ conditionPreview: w.conditionPreview,
245
+ autoSave: w.autoSave,
246
+ onError: r.onError
247
+ });
248
+ m = E;
249
+ let D = De(), O = me(r.ai), k = ke({
250
+ planConfigInstance: _,
251
+ aiConfig: O,
252
+ editor: y
253
+ }), A = Ae({
254
+ onRequestMedia: r.onRequestMedia,
255
+ mediaLibraryOpen: D.mediaLibraryOpen,
256
+ mediaLibraryAccept: D.mediaLibraryAccept
257
+ });
258
+ V({
259
+ onBlockMove: y.moveBlock,
260
+ onBlockAdd: y.addBlock
261
+ });
262
+ let j = re({
263
+ authManager: g,
264
+ getFontsConfig: () => r.fonts,
265
+ canUseCustomFonts: () => _.hasFeature("custom_fonts")
266
+ }), z = q({
267
+ authManager: g,
268
+ getTemplateId: () => y.state.template?.id ?? null,
269
+ save: () => y.save(),
270
+ exportHtml: (e) => j.exportHtml(e),
271
+ onError: r.onError,
272
+ isAuthReady: u,
273
+ onBeforeTestEmail: r.onBeforeTestEmail
274
+ }), B = ge({
275
+ authManager: g,
276
+ getTemplateId: () => y.state.template?.id ?? null,
277
+ getSocketId: () => b.getSocketId(),
278
+ onComment: r.onComment,
279
+ onError: r.onError,
280
+ isAuthReady: u,
281
+ hasCommentingFeature: () => r.commenting !== !1 && _.hasFeature("commenting")
282
+ });
283
+ pe({
284
+ comments: B,
285
+ channel: b.channel
286
+ });
287
+ let H = le({
288
+ authManager: g,
289
+ onError: r.onError
290
+ }), W = e(!1), G = e(null), K = e(!1), J = te({
291
+ authManager: g,
292
+ getTemplateId: () => y.state.template?.id ?? null
293
+ });
294
+ function Y(e) {
295
+ D.commentsOpen.value = !0, queueMicrotask(() => {
296
+ c()?.filterByBlock(e);
297
+ });
298
+ }
299
+ o(N, A.handleRequestMedia), o(L, g), o(I, O), o(R, B), o(P, H), o(de, J), o(F, {
300
+ plan: _,
301
+ ai: O,
302
+ comments: {
303
+ getBlockCount: (e) => B.commentCountByBlock.value.get(e) ?? 0,
304
+ openForBlock: Y
305
+ },
306
+ savedModules: {
307
+ openSaveDialog: (e) => {
308
+ G.value = e ?? null, W.value = !0;
309
+ },
310
+ openBrowser: () => {
311
+ K.value = !0;
312
+ },
313
+ moduleCount: S(() => H.modules.value.length)
314
+ }
315
+ });
316
+ function X(e) {
317
+ _.hasFeature("theme_customization") && (w.themeOverrides.value = e);
318
+ }
319
+ function Z(e) {
320
+ y.setUiTheme(e);
321
+ }
322
+ async function ue() {
323
+ l.value = !0, d.value = null;
324
+ try {
325
+ if (await g.initialize(), f) return;
326
+ u.value = !0;
327
+ let e = await ce({ authManager: g });
328
+ if (f) return;
329
+ if (!e.api.ok) throw Error("Health check failed: API is not reachable");
330
+ if (!e.auth.ok) throw Error(`Health check failed: authentication error${e.auth.error ? ` - ${e.auth.error}` : ""}`);
331
+ if (e.websocket.ok || se.warn("WebSocket health check failed:", e.websocket.error ?? "unknown error", "-- real-time features will be disabled."), await _.fetchConfig(), f) return;
332
+ a.setCustomFontsEnabled(_.hasFeature("custom_fonts")), r.customBlocks?.length && _.hasFeature("custom_blocks") && w.registerCustomBlocks(r.customBlocks), r.theme && _.hasFeature("theme_customization") && (w.themeOverrides.value = r.theme), r.modules !== !1 && _.hasFeature("saved_modules") && H.loadModules(), s("ready");
333
+ } catch (e) {
334
+ if (f) return;
335
+ let t = e instanceof Error ? e : Error("Initialization failed", { cause: e });
336
+ d.value = t, r.onError?.(t);
337
+ } finally {
338
+ f || (l.value = !1);
339
+ }
340
+ }
341
+ function Q() {
342
+ f = !0, a.cleanupFontLinks(), b.disconnect(), w.destroy(), r.onUnmount?.();
343
+ }
344
+ return {
345
+ isInitializing: l,
346
+ isAuthReady: u,
347
+ initError: d,
348
+ isDestroyed: () => f,
349
+ authManager: g,
350
+ planConfigInstance: _,
351
+ websocket: b,
352
+ collaboration: x,
353
+ isCollaborationEnabled: C,
354
+ editor: y,
355
+ core: w,
356
+ aiConfig: O,
357
+ featureFlags: k,
358
+ mediaLib: A,
359
+ exporter: j,
360
+ testEmail: z,
361
+ commentsInstance: B,
362
+ savedModulesHeadless: H,
363
+ scoringInstance: J,
364
+ panelState: D,
365
+ snapshotPreview: E,
366
+ collabWarning: T,
367
+ showSaveModuleDialog: W,
368
+ showModuleBrowserModal: K,
369
+ saveModulePreSelectedBlockId: G,
370
+ onSaveHook: p,
371
+ initialize: ue,
372
+ destroy: Q,
373
+ setThemeOverrides: X,
374
+ setUiTheme: Z,
375
+ openCommentsForBlock: Y
376
+ };
377
+ }
378
+ //#endregion
379
+ //#region src/utils/preRenderCustomBlocks.ts
380
+ async function Me(e, t) {
381
+ let n = async (e) => {
382
+ if (W(e)) {
383
+ let n = e;
384
+ try {
385
+ n.renderedHtml = await t.renderCustomBlock(n);
386
+ } catch {
387
+ n.renderedHtml = `<!-- Custom block render error: ${n.customType} -->`;
388
+ }
389
+ }
390
+ if (e.type === "section" && "children" in e) {
391
+ let t = e;
392
+ for (let e of t.children) for (let t of e) await n(t);
393
+ }
394
+ };
395
+ for (let t of e.blocks) await n(t);
396
+ }
397
+ //#endregion
398
+ //#region src/cloud/composables/useCloudLifecycle.ts
399
+ function Ne(e) {
400
+ let { config: t, editor: n, websocket: r, planConfigInstance: i, snapshotPreview: a, core: o, exporter: s, featureFlags: c, isDestroyed: l } = e;
401
+ function u() {
402
+ return j(i.config.value.websocket);
403
+ }
404
+ async function d(e) {
405
+ let i = await n.create(e);
406
+ return l() ? i : (t.onCreate?.(i), a.initSnapshotHistory(), r.connect(i.id, u()), i);
407
+ }
408
+ async function f(e) {
409
+ let i = await n.load(e);
410
+ return l() ? i : (t.onLoad?.(i), a.initSnapshotHistory(), r.connect(i.id, u()), i);
411
+ }
412
+ async function p() {
413
+ c.isSaveExporting.value = !0, c.saveStatus.value = "idle";
414
+ try {
415
+ if (await Me(n.content.value, o.registry), l()) throw Error("Component unmounted during save");
416
+ let e = await n.save();
417
+ if (l()) throw Error("Component unmounted during save");
418
+ a.initSnapshotHistory(), a.snapshotHistoryInstance.value?.loadSnapshots();
419
+ let r = await s.exportHtml(e.id);
420
+ if (l()) throw Error("Component unmounted during save");
421
+ let i = {
422
+ templateId: e.id,
423
+ html: r.html,
424
+ mjml: r.mjml,
425
+ content: e.content
426
+ };
427
+ return t.onSave?.(i), c.saveStatus.value = "saved", c.startSaveStatusClear(), i;
428
+ } catch (e) {
429
+ throw l() || (c.saveStatus.value = "error", c.saveErrorMessage.value = e instanceof Error ? e.message : "Save failed"), e;
430
+ } finally {
431
+ l() || (c.isSaveExporting.value = !1);
432
+ }
433
+ }
434
+ return {
435
+ createTemplate: d,
436
+ loadTemplate: f,
437
+ saveTemplate: p
438
+ };
439
+ }
440
+ //#endregion
441
+ //#region src/cloud/components/CloudHeader.vue?vue&type=script&setup=true&lang.ts
442
+ var Pe = {
443
+ 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",
444
+ style: {
445
+ "background-color": "color-mix(in srgb, var(--tpl-bg) 80%, transparent)",
446
+ "backdrop-filter": "blur(12px)",
447
+ "-webkit-backdrop-filter": "blur(12px)",
448
+ "box-shadow": "var(--tpl-shadow-md)",
449
+ "border-bottom": "1px solid var(--tpl-border)"
450
+ }
451
+ }, Fe = { class: "tpl-header-left tpl:flex tpl:min-w-[200px] tpl:items-center tpl:gap-3" }, Ie = {
452
+ key: 0,
453
+ class: "tpl-logo tpl:flex tpl:items-center tpl:gap-2.5 tpl:text-sm tpl:font-semibold tpl:text-[var(--tpl-text)]"
454
+ }, Le = ["src"], Re = { style: { "letter-spacing": "-0.01em" } }, ze = {
455
+ key: 1,
456
+ class: "tpl:text-xs tpl:opacity-60 tpl:text-[var(--tpl-text-muted)]"
457
+ }, Be = { class: "tpl-header-center tpl:flex tpl:items-center tpl:justify-center tpl:gap-10" }, Ve = { class: "tpl-header-right tpl:flex tpl:min-w-[200px] tpl:items-center tpl:justify-end tpl:gap-3" }, He = ["data-tooltip"], Ue = {
458
+ key: 1,
459
+ "aria-live": "polite",
460
+ class: "tpl-status tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-success)]"
461
+ }, We = {
462
+ key: 2,
463
+ "aria-live": "polite",
464
+ class: "tpl-status tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-text-muted)]"
465
+ }, Ge = ["aria-label", "aria-expanded"], Ke = {
466
+ key: 0,
467
+ 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)]"
468
+ }, qe = ["aria-expanded"], Je = {
469
+ key: 0,
470
+ class: "tpl:absolute tpl:right-0 tpl:top-full tpl:z-50 tpl:mt-1 tpl:origin-top-right"
471
+ }, Ye = ["disabled"], Xe = ["disabled"], Ze = /* @__PURE__ */ s({
472
+ __name: "CloudHeader",
473
+ props: {
474
+ editor: {},
475
+ core: {},
476
+ authManager: {},
477
+ featureFlags: {},
478
+ panelState: {},
479
+ snapshotPreview: {},
480
+ commentsInstance: {},
481
+ testEmail: {},
482
+ websocket: {},
483
+ collaboration: {},
484
+ isCollaborationEnabled: { type: Boolean },
485
+ isSaveDisabled: { type: Boolean },
486
+ isSaving: { type: Boolean }
487
+ },
488
+ emits: ["save"],
489
+ setup(e) {
490
+ let t = D(() => import("./CollaboratorBar-DO1nxSrr.js")), n = D(() => import("./SnapshotHistory-KME4xmn_.js")), i = D(() => import("./AiFeatureMenu-C5UQmEgV.js"));
491
+ return (o, s) => (a(), u("header", Pe, [
492
+ b("div", Fe, [e.featureFlags.isWhiteLabeled.value ? g("", !0) : (a(), u("div", Ie, [b("img", {
493
+ src: e.authManager.resolveUrl("/logo.svg"),
494
+ alt: "Templatical",
495
+ width: "24",
496
+ height: "24",
497
+ class: "tpl:shrink-0"
498
+ }, null, 8, Le), b("span", Re, y(e.core.t.header.title), 1)])), e.featureFlags.templateLimit.value === null ? g("", !0) : (a(), u("span", ze, y(e.core.format(e.core.t.header.templatesUsed, {
499
+ used: e.featureFlags.templateCount.value,
500
+ max: e.featureFlags.templateLimit.value
501
+ })), 1))]),
502
+ b("div", Be, [
503
+ f(be, {
504
+ viewport: e.editor.state.viewport,
505
+ onChange: e.editor.setViewport
506
+ }, null, 8, ["viewport", "onChange"]),
507
+ f(xe, {
508
+ "dark-mode": e.editor.state.darkMode,
509
+ onChange: e.editor.setDarkMode
510
+ }, null, 8, ["dark-mode", "onChange"]),
511
+ f(Ce, {
512
+ "preview-mode": e.editor.state.previewMode,
513
+ onChange: e.editor.setPreviewMode
514
+ }, null, 8, ["preview-mode", "onChange"]),
515
+ e.collaboration && e.isCollaborationEnabled ? (a(), _(d(t), {
516
+ key: 0,
517
+ collaborators: e.collaboration.collaborators.value,
518
+ "is-connected": e.websocket.isConnected.value
519
+ }, null, 8, ["collaborators", "is-connected"])) : g("", !0),
520
+ e.snapshotPreview.snapshotHistoryInstance.value ? (a(), _(d(n), {
521
+ key: 1,
522
+ snapshots: e.snapshotPreview.snapshotHistorySnapshots.value,
523
+ "is-loading": e.snapshotPreview.snapshotHistoryIsLoading.value,
524
+ "is-restoring": e.snapshotPreview.snapshotHistoryIsRestoring.value,
525
+ onLoad: e.snapshotPreview.loadSnapshotHistory,
526
+ onNavigate: e.snapshotPreview.handleSnapshotNavigate
527
+ }, null, 8, [
528
+ "snapshots",
529
+ "is-loading",
530
+ "is-restoring",
531
+ "onLoad",
532
+ "onNavigate"
533
+ ])) : g("", !0)
534
+ ]),
535
+ b("div", Ve, [
536
+ e.featureFlags.saveStatus.value === "error" ? (a(), u("div", {
537
+ key: 0,
538
+ "aria-live": "assertive",
539
+ class: "tpl-tooltip tpl-status tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-danger)]",
540
+ "data-tooltip": e.featureFlags.saveErrorMessage.value
541
+ }, [f(d(z), {
542
+ size: 12,
543
+ "stroke-width": 2.5
544
+ }), O(" " + y(e.core.t.header.saveFailed), 1)], 8, He)) : e.featureFlags.saveStatus.value === "saved" ? (a(), u("div", Ue, [f(d(B), {
545
+ size: 12,
546
+ "stroke-width": 2.5
547
+ }), O(" " + y(e.core.t.header.saved), 1)])) : e.editor.state.isDirty ? (a(), u("div", We, [s[4] ||= b("span", { class: "tpl-pulse tpl:size-1.5 tpl:rounded-full tpl:bg-[var(--tpl-primary)]" }, null, -1), O(" " + y(e.core.t.header.unsaved), 1)])) : g("", !0),
548
+ e.commentsInstance.isEnabled.value && e.featureFlags.hasTemplateSaved.value ? (a(), u("button", {
549
+ key: 3,
550
+ "aria-label": e.commentsInstance.unresolvedCount.value > 0 ? `${e.core.t.comments.button} (${e.commentsInstance.unresolvedCount.value})` : e.core.t.comments.button,
551
+ "aria-expanded": e.panelState.commentsOpen.value,
552
+ class: C(d($)),
553
+ style: m({
554
+ backgroundColor: e.panelState.commentsOpen.value ? "var(--tpl-primary)" : "transparent",
555
+ color: e.panelState.commentsOpen.value ? "var(--tpl-bg)" : "var(--tpl-primary)",
556
+ borderColor: "var(--tpl-primary)"
557
+ }),
558
+ onClick: s[0] ||= (t) => e.panelState.commentsOpen.value = !e.panelState.commentsOpen.value
559
+ }, [
560
+ f(d(Y), {
561
+ size: 16,
562
+ "stroke-width": 2
563
+ }),
564
+ O(" " + y(e.core.t.comments.button) + " ", 1),
565
+ e.commentsInstance.unresolvedCount.value > 0 && !e.panelState.commentsOpen.value ? (a(), u("span", Ke, y(e.commentsInstance.unresolvedCount.value), 1)) : g("", !0)
566
+ ], 14, Ge)) : g("", !0),
567
+ e.featureFlags.canUseAiGeneration.value && e.featureFlags.hasTemplateSaved.value ? (a(), u("div", {
568
+ key: 4,
569
+ ref: (t) => e.panelState.aiMenuRef.value = t,
570
+ class: "tpl:relative"
571
+ }, [b("button", {
572
+ "aria-expanded": e.panelState.aiMenuOpen.value,
573
+ class: C(["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", e.panelState.aiButtonActive.value ? "tpl-ai-btn--active" : "tpl-ai-btn--idle"]),
574
+ onClick: s[1] ||= T((...t) => e.panelState.toggleAiMenu && e.panelState.toggleAiMenu(...t), ["stop"])
575
+ }, [f(d(G), {
576
+ size: 16,
577
+ "stroke-width": 2,
578
+ class: "tpl-ai-btn-icon"
579
+ }), O(" " + y(e.core.t.aiChat.button), 1)], 10, qe), f(x, {
580
+ "enter-active-class": "tpl:transition-all tpl:duration-150 tpl:ease-out",
581
+ "enter-from-class": "tpl:scale-95 tpl:opacity-0",
582
+ "enter-to-class": "tpl:scale-100 tpl:opacity-100",
583
+ "leave-active-class": "tpl:transition-all tpl:duration-100 tpl:ease-in",
584
+ "leave-from-class": "tpl:scale-100 tpl:opacity-100",
585
+ "leave-to-class": "tpl:scale-95 tpl:opacity-0"
586
+ }, {
587
+ default: r(() => [e.panelState.aiMenuOpen.value ? (a(), u("div", Je, [f(d(i), {
588
+ "active-feature": e.panelState.activeAiFeature.value,
589
+ onSelect: e.panelState.handleAiFeatureSelect
590
+ }, null, 8, ["active-feature", "onSelect"])])) : g("", !0)]),
591
+ _: 1
592
+ })], 512)) : g("", !0),
593
+ e.testEmail.isEnabled.value && e.featureFlags.canSendTestEmail.value ? (a(), u("button", {
594
+ key: 5,
595
+ class: C(d($)),
596
+ style: {
597
+ "background-color": "transparent",
598
+ color: "var(--tpl-primary)",
599
+ "border-color": "var(--tpl-primary)"
600
+ },
601
+ disabled: e.testEmail.isSending.value || !e.featureFlags.hasTemplateSaved.value,
602
+ onClick: s[2] ||= (t) => e.panelState.testEmailModalOpen.value = !0
603
+ }, [e.testEmail.isSending.value ? (a(), _(d(Q), {
604
+ key: 1,
605
+ class: "tpl-spinner",
606
+ size: 16,
607
+ "stroke-width": 2
608
+ })) : (a(), _(d(K), {
609
+ key: 0,
610
+ size: 16,
611
+ "stroke-width": 2
612
+ })), O(" " + y(e.core.t.testEmail.button), 1)], 10, Ye)) : g("", !0),
613
+ b("button", {
614
+ class: C(d($)),
615
+ style: {
616
+ "background-color": "transparent",
617
+ color: "var(--tpl-primary)",
618
+ "border-color": "var(--tpl-primary)"
619
+ },
620
+ disabled: e.isSaveDisabled,
621
+ onClick: s[3] ||= (e) => o.$emit("save")
622
+ }, [e.isSaving ? (a(), _(d(Q), {
623
+ key: 1,
624
+ class: "tpl-spinner",
625
+ size: 16,
626
+ "stroke-width": 2
627
+ })) : (a(), _(d(ve), {
628
+ key: 0,
629
+ size: 16,
630
+ "stroke-width": 2
631
+ })), O(" " + y(e.isSaving ? e.core.t.header.saving : e.core.t.header.save), 1)], 10, Xe)
632
+ ])
633
+ ]));
634
+ }
635
+ }), Qe = /* @__PURE__ */ s({
636
+ __name: "CloudPanels",
637
+ props: {
638
+ config: {},
639
+ editor: {},
640
+ core: {},
641
+ panelState: {},
642
+ planConfigInstance: {},
643
+ testEmail: {},
644
+ mediaLib: {},
645
+ savedModulesHeadless: {},
646
+ showSaveModuleDialog: { type: Boolean },
647
+ saveModulePreSelectedBlockId: {},
648
+ showModuleBrowserModal: { type: Boolean }
649
+ },
650
+ emits: [
651
+ "update:showSaveModuleDialog",
652
+ "update:saveModulePreSelectedBlockId",
653
+ "update:showModuleBrowserModal",
654
+ "send-test-email",
655
+ "module-insert"
656
+ ],
657
+ setup(t, { expose: n, emit: r }) {
658
+ let i = D(() => import("./AiChatSidebar-X_Bv3Qys.js")), o = D(() => import("./CommentsSidebar-4MTw_hue.js")), s = D(() => import("./DesignReferenceSidebar-Bswh4Yx4.js")), c = D(() => import("./TemplateScoringPanel-DgB3xDN6.js")), l = D(() => import("./TestEmailModal-DdpvRbYf.js")), p = D(() => import("./SaveModuleDialog-CjqKkTEc.js")), m = D(() => import("./ModuleBrowserModal-ChBr3aXj.js")), v = D(async () => (await import("./src-3i8rPuqd.js")).MediaLibraryModal), y = r;
659
+ function b(e, t, n) {
660
+ t.history.record(), n.setContent(e), t.conditionPreview.reset();
661
+ }
662
+ let x = e(null);
663
+ function S(e) {
664
+ x.value?.filterByBlock(e);
665
+ }
666
+ return n({ filterCommentsByBlock: S }), (e, n) => (a(), u(h, null, [
667
+ f(d(i), {
668
+ visible: t.panelState.aiChatOpen.value,
669
+ "on-apply": (e) => b(e, t.core, t.editor),
670
+ onClose: n[0] ||= (e) => t.panelState.aiChatOpen.value = !1
671
+ }, null, 8, ["visible", "on-apply"]),
672
+ f(d(c), {
673
+ visible: t.panelState.scoringPanelOpen.value,
674
+ onClose: n[1] ||= (e) => t.panelState.scoringPanelOpen.value = !1
675
+ }, null, 8, ["visible"]),
676
+ f(d(s), {
677
+ visible: t.panelState.designReferenceOpen.value,
678
+ "has-existing-blocks": t.editor.content.value.blocks.length > 0,
679
+ onClose: n[2] ||= (e) => t.panelState.designReferenceOpen.value = !1,
680
+ onApply: n[3] ||= (e) => b(e, t.core, t.editor)
681
+ }, null, 8, ["visible", "has-existing-blocks"]),
682
+ f(d(o), {
683
+ ref_key: "commentsSidebar",
684
+ ref: x,
685
+ visible: t.panelState.commentsOpen.value,
686
+ onClose: n[4] ||= (e) => t.panelState.commentsOpen.value = !1
687
+ }, null, 8, ["visible"]),
688
+ f(d(l), {
689
+ visible: t.panelState.testEmailModalOpen.value,
690
+ "allowed-emails": t.testEmail.allowedEmails.value,
691
+ "is-sending": t.testEmail.isSending.value,
692
+ error: t.testEmail.error.value,
693
+ onSend: n[5] ||= (e) => y("send-test-email", e),
694
+ onClose: n[6] ||= (e) => t.panelState.testEmailModalOpen.value = !1
695
+ }, null, 8, [
696
+ "visible",
697
+ "allowed-emails",
698
+ "is-sending",
699
+ "error"
700
+ ]),
701
+ t.planConfigInstance.hasFeature("saved_modules") && t.config.modules !== !1 ? (a(), _(d(p), {
702
+ key: 0,
703
+ visible: t.showSaveModuleDialog,
704
+ "pre-selected-block-id": t.saveModulePreSelectedBlockId,
705
+ onClose: n[7] ||= (e) => {
706
+ y("update:showSaveModuleDialog", !1), y("update:saveModulePreSelectedBlockId", null);
707
+ },
708
+ onSaved: n[8] ||= (e) => t.savedModulesHeadless.loadModules()
709
+ }, null, 8, ["visible", "pre-selected-block-id"])) : g("", !0),
710
+ t.planConfigInstance.hasFeature("saved_modules") && t.config.modules !== !1 ? (a(), _(d(m), {
711
+ key: 1,
712
+ visible: t.showModuleBrowserModal,
713
+ onClose: n[9] ||= (e) => y("update:showModuleBrowserModal", !1),
714
+ onInsert: n[10] ||= (e, t) => y("module-insert", e, t)
715
+ }, null, 8, ["visible"])) : g("", !0),
716
+ f(d(v), {
717
+ visible: t.panelState.mediaLibraryOpen.value,
718
+ accept: t.panelState.mediaLibraryAccept.value,
719
+ onSelect: t.mediaLib.handleMediaSelect,
720
+ onClose: t.mediaLib.handleMediaLibraryClose
721
+ }, null, 8, [
722
+ "visible",
723
+ "accept",
724
+ "onSelect",
725
+ "onClose"
726
+ ])
727
+ ], 64));
728
+ }
729
+ }), $e = {
730
+ key: 0,
731
+ class: "tpl-loading tpl:absolute tpl:inset-0 tpl:z-overlay tpl:flex tpl:flex-col tpl:bg-[var(--tpl-bg)]"
732
+ }, et = { class: "tpl:flex tpl:flex-1 tpl:overflow-hidden" }, tt = { 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)]" }, nt = /* @__PURE__ */ s({
733
+ __name: "CloudLoadingOverlay",
734
+ props: { visible: { type: Boolean } },
735
+ setup(e) {
736
+ return (t, r) => e.visible ? (a(), u("div", $e, [r[1] ||= E("<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), b("div", et, [b("div", tt, [(a(), u(h, null, n(5, (e) => b("div", {
737
+ key: e,
738
+ class: "tpl-shimmer tpl:size-7 tpl:rounded-[var(--tpl-radius-sm)]"
739
+ })), 64))]), r[0] ||= E("<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)])])) : g("", !0);
740
+ }
741
+ }), rt = {
742
+ key: 0,
743
+ role: "alert",
744
+ 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)]"
745
+ }, it = { class: "tpl:flex tpl:size-16 tpl:items-center tpl:justify-center tpl:rounded-full tpl:bg-[var(--tpl-danger-light)]" }, at = { class: "tpl:flex tpl:flex-col tpl:items-center tpl:gap-2 tpl:text-center" }, ot = { class: "tpl:text-lg tpl:font-semibold tpl:text-[var(--tpl-text)]" }, st = { class: "tpl:max-w-md tpl:text-sm tpl:text-[var(--tpl-text-muted)]" }, ct = /* @__PURE__ */ s({
746
+ __name: "CloudErrorOverlay",
747
+ props: {
748
+ error: {},
749
+ visible: { type: Boolean }
750
+ },
751
+ emits: ["retry"],
752
+ setup(e, { emit: t }) {
753
+ let n = t, { t: r } = Z();
754
+ function i(e) {
755
+ return "isUnauthorized" in e && e.isUnauthorized ? r.error.authFailed : "isNotFound" in e && e.isNotFound ? r.error.templateNotFound : r.error.defaultMessage;
756
+ }
757
+ function o(e) {
758
+ return "isNotFound" in e && !!e.isNotFound;
759
+ }
760
+ return (t, s) => e.visible && e.error ? (a(), u("div", rt, [
761
+ b("div", it, [f(d(z), {
762
+ size: 32,
763
+ "stroke-width": 1.5,
764
+ class: "tpl:text-[var(--tpl-danger)]"
765
+ })]),
766
+ b("div", at, [b("h2", ot, y(d(r).error.title), 1), b("p", st, y(i(e.error)), 1)]),
767
+ o(e.error) ? g("", !0) : (a(), u("button", {
768
+ key: 0,
769
+ 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)]",
770
+ onClick: s[0] ||= (e) => n("retry")
771
+ }, y(d(r).error.retry), 1))
772
+ ])) : g("", !0);
773
+ }
774
+ }), lt = {
775
+ key: 0,
776
+ 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)]"
777
+ }, ut = { class: "tpl:flex tpl:items-center tpl:gap-2 tpl:text-sm tpl:text-[var(--tpl-text)]" }, dt = { class: "tpl:flex tpl:items-center tpl:gap-2" }, ft = /* @__PURE__ */ s({
778
+ __name: "SnapshotPreviewBanner",
779
+ props: { visible: { type: Boolean } },
780
+ emits: ["cancel", "confirm"],
781
+ setup(e, { emit: t }) {
782
+ let n = t, { t: r } = Z();
783
+ return (t, i) => e.visible ? (a(), u("div", lt, [b("div", ut, [f(d(he), {
784
+ size: 18,
785
+ "stroke-width": 2,
786
+ class: "tpl:text-[var(--tpl-primary)]"
787
+ }), b("span", null, y(d(r).snapshotPreview.message), 1)]), b("div", dt, [b("button", {
788
+ 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)]",
789
+ style: { "background-color": "transparent" },
790
+ onClick: i[0] ||= (e) => n("cancel")
791
+ }, y(d(r).snapshotPreview.cancel), 1), b("button", {
792
+ 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)]",
793
+ onClick: i[1] ||= (e) => n("confirm")
794
+ }, y(d(r).snapshotPreview.restore), 1)])])) : g("", !0);
795
+ }
796
+ }), pt = {
797
+ key: 0,
798
+ role: "status",
799
+ "aria-live": "polite",
800
+ 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",
801
+ style: {
802
+ "background-color": "var(--tpl-warning-light)",
803
+ color: "var(--tpl-text)",
804
+ border: "1px solid var(--tpl-warning)"
805
+ }
806
+ }, mt = /* @__PURE__ */ s({
807
+ __name: "CollabUndoToast",
808
+ props: { visible: { type: Boolean } },
809
+ setup(e) {
810
+ let { t } = Z();
811
+ return (n, r) => e.visible ? (a(), u("div", pt, y(d(t).history.collabWarning), 1)) : g("", !0);
812
+ }
813
+ }), ht = ["data-tpl-theme"], gt = { class: "tpl:sticky tpl:top-0 tpl:z-40 tpl:h-0" }, _t = { class: "tpl-main tpl:flex tpl:justify-center tpl:p-8" }, vt = ["aria-label"], yt = /* @__PURE__ */ k(/* @__PURE__ */ s({
814
+ __name: "CloudEditor",
815
+ props: {
816
+ config: {},
817
+ translations: {},
818
+ fontsManager: {}
819
+ },
820
+ emits: ["ready"],
821
+ setup(t, { expose: n, emit: o }) {
822
+ let s = t, l = o, h = e(null), S = je({
823
+ config: s.config,
824
+ translations: s.translations,
825
+ fontsManager: s.fontsManager,
826
+ emit: l,
827
+ getCommentsSidebar: () => h.value ? { filterByBlock: h.value.filterCommentsByBlock } : null
828
+ }), { isInitializing: w, isAuthReady: T, initError: E, authManager: D, planConfigInstance: k, websocket: A, collaboration: j, isCollaborationEnabled: M, editor: N, core: P, featureFlags: F, mediaLib: I, exporter: L, testEmail: R, commentsInstance: ee, savedModulesHeadless: z, panelState: B, snapshotPreview: V, collabWarning: H, showSaveModuleDialog: U, showModuleBrowserModal: W, saveModulePreSelectedBlockId: G, setThemeOverrides: te, setUiTheme: ne } = S;
829
+ async function K(e) {
830
+ try {
831
+ await R.sendTestEmail(e), B.testEmailModalOpen.value = !1;
832
+ } catch {}
833
+ }
834
+ function re(e, t) {
835
+ for (let n = 0; n < e.content.length; n++) {
836
+ let r = J(e.content[n]), i = t === void 0 ? void 0 : t + n;
837
+ N.addBlock(r, void 0, void 0, i);
838
+ }
839
+ W.value = !1;
840
+ }
841
+ let q = Ne({
842
+ config: s.config,
843
+ editor: N,
844
+ websocket: A,
845
+ planConfigInstance: k,
846
+ snapshotPreview: V,
847
+ core: P,
848
+ exporter: L,
849
+ featureFlags: F,
850
+ isDestroyed: S.isDestroyed
851
+ });
852
+ return S.onSaveHook.value = q.saveTemplate, v(() => {
853
+ S.initialize();
854
+ }), i(() => {
855
+ S.destroy();
856
+ }), n({
857
+ getContent: () => N.content.value,
858
+ setContent: (e) => N.setContent(e),
859
+ setTheme: ne,
860
+ setThemeOverrides: te,
861
+ create: q.createTemplate,
862
+ load: q.loadTemplate,
863
+ save: q.saveTemplate,
864
+ sendTestEmail: R.sendTestEmail
865
+ }), (e, t) => (a(), u("div", {
866
+ class: C(["tpl tpl:relative tpl:h-full tpl:overflow-hidden", { "tpl:dark": d(N).state.darkMode }]),
867
+ "data-tpl-theme": d(P).resolvedTheme.value,
868
+ style: m(d(P).themeStyles.value)
869
+ }, [
870
+ f(x, {
871
+ "enter-active-class": "tpl:transition-opacity tpl:duration-200",
872
+ "enter-from-class": "tpl:opacity-100",
873
+ "enter-to-class": "tpl:opacity-100",
874
+ "leave-active-class": "tpl:transition-opacity tpl:duration-300",
875
+ "leave-from-class": "tpl:opacity-100",
876
+ "leave-to-class": "tpl:opacity-0"
877
+ }, {
878
+ default: r(() => [f(nt, { visible: d(w) || d(N).state.isLoading }, null, 8, ["visible"])]),
879
+ _: 1
880
+ }),
881
+ f(x, {
882
+ "enter-active-class": "tpl:transition-opacity tpl:duration-200",
883
+ "enter-from-class": "tpl:opacity-0",
884
+ "enter-to-class": "tpl:opacity-100",
885
+ "leave-active-class": "tpl:transition-opacity tpl:duration-300",
886
+ "leave-from-class": "tpl:opacity-100",
887
+ "leave-to-class": "tpl:opacity-0"
888
+ }, {
889
+ default: r(() => [f(ct, {
890
+ error: d(E),
891
+ visible: !!d(E) && !d(w),
892
+ onRetry: d(S).initialize
893
+ }, null, 8, [
894
+ "error",
895
+ "visible",
896
+ "onRetry"
897
+ ])]),
898
+ _: 1
899
+ }),
900
+ f(Ze, {
901
+ editor: d(N),
902
+ core: d(P),
903
+ "auth-manager": d(D),
904
+ "feature-flags": d(F),
905
+ "panel-state": d(B),
906
+ "snapshot-preview": d(V),
907
+ "comments-instance": d(ee),
908
+ "test-email": d(R),
909
+ websocket: d(A),
910
+ collaboration: d(j),
911
+ "is-collaboration-enabled": d(M),
912
+ "is-saving": d(N).state.isSaving || d(F).isSaveExporting.value,
913
+ "is-save-disabled": d(N).state.isSaving || d(F).isSaveExporting.value || !d(N).state.isDirty,
914
+ onSave: t[0] ||= (e) => d(q).saveTemplate().catch((e) => s.config.onError?.(e))
915
+ }, null, 8, [
916
+ "editor",
917
+ "core",
918
+ "auth-manager",
919
+ "feature-flags",
920
+ "panel-state",
921
+ "snapshot-preview",
922
+ "comments-instance",
923
+ "test-email",
924
+ "websocket",
925
+ "collaboration",
926
+ "is-collaboration-enabled",
927
+ "is-saving",
928
+ "is-save-disabled"
929
+ ]),
930
+ f(ft, {
931
+ visible: d(V).isPreviewingSnapshot.value,
932
+ onCancel: d(V).cancelPreview,
933
+ onConfirm: d(V).confirmRestoreSnapshot
934
+ }, null, 8, [
935
+ "visible",
936
+ "onCancel",
937
+ "onConfirm"
938
+ ]),
939
+ f(x, {
940
+ "enter-active-class": "tpl:transition-all tpl:duration-200 tpl:ease-out",
941
+ "enter-from-class": "tpl:translate-y-[-8px] tpl:opacity-0",
942
+ "enter-to-class": "tpl:translate-y-0 tpl:opacity-100",
943
+ "leave-active-class": "tpl:transition-all tpl:duration-300 tpl:ease-in",
944
+ "leave-from-class": "tpl:translate-y-0 tpl:opacity-100",
945
+ "leave-to-class": "tpl:translate-y-[-8px] tpl:opacity-0"
946
+ }, {
947
+ default: r(() => [f(mt, { visible: d(H).collabUndoWarningVisible.value }, null, 8, ["visible"])]),
948
+ _: 1
949
+ }),
950
+ c(f(Se, null, null, 512), [[p, !d(N).state.previewMode]]),
951
+ b("div", {
952
+ class: C(["tpl-body tpl:absolute tpl:bottom-0 tpl:overflow-auto", [d(N).state.previewMode ? "tpl:left-0 tpl:right-0" : d(B).rightPanelOpen.value ? "tpl:left-12 tpl:right-[680px]" : "tpl:left-12 tpl:right-[320px]", d(V).isPreviewingSnapshot.value ? "tpl:top-[104px]" : "tpl:top-14"]]),
953
+ style: {
954
+ transition: "all 300ms cubic-bezier(0.34, 1.56, 0.64, 1)",
955
+ "background-color": "var(--tpl-canvas-bg)"
956
+ }
957
+ }, [b("div", gt, [f(x, { name: "tpl-restore-btn" }, {
958
+ default: r(() => [d(P).conditionPreview.hasHiddenBlocks.value ? (a(), u("button", {
959
+ key: 0,
960
+ 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",
961
+ style: {
962
+ "background-color": "var(--tpl-warning-light)",
963
+ color: "var(--tpl-warning)",
964
+ "border-color": "var(--tpl-warning)",
965
+ "backdrop-filter": "blur(8px)"
966
+ },
967
+ onClick: t[1] ||= (e) => d(P).conditionPreview.reset()
968
+ }, [f(d(_e), {
969
+ size: 13,
970
+ "stroke-width": 2
971
+ }), O(" " + y(d(P).t.blockSettings.restoreHiddenBlocks), 1)])) : g("", !0)]),
972
+ _: 1
973
+ })]), b("main", _t, [f(we, {
974
+ viewport: d(N).state.viewport,
975
+ content: d(N).content.value,
976
+ "selected-block-id": d(N).state.selectedBlockId,
977
+ "dark-mode": d(N).state.darkMode,
978
+ "preview-mode": d(N).state.previewMode,
979
+ "locked-blocks": d(j)?.lockedBlocks.value ?? void 0,
980
+ onSelectBlock: d(N).selectBlock,
981
+ onOpenAiChat: t[2] ||= (e) => d(B).aiChatOpen.value = !0,
982
+ onOpenDesignReference: t[3] ||= (e) => d(B).designReferenceOpen.value = !0
983
+ }, null, 8, [
984
+ "viewport",
985
+ "content",
986
+ "selected-block-id",
987
+ "dark-mode",
988
+ "preview-mode",
989
+ "locked-blocks",
990
+ "onSelectBlock"
991
+ ])])], 2),
992
+ d(F).isWhiteLabeled.value ? g("", !0) : (a(), _(Te, {
993
+ key: 0,
994
+ "position-class": [d(N).state.previewMode ? "tpl:left-0 tpl:right-0" : d(B).rightPanelOpen.value ? "tpl:left-12 tpl:right-[680px]" : "tpl:left-12 tpl:right-[320px]"]
995
+ }, null, 8, ["position-class"])),
996
+ b("div", {
997
+ class: "tpl-sr-only",
998
+ role: "status",
999
+ "aria-live": "polite",
1000
+ "aria-atomic": "true",
1001
+ "aria-label": d(P).t.landmarks.reorderAnnouncements
1002
+ }, y(d(P).keyboardReorder.announcement.value), 9, vt),
1003
+ c(f(ye, {
1004
+ "selected-block": d(N).selectedBlock.value,
1005
+ settings: d(N).content.value.settings,
1006
+ "shifted-left": d(B).rightPanelOpen.value,
1007
+ onUpdateBlock: t[4] ||= (e) => d(N).updateBlock(d(N).selectedBlock.value.id, e),
1008
+ onDeleteBlock: t[5] ||= (e) => d(P).blockActions.deleteBlock(d(N).selectedBlock.value.id),
1009
+ onDuplicateBlock: t[6] ||= (e) => d(P).blockActions.duplicateBlock(d(N).selectedBlock.value),
1010
+ onUpdateSettings: d(N).updateSettings
1011
+ }, null, 8, [
1012
+ "selected-block",
1013
+ "settings",
1014
+ "shifted-left",
1015
+ "onUpdateSettings"
1016
+ ]), [[p, !d(N).state.previewMode]]),
1017
+ !d(w) && d(T) ? (a(), _(Qe, {
1018
+ key: 1,
1019
+ ref_key: "cloudPanelsRef",
1020
+ ref: h,
1021
+ config: s.config,
1022
+ editor: d(N),
1023
+ core: d(P),
1024
+ "panel-state": d(B),
1025
+ "plan-config-instance": d(k),
1026
+ "test-email": d(R),
1027
+ "media-lib": d(I),
1028
+ "saved-modules-headless": d(z),
1029
+ "show-save-module-dialog": d(U),
1030
+ "save-module-pre-selected-block-id": d(G),
1031
+ "show-module-browser-modal": d(W),
1032
+ "onUpdate:showSaveModuleDialog": t[7] ||= (e) => U.value = e,
1033
+ "onUpdate:saveModulePreSelectedBlockId": t[8] ||= (e) => G.value = e,
1034
+ "onUpdate:showModuleBrowserModal": t[9] ||= (e) => W.value = e,
1035
+ onSendTestEmail: K,
1036
+ onModuleInsert: re
1037
+ }, null, 8, [
1038
+ "config",
1039
+ "editor",
1040
+ "core",
1041
+ "panel-state",
1042
+ "plan-config-instance",
1043
+ "test-email",
1044
+ "media-lib",
1045
+ "saved-modules-headless",
1046
+ "show-save-module-dialog",
1047
+ "save-module-pre-selected-block-id",
1048
+ "show-module-browser-modal"
1049
+ ])) : g("", !0)
1050
+ ], 14, ht));
1051
+ }
1052
+ }), [["__scopeId", "data-v-4bccdddc"]]);
1053
+ //#endregion
1054
+ export { yt as default };
1055
+
1056
+ //# sourceMappingURL=CloudEditor-DeTolKnf.js.map