@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
@@ -63,7 +63,7 @@ var s = {
63
63
  "center",
64
64
  "bottom"
65
65
  ];
66
- function ee(e) {
66
+ function p(e) {
67
67
  return {
68
68
  url: e,
69
69
  size: "cover",
@@ -74,7 +74,7 @@ function ee(e) {
74
74
  repeat: !1
75
75
  };
76
76
  }
77
- function te(e) {
77
+ function m(e) {
78
78
  let t = "";
79
79
  for (let n of e) {
80
80
  let e = n.charCodeAt(0);
@@ -82,35 +82,35 @@ function te(e) {
82
82
  }
83
83
  return t;
84
84
  }
85
- function ne(e) {
85
+ function ee(e) {
86
86
  let t = typeof e?.url == "string" ? e.url.trim() : "";
87
87
  if (!e || !t) return null;
88
88
  let n = u.includes(e.size) ? e.size : "cover", r = e.position, i = r && d.includes(r.x) ? r.x : "center", a = r && f.includes(r.y) ? r.y : "center";
89
89
  return {
90
- url: te(t),
90
+ url: m(t),
91
91
  size: n,
92
92
  position: `${i} ${a}`,
93
93
  repeat: e.repeat ? "repeat" : "no-repeat"
94
94
  };
95
95
  }
96
- var re = [
96
+ var te = [
97
97
  "top",
98
98
  "middle",
99
99
  "bottom"
100
100
  ];
101
- function ie(e) {
101
+ function ne(e) {
102
102
  let t = e.hero;
103
103
  if (!t || typeof t != "object") return null;
104
104
  if (e.columns !== "1") return {
105
105
  applied: !1,
106
106
  reason: "columns"
107
107
  };
108
- let n = ne(e.backgroundImage);
108
+ let n = ee(e.backgroundImage);
109
109
  if (n === null) return {
110
110
  applied: !1,
111
111
  reason: "image"
112
112
  };
113
- let r = oe(e.backgroundImage), i = ae(t.height) ? Math.round(t.height) : "image";
113
+ let r = ie(e.backgroundImage), i = re(t.height) ? Math.round(t.height) : "image";
114
114
  return i === "image" && r === null ? {
115
115
  applied: !1,
116
116
  reason: "size"
@@ -118,18 +118,18 @@ function ie(e) {
118
118
  applied: !0,
119
119
  image: n,
120
120
  height: i,
121
- verticalAlign: re.includes(t.verticalAlign) ? t.verticalAlign : "middle",
121
+ verticalAlign: te.includes(t.verticalAlign) ? t.verticalAlign : "middle",
122
122
  aspectRatio: r
123
123
  };
124
124
  }
125
- function ae(e) {
125
+ function re(e) {
126
126
  return typeof e == "number" && Number.isFinite(e) && e >= 1;
127
127
  }
128
- function oe(e) {
128
+ function ie(e) {
129
129
  let t = e?.naturalWidth, n = e?.naturalHeight;
130
130
  return typeof t != "number" || typeof n != "number" || !Number.isFinite(t) || !Number.isFinite(n) || t <= 0 || n <= 0 ? null : n / t;
131
131
  }
132
- var se = {
132
+ var ae = {
133
133
  facebook: {
134
134
  color: "#1877F2",
135
135
  path: "M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"
@@ -146,6 +146,10 @@ var se = {
146
146
  color: "#0A66C2",
147
147
  path: "M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"
148
148
  },
149
+ xing: {
150
+ color: "#006567",
151
+ path: "M18.188 0c-.517 0-.741.325-.927.66c0 0-7.455 13.224-7.702 13.657c.015.024 4.919 9.023 4.919 9.023c.17.308.436.66.967.66h3.454c.211 0 .375-.078.463-.22c.089-.151.089-.346-.009-.536l-4.879-8.916a.02.02 0 0 1 0-.022L22.139.756c.095-.191.097-.387.006-.535C22.056.078 21.894 0 21.686 0zM3.648 4.74c-.211 0-.385.074-.473.216c-.09.149-.078.339.02.531l2.34 4.05q.006.014 0 .021L1.86 16.051a.52.52 0 0 0 0 .529c.085.142.239.234.45.234h3.461c.518 0 .766-.348.945-.667l3.734-6.609l-2.378-4.155c-.172-.315-.434-.659-.962-.659H3.648z"
152
+ },
149
153
  youtube: {
150
154
  color: "#FF0000",
151
155
  path: "M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"
@@ -198,31 +202,31 @@ var se = {
198
202
  color: "#1769FF",
199
203
  path: "M22 7h-7V5h7v2zm1.726 10c-.442 1.297-2.029 3-5.101 3-3.074 0-5.564-1.729-5.564-5.675 0-3.91 2.325-5.92 5.466-5.92 3.082 0 4.964 1.782 5.375 4.426.078.506.109 1.188.095 2.14H15.97c.13 3.211 3.483 3.312 4.588 2.029h3.168zm-7.686-4h4.965c-.105-1.547-1.136-2.219-2.477-2.219-1.466 0-2.277.768-2.488 2.219zm-9.574 6.988H0V5.021h6.953c5.476.081 5.58 5.444 2.72 6.906 3.461 1.26 3.577 8.061-3.207 8.061zM3 11h3.584c2.508 0 2.906-3-.312-3H3v3zm3.391 3H3v3.016h3.341c3.055 0 2.868-3.016.05-3.016z"
200
204
  }
201
- }, ce = {
205
+ }, oe = {
202
206
  dark: "#1f1f1f",
203
207
  light: "#ffffff"
204
208
  };
205
- function le(e) {
209
+ function se(e) {
206
210
  return e === "dark" || e === "light" ? e : void 0;
207
211
  }
208
- function ue(e, t) {
209
- let n = le(t);
212
+ function ce(e, t) {
213
+ let n = se(t);
210
214
  return {
211
- fill: n ? ce[n] : se[e].color,
212
- onFill: n === "light" ? ce.dark : "#ffffff"
215
+ fill: n ? oe[n] : ae[e].color,
216
+ onFill: n === "light" ? oe.dark : "#ffffff"
213
217
  };
214
218
  }
215
- function de(e, t) {
216
- if (le(t) === "dark" && (e === "plain" || e === "outlined")) return {
217
- color: ce.light,
219
+ function le(e, t) {
220
+ if (se(t) === "dark" && (e === "plain" || e === "outlined")) return {
221
+ color: oe.light,
218
222
  opacity: .6,
219
223
  width: 1.4
220
224
  };
221
225
  }
222
- function fe(e) {
226
+ function ue(e) {
223
227
  return e === "plain" ? .84 : .6;
224
228
  }
225
- function pe(e) {
229
+ function de(e) {
226
230
  let t = [], n = (e, n) => {
227
231
  typeof e == "string" && /[./]/.test(e) && t.push({
228
232
  path: n,
@@ -240,7 +244,7 @@ function pe(e) {
240
244
  };
241
245
  return r(e.blocks, "blocks"), t;
242
246
  }
243
- function p(e) {
247
+ function h(e) {
244
248
  let t = [];
245
249
  return JSON.parse(JSON.stringify(e, function(e, n) {
246
250
  if (typeof n != "object" || !n) return n;
@@ -248,21 +252,21 @@ function p(e) {
248
252
  if (!t.includes(n)) return t.push(n), n;
249
253
  }));
250
254
  }
251
- function me(e) {
255
+ function fe(e) {
252
256
  return typeof e == "object" && !!e && !Array.isArray(e);
253
257
  }
254
- function m(e, t) {
258
+ function g(e, t) {
255
259
  if (e === t) return !0;
256
- if (Array.isArray(e)) return !Array.isArray(t) || e.length !== t.length ? !1 : e.every((e, n) => m(e, t[n]));
257
- if (me(e)) {
258
- if (!me(t)) return !1;
260
+ if (Array.isArray(e)) return !Array.isArray(t) || e.length !== t.length ? !1 : e.every((e, n) => g(e, t[n]));
261
+ if (fe(e)) {
262
+ if (!fe(t)) return !1;
259
263
  let n = /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)]);
260
- for (let r of n) if ((e[r] !== void 0 || t[r] !== void 0) && !m(e[r], t[r])) return !1;
264
+ for (let r of n) if ((e[r] !== void 0 || t[r] !== void 0) && !g(e[r], t[r])) return !1;
261
265
  return !0;
262
266
  }
263
267
  return !1;
264
268
  }
265
- var he = class extends Error {
269
+ var pe = class extends Error {
266
270
  statusCode;
267
271
  code;
268
272
  constructor(e, t, n, r) {
@@ -277,7 +281,7 @@ var he = class extends Error {
277
281
  get isServerError() {
278
282
  return this.statusCode !== void 0 && this.statusCode >= 500;
279
283
  }
280
- }, ge = {
284
+ }, me = {
281
285
  title: ["content"],
282
286
  paragraph: ["content"],
283
287
  html: ["content"],
@@ -294,58 +298,58 @@ var he = class extends Error {
294
298
  "expiredMessage"
295
299
  ],
296
300
  custom: ["fieldValues.*"]
297
- }, h = ["preheaderText"];
298
- function _e(e) {
301
+ }, _ = ["preheaderText"];
302
+ function he(e) {
299
303
  return typeof e == "string" && /^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$/.test(e);
300
304
  }
301
- function g(e) {
305
+ function v(e) {
302
306
  return typeof e == "object" && !!e && !Array.isArray(e);
303
307
  }
304
- var ve = /* @__PURE__ */ new Set([
308
+ var ge = /* @__PURE__ */ new Set([
305
309
  "__proto__",
306
310
  "constructor",
307
311
  "prototype"
308
312
  ]);
309
- function _(e) {
310
- return e.split(".").every((e) => e !== "" && !ve.has(e));
313
+ function y(e) {
314
+ return e.split(".").every((e) => e !== "" && !ge.has(e));
311
315
  }
312
- function ye(e, t) {
313
- if (!ve.has(t)) return Array.isArray(e) ? e.find((e) => g(e) && e.id === t) : g(e) && Object.hasOwn(e, t) ? e[t] : void 0;
316
+ function _e(e, t) {
317
+ if (!ge.has(t)) return Array.isArray(e) ? e.find((e) => v(e) && e.id === t) : v(e) && Object.hasOwn(e, t) ? e[t] : void 0;
314
318
  }
315
- function v(e, t) {
316
- return t.split(".").reduce(ye, e);
319
+ function b(e, t) {
320
+ return t.split(".").reduce(_e, e);
317
321
  }
318
- function be(e) {
319
- let t = p(e);
322
+ function ve(e) {
323
+ let t = h(e);
320
324
  for (let [n, r] of Object.entries(t.l10n ?? {})) {
321
325
  for (let t of ["text", "set"]) {
322
326
  for (let n of Object.keys(r[t] ?? {})) {
323
- let i = n.includes(".") ? v(e, n.slice(0, n.lastIndexOf("."))) : e;
324
- _(n) && (t !== "text" && g(i) || v(e, n) !== void 0) || delete r[t][n];
327
+ let i = n.includes(".") ? b(e, n.slice(0, n.lastIndexOf("."))) : e;
328
+ y(n) && (t !== "text" && v(i) || b(e, n) !== void 0) || delete r[t][n];
325
329
  }
326
330
  r[t] && !Object.keys(r[t]).length && delete r[t];
327
331
  }
328
332
  Object.keys(r).length || delete t.l10n[n];
329
333
  }
330
- return t.l10n && !Object.keys(t.l10n).length && delete t.l10n, m(t, e) ? e : t;
334
+ return t.l10n && !Object.keys(t.l10n).length && delete t.l10n, g(t, e) ? e : t;
331
335
  }
332
- function y(e) {
333
- let t = be(e);
336
+ function x(e) {
337
+ let t = ve(e);
334
338
  if (t.type === "wrapper") {
335
- let e = t.children.map(y);
339
+ let e = t.children.map(x);
336
340
  return e.some((e, n) => e !== t.children[n]) ? {
337
341
  ...t,
338
342
  children: e
339
343
  } : t;
340
344
  }
341
345
  if (t.type !== "section") return t;
342
- let n = t.children.map((e) => e.map(y));
346
+ let n = t.children.map((e) => e.map(x));
343
347
  return n.some((e, n) => e.some((e, r) => e !== t.children[n][r])) ? {
344
348
  ...t,
345
349
  children: n
346
350
  } : t;
347
351
  }
348
- function xe(e, t, n) {
352
+ function ye(e, t, n) {
349
353
  if (e.type === "custom") return !1;
350
354
  if (e.type === "section") return t === "columns";
351
355
  let r = e.type === "menu" ? "items" : e.type === "social" ? "icons" : e.type === "table" ? "rows" : null;
@@ -358,44 +362,44 @@ function xe(e, t, n) {
358
362
  let o = a.split(".").length;
359
363
  if (i[o] === "id") return !0;
360
364
  if (i.length !== o) return !1;
361
- let s = v(e, a);
362
- if (!g(s) || !g(n) || s.id !== n.id) return !0;
365
+ let s = b(e, a);
366
+ if (!v(s) || !v(n) || s.id !== n.id) return !0;
363
367
  if (e.type === "table" && o === 2) {
364
- let e = (e) => Array.isArray(e) ? e.map((e) => g(e) ? e.id : void 0) : null;
365
- return !m(e(s.cells), e(n.cells));
368
+ let e = (e) => Array.isArray(e) ? e.map((e) => v(e) ? e.id : void 0) : null;
369
+ return !g(e(s.cells), e(n.cells));
366
370
  }
367
371
  return !1;
368
372
  }
369
- function Se(e) {
370
- return be(e);
373
+ function be(e) {
374
+ return ve(e);
371
375
  }
372
- function b(e, t, n) {
373
- if (!_(t)) return !1;
374
- let r = t.split("."), i = r.pop(), a = r.reduce(ye, e);
376
+ function S(e, t, n) {
377
+ if (!y(t)) return !1;
378
+ let r = t.split("."), i = r.pop(), a = r.reduce(_e, e);
375
379
  if (Array.isArray(a)) {
376
- let e = a.findIndex((e) => g(e) && e.id === i);
377
- return e < 0 ? !1 : (a[e] = p(n), !0);
380
+ let e = a.findIndex((e) => v(e) && e.id === i);
381
+ return e < 0 ? !1 : (a[e] = h(n), !0);
378
382
  }
379
- return g(a) ? (n === null ? delete a[i] : a[i] = p(n), !0) : !1;
383
+ return v(a) ? (n === null ? delete a[i] : a[i] = h(n), !0) : !1;
380
384
  }
381
- function Ce(e, t) {
385
+ function xe(e, t) {
382
386
  let [n, ...r] = t.split(".");
383
387
  if (n === void 0) return [""];
384
388
  let i = [];
385
389
  if (n === "*") {
386
390
  let t = Array.isArray(e) ? e : [];
387
- for (let e of t) if (g(e) && typeof e.id == "string") for (let t of r.length ? Ce(e, r.join(".")) : [""]) i.push(t ? `${e.id}.${t}` : e.id);
391
+ for (let e of t) if (v(e) && typeof e.id == "string") for (let t of r.length ? xe(e, r.join(".")) : [""]) i.push(t ? `${e.id}.${t}` : e.id);
388
392
  return i;
389
393
  }
390
- let a = g(e) ? e[n] : void 0;
394
+ let a = v(e) ? e[n] : void 0;
391
395
  if (r.length === 0) return a === void 0 ? [] : [n];
392
- for (let e of Ce(a, r.join("."))) i.push(`${n}.${e}`);
396
+ for (let e of xe(a, r.join("."))) i.push(`${n}.${e}`);
393
397
  return i;
394
398
  }
395
- function x(e, t = []) {
399
+ function C(e, t = []) {
396
400
  if (e.type === "custom") {
397
401
  let n = t.find((t) => t.type === e.customType), r = new Set((n?.fields ?? []).filter((e) => e.type === "text" || e.type === "textarea").map((e) => e.key)), i = e.fieldValues;
398
- return g(i) ? Object.keys(i).filter((e) => r.has(e)).map((e) => `fieldValues.${e}`) : [];
402
+ return v(i) ? Object.keys(i).filter((e) => r.has(e)).map((e) => `fieldValues.${e}`) : [];
399
403
  }
400
404
  let n = (e) => !e.id.includes("."), r = e.type === "menu" ? {
401
405
  ...e,
@@ -407,118 +411,118 @@ function x(e, t = []) {
407
411
  cells: e.cells.filter(n)
408
412
  }))
409
413
  } : e;
410
- return (ge[e.type] ?? []).flatMap((e) => Ce(r, e));
414
+ return (me[e.type] ?? []).flatMap((e) => xe(r, e));
411
415
  }
412
- function S(e, t) {
413
- return (ge[e] ?? []).some((e) => {
416
+ function Se(e, t) {
417
+ return (me[e] ?? []).some((e) => {
414
418
  let n = e.split("."), r = t.split(".");
415
419
  return n.length === r.length && n.every((e, t) => e === "*" || e === r[t]);
416
420
  });
417
421
  }
418
- function C(e) {
422
+ function w(e) {
419
423
  let t = 2166136261;
420
424
  for (let n of new TextEncoder().encode(e)) t ^= n, t = Math.imul(t, 16777619) >>> 0;
421
425
  return t.toString(16).padStart(8, "0");
422
426
  }
423
- function we(e) {
427
+ function Ce(e) {
424
428
  let { l10n: t, ...n } = e;
425
429
  return n;
426
430
  }
427
- function w(e = {}) {
431
+ function T(e = {}) {
428
432
  return Object.entries(e).sort(([e], [t]) => e.split(".").length - t.split(".").length);
429
433
  }
430
- function Te(e, t, n) {
431
- let r = e, i = p(we(r));
434
+ function we(e, t, n) {
435
+ let r = e, i = h(Ce(r));
432
436
  if (t === n) return i;
433
437
  let a = r.l10n?.[t];
434
438
  if (!a) return i;
435
- for (let [e, t] of w(a.set)) b(i, e, t);
436
- for (let [t, n] of Object.entries(a.text ?? {})) v(e, t) !== void 0 && b(i, t, n.value);
439
+ for (let [e, t] of T(a.set)) S(i, e, t);
440
+ for (let [t, n] of Object.entries(a.text ?? {})) b(e, t) !== void 0 && S(i, t, n.value);
437
441
  return e.type === "custom" && (Object.keys(a.text ?? {}).length > 0 || Object.keys(a.set ?? {}).length > 0) && delete i.renderedHtml, i;
438
442
  }
439
- function Ee(e, t) {
443
+ function Te(e, t) {
440
444
  return e.l10n?.[t]?.hidden === !0;
441
445
  }
442
- function De(e) {
446
+ function Ee(e) {
443
447
  let { locales: t, l10n: n, ...r } = e;
444
448
  return r;
445
449
  }
446
- function T(e) {
450
+ function E(e) {
447
451
  return e.settings?.locale ?? "en";
448
452
  }
449
- function Oe(e, t, n) {
450
- let r = T(e), i = e.settings?.locales ?? [];
453
+ function De(e, t, n) {
454
+ let r = E(e), i = e.settings?.locales ?? [];
451
455
  if (t !== r && !i.includes(t)) {
452
456
  if (n?.missing === "default") t = r;
453
- else throw new he(`This template has no "${t}" version.`, void 0, "unknown_locale");
457
+ else throw new pe(`This template has no "${t}" version.`, void 0, "unknown_locale");
454
458
  }
455
459
  let a = (e) => e.flatMap((e) => {
456
- if (t !== r && Ee(e, t)) return [];
457
- let n = Te(e, t, r);
460
+ if (t !== r && Te(e, t)) return [];
461
+ let n = we(e, t, r);
458
462
  return n.type === "section" && Array.isArray(n.children) ? n.children = n.children.map((e) => a(e)) : n.type === "wrapper" && Array.isArray(n.children) && (n.children = a(n.children)), [n];
459
- }), o = p(De(e.settings)), s = e.settings?.l10n?.[t];
463
+ }), o = h(Ee(e.settings)), s = e.settings?.l10n?.[t];
460
464
  if (t !== r && s) {
461
- for (let [e, t] of w(s.set)) b(o, e, t);
462
- for (let [t, n] of Object.entries(s.text ?? {})) v(e.settings, t) !== void 0 && b(o, t, n.value);
465
+ for (let [e, t] of T(s.set)) S(o, e, t);
466
+ for (let [t, n] of Object.entries(s.text ?? {})) b(e.settings, t) !== void 0 && S(o, t, n.value);
463
467
  }
464
468
  return o.locale = t, {
465
469
  blocks: a(e.blocks),
466
470
  settings: o
467
471
  };
468
472
  }
469
- function ke(e, t, n = []) {
473
+ function Oe(e, t, n = []) {
470
474
  let r = {
471
475
  translated: [],
472
476
  missing: [],
473
477
  stale: []
474
478
  }, i = (e, t, n, i) => {
475
479
  for (let a of n) {
476
- let n = v(t, a);
480
+ let n = b(t, a);
477
481
  if (typeof n != "string") continue;
478
482
  let o = i?.[a];
479
- (o || n !== "") && (o ? o.sourceHash === C(n) ? r.translated.push(`${e}/${a}`) : r.stale.push(`${e}/${a}`) : r.missing.push(`${e}/${a}`));
483
+ (o || n !== "") && (o ? o.sourceHash === w(n) ? r.translated.push(`${e}/${a}`) : r.stale.push(`${e}/${a}`) : r.missing.push(`${e}/${a}`));
480
484
  }
481
485
  }, a = (e) => {
482
486
  for (let r of e) {
483
- if (Ee(r, t)) continue;
487
+ if (Te(r, t)) continue;
484
488
  let e = r.l10n?.[t];
485
- i(r.id, r, x(r, n), e?.text);
489
+ i(r.id, r, C(r, n), e?.text);
486
490
  let o = r.children;
487
491
  if (r.type === "section" && Array.isArray(o)) for (let e of o) a(e);
488
492
  else r.type === "wrapper" && Array.isArray(o) && a(o);
489
493
  }
490
494
  };
491
- return a(e.blocks), i("settings", e.settings, [...h], e.settings?.l10n?.[t]?.text), r;
495
+ return a(e.blocks), i("settings", e.settings, [..._], e.settings?.l10n?.[t]?.text), r;
492
496
  }
493
- function Ae(e, t) {
494
- if (t === T(e) || !e.settings.locales?.includes(t)) return [];
497
+ function ke(e, t) {
498
+ if (t === E(e) || !e.settings.locales?.includes(t)) return [];
495
499
  let n = [], r = (e) => {
496
- for (let i of e) Ee(i, t) && n.push(i.id), i.type === "section" ? i.children.forEach(r) : i.type === "wrapper" && r(i.children);
500
+ for (let i of e) Te(i, t) && n.push(i.id), i.type === "section" ? i.children.forEach(r) : i.type === "wrapper" && r(i.children);
497
501
  };
498
502
  return r(e.blocks), n;
499
503
  }
500
- function je(e, t, n = []) {
501
- if (t === T(e) || !e.settings.locales?.includes(t)) return [];
504
+ function Ae(e, t, n = []) {
505
+ if (t === E(e) || !e.settings.locales?.includes(t)) return [];
502
506
  let r = [], i = (e, n, i) => {
503
- r.push(...Me(n, t, i).map((t) => `${e}/${t}`));
507
+ r.push(...je(n, t, i).map((t) => `${e}/${t}`));
504
508
  }, a = (e) => {
505
- for (let t of e) i(t.id, t, x(t, n)), t.type === "section" ? t.children.forEach(a) : t.type === "wrapper" && a(t.children);
509
+ for (let t of e) i(t.id, t, C(t, n)), t.type === "section" ? t.children.forEach(a) : t.type === "wrapper" && a(t.children);
506
510
  };
507
- return a(e.blocks), i("settings", e.settings, h), r;
511
+ return a(e.blocks), i("settings", e.settings, _), r;
508
512
  }
509
- function Me(e, t, n) {
513
+ function je(e, t, n) {
510
514
  let r = e.l10n?.[t];
511
515
  return n.filter((t) => {
512
- let n = v(e, t);
513
- return typeof n != "string" || n === "" || r?.text?.[t] ? !1 : !Object.keys(r?.set ?? {}).some((n) => (t === n || t.startsWith(`${n}.`)) && (!n.includes(".") || v(e, n.slice(0, n.lastIndexOf("."))) !== void 0));
516
+ let n = b(e, t);
517
+ return typeof n != "string" || n === "" || r?.text?.[t] ? !1 : !Object.keys(r?.set ?? {}).some((n) => (t === n || t.startsWith(`${n}.`)) && (!n.includes(".") || b(e, n.slice(0, n.lastIndexOf("."))) !== void 0));
514
518
  });
515
519
  }
516
- function Ne(e, t, n = {}) {
517
- let r = T(e), i = (e, n, i) => {
518
- let a = Me(e, t, i), o = p(e.l10n ?? {}), s = o[t] ?? {}, c = p(e);
520
+ function Me(e, t, n = {}) {
521
+ let r = E(e), i = (e, n, i) => {
522
+ let a = je(e, t, i), o = h(e.l10n ?? {}), s = o[t] ?? {}, c = h(e);
519
523
  delete c.l10n;
520
- for (let [e, t] of w(s.set)) b(c, e, t);
521
- for (let [t, n] of Object.entries(s.text ?? {})) v(e, t) !== void 0 && b(c, t, n.value);
524
+ for (let [e, t] of T(s.set)) S(c, e, t);
525
+ for (let [t, n] of Object.entries(s.text ?? {})) b(e, t) !== void 0 && S(c, t, n.value);
522
526
  delete o[t];
523
527
  let l = {}, u = /* @__PURE__ */ new Set([
524
528
  ...Object.keys(s.set ?? {}),
@@ -526,22 +530,22 @@ function Ne(e, t, n = {}) {
526
530
  ...a
527
531
  ]);
528
532
  for (let t of u) {
529
- let r = v(e, t), i = v(c, t);
530
- m(r, i) ? (s.text?.[t] || a.includes(t)) && n(t) && typeof r == "string" && r !== "" && ((l.text ??= {})[t] = {
533
+ let r = b(e, t), i = b(c, t);
534
+ g(r, i) ? (s.text?.[t] || a.includes(t)) && n(t) && typeof r == "string" && r !== "" && ((l.text ??= {})[t] = {
531
535
  value: r,
532
- sourceHash: C(r)
536
+ sourceHash: w(r)
533
537
  }) : n(t) && typeof r == "string" && typeof i == "string" ? (l.text ??= {})[t] = {
534
538
  value: r,
535
- sourceHash: C(i)
536
- } : (l.set ??= {})[t] = r === void 0 ? null : p(r);
539
+ sourceHash: w(i)
540
+ } : (l.set ??= {})[t] = r === void 0 ? null : h(r);
537
541
  }
538
542
  let d = (e, t) => {
539
543
  let n = /* @__PURE__ */ new Set();
540
544
  for (let t of Object.keys(e.set ?? {})) {
541
545
  let e = t.split(".");
542
546
  for (; e.length > 1;) {
543
- let t = v(c, e.slice(0, -1).join("."));
544
- if (g(t) || Array.isArray(t) && v(c, e.join(".")) !== void 0) break;
547
+ let t = b(c, e.slice(0, -1).join("."));
548
+ if (v(t) || Array.isArray(t) && b(c, e.join(".")) !== void 0) break;
545
549
  e.pop();
546
550
  }
547
551
  let r = e.join(".");
@@ -549,40 +553,40 @@ function Ne(e, t, n = {}) {
549
553
  }
550
554
  for (let r of n) {
551
555
  for (let t of ["text", "set"]) for (let n of Object.keys(e[t] ?? {})) (n === r || n.startsWith(`${r}.`)) && delete e[t][n];
552
- let n = v(t, r);
553
- (e.set ??= {})[r] = n === void 0 ? null : p(n);
556
+ let n = b(t, r);
557
+ (e.set ??= {})[r] = n === void 0 ? null : h(n);
554
558
  }
555
559
  e.text && !Object.keys(e.text).length && delete e.text;
556
560
  };
557
561
  for (let t of Object.values(o)) {
558
- let n = p(e);
559
- for (let [e, r] of w(t.set)) b(n, e, r);
560
- for (let [r, i] of Object.entries(t.text ?? {})) v(e, r) !== void 0 && b(n, r, i.value);
562
+ let n = h(e);
563
+ for (let [e, r] of T(t.set)) S(n, e, r);
564
+ for (let [r, i] of Object.entries(t.text ?? {})) b(e, r) !== void 0 && S(n, r, i.value);
561
565
  for (let [n, r] of Object.entries(t.text ?? {})) {
562
- let i = v(c, n);
566
+ let i = b(c, n);
563
567
  if (typeof i != "string") (t.set ??= {})[n] = r.value, delete t.text[n];
564
568
  else {
565
- let t = v(e, n);
566
- typeof t == "string" && r.sourceHash === C(t) && (r.sourceHash = C(i));
569
+ let t = b(e, n);
570
+ typeof t == "string" && r.sourceHash === w(t) && (r.sourceHash = w(i));
567
571
  }
568
572
  }
569
573
  d(t, n);
570
574
  }
571
575
  return Object.keys(l).length && (d(l, e), o[r] = l), Object.keys(o).length && (c.l10n = o), c;
572
576
  }, a = (e) => e.map((e) => {
573
- let t = e.type === "custom" ? [.../* @__PURE__ */ new Set([...Object.hasOwn(n, e.id) ? n[e.id] : [], ...Object.values(e.l10n ?? {}).flatMap((e) => Object.keys(e.text ?? {}))])] : x(e), r = i(e, (n) => e.type === "custom" ? t.includes(n) : S(e.type, n), t);
574
- return e.type === "custom" && r.type === "custom" && !m(e.fieldValues, r.fieldValues) && delete r.renderedHtml, r.type === "section" ? r.children = r.children.map(a) : r.type === "wrapper" && (r.children = a(r.children)), r;
575
- }), o = i(e.settings, (e) => h.includes(e), h);
577
+ let t = e.type === "custom" ? [.../* @__PURE__ */ new Set([...Object.hasOwn(n, e.id) ? n[e.id] : [], ...Object.values(e.l10n ?? {}).flatMap((e) => Object.keys(e.text ?? {}))])] : C(e), r = i(e, (n) => e.type === "custom" ? t.includes(n) : Se(e.type, n), t);
578
+ return e.type === "custom" && r.type === "custom" && !g(e.fieldValues, r.fieldValues) && delete r.renderedHtml, r.type === "section" ? r.children = r.children.map(a) : r.type === "wrapper" && (r.children = a(r.children)), r;
579
+ }), o = i(e.settings, (e) => _.includes(e), _);
576
580
  return o.locale = t, o.locales = e.settings.locales.map((e) => e === t ? r : e), {
577
581
  blocks: a(e.blocks),
578
582
  settings: o
579
583
  };
580
584
  }
581
- function Pe(e, t, n = []) {
582
- let r = Object.fromEntries(L(e.blocks).flatMap((e) => {
585
+ function Ne(e, t, n = []) {
586
+ let r = Object.fromEntries(F(e.blocks).flatMap((e) => {
583
587
  if (e.type !== "custom") return [];
584
- let t = x(e, n).filter((t) => typeof v(e, t) == "string");
585
- return t.length && Be.has(e.id) && O("invalid_operation", 0, Ve), t.length ? [[e.id, t]] : [];
588
+ let t = C(e, n).filter((t) => typeof b(e, t) == "string");
589
+ return t.length && ze.has(e.id) && k("invalid_operation", 0, Be), t.length ? [[e.id, t]] : [];
586
590
  }));
587
591
  return {
588
592
  op: "setDefaultLocale",
@@ -590,7 +594,7 @@ function Pe(e, t, n = []) {
590
594
  ...Object.keys(r).length ? { customTextFields: r } : {}
591
595
  };
592
596
  }
593
- var E = class extends Error {
597
+ var D = class extends Error {
594
598
  code;
595
599
  opIndex;
596
600
  blockId;
@@ -598,44 +602,44 @@ var E = class extends Error {
598
602
  super(n), this.name = "OperationError", this.code = e, this.opIndex = t, r !== void 0 && (this.blockId = r);
599
603
  }
600
604
  };
601
- function Fe(e) {
605
+ function Pe(e) {
602
606
  return e === "1" ? 1 : e === "3" ? 3 : 2;
603
607
  }
604
- function Ie(e, t, n = {}) {
605
- let r = p(e);
606
- return D(r, t, n), r;
608
+ function Fe(e, t, n = {}) {
609
+ let r = h(e);
610
+ return O(r, t, n), r;
607
611
  }
608
- function D(e, t, n = {}) {
612
+ function O(e, t, n = {}) {
609
613
  let r = {
610
614
  locks: n.locks ?? [],
611
615
  session: n.session ?? null
612
616
  };
613
- t.forEach((t, n) => rt(e, t, n, r));
617
+ t.forEach((t, n) => at(e, t, n, r));
614
618
  }
615
- var Le = /* @__PURE__ */ new Set([
619
+ var Ie = /* @__PURE__ */ new Set([
616
620
  "id",
617
621
  "type",
618
622
  "children",
619
623
  "l10n"
620
- ]), Re = /* @__PURE__ */ new Set(["locales", "l10n"]), ze = /* @__PURE__ */ new Set([
624
+ ]), Le = /* @__PURE__ */ new Set(["locales", "l10n"]), Re = /* @__PURE__ */ new Set([
621
625
  "locale",
622
626
  "locales",
623
627
  "l10n"
624
- ]), Be = /* @__PURE__ */ new Set([
628
+ ]), ze = /* @__PURE__ */ new Set([
625
629
  "__proto__",
626
630
  "constructor",
627
631
  "prototype"
628
- ]), Ve = "customTextFields must map existing custom block ids to lists of string fieldValues paths.";
629
- function O(e, t, n, r) {
630
- throw new E(e, t, n, r);
632
+ ]), Be = "customTextFields must map existing custom block ids to lists of string fieldValues paths.";
633
+ function k(e, t, n, r) {
634
+ throw new D(e, t, n, r);
631
635
  }
632
- function k(e) {
636
+ function A(e) {
633
637
  return typeof e == "object" && !!e && !Array.isArray(e);
634
638
  }
635
- function A(e) {
639
+ function j(e) {
636
640
  return e.type === "section";
637
641
  }
638
- function j(e) {
642
+ function Ve(e) {
639
643
  return Array.isArray(e.blocks) ? e.blocks : [];
640
644
  }
641
645
  function He(e) {
@@ -643,23 +647,23 @@ function He(e) {
643
647
  return Array.isArray(t) ? t.map((e) => Array.isArray(e) ? e : []) : [];
644
648
  }
645
649
  function M(e, t) {
646
- let n = j(e);
650
+ let n = Ve(e);
647
651
  for (let e = 0; e < n.length; e++) {
648
652
  let r = n[e];
649
- if (!k(r)) continue;
653
+ if (!A(r)) continue;
650
654
  if (r.id === t) return {
651
655
  block: r,
652
656
  list: n,
653
657
  index: e,
654
658
  parent: null
655
659
  };
656
- if (!A(r) || typeof r.id != "string") continue;
660
+ if (!j(r) || typeof r.id != "string") continue;
657
661
  let i = r.children;
658
662
  if (Array.isArray(i)) for (let e = 0; e < i.length; e++) {
659
663
  let n = i[e];
660
664
  if (Array.isArray(n)) for (let i = 0; i < n.length; i++) {
661
665
  let a = n[i];
662
- if (k(a) && a.id === t) return {
666
+ if (A(a) && a.id === t) return {
663
667
  block: a,
664
668
  list: n,
665
669
  index: i,
@@ -673,98 +677,98 @@ function M(e, t) {
673
677
  }
674
678
  return null;
675
679
  }
676
- function N(e) {
680
+ function Ue(e) {
677
681
  let t = typeof e.id == "string" ? [e.id] : [];
678
- if (A(e)) for (let n of He(e)) t.push(...Ue(n));
682
+ if (j(e)) for (let n of He(e)) t.push(...We(n));
679
683
  return t;
680
684
  }
681
- function Ue(e) {
682
- return e.flatMap((e) => k(e) ? N(e) : []);
685
+ function We(e) {
686
+ return e.flatMap((e) => A(e) ? Ue(e) : []);
683
687
  }
684
- function P(e, t) {
685
- return typeof e.blockId != "string" || e.blockId === "" ? O("invalid_operation", t, "blockId must be a block id.") : e.blockId;
688
+ function Ge(e, t) {
689
+ return typeof e.blockId != "string" || e.blockId === "" ? k("invalid_operation", t, "blockId must be a block id.") : e.blockId;
686
690
  }
687
- function We(e, t) {
691
+ function Ke(e, t) {
688
692
  let n = e.parent;
689
- return n === null ? null : k(n) && typeof n.sectionId == "string" && typeof n.column == "number" && Number.isInteger(n.column) ? {
693
+ return n === null ? null : A(n) && typeof n.sectionId == "string" && typeof n.column == "number" && Number.isInteger(n.column) ? {
690
694
  sectionId: n.sectionId,
691
695
  column: n.column
692
- } : O("invalid_operation", t, "parent must be null or { \"sectionId\", \"column\" }.");
696
+ } : k("invalid_operation", t, "parent must be null or { \"sectionId\", \"column\" }.");
693
697
  }
694
- function Ge(e, t) {
698
+ function qe(e, t) {
695
699
  let n = e.after;
696
- return n === null ? null : typeof n == "string" && n !== "" ? n : O("invalid_operation", t, "after must be null or a block id.");
700
+ return n === null ? null : typeof n == "string" && n !== "" ? n : k("invalid_operation", t, "after must be null or a block id.");
697
701
  }
698
- function F(e, t) {
702
+ function N(e, t) {
699
703
  let n = e.expect;
700
- return n == null ? null : k(n) ? n : O("invalid_operation", t, "expect must be an object.");
704
+ return n == null ? null : A(n) ? n : k("invalid_operation", t, "expect must be an object.");
701
705
  }
702
- function Ke(e, t, n) {
706
+ function Je(e, t, n) {
703
707
  let r = e.set ?? null, i = e.unset ?? [];
704
- (r === null || k(r)) && Array.isArray(i) && i.every((e) => typeof e == "string") || O("invalid_operation", t, "set must be an object and unset a list of keys.");
708
+ (r === null || A(r)) && Array.isArray(i) && i.every((e) => typeof e == "string") || k("invalid_operation", t, "set must be an object and unset a list of keys.");
705
709
  let a = r === null ? {} : r, o = Object.keys(a).filter((e) => a[e] !== void 0);
706
- o.length === 0 && i.length === 0 && O("invalid_operation", t, "Set or unset at least one key.");
707
- for (let e of [...o, ...i]) n.has(e) && O("invalid_operation", t, `"${e}" can't be set or unset.`);
710
+ o.length === 0 && i.length === 0 && k("invalid_operation", t, "Set or unset at least one key.");
711
+ for (let e of [...o, ...i]) n.has(e) && k("invalid_operation", t, `"${e}" can't be set or unset.`);
708
712
  let s = i.find((e) => o.includes(e));
709
- return s !== void 0 && O("invalid_operation", t, `"${s}" is both set and unset.`), {
713
+ return s !== void 0 && k("invalid_operation", t, `"${s}" is both set and unset.`), {
710
714
  set: Object.fromEntries(o.map((e) => [e, a[e]])),
711
715
  unset: i
712
716
  };
713
717
  }
714
- function qe(e, t, n) {
715
- if (k(e) && typeof e.id == "string" && e.id !== "" && typeof e.type == "string" || O("invalid_operation", t, "A block needs a non-empty string id and a string type."), !A(e)) return;
716
- n && O("invalid_operation", t, "Sections can only be placed at the top level.");
718
+ function Ye(e, t, n) {
719
+ if (A(e) && typeof e.id == "string" && e.id !== "" && typeof e.type == "string" || k("invalid_operation", t, "A block needs a non-empty string id and a string type."), !j(e)) return;
720
+ n && k("invalid_operation", t, "Sections can only be placed at the top level.");
717
721
  let r = e.children;
718
- Array.isArray(r) && r.every((e) => Array.isArray(e)) || O("invalid_operation", t, "A section needs children: a list of columns, each a list of blocks.");
719
- for (let e of r) for (let n of e) qe(n, t, !0);
722
+ Array.isArray(r) && r.every((e) => Array.isArray(e)) || k("invalid_operation", t, "A section needs children: a list of columns, each a list of blocks.");
723
+ for (let e of r) for (let n of e) Ye(n, t, !0);
720
724
  }
721
- function I(e, t) {
725
+ function P(e, t) {
722
726
  return e.session === null || t.sessionId !== e.session;
723
727
  }
724
- function Je(e, t, n) {
725
- let r = e.locks.find((n) => t.includes(n.blockId) && I(e, n));
726
- r && O("lock_held", n, `Block "${r.blockId}" is being edited in another session.`, r.blockId);
728
+ function Xe(e, t, n) {
729
+ let r = e.locks.find((n) => t.includes(n.blockId) && P(e, n));
730
+ r && k("lock_held", n, `Block "${r.blockId}" is being edited in another session.`, r.blockId);
727
731
  }
728
- function Ye(e, t, n, r) {
729
- e.locks.find((r) => I(e, r) && r.blockId === t && ((r.locale ?? null) === null || r.locale === n)) && O("lock_held", r, `Block "${t}" is being edited in another session.`, t);
732
+ function Ze(e, t, n, r) {
733
+ e.locks.find((r) => P(e, r) && r.blockId === t && ((r.locale ?? null) === null || r.locale === n)) && k("lock_held", r, `Block "${t}" is being edited in another session.`, t);
730
734
  }
731
- function Xe(e, t, n, r) {
732
- for (let [i, a] of Object.entries(t)) a !== void 0 && (m(Object.hasOwn(e, i) && e[i] !== void 0 ? e[i] : null, a) || O("precondition_failed", n, r === void 0 ? `Setting "${i}" has changed since.` : `"${i}" of block "${r}" has changed since.`, r));
735
+ function Qe(e, t, n, r) {
736
+ for (let [i, a] of Object.entries(t)) a !== void 0 && (g(Object.hasOwn(e, i) && e[i] !== void 0 ? e[i] : null, a) || k("precondition_failed", n, r === void 0 ? `Setting "${i}" has changed since.` : `"${i}" of block "${r}" has changed since.`, r));
733
737
  }
734
- function Ze(e, t, n) {
738
+ function $e(e, t, n) {
735
739
  if (t === null) return Array.isArray(e.blocks) || (e.blocks = []), e.blocks;
736
740
  let r = M(e, t.sectionId);
737
- if (!r) return O("block_missing", n, `No section with id "${t.sectionId}".`, t.sectionId);
738
- if (!A(r.block)) return O("invalid_operation", n, `Block "${t.sectionId}" isn't a section.`);
741
+ if (!r) return k("block_missing", n, `No section with id "${t.sectionId}".`, t.sectionId);
742
+ if (!j(r.block)) return k("invalid_operation", n, `Block "${t.sectionId}" isn't a section.`);
739
743
  let i = r.block.children;
740
- return !Array.isArray(i) || t.column < 0 || t.column >= i.length ? O("invalid_operation", n, `Section "${t.sectionId}" has no column ${t.column}.`) : (Array.isArray(i[t.column]) || (i[t.column] = []), i[t.column]);
744
+ return !Array.isArray(i) || t.column < 0 || t.column >= i.length ? k("invalid_operation", n, `Section "${t.sectionId}" has no column ${t.column}.`) : (Array.isArray(i[t.column]) || (i[t.column] = []), i[t.column]);
741
745
  }
742
- function Qe(e, t, n) {
746
+ function et(e, t, n) {
743
747
  if (t === null) return 0;
744
- let r = e.findIndex((e) => k(e) && e.id === t);
745
- return r === -1 ? O("anchor_missing", n, `No block "${t}" in the target container.`, t) : r + 1;
748
+ let r = e.findIndex((e) => A(e) && e.id === t);
749
+ return r === -1 ? k("anchor_missing", n, `No block "${t}" in the target container.`, t) : r + 1;
746
750
  }
747
- function $e(e, t, n, r) {
748
- let i = Fe(t), a = Array.isArray(e.children) ? e.children : [];
751
+ function tt(e, t, n, r) {
752
+ let i = Pe(t), a = Array.isArray(e.children) ? e.children : [];
749
753
  for (let e = i; e < a.length; e++) {
750
754
  let t = a[e];
751
- Array.isArray(t) && t.length > 0 && O("invalid_operation", n, `Column ${e} of section "${r}" still holds blocks, so the layout can't drop it.`);
755
+ Array.isArray(t) && t.length > 0 && k("invalid_operation", n, `Column ${e} of section "${r}" still holds blocks, so the layout can't drop it.`);
752
756
  }
753
757
  let o = a.slice(0, i);
754
758
  for (; o.length < i;) o.push([]);
755
759
  e.children = o;
756
760
  }
757
- function et(e, t, n) {
761
+ function nt(e, t, n) {
758
762
  for (let [n, r] of Object.entries(t)) n === "__proto__" ? Object.defineProperty(e, n, {
759
- value: p(r),
763
+ value: h(r),
760
764
  writable: !0,
761
765
  enumerable: !0,
762
766
  configurable: !0
763
- }) : e[n] = p(r);
767
+ }) : e[n] = h(r);
764
768
  for (let t of n) delete e[t];
765
769
  }
766
- function tt(e) {
767
- return pe(e).map((t) => {
770
+ function rt(e) {
771
+ return de(e).map((t) => {
768
772
  let n = t.path.replace(/\.(items|icons|rows)\[.*$/, "").replace(/\[(\d+)\]/g, ".$1").split(".").reduce((e, t) => e[t], e);
769
773
  return {
770
774
  id: t.id,
@@ -772,114 +776,114 @@ function tt(e) {
772
776
  };
773
777
  });
774
778
  }
775
- function nt(e, t, n) {
776
- let r = ({ id: e, blockId: t }) => JSON.stringify([t ?? null, e]), i = new Set(n ? tt(n).map(r) : []), a = tt(e).find((e) => !i.has(r(e)));
777
- a && O("invalid_operation", t, `Element id "${a.id}" must not contain "." or "/".`, a.blockId);
779
+ function it(e, t, n) {
780
+ let r = ({ id: e, blockId: t }) => JSON.stringify([t ?? null, e]), i = new Set(n ? rt(n).map(r) : []), a = rt(e).find((e) => !i.has(r(e)));
781
+ a && k("invalid_operation", t, `Element id "${a.id}" must not contain "." or "/".`, a.blockId);
778
782
  }
779
- function rt(e, t, n, r) {
783
+ function at(e, t, n, r) {
780
784
  let i = t;
781
- switch (k(i) && typeof i.op == "string" || O("invalid_operation", n, "Each operation must be an object with an \"op\"."), i.op) {
782
- case "addBlock": return it(e, i, n);
783
- case "moveBlock": return at(e, i, n, r);
784
- case "deleteBlock": return ot(e, i, n, r);
785
- case "updateBlock": return st(e, i, n, r);
786
- case "updateSettings": return ct(e, i, n);
787
- case "setContent": return Ct(e, i, n, r);
788
- case "setDefaultLocale": return wt(e, i, n, r);
789
- case "addLocale": return dt(e, i, n);
790
- case "removeLocale": return pt(e, i, n);
791
- case "updateBlockLocale": return xt(e, i, n, r);
792
- case "updateSettingsLocale": return St(e, i, n);
793
- default: O("invalid_operation", n, `Unknown operation "${i.op}".`);
785
+ switch (A(i) && typeof i.op == "string" || k("invalid_operation", n, "Each operation must be an object with an \"op\"."), i.op) {
786
+ case "addBlock": return ot(e, i, n);
787
+ case "moveBlock": return st(e, i, n, r);
788
+ case "deleteBlock": return ct(e, i, n, r);
789
+ case "updateBlock": return lt(e, i, n, r);
790
+ case "updateSettings": return ut(e, i, n);
791
+ case "setContent": return Tt(e, i, n, r);
792
+ case "setDefaultLocale": return Et(e, i, n, r);
793
+ case "addLocale": return pt(e, i, n);
794
+ case "removeLocale": return ht(e, i, n);
795
+ case "updateBlockLocale": return Ct(e, i, n, r);
796
+ case "updateSettingsLocale": return wt(e, i, n);
797
+ default: k("invalid_operation", n, `Unknown operation "${i.op}".`);
794
798
  }
795
799
  }
796
- function it(e, t, n) {
797
- let r = We(t, n), i = Ge(t, n), a = t.block;
798
- qe(a, n, r !== null), nt({
800
+ function ot(e, t, n) {
801
+ let r = Ke(t, n), i = qe(t, n), a = t.block;
802
+ Ye(a, n, r !== null), it({
799
803
  blocks: [a],
800
804
  settings: e.settings
801
805
  }, n);
802
- let o = new Set(Ue(j(e))), s = /* @__PURE__ */ new Set();
803
- for (let e of N(a)) (o.has(e) || s.has(e)) && O("block_exists", n, `A block with id "${e}" already exists.`, e), s.add(e);
804
- let c = Ze(e, r, n), l = Qe(c, i, n);
805
- bt(e, a, r, n, !0), c.splice(l, 0, p(a));
806
- }
807
- function at(e, t, n, r) {
808
- let i = P(t, n), a = We(t, n), o = Ge(t, n), s = F(t, n), c = M(e, i);
809
- if (!c) return O("block_missing", n, `No block with id "${i}".`, i);
810
- if (Je(r, N(c.block), n), s) {
811
- let e = c.index > 0 ? c.list[c.index - 1] : null, t = k(e) ? e.id ?? null : null;
812
- m(c.parent, s.parent ?? null) && m(t, s.after ?? null) || O("precondition_failed", n, `Block "${i}" has moved since.`, i);
813
- }
814
- A(c.block) && a !== null && O("invalid_operation", n, "Sections can only be placed at the top level."), o === i && O("invalid_operation", n, "A block can't be placed after itself.");
815
- let l = Ze(e, a, n);
816
- Qe(l.filter((e) => e !== c.block), o, n), bt(e, c.block, a, n, !1), c.list.splice(c.index, 1), l.splice(Qe(l, o, n), 0, c.block);
817
- }
818
- function ot(e, t, n, r) {
819
- let i = P(t, n), a = F(t, n), o = M(e, i);
820
- if (!o) return O("block_missing", n, `No block with id "${i}".`, i);
821
- Je(r, N(o.block), n), a && !m(o.block, a.block ?? null) && O("precondition_failed", n, `Block "${i}" has changed since.`, i), o.list.splice(o.index, 1);
806
+ let o = new Set(We(Ve(e))), s = /* @__PURE__ */ new Set();
807
+ for (let e of Ue(a)) (o.has(e) || s.has(e)) && k("block_exists", n, `A block with id "${e}" already exists.`, e), s.add(e);
808
+ let c = $e(e, r, n), l = et(c, i, n);
809
+ St(e, a, r, n, !0), c.splice(l, 0, h(a));
822
810
  }
823
811
  function st(e, t, n, r) {
824
- let i = P(t, n), { set: a, unset: o } = Ke(t, n, Le), s = F(t, n), c = M(e, i);
825
- if (!c) return O("block_missing", n, `No block with id "${i}".`, i);
826
- let l = c.block, u = A(l);
827
- u && o.includes("columns") && O("invalid_operation", n, "A section's columns can't be unset; set another layout instead."), Je(r, [i], n), s && Xe(l, s, n, i);
812
+ let i = Ge(t, n), a = Ke(t, n), o = qe(t, n), s = N(t, n), c = M(e, i);
813
+ if (!c) return k("block_missing", n, `No block with id "${i}".`, i);
814
+ if (Xe(r, Ue(c.block), n), s) {
815
+ let e = c.index > 0 ? c.list[c.index - 1] : null, t = A(e) ? e.id ?? null : null;
816
+ g(c.parent, s.parent ?? null) && g(t, s.after ?? null) || k("precondition_failed", n, `Block "${i}" has moved since.`, i);
817
+ }
818
+ j(c.block) && a !== null && k("invalid_operation", n, "Sections can only be placed at the top level."), o === i && k("invalid_operation", n, "A block can't be placed after itself.");
819
+ let l = $e(e, a, n);
820
+ et(l.filter((e) => e !== c.block), o, n), St(e, c.block, a, n, !1), c.list.splice(c.index, 1), l.splice(et(l, o, n), 0, c.block);
821
+ }
822
+ function ct(e, t, n, r) {
823
+ let i = Ge(t, n), a = N(t, n), o = M(e, i);
824
+ if (!o) return k("block_missing", n, `No block with id "${i}".`, i);
825
+ Xe(r, Ue(o.block), n), a && !g(o.block, a.block ?? null) && k("precondition_failed", n, `Block "${i}" has changed since.`, i), o.list.splice(o.index, 1);
826
+ }
827
+ function lt(e, t, n, r) {
828
+ let i = Ge(t, n), { set: a, unset: o } = Je(t, n, Ie), s = N(t, n), c = M(e, i);
829
+ if (!c) return k("block_missing", n, `No block with id "${i}".`, i);
830
+ let l = c.block, u = j(l);
831
+ u && o.includes("columns") && k("invalid_operation", n, "A section's columns can't be unset; set another layout instead."), Xe(r, [i], n), s && Qe(l, s, n, i);
828
832
  let d = { ...l };
829
- et(d, a, o), nt({
833
+ nt(d, a, o), it({
830
834
  blocks: [d],
831
835
  settings: e.settings
832
836
  }, n, {
833
837
  blocks: [l],
834
838
  settings: e.settings
835
- }), u && Object.hasOwn(a, "columns") && $e(l, a.columns, n, i), et(l, a, o);
836
- let f = y(l);
837
- m(l.l10n, f.l10n) || (f.l10n ? l.l10n = f.l10n : delete l.l10n), u && f.type === "section" && !m(l.children, f.children) && (l.children = f.children);
839
+ }), u && Object.hasOwn(a, "columns") && tt(l, a.columns, n, i), nt(l, a, o);
840
+ let f = x(l);
841
+ g(l.l10n, f.l10n) || (f.l10n ? l.l10n = f.l10n : delete l.l10n), u && f.type === "section" && !g(l.children, f.children) && (l.children = f.children);
838
842
  }
839
- function ct(e, t, n) {
840
- let { set: r, unset: i } = Ke(t, n, Re), a = F(t, n);
841
- e.settings?.locales?.length && (Object.hasOwn(r, "locale") || i.includes("locale")) && O("invalid_operation", n, "The default locale can't change while language versions exist."), k(e.settings) || (e.settings = {});
843
+ function ut(e, t, n) {
844
+ let { set: r, unset: i } = Je(t, n, Le), a = N(t, n);
845
+ e.settings?.locales?.length && (Object.hasOwn(r, "locale") || i.includes("locale")) && k("invalid_operation", n, "The default locale can't change while language versions exist."), A(e.settings) || (e.settings = {});
842
846
  let o = e.settings;
843
- a && Xe(o, a, n), et(o, r, i);
844
- let s = Se(e.settings);
845
- m(o.l10n, s.l10n) || (s.l10n ? o.l10n = s.l10n : delete o.l10n);
847
+ a && Qe(o, a, n), nt(o, r, i);
848
+ let s = be(e.settings);
849
+ g(o.l10n, s.l10n) || (s.l10n ? o.l10n = s.l10n : delete o.l10n);
846
850
  }
847
- function lt(e, t) {
851
+ function dt(e, t) {
848
852
  let n = e.locale;
849
- return _e(n) && n !== "__proto__" && n !== "constructor" && n !== "prototype" || O("invalid_operation", t, "locale must be a language tag."), n;
853
+ return he(n) && n !== "__proto__" && n !== "constructor" && n !== "prototype" || k("invalid_operation", t, "locale must be a language tag."), n;
850
854
  }
851
- function ut(e, t, n) {
852
- let r = lt(t, n);
853
- return e.settings.locales?.includes(r) || O("invalid_operation", n, `Locale "${r}" isn't in settings.locales.`), r;
855
+ function ft(e, t, n) {
856
+ let r = dt(t, n);
857
+ return e.settings.locales?.includes(r) || k("invalid_operation", n, `Locale "${r}" isn't in settings.locales.`), r;
854
858
  }
855
- function dt(e, t, n) {
856
- let r = lt(t, n), i = e.settings.locales ?? [], a = r.toLowerCase(), o = t.position === void 0 ? i.length : t.position;
857
- (T(e).toLowerCase() === a || i.some((e) => e.toLowerCase() === a) || typeof o != "number" || !Number.isInteger(o) || o < 0 || o > i.length) && O("invalid_operation", n, "The locale already exists or its insertion position is invalid."), e.settings.locales || (e.settings.locales = []), e.settings.locales.splice(o, 0, r);
859
+ function pt(e, t, n) {
860
+ let r = dt(t, n), i = e.settings.locales ?? [], a = r.toLowerCase(), o = t.position === void 0 ? i.length : t.position;
861
+ (E(e).toLowerCase() === a || i.some((e) => e.toLowerCase() === a) || typeof o != "number" || !Number.isInteger(o) || o < 0 || o > i.length) && k("invalid_operation", n, "The locale already exists or its insertion position is invalid."), e.settings.locales || (e.settings.locales = []), e.settings.locales.splice(o, 0, r);
858
862
  }
859
- function L(e) {
860
- return e.flatMap((e) => k(e) ? [e, ...A(e) ? He(e).flatMap(L) : e.type === "wrapper" && Array.isArray(e.children) ? L(e.children) : []] : []);
863
+ function F(e) {
864
+ return e.flatMap((e) => A(e) ? [e, ...j(e) ? He(e).flatMap(F) : e.type === "wrapper" && Array.isArray(e.children) ? F(e.children) : []] : []);
861
865
  }
862
- function ft(e, t) {
866
+ function mt(e, t) {
863
867
  let n = e.l10n;
864
- return k(n) && k(n[t]) ? n[t] : {};
865
- }
866
- function pt(e, t, n) {
867
- let r = ut(e, t, n), i = F(t, n);
868
- i && (!k(i.blocks) || i.settings !== void 0 && !k(i.settings)) && O("invalid_operation", n, "expect needs a blocks object and an optional settings layer.");
869
- let a = e.settings, o = L(j(e)), s = Object.fromEntries(o.flatMap((e) => k(e.l10n) && Object.hasOwn(e.l10n, r) ? [[String(e.id), e.l10n[r]]] : []));
870
- !i || m(s, i.blocks) && m(k(a.l10n) ? a.l10n[r] : void 0, i.settings) || O("precondition_failed", n, `Locale "${r}" has changed since.`);
871
- for (let e of [...o, a]) k(e.l10n) && (delete e.l10n[r], Object.keys(e.l10n).length === 0 && delete e.l10n);
868
+ return A(n) && A(n[t]) ? n[t] : {};
869
+ }
870
+ function ht(e, t, n) {
871
+ let r = ft(e, t, n), i = N(t, n);
872
+ i && (!A(i.blocks) || i.settings !== void 0 && !A(i.settings)) && k("invalid_operation", n, "expect needs a blocks object and an optional settings layer.");
873
+ let a = e.settings, o = F(Ve(e)), s = Object.fromEntries(o.flatMap((e) => A(e.l10n) && Object.hasOwn(e.l10n, r) ? [[String(e.id), e.l10n[r]]] : []));
874
+ !i || g(s, i.blocks) && g(A(a.l10n) ? a.l10n[r] : void 0, i.settings) || k("precondition_failed", n, `Locale "${r}" has changed since.`);
875
+ for (let e of [...o, a]) A(e.l10n) && (delete e.l10n[r], Object.keys(e.l10n).length === 0 && delete e.l10n);
872
876
  e.settings.locales.splice(e.settings.locales.indexOf(r), 1), e.settings.locales.length === 0 && delete e.settings.locales;
873
877
  }
874
- function mt(e, t, n) {
875
- (e.text === void 0 || ((e) => k(e) && Object.values(e).every((e) => k(e) && typeof e.value == "string" && typeof e.sourceHash == "string"))(e.text)) && (e.set === void 0 || k(e.set) && !Object.values(e.set).some((e) => e === void 0)) && (e.unset === void 0 || Array.isArray(e.unset) && e.unset.every((e) => typeof e == "string" && e !== "" && _(e))) && (e.hidden === void 0 || !n && typeof e.hidden == "boolean") && [
878
+ function gt(e, t, n) {
879
+ (e.text === void 0 || ((e) => A(e) && Object.values(e).every((e) => A(e) && typeof e.value == "string" && typeof e.sourceHash == "string"))(e.text)) && (e.set === void 0 || A(e.set) && !Object.values(e.set).some((e) => e === void 0)) && (e.unset === void 0 || Array.isArray(e.unset) && e.unset.every((e) => typeof e == "string" && e !== "" && y(e))) && (e.hidden === void 0 || !n && typeof e.hidden == "boolean") && [
876
880
  "text",
877
881
  "set",
878
882
  "unset",
879
883
  ...n ? [] : ["hidden"]
880
- ].some((t) => e[t] !== void 0) || O("invalid_operation", t, "A locale update needs text, set, unset or a block's boolean hidden.");
881
- let r = F(e, t);
882
- return r && (r.text !== void 0 && !k(r.text) || r.set !== void 0 && !k(r.set) || r.hidden !== void 0 && (n || typeof r.hidden != "boolean")) && O("invalid_operation", t, "The locale layer expect is malformed."), {
884
+ ].some((t) => e[t] !== void 0) || k("invalid_operation", t, "A locale update needs text, set, unset or a block's boolean hidden.");
885
+ let r = N(e, t);
886
+ return r && (r.text !== void 0 && !A(r.text) || r.set !== void 0 && !A(r.set) || r.hidden !== void 0 && (n || typeof r.hidden != "boolean")) && k("invalid_operation", t, "The locale layer expect is malformed."), {
883
887
  text: e.text ?? {},
884
888
  set: e.set ?? {},
885
889
  unset: e.unset ?? [],
@@ -887,82 +891,82 @@ function mt(e, t, n) {
887
891
  expect: r
888
892
  };
889
893
  }
890
- function ht(e, t, n, r) {
891
- for (let i of Object.keys(t.text)) _(i) && (r ? h.includes(i) : S(String(e.type), i)) && v(e, i) !== void 0 || O("invalid_operation", n, `Text path "${i}" isn't translatable or doesn't resolve.`);
894
+ function _t(e, t, n, r) {
895
+ for (let i of Object.keys(t.text)) y(i) && (r ? _.includes(i) : Se(String(e.type), i)) && b(e, i) !== void 0 || k("invalid_operation", n, `Text path "${i}" isn't translatable or doesn't resolve.`);
892
896
  for (let i of Object.keys(t.set)) {
893
- let a = i.split("."), o = r ? ze : Le, s = a.length === 1 ? e : v(e, a.slice(0, -1).join("."));
894
- (!_(i) || o.has(a[0]) || !r && xe(e, i, t.set[i]) || v(e, i) === void 0 && !k(s)) && O("invalid_operation", n, `Override path "${i}" is immutable or doesn't resolve.`);
897
+ let a = i.split("."), o = r ? Re : Ie, s = a.length === 1 ? e : b(e, a.slice(0, -1).join("."));
898
+ (!y(i) || o.has(a[0]) || !r && ye(e, i, t.set[i]) || b(e, i) === void 0 && !A(s)) && k("invalid_operation", n, `Override path "${i}" is immutable or doesn't resolve.`);
895
899
  }
896
900
  }
897
- function gt(e, t, n, r) {
901
+ function vt(e, t, n, r) {
898
902
  if (t) {
899
- for (let i of ["text", "set"]) for (let [a, o] of Object.entries(t[i] ?? {})) m(e[i]?.[a] ?? null, o) || O("precondition_failed", n, `Locale path "${a}" has changed since.`, r);
900
- t.hidden !== void 0 && !m(e.hidden === !0, t.hidden) && O("precondition_failed", n, "The locale's hidden state has changed since.", r);
903
+ for (let i of ["text", "set"]) for (let [a, o] of Object.entries(t[i] ?? {})) g(e[i]?.[a] ?? null, o) || k("precondition_failed", n, `Locale path "${a}" has changed since.`, r);
904
+ t.hidden !== void 0 && !g(e.hidden === !0, t.hidden) && k("precondition_failed", n, "The locale's hidden state has changed since.", r);
901
905
  }
902
906
  }
903
- function _t(e, t, n) {
904
- k(e.l10n) || (e.l10n = {});
907
+ function yt(e, t, n) {
908
+ A(e.l10n) || (e.l10n = {});
905
909
  let r = e.l10n;
906
- k(r[t]) || (r[t] = {});
910
+ A(r[t]) || (r[t] = {});
907
911
  let i = r[t];
908
912
  for (let e of n.unset) i.text && delete i.text[e], i.set && delete i.set[e];
909
- for (let [e, t] of Object.entries(n.text)) i.text ||= {}, i.text[e] = p(t), i.set && delete i.set[e];
910
- for (let [e, t] of Object.entries(n.set)) i.set ||= {}, i.set[e] = p(t), i.text && delete i.text[e];
913
+ for (let [e, t] of Object.entries(n.text)) i.text ||= {}, i.text[e] = h(t), i.set && delete i.set[e];
914
+ for (let [e, t] of Object.entries(n.set)) i.set ||= {}, i.set[e] = h(t), i.text && delete i.text[e];
911
915
  n.hidden === !0 ? i.hidden = !0 : n.hidden === !1 && delete i.hidden, i.text && Object.keys(i.text).length === 0 && delete i.text, i.set && Object.keys(i.set).length === 0 && delete i.set, Object.keys(i).length === 0 && delete r[t], Object.keys(r).length === 0 && delete e.l10n;
912
916
  }
913
- function R(e) {
914
- return k(e) ? e.type === "slot" || Array.isArray(e.children) && e.children.some((e) => Array.isArray(e) ? e.some(R) : R(e)) : !1;
917
+ function I(e) {
918
+ return A(e) ? e.type === "slot" || Array.isArray(e.children) && e.children.some((e) => Array.isArray(e) ? e.some(I) : I(e)) : !1;
915
919
  }
916
- function vt(e) {
917
- return k(e) && k(e.l10n) && Object.values(e.l10n).some((e) => k(e) && e.hidden === !0);
920
+ function bt(e) {
921
+ return A(e) && A(e.l10n) && Object.values(e.l10n).some((e) => A(e) && e.hidden === !0);
918
922
  }
919
- function yt(e) {
920
- return !k(e) || !R(e) ? !1 : vt(e) ? !0 : Array.isArray(e.children) && e.children.some((e) => Array.isArray(e) ? e.some(yt) : yt(e));
923
+ function xt(e) {
924
+ return !A(e) || !I(e) ? !1 : bt(e) ? !0 : Array.isArray(e.children) && e.children.some((e) => Array.isArray(e) ? e.some(xt) : xt(e));
921
925
  }
922
- function bt(e, t, n, r, i) {
923
- if (!R(t)) return;
926
+ function St(e, t, n, r, i) {
927
+ if (!I(t)) return;
924
928
  let a = n === null ? null : M(e, n.sectionId);
925
- (a !== null && vt(a.block) || i && yt(t)) && O("invalid_operation", r, "A layout's slot block can't be placed inside a block that a language hides.", k(t) && typeof t.id == "string" ? t.id : void 0);
929
+ (a !== null && bt(a.block) || i && xt(t)) && k("invalid_operation", r, "A layout's slot block can't be placed inside a block that a language hides.", A(t) && typeof t.id == "string" ? t.id : void 0);
926
930
  }
927
- function xt(e, t, n, r) {
928
- let i = ut(e, t, n), a = P(t, n), o = mt(t, n, !1), s = L(j(e)).find((e) => e.id === a);
929
- s || O("block_missing", n, `No block with id "${a}".`, a), ht(s, o, n, !1), Ye(r, a, i, n), gt(ft(s, i), o.expect, n, a), o.hidden === !0 && R(s) && O("invalid_operation", n, "A layout's slot block, and any block that contains it, can't be hidden.", a), _t(s, i, o);
931
+ function Ct(e, t, n, r) {
932
+ let i = ft(e, t, n), a = Ge(t, n), o = gt(t, n, !1), s = F(Ve(e)).find((e) => e.id === a);
933
+ s || k("block_missing", n, `No block with id "${a}".`, a), _t(s, o, n, !1), Ze(r, a, i, n), vt(mt(s, i), o.expect, n, a), o.hidden === !0 && I(s) && k("invalid_operation", n, "A layout's slot block, and any block that contains it, can't be hidden.", a), yt(s, i, o);
930
934
  }
931
- function St(e, t, n) {
932
- let r = ut(e, t, n), i = mt(t, n, !0), a = e.settings;
933
- ht(a, i, n, !0), gt(ft(a, r), i.expect, n), _t(a, r, i);
935
+ function wt(e, t, n) {
936
+ let r = ft(e, t, n), i = gt(t, n, !0), a = e.settings;
937
+ _t(a, i, n, !0), vt(mt(a, r), i.expect, n), yt(a, r, i);
934
938
  }
935
- function Ct(e, t, n, r) {
939
+ function Tt(e, t, n, r) {
936
940
  let i = t.content;
937
- if (!k(i) || !Array.isArray(i.blocks) || !k(i.settings)) return O("invalid_operation", n, "setContent needs content with a blocks array and a settings object.");
938
- nt(i, n, e);
939
- let a = r.locks.find((e) => I(r, e));
940
- a && O("locked_by_others", n, "Other sessions hold locks on this template.", a.blockId), e.blocks = p(i.blocks), e.settings = p(i.settings);
941
- }
942
- function wt(e, t, n, r) {
943
- let i = lt(t, n);
944
- e.settings.locales?.includes(i) || O("invalid_operation", n, `"${i}" is not a language version of this template.`);
945
- let a = Ae(e, i);
946
- a.length && O("invalid_operation", n, a.length === 1 ? `1 block is hidden in "${i}". Show it before making it the default.` : `${a.length} blocks are hidden in "${i}". Show them before making it the default.`, a[0]);
947
- let o = r.locks.find((e) => I(r, e));
948
- o && O("locked_by_others", n, "Other sessions hold locks on this template.", o.blockId);
941
+ if (!A(i) || !Array.isArray(i.blocks) || !A(i.settings)) return k("invalid_operation", n, "setContent needs content with a blocks array and a settings object.");
942
+ it(i, n, e);
943
+ let a = r.locks.find((e) => P(r, e));
944
+ a && k("locked_by_others", n, "Other sessions hold locks on this template.", a.blockId), e.blocks = h(i.blocks), e.settings = h(i.settings);
945
+ }
946
+ function Et(e, t, n, r) {
947
+ let i = dt(t, n);
948
+ e.settings.locales?.includes(i) || k("invalid_operation", n, `"${i}" is not a language version of this template.`);
949
+ let a = ke(e, i);
950
+ a.length && k("invalid_operation", n, a.length === 1 ? `1 block is hidden in "${i}". Show it before making it the default.` : `${a.length} blocks are hidden in "${i}". Show them before making it the default.`, a[0]);
951
+ let o = r.locks.find((e) => P(r, e));
952
+ o && k("locked_by_others", n, "Other sessions hold locks on this template.", o.blockId);
949
953
  let s = t.customTextFields;
950
954
  if (s !== void 0) {
951
- let t = L(e.blocks);
952
- (!k(s) || Object.getOwnPropertyNames(s).some((e) => {
953
- if (Be.has(e)) return !0;
955
+ let t = F(e.blocks);
956
+ (!A(s) || Object.getOwnPropertyNames(s).some((e) => {
957
+ if (ze.has(e)) return !0;
954
958
  let n = s[e], r = t.find((t) => t.id === e);
955
- return r?.type !== "custom" || !Array.isArray(n) || n.some((e) => typeof e != "string" || !_(e) || !S("custom", e) || typeof v(r, e) != "string");
956
- })) && O("invalid_operation", n, Ve);
959
+ return r?.type !== "custom" || !Array.isArray(n) || n.some((e) => typeof e != "string" || !y(e) || !Se("custom", e) || typeof b(r, e) != "string");
960
+ })) && k("invalid_operation", n, Be);
957
961
  }
958
- let c = Ne(e, i, t.customTextFields);
962
+ let c = Me(e, i, t.customTextFields);
959
963
  e.blocks = c.blocks, e.settings = c.settings;
960
964
  }
961
- function Tt(e) {
965
+ function Dt(e) {
962
966
  let t = e.children;
963
967
  return e.type === "section" && Array.isArray(t) ? t : [];
964
968
  }
965
- function Et(e, t, n = null) {
969
+ function Ot(e, t, n = null) {
966
970
  for (let r = 0; r < e.length; r++) {
967
971
  let i = e[r];
968
972
  if (i.id === t) return {
@@ -970,10 +974,10 @@ function Et(e, t, n = null) {
970
974
  parent: n,
971
975
  after: r > 0 ? e[r - 1].id : null
972
976
  };
973
- let a = Tt(i);
977
+ let a = Dt(i);
974
978
  for (let e = 0; e < a.length; e++) {
975
979
  if (!Array.isArray(a[e])) continue;
976
- let n = Et(a[e], t, {
980
+ let n = Ot(a[e], t, {
977
981
  sectionId: i.id,
978
982
  column: e
979
983
  });
@@ -982,18 +986,18 @@ function Et(e, t, n = null) {
982
986
  }
983
987
  return null;
984
988
  }
985
- function Dt(e, t, n) {
986
- let r = Et(e.blocks, t);
987
- if (!r) throw new E("block_missing", n, `No block with id "${t}".`, t);
989
+ function kt(e, t, n) {
990
+ let r = Ot(e.blocks, t);
991
+ if (!r) throw new D("block_missing", n, `No block with id "${t}".`, t);
988
992
  return r;
989
993
  }
990
- function Ot(e, t, n) {
994
+ function At(e, t, n) {
991
995
  let r = {}, i = [], a = {}, o = [.../* @__PURE__ */ new Set([...Object.keys(t ?? {}), ...n ?? []])];
992
996
  for (let n of o) {
993
997
  let o = e[n];
994
- o === void 0 ? i.push(n) : r[n] = p(o);
998
+ o === void 0 ? i.push(n) : r[n] = h(o);
995
999
  let s = t && n in t ? t[n] : void 0;
996
- a[n] = s === void 0 ? null : p(s);
1000
+ a[n] = s === void 0 ? null : h(s);
997
1001
  }
998
1002
  return {
999
1003
  set: r,
@@ -1001,13 +1005,13 @@ function Ot(e, t, n) {
1001
1005
  expect: a
1002
1006
  };
1003
1007
  }
1004
- function kt(e, t) {
1008
+ function L(e, t) {
1005
1009
  return e.l10n?.[t] ?? {};
1006
1010
  }
1007
- function z(e, t, n, r) {
1011
+ function R(e, t, n, r) {
1008
1012
  let i = {}, a = {}, o = {};
1009
1013
  n.length && (o.text = {}, o.set = {});
1010
- for (let r of n) e.text?.[r] !== void 0 && (i[r] = p(e.text[r])), e.set && Object.hasOwn(e.set, r) && (a[r] = p(e.set[r])), o.text[r] = p(t.text?.[r] ?? null), o.set[r] = p(t.set?.[r] ?? null);
1014
+ for (let r of n) e.text?.[r] !== void 0 && (i[r] = h(e.text[r])), e.set && Object.hasOwn(e.set, r) && (a[r] = h(e.set[r])), o.text[r] = h(t.text?.[r] ?? null), o.set[r] = h(t.set?.[r] ?? null);
1011
1015
  return r && (o.hidden = t.hidden === !0), {
1012
1016
  unset: n,
1013
1017
  ...Object.keys(i).length ? { text: i } : {},
@@ -1016,21 +1020,21 @@ function z(e, t, n, r) {
1016
1020
  expect: o
1017
1021
  };
1018
1022
  }
1019
- function At(e) {
1020
- let { unset: t, ...n } = z(e, {}, [.../* @__PURE__ */ new Set([...Object.keys(e.text ?? {}), ...Object.keys(e.set ?? {})])], e.hidden === !0);
1023
+ function jt(e) {
1024
+ let { unset: t, ...n } = R(e, {}, [.../* @__PURE__ */ new Set([...Object.keys(e.text ?? {}), ...Object.keys(e.set ?? {})])], e.hidden === !0);
1021
1025
  return n;
1022
1026
  }
1023
- function B(e) {
1024
- return e.flatMap((e) => [e, ...e.type === "wrapper" ? B(e.children) : Tt(e).flatMap(B)]);
1027
+ function z(e) {
1028
+ return e.flatMap((e) => [e, ...e.type === "wrapper" ? z(e.children) : Dt(e).flatMap(z)]);
1025
1029
  }
1026
- function jt(e, t) {
1027
- let n = p(e);
1028
- D(n, [t]);
1030
+ function Mt(e, t) {
1031
+ let n = h(e);
1032
+ O(n, [t]);
1029
1033
  let r = [], i = (e, t, n) => {
1030
1034
  for (let [i, a] of Object.entries(e.l10n ?? {})) {
1031
1035
  let e = t.l10n?.[i] ?? {}, o = [.../* @__PURE__ */ new Set([...Object.keys(a.text ?? {}).filter((t) => !Object.hasOwn(e.text ?? {}, t)), ...Object.keys(a.set ?? {}).filter((t) => !Object.hasOwn(e.set ?? {}, t))])];
1032
1036
  if (!o.length) continue;
1033
- let s = z(a, e, o, !1);
1037
+ let s = R(a, e, o, !1);
1034
1038
  r.push(n === void 0 ? {
1035
1039
  op: "updateSettingsLocale",
1036
1040
  locale: i,
@@ -1045,32 +1049,32 @@ function jt(e, t) {
1045
1049
  };
1046
1050
  if (t.op === "updateSettings") i(e.settings, n.settings);
1047
1051
  else {
1048
- let t = new Map(B(n.blocks).map((e) => [e.id, e]));
1049
- for (let n of B(e.blocks)) {
1052
+ let t = new Map(z(n.blocks).map((e) => [e.id, e]));
1053
+ for (let n of z(e.blocks)) {
1050
1054
  let e = t.get(n.id);
1051
1055
  e && i(n, e, n.id);
1052
1056
  }
1053
1057
  }
1054
1058
  return r;
1055
1059
  }
1056
- function Mt(e, t, n) {
1060
+ function Nt(e, t, n) {
1057
1061
  switch (t.op) {
1058
1062
  case "addBlock": return {
1059
1063
  op: "deleteBlock",
1060
1064
  blockId: t.block.id,
1061
- expect: { block: p(t.block) }
1065
+ expect: { block: h(t.block) }
1062
1066
  };
1063
1067
  case "deleteBlock": {
1064
- let r = Dt(e, t.blockId, n);
1068
+ let r = kt(e, t.blockId, n);
1065
1069
  return {
1066
1070
  op: "addBlock",
1067
- block: p(r.block),
1071
+ block: h(r.block),
1068
1072
  parent: r.parent,
1069
1073
  after: r.after
1070
1074
  };
1071
1075
  }
1072
1076
  case "moveBlock": {
1073
- let r = Dt(e, t.blockId, n);
1077
+ let r = kt(e, t.blockId, n);
1074
1078
  return {
1075
1079
  op: "moveBlock",
1076
1080
  blockId: t.blockId,
@@ -1083,23 +1087,23 @@ function Mt(e, t, n) {
1083
1087
  };
1084
1088
  }
1085
1089
  case "updateBlock": {
1086
- let r = Dt(e, t.blockId, n).block, { set: i, unset: a, expect: o } = Ot(r, t.set, t.unset);
1090
+ let r = kt(e, t.blockId, n).block, { set: i, unset: a, expect: o } = At(r, t.set, t.unset);
1087
1091
  return [{
1088
1092
  op: "updateBlock",
1089
1093
  blockId: t.blockId,
1090
1094
  ...Object.keys(i).length > 0 ? { set: i } : {},
1091
1095
  ...a.length > 0 ? { unset: a } : {},
1092
1096
  expect: o
1093
- }, ...jt(e, t)];
1097
+ }, ...Mt(e, t)];
1094
1098
  }
1095
1099
  case "updateSettings": {
1096
- let { set: n, unset: r, expect: i } = Ot(e.settings, t.set, t.unset);
1100
+ let { set: n, unset: r, expect: i } = At(e.settings, t.set, t.unset);
1097
1101
  return [{
1098
1102
  op: "updateSettings",
1099
1103
  ...Object.keys(n).length > 0 ? { set: n } : {},
1100
1104
  ...r.length > 0 ? { unset: r } : {},
1101
1105
  expect: i
1102
- }, ...jt(e, t)];
1106
+ }, ...Mt(e, t)];
1103
1107
  }
1104
1108
  case "addLocale": return {
1105
1109
  op: "removeLocale",
@@ -1112,18 +1116,18 @@ function Mt(e, t, n) {
1112
1116
  locale: t.locale,
1113
1117
  position: e.settings.locales?.indexOf(t.locale)
1114
1118
  }];
1115
- for (let r of B(e.blocks)) {
1119
+ for (let r of z(e.blocks)) {
1116
1120
  let e = r.l10n?.[t.locale];
1117
1121
  e && n.push({
1118
1122
  op: "updateBlockLocale",
1119
1123
  blockId: r.id,
1120
1124
  locale: t.locale,
1121
- ...At(e)
1125
+ ...jt(e)
1122
1126
  });
1123
1127
  }
1124
1128
  let r = e.settings.l10n?.[t.locale];
1125
1129
  if (r) {
1126
- let { hidden: e, ...i } = At(r);
1130
+ let { hidden: e, ...i } = jt(r);
1127
1131
  n.push({
1128
1132
  op: "updateSettingsLocale",
1129
1133
  locale: t.locale,
@@ -1134,23 +1138,23 @@ function Mt(e, t, n) {
1134
1138
  }
1135
1139
  case "updateBlockLocale":
1136
1140
  case "updateSettingsLocale": {
1137
- let n = p(e);
1138
- D(n, [t]);
1141
+ let n = h(e);
1142
+ O(n, [t]);
1139
1143
  let r = [.../* @__PURE__ */ new Set([
1140
1144
  ...Object.keys(t.text ?? {}),
1141
1145
  ...Object.keys(t.set ?? {}),
1142
1146
  ...t.unset ?? []
1143
1147
  ])];
1144
1148
  if (t.op === "updateBlockLocale") {
1145
- let i = B(e.blocks).find((e) => e.id === t.blockId), a = B(n.blocks).find((e) => e.id === t.blockId);
1149
+ let i = z(e.blocks).find((e) => e.id === t.blockId), a = z(n.blocks).find((e) => e.id === t.blockId);
1146
1150
  return {
1147
1151
  op: "updateBlockLocale",
1148
1152
  blockId: t.blockId,
1149
1153
  locale: t.locale,
1150
- ...z(kt(i, t.locale), kt(a, t.locale), r, t.hidden !== void 0)
1154
+ ...R(L(i, t.locale), L(a, t.locale), r, t.hidden !== void 0)
1151
1155
  };
1152
1156
  }
1153
- let { hidden: i, ...a } = z(kt(e.settings, t.locale), kt(n.settings, t.locale), r, !1);
1157
+ let { hidden: i, ...a } = R(L(e.settings, t.locale), L(n.settings, t.locale), r, !1);
1154
1158
  return {
1155
1159
  op: "updateSettingsLocale",
1156
1160
  locale: t.locale,
@@ -1161,56 +1165,56 @@ function Mt(e, t, n) {
1161
1165
  case "setContent": return {
1162
1166
  op: "setContent",
1163
1167
  content: {
1164
- blocks: p(e.blocks),
1165
- settings: p(e.settings)
1168
+ blocks: h(e.blocks),
1169
+ settings: h(e.settings)
1166
1170
  }
1167
1171
  };
1168
1172
  }
1169
1173
  }
1170
- function Nt(e, t) {
1171
- let n = p(e), r = [];
1174
+ function Pt(e, t) {
1175
+ let n = h(e), r = [];
1172
1176
  return t.forEach((e, t) => {
1173
1177
  try {
1174
- let i = Mt(n, e, t);
1175
- r.push(...Array.isArray(i) ? [...i].reverse() : [i]), D(n, [e]);
1178
+ let i = Nt(n, e, t);
1179
+ r.push(...Array.isArray(i) ? [...i].reverse() : [i]), O(n, [e]);
1176
1180
  } catch (e) {
1177
- throw e instanceof E ? new E(e.code, t, e.message, e.blockId) : e;
1181
+ throw e instanceof D ? new D(e.code, t, e.message, e.blockId) : e;
1178
1182
  }
1179
1183
  }), r.reverse();
1180
1184
  }
1181
- function Pt(e) {
1185
+ function Ft(e) {
1182
1186
  return e === "invalid_operation" ? 422 : e === "content_too_large" ? 413 : 409;
1183
1187
  }
1184
- var Ft = class extends he {
1188
+ var It = class extends pe {
1185
1189
  opIndex;
1186
1190
  holder;
1187
1191
  holders;
1188
1192
  constructor(e, t) {
1189
- super(e, t.status ?? Pt(t.code), t.code), this.name = "CollaborationConflict", t.opIndex !== void 0 && (this.opIndex = t.opIndex), t.holder !== void 0 && (this.holder = t.holder), t.holders !== void 0 && (this.holders = t.holders);
1193
+ super(e, t.status ?? Ft(t.code), t.code), this.name = "CollaborationConflict", t.opIndex !== void 0 && (this.opIndex = t.opIndex), t.holder !== void 0 && (this.holder = t.holder), t.holders !== void 0 && (this.holders = t.holders);
1190
1194
  }
1191
1195
  };
1192
- function It(e) {
1196
+ function Lt(e) {
1193
1197
  return e.type === "section";
1194
1198
  }
1195
- function Lt(e) {
1199
+ function Rt(e) {
1196
1200
  return e.type === "custom";
1197
1201
  }
1198
- function V(e) {
1202
+ function B(e) {
1199
1203
  return e.type === "slot";
1200
1204
  }
1201
- function H(e) {
1205
+ function V(e) {
1202
1206
  return e.type === "wrapper";
1203
1207
  }
1204
- var Rt = {
1208
+ var zt = {
1205
1209
  content: "<p>Enter your title</p>",
1206
1210
  level: 2,
1207
1211
  textAlign: "left"
1208
- }, zt = { content: "<p>Enter your text here</p>" }, Bt = {
1212
+ }, Bt = { content: "<p>Enter your text here</p>" }, Vt = {
1209
1213
  src: "",
1210
1214
  alt: "",
1211
1215
  width: "full",
1212
1216
  align: "center"
1213
- }, Vt = {
1217
+ }, Ht = {
1214
1218
  text: "Click Here",
1215
1219
  url: "",
1216
1220
  backgroundColor: "#333333",
@@ -1224,36 +1228,36 @@ var Rt = {
1224
1228
  left: 24
1225
1229
  },
1226
1230
  align: "center"
1227
- }, Ht = {
1231
+ }, Ut = {
1228
1232
  lineStyle: "solid",
1229
1233
  color: "#e0e0e0",
1230
1234
  thickness: 1,
1231
1235
  width: "full"
1232
- }, Ut = { columns: "1" }, Wt = {
1236
+ }, Wt = { columns: "1" }, Gt = {
1233
1237
  url: "",
1234
1238
  thumbnailUrl: "",
1235
1239
  alt: "Video",
1236
1240
  width: "full",
1237
1241
  align: "center"
1238
- }, Gt = {
1242
+ }, Kt = {
1239
1243
  iconStyle: "solid",
1240
1244
  iconSize: "medium",
1241
1245
  spacing: 10,
1242
1246
  align: "center"
1243
- }, Kt = { height: 24 }, qt = { content: "" }, Jt = {
1247
+ }, qt = { height: 24 }, Jt = { content: "" }, Yt = {
1244
1248
  fontSize: 15,
1245
1249
  textAlign: "center",
1246
1250
  separator: "|",
1247
1251
  separatorColor: "#e0e0e0",
1248
1252
  spacing: 10
1249
- }, Yt = {
1253
+ }, Xt = {
1250
1254
  hasHeaderRow: !0,
1251
1255
  borderColor: "#e0e0e0",
1252
1256
  borderWidth: 1,
1253
1257
  cellPadding: 8,
1254
1258
  fontSize: 15,
1255
1259
  textAlign: "left"
1256
- }, Xt = {
1260
+ }, Zt = {
1257
1261
  targetDate: "",
1258
1262
  timezone: "UTC",
1259
1263
  showDays: !0,
@@ -1273,21 +1277,21 @@ var Rt = {
1273
1277
  expiredMessage: "This offer has expired",
1274
1278
  expiredImageUrl: "",
1275
1279
  hideOnExpiry: !1
1276
- }, Zt = {
1277
- title: Rt,
1278
- paragraph: zt,
1279
- image: Bt,
1280
- button: Vt,
1281
- divider: Ht,
1282
- section: Ut,
1283
- video: Wt,
1284
- social: Gt,
1285
- spacer: Kt,
1286
- html: qt,
1287
- menu: Jt,
1288
- table: Yt,
1289
- countdown: Xt
1290
1280
  }, Qt = {
1281
+ title: zt,
1282
+ paragraph: Bt,
1283
+ image: Vt,
1284
+ button: Ht,
1285
+ divider: Ut,
1286
+ section: Wt,
1287
+ video: Gt,
1288
+ social: Kt,
1289
+ spacer: qt,
1290
+ html: Jt,
1291
+ menu: Yt,
1292
+ table: Xt,
1293
+ countdown: Zt
1294
+ }, $t = {
1291
1295
  width: 600,
1292
1296
  backgroundColor: "#ffffff",
1293
1297
  textColor: "#1a1a1a",
@@ -1295,28 +1299,28 @@ var Rt = {
1295
1299
  fontFamily: "Arial",
1296
1300
  locale: "en"
1297
1301
  };
1298
- function $t(e) {
1302
+ function en(e) {
1299
1303
  return typeof e == "object" && !!e && !Array.isArray(e) && Object.getPrototypeOf(e) === Object.prototype;
1300
1304
  }
1301
- function en(e, t) {
1305
+ function tn(e, t) {
1302
1306
  let n = { ...e };
1303
1307
  for (let r of Object.keys(t)) {
1304
1308
  let i = e[r], a = t[r];
1305
- a !== void 0 && (n[r] = $t(i) && $t(a) ? en(i, a) : a);
1309
+ a !== void 0 && (n[r] = en(i) && en(a) ? tn(i, a) : a);
1306
1310
  }
1307
1311
  return n;
1308
1312
  }
1309
- function tn(e = "Arial", t) {
1313
+ function nn(e = "Arial", t) {
1310
1314
  return {
1311
1315
  blocks: [],
1312
1316
  settings: {
1313
- ...Qt,
1317
+ ...$t,
1314
1318
  fontFamily: e,
1315
1319
  ...t
1316
1320
  }
1317
1321
  };
1318
1322
  }
1319
- var nn = [
1323
+ var rn = [
1320
1324
  "ar",
1321
1325
  "he",
1322
1326
  "iw",
@@ -1330,31 +1334,64 @@ var nn = [
1330
1334
  "ckb",
1331
1335
  "ks"
1332
1336
  ];
1333
- function rn(e) {
1337
+ function an(e) {
1334
1338
  let t = e?.trim().replace(/_/g, "-").split("-")[0]?.toLowerCase();
1335
- return !!t && nn.includes(t);
1339
+ return !!t && rn.includes(t);
1336
1340
  }
1337
- function an(e) {
1338
- return e.direction === "ltr" || e.direction === "rtl" ? e.direction : rn(e.locale) ? "rtl" : "ltr";
1341
+ function on(e) {
1342
+ return e.direction === "ltr" || e.direction === "rtl" ? e.direction : an(e.locale) ? "rtl" : "ltr";
1343
+ }
1344
+ var sn = 2e4, cn = /* @__PURE__ */ new Set(["\"", "'"]);
1345
+ function H(e, t) {
1346
+ let n = null, r = "tag";
1347
+ for (let i = t; i < e.length; i++) {
1348
+ let t = e[i];
1349
+ if (n !== null) t === n && (n = null);
1350
+ else {
1351
+ if (r === "beforeValue") {
1352
+ if (U(t)) continue;
1353
+ if (cn.has(t)) {
1354
+ n = t, r = "tag";
1355
+ continue;
1356
+ }
1357
+ r = "unquotedValue";
1358
+ }
1359
+ if (r === "unquotedValue") {
1360
+ if (t === ">") return i;
1361
+ U(t) && (r = "tag");
1362
+ } else if (t === "=") r = "beforeValue";
1363
+ else if (t === ">") return i;
1364
+ }
1365
+ }
1366
+ return -1;
1339
1367
  }
1340
- var on = 2e4, sn = /* @__PURE__ */ new Set(["\"", "'"]);
1341
- function U(e, t) {
1368
+ function ln(e, t) {
1342
1369
  let n = null;
1343
1370
  for (let r = t; r < e.length; r++) {
1344
1371
  let t = e[r];
1345
1372
  if (n !== null) t === n && (n = null);
1346
- else if (sn.has(t)) n = t;
1347
- else if (t === ">") return r;
1373
+ else if (cn.has(t)) n = t;
1374
+ else if (t === ">") return {
1375
+ end: r,
1376
+ nextSpan: -1
1377
+ };
1378
+ else if (t === "<" && e.startsWith("<span", r)) return {
1379
+ end: -1,
1380
+ nextSpan: r
1381
+ };
1348
1382
  }
1349
- return -1;
1383
+ return {
1384
+ end: -1,
1385
+ nextSpan: -1
1386
+ };
1350
1387
  }
1351
- function cn(e) {
1388
+ function un(e) {
1352
1389
  return e !== " " && e !== " " && e !== "\n" && e !== "\r" && e !== "\f" && e !== "=" && e !== ">" && e !== "/";
1353
1390
  }
1354
- function W(e) {
1391
+ function U(e) {
1355
1392
  return e === " " || e === " " || e === "\n" || e === "\r" || e === "\f";
1356
1393
  }
1357
- var ln = {
1394
+ var dn = {
1358
1395
  AMP: "&",
1359
1396
  COPY: "©",
1360
1397
  GT: ">",
@@ -1615,50 +1652,50 @@ var ln = {
1615
1652
  zwj: "‍",
1616
1653
  zwnj: "‌"
1617
1654
  };
1618
- function G(e) {
1655
+ function W(e) {
1619
1656
  return e.includes("&") ? e.replace(/&(#[0-9]+|#[xX][0-9a-fA-F]+|[a-zA-Z][a-zA-Z0-9]*);/g, (e, t) => {
1620
1657
  if (t[0] === "#") {
1621
1658
  let n = t[1] === "x" || t[1] === "X" ? Number.parseInt(t.slice(2), 16) : Number.parseInt(t.slice(1), 10);
1622
1659
  return !Number.isFinite(n) || n < 1 || n > 1114111 || n >= 55296 && n <= 57343 ? e : String.fromCodePoint(n);
1623
1660
  }
1624
- return Object.hasOwn(ln, t) ? ln[t] : e;
1661
+ return Object.hasOwn(dn, t) ? dn[t] : e;
1625
1662
  }) : e;
1626
1663
  }
1627
- function un(e, t) {
1664
+ function fn(e, t) {
1628
1665
  let n = t.toLowerCase(), r = 0;
1629
1666
  for (; r < e.length;) {
1630
- for (; r < e.length && (W(e[r]) || e[r] === "/");) r++;
1667
+ for (; r < e.length && (U(e[r]) || e[r] === "/");) r++;
1631
1668
  if (r >= e.length) break;
1632
1669
  let t = r;
1633
- for (; r < e.length && cn(e[r]);) r++;
1670
+ for (; r < e.length && un(e[r]);) r++;
1634
1671
  let i = e.substring(t, r).toLowerCase();
1635
1672
  if (i === "") {
1636
1673
  r++;
1637
1674
  continue;
1638
1675
  }
1639
- for (; r < e.length && W(e[r]);) r++;
1676
+ for (; r < e.length && U(e[r]);) r++;
1640
1677
  if (e[r] !== "=") continue;
1641
- for (r++; r < e.length && W(e[r]);) r++;
1678
+ for (r++; r < e.length && U(e[r]);) r++;
1642
1679
  let a = e[r];
1643
- if (sn.has(a)) {
1680
+ if (cn.has(a)) {
1644
1681
  let t = r + 1, o = e.indexOf(a, t);
1645
1682
  if (o === -1) return null;
1646
- if (i === n) return G(e.substring(t, o));
1683
+ if (i === n) return W(e.substring(t, o));
1647
1684
  r = o + 1;
1648
1685
  continue;
1649
1686
  }
1650
1687
  let o = r;
1651
- for (; r < e.length && !W(e[r]) && e[r] !== ">";) r++;
1652
- if (i === n) return G(e.substring(o, r));
1688
+ for (; r < e.length && !U(e[r]) && e[r] !== ">";) r++;
1689
+ if (i === n) return W(e.substring(o, r));
1653
1690
  }
1654
1691
  return null;
1655
1692
  }
1656
- function dn(e, t) {
1657
- return pn(e, t, !0);
1693
+ function pn(e, t) {
1694
+ return hn(e, t, !0);
1658
1695
  }
1659
- function fn(e) {
1696
+ function mn(e) {
1660
1697
  let t = [];
1661
- return pn(e, (n, r, i) => {
1698
+ return hn(e, (n, r, i) => {
1662
1699
  let a = e.slice(r, i);
1663
1700
  return t.push({
1664
1701
  start: r,
@@ -1667,7 +1704,7 @@ function fn(e) {
1667
1704
  }), a;
1668
1705
  }, !0), t;
1669
1706
  }
1670
- function pn(e, t, n) {
1707
+ function hn(e, t, n) {
1671
1708
  let r = "", i = 0;
1672
1709
  for (; i < e.length;) {
1673
1710
  let a = e.indexOf("<span", i);
@@ -1680,26 +1717,30 @@ function pn(e, t, n) {
1680
1717
  r += e.substring(i, a + 5), i = a + 5;
1681
1718
  continue;
1682
1719
  }
1683
- let s = U(e, a + 5);
1720
+ let { end: s, nextSpan: c } = ln(e, a + 5);
1721
+ if (c !== -1) {
1722
+ r += e.substring(i, c), i = c;
1723
+ continue;
1724
+ }
1684
1725
  if (s === -1) {
1685
1726
  r += e.substring(i);
1686
1727
  break;
1687
1728
  }
1688
- let c = e.substring(a + 5, s), l = hn(c, "data-merge-tag") ?? hn(c, "data-logic-merge-tag");
1689
- if (l === null) {
1690
- r += e.substring(i, a + 5), i = a + 5;
1729
+ let l = e.substring(a + 5, s), u = _n(l, "data-merge-tag") ?? _n(l, "data-logic-merge-tag");
1730
+ if (u === null) {
1731
+ r += e.substring(i, s + 1), i = s + 1;
1691
1732
  continue;
1692
1733
  }
1693
- let u = mn(e, s + 1, n);
1694
- if (u === -1) {
1734
+ let d = gn(e, s + 1, n);
1735
+ if (d === -1) {
1695
1736
  r += e.substring(i);
1696
1737
  break;
1697
1738
  }
1698
- r += e.substring(i, a), r += t(l, a, u), i = u;
1739
+ r += e.substring(i, a), r += t(u, a, d), i = d;
1699
1740
  }
1700
1741
  return r;
1701
1742
  }
1702
- function mn(e, t, n) {
1743
+ function gn(e, t, n) {
1703
1744
  if (!n) {
1704
1745
  let n = e.indexOf("</span>", t);
1705
1746
  return n === -1 ? -1 : n + 7;
@@ -1708,7 +1749,7 @@ function mn(e, t, n) {
1708
1749
  for (; i < e.length;) {
1709
1750
  let t = e.indexOf("<", i);
1710
1751
  if (t === -1) return -1;
1711
- let n = U(e, t + 1);
1752
+ let n = H(e, t + 1);
1712
1753
  if (n === -1) return -1;
1713
1754
  let a = e.startsWith("</span", t), o = e.startsWith("<span", t), s = e[t + (a ? 6 : 5)];
1714
1755
  if ((o || a) && (s === ">" || s === "/" || /\s/.test(s)) && (r += a ? -1 : 1, r === 0)) return n + 1;
@@ -1716,17 +1757,257 @@ function mn(e, t, n) {
1716
1757
  }
1717
1758
  return -1;
1718
1759
  }
1719
- function hn(e, t) {
1720
- return un(e, t);
1760
+ function _n(e, t) {
1761
+ return fn(e, t);
1762
+ }
1763
+ var G = {
1764
+ liquid: {
1765
+ value: /\{\{.+?\}\}/g,
1766
+ logic: /\{%-?\s*(\w+).*?-?%\}/g,
1767
+ opener: "{{",
1768
+ closer: "}}"
1769
+ },
1770
+ handlebars: {
1771
+ value: /\{\{\{?.+?\}?\}\}/g,
1772
+ logic: /\{\{[#/](\w+).*?\}\}/g,
1773
+ opener: "{{",
1774
+ closer: "}}"
1775
+ },
1776
+ mailchimp: {
1777
+ value: /\*\|\w+\|\*/g,
1778
+ logic: /\*\|(\w+)[:|].*?\|\*/g,
1779
+ opener: "*|",
1780
+ closer: "|*"
1781
+ },
1782
+ ampscript: {
1783
+ value: /%%=.+?=%%/g,
1784
+ logic: /%%\[\s*(\w+).*?\]%%/g,
1785
+ opener: "%%=",
1786
+ closer: "=%%"
1787
+ }
1788
+ };
1789
+ function vn(e, t, n) {
1790
+ for (let r = n; r < e.length; r++) {
1791
+ let n = e.charCodeAt(r);
1792
+ if (n === 10 || n === 13 || n === 8232 || n === 8233) return {
1793
+ close: -1,
1794
+ lineBreak: r
1795
+ };
1796
+ if (e.startsWith(t, r)) return {
1797
+ close: r,
1798
+ lineBreak: -1
1799
+ };
1800
+ }
1801
+ return {
1802
+ close: -1,
1803
+ lineBreak: -1
1804
+ };
1805
+ }
1806
+ function K(e, t, n, r = 0, i = Infinity) {
1807
+ let a = Object.keys(G).find((e) => G[e] === t);
1808
+ if (!a) {
1809
+ let a = t[n], o = new RegExp(a.source, a.flags.replace(/[gy]/g, "") + "g");
1810
+ return o.lastIndex = r, [...e.matchAll(o)].slice(0, i).map((e) => ({
1811
+ index: e.index,
1812
+ value: e[0]
1813
+ }));
1814
+ }
1815
+ let o = t[n], s = a === "ampscript" ? n === "value" ? "%%=" : "%%[" : a === "liquid" && n === "logic" ? "{%" : a === "mailchimp" ? "*|" : "{{", c = a === "ampscript" ? n === "value" ? "=%%" : "]%%" : a === "liquid" && n === "logic" ? "%}" : a === "mailchimp" ? "|*" : "}}", l = n === "logic" ? {
1816
+ liquid: String.raw`\{%-?\s*\w+`,
1817
+ handlebars: String.raw`\{\{[#/]\w+`,
1818
+ mailchimp: String.raw`\*\|\w+[:|]`,
1819
+ ampscript: String.raw`%%\[\s*\w+`
1820
+ }[a] : a === "mailchimp" ? String.raw`\*\|\w+` : null, u = l ? new RegExp(l, "y") : null, d = new RegExp(o.source, "y"), f = [], p = r;
1821
+ for (; p < e.length && f.length < i;) {
1822
+ let t = e.indexOf(s, p);
1823
+ if (t < 0) break;
1824
+ if (u && (u.lastIndex = t, !u.exec(e))) {
1825
+ p = t + 1;
1826
+ continue;
1827
+ }
1828
+ let r = u?.lastIndex ?? t + s.length, i = a === "mailchimp" && n === "value" ? {
1829
+ close: e.startsWith(c, r) ? r : -1,
1830
+ lineBreak: -1
1831
+ } : vn(e, c, Math.max(r, t + s.length + +(n === "value")));
1832
+ if (i.lineBreak >= 0) {
1833
+ let r = i.lineBreak, o = n === "logic" && (a === "liquid" || a === "ampscript") ? e.lastIndexOf(s, r) : -1;
1834
+ p = o > t ? o : r + 1;
1835
+ continue;
1836
+ }
1837
+ if (i.close < 0) {
1838
+ if (a === "mailchimp" && n === "value") {
1839
+ p = t + 1;
1840
+ continue;
1841
+ }
1842
+ break;
1843
+ }
1844
+ d.lastIndex = t;
1845
+ let o = d.exec(e);
1846
+ o ? (f.push({
1847
+ index: t,
1848
+ value: o[0]
1849
+ }), p = d.lastIndex) : p = t + 1;
1850
+ }
1851
+ return f;
1852
+ }
1853
+ function yn(e, t) {
1854
+ if (!Object.values(G).includes(t)) {
1855
+ let n = RegExp(`(${t.value.source}|${t.logic.source})`, "g");
1856
+ return [...e.matchAll(n)].map((e) => ({
1857
+ index: e.index,
1858
+ value: e[0]
1859
+ }));
1860
+ }
1861
+ if (t === G.handlebars) return K(e, t, "value");
1862
+ if (t === G.mailchimp) {
1863
+ let n = [], r = new RegExp(t.value.source, "y"), i = new RegExp(t.logic.source, "y"), a = /\*\|\w+[:|]/y, o = 0;
1864
+ for (; o < e.length;) {
1865
+ let t = e.indexOf("*|", o);
1866
+ if (t < 0) break;
1867
+ r.lastIndex = t;
1868
+ let s = r.exec(e);
1869
+ if (s) {
1870
+ n.push({
1871
+ index: t,
1872
+ value: s[0]
1873
+ }), o = r.lastIndex;
1874
+ continue;
1875
+ }
1876
+ if (a.lastIndex = t, !a.exec(e)) {
1877
+ o = t + 2;
1878
+ continue;
1879
+ }
1880
+ let c = vn(e, "|*", a.lastIndex);
1881
+ if (c.lineBreak >= 0) {
1882
+ o = c.lineBreak + 1;
1883
+ continue;
1884
+ }
1885
+ if (c.close < 0) break;
1886
+ i.lastIndex = t;
1887
+ let l = i.exec(e);
1888
+ l ? (n.push({
1889
+ index: t,
1890
+ value: l[0]
1891
+ }), o = i.lastIndex) : o = t + 2;
1892
+ }
1893
+ return n;
1894
+ }
1895
+ let n = [], r = 0, i = K(e, t, "value", r, 1)[0], a = K(e, t, "logic", r, 1)[0];
1896
+ for (; i || a;) {
1897
+ let o = !a || i && i.index <= a.index ? i : a;
1898
+ n.push(o), r = o.index + o.value.length, (o === i || i && i.index < r) && (i = K(e, t, "value", r, 1)[0]), (o === a || a && a.index < r) && (a = K(e, t, "logic", r, 1)[0]);
1899
+ }
1900
+ return n;
1901
+ }
1902
+ function bn(e) {
1903
+ return typeof e == "string" && e.trim() !== "" ? e : null;
1904
+ }
1905
+ function xn(e) {
1906
+ return Object.values(G).find((t) => t.value.source === e.value.source) ?? null;
1907
+ }
1908
+ function Sn(e) {
1909
+ return bn(e.opener) ?? xn(e)?.opener ?? null;
1910
+ }
1911
+ function Cn(e) {
1912
+ return bn(e.closer) ?? xn(e)?.closer ?? null;
1913
+ }
1914
+ function wn(e) {
1915
+ return e ? typeof e == "string" ? G[e] ?? G.liquid : e : G.liquid;
1916
+ }
1917
+ function Tn(e) {
1918
+ let t = e.source, n = e.flags.replace("g", "");
1919
+ return RegExp(`^${t}$`, n);
1920
+ }
1921
+ function En(e, t) {
1922
+ let n = e?.trim() || "";
1923
+ return !Tn(t.logic).test(n) && Tn(t.value).test(n);
1924
+ }
1925
+ function Dn(e, t) {
1926
+ let n = t.find((t) => t.value === e);
1927
+ return n ? n.label : e;
1928
+ }
1929
+ function On(e, t) {
1930
+ return Rn(e, "data-merge-tag", (e) => Dn(e, t));
1931
+ }
1932
+ function kn(e, t) {
1933
+ return t.find((t) => t.value === e)?.sample;
1934
+ }
1935
+ function An(e, t) {
1936
+ return Rn(e, "data-merge-tag", (e) => Nn(kn(e, t) ?? Dn(e, t)), { unwrap: (e) => kn(e, t) !== void 0 });
1937
+ }
1938
+ function jn(e) {
1939
+ return e.some((e) => e.sample !== void 0);
1940
+ }
1941
+ function Mn(e, t) {
1942
+ if (!e) return e;
1943
+ let n = e;
1944
+ for (let e of t) e.sample !== void 0 && (n = n.split(e.value).join(e.sample));
1945
+ return n;
1946
+ }
1947
+ function Nn(e) {
1948
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
1949
+ }
1950
+ function Pn(e, t) {
1951
+ if (!e) return !1;
1952
+ if (Object.values(G).includes(t)) return K(e, t, "value", 0, 1).length > 0 || K(e, t, "logic", 0, 1).length > 0;
1953
+ let n = new RegExp(t.value.source, t.value.flags), r = new RegExp(t.logic.source, t.logic.flags);
1954
+ return n.test(e) || r.test(e);
1955
+ }
1956
+ function Fn(e, t) {
1957
+ return Tn(t.logic).test(e?.trim() || "");
1958
+ }
1959
+ function In(e, t) {
1960
+ let n = new RegExp(t.logic.source, t.logic.flags.replace("g", "")), r = e.match(n);
1961
+ return r && r[1] ? r[1].toUpperCase() : e;
1721
1962
  }
1722
- var gn = {
1963
+ function Ln(e, t) {
1964
+ return Rn(e, "data-logic-merge-tag", (e) => In(e, t));
1965
+ }
1966
+ function Rn(e, t, n, r) {
1967
+ let i = "", a = 0;
1968
+ for (; a < e.length;) {
1969
+ let o = e.indexOf("<span", a);
1970
+ if (o === -1) {
1971
+ i += e.substring(a);
1972
+ break;
1973
+ }
1974
+ let s = e[o + 5];
1975
+ if (s !== ">" && s !== " " && s !== " " && s !== "\n" && s !== "\r" && s !== "/") {
1976
+ i += e.substring(a, o + 5), a = o + 5;
1977
+ continue;
1978
+ }
1979
+ let { end: c, nextSpan: l } = ln(e, o + 5);
1980
+ if (l !== -1) {
1981
+ i += e.substring(a, l), a = l;
1982
+ continue;
1983
+ }
1984
+ if (c === -1) {
1985
+ i += e.substring(a);
1986
+ break;
1987
+ }
1988
+ let u = fn(e.substring(o + 5, c), t);
1989
+ if (u === null) {
1990
+ i += e.substring(a, c + 1), a = c + 1;
1991
+ continue;
1992
+ }
1993
+ let d = e.indexOf("</span>", c + 1);
1994
+ if (d === -1) {
1995
+ i += e.substring(a);
1996
+ break;
1997
+ }
1998
+ let f = n(u);
1999
+ r?.unwrap?.(u) ? (i += e.substring(a, o), i += f) : (i += e.substring(a, c + 1), i += f, i += "</span>"), a = d + 7;
2000
+ }
2001
+ return i;
2002
+ }
2003
+ var zn = {
1723
2004
  title: ["content"],
1724
2005
  paragraph: ["content"]
1725
2006
  };
1726
- function _n(e) {
2007
+ function Bn(e) {
1727
2008
  let t = [], n = /<[a-z][\w:-]*\b/gi;
1728
2009
  for (; n.exec(e);) {
1729
- let r = U(e, n.lastIndex);
2010
+ let r = H(e, n.lastIndex);
1730
2011
  if (r < 0) break;
1731
2012
  let i = n.lastIndex, a = e.slice(i, r), o = /[^\s"'<>/=]+\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+))/g;
1732
2013
  for (let e; e = o.exec(a);) {
@@ -1740,42 +2021,46 @@ function _n(e) {
1740
2021
  }
1741
2022
  return t;
1742
2023
  }
1743
- function vn(e, t, n) {
1744
- let r = n === "html" ? fn(e) : [], i = n === "html" ? _n(e) : [], a = r.map((e) => ({
2024
+ function Vn(e, t, n) {
2025
+ let r = n === "html" ? mn(e) : [], i = n === "html" ? Bn(e) : [], a = r.map((e) => ({
1745
2026
  ...e,
1746
2027
  attribute: !1
1747
- })), o = (n, r) => {
1748
- let o = e.slice(n, r), s = [t.logic, t.value].map((e) => new RegExp(e.source, e.flags.replace(/[gy]/g, "") + "g")), c = 0;
1749
- for (; c < o.length;) {
1750
- let e = s.flatMap((e) => {
1751
- e.lastIndex = c;
1752
- let t = e.exec(o);
1753
- for (; t && t[0].length === 0;) e.lastIndex = t.index + 1, t = e.exec(o);
1754
- return t ? [t] : [];
2028
+ })), o = 0, s = (n, r) => {
2029
+ let s = e.slice(n, r), c = Object.values(G).includes(t), l = ["logic", "value"], u = c ? l.map((e) => K(s, t, e, 0, 1)[0]) : null, d = c ? null : [t.logic, t.value].map((e) => new RegExp(e.source, e.flags.replace(/[gy]/g, "") + "g")), f = 0;
2030
+ for (; f < s.length;) {
2031
+ let e = c ? u.flatMap((e) => e ? [e] : []) : d.flatMap((e) => {
2032
+ e.lastIndex = f;
2033
+ let t = e.exec(s);
2034
+ for (; t && t[0].length === 0;) e.lastIndex = t.index + 1, t = e.exec(s);
2035
+ return t ? [{
2036
+ index: t.index,
2037
+ value: t[0]
2038
+ }] : [];
1755
2039
  });
1756
- e.sort((e, t) => e.index - t.index || e[0].length - t[0].length);
1757
- let t = e[0];
1758
- if (!t) break;
1759
- let r = n + t.index, l = r + t[0].length;
1760
- a.push({
1761
- start: r,
1762
- end: l,
1763
- markup: t[0],
1764
- attribute: i.some((e) => r >= e.start && l <= e.end)
1765
- }), c = t.index + t[0].length;
2040
+ e.sort((e, t) => e.index - t.index || e.value.length - t.value.length);
2041
+ let r = e[0];
2042
+ if (!r) break;
2043
+ let p = n + r.index, m = p + r.value.length;
2044
+ for (; i[o]?.end <= p;) o++;
2045
+ if (a.push({
2046
+ start: p,
2047
+ end: m,
2048
+ markup: r.value,
2049
+ attribute: i[o] !== void 0 && p >= i[o].start && m <= i[o].end
2050
+ }), f = r.index + r.value.length, c) for (let e = 0; e < l.length; e++) u[e] && u[e].index < f && (u[e] = K(s, t, l[e], f, 1)[0]);
1766
2051
  }
1767
- }, s = 0;
1768
- for (let e of r) o(s, e.start), s = e.end;
1769
- return o(s, e.length), a.sort((e, t) => e.start - t.start);
2052
+ }, c = 0;
2053
+ for (let e of r) s(c, e.start), c = e.end;
2054
+ return s(c, e.length), a.sort((e, t) => e.start - t.start);
1770
2055
  }
1771
- function yn(e) {
2056
+ function Hn(e) {
1772
2057
  if (!e.includes("&")) return { text: e };
1773
2058
  let t = "", n = [0], r = 0, i = (i) => {
1774
2059
  for (t += e.slice(r, i); r < i;) n.push(++r);
1775
2060
  };
1776
2061
  for (let a of e.matchAll(/&(?:#[0-9]+|#[xX][0-9a-fA-F]+|[a-zA-Z][a-zA-Z0-9]*);/g)) {
1777
2062
  i(a.index);
1778
- let e = G(a[0]);
2063
+ let e = W(a[0]);
1779
2064
  t += e;
1780
2065
  for (let t = 1; t < e.length; t++) n.push(-1);
1781
2066
  r = a.index + a[0].length, n.push(r);
@@ -1785,17 +2070,17 @@ function yn(e) {
1785
2070
  offsets: n
1786
2071
  };
1787
2072
  }
1788
- var K = /* @__PURE__ */ new Map(), bn = 32;
1789
- function xn(e) {
1790
- let t = JSON.stringify(e), n = K.get(t);
2073
+ var q = /* @__PURE__ */ new Map(), Un = 32;
2074
+ function Wn(e) {
2075
+ let t = JSON.stringify(e), n = q.get(t);
1791
2076
  if (n === void 0) {
1792
2077
  let r = e.map((e) => e.trim()).filter(Boolean).sort((e, t) => t.length - e.length).map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
1793
- n = r.length ? RegExp(`(?<![\\p{L}\\p{N}_])(?:${r.join("|")})(?![\\p{L}\\p{N}_])`, "gu") : null, K.size >= bn && K.delete(K.keys().next().value), K.set(t, n);
2078
+ n = r.length ? RegExp(`(?<![\\p{L}\\p{N}_])(?:${r.join("|")})(?![\\p{L}\\p{N}_])`, "gu") : null, q.size >= Un && q.delete(q.keys().next().value), q.set(t, n);
1794
2079
  }
1795
2080
  return n;
1796
2081
  }
1797
- function Sn(e, t, n) {
1798
- let r = n.length ? xn(n) : null;
2082
+ function Gn(e, t, n) {
2083
+ let r = n.length ? Wn(n) : null;
1799
2084
  if (!r) return [];
1800
2085
  let i = [];
1801
2086
  if (t === "text") i.push({
@@ -1804,7 +2089,7 @@ function Sn(e, t, n) {
1804
2089
  attribute: !1
1805
2090
  });
1806
2091
  else {
1807
- i.push(..._n(e).map((e) => ({
2092
+ i.push(...Bn(e).map((e) => ({
1808
2093
  ...e,
1809
2094
  attribute: !0
1810
2095
  })));
@@ -1815,7 +2100,7 @@ function Sn(e, t, n) {
1815
2100
  end: r.index,
1816
2101
  attribute: !1
1817
2102
  });
1818
- let a = r[0] === "<!--" ? e.indexOf("-->", t.lastIndex) : U(e, t.lastIndex);
2103
+ let a = r[0] === "<!--" ? e.indexOf("-->", t.lastIndex) : H(e, t.lastIndex);
1819
2104
  if (a < 0) return [];
1820
2105
  n = a + (r[0] === "<!--" ? 3 : 1), t.lastIndex = n;
1821
2106
  }
@@ -1828,7 +2113,7 @@ function Sn(e, t, n) {
1828
2113
  let a = [];
1829
2114
  for (let n of i) {
1830
2115
  r.lastIndex = 0;
1831
- let i = e.slice(n.start, n.end), o = t === "html" ? yn(i) : {
2116
+ let i = e.slice(n.start, n.end), o = t === "html" ? Hn(i) : {
1832
2117
  text: i,
1833
2118
  offsets: void 0
1834
2119
  };
@@ -1847,53 +2132,53 @@ function Sn(e, t, n) {
1847
2132
  }
1848
2133
  return a;
1849
2134
  }
1850
- function Cn(e, t, n, r) {
1851
- let i = vn(e, t, n), a = Sn(e, n, r?.doNotTranslate ?? []).filter((e) => !i.some((t) => e.start < t.end && e.end > t.start));
2135
+ function Kn(e, t, n, r) {
2136
+ let i = Vn(e, t, n), a = Gn(e, n, r?.doNotTranslate ?? []).filter((e) => !i.some((t) => e.start < t.end && e.end > t.start));
1852
2137
  return [...i, ...a].sort((e, t) => e.start - t.start);
1853
2138
  }
1854
- function wn(e, t, n) {
2139
+ function qn(e, t, n) {
1855
2140
  let r = "", i = 0;
1856
2141
  return t.forEach((t, a) => {
1857
2142
  r += e.slice(i, t.start), r += t.attribute ? `__x${n[a]}__` : `<x id="${n[a]}"/>`, i = t.end;
1858
2143
  }), r + e.slice(i);
1859
2144
  }
1860
- function Tn(e, t, n, r) {
1861
- let i = Cn(e, t, n, r);
2145
+ function Jn(e, t, n, r) {
2146
+ let i = Kn(e, t, n, r);
1862
2147
  return {
1863
- text: wn(e, i, i.map((e, t) => t + 1)),
2148
+ text: qn(e, i, i.map((e, t) => t + 1)),
1864
2149
  tokens: i.map((e) => e.markup)
1865
2150
  };
1866
2151
  }
1867
- function En(e, t) {
2152
+ function Yn(e, t) {
1868
2153
  let n = /* @__PURE__ */ new Set(), r = !0, i = e.replace(/<x id="(\d+)"\s*\/>|<x id="(\d+)"><\/x>|__x(\d+)__/g, (e, i, a, o) => {
1869
2154
  let s = Number(i ?? a ?? o);
1870
2155
  return (s < 1 || s > t.length || n.has(s)) && (r = !1), n.add(s), t[s - 1] ?? "";
1871
2156
  });
1872
2157
  return r && n.size === t.length ? i : null;
1873
2158
  }
1874
- function Dn(e, t, n, r, i) {
1875
- let a = Cn(e, n, r, i), o = /* @__PURE__ */ new Set(), s = (e) => {
2159
+ function Xn(e, t, n, r, i) {
2160
+ let a = Kn(e, n, r, i), o = /* @__PURE__ */ new Set(), s = (e) => {
1876
2161
  let n = t.findIndex((t, n) => !o.has(n) && e(t));
1877
2162
  return n >= 0 && o.add(n), n;
1878
2163
  }, c = a.map((e) => s((t) => t === e.markup));
1879
2164
  return a.forEach((e, t) => {
1880
- c[t] < 0 && e.term !== void 0 && r === "html" && (c[t] = s((t) => G(t) === e.term));
1881
- }), o.size !== t.length || a.some((e, t) => c[t] < 0 && e.term === void 0) ? null : wn(e, a.filter((e, t) => c[t] >= 0), c.filter((e) => e >= 0).map((e) => e + 1));
2165
+ c[t] < 0 && e.term !== void 0 && r === "html" && (c[t] = s((t) => W(t) === e.term));
2166
+ }), o.size !== t.length || a.some((e, t) => c[t] < 0 && e.term === void 0) ? null : qn(e, a.filter((e, t) => c[t] >= 0), c.filter((e) => e >= 0).map((e) => e + 1));
1882
2167
  }
1883
- function On(e, t, n = []) {
2168
+ function Zn(e, t, n = []) {
1884
2169
  let r = /* @__PURE__ */ new Map();
1885
- if (t === T(e) || !e.settings.locales?.includes(t)) return r;
2170
+ if (t === E(e) || !e.settings.locales?.includes(t)) return r;
1886
2171
  let i = (e, n, i, a) => {
1887
2172
  let o = n.l10n?.[t];
1888
2173
  for (let t of i) {
1889
- let i = v(n, t);
2174
+ let i = b(n, t);
1890
2175
  if (typeof i != "string" || i === "" || Object.keys(o?.set ?? {}).some((e) => e === t || t.startsWith(`${e}.`))) continue;
1891
2176
  let s = e.kind === "block" ? e.blockId : "settings";
1892
2177
  r.set(`${s}/${t}`, {
1893
2178
  target: e,
1894
2179
  path: t,
1895
2180
  source: i,
1896
- format: a && gn[a]?.includes(t) ? "html" : "text",
2181
+ format: a && zn[a]?.includes(t) ? "html" : "text",
1897
2182
  text: o?.text?.[t]
1898
2183
  });
1899
2184
  }
@@ -1902,22 +2187,22 @@ function On(e, t, n = []) {
1902
2187
  if (r.type !== "html" && i({
1903
2188
  kind: "block",
1904
2189
  blockId: r.id
1905
- }, r, x(r, n), r.type), r.type === "section") for (let e of r.children) a(e);
2190
+ }, r, C(r, n), r.type), r.type === "section") for (let e of r.children) a(e);
1906
2191
  else r.type === "wrapper" && a(r.children);
1907
2192
  }
1908
2193
  };
1909
- return a(e.blocks), i({ kind: "settings" }, e.settings, h), r;
2194
+ return a(e.blocks), i({ kind: "settings" }, e.settings, _), r;
1910
2195
  }
1911
- function kn(e, t, n) {
1912
- let r = n.only === "all" ? null : ke(e, t, n.definitions), i = r && /* @__PURE__ */ new Set([...r.missing, ...r.stale]), a = [], o = {};
1913
- for (let [r, s] of On(e, t, n.definitions)) {
2196
+ function Qn(e, t, n) {
2197
+ let r = n.only === "all" ? null : Oe(e, t, n.definitions), i = r && /* @__PURE__ */ new Set([...r.missing, ...r.stale]), a = [], o = {};
2198
+ for (let [r, s] of Zn(e, t, n.definitions)) {
1914
2199
  if (i && !i.has(r) || n.blockId !== void 0 && (s.target.kind !== "block" || s.target.blockId !== n.blockId)) continue;
1915
- let e = Tn(s.source, n.syntax, s.format, n), t = s.text ? Dn(s.text.value, e.tokens, n.syntax, s.format, n) : void 0;
2200
+ let e = Jn(s.source, n.syntax, s.format, n), t = s.text ? Xn(s.text.value, e.tokens, n.syntax, s.format, n) : void 0;
1916
2201
  a.push({
1917
2202
  id: r,
1918
2203
  format: s.format,
1919
2204
  source: e.text,
1920
- sourceHash: C(s.source),
2205
+ sourceHash: w(s.source),
1921
2206
  ...t == null ? {} : { text: t }
1922
2207
  }), o[r] = e.tokens;
1923
2208
  }
@@ -1926,8 +2211,8 @@ function kn(e, t, n) {
1926
2211
  tokens: o
1927
2212
  };
1928
2213
  }
1929
- function An(e, t, n, r) {
1930
- let i = On(e, t, r.definitions), a = /* @__PURE__ */ new Map(), o = (e) => {
2214
+ function $n(e, t, n, r) {
2215
+ let i = Zn(e, t, r.definitions), a = /* @__PURE__ */ new Map(), o = (e) => {
1931
2216
  for (let t of e) if (a.set(t.id, t), t.type === "section") for (let e of t.children) o(e);
1932
2217
  else t.type === "wrapper" && o(t.children);
1933
2218
  };
@@ -1939,12 +2224,12 @@ function An(e, t, n, r) {
1939
2224
  let n = t.id.lastIndexOf("/"), r = t.id.slice(0, n), i = r === "settings" ? [a.get(r), e.settings] : [a.get(r)];
1940
2225
  l.push({
1941
2226
  id: t.id,
1942
- reason: n < 0 || !i.some((e) => e && v(e, t.id.slice(n + 1)) !== void 0) ? "unknown_field" : "not_translatable"
2227
+ reason: n < 0 || !i.some((e) => e && b(e, t.id.slice(n + 1)) !== void 0) ? "unknown_field" : "not_translatable"
1943
2228
  });
1944
2229
  continue;
1945
2230
  }
1946
- let o = Object.hasOwn(r.tokens, t.id) ? r.tokens[t.id] : void 0, u = o ? En(t.text, o) : null;
1947
- if (!o || u === null || Dn(u, o, r.syntax, n.format, r) === null) {
2231
+ let o = Object.hasOwn(r.tokens, t.id) ? r.tokens[t.id] : void 0, u = o ? Yn(t.text, o) : null;
2232
+ if (!o || u === null || Xn(u, o, r.syntax, n.format, r) === null) {
1948
2233
  l.push({
1949
2234
  id: t.id,
1950
2235
  reason: "tags_changed"
@@ -1973,7 +2258,7 @@ function An(e, t, n, r) {
1973
2258
  rejected: l
1974
2259
  };
1975
2260
  }
1976
- function jn(e) {
2261
+ function er(e) {
1977
2262
  return new e.Liquid({
1978
2263
  strictVariables: !1,
1979
2264
  strictFilters: !1,
@@ -1981,17 +2266,17 @@ function jn(e) {
1981
2266
  templates: {}
1982
2267
  });
1983
2268
  }
1984
- function q(e, t) {
1985
- let n = p(e);
1986
- return !t || Object.keys(t).length === 0 ? n : en(n, t);
2269
+ function J(e, t) {
2270
+ let n = h(e);
2271
+ return !t || Object.keys(t).length === 0 ? n : tn(n, t);
1987
2272
  }
1988
- function J(e) {
1989
- return e === void 0 ? void 0 : p(e);
2273
+ function Y(e) {
2274
+ return e === void 0 ? void 0 : h(e);
1990
2275
  }
1991
- function Y() {
2276
+ function X() {
1992
2277
  return crypto.randomUUID();
1993
2278
  }
1994
- function Mn(e = 0) {
2279
+ function tr(e = 0) {
1995
2280
  return {
1996
2281
  top: e,
1997
2282
  right: e,
@@ -1999,135 +2284,135 @@ function Mn(e = 0) {
1999
2284
  left: e
2000
2285
  };
2001
2286
  }
2002
- function X(e = 10) {
2003
- return { padding: Mn(e) };
2287
+ function Z(e = 10) {
2288
+ return { padding: tr(e) };
2004
2289
  }
2005
- function Nn(e = {}) {
2006
- return q({
2007
- id: Y(),
2290
+ function nr(e = {}) {
2291
+ return J({
2292
+ id: X(),
2008
2293
  type: "title",
2009
- ...Rt,
2010
- styles: X()
2294
+ ...zt,
2295
+ styles: Z()
2011
2296
  }, e);
2012
2297
  }
2013
- function Pn(e = {}) {
2014
- return q({
2015
- id: Y(),
2298
+ function rr(e = {}) {
2299
+ return J({
2300
+ id: X(),
2016
2301
  type: "paragraph",
2017
- ...zt,
2018
- styles: X()
2302
+ ...Bt,
2303
+ styles: Z()
2019
2304
  }, e);
2020
2305
  }
2021
- function Fn(e = {}) {
2022
- return q({
2023
- id: Y(),
2306
+ function ir(e = {}) {
2307
+ return J({
2308
+ id: X(),
2024
2309
  type: "image",
2025
- ...Bt,
2026
- styles: X()
2310
+ ...Vt,
2311
+ styles: Z()
2027
2312
  }, e);
2028
2313
  }
2029
- function In(e = {}) {
2030
- return q({
2031
- id: Y(),
2314
+ function ar(e = {}) {
2315
+ return J({
2316
+ id: X(),
2032
2317
  type: "button",
2033
- ...Vt,
2034
- styles: X()
2318
+ ...Ht,
2319
+ styles: Z()
2035
2320
  }, e);
2036
2321
  }
2037
- function Ln(e = {}) {
2038
- return q({
2039
- id: Y(),
2322
+ function or(e = {}) {
2323
+ return J({
2324
+ id: X(),
2040
2325
  type: "divider",
2041
- ...Ht,
2042
- styles: X(20)
2326
+ ...Ut,
2327
+ styles: Z(20)
2043
2328
  }, e);
2044
2329
  }
2045
- function Rn(e = {}) {
2046
- return q({
2047
- id: Y(),
2330
+ function sr(e = {}) {
2331
+ return J({
2332
+ id: X(),
2048
2333
  type: "section",
2049
- ...Ut,
2334
+ ...Wt,
2050
2335
  children: [[]],
2051
- styles: X(20)
2336
+ styles: Z(20)
2052
2337
  }, e);
2053
2338
  }
2054
- function zn(e = {}) {
2055
- return q({
2056
- id: Y(),
2339
+ function cr(e = {}) {
2340
+ return J({
2341
+ id: X(),
2057
2342
  type: "video",
2058
- ...Wt,
2059
- styles: X()
2343
+ ...Gt,
2344
+ styles: Z()
2060
2345
  }, e);
2061
2346
  }
2062
- function Bn(e = {}) {
2063
- return q({
2064
- id: Y(),
2347
+ function lr(e = {}) {
2348
+ return J({
2349
+ id: X(),
2065
2350
  type: "social",
2066
2351
  icons: [],
2067
- ...Gt,
2068
- styles: X()
2352
+ ...Kt,
2353
+ styles: Z()
2069
2354
  }, e);
2070
2355
  }
2071
- function Vn(e = {}) {
2072
- return q({
2073
- id: Y(),
2356
+ function ur(e = {}) {
2357
+ return J({
2358
+ id: X(),
2074
2359
  type: "spacer",
2075
- ...Kt,
2076
- styles: X(0)
2360
+ ...qt,
2361
+ styles: Z(0)
2077
2362
  }, e);
2078
2363
  }
2079
- function Hn(e = {}) {
2080
- return q({
2081
- id: Y(),
2364
+ function dr(e = {}) {
2365
+ return J({
2366
+ id: X(),
2082
2367
  type: "html",
2083
- ...qt,
2084
- styles: X()
2368
+ ...Jt,
2369
+ styles: Z()
2085
2370
  }, e);
2086
2371
  }
2087
- function Un(e = {}) {
2088
- return q({
2089
- id: Y(),
2372
+ function fr(e = {}) {
2373
+ return J({
2374
+ id: X(),
2090
2375
  type: "menu",
2091
2376
  items: [],
2092
- ...Jt,
2093
- styles: X()
2377
+ ...Yt,
2378
+ styles: Z()
2094
2379
  }, e);
2095
2380
  }
2096
- function Wn(e, t) {
2381
+ function pr(e, t) {
2097
2382
  return Array.from({ length: t }, () => ({
2098
- id: Y(),
2383
+ id: X(),
2099
2384
  cells: Array.from({ length: e }, () => ({
2100
- id: Y(),
2385
+ id: X(),
2101
2386
  content: ""
2102
2387
  }))
2103
2388
  }));
2104
2389
  }
2105
- function Gn(e = {}) {
2106
- return q({
2107
- id: Y(),
2390
+ function mr(e = {}) {
2391
+ return J({
2392
+ id: X(),
2108
2393
  type: "table",
2109
- rows: Wn(3, 3),
2110
- ...Yt,
2111
- styles: X()
2394
+ rows: pr(3, 3),
2395
+ ...Xt,
2396
+ styles: Z()
2112
2397
  }, e);
2113
2398
  }
2114
- function Kn(e = {}) {
2115
- return q({
2116
- id: Y(),
2399
+ function hr(e = {}) {
2400
+ return J({
2401
+ id: X(),
2117
2402
  type: "countdown",
2118
- ...Xt,
2119
- styles: X()
2403
+ ...Zt,
2404
+ styles: Z()
2120
2405
  }, e);
2121
2406
  }
2122
- function qn(e) {
2407
+ function gr(e) {
2123
2408
  return e.type === "repeatable" ? e.default ?? [] : e.type === "boolean" ? e.default ?? !1 : e.type === "number" ? e.default ?? 0 : e.default ?? "";
2124
2409
  }
2125
- function Jn(e) {
2410
+ function _r(e) {
2126
2411
  let t = {};
2127
- for (let n of e.fields) t[n.key] = J(qn(n));
2128
- let n = q(X(), J(e.defaultStyles));
2412
+ for (let n of e.fields) t[n.key] = Y(gr(n));
2413
+ let n = J(Z(), Y(e.defaultStyles));
2129
2414
  return {
2130
- id: Y(),
2415
+ id: X(),
2131
2416
  type: "custom",
2132
2417
  customType: e.type,
2133
2418
  fieldValues: t,
@@ -2135,42 +2420,42 @@ function Jn(e) {
2135
2420
  ...e.dataSource ? { dataSourceFetched: !1 } : {}
2136
2421
  };
2137
2422
  }
2138
- function Yn() {
2423
+ function vr() {
2139
2424
  return {
2140
- id: Y(),
2425
+ id: X(),
2141
2426
  type: "slot",
2142
- styles: X(0)
2427
+ styles: Z(0)
2143
2428
  };
2144
2429
  }
2145
- function Xn(e = {}) {
2146
- return q({
2147
- id: Y(),
2430
+ function yr(e = {}) {
2431
+ return J({
2432
+ id: X(),
2148
2433
  type: "wrapper",
2149
2434
  children: [],
2150
- styles: X(0)
2435
+ styles: Z(0)
2151
2436
  }, e);
2152
2437
  }
2153
- function Zn(e, t) {
2438
+ function br(e, t) {
2154
2439
  switch (e) {
2155
- case "section": return Rn(J(t?.section));
2156
- case "title": return Nn(J(t?.title));
2157
- case "paragraph": return Pn(J(t?.paragraph));
2158
- case "image": return Fn(J(t?.image));
2159
- case "button": return In(J(t?.button));
2160
- case "divider": return Ln(J(t?.divider));
2161
- case "video": return zn(J(t?.video));
2162
- case "social": return Bn(J(t?.social));
2163
- case "spacer": return Vn(J(t?.spacer));
2164
- case "html": return Hn(J(t?.html));
2165
- case "menu": return Un(J(t?.menu));
2166
- case "table": return Gn(J(t?.table));
2167
- case "countdown": return Kn(J(t?.countdown));
2440
+ case "section": return sr(Y(t?.section));
2441
+ case "title": return nr(Y(t?.title));
2442
+ case "paragraph": return rr(Y(t?.paragraph));
2443
+ case "image": return ir(Y(t?.image));
2444
+ case "button": return ar(Y(t?.button));
2445
+ case "divider": return or(Y(t?.divider));
2446
+ case "video": return cr(Y(t?.video));
2447
+ case "social": return lr(Y(t?.social));
2448
+ case "spacer": return ur(Y(t?.spacer));
2449
+ case "html": return dr(Y(t?.html));
2450
+ case "menu": return fr(Y(t?.menu));
2451
+ case "table": return mr(Y(t?.table));
2452
+ case "countdown": return hr(Y(t?.countdown));
2168
2453
  case "slot": throw Error("[Templatical] slot cannot be inserted into content. Use createSlotBlock() to build a layout.");
2169
2454
  case "wrapper": throw Error("[Templatical] wrapper cannot be inserted into content. Use createWrapperBlock() to build a layout.");
2170
2455
  default: throw Error(`Unknown block type: ${e}`);
2171
2456
  }
2172
2457
  }
2173
- function Qn(e, t) {
2458
+ function xr(e, t) {
2174
2459
  let n = e.l10n;
2175
2460
  if (!n || t.size === 0) return;
2176
2461
  let r = (n) => {
@@ -2185,12 +2470,12 @@ function Qn(e, t) {
2185
2470
  n && (e[t] = Object.fromEntries(Object.entries(n).map(([e, t]) => [r(e), t])));
2186
2471
  }
2187
2472
  }
2188
- function Z(e) {
2473
+ function Q(e) {
2189
2474
  let t = JSON.parse(JSON.stringify(e));
2190
- t.id = Y();
2475
+ t.id = X();
2191
2476
  let n = /* @__PURE__ */ new Map(), r = (e, t) => {
2192
2477
  let r = e.id;
2193
- e.id = Y();
2478
+ e.id = X();
2194
2479
  let i = n.get(t);
2195
2480
  return i || (i = /* @__PURE__ */ new Map(), n.set(t, i)), i.set(r, e.id), r;
2196
2481
  };
@@ -2200,84 +2485,84 @@ function Z(e) {
2200
2485
  }
2201
2486
  if (t.type === "menu") for (let e of t.items) r(e, "items");
2202
2487
  if (t.type === "social") for (let e of t.icons) r(e, "icons");
2203
- return t.type === "section" && (t.children = t.children.map((e) => e.map((e) => Z(e)))), t.type === "wrapper" && (t.children = t.children.map((e) => Z(e))), Qn(t, n), t;
2488
+ return t.type === "section" && (t.children = t.children.map((e) => e.map((e) => Q(e)))), t.type === "wrapper" && (t.children = t.children.map((e) => Q(e))), xr(t, n), t;
2204
2489
  }
2205
- var $n = "[Templatical] layout: must contain exactly one slot block", er = "[Templatical] layout: slot must be a top-level or wrapper child, not nested in a section", tr = "[Templatical] layout: a wrapper cannot contain a wrapper", nr = "[Templatical] layout: a wrapper around the slot cannot contain blocks that emit mj-wrapper (section.wrapper)", rr = "[Templatical] slot is not a valid content block", ir = "[Templatical] wrapper is not a valid content block";
2206
- function Q(e, t, n = null, r = !1) {
2207
- for (let i of e) if (t(i, n, r), It(i)) for (let e of i.children) Q(e, t, i, !0);
2208
- else H(i) && Q(i.children, t, i, r);
2490
+ var Sr = "[Templatical] layout: must contain exactly one slot block", Cr = "[Templatical] layout: slot must be a top-level or wrapper child, not nested in a section", wr = "[Templatical] layout: a wrapper cannot contain a wrapper", Tr = "[Templatical] layout: a wrapper around the slot cannot contain blocks that emit mj-wrapper (section.wrapper)", Er = "[Templatical] slot is not a valid content block", Dr = "[Templatical] wrapper is not a valid content block";
2491
+ function $(e, t, n = null, r = !1) {
2492
+ for (let i of e) if (t(i, n, r), Lt(i)) for (let e of i.children) $(e, t, i, !0);
2493
+ else V(i) && $(i.children, t, i, r);
2209
2494
  }
2210
- function ar(e) {
2495
+ function Or(e) {
2211
2496
  let t = 0;
2212
- if (Q(e.blocks, (e, n, r) => {
2213
- if (V(e) && (t += 1, r)) throw Error(er);
2214
- if (H(e)) {
2215
- if (r) throw Error(er);
2216
- if (e.children.some(H)) throw Error(tr);
2497
+ if ($(e.blocks, (e, n, r) => {
2498
+ if (B(e) && (t += 1, r)) throw Error(Cr);
2499
+ if (V(e)) {
2500
+ if (r) throw Error(Cr);
2501
+ if (e.children.some(V)) throw Error(wr);
2217
2502
  }
2218
- }), t !== 1) throw Error($n);
2503
+ }), t !== 1) throw Error(Sr);
2219
2504
  }
2220
- function or(e) {
2221
- Q(e.blocks, (e) => {
2222
- if (V(e)) throw Error(rr);
2505
+ function kr(e) {
2506
+ $(e.blocks, (e) => {
2507
+ if (B(e)) throw Error(Er);
2223
2508
  });
2224
2509
  }
2225
- function sr(e) {
2226
- Q(e.blocks, (e) => {
2227
- if (H(e)) throw Error(ir);
2510
+ function Ar(e) {
2511
+ $(e.blocks, (e) => {
2512
+ if (V(e)) throw Error(Dr);
2228
2513
  });
2229
2514
  }
2230
- function cr(e) {
2515
+ function jr(e) {
2231
2516
  let t = !1;
2232
- return Q(e.blocks, (e, n) => {
2233
- V(e) && n !== null && H(n) && (t = !0);
2517
+ return $(e.blocks, (e, n) => {
2518
+ B(e) && n !== null && V(n) && (t = !0);
2234
2519
  }), t;
2235
2520
  }
2236
- function lr(e) {
2237
- if (V(e)) return e;
2238
- if (H(e)) {
2239
- let t = Z({
2521
+ function Mr(e) {
2522
+ if (B(e)) return e;
2523
+ if (V(e)) {
2524
+ let t = Q({
2240
2525
  ...e,
2241
2526
  children: []
2242
2527
  });
2243
- return t.children = e.children.map(lr), t;
2528
+ return t.children = e.children.map(Mr), t;
2244
2529
  }
2245
- return Z(e);
2530
+ return Q(e);
2246
2531
  }
2247
- function ur(e) {
2532
+ function Nr(e) {
2248
2533
  for (let t = 0; t < e.length; t++) {
2249
2534
  let n = e[t];
2250
- if (V(n)) return {
2535
+ if (B(n)) return {
2251
2536
  parent: e,
2252
2537
  index: t
2253
2538
  };
2254
- if (H(n)) {
2255
- let e = ur(n.children);
2539
+ if (V(n)) {
2540
+ let e = Nr(n.children);
2256
2541
  if (e) return e;
2257
2542
  }
2258
2543
  }
2259
2544
  return null;
2260
2545
  }
2261
- function dr(e) {
2262
- for (let t of e) if (It(t)) {
2546
+ function Pr(e) {
2547
+ for (let t of e) if (Lt(t)) {
2263
2548
  if (t.wrapper) return !0;
2264
- for (let e of t.children) if (dr(e)) return !0;
2549
+ for (let e of t.children) if (Pr(e)) return !0;
2265
2550
  }
2266
2551
  return !1;
2267
2552
  }
2268
- function fr(e, t) {
2269
- if (ar(e), or(t), sr(t), cr(e) && dr(t.blocks)) throw Error(nr);
2270
- let n = e.blocks.map(lr), r = ur(n);
2271
- if (!r) throw Error($n);
2272
- return r.parent.splice(r.index, 1, ...p(t.blocks)), {
2553
+ function Fr(e, t) {
2554
+ if (Or(e), kr(t), Ar(t), jr(e) && Pr(t.blocks)) throw Error(Tr);
2555
+ let n = e.blocks.map(Mr), r = Nr(n);
2556
+ if (!r) throw Error(Sr);
2557
+ return r.parent.splice(r.index, 1, ...h(t.blocks)), {
2273
2558
  blocks: n,
2274
2559
  settings: {
2275
- ...p(t.settings),
2560
+ ...h(t.settings),
2276
2561
  backgroundColor: e.settings.backgroundColor
2277
2562
  }
2278
2563
  };
2279
2564
  }
2280
- var pr = Object.freeze([
2565
+ var Ir = Object.freeze([
2281
2566
  "http",
2282
2567
  "https",
2283
2568
  "mailto",
@@ -2293,37 +2578,37 @@ Object.freeze([
2293
2578
  "data",
2294
2579
  "vbscript"
2295
2580
  ]);
2296
- function mr(e) {
2581
+ function Lr(e) {
2297
2582
  return e.replace(/[\t\n\r]/g, "").replace(/^[\u0000-\u0020]+/, "").trimEnd();
2298
2583
  }
2299
- function hr(e) {
2300
- let t = /^([a-z][a-z0-9+.-]*):/i.exec(mr(e));
2584
+ function Rr(e) {
2585
+ let t = /^([a-z][a-z0-9+.-]*):/i.exec(Lr(e));
2301
2586
  return t ? t[1].toLowerCase() : null;
2302
2587
  }
2303
- var gr = /^data:image\/(png|jpe?g|gif|webp|svg\+xml);/i, _r = Object.freeze([
2588
+ var zr = /^data:image\/(png|jpe?g|gif|webp|svg\+xml);/i, Br = Object.freeze([
2304
2589
  "href",
2305
2590
  "xlink:href",
2306
2591
  "background",
2307
2592
  "poster",
2308
2593
  "src"
2309
- ]), vr = Object.freeze([
2594
+ ]), Vr = Object.freeze([
2310
2595
  "srcdoc",
2311
2596
  "ping",
2312
2597
  "formaction",
2313
2598
  "action"
2314
2599
  ]);
2315
- function yr(e, t) {
2316
- let n = mr(e), r = hr(n);
2317
- return r === null || pr.some((e) => e === r) ? !0 : t.toLowerCase() === "src" && gr.test(n);
2600
+ function Hr(e, t) {
2601
+ let n = Lr(e), r = Rr(n);
2602
+ return r === null || Ir.some((e) => e === r) ? !0 : t.toLowerCase() === "src" && zr.test(n);
2318
2603
  }
2319
- var br = /<\/?p\b[^<>]*>/gi, xr = /<p\b([^<>]*)>\s*<\/p>/gi;
2320
- function Sr(e) {
2321
- return e.replace(br, "").trim() === "";
2604
+ var Ur = /<\/?p\b[^<>]*>/gi, Wr = /<p\b([^<>]*)>\s*<\/p>/gi;
2605
+ function Gr(e) {
2606
+ return e.replace(Ur, "").trim() === "";
2322
2607
  }
2323
- function Cr(e) {
2324
- return Sr(e) ? e : e.replace(xr, "<p$1>&nbsp;</p>");
2608
+ function Kr(e) {
2609
+ return Gr(e) ? e : e.replace(Wr, "<p$1>&nbsp;</p>");
2325
2610
  }
2326
- var wr = {
2611
+ var qr = {
2327
2612
  arial: "Arial, sans-serif",
2328
2613
  helvetica: "Helvetica, sans-serif",
2329
2614
  georgia: "Georgia, serif",
@@ -2332,13 +2617,13 @@ var wr = {
2332
2617
  "trebuchet ms": "'Trebuchet MS', sans-serif",
2333
2618
  "courier new": "'Courier New', monospace",
2334
2619
  tahoma: "Tahoma, sans-serif"
2335
- }, Tr = /* @__PURE__ */ new Set([
2620
+ }, Jr = /* @__PURE__ */ new Set([
2336
2621
  "inherit",
2337
2622
  "initial",
2338
2623
  "unset",
2339
2624
  "revert",
2340
2625
  "revert-layer"
2341
- ]), Er = /* @__PURE__ */ new Set([
2626
+ ]), Yr = /* @__PURE__ */ new Set([
2342
2627
  "serif",
2343
2628
  "sans-serif",
2344
2629
  "monospace",
@@ -2353,14 +2638,14 @@ var wr = {
2353
2638
  "math",
2354
2639
  "fangsong"
2355
2640
  ]);
2356
- function Dr(e) {
2641
+ function Xr(e) {
2357
2642
  return e === " " || e === " " || e === "\n" || e === "\r" || e === "\f";
2358
2643
  }
2359
- function Or(e) {
2644
+ function Zr(e) {
2360
2645
  if (typeof e != "string") return [];
2361
2646
  let t = e.replace(/!\s*important\s*$/i, ""), n = [], r = 0;
2362
2647
  for (;;) {
2363
- for (; r < t.length && Dr(t[r]);) r++;
2648
+ for (; r < t.length && Xr(t[r]);) r++;
2364
2649
  if (r >= t.length) return [];
2365
2650
  let e = t[r];
2366
2651
  if (e === "\"" || e === "'") {
@@ -2377,7 +2662,7 @@ function Or(e) {
2377
2662
  }
2378
2663
  }
2379
2664
  if (!o) return [];
2380
- for (; a < t.length && Dr(t[a]);) a++;
2665
+ for (; a < t.length && Xr(t[a]);) a++;
2381
2666
  if (a < t.length && t[a] !== ",") return [];
2382
2667
  n.push({
2383
2668
  name: i,
@@ -2385,7 +2670,7 @@ function Or(e) {
2385
2670
  }), r = a;
2386
2671
  } else {
2387
2672
  let e = t.indexOf(",", r), i = e === -1 ? t.length : e, a = t.slice(r, i).trim().split(/\s+/).join(" ");
2388
- if (a === "" || a.includes("\"") || a.includes("'") || Tr.has(a.toLowerCase())) return [];
2673
+ if (a === "" || a.includes("\"") || a.includes("'") || Jr.has(a.toLowerCase())) return [];
2389
2674
  n.push({
2390
2675
  name: a,
2391
2676
  quoted: !1
@@ -2395,148 +2680,26 @@ function Or(e) {
2395
2680
  r++;
2396
2681
  }
2397
2682
  }
2398
- function kr(e) {
2683
+ function Qr(e) {
2399
2684
  return `'${e.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
2400
2685
  }
2401
- function Ar(e) {
2402
- return !e.quoted && Er.has(e.name.toLowerCase());
2686
+ function $r(e) {
2687
+ return !e.quoted && Yr.has(e.name.toLowerCase());
2403
2688
  }
2404
- function jr(e) {
2405
- return Or(e)[0]?.name ?? "";
2689
+ function ei(e) {
2690
+ return Zr(e)[0]?.name ?? "";
2406
2691
  }
2407
- function Mr(e, t) {
2408
- let n = (e) => `${kr(e.name)}, ${e.fallback ?? t.defaultFallback}`, r = typeof e == "string" ? e.trim().toLowerCase() : "", i = t.customFonts.find((e) => e.name.toLowerCase() === r);
2692
+ function ti(e, t) {
2693
+ let n = (e) => `${Qr(e.name)}, ${e.fallback ?? t.defaultFallback}`, r = typeof e == "string" ? e.trim().toLowerCase() : "", i = t.customFonts.find((e) => e.name.toLowerCase() === r);
2409
2694
  if (i) return n(i);
2410
- let a = Or(e);
2695
+ let a = Zr(e);
2411
2696
  if (a.length !== 1) return e;
2412
2697
  let [o] = a, s = o.name.toLowerCase(), c = t.customFonts.find((e) => e.name.toLowerCase() === s);
2413
- return c ? n(c) : wr[s] || (Ar(o) ? e : `${kr(o.name)}, ${t.defaultFallback}`);
2414
- }
2415
- var $ = {
2416
- liquid: {
2417
- value: /\{\{.+?\}\}/g,
2418
- logic: /\{%-?\s*(\w+).*?-?%\}/g,
2419
- opener: "{{",
2420
- closer: "}}"
2421
- },
2422
- handlebars: {
2423
- value: /\{\{\{?.+?\}?\}\}/g,
2424
- logic: /\{\{[#/](\w+).*?\}\}/g,
2425
- opener: "{{",
2426
- closer: "}}"
2427
- },
2428
- mailchimp: {
2429
- value: /\*\|\w+\|\*/g,
2430
- logic: /\*\|(\w+)[:|].*?\|\*/g,
2431
- opener: "*|",
2432
- closer: "|*"
2433
- },
2434
- ampscript: {
2435
- value: /%%=.+?=%%/g,
2436
- logic: /%%\[\s*(\w+).*?\]%%/g,
2437
- opener: "%%=",
2438
- closer: "=%%"
2439
- }
2440
- };
2441
- function Nr(e) {
2442
- return typeof e == "string" && e.trim() !== "" ? e : null;
2443
- }
2444
- function Pr(e) {
2445
- return Object.values($).find((t) => t.value.source === e.value.source) ?? null;
2446
- }
2447
- function Fr(e) {
2448
- return Nr(e.opener) ?? Pr(e)?.opener ?? null;
2449
- }
2450
- function Ir(e) {
2451
- return Nr(e.closer) ?? Pr(e)?.closer ?? null;
2698
+ return c ? n(c) : qr[s] || ($r(o) ? e : `${Qr(o.name)}, ${t.defaultFallback}`);
2452
2699
  }
2453
- function Lr(e) {
2454
- return e ? typeof e == "string" ? $[e] ?? $.liquid : e : $.liquid;
2455
- }
2456
- function Rr(e) {
2457
- let t = e.source, n = e.flags.replace("g", "");
2458
- return RegExp(`^${t}$`, n);
2459
- }
2460
- function zr(e, t) {
2461
- let n = e?.trim() || "";
2462
- return !Rr(t.logic).test(n) && Rr(t.value).test(n);
2463
- }
2464
- function Br(e, t) {
2465
- let n = t.find((t) => t.value === e);
2466
- return n ? n.label : e;
2467
- }
2468
- function Vr(e, t) {
2469
- return Zr(e, "data-merge-tag", (e) => Br(e, t));
2470
- }
2471
- function Hr(e, t) {
2472
- return t.find((t) => t.value === e)?.sample;
2473
- }
2474
- function Ur(e, t) {
2475
- return Zr(e, "data-merge-tag", (e) => Kr(Hr(e, t) ?? Br(e, t)), { unwrap: (e) => Hr(e, t) !== void 0 });
2476
- }
2477
- function Wr(e) {
2478
- return e.some((e) => e.sample !== void 0);
2479
- }
2480
- function Gr(e, t) {
2481
- if (!e) return e;
2482
- let n = e;
2483
- for (let e of t) e.sample !== void 0 && (n = n.split(e.value).join(e.sample));
2484
- return n;
2485
- }
2486
- function Kr(e) {
2487
- return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
2488
- }
2489
- function qr(e, t) {
2490
- if (!e) return !1;
2491
- let n = new RegExp(t.value.source, t.value.flags), r = new RegExp(t.logic.source, t.logic.flags);
2492
- return n.test(e) || r.test(e);
2493
- }
2494
- function Jr(e, t) {
2495
- return Rr(t.logic).test(e?.trim() || "");
2496
- }
2497
- function Yr(e, t) {
2498
- let n = new RegExp(t.logic.source, t.logic.flags.replace("g", "")), r = e.match(n);
2499
- return r && r[1] ? r[1].toUpperCase() : e;
2500
- }
2501
- function Xr(e, t) {
2502
- return Zr(e, "data-logic-merge-tag", (e) => Yr(e, t));
2503
- }
2504
- function Zr(e, t, n, r) {
2505
- let i = "", a = 0;
2506
- for (; a < e.length;) {
2507
- let o = e.indexOf("<span", a);
2508
- if (o === -1) {
2509
- i += e.substring(a);
2510
- break;
2511
- }
2512
- let s = e[o + 5];
2513
- if (s !== ">" && s !== " " && s !== " " && s !== "\n" && s !== "\r" && s !== "/") {
2514
- i += e.substring(a, o + 5), a = o + 5;
2515
- continue;
2516
- }
2517
- let c = U(e, o + 5);
2518
- if (c === -1) {
2519
- i += e.substring(a);
2520
- break;
2521
- }
2522
- let l = e.indexOf("</span>", c + 1);
2523
- if (l === -1) {
2524
- i += e.substring(a);
2525
- break;
2526
- }
2527
- let u = un(e.substring(o + 5, c), t);
2528
- if (u === null) {
2529
- i += e.substring(a, o + 5), a = o + 5;
2530
- continue;
2531
- }
2532
- let d = n(u);
2533
- r?.unwrap?.(u) ? (i += e.substring(a, o), i += d) : (i += e.substring(a, c + 1), i += d, i += "</span>"), a = l + 7;
2534
- }
2535
- return i;
2536
- }
2537
- function Qr(e) {
2700
+ function ni(e) {
2538
2701
  if (typeof e != "object" || !e) return !1;
2539
2702
  let t = e;
2540
2703
  return Array.isArray(t.blocks);
2541
2704
  }
2542
- export { je as $, r as $t, Zn as A, kn as At, Pn as B, ie as Bt, Ie as C, V as Ct, Z as D, cr as Dt, sr as E, H as Et, tn as F, v as Ft, Vn as G, p as Gt, Pe as H, Vr as Ht, Ln as I, dn as It, zn as J, de as Jt, Gn as K, ue as Kt, Hn as L, ne as Lt, Kn as M, Or as Mt, Jn as N, y as Nt, qr as O, ke as Ot, jn as P, Se as Pt, en as Q, n as Qt, Fn as R, an as Rt, An as S, It as St, or as T, S as Tt, Yn as U, Oe as Ut, Rn as V, Xr as Vt, Bn as W, Lr as Wt, G as X, Ur as Xt, Xn as Y, C as Yt, m as Z, Gr as Zt, he as _, Jr as _t, Ft as a, Y as at, on as b, yr as bt, s as c, Br as ct, E as d, Fr as dt, o as en, T as et, l as f, Wr as ft, $ as g, _e as gt, se as h, Lt as ht, e as i, ar as in, jr as it, In as j, Te as jt, ee as k, Ae as kt, vr as l, Hr as lt, h as m, Nt as mt, f as n, t as nn, hr as nt, Zt as o, Fe as ot, pr as p, oe as pt, Nn as q, fe as qt, i as r, En as rn, Cr as rt, Qt as s, Yr as st, d as t, x as tn, te as tt, _r as u, Ir as ut, c as v, zr as vt, D as w, xe as wt, fr as x, _ as xt, gn as y, Qr as yt, Un as z, Mr as zt };
2705
+ export { Ae as $, An as $t, br as A, ke as At, rr as B, ti as Bt, Fe as C, Lt as Ct, Q as D, V as Dt, Ar as E, Se as Et, nn as F, be as Ft, ur as G, wn as Gt, Ne as H, Ln as Ht, or as I, b as It, cr as J, K as Jt, mr as K, h as Kt, dr as L, pn as Lt, hr as M, we as Mt, _r as N, Zr as Nt, Pn as O, jr as Ot, er as P, x as Pt, tn as Q, w as Qt, ir as R, ee as Rt, $n as S, y as St, kr as T, ye as Tt, vr as U, On as Ut, sr as V, ne as Vt, lr as W, De as Wt, W as X, ue as Xt, yr as Y, ce as Yt, g as Z, le as Zt, pe as _, he as _t, It as a, t as an, ei as at, sn as b, ni as bt, s as c, In as ct, D as d, Cn as dt, Mn as en, E as et, l as f, Sn as ft, G as g, Rt as gt, ae as h, Pt as ht, e as i, C as in, H as it, ar as j, Qn as jt, p as k, Oe as kt, Vr as l, Dn as lt, _ as m, ie as mt, f as n, r as nn, Rr as nt, Qt as o, Yn as on, X as ot, Ir as p, jn as pt, nr as q, yn as qt, i as r, o as rn, Kr as rt, $t as s, Or as sn, Pe as st, d as t, n as tn, m as tt, Br as u, kn as ut, c as v, Fn as vt, O as w, B as wt, Fr as x, Hr as xt, zn as y, En as yt, fr as z, on as zt };