@templatical/editor 0.26.2 → 0.27.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 (285) hide show
  1. package/README.md +3 -1
  2. package/dist/{AiChatSidebar-CMBz6Wix.js → AiChatSidebar-iVJDzqjr.js} +60 -60
  3. package/dist/AiFeatureMenu-DvrK-dzj.js +57 -0
  4. package/dist/{BlockIssueBadge-Buk3_6QF.js → BlockIssueBadge-BHysq7XQ.js} +11 -11
  5. package/dist/BlockPreviewCanvas-GZbr0ph5.js +121 -0
  6. package/dist/CloudHeaderExtras-Cx8gFWu2.js +59 -0
  7. package/dist/CloudPanels-D0X449DD.js +227 -0
  8. package/dist/{CollaboratorBar-zvfvE7f-.js → CollaboratorBar-DMSWCrX3.js} +21 -21
  9. package/dist/ColorPicker-DCjFQCAg.js +501 -0
  10. package/dist/CommentsPanel-D5wQB1Kf.js +18 -0
  11. package/dist/CommentsSidebar-BoTIxpLE.js +481 -0
  12. package/dist/{cdn/chunks/CountdownBlock-vLTkTI9e.js → CountdownBlock-BFX8iU90.js} +19 -21
  13. package/dist/{cdn/chunks/CountdownToolbar-DPjcgcVR.js → CountdownToolbar-CSftc9Ma.js} +52 -53
  14. package/dist/{DesignReferenceSidebar-Bx96XFmK.js → DesignReferenceSidebar-DKsx2TiL.js} +72 -71
  15. package/dist/{IssuesPanel-Do7RLXsP.js → IssuesPanel-flKKwKpM.js} +38 -38
  16. package/dist/{LoadingTrack-BexpNuTV.js → LoadingTrack-C2T8ixEL.js} +3 -3
  17. package/dist/{MergeTagModeToggle-P-UguQHc.js → MergeTagModeToggle-PKCoKAoF.js} +43 -43
  18. package/dist/{MergeTagSuggestion-BJ43ihWR.js → MergeTagSuggestion-DGha0WRp.js} +46 -46
  19. package/dist/{cdn/chunks/NumberWithSuffix-BXrRdfq1.js → NumberWithSuffix-DdPCXfKf.js} +42 -44
  20. package/dist/{ParagraphEditor-CLvv5Ija.js → ParagraphEditor-vDU-5y6r.js} +202 -199
  21. package/dist/RestoreVersionDialog-DIn1muFD.js +86 -0
  22. package/dist/{RichTextEditorContent-fbYJXAio.js → RichTextEditorContent-I83k5DtQ.js} +44 -44
  23. package/dist/SaveBlockDialog-C_QvYAeL.js +266 -0
  24. package/dist/{SavedBlocksBrowserModal-KWlaiLlr.js → SavedBlocksBrowserModal-CefWWcdT.js} +116 -115
  25. package/dist/{cdn/chunks/SavedBlocksPanels-e4HyTZ8v.js → SavedBlocksPanels-DnQwO-7O.js} +9 -11
  26. package/dist/{SavedBlocksPickBar-C3h8oL3r.js → SavedBlocksPickBar-BsFubArH.js} +17 -17
  27. package/dist/{TemplateScoringPanel-BZUsb3FD.js → TemplateScoringPanel-Bv_bBsJi.js} +87 -87
  28. package/dist/TestEmailModal-STPWDP79.js +206 -0
  29. package/dist/{cdn/chunks/TestEmailPanel-CZAG1gQE.js → TestEmailPanel-HYVjApKZ.js} +4 -6
  30. package/dist/TitleEditor-DnB0EJ_g.js +198 -0
  31. package/dist/TplModal-chvLhXmC.js +49 -0
  32. package/dist/VersionHistoryMenu-Cq4rH56t.js +155 -0
  33. package/dist/VersionHistoryPanels-D7k_F7-9.js +46 -0
  34. package/dist/VersionPreviewBanner-DthyHe6C.js +38 -0
  35. package/dist/{blockTypeIcons-2_85L_CL.js → blockTypeIcons-B8r4jMBn.js} +6 -6
  36. package/dist/bundle-stats.json +8 -8
  37. package/dist/{ca-D1zgI9fQ.js → ca-Cqg9O8mx.js} +69 -6
  38. package/dist/cdn/chunks/{AiChatSidebar-CQ8KUmNB.js → AiChatSidebar-DTUoBH5a.js} +54 -54
  39. package/dist/cdn/chunks/AiChatSidebar-DTUoBH5a.js.map +1 -0
  40. package/dist/cdn/chunks/AiFeatureMenu-Dyh7mUMB.js +57 -0
  41. package/dist/cdn/chunks/AiFeatureMenu-Dyh7mUMB.js.map +1 -0
  42. package/dist/cdn/chunks/{BlockIssueBadge-BEEY9o2o.js → BlockIssueBadge-UzSSOM_2.js} +13 -13
  43. package/dist/cdn/chunks/{BlockIssueBadge-BEEY9o2o.js.map → BlockIssueBadge-UzSSOM_2.js.map} +1 -1
  44. package/dist/cdn/chunks/{BlockPreviewCanvas-DPtiMsVz.js → BlockPreviewCanvas-DStQFo9P.js} +42 -42
  45. package/dist/cdn/chunks/{BlockPreviewCanvas-DPtiMsVz.js.map → BlockPreviewCanvas-DStQFo9P.js.map} +1 -1
  46. package/dist/cdn/chunks/CloudHeaderExtras-BZVu7dnO.js +60 -0
  47. package/dist/cdn/chunks/CloudHeaderExtras-BZVu7dnO.js.map +1 -0
  48. package/dist/cdn/chunks/CloudPanels-CXbaBKHQ.js +227 -0
  49. package/dist/cdn/chunks/CloudPanels-CXbaBKHQ.js.map +1 -0
  50. package/dist/cdn/chunks/{CollaboratorBar-BF469_AN.js → CollaboratorBar-BH_lZlat.js} +22 -22
  51. package/dist/cdn/chunks/CollaboratorBar-BH_lZlat.js.map +1 -0
  52. package/dist/cdn/chunks/ColorPicker-CStXen0Y.js +502 -0
  53. package/dist/cdn/chunks/ColorPicker-CStXen0Y.js.map +1 -0
  54. package/dist/cdn/chunks/CommentsPanel-jzZ2X0P4.js +20 -0
  55. package/dist/cdn/chunks/CommentsPanel-jzZ2X0P4.js.map +1 -0
  56. package/dist/cdn/chunks/CommentsSidebar-Dxke-vUP.js +460 -0
  57. package/dist/cdn/chunks/CommentsSidebar-Dxke-vUP.js.map +1 -0
  58. package/dist/{CountdownBlock-DuyvGcr8.js → cdn/chunks/CountdownBlock-BYSrJWxg.js} +25 -23
  59. package/dist/cdn/chunks/{CountdownBlock-vLTkTI9e.js.map → CountdownBlock-BYSrJWxg.js.map} +1 -1
  60. package/dist/{CountdownToolbar-CBE9wRaV.js → cdn/chunks/CountdownToolbar-CZPtQIb8.js} +66 -63
  61. package/dist/cdn/chunks/{CountdownToolbar-DPjcgcVR.js.map → CountdownToolbar-CZPtQIb8.js.map} +1 -1
  62. package/dist/cdn/chunks/{DesignReferenceSidebar-B-HFXV0W.js → DesignReferenceSidebar-sZWciECR.js} +64 -64
  63. package/dist/cdn/chunks/DesignReferenceSidebar-sZWciECR.js.map +1 -0
  64. package/dist/cdn/chunks/{IssuesPanel-DKTS4QVb.js → IssuesPanel-CHtetM9i.js} +36 -36
  65. package/dist/cdn/chunks/IssuesPanel-CHtetM9i.js.map +1 -0
  66. package/dist/cdn/chunks/{LoadingTrack-C52ZGL5q.js → LoadingTrack-Dp_QZvAK.js} +3 -3
  67. package/dist/cdn/chunks/{LoadingTrack-C52ZGL5q.js.map → LoadingTrack-Dp_QZvAK.js.map} +1 -1
  68. package/dist/cdn/chunks/{MergeTagModeToggle-DQ79SqQc.js → MergeTagModeToggle-ZwW-5EeN.js} +39 -39
  69. package/dist/cdn/chunks/{MergeTagModeToggle-DQ79SqQc.js.map → MergeTagModeToggle-ZwW-5EeN.js.map} +1 -1
  70. package/dist/cdn/chunks/{MergeTagSuggestion-Dn8dExNa.js → MergeTagSuggestion-DhllqTA3.js} +47 -47
  71. package/dist/cdn/chunks/MergeTagSuggestion-DhllqTA3.js.map +1 -0
  72. package/dist/{NumberWithSuffix-D37ZWiZh.js → cdn/chunks/NumberWithSuffix-yeQLcCyH.js} +37 -35
  73. package/dist/cdn/chunks/NumberWithSuffix-yeQLcCyH.js.map +1 -0
  74. package/dist/cdn/chunks/{ParagraphEditor-Bzcma_Lm.js → ParagraphEditor-BJJ925sx.js} +235 -233
  75. package/dist/cdn/chunks/ParagraphEditor-BJJ925sx.js.map +1 -0
  76. package/dist/cdn/chunks/RestoreVersionDialog-B0Jadu6F.js +87 -0
  77. package/dist/cdn/chunks/RestoreVersionDialog-B0Jadu6F.js.map +1 -0
  78. package/dist/cdn/chunks/{RichTextEditorContent-DtL49Jpo.js → RichTextEditorContent-CfSq2wPR.js} +44 -44
  79. package/dist/cdn/chunks/RichTextEditorContent-CfSq2wPR.js.map +1 -0
  80. package/dist/cdn/chunks/SaveBlockDialog-C1DXh6P9.js +265 -0
  81. package/dist/cdn/chunks/SaveBlockDialog-C1DXh6P9.js.map +1 -0
  82. package/dist/cdn/chunks/{SavedBlocksBrowserModal-C59D4G5C.js → SavedBlocksBrowserModal-BerMxAUt.js} +114 -113
  83. package/dist/cdn/chunks/SavedBlocksBrowserModal-BerMxAUt.js.map +1 -0
  84. package/dist/{SavedBlocksPanels-CQsZvWO_.js → cdn/chunks/SavedBlocksPanels-BUE4lzVP.js} +11 -9
  85. package/dist/cdn/chunks/{SavedBlocksPanels-e4HyTZ8v.js.map → SavedBlocksPanels-BUE4lzVP.js.map} +1 -1
  86. package/dist/cdn/chunks/{SavedBlocksPickBar-DMHxPCM4.js → SavedBlocksPickBar-4HrqQfvl.js} +17 -17
  87. package/dist/cdn/chunks/SavedBlocksPickBar-4HrqQfvl.js.map +1 -0
  88. package/dist/cdn/chunks/{TemplateScoringPanel-NucRtAP0.js → TemplateScoringPanel-Xdkp2EMY.js} +81 -81
  89. package/dist/cdn/chunks/TemplateScoringPanel-Xdkp2EMY.js.map +1 -0
  90. package/dist/cdn/chunks/TestEmailModal-yfmFiavR.js +206 -0
  91. package/dist/cdn/chunks/TestEmailModal-yfmFiavR.js.map +1 -0
  92. package/dist/{TestEmailPanel-B6goIAxT.js → cdn/chunks/TestEmailPanel-DqTDh5ri.js} +6 -4
  93. package/dist/cdn/chunks/{TestEmailPanel-CZAG1gQE.js.map → TestEmailPanel-DqTDh5ri.js.map} +1 -1
  94. package/dist/cdn/chunks/{TitleEditor-D0_LY2Ex.js → TitleEditor-nUAF7fKr.js} +85 -84
  95. package/dist/cdn/chunks/TitleEditor-nUAF7fKr.js.map +1 -0
  96. package/dist/cdn/chunks/TplModal-C0IqikoV.js +50 -0
  97. package/dist/cdn/chunks/TplModal-C0IqikoV.js.map +1 -0
  98. package/dist/cdn/chunks/VersionHistoryMenu-_MAj3qZj.js +148 -0
  99. package/dist/cdn/chunks/VersionHistoryMenu-_MAj3qZj.js.map +1 -0
  100. package/dist/cdn/chunks/VersionHistoryPanels-6Hz9w20W.js +48 -0
  101. package/dist/cdn/chunks/VersionHistoryPanels-6Hz9w20W.js.map +1 -0
  102. package/dist/cdn/chunks/VersionPreviewBanner-D098_6_I.js +40 -0
  103. package/dist/cdn/chunks/VersionPreviewBanner-D098_6_I.js.map +1 -0
  104. package/dist/cdn/chunks/{blockTypeIcons-FXlMM3PL.js → blockTypeIcons-hX_W4dqo.js} +2 -2
  105. package/dist/cdn/chunks/{blockTypeIcons-FXlMM3PL.js.map → blockTypeIcons-hX_W4dqo.js.map} +1 -1
  106. package/dist/cdn/chunks/{ca-D1zgI9fQ.js → ca-Cqg9O8mx.js} +70 -7
  107. package/dist/cdn/chunks/ca-Cqg9O8mx.js.map +1 -0
  108. package/dist/{cloud-qINCmQbn.js → cdn/chunks/cloud-BA0OpRh-.js} +400 -609
  109. package/dist/cdn/chunks/cloud-BA0OpRh-.js.map +1 -0
  110. package/dist/cdn/chunks/createCloudRuntime-DmzV7OnU.js +344 -0
  111. package/dist/cdn/chunks/createCloudRuntime-DmzV7OnU.js.map +1 -0
  112. package/dist/{de-DHra3lvx.js → cdn/chunks/de-BXmeeFbX.js} +71 -6
  113. package/dist/cdn/chunks/de-BXmeeFbX.js.map +1 -0
  114. package/dist/{de-uVoSP1xF.js → cdn/chunks/de-Dbwm2cON.js} +3 -54
  115. package/dist/cdn/chunks/de-Dbwm2cON.js.map +1 -0
  116. package/dist/cdn/chunks/{dist-B2HKGHnc.js → dist-CM8TB0VD.js} +136 -136
  117. package/dist/cdn/chunks/{dist-B2HKGHnc.js.map → dist-CM8TB0VD.js.map} +1 -1
  118. package/dist/cdn/chunks/{dist-C6z8AjBC.js → dist-CYLJiSiH.js} +63 -63
  119. package/dist/cdn/chunks/{dist-C6z8AjBC.js.map → dist-CYLJiSiH.js.map} +1 -1
  120. package/dist/cdn/chunks/{draggable-DCs9qL-b.js → draggable-BfpsXFg7.js} +916 -905
  121. package/dist/cdn/chunks/{draggable-DCs9qL-b.js.map → draggable-BfpsXFg7.js.map} +1 -1
  122. package/dist/cdn/chunks/{en-DlqX2YWZ.js → en-DbBNy67B.js} +70 -7
  123. package/dist/cdn/chunks/en-DbBNy67B.js.map +1 -0
  124. package/dist/{en-CjhsJxb-.js → cdn/chunks/en-Dzw4EqNI.js} +3 -54
  125. package/dist/cdn/chunks/en-Dzw4EqNI.js.map +1 -0
  126. package/dist/cdn/chunks/{es-Cuss2snv.js → es-JUsAjxWu.js} +70 -7
  127. package/dist/cdn/chunks/es-JUsAjxWu.js.map +1 -0
  128. package/dist/cdn/chunks/{extensions-C7h52yuk.js → extensions-CMcVw2uu.js} +81 -67
  129. package/dist/cdn/chunks/extensions-CMcVw2uu.js.map +1 -0
  130. package/dist/{fr-Cm85vB2g.js → cdn/chunks/fr-J3qgXH4h.js} +71 -6
  131. package/dist/cdn/chunks/fr-J3qgXH4h.js.map +1 -0
  132. package/dist/cdn/chunks/{icons-CvYN6zrM.js → icons-C36Ha5VU.js} +11 -11
  133. package/dist/cdn/chunks/{icons-CvYN6zrM.js.map → icons-C36Ha5VU.js.map} +1 -1
  134. package/dist/{keys-fwF3qZax.js → cdn/chunks/keys-CbQuRX85.js} +6 -4
  135. package/dist/cdn/chunks/keys-CbQuRX85.js.map +1 -0
  136. package/dist/cdn/chunks/logger-ByvdoAwq.js +23 -0
  137. package/dist/cdn/chunks/logger-ByvdoAwq.js.map +1 -0
  138. package/dist/cdn/chunks/{nl-dmiIX7oT.js → nl-D_4DkqOi.js} +70 -7
  139. package/dist/cdn/chunks/nl-D_4DkqOi.js.map +1 -0
  140. package/dist/cdn/chunks/preRenderCustomBlocks-CbA3RcAy.js +23 -0
  141. package/dist/cdn/chunks/preRenderCustomBlocks-CbA3RcAy.js.map +1 -0
  142. package/dist/{pt-BR-CTzHTqJD.js → cdn/chunks/pt-BR-BxzQzWGJ.js} +3 -54
  143. package/dist/cdn/chunks/pt-BR-BxzQzWGJ.js.map +1 -0
  144. package/dist/cdn/chunks/{pt-BR-CaIG-7EM.js → pt-BR-KGURyEEQ.js} +70 -7
  145. package/dist/cdn/chunks/pt-BR-KGURyEEQ.js.map +1 -0
  146. package/dist/cdn/chunks/{src-CUKUsRzX.js → src-BOjFLNf7.js} +148 -134
  147. package/dist/cdn/chunks/src-BOjFLNf7.js.map +1 -0
  148. package/dist/cdn/chunks/{src-xkGep9eN.js → src-Dq3fgSIx.js} +1448 -1458
  149. package/dist/cdn/chunks/src-Dq3fgSIx.js.map +1 -0
  150. package/dist/cdn/chunks/styleConstants-ByDqaYj_.js +61 -0
  151. package/dist/cdn/chunks/styleConstants-ByDqaYj_.js.map +1 -0
  152. package/dist/cdn/chunks/timeouts-DHPZQ0G3.js +6 -0
  153. package/dist/cdn/chunks/timeouts-DHPZQ0G3.js.map +1 -0
  154. package/dist/cdn/chunks/{tiptap-C44S1Cmh.js → tiptap-DmpGap5g.js} +40 -40
  155. package/dist/cdn/chunks/{tiptap-C44S1Cmh.js.map → tiptap-DmpGap5g.js.map} +1 -1
  156. package/dist/cdn/chunks/{useAliveFlag-Dxwgo6P4.js → useAliveFlag-Dtm174fG.js} +2 -2
  157. package/dist/cdn/chunks/{useAliveFlag-Dxwgo6P4.js.map → useAliveFlag-Dtm174fG.js.map} +1 -1
  158. package/dist/cdn/chunks/{useCloudI18n-8wkJtuJD.js → useCloudI18n-NVa1aeY8.js} +5 -5
  159. package/dist/cdn/chunks/{useCloudI18n-8wkJtuJD.js.map → useCloudI18n-NVa1aeY8.js.map} +1 -1
  160. package/dist/cdn/chunks/{useEditorCore-CKQ9gmoo.js → useEditorCore-CTu_qZ3W.js} +1434 -1147
  161. package/dist/cdn/chunks/useEditorCore-CTu_qZ3W.js.map +1 -0
  162. package/dist/cdn/chunks/{useI18n-UMs0F71x.js → useI18n-DVWCJJFH.js} +5 -5
  163. package/dist/cdn/chunks/{useI18n-UMs0F71x.js.map → useI18n-DVWCJJFH.js.map} +1 -1
  164. package/dist/cdn/chunks/{useMergeTag-JmXOtpln.js → useMergeTag-BfZBRPQp.js} +4 -4
  165. package/dist/cdn/chunks/{useMergeTag-JmXOtpln.js.map → useMergeTag-BfZBRPQp.js.map} +1 -1
  166. package/dist/cdn/chunks/{usePopoverPosition-cf8Y-ynK.js → usePopoverPosition-BC-HA7TK.js} +3 -3
  167. package/dist/cdn/chunks/{usePopoverPosition-cf8Y-ynK.js.map → usePopoverPosition-BC-HA7TK.js.map} +1 -1
  168. package/dist/cdn/editor.css +1 -1
  169. package/dist/cdn/editor.js +5103 -284
  170. package/dist/cdn/editor.js.map +1 -1
  171. package/dist/{check-On4TSac-.js → check-DZbmkMQe.js} +1 -1
  172. package/dist/{chevron-down-69EiBGoB.js → chevron-down-nYScOLeZ.js} +1 -1
  173. package/dist/{chevron-up-Dh3MG1Dw.js → chevron-up-CpYpDLnc.js} +1 -1
  174. package/dist/{circle-alert-cilwzafX.js → circle-alert-CuuK6thq.js} +1 -1
  175. package/dist/{clock-Dt0APH92.js → clock-DxkrtqOr.js} +1 -1
  176. package/dist/cloud-BAefVBb_.js +1444 -0
  177. package/dist/createCloudRuntime-Bt8W-ajI.js +342 -0
  178. package/dist/{createLucideIcon-C8WzBYCv.js → createLucideIcon-L-wQXW_R.js} +9 -9
  179. package/dist/{cdn/chunks/de-DHra3lvx.js → de-BXmeeFbX.js} +69 -8
  180. package/dist/{cdn/chunks/de-uVoSP1xF.js → de-Dbwm2cON.js} +1 -56
  181. package/dist/dist-B5iReTtK.js +251 -0
  182. package/dist/{dist-Cl8J0IES.js → dist-Ck9roB6K.js} +42 -42
  183. package/dist/{dist-BpKxrUi2.js → dist-CqcGTIiX.js} +46 -46
  184. package/dist/{en-DlqX2YWZ.js → en-DbBNy67B.js} +69 -6
  185. package/dist/{cdn/chunks/en-CjhsJxb-.js → en-Dzw4EqNI.js} +1 -56
  186. package/dist/{es-Cuss2snv.js → es-JUsAjxWu.js} +69 -6
  187. package/dist/{extensions-DzKNPITR.js → extensions-CX87G4aL.js} +71 -57
  188. package/dist/{cdn/chunks/fr-Cm85vB2g.js → fr-J3qgXH4h.js} +69 -8
  189. package/dist/{image-up-Ceggh_R3.js → image-up-DouZRGVt.js} +1 -1
  190. package/dist/index.d.ts +499 -23
  191. package/dist/{info-DO5odBcZ.js → info-puX5V6Iq.js} +1 -1
  192. package/dist/{cdn/chunks/keys-Cmc2Yl3D.js → keys-BxixS0TN.js} +4 -6
  193. package/dist/{list-checks-BSkPKbuI.js → list-checks-jw-ZlvWY.js} +1 -1
  194. package/dist/{loader-circle-bO7o7_HD.js → loader-circle-DqTxB7Kr.js} +1 -1
  195. package/dist/logger-BBlvSn6q.js +21 -0
  196. package/dist/{message-circle-BEkAk65X.js → message-circle-BZ7YpB22.js} +1 -1
  197. package/dist/{nl-dmiIX7oT.js → nl-D_4DkqOi.js} +69 -6
  198. package/dist/{pencil-t6m0EtKL.js → pencil-DmbRhTJu.js} +1 -1
  199. package/dist/preRenderCustomBlocks-BebjKtmw.js +21 -0
  200. package/dist/{cdn/chunks/pt-BR-CTzHTqJD.js → pt-BR-BxzQzWGJ.js} +1 -56
  201. package/dist/{pt-BR-CaIG-7EM.js → pt-BR-KGURyEEQ.js} +69 -6
  202. package/dist/{refresh-cw-CkOYVzK5.js → refresh-cw-OK_O-cL0.js} +1 -1
  203. package/dist/{runtime-dom.esm-bundler-CepEmvwF.js → runtime-dom.esm-bundler-BgKXIPLV.js} +144 -144
  204. package/dist/{scan-line-DwSVj25O.js → scan-line-DyaSTsJ5.js} +1 -1
  205. package/dist/{send-CWsWN8PQ.js → send-B-wasJJC.js} +1 -1
  206. package/dist/{shield-check-qje8Kufw.js → shield-check-DUIyRrTo.js} +1 -1
  207. package/dist/{sparkles-DumaWRW-.js → sparkles-DYEMATWC.js} +1 -1
  208. package/dist/style.css +1 -1
  209. package/dist/styleConstants-ByDqaYj_.js +59 -0
  210. package/dist/templatical-editor.js +5303 -289
  211. package/dist/{text-align-start-Ir8Ah4mT.js → text-align-start-CzjLeBLe.js} +1 -1
  212. package/dist/timeouts-DHPZQ0G3.js +4 -0
  213. package/dist/{trash-2-CklAFCmO.js → trash-2-C0shEPry.js} +1 -1
  214. package/dist/{triangle-alert-BBi4n93g.js → triangle-alert-Fw0ce8oQ.js} +1 -1
  215. package/dist/{upload-sVqqppuv.js → upload-D69C2CBx.js} +3 -4
  216. package/dist/{useAliveFlag-cvyBxHp7.js → useAliveFlag-BGIAZii_.js} +1 -1
  217. package/dist/{useCloudI18n-DKVm6PCa.js → useCloudI18n-CAZTZ9_a.js} +2 -2
  218. package/dist/{useEditorCore-idmPLUeb.js → useEditorCore-B-kONNRw.js} +1604 -1320
  219. package/dist/{useI18n-DoVKdCTH.js → useI18n-BfXff_Sy.js} +2 -2
  220. package/dist/{useMergeTag-CYZk7dZD.js → useMergeTag-Dd4I7kge.js} +3 -3
  221. package/dist/usePopoverPosition-CxhCX3SQ.js +59 -0
  222. package/dist/{vue.runtime.esm-bundler-D1diBMsm.js → vue.runtime.esm-bundler-DzEsDRtY.js} +447 -436
  223. package/dist/{x-Mby7KlhS.js → x-BjTlFqRv.js} +1 -1
  224. package/package.json +7 -7
  225. package/dist/AiFeatureMenu-BY6mubnR.js +0 -63
  226. package/dist/BlockPreviewCanvas-DbNOqSI1.js +0 -121
  227. package/dist/CloudEditor-DEnMNMbm.js +0 -1188
  228. package/dist/ColorPicker-ClETsjA3.js +0 -550
  229. package/dist/CommentsSidebar-CdRCCSDD.js +0 -435
  230. package/dist/SaveBlockDialog-fVp_PwZi.js +0 -265
  231. package/dist/SnapshotHistory-DjA3Ej_i.js +0 -128
  232. package/dist/TestEmailModal-EM0RP_9L.js +0 -205
  233. package/dist/TitleEditor-JEaP9jVF.js +0 -197
  234. package/dist/TplModal-DoneXIj_.js +0 -49
  235. package/dist/cdn/chunks/AiChatSidebar-CQ8KUmNB.js.map +0 -1
  236. package/dist/cdn/chunks/AiFeatureMenu-Cwj8afsi.js +0 -63
  237. package/dist/cdn/chunks/AiFeatureMenu-Cwj8afsi.js.map +0 -1
  238. package/dist/cdn/chunks/CloudEditor-CQ830jJt.js +0 -1166
  239. package/dist/cdn/chunks/CloudEditor-CQ830jJt.js.map +0 -1
  240. package/dist/cdn/chunks/CollaboratorBar-BF469_AN.js.map +0 -1
  241. package/dist/cdn/chunks/ColorPicker-W_UyiVGc.js +0 -552
  242. package/dist/cdn/chunks/ColorPicker-W_UyiVGc.js.map +0 -1
  243. package/dist/cdn/chunks/CommentsSidebar-BLRZRSSC.js +0 -412
  244. package/dist/cdn/chunks/CommentsSidebar-BLRZRSSC.js.map +0 -1
  245. package/dist/cdn/chunks/DesignReferenceSidebar-B-HFXV0W.js.map +0 -1
  246. package/dist/cdn/chunks/IssuesPanel-DKTS4QVb.js.map +0 -1
  247. package/dist/cdn/chunks/MergeTagSuggestion-Dn8dExNa.js.map +0 -1
  248. package/dist/cdn/chunks/NumberWithSuffix-BXrRdfq1.js.map +0 -1
  249. package/dist/cdn/chunks/ParagraphEditor-Bzcma_Lm.js.map +0 -1
  250. package/dist/cdn/chunks/RichTextEditorContent-DtL49Jpo.js.map +0 -1
  251. package/dist/cdn/chunks/SaveBlockDialog-BfNVeXXV.js +0 -264
  252. package/dist/cdn/chunks/SaveBlockDialog-BfNVeXXV.js.map +0 -1
  253. package/dist/cdn/chunks/SavedBlocksBrowserModal-C59D4G5C.js.map +0 -1
  254. package/dist/cdn/chunks/SavedBlocksPickBar-DMHxPCM4.js.map +0 -1
  255. package/dist/cdn/chunks/SnapshotHistory-80tAU_VX.js +0 -121
  256. package/dist/cdn/chunks/SnapshotHistory-80tAU_VX.js.map +0 -1
  257. package/dist/cdn/chunks/TemplateScoringPanel-NucRtAP0.js.map +0 -1
  258. package/dist/cdn/chunks/TestEmailModal-DdWfAGNe.js +0 -205
  259. package/dist/cdn/chunks/TestEmailModal-DdWfAGNe.js.map +0 -1
  260. package/dist/cdn/chunks/TitleEditor-D0_LY2Ex.js.map +0 -1
  261. package/dist/cdn/chunks/TplModal-iCmoKB2k.js +0 -50
  262. package/dist/cdn/chunks/TplModal-iCmoKB2k.js.map +0 -1
  263. package/dist/cdn/chunks/ca-D1zgI9fQ.js.map +0 -1
  264. package/dist/cdn/chunks/cloud-DcC8bPwn.js +0 -1787
  265. package/dist/cdn/chunks/cloud-DcC8bPwn.js.map +0 -1
  266. package/dist/cdn/chunks/de-DHra3lvx.js.map +0 -1
  267. package/dist/cdn/chunks/de-uVoSP1xF.js.map +0 -1
  268. package/dist/cdn/chunks/en-CjhsJxb-.js.map +0 -1
  269. package/dist/cdn/chunks/en-DlqX2YWZ.js.map +0 -1
  270. package/dist/cdn/chunks/es-Cuss2snv.js.map +0 -1
  271. package/dist/cdn/chunks/extensions-C7h52yuk.js.map +0 -1
  272. package/dist/cdn/chunks/fr-Cm85vB2g.js.map +0 -1
  273. package/dist/cdn/chunks/keys-Cmc2Yl3D.js.map +0 -1
  274. package/dist/cdn/chunks/nl-dmiIX7oT.js.map +0 -1
  275. package/dist/cdn/chunks/pt-BR-CTzHTqJD.js.map +0 -1
  276. package/dist/cdn/chunks/pt-BR-CaIG-7EM.js.map +0 -1
  277. package/dist/cdn/chunks/src-CUKUsRzX.js.map +0 -1
  278. package/dist/cdn/chunks/src-xkGep9eN.js.map +0 -1
  279. package/dist/cdn/chunks/styles-CND3ey2g.js +0 -4140
  280. package/dist/cdn/chunks/styles-CND3ey2g.js.map +0 -1
  281. package/dist/cdn/chunks/timeouts-SsLMC4a3.js +0 -6
  282. package/dist/cdn/chunks/timeouts-SsLMC4a3.js.map +0 -1
  283. package/dist/cdn/chunks/useEditorCore-CKQ9gmoo.js.map +0 -1
  284. package/dist/styles-BK36D1sy.js +0 -4318
  285. package/dist/usePopoverPosition-C0dPEF4X.js +0 -308
@@ -1,7 +1,12 @@
1
- import { I as e, J as t, K as n, Y as r, q as i, s as a } from "./vue.runtime.esm-bundler-D1diBMsm.js";
2
- import { o, p as s } from "./dist-B1kLn1rs.js";
3
- //#region ../core/dist/cloud/index.js
4
- var c = class e {
1
+ import { r as e } from "./rolldown-runtime-B0aSnxlc.js";
2
+ import { B as t, Q as n, Y as r, f as i } from "./draggable-BfpsXFg7.js";
3
+ import { t as a } from "./src-B_QJduQD.js";
4
+ //#region ../core/src/cloud/auth.ts
5
+ function o(e) {
6
+ let t = e instanceof a ? e.statusCode : void 0;
7
+ return t !== void 0 && t >= 400 && t < 500;
8
+ }
9
+ var s = class e {
5
10
  static DEFAULT_BASE_URL = "https://templatical.com";
6
11
  accessToken = null;
7
12
  expiresAt = null;
@@ -75,7 +80,7 @@ var c = class e {
75
80
  };
76
81
  e === "POST" && this.requestOptions.body && (t["Content-Type"] = "application/json", n.body = JSON.stringify(this.requestOptions.body));
77
82
  let r = await fetch(this.url, n);
78
- if (!r.ok) throw new o(`Token refresh failed: ${r.status}`, r.status);
83
+ if (!r.ok) throw new a(`Token refresh failed: ${r.status}`, r.status);
79
84
  let i = await r.json();
80
85
  if (!i.token || !i.expires_at || !i.project_id || !i.tenant) throw Error("Invalid token response: missing token, expires_at, project_id, or tenant");
81
86
  return this.accessToken = i.token, this.expiresAt = /* @__PURE__ */ new Date(i.expires_at * 1e3), this._projectId = i.project_id, this._tenantSlug = i.tenant, this._testEmailConfig = i.test_email?.allowed_emails && i.test_email?.signature ? {
@@ -102,6 +107,30 @@ var c = class e {
102
107
  return a.status === 401 && (a = await i(await this.refreshToken())), a;
103
108
  }
104
109
  };
110
+ function c(e, t) {
111
+ return e.mode === "direct" ? new s({
112
+ url: `${(e.baseUrl ?? "https://templatical.com").replace(/\/$/, "")}/api/v1/auth/token`,
113
+ baseUrl: e.baseUrl,
114
+ requestOptions: {
115
+ method: "POST",
116
+ headers: { "Content-Type": "application/json" },
117
+ body: {
118
+ client_id: e.clientId,
119
+ client_secret: e.clientSecret,
120
+ tenant: e.tenant,
121
+ client_type: "sdk"
122
+ }
123
+ },
124
+ onError: t
125
+ }) : new s({
126
+ url: e.url,
127
+ baseUrl: e.baseUrl,
128
+ requestOptions: e.requestOptions,
129
+ onError: t
130
+ });
131
+ }
132
+ //#endregion
133
+ //#region ../core/src/cloud/url-builder.ts
105
134
  function l(e, t) {
106
135
  return e.replace(/\{(\w+)\}/g, (e, n) => encodeURIComponent(t[n] ?? ""));
107
136
  }
@@ -116,10 +145,10 @@ var u = "/api/v1/projects/{project}/tenants/{tenant}", d = `${u}/templates/{temp
116
145
  "templates.export": `${d}/export`,
117
146
  "templates.importFromBeefree": `${u}/templates/import/from-beefree`,
118
147
  "templates.sendTestEmail": `${d}/send-test-email`,
119
- "snapshots.index": `${d}/snapshots`,
120
- "snapshots.store": `${d}/snapshots`,
121
- "snapshots.show": `${d}/snapshots/{snapshot}`,
122
- "snapshots.restore": `${d}/snapshots/{snapshot}/restore`,
148
+ "versions.index": `${d}/versions`,
149
+ "versions.store": `${d}/versions`,
150
+ "versions.show": `${d}/versions/{version}`,
151
+ "versions.restore": `${d}/versions/{version}/restore`,
123
152
  "comments.index": `${d}/comments`,
124
153
  "comments.store": `${d}/comments`,
125
154
  "comments.update": `${d}/comments/{comment}`,
@@ -177,7 +206,7 @@ var u = "/api/v1/projects/{project}/tenants/{tenant}", d = `${u}/templates/{temp
177
206
  });
178
207
  if (!n.ok) {
179
208
  let e = await n.json().catch(() => ({ message: `HTTP error ${n.status}` })), t = this.extractFirstValidationError(e);
180
- throw new o(t, n.status);
209
+ throw new a(t, n.status);
181
210
  }
182
211
  if (n.status !== 204) return (await n.json()).data;
183
212
  }
@@ -188,10 +217,13 @@ var u = "/api/v1/projects/{project}/tenants/{tenant}", d = `${u}/templates/{temp
188
217
  }
189
218
  return e.message;
190
219
  }
191
- async createTemplate(e) {
220
+ async createTemplate(e, t) {
192
221
  return this.request(l(g["templates.store"], this.baseParams), {
193
222
  method: "POST",
194
- body: JSON.stringify({ content: e })
223
+ body: JSON.stringify(t === void 0 ? { content: e } : {
224
+ content: e,
225
+ name: t
226
+ })
195
227
  });
196
228
  }
197
229
  async getTemplate(e) {
@@ -206,16 +238,19 @@ var u = "/api/v1/projects/{project}/tenants/{tenant}", d = `${u}/templates/{temp
206
238
  template: e
207
239
  }), {
208
240
  method: "PUT",
209
- body: JSON.stringify({ content: t })
241
+ body: JSON.stringify(t)
210
242
  });
211
243
  }
212
- async createSnapshot(e, t) {
213
- return this.request(l(g["snapshots.store"], {
244
+ async createVersion(e, t, n) {
245
+ return this.request(l(g["versions.store"], {
214
246
  ...this.baseParams,
215
247
  template: e
216
248
  }), {
217
249
  method: "POST",
218
- body: JSON.stringify({ content: t })
250
+ body: JSON.stringify(n === void 0 ? { content: t } : {
251
+ content: t,
252
+ label: n
253
+ })
219
254
  });
220
255
  }
221
256
  async deleteTemplate(e) {
@@ -224,17 +259,24 @@ var u = "/api/v1/projects/{project}/tenants/{tenant}", d = `${u}/templates/{temp
224
259
  template: e
225
260
  }), { method: "DELETE" });
226
261
  }
227
- async getSnapshots(e) {
228
- return this.request(l(g["snapshots.index"], {
262
+ async getVersions(e) {
263
+ return this.request(l(g["versions.index"], {
229
264
  ...this.baseParams,
230
265
  template: e
231
266
  }));
232
267
  }
233
- async restoreSnapshot(e, t) {
234
- return this.request(l(g["snapshots.restore"], {
268
+ async getVersion(e, t) {
269
+ return this.request(l(g["versions.show"], {
235
270
  ...this.baseParams,
236
271
  template: e,
237
- snapshot: t
272
+ version: t
273
+ }));
274
+ }
275
+ async restoreVersion(e, t) {
276
+ return this.request(l(g["versions.restore"], {
277
+ ...this.baseParams,
278
+ template: e,
279
+ version: t
238
280
  }), { method: "POST" });
239
281
  }
240
282
  async exportTemplate(e, t) {
@@ -335,6 +377,8 @@ var u = "/api/v1/projects/{project}/tenants/{tenant}", d = `${u}/templates/{temp
335
377
  }), { method: "DELETE" });
336
378
  }
337
379
  };
380
+ //#endregion
381
+ //#region ../core/src/cloud/websocket-client.ts
338
382
  function v(e) {
339
383
  return {
340
384
  host: e.host,
@@ -352,27 +396,27 @@ var y = class {
352
396
  }
353
397
  async connect() {
354
398
  if (this.pusher) return;
355
- let e;
399
+ let t;
356
400
  try {
357
- ({default: e} = await import("pusher-js"));
401
+ ({default: t} = await import("./pusher-BbIHJKf3.js").then((t) => /* @__PURE__ */ e(t.t(), 1)));
358
402
  } catch {
359
- throw Error("Cloud features require the optional peer dependency 'pusher-js'. Install it with: npm install pusher-js");
403
+ throw Error("[Templatical] Cloud features require the optional peer dependency 'pusher-js'. Please install it.");
360
404
  }
361
- let { host: t, port: n, appKey: r } = this.config, i = this.authManager.resolveUrl(l(g["broadcasting.auth"], {
405
+ let { host: n, port: r, appKey: i } = this.config, a = this.authManager.resolveUrl(l(g["broadcasting.auth"], {
362
406
  project: this.authManager.projectId,
363
407
  tenant: this.authManager.tenantSlug
364
408
  }));
365
- this.pusher = new e(r, {
366
- wsHost: t,
367
- wsPort: n,
368
- wssPort: n,
409
+ this.pusher = new t(i, {
410
+ wsHost: n,
411
+ wsPort: r,
412
+ wssPort: r,
369
413
  forceTLS: !0,
370
414
  disableStats: !0,
371
415
  enabledTransports: ["ws", "wss"],
372
416
  cluster: "",
373
417
  channelAuthorization: {
374
418
  transport: "ajax",
375
- endpoint: i,
419
+ endpoint: a,
376
420
  headers: {
377
421
  Authorization: `Bearer ${this.authManager.accessTokenValue}`,
378
422
  Accept: "application/json"
@@ -407,6 +451,8 @@ var y = class {
407
451
  return this.pusher?.connection.state === "connected";
408
452
  }
409
453
  };
454
+ //#endregion
455
+ //#region ../core/src/cloud/mcp-operation-handler.ts
410
456
  function b(e, t) {
411
457
  let { operation: n, data: r } = t;
412
458
  switch (n) {
@@ -431,212 +477,14 @@ function b(e, t) {
431
477
  case "update_block_style": e.updateBlock(r.block_id, { styles: r.styles });
432
478
  }
433
479
  }
434
- function x(e) {
435
- return e === "1" ? 1 : e === "3" ? 3 : 2;
436
- }
437
- function S(e) {
438
- let n = new _(e.authManager), r = i({
439
- template: null,
440
- content: s(e.defaultFontFamily, e.templateDefaults),
441
- selectedBlockId: null,
442
- viewport: "desktop",
443
- darkMode: !1,
444
- previewMode: !1,
445
- isDirty: !1,
446
- isSaving: !1,
447
- isLoading: !1,
448
- uiTheme: "auto"
449
- }), c = a({
450
- get: () => r.content,
451
- set: (e) => {
452
- r.content = e, r.isDirty = !0;
453
- }
454
- }), l = a(() => r.selectedBlockId ? d(r.content.blocks, r.selectedBlockId) : null), u = a(() => {
455
- let e = /* @__PURE__ */ new Set(), t = r.template?.content?.blocks;
456
- if (!t) return e;
457
- for (let n of t) if (e.add(n.id), n.type === "section") for (let t of n.children) for (let n of t) e.add(n.id);
458
- return e;
459
- });
460
- function d(e, t) {
461
- for (let n of e) {
462
- if (n.id === t) return n;
463
- if (n.type === "section") for (let e of n.children) {
464
- let n = d(e, t);
465
- if (n) return n;
466
- }
467
- }
468
- return null;
469
- }
470
- function f(e, t, n = { blocks: e }) {
471
- for (let r = 0; r < e.length; r++) {
472
- let i = e[r];
473
- if (i.id === t) return n;
474
- if (i.type === "section") for (let e = 0; e < i.children.length; e++) {
475
- let n = f(i.children[e], t, {
476
- blocks: i.children[e],
477
- sectionId: i.id,
478
- columnIndex: e
479
- });
480
- if (n) return n;
481
- }
482
- }
483
- return null;
484
- }
485
- function p(t) {
486
- return e.lockedBlocks?.value.has(t) ?? !1;
487
- }
488
- function m(e, t = !0) {
489
- r.content = e, t && (r.isDirty = !0);
490
- }
491
- function h(e) {
492
- e && p(e) || (r.selectedBlockId = e);
493
- }
494
- function g(e) {
495
- r.viewport = e;
496
- }
497
- function v(e) {
498
- r.darkMode = e;
499
- }
500
- function y(e) {
501
- r.uiTheme = e;
502
- }
503
- function b(e) {
504
- r.previewMode = e, e && (r.selectedBlockId = null);
505
- }
506
- function S(e, t) {
507
- if (p(e)) return;
508
- let n = d(r.content.blocks, e);
509
- n && (Object.assign(n, t), r.isDirty = !0);
510
- }
511
- function C(e) {
512
- r.content.settings = {
513
- ...r.content.settings,
514
- ...e
515
- }, r.isDirty = !0;
516
- }
517
- function w(e, t, n = 0, i) {
518
- if (t) {
519
- let a = d(r.content.blocks, t);
520
- if (a && a.type === "section") {
521
- a.children[n] = a.children[n] || [];
522
- let t = a.children[n];
523
- i !== void 0 && i < t.length ? t.splice(i, 0, e) : t.push(e);
524
- }
525
- } else i !== void 0 && i < r.content.blocks.length ? r.content.blocks.splice(i, 0, e) : r.content.blocks.push(e);
526
- r.isDirty = !0;
527
- }
528
- function T(e) {
529
- if (p(e)) return;
530
- let t = f(r.content.blocks, e);
531
- if (t) {
532
- let n = t.blocks.findIndex((t) => t.id === e);
533
- n !== -1 && (t.blocks.splice(n, 1), r.selectedBlockId === e && (r.selectedBlockId = null), r.isDirty = !0);
534
- }
535
- }
536
- function E(e, t, n, i = 0) {
537
- let a = f(r.content.blocks, e);
538
- if (!a) return;
539
- let o = a.blocks.findIndex((t) => t.id === e);
540
- if (o === -1) return;
541
- let s;
542
- if (n) {
543
- let e = d(r.content.blocks, n);
544
- if (!e || e.type !== "section" || i < 0 || i >= x(e.columns)) return;
545
- e.children[i] = e.children[i] || [], s = e.children[i];
546
- } else s = r.content.blocks;
547
- let [c] = a.blocks.splice(o, 1);
548
- s.splice(t, 0, c), r.isDirty = !0;
549
- }
550
- async function D(t) {
551
- r.isLoading = !0;
552
- try {
553
- t && (r.content = t);
554
- let e = await n.createTemplate(r.content);
555
- return r.template = e, r.isDirty = !1, e;
556
- } catch (t) {
557
- throw e.onError?.(t), t;
558
- } finally {
559
- r.isLoading = !1;
560
- }
561
- }
562
- async function O(t) {
563
- r.isLoading = !0;
564
- try {
565
- let e = await n.getTemplate(t);
566
- return r.template = e, r.content = e.content, r.isDirty = !1, e;
567
- } catch (t) {
568
- throw e.onError?.(t), t;
569
- } finally {
570
- r.isLoading = !1;
571
- }
572
- }
573
- async function k() {
574
- if (!r.template?.id) throw new o("No template loaded. Call create() or load() before saving.");
575
- r.isSaving = !0;
576
- try {
577
- let e = await n.updateTemplate(r.template.id, r.content);
578
- return r.template = e, r.isDirty = !1, e;
579
- } catch (t) {
580
- throw e.onError?.(t), t;
581
- } finally {
582
- r.isSaving = !1;
583
- }
584
- }
585
- async function A() {
586
- if (r.template?.id) try {
587
- await n.createSnapshot(r.template.id, r.content);
588
- } catch (t) {
589
- throw e.onError?.(t), t;
590
- }
591
- }
592
- function j() {
593
- return r.template?.id !== void 0;
594
- }
595
- function M() {
596
- r.isDirty = !0;
597
- }
598
- function N(e) {
599
- let t = f(r.content.blocks, e);
600
- if (!t) return null;
601
- let n = t.blocks.findIndex((t) => t.id === e);
602
- return n === -1 ? null : {
603
- targetSectionId: t.sectionId,
604
- columnIndex: t.columnIndex,
605
- index: n
606
- };
607
- }
608
- return {
609
- state: t(r),
610
- content: c,
611
- selectedBlock: l,
612
- savedBlockIds: u,
613
- isBlockLocked: p,
614
- findBlockLocation: N,
615
- setContent: m,
616
- selectBlock: h,
617
- setViewport: g,
618
- setDarkMode: v,
619
- setUiTheme: y,
620
- setPreviewMode: b,
621
- updateBlock: S,
622
- updateSettings: C,
623
- addBlock: w,
624
- removeBlock: T,
625
- moveBlock: E,
626
- create: D,
627
- load: O,
628
- save: k,
629
- createSnapshot: A,
630
- hasTemplate: j,
631
- markDirty: M
632
- };
633
- }
634
- var C = 0;
635
- function w() {
636
- return `msg_${Date.now()}_${++C}`;
480
+ //#endregion
481
+ //#region ../core/src/cloud/ai-chat.ts
482
+ var x = 0;
483
+ function S() {
484
+ return `msg_${Date.now()}_${++x}`;
637
485
  }
638
- function T(e) {
639
- let { authManager: t, getTemplateId: n, onApply: i, onError: a } = e, o = r([]), s = r(!1), c = r(!1), u = r(null), d = r(null), f = r(null), p = r(null), m = r(null), h = r(null), _ = r(!1), v = r([]), y = r(!1);
486
+ function C(e) {
487
+ let { authManager: t, getTemplateId: r, onApply: i, onError: a } = e, o = n([]), s = n(!1), c = n(!1), u = n(null), d = n(null), f = n(null), p = n(null), m = n(null), h = n(null), _ = n(!1), v = n([]), y = n(!1);
640
488
  function b(e, t) {
641
489
  let n = o.value.findIndex((t) => t.id === e);
642
490
  if (n === -1) return;
@@ -651,7 +499,7 @@ function T(e) {
651
499
  ];
652
500
  }
653
501
  async function x() {
654
- let e = n();
502
+ let e = r();
655
503
  if (e) {
656
504
  c.value = !0;
657
505
  try {
@@ -676,16 +524,16 @@ function T(e) {
676
524
  }
677
525
  }
678
526
  }
679
- async function S(e, r) {
680
- let i = n();
527
+ async function C(e, n) {
528
+ let i = r();
681
529
  if (i) {
682
530
  y.value = !0;
683
531
  try {
684
- let n = l(g["ai.suggestions"], {
532
+ let r = l(g["ai.suggestions"], {
685
533
  project: t.projectId,
686
534
  tenant: t.tenantSlug,
687
535
  template: i
688
- }), a = await t.authenticatedFetch(n, {
536
+ }), a = await t.authenticatedFetch(r, {
689
537
  method: "POST",
690
538
  headers: {
691
539
  "Content-Type": "application/json",
@@ -693,7 +541,7 @@ function T(e) {
693
541
  },
694
542
  body: JSON.stringify({
695
543
  current_content: e,
696
- merge_tags: r.map((e) => ({
544
+ merge_tags: n.map((e) => ({
697
545
  label: e.label,
698
546
  value: e.value
699
547
  }))
@@ -725,30 +573,30 @@ function T(e) {
725
573
  }
726
574
  }
727
575
  }
728
- async function C(e, r, c) {
729
- let y = n();
576
+ async function w(e, n, c) {
577
+ let y = r();
730
578
  if (!y) throw Error("Template must be saved before using AI generation");
731
579
  s.value = !0, u.value = null, d.value = null, v.value = [];
732
- let x = w();
580
+ let x = S();
733
581
  o.value = [...o.value, {
734
582
  id: x,
735
583
  role: "user",
736
584
  content: e,
737
585
  timestamp: Date.now()
738
586
  }];
739
- let S = w();
587
+ let C = S();
740
588
  o.value = [...o.value, {
741
- id: S,
589
+ id: C,
742
590
  role: "assistant",
743
591
  content: "",
744
592
  timestamp: Date.now()
745
593
  }];
746
594
  try {
747
- let n = l(g["ai.generate"], {
595
+ let r = l(g["ai.generate"], {
748
596
  project: t.projectId,
749
597
  tenant: t.tenantSlug,
750
598
  template: y
751
- }), a = await t.authenticatedFetch(n, {
599
+ }), a = await t.authenticatedFetch(r, {
752
600
  method: "POST",
753
601
  headers: {
754
602
  "Content-Type": "application/json",
@@ -756,7 +604,7 @@ function T(e) {
756
604
  },
757
605
  body: JSON.stringify({
758
606
  prompt: e,
759
- current_content: r,
607
+ current_content: n,
760
608
  merge_tags: c.map((e) => ({
761
609
  label: e.label,
762
610
  value: e.value
@@ -766,7 +614,7 @@ function T(e) {
766
614
  });
767
615
  if (!a.ok) {
768
616
  let e = await a.json().catch(() => null);
769
- throw a.status === 403 ? Error("ai_generation_not_available") : Error(e?.message || "Failed to generate template");
617
+ throw Error(a.status === 403 ? "ai_generation_not_available" : e?.message || "Failed to generate template");
770
618
  }
771
619
  let s = a.body?.getReader();
772
620
  if (!s) throw Error("Failed to read stream");
@@ -776,19 +624,19 @@ function T(e) {
776
624
  let { done: e, value: t } = await s.read();
777
625
  if (e) break;
778
626
  v += d.decode(t, { stream: !0 });
779
- let n = v.split("\n");
780
- v = n.pop() ?? "";
781
- for (let e of n) {
627
+ let r = v.split("\n");
628
+ v = r.pop() ?? "";
629
+ for (let e of r) {
782
630
  if (!e.startsWith("data: ")) continue;
783
- let t = e.slice(6), n;
631
+ let t = e.slice(6), r;
784
632
  try {
785
- n = JSON.parse(t);
633
+ r = JSON.parse(t);
786
634
  } catch {
787
635
  continue;
788
636
  }
789
- if (n.type === "text") b(S, { content: (o.value.find((e) => e.id === S)?.content ?? "") + n.text });
790
- else if (n.type === "error") throw Error(n.message || "Failed to generate template");
791
- else n.type === "done" && (n.conversation_id && (f.value = n.conversation_id), b(S, { content: n.text }), x = n.content ?? null, x ? (m.value = r, h.value = x, p.value = S, _.value = !1, i?.(x)) : u.value = "ai_apply_failed");
637
+ if (r.type === "text") b(C, { content: (o.value.find((e) => e.id === C)?.content ?? "") + r.text });
638
+ else if (r.type === "error") throw Error(r.message || "Failed to generate template");
639
+ else r.type === "done" && (r.conversation_id && (f.value = r.conversation_id), b(C, { content: r.text }), x = r.content ?? null, x ? (m.value = n, h.value = x, p.value = C, _.value = !1, i?.(x)) : u.value = "ai_apply_failed");
792
640
  }
793
641
  }
794
642
  } finally {
@@ -797,7 +645,7 @@ function T(e) {
797
645
  return x;
798
646
  } catch (t) {
799
647
  let n = t instanceof Error ? t : Error("Failed to generate template", { cause: t });
800
- return u.value = n.message, d.value = e, a?.(n), o.value = o.value.filter((e) => e.id !== x && e.id !== S), null;
648
+ return u.value = n.message, d.value = e, a?.(n), o.value = o.value.filter((e) => e.id !== x && e.id !== C), null;
801
649
  } finally {
802
650
  s.value = !1;
803
651
  }
@@ -818,34 +666,38 @@ function T(e) {
818
666
  failedPrompt: d,
819
667
  suggestions: v,
820
668
  isLoadingSuggestions: y,
821
- sendPrompt: C,
669
+ sendPrompt: w,
822
670
  toggleLastRevert: T,
823
671
  loadConversation: x,
824
- loadSuggestions: S,
672
+ loadSuggestions: C,
825
673
  clearChat: E
826
674
  };
827
675
  }
828
- function E(e) {
676
+ //#endregion
677
+ //#region ../core/src/cloud/ai-config.ts
678
+ function w(e) {
829
679
  function t(t) {
830
680
  return e !== !1 && e?.[t] !== !1;
831
681
  }
832
682
  return {
833
683
  isFeatureEnabled: t,
834
- hasAnyMenuFeature: a(() => t("chat") || t("scoring") || t("designToTemplate"))
684
+ hasAnyMenuFeature: i(() => t("chat") || t("scoring") || t("designToTemplate"))
835
685
  };
836
686
  }
837
- function D(e) {
838
- let { authManager: t, getTemplateId: n } = e, i = r(!1), a = r(null), o = r(null), s = r(null), c = r(""), u = r(null);
839
- async function d(e, r) {
840
- let s = n();
687
+ //#endregion
688
+ //#region ../core/src/cloud/template-scoring.ts
689
+ function T(e) {
690
+ let { authManager: t, getTemplateId: r } = e, i = n(!1), a = n(null), o = n(null), s = n(null), c = n(""), u = n(null);
691
+ async function d(e, n) {
692
+ let s = r();
841
693
  if (!s) return null;
842
694
  i.value = !0, o.value = null, a.value = null;
843
695
  try {
844
- let n = l(g["ai.score"], {
696
+ let r = l(g["ai.score"], {
845
697
  project: t.projectId,
846
698
  tenant: t.tenantSlug,
847
699
  template: s
848
- }), i = await t.authenticatedFetch(n, {
700
+ }), i = await t.authenticatedFetch(r, {
849
701
  method: "POST",
850
702
  headers: {
851
703
  "Content-Type": "application/json",
@@ -853,7 +705,7 @@ function D(e) {
853
705
  },
854
706
  body: JSON.stringify({
855
707
  current_content: e,
856
- merge_tags: r.map((e) => ({
708
+ merge_tags: n.map((e) => ({
857
709
  label: e.label,
858
710
  value: e.value
859
711
  }))
@@ -893,16 +745,16 @@ function D(e) {
893
745
  i.value = !1;
894
746
  }
895
747
  }
896
- async function f(e, r, i) {
897
- let a = n();
748
+ async function f(e, n, i) {
749
+ let a = r();
898
750
  if (!a) return null;
899
- s.value = r.id, c.value = "", u.value = null;
751
+ s.value = n.id, c.value = "", u.value = null;
900
752
  try {
901
- let n = l(g["ai.fixFinding"], {
753
+ let r = l(g["ai.fixFinding"], {
902
754
  project: t.projectId,
903
755
  tenant: t.tenantSlug,
904
756
  template: a
905
- }), o = await t.authenticatedFetch(n, {
757
+ }), o = await t.authenticatedFetch(r, {
906
758
  method: "POST",
907
759
  headers: {
908
760
  "Content-Type": "application/json",
@@ -911,10 +763,10 @@ function D(e) {
911
763
  body: JSON.stringify({
912
764
  content: e,
913
765
  finding: {
914
- id: r.id,
915
- message: r.message,
916
- suggestion: r.suggestion,
917
- category: r.category
766
+ id: n.id,
767
+ message: n.message,
768
+ suggestion: n.suggestion,
769
+ category: n.category
918
770
  },
919
771
  merge_tags: i.map((e) => ({
920
772
  label: e.label,
@@ -977,27 +829,29 @@ function D(e) {
977
829
  reset: m
978
830
  };
979
831
  }
980
- function O(e) {
981
- let { authManager: t, getTemplateId: n, onApply: i, onError: a } = e, o = r(!1), s = r(null);
832
+ //#endregion
833
+ //#region ../core/src/cloud/design-reference.ts
834
+ function E(e) {
835
+ let { authManager: t, getTemplateId: r, onApply: i, onError: a } = e, o = n(!1), s = n(null);
982
836
  async function c(e) {
983
- let r = n();
984
- if (!r) throw Error("Template must be saved before using design reference");
837
+ let n = r();
838
+ if (!n) throw Error("Template must be saved before using design reference");
985
839
  o.value = !0, s.value = null;
986
840
  try {
987
- let n = new FormData();
988
- e.prompt && n.append("prompt", e.prompt), e.imageUpload && n.append("image_upload", e.imageUpload), e.pdfUpload && n.append("pdf_upload", e.pdfUpload);
841
+ let r = new FormData();
842
+ e.prompt && r.append("prompt", e.prompt), e.imageUpload && r.append("image_upload", e.imageUpload), e.pdfUpload && r.append("pdf_upload", e.pdfUpload);
989
843
  let a = l(g["ai.generateFromDesign"], {
990
844
  project: t.projectId,
991
845
  tenant: t.tenantSlug,
992
- template: r
846
+ template: n
993
847
  }), o = await t.authenticatedFetch(a, {
994
848
  method: "POST",
995
849
  headers: { Accept: "text/event-stream" },
996
- body: n
850
+ body: r
997
851
  });
998
852
  if (!o.ok) {
999
853
  let e = await o.json().catch(() => null);
1000
- throw o.status === 403 ? Error("ai_generation_not_available") : Error(e?.message || "Failed to generate template from design");
854
+ throw Error(o.status === 403 ? "ai_generation_not_available" : e?.message || "Failed to generate template from design");
1001
855
  }
1002
856
  let s = o.body?.getReader();
1003
857
  if (!s) throw Error("Failed to read stream");
@@ -1038,230 +892,104 @@ function O(e) {
1038
892
  reset: u
1039
893
  };
1040
894
  }
895
+ //#endregion
896
+ //#region ../core/src/cloud/comments-provider.ts
897
+ var D = "comment-broadcast";
898
+ function O(e) {
899
+ let t = {
900
+ id: e.id,
901
+ body: e.body,
902
+ author: {
903
+ id: e.author_identifier,
904
+ name: e.author_name
905
+ },
906
+ createdAt: e.created_at,
907
+ blockId: e.block_id,
908
+ parentId: e.parent_id,
909
+ resolvedAt: e.resolved_at
910
+ };
911
+ return e.updated_at !== e.created_at && (t.updatedAt = e.updated_at), e.resolved_by_identifier && (t.resolvedBy = {
912
+ id: e.resolved_by_identifier,
913
+ name: e.resolved_by_name ?? ""
914
+ }), e.replies?.length && (t.replies = e.replies.map(O)), t;
915
+ }
1041
916
  function k(e) {
1042
- let { authManager: t, getTemplateId: n, getSocketId: i, onComment: o, onError: s, hasCommentingFeature: c } = e, l = new _(t), u = r([]), d = r(!1), f = r(!1), p = a(() => (c?.() ?? !1) && t.userConfig !== null), m = a(() => {
1043
- let e = 0;
1044
- for (let t of u.value) e += 1 + (t.replies?.length ?? 0);
1045
- return e;
1046
- }), h = a(() => u.value.filter((e) => !e.resolved_at).length), g = a(() => {
1047
- let e = /* @__PURE__ */ new Map();
1048
- for (let t of u.value) t.block_id && e.set(t.block_id, (e.get(t.block_id) ?? 0) + 1 + (t.replies?.length ?? 0));
1049
- return e;
1050
- });
1051
- function v() {
1052
- let e = t.userConfig;
1053
- if (!e) throw Error("User config not available");
917
+ let { authManager: n, channel: r, getSocketId: i } = e, a = new _(n);
918
+ function o() {
919
+ let e = n.userConfig;
920
+ if (!e) throw Error("[Templatical] Cloud comments need a signed user in the auth token. The project's token endpoint must include a `user` claim.");
1054
921
  return {
1055
922
  user_id: e.id,
1056
923
  user_name: e.name,
1057
924
  user_signature: e.signature
1058
925
  };
1059
926
  }
1060
- function y() {
927
+ function s() {
1061
928
  let e = i?.();
1062
- if (e) return { "X-Socket-ID": e };
1063
- }
1064
- function b(e, t) {
1065
- o?.({
1066
- type: e,
1067
- comment: t
1068
- });
929
+ return e ? { "X-Socket-ID": e } : void 0;
1069
930
  }
1070
- function x(e) {
1071
- for (let t of u.value) {
1072
- if (t.id === e) return t;
1073
- for (let n of t.replies ?? []) if (n.id === e) return n;
1074
- }
1075
- return null;
1076
- }
1077
- async function S() {
1078
- let e = n();
1079
- if (e) {
1080
- d.value = !0;
1081
- try {
1082
- u.value = await l.getComments(e);
1083
- } catch (e) {
1084
- let t = e instanceof Error ? e : Error("Failed to load comments", { cause: e });
1085
- s?.(t);
1086
- } finally {
1087
- d.value = !1;
1088
- }
1089
- }
1090
- }
1091
- async function C(e, t, r) {
1092
- let i = n();
1093
- if (!i) return null;
1094
- f.value = !0;
1095
- try {
1096
- let n = await l.createComment(i, {
1097
- body: e,
1098
- block_id: t,
1099
- parent_id: r,
1100
- ...v()
1101
- }, y());
1102
- if (r) {
1103
- let e = x(r);
1104
- e && (e.replies = [...e.replies ?? [], n]);
1105
- } else u.value = [...u.value, n];
1106
- return b("created", n), n;
1107
- } catch (e) {
1108
- let t = e instanceof Error ? e : Error("Failed to create comment", { cause: e });
1109
- return s?.(t), null;
1110
- } finally {
1111
- f.value = !1;
1112
- }
1113
- }
1114
- async function w(e, t) {
1115
- let r = n();
1116
- if (!r) return null;
1117
- f.value = !0;
1118
- try {
1119
- let n = await l.updateComment(r, e, {
1120
- body: t,
1121
- ...v()
1122
- }, y());
1123
- return A(e, n), b("updated", n), n;
1124
- } catch (e) {
1125
- let t = e instanceof Error ? e : Error("Failed to update comment", { cause: e });
1126
- return s?.(t), null;
1127
- } finally {
1128
- f.value = !1;
1129
- }
1130
- }
1131
- async function T(e) {
1132
- let t = n();
1133
- if (!t) return !1;
1134
- let r = x(e);
1135
- if (!r) return !1;
1136
- let i = {
1137
- ...r,
1138
- replies: [...r.replies ?? []]
1139
- };
1140
- f.value = !0;
1141
- try {
1142
- if (await l.deleteComment(t, e, v(), y()), r.parent_id) {
1143
- let t = x(r.parent_id);
1144
- t && (t.replies = (t.replies ?? []).filter((t) => t.id !== e));
1145
- } else u.value = u.value.filter((t) => t.id !== e);
1146
- return b("deleted", i), !0;
1147
- } catch (e) {
1148
- let t = e instanceof Error ? e : Error("Failed to delete comment", { cause: e });
1149
- return s?.(t), !1;
1150
- } finally {
1151
- f.value = !1;
1152
- }
1153
- }
1154
- async function E(e) {
1155
- let t = n();
1156
- if (!t) return null;
1157
- f.value = !0;
1158
- try {
1159
- let n = await l.resolveComment(t, e, v(), y());
1160
- return A(e, n), b(n.resolved_at ? "resolved" : "unresolved", n), n;
1161
- } catch (e) {
1162
- let t = e instanceof Error ? e : Error("Failed to toggle comment resolution", { cause: e });
1163
- return s?.(t), null;
1164
- } finally {
1165
- f.value = !1;
1166
- }
1167
- }
1168
- function D(e) {
1169
- if (e.parent_id) {
1170
- let t = x(e.parent_id);
1171
- t && (t.replies = [...t.replies ?? [], e]);
1172
- } else u.value = [...u.value, e];
1173
- b("created", e);
1174
- }
1175
- function O(e) {
1176
- A(e.id, e), b("updated", e);
1177
- }
1178
- function k(e, t) {
1179
- let n = x(e), r = n ? {
1180
- ...n,
1181
- replies: [...n.replies ?? []]
1182
- } : null;
1183
- if (t) {
1184
- let n = x(t);
1185
- n && (n.replies = (n.replies ?? []).filter((t) => t.id !== e));
1186
- } else u.value = u.value.filter((t) => t.id !== e);
1187
- r && b("deleted", r);
1188
- }
1189
- function A(e, t) {
1190
- for (let n = 0; n < u.value.length; n++) {
1191
- if (u.value[n].id === e) {
1192
- u.value = [
1193
- ...u.value.slice(0, n),
1194
- {
1195
- ...t,
1196
- replies: u.value[n].replies
1197
- },
1198
- ...u.value.slice(n + 1)
1199
- ];
1200
- return;
1201
- }
1202
- let r = u.value[n].replies ?? [];
1203
- for (let i = 0; i < r.length; i++) if (r[i].id === e) {
1204
- let e = [
1205
- ...r.slice(0, i),
1206
- t,
1207
- ...r.slice(i + 1)
1208
- ];
1209
- u.value = [
1210
- ...u.value.slice(0, n),
1211
- {
1212
- ...u.value[n],
1213
- replies: e
1214
- },
1215
- ...u.value.slice(n + 1)
1216
- ];
1217
- return;
931
+ return {
932
+ async list(e) {
933
+ return (await a.getComments(e)).map(O);
934
+ },
935
+ async create(e, t) {
936
+ return O(await a.createComment(e, {
937
+ body: t.body,
938
+ block_id: t.blockId,
939
+ parent_id: t.parentId,
940
+ ...o()
941
+ }, s()));
942
+ },
943
+ async update(e, t, n) {
944
+ if (n.body === void 0) throw Error("[Templatical] Cloud comments: update() needs a `body` in the patch.");
945
+ return O(await a.updateComment(e, t, {
946
+ body: n.body,
947
+ ...o()
948
+ }, s()));
949
+ },
950
+ async delete(e, t) {
951
+ await a.deleteComment(e, t, o(), s());
952
+ },
953
+ async setResolved(e, t, n) {
954
+ return O(await a.resolveComment(e, t, o(), s()));
955
+ },
956
+ subscribe(e, n) {
957
+ function i(e) {
958
+ let t = O(e.comment);
959
+ switch (e.action) {
960
+ case "comment_created":
961
+ n({
962
+ type: "created",
963
+ comment: t
964
+ });
965
+ break;
966
+ case "comment_deleted":
967
+ n({
968
+ type: "deleted",
969
+ commentId: t.id,
970
+ parentId: t.parentId
971
+ });
972
+ break;
973
+ case "comment_updated":
974
+ case "comment_resolved":
975
+ case "comment_unresolved": n({
976
+ type: "updated",
977
+ comment: t
978
+ });
979
+ }
1218
980
  }
981
+ let a = t(r, (e, t) => {
982
+ t?.unbind(D, i), e?.bind(D, i);
983
+ }, { immediate: !0 });
984
+ return () => {
985
+ a(), r.value?.unbind(D, i);
986
+ };
1219
987
  }
1220
- }
1221
- return {
1222
- comments: u,
1223
- isLoading: d,
1224
- isSubmitting: f,
1225
- isEnabled: p,
1226
- commentCountByBlock: g,
1227
- totalCount: m,
1228
- unresolvedCount: h,
1229
- loadComments: S,
1230
- addComment: C,
1231
- editComment: w,
1232
- removeComment: T,
1233
- toggleResolve: E,
1234
- applyRemoteCreate: D,
1235
- applyRemoteUpdate: O,
1236
- applyRemoteDelete: k
1237
988
  };
1238
989
  }
1239
- function A(t) {
1240
- let { comments: r, channel: i } = t;
1241
- e(i, (e, t) => {
1242
- t && t.unbind("comment-broadcast"), e && e.bind("comment-broadcast", (e) => {
1243
- j(r, e);
1244
- });
1245
- }), n(() => {
1246
- i.value?.unbind("comment-broadcast");
1247
- });
1248
- }
1249
- function j(e, t) {
1250
- switch (t.action) {
1251
- case "comment_created":
1252
- e.applyRemoteCreate(t.comment);
1253
- break;
1254
- case "comment_updated":
1255
- e.applyRemoteUpdate(t.comment);
1256
- break;
1257
- case "comment_deleted":
1258
- e.applyRemoteDelete(t.comment.id, t.comment.parent_id);
1259
- break;
1260
- case "comment_resolved":
1261
- case "comment_unresolved": e.applyRemoteUpdate(t.comment);
1262
- }
1263
- }
1264
- var M = [
990
+ //#endregion
991
+ //#region ../core/src/cloud/collaboration.ts
992
+ var A = [
1265
993
  "pusher:member_added",
1266
994
  "pusher:member_removed",
1267
995
  "client-block_locked",
@@ -1269,10 +997,10 @@ var M = [
1269
997
  "client-operation",
1270
998
  "mcp-operation"
1271
999
  ];
1272
- function N(e) {
1273
- for (let t of M) e.unbind(t);
1000
+ function j(e) {
1001
+ for (let t of A) e.unbind(t);
1274
1002
  }
1275
- var P = [
1003
+ var M = [
1276
1004
  "#3b82f6",
1277
1005
  "#ef4444",
1278
1006
  "#10b981",
@@ -1284,10 +1012,10 @@ var P = [
1284
1012
  "#6366f1",
1285
1013
  "#14b8a6"
1286
1014
  ];
1287
- function F(t) {
1288
- let { authManager: i, editor: o, channel: s } = t, c = r([]), l = r(/* @__PURE__ */ new Map()), u = 0, d = !1, f = a(() => i.userConfig?.id ?? "");
1015
+ function N(e) {
1016
+ let { authManager: a, editor: o, channel: s } = e, c = n([]), l = n(/* @__PURE__ */ new Map()), u = 0, d = !1, f = i(() => a.userConfig?.id ?? "");
1289
1017
  function p() {
1290
- let e = P[u % P.length];
1018
+ let e = M[u % M.length];
1291
1019
  return u++, e;
1292
1020
  }
1293
1021
  function m(e) {
@@ -1346,42 +1074,42 @@ function F(t) {
1346
1074
  function S(e) {
1347
1075
  s.value && s.value.trigger("client-block_unlocked", { blockId: e });
1348
1076
  }
1349
- return e(() => o.state.selectedBlockId, (e, t) => {
1077
+ return t(() => o.state.selectedBlockId, (e, t) => {
1350
1078
  d || (t && S(t), e && x(e));
1351
- }), e(s, (e, n) => {
1352
- if (n && N(n), !e) {
1079
+ }), t(s, (t, n) => {
1080
+ if (n && j(n), !t) {
1353
1081
  c.value = [], l.value = /* @__PURE__ */ new Map(), u = 0;
1354
1082
  return;
1355
1083
  }
1356
- let r = e.members;
1084
+ let r = t.members;
1357
1085
  r && r.each((e) => {
1358
1086
  m(e.info);
1359
- }), e.bind("pusher:member_added", (e) => {
1360
- let n = m(e.info);
1361
- n && t.onCollaboratorJoined?.(n);
1362
- }), e.bind("pusher:member_removed", (e) => {
1363
- let n = c.value.find((t) => t.id === e.id);
1364
- h(e.id), n && t.onCollaboratorLeft?.(n);
1365
- }), e.bind("client-block_locked", (e) => {
1366
- g(e);
1367
- let n = c.value.find((t) => t.id === e.userId);
1368
- n && t.onBlockLocked?.({
1369
- blockId: e.blockId,
1087
+ }), t.bind("pusher:member_added", (t) => {
1088
+ let n = m(t.info);
1089
+ n && e.onCollaboratorJoined?.(n);
1090
+ }), t.bind("pusher:member_removed", (t) => {
1091
+ let n = c.value.find((e) => e.id === t.id);
1092
+ h(t.id), n && e.onCollaboratorLeft?.(n);
1093
+ }), t.bind("client-block_locked", (t) => {
1094
+ g(t);
1095
+ let n = c.value.find((e) => e.id === t.userId);
1096
+ n && e.onBlockLocked?.({
1097
+ blockId: t.blockId,
1370
1098
  collaborator: n
1371
1099
  });
1372
- }), e.bind("client-block_unlocked", (e) => {
1373
- let n = l.value.get(e.blockId);
1374
- _(e), n && t.onBlockUnlocked?.({
1375
- blockId: e.blockId,
1100
+ }), t.bind("client-block_unlocked", (t) => {
1101
+ let n = l.value.get(t.blockId);
1102
+ _(t), n && e.onBlockUnlocked?.({
1103
+ blockId: t.blockId,
1376
1104
  collaborator: n
1377
1105
  });
1378
- }), e.bind("client-operation", (e) => {
1106
+ }), t.bind("client-operation", (e) => {
1379
1107
  v(e);
1380
- }), e.bind("mcp-operation", (e) => {
1108
+ }), t.bind("mcp-operation", (e) => {
1381
1109
  v(e);
1382
1110
  });
1383
- }), n(() => {
1384
- s.value && N(s.value);
1111
+ }), r(() => {
1112
+ s.value && j(s.value);
1385
1113
  }), {
1386
1114
  collaborators: c,
1387
1115
  lockedBlocks: l,
@@ -1389,7 +1117,9 @@ function F(t) {
1389
1117
  _isProcessingRemoteOperation: () => d
1390
1118
  };
1391
1119
  }
1392
- function I(e, t) {
1120
+ //#endregion
1121
+ //#region ../core/src/cloud/collaboration-broadcast.ts
1122
+ function P(e, t) {
1393
1123
  let n = e.addBlock, r = e.updateBlock, i = e.removeBlock, a = e.moveBlock, o = e.updateSettings, s = e.setContent;
1394
1124
  e.addBlock = (e, r, i, a) => {
1395
1125
  n(e, r, i, a), t._broadcastOperation({
@@ -1442,20 +1172,22 @@ function I(e, t) {
1442
1172
  });
1443
1173
  };
1444
1174
  }
1445
- function L(e) {
1446
- let { authManager: t, onError: n } = e, i = r(null), a = r(!1), o = null, s = null;
1447
- async function c(e, r) {
1175
+ //#endregion
1176
+ //#region ../core/src/cloud/web-socket.ts
1177
+ function F(e) {
1178
+ let { authManager: t, onError: r } = e, i = n(null), a = n(!1), o = null, s = null;
1179
+ async function c(e, n) {
1448
1180
  if (o) return;
1449
1181
  o = new y({
1450
1182
  authManager: t,
1451
- config: r,
1452
- onError: n
1183
+ config: n,
1184
+ onError: r
1453
1185
  }), await o.connect(), s = `presence-template.${e}`;
1454
1186
  let c = o.subscribePresence(s);
1455
1187
  c.bind("pusher:subscription_succeeded", () => {
1456
1188
  a.value = !0, i.value = c;
1457
1189
  }), c.bind("pusher:subscription_error", (e) => {
1458
- a.value = !1, i.value = null, n?.(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to subscribe to template channel"));
1190
+ a.value = !1, i.value = null, r?.(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to subscribe to template channel"));
1459
1191
  });
1460
1192
  }
1461
1193
  function l() {
@@ -1472,7 +1204,9 @@ function L(e) {
1472
1204
  getSocketId: u
1473
1205
  };
1474
1206
  }
1475
- function R(e) {
1207
+ //#endregion
1208
+ //#region ../core/src/cloud/saved-blocks-provider.ts
1209
+ function I(e) {
1476
1210
  let t = new _(e);
1477
1211
  return {
1478
1212
  list(e) {
@@ -1489,43 +1223,115 @@ function R(e) {
1489
1223
  }
1490
1224
  };
1491
1225
  }
1492
- function z(e) {
1493
- let t = new _(e.authManager), n = r([]), i = r(!1), a = r(!1);
1494
- async function o() {
1495
- i.value = !0;
1496
- try {
1497
- n.value = await t.getSnapshots(e.templateId);
1498
- } catch (t) {
1499
- throw e.onError?.(t), t;
1500
- } finally {
1501
- i.value = !1;
1502
- }
1226
+ //#endregion
1227
+ //#region ../core/src/cloud/templates-provider.ts
1228
+ var L = 6e4;
1229
+ function R(e) {
1230
+ let t = new _(e), n = 0;
1231
+ function r(e, r) {
1232
+ let i = Date.now();
1233
+ i - n < L || (n = i, t.createVersion(e, r).catch((e) => {
1234
+ console.warn("[Templatical] Automatic version not recorded — the save itself succeeded:", e);
1235
+ }));
1503
1236
  }
1504
- async function s(n) {
1505
- a.value = !0;
1506
- try {
1507
- let r = await t.restoreSnapshot(e.templateId, n);
1508
- return e.onRestore?.(r), r;
1509
- } catch (t) {
1510
- throw e.onError?.(t), t;
1511
- } finally {
1512
- a.value = !1;
1237
+ return {
1238
+ load(e) {
1239
+ return t.getTemplate(e);
1240
+ },
1241
+ create(e) {
1242
+ return t.createTemplate(e.content, e.name);
1243
+ },
1244
+ async save(e, n) {
1245
+ let i = await t.updateTemplate(e, n);
1246
+ return n.content && r(e, n.content), i;
1513
1247
  }
1248
+ };
1249
+ }
1250
+ //#endregion
1251
+ //#region ../core/src/cloud/export.ts
1252
+ function z(e) {
1253
+ return {
1254
+ customFonts: e?.customFonts ?? [],
1255
+ defaultFallback: e?.defaultFallback ?? "Arial, sans-serif"
1256
+ };
1257
+ }
1258
+ function B(e) {
1259
+ let t = new _(e.authManager);
1260
+ async function n(e, n) {
1261
+ let r = await t.exportTemplate(e, n);
1262
+ return {
1263
+ html: r.html,
1264
+ mjml: r.mjml
1265
+ };
1266
+ }
1267
+ async function r(e, n) {
1268
+ return (await t.exportTemplate(e, n)).mjml;
1514
1269
  }
1515
1270
  return {
1516
- snapshots: n,
1517
- isLoading: i,
1518
- isRestoring: a,
1519
- loadSnapshots: o,
1520
- restoreSnapshot: s
1271
+ exportHtml: n,
1272
+ getMjmlSource: r
1521
1273
  };
1522
1274
  }
1523
- function B(t) {
1524
- let { authManager: n, isAuthReady: i } = t, o = r(null);
1525
- i && e(i, (e) => {
1526
- e && (o.value = n.testEmailConfig);
1275
+ //#endregion
1276
+ //#region ../core/src/cloud/render-provider.ts
1277
+ function V(e) {
1278
+ let t = B({ authManager: e.authManager });
1279
+ function n(e) {
1280
+ return {
1281
+ customFonts: e.fonts?.customFonts ?? [],
1282
+ defaultFallback: e.fonts?.defaultFallback ?? "Arial, sans-serif"
1283
+ };
1284
+ }
1285
+ async function r() {
1286
+ if (e.getTemplateId() === null) throw Error("[Templatical] Cloud renders from the saved template, so one must exist first. Call create() or load() before toMjml() / toHtml().");
1287
+ return (await e.save()).id;
1288
+ }
1289
+ return {
1290
+ async toMjml(e) {
1291
+ let i = n(e), a = await r();
1292
+ return t.getMjmlSource(a, i);
1293
+ },
1294
+ async toHtml(e) {
1295
+ let i = n(e), a = await r(), { html: o } = await t.exportHtml(a, i);
1296
+ return o;
1297
+ }
1298
+ };
1299
+ }
1300
+ //#endregion
1301
+ //#region ../core/src/cloud/version-history-provider.ts
1302
+ function H(e) {
1303
+ return {
1304
+ id: e.id,
1305
+ createdAt: e.created_at,
1306
+ isAutomatic: e.is_autosave,
1307
+ content: e.content
1308
+ };
1309
+ }
1310
+ function U(e) {
1311
+ let t = new _(e);
1312
+ return {
1313
+ async list(e) {
1314
+ return { versions: (await t.getVersions(e)).map(H) };
1315
+ },
1316
+ async get(e, n) {
1317
+ return (await t.getVersion(e, n)).content;
1318
+ },
1319
+ async create(e, n, r) {
1320
+ return H(await t.createVersion(e, n, r?.label));
1321
+ },
1322
+ restore(e, n) {
1323
+ return t.restoreVersion(e, n);
1324
+ }
1325
+ };
1326
+ }
1327
+ //#endregion
1328
+ //#region ../core/src/cloud/test-email.ts
1329
+ function W(e) {
1330
+ let { authManager: r, isAuthReady: a } = e, o = n(null);
1331
+ a && t(a, (e) => {
1332
+ e && (o.value = r.testEmailConfig);
1527
1333
  }, { immediate: !0 });
1528
- let s = a(() => o.value !== null), c = a(() => o.value?.allowedEmails ?? []);
1334
+ let s = i(() => o.value !== null), c = i(() => o.value?.allowedEmails ?? []);
1529
1335
  function l() {
1530
1336
  return o.value?.signature ?? null;
1531
1337
  }
@@ -1535,7 +1341,9 @@ function B(t) {
1535
1341
  getSignature: l
1536
1342
  };
1537
1343
  }
1538
- function V(e) {
1344
+ //#endregion
1345
+ //#region ../core/src/cloud/test-email-provider.ts
1346
+ function G(e) {
1539
1347
  let t = new _(e.authManager);
1540
1348
  return {
1541
1349
  get allowedRecipients() {
@@ -1557,61 +1365,40 @@ function V(e) {
1557
1365
  }
1558
1366
  };
1559
1367
  }
1560
- function H(e) {
1561
- let { authManager: t, getFontsConfig: n, canUseCustomFonts: r } = e, i = new _(t);
1562
- function a() {
1563
- let e = n?.();
1564
- return {
1565
- customFonts: (r?.() ?? !0) && e?.customFonts ? e.customFonts : [],
1566
- defaultFallback: e?.defaultFallback ?? "Arial, sans-serif"
1567
- };
1568
- }
1569
- async function o(e) {
1570
- let t = a(), n = await i.exportTemplate(e, t);
1571
- return {
1572
- html: n.html,
1573
- mjml: n.mjml
1574
- };
1575
- }
1576
- async function s(e) {
1577
- let t = a();
1578
- return (await i.exportTemplate(e, t)).mjml;
1579
- }
1580
- return {
1581
- exportHtml: o,
1582
- getMjmlSource: s
1583
- };
1584
- }
1585
- function U(e) {
1586
- let { authManager: t, onError: n } = e, i = r(null), o = r(!1), s = new _(t), c = a(() => i.value?.features ?? null);
1368
+ //#endregion
1369
+ //#region ../core/src/cloud/plan-config.ts
1370
+ function K(e) {
1371
+ let { authManager: t, onError: r } = e, a = n(null), o = n(!1), s = new _(t), c = i(() => a.value?.features ?? null);
1587
1372
  function l(e) {
1588
- return i.value?.features[e] ?? !1;
1373
+ return a.value?.features[e] ?? !1;
1589
1374
  }
1590
1375
  async function u() {
1591
1376
  if (!o.value) {
1592
1377
  o.value = !0;
1593
1378
  try {
1594
- i.value = await s.fetchConfig();
1379
+ a.value = await s.fetchConfig();
1595
1380
  } catch (e) {
1596
- n?.(e instanceof Error ? e : Error("Failed to fetch config", { cause: e }));
1381
+ r?.(e instanceof Error ? e : Error("Failed to fetch config", { cause: e }));
1597
1382
  } finally {
1598
1383
  o.value = !1;
1599
1384
  }
1600
1385
  }
1601
1386
  }
1602
1387
  return {
1603
- config: i,
1388
+ config: a,
1604
1389
  isLoading: o,
1605
1390
  hasFeature: l,
1606
1391
  features: c,
1607
1392
  fetchConfig: u
1608
1393
  };
1609
1394
  }
1610
- var W = 5e3;
1611
- function G(e) {
1395
+ //#endregion
1396
+ //#region ../core/src/cloud/health-check.ts
1397
+ var q = 5e3;
1398
+ function J(e) {
1612
1399
  return e.authManager ? e.authManager.resolveUrl(g.health) : `${(e.baseUrl ?? "https://templatical.com").replace(/\/$/, "")}${g.health}`;
1613
1400
  }
1614
- async function K(e, t) {
1401
+ async function Y(e, t) {
1615
1402
  let n = performance.now();
1616
1403
  try {
1617
1404
  let r = t ? await t.authenticatedFetch(g.health, {
@@ -1663,7 +1450,7 @@ async function K(e, t) {
1663
1450
  };
1664
1451
  }
1665
1452
  }
1666
- async function q(e) {
1453
+ async function X(e) {
1667
1454
  if (!e?.host || !e?.app_key) return {
1668
1455
  ok: !1,
1669
1456
  error: "WebSocket configuration not available"
@@ -1679,7 +1466,7 @@ async function q(e) {
1679
1466
  ok: !1,
1680
1467
  error: "WebSocket connection timed out"
1681
1468
  });
1682
- }, W);
1469
+ }, q);
1683
1470
  try {
1684
1471
  n = new WebSocket(t);
1685
1472
  } catch (t) {
@@ -1699,8 +1486,8 @@ async function q(e) {
1699
1486
  };
1700
1487
  });
1701
1488
  }
1702
- async function J(e = {}) {
1703
- let t = await K(G(e), e.authManager), n = await q(t.wsConfig);
1489
+ async function Z(e = {}) {
1490
+ let t = await Y(J(e), e.authManager), n = await X(t.wsConfig);
1704
1491
  return {
1705
1492
  api: t.api,
1706
1493
  websocket: n,
@@ -1708,13 +1495,17 @@ async function J(e = {}) {
1708
1495
  overall: t.api.ok && t.auth.ok
1709
1496
  };
1710
1497
  }
1711
- function Y(t) {
1712
- let { editor: n, channel: r, onOperation: i } = t;
1713
- e(r, (e, t) => {
1498
+ //#endregion
1499
+ //#region ../core/src/cloud/mcp-listener.ts
1500
+ function Q(e) {
1501
+ let { editor: n, channel: r, onOperation: i } = e;
1502
+ t(r, (e, t) => {
1714
1503
  t && t.unbind("mcp-operation"), e && e.bind("mcp-operation", (e) => {
1715
1504
  b(n, e), i?.(e);
1716
1505
  });
1717
1506
  });
1718
1507
  }
1719
1508
  //#endregion
1720
- export { z as _, v as a, L as b, F as c, k as d, O as f, U as g, Y as h, J as i, I as l, H as m, R as n, T as o, S as p, V as r, E as s, c as t, A as u, D as v, B as y };
1509
+ export { l as C, o as E, g as S, c as T, T as _, W as a, v as b, z as c, I as d, F as f, E as g, k as h, G as i, B as l, N as m, Z as n, U as o, P as p, K as r, V as s, Q as t, R as u, w as v, s as w, _ as x, C as y };
1510
+
1511
+ //# sourceMappingURL=cloud-BA0OpRh-.js.map