@templatical/editor 0.0.1 → 0.0.3

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 (130) hide show
  1. package/dist/AiChatSidebar-busJk9hm.js +214 -0
  2. package/dist/AiFeatureMenu-DLGv_-pj.js +63 -0
  3. package/dist/CloudEditor-BDnHd6Um.js +919 -0
  4. package/dist/CollaboratorBar-Dv3l52vC.js +91 -0
  5. package/dist/CommentsSidebar-4tjp0VU5.js +439 -0
  6. package/dist/DesignReferenceSidebar-CmwXvltV.js +273 -0
  7. package/dist/LoadingTrack-vK8W2PJf.js +10 -0
  8. package/dist/ModuleBrowserModal-lrk3Fr0H.js +205 -0
  9. package/dist/ModulePreviewCanvas-BcBJLnwL.js +106 -0
  10. package/dist/ParagraphEditor-DH8cSC6m.js +625 -0
  11. package/dist/RichTextEditorContent-CQqodi7p.js +133 -0
  12. package/dist/SaveModuleDialog-Bmzi72td.js +122 -0
  13. package/dist/SnapshotHistory-AEgi9Xsn.js +126 -0
  14. package/dist/TemplateScoringPanel-CTgMtc0-.js +249 -0
  15. package/dist/TestEmailModal-Dpq1is9S.js +94 -0
  16. package/dist/TitleEditor-CLcDdcWI.js +167 -0
  17. package/dist/TplModal-CGzRjR96.js +44 -0
  18. package/dist/_plugin-vue_export-helper-B1-bu7yR.js +47 -0
  19. package/dist/blockTypeIcons-BpPTqcok.js +126 -0
  20. package/dist/cdn/chunks/ParagraphEditor-CCtWbGDv.js +3 -0
  21. package/dist/cdn/chunks/ParagraphEditor-CCtWbGDv.js.map +1 -0
  22. package/dist/cdn/chunks/RichTextEditorContent-BUD9veXd.js +2 -0
  23. package/dist/cdn/chunks/RichTextEditorContent-BUD9veXd.js.map +1 -0
  24. package/dist/cdn/chunks/TitleEditor-e_UTyxjd.js +3 -0
  25. package/dist/cdn/chunks/TitleEditor-e_UTyxjd.js.map +1 -0
  26. package/dist/cdn/chunks/dist-0UheN8rK.js +1 -0
  27. package/dist/cdn/chunks/dist-55mmbGQ9.js +1 -0
  28. package/dist/cdn/chunks/dist-B31mxKyP.js +1 -0
  29. package/dist/cdn/chunks/dist-B5JI9nIg.js +1 -0
  30. package/dist/cdn/chunks/dist-B93vLKhU.js +1 -0
  31. package/dist/cdn/chunks/dist-BDt3FJvj.js +1 -0
  32. package/dist/cdn/chunks/dist-BJRuFHmi.js +1 -0
  33. package/dist/cdn/chunks/dist-BKSzrf0L.js +1 -0
  34. package/dist/cdn/chunks/dist-BL8c5gYQ.js +1 -0
  35. package/dist/cdn/chunks/dist-CYThWMP5.js +1 -0
  36. package/dist/cdn/chunks/dist-DxZbPJYt.js +1 -0
  37. package/dist/cdn/chunks/draggable-ClUwYCFL.js +17 -0
  38. package/dist/cdn/chunks/draggable-ClUwYCFL.js.map +1 -0
  39. package/dist/cdn/chunks/emojiData-6fVLNqeH.js +2 -0
  40. package/dist/cdn/chunks/emojiData-6fVLNqeH.js.map +1 -0
  41. package/dist/cdn/chunks/extensions-ea_ewKUl.js +2 -0
  42. package/dist/cdn/chunks/extensions-ea_ewKUl.js.map +1 -0
  43. package/dist/cdn/chunks/icons-vmLJTaJk.js +2 -0
  44. package/dist/cdn/chunks/icons-vmLJTaJk.js.map +1 -0
  45. package/dist/cdn/chunks/rolldown-runtime-BakkzWXw.js +1 -0
  46. package/dist/cdn/chunks/styleConstants-CNejCb-L.js +2 -0
  47. package/dist/cdn/chunks/styleConstants-CNejCb-L.js.map +1 -0
  48. package/dist/cdn/chunks/tiptap-Cya4P9CN.js +145 -0
  49. package/dist/cdn/chunks/tiptap-Cya4P9CN.js.map +1 -0
  50. package/dist/cdn/chunks/useEditorCore-CwuxQuvh.js +2 -0
  51. package/dist/cdn/chunks/useEditorCore-CwuxQuvh.js.map +1 -0
  52. package/dist/cdn/chunks/useMergeTag-DVOz1v9p.js +2 -0
  53. package/dist/cdn/chunks/useMergeTag-DVOz1v9p.js.map +1 -0
  54. package/dist/cdn/editor.css +1 -0
  55. package/dist/cdn/editor.js +2 -0
  56. package/dist/cdn/editor.js.map +1 -0
  57. package/dist/check-B7kDuZmP.js +7 -0
  58. package/dist/chevron-down-DJLW2Q9Z.js +7 -0
  59. package/dist/circle-alert-E2vYPs5r.js +25 -0
  60. package/dist/clock-lWIIQA3C.js +12 -0
  61. package/dist/de-B4Ob4vCo.js +682 -0
  62. package/dist/dist-4LiM9FDd.js +35 -0
  63. package/dist/dist-Bu7veieH.js +776 -0
  64. package/dist/dist-C1BIRHCQ.js +61 -0
  65. package/dist/dist-CG-vEqSU.js +314 -0
  66. package/dist/dist-C_ymrGFi.js +10625 -0
  67. package/dist/dist-ChAGLpWo.js +35 -0
  68. package/dist/dist-D_HQYSY-.js +189 -0
  69. package/dist/dist-DkypH7qG.js +5 -0
  70. package/dist/dist-DmOE-Ubp.js +74 -0
  71. package/dist/dist-DmpMJbmZ.js +513 -0
  72. package/dist/dist-DrvKRSU6.js +47 -0
  73. package/dist/dist-Dxnd0GRf.js +5 -0
  74. package/dist/dist-DysAFIPy.js +2054 -0
  75. package/dist/emojiData-BfWQS72m.js +17 -0
  76. package/dist/en-YXsspZJG.js +682 -0
  77. package/dist/extensions-CKM99njP.js +420 -0
  78. package/dist/formatRelativeTime-DX3FgqN9.js +8 -0
  79. package/dist/i18n-CJsFtdbZ.js +23 -0
  80. package/dist/image-up-X4xIq4ea.js +23 -0
  81. package/dist/keys-Dwa2PmdD.js +10 -0
  82. package/dist/liquid.browser-BemTg3sZ.js +3272 -0
  83. package/dist/loader-circle-BTQQxC3l.js +7 -0
  84. package/dist/message-circle-Blgm6V_h.js +7 -0
  85. package/dist/refresh-cw-Bb4PEeW1.js +44 -0
  86. package/dist/scan-line-7lZPfOdm.js +25 -0
  87. package/dist/send-C0ltAQrv.js +10 -0
  88. package/dist/shield-check-f-qv4RKs.js +10 -0
  89. package/dist/sparkles-KhBCGlqB.js +23 -0
  90. package/dist/styleConstants-D4SOZGBV.js +94 -0
  91. package/dist/styles-DSw1VNU3.js +3406 -0
  92. package/dist/templatical-editor.css +2 -1
  93. package/dist/templatical-editor.js +242 -9
  94. package/dist/templatical-editor.umd.cjs +112 -524
  95. package/dist/timeouts-CmBrLeZA.js +4 -0
  96. package/dist/trash-2-OwjZ-guZ.js +25 -0
  97. package/dist/triangle-alert-DOSRIUYZ.js +17 -0
  98. package/dist/useEditorCore-Cc4RCwWq.js +5556 -0
  99. package/dist/useI18n-DUirdXEX.js +17 -0
  100. package/dist/useMergeTag-DVnlvPYJ.js +33 -0
  101. package/dist/x-CGlq2XQe.js +10 -0
  102. package/package.json +30 -20
  103. package/dist/AiChatSidebar-0vx9TP5B.js +0 -305
  104. package/dist/AiFeatureMenu-CI-v74ND.js +0 -69
  105. package/dist/CloudEditor-Wdfv_9xn.js +0 -1132
  106. package/dist/CollaboratorBar-B3uV4Wtw.js +0 -89
  107. package/dist/CommentsSidebar-PVUlloyB.js +0 -655
  108. package/dist/DesignReferenceSidebar-DAlAWrxU.js +0 -351
  109. package/dist/ModuleBrowserModal-1JEcChd8.js +0 -323
  110. package/dist/ModulePreviewCanvas-Cdp484Ae.js +0 -169
  111. package/dist/SaveModuleDialog-eNyr3XKn.js +0 -168
  112. package/dist/SnapshotHistory-D-ZiIj1v.js +0 -169
  113. package/dist/TemplateScoringPanel-DSZPo15C.js +0 -385
  114. package/dist/TestEmailModal-Cwre5elw.js +0 -128
  115. package/dist/TextEditor-BuUOIByX.js +0 -780
  116. package/dist/de-BWIAblxs.js +0 -685
  117. package/dist/en-cYyUzNV1.js +0 -685
  118. package/dist/index-0tWUczNu.js +0 -47
  119. package/dist/index-4okvXjqk.js +0 -41
  120. package/dist/index-BSc6h5zo.js +0 -967
  121. package/dist/index-CrvwWlhN.js +0 -41
  122. package/dist/index-D-iD-7lO.js +0 -10961
  123. package/dist/index-D-ygXbc8.js +0 -2452
  124. package/dist/index-DbrWKz-e.js +0 -1415
  125. package/dist/index-DeUeHy6g.js +0 -422
  126. package/dist/index-Ude6e9RU.js +0 -41
  127. package/dist/index-ZQzHBwkr.js +0 -12767
  128. package/dist/liquid.browser-CeNxS2GL.js +0 -3493
  129. package/dist/loader-circle-tM9j2mRh.js +0 -13
  130. package/dist/shield-check-Ngi9jAQc.js +0 -20
@@ -0,0 +1,919 @@
1
+ import { S as e, t } from "./useEditorCore-Cc4RCwWq.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 { _ as a, b as o, c as s, r as c, s as l, t as u, y as d } from "./keys-Dwa2PmdD.js";
5
+ import { t as f } from "./useI18n-DUirdXEX.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 ee } from "./circle-alert-E2vYPs5r.js";
9
+ import { a as te, i as ne, n as re, o as ie, r as ae, s as oe, t as se } from "./styles-DSw1VNU3.js";
10
+ import { t as ce } from "./clock-lWIIQA3C.js";
11
+ import { t as le } from "./loader-circle-BTQQxC3l.js";
12
+ import { t as ue } from "./message-circle-Blgm6V_h.js";
13
+ import { t as de } from "./send-C0ltAQrv.js";
14
+ import { t as fe } from "./sparkles-KhBCGlqB.js";
15
+ import { u as g } from "./styleConstants-D4SOZGBV.js";
16
+ import { Fragment as pe, Transition as _, computed as v, createBlock as y, createCommentVNode as b, createElementBlock as x, createElementVNode as S, createStaticVNode as me, createTextVNode as C, createVNode as w, defineAsyncComponent as T, defineComponent as E, nextTick as he, normalizeClass as D, normalizeStyle as ge, onMounted as _e, onScopeDispose as ve, onUnmounted as ye, openBlock as O, provide as k, ref as A, renderList as be, shallowRef as xe, toDisplayString as j, unref as M, vShow as Se, watch as Ce, withCtx as N, withDirectives as we, withModifiers as Te } from "vue";
17
+ import { cloneBlock as Ee, isCustomBlock as De } from "@templatical/types";
18
+ import { AuthManager as Oe, performHealthCheck as ke, resolveWebSocketConfig as Ae, useAiConfig as je, useCollaboration as Me, useCollaborationBroadcast as Ne, useCommentListener as Pe, useComments as Fe, useEditor as Ie, useExport as Le, useMcpListener as Re, usePlanConfig as ze, useSavedModules as Be, useSnapshotHistory as Ve, useTemplateScoring as He, useTestEmail as Ue, useWebSocket as We } from "@templatical/core/cloud";
19
+ var Ge = 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 Ke(e) {
36
+ let { authManager: t, editor: n, history: r, conditionPreview: i, autoSave: a, onError: o } = e, s = xe(null), c = A(null), l = A(null), u = v(() => c.value !== null), d = v(() => s.value?.snapshots.value ?? []), f = v(() => s.value?.isLoading.value ?? !1), p = v(() => s.value?.isRestoring.value ?? !1);
37
+ function m() {
38
+ n.state.template?.id && !s.value && (s.value = Ve({
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 ee(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 te() {
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 ne() {
63
+ !c.value || !l.value || (n.setContent(l.value, !1), c.value = null, l.value = null, a?.resume());
64
+ }
65
+ async function re() {
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: ee,
79
+ confirmRestoreSnapshot: te,
80
+ cancelPreview: ne,
81
+ loadSnapshotHistory: re
82
+ };
83
+ }
84
+ //#endregion
85
+ //#region src/cloud/composables/useCloudPanelState.ts
86
+ function qe() {
87
+ let e = A(null), t = v({
88
+ get: () => e.value === "ai-chat",
89
+ set: (t) => e.value = t ? "ai-chat" : null
90
+ }), n = v({
91
+ get: () => e.value === "scoring",
92
+ set: (t) => e.value = t ? "scoring" : null
93
+ }), r = v({
94
+ get: () => e.value === "design-reference",
95
+ set: (t) => e.value = t ? "design-reference" : null
96
+ }), a = v({
97
+ get: () => e.value === "comments",
98
+ set: (t) => e.value = t ? "comments" : null
99
+ }), o = A(!1), s = A(!1), c = A(void 0), l = A(!1), u = A(null), d = v(() => e.value !== null), f = v(() => {
100
+ let t = e.value;
101
+ return t === "ai-chat" || t === "design-reference" || t === "scoring" ? t : null;
102
+ }), p = v(() => 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 Je(e) {
132
+ let { isCollaborationEnabled: t, getCollaboratorCount: i, canUndo: a } = e, o = A(!1), s = A(!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 Ye(e) {
146
+ let { planConfigInstance: t, aiConfig: n, editor: i } = e, a = v(() => t.hasFeature("ai_generation") && n.hasAnyMenuFeature.value), o = v(() => t.hasFeature("test_email")), s = v(() => !!i.state.template?.id), c = v(() => t.hasFeature("white_label")), l = v(() => t.config.value?.limits.max_templates ?? null), u = v(() => t.config.value?.template_count ?? 0), d = A(!1), f = A("idle"), p = A(""), { 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 Xe(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 ve(() => {
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 Ze = {
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
+ }, P = { class: "tpl:flex tpl:flex-1 tpl:overflow-hidden" }, Qe = { 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)]" }, $e = /* @__PURE__ */ E({
203
+ __name: "CloudLoadingOverlay",
204
+ props: { visible: { type: Boolean } },
205
+ setup(e) {
206
+ return (t, n) => e.visible ? (O(), x("div", Ze, [n[1] ||= me("<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), S("div", P, [S("div", Qe, [(O(), x(pe, null, be(5, (e) => S("div", {
207
+ key: e,
208
+ class: "tpl-shimmer tpl:size-7 tpl:rounded-[var(--tpl-radius-sm)]"
209
+ })), 64))]), n[0] ||= me("<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)])])) : b("", !0);
210
+ }
211
+ }), F = {
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
+ }, I = { class: "tpl:flex tpl:size-16 tpl:items-center tpl:justify-center tpl:rounded-full tpl:bg-[var(--tpl-danger-light)]" }, L = { class: "tpl:flex tpl:flex-col tpl:items-center tpl:gap-2 tpl:text-center" }, R = { class: "tpl:text-lg tpl:font-semibold tpl:text-[var(--tpl-text)]" }, z = { class: "tpl:max-w-md tpl:text-sm tpl:text-[var(--tpl-text-muted)]" }, et = /* @__PURE__ */ E({
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 ? (O(), x("div", F, [
231
+ S("div", I, [w(M(ee), {
232
+ size: 32,
233
+ "stroke-width": 1.5,
234
+ class: "tpl:text-[var(--tpl-danger)]"
235
+ })]),
236
+ S("div", L, [S("h2", R, j(M(r).error.title), 1), S("p", z, j(i(e.error)), 1)]),
237
+ a(e.error) ? b("", !0) : (O(), x("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
+ }, j(M(r).error.retry), 1))
242
+ ])) : b("", !0);
243
+ }
244
+ }), B = {
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
+ }, V = { class: "tpl:flex tpl:items-center tpl:gap-2 tpl:text-sm tpl:text-[var(--tpl-text)]" }, H = { class: "tpl:flex tpl:items-center tpl:gap-2" }, tt = /* @__PURE__ */ E({
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 ? (O(), x("div", B, [S("div", V, [w(M(ce), {
254
+ size: 18,
255
+ "stroke-width": 2,
256
+ class: "tpl:text-[var(--tpl-primary)]"
257
+ }), S("span", null, j(M(r).snapshotPreview.message), 1)]), S("div", H, [S("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
+ }, j(M(r).snapshotPreview.cancel), 1), S("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
+ }, j(M(r).snapshotPreview.restore), 1)])])) : b("", !0);
265
+ }
266
+ }), U = {
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
+ }, nt = /* @__PURE__ */ E({
277
+ __name: "CollabUndoToast",
278
+ props: { visible: { type: Boolean } },
279
+ setup(e) {
280
+ let { t } = f();
281
+ return (n, r) => e.visible ? (O(), x("div", U, j(M(t).history.collabWarning), 1)) : b("", !0);
282
+ }
283
+ }), rt = ["data-tpl-theme"], it = {
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
+ }, at = { class: "tpl-header-left tpl:flex tpl:min-w-[200px] tpl:items-center tpl:gap-3" }, ot = {
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
+ }, st = ["src"], ct = { style: { "letter-spacing": "-0.01em" } }, lt = {
296
+ key: 1,
297
+ class: "tpl:text-xs tpl:opacity-60 tpl:text-[var(--tpl-text-muted)]"
298
+ }, ut = { class: "tpl-header-center tpl:flex tpl:items-center tpl:justify-center tpl:gap-10" }, dt = { class: "tpl-header-right tpl:flex tpl:min-w-[200px] tpl:items-center tpl:justify-end tpl:gap-3" }, ft = ["data-tooltip"], pt = {
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
+ }, mt = {
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
+ }, ht = ["aria-label", "aria-expanded"], gt = {
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
+ }, _t = ["aria-expanded"], vt = {
310
+ key: 0,
311
+ class: "tpl:absolute tpl:right-0 tpl:top-full tpl:z-50 tpl:mt-1 tpl:origin-top-right"
312
+ }, yt = ["disabled"], bt = ["disabled"], xt = { class: "tpl:sticky tpl:top-0 tpl:z-40 tpl:h-0" }, St = { class: "tpl-main tpl:flex tpl:justify-center tpl:p-8" }, Ct = {
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
+ }, wt = {
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
+ }, W = /* @__PURE__ */ m(/* @__PURE__ */ E({
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 = T(() => import("./AiChatSidebar-busJk9hm.js")), p = T(() => import("./CommentsSidebar-4tjp0VU5.js")), m = T(() => import("./DesignReferenceSidebar-CmwXvltV.js")), ce = T(() => import("./TemplateScoringPanel-CTgMtc0-.js")), me = T(() => import("./TestEmailModal-Dpq1is9S.js")), E = T(() => import("./SaveModuleDialog-Bmzi72td.js")), ve = T(() => import("./ModuleBrowserModal-lrk3Fr0H.js")), be = T(() => import("./SnapshotHistory-AEgi9Xsn.js")), xe = T(() => import("./CollaboratorBar-Dv3l52vC.js")), Ve = T(() => import("./AiFeatureMenu-DLGv_-pj.js")), Ze = T(async () => (await import("@templatical/media-library")).MediaLibraryModal), P = n, Qe = i, F = A(!0), I = A(!1), L = A(null), R = !1, z = new Oe({
335
+ ...P.config.auth,
336
+ onError: P.config.onError
337
+ }), B = ze({
338
+ authManager: z,
339
+ onError: P.config.onError
340
+ }), V = A(/* @__PURE__ */ new Map()), H = Ie({
341
+ authManager: z,
342
+ defaultFontFamily: P.config.fonts?.defaultFont,
343
+ templateDefaults: P.config.templateDefaults,
344
+ onError: P.config.onError,
345
+ lockedBlocks: V
346
+ }), U = We({
347
+ authManager: z,
348
+ onError: P.config.onError
349
+ });
350
+ P.config.mcp?.enabled && Re({
351
+ editor: H,
352
+ channel: U.channel,
353
+ onOperation: P.config.mcp.onOperation
354
+ });
355
+ let W = null;
356
+ P.config.collaboration?.enabled && (W = Me({
357
+ authManager: z,
358
+ editor: H,
359
+ channel: U.channel,
360
+ onError: P.config.onError,
361
+ onCollaboratorJoined: P.config.collaboration.onCollaboratorJoined,
362
+ onCollaboratorLeft: P.config.collaboration.onCollaboratorLeft,
363
+ onBlockLocked: P.config.collaboration.onBlockLocked,
364
+ onBlockUnlocked: P.config.collaboration.onBlockUnlocked
365
+ }), Ce(() => W.lockedBlocks.value, (e) => {
366
+ V.value = e;
367
+ }, { immediate: !0 }), Ne(H, W));
368
+ let Tt = v(() => !!P.config.collaboration?.enabled && B.hasFeature("collaboration")), Et = null, Dt = null, G = t({
369
+ editor: H,
370
+ config: {
371
+ uiTheme: P.config.uiTheme,
372
+ theme: void 0,
373
+ blockDefaults: P.config.blockDefaults,
374
+ customBlocks: [],
375
+ mergeTags: P.config.mergeTags,
376
+ displayConditions: P.config.displayConditions,
377
+ onRequestMedia: null,
378
+ onSave: () => {
379
+ $().catch((e) => {
380
+ P.config.onError?.(e);
381
+ });
382
+ }
383
+ },
384
+ translations: P.translations,
385
+ fontsManager: P.fontsManager,
386
+ historyOptions: W ? { isRemoteOperation: () => W._isProcessingRemoteOperation() } : void 0,
387
+ autoSaveOptions: {
388
+ onChange: async () => {
389
+ H.hasTemplate() && (await H.createSnapshot(), Et?.snapshotHistoryInstance.value?.loadSnapshots());
390
+ },
391
+ debounce: P.config.autoSaveDebounce ?? 5e3,
392
+ enabled: () => P.config.autoSave !== !1 && B.hasFeature("auto_save")
393
+ },
394
+ themeExtraStyles: () => ({ "--tpl-drop-text": `"${P.translations.canvas.dropHere}"` }),
395
+ keyboardOptions: { onBeforeUndo: () => Dt?.showCollabUndoWarning() }
396
+ }), Ot = Je({
397
+ isCollaborationEnabled: Tt,
398
+ getCollaboratorCount: () => W?.collaborators.value.length ?? 0,
399
+ canUndo: G.history.canUndo
400
+ });
401
+ Dt = Ot;
402
+ let K = Ke({
403
+ authManager: z,
404
+ editor: H,
405
+ history: G.history,
406
+ conditionPreview: G.conditionPreview,
407
+ autoSave: G.autoSave,
408
+ onError: P.config.onError
409
+ });
410
+ Et = K;
411
+ let q = qe(), kt = je(P.config.ai), J = Ye({
412
+ planConfigInstance: B,
413
+ aiConfig: kt,
414
+ editor: H
415
+ }), At = Xe({
416
+ onRequestMedia: P.config.onRequestMedia,
417
+ mediaLibraryOpen: q.mediaLibraryOpen,
418
+ mediaLibraryAccept: q.mediaLibraryAccept
419
+ });
420
+ e({
421
+ onBlockMove: H.moveBlock,
422
+ onBlockAdd: H.addBlock
423
+ });
424
+ let jt = Le({
425
+ authManager: z,
426
+ getFontsConfig: () => P.config.fonts,
427
+ canUseCustomFonts: () => B.hasFeature("custom_fonts")
428
+ }), Y = Ue({
429
+ authManager: z,
430
+ getTemplateId: () => H.state.template?.id ?? null,
431
+ save: () => H.save(),
432
+ exportHtml: (e) => jt.exportHtml(e),
433
+ onError: P.config.onError,
434
+ isAuthReady: I,
435
+ onBeforeTestEmail: P.config.onBeforeTestEmail
436
+ }), X = Fe({
437
+ authManager: z,
438
+ getTemplateId: () => H.state.template?.id ?? null,
439
+ getSocketId: () => U.getSocketId(),
440
+ onComment: P.config.onComment,
441
+ onError: P.config.onError,
442
+ isAuthReady: I,
443
+ hasCommentingFeature: () => P.config.commenting !== !1 && B.hasFeature("commenting")
444
+ });
445
+ Pe({
446
+ comments: X,
447
+ channel: U.channel
448
+ });
449
+ let Z = Be({
450
+ authManager: z,
451
+ onError: P.config.onError
452
+ }), Mt = A(!1), Nt = A(null), Q = A(!1), Pt = He({
453
+ authManager: z,
454
+ getTemplateId: () => H.state.template?.id ?? null
455
+ });
456
+ k(a, At.handleRequestMedia), k(c, z), k(u, kt), k(s, X), k(d, Z), k(o, Pt), k(l, {
457
+ plan: B,
458
+ ai: kt,
459
+ comments: {
460
+ getBlockCount: (e) => X.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
+ Q.value = !0;
469
+ },
470
+ moduleCount: v(() => Z.modules.value.length)
471
+ }
472
+ });
473
+ function Ft(e) {
474
+ B.hasFeature("theme_customization") && (G.themeOverrides.value = e);
475
+ }
476
+ function It(e) {
477
+ H.setUiTheme(e);
478
+ }
479
+ let Lt = A(null);
480
+ function Rt(e) {
481
+ q.commentsOpen.value = !0, he(() => {
482
+ Lt.value?.filterByBlock(e);
483
+ });
484
+ }
485
+ async function zt(e) {
486
+ try {
487
+ await Y.sendTestEmail(e), q.testEmailModalOpen.value = !1;
488
+ } catch {}
489
+ }
490
+ function Bt(e, t) {
491
+ for (let n = 0; n < e.content.length; n++) {
492
+ let r = Ee(e.content[n]), i = t === void 0 ? void 0 : t + n;
493
+ H.addBlock(r, void 0, void 0, i);
494
+ }
495
+ Q.value = !1;
496
+ }
497
+ async function Vt(e) {
498
+ let t = async (e) => {
499
+ if (De(e)) {
500
+ let t = e;
501
+ try {
502
+ t.renderedHtml = await G.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
+ F.value = !0, L.value = null;
516
+ try {
517
+ if (await z.initialize(), R) return;
518
+ I.value = !0;
519
+ let e = await ke({ authManager: z });
520
+ if (R) 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 B.fetchConfig(), R) return;
524
+ P.fontsManager.setCustomFontsEnabled(B.hasFeature("custom_fonts")), P.config.customBlocks?.length && B.hasFeature("custom_blocks") && G.registerCustomBlocks(P.config.customBlocks), P.config.theme && B.hasFeature("theme_customization") && (G.themeOverrides.value = P.config.theme), P.config.modules !== !1 && B.hasFeature("saved_modules") && Z.loadModules(), Qe("ready");
525
+ } catch (e) {
526
+ if (R) return;
527
+ let t = e instanceof Error ? e : Error("Initialization failed", { cause: e });
528
+ L.value = t, P.config.onError?.(t);
529
+ } finally {
530
+ R || (F.value = !1);
531
+ }
532
+ }
533
+ function Ut() {
534
+ return Ae(B.config.value.websocket);
535
+ }
536
+ async function Wt(e) {
537
+ let t = await H.create(e);
538
+ return R ? t : (P.config.onCreate?.(t), K.initSnapshotHistory(), U.connect(t.id, Ut()), t);
539
+ }
540
+ async function Gt(e) {
541
+ let t = await H.load(e);
542
+ return R ? t : (P.config.onLoad?.(t), K.initSnapshotHistory(), U.connect(t.id, Ut()), t);
543
+ }
544
+ async function $() {
545
+ J.isSaveExporting.value = !0, J.saveStatus.value = "idle";
546
+ try {
547
+ if (await Vt(H.content.value), R) throw Error("Component unmounted during save");
548
+ let e = await H.save();
549
+ if (R) throw Error("Component unmounted during save");
550
+ K.initSnapshotHistory(), K.snapshotHistoryInstance.value && K.snapshotHistoryInstance.value.loadSnapshots();
551
+ let t = await jt.exportHtml(e.id);
552
+ if (R) 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 P.config.onSave?.(n), J.saveStatus.value = "saved", J.startSaveStatusClear(), n;
560
+ } catch (e) {
561
+ throw R || (J.saveStatus.value = "error", J.saveErrorMessage.value = e instanceof Error ? e.message : "Save failed"), e;
562
+ } finally {
563
+ R || (J.isSaveExporting.value = !1);
564
+ }
565
+ }
566
+ return _e(() => {
567
+ Ht();
568
+ }), ye(() => {
569
+ R = !0, P.fontsManager.cleanupFontLinks(), U.disconnect(), G.destroy(), P.config.onUnmount?.();
570
+ }), r({
571
+ getContent: () => H.content.value,
572
+ setContent: (e) => H.setContent(e),
573
+ setTheme: It,
574
+ setThemeOverrides: Ft,
575
+ create: Wt,
576
+ load: Gt,
577
+ save: $,
578
+ sendTestEmail: Y.sendTestEmail
579
+ }), (e, t) => (O(), x("div", {
580
+ class: D(["tpl tpl:relative tpl:h-full tpl:overflow-hidden", { "tpl:dark": M(H).state.darkMode }]),
581
+ "data-tpl-theme": M(G).resolvedTheme.value,
582
+ style: ge(M(G).themeStyles.value)
583
+ }, [
584
+ w(_, {
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: N(() => [w($e, { visible: F.value || M(H).state.isLoading }, null, 8, ["visible"])]),
593
+ _: 1
594
+ }),
595
+ w(_, {
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: N(() => [w(et, {
604
+ error: L.value,
605
+ visible: !!L.value && !F.value,
606
+ onRetry: Ht
607
+ }, null, 8, ["error", "visible"])]),
608
+ _: 1
609
+ }),
610
+ S("header", it, [
611
+ S("div", at, [M(J).isWhiteLabeled.value ? b("", !0) : (O(), x("div", ot, [S("img", {
612
+ src: M(z).resolveUrl("/logo.svg"),
613
+ alt: "Templatical",
614
+ width: "24",
615
+ height: "24",
616
+ class: "tpl:shrink-0"
617
+ }, null, 8, st), S("span", ct, j(M(G).t.header.title), 1)])), M(J).templateLimit.value === null ? b("", !0) : (O(), x("span", lt, j(M(G).format(M(G).t.header.templatesUsed, {
618
+ used: M(J).templateCount.value,
619
+ max: M(J).templateLimit.value
620
+ })), 1))]),
621
+ S("div", ut, [
622
+ w(ae, {
623
+ viewport: M(H).state.viewport,
624
+ onChange: M(H).setViewport
625
+ }, null, 8, ["viewport", "onChange"]),
626
+ w(se, {
627
+ "dark-mode": M(H).state.darkMode,
628
+ onChange: M(H).setDarkMode
629
+ }, null, 8, ["dark-mode", "onChange"]),
630
+ w(re, {
631
+ "preview-mode": M(H).state.previewMode,
632
+ onChange: M(H).setPreviewMode
633
+ }, null, 8, ["preview-mode", "onChange"]),
634
+ M(W) && Tt.value ? (O(), y(M(xe), {
635
+ key: 0,
636
+ collaborators: M(W).collaborators.value,
637
+ "is-connected": M(U).isConnected.value
638
+ }, null, 8, ["collaborators", "is-connected"])) : b("", !0),
639
+ M(K).snapshotHistoryInstance.value ? (O(), y(M(be), {
640
+ key: 1,
641
+ snapshots: M(K).snapshotHistorySnapshots.value,
642
+ "is-loading": M(K).snapshotHistoryIsLoading.value,
643
+ "is-restoring": M(K).snapshotHistoryIsRestoring.value,
644
+ onLoad: M(K).loadSnapshotHistory,
645
+ onNavigate: M(K).handleSnapshotNavigate
646
+ }, null, 8, [
647
+ "snapshots",
648
+ "is-loading",
649
+ "is-restoring",
650
+ "onLoad",
651
+ "onNavigate"
652
+ ])) : b("", !0)
653
+ ]),
654
+ S("div", dt, [
655
+ M(J).saveStatus.value === "error" ? (O(), x("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": M(J).saveErrorMessage.value
660
+ }, [w(M(ee), {
661
+ size: 12,
662
+ "stroke-width": 2.5
663
+ }), C(" " + j(M(G).t.header.saveFailed), 1)], 8, ft)) : M(J).saveStatus.value === "saved" ? (O(), x("div", pt, [w(M(h), {
664
+ size: 12,
665
+ "stroke-width": 2.5
666
+ }), C(" " + j(M(G).t.header.saved), 1)])) : M(H).state.isDirty ? (O(), x("div", mt, [t[19] ||= S("span", { class: "tpl-pulse tpl:size-1.5 tpl:rounded-full tpl:bg-[var(--tpl-primary)]" }, null, -1), C(" " + j(M(G).t.header.unsaved), 1)])) : b("", !0),
667
+ M(X).isEnabled.value && M(J).hasTemplateSaved.value ? (O(), x("button", {
668
+ key: 3,
669
+ "aria-label": M(X).unresolvedCount.value > 0 ? `${M(G).t.comments.button} (${M(X).unresolvedCount.value})` : M(G).t.comments.button,
670
+ "aria-expanded": M(q).commentsOpen.value,
671
+ class: D(M(g)),
672
+ style: ge({
673
+ backgroundColor: M(q).commentsOpen.value ? "var(--tpl-primary)" : "transparent",
674
+ color: M(q).commentsOpen.value ? "var(--tpl-bg)" : "var(--tpl-primary)",
675
+ borderColor: "var(--tpl-primary)"
676
+ }),
677
+ onClick: t[0] ||= (e) => M(q).commentsOpen.value = !M(q).commentsOpen.value
678
+ }, [
679
+ w(M(ue), {
680
+ size: 16,
681
+ "stroke-width": 2
682
+ }),
683
+ C(" " + j(M(G).t.comments.button) + " ", 1),
684
+ M(X).unresolvedCount.value > 0 && !M(q).commentsOpen.value ? (O(), x("span", gt, j(M(X).unresolvedCount.value), 1)) : b("", !0)
685
+ ], 14, ht)) : b("", !0),
686
+ M(J).canUseAiGeneration.value && M(J).hasTemplateSaved.value ? (O(), x("div", {
687
+ key: 4,
688
+ ref: (e) => M(q).aiMenuRef.value = e,
689
+ class: "tpl:relative"
690
+ }, [S("button", {
691
+ "aria-expanded": M(q).aiMenuOpen.value,
692
+ class: D(["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", M(q).aiButtonActive.value ? "tpl-ai-btn--active" : "tpl-ai-btn--idle"]),
693
+ onClick: t[1] ||= Te((...e) => M(q).toggleAiMenu && M(q).toggleAiMenu(...e), ["stop"])
694
+ }, [w(M(fe), {
695
+ size: 16,
696
+ "stroke-width": 2,
697
+ class: "tpl-ai-btn-icon"
698
+ }), C(" " + j(M(G).t.aiChat.button), 1)], 10, _t), w(_, {
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: N(() => [M(q).aiMenuOpen.value ? (O(), x("div", vt, [w(M(Ve), {
707
+ "active-feature": M(q).activeAiFeature.value,
708
+ onSelect: M(q).handleAiFeatureSelect
709
+ }, null, 8, ["active-feature", "onSelect"])])) : b("", !0)]),
710
+ _: 1
711
+ })], 512)) : b("", !0),
712
+ M(Y).isEnabled.value && M(J).canSendTestEmail.value ? (O(), x("button", {
713
+ key: 5,
714
+ class: D(M(g)),
715
+ style: {
716
+ "background-color": "transparent",
717
+ color: "var(--tpl-primary)",
718
+ "border-color": "var(--tpl-primary)"
719
+ },
720
+ disabled: M(Y).isSending.value || !M(J).hasTemplateSaved.value,
721
+ onClick: t[2] ||= (e) => M(q).testEmailModalOpen.value = !0
722
+ }, [M(Y).isSending.value ? (O(), y(M(le), {
723
+ key: 1,
724
+ class: "tpl-spinner",
725
+ size: 16,
726
+ "stroke-width": 2
727
+ })) : (O(), y(M(de), {
728
+ key: 0,
729
+ size: 16,
730
+ "stroke-width": 2
731
+ })), C(" " + j(M(G).t.testEmail.button), 1)], 10, yt)) : b("", !0),
732
+ S("button", {
733
+ class: D(M(g)),
734
+ style: {
735
+ "background-color": "transparent",
736
+ color: "var(--tpl-primary)",
737
+ "border-color": "var(--tpl-primary)"
738
+ },
739
+ disabled: M(H).state.isSaving || M(J).isSaveExporting.value || !M(H).state.isDirty,
740
+ onClick: t[3] ||= (e) => $().catch((e) => P.config.onError?.(e))
741
+ }, [!M(H).state.isSaving && !M(J).isSaveExporting.value ? (O(), y(M(Ge), {
742
+ key: 0,
743
+ size: 16,
744
+ "stroke-width": 2
745
+ })) : (O(), y(M(le), {
746
+ key: 1,
747
+ class: "tpl-spinner",
748
+ size: 16,
749
+ "stroke-width": 2
750
+ })), C(" " + j(M(H).state.isSaving || M(J).isSaveExporting.value ? M(G).t.header.saving : M(G).t.header.save), 1)], 10, bt)
751
+ ])
752
+ ]),
753
+ w(tt, {
754
+ visible: M(K).isPreviewingSnapshot.value,
755
+ onCancel: M(K).cancelPreview,
756
+ onConfirm: M(K).confirmRestoreSnapshot
757
+ }, null, 8, [
758
+ "visible",
759
+ "onCancel",
760
+ "onConfirm"
761
+ ]),
762
+ w(_, {
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: N(() => [w(nt, { visible: M(Ot).collabUndoWarningVisible.value }, null, 8, ["visible"])]),
771
+ _: 1
772
+ }),
773
+ we(w(te, null, null, 512), [[Se, !M(H).state.previewMode]]),
774
+ S("div", {
775
+ class: D(["tpl-body tpl:absolute tpl:bottom-0 tpl:overflow-auto tpl:transition-all tpl:duration-300", [M(H).state.previewMode ? "tpl:left-0 tpl:right-0" : M(q).rightPanelOpen.value ? "tpl:left-12 tpl:right-[680px]" : "tpl:left-12 tpl:right-[320px]", M(K).isPreviewingSnapshot.value ? "tpl:top-[104px]" : "tpl:top-14"]]),
776
+ style: {
777
+ "transition-timing-function": "cubic-bezier(0.34, 1.56, 0.64, 1)",
778
+ "background-color": "var(--tpl-canvas-bg)"
779
+ }
780
+ }, [S("div", xt, [w(_, { name: "tpl-restore-btn" }, {
781
+ default: N(() => [M(G).conditionPreview.hasHiddenBlocks.value ? (O(), x("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) => M(G).conditionPreview.reset()
791
+ }, [w(M(oe), {
792
+ size: 13,
793
+ "stroke-width": 2
794
+ }), C(" " + j(M(G).t.blockSettings.restoreHiddenBlocks), 1)])) : b("", !0)]),
795
+ _: 1
796
+ })]), S("main", St, [w(ie, {
797
+ viewport: M(H).state.viewport,
798
+ content: M(H).content.value,
799
+ "selected-block-id": M(H).state.selectedBlockId,
800
+ "dark-mode": M(H).state.darkMode,
801
+ "preview-mode": M(H).state.previewMode,
802
+ "locked-blocks": M(W)?.lockedBlocks.value ?? void 0,
803
+ onSelectBlock: M(H).selectBlock,
804
+ onOpenAiChat: t[5] ||= (e) => M(q).aiChatOpen.value = !0,
805
+ onOpenDesignReference: t[6] ||= (e) => M(q).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
+ M(J).isWhiteLabeled.value ? b("", !0) : (O(), x("footer", {
816
+ key: 0,
817
+ class: D(["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)]", [M(H).state.previewMode ? "tpl:left-0 tpl:right-0" : M(q).rightPanelOpen.value ? "tpl:left-12 tpl:right-[680px]" : "tpl:left-12 tpl:right-[320px]"]])
818
+ }, [S("div", Ct, [
819
+ S("span", null, j(M(G).t.footer.poweredBy), 1),
820
+ t[20] ||= S("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
+ }, [S("img", {
827
+ width: "14",
828
+ height: "14",
829
+ src: "https://templatical.com/logo.svg",
830
+ alt: ""
831
+ }), C(" Templatical ")], -1),
832
+ t[21] ||= S("span", { class: "tpl:text-[var(--tpl-border)]" }, "·", -1),
833
+ S("a", wt, j(M(G).t.footer.openSource), 1)
834
+ ])], 2)),
835
+ we(w(ne, {
836
+ "selected-block": M(H).selectedBlock.value,
837
+ settings: M(H).content.value.settings,
838
+ "shifted-left": M(q).rightPanelOpen.value,
839
+ onUpdateBlock: t[7] ||= (e) => M(H).updateBlock(M(H).selectedBlock.value.id, e),
840
+ onDeleteBlock: t[8] ||= (e) => M(G).blockActions.deleteBlock(M(H).selectedBlock.value.id),
841
+ onDuplicateBlock: t[9] ||= (e) => M(G).blockActions.duplicateBlock(M(H).selectedBlock.value),
842
+ onUpdateSettings: M(H).updateSettings
843
+ }, null, 8, [
844
+ "selected-block",
845
+ "settings",
846
+ "shifted-left",
847
+ "onUpdateSettings"
848
+ ]), [[Se, !M(H).state.previewMode]]),
849
+ !F.value && I.value ? (O(), x(pe, { key: 1 }, [
850
+ w(M(f), {
851
+ visible: M(q).aiChatOpen.value,
852
+ "on-apply": (e) => {
853
+ M(G).history.record(), M(H).setContent(e), M(G).conditionPreview.reset();
854
+ },
855
+ onClose: t[10] ||= (e) => M(q).aiChatOpen.value = !1
856
+ }, null, 8, ["visible", "on-apply"]),
857
+ w(M(ce), {
858
+ visible: M(q).scoringPanelOpen.value,
859
+ onClose: t[11] ||= (e) => M(q).scoringPanelOpen.value = !1
860
+ }, null, 8, ["visible"]),
861
+ w(M(m), {
862
+ visible: M(q).designReferenceOpen.value,
863
+ "has-existing-blocks": M(H).content.value.blocks.length > 0,
864
+ onClose: t[12] ||= (e) => M(q).designReferenceOpen.value = !1,
865
+ onApply: t[13] ||= (e) => {
866
+ M(G).history.record(), M(H).setContent(e), M(G).conditionPreview.reset();
867
+ }
868
+ }, null, 8, ["visible", "has-existing-blocks"]),
869
+ w(M(p), {
870
+ ref_key: "commentsSidebarRef",
871
+ ref: Lt,
872
+ visible: M(q).commentsOpen.value,
873
+ onClose: t[14] ||= (e) => M(q).commentsOpen.value = !1
874
+ }, null, 8, ["visible"]),
875
+ w(M(me), {
876
+ visible: M(q).testEmailModalOpen.value,
877
+ "allowed-emails": M(Y).allowedEmails.value,
878
+ "is-sending": M(Y).isSending.value,
879
+ error: M(Y).error.value,
880
+ onSend: zt,
881
+ onClose: t[15] ||= (e) => M(q).testEmailModalOpen.value = !1
882
+ }, null, 8, [
883
+ "visible",
884
+ "allowed-emails",
885
+ "is-sending",
886
+ "error"
887
+ ]),
888
+ M(B).hasFeature("saved_modules") && P.config.modules !== !1 ? (O(), y(M(E), {
889
+ key: 0,
890
+ visible: Mt.value,
891
+ "pre-selected-block-id": Nt.value,
892
+ onClose: t[16] ||= (e) => {
893
+ Mt.value = !1, Nt.value = null;
894
+ },
895
+ onSaved: t[17] ||= (e) => M(Z).loadModules()
896
+ }, null, 8, ["visible", "pre-selected-block-id"])) : b("", !0),
897
+ M(B).hasFeature("saved_modules") && P.config.modules !== !1 ? (O(), y(M(ve), {
898
+ key: 1,
899
+ visible: Q.value,
900
+ onClose: t[18] ||= (e) => Q.value = !1,
901
+ onInsert: Bt
902
+ }, null, 8, ["visible"])) : b("", !0),
903
+ w(M(Ze), {
904
+ visible: M(q).mediaLibraryOpen.value,
905
+ accept: M(q).mediaLibraryAccept.value,
906
+ onSelect: M(At).handleMediaSelect,
907
+ onClose: M(At).handleMediaLibraryClose
908
+ }, null, 8, [
909
+ "visible",
910
+ "accept",
911
+ "onSelect",
912
+ "onClose"
913
+ ])
914
+ ], 64)) : b("", !0)
915
+ ], 14, rt));
916
+ }
917
+ }), [["__scopeId", "data-v-55f76577"]]);
918
+ //#endregion
919
+ export { W as default };