@templatical/editor 0.13.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/dist/{AiChatSidebar-B0-U5-sb.js → AiChatSidebar-BIKvYREk.js} +57 -56
  2. package/dist/{AiFeatureMenu-DxDwLS8B.js → AiFeatureMenu-QbD82crt.js} +23 -23
  3. package/dist/{BlockIssueBadge-C-EPqWsh.js → BlockIssueBadge-B3xVgMTh.js} +11 -11
  4. package/dist/CloudEditor-DptuSf7A.js +1234 -0
  5. package/dist/{CollaboratorBar-DgwjisX2.js → CollaboratorBar-DrA_K69w.js} +20 -20
  6. package/dist/{CommentsSidebar-CpRLN40c.js → CommentsSidebar-D_tSGvTX.js} +158 -157
  7. package/dist/CountdownBlock-apiYUhkQ.js +92 -0
  8. package/dist/CountdownToolbar-CS0axcjz.js +210 -0
  9. package/dist/{DesignReferenceSidebar-BgPDbOsl.js → DesignReferenceSidebar-DWYK9nTk.js} +58 -57
  10. package/dist/{IssuesPanel-I0z6k6-H.js → IssuesPanel-CR1MPaDE.js} +40 -40
  11. package/dist/{LoadingTrack-C7mGWPHS.js → LoadingTrack-DsecR8Rw.js} +1 -1
  12. package/dist/MergeTagSuggestion-CH2SUxBo.js +1327 -0
  13. package/dist/ModuleBrowserModal-D45rBj5C.js +202 -0
  14. package/dist/{ModulePreviewCanvas-Dni9kK4j.js → ModulePreviewCanvas-BiQ6B2-l.js} +29 -29
  15. package/dist/{NumberWithSuffix-D3fdj0iO.js → NumberWithSuffix-CrA6quxx.js} +143 -142
  16. package/dist/ParagraphEditor-1NaUJpZO.js +721 -0
  17. package/dist/{RichTextEditorContent-Q5altsx1.js → RichTextEditorContent-BqLHIZY7.js} +45 -44
  18. package/dist/{SaveModuleDialog-C38VqN2T.js → SaveModuleDialog-B0sPOTgO.js} +38 -37
  19. package/dist/{SnapshotHistory-ByloTpwh.js → SnapshotHistory-DslVzmSb.js} +34 -33
  20. package/dist/{TemplateScoringPanel-CUxiPtEf.js → TemplateScoringPanel-CZ62rGHz.js} +83 -82
  21. package/dist/{TestEmailModal-BvZBMBad.js → TestEmailModal-DWGniJVu.js} +22 -21
  22. package/dist/TitleEditor-D4t_gZZJ.js +193 -0
  23. package/dist/{TplModal-BYb-X5Bj.js → TplModal-Br2VG6cn.js} +14 -13
  24. package/dist/{blockTypeIcons-CyAom3iI.js → blockTypeIcons-CXhCS5WV.js} +5 -5
  25. package/dist/bundle-stats.json +8 -8
  26. package/dist/cdn/chunks/{AiFeatureMenu-BSoy-SoF.js → AiFeatureMenu-3Slo_LGA.js} +8 -8
  27. package/dist/cdn/chunks/{AiFeatureMenu-BSoy-SoF.js.map → AiFeatureMenu-3Slo_LGA.js.map} +1 -1
  28. package/dist/cdn/chunks/{BlockIssueBadge-BQDUuJxy.js → BlockIssueBadge-BxwEiiF3.js} +5 -5
  29. package/dist/cdn/chunks/{BlockIssueBadge-BQDUuJxy.js.map → BlockIssueBadge-BxwEiiF3.js.map} +1 -1
  30. package/dist/cdn/chunks/{CloudEditor-BZuzsQOZ.js → CloudEditor-DFIFWD9G.js} +163 -161
  31. package/dist/cdn/chunks/CloudEditor-DFIFWD9G.js.map +1 -0
  32. package/dist/cdn/chunks/{CollaboratorBar-DUpSrtDr.js → CollaboratorBar-Cu3vuN66.js} +4 -4
  33. package/dist/cdn/chunks/{CollaboratorBar-DUpSrtDr.js.map → CollaboratorBar-Cu3vuN66.js.map} +1 -1
  34. package/dist/cdn/chunks/{CountdownBlock-DChGTAsH.js → CountdownBlock-BEVAJQtQ.js} +3 -3
  35. package/dist/cdn/chunks/{CountdownBlock-DChGTAsH.js.map → CountdownBlock-BEVAJQtQ.js.map} +1 -1
  36. package/dist/cdn/chunks/{CountdownToolbar-C6gX2SJr.js → CountdownToolbar-CI2sQZv5.js} +4 -4
  37. package/dist/cdn/chunks/{CountdownToolbar-C6gX2SJr.js.map → CountdownToolbar-CI2sQZv5.js.map} +1 -1
  38. package/dist/cdn/chunks/{IssuesPanel-Bo1uhdSe.js → IssuesPanel-BdeDoTcn.js} +11 -11
  39. package/dist/cdn/chunks/{IssuesPanel-Bo1uhdSe.js.map → IssuesPanel-BdeDoTcn.js.map} +1 -1
  40. package/dist/cdn/chunks/MergeTagSuggestion-BsCAo4Co.js +213 -0
  41. package/dist/cdn/chunks/MergeTagSuggestion-BsCAo4Co.js.map +1 -0
  42. package/dist/cdn/chunks/{ModuleBrowserModal-a-tZRCcD.js → ModuleBrowserModal-Dz-I5zfj.js} +11 -8
  43. package/dist/cdn/chunks/{ModuleBrowserModal-a-tZRCcD.js.map → ModuleBrowserModal-Dz-I5zfj.js.map} +1 -1
  44. package/dist/cdn/chunks/{ModulePreviewCanvas-Bm6k0Op0.js → ModulePreviewCanvas-BfinyuAN.js} +21 -21
  45. package/dist/cdn/chunks/{ModulePreviewCanvas-Bm6k0Op0.js.map → ModulePreviewCanvas-BfinyuAN.js.map} +1 -1
  46. package/dist/cdn/chunks/{NumberWithSuffix-HTbuD3VJ.js → NumberWithSuffix-CDjEa08X.js} +4 -4
  47. package/dist/cdn/chunks/{NumberWithSuffix-HTbuD3VJ.js.map → NumberWithSuffix-CDjEa08X.js.map} +1 -1
  48. package/dist/cdn/chunks/{ParagraphEditor-pGrfSccu.js → ParagraphEditor-B3fG0vge.js} +130 -110
  49. package/dist/cdn/chunks/ParagraphEditor-B3fG0vge.js.map +1 -0
  50. package/dist/cdn/chunks/{RichTextEditorContent-D7XZix_1.js → RichTextEditorContent-C6YPCp9j.js} +4 -4
  51. package/dist/cdn/chunks/{RichTextEditorContent-D7XZix_1.js.map → RichTextEditorContent-C6YPCp9j.js.map} +1 -1
  52. package/dist/cdn/chunks/{SaveModuleDialog-C9PQ9x6j.js → SaveModuleDialog-C6UIIVAM.js} +6 -6
  53. package/dist/cdn/chunks/{SaveModuleDialog-C9PQ9x6j.js.map → SaveModuleDialog-C6UIIVAM.js.map} +1 -1
  54. package/dist/cdn/chunks/{TitleEditor-BvFbL16O.js → TitleEditor-BiZbLYF1.js} +62 -46
  55. package/dist/cdn/chunks/TitleEditor-BiZbLYF1.js.map +1 -0
  56. package/dist/cdn/chunks/blockTypeIcons-BernVG06.js +22 -0
  57. package/dist/cdn/chunks/{blockTypeIcons-Kd1MT0u8.js.map → blockTypeIcons-BernVG06.js.map} +1 -1
  58. package/dist/{de-C2wOXoxs.js → cdn/chunks/de-LsV0u1tP.js} +19 -1
  59. package/dist/cdn/chunks/de-LsV0u1tP.js.map +1 -0
  60. package/dist/cdn/chunks/{draggable-Bci-fq8y.js → draggable-kG-D5Xsm.js} +19 -10
  61. package/dist/cdn/chunks/draggable-kG-D5Xsm.js.map +1 -0
  62. package/dist/cdn/chunks/{en-dR7zfNC3.js → en-Bb8X1bOs.js} +18 -2
  63. package/dist/cdn/chunks/en-Bb8X1bOs.js.map +1 -0
  64. package/dist/cdn/chunks/extensions-Drp8UDc6.js +421 -0
  65. package/dist/cdn/chunks/extensions-Drp8UDc6.js.map +1 -0
  66. package/dist/cdn/chunks/{features-DU6lA8l1.js → features-Dpczf9Su.js} +1171 -994
  67. package/dist/cdn/chunks/features-Dpczf9Su.js.map +1 -0
  68. package/dist/cdn/chunks/{icons-BjHUZZyJ.js → icons-CuxnJiGQ.js} +170 -164
  69. package/dist/cdn/chunks/icons-CuxnJiGQ.js.map +1 -0
  70. package/dist/cdn/chunks/{liquid.browser-DKKBzRQu.js → liquid.browser-BJOEu6Cg.js} +693 -678
  71. package/dist/cdn/chunks/liquid.browser-BJOEu6Cg.js.map +1 -0
  72. package/dist/cdn/chunks/{media-library-Byelliig.js → media-library-CiYl_BO7.js} +556 -554
  73. package/dist/cdn/chunks/{media-library-Byelliig.js.map → media-library-CiYl_BO7.js.map} +1 -1
  74. package/dist/cdn/chunks/{pt-BR-BZ86xqK6.js → pt-BR-BwJY_cvb.js} +18 -2
  75. package/dist/cdn/chunks/pt-BR-BwJY_cvb.js.map +1 -0
  76. package/dist/cdn/chunks/{pusher-BICWUP2j.js → pusher-CIwiKF8H.js} +9 -6
  77. package/dist/cdn/chunks/{pusher-BICWUP2j.js.map → pusher-CIwiKF8H.js.map} +1 -1
  78. package/dist/cdn/chunks/quality-CNjGxBG0.js +2176 -0
  79. package/dist/cdn/chunks/{quality-DNnYAntR.js.map → quality-CNjGxBG0.js.map} +1 -1
  80. package/dist/cdn/chunks/{renderer-CZKO-Tav.js → renderer-CFkg8h-K.js} +40 -31
  81. package/dist/cdn/chunks/renderer-CFkg8h-K.js.map +1 -0
  82. package/dist/cdn/chunks/{src-DsqSXXjk.js → src-DRpKu4Dy.js} +11 -11
  83. package/dist/cdn/chunks/{src-DsqSXXjk.js.map → src-DRpKu4Dy.js.map} +1 -1
  84. package/dist/cdn/chunks/styles-B7wryV0l.js +3943 -0
  85. package/dist/cdn/chunks/styles-B7wryV0l.js.map +1 -0
  86. package/dist/cdn/chunks/{tiptap-CwScfbsM.js → tiptap-DF9PEiqH.js} +5429 -5373
  87. package/dist/cdn/chunks/tiptap-DF9PEiqH.js.map +1 -0
  88. package/dist/cdn/editor.css +1 -1
  89. package/dist/cdn/editor.js +117 -115
  90. package/dist/cdn/editor.js.map +1 -1
  91. package/dist/{check-BRzXxFHr.js → check-rl7ok6uJ.js} +1 -1
  92. package/dist/{chevron-down-DmEgzmYT.js → chevron-down-BKe__NOD.js} +1 -1
  93. package/dist/{circle-alert-BStvZr3O.js → circle-alert-C8xmpMsK.js} +1 -1
  94. package/dist/{clock-Blwp_1R6.js → clock-BW4JuDCN.js} +1 -1
  95. package/dist/{cloud-_olro76D.js → cloud-BQusL53H.js} +208 -208
  96. package/dist/createLucideIcon-Dx-EjR9r.js +43 -0
  97. package/dist/{cdn/chunks/de-C2wOXoxs.js → de-LsV0u1tP.js} +17 -3
  98. package/dist/{dist-BlG7k25W.js → dist-B5Sov3sS.js} +7 -7
  99. package/dist/dist-BEWiuOMi.js +251 -0
  100. package/dist/{dist-b7Ak-CuM.js → dist-BFmE-7hB.js} +2 -2
  101. package/dist/{dist-o73iaGqy.js → dist-BMoa33wT.js} +2 -2
  102. package/dist/{dist-BctFrpeA.js → dist-BibU4HNl.js} +74 -65
  103. package/dist/{dist-D6x1cQeh.js → dist-BsCGIDSt.js} +103 -102
  104. package/dist/dist-CNLKj9wa.js +5 -0
  105. package/dist/{dist-DULfKmTh.js → dist-CNXDNYQn.js} +729 -695
  106. package/dist/{dist-412xXefB.js → dist-COG3IdPK.js} +3 -3
  107. package/dist/{dist-Cz79qrLL.js → dist-CQZxDvFw.js} +3 -3
  108. package/dist/{dist-BwgjpLfr.js → dist-CRsjOQM-.js} +2 -2
  109. package/dist/dist-CTT6WYJ6.js +134 -0
  110. package/dist/dist-Cqa6aeAJ.js +5 -0
  111. package/dist/{dist-BCQZZUE9.js → dist-SXJJ2v41.js} +2 -2
  112. package/dist/{dist-DhKTdU52.js → dist-itdjZraK.js} +1445 -1420
  113. package/dist/{en-dR7zfNC3.js → en-Bb8X1bOs.js} +17 -1
  114. package/dist/extensions-DwaZAqm6.js +423 -0
  115. package/dist/{image-up-BFPbw_Zq.js → image-up-BwBCmQ4P.js} +1 -1
  116. package/dist/index.d.ts +17 -0
  117. package/dist/{info-B_qLEBN2.js → info-TCn7uWR5.js} +1 -1
  118. package/dist/keys-Cv8-8GsD.js +10 -0
  119. package/dist/{liquid.browser-CVjP5Mex.js → liquid.browser-DZLtv26k.js} +692 -677
  120. package/dist/{list-checks-CGg7JxPm.js → list-checks-CSrOWNgq.js} +1 -1
  121. package/dist/{loader-circle-CDF8eR_Q.js → loader-circle-BLmicnPG.js} +1 -1
  122. package/dist/{message-circle-C3cHsCJl.js → message-circle-C9hHMQCI.js} +1 -1
  123. package/dist/{pt-BR-BZ86xqK6.js → pt-BR-BwJY_cvb.js} +17 -1
  124. package/dist/{refresh-cw-Butml7Q4.js → refresh-cw-D1JQ1LNa.js} +1 -1
  125. package/dist/runtime-dom.esm-bundler-BzuoCyNp.js +523 -0
  126. package/dist/scan-line-DgijVq9y.js +31 -0
  127. package/dist/{send-k7npFJNO.js → send-DjPdq69F.js} +1 -1
  128. package/dist/{shield-check-CV6GbmCu.js → shield-check-Bqluu8FS.js} +1 -1
  129. package/dist/{sparkles-C965Xop4.js → sparkles-M4azPVSP.js} +1 -1
  130. package/dist/style.css +1 -1
  131. package/dist/styles-D7fQ7f_1.js +4164 -0
  132. package/dist/templatical-editor.js +155 -152
  133. package/dist/{text-align-start-Bxnps8fH.js → text-align-start-CMya5pCQ.js} +11 -11
  134. package/dist/{trash-2-DpGb7fIt.js → trash-2-C-81rkLS.js} +1 -1
  135. package/dist/{triangle-alert-BKYElAwz.js → triangle-alert-BuRWnynk.js} +1 -1
  136. package/dist/{upload-BF7sxd1_.js → upload-CWBIoLd4.js} +1 -1
  137. package/dist/{useAliveFlag-BinvbqQR.js → useAliveFlag-CECL_OUb.js} +1 -1
  138. package/dist/{useCloudI18n-L3H2XvdW.js → useCloudI18n-AKCy98qD.js} +2 -2
  139. package/dist/{useEditorCore-DKYZ7aKk.js → useEditorCore-vcWLdnjN.js} +1480 -1310
  140. package/dist/{useI18n-CTs_bP9d.js → useI18n-C-TDeJBt.js} +2 -2
  141. package/dist/{useMergeTag-e3RSY-s3.js → useMergeTag-DSrBY0-2.js} +6 -6
  142. package/dist/usePopoverRoot-DKUDnr55.js +8 -0
  143. package/dist/{vue.runtime.esm-bundler-B2k01iQh.js → vue.runtime.esm-bundler-l0XAqiyv.js} +639 -1151
  144. package/dist/{x-CGjkjdKK.js → x-CQSvXnGR.js} +1 -1
  145. package/package.json +27 -27
  146. package/dist/CloudEditor-DaEfipBn.js +0 -1230
  147. package/dist/CountdownBlock-DO9fziwf.js +0 -92
  148. package/dist/CountdownToolbar-BeII06yJ.js +0 -210
  149. package/dist/ModuleBrowserModal-DsZRr87F.js +0 -198
  150. package/dist/ParagraphEditor-CZ-cmhX3.js +0 -700
  151. package/dist/TitleEditor-DbNOcvhR.js +0 -177
  152. package/dist/cdn/chunks/CloudEditor-BZuzsQOZ.js.map +0 -1
  153. package/dist/cdn/chunks/ParagraphEditor-pGrfSccu.js.map +0 -1
  154. package/dist/cdn/chunks/TitleEditor-BvFbL16O.js.map +0 -1
  155. package/dist/cdn/chunks/blockTypeIcons-Kd1MT0u8.js +0 -22
  156. package/dist/cdn/chunks/de-C2wOXoxs.js.map +0 -1
  157. package/dist/cdn/chunks/draggable-Bci-fq8y.js.map +0 -1
  158. package/dist/cdn/chunks/en-dR7zfNC3.js.map +0 -1
  159. package/dist/cdn/chunks/extensions-CuUjSmuA.js +0 -605
  160. package/dist/cdn/chunks/extensions-CuUjSmuA.js.map +0 -1
  161. package/dist/cdn/chunks/features-DU6lA8l1.js.map +0 -1
  162. package/dist/cdn/chunks/icons-BjHUZZyJ.js.map +0 -1
  163. package/dist/cdn/chunks/liquid.browser-DKKBzRQu.js.map +0 -1
  164. package/dist/cdn/chunks/pt-BR-BZ86xqK6.js.map +0 -1
  165. package/dist/cdn/chunks/quality-DNnYAntR.js +0 -2176
  166. package/dist/cdn/chunks/renderer-CZKO-Tav.js.map +0 -1
  167. package/dist/cdn/chunks/styles-DiAdtiz9.js +0 -3428
  168. package/dist/cdn/chunks/styles-DiAdtiz9.js.map +0 -1
  169. package/dist/cdn/chunks/tiptap-CwScfbsM.js.map +0 -1
  170. package/dist/createLucideIcon-CmPAC-gt.js +0 -43
  171. package/dist/dist-BNEdeWub.js +0 -5
  172. package/dist/dist-Cgry6fNv.js +0 -382
  173. package/dist/dist-u0iIJH3V.js +0 -5
  174. package/dist/extensions-XPlNAKIL.js +0 -1720
  175. package/dist/keys-mFiJ5N0_.js +0 -10
  176. package/dist/scan-line-XYEqim_E.js +0 -25
  177. package/dist/styles-D0RCAWhB.js +0 -3647
  178. package/dist/usePopoverRoot-DVh7NY1q.js +0 -8
@@ -0,0 +1,1234 @@
1
+ import { A as e, D as t, Dt as n, E as r, Et as i, I as a, K as o, O as s, Ot as c, R as l, Y as u, Z as d, _ as f, c as p, d as m, g as h, h as g, k as _, l as v, m as y, nt as b, p as x, r as S, s as C, u as w, z as T } from "./vue.runtime.esm-bundler-l0XAqiyv.js";
2
+ import { c as E, o as D, t as O } from "./runtime-dom.esm-bundler-BzuoCyNp.js";
3
+ import { t as k } from "./timeouts-Bmi_yePw.js";
4
+ import { O as A, a as j } from "./dist-BibU4HNl.js";
5
+ import { I as M, b as ee, t as N, w as P } from "./useEditorCore-vcWLdnjN.js";
6
+ import { m as F } from "./dist-CTT6WYJ6.js";
7
+ import { t as I } from "./dist-BEWiuOMi.js";
8
+ import { D as L, M as R, c as z, j as te, l as ne, r as B, s as re, t as ie } from "./keys-Cv8-8GsD.js";
9
+ import { t as V } from "./useI18n-C-TDeJBt.js";
10
+ import { t as H } from "./createLucideIcon-Dx-EjR9r.js";
11
+ import { t as U } from "./check-rl7ok6uJ.js";
12
+ import { t as W } from "./circle-alert-C8xmpMsK.js";
13
+ import { a as G, c as ae, d as oe, f as K, i as q, l as se, n as ce, o as le, p as ue, r as de, s as fe, t as pe, u as me } from "./styles-D7fQ7f_1.js";
14
+ import { t as he } from "./clock-BW4JuDCN.js";
15
+ import { t as J } from "./loader-circle-BLmicnPG.js";
16
+ import { t as ge } from "./message-circle-C9hHMQCI.js";
17
+ import { t as _e } from "./send-DjPdq69F.js";
18
+ import { t as Y } from "./sparkles-M4azPVSP.js";
19
+ import { t as X } from "./triangle-alert-BuRWnynk.js";
20
+ import { t as Z } from "./_plugin-vue_export-helper-B3ysoDQm.js";
21
+ import { n as Q } from "./useCloudI18n-AKCy98qD.js";
22
+ import { d as $ } from "./styleConstants-lGobwiLH.js";
23
+ import { _ as ve, a as ye, c as be, d as xe, f as Se, g as Ce, h as we, l as Te, m as Ee, n as De, o as Oe, p as ke, r as Ae, s as je, t as Me, v as Ne, y as Pe } from "./cloud-BQusL53H.js";
24
+ var Fe = H("save", [
25
+ ["path", {
26
+ 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",
27
+ key: "1c8476"
28
+ }],
29
+ ["path", {
30
+ d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",
31
+ key: "1ydtos"
32
+ }],
33
+ ["path", {
34
+ d: "M7 3v4a1 1 0 0 0 1 1h7",
35
+ key: "t51u73"
36
+ }]
37
+ ]);
38
+ //#endregion
39
+ //#region src/cloud/composables/useSnapshotPreview.ts
40
+ function Ie(e) {
41
+ let { authManager: t, editor: n, history: r, conditionPreview: i, autoSave: a, onError: s } = e, c = d(null), l = u(null), f = u(null), p = !1;
42
+ o(() => {
43
+ p = !0;
44
+ });
45
+ let m = C(() => l.value !== null), h = C(() => c.value?.snapshots.value ?? []), g = C(() => c.value?.isLoading.value ?? !1), _ = C(() => c.value?.isRestoring.value ?? !1);
46
+ function v() {
47
+ n.state.template?.id && !c.value && (c.value = Ce({
48
+ authManager: t,
49
+ templateId: n.state.template.id,
50
+ onRestore: y,
51
+ onError: s
52
+ }), c.value.loadSnapshots());
53
+ }
54
+ function y(e) {
55
+ n.setContent(e.content, !1), r.clear(), i.reset();
56
+ }
57
+ async function b(e) {
58
+ if (!p) {
59
+ if (l.value) {
60
+ l.value = e, n.setContent(e.content, !1);
61
+ return;
62
+ }
63
+ n.state.isDirty && n.hasTemplate() && (await n.createSnapshot(), p) || (f.value = structuredClone(n.content.value), a?.pause(), l.value = e, n.setContent(e.content, !1));
64
+ }
65
+ }
66
+ async function x() {
67
+ if (!(!l.value || !c.value)) try {
68
+ if (await c.value.restoreSnapshot(l.value.id), p || (await c.value.loadSnapshots(), p)) return;
69
+ } catch (e) {
70
+ throw !p && f.value && n.setContent(f.value, !1), e;
71
+ } finally {
72
+ p || (l.value = null, f.value = null, a?.resume());
73
+ }
74
+ }
75
+ function S() {
76
+ !l.value || !f.value || (n.setContent(f.value, !1), l.value = null, f.value = null, a?.resume());
77
+ }
78
+ async function w() {
79
+ p || c.value && await c.value.loadSnapshots();
80
+ }
81
+ return {
82
+ snapshotHistoryInstance: c,
83
+ previewingSnapshot: l,
84
+ contentBeforePreview: f,
85
+ isPreviewingSnapshot: m,
86
+ snapshotHistorySnapshots: h,
87
+ snapshotHistoryIsLoading: g,
88
+ snapshotHistoryIsRestoring: _,
89
+ initSnapshotHistory: v,
90
+ handleRestore: y,
91
+ handleSnapshotNavigate: b,
92
+ confirmRestoreSnapshot: x,
93
+ cancelPreview: S,
94
+ loadSnapshotHistory: w
95
+ };
96
+ }
97
+ //#endregion
98
+ //#region src/cloud/composables/useCloudPanelState.ts
99
+ function Le() {
100
+ let e = u(null), t = C({
101
+ get: () => e.value === "ai-chat",
102
+ set: (t) => e.value = t ? "ai-chat" : null
103
+ }), n = C({
104
+ get: () => e.value === "scoring",
105
+ set: (t) => e.value = t ? "scoring" : null
106
+ }), r = C({
107
+ get: () => e.value === "design-reference",
108
+ set: (t) => e.value = t ? "design-reference" : null
109
+ }), i = C({
110
+ get: () => e.value === "comments",
111
+ set: (t) => e.value = t ? "comments" : null
112
+ }), a = u(!1), o = u(!1), s = u(void 0), c = u(!1), l = u(null), d = C(() => e.value !== null), f = C(() => {
113
+ let t = e.value;
114
+ return t === "ai-chat" || t === "design-reference" || t === "scoring" ? t : null;
115
+ }), p = C(() => c.value || e.value === "ai-chat" || e.value === "design-reference" || e.value === "scoring");
116
+ function m() {
117
+ c.value = !c.value;
118
+ }
119
+ function h(t) {
120
+ c.value = !1, e.value = e.value === t ? null : t;
121
+ }
122
+ return I(l, () => {
123
+ c.value = !1;
124
+ }), {
125
+ activePanel: e,
126
+ aiChatOpen: t,
127
+ scoringPanelOpen: n,
128
+ designReferenceOpen: r,
129
+ commentsOpen: i,
130
+ testEmailModalOpen: a,
131
+ mediaLibraryOpen: o,
132
+ mediaLibraryAccept: s,
133
+ aiMenuOpen: c,
134
+ aiMenuRef: l,
135
+ rightPanelOpen: d,
136
+ activeAiFeature: f,
137
+ aiButtonActive: p,
138
+ toggleAiMenu: m,
139
+ handleAiFeatureSelect: h
140
+ };
141
+ }
142
+ //#endregion
143
+ //#region src/cloud/composables/useCollabUndoWarning.ts
144
+ function Re(e) {
145
+ let { isCollaborationEnabled: t, getCollaboratorCount: n, canUndo: r } = e, i = u(!1), a = u(!1), { start: o } = F(() => {
146
+ a.value = !1;
147
+ }, k, { immediate: !1 });
148
+ function s() {
149
+ i.value || !t.value || n() === 0 || !r.value || (i.value = !0, a.value = !0, o());
150
+ }
151
+ return {
152
+ collabUndoWarningVisible: a,
153
+ showCollabUndoWarning: s
154
+ };
155
+ }
156
+ //#endregion
157
+ //#region src/cloud/composables/useCloudFeatureFlags.ts
158
+ function ze(e) {
159
+ let { planConfigInstance: t, aiConfig: n, editor: r } = e, i = C(() => t.hasFeature("ai_generation") && n.hasAnyMenuFeature.value), a = C(() => t.hasFeature("test_email")), o = C(() => !!r.state.template?.id), s = C(() => t.hasFeature("white_label")), c = C(() => t.config.value?.limits.max_templates ?? null), l = C(() => t.config.value?.template_count ?? 0), d = u(!1), f = u("idle"), p = u(""), { start: m } = F(() => {
160
+ f.value = "idle";
161
+ }, 3e3, { immediate: !1 });
162
+ return {
163
+ canUseAiGeneration: i,
164
+ canSendTestEmail: a,
165
+ hasTemplateSaved: o,
166
+ isWhiteLabeled: s,
167
+ templateLimit: c,
168
+ templateCount: l,
169
+ isSaveExporting: d,
170
+ saveStatus: f,
171
+ saveErrorMessage: p,
172
+ startSaveStatusClear: m
173
+ };
174
+ }
175
+ //#endregion
176
+ //#region src/cloud/composables/useCloudMediaLibrary.ts
177
+ function Be(e) {
178
+ let { onRequestMedia: t, mediaLibraryOpen: n, mediaLibraryAccept: r, authManager: i, getMediaConfig: a, onError: s } = e, c = null;
179
+ function l(e) {
180
+ return {
181
+ url: e.url,
182
+ alt: e.alt_text || void 0
183
+ };
184
+ }
185
+ async function u(e) {
186
+ let i = e?.accept ?? ["images"];
187
+ if (e?.files?.length) {
188
+ if (t) {
189
+ let n = await t({
190
+ accept: i,
191
+ files: e.files
192
+ });
193
+ return n ? l(n) : null;
194
+ }
195
+ return d(e.files[0]);
196
+ }
197
+ if (t) {
198
+ let e = await t({ accept: i });
199
+ return e ? l(e) : null;
200
+ }
201
+ return c &&= (c(null), null), r.value = i, n.value = !0, new Promise((e) => {
202
+ c = (t) => {
203
+ e(t);
204
+ };
205
+ });
206
+ }
207
+ async function d(e) {
208
+ let t = f(e);
209
+ if (t) return s?.(t), null;
210
+ try {
211
+ let { MediaApiClient: t } = await import("@templatical/media-library");
212
+ return l(await new t(i).uploadMedia(e));
213
+ } catch (e) {
214
+ return s?.(e), null;
215
+ }
216
+ }
217
+ function f(e) {
218
+ let t = a?.() ?? null;
219
+ if (!t) return null;
220
+ let n = t.categories?.images?.mime_types ?? [];
221
+ return n.length > 0 && !n.includes(e.type) ? /* @__PURE__ */ Error(`Unsupported image type: ${e.type || "unknown"}. Accepted: ${n.join(", ")}.`) : t.max_file_size > 0 && e.size > t.max_file_size ? /* @__PURE__ */ Error(`Image is too large (${e.size} bytes). Maximum allowed is ${t.max_file_size} bytes.`) : null;
222
+ }
223
+ function p(e) {
224
+ n.value = !1, c?.(l(e)), c = null;
225
+ }
226
+ function m() {
227
+ n.value = !1, c?.(null), c = null;
228
+ }
229
+ return o(() => {
230
+ c &&= (c(null), null);
231
+ }), {
232
+ handleRequestMedia: u,
233
+ handleMediaSelect: p,
234
+ handleMediaLibraryClose: m
235
+ };
236
+ }
237
+ //#endregion
238
+ //#region src/cloud/composables/useCloudInitialization.ts
239
+ function Ve(e) {
240
+ let { config: t, translations: n, fontsManager: r, emit: i, getCommentsSidebar: o } = e, s = u(!0), c = u(!1), l = u(null), d = !1, f = { value: null }, p = null, m = null, h = new Me({
241
+ ...t.auth,
242
+ onError: t.onError
243
+ }), g = Ee({
244
+ authManager: h,
245
+ onError: t.onError
246
+ }), v = u(/* @__PURE__ */ new Map()), y = xe({
247
+ authManager: h,
248
+ defaultFontFamily: t.fonts?.defaultFont,
249
+ templateDefaults: t.templateDefaults,
250
+ onError: t.onError,
251
+ lockedBlocks: v
252
+ }), b = Pe({
253
+ authManager: h,
254
+ onError: t.onError
255
+ });
256
+ t.mcp?.enabled && ke({
257
+ editor: y,
258
+ channel: b.channel,
259
+ onOperation: t.mcp.onOperation
260
+ });
261
+ let x = null;
262
+ t.collaboration?.enabled && (x = Oe({
263
+ authManager: h,
264
+ editor: y,
265
+ channel: b.channel,
266
+ onError: t.onError,
267
+ onCollaboratorJoined: t.collaboration.onCollaboratorJoined,
268
+ onCollaboratorLeft: t.collaboration.onCollaboratorLeft,
269
+ onBlockLocked: t.collaboration.onBlockLocked,
270
+ onBlockUnlocked: t.collaboration.onBlockUnlocked
271
+ }), a(() => x.lockedBlocks.value, (e) => {
272
+ v.value = e;
273
+ }, { immediate: !0 }), je(y, x));
274
+ let S = C(() => !!t.collaboration?.enabled && g.hasFeature("collaboration")), w = N({
275
+ editor: y,
276
+ config: {
277
+ uiTheme: t.uiTheme,
278
+ theme: void 0,
279
+ blockDefaults: t.blockDefaults,
280
+ customBlocks: [],
281
+ paletteBlocks: t.paletteBlocks,
282
+ mergeTags: t.mergeTags,
283
+ logicTags: t.logicTags,
284
+ displayConditions: t.displayConditions,
285
+ onRequestMedia: null,
286
+ lint: K(t),
287
+ onSave: () => {
288
+ f.value?.().catch((e) => {
289
+ t.onError?.(e);
290
+ });
291
+ }
292
+ },
293
+ translations: n,
294
+ fontsManager: r,
295
+ historyOptions: x ? { isRemoteOperation: () => x._isProcessingRemoteOperation() } : void 0,
296
+ autoSaveOptions: {
297
+ onChange: async () => {
298
+ y.hasTemplate() && (await y.createSnapshot(), p?.snapshotHistoryInstance.value?.loadSnapshots());
299
+ },
300
+ debounce: t.autoSaveDebounce ?? 5e3,
301
+ enabled: () => t.autoSave !== !1 && g.hasFeature("auto_save")
302
+ },
303
+ themeExtraStyles: () => ({ "--tpl-drop-text": `"${n.canvas.dropHere}"` }),
304
+ keyboardOptions: { onBeforeUndo: () => m?.showCollabUndoWarning() },
305
+ editorRoot: e.editorRoot,
306
+ containerEl: e.containerEl
307
+ }), T = Re({
308
+ isCollaborationEnabled: S,
309
+ getCollaboratorCount: () => x?.collaborators.value.length ?? 0,
310
+ canUndo: w.history.canUndo
311
+ });
312
+ m = T;
313
+ let E = Ie({
314
+ authManager: h,
315
+ editor: y,
316
+ history: w.history,
317
+ conditionPreview: w.conditionPreview,
318
+ autoSave: w.autoSave,
319
+ onError: t.onError
320
+ });
321
+ p = E;
322
+ let D = Le(), O = ye(t.ai), k = ze({
323
+ planConfigInstance: g,
324
+ aiConfig: O,
325
+ editor: y
326
+ }), A = Be({
327
+ onRequestMedia: t.onRequestMedia,
328
+ mediaLibraryOpen: D.mediaLibraryOpen,
329
+ mediaLibraryAccept: D.mediaLibraryAccept,
330
+ authManager: h,
331
+ getMediaConfig: () => g.config.value?.media ?? null,
332
+ onError: t.onError
333
+ });
334
+ P({
335
+ onBlockMove: y.moveBlock,
336
+ onBlockAdd: y.addBlock
337
+ });
338
+ let j = Se({
339
+ authManager: h,
340
+ getFontsConfig: () => t.fonts,
341
+ canUseCustomFonts: () => g.hasFeature("custom_fonts")
342
+ }), ee = Ne({
343
+ authManager: h,
344
+ getTemplateId: () => y.state.template?.id ?? null,
345
+ save: () => y.save(),
346
+ exportHtml: (e) => j.exportHtml(e),
347
+ onError: t.onError,
348
+ isAuthReady: c,
349
+ onBeforeTestEmail: t.onBeforeTestEmail
350
+ }), F = Te({
351
+ authManager: h,
352
+ getTemplateId: () => y.state.template?.id ?? null,
353
+ getSocketId: () => b.getSocketId(),
354
+ onComment: t.onComment,
355
+ onError: t.onError,
356
+ isAuthReady: c,
357
+ hasCommentingFeature: () => t.commenting !== !1 && g.hasFeature("commenting")
358
+ });
359
+ be({
360
+ comments: F,
361
+ channel: b.channel
362
+ });
363
+ let I = we({
364
+ authManager: h,
365
+ onError: t.onError
366
+ }), z = u(!1), V = u(null), H = u(!1), U = ve({
367
+ authManager: h,
368
+ getTemplateId: () => y.state.template?.id ?? null
369
+ });
370
+ function W(e) {
371
+ D.commentsOpen.value = !0, queueMicrotask(() => {
372
+ o()?.filterByBlock(e);
373
+ });
374
+ }
375
+ _(L, A.handleRequestMedia), _(B, h), _(ie, O), _(ne, F), _(te, I), _(R, U), _(re, {
376
+ plan: g,
377
+ ai: O,
378
+ comments: {
379
+ getBlockCount: (e) => F.commentCountByBlock.value.get(e) ?? 0,
380
+ openForBlock: W
381
+ },
382
+ savedModules: {
383
+ openSaveDialog: (e) => {
384
+ V.value = e ?? null, z.value = !0;
385
+ },
386
+ openBrowser: () => {
387
+ H.value = !0;
388
+ },
389
+ moduleCount: C(() => I.modules.value.length)
390
+ }
391
+ });
392
+ function G(e) {
393
+ g.hasFeature("theme_customization") && (w.themeOverrides.value = e);
394
+ }
395
+ function ae(e) {
396
+ y.setUiTheme(e);
397
+ }
398
+ async function oe() {
399
+ s.value = !0, l.value = null;
400
+ try {
401
+ if (await h.initialize(), d) return;
402
+ c.value = !0;
403
+ let e = await De({ authManager: h });
404
+ if (d) return;
405
+ if (!e.api.ok) throw Error("Health check failed: API is not reachable");
406
+ if (!e.auth.ok) throw Error(`Health check failed: authentication error${e.auth.error ? ` - ${e.auth.error}` : ""}`);
407
+ if (e.websocket.ok || M.warn("WebSocket health check failed:", e.websocket.error ?? "unknown error", "-- real-time features will be disabled."), await g.fetchConfig(), d) return;
408
+ r.setCustomFontsEnabled(g.hasFeature("custom_fonts")), t.customBlocks?.length && g.hasFeature("custom_blocks") && w.registerCustomBlocks(t.customBlocks), t.theme && g.hasFeature("theme_customization") && (w.themeOverrides.value = t.theme), t.modules !== !1 && g.hasFeature("saved_modules") && I.loadModules(), i("ready");
409
+ } catch (e) {
410
+ if (d) return;
411
+ let n = e instanceof Error ? e : Error("Initialization failed", { cause: e });
412
+ l.value = n, t.onError?.(n);
413
+ } finally {
414
+ d || (s.value = !1);
415
+ }
416
+ }
417
+ function q() {
418
+ d = !0, r.cleanupFontLinks(), b.disconnect(), w.destroy(), t.onUnmount?.();
419
+ }
420
+ return {
421
+ isInitializing: s,
422
+ isAuthReady: c,
423
+ initError: l,
424
+ isDestroyed: () => d,
425
+ authManager: h,
426
+ planConfigInstance: g,
427
+ websocket: b,
428
+ collaboration: x,
429
+ isCollaborationEnabled: S,
430
+ editor: y,
431
+ core: w,
432
+ aiConfig: O,
433
+ featureFlags: k,
434
+ mediaLib: A,
435
+ exporter: j,
436
+ testEmail: ee,
437
+ commentsInstance: F,
438
+ savedModulesHeadless: I,
439
+ scoringInstance: U,
440
+ panelState: D,
441
+ snapshotPreview: E,
442
+ collabWarning: T,
443
+ showSaveModuleDialog: z,
444
+ showModuleBrowserModal: H,
445
+ saveModulePreSelectedBlockId: V,
446
+ onSaveHook: f,
447
+ initialize: oe,
448
+ destroy: q,
449
+ setThemeOverrides: G,
450
+ setUiTheme: ae,
451
+ openCommentsForBlock: W
452
+ };
453
+ }
454
+ //#endregion
455
+ //#region src/utils/preRenderCustomBlocks.ts
456
+ async function He(e, t) {
457
+ let n = async (e) => {
458
+ if (A(e)) {
459
+ let n = e;
460
+ try {
461
+ n.renderedHtml = await t.renderCustomBlock(n);
462
+ } catch {
463
+ n.renderedHtml = `<!-- Custom block render error: ${n.customType} -->`;
464
+ }
465
+ }
466
+ if (e.type === "section" && "children" in e) {
467
+ let t = e;
468
+ for (let e of t.children) for (let t of e) await n(t);
469
+ }
470
+ };
471
+ for (let t of e.blocks) await n(t);
472
+ }
473
+ //#endregion
474
+ //#region src/cloud/composables/useCloudLifecycle.ts
475
+ function Ue(e) {
476
+ let { config: t, editor: n, websocket: r, planConfigInstance: i, snapshotPreview: a, core: o, exporter: s, featureFlags: c, isDestroyed: l } = e;
477
+ function u() {
478
+ return Ae(i.config.value.websocket);
479
+ }
480
+ async function d(e) {
481
+ let i = await n.create(e);
482
+ return l() ? i : (t.onCreate?.(i), a.initSnapshotHistory(), r.connect(i.id, u()), i);
483
+ }
484
+ async function f(e) {
485
+ let i = await n.load(e);
486
+ return l() ? i : (t.onLoad?.(i), a.initSnapshotHistory(), r.connect(i.id, u()), i);
487
+ }
488
+ async function p() {
489
+ c.isSaveExporting.value = !0, c.saveStatus.value = "idle";
490
+ try {
491
+ if (await He(n.content.value, o.registry), l()) throw Error("Component unmounted during save");
492
+ let e = await n.save();
493
+ if (l()) throw Error("Component unmounted during save");
494
+ a.initSnapshotHistory(), a.snapshotHistoryInstance.value?.loadSnapshots();
495
+ let r = await s.exportHtml(e.id);
496
+ if (l()) throw Error("Component unmounted during save");
497
+ let i = {
498
+ templateId: e.id,
499
+ html: r.html,
500
+ mjml: r.mjml,
501
+ content: e.content
502
+ };
503
+ return t.onSave?.(i), c.saveStatus.value = "saved", c.startSaveStatusClear(), i;
504
+ } catch (e) {
505
+ throw l() || (c.saveStatus.value = "error", c.saveErrorMessage.value = e instanceof Error ? e.message : "Save failed"), e;
506
+ } finally {
507
+ l() || (c.isSaveExporting.value = !1);
508
+ }
509
+ }
510
+ return {
511
+ createTemplate: d,
512
+ loadTemplate: f,
513
+ saveTemplate: p
514
+ };
515
+ }
516
+ //#endregion
517
+ //#region src/cloud/composables/useCloudSaveGate.ts
518
+ function We(e) {
519
+ let t = u(!1), n = null, r = C(() => e.planConfig.value?.accessibility?.blockOnError === !0), i = C(() => r.value ? e.issues.value.filter((e) => e.severity === "error") : []), a = C(() => i.value.length > 0);
520
+ async function o(e) {
521
+ return a.value ? (n = e, t.value = !0, !1) : (await e(), !0);
522
+ }
523
+ async function s() {
524
+ let e = n;
525
+ n = null, t.value = !1, e && await e();
526
+ }
527
+ function c() {
528
+ n = null, t.value = !1;
529
+ }
530
+ return {
531
+ shouldBlock: a,
532
+ blockingIssues: i,
533
+ modalOpen: t,
534
+ tryRunSave: o,
535
+ confirmAndSave: s,
536
+ cancel: c
537
+ };
538
+ }
539
+ //#endregion
540
+ //#region src/cloud/components/CloudSaveGateModal.vue?vue&type=script&setup=true&lang.ts
541
+ var Ge = ["aria-label"], Ke = { class: "tpl:flex tpl:max-h-[80vh] tpl:w-full tpl:max-w-md tpl:flex-col tpl:gap-4 tpl:rounded-lg tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:p-5 tpl:shadow-[var(--tpl-shadow-md)]" }, qe = { class: "tpl:flex tpl:items-center tpl:gap-2" }, Je = { class: "tpl:m-0 tpl:text-base tpl:font-semibold tpl:text-[var(--tpl-text)]" }, Ye = { class: "tpl:m-0 tpl:text-sm tpl:text-[var(--tpl-text-muted)]" }, Xe = { class: "tpl:m-0 tpl:flex tpl:max-h-64 tpl:list-none tpl:flex-col tpl:gap-1.5 tpl:overflow-y-auto tpl:rounded-md tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:p-2" }, Ze = { class: "tpl:text-xs tpl:text-[var(--tpl-text)]" }, Qe = { class: "tpl:font-mono tpl:text-[10px] tpl:text-[var(--tpl-text-dim)]" }, $e = { class: "tpl:flex tpl:justify-end tpl:gap-2" }, et = /* @__PURE__ */ f({
542
+ __name: "CloudSaveGateModal",
543
+ props: {
544
+ open: { type: Boolean },
545
+ issues: {}
546
+ },
547
+ emits: ["cancel", "confirm"],
548
+ setup(t, { emit: n }) {
549
+ let r = n, { t: i } = Q();
550
+ return (n, a) => (s(), v(O, {
551
+ "enter-active-class": "tpl:transition-opacity tpl:duration-150",
552
+ "leave-active-class": "tpl:transition-opacity tpl:duration-150",
553
+ "enter-from-class": "tpl:opacity-0",
554
+ "leave-to-class": "tpl:opacity-0"
555
+ }, {
556
+ default: l(() => [t.open ? (s(), m("div", {
557
+ key: 0,
558
+ role: "dialog",
559
+ "aria-modal": "true",
560
+ "aria-label": b(i).saveGate.title,
561
+ class: "tpl:fixed tpl:inset-0 tpl:z-50 tpl:flex tpl:items-center tpl:justify-center tpl:bg-black/40 tpl:p-6",
562
+ onClick: a[2] ||= E((e) => r("cancel"), ["self"])
563
+ }, [p("div", Ke, [
564
+ p("header", qe, [g(b(X), {
565
+ size: 18,
566
+ "stroke-width": 2,
567
+ class: "tpl:text-[var(--tpl-warning)]"
568
+ }), p("h2", Je, c(b(i).saveGate.title), 1)]),
569
+ p("p", Ye, c(b(i).saveGate.body), 1),
570
+ p("ul", Xe, [(s(!0), m(S, null, e(t.issues, (e) => (s(), m("li", {
571
+ key: `${e.ruleId}-${e.blockId ?? "template"}`,
572
+ class: "tpl:flex tpl:flex-col tpl:gap-0.5 tpl:rounded tpl:px-2 tpl:py-1.5"
573
+ }, [p("span", Ze, c(e.message), 1), p("span", Qe, c(e.ruleId), 1)]))), 128))]),
574
+ p("footer", $e, [p("button", {
575
+ type: "button",
576
+ class: "tpl:rounded-md tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg)] tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:text-[var(--tpl-text)]",
577
+ onClick: a[0] ||= (e) => r("cancel")
578
+ }, c(b(i).saveGate.cancel), 1), p("button", {
579
+ type: "button",
580
+ class: "tpl:rounded-md tpl:bg-[var(--tpl-danger)] tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:text-white",
581
+ onClick: a[1] ||= (e) => r("confirm")
582
+ }, c(b(i).saveGate.confirm), 1)])
583
+ ])], 8, Ge)) : w("", !0)]),
584
+ _: 1
585
+ }));
586
+ }
587
+ }), tt = {
588
+ 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",
589
+ style: {
590
+ "background-color": "color-mix(in srgb, var(--tpl-bg) 80%, transparent)",
591
+ "backdrop-filter": "blur(12px)",
592
+ "-webkit-backdrop-filter": "blur(12px)",
593
+ "box-shadow": "var(--tpl-shadow-md)",
594
+ "border-bottom": "1px solid var(--tpl-border)"
595
+ }
596
+ }, nt = { class: "tpl-header-left tpl:flex tpl:min-w-[200px] tpl:items-center tpl:gap-3" }, rt = {
597
+ key: 0,
598
+ class: "tpl:text-xs tpl:opacity-60 tpl:text-[var(--tpl-text-muted)]"
599
+ }, it = { class: "tpl-header-center tpl:flex tpl:items-center tpl:justify-center tpl:gap-10" }, at = { class: "tpl-header-right tpl:flex tpl:min-w-[200px] tpl:items-center tpl:justify-end tpl:gap-3" }, ot = ["data-tooltip"], st = {
600
+ key: 1,
601
+ "aria-live": "polite",
602
+ class: "tpl-status tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-success)]"
603
+ }, ct = {
604
+ key: 2,
605
+ "aria-live": "polite",
606
+ class: "tpl-status tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-text-muted)]"
607
+ }, lt = ["aria-label", "aria-expanded"], ut = {
608
+ key: 0,
609
+ 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)]"
610
+ }, dt = ["aria-expanded"], ft = {
611
+ key: 0,
612
+ class: "tpl:absolute tpl:right-0 tpl:top-full tpl:z-50 tpl:mt-1 tpl:origin-top-right"
613
+ }, pt = ["disabled"], mt = ["disabled"], ht = /* @__PURE__ */ f({
614
+ __name: "CloudHeader",
615
+ props: {
616
+ editor: {},
617
+ core: {},
618
+ featureFlags: {},
619
+ panelState: {},
620
+ snapshotPreview: {},
621
+ commentsInstance: {},
622
+ testEmail: {},
623
+ websocket: {},
624
+ collaboration: {},
625
+ isCollaborationEnabled: { type: Boolean },
626
+ isSaveDisabled: { type: Boolean },
627
+ isSaving: { type: Boolean }
628
+ },
629
+ emits: ["save"],
630
+ setup(e) {
631
+ let t = h(() => import("./CollaboratorBar-DrA_K69w.js")), r = h(() => import("./SnapshotHistory-DslVzmSb.js")), a = h(() => import("./AiFeatureMenu-QbD82crt.js")), { t: o, format: u } = Q();
632
+ return (d, f) => (s(), m("header", tt, [
633
+ p("div", nt, [e.featureFlags.templateLimit.value === null ? w("", !0) : (s(), m("span", rt, c(b(u)(b(o).header.templatesUsed, {
634
+ used: e.featureFlags.templateCount.value,
635
+ max: e.featureFlags.templateLimit.value
636
+ })), 1))]),
637
+ p("div", it, [
638
+ g(le, {
639
+ viewport: e.editor.state.viewport,
640
+ onChange: e.editor.setViewport
641
+ }, null, 8, ["viewport", "onChange"]),
642
+ g(q, {
643
+ "dark-mode": e.editor.state.darkMode,
644
+ onChange: e.editor.setDarkMode
645
+ }, null, 8, ["dark-mode", "onChange"]),
646
+ g(G, {
647
+ "preview-mode": e.editor.state.previewMode,
648
+ onChange: e.editor.setPreviewMode
649
+ }, null, 8, ["preview-mode", "onChange"]),
650
+ e.collaboration && e.isCollaborationEnabled ? (s(), v(b(t), {
651
+ key: 0,
652
+ collaborators: e.collaboration.collaborators.value,
653
+ "is-connected": e.websocket.isConnected.value
654
+ }, null, 8, ["collaborators", "is-connected"])) : w("", !0),
655
+ e.snapshotPreview.snapshotHistoryInstance.value ? (s(), v(b(r), {
656
+ key: 1,
657
+ snapshots: e.snapshotPreview.snapshotHistorySnapshots.value,
658
+ "is-loading": e.snapshotPreview.snapshotHistoryIsLoading.value,
659
+ "is-restoring": e.snapshotPreview.snapshotHistoryIsRestoring.value,
660
+ onLoad: e.snapshotPreview.loadSnapshotHistory,
661
+ onNavigate: e.snapshotPreview.handleSnapshotNavigate
662
+ }, null, 8, [
663
+ "snapshots",
664
+ "is-loading",
665
+ "is-restoring",
666
+ "onLoad",
667
+ "onNavigate"
668
+ ])) : w("", !0)
669
+ ]),
670
+ p("div", at, [
671
+ e.featureFlags.saveStatus.value === "error" ? (s(), m("div", {
672
+ key: 0,
673
+ "aria-live": "assertive",
674
+ class: "tpl-tooltip tpl-status tpl:flex tpl:items-center tpl:gap-1.5 tpl:text-xs tpl:text-[var(--tpl-danger)]",
675
+ "data-tooltip": e.featureFlags.saveErrorMessage.value
676
+ }, [g(b(W), {
677
+ size: 12,
678
+ "stroke-width": 2.5
679
+ }), y(" " + c(b(o).header.saveFailed), 1)], 8, ot)) : e.featureFlags.saveStatus.value === "saved" ? (s(), m("div", st, [g(b(U), {
680
+ size: 12,
681
+ "stroke-width": 2.5
682
+ }), y(" " + c(b(o).header.saved), 1)])) : e.editor.state.isDirty ? (s(), m("div", ct, [f[4] ||= p("span", { class: "tpl-pulse tpl:size-1.5 tpl:rounded-full tpl:bg-[var(--tpl-primary)]" }, null, -1), y(" " + c(b(o).header.unsaved), 1)])) : w("", !0),
683
+ e.commentsInstance.isEnabled.value && e.featureFlags.hasTemplateSaved.value ? (s(), m("button", {
684
+ key: 3,
685
+ "aria-label": e.commentsInstance.unresolvedCount.value > 0 ? `${b(o).comments.button} (${e.commentsInstance.unresolvedCount.value})` : b(o).comments.button,
686
+ "aria-expanded": e.panelState.commentsOpen.value,
687
+ class: i(b($)),
688
+ style: n({
689
+ backgroundColor: e.panelState.commentsOpen.value ? "var(--tpl-primary)" : "transparent",
690
+ color: e.panelState.commentsOpen.value ? "var(--tpl-bg)" : "var(--tpl-primary)",
691
+ borderColor: "var(--tpl-primary)"
692
+ }),
693
+ onClick: f[0] ||= (t) => e.panelState.commentsOpen.value = !e.panelState.commentsOpen.value
694
+ }, [
695
+ g(b(ge), {
696
+ size: 16,
697
+ "stroke-width": 2
698
+ }),
699
+ y(" " + c(b(o).comments.button) + " ", 1),
700
+ e.commentsInstance.unresolvedCount.value > 0 && !e.panelState.commentsOpen.value ? (s(), m("span", ut, c(e.commentsInstance.unresolvedCount.value), 1)) : w("", !0)
701
+ ], 14, lt)) : w("", !0),
702
+ e.featureFlags.canUseAiGeneration.value && e.featureFlags.hasTemplateSaved.value ? (s(), m("div", {
703
+ key: 4,
704
+ ref: (t) => e.panelState.aiMenuRef.value = t,
705
+ class: "tpl:relative"
706
+ }, [p("button", {
707
+ "aria-expanded": e.panelState.aiMenuOpen.value,
708
+ class: i(["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"]),
709
+ onClick: f[1] ||= E((...t) => e.panelState.toggleAiMenu && e.panelState.toggleAiMenu(...t), ["stop"])
710
+ }, [g(b(Y), {
711
+ size: 16,
712
+ "stroke-width": 2,
713
+ class: "tpl-ai-btn-icon"
714
+ }), y(" " + c(b(o).aiChat.button), 1)], 10, dt), g(O, {
715
+ "enter-active-class": "tpl:transition-all tpl:duration-150 tpl:ease-out",
716
+ "enter-from-class": "tpl:scale-95 tpl:opacity-0",
717
+ "enter-to-class": "tpl:scale-100 tpl:opacity-100",
718
+ "leave-active-class": "tpl:transition-all tpl:duration-100 tpl:ease-in",
719
+ "leave-from-class": "tpl:scale-100 tpl:opacity-100",
720
+ "leave-to-class": "tpl:scale-95 tpl:opacity-0"
721
+ }, {
722
+ default: l(() => [e.panelState.aiMenuOpen.value ? (s(), m("div", ft, [g(b(a), {
723
+ "active-feature": e.panelState.activeAiFeature.value,
724
+ onSelect: e.panelState.handleAiFeatureSelect
725
+ }, null, 8, ["active-feature", "onSelect"])])) : w("", !0)]),
726
+ _: 1
727
+ })], 512)) : w("", !0),
728
+ e.testEmail.isEnabled.value && e.featureFlags.canSendTestEmail.value ? (s(), m("button", {
729
+ key: 5,
730
+ class: i(b($)),
731
+ style: {
732
+ "background-color": "transparent",
733
+ color: "var(--tpl-primary)",
734
+ "border-color": "var(--tpl-primary)"
735
+ },
736
+ disabled: e.testEmail.isSending.value || !e.featureFlags.hasTemplateSaved.value,
737
+ onClick: f[2] ||= (t) => e.panelState.testEmailModalOpen.value = !0
738
+ }, [e.testEmail.isSending.value ? (s(), v(b(J), {
739
+ key: 1,
740
+ class: "tpl-spinner",
741
+ size: 16,
742
+ "stroke-width": 2
743
+ })) : (s(), v(b(_e), {
744
+ key: 0,
745
+ size: 16,
746
+ "stroke-width": 2
747
+ })), y(" " + c(b(o).testEmail.button), 1)], 10, pt)) : w("", !0),
748
+ p("button", {
749
+ class: i(b($)),
750
+ style: {
751
+ "background-color": "transparent",
752
+ color: "var(--tpl-primary)",
753
+ "border-color": "var(--tpl-primary)"
754
+ },
755
+ disabled: e.isSaveDisabled,
756
+ onClick: f[3] ||= (e) => d.$emit("save")
757
+ }, [e.isSaving ? (s(), v(b(J), {
758
+ key: 1,
759
+ class: "tpl-spinner",
760
+ size: 16,
761
+ "stroke-width": 2
762
+ })) : (s(), v(b(Fe), {
763
+ key: 0,
764
+ size: 16,
765
+ "stroke-width": 2
766
+ })), y(" " + c(e.isSaving ? b(o).header.saving : b(o).header.save), 1)], 10, mt)
767
+ ])
768
+ ]));
769
+ }
770
+ }), gt = /* @__PURE__ */ f({
771
+ __name: "CloudPanels",
772
+ props: {
773
+ config: {},
774
+ editor: {},
775
+ core: {},
776
+ panelState: {},
777
+ planConfigInstance: {},
778
+ testEmail: {},
779
+ mediaLib: {},
780
+ savedModulesHeadless: {},
781
+ showSaveModuleDialog: { type: Boolean },
782
+ saveModulePreSelectedBlockId: {},
783
+ showModuleBrowserModal: { type: Boolean }
784
+ },
785
+ emits: [
786
+ "update:showSaveModuleDialog",
787
+ "update:saveModulePreSelectedBlockId",
788
+ "update:showModuleBrowserModal",
789
+ "send-test-email",
790
+ "module-insert"
791
+ ],
792
+ setup(e, { expose: t, emit: n }) {
793
+ let r = h(() => import("./AiChatSidebar-BIKvYREk.js")), i = h(() => import("./CommentsSidebar-D_tSGvTX.js")), a = h(() => import("./DesignReferenceSidebar-DWYK9nTk.js")), o = h(() => import("./TemplateScoringPanel-CZ62rGHz.js")), c = h(() => import("./TestEmailModal-DWGniJVu.js")), l = h(() => import("./SaveModuleDialog-B0sPOTgO.js")), d = h(() => import("./ModuleBrowserModal-D45rBj5C.js")), f = h(async () => {
794
+ try {
795
+ return (await import("@templatical/media-library")).MediaLibraryModal;
796
+ } catch {
797
+ throw Error("[Templatical] Cloud media library requires the optional peer dependency '@templatical/media-library'. Please install it.");
798
+ }
799
+ }), p = n;
800
+ function _(e, t, n) {
801
+ t.history.record(), n.setContent(e), t.conditionPreview.reset();
802
+ }
803
+ function y(e, t) {
804
+ p("module-insert", e, t);
805
+ }
806
+ let x = u(null);
807
+ function C(e) {
808
+ x.value?.filterByBlock(e);
809
+ }
810
+ return t({ filterCommentsByBlock: C }), (t, n) => (s(), m(S, null, [
811
+ g(b(r), {
812
+ visible: e.panelState.aiChatOpen.value,
813
+ "on-apply": (t) => _(t, e.core, e.editor),
814
+ onClose: n[0] ||= (t) => e.panelState.aiChatOpen.value = !1
815
+ }, null, 8, ["visible", "on-apply"]),
816
+ g(b(o), {
817
+ visible: e.panelState.scoringPanelOpen.value,
818
+ onClose: n[1] ||= (t) => e.panelState.scoringPanelOpen.value = !1
819
+ }, null, 8, ["visible"]),
820
+ g(b(a), {
821
+ visible: e.panelState.designReferenceOpen.value,
822
+ "has-existing-blocks": e.editor.content.value.blocks.length > 0,
823
+ onClose: n[2] ||= (t) => e.panelState.designReferenceOpen.value = !1,
824
+ onApply: n[3] ||= (t) => _(t, e.core, e.editor)
825
+ }, null, 8, ["visible", "has-existing-blocks"]),
826
+ g(b(i), {
827
+ ref_key: "commentsSidebar",
828
+ ref: x,
829
+ visible: e.panelState.commentsOpen.value,
830
+ onClose: n[4] ||= (t) => e.panelState.commentsOpen.value = !1
831
+ }, null, 8, ["visible"]),
832
+ g(b(c), {
833
+ visible: e.panelState.testEmailModalOpen.value,
834
+ "allowed-emails": e.testEmail.allowedEmails.value,
835
+ "is-sending": e.testEmail.isSending.value,
836
+ error: e.testEmail.error.value,
837
+ onSend: n[5] ||= (e) => p("send-test-email", e),
838
+ onClose: n[6] ||= (t) => e.panelState.testEmailModalOpen.value = !1
839
+ }, null, 8, [
840
+ "visible",
841
+ "allowed-emails",
842
+ "is-sending",
843
+ "error"
844
+ ]),
845
+ e.planConfigInstance.hasFeature("saved_modules") && e.config.modules !== !1 ? (s(), v(b(l), {
846
+ key: 0,
847
+ visible: e.showSaveModuleDialog,
848
+ "pre-selected-block-id": e.saveModulePreSelectedBlockId,
849
+ onClose: n[7] ||= (e) => {
850
+ p("update:showSaveModuleDialog", !1), p("update:saveModulePreSelectedBlockId", null);
851
+ },
852
+ onSaved: n[8] ||= (t) => e.savedModulesHeadless.loadModules()
853
+ }, null, 8, ["visible", "pre-selected-block-id"])) : w("", !0),
854
+ e.planConfigInstance.hasFeature("saved_modules") && e.config.modules !== !1 ? (s(), v(b(d), {
855
+ key: 1,
856
+ visible: e.showModuleBrowserModal,
857
+ onClose: n[9] ||= (e) => p("update:showModuleBrowserModal", !1),
858
+ onInsert: y
859
+ }, null, 8, ["visible"])) : w("", !0),
860
+ g(b(f), {
861
+ visible: e.panelState.mediaLibraryOpen.value,
862
+ accept: e.panelState.mediaLibraryAccept.value,
863
+ "popover-target": e.core.popoverRoot.value,
864
+ onSelect: e.mediaLib.handleMediaSelect,
865
+ onClose: e.mediaLib.handleMediaLibraryClose
866
+ }, null, 8, [
867
+ "visible",
868
+ "accept",
869
+ "popover-target",
870
+ "onSelect",
871
+ "onClose"
872
+ ])
873
+ ], 64));
874
+ }
875
+ }), _t = {
876
+ key: 0,
877
+ class: "tpl-loading tpl:absolute tpl:inset-0 tpl:z-overlay tpl:flex tpl:flex-col tpl:bg-[var(--tpl-bg)]"
878
+ }, vt = { class: "tpl:flex tpl:flex-1 tpl:overflow-hidden" }, yt = { 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)]" }, bt = /* @__PURE__ */ f({
879
+ __name: "CloudLoadingOverlay",
880
+ props: { visible: { type: Boolean } },
881
+ setup(t) {
882
+ return (n, r) => t.visible ? (s(), m("div", _t, [r[1] ||= x("<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), p("div", vt, [p("div", yt, [(s(), m(S, null, e(5, (e) => p("div", {
883
+ key: e,
884
+ class: "tpl-shimmer tpl:size-7 tpl:rounded-[var(--tpl-radius-sm)]"
885
+ })), 64))]), r[0] ||= x("<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)])])) : w("", !0);
886
+ }
887
+ }), xt = {
888
+ key: 0,
889
+ role: "alert",
890
+ 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)]"
891
+ }, St = { class: "tpl:flex tpl:size-16 tpl:items-center tpl:justify-center tpl:rounded-full tpl:bg-[var(--tpl-danger-light)]" }, Ct = { class: "tpl:flex tpl:flex-col tpl:items-center tpl:gap-2 tpl:text-center" }, wt = { class: "tpl:text-lg tpl:font-semibold tpl:text-[var(--tpl-text)]" }, Tt = { class: "tpl:max-w-md tpl:text-sm tpl:text-[var(--tpl-text-muted)]" }, Et = /* @__PURE__ */ f({
892
+ __name: "CloudErrorOverlay",
893
+ props: {
894
+ error: {},
895
+ visible: { type: Boolean }
896
+ },
897
+ emits: ["retry"],
898
+ setup(e, { emit: t }) {
899
+ let n = t, { t: r } = Q();
900
+ function i(e) {
901
+ return "isUnauthorized" in e && e.isUnauthorized ? r.error.authFailed : "isNotFound" in e && e.isNotFound ? r.error.templateNotFound : r.error.defaultMessage;
902
+ }
903
+ function a(e) {
904
+ return "isNotFound" in e && !!e.isNotFound;
905
+ }
906
+ return (t, o) => e.visible && e.error ? (s(), m("div", xt, [
907
+ p("div", St, [g(b(W), {
908
+ size: 32,
909
+ "stroke-width": 1.5,
910
+ class: "tpl:text-[var(--tpl-danger)]"
911
+ })]),
912
+ p("div", Ct, [p("h2", wt, c(b(r).error.title), 1), p("p", Tt, c(i(e.error)), 1)]),
913
+ a(e.error) ? w("", !0) : (s(), m("button", {
914
+ key: 0,
915
+ 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)]",
916
+ onClick: o[0] ||= (e) => n("retry")
917
+ }, c(b(r).error.retry), 1))
918
+ ])) : w("", !0);
919
+ }
920
+ }), Dt = {
921
+ key: 0,
922
+ 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)]"
923
+ }, Ot = { class: "tpl:flex tpl:items-center tpl:gap-2 tpl:text-sm tpl:text-[var(--tpl-text)]" }, kt = { class: "tpl:flex tpl:items-center tpl:gap-2" }, At = /* @__PURE__ */ f({
924
+ __name: "SnapshotPreviewBanner",
925
+ props: { visible: { type: Boolean } },
926
+ emits: ["cancel", "confirm"],
927
+ setup(e, { emit: t }) {
928
+ let n = t, { t: r } = Q();
929
+ return (t, i) => e.visible ? (s(), m("div", Dt, [p("div", Ot, [g(b(he), {
930
+ size: 18,
931
+ "stroke-width": 2,
932
+ class: "tpl:text-[var(--tpl-primary)]"
933
+ }), p("span", null, c(b(r).snapshotPreview.message), 1)]), p("div", kt, [p("button", {
934
+ 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)]",
935
+ style: { "background-color": "transparent" },
936
+ onClick: i[0] ||= (e) => n("cancel")
937
+ }, c(b(r).snapshotPreview.cancel), 1), p("button", {
938
+ 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)]",
939
+ onClick: i[1] ||= (e) => n("confirm")
940
+ }, c(b(r).snapshotPreview.restore), 1)])])) : w("", !0);
941
+ }
942
+ }), jt = {
943
+ key: 0,
944
+ role: "status",
945
+ "aria-live": "polite",
946
+ 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",
947
+ style: {
948
+ "background-color": "var(--tpl-warning-light)",
949
+ color: "var(--tpl-text)",
950
+ border: "1px solid var(--tpl-warning)"
951
+ }
952
+ }, Mt = /* @__PURE__ */ f({
953
+ __name: "CollabUndoToast",
954
+ props: { visible: { type: Boolean } },
955
+ setup(e) {
956
+ let { t } = V();
957
+ return (n, r) => e.visible ? (s(), m("div", jt, c(b(t).history.collabWarning), 1)) : w("", !0);
958
+ }
959
+ }), Nt = ["data-tpl-theme"], Pt = { class: "tpl:sticky tpl:top-0 tpl:z-40 tpl:h-0" }, Ft = { class: "tpl-main tpl:flex tpl:justify-center tpl:p-8" }, It = ["aria-label"], Lt = /*#__PURE__*/ Z(/* @__PURE__ */ f({
960
+ __name: "CloudEditor",
961
+ props: {
962
+ config: {},
963
+ translations: {},
964
+ cloudTranslations: {},
965
+ fontsManager: {},
966
+ shadowRoot: {}
967
+ },
968
+ emits: ["ready"],
969
+ setup(e, { expose: a, emit: o }) {
970
+ let d = e;
971
+ _(z, d.cloudTranslations);
972
+ let f = o, h = u(null), x = u(null), S = Ve({
973
+ config: d.config,
974
+ translations: d.translations,
975
+ fontsManager: d.fontsManager,
976
+ emit: f,
977
+ getCommentsSidebar: () => h.value ? { filterByBlock: h.value.filterCommentsByBlock } : null,
978
+ editorRoot: d.shadowRoot,
979
+ containerEl: x
980
+ }), { isInitializing: C, isAuthReady: k, initError: A, planConfigInstance: M, websocket: N, collaboration: P, isCollaborationEnabled: F, editor: I, core: L, featureFlags: R, mediaLib: te, exporter: ne, testEmail: B, commentsInstance: re, savedModulesHeadless: ie, panelState: V, snapshotPreview: H, collabWarning: U, showSaveModuleDialog: W, showModuleBrowserModal: G, saveModulePreSelectedBlockId: K, setThemeOverrides: q, setUiTheme: le } = S, { showNotice: he } = ee(() => d.config.smallScreenNotice);
981
+ async function J(e) {
982
+ try {
983
+ await B.sendTestEmail(e), V.testEmailModalOpen.value = !1;
984
+ } catch {}
985
+ }
986
+ async function ge() {
987
+ try {
988
+ await H.confirmRestoreSnapshot();
989
+ } catch {}
990
+ }
991
+ function _e(e, t) {
992
+ for (let n = 0; n < e.content.length; n++) {
993
+ let r = j(e.content[n]), i = t === void 0 ? void 0 : t + n;
994
+ I.addBlock(r, void 0, void 0, i);
995
+ }
996
+ G.value = !1;
997
+ }
998
+ let Y = Ue({
999
+ config: d.config,
1000
+ editor: I,
1001
+ websocket: N,
1002
+ planConfigInstance: M,
1003
+ snapshotPreview: H,
1004
+ core: L,
1005
+ exporter: ne,
1006
+ featureFlags: R,
1007
+ isDestroyed: S.isDestroyed
1008
+ }), X = We({
1009
+ issues: L.templateLint ? L.templateLint.issues : u([]),
1010
+ planConfig: M.config
1011
+ });
1012
+ async function Z() {
1013
+ await X.tryRunSave(() => Y.saveTemplate().catch((e) => d.config.onError?.(e)));
1014
+ }
1015
+ return S.onSaveHook.value = Z, r(() => {
1016
+ S.initialize();
1017
+ }), t(() => {
1018
+ S.destroy();
1019
+ }), a({
1020
+ getContent: () => I.content.value,
1021
+ setContent: (e) => I.setContent(e),
1022
+ setTheme: le,
1023
+ setThemeOverrides: q,
1024
+ create: Y.createTemplate,
1025
+ load: Y.loadTemplate,
1026
+ save: Y.saveTemplate,
1027
+ sendTestEmail: B.sendTestEmail
1028
+ }), (t, r) => (s(), m("div", {
1029
+ ref_key: "rootEl",
1030
+ ref: x,
1031
+ class: i(["tpl tpl:relative tpl:h-full tpl:overflow-hidden", { "tpl:dark": b(I).state.darkMode }]),
1032
+ "data-tpl-theme": b(L).resolvedTheme.value,
1033
+ style: n(b(L).themeStyles.value),
1034
+ onDragover: r[9] ||= E(() => {}, ["prevent"]),
1035
+ onDrop: r[10] ||= E(() => {}, ["prevent"])
1036
+ }, [
1037
+ g(me),
1038
+ g(O, {
1039
+ "enter-active-class": "tpl:transition-opacity tpl:duration-200",
1040
+ "enter-from-class": "tpl:opacity-100",
1041
+ "enter-to-class": "tpl:opacity-100",
1042
+ "leave-active-class": "tpl:transition-opacity tpl:duration-300",
1043
+ "leave-from-class": "tpl:opacity-100",
1044
+ "leave-to-class": "tpl:opacity-0"
1045
+ }, {
1046
+ default: l(() => [g(bt, { visible: b(C) || b(I).state.isLoading }, null, 8, ["visible"])]),
1047
+ _: 1
1048
+ }),
1049
+ g(O, {
1050
+ "enter-active-class": "tpl:transition-opacity tpl:duration-200",
1051
+ "enter-from-class": "tpl:opacity-0",
1052
+ "enter-to-class": "tpl:opacity-100",
1053
+ "leave-active-class": "tpl:transition-opacity tpl:duration-300",
1054
+ "leave-from-class": "tpl:opacity-100",
1055
+ "leave-to-class": "tpl:opacity-0"
1056
+ }, {
1057
+ default: l(() => [g(Et, {
1058
+ error: b(A),
1059
+ visible: !!b(A) && !b(C),
1060
+ onRetry: b(S).initialize
1061
+ }, null, 8, [
1062
+ "error",
1063
+ "visible",
1064
+ "onRetry"
1065
+ ])]),
1066
+ _: 1
1067
+ }),
1068
+ g(ht, {
1069
+ editor: b(I),
1070
+ core: b(L),
1071
+ "feature-flags": b(R),
1072
+ "panel-state": b(V),
1073
+ "snapshot-preview": b(H),
1074
+ "comments-instance": b(re),
1075
+ "test-email": b(B),
1076
+ websocket: b(N),
1077
+ collaboration: b(P),
1078
+ "is-collaboration-enabled": b(F),
1079
+ "is-saving": b(I).state.isSaving || b(R).isSaveExporting.value,
1080
+ "is-save-disabled": b(I).state.isSaving || b(R).isSaveExporting.value || !b(I).state.isDirty,
1081
+ onSave: Z
1082
+ }, null, 8, [
1083
+ "editor",
1084
+ "core",
1085
+ "feature-flags",
1086
+ "panel-state",
1087
+ "snapshot-preview",
1088
+ "comments-instance",
1089
+ "test-email",
1090
+ "websocket",
1091
+ "collaboration",
1092
+ "is-collaboration-enabled",
1093
+ "is-saving",
1094
+ "is-save-disabled"
1095
+ ]),
1096
+ g(et, {
1097
+ open: b(X).modalOpen.value,
1098
+ issues: b(X).blockingIssues.value,
1099
+ onCancel: b(X).cancel,
1100
+ onConfirm: b(X).confirmAndSave
1101
+ }, null, 8, [
1102
+ "open",
1103
+ "issues",
1104
+ "onCancel",
1105
+ "onConfirm"
1106
+ ]),
1107
+ g(At, {
1108
+ visible: b(H).isPreviewingSnapshot.value,
1109
+ onCancel: b(H).cancelPreview,
1110
+ onConfirm: ge
1111
+ }, null, 8, ["visible", "onCancel"]),
1112
+ g(O, {
1113
+ "enter-active-class": "tpl:transition-all tpl:duration-200 tpl:ease-out",
1114
+ "enter-from-class": "tpl:translate-y-[-8px] tpl:opacity-0",
1115
+ "enter-to-class": "tpl:translate-y-0 tpl:opacity-100",
1116
+ "leave-active-class": "tpl:transition-all tpl:duration-300 tpl:ease-in",
1117
+ "leave-from-class": "tpl:translate-y-0 tpl:opacity-100",
1118
+ "leave-to-class": "tpl:translate-y-[-8px] tpl:opacity-0"
1119
+ }, {
1120
+ default: l(() => [g(Mt, { visible: b(U).collabUndoWarningVisible.value }, null, 8, ["visible"])]),
1121
+ _: 1
1122
+ }),
1123
+ T(g(se, null, null, 512), [[D, !b(I).state.previewMode]]),
1124
+ p("div", {
1125
+ class: i(["tpl-body tpl:absolute tpl:bottom-0 tpl:overflow-auto", [b(I).state.previewMode ? "tpl:left-0 tpl:right-0" : b(V).rightPanelOpen.value ? "tpl:left-12 tpl:right-[680px]" : "tpl:left-12 tpl:right-[320px]", b(H).isPreviewingSnapshot.value ? "tpl:top-[104px]" : "tpl:top-14"]]),
1126
+ style: {
1127
+ transition: "all 300ms cubic-bezier(0.34, 1.56, 0.64, 1)",
1128
+ "background-color": "var(--tpl-canvas-bg)"
1129
+ }
1130
+ }, [p("div", Pt, [g(O, { name: "tpl-restore-btn" }, {
1131
+ default: l(() => [b(L).conditionPreview.hasHiddenBlocks.value ? (s(), m("button", {
1132
+ key: 0,
1133
+ 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",
1134
+ style: {
1135
+ "background-color": "var(--tpl-warning-light)",
1136
+ color: "var(--tpl-warning)",
1137
+ "border-color": "var(--tpl-warning)",
1138
+ "backdrop-filter": "blur(8px)"
1139
+ },
1140
+ onClick: r[0] ||= (e) => b(L).conditionPreview.reset()
1141
+ }, [g(b(ue), {
1142
+ size: 13,
1143
+ "stroke-width": 2
1144
+ }), y(" " + c(b(L).t.blockSettings.restoreHiddenBlocks), 1)])) : w("", !0)]),
1145
+ _: 1
1146
+ })]), p("main", Ft, [g(oe, {
1147
+ viewport: b(I).state.viewport,
1148
+ content: b(I).content.value,
1149
+ "selected-block-id": b(I).state.selectedBlockId,
1150
+ "dark-mode": b(I).state.darkMode,
1151
+ "preview-mode": b(I).state.previewMode,
1152
+ "locked-blocks": b(P)?.lockedBlocks.value ?? void 0,
1153
+ onSelectBlock: b(I).selectBlock,
1154
+ onOpenAiChat: r[1] ||= (e) => b(V).aiChatOpen.value = !0,
1155
+ onOpenDesignReference: r[2] ||= (e) => b(V).designReferenceOpen.value = !0
1156
+ }, null, 8, [
1157
+ "viewport",
1158
+ "content",
1159
+ "selected-block-id",
1160
+ "dark-mode",
1161
+ "preview-mode",
1162
+ "locked-blocks",
1163
+ "onSelectBlock"
1164
+ ])])], 2),
1165
+ e.config.branding !== !1 && !b(R).isWhiteLabeled.value ? (s(), v(de, {
1166
+ key: 0,
1167
+ "position-class": [b(I).state.previewMode ? "tpl:left-0 tpl:right-0" : b(V).rightPanelOpen.value ? "tpl:left-12 tpl:right-[680px]" : "tpl:left-12 tpl:right-[320px]"]
1168
+ }, null, 8, ["position-class"])) : w("", !0),
1169
+ p("div", {
1170
+ class: "tpl-sr-only",
1171
+ role: "status",
1172
+ "aria-live": "polite",
1173
+ "aria-atomic": "true",
1174
+ "aria-label": b(L).t.landmarks.reorderAnnouncements
1175
+ }, c(b(L).keyboardReorder.announcement.value), 9, It),
1176
+ T(g(ae, {
1177
+ "selected-block": b(I).selectedBlock.value,
1178
+ settings: b(I).content.value.settings,
1179
+ "shifted-left": b(V).rightPanelOpen.value,
1180
+ onUpdateBlock: r[3] ||= (e) => b(I).updateBlock(b(I).selectedBlock.value.id, e),
1181
+ onDeleteBlock: r[4] ||= (e) => b(L).blockActions.deleteBlock(b(I).selectedBlock.value.id),
1182
+ onDuplicateBlock: r[5] ||= (e) => b(L).blockActions.duplicateBlock(b(I).selectedBlock.value),
1183
+ onUpdateSettings: b(I).updateSettings
1184
+ }, null, 8, [
1185
+ "selected-block",
1186
+ "settings",
1187
+ "shifted-left",
1188
+ "onUpdateSettings"
1189
+ ]), [[D, !b(I).state.previewMode]]),
1190
+ !b(C) && b(k) ? (s(), v(gt, {
1191
+ key: 1,
1192
+ ref_key: "cloudPanelsRef",
1193
+ ref: h,
1194
+ config: d.config,
1195
+ editor: b(I),
1196
+ core: b(L),
1197
+ "panel-state": b(V),
1198
+ "plan-config-instance": b(M),
1199
+ "test-email": b(B),
1200
+ "media-lib": b(te),
1201
+ "saved-modules-headless": b(ie),
1202
+ "show-save-module-dialog": b(W),
1203
+ "save-module-pre-selected-block-id": b(K),
1204
+ "show-module-browser-modal": b(G),
1205
+ "onUpdate:showSaveModuleDialog": r[6] ||= (e) => W.value = e,
1206
+ "onUpdate:saveModulePreSelectedBlockId": r[7] ||= (e) => K.value = e,
1207
+ "onUpdate:showModuleBrowserModal": r[8] ||= (e) => G.value = e,
1208
+ onSendTestEmail: J,
1209
+ onModuleInsert: _e
1210
+ }, null, 8, [
1211
+ "config",
1212
+ "editor",
1213
+ "core",
1214
+ "panel-state",
1215
+ "plan-config-instance",
1216
+ "test-email",
1217
+ "media-lib",
1218
+ "saved-modules-headless",
1219
+ "show-save-module-dialog",
1220
+ "save-module-pre-selected-block-id",
1221
+ "show-module-browser-modal"
1222
+ ])) : w("", !0),
1223
+ p("div", {
1224
+ ref: (e) => b(L).popoverRoot.value = e,
1225
+ class: "tpl-popover-root"
1226
+ }, null, 512),
1227
+ g(ce),
1228
+ g(pe),
1229
+ b(he) ? (s(), v(fe, { key: 2 })) : w("", !0)
1230
+ ], 46, Nt));
1231
+ }
1232
+ }), [["__scopeId", "data-v-3fc6c906"]]);
1233
+ //#endregion
1234
+ export { Lt as default };