@templatical/editor 0.48.0 → 0.50.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 (396) hide show
  1. package/README.md +4 -2
  2. package/dist/AiAltTextPopover-BZQ95GXL.js +106 -0
  3. package/dist/AiAltTextReview-DoBEudnE.js +206 -0
  4. package/dist/AiChatPanel-Bs6sES3b.js +550 -0
  5. package/dist/AiHeaderMenu-BEaTazx4.js +36 -0
  6. package/dist/AiPanels-CfN7A-ZA.js +33 -0
  7. package/dist/AiRewriteMenu-C3ZfDDYy.js +276 -0
  8. package/dist/{BlockIssueBadge-BShkuJis.js → BlockIssueBadge-CKwZ1Vgn.js} +11 -11
  9. package/dist/{BlockPreviewCanvas-tzAtDkXH.js → BlockPreviewCanvas-BXNLLLYi.js} +33 -33
  10. package/dist/CloudHeaderExtras-CsJMEiyN.js +23 -0
  11. package/dist/CloudPanels-B4F5m7vy.js +168 -0
  12. package/dist/CollaborationNotices-CNuDp7Y2.js +76 -0
  13. package/dist/CollaboratorBar-BtHPiuHq.js +123 -0
  14. package/dist/{CommentsPanel-DiWzYtnZ.js → CommentsPanel-CyCM-BvT.js} +4 -4
  15. package/dist/CommentsSidebar-Ca3DyFOX.js +500 -0
  16. package/dist/{cdn/chunks/CountdownBlock-Dasj191h.js → CountdownBlock-DR4Xm2-T.js} +24 -26
  17. package/dist/{CountdownToolbar-C4y3Ft7H.js → CountdownToolbar-CEIMPojJ.js} +56 -56
  18. package/dist/IssuesPanel-C8nMUccy.js +360 -0
  19. package/dist/{LoadingTrack-6XsqodoY.js → LoadingTrack-B0RKQWq3.js} +2 -2
  20. package/dist/{LogicTagInsertButton-B1_Wy0AN.js → LogicTagInsertButton-CqfU52CO.js} +272 -267
  21. package/dist/{cdn/chunks/MediaEditModal-zXfcArr4.js → MediaEditModal-DHtkZ4OU.js} +202 -186
  22. package/dist/{MediaPanels-9mDBv4aL.js → MediaPanels-CGcOB2pR.js} +4 -4
  23. package/dist/{MergeTagInput-fOewuF27.js → MergeTagInput-YnEkorTZ.js} +26 -26
  24. package/dist/{MergeTagModeToggle-BXamLcv7.js → MergeTagModeToggle-Dhb1DAcQ.js} +40 -40
  25. package/dist/MergeTagTextarea-e4lnwtqZ.js +70 -0
  26. package/dist/ParagraphEditor-B6NK0ytw.js +799 -0
  27. package/dist/{RestoreVersionDialog-BEKXx9xk.js → RestoreVersionDialog-Bq_IGOLJ.js} +22 -22
  28. package/dist/{RichTextEditorContent-D7kp7iig.js → RichTextEditorContent-AOM6fylS.js} +48 -48
  29. package/dist/{SaveBlockDialog-SJu0lecx.js → SaveBlockDialog-C8GngfQx.js} +88 -88
  30. package/dist/{cdn/chunks/SavedBlocksBrowserModal-CtnB58p_.js → SavedBlocksBrowserModal-wnkvxpm_.js} +102 -99
  31. package/dist/{SavedBlocksPanels-Dr5Fxx9Z.js → SavedBlocksPanels-C2s3q0pJ.js} +9 -9
  32. package/dist/{SavedBlocksPickBar-DnEWBZJy.js → SavedBlocksPickBar-BjcTiV87.js} +14 -14
  33. package/dist/TemplateSettings-BVBWpiDU.js +237 -0
  34. package/dist/{TestEmailModal-CbRY8HQx.js → TestEmailModal-SyhO9bn3.js} +57 -57
  35. package/dist/{TestEmailPanel-NAOmt3xi.js → TestEmailPanel-BDd2Rtav.js} +4 -4
  36. package/dist/{TitleEditor-Cc3DHbuN.js → TitleEditor-pxD53y_l.js} +75 -75
  37. package/dist/ToggleSwitch-D51U9cmR.js +37 -0
  38. package/dist/Toolbar-CZSPZYbj.js +3153 -0
  39. package/dist/{TplModal-Bz4-IZ9R.js → TplModal-DCzBzicE.js} +19 -19
  40. package/dist/{VersionHistoryMenu-CjV1d1zk.js → VersionHistoryMenu-BQeWPT85.js} +35 -35
  41. package/dist/{VersionHistoryPanels-BtwxrKJn.js → VersionHistoryPanels-BBm7YbRQ.js} +5 -5
  42. package/dist/{VersionPreviewBanner-BLAei1kj.js → VersionPreviewBanner-DUGF0tUJ.js} +10 -10
  43. package/dist/WrapperBlock-BO619LAb.js +45 -0
  44. package/dist/aiErrors-D5UOoYOt.js +41 -0
  45. package/dist/aiImageContext-BH4Ss1h3.js +48 -0
  46. package/dist/aiRewritePreview-DLGM05Ge.js +44 -0
  47. package/dist/{blockTypeIcons-CEDZytqP.js → blockTypeIcons-NzaYvAI4.js} +15 -14
  48. package/dist/bundle-stats.json +8 -8
  49. package/dist/{cdn/chunks/ca-CbNzJM3I.js → ca-C7mTzW1r.js} +147 -8
  50. package/dist/cdn/chunks/AiAltTextPopover-CQu0Q_ZX.js +107 -0
  51. package/dist/cdn/chunks/AiAltTextPopover-CQu0Q_ZX.js.map +1 -0
  52. package/dist/cdn/chunks/AiAltTextReview-CI2HbWfn.js +207 -0
  53. package/dist/cdn/chunks/AiAltTextReview-CI2HbWfn.js.map +1 -0
  54. package/dist/cdn/chunks/AiChatPanel-BYqn1bKu.js +476 -0
  55. package/dist/cdn/chunks/AiChatPanel-BYqn1bKu.js.map +1 -0
  56. package/dist/cdn/chunks/AiHeaderMenu-oldAAFyL.js +37 -0
  57. package/dist/cdn/chunks/AiHeaderMenu-oldAAFyL.js.map +1 -0
  58. package/dist/cdn/chunks/AiPanels-CIFKQv8Y.js +34 -0
  59. package/dist/cdn/chunks/AiPanels-CIFKQv8Y.js.map +1 -0
  60. package/dist/cdn/chunks/AiRewriteMenu-Bhh71zcc.js +208 -0
  61. package/dist/cdn/chunks/AiRewriteMenu-Bhh71zcc.js.map +1 -0
  62. package/dist/cdn/chunks/{BlockIssueBadge-C7sdnkrF.js → BlockIssueBadge-DAn2vsMJ.js} +13 -13
  63. package/dist/cdn/chunks/{BlockIssueBadge-C7sdnkrF.js.map → BlockIssueBadge-DAn2vsMJ.js.map} +1 -1
  64. package/dist/cdn/chunks/{BlockPreviewCanvas-vK5tBazr.js → BlockPreviewCanvas-D0--EQkP.js} +39 -39
  65. package/dist/cdn/chunks/{BlockPreviewCanvas-vK5tBazr.js.map → BlockPreviewCanvas-D0--EQkP.js.map} +1 -1
  66. package/dist/cdn/chunks/CloudHeaderExtras-DaUU8P8R.js +25 -0
  67. package/dist/cdn/chunks/CloudHeaderExtras-DaUU8P8R.js.map +1 -0
  68. package/dist/cdn/chunks/{CloudPanels-awqHfJqC.js → CloudPanels-C3jsxo_f.js} +52 -100
  69. package/dist/cdn/chunks/CloudPanels-C3jsxo_f.js.map +1 -0
  70. package/dist/cdn/chunks/CollaborationNotices-DjRI8gvs.js +78 -0
  71. package/dist/cdn/chunks/CollaborationNotices-DjRI8gvs.js.map +1 -0
  72. package/dist/cdn/chunks/CollaboratorBar-Dfzm6A9A.js +72 -0
  73. package/dist/cdn/chunks/CollaboratorBar-Dfzm6A9A.js.map +1 -0
  74. package/dist/cdn/chunks/CommentsPanel-CSO79OeX.js +20 -0
  75. package/dist/cdn/chunks/{CommentsPanel-CbzxwsyI.js.map → CommentsPanel-CSO79OeX.js.map} +1 -1
  76. package/dist/cdn/chunks/CommentsSidebar-CCvplq1Z.js +470 -0
  77. package/dist/cdn/chunks/{CommentsSidebar-DWPHZuQm.js.map → CommentsSidebar-CCvplq1Z.js.map} +1 -1
  78. package/dist/{CountdownBlock-zx39Dyby.js → cdn/chunks/CountdownBlock-C6USdwk3.js} +19 -17
  79. package/dist/cdn/chunks/{CountdownBlock-Dasj191h.js.map → CountdownBlock-C6USdwk3.js.map} +1 -1
  80. package/dist/cdn/chunks/{CountdownToolbar-Cqg8FUH-.js → CountdownToolbar-Cjud2Tos.js} +71 -71
  81. package/dist/cdn/chunks/{CountdownToolbar-Cqg8FUH-.js.map → CountdownToolbar-Cjud2Tos.js.map} +1 -1
  82. package/dist/cdn/chunks/IssuesPanel-BaWHPDxZ.js +340 -0
  83. package/dist/cdn/chunks/IssuesPanel-BaWHPDxZ.js.map +1 -0
  84. package/dist/cdn/chunks/{LoadingTrack-DbH97JR9.js → LoadingTrack-BIcL4NiY.js} +2 -2
  85. package/dist/cdn/chunks/{LoadingTrack-DbH97JR9.js.map → LoadingTrack-BIcL4NiY.js.map} +1 -1
  86. package/dist/cdn/chunks/{LogicTagInsertButton-BMB9vShs.js → LogicTagInsertButton-CsL2JDOG.js} +374 -369
  87. package/dist/cdn/chunks/LogicTagInsertButton-CsL2JDOG.js.map +1 -0
  88. package/dist/{MediaEditModal-ByOvznRC.js → cdn/chunks/MediaEditModal-BuHCiyMu.js} +544 -560
  89. package/dist/cdn/chunks/MediaEditModal-BuHCiyMu.js.map +1 -0
  90. package/dist/cdn/chunks/MediaPanels-DAgUf_T1.js +45 -0
  91. package/dist/cdn/chunks/{MediaPanels-Cp4XB_dH.js.map → MediaPanels-DAgUf_T1.js.map} +1 -1
  92. package/dist/cdn/chunks/{MergeTagInput-DLqrA9co.js → MergeTagInput-C8U-7LxL.js} +34 -34
  93. package/dist/cdn/chunks/{MergeTagInput-DLqrA9co.js.map → MergeTagInput-C8U-7LxL.js.map} +1 -1
  94. package/dist/cdn/chunks/{MergeTagModeToggle-BRiJzzn5.js → MergeTagModeToggle-Mm-p0A52.js} +41 -41
  95. package/dist/cdn/chunks/{MergeTagModeToggle-BRiJzzn5.js.map → MergeTagModeToggle-Mm-p0A52.js.map} +1 -1
  96. package/dist/cdn/chunks/MergeTagTextarea-DuLScsWM.js +72 -0
  97. package/dist/cdn/chunks/MergeTagTextarea-DuLScsWM.js.map +1 -0
  98. package/dist/cdn/chunks/ParagraphEditor-CqSj6Ayz.js +634 -0
  99. package/dist/cdn/chunks/ParagraphEditor-CqSj6Ayz.js.map +1 -0
  100. package/dist/cdn/chunks/{RestoreVersionDialog-BgR6RXSb.js → RestoreVersionDialog-CdA5osuA.js} +26 -26
  101. package/dist/cdn/chunks/{RestoreVersionDialog-BgR6RXSb.js.map → RestoreVersionDialog-CdA5osuA.js.map} +1 -1
  102. package/dist/cdn/chunks/{RichTextEditorContent-C4DMAn0g.js → RichTextEditorContent-Q1d2xqBT.js} +46 -46
  103. package/dist/cdn/chunks/{RichTextEditorContent-C4DMAn0g.js.map → RichTextEditorContent-Q1d2xqBT.js.map} +1 -1
  104. package/dist/cdn/chunks/{SaveBlockDialog-BaIsQd09.js → SaveBlockDialog-CijargAy.js} +78 -78
  105. package/dist/cdn/chunks/{SaveBlockDialog-BaIsQd09.js.map → SaveBlockDialog-CijargAy.js.map} +1 -1
  106. package/dist/cdn/chunks/SavedBlocksBrowserModal-DtOz_X5S.js +357 -0
  107. package/dist/cdn/chunks/{SavedBlocksBrowserModal-CtnB58p_.js.map → SavedBlocksBrowserModal-DtOz_X5S.js.map} +1 -1
  108. package/dist/cdn/chunks/SavedBlocksPanels-BowyED5h.js +38 -0
  109. package/dist/cdn/chunks/{SavedBlocksPanels-BhEOMzEQ.js.map → SavedBlocksPanels-BowyED5h.js.map} +1 -1
  110. package/dist/cdn/chunks/{SavedBlocksPickBar-CcdqTEIp.js → SavedBlocksPickBar-BPRaJBv3.js} +19 -19
  111. package/dist/cdn/chunks/{SavedBlocksPickBar-CcdqTEIp.js.map → SavedBlocksPickBar-BPRaJBv3.js.map} +1 -1
  112. package/dist/cdn/chunks/TemplateSettings-ByZeBO34.js +209 -0
  113. package/dist/cdn/chunks/{TemplateSettings-BkkWTDHD.js.map → TemplateSettings-ByZeBO34.js.map} +1 -1
  114. package/dist/cdn/chunks/{TestEmailModal-V5mwHsUV.js → TestEmailModal-BUVTj3Ic.js} +54 -54
  115. package/dist/cdn/chunks/{TestEmailModal-V5mwHsUV.js.map → TestEmailModal-BUVTj3Ic.js.map} +1 -1
  116. package/dist/cdn/chunks/TestEmailPanel-BxutYoWg.js +35 -0
  117. package/dist/cdn/chunks/{TestEmailPanel-DxrKuctP.js.map → TestEmailPanel-BxutYoWg.js.map} +1 -1
  118. package/dist/cdn/chunks/TitleEditor-Ccv6uoTz.js +199 -0
  119. package/dist/cdn/chunks/{TitleEditor-CsZiG3TT.js.map → TitleEditor-Ccv6uoTz.js.map} +1 -1
  120. package/dist/cdn/chunks/ToggleSwitch-Ctdmj621.js +39 -0
  121. package/dist/cdn/chunks/ToggleSwitch-Ctdmj621.js.map +1 -0
  122. package/dist/cdn/chunks/{Toolbar-C_x2TfFk.js → Toolbar-DoprRgTn.js} +1097 -1101
  123. package/dist/cdn/chunks/Toolbar-DoprRgTn.js.map +1 -0
  124. package/dist/cdn/chunks/{TplModal-DC_eodTV.js → TplModal-BXQzmsJX.js} +21 -21
  125. package/dist/cdn/chunks/{TplModal-DC_eodTV.js.map → TplModal-BXQzmsJX.js.map} +1 -1
  126. package/dist/cdn/chunks/{VersionHistoryMenu-DXnM5Df2.js → VersionHistoryMenu-BF2fNCvq.js} +41 -41
  127. package/dist/cdn/chunks/{VersionHistoryMenu-DXnM5Df2.js.map → VersionHistoryMenu-BF2fNCvq.js.map} +1 -1
  128. package/dist/cdn/chunks/VersionHistoryPanels-Dal0Uk69.js +48 -0
  129. package/dist/cdn/chunks/{VersionHistoryPanels-DXSqmaLS.js.map → VersionHistoryPanels-Dal0Uk69.js.map} +1 -1
  130. package/dist/cdn/chunks/{VersionPreviewBanner-DKyN6BhO.js → VersionPreviewBanner-BaGcn-b1.js} +13 -13
  131. package/dist/cdn/chunks/{VersionPreviewBanner-DKyN6BhO.js.map → VersionPreviewBanner-BaGcn-b1.js.map} +1 -1
  132. package/dist/cdn/chunks/WrapperBlock-DkQJtLz0.js +47 -0
  133. package/dist/cdn/chunks/{WrapperBlock-gG_Bleug.js.map → WrapperBlock-DkQJtLz0.js.map} +1 -1
  134. package/dist/cdn/chunks/aiErrors-D5UOoYOt.js +43 -0
  135. package/dist/cdn/chunks/aiErrors-D5UOoYOt.js.map +1 -0
  136. package/dist/cdn/chunks/aiImageContext-BH4Ss1h3.js +50 -0
  137. package/dist/cdn/chunks/aiImageContext-BH4Ss1h3.js.map +1 -0
  138. package/dist/cdn/chunks/aiRewritePreview-DLGM05Ge.js +46 -0
  139. package/dist/cdn/chunks/aiRewritePreview-DLGM05Ge.js.map +1 -0
  140. package/dist/cdn/chunks/blockTypeIcons-ikZAmd6U.js +22 -0
  141. package/dist/cdn/chunks/{blockTypeIcons-HrMJDfVg.js.map → blockTypeIcons-ikZAmd6U.js.map} +1 -1
  142. package/dist/{ca-CbNzJM3I.js → cdn/chunks/ca-C7mTzW1r.js} +149 -6
  143. package/dist/cdn/chunks/ca-C7mTzW1r.js.map +1 -0
  144. package/dist/cdn/chunks/createCloudRuntime-DpBWhrv3.js +1408 -0
  145. package/dist/cdn/chunks/createCloudRuntime-DpBWhrv3.js.map +1 -0
  146. package/dist/cdn/chunks/de-DBOTcDj2.js +22 -0
  147. package/dist/cdn/chunks/de-DBOTcDj2.js.map +1 -0
  148. package/dist/{de-DMquBpZM.js → cdn/chunks/de-DNuYQTmS.js} +149 -6
  149. package/dist/cdn/chunks/de-DNuYQTmS.js.map +1 -0
  150. package/dist/{dist-CUWI-IvA.js → cdn/chunks/dist-Bo8Thh8v.js} +60 -58
  151. package/dist/cdn/chunks/{dist-CjL6JHML.js.map → dist-Bo8Thh8v.js.map} +1 -1
  152. package/dist/cdn/chunks/dist-S-rLGqax.js +406 -0
  153. package/dist/cdn/chunks/{dist-MNQYSEWU.js.map → dist-S-rLGqax.js.map} +1 -1
  154. package/dist/cdn/chunks/{draggable-DrsNwZuB.js → draggable-DZ0gwUJ6.js} +1359 -1266
  155. package/dist/cdn/chunks/draggable-DZ0gwUJ6.js.map +1 -0
  156. package/dist/cdn/chunks/{editor-modal-vEEmZ8Tu.js → editor-modal-CI6EfeMd.js} +881 -881
  157. package/dist/cdn/chunks/{editor-modal-vEEmZ8Tu.js.map → editor-modal-CI6EfeMd.js.map} +1 -1
  158. package/dist/cdn/chunks/en-CDhWRrF_.js +22 -0
  159. package/dist/cdn/chunks/en-CDhWRrF_.js.map +1 -0
  160. package/dist/{en-C8Mp71sO.js → cdn/chunks/en-CW71OK66.js} +149 -6
  161. package/dist/cdn/chunks/en-CW71OK66.js.map +1 -0
  162. package/dist/cdn/chunks/en-ifvu6oPv.js +1 -0
  163. package/dist/{es-Byq4tthI.js → cdn/chunks/es-DdK7zQfi.js} +149 -6
  164. package/dist/cdn/chunks/es-DdK7zQfi.js.map +1 -0
  165. package/dist/cdn/chunks/{extensions-hJ9VqzDc.js → extensions-taJTZlLK.js} +71 -71
  166. package/dist/cdn/chunks/{extensions-hJ9VqzDc.js.map → extensions-taJTZlLK.js.map} +1 -1
  167. package/dist/{fr-B3j35HEw.js → cdn/chunks/fr-Dz5Bgb7-.js} +149 -6
  168. package/dist/cdn/chunks/fr-Dz5Bgb7-.js.map +1 -0
  169. package/dist/cdn/chunks/{icons-aTYwH5-g.js → icons-DNX6StSs.js} +183 -150
  170. package/dist/cdn/chunks/icons-DNX6StSs.js.map +1 -0
  171. package/dist/{ja-D7txAuGS.js → cdn/chunks/ja-Di-zJiT8.js} +149 -6
  172. package/dist/cdn/chunks/ja-Di-zJiT8.js.map +1 -0
  173. package/dist/cdn/chunks/keys-BTpmg2Tt.js +12 -0
  174. package/dist/cdn/chunks/keys-BTpmg2Tt.js.map +1 -0
  175. package/dist/{logger-BBlvSn6q.js → cdn/chunks/logger-Tj0RPskW.js} +7 -1
  176. package/dist/cdn/chunks/logger-Tj0RPskW.js.map +1 -0
  177. package/dist/{nl-ClJ3BY3F.js → cdn/chunks/nl-CvVuHYFL.js} +149 -6
  178. package/dist/cdn/chunks/nl-CvVuHYFL.js.map +1 -0
  179. package/dist/cdn/chunks/normalizeMergeTagMarkup-DyePIGqu.js +199 -0
  180. package/dist/cdn/chunks/normalizeMergeTagMarkup-DyePIGqu.js.map +1 -0
  181. package/dist/cdn/chunks/{preRenderCustomBlocks-ByfuSjtL.js → preRenderCustomBlocks-Dc-QLntG.js} +4 -4
  182. package/dist/cdn/chunks/{preRenderCustomBlocks-ByfuSjtL.js.map → preRenderCustomBlocks-Dc-QLntG.js.map} +1 -1
  183. package/dist/cdn/chunks/pt-BR-CHM-ZKvE.js +22 -0
  184. package/dist/cdn/chunks/pt-BR-CHM-ZKvE.js.map +1 -0
  185. package/dist/{pt-BR-DibcXcmv.js → cdn/chunks/pt-BR-ZhO4vgyq.js} +149 -6
  186. package/dist/cdn/chunks/pt-BR-ZhO4vgyq.js.map +1 -0
  187. package/dist/cdn/chunks/{pusher-C8DeiO2X.js → pusher-Cs4GGEtd.js} +2 -2
  188. package/dist/cdn/chunks/pusher-Cs4GGEtd.js.map +1 -0
  189. package/dist/cdn/chunks/{rolldown-runtime-B0aSnxlc.js → rolldown-runtime-Y_bBpyJl.js} +1 -1
  190. package/dist/cdn/chunks/sanitizeRichTextHtml-DeISfLFr.js +62 -0
  191. package/dist/cdn/chunks/sanitizeRichTextHtml-DeISfLFr.js.map +1 -0
  192. package/dist/cdn/chunks/socialIcons-BBvsTwCV.js +2032 -0
  193. package/dist/cdn/chunks/socialIcons-BBvsTwCV.js.map +1 -0
  194. package/dist/cdn/chunks/{src-DYCDeBDM.js → src-BNFnxfrA.js} +694 -329
  195. package/dist/cdn/chunks/src-BNFnxfrA.js.map +1 -0
  196. package/dist/cdn/chunks/{src-dZ4D_tuP.js → src-BcTUmgLe.js} +181 -181
  197. package/dist/cdn/chunks/src-BcTUmgLe.js.map +1 -0
  198. package/dist/cdn/chunks/src-Bs_yxk3h.js +4392 -0
  199. package/dist/cdn/chunks/src-Bs_yxk3h.js.map +1 -0
  200. package/dist/cdn/chunks/{styleConstants-D1Jz-TFU.js → styleConstants-v1dNKgJf.js} +2 -4
  201. package/dist/cdn/chunks/{styleConstants-D1Jz-TFU.js.map → styleConstants-v1dNKgJf.js.map} +1 -1
  202. package/dist/cdn/chunks/{tiptap-BPigZk5G.js → tiptap-CtVrAViq.js} +44 -44
  203. package/dist/cdn/chunks/tiptap-CtVrAViq.js.map +1 -0
  204. package/dist/cdn/chunks/{useCloudI18n-BBF4waXO.js → useCloudI18n-AVXhzbhQ.js} +4 -4
  205. package/dist/cdn/chunks/{useCloudI18n-BBF4waXO.js.map → useCloudI18n-AVXhzbhQ.js.map} +1 -1
  206. package/dist/cdn/chunks/useEditorCore-CCVFi1YZ.js +2586 -0
  207. package/dist/cdn/chunks/useEditorCore-CCVFi1YZ.js.map +1 -0
  208. package/dist/cdn/chunks/useEditorRoot-CR5GjJD6.js +10 -0
  209. package/dist/cdn/chunks/{useEditorRoot-CTc6O8al.js.map → useEditorRoot-CR5GjJD6.js.map} +1 -1
  210. package/dist/cdn/chunks/{useI18n-DUlyyIJJ.js → useI18n-CbVubQhM.js} +3 -3
  211. package/dist/cdn/chunks/{useI18n-DUlyyIJJ.js.map → useI18n-CbVubQhM.js.map} +1 -1
  212. package/dist/cdn/chunks/{useLogicTag-HsyUCQtl.js → useLogicTag-B49Nc53Y.js} +5 -5
  213. package/dist/cdn/chunks/{useLogicTag-HsyUCQtl.js.map → useLogicTag-B49Nc53Y.js.map} +1 -1
  214. package/dist/cdn/chunks/{useMergeTag-Dg9pE85U.js → useMergeTag-B0KryMj8.js} +7 -7
  215. package/dist/cdn/chunks/{useMergeTag-Dg9pE85U.js.map → useMergeTag-B0KryMj8.js.map} +1 -1
  216. package/dist/cdn/chunks/{usePopoverPosition-IbaW6-Ao.js → usePopoverPosition-C829ps5i.js} +4 -4
  217. package/dist/cdn/chunks/{usePopoverPosition-IbaW6-Ao.js.map → usePopoverPosition-C829ps5i.js.map} +1 -1
  218. package/dist/cdn/chunks/useScrollToBlock-CAwvulog.js +51 -0
  219. package/dist/cdn/chunks/useScrollToBlock-CAwvulog.js.map +1 -0
  220. package/dist/cdn/chunks/{withCurrentFont-oLcATrQ8.js → withCurrentFont-DFPXeVfG.js} +2 -2
  221. package/dist/cdn/chunks/{withCurrentFont-oLcATrQ8.js.map → withCurrentFont-DFPXeVfG.js.map} +1 -1
  222. package/dist/cdn/editor.css +1 -1
  223. package/dist/cdn/editor.js +2235 -1311
  224. package/dist/cdn/editor.js.map +1 -1
  225. package/dist/{check-ClwqRMgv.js → check-yYsp5Xpk.js} +1 -1
  226. package/dist/{chevron-down-te6qn-zE.js → chevron-down-DTmD06_j.js} +1 -1
  227. package/dist/{chevron-right-W2hbH1FM.js → chevron-right-BSeYZOxc.js} +1 -1
  228. package/dist/{chevron-up-Bf5Zo7o4.js → chevron-up-BOApwrxi.js} +1 -1
  229. package/dist/{circle-alert-CIEGV5DN.js → circle-alert-BMszY8im.js} +1 -1
  230. package/dist/{clock-Y4cx0gkJ.js → clock-HADxnl6-.js} +1 -1
  231. package/dist/createCloudRuntime-DVQI_ReU.js +1379 -0
  232. package/dist/{createLucideIcon-CYHXK9hn.js → createLucideIcon-0lYYH3EW.js} +6 -6
  233. package/dist/de-DBOTcDj2.js +20 -0
  234. package/dist/{cdn/chunks/de-DMquBpZM.js → de-DNuYQTmS.js} +147 -8
  235. package/dist/{cdn/chunks/dist-CjL6JHML.js → dist-C7EtxNCb.js} +49 -51
  236. package/dist/{dist-DuufrR8O.js → dist-C_dV9QAx.js} +130 -130
  237. package/dist/{cdn/chunks/dist-MNQYSEWU.js → dist-DI4_YSnG.js} +111 -110
  238. package/dist/{dist-tsmnQugO.js → dist-DtOF3bDW.js} +648 -294
  239. package/dist/{editor-modal-AlVLkU91.js → editor-modal-Bzhl-PgI.js} +832 -834
  240. package/dist/en-CDhWRrF_.js +20 -0
  241. package/dist/{cdn/chunks/en-C8Mp71sO.js → en-CW71OK66.js} +147 -8
  242. package/dist/en-DwV15ltA.js +1 -0
  243. package/dist/{cdn/chunks/es-Byq4tthI.js → es-DdK7zQfi.js} +147 -8
  244. package/dist/{extensions-pjO8VGkM.js → extensions-CdyweA50.js} +54 -54
  245. package/dist/{eye-Ddnz8nnm.js → eye-DWkSvYpj.js} +1 -1
  246. package/dist/{cdn/chunks/fr-B3j35HEw.js → fr-Dz5Bgb7-.js} +147 -8
  247. package/dist/image-DesWjcZ4.js +28 -0
  248. package/dist/index.d.ts +640 -48
  249. package/dist/{info-DXLmzoeY.js → info-ClWJGoZy.js} +1 -1
  250. package/dist/{cdn/chunks/ja-D7txAuGS.js → ja-Di-zJiT8.js} +147 -8
  251. package/dist/keys-Zd9KWRD1.js +10 -0
  252. package/dist/{link-Cel46wgo.js → link-BqRicFTA.js} +1 -1
  253. package/dist/{list-Cl0GwiV9.js → list-bojQr9bn.js} +1 -1
  254. package/dist/{loader-circle-uAwpvfys.js → loader-circle-B2B8LbUu.js} +1 -1
  255. package/dist/{cdn/chunks/logger-ByvdoAwq.js → logger-k9Nbj3Cp.js} +5 -3
  256. package/dist/{message-circle-DWU1pTM_.js → message-circle-BEuiNsyZ.js} +1 -1
  257. package/dist/{cdn/chunks/nl-ClJ3BY3F.js → nl-CvVuHYFL.js} +147 -8
  258. package/dist/normalizeMergeTagMarkup-P6SUBuPv.js +197 -0
  259. package/dist/{package-CbyG_yU_.js → package-DCROB4aM.js} +1 -1
  260. package/dist/{pencil-BzoDcwKu.js → pencil-CEotCKbf.js} +1 -1
  261. package/dist/{preRenderCustomBlocks-DMP5RuHl.js → preRenderCustomBlocks-D8rr61_z.js} +3 -3
  262. package/dist/pt-BR-CHM-ZKvE.js +20 -0
  263. package/dist/{cdn/chunks/pt-BR-DibcXcmv.js → pt-BR-ZhO4vgyq.js} +147 -8
  264. package/dist/{refresh-cw-9WinWixo.js → refresh-cw-C6M2mHNC.js} +12 -2
  265. package/dist/{runtime-dom.esm-bundler-lFF-QG3j.js → runtime-dom.esm-bundler-B8WCZWUm.js} +134 -134
  266. package/dist/sanitizeRichTextHtml-DeISfLFr.js +60 -0
  267. package/dist/{search-CqgGq1gG.js → search-Cy99zPYf.js} +1 -1
  268. package/dist/{send-Ceo3c9Db.js → send-BDLJFsf3.js} +1 -1
  269. package/dist/{smartphone-CcLaCpGK.js → smartphone-CVvQaNA4.js} +1 -1
  270. package/dist/socialIcons-Dd-jRiVe.js +2086 -0
  271. package/dist/{sparkles-Do9XjAuT.js → sparkles-Ce0Qz0ox.js} +1 -1
  272. package/dist/square-BWlolnXe.js +15 -0
  273. package/dist/style.css +1 -1
  274. package/dist/{styleConstants-D1Jz-TFU.js → styleConstants-v1dNKgJf.js} +1 -3
  275. package/dist/templatical-editor.js +2272 -1327
  276. package/dist/{text-align-start-DvzC0HQA.js → text-align-start-D1V5gPTy.js} +1 -1
  277. package/dist/{trash-vlINTx32.js → trash-CZfiUFmw.js} +1 -1
  278. package/dist/{triangle-alert-MRYSJ9T2.js → triangle-alert-CFDzyFC7.js} +1 -1
  279. package/dist/upload-BJfvdIrD.js +36 -0
  280. package/dist/{useCloudI18n-Nwqo7pI_.js → useCloudI18n-Dcjua65H.js} +5 -5
  281. package/dist/{useEditorCore-PvErWWsp.js → useEditorCore-BTLeAVlM.js} +1534 -1549
  282. package/dist/{useEditorRoot-BD3piYtD.js → useEditorRoot-DUy67lJu.js} +2 -2
  283. package/dist/{useI18n-CxVEpurs.js → useI18n-BdoY7xDE.js} +4 -4
  284. package/dist/{useLogicTag-BHn67tDd.js → useLogicTag-DKLZ1T9H.js} +3 -3
  285. package/dist/{useMergeTag-CRkm5Ig6.js → useMergeTag-Bhdx7AKk.js} +5 -5
  286. package/dist/{usePopoverPosition-CwnH1o5g.js → usePopoverPosition-BZea45XK.js} +2 -2
  287. package/dist/useScrollToBlock-FmNMALM_.js +74 -0
  288. package/dist/{vue.runtime.esm-bundler-CAzmrXdD.js → vue.runtime.esm-bundler-DgFJ6GPG.js} +1182 -1087
  289. package/dist/{withCurrentFont-CxRGeHO3.js → withCurrentFont-BATJHNve.js} +1 -1
  290. package/dist/{x-Cd6SFw8r.js → x-CZ0Js0hA.js} +1 -1
  291. package/package.json +17 -15
  292. package/dist/AiChatSidebar-DxPHFNoT.js +0 -230
  293. package/dist/AiFeatureMenu-C8GVqu1d.js +0 -57
  294. package/dist/CloudHeaderExtras-CUSftQdm.js +0 -59
  295. package/dist/CloudPanels-Dgw7tb4R.js +0 -216
  296. package/dist/CollaboratorBar-5rfopCPx.js +0 -103
  297. package/dist/CommentsSidebar-BOqj16Al.js +0 -500
  298. package/dist/DesignReferenceSidebar-BWAi3eQQ.js +0 -279
  299. package/dist/IssuesPanel-C-x3I012.js +0 -117
  300. package/dist/ParagraphEditor-BVjOwwHx.js +0 -797
  301. package/dist/SavedBlocksBrowserModal-DbmIS5uK.js +0 -360
  302. package/dist/TemplateScoringPanel-ynbGl-sr.js +0 -273
  303. package/dist/TemplateSettings-Bi01S3H3.js +0 -246
  304. package/dist/ToggleSwitch-Ozc7YU38.js +0 -102
  305. package/dist/Toolbar-B-2lO0I8.js +0 -3156
  306. package/dist/WrapperBlock-D0qgNqjD.js +0 -45
  307. package/dist/cdn/chunks/AiChatSidebar-Dk0rJBQN.js +0 -205
  308. package/dist/cdn/chunks/AiChatSidebar-Dk0rJBQN.js.map +0 -1
  309. package/dist/cdn/chunks/AiFeatureMenu-B7b0w8ZS.js +0 -57
  310. package/dist/cdn/chunks/AiFeatureMenu-B7b0w8ZS.js.map +0 -1
  311. package/dist/cdn/chunks/CloudHeaderExtras-B4fhuwc_.js +0 -60
  312. package/dist/cdn/chunks/CloudHeaderExtras-B4fhuwc_.js.map +0 -1
  313. package/dist/cdn/chunks/CloudPanels-awqHfJqC.js.map +0 -1
  314. package/dist/cdn/chunks/CollaboratorBar-CS0ivqkr.js +0 -52
  315. package/dist/cdn/chunks/CollaboratorBar-CS0ivqkr.js.map +0 -1
  316. package/dist/cdn/chunks/CommentsPanel-CbzxwsyI.js +0 -20
  317. package/dist/cdn/chunks/CommentsSidebar-DWPHZuQm.js +0 -470
  318. package/dist/cdn/chunks/DesignReferenceSidebar-BW9cHnA9.js +0 -229
  319. package/dist/cdn/chunks/DesignReferenceSidebar-BW9cHnA9.js.map +0 -1
  320. package/dist/cdn/chunks/IssuesPanel-cXf9ywA4.js +0 -100
  321. package/dist/cdn/chunks/IssuesPanel-cXf9ywA4.js.map +0 -1
  322. package/dist/cdn/chunks/LogicTagInsertButton-BMB9vShs.js.map +0 -1
  323. package/dist/cdn/chunks/MediaEditModal-zXfcArr4.js.map +0 -1
  324. package/dist/cdn/chunks/MediaPanels-Cp4XB_dH.js +0 -45
  325. package/dist/cdn/chunks/ParagraphEditor-D4aq9eeC.js +0 -632
  326. package/dist/cdn/chunks/ParagraphEditor-D4aq9eeC.js.map +0 -1
  327. package/dist/cdn/chunks/SavedBlocksPanels-BhEOMzEQ.js +0 -38
  328. package/dist/cdn/chunks/TemplateScoringPanel-BrWqJCSP.js +0 -237
  329. package/dist/cdn/chunks/TemplateScoringPanel-BrWqJCSP.js.map +0 -1
  330. package/dist/cdn/chunks/TemplateSettings-BkkWTDHD.js +0 -208
  331. package/dist/cdn/chunks/TestEmailPanel-DxrKuctP.js +0 -35
  332. package/dist/cdn/chunks/TitleEditor-CsZiG3TT.js +0 -199
  333. package/dist/cdn/chunks/ToggleSwitch-BB-bQADJ.js +0 -104
  334. package/dist/cdn/chunks/ToggleSwitch-BB-bQADJ.js.map +0 -1
  335. package/dist/cdn/chunks/Toolbar-C_x2TfFk.js.map +0 -1
  336. package/dist/cdn/chunks/VersionHistoryPanels-DXSqmaLS.js +0 -48
  337. package/dist/cdn/chunks/WrapperBlock-gG_Bleug.js +0 -47
  338. package/dist/cdn/chunks/blockTypeIcons-HrMJDfVg.js +0 -22
  339. package/dist/cdn/chunks/ca-CbNzJM3I.js.map +0 -1
  340. package/dist/cdn/chunks/cloud-BHClP3e2.js +0 -1736
  341. package/dist/cdn/chunks/cloud-BHClP3e2.js.map +0 -1
  342. package/dist/cdn/chunks/createCloudRuntime-Vd0N4elZ.js +0 -400
  343. package/dist/cdn/chunks/createCloudRuntime-Vd0N4elZ.js.map +0 -1
  344. package/dist/cdn/chunks/de-DMquBpZM.js.map +0 -1
  345. package/dist/cdn/chunks/de-mMY5yQJu.js +0 -93
  346. package/dist/cdn/chunks/de-mMY5yQJu.js.map +0 -1
  347. package/dist/cdn/chunks/draggable-DrsNwZuB.js.map +0 -1
  348. package/dist/cdn/chunks/en-C8Mp71sO.js.map +0 -1
  349. package/dist/cdn/chunks/en-ChVeGQBY.js +0 -93
  350. package/dist/cdn/chunks/en-ChVeGQBY.js.map +0 -1
  351. package/dist/cdn/chunks/en-eWpiXyZu.js +0 -1
  352. package/dist/cdn/chunks/es-Byq4tthI.js.map +0 -1
  353. package/dist/cdn/chunks/fr-B3j35HEw.js.map +0 -1
  354. package/dist/cdn/chunks/icons-aTYwH5-g.js.map +0 -1
  355. package/dist/cdn/chunks/ja-D7txAuGS.js.map +0 -1
  356. package/dist/cdn/chunks/keys-HI-INbkz.js +0 -12
  357. package/dist/cdn/chunks/keys-HI-INbkz.js.map +0 -1
  358. package/dist/cdn/chunks/logger-ByvdoAwq.js.map +0 -1
  359. package/dist/cdn/chunks/nl-ClJ3BY3F.js.map +0 -1
  360. package/dist/cdn/chunks/pt-BR-CoCwRUi0.js +0 -93
  361. package/dist/cdn/chunks/pt-BR-CoCwRUi0.js.map +0 -1
  362. package/dist/cdn/chunks/pt-BR-DibcXcmv.js.map +0 -1
  363. package/dist/cdn/chunks/pusher-C8DeiO2X.js.map +0 -1
  364. package/dist/cdn/chunks/socialIcons-C_lnkpG6.js +0 -1279
  365. package/dist/cdn/chunks/socialIcons-C_lnkpG6.js.map +0 -1
  366. package/dist/cdn/chunks/src-DYCDeBDM.js.map +0 -1
  367. package/dist/cdn/chunks/src-DlFlC9Tt.js +0 -1272
  368. package/dist/cdn/chunks/src-DlFlC9Tt.js.map +0 -1
  369. package/dist/cdn/chunks/src-dZ4D_tuP.js.map +0 -1
  370. package/dist/cdn/chunks/timeouts-Cv2jvusx.js +0 -6
  371. package/dist/cdn/chunks/timeouts-Cv2jvusx.js.map +0 -1
  372. package/dist/cdn/chunks/tiptap-BPigZk5G.js.map +0 -1
  373. package/dist/cdn/chunks/useAliveFlag-DCB96vzR.js +0 -12
  374. package/dist/cdn/chunks/useAliveFlag-DCB96vzR.js.map +0 -1
  375. package/dist/cdn/chunks/useEditorCore-Bb2UcB20.js +0 -2602
  376. package/dist/cdn/chunks/useEditorCore-Bb2UcB20.js.map +0 -1
  377. package/dist/cdn/chunks/useEditorRoot-CTc6O8al.js +0 -10
  378. package/dist/cdn/chunks/useScrollToBlock-uUa601I4.js +0 -21
  379. package/dist/cdn/chunks/useScrollToBlock-uUa601I4.js.map +0 -1
  380. package/dist/cloud-B5xwm_4X.js +0 -1689
  381. package/dist/copy-BEcsAlfB.js +0 -19
  382. package/dist/createCloudRuntime-zNPkF6T9.js +0 -398
  383. package/dist/de-mMY5yQJu.js +0 -91
  384. package/dist/dist-DAAJogrx.js +0 -407
  385. package/dist/en-B0FUfNwz.js +0 -1
  386. package/dist/en-ChVeGQBY.js +0 -91
  387. package/dist/image-up-CM_HC0Dx.js +0 -27
  388. package/dist/keys-BKFq19a2.js +0 -10
  389. package/dist/plus-8cDvoCjZ.js +0 -14
  390. package/dist/pt-BR-CoCwRUi0.js +0 -91
  391. package/dist/shield-check-uDAwur5D.js +0 -14
  392. package/dist/socialIcons-PTiwhLoC.js +0 -1359
  393. package/dist/timeouts-Cv2jvusx.js +0 -4
  394. package/dist/upload-CtNOI6J2.js +0 -21
  395. package/dist/useAliveFlag-Dd06mRxe.js +0 -10
  396. package/dist/useScrollToBlock-CXmcHQQN.js +0 -47
@@ -0,0 +1,2086 @@
1
+ import { At as e, C as t, G as n, Mt as r, O as i, Q as a, U as o, X as s, Y as c, Z as l, _ as u, c as d, et as f, f as p, g as m, it as h, j as g, jt as _, ot as v, r as y, st as b, y as x, z as S } from "./vue.runtime.esm-bundler-DgFJ6GPG.js";
2
+ import { C, D as w, K as T, V as E, _ as ee, b as D, ct as O, d as k, f as A, g as j, h as M, l as N, mt as P, ot as F, p as I, q as L, tt as te, v as R, vt as z, wt as B, x as V, y as H } from "./dist-DtOF3bDW.js";
3
+ import { r as ne } from "./dist-DI4_YSnG.js";
4
+ import { L as U, P as re, c as ie, x as W } from "./keys-Zd9KWRD1.js";
5
+ import { t as ae } from "./useI18n-BdoY7xDE.js";
6
+ import { o as oe, s as G } from "./usePopoverPosition-BZea45XK.js";
7
+ import { t as K } from "./createLucideIcon-0lYYH3EW.js";
8
+ import { t as se } from "./upload-BJfvdIrD.js";
9
+ import { t as ce } from "./loader-circle-B2B8LbUu.js";
10
+ //#region ../core/dist/index.js
11
+ function q(e) {
12
+ return e instanceof Error ? e : Error(String(e), { cause: e });
13
+ }
14
+ function J(e, t) {
15
+ try {
16
+ t();
17
+ } catch (t) {
18
+ e?.(q(t));
19
+ }
20
+ }
21
+ function le(e) {
22
+ let t = e.content ?? w(e.defaultFontFamily, e.templateDefaults);
23
+ R(t), H(t);
24
+ let n = s({
25
+ template: null,
26
+ content: t,
27
+ selectedBlockId: null,
28
+ viewport: "desktop",
29
+ darkMode: !1,
30
+ previewMode: !1,
31
+ isDirty: !1,
32
+ isSaving: !1,
33
+ isLoading: !1,
34
+ uiTheme: "auto"
35
+ }), r = a(0), i = 0, c = 0;
36
+ function u() {
37
+ n.isDirty = !0, c++;
38
+ }
39
+ let d = o({
40
+ get: () => n.content,
41
+ set: (e) => {
42
+ n.content = e, u();
43
+ }
44
+ }), f = o(() => n.selectedBlockId ? p(n.content.blocks, n.selectedBlockId) : null);
45
+ function p(e, t) {
46
+ for (let n of e) {
47
+ if (n.id === t) return n;
48
+ if (n.type === "section") for (let e of n.children) {
49
+ let n = p(e, t);
50
+ if (n) return n;
51
+ }
52
+ }
53
+ return null;
54
+ }
55
+ function m(e, t) {
56
+ if (t.add(e.id), e.type === "section") for (let n of e.children) for (let e of n) m(e, t);
57
+ }
58
+ function h(e, t, n = { blocks: e }) {
59
+ for (let r = 0; r < e.length; r++) {
60
+ let i = e[r];
61
+ if (i.id === t) return n;
62
+ if (i.type === "section") for (let e = 0; e < i.children.length; e++) {
63
+ let n = h(i.children[e], t, {
64
+ blocks: i.children[e],
65
+ sectionId: i.id,
66
+ columnIndex: e
67
+ });
68
+ if (n) return n;
69
+ }
70
+ }
71
+ return null;
72
+ }
73
+ function g(t) {
74
+ return e.lockedBlocks?.value.has(t) ?? !1;
75
+ }
76
+ function _(e) {
77
+ let t = h(n.content.blocks, e);
78
+ if (!t) return null;
79
+ let r = t.blocks.findIndex((t) => t.id === e);
80
+ return r === -1 ? null : {
81
+ targetSectionId: t.sectionId,
82
+ columnIndex: t.columnIndex,
83
+ index: r
84
+ };
85
+ }
86
+ function v(e, t = !0) {
87
+ R(e), H(e), n.content = e, t && u();
88
+ }
89
+ function y(e) {
90
+ e && g(e) || (n.selectedBlockId = e);
91
+ }
92
+ function b(e) {
93
+ n.viewport = e;
94
+ }
95
+ function x(e) {
96
+ n.darkMode = e;
97
+ }
98
+ function S(e) {
99
+ n.uiTheme = e;
100
+ }
101
+ function C(e) {
102
+ n.previewMode = e, e && (n.selectedBlockId = null);
103
+ }
104
+ function T(e, t) {
105
+ if (g(e)) return;
106
+ let r = p(n.content.blocks, e);
107
+ r && (Object.assign(r, t), u());
108
+ }
109
+ function E(e) {
110
+ n.content.settings = {
111
+ ...n.content.settings,
112
+ ...e
113
+ }, u();
114
+ }
115
+ function ee(e, t, r = 0, i) {
116
+ let a = {
117
+ settings: n.content.settings,
118
+ blocks: [e]
119
+ };
120
+ if (R(a), H(a), !(t && e.type === "section")) {
121
+ if (t) {
122
+ if (g(t)) return;
123
+ let a = p(n.content.blocks, t);
124
+ if (a && a.type === "section") {
125
+ if (r < 0 || r >= L(a.columns)) return;
126
+ a.children[r] = a.children[r] || [];
127
+ let t = a.children[r];
128
+ i !== void 0 && i < t.length ? t.splice(i, 0, e) : t.push(e);
129
+ }
130
+ } else i !== void 0 && i < n.content.blocks.length ? n.content.blocks.splice(i, 0, e) : n.content.blocks.push(e);
131
+ u();
132
+ }
133
+ }
134
+ function D(e) {
135
+ if (g(e)) return;
136
+ let t = h(n.content.blocks, e);
137
+ if (t) {
138
+ let r = t.blocks.findIndex((t) => t.id === e);
139
+ if (r !== -1) {
140
+ let [e] = t.blocks.splice(r, 1);
141
+ if (n.selectedBlockId) {
142
+ let t = /* @__PURE__ */ new Set();
143
+ m(e, t), t.has(n.selectedBlockId) && (n.selectedBlockId = null);
144
+ }
145
+ u();
146
+ }
147
+ }
148
+ }
149
+ function O(e, t, r, i = 0) {
150
+ if (g(e) || r && g(r)) return;
151
+ let a = h(n.content.blocks, e);
152
+ if (!a) return;
153
+ let o = a.blocks.findIndex((t) => t.id === e);
154
+ if (o === -1 || r && a.blocks[o].type === "section") return;
155
+ let s;
156
+ if (r) {
157
+ let e = p(n.content.blocks, r);
158
+ if (!e || e.type !== "section" || i < 0 || i >= L(e.columns)) return;
159
+ e.children[i] = e.children[i] || [], s = e.children[i];
160
+ } else s = n.content.blocks;
161
+ let [c] = a.blocks.splice(o, 1);
162
+ s.splice(t, 0, c), u();
163
+ }
164
+ function k() {
165
+ u();
166
+ }
167
+ function A(e, t) {
168
+ throw new I(`[Templatical] Templates: ${e} ${t}`);
169
+ }
170
+ function j(t) {
171
+ J(e.onError, t);
172
+ }
173
+ function M(t) {
174
+ let { templates: n } = e;
175
+ return n || A(t, "needs a templates provider. Pass one as `init({ templates })` to enable saving and loading."), n;
176
+ }
177
+ function N(e) {
178
+ n.template && (n.template = {
179
+ ...n.template,
180
+ name: e
181
+ }, u());
182
+ }
183
+ async function P(t) {
184
+ let a = M("create()"), { create: o } = a;
185
+ typeof o != "function" && A("create()", "is disabled by the provider — its `create` is `false`.");
186
+ let s, l = ++i;
187
+ n.isLoading = !0;
188
+ try {
189
+ t?.content && (n.content = t.content);
190
+ let e = c;
191
+ s = await o(t?.name === void 0 ? { content: n.content } : {
192
+ name: t.name,
193
+ content: n.content
194
+ }), n.template = s, c === e && (n.isDirty = !1), r.value++;
195
+ } catch (t) {
196
+ throw e.onError?.(t), t;
197
+ } finally {
198
+ i === l && (n.isLoading = !1);
199
+ }
200
+ return j(() => a.onCreated?.(s)), s;
201
+ }
202
+ async function F(t, a) {
203
+ let o = M("load()"), s, c = ++i;
204
+ n.isLoading = !0;
205
+ try {
206
+ if (s = await o.load(t), R(s.content), H(s.content), a && !a()) return s;
207
+ n.template = s, n.content = s.content, n.isDirty = !1, r.value++;
208
+ } catch (t) {
209
+ throw e.onError?.(t), t;
210
+ } finally {
211
+ i === c && (n.isLoading = !1);
212
+ }
213
+ return j(() => o.onLoaded?.(s)), s;
214
+ }
215
+ async function te(t = "api") {
216
+ let r = M("save()"), { save: i } = r;
217
+ typeof i != "function" && A("save()", "is disabled by the provider — its `save` is `false`.");
218
+ let a = n.template;
219
+ a || A("save()", "has no template loaded. Call create() or load() first.");
220
+ let o = a.name === void 0 ? { content: n.content } : {
221
+ name: a.name,
222
+ content: n.content
223
+ }, s;
224
+ n.isSaving = !0;
225
+ try {
226
+ let e = c;
227
+ if (s = await i(a.id, o), n.template?.id === a.id) {
228
+ let e = n.template.name;
229
+ n.template = e === a.name ? s : {
230
+ ...s,
231
+ name: e
232
+ };
233
+ }
234
+ c === e && (n.isDirty = !1);
235
+ } catch (t) {
236
+ throw e.onError?.(t), t;
237
+ } finally {
238
+ n.isSaving = !1;
239
+ }
240
+ return j(() => r.onSaved?.(s, { trigger: t })), s;
241
+ }
242
+ function z() {
243
+ return n.template?.id !== void 0;
244
+ }
245
+ return {
246
+ state: l(n),
247
+ loadVersion: l(r),
248
+ content: d,
249
+ selectedBlock: f,
250
+ isBlockLocked: g,
251
+ setContent: v,
252
+ selectBlock: y,
253
+ setViewport: b,
254
+ setDarkMode: x,
255
+ setUiTheme: S,
256
+ setPreviewMode: C,
257
+ updateBlock: T,
258
+ updateSettings: E,
259
+ addBlock: ee,
260
+ removeBlock: D,
261
+ moveBlock: O,
262
+ markDirty: k,
263
+ findBlockLocation: _,
264
+ setName: N,
265
+ create: P,
266
+ load: F,
267
+ save: te,
268
+ hasTemplate: z
269
+ };
270
+ }
271
+ var ue = 50, Y = 300, de = 1500;
272
+ function fe(e) {
273
+ let { content: t, setContent: n, maxSize: r = ue } = e, i = a([]), s = a([]), c = a(!1), l = null, u = null, d = o(() => i.value.length > 0), f = o(() => s.value.length > 0);
274
+ function p() {
275
+ return z(t.value);
276
+ }
277
+ function m(e) {
278
+ i.value.push(e), i.value.length > r && i.value.splice(0, i.value.length - r);
279
+ }
280
+ function h() {
281
+ u &&= (clearTimeout(u.timeoutId), null);
282
+ }
283
+ function g() {
284
+ h(), m(p()), s.value = [];
285
+ }
286
+ function _(e) {
287
+ u && u.blockId === e ? (clearTimeout(u.timeoutId), u.timeoutId = setTimeout(() => {
288
+ u = null;
289
+ }, Y)) : (h(), m(p()), s.value = [], u = {
290
+ blockId: e,
291
+ timeoutId: setTimeout(() => {
292
+ u = null;
293
+ }, Y)
294
+ });
295
+ }
296
+ function v() {
297
+ c.value = !0, l && clearTimeout(l), l = setTimeout(() => {
298
+ c.value = !1, l = null;
299
+ }, de);
300
+ }
301
+ function y() {
302
+ if (i.value.length === 0) return;
303
+ h();
304
+ let e = i.value.pop();
305
+ s.value.push(p()), n(e, !0), v();
306
+ }
307
+ function b() {
308
+ if (s.value.length === 0) return;
309
+ h();
310
+ let e = s.value.pop();
311
+ i.value.push(p()), n(e, !0), v();
312
+ }
313
+ function x() {
314
+ i.value = [], s.value = [], h();
315
+ }
316
+ function S() {
317
+ x(), l &&= (clearTimeout(l), null);
318
+ }
319
+ return {
320
+ canUndo: d,
321
+ canRedo: f,
322
+ isNavigating: c,
323
+ undo: y,
324
+ redo: b,
325
+ record: g,
326
+ recordDebounced: _,
327
+ clear: x,
328
+ destroy: S
329
+ };
330
+ }
331
+ function pe(e) {
332
+ let { addBlock: t, removeBlock: n, updateBlock: r, selectBlock: i, findBlockLocation: a } = e;
333
+ function o(n, r, a) {
334
+ let o = typeof e.blockDefaults == "function" ? e.blockDefaults() : e.blockDefaults, s = C(n, o);
335
+ return t(s, r, a), i(s.id), s;
336
+ }
337
+ function s(e, n, r) {
338
+ let o = D(e);
339
+ if (n !== void 0 || r !== void 0) t(o, n, r);
340
+ else {
341
+ let i = a?.(e.id) ?? null;
342
+ i ? t(o, i.targetSectionId, i.columnIndex, i.index + 1) : t(o, n, r);
343
+ }
344
+ return i(o.id), o;
345
+ }
346
+ function c(e) {
347
+ n(e);
348
+ }
349
+ function l(e, t, n) {
350
+ r(e, { [t]: n });
351
+ }
352
+ return {
353
+ createAndAddBlock: o,
354
+ duplicateBlock: s,
355
+ deleteBlock: c,
356
+ updateBlockProperty: l
357
+ };
358
+ }
359
+ var X = 2e3;
360
+ function me(e) {
361
+ let { content: t, isDirty: n, onChange: r, debounce: i = X, enabled: a = !0 } = e, o = null, s = !1;
362
+ function c() {
363
+ return typeof a == "function" ? a() : a;
364
+ }
365
+ function l() {
366
+ s = !0, d();
367
+ }
368
+ function u() {
369
+ s = !1;
370
+ }
371
+ function d() {
372
+ o &&= (clearTimeout(o), null);
373
+ }
374
+ function f() {
375
+ d(), n() && r(JSON.parse(JSON.stringify(t.value)));
376
+ }
377
+ function p() {
378
+ c() && !s && (d(), o = setTimeout(() => {
379
+ o = null, c() && !s && n() && r(JSON.parse(JSON.stringify(t.value)));
380
+ }, i));
381
+ }
382
+ let m = b(t, () => {
383
+ p();
384
+ }, { deep: !0 });
385
+ function h() {
386
+ m(), d();
387
+ }
388
+ return {
389
+ flush: f,
390
+ cancel: d,
391
+ pause: l,
392
+ resume: u,
393
+ destroy: h
394
+ };
395
+ }
396
+ function he(e) {
397
+ let t = s(/* @__PURE__ */ new Set()), n = o(() => t.size > 0);
398
+ function r(e) {
399
+ return t.has(e);
400
+ }
401
+ function i(n) {
402
+ t.has(n) ? t.delete(n) : (t.add(n), e.state.selectedBlockId === n && e.selectBlock(null));
403
+ }
404
+ function a() {
405
+ t.clear();
406
+ }
407
+ return {
408
+ isHidden: r,
409
+ toggleBlock: i,
410
+ reset: a,
411
+ hasHiddenBlocks: n
412
+ };
413
+ }
414
+ function ge(e) {
415
+ let t = a(!1), n = a(!1), r = o(() => !!e.definition.value?.dataSource), i = o(() => r.value && !e.block.value.dataSourceFetched);
416
+ async function s() {
417
+ let r = e.definition.value;
418
+ if (r?.dataSource) {
419
+ t.value = !0, n.value = !1;
420
+ try {
421
+ let t = await r.dataSource.onFetch({
422
+ fieldValues: { ...e.block.value.fieldValues },
423
+ blockId: e.block.value.id
424
+ });
425
+ if (t == null) return;
426
+ let n = { ...e.block.value.fieldValues };
427
+ for (let e of Object.keys(n)) e in t && (n[e] = t[e]);
428
+ e.onUpdate(n, !0);
429
+ } catch (e) {
430
+ console.warn("[Templatical] Data source fetch error:", e), n.value = !0;
431
+ } finally {
432
+ t.value = !1;
433
+ }
434
+ }
435
+ }
436
+ return {
437
+ isFetching: t,
438
+ fetchError: n,
439
+ fetch: s,
440
+ hasDataSource: r,
441
+ needsFetch: i
442
+ };
443
+ }
444
+ function _e(e, t) {
445
+ let n = e.addBlock, r = e.removeBlock, i = e.moveBlock, a = e.updateBlock, o = e.updateSettings;
446
+ e.addBlock = (r, i, a, o) => {
447
+ i && e.isBlockLocked(i) || (t.record(), n(r, i, a, o));
448
+ }, e.removeBlock = (n) => {
449
+ e.isBlockLocked(n) || (t.record(), r(n));
450
+ }, e.moveBlock = (n, r, a, o) => {
451
+ e.isBlockLocked(n) || a && e.isBlockLocked(a) || (t.record(), i(n, r, a, o));
452
+ }, e.updateBlock = (n, r) => {
453
+ e.isBlockLocked(n) || (t.recordDebounced(n), a(n, r));
454
+ }, e.updateSettings = (e) => {
455
+ t.record(), o(e);
456
+ };
457
+ }
458
+ var ve = "root", ye = /* @__PURE__ */ new Set([
459
+ "id",
460
+ "type",
461
+ "children"
462
+ ]), be = /* @__PURE__ */ new Set([
463
+ "id",
464
+ "type",
465
+ "children",
466
+ "columns"
467
+ ]), xe = /* @__PURE__ */ new Set();
468
+ function Se(e) {
469
+ return e === null ? ve : JSON.stringify([e.sectionId, e.column]);
470
+ }
471
+ function Z(e) {
472
+ let t = e.children;
473
+ return e.type === "section" && Array.isArray(t) ? t : [];
474
+ }
475
+ function Ce(e) {
476
+ let t = /* @__PURE__ */ new Map(), n = (e, r) => {
477
+ e.forEach((e, i) => {
478
+ t.has(e.id) || t.set(e.id, {
479
+ block: e,
480
+ key: Se(r),
481
+ index: i
482
+ }), Z(e).forEach((t, r) => {
483
+ Array.isArray(t) && n(t, {
484
+ sectionId: e.id,
485
+ column: r
486
+ });
487
+ });
488
+ });
489
+ };
490
+ return n(e, null), t;
491
+ }
492
+ function we(e) {
493
+ let t = [], n = Array(e.length).fill(-1);
494
+ e.forEach((r, i) => {
495
+ let a = 0, o = t.length;
496
+ for (; a < o;) {
497
+ let n = a + o >> 1;
498
+ e[t[n]] < r ? a = n + 1 : o = n;
499
+ }
500
+ a > 0 && (n[i] = t[a - 1]), t[a] = i;
501
+ });
502
+ let r = /* @__PURE__ */ new Set(), i = t.length > 0 ? t[t.length - 1] : -1;
503
+ for (; i !== -1;) r.add(i), i = n[i];
504
+ return r;
505
+ }
506
+ function Q(e, t, n) {
507
+ let r = {}, i = [];
508
+ for (let i of Object.keys(t)) n.has(i) || t[i] === void 0 || E(e[i], t[i]) || (r[i] = z(t[i]));
509
+ for (let r of Object.keys(e)) n.has(r) || e[r] === void 0 || t[r] === void 0 && i.push(r);
510
+ return {
511
+ set: r,
512
+ unset: i
513
+ };
514
+ }
515
+ function Te(e, t) {
516
+ let n = Ce(e.blocks), r = Ce(t.blocks), i = [], a = (e) => {
517
+ let t = r.get(e), i = n.get(e);
518
+ return t !== void 0 && i !== void 0 && t.block.type !== i.block.type;
519
+ }, o = (e) => r.has(e.id) && !a(e.id), s = (e) => Z(e).some((e) => Array.isArray(e) && e.some((e) => o(e) || !a(e.id) && s(e))), c = /* @__PURE__ */ new Set(), l = [], u = (e, t) => {
520
+ let n = "kept";
521
+ t === "dropped" ? (c.add(e.id), n = "dropped") : a(e.id) ? (i.push({
522
+ op: "deleteBlock",
523
+ blockId: e.id
524
+ }), c.add(e.id), n = "dropped") : r.has(e.id) || (t === "deferred" ? n = "deferred" : s(e) ? (l.push(e.id), n = "deferred") : (i.push({
525
+ op: "deleteBlock",
526
+ blockId: e.id
527
+ }), c.add(e.id), n = "dropped"));
528
+ for (let t of Z(e)) if (Array.isArray(t)) for (let e of t) u(e, n);
529
+ };
530
+ for (let t of e.blocks) u(t, "kept");
531
+ let d = (e) => n.has(e) && !c.has(e), f = (e) => {
532
+ let t = z(e);
533
+ return t.type === "section" && (t.children = Z(e).map((e) => Array.isArray(e) ? e.filter((e) => !d(e.id)).map((e) => z(e)) : e)), t;
534
+ }, p = (e, t, r) => {
535
+ let a = Se(e), o = [], s = [];
536
+ t.forEach((e, t) => {
537
+ let r = n.get(e.id);
538
+ d(e.id) && r !== void 0 && r.key === a && (o.push(r.index), s.push(t));
539
+ });
540
+ let c = new Set([...we(o)].map((e) => s[e]));
541
+ t.forEach((n, a) => {
542
+ if (c.has(a) || r(n)) return;
543
+ let o = a > 0 ? t[a - 1].id : null;
544
+ i.push(d(n.id) ? {
545
+ op: "moveBlock",
546
+ blockId: n.id,
547
+ parent: e,
548
+ after: o
549
+ } : {
550
+ op: "addBlock",
551
+ block: f(n),
552
+ parent: e,
553
+ after: o
554
+ });
555
+ });
556
+ };
557
+ p(null, t.blocks, () => !1);
558
+ let m = t.blocks.filter((e) => e.type === "section"), h = /* @__PURE__ */ new Set(), g = (e) => {
559
+ for (let t of m) {
560
+ if (!d(t.id)) continue;
561
+ let r = Z(n.get(t.id).block).length, a = Z(t).length;
562
+ (e ? a > r : a < r) && (i.push({
563
+ op: "updateBlock",
564
+ blockId: t.id,
565
+ set: { columns: t.columns }
566
+ }), h.add(t.id));
567
+ }
568
+ };
569
+ g(!0);
570
+ for (let e of m) {
571
+ let t = !d(e.id);
572
+ Z(e).forEach((n, r) => {
573
+ Array.isArray(n) && p({
574
+ sectionId: e.id,
575
+ column: r
576
+ }, n, (e) => t && !d(e.id));
577
+ });
578
+ }
579
+ g(!1);
580
+ for (let e of l) i.push({
581
+ op: "deleteBlock",
582
+ blockId: e
583
+ });
584
+ for (let [e, t] of r) {
585
+ if (!d(e)) continue;
586
+ let { set: r, unset: a } = Q(n.get(e).block, t.block, h.has(e) ? be : ye);
587
+ (Object.keys(r).length !== 0 || a.length !== 0) && i.push({
588
+ op: "updateBlock",
589
+ blockId: e,
590
+ ...Object.keys(r).length > 0 ? { set: r } : {},
591
+ ...a.length > 0 ? { unset: a } : {}
592
+ });
593
+ }
594
+ let _ = Q(e.settings, t.settings, xe);
595
+ return (Object.keys(_.set).length > 0 || _.unset.length > 0) && i.push({
596
+ op: "updateSettings",
597
+ ...Object.keys(_.set).length > 0 ? { set: _.set } : {},
598
+ ..._.unset.length > 0 ? { unset: _.unset } : {}
599
+ }), i;
600
+ }
601
+ var Ee = 1e3, De = 1e4, Oe = [
602
+ 1e3,
603
+ 2e3,
604
+ 5e3,
605
+ 1e4,
606
+ 3e4
607
+ ], ke = 50, Ae = 100, je = /* @__PURE__ */ new Set([
608
+ "block_exists",
609
+ "block_missing",
610
+ "anchor_missing",
611
+ "precondition_failed",
612
+ "lock_held",
613
+ "locked_by_others",
614
+ "invalid_operation",
615
+ "lock_lost",
616
+ "content_too_large"
617
+ ]);
618
+ function Me(e) {
619
+ let t = e?.code;
620
+ return typeof t == "string" && je.has(t) ? t : null;
621
+ }
622
+ function Ne(e) {
623
+ let t = e?.holder;
624
+ return typeof t == "object" && t && typeof t.sessionId == "string" ? t : void 0;
625
+ }
626
+ function Pe(e) {
627
+ let t = e?.statusCode;
628
+ return typeof t != "number" || t >= 500 || t === 408 || t === 429;
629
+ }
630
+ function Fe(e, t) {
631
+ return e.some((e) => {
632
+ if (e.id === t) return !0;
633
+ let n = e.children;
634
+ return e.type === "section" && Array.isArray(n) && n.some((e) => Array.isArray(e) && Fe(e, t));
635
+ });
636
+ }
637
+ function Ie(e) {
638
+ if (e.length === 1 && e[0].op === "updateSettings") return !0;
639
+ let t = e[0];
640
+ return t.op === "updateBlock" && e.every((e) => e.op === "updateBlock" && e.blockId === t.blockId);
641
+ }
642
+ function Le(e) {
643
+ return e.map((e) => {
644
+ if (!("expect" in e)) return e;
645
+ let { expect: t, ...n } = e;
646
+ return n;
647
+ });
648
+ }
649
+ function Re(e) {
650
+ let { provider: t } = e, r = e.sessionId ?? crypto.randomUUID(), i = e.maxUndo ?? ke, s = typeof t.acquireLock == "function" && typeof t.renewLock == "function" && typeof t.releaseLock == "function", l = f([]), u = f(/* @__PURE__ */ new Map()), d = a(null), p = a(0), m = a(0), h = null, g = null, _ = !1, v = !1, y = !1, x = null, S = 0, C = !1, w = [], T = null, D = null, O = Promise.resolve(), k = null, A = o(() => (m.value, (g?.undo.length ?? 0) > 0)), M = o(() => (m.value, (g?.redo.length ?? 0) > 0));
651
+ function P(t) {
652
+ e.onError?.(t instanceof Error ? t : Error(String(t)));
653
+ }
654
+ function F(t, n = g) {
655
+ n !== g || C || e.onNotice?.(t);
656
+ }
657
+ function I() {
658
+ return {
659
+ locks: [...u.value.values()].map((e) => ({
660
+ blockId: e.blockId,
661
+ sessionId: e.holder.sessionId
662
+ })),
663
+ session: r
664
+ };
665
+ }
666
+ function L() {
667
+ m.value++;
668
+ }
669
+ function R(e, t) {
670
+ e.push(t), e.length > i && e.splice(0, e.length - i);
671
+ }
672
+ function B(e) {
673
+ if (!h || _) return;
674
+ v = !0;
675
+ try {
676
+ let t = h.content.value, n = Te(t, e);
677
+ if (n.length > 0) try {
678
+ ee(t, n);
679
+ } catch {
680
+ h.setContent(z(e), !1);
681
+ }
682
+ E(h.content.value, e) || h.setContent(z(e), !1);
683
+ } finally {
684
+ v = !1;
685
+ }
686
+ let t = h.state.selectedBlockId;
687
+ t && !Fe(e.blocks, t) && h.selectBlock(null);
688
+ }
689
+ function V() {
690
+ v || y || (y = !0, queueMicrotask(() => {
691
+ y = !1, ne(!1);
692
+ }));
693
+ }
694
+ function H() {
695
+ x &&= (clearTimeout(x), null);
696
+ }
697
+ function ne(e, t = !1) {
698
+ let n = g;
699
+ if (!h || !n || _ || v || h.state.isLoading && !t || h.state.template?.id !== n.templateId) return;
700
+ let r = Te(n.view, h.content.value);
701
+ if (r.length === 0) H();
702
+ else {
703
+ if (!e && Ie(r)) {
704
+ let e = Date.now();
705
+ if (x === null && (S = e), e - S < 1e3) {
706
+ x && clearTimeout(x), x = setTimeout(() => {
707
+ x = null, ne(!0);
708
+ }, 300);
709
+ return;
710
+ }
711
+ }
712
+ H(), re(n, r);
713
+ }
714
+ }
715
+ function U() {
716
+ ne(!0);
717
+ }
718
+ function re(e, t) {
719
+ let n = t, r;
720
+ try {
721
+ r = j(e.view, n, I());
722
+ } catch (t) {
723
+ if (!(t instanceof N)) throw t;
724
+ B(e.view);
725
+ let n = t.blockId === void 0 ? void 0 : u.value.get(t.blockId)?.holder;
726
+ F({
727
+ type: "editRefused",
728
+ code: t.code,
729
+ ...n ? { holder: n } : {}
730
+ }), t.code === "invalid_operation" && P(t);
731
+ return;
732
+ }
733
+ let i = h.content.value;
734
+ if (!E(r, i)) {
735
+ P(/* @__PURE__ */ Error("[Templatical] Collaboration: a change couldn't be expressed as block operations, so the whole content was sent.")), n = [{
736
+ op: "setContent",
737
+ content: z(i)
738
+ }];
739
+ try {
740
+ r = j(e.view, n, I());
741
+ } catch (t) {
742
+ if (!(t instanceof N)) throw t;
743
+ B(e.view), F({
744
+ type: "editRefused",
745
+ code: t.code
746
+ });
747
+ return;
748
+ }
749
+ }
750
+ let a = { ops: te(e.view, n) };
751
+ R(e.undo, a), e.redo = [], L(), e.view = r, ie(e, n, "edit", a);
752
+ }
753
+ function ie(e, t, n, r) {
754
+ let i = { dropped: !1 }, a = 0;
755
+ do
756
+ e.pending.push({
757
+ batchId: crypto.randomUUID(),
758
+ ops: t.slice(a, a + Ae),
759
+ origin: n,
760
+ entry: r,
761
+ group: i,
762
+ sent: !1,
763
+ revision: null
764
+ }), a += Ae;
765
+ while (a < t.length);
766
+ W(e);
767
+ }
768
+ function W(e) {
769
+ if (e.inFlight) return;
770
+ let t = e.pending.find((e) => !e.sent);
771
+ t ? (t.sent = !0, e.inFlight = t, ae(e, t, 0)) : q(e);
772
+ }
773
+ function ae(e, n, r) {
774
+ t.submit(e.templateId, {
775
+ batchId: n.batchId,
776
+ baseRevision: e.revision,
777
+ ops: n.ops,
778
+ ...n.origin === "ai" ? { origin: "ai" } : {}
779
+ }).then(({ revision: t }) => {
780
+ e.inFlight = null, oe(e, n, t), W(e);
781
+ }, (t) => {
782
+ if (Me(t) !== null) e.inFlight = null, ce(e, n, t), W(e);
783
+ else if (Pe(t)) {
784
+ J(e, t);
785
+ let i = Oe[Math.min(r, Oe.length - 1)];
786
+ setTimeout(() => {
787
+ C || ae(e, n, r + 1);
788
+ }, i);
789
+ } else e.inFlight = null, P(t), ce(e, n, t), W(e);
790
+ });
791
+ }
792
+ function oe(e, t, n) {
793
+ t.revision === null && (t.revision = n, n <= e.revision ? (G(e, t), de(e)) : (e.own.set(n, t), Y(e)));
794
+ }
795
+ function G(e, t) {
796
+ e.pending = e.pending.filter((e) => e !== t), q(e);
797
+ }
798
+ function K(e, t) {
799
+ if (t.entry) {
800
+ for (let n of [e.undo, e.redo]) {
801
+ let e = n.indexOf(t.entry);
802
+ e !== -1 && n.splice(e, 1);
803
+ }
804
+ L();
805
+ }
806
+ }
807
+ function se(e, t) {
808
+ let n = !t.group.dropped;
809
+ return t.group.dropped = !0, e.pending = e.pending.filter((e) => e.group !== t.group || e.sent), n && K(e, t), q(e), n;
810
+ }
811
+ function ce(e, t, n) {
812
+ if (G(e, t), se(e, t)) {
813
+ let r = Me(n) ?? "invalid_operation";
814
+ if (t.origin === "edit" || t.origin === "ai") {
815
+ let t = Ne(n);
816
+ F({
817
+ type: "editRefused",
818
+ code: r,
819
+ ...t ? { holder: t } : {}
820
+ }, e);
821
+ } else F({
822
+ type: "undoSkipped",
823
+ code: r
824
+ }, e);
825
+ }
826
+ de(e), e === g && X();
827
+ }
828
+ function q(e) {
829
+ if (!(e.pending.length > 0 || e.waiters.length === 0)) for (let t of e.waiters.splice(0)) t.resolve();
830
+ }
831
+ function J(e, t) {
832
+ let n = t instanceof Error ? t : Error(String(t));
833
+ for (let t of e.waiters.splice(0)) t.reject(n);
834
+ }
835
+ function le(e, t) {
836
+ if (t.revision <= e.revision) return;
837
+ let n = e.pending.find((e) => e.batchId === t.batchId);
838
+ n ? oe(e, n, t.revision) : (e.remote.set(t.revision, t), Y(e));
839
+ }
840
+ function ue(t, n) {
841
+ let r = n.ops;
842
+ if (e.normalizeRemoteOperations) try {
843
+ r = e.normalizeRemoteOperations(n.ops, t.confirmed);
844
+ } catch (e) {
845
+ P(e);
846
+ }
847
+ return Le(r);
848
+ }
849
+ function Y(t) {
850
+ let n = [], r = !1;
851
+ for (;;) {
852
+ let e = t.revision + 1, i = t.remote.get(e), a = t.own.get(e);
853
+ if (!i && !a) break;
854
+ try {
855
+ t.confirmed = j(t.confirmed, i ? ue(t, i) : a.ops);
856
+ } catch {
857
+ if (t.recovering) {
858
+ t.remote.clear(), t.own.clear(), P(/* @__PURE__ */ Error("[Templatical] Collaboration: this editor can't follow the template's changes. Reload the page."));
859
+ return;
860
+ }
861
+ me(t);
862
+ return;
863
+ }
864
+ t.revision = e, i ? (t.remote.delete(e), n.push(i)) : (t.own.delete(e), a.group.dropped && (r = !0), G(t, a));
865
+ }
866
+ if (t === g && (p.value = t.revision), t.remote.size > 0 || t.own.size > 0 ? fe(t) : pe(t), (n.length !== 0 || r) && (de(t), t === g)) for (let t of n) try {
867
+ e.onRemoteChange?.({
868
+ actor: t.actor,
869
+ ops: t.ops
870
+ });
871
+ } catch (e) {
872
+ P(e);
873
+ }
874
+ }
875
+ function de(e) {
876
+ e === g && U();
877
+ let t = e.confirmed;
878
+ for (let n = 0; n < e.pending.length; n++) {
879
+ let r = e.pending[n];
880
+ try {
881
+ t = j(t, r.ops);
882
+ } catch (i) {
883
+ if (r.sent) continue;
884
+ if (se(e, r)) {
885
+ let t = i instanceof N ? i.code : "invalid_operation";
886
+ F(r.origin === "edit" || r.origin === "ai" ? {
887
+ type: "editRefused",
888
+ code: t
889
+ } : {
890
+ type: "undoSkipped",
891
+ code: t
892
+ }, e);
893
+ }
894
+ t = e.confirmed, n = -1;
895
+ }
896
+ }
897
+ e.view = t, q(e), e === g && B(t);
898
+ }
899
+ function fe(e) {
900
+ e.gapTimer ||= setTimeout(() => {
901
+ e.gapTimer = null, e === g && X();
902
+ }, Ee);
903
+ }
904
+ function pe(e) {
905
+ e.gapTimer &&= (clearTimeout(e.gapTimer), null);
906
+ }
907
+ function X() {
908
+ let e = g;
909
+ return e ? (e.catchingUp ||= (async () => {
910
+ try {
911
+ let n = await t.operationsAfter(e.templateId, e.revision);
912
+ if (e.retired) return;
913
+ if ("resync" in n) {
914
+ await me(e);
915
+ return;
916
+ }
917
+ for (let t of n.batches) le(e, t);
918
+ } catch (e) {
919
+ P(e);
920
+ } finally {
921
+ e.catchingUp = null;
922
+ }
923
+ })(), e.catchingUp) : Promise.resolve();
924
+ }
925
+ async function me(t) {
926
+ t.recovering = !0;
927
+ try {
928
+ let n = await e.loadTemplate(t.templateId);
929
+ if (t.retired) return;
930
+ let r = n.revision ?? t.revision;
931
+ t.confirmed = z(n.content), t.revision = r, t.remote = new Map([...t.remote].filter(([e]) => e > r));
932
+ for (let [e, n] of [...t.own]) e <= r && (t.own.delete(e), G(t, n));
933
+ t === g && (p.value = r), de(t), Y(t);
934
+ } catch (e) {
935
+ P(e);
936
+ } finally {
937
+ t.recovering = !1;
938
+ }
939
+ }
940
+ function he(t) {
941
+ let n = () => t === g && !t.retired;
942
+ return {
943
+ onBatch: (e) => {
944
+ n() && le(t, e);
945
+ },
946
+ onResync: (r, i) => {
947
+ if (!(!n() || r <= t.revision)) {
948
+ if (i) try {
949
+ e.onRemoteResync?.({
950
+ revision: r,
951
+ actor: i
952
+ });
953
+ } catch (e) {
954
+ P(e);
955
+ }
956
+ X();
957
+ }
958
+ },
959
+ onLock: (e) => {
960
+ n() && xe(e);
961
+ },
962
+ onUnlock: (e, t) => {
963
+ n() && Se(e, t);
964
+ },
965
+ onMembers: (e) => {
966
+ n() && Ce(e);
967
+ },
968
+ onConnectionChange: (e) => {
969
+ n() && ye(t, e);
970
+ }
971
+ };
972
+ }
973
+ function ge(e, n) {
974
+ t.join(e.templateId, { sessionId: r }, he(e)).then((t) => {
975
+ e.retired || e !== g ? n || t.leave() : (e.leave = t.leave, Z(t.locks, !n), Ce(t.members), t.members.length > 0 && (d.value = "connected"), t.revision > e.revision && X(), n && Q());
976
+ }, (e) => P(e));
977
+ }
978
+ function _e(e) {
979
+ let t = z(e.content), n = {
980
+ templateId: e.id,
981
+ confirmed: t,
982
+ revision: e.revision ?? 0,
983
+ pending: [],
984
+ view: z(t),
985
+ remote: /* @__PURE__ */ new Map(),
986
+ own: /* @__PURE__ */ new Map(),
987
+ inFlight: null,
988
+ gapTimer: null,
989
+ catchingUp: null,
990
+ leave: null,
991
+ retired: !1,
992
+ recovering: !1,
993
+ undo: [],
994
+ redo: [],
995
+ waiters: []
996
+ };
997
+ g = n, p.value = n.revision, L(), ge(n, !1), h?.state.selectedBlockId && Be(h.state.selectedBlockId), V();
998
+ }
999
+ function ve(e) {
1000
+ e.retired = !0, pe(e), e.leave?.(), e.leave = null, J(e, /* @__PURE__ */ Error("[Templatical] The template was closed."));
1001
+ }
1002
+ function ye(e, t) {
1003
+ let n = d.value;
1004
+ d.value = t, t === "connected" && n !== null && n !== "connected" && ge(e, !0);
1005
+ }
1006
+ function be(e) {
1007
+ g && g.templateId === e?.id || (g &&= (H(), ve(g), null), l.value = [], u.value = /* @__PURE__ */ new Map(), d.value = null, T = null, Q(), L(), e && _e(e));
1008
+ }
1009
+ function xe(e) {
1010
+ if (e.holder.sessionId === r) return;
1011
+ let t = new Map([...u.value].filter(([, t]) => t.holder.sessionId !== e.holder.sessionId));
1012
+ t.set(e.blockId, e), u.value = t, h?.state.selectedBlockId === e.blockId && (h.selectBlock(null), F({
1013
+ type: "selectionRefused",
1014
+ blockId: e.blockId,
1015
+ holder: e.holder
1016
+ }));
1017
+ }
1018
+ function Se(e, t) {
1019
+ if (u.value.get(e)?.holder.sessionId !== t) return;
1020
+ let n = new Map(u.value);
1021
+ n.delete(e), u.value = n;
1022
+ }
1023
+ function Z(e, t) {
1024
+ let n = t ? new Map(u.value) : /* @__PURE__ */ new Map();
1025
+ for (let i of e) i.holder.sessionId !== r && (t && n.has(i.blockId) || n.set(i.blockId, i));
1026
+ u.value = n;
1027
+ }
1028
+ function Ce(e) {
1029
+ let t = new Set(e.map((e) => e.sessionId)), n = new Set(l.value.map((e) => e.sessionId).filter((e) => !t.has(e)));
1030
+ if (l.value = e, n.size === 0) return;
1031
+ let r = new Map([...u.value].filter(([, e]) => !n.has(e.holder.sessionId)));
1032
+ r.size !== u.value.size && (u.value = r);
1033
+ }
1034
+ function we(e) {
1035
+ O = O.then(e).catch(P);
1036
+ }
1037
+ function Q() {
1038
+ s && we(async () => {
1039
+ if (D && (T === null || D.templateId !== T.templateId)) {
1040
+ let e = D;
1041
+ D = null, $(), await t.releaseLock(e.templateId, e.blockId);
1042
+ }
1043
+ let e = T;
1044
+ if (!(!e || D?.templateId === e.templateId && D.blockId === e.blockId)) try {
1045
+ await t.acquireLock(e.templateId, e.blockId), D = e, ze(), je(e.blockId);
1046
+ } catch (n) {
1047
+ if (D?.templateId === e.templateId) {
1048
+ let e = D;
1049
+ D = null, $(), await t.releaseLock(e.templateId, e.blockId).catch(() => {});
1050
+ }
1051
+ if (T !== e) return;
1052
+ Re(e.blockId, n);
1053
+ }
1054
+ });
1055
+ }
1056
+ function je(e) {
1057
+ if (!u.value.has(e)) return;
1058
+ let t = new Map(u.value);
1059
+ t.delete(e), u.value = t;
1060
+ }
1061
+ function Re(e, t) {
1062
+ let n = Me(t);
1063
+ if (n === "lock_held" || n === "block_missing") {
1064
+ T = null;
1065
+ let n = Ne(t);
1066
+ n ? xe({
1067
+ blockId: e,
1068
+ holder: n,
1069
+ expiresAt: ""
1070
+ }) : h?.state.selectedBlockId === e && h.selectBlock(null);
1071
+ } else P(t), setTimeout(() => {
1072
+ T?.blockId === e && Q();
1073
+ }, Oe[0]);
1074
+ }
1075
+ function ze() {
1076
+ k ||= setInterval(() => {
1077
+ we(async () => {
1078
+ let e = D;
1079
+ if (e) try {
1080
+ await t.renewLock(e.templateId, e.blockId);
1081
+ } catch (e) {
1082
+ if (Me(e) === "lock_lost") {
1083
+ D = null, $(), Q();
1084
+ return;
1085
+ }
1086
+ P(e);
1087
+ }
1088
+ });
1089
+ }, De);
1090
+ }
1091
+ function $() {
1092
+ k &&= (clearInterval(k), null);
1093
+ }
1094
+ function Be(e) {
1095
+ U(), g && (T = e ? {
1096
+ templateId: g.templateId,
1097
+ blockId: e
1098
+ } : null, Q());
1099
+ }
1100
+ function Ve() {
1101
+ U(), D && s && (t.releaseLock(D.templateId, D.blockId).catch(() => {}), D = null, $()), g?.leave?.(), g && (g.leave = null);
1102
+ }
1103
+ function He(e) {
1104
+ let t = g;
1105
+ if (!t || _) return;
1106
+ U();
1107
+ let n = (e === "undo" ? t.undo : t.redo).pop();
1108
+ if (!n) return;
1109
+ L();
1110
+ let r;
1111
+ try {
1112
+ r = j(t.view, n.ops, I());
1113
+ } catch (e) {
1114
+ if (!(e instanceof N)) throw e;
1115
+ F({
1116
+ type: "undoSkipped",
1117
+ code: e.code
1118
+ });
1119
+ return;
1120
+ }
1121
+ let i = { ops: te(t.view, n.ops) };
1122
+ R(e === "undo" ? t.redo : t.undo, i), t.view = r, B(r), h?.markDirty(), ie(t, n.ops, e, i);
1123
+ }
1124
+ function Ue(e, t) {
1125
+ let n = g;
1126
+ if (!h || !n || _) return {
1127
+ applied: !1,
1128
+ error: new N("invalid_operation", 0, "No template is open for editing.")
1129
+ };
1130
+ U();
1131
+ let r, i;
1132
+ try {
1133
+ r = j(n.view, e, I()), i = te(n.view, e);
1134
+ } catch (e) {
1135
+ if (e instanceof N) return {
1136
+ applied: !1,
1137
+ error: e
1138
+ };
1139
+ throw e;
1140
+ }
1141
+ let a = n.undo.at(-1), o;
1142
+ return a && a.turn === t.turn ? (a.ops = [...i, ...a.ops], o = a) : (o = {
1143
+ ops: i,
1144
+ turn: t.turn
1145
+ }, R(n.undo, o)), n.redo = [], L(), n.view = r, B(r), h.markDirty(), ie(n, e, t.origin, o), {
1146
+ applied: !0,
1147
+ inverse: i
1148
+ };
1149
+ }
1150
+ function We(e) {
1151
+ h = e, w.push(b(() => e.state.template, (e) => be(e), { immediate: !0 }), b(() => e.content.value, V, { deep: !0 }), b(() => e.state.selectedBlockId, Be), b(() => e.state.isLoading, (e) => e ? ne(!0, !0) : V())), typeof window < "u" && (window.addEventListener("pagehide", Ve), window.addEventListener("blur", U)), n() && c(Je);
1152
+ }
1153
+ function Ge() {
1154
+ U();
1155
+ let e = g;
1156
+ return !e || e.pending.length === 0 ? Promise.resolve() : new Promise((t, n) => e.waiters.push({
1157
+ resolve: t,
1158
+ reject: n
1159
+ }));
1160
+ }
1161
+ function Ke() {
1162
+ U(), _ = !0;
1163
+ }
1164
+ function qe() {
1165
+ _ = !1, g && B(g.view);
1166
+ }
1167
+ function Je() {
1168
+ if (!C) {
1169
+ U();
1170
+ for (let e of w.splice(0)) e();
1171
+ H(), Ve(), C = !0, g && ve(g), g = null, $(), typeof window < "u" && (window.removeEventListener("pagehide", Ve), window.removeEventListener("blur", U));
1172
+ }
1173
+ }
1174
+ return {
1175
+ sessionId: r,
1176
+ members: l,
1177
+ locks: u,
1178
+ connection: d,
1179
+ revision: p,
1180
+ canUndo: A,
1181
+ canRedo: M,
1182
+ attach: We,
1183
+ undo: () => He("undo"),
1184
+ redo: () => He("redo"),
1185
+ clearHistory: () => {
1186
+ g && (g.undo = [], g.redo = [], L());
1187
+ },
1188
+ flush: U,
1189
+ settle: Ge,
1190
+ suspend: Ke,
1191
+ resume: qe,
1192
+ catchUp: X,
1193
+ hasConfirmedBlock: (e) => g ? Fe(g.confirmed.blocks, e) : !1,
1194
+ applyOperations: Ue,
1195
+ destroy: Je
1196
+ };
1197
+ }
1198
+ function ze(e) {
1199
+ let { provider: t } = e, n = a([]), r = a(!1), i = d(() => {
1200
+ let e = /* @__PURE__ */ new Set();
1201
+ for (let t of n.value) {
1202
+ let n = t.category?.trim();
1203
+ n && e.add(n);
1204
+ }
1205
+ return [...e].sort((e, t) => e.localeCompare(t));
1206
+ }), o = d(() => typeof t.create == "function"), s = d(() => typeof t.update == "function"), c = d(() => typeof t.delete == "function");
1207
+ function l(e) {
1208
+ return s.value && e.canUpdate !== !1;
1209
+ }
1210
+ function u(e) {
1211
+ return c.value && e.canDelete !== !1;
1212
+ }
1213
+ function f(e, t) {
1214
+ throw new I(`[Templatical] Saved blocks: ${e} is ${t}. Check the capability before calling — the editor's own UI hides the action.`);
1215
+ }
1216
+ function p(t) {
1217
+ J(e.onError, t);
1218
+ }
1219
+ async function m(i) {
1220
+ r.value = !0;
1221
+ try {
1222
+ n.value = await t.list(i);
1223
+ } catch (t) {
1224
+ throw e.onError?.(t), t;
1225
+ } finally {
1226
+ r.value = !1;
1227
+ }
1228
+ }
1229
+ async function h(r, i, a) {
1230
+ let { create: o } = t;
1231
+ typeof o != "function" && f("create", "disabled by the provider");
1232
+ try {
1233
+ let e = await o(a ? {
1234
+ name: r,
1235
+ content: i,
1236
+ category: a
1237
+ } : {
1238
+ name: r,
1239
+ content: i
1240
+ });
1241
+ return n.value = [e, ...n.value], p(() => t.onCreated?.(e)), e;
1242
+ } catch (t) {
1243
+ throw e.onError?.(t), t;
1244
+ }
1245
+ }
1246
+ async function g(r, i) {
1247
+ let { update: a } = t;
1248
+ typeof a != "function" && f("update", "disabled by the provider");
1249
+ let o = n.value.find((e) => e.id === r);
1250
+ o && o.canUpdate === !1 && f("update", `not permitted for entry "${r}"`);
1251
+ try {
1252
+ let e = await a(r, i);
1253
+ return n.value = n.value.map((t) => t.id === r ? e : t), p(() => t.onUpdated?.(e)), e;
1254
+ } catch (t) {
1255
+ throw e.onError?.(t), t;
1256
+ }
1257
+ }
1258
+ async function _(r) {
1259
+ let { delete: i } = t;
1260
+ typeof i != "function" && f("delete", "disabled by the provider");
1261
+ let a = n.value.find((e) => e.id === r) ?? null;
1262
+ a && a.canDelete === !1 && f("delete", `not permitted for entry "${r}"`);
1263
+ try {
1264
+ await i(r), n.value = n.value.filter((e) => e.id !== r), a && p(() => t.onDeleted?.(a));
1265
+ } catch (t) {
1266
+ throw e.onError?.(t), t;
1267
+ }
1268
+ }
1269
+ return {
1270
+ savedBlocks: n,
1271
+ isLoading: r,
1272
+ categories: i,
1273
+ canCreate: o,
1274
+ canUpdate: s,
1275
+ canDelete: c,
1276
+ canUpdateBlock: l,
1277
+ canDeleteBlock: u,
1278
+ load: m,
1279
+ create: h,
1280
+ update: g,
1281
+ remove: _
1282
+ };
1283
+ }
1284
+ var $ = "templatical:saved-blocks";
1285
+ function Be(e = {}) {
1286
+ let t = e.key ?? $;
1287
+ function n() {
1288
+ if (typeof localStorage > "u") throw Error("[Templatical] createLocalStorageSavedBlocksProvider requires a browser environment with localStorage. Supply your own SavedBlocksProvider for server-side or non-browser use.");
1289
+ return localStorage;
1290
+ }
1291
+ function r() {
1292
+ let e = n().getItem(t);
1293
+ if (!e) return [];
1294
+ try {
1295
+ let t = JSON.parse(e);
1296
+ return Array.isArray(t) ? t : [];
1297
+ } catch {
1298
+ return [];
1299
+ }
1300
+ }
1301
+ function i(e) {
1302
+ n().setItem(t, JSON.stringify(e));
1303
+ }
1304
+ return {
1305
+ async list(e) {
1306
+ let t = r(), n = e?.search?.trim().toLowerCase(), i = e?.category?.trim();
1307
+ return t.filter((e) => !(n && !e.name.toLowerCase().includes(n) || i && e.category !== i));
1308
+ },
1309
+ async create(e) {
1310
+ let t = (/* @__PURE__ */ new Date()).toISOString(), n = {
1311
+ id: T(),
1312
+ name: e.name,
1313
+ content: e.content,
1314
+ ...e.category ? { category: e.category } : {},
1315
+ createdAt: t,
1316
+ updatedAt: t
1317
+ };
1318
+ return i([n, ...r()]), n;
1319
+ },
1320
+ async update(e, t) {
1321
+ let n = r(), a = n.findIndex((t) => t.id === e);
1322
+ if (a === -1) throw Error(`[Templatical] Saved block not found: ${e}`);
1323
+ let o = {
1324
+ ...n[a],
1325
+ ...t,
1326
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
1327
+ }, s = [...n];
1328
+ return s[a] = o, i(s), o;
1329
+ },
1330
+ async delete(e) {
1331
+ let t = r();
1332
+ if (!t.some((t) => t.id === e)) throw Error(`[Templatical] Saved block not found: ${e}`);
1333
+ i(t.filter((t) => t.id !== e));
1334
+ }
1335
+ };
1336
+ }
1337
+ var Ve = "templatical:media", He = 50;
1338
+ function Ue(e = {}) {
1339
+ let t = e.key ?? Ve;
1340
+ function n() {
1341
+ if (typeof localStorage > "u") throw Error("[Templatical] createLocalStorageMediaProvider requires a browser environment with localStorage. Supply your own MediaProvider for server-side or non-browser use.");
1342
+ return localStorage;
1343
+ }
1344
+ function r() {
1345
+ let e = n().getItem(t);
1346
+ if (!e) return [];
1347
+ try {
1348
+ let t = JSON.parse(e);
1349
+ return Array.isArray(t) ? t : [];
1350
+ } catch {
1351
+ return [];
1352
+ }
1353
+ }
1354
+ function i(e) {
1355
+ n().setItem(t, JSON.stringify(e));
1356
+ }
1357
+ function a(e) {
1358
+ return typeof FileReader > "u" ? Promise.reject(/* @__PURE__ */ Error("[Templatical] createLocalStorageMediaProvider requires a browser environment with FileReader.")) : new Promise((t, n) => {
1359
+ let r = new FileReader();
1360
+ r.onload = () => {
1361
+ typeof r.result == "string" ? t(r.result) : n(/* @__PURE__ */ Error("[Templatical] Failed to read file as a data URL."));
1362
+ }, r.onerror = () => {
1363
+ n(r.error ?? /* @__PURE__ */ Error("[Templatical] Failed to read file as a data URL."));
1364
+ }, r.readAsDataURL(e);
1365
+ });
1366
+ }
1367
+ return {
1368
+ async list(e) {
1369
+ let t = r(), n = e?.search?.trim().toLowerCase(), i = n ? t.filter((e) => {
1370
+ let t = e.filename?.toLowerCase() ?? "", r = e.alt?.toLowerCase() ?? "";
1371
+ return t.includes(n) || r.includes(n);
1372
+ }) : t, a = e?.cursor ? Number.parseInt(e.cursor, 10) : 0, o = Number.isFinite(a) && a > 0 ? a : 0, s = i.slice(o, o + He), c = { items: s }, l = o + s.length;
1373
+ return l < i.length && (c.nextCursor = String(l)), c;
1374
+ },
1375
+ async create(e) {
1376
+ let t = await a(e.file), n = (/* @__PURE__ */ new Date()).toISOString(), o = {
1377
+ id: T(),
1378
+ url: t,
1379
+ filename: e.filename || e.file.name,
1380
+ createdAt: n,
1381
+ updatedAt: n,
1382
+ size: e.file.size
1383
+ };
1384
+ return e.alt !== void 0 && (o.alt = e.alt), e.file.type && (o.mimeType = e.file.type), e.folderId !== void 0 && (o.folderId = e.folderId), i([o, ...r()]), o;
1385
+ },
1386
+ async update(e, t) {
1387
+ let n = r(), a = n.findIndex((t) => t.id === e);
1388
+ if (a === -1) throw Error(`[Templatical] Media asset not found: ${e}`);
1389
+ let o = n[a], s = {
1390
+ ...o,
1391
+ ...t,
1392
+ id: o.id,
1393
+ url: o.url,
1394
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
1395
+ }, c = [...n];
1396
+ return c[a] = s, i(c), s;
1397
+ },
1398
+ async delete(e) {
1399
+ let t = r();
1400
+ for (let n of e) if (!t.some((e) => e.id === n)) throw Error(`[Templatical] Media asset not found: ${n}`);
1401
+ let n = new Set(e);
1402
+ i(t.filter((e) => !n.has(e.id)));
1403
+ },
1404
+ folders: !1,
1405
+ replace: !1,
1406
+ importFromUrl: !1,
1407
+ checkUsage: !1,
1408
+ frequentlyUsed: !1,
1409
+ storage: !1
1410
+ };
1411
+ }
1412
+ function We(e) {
1413
+ let { provider: t, getTemplateId: n } = e, r = a([]), i = a(!1), o = a(void 0), s = a(!1), c = /* @__PURE__ */ new Map(), l = d(() => typeof t.create == "function"), u = d(() => typeof t.restore == "function");
1414
+ function f(e) {
1415
+ let t = n();
1416
+ if (!t) throw new I(`[Templatical] Version history: ${e} needs a template. Call create() or load() first.`);
1417
+ return t;
1418
+ }
1419
+ function p(e) {
1420
+ throw new I(`[Templatical] Version history: ${e} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`);
1421
+ }
1422
+ function m(t) {
1423
+ J(e.onError, t);
1424
+ }
1425
+ async function h(n) {
1426
+ let a = f("list");
1427
+ i.value = !0;
1428
+ try {
1429
+ let e = await t.list(a, n);
1430
+ r.value = e.versions, o.value = e.nextCursor;
1431
+ } catch (t) {
1432
+ throw e.onError?.(t), t;
1433
+ } finally {
1434
+ i.value = !1;
1435
+ }
1436
+ }
1437
+ function g(e) {
1438
+ return e.content ?? c.get(e.id) ?? null;
1439
+ }
1440
+ async function _(n) {
1441
+ let r = g(n);
1442
+ if (r) return r;
1443
+ let i = f("get");
1444
+ try {
1445
+ let e = await t.get(i, n.id);
1446
+ return c.set(n.id, e), e;
1447
+ } catch (t) {
1448
+ throw e.onError?.(t), t;
1449
+ }
1450
+ }
1451
+ async function v(n, i) {
1452
+ let { create: a } = t;
1453
+ typeof a != "function" && p("create");
1454
+ let o = f("create");
1455
+ try {
1456
+ let e = await a(o, n, i);
1457
+ return r.value = [e, ...r.value], m(() => t.onCreated?.(e)), e;
1458
+ } catch (t) {
1459
+ throw e.onError?.(t), t;
1460
+ }
1461
+ }
1462
+ async function y(n) {
1463
+ let { restore: r } = t;
1464
+ typeof r != "function" && p("restore");
1465
+ let i = f("restore"), a;
1466
+ s.value = !0;
1467
+ try {
1468
+ a = await r(i, n);
1469
+ } catch (t) {
1470
+ throw e.onError?.(t), t;
1471
+ } finally {
1472
+ s.value = !1;
1473
+ }
1474
+ return m(() => t.onRestored?.(a)), a;
1475
+ }
1476
+ return {
1477
+ nextCursor: o,
1478
+ versions: r,
1479
+ isLoading: i,
1480
+ isRestoring: s,
1481
+ canCreate: l,
1482
+ canRestore: u,
1483
+ load: h,
1484
+ peekContent: g,
1485
+ resolveContent: _,
1486
+ create: v,
1487
+ restore: y
1488
+ };
1489
+ }
1490
+ function Ge(e) {
1491
+ let { provider: t, getTemplateId: n, getUser: r } = e, i = a([]), o = a(!1), s = a(!1), c = d(() => typeof t.create == "function"), l = d(() => typeof t.update == "function"), u = d(() => typeof t.delete == "function"), f = d(() => typeof t.setResolved == "function"), p = d(() => i.value.reduce((e, t) => e + 1 + (t.replies?.length ?? 0), 0)), m = d(() => i.value.filter((e) => !e.resolvedAt).length), h = d(() => {
1492
+ let e = /* @__PURE__ */ new Map();
1493
+ for (let t of i.value) t.blockId && e.set(t.blockId, (e.get(t.blockId) ?? 0) + 1 + (t.replies?.length ?? 0));
1494
+ return e;
1495
+ });
1496
+ function g(e) {
1497
+ let t = n();
1498
+ if (!t) throw new I(`[Templatical] Comments: ${e} needs a template. Call create() or load() first.`);
1499
+ return t;
1500
+ }
1501
+ function _(e) {
1502
+ let t = r();
1503
+ if (!t) throw new I(`[Templatical] Comments: ${e} needs to know who is commenting. Pass init({ user: { id, name } }) — an unattributed comment is not written.`);
1504
+ return t;
1505
+ }
1506
+ function v(e) {
1507
+ throw new I(`[Templatical] Comments: ${e} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`);
1508
+ }
1509
+ function y(e) {
1510
+ for (let t of i.value) {
1511
+ if (t.id === e) return t;
1512
+ for (let n of t.replies ?? []) if (n.id === e) return n;
1513
+ }
1514
+ return null;
1515
+ }
1516
+ function b(e) {
1517
+ let t = r();
1518
+ return t !== null && e.author.id === t.id;
1519
+ }
1520
+ function x(t) {
1521
+ let n = q(t);
1522
+ throw e.onError?.(n), n;
1523
+ }
1524
+ function S(t) {
1525
+ J(e.onError, t);
1526
+ }
1527
+ function C(e, t, n) {
1528
+ return [
1529
+ ...e.slice(0, t),
1530
+ n,
1531
+ ...e.slice(t + 1)
1532
+ ];
1533
+ }
1534
+ function w(e, t) {
1535
+ return e !== void 0 && JSON.stringify(e) === JSON.stringify(t);
1536
+ }
1537
+ function T(e) {
1538
+ if (e.parentId) {
1539
+ let t = !1, n = i.value.map((n) => {
1540
+ if (n.id !== e.parentId) return n;
1541
+ let r = n.replies ?? [], i = r.findIndex((t) => t.id === e.id);
1542
+ return i !== -1 && w(r[i], e) ? n : (t = !0, {
1543
+ ...n,
1544
+ replies: i === -1 ? [...r, e] : C(r, i, e)
1545
+ });
1546
+ });
1547
+ return t && (i.value = n), t;
1548
+ }
1549
+ let t = i.value.findIndex((t) => t.id === e.id);
1550
+ if (t === -1) return i.value = [...i.value, e], !0;
1551
+ let n = {
1552
+ ...e,
1553
+ replies: e.replies ?? i.value[t].replies
1554
+ };
1555
+ return !w(i.value[t], n) && (i.value = C(i.value, t, n), !0);
1556
+ }
1557
+ function E(e, t) {
1558
+ let n = y(e), r = t ?? n?.parentId ?? null;
1559
+ return r ? i.value = i.value.map((t) => t.id === r ? {
1560
+ ...t,
1561
+ replies: (t.replies ?? []).filter((t) => t.id !== e)
1562
+ } : t) : i.value = i.value.filter((t) => t.id !== e), n;
1563
+ }
1564
+ async function ee(e) {
1565
+ let n = g("list");
1566
+ o.value = !0;
1567
+ try {
1568
+ i.value = await t.list(n, e);
1569
+ } catch (e) {
1570
+ x(e);
1571
+ } finally {
1572
+ o.value = !1;
1573
+ }
1574
+ }
1575
+ async function D(e) {
1576
+ let { create: n } = t;
1577
+ typeof n != "function" && v("create");
1578
+ let r = g("create");
1579
+ _("create"), s.value = !0;
1580
+ try {
1581
+ let i = await n(r, e);
1582
+ return T(i), S(() => t.onCreated?.(i, { origin: "local" })), i;
1583
+ } catch (e) {
1584
+ x(e);
1585
+ } finally {
1586
+ s.value = !1;
1587
+ }
1588
+ }
1589
+ async function O(e, n) {
1590
+ let { update: r } = t;
1591
+ typeof r != "function" && v("update");
1592
+ let i = g("update");
1593
+ _("update"), s.value = !0;
1594
+ try {
1595
+ let a = await r(i, e, n);
1596
+ return T(a), S(() => t.onUpdated?.(a, { origin: "local" })), a;
1597
+ } catch (e) {
1598
+ x(e);
1599
+ } finally {
1600
+ s.value = !1;
1601
+ }
1602
+ }
1603
+ async function k(e) {
1604
+ let { delete: n } = t;
1605
+ typeof n != "function" && v("delete");
1606
+ let r = g("delete");
1607
+ _("delete");
1608
+ let i = y(e);
1609
+ s.value = !0;
1610
+ try {
1611
+ await n(r, e), E(e), i && S(() => t.onDeleted?.(i, { origin: "local" }));
1612
+ } catch (e) {
1613
+ x(e);
1614
+ } finally {
1615
+ s.value = !1;
1616
+ }
1617
+ }
1618
+ async function A(e, n) {
1619
+ let { setResolved: r } = t;
1620
+ typeof r != "function" && v("setResolved");
1621
+ let i = g("setResolved");
1622
+ _("setResolved"), s.value = !0;
1623
+ try {
1624
+ let a = await r(i, e, n);
1625
+ return T(a), S(() => (a.resolvedAt ? t.onResolved : t.onUnresolved)?.(a, { origin: "local" })), a;
1626
+ } catch (e) {
1627
+ x(e);
1628
+ } finally {
1629
+ s.value = !1;
1630
+ }
1631
+ }
1632
+ function j(e) {
1633
+ T(e) && S(() => t.onCreated?.(e, { origin: "remote" }));
1634
+ }
1635
+ function M(e) {
1636
+ T(e) && S(() => (e.resolvedAt ? t.onResolved : t.onUpdated)?.(e, { origin: "remote" }));
1637
+ }
1638
+ function N(e, n) {
1639
+ let r = E(e, n);
1640
+ r && S(() => t.onDeleted?.(r, { origin: "remote" }));
1641
+ }
1642
+ return {
1643
+ comments: i,
1644
+ isLoading: o,
1645
+ isSubmitting: s,
1646
+ canCreate: c,
1647
+ canUpdate: l,
1648
+ canDelete: u,
1649
+ canResolve: f,
1650
+ totalCount: p,
1651
+ unresolvedCount: m,
1652
+ commentCountByBlock: h,
1653
+ load: ee,
1654
+ create: D,
1655
+ update: O,
1656
+ remove: k,
1657
+ setResolved: A,
1658
+ find: y,
1659
+ isOwn: b,
1660
+ applyRemoteCreate: j,
1661
+ applyRemoteUpdate: M,
1662
+ applyRemoteDelete: N
1663
+ };
1664
+ }
1665
+ function Ke(e) {
1666
+ let { comments: t, provider: n, getTemplateId: r } = e, { subscribe: i } = n;
1667
+ if (typeof i != "function") return;
1668
+ let a = null;
1669
+ function o() {
1670
+ a?.(), a = null;
1671
+ }
1672
+ S(() => r(), (e) => {
1673
+ o(), e && (a = i(e, (e) => {
1674
+ switch (e.type) {
1675
+ case "created":
1676
+ t.applyRemoteCreate(e.comment);
1677
+ break;
1678
+ case "updated":
1679
+ t.applyRemoteUpdate(e.comment);
1680
+ break;
1681
+ case "deleted": t.applyRemoteDelete(e.commentId, e.parentId);
1682
+ }
1683
+ }));
1684
+ }, { immediate: !0 }), c(o);
1685
+ }
1686
+ //#endregion
1687
+ //#region src/constants/timeouts.ts
1688
+ var qe = 1e4;
1689
+ //#endregion
1690
+ //#region src/composables/useImageUrlResolver.ts
1691
+ function Je(e) {
1692
+ let t = s(/* @__PURE__ */ new Map()), n = /* @__PURE__ */ new Set();
1693
+ function r(e) {
1694
+ return t.get(e);
1695
+ }
1696
+ function i(e) {
1697
+ return t.has(e) || n.has(e);
1698
+ }
1699
+ function a(r) {
1700
+ if (i(r)) return;
1701
+ let a;
1702
+ try {
1703
+ a = e(r);
1704
+ } catch {
1705
+ t.set(r, null);
1706
+ return;
1707
+ }
1708
+ a === null || typeof a == "string" ? t.set(r, a) : (n.add(r), Promise.resolve(a).then((e) => {
1709
+ t.set(r, typeof e == "string" ? e : null);
1710
+ }, () => {
1711
+ t.set(r, null);
1712
+ }).finally(() => n.delete(r)));
1713
+ }
1714
+ return {
1715
+ get: r,
1716
+ has: i,
1717
+ lookup: a
1718
+ };
1719
+ }
1720
+ function Ye(e) {
1721
+ let r = t(W, null), i = d(e);
1722
+ if (!r) return i;
1723
+ let a;
1724
+ function o() {
1725
+ a !== void 0 && (clearTimeout(a), a = void 0);
1726
+ }
1727
+ n() && c(o);
1728
+ let s = !0;
1729
+ return S(i, (e) => {
1730
+ o();
1731
+ let t = s;
1732
+ s = !1, e && !r.has(e) && (t ? r.lookup(e) : a = setTimeout(() => {
1733
+ a = void 0, r.lookup(e);
1734
+ }, 300));
1735
+ }, { immediate: !0 }), d(() => {
1736
+ let e = i.value;
1737
+ if (!e) return e;
1738
+ let t = r.get(e);
1739
+ return typeof t == "string" && t.length > 0 ? t : e;
1740
+ });
1741
+ }
1742
+ function Xe(e, t) {
1743
+ if (!e || !t) return t;
1744
+ let n = e.get(t);
1745
+ return typeof n == "string" && n.length > 0 ? n : t;
1746
+ }
1747
+ function Ze(e, t) {
1748
+ return typeof e?.url == "string" && V(e.url, t);
1749
+ }
1750
+ function Qe(e, t) {
1751
+ let n = e?.url;
1752
+ if (typeof n == "string" && n.trim() !== "") return V(n, t) ? void 0 : n;
1753
+ }
1754
+ function $e(e) {
1755
+ let n = t(re, A.liquid), r = Ye(() => Qe(e(), n));
1756
+ return d(() => Ze(e(), n) ? null : r.value);
1757
+ }
1758
+ function et(e, t, n) {
1759
+ return Ze(t, n) ? null : Xe(e, Qe(t, n));
1760
+ }
1761
+ //#endregion
1762
+ //#region src/utils/blockTypeLabels.ts
1763
+ function tt(e, t) {
1764
+ return t.blocks[e] ?? e;
1765
+ }
1766
+ function nt(e, t, n = []) {
1767
+ if (e.type !== "custom") return tt(e.type, t);
1768
+ let { customType: r } = e;
1769
+ return n.find((e) => e.type === r)?.name ?? r;
1770
+ }
1771
+ //#endregion
1772
+ //#region src/utils/resolveFieldColors.ts
1773
+ function rt(e, t) {
1774
+ let n = G({ presets: e.presets }, oe), r = n.presets.length === 0, i = e.allowCustom ?? t.allowCustom;
1775
+ return {
1776
+ presets: r ? t.presets : n.presets,
1777
+ allowCustom: t.allowCustom !== !1 && i,
1778
+ invalidPresets: n.invalidPresets,
1779
+ emptyPresets: e.presets !== void 0 && e.presets.length === 0,
1780
+ presetsInherited: r,
1781
+ allowCustomIgnored: e.allowCustom === !0 && t.allowCustom === !1
1782
+ };
1783
+ }
1784
+ var it = K({
1785
+ name: "code",
1786
+ size: 24,
1787
+ node: [["path", {
1788
+ d: "m16 18 6-6-6-6",
1789
+ key: "eg8j8"
1790
+ }], ["path", {
1791
+ d: "m8 6-6 6 6 6",
1792
+ key: "ppft3o"
1793
+ }]]
1794
+ }), at = K({
1795
+ name: "navigation",
1796
+ size: 24,
1797
+ node: [["polygon", {
1798
+ points: "3 11 22 2 13 21 11 13 3 11",
1799
+ key: "1ltx0t"
1800
+ }]]
1801
+ }), ot = K({
1802
+ name: "share-2",
1803
+ size: 24,
1804
+ node: [
1805
+ ["circle", {
1806
+ cx: "18",
1807
+ cy: "5",
1808
+ r: "3",
1809
+ key: "gq8acd"
1810
+ }],
1811
+ ["circle", {
1812
+ cx: "6",
1813
+ cy: "12",
1814
+ r: "3",
1815
+ key: "w7nqdw"
1816
+ }],
1817
+ ["circle", {
1818
+ cx: "18",
1819
+ cy: "19",
1820
+ r: "3",
1821
+ key: "1xt0gg"
1822
+ }],
1823
+ ["line", {
1824
+ x1: "8.59",
1825
+ x2: "15.42",
1826
+ y1: "13.51",
1827
+ y2: "17.49",
1828
+ key: "47mynk"
1829
+ }],
1830
+ ["line", {
1831
+ x1: "15.41",
1832
+ x2: "8.59",
1833
+ y1: "6.51",
1834
+ y2: "10.49",
1835
+ key: "1n3mei"
1836
+ }]
1837
+ ]
1838
+ }), st = K({
1839
+ name: "table",
1840
+ size: 24,
1841
+ node: [
1842
+ ["path", {
1843
+ d: "M12 3v18",
1844
+ key: "108xh3"
1845
+ }],
1846
+ ["rect", {
1847
+ width: "18",
1848
+ height: "18",
1849
+ x: "3",
1850
+ y: "3",
1851
+ rx: "2",
1852
+ key: "afitv7"
1853
+ }],
1854
+ ["path", {
1855
+ d: "M3 9h18",
1856
+ key: "1pudct"
1857
+ }],
1858
+ ["path", {
1859
+ d: "M3 15h18",
1860
+ key: "5xshup"
1861
+ }]
1862
+ ]
1863
+ });
1864
+ //#endregion
1865
+ //#region src/utils/imageNaturalSize.ts
1866
+ function ct(e) {
1867
+ return typeof e == "number" && Number.isFinite(e) && e > 0;
1868
+ }
1869
+ function lt(e, t) {
1870
+ return ct(e) && ct(t) ? {
1871
+ width: e,
1872
+ height: t
1873
+ } : null;
1874
+ }
1875
+ function ut(e) {
1876
+ return lt(e.naturalWidth, e.naturalHeight);
1877
+ }
1878
+ function dt(e) {
1879
+ return e ? {
1880
+ naturalWidth: e.width,
1881
+ naturalHeight: e.height
1882
+ } : {
1883
+ naturalWidth: void 0,
1884
+ naturalHeight: void 0
1885
+ };
1886
+ }
1887
+ function ft(e, t) {
1888
+ if (typeof Image > "u") return t(null), () => {};
1889
+ let n = new Image(), r = () => {
1890
+ n.onload = null, n.onerror = null;
1891
+ };
1892
+ return n.onload = () => {
1893
+ r(), t(lt(n.naturalWidth, n.naturalHeight));
1894
+ }, n.onerror = () => {
1895
+ r(), t(null);
1896
+ }, n.src = e, r;
1897
+ }
1898
+ function pt(e) {
1899
+ return new Promise((t) => {
1900
+ let n = setTimeout(() => {
1901
+ r(), t(null);
1902
+ }, qe), r = ft(e, (e) => {
1903
+ clearTimeout(n), t(e);
1904
+ });
1905
+ });
1906
+ }
1907
+ //#endregion
1908
+ //#region src/components/MediaDropOverlay.vue
1909
+ var mt = /* @__PURE__ */ x({
1910
+ __name: "MediaDropOverlay",
1911
+ props: {
1912
+ uploading: { type: Boolean },
1913
+ size: { default: "field" }
1914
+ },
1915
+ setup(t) {
1916
+ let n = t, { t: i } = ae(), a = {
1917
+ field: {
1918
+ gap: "tpl:gap-1.5",
1919
+ icon: 18,
1920
+ veil: "90%"
1921
+ },
1922
+ canvas: {
1923
+ gap: "tpl:gap-2",
1924
+ icon: 20,
1925
+ veil: "85%"
1926
+ }
1927
+ }, o = d(() => a[n.size]);
1928
+ return (n, a) => (g(), p("div", {
1929
+ class: e(["tpl:pointer-events-none tpl:absolute tpl:inset-0 tpl:z-10 tpl:flex tpl:flex-col tpl:items-center tpl:justify-center tpl:rounded tpl:border-2 tpl:border-dashed tpl:text-xs tpl:font-medium tpl:border-[var(--tpl-primary)] tpl:text-[var(--tpl-primary)]", o.value.gap]),
1930
+ style: _({ backgroundColor: `color-mix(in srgb, var(--tpl-bg) ${o.value.veil}, transparent)` })
1931
+ }, [t.uploading ? (g(), p(y, { key: 0 }, [u(v(ce), {
1932
+ class: "tpl-spinner",
1933
+ size: o.value.icon,
1934
+ "stroke-width": 2
1935
+ }, null, 8, ["size"]), m(" " + r(v(i).image.uploading), 1)], 64)) : (g(), p(y, { key: 1 }, [u(v(se), {
1936
+ size: o.value.icon,
1937
+ "stroke-width": 1.5
1938
+ }, null, 8, ["size"]), m(" " + r(v(i).image.dropToUpload), 1)], 64))], 6));
1939
+ }
1940
+ });
1941
+ //#endregion
1942
+ //#region src/composables/useAliveFlag.ts
1943
+ function ht() {
1944
+ let e = { alive: !0 };
1945
+ return i(() => {
1946
+ e.alive = !1;
1947
+ }), e;
1948
+ }
1949
+ //#endregion
1950
+ //#region src/composables/useImageDrop.ts
1951
+ var gt = "image/";
1952
+ function _t(e) {
1953
+ let { target: t, onFiles: n, enabled: r } = e, i = () => r === void 0 || h(r), { isOverDropZone: a } = ne(t, {
1954
+ preventDefaultForUnhandled: !0,
1955
+ onDrop: (e) => {
1956
+ if (!i()) return;
1957
+ let t = (e ?? []).filter((e) => e.type.startsWith(gt));
1958
+ t.length > 0 && n([t[0]]);
1959
+ }
1960
+ });
1961
+ return { isOver: d(() => i() && a.value) };
1962
+ }
1963
+ //#endregion
1964
+ //#region src/composables/useMediaDropField.ts
1965
+ function vt(e) {
1966
+ let { target: n, blocked: r, apply: i } = e, o = t(U, null), s = t(ie, null), c = ht();
1967
+ async function l() {
1968
+ let e = await o?.({ accept: ["images"] });
1969
+ c.alive && e && i(e);
1970
+ }
1971
+ let u = a(!1), f = d(() => (s?.value ?? !!o) && !u.value && !h(r));
1972
+ async function p(e) {
1973
+ if (o) {
1974
+ u.value = !0;
1975
+ try {
1976
+ let t = await o({
1977
+ accept: ["images"],
1978
+ files: e
1979
+ });
1980
+ if (!c.alive) return;
1981
+ t && i(t);
1982
+ } finally {
1983
+ c.alive && (u.value = !1);
1984
+ }
1985
+ }
1986
+ }
1987
+ let { isOver: m } = _t({
1988
+ target: n,
1989
+ enabled: f,
1990
+ onFiles: p
1991
+ }), g = d(() => f.value && m.value || u.value);
1992
+ return {
1993
+ canBrowse: !!o,
1994
+ dropEnabled: f,
1995
+ isUploading: u,
1996
+ showOverlay: g,
1997
+ openMediaBrowser: l
1998
+ };
1999
+ }
2000
+ function yt(e, t = "desktop") {
2001
+ return t === "mobile" ? 375 : e?.width ?? 600;
2002
+ }
2003
+ var bt = "width 300ms cubic-bezier(0.34, 1.56, 0.64, 1)", xt = {
2004
+ 1: [100],
2005
+ 2: [50, 50],
2006
+ 3: [
2007
+ 33.33,
2008
+ 33.33,
2009
+ 33.34
2010
+ ],
2011
+ "1-2": [33.33, 66.67],
2012
+ "2-1": [66.67, 33.33]
2013
+ };
2014
+ function St(e, t) {
2015
+ let n = (e) => Math.trunc(e ?? 0), r = (e) => B(e) === null ? 0 : Math.trunc(e.width);
2016
+ return n(e?.left) + n(e?.right) + r(t?.left) + r(t?.right);
2017
+ }
2018
+ function Ct(e, t) {
2019
+ return Math.floor(e) - St(t);
2020
+ }
2021
+ function wt(e, t) {
2022
+ let n = "border" in e ? e.border : void 0;
2023
+ return Math.floor(t) - St(e.styles.padding, n);
2024
+ }
2025
+ function* Tt(e, t) {
2026
+ for (let n of e) O(n) ? yield* Tt(n.children, Ct(t, n.styles.padding)) : yield {
2027
+ block: n,
2028
+ bandWidth: F(n) && n.wrapper ? Ct(t, n.wrapper.padding) : t
2029
+ };
2030
+ }
2031
+ function Et(e, t) {
2032
+ if (!t) return e;
2033
+ try {
2034
+ return M(t, e);
2035
+ } catch {
2036
+ return e;
2037
+ }
2038
+ }
2039
+ function Dt(e, t, n) {
2040
+ let r = Et(e, n);
2041
+ for (let { block: e, bandWidth: n } of Tt(r.blocks, r.settings.width)) if (F(e)) {
2042
+ let r = P(e)?.applied ? void 0 : e.border, i = Math.floor(n) - St(e.styles.padding, r), a = xt[e.columns] ?? [100];
2043
+ for (let n = 0; n < e.children.length; n++) {
2044
+ let r = Math.floor(i * (a[n] ?? 100) / 100), o = e.children[n].find((e) => e.id === t);
2045
+ if (o) return wt(o, r);
2046
+ }
2047
+ } else if (e.id === t) return wt(e, n);
2048
+ return null;
2049
+ }
2050
+ function Ot(e, t, n) {
2051
+ let r = Et(e, n);
2052
+ for (let { block: e, bandWidth: n } of Tt(r.blocks, r.settings.width)) if (e.id === t) return Math.floor(n);
2053
+ return null;
2054
+ }
2055
+ function kt(e, t, n) {
2056
+ if (!F(e)) return;
2057
+ let r = P(e);
2058
+ if (r?.applied && r.height === "image") return (t ? Ot(t, e.id, n) : null) ?? yt(t?.settings);
2059
+ }
2060
+ //#endregion
2061
+ //#region src/constants/socialIcons.ts
2062
+ var At = k, jt = {
2063
+ small: 24,
2064
+ medium: 32,
2065
+ large: 48
2066
+ }, Mt = [
2067
+ "facebook",
2068
+ "twitter",
2069
+ "instagram",
2070
+ "linkedin",
2071
+ "youtube",
2072
+ "tiktok",
2073
+ "pinterest",
2074
+ "email",
2075
+ "website",
2076
+ "whatsapp",
2077
+ "telegram",
2078
+ "discord",
2079
+ "snapchat",
2080
+ "reddit",
2081
+ "github",
2082
+ "dribbble",
2083
+ "behance"
2084
+ ];
2085
+ //#endregion
2086
+ export { Ue as A, fe as B, tt as C, $e as D, et as E, Ke as F, ze as H, Ge as I, he as L, me as M, pe as N, Ye as O, Re as P, ge as R, nt as S, Qe as T, We as U, _e as V, st as _, kt as a, it as b, yt as c, mt as d, ft as f, lt as g, ut as h, Dt as i, Be as j, X as k, vt as l, dt as m, At as n, Ot as o, pt as p, Mt as r, bt as s, jt as t, ht as u, ot as v, Je as w, rt as x, at as y, le as z };