@templatical/editor 0.61.0 → 0.62.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 (230) hide show
  1. package/LICENSE +21 -109
  2. package/README.md +3 -3
  3. package/dist/{AiAltTextPopover-DSA1wiiW.js → AiAltTextPopover-C1Ike67q.js} +3 -4
  4. package/dist/{AiAltTextReview-B9-vfzCj.js → AiAltTextReview-BjT7_PoG.js} +2 -3
  5. package/dist/{AiChatPanel-DF5TvO9H.js → AiChatPanel-C82fJozf.js} +3 -4
  6. package/dist/{AiPanels-zRqC5DIP.js → AiPanels-sam_GMNs.js} +1 -1
  7. package/dist/{AiRewriteMenu-CmZKTO-O.js → AiRewriteMenu-CpBcT6QL.js} +3 -4
  8. package/dist/{BlockIssueBadge-Bug5iqcK.js → BlockIssueBadge-D3OmWkCh.js} +2 -3
  9. package/dist/{BlockPreviewCanvas-knSyWaCP.js → BlockPreviewCanvas-BHRmnq0w.js} +6 -6
  10. package/dist/{CollaborationNotices-BM35YG72.js → CollaborationNotices-Cmc7Ziuf.js} +1 -1
  11. package/dist/{CollaboratorBar-DMsEOndt.js → CollaboratorBar-DVtWefk1.js} +1 -1
  12. package/dist/{CommentsPanel-BMYvXRKK.js → CommentsPanel-BSt22Zw9.js} +1 -1
  13. package/dist/{cdn/chunks/CommentsSidebar-BEiOQ_zT.js → CommentsSidebar-C8qbxjyN.js} +228 -205
  14. package/dist/{CountdownBlock-AYPypmcX.js → CountdownBlock-bFAELCB6.js} +3 -4
  15. package/dist/{CountdownToolbar-BprSuPJk.js → CountdownToolbar-CJbPEVV5.js} +4 -4
  16. package/dist/{IssuesPanel-CeCvUfa7.js → IssuesPanel-CKYf6K84.js} +4 -5
  17. package/dist/{LanguageMenu-CkGqLYjf.js → LanguageMenu-BFOEQEPy.js} +5 -6
  18. package/dist/{LocaleNotices-D0be8ovO.js → LocaleNotices-24UYFxo2.js} +7 -8
  19. package/dist/{LogicTagInsertButton-BzEZUTRZ.js → LogicTagInsertButton-DdaafrjI.js} +95 -96
  20. package/dist/{MergeTagInput-By2FSStk.js → MergeTagInput-BXM6-eF-.js} +1 -1
  21. package/dist/{MergeTagModeToggle-DtjOZhoD.js → MergeTagModeToggle-ooA_Ytfq.js} +2 -3
  22. package/dist/{MergeTagTextarea-BjHlamJv.js → MergeTagTextarea-B86MPY89.js} +3 -4
  23. package/dist/{ParagraphEditor-Ctu4fSsl.js → ParagraphEditor-C15Glzy_.js} +78 -79
  24. package/dist/{RestoreVersionDialog-DvZoTJVa.js → RestoreVersionDialog-C13Bo4b0.js} +2 -2
  25. package/dist/{RichTextEditorContent-B1p7Ykq8.js → RichTextEditorContent-BNMBOkdy.js} +5 -6
  26. package/dist/{SaveBlockDialog-DHfT-Tpx.js → SaveBlockDialog-lm_1-2w2.js} +23 -24
  27. package/dist/{SavedBlocksBrowserModal-BjJuuXQv.js → SavedBlocksBrowserModal-BjUZG5_S.js} +8 -9
  28. package/dist/{SavedBlocksPanels-D6eiMQZ3.js → SavedBlocksPanels-Bj3LAXcL.js} +1 -1
  29. package/dist/{SavedBlocksPickBar-BkgCDSXe.js → SavedBlocksPickBar-DOTr0Imx.js} +2 -2
  30. package/dist/{TemplateSettings-DQAbNsiS.js → TemplateSettings-Z-i-_xF5.js} +19 -20
  31. package/dist/{TestEmailModal-m_AEa36T.js → TestEmailModal-ClEnoNEB.js} +17 -18
  32. package/dist/{TestEmailPanel-OApkuaVd.js → TestEmailPanel-CVmrt-d9.js} +1 -1
  33. package/dist/{TitleEditor-Cwdtfk15.js → TitleEditor-BHZF5C6q.js} +8 -9
  34. package/dist/{Toolbar-D_T55elL.js → Toolbar-bwAdFK4A.js} +308 -310
  35. package/dist/{TplModal-2MKm5y6r.js → TplModal-QWmSO1nR.js} +4 -4
  36. package/dist/{VersionHistoryMenu-B3-xJ7GO.js → VersionHistoryMenu-qoOkZKal.js} +6 -7
  37. package/dist/{VersionHistoryPanels-CCM0IQBg.js → VersionHistoryPanels-D82hgc2v.js} +1 -1
  38. package/dist/{VersionPreviewBanner-DLAB4ZbS.js → VersionPreviewBanner-DEN9rl6y.js} +1 -1
  39. package/dist/{WrapperBlock-BZl10HLy.js → WrapperBlock-32v93A9w.js} +4 -4
  40. package/dist/{blockTypeIcons-C691ZY1l.js → blockTypeIcons-C1S2wVx8.js} +4 -4
  41. package/dist/bundle-stats.json +8 -8
  42. package/dist/{ca-C8N05sCU.js → ca-BIseSbs-.js} +1 -2
  43. package/dist/cdn/chunks/{AiAltTextPopover-BLNN_Pnd.js → AiAltTextPopover-mDx_knAl.js} +4 -5
  44. package/dist/cdn/chunks/{AiAltTextPopover-BLNN_Pnd.js.map → AiAltTextPopover-mDx_knAl.js.map} +1 -1
  45. package/dist/cdn/chunks/{AiAltTextReview-Db8vSNpe.js → AiAltTextReview-Dmg8iVWD.js} +3 -4
  46. package/dist/cdn/chunks/{AiAltTextReview-Db8vSNpe.js.map → AiAltTextReview-Dmg8iVWD.js.map} +1 -1
  47. package/dist/cdn/chunks/{AiChatPanel-BYAsgmoC.js → AiChatPanel-CEDr_x8G.js} +4 -5
  48. package/dist/cdn/chunks/{AiChatPanel-BYAsgmoC.js.map → AiChatPanel-CEDr_x8G.js.map} +1 -1
  49. package/dist/cdn/chunks/{AiPanels-MY_YPls8.js → AiPanels-qJgLTYPs.js} +2 -2
  50. package/dist/cdn/chunks/{AiPanels-MY_YPls8.js.map → AiPanels-qJgLTYPs.js.map} +1 -1
  51. package/dist/cdn/chunks/{AiRewriteMenu-BSePiXe_.js → AiRewriteMenu-2a9WjizC.js} +4 -5
  52. package/dist/cdn/chunks/{AiRewriteMenu-BSePiXe_.js.map → AiRewriteMenu-2a9WjizC.js.map} +1 -1
  53. package/dist/cdn/chunks/{BlockIssueBadge-fYeNnepj.js → BlockIssueBadge-D87CYoPw.js} +3 -4
  54. package/dist/cdn/chunks/{BlockIssueBadge-fYeNnepj.js.map → BlockIssueBadge-D87CYoPw.js.map} +1 -1
  55. package/dist/cdn/chunks/{BlockPreviewCanvas-B153A3hu.js → BlockPreviewCanvas-DDDKuWJz.js} +8 -8
  56. package/dist/cdn/chunks/{BlockPreviewCanvas-B153A3hu.js.map → BlockPreviewCanvas-DDDKuWJz.js.map} +1 -1
  57. package/dist/cdn/chunks/{CollaborationNotices-COkmBmps.js → CollaborationNotices-DyzhN_Ns.js} +2 -2
  58. package/dist/cdn/chunks/{CollaborationNotices-COkmBmps.js.map → CollaborationNotices-DyzhN_Ns.js.map} +1 -1
  59. package/dist/cdn/chunks/{CollaboratorBar-BSzI8YIU.js → CollaboratorBar-bNFuQxxP.js} +2 -2
  60. package/dist/cdn/chunks/{CollaboratorBar-BSzI8YIU.js.map → CollaboratorBar-bNFuQxxP.js.map} +1 -1
  61. package/dist/cdn/chunks/{CommentsPanel-R27fqh9O.js → CommentsPanel-D-D2qsS6.js} +2 -2
  62. package/dist/cdn/chunks/{CommentsPanel-R27fqh9O.js.map → CommentsPanel-D-D2qsS6.js.map} +1 -1
  63. package/dist/cdn/chunks/CommentsSidebar-CCVp8M2T.js +479 -0
  64. package/dist/cdn/chunks/CommentsSidebar-CCVp8M2T.js.map +1 -0
  65. package/dist/cdn/chunks/{CountdownBlock--hlKE2aj.js → CountdownBlock-5hUzymeP.js} +4 -5
  66. package/dist/cdn/chunks/{CountdownBlock--hlKE2aj.js.map → CountdownBlock-5hUzymeP.js.map} +1 -1
  67. package/dist/cdn/chunks/{CountdownToolbar-DOhXnbsq.js → CountdownToolbar-DaGxwKfG.js} +5 -5
  68. package/dist/cdn/chunks/{CountdownToolbar-DOhXnbsq.js.map → CountdownToolbar-DaGxwKfG.js.map} +1 -1
  69. package/dist/cdn/chunks/{IssuesPanel-DgxiS3hF.js → IssuesPanel-DQQo1B1z.js} +10 -11
  70. package/dist/cdn/chunks/IssuesPanel-DQQo1B1z.js.map +1 -0
  71. package/dist/cdn/chunks/{LanguageMenu-B6kt8SgX.js → LanguageMenu-2Er64H2b.js} +6 -7
  72. package/dist/cdn/chunks/{LanguageMenu-B6kt8SgX.js.map → LanguageMenu-2Er64H2b.js.map} +1 -1
  73. package/dist/cdn/chunks/{LocaleNotices-Bleg4gTu.js → LocaleNotices-DSfOyyyf.js} +8 -9
  74. package/dist/cdn/chunks/{LocaleNotices-Bleg4gTu.js.map → LocaleNotices-DSfOyyyf.js.map} +1 -1
  75. package/dist/cdn/chunks/{LogicTagInsertButton-DGg1Wvhp.js → LogicTagInsertButton-CumMM1rP.js} +7 -8
  76. package/dist/cdn/chunks/{LogicTagInsertButton-DGg1Wvhp.js.map → LogicTagInsertButton-CumMM1rP.js.map} +1 -1
  77. package/dist/cdn/chunks/{MergeTagInput-BVfTwujW.js → MergeTagInput-Dm_QiG96.js} +2 -2
  78. package/dist/cdn/chunks/{MergeTagInput-BVfTwujW.js.map → MergeTagInput-Dm_QiG96.js.map} +1 -1
  79. package/dist/cdn/chunks/{MergeTagModeToggle-BoI0C1Y6.js → MergeTagModeToggle-Bir7lkLe.js} +3 -4
  80. package/dist/cdn/chunks/{MergeTagModeToggle-BoI0C1Y6.js.map → MergeTagModeToggle-Bir7lkLe.js.map} +1 -1
  81. package/dist/cdn/chunks/{MergeTagTextarea-DGDv-pdn.js → MergeTagTextarea-B_IFeWfZ.js} +4 -5
  82. package/dist/cdn/chunks/{MergeTagTextarea-DGDv-pdn.js.map → MergeTagTextarea-B_IFeWfZ.js.map} +1 -1
  83. package/dist/cdn/chunks/{ParagraphEditor-D0q36Myd.js → ParagraphEditor-CWjMxuy0.js} +135 -136
  84. package/dist/cdn/chunks/{ParagraphEditor-D0q36Myd.js.map → ParagraphEditor-CWjMxuy0.js.map} +1 -1
  85. package/dist/cdn/chunks/{RestoreVersionDialog-CJggFdbi.js → RestoreVersionDialog-BsfulSK7.js} +3 -3
  86. package/dist/cdn/chunks/{RestoreVersionDialog-CJggFdbi.js.map → RestoreVersionDialog-BsfulSK7.js.map} +1 -1
  87. package/dist/cdn/chunks/{RichTextEditorContent-D3ihUF8v.js → RichTextEditorContent-CuvFVxEq.js} +6 -7
  88. package/dist/cdn/chunks/{RichTextEditorContent-D3ihUF8v.js.map → RichTextEditorContent-CuvFVxEq.js.map} +1 -1
  89. package/dist/cdn/chunks/{SaveBlockDialog-BzES5tqd.js → SaveBlockDialog-8zxJlHw2.js} +25 -26
  90. package/dist/cdn/chunks/{SaveBlockDialog-BzES5tqd.js.map → SaveBlockDialog-8zxJlHw2.js.map} +1 -1
  91. package/dist/cdn/chunks/{SavedBlocksBrowserModal-CLNcZcLd.js → SavedBlocksBrowserModal-DtaGW2H4.js} +9 -10
  92. package/dist/cdn/chunks/{SavedBlocksBrowserModal-CLNcZcLd.js.map → SavedBlocksBrowserModal-DtaGW2H4.js.map} +1 -1
  93. package/dist/cdn/chunks/{SavedBlocksPanels-R0W9LElD.js → SavedBlocksPanels-CtDhdbiD.js} +2 -2
  94. package/dist/cdn/chunks/{SavedBlocksPanels-R0W9LElD.js.map → SavedBlocksPanels-CtDhdbiD.js.map} +1 -1
  95. package/dist/cdn/chunks/{SavedBlocksPickBar-JNi5Rx4V.js → SavedBlocksPickBar-DovcCaoW.js} +3 -3
  96. package/dist/cdn/chunks/{SavedBlocksPickBar-JNi5Rx4V.js.map → SavedBlocksPickBar-DovcCaoW.js.map} +1 -1
  97. package/dist/cdn/chunks/{TemplateSettings-C5wsNcgX.js → TemplateSettings-B8Ch5ps8.js} +20 -21
  98. package/dist/cdn/chunks/{TemplateSettings-C5wsNcgX.js.map → TemplateSettings-B8Ch5ps8.js.map} +1 -1
  99. package/dist/cdn/chunks/{TestEmailModal-BxIAwjww.js → TestEmailModal-D1EuQSgA.js} +16 -17
  100. package/dist/cdn/chunks/{TestEmailModal-BxIAwjww.js.map → TestEmailModal-D1EuQSgA.js.map} +1 -1
  101. package/dist/cdn/chunks/{TestEmailPanel-B8BsWXjE.js → TestEmailPanel-0iG-utN7.js} +2 -2
  102. package/dist/cdn/chunks/{TestEmailPanel-B8BsWXjE.js.map → TestEmailPanel-0iG-utN7.js.map} +1 -1
  103. package/dist/cdn/chunks/{TitleEditor-DhcI1aRS.js → TitleEditor-k2vSwKxN.js} +17 -18
  104. package/dist/cdn/chunks/{TitleEditor-DhcI1aRS.js.map → TitleEditor-k2vSwKxN.js.map} +1 -1
  105. package/dist/cdn/chunks/{Toolbar-Ch3h2BUs.js → Toolbar-BnTSuZQb.js} +310 -312
  106. package/dist/cdn/chunks/Toolbar-BnTSuZQb.js.map +1 -0
  107. package/dist/cdn/chunks/{TplModal-CPOqOxVf.js → TplModal-iRdN04Sa.js} +5 -5
  108. package/dist/cdn/chunks/{TplModal-CPOqOxVf.js.map → TplModal-iRdN04Sa.js.map} +1 -1
  109. package/dist/cdn/chunks/{VersionHistoryMenu-DTDO48HI.js → VersionHistoryMenu-DlPr3twf.js} +7 -8
  110. package/dist/cdn/chunks/{VersionHistoryMenu-DTDO48HI.js.map → VersionHistoryMenu-DlPr3twf.js.map} +1 -1
  111. package/dist/cdn/chunks/{VersionHistoryPanels-CVrXHYxT.js → VersionHistoryPanels-Bw5UHEvo.js} +2 -2
  112. package/dist/cdn/chunks/{VersionHistoryPanels-CVrXHYxT.js.map → VersionHistoryPanels-Bw5UHEvo.js.map} +1 -1
  113. package/dist/cdn/chunks/{VersionPreviewBanner-C1H_fYAr.js → VersionPreviewBanner-anJgZOcw.js} +2 -2
  114. package/dist/cdn/chunks/VersionPreviewBanner-anJgZOcw.js.map +1 -0
  115. package/dist/cdn/chunks/{WrapperBlock-B8SJ7Q4w.js → WrapperBlock-CFjCtyvx.js} +5 -5
  116. package/dist/cdn/chunks/{WrapperBlock-B8SJ7Q4w.js.map → WrapperBlock-CFjCtyvx.js.map} +1 -1
  117. package/dist/cdn/chunks/{ca-C8N05sCU.js → ca-BIseSbs-.js} +2 -3
  118. package/dist/cdn/chunks/{ca-C8N05sCU.js.map → ca-BIseSbs-.js.map} +1 -1
  119. package/dist/cdn/chunks/{composables-CKXPwWo9.js → composables-Nir0umYc.js} +444 -464
  120. package/dist/cdn/chunks/composables-Nir0umYc.js.map +1 -0
  121. package/dist/{da-Dno_4nGy.js → cdn/chunks/da-DN46iRXS.js} +3 -2
  122. package/dist/cdn/chunks/{da-Dno_4nGy.js.map → da-DN46iRXS.js.map} +1 -1
  123. package/dist/{de-DRR5JSkh.js → cdn/chunks/de-Dyk8PPCm.js} +3 -2
  124. package/dist/cdn/chunks/{de-DRR5JSkh.js.map → de-Dyk8PPCm.js.map} +1 -1
  125. package/dist/{en-DAcLbbpg.js → cdn/chunks/en-BzMbMmgz.js} +3 -2
  126. package/dist/cdn/chunks/{en-DAcLbbpg.js.map → en-BzMbMmgz.js.map} +1 -1
  127. package/dist/{es-BcEQLQxe.js → cdn/chunks/es-KSHEXYyf.js} +3 -2
  128. package/dist/cdn/chunks/{es-BcEQLQxe.js.map → es-KSHEXYyf.js.map} +1 -1
  129. package/dist/cdn/chunks/{extensions-Bq9nXmBP.js → extensions-Br2hHeiR.js} +5 -5
  130. package/dist/cdn/chunks/{extensions-Bq9nXmBP.js.map → extensions-Br2hHeiR.js.map} +1 -1
  131. package/dist/{fr-CNQG7ESr.js → cdn/chunks/fr-DtKHfZyk.js} +3 -2
  132. package/dist/cdn/chunks/{fr-CNQG7ESr.js.map → fr-DtKHfZyk.js.map} +1 -1
  133. package/dist/{ja-CMxWxqSH.js → cdn/chunks/ja-DUSaDVPA.js} +3 -2
  134. package/dist/cdn/chunks/{ja-CMxWxqSH.js.map → ja-DUSaDVPA.js.map} +1 -1
  135. package/dist/{nl-BjyYZDkC.js → cdn/chunks/nl-DQbuxzD6.js} +3 -2
  136. package/dist/cdn/chunks/{nl-BjyYZDkC.js.map → nl-DQbuxzD6.js.map} +1 -1
  137. package/dist/{pt-BR-DC2A3C0v.js → cdn/chunks/pt-BR-CxpxBtvc.js} +3 -2
  138. package/dist/cdn/chunks/{pt-BR-DC2A3C0v.js.map → pt-BR-CxpxBtvc.js.map} +1 -1
  139. package/dist/cdn/chunks/rolldown-runtime-CGnMp29N.js +10 -0
  140. package/dist/cdn/chunks/{socialIcons-CSe4YJ52.js → socialIcons-CXQfKLUV.js} +156 -136
  141. package/dist/cdn/chunks/socialIcons-CXQfKLUV.js.map +1 -0
  142. package/dist/cdn/chunks/{src-Bk1LF1np.js → src-9e0wFfHH.js} +4 -2
  143. package/dist/cdn/chunks/src-9e0wFfHH.js.map +1 -0
  144. package/dist/cdn/chunks/src-A0kzK-pR.js.map +1 -1
  145. package/dist/cdn/chunks/{src-edESkGqO.js → src-C9jjLNMg.js} +2 -2
  146. package/dist/cdn/chunks/{src-edESkGqO.js.map → src-C9jjLNMg.js.map} +1 -1
  147. package/dist/cdn/chunks/{tiptap-DDhueoan.js → tiptap-DLW5XdqI.js} +2 -2
  148. package/dist/cdn/chunks/{tiptap-DDhueoan.js.map → tiptap-DLW5XdqI.js.map} +1 -1
  149. package/dist/cdn/chunks/{useEditorRoot-D0Lp2x4_.js → useEditorRoot-BPVxLYFD.js} +2 -2
  150. package/dist/cdn/chunks/{useEditorRoot-D0Lp2x4_.js.map → useEditorRoot-BPVxLYFD.js.map} +1 -1
  151. package/dist/cdn/chunks/useI18n-DwP1ksBW.js +24 -0
  152. package/dist/cdn/chunks/{keys-ywH4jHJ2.js.map → useI18n-DwP1ksBW.js.map} +1 -1
  153. package/dist/cdn/chunks/{useLanguageName-DDhdVpqh.js → useLanguageName-CeuoO9WZ.js} +2 -2
  154. package/dist/cdn/chunks/{useLanguageName-DDhdVpqh.js.map → useLanguageName-CeuoO9WZ.js.map} +1 -1
  155. package/dist/cdn/chunks/{useLogicTag-CKtQlJDa.js → useLogicTag-gphGbQfy.js} +3 -3
  156. package/dist/cdn/chunks/{useLogicTag-CKtQlJDa.js.map → useLogicTag-gphGbQfy.js.map} +1 -1
  157. package/dist/cdn/chunks/{useMergeTag-Dwy3U0PI.js → useMergeTag-QM-tkBc6.js} +3 -3
  158. package/dist/cdn/chunks/{useMergeTag-Dwy3U0PI.js.map → useMergeTag-QM-tkBc6.js.map} +1 -1
  159. package/dist/cdn/chunks/{usePopoverPosition-CBp9uwjV.js → usePopoverPosition-Cg8LR0W4.js} +2 -2
  160. package/dist/cdn/chunks/{usePopoverPosition-CBp9uwjV.js.map → usePopoverPosition-Cg8LR0W4.js.map} +1 -1
  161. package/dist/cdn/chunks/{useScrollToBlock-32EnuMwu.js → useScrollToBlock-CS7zo4oQ.js} +2 -2
  162. package/dist/cdn/chunks/{useScrollToBlock-32EnuMwu.js.map → useScrollToBlock-CS7zo4oQ.js.map} +1 -1
  163. package/dist/cdn/editor.css +1 -1
  164. package/dist/cdn/editor.js +877 -975
  165. package/dist/cdn/editor.js.map +1 -1
  166. package/dist/{composables-26aR45W3.js → composables-6SKZrQs-.js} +817 -837
  167. package/dist/{cdn/chunks/da-Dno_4nGy.js → da-DN46iRXS.js} +1 -4
  168. package/dist/{cdn/chunks/de-DRR5JSkh.js → de-Dyk8PPCm.js} +1 -4
  169. package/dist/{cdn/chunks/en-DAcLbbpg.js → en-BzMbMmgz.js} +1 -4
  170. package/dist/{cdn/chunks/es-BcEQLQxe.js → es-KSHEXYyf.js} +1 -4
  171. package/dist/{extensions-zHf8YFRw.js → extensions-D74nAP73.js} +3 -3
  172. package/dist/{cdn/chunks/fr-CNQG7ESr.js → fr-DtKHfZyk.js} +1 -4
  173. package/dist/index.d.ts +33 -405
  174. package/dist/{cdn/chunks/ja-CMxWxqSH.js → ja-DUSaDVPA.js} +1 -4
  175. package/dist/{cdn/chunks/nl-BjyYZDkC.js → nl-DQbuxzD6.js} +1 -4
  176. package/dist/{cdn/chunks/pt-BR-DC2A3C0v.js → pt-BR-CxpxBtvc.js} +1 -4
  177. package/dist/{socialIcons-mWE33bOn.js → socialIcons-K89pe-h2.js} +84 -64
  178. package/dist/style.css +1 -1
  179. package/dist/templatical-editor.js +1060 -1158
  180. package/dist/{useEditorRoot-DWfC2CVC.js → useEditorRoot-CQeutW_s.js} +1 -1
  181. package/dist/useI18n-B05qsAsl.js +22 -0
  182. package/dist/{useLanguageName-CEFzafHB.js → useLanguageName-CnpG7FD5.js} +1 -1
  183. package/dist/{useLogicTag-K5CPoMTk.js → useLogicTag-DSa1si4o.js} +2 -2
  184. package/dist/{useMergeTag-tsU_Sw2x.js → useMergeTag-DwxbvRZI.js} +2 -2
  185. package/dist/{usePopoverPosition-DF0ZYH7g.js → usePopoverPosition-B8CXTr8v.js} +1 -1
  186. package/dist/{useScrollToBlock-eZXiGa8o.js → useScrollToBlock-ZZBBGFan.js} +1 -1
  187. package/package.json +11 -13
  188. package/dist/CloudHeaderExtras-DC_oNrxz.js +0 -22
  189. package/dist/CloudPanels-BbHJHZri.js +0 -167
  190. package/dist/CommentsSidebar-_8at1Rug.js +0 -516
  191. package/dist/cdn/chunks/CloudHeaderExtras-Cd-ePldd.js +0 -24
  192. package/dist/cdn/chunks/CloudHeaderExtras-Cd-ePldd.js.map +0 -1
  193. package/dist/cdn/chunks/CloudPanels-Bv26_Sd8.js +0 -167
  194. package/dist/cdn/chunks/CloudPanels-Bv26_Sd8.js.map +0 -1
  195. package/dist/cdn/chunks/CommentsSidebar-BEiOQ_zT.js.map +0 -1
  196. package/dist/cdn/chunks/IssuesPanel-DgxiS3hF.js.map +0 -1
  197. package/dist/cdn/chunks/Toolbar-Ch3h2BUs.js.map +0 -1
  198. package/dist/cdn/chunks/VersionPreviewBanner-C1H_fYAr.js.map +0 -1
  199. package/dist/cdn/chunks/composables-CKXPwWo9.js.map +0 -1
  200. package/dist/cdn/chunks/createCloudRuntime-CUlw09ix.js +0 -1405
  201. package/dist/cdn/chunks/createCloudRuntime-CUlw09ix.js.map +0 -1
  202. package/dist/cdn/chunks/de-6M4JoHoD.js +0 -21
  203. package/dist/cdn/chunks/de-6M4JoHoD.js.map +0 -1
  204. package/dist/cdn/chunks/en-FzUuJ8HW.js +0 -21
  205. package/dist/cdn/chunks/en-FzUuJ8HW.js.map +0 -1
  206. package/dist/cdn/chunks/keys-ywH4jHJ2.js +0 -11
  207. package/dist/cdn/chunks/logger-CqQTfJGx.js +0 -26
  208. package/dist/cdn/chunks/logger-CqQTfJGx.js.map +0 -1
  209. package/dist/cdn/chunks/preRenderCustomBlocks-BLVFtvl8.js +0 -22
  210. package/dist/cdn/chunks/preRenderCustomBlocks-BLVFtvl8.js.map +0 -1
  211. package/dist/cdn/chunks/pt-BR-Bp92Fc6J.js +0 -21
  212. package/dist/cdn/chunks/pt-BR-Bp92Fc6J.js.map +0 -1
  213. package/dist/cdn/chunks/pusher-x9rNqzon.js +0 -2473
  214. package/dist/cdn/chunks/pusher-x9rNqzon.js.map +0 -1
  215. package/dist/cdn/chunks/rolldown-runtime-QGRDbDUS.js +0 -19
  216. package/dist/cdn/chunks/socialIcons-CSe4YJ52.js.map +0 -1
  217. package/dist/cdn/chunks/src-Bk1LF1np.js.map +0 -1
  218. package/dist/cdn/chunks/useCloudI18n-BTV9uu3c.js +0 -24
  219. package/dist/cdn/chunks/useCloudI18n-BTV9uu3c.js.map +0 -1
  220. package/dist/cdn/chunks/useI18n-DPg6rPbu.js +0 -18
  221. package/dist/cdn/chunks/useI18n-DPg6rPbu.js.map +0 -1
  222. package/dist/createCloudRuntime-CiEo0wkr.js +0 -1389
  223. package/dist/de-6M4JoHoD.js +0 -19
  224. package/dist/en-FzUuJ8HW.js +0 -19
  225. package/dist/keys-B4DimcgX.js +0 -9
  226. package/dist/logger-BOu7oEtk.js +0 -24
  227. package/dist/preRenderCustomBlocks-6CLw2rP6.js +0 -20
  228. package/dist/pt-BR-Bp92Fc6J.js +0 -19
  229. package/dist/useCloudI18n-BnuOL1YS.js +0 -22
  230. package/dist/useI18n-Cx9W7OWb.js +0 -16
@@ -1,1389 +0,0 @@
1
- import { B as e, N as t, c as n, et as r } from "./vue.runtime.esm-bundler-BE5V8ADU.js";
2
- import { y as i } from "./dist-DX_IQgcU.js";
3
- import { t as a } from "./preRenderCustomBlocks-6CLw2rP6.js";
4
- import { t as o } from "./logger-BOu7oEtk.js";
5
- import { f as s, o as c } from "./keys-B4DimcgX.js";
6
- // ../core/dist/cloud/index.js
7
- function l(e) {
8
- let t = e instanceof i ? e.statusCode : void 0;
9
- return t !== void 0 && t >= 400 && t < 500;
10
- }
11
- var u = class e {
12
- static DEFAULT_BASE_URL = "https://templatical.com";
13
- accessToken = null;
14
- expiresAt = null;
15
- _projectId = null;
16
- _tenantId = null;
17
- _tenantSlug = null;
18
- _testEmailConfig = null;
19
- _userConfig = null;
20
- url;
21
- baseUrl;
22
- requestOptions;
23
- onError;
24
- refreshPromise = null;
25
- static REFRESH_THRESHOLD_MS = 6e4;
26
- constructor(t) {
27
- this.url = t.url, this.baseUrl = (t.baseUrl ?? e.DEFAULT_BASE_URL).replace(/\/$/, ""), this.requestOptions = t.requestOptions ?? {}, this.onError = t.onError;
28
- }
29
- resolveUrl(e) {
30
- if (e.startsWith("http://") || e.startsWith("https://")) return e;
31
- let t = e.startsWith("/") ? e : `/${e}`;
32
- return `${this.baseUrl}${t}`;
33
- }
34
- get projectId() {
35
- if (!this._projectId) throw Error("Project ID not available. Call initialize() first.");
36
- return this._projectId;
37
- }
38
- get tenantId() {
39
- if (!this._tenantId) throw Error("Tenant ID not available. Call initialize() first.");
40
- return this._tenantId;
41
- }
42
- get tenantSlug() {
43
- if (!this._tenantSlug) throw Error("Tenant slug not available. Call initialize() first.");
44
- return this._tenantSlug;
45
- }
46
- get testEmailConfig() {
47
- return this._testEmailConfig;
48
- }
49
- get userConfig() {
50
- return this._userConfig;
51
- }
52
- get accessTokenValue() {
53
- return this.accessToken;
54
- }
55
- async initialize() {
56
- await this.ensureToken();
57
- }
58
- async ensureToken() {
59
- return this.accessToken && !this.isTokenExpiringSoon() ? this.accessToken : this.refreshToken();
60
- }
61
- isTokenExpiringSoon() {
62
- return !this.expiresAt || this.expiresAt.getTime() - Date.now() < e.REFRESH_THRESHOLD_MS;
63
- }
64
- async refreshToken() {
65
- if (this.refreshPromise) return this.refreshPromise;
66
- this.refreshPromise = this.performRefresh();
67
- try {
68
- return await this.refreshPromise;
69
- } finally {
70
- this.refreshPromise = null;
71
- }
72
- }
73
- async performRefresh() {
74
- try {
75
- let e = this.requestOptions.method ?? "POST", t = {
76
- Accept: "application/json",
77
- ...this.requestOptions.headers
78
- }, n = {
79
- method: e,
80
- headers: t,
81
- credentials: this.requestOptions.credentials ?? "include"
82
- };
83
- e === "POST" && this.requestOptions.body && (t["Content-Type"] = "application/json", n.body = JSON.stringify(this.requestOptions.body));
84
- let r = await fetch(this.url, n);
85
- if (!r.ok) throw new i(`Token refresh failed: ${r.status}`, r.status);
86
- let a = await r.json();
87
- if (!a.token || !a.expiresAt || !a.projectId || !a.tenant) throw Error("Invalid token response: missing token, expiresAt, projectId, or tenant");
88
- return this.accessToken = a.token, this.expiresAt = /* @__PURE__ */ new Date(a.expiresAt * 1e3), this._projectId = a.projectId, this._tenantSlug = a.tenant, this._testEmailConfig = a.testEmail?.allowedEmails && a.testEmail?.signature ? {
89
- allowedEmails: a.testEmail.allowedEmails,
90
- signature: a.testEmail.signature
91
- } : null, this._userConfig = a.user?.id && a.user?.name && a.user?.signature ? {
92
- id: a.user.id,
93
- name: a.user.name,
94
- signature: a.user.signature
95
- } : null, this.accessToken;
96
- } catch (e) {
97
- let t = e instanceof Error ? e : Error("Token refresh failed", { cause: e });
98
- throw this.onError?.(t), t;
99
- }
100
- }
101
- async authenticatedFetch(e, t = {}) {
102
- let n = await this.ensureToken(), r = this.resolveUrl(e), i = async (e) => fetch(r, {
103
- ...t,
104
- headers: {
105
- ...t.headers,
106
- Authorization: `Bearer ${e}`
107
- }
108
- }), a = await i(n);
109
- return a.status === 401 && (a = await i(await this.refreshToken())), a;
110
- }
111
- };
112
- function d(e, t) {
113
- return e.replace(/\{(\w+)\}/g, (e, n) => encodeURIComponent(t[n] ?? ""));
114
- }
115
- var f = "/api/v1/projects/{project}/tenants/{tenant}", p = `${f}/templates/{template}`, m = `${f}/media`, h = `${m}/folders`, g = `${f}/saved-modules`, _ = {
116
- health: "/api/v1/health",
117
- "projects.config": `${f}/config`,
118
- "broadcasting.auth": `${f}/broadcasting/auth`,
119
- "templates.store": `${f}/templates`,
120
- "templates.show": `${p}`,
121
- "templates.update": `${p}`,
122
- "templates.destroy": `${p}`,
123
- "templates.export": `${p}/export`,
124
- "templates.importFromBeefree": `${f}/templates/import/from-beefree`,
125
- "templates.sendTestEmail": `${p}/send-test-email`,
126
- "versions.index": `${p}/versions`,
127
- "versions.store": `${p}/versions`,
128
- "versions.show": `${p}/versions/{version}`,
129
- "versions.restore": `${p}/versions/{version}/restore`,
130
- "comments.index": `${p}/comments`,
131
- "comments.store": `${p}/comments`,
132
- "comments.update": `${p}/comments/{comment}`,
133
- "comments.destroy": `${p}/comments/{comment}`,
134
- "comments.resolve": `${p}/comments/{comment}/resolve`,
135
- "media.upload": `${m}/upload`,
136
- "media.browse": `${m}/browse`,
137
- "media.delete": `${m}/delete`,
138
- "media.move": `${m}/move`,
139
- "media.update": `${m}/{media}`,
140
- "media.replace": `${m}/{media}/replace`,
141
- "media.checkUsage": `${m}/check-usage`,
142
- "media.frequentlyUsed": `${m}/frequently-used`,
143
- "media.importFromUrl": `${m}/import-from-url`,
144
- "folders.index": `${h}`,
145
- "folders.store": `${h}`,
146
- "folders.update": `${h}/{mediaFolder}`,
147
- "folders.destroy": `${h}/{mediaFolder}`,
148
- "savedModules.index": `${g}`,
149
- "savedModules.store": `${g}`,
150
- "savedModules.update": `${g}/{savedModule}`,
151
- "savedModules.destroy": `${g}/{savedModule}`
152
- }, v = class {
153
- authManager;
154
- constructor(e) {
155
- this.authManager = e;
156
- }
157
- get projectId() {
158
- return this.authManager.projectId;
159
- }
160
- get tenantSlug() {
161
- return this.authManager.tenantSlug;
162
- }
163
- get baseParams() {
164
- return {
165
- project: this.projectId,
166
- tenant: this.tenantSlug
167
- };
168
- }
169
- async request(e, t = {}) {
170
- let n = await this.authManager.authenticatedFetch(e, {
171
- ...t,
172
- headers: {
173
- "Content-Type": "application/json",
174
- Accept: "application/json",
175
- ...t.headers
176
- }
177
- });
178
- if (!n.ok) {
179
- let e = await n.json().catch(() => ({ message: `HTTP error ${n.status}` })), t = this.extractFirstValidationError(e);
180
- throw new i(t, n.status);
181
- }
182
- if (n.status !== 204) return (await n.json()).data;
183
- }
184
- extractFirstValidationError(e) {
185
- if (e.errors) {
186
- let t = Object.keys(e.errors)[0];
187
- if (t && e.errors[t]?.length > 0) return e.errors[t][0];
188
- }
189
- return e.message;
190
- }
191
- async createTemplate(e, t) {
192
- return this.request(d(_["templates.store"], this.baseParams), {
193
- method: "POST",
194
- body: JSON.stringify(t === void 0 ? { content: e } : {
195
- content: e,
196
- name: t
197
- })
198
- });
199
- }
200
- async getTemplate(e) {
201
- return this.request(d(_["templates.show"], {
202
- ...this.baseParams,
203
- template: e
204
- }));
205
- }
206
- async updateTemplate(e, t) {
207
- return this.request(d(_["templates.update"], {
208
- ...this.baseParams,
209
- template: e
210
- }), {
211
- method: "PUT",
212
- body: JSON.stringify(t)
213
- });
214
- }
215
- async createVersion(e, t, n) {
216
- return this.request(d(_["versions.store"], {
217
- ...this.baseParams,
218
- template: e
219
- }), {
220
- method: "POST",
221
- body: JSON.stringify(n === void 0 ? { content: t } : {
222
- content: t,
223
- label: n
224
- })
225
- });
226
- }
227
- async deleteTemplate(e) {
228
- return this.request(d(_["templates.destroy"], {
229
- ...this.baseParams,
230
- template: e
231
- }), { method: "DELETE" });
232
- }
233
- async getVersions(e) {
234
- return this.request(d(_["versions.index"], {
235
- ...this.baseParams,
236
- template: e
237
- }));
238
- }
239
- async getVersion(e, t) {
240
- return this.request(d(_["versions.show"], {
241
- ...this.baseParams,
242
- template: e,
243
- version: t
244
- }));
245
- }
246
- async restoreVersion(e, t) {
247
- return this.request(d(_["versions.restore"], {
248
- ...this.baseParams,
249
- template: e,
250
- version: t
251
- }), { method: "POST" });
252
- }
253
- async exportTemplate(e, t) {
254
- let n = t ? JSON.stringify({
255
- custom_fonts: t.customFonts,
256
- default_fallback: t.defaultFallback
257
- }) : void 0;
258
- return this.request(d(_["templates.export"], {
259
- ...this.baseParams,
260
- template: e
261
- }), {
262
- method: "POST",
263
- body: n
264
- });
265
- }
266
- async sendTestEmail(e, t) {
267
- await this.request(d(_["templates.sendTestEmail"], {
268
- ...this.baseParams,
269
- template: e
270
- }), {
271
- method: "POST",
272
- body: JSON.stringify(t)
273
- });
274
- }
275
- commentsUrl(e, t) {
276
- return t ? d(_["comments.update"], {
277
- ...this.baseParams,
278
- template: e,
279
- comment: t
280
- }) : d(_["comments.index"], {
281
- ...this.baseParams,
282
- template: e
283
- });
284
- }
285
- async getComments(e) {
286
- return this.request(this.commentsUrl(e));
287
- }
288
- async createComment(e, t, n) {
289
- return this.request(this.commentsUrl(e), {
290
- method: "POST",
291
- body: JSON.stringify(t),
292
- headers: n
293
- });
294
- }
295
- async updateComment(e, t, n, r) {
296
- return this.request(this.commentsUrl(e, t), {
297
- method: "PUT",
298
- body: JSON.stringify(n),
299
- headers: r
300
- });
301
- }
302
- async deleteComment(e, t, n, r) {
303
- return this.request(this.commentsUrl(e, t), {
304
- method: "DELETE",
305
- body: JSON.stringify(n),
306
- headers: r
307
- });
308
- }
309
- async resolveComment(e, t, n, r) {
310
- return this.request(d(_["comments.resolve"], {
311
- ...this.baseParams,
312
- template: e,
313
- comment: t
314
- }), {
315
- method: "POST",
316
- body: JSON.stringify(n),
317
- headers: r
318
- });
319
- }
320
- async fetchConfig() {
321
- return this.request(d(_["projects.config"], this.baseParams));
322
- }
323
- async listModules(e, t) {
324
- let n = d(_["savedModules.index"], this.baseParams), r = new URLSearchParams();
325
- e && r.set("search", e), t && r.set("category", t);
326
- let i = r.size > 0 ? `?${r}` : "";
327
- return this.request(`${n}${i}`);
328
- }
329
- async createModule(e) {
330
- return this.request(d(_["savedModules.store"], this.baseParams), {
331
- method: "POST",
332
- body: JSON.stringify(e)
333
- });
334
- }
335
- async updateModule(e, t) {
336
- return this.request(d(_["savedModules.update"], {
337
- ...this.baseParams,
338
- savedModule: e
339
- }), {
340
- method: "PUT",
341
- body: JSON.stringify(t)
342
- });
343
- }
344
- async deleteModule(e) {
345
- return this.request(d(_["savedModules.destroy"], {
346
- ...this.baseParams,
347
- savedModule: e
348
- }), { method: "DELETE" });
349
- }
350
- }, y = class {
351
- authManager;
352
- constructor(e) {
353
- this.authManager = e;
354
- }
355
- get projectId() {
356
- return this.authManager.projectId;
357
- }
358
- get tenantSlug() {
359
- return this.authManager.tenantSlug;
360
- }
361
- get baseParams() {
362
- return {
363
- project: this.projectId,
364
- tenant: this.tenantSlug
365
- };
366
- }
367
- async request(e, t = {}) {
368
- let n = await this.authManager.authenticatedFetch(e, {
369
- ...t,
370
- headers: {
371
- "Content-Type": "application/json",
372
- Accept: "application/json",
373
- ...t.headers
374
- }
375
- });
376
- if (!n.ok) {
377
- let e = await n.json().catch(() => ({ message: `HTTP error ${n.status}` }));
378
- throw Error(e.message, { cause: e });
379
- }
380
- if (n.status !== 204) return (await n.json()).data;
381
- }
382
- async browseMedia(e) {
383
- let t = new URLSearchParams();
384
- e.folderId && t.set("folderId", e.folderId), e.search && t.set("search", e.search), e.category && t.set("category", e.category), e.sort && t.set("sort", e.sort), e.cursor && t.set("cursor", e.cursor);
385
- let n = t.toString(), r = `${d(_["media.browse"], this.baseParams)}${n ? `?${n}` : ""}`, i = await this.authManager.authenticatedFetch(r, { headers: { Accept: "application/json" } });
386
- if (!i.ok) {
387
- let e = await i.json().catch(() => ({ message: `HTTP error ${i.status}` }));
388
- throw Error(e.message, { cause: e });
389
- }
390
- return i.json();
391
- }
392
- async uploadMedia(e, t) {
393
- let n = new FormData();
394
- n.append("file", e), t && n.append("folderId", t);
395
- let r = d(_["media.upload"], this.baseParams), i = await this.authManager.authenticatedFetch(r, {
396
- method: "POST",
397
- headers: { Accept: "application/json" },
398
- body: n
399
- });
400
- if (!i.ok) {
401
- let e = await i.json().catch(() => ({ message: `HTTP error ${i.status}` }));
402
- throw Error(e.message, { cause: e });
403
- }
404
- return (await i.json()).data;
405
- }
406
- async updateMedia(e, t, n) {
407
- let r = {};
408
- return t !== void 0 && (r.filename = t), n !== void 0 && (r.alt = n), this.request(d(_["media.update"], {
409
- ...this.baseParams,
410
- media: e
411
- }), {
412
- method: "PUT",
413
- body: JSON.stringify(r)
414
- });
415
- }
416
- async deleteMedia(e) {
417
- return this.request(d(_["media.delete"], this.baseParams), {
418
- method: "POST",
419
- body: JSON.stringify({ ids: e })
420
- });
421
- }
422
- async moveMedia(e, t) {
423
- return this.request(d(_["media.move"], this.baseParams), {
424
- method: "POST",
425
- body: JSON.stringify({
426
- ids: e,
427
- folderId: t
428
- })
429
- });
430
- }
431
- async getMediaFolders() {
432
- return this.request(d(_["folders.index"], this.baseParams));
433
- }
434
- async createMediaFolder(e, t) {
435
- return this.request(d(_["folders.store"], this.baseParams), {
436
- method: "POST",
437
- body: JSON.stringify({
438
- name: e,
439
- parentId: t ?? null
440
- })
441
- });
442
- }
443
- async renameMediaFolder(e, t) {
444
- return this.request(d(_["folders.update"], {
445
- ...this.baseParams,
446
- mediaFolder: e
447
- }), {
448
- method: "PUT",
449
- body: JSON.stringify({ name: t })
450
- });
451
- }
452
- async deleteMediaFolder(e) {
453
- return this.request(d(_["folders.destroy"], {
454
- ...this.baseParams,
455
- mediaFolder: e
456
- }), { method: "DELETE" });
457
- }
458
- async checkMediaUsage(e) {
459
- let t = await this.authManager.authenticatedFetch(d(_["media.checkUsage"], this.baseParams), {
460
- method: "POST",
461
- headers: {
462
- "Content-Type": "application/json",
463
- Accept: "application/json"
464
- },
465
- body: JSON.stringify({ ids: e })
466
- });
467
- if (!t.ok) {
468
- let e = await t.json().catch(() => ({ message: `HTTP error ${t.status}` }));
469
- throw Error(e.message, { cause: e });
470
- }
471
- return t.json();
472
- }
473
- async getFrequentlyUsed() {
474
- return this.request(d(_["media.frequentlyUsed"], this.baseParams));
475
- }
476
- async importFromUrl(e, t) {
477
- return this.request(d(_["media.importFromUrl"], this.baseParams), {
478
- method: "POST",
479
- body: JSON.stringify({
480
- url: e,
481
- folderId: t ?? null
482
- })
483
- });
484
- }
485
- async replaceMedia(e, t) {
486
- let n = new FormData();
487
- n.append("file", t);
488
- let r = d(_["media.replace"], {
489
- ...this.baseParams,
490
- media: e
491
- }), i = await this.authManager.authenticatedFetch(r, {
492
- method: "POST",
493
- headers: { Accept: "application/json" },
494
- body: n
495
- });
496
- if (!i.ok) {
497
- let e = await i.json().catch(() => ({ message: `HTTP error ${i.status}` }));
498
- throw Error(e.message, { cause: e });
499
- }
500
- return (await i.json()).data;
501
- }
502
- };
503
- function b(e) {
504
- return {
505
- host: e.host,
506
- port: e.port,
507
- appKey: e.appKey
508
- };
509
- }
510
- var x = class {
511
- pusher = null;
512
- authManager;
513
- config;
514
- onError;
515
- constructor(e) {
516
- this.authManager = e.authManager, this.config = e.config, this.onError = e.onError;
517
- }
518
- async connect() {
519
- if (this.pusher) return;
520
- let e;
521
- try {
522
- ({default: e} = await import("pusher-js"));
523
- } catch {
524
- throw Error("[Templatical] Cloud features require the optional peer dependency 'pusher-js'. Please install it.");
525
- }
526
- let { host: t, port: n, appKey: r } = this.config, i = this.authManager.resolveUrl(d(_["broadcasting.auth"], {
527
- project: this.authManager.projectId,
528
- tenant: this.authManager.tenantSlug
529
- }));
530
- this.pusher = new e(r, {
531
- wsHost: t,
532
- wsPort: n,
533
- wssPort: n,
534
- forceTLS: !0,
535
- disableStats: !0,
536
- enabledTransports: ["ws", "wss"],
537
- cluster: "",
538
- channelAuthorization: {
539
- transport: "ajax",
540
- endpoint: i,
541
- headers: {
542
- Authorization: `Bearer ${this.authManager.accessTokenValue}`,
543
- Accept: "application/json"
544
- },
545
- params: {
546
- userId: this.authManager.userConfig?.id ?? "",
547
- userName: this.authManager.userConfig?.name ?? "",
548
- userSignature: this.authManager.userConfig?.signature ?? ""
549
- }
550
- }
551
- }), this.pusher.connection.bind("error", (e) => {
552
- this.onError?.(e instanceof Error ? e : /* @__PURE__ */ Error("WebSocket connection error"));
553
- });
554
- }
555
- subscribePresence(e) {
556
- if (!this.pusher) throw Error("WebSocketClient not connected. Call connect() first.");
557
- return this.pusher.subscribe(e);
558
- }
559
- unsubscribe(e) {
560
- this.pusher?.unsubscribe(e);
561
- }
562
- getChannel(e) {
563
- return this.pusher?.channel(e);
564
- }
565
- disconnect() {
566
- this.pusher &&= (this.pusher.disconnect(), null);
567
- }
568
- getSocketId() {
569
- return this.pusher?.connection.socket_id ?? null;
570
- }
571
- get isConnected() {
572
- return this.pusher?.connection.state === "connected";
573
- }
574
- }, S = "comment-broadcast";
575
- function C(e) {
576
- let t = {
577
- id: e.id,
578
- body: e.body,
579
- author: e.author,
580
- createdAt: e.createdAt,
581
- blockId: e.blockId,
582
- parentId: e.parentId,
583
- resolvedAt: e.resolvedAt
584
- };
585
- return e.updatedAt !== e.createdAt && (t.updatedAt = e.updatedAt), e.resolvedBy && (t.resolvedBy = e.resolvedBy), e.replies?.length && (t.replies = e.replies.map(C)), t;
586
- }
587
- function ee(t) {
588
- let { authManager: n, channel: r, getSocketId: i } = t, a = new v(n);
589
- function o() {
590
- let e = n.userConfig;
591
- 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.");
592
- return {
593
- userId: e.id,
594
- userName: e.name,
595
- userSignature: e.signature
596
- };
597
- }
598
- function s() {
599
- let e = i?.();
600
- return e ? { "X-Socket-ID": e } : void 0;
601
- }
602
- return {
603
- async list(e) {
604
- return (await a.getComments(e)).map(C);
605
- },
606
- async create(e, t) {
607
- return C(await a.createComment(e, {
608
- body: t.body,
609
- blockId: t.blockId,
610
- parentId: t.parentId,
611
- ...o()
612
- }, s()));
613
- },
614
- async update(e, t, n) {
615
- if (n.body === void 0) throw Error("[Templatical] Cloud comments: update() needs a `body` in the patch.");
616
- return C(await a.updateComment(e, t, {
617
- body: n.body,
618
- ...o()
619
- }, s()));
620
- },
621
- async delete(e, t) {
622
- await a.deleteComment(e, t, o(), s());
623
- },
624
- async setResolved(e, t, n) {
625
- return C(await a.resolveComment(e, t, o(), s()));
626
- },
627
- subscribe(t, n) {
628
- function i(e) {
629
- if (e.comment.templateId && e.comment.templateId !== t) return;
630
- let r = C(e.comment);
631
- switch (e.action) {
632
- case "commentCreated":
633
- n({
634
- type: "created",
635
- comment: r
636
- });
637
- break;
638
- case "commentDeleted":
639
- n({
640
- type: "deleted",
641
- commentId: r.id,
642
- parentId: r.parentId
643
- });
644
- break;
645
- case "commentUpdated":
646
- case "commentResolved":
647
- case "commentUnresolved": n({
648
- type: "updated",
649
- comment: r
650
- });
651
- }
652
- }
653
- let a = e(r, (e, t) => {
654
- t?.unbind(S, i), e?.bind(S, i);
655
- }, { immediate: !0 });
656
- return () => {
657
- a(), r.value?.unbind(S, i);
658
- };
659
- }
660
- };
661
- }
662
- function te(e) {
663
- let { authManager: t, onError: n } = e, i = r(null), a = r(!1), o = null, s = null, c = null, l = null;
664
- async function u(e, r) {
665
- let u = `presence-template.${e}`;
666
- if (l = u, o && c === u) return;
667
- if (!o) {
668
- let e = new x({
669
- authManager: t,
670
- config: r,
671
- onError: n
672
- });
673
- o = e, s = e.connect().catch((t) => {
674
- throw o === e && (o = null, s = null, c = null, l = null), t;
675
- });
676
- }
677
- let d = o;
678
- if (await s, o !== d) {
679
- d.disconnect();
680
- return;
681
- }
682
- if (l !== u || c === u) return;
683
- c && d.unsubscribe(c), c = u, i.value = null, a.value = !1;
684
- let f = d.subscribePresence(u);
685
- f.bind("pusher:subscription_succeeded", () => {
686
- c === u && (a.value = !0, i.value = f);
687
- }), f.bind("pusher:subscription_error", (e) => {
688
- c === u && (a.value = !1, i.value = null, n?.(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to subscribe to template channel")));
689
- });
690
- }
691
- function d() {
692
- c && o && o.unsubscribe(c), o?.disconnect(), o = null, s = null, c = null, l = null, i.value = null, a.value = !1;
693
- }
694
- function f() {
695
- return o?.getSocketId() ?? null;
696
- }
697
- return {
698
- channel: i,
699
- isConnected: a,
700
- connect: u,
701
- disconnect: d,
702
- getSocketId: f
703
- };
704
- }
705
- function ne(e) {
706
- let t = new v(e);
707
- return {
708
- list(e) {
709
- return t.listModules(e?.search, e?.category);
710
- },
711
- create(e) {
712
- return t.createModule(e);
713
- },
714
- update(e, n) {
715
- return t.updateModule(e, n);
716
- },
717
- delete(e) {
718
- return t.deleteModule(e);
719
- }
720
- };
721
- }
722
- function w(e) {
723
- let t = {
724
- id: e.id,
725
- url: e.url,
726
- filename: e.filename,
727
- alt: e.alt,
728
- mimeType: e.mimeType,
729
- folderId: e.folderId,
730
- createdAt: e.createdAt,
731
- updatedAt: e.updatedAt,
732
- size: e.size
733
- };
734
- return e.width != null && (t.width = e.width), e.height != null && (t.height = e.height), e.thumbnailUrl != null && (t.thumbnailUrl = e.thumbnailUrl), t;
735
- }
736
- function T(e, t = null) {
737
- return {
738
- id: e.id,
739
- name: e.name,
740
- parentId: e.parentId === void 0 ? t : e.parentId
741
- };
742
- }
743
- function E(e, t = null) {
744
- let n = [];
745
- for (let r of e) n.push(T(r, t)), r.children?.length && n.push(...E(r.children, r.id));
746
- return n;
747
- }
748
- function D(e) {
749
- let t = e?.media?.categories;
750
- if (!t) return;
751
- let n = {};
752
- for (let [e, r] of Object.entries(t)) n[e] = r.mimeTypes;
753
- return n;
754
- }
755
- function O(e, t) {
756
- let n = new y(e);
757
- return {
758
- async list(e) {
759
- let t = await n.browseMedia({
760
- search: e?.search,
761
- cursor: e?.cursor,
762
- folderId: e?.folderId,
763
- category: e?.category
764
- }), r = { items: t.data.map(w) };
765
- return t.meta.nextCursor && (r.nextCursor = t.meta.nextCursor), r;
766
- },
767
- async create(e) {
768
- return w(await n.uploadMedia(e.file, e.folderId));
769
- },
770
- async update(e, t) {
771
- return w(await n.updateMedia(e, t.filename, t.alt));
772
- },
773
- delete(e) {
774
- return n.deleteMedia(e);
775
- },
776
- folders: {
777
- async list() {
778
- return E(await n.getMediaFolders());
779
- },
780
- async create(e) {
781
- return T(await n.createMediaFolder(e.name, e.parentId));
782
- },
783
- async update(e, t) {
784
- return T(await n.renameMediaFolder(e, t.name));
785
- },
786
- delete(e) {
787
- return n.deleteMediaFolder(e);
788
- },
789
- async move(e, t) {
790
- return (await n.moveMedia(e, t)).map(w);
791
- }
792
- },
793
- async replace(e, t) {
794
- return w(await n.replaceMedia(e, t));
795
- },
796
- async importFromUrl(e, t) {
797
- return w(await n.importFromUrl(e, t));
798
- },
799
- async checkUsage(e) {
800
- let t = await n.checkMediaUsage(e), r = {};
801
- for (let [e, n] of Object.entries(t.data)) r[e] = {
802
- templateCount: n.templateCount,
803
- templateNames: n.templateNames
804
- };
805
- return r;
806
- },
807
- async frequentlyUsed() {
808
- return (await n.getFrequentlyUsed()).map(w);
809
- },
810
- async storage() {
811
- return t?.()?.storage ?? null;
812
- },
813
- get maxFileSize() {
814
- return t?.()?.media?.maxFileSize;
815
- },
816
- get mimeTypes() {
817
- return D(t?.() ?? null);
818
- }
819
- };
820
- }
821
- var k = 6e4;
822
- function re(e) {
823
- let t = new v(e), n = 0;
824
- function r(e, r) {
825
- let i = Date.now();
826
- i - n < k || (n = i, t.createVersion(e, r).catch((e) => {
827
- console.warn("[Templatical] Automatic version not recorded — the save itself succeeded:", e);
828
- }));
829
- }
830
- return {
831
- load(e) {
832
- return t.getTemplate(e);
833
- },
834
- create(e) {
835
- return t.createTemplate(e.content, e.name);
836
- },
837
- async save(e, n) {
838
- let i = await t.updateTemplate(e, n);
839
- return n.content && r(e, n.content), i;
840
- }
841
- };
842
- }
843
- function ie(e) {
844
- return {
845
- customFonts: e?.customFonts ?? [],
846
- defaultFallback: e?.defaultFallback ?? "Arial, sans-serif"
847
- };
848
- }
849
- function A(e) {
850
- let t = new v(e.authManager);
851
- async function n(e, n) {
852
- let r = await t.exportTemplate(e, n);
853
- return {
854
- html: r.html,
855
- mjml: r.mjml
856
- };
857
- }
858
- async function r(e, n) {
859
- return (await t.exportTemplate(e, n)).mjml;
860
- }
861
- return {
862
- exportHtml: n,
863
- getMjmlSource: r
864
- };
865
- }
866
- function j(e) {
867
- let t = A({ authManager: e.authManager });
868
- function n(e) {
869
- return {
870
- customFonts: e.fonts?.customFonts ?? [],
871
- defaultFallback: e.fonts?.defaultFallback ?? "Arial, sans-serif"
872
- };
873
- }
874
- async function r() {
875
- 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().");
876
- return (await e.save()).id;
877
- }
878
- return {
879
- async toMjml(e) {
880
- let i = n(e), a = await r();
881
- return t.getMjmlSource(a, i);
882
- },
883
- async toHtml(e) {
884
- let i = n(e), a = await r(), { html: o } = await t.exportHtml(a, i);
885
- return o;
886
- }
887
- };
888
- }
889
- function M(e) {
890
- return {
891
- id: e.id,
892
- createdAt: e.createdAt,
893
- isAutomatic: e.isAutomatic,
894
- content: e.content
895
- };
896
- }
897
- function ae(e) {
898
- let t = new v(e);
899
- return {
900
- async list(e) {
901
- return { versions: (await t.getVersions(e)).map(M) };
902
- },
903
- async get(e, n) {
904
- return (await t.getVersion(e, n)).content;
905
- },
906
- async create(e, n, r) {
907
- return M(await t.createVersion(e, n, r?.label));
908
- },
909
- restore(e, n) {
910
- return t.restoreVersion(e, n);
911
- }
912
- };
913
- }
914
- function oe(t) {
915
- let { authManager: i, isAuthReady: a } = t, o = r(null);
916
- a && e(a, (e) => {
917
- e && (o.value = i.testEmailConfig);
918
- }, { immediate: !0 });
919
- let s = n(() => o.value !== null), c = n(() => o.value?.allowedEmails ?? []);
920
- function l() {
921
- return o.value?.signature ?? null;
922
- }
923
- return {
924
- isEnabled: s,
925
- allowedEmails: c,
926
- getSignature: l
927
- };
928
- }
929
- function se(e) {
930
- let t = new v(e.authManager);
931
- return {
932
- get allowedRecipients() {
933
- return e.allowedEmails.value;
934
- },
935
- async send({ recipient: n }) {
936
- let r = e.getSignature();
937
- if (r === null) throw Error("Test email is not enabled for this project");
938
- let i = e.getTemplateId();
939
- if (i === null) throw Error("Template must be saved before sending a test email");
940
- await e.save();
941
- let { html: a } = await e.exportHtml(i);
942
- e.onBeforeTestEmail && (a = await e.onBeforeTestEmail(a)), await t.sendTestEmail(i, {
943
- recipient: n,
944
- html: a,
945
- allowedEmails: e.allowedEmails.value,
946
- signature: r
947
- });
948
- }
949
- };
950
- }
951
- function ce(e) {
952
- let { authManager: t, onError: i } = e, a = r(null), o = r(!1), s = new v(t), c = n(() => a.value?.features ?? null);
953
- function l(e) {
954
- return a.value?.features[e] ?? !1;
955
- }
956
- async function u() {
957
- if (!o.value) {
958
- o.value = !0;
959
- try {
960
- a.value = await s.fetchConfig();
961
- } catch (e) {
962
- i?.(e instanceof Error ? e : Error("Failed to fetch config", { cause: e }));
963
- } finally {
964
- o.value = !1;
965
- }
966
- }
967
- }
968
- return {
969
- config: a,
970
- isLoading: o,
971
- hasFeature: l,
972
- features: c,
973
- fetchConfig: u
974
- };
975
- }
976
- var N = 5e3;
977
- function P(e) {
978
- return e.authManager ? e.authManager.resolveUrl(_.health) : `${(e.baseUrl ?? "https://templatical.com").replace(/\/$/, "")}${_.health}`;
979
- }
980
- async function F(e, t) {
981
- let n = performance.now();
982
- try {
983
- let r = t ? await t.authenticatedFetch(_.health, {
984
- method: "GET",
985
- headers: { Accept: "application/json" }
986
- }) : await fetch(e, {
987
- method: "GET",
988
- headers: { Accept: "application/json" }
989
- }), i = Math.round(performance.now() - n);
990
- if (r.status === 401) return {
991
- api: {
992
- ok: !0,
993
- latency: i
994
- },
995
- auth: {
996
- ok: !1,
997
- error: "HTTP 401"
998
- }
999
- };
1000
- if (!r.ok) return {
1001
- api: {
1002
- ok: !1,
1003
- latency: i
1004
- },
1005
- auth: {
1006
- ok: !t,
1007
- error: t ? `HTTP ${r.status}` : void 0
1008
- }
1009
- };
1010
- let a = await r.json();
1011
- return {
1012
- api: {
1013
- ok: a.status === "ok",
1014
- latency: i
1015
- },
1016
- auth: { ok: !0 },
1017
- wsConfig: a.websocket
1018
- };
1019
- } catch (e) {
1020
- return {
1021
- api: {
1022
- ok: !1,
1023
- latency: Math.round(performance.now() - n)
1024
- },
1025
- auth: {
1026
- ok: !t,
1027
- error: t ? e instanceof Error ? e.message : "Authentication check failed" : void 0
1028
- }
1029
- };
1030
- }
1031
- }
1032
- async function I(e) {
1033
- if (!e?.host || !e?.appKey) return {
1034
- ok: !1,
1035
- error: "WebSocket configuration not available"
1036
- };
1037
- if (typeof WebSocket > "u") return {
1038
- ok: !1,
1039
- error: "WebSocket not supported in this environment"
1040
- };
1041
- let t = `${e.port === 443 ? "wss" : "ws"}://${e.host}:${e.port}/app/${e.appKey}?protocol=7&client=js&version=8.4.0-rc2&flash=false`;
1042
- return new Promise((e) => {
1043
- let n = null, r = setTimeout(() => {
1044
- n?.close(), e({
1045
- ok: !1,
1046
- error: "WebSocket connection timed out"
1047
- });
1048
- }, N);
1049
- try {
1050
- n = new WebSocket(t);
1051
- } catch (t) {
1052
- clearTimeout(r), e({
1053
- ok: !1,
1054
- error: t instanceof Error ? t.message : "WebSocket connection failed"
1055
- });
1056
- return;
1057
- }
1058
- n.onopen = () => {
1059
- clearTimeout(r), n?.close(), e({ ok: !0 });
1060
- }, n.onerror = () => {
1061
- clearTimeout(r), e({
1062
- ok: !1,
1063
- error: "WebSocket connection failed"
1064
- });
1065
- };
1066
- });
1067
- }
1068
- async function L(e = {}) {
1069
- let t = await F(P(e), e.authManager), n = await I(t.wsConfig);
1070
- return {
1071
- api: t.api,
1072
- websocket: n,
1073
- auth: t.auth,
1074
- overall: t.api.ok && t.auth.ok
1075
- };
1076
- }
1077
- // src/cloud/composables/useCloudFeatureFlags.ts
1078
- function R(e) {
1079
- let { planConfigInstance: t, getTemplateId: r } = e;
1080
- return {
1081
- canSendTestEmail: n(() => t.hasFeature("testEmail")),
1082
- hasTemplateSaved: n(() => r() !== null),
1083
- templateLimit: n(() => t.config.value?.limits.maxTemplates ?? null),
1084
- templateCount: n(() => t.config.value?.templateCount ?? 0)
1085
- };
1086
- }
1087
- // src/cloud/composables/useCloudPanelState.ts
1088
- function z() {
1089
- let e = r(null);
1090
- return {
1091
- activePanel: e,
1092
- commentsOpen: n({
1093
- get: () => e.value === "comments",
1094
- set: (t) => e.value = t ? "comments" : null
1095
- }),
1096
- rightPanelOpen: n(() => e.value !== null)
1097
- };
1098
- }
1099
- // src/cloud/composables/useCloudSaveGate.ts
1100
- function B(e) {
1101
- let t = r(!1), i = null, a = n(() => e.planConfig.value?.accessibility?.blockOnError === !0), o = n(() => a.value ? e.issues.value.filter((e) => e.severity === "error") : []), s = n(() => o.value.length > 0);
1102
- async function c(e) {
1103
- return s.value ? (i = e, t.value = !0, !1) : (await e(), !0);
1104
- }
1105
- async function l(e) {
1106
- return !s.value && (await e(), !0);
1107
- }
1108
- async function u() {
1109
- let e = i;
1110
- i = null, t.value = !1, e && await e();
1111
- }
1112
- function d() {
1113
- i = null, t.value = !1;
1114
- }
1115
- return {
1116
- shouldBlock: s,
1117
- blockingIssues: o,
1118
- modalOpen: t,
1119
- tryRunSave: c,
1120
- runUnlessBlocked: l,
1121
- confirmAndSave: u,
1122
- cancel: d
1123
- };
1124
- }
1125
- // src/cloud/collectSavedBlockIds.ts
1126
- function V(e) {
1127
- let t = /* @__PURE__ */ new Set();
1128
- return H(e?.content?.blocks, t), t;
1129
- }
1130
- function H(e, t) {
1131
- if (e) {
1132
- for (let n of e) if (t.add(n.id), n.children) {
1133
- if (n.type === "section") for (let e of n.children) H(e, t);
1134
- else n.type === "wrapper" && H(n.children, t);
1135
- }
1136
- }
1137
- }
1138
- // src/cloud/createCloudRuntime.ts
1139
- function U(e) {
1140
- if (!e) return {};
1141
- let { onSaved: t, onCreated: n, onLoaded: r } = e;
1142
- return {
1143
- ...typeof t == "function" ? { onSaved: t } : {},
1144
- ...typeof n == "function" ? { onCreated: n } : {},
1145
- ...typeof r == "function" ? { onLoaded: r } : {}
1146
- };
1147
- }
1148
- function W(e) {
1149
- if (!e) return {};
1150
- let { onCreated: t, onUpdated: n, onDeleted: r, onResolved: i, onUnresolved: a } = e;
1151
- return {
1152
- ...typeof t == "function" ? { onCreated: t } : {},
1153
- ...typeof n == "function" ? { onUpdated: n } : {},
1154
- ...typeof r == "function" ? { onDeleted: r } : {},
1155
- ...typeof i == "function" ? { onResolved: i } : {},
1156
- ...typeof a == "function" ? { onUnresolved: a } : {}
1157
- };
1158
- }
1159
- function le(e) {
1160
- if (typeof e != "object" || !e) return {};
1161
- let { onCreated: t, onUpdated: n, onDeleted: r } = e;
1162
- return {
1163
- ...typeof t == "function" ? { onCreated: t } : {},
1164
- ...typeof n == "function" ? { onUpdated: n } : {},
1165
- ...typeof r == "function" ? { onDeleted: r } : {}
1166
- };
1167
- }
1168
- function ue(e) {
1169
- if (typeof e != "object" || !e) return {};
1170
- let { onSent: t, defaultRecipient: n } = e;
1171
- return {
1172
- ...typeof t == "function" ? { onSent: t } : {},
1173
- ...typeof n == "string" ? { defaultRecipient: n } : {}
1174
- };
1175
- }
1176
- function de(e) {
1177
- if (typeof e != "object" || !e) return {};
1178
- let { onCreated: t, onUpdated: n, onDeleted: r } = e;
1179
- return {
1180
- ...typeof t == "function" ? { onCreated: t } : {},
1181
- ...typeof n == "function" ? { onUpdated: n } : {},
1182
- ...typeof r == "function" ? { onDeleted: r } : {}
1183
- };
1184
- }
1185
- function fe(e) {
1186
- if (!e) return {};
1187
- let { onCreated: t, onRestored: n } = e;
1188
- return {
1189
- ...typeof t == "function" ? { onCreated: t } : {},
1190
- ...typeof n == "function" ? { onRestored: n } : {}
1191
- };
1192
- }
1193
- function G(e) {
1194
- return e.length < 2 ? e.join("") : e.length === 2 ? e.join(" and ") : `${e.slice(0, -1).join(", ")} and ${e[e.length - 1]}`;
1195
- }
1196
- async function K(n) {
1197
- let { config: i, cloudTranslations: d } = n;
1198
- i.localization !== void 0 && o.warn("initCloud ignores `localization`; the Cloud editor does not support language versions."), i.translation !== void 0 && o.warn("initCloud ignores `translation`; the Cloud editor does not support translation.");
1199
- let f = null, p = null, m = null, h = null, g = r(null), _ = r(null);
1200
- function v() {
1201
- if (!f) throw Error("[Templatical] The Cloud editor is not mounted yet.");
1202
- return f;
1203
- }
1204
- function y() {
1205
- return f?.state.template?.id ?? null;
1206
- }
1207
- let x = new u({
1208
- ...i.auth,
1209
- onError: (e) => {
1210
- l(e) && (g.value = e), i.onError?.(e);
1211
- }
1212
- }), S = ce({
1213
- authManager: x,
1214
- onError: i.onError
1215
- });
1216
- await x.initialize();
1217
- let C = await L({ authManager: x });
1218
- if (!C.api.ok) throw Error("Health check failed: API is not reachable");
1219
- if (!C.auth.ok) throw Error(`Health check failed: authentication error${C.auth.error ? ` - ${C.auth.error}` : ""}`);
1220
- C.websocket.ok || o.warn("WebSocket health check failed:", C.websocket.error ?? "unknown error", "-- real-time features will be disabled."), await S.fetchConfig(), g.value = null;
1221
- let w = i.templates, T = [
1222
- "load",
1223
- "create",
1224
- "save"
1225
- ].filter((e) => w?.[e] !== void 0);
1226
- T.length > 0 && o.warn(`initCloud ignores ${G(T.map((e) => `templates.${e}`))} — the template id is the join key for version history, comments and the server-side export, so an id Cloud never issued would break them. Your event handlers were kept. Use init() to bring your own storage.`);
1227
- let E = i.versionHistory, D = [
1228
- "list",
1229
- "get",
1230
- "create",
1231
- "restore"
1232
- ].filter((e) => E?.[e] !== void 0);
1233
- D.length > 0 && o.warn(`initCloud ignores ${G(D.map((e) => `versionHistory.${e}`))} — a version is keyed to a template id Cloud issued, so Cloud owns its history. Your event handlers were kept. Use init() to bring your own storage.`);
1234
- let k = i.comments, M = [
1235
- "list",
1236
- "create",
1237
- "update",
1238
- "delete",
1239
- "setResolved",
1240
- "subscribe"
1241
- ].filter((e) => k?.[e] !== void 0);
1242
- M.length > 0 && o.warn(`initCloud ignores ${G(M.map((e) => `comments.${e}`))} — a comment is keyed to a template id Cloud issued, and its author is signed by the auth token, so Cloud owns the conversation. Your event handlers were kept. Use init() to bring your own storage.`), i.render && o.warn("initCloud does not accept a `render` provider — Cloud renders server-side for test email, sends and exports, so a supplied renderer would change only what you preview and export, never what Cloud delivers. The supplied provider is ignored. For your own MJML, call renderToMjml(editor.getContent()) from @templatical/renderer."), i.ai !== void 0 && o.warn("initCloud does not take an `ai` key yet — Cloud's AI arrives as its own provider in a later release. The key is ignored. To bring your own AI backend, use init({ ai }).");
1243
- function N(e) {
1244
- let t = S.config.value?.websocket;
1245
- m && t && m.connect(e.id, b(t));
1246
- }
1247
- let P = re(x), F = P.create, I = P.save, H = {
1248
- ...U(i.templates),
1249
- load: async (e) => {
1250
- let t = await P.load(e);
1251
- return N(t), t;
1252
- },
1253
- create: typeof F == "function" ? async (e) => {
1254
- let t = await F(e);
1255
- return N(t), t;
1256
- } : !1,
1257
- save: typeof I == "function" ? async (e, t) => {
1258
- if (p && f) {
1259
- let e = p.registry;
1260
- await a(f.content.value, {
1261
- renderCustomBlock: e.renderCustomBlock,
1262
- getCustomBlockStylesheet: (t) => e.getDefinition(t)?.stylesheet
1263
- });
1264
- }
1265
- return I(e, t);
1266
- } : !1
1267
- }, K = j({
1268
- authManager: x,
1269
- getTemplateId: y,
1270
- save: () => v().save()
1271
- }), pe = {
1272
- ...fe(i.versionHistory),
1273
- ...ae(x)
1274
- }, me = {
1275
- ...W(i.comments),
1276
- ...ee({
1277
- authManager: x,
1278
- channel: _,
1279
- getSocketId: () => m?.getSocketId() ?? null
1280
- })
1281
- }, he = x.userConfig ? {
1282
- id: x.userConfig.id,
1283
- name: x.userConfig.name
1284
- } : void 0, q = typeof i.savedBlocks?.list == "function" ? i.savedBlocks : null;
1285
- if (q === null && typeof i.savedBlocks == "object" && i.savedBlocks !== null) {
1286
- let e = i.savedBlocks, t = [
1287
- "list",
1288
- "create",
1289
- "update",
1290
- "delete"
1291
- ].filter((t) => e[t] !== void 0);
1292
- t.length > 0 && o.warn(`initCloud ignores ${G(t.map((e) => `savedBlocks.${e}`))} — a provider needs a working list to replace Cloud's store, and this value has none, so it configures Cloud's own store instead. Your event handlers were kept. Use init() to bring your own storage.`);
1293
- }
1294
- let J = i.savedBlocks === !1 ? void 0 : q ?? {
1295
- ...le(i.savedBlocks),
1296
- ...ne(x)
1297
- }, Y = oe({
1298
- authManager: x,
1299
- isAuthReady: r(!0)
1300
- }), ge = A({ authManager: x }), X = typeof i.testEmail?.send == "function" ? i.testEmail : null;
1301
- if (X === null && typeof i.testEmail == "object" && i.testEmail !== null) {
1302
- let e = i.testEmail, t = [
1303
- "send",
1304
- "includeMjml",
1305
- "allowedRecipients"
1306
- ].filter((t) => e[t] !== void 0);
1307
- t.length > 0 && o.warn(`initCloud ignores ${G(t.map((e) => `testEmail.${e}`))} — a provider needs a working send to replace Cloud's sender outright, and Cloud renders server-side with the signed allowlist from your project's JWT either way, so none of these apply here. Your event handlers were kept.`);
1308
- }
1309
- let _e = X ?? Object.assign(se({
1310
- authManager: x,
1311
- getTemplateId: y,
1312
- save: () => v().save(),
1313
- exportHtml: (e) => ge.exportHtml(e, ie(i.fonts)),
1314
- allowedEmails: Y.allowedEmails,
1315
- getSignature: Y.getSignature,
1316
- onBeforeTestEmail: i.onBeforeTestEmail
1317
- }), ue(i.testEmail)), Z = typeof i.media?.list == "function" ? i.media : null;
1318
- if (Z === null && typeof i.media == "object" && i.media !== null) {
1319
- let e = i.media, t = [
1320
- "list",
1321
- "create",
1322
- "update",
1323
- "delete"
1324
- ].filter((t) => e[t] !== void 0);
1325
- t.length > 0 && o.warn(`initCloud ignores ${G(t.map((e) => `media.${e}`))} — a provider needs a working list to replace Cloud's store, and this value has none, so it configures Cloud's own store instead. Your event handlers were kept. Use init() to bring your own storage.`);
1326
- let n = ["maxFileSize", "mimeTypes"].filter((t) => e[t] !== void 0);
1327
- n.length > 0 && o.warn(`initCloud ignores ${G(n.map((e) => `media.${e}`))} — Cloud's plan owns those limits whenever Cloud's store is in play. Your event handlers were kept.`);
1328
- }
1329
- let Q = i.media === !1 ? void 0 : Z ?? Object.assign(O(x, () => S.config.value), de(i.media)), $ = R({
1330
- planConfigInstance: S,
1331
- getTemplateId: y
1332
- });
1333
- function ve(n) {
1334
- f = n.editor, t(s, d), t(c, x);
1335
- let r = te({
1336
- authManager: x,
1337
- onError: i.onError
1338
- });
1339
- return m = r, e(r.channel, (e) => {
1340
- _.value = e;
1341
- }, { immediate: !0 }), {
1342
- websocket: r,
1343
- panelState: z(),
1344
- featureFlags: $
1345
- };
1346
- }
1347
- function ye(e) {
1348
- let { core: t, capabilities: n } = e;
1349
- return p = t, h = B({
1350
- issues: t.templateLint ? t.templateLint.issues : r([]),
1351
- planConfig: S.config
1352
- }), n.plan = S, i.customBlocks?.length && t.registerCustomBlocks(i.customBlocks), i.theme && (t.themeOverrides.value = i.theme), {
1353
- saveGate: h,
1354
- sessionError: g,
1355
- retry: async () => {
1356
- try {
1357
- await x.initialize(), g.value = null;
1358
- } catch (e) {
1359
- g.value = e instanceof Error ? e : /* @__PURE__ */ Error("Authentication failed");
1360
- }
1361
- }
1362
- };
1363
- }
1364
- return {
1365
- runtime: {
1366
- isSavedBlocksAvailable: q ? () => !0 : () => i.savedBlocks !== !1 && S.hasFeature("savedModules"),
1367
- isTestEmailAvailable: X ? () => !0 : () => Y.isEnabled.value && $.canSendTestEmail.value && $.hasTemplateSaved.value,
1368
- isCommentsAvailable: () => i.comments !== !1 && S.hasFeature("commenting") && $.hasTemplateSaved.value,
1369
- isBlockSaved: (e) => V(f?.state.template ?? null).has(e),
1370
- getSaveGate: () => h,
1371
- attach: ve,
1372
- ready: ye,
1373
- destroy() {
1374
- m?.disconnect(), i.onUnmount?.();
1375
- }
1376
- },
1377
- providers: {
1378
- templates: H,
1379
- render: K,
1380
- versionHistory: pe,
1381
- ...J ? { savedBlocks: J } : {},
1382
- testEmail: _e,
1383
- comments: me,
1384
- ...Q ? { media: Q } : {}
1385
- },
1386
- user: he
1387
- };
1388
- }
1389
- export { K as bootstrapCloud };