@templatical/editor 0.57.2 → 0.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/dist/{AiAltTextPopover-B4cg0jQG.js → AiAltTextPopover-CwyKz_9U.js} +3 -3
  2. package/dist/{AiAltTextReview-Dni8I9eV.js → AiAltTextReview-DNFnR1PN.js} +2 -2
  3. package/dist/{AiChatPanel-QWqGhy2s.js → AiChatPanel-DWWVvJIP.js} +3 -3
  4. package/dist/{AiPanels-DE2ysIV1.js → AiPanels-CESbBB63.js} +1 -1
  5. package/dist/{AiRewriteMenu-B25gpnip.js → AiRewriteMenu-CjXiI-n4.js} +5 -5
  6. package/dist/{BlockIssueBadge-Ri7dQhuz.js → BlockIssueBadge-3k568_Od.js} +2 -2
  7. package/dist/{BlockPreviewCanvas-yr5MmQql.js → BlockPreviewCanvas-3FzYSsPm.js} +6 -6
  8. package/dist/{CloudHeaderExtras-CJsXi4Ku.js → CloudHeaderExtras-xrHubAHL.js} +1 -1
  9. package/dist/{CloudPanels-ZOR9By8W.js → CloudPanels-CSFN-eLV.js} +3 -3
  10. package/dist/{CollaborationNotices-COS_YvTq.js → CollaborationNotices-D9GQ477K.js} +1 -1
  11. package/dist/{CollaboratorBar-jq6HH0fb.js → CollaboratorBar-DsRjAaqd.js} +1 -1
  12. package/dist/{CommentsPanel-B0_Ob2vO.js → CommentsPanel-lb-IFzjl.js} +1 -1
  13. package/dist/{CommentsSidebar-DFoLon5D.js → CommentsSidebar-CVVTCWBH.js} +3 -3
  14. package/dist/{CountdownBlock-BrR2uqM3.js → CountdownBlock-CSEq79Nc.js} +2 -2
  15. package/dist/{CountdownToolbar-BtP0n0yZ.js → CountdownToolbar-BV9yQi9k.js} +5 -5
  16. package/dist/{IssuesPanel-CarJYQFu.js → IssuesPanel-pxcWAQJM.js} +5 -5
  17. package/dist/{LanguageMenu-confz89v.js → LanguageMenu-CEKRbNhA.js} +5 -5
  18. package/dist/{LocaleNotices-D8aE167E.js → LocaleNotices-j4aMFfmc.js} +2 -2
  19. package/dist/{LogicTagInsertButton-DFL3kvGK.js → LogicTagInsertButton-BDIsyl3C.js} +96 -96
  20. package/dist/{MergeTagInput-BuGJeeyA.js → MergeTagInput-De1yWoc2.js} +2 -2
  21. package/dist/{MergeTagModeToggle-D7482NZf.js → MergeTagModeToggle-CL96pI1E.js} +2 -2
  22. package/dist/{MergeTagTextarea-Qt9_NeY4.js → MergeTagTextarea-DDyV8U44.js} +4 -4
  23. package/dist/{ParagraphEditor-Cd-CBE_l.js → ParagraphEditor-Vz90-hhN.js} +9 -9
  24. package/dist/{RestoreVersionDialog-Clh4l0Bn.js → RestoreVersionDialog-BgrtpVl1.js} +3 -3
  25. package/dist/{RichTextEditorContent-Dw_Z9zhi.js → RichTextEditorContent-C2Yj1-ZA.js} +5 -5
  26. package/dist/{SaveBlockDialog-kboYvk_a.js → SaveBlockDialog-DRvLFKWJ.js} +11 -11
  27. package/dist/{SavedBlocksBrowserModal-wVGMC6My.js → SavedBlocksBrowserModal-Dw0uF-NT.js} +7 -7
  28. package/dist/{SavedBlocksPanels-C9AHYfYR.js → SavedBlocksPanels-BReNi8sg.js} +1 -1
  29. package/dist/{SavedBlocksPickBar-CVbV5MVL.js → SavedBlocksPickBar-BQX4g7OE.js} +3 -3
  30. package/dist/{TemplateSettings-ChCm5_2b.js → TemplateSettings-CBCaybvd.js} +5 -5
  31. package/dist/TestEmailModal-BiCUiRFo.js +240 -0
  32. package/dist/{TestEmailPanel-7Ua54CYL.js → TestEmailPanel-Bfr-sGrI.js} +1 -1
  33. package/dist/{TitleEditor-DXMOgW-9.js → TitleEditor-B8thQPgg.js} +7 -7
  34. package/dist/{Toolbar-CVHJl6i4.js → Toolbar-FIYSw3Us.js} +438 -438
  35. package/dist/{TplModal-BErE8I3p.js → TplModal-BIqO0owX.js} +3 -3
  36. package/dist/{VersionHistoryMenu-P3P00KqQ.js → VersionHistoryMenu-6jMve6By.js} +2 -2
  37. package/dist/{VersionHistoryPanels-DES1b1Pq.js → VersionHistoryPanels-C91mfsMA.js} +1 -1
  38. package/dist/{VersionPreviewBanner-D2TtR9I5.js → VersionPreviewBanner-Bq8z1SUc.js} +2 -2
  39. package/dist/{WrapperBlock-B1zI7POT.js → WrapperBlock-BAqgP8hm.js} +3 -3
  40. package/dist/{blockTypeIcons-Dp540i74.js → blockTypeIcons-VX_8UQ21.js} +1 -1
  41. package/dist/bundle-stats.json +8 -8
  42. package/dist/{ca-BJn8lcJx.js → ca-YfIxwO1G.js} +1 -0
  43. package/dist/cdn/chunks/{AiAltTextPopover-sx3bmRiV.js → AiAltTextPopover-Dj-VLU88.js} +4 -4
  44. package/dist/cdn/chunks/{AiAltTextPopover-sx3bmRiV.js.map → AiAltTextPopover-Dj-VLU88.js.map} +1 -1
  45. package/dist/cdn/chunks/{AiAltTextReview-Cj3PKInZ.js → AiAltTextReview-tVkJPOk6.js} +3 -3
  46. package/dist/cdn/chunks/{AiAltTextReview-Cj3PKInZ.js.map → AiAltTextReview-tVkJPOk6.js.map} +1 -1
  47. package/dist/cdn/chunks/{AiChatPanel-DibkqrqY.js → AiChatPanel-CYPvHQGQ.js} +4 -4
  48. package/dist/cdn/chunks/{AiChatPanel-DibkqrqY.js.map → AiChatPanel-CYPvHQGQ.js.map} +1 -1
  49. package/dist/cdn/chunks/{AiPanels-DVs4r8sY.js → AiPanels-ChTLCmMS.js} +2 -2
  50. package/dist/cdn/chunks/{AiPanels-DVs4r8sY.js.map → AiPanels-ChTLCmMS.js.map} +1 -1
  51. package/dist/cdn/chunks/{AiRewriteMenu-BbZ9NRoe.js → AiRewriteMenu-99qbfCZI.js} +6 -6
  52. package/dist/cdn/chunks/{AiRewriteMenu-BbZ9NRoe.js.map → AiRewriteMenu-99qbfCZI.js.map} +1 -1
  53. package/dist/cdn/chunks/{BlockIssueBadge-BWIth1y6.js → BlockIssueBadge-BKO4Mr8f.js} +3 -3
  54. package/dist/cdn/chunks/{BlockIssueBadge-BWIth1y6.js.map → BlockIssueBadge-BKO4Mr8f.js.map} +1 -1
  55. package/dist/cdn/chunks/{BlockPreviewCanvas-BDZ6pMHq.js → BlockPreviewCanvas-BF0yCTKP.js} +7 -7
  56. package/dist/cdn/chunks/{BlockPreviewCanvas-BDZ6pMHq.js.map → BlockPreviewCanvas-BF0yCTKP.js.map} +1 -1
  57. package/dist/cdn/chunks/{CloudHeaderExtras-CazfMn6A.js → CloudHeaderExtras-O_K3jmgO.js} +2 -2
  58. package/dist/cdn/chunks/{CloudHeaderExtras-CazfMn6A.js.map → CloudHeaderExtras-O_K3jmgO.js.map} +1 -1
  59. package/dist/cdn/chunks/{CloudPanels-BI_hJwcJ.js → CloudPanels-gV2WFHQk.js} +4 -4
  60. package/dist/cdn/chunks/{CloudPanels-BI_hJwcJ.js.map → CloudPanels-gV2WFHQk.js.map} +1 -1
  61. package/dist/cdn/chunks/{CollaborationNotices-yKOt4o7B.js → CollaborationNotices-CwAoa-73.js} +2 -2
  62. package/dist/cdn/chunks/{CollaborationNotices-yKOt4o7B.js.map → CollaborationNotices-CwAoa-73.js.map} +1 -1
  63. package/dist/cdn/chunks/{CollaboratorBar-D5fycyLP.js → CollaboratorBar-DdQQwtwd.js} +2 -2
  64. package/dist/cdn/chunks/{CollaboratorBar-D5fycyLP.js.map → CollaboratorBar-DdQQwtwd.js.map} +1 -1
  65. package/dist/cdn/chunks/{CommentsPanel-BPoa1lBK.js → CommentsPanel-C8AKtxiG.js} +2 -2
  66. package/dist/cdn/chunks/{CommentsPanel-BPoa1lBK.js.map → CommentsPanel-C8AKtxiG.js.map} +1 -1
  67. package/dist/cdn/chunks/{CommentsSidebar-DLn9qWtv.js → CommentsSidebar-FxY0RHSq.js} +4 -4
  68. package/dist/cdn/chunks/{CommentsSidebar-DLn9qWtv.js.map → CommentsSidebar-FxY0RHSq.js.map} +1 -1
  69. package/dist/cdn/chunks/{CountdownBlock-Do6oItNW.js → CountdownBlock-DGgnPUlu.js} +3 -3
  70. package/dist/cdn/chunks/{CountdownBlock-Do6oItNW.js.map → CountdownBlock-DGgnPUlu.js.map} +1 -1
  71. package/dist/cdn/chunks/{CountdownToolbar-D5_QBuhO.js → CountdownToolbar-9PtYUgCW.js} +6 -6
  72. package/dist/cdn/chunks/{CountdownToolbar-D5_QBuhO.js.map → CountdownToolbar-9PtYUgCW.js.map} +1 -1
  73. package/dist/cdn/chunks/{IssuesPanel-BzVpxRkq.js → IssuesPanel-Co-ffgWa.js} +6 -6
  74. package/dist/cdn/chunks/{IssuesPanel-BzVpxRkq.js.map → IssuesPanel-Co-ffgWa.js.map} +1 -1
  75. package/dist/cdn/chunks/{LanguageMenu-GEbUX5Oe.js → LanguageMenu-fL4DRGGQ.js} +6 -6
  76. package/dist/cdn/chunks/{LanguageMenu-GEbUX5Oe.js.map → LanguageMenu-fL4DRGGQ.js.map} +1 -1
  77. package/dist/cdn/chunks/{LocaleNotices-CWRS_G-4.js → LocaleNotices-BVDJ7kyj.js} +3 -3
  78. package/dist/cdn/chunks/{LocaleNotices-CWRS_G-4.js.map → LocaleNotices-BVDJ7kyj.js.map} +1 -1
  79. package/dist/cdn/chunks/{LogicTagInsertButton-CrkAz1t_.js → LogicTagInsertButton-DPYA8LJW.js} +9 -9
  80. package/dist/cdn/chunks/{LogicTagInsertButton-CrkAz1t_.js.map → LogicTagInsertButton-DPYA8LJW.js.map} +1 -1
  81. package/dist/cdn/chunks/{MergeTagInput-DkCATtfE.js → MergeTagInput-Cxfjq3tx.js} +3 -3
  82. package/dist/cdn/chunks/{MergeTagInput-DkCATtfE.js.map → MergeTagInput-Cxfjq3tx.js.map} +1 -1
  83. package/dist/cdn/chunks/{MergeTagModeToggle-DYAFxyoB.js → MergeTagModeToggle-BmNGV3yc.js} +3 -3
  84. package/dist/cdn/chunks/{MergeTagModeToggle-DYAFxyoB.js.map → MergeTagModeToggle-BmNGV3yc.js.map} +1 -1
  85. package/dist/cdn/chunks/{MergeTagTextarea-DRS6pXSE.js → MergeTagTextarea-DmwrPAss.js} +5 -5
  86. package/dist/cdn/chunks/{MergeTagTextarea-DRS6pXSE.js.map → MergeTagTextarea-DmwrPAss.js.map} +1 -1
  87. package/dist/cdn/chunks/{ParagraphEditor-rEdKBett.js → ParagraphEditor-A_OEuQ1Q.js} +10 -10
  88. package/dist/cdn/chunks/{ParagraphEditor-rEdKBett.js.map → ParagraphEditor-A_OEuQ1Q.js.map} +1 -1
  89. package/dist/cdn/chunks/{RestoreVersionDialog-B7eTijWD.js → RestoreVersionDialog-Ca_lUsk4.js} +4 -4
  90. package/dist/cdn/chunks/{RestoreVersionDialog-B7eTijWD.js.map → RestoreVersionDialog-Ca_lUsk4.js.map} +1 -1
  91. package/dist/cdn/chunks/{RichTextEditorContent-EtUIYzHB.js → RichTextEditorContent-Dq4TROOg.js} +6 -6
  92. package/dist/cdn/chunks/{RichTextEditorContent-EtUIYzHB.js.map → RichTextEditorContent-Dq4TROOg.js.map} +1 -1
  93. package/dist/cdn/chunks/{SaveBlockDialog-BquE_Brz.js → SaveBlockDialog-BXRCqrZX.js} +12 -12
  94. package/dist/cdn/chunks/{SaveBlockDialog-BquE_Brz.js.map → SaveBlockDialog-BXRCqrZX.js.map} +1 -1
  95. package/dist/cdn/chunks/{SavedBlocksBrowserModal--fNlId5y.js → SavedBlocksBrowserModal-DdaBcSOI.js} +7 -7
  96. package/dist/cdn/chunks/{SavedBlocksBrowserModal--fNlId5y.js.map → SavedBlocksBrowserModal-DdaBcSOI.js.map} +1 -1
  97. package/dist/cdn/chunks/{SavedBlocksPanels-0Z0dELDm.js → SavedBlocksPanels-BcVFZDKI.js} +2 -2
  98. package/dist/cdn/chunks/{SavedBlocksPanels-0Z0dELDm.js.map → SavedBlocksPanels-BcVFZDKI.js.map} +1 -1
  99. package/dist/cdn/chunks/{SavedBlocksPickBar-yezZxZeP.js → SavedBlocksPickBar-o66PhlTo.js} +4 -4
  100. package/dist/cdn/chunks/{SavedBlocksPickBar-yezZxZeP.js.map → SavedBlocksPickBar-o66PhlTo.js.map} +1 -1
  101. package/dist/cdn/chunks/{TemplateSettings-DFetnT9P.js → TemplateSettings-uoiUkd2l.js} +6 -6
  102. package/dist/cdn/chunks/{TemplateSettings-DFetnT9P.js.map → TemplateSettings-uoiUkd2l.js.map} +1 -1
  103. package/dist/cdn/chunks/TestEmailModal-WOC7bmF_.js +239 -0
  104. package/dist/cdn/chunks/TestEmailModal-WOC7bmF_.js.map +1 -0
  105. package/dist/cdn/chunks/{TestEmailPanel-C2dxmmoW.js → TestEmailPanel-DUWH9xsZ.js} +2 -2
  106. package/dist/cdn/chunks/{TestEmailPanel-C2dxmmoW.js.map → TestEmailPanel-DUWH9xsZ.js.map} +1 -1
  107. package/dist/cdn/chunks/{TitleEditor-Bq62I2SC.js → TitleEditor-EHW0lgG4.js} +7 -7
  108. package/dist/cdn/chunks/{TitleEditor-Bq62I2SC.js.map → TitleEditor-EHW0lgG4.js.map} +1 -1
  109. package/dist/cdn/chunks/{Toolbar-CwmW8wAI.js → Toolbar-BzAuH2G4.js} +19 -19
  110. package/dist/cdn/chunks/{Toolbar-CwmW8wAI.js.map → Toolbar-BzAuH2G4.js.map} +1 -1
  111. package/dist/cdn/chunks/{TplModal-DE6BniBg.js → TplModal-B9DVglkN.js} +4 -4
  112. package/dist/cdn/chunks/{TplModal-DE6BniBg.js.map → TplModal-B9DVglkN.js.map} +1 -1
  113. package/dist/cdn/chunks/{VersionHistoryMenu-BBYU71Ua.js → VersionHistoryMenu-DDqYMqC2.js} +3 -3
  114. package/dist/cdn/chunks/{VersionHistoryMenu-BBYU71Ua.js.map → VersionHistoryMenu-DDqYMqC2.js.map} +1 -1
  115. package/dist/cdn/chunks/{VersionHistoryPanels-mMMqnf3O.js → VersionHistoryPanels-DO-kcL28.js} +2 -2
  116. package/dist/cdn/chunks/{VersionHistoryPanels-mMMqnf3O.js.map → VersionHistoryPanels-DO-kcL28.js.map} +1 -1
  117. package/dist/cdn/chunks/{VersionPreviewBanner-tBz-3lGg.js → VersionPreviewBanner-CYT5QUoc.js} +3 -3
  118. package/dist/cdn/chunks/{VersionPreviewBanner-tBz-3lGg.js.map → VersionPreviewBanner-CYT5QUoc.js.map} +1 -1
  119. package/dist/cdn/chunks/{WrapperBlock-B9XxtFql.js → WrapperBlock-CyD_pW18.js} +4 -4
  120. package/dist/cdn/chunks/{WrapperBlock-B9XxtFql.js.map → WrapperBlock-CyD_pW18.js.map} +1 -1
  121. package/dist/cdn/chunks/{ca-BJn8lcJx.js → ca-YfIxwO1G.js} +2 -1
  122. package/dist/cdn/chunks/{ca-BJn8lcJx.js.map → ca-YfIxwO1G.js.map} +1 -1
  123. package/dist/cdn/chunks/{composables-CkthyXi9.js → composables-CN9j_FH4.js} +466 -451
  124. package/dist/cdn/chunks/composables-CN9j_FH4.js.map +1 -0
  125. package/dist/cdn/chunks/{createCloudRuntime-k12jYbXP.js → createCloudRuntime-D8zeR9D2.js} +2 -2
  126. package/dist/cdn/chunks/{createCloudRuntime-k12jYbXP.js.map → createCloudRuntime-D8zeR9D2.js.map} +1 -1
  127. package/dist/cdn/chunks/{da-qQzj0QGy.js → da-CM6DCvRG.js} +2 -1
  128. package/dist/cdn/chunks/{da-qQzj0QGy.js.map → da-CM6DCvRG.js.map} +1 -1
  129. package/dist/cdn/chunks/{de-BLFp3nWx.js → de-Dugz1zXC.js} +2 -1
  130. package/dist/cdn/chunks/{de-BLFp3nWx.js.map → de-Dugz1zXC.js.map} +1 -1
  131. package/dist/cdn/chunks/{en-DGGQJGbm.js → en-BykoFuFY.js} +2 -1
  132. package/dist/cdn/chunks/{en-DGGQJGbm.js.map → en-BykoFuFY.js.map} +1 -1
  133. package/dist/cdn/chunks/{es-DTY9qgLv.js → es-DaWsTkpj.js} +2 -1
  134. package/dist/cdn/chunks/{es-DTY9qgLv.js.map → es-DaWsTkpj.js.map} +1 -1
  135. package/dist/cdn/chunks/{extensions-Djyg5slk.js → extensions-BYJPv1sA.js} +4 -4
  136. package/dist/cdn/chunks/{extensions-Djyg5slk.js.map → extensions-BYJPv1sA.js.map} +1 -1
  137. package/dist/cdn/chunks/{fr-L4FqO9Gp.js → fr-DqwQHtJo.js} +2 -1
  138. package/dist/cdn/chunks/{fr-L4FqO9Gp.js.map → fr-DqwQHtJo.js.map} +1 -1
  139. package/dist/cdn/chunks/{ja-6uOXkh4v.js → ja-BH4MS1Ye.js} +2 -1
  140. package/dist/cdn/chunks/{ja-6uOXkh4v.js.map → ja-BH4MS1Ye.js.map} +1 -1
  141. package/dist/cdn/chunks/{keys-BQqbBUag.js → keys-DNv3xXxI.js} +4 -4
  142. package/dist/cdn/chunks/keys-DNv3xXxI.js.map +1 -0
  143. package/dist/cdn/chunks/{nl-DCxuxwNq.js → nl-BQl1_UHv.js} +2 -1
  144. package/dist/cdn/chunks/{nl-DCxuxwNq.js.map → nl-BQl1_UHv.js.map} +1 -1
  145. package/dist/{pt-BR-CBkcrebr.js → cdn/chunks/pt-BR-eyzmU9Vs.js} +3 -0
  146. package/dist/cdn/chunks/{pt-BR-CBkcrebr.js.map → pt-BR-eyzmU9Vs.js.map} +1 -1
  147. package/dist/cdn/chunks/{socialIcons-CkgQUpim.js → socialIcons-bvQ57o1m.js} +484 -467
  148. package/dist/cdn/chunks/socialIcons-bvQ57o1m.js.map +1 -0
  149. package/dist/cdn/chunks/{src-CpUX1Mhb.js → src-BXrhjqCv.js} +11 -18
  150. package/dist/cdn/chunks/src-BXrhjqCv.js.map +1 -0
  151. package/dist/cdn/chunks/src-CVHGPKSW.js.map +1 -1
  152. package/dist/cdn/chunks/{styleConstants-CgiNKdnc.js → styleConstants-Br6CIRoS.js} +6 -6
  153. package/dist/cdn/chunks/styleConstants-Br6CIRoS.js.map +1 -0
  154. package/dist/cdn/chunks/{useCloudI18n-Dr4S2TRW.js → useCloudI18n-CWgySYuJ.js} +2 -2
  155. package/dist/cdn/chunks/{useCloudI18n-Dr4S2TRW.js.map → useCloudI18n-CWgySYuJ.js.map} +1 -1
  156. package/dist/cdn/chunks/{useEditorRoot-B_kf_k-g.js → useEditorRoot-BA4vV7sK.js} +2 -2
  157. package/dist/cdn/chunks/{useEditorRoot-B_kf_k-g.js.map → useEditorRoot-BA4vV7sK.js.map} +1 -1
  158. package/dist/cdn/chunks/{useI18n-CSf-ZpcM.js → useI18n-JsIdvX-i.js} +2 -2
  159. package/dist/cdn/chunks/{useI18n-CSf-ZpcM.js.map → useI18n-JsIdvX-i.js.map} +1 -1
  160. package/dist/cdn/chunks/{useLogicTag-YXRBcfgG.js → useLogicTag-C10Wef7d.js} +2 -2
  161. package/dist/cdn/chunks/{useLogicTag-YXRBcfgG.js.map → useLogicTag-C10Wef7d.js.map} +1 -1
  162. package/dist/cdn/chunks/{useMergeTag-lb-Wrw-B.js → useMergeTag-Dd26TcvH.js} +2 -2
  163. package/dist/cdn/chunks/{useMergeTag-lb-Wrw-B.js.map → useMergeTag-Dd26TcvH.js.map} +1 -1
  164. package/dist/cdn/chunks/{usePopoverPosition-BJFFi8x6.js → usePopoverPosition-DWRQRT2P.js} +2 -2
  165. package/dist/cdn/chunks/{usePopoverPosition-BJFFi8x6.js.map → usePopoverPosition-DWRQRT2P.js.map} +1 -1
  166. package/dist/cdn/chunks/{useScrollToBlock-MI4PP5lk.js → useScrollToBlock-CArjwH-u.js} +2 -2
  167. package/dist/cdn/chunks/{useScrollToBlock-MI4PP5lk.js.map → useScrollToBlock-CArjwH-u.js.map} +1 -1
  168. package/dist/cdn/editor.css +1 -1
  169. package/dist/cdn/editor.js +709 -617
  170. package/dist/cdn/editor.js.map +1 -1
  171. package/dist/{composables-BrzGZQkd.js → composables-DbqKYIRE.js} +631 -616
  172. package/dist/{createCloudRuntime-DgQfMi22.js → createCloudRuntime-DiUnYjKr.js} +1 -1
  173. package/dist/{da-qQzj0QGy.js → da-CM6DCvRG.js} +1 -0
  174. package/dist/{de-BLFp3nWx.js → de-Dugz1zXC.js} +1 -0
  175. package/dist/{en-DGGQJGbm.js → en-BykoFuFY.js} +1 -0
  176. package/dist/{es-DTY9qgLv.js → es-DaWsTkpj.js} +1 -0
  177. package/dist/{extensions-Cyp2x7cD.js → extensions-CAuXwpbI.js} +3 -3
  178. package/dist/{fr-L4FqO9Gp.js → fr-DqwQHtJo.js} +1 -0
  179. package/dist/index.d.ts +64 -5
  180. package/dist/{ja-6uOXkh4v.js → ja-BH4MS1Ye.js} +1 -0
  181. package/dist/{keys-D9oKZN1h.js → keys-BeQy64On.js} +3 -3
  182. package/dist/{nl-DCxuxwNq.js → nl-BQl1_UHv.js} +1 -0
  183. package/dist/{cdn/chunks/pt-BR-CBkcrebr.js → pt-BR-eyzmU9Vs.js} +1 -2
  184. package/dist/{socialIcons-ZfH8PyV2.js → socialIcons-RKdTgJip.js} +376 -359
  185. package/dist/style.css +1 -1
  186. package/dist/{styleConstants-CgiNKdnc.js → styleConstants-Br6CIRoS.js} +5 -5
  187. package/dist/templatical-editor.js +761 -668
  188. package/dist/{useCloudI18n-HhCZYRV6.js → useCloudI18n-nMZ9f_4b.js} +1 -1
  189. package/dist/{useEditorRoot-B0Njczhx.js → useEditorRoot-DpssP9rX.js} +1 -1
  190. package/dist/{useI18n-CM9vKbYc.js → useI18n-C2p-qHeb.js} +1 -1
  191. package/dist/{useLogicTag-BTCtn-uG.js → useLogicTag-59fmujI7.js} +1 -1
  192. package/dist/{useMergeTag-QlXUjCWT.js → useMergeTag-M1vauWet.js} +1 -1
  193. package/dist/{usePopoverPosition-CVRzzLkC.js → usePopoverPosition-L9MOHBM-.js} +1 -1
  194. package/dist/{useScrollToBlock-DruzlN2h.js → useScrollToBlock-BMF0Dt5l.js} +1 -1
  195. package/package.json +8 -8
  196. package/dist/TestEmailModal-CYq9Ec7x.js +0 -212
  197. package/dist/cdn/chunks/TestEmailModal-DJpwpEZs.js +0 -212
  198. package/dist/cdn/chunks/TestEmailModal-DJpwpEZs.js.map +0 -1
  199. package/dist/cdn/chunks/composables-CkthyXi9.js.map +0 -1
  200. package/dist/cdn/chunks/keys-BQqbBUag.js.map +0 -1
  201. package/dist/cdn/chunks/socialIcons-CkgQUpim.js.map +0 -1
  202. package/dist/cdn/chunks/src-CpUX1Mhb.js.map +0 -1
  203. package/dist/cdn/chunks/styleConstants-CgiNKdnc.js.map +0 -1
@@ -1,12 +1,12 @@
1
1
  import { $ as e, B as t, Ft as n, G as r, M as i, Mt as a, Pt as o, Q as s, Y as c, Z as l, _ as u, c as d, ct as f, et as p, f as m, g as h, it as g, k as _, lt as v, nt as y, ot as b, q as x, r as S, w as C, y as w } from "./vue.runtime.esm-bundler-BE5V8ADU.js";
2
- import { A as T, At as E, D, E as O, Et as k, Ft as A, G as j, Lt as ee, N as M, O as N, Ot as te, R as P, Rt as F, S as ne, T as re, Tt as I, Wt as L, Yt as R, _ as z, bt as ie, et as B, f as V, g as ae, h as oe, in as H, j as se, kt as ce, lt as U, qt as le, rt as W, sn as ue, tn as de, ut as fe, v as G, vt as pe, w as K, zt as q } from "./dist-BTjObRcv.js";
3
- import { t as J } from "./createLucideIcon-CssArtUe.js";
4
- import { t as me } from "./upload-BWYXWYHb.js";
5
- import { t as he } from "./loader-circle-BMc3fVpa.js";
6
- import { B as ge, C as _e, W as ve, u as ye } from "./keys-D9oKZN1h.js";
7
- import { t as be } from "./useI18n-CM9vKbYc.js";
8
- import { r as xe } from "./dist-B6ptxfPo.js";
9
- import { i as Se, r as Ce } from "./usePopoverPosition-CVRzzLkC.js";
2
+ import { A as T, At as E, D, E as O, Et as k, Ft as A, G as j, Lt as ee, N as M, O as N, Ot as P, R as F, Rt as I, S as te, T as ne, Tt as L, Wt as R, Yt as z, _ as B, bt as re, et as V, f as H, g as ie, h as ae, in as U, j as oe, kt as se, lt as ce, qt as le, rt as W, sn as ue, tn as de, ut as fe, v as G, vt as pe, w as K, zt as q } from "./dist-BTjObRcv.js";
3
+ import { t as me } from "./createLucideIcon-CssArtUe.js";
4
+ import { t as he } from "./upload-BWYXWYHb.js";
5
+ import { t as ge } from "./loader-circle-BMc3fVpa.js";
6
+ import { B as _e, C as ve, W as ye, u as be } from "./keys-BeQy64On.js";
7
+ import { t as xe } from "./useI18n-C2p-qHeb.js";
8
+ import { r as J } from "./dist-B6ptxfPo.js";
9
+ import { i as Se, r as Ce } from "./usePopoverPosition-L9MOHBM-.js";
10
10
  // ../core/dist/index.js
11
11
  var Y = (e) => typeof e == "object" && !!e && !Array.isArray(e), we = (e) => Array.isArray(e) && e.length > 0 && e.every((e) => Y(e) && typeof e.id == "string"), Te = /* @__PURE__ */ new Set([
12
12
  "id",
@@ -19,7 +19,7 @@ var Y = (e) => typeof e == "object" && !!e && !Array.isArray(e), we = (e) => Arr
19
19
  function Ee(e, t, n) {
20
20
  let r = /* @__PURE__ */ new Set();
21
21
  for (let i of n) {
22
- if (!I(i)) continue;
22
+ if (!L(i)) continue;
23
23
  let n = i.split("."), a = n.pop(), o = n.join("."), s = q(e, i), c = t;
24
24
  for (let [t, i] of n.entries()) {
25
25
  let a = n.slice(0, t + 1).join(".");
@@ -28,8 +28,8 @@ function Ee(e, t, n) {
28
28
  if (Array.isArray(c)) {
29
29
  let e = c.findIndex((e) => Y(e) && e.id === a);
30
30
  if (e < 0) continue;
31
- s === void 0 ? c.splice(e, 1) : c[e] = R(s);
32
- } else Y(c) && (s === void 0 ? delete c[a] : c[a] = R(s), o && Object.keys(c).length === 0 && q(e, o) === void 0 && Ee(e, t, [o]));
31
+ s === void 0 ? c.splice(e, 1) : c[e] = z(s);
32
+ } else Y(c) && (s === void 0 ? delete c[a] : c[a] = z(s), o && Object.keys(c).length === 0 && q(e, o) === void 0 && Ee(e, t, [o]));
33
33
  }
34
34
  return r;
35
35
  }
@@ -40,13 +40,13 @@ function De(e, t, n, r, i = !0, a = /* @__PURE__ */ new Set()) {
40
40
  let t = e.find((e) => e.id === o.id);
41
41
  t && De(t, o, `${n}.${o.id}`, r, i, a);
42
42
  }
43
- else B(e, t) || r.set(n, t);
43
+ else V(e, t) || r.set(n, t);
44
44
  }
45
45
  function X(e, t, n, r = [], i = /* @__PURE__ */ new Set()) {
46
46
  let a = /* @__PURE__ */ new Map();
47
47
  De(e, t, "", a, e.type !== "custom", i);
48
48
  let o = new Set(e.type === "custom" ? ue(e, r) : []), s = {}, c = {};
49
- for (let [t, r] of a) if ((e.type === "custom" ? o.has(t) : ce(e.type, t)) && typeof r == "string" && q(e, t) !== void 0) {
49
+ for (let [t, r] of a) if ((e.type === "custom" ? o.has(t) : se(e.type, t)) && typeof r == "string" && q(e, t) !== void 0) {
50
50
  let i = n?.text?.[t];
51
51
  s[t] = i && i.value === r ? i : {
52
52
  value: r,
@@ -60,7 +60,7 @@ function Oe(e, t, n) {
60
60
  let r = !1;
61
61
  function i(e, t, n, a) {
62
62
  let o = e[n], s = t[n], c = (e) => Array.isArray(e) && e.every((e) => Y(e) && typeof e.id == "string");
63
- if (c(o) && c(s) && (JSON.stringify(o.map((e) => e.id)) !== JSON.stringify(s.map((e) => e.id)) && (r = !0, e[n] = s.map((e) => R(o.find((t) => t.id === e.id) ?? e))), a)) for (let t of s) {
63
+ if (c(o) && c(s) && (JSON.stringify(o.map((e) => e.id)) !== JSON.stringify(s.map((e) => e.id)) && (r = !0, e[n] = s.map((e) => z(o.find((t) => t.id === e.id) ?? e))), a)) for (let t of s) {
64
64
  let r = e[n].find((e) => e.id === t.id);
65
65
  r && i(r, t, a);
66
66
  }
@@ -68,7 +68,7 @@ function Oe(e, t, n) {
68
68
  let a = e, o = t;
69
69
  if (e.type === "menu" && i(a, o, "items"), e.type === "table" && i(a, o, "rows", "cells"), e.type === "social" && i(a, o, "icons"), e.type === "section" && t.type === "section") {
70
70
  let i = (e) => e.map((e) => e.map((e) => e.id));
71
- (e.columns !== t.columns || JSON.stringify(i(e.children)) !== JSON.stringify(i(t.children))) && (r = !0, e.columns = t.columns, e.children = t.children.map((e) => e.map((e) => R(n(e.id) ?? e))));
71
+ (e.columns !== t.columns || JSON.stringify(i(e.children)) !== JSON.stringify(i(t.children))) && (r = !0, e.columns = t.columns, e.children = t.children.map((e) => e.map((e) => z(n(e.id) ?? e))));
72
72
  }
73
73
  return r;
74
74
  }
@@ -79,7 +79,7 @@ function ke(e, t, n) {
79
79
  }, i = /* @__PURE__ */ new Map();
80
80
  De(r(e), r(t), "", i);
81
81
  let a = {};
82
- for (let [t, r] of i) if (oe.includes(t) && typeof r == "string" && q(e, t) !== void 0) {
82
+ for (let [t, r] of i) if (ae.includes(t) && typeof r == "string" && q(e, t) !== void 0) {
83
83
  let i = n?.text?.[t];
84
84
  (a.text ??= {})[t] = i?.value === r ? i : {
85
85
  value: r,
@@ -89,30 +89,30 @@ function ke(e, t, n) {
89
89
  return a;
90
90
  }
91
91
  function Ae(e, t, n, r, i, a = []) {
92
- let o = R(e ?? {}), s = [.../* @__PURE__ */ new Set([...a, ...[.../* @__PURE__ */ new Set([
92
+ let o = z(e ?? {}), s = [.../* @__PURE__ */ new Set([...a, ...[.../* @__PURE__ */ new Set([
93
93
  ...Object.keys(t.text ?? {}),
94
94
  ...Object.keys(t.set ?? {}),
95
95
  ...Object.keys(n.text ?? {}),
96
96
  ...Object.keys(n.set ?? {})
97
- ])].filter((e) => !B(t.text?.[e], n.text?.[e]) || !B(t.set?.[e], n.set?.[e]))])], c = Object.keys(e?.set ?? {}).filter((e) => s.some((t) => t.startsWith(`${e}.`)));
97
+ ])].filter((e) => !V(t.text?.[e], n.text?.[e]) || !V(t.set?.[e], n.set?.[e]))])], c = Object.keys(e?.set ?? {}).filter((e) => s.some((t) => t.startsWith(`${e}.`)));
98
98
  for (let e of c) {
99
- let t = q(i, e), n = s.filter((t) => t.startsWith(`${e}.`) && B(q(r, t), q(i, t)));
100
- if (B(t, q(r, e))) delete o.set[e];
99
+ let t = q(i, e), n = s.filter((t) => t.startsWith(`${e}.`) && V(q(r, t), q(i, t)));
100
+ if (V(t, q(r, e))) delete o.set[e];
101
101
  else if (n.length && Y(q(r, e)) && Y(t)) {
102
102
  delete o.set[e];
103
103
  let i = (e, t, a) => {
104
104
  if (!n.some((t) => e === t || e.startsWith(`${t}.`))) {
105
105
  if (Y(t) && Y(a)) for (let n of /* @__PURE__ */ new Set([...Object.keys(t), ...Object.keys(a)])) i(`${e}.${n}`, t[n], a[n]);
106
106
  else if (Y(r) && r.type !== "custom" && we(t) && we(a)) for (let n of a) i(`${e}.${n.id}`, t.find((e) => e.id === n.id), n);
107
- else Y(r) && typeof r.type == "string" && te(r, e, a) || o.text?.[e] && o.text[e].value === a || ((o.set ??= {})[e] = a === void 0 ? null : R(a));
107
+ else Y(r) && typeof r.type == "string" && P(r, e, a) || o.text?.[e] && o.text[e].value === a || ((o.set ??= {})[e] = a === void 0 ? null : z(a));
108
108
  }
109
109
  };
110
110
  i(e, q(r, e), t);
111
- } else o.set[e] = t === void 0 ? null : R(t);
111
+ } else o.set[e] = t === void 0 ? null : z(t);
112
112
  for (let t of ["text", "set"]) for (let n of Object.keys(o[t] ?? {})) {
113
113
  if (!n.startsWith(`${e}.`)) continue;
114
114
  let r = t === "text" ? o.text[n].value : o.set[n] ?? void 0;
115
- B(r, q(i, n)) || delete o[t][n];
115
+ V(r, q(i, n)) || delete o[t][n];
116
116
  }
117
117
  }
118
118
  for (let e of s) if (!c.includes(e)) {
@@ -191,7 +191,7 @@ function Ie(e, t) {
191
191
  }
192
192
  }
193
193
  function Le(t) {
194
- let n = t.content ?? P(t.defaultFontFamily, t.templateDefaults);
194
+ let n = t.content ?? F(t.defaultFontFamily, t.templateDefaults);
195
195
  O(n), D(n);
196
196
  let i = s({
197
197
  template: null,
@@ -225,16 +225,16 @@ function Le(t) {
225
225
  }
226
226
  function f(e, n) {
227
227
  if (!l()) return null;
228
- if (e === "addLocale" && (!ie(n) || t.localization && !t.localization.locales.includes(n))) throw new G(`Locale "${n}" is not enabled.`, void 0, "unknown_locale");
229
- let r = R(i.content);
230
- return re(r, [{
228
+ if (e === "addLocale" && (!re(n) || t.localization && !t.localization.locales.includes(n))) throw new G(`Locale "${n}" is not enabled.`, void 0, "unknown_locale");
229
+ let r = z(i.content);
230
+ return ne(r, [{
231
231
  op: e,
232
232
  locale: n
233
- }]), B(r, i.content) ? null : r;
233
+ }]), V(r, i.content) ? null : r;
234
234
  }
235
235
  function m(e, t) {
236
236
  let n = f(e, t);
237
- n && (i.content = n, M());
237
+ n && (i.content = n, P());
238
238
  }
239
239
  function h(e) {
240
240
  m("addLocale", e);
@@ -251,24 +251,24 @@ function Le(t) {
251
251
  }
252
252
  function b(e, t) {
253
253
  let [n, r] = t;
254
- if (!a.value || !l() || z(n)) return null;
255
- let s = I(i.content.blocks, n);
254
+ if (!a.value || !l() || H(n)) return null;
255
+ let s = R(i.content.blocks, n);
256
256
  if (!s) return null;
257
- let c = s.l10n?.[a.value], u = A(s, a.value, W(i.content)), d = X(s, u, c, o), f = e === "resetLocaleFields" && Array.isArray(r) ? Ee(s, u, r) : void 0, p = e === "resetLocaleFields" ? Ae(c, d, X(s, u, c, o, f), s, u, Array.isArray(r) ? r : []) : R(c ?? {});
257
+ let c = s.l10n?.[a.value], u = A(s, a.value, W(i.content)), d = X(s, u, c, o), f = e === "resetLocaleFields" && Array.isArray(r) ? Ee(s, u, r) : void 0, p = e === "resetLocaleFields" ? Ae(c, d, X(s, u, c, o, f), s, u, Array.isArray(r) ? r : []) : z(c ?? {});
258
258
  if (e === "setBlockHidden") r ? p.hidden = !0 : delete p.hidden;
259
259
  else if (e === "resetLocaleFields") r || (delete p.text, delete p.set, delete p.hidden);
260
260
  else for (let e of r) {
261
261
  let t = p.text?.[e];
262
262
  t && (t.sourceHash = de(String(q(s, e) ?? "")));
263
263
  }
264
- return p.text && !Object.keys(p.text).length && delete p.text, p.set && !Object.keys(p.set).length && delete p.set, B(c ?? {}, p) ? null : {
264
+ return p.text && !Object.keys(p.text).length && delete p.text, p.set && !Object.keys(p.set).length && delete p.set, V(c ?? {}, p) ? null : {
265
265
  block: s,
266
266
  layer: p
267
267
  };
268
268
  }
269
269
  function x(e, t) {
270
270
  let n = b(e, t);
271
- n && (y(n.block, n.layer), M());
271
+ n && (y(n.block, n.layer), P());
272
272
  }
273
273
  function S(e, t) {
274
274
  x("setBlockHidden", [e, t]);
@@ -279,32 +279,32 @@ function Le(t) {
279
279
  function w(e, t) {
280
280
  x("keepTranslations", [e, t]);
281
281
  }
282
- let T = p(0), E = 0, k = 0;
283
- function M() {
284
- i.isDirty = !0, k++;
282
+ let T = p(0), E = p(0), k = 0, M = 0;
283
+ function P() {
284
+ i.isDirty = !0, M++;
285
285
  }
286
286
  let te = r({
287
287
  get: () => i.content,
288
288
  set: (e) => {
289
- i.content = e, M();
289
+ i.content = e, P();
290
290
  }
291
- }), ne = r(() => i.selectedBlockId ? I(i.content.blocks, i.selectedBlockId) : null);
292
- function I(e, t) {
291
+ }), L = r(() => i.selectedBlockId ? R(i.content.blocks, i.selectedBlockId) : null);
292
+ function R(e, t) {
293
293
  for (let n of e) {
294
294
  if (n.id === t) return n;
295
295
  if (n.type === "section") for (let e of n.children) {
296
- let n = I(e, t);
296
+ let n = R(e, t);
297
297
  if (n) return n;
298
298
  }
299
299
  }
300
300
  return null;
301
301
  }
302
- function L(e, t, n = { blocks: e }) {
302
+ function B(e, t, n = { blocks: e }) {
303
303
  for (let r = 0; r < e.length; r++) {
304
304
  let i = e[r];
305
305
  if (i.id === t) return n;
306
306
  if (i.type === "section") for (let e = 0; e < i.children.length; e++) {
307
- let n = L(i.children[e], t, {
307
+ let n = B(i.children[e], t, {
308
308
  blocks: i.children[e],
309
309
  sectionId: i.id,
310
310
  columnIndex: e
@@ -314,7 +314,7 @@ function Le(t) {
314
314
  }
315
315
  return null;
316
316
  }
317
- function z(e, n = !1) {
317
+ function H(e, n = !1) {
318
318
  let r = a.value ?? t.lockLocale?.value ?? null;
319
319
  for (let [i, a] of t.lockedBlocks?.value ?? []) {
320
320
  let o = a;
@@ -324,8 +324,8 @@ function Le(t) {
324
324
  }
325
325
  return !1;
326
326
  }
327
- function V(e) {
328
- let t = L(i.content.blocks, e);
327
+ function ie(e) {
328
+ let t = B(i.content.blocks, e);
329
329
  if (!t) return null;
330
330
  let n = t.blocks.findIndex((t) => t.id === e);
331
331
  return n === -1 ? null : {
@@ -335,12 +335,12 @@ function Le(t) {
335
335
  };
336
336
  }
337
337
  function ae(e, t = !0) {
338
- O(e), D(e), i.content = e, t && M();
338
+ O(e), D(e), i.content = e, t && P();
339
339
  }
340
- function oe(e) {
341
- e && z(e) || (i.selectedBlockId = e);
340
+ function U(e) {
341
+ e && H(e) || (i.selectedBlockId = e);
342
342
  }
343
- function H(e) {
343
+ function oe(e) {
344
344
  i.viewport = e;
345
345
  }
346
346
  function se(e) {
@@ -349,22 +349,22 @@ function Le(t) {
349
349
  function ce(e) {
350
350
  i.uiTheme = e;
351
351
  }
352
- function U(e) {
352
+ function ue(e) {
353
353
  i.previewMode = e, e && (i.selectedBlockId = null);
354
354
  }
355
- function ue(e, t) {
355
+ function fe(e, t) {
356
356
  if (!l()) return !1;
357
- let n = I(i.content.blocks, e);
357
+ let n = R(i.content.blocks, e);
358
358
  if (!n) return !1;
359
359
  if ("l10n" in t) throw new G("l10n is immutable in updateBlock.", void 0, "invalid_operation");
360
360
  let r = {
361
361
  ...n,
362
362
  ...t
363
- }, o = R(n), s = Oe(o, r, (e) => I(i.content.blocks, e)), c = "children" in t, u = s || c || r.type !== n.type;
363
+ }, o = z(n), s = Oe(o, r, (e) => R(i.content.blocks, e)), c = "children" in t, u = s || c || r.type !== n.type;
364
364
  if (c && r.type === "section" && Array.isArray(r.children)) {
365
365
  let e = new Set(N(n).slice(1)), t = /* @__PURE__ */ new Set();
366
366
  for (let n of r.children) for (let r of n) for (let n of N(r)) {
367
- if (t.has(n) || z(n, !0) || I(i.content.blocks, n) !== null && !e.has(n)) return !1;
367
+ if (t.has(n) || H(n, !0) || R(i.content.blocks, n) !== null && !e.has(n)) return !1;
368
368
  t.add(n);
369
369
  }
370
370
  if (a.value) {
@@ -372,41 +372,41 @@ function Le(t) {
372
372
  if (new Set(e).size !== e.length) return !1;
373
373
  }
374
374
  }
375
- return !z(e, u || "columns" in t) && (!u || !N(n).some((t) => t !== e && z(t, !0)));
375
+ return !H(e, u || "columns" in t) && (!u || !N(n).some((t) => t !== e && H(t, !0)));
376
376
  }
377
- function fe(e, n) {
378
- if (!ue(e, n)) return;
379
- let r = I(i.content.blocks, e);
377
+ function pe(e, n) {
378
+ if (!fe(e, n)) return;
379
+ let r = R(i.content.blocks, e);
380
380
  if (!r) return;
381
381
  let s = a.value;
382
382
  if (s) {
383
383
  let a = A(r, s, W(i.content)), c = {
384
384
  ...a,
385
385
  ...n
386
- }, l = R(r), u = Oe(l, c, (e) => I(i.content.blocks, e));
387
- if (z(e, u)) return;
386
+ }, l = z(r), u = Oe(l, c, (e) => R(i.content.blocks, e));
387
+ if (H(e, u)) return;
388
388
  u && t.onStructureChange?.();
389
389
  let d = ee(l);
390
390
  delete r.l10n, Object.assign(r, d), y(r, Ae(r.l10n?.[s], X(r, a, r.l10n?.[s], o), X(r, c, r.l10n?.[s], o), r, c));
391
391
  } else {
392
- if (z(e, "children" in n || "columns" in n)) return;
392
+ if (H(e, "children" in n || "columns" in n)) return;
393
393
  let t = ee({
394
394
  ...r,
395
395
  ...n
396
396
  });
397
397
  delete r.l10n, Object.assign(r, t);
398
398
  }
399
- M();
399
+ P();
400
400
  }
401
- function pe(e) {
401
+ function K(e) {
402
402
  if ("locales" in e || "l10n" in e) throw new G("locales and l10n are immutable in updateSettings.", void 0, "invalid_operation");
403
403
  if ("locale" in e && e.locale !== W(i.content) && i.content.settings.locales?.length) throw new G("The default locale can't change while language versions exist.", void 0, "invalid_operation");
404
404
  }
405
- function K(e) {
405
+ function me(e) {
406
406
  if (!l()) return;
407
- pe(e);
407
+ K(e);
408
408
  let t = a.value;
409
- if (!t) i.content.settings = F({
409
+ if (!t) i.content.settings = I({
410
410
  ...i.content.settings,
411
411
  ...e
412
412
  });
@@ -421,122 +421,122 @@ function Le(t) {
421
421
  [t]: s
422
422
  } : n.l10n && (delete n.l10n[t], Object.keys(n.l10n).length || delete n.l10n);
423
423
  }
424
- M();
424
+ P();
425
425
  }
426
- let J = {
426
+ let he = {
427
427
  canEdit: l,
428
428
  content: () => i.content,
429
- findBlock: (e) => I(i.content.blocks, e),
430
- findBlockLocation: V,
431
- isBlockLocked: z
429
+ findBlock: (e) => R(i.content.blocks, e),
430
+ findBlockLocation: ie,
431
+ isBlockLocked: H
432
432
  };
433
- function me(e, n, r = 0, o) {
434
- if (Me(J, "addBlock", [
433
+ function ge(e, n, r = 0, o) {
434
+ if (Me(he, "addBlock", [
435
435
  e,
436
436
  n,
437
437
  r,
438
438
  o
439
439
  ])) {
440
440
  if (n) {
441
- let t = I(i.content.blocks, n);
441
+ let t = R(i.content.blocks, n);
442
442
  if (t && t.type === "section") {
443
443
  t.children[r] = t.children[r] || [];
444
444
  let n = t.children[r];
445
445
  o !== void 0 && o < n.length ? n.splice(o, 0, e) : n.push(e);
446
446
  }
447
447
  } else o !== void 0 && o < i.content.blocks.length ? i.content.blocks.splice(o, 0, e) : i.content.blocks.push(e);
448
- a.value && t.onStructureChange?.(), M();
448
+ a.value && t.onStructureChange?.(), P();
449
449
  }
450
450
  }
451
- function he(e) {
452
- if (!Me(J, "removeBlock", [e])) return;
453
- let n = L(i.content.blocks, e);
451
+ function _e(e) {
452
+ if (!Me(he, "removeBlock", [e])) return;
453
+ let n = B(i.content.blocks, e);
454
454
  if (n) {
455
455
  let r = n.blocks.findIndex((t) => t.id === e);
456
456
  if (r !== -1) {
457
457
  let [e] = n.blocks.splice(r, 1);
458
- i.selectedBlockId && new Set(N(e)).has(i.selectedBlockId) && (i.selectedBlockId = null), a.value && t.onStructureChange?.(), M();
458
+ i.selectedBlockId && new Set(N(e)).has(i.selectedBlockId) && (i.selectedBlockId = null), a.value && t.onStructureChange?.(), P();
459
459
  }
460
460
  }
461
461
  }
462
- function ge(e, n, r, o = 0) {
463
- if (!Me(J, "moveBlock", [
462
+ function ve(e, n, r, o = 0) {
463
+ if (!Me(he, "moveBlock", [
464
464
  e,
465
465
  n,
466
466
  r,
467
467
  o
468
468
  ])) return;
469
- let s = L(i.content.blocks, e), c = s.blocks.findIndex((t) => t.id === e), l;
469
+ let s = B(i.content.blocks, e), c = s.blocks.findIndex((t) => t.id === e), l;
470
470
  if (r) {
471
- let e = I(i.content.blocks, r);
471
+ let e = R(i.content.blocks, r);
472
472
  e.children[o] = e.children[o] || [], l = e.children[o];
473
473
  } else l = i.content.blocks;
474
474
  let [u] = s.blocks.splice(c, 1);
475
- l.splice(n, 0, u), a.value && t.onStructureChange?.(), M();
475
+ l.splice(n, 0, u), a.value && t.onStructureChange?.(), P();
476
476
  }
477
- function _e() {
478
- M();
477
+ function ye() {
478
+ P();
479
479
  }
480
- function ve(e, t) {
480
+ function be(e, t) {
481
481
  throw new G(`[Templatical] Templates: ${e} ${t}`);
482
482
  }
483
- function ye(e) {
483
+ function xe(e) {
484
484
  Ie(t.onError, e);
485
485
  }
486
- function be(e) {
486
+ function J(e) {
487
487
  let { templates: n } = t;
488
- return n || ve(e, "needs a templates provider. Pass one as `init({ templates })` to enable saving and loading."), n;
488
+ return n || be(e, "needs a templates provider. Pass one as `init({ templates })` to enable saving and loading."), n;
489
489
  }
490
- function xe(e) {
490
+ function Se(e) {
491
491
  i.template && (i.template = {
492
492
  ...i.template,
493
493
  name: e
494
- }, M());
494
+ }, P());
495
495
  }
496
- async function Se(e) {
497
- let n = be("create()"), { create: r } = n;
498
- typeof r != "function" && ve("create()", "is disabled by the provider — its `create` is `false`.");
499
- let a, o = ++E;
496
+ async function Ce(e) {
497
+ let n = J("create()"), { create: r } = n;
498
+ typeof r != "function" && be("create()", "is disabled by the provider — its `create` is `false`.");
499
+ let a, o = ++k;
500
500
  i.isLoading = !0;
501
501
  try {
502
- e?.content && (i.content = e.content);
503
- let t = k;
502
+ e?.content !== void 0 && (i.content = e.content, E.value++);
503
+ let t = M;
504
504
  a = await r(e?.name === void 0 ? { content: i.content } : {
505
505
  name: e.name,
506
506
  content: i.content
507
- }), i.template = a, k === t && (i.isDirty = !1), T.value++;
507
+ }), i.template = a, M === t && (i.isDirty = !1), T.value++;
508
508
  } catch (e) {
509
509
  throw t.onError?.(e), e;
510
510
  } finally {
511
- E === o && (i.isLoading = !1);
511
+ k === o && (i.isLoading = !1);
512
512
  }
513
- return ye(() => n.onCreated?.(a)), a;
513
+ return xe(() => n.onCreated?.(a)), a;
514
514
  }
515
- async function Ce(e, n) {
516
- let r = be("load()"), a, o = ++E;
515
+ async function Y(e, n) {
516
+ let r = J("load()"), a, o = ++k;
517
517
  i.isLoading = !0;
518
518
  try {
519
519
  if (a = await r.load(e), O(a.content), D(a.content), n && !n()) return a;
520
- i.template = a, i.content = a.content, i.isDirty = !1, T.value++;
520
+ i.template = a, i.content = a.content, E.value++, i.isDirty = !1, T.value++;
521
521
  } catch (e) {
522
522
  throw t.onError?.(e), e;
523
523
  } finally {
524
- E === o && (i.isLoading = !1);
524
+ k === o && (i.isLoading = !1);
525
525
  }
526
- return ye(() => r.onLoaded?.(a)), a;
526
+ return xe(() => r.onLoaded?.(a)), a;
527
527
  }
528
- async function Y(e = "api") {
529
- let n = be("save()"), { save: r } = n;
530
- typeof r != "function" && ve("save()", "is disabled by the provider — its `save` is `false`.");
528
+ async function we(e = "api") {
529
+ let n = J("save()"), { save: r } = n;
530
+ typeof r != "function" && be("save()", "is disabled by the provider — its `save` is `false`.");
531
531
  let a = i.template;
532
- a || ve("save()", "has no template loaded. Call create() or load() first.");
532
+ a || be("save()", "has no template loaded. Call create() or load() first.");
533
533
  let o = a.name === void 0 ? { content: i.content } : {
534
534
  name: a.name,
535
535
  content: i.content
536
536
  }, s;
537
537
  i.isSaving = !0;
538
538
  try {
539
- let e = k;
539
+ let e = M;
540
540
  if (s = await r(a.id, o), i.template?.id === a.id) {
541
541
  let e = i.template.name;
542
542
  i.template = e === a.name ? s : {
@@ -544,22 +544,23 @@ function Le(t) {
544
544
  name: e
545
545
  };
546
546
  }
547
- k === e && (i.isDirty = !1);
547
+ M === e && (i.isDirty = !1);
548
548
  } catch (e) {
549
549
  throw t.onError?.(e), e;
550
550
  } finally {
551
551
  i.isSaving = !1;
552
552
  }
553
- return ye(() => n.onSaved?.(s, { trigger: e })), s;
553
+ return xe(() => n.onSaved?.(s, { trigger: e })), s;
554
554
  }
555
- function we() {
555
+ function Te() {
556
556
  return i.template?.id !== void 0;
557
557
  }
558
- let Te = {
558
+ let De = {
559
559
  state: e(i),
560
560
  loadVersion: e(T),
561
+ contentReplaced: e(E),
561
562
  content: te,
562
- selectedBlock: ne,
563
+ selectedBlock: L,
563
564
  activeLocale: a,
564
565
  setActiveLocale: c,
565
566
  addLocale: h,
@@ -569,33 +570,33 @@ function Le(t) {
569
570
  keepTranslations: w,
570
571
  setCustomBlockDefinitions: u,
571
572
  createSetDefaultLocaleOperation: d,
572
- isBlockLocked: z,
573
+ isBlockLocked: H,
573
574
  setContent: ae,
574
- selectBlock: oe,
575
- setViewport: H,
575
+ selectBlock: U,
576
+ setViewport: oe,
576
577
  setDarkMode: se,
577
578
  setUiTheme: ce,
578
- setPreviewMode: U,
579
- updateBlock: fe,
580
- updateSettings: K,
581
- addBlock: me,
582
- removeBlock: he,
583
- moveBlock: ge,
584
- markDirty: _e,
585
- findBlockLocation: V,
586
- setName: xe,
587
- create: Se,
588
- load: Ce,
589
- save: Y,
590
- hasTemplate: we
579
+ setPreviewMode: ue,
580
+ updateBlock: pe,
581
+ updateSettings: me,
582
+ addBlock: ge,
583
+ removeBlock: _e,
584
+ moveBlock: ve,
585
+ markDirty: ye,
586
+ findBlockLocation: ie,
587
+ setName: Se,
588
+ create: Ce,
589
+ load: Y,
590
+ save: we,
591
+ hasTemplate: Te
591
592
  };
592
- return Pe(Te, (e, t) => je(e) ? Me(J, e, t) : l() ? e === "updateBlock" ? ue(t[0], t[1]) : (e === "updateSettings" && pe(t[0]), e === "addLocale" || e === "removeLocale" ? f(e, t[0]) !== null : e === "setBlockHidden" || e === "resetLocaleFields" || e === "keepTranslations" ? b(e, t) !== null : !0) : !1), Te;
593
+ return Pe(De, (e, t) => je(e) ? Me(he, e, t) : l() ? e === "updateBlock" ? fe(t[0], t[1]) : (e === "updateSettings" && K(t[0]), e === "addLocale" || e === "removeLocale" ? f(e, t[0]) !== null : e === "setBlockHidden" || e === "resetLocaleFields" || e === "keepTranslations" ? b(e, t) !== null : !0) : !1), De;
593
594
  }
594
595
  var Re = 50, ze = 300, Be = 1500;
595
596
  function Ve(e) {
596
597
  let { content: t, setContent: n, maxSize: i = Re } = e, a = p([]), o = p([]), s = p(!1), c = null, l = null, u = r(() => a.value.length > 0), d = r(() => o.value.length > 0);
597
598
  function f() {
598
- return R(t.value);
599
+ return z(t.value);
599
600
  }
600
601
  function m(e) {
601
602
  a.value.push(e), a.value.length > i && a.value.splice(0, a.value.length - i);
@@ -771,7 +772,7 @@ function Ke(e) {
771
772
  };
772
773
  }
773
774
  function qe(e, t) {
774
- e.activeLocale && v(e.activeLocale, () => t.flushDebounce?.());
775
+ e.contentReplaced && v(e.contentReplaced, () => t.clear()), e.activeLocale && v(e.activeLocale, () => t.flushDebounce?.());
775
776
  for (let n of [
776
777
  "addLocale",
777
778
  "removeLocale",
@@ -864,7 +865,7 @@ function nt(e) {
864
865
  }
865
866
  function rt(e, t, n) {
866
867
  let r = {}, i = [];
867
- for (let i of Object.keys(t)) n.has(i) || t[i] === void 0 || B(e[i], t[i]) || (r[i] = R(t[i]));
868
+ for (let i of Object.keys(t)) n.has(i) || t[i] === void 0 || V(e[i], t[i]) || (r[i] = z(t[i]));
868
869
  for (let r of Object.keys(e)) n.has(r) || e[r] === void 0 || t[r] === void 0 && i.push(r);
869
870
  return {
870
871
  set: r,
@@ -883,7 +884,7 @@ function it(e = {}, t = {}) {
883
884
  function at(e, t) {
884
885
  if (e.settings.locale !== t.settings.locale && (e.settings.locales?.length || t.settings.locales?.length)) return [{
885
886
  op: "setContent",
886
- content: R(t)
887
+ content: z(t)
887
888
  }];
888
889
  let n = tt(e.blocks), r = tt(t.blocks), i = [], a = new Set(t.settings.locales ?? []), o = new Set(e.settings.locales ?? []), s = (e) => {
889
890
  let t = r.get(e), i = n.get(e);
@@ -901,7 +902,7 @@ function at(e, t) {
901
902
  };
902
903
  for (let t of e.blocks) p(t, "kept");
903
904
  let m = (e) => n.has(e) && !d.has(e), h = (e) => {
904
- let t = R(e);
905
+ let t = z(e);
905
906
  return t.type === "section" ? t.children = et(e).map((e) => Array.isArray(e) ? e.filter((e) => !m(e.id)).map(h) : e) : t.type === "wrapper" && e.type === "wrapper" && (t.children = e.children.filter((e) => !m(e.id)).map(h)), t;
906
907
  }, g = (e, t, r) => {
907
908
  let a = $e(e), o = [], s = [];
@@ -1083,11 +1084,11 @@ function lt(e, t, n) {
1083
1084
  Object.keys(n).length ? (e.l10n ??= {})[t] = n : e.l10n && (delete e.l10n[t], Object.keys(e.l10n).length || delete e.l10n);
1084
1085
  }
1085
1086
  function ut(e) {
1086
- let t = R(e);
1087
+ let t = z(e);
1087
1088
  return delete t.l10n, t.type === "section" ? t.children = t.children.map((e) => e.map(ut)) : t.type === "wrapper" && (t.children = t.children.map(ut)), t;
1088
1089
  }
1089
1090
  function dt(e, t, n, r) {
1090
- let i = le(e, t), a = R(e), o = R(i.settings), s = !1, c = /* @__PURE__ */ new Map(), l = (n, r) => {
1091
+ let i = le(e, t), a = z(e), o = z(i.settings), s = !1, c = /* @__PURE__ */ new Map(), l = (n, r) => {
1091
1092
  for (let [i, a] of $(n)) c.set(i, {
1092
1093
  initial: A(a, t, W(e)),
1093
1094
  added: r,
@@ -1096,19 +1097,19 @@ function dt(e, t, n, r) {
1096
1097
  };
1097
1098
  l(i.blocks, !1);
1098
1099
  let u = [], d = (e, t, n) => {
1099
- if (t.some((e) => e?.op === "setDefaultLocale")) throw new V("invalid_operation", n, "Changing the default language isn't possible in a language view; switch to the default language.");
1100
- if (t.some((e) => e?.op === "setContent")) throw new V("invalid_operation", n, "Replacing the whole template isn't possible in a language view; switch to the default language.");
1100
+ if (t.some((e) => e?.op === "setDefaultLocale")) throw new H("invalid_operation", n, "Changing the default language isn't possible in a language view; switch to the default language.");
1101
+ if (t.some((e) => e?.op === "setContent")) throw new H("invalid_operation", n, "Replacing the whole template isn't possible in a language view; switch to the default language.");
1101
1102
  try {
1102
1103
  return K(e, t);
1103
1104
  } catch (e) {
1104
- throw e instanceof V ? new V(e.code, n, e.message, e.blockId) : e;
1105
+ throw e instanceof H ? new H(e.code, n, e.message, e.blockId) : e;
1105
1106
  }
1106
1107
  }, f = (e, t) => {
1107
1108
  a = d(a, e, t), u.push(...e);
1108
1109
  }, p = (e, n) => {
1109
1110
  let o = c.get(e);
1110
1111
  if (!o?.changed) return;
1111
- let s = $(a.blocks).get(e), l = $(i.blocks).get(e), u = R(a), d = ot(u, st(u, e).parent), p = R(s);
1112
+ let s = $(a.blocks).get(e), l = $(i.blocks).get(e), u = z(a), d = ot(u, st(u, e).parent), p = z(s);
1112
1113
  if (o.added) p = ut(l), p.type === "section" && s.type === "section" ? (p.children = s.children, p.columns = s.columns) : p.type === "wrapper" && s.type === "wrapper" && (p.children = s.children);
1113
1114
  else {
1114
1115
  let e = p.type === "section" ? {
@@ -1184,7 +1185,7 @@ function dt(e, t, n, r) {
1184
1185
  });
1185
1186
  for (let e of c.keys()) p(e, n.length - 1);
1186
1187
  if (s) {
1187
- let e = R(a), r = e.settings.l10n?.[t];
1188
+ let e = z(a), r = e.settings.l10n?.[t];
1188
1189
  lt(e.settings, t, Ae(r, ke(e.settings, o, r), ke(e.settings, i.settings, r), e.settings, i.settings)), f(at(a, e), n.length - 1);
1189
1190
  }
1190
1191
  return u;
@@ -1241,14 +1242,14 @@ function wt(e) {
1241
1242
  });
1242
1243
  }
1243
1244
  function Tt(e) {
1244
- let { provider: t } = e, n = e.sessionId ?? crypto.randomUUID(), i = e.maxUndo ?? ht, a = typeof t.acquireLock == "function" && typeof t.renewLock == "function" && typeof t.releaseLock == "function", o = y([]), s = y(/* @__PURE__ */ new Map()), c = /* @__PURE__ */ new WeakSet(), u = /* @__PURE__ */ new WeakMap(), d = 0, f = p(null), m = p(null), h = p(0), g = p(0), _ = null, b = null, S = !1, C = !1, w = !1, T = !1, E = null, D = 0, O = !1, k = [], A = null, j = null, ee = Promise.resolve(), M = null, N = r(() => (g.value, (b?.undo.length ?? 0) > 0)), te = r(() => (g.value, (b?.redo.length ?? 0) > 0));
1245
- function P(t) {
1245
+ let { provider: t } = e, n = e.sessionId ?? crypto.randomUUID(), i = e.maxUndo ?? ht, a = typeof t.acquireLock == "function" && typeof t.renewLock == "function" && typeof t.releaseLock == "function", o = y([]), s = y(/* @__PURE__ */ new Map()), c = /* @__PURE__ */ new WeakSet(), u = /* @__PURE__ */ new WeakMap(), d = 0, f = p(null), m = p(null), h = p(0), g = p(0), _ = null, b = null, S = !1, C = !1, w = !1, T = !1, E = null, D = 0, O = !1, k = [], A = null, j = null, ee = Promise.resolve(), M = null, N = r(() => (g.value, (b?.undo.length ?? 0) > 0)), P = r(() => (g.value, (b?.redo.length ?? 0) > 0));
1246
+ function F(t) {
1246
1247
  e.onError?.(t instanceof Error ? t : Error(String(t)));
1247
1248
  }
1248
- function F(t, n = b) {
1249
+ function I(t, n = b) {
1249
1250
  n !== b || O || e.onNotice?.(t);
1250
1251
  }
1251
- function ne() {
1252
+ function te() {
1252
1253
  return {
1253
1254
  locks: [...s.value.values()].map((e) => ({
1254
1255
  blockId: e.blockId,
@@ -1258,87 +1259,87 @@ function Tt(e) {
1258
1259
  session: n
1259
1260
  };
1260
1261
  }
1261
- function I() {
1262
+ function L() {
1262
1263
  g.value++;
1263
1264
  }
1264
- function L(e, t) {
1265
+ function R(e, t) {
1265
1266
  e.push(t), e.length > i && e.splice(0, e.length - i);
1266
1267
  }
1267
- function z(e) {
1268
+ function B(e) {
1268
1269
  if (!_ || S) return;
1269
1270
  C = !0;
1270
1271
  try {
1271
1272
  let t = _.content.value, n = at(t, e);
1272
1273
  if (n.length > 0) try {
1273
- re(t, n);
1274
+ ne(t, n);
1274
1275
  } catch {
1275
- _.setContent(R(e), !1);
1276
+ _.setContent(z(e), !1);
1276
1277
  }
1277
- B(_.content.value, e) || _.setContent(R(e), !1);
1278
+ V(_.content.value, e) || _.setContent(z(e), !1);
1278
1279
  } finally {
1279
1280
  C = !1;
1280
1281
  }
1281
1282
  let t = _.state.selectedBlockId;
1282
1283
  t && !St(e.blocks, t) && _.selectBlock(null);
1283
1284
  }
1284
- function ie() {
1285
+ function re() {
1285
1286
  C || T || (T = !0, queueMicrotask(() => {
1286
- T = !1, oe(!1);
1287
+ T = !1, ae(!1);
1287
1288
  }));
1288
1289
  }
1289
- function ae() {
1290
+ function ie() {
1290
1291
  E &&= (clearTimeout(E), null);
1291
1292
  }
1292
- function oe(e, t = !1) {
1293
+ function ae(e, t = !1) {
1293
1294
  let n = b;
1294
1295
  if (!_ || !n || S || C || _.state.isLoading && !t || _.state.template?.id !== n.templateId) return;
1295
1296
  let r = at(n.view, _.content.value);
1296
- if (r.length === 0) ae();
1297
+ if (r.length === 0) ie();
1297
1298
  else {
1298
1299
  if (!e && Ct(r)) {
1299
1300
  let e = Date.now();
1300
1301
  if (E === null && (D = e), e - D < 1e3) {
1301
1302
  E && clearTimeout(E), E = setTimeout(() => {
1302
- E = null, oe(!0);
1303
+ E = null, ae(!0);
1303
1304
  }, 300);
1304
1305
  return;
1305
1306
  }
1306
1307
  }
1307
- ae(), se(n, r);
1308
+ ie(), oe(n, r);
1308
1309
  }
1309
1310
  }
1310
- function H() {
1311
- oe(!0);
1311
+ function U() {
1312
+ ae(!0);
1312
1313
  }
1313
- function se(e, t) {
1314
+ function oe(e, t) {
1314
1315
  let n = t, r;
1315
1316
  try {
1316
- r = K(e.view, n, ne());
1317
+ r = K(e.view, n, te());
1317
1318
  } catch (n) {
1318
- if (!(n instanceof V)) throw n;
1319
- z(e.view);
1320
- let r = n.blockId === void 0 ? void 0 : ke(n.blockId).find((e) => {
1319
+ if (!(n instanceof H)) throw n;
1320
+ B(e.view);
1321
+ let r = n.blockId === void 0 ? void 0 : Ae(n.blockId).find((e) => {
1321
1322
  let r = t[n.opIndex];
1322
1323
  return r.op !== "updateBlockLocale" || e.locale == null || e.locale === r.locale;
1323
1324
  })?.holder;
1324
- F({
1325
+ I({
1325
1326
  type: "editRefused",
1326
1327
  code: n.code,
1327
1328
  ...r ? { holder: r } : {}
1328
- }), n.code === "invalid_operation" && P(n);
1329
+ }), n.code === "invalid_operation" && F(n);
1329
1330
  return;
1330
1331
  }
1331
1332
  let i = _.content.value;
1332
- if (!B(r, i)) {
1333
- P(/* @__PURE__ */ Error("[Templatical] Collaboration: a change couldn't be expressed as block operations, so the whole content was sent.")), n = [{
1333
+ if (!V(r, i)) {
1334
+ F(/* @__PURE__ */ Error("[Templatical] Collaboration: a change couldn't be expressed as block operations, so the whole content was sent.")), n = [{
1334
1335
  op: "setContent",
1335
- content: R(i)
1336
+ content: z(i)
1336
1337
  }];
1337
1338
  try {
1338
- r = K(e.view, n, ne());
1339
+ r = K(e.view, n, te());
1339
1340
  } catch (t) {
1340
- if (!(t instanceof V)) throw t;
1341
- z(e.view), F({
1341
+ if (!(t instanceof H)) throw t;
1342
+ B(e.view), I({
1342
1343
  type: "editRefused",
1343
1344
  code: t.code
1344
1345
  });
@@ -1346,11 +1347,11 @@ function Tt(e) {
1346
1347
  }
1347
1348
  }
1348
1349
  let a = vt({ ops: pe(e.view, n) }, r);
1349
- L(e.undo, a), e.redo = [], I();
1350
+ R(e.undo, a), e.redo = [], L();
1350
1351
  let o = e.view;
1351
- e.view = r, ce(e, n, "edit", a, o);
1352
+ e.view = r, se(e, n, "edit", a, o);
1352
1353
  }
1353
- function ce(e, t, n, r, i) {
1354
+ function se(e, t, n, r, i) {
1354
1355
  let a = { dropped: !1 }, o = 0, s = i;
1355
1356
  do {
1356
1357
  let i = t.slice(o, o + gt);
@@ -1369,9 +1370,9 @@ function Tt(e) {
1369
1370
  s = null;
1370
1371
  }
1371
1372
  } while (o < t.length);
1372
- U(e);
1373
+ ce(e);
1373
1374
  }
1374
- function U(e) {
1375
+ function ce(e) {
1375
1376
  if (e.inFlight || w) return;
1376
1377
  let t = e.pending.find((e) => !e.sent);
1377
1378
  t ? (t.sent = !0, e.inFlight = t, le(e, t, 0)) : q(e);
@@ -1383,20 +1384,20 @@ function Tt(e) {
1383
1384
  ops: n.ops,
1384
1385
  ...n.origin === "ai" ? { origin: "ai" } : {}
1385
1386
  }).then(({ revision: t }) => {
1386
- e.inFlight = null, W(e, n, t), U(e);
1387
+ e.inFlight = null, W(e, n, t), ce(e);
1387
1388
  }, (t) => {
1388
- if (yt(t) !== null) e.inFlight = null, G(e, n, t), U(e);
1389
+ if (yt(t) !== null) e.inFlight = null, G(e, n, t), ce(e);
1389
1390
  else if (xt(t)) {
1390
- J(e, t);
1391
+ me(e, t);
1391
1392
  let i = mt[Math.min(r, mt.length - 1)];
1392
1393
  setTimeout(() => {
1393
1394
  O || le(e, n, r + 1);
1394
1395
  }, i);
1395
- } else e.inFlight = null, P(t), G(e, n, t), U(e);
1396
+ } else e.inFlight = null, F(t), G(e, n, t), ce(e);
1396
1397
  });
1397
1398
  }
1398
1399
  function W(e, t, n) {
1399
- t.revision === null && (t.revision = n, n <= e.revision ? (ue(e, t), _e(e)) : (e.own.set(n, t), ge(e)));
1400
+ t.revision === null && (t.revision = n, n <= e.revision ? (ue(e, t), ve(e)) : (e.own.set(n, t), _e(e)));
1400
1401
  }
1401
1402
  function ue(e, t) {
1402
1403
  e.pending = e.pending.filter((e) => e !== t), q(e);
@@ -1407,7 +1408,7 @@ function Tt(e) {
1407
1408
  let e = n.indexOf(t.entry);
1408
1409
  e !== -1 && n.splice(e, 1);
1409
1410
  }
1410
- I();
1411
+ L();
1411
1412
  }
1412
1413
  }
1413
1414
  function fe(e, t) {
@@ -1419,49 +1420,49 @@ function Tt(e) {
1419
1420
  let r = yt(n) ?? "invalid_operation";
1420
1421
  if (t.origin === "edit" || t.origin === "ai") {
1421
1422
  let t = bt(n);
1422
- F({
1423
+ I({
1423
1424
  type: "editRefused",
1424
1425
  code: r,
1425
1426
  ...t ? { holder: t } : {}
1426
1427
  }, e);
1427
- } else F({
1428
+ } else I({
1428
1429
  type: "undoSkipped",
1429
1430
  code: r
1430
1431
  }, e);
1431
1432
  }
1432
- _e(e), e === b && xe();
1433
+ ve(e), e === b && J();
1433
1434
  }
1434
1435
  function q(e) {
1435
1436
  if (!(e.pending.length > 0 || e.waiters.length === 0)) for (let t of e.waiters.splice(0)) t.resolve();
1436
1437
  }
1437
- function J(e, t) {
1438
+ function me(e, t) {
1438
1439
  let n = t instanceof Error ? t : Error(String(t));
1439
1440
  for (let t of e.waiters.splice(0)) t.reject(n);
1440
1441
  }
1441
- function me(e, t) {
1442
+ function he(e, t) {
1442
1443
  if (t.revision <= e.revision) return;
1443
1444
  let n = e.pending.find((e) => e.batchId === t.batchId);
1444
- n ? W(e, n, t.revision) : (e.remote.set(t.revision, t), ge(e));
1445
+ n ? W(e, n, t.revision) : (e.remote.set(t.revision, t), _e(e));
1445
1446
  }
1446
- function he(t, n) {
1447
+ function ge(t, n) {
1447
1448
  let r = n.ops;
1448
1449
  if (e.normalizeRemoteOperations) try {
1449
1450
  r = e.normalizeRemoteOperations(n.ops, t.confirmed);
1450
1451
  } catch (e) {
1451
- P(e);
1452
+ F(e);
1452
1453
  }
1453
1454
  return wt(r);
1454
1455
  }
1455
- function ge(t) {
1456
+ function _e(t) {
1456
1457
  let n = [], r = !1;
1457
1458
  for (;;) {
1458
1459
  let e = t.revision + 1, i = t.remote.get(e), a = t.own.get(e);
1459
1460
  if (!i && !a) break;
1460
1461
  try {
1461
- t.confirmed = K(t.confirmed, i ? he(t, i) : a.ops);
1462
+ t.confirmed = K(t.confirmed, i ? ge(t, i) : a.ops);
1462
1463
  } catch {
1463
1464
  if (t.recovering) {
1464
- t.remote.clear(), t.own.clear(), P(/* @__PURE__ */ Error("[Templatical] Collaboration: this editor can't follow the template's changes. Reload the page."));
1465
+ t.remote.clear(), t.own.clear(), F(/* @__PURE__ */ Error("[Templatical] Collaboration: this editor can't follow the template's changes. Reload the page."));
1465
1466
  return;
1466
1467
  }
1467
1468
  Se(t);
@@ -1469,39 +1470,39 @@ function Tt(e) {
1469
1470
  }
1470
1471
  t.revision = e, i ? (t.remote.delete(e), n.push(i)) : (t.own.delete(e), a.group.dropped && (r = !0), ue(t, a));
1471
1472
  }
1472
- if (t === b && (h.value = t.revision), t.remote.size > 0 || t.own.size > 0 ? ye(t) : be(t), (n.length !== 0 || r) && (_e(t), t === b)) for (let t of n) try {
1473
+ if (t === b && (h.value = t.revision), t.remote.size > 0 || t.own.size > 0 ? be(t) : xe(t), (n.length !== 0 || r) && (ve(t), t === b)) for (let t of n) try {
1473
1474
  e.onRemoteChange?.({
1474
1475
  actor: t.actor,
1475
1476
  ops: t.ops,
1476
1477
  locale: t.ops.find((e) => e.op !== "setDefaultLocale" && "locale" in e)?.locale ?? null
1477
1478
  });
1478
1479
  } catch (e) {
1479
- P(e);
1480
+ F(e);
1480
1481
  }
1481
1482
  }
1482
- function _e(e) {
1483
+ function ve(e) {
1483
1484
  let t = !w;
1484
1485
  w = !0;
1485
1486
  try {
1486
- ve(e);
1487
+ ye(e);
1487
1488
  } finally {
1488
1489
  t && (w = !1);
1489
1490
  }
1490
- t && U(e);
1491
+ t && ce(e);
1491
1492
  }
1492
- function ve(e) {
1493
- e === b && H();
1493
+ function ye(e) {
1494
+ e === b && U();
1494
1495
  let t = e.confirmed;
1495
1496
  for (let n = 0; n < e.pending.length; n++) {
1496
1497
  let r = e.pending[n], i;
1497
- if (r.base && !B(r.base, t)) i = "precondition_failed";
1498
+ if (r.base && !V(r.base, t)) i = "precondition_failed";
1498
1499
  else try {
1499
1500
  t = K(t, r.ops);
1500
1501
  continue;
1501
1502
  } catch (e) {
1502
- i = e instanceof V ? e.code : "invalid_operation";
1503
+ i = e instanceof H ? e.code : "invalid_operation";
1503
1504
  }
1504
- r.sent || (fe(e, r) && F(r.origin === "edit" || r.origin === "ai" ? {
1505
+ r.sent || (fe(e, r) && I(r.origin === "edit" || r.origin === "ai" ? {
1505
1506
  type: "editRefused",
1506
1507
  code: i
1507
1508
  } : {
@@ -1509,17 +1510,17 @@ function Tt(e) {
1509
1510
  code: i
1510
1511
  }, e), t = e.confirmed, n = -1);
1511
1512
  }
1512
- e.view = t, q(e), e === b && z(t);
1513
+ e.view = t, q(e), e === b && B(t);
1513
1514
  }
1514
- function ye(e) {
1515
+ function be(e) {
1515
1516
  e.gapTimer ||= setTimeout(() => {
1516
- e.gapTimer = null, e === b && xe();
1517
+ e.gapTimer = null, e === b && J();
1517
1518
  }, ft);
1518
1519
  }
1519
- function be(e) {
1520
+ function xe(e) {
1520
1521
  e.gapTimer &&= (clearTimeout(e.gapTimer), null);
1521
1522
  }
1522
- function xe() {
1523
+ function J() {
1523
1524
  let e = b;
1524
1525
  return e ? (e.catchingUp ||= (async () => {
1525
1526
  try {
@@ -1529,9 +1530,9 @@ function Tt(e) {
1529
1530
  await Se(e);
1530
1531
  return;
1531
1532
  }
1532
- for (let t of n.batches) me(e, t);
1533
+ for (let t of n.batches) he(e, t);
1533
1534
  } catch (e) {
1534
- P(e);
1535
+ F(e);
1535
1536
  } finally {
1536
1537
  e.catchingUp = null;
1537
1538
  }
@@ -1542,21 +1543,24 @@ function Tt(e) {
1542
1543
  try {
1543
1544
  let n = await e.loadTemplate(t.templateId);
1544
1545
  if (t.retired) return;
1545
- let r = n.revision ?? t.revision;
1546
- t.confirmed = R(n.content), t.revision = r, t.remote = new Map([...t.remote].filter(([e]) => e > r));
1547
- for (let [e, n] of [...t.own]) e <= r && (t.own.delete(e), ue(t, n));
1548
- t === b && (h.value = r), _e(t), ge(t);
1546
+ Ce(t, n);
1549
1547
  } catch (e) {
1550
- P(e);
1548
+ F(e);
1551
1549
  } finally {
1552
1550
  t.recovering = !1;
1553
1551
  }
1554
1552
  }
1555
- function Ce(t) {
1553
+ function Ce(e, t) {
1554
+ let n = t.revision ?? e.revision;
1555
+ e.confirmed = z(t.content), e.revision = n, e.remote = new Map([...e.remote].filter(([e]) => e > n));
1556
+ for (let [t, r] of [...e.own]) t <= n && (e.own.delete(t), ue(e, r));
1557
+ e === b && (h.value = n), ve(e), _e(e);
1558
+ }
1559
+ function Y(t) {
1556
1560
  let n = () => t === b && !t.retired;
1557
1561
  return {
1558
1562
  onBatch: (e) => {
1559
- n() && me(t, e);
1563
+ n() && he(t, e);
1560
1564
  },
1561
1565
  onResync: (r, i) => {
1562
1566
  if (!(!n() || r <= t.revision)) {
@@ -1566,38 +1570,38 @@ function Tt(e) {
1566
1570
  actor: i
1567
1571
  });
1568
1572
  } catch (e) {
1569
- P(e);
1573
+ F(e);
1570
1574
  }
1571
- xe();
1575
+ J();
1572
1576
  }
1573
1577
  },
1574
1578
  onLock: (e) => {
1575
- n() && je(e);
1579
+ n() && Me(e);
1576
1580
  },
1577
1581
  onUnlock: (e, t, r) => {
1578
- n() && Me(e, t, r);
1582
+ n() && Ne(e, t, r);
1579
1583
  },
1580
1584
  onMembers: (e) => {
1581
- n() && Pe(e);
1585
+ n() && Z(e);
1582
1586
  },
1583
1587
  onConnectionChange: (e) => {
1584
- n() && Ee(t, e);
1588
+ n() && De(t, e);
1585
1589
  }
1586
1590
  };
1587
1591
  }
1588
- function Y(e, r) {
1592
+ function we(e, r) {
1589
1593
  let i = d;
1590
- t.join(e.templateId, { sessionId: n }, Ce(e)).then((t) => {
1591
- e.retired || e !== b ? r || t.leave() : (e.leave = t.leave, Ne(t.locks, !r, i), Pe(t.members), t.members.length > 0 && (m.value = "connected"), t.revision > e.revision && xe(), r && Q());
1592
- }, (e) => P(e));
1594
+ t.join(e.templateId, { sessionId: n }, Y(e)).then((t) => {
1595
+ e.retired || e !== b ? r || t.leave() : (e.leave = t.leave, Pe(t.locks, !r, i), Z(t.members), t.members.length > 0 && (m.value = "connected"), t.revision > e.revision && J(), r && Fe());
1596
+ }, (e) => F(e));
1593
1597
  }
1594
- function we(e) {
1595
- let t = R(e.content), n = {
1598
+ function Te(e, t) {
1599
+ let n = z(e.content), r = {
1596
1600
  templateId: e.id,
1597
- confirmed: t,
1601
+ confirmed: n,
1598
1602
  revision: e.revision ?? 0,
1599
1603
  pending: [],
1600
- view: R(t),
1604
+ view: z(n),
1601
1605
  remote: /* @__PURE__ */ new Map(),
1602
1606
  own: /* @__PURE__ */ new Map(),
1603
1607
  inFlight: null,
@@ -1606,140 +1610,143 @@ function Tt(e) {
1606
1610
  leave: null,
1607
1611
  retired: !1,
1608
1612
  recovering: !1,
1609
- undo: [],
1610
- redo: [],
1613
+ undo: t?.undo ?? [],
1614
+ redo: t?.redo ?? [],
1611
1615
  waiters: []
1612
1616
  };
1613
- b = n, h.value = n.revision, I(), Y(n, !1), _?.state.selectedBlockId && ze(_.state.selectedBlockId), ie();
1617
+ b = r, h.value = r.revision, L(), we(r, !1), _?.state.selectedBlockId && Be(_.state.selectedBlockId), re();
1614
1618
  }
1615
- function Te(e) {
1616
- e.retired = !0, be(e), e.leave?.(), e.leave = null, J(e, /* @__PURE__ */ Error("[Templatical] The template was closed."));
1619
+ function Ee(e) {
1620
+ e.retired = !0, xe(e), e.leave?.(), e.leave = null, me(e, /* @__PURE__ */ Error("[Templatical] The template was closed."));
1617
1621
  }
1618
- function Ee(e, t) {
1622
+ function De(e, t) {
1619
1623
  let n = m.value;
1620
- m.value = t, t === "connected" && n !== null && n !== "connected" && Y(e, !0);
1621
- }
1622
- function De(e) {
1623
- b && b.templateId === e?.id || (b &&= (ae(), Te(b), null), o.value = [], s.value = /* @__PURE__ */ new Map(), m.value = null, A = null, Q(), I(), e && we(e));
1624
+ m.value = t, t === "connected" && n !== null && n !== "connected" && we(e, !0);
1624
1625
  }
1625
1626
  function X(e, t) {
1627
+ b && b.templateId === e?.id || (b &&= (ie(), Ee(b), null), o.value = [], s.value = /* @__PURE__ */ new Map(), m.value = null, A = null, Fe(), L(), e && Te(e, t));
1628
+ }
1629
+ function Oe(e, t) {
1626
1630
  return `${e}\u0000${t ?? ""}`;
1627
1631
  }
1628
- function Oe(e, t, n) {
1632
+ function ke(e, t, n) {
1629
1633
  return e.blockId === t && (n == null || e.locale == null || e.locale === n);
1630
1634
  }
1631
- function ke(e) {
1635
+ function Ae(e) {
1632
1636
  return [...s.value.values()].filter((t) => t.blockId === e);
1633
1637
  }
1634
- function Ae(e) {
1635
- e !== f.value && (H(), f.value = e, ze(_?.state.selectedBlockId ?? null));
1638
+ function je(e) {
1639
+ e !== f.value && (U(), f.value = e, Be(_?.state.selectedBlockId ?? null));
1636
1640
  }
1637
- function je(e, t = !1) {
1641
+ function Me(e, t = !1) {
1638
1642
  if (e.holder.sessionId === n) return;
1639
1643
  t ? c.add(e) : u.set(e, ++d);
1640
1644
  let r = new Map([...s.value].filter(([, t]) => t.holder.sessionId !== e.holder.sessionId));
1641
- r.set(X(e.blockId, e.locale), e), s.value = r, _?.state.selectedBlockId === e.blockId && (f.value === null || e.locale == null || e.locale === f.value) && (_.selectBlock(null), F({
1645
+ r.set(Oe(e.blockId, e.locale), e), s.value = r, _?.state.selectedBlockId === e.blockId && (f.value === null || e.locale == null || e.locale === f.value) && (_.selectBlock(null), I({
1642
1646
  type: "selectionRefused",
1643
1647
  blockId: e.blockId,
1644
1648
  holder: e.holder
1645
1649
  }));
1646
1650
  }
1647
- function Me(e, t, n) {
1648
- let r = X(e, n), i = new Map([...s.value].filter(([n, i]) => i.holder.sessionId !== t || n !== r && !(i.blockId === e && c.has(i))));
1651
+ function Ne(e, t, n) {
1652
+ let r = Oe(e, n), i = new Map([...s.value].filter(([n, i]) => i.holder.sessionId !== t || n !== r && !(i.blockId === e && c.has(i))));
1649
1653
  i.size !== s.value.size && (s.value = i);
1650
1654
  }
1651
- function Ne(e, t, r) {
1655
+ function Pe(e, t, r) {
1652
1656
  let i = new Map([...s.value].filter(([, e]) => !c.has(e) && (t || (u.get(e) ?? 0) > r))), a = [...i.values()];
1653
- for (let t of e) if (t.holder.sessionId !== n && !a.some((e) => e.holder.sessionId === t.holder.sessionId || Oe(e, t.blockId, t.locale))) {
1657
+ for (let t of e) if (t.holder.sessionId !== n && !a.some((e) => e.holder.sessionId === t.holder.sessionId || ke(e, t.blockId, t.locale))) {
1654
1658
  for (let [e, n] of i) n.holder.sessionId === t.holder.sessionId && i.delete(e);
1655
- i.set(X(t.blockId, t.locale), t);
1659
+ i.set(Oe(t.blockId, t.locale), t);
1656
1660
  }
1657
1661
  s.value = i;
1658
1662
  }
1659
- function Pe(e) {
1663
+ function Z(e) {
1660
1664
  let t = new Set(e.map((e) => e.sessionId)), n = new Set(o.value.map((e) => e.sessionId).filter((e) => !t.has(e)));
1661
1665
  if (o.value = e, n.size === 0) return;
1662
1666
  let r = new Map([...s.value].filter(([, e]) => !n.has(e.holder.sessionId)));
1663
1667
  r.size !== s.value.size && (s.value = r);
1664
1668
  }
1665
- function Z(e) {
1666
- ee = ee.then(e).catch(P);
1669
+ function Q(e) {
1670
+ ee = ee.then(e).catch(F);
1667
1671
  }
1668
- function Q() {
1669
- a && Z(async () => {
1672
+ function Fe() {
1673
+ a && Q(async () => {
1670
1674
  if (j && (A === null || j.templateId !== A.templateId || j.locale !== A.locale)) {
1671
1675
  let e = j;
1672
- j = null, Re(), await t.releaseLock(e.templateId, e.blockId, e.locale);
1676
+ j = null, ze(), await t.releaseLock(e.templateId, e.blockId, e.locale);
1673
1677
  }
1674
1678
  let e = A;
1675
1679
  if (!(!e || j?.templateId === e.templateId && j.blockId === e.blockId && j.locale === e.locale)) try {
1676
1680
  let n = await t.acquireLock(e.templateId, e.blockId, e.locale);
1677
- j = e, Le(), Fe(n.blockId, n.locale ?? null);
1681
+ j = e, Re(), Ie(n.blockId, n.locale ?? null);
1678
1682
  } catch (n) {
1679
1683
  if (j?.templateId === e.templateId) {
1680
1684
  let e = j;
1681
- j = null, Re(), await t.releaseLock(e.templateId, e.blockId, e.locale).catch(() => {});
1685
+ j = null, ze(), await t.releaseLock(e.templateId, e.blockId, e.locale).catch(() => {});
1682
1686
  }
1683
1687
  if (A !== e) return;
1684
- Ie(e.blockId, n);
1688
+ Le(e.blockId, n);
1685
1689
  }
1686
1690
  });
1687
1691
  }
1688
- function Fe(e, t) {
1689
- let n = new Map([...s.value].filter(([, n]) => !Oe(n, e, t)));
1692
+ function Ie(e, t) {
1693
+ let n = new Map([...s.value].filter(([, n]) => !ke(n, e, t)));
1690
1694
  n.size !== s.value.size && (s.value = n);
1691
1695
  }
1692
- function Ie(e, t) {
1696
+ function Le(e, t) {
1693
1697
  let n = yt(t);
1694
1698
  if (n === "lock_held" || n === "block_missing") {
1695
1699
  A = null;
1696
1700
  let n = bt(t);
1697
- n ? je({
1701
+ n ? Me({
1698
1702
  blockId: e,
1699
1703
  holder: n,
1700
1704
  expiresAt: ""
1701
1705
  }, !0) : _?.state.selectedBlockId === e && _.selectBlock(null);
1702
- } else P(t), setTimeout(() => {
1703
- A?.blockId === e && Q();
1706
+ } else F(t), setTimeout(() => {
1707
+ A?.blockId === e && Fe();
1704
1708
  }, mt[0]);
1705
1709
  }
1706
- function Le() {
1710
+ function Re() {
1707
1711
  M ||= setInterval(() => {
1708
- Z(async () => {
1712
+ Q(async () => {
1709
1713
  let e = j;
1710
1714
  if (e) try {
1711
1715
  await t.renewLock(e.templateId, e.blockId, e.locale);
1712
1716
  } catch (e) {
1713
1717
  if (yt(e) === "lock_lost") {
1714
- j = null, Re(), Q();
1718
+ j = null, ze(), Fe();
1715
1719
  return;
1716
1720
  }
1717
- P(e);
1721
+ F(e);
1718
1722
  }
1719
1723
  });
1720
1724
  }, pt);
1721
1725
  }
1722
- function Re() {
1726
+ function ze() {
1723
1727
  M &&= (clearInterval(M), null);
1724
1728
  }
1725
- function ze(e) {
1726
- H(), b && (A = e ? {
1729
+ function Be(e) {
1730
+ U(), b && (A = e ? {
1727
1731
  templateId: b.templateId,
1728
1732
  blockId: e,
1729
1733
  locale: f.value
1730
- } : null, Q());
1734
+ } : null, Fe());
1731
1735
  }
1732
- function Be() {
1733
- H(), j && a && (t.releaseLock(j.templateId, j.blockId, j.locale).catch(() => {}), j = null, Re()), b?.leave?.(), b && (b.leave = null);
1736
+ function Ve() {
1737
+ U(), j && a && (t.releaseLock(j.templateId, j.blockId, j.locale).catch(() => {}), j = null, ze()), b?.leave?.(), b && (b.leave = null);
1734
1738
  }
1735
- function Ve(e) {
1739
+ function He() {
1740
+ b && (b.undo = [], b.redo = [], L());
1741
+ }
1742
+ function Ue(e) {
1736
1743
  let t = b;
1737
1744
  if (!t || S) return;
1738
- H();
1745
+ U();
1739
1746
  let n = (e === "undo" ? t.undo : t.redo).pop();
1740
1747
  if (!n) return;
1741
- if (I(), n.view && !B(n.view, t.view)) {
1742
- F({
1748
+ if (L(), n.view && !V(n.view, t.view)) {
1749
+ I({
1743
1750
  type: "undoSkipped",
1744
1751
  code: "precondition_failed"
1745
1752
  });
@@ -1747,41 +1754,41 @@ function Tt(e) {
1747
1754
  }
1748
1755
  let r;
1749
1756
  try {
1750
- r = K(t.view, n.ops, ne());
1757
+ r = K(t.view, n.ops, te());
1751
1758
  } catch (e) {
1752
- if (!(e instanceof V)) throw e;
1753
- F({
1759
+ if (!(e instanceof H)) throw e;
1760
+ I({
1754
1761
  type: "undoSkipped",
1755
1762
  code: e.code
1756
1763
  });
1757
1764
  return;
1758
1765
  }
1759
1766
  let i = vt({ ops: pe(t.view, n.ops) }, r);
1760
- L(e === "undo" ? t.redo : t.undo, i);
1767
+ R(e === "undo" ? t.redo : t.undo, i);
1761
1768
  let a = t.view;
1762
- t.view = r, z(r), _?.markDirty(), ce(t, n.ops, e, i, a);
1769
+ t.view = r, B(r), _?.markDirty(), se(t, n.ops, e, i, a);
1763
1770
  }
1764
- function He(e, t) {
1771
+ function We(e, t) {
1765
1772
  let n = b;
1766
1773
  if (!_ || !n || S) return {
1767
1774
  applied: !1,
1768
- error: new V("invalid_operation", 0, "No template is open for editing.")
1775
+ error: new H("invalid_operation", 0, "No template is open for editing.")
1769
1776
  };
1770
1777
  if (t.origin === void 0) try {
1771
- K(_.content.value, e, ne());
1778
+ K(_.content.value, e, te());
1772
1779
  } catch (e) {
1773
- if (e instanceof V) return {
1780
+ if (e instanceof H) return {
1774
1781
  applied: !1,
1775
1782
  error: e
1776
1783
  };
1777
1784
  throw e;
1778
1785
  }
1779
- H();
1786
+ U();
1780
1787
  let r, i;
1781
1788
  try {
1782
- r = K(n.view, e, ne()), i = pe(n.view, e);
1789
+ r = K(n.view, e, te()), i = pe(n.view, e);
1783
1790
  } catch (e) {
1784
- if (e instanceof V) return {
1791
+ if (e instanceof H) return {
1785
1792
  applied: !1,
1786
1793
  error: e
1787
1794
  };
@@ -1789,91 +1796,101 @@ function Tt(e) {
1789
1796
  }
1790
1797
  let a = n.undo.at(-1), o;
1791
1798
  if (t.origin === "ai" && t.turn !== void 0 && a && a.turn === t.turn) {
1792
- let e = a.view !== void 0 && !B(a.view, n.view);
1799
+ let e = a.view !== void 0 && !V(a.view, n.view);
1793
1800
  a.ops = [...i, ...a.ops], o = e ? a : vt(a, r);
1794
1801
  } else o = vt({
1795
1802
  ops: i,
1796
1803
  ...t.origin === "ai" && t.turn !== void 0 ? { turn: t.turn } : {}
1797
- }, r), L(n.undo, o);
1798
- n.redo = [], I();
1804
+ }, r), R(n.undo, o);
1805
+ n.redo = [], L();
1799
1806
  let s = n.view;
1800
- return n.view = r, z(r), _.markDirty(), ce(n, e, t.origin ?? "edit", o, s), {
1807
+ return n.view = r, B(r), _.markDirty(), se(n, e, t.origin ?? "edit", o, s), {
1801
1808
  applied: !0,
1802
1809
  inverse: i
1803
1810
  };
1804
1811
  }
1805
- function Ue(e) {
1812
+ function Ge(e) {
1806
1813
  _ = e;
1807
- let t = e;
1808
- if (t.moveBlock && t.findBlockLocation) {
1809
- let n = t.moveBlock, r = (...r) => {
1814
+ let t = e.contentReplaced?.value ?? 0, n = e;
1815
+ if (n.moveBlock && n.findBlockLocation) {
1816
+ let t = n.moveBlock, r = (...r) => {
1810
1817
  let i = b, a = i && !S && !C && !e.state.isLoading && e.state.template?.id === i.templateId;
1811
- if (a && oe(!0), n(...r), !a || B(i.view, e.content.value)) return;
1812
- let o = t.findBlockLocation(r[0]);
1818
+ if (a && ae(!0), t(...r), !a || V(i.view, e.content.value)) return;
1819
+ let o = n.findBlockLocation(r[0]);
1813
1820
  if (!o) return;
1814
1821
  let s = o.targetSectionId ? {
1815
1822
  sectionId: o.targetSectionId,
1816
1823
  column: o.columnIndex ?? 0
1817
1824
  } : null, c = s ? e.content.value.blocks.find((e) => e.id === s.sectionId) : void 0, l = s && c?.type === "section" ? c.children[s.column] : e.content.value.blocks;
1818
- se(i, [{
1825
+ oe(i, [{
1819
1826
  op: "moveBlock",
1820
1827
  blockId: r[0],
1821
1828
  parent: s,
1822
1829
  after: l[o.index - 1]?.id ?? null
1823
1830
  }]);
1824
1831
  };
1825
- t.moveBlock = r, k.push(() => {
1826
- t.moveBlock === r && (t.moveBlock = n);
1832
+ n.moveBlock = r, k.push(() => {
1833
+ n.moveBlock === r && (n.moveBlock = t);
1827
1834
  });
1828
1835
  }
1829
- k.push(v(() => e.state.template, (e) => De(e), { immediate: !0 }), v(() => e.content.value, ie, { deep: !0 }), v(() => e.state.selectedBlockId, ze), v(() => e.state.isLoading, (e) => e ? oe(!0, !0) : ie())), typeof window < "u" && (window.addEventListener("pagehide", Be), window.addEventListener("blur", H)), x() && l(qe);
1836
+ k.push(v(() => e.state.template, (t) => {
1837
+ e.loadVersion && e.contentReplaced && e.state.isLoading || X(t);
1838
+ }, { immediate: !0 }), v(() => e.content.value, re, { deep: !0 }), v(() => e.state.selectedBlockId, Be), v(() => e.state.isLoading, (e) => e ? ae(!0, !0) : re()));
1839
+ let r = e.contentReplaced, i = e.loadVersion;
1840
+ r && i && k.push(v(r, He), v(i, () => {
1841
+ let n = r.value !== t;
1842
+ t = r.value;
1843
+ let i = e.state.template;
1844
+ b?.templateId === i?.id ? n && b && i && Ce(b, i) : X(i, !n && b && i ? {
1845
+ undo: b.undo,
1846
+ redo: b.redo
1847
+ } : void 0);
1848
+ })), typeof window < "u" && (window.addEventListener("pagehide", Ve), window.addEventListener("blur", U)), x() && l(Ye);
1830
1849
  }
1831
- function We() {
1832
- H();
1850
+ function Ke() {
1851
+ U();
1833
1852
  let e = b;
1834
1853
  return !e || e.pending.length === 0 ? Promise.resolve() : new Promise((t, n) => e.waiters.push({
1835
1854
  resolve: t,
1836
1855
  reject: n
1837
1856
  }));
1838
1857
  }
1839
- function Ge() {
1840
- H(), S = !0;
1858
+ function qe() {
1859
+ U(), S = !0;
1841
1860
  }
1842
- function Ke() {
1843
- S = !1, b && z(b.view);
1861
+ function Je() {
1862
+ S = !1, b && B(b.view);
1844
1863
  }
1845
- function qe() {
1864
+ function Ye() {
1846
1865
  if (!O) {
1847
- H();
1866
+ U();
1848
1867
  for (let e of k.splice(0)) e();
1849
- ae(), Be(), O = !0, b && Te(b), b = null, Re(), typeof window < "u" && (window.removeEventListener("pagehide", Be), window.removeEventListener("blur", H));
1868
+ ie(), Ve(), O = !0, b && Ee(b), b = null, ze(), typeof window < "u" && (window.removeEventListener("pagehide", Ve), window.removeEventListener("blur", U));
1850
1869
  }
1851
1870
  }
1852
1871
  return {
1853
1872
  sessionId: n,
1854
1873
  members: o,
1855
1874
  locks: s,
1856
- locksOf: ke,
1875
+ locksOf: Ae,
1857
1876
  lockLocale: f,
1858
- setLockLocale: Ae,
1877
+ setLockLocale: je,
1859
1878
  connection: m,
1860
1879
  revision: h,
1861
1880
  canUndo: N,
1862
- canRedo: te,
1863
- attach: Ue,
1864
- undo: () => Ve("undo"),
1865
- redo: () => Ve("redo"),
1866
- clearHistory: () => {
1867
- b && (b.undo = [], b.redo = [], I());
1868
- },
1869
- flush: H,
1870
- settle: We,
1871
- suspend: Ge,
1872
- resume: Ke,
1873
- catchUp: xe,
1881
+ canRedo: P,
1882
+ attach: Ge,
1883
+ undo: () => Ue("undo"),
1884
+ redo: () => Ue("redo"),
1885
+ clearHistory: He,
1886
+ flush: U,
1887
+ settle: Ke,
1888
+ suspend: qe,
1889
+ resume: Je,
1890
+ catchUp: J,
1874
1891
  hasConfirmedBlock: (e) => b ? St(b.confirmed.blocks, e) : !1,
1875
- applyOperations: He,
1876
- destroy: qe
1892
+ applyOperations: We,
1893
+ destroy: Ye
1877
1894
  };
1878
1895
  }
1879
1896
  function Et(e) {
@@ -1989,7 +2006,7 @@ function Ot(e = {}) {
1989
2006
  },
1990
2007
  async create(e) {
1991
2008
  let t = (/* @__PURE__ */ new Date()).toISOString(), n = {
1992
- id: U(),
2009
+ id: ce(),
1993
2010
  name: e.name,
1994
2011
  content: e.content,
1995
2012
  ...e.category ? { category: e.category } : {},
@@ -2055,7 +2072,7 @@ function jt(e = {}) {
2055
2072
  },
2056
2073
  async create(e) {
2057
2074
  let t = await a(e.file), n = (/* @__PURE__ */ new Date()).toISOString(), o = {
2058
- id: U(),
2075
+ id: ce(),
2059
2076
  url: t,
2060
2077
  filename: e.filename || e.file.name,
2061
2078
  createdAt: n,
@@ -2364,7 +2381,7 @@ function Pt(e) {
2364
2381
  }));
2365
2382
  }, { immediate: !0 }), l(s);
2366
2383
  }
2367
- var Ft = J({
2384
+ var Ft = me({
2368
2385
  name: "code",
2369
2386
  size: 24,
2370
2387
  node: [["path", {
@@ -2374,14 +2391,14 @@ var Ft = J({
2374
2391
  d: "m8 6-6 6 6 6",
2375
2392
  key: "ppft3o"
2376
2393
  }]]
2377
- }), It = J({
2394
+ }), It = me({
2378
2395
  name: "navigation",
2379
2396
  size: 24,
2380
2397
  node: [["polygon", {
2381
2398
  points: "3 11 22 2 13 21 11 13 3 11",
2382
2399
  key: "1ltx0t"
2383
2400
  }]]
2384
- }), Lt = J({
2401
+ }), Lt = me({
2385
2402
  name: "share-2",
2386
2403
  size: 24,
2387
2404
  node: [
@@ -2418,7 +2435,7 @@ var Ft = J({
2418
2435
  key: "1n3mei"
2419
2436
  }]
2420
2437
  ]
2421
- }), Rt = J({
2438
+ }), Rt = me({
2422
2439
  name: "table",
2423
2440
  size: 24,
2424
2441
  node: [
@@ -2475,7 +2492,7 @@ function Bt(e) {
2475
2492
  };
2476
2493
  }
2477
2494
  function Vt(e) {
2478
- let n = C(_e, null), r = d(e);
2495
+ let n = C(ve, null), r = d(e);
2479
2496
  if (!n) return r;
2480
2497
  let i;
2481
2498
  function a() {
@@ -2502,14 +2519,14 @@ function Ht(e, t) {
2502
2519
  return typeof n == "string" && n.length > 0 ? n : t;
2503
2520
  }
2504
2521
  function Ut(e, t) {
2505
- return typeof e?.url == "string" && se(e.url, t);
2522
+ return typeof e?.url == "string" && oe(e.url, t);
2506
2523
  }
2507
2524
  function Wt(e, t) {
2508
2525
  let n = e?.url;
2509
- if (typeof n == "string" && n.trim() !== "") return se(n, t) ? void 0 : n;
2526
+ if (typeof n == "string" && n.trim() !== "") return oe(n, t) ? void 0 : n;
2510
2527
  }
2511
2528
  function Gt(e) {
2512
- let t = C(ge, z.liquid), n = Vt(() => Wt(e(), t));
2529
+ let t = C(_e, B.liquid), n = Vt(() => Wt(e(), t));
2513
2530
  return d(() => Ut(e(), t) ? null : n.value);
2514
2531
  }
2515
2532
  function Kt(e, t, n) {
@@ -2586,7 +2603,7 @@ var nn = /* @__PURE__ */ w({
2586
2603
  size: { default: "field" }
2587
2604
  },
2588
2605
  setup(e) {
2589
- let t = e, { t: r } = be(), s = {
2606
+ let t = e, { t: r } = xe(), s = {
2590
2607
  field: {
2591
2608
  gap: "tpl:gap-1.5",
2592
2609
  icon: 18,
@@ -2601,11 +2618,11 @@ var nn = /* @__PURE__ */ w({
2601
2618
  return (t, s) => (i(), m("div", {
2602
2619
  class: a(["tpl:pointer-events-none tpl:absolute tpl:inset-0 tpl:z-10 tpl:flex tpl:flex-col tpl:items-center tpl:justify-center tpl:rounded tpl:border-2 tpl:border-dashed tpl:text-xs tpl:font-medium tpl:border-[var(--tpl-primary)] tpl:text-[var(--tpl-primary)]", c.value.gap]),
2603
2620
  style: o({ backgroundColor: `color-mix(in srgb, var(--tpl-bg) ${c.value.veil}, transparent)` })
2604
- }, [e.uploading ? (i(), m(S, { key: 0 }, [u(f(he), {
2621
+ }, [e.uploading ? (i(), m(S, { key: 0 }, [u(f(ge), {
2605
2622
  class: "tpl-spinner",
2606
2623
  size: c.value.icon,
2607
2624
  "stroke-width": 2
2608
- }, null, 8, ["size"]), h(" " + n(f(r).image.uploading), 1)], 64)) : (i(), m(S, { key: 1 }, [u(f(me), {
2625
+ }, null, 8, ["size"]), h(" " + n(f(r).image.uploading), 1)], 64)) : (i(), m(S, { key: 1 }, [u(f(he), {
2609
2626
  size: c.value.icon,
2610
2627
  "stroke-width": 1.5
2611
2628
  }, null, 8, ["size"]), h(" " + n(f(r).image.dropToUpload), 1)], 64))], 6));
@@ -2621,7 +2638,7 @@ function rn() {
2621
2638
  // src/composables/useImageDrop.ts
2622
2639
  var an = "image/";
2623
2640
  function on(e) {
2624
- let { target: t, onFiles: n, enabled: r } = e, i = () => r === void 0 || b(r), { isOverDropZone: a } = xe(t, {
2641
+ let { target: t, onFiles: n, enabled: r } = e, i = () => r === void 0 || b(r), { isOverDropZone: a } = J(t, {
2625
2642
  preventDefaultForUnhandled: !0,
2626
2643
  onDrop: (e) => {
2627
2644
  if (!i()) return;
@@ -2633,7 +2650,7 @@ function on(e) {
2633
2650
  }
2634
2651
  // src/composables/useMediaDropField.ts
2635
2652
  function sn(e) {
2636
- let { target: t, blocked: n, apply: r } = e, i = C(ve, null), a = C(ye, null), o = rn();
2653
+ let { target: t, blocked: n, apply: r } = e, i = C(ye, null), a = C(be, null), o = rn();
2637
2654
  async function s() {
2638
2655
  let e = await i?.({ accept: ["images"] });
2639
2656
  o.alive && e && r(e);
@@ -2695,7 +2712,7 @@ var ln = "width 300ms cubic-bezier(0.34, 1.56, 0.64, 1)", un = {
2695
2712
  ]
2696
2713
  };
2697
2714
  function dn(e, t) {
2698
- let n = (e) => Math.trunc(e ?? 0), r = (e) => H(e) === null ? 0 : Math.trunc(e.width);
2715
+ let n = (e) => Math.trunc(e ?? 0), r = (e) => U(e) === null ? 0 : Math.trunc(e.width);
2699
2716
  return n(e?.left) + n(e?.right) + r(t?.left) + r(t?.right);
2700
2717
  }
2701
2718
  function fn(e, t) {
@@ -2714,7 +2731,7 @@ function* mn(e, t) {
2714
2731
  function hn(e, t, n = W(e)) {
2715
2732
  if (!t) return e;
2716
2733
  try {
2717
- return ne(le(t, n, { missing: "default" }), e);
2734
+ return te(le(t, n, { missing: "default" }), e);
2718
2735
  } catch {
2719
2736
  return e;
2720
2737
  }
@@ -2722,7 +2739,7 @@ function hn(e, t, n = W(e)) {
2722
2739
  function gn(e, t, n, r) {
2723
2740
  let i = hn(e, n, r);
2724
2741
  for (let { block: e, bandWidth: n } of mn(i.blocks, i.settings.width)) if (k(e)) {
2725
- let r = L(e)?.applied ? void 0 : e.border, i = Math.floor(n) - dn(e.styles.padding, r), a = un[e.columns] ?? [100];
2742
+ let r = R(e)?.applied ? void 0 : e.border, i = Math.floor(n) - dn(e.styles.padding, r), a = un[e.columns] ?? [100];
2726
2743
  for (let n = 0; n < e.children.length; n++) {
2727
2744
  let r = Math.floor(i * (a[n] ?? 100) / 100), o = e.children[n].find((e) => e.id === t);
2728
2745
  if (o) return pn(o, r);
@@ -2736,14 +2753,14 @@ function _n(e, t, n, r) {
2736
2753
  return null;
2737
2754
  }
2738
2755
  function vn(e) {
2739
- let t = k(e) ? L(e) : null;
2756
+ let t = k(e) ? R(e) : null;
2740
2757
  return !!t?.applied && t.height === "image";
2741
2758
  }
2742
2759
  function yn(e, t, n, r) {
2743
2760
  if (vn(e)) return (t ? _n(t, e.id, n, r) : null) ?? cn(t?.settings);
2744
2761
  }
2745
2762
  // src/constants/socialIcons.ts
2746
- var bn = ae, xn = {
2763
+ var bn = ie, xn = {
2747
2764
  small: 24,
2748
2765
  medium: 32,
2749
2766
  large: 48