@templatical/editor 0.38.0 → 0.39.1

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 (289) hide show
  1. package/README.md +2 -4
  2. package/dist/{AiChatSidebar-tu4eLcf_.js → AiChatSidebar-pOxCZWz9.js} +67 -67
  3. package/dist/{AiFeatureMenu-BF0i0vA4.js → AiFeatureMenu-Bljk6Qjv.js} +7 -7
  4. package/dist/{BlockIssueBadge-DT-FqKeC.js → BlockIssueBadge-D5oGxOQP.js} +5 -5
  5. package/dist/{BlockPreviewCanvas-DDCmMram.js → BlockPreviewCanvas-DXGjUECG.js} +27 -27
  6. package/dist/{CloudHeaderExtras-NPhudovT.js → CloudHeaderExtras-DaocwNmy.js} +5 -5
  7. package/dist/{CloudPanels-Iwnky0iA.js → CloudPanels-CyZAnSJY.js} +7 -7
  8. package/dist/{CollaboratorBar-DAITu0hz.js → CollaboratorBar-C7Zca3g1.js} +4 -4
  9. package/dist/{CommentsPanel-CDvgmWP1.js → CommentsPanel-CNOb7YCm.js} +2 -2
  10. package/dist/{CommentsSidebar-X_xqM3dR.js → CommentsSidebar-VmwjU9va.js} +14 -14
  11. package/dist/{CountdownBlock-ZFJIdbP6.js → CountdownBlock-DSvbf3qU.js} +3 -3
  12. package/dist/{CountdownToolbar-DBFoG3a6.js → CountdownToolbar-C2kfS6Oy.js} +31 -30
  13. package/dist/{DesignReferenceSidebar--QtXjLrw.js → DesignReferenceSidebar-QC4gEUWp.js} +11 -11
  14. package/dist/{IssuesPanel-BLbNFMSX.js → IssuesPanel-DL2Xr14_.js} +8 -8
  15. package/dist/{LoadingTrack-BlTL4zFv.js → LoadingTrack-C2jKCU2d.js} +1 -1
  16. package/dist/LogicTagInsertButton-D8IwH-9Z.js +1071 -0
  17. package/dist/{MediaPanels-CMTAhDXB.js → MediaPanels-Cc4UkfG1.js} +2 -2
  18. package/dist/MergeTagInput-QI-5KG2R.js +81 -0
  19. package/dist/{MergeTagModeToggle-DKN6ihI5.js → MergeTagModeToggle-D793Bj_E.js} +32 -73
  20. package/dist/{ParagraphEditor-1E9yzOfk.js → ParagraphEditor-DkkPSexG.js} +50 -51
  21. package/dist/{RestoreVersionDialog-BMGUkcd8.js → RestoreVersionDialog-BgueZnZr.js} +5 -5
  22. package/dist/{RichTextEditorContent-BnxbQUV9.js → RichTextEditorContent-BC5UTVnb.js} +12 -12
  23. package/dist/{SaveBlockDialog-WKASpCCT.js → SaveBlockDialog-BuTuVlLr.js} +12 -11
  24. package/dist/{SavedBlocksBrowserModal-AYEXTMtQ.js → SavedBlocksBrowserModal-Srhix8BB.js} +17 -16
  25. package/dist/{SavedBlocksPanels-D_CpacTl.js → SavedBlocksPanels-B2iScCS-.js} +2 -2
  26. package/dist/{SavedBlocksPickBar-BHMwg-1G.js → SavedBlocksPickBar-cI7bDQQi.js} +4 -4
  27. package/dist/{TemplateScoringPanel-CSin43YM.js → TemplateScoringPanel-C2Rdlyn6.js} +104 -104
  28. package/dist/TemplateSettings-C_5leDdF.js +245 -0
  29. package/dist/{TestEmailModal-BxizsRCd.js → TestEmailModal-DJ5q_u4N.js} +55 -55
  30. package/dist/{TestEmailPanel-vd2e5HzT.js → TestEmailPanel-CP24UGst.js} +2 -2
  31. package/dist/{TitleEditor-CLJ68Ty4.js → TitleEditor-QBBOXtxx.js} +18 -18
  32. package/dist/ToggleSwitch-JvQ_CmI1.js +102 -0
  33. package/dist/Toolbar-COD2TW20.js +2426 -0
  34. package/dist/{TplModal-Q9fDgS1M.js → TplModal-C8xGjC1l.js} +5 -5
  35. package/dist/{VersionHistoryMenu-eGYVhM4H.js → VersionHistoryMenu-BVQityes.js} +10 -10
  36. package/dist/{VersionHistoryPanels-C7Ntrrfq.js → VersionHistoryPanels-BrK6na4A.js} +2 -2
  37. package/dist/{VersionPreviewBanner-BbQXnR0M.js → VersionPreviewBanner-BaMSgA1O.js} +3 -3
  38. package/dist/{blockTypeIcons-5qD4bB76.js → blockTypeIcons-CdXugKyV.js} +16 -37
  39. package/dist/bundle-stats.json +8 -8
  40. package/dist/{cdn/chunks/ca-D9S-UCfZ.js → ca-YlPDhElv.js} +5 -3
  41. package/dist/cdn/chunks/{AiChatSidebar-dyqqHAcI.js → AiChatSidebar-CjSEoK4x.js} +54 -54
  42. package/dist/cdn/chunks/AiChatSidebar-CjSEoK4x.js.map +1 -0
  43. package/dist/cdn/chunks/{AiFeatureMenu-BjVMwhW8.js → AiFeatureMenu-l0K5TOSn.js} +6 -6
  44. package/dist/cdn/chunks/{AiFeatureMenu-BjVMwhW8.js.map → AiFeatureMenu-l0K5TOSn.js.map} +1 -1
  45. package/dist/cdn/chunks/{BlockIssueBadge-BJ__oEtm.js → BlockIssueBadge-9hHpaXb9.js} +5 -5
  46. package/dist/cdn/chunks/{BlockIssueBadge-BJ__oEtm.js.map → BlockIssueBadge-9hHpaXb9.js.map} +1 -1
  47. package/dist/cdn/chunks/{BlockPreviewCanvas-B5f26eLE.js → BlockPreviewCanvas-lQrAdgG3.js} +30 -30
  48. package/dist/cdn/chunks/{BlockPreviewCanvas-B5f26eLE.js.map → BlockPreviewCanvas-lQrAdgG3.js.map} +1 -1
  49. package/dist/cdn/chunks/{CloudHeaderExtras-D5P5IEKA.js → CloudHeaderExtras-CXNe7Q-4.js} +5 -5
  50. package/dist/cdn/chunks/{CloudHeaderExtras-D5P5IEKA.js.map → CloudHeaderExtras-CXNe7Q-4.js.map} +1 -1
  51. package/dist/cdn/chunks/{CloudPanels-DkmR05nB.js → CloudPanels-bHhh9AUA.js} +6 -6
  52. package/dist/cdn/chunks/{CloudPanels-DkmR05nB.js.map → CloudPanels-bHhh9AUA.js.map} +1 -1
  53. package/dist/cdn/chunks/{CollaboratorBar-Yn7KSpt4.js → CollaboratorBar-DgqcaGGI.js} +5 -5
  54. package/dist/cdn/chunks/{CollaboratorBar-Yn7KSpt4.js.map → CollaboratorBar-DgqcaGGI.js.map} +1 -1
  55. package/dist/cdn/chunks/{CommentsPanel-CntwwocI.js → CommentsPanel-Cy4TlTHC.js} +3 -3
  56. package/dist/cdn/chunks/{CommentsPanel-CntwwocI.js.map → CommentsPanel-Cy4TlTHC.js.map} +1 -1
  57. package/dist/cdn/chunks/{CommentsSidebar-BLDKnKy7.js → CommentsSidebar-C7oAP3Mx.js} +5 -5
  58. package/dist/cdn/chunks/{CommentsSidebar-BLDKnKy7.js.map → CommentsSidebar-C7oAP3Mx.js.map} +1 -1
  59. package/dist/cdn/chunks/{CountdownBlock-B4AfqJwb.js → CountdownBlock-DdC8Lg5F.js} +4 -4
  60. package/dist/cdn/chunks/{CountdownBlock-B4AfqJwb.js.map → CountdownBlock-DdC8Lg5F.js.map} +1 -1
  61. package/dist/cdn/chunks/{CountdownToolbar-CA1dpuOI.js → CountdownToolbar-CN9h4nlC.js} +22 -21
  62. package/dist/cdn/chunks/{CountdownToolbar-CA1dpuOI.js.map → CountdownToolbar-CN9h4nlC.js.map} +1 -1
  63. package/dist/cdn/chunks/{DesignReferenceSidebar-D1Y9Hswe.js → DesignReferenceSidebar-Bjo0M-AY.js} +7 -7
  64. package/dist/cdn/chunks/{DesignReferenceSidebar-D1Y9Hswe.js.map → DesignReferenceSidebar-Bjo0M-AY.js.map} +1 -1
  65. package/dist/cdn/chunks/{IssuesPanel-Q62LTqvd.js → IssuesPanel-DdFk-Blf.js} +6 -6
  66. package/dist/cdn/chunks/{IssuesPanel-Q62LTqvd.js.map → IssuesPanel-DdFk-Blf.js.map} +1 -1
  67. package/dist/cdn/chunks/{LoadingTrack-Cm3TDKb3.js → LoadingTrack-Ba5xh5HD.js} +2 -2
  68. package/dist/cdn/chunks/{LoadingTrack-Cm3TDKb3.js.map → LoadingTrack-Ba5xh5HD.js.map} +1 -1
  69. package/dist/cdn/chunks/LogicTagInsertButton-DpyPozop.js +1035 -0
  70. package/dist/cdn/chunks/LogicTagInsertButton-DpyPozop.js.map +1 -0
  71. package/dist/cdn/chunks/{MediaPanels-D21M6shx.js → MediaPanels-kX9AZQ7K.js} +3 -3
  72. package/dist/cdn/chunks/{MediaPanels-D21M6shx.js.map → MediaPanels-kX9AZQ7K.js.map} +1 -1
  73. package/dist/cdn/chunks/MergeTagInput-ERJr7bP_.js +83 -0
  74. package/dist/cdn/chunks/MergeTagInput-ERJr7bP_.js.map +1 -0
  75. package/dist/cdn/chunks/{MergeTagModeToggle-DYxkAGtA.js → MergeTagModeToggle-n3nvSNeQ.js} +33 -33
  76. package/dist/cdn/chunks/{MergeTagModeToggle-DYxkAGtA.js.map → MergeTagModeToggle-n3nvSNeQ.js.map} +1 -1
  77. package/dist/cdn/chunks/{ParagraphEditor-Bd-GQXee.js → ParagraphEditor-DO4RzP8l.js} +43 -43
  78. package/dist/cdn/chunks/{ParagraphEditor-Bd-GQXee.js.map → ParagraphEditor-DO4RzP8l.js.map} +1 -1
  79. package/dist/cdn/chunks/{RestoreVersionDialog-2X9RpM9A.js → RestoreVersionDialog-CzZ_sFnz.js} +5 -5
  80. package/dist/cdn/chunks/{RestoreVersionDialog-2X9RpM9A.js.map → RestoreVersionDialog-CzZ_sFnz.js.map} +1 -1
  81. package/dist/cdn/chunks/{RichTextEditorContent-D_rb0rmU.js → RichTextEditorContent-Ch5zeyZ7.js} +9 -9
  82. package/dist/cdn/chunks/{RichTextEditorContent-D_rb0rmU.js.map → RichTextEditorContent-Ch5zeyZ7.js.map} +1 -1
  83. package/dist/cdn/chunks/{SaveBlockDialog-CufdTomT.js → SaveBlockDialog-LgxYrXyx.js} +10 -9
  84. package/dist/cdn/chunks/{SaveBlockDialog-CufdTomT.js.map → SaveBlockDialog-LgxYrXyx.js.map} +1 -1
  85. package/dist/cdn/chunks/{SavedBlocksBrowserModal-CqpaNsk7.js → SavedBlocksBrowserModal-CdeSsTpb.js} +9 -9
  86. package/dist/cdn/chunks/{SavedBlocksBrowserModal-CqpaNsk7.js.map → SavedBlocksBrowserModal-CdeSsTpb.js.map} +1 -1
  87. package/dist/cdn/chunks/{SavedBlocksPanels-DpxYxddo.js → SavedBlocksPanels-B5hakNJj.js} +3 -3
  88. package/dist/cdn/chunks/{SavedBlocksPanels-DpxYxddo.js.map → SavedBlocksPanels-B5hakNJj.js.map} +1 -1
  89. package/dist/cdn/chunks/{SavedBlocksPickBar-Drpoav1B.js → SavedBlocksPickBar-Cl6PLwwV.js} +5 -5
  90. package/dist/cdn/chunks/{SavedBlocksPickBar-Drpoav1B.js.map → SavedBlocksPickBar-Cl6PLwwV.js.map} +1 -1
  91. package/dist/cdn/chunks/{TemplateScoringPanel-DBjUNULq.js → TemplateScoringPanel--JxR6CsQ.js} +86 -86
  92. package/dist/cdn/chunks/TemplateScoringPanel--JxR6CsQ.js.map +1 -0
  93. package/dist/cdn/chunks/TemplateSettings-DjXiiiNr.js +207 -0
  94. package/dist/cdn/chunks/TemplateSettings-DjXiiiNr.js.map +1 -0
  95. package/dist/cdn/chunks/{TestEmailModal-BTNlSW6f.js → TestEmailModal-BAuDxJtD.js} +53 -53
  96. package/dist/cdn/chunks/TestEmailModal-BAuDxJtD.js.map +1 -0
  97. package/dist/cdn/chunks/{TestEmailPanel-D0A9Zgxr.js → TestEmailPanel-GUGZisLp.js} +3 -3
  98. package/dist/cdn/chunks/{TestEmailPanel-D0A9Zgxr.js.map → TestEmailPanel-GUGZisLp.js.map} +1 -1
  99. package/dist/cdn/chunks/{TitleEditor-CrnuIq62.js → TitleEditor-uKu33Nwr.js} +16 -16
  100. package/dist/cdn/chunks/TitleEditor-uKu33Nwr.js.map +1 -0
  101. package/dist/cdn/chunks/ToggleSwitch-CDy8OfcB.js +104 -0
  102. package/dist/cdn/chunks/ToggleSwitch-CDy8OfcB.js.map +1 -0
  103. package/dist/cdn/chunks/Toolbar-dxDYwN5E.js +2385 -0
  104. package/dist/cdn/chunks/Toolbar-dxDYwN5E.js.map +1 -0
  105. package/dist/cdn/chunks/{TplModal-DYXrTz42.js → TplModal-DuwS2ifK.js} +5 -5
  106. package/dist/cdn/chunks/{TplModal-DYXrTz42.js.map → TplModal-DuwS2ifK.js.map} +1 -1
  107. package/dist/cdn/chunks/{VersionHistoryMenu-bDGnE4hb.js → VersionHistoryMenu-Dij1pTEb.js} +6 -6
  108. package/dist/cdn/chunks/{VersionHistoryMenu-bDGnE4hb.js.map → VersionHistoryMenu-Dij1pTEb.js.map} +1 -1
  109. package/dist/cdn/chunks/{VersionHistoryPanels-82P0Q0HM.js → VersionHistoryPanels-GeR6MStB.js} +3 -3
  110. package/dist/cdn/chunks/{VersionHistoryPanels-82P0Q0HM.js.map → VersionHistoryPanels-GeR6MStB.js.map} +1 -1
  111. package/dist/cdn/chunks/{VersionPreviewBanner-BJiwKkVC.js → VersionPreviewBanner-Df3FVlig.js} +4 -4
  112. package/dist/cdn/chunks/{VersionPreviewBanner-BJiwKkVC.js.map → VersionPreviewBanner-Df3FVlig.js.map} +1 -1
  113. package/dist/cdn/chunks/{blockTypeIcons-CNjJSFun.js → blockTypeIcons-raBjStuv.js} +2 -2
  114. package/dist/cdn/chunks/{blockTypeIcons-CNjJSFun.js.map → blockTypeIcons-raBjStuv.js.map} +1 -1
  115. package/dist/{ca-D9S-UCfZ.js → cdn/chunks/ca-YlPDhElv.js} +7 -1
  116. package/dist/cdn/chunks/{ca-D9S-UCfZ.js.map → ca-YlPDhElv.js.map} +1 -1
  117. package/dist/cdn/chunks/{cloud-BLgCKP7Z.js → cloud-eaXyxZ8l.js} +2 -2
  118. package/dist/cdn/chunks/{cloud-BLgCKP7Z.js.map → cloud-eaXyxZ8l.js.map} +1 -1
  119. package/dist/cdn/chunks/{createCloudRuntime-U-qCH-dq.js → createCloudRuntime-D5bXzcTe.js} +6 -6
  120. package/dist/cdn/chunks/{createCloudRuntime-U-qCH-dq.js.map → createCloudRuntime-D5bXzcTe.js.map} +1 -1
  121. package/dist/cdn/chunks/{de-BUPszLpi.js → de-CONjnzrF.js} +6 -2
  122. package/dist/cdn/chunks/{de-BUPszLpi.js.map → de-CONjnzrF.js.map} +1 -1
  123. package/dist/cdn/chunks/{dist-BW6Y49zE.js → dist-BRZhN8qJ.js} +4 -4
  124. package/dist/cdn/chunks/dist-BRZhN8qJ.js.map +1 -0
  125. package/dist/cdn/chunks/{dist-CAFTQ6Y2.js → dist-CXB2_kBa.js} +27 -22
  126. package/dist/cdn/chunks/dist-CXB2_kBa.js.map +1 -0
  127. package/dist/cdn/chunks/{draggable-kbOhCgnk.js → draggable-IB4x6w2O.js} +1477 -1470
  128. package/dist/cdn/chunks/draggable-IB4x6w2O.js.map +1 -0
  129. package/dist/cdn/chunks/{editor-modal-MXgtarMl.js → editor-modal-C_xYN_66.js} +7 -7
  130. package/dist/cdn/chunks/{editor-modal-MXgtarMl.js.map → editor-modal-C_xYN_66.js.map} +1 -1
  131. package/dist/cdn/chunks/{en-BbOC5x3w.js → en-BAMooiOF.js} +6 -2
  132. package/dist/cdn/chunks/{en-BbOC5x3w.js.map → en-BAMooiOF.js.map} +1 -1
  133. package/dist/cdn/chunks/en-BwfjKb4M.js +2 -0
  134. package/dist/{es-0bCDcT9p.js → cdn/chunks/es-I47lHs2m.js} +7 -1
  135. package/dist/cdn/chunks/{es-0bCDcT9p.js.map → es-I47lHs2m.js.map} +1 -1
  136. package/dist/cdn/chunks/{extensions-B8_jnIkD.js → extensions-Bhu8UEE5.js} +185 -100
  137. package/dist/cdn/chunks/extensions-Bhu8UEE5.js.map +1 -0
  138. package/dist/cdn/chunks/{fr-Brr8mJ9e.js → fr-B8MIKjT4.js} +6 -2
  139. package/dist/cdn/chunks/{fr-Brr8mJ9e.js.map → fr-B8MIKjT4.js.map} +1 -1
  140. package/dist/cdn/chunks/htmlparser-ClUZ6waR.js +1113 -0
  141. package/dist/cdn/chunks/htmlparser-ClUZ6waR.js.map +1 -0
  142. package/dist/cdn/chunks/{icons-BUlqGSgd.js → icons-BKkJ-5xF.js} +36 -36
  143. package/dist/cdn/chunks/{icons-BUlqGSgd.js.map → icons-BKkJ-5xF.js.map} +1 -1
  144. package/dist/cdn/chunks/keys-dJbD1QPs.js +12 -0
  145. package/dist/cdn/chunks/keys-dJbD1QPs.js.map +1 -0
  146. package/dist/{nl-Co3_RL0M.js → cdn/chunks/nl-CBLxcb-0.js} +7 -1
  147. package/dist/cdn/chunks/{nl-Co3_RL0M.js.map → nl-CBLxcb-0.js.map} +1 -1
  148. package/dist/{pt-BR-BECez5b0.js → cdn/chunks/pt-BR-CMSRfX7t.js} +7 -1
  149. package/dist/cdn/chunks/{pt-BR-BECez5b0.js.map → pt-BR-CMSRfX7t.js.map} +1 -1
  150. package/dist/cdn/chunks/socialIcons-9VrG8X3m.js +1054 -0
  151. package/dist/cdn/chunks/socialIcons-9VrG8X3m.js.map +1 -0
  152. package/dist/cdn/chunks/{src-IGLRmUar.js → src-CZ-W8YBa.js} +4 -4
  153. package/dist/cdn/chunks/{src-IGLRmUar.js.map → src-CZ-W8YBa.js.map} +1 -1
  154. package/dist/cdn/chunks/{src-CUvZWL6Y.js → src-CaNsA_WX.js} +2 -2
  155. package/dist/cdn/chunks/{src-CUvZWL6Y.js.map → src-CaNsA_WX.js.map} +1 -1
  156. package/dist/cdn/chunks/src-Dwgq7hf4.js.map +1 -1
  157. package/dist/cdn/chunks/templateSettingsFields-YCFVBVYh.js +36 -0
  158. package/dist/cdn/chunks/templateSettingsFields-YCFVBVYh.js.map +1 -0
  159. package/dist/cdn/chunks/{tiptap-Epe8m3Vo.js → tiptap-DhLuKyDc.js} +2776 -2773
  160. package/dist/cdn/chunks/tiptap-DhLuKyDc.js.map +1 -0
  161. package/dist/cdn/chunks/{useAliveFlag-CT9gjvO_.js → useAliveFlag-DAlQLbM2.js} +2 -2
  162. package/dist/cdn/chunks/{useAliveFlag-CT9gjvO_.js.map → useAliveFlag-DAlQLbM2.js.map} +1 -1
  163. package/dist/cdn/chunks/{useCloudI18n-DSWSGj-A.js → useCloudI18n-C09JcFS0.js} +3 -3
  164. package/dist/cdn/chunks/{useCloudI18n-DSWSGj-A.js.map → useCloudI18n-C09JcFS0.js.map} +1 -1
  165. package/dist/cdn/chunks/useEditorCore-BHmIp1hW.js +2592 -0
  166. package/dist/cdn/chunks/useEditorCore-BHmIp1hW.js.map +1 -0
  167. package/dist/cdn/chunks/useEditorRoot-DFx2fXJP.js +10 -0
  168. package/dist/cdn/chunks/{useEditorRoot-B0zW2nT4.js.map → useEditorRoot-DFx2fXJP.js.map} +1 -1
  169. package/dist/cdn/chunks/{useI18n-Dlo7R9RA.js → useI18n-DTZ9sIcv.js} +3 -3
  170. package/dist/cdn/chunks/{useI18n-Dlo7R9RA.js.map → useI18n-DTZ9sIcv.js.map} +1 -1
  171. package/dist/cdn/chunks/useLogicTag-E2V0Xdcb.js +38 -0
  172. package/dist/cdn/chunks/useLogicTag-E2V0Xdcb.js.map +1 -0
  173. package/dist/cdn/chunks/useMergeTag-BE8oDoha.js +60 -0
  174. package/dist/cdn/chunks/useMergeTag-BE8oDoha.js.map +1 -0
  175. package/dist/cdn/chunks/{usePopoverPosition-ElP3ABaV.js → usePopoverPosition-gB9q-ql7.js} +3 -3
  176. package/dist/cdn/chunks/{usePopoverPosition-ElP3ABaV.js.map → usePopoverPosition-gB9q-ql7.js.map} +1 -1
  177. package/dist/cdn/chunks/{useScrollToBlock-nTbWkgaU.js → useScrollToBlock-CtTXwmiU.js} +3 -3
  178. package/dist/cdn/chunks/{useScrollToBlock-nTbWkgaU.js.map → useScrollToBlock-CtTXwmiU.js.map} +1 -1
  179. package/dist/cdn/editor.css +1 -1
  180. package/dist/cdn/editor.js +856 -3347
  181. package/dist/cdn/editor.js.map +1 -1
  182. package/dist/{check-DWtkBzBU.js → check-eqb2JhqU.js} +1 -1
  183. package/dist/{chevron-down-C-Fjxcqj.js → chevron-down-Dkr-7Ywl.js} +1 -1
  184. package/dist/{chevron-right-SOkn2d4P.js → chevron-right-Bge4XF_B.js} +1 -1
  185. package/dist/{chevron-up-lntU1ypp.js → chevron-up-CQAyl0kC.js} +1 -1
  186. package/dist/{circle-alert-CjzUTwy3.js → circle-alert-CYgTHKWr.js} +1 -1
  187. package/dist/{clock-pB2QKPsJ.js → clock-BgSJZJP5.js} +1 -1
  188. package/dist/{cloud-DdidMW6f.js → cloud-C9xWZXhg.js} +1 -1
  189. package/dist/{copy-CId1E038.js → copy-mw6PVnOJ.js} +1 -1
  190. package/dist/{createCloudRuntime-x5WZm3p8.js → createCloudRuntime-BGd5--Bq.js} +5 -5
  191. package/dist/{createLucideIcon-Cwf_nTzE.js → createLucideIcon-BxY5yz5u.js} +6 -6
  192. package/dist/{de-BUPszLpi.js → de-CONjnzrF.js} +5 -1
  193. package/dist/{dist-D8i1ixHK.js → dist-8VFzbeu9.js} +3 -3
  194. package/dist/{dist-DBirAJIs.js → dist-BDuPwOyn.js} +26 -21
  195. package/dist/{dist-CtF9STPS.js → dist-BJM3eFyT.js} +1 -1
  196. package/dist/{dist-DkcA6epL.js → dist-BdHF7nyq.js} +3 -3
  197. package/dist/{dist-ByT5fgKq.js → dist-Bl4rxpX9.js} +1 -1
  198. package/dist/{dist-BVqAYoRB.js → dist-BmsLcnrO.js} +4 -4
  199. package/dist/{dist-CtMXAH7a.js → dist-BxVnMgXZ.js} +1 -1
  200. package/dist/{dist-DC-3T0ED.js → dist-CQSVro7b.js} +1 -1
  201. package/dist/{dist-f7HXo6j6.js → dist-DQbOebGW.js} +1 -1
  202. package/dist/{dist-DL9334yz.js → dist-DerFNpDY.js} +3 -3
  203. package/dist/{dist-D08oVYhr.js → dist-Djmzp6wi.js} +1 -1
  204. package/dist/{dist-D7WY8VPq.js → dist-DyrEOKEJ.js} +1 -1
  205. package/dist/{dist-DzdeVn-W.js → dist-EDkj3Ub1.js} +1 -1
  206. package/dist/{dist-C1tsW_99.js → dist-wyXxj3R1.js} +1 -1
  207. package/dist/{editor-modal-B_LaQf0s.js → editor-modal-OPhP71YO.js} +20 -20
  208. package/dist/{en-BbOC5x3w.js → en-BAMooiOF.js} +5 -1
  209. package/dist/en-CjNopehs.js +2 -0
  210. package/dist/{cdn/chunks/es-0bCDcT9p.js → es-I47lHs2m.js} +5 -3
  211. package/dist/extensions-DRN-elXT.js +1645 -0
  212. package/dist/{eye-BuGtFUoJ.js → eye-DphkRtAD.js} +1 -1
  213. package/dist/{fr-Brr8mJ9e.js → fr-B8MIKjT4.js} +5 -1
  214. package/dist/{image-up-gH4JEpU5.js → image-up-Qi2BXD7T.js} +1 -1
  215. package/dist/index.d.ts +15 -0
  216. package/dist/{info-BQ60P82u.js → info-VSyAs02q.js} +1 -1
  217. package/dist/keys-BdoSgsz9.js +10 -0
  218. package/dist/{link-3R8it3J7.js → link-CNuozGqD.js} +1 -1
  219. package/dist/{list-Ccdgj46T.js → list-BA0I5Wmu.js} +1 -1
  220. package/dist/{loader-circle-B_tAD4k6.js → loader-circle-z5eeqasv.js} +1 -1
  221. package/dist/{message-circle-P-KSc6V0.js → message-circle-BsQ9hEup.js} +1 -1
  222. package/dist/{cdn/chunks/nl-Co3_RL0M.js → nl-CBLxcb-0.js} +5 -3
  223. package/dist/package-OkXfuRoO.js +25 -0
  224. package/dist/{pencil-9ZiwqS4r.js → pencil-DFVFA7Dj.js} +1 -1
  225. package/dist/{plus-BwJEzCaO.js → plus-D8bkVjZ7.js} +1 -1
  226. package/dist/{cdn/chunks/pt-BR-BECez5b0.js → pt-BR-CMSRfX7t.js} +5 -3
  227. package/dist/{refresh-cw-DEgfb2FK.js → refresh-cw-DPB7YFuz.js} +1 -1
  228. package/dist/{runtime-dom.esm-bundler-PnoZU512.js → runtime-dom.esm-bundler-BGbPz4-g.js} +2 -2
  229. package/dist/{search-DqQ8Li5E.js → search-C-dCgqIa.js} +1 -1
  230. package/dist/{send-CE6uvqop.js → send-Cm2fy2zm.js} +1 -1
  231. package/dist/{shield-check-DhD1Z3rd.js → shield-check-COgBYFDF.js} +1 -1
  232. package/dist/smartphone-v0u_MOEV.js +46 -0
  233. package/dist/socialIcons-DkGcpEwC.js +1130 -0
  234. package/dist/{sparkles-R0ZQHa6F.js → sparkles-Ds0RF8Iu.js} +1 -1
  235. package/dist/style.css +1 -1
  236. package/dist/templateSettingsFields-YCFVBVYh.js +34 -0
  237. package/dist/templatical-editor.js +945 -3511
  238. package/dist/{text-align-start-DSux2UNn.js → text-align-start-DiavaIm6.js} +1 -1
  239. package/dist/{trash-Cf_SqsER.js → trash-DnOkfu2V.js} +1 -1
  240. package/dist/{triangle-alert-C6tGa6jw.js → triangle-alert-DGLAyXnh.js} +1 -1
  241. package/dist/{upload-DusKjpVr.js → upload-BBDme2cy.js} +1 -1
  242. package/dist/{useAliveFlag-oyByIcjy.js → useAliveFlag-BkKyhkwZ.js} +1 -1
  243. package/dist/{useCloudI18n-BLyh_e2T.js → useCloudI18n-D1iedlP3.js} +2 -2
  244. package/dist/useEditorCore-C5APBjjV.js +4097 -0
  245. package/dist/{useEditorRoot-ds57-l6F.js → useEditorRoot-BOxn5EfP.js} +2 -2
  246. package/dist/{useI18n-BbdxxpOE.js → useI18n-Ds_-druD.js} +2 -2
  247. package/dist/useLogicTag-DoHfc08B.js +36 -0
  248. package/dist/useMergeTag-DXyum3kG.js +58 -0
  249. package/dist/{usePopoverPosition-CprM5p-c.js → usePopoverPosition-Du-Ah8E9.js} +2 -2
  250. package/dist/{useScrollToBlock-BTFw0b9O.js → useScrollToBlock-DXQYPCnJ.js} +3 -3
  251. package/dist/{vue.runtime.esm-bundler-DShF3P6k.js → vue.runtime.esm-bundler-CyqhBwpY.js} +1133 -1126
  252. package/dist/{x-D_-42Ukq.js → x-3BHV3Q6K.js} +1 -1
  253. package/package.json +16 -16
  254. package/dist/ColorPicker-BqlZ_TqG.js +0 -501
  255. package/dist/FieldRow-C8nOknr_.js +0 -128
  256. package/dist/MergeTagInput-BEjzj4Iu.js +0 -457
  257. package/dist/MergeTagSuggestion-DKoLEeoj.js +0 -1329
  258. package/dist/cdn/chunks/AiChatSidebar-dyqqHAcI.js.map +0 -1
  259. package/dist/cdn/chunks/ColorPicker-LcrzgMoW.js +0 -502
  260. package/dist/cdn/chunks/ColorPicker-LcrzgMoW.js.map +0 -1
  261. package/dist/cdn/chunks/FieldRow-D9OJhYeb.js +0 -130
  262. package/dist/cdn/chunks/FieldRow-D9OJhYeb.js.map +0 -1
  263. package/dist/cdn/chunks/MergeTagInput-l7paaAml.js +0 -419
  264. package/dist/cdn/chunks/MergeTagInput-l7paaAml.js.map +0 -1
  265. package/dist/cdn/chunks/MergeTagSuggestion-t8Uj00Er.js +0 -215
  266. package/dist/cdn/chunks/MergeTagSuggestion-t8Uj00Er.js.map +0 -1
  267. package/dist/cdn/chunks/TemplateScoringPanel-DBjUNULq.js.map +0 -1
  268. package/dist/cdn/chunks/TestEmailModal-BTNlSW6f.js.map +0 -1
  269. package/dist/cdn/chunks/TitleEditor-CrnuIq62.js.map +0 -1
  270. package/dist/cdn/chunks/dist-BW6Y49zE.js.map +0 -1
  271. package/dist/cdn/chunks/dist-CAFTQ6Y2.js.map +0 -1
  272. package/dist/cdn/chunks/draggable-kbOhCgnk.js.map +0 -1
  273. package/dist/cdn/chunks/en-C9U7N77n.js +0 -2
  274. package/dist/cdn/chunks/extensions-B8_jnIkD.js.map +0 -1
  275. package/dist/cdn/chunks/htmlparser-DTML8Gvz.js +0 -1007
  276. package/dist/cdn/chunks/htmlparser-DTML8Gvz.js.map +0 -1
  277. package/dist/cdn/chunks/keys-DBFhDFng.js +0 -12
  278. package/dist/cdn/chunks/keys-DBFhDFng.js.map +0 -1
  279. package/dist/cdn/chunks/tiptap-Epe8m3Vo.js.map +0 -1
  280. package/dist/cdn/chunks/useEditorCore-Cs7rYVBo.js +0 -3689
  281. package/dist/cdn/chunks/useEditorCore-Cs7rYVBo.js.map +0 -1
  282. package/dist/cdn/chunks/useEditorRoot-B0zW2nT4.js +0 -10
  283. package/dist/cdn/chunks/useMergeTag-BYAifvh8.js +0 -46
  284. package/dist/cdn/chunks/useMergeTag-BYAifvh8.js.map +0 -1
  285. package/dist/en-DcmpWV53.js +0 -2
  286. package/dist/extensions-CHOBZRab.js +0 -445
  287. package/dist/keys-DQA2i1k1.js +0 -10
  288. package/dist/useEditorCore-DhlKOYwe.js +0 -5273
  289. package/dist/useMergeTag-DlvOBW_B.js +0 -44
@@ -1,3689 +0,0 @@
1
- import { A as e, B as t, E as n, F as r, H as i, I as a, K as o, N as s, P as c, Q as l, R as u, S as d, U as f, W as p, X as m, Y as h, Z as g, at as _, b as v, c as y, ct as b, et as x, f as S, g as C, h as w, it as T, j as E, k as D, l as O, lt as k, m as A, ot as j, p as M, q as N, rt as P, s as F, t as I, u as L, ut as R, w as z, x as B, y as V } from "./draggable-kbOhCgnk.js";
2
- import { A as H, B as ee, C as te, D as ne, E as re, F as ie, H as ae, I as oe, L as U, M as se, N as ce, O as le, P as ue, R as de, S as fe, T as pe, V as me, W as he, _ as ge, a as _e, b as ve, d as ye, f as be, g as xe, h as Se, i as W, it as Ce, j as we, k as Te, l as Ee, m as De, n as Oe, nt as ke, o as Ae, p as je, r as Me, rt as Ne, s as Pe, t as G, u as Fe, w as Ie, z as Le } from "./src-Dwgq7hf4.js";
3
- import { _ as Re, h as ze, v as Be, y as Ve } from "./dist-BW6Y49zE.js";
4
- import { a as K, c as He, i as Ue, r as We } from "./dist-CAFTQ6Y2.js";
5
- import { A as Ge, C as Ke, D as q, E as qe, F as Je, G as Ye, H as Xe, I as Ze, J, K as Qe, L as $e, M as et, N as tt, O as nt, P as rt, R as it, S as at, T as ot, U as st, W as ct, Y as lt, _ as ut, a as dt, b as ft, c as pt, d as mt, f as ht, g as Y, h as gt, j as _t, k as vt, l as yt, m as bt, n as xt, o as St, p as Ct, q as wt, r as Tt, s as Et, v as Dt, w as Ot, x as kt, y as At, z as jt } from "./keys-DBFhDFng.js";
6
- import "./timeouts-DHPZQ0G3.js";
7
- import { t as X } from "./useI18n-Dlo7R9RA.js";
8
- import { t as Z } from "./logger-ByvdoAwq.js";
9
- import { a as Mt, i as Nt, o as Pt, r as Ft, t as It } from "./usePopoverPosition-ElP3ABaV.js";
10
- import { A as Lt, Bt as Rt, Et as zt, H as Bt, Ot as Vt, Tt as Ht, X as Ut, d as Wt, ft as Gt, ht as Kt, it as qt, o as Jt, s as Yt, tt as Xt, u as Zt, v as Qt, vt as $t, zt as en } from "./icons-BUlqGSgd.js";
11
- import { t as tn } from "./LoadingTrack-Cm3TDKb3.js";
12
- import { t as nn } from "./_plugin-vue_export-helper-B3ysoDQm.js";
13
- import { t as rn } from "./useEditorRoot-B0zW2nT4.js";
14
- import "./useCloudI18n-DSWSGj-A.js";
15
- import { t as an } from "./useMergeTag-BYAifvh8.js";
16
- import { t as on } from "./useAliveFlag-CT9gjvO_.js";
17
- //#region ../core/src/error-reporting.ts
18
- function sn(e) {
19
- return e instanceof Error ? e : Error(String(e), { cause: e });
20
- }
21
- function cn(e, t) {
22
- try {
23
- t();
24
- } catch (t) {
25
- e?.(sn(t));
26
- }
27
- }
28
- //#endregion
29
- //#region ../core/src/editor.ts
30
- function ln(e) {
31
- return e === "1" ? 1 : e === "3" ? 3 : 2;
32
- }
33
- function un(e) {
34
- let t = m({
35
- template: null,
36
- content: e.content ?? Le(e.defaultFontFamily, e.templateDefaults),
37
- selectedBlockId: null,
38
- viewport: "desktop",
39
- darkMode: !1,
40
- previewMode: !1,
41
- isDirty: !1,
42
- isSaving: !1,
43
- isLoading: !1,
44
- uiTheme: "auto"
45
- }), n = 0;
46
- function r() {
47
- t.isDirty = !0, n++;
48
- }
49
- let i = p({
50
- get: () => t.content,
51
- set: (e) => {
52
- t.content = e, r();
53
- }
54
- }), a = p(() => t.selectedBlockId ? o(t.content.blocks, t.selectedBlockId) : null);
55
- function o(e, t) {
56
- for (let n of e) {
57
- if (n.id === t) return n;
58
- if (n.type === "section") for (let e of n.children) {
59
- let n = o(e, t);
60
- if (n) return n;
61
- }
62
- }
63
- return null;
64
- }
65
- function s(e, t) {
66
- if (t.add(e.id), e.type === "section") for (let n of e.children) for (let e of n) s(e, t);
67
- }
68
- function c(e, t, n = { blocks: e }) {
69
- for (let r = 0; r < e.length; r++) {
70
- let i = e[r];
71
- if (i.id === t) return n;
72
- if (i.type === "section") for (let e = 0; e < i.children.length; e++) {
73
- let n = c(i.children[e], t, {
74
- blocks: i.children[e],
75
- sectionId: i.id,
76
- columnIndex: e
77
- });
78
- if (n) return n;
79
- }
80
- }
81
- return null;
82
- }
83
- function l(t) {
84
- return e.lockedBlocks?.value.has(t) ?? !1;
85
- }
86
- function u(e) {
87
- let n = c(t.content.blocks, e);
88
- if (!n) return null;
89
- let r = n.blocks.findIndex((t) => t.id === e);
90
- return r === -1 ? null : {
91
- targetSectionId: n.sectionId,
92
- columnIndex: n.columnIndex,
93
- index: r
94
- };
95
- }
96
- function d(e, n = !0) {
97
- t.content = e, n && r();
98
- }
99
- function f(e) {
100
- e && l(e) || (t.selectedBlockId = e);
101
- }
102
- function h(e) {
103
- t.viewport = e;
104
- }
105
- function _(e) {
106
- t.darkMode = e;
107
- }
108
- function v(e) {
109
- t.uiTheme = e;
110
- }
111
- function y(e) {
112
- t.previewMode = e, e && (t.selectedBlockId = null);
113
- }
114
- function b(e, n) {
115
- if (l(e)) return;
116
- let i = o(t.content.blocks, e);
117
- i && (Object.assign(i, n), r());
118
- }
119
- function x(e) {
120
- t.content.settings = {
121
- ...t.content.settings,
122
- ...e
123
- }, r();
124
- }
125
- function S(e, n, i = 0, a) {
126
- if (!(n && e.type === "section")) {
127
- if (n) {
128
- if (l(n)) return;
129
- let r = o(t.content.blocks, n);
130
- if (r && r.type === "section") {
131
- if (i < 0 || i >= ln(r.columns)) return;
132
- r.children[i] = r.children[i] || [];
133
- let t = r.children[i];
134
- a !== void 0 && a < t.length ? t.splice(a, 0, e) : t.push(e);
135
- }
136
- } else a !== void 0 && a < t.content.blocks.length ? t.content.blocks.splice(a, 0, e) : t.content.blocks.push(e);
137
- r();
138
- }
139
- }
140
- function C(e) {
141
- if (l(e)) return;
142
- let n = c(t.content.blocks, e);
143
- if (n) {
144
- let i = n.blocks.findIndex((t) => t.id === e);
145
- if (i !== -1) {
146
- let [e] = n.blocks.splice(i, 1);
147
- if (t.selectedBlockId) {
148
- let n = /* @__PURE__ */ new Set();
149
- s(e, n), n.has(t.selectedBlockId) && (t.selectedBlockId = null);
150
- }
151
- r();
152
- }
153
- }
154
- }
155
- function w(e, n, i, a = 0) {
156
- if (l(e) || i && l(i)) return;
157
- let s = c(t.content.blocks, e);
158
- if (!s) return;
159
- let u = s.blocks.findIndex((t) => t.id === e);
160
- if (u === -1 || i && s.blocks[u].type === "section") return;
161
- let d;
162
- if (i) {
163
- let e = o(t.content.blocks, i);
164
- if (!e || e.type !== "section" || a < 0 || a >= ln(e.columns)) return;
165
- e.children[a] = e.children[a] || [], d = e.children[a];
166
- } else d = t.content.blocks;
167
- let [f] = s.blocks.splice(u, 1);
168
- d.splice(n, 0, f), r();
169
- }
170
- function T() {
171
- r();
172
- }
173
- function E(e, t) {
174
- throw new G(`[Templatical] Templates: ${e} ${t}`);
175
- }
176
- function D(t) {
177
- cn(e.onError, t);
178
- }
179
- function O(t) {
180
- let { templates: n } = e;
181
- return n || E(t, "needs a templates provider. Pass one as `init({ templates })` to enable saving and loading."), n;
182
- }
183
- function k(e) {
184
- t.template && (t.template = {
185
- ...t.template,
186
- name: e
187
- }, r());
188
- }
189
- async function A(r) {
190
- let i = O("create()"), { create: a } = i;
191
- typeof a != "function" && E("create()", "is disabled by the provider — its `create` is `false`.");
192
- let o;
193
- t.isLoading = !0;
194
- try {
195
- r?.content && (t.content = r.content);
196
- let e = n;
197
- o = await a(r?.name === void 0 ? { content: t.content } : {
198
- name: r.name,
199
- content: t.content
200
- }), t.template = o, n === e && (t.isDirty = !1);
201
- } catch (t) {
202
- throw e.onError?.(t), t;
203
- } finally {
204
- t.isLoading = !1;
205
- }
206
- return D(() => i.onCreated?.(o)), o;
207
- }
208
- async function j(n) {
209
- let r = O("load()"), i;
210
- t.isLoading = !0;
211
- try {
212
- i = await r.load(n), t.template = i, t.content = i.content, t.isDirty = !1;
213
- } catch (t) {
214
- throw e.onError?.(t), t;
215
- } finally {
216
- t.isLoading = !1;
217
- }
218
- return D(() => r.onLoaded?.(i)), i;
219
- }
220
- async function M(r = "api") {
221
- let i = O("save()"), { save: a } = i;
222
- typeof a != "function" && E("save()", "is disabled by the provider — its `save` is `false`.");
223
- let o = t.template;
224
- o || E("save()", "has no template loaded. Call create() or load() first.");
225
- let s = o.name === void 0 ? { content: t.content } : {
226
- name: o.name,
227
- content: t.content
228
- }, c;
229
- t.isSaving = !0;
230
- try {
231
- let e = n;
232
- if (c = await a(o.id, s), t.template?.id === o.id) {
233
- let e = t.template.name;
234
- t.template = e === o.name ? c : {
235
- ...c,
236
- name: e
237
- };
238
- }
239
- n === e && (t.isDirty = !1);
240
- } catch (t) {
241
- throw e.onError?.(t), t;
242
- } finally {
243
- t.isSaving = !1;
244
- }
245
- return D(() => i.onSaved?.(c, { trigger: r })), c;
246
- }
247
- function N() {
248
- return t.template?.id !== void 0;
249
- }
250
- return {
251
- state: g(t),
252
- content: i,
253
- selectedBlock: a,
254
- isBlockLocked: l,
255
- setContent: d,
256
- selectBlock: f,
257
- setViewport: h,
258
- setDarkMode: _,
259
- setUiTheme: v,
260
- setPreviewMode: y,
261
- updateBlock: b,
262
- updateSettings: x,
263
- addBlock: S,
264
- removeBlock: C,
265
- moveBlock: w,
266
- markDirty: T,
267
- findBlockLocation: u,
268
- setName: k,
269
- create: A,
270
- load: j,
271
- save: M,
272
- hasTemplate: N
273
- };
274
- }
275
- //#endregion
276
- //#region ../core/src/history.ts
277
- var dn = 50, fn = 300, pn = 1500;
278
- function mn(e) {
279
- let { content: t, setContent: n, isRemoteOperation: r, maxSize: i = dn } = e, a = l([]), o = l([]), s = l(!1), c = null, u = null, d = p(() => a.value.length > 0), f = p(() => o.value.length > 0);
280
- function m() {
281
- return ve(t.value);
282
- }
283
- function h(e) {
284
- a.value.push(e), a.value.length > i && a.value.splice(0, a.value.length - i);
285
- }
286
- function g() {
287
- u &&= (clearTimeout(u.timeoutId), null);
288
- }
289
- function _() {
290
- r?.() || (g(), h(m()), o.value = []);
291
- }
292
- function v(e) {
293
- if (!r?.()) {
294
- if (u && u.blockId === e) {
295
- clearTimeout(u.timeoutId), u.timeoutId = setTimeout(() => {
296
- u = null;
297
- }, fn);
298
- return;
299
- }
300
- g(), h(m()), o.value = [], u = {
301
- blockId: e,
302
- timeoutId: setTimeout(() => {
303
- u = null;
304
- }, fn)
305
- };
306
- }
307
- }
308
- function y() {
309
- s.value = !0, c && clearTimeout(c), c = setTimeout(() => {
310
- s.value = !1, c = null;
311
- }, pn);
312
- }
313
- function b() {
314
- if (a.value.length === 0) return;
315
- g();
316
- let e = a.value.pop();
317
- o.value.push(m()), n(e, !0), y();
318
- }
319
- function x() {
320
- if (o.value.length === 0) return;
321
- g();
322
- let e = o.value.pop();
323
- a.value.push(m()), n(e, !0), y();
324
- }
325
- function S() {
326
- a.value = [], o.value = [], g();
327
- }
328
- function C() {
329
- S(), c &&= (clearTimeout(c), null);
330
- }
331
- return {
332
- canUndo: d,
333
- canRedo: f,
334
- isNavigating: s,
335
- undo: b,
336
- redo: x,
337
- record: _,
338
- recordDebounced: v,
339
- clear: S,
340
- destroy: C
341
- };
342
- }
343
- //#endregion
344
- //#region ../core/src/block-actions.ts
345
- function hn(e) {
346
- e.type === "table" ? e.rows = e.rows.map((e) => ({
347
- ...e,
348
- id: U(),
349
- cells: e.cells.map((e) => ({
350
- ...e,
351
- id: U()
352
- }))
353
- })) : e.type === "social" ? e.icons = e.icons.map((e) => ({
354
- ...e,
355
- id: U()
356
- })) : e.type === "menu" && (e.items = e.items.map((e) => ({
357
- ...e,
358
- id: U()
359
- })));
360
- }
361
- function gn(e) {
362
- let { addBlock: t, removeBlock: n, updateBlock: r, selectBlock: i, findBlockLocation: a } = e;
363
- function o(n, r, a) {
364
- let o = typeof e.blockDefaults == "function" ? e.blockDefaults() : e.blockDefaults, s = fe(n, o);
365
- return t(s, r, a), i(s.id), s;
366
- }
367
- function s(e, n, r) {
368
- let o = JSON.parse(JSON.stringify(e));
369
- if (o.id = U(), hn(o), o.type === "section" && (o.children = o.children.map((e) => e.map((e) => {
370
- let t = JSON.parse(JSON.stringify(e));
371
- return t.id = U(), hn(t), t;
372
- }))), n !== void 0 || r !== void 0) t(o, n, r);
373
- else {
374
- let i = a?.(e.id) ?? null;
375
- i ? t(o, i.targetSectionId, i.columnIndex, i.index + 1) : t(o, n, r);
376
- }
377
- return i(o.id), o;
378
- }
379
- function c(e) {
380
- n(e);
381
- }
382
- function l(e, t, n) {
383
- r(e, { [t]: n });
384
- }
385
- return {
386
- createAndAddBlock: o,
387
- duplicateBlock: s,
388
- deleteBlock: c,
389
- updateBlockProperty: l
390
- };
391
- }
392
- //#endregion
393
- //#region ../core/src/auto-save.ts
394
- var _n = 2e3;
395
- function vn(e) {
396
- let { content: t, isDirty: n, onChange: r, debounce: i = _n, enabled: a = !0 } = e, o = null, s = !1;
397
- function c() {
398
- return typeof a == "function" ? a() : a;
399
- }
400
- function l() {
401
- s = !0, d();
402
- }
403
- function u() {
404
- s = !1;
405
- }
406
- function d() {
407
- o &&= (clearTimeout(o), null);
408
- }
409
- function f() {
410
- d(), n() && r(JSON.parse(JSON.stringify(t.value)));
411
- }
412
- function p() {
413
- c() && !s && (d(), o = setTimeout(() => {
414
- o = null, c() && !s && n() && r(JSON.parse(JSON.stringify(t.value)));
415
- }, i));
416
- }
417
- let m = j(t, () => {
418
- p();
419
- }, { deep: !0 });
420
- function h() {
421
- m(), d();
422
- }
423
- return {
424
- flush: f,
425
- cancel: d,
426
- pause: l,
427
- resume: u,
428
- destroy: h
429
- };
430
- }
431
- //#endregion
432
- //#region ../core/src/condition-preview.ts
433
- function yn(e) {
434
- let t = m(/* @__PURE__ */ new Set()), n = p(() => t.size > 0);
435
- function r(e) {
436
- return t.has(e);
437
- }
438
- function i(n) {
439
- t.has(n) ? t.delete(n) : (t.add(n), e.state.selectedBlockId === n && e.selectBlock(null));
440
- }
441
- function a() {
442
- t.clear();
443
- }
444
- return {
445
- isHidden: r,
446
- toggleBlock: i,
447
- reset: a,
448
- hasHiddenBlocks: n
449
- };
450
- }
451
- //#endregion
452
- //#region ../core/src/data-source-fetch.ts
453
- function bn(e) {
454
- let t = l(!1), n = l(!1), r = p(() => !!e.definition.value?.dataSource), i = p(() => r.value && !e.block.value.dataSourceFetched);
455
- async function a() {
456
- let r = e.definition.value;
457
- if (r?.dataSource) {
458
- t.value = !0, n.value = !1;
459
- try {
460
- let t = await r.dataSource.onFetch({
461
- fieldValues: { ...e.block.value.fieldValues },
462
- blockId: e.block.value.id
463
- });
464
- if (t == null) return;
465
- let n = { ...e.block.value.fieldValues };
466
- for (let e of Object.keys(n)) e in t && (n[e] = t[e]);
467
- e.onUpdate(n, !0);
468
- } catch (e) {
469
- console.warn("[Templatical] Data source fetch error:", e), n.value = !0;
470
- } finally {
471
- t.value = !1;
472
- }
473
- }
474
- }
475
- return {
476
- isFetching: t,
477
- fetchError: n,
478
- fetch: a,
479
- hasDataSource: r,
480
- needsFetch: i
481
- };
482
- }
483
- //#endregion
484
- //#region ../core/src/history-interceptor.ts
485
- function xn(e, t) {
486
- let n = e.addBlock, r = e.removeBlock, i = e.moveBlock, a = e.updateBlock, o = e.updateSettings;
487
- e.addBlock = (r, i, a, o) => {
488
- i && e.isBlockLocked(i) || (t.record(), n(r, i, a, o));
489
- }, e.removeBlock = (n) => {
490
- e.isBlockLocked(n) || (t.record(), r(n));
491
- }, e.moveBlock = (n, r, a, o) => {
492
- e.isBlockLocked(n) || a && e.isBlockLocked(a) || (t.record(), i(n, r, a, o));
493
- }, e.updateBlock = (n, r) => {
494
- e.isBlockLocked(n) || (t.recordDebounced(n), a(n, r));
495
- }, e.updateSettings = (e) => {
496
- t.record(), o(e);
497
- };
498
- }
499
- //#endregion
500
- //#region ../core/src/saved-blocks.ts
501
- function Sn(e) {
502
- let { provider: t } = e, n = l([]), r = l(!1), i = S(() => {
503
- let e = /* @__PURE__ */ new Set();
504
- for (let t of n.value) {
505
- let n = t.category?.trim();
506
- n && e.add(n);
507
- }
508
- return [...e].sort((e, t) => e.localeCompare(t));
509
- }), a = S(() => typeof t.create == "function"), o = S(() => typeof t.update == "function"), s = S(() => typeof t.delete == "function");
510
- function c(e) {
511
- return o.value && e.canUpdate !== !1;
512
- }
513
- function u(e) {
514
- return s.value && e.canDelete !== !1;
515
- }
516
- function d(e, t) {
517
- throw new G(`[Templatical] Saved blocks: ${e} is ${t}. Check the capability before calling — the editor's own UI hides the action.`);
518
- }
519
- function f(t) {
520
- cn(e.onError, t);
521
- }
522
- async function p(i) {
523
- r.value = !0;
524
- try {
525
- n.value = await t.list(i);
526
- } catch (t) {
527
- throw e.onError?.(t), t;
528
- } finally {
529
- r.value = !1;
530
- }
531
- }
532
- async function m(r, i, a) {
533
- let { create: o } = t;
534
- typeof o != "function" && d("create", "disabled by the provider");
535
- try {
536
- let e = await o(a ? {
537
- name: r,
538
- content: i,
539
- category: a
540
- } : {
541
- name: r,
542
- content: i
543
- });
544
- return n.value = [e, ...n.value], f(() => t.onCreated?.(e)), e;
545
- } catch (t) {
546
- throw e.onError?.(t), t;
547
- }
548
- }
549
- async function h(r, i) {
550
- let { update: a } = t;
551
- typeof a != "function" && d("update", "disabled by the provider");
552
- let o = n.value.find((e) => e.id === r);
553
- o && o.canUpdate === !1 && d("update", `not permitted for entry "${r}"`);
554
- try {
555
- let e = await a(r, i);
556
- return n.value = n.value.map((t) => t.id === r ? e : t), f(() => t.onUpdated?.(e)), e;
557
- } catch (t) {
558
- throw e.onError?.(t), t;
559
- }
560
- }
561
- async function g(r) {
562
- let { delete: i } = t;
563
- typeof i != "function" && d("delete", "disabled by the provider");
564
- let a = n.value.find((e) => e.id === r) ?? null;
565
- a && a.canDelete === !1 && d("delete", `not permitted for entry "${r}"`);
566
- try {
567
- await i(r), n.value = n.value.filter((e) => e.id !== r), a && f(() => t.onDeleted?.(a));
568
- } catch (t) {
569
- throw e.onError?.(t), t;
570
- }
571
- }
572
- return {
573
- savedBlocks: n,
574
- isLoading: r,
575
- categories: i,
576
- canCreate: a,
577
- canUpdate: o,
578
- canDelete: s,
579
- canUpdateBlock: c,
580
- canDeleteBlock: u,
581
- load: p,
582
- create: m,
583
- update: h,
584
- remove: g
585
- };
586
- }
587
- //#endregion
588
- //#region ../core/src/saved-blocks-local.ts
589
- var Cn = "templatical:saved-blocks";
590
- function wn(e = {}) {
591
- let t = e.key ?? Cn;
592
- function n() {
593
- if (typeof localStorage > "u") throw Error("[Templatical] createLocalStorageSavedBlocksProvider requires a browser environment with localStorage. Supply your own SavedBlocksProvider for server-side or non-browser use.");
594
- return localStorage;
595
- }
596
- function r() {
597
- let e = n().getItem(t);
598
- if (!e) return [];
599
- try {
600
- let t = JSON.parse(e);
601
- return Array.isArray(t) ? t : [];
602
- } catch {
603
- return [];
604
- }
605
- }
606
- function i(e) {
607
- n().setItem(t, JSON.stringify(e));
608
- }
609
- return {
610
- async list(e) {
611
- let t = r(), n = e?.search?.trim().toLowerCase(), i = e?.category?.trim();
612
- return t.filter((e) => !(n && !e.name.toLowerCase().includes(n) || i && e.category !== i));
613
- },
614
- async create(e) {
615
- let t = (/* @__PURE__ */ new Date()).toISOString(), n = {
616
- id: U(),
617
- name: e.name,
618
- content: e.content,
619
- ...e.category ? { category: e.category } : {},
620
- createdAt: t,
621
- updatedAt: t
622
- };
623
- return i([n, ...r()]), n;
624
- },
625
- async update(e, t) {
626
- let n = r(), a = n.findIndex((t) => t.id === e);
627
- if (a === -1) throw Error(`[Templatical] Saved block not found: ${e}`);
628
- let o = {
629
- ...n[a],
630
- ...t,
631
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
632
- }, s = [...n];
633
- return s[a] = o, i(s), o;
634
- },
635
- async delete(e) {
636
- let t = r();
637
- if (!t.some((t) => t.id === e)) throw Error(`[Templatical] Saved block not found: ${e}`);
638
- i(t.filter((t) => t.id !== e));
639
- }
640
- };
641
- }
642
- //#endregion
643
- //#region ../core/src/media-local.ts
644
- var Tn = "templatical:media", En = 50;
645
- function Dn(e = {}) {
646
- let t = e.key ?? Tn;
647
- function n() {
648
- if (typeof localStorage > "u") throw Error("[Templatical] createLocalStorageMediaProvider requires a browser environment with localStorage. Supply your own MediaProvider for server-side or non-browser use.");
649
- return localStorage;
650
- }
651
- function r() {
652
- let e = n().getItem(t);
653
- if (!e) return [];
654
- try {
655
- let t = JSON.parse(e);
656
- return Array.isArray(t) ? t : [];
657
- } catch {
658
- return [];
659
- }
660
- }
661
- function i(e) {
662
- n().setItem(t, JSON.stringify(e));
663
- }
664
- function a(e) {
665
- return typeof FileReader > "u" ? Promise.reject(/* @__PURE__ */ Error("[Templatical] createLocalStorageMediaProvider requires a browser environment with FileReader.")) : new Promise((t, n) => {
666
- let r = new FileReader();
667
- r.onload = () => {
668
- if (typeof r.result != "string") {
669
- n(/* @__PURE__ */ Error("[Templatical] Failed to read file as a data URL."));
670
- return;
671
- }
672
- t(r.result);
673
- }, r.onerror = () => {
674
- n(r.error ?? /* @__PURE__ */ Error("[Templatical] Failed to read file as a data URL."));
675
- }, r.readAsDataURL(e);
676
- });
677
- }
678
- return {
679
- async list(e) {
680
- let t = r(), n = e?.search?.trim().toLowerCase(), i = n ? t.filter((e) => {
681
- let t = e.filename?.toLowerCase() ?? "", r = e.alt?.toLowerCase() ?? "";
682
- return t.includes(n) || r.includes(n);
683
- }) : t, a = e?.cursor ? Number.parseInt(e.cursor, 10) : 0, o = Number.isFinite(a) && a > 0 ? a : 0, s = i.slice(o, o + En), c = { items: s }, l = o + s.length;
684
- return l < i.length && (c.nextCursor = String(l)), c;
685
- },
686
- async create(e) {
687
- let t = await a(e.file), n = (/* @__PURE__ */ new Date()).toISOString(), o = {
688
- id: U(),
689
- url: t,
690
- filename: e.filename || e.file.name,
691
- createdAt: n,
692
- updatedAt: n,
693
- size: e.file.size
694
- };
695
- return e.alt !== void 0 && (o.alt = e.alt), e.file.type && (o.mimeType = e.file.type), e.folderId !== void 0 && (o.folderId = e.folderId), i([o, ...r()]), o;
696
- },
697
- async update(e, t) {
698
- let n = r(), a = n.findIndex((t) => t.id === e);
699
- if (a === -1) throw Error(`[Templatical] Media asset not found: ${e}`);
700
- let o = n[a], s = {
701
- ...o,
702
- ...t,
703
- id: o.id,
704
- url: o.url,
705
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
706
- }, c = [...n];
707
- return c[a] = s, i(c), s;
708
- },
709
- async delete(e) {
710
- let t = r();
711
- for (let n of e) if (!t.some((e) => e.id === n)) throw Error(`[Templatical] Media asset not found: ${n}`);
712
- let n = new Set(e);
713
- i(t.filter((e) => !n.has(e.id)));
714
- },
715
- folders: !1,
716
- replace: !1,
717
- importFromUrl: !1,
718
- checkUsage: !1,
719
- frequentlyUsed: !1,
720
- storage: !1
721
- };
722
- }
723
- //#endregion
724
- //#region ../core/src/version-history.ts
725
- function On(e) {
726
- let { provider: t, getTemplateId: n } = e, r = l([]), i = l(!1), a = l(void 0), o = l(!1), s = /* @__PURE__ */ new Map(), c = S(() => typeof t.create == "function"), u = S(() => typeof t.restore == "function");
727
- function d(e) {
728
- let t = n();
729
- if (!t) throw new G(`[Templatical] Version history: ${e} needs a template. Call create() or load() first.`);
730
- return t;
731
- }
732
- function f(e) {
733
- throw new G(`[Templatical] Version history: ${e} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`);
734
- }
735
- function p(t) {
736
- cn(e.onError, t);
737
- }
738
- async function m(n) {
739
- let o = d("list");
740
- i.value = !0;
741
- try {
742
- let e = await t.list(o, n);
743
- r.value = e.versions, a.value = e.nextCursor;
744
- } catch (t) {
745
- throw e.onError?.(t), t;
746
- } finally {
747
- i.value = !1;
748
- }
749
- }
750
- function h(e) {
751
- return e.content ?? s.get(e.id) ?? null;
752
- }
753
- async function g(n) {
754
- let r = h(n);
755
- if (r) return r;
756
- let i = d("get");
757
- try {
758
- let e = await t.get(i, n.id);
759
- return s.set(n.id, e), e;
760
- } catch (t) {
761
- throw e.onError?.(t), t;
762
- }
763
- }
764
- async function _(n, i) {
765
- let { create: a } = t;
766
- typeof a != "function" && f("create");
767
- let o = d("create");
768
- try {
769
- let e = await a(o, n, i);
770
- return r.value = [e, ...r.value], p(() => t.onCreated?.(e)), e;
771
- } catch (t) {
772
- throw e.onError?.(t), t;
773
- }
774
- }
775
- async function v(n) {
776
- let { restore: r } = t;
777
- typeof r != "function" && f("restore");
778
- let i = d("restore"), a;
779
- o.value = !0;
780
- try {
781
- a = await r(i, n);
782
- } catch (t) {
783
- throw e.onError?.(t), t;
784
- } finally {
785
- o.value = !1;
786
- }
787
- return p(() => t.onRestored?.(a)), a;
788
- }
789
- return {
790
- nextCursor: a,
791
- versions: r,
792
- isLoading: i,
793
- isRestoring: o,
794
- canCreate: c,
795
- canRestore: u,
796
- load: m,
797
- peekContent: h,
798
- resolveContent: g,
799
- create: _,
800
- restore: v
801
- };
802
- }
803
- //#endregion
804
- //#region ../core/src/comments.ts
805
- function kn(e) {
806
- let { provider: t, getTemplateId: n, getUser: r } = e, i = l([]), a = l(!1), o = l(!1), s = S(() => typeof t.create == "function"), c = S(() => typeof t.update == "function"), u = S(() => typeof t.delete == "function"), d = S(() => typeof t.setResolved == "function"), f = S(() => i.value.reduce((e, t) => e + 1 + (t.replies?.length ?? 0), 0)), p = S(() => i.value.filter((e) => !e.resolvedAt).length), m = S(() => {
807
- let e = /* @__PURE__ */ new Map();
808
- for (let t of i.value) t.blockId && e.set(t.blockId, (e.get(t.blockId) ?? 0) + 1 + (t.replies?.length ?? 0));
809
- return e;
810
- });
811
- function h(e) {
812
- let t = n();
813
- if (!t) throw new G(`[Templatical] Comments: ${e} needs a template. Call create() or load() first.`);
814
- return t;
815
- }
816
- function g(e) {
817
- let t = r();
818
- if (!t) throw new G(`[Templatical] Comments: ${e} needs to know who is commenting. Pass init({ user: { id, name } }) — an unattributed comment is not written.`);
819
- return t;
820
- }
821
- function _(e) {
822
- throw new G(`[Templatical] Comments: ${e} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`);
823
- }
824
- function v(e) {
825
- for (let t of i.value) {
826
- if (t.id === e) return t;
827
- for (let n of t.replies ?? []) if (n.id === e) return n;
828
- }
829
- return null;
830
- }
831
- function y(e) {
832
- let t = r();
833
- return t !== null && e.author.id === t.id;
834
- }
835
- function b(t) {
836
- let n = sn(t);
837
- throw e.onError?.(n), n;
838
- }
839
- function x(t) {
840
- cn(e.onError, t);
841
- }
842
- function C(e, t, n) {
843
- return [
844
- ...e.slice(0, t),
845
- n,
846
- ...e.slice(t + 1)
847
- ];
848
- }
849
- function w(e, t) {
850
- return e !== void 0 && JSON.stringify(e) === JSON.stringify(t);
851
- }
852
- function T(e) {
853
- if (e.parentId) {
854
- let t = !1, n = i.value.map((n) => {
855
- if (n.id !== e.parentId) return n;
856
- let r = n.replies ?? [], i = r.findIndex((t) => t.id === e.id);
857
- return i !== -1 && w(r[i], e) ? n : (t = !0, {
858
- ...n,
859
- replies: i === -1 ? [...r, e] : C(r, i, e)
860
- });
861
- });
862
- return t && (i.value = n), t;
863
- }
864
- let t = i.value.findIndex((t) => t.id === e.id);
865
- if (t === -1) return i.value = [...i.value, e], !0;
866
- let n = {
867
- ...e,
868
- replies: e.replies ?? i.value[t].replies
869
- };
870
- return !w(i.value[t], n) && (i.value = C(i.value, t, n), !0);
871
- }
872
- function E(e, t) {
873
- let n = v(e), r = t ?? n?.parentId ?? null;
874
- return r ? i.value = i.value.map((t) => t.id === r ? {
875
- ...t,
876
- replies: (t.replies ?? []).filter((t) => t.id !== e)
877
- } : t) : i.value = i.value.filter((t) => t.id !== e), n;
878
- }
879
- async function D(e) {
880
- let n = h("list");
881
- a.value = !0;
882
- try {
883
- i.value = await t.list(n, e);
884
- } catch (e) {
885
- b(e);
886
- } finally {
887
- a.value = !1;
888
- }
889
- }
890
- async function O(e) {
891
- let { create: n } = t;
892
- typeof n != "function" && _("create");
893
- let r = h("create");
894
- g("create"), o.value = !0;
895
- try {
896
- let i = await n(r, e);
897
- return T(i), x(() => t.onCreated?.(i, { origin: "local" })), i;
898
- } catch (e) {
899
- b(e);
900
- } finally {
901
- o.value = !1;
902
- }
903
- }
904
- async function k(e, n) {
905
- let { update: r } = t;
906
- typeof r != "function" && _("update");
907
- let i = h("update");
908
- g("update"), o.value = !0;
909
- try {
910
- let a = await r(i, e, n);
911
- return T(a), x(() => t.onUpdated?.(a, { origin: "local" })), a;
912
- } catch (e) {
913
- b(e);
914
- } finally {
915
- o.value = !1;
916
- }
917
- }
918
- async function A(e) {
919
- let { delete: n } = t;
920
- typeof n != "function" && _("delete");
921
- let r = h("delete");
922
- g("delete");
923
- let i = v(e);
924
- o.value = !0;
925
- try {
926
- await n(r, e), E(e), i && x(() => t.onDeleted?.(i, { origin: "local" }));
927
- } catch (e) {
928
- b(e);
929
- } finally {
930
- o.value = !1;
931
- }
932
- }
933
- async function j(e, n) {
934
- let { setResolved: r } = t;
935
- typeof r != "function" && _("setResolved");
936
- let i = h("setResolved");
937
- g("setResolved"), o.value = !0;
938
- try {
939
- let a = await r(i, e, n);
940
- return T(a), x(() => (a.resolvedAt ? t.onResolved : t.onUnresolved)?.(a, { origin: "local" })), a;
941
- } catch (e) {
942
- b(e);
943
- } finally {
944
- o.value = !1;
945
- }
946
- }
947
- function M(e) {
948
- T(e) && x(() => t.onCreated?.(e, { origin: "remote" }));
949
- }
950
- function N(e) {
951
- T(e) && x(() => (e.resolvedAt ? t.onResolved : t.onUpdated)?.(e, { origin: "remote" }));
952
- }
953
- function P(e, n) {
954
- let r = E(e, n);
955
- r && x(() => t.onDeleted?.(r, { origin: "remote" }));
956
- }
957
- return {
958
- comments: i,
959
- isLoading: a,
960
- isSubmitting: o,
961
- canCreate: s,
962
- canUpdate: c,
963
- canDelete: u,
964
- canResolve: d,
965
- totalCount: f,
966
- unresolvedCount: p,
967
- commentCountByBlock: m,
968
- load: D,
969
- create: O,
970
- update: k,
971
- remove: A,
972
- setResolved: j,
973
- find: v,
974
- isOwn: y,
975
- applyRemoteCreate: M,
976
- applyRemoteUpdate: N,
977
- applyRemoteDelete: P
978
- };
979
- }
980
- function An(e) {
981
- let { comments: n, provider: r, getTemplateId: i } = e, { subscribe: a } = r;
982
- if (typeof a != "function") return;
983
- let o = null;
984
- function s() {
985
- o?.(), o = null;
986
- }
987
- t(() => i(), (e) => {
988
- s(), e && (o = a(e, (e) => {
989
- switch (e.type) {
990
- case "created":
991
- n.applyRemoteCreate(e.comment);
992
- break;
993
- case "updated":
994
- n.applyRemoteUpdate(e.comment);
995
- break;
996
- case "deleted": n.applyRemoteDelete(e.commentId, e.parentId);
997
- }
998
- }));
999
- }, { immediate: !0 }), h(s);
1000
- }
1001
- //#endregion
1002
- //#region src/utils/activeEditorTracker.ts
1003
- var jn = /* @__PURE__ */ new Set(), Q = 0, Mn = 0;
1004
- function Nn() {
1005
- let e = ++Mn;
1006
- return jn.add(e), Q === 0 && (Q = e), {
1007
- id: e,
1008
- isActive: () => jn.size <= 1 || Q === e,
1009
- claim: () => {
1010
- Q = e;
1011
- },
1012
- dispose: () => {
1013
- if (jn.delete(e), Q === e) {
1014
- let e = Array.from(jn);
1015
- Q = e[e.length - 1] ?? 0;
1016
- }
1017
- }
1018
- };
1019
- }
1020
- //#endregion
1021
- //#region src/composables/usePreviewResolution.ts
1022
- var Pn = 500;
1023
- function Fn(e) {
1024
- let n = typeof e.resolvePreview == "function", r = l(null), i = l(!1), a = l(!1), o = 0, s = null;
1025
- function c() {
1026
- s !== null && (clearTimeout(s), s = null);
1027
- }
1028
- async function u() {
1029
- let t = e.resolvePreview;
1030
- if (!t) return;
1031
- let n = ++o;
1032
- i.value = !0;
1033
- let s = {
1034
- content: ve(e.getContent()),
1035
- ...e.getRecipient?.() === void 0 ? {} : { recipient: e.getRecipient() }
1036
- };
1037
- try {
1038
- let e = await t(s);
1039
- if (n !== o) return;
1040
- if (!Oe(e)) {
1041
- a.value = !0;
1042
- return;
1043
- }
1044
- r.value = e, a.value = !1;
1045
- } catch {
1046
- if (n !== o) return;
1047
- a.value = !0;
1048
- } finally {
1049
- n === o && (i.value = !1);
1050
- }
1051
- }
1052
- function d() {
1053
- if (n) {
1054
- if (c(), r.value === null) {
1055
- u();
1056
- return;
1057
- }
1058
- s = setTimeout(() => {
1059
- s = null, u();
1060
- }, Pn);
1061
- }
1062
- }
1063
- return t(() => [e.isActive(), e.getRecipient?.()], ([e]) => {
1064
- if (!e) {
1065
- c(), o++, i.value = !1, r.value = null, a.value = !1;
1066
- return;
1067
- }
1068
- d();
1069
- }, { immediate: !0 }), h(() => {
1070
- c(), o++;
1071
- }), {
1072
- isConfigured: n,
1073
- content: S(() => r.value ?? e.getContent()),
1074
- isResolving: i,
1075
- isInitialResolve: S(() => i.value && r.value === null),
1076
- hasFailed: a,
1077
- supersedesSamples: S(() => n)
1078
- };
1079
- }
1080
- //#endregion
1081
- //#region src/composables/useImageUrlResolver.ts
1082
- function In(e) {
1083
- let t = m(/* @__PURE__ */ new Map()), n = /* @__PURE__ */ new Set();
1084
- function r(e) {
1085
- return t.get(e);
1086
- }
1087
- function i(e) {
1088
- return t.has(e) || n.has(e);
1089
- }
1090
- function a(r) {
1091
- if (i(r)) return;
1092
- let a;
1093
- try {
1094
- a = e(r);
1095
- } catch {
1096
- t.set(r, null);
1097
- return;
1098
- }
1099
- if (a === null || typeof a == "string") {
1100
- t.set(r, a);
1101
- return;
1102
- }
1103
- n.add(r), Promise.resolve(a).then((e) => {
1104
- t.set(r, typeof e == "string" ? e : null);
1105
- }, () => {
1106
- t.set(r, null);
1107
- }).finally(() => n.delete(r));
1108
- }
1109
- return {
1110
- get: r,
1111
- has: i,
1112
- lookup: a
1113
- };
1114
- }
1115
- function Ln(e) {
1116
- let r = n(kt, null), i = S(e);
1117
- if (!r) return i;
1118
- let a;
1119
- function s() {
1120
- a !== void 0 && (clearTimeout(a), a = void 0);
1121
- }
1122
- o() && h(s);
1123
- let c = !0;
1124
- return t(i, (e) => {
1125
- s();
1126
- let t = c;
1127
- if (c = !1, e && !r.has(e)) {
1128
- if (t) {
1129
- r.lookup(e);
1130
- return;
1131
- }
1132
- a = setTimeout(() => {
1133
- a = void 0, r.lookup(e);
1134
- }, 300);
1135
- }
1136
- }, { immediate: !0 }), S(() => {
1137
- let e = i.value;
1138
- if (!e) return e;
1139
- let t = r.get(e);
1140
- return typeof t == "string" && t.length > 0 ? t : e;
1141
- });
1142
- }
1143
- //#endregion
1144
- //#region src/composables/useMergeTagPicker.ts
1145
- function Rn() {
1146
- let e = l(!1), t = l([]), n = null;
1147
- function r(r) {
1148
- if (n) {
1149
- let e = n;
1150
- n = null, e(null);
1151
- }
1152
- return t.value = r, e.value = !0, new Promise((e) => {
1153
- n = e;
1154
- });
1155
- }
1156
- function i(r) {
1157
- let i = n;
1158
- n = null, e.value = !1, t.value = [], i && i(r);
1159
- }
1160
- return o() && h(() => {
1161
- if (n) {
1162
- let e = n;
1163
- n = null, e(null);
1164
- }
1165
- e.value = !1, t.value = [];
1166
- }), {
1167
- isOpen: e,
1168
- tags: t,
1169
- open: r,
1170
- resolve: i
1171
- };
1172
- }
1173
- //#endregion
1174
- //#region src/composables/useLogicTagPicker.ts
1175
- function zn() {
1176
- let e = l(!1), t = l([]), n = l([]), r = null;
1177
- function i(i, a) {
1178
- if (r) {
1179
- let e = r;
1180
- r = null, e(null);
1181
- }
1182
- return t.value = i, n.value = a, e.value = !0, new Promise((e) => {
1183
- r = e;
1184
- });
1185
- }
1186
- function a(i) {
1187
- let a = r;
1188
- r = null, e.value = !1, t.value = [], n.value = [], a && a(i);
1189
- }
1190
- return o() && h(() => {
1191
- if (r) {
1192
- let e = r;
1193
- r = null, e(null);
1194
- }
1195
- e.value = !1, t.value = [], n.value = [];
1196
- }), {
1197
- isOpen: e,
1198
- tags: t,
1199
- pairs: n,
1200
- open: i,
1201
- resolve: a
1202
- };
1203
- }
1204
- //#endregion
1205
- //#region src/composables/useTemplateLint.ts
1206
- function Bn(e) {
1207
- return e ? e.disabled === !0 || e.accessibility === !1 && e.structure === !1 && e.links === !1 : !1;
1208
- }
1209
- function Vn(e) {
1210
- let n = l([]), r = l(!1), i = l(!1), a = x(null), o = Bn(e.options), s = null, c = !1;
1211
- o || u();
1212
- async function u() {
1213
- try {
1214
- let t = await import("./src-CUvZWL6Y.js");
1215
- if (c) return;
1216
- a.value = { lintTemplate: t.lintTemplate }, r.value = !0, d(), s = Ve(e.content, d, {
1217
- debounce: e.debounce ?? 500,
1218
- deep: !0
1219
- });
1220
- } catch {
1221
- if (c) return;
1222
- i.value = !0;
1223
- }
1224
- }
1225
- function d() {
1226
- a.value && (n.value = a.value.lintTemplate(e.content.value, e.options));
1227
- }
1228
- let f = t(() => e.options, () => {
1229
- a.value && d();
1230
- }, { deep: !0 });
1231
- function p(t) {
1232
- t.fix && t.fix.apply({
1233
- updateBlock: e.updateBlock,
1234
- updateSettings: e.updateSettings,
1235
- removeBlock: e.removeBlock
1236
- });
1237
- }
1238
- function m() {
1239
- c = !0, s?.(), f();
1240
- }
1241
- return {
1242
- issues: n,
1243
- ready: r,
1244
- unavailable: i,
1245
- applyFix: p,
1246
- destroy: m
1247
- };
1248
- }
1249
- //#endregion
1250
- //#region src/utils/blockTypeLabels.ts
1251
- function Hn(e, t) {
1252
- return t.blocks[e] ?? e;
1253
- }
1254
- function Un(e, t, n = []) {
1255
- if (e.type !== "custom") return Hn(e.type, t);
1256
- let { customType: r } = e;
1257
- return n.find((e) => e.type === r)?.name ?? r;
1258
- }
1259
- //#endregion
1260
- //#region src/composables/useKeyboardReorder.ts
1261
- function Wn(e, t, n = []) {
1262
- let r = l(null), i = l(""), a = null;
1263
- function o(t) {
1264
- let n = e.content.value.blocks, r = n.findIndex((e) => e.id === t);
1265
- if (r !== -1) return {
1266
- index: r,
1267
- total: n.length
1268
- };
1269
- for (let e of n) {
1270
- if (e.type !== "section") continue;
1271
- let n = e;
1272
- for (let e = 0; e < n.children.length; e++) {
1273
- let r = n.children[e], i = r.findIndex((e) => e.id === t);
1274
- if (i !== -1) return {
1275
- index: i,
1276
- total: r.length,
1277
- sectionId: n.id,
1278
- columnIndex: e
1279
- };
1280
- }
1281
- }
1282
- return null;
1283
- }
1284
- function s(r) {
1285
- let i = o(r);
1286
- if (!i) return "";
1287
- let a = (i.sectionId ? c(i.sectionId, i.columnIndex ?? 0) : e.content.value.blocks)?.[i.index];
1288
- return a ? Un(a, t.t, n) : "";
1289
- }
1290
- function c(t, n) {
1291
- return e.content.value.blocks.find((e) => e.id === t && e.type === "section")?.children[n] ?? null;
1292
- }
1293
- function u(e) {
1294
- i.value = "", queueMicrotask(() => {
1295
- i.value = e;
1296
- });
1297
- }
1298
- function d(e) {
1299
- return r.value === e;
1300
- }
1301
- function f(e) {
1302
- let n = o(e);
1303
- n && (r.value = e, a = n, u(t.format(t.t.blockActions.lifted, {
1304
- block: s(e),
1305
- position: String(n.index + 1),
1306
- total: String(n.total)
1307
- })));
1308
- }
1309
- function p(n, r) {
1310
- let i = o(n);
1311
- if (!i) return;
1312
- let a = i.index + r;
1313
- a < 0 || a >= i.total || (e.moveBlock(n, a, i.sectionId, i.columnIndex), u(t.format(t.t.blockActions.moved, {
1314
- block: s(n),
1315
- position: String(a + 1),
1316
- total: String(i.total)
1317
- })));
1318
- }
1319
- function m(e) {
1320
- p(e, -1);
1321
- }
1322
- function h(e) {
1323
- p(e, 1);
1324
- }
1325
- function g(e) {
1326
- let n = o(e);
1327
- n && u(t.format(t.t.blockActions.dropped, {
1328
- block: s(e),
1329
- position: String(n.index + 1),
1330
- total: String(n.total)
1331
- })), r.value = null, a = null;
1332
- }
1333
- function _() {
1334
- let n = r.value;
1335
- if (n && a) {
1336
- let r = o(n);
1337
- r && (r && (r.sectionId !== a.sectionId || r.columnIndex !== a.columnIndex) || r && r.index !== a.index) && e.moveBlock(n, a.index, a.sectionId, a.columnIndex), u(t.format(t.t.blockActions.cancelled, {
1338
- block: s(n),
1339
- position: String(a.index + 1)
1340
- }));
1341
- }
1342
- r.value = null, a = null;
1343
- }
1344
- return {
1345
- liftedBlockId: r,
1346
- announcement: i,
1347
- isLifted: d,
1348
- lift: f,
1349
- cancel: _,
1350
- moveUp: m,
1351
- moveDown: h,
1352
- drop: g
1353
- };
1354
- }
1355
- //#endregion
1356
- //#region src/composables/useUiTheme.ts
1357
- function Gn(e) {
1358
- let t = He("(prefers-color-scheme: dark)");
1359
- return { resolvedTheme: S(() => e.value === "auto" ? t.value ? "dark" : "light" : e.value) };
1360
- }
1361
- //#endregion
1362
- //#region src/composables/useThemeStyles.ts
1363
- var Kn = {
1364
- bg: "--tpl-bg",
1365
- bgElevated: "--tpl-bg-elevated",
1366
- bgHover: "--tpl-bg-hover",
1367
- bgActive: "--tpl-bg-active",
1368
- border: "--tpl-border",
1369
- borderLight: "--tpl-border-light",
1370
- text: "--tpl-text",
1371
- textMuted: "--tpl-text-muted",
1372
- textDim: "--tpl-text-dim",
1373
- primary: "--tpl-primary",
1374
- primaryHover: "--tpl-primary-hover",
1375
- primaryLight: "--tpl-primary-light",
1376
- secondary: "--tpl-secondary",
1377
- secondaryHover: "--tpl-secondary-hover",
1378
- secondaryLight: "--tpl-secondary-light",
1379
- success: "--tpl-success",
1380
- successLight: "--tpl-success-light",
1381
- warning: "--tpl-warning",
1382
- warningLight: "--tpl-warning-light",
1383
- danger: "--tpl-danger",
1384
- dangerLight: "--tpl-danger-light",
1385
- canvasBg: "--tpl-canvas-bg"
1386
- };
1387
- function qn({ themeOverrides: e, resolvedTheme: t, extraStyles: n }) {
1388
- return { themeStyles: S(() => {
1389
- let r = {}, i = e.value, a = t.value === "dark" ? i.dark : i;
1390
- if (a) for (let [e, t] of Object.entries(Kn)) {
1391
- let n = a[e];
1392
- n && (r[t] = n);
1393
- }
1394
- return n && Object.assign(r, n()), r;
1395
- }) };
1396
- }
1397
- //#endregion
1398
- //#region src/composables/useBlockRegistry.ts
1399
- function Jn() {
1400
- let e = x(/* @__PURE__ */ new Map());
1401
- function t(t, n) {
1402
- e.value.set(t, n), T(e);
1403
- }
1404
- function n(t, n) {
1405
- let r = `custom:${t.type}`;
1406
- e.value.set(r, {
1407
- component: n,
1408
- createBlock: () => pe(t),
1409
- definition: t
1410
- }), T(e);
1411
- }
1412
- function r(t) {
1413
- if (t.type === "custom") {
1414
- let n = `custom:${t.customType}`;
1415
- return e.value.get(n)?.component;
1416
- }
1417
- return e.value.get(t.type)?.component;
1418
- }
1419
- function i(t) {
1420
- return e.value.get(t)?.createBlock();
1421
- }
1422
- function a(t) {
1423
- let n = `custom:${t}`;
1424
- return e.value.get(n)?.definition;
1425
- }
1426
- function o(e) {
1427
- return `<div style="color: var(--tpl-text-muted); padding: 16px; text-align: center; border: 1px dashed var(--tpl-border); border-radius: var(--tpl-radius-sm); font-family: var(--tpl-font-family); font-size: 14px;">${e}</div>`;
1428
- }
1429
- async function s(e) {
1430
- let t = a(e.customType);
1431
- if (!t) return o("Block definition not found");
1432
- try {
1433
- let { Liquid: n } = await import("./liquid.browser-BypTT2oc.js");
1434
- return await new n({
1435
- strictVariables: !1,
1436
- strictFilters: !1
1437
- }).parseAndRender(t.template, e.fieldValues);
1438
- } catch (t) {
1439
- return Z.error(`Failed to render custom block "${e.customType}":`, t), o(`Render error: ${e.customType}`);
1440
- }
1441
- }
1442
- function c(t) {
1443
- return e.value.has(t);
1444
- }
1445
- return {
1446
- registerBuiltIn: t,
1447
- registerCustom: n,
1448
- getComponent: r,
1449
- createBlock: i,
1450
- getDefinition: a,
1451
- renderCustomBlock: s,
1452
- isRegistered: c
1453
- };
1454
- }
1455
- //#endregion
1456
- //#region src/composables/useCustomBlockStylesheets.ts
1457
- function Yn(e, t) {
1458
- return S(() => {
1459
- let n = Xn(e.value.blocks);
1460
- if (n.size === 0) return [];
1461
- let r = /* @__PURE__ */ new Set(), i = [];
1462
- for (let e of n) {
1463
- let n = t.getDefinition(e)?.stylesheet;
1464
- if (!n) continue;
1465
- let a = n.trim();
1466
- a === "" || r.has(a) || (r.add(a), i.push(a));
1467
- }
1468
- return i;
1469
- });
1470
- }
1471
- function Xn(e) {
1472
- let t = /* @__PURE__ */ new Set();
1473
- return Zn(e, t), t;
1474
- }
1475
- function Zn(e, t) {
1476
- for (let n of e) {
1477
- if (he(n)) {
1478
- t.add(n.customType);
1479
- continue;
1480
- }
1481
- if (n.type === "section") {
1482
- let e = n.children;
1483
- if (!e) continue;
1484
- for (let n of e) Zn(n, t);
1485
- }
1486
- }
1487
- }
1488
- //#endregion
1489
- //#region src/utils/registerBuiltInBlocks.ts
1490
- var Qn = [
1491
- {
1492
- type: "section",
1493
- createBlock: we
1494
- },
1495
- {
1496
- type: "title",
1497
- createBlock: ie
1498
- },
1499
- {
1500
- type: "paragraph",
1501
- createBlock: H
1502
- },
1503
- {
1504
- type: "image",
1505
- createBlock: le
1506
- },
1507
- {
1508
- type: "button",
1509
- createBlock: te
1510
- },
1511
- {
1512
- type: "divider",
1513
- createBlock: re
1514
- },
1515
- {
1516
- type: "video",
1517
- createBlock: oe
1518
- },
1519
- {
1520
- type: "social",
1521
- createBlock: se
1522
- },
1523
- {
1524
- type: "menu",
1525
- createBlock: Te
1526
- },
1527
- {
1528
- type: "table",
1529
- createBlock: ue
1530
- },
1531
- {
1532
- type: "spacer",
1533
- createBlock: ce
1534
- },
1535
- {
1536
- type: "html",
1537
- createBlock: ne
1538
- },
1539
- {
1540
- type: "countdown",
1541
- createBlock: Ie
1542
- }
1543
- ];
1544
- function $n(e, t) {
1545
- for (let n of Qn) {
1546
- let r = t[n.type];
1547
- r && e.registerBuiltIn(n.type, {
1548
- component: r,
1549
- createBlock: n.createBlock
1550
- });
1551
- }
1552
- }
1553
- //#endregion
1554
- //#region src/utils/resolveHtmlBlockPreview.ts
1555
- function er(e) {
1556
- return typeof e == "boolean" ? e : e?.enabled ?? !1;
1557
- }
1558
- //#endregion
1559
- //#region src/utils/templateSettingsFields.ts
1560
- var tr = {
1561
- width: "layout",
1562
- backgroundColor: "appearance",
1563
- textColor: "appearance",
1564
- linkColor: "appearance",
1565
- linkUnderline: "appearance",
1566
- fontFamily: "appearance",
1567
- locale: "language",
1568
- direction: "language",
1569
- preheaderText: "preheader"
1570
- }, nr = Object.keys(tr);
1571
- function rr(e) {
1572
- return Object.prototype.hasOwnProperty.call(tr, e);
1573
- }
1574
- function ir(e) {
1575
- let t = e?.fields;
1576
- if (t === void 0 || t === !0) return {
1577
- fields: new Set(nr),
1578
- unknown: []
1579
- };
1580
- if (t === !1) return {
1581
- fields: /* @__PURE__ */ new Set(),
1582
- unknown: []
1583
- };
1584
- let n = /* @__PURE__ */ new Set(), r = [];
1585
- for (let e of t) rr(e) ? n.add(e) : r.push(String(e));
1586
- return {
1587
- fields: n,
1588
- unknown: r
1589
- };
1590
- }
1591
- //#endregion
1592
- //#region src/utils/collectOffPaletteDefaults.ts
1593
- function ar(e) {
1594
- return typeof e == "object" && !!e && !Array.isArray(e);
1595
- }
1596
- function or(e, t, n) {
1597
- let r = new Set(e.map((e) => Ft(e))), i = [], a = (e, t) => {
1598
- for (let [n, o] of Object.entries(e)) typeof o == "string" ? o !== "" && /color$/i.test(n) && !r.has(Ft(o)) && i.push(`${t}.${n}: ${o}`) : ar(o) && a(o, `${t}.${n}`);
1599
- }, o = t;
1600
- for (let [e, t] of Object.entries(ee)) {
1601
- let n = o?.[e];
1602
- a({
1603
- ...t,
1604
- ...ar(n) ? n : {}
1605
- }, e);
1606
- }
1607
- return a({
1608
- ...me,
1609
- ...n ?? {}
1610
- }, "template"), i;
1611
- }
1612
- //#endregion
1613
- //#region src/utils/localizedBlockDefaults.ts
1614
- function sr(e) {
1615
- return {
1616
- title: { content: `<p>${e.blockDefaults.title}</p>` },
1617
- paragraph: { content: `<p>${e.blockDefaults.paragraph}</p>` },
1618
- button: { text: e.blockDefaults.button }
1619
- };
1620
- }
1621
- //#endregion
1622
- //#region src/i18n/index.ts
1623
- var cr = /* #__PURE__ */ Object.assign({
1624
- "./locales/ca.ts": () => import("./ca-D9S-UCfZ.js"),
1625
- "./locales/de.ts": () => import("./de-BUPszLpi.js"),
1626
- "./locales/en.ts": () => import("./en-BbOC5x3w.js"),
1627
- "./locales/es.ts": () => import("./es-0bCDcT9p.js"),
1628
- "./locales/fr.ts": () => import("./fr-Brr8mJ9e.js"),
1629
- "./locales/nl.ts": () => import("./nl-Co3_RL0M.js"),
1630
- "./locales/pt-BR.ts": () => import("./pt-BR-BECez5b0.js")
1631
- }), lr = /* #__PURE__ */ Object.assign({
1632
- "./locales/cloud/de.ts": () => import("./de-BytZwgn6.js"),
1633
- "./locales/cloud/en.ts": () => import("./en-DyOSV0lY.js"),
1634
- "./locales/cloud/pt-BR.ts": () => import("./pt-BR-C1WLSGDh.js")
1635
- });
1636
- function ur(e) {
1637
- return Object.keys(e).map((e) => e.match(/\/([^/]+)\.ts$/)?.[1]).filter((e) => !!e);
1638
- }
1639
- var dr = ur(cr), fr = ur(lr);
1640
- function pr(e) {
1641
- return e.trim().replace(/_/g, "-").toLowerCase();
1642
- }
1643
- function mr(e, t) {
1644
- let n = pr(e);
1645
- return t.find((e) => pr(e) === n);
1646
- }
1647
- function hr(e) {
1648
- return pr(e).split("-")[0];
1649
- }
1650
- function gr(e, t) {
1651
- return mr(e, t) ?? mr(hr(e), t);
1652
- }
1653
- function _r(e, t) {
1654
- return gr(e, t) ?? "en";
1655
- }
1656
- async function vr(e) {
1657
- let t = cr[`./locales/${_r(e, dr)}.ts`];
1658
- return (await t()).default;
1659
- }
1660
- async function yr(e) {
1661
- let t = lr[`./locales/cloud/${_r(e, fr)}.ts`];
1662
- return (await t()).default;
1663
- }
1664
- function br(e) {
1665
- return gr(e, dr) !== void 0;
1666
- }
1667
- function xr(e) {
1668
- return gr(e, fr) !== void 0;
1669
- }
1670
- function Sr() {
1671
- return [...dr];
1672
- }
1673
- function Cr() {
1674
- return [...fr];
1675
- }
1676
- //#endregion
1677
- //#region src/i18n/contentDefaults.ts
1678
- var $ = {
1679
- en: {
1680
- video: "Video",
1681
- days: "Days",
1682
- hours: "Hours",
1683
- minutes: "Minutes",
1684
- seconds: "Seconds",
1685
- expired: "This offer has expired"
1686
- },
1687
- de: {
1688
- video: "Video",
1689
- days: "Tage",
1690
- hours: "Stunden",
1691
- minutes: "Minuten",
1692
- seconds: "Sekunden",
1693
- expired: "Dieses Angebot ist abgelaufen"
1694
- },
1695
- es: {
1696
- video: "Vídeo",
1697
- days: "Días",
1698
- hours: "Horas",
1699
- minutes: "Minutos",
1700
- seconds: "Segundos",
1701
- expired: "Esta oferta ha expirado"
1702
- },
1703
- fr: {
1704
- video: "Vidéo",
1705
- days: "Jours",
1706
- hours: "Heures",
1707
- minutes: "Minutes",
1708
- seconds: "Secondes",
1709
- expired: "Cette offre a expiré"
1710
- },
1711
- nl: {
1712
- video: "Video",
1713
- days: "Dagen",
1714
- hours: "Uren",
1715
- minutes: "Minuten",
1716
- seconds: "Seconden",
1717
- expired: "Deze aanbieding is verlopen"
1718
- },
1719
- "pt-BR": {
1720
- video: "Vídeo",
1721
- days: "Dias",
1722
- hours: "Horas",
1723
- minutes: "Minutos",
1724
- seconds: "Segundos",
1725
- expired: "Esta oferta expirou"
1726
- },
1727
- ca: {
1728
- video: "Vídeo",
1729
- days: "Dies",
1730
- hours: "Hores",
1731
- minutes: "Minuts",
1732
- seconds: "Segons",
1733
- expired: "Aquesta oferta ha caducat"
1734
- }
1735
- }, wr = new Map(Object.keys($).map((e) => [e.toLowerCase(), e]));
1736
- function Tr(e) {
1737
- if (!e) return $.en;
1738
- let t = e.trim().replace(/_/g, "-").toLowerCase(), n = wr.get(t);
1739
- if (n) return $[n];
1740
- let r = wr.get(hr(t));
1741
- return r ? $[r] : $.en;
1742
- }
1743
- function Er(e) {
1744
- let t = Tr(e);
1745
- return {
1746
- video: { alt: t.video },
1747
- countdown: {
1748
- labelDays: t.days,
1749
- labelHours: t.hours,
1750
- labelMinutes: t.minutes,
1751
- labelSeconds: t.seconds,
1752
- expiredMessage: t.expired
1753
- }
1754
- };
1755
- }
1756
- //#endregion
1757
- //#region src/utils/resolveFieldColors.ts
1758
- function Dr(e, t) {
1759
- let n = Pt({ presets: e.presets }, Mt), r = n.presets.length === 0;
1760
- return {
1761
- presets: r ? t.presets : n.presets,
1762
- allowCustom: t.allowCustom === !1 ? !1 : e.allowCustom ?? t.allowCustom,
1763
- invalidPresets: n.invalidPresets,
1764
- emptyPresets: e.presets !== void 0 && e.presets.length === 0,
1765
- presetsInherited: r,
1766
- allowCustomIgnored: e.allowCustom === !0 && t.allowCustom === !1
1767
- };
1768
- }
1769
- //#endregion
1770
- //#region src/utils/collectColorFieldIssues.ts
1771
- function Or(e, t) {
1772
- let n = [], r = (r, i) => {
1773
- let a = Dr(r, t), o = `custom block "${e.type}" field "${i}"`, s = (t) => `${e.type}:${i}:${t}`;
1774
- if (a.invalidPresets.length > 0 && n.push({
1775
- id: s("invalid-presets"),
1776
- message: `${o}: presets skipped invalid entries: ${a.invalidPresets.join(", ")} — presets must be hex colors (#rgb or #rrggbb).` + (a.presetsInherited ? " No valid entries are left, so the field inherits colors.presets." : "")
1777
- }), a.emptyPresets && n.push({
1778
- id: s("empty-presets"),
1779
- message: `${o}: presets is empty — a field palette can only narrow the editor's, so an empty list is ignored and the field inherits colors.presets.`
1780
- }), a.allowCustomIgnored && n.push({
1781
- id: s("allow-custom-ignored"),
1782
- message: `${o}: allowCustom: true is ignored because colors.allowCustom is false — a field can narrow the editor-wide palette, never unlock it.`
1783
- }), !a.allowCustom && a.presets.length > 0) {
1784
- let e = r.default ?? "", t = new Set(a.presets.map((e) => Ft(e)));
1785
- e !== "" && !t.has(Ft(e)) && n.push({
1786
- id: s("off-palette-default"),
1787
- message: `${o} locks custom colours, but its default ${e} falls outside the field's presets: ${a.presets.join(", ")}. New blocks start on a colour the picker can't reselect — set the default from the same palette.`
1788
- });
1789
- }
1790
- };
1791
- for (let t of e.fields) if (t.type === "color") r(t, t.key);
1792
- else if (t.type === "repeatable") for (let e of t.fields) e.type === "color" && r(e, `${t.key}[].${e.key}`);
1793
- return n;
1794
- }
1795
- //#endregion
1796
- //#region src/utils/keyboardShortcuts.ts
1797
- function kr(e) {
1798
- for (let t of e.composedPath()) {
1799
- if (!(t instanceof HTMLElement)) continue;
1800
- if (t.isContentEditable) return !0;
1801
- let e = t.tagName;
1802
- if (e === "INPUT" || e === "TEXTAREA" || e === "SELECT") return !0;
1803
- }
1804
- return !1;
1805
- }
1806
- function Ar(e, t) {
1807
- let n = e.metaKey || e.ctrlKey;
1808
- if (n && e.key.toLowerCase() === "s") {
1809
- e.preventDefault(), t.onSave?.();
1810
- return;
1811
- }
1812
- if (n && e.key.toLowerCase() === "z") {
1813
- if (kr(e)) return;
1814
- e.preventDefault(), e.shiftKey ? t.history.redo() : (t.onBeforeUndo?.(), t.history.undo());
1815
- return;
1816
- }
1817
- if (t.isPicking?.() && !kr(e)) {
1818
- if (e.key === "Escape") {
1819
- e.preventDefault(), t.onCancelPick?.();
1820
- return;
1821
- }
1822
- if (e.key === "Enter") {
1823
- e.preventDefault(), t.onConfirmPick?.();
1824
- return;
1825
- }
1826
- if (e.key === "Delete" || e.key === "Backspace") {
1827
- e.preventDefault();
1828
- return;
1829
- }
1830
- }
1831
- if (e.key === "Escape") {
1832
- t.selectBlock(null);
1833
- return;
1834
- }
1835
- (e.key === "Delete" || e.key === "Backspace") && t.getSelectedBlockId() && !kr(e) && (e.preventDefault(), t.history.record(), t.removeBlock(t.getSelectedBlockId()));
1836
- }
1837
- //#endregion
1838
- //#region src/utils/mergeTagLabelSegments.ts
1839
- function jr(e, t, n, r = !1) {
1840
- if (!e) return [];
1841
- let i = RegExp(`(${n.value.source}|${n.logic.source})`, "g"), a = [], o = 0, s;
1842
- for (; (s = i.exec(e)) !== null;) {
1843
- s.index > o && a.push({
1844
- type: "text",
1845
- value: e.slice(o, s.index)
1846
- });
1847
- let i = s[0];
1848
- if (be(i, n)) {
1849
- let e = r ? Pe(i, t) : void 0;
1850
- a.push(e === void 0 ? {
1851
- type: "tag",
1852
- value: Ae(i, t)
1853
- } : {
1854
- type: "text",
1855
- value: e
1856
- });
1857
- } else ye(i, n) ? a.push({
1858
- type: "tag",
1859
- value: _e(i, n)
1860
- }) : a.push({
1861
- type: "text",
1862
- value: i
1863
- });
1864
- o = s.index + i.length;
1865
- }
1866
- return o < e.length && a.push({
1867
- type: "text",
1868
- value: e.slice(o)
1869
- }), a;
1870
- }
1871
- //#endregion
1872
- //#region src/components/MergeTagPreviewText.vue
1873
- var Mr = d({
1874
- name: "MergeTagPreviewText",
1875
- props: { text: {
1876
- type: String,
1877
- required: !0
1878
- } },
1879
- setup(e) {
1880
- let t = n(q, []), r = n(et, Me.liquid), i = n(J, null), a = S(() => jr(e.text, t, r, i?.value ?? !1));
1881
- return () => a.value.map((e, t) => e.type === "tag" ? z("span", {
1882
- key: t,
1883
- class: "tpl-merge-tag-label"
1884
- }, e.value) : e.value);
1885
- }
1886
- }), Nr = ["href"], Pr = /* @__PURE__ */ d({
1887
- __name: "ButtonBlock",
1888
- props: {
1889
- block: {},
1890
- viewport: {}
1891
- },
1892
- setup(e) {
1893
- let t = e, n = S(() => {
1894
- let e = {
1895
- display: "inline-block",
1896
- padding: `${t.block.buttonPadding.top}px ${t.block.buttonPadding.right}px ${t.block.buttonPadding.bottom}px ${t.block.buttonPadding.left}px`,
1897
- backgroundColor: t.block.backgroundColor,
1898
- color: t.block.textColor,
1899
- fontSize: `${t.block.fontSize}px`,
1900
- fontWeight: "bold",
1901
- textDecoration: "none",
1902
- borderRadius: `${t.block.borderRadius}px`,
1903
- textAlign: "center"
1904
- };
1905
- return t.block.fontFamily && (e.fontFamily = t.block.fontFamily), t.block.width === "full" ? (e.display = "block", e.width = "100%", e.boxSizing = "border-box") : typeof t.block.width == "number" && (e.width = `${t.block.width}px`, e.boxSizing = "border-box"), e;
1906
- }), r = S(() => ({ textAlign: t.block.align ?? "center" }));
1907
- return (t, i) => (s(), C("div", { style: k(r.value) }, [M("a", {
1908
- href: e.block.url || "#",
1909
- style: k(n.value),
1910
- class: "tpl:cursor-default",
1911
- onClick: i[0] ||= O(() => {}, ["prevent"])
1912
- }, [v(Mr, { text: e.block.text }, null, 8, ["text"])], 12, Nr)], 4));
1913
- }
1914
- }), Fr = ["innerHTML"], Ir = [
1915
- "src",
1916
- "width",
1917
- "height"
1918
- ], Lr = /* @__PURE__ */ d({
1919
- __name: "CustomBlockIcon",
1920
- props: {
1921
- icon: {},
1922
- size: {}
1923
- },
1924
- setup(e) {
1925
- let t = e, n = S(() => t.size ?? 20), r = S(() => t.icon && (t.icon.trimStart().startsWith("<svg") || t.icon.trimStart().startsWith("<SVG"))), i = S(() => t.icon && !r.value && (t.icon.startsWith("http") || t.icon.startsWith("/")));
1926
- return (t, a) => r.value ? (s(), C("span", {
1927
- key: 0,
1928
- class: "tpl:inline-flex tpl:items-center tpl:justify-center",
1929
- style: k({
1930
- width: `${n.value}px`,
1931
- height: `${n.value}px`
1932
- }),
1933
- innerHTML: e.icon
1934
- }, null, 12, Fr)) : i.value ? (s(), C("img", {
1935
- key: 1,
1936
- src: e.icon,
1937
- width: n.value,
1938
- height: n.value,
1939
- class: "tpl:inline-block",
1940
- alt: ""
1941
- }, null, 8, Ir)) : (s(), A(_(en), {
1942
- key: 2,
1943
- size: n.value,
1944
- "stroke-width": 1.5
1945
- }, null, 8, ["size"]));
1946
- }
1947
- }), Rr = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
1948
- function zr(e, n) {
1949
- let r = rn(), i = null, a = null, o = null;
1950
- function s() {
1951
- return e.value ? Array.from(e.value.querySelectorAll(Rr)).filter((e) => e.offsetParent !== null) : [];
1952
- }
1953
- function c(e) {
1954
- if (e.key !== "Tab") return;
1955
- let t = s();
1956
- if (t.length === 0) return;
1957
- let n = t[0], i = t[t.length - 1];
1958
- e.shiftKey ? r.activeElement === n && (e.preventDefault(), i.focus()) : r.activeElement === i && (e.preventDefault(), n.focus());
1959
- }
1960
- function l() {
1961
- let t = a !== null || o !== null;
1962
- t && u({ restoreFocus: !1 }), t || (i = r.activeElement), o = requestAnimationFrame(() => {
1963
- o = null;
1964
- let t = s();
1965
- t.length > 0 && (e.value?.querySelector("[autofocus], input:not([disabled])") ?? t[0]).focus();
1966
- }), a = K(e, "keydown", c);
1967
- }
1968
- function u(e = {}) {
1969
- let t = e.restoreFocus !== !1;
1970
- o !== null && (typeof cancelAnimationFrame < "u" && cancelAnimationFrame(o), o = null), a?.(), a = null, t && i && i.focus && (i.focus(), i = null);
1971
- }
1972
- let d = t([n, e], ([e, t]) => {
1973
- e && t ? l() : u();
1974
- }, { flush: "post" });
1975
- h(() => {
1976
- d(), u();
1977
- });
1978
- }
1979
- //#endregion
1980
- //#region src/composables/useEmoji.ts
1981
- function Br() {
1982
- let [e, n] = Be(!1), r = x([]), i = !1;
1983
- h(() => {
1984
- i = !0;
1985
- }), t(e, async (e) => {
1986
- if (e && r.value.length === 0) {
1987
- let { emojiCategories: e } = await import("./emojiData-6m0DBh7O.js");
1988
- if (i) return;
1989
- r.value = e;
1990
- }
1991
- });
1992
- function a() {
1993
- n();
1994
- }
1995
- function o() {
1996
- e.value = !1;
1997
- }
1998
- return {
1999
- categories: r,
2000
- isOpen: e,
2001
- toggle: a,
2002
- close: o
2003
- };
2004
- }
2005
- //#endregion
2006
- //#region src/composables/useFonts.ts
2007
- var Vr = [
2008
- {
2009
- value: "Arial",
2010
- label: "Arial"
2011
- },
2012
- {
2013
- value: "Helvetica",
2014
- label: "Helvetica"
2015
- },
2016
- {
2017
- value: "Georgia",
2018
- label: "Georgia"
2019
- },
2020
- {
2021
- value: "Times New Roman",
2022
- label: "Times New Roman"
2023
- },
2024
- {
2025
- value: "Verdana",
2026
- label: "Verdana"
2027
- },
2028
- {
2029
- value: "Trebuchet MS",
2030
- label: "Trebuchet MS"
2031
- },
2032
- {
2033
- value: "Courier New",
2034
- label: "Courier New"
2035
- }
2036
- ], Hr = {
2037
- arial: "Arial, sans-serif",
2038
- helvetica: "Helvetica, sans-serif",
2039
- georgia: "Georgia, serif",
2040
- "times new roman": "'Times New Roman', serif",
2041
- verdana: "Verdana, sans-serif",
2042
- "trebuchet ms": "'Trebuchet MS', sans-serif",
2043
- "courier new": "'Courier New', monospace"
2044
- }, Ur = "Arial, sans-serif";
2045
- function Wr(e) {
2046
- if (e === void 0 || e === !0) return [...Vr];
2047
- if (e === !1) return [];
2048
- let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
2049
- for (let i of e) {
2050
- let e = i.toLowerCase(), a = Vr.find((t) => t.value.toLowerCase() === e);
2051
- if (!a) {
2052
- r.has(e) || (r.add(e), Z.warn(`config.fonts.builtIns: "${i}" is not a built-in font — skipping it. Built-in fonts are: ${Vr.map((e) => e.value).join(", ")}.`));
2053
- continue;
2054
- }
2055
- n.has(a.value) || (n.add(a.value), t.push(a));
2056
- }
2057
- return t;
2058
- }
2059
- function Gr(e) {
2060
- let t = l(e?.customFonts ?? []), n = l(!1), r = Wr(e?.builtIns), i = S(() => e?.defaultFallback ?? Ur), a = S(() => {
2061
- let e = [...r], n = t.value.map((e) => ({
2062
- value: e.name,
2063
- label: e.name,
2064
- isCustom: !0
2065
- })), i = [...e, ...n];
2066
- return i.sort((e, t) => e.label.localeCompare(t.label)), i;
2067
- });
2068
- function s(e) {
2069
- return a.value.some((t) => t.label.toLowerCase() === e.toLowerCase() || t.value.toLowerCase().startsWith(e.toLowerCase()));
2070
- }
2071
- let c = e?.defaultFont ?? Ur.split(",")[0].trim();
2072
- s(c) || Z.warn(`config.fonts: new templates seed "${c}", which the font picker doesn't offer — authors can't reselect it. Either add it to fonts.builtIns, or set fonts.defaultFont to an offered font.`);
2073
- function u() {
2074
- if (e?.defaultFont && s(e.defaultFont)) {
2075
- let t = a.value.find((t) => t.label.toLowerCase() === e.defaultFont.toLowerCase() || t.value.toLowerCase().startsWith(e.defaultFont.toLowerCase()));
2076
- if (t) return t.value;
2077
- }
2078
- return Ur;
2079
- }
2080
- let d = S(() => u());
2081
- function f(e) {
2082
- if (!e) return i.value;
2083
- let n = t.value.find((t) => t.name.toLowerCase() === e.toLowerCase());
2084
- return n ? `'${n.name}', ${n.fallback ?? i.value}` : Hr[e.toLowerCase()] || (e.includes(",") ? e : `${e}, ${i.value}`);
2085
- }
2086
- let p = [], m = !1;
2087
- async function g() {
2088
- if (t.value.length === 0) {
2089
- m || (n.value = !0);
2090
- return;
2091
- }
2092
- let e = t.value.map(async (e) => {
2093
- try {
2094
- if (document.querySelector(`link[data-custom-font="${CSS.escape(e.name)}"]`)) return;
2095
- let t = document.createElement("link");
2096
- t.rel = "stylesheet", t.href = e.url, t.setAttribute("data-custom-font", e.name), p.push(t), await new Promise((n, r) => {
2097
- t.onload = () => n(), t.onerror = () => r(/* @__PURE__ */ Error(`Failed to load font: ${e.name}`)), document.head.appendChild(t);
2098
- });
2099
- } catch (t) {
2100
- Z.warn(`Failed to load custom font "${e.name}":`, t);
2101
- }
2102
- });
2103
- await Promise.allSettled(e), !m && (n.value = !0);
2104
- }
2105
- function _() {
2106
- for (let e of p) e.remove();
2107
- p.length = 0;
2108
- }
2109
- return o() && h(() => {
2110
- m = !0, _();
2111
- }), {
2112
- fonts: a,
2113
- defaultFont: d,
2114
- defaultFallback: i,
2115
- customFonts: t,
2116
- isLoaded: n,
2117
- loadCustomFonts: g,
2118
- cleanupFontLinks: _,
2119
- getFontWithFallback: f,
2120
- getDefaultFont: u
2121
- };
2122
- }
2123
- //#endregion
2124
- //#region src/composables/useLogicTag.ts
2125
- function Kr() {
2126
- let e = n(Ot, []), t = n(Ke, []), r = n(et, Me.liquid), i = n(tt, null), a = n(ot, null), o = n(qe, null) ?? l(!1), s = !!i || e.length > 0 || t.length > 0, c = e.length > 0 || t.length > 0;
2127
- async function u() {
2128
- if (i) {
2129
- o.value = !0;
2130
- try {
2131
- return await i();
2132
- } finally {
2133
- o.value = !1;
2134
- }
2135
- }
2136
- if (a && c) {
2137
- o.value = !0;
2138
- try {
2139
- return await a.open(e, t);
2140
- } finally {
2141
- o.value = !1;
2142
- }
2143
- }
2144
- return null;
2145
- }
2146
- return {
2147
- logicTags: e,
2148
- logicPairs: t,
2149
- syntax: r,
2150
- canInsertLogicTag: s,
2151
- isRequesting: o,
2152
- requestLogicTag: u
2153
- };
2154
- }
2155
- //#endregion
2156
- //#region src/utils/mergeTagNodeSpec.ts
2157
- function qr(e, t, n) {
2158
- return ye(e, n) ? {
2159
- type: "logicMergeTagNode",
2160
- attrs: {
2161
- value: e,
2162
- keyword: _e(e, n)
2163
- }
2164
- } : {
2165
- type: "mergeTagNode",
2166
- attrs: {
2167
- label: t,
2168
- value: e
2169
- }
2170
- };
2171
- }
2172
- //#endregion
2173
- //#region src/utils/insertLogicTag.ts
2174
- function Jr(e) {
2175
- return "before" in e && "after" in e;
2176
- }
2177
- function Yr(e, t, n) {
2178
- if (!Jr(t)) {
2179
- e.chain().focus().insertContent(qr(t.value, t.label, n)).run();
2180
- return;
2181
- }
2182
- let r = qr(t.before, t.label, n), i = qr(t.after, t.label, n), { from: a, to: o } = e.state.selection;
2183
- if (a !== o) {
2184
- e.chain().focus().insertContentAt(o, i).insertContentAt(a, r).run();
2185
- return;
2186
- }
2187
- e.chain().focus().insertContentAt(a, [r, i]).setTextSelection(a + 1).run();
2188
- }
2189
- //#endregion
2190
- //#region src/utils/linkColorExtension.ts
2191
- function Xr(e) {
2192
- if (!e) return null;
2193
- let t = e.trim();
2194
- return /^#[0-9a-f]{3,8}$/i.test(t) || /^(rgb|rgba|hsl|hsla)\(\s*[0-9.,%/\s]+\)$/i.test(t) || /^[a-z]+$/i.test(t) ? t : null;
2195
- }
2196
- function Zr(e) {
2197
- return e.extend({ addAttributes() {
2198
- return {
2199
- ...this.parent?.(),
2200
- color: {
2201
- default: null,
2202
- parseHTML: (e) => Xr(Nt(e.style.color)),
2203
- renderHTML: (e) => {
2204
- let t = Xr(e.color);
2205
- return t ? { style: `color: ${t}` } : {};
2206
- }
2207
- }
2208
- };
2209
- } });
2210
- }
2211
- //#endregion
2212
- //#region src/composables/useRichTextLinkDialog.ts
2213
- function Qr(e, t = Me.liquid) {
2214
- let n = l(!1), r = l(""), i = l(""), a = l(null);
2215
- zr(a, n);
2216
- function o() {
2217
- let t = e.value?.getAttributes("link") ?? {};
2218
- r.value = t.href || "", i.value = t.color || "", n.value = !0;
2219
- }
2220
- function s() {
2221
- if (r.value) {
2222
- let t = d(r.value);
2223
- if (t !== null) {
2224
- let n = Xr(i.value), r = e.value?.chain().focus().extendMarkRange("link").setLink({ href: t }).updateAttributes("link", { color: n });
2225
- n && typeof e.value?.commands.unsetColor == "function" && r?.unsetColor(), r?.run();
2226
- }
2227
- }
2228
- p();
2229
- }
2230
- let c = /* @__PURE__ */ new Set([
2231
- "http",
2232
- "https",
2233
- "mailto",
2234
- "tel",
2235
- "ftp",
2236
- "ftps",
2237
- "sms",
2238
- "xmpp",
2239
- "cid"
2240
- ]);
2241
- function u(e) {
2242
- return RegExp(`^(?:${t.value.source})`).test(e);
2243
- }
2244
- function d(e) {
2245
- let t = e.trim();
2246
- if (!t) return null;
2247
- if (t.startsWith("#")) return t;
2248
- let n = /^([a-z][a-z0-9+.-]*):/i.exec(t);
2249
- return n ? c.has(n[1].toLowerCase()) ? t : null : u(t) ? t : `https://${t}`;
2250
- }
2251
- function f() {
2252
- e.value?.chain().focus().extendMarkRange("link").unsetLink().run(), p();
2253
- }
2254
- function p() {
2255
- n.value = !1, r.value = "", i.value = "";
2256
- }
2257
- function m(e) {
2258
- e.key === "Enter" ? (e.preventDefault(), s()) : e.key === "Escape" && p();
2259
- }
2260
- return {
2261
- showLinkDialog: n,
2262
- linkUrl: r,
2263
- linkColor: i,
2264
- linkDialogRef: a,
2265
- openLinkDialog: o,
2266
- insertLink: s,
2267
- removeLink: f,
2268
- closeLinkDialog: p,
2269
- handleLinkKeydown: m
2270
- };
2271
- }
2272
- //#endregion
2273
- //#region src/composables/useRichTextEditor.ts
2274
- function $r(r) {
2275
- let i = n(Y, null), { mergeTags: a, canRequestMergeTag: o, isRequesting: s, requestMergeTag: c, syntax: u, autocomplete: d } = an(), { canInsertLogicTag: f, isRequesting: p, requestLogicTag: m } = Kr(), h = n(Ye, null), g = (N(h) ? h.value : h)?.mergeTag?.suggestionEmpty ?? "No matching merge tags", _ = Ee(u), v = x(null), y = () => de(i?.content?.value?.settings ?? { locale: "en" });
2276
- t(y, (e) => {
2277
- let t = v.value?.view.dom;
2278
- t && t.setAttribute("dir", e);
2279
- });
2280
- let { showLinkDialog: b, linkUrl: S, linkColor: C, linkDialogRef: w, openLinkDialog: T, insertLink: E, removeLink: D, closeLinkDialog: O, handleLinkKeydown: k } = Qr(v, u), { start: A, stop: j } = Re(() => v.value?.commands.focus("end"), 0, { immediate: !1 }), M = x(null), P = l(!0), F = l(null), I = !1;
2281
- async function L() {
2282
- F.value = null, P.value = !0;
2283
- try {
2284
- let { TiptapEditor: e, EC: t, extensions: n } = await r.loadExtensions({
2285
- mergeTags: a,
2286
- syntax: u,
2287
- triggerChar: _,
2288
- autocompleteEnabled: d,
2289
- suggestionEmptyText: g
2290
- });
2291
- if (I) return;
2292
- M.value = t;
2293
- let o = /* @__PURE__ */ new Map();
2294
- n.forEach((e, t) => o.set(e.name, t));
2295
- let s = new e({
2296
- extensions: n.filter((e, t) => o.get(e.name) === t),
2297
- content: r.blockContent(),
2298
- editable: !0,
2299
- editorProps: { attributes: { dir: y() } },
2300
- onUpdate: ({ editor: e }) => {
2301
- I || i && i.updateBlock(r.blockId(), { content: e.getHTML() });
2302
- }
2303
- });
2304
- if (I) {
2305
- s.destroy();
2306
- return;
2307
- }
2308
- v.value = s, P.value = !1, A();
2309
- } catch (e) {
2310
- if (I) return;
2311
- Z.error(`[${r.editorName ?? "RichTextEditor"}] Failed to initialize TipTap editor:`, e), F.value = e instanceof Error ? e.message : "Failed to load editor", P.value = !1;
2312
- }
2313
- }
2314
- function R() {
2315
- v.value?.destroy(), v.value = null, L();
2316
- }
2317
- L();
2318
- let z = t(() => r.blockContent(), (e) => {
2319
- v.value && v.value.getHTML() !== e && v.value.commands.setContent(e, { emitUpdate: !1 });
2320
- });
2321
- function B(e) {
2322
- if (s.value || p.value) return;
2323
- let t = e.composedPath(), n = t.find((e) => e instanceof HTMLElement);
2324
- if (!n) return;
2325
- r.onClickOutsideSideEffect?.(n);
2326
- let i = t.some((e) => e instanceof HTMLElement && e.classList.contains("tpl-color-popover"));
2327
- n.closest(".tpl-text-editor-wrapper") || n.closest(".tpl-text-toolbar") || n.closest(".tpl-link-dialog") || i || r.onDone();
2328
- }
2329
- K(document, "mousedown", B), e(() => {
2330
- I = !0, z(), j(), v.value?.destroy();
2331
- });
2332
- async function V() {
2333
- let e = await c();
2334
- I || (e && v.value ? v.value.chain().focus().insertMergeTag({
2335
- label: e.label,
2336
- value: e.value
2337
- }).run() : v.value?.commands.focus());
2338
- }
2339
- async function H() {
2340
- let e = await m();
2341
- I || (e && v.value ? Yr(v.value, e, u) : v.value?.commands.focus());
2342
- }
2343
- return {
2344
- editor: v,
2345
- EditorContent: M,
2346
- isLoading: P,
2347
- initError: F,
2348
- retry: R,
2349
- showLinkDialog: b,
2350
- linkUrl: S,
2351
- linkColor: C,
2352
- linkDialogRef: w,
2353
- mergeTags: a,
2354
- canRequestMergeTag: o,
2355
- isRequestingMergeTag: s,
2356
- syntax: u,
2357
- canInsertLogicTag: f,
2358
- isRequestingLogicTag: p,
2359
- openLinkDialog: T,
2360
- insertLink: E,
2361
- removeLink: D,
2362
- closeLinkDialog: O,
2363
- handleLinkKeydown: k,
2364
- handleAddMergeTag: V,
2365
- handleAddLogicTag: H
2366
- };
2367
- }
2368
- //#endregion
2369
- //#region src/composables/useSmallScreenNotice.ts
2370
- var ei = "(max-width: 767px)";
2371
- function ti(e) {
2372
- let t = He(ei);
2373
- return {
2374
- isSmallScreen: t,
2375
- showNotice: S(() => (P(e) ?? !0) && t.value)
2376
- };
2377
- }
2378
- //#endregion
2379
- //#region src/components/blocks/CustomBlock.vue?vue&type=script&setup=true&lang.ts
2380
- var ni = { class: "tpl:w-full" }, ri = {
2381
- key: 0,
2382
- class: "tpl:flex tpl:min-h-[80px] tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border tpl:border-dashed tpl:py-4 tpl:border-[var(--tpl-warning)] tpl:bg-[var(--tpl-warning-light)]"
2383
- }, ii = { class: "tpl:text-sm tpl:text-[var(--tpl-text-muted)]" }, ai = {
2384
- key: 1,
2385
- class: "tpl:flex tpl:min-h-[80px] tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border tpl:border-dashed tpl:py-4 tpl:border-[var(--tpl-danger)] tpl:bg-[var(--tpl-danger-light)]"
2386
- }, oi = { class: "tpl:text-sm tpl:text-[var(--tpl-text-muted)]" }, si = {
2387
- key: 2,
2388
- class: "tpl:relative"
2389
- }, ci = ["innerHTML"], li = {
2390
- key: 0,
2391
- class: "tpl:absolute tpl:inset-0 tpl:flex tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-3 tpl:rounded tpl:backdrop-blur-[2px]",
2392
- style: { "background-color": "color-mix(in srgb, var(--tpl-bg) 80%, transparent)" }
2393
- }, ui = /* @__PURE__ */ d({
2394
- __name: "CustomBlock",
2395
- props: {
2396
- block: {},
2397
- viewport: {}
2398
- },
2399
- emits: ["fetchData"],
2400
- setup(e, { emit: r }) {
2401
- let i = e, a = r, { t: o } = X(), c = n(Et, null), u = l(""), d = l(!1), f = S(() => c?.getDefinition(i.block.customType)), p = S(() => !!f.value), { isFetching: m, fetch: h, needsFetch: g, hasDataSource: y } = bn({
2402
- definition: f,
2403
- block: S(() => i.block),
2404
- onUpdate: (e, t) => {
2405
- a("fetchData", {
2406
- fieldValues: e,
2407
- dataSourceFetched: t
2408
- });
2409
- }
2410
- }), b = n(q, []), x = n(J, null), T = S(() => {
2411
- if (!x?.value) return i.block;
2412
- let e = {};
2413
- for (let [t, n] of Object.entries(i.block.fieldValues)) e[t] = typeof n == "string" ? ge(n, b) : n;
2414
- return {
2415
- ...i.block,
2416
- fieldValues: e
2417
- };
2418
- });
2419
- async function D() {
2420
- if (c) {
2421
- d.value = !1;
2422
- try {
2423
- let e = await c.renderCustomBlock(T.value);
2424
- e.includes("Template render error:") && (d.value = !0), u.value = e;
2425
- } catch {
2426
- d.value = !0, u.value = "";
2427
- }
2428
- }
2429
- }
2430
- let k = ze(D, 150);
2431
- return E(() => {
2432
- D();
2433
- }), t(() => i.block.fieldValues, () => {
2434
- k();
2435
- }, { deep: !0 }), t(() => x?.value, () => {
2436
- k();
2437
- }), (e, t) => (s(), C("div", ni, [p.value ? d.value ? (s(), C("div", ai, [v(_(Zt), {
2438
- size: 24,
2439
- class: "tpl:text-[var(--tpl-danger)]"
2440
- }), M("span", oi, R(_(o).customBlocks.renderError), 1)])) : (s(), C("div", si, [M("div", { innerHTML: u.value }, null, 8, ci), _(y) && _(g) ? (s(), C("div", li, [_(m) ? (s(), A(tn, {
2441
- key: 1,
2442
- class: "tpl:w-48"
2443
- })) : (s(), C("button", {
2444
- key: 0,
2445
- type: "button",
2446
- class: "tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-2 tpl:rounded-[var(--tpl-radius-sm)] tpl:border tpl:border-[var(--tpl-border)] tpl:px-4 tpl:py-2 tpl:text-sm tpl:font-semibold tpl:shadow-[var(--tpl-shadow)] tpl:transition-all tpl:hover:border-[var(--tpl-primary)] tpl:hover:shadow-[var(--tpl-shadow-md)] tpl:bg-[var(--tpl-primary-light)] tpl:text-[var(--tpl-primary-hover)]",
2447
- onClick: t[0] ||= O((...e) => _(h) && _(h)(...e), ["stop"])
2448
- }, [f.value?.icon ? (s(), A(Lr, {
2449
- key: 0,
2450
- icon: f.value.icon,
2451
- size: 16
2452
- }, null, 8, ["icon"])) : w("", !0), V(" " + R(f.value?.dataSource?.label || _(o).customBlocks.dataSource.fetchButton), 1)]))])) : w("", !0)])) : (s(), C("div", ri, [v(_(Bt), {
2453
- size: 24,
2454
- class: "tpl:text-[var(--tpl-warning)]"
2455
- }), M("span", ii, R(_(o).customBlocks.definitionNotFound), 1)]))]));
2456
- }
2457
- }), di = { class: "tpl:w-full" }, fi = /* @__PURE__ */ d({
2458
- __name: "DividerBlock",
2459
- props: {
2460
- block: {},
2461
- viewport: {}
2462
- },
2463
- setup(e) {
2464
- let t = e, n = S(() => ({
2465
- borderTop: `${t.block.thickness}px ${t.block.lineStyle} ${t.block.color}`,
2466
- width: t.block.width === "full" ? "100%" : `${t.block.width}px`,
2467
- margin: t.block.width === "full" ? "0" : "0 auto"
2468
- }));
2469
- return (e, t) => (s(), C("div", di, [M("hr", {
2470
- class: "tpl:m-0 tpl:border-none",
2471
- style: k(n.value)
2472
- }, null, 4)]));
2473
- }
2474
- }), pi = { class: "tpl:w-full" }, mi = ["srcdoc", "title"], hi = {
2475
- key: 1,
2476
- class: "tpl:flex tpl:min-h-[80px] tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border tpl:border-dashed tpl:py-4 tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-hover)]"
2477
- }, gi = {
2478
- key: 0,
2479
- class: "tpl:text-sm tpl:text-[var(--tpl-text-muted)]"
2480
- }, _i = {
2481
- key: 1,
2482
- class: "tpl:text-sm tpl:text-[var(--tpl-text-dim)]"
2483
- }, vi = /* @__PURE__ */ d({
2484
- __name: "HtmlBlock",
2485
- props: {
2486
- block: {},
2487
- viewport: {}
2488
- },
2489
- setup(r) {
2490
- let i = r, { t: a } = X(), o = n(ft, !1), c = S(() => i.block.content.trim().length > 0), u = S(() => o && c.value), d = n(q, []), f = n(J, null), p = S(() => f?.value ? ge(i.block.content, d) : i.block.content), m = l(null), h = l(60), g = null;
2491
- function y() {
2492
- let e = m.value?.contentDocument;
2493
- e && (h.value = Math.max(e.body?.scrollHeight ?? 0, e.documentElement?.scrollHeight ?? 0));
2494
- }
2495
- function b() {
2496
- g?.disconnect(), g = null, y();
2497
- let e = m.value?.contentDocument?.documentElement;
2498
- e && typeof ResizeObserver < "u" && (g = new ResizeObserver(() => y()), g.observe(e));
2499
- }
2500
- return t(u, (e) => {
2501
- e || (g?.disconnect(), g = null);
2502
- }), e(() => {
2503
- g?.disconnect(), g = null;
2504
- }), (e, t) => (s(), C("div", pi, [u.value ? (s(), C("iframe", {
2505
- key: 0,
2506
- ref_key: "iframeRef",
2507
- ref: m,
2508
- srcdoc: p.value,
2509
- sandbox: "allow-same-origin",
2510
- title: _(a).html.preview,
2511
- class: "tpl:block tpl:w-full tpl:border-0",
2512
- style: k({ height: `${h.value}px` }),
2513
- onLoad: b
2514
- }, null, 44, mi)) : (s(), C("div", hi, [v(_(Vt), {
2515
- size: 24,
2516
- class: "tpl:text-[var(--tpl-text-dim)]"
2517
- }), c.value ? (s(), C("span", gi, R(_(a).html.preview), 1)) : (s(), C("span", _i, R(_(a).html.empty), 1))]))]));
2518
- }
2519
- }), yi = "image/";
2520
- function bi(e) {
2521
- let { target: t, onFiles: n, enabled: r } = e, i = () => r === void 0 || P(r), { isOverDropZone: a } = We(t, {
2522
- preventDefaultForUnhandled: !0,
2523
- onDrop: (e) => {
2524
- if (!i()) return;
2525
- let t = (e ?? []).filter((e) => e.type.startsWith(yi));
2526
- t.length > 0 && n([t[0]]);
2527
- }
2528
- });
2529
- return { isOver: S(() => i() && a.value) };
2530
- }
2531
- //#endregion
2532
- //#region src/components/blocks/ImageBlock.vue?vue&type=script&setup=true&lang.ts
2533
- var xi = ["data-drop-enabled"], Si = {
2534
- key: 0,
2535
- class: "tpl:pointer-events-none tpl:absolute tpl:inset-0 tpl:z-10 tpl:flex tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border-2 tpl:border-dashed tpl:text-xs tpl:font-medium tpl:border-[var(--tpl-primary)] tpl:text-[var(--tpl-primary)]",
2536
- style: { "background-color": "color-mix(in srgb, var(--tpl-bg) 85%, transparent)" }
2537
- }, Ci = ["href"], wi = ["src", "alt"], Ti = ["src", "alt"], Ei = {
2538
- class: "tpl:max-w-full tpl:truncate tpl:px-3 tpl:text-xs tpl:font-medium tpl:text-[var(--tpl-primary)]",
2539
- style: { opacity: "0.7" }
2540
- }, Di = ["href"], Oi = ["src", "alt"], ki = ["src", "alt"], Ai = {
2541
- key: 4,
2542
- class: "tpl:flex tpl:min-h-[100px] tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border-2 tpl:border-dashed tpl:text-sm tpl:border-[var(--tpl-border-light)] tpl:bg-[var(--tpl-bg-hover)] tpl:text-[var(--tpl-text-dim)]"
2543
- }, ji = ["aria-label"], Mi = { key: 1 }, Ni = /* @__PURE__ */ d({
2544
- __name: "ImageBlock",
2545
- props: {
2546
- block: {},
2547
- viewport: {}
2548
- },
2549
- emits: ["update"],
2550
- setup(e, { emit: t }) {
2551
- let r = e, i = t, { t: a } = X(), { syntax: o } = an(), c = n(rt, null), u = n(pt, null), d = S(() => !!c), f = on();
2552
- async function p() {
2553
- let e = await c?.({ accept: ["images"] });
2554
- if (f.alive && e) {
2555
- let t = { src: e.url };
2556
- e.alt && (t.alt = e.alt), i("update", t);
2557
- }
2558
- }
2559
- let m = l(), h = l(!1), g = S(() => (u?.value ?? !!c) && !h.value && !E.value);
2560
- async function y(e) {
2561
- if (c) {
2562
- h.value = !0;
2563
- try {
2564
- let t = await c({
2565
- accept: ["images"],
2566
- files: e
2567
- });
2568
- if (!f.alive) return;
2569
- if (t) {
2570
- let e = { src: t.url };
2571
- t.alt && (e.alt = t.alt), i("update", e);
2572
- }
2573
- } finally {
2574
- f.alive && (h.value = !1);
2575
- }
2576
- }
2577
- }
2578
- let { isOver: b } = bi({
2579
- target: m,
2580
- enabled: g,
2581
- onFiles: y
2582
- }), x = S(() => ({ textAlign: r.block.align })), T = S(() => {
2583
- let e = r.block.align;
2584
- return {
2585
- maxWidth: "100%",
2586
- width: r.block.width === "full" ? "100%" : `${r.block.width}px`,
2587
- height: r.block.height ? `${r.block.height}px` : void 0,
2588
- borderRadius: r.block.borderRadius && r.block.borderRadius > 0 ? `${r.block.borderRadius}px` : void 0,
2589
- display: "block",
2590
- marginLeft: e === "center" || e === "right" ? "auto" : void 0,
2591
- marginRight: e === "center" ? "auto" : void 0
2592
- };
2593
- }), E = S(() => W(r.block.src, o)), D = Ln(() => E.value ? void 0 : r.block.src), A = Ln(() => E.value ? r.block.placeholderUrl : void 0);
2594
- return (t, n) => (s(), C("div", {
2595
- ref_key: "dropZoneRef",
2596
- ref: m,
2597
- "data-testid": "image-drop-zone",
2598
- "data-drop-enabled": g.value,
2599
- class: "tpl:relative tpl:w-full",
2600
- style: k(x.value)
2601
- }, [g.value && (_(b) || h.value) ? (s(), C("div", Si, [h.value ? (s(), C(L, { key: 0 }, [v(_(qt), {
2602
- class: "tpl-spinner",
2603
- size: 20,
2604
- "stroke-width": 2
2605
- }), V(" " + R(_(a).image.uploading), 1)], 64)) : (s(), C(L, { key: 1 }, [v(_(Yt), {
2606
- size: 20,
2607
- "stroke-width": 1.5
2608
- }), V(" " + R(_(a).image.dropToUpload), 1)], 64))])) : w("", !0), e.block.src && E.value && e.block.placeholderUrl ? (s(), C(L, { key: 1 }, [e.block.linkUrl ? (s(), C("a", {
2609
- key: 0,
2610
- href: e.block.linkUrl,
2611
- target: "_blank",
2612
- rel: "noopener noreferrer",
2613
- onClick: n[0] ||= O(() => {}, ["prevent"])
2614
- }, [M("img", {
2615
- class: "tpl:border-0",
2616
- loading: "lazy",
2617
- src: _(A),
2618
- alt: e.block.alt || _(a).image.altTextPlaceholder,
2619
- style: k(T.value)
2620
- }, null, 12, wi)], 8, Ci)) : (s(), C("img", {
2621
- key: 1,
2622
- class: "tpl:border-0",
2623
- src: _(A),
2624
- alt: e.block.alt,
2625
- style: k(T.value)
2626
- }, null, 12, Ti))], 64)) : e.block.src && E.value ? (s(), C("div", {
2627
- key: 2,
2628
- class: "tpl:!flex tpl:min-h-[120px] tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border-2 tpl:border-dashed tpl:text-center tpl:bg-[var(--tpl-bg-elevated)]",
2629
- style: k([{ "border-color": "color-mix(in srgb, var(--tpl-primary) 40%, transparent)" }, T.value])
2630
- }, [v(_(Gt), {
2631
- size: 32,
2632
- "stroke-width": 1.5,
2633
- class: "tpl:text-[var(--tpl-primary)]",
2634
- style: { opacity: "0.5" }
2635
- }), M("span", Ei, [v(Mr, { text: e.block.src }, null, 8, ["text"])])], 4)) : e.block.src ? (s(), C(L, { key: 3 }, [e.block.linkUrl ? (s(), C("a", {
2636
- key: 0,
2637
- href: e.block.linkUrl,
2638
- target: "_blank",
2639
- rel: "noopener noreferrer",
2640
- onClick: n[1] ||= O(() => {}, ["prevent"])
2641
- }, [M("img", {
2642
- class: "tpl:border-0",
2643
- loading: "lazy",
2644
- src: _(D),
2645
- alt: e.block.alt || _(a).image.altTextPlaceholder,
2646
- style: k(T.value)
2647
- }, null, 12, Oi)], 8, Di)) : (s(), C("img", {
2648
- key: 1,
2649
- class: "tpl:border-0",
2650
- src: _(D),
2651
- alt: e.block.alt,
2652
- style: k(T.value)
2653
- }, null, 12, ki))], 64)) : (s(), C("div", Ai, [d.value ? (s(), C("button", {
2654
- key: 0,
2655
- "aria-label": _(a).image.browseMedia,
2656
- class: "tpl:flex tpl:items-center tpl:gap-1.5 tpl:rounded-md tpl:border tpl:px-3 tpl:py-2 tpl:text-xs tpl:font-medium tpl:transition-all tpl:cursor-pointer tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-primary)] tpl:bg-[var(--tpl-bg)]",
2657
- onClick: O(p, ["stop"])
2658
- }, [v(_(Gt), {
2659
- size: 14,
2660
- "stroke-width": 1.5
2661
- }), V(" " + R(_(a).image.browseMedia), 1)], 8, ji)) : (s(), C("span", Mi, R(_(a).image.clickToAdd), 1))]))], 12, xi));
2662
- }
2663
- }), Pi = { class: "tpl:w-full" }, Fi = ["href"], Ii = {
2664
- key: 1,
2665
- class: "tpl:flex tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border tpl:border-dashed tpl:py-4 tpl:text-sm tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text-dim)]"
2666
- }, Li = /* @__PURE__ */ d({
2667
- __name: "MenuBlock",
2668
- props: {
2669
- block: {},
2670
- viewport: {}
2671
- },
2672
- setup(e) {
2673
- let t = e, { t: n } = X(), i = S(() => ({
2674
- display: "flex",
2675
- flexWrap: "wrap",
2676
- gap: `0 ${t.block.spacing}px`,
2677
- justifyContent: t.block.textAlign === "left" ? "flex-start" : t.block.textAlign === "right" ? "flex-end" : "center",
2678
- fontSize: `${t.block.fontSize}px`,
2679
- fontFamily: t.block.fontFamily || "inherit",
2680
- alignItems: "center"
2681
- })), a = S(() => t.block.items.length > 0);
2682
- function o(e) {
2683
- return e || t.block.linkColor || t.block.color;
2684
- }
2685
- return (t, c) => (s(), C("div", Pi, [a.value ? (s(), C("div", {
2686
- key: 0,
2687
- style: k(i.value)
2688
- }, [(s(!0), C(L, null, r(e.block.items, (t, n) => (s(), C(L, { key: t.id }, [M("a", {
2689
- href: t.url || "#",
2690
- class: "tpl:cursor-default tpl:no-underline",
2691
- style: k({
2692
- color: o(t.color),
2693
- fontWeight: t.bold ? "bold" : "normal",
2694
- textDecoration: t.underline ? "underline" : "none"
2695
- }),
2696
- onClick: c[0] ||= O(() => {}, ["prevent"])
2697
- }, [v(Mr, { text: t.text || "..." }, null, 8, ["text"])], 12, Fi), n < e.block.items.length - 1 ? (s(), C("span", {
2698
- key: 0,
2699
- style: k({
2700
- color: e.block.separatorColor,
2701
- padding: `0 ${e.block.spacing}px`
2702
- })
2703
- }, R(e.block.separator), 5)) : w("", !0)], 64))), 128))], 4)) : (s(), C("div", Ii, [v(_(Ut), { size: 16 }), M("span", null, R(_(n).menu.addLinks), 1)]))]));
2704
- }
2705
- }), Ri = /* @__PURE__ */ new Set([
2706
- "http",
2707
- "https",
2708
- "mailto",
2709
- "tel",
2710
- "ftp",
2711
- "ftps",
2712
- "sms",
2713
- "xmpp",
2714
- "cid"
2715
- ]), zi = /* @__PURE__ */ new Set([
2716
- "SCRIPT",
2717
- "STYLE",
2718
- "IFRAME",
2719
- "OBJECT",
2720
- "EMBED",
2721
- "LINK",
2722
- "META",
2723
- "BASE",
2724
- "FORM"
2725
- ]), Bi = /* @__PURE__ */ new Set([
2726
- "href",
2727
- "xlink:href",
2728
- "formaction",
2729
- "action",
2730
- "ping",
2731
- "background",
2732
- "poster"
2733
- ]);
2734
- function Vi(e, t) {
2735
- let n = e.replace(/[\t\n\r]/g, "").replace(/^[\u0000-\u0020]+/, "").trimEnd();
2736
- if (!n || n.startsWith("#")) return !0;
2737
- let r = /^([a-z][a-z0-9+.-]*):/i.exec(n);
2738
- if (!r) return !0;
2739
- let i = r[1].toLowerCase();
2740
- return Ri.has(i) ? !0 : t && i === "data" ? /^data:image\/(png|jpe?g|gif|webp|svg\+xml);/i.test(n) : !1;
2741
- }
2742
- function Hi(e) {
2743
- if (zi.has(e.tagName)) {
2744
- e.remove();
2745
- return;
2746
- }
2747
- let t = [];
2748
- for (let n = 0; n < e.attributes.length; n++) t.push(e.attributes[n].name);
2749
- for (let n of t) {
2750
- let t = n.toLowerCase();
2751
- if (t.startsWith("on")) {
2752
- e.removeAttribute(n);
2753
- continue;
2754
- }
2755
- if (Bi.has(t)) {
2756
- Vi(e.getAttribute(n) ?? "", !1) || e.removeAttribute(n);
2757
- continue;
2758
- }
2759
- if (t === "src") {
2760
- Vi(e.getAttribute(n) ?? "", !0) || e.removeAttribute(n);
2761
- continue;
2762
- }
2763
- t === "srcdoc" && e.removeAttribute(n);
2764
- }
2765
- let n = Array.from(e.children);
2766
- for (let e of n) Hi(e);
2767
- }
2768
- function Ui(e) {
2769
- if (typeof DOMParser > "u") return e;
2770
- let t = new DOMParser().parseFromString(`<!doctype html><body>${e}</body>`, "text/html").body, n = Array.from(t.children);
2771
- for (let e of n) Hi(e);
2772
- return t.innerHTML;
2773
- }
2774
- //#endregion
2775
- //#region src/composables/useEditableTextBlock.ts
2776
- function Wi(e) {
2777
- let t = n(q, []), r = n(J, null), { syntax: i } = an(), a = S(() => r?.value ? xe(e(), t) : De(e(), t)), o = S(() => Ui(je(a.value, i))), s = l(!1), c = l(null), { top: u, left: d } = Ue(c), { toLocal: f } = It(), p = S(() => f({
2778
- top: u.value - 8,
2779
- left: d.value
2780
- }));
2781
- function m() {
2782
- s.value = !0;
2783
- }
2784
- function h() {
2785
- s.value = !1;
2786
- }
2787
- return {
2788
- isEditing: s,
2789
- blockRef: c,
2790
- toolbarPosition: p,
2791
- resolvedContent: o,
2792
- handleDoubleClick: m,
2793
- handleEditorDone: h
2794
- };
2795
- }
2796
- //#endregion
2797
- //#region src/components/blocks/ParagraphBlock.vue?vue&type=script&setup=true&lang.ts
2798
- var Gi = ["innerHTML"], Ki = /* @__PURE__ */ d({
2799
- __name: "ParagraphBlock",
2800
- props: {
2801
- block: {},
2802
- viewport: {}
2803
- },
2804
- setup(e) {
2805
- let t = e, n = B(() => import("./ParagraphEditor-Bd-GQXee.js")), { isEditing: r, blockRef: i, toolbarPosition: a, resolvedContent: o, handleDoubleClick: c, handleEditorDone: l } = Wi(() => t.block.content);
2806
- return (t, u) => (s(), C("div", {
2807
- ref_key: "blockRef",
2808
- ref: i,
2809
- class: "tpl:min-h-[1em] tpl:w-full",
2810
- onDblclick: u[0] ||= (...e) => _(c) && _(c)(...e)
2811
- }, [_(r) ? (s(), A(_(n), {
2812
- key: 0,
2813
- block: e.block,
2814
- "toolbar-position": _(a),
2815
- onDone: _(l)
2816
- }, null, 8, [
2817
- "block",
2818
- "toolbar-position",
2819
- "onDone"
2820
- ])) : (s(), C("div", {
2821
- key: 1,
2822
- class: "tpl-text-content tpl:outline-none",
2823
- innerHTML: _(o)
2824
- }, null, 8, Gi))], 544));
2825
- }
2826
- });
2827
- //#endregion
2828
- //#region src/utils/blockComponentResolver.ts
2829
- function qi(e) {
2830
- let t = { fontFamily: e.fontFamily };
2831
- return e.textColor && (t.color = e.textColor), e.linkColor && (t["--tpl-doc-link-color"] = e.linkColor), e.linkUnderline && (t["--tpl-doc-link-underline"] = "underline"), t;
2832
- }
2833
- function Ji(e, t, n) {
2834
- if (t) {
2835
- let n = t.getComponent(e);
2836
- if (n) return n;
2837
- }
2838
- return n[e.type] ?? null;
2839
- }
2840
- function Yi(e) {
2841
- let { padding: t, backgroundColor: n } = e.styles, r = {
2842
- padding: `${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`,
2843
- backgroundColor: n || "transparent"
2844
- };
2845
- return (e.type === "paragraph" || e.type === "title") && (r["--tpl-doc-paragraph-spacing"] = `${e.type === "paragraph" ? e.paragraphSpacing ?? Ce.paragraphGap : Ce.paragraphGap}px`), e.type === "section" && e.borderRadius && e.borderRadius > 0 && (r.borderRadius = `${e.borderRadius}px`), r;
2846
- }
2847
- function Xi(e) {
2848
- if (e.type !== "section" || !e.wrapper) return null;
2849
- let t = e.wrapper, n = {};
2850
- return t.backgroundColor && (n.backgroundColor = t.backgroundColor), t.padding && (n.padding = `${t.padding.top}px ${t.padding.right}px ${t.padding.bottom}px ${t.padding.left}px`), t.borderRadius && t.borderRadius > 0 && (n.borderRadius = `${t.borderRadius}px`), n;
2851
- }
2852
- //#endregion
2853
- //#region src/components/blocks/BlockWrapper.vue?vue&type=script&setup=true&lang.ts
2854
- var Zi = [
2855
- "data-block-id",
2856
- "data-block-type",
2857
- "data-tpl-picked"
2858
- ], Qi = ["aria-label"], $i = [
2859
- "aria-label",
2860
- "aria-pressed",
2861
- "title"
2862
- ], ea = ["aria-label", "title"], ta = ["aria-label", "title"], na = ["aria-label", "title"], ra = {
2863
- key: 1,
2864
- class: "tpl-block-hidden-overlay tpl:pointer-events-none tpl:absolute tpl:inset-0 tpl:z-[5] tpl:flex tpl:items-center tpl:justify-center tpl:rounded-sm"
2865
- }, ia = { class: "tpl:flex tpl:items-center tpl:gap-1 tpl:rounded tpl:px-2 tpl:py-1 tpl:text-[10px] tpl:font-medium tpl:bg-[var(--tpl-chrome-bg-elevated)] tpl:text-[var(--tpl-chrome-text-muted)] tpl:shadow-[var(--tpl-shadow-sm)]" }, aa = {
2866
- key: 2,
2867
- class: "tpl:absolute tpl:-left-1 tpl:top-1/2 tpl:z-[5] tpl:-translate-x-full tpl:-translate-y-1/2"
2868
- }, oa = ["aria-label", "title"], sa = {
2869
- key: 3,
2870
- class: "tpl:absolute tpl:-right-1 tpl:-top-1 tpl:z-[5] tpl:translate-x-full"
2871
- }, ca = ["aria-label"], la = /*#__PURE__*/ nn(/* @__PURE__ */ d({
2872
- __name: "BlockWrapper",
2873
- props: {
2874
- block: {},
2875
- isSelected: { type: Boolean },
2876
- viewport: {},
2877
- previewMode: { type: Boolean },
2878
- nested: { type: Boolean },
2879
- picked: { type: Boolean }
2880
- },
2881
- emits: ["select"],
2882
- setup(e, { emit: t }) {
2883
- let r = B(() => import("./BlockIssueBadge-BJ__oEtm.js")), i = e, o = t, { t: c, format: u } = X(), d = n(at, null), f = l(null), p = S(() => d?.liftedBlockId.value === i.block.id), m = S(() => p.value ? u(c.blockActions.dragLifted, { block: i.block.type }) : c.blockActions.drag);
2884
- async function h() {
2885
- await D(), f.value?.focus();
2886
- }
2887
- function g(e) {
2888
- if (d) {
2889
- if (e.key === " " || e.key === "Enter") {
2890
- e.preventDefault(), e.stopPropagation(), p.value ? d.drop(i.block.id) : d.lift(i.block.id);
2891
- return;
2892
- }
2893
- if (p.value) {
2894
- if (e.key === "Escape") {
2895
- e.preventDefault(), e.stopPropagation(), d.cancel(), h();
2896
- return;
2897
- }
2898
- if (e.key === "ArrowUp") {
2899
- e.preventDefault(), e.stopPropagation(), d.moveUp(i.block.id), h();
2900
- return;
2901
- }
2902
- e.key === "ArrowDown" && (e.preventDefault(), e.stopPropagation(), d.moveDown(i.block.id), h());
2903
- }
2904
- }
2905
- }
2906
- let y = S(() => !i.viewport || !i.block.visibility ? !1 : i.block.visibility[i.viewport] === !1), x = S(() => i.previewMode === !0 && y.value), T = S(() => i.viewport ? {
2907
- desktop: c.viewport.desktop,
2908
- mobile: c.viewport.mobile
2909
- }[i.viewport] ?? i.viewport : ""), E = S(() => !!i.block.displayCondition), A = n(dt, null), j = n(ht, null), N = n(yt, {}), P = S(() => N.savedBlocks?.isPicking.value === !0), F = S(() => !i.nested && N.savedBlocks?.isAvailable.value === !0 && N.savedBlocks?.canCreate.value === !0), I = S(() => i.isSelected && !P.value), L = S(() => N.comments?.getBlockCount(i.block.id) ?? 0), z = S(() => Yi(i.block)), H = S(() => Xi(i.block));
2910
- function ee(e) {
2911
- i.previewMode || (e.target?.closest("a") && e.preventDefault(), e.stopPropagation(), o("select"));
2912
- }
2913
- function te() {
2914
- A?.deleteBlock(i.block.id);
2915
- }
2916
- function ne() {
2917
- A?.duplicateBlock(i.block);
2918
- }
2919
- function re() {
2920
- N.savedBlocks?.startPicking(i.block.id);
2921
- }
2922
- function ie() {
2923
- j?.toggleBlock(i.block.id);
2924
- }
2925
- return (t, n) => x.value ? w("", !0) : (s(), C("div", {
2926
- key: 0,
2927
- class: b(["tpl-block tpl:group tpl:relative tpl:cursor-pointer tpl:rounded-sm tpl:transition-shadow", {
2928
- "tpl-block--selected": e.isSelected,
2929
- "tpl-block--picked": e.picked,
2930
- "tpl-block--idle": !e.isSelected && !e.picked,
2931
- "tpl-block--lifted": p.value
2932
- }]),
2933
- "data-block-id": e.block.id,
2934
- "data-block-type": e.block.type,
2935
- "data-tpl-picked": e.picked || void 0,
2936
- onClick: ee
2937
- }, [
2938
- v(_(r), { "block-id": e.block.id }, null, 8, ["block-id"]),
2939
- I.value ? (s(), C("div", {
2940
- key: 0,
2941
- role: "toolbar",
2942
- "aria-label": _(c).blockActions.drag,
2943
- class: "tpl-block-actions tpl-fade-in tpl:absolute tpl:-right-2 tpl:top-1/2 tpl:z-10 tpl:flex tpl:-translate-y-1/2 tpl:translate-x-full tpl:gap-0.5 tpl:rounded-[var(--tpl-radius-sm)] tpl:p-1 tpl:bg-[var(--tpl-chrome-bg-elevated)] tpl:shadow-[var(--tpl-shadow-md)] tpl:border tpl:border-[var(--tpl-border)]"
2944
- }, [
2945
- M("button", {
2946
- ref_key: "dragButtonRef",
2947
- ref: f,
2948
- class: "tpl-block-btn tpl-block-action-btn tpl:flex tpl:size-7 tpl:cursor-grab tpl:items-center tpl:justify-center tpl:rounded-sm tpl:border-none tpl:transition-colors tpl:active:cursor-grabbing",
2949
- "aria-label": m.value,
2950
- "aria-pressed": p.value,
2951
- "aria-keyshortcuts": "Space Enter ArrowUp ArrowDown Escape",
2952
- title: _(c).blockActions.drag,
2953
- onKeydown: g
2954
- }, [v(_(Kt), {
2955
- size: 14,
2956
- "stroke-width": 1.5
2957
- })], 40, $i),
2958
- M("button", {
2959
- class: "tpl-block-action-btn tpl:flex tpl:size-7 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-sm tpl:border-none tpl:transition-colors",
2960
- "aria-label": _(c).blockActions.duplicate,
2961
- title: _(c).blockActions.duplicate,
2962
- onClick: O(ne, ["stop"])
2963
- }, [v(_(zt), {
2964
- size: 14,
2965
- "stroke-width": 1.5
2966
- })], 8, ea),
2967
- F.value ? (s(), C("button", {
2968
- key: 0,
2969
- class: "tpl-block-action-btn tpl:flex tpl:size-7 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-sm tpl:border-none tpl:transition-colors",
2970
- "aria-label": _(c).blockActions.saveAsBlock,
2971
- title: _(c).blockActions.saveAsBlock,
2972
- onClick: O(re, ["stop"])
2973
- }, [v(_(Rt), {
2974
- size: 14,
2975
- "stroke-width": 1.5
2976
- })], 8, ta)) : w("", !0),
2977
- M("button", {
2978
- class: "tpl-block-action-btn tpl-block-delete-btn tpl:flex tpl:size-7 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-sm tpl:border-none tpl:transition-colors",
2979
- "aria-label": _(c).blockActions.delete,
2980
- title: _(c).blockActions.delete,
2981
- onClick: O(te, ["stop"])
2982
- }, [v(_(Wt), {
2983
- size: 14,
2984
- "stroke-width": 1.5
2985
- })], 8, na)
2986
- ], 8, Qi)) : w("", !0),
2987
- y.value ? (s(), C("div", ra, [M("span", ia, [v(_(Ht), {
2988
- size: 12,
2989
- "stroke-width": 1.5
2990
- }), V(" " + R(_(u)(_(c).blockActions.hiddenOnViewport, { viewport: T.value })), 1)])])) : w("", !0),
2991
- E.value && !y.value ? (s(), C("div", aa, [M("button", {
2992
- "data-testid": "condition-toggle",
2993
- class: "tpl-condition-toggle tpl:flex tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-md tpl:p-1 tpl:transition-colors tpl:bg-[var(--tpl-chrome-bg-elevated)] tpl:text-[var(--tpl-primary)] tpl:border tpl:border-[var(--tpl-border)]",
2994
- "aria-label": _(c).blockActions.conditionToggle,
2995
- title: e.block.displayCondition?.label,
2996
- onClick: O(ie, ["stop"])
2997
- }, [v(_($t), {
2998
- size: 12,
2999
- "stroke-width": 2
3000
- })], 8, oa)])) : w("", !0),
3001
- L.value > 0 && !y.value ? (s(), C("div", sa, [M("button", {
3002
- class: "tpl-comment-indicator tpl:flex tpl:min-h-6 tpl:min-w-6 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:gap-0.5 tpl:rounded-full tpl:border-none tpl:px-2 tpl:py-0.5 tpl:text-[10px] tpl:font-semibold tpl:transition-colors tpl:bg-[var(--tpl-chrome-primary-light)] tpl:text-[var(--tpl-primary)]",
3003
- "aria-label": _(u)(_(c).blockActions.comments, { count: String(L.value) }),
3004
- onClick: n[0] ||= O((t) => _(N).comments?.openForBlock(e.block.id), ["stop"])
3005
- }, [v(_(Xt), {
3006
- size: 12,
3007
- "stroke-width": 2.5
3008
- }), V(" " + R(L.value), 1)], 8, ca)])) : w("", !0),
3009
- H.value ? (s(), C("div", {
3010
- key: 4,
3011
- class: "tpl-section-wrapper",
3012
- style: k(H.value)
3013
- }, [M("div", {
3014
- class: "tpl-block-content",
3015
- style: k(z.value)
3016
- }, [a(t.$slots, "default", {}, void 0, !0)], 4)], 4)) : (s(), C("div", {
3017
- key: 5,
3018
- class: "tpl-block-content",
3019
- style: k(z.value)
3020
- }, [a(t.$slots, "default", {}, void 0, !0)], 4))
3021
- ], 10, Zi));
3022
- }
3023
- }), [["__scopeId", "data-v-2c239048"]]);
3024
- //#endregion
3025
- //#region src/utils/unwrapParagraph.ts
3026
- function ua(e) {
3027
- let t = e.match(/^\s*<p\b[^>]*>([\s\S]*)<\/p>\s*$/);
3028
- return !t || /<\/p>\s*<p\b/i.test(t[1]) ? e : t[1];
3029
- }
3030
- //#endregion
3031
- //#region src/components/blocks/TitleBlock.vue
3032
- var da = /* @__PURE__ */ d({
3033
- __name: "TitleBlock",
3034
- props: {
3035
- block: {},
3036
- viewport: {}
3037
- },
3038
- setup(e) {
3039
- let t = e, n = B(() => import("./TitleEditor-CrnuIq62.js")), { isEditing: r, blockRef: i, toolbarPosition: a, resolvedContent: o, handleDoubleClick: c, handleEditorDone: l } = Wi(() => t.block.content), d = S(() => {
3040
- let e = {
3041
- fontSize: `${Ne[t.block.level]}px`,
3042
- textAlign: t.block.textAlign
3043
- };
3044
- return t.block.color && (e.color = t.block.color), t.block.fontFamily && (e.fontFamily = t.block.fontFamily), e;
3045
- }), f = S(() => `h${t.block.level}`), p = S(() => ua(o.value));
3046
- return (t, o) => (s(), C("div", {
3047
- ref_key: "blockRef",
3048
- ref: i,
3049
- class: "tpl:min-h-[1em] tpl:w-full",
3050
- style: k(d.value),
3051
- onDblclick: o[0] ||= (...e) => _(c) && _(c)(...e)
3052
- }, [_(r) ? (s(), A(_(n), {
3053
- key: 0,
3054
- block: e.block,
3055
- "toolbar-position": _(a),
3056
- onDone: _(l)
3057
- }, null, 8, [
3058
- "block",
3059
- "toolbar-position",
3060
- "onDone"
3061
- ])) : (s(), A(u(f.value), {
3062
- key: 1,
3063
- class: "tpl-text-content tpl:m-0 tpl:font-[inherit] tpl:text-[length:inherit] tpl:leading-tight tpl:outline-none",
3064
- style: { color: "inherit" },
3065
- innerHTML: p.value
3066
- }, null, 8, ["innerHTML"]))], 36));
3067
- }
3068
- });
3069
- //#endregion
3070
- //#region src/utils/sectionColumnDrop.ts
3071
- function fa(e) {
3072
- return e.dataset.blockType !== "section" && e.dataset.paletteType !== "section";
3073
- }
3074
- //#endregion
3075
- //#region src/components/blocks/SectionBlock.vue?vue&type=script&setup=true&lang.ts
3076
- var pa = { class: "tpl:w-full" }, ma = {
3077
- key: 0,
3078
- "data-testid": "section-drop-hint",
3079
- class: "tpl:pointer-events-none tpl:absolute tpl:inset-0 tpl:flex tpl:items-center tpl:justify-center tpl:text-xs tpl:text-[var(--tpl-chrome-text-dim)]"
3080
- }, ha = /* @__PURE__ */ d({
3081
- __name: "SectionBlock",
3082
- props: {
3083
- block: {},
3084
- viewport: {}
3085
- },
3086
- setup(e) {
3087
- let t = {
3088
- title: da,
3089
- paragraph: Ki,
3090
- image: Ni,
3091
- button: Pr,
3092
- divider: fi,
3093
- custom: ui
3094
- }, a = e, { t: o } = X(), c = lt(Y, "SectionBlock"), l = n(ht, null), d = n(Et, null), p = n(yt, {}), m = n(Tt, null);
3095
- function h(e) {
3096
- let t = p.savedBlocks;
3097
- if (t?.isPicking.value) {
3098
- t.togglePick(a.block.id);
3099
- return;
3100
- }
3101
- c.selectBlock(e);
3102
- }
3103
- let g = S(() => {
3104
- switch (a.block.columns) {
3105
- case "2": return ["50%", "50%"];
3106
- case "3": return [
3107
- "33.33%",
3108
- "33.33%",
3109
- "33.33%"
3110
- ];
3111
- case "1-2": return ["33.33%", "66.67%"];
3112
- case "2-1": return ["66.67%", "33.33%"];
3113
- default: return ["100%"];
3114
- }
3115
- }), y = S(() => {
3116
- let e = g.value.length, t = [...a.block.children];
3117
- for (; t.length < e;) t.push([]);
3118
- return t.slice(0, e);
3119
- }), x = S(() => a.viewport === "mobile" && a.block.stackOnMobile !== !1);
3120
- function T(e) {
3121
- return y.value[e] || [];
3122
- }
3123
- function E(e, t) {
3124
- let n = t.map((e) => JSON.parse(JSON.stringify(e))), r = [...a.block.children];
3125
- for (; r.length <= e;) r.push([]);
3126
- r[e] = n, c.updateBlock(a.block.id, { children: r });
3127
- }
3128
- function D(e) {
3129
- return Ji(e, d, t);
3130
- }
3131
- function O(e, t) {
3132
- e.type === "custom" && c.updateBlock(e.id, {
3133
- fieldValues: t.fieldValues,
3134
- dataSourceFetched: t.dataSourceFetched
3135
- });
3136
- }
3137
- return (t, n) => (s(), C("div", pa, [M("div", { class: b(["tpl:flex tpl:gap-0", { "tpl:flex-col": x.value }]) }, [(s(!0), C(L, null, r(y.value, (t, n) => (s(), C("div", {
3138
- key: n,
3139
- class: b(["tpl:relative tpl:min-h-[60px] tpl:rounded", T(n).length === 0 ? "tpl:border tpl:border-dashed tpl:border-[var(--tpl-border)]" : ""]),
3140
- style: k({ width: x.value ? "100%" : g.value[n] })
3141
- }, [v(_(I), {
3142
- "model-value": T(n),
3143
- group: {
3144
- name: "blocks",
3145
- pull: !0,
3146
- put: (e, t, n) => _(fa)(n)
3147
- },
3148
- animation: 150,
3149
- "ghost-class": "tpl-ghost",
3150
- "drag-class": "tpl-dragging",
3151
- handle: ".tpl-block-btn",
3152
- "invert-swap": !0,
3153
- "inverted-swap-threshold": .65,
3154
- "empty-insert-threshold": 20,
3155
- "force-fallback": !0,
3156
- class: "tpl:min-h-[60px]",
3157
- "onUpdate:modelValue": (e) => E(n, e)
3158
- }, {
3159
- default: i(() => [(s(!0), C(L, null, r(T(n), (t) => f((s(), C("div", { key: t.id }, [v(la, {
3160
- block: t,
3161
- "is-selected": _(c).state.selectedBlockId === t.id,
3162
- viewport: e.viewport,
3163
- "preview-mode": _(c).state.previewMode,
3164
- nested: "",
3165
- onSelect: (e) => h(t.id)
3166
- }, {
3167
- default: i(() => [(s(), A(u(D(t)), {
3168
- block: t,
3169
- viewport: e.viewport,
3170
- onFetchData: (e) => O(t, e),
3171
- onUpdate: (e) => _(c).updateBlock(t.id, e)
3172
- }, null, 40, [
3173
- "block",
3174
- "viewport",
3175
- "onFetchData",
3176
- "onUpdate"
3177
- ]))]),
3178
- _: 2
3179
- }, 1032, [
3180
- "block",
3181
- "is-selected",
3182
- "viewport",
3183
- "preview-mode",
3184
- "onSelect"
3185
- ])])), [[F, _(m) === !1 || !_(l)?.isHidden(t.id)]])), 128))]),
3186
- _: 2
3187
- }, 1032, [
3188
- "model-value",
3189
- "group",
3190
- "onUpdate:modelValue"
3191
- ]), T(n).length === 0 ? (s(), C("div", ma, [M("span", null, R(_(o).section.dropHere), 1)])) : w("", !0)], 6))), 128))], 2)]));
3192
- }
3193
- }), ga = ke, _a = {
3194
- small: 24,
3195
- medium: 32,
3196
- large: 48
3197
- }, va = [
3198
- "facebook",
3199
- "twitter",
3200
- "instagram",
3201
- "linkedin",
3202
- "youtube",
3203
- "tiktok",
3204
- "pinterest",
3205
- "email",
3206
- "website",
3207
- "whatsapp",
3208
- "telegram",
3209
- "discord",
3210
- "snapchat",
3211
- "reddit",
3212
- "github",
3213
- "dribbble",
3214
- "behance"
3215
- ], ya = [
3216
- "width",
3217
- "height",
3218
- "fill"
3219
- ], ba = ["d"], xa = /* @__PURE__ */ d({
3220
- __name: "SocialIconSvg",
3221
- props: {
3222
- platform: {},
3223
- iconStyle: {},
3224
- iconSize: {}
3225
- },
3226
- setup(e) {
3227
- let t = e, n = S(() => ga[t.platform]), r = S(() => _a[t.iconSize]), i = S(() => {
3228
- let e = {
3229
- display: "inline-flex",
3230
- alignItems: "center",
3231
- justifyContent: "center",
3232
- width: `${r.value}px`,
3233
- height: `${r.value}px`
3234
- };
3235
- switch (t.iconStyle) {
3236
- case "solid": return {
3237
- ...e,
3238
- backgroundColor: n.value.color,
3239
- borderRadius: "4px"
3240
- };
3241
- case "outlined": return {
3242
- ...e,
3243
- backgroundColor: "transparent",
3244
- border: `2px solid ${n.value.color}`,
3245
- borderRadius: "4px"
3246
- };
3247
- case "rounded": return {
3248
- ...e,
3249
- backgroundColor: n.value.color,
3250
- borderRadius: "8px"
3251
- };
3252
- case "square": return {
3253
- ...e,
3254
- backgroundColor: n.value.color,
3255
- borderRadius: "0"
3256
- };
3257
- case "circle": return {
3258
- ...e,
3259
- backgroundColor: n.value.color,
3260
- borderRadius: "50%"
3261
- };
3262
- default: return e;
3263
- }
3264
- }), a = S(() => Math.floor(r.value * .6)), o = S(() => t.iconStyle === "outlined" ? n.value.color : "#ffffff");
3265
- return (e, t) => (s(), C("span", { style: k(i.value) }, [(s(), C("svg", {
3266
- width: a.value,
3267
- height: a.value,
3268
- viewBox: "0 0 24 24",
3269
- fill: o.value,
3270
- xmlns: "http://www.w3.org/2000/svg"
3271
- }, [M("path", { d: n.value.path }, null, 8, ba)], 8, ya))], 4));
3272
- }
3273
- }), Sa = { class: "tpl:w-full" }, Ca = ["href"], wa = {
3274
- key: 1,
3275
- class: "tpl:flex tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border tpl:border-dashed tpl:py-4 tpl:text-sm tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text-dim)]"
3276
- }, Ta = /* @__PURE__ */ d({
3277
- __name: "SocialIconsBlock",
3278
- props: {
3279
- block: {},
3280
- viewport: {}
3281
- },
3282
- setup(e) {
3283
- let t = e, { t: n } = X(), i = S(() => ({
3284
- display: "flex",
3285
- flexWrap: "wrap",
3286
- gap: `${t.block.spacing}px`,
3287
- justifyContent: t.block.align === "left" ? "flex-start" : t.block.align === "right" ? "flex-end" : "center"
3288
- })), a = S(() => t.block.icons.length > 0);
3289
- return (t, o) => (s(), C("div", Sa, [a.value ? (s(), C("div", {
3290
- key: 0,
3291
- style: k(i.value)
3292
- }, [(s(!0), C(L, null, r(e.block.icons, (t) => (s(), C("a", {
3293
- key: t.id,
3294
- href: t.url || "#",
3295
- class: "tpl:cursor-default",
3296
- onClick: o[0] ||= O(() => {}, ["prevent"])
3297
- }, [v(xa, {
3298
- platform: t.platform,
3299
- "icon-style": e.block.iconStyle,
3300
- "icon-size": e.block.iconSize
3301
- }, null, 8, [
3302
- "platform",
3303
- "icon-style",
3304
- "icon-size"
3305
- ])], 8, Ca))), 128))], 4)) : (s(), C("div", wa, [v(_(Lt), { size: 16 }), M("span", null, R(_(n).social.addIcons), 1)]))]));
3306
- }
3307
- }), Ea = { class: "tpl:w-full" }, Da = {
3308
- key: 0,
3309
- class: "tpl:absolute tpl:rounded tpl:px-2 tpl:py-0.5 tpl:text-[10px] tpl:font-medium",
3310
- style: {
3311
- "background-color": "var(--tpl-bg-hover)",
3312
- color: "var(--tpl-text-dim)"
3313
- }
3314
- }, Oa = /* @__PURE__ */ d({
3315
- __name: "SpacerBlock",
3316
- props: {
3317
- block: {},
3318
- viewport: {}
3319
- },
3320
- setup(e) {
3321
- let t = e, n = lt(Y, "SpacerBlock"), r = S(() => ({
3322
- height: `${t.block.height}px`,
3323
- minHeight: `${t.block.height}px`,
3324
- ...n.state.previewMode ? {} : { borderColor: "var(--tpl-border)" }
3325
- }));
3326
- return (t, i) => (s(), C("div", Ea, [M("div", {
3327
- style: k(r.value),
3328
- class: b(["tpl:relative tpl:flex tpl:items-center tpl:justify-center", { "tpl:border-y tpl:border-dashed": !_(n).state.previewMode }])
3329
- }, [_(n).state.previewMode ? w("", !0) : (s(), C("span", Da, R(e.block.height) + "px ", 1))], 6)]));
3330
- }
3331
- }), ka = { class: "tpl:w-full" }, Aa = { key: 0 }, ja = [
3332
- "aria-label",
3333
- "data-placeholder",
3334
- "onBlur"
3335
- ], Ma = [
3336
- "aria-label",
3337
- "data-placeholder",
3338
- "onBlur"
3339
- ], Na = {
3340
- key: 1,
3341
- class: "tpl:flex tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border tpl:border-dashed tpl:py-4 tpl:text-sm tpl:border-[var(--tpl-border)] tpl:text-[var(--tpl-text-dim)]"
3342
- }, Pa = /*#__PURE__*/ nn(/* @__PURE__ */ d({
3343
- __name: "TableBlock",
3344
- props: {
3345
- block: {},
3346
- viewport: {}
3347
- },
3348
- setup(e) {
3349
- let t = {
3350
- mounted(e, t) {
3351
- e.textContent = t.value ?? "";
3352
- },
3353
- updated(e, t) {
3354
- t.value !== t.oldValue && e.getRootNode().activeElement !== e && (e.textContent = t.value ?? "");
3355
- }
3356
- }, n = e, { t: i } = X(), a = lt(Y, "TableBlock"), o = S(() => n.block.rows.length > 0), c = S(() => {
3357
- let e = {
3358
- width: "100%",
3359
- borderCollapse: "collapse",
3360
- fontSize: `${n.block.fontSize}px`,
3361
- textAlign: n.block.textAlign,
3362
- fontFamily: n.block.fontFamily || "inherit"
3363
- };
3364
- return n.block.color && (e.color = n.block.color), e;
3365
- }), l = S(() => ({
3366
- border: `${n.block.borderWidth}px solid ${n.block.borderColor}`,
3367
- padding: `${n.block.cellPadding}px`,
3368
- textAlign: n.block.textAlign
3369
- })), u = S(() => ({
3370
- ...l.value,
3371
- fontWeight: "bold",
3372
- backgroundColor: n.block.headerBackgroundColor || "transparent"
3373
- })), d = S(() => n.block.hasHeaderRow && n.block.rows.length > 0 ? n.block.rows[0] : null), p = S(() => n.block.hasHeaderRow ? n.block.rows.slice(1) : n.block.rows);
3374
- function m() {
3375
- a.selectBlock(n.block.id);
3376
- }
3377
- function h(e, t, r) {
3378
- let i = r.target.innerText.trim(), o = n.block.rows.map((n) => n.id === e ? {
3379
- ...n,
3380
- cells: n.cells.map((e) => e.id === t ? {
3381
- ...e,
3382
- content: i
3383
- } : e)
3384
- } : n);
3385
- a.updateBlock(n.block.id, { rows: o });
3386
- }
3387
- return (e, n) => (s(), C("div", ka, [o.value ? (s(), C("table", {
3388
- key: 0,
3389
- style: k(c.value),
3390
- class: "tpl-table-editable"
3391
- }, [d.value ? (s(), C("thead", Aa, [M("tr", null, [(s(!0), C(L, null, r(d.value.cells, (e) => f((s(), C("th", {
3392
- key: e.id,
3393
- style: k(u.value),
3394
- "aria-label": _(i).table.cellPlaceholder,
3395
- contenteditable: "true",
3396
- "data-placeholder": _(i).table.cellPlaceholder,
3397
- onBlur: (t) => h(d.value.id, e.id, t),
3398
- onKeydown: n[0] ||= y(O((e) => e.target.blur(), ["prevent"]), ["enter"]),
3399
- onClick: O(m, ["stop"])
3400
- }, null, 44, ja)), [[t, e.content]])), 128))])])) : w("", !0), M("tbody", null, [(s(!0), C(L, null, r(p.value, (e) => (s(), C("tr", { key: e.id }, [(s(!0), C(L, null, r(e.cells, (r) => f((s(), C("td", {
3401
- key: r.id,
3402
- style: k(l.value),
3403
- "aria-label": _(i).table.cellPlaceholder,
3404
- contenteditable: "true",
3405
- "data-placeholder": _(i).table.cellPlaceholder,
3406
- onBlur: (t) => h(e.id, r.id, t),
3407
- onKeydown: n[1] ||= y(O((e) => e.target.blur(), ["prevent"]), ["enter"]),
3408
- onClick: O(m, ["stop"])
3409
- }, null, 44, Ma)), [[t, r.content]])), 128))]))), 128))])], 4)) : (s(), C("div", Na, [v(_(Qt), { size: 16 }), M("span", null, R(_(i).table.empty), 1)]))]));
3410
- }
3411
- }), [["__scopeId", "data-v-963ac422"]]), Fa = /* @__PURE__ */ d({
3412
- __name: "VideoPlayButton",
3413
- props: { hoverEffect: {
3414
- type: Boolean,
3415
- default: !1
3416
- } },
3417
- setup(e) {
3418
- return (t, n) => (s(), C("div", { class: b(["tpl:absolute tpl:inset-0 tpl:flex tpl:items-center tpl:justify-center tpl:bg-black/30", e.hoverEffect && "tpl:transition-opacity tpl:group-hover:bg-black/40"]) }, [...n[0] ||= [M("div", { class: "tpl:flex tpl:size-16 tpl:items-center tpl:justify-center tpl:rounded-full tpl:bg-[color-mix(in_srgb,var(--tpl-bg)_90%,transparent)] tpl:shadow-[var(--tpl-shadow-lg)]" }, [M("svg", {
3419
- class: "tpl:ml-1 tpl:text-[var(--tpl-danger)]",
3420
- width: "28",
3421
- height: "28",
3422
- viewBox: "0 0 24 24",
3423
- fill: "currentColor"
3424
- }, [M("polygon", { points: "5,3 19,12 5,21" })])], -1)]], 2));
3425
- }
3426
- });
3427
- //#endregion
3428
- //#region src/utils/videoThumbnail.ts
3429
- function Ia(e) {
3430
- if (!e) return {
3431
- platform: "unknown",
3432
- videoId: null,
3433
- thumbnailUrl: null
3434
- };
3435
- for (let t of [/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/i, /youtube\.com\/shorts\/([a-zA-Z0-9_-]{11})/i]) {
3436
- let n = e.match(t);
3437
- if (n) {
3438
- let e = n[1];
3439
- return {
3440
- platform: "youtube",
3441
- videoId: e,
3442
- thumbnailUrl: `https://img.youtube.com/vi/${e}/maxresdefault.jpg`
3443
- };
3444
- }
3445
- }
3446
- let t = e.match(/vimeo\.com\/(?:video\/)?(\d+)/i);
3447
- if (t) {
3448
- let e = t[1];
3449
- return {
3450
- platform: "vimeo",
3451
- videoId: e,
3452
- thumbnailUrl: `https://vumbnail.com/${e}.jpg`
3453
- };
3454
- }
3455
- return {
3456
- platform: "unknown",
3457
- videoId: null,
3458
- thumbnailUrl: null
3459
- };
3460
- }
3461
- function La(e, t) {
3462
- return t || Ia(e).thumbnailUrl;
3463
- }
3464
- //#endregion
3465
- //#region src/components/blocks/VideoBlock.vue?vue&type=script&setup=true&lang.ts
3466
- var Ra = ["src", "alt"], za = {
3467
- class: "tpl:max-w-full tpl:truncate tpl:px-3 tpl:text-xs tpl:font-medium tpl:text-[var(--tpl-primary)]",
3468
- style: { opacity: "0.7" }
3469
- }, Ba = ["href"], Va = ["src", "alt"], Ha = ["src", "alt"], Ua = {
3470
- key: 3,
3471
- class: "tpl:flex tpl:min-h-[150px] tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border-2 tpl:border-dashed tpl:text-sm tpl:border-[var(--tpl-border-light)] tpl:bg-[var(--tpl-bg-hover)] tpl:text-[var(--tpl-text-dim)]"
3472
- }, Wa = /* @__PURE__ */ d({
3473
- __name: "VideoBlock",
3474
- props: {
3475
- block: {},
3476
- viewport: {}
3477
- },
3478
- setup(e) {
3479
- let t = e, { t: n } = X(), { syntax: r } = an(), i = S(() => W(t.block.url, r) || W(t.block.thumbnailUrl, r)), a = Ln(() => i.value ? void 0 : t.block.thumbnailUrl || void 0), o = Ln(() => i.value ? t.block.placeholderUrl : void 0), c = S(() => i.value ? null : t.block.thumbnailUrl ? a.value ?? null : La(t.block.url)), l = S(() => ({ textAlign: t.block.align })), u = S(() => {
3480
- let e = t.block.align;
3481
- return {
3482
- maxWidth: "100%",
3483
- width: t.block.width === "full" ? "100%" : `${t.block.width}px`,
3484
- height: t.block.height ? `${t.block.height}px` : void 0,
3485
- display: "block",
3486
- marginLeft: e === "center" || e === "right" ? "auto" : void 0,
3487
- marginRight: e === "center" ? "auto" : void 0
3488
- };
3489
- }), d = S(() => ({ height: t.block.height ? `${t.block.height}px` : void 0 })), f = S(() => W(t.block.url, r) ? t.block.url : t.block.thumbnailUrl);
3490
- return (t, r) => (s(), C("div", {
3491
- class: "tpl:w-full",
3492
- style: k(l.value)
3493
- }, [i.value && e.block.placeholderUrl ? (s(), C("div", {
3494
- key: 0,
3495
- class: "tpl:relative tpl:inline-block",
3496
- style: k(u.value)
3497
- }, [M("img", {
3498
- class: "tpl:w-full tpl:border-0",
3499
- src: _(o),
3500
- alt: e.block.alt,
3501
- style: k(d.value)
3502
- }, null, 12, Ra), v(Fa)], 4)) : i.value ? (s(), C("div", {
3503
- key: 1,
3504
- class: "tpl:relative tpl:!flex tpl:min-h-[150px] tpl:flex-col tpl:items-center tpl:justify-center tpl:gap-2 tpl:rounded tpl:border-2 tpl:border-dashed tpl:text-center tpl:bg-[var(--tpl-bg-elevated)]",
3505
- style: k([{ "border-color": "color-mix(in srgb, var(--tpl-primary) 40%, transparent)" }, u.value])
3506
- }, [v(_(Jt), {
3507
- size: 36,
3508
- "stroke-width": 1.5,
3509
- class: "tpl:text-[var(--tpl-primary)]",
3510
- style: { opacity: "0.5" }
3511
- }), M("span", za, [v(Mr, { text: f.value }, null, 8, ["text"])])], 4)) : c.value ? (s(), C(L, { key: 2 }, [e.block.url ? (s(), C("a", {
3512
- key: 0,
3513
- href: e.block.url,
3514
- target: "_blank",
3515
- rel: "noopener noreferrer",
3516
- class: "tpl:group tpl:relative tpl:inline-block",
3517
- style: k(u.value),
3518
- onClick: r[0] ||= O(() => {}, ["prevent"])
3519
- }, [M("img", {
3520
- class: "tpl:w-full tpl:border-0",
3521
- src: c.value,
3522
- alt: e.block.alt,
3523
- style: k(d.value)
3524
- }, null, 12, Va), v(Fa, { "hover-effect": "" })], 12, Ba)) : (s(), C("div", {
3525
- key: 1,
3526
- class: "tpl:relative tpl:inline-block",
3527
- style: k(u.value)
3528
- }, [M("img", {
3529
- class: "tpl:w-full tpl:border-0",
3530
- src: c.value,
3531
- alt: e.block.alt,
3532
- style: k(d.value)
3533
- }, null, 12, Ha), v(Fa)], 4))], 64)) : (s(), C("div", Ua, [v(_(Jt), {
3534
- size: 40,
3535
- "stroke-width": 1.5,
3536
- class: "tpl:text-[var(--tpl-border-light)]"
3537
- }), M("span", null, R(_(n).video.addVideo), 1)]))], 4));
3538
- }
3539
- }), Ga = {
3540
- section: ha,
3541
- title: da,
3542
- paragraph: Ki,
3543
- image: Ni,
3544
- button: Pr,
3545
- divider: fi,
3546
- video: Wa,
3547
- social: Ta,
3548
- menu: Li,
3549
- table: Pa,
3550
- spacer: Oa,
3551
- html: vi,
3552
- countdown: B(() => import("./CountdownBlock-B4AfqJwb.js"))
3553
- };
3554
- function Ka(e) {
3555
- let { editor: n, config: r, translations: i, fontsManager: a } = e, { t: s, format: u } = X(i), d = S(() => ae(ae(ae(sr(i), Er(n.content.value.settings?.locale)), de(n.content.value.settings) === "rtl" ? {
3556
- title: { textAlign: "right" },
3557
- table: { textAlign: "right" }
3558
- } : {}), r.blockDefaults ?? {}));
3559
- n.setUiTheme(r.uiTheme ?? "auto");
3560
- let { resolvedTheme: f } = Gn(S(() => n.state.uiTheme)), p = l(r.theme ?? {}), { themeStyles: m } = qn({
3561
- themeOverrides: p,
3562
- resolvedTheme: f,
3563
- extraStyles: () => ({
3564
- "--tpl-drop-text": `"${i.canvas.dropHere}"`,
3565
- ...e.themeExtraStyles?.()
3566
- })
3567
- }), g = mn({
3568
- content: n.content,
3569
- setContent: (e, t) => n.setContent(e, t),
3570
- ...e.historyOptions
3571
- });
3572
- xn(n, g);
3573
- let _ = gn({
3574
- addBlock: n.addBlock,
3575
- removeBlock: n.removeBlock,
3576
- updateBlock: n.updateBlock,
3577
- selectBlock: n.selectBlock,
3578
- findBlockLocation: n.findBlockLocation,
3579
- blockDefaults: () => d.value
3580
- }), v = yn(n), y = e.autoSaveOptions !== null && e.autoSaveOptions !== void 0 ? vn({
3581
- content: n.content,
3582
- isDirty: () => n.state.isDirty,
3583
- ...e.autoSaveOptions
3584
- }) : null, b = null;
3585
- y && (b = t(g.isNavigating, (e) => {
3586
- e ? y.pause() : y.resume();
3587
- }));
3588
- let x = Wn(n, {
3589
- t: s,
3590
- format: u
3591
- }, r.customBlocks ?? []), C = Pt(r.colors);
3592
- if (C.allowCustomIgnored && Z.warn("config.colors.allowCustom: false is ignored without presets — keeping the color wheel and hex input so a color can still be chosen."), C.invalidPresets.length > 0 && Z.warn(`config.colors.presets skipped invalid entries: ${C.invalidPresets.join(", ")} — presets must be hex colors (#rgb or #rrggbb).`), C.allowCustom === !1) {
3593
- let e = or(C.presets, r.blockDefaults, r.templateDefaults);
3594
- e.length > 0 && Z.warn(`config.colors locks custom colours, but these block/template default colours fall outside colors.presets: ${e.join(", ")}. New blocks start on a colour the palette can't reselect — set blockDefaults / templateDefaults from the same palette.`);
3595
- }
3596
- let w = ir(r.templateSettings);
3597
- for (let e of w.unknown) Z.warn(`config.templateSettings.fields: "${e}" is not a template setting (expected one of ${nr.join(", ")}) — skipping it.`);
3598
- let T = Jn();
3599
- $n(T, Ga);
3600
- let E = /* @__PURE__ */ new Set();
3601
- function D(e) {
3602
- for (let t of e) {
3603
- T.registerCustom(t, ui);
3604
- for (let e of Or(t, C)) E.has(e.id) || (E.add(e.id), Z.warn(e.message));
3605
- }
3606
- }
3607
- r.customBlocks?.length && D(r.customBlocks);
3608
- let O = Nn();
3609
- if (o() && h(O.dispose), e.containerEl) {
3610
- let t = e.containerEl;
3611
- K(document, "pointerdown", (e) => {
3612
- let n = t.value;
3613
- n && (e.composedPath?.() ?? []).includes(n) && O.claim();
3614
- }, { capture: !0 });
3615
- }
3616
- function k() {
3617
- let t = e.capabilities?.templates;
3618
- if (t) {
3619
- t.save();
3620
- return;
3621
- }
3622
- y?.flush();
3623
- }
3624
- function A(t) {
3625
- O.isActive() && Ar(t, {
3626
- history: g,
3627
- selectBlock: (e) => n.selectBlock(e),
3628
- getSelectedBlockId: () => n.state.selectedBlockId,
3629
- removeBlock: (e) => n.removeBlock(e),
3630
- onSave: k,
3631
- onBeforeUndo: e.keyboardOptions?.onBeforeUndo,
3632
- isPicking: () => e.capabilities?.savedBlocks?.isPicking.value === !0,
3633
- onConfirmPick: () => e.capabilities?.savedBlocks?.confirmPicking(),
3634
- onCancelPick: () => e.capabilities?.savedBlocks?.cancelPicking()
3635
- });
3636
- }
3637
- K(document, "keydown", A);
3638
- let j = l(null);
3639
- c(ut, e.editorRoot ?? document), c($e, j), c(Ye, i), c(Y, n), c(At, g), c(dt, _), c(ht, v), c(Dt, a), c(ct, m), c(wt, f), c(St, d), c(Qe, r.locale), c(Et, T), c(Ct, r.customBlocks ?? []), c(Ze, r.paletteBlocks), c(ft, er(r.htmlBlockPreview)), c(mt, C), c(st, w.fields), c(bt, Yn(n.content, T));
3640
- let M = Se(r.mergeTags?.syntax);
3641
- c(q, r.mergeTags?.tags ?? []), c(et, M), c(Je, r.mergeTags?.onRequest ?? null), c(nt, r.mergeTags?.autocomplete !== !1);
3642
- let N = l(Fe(r.mergeTags?.tags ?? []));
3643
- c(_t, N);
3644
- let P = Fn({
3645
- resolvePreview: r.resolvePreview,
3646
- getContent: () => n.content.value,
3647
- isActive: () => n.state.previewMode
3648
- });
3649
- c(it, P), c(jt, r.resolvePreview);
3650
- let F = S(() => !(n.state.previewMode && P.isConfigured));
3651
- c(Tt, F);
3652
- let I = Rn();
3653
- c(vt, I), c(Ge, l(!1)), c(qe, l(!1)), c(Ot, r.logicTags?.tags ?? []), c(Ke, r.logicTags?.pairs ?? []), c(tt, r.logicTags?.onRequest ?? null), c(ot, zn()), c(rt, r.onRequestMedia ?? null), c(pt, r.canDropMedia ?? null), c(kt, r.resolveImageUrl ? In(r.resolveImageUrl) : null), c(gt, r.displayConditions?.conditions ?? []), c(xt, r.displayConditions?.allowCustom ?? !1), c(yt, e.capabilities ?? {}), c(at, x);
3654
- let L = Bn(r.lint) ? null : Vn({
3655
- content: n.content,
3656
- options: r.lint ?? {},
3657
- updateBlock: n.updateBlock,
3658
- updateSettings: n.updateSettings,
3659
- removeBlock: n.removeBlock
3660
- });
3661
- c(Xe, L);
3662
- function R() {
3663
- b?.(), L?.destroy(), y?.destroy(), g.destroy();
3664
- }
3665
- return {
3666
- t: s,
3667
- format: u,
3668
- history: g,
3669
- blockActions: _,
3670
- conditionPreview: v,
3671
- autoSave: y,
3672
- resolvedTheme: f,
3673
- themeStyles: m,
3674
- themeOverrides: p,
3675
- registry: T,
3676
- keyboardReorder: x,
3677
- templateLint: L,
3678
- popoverRoot: j,
3679
- mergeTagSampleMode: N,
3680
- previewResolution: P,
3681
- appliesConditionFilter: F,
3682
- registerCustomBlocks: D,
3683
- destroy: R
3684
- };
3685
- }
3686
- //#endregion
3687
- export { hr as A, Hn as B, Kr as C, Lr as D, zr as E, yr as F, Dn as G, An as H, vr as I, bn as J, wn as K, nr as L, Sr as M, xr as N, Pr as O, br as P, tr as R, Zr as S, Br as T, kn as U, Fn as V, On as W, un as X, _n as Y, vi as _, Ta as a, ti as b, da as c, qi as d, Ji as f, bi as g, Ni as h, Oa as i, Cr as j, Dr as k, la as l, Li as m, Wa as n, va as o, Ki as p, Sn as q, Pa as r, ha as s, Ka as t, Yi as u, fi as v, Gr as w, $r as x, ui as y, Un as z };
3688
-
3689
- //# sourceMappingURL=useEditorCore-Cs7rYVBo.js.map