@templatical/editor 0.54.1 → 0.55.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 (172) hide show
  1. package/dist/{AiAltTextPopover-NMJqQKvD.js → AiAltTextPopover-D5QosKvB.js} +1 -1
  2. package/dist/{AiAltTextReview-Ci4zHwRc.js → AiAltTextReview-D1W_lrI_.js} +1 -1
  3. package/dist/{AiRewriteMenu-arKoTjsQ.js → AiRewriteMenu-BwztoMov.js} +4 -4
  4. package/dist/{BlockPreviewCanvas-BTieuBmH.js → BlockPreviewCanvas-C23A6FRm.js} +6 -6
  5. package/dist/{CloudPanels-Hxdp0doU.js → CloudPanels-Baoaj6Xf.js} +1 -1
  6. package/dist/{CountdownToolbar-CM4XNEuO.js → CountdownToolbar-CA_gDIdZ.js} +4 -4
  7. package/dist/{IssuesPanel-1wGV0wiy.js → IssuesPanel-nmFhWG1p.js} +1 -1
  8. package/dist/{LanguageMenu-BpxbIJEx.js → LanguageMenu-DcABUYop.js} +5 -5
  9. package/dist/{LogicTagInsertButton-DgTJ6Lvx.js → LogicTagInsertButton-qZ82VMFx.js} +284 -279
  10. package/dist/{MergeTagInput-B_51YcQO.js → MergeTagInput-JJeZbFkD.js} +1 -1
  11. package/dist/{MergeTagModeToggle-D3Q2z317.js → MergeTagModeToggle-DDucd1eC.js} +1 -1
  12. package/dist/{MergeTagTextarea-DZz1L9DE.js → MergeTagTextarea-dQ2LRrNB.js} +2 -2
  13. package/dist/{ParagraphEditor-B38t4E2p.js → ParagraphEditor-VXYwGoz_.js} +8 -8
  14. package/dist/{RestoreVersionDialog-n7FSmWXB.js → RestoreVersionDialog-BibNvAaJ.js} +1 -1
  15. package/dist/{RichTextEditorContent-Dstovi0m.js → RichTextEditorContent-CU5EOlM_.js} +2 -2
  16. package/dist/{SaveBlockDialog-B94NpmDV.js → SaveBlockDialog-S9aFi0cy.js} +4 -4
  17. package/dist/{SavedBlocksBrowserModal-C1vSc8iM.js → SavedBlocksBrowserModal-DIdn6B0J.js} +4 -4
  18. package/dist/{SavedBlocksPanels-DLDmIYeL.js → SavedBlocksPanels-Cme2M6u8.js} +1 -1
  19. package/dist/{SavedBlocksPickBar-ngf2sFEs.js → SavedBlocksPickBar-BDmA7r3m.js} +1 -1
  20. package/dist/{TemplateSettings-Baar78_s.js → TemplateSettings-C_LHLm5M.js} +4 -4
  21. package/dist/{TestEmailModal-CB_9I1bl.js → TestEmailModal-CLIRn7eL.js} +5 -5
  22. package/dist/{TestEmailPanel-BUq-dbXQ.js → TestEmailPanel-frdtjC8h.js} +1 -1
  23. package/dist/{TitleEditor-BLP41rwy.js → TitleEditor-D5kC56Jl.js} +4 -4
  24. package/dist/{Toolbar-bOZ_eq7X.js → Toolbar-D904Yw_R.js} +747 -699
  25. package/dist/{TplModal-DFKqmJQz.js → TplModal-BBdotDf1.js} +1 -1
  26. package/dist/{VersionHistoryPanels-DPxj3mec.js → VersionHistoryPanels-DhagEgOk.js} +1 -1
  27. package/dist/{WrapperBlock-BdVIuGMR.js → WrapperBlock-BAT3T0Cz.js} +3 -3
  28. package/dist/{blockTypeIcons-BUyPZ7Su.js → blockTypeIcons-CoRQV_hP.js} +1 -1
  29. package/dist/bundle-stats.json +6 -6
  30. package/dist/{cdn/chunks/ca-DOuIxWRv.js → ca-DIkMxYCN.js} +10 -3
  31. package/dist/cdn/chunks/{AiAltTextPopover-Cnc_kUmb.js → AiAltTextPopover-CUGOPuRo.js} +2 -2
  32. package/dist/cdn/chunks/{AiAltTextPopover-Cnc_kUmb.js.map → AiAltTextPopover-CUGOPuRo.js.map} +1 -1
  33. package/dist/cdn/chunks/{AiAltTextReview-DPeSY-7r.js → AiAltTextReview-B9vm_L-8.js} +2 -2
  34. package/dist/cdn/chunks/{AiAltTextReview-DPeSY-7r.js.map → AiAltTextReview-B9vm_L-8.js.map} +1 -1
  35. package/dist/cdn/chunks/{AiRewriteMenu-YcVFv6RS.js → AiRewriteMenu-BvV_7tNZ.js} +7 -7
  36. package/dist/cdn/chunks/{AiRewriteMenu-YcVFv6RS.js.map → AiRewriteMenu-BvV_7tNZ.js.map} +1 -1
  37. package/dist/cdn/chunks/{BlockPreviewCanvas-6ck15xz9.js → BlockPreviewCanvas-Dr-xGq6v.js} +7 -7
  38. package/dist/cdn/chunks/{BlockPreviewCanvas-6ck15xz9.js.map → BlockPreviewCanvas-Dr-xGq6v.js.map} +1 -1
  39. package/dist/cdn/chunks/{CloudPanels-BHHpNckC.js → CloudPanels-CQ0vNgsH.js} +2 -2
  40. package/dist/cdn/chunks/{CloudPanels-BHHpNckC.js.map → CloudPanels-CQ0vNgsH.js.map} +1 -1
  41. package/dist/cdn/chunks/{CountdownToolbar-CNgsNL5-.js → CountdownToolbar-BxW-J7DX.js} +5 -5
  42. package/dist/cdn/chunks/{CountdownToolbar-CNgsNL5-.js.map → CountdownToolbar-BxW-J7DX.js.map} +1 -1
  43. package/dist/cdn/chunks/{IssuesPanel-Duic0mIs.js → IssuesPanel-BoHeIjvw.js} +3 -3
  44. package/dist/cdn/chunks/{IssuesPanel-Duic0mIs.js.map → IssuesPanel-BoHeIjvw.js.map} +1 -1
  45. package/dist/cdn/chunks/{LanguageMenu-C6utRx_4.js → LanguageMenu-BnYN5N1h.js} +7 -7
  46. package/dist/cdn/chunks/{LanguageMenu-C6utRx_4.js.map → LanguageMenu-BnYN5N1h.js.map} +1 -1
  47. package/dist/cdn/chunks/{LogicTagInsertButton-Bhvi0nWz.js → LogicTagInsertButton-Bt2PXbQ0.js} +255 -250
  48. package/dist/cdn/chunks/LogicTagInsertButton-Bt2PXbQ0.js.map +1 -0
  49. package/dist/cdn/chunks/{MergeTagInput-CrhZm-AW.js → MergeTagInput-BELdMRni.js} +2 -2
  50. package/dist/cdn/chunks/{MergeTagInput-CrhZm-AW.js.map → MergeTagInput-BELdMRni.js.map} +1 -1
  51. package/dist/cdn/chunks/{MergeTagModeToggle-CWVtXLYa.js → MergeTagModeToggle-DKfMDIEF.js} +2 -2
  52. package/dist/cdn/chunks/{MergeTagModeToggle-CWVtXLYa.js.map → MergeTagModeToggle-DKfMDIEF.js.map} +1 -1
  53. package/dist/cdn/chunks/{MergeTagTextarea-hTIBwX0F.js → MergeTagTextarea-w6xen3Xh.js} +5 -5
  54. package/dist/cdn/chunks/{MergeTagTextarea-hTIBwX0F.js.map → MergeTagTextarea-w6xen3Xh.js.map} +1 -1
  55. package/dist/cdn/chunks/{ParagraphEditor-B3EQ0Ai6.js → ParagraphEditor-Cal9hY3U.js} +9 -9
  56. package/dist/cdn/chunks/{ParagraphEditor-B3EQ0Ai6.js.map → ParagraphEditor-Cal9hY3U.js.map} +1 -1
  57. package/dist/cdn/chunks/{RestoreVersionDialog-DfNrVi0R.js → RestoreVersionDialog-f_ulmASY.js} +2 -2
  58. package/dist/cdn/chunks/{RestoreVersionDialog-DfNrVi0R.js.map → RestoreVersionDialog-f_ulmASY.js.map} +1 -1
  59. package/dist/cdn/chunks/{RichTextEditorContent-up4AqL7D.js → RichTextEditorContent-C_v0kS4A.js} +3 -3
  60. package/dist/cdn/chunks/{RichTextEditorContent-up4AqL7D.js.map → RichTextEditorContent-C_v0kS4A.js.map} +1 -1
  61. package/dist/cdn/chunks/{SaveBlockDialog-BqglcKcN.js → SaveBlockDialog-C6N9RFls.js} +5 -5
  62. package/dist/cdn/chunks/{SaveBlockDialog-BqglcKcN.js.map → SaveBlockDialog-C6N9RFls.js.map} +1 -1
  63. package/dist/cdn/chunks/{SavedBlocksBrowserModal-BewXGlrK.js → SavedBlocksBrowserModal-Bl2sl09D.js} +4 -4
  64. package/dist/cdn/chunks/{SavedBlocksBrowserModal-BewXGlrK.js.map → SavedBlocksBrowserModal-Bl2sl09D.js.map} +1 -1
  65. package/dist/cdn/chunks/{SavedBlocksPanels-0ZpX-jXI.js → SavedBlocksPanels-DqVcmEUK.js} +2 -2
  66. package/dist/cdn/chunks/{SavedBlocksPanels-0ZpX-jXI.js.map → SavedBlocksPanels-DqVcmEUK.js.map} +1 -1
  67. package/dist/cdn/chunks/{SavedBlocksPickBar-DHah-Uf7.js → SavedBlocksPickBar-DE-J1JVL.js} +2 -2
  68. package/dist/cdn/chunks/{SavedBlocksPickBar-DHah-Uf7.js.map → SavedBlocksPickBar-DE-J1JVL.js.map} +1 -1
  69. package/dist/cdn/chunks/{TemplateSettings-CWUpUKJb.js → TemplateSettings-CpoKZ8oV.js} +5 -5
  70. package/dist/cdn/chunks/{TemplateSettings-CWUpUKJb.js.map → TemplateSettings-CpoKZ8oV.js.map} +1 -1
  71. package/dist/cdn/chunks/{TestEmailModal-7pUDYLrk.js → TestEmailModal-DI3z__Bd.js} +8 -8
  72. package/dist/cdn/chunks/{TestEmailModal-7pUDYLrk.js.map → TestEmailModal-DI3z__Bd.js.map} +1 -1
  73. package/dist/cdn/chunks/{TestEmailPanel-DBWwMsH1.js → TestEmailPanel-Cp5d2YGn.js} +2 -2
  74. package/dist/cdn/chunks/{TestEmailPanel-DBWwMsH1.js.map → TestEmailPanel-Cp5d2YGn.js.map} +1 -1
  75. package/dist/cdn/chunks/{TitleEditor-VAanUjPQ.js → TitleEditor-C2syRLdZ.js} +4 -4
  76. package/dist/cdn/chunks/{TitleEditor-VAanUjPQ.js.map → TitleEditor-C2syRLdZ.js.map} +1 -1
  77. package/dist/cdn/chunks/{Toolbar-BlWVQRcA.js → Toolbar-NEE8qxYh.js} +754 -706
  78. package/dist/cdn/chunks/Toolbar-NEE8qxYh.js.map +1 -0
  79. package/dist/cdn/chunks/{TplModal-DDlR7mk3.js → TplModal-B1MgvtX8.js} +2 -2
  80. package/dist/cdn/chunks/{TplModal-DDlR7mk3.js.map → TplModal-B1MgvtX8.js.map} +1 -1
  81. package/dist/cdn/chunks/{VersionHistoryPanels-DJDeaf1B.js → VersionHistoryPanels-Cefd8i_e.js} +2 -2
  82. package/dist/cdn/chunks/{VersionHistoryPanels-DJDeaf1B.js.map → VersionHistoryPanels-Cefd8i_e.js.map} +1 -1
  83. package/dist/cdn/chunks/{WrapperBlock-DRJnrgy-.js → WrapperBlock-DFY-7YSs.js} +4 -4
  84. package/dist/cdn/chunks/{WrapperBlock-DRJnrgy-.js.map → WrapperBlock-DFY-7YSs.js.map} +1 -1
  85. package/dist/{ca-DOuIxWRv.js → cdn/chunks/ca-DIkMxYCN.js} +12 -1
  86. package/dist/cdn/chunks/{ca-DOuIxWRv.js.map → ca-DIkMxYCN.js.map} +1 -1
  87. package/dist/cdn/chunks/{composables-Jc3uZuLs.js → composables-nyxwrM27.js} +619 -597
  88. package/dist/cdn/chunks/composables-nyxwrM27.js.map +1 -0
  89. package/dist/cdn/chunks/{createCloudRuntime-C2Zs5F1O.js → createCloudRuntime-DJkDGKQ_.js} +3 -3
  90. package/dist/cdn/chunks/{createCloudRuntime-C2Zs5F1O.js.map → createCloudRuntime-DJkDGKQ_.js.map} +1 -1
  91. package/dist/{de-DaOUfYBX.js → cdn/chunks/de-Cc6Ue0UD.js} +12 -1
  92. package/dist/cdn/chunks/de-Cc6Ue0UD.js.map +1 -0
  93. package/dist/cdn/chunks/{en-C0pHHMiR.js → en-BX4FujAQ.js} +11 -2
  94. package/dist/cdn/chunks/en-BX4FujAQ.js.map +1 -0
  95. package/dist/{es-CxyEKr6n.js → cdn/chunks/es-Do5b-MKU.js} +12 -1
  96. package/dist/cdn/chunks/es-Do5b-MKU.js.map +1 -0
  97. package/dist/cdn/chunks/{extensions-DcMKZpzh.js → extensions-BcwkOjVq.js} +76 -70
  98. package/dist/cdn/chunks/extensions-BcwkOjVq.js.map +1 -0
  99. package/dist/{fr-CYbamiI6.js → cdn/chunks/fr-S1n2Ebzp.js} +12 -1
  100. package/dist/cdn/chunks/fr-S1n2Ebzp.js.map +1 -0
  101. package/dist/cdn/chunks/{ja-DfaIAoGI.js → ja-DLwcq4bA.js} +11 -2
  102. package/dist/cdn/chunks/ja-DLwcq4bA.js.map +1 -0
  103. package/dist/{nl-DkrB-VKZ.js → cdn/chunks/nl-0JSWaZpT.js} +12 -1
  104. package/dist/cdn/chunks/nl-0JSWaZpT.js.map +1 -0
  105. package/dist/{normalizeMergeTagMarkup-CUCo7B5X.js → cdn/chunks/normalizeMergeTagMarkup-BrGw5jxk.js} +102 -90
  106. package/dist/cdn/chunks/normalizeMergeTagMarkup-BrGw5jxk.js.map +1 -0
  107. package/dist/{preRenderCustomBlocks-Bs3N9no-.js → cdn/chunks/preRenderCustomBlocks-Cj0XYwuh.js} +3 -1
  108. package/dist/cdn/chunks/{preRenderCustomBlocks-f7GEKdvw.js.map → preRenderCustomBlocks-Cj0XYwuh.js.map} +1 -1
  109. package/dist/{pt-BR-CY5Ye7eP.js → cdn/chunks/pt-BR-D3VlIMDZ.js} +12 -1
  110. package/dist/cdn/chunks/pt-BR-D3VlIMDZ.js.map +1 -0
  111. package/dist/cdn/chunks/{sanitizeHtml-WTfz9lZd.js → sanitizeHtml-GxJCxKcP.js} +3 -3
  112. package/dist/cdn/chunks/{sanitizeHtml-WTfz9lZd.js.map → sanitizeHtml-GxJCxKcP.js.map} +1 -1
  113. package/dist/cdn/chunks/{socialIcons-DeCYorUT.js → socialIcons-B5zrrV8-.js} +387 -386
  114. package/dist/cdn/chunks/{socialIcons-DeCYorUT.js.map → socialIcons-B5zrrV8-.js.map} +1 -1
  115. package/dist/cdn/chunks/{src-A_cKeTM_.js → src-Diw9SLIe.js} +673 -554
  116. package/dist/cdn/chunks/src-Diw9SLIe.js.map +1 -0
  117. package/dist/cdn/chunks/src-UR3AQocX.js +683 -0
  118. package/dist/cdn/chunks/src-UR3AQocX.js.map +1 -0
  119. package/dist/cdn/chunks/{src-BQUv2CYU.js → src-v47QHNmB.js} +808 -645
  120. package/dist/cdn/chunks/src-v47QHNmB.js.map +1 -0
  121. package/dist/cdn/chunks/useLocalizedDisplay-DekV8qar.js +33 -0
  122. package/dist/cdn/chunks/{useLocalizedDisplay-aGfnO90D.js.map → useLocalizedDisplay-DekV8qar.js.map} +1 -1
  123. package/dist/cdn/chunks/{useLogicTag-DtYe8HIq.js → useLogicTag-Cbp3I7UN.js} +2 -2
  124. package/dist/cdn/chunks/{useLogicTag-DtYe8HIq.js.map → useLogicTag-Cbp3I7UN.js.map} +1 -1
  125. package/dist/cdn/chunks/{useMergeTag-B8ULmsnp.js → useMergeTag-1lrpNyR5.js} +4 -4
  126. package/dist/cdn/chunks/{useMergeTag-B8ULmsnp.js.map → useMergeTag-1lrpNyR5.js.map} +1 -1
  127. package/dist/cdn/chunks/{withCurrentFont-MK8ga9q9.js → withCurrentFont-DZfmiv8V.js} +2 -2
  128. package/dist/cdn/chunks/{withCurrentFont-MK8ga9q9.js.map → withCurrentFont-DZfmiv8V.js.map} +1 -1
  129. package/dist/cdn/editor.css +1 -1
  130. package/dist/cdn/editor.js +285 -285
  131. package/dist/cdn/editor.js.map +1 -1
  132. package/dist/{composables-XjYKaKhY.js → composables-DPgNn9GZ.js} +963 -941
  133. package/dist/{createCloudRuntime-DGV5a5Af.js → createCloudRuntime-Bw8TLmQ8.js} +2 -2
  134. package/dist/{cdn/chunks/de-DaOUfYBX.js → de-Cc6Ue0UD.js} +10 -3
  135. package/dist/{dist-Cdkm20M6.js → dist-CBdk1Vcb.js} +978 -815
  136. package/dist/{en-C0pHHMiR.js → en-BX4FujAQ.js} +10 -1
  137. package/dist/{cdn/chunks/es-CxyEKr6n.js → es-Do5b-MKU.js} +10 -3
  138. package/dist/{extensions-BJ184osp.js → extensions-QFAARrjF.js} +336 -330
  139. package/dist/{cdn/chunks/fr-CYbamiI6.js → fr-S1n2Ebzp.js} +10 -3
  140. package/dist/index.d.ts +14 -1
  141. package/dist/{ja-DfaIAoGI.js → ja-DLwcq4bA.js} +10 -1
  142. package/dist/{cdn/chunks/nl-DkrB-VKZ.js → nl-0JSWaZpT.js} +10 -3
  143. package/dist/{cdn/chunks/normalizeMergeTagMarkup-cC32Ox6A.js → normalizeMergeTagMarkup-BS0nRvhq.js} +97 -89
  144. package/dist/{cdn/chunks/preRenderCustomBlocks-f7GEKdvw.js → preRenderCustomBlocks-CiKvKd8V.js} +4 -6
  145. package/dist/{cdn/chunks/pt-BR-CY5Ye7eP.js → pt-BR-D3VlIMDZ.js} +10 -3
  146. package/dist/{sanitizeHtml-2rjV0r-6.js → sanitizeHtml-USjTyALR.js} +5 -5
  147. package/dist/{socialIcons-TFiOkpoU.js → socialIcons-NvIg5ahU.js} +401 -400
  148. package/dist/style.css +1 -1
  149. package/dist/templatical-editor.js +190 -190
  150. package/dist/useLocalizedDisplay-LdjosX4w.js +31 -0
  151. package/dist/{useLogicTag-BXXXQQmi.js → useLogicTag-D8zgkXfb.js} +1 -1
  152. package/dist/{useMergeTag-C9Okr87y.js → useMergeTag-k7Kr0nMd.js} +3 -3
  153. package/dist/{withCurrentFont-DJiQqZzL.js → withCurrentFont-Bzeg_gfH.js} +1 -1
  154. package/package.json +7 -7
  155. package/dist/cdn/chunks/LogicTagInsertButton-Bhvi0nWz.js.map +0 -1
  156. package/dist/cdn/chunks/Toolbar-BlWVQRcA.js.map +0 -1
  157. package/dist/cdn/chunks/composables-Jc3uZuLs.js.map +0 -1
  158. package/dist/cdn/chunks/de-DaOUfYBX.js.map +0 -1
  159. package/dist/cdn/chunks/en-C0pHHMiR.js.map +0 -1
  160. package/dist/cdn/chunks/es-CxyEKr6n.js.map +0 -1
  161. package/dist/cdn/chunks/extensions-DcMKZpzh.js.map +0 -1
  162. package/dist/cdn/chunks/fr-CYbamiI6.js.map +0 -1
  163. package/dist/cdn/chunks/ja-DfaIAoGI.js.map +0 -1
  164. package/dist/cdn/chunks/nl-DkrB-VKZ.js.map +0 -1
  165. package/dist/cdn/chunks/normalizeMergeTagMarkup-cC32Ox6A.js.map +0 -1
  166. package/dist/cdn/chunks/pt-BR-CY5Ye7eP.js.map +0 -1
  167. package/dist/cdn/chunks/src-8bYYJPCt.js +0 -671
  168. package/dist/cdn/chunks/src-8bYYJPCt.js.map +0 -1
  169. package/dist/cdn/chunks/src-A_cKeTM_.js.map +0 -1
  170. package/dist/cdn/chunks/src-BQUv2CYU.js.map +0 -1
  171. package/dist/cdn/chunks/useLocalizedDisplay-aGfnO90D.js +0 -33
  172. package/dist/useLocalizedDisplay-DNNwDRxL.js +0 -31
@@ -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-DepKdldn.js";
2
- import { $t as T, A as E, At as D, Bt as O, Ft as k, Gt as A, Ht as j, It as M, Jt as N, Kt as ee, Mt as P, N as F, Nt as te, O as ne, Ot as re, P as I, Pt as L, Qt as R, Rt as z, Vt as ie, Xt as B, Yt as ae, Z as oe, Zt as V, en as H, jt as U, k as W, lt as se, n as ce, qt as le, r as ue, sn as de, tn as fe, vn as pe, xt as me, zt as he } from "./src-BQUv2CYU.js";
3
- import { at as ge, s as _e } from "./icons-Da9GKjPx.js";
4
- import { B as ve, C as ye, U as be, u as xe } from "./keys-CoQtCqNv.js";
5
- import { t as Se } from "./useI18n-BnJYydPv.js";
6
- import { r as Ce } from "./dist-DqGgijFI.js";
7
- import { i as we, r as Te } from "./usePopoverPosition-BWAXWeBv.js";
2
+ import { $t as T, At as E, Bt as D, Ct as O, Ft as ee, H as k, Ht as A, I as j, It as te, Jt as M, Lt as N, Mt as ne, Nt as P, Pt as F, Qt as re, Rt as I, U as L, Ut as R, Vt as z, Wt as ie, Xt as B, Yt as ae, Zt as oe, bn as se, dt as V, en as H, h as U, ln as W, m as ce, nn as G, p as le, qt as K, rn as ue, tn as q, v as de, y as fe } from "./src-v47QHNmB.js";
3
+ import { at as pe, s as J } from "./icons-Da9GKjPx.js";
4
+ import { B as me, C as he, U as ge, u as _e } from "./keys-CoQtCqNv.js";
5
+ import { t as ve } from "./useI18n-BnJYydPv.js";
6
+ import { r as ye } from "./dist-DqGgijFI.js";
7
+ import { i as be, r as xe } from "./usePopoverPosition-BWAXWeBv.js";
8
8
  // ../core/src/localized-edit.ts
9
- var G = (e) => typeof e == "object" && !!e && !Array.isArray(e), Ee = (e) => Array.isArray(e) && e.length > 0 && e.every((e) => G(e) && typeof e.id == "string"), De = /* @__PURE__ */ new Set([
9
+ var Y = (e) => typeof e == "object" && !!e && !Array.isArray(e), Se = (e) => Array.isArray(e) && e.length > 0 && e.every((e) => Y(e) && typeof e.id == "string"), Ce = /* @__PURE__ */ new Set([
10
10
  "id",
11
11
  "type",
12
12
  "children",
@@ -14,51 +14,51 @@ var G = (e) => typeof e == "object" && !!e && !Array.isArray(e), Ee = (e) => Arr
14
14
  "l10n",
15
15
  "renderedHtml"
16
16
  ]);
17
- function Oe(e, t, n) {
17
+ function we(e, t, n) {
18
18
  let r = /* @__PURE__ */ new Set();
19
19
  for (let i of n) {
20
- if (!O(i)) continue;
21
- let n = i.split("."), a = n.pop(), o = n.join("."), s = N(e, i), c = t;
20
+ if (!A(i)) continue;
21
+ let n = i.split("."), a = n.pop(), o = n.join("."), s = B(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 && G(c) && N(c, i) === void 0 && G(N(e, a)) && (c[i] = {}, r.add(a)), c = N(c, i);
24
+ s !== void 0 && Y(c) && B(c, i) === void 0 && Y(B(e, a)) && (c[i] = {}, r.add(a)), c = B(c, i);
25
25
  }
26
26
  if (Array.isArray(c)) {
27
- let e = c.findIndex((e) => G(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 G(c) && (s === void 0 ? delete c[a] : c[a] = H(s), o && Object.keys(c).length === 0 && N(e, o) === void 0 && Oe(e, t, [o]));
29
+ s === void 0 ? c.splice(e, 1) : c[e] = G(s);
30
+ } else Y(c) && (s === void 0 ? delete c[a] : c[a] = G(s), o && Object.keys(c).length === 0 && B(e, o) === void 0 && we(e, t, [o]));
31
31
  }
32
32
  return r;
33
33
  }
34
- function K(e, t, n, r, i = !0, a = /* @__PURE__ */ new Set()) {
35
- if (G(e) && G(t) && !a.has(n)) for (let o of /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)])) (n || !De.has(o)) && K(e[o], t[o], n ? `${n}.${o}` : o, r, i, a);
36
- else if (i && Ee(e) && Ee(t)) for (let o of t) {
34
+ function Te(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 || !Ce.has(o)) && Te(e[o], t[o], n ? `${n}.${o}` : o, r, i, a);
36
+ else if (i && Se(e) && Se(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 && K(t, o, `${n}.${o.id}`, r, i, a);
39
+ t && Te(t, o, `${n}.${o.id}`, r, i, a);
40
40
  }
41
- else T(e, t) || r.set(n, t);
41
+ else q(e, t) || r.set(n, t);
42
42
  }
43
- function q(e, t, n, r = [], i = /* @__PURE__ */ new Set()) {
43
+ function Ee(e, t, n, r = [], i = /* @__PURE__ */ new Set()) {
44
44
  let a = /* @__PURE__ */ new Map();
45
- K(e, t, "", a, e.type !== "custom", i);
46
- let o = new Set(e.type === "custom" ? V(e, r) : []), s = {}, c = {};
47
- for (let [t, r] of a) if ((e.type === "custom" ? o.has(t) : j(e.type, t)) && typeof r == "string" && N(e, t) !== void 0) {
45
+ Te(e, t, "", a, e.type !== "custom", i);
46
+ let o = new Set(e.type === "custom" ? T(e, r) : []), s = {}, c = {};
47
+ for (let [t, r] of a) if ((e.type === "custom" ? o.has(t) : ie(e.type, t)) && typeof r == "string" && B(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(N(e, t) ?? ""))
51
+ sourceHash: re(String(B(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 ke(e, t, n) {
57
+ function De(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) => G(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) => G(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 ke(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) => G(n(e.id) ?? e))));
70
70
  }
71
71
  return r;
72
72
  }
73
- function J(e, t, n) {
73
+ function Oe(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
- K(r(e), r(t), "", i);
78
+ Te(r(e), r(t), "", i);
79
79
  let a = {};
80
- for (let [t, r] of i) if (M.includes(t) && typeof r == "string" && N(e, t) !== void 0) {
80
+ for (let [t, r] of i) if (I.includes(t) && typeof r == "string" && B(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(N(e, t) ?? ""))
84
+ sourceHash: re(String(B(e, t) ?? ""))
85
85
  };
86
86
  } else (a.set ??= {})[t] = r === void 0 ? null : r;
87
87
  return a;
88
88
  }
89
- function Y(e, t, n, r, i, a = []) {
90
- let o = H(e ?? {}), s = [.../* @__PURE__ */ new Set([...a, ...[.../* @__PURE__ */ new Set([
89
+ function ke(e, t, n, r, i, a = []) {
90
+ let o = G(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) => !T(t.text?.[e], n.text?.[e]) || !T(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 = N(i, e), n = s.filter((t) => t.startsWith(`${e}.`) && T(N(r, t), N(i, t)));
98
- if (T(t, N(r, e))) delete o.set[e];
99
- else if (n.length && G(N(r, e)) && G(t)) {
97
+ let t = B(i, e), n = s.filter((t) => t.startsWith(`${e}.`) && q(B(r, t), B(i, t)));
98
+ if (q(t, B(r, e))) delete o.set[e];
99
+ else if (n.length && Y(B(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 (G(t) && G(a)) for (let n of /* @__PURE__ */ new Set([...Object.keys(t), ...Object.keys(a)])) i(`${e}.${n}`, t[n], a[n]);
104
- else if (G(r) && r.type !== "custom" && Ee(t) && Ee(a)) for (let n of a) i(`${e}.${n.id}`, t.find((e) => e.id === n.id), n);
105
- else G(r) && typeof r.type == "string" && ie(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" && Se(t) && Se(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" && R(r, e, a) || o.text?.[e] && o.text[e].value === a || ((o.set ??= {})[e] = a === void 0 ? null : G(a));
106
106
  }
107
107
  };
108
- i(e, N(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}.`) && (T(t === "text" ? o.text[n].value : o.set[n] ?? void 0, N(i, n)) || delete o[t][n]);
108
+ i(e, B(r, e), t);
109
+ } else o.set[e] = t === void 0 ? null : G(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, B(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];
@@ -135,7 +135,7 @@ function je(e, t, n) {
135
135
  ...e.content(),
136
136
  blocks: [o]
137
137
  };
138
- W(t), E(t);
138
+ ce(t), U(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,7 +143,7 @@ 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 >= k(t.columns)) return !1;
146
+ if (t?.type !== "section" || u < 0 || u >= N(t.columns)) return !1;
147
147
  }
148
148
  }
149
149
  return t !== "moveBlock" || s?.targetSectionId !== l || (s?.columnIndex ?? 0) !== u || s?.index !== n[1];
@@ -188,8 +188,8 @@ function Q(e, t) {
188
188
  }
189
189
  // ../core/src/editor.ts
190
190
  function Fe(t) {
191
- let n = t.content ?? se(t.defaultFontFamily, t.templateDefaults);
192
- W(n), E(n);
191
+ let n = t.content ?? V(t.defaultFontFamily, t.templateDefaults);
192
+ ce(n), U(n);
193
193
  let r = e({
194
194
  template: null,
195
195
  content: n,
@@ -204,11 +204,11 @@ function Fe(t) {
204
204
  uiTheme: "auto"
205
205
  }), i = u(r, "activeLocale"), a = [];
206
206
  function o(e) {
207
- let t = z(r.content);
208
- if (e === t && (e = null), e !== null && !r.content.settings.locales?.includes(e)) throw new R(`This template has no "${e}" version.`, void 0, "unknown_locale");
207
+ let t = D(r.content);
208
+ if (e === t && (e = null), e !== null && !r.content.settings.locales?.includes(e)) throw new H(`This template has no "${e}" version.`, void 0, "unknown_locale");
209
209
  i.value = e;
210
210
  }
211
- h(() => i.value ?? z(r.content), (e) => Q(t.onError, () => t.onLocaleChange?.(e))), h(() => r.content.settings.locales?.includes(i.value ?? ""), () => {
211
+ h(() => i.value ?? D(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 Fe(t) {
218
218
  a = e;
219
219
  }
220
220
  function l(e) {
221
- return L(r.content, e, a);
221
+ return te(r.content, e, a);
222
222
  }
223
223
  function d(e, n) {
224
224
  if (!s()) return null;
225
- if (e === "addLocale" && (!he(n) || t.localization && !t.localization.locales.includes(n))) throw new R(`Locale "${n}" is not enabled.`, void 0, "unknown_locale");
226
- let i = H(r.content);
227
- return te(i, [{
225
+ if (e === "addLocale" && (!z(n) || t.localization && !t.localization.locales.includes(n))) throw new H(`Locale "${n}" is not enabled.`, void 0, "unknown_locale");
226
+ let i = G(r.content);
227
+ return ee(i, [{
228
228
  op: e,
229
229
  locale: n
230
- }]), T(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, j());
234
+ n && (r.content = n, k());
235
235
  }
236
236
  function p(e) {
237
237
  f("addLocale", e);
@@ -248,24 +248,24 @@ function Fe(t) {
248
248
  }
249
249
  function v(e, t) {
250
250
  let [n, o] = t;
251
- if (!i.value || !s() || I(n)) return null;
252
- let c = F(r.content.blocks, n);
251
+ if (!i.value || !s() || F(n)) return null;
252
+ let c = N(r.content.blocks, n);
253
253
  if (!c) return null;
254
- let l = c.l10n?.[i.value], u = A(c, i.value, z(r.content)), d = q(c, u, l, a), f = e === "resetLocaleFields" && Array.isArray(o) ? Oe(c, u, o) : void 0, p = e === "resetLocaleFields" ? Y(l, d, q(c, u, l, a, f), c, u, Array.isArray(o) ? o : []) : H(l ?? {});
254
+ let l = c.l10n?.[i.value], u = K(c, i.value, D(r.content)), d = Ee(c, u, l, a), f = e === "resetLocaleFields" && Array.isArray(o) ? we(c, u, o) : void 0, p = e === "resetLocaleFields" ? ke(l, d, Ee(c, u, l, a, f), c, u, Array.isArray(o) ? o : []) : G(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(N(c, e) ?? "")));
259
+ t && (t.sourceHash = re(String(B(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, T(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), j());
268
+ n && (_(n.block, n.layer), k());
269
269
  }
270
270
  function x(e, t) {
271
271
  y("setBlockHidden", [e, t]);
@@ -276,21 +276,21 @@ function Fe(t) {
276
276
  function w(e, t) {
277
277
  y("keepTranslations", [e, t]);
278
278
  }
279
- let D = S(0), O = 0, k = 0;
280
- function j() {
281
- r.isDirty = !0, k++;
279
+ let T = S(0), E = 0, O = 0;
280
+ function k() {
281
+ r.isDirty = !0, O++;
282
282
  }
283
- let M = b({
283
+ let A = b({
284
284
  get: () => r.content,
285
285
  set: (e) => {
286
- r.content = e, j();
286
+ r.content = e, k();
287
287
  }
288
- }), P = b(() => r.selectedBlockId ? F(r.content.blocks, r.selectedBlockId) : null);
289
- function F(e, t) {
288
+ }), j = b(() => r.selectedBlockId ? N(r.content.blocks, r.selectedBlockId) : null);
289
+ function N(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 = F(e, t);
293
+ let n = N(e, t);
294
294
  if (n) return n;
295
295
  }
296
296
  }
@@ -299,12 +299,12 @@ function Fe(t) {
299
299
  function ne(e, t) {
300
300
  if (t.add(e.id), e.type === "section") for (let n of e.children) for (let e of n) ne(e, t);
301
301
  }
302
- function re(e, t, n = { blocks: e }) {
302
+ function P(e, t, n = { blocks: e }) {
303
303
  for (let r = 0; r < e.length; r++) {
304
304
  let i = e[r];
305
305
  if (i.id === t) return n;
306
306
  if (i.type === "section") for (let e = 0; e < i.children.length; e++) {
307
- let n = re(i.children[e], t, {
307
+ let n = P(i.children[e], t, {
308
308
  blocks: i.children[e],
309
309
  sectionId: i.id,
310
310
  columnIndex: e
@@ -314,7 +314,7 @@ function Fe(t) {
314
314
  }
315
315
  return null;
316
316
  }
317
- function I(e, n = !1) {
317
+ function F(e, n = !1) {
318
318
  let r = i.value ?? t.lockLocale?.value ?? null;
319
319
  for (let [i, a] of t.lockedBlocks?.value ?? []) {
320
320
  let o = a;
@@ -324,8 +324,8 @@ function Fe(t) {
324
324
  }
325
325
  return !1;
326
326
  }
327
- function ie(e) {
328
- let t = re(r.content.blocks, e);
327
+ function I(e) {
328
+ let t = P(r.content.blocks, e);
329
329
  if (!t) return null;
330
330
  let n = t.blocks.findIndex((t) => t.id === e);
331
331
  return n === -1 ? null : {
@@ -334,112 +334,112 @@ function Fe(t) {
334
334
  index: n
335
335
  };
336
336
  }
337
- function oe(e, t = !0) {
338
- W(e), E(e), r.content = e, t && j();
337
+ function L(e, t = !0) {
338
+ ce(e), U(e), r.content = e, t && k();
339
339
  }
340
- function V(e) {
341
- e && I(e) || (r.selectedBlockId = e);
340
+ function R(e) {
341
+ e && F(e) || (r.selectedBlockId = e);
342
342
  }
343
- function U(e) {
343
+ function ie(e) {
344
344
  r.viewport = e;
345
345
  }
346
- function ce(e) {
346
+ function se(e) {
347
347
  r.darkMode = e;
348
348
  }
349
- function ue(e) {
349
+ function W(e) {
350
350
  r.uiTheme = e;
351
351
  }
352
- function de(e) {
352
+ function le(e) {
353
353
  r.previewMode = e, e && (r.selectedBlockId = null);
354
354
  }
355
- function fe(e, t) {
355
+ function ue(e, t) {
356
356
  if (!s()) return !1;
357
- let n = F(r.content.blocks, e);
357
+ let n = N(r.content.blocks, e);
358
358
  if (!n) return !1;
359
- if ("l10n" in t) throw new R("l10n is immutable in updateBlock.", void 0, "invalid_operation");
359
+ if ("l10n" in t) throw new H("l10n is immutable in updateBlock.", void 0, "invalid_operation");
360
360
  let i = {
361
361
  ...n,
362
362
  ...t
363
363
  };
364
- return !I(e, ke(H(n), i, (e) => F(r.content.blocks, e)));
364
+ return !F(e, De(G(n), i, (e) => N(r.content.blocks, e)));
365
365
  }
366
- function pe(e, n) {
367
- if (!fe(e, n)) return;
368
- let o = F(r.content.blocks, e);
366
+ function de(e, n) {
367
+ if (!ue(e, n)) return;
368
+ let o = N(r.content.blocks, e);
369
369
  if (!o) return;
370
370
  let s = i.value;
371
371
  if (s) {
372
- let i = A(o, s, z(r.content)), c = {
372
+ let i = K(o, s, D(r.content)), c = {
373
373
  ...i,
374
374
  ...n
375
- }, l = H(o), u = ke(l, c, (e) => F(r.content.blocks, e));
376
- if (I(e, u)) return;
375
+ }, l = G(o), u = De(l, c, (e) => N(r.content.blocks, e));
376
+ if (F(e, u)) return;
377
377
  u && t.onStructureChange?.();
378
- let d = ee(l);
379
- delete o.l10n, Object.assign(o, d), _(o, Y(o.l10n?.[s], q(o, i, o.l10n?.[s], a), q(o, c, o.l10n?.[s], a), o, c));
378
+ let d = M(l);
379
+ 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));
380
380
  } else {
381
- if (I(e, "children" in n || "columns" in n)) return;
382
- let t = ee({
381
+ if (F(e, "children" in n || "columns" in n)) return;
382
+ let t = M({
383
383
  ...o,
384
384
  ...n
385
385
  });
386
386
  delete o.l10n, Object.assign(o, t);
387
387
  }
388
- j();
388
+ k();
389
389
  }
390
- function me(e) {
391
- if ("locales" in e || "l10n" in e) throw new R("locales and l10n are immutable in updateSettings.", void 0, "invalid_operation");
392
- if ("locale" in e && e.locale !== z(r.content) && r.content.settings.locales?.length) throw new R("The default locale can't change while language versions exist.", void 0, "invalid_operation");
390
+ function fe(e) {
391
+ if ("locales" in e || "l10n" in e) throw new H("locales and l10n are immutable in updateSettings.", void 0, "invalid_operation");
392
+ if ("locale" in e && e.locale !== D(r.content) && r.content.settings.locales?.length) throw new H("The default locale can't change while language versions exist.", void 0, "invalid_operation");
393
393
  }
394
- function ge(e) {
394
+ function pe(e) {
395
395
  if (!s()) return;
396
- me(e);
396
+ fe(e);
397
397
  let t = i.value;
398
- if (!t) r.content.settings = le({
398
+ if (!t) r.content.settings = ae({
399
399
  ...r.content.settings,
400
400
  ...e
401
401
  });
402
402
  else {
403
- let n = r.content.settings, i = ae(r.content, t).settings, a = {
403
+ let n = r.content.settings, i = oe(r.content, t).settings, a = {
404
404
  ...i,
405
405
  locale: n.locale,
406
406
  ...e
407
- }, o = n.l10n?.[t], s = Y(o, J(n, i, o), J(n, a, o), n, a);
407
+ }, o = n.l10n?.[t], s = ke(o, Oe(n, i, o), Oe(n, a, o), n, a);
408
408
  Object.keys(s).length ? n.l10n = {
409
409
  ...n.l10n,
410
410
  [t]: s
411
411
  } : n.l10n && (delete n.l10n[t], Object.keys(n.l10n).length || delete n.l10n);
412
412
  }
413
- j();
413
+ k();
414
414
  }
415
- let _e = {
415
+ let J = {
416
416
  canEdit: s,
417
417
  content: () => r.content,
418
- findBlock: (e) => F(r.content.blocks, e),
419
- findBlockLocation: ie,
420
- isBlockLocked: I
418
+ findBlock: (e) => N(r.content.blocks, e),
419
+ findBlockLocation: I,
420
+ isBlockLocked: F
421
421
  };
422
- function ve(e, n, a = 0, o) {
423
- if (je(_e, "addBlock", [
422
+ function me(e, n, a = 0, o) {
423
+ if (je(J, "addBlock", [
424
424
  e,
425
425
  n,
426
426
  a,
427
427
  o
428
428
  ])) {
429
429
  if (n) {
430
- let t = F(r.content.blocks, n);
430
+ let t = N(r.content.blocks, n);
431
431
  if (t && t.type === "section") {
432
432
  t.children[a] = t.children[a] || [];
433
433
  let n = t.children[a];
434
434
  o !== void 0 && o < n.length ? n.splice(o, 0, e) : n.push(e);
435
435
  }
436
436
  } else o !== void 0 && o < r.content.blocks.length ? r.content.blocks.splice(o, 0, e) : r.content.blocks.push(e);
437
- i.value && t.onStructureChange?.(), j();
437
+ i.value && t.onStructureChange?.(), k();
438
438
  }
439
439
  }
440
- function ye(e) {
441
- if (!je(_e, "removeBlock", [e])) return;
442
- let n = re(r.content.blocks, e);
440
+ function he(e) {
441
+ if (!je(J, "removeBlock", [e])) return;
442
+ let n = P(r.content.blocks, e);
443
443
  if (n) {
444
444
  let a = n.blocks.findIndex((t) => t.id === e);
445
445
  if (a !== -1) {
@@ -448,88 +448,88 @@ function Fe(t) {
448
448
  let t = /* @__PURE__ */ new Set();
449
449
  ne(e, t), t.has(r.selectedBlockId) && (r.selectedBlockId = null);
450
450
  }
451
- i.value && t.onStructureChange?.(), j();
451
+ i.value && t.onStructureChange?.(), k();
452
452
  }
453
453
  }
454
454
  }
455
- function be(e, n, a, o = 0) {
456
- if (!je(_e, "moveBlock", [
455
+ function ge(e, n, a, o = 0) {
456
+ if (!je(J, "moveBlock", [
457
457
  e,
458
458
  n,
459
459
  a,
460
460
  o
461
461
  ])) return;
462
- let s = re(r.content.blocks, e), c = s.blocks.findIndex((t) => t.id === e), l;
462
+ let s = P(r.content.blocks, e), c = s.blocks.findIndex((t) => t.id === e), l;
463
463
  if (a) {
464
- let e = F(r.content.blocks, a);
464
+ let e = N(r.content.blocks, a);
465
465
  e.children[o] = e.children[o] || [], l = e.children[o];
466
466
  } else l = r.content.blocks;
467
467
  let [u] = s.blocks.splice(c, 1);
468
- l.splice(n, 0, u), i.value && t.onStructureChange?.(), j();
468
+ l.splice(n, 0, u), i.value && t.onStructureChange?.(), k();
469
469
  }
470
- function xe() {
471
- j();
470
+ function _e() {
471
+ k();
472
472
  }
473
- function Se(e, t) {
474
- throw new R(`[Templatical] Templates: ${e} ${t}`);
473
+ function ve(e, t) {
474
+ throw new H(`[Templatical] Templates: ${e} ${t}`);
475
475
  }
476
- function Ce(e) {
476
+ function ye(e) {
477
477
  Q(t.onError, e);
478
478
  }
479
- function we(e) {
479
+ function be(e) {
480
480
  let { templates: n } = t;
481
- return n || Se(e, "needs a templates provider. Pass one as `init({ templates })` to enable saving and loading."), n;
481
+ return n || ve(e, "needs a templates provider. Pass one as `init({ templates })` to enable saving and loading."), n;
482
482
  }
483
- function Te(e) {
483
+ function xe(e) {
484
484
  r.template && (r.template = {
485
485
  ...r.template,
486
486
  name: e
487
- }, j());
487
+ }, k());
488
488
  }
489
- async function G(e) {
490
- let n = we("create()"), { create: i } = n;
491
- typeof i != "function" && Se("create()", "is disabled by the provider — its `create` is `false`.");
492
- let a, o = ++O;
489
+ async function Y(e) {
490
+ let n = be("create()"), { create: i } = n;
491
+ typeof i != "function" && ve("create()", "is disabled by the provider — its `create` is `false`.");
492
+ let a, o = ++E;
493
493
  r.isLoading = !0;
494
494
  try {
495
495
  e?.content && (r.content = e.content);
496
- let t = k;
496
+ let t = O;
497
497
  a = await i(e?.name === void 0 ? { content: r.content } : {
498
498
  name: e.name,
499
499
  content: r.content
500
- }), r.template = a, k === t && (r.isDirty = !1), D.value++;
500
+ }), r.template = a, O === t && (r.isDirty = !1), T.value++;
501
501
  } catch (e) {
502
502
  throw t.onError?.(e), e;
503
503
  } finally {
504
- O === o && (r.isLoading = !1);
504
+ E === o && (r.isLoading = !1);
505
505
  }
506
- return Ce(() => n.onCreated?.(a)), a;
506
+ return ye(() => n.onCreated?.(a)), a;
507
507
  }
508
- async function Ee(e, n) {
509
- let i = we("load()"), a, o = ++O;
508
+ async function Se(e, n) {
509
+ let i = be("load()"), a, o = ++E;
510
510
  r.isLoading = !0;
511
511
  try {
512
- if (a = await i.load(e), W(a.content), E(a.content), n && !n()) return a;
513
- r.template = a, r.content = a.content, r.isDirty = !1, D.value++;
512
+ if (a = await i.load(e), ce(a.content), U(a.content), n && !n()) return a;
513
+ r.template = a, r.content = a.content, r.isDirty = !1, T.value++;
514
514
  } catch (e) {
515
515
  throw t.onError?.(e), e;
516
516
  } finally {
517
- O === o && (r.isLoading = !1);
517
+ E === o && (r.isLoading = !1);
518
518
  }
519
- return Ce(() => i.onLoaded?.(a)), a;
519
+ return ye(() => i.onLoaded?.(a)), a;
520
520
  }
521
- async function De(e = "api") {
522
- let n = we("save()"), { save: i } = n;
523
- typeof i != "function" && Se("save()", "is disabled by the provider — its `save` is `false`.");
521
+ async function Ce(e = "api") {
522
+ let n = be("save()"), { save: i } = n;
523
+ typeof i != "function" && ve("save()", "is disabled by the provider — its `save` is `false`.");
524
524
  let a = r.template;
525
- a || Se("save()", "has no template loaded. Call create() or load() first.");
525
+ a || ve("save()", "has no template loaded. Call create() or load() first.");
526
526
  let o = a.name === void 0 ? { content: r.content } : {
527
527
  name: a.name,
528
528
  content: r.content
529
529
  }, s;
530
530
  r.isSaving = !0;
531
531
  try {
532
- let e = k;
532
+ let e = O;
533
533
  if (s = await i(a.id, o), r.template?.id === a.id) {
534
534
  let e = r.template.name;
535
535
  r.template = e === a.name ? s : {
@@ -537,22 +537,22 @@ function Fe(t) {
537
537
  name: e
538
538
  };
539
539
  }
540
- k === e && (r.isDirty = !1);
540
+ O === e && (r.isDirty = !1);
541
541
  } catch (e) {
542
542
  throw t.onError?.(e), e;
543
543
  } finally {
544
544
  r.isSaving = !1;
545
545
  }
546
- return Ce(() => n.onSaved?.(s, { trigger: e })), s;
546
+ return ye(() => n.onSaved?.(s, { trigger: e })), s;
547
547
  }
548
- function K() {
548
+ function Te() {
549
549
  return r.template?.id !== void 0;
550
550
  }
551
551
  let X = {
552
552
  state: m(r),
553
- loadVersion: m(D),
554
- content: M,
555
- selectedBlock: P,
553
+ loadVersion: m(T),
554
+ content: A,
555
+ selectedBlock: j,
556
556
  activeLocale: i,
557
557
  setActiveLocale: o,
558
558
  addLocale: p,
@@ -562,34 +562,34 @@ function Fe(t) {
562
562
  keepTranslations: w,
563
563
  setCustomBlockDefinitions: c,
564
564
  createSetDefaultLocaleOperation: l,
565
- isBlockLocked: I,
566
- setContent: oe,
567
- selectBlock: V,
568
- setViewport: U,
569
- setDarkMode: ce,
570
- setUiTheme: ue,
571
- setPreviewMode: de,
572
- updateBlock: pe,
573
- updateSettings: ge,
574
- addBlock: ve,
575
- removeBlock: ye,
576
- moveBlock: be,
577
- markDirty: xe,
578
- findBlockLocation: ie,
579
- setName: Te,
580
- create: G,
581
- load: Ee,
582
- save: De,
583
- hasTemplate: K
565
+ isBlockLocked: F,
566
+ setContent: L,
567
+ selectBlock: R,
568
+ setViewport: ie,
569
+ setDarkMode: se,
570
+ setUiTheme: W,
571
+ setPreviewMode: le,
572
+ updateBlock: de,
573
+ updateSettings: pe,
574
+ addBlock: me,
575
+ removeBlock: he,
576
+ moveBlock: ge,
577
+ markDirty: _e,
578
+ findBlockLocation: I,
579
+ setName: xe,
580
+ create: Y,
581
+ load: Se,
582
+ save: Ce,
583
+ hasTemplate: Te
584
584
  };
585
- return Me(X, (e, t) => Ae(e) ? je(_e, 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;
585
+ return Me(X, (e, t) => Ae(e) ? je(J, e, t) : s() ? e === "updateBlock" ? ue(t[0], t[1]) : (e === "updateSettings" && fe(t[0]), e === "addLocale" || e === "removeLocale" ? d(e, t[0]) !== null : e === "setBlockHidden" || e === "resetLocaleFields" || e === "keepTranslations" ? v(e, t) !== null : !0) : !1), X;
586
586
  }
587
587
  // ../core/src/history.ts
588
588
  var Ie = 50, Le = 300, Re = 1500;
589
589
  function ze(e) {
590
590
  let { content: t, setContent: n, maxSize: r = Ie } = e, i = S([]), a = S([]), o = S(!1), s = null, c = null, l = b(() => i.value.length > 0), u = b(() => a.value.length > 0);
591
591
  function d() {
592
- return H(t.value);
592
+ return G(t.value);
593
593
  }
594
594
  function f(e) {
595
595
  i.value.push(e), i.value.length > r && i.value.splice(0, i.value.length - r);
@@ -650,11 +650,11 @@ function ze(e) {
650
650
  function Be(e) {
651
651
  let { addBlock: t, removeBlock: n, updateBlock: r, selectBlock: i, findBlockLocation: a } = e;
652
652
  function o(n, r, a) {
653
- let o = typeof e.blockDefaults == "function" ? e.blockDefaults() : e.blockDefaults, s = I(n, o);
653
+ let o = typeof e.blockDefaults == "function" ? e.blockDefaults() : e.blockDefaults, s = fe(n, o);
654
654
  return t(s, r, a), i(s.id), s;
655
655
  }
656
656
  function s(e, n, r) {
657
- let o = F(e);
657
+ let o = de(e);
658
658
  if (!Z(t, "duplicateBlock", [
659
659
  e,
660
660
  n,
@@ -859,7 +859,7 @@ function et(e) {
859
859
  }
860
860
  function tt(e, t, n) {
861
861
  let r = {}, i = [];
862
- for (let i of Object.keys(t)) n.has(i) || t[i] === void 0 || T(e[i], t[i]) || (r[i] = H(t[i]));
862
+ for (let i of Object.keys(t)) n.has(i) || t[i] === void 0 || q(e[i], t[i]) || (r[i] = G(t[i]));
863
863
  for (let r of Object.keys(e)) n.has(r) || e[r] === void 0 || t[r] === void 0 && i.push(r);
864
864
  return {
865
865
  set: r,
@@ -878,7 +878,7 @@ function nt(e = {}, t = {}) {
878
878
  function rt(e, t) {
879
879
  if (e.settings.locale !== t.settings.locale && (e.settings.locales?.length || t.settings.locales?.length)) return [{
880
880
  op: "setContent",
881
- content: H(t)
881
+ content: G(t)
882
882
  }];
883
883
  let n = $e(e.blocks), r = $e(t.blocks), i = [], a = (e) => {
884
884
  let t = r.get(e), i = n.get(e);
@@ -896,8 +896,8 @@ function rt(e, t) {
896
896
  };
897
897
  for (let t of e.blocks) u(t, "kept");
898
898
  let d = (e) => n.has(e) && !c.has(e), f = (e) => {
899
- let t = H(e);
900
- return t.type === "section" && (t.children = Qe(e).map((e) => Array.isArray(e) ? e.filter((e) => !d(e.id)).map((e) => H(e)) : e)), t;
899
+ let t = G(e);
900
+ return t.type === "section" && (t.children = Qe(e).map((e) => Array.isArray(e) ? e.filter((e) => !d(e.id)).map((e) => G(e)) : e)), t;
901
901
  }, p = (e, t, r) => {
902
902
  let a = Ze(e), o = [], s = [];
903
903
  t.forEach((e, t) => {
@@ -1037,41 +1037,41 @@ function st(e, t, n) {
1037
1037
  Object.keys(n).length ? (e.l10n ??= {})[t] = n : e.l10n && (delete e.l10n[t], Object.keys(e.l10n).length || delete e.l10n);
1038
1038
  }
1039
1039
  function ct(e) {
1040
- let t = H(e);
1040
+ let t = G(e);
1041
1041
  return delete t.l10n, t.type === "section" && (t.children = t.children.map((e) => e.map(ct))), t;
1042
1042
  }
1043
1043
  function lt(e, t, n, r) {
1044
- let i = ae(e, t), a = H(e), o = H(i.settings), s = !1, c = /* @__PURE__ */ new Map(), l = (n, r) => {
1044
+ let i = oe(e, t), a = G(e), o = G(i.settings), s = !1, c = /* @__PURE__ */ new Map(), l = (n, r) => {
1045
1045
  for (let [i, a] of $(n)) c.set(i, {
1046
- initial: A(a, t, z(e)),
1046
+ initial: K(a, t, D(e)),
1047
1047
  added: r,
1048
1048
  changed: !1
1049
1049
  });
1050
1050
  };
1051
1051
  l(i.blocks, !1);
1052
1052
  let u = [], d = (e, t, n) => {
1053
- if (t.some((e) => e?.op === "setDefaultLocale")) throw new U("invalid_operation", n, "Changing the default language isn't possible in a language view; switch to the default language.");
1054
- if (t.some((e) => e?.op === "setContent")) throw new U("invalid_operation", n, "Replacing the whole template isn't possible in a language view; switch to the default language.");
1053
+ 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.");
1054
+ 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.");
1055
1055
  try {
1056
- return P(e, t);
1056
+ return F(e, t);
1057
1057
  } catch (e) {
1058
- throw e instanceof U ? new U(e.code, n, e.message, e.blockId) : e;
1058
+ throw e instanceof P ? new P(e.code, n, e.message, e.blockId) : e;
1059
1059
  }
1060
1060
  }, f = (e, t) => {
1061
1061
  a = d(a, e, t), u.push(...e);
1062
1062
  }, p = (e, n) => {
1063
1063
  let o = c.get(e);
1064
1064
  if (!o?.changed) return;
1065
- let s = $(a.blocks).get(e), l = $(i.blocks).get(e), u = H(a), d = it(u, at(u, e).parent), p = H(s);
1065
+ let s = $(a.blocks).get(e), l = $(i.blocks).get(e), u = G(a), d = it(u, at(u, e).parent), p = G(s);
1066
1066
  if (o.added) p = ct(l), p.type === "section" && s.type === "section" && (p.children = s.children, p.columns = s.columns);
1067
1067
  else {
1068
- ke(p, p.type === "section" ? {
1068
+ De(p, p.type === "section" ? {
1069
1069
  ...l,
1070
1070
  children: p.children,
1071
1071
  columns: p.columns
1072
- } : l, (e) => $(a.blocks).get(e) ?? null), p = ee(p);
1072
+ } : l, (e) => $(a.blocks).get(e) ?? null), p = M(p);
1073
1073
  let e = p.l10n?.[t];
1074
- st(p, t, Y(e, q(p, o.initial, e, r), q(p, l, e, r), p, l));
1074
+ st(p, t, ke(e, Ee(p, o.initial, e, r), Ee(p, l, e, r), p, l));
1075
1075
  }
1076
1076
  d[d.findIndex((t) => t.id === e)] = p, f(rt(a, u), n), o.changed = !1;
1077
1077
  }, m = (e, t, n) => {
@@ -1092,7 +1092,7 @@ function lt(e, t, n, r) {
1092
1092
  op: "updateBlock",
1093
1093
  blockId: e.blockId,
1094
1094
  set: { columns: i.columns },
1095
- ...e.expect ? { expect: Object.fromEntries(Object.keys(e.expect).map((e) => [e, N(u, e) ?? null])) } : {}
1095
+ ...e.expect ? { expect: Object.fromEntries(Object.keys(e.expect).map((e) => [e, B(u, e) ?? null])) } : {}
1096
1096
  }], n);
1097
1097
  };
1098
1098
  n.forEach((e, t) => {
@@ -1137,8 +1137,8 @@ function lt(e, t, n, r) {
1137
1137
  });
1138
1138
  for (let e of c.keys()) p(e, n.length - 1);
1139
1139
  if (s) {
1140
- let e = H(a), r = e.settings.l10n?.[t];
1141
- st(e.settings, t, Y(r, J(e.settings, o, r), J(e.settings, i.settings, r), e.settings, i.settings)), f(rt(a, e), n.length - 1);
1140
+ let e = G(a), r = e.settings.l10n?.[t];
1141
+ st(e.settings, t, ke(r, Oe(e.settings, o, r), Oe(e.settings, i.settings, r), e.settings, i.settings)), f(rt(a, e), n.length - 1);
1142
1142
  }
1143
1143
  return u;
1144
1144
  }
@@ -1194,12 +1194,12 @@ function St(e) {
1194
1194
  });
1195
1195
  }
1196
1196
  function Ct(e) {
1197
- let { provider: t } = e, n = e.sessionId ?? crypto.randomUUID(), r = e.maxUndo ?? pt, 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, E = !1, O = null, k = 0, A = !1, j = [], M = null, N = null, ee = Promise.resolve(), F = null, ne = b(() => (v?.undo.length ?? 0) > 0), re = b(() => (v?.redo.length ?? 0) > 0);
1197
+ let { provider: t } = e, n = e.sessionId ?? crypto.randomUUID(), r = e.maxUndo ?? pt, 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, O = !1, k = [], A = null, j = null, te = Promise.resolve(), M = null, N = b(() => (v?.undo.length ?? 0) > 0), re = b(() => (v?.redo.length ?? 0) > 0);
1198
1198
  function I(t) {
1199
1199
  e.onError?.(t instanceof Error ? t : Error(String(t)));
1200
1200
  }
1201
1201
  function L(t, n = v) {
1202
- n !== v || A || e.onNotice?.(t);
1202
+ n !== v || O || e.onNotice?.(t);
1203
1203
  }
1204
1204
  function R() {
1205
1205
  return {
@@ -1223,11 +1223,11 @@ function Ct(e) {
1223
1223
  try {
1224
1224
  let t = _.content.value, n = rt(t, e);
1225
1225
  if (n.length > 0) try {
1226
- te(t, n);
1226
+ ee(t, n);
1227
1227
  } catch {
1228
- _.setContent(H(e), !1);
1228
+ _.setContent(G(e), !1);
1229
1229
  }
1230
- T(_.content.value, e) || _.setContent(H(e), !1);
1230
+ q(_.content.value, e) || _.setContent(G(e), !1);
1231
1231
  } finally {
1232
1232
  C = !1;
1233
1233
  }
@@ -1235,14 +1235,14 @@ function Ct(e) {
1235
1235
  t && !bt(e.blocks, t) && _.selectBlock(null);
1236
1236
  }
1237
1237
  function ae() {
1238
- C || E || (E = !0, queueMicrotask(() => {
1239
- E = !1, V(!1);
1238
+ C || T || (T = !0, queueMicrotask(() => {
1239
+ T = !1, se(!1);
1240
1240
  }));
1241
1241
  }
1242
1242
  function oe() {
1243
- O &&= (clearTimeout(O), null);
1243
+ E &&= (clearTimeout(E), null);
1244
1244
  }
1245
- function V(e, t = !1) {
1245
+ function se(e, t = !1) {
1246
1246
  let n = v;
1247
1247
  if (!_ || !n || y || C || _.state.isLoading && !t || _.state.template?.id !== n.templateId) return;
1248
1248
  let r = rt(n.view, _.content.value);
@@ -1250,25 +1250,25 @@ function Ct(e) {
1250
1250
  else {
1251
1251
  if (!e && xt(r)) {
1252
1252
  let e = Date.now();
1253
- if (O === null && (k = e), e - k < 1e3) {
1254
- O && clearTimeout(O), O = setTimeout(() => {
1255
- O = null, V(!0);
1253
+ if (E === null && (D = e), e - D < 1e3) {
1254
+ E && clearTimeout(E), E = setTimeout(() => {
1255
+ E = null, se(!0);
1256
1256
  }, 300);
1257
1257
  return;
1258
1258
  }
1259
1259
  }
1260
- oe(), se(n, r);
1260
+ oe(), H(n, r);
1261
1261
  }
1262
1262
  }
1263
- function W() {
1264
- V(!0);
1263
+ function V() {
1264
+ se(!0);
1265
1265
  }
1266
- function se(e, t) {
1266
+ function H(e, t) {
1267
1267
  let n = t, r;
1268
1268
  try {
1269
- r = P(e.view, n, R());
1269
+ r = F(e.view, n, R());
1270
1270
  } catch (n) {
1271
- if (!(n instanceof U)) throw n;
1271
+ if (!(n instanceof P)) throw n;
1272
1272
  B(e.view);
1273
1273
  let r = n.blockId === void 0 ? void 0 : Ae(n.blockId).find((e) => {
1274
1274
  let r = t[n.opIndex];
@@ -1282,15 +1282,15 @@ function Ct(e) {
1282
1282
  return;
1283
1283
  }
1284
1284
  let i = _.content.value;
1285
- if (!T(r, i)) {
1285
+ if (!q(r, i)) {
1286
1286
  I(/* @__PURE__ */ Error("[Templatical] Collaboration: a change couldn't be expressed as block operations, so the whole content was sent.")), n = [{
1287
1287
  op: "setContent",
1288
- content: H(i)
1288
+ content: G(i)
1289
1289
  }];
1290
1290
  try {
1291
- r = P(e.view, n, R());
1291
+ r = F(e.view, n, R());
1292
1292
  } catch (t) {
1293
- if (!(t instanceof U)) throw t;
1293
+ if (!(t instanceof P)) throw t;
1294
1294
  B(e.view), L({
1295
1295
  type: "editRefused",
1296
1296
  code: t.code
@@ -1298,12 +1298,12 @@ function Ct(e) {
1298
1298
  return;
1299
1299
  }
1300
1300
  }
1301
- let a = gt({ ops: D(e.view, n) }, r);
1301
+ let a = gt({ ops: ne(e.view, n) }, r);
1302
1302
  ie(e.undo, a), e.redo = [], z();
1303
1303
  let o = e.view;
1304
- e.view = r, ce(e, n, "edit", a, o);
1304
+ e.view = r, U(e, n, "edit", a, o);
1305
1305
  }
1306
- function ce(e, t, n, r, i) {
1306
+ function U(e, t, n, r, i) {
1307
1307
  let a = { dropped: !1 }, o = 0, s = i;
1308
1308
  do {
1309
1309
  let i = t.slice(o, o + mt);
@@ -1317,44 +1317,44 @@ function Ct(e) {
1317
1317
  revision: null,
1318
1318
  ...s && i.some((e) => e.op === "setContent") ? { base: s } : {}
1319
1319
  }), o += mt, s && t.slice(o).some((e) => e.op === "setContent")) try {
1320
- s = P(s, i);
1320
+ s = F(s, i);
1321
1321
  } catch {
1322
1322
  s = null;
1323
1323
  }
1324
1324
  } while (o < t.length);
1325
- le(e);
1325
+ W(e);
1326
1326
  }
1327
- function le(e) {
1327
+ function W(e) {
1328
1328
  if (e.inFlight || w) return;
1329
1329
  let t = e.pending.find((e) => !e.sent);
1330
- t ? (t.sent = !0, e.inFlight = t, ue(e, t, 0)) : ge(e);
1330
+ t ? (t.sent = !0, e.inFlight = t, ce(e, t, 0)) : pe(e);
1331
1331
  }
1332
- function ue(e, n, r) {
1332
+ function ce(e, n, r) {
1333
1333
  t.submit(e.templateId, {
1334
1334
  batchId: n.batchId,
1335
1335
  baseRevision: n.baseRevision ??= e.revision,
1336
1336
  ops: n.ops,
1337
1337
  ...n.origin === "ai" ? { origin: "ai" } : {}
1338
1338
  }).then(({ revision: t }) => {
1339
- e.inFlight = null, de(e, n, t), le(e);
1339
+ e.inFlight = null, le(e, n, t), W(e);
1340
1340
  }, (t) => {
1341
- if (_t(t) !== null) e.inFlight = null, he(e, n, t), le(e);
1341
+ if (_t(t) !== null) e.inFlight = null, fe(e, n, t), W(e);
1342
1342
  else if (yt(t)) {
1343
- _e(e, t);
1343
+ J(e, t);
1344
1344
  let i = ft[Math.min(r, ft.length - 1)];
1345
1345
  setTimeout(() => {
1346
- A || ue(e, n, r + 1);
1346
+ O || ce(e, n, r + 1);
1347
1347
  }, i);
1348
- } else e.inFlight = null, I(t), he(e, n, t), le(e);
1348
+ } else e.inFlight = null, I(t), fe(e, n, t), W(e);
1349
1349
  });
1350
1350
  }
1351
- function de(e, t, n) {
1352
- t.revision === null && (t.revision = n, n <= e.revision ? (fe(e, t), xe(e)) : (e.own.set(n, t), be(e)));
1351
+ function le(e, t, n) {
1352
+ t.revision === null && (t.revision = n, n <= e.revision ? (K(e, t), _e(e)) : (e.own.set(n, t), ge(e)));
1353
1353
  }
1354
- function fe(e, t) {
1355
- e.pending = e.pending.filter((e) => e !== t), ge(e);
1354
+ function K(e, t) {
1355
+ e.pending = e.pending.filter((e) => e !== t), pe(e);
1356
1356
  }
1357
- function pe(e, t) {
1357
+ function ue(e, t) {
1358
1358
  if (t.entry) {
1359
1359
  for (let n of [e.undo, e.redo]) {
1360
1360
  let e = n.indexOf(t.entry);
@@ -1363,12 +1363,12 @@ function Ct(e) {
1363
1363
  z();
1364
1364
  }
1365
1365
  }
1366
- function me(e, t) {
1366
+ function de(e, t) {
1367
1367
  let n = !t.group.dropped;
1368
- return t.group.dropped = !0, e.pending = e.pending.filter((e) => e.group !== t.group || e.sent), n && pe(e, t), ge(e), n;
1368
+ return t.group.dropped = !0, e.pending = e.pending.filter((e) => e.group !== t.group || e.sent), n && ue(e, t), pe(e), n;
1369
1369
  }
1370
- function he(e, t, n) {
1371
- if (fe(e, t), me(e, t)) {
1370
+ function fe(e, t, n) {
1371
+ if (K(e, t), de(e, t)) {
1372
1372
  let r = _t(n) ?? "invalid_operation";
1373
1373
  if (t.origin === "edit" || t.origin === "ai") {
1374
1374
  let t = vt(n);
@@ -1382,21 +1382,21 @@ function Ct(e) {
1382
1382
  code: r
1383
1383
  }, e);
1384
1384
  }
1385
- xe(e), e === v && Te();
1385
+ _e(e), e === v && xe();
1386
1386
  }
1387
- function ge(e) {
1387
+ function pe(e) {
1388
1388
  if (!(e.pending.length > 0 || e.waiters.length === 0)) for (let t of e.waiters.splice(0)) t.resolve();
1389
1389
  }
1390
- function _e(e, t) {
1390
+ function J(e, t) {
1391
1391
  let n = t instanceof Error ? t : Error(String(t));
1392
1392
  for (let t of e.waiters.splice(0)) t.reject(n);
1393
1393
  }
1394
- function ve(e, t) {
1394
+ function me(e, t) {
1395
1395
  if (t.revision <= e.revision) return;
1396
1396
  let n = e.pending.find((e) => e.batchId === t.batchId);
1397
- n ? de(e, n, t.revision) : (e.remote.set(t.revision, t), be(e));
1397
+ n ? le(e, n, t.revision) : (e.remote.set(t.revision, t), ge(e));
1398
1398
  }
1399
- function ye(t, n) {
1399
+ function he(t, n) {
1400
1400
  let r = n.ops;
1401
1401
  if (e.normalizeRemoteOperations) try {
1402
1402
  r = e.normalizeRemoteOperations(n.ops, t.confirmed);
@@ -1405,24 +1405,24 @@ function Ct(e) {
1405
1405
  }
1406
1406
  return St(r);
1407
1407
  }
1408
- function be(t) {
1408
+ function ge(t) {
1409
1409
  let n = [], r = !1;
1410
1410
  for (;;) {
1411
1411
  let e = t.revision + 1, i = t.remote.get(e), a = t.own.get(e);
1412
1412
  if (!i && !a) break;
1413
1413
  try {
1414
- t.confirmed = P(t.confirmed, i ? ye(t, i) : a.ops);
1414
+ t.confirmed = F(t.confirmed, i ? he(t, i) : a.ops);
1415
1415
  } catch {
1416
1416
  if (t.recovering) {
1417
1417
  t.remote.clear(), t.own.clear(), I(/* @__PURE__ */ Error("[Templatical] Collaboration: this editor can't follow the template's changes. Reload the page."));
1418
1418
  return;
1419
1419
  }
1420
- G(t);
1420
+ Y(t);
1421
1421
  return;
1422
1422
  }
1423
- t.revision = e, i ? (t.remote.delete(e), n.push(i)) : (t.own.delete(e), a.group.dropped && (r = !0), fe(t, a));
1423
+ t.revision = e, i ? (t.remote.delete(e), n.push(i)) : (t.own.delete(e), a.group.dropped && (r = !0), K(t, a));
1424
1424
  }
1425
- if (t === v && (m.value = t.revision), t.remote.size > 0 || t.own.size > 0 ? Ce(t) : we(t), (n.length !== 0 || r) && (xe(t), t === v)) for (let t of n) try {
1425
+ if (t === v && (m.value = t.revision), t.remote.size > 0 || t.own.size > 0 ? ye(t) : be(t), (n.length !== 0 || r) && (_e(t), t === v)) for (let t of n) try {
1426
1426
  e.onRemoteChange?.({
1427
1427
  actor: t.actor,
1428
1428
  ops: t.ops,
@@ -1432,29 +1432,29 @@ function Ct(e) {
1432
1432
  I(e);
1433
1433
  }
1434
1434
  }
1435
- function xe(e) {
1435
+ function _e(e) {
1436
1436
  let t = !w;
1437
1437
  w = !0;
1438
1438
  try {
1439
- Se(e);
1439
+ ve(e);
1440
1440
  } finally {
1441
1441
  t && (w = !1);
1442
1442
  }
1443
- t && le(e);
1443
+ t && W(e);
1444
1444
  }
1445
- function Se(e) {
1446
- e === v && W();
1445
+ function ve(e) {
1446
+ e === v && V();
1447
1447
  let t = e.confirmed;
1448
1448
  for (let n = 0; n < e.pending.length; n++) {
1449
1449
  let r = e.pending[n], i;
1450
- if (r.base && !T(r.base, t)) i = "precondition_failed";
1450
+ if (r.base && !q(r.base, t)) i = "precondition_failed";
1451
1451
  else try {
1452
- t = P(t, r.ops);
1452
+ t = F(t, r.ops);
1453
1453
  continue;
1454
1454
  } catch (e) {
1455
- i = e instanceof U ? e.code : "invalid_operation";
1455
+ i = e instanceof P ? e.code : "invalid_operation";
1456
1456
  }
1457
- r.sent || (me(e, r) && L(r.origin === "edit" || r.origin === "ai" ? {
1457
+ r.sent || (de(e, r) && L(r.origin === "edit" || r.origin === "ai" ? {
1458
1458
  type: "editRefused",
1459
1459
  code: i
1460
1460
  } : {
@@ -1462,27 +1462,27 @@ function Ct(e) {
1462
1462
  code: i
1463
1463
  }, e), t = e.confirmed, n = -1);
1464
1464
  }
1465
- e.view = t, ge(e), e === v && B(t);
1465
+ e.view = t, pe(e), e === v && B(t);
1466
1466
  }
1467
- function Ce(e) {
1467
+ function ye(e) {
1468
1468
  e.gapTimer ||= setTimeout(() => {
1469
- e.gapTimer = null, e === v && Te();
1469
+ e.gapTimer = null, e === v && xe();
1470
1470
  }, ut);
1471
1471
  }
1472
- function we(e) {
1472
+ function be(e) {
1473
1473
  e.gapTimer &&= (clearTimeout(e.gapTimer), null);
1474
1474
  }
1475
- function Te() {
1475
+ function xe() {
1476
1476
  let e = v;
1477
1477
  return e ? (e.catchingUp ||= (async () => {
1478
1478
  try {
1479
1479
  let n = await t.operationsAfter(e.templateId, e.revision);
1480
1480
  if (e.retired) return;
1481
1481
  if ("resync" in n) {
1482
- await G(e);
1482
+ await Y(e);
1483
1483
  return;
1484
1484
  }
1485
- for (let t of n.batches) ve(e, t);
1485
+ for (let t of n.batches) me(e, t);
1486
1486
  } catch (e) {
1487
1487
  I(e);
1488
1488
  } finally {
@@ -1490,26 +1490,26 @@ function Ct(e) {
1490
1490
  }
1491
1491
  })(), e.catchingUp) : Promise.resolve();
1492
1492
  }
1493
- async function G(t) {
1493
+ async function Y(t) {
1494
1494
  t.recovering = !0;
1495
1495
  try {
1496
1496
  let n = await e.loadTemplate(t.templateId);
1497
1497
  if (t.retired) return;
1498
1498
  let r = n.revision ?? t.revision;
1499
- t.confirmed = H(n.content), t.revision = r, t.remote = new Map([...t.remote].filter(([e]) => e > r));
1500
- for (let [e, n] of [...t.own]) e <= r && (t.own.delete(e), fe(t, n));
1501
- t === v && (m.value = r), xe(t), be(t);
1499
+ t.confirmed = G(n.content), t.revision = r, t.remote = new Map([...t.remote].filter(([e]) => e > r));
1500
+ for (let [e, n] of [...t.own]) e <= r && (t.own.delete(e), K(t, n));
1501
+ t === v && (m.value = r), _e(t), ge(t);
1502
1502
  } catch (e) {
1503
1503
  I(e);
1504
1504
  } finally {
1505
1505
  t.recovering = !1;
1506
1506
  }
1507
1507
  }
1508
- function Ee(t) {
1508
+ function Se(t) {
1509
1509
  let n = () => t === v && !t.retired;
1510
1510
  return {
1511
1511
  onBatch: (e) => {
1512
- n() && ve(t, e);
1512
+ n() && me(t, e);
1513
1513
  },
1514
1514
  onResync: (r, i) => {
1515
1515
  if (!(!n() || r <= t.revision)) {
@@ -1521,7 +1521,7 @@ function Ct(e) {
1521
1521
  } catch (e) {
1522
1522
  I(e);
1523
1523
  }
1524
- Te();
1524
+ xe();
1525
1525
  }
1526
1526
  },
1527
1527
  onLock: (e) => {
@@ -1534,23 +1534,23 @@ function Ct(e) {
1534
1534
  n() && Z(e);
1535
1535
  },
1536
1536
  onConnectionChange: (e) => {
1537
- n() && q(t, e);
1537
+ n() && Ee(t, e);
1538
1538
  }
1539
1539
  };
1540
1540
  }
1541
- function De(e, r) {
1541
+ function Ce(e, r) {
1542
1542
  let i = d;
1543
- t.join(e.templateId, { sessionId: n }, Ee(e)).then((t) => {
1544
- 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 && Te(), r && Q());
1543
+ t.join(e.templateId, { sessionId: n }, Se(e)).then((t) => {
1544
+ 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 && xe(), r && Q());
1545
1545
  }, (e) => I(e));
1546
1546
  }
1547
- function Oe(e) {
1548
- let t = H(e.content), n = {
1547
+ function we(e) {
1548
+ let t = G(e.content), n = {
1549
1549
  templateId: e.id,
1550
1550
  confirmed: t,
1551
1551
  revision: e.revision ?? 0,
1552
1552
  pending: [],
1553
- view: H(t),
1553
+ view: G(t),
1554
1554
  remote: /* @__PURE__ */ new Map(),
1555
1555
  own: /* @__PURE__ */ new Map(),
1556
1556
  inFlight: null,
@@ -1563,49 +1563,49 @@ function Ct(e) {
1563
1563
  redo: [],
1564
1564
  waiters: []
1565
1565
  };
1566
- v = n, m.value = n.revision, z(), De(n, !1), _?.state.selectedBlockId && ze(_.state.selectedBlockId), ae();
1566
+ v = n, m.value = n.revision, z(), Ce(n, !1), _?.state.selectedBlockId && ze(_.state.selectedBlockId), ae();
1567
1567
  }
1568
- function K(e) {
1569
- e.retired = !0, we(e), e.leave?.(), e.leave = null, _e(e, /* @__PURE__ */ Error("[Templatical] The template was closed."));
1568
+ function Te(e) {
1569
+ e.retired = !0, be(e), e.leave?.(), e.leave = null, J(e, /* @__PURE__ */ Error("[Templatical] The template was closed."));
1570
1570
  }
1571
- function q(e, t) {
1571
+ function Ee(e, t) {
1572
1572
  let n = p.value;
1573
- p.value = t, t === "connected" && n !== null && n !== "connected" && De(e, !0);
1573
+ p.value = t, t === "connected" && n !== null && n !== "connected" && Ce(e, !0);
1574
1574
  }
1575
- function ke(e) {
1576
- v && v.templateId === e?.id || (v &&= (oe(), K(v), null), a.value = [], s.value = /* @__PURE__ */ new Map(), p.value = null, M = null, Q(), z(), e && Oe(e));
1575
+ function De(e) {
1576
+ v && v.templateId === e?.id || (v &&= (oe(), Te(v), null), a.value = [], s.value = /* @__PURE__ */ new Map(), p.value = null, A = null, Q(), z(), e && we(e));
1577
1577
  }
1578
- function J(e, t) {
1578
+ function Oe(e, t) {
1579
1579
  return `${e}\u0000${t ?? ""}`;
1580
1580
  }
1581
- function Y(e, t, n) {
1581
+ function ke(e, t, n) {
1582
1582
  return e.blockId === t && (n == null || e.locale == null || e.locale === n);
1583
1583
  }
1584
1584
  function Ae(e) {
1585
1585
  return [...s.value.values()].filter((t) => t.blockId === e);
1586
1586
  }
1587
1587
  function je(e) {
1588
- e !== f.value && (W(), f.value = e, ze(_?.state.selectedBlockId ?? null));
1588
+ e !== f.value && (V(), f.value = e, ze(_?.state.selectedBlockId ?? null));
1589
1589
  }
1590
1590
  function X(e, t = !1) {
1591
1591
  if (e.holder.sessionId === n) return;
1592
1592
  t ? l.add(e) : u.set(e, ++d);
1593
1593
  let r = new Map([...s.value].filter(([, t]) => t.holder.sessionId !== e.holder.sessionId));
1594
- r.set(J(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({
1594
+ r.set(Oe(e.blockId, e.locale), e), s.value = r, _?.state.selectedBlockId === e.blockId && (f.value === null || e.locale == null || e.locale === f.value) && (_.selectBlock(null), L({
1595
1595
  type: "selectionRefused",
1596
1596
  blockId: e.blockId,
1597
1597
  holder: e.holder
1598
1598
  }));
1599
1599
  }
1600
1600
  function Me(e, t, n) {
1601
- let r = J(e, n), i = new Map([...s.value].filter(([n, i]) => i.holder.sessionId !== t || n !== r && !(i.blockId === e && l.has(i))));
1601
+ let r = Oe(e, n), i = new Map([...s.value].filter(([n, i]) => i.holder.sessionId !== t || n !== r && !(i.blockId === e && l.has(i))));
1602
1602
  i.size !== s.value.size && (s.value = i);
1603
1603
  }
1604
1604
  function Ne(e, t, r) {
1605
1605
  let i = new Map([...s.value].filter(([, e]) => !l.has(e) && (t || (u.get(e) ?? 0) > r))), a = [...i.values()];
1606
- for (let t of e) if (t.holder.sessionId !== n && !a.some((e) => e.holder.sessionId === t.holder.sessionId || Y(e, t.blockId, t.locale))) {
1606
+ for (let t of e) if (t.holder.sessionId !== n && !a.some((e) => e.holder.sessionId === t.holder.sessionId || ke(e, t.blockId, t.locale))) {
1607
1607
  for (let [e, n] of i) n.holder.sessionId === t.holder.sessionId && i.delete(e);
1608
- i.set(J(t.blockId, t.locale), t);
1608
+ i.set(Oe(t.blockId, t.locale), t);
1609
1609
  }
1610
1610
  s.value = i;
1611
1611
  }
@@ -1616,36 +1616,36 @@ function Ct(e) {
1616
1616
  r.size !== s.value.size && (s.value = r);
1617
1617
  }
1618
1618
  function Pe(e) {
1619
- ee = ee.then(e).catch(I);
1619
+ te = te.then(e).catch(I);
1620
1620
  }
1621
1621
  function Q() {
1622
1622
  i && Pe(async () => {
1623
- if (N && (M === null || N.templateId !== M.templateId || N.locale !== M.locale)) {
1624
- let e = N;
1625
- N = null, Re(), await t.releaseLock(e.templateId, e.blockId, e.locale);
1623
+ if (j && (A === null || j.templateId !== A.templateId || j.locale !== A.locale)) {
1624
+ let e = j;
1625
+ j = null, Re(), await t.releaseLock(e.templateId, e.blockId, e.locale);
1626
1626
  }
1627
- let e = M;
1628
- if (!(!e || N?.templateId === e.templateId && N.blockId === e.blockId && N.locale === e.locale)) try {
1627
+ let e = A;
1628
+ if (!(!e || j?.templateId === e.templateId && j.blockId === e.blockId && j.locale === e.locale)) try {
1629
1629
  let n = await t.acquireLock(e.templateId, e.blockId, e.locale);
1630
- N = e, Le(), Fe(n.blockId, n.locale ?? null);
1630
+ j = e, Le(), Fe(n.blockId, n.locale ?? null);
1631
1631
  } catch (n) {
1632
- if (N?.templateId === e.templateId) {
1633
- let e = N;
1634
- N = null, Re(), await t.releaseLock(e.templateId, e.blockId, e.locale).catch(() => {});
1632
+ if (j?.templateId === e.templateId) {
1633
+ let e = j;
1634
+ j = null, Re(), await t.releaseLock(e.templateId, e.blockId, e.locale).catch(() => {});
1635
1635
  }
1636
- if (M !== e) return;
1636
+ if (A !== e) return;
1637
1637
  Ie(e.blockId, n);
1638
1638
  }
1639
1639
  });
1640
1640
  }
1641
1641
  function Fe(e, t) {
1642
- let n = new Map([...s.value].filter(([, n]) => !Y(n, e, t)));
1642
+ let n = new Map([...s.value].filter(([, n]) => !ke(n, e, t)));
1643
1643
  n.size !== s.value.size && (s.value = n);
1644
1644
  }
1645
1645
  function Ie(e, t) {
1646
1646
  let n = _t(t);
1647
1647
  if (n === "lock_held" || n === "block_missing") {
1648
- M = null;
1648
+ A = null;
1649
1649
  let n = vt(t);
1650
1650
  n ? X({
1651
1651
  blockId: e,
@@ -1653,18 +1653,18 @@ function Ct(e) {
1653
1653
  expiresAt: ""
1654
1654
  }, !0) : _?.state.selectedBlockId === e && _.selectBlock(null);
1655
1655
  } else I(t), setTimeout(() => {
1656
- M?.blockId === e && Q();
1656
+ A?.blockId === e && Q();
1657
1657
  }, ft[0]);
1658
1658
  }
1659
1659
  function Le() {
1660
- F ||= setInterval(() => {
1660
+ M ||= setInterval(() => {
1661
1661
  Pe(async () => {
1662
- let e = N;
1662
+ let e = j;
1663
1663
  if (e) try {
1664
1664
  await t.renewLock(e.templateId, e.blockId, e.locale);
1665
1665
  } catch (e) {
1666
1666
  if (_t(e) === "lock_lost") {
1667
- N = null, Re(), Q();
1667
+ j = null, Re(), Q();
1668
1668
  return;
1669
1669
  }
1670
1670
  I(e);
@@ -1673,25 +1673,25 @@ function Ct(e) {
1673
1673
  }, dt);
1674
1674
  }
1675
1675
  function Re() {
1676
- F &&= (clearInterval(F), null);
1676
+ M &&= (clearInterval(M), null);
1677
1677
  }
1678
1678
  function ze(e) {
1679
- W(), v && (M = e ? {
1679
+ V(), v && (A = e ? {
1680
1680
  templateId: v.templateId,
1681
1681
  blockId: e,
1682
1682
  locale: f.value
1683
1683
  } : null, Q());
1684
1684
  }
1685
1685
  function Be() {
1686
- W(), N && i && (t.releaseLock(N.templateId, N.blockId, N.locale).catch(() => {}), N = null, Re()), v?.leave?.(), v && (v.leave = null);
1686
+ V(), j && i && (t.releaseLock(j.templateId, j.blockId, j.locale).catch(() => {}), j = null, Re()), v?.leave?.(), v && (v.leave = null);
1687
1687
  }
1688
1688
  function Ve(e) {
1689
1689
  let t = v;
1690
1690
  if (!t || y) return;
1691
- W();
1691
+ V();
1692
1692
  let n = (e === "undo" ? t.undo : t.redo).pop();
1693
1693
  if (!n) return;
1694
- if (z(), n.view && !T(n.view, t.view)) {
1694
+ if (z(), n.view && !q(n.view, t.view)) {
1695
1695
  L({
1696
1696
  type: "undoSkipped",
1697
1697
  code: "precondition_failed"
@@ -1700,41 +1700,41 @@ function Ct(e) {
1700
1700
  }
1701
1701
  let r;
1702
1702
  try {
1703
- r = P(t.view, n.ops, R());
1703
+ r = F(t.view, n.ops, R());
1704
1704
  } catch (e) {
1705
- if (!(e instanceof U)) throw e;
1705
+ if (!(e instanceof P)) throw e;
1706
1706
  L({
1707
1707
  type: "undoSkipped",
1708
1708
  code: e.code
1709
1709
  });
1710
1710
  return;
1711
1711
  }
1712
- let i = gt({ ops: D(t.view, n.ops) }, r);
1712
+ let i = gt({ ops: ne(t.view, n.ops) }, r);
1713
1713
  ie(e === "undo" ? t.redo : t.undo, i);
1714
1714
  let a = t.view;
1715
- t.view = r, B(r), _?.markDirty(), ce(t, n.ops, e, i, a);
1715
+ t.view = r, B(r), _?.markDirty(), U(t, n.ops, e, i, a);
1716
1716
  }
1717
1717
  function He(e, t) {
1718
1718
  let n = v;
1719
1719
  if (!_ || !n || y) return {
1720
1720
  applied: !1,
1721
- error: new U("invalid_operation", 0, "No template is open for editing.")
1721
+ error: new P("invalid_operation", 0, "No template is open for editing.")
1722
1722
  };
1723
1723
  if (t.origin === void 0) try {
1724
- P(_.content.value, e, R());
1724
+ F(_.content.value, e, R());
1725
1725
  } catch (e) {
1726
- if (e instanceof U) return {
1726
+ if (e instanceof P) return {
1727
1727
  applied: !1,
1728
1728
  error: e
1729
1729
  };
1730
1730
  throw e;
1731
1731
  }
1732
- W();
1732
+ V();
1733
1733
  let r, i;
1734
1734
  try {
1735
- r = P(n.view, e, R()), i = D(n.view, e);
1735
+ r = F(n.view, e, R()), i = ne(n.view, e);
1736
1736
  } catch (e) {
1737
- if (e instanceof U) return {
1737
+ if (e instanceof P) return {
1738
1738
  applied: !1,
1739
1739
  error: e
1740
1740
  };
@@ -1742,7 +1742,7 @@ function Ct(e) {
1742
1742
  }
1743
1743
  let a = n.undo.at(-1), o;
1744
1744
  if (t.origin === "ai" && t.turn !== void 0 && a && a.turn === t.turn) {
1745
- let e = a.view !== void 0 && !T(a.view, n.view);
1745
+ let e = a.view !== void 0 && !q(a.view, n.view);
1746
1746
  a.ops = [...i, ...a.ops], o = e ? a : gt(a, r);
1747
1747
  } else o = gt({
1748
1748
  ops: i,
@@ -1750,7 +1750,7 @@ function Ct(e) {
1750
1750
  }, r), ie(n.undo, o);
1751
1751
  n.redo = [], z();
1752
1752
  let s = n.view;
1753
- return n.view = r, B(r), _.markDirty(), ce(n, e, t.origin ?? "edit", o, s), {
1753
+ return n.view = r, B(r), _.markDirty(), U(n, e, t.origin ?? "edit", o, s), {
1754
1754
  applied: !0,
1755
1755
  inverse: i
1756
1756
  };
@@ -1761,28 +1761,28 @@ function Ct(e) {
1761
1761
  if (t.moveBlock && t.findBlockLocation) {
1762
1762
  let n = t.moveBlock, r = (...r) => {
1763
1763
  let i = v, a = i && !y && !C && !e.state.isLoading && e.state.template?.id === i.templateId;
1764
- if (a && V(!0), n(...r), !a || T(i.view, e.content.value)) return;
1764
+ if (a && se(!0), n(...r), !a || q(i.view, e.content.value)) return;
1765
1765
  let o = t.findBlockLocation(r[0]);
1766
1766
  if (!o) return;
1767
1767
  let s = o.targetSectionId ? {
1768
1768
  sectionId: o.targetSectionId,
1769
1769
  column: o.columnIndex ?? 0
1770
1770
  } : null, c = s ? e.content.value.blocks.find((e) => e.id === s.sectionId) : void 0;
1771
- se(i, [{
1771
+ H(i, [{
1772
1772
  op: "moveBlock",
1773
1773
  blockId: r[0],
1774
1774
  parent: s,
1775
1775
  after: (s && c?.type === "section" ? c.children[s.column] : e.content.value.blocks)[o.index - 1]?.id ?? null
1776
1776
  }]);
1777
1777
  };
1778
- t.moveBlock = r, j.push(() => {
1778
+ t.moveBlock = r, k.push(() => {
1779
1779
  t.moveBlock === r && (t.moveBlock = n);
1780
1780
  });
1781
1781
  }
1782
- j.push(h(() => e.state.template, (e) => ke(e), { immediate: !0 }), h(() => e.content.value, ae, { deep: !0 }), h(() => e.state.selectedBlockId, ze), h(() => e.state.isLoading, (e) => e ? V(!0, !0) : ae())), typeof window < "u" && (window.addEventListener("pagehide", Be), window.addEventListener("blur", W)), c() && o(qe);
1782
+ k.push(h(() => e.state.template, (e) => De(e), { immediate: !0 }), h(() => e.content.value, ae, { deep: !0 }), h(() => e.state.selectedBlockId, ze), h(() => e.state.isLoading, (e) => e ? se(!0, !0) : ae())), typeof window < "u" && (window.addEventListener("pagehide", Be), window.addEventListener("blur", V)), c() && o(qe);
1783
1783
  }
1784
1784
  function We() {
1785
- W();
1785
+ V();
1786
1786
  let e = v;
1787
1787
  return !e || e.pending.length === 0 ? Promise.resolve() : new Promise((t, n) => e.waiters.push({
1788
1788
  resolve: t,
@@ -1790,16 +1790,16 @@ function Ct(e) {
1790
1790
  }));
1791
1791
  }
1792
1792
  function Ge() {
1793
- W(), y = !0;
1793
+ V(), y = !0;
1794
1794
  }
1795
1795
  function Ke() {
1796
1796
  y = !1, v && B(v.view);
1797
1797
  }
1798
1798
  function qe() {
1799
- if (!A) {
1800
- W();
1801
- for (let e of j.splice(0)) e();
1802
- oe(), Be(), A = !0, v && K(v), v = null, Re(), typeof window < "u" && (window.removeEventListener("pagehide", Be), window.removeEventListener("blur", W));
1799
+ if (!O) {
1800
+ V();
1801
+ for (let e of k.splice(0)) e();
1802
+ oe(), Be(), O = !0, v && Te(v), v = null, Re(), typeof window < "u" && (window.removeEventListener("pagehide", Be), window.removeEventListener("blur", V));
1803
1803
  }
1804
1804
  }
1805
1805
  return {
@@ -1811,7 +1811,7 @@ function Ct(e) {
1811
1811
  setLockLocale: je,
1812
1812
  connection: p,
1813
1813
  revision: m,
1814
- canUndo: ne,
1814
+ canUndo: N,
1815
1815
  canRedo: re,
1816
1816
  attach: Ue,
1817
1817
  undo: () => Ve("undo"),
@@ -1819,11 +1819,11 @@ function Ct(e) {
1819
1819
  clearHistory: () => {
1820
1820
  v && (v.undo = [], v.redo = [], z());
1821
1821
  },
1822
- flush: W,
1822
+ flush: V,
1823
1823
  settle: We,
1824
1824
  suspend: Ge,
1825
1825
  resume: Ke,
1826
- catchUp: Te,
1826
+ catchUp: xe,
1827
1827
  hasConfirmedBlock: (e) => v ? bt(v.confirmed.blocks, e) : !1,
1828
1828
  applyOperations: He,
1829
1829
  destroy: qe
@@ -1846,7 +1846,7 @@ function wt(e) {
1846
1846
  return s.value && e.canDelete !== !1;
1847
1847
  }
1848
1848
  function u(e, t) {
1849
- throw new R(`[Templatical] Saved blocks: ${e} is ${t}. Check the capability before calling — the editor's own UI hides the action.`);
1849
+ throw new H(`[Templatical] Saved blocks: ${e} is ${t}. Check the capability before calling — the editor's own UI hides the action.`);
1850
1850
  }
1851
1851
  function d(t) {
1852
1852
  Q(e.onError, t);
@@ -1944,7 +1944,7 @@ function Et(e = {}) {
1944
1944
  },
1945
1945
  async create(e) {
1946
1946
  let t = (/* @__PURE__ */ new Date()).toISOString(), n = {
1947
- id: oe(),
1947
+ id: j(),
1948
1948
  name: e.name,
1949
1949
  content: e.content,
1950
1950
  ...e.category ? { category: e.category } : {},
@@ -2011,7 +2011,7 @@ function kt(e = {}) {
2011
2011
  },
2012
2012
  async create(e) {
2013
2013
  let t = await a(e.file), n = (/* @__PURE__ */ new Date()).toISOString(), o = {
2014
- id: oe(),
2014
+ id: j(),
2015
2015
  url: t,
2016
2016
  filename: e.filename || e.file.name,
2017
2017
  createdAt: n,
@@ -2051,11 +2051,11 @@ function At(e) {
2051
2051
  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");
2052
2052
  function u(e) {
2053
2053
  let t = n();
2054
- if (!t) throw new R(`[Templatical] Version history: ${e} needs a template. Call create() or load() first.`);
2054
+ if (!t) throw new H(`[Templatical] Version history: ${e} needs a template. Call create() or load() first.`);
2055
2055
  return t;
2056
2056
  }
2057
2057
  function d(e) {
2058
- throw new R(`[Templatical] Version history: ${e} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`);
2058
+ throw new H(`[Templatical] Version history: ${e} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`);
2059
2059
  }
2060
2060
  function f(t) {
2061
2061
  Q(e.onError, t);
@@ -2134,16 +2134,16 @@ function jt(e) {
2134
2134
  });
2135
2135
  function m(e) {
2136
2136
  let t = n();
2137
- if (!t) throw new R(`[Templatical] Comments: ${e} needs a template. Call create() or load() first.`);
2137
+ if (!t) throw new H(`[Templatical] Comments: ${e} needs a template. Call create() or load() first.`);
2138
2138
  return t;
2139
2139
  }
2140
2140
  function h(e) {
2141
2141
  let t = r();
2142
- if (!t) throw new R(`[Templatical] Comments: ${e} needs to know who is commenting. Pass init({ user: { id, name } }) — an unattributed comment is not written.`);
2142
+ if (!t) throw new H(`[Templatical] Comments: ${e} needs to know who is commenting. Pass init({ user: { id, name } }) — an unattributed comment is not written.`);
2143
2143
  return t;
2144
2144
  }
2145
2145
  function g(e) {
2146
- throw new R(`[Templatical] Comments: ${e} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`);
2146
+ throw new H(`[Templatical] Comments: ${e} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`);
2147
2147
  }
2148
2148
  function _(e) {
2149
2149
  for (let t of i.value) {
@@ -2225,7 +2225,7 @@ function jt(e) {
2225
2225
  o.value = !1;
2226
2226
  }
2227
2227
  }
2228
- async function k(e, n) {
2228
+ async function ee(e, n) {
2229
2229
  let { update: r } = t;
2230
2230
  typeof r != "function" && g("update");
2231
2231
  let i = m("update");
@@ -2239,7 +2239,7 @@ function jt(e) {
2239
2239
  o.value = !1;
2240
2240
  }
2241
2241
  }
2242
- async function A(e) {
2242
+ async function k(e) {
2243
2243
  let { delete: n } = t;
2244
2244
  typeof n != "function" && g("delete");
2245
2245
  let r = m("delete");
@@ -2254,7 +2254,7 @@ function jt(e) {
2254
2254
  o.value = !1;
2255
2255
  }
2256
2256
  }
2257
- async function j(e, n) {
2257
+ async function A(e, n) {
2258
2258
  let { setResolved: r } = t;
2259
2259
  typeof r != "function" && g("setResolved");
2260
2260
  let i = m("setResolved");
@@ -2268,13 +2268,13 @@ function jt(e) {
2268
2268
  o.value = !1;
2269
2269
  }
2270
2270
  }
2271
- function M(e) {
2271
+ function j(e) {
2272
2272
  T(e) && x(() => t.onCreated?.(e, { origin: "remote" }));
2273
2273
  }
2274
- function N(e) {
2274
+ function te(e) {
2275
2275
  T(e) && x(() => (e.resolvedAt ? t.onResolved : t.onUpdated)?.(e, { origin: "remote" }));
2276
2276
  }
2277
- function ee(e, n) {
2277
+ function M(e, n) {
2278
2278
  let r = E(e, n);
2279
2279
  r && x(() => t.onDeleted?.(r, { origin: "remote" }));
2280
2280
  }
@@ -2291,14 +2291,14 @@ function jt(e) {
2291
2291
  commentCountByBlock: p,
2292
2292
  load: D,
2293
2293
  create: O,
2294
- update: k,
2295
- remove: A,
2296
- setResolved: j,
2294
+ update: ee,
2295
+ remove: k,
2296
+ setResolved: A,
2297
2297
  find: _,
2298
2298
  isOwn: y,
2299
- applyRemoteCreate: M,
2300
- applyRemoteUpdate: N,
2301
- applyRemoteDelete: ee
2299
+ applyRemoteCreate: j,
2300
+ applyRemoteUpdate: te,
2301
+ applyRemoteDelete: M
2302
2302
  };
2303
2303
  }
2304
2304
  function Mt(e) {
@@ -2355,7 +2355,7 @@ function Pt(t) {
2355
2355
  };
2356
2356
  }
2357
2357
  function Ft(e) {
2358
- let t = a(ye, null), n = v(e);
2358
+ let t = a(he, null), n = v(e);
2359
2359
  if (!t) return n;
2360
2360
  let i;
2361
2361
  function s() {
@@ -2382,14 +2382,14 @@ function It(e, t) {
2382
2382
  return typeof n == "string" && n.length > 0 ? n : t;
2383
2383
  }
2384
2384
  function Lt(e, t) {
2385
- return typeof e?.url == "string" && ue(e.url, t);
2385
+ return typeof e?.url == "string" && L(e.url, t);
2386
2386
  }
2387
2387
  function Rt(e, t) {
2388
2388
  let n = e?.url;
2389
- if (typeof n == "string" && n.trim() !== "") return ue(n, t) ? void 0 : n;
2389
+ if (typeof n == "string" && n.trim() !== "") return L(n, t) ? void 0 : n;
2390
2390
  }
2391
2391
  function zt(e) {
2392
- let t = a(ve, ce.liquid), n = Ft(() => Rt(e(), t));
2392
+ let t = a(me, k.liquid), n = Ft(() => Rt(e(), t));
2393
2393
  return v(() => Lt(e(), t) ? null : n.value);
2394
2394
  }
2395
2395
  function Bt(e, t, n) {
@@ -2406,7 +2406,7 @@ function Ht(e, t, n = []) {
2406
2406
  }
2407
2407
  // src/utils/resolveFieldColors.ts
2408
2408
  function Ut(e, t) {
2409
- let n = we({ presets: e.presets }, Te), r = n.presets.length === 0;
2409
+ let n = be({ presets: e.presets }, xe), r = n.presets.length === 0;
2410
2410
  return {
2411
2411
  presets: r ? t.presets : n.presets,
2412
2412
  allowCustom: t.allowCustom === !1 ? !1 : e.allowCustom ?? t.allowCustom,
@@ -2466,7 +2466,7 @@ var Xt = /* @__PURE__ */ t({
2466
2466
  size: { default: "field" }
2467
2467
  },
2468
2468
  setup(e) {
2469
- let t = e, { t: r } = Se(), i = {
2469
+ let t = e, { t: r } = ve(), i = {
2470
2470
  field: {
2471
2471
  gap: "tpl:gap-1.5",
2472
2472
  icon: 18,
@@ -2481,11 +2481,11 @@ var Xt = /* @__PURE__ */ t({
2481
2481
  return (t, i) => (n(), l("div", {
2482
2482
  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]),
2483
2483
  style: y({ backgroundColor: `color-mix(in srgb, var(--tpl-bg) ${a.value.veil}, transparent)` })
2484
- }, [e.uploading ? (n(), l(C, { key: 0 }, [w(f(ge), {
2484
+ }, [e.uploading ? (n(), l(C, { key: 0 }, [w(f(pe), {
2485
2485
  class: "tpl-spinner",
2486
2486
  size: a.value.icon,
2487
2487
  "stroke-width": 2
2488
- }, null, 8, ["size"]), d(" " + g(f(r).image.uploading), 1)], 64)) : (n(), l(C, { key: 1 }, [w(f(_e), {
2488
+ }, null, 8, ["size"]), d(" " + g(f(r).image.uploading), 1)], 64)) : (n(), l(C, { key: 1 }, [w(f(J), {
2489
2489
  size: a.value.icon,
2490
2490
  "stroke-width": 1.5
2491
2491
  }, null, 8, ["size"]), d(" " + g(f(r).image.dropToUpload), 1)], 64))], 6));
@@ -2501,7 +2501,7 @@ function Zt() {
2501
2501
  // src/composables/useImageDrop.ts
2502
2502
  var Qt = "image/";
2503
2503
  function $t(e) {
2504
- let { target: t, onFiles: n, enabled: r } = e, i = () => r === void 0 || _(r), { isOverDropZone: a } = Ce(t, {
2504
+ let { target: t, onFiles: n, enabled: r } = e, i = () => r === void 0 || _(r), { isOverDropZone: a } = ye(t, {
2505
2505
  preventDefaultForUnhandled: !0,
2506
2506
  onDrop: (e) => {
2507
2507
  if (!i()) return;
@@ -2513,7 +2513,7 @@ function $t(e) {
2513
2513
  }
2514
2514
  // src/composables/useMediaDropField.ts
2515
2515
  function en(e) {
2516
- let { target: t, blocked: n, apply: r } = e, i = a(be, null), o = a(xe, null), s = Zt();
2516
+ let { target: t, blocked: n, apply: r } = e, i = a(ge, null), o = a(_e, null), s = Zt();
2517
2517
  async function c() {
2518
2518
  let e = await i?.({ accept: ["images"] });
2519
2519
  s.alive && e && r(e);
@@ -2562,7 +2562,7 @@ var nn = "width 300ms cubic-bezier(0.34, 1.56, 0.64, 1)", rn = {
2562
2562
  "2-1": [66.67, 33.33]
2563
2563
  };
2564
2564
  function an(e, t) {
2565
- let n = (e) => Math.trunc(e ?? 0), r = (e) => pe(e) === null ? 0 : Math.trunc(e.width);
2565
+ let n = (e) => Math.trunc(e ?? 0), r = (e) => se(e) === null ? 0 : Math.trunc(e.width);
2566
2566
  return n(e?.left) + n(e?.right) + r(t?.left) + r(t?.right);
2567
2567
  }
2568
2568
  function on(e, t) {
@@ -2573,23 +2573,23 @@ function sn(e, t) {
2573
2573
  return Math.floor(t) - an(e.styles.padding, n);
2574
2574
  }
2575
2575
  function* cn(e, t) {
2576
- for (let n of e) re(n) ? yield* cn(n.children, on(t, n.styles.padding)) : yield {
2576
+ for (let n of e) E(n) ? yield* cn(n.children, on(t, n.styles.padding)) : yield {
2577
2577
  block: n,
2578
- bandWidth: me(n) && n.wrapper ? on(t, n.wrapper.padding) : t
2578
+ bandWidth: O(n) && n.wrapper ? on(t, n.wrapper.padding) : t
2579
2579
  };
2580
2580
  }
2581
- function ln(e, t, n = z(e)) {
2581
+ function ln(e, t, n = D(e)) {
2582
2582
  if (!t) return e;
2583
2583
  try {
2584
- return ne(ae(t, n, { missing: "default" }), e);
2584
+ return le(oe(t, n, { missing: "default" }), e);
2585
2585
  } catch {
2586
2586
  return e;
2587
2587
  }
2588
2588
  }
2589
2589
  function un(e, t, n, r) {
2590
2590
  let i = ln(e, n, r);
2591
- for (let { block: e, bandWidth: n } of cn(i.blocks, i.settings.width)) if (me(e)) {
2592
- let r = de(e)?.applied ? void 0 : e.border, i = Math.floor(n) - an(e.styles.padding, r), a = rn[e.columns] ?? [100];
2591
+ for (let { block: e, bandWidth: n } of cn(i.blocks, i.settings.width)) if (O(e)) {
2592
+ let r = W(e)?.applied ? void 0 : e.border, i = Math.floor(n) - an(e.styles.padding, r), a = rn[e.columns] ?? [100];
2593
2593
  for (let n = 0; n < e.children.length; n++) {
2594
2594
  let r = Math.floor(i * (a[n] ?? 100) / 100), o = e.children[n].find((e) => e.id === t);
2595
2595
  if (o) return sn(o, r);
@@ -2603,14 +2603,14 @@ function dn(e, t, n, r) {
2603
2603
  return null;
2604
2604
  }
2605
2605
  function fn(e) {
2606
- let t = me(e) ? de(e) : null;
2606
+ let t = O(e) ? W(e) : null;
2607
2607
  return !!t?.applied && t.height === "image";
2608
2608
  }
2609
2609
  function pn(e, t, n, r) {
2610
2610
  if (fn(e)) return (t ? dn(t, e.id, n, r) : null) ?? tn(t?.settings);
2611
2611
  }
2612
2612
  // src/constants/socialIcons.ts
2613
- var mn = fe, hn = {
2613
+ var mn = ue, hn = {
2614
2614
  small: 24,
2615
2615
  medium: 32,
2616
2616
  large: 48
@@ -2619,6 +2619,7 @@ var mn = fe, hn = {
2619
2619
  "twitter",
2620
2620
  "instagram",
2621
2621
  "linkedin",
2622
+ "xing",
2622
2623
  "youtube",
2623
2624
  "tiktok",
2624
2625
  "pinterest",
@@ -2635,4 +2636,4 @@ var mn = fe, hn = {
2635
2636
  ];
2636
2637
  export { Et as A, ze as B, Bt as C, jt as D, Mt as E, We as F, Ue as I, Ve as L, Ct as M, lt as N, At as O, Ge as P, He as R, Rt as S, Ft as T, Fe as V, Gt as _, fn as a, Vt as b, nn as c, Zt as d, Xt as f, Kt as g, qt as h, un as i, wt as j, kt as k, tn as l, Yt as m, mn as n, pn as o, Jt as p, gn as r, dn as s, hn as t, en as u, Ut as v, zt as w, Pt as x, Ht as y, Be as z };
2637
2638
 
2638
- //# sourceMappingURL=socialIcons-DeCYorUT.js.map
2639
+ //# sourceMappingURL=socialIcons-B5zrrV8-.js.map