@templatical/editor 0.58.0 → 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 (202) 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-CymzjJYe.js → src-BXrhjqCv.js} +2 -2
  150. package/dist/cdn/chunks/{src-CymzjJYe.js.map → src-BXrhjqCv.js.map} +1 -1
  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 +7 -7
  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/styleConstants-CgiNKdnc.js.map +0 -1
@@ -1,12 +1,12 @@
1
1
  import { $ as e, C as t, F as n, H as r, M as i, O as a, Q as o, X as s, Y as c, _ as l, at as u, b as d, ct as f, dt as p, et as m, lt as h, mt as g, ot as _, p as v, pt as y, q as b, rt as x, tt as S, u as C, x as w } from "./draggable-IRVFEZ-b.js";
2
- import { $t as T, Bt as E, Cn as D, Ft as O, Gt as k, H as ee, Ht as A, I as j, It as te, Kt as M, Lt as N, Nt as ne, Pt as P, Qt as F, Rt as re, Ut as I, W as L, Wt as ie, Xt as R, Yt as ae, Zt as oe, an as se, dn as z, en as B, ft as V, h as ce, in as H, jt as le, m as U, nn as W, p as ue, rn as G, tn as de, v as fe, wt as pe, y as me, zt as he } from "./src-CVHGPKSW.js";
3
- import { at as K, s as ge } from "./icons-C7vjUBLn.js";
4
- import { B as _e, C as ve, W as ye, u as be } from "./keys-BQqbBUag.js";
5
- import { t as xe } from "./useI18n-CSf-ZpcM.js";
6
- import { r as Se } from "./dist-zu1jwYIS.js";
7
- import { i as q, r as Ce } from "./usePopoverPosition-BJFFi8x6.js";
2
+ import { $t as T, Bt as E, Cn as D, Ft as O, Gt as k, H as A, Ht as j, I as M, It as ee, Kt as te, Lt as N, Nt as P, Pt as F, Qt as I, Rt as ne, Ut as L, W as R, Wt as z, Xt as B, Yt as re, Zt as V, an as ie, dn as ae, en as H, ft as U, h as oe, in as W, jt as se, m as G, nn as K, p as ce, rn as q, tn as le, v as ue, wt as de, y as fe, zt as pe } from "./src-CVHGPKSW.js";
3
+ import { at as me, s as he } from "./icons-C7vjUBLn.js";
4
+ import { B as ge, C as _e, W as ve, u as ye } from "./keys-DNv3xXxI.js";
5
+ import { t as be } from "./useI18n-JsIdvX-i.js";
6
+ import { r as xe } from "./dist-zu1jwYIS.js";
7
+ import { i as J, r as Se } from "./usePopoverPosition-DWRQRT2P.js";
8
8
  // ../core/src/localized-edit.ts
9
- var J = (e) => typeof e == "object" && !!e && !Array.isArray(e), Y = (e) => Array.isArray(e) && e.length > 0 && e.every((e) => J(e) && typeof e.id == "string"), we = /* @__PURE__ */ new Set([
9
+ var Y = (e) => typeof e == "object" && !!e && !Array.isArray(e), Ce = (e) => Array.isArray(e) && e.length > 0 && e.every((e) => Y(e) && typeof e.id == "string"), we = /* @__PURE__ */ new Set([
10
10
  "id",
11
11
  "type",
12
12
  "children",
@@ -17,48 +17,48 @@ var J = (e) => typeof e == "object" && !!e && !Array.isArray(e), Y = (e) => Arra
17
17
  function Te(e, t, n) {
18
18
  let r = /* @__PURE__ */ new Set();
19
19
  for (let i of n) {
20
- if (!ie(i)) continue;
21
- let n = i.split("."), a = n.pop(), o = n.join("."), s = F(e, i), c = t;
20
+ if (!z(i)) continue;
21
+ let n = i.split("."), a = n.pop(), o = n.join("."), s = I(e, i), c = t;
22
22
  for (let [t, i] of n.entries()) {
23
23
  let a = n.slice(0, t + 1).join(".");
24
- s !== void 0 && J(c) && F(c, i) === void 0 && J(F(e, a)) && (c[i] = {}, r.add(a)), c = F(c, i);
24
+ s !== void 0 && Y(c) && I(c, i) === void 0 && Y(I(e, a)) && (c[i] = {}, r.add(a)), c = I(c, i);
25
25
  }
26
26
  if (Array.isArray(c)) {
27
- let e = c.findIndex((e) => J(e) && e.id === a);
27
+ let e = c.findIndex((e) => Y(e) && e.id === a);
28
28
  if (e < 0) continue;
29
- s === void 0 ? c.splice(e, 1) : c[e] = H(s);
30
- } else J(c) && (s === void 0 ? delete c[a] : c[a] = H(s), o && Object.keys(c).length === 0 && F(e, o) === void 0 && Te(e, t, [o]));
29
+ s === void 0 ? c.splice(e, 1) : c[e] = W(s);
30
+ } else Y(c) && (s === void 0 ? delete c[a] : c[a] = W(s), o && Object.keys(c).length === 0 && I(e, o) === void 0 && Te(e, t, [o]));
31
31
  }
32
32
  return r;
33
33
  }
34
- function X(e, t, n, r, i = !0, a = /* @__PURE__ */ new Set()) {
35
- if (J(e) && J(t) && !a.has(n)) for (let o of /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)])) (n || !we.has(o)) && X(e[o], t[o], n ? `${n}.${o}` : o, r, i, a);
36
- else if (i && Y(e) && Y(t)) for (let o of t) {
34
+ function Ee(e, t, n, r, i = !0, a = /* @__PURE__ */ new Set()) {
35
+ if (Y(e) && Y(t) && !a.has(n)) for (let o of /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)])) (n || !we.has(o)) && Ee(e[o], t[o], n ? `${n}.${o}` : o, r, i, a);
36
+ else if (i && Ce(e) && Ce(t)) for (let o of t) {
37
37
  if (o.id.includes(".")) continue;
38
38
  let t = e.find((e) => e.id === o.id);
39
- t && X(t, o, `${n}.${o.id}`, r, i, a);
39
+ t && Ee(t, o, `${n}.${o.id}`, r, i, a);
40
40
  }
41
- else G(e, t) || r.set(n, t);
41
+ else q(e, t) || r.set(n, t);
42
42
  }
43
- function Ee(e, t, n, r = [], i = /* @__PURE__ */ new Set()) {
43
+ function De(e, t, n, r = [], i = /* @__PURE__ */ new Set()) {
44
44
  let a = /* @__PURE__ */ new Map();
45
- X(e, t, "", a, e.type !== "custom", i);
46
- let o = new Set(e.type === "custom" ? de(e, r) : []), s = {}, c = {};
47
- for (let [t, r] of a) if ((e.type === "custom" ? o.has(t) : M(e.type, t)) && typeof r == "string" && F(e, t) !== void 0) {
45
+ Ee(e, t, "", a, e.type !== "custom", i);
46
+ let o = new Set(e.type === "custom" ? le(e, r) : []), s = {}, c = {};
47
+ for (let [t, r] of a) if ((e.type === "custom" ? o.has(t) : te(e.type, t)) && typeof r == "string" && I(e, t) !== void 0) {
48
48
  let i = n?.text?.[t];
49
49
  s[t] = i && i.value === r ? i : {
50
50
  value: r,
51
- sourceHash: B(String(F(e, t) ?? ""))
51
+ sourceHash: H(String(I(e, t) ?? ""))
52
52
  };
53
53
  } else c[t] = r === void 0 ? null : r;
54
54
  let l = {};
55
55
  return Object.keys(s).length && (l.text = s), Object.keys(c).length && (l.set = c), n?.hidden && (l.hidden = !0), l;
56
56
  }
57
- function De(e, t, n) {
57
+ function Oe(e, t, n) {
58
58
  let r = !1;
59
59
  function i(e, t, n, a) {
60
- let o = e[n], s = t[n], c = (e) => Array.isArray(e) && e.every((e) => J(e) && typeof e.id == "string");
61
- 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) => H(o.find((t) => t.id === e.id) ?? e))), a)) for (let t of s) {
60
+ let o = e[n], s = t[n], c = (e) => Array.isArray(e) && e.every((e) => Y(e) && typeof e.id == "string");
61
+ 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) => W(o.find((t) => t.id === e.id) ?? e))), a)) for (let t of s) {
62
62
  let r = e[n].find((e) => e.id === t.id);
63
63
  r && i(r, t, a);
64
64
  }
@@ -66,48 +66,48 @@ function De(e, t, n) {
66
66
  let a = e, o = t;
67
67
  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") {
68
68
  let i = (e) => e.map((e) => e.map((e) => e.id));
69
- (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) => H(n(e.id) ?? e))));
69
+ (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) => W(n(e.id) ?? e))));
70
70
  }
71
71
  return r;
72
72
  }
73
- function Oe(e, t, n) {
73
+ function ke(e, t, n) {
74
74
  let r = (e) => {
75
75
  let { locale: t, locales: n, l10n: r, ...i } = e;
76
76
  return i;
77
77
  }, i = /* @__PURE__ */ new Map();
78
- X(r(e), r(t), "", i);
78
+ Ee(r(e), r(t), "", i);
79
79
  let a = {};
80
- for (let [t, r] of i) if (E.includes(t) && typeof r == "string" && F(e, t) !== void 0) {
80
+ for (let [t, r] of i) if (E.includes(t) && typeof r == "string" && I(e, t) !== void 0) {
81
81
  let i = n?.text?.[t];
82
82
  (a.text ??= {})[t] = i?.value === r ? i : {
83
83
  value: r,
84
- sourceHash: B(String(F(e, t) ?? ""))
84
+ sourceHash: H(String(I(e, t) ?? ""))
85
85
  };
86
86
  } else (a.set ??= {})[t] = r === void 0 ? null : r;
87
87
  return a;
88
88
  }
89
- function ke(e, t, n, r, i, a = []) {
90
- let o = H(e ?? {}), s = [.../* @__PURE__ */ new Set([...a, ...[.../* @__PURE__ */ new Set([
89
+ function Ae(e, t, n, r, i, a = []) {
90
+ let o = W(e ?? {}), s = [.../* @__PURE__ */ new Set([...a, ...[.../* @__PURE__ */ new Set([
91
91
  ...Object.keys(t.text ?? {}),
92
92
  ...Object.keys(t.set ?? {}),
93
93
  ...Object.keys(n.text ?? {}),
94
94
  ...Object.keys(n.set ?? {})
95
- ])].filter((e) => !G(t.text?.[e], n.text?.[e]) || !G(t.set?.[e], n.set?.[e]))])], c = Object.keys(e?.set ?? {}).filter((e) => s.some((t) => t.startsWith(`${e}.`)));
95
+ ])].filter((e) => !q(t.text?.[e], n.text?.[e]) || !q(t.set?.[e], n.set?.[e]))])], c = Object.keys(e?.set ?? {}).filter((e) => s.some((t) => t.startsWith(`${e}.`)));
96
96
  for (let e of c) {
97
- let t = F(i, e), n = s.filter((t) => t.startsWith(`${e}.`) && G(F(r, t), F(i, t)));
98
- if (G(t, F(r, e))) delete o.set[e];
99
- else if (n.length && J(F(r, e)) && J(t)) {
97
+ let t = I(i, e), n = s.filter((t) => t.startsWith(`${e}.`) && q(I(r, t), I(i, t)));
98
+ if (q(t, I(r, e))) delete o.set[e];
99
+ else if (n.length && Y(I(r, e)) && Y(t)) {
100
100
  delete o.set[e];
101
101
  let i = (e, t, a) => {
102
102
  if (!n.some((t) => e === t || e.startsWith(`${t}.`))) {
103
- if (J(t) && J(a)) for (let n of /* @__PURE__ */ new Set([...Object.keys(t), ...Object.keys(a)])) i(`${e}.${n}`, t[n], a[n]);
104
- else if (J(r) && r.type !== "custom" && Y(t) && Y(a)) for (let n of a) i(`${e}.${n.id}`, t.find((e) => e.id === n.id), n);
105
- else J(r) && typeof r.type == "string" && k(r, e, a) || o.text?.[e] && o.text[e].value === a || ((o.set ??= {})[e] = a === void 0 ? null : H(a));
103
+ 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]);
104
+ else if (Y(r) && r.type !== "custom" && Ce(t) && Ce(a)) for (let n of a) i(`${e}.${n.id}`, t.find((e) => e.id === n.id), n);
105
+ else Y(r) && typeof r.type == "string" && k(r, e, a) || o.text?.[e] && o.text[e].value === a || ((o.set ??= {})[e] = a === void 0 ? null : W(a));
106
106
  }
107
107
  };
108
- i(e, F(r, e), t);
109
- } else o.set[e] = t === void 0 ? null : H(t);
110
- for (let t of ["text", "set"]) for (let n of Object.keys(o[t] ?? {})) n.startsWith(`${e}.`) && (G(t === "text" ? o.text[n].value : o.set[n] ?? void 0, F(i, n)) || delete o[t][n]);
108
+ i(e, I(r, e), t);
109
+ } else o.set[e] = t === void 0 ? null : W(t);
110
+ for (let t of ["text", "set"]) for (let n of Object.keys(o[t] ?? {})) n.startsWith(`${e}.`) && (q(t === "text" ? o.text[n].value : o.set[n] ?? void 0, I(i, n)) || delete o[t][n]);
111
111
  }
112
112
  for (let e of s) if (!c.includes(e)) {
113
113
  for (let t of ["text", "set"]) for (let n of Object.keys(o[t] ?? {})) (n === e || n.startsWith(`${e}.`)) && delete o[t][n];
@@ -116,7 +116,7 @@ function ke(e, t, n, r, i, a = []) {
116
116
  return o.text && !Object.keys(o.text).length && delete o.text, o.set && !Object.keys(o.set).length && delete o.set, o;
117
117
  }
118
118
  // ../core/src/mutation-guard.ts
119
- function Ae(e) {
119
+ function je(e) {
120
120
  return [
121
121
  "addBlock",
122
122
  "removeBlock",
@@ -124,7 +124,7 @@ function Ae(e) {
124
124
  "duplicateBlock"
125
125
  ].includes(e);
126
126
  }
127
- function je(e, t, n) {
127
+ function Me(e, t, n) {
128
128
  if (e.canEdit && !e.canEdit()) return !1;
129
129
  let r = t === "addBlock", i = t === "duplicateBlock", a = typeof n[0] == "string" ? n[0] : n[0].id, o = r ? n[0] : e.findBlock?.(a);
130
130
  if (!r && e.findBlock && !o) return !1;
@@ -135,7 +135,7 @@ function je(e, t, n) {
135
135
  ...e.content(),
136
136
  blocks: [o]
137
137
  };
138
- U(t), ce(t);
138
+ G(t), oe(t);
139
139
  }
140
140
  if (t === "removeBlock") return !0;
141
141
  let c = i && n[1] === void 0 && n[2] === void 0, l = c ? s?.targetSectionId : n[t === "moveBlock" ? 2 : 1], u = (c ? s?.columnIndex : n[t === "moveBlock" ? 3 : 2]) ?? 0;
@@ -143,24 +143,24 @@ function je(e, t, n) {
143
143
  if (e.isBlockLocked(l, !0) || o?.type === "section") return !1;
144
144
  if (e.findBlock) {
145
145
  let t = e.findBlock(l);
146
- if (t?.type !== "section" || u < 0 || u >= he(t.columns)) return !1;
146
+ if (t?.type !== "section" || u < 0 || u >= pe(t.columns)) return !1;
147
147
  }
148
148
  }
149
149
  return t !== "moveBlock" || s?.targetSectionId !== l || (s?.columnIndex ?? 0) !== u || s?.index !== n[1];
150
150
  }
151
- var Me = /* @__PURE__ */ new WeakMap();
151
+ var X = /* @__PURE__ */ new WeakMap();
152
152
  function Ne(e, t) {
153
- Me.set(e, t);
154
- for (let n of Object.values(e)) typeof n == "function" && Me.set(n, t);
153
+ X.set(e, t);
154
+ for (let n of Object.values(e)) typeof n == "function" && X.set(n, t);
155
155
  }
156
- function Z(e, t) {
157
- let n = Me.get(e);
158
- n && Me.set(t, n);
156
+ function Pe(e, t) {
157
+ let n = X.get(e);
158
+ n && X.set(t, n);
159
159
  }
160
- function Q(e, t, n) {
161
- let r = Reflect.get(e, t), i = Me.get(e) ?? (typeof r == "function" ? Me.get(r) : void 0);
160
+ function Z(e, t, n) {
161
+ let r = Reflect.get(e, t), i = X.get(e) ?? (typeof r == "function" ? X.get(r) : void 0);
162
162
  if (i) return i(t, n);
163
- if (!Ae(t)) return !0;
163
+ if (!je(t)) return !0;
164
164
  let a = Reflect.get(e, "isBlockLocked");
165
165
  if (typeof a != "function") return !0;
166
166
  let o = { isBlockLocked: (t, n) => a.call(e, t, n) }, c = Reflect.get(e, "content");
@@ -173,23 +173,23 @@ function Q(e, t, n) {
173
173
  let n = Reflect.get(e, t);
174
174
  typeof n == "function" && (o[t] = n.bind(e));
175
175
  }
176
- return je(o, t, n);
176
+ return Me(o, t, n);
177
177
  }
178
178
  // ../core/src/error-reporting.ts
179
- function Pe(e) {
179
+ function Fe(e) {
180
180
  return e instanceof Error ? e : Error(String(e), { cause: e });
181
181
  }
182
- function Fe(e, t) {
182
+ function Q(e, t) {
183
183
  try {
184
184
  t();
185
185
  } catch (t) {
186
- e?.(Pe(t));
186
+ e?.(Fe(t));
187
187
  }
188
188
  }
189
189
  // ../core/src/editor.ts
190
190
  function Ie(t) {
191
- let n = t.content ?? V(t.defaultFontFamily, t.templateDefaults);
192
- U(n), ce(n);
191
+ let n = t.content ?? U(t.defaultFontFamily, t.templateDefaults);
192
+ G(n), oe(n);
193
193
  let r = e({
194
194
  template: null,
195
195
  content: n,
@@ -204,11 +204,11 @@ function Ie(t) {
204
204
  uiTheme: "auto"
205
205
  }), i = u(r, "activeLocale"), a = [];
206
206
  function o(e) {
207
- let t = A(r.content);
208
- if (e === t && (e = null), e !== null && !r.content.settings.locales?.includes(e)) throw new W(`This template has no "${e}" version.`, void 0, "unknown_locale");
207
+ let t = j(r.content);
208
+ if (e === t && (e = null), e !== null && !r.content.settings.locales?.includes(e)) throw new K(`This template has no "${e}" version.`, void 0, "unknown_locale");
209
209
  i.value = e;
210
210
  }
211
- h(() => i.value ?? A(r.content), (e) => Fe(t.onError, () => t.onLocaleChange?.(e))), h(() => r.content.settings.locales?.includes(i.value ?? ""), () => {
211
+ h(() => i.value ?? j(r.content), (e) => Q(t.onError, () => t.onLocaleChange?.(e))), h(() => r.content.settings.locales?.includes(i.value ?? ""), () => {
212
212
  i.value && !r.content.settings.locales?.includes(i.value) && o(null);
213
213
  });
214
214
  function s() {
@@ -218,20 +218,20 @@ function Ie(t) {
218
218
  a = e;
219
219
  }
220
220
  function l(e) {
221
- return re(r.content, e, a);
221
+ return ne(r.content, e, a);
222
222
  }
223
223
  function d(e, n) {
224
224
  if (!s()) return null;
225
- if (e === "addLocale" && (!I(n) || t.localization && !t.localization.locales.includes(n))) throw new W(`Locale "${n}" is not enabled.`, void 0, "unknown_locale");
226
- let i = H(r.content);
227
- return te(i, [{
225
+ if (e === "addLocale" && (!L(n) || t.localization && !t.localization.locales.includes(n))) throw new K(`Locale "${n}" is not enabled.`, void 0, "unknown_locale");
226
+ let i = W(r.content);
227
+ return ee(i, [{
228
228
  op: e,
229
229
  locale: n
230
- }]), G(i, r.content) ? null : i;
230
+ }]), q(i, r.content) ? null : i;
231
231
  }
232
232
  function f(e, t) {
233
233
  let n = d(e, t);
234
- n && (r.content = n, k());
234
+ n && (r.content = n, A());
235
235
  }
236
236
  function p(e) {
237
237
  f("addLocale", e);
@@ -248,24 +248,24 @@ function Ie(t) {
248
248
  }
249
249
  function v(e, t) {
250
250
  let [n, o] = t;
251
- if (!i.value || !s() || P(n)) return null;
252
- let c = M(r.content.blocks, n);
251
+ if (!i.value || !s() || R(n)) return null;
252
+ let c = P(r.content.blocks, n);
253
253
  if (!c) return null;
254
- let l = c.l10n?.[i.value], u = ae(c, i.value, A(r.content)), d = Ee(c, u, l, a), f = e === "resetLocaleFields" && Array.isArray(o) ? Te(c, u, o) : void 0, p = e === "resetLocaleFields" ? ke(l, d, Ee(c, u, l, a, f), c, u, Array.isArray(o) ? o : []) : H(l ?? {});
254
+ let l = c.l10n?.[i.value], u = re(c, i.value, j(r.content)), d = De(c, u, l, a), f = e === "resetLocaleFields" && Array.isArray(o) ? Te(c, u, o) : void 0, p = e === "resetLocaleFields" ? Ae(l, d, De(c, u, l, a, f), c, u, Array.isArray(o) ? o : []) : W(l ?? {});
255
255
  if (e === "setBlockHidden") o ? p.hidden = !0 : delete p.hidden;
256
256
  else if (e === "resetLocaleFields") o || (delete p.text, delete p.set, delete p.hidden);
257
257
  else for (let e of o) {
258
258
  let t = p.text?.[e];
259
- t && (t.sourceHash = B(String(F(c, e) ?? "")));
259
+ t && (t.sourceHash = H(String(I(c, e) ?? "")));
260
260
  }
261
- return p.text && !Object.keys(p.text).length && delete p.text, p.set && !Object.keys(p.set).length && delete p.set, G(l ?? {}, p) ? null : {
261
+ return p.text && !Object.keys(p.text).length && delete p.text, p.set && !Object.keys(p.set).length && delete p.set, q(l ?? {}, p) ? null : {
262
262
  block: c,
263
263
  layer: p
264
264
  };
265
265
  }
266
266
  function y(e, t) {
267
267
  let n = v(e, t);
268
- n && (_(n.block, n.layer), k());
268
+ n && (_(n.block, n.layer), A());
269
269
  }
270
270
  function x(e, t) {
271
271
  y("setBlockHidden", [e, t]);
@@ -276,32 +276,32 @@ function Ie(t) {
276
276
  function w(e, t) {
277
277
  y("keepTranslations", [e, t]);
278
278
  }
279
- let E = S(0), D = 0, O = 0;
280
- function k() {
281
- r.isDirty = !0, O++;
279
+ let E = S(0), D = S(0), O = 0, k = 0;
280
+ function A() {
281
+ r.isDirty = !0, k++;
282
282
  }
283
- let ee = b({
283
+ let M = b({
284
284
  get: () => r.content,
285
285
  set: (e) => {
286
- r.content = e, k();
286
+ r.content = e, A();
287
287
  }
288
- }), j = b(() => r.selectedBlockId ? M(r.content.blocks, r.selectedBlockId) : null);
289
- function M(e, t) {
288
+ }), te = b(() => r.selectedBlockId ? P(r.content.blocks, r.selectedBlockId) : null);
289
+ function P(e, t) {
290
290
  for (let n of e) {
291
291
  if (n.id === t) return n;
292
292
  if (n.type === "section") for (let e of n.children) {
293
- let n = M(e, t);
293
+ let n = P(e, t);
294
294
  if (n) return n;
295
295
  }
296
296
  }
297
297
  return null;
298
298
  }
299
- function ne(e, t, n = { blocks: e }) {
299
+ function F(e, t, n = { blocks: e }) {
300
300
  for (let r = 0; r < e.length; r++) {
301
301
  let i = e[r];
302
302
  if (i.id === t) return n;
303
303
  if (i.type === "section") for (let e = 0; e < i.children.length; e++) {
304
- let n = ne(i.children[e], t, {
304
+ let n = F(i.children[e], t, {
305
305
  blocks: i.children[e],
306
306
  sectionId: i.id,
307
307
  columnIndex: e
@@ -311,7 +311,7 @@ function Ie(t) {
311
311
  }
312
312
  return null;
313
313
  }
314
- function P(e, n = !1) {
314
+ function R(e, n = !1) {
315
315
  let r = i.value ?? t.lockLocale?.value ?? null;
316
316
  for (let [i, a] of t.lockedBlocks?.value ?? []) {
317
317
  let o = a;
@@ -321,8 +321,8 @@ function Ie(t) {
321
321
  }
322
322
  return !1;
323
323
  }
324
- function L(e) {
325
- let t = ne(r.content.blocks, e);
324
+ function z(e) {
325
+ let t = F(r.content.blocks, e);
326
326
  if (!t) return null;
327
327
  let n = t.blocks.findIndex((t) => t.id === e);
328
328
  return n === -1 ? null : {
@@ -332,36 +332,36 @@ function Ie(t) {
332
332
  };
333
333
  }
334
334
  function ie(e, t = !0) {
335
- U(e), ce(e), r.content = e, t && k();
335
+ G(e), oe(e), r.content = e, t && A();
336
336
  }
337
- function se(e) {
338
- e && P(e) || (r.selectedBlockId = e);
337
+ function ae(e) {
338
+ e && R(e) || (r.selectedBlockId = e);
339
339
  }
340
- function z(e) {
340
+ function se(e) {
341
341
  r.viewport = e;
342
342
  }
343
- function le(e) {
343
+ function ce(e) {
344
344
  r.darkMode = e;
345
345
  }
346
- function ue(e) {
346
+ function le(e) {
347
347
  r.uiTheme = e;
348
348
  }
349
- function de(e) {
349
+ function ue(e) {
350
350
  r.previewMode = e, e && (r.selectedBlockId = null);
351
351
  }
352
- function fe(e, t) {
352
+ function de(e, t) {
353
353
  if (!s()) return !1;
354
- let n = M(r.content.blocks, e);
354
+ let n = P(r.content.blocks, e);
355
355
  if (!n) return !1;
356
- if ("l10n" in t) throw new W("l10n is immutable in updateBlock.", void 0, "invalid_operation");
356
+ if ("l10n" in t) throw new K("l10n is immutable in updateBlock.", void 0, "invalid_operation");
357
357
  let a = {
358
358
  ...n,
359
359
  ...t
360
- }, o = H(n), c = De(o, a, (e) => M(r.content.blocks, e)), l = "children" in t, u = c || l || a.type !== n.type;
360
+ }, o = W(n), c = Oe(o, a, (e) => P(r.content.blocks, e)), l = "children" in t, u = c || l || a.type !== n.type;
361
361
  if (l && a.type === "section" && Array.isArray(a.children)) {
362
362
  let e = new Set(N(n).slice(1)), t = /* @__PURE__ */ new Set();
363
363
  for (let n of a.children) for (let i of n) for (let n of N(i)) {
364
- if (t.has(n) || P(n, !0) || M(r.content.blocks, n) !== null && !e.has(n)) return !1;
364
+ if (t.has(n) || R(n, !0) || P(r.content.blocks, n) !== null && !e.has(n)) return !1;
365
365
  t.add(n);
366
366
  }
367
367
  if (i.value) {
@@ -369,41 +369,41 @@ function Ie(t) {
369
369
  if (new Set(e).size !== e.length) return !1;
370
370
  }
371
371
  }
372
- return !P(e, u || "columns" in t) && (!u || !N(n).some((t) => t !== e && P(t, !0)));
372
+ return !R(e, u || "columns" in t) && (!u || !N(n).some((t) => t !== e && R(t, !0)));
373
373
  }
374
- function pe(e, n) {
375
- if (!fe(e, n)) return;
376
- let o = M(r.content.blocks, e);
374
+ function fe(e, n) {
375
+ if (!de(e, n)) return;
376
+ let o = P(r.content.blocks, e);
377
377
  if (!o) return;
378
378
  let s = i.value;
379
379
  if (s) {
380
- let i = ae(o, s, A(r.content)), c = {
380
+ let i = re(o, s, j(r.content)), c = {
381
381
  ...i,
382
382
  ...n
383
- }, l = H(o), u = De(l, c, (e) => M(r.content.blocks, e));
384
- if (P(e, u)) return;
383
+ }, l = W(o), u = Oe(l, c, (e) => P(r.content.blocks, e));
384
+ if (R(e, u)) return;
385
385
  u && t.onStructureChange?.();
386
- let d = R(l);
387
- delete o.l10n, Object.assign(o, d), _(o, ke(o.l10n?.[s], Ee(o, i, o.l10n?.[s], a), Ee(o, c, o.l10n?.[s], a), o, c));
386
+ let d = B(l);
387
+ delete o.l10n, Object.assign(o, d), _(o, Ae(o.l10n?.[s], De(o, i, o.l10n?.[s], a), De(o, c, o.l10n?.[s], a), o, c));
388
388
  } else {
389
- if (P(e, "children" in n || "columns" in n)) return;
390
- let t = R({
389
+ if (R(e, "children" in n || "columns" in n)) return;
390
+ let t = B({
391
391
  ...o,
392
392
  ...n
393
393
  });
394
394
  delete o.l10n, Object.assign(o, t);
395
395
  }
396
- k();
396
+ A();
397
397
  }
398
- function me(e) {
399
- if ("locales" in e || "l10n" in e) throw new W("locales and l10n are immutable in updateSettings.", void 0, "invalid_operation");
400
- if ("locale" in e && e.locale !== A(r.content) && r.content.settings.locales?.length) throw new W("The default locale can't change while language versions exist.", void 0, "invalid_operation");
398
+ function pe(e) {
399
+ if ("locales" in e || "l10n" in e) throw new K("locales and l10n are immutable in updateSettings.", void 0, "invalid_operation");
400
+ if ("locale" in e && e.locale !== j(r.content) && r.content.settings.locales?.length) throw new K("The default locale can't change while language versions exist.", void 0, "invalid_operation");
401
401
  }
402
- function he(e) {
402
+ function me(e) {
403
403
  if (!s()) return;
404
- me(e);
404
+ pe(e);
405
405
  let t = i.value;
406
- if (!t) r.content.settings = oe({
406
+ if (!t) r.content.settings = V({
407
407
  ...r.content.settings,
408
408
  ...e
409
409
  });
@@ -412,118 +412,118 @@ function Ie(t) {
412
412
  ...i,
413
413
  locale: n.locale,
414
414
  ...e
415
- }, o = n.l10n?.[t], s = ke(o, Oe(n, i, o), Oe(n, a, o), n, a);
415
+ }, o = n.l10n?.[t], s = Ae(o, ke(n, i, o), ke(n, a, o), n, a);
416
416
  Object.keys(s).length ? n.l10n = {
417
417
  ...n.l10n,
418
418
  [t]: s
419
419
  } : n.l10n && (delete n.l10n[t], Object.keys(n.l10n).length || delete n.l10n);
420
420
  }
421
- k();
421
+ A();
422
422
  }
423
- let K = {
423
+ let he = {
424
424
  canEdit: s,
425
425
  content: () => r.content,
426
- findBlock: (e) => M(r.content.blocks, e),
427
- findBlockLocation: L,
428
- isBlockLocked: P
426
+ findBlock: (e) => P(r.content.blocks, e),
427
+ findBlockLocation: z,
428
+ isBlockLocked: R
429
429
  };
430
430
  function ge(e, n, a = 0, o) {
431
- if (je(K, "addBlock", [
431
+ if (Me(he, "addBlock", [
432
432
  e,
433
433
  n,
434
434
  a,
435
435
  o
436
436
  ])) {
437
437
  if (n) {
438
- let t = M(r.content.blocks, n);
438
+ let t = P(r.content.blocks, n);
439
439
  if (t && t.type === "section") {
440
440
  t.children[a] = t.children[a] || [];
441
441
  let n = t.children[a];
442
442
  o !== void 0 && o < n.length ? n.splice(o, 0, e) : n.push(e);
443
443
  }
444
444
  } else o !== void 0 && o < r.content.blocks.length ? r.content.blocks.splice(o, 0, e) : r.content.blocks.push(e);
445
- i.value && t.onStructureChange?.(), k();
445
+ i.value && t.onStructureChange?.(), A();
446
446
  }
447
447
  }
448
448
  function _e(e) {
449
- if (!je(K, "removeBlock", [e])) return;
450
- let n = ne(r.content.blocks, e);
449
+ if (!Me(he, "removeBlock", [e])) return;
450
+ let n = F(r.content.blocks, e);
451
451
  if (n) {
452
452
  let a = n.blocks.findIndex((t) => t.id === e);
453
453
  if (a !== -1) {
454
454
  let [e] = n.blocks.splice(a, 1);
455
- r.selectedBlockId && new Set(N(e)).has(r.selectedBlockId) && (r.selectedBlockId = null), i.value && t.onStructureChange?.(), k();
455
+ r.selectedBlockId && new Set(N(e)).has(r.selectedBlockId) && (r.selectedBlockId = null), i.value && t.onStructureChange?.(), A();
456
456
  }
457
457
  }
458
458
  }
459
459
  function ve(e, n, a, o = 0) {
460
- if (!je(K, "moveBlock", [
460
+ if (!Me(he, "moveBlock", [
461
461
  e,
462
462
  n,
463
463
  a,
464
464
  o
465
465
  ])) return;
466
- let s = ne(r.content.blocks, e), c = s.blocks.findIndex((t) => t.id === e), l;
466
+ let s = F(r.content.blocks, e), c = s.blocks.findIndex((t) => t.id === e), l;
467
467
  if (a) {
468
- let e = M(r.content.blocks, a);
468
+ let e = P(r.content.blocks, a);
469
469
  e.children[o] = e.children[o] || [], l = e.children[o];
470
470
  } else l = r.content.blocks;
471
471
  let [u] = s.blocks.splice(c, 1);
472
- l.splice(n, 0, u), i.value && t.onStructureChange?.(), k();
472
+ l.splice(n, 0, u), i.value && t.onStructureChange?.(), A();
473
473
  }
474
474
  function ye() {
475
- k();
475
+ A();
476
476
  }
477
477
  function be(e, t) {
478
- throw new W(`[Templatical] Templates: ${e} ${t}`);
478
+ throw new K(`[Templatical] Templates: ${e} ${t}`);
479
479
  }
480
480
  function xe(e) {
481
- Fe(t.onError, e);
481
+ Q(t.onError, e);
482
482
  }
483
- function Se(e) {
483
+ function J(e) {
484
484
  let { templates: n } = t;
485
485
  return n || be(e, "needs a templates provider. Pass one as `init({ templates })` to enable saving and loading."), n;
486
486
  }
487
- function q(e) {
487
+ function Se(e) {
488
488
  r.template && (r.template = {
489
489
  ...r.template,
490
490
  name: e
491
- }, k());
491
+ }, A());
492
492
  }
493
- async function Ce(e) {
494
- let n = Se("create()"), { create: i } = n;
493
+ async function Y(e) {
494
+ let n = J("create()"), { create: i } = n;
495
495
  typeof i != "function" && be("create()", "is disabled by the provider — its `create` is `false`.");
496
- let a, o = ++D;
496
+ let a, o = ++O;
497
497
  r.isLoading = !0;
498
498
  try {
499
- e?.content && (r.content = e.content);
500
- let t = O;
499
+ e?.content !== void 0 && (r.content = e.content, D.value++);
500
+ let t = k;
501
501
  a = await i(e?.name === void 0 ? { content: r.content } : {
502
502
  name: e.name,
503
503
  content: r.content
504
- }), r.template = a, O === t && (r.isDirty = !1), E.value++;
504
+ }), r.template = a, k === t && (r.isDirty = !1), E.value++;
505
505
  } catch (e) {
506
506
  throw t.onError?.(e), e;
507
507
  } finally {
508
- D === o && (r.isLoading = !1);
508
+ O === o && (r.isLoading = !1);
509
509
  }
510
510
  return xe(() => n.onCreated?.(a)), a;
511
511
  }
512
- async function J(e, n) {
513
- let i = Se("load()"), a, o = ++D;
512
+ async function Ce(e, n) {
513
+ let i = J("load()"), a, o = ++O;
514
514
  r.isLoading = !0;
515
515
  try {
516
- if (a = await i.load(e), U(a.content), ce(a.content), n && !n()) return a;
517
- r.template = a, r.content = a.content, r.isDirty = !1, E.value++;
516
+ if (a = await i.load(e), G(a.content), oe(a.content), n && !n()) return a;
517
+ r.template = a, r.content = a.content, D.value++, r.isDirty = !1, E.value++;
518
518
  } catch (e) {
519
519
  throw t.onError?.(e), e;
520
520
  } finally {
521
- D === o && (r.isLoading = !1);
521
+ O === o && (r.isLoading = !1);
522
522
  }
523
523
  return xe(() => i.onLoaded?.(a)), a;
524
524
  }
525
- async function Y(e = "api") {
526
- let n = Se("save()"), { save: i } = n;
525
+ async function we(e = "api") {
526
+ let n = J("save()"), { save: i } = n;
527
527
  typeof i != "function" && be("save()", "is disabled by the provider — its `save` is `false`.");
528
528
  let a = r.template;
529
529
  a || be("save()", "has no template loaded. Call create() or load() first.");
@@ -533,7 +533,7 @@ function Ie(t) {
533
533
  }, s;
534
534
  r.isSaving = !0;
535
535
  try {
536
- let e = O;
536
+ let e = k;
537
537
  if (s = await i(a.id, o), r.template?.id === a.id) {
538
538
  let e = r.template.name;
539
539
  r.template = e === a.name ? s : {
@@ -541,7 +541,7 @@ function Ie(t) {
541
541
  name: e
542
542
  };
543
543
  }
544
- O === e && (r.isDirty = !1);
544
+ k === e && (r.isDirty = !1);
545
545
  } catch (e) {
546
546
  throw t.onError?.(e), e;
547
547
  } finally {
@@ -549,14 +549,15 @@ function Ie(t) {
549
549
  }
550
550
  return xe(() => n.onSaved?.(s, { trigger: e })), s;
551
551
  }
552
- function we() {
552
+ function Ee() {
553
553
  return r.template?.id !== void 0;
554
554
  }
555
555
  let X = {
556
556
  state: m(r),
557
557
  loadVersion: m(E),
558
- content: ee,
559
- selectedBlock: j,
558
+ contentReplaced: m(D),
559
+ content: M,
560
+ selectedBlock: te,
560
561
  activeLocale: i,
561
562
  setActiveLocale: o,
562
563
  addLocale: p,
@@ -566,34 +567,34 @@ function Ie(t) {
566
567
  keepTranslations: w,
567
568
  setCustomBlockDefinitions: c,
568
569
  createSetDefaultLocaleOperation: l,
569
- isBlockLocked: P,
570
+ isBlockLocked: R,
570
571
  setContent: ie,
571
- selectBlock: se,
572
- setViewport: z,
573
- setDarkMode: le,
574
- setUiTheme: ue,
575
- setPreviewMode: de,
576
- updateBlock: pe,
577
- updateSettings: he,
572
+ selectBlock: ae,
573
+ setViewport: se,
574
+ setDarkMode: ce,
575
+ setUiTheme: le,
576
+ setPreviewMode: ue,
577
+ updateBlock: fe,
578
+ updateSettings: me,
578
579
  addBlock: ge,
579
580
  removeBlock: _e,
580
581
  moveBlock: ve,
581
582
  markDirty: ye,
582
- findBlockLocation: L,
583
- setName: q,
584
- create: Ce,
585
- load: J,
586
- save: Y,
587
- hasTemplate: we
583
+ findBlockLocation: z,
584
+ setName: Se,
585
+ create: Y,
586
+ load: Ce,
587
+ save: we,
588
+ hasTemplate: Ee
588
589
  };
589
- return Ne(X, (e, t) => Ae(e) ? je(K, e, t) : s() ? e === "updateBlock" ? fe(t[0], t[1]) : (e === "updateSettings" && me(t[0]), e === "addLocale" || e === "removeLocale" ? d(e, t[0]) !== null : e === "setBlockHidden" || e === "resetLocaleFields" || e === "keepTranslations" ? v(e, t) !== null : !0) : !1), X;
590
+ return Ne(X, (e, t) => je(e) ? Me(he, e, t) : s() ? e === "updateBlock" ? de(t[0], t[1]) : (e === "updateSettings" && pe(t[0]), e === "addLocale" || e === "removeLocale" ? d(e, t[0]) !== null : e === "setBlockHidden" || e === "resetLocaleFields" || e === "keepTranslations" ? v(e, t) !== null : !0) : !1), X;
590
591
  }
591
592
  // ../core/src/history.ts
592
593
  var Le = 50, Re = 300, ze = 1500;
593
594
  function Be(e) {
594
595
  let { content: t, setContent: n, maxSize: r = Le } = e, i = S([]), a = S([]), o = S(!1), s = null, c = null, l = b(() => i.value.length > 0), u = b(() => a.value.length > 0);
595
596
  function d() {
596
- return H(t.value);
597
+ return W(t.value);
597
598
  }
598
599
  function f(e) {
599
600
  i.value.push(e), i.value.length > r && i.value.splice(0, i.value.length - r);
@@ -654,12 +655,12 @@ function Be(e) {
654
655
  function Ve(e) {
655
656
  let { addBlock: t, removeBlock: n, updateBlock: r, selectBlock: i, findBlockLocation: a } = e;
656
657
  function o(n, r, a) {
657
- let o = typeof e.blockDefaults == "function" ? e.blockDefaults() : e.blockDefaults, s = me(n, o);
658
+ let o = typeof e.blockDefaults == "function" ? e.blockDefaults() : e.blockDefaults, s = fe(n, o);
658
659
  return t(s, r, a), i(s.id), s;
659
660
  }
660
661
  function s(e, n, r) {
661
- let o = fe(e);
662
- if (!Q(t, "duplicateBlock", [
662
+ let o = ue(e);
663
+ if (!Z(t, "duplicateBlock", [
663
664
  e,
664
665
  n,
665
666
  r
@@ -774,7 +775,7 @@ function Ge(e) {
774
775
  }
775
776
  // ../core/src/history-interceptor.ts
776
777
  function Ke(e, t) {
777
- e.activeLocale && h(e.activeLocale, () => t.flushDebounce?.());
778
+ e.contentReplaced && h(e.contentReplaced, () => t.clear()), e.activeLocale && h(e.activeLocale, () => t.flushDebounce?.());
778
779
  for (let n of [
779
780
  "addLocale",
780
781
  "removeLocale",
@@ -784,31 +785,31 @@ function Ke(e, t) {
784
785
  ]) {
785
786
  let r = e[n];
786
787
  r && (Object.assign(e, { [n]: (...i) => {
787
- Q(e, n, i) && (["addLocale", "removeLocale"].includes(n) || !e.isBlockLocked(i[0])) && (t.record(), r(...i));
788
- } }), Z(r, e[n]));
788
+ Z(e, n, i) && (["addLocale", "removeLocale"].includes(n) || !e.isBlockLocked(i[0])) && (t.record(), r(...i));
789
+ } }), Pe(r, e[n]));
789
790
  }
790
791
  let n = e.addBlock, r = e.removeBlock, i = e.moveBlock, a = e.updateBlock, o = e.updateSettings;
791
792
  e.addBlock = (r, i, a, o) => {
792
- Q(e, "addBlock", [
793
+ Z(e, "addBlock", [
793
794
  r,
794
795
  i,
795
796
  a,
796
797
  o
797
798
  ]) && (t.record(), n(r, i, a, o));
798
799
  }, e.removeBlock = (n) => {
799
- Q(e, "removeBlock", [n]) && (t.record(), r(n));
800
+ Z(e, "removeBlock", [n]) && (t.record(), r(n));
800
801
  }, e.moveBlock = (n, r, a, o) => {
801
- Q(e, "moveBlock", [
802
+ Z(e, "moveBlock", [
802
803
  n,
803
804
  r,
804
805
  a,
805
806
  o
806
807
  ]) && (t.record(), i(n, r, a, o));
807
- }, Z(n, e.addBlock), Z(r, e.removeBlock), Z(i, e.moveBlock), e.updateBlock = (n, r) => {
808
- Q(e, "updateBlock", [n, r]) && (e.isBlockLocked(n) || (t.recordDebounced(n), a(n, r)));
808
+ }, Pe(n, e.addBlock), Pe(r, e.removeBlock), Pe(i, e.moveBlock), e.updateBlock = (n, r) => {
809
+ Z(e, "updateBlock", [n, r]) && (e.isBlockLocked(n) || (t.recordDebounced(n), a(n, r)));
809
810
  }, e.updateSettings = (n) => {
810
- Q(e, "updateSettings", [n]) && (t.record(), o(n));
811
- }, Z(a, e.updateBlock), Z(o, e.updateSettings);
811
+ Z(e, "updateSettings", [n]) && (t.record(), o(n));
812
+ }, Pe(a, e.updateBlock), Pe(o, e.updateSettings);
812
813
  }
813
814
  // ../core/src/diff-content.ts
814
815
  var qe = "root", Je = /* @__PURE__ */ new Set([
@@ -868,7 +869,7 @@ function tt(e) {
868
869
  }
869
870
  function nt(e, t, n) {
870
871
  let r = {}, i = [];
871
- for (let i of Object.keys(t)) n.has(i) || t[i] === void 0 || G(e[i], t[i]) || (r[i] = H(t[i]));
872
+ for (let i of Object.keys(t)) n.has(i) || t[i] === void 0 || q(e[i], t[i]) || (r[i] = W(t[i]));
872
873
  for (let r of Object.keys(e)) n.has(r) || e[r] === void 0 || t[r] === void 0 && i.push(r);
873
874
  return {
874
875
  set: r,
@@ -887,7 +888,7 @@ function rt(e = {}, t = {}) {
887
888
  function it(e, t) {
888
889
  if (e.settings.locale !== t.settings.locale && (e.settings.locales?.length || t.settings.locales?.length)) return [{
889
890
  op: "setContent",
890
- content: H(t)
891
+ content: W(t)
891
892
  }];
892
893
  let n = et(e.blocks), r = et(t.blocks), i = [], a = new Set(t.settings.locales ?? []), o = new Set(e.settings.locales ?? []), s = (e) => {
893
894
  let t = r.get(e), i = n.get(e);
@@ -905,7 +906,7 @@ function it(e, t) {
905
906
  };
906
907
  for (let t of e.blocks) p(t, "kept");
907
908
  let m = (e) => n.has(e) && !d.has(e), h = (e) => {
908
- let t = H(e);
909
+ let t = W(e);
909
910
  return t.type === "section" ? t.children = $e(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;
910
911
  }, g = (e, t, r) => {
911
912
  let a = Qe(e), o = [], s = [];
@@ -1088,41 +1089,41 @@ function ct(e, t, n) {
1088
1089
  Object.keys(n).length ? (e.l10n ??= {})[t] = n : e.l10n && (delete e.l10n[t], Object.keys(e.l10n).length || delete e.l10n);
1089
1090
  }
1090
1091
  function lt(e) {
1091
- let t = H(e);
1092
+ let t = W(e);
1092
1093
  return delete t.l10n, t.type === "section" ? t.children = t.children.map((e) => e.map(lt)) : t.type === "wrapper" && (t.children = t.children.map(lt)), t;
1093
1094
  }
1094
1095
  function ut(e, t, n, r) {
1095
- let i = T(e, t), a = H(e), o = H(i.settings), s = !1, c = /* @__PURE__ */ new Map(), l = (n, r) => {
1096
+ let i = T(e, t), a = W(e), o = W(i.settings), s = !1, c = /* @__PURE__ */ new Map(), l = (n, r) => {
1096
1097
  for (let [i, a] of $(n)) c.set(i, {
1097
- initial: ae(a, t, A(e)),
1098
+ initial: re(a, t, j(e)),
1098
1099
  added: r,
1099
1100
  changed: !1
1100
1101
  });
1101
1102
  };
1102
1103
  l(i.blocks, !1);
1103
1104
  let u = [], d = (e, t, n) => {
1104
- if (t.some((e) => e?.op === "setDefaultLocale")) throw new P("invalid_operation", n, "Changing the default language isn't possible in a language view; switch to the default language.");
1105
- if (t.some((e) => e?.op === "setContent")) throw new P("invalid_operation", n, "Replacing the whole template isn't possible in a language view; switch to the default language.");
1105
+ if (t.some((e) => e?.op === "setDefaultLocale")) throw new F("invalid_operation", n, "Changing the default language isn't possible in a language view; switch to the default language.");
1106
+ if (t.some((e) => e?.op === "setContent")) throw new F("invalid_operation", n, "Replacing the whole template isn't possible in a language view; switch to the default language.");
1106
1107
  try {
1107
1108
  return O(e, t);
1108
1109
  } catch (e) {
1109
- throw e instanceof P ? new P(e.code, n, e.message, e.blockId) : e;
1110
+ throw e instanceof F ? new F(e.code, n, e.message, e.blockId) : e;
1110
1111
  }
1111
1112
  }, f = (e, t) => {
1112
1113
  a = d(a, e, t), u.push(...e);
1113
1114
  }, p = (e, n) => {
1114
1115
  let o = c.get(e);
1115
1116
  if (!o?.changed) return;
1116
- let s = $(a.blocks).get(e), l = $(i.blocks).get(e), u = H(a), d = at(u, ot(u, e).parent), p = H(s);
1117
+ let s = $(a.blocks).get(e), l = $(i.blocks).get(e), u = W(a), d = at(u, ot(u, e).parent), p = W(s);
1117
1118
  if (o.added) p = lt(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);
1118
1119
  else {
1119
- De(p, p.type === "section" ? {
1120
+ Oe(p, p.type === "section" ? {
1120
1121
  ...l,
1121
1122
  children: p.children,
1122
1123
  columns: p.columns
1123
- } : l, (e) => $(a.blocks).get(e) ?? null), p = R(p);
1124
+ } : l, (e) => $(a.blocks).get(e) ?? null), p = B(p);
1124
1125
  let e = p.l10n?.[t];
1125
- ct(p, t, ke(e, Ee(p, o.initial, e, r), Ee(p, l, e, r), p, l));
1126
+ ct(p, t, Ae(e, De(p, o.initial, e, r), De(p, l, e, r), p, l));
1126
1127
  }
1127
1128
  d[d.findIndex((t) => t.id === e)] = p, f(it(a, u), n), o.changed = !1;
1128
1129
  }, m = (e, t, n) => {
@@ -1143,7 +1144,7 @@ function ut(e, t, n, r) {
1143
1144
  op: "updateBlock",
1144
1145
  blockId: e.blockId,
1145
1146
  set: { columns: i.columns },
1146
- ...e.expect ? { expect: Object.fromEntries(Object.keys(e.expect).map((e) => [e, F(u, e) ?? null])) } : {}
1147
+ ...e.expect ? { expect: Object.fromEntries(Object.keys(e.expect).map((e) => [e, I(u, e) ?? null])) } : {}
1147
1148
  }], n);
1148
1149
  };
1149
1150
  n.forEach((e, t) => {
@@ -1188,8 +1189,8 @@ function ut(e, t, n, r) {
1188
1189
  });
1189
1190
  for (let e of c.keys()) p(e, n.length - 1);
1190
1191
  if (s) {
1191
- let e = H(a), r = e.settings.l10n?.[t];
1192
- ct(e.settings, t, ke(r, Oe(e.settings, o, r), Oe(e.settings, i.settings, r), e.settings, i.settings)), f(it(a, e), n.length - 1);
1192
+ let e = W(a), r = e.settings.l10n?.[t];
1193
+ ct(e.settings, t, Ae(r, ke(e.settings, o, r), ke(e.settings, i.settings, r), e.settings, i.settings)), f(it(a, e), n.length - 1);
1193
1194
  }
1194
1195
  return u;
1195
1196
  }
@@ -1245,14 +1246,14 @@ function Ct(e) {
1245
1246
  });
1246
1247
  }
1247
1248
  function wt(e) {
1248
- let { provider: t } = e, n = e.sessionId ?? crypto.randomUUID(), r = e.maxUndo ?? mt, i = typeof t.acquireLock == "function" && typeof t.renewLock == "function" && typeof t.releaseLock == "function", a = x([]), s = x(/* @__PURE__ */ new Map()), l = /* @__PURE__ */ new WeakSet(), u = /* @__PURE__ */ new WeakMap(), d = 0, f = S(null), p = S(null), m = S(0), g = S(0), _ = null, v = null, y = !1, C = !1, w = !1, T = !1, E = null, D = 0, k = !1, ee = [], A = null, j = null, M = Promise.resolve(), N = null, F = b(() => (v?.undo.length ?? 0) > 0), re = b(() => (v?.redo.length ?? 0) > 0);
1249
- function I(t) {
1249
+ let { provider: t } = e, n = e.sessionId ?? crypto.randomUUID(), r = e.maxUndo ?? mt, i = typeof t.acquireLock == "function" && typeof t.renewLock == "function" && typeof t.releaseLock == "function", a = x([]), s = x(/* @__PURE__ */ new Map()), l = /* @__PURE__ */ new WeakSet(), u = /* @__PURE__ */ new WeakMap(), d = 0, f = S(null), p = S(null), m = S(0), g = S(0), _ = null, v = null, y = !1, C = !1, w = !1, T = !1, E = null, D = 0, k = !1, A = [], j = null, M = null, te = Promise.resolve(), N = null, I = b(() => (v?.undo.length ?? 0) > 0), ne = b(() => (v?.redo.length ?? 0) > 0);
1250
+ function L(t) {
1250
1251
  e.onError?.(t instanceof Error ? t : Error(String(t)));
1251
1252
  }
1252
- function L(t, n = v) {
1253
+ function R(t, n = v) {
1253
1254
  n !== v || k || e.onNotice?.(t);
1254
1255
  }
1255
- function ie() {
1256
+ function z() {
1256
1257
  return {
1257
1258
  locks: [...s.value.values()].map((e) => ({
1258
1259
  blockId: e.blockId,
@@ -1262,99 +1263,99 @@ function wt(e) {
1262
1263
  session: n
1263
1264
  };
1264
1265
  }
1265
- function R() {
1266
+ function B() {
1266
1267
  g.value++;
1267
1268
  }
1268
- function ae(e, t) {
1269
+ function re(e, t) {
1269
1270
  e.push(t), e.length > r && e.splice(0, e.length - r);
1270
1271
  }
1271
- function oe(e) {
1272
+ function V(e) {
1272
1273
  if (!_ || y) return;
1273
1274
  C = !0;
1274
1275
  try {
1275
1276
  let t = _.content.value, n = it(t, e);
1276
1277
  if (n.length > 0) try {
1277
- te(t, n);
1278
+ ee(t, n);
1278
1279
  } catch {
1279
- _.setContent(H(e), !1);
1280
+ _.setContent(W(e), !1);
1280
1281
  }
1281
- G(_.content.value, e) || _.setContent(H(e), !1);
1282
+ q(_.content.value, e) || _.setContent(W(e), !1);
1282
1283
  } finally {
1283
1284
  C = !1;
1284
1285
  }
1285
1286
  let t = _.state.selectedBlockId;
1286
1287
  t && !xt(e.blocks, t) && _.selectBlock(null);
1287
1288
  }
1288
- function se() {
1289
+ function ie() {
1289
1290
  C || T || (T = !0, queueMicrotask(() => {
1290
- T = !1, B(!1);
1291
+ T = !1, H(!1);
1291
1292
  }));
1292
1293
  }
1293
- function z() {
1294
+ function ae() {
1294
1295
  E &&= (clearTimeout(E), null);
1295
1296
  }
1296
- function B(e, t = !1) {
1297
+ function H(e, t = !1) {
1297
1298
  let n = v;
1298
1299
  if (!_ || !n || y || C || _.state.isLoading && !t || _.state.template?.id !== n.templateId) return;
1299
1300
  let r = it(n.view, _.content.value);
1300
- if (r.length === 0) z();
1301
+ if (r.length === 0) ae();
1301
1302
  else {
1302
1303
  if (!e && St(r)) {
1303
1304
  let e = Date.now();
1304
1305
  if (E === null && (D = e), e - D < 1e3) {
1305
1306
  E && clearTimeout(E), E = setTimeout(() => {
1306
- E = null, B(!0);
1307
+ E = null, H(!0);
1307
1308
  }, 300);
1308
1309
  return;
1309
1310
  }
1310
1311
  }
1311
- z(), ce(n, r);
1312
+ ae(), oe(n, r);
1312
1313
  }
1313
1314
  }
1314
- function V() {
1315
- B(!0);
1315
+ function U() {
1316
+ H(!0);
1316
1317
  }
1317
- function ce(e, t) {
1318
+ function oe(e, t) {
1318
1319
  let n = t, r;
1319
1320
  try {
1320
- r = O(e.view, n, ie());
1321
+ r = O(e.view, n, z());
1321
1322
  } catch (n) {
1322
- if (!(n instanceof P)) throw n;
1323
- oe(e.view);
1324
- let r = n.blockId === void 0 ? void 0 : ke(n.blockId).find((e) => {
1323
+ if (!(n instanceof F)) throw n;
1324
+ V(e.view);
1325
+ let r = n.blockId === void 0 ? void 0 : je(n.blockId).find((e) => {
1325
1326
  let r = t[n.opIndex];
1326
1327
  return r.op !== "updateBlockLocale" || e.locale == null || e.locale === r.locale;
1327
1328
  })?.holder;
1328
- L({
1329
+ R({
1329
1330
  type: "editRefused",
1330
1331
  code: n.code,
1331
1332
  ...r ? { holder: r } : {}
1332
- }), n.code === "invalid_operation" && I(n);
1333
+ }), n.code === "invalid_operation" && L(n);
1333
1334
  return;
1334
1335
  }
1335
1336
  let i = _.content.value;
1336
- if (!G(r, i)) {
1337
- I(/* @__PURE__ */ Error("[Templatical] Collaboration: a change couldn't be expressed as block operations, so the whole content was sent.")), n = [{
1337
+ if (!q(r, i)) {
1338
+ L(/* @__PURE__ */ Error("[Templatical] Collaboration: a change couldn't be expressed as block operations, so the whole content was sent.")), n = [{
1338
1339
  op: "setContent",
1339
- content: H(i)
1340
+ content: W(i)
1340
1341
  }];
1341
1342
  try {
1342
- r = O(e.view, n, ie());
1343
+ r = O(e.view, n, z());
1343
1344
  } catch (t) {
1344
- if (!(t instanceof P)) throw t;
1345
- oe(e.view), L({
1345
+ if (!(t instanceof F)) throw t;
1346
+ V(e.view), R({
1346
1347
  type: "editRefused",
1347
1348
  code: t.code
1348
1349
  });
1349
1350
  return;
1350
1351
  }
1351
1352
  }
1352
- let a = _t({ ops: ne(e.view, n) }, r);
1353
- ae(e.undo, a), e.redo = [], R();
1353
+ let a = _t({ ops: P(e.view, n) }, r);
1354
+ re(e.undo, a), e.redo = [], B();
1354
1355
  let o = e.view;
1355
- e.view = r, le(e, n, "edit", a, o);
1356
+ e.view = r, se(e, n, "edit", a, o);
1356
1357
  }
1357
- function le(e, t, n, r, i) {
1358
+ function se(e, t, n, r, i) {
1358
1359
  let a = { dropped: !1 }, o = 0, s = i;
1359
1360
  do {
1360
1361
  let i = t.slice(o, o + ht);
@@ -1373,139 +1374,139 @@ function wt(e) {
1373
1374
  s = null;
1374
1375
  }
1375
1376
  } while (o < t.length);
1376
- U(e);
1377
+ G(e);
1377
1378
  }
1378
- function U(e) {
1379
+ function G(e) {
1379
1380
  if (e.inFlight || w) return;
1380
1381
  let t = e.pending.find((e) => !e.sent);
1381
- t ? (t.sent = !0, e.inFlight = t, W(e, t, 0)) : he(e);
1382
+ t ? (t.sent = !0, e.inFlight = t, K(e, t, 0)) : pe(e);
1382
1383
  }
1383
- function W(e, n, r) {
1384
+ function K(e, n, r) {
1384
1385
  t.submit(e.templateId, {
1385
1386
  batchId: n.batchId,
1386
1387
  baseRevision: n.baseRevision ??= e.revision,
1387
1388
  ops: n.ops,
1388
1389
  ...n.origin === "ai" ? { origin: "ai" } : {}
1389
1390
  }).then(({ revision: t }) => {
1390
- e.inFlight = null, ue(e, n, t), U(e);
1391
+ e.inFlight = null, ce(e, n, t), G(e);
1391
1392
  }, (t) => {
1392
- if (vt(t) !== null) e.inFlight = null, me(e, n, t), U(e);
1393
+ if (vt(t) !== null) e.inFlight = null, fe(e, n, t), G(e);
1393
1394
  else if (bt(t)) {
1394
- K(e, t);
1395
+ me(e, t);
1395
1396
  let i = pt[Math.min(r, pt.length - 1)];
1396
1397
  setTimeout(() => {
1397
- k || W(e, n, r + 1);
1398
+ k || K(e, n, r + 1);
1398
1399
  }, i);
1399
- } else e.inFlight = null, I(t), me(e, n, t), U(e);
1400
+ } else e.inFlight = null, L(t), fe(e, n, t), G(e);
1400
1401
  });
1401
1402
  }
1402
- function ue(e, t, n) {
1403
- t.revision === null && (t.revision = n, n <= e.revision ? (de(e, t), ye(e)) : (e.own.set(n, t), ve(e)));
1403
+ function ce(e, t, n) {
1404
+ t.revision === null && (t.revision = n, n <= e.revision ? (le(e, t), ve(e)) : (e.own.set(n, t), _e(e)));
1404
1405
  }
1405
- function de(e, t) {
1406
- e.pending = e.pending.filter((e) => e !== t), he(e);
1406
+ function le(e, t) {
1407
+ e.pending = e.pending.filter((e) => e !== t), pe(e);
1407
1408
  }
1408
- function fe(e, t) {
1409
+ function ue(e, t) {
1409
1410
  if (t.entry) {
1410
1411
  for (let n of [e.undo, e.redo]) {
1411
1412
  let e = n.indexOf(t.entry);
1412
1413
  e !== -1 && n.splice(e, 1);
1413
1414
  }
1414
- R();
1415
+ B();
1415
1416
  }
1416
1417
  }
1417
- function pe(e, t) {
1418
+ function de(e, t) {
1418
1419
  let n = !t.group.dropped;
1419
- return t.group.dropped = !0, e.pending = e.pending.filter((e) => e.group !== t.group || e.sent), n && fe(e, t), he(e), n;
1420
+ return t.group.dropped = !0, e.pending = e.pending.filter((e) => e.group !== t.group || e.sent), n && ue(e, t), pe(e), n;
1420
1421
  }
1421
- function me(e, t, n) {
1422
- if (de(e, t), pe(e, t)) {
1422
+ function fe(e, t, n) {
1423
+ if (le(e, t), de(e, t)) {
1423
1424
  let r = vt(n) ?? "invalid_operation";
1424
1425
  if (t.origin === "edit" || t.origin === "ai") {
1425
1426
  let t = yt(n);
1426
- L({
1427
+ R({
1427
1428
  type: "editRefused",
1428
1429
  code: r,
1429
1430
  ...t ? { holder: t } : {}
1430
1431
  }, e);
1431
- } else L({
1432
+ } else R({
1432
1433
  type: "undoSkipped",
1433
1434
  code: r
1434
1435
  }, e);
1435
1436
  }
1436
- ye(e), e === v && q();
1437
+ ve(e), e === v && J();
1437
1438
  }
1438
- function he(e) {
1439
+ function pe(e) {
1439
1440
  if (!(e.pending.length > 0 || e.waiters.length === 0)) for (let t of e.waiters.splice(0)) t.resolve();
1440
1441
  }
1441
- function K(e, t) {
1442
+ function me(e, t) {
1442
1443
  let n = t instanceof Error ? t : Error(String(t));
1443
1444
  for (let t of e.waiters.splice(0)) t.reject(n);
1444
1445
  }
1445
- function ge(e, t) {
1446
+ function he(e, t) {
1446
1447
  if (t.revision <= e.revision) return;
1447
1448
  let n = e.pending.find((e) => e.batchId === t.batchId);
1448
- n ? ue(e, n, t.revision) : (e.remote.set(t.revision, t), ve(e));
1449
+ n ? ce(e, n, t.revision) : (e.remote.set(t.revision, t), _e(e));
1449
1450
  }
1450
- function _e(t, n) {
1451
+ function ge(t, n) {
1451
1452
  let r = n.ops;
1452
1453
  if (e.normalizeRemoteOperations) try {
1453
1454
  r = e.normalizeRemoteOperations(n.ops, t.confirmed);
1454
1455
  } catch (e) {
1455
- I(e);
1456
+ L(e);
1456
1457
  }
1457
1458
  return Ct(r);
1458
1459
  }
1459
- function ve(t) {
1460
+ function _e(t) {
1460
1461
  let n = [], r = !1;
1461
1462
  for (;;) {
1462
1463
  let e = t.revision + 1, i = t.remote.get(e), a = t.own.get(e);
1463
1464
  if (!i && !a) break;
1464
1465
  try {
1465
- t.confirmed = O(t.confirmed, i ? _e(t, i) : a.ops);
1466
+ t.confirmed = O(t.confirmed, i ? ge(t, i) : a.ops);
1466
1467
  } catch {
1467
1468
  if (t.recovering) {
1468
- t.remote.clear(), t.own.clear(), I(/* @__PURE__ */ Error("[Templatical] Collaboration: this editor can't follow the template's changes. Reload the page."));
1469
+ t.remote.clear(), t.own.clear(), L(/* @__PURE__ */ Error("[Templatical] Collaboration: this editor can't follow the template's changes. Reload the page."));
1469
1470
  return;
1470
1471
  }
1471
- Ce(t);
1472
+ Se(t);
1472
1473
  return;
1473
1474
  }
1474
- t.revision = e, i ? (t.remote.delete(e), n.push(i)) : (t.own.delete(e), a.group.dropped && (r = !0), de(t, a));
1475
+ t.revision = e, i ? (t.remote.delete(e), n.push(i)) : (t.own.delete(e), a.group.dropped && (r = !0), le(t, a));
1475
1476
  }
1476
- if (t === v && (m.value = t.revision), t.remote.size > 0 || t.own.size > 0 ? xe(t) : Se(t), (n.length !== 0 || r) && (ye(t), t === v)) for (let t of n) try {
1477
+ if (t === v && (m.value = t.revision), t.remote.size > 0 || t.own.size > 0 ? be(t) : xe(t), (n.length !== 0 || r) && (ve(t), t === v)) for (let t of n) try {
1477
1478
  e.onRemoteChange?.({
1478
1479
  actor: t.actor,
1479
1480
  ops: t.ops,
1480
1481
  locale: t.ops.find((e) => e.op !== "setDefaultLocale" && "locale" in e)?.locale ?? null
1481
1482
  });
1482
1483
  } catch (e) {
1483
- I(e);
1484
+ L(e);
1484
1485
  }
1485
1486
  }
1486
- function ye(e) {
1487
+ function ve(e) {
1487
1488
  let t = !w;
1488
1489
  w = !0;
1489
1490
  try {
1490
- be(e);
1491
+ ye(e);
1491
1492
  } finally {
1492
1493
  t && (w = !1);
1493
1494
  }
1494
- t && U(e);
1495
+ t && G(e);
1495
1496
  }
1496
- function be(e) {
1497
- e === v && V();
1497
+ function ye(e) {
1498
+ e === v && U();
1498
1499
  let t = e.confirmed;
1499
1500
  for (let n = 0; n < e.pending.length; n++) {
1500
1501
  let r = e.pending[n], i;
1501
- if (r.base && !G(r.base, t)) i = "precondition_failed";
1502
+ if (r.base && !q(r.base, t)) i = "precondition_failed";
1502
1503
  else try {
1503
1504
  t = O(t, r.ops);
1504
1505
  continue;
1505
1506
  } catch (e) {
1506
- i = e instanceof P ? e.code : "invalid_operation";
1507
+ i = e instanceof F ? e.code : "invalid_operation";
1507
1508
  }
1508
- r.sent || (pe(e, r) && L(r.origin === "edit" || r.origin === "ai" ? {
1509
+ r.sent || (de(e, r) && R(r.origin === "edit" || r.origin === "ai" ? {
1509
1510
  type: "editRefused",
1510
1511
  code: i
1511
1512
  } : {
@@ -1513,54 +1514,57 @@ function wt(e) {
1513
1514
  code: i
1514
1515
  }, e), t = e.confirmed, n = -1);
1515
1516
  }
1516
- e.view = t, he(e), e === v && oe(t);
1517
+ e.view = t, pe(e), e === v && V(t);
1517
1518
  }
1518
- function xe(e) {
1519
+ function be(e) {
1519
1520
  e.gapTimer ||= setTimeout(() => {
1520
- e.gapTimer = null, e === v && q();
1521
+ e.gapTimer = null, e === v && J();
1521
1522
  }, dt);
1522
1523
  }
1523
- function Se(e) {
1524
+ function xe(e) {
1524
1525
  e.gapTimer &&= (clearTimeout(e.gapTimer), null);
1525
1526
  }
1526
- function q() {
1527
+ function J() {
1527
1528
  let e = v;
1528
1529
  return e ? (e.catchingUp ||= (async () => {
1529
1530
  try {
1530
1531
  let n = await t.operationsAfter(e.templateId, e.revision);
1531
1532
  if (e.retired) return;
1532
1533
  if ("resync" in n) {
1533
- await Ce(e);
1534
+ await Se(e);
1534
1535
  return;
1535
1536
  }
1536
- for (let t of n.batches) ge(e, t);
1537
+ for (let t of n.batches) he(e, t);
1537
1538
  } catch (e) {
1538
- I(e);
1539
+ L(e);
1539
1540
  } finally {
1540
1541
  e.catchingUp = null;
1541
1542
  }
1542
1543
  })(), e.catchingUp) : Promise.resolve();
1543
1544
  }
1544
- async function Ce(t) {
1545
+ async function Se(t) {
1545
1546
  t.recovering = !0;
1546
1547
  try {
1547
1548
  let n = await e.loadTemplate(t.templateId);
1548
1549
  if (t.retired) return;
1549
- let r = n.revision ?? t.revision;
1550
- t.confirmed = H(n.content), t.revision = r, t.remote = new Map([...t.remote].filter(([e]) => e > r));
1551
- for (let [e, n] of [...t.own]) e <= r && (t.own.delete(e), de(t, n));
1552
- t === v && (m.value = r), ye(t), ve(t);
1550
+ Y(t, n);
1553
1551
  } catch (e) {
1554
- I(e);
1552
+ L(e);
1555
1553
  } finally {
1556
1554
  t.recovering = !1;
1557
1555
  }
1558
1556
  }
1559
- function J(t) {
1557
+ function Y(e, t) {
1558
+ let n = t.revision ?? e.revision;
1559
+ e.confirmed = W(t.content), e.revision = n, e.remote = new Map([...e.remote].filter(([e]) => e > n));
1560
+ for (let [t, r] of [...e.own]) t <= n && (e.own.delete(t), le(e, r));
1561
+ e === v && (m.value = n), ve(e), _e(e);
1562
+ }
1563
+ function Ce(t) {
1560
1564
  let n = () => t === v && !t.retired;
1561
1565
  return {
1562
1566
  onBatch: (e) => {
1563
- n() && ge(t, e);
1567
+ n() && he(t, e);
1564
1568
  },
1565
1569
  onResync: (r, i) => {
1566
1570
  if (!(!n() || r <= t.revision)) {
@@ -1570,38 +1574,38 @@ function wt(e) {
1570
1574
  actor: i
1571
1575
  });
1572
1576
  } catch (e) {
1573
- I(e);
1577
+ L(e);
1574
1578
  }
1575
- q();
1579
+ J();
1576
1580
  }
1577
1581
  },
1578
1582
  onLock: (e) => {
1579
- n() && je(e);
1583
+ n() && X(e);
1580
1584
  },
1581
1585
  onUnlock: (e, t, r) => {
1582
- n() && Me(e, t, r);
1586
+ n() && Ne(e, t, r);
1583
1587
  },
1584
1588
  onMembers: (e) => {
1585
1589
  n() && Z(e);
1586
1590
  },
1587
1591
  onConnectionChange: (e) => {
1588
- n() && X(t, e);
1592
+ n() && De(t, e);
1589
1593
  }
1590
1594
  };
1591
1595
  }
1592
- function Y(e, r) {
1596
+ function we(e, r) {
1593
1597
  let i = d;
1594
- t.join(e.templateId, { sessionId: n }, J(e)).then((t) => {
1595
- e.retired || e !== v ? r || t.leave() : (e.leave = t.leave, Ne(t.locks, !r, i), Z(t.members), t.members.length > 0 && (p.value = "connected"), t.revision > e.revision && q(), r && Pe());
1596
- }, (e) => I(e));
1598
+ t.join(e.templateId, { sessionId: n }, Ce(e)).then((t) => {
1599
+ e.retired || e !== v ? r || t.leave() : (e.leave = t.leave, Pe(t.locks, !r, i), Z(t.members), t.members.length > 0 && (p.value = "connected"), t.revision > e.revision && J(), r && Q());
1600
+ }, (e) => L(e));
1597
1601
  }
1598
- function we(e) {
1599
- let t = H(e.content), n = {
1602
+ function Te(e, t) {
1603
+ let n = W(e.content), r = {
1600
1604
  templateId: e.id,
1601
- confirmed: t,
1605
+ confirmed: n,
1602
1606
  revision: e.revision ?? 0,
1603
1607
  pending: [],
1604
- view: H(t),
1608
+ view: W(n),
1605
1609
  remote: /* @__PURE__ */ new Map(),
1606
1610
  own: /* @__PURE__ */ new Map(),
1607
1611
  inFlight: null,
@@ -1610,53 +1614,53 @@ function wt(e) {
1610
1614
  leave: null,
1611
1615
  retired: !1,
1612
1616
  recovering: !1,
1613
- undo: [],
1614
- redo: [],
1617
+ undo: t?.undo ?? [],
1618
+ redo: t?.redo ?? [],
1615
1619
  waiters: []
1616
1620
  };
1617
- v = n, m.value = n.revision, R(), Y(n, !1), _?.state.selectedBlockId && ze(_.state.selectedBlockId), se();
1621
+ v = r, m.value = r.revision, B(), we(r, !1), _?.state.selectedBlockId && Be(_.state.selectedBlockId), ie();
1618
1622
  }
1619
- function Te(e) {
1620
- e.retired = !0, Se(e), e.leave?.(), e.leave = null, K(e, /* @__PURE__ */ Error("[Templatical] The template was closed."));
1623
+ function Ee(e) {
1624
+ e.retired = !0, xe(e), e.leave?.(), e.leave = null, me(e, /* @__PURE__ */ Error("[Templatical] The template was closed."));
1621
1625
  }
1622
- function X(e, t) {
1626
+ function De(e, t) {
1623
1627
  let n = p.value;
1624
- p.value = t, t === "connected" && n !== null && n !== "connected" && Y(e, !0);
1628
+ p.value = t, t === "connected" && n !== null && n !== "connected" && we(e, !0);
1625
1629
  }
1626
- function Ee(e) {
1627
- v && v.templateId === e?.id || (v &&= (z(), Te(v), null), a.value = [], s.value = /* @__PURE__ */ new Map(), p.value = null, A = null, Pe(), R(), e && we(e));
1630
+ function Oe(e, t) {
1631
+ v && v.templateId === e?.id || (v &&= (ae(), Ee(v), null), a.value = [], s.value = /* @__PURE__ */ new Map(), p.value = null, j = null, Q(), B(), e && Te(e, t));
1628
1632
  }
1629
- function De(e, t) {
1633
+ function ke(e, t) {
1630
1634
  return `${e}\u0000${t ?? ""}`;
1631
1635
  }
1632
- function Oe(e, t, n) {
1636
+ function Ae(e, t, n) {
1633
1637
  return e.blockId === t && (n == null || e.locale == null || e.locale === n);
1634
1638
  }
1635
- function ke(e) {
1639
+ function je(e) {
1636
1640
  return [...s.value.values()].filter((t) => t.blockId === e);
1637
1641
  }
1638
- function Ae(e) {
1639
- e !== f.value && (V(), f.value = e, ze(_?.state.selectedBlockId ?? null));
1642
+ function Me(e) {
1643
+ e !== f.value && (U(), f.value = e, Be(_?.state.selectedBlockId ?? null));
1640
1644
  }
1641
- function je(e, t = !1) {
1645
+ function X(e, t = !1) {
1642
1646
  if (e.holder.sessionId === n) return;
1643
1647
  t ? l.add(e) : u.set(e, ++d);
1644
1648
  let r = new Map([...s.value].filter(([, t]) => t.holder.sessionId !== e.holder.sessionId));
1645
- r.set(De(e.blockId, e.locale), e), s.value = r, _?.state.selectedBlockId === e.blockId && (f.value === null || e.locale == null || e.locale === f.value) && (_.selectBlock(null), L({
1649
+ r.set(ke(e.blockId, e.locale), e), s.value = r, _?.state.selectedBlockId === e.blockId && (f.value === null || e.locale == null || e.locale === f.value) && (_.selectBlock(null), R({
1646
1650
  type: "selectionRefused",
1647
1651
  blockId: e.blockId,
1648
1652
  holder: e.holder
1649
1653
  }));
1650
1654
  }
1651
- function Me(e, t, n) {
1652
- let r = De(e, n), i = new Map([...s.value].filter(([n, i]) => i.holder.sessionId !== t || n !== r && !(i.blockId === e && l.has(i))));
1655
+ function Ne(e, t, n) {
1656
+ let r = ke(e, n), i = new Map([...s.value].filter(([n, i]) => i.holder.sessionId !== t || n !== r && !(i.blockId === e && l.has(i))));
1653
1657
  i.size !== s.value.size && (s.value = i);
1654
1658
  }
1655
- function Ne(e, t, r) {
1659
+ function Pe(e, t, r) {
1656
1660
  let i = new Map([...s.value].filter(([, e]) => !l.has(e) && (t || (u.get(e) ?? 0) > r))), a = [...i.values()];
1657
- 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))) {
1661
+ for (let t of e) if (t.holder.sessionId !== n && !a.some((e) => e.holder.sessionId === t.holder.sessionId || Ae(e, t.blockId, t.locale))) {
1658
1662
  for (let [e, n] of i) n.holder.sessionId === t.holder.sessionId && i.delete(e);
1659
- i.set(De(t.blockId, t.locale), t);
1663
+ i.set(ke(t.blockId, t.locale), t);
1660
1664
  }
1661
1665
  s.value = i;
1662
1666
  }
@@ -1666,84 +1670,87 @@ function wt(e) {
1666
1670
  let r = new Map([...s.value].filter(([, e]) => !n.has(e.holder.sessionId)));
1667
1671
  r.size !== s.value.size && (s.value = r);
1668
1672
  }
1669
- function Q(e) {
1670
- M = M.then(e).catch(I);
1673
+ function Fe(e) {
1674
+ te = te.then(e).catch(L);
1671
1675
  }
1672
- function Pe() {
1673
- i && Q(async () => {
1674
- if (j && (A === null || j.templateId !== A.templateId || j.locale !== A.locale)) {
1675
- let e = j;
1676
- j = null, Re(), await t.releaseLock(e.templateId, e.blockId, e.locale);
1676
+ function Q() {
1677
+ i && Fe(async () => {
1678
+ if (M && (j === null || M.templateId !== j.templateId || M.locale !== j.locale)) {
1679
+ let e = M;
1680
+ M = null, ze(), await t.releaseLock(e.templateId, e.blockId, e.locale);
1677
1681
  }
1678
- let e = A;
1679
- if (!(!e || j?.templateId === e.templateId && j.blockId === e.blockId && j.locale === e.locale)) try {
1682
+ let e = j;
1683
+ if (!(!e || M?.templateId === e.templateId && M.blockId === e.blockId && M.locale === e.locale)) try {
1680
1684
  let n = await t.acquireLock(e.templateId, e.blockId, e.locale);
1681
- j = e, Le(), Fe(n.blockId, n.locale ?? null);
1685
+ M = e, Re(), Ie(n.blockId, n.locale ?? null);
1682
1686
  } catch (n) {
1683
- if (j?.templateId === e.templateId) {
1684
- let e = j;
1685
- j = null, Re(), await t.releaseLock(e.templateId, e.blockId, e.locale).catch(() => {});
1687
+ if (M?.templateId === e.templateId) {
1688
+ let e = M;
1689
+ M = null, ze(), await t.releaseLock(e.templateId, e.blockId, e.locale).catch(() => {});
1686
1690
  }
1687
- if (A !== e) return;
1688
- Ie(e.blockId, n);
1691
+ if (j !== e) return;
1692
+ Le(e.blockId, n);
1689
1693
  }
1690
1694
  });
1691
1695
  }
1692
- function Fe(e, t) {
1693
- let n = new Map([...s.value].filter(([, n]) => !Oe(n, e, t)));
1696
+ function Ie(e, t) {
1697
+ let n = new Map([...s.value].filter(([, n]) => !Ae(n, e, t)));
1694
1698
  n.size !== s.value.size && (s.value = n);
1695
1699
  }
1696
- function Ie(e, t) {
1700
+ function Le(e, t) {
1697
1701
  let n = vt(t);
1698
1702
  if (n === "lock_held" || n === "block_missing") {
1699
- A = null;
1703
+ j = null;
1700
1704
  let n = yt(t);
1701
- n ? je({
1705
+ n ? X({
1702
1706
  blockId: e,
1703
1707
  holder: n,
1704
1708
  expiresAt: ""
1705
1709
  }, !0) : _?.state.selectedBlockId === e && _.selectBlock(null);
1706
- } else I(t), setTimeout(() => {
1707
- A?.blockId === e && Pe();
1710
+ } else L(t), setTimeout(() => {
1711
+ j?.blockId === e && Q();
1708
1712
  }, pt[0]);
1709
1713
  }
1710
- function Le() {
1714
+ function Re() {
1711
1715
  N ||= setInterval(() => {
1712
- Q(async () => {
1713
- let e = j;
1716
+ Fe(async () => {
1717
+ let e = M;
1714
1718
  if (e) try {
1715
1719
  await t.renewLock(e.templateId, e.blockId, e.locale);
1716
1720
  } catch (e) {
1717
1721
  if (vt(e) === "lock_lost") {
1718
- j = null, Re(), Pe();
1722
+ M = null, ze(), Q();
1719
1723
  return;
1720
1724
  }
1721
- I(e);
1725
+ L(e);
1722
1726
  }
1723
1727
  });
1724
1728
  }, ft);
1725
1729
  }
1726
- function Re() {
1730
+ function ze() {
1727
1731
  N &&= (clearInterval(N), null);
1728
1732
  }
1729
- function ze(e) {
1730
- V(), v && (A = e ? {
1733
+ function Be(e) {
1734
+ U(), v && (j = e ? {
1731
1735
  templateId: v.templateId,
1732
1736
  blockId: e,
1733
1737
  locale: f.value
1734
- } : null, Pe());
1738
+ } : null, Q());
1735
1739
  }
1736
- function Be() {
1737
- V(), j && i && (t.releaseLock(j.templateId, j.blockId, j.locale).catch(() => {}), j = null, Re()), v?.leave?.(), v && (v.leave = null);
1740
+ function Ve() {
1741
+ U(), M && i && (t.releaseLock(M.templateId, M.blockId, M.locale).catch(() => {}), M = null, ze()), v?.leave?.(), v && (v.leave = null);
1738
1742
  }
1739
- function Ve(e) {
1743
+ function He() {
1744
+ v && (v.undo = [], v.redo = [], B());
1745
+ }
1746
+ function Ue(e) {
1740
1747
  let t = v;
1741
1748
  if (!t || y) return;
1742
- V();
1749
+ U();
1743
1750
  let n = (e === "undo" ? t.undo : t.redo).pop();
1744
1751
  if (!n) return;
1745
- if (R(), n.view && !G(n.view, t.view)) {
1746
- L({
1752
+ if (B(), n.view && !q(n.view, t.view)) {
1753
+ R({
1747
1754
  type: "undoSkipped",
1748
1755
  code: "precondition_failed"
1749
1756
  });
@@ -1751,41 +1758,41 @@ function wt(e) {
1751
1758
  }
1752
1759
  let r;
1753
1760
  try {
1754
- r = O(t.view, n.ops, ie());
1761
+ r = O(t.view, n.ops, z());
1755
1762
  } catch (e) {
1756
- if (!(e instanceof P)) throw e;
1757
- L({
1763
+ if (!(e instanceof F)) throw e;
1764
+ R({
1758
1765
  type: "undoSkipped",
1759
1766
  code: e.code
1760
1767
  });
1761
1768
  return;
1762
1769
  }
1763
- let i = _t({ ops: ne(t.view, n.ops) }, r);
1764
- ae(e === "undo" ? t.redo : t.undo, i);
1770
+ let i = _t({ ops: P(t.view, n.ops) }, r);
1771
+ re(e === "undo" ? t.redo : t.undo, i);
1765
1772
  let a = t.view;
1766
- t.view = r, oe(r), _?.markDirty(), le(t, n.ops, e, i, a);
1773
+ t.view = r, V(r), _?.markDirty(), se(t, n.ops, e, i, a);
1767
1774
  }
1768
- function He(e, t) {
1775
+ function We(e, t) {
1769
1776
  let n = v;
1770
1777
  if (!_ || !n || y) return {
1771
1778
  applied: !1,
1772
- error: new P("invalid_operation", 0, "No template is open for editing.")
1779
+ error: new F("invalid_operation", 0, "No template is open for editing.")
1773
1780
  };
1774
1781
  if (t.origin === void 0) try {
1775
- O(_.content.value, e, ie());
1782
+ O(_.content.value, e, z());
1776
1783
  } catch (e) {
1777
- if (e instanceof P) return {
1784
+ if (e instanceof F) return {
1778
1785
  applied: !1,
1779
1786
  error: e
1780
1787
  };
1781
1788
  throw e;
1782
1789
  }
1783
- V();
1790
+ U();
1784
1791
  let r, i;
1785
1792
  try {
1786
- r = O(n.view, e, ie()), i = ne(n.view, e);
1793
+ r = O(n.view, e, z()), i = P(n.view, e);
1787
1794
  } catch (e) {
1788
- if (e instanceof P) return {
1795
+ if (e instanceof F) return {
1789
1796
  applied: !1,
1790
1797
  error: e
1791
1798
  };
@@ -1793,91 +1800,101 @@ function wt(e) {
1793
1800
  }
1794
1801
  let a = n.undo.at(-1), o;
1795
1802
  if (t.origin === "ai" && t.turn !== void 0 && a && a.turn === t.turn) {
1796
- let e = a.view !== void 0 && !G(a.view, n.view);
1803
+ let e = a.view !== void 0 && !q(a.view, n.view);
1797
1804
  a.ops = [...i, ...a.ops], o = e ? a : _t(a, r);
1798
1805
  } else o = _t({
1799
1806
  ops: i,
1800
1807
  ...t.origin === "ai" && t.turn !== void 0 ? { turn: t.turn } : {}
1801
- }, r), ae(n.undo, o);
1802
- n.redo = [], R();
1808
+ }, r), re(n.undo, o);
1809
+ n.redo = [], B();
1803
1810
  let s = n.view;
1804
- return n.view = r, oe(r), _.markDirty(), le(n, e, t.origin ?? "edit", o, s), {
1811
+ return n.view = r, V(r), _.markDirty(), se(n, e, t.origin ?? "edit", o, s), {
1805
1812
  applied: !0,
1806
1813
  inverse: i
1807
1814
  };
1808
1815
  }
1809
- function Ue(e) {
1816
+ function Ge(e) {
1810
1817
  _ = e;
1811
- let t = e;
1812
- if (t.moveBlock && t.findBlockLocation) {
1813
- let n = t.moveBlock, r = (...r) => {
1818
+ let t = e.contentReplaced?.value ?? 0, n = e;
1819
+ if (n.moveBlock && n.findBlockLocation) {
1820
+ let t = n.moveBlock, r = (...r) => {
1814
1821
  let i = v, a = i && !y && !C && !e.state.isLoading && e.state.template?.id === i.templateId;
1815
- if (a && B(!0), n(...r), !a || G(i.view, e.content.value)) return;
1816
- let o = t.findBlockLocation(r[0]);
1822
+ if (a && H(!0), t(...r), !a || q(i.view, e.content.value)) return;
1823
+ let o = n.findBlockLocation(r[0]);
1817
1824
  if (!o) return;
1818
1825
  let s = o.targetSectionId ? {
1819
1826
  sectionId: o.targetSectionId,
1820
1827
  column: o.columnIndex ?? 0
1821
1828
  } : null, c = s ? e.content.value.blocks.find((e) => e.id === s.sectionId) : void 0;
1822
- ce(i, [{
1829
+ oe(i, [{
1823
1830
  op: "moveBlock",
1824
1831
  blockId: r[0],
1825
1832
  parent: s,
1826
1833
  after: (s && c?.type === "section" ? c.children[s.column] : e.content.value.blocks)[o.index - 1]?.id ?? null
1827
1834
  }]);
1828
1835
  };
1829
- t.moveBlock = r, ee.push(() => {
1830
- t.moveBlock === r && (t.moveBlock = n);
1836
+ n.moveBlock = r, A.push(() => {
1837
+ n.moveBlock === r && (n.moveBlock = t);
1831
1838
  });
1832
1839
  }
1833
- ee.push(h(() => e.state.template, (e) => Ee(e), { immediate: !0 }), h(() => e.content.value, se, { deep: !0 }), h(() => e.state.selectedBlockId, ze), h(() => e.state.isLoading, (e) => e ? B(!0, !0) : se())), typeof window < "u" && (window.addEventListener("pagehide", Be), window.addEventListener("blur", V)), c() && o(qe);
1840
+ A.push(h(() => e.state.template, (t) => {
1841
+ e.loadVersion && e.contentReplaced && e.state.isLoading || Oe(t);
1842
+ }, { immediate: !0 }), h(() => e.content.value, ie, { deep: !0 }), h(() => e.state.selectedBlockId, Be), h(() => e.state.isLoading, (e) => e ? H(!0, !0) : ie()));
1843
+ let r = e.contentReplaced, i = e.loadVersion;
1844
+ r && i && A.push(h(r, He), h(i, () => {
1845
+ let n = r.value !== t;
1846
+ t = r.value;
1847
+ let i = e.state.template;
1848
+ v?.templateId === i?.id ? n && v && i && Y(v, i) : Oe(i, !n && v && i ? {
1849
+ undo: v.undo,
1850
+ redo: v.redo
1851
+ } : void 0);
1852
+ })), typeof window < "u" && (window.addEventListener("pagehide", Ve), window.addEventListener("blur", U)), c() && o(Ye);
1834
1853
  }
1835
- function We() {
1836
- V();
1854
+ function Ke() {
1855
+ U();
1837
1856
  let e = v;
1838
1857
  return !e || e.pending.length === 0 ? Promise.resolve() : new Promise((t, n) => e.waiters.push({
1839
1858
  resolve: t,
1840
1859
  reject: n
1841
1860
  }));
1842
1861
  }
1843
- function Ge() {
1844
- V(), y = !0;
1862
+ function qe() {
1863
+ U(), y = !0;
1845
1864
  }
1846
- function Ke() {
1847
- y = !1, v && oe(v.view);
1865
+ function Je() {
1866
+ y = !1, v && V(v.view);
1848
1867
  }
1849
- function qe() {
1868
+ function Ye() {
1850
1869
  if (!k) {
1851
- V();
1852
- for (let e of ee.splice(0)) e();
1853
- z(), Be(), k = !0, v && Te(v), v = null, Re(), typeof window < "u" && (window.removeEventListener("pagehide", Be), window.removeEventListener("blur", V));
1870
+ U();
1871
+ for (let e of A.splice(0)) e();
1872
+ ae(), Ve(), k = !0, v && Ee(v), v = null, ze(), typeof window < "u" && (window.removeEventListener("pagehide", Ve), window.removeEventListener("blur", U));
1854
1873
  }
1855
1874
  }
1856
1875
  return {
1857
1876
  sessionId: n,
1858
1877
  members: a,
1859
1878
  locks: s,
1860
- locksOf: ke,
1879
+ locksOf: je,
1861
1880
  lockLocale: f,
1862
- setLockLocale: Ae,
1881
+ setLockLocale: Me,
1863
1882
  connection: p,
1864
1883
  revision: m,
1865
- canUndo: F,
1866
- canRedo: re,
1867
- attach: Ue,
1868
- undo: () => Ve("undo"),
1869
- redo: () => Ve("redo"),
1870
- clearHistory: () => {
1871
- v && (v.undo = [], v.redo = [], R());
1872
- },
1873
- flush: V,
1874
- settle: We,
1875
- suspend: Ge,
1876
- resume: Ke,
1877
- catchUp: q,
1884
+ canUndo: I,
1885
+ canRedo: ne,
1886
+ attach: Ge,
1887
+ undo: () => Ue("undo"),
1888
+ redo: () => Ue("redo"),
1889
+ clearHistory: He,
1890
+ flush: U,
1891
+ settle: Ke,
1892
+ suspend: qe,
1893
+ resume: Je,
1894
+ catchUp: J,
1878
1895
  hasConfirmedBlock: (e) => v ? xt(v.confirmed.blocks, e) : !1,
1879
- applyOperations: He,
1880
- destroy: qe
1896
+ applyOperations: We,
1897
+ destroy: Ye
1881
1898
  };
1882
1899
  }
1883
1900
  // ../core/src/saved-blocks.ts
@@ -1897,10 +1914,10 @@ function Tt(e) {
1897
1914
  return s.value && e.canDelete !== !1;
1898
1915
  }
1899
1916
  function u(e, t) {
1900
- throw new W(`[Templatical] Saved blocks: ${e} is ${t}. Check the capability before calling — the editor's own UI hides the action.`);
1917
+ throw new K(`[Templatical] Saved blocks: ${e} is ${t}. Check the capability before calling — the editor's own UI hides the action.`);
1901
1918
  }
1902
1919
  function d(t) {
1903
- Fe(e.onError, t);
1920
+ Q(e.onError, t);
1904
1921
  }
1905
1922
  async function f(i) {
1906
1923
  r.value = !0;
@@ -1995,7 +2012,7 @@ function Dt(e = {}) {
1995
2012
  },
1996
2013
  async create(e) {
1997
2014
  let t = (/* @__PURE__ */ new Date()).toISOString(), n = {
1998
- id: j(),
2015
+ id: M(),
1999
2016
  name: e.name,
2000
2017
  content: e.content,
2001
2018
  ...e.category ? { category: e.category } : {},
@@ -2062,7 +2079,7 @@ function At(e = {}) {
2062
2079
  },
2063
2080
  async create(e) {
2064
2081
  let t = await a(e.file), n = (/* @__PURE__ */ new Date()).toISOString(), o = {
2065
- id: j(),
2082
+ id: M(),
2066
2083
  url: t,
2067
2084
  filename: e.filename || e.file.name,
2068
2085
  createdAt: n,
@@ -2102,14 +2119,14 @@ function jt(e) {
2102
2119
  let { provider: t, getTemplateId: n } = e, r = S([]), i = S(!1), a = S(void 0), o = S(!1), s = /* @__PURE__ */ new Map(), c = v(() => typeof t.create == "function"), l = v(() => typeof t.restore == "function");
2103
2120
  function u(e) {
2104
2121
  let t = n();
2105
- if (!t) throw new W(`[Templatical] Version history: ${e} needs a template. Call create() or load() first.`);
2122
+ if (!t) throw new K(`[Templatical] Version history: ${e} needs a template. Call create() or load() first.`);
2106
2123
  return t;
2107
2124
  }
2108
2125
  function d(e) {
2109
- throw new W(`[Templatical] Version history: ${e} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`);
2126
+ throw new K(`[Templatical] Version history: ${e} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`);
2110
2127
  }
2111
2128
  function f(t) {
2112
- Fe(e.onError, t);
2129
+ Q(e.onError, t);
2113
2130
  }
2114
2131
  async function p(n) {
2115
2132
  let o = u("list");
@@ -2185,16 +2202,16 @@ function Mt(e) {
2185
2202
  });
2186
2203
  function m(e) {
2187
2204
  let t = n();
2188
- if (!t) throw new W(`[Templatical] Comments: ${e} needs a template. Call create() or load() first.`);
2205
+ if (!t) throw new K(`[Templatical] Comments: ${e} needs a template. Call create() or load() first.`);
2189
2206
  return t;
2190
2207
  }
2191
2208
  function h(e) {
2192
2209
  let t = r();
2193
- if (!t) throw new W(`[Templatical] Comments: ${e} needs to know who is commenting. Pass init({ user: { id, name } }) — an unattributed comment is not written.`);
2210
+ if (!t) throw new K(`[Templatical] Comments: ${e} needs to know who is commenting. Pass init({ user: { id, name } }) — an unattributed comment is not written.`);
2194
2211
  return t;
2195
2212
  }
2196
2213
  function g(e) {
2197
- throw new W(`[Templatical] Comments: ${e} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`);
2214
+ throw new K(`[Templatical] Comments: ${e} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`);
2198
2215
  }
2199
2216
  function _(e) {
2200
2217
  for (let t of i.value) {
@@ -2208,11 +2225,11 @@ function Mt(e) {
2208
2225
  return t !== null && e.author.id === t.id;
2209
2226
  }
2210
2227
  function b(t) {
2211
- let n = Pe(t);
2228
+ let n = Fe(t);
2212
2229
  throw e.onError?.(n), n;
2213
2230
  }
2214
2231
  function x(t) {
2215
- Fe(e.onError, t);
2232
+ Q(e.onError, t);
2216
2233
  }
2217
2234
  function C(e, t, n) {
2218
2235
  return [
@@ -2290,7 +2307,7 @@ function Mt(e) {
2290
2307
  o.value = !1;
2291
2308
  }
2292
2309
  }
2293
- async function ee(e) {
2310
+ async function A(e) {
2294
2311
  let { delete: n } = t;
2295
2312
  typeof n != "function" && g("delete");
2296
2313
  let r = m("delete");
@@ -2305,7 +2322,7 @@ function Mt(e) {
2305
2322
  o.value = !1;
2306
2323
  }
2307
2324
  }
2308
- async function A(e, n) {
2325
+ async function j(e, n) {
2309
2326
  let { setResolved: r } = t;
2310
2327
  typeof r != "function" && g("setResolved");
2311
2328
  let i = m("setResolved");
@@ -2319,13 +2336,13 @@ function Mt(e) {
2319
2336
  o.value = !1;
2320
2337
  }
2321
2338
  }
2322
- function j(e) {
2339
+ function M(e) {
2323
2340
  T(e) && x(() => t.onCreated?.(e, { origin: "remote" }));
2324
2341
  }
2325
- function te(e) {
2342
+ function ee(e) {
2326
2343
  T(e) && x(() => (e.resolvedAt ? t.onResolved : t.onUpdated)?.(e, { origin: "remote" }));
2327
2344
  }
2328
- function M(e, n) {
2345
+ function te(e, n) {
2329
2346
  let r = E(e, n);
2330
2347
  r && x(() => t.onDeleted?.(r, { origin: "remote" }));
2331
2348
  }
@@ -2343,13 +2360,13 @@ function Mt(e) {
2343
2360
  load: D,
2344
2361
  create: O,
2345
2362
  update: k,
2346
- remove: ee,
2347
- setResolved: A,
2363
+ remove: A,
2364
+ setResolved: j,
2348
2365
  find: _,
2349
2366
  isOwn: y,
2350
- applyRemoteCreate: j,
2351
- applyRemoteUpdate: te,
2352
- applyRemoteDelete: M
2367
+ applyRemoteCreate: M,
2368
+ applyRemoteUpdate: ee,
2369
+ applyRemoteDelete: te
2353
2370
  };
2354
2371
  }
2355
2372
  function Nt(e) {
@@ -2406,7 +2423,7 @@ function Ft(t) {
2406
2423
  };
2407
2424
  }
2408
2425
  function It(e) {
2409
- let t = a(ve, null), n = v(e);
2426
+ let t = a(_e, null), n = v(e);
2410
2427
  if (!t) return n;
2411
2428
  let i;
2412
2429
  function s() {
@@ -2433,14 +2450,14 @@ function Lt(e, t) {
2433
2450
  return typeof n == "string" && n.length > 0 ? n : t;
2434
2451
  }
2435
2452
  function Rt(e, t) {
2436
- return typeof e?.url == "string" && L(e.url, t);
2453
+ return typeof e?.url == "string" && R(e.url, t);
2437
2454
  }
2438
2455
  function zt(e, t) {
2439
2456
  let n = e?.url;
2440
- if (typeof n == "string" && n.trim() !== "") return L(n, t) ? void 0 : n;
2457
+ if (typeof n == "string" && n.trim() !== "") return R(n, t) ? void 0 : n;
2441
2458
  }
2442
2459
  function Bt(e) {
2443
- let t = a(_e, ee.liquid), n = It(() => zt(e(), t));
2460
+ let t = a(ge, A.liquid), n = It(() => zt(e(), t));
2444
2461
  return v(() => Rt(e(), t) ? null : n.value);
2445
2462
  }
2446
2463
  function Vt(e, t, n) {
@@ -2457,7 +2474,7 @@ function Ut(e, t, n = []) {
2457
2474
  }
2458
2475
  // src/utils/resolveFieldColors.ts
2459
2476
  function Wt(e, t) {
2460
- let n = q({ presets: e.presets }, Ce), r = n.presets.length === 0;
2477
+ let n = J({ presets: e.presets }, Se), r = n.presets.length === 0;
2461
2478
  return {
2462
2479
  presets: r ? t.presets : n.presets,
2463
2480
  allowCustom: t.allowCustom === !1 ? !1 : e.allowCustom ?? t.allowCustom,
@@ -2517,7 +2534,7 @@ var Zt = /* @__PURE__ */ t({
2517
2534
  size: { default: "field" }
2518
2535
  },
2519
2536
  setup(e) {
2520
- let t = e, { t: r } = xe(), i = {
2537
+ let t = e, { t: r } = be(), i = {
2521
2538
  field: {
2522
2539
  gap: "tpl:gap-1.5",
2523
2540
  icon: 18,
@@ -2532,11 +2549,11 @@ var Zt = /* @__PURE__ */ t({
2532
2549
  return (t, i) => (n(), l("div", {
2533
2550
  class: p(["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)]", a.value.gap]),
2534
2551
  style: y({ backgroundColor: `color-mix(in srgb, var(--tpl-bg) ${a.value.veil}, transparent)` })
2535
- }, [e.uploading ? (n(), l(C, { key: 0 }, [w(f(K), {
2552
+ }, [e.uploading ? (n(), l(C, { key: 0 }, [w(f(me), {
2536
2553
  class: "tpl-spinner",
2537
2554
  size: a.value.icon,
2538
2555
  "stroke-width": 2
2539
- }, null, 8, ["size"]), d(" " + g(f(r).image.uploading), 1)], 64)) : (n(), l(C, { key: 1 }, [w(f(ge), {
2556
+ }, null, 8, ["size"]), d(" " + g(f(r).image.uploading), 1)], 64)) : (n(), l(C, { key: 1 }, [w(f(he), {
2540
2557
  size: a.value.icon,
2541
2558
  "stroke-width": 1.5
2542
2559
  }, null, 8, ["size"]), d(" " + g(f(r).image.dropToUpload), 1)], 64))], 6));
@@ -2552,7 +2569,7 @@ function Qt() {
2552
2569
  // src/composables/useImageDrop.ts
2553
2570
  var $t = "image/";
2554
2571
  function en(e) {
2555
- let { target: t, onFiles: n, enabled: r } = e, i = () => r === void 0 || _(r), { isOverDropZone: a } = Se(t, {
2572
+ let { target: t, onFiles: n, enabled: r } = e, i = () => r === void 0 || _(r), { isOverDropZone: a } = xe(t, {
2556
2573
  preventDefaultForUnhandled: !0,
2557
2574
  onDrop: (e) => {
2558
2575
  if (!i()) return;
@@ -2564,7 +2581,7 @@ function en(e) {
2564
2581
  }
2565
2582
  // src/composables/useMediaDropField.ts
2566
2583
  function tn(e) {
2567
- let { target: t, blocked: n, apply: r } = e, i = a(ye, null), o = a(be, null), s = Qt();
2584
+ let { target: t, blocked: n, apply: r } = e, i = a(ve, null), o = a(ye, null), s = Qt();
2568
2585
  async function c() {
2569
2586
  let e = await i?.({ accept: ["images"] });
2570
2587
  s.alive && e && r(e);
@@ -2637,23 +2654,23 @@ function cn(e, t) {
2637
2654
  return Math.floor(t) - on(e.styles.padding, n);
2638
2655
  }
2639
2656
  function* ln(e, t) {
2640
- for (let n of e) le(n) ? yield* ln(n.children, sn(t, n.styles.padding)) : yield {
2657
+ for (let n of e) se(n) ? yield* ln(n.children, sn(t, n.styles.padding)) : yield {
2641
2658
  block: n,
2642
- bandWidth: pe(n) && n.wrapper ? sn(t, n.wrapper.padding) : t
2659
+ bandWidth: de(n) && n.wrapper ? sn(t, n.wrapper.padding) : t
2643
2660
  };
2644
2661
  }
2645
- function un(e, t, n = A(e)) {
2662
+ function un(e, t, n = j(e)) {
2646
2663
  if (!t) return e;
2647
2664
  try {
2648
- return ue(T(t, n, { missing: "default" }), e);
2665
+ return ce(T(t, n, { missing: "default" }), e);
2649
2666
  } catch {
2650
2667
  return e;
2651
2668
  }
2652
2669
  }
2653
2670
  function dn(e, t, n, r) {
2654
2671
  let i = un(e, n, r);
2655
- for (let { block: e, bandWidth: n } of ln(i.blocks, i.settings.width)) if (pe(e)) {
2656
- let r = z(e)?.applied ? void 0 : e.border, i = Math.floor(n) - on(e.styles.padding, r), a = an[e.columns] ?? [100];
2672
+ for (let { block: e, bandWidth: n } of ln(i.blocks, i.settings.width)) if (de(e)) {
2673
+ let r = ae(e)?.applied ? void 0 : e.border, i = Math.floor(n) - on(e.styles.padding, r), a = an[e.columns] ?? [100];
2657
2674
  for (let n = 0; n < e.children.length; n++) {
2658
2675
  let r = Math.floor(i * (a[n] ?? 100) / 100), o = e.children[n].find((e) => e.id === t);
2659
2676
  if (o) return cn(o, r);
@@ -2667,14 +2684,14 @@ function fn(e, t, n, r) {
2667
2684
  return null;
2668
2685
  }
2669
2686
  function pn(e) {
2670
- let t = pe(e) ? z(e) : null;
2687
+ let t = de(e) ? ae(e) : null;
2671
2688
  return !!t?.applied && t.height === "image";
2672
2689
  }
2673
2690
  function mn(e, t, n, r) {
2674
2691
  if (pn(e)) return (t ? fn(t, e.id, n, r) : null) ?? nn(t?.settings);
2675
2692
  }
2676
2693
  // src/constants/socialIcons.ts
2677
- var hn = se, gn = {
2694
+ var hn = ie, gn = {
2678
2695
  small: 24,
2679
2696
  medium: 32,
2680
2697
  large: 48
@@ -2700,4 +2717,4 @@ var hn = se, gn = {
2700
2717
  ];
2701
2718
  export { Dt as A, Be as B, Vt as C, Mt as D, Nt as E, Ge as F, We as I, He as L, wt as M, ut as N, jt as O, Ke as P, Ue as R, zt as S, It as T, Ie as V, Kt as _, pn as a, Ht as b, rn as c, Qt as d, Zt as f, qt as g, Jt as h, dn as i, Tt as j, At as k, nn as l, Xt as m, hn as n, mn as o, Yt as p, _n as r, fn as s, gn as t, tn as u, Wt as v, Bt as w, Ft as x, Ut as y, Ve as z };
2702
2719
 
2703
- //# sourceMappingURL=socialIcons-CkgQUpim.js.map
2720
+ //# sourceMappingURL=socialIcons-bvQ57o1m.js.map