@templatical/editor 0.52.1 → 0.54.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.
- package/README.md +1 -1
- package/dist/AiAltTextPopover-NMJqQKvD.js +106 -0
- package/dist/{AiAltTextReview-9ySsXOTU.js → AiAltTextReview-Ci4zHwRc.js} +68 -66
- package/dist/AiChatPanel-C8SeEJRP.js +561 -0
- package/dist/{AiPanels-DqT4PgQ0.js → AiPanels-CR6zphjP.js} +6 -6
- package/dist/{AiRewriteMenu-28agTycW.js → AiRewriteMenu-CIHUnPud.js} +76 -105
- package/dist/BlockIssueBadge-DaPTq1RE.js +33 -0
- package/dist/BlockPreviewCanvas-B70RSavL.js +140 -0
- package/dist/{CloudHeaderExtras-QI82yF54.js → CloudHeaderExtras-XpjJjn3o.js} +4 -4
- package/dist/{CloudPanels-BKJaLkUN.js → CloudPanels-VpSQiLLL.js} +53 -53
- package/dist/CollaborationNotices-Cnx0XHzZ.js +65 -0
- package/dist/{CollaboratorBar-CXQqN3VP.js → CollaboratorBar-BaBoNhwB.js} +24 -24
- package/dist/CommentsPanel-Ck3QmqiC.js +16 -0
- package/dist/CommentsSidebar-CHknhOar.js +526 -0
- package/dist/{CountdownBlock-CU2yTWtF.js → CountdownBlock-BMezkFbJ.js} +15 -15
- package/dist/CountdownToolbar-CM4XNEuO.js +258 -0
- package/dist/IssuesPanel-1wGV0wiy.js +371 -0
- package/dist/LanguageMenu-d2GlX67r.js +403 -0
- package/dist/{LoadingTrack-DM4g6j7b.js → LoadingTrack-BG8cg9xi.js} +2 -2
- package/dist/LocaleNotices-WzsYtBRs.js +46 -0
- package/dist/LogicTagInsertButton-DgTJ6Lvx.js +1096 -0
- package/dist/{MediaEditModal-Dy08GEwE.js → MediaEditModal-C3U9Mi31.js} +451 -451
- package/dist/{MediaPanels-BgEp7iCp.js → MediaPanels-CGmk9ufe.js} +4 -4
- package/dist/{MergeTagInput-B9dtUthD.js → MergeTagInput-B_51YcQO.js} +30 -30
- package/dist/{MergeTagModeToggle-DxujhYJ4.js → MergeTagModeToggle-D3Q2z317.js} +49 -49
- package/dist/MergeTagTextarea-DZz1L9DE.js +126 -0
- package/dist/ParagraphEditor-CI68PYDL.js +825 -0
- package/dist/{RestoreVersionDialog-C4s_JYCx.js → RestoreVersionDialog-DcuhpOIz.js} +23 -23
- package/dist/{RichTextEditorContent-o6HmE8GR.js → RichTextEditorContent-Dstovi0m.js} +47 -47
- package/dist/{SaveBlockDialog-CWLrly6l.js → SaveBlockDialog-vuwvoi-d.js} +86 -86
- package/dist/{cdn/chunks/SavedBlocksBrowserModal-BPYcRoGa.js → SavedBlocksBrowserModal-DUJm0dOv.js} +135 -132
- package/dist/{SavedBlocksPanels-BE1N9rNZ.js → SavedBlocksPanels-BiMXQ5lY.js} +9 -9
- package/dist/{SavedBlocksPickBar-Dwl94xhP.js → SavedBlocksPickBar-CAstZfG7.js} +15 -15
- package/dist/TemplateSettings-Baar78_s.js +294 -0
- package/dist/TestEmailModal-Bl_GHdrN.js +212 -0
- package/dist/{TestEmailPanel-DaFjP9QK.js → TestEmailPanel-CpTBF7B5.js} +4 -4
- package/dist/TitleEditor-DkbEDAZB.js +202 -0
- package/dist/ToggleSwitch-R3wCCYE6.js +43 -0
- package/dist/Toolbar-bOZ_eq7X.js +3711 -0
- package/dist/{TplModal-DLMssVlt.js → TplModal-wk2gLa7_.js} +17 -17
- package/dist/{VersionHistoryMenu-BkbYUs0Q.js → VersionHistoryMenu-BnP0EyLl.js} +39 -39
- package/dist/{VersionHistoryPanels-DP7HaYWv.js → VersionHistoryPanels-Cq2rFKIX.js} +5 -5
- package/dist/VersionPreviewBanner-BPP939cD.js +37 -0
- package/dist/WrapperBlock-cWT_nZgQ.js +44 -0
- package/dist/{blockTypeIcons-BHjlPnPf.js → blockTypeIcons-BUyPZ7Su.js} +7 -7
- package/dist/bundle-stats.json +8 -8
- package/dist/{cdn/chunks/ca-CD-Kt1qz.js → ca-DOuIxWRv.js} +114 -2
- package/dist/cdn/chunks/AiAltTextPopover-Cnc_kUmb.js +107 -0
- package/dist/cdn/chunks/AiAltTextPopover-Cnc_kUmb.js.map +1 -0
- package/dist/cdn/chunks/{AiAltTextReview-BGLLSKLm.js → AiAltTextReview-DPeSY-7r.js} +70 -68
- package/dist/cdn/chunks/AiAltTextReview-DPeSY-7r.js.map +1 -0
- package/dist/cdn/chunks/AiChatPanel-By8Uo1nH.js +487 -0
- package/dist/cdn/chunks/AiChatPanel-By8Uo1nH.js.map +1 -0
- package/dist/cdn/chunks/{AiPanels-0wBarZSH.js → AiPanels-BblCSkQy.js} +11 -11
- package/dist/cdn/chunks/{AiPanels-0wBarZSH.js.map → AiPanels-BblCSkQy.js.map} +1 -1
- package/dist/cdn/chunks/{AiRewriteMenu-qf-cfEpy.js → AiRewriteMenu-C4btyN4W.js} +79 -79
- package/dist/cdn/chunks/AiRewriteMenu-C4btyN4W.js.map +1 -0
- package/dist/cdn/chunks/BlockIssueBadge-D3Plo_wt.js +34 -0
- package/dist/cdn/chunks/BlockIssueBadge-D3Plo_wt.js.map +1 -0
- package/dist/cdn/chunks/BlockPreviewCanvas-CTKmBPsq.js +142 -0
- package/dist/cdn/chunks/{BlockPreviewCanvas-DGBh6mqe.js.map → BlockPreviewCanvas-CTKmBPsq.js.map} +1 -1
- package/dist/cdn/chunks/{CloudHeaderExtras-BMNK_F9p.js → CloudHeaderExtras-BtqdN777.js} +4 -4
- package/dist/cdn/chunks/{CloudHeaderExtras-BMNK_F9p.js.map → CloudHeaderExtras-BtqdN777.js.map} +1 -1
- package/dist/cdn/chunks/{CloudPanels-JMWIoVWh.js → CloudPanels-COU26R83.js} +45 -45
- package/dist/cdn/chunks/{CloudPanels-JMWIoVWh.js.map → CloudPanels-COU26R83.js.map} +1 -1
- package/dist/cdn/chunks/CollaborationNotices-DraFUhyo.js +67 -0
- package/dist/cdn/chunks/CollaborationNotices-DraFUhyo.js.map +1 -0
- package/dist/cdn/chunks/{CollaboratorBar-CXByAoUz.js → CollaboratorBar-0OEH3hrj.js} +17 -17
- package/dist/cdn/chunks/{CollaboratorBar-CXByAoUz.js.map → CollaboratorBar-0OEH3hrj.js.map} +1 -1
- package/dist/cdn/chunks/CommentsPanel-tZZswofV.js +18 -0
- package/dist/cdn/chunks/{CommentsPanel-DoJnKLXI.js.map → CommentsPanel-tZZswofV.js.map} +1 -1
- package/dist/cdn/chunks/CommentsSidebar-7Hfl3Hdj.js +496 -0
- package/dist/cdn/chunks/CommentsSidebar-7Hfl3Hdj.js.map +1 -0
- package/dist/cdn/chunks/{CountdownBlock-BqRw147R.js → CountdownBlock-CjMhMhnv.js} +22 -22
- package/dist/cdn/chunks/{CountdownBlock-BqRw147R.js.map → CountdownBlock-CjMhMhnv.js.map} +1 -1
- package/dist/cdn/chunks/CountdownToolbar-CNgsNL5-.js +260 -0
- package/dist/cdn/chunks/CountdownToolbar-CNgsNL5-.js.map +1 -0
- package/dist/cdn/chunks/{IssuesPanel-C7LfxaAY.js → IssuesPanel-Duic0mIs.js} +133 -121
- package/dist/cdn/chunks/IssuesPanel-Duic0mIs.js.map +1 -0
- package/dist/cdn/chunks/LanguageMenu-B1Aue_lf.js +359 -0
- package/dist/cdn/chunks/LanguageMenu-B1Aue_lf.js.map +1 -0
- package/dist/cdn/chunks/{LoadingTrack-CZuLTazv.js → LoadingTrack-DUYcDHOV.js} +2 -2
- package/dist/cdn/chunks/{LoadingTrack-CZuLTazv.js.map → LoadingTrack-DUYcDHOV.js.map} +1 -1
- package/dist/cdn/chunks/LocaleNotices-8J2DRWeg.js +47 -0
- package/dist/cdn/chunks/LocaleNotices-8J2DRWeg.js.map +1 -0
- package/dist/{LogicTagInsertButton-CfscnwCn.js → cdn/chunks/LogicTagInsertButton-Bhvi0nWz.js} +422 -449
- package/dist/cdn/chunks/LogicTagInsertButton-Bhvi0nWz.js.map +1 -0
- package/dist/cdn/chunks/{MediaEditModal-Cpcod6_U.js → MediaEditModal-Dz972UFx.js} +421 -421
- package/dist/cdn/chunks/MediaEditModal-Dz972UFx.js.map +1 -0
- package/dist/cdn/chunks/{MediaPanels-BIdcW_1f.js → MediaPanels-C6Hqtp1H.js} +5 -5
- package/dist/cdn/chunks/{MediaPanels-BIdcW_1f.js.map → MediaPanels-C6Hqtp1H.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagInput-BvWg8o5E.js → MergeTagInput-CrhZm-AW.js} +28 -28
- package/dist/cdn/chunks/{MergeTagInput-BvWg8o5E.js.map → MergeTagInput-CrhZm-AW.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagModeToggle-BgKEVUtV.js → MergeTagModeToggle-CWVtXLYa.js} +52 -52
- package/dist/cdn/chunks/MergeTagModeToggle-CWVtXLYa.js.map +1 -0
- package/dist/cdn/chunks/MergeTagTextarea-hTIBwX0F.js +128 -0
- package/dist/cdn/chunks/MergeTagTextarea-hTIBwX0F.js.map +1 -0
- package/dist/cdn/chunks/ParagraphEditor-B2UU1Q5I.js +660 -0
- package/dist/cdn/chunks/ParagraphEditor-B2UU1Q5I.js.map +1 -0
- package/dist/cdn/chunks/{RestoreVersionDialog-CjOdD2xj.js → RestoreVersionDialog-C1Y5Ewo_.js} +22 -22
- package/dist/cdn/chunks/{RestoreVersionDialog-CjOdD2xj.js.map → RestoreVersionDialog-C1Y5Ewo_.js.map} +1 -1
- package/dist/cdn/chunks/{RichTextEditorContent-DNjR_sNN.js → RichTextEditorContent-up4AqL7D.js} +44 -44
- package/dist/cdn/chunks/{RichTextEditorContent-DNjR_sNN.js.map → RichTextEditorContent-up4AqL7D.js.map} +1 -1
- package/dist/cdn/chunks/{SaveBlockDialog-CUhpawq0.js → SaveBlockDialog-B9lwEP_T.js} +77 -77
- package/dist/cdn/chunks/{SaveBlockDialog-CUhpawq0.js.map → SaveBlockDialog-B9lwEP_T.js.map} +1 -1
- package/dist/{SavedBlocksBrowserModal-CE8n4EBS.js → cdn/chunks/SavedBlocksBrowserModal-fAeHUyxb.js} +103 -106
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-BPYcRoGa.js.map → SavedBlocksBrowserModal-fAeHUyxb.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksPanels-C6--Bc81.js → SavedBlocksPanels-DRDTLDyZ.js} +9 -9
- package/dist/cdn/chunks/{SavedBlocksPanels-C6--Bc81.js.map → SavedBlocksPanels-DRDTLDyZ.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksPickBar-DUavxpbU.js → SavedBlocksPickBar-B6b5z-o3.js} +16 -16
- package/dist/cdn/chunks/{SavedBlocksPickBar-DUavxpbU.js.map → SavedBlocksPickBar-B6b5z-o3.js.map} +1 -1
- package/dist/cdn/chunks/TemplateSettings-CWUpUKJb.js +266 -0
- package/dist/cdn/chunks/TemplateSettings-CWUpUKJb.js.map +1 -0
- package/dist/cdn/chunks/TestEmailModal-DQxnW5Q5.js +212 -0
- package/dist/cdn/chunks/TestEmailModal-DQxnW5Q5.js.map +1 -0
- package/dist/cdn/chunks/{TestEmailPanel-CcUpEpAn.js → TestEmailPanel-BcO_-16H.js} +5 -5
- package/dist/cdn/chunks/{TestEmailPanel-CcUpEpAn.js.map → TestEmailPanel-BcO_-16H.js.map} +1 -1
- package/dist/cdn/chunks/TitleEditor-pmycpmTd.js +202 -0
- package/dist/cdn/chunks/TitleEditor-pmycpmTd.js.map +1 -0
- package/dist/cdn/chunks/ToggleSwitch-BSkySwA1.js +45 -0
- package/dist/cdn/chunks/ToggleSwitch-BSkySwA1.js.map +1 -0
- package/dist/cdn/chunks/Toolbar-BlWVQRcA.js +3626 -0
- package/dist/cdn/chunks/Toolbar-BlWVQRcA.js.map +1 -0
- package/dist/cdn/chunks/{TplModal-CFPDgbwQ.js → TplModal-ClSSGX7a.js} +20 -20
- package/dist/cdn/chunks/{TplModal-CFPDgbwQ.js.map → TplModal-ClSSGX7a.js.map} +1 -1
- package/dist/cdn/chunks/{VersionHistoryMenu-BYlLRvRJ.js → VersionHistoryMenu-CZury5gU.js} +33 -33
- package/dist/cdn/chunks/{VersionHistoryMenu-BYlLRvRJ.js.map → VersionHistoryMenu-CZury5gU.js.map} +1 -1
- package/dist/cdn/chunks/{VersionHistoryPanels-C6SOVoiT.js → VersionHistoryPanels-B8GPBKMq.js} +6 -6
- package/dist/cdn/chunks/{VersionHistoryPanels-C6SOVoiT.js.map → VersionHistoryPanels-B8GPBKMq.js.map} +1 -1
- package/dist/cdn/chunks/VersionPreviewBanner-C4Ji8nu4.js +39 -0
- package/dist/cdn/chunks/VersionPreviewBanner-C4Ji8nu4.js.map +1 -0
- package/dist/cdn/chunks/WrapperBlock-BoUflYwY.js +46 -0
- package/dist/cdn/chunks/WrapperBlock-BoUflYwY.js.map +1 -0
- package/dist/cdn/chunks/{blockTypeIcons-D7FW7Ypo.js → blockTypeIcons-Cc6RJ27V.js} +5 -5
- package/dist/cdn/chunks/{blockTypeIcons-D7FW7Ypo.js.map → blockTypeIcons-Cc6RJ27V.js.map} +1 -1
- package/dist/{ca-CD-Kt1qz.js → cdn/chunks/ca-DOuIxWRv.js} +116 -0
- package/dist/cdn/chunks/ca-DOuIxWRv.js.map +1 -0
- package/dist/cdn/chunks/composables-C1KU4ZHw.js +3039 -0
- package/dist/cdn/chunks/composables-C1KU4ZHw.js.map +1 -0
- package/dist/cdn/chunks/{createCloudRuntime-Cth2JCEh.js → createCloudRuntime-C2Zs5F1O.js} +75 -73
- package/dist/cdn/chunks/createCloudRuntime-C2Zs5F1O.js.map +1 -0
- package/dist/{de-CeFJ6wbM.js → cdn/chunks/de-DaOUfYBX.js} +116 -0
- package/dist/cdn/chunks/de-DaOUfYBX.js.map +1 -0
- package/dist/cdn/chunks/{dist-8ym3y-pH.js → dist-BzXULHvI.js} +48 -48
- package/dist/cdn/chunks/{dist-8ym3y-pH.js.map → dist-BzXULHvI.js.map} +1 -1
- package/dist/cdn/chunks/{dist-BMzNabtD.js → dist-DqGgijFI.js} +114 -114
- package/dist/cdn/chunks/{dist-BMzNabtD.js.map → dist-DqGgijFI.js.map} +1 -1
- package/dist/cdn/chunks/{draggable-Du8AUMFT.js → draggable-DepKdldn.js} +1491 -1486
- package/dist/cdn/chunks/draggable-DepKdldn.js.map +1 -0
- package/dist/cdn/chunks/{editor-modal-CyCe560f.js → editor-modal-erQEOHZN.js} +781 -781
- package/dist/cdn/chunks/{editor-modal-CyCe560f.js.map → editor-modal-erQEOHZN.js.map} +1 -1
- package/dist/cdn/chunks/en-B6tLGRHq.js +1 -0
- package/dist/{en-D14i5nFh.js → cdn/chunks/en-C0pHHMiR.js} +116 -0
- package/dist/cdn/chunks/en-C0pHHMiR.js.map +1 -0
- package/dist/{es-zDacbMhs.js → cdn/chunks/es-CxyEKr6n.js} +116 -0
- package/dist/cdn/chunks/es-CxyEKr6n.js.map +1 -0
- package/dist/cdn/chunks/{extensions-CFF2KWy-.js → extensions-DcMKZpzh.js} +59 -59
- package/dist/cdn/chunks/{extensions-CFF2KWy-.js.map → extensions-DcMKZpzh.js.map} +1 -1
- package/dist/{fr-CSgYtjOd.js → cdn/chunks/fr-CYbamiI6.js} +116 -0
- package/dist/cdn/chunks/fr-CYbamiI6.js.map +1 -0
- package/dist/cdn/chunks/{icons-okSPsLOa.js → icons-Da9GKjPx.js} +188 -147
- package/dist/cdn/chunks/icons-Da9GKjPx.js.map +1 -0
- package/dist/{ja-B7H3ID8O.js → cdn/chunks/ja-DfaIAoGI.js} +116 -0
- package/dist/cdn/chunks/ja-DfaIAoGI.js.map +1 -0
- package/dist/cdn/chunks/keys-CoQtCqNv.js +11 -0
- package/dist/cdn/chunks/keys-CoQtCqNv.js.map +1 -0
- package/dist/cdn/chunks/languageName-DEEOhDWI.js +12 -0
- package/dist/cdn/chunks/languageName-DEEOhDWI.js.map +1 -0
- package/dist/{nl-176ySmc5.js → cdn/chunks/nl-DkrB-VKZ.js} +116 -0
- package/dist/cdn/chunks/nl-DkrB-VKZ.js.map +1 -0
- package/dist/cdn/chunks/normalizeMergeTagMarkup-cC32Ox6A.js +290 -0
- package/dist/cdn/chunks/normalizeMergeTagMarkup-cC32Ox6A.js.map +1 -0
- package/dist/cdn/chunks/noticeTones-D7BPu-Le.js +16 -0
- package/dist/cdn/chunks/noticeTones-D7BPu-Le.js.map +1 -0
- package/dist/cdn/chunks/plural-CyxrJXL1.js +17 -0
- package/dist/cdn/chunks/plural-CyxrJXL1.js.map +1 -0
- package/dist/{preRenderCustomBlocks--_xc0XK3.js → cdn/chunks/preRenderCustomBlocks-f7GEKdvw.js} +5 -3
- package/dist/cdn/chunks/{preRenderCustomBlocks-BcXIz7oJ.js.map → preRenderCustomBlocks-f7GEKdvw.js.map} +1 -1
- package/dist/{pt-BR-dDlTwX18.js → cdn/chunks/pt-BR-CY5Ye7eP.js} +116 -0
- package/dist/cdn/chunks/pt-BR-CY5Ye7eP.js.map +1 -0
- package/dist/cdn/chunks/sanitizeHtml-WTfz9lZd.js +61 -0
- package/dist/cdn/chunks/sanitizeHtml-WTfz9lZd.js.map +1 -0
- package/dist/cdn/chunks/socialIcons-DeCYorUT.js +2638 -0
- package/dist/cdn/chunks/socialIcons-DeCYorUT.js.map +1 -0
- package/dist/cdn/chunks/{src-DEd87i_U.js → src-A_cKeTM_.js} +618 -461
- package/dist/cdn/chunks/src-A_cKeTM_.js.map +1 -0
- package/dist/cdn/chunks/src-BQUv2CYU.js +2606 -0
- package/dist/cdn/chunks/src-BQUv2CYU.js.map +1 -0
- package/dist/cdn/chunks/src-BWX_xVxO.js +671 -0
- package/dist/cdn/chunks/src-BWX_xVxO.js.map +1 -0
- package/dist/{styleConstants-B8xVRiwX.js → cdn/chunks/styleConstants-CgiNKdnc.js} +7 -5
- package/dist/cdn/chunks/styleConstants-CgiNKdnc.js.map +1 -0
- package/dist/cdn/chunks/templateSettingsFields-cjlP-jdw.js.map +1 -1
- package/dist/cdn/chunks/{tiptap-CbiTlECY.js → tiptap-Dipw_zOQ.js} +40 -40
- package/dist/cdn/chunks/{tiptap-CbiTlECY.js.map → tiptap-Dipw_zOQ.js.map} +1 -1
- package/dist/cdn/chunks/{useCloudI18n-DY8_-ETE.js → useCloudI18n-Cc5NZqiI.js} +3 -3
- package/dist/cdn/chunks/{useCloudI18n-DY8_-ETE.js.map → useCloudI18n-Cc5NZqiI.js.map} +1 -1
- package/dist/cdn/chunks/useEditorRoot-D_LuZ_hE.js +9 -0
- package/dist/cdn/chunks/{useEditorRoot-vjZJwKrV.js.map → useEditorRoot-D_LuZ_hE.js.map} +1 -1
- package/dist/cdn/chunks/{useI18n-D8pY4LTq.js → useI18n-BnJYydPv.js} +3 -3
- package/dist/cdn/chunks/{useI18n-D8pY4LTq.js.map → useI18n-BnJYydPv.js.map} +1 -1
- package/dist/cdn/chunks/useLocalizedDisplay-aGfnO90D.js +33 -0
- package/dist/cdn/chunks/useLocalizedDisplay-aGfnO90D.js.map +1 -0
- package/dist/cdn/chunks/{useLogicTag-DBJDtpKA.js → useLogicTag-DtYe8HIq.js} +5 -5
- package/dist/cdn/chunks/{useLogicTag-DBJDtpKA.js.map → useLogicTag-DtYe8HIq.js.map} +1 -1
- package/dist/cdn/chunks/{useMergeTag-B-aG--s1.js → useMergeTag-B8ULmsnp.js} +6 -6
- package/dist/cdn/chunks/{useMergeTag-B-aG--s1.js.map → useMergeTag-B8ULmsnp.js.map} +1 -1
- package/dist/cdn/chunks/usePopoverPosition-BWAXWeBv.js +78 -0
- package/dist/cdn/chunks/usePopoverPosition-BWAXWeBv.js.map +1 -0
- package/dist/cdn/chunks/{useScrollToBlock-vjQ0fe-L.js → useScrollToBlock-Ct1AwLD-.js} +5 -5
- package/dist/cdn/chunks/useScrollToBlock-Ct1AwLD-.js.map +1 -0
- package/dist/cdn/chunks/{withCurrentFont-hZTvYBHO.js → withCurrentFont-MK8ga9q9.js} +2 -2
- package/dist/cdn/chunks/{withCurrentFont-hZTvYBHO.js.map → withCurrentFont-MK8ga9q9.js.map} +1 -1
- package/dist/cdn/editor.css +1 -1
- package/dist/cdn/editor.js +2189 -1495
- package/dist/cdn/editor.js.map +1 -1
- package/dist/{check-BZ8o0eet.js → check-XMnOOIEC.js} +1 -1
- package/dist/{chevron-down-DfAAfILv.js → chevron-down-DmamTEWQ.js} +1 -1
- package/dist/{chevron-right-Bk4mGdr7.js → chevron-right-BEFXOH27.js} +1 -1
- package/dist/{chevron-up-MhUf_azW.js → chevron-up-Dw7woXj8.js} +1 -1
- package/dist/{circle-alert-CShJwVFv.js → circle-alert-BTKC9vkq.js} +1 -1
- package/dist/{clock-CTfD6OCt.js → clock-BVT5u2uG.js} +1 -1
- package/dist/composables-CMIrGXJ1.js +4517 -0
- package/dist/{createCloudRuntime-DCgO4A1r.js → createCloudRuntime-DGV5a5Af.js} +54 -52
- package/dist/{createLucideIcon-CvhTA2KG.js → createLucideIcon-CgDE3xAR.js} +16 -16
- package/dist/{cdn/chunks/de-CeFJ6wbM.js → de-DaOUfYBX.js} +114 -2
- package/dist/{dist-ByCWA2Tv.js → dist-0alKVRc_.js} +101 -101
- package/dist/{dist-Cy8I5scI.js → dist-54VCNoC0.js} +2 -2
- package/dist/dist-6DU0me3E.js +4 -0
- package/dist/{dist-p3wymUDt.js → dist-B8dY8drK.js} +2 -2
- package/dist/{dist-Dd5MU2Ev.js → dist-B9a7iVye.js} +2 -2
- package/dist/{dist-V7W1UhVr.js → dist-BWflWcpW.js} +2 -2
- package/dist/{dist-D6fZec6r.js → dist-C3hu_C3w.js} +2 -2
- package/dist/{dist-CVy-7PHQ.js → dist-CX7skkvG.js} +48 -48
- package/dist/dist-CcOn7WCo.js +4 -0
- package/dist/dist-Cdkm20M6.js +2542 -0
- package/dist/{dist-BS5uKktL.js → dist-ChOb5XHW.js} +2 -2
- package/dist/{dist-BF5zEHop.js → dist-DZ3X-uB8.js} +2 -2
- package/dist/{dist-CWSG7Kj0.js → dist-D_XrUEET.js} +5 -5
- package/dist/{dist-txQLT2sF.js → dist-TAv500j6.js} +2 -2
- package/dist/{dist-D6cMdrfG.js → dist-fqSers8_.js} +55 -55
- package/dist/{editor-modal-zaZHcmlO.js → editor-modal-BeX6otLk.js} +953 -952
- package/dist/{cdn/chunks/en-D14i5nFh.js → en-C0pHHMiR.js} +114 -2
- package/dist/en-Do0SU6tR.js +1 -0
- package/dist/{cdn/chunks/es-zDacbMhs.js → es-CxyEKr6n.js} +114 -2
- package/dist/{extensions-fo_c-vqf.js → extensions-BJ184osp.js} +173 -173
- package/dist/{eye-7W4t5e0Q.js → eye-ByMgHeA_.js} +1 -1
- package/dist/{cdn/chunks/fr-CSgYtjOd.js → fr-CYbamiI6.js} +114 -2
- package/dist/{image-BDiRFzSd.js → image-Ch8tR35K.js} +1 -1
- package/dist/index.d.ts +182 -14
- package/dist/{info-Cxi3-Kh9.js → info-DzSD-Wpk.js} +1 -1
- package/dist/{cdn/chunks/ja-B7H3ID8O.js → ja-DfaIAoGI.js} +114 -2
- package/dist/keys-BCqskl51.js +9 -0
- package/dist/languageName-DEEOhDWI.js +10 -0
- package/dist/{link-ju_2Cmir.js → link-oDn9AR2w.js} +1 -1
- package/dist/{list-DYZJf0aZ.js → list-C5t07dp8.js} +1 -1
- package/dist/{loader-circle-BZRD0a4I.js → loader-circle-k6xvKgUB.js} +1 -1
- package/dist/{message-circle-DuEw4Zfx.js → message-circle-C23R6OJR.js} +1 -1
- package/dist/{cdn/chunks/nl-176ySmc5.js → nl-DkrB-VKZ.js} +114 -2
- package/dist/normalizeMergeTagMarkup-CUCo7B5X.js +288 -0
- package/dist/noticeTones-D7BPu-Le.js +14 -0
- package/dist/{package-CePMr2kK.js → package-C90eQ7NU.js} +1 -1
- package/dist/{pencil-D3aFCL7c.js → pencil-BK7GrQuA.js} +1 -1
- package/dist/plural-CyxrJXL1.js +15 -0
- package/dist/plus-Cr0Mis63.js +13 -0
- package/dist/{cdn/chunks/preRenderCustomBlocks-BcXIz7oJ.js → preRenderCustomBlocks-Bs3N9no-.js} +4 -6
- package/dist/{cdn/chunks/pt-BR-dDlTwX18.js → pt-BR-CY5Ye7eP.js} +114 -2
- package/dist/{refresh-cw-xnro7_Sk.js → refresh-cw-_ZLOIEvA.js} +2 -12
- package/dist/rotate-ccw-CB5wsHwv.js +13 -0
- package/dist/{runtime-dom.esm-bundler-BURR-bj5.js → runtime-dom.esm-bundler-DlHp8xgy.js} +154 -154
- package/dist/sanitizeHtml-2rjV0r-6.js +962 -0
- package/dist/{search-CDrstRBv.js → search-BmrQNox8.js} +1 -1
- package/dist/{send-DROkPOaX.js → send-blAsIBBg.js} +1 -1
- package/dist/{smartphone-Bx6u_tjn.js → smartphone-BPpWYrwV.js} +1 -1
- package/dist/socialIcons-TFiOkpoU.js +2705 -0
- package/dist/{sparkles-CdaTtvoz.js → sparkles-OqIxrNp-.js} +1 -1
- package/dist/{square-BbCROH_f.js → square-BP-V7iT-.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{cdn/chunks/styleConstants-B8xVRiwX.js → styleConstants-CgiNKdnc.js} +5 -7
- package/dist/templatical-editor.js +2438 -1752
- package/dist/{text-align-start-CGacJ9Vw.js → text-align-start-4mwX2o-F.js} +13 -13
- package/dist/{trash-DxCd7zIy.js → trash-B99WixTA.js} +1 -1
- package/dist/{triangle-alert-7_oaitpf.js → triangle-alert-CHMiDkHa.js} +1 -1
- package/dist/{upload-DuFEOi_0.js → upload-Cp8o-hrN.js} +1 -1
- package/dist/{useCloudI18n-DEMmUKuO.js → useCloudI18n-Dh2iydo1.js} +4 -4
- package/dist/useEditorRoot-DY3mgcHm.js +7 -0
- package/dist/{useI18n-BBrHTdu8.js → useI18n-CgtvtF4C.js} +4 -4
- package/dist/useLocalizedDisplay-DNNwDRxL.js +31 -0
- package/dist/{useLogicTag-ZPC39rfH.js → useLogicTag-BXXXQQmi.js} +4 -4
- package/dist/{useMergeTag-BQ4qqWpQ.js → useMergeTag-C9Okr87y.js} +5 -5
- package/dist/usePopoverPosition-VDQjyX_A.js +76 -0
- package/dist/{useScrollToBlock-BSyAV4pk.js → useScrollToBlock-B35ObCGK.js} +5 -5
- package/dist/{vue.runtime.esm-bundler-CnEeTfhs.js → vue.runtime.esm-bundler-BJXc_Mri.js} +1373 -1368
- package/dist/withCurrentFont-DJiQqZzL.js +18 -0
- package/dist/{x-BpfG7v9g.js → x-BIBStNMS.js} +1 -1
- package/package.json +21 -21
- package/dist/AiAltTextPopover-DawbUywc.js +0 -105
- package/dist/AiChatPanel-CupPhmsN.js +0 -548
- package/dist/BlockIssueBadge-BxpDy3u-.js +0 -33
- package/dist/BlockPreviewCanvas-B-4bmJ3t.js +0 -140
- package/dist/CollaborationNotices-CTw4JThq.js +0 -75
- package/dist/CommentsPanel-DwwFuh1h.js +0 -16
- package/dist/CommentsSidebar-9ZfiC2DO.js +0 -500
- package/dist/CountdownToolbar-BqoYzf_6.js +0 -197
- package/dist/IssuesPanel-4ykrf1ax.js +0 -359
- package/dist/MergeTagTextarea-CPFEjJZd.js +0 -69
- package/dist/ParagraphEditor-CWXfurGh.js +0 -796
- package/dist/TemplateSettings-CS0f1Ues.js +0 -236
- package/dist/TestEmailModal-DBD0X5nV.js +0 -209
- package/dist/TitleEditor-DSqtle77.js +0 -198
- package/dist/ToggleSwitch-JykPyD_8.js +0 -36
- package/dist/Toolbar-BZPFfKrf.js +0 -3145
- package/dist/VersionPreviewBanner-DECaBwLq.js +0 -37
- package/dist/WrapperBlock-BsJv_Fiw.js +0 -44
- package/dist/cdn/chunks/AiAltTextPopover-SEEjkd-I.js +0 -106
- package/dist/cdn/chunks/AiAltTextPopover-SEEjkd-I.js.map +0 -1
- package/dist/cdn/chunks/AiAltTextReview-BGLLSKLm.js.map +0 -1
- package/dist/cdn/chunks/AiChatPanel-DKDAaBNi.js +0 -474
- package/dist/cdn/chunks/AiChatPanel-DKDAaBNi.js.map +0 -1
- package/dist/cdn/chunks/AiRewriteMenu-qf-cfEpy.js.map +0 -1
- package/dist/cdn/chunks/BlockIssueBadge-jdf91-nk.js +0 -34
- package/dist/cdn/chunks/BlockIssueBadge-jdf91-nk.js.map +0 -1
- package/dist/cdn/chunks/BlockPreviewCanvas-DGBh6mqe.js +0 -142
- package/dist/cdn/chunks/CollaborationNotices-Bsf1rGW9.js +0 -77
- package/dist/cdn/chunks/CollaborationNotices-Bsf1rGW9.js.map +0 -1
- package/dist/cdn/chunks/CommentsPanel-DoJnKLXI.js +0 -18
- package/dist/cdn/chunks/CommentsSidebar-CUtgvdBC.js +0 -470
- package/dist/cdn/chunks/CommentsSidebar-CUtgvdBC.js.map +0 -1
- package/dist/cdn/chunks/CountdownToolbar-xobieKoU.js +0 -199
- package/dist/cdn/chunks/CountdownToolbar-xobieKoU.js.map +0 -1
- package/dist/cdn/chunks/IssuesPanel-C7LfxaAY.js.map +0 -1
- package/dist/cdn/chunks/LogicTagInsertButton-BIi05UQu.js +0 -1051
- package/dist/cdn/chunks/LogicTagInsertButton-BIi05UQu.js.map +0 -1
- package/dist/cdn/chunks/MediaEditModal-Cpcod6_U.js.map +0 -1
- package/dist/cdn/chunks/MergeTagModeToggle-BgKEVUtV.js.map +0 -1
- package/dist/cdn/chunks/MergeTagTextarea-tBz8McZf.js +0 -71
- package/dist/cdn/chunks/MergeTagTextarea-tBz8McZf.js.map +0 -1
- package/dist/cdn/chunks/ParagraphEditor-B3Rj_cWF.js +0 -631
- package/dist/cdn/chunks/ParagraphEditor-B3Rj_cWF.js.map +0 -1
- package/dist/cdn/chunks/TemplateSettings-CKtI-dof.js +0 -208
- package/dist/cdn/chunks/TemplateSettings-CKtI-dof.js.map +0 -1
- package/dist/cdn/chunks/TestEmailModal-CDQTgESD.js +0 -209
- package/dist/cdn/chunks/TestEmailModal-CDQTgESD.js.map +0 -1
- package/dist/cdn/chunks/TitleEditor-Cob7RLyK.js +0 -198
- package/dist/cdn/chunks/TitleEditor-Cob7RLyK.js.map +0 -1
- package/dist/cdn/chunks/ToggleSwitch-J7Vwhvha.js +0 -38
- package/dist/cdn/chunks/ToggleSwitch-J7Vwhvha.js.map +0 -1
- package/dist/cdn/chunks/Toolbar-CdpsvNOR.js +0 -3061
- package/dist/cdn/chunks/Toolbar-CdpsvNOR.js.map +0 -1
- package/dist/cdn/chunks/VersionPreviewBanner-Dvg0ZfAW.js +0 -39
- package/dist/cdn/chunks/VersionPreviewBanner-Dvg0ZfAW.js.map +0 -1
- package/dist/cdn/chunks/WrapperBlock-C7Md56IT.js +0 -46
- package/dist/cdn/chunks/WrapperBlock-C7Md56IT.js.map +0 -1
- package/dist/cdn/chunks/ca-CD-Kt1qz.js.map +0 -1
- package/dist/cdn/chunks/createCloudRuntime-Cth2JCEh.js.map +0 -1
- package/dist/cdn/chunks/de-CeFJ6wbM.js.map +0 -1
- package/dist/cdn/chunks/draggable-Du8AUMFT.js.map +0 -1
- package/dist/cdn/chunks/en-D14i5nFh.js.map +0 -1
- package/dist/cdn/chunks/en-TIqv4ag3.js +0 -1
- package/dist/cdn/chunks/es-zDacbMhs.js.map +0 -1
- package/dist/cdn/chunks/fr-CSgYtjOd.js.map +0 -1
- package/dist/cdn/chunks/icons-okSPsLOa.js.map +0 -1
- package/dist/cdn/chunks/ja-B7H3ID8O.js.map +0 -1
- package/dist/cdn/chunks/keys-CUj6UA38.js +0 -11
- package/dist/cdn/chunks/keys-CUj6UA38.js.map +0 -1
- package/dist/cdn/chunks/nl-176ySmc5.js.map +0 -1
- package/dist/cdn/chunks/normalizeMergeTagMarkup-C_KlfSW4.js +0 -198
- package/dist/cdn/chunks/normalizeMergeTagMarkup-C_KlfSW4.js.map +0 -1
- package/dist/cdn/chunks/pt-BR-dDlTwX18.js.map +0 -1
- package/dist/cdn/chunks/sanitizeHtml-CN85EDrO.js +0 -72
- package/dist/cdn/chunks/sanitizeHtml-CN85EDrO.js.map +0 -1
- package/dist/cdn/chunks/socialIcons-jsTDmkbb.js +0 -2008
- package/dist/cdn/chunks/socialIcons-jsTDmkbb.js.map +0 -1
- package/dist/cdn/chunks/src-C7bkofBL.js +0 -647
- package/dist/cdn/chunks/src-C7bkofBL.js.map +0 -1
- package/dist/cdn/chunks/src-DEd87i_U.js.map +0 -1
- package/dist/cdn/chunks/src-DwWrYnUj.js +0 -1404
- package/dist/cdn/chunks/src-DwWrYnUj.js.map +0 -1
- package/dist/cdn/chunks/styleConstants-B8xVRiwX.js.map +0 -1
- package/dist/cdn/chunks/useEditorCore-BrY66C2y.js +0 -2582
- package/dist/cdn/chunks/useEditorCore-BrY66C2y.js.map +0 -1
- package/dist/cdn/chunks/useEditorRoot-vjZJwKrV.js +0 -9
- package/dist/cdn/chunks/usePopoverPosition-DSMtmu2W.js +0 -70
- package/dist/cdn/chunks/usePopoverPosition-DSMtmu2W.js.map +0 -1
- package/dist/cdn/chunks/useScrollToBlock-vjQ0fe-L.js.map +0 -1
- package/dist/dist-CKi_npZM.js +0 -1344
- package/dist/dist-DyFArF_G.js +0 -4
- package/dist/dist-pA3ooG6N.js +0 -4
- package/dist/en-Db76vJbY.js +0 -1
- package/dist/keys-BgRERHzu.js +0 -9
- package/dist/normalizeMergeTagMarkup-CELnOlgK.js +0 -196
- package/dist/sanitizeHtml-BzfzpYJY.js +0 -942
- package/dist/socialIcons-D7MGsg0d.js +0 -2075
- package/dist/useEditorCore-BSo2sSID.js +0 -4059
- package/dist/useEditorRoot-BMcoCLBx.js +0 -7
- package/dist/usePopoverPosition-DV1PxL66.js +0 -68
- package/dist/withCurrentFont-B22FXAF5.js +0 -18
|
@@ -1,2075 +0,0 @@
|
|
|
1
|
-
import { $ as e, C as t, K as n, Mt as r, Nt as i, O as a, Q as o, W as s, X as c, Z as l, _ as u, at as d, c as f, ct as p, f as m, g as h, j as g, jt as _, r as v, st as y, tt as b, y as x, z as S } from "./vue.runtime.esm-bundler-CnEeTfhs.js";
|
|
2
|
-
import { Ot as C, S as w, St as T, U as E, X as D, Y as O, _ as k, b as A, f as j, ft as M, g as N, it as P, k as F, l as I, m as L, p as R, ut as z, v as ee, vt as B, w as V, x as te, y as H } from "./dist-CKi_npZM.js";
|
|
3
|
-
import { r as U } from "./dist-ByCWA2Tv.js";
|
|
4
|
-
import { L as W, P as ne, c as re, x as G } from "./keys-BgRERHzu.js";
|
|
5
|
-
import { t as ie } from "./useI18n-BBrHTdu8.js";
|
|
6
|
-
import { o as ae, s as K } from "./usePopoverPosition-DV1PxL66.js";
|
|
7
|
-
import { t as q } from "./createLucideIcon-CvhTA2KG.js";
|
|
8
|
-
import { t as oe } from "./upload-DuFEOi_0.js";
|
|
9
|
-
import { t as se } from "./loader-circle-BZRD0a4I.js";
|
|
10
|
-
// ../core/dist/index.js
|
|
11
|
-
function J(e) {
|
|
12
|
-
return e instanceof Error ? e : Error(String(e), { cause: e });
|
|
13
|
-
}
|
|
14
|
-
function Y(e, t) {
|
|
15
|
-
try {
|
|
16
|
-
t();
|
|
17
|
-
} catch (t) {
|
|
18
|
-
e?.(J(t));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function ce(t) {
|
|
22
|
-
let n = t.content ?? F(t.defaultFontFamily, t.templateDefaults);
|
|
23
|
-
H(n), A(n);
|
|
24
|
-
let r = l({
|
|
25
|
-
template: null,
|
|
26
|
-
content: n,
|
|
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
|
-
}), i = e(0), a = 0, c = 0;
|
|
36
|
-
function u() {
|
|
37
|
-
r.isDirty = !0, c++;
|
|
38
|
-
}
|
|
39
|
-
let d = s({
|
|
40
|
-
get: () => r.content,
|
|
41
|
-
set: (e) => {
|
|
42
|
-
r.content = e, u();
|
|
43
|
-
}
|
|
44
|
-
}), f = s(() => r.selectedBlockId ? p(r.content.blocks, r.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(e) {
|
|
74
|
-
return t.lockedBlocks?.value.has(e) ?? !1;
|
|
75
|
-
}
|
|
76
|
-
function _(e) {
|
|
77
|
-
let t = h(r.content.blocks, e);
|
|
78
|
-
if (!t) return null;
|
|
79
|
-
let n = t.blocks.findIndex((t) => t.id === e);
|
|
80
|
-
return n === -1 ? null : {
|
|
81
|
-
targetSectionId: t.sectionId,
|
|
82
|
-
columnIndex: t.columnIndex,
|
|
83
|
-
index: n
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
function v(e, t = !0) {
|
|
87
|
-
H(e), A(e), r.content = e, t && u();
|
|
88
|
-
}
|
|
89
|
-
function y(e) {
|
|
90
|
-
e && g(e) || (r.selectedBlockId = e);
|
|
91
|
-
}
|
|
92
|
-
function b(e) {
|
|
93
|
-
r.viewport = e;
|
|
94
|
-
}
|
|
95
|
-
function x(e) {
|
|
96
|
-
r.darkMode = e;
|
|
97
|
-
}
|
|
98
|
-
function S(e) {
|
|
99
|
-
r.uiTheme = e;
|
|
100
|
-
}
|
|
101
|
-
function C(e) {
|
|
102
|
-
r.previewMode = e, e && (r.selectedBlockId = null);
|
|
103
|
-
}
|
|
104
|
-
function w(e, t) {
|
|
105
|
-
if (g(e)) return;
|
|
106
|
-
let n = p(r.content.blocks, e);
|
|
107
|
-
n && (Object.assign(n, t), u());
|
|
108
|
-
}
|
|
109
|
-
function T(e) {
|
|
110
|
-
r.content.settings = {
|
|
111
|
-
...r.content.settings,
|
|
112
|
-
...e
|
|
113
|
-
}, u();
|
|
114
|
-
}
|
|
115
|
-
function E(e, t, n = 0, i) {
|
|
116
|
-
let a = {
|
|
117
|
-
settings: r.content.settings,
|
|
118
|
-
blocks: [e]
|
|
119
|
-
};
|
|
120
|
-
if (H(a), A(a), !(t && e.type === "section")) {
|
|
121
|
-
if (t) {
|
|
122
|
-
if (g(t)) return;
|
|
123
|
-
let a = p(r.content.blocks, t);
|
|
124
|
-
if (a && a.type === "section") {
|
|
125
|
-
if (n < 0 || n >= D(a.columns)) return;
|
|
126
|
-
a.children[n] = a.children[n] || [];
|
|
127
|
-
let t = a.children[n];
|
|
128
|
-
i !== void 0 && i < t.length ? t.splice(i, 0, e) : t.push(e);
|
|
129
|
-
}
|
|
130
|
-
} else i !== void 0 && i < r.content.blocks.length ? r.content.blocks.splice(i, 0, e) : r.content.blocks.push(e);
|
|
131
|
-
u();
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
function O(e) {
|
|
135
|
-
if (g(e)) return;
|
|
136
|
-
let t = h(r.content.blocks, e);
|
|
137
|
-
if (t) {
|
|
138
|
-
let n = t.blocks.findIndex((t) => t.id === e);
|
|
139
|
-
if (n !== -1) {
|
|
140
|
-
let [e] = t.blocks.splice(n, 1);
|
|
141
|
-
if (r.selectedBlockId) {
|
|
142
|
-
let t = /* @__PURE__ */ new Set();
|
|
143
|
-
m(e, t), t.has(r.selectedBlockId) && (r.selectedBlockId = null);
|
|
144
|
-
}
|
|
145
|
-
u();
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
function k(e, t, n, i = 0) {
|
|
150
|
-
if (g(e) || n && g(n)) return;
|
|
151
|
-
let a = h(r.content.blocks, e);
|
|
152
|
-
if (!a) return;
|
|
153
|
-
let o = a.blocks.findIndex((t) => t.id === e);
|
|
154
|
-
if (o === -1 || n && a.blocks[o].type === "section") return;
|
|
155
|
-
let s;
|
|
156
|
-
if (n) {
|
|
157
|
-
let e = p(r.content.blocks, n);
|
|
158
|
-
if (!e || e.type !== "section" || i < 0 || i >= D(e.columns)) return;
|
|
159
|
-
e.children[i] = e.children[i] || [], s = e.children[i];
|
|
160
|
-
} else s = r.content.blocks;
|
|
161
|
-
let [c] = a.blocks.splice(o, 1);
|
|
162
|
-
s.splice(t, 0, c), u();
|
|
163
|
-
}
|
|
164
|
-
function j() {
|
|
165
|
-
u();
|
|
166
|
-
}
|
|
167
|
-
function M(e, t) {
|
|
168
|
-
throw new L(`[Templatical] Templates: ${e} ${t}`);
|
|
169
|
-
}
|
|
170
|
-
function N(e) {
|
|
171
|
-
Y(t.onError, e);
|
|
172
|
-
}
|
|
173
|
-
function P(e) {
|
|
174
|
-
let { templates: n } = t;
|
|
175
|
-
return n || M(e, "needs a templates provider. Pass one as `init({ templates })` to enable saving and loading."), n;
|
|
176
|
-
}
|
|
177
|
-
function I(e) {
|
|
178
|
-
r.template && (r.template = {
|
|
179
|
-
...r.template,
|
|
180
|
-
name: e
|
|
181
|
-
}, u());
|
|
182
|
-
}
|
|
183
|
-
async function R(e) {
|
|
184
|
-
let n = P("create()"), { create: o } = n;
|
|
185
|
-
typeof o != "function" && M("create()", "is disabled by the provider — its `create` is `false`.");
|
|
186
|
-
let s, l = ++a;
|
|
187
|
-
r.isLoading = !0;
|
|
188
|
-
try {
|
|
189
|
-
e?.content && (r.content = e.content);
|
|
190
|
-
let t = c;
|
|
191
|
-
s = await o(e?.name === void 0 ? { content: r.content } : {
|
|
192
|
-
name: e.name,
|
|
193
|
-
content: r.content
|
|
194
|
-
}), r.template = s, c === t && (r.isDirty = !1), i.value++;
|
|
195
|
-
} catch (e) {
|
|
196
|
-
throw t.onError?.(e), e;
|
|
197
|
-
} finally {
|
|
198
|
-
a === l && (r.isLoading = !1);
|
|
199
|
-
}
|
|
200
|
-
return N(() => n.onCreated?.(s)), s;
|
|
201
|
-
}
|
|
202
|
-
async function z(e, n) {
|
|
203
|
-
let o = P("load()"), s, c = ++a;
|
|
204
|
-
r.isLoading = !0;
|
|
205
|
-
try {
|
|
206
|
-
if (s = await o.load(e), H(s.content), A(s.content), n && !n()) return s;
|
|
207
|
-
r.template = s, r.content = s.content, r.isDirty = !1, i.value++;
|
|
208
|
-
} catch (e) {
|
|
209
|
-
throw t.onError?.(e), e;
|
|
210
|
-
} finally {
|
|
211
|
-
a === c && (r.isLoading = !1);
|
|
212
|
-
}
|
|
213
|
-
return N(() => o.onLoaded?.(s)), s;
|
|
214
|
-
}
|
|
215
|
-
async function ee(e = "api") {
|
|
216
|
-
let n = P("save()"), { save: i } = n;
|
|
217
|
-
typeof i != "function" && M("save()", "is disabled by the provider — its `save` is `false`.");
|
|
218
|
-
let a = r.template;
|
|
219
|
-
a || M("save()", "has no template loaded. Call create() or load() first.");
|
|
220
|
-
let o = a.name === void 0 ? { content: r.content } : {
|
|
221
|
-
name: a.name,
|
|
222
|
-
content: r.content
|
|
223
|
-
}, s;
|
|
224
|
-
r.isSaving = !0;
|
|
225
|
-
try {
|
|
226
|
-
let e = c;
|
|
227
|
-
if (s = await i(a.id, o), r.template?.id === a.id) {
|
|
228
|
-
let e = r.template.name;
|
|
229
|
-
r.template = e === a.name ? s : {
|
|
230
|
-
...s,
|
|
231
|
-
name: e
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
c === e && (r.isDirty = !1);
|
|
235
|
-
} catch (e) {
|
|
236
|
-
throw t.onError?.(e), e;
|
|
237
|
-
} finally {
|
|
238
|
-
r.isSaving = !1;
|
|
239
|
-
}
|
|
240
|
-
return N(() => n.onSaved?.(s, { trigger: e })), s;
|
|
241
|
-
}
|
|
242
|
-
function B() {
|
|
243
|
-
return r.template?.id !== void 0;
|
|
244
|
-
}
|
|
245
|
-
return {
|
|
246
|
-
state: o(r),
|
|
247
|
-
loadVersion: o(i),
|
|
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: w,
|
|
258
|
-
updateSettings: T,
|
|
259
|
-
addBlock: E,
|
|
260
|
-
removeBlock: O,
|
|
261
|
-
moveBlock: k,
|
|
262
|
-
markDirty: j,
|
|
263
|
-
findBlockLocation: _,
|
|
264
|
-
setName: I,
|
|
265
|
-
create: R,
|
|
266
|
-
load: z,
|
|
267
|
-
save: ee,
|
|
268
|
-
hasTemplate: B
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
var le = 50, ue = 300, de = 1500;
|
|
272
|
-
function fe(t) {
|
|
273
|
-
let { content: n, setContent: r, maxSize: i = le } = t, a = e([]), o = e([]), c = e(!1), l = null, u = null, d = s(() => a.value.length > 0), f = s(() => o.value.length > 0);
|
|
274
|
-
function p() {
|
|
275
|
-
return T(n.value);
|
|
276
|
-
}
|
|
277
|
-
function m(e) {
|
|
278
|
-
a.value.push(e), a.value.length > i && a.value.splice(0, a.value.length - i);
|
|
279
|
-
}
|
|
280
|
-
function h() {
|
|
281
|
-
u &&= (clearTimeout(u.timeoutId), null);
|
|
282
|
-
}
|
|
283
|
-
function g() {
|
|
284
|
-
h(), m(p()), o.value = [];
|
|
285
|
-
}
|
|
286
|
-
function _(e) {
|
|
287
|
-
u && u.blockId === e ? (clearTimeout(u.timeoutId), u.timeoutId = setTimeout(() => {
|
|
288
|
-
u = null;
|
|
289
|
-
}, ue)) : (h(), m(p()), o.value = [], u = {
|
|
290
|
-
blockId: e,
|
|
291
|
-
timeoutId: setTimeout(() => {
|
|
292
|
-
u = null;
|
|
293
|
-
}, ue)
|
|
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 (a.value.length === 0) return;
|
|
303
|
-
h();
|
|
304
|
-
let e = a.value.pop();
|
|
305
|
-
o.value.push(p()), r(e, !0), v();
|
|
306
|
-
}
|
|
307
|
-
function b() {
|
|
308
|
-
if (o.value.length === 0) return;
|
|
309
|
-
h();
|
|
310
|
-
let e = o.value.pop();
|
|
311
|
-
a.value.push(p()), r(e, !0), v();
|
|
312
|
-
}
|
|
313
|
-
function x() {
|
|
314
|
-
a.value = [], o.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 = V(n, o);
|
|
335
|
-
return t(s, r, a), i(s.id), s;
|
|
336
|
-
}
|
|
337
|
-
function s(e, n, r) {
|
|
338
|
-
let o = te(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 m() {
|
|
378
|
-
c() && !s && (d(), o = setTimeout(() => {
|
|
379
|
-
o = null, c() && !s && n() && r(JSON.parse(JSON.stringify(t.value)));
|
|
380
|
-
}, i));
|
|
381
|
-
}
|
|
382
|
-
let h = p(t, () => {
|
|
383
|
-
m();
|
|
384
|
-
}, { deep: !0 });
|
|
385
|
-
function g() {
|
|
386
|
-
h(), d();
|
|
387
|
-
}
|
|
388
|
-
return {
|
|
389
|
-
flush: f,
|
|
390
|
-
cancel: d,
|
|
391
|
-
pause: l,
|
|
392
|
-
resume: u,
|
|
393
|
-
destroy: g
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
function he(e) {
|
|
397
|
-
let t = l(/* @__PURE__ */ new Set()), n = s(() => 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(t) {
|
|
415
|
-
let n = e(!1), r = e(!1), i = s(() => !!t.definition.value?.dataSource), a = s(() => i.value && !t.block.value.dataSourceFetched);
|
|
416
|
-
async function o() {
|
|
417
|
-
let e = t.definition.value;
|
|
418
|
-
if (e?.dataSource) {
|
|
419
|
-
n.value = !0, r.value = !1;
|
|
420
|
-
try {
|
|
421
|
-
let n = await e.dataSource.onFetch({
|
|
422
|
-
fieldValues: { ...t.block.value.fieldValues },
|
|
423
|
-
blockId: t.block.value.id
|
|
424
|
-
});
|
|
425
|
-
if (n == null) return;
|
|
426
|
-
let r = { ...t.block.value.fieldValues };
|
|
427
|
-
for (let e of Object.keys(r)) e in n && (r[e] = n[e]);
|
|
428
|
-
t.onUpdate(r, !0);
|
|
429
|
-
} catch (e) {
|
|
430
|
-
console.warn("[Templatical] Data source fetch error:", e), r.value = !0;
|
|
431
|
-
} finally {
|
|
432
|
-
n.value = !1;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
return {
|
|
437
|
-
isFetching: n,
|
|
438
|
-
fetchError: r,
|
|
439
|
-
fetch: o,
|
|
440
|
-
hasDataSource: i,
|
|
441
|
-
needsFetch: a
|
|
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] = T(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 = T(e);
|
|
533
|
-
return t.type === "section" && (t.children = Z(e).map((e) => Array.isArray(e) ? e.filter((e) => !d(e.id)).map((e) => T(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(t) {
|
|
650
|
-
let { provider: r } = t, i = t.sessionId ?? crypto.randomUUID(), a = t.maxUndo ?? ke, o = typeof r.acquireLock == "function" && typeof r.renewLock == "function" && typeof r.releaseLock == "function", l = b([]), u = b(/* @__PURE__ */ new Map()), d = e(null), f = e(0), m = e(0), h = null, g = null, _ = !1, v = !1, y = !1, x = null, S = 0, C = !1, w = [], D = null, O = null, A = Promise.resolve(), j = null, M = s(() => (m.value, (g?.undo.length ?? 0) > 0)), N = s(() => (m.value, (g?.redo.length ?? 0) > 0));
|
|
651
|
-
function F(e) {
|
|
652
|
-
t.onError?.(e instanceof Error ? e : Error(String(e)));
|
|
653
|
-
}
|
|
654
|
-
function L(e, n = g) {
|
|
655
|
-
n !== g || C || t.onNotice?.(e);
|
|
656
|
-
}
|
|
657
|
-
function R() {
|
|
658
|
-
return {
|
|
659
|
-
locks: [...u.value.values()].map((e) => ({
|
|
660
|
-
blockId: e.blockId,
|
|
661
|
-
sessionId: e.holder.sessionId
|
|
662
|
-
})),
|
|
663
|
-
session: i
|
|
664
|
-
};
|
|
665
|
-
}
|
|
666
|
-
function z() {
|
|
667
|
-
m.value++;
|
|
668
|
-
}
|
|
669
|
-
function B(e, t) {
|
|
670
|
-
e.push(t), e.length > a && e.splice(0, e.length - a);
|
|
671
|
-
}
|
|
672
|
-
function V(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(T(e), !1);
|
|
681
|
-
}
|
|
682
|
-
E(h.content.value, e) || h.setContent(T(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 te() {
|
|
690
|
-
v || y || (y = !0, queueMicrotask(() => {
|
|
691
|
-
y = !1, U(!1);
|
|
692
|
-
}));
|
|
693
|
-
}
|
|
694
|
-
function H() {
|
|
695
|
-
x &&= (clearTimeout(x), null);
|
|
696
|
-
}
|
|
697
|
-
function U(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, U(!0);
|
|
708
|
-
}, 300);
|
|
709
|
-
return;
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
H(), ne(n, r);
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
function W() {
|
|
716
|
-
U(!0);
|
|
717
|
-
}
|
|
718
|
-
function ne(e, t) {
|
|
719
|
-
let n = t, r;
|
|
720
|
-
try {
|
|
721
|
-
r = k(e.view, n, R());
|
|
722
|
-
} catch (t) {
|
|
723
|
-
if (!(t instanceof I)) throw t;
|
|
724
|
-
V(e.view);
|
|
725
|
-
let n = t.blockId === void 0 ? void 0 : u.value.get(t.blockId)?.holder;
|
|
726
|
-
L({
|
|
727
|
-
type: "editRefused",
|
|
728
|
-
code: t.code,
|
|
729
|
-
...n ? { holder: n } : {}
|
|
730
|
-
}), t.code === "invalid_operation" && F(t);
|
|
731
|
-
return;
|
|
732
|
-
}
|
|
733
|
-
let i = h.content.value;
|
|
734
|
-
if (!E(r, i)) {
|
|
735
|
-
F(/* @__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: T(i)
|
|
738
|
-
}];
|
|
739
|
-
try {
|
|
740
|
-
r = k(e.view, n, R());
|
|
741
|
-
} catch (t) {
|
|
742
|
-
if (!(t instanceof I)) throw t;
|
|
743
|
-
V(e.view), L({
|
|
744
|
-
type: "editRefused",
|
|
745
|
-
code: t.code
|
|
746
|
-
});
|
|
747
|
-
return;
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
let a = { ops: P(e.view, n) };
|
|
751
|
-
B(e.undo, a), e.redo = [], z(), e.view = r, re(e, n, "edit", a);
|
|
752
|
-
}
|
|
753
|
-
function re(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
|
-
G(e);
|
|
767
|
-
}
|
|
768
|
-
function G(e) {
|
|
769
|
-
if (e.inFlight) return;
|
|
770
|
-
let t = e.pending.find((e) => !e.sent);
|
|
771
|
-
t ? (t.sent = !0, e.inFlight = t, ie(e, t, 0)) : J(e);
|
|
772
|
-
}
|
|
773
|
-
function ie(e, t, n) {
|
|
774
|
-
r.submit(e.templateId, {
|
|
775
|
-
batchId: t.batchId,
|
|
776
|
-
baseRevision: e.revision,
|
|
777
|
-
ops: t.ops,
|
|
778
|
-
...t.origin === "ai" ? { origin: "ai" } : {}
|
|
779
|
-
}).then(({ revision: n }) => {
|
|
780
|
-
e.inFlight = null, ae(e, t, n), G(e);
|
|
781
|
-
}, (r) => {
|
|
782
|
-
if (Me(r) !== null) e.inFlight = null, se(e, t, r), G(e);
|
|
783
|
-
else if (Pe(r)) {
|
|
784
|
-
Y(e, r);
|
|
785
|
-
let i = Oe[Math.min(n, Oe.length - 1)];
|
|
786
|
-
setTimeout(() => {
|
|
787
|
-
C || ie(e, t, n + 1);
|
|
788
|
-
}, i);
|
|
789
|
-
} else e.inFlight = null, F(r), se(e, t, r), G(e);
|
|
790
|
-
});
|
|
791
|
-
}
|
|
792
|
-
function ae(e, t, n) {
|
|
793
|
-
t.revision === null && (t.revision = n, n <= e.revision ? (K(e, t), de(e)) : (e.own.set(n, t), ue(e)));
|
|
794
|
-
}
|
|
795
|
-
function K(e, t) {
|
|
796
|
-
e.pending = e.pending.filter((e) => e !== t), J(e);
|
|
797
|
-
}
|
|
798
|
-
function q(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
|
-
z();
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
function oe(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 && q(e, t), J(e), n;
|
|
810
|
-
}
|
|
811
|
-
function se(e, t, n) {
|
|
812
|
-
if (K(e, t), oe(e, t)) {
|
|
813
|
-
let r = Me(n) ?? "invalid_operation";
|
|
814
|
-
if (t.origin === "edit" || t.origin === "ai") {
|
|
815
|
-
let t = Ne(n);
|
|
816
|
-
L({
|
|
817
|
-
type: "editRefused",
|
|
818
|
-
code: r,
|
|
819
|
-
...t ? { holder: t } : {}
|
|
820
|
-
}, e);
|
|
821
|
-
} else L({
|
|
822
|
-
type: "undoSkipped",
|
|
823
|
-
code: r
|
|
824
|
-
}, e);
|
|
825
|
-
}
|
|
826
|
-
de(e), e === g && X();
|
|
827
|
-
}
|
|
828
|
-
function J(e) {
|
|
829
|
-
if (!(e.pending.length > 0 || e.waiters.length === 0)) for (let t of e.waiters.splice(0)) t.resolve();
|
|
830
|
-
}
|
|
831
|
-
function Y(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 ce(e, t) {
|
|
836
|
-
if (t.revision <= e.revision) return;
|
|
837
|
-
let n = e.pending.find((e) => e.batchId === t.batchId);
|
|
838
|
-
n ? ae(e, n, t.revision) : (e.remote.set(t.revision, t), ue(e));
|
|
839
|
-
}
|
|
840
|
-
function le(e, n) {
|
|
841
|
-
let r = n.ops;
|
|
842
|
-
if (t.normalizeRemoteOperations) try {
|
|
843
|
-
r = t.normalizeRemoteOperations(n.ops, e.confirmed);
|
|
844
|
-
} catch (e) {
|
|
845
|
-
F(e);
|
|
846
|
-
}
|
|
847
|
-
return Le(r);
|
|
848
|
-
}
|
|
849
|
-
function ue(e) {
|
|
850
|
-
let n = [], r = !1;
|
|
851
|
-
for (;;) {
|
|
852
|
-
let t = e.revision + 1, i = e.remote.get(t), a = e.own.get(t);
|
|
853
|
-
if (!i && !a) break;
|
|
854
|
-
try {
|
|
855
|
-
e.confirmed = k(e.confirmed, i ? le(e, i) : a.ops);
|
|
856
|
-
} catch {
|
|
857
|
-
if (e.recovering) {
|
|
858
|
-
e.remote.clear(), e.own.clear(), F(/* @__PURE__ */ Error("[Templatical] Collaboration: this editor can't follow the template's changes. Reload the page."));
|
|
859
|
-
return;
|
|
860
|
-
}
|
|
861
|
-
me(e);
|
|
862
|
-
return;
|
|
863
|
-
}
|
|
864
|
-
e.revision = t, i ? (e.remote.delete(t), n.push(i)) : (e.own.delete(t), a.group.dropped && (r = !0), K(e, a));
|
|
865
|
-
}
|
|
866
|
-
if (e === g && (f.value = e.revision), e.remote.size > 0 || e.own.size > 0 ? fe(e) : pe(e), (n.length !== 0 || r) && (de(e), e === g)) for (let e of n) try {
|
|
867
|
-
t.onRemoteChange?.({
|
|
868
|
-
actor: e.actor,
|
|
869
|
-
ops: e.ops
|
|
870
|
-
});
|
|
871
|
-
} catch (e) {
|
|
872
|
-
F(e);
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
function de(e) {
|
|
876
|
-
e === g && W();
|
|
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 = k(t, r.ops);
|
|
882
|
-
} catch (i) {
|
|
883
|
-
if (r.sent) continue;
|
|
884
|
-
if (oe(e, r)) {
|
|
885
|
-
let t = i instanceof I ? i.code : "invalid_operation";
|
|
886
|
-
L(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, J(e), e === g && V(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 t = await r.operationsAfter(e.templateId, e.revision);
|
|
912
|
-
if (e.retired) return;
|
|
913
|
-
if ("resync" in t) {
|
|
914
|
-
await me(e);
|
|
915
|
-
return;
|
|
916
|
-
}
|
|
917
|
-
for (let n of t.batches) ce(e, n);
|
|
918
|
-
} catch (e) {
|
|
919
|
-
F(e);
|
|
920
|
-
} finally {
|
|
921
|
-
e.catchingUp = null;
|
|
922
|
-
}
|
|
923
|
-
})(), e.catchingUp) : Promise.resolve();
|
|
924
|
-
}
|
|
925
|
-
async function me(e) {
|
|
926
|
-
e.recovering = !0;
|
|
927
|
-
try {
|
|
928
|
-
let n = await t.loadTemplate(e.templateId);
|
|
929
|
-
if (e.retired) return;
|
|
930
|
-
let r = n.revision ?? e.revision;
|
|
931
|
-
e.confirmed = T(n.content), e.revision = r, e.remote = new Map([...e.remote].filter(([e]) => e > r));
|
|
932
|
-
for (let [t, n] of [...e.own]) t <= r && (e.own.delete(t), K(e, n));
|
|
933
|
-
e === g && (f.value = r), de(e), ue(e);
|
|
934
|
-
} catch (e) {
|
|
935
|
-
F(e);
|
|
936
|
-
} finally {
|
|
937
|
-
e.recovering = !1;
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
|
-
function he(e) {
|
|
941
|
-
let n = () => e === g && !e.retired;
|
|
942
|
-
return {
|
|
943
|
-
onBatch: (t) => {
|
|
944
|
-
n() && ce(e, t);
|
|
945
|
-
},
|
|
946
|
-
onResync: (r, i) => {
|
|
947
|
-
if (!(!n() || r <= e.revision)) {
|
|
948
|
-
if (i) try {
|
|
949
|
-
t.onRemoteResync?.({
|
|
950
|
-
revision: r,
|
|
951
|
-
actor: i
|
|
952
|
-
});
|
|
953
|
-
} catch (e) {
|
|
954
|
-
F(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: (t) => {
|
|
969
|
-
n() && ye(e, t);
|
|
970
|
-
}
|
|
971
|
-
};
|
|
972
|
-
}
|
|
973
|
-
function ge(e, t) {
|
|
974
|
-
r.join(e.templateId, { sessionId: i }, he(e)).then((n) => {
|
|
975
|
-
e.retired || e !== g ? t || n.leave() : (e.leave = n.leave, Z(n.locks, !t), Ce(n.members), n.members.length > 0 && (d.value = "connected"), n.revision > e.revision && X(), t && Q());
|
|
976
|
-
}, (e) => F(e));
|
|
977
|
-
}
|
|
978
|
-
function _e(e) {
|
|
979
|
-
let t = T(e.content), n = {
|
|
980
|
-
templateId: e.id,
|
|
981
|
-
confirmed: t,
|
|
982
|
-
revision: e.revision ?? 0,
|
|
983
|
-
pending: [],
|
|
984
|
-
view: T(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, f.value = n.revision, z(), ge(n, !1), h?.state.selectedBlockId && Be(h.state.selectedBlockId), te();
|
|
998
|
-
}
|
|
999
|
-
function ve(e) {
|
|
1000
|
-
e.retired = !0, pe(e), e.leave?.(), e.leave = null, Y(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, D = null, Q(), z(), e && _e(e));
|
|
1008
|
-
}
|
|
1009
|
-
function xe(e) {
|
|
1010
|
-
if (e.holder.sessionId === i) 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), L({
|
|
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 r of e) r.holder.sessionId !== i && (t && n.has(r.blockId) || n.set(r.blockId, r));
|
|
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
|
-
A = A.then(e).catch(F);
|
|
1036
|
-
}
|
|
1037
|
-
function Q() {
|
|
1038
|
-
o && we(async () => {
|
|
1039
|
-
if (O && (D === null || O.templateId !== D.templateId)) {
|
|
1040
|
-
let e = O;
|
|
1041
|
-
O = null, $(), await r.releaseLock(e.templateId, e.blockId);
|
|
1042
|
-
}
|
|
1043
|
-
let e = D;
|
|
1044
|
-
if (!(!e || O?.templateId === e.templateId && O.blockId === e.blockId)) try {
|
|
1045
|
-
await r.acquireLock(e.templateId, e.blockId), O = e, ze(), je(e.blockId);
|
|
1046
|
-
} catch (t) {
|
|
1047
|
-
if (O?.templateId === e.templateId) {
|
|
1048
|
-
let e = O;
|
|
1049
|
-
O = null, $(), await r.releaseLock(e.templateId, e.blockId).catch(() => {});
|
|
1050
|
-
}
|
|
1051
|
-
if (D !== e) return;
|
|
1052
|
-
Re(e.blockId, t);
|
|
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
|
-
D = 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 F(t), setTimeout(() => {
|
|
1072
|
-
D?.blockId === e && Q();
|
|
1073
|
-
}, Oe[0]);
|
|
1074
|
-
}
|
|
1075
|
-
function ze() {
|
|
1076
|
-
j ||= setInterval(() => {
|
|
1077
|
-
we(async () => {
|
|
1078
|
-
let e = O;
|
|
1079
|
-
if (e) try {
|
|
1080
|
-
await r.renewLock(e.templateId, e.blockId);
|
|
1081
|
-
} catch (e) {
|
|
1082
|
-
if (Me(e) === "lock_lost") {
|
|
1083
|
-
O = null, $(), Q();
|
|
1084
|
-
return;
|
|
1085
|
-
}
|
|
1086
|
-
F(e);
|
|
1087
|
-
}
|
|
1088
|
-
});
|
|
1089
|
-
}, De);
|
|
1090
|
-
}
|
|
1091
|
-
function $() {
|
|
1092
|
-
j &&= (clearInterval(j), null);
|
|
1093
|
-
}
|
|
1094
|
-
function Be(e) {
|
|
1095
|
-
W(), g && (D = e ? {
|
|
1096
|
-
templateId: g.templateId,
|
|
1097
|
-
blockId: e
|
|
1098
|
-
} : null, Q());
|
|
1099
|
-
}
|
|
1100
|
-
function Ve() {
|
|
1101
|
-
W(), O && o && (r.releaseLock(O.templateId, O.blockId).catch(() => {}), O = null, $()), g?.leave?.(), g && (g.leave = null);
|
|
1102
|
-
}
|
|
1103
|
-
function He(e) {
|
|
1104
|
-
let t = g;
|
|
1105
|
-
if (!t || _) return;
|
|
1106
|
-
W();
|
|
1107
|
-
let n = (e === "undo" ? t.undo : t.redo).pop();
|
|
1108
|
-
if (!n) return;
|
|
1109
|
-
z();
|
|
1110
|
-
let r;
|
|
1111
|
-
try {
|
|
1112
|
-
r = k(t.view, n.ops, R());
|
|
1113
|
-
} catch (e) {
|
|
1114
|
-
if (!(e instanceof I)) throw e;
|
|
1115
|
-
L({
|
|
1116
|
-
type: "undoSkipped",
|
|
1117
|
-
code: e.code
|
|
1118
|
-
});
|
|
1119
|
-
return;
|
|
1120
|
-
}
|
|
1121
|
-
let i = { ops: P(t.view, n.ops) };
|
|
1122
|
-
B(e === "undo" ? t.redo : t.undo, i), t.view = r, V(r), h?.markDirty(), re(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 I("invalid_operation", 0, "No template is open for editing.")
|
|
1129
|
-
};
|
|
1130
|
-
W();
|
|
1131
|
-
let r, i;
|
|
1132
|
-
try {
|
|
1133
|
-
r = k(n.view, e, R()), i = P(n.view, e);
|
|
1134
|
-
} catch (e) {
|
|
1135
|
-
if (e instanceof I) 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
|
-
}, B(n.undo, o)), n.redo = [], z(), n.view = r, V(r), h.markDirty(), re(n, e, t.origin, o), {
|
|
1146
|
-
applied: !0,
|
|
1147
|
-
inverse: i
|
|
1148
|
-
};
|
|
1149
|
-
}
|
|
1150
|
-
function We(e) {
|
|
1151
|
-
h = e, w.push(p(() => e.state.template, (e) => be(e), { immediate: !0 }), p(() => e.content.value, te, { deep: !0 }), p(() => e.state.selectedBlockId, Be), p(() => e.state.isLoading, (e) => e ? U(!0, !0) : te())), typeof window < "u" && (window.addEventListener("pagehide", Ve), window.addEventListener("blur", W)), n() && c(Je);
|
|
1152
|
-
}
|
|
1153
|
-
function Ge() {
|
|
1154
|
-
W();
|
|
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
|
-
W(), _ = !0;
|
|
1163
|
-
}
|
|
1164
|
-
function qe() {
|
|
1165
|
-
_ = !1, g && V(g.view);
|
|
1166
|
-
}
|
|
1167
|
-
function Je() {
|
|
1168
|
-
if (!C) {
|
|
1169
|
-
W();
|
|
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", W));
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
return {
|
|
1175
|
-
sessionId: i,
|
|
1176
|
-
members: l,
|
|
1177
|
-
locks: u,
|
|
1178
|
-
connection: d,
|
|
1179
|
-
revision: f,
|
|
1180
|
-
canUndo: M,
|
|
1181
|
-
canRedo: N,
|
|
1182
|
-
attach: We,
|
|
1183
|
-
undo: () => He("undo"),
|
|
1184
|
-
redo: () => He("redo"),
|
|
1185
|
-
clearHistory: () => {
|
|
1186
|
-
g && (g.undo = [], g.redo = [], z());
|
|
1187
|
-
},
|
|
1188
|
-
flush: W,
|
|
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(t) {
|
|
1199
|
-
let { provider: n } = t, r = e([]), i = e(!1), a = f(() => {
|
|
1200
|
-
let e = /* @__PURE__ */ new Set();
|
|
1201
|
-
for (let t of r.value) {
|
|
1202
|
-
let n = t.category?.trim();
|
|
1203
|
-
n && e.add(n);
|
|
1204
|
-
}
|
|
1205
|
-
return [...e].sort((e, t) => e.localeCompare(t));
|
|
1206
|
-
}), o = f(() => typeof n.create == "function"), s = f(() => typeof n.update == "function"), c = f(() => typeof n.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 d(e, t) {
|
|
1214
|
-
throw new L(`[Templatical] Saved blocks: ${e} is ${t}. Check the capability before calling — the editor's own UI hides the action.`);
|
|
1215
|
-
}
|
|
1216
|
-
function p(e) {
|
|
1217
|
-
Y(t.onError, e);
|
|
1218
|
-
}
|
|
1219
|
-
async function m(e) {
|
|
1220
|
-
i.value = !0;
|
|
1221
|
-
try {
|
|
1222
|
-
r.value = await n.list(e);
|
|
1223
|
-
} catch (e) {
|
|
1224
|
-
throw t.onError?.(e), e;
|
|
1225
|
-
} finally {
|
|
1226
|
-
i.value = !1;
|
|
1227
|
-
}
|
|
1228
|
-
}
|
|
1229
|
-
async function h(e, i, a) {
|
|
1230
|
-
let { create: o } = n;
|
|
1231
|
-
typeof o != "function" && d("create", "disabled by the provider");
|
|
1232
|
-
try {
|
|
1233
|
-
let t = await o(a ? {
|
|
1234
|
-
name: e,
|
|
1235
|
-
content: i,
|
|
1236
|
-
category: a
|
|
1237
|
-
} : {
|
|
1238
|
-
name: e,
|
|
1239
|
-
content: i
|
|
1240
|
-
});
|
|
1241
|
-
return r.value = [t, ...r.value], p(() => n.onCreated?.(t)), t;
|
|
1242
|
-
} catch (e) {
|
|
1243
|
-
throw t.onError?.(e), e;
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
async function g(e, i) {
|
|
1247
|
-
let { update: a } = n;
|
|
1248
|
-
typeof a != "function" && d("update", "disabled by the provider");
|
|
1249
|
-
let o = r.value.find((t) => t.id === e);
|
|
1250
|
-
o && o.canUpdate === !1 && d("update", `not permitted for entry "${e}"`);
|
|
1251
|
-
try {
|
|
1252
|
-
let t = await a(e, i);
|
|
1253
|
-
return r.value = r.value.map((n) => n.id === e ? t : n), p(() => n.onUpdated?.(t)), t;
|
|
1254
|
-
} catch (e) {
|
|
1255
|
-
throw t.onError?.(e), e;
|
|
1256
|
-
}
|
|
1257
|
-
}
|
|
1258
|
-
async function _(e) {
|
|
1259
|
-
let { delete: i } = n;
|
|
1260
|
-
typeof i != "function" && d("delete", "disabled by the provider");
|
|
1261
|
-
let a = r.value.find((t) => t.id === e) ?? null;
|
|
1262
|
-
a && a.canDelete === !1 && d("delete", `not permitted for entry "${e}"`);
|
|
1263
|
-
try {
|
|
1264
|
-
await i(e), r.value = r.value.filter((t) => t.id !== e), a && p(() => n.onDeleted?.(a));
|
|
1265
|
-
} catch (e) {
|
|
1266
|
-
throw t.onError?.(e), e;
|
|
1267
|
-
}
|
|
1268
|
-
}
|
|
1269
|
-
return {
|
|
1270
|
-
savedBlocks: r,
|
|
1271
|
-
isLoading: i,
|
|
1272
|
-
categories: a,
|
|
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: O(),
|
|
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: O(),
|
|
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(t) {
|
|
1413
|
-
let { provider: n, getTemplateId: r } = t, i = e([]), a = e(!1), o = e(void 0), s = e(!1), c = /* @__PURE__ */ new Map(), l = f(() => typeof n.create == "function"), u = f(() => typeof n.restore == "function");
|
|
1414
|
-
function d(e) {
|
|
1415
|
-
let t = r();
|
|
1416
|
-
if (!t) throw new L(`[Templatical] Version history: ${e} needs a template. Call create() or load() first.`);
|
|
1417
|
-
return t;
|
|
1418
|
-
}
|
|
1419
|
-
function p(e) {
|
|
1420
|
-
throw new L(`[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(e) {
|
|
1423
|
-
Y(t.onError, e);
|
|
1424
|
-
}
|
|
1425
|
-
async function h(e) {
|
|
1426
|
-
let r = d("list");
|
|
1427
|
-
a.value = !0;
|
|
1428
|
-
try {
|
|
1429
|
-
let t = await n.list(r, e);
|
|
1430
|
-
i.value = t.versions, o.value = t.nextCursor;
|
|
1431
|
-
} catch (e) {
|
|
1432
|
-
throw t.onError?.(e), e;
|
|
1433
|
-
} finally {
|
|
1434
|
-
a.value = !1;
|
|
1435
|
-
}
|
|
1436
|
-
}
|
|
1437
|
-
function g(e) {
|
|
1438
|
-
return e.content ?? c.get(e.id) ?? null;
|
|
1439
|
-
}
|
|
1440
|
-
async function _(e) {
|
|
1441
|
-
let r = g(e);
|
|
1442
|
-
if (r) return r;
|
|
1443
|
-
let i = d("get");
|
|
1444
|
-
try {
|
|
1445
|
-
let t = await n.get(i, e.id);
|
|
1446
|
-
return c.set(e.id, t), t;
|
|
1447
|
-
} catch (e) {
|
|
1448
|
-
throw t.onError?.(e), e;
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
async function v(e, r) {
|
|
1452
|
-
let { create: a } = n;
|
|
1453
|
-
typeof a != "function" && p("create");
|
|
1454
|
-
let o = d("create");
|
|
1455
|
-
try {
|
|
1456
|
-
let t = await a(o, e, r);
|
|
1457
|
-
return i.value = [t, ...i.value], m(() => n.onCreated?.(t)), t;
|
|
1458
|
-
} catch (e) {
|
|
1459
|
-
throw t.onError?.(e), e;
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
|
-
async function y(e) {
|
|
1463
|
-
let { restore: r } = n;
|
|
1464
|
-
typeof r != "function" && p("restore");
|
|
1465
|
-
let i = d("restore"), a;
|
|
1466
|
-
s.value = !0;
|
|
1467
|
-
try {
|
|
1468
|
-
a = await r(i, e);
|
|
1469
|
-
} catch (e) {
|
|
1470
|
-
throw t.onError?.(e), e;
|
|
1471
|
-
} finally {
|
|
1472
|
-
s.value = !1;
|
|
1473
|
-
}
|
|
1474
|
-
return m(() => n.onRestored?.(a)), a;
|
|
1475
|
-
}
|
|
1476
|
-
return {
|
|
1477
|
-
nextCursor: o,
|
|
1478
|
-
versions: i,
|
|
1479
|
-
isLoading: a,
|
|
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(t) {
|
|
1491
|
-
let { provider: n, getTemplateId: r, getUser: i } = t, a = e([]), o = e(!1), s = e(!1), c = f(() => typeof n.create == "function"), l = f(() => typeof n.update == "function"), u = f(() => typeof n.delete == "function"), d = f(() => typeof n.setResolved == "function"), p = f(() => a.value.reduce((e, t) => e + 1 + (t.replies?.length ?? 0), 0)), m = f(() => a.value.filter((e) => !e.resolvedAt).length), h = f(() => {
|
|
1492
|
-
let e = /* @__PURE__ */ new Map();
|
|
1493
|
-
for (let t of a.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 = r();
|
|
1498
|
-
if (!t) throw new L(`[Templatical] Comments: ${e} needs a template. Call create() or load() first.`);
|
|
1499
|
-
return t;
|
|
1500
|
-
}
|
|
1501
|
-
function _(e) {
|
|
1502
|
-
let t = i();
|
|
1503
|
-
if (!t) throw new L(`[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 L(`[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 a.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 = i();
|
|
1518
|
-
return t !== null && e.author.id === t.id;
|
|
1519
|
-
}
|
|
1520
|
-
function x(e) {
|
|
1521
|
-
let n = J(e);
|
|
1522
|
-
throw t.onError?.(n), n;
|
|
1523
|
-
}
|
|
1524
|
-
function S(e) {
|
|
1525
|
-
Y(t.onError, e);
|
|
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 = a.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 && (a.value = n), t;
|
|
1548
|
-
}
|
|
1549
|
-
let t = a.value.findIndex((t) => t.id === e.id);
|
|
1550
|
-
if (t === -1) return a.value = [...a.value, e], !0;
|
|
1551
|
-
let n = {
|
|
1552
|
-
...e,
|
|
1553
|
-
replies: e.replies ?? a.value[t].replies
|
|
1554
|
-
};
|
|
1555
|
-
return !w(a.value[t], n) && (a.value = C(a.value, t, n), !0);
|
|
1556
|
-
}
|
|
1557
|
-
function E(e, t) {
|
|
1558
|
-
let n = y(e), r = t ?? n?.parentId ?? null;
|
|
1559
|
-
return r ? a.value = a.value.map((t) => t.id === r ? {
|
|
1560
|
-
...t,
|
|
1561
|
-
replies: (t.replies ?? []).filter((t) => t.id !== e)
|
|
1562
|
-
} : t) : a.value = a.value.filter((t) => t.id !== e), n;
|
|
1563
|
-
}
|
|
1564
|
-
async function D(e) {
|
|
1565
|
-
let t = g("list");
|
|
1566
|
-
o.value = !0;
|
|
1567
|
-
try {
|
|
1568
|
-
a.value = await n.list(t, e);
|
|
1569
|
-
} catch (e) {
|
|
1570
|
-
x(e);
|
|
1571
|
-
} finally {
|
|
1572
|
-
o.value = !1;
|
|
1573
|
-
}
|
|
1574
|
-
}
|
|
1575
|
-
async function O(e) {
|
|
1576
|
-
let { create: t } = n;
|
|
1577
|
-
typeof t != "function" && v("create");
|
|
1578
|
-
let r = g("create");
|
|
1579
|
-
_("create"), s.value = !0;
|
|
1580
|
-
try {
|
|
1581
|
-
let i = await t(r, e);
|
|
1582
|
-
return T(i), S(() => n.onCreated?.(i, { origin: "local" })), i;
|
|
1583
|
-
} catch (e) {
|
|
1584
|
-
x(e);
|
|
1585
|
-
} finally {
|
|
1586
|
-
s.value = !1;
|
|
1587
|
-
}
|
|
1588
|
-
}
|
|
1589
|
-
async function k(e, t) {
|
|
1590
|
-
let { update: r } = n;
|
|
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, t);
|
|
1596
|
-
return T(a), S(() => n.onUpdated?.(a, { origin: "local" })), a;
|
|
1597
|
-
} catch (e) {
|
|
1598
|
-
x(e);
|
|
1599
|
-
} finally {
|
|
1600
|
-
s.value = !1;
|
|
1601
|
-
}
|
|
1602
|
-
}
|
|
1603
|
-
async function A(e) {
|
|
1604
|
-
let { delete: t } = n;
|
|
1605
|
-
typeof t != "function" && v("delete");
|
|
1606
|
-
let r = g("delete");
|
|
1607
|
-
_("delete");
|
|
1608
|
-
let i = y(e);
|
|
1609
|
-
s.value = !0;
|
|
1610
|
-
try {
|
|
1611
|
-
await t(r, e), E(e), i && S(() => n.onDeleted?.(i, { origin: "local" }));
|
|
1612
|
-
} catch (e) {
|
|
1613
|
-
x(e);
|
|
1614
|
-
} finally {
|
|
1615
|
-
s.value = !1;
|
|
1616
|
-
}
|
|
1617
|
-
}
|
|
1618
|
-
async function j(e, t) {
|
|
1619
|
-
let { setResolved: r } = n;
|
|
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, t);
|
|
1625
|
-
return T(a), S(() => (a.resolvedAt ? n.onResolved : n.onUnresolved)?.(a, { origin: "local" })), a;
|
|
1626
|
-
} catch (e) {
|
|
1627
|
-
x(e);
|
|
1628
|
-
} finally {
|
|
1629
|
-
s.value = !1;
|
|
1630
|
-
}
|
|
1631
|
-
}
|
|
1632
|
-
function M(e) {
|
|
1633
|
-
T(e) && S(() => n.onCreated?.(e, { origin: "remote" }));
|
|
1634
|
-
}
|
|
1635
|
-
function N(e) {
|
|
1636
|
-
T(e) && S(() => (e.resolvedAt ? n.onResolved : n.onUpdated)?.(e, { origin: "remote" }));
|
|
1637
|
-
}
|
|
1638
|
-
function P(e, t) {
|
|
1639
|
-
let r = E(e, t);
|
|
1640
|
-
r && S(() => n.onDeleted?.(r, { origin: "remote" }));
|
|
1641
|
-
}
|
|
1642
|
-
return {
|
|
1643
|
-
comments: a,
|
|
1644
|
-
isLoading: o,
|
|
1645
|
-
isSubmitting: s,
|
|
1646
|
-
canCreate: c,
|
|
1647
|
-
canUpdate: l,
|
|
1648
|
-
canDelete: u,
|
|
1649
|
-
canResolve: d,
|
|
1650
|
-
totalCount: p,
|
|
1651
|
-
unresolvedCount: m,
|
|
1652
|
-
commentCountByBlock: h,
|
|
1653
|
-
load: D,
|
|
1654
|
-
create: O,
|
|
1655
|
-
update: k,
|
|
1656
|
-
remove: A,
|
|
1657
|
-
setResolved: j,
|
|
1658
|
-
find: y,
|
|
1659
|
-
isOwn: b,
|
|
1660
|
-
applyRemoteCreate: M,
|
|
1661
|
-
applyRemoteUpdate: N,
|
|
1662
|
-
applyRemoteDelete: P
|
|
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
|
-
// src/constants/timeouts.ts
|
|
1687
|
-
var qe = 1e4;
|
|
1688
|
-
// src/composables/useImageUrlResolver.ts
|
|
1689
|
-
function Je(e) {
|
|
1690
|
-
let t = l(/* @__PURE__ */ new Map()), n = /* @__PURE__ */ new Set();
|
|
1691
|
-
function r(e) {
|
|
1692
|
-
return t.get(e);
|
|
1693
|
-
}
|
|
1694
|
-
function i(e) {
|
|
1695
|
-
return t.has(e) || n.has(e);
|
|
1696
|
-
}
|
|
1697
|
-
function a(r) {
|
|
1698
|
-
if (i(r)) return;
|
|
1699
|
-
let a;
|
|
1700
|
-
try {
|
|
1701
|
-
a = e(r);
|
|
1702
|
-
} catch {
|
|
1703
|
-
t.set(r, null);
|
|
1704
|
-
return;
|
|
1705
|
-
}
|
|
1706
|
-
a === null || typeof a == "string" ? t.set(r, a) : (n.add(r), Promise.resolve(a).then((e) => {
|
|
1707
|
-
t.set(r, typeof e == "string" ? e : null);
|
|
1708
|
-
}, () => {
|
|
1709
|
-
t.set(r, null);
|
|
1710
|
-
}).finally(() => n.delete(r)));
|
|
1711
|
-
}
|
|
1712
|
-
return {
|
|
1713
|
-
get: r,
|
|
1714
|
-
has: i,
|
|
1715
|
-
lookup: a
|
|
1716
|
-
};
|
|
1717
|
-
}
|
|
1718
|
-
function Ye(e) {
|
|
1719
|
-
let r = t(G, null), i = f(e);
|
|
1720
|
-
if (!r) return i;
|
|
1721
|
-
let a;
|
|
1722
|
-
function o() {
|
|
1723
|
-
a !== void 0 && (clearTimeout(a), a = void 0);
|
|
1724
|
-
}
|
|
1725
|
-
n() && c(o);
|
|
1726
|
-
let s = !0;
|
|
1727
|
-
return S(i, (e) => {
|
|
1728
|
-
o();
|
|
1729
|
-
let t = s;
|
|
1730
|
-
s = !1, e && !r.has(e) && (t ? r.lookup(e) : a = setTimeout(() => {
|
|
1731
|
-
a = void 0, r.lookup(e);
|
|
1732
|
-
}, 300));
|
|
1733
|
-
}, { immediate: !0 }), f(() => {
|
|
1734
|
-
let e = i.value;
|
|
1735
|
-
if (!e) return e;
|
|
1736
|
-
let t = r.get(e);
|
|
1737
|
-
return typeof t == "string" && t.length > 0 ? t : e;
|
|
1738
|
-
});
|
|
1739
|
-
}
|
|
1740
|
-
function Xe(e, t) {
|
|
1741
|
-
if (!e || !t) return t;
|
|
1742
|
-
let n = e.get(t);
|
|
1743
|
-
return typeof n == "string" && n.length > 0 ? n : t;
|
|
1744
|
-
}
|
|
1745
|
-
function Ze(e, t) {
|
|
1746
|
-
return typeof e?.url == "string" && w(e.url, t);
|
|
1747
|
-
}
|
|
1748
|
-
function Qe(e, t) {
|
|
1749
|
-
let n = e?.url;
|
|
1750
|
-
if (typeof n == "string" && n.trim() !== "") return w(n, t) ? void 0 : n;
|
|
1751
|
-
}
|
|
1752
|
-
function $e(e) {
|
|
1753
|
-
let n = t(ne, R.liquid), r = Ye(() => Qe(e(), n));
|
|
1754
|
-
return f(() => Ze(e(), n) ? null : r.value);
|
|
1755
|
-
}
|
|
1756
|
-
function et(e, t, n) {
|
|
1757
|
-
return Ze(t, n) ? null : Xe(e, Qe(t, n));
|
|
1758
|
-
}
|
|
1759
|
-
// src/utils/blockTypeLabels.ts
|
|
1760
|
-
function tt(e, t) {
|
|
1761
|
-
return t.blocks[e] ?? e;
|
|
1762
|
-
}
|
|
1763
|
-
function nt(e, t, n = []) {
|
|
1764
|
-
if (e.type !== "custom") return tt(e.type, t);
|
|
1765
|
-
let { customType: r } = e;
|
|
1766
|
-
return n.find((e) => e.type === r)?.name ?? r;
|
|
1767
|
-
}
|
|
1768
|
-
// src/utils/resolveFieldColors.ts
|
|
1769
|
-
function rt(e, t) {
|
|
1770
|
-
let n = K({ presets: e.presets }, ae), r = n.presets.length === 0, i = e.allowCustom ?? t.allowCustom;
|
|
1771
|
-
return {
|
|
1772
|
-
presets: r ? t.presets : n.presets,
|
|
1773
|
-
allowCustom: t.allowCustom !== !1 && i,
|
|
1774
|
-
invalidPresets: n.invalidPresets,
|
|
1775
|
-
emptyPresets: e.presets !== void 0 && e.presets.length === 0,
|
|
1776
|
-
presetsInherited: r,
|
|
1777
|
-
allowCustomIgnored: e.allowCustom === !0 && t.allowCustom === !1
|
|
1778
|
-
};
|
|
1779
|
-
}
|
|
1780
|
-
var it = q({
|
|
1781
|
-
name: "code",
|
|
1782
|
-
size: 24,
|
|
1783
|
-
node: [["path", {
|
|
1784
|
-
d: "m16 18 6-6-6-6",
|
|
1785
|
-
key: "eg8j8"
|
|
1786
|
-
}], ["path", {
|
|
1787
|
-
d: "m8 6-6 6 6 6",
|
|
1788
|
-
key: "ppft3o"
|
|
1789
|
-
}]]
|
|
1790
|
-
}), at = q({
|
|
1791
|
-
name: "navigation",
|
|
1792
|
-
size: 24,
|
|
1793
|
-
node: [["polygon", {
|
|
1794
|
-
points: "3 11 22 2 13 21 11 13 3 11",
|
|
1795
|
-
key: "1ltx0t"
|
|
1796
|
-
}]]
|
|
1797
|
-
}), ot = q({
|
|
1798
|
-
name: "share-2",
|
|
1799
|
-
size: 24,
|
|
1800
|
-
node: [
|
|
1801
|
-
["circle", {
|
|
1802
|
-
cx: "18",
|
|
1803
|
-
cy: "5",
|
|
1804
|
-
r: "3",
|
|
1805
|
-
key: "gq8acd"
|
|
1806
|
-
}],
|
|
1807
|
-
["circle", {
|
|
1808
|
-
cx: "6",
|
|
1809
|
-
cy: "12",
|
|
1810
|
-
r: "3",
|
|
1811
|
-
key: "w7nqdw"
|
|
1812
|
-
}],
|
|
1813
|
-
["circle", {
|
|
1814
|
-
cx: "18",
|
|
1815
|
-
cy: "19",
|
|
1816
|
-
r: "3",
|
|
1817
|
-
key: "1xt0gg"
|
|
1818
|
-
}],
|
|
1819
|
-
["line", {
|
|
1820
|
-
x1: "8.59",
|
|
1821
|
-
x2: "15.42",
|
|
1822
|
-
y1: "13.51",
|
|
1823
|
-
y2: "17.49",
|
|
1824
|
-
key: "47mynk"
|
|
1825
|
-
}],
|
|
1826
|
-
["line", {
|
|
1827
|
-
x1: "15.41",
|
|
1828
|
-
x2: "8.59",
|
|
1829
|
-
y1: "6.51",
|
|
1830
|
-
y2: "10.49",
|
|
1831
|
-
key: "1n3mei"
|
|
1832
|
-
}]
|
|
1833
|
-
]
|
|
1834
|
-
}), st = q({
|
|
1835
|
-
name: "table",
|
|
1836
|
-
size: 24,
|
|
1837
|
-
node: [
|
|
1838
|
-
["path", {
|
|
1839
|
-
d: "M12 3v18",
|
|
1840
|
-
key: "108xh3"
|
|
1841
|
-
}],
|
|
1842
|
-
["rect", {
|
|
1843
|
-
width: "18",
|
|
1844
|
-
height: "18",
|
|
1845
|
-
x: "3",
|
|
1846
|
-
y: "3",
|
|
1847
|
-
rx: "2",
|
|
1848
|
-
key: "afitv7"
|
|
1849
|
-
}],
|
|
1850
|
-
["path", {
|
|
1851
|
-
d: "M3 9h18",
|
|
1852
|
-
key: "1pudct"
|
|
1853
|
-
}],
|
|
1854
|
-
["path", {
|
|
1855
|
-
d: "M3 15h18",
|
|
1856
|
-
key: "5xshup"
|
|
1857
|
-
}]
|
|
1858
|
-
]
|
|
1859
|
-
});
|
|
1860
|
-
// src/utils/imageNaturalSize.ts
|
|
1861
|
-
function ct(e) {
|
|
1862
|
-
return typeof e == "number" && Number.isFinite(e) && e > 0;
|
|
1863
|
-
}
|
|
1864
|
-
function lt(e, t) {
|
|
1865
|
-
return ct(e) && ct(t) ? {
|
|
1866
|
-
width: e,
|
|
1867
|
-
height: t
|
|
1868
|
-
} : null;
|
|
1869
|
-
}
|
|
1870
|
-
function ut(e) {
|
|
1871
|
-
return lt(e.naturalWidth, e.naturalHeight);
|
|
1872
|
-
}
|
|
1873
|
-
function dt(e) {
|
|
1874
|
-
return e ? {
|
|
1875
|
-
naturalWidth: e.width,
|
|
1876
|
-
naturalHeight: e.height
|
|
1877
|
-
} : {
|
|
1878
|
-
naturalWidth: void 0,
|
|
1879
|
-
naturalHeight: void 0
|
|
1880
|
-
};
|
|
1881
|
-
}
|
|
1882
|
-
function ft(e, t) {
|
|
1883
|
-
if (typeof Image > "u") return t(null), () => {};
|
|
1884
|
-
let n = new Image(), r = () => {
|
|
1885
|
-
n.onload = null, n.onerror = null;
|
|
1886
|
-
};
|
|
1887
|
-
return n.onload = () => {
|
|
1888
|
-
r(), t(lt(n.naturalWidth, n.naturalHeight));
|
|
1889
|
-
}, n.onerror = () => {
|
|
1890
|
-
r(), t(null);
|
|
1891
|
-
}, n.src = e, r;
|
|
1892
|
-
}
|
|
1893
|
-
function pt(e) {
|
|
1894
|
-
return new Promise((t) => {
|
|
1895
|
-
let n = setTimeout(() => {
|
|
1896
|
-
r(), t(null);
|
|
1897
|
-
}, qe), r = ft(e, (e) => {
|
|
1898
|
-
clearTimeout(n), t(e);
|
|
1899
|
-
});
|
|
1900
|
-
});
|
|
1901
|
-
}
|
|
1902
|
-
// src/components/MediaDropOverlay.vue
|
|
1903
|
-
var mt = /* @__PURE__ */ x({
|
|
1904
|
-
__name: "MediaDropOverlay",
|
|
1905
|
-
props: {
|
|
1906
|
-
uploading: { type: Boolean },
|
|
1907
|
-
size: { default: "field" }
|
|
1908
|
-
},
|
|
1909
|
-
setup(e) {
|
|
1910
|
-
let t = e, { t: n } = ie(), a = {
|
|
1911
|
-
field: {
|
|
1912
|
-
gap: "tpl:gap-1.5",
|
|
1913
|
-
icon: 18,
|
|
1914
|
-
veil: "90%"
|
|
1915
|
-
},
|
|
1916
|
-
canvas: {
|
|
1917
|
-
gap: "tpl:gap-2",
|
|
1918
|
-
icon: 20,
|
|
1919
|
-
veil: "85%"
|
|
1920
|
-
}
|
|
1921
|
-
}, o = f(() => a[t.size]);
|
|
1922
|
-
return (t, a) => (g(), m("div", {
|
|
1923
|
-
class: _(["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]),
|
|
1924
|
-
style: r({ backgroundColor: `color-mix(in srgb, var(--tpl-bg) ${o.value.veil}, transparent)` })
|
|
1925
|
-
}, [e.uploading ? (g(), m(v, { key: 0 }, [u(y(se), {
|
|
1926
|
-
class: "tpl-spinner",
|
|
1927
|
-
size: o.value.icon,
|
|
1928
|
-
"stroke-width": 2
|
|
1929
|
-
}, null, 8, ["size"]), h(" " + i(y(n).image.uploading), 1)], 64)) : (g(), m(v, { key: 1 }, [u(y(oe), {
|
|
1930
|
-
size: o.value.icon,
|
|
1931
|
-
"stroke-width": 1.5
|
|
1932
|
-
}, null, 8, ["size"]), h(" " + i(y(n).image.dropToUpload), 1)], 64))], 6));
|
|
1933
|
-
}
|
|
1934
|
-
});
|
|
1935
|
-
// src/composables/useAliveFlag.ts
|
|
1936
|
-
function ht() {
|
|
1937
|
-
let e = { alive: !0 };
|
|
1938
|
-
return a(() => {
|
|
1939
|
-
e.alive = !1;
|
|
1940
|
-
}), e;
|
|
1941
|
-
}
|
|
1942
|
-
// src/composables/useImageDrop.ts
|
|
1943
|
-
var gt = "image/";
|
|
1944
|
-
function _t(e) {
|
|
1945
|
-
let { target: t, onFiles: n, enabled: r } = e, i = () => r === void 0 || d(r), { isOverDropZone: a } = U(t, {
|
|
1946
|
-
preventDefaultForUnhandled: !0,
|
|
1947
|
-
onDrop: (e) => {
|
|
1948
|
-
if (!i()) return;
|
|
1949
|
-
let t = (e ?? []).filter((e) => e.type.startsWith(gt));
|
|
1950
|
-
t.length > 0 && n([t[0]]);
|
|
1951
|
-
}
|
|
1952
|
-
});
|
|
1953
|
-
return { isOver: f(() => i() && a.value) };
|
|
1954
|
-
}
|
|
1955
|
-
// src/composables/useMediaDropField.ts
|
|
1956
|
-
function vt(n) {
|
|
1957
|
-
let { target: r, blocked: i, apply: a } = n, o = t(W, null), s = t(re, null), c = ht();
|
|
1958
|
-
async function l() {
|
|
1959
|
-
let e = await o?.({ accept: ["images"] });
|
|
1960
|
-
c.alive && e && a(e);
|
|
1961
|
-
}
|
|
1962
|
-
let u = e(!1), p = f(() => (s?.value ?? !!o) && !u.value && !d(i));
|
|
1963
|
-
async function m(e) {
|
|
1964
|
-
if (o) {
|
|
1965
|
-
u.value = !0;
|
|
1966
|
-
try {
|
|
1967
|
-
let t = await o({
|
|
1968
|
-
accept: ["images"],
|
|
1969
|
-
files: e
|
|
1970
|
-
});
|
|
1971
|
-
if (!c.alive) return;
|
|
1972
|
-
t && a(t);
|
|
1973
|
-
} finally {
|
|
1974
|
-
c.alive && (u.value = !1);
|
|
1975
|
-
}
|
|
1976
|
-
}
|
|
1977
|
-
}
|
|
1978
|
-
let { isOver: h } = _t({
|
|
1979
|
-
target: r,
|
|
1980
|
-
enabled: p,
|
|
1981
|
-
onFiles: m
|
|
1982
|
-
}), g = f(() => p.value && h.value || u.value);
|
|
1983
|
-
return {
|
|
1984
|
-
canBrowse: !!o,
|
|
1985
|
-
dropEnabled: p,
|
|
1986
|
-
isUploading: u,
|
|
1987
|
-
showOverlay: g,
|
|
1988
|
-
openMediaBrowser: l
|
|
1989
|
-
};
|
|
1990
|
-
}
|
|
1991
|
-
function yt(e, t = "desktop") {
|
|
1992
|
-
return t === "mobile" ? 375 : e?.width ?? 600;
|
|
1993
|
-
}
|
|
1994
|
-
var bt = "width 300ms cubic-bezier(0.34, 1.56, 0.64, 1)", xt = {
|
|
1995
|
-
1: [100],
|
|
1996
|
-
2: [50, 50],
|
|
1997
|
-
3: [
|
|
1998
|
-
33.33,
|
|
1999
|
-
33.33,
|
|
2000
|
-
33.34
|
|
2001
|
-
],
|
|
2002
|
-
"1-2": [33.33, 66.67],
|
|
2003
|
-
"2-1": [66.67, 33.33]
|
|
2004
|
-
};
|
|
2005
|
-
function St(e, t) {
|
|
2006
|
-
let n = (e) => Math.trunc(e ?? 0), r = (e) => C(e) === null ? 0 : Math.trunc(e.width);
|
|
2007
|
-
return n(e?.left) + n(e?.right) + r(t?.left) + r(t?.right);
|
|
2008
|
-
}
|
|
2009
|
-
function Ct(e, t) {
|
|
2010
|
-
return Math.floor(e) - St(t);
|
|
2011
|
-
}
|
|
2012
|
-
function wt(e, t) {
|
|
2013
|
-
let n = "border" in e ? e.border : void 0;
|
|
2014
|
-
return Math.floor(t) - St(e.styles.padding, n);
|
|
2015
|
-
}
|
|
2016
|
-
function* Tt(e, t) {
|
|
2017
|
-
for (let n of e) M(n) ? yield* Tt(n.children, Ct(t, n.styles.padding)) : yield {
|
|
2018
|
-
block: n,
|
|
2019
|
-
bandWidth: z(n) && n.wrapper ? Ct(t, n.wrapper.padding) : t
|
|
2020
|
-
};
|
|
2021
|
-
}
|
|
2022
|
-
function Et(e, t) {
|
|
2023
|
-
if (!t) return e;
|
|
2024
|
-
try {
|
|
2025
|
-
return N(t, e);
|
|
2026
|
-
} catch {
|
|
2027
|
-
return e;
|
|
2028
|
-
}
|
|
2029
|
-
}
|
|
2030
|
-
function Dt(e, t, n) {
|
|
2031
|
-
let r = Et(e, n);
|
|
2032
|
-
for (let { block: e, bandWidth: n } of Tt(r.blocks, r.settings.width)) if (z(e)) {
|
|
2033
|
-
let r = B(e)?.applied ? void 0 : e.border, i = Math.floor(n) - St(e.styles.padding, r), a = xt[e.columns] ?? [100];
|
|
2034
|
-
for (let n = 0; n < e.children.length; n++) {
|
|
2035
|
-
let r = Math.floor(i * (a[n] ?? 100) / 100), o = e.children[n].find((e) => e.id === t);
|
|
2036
|
-
if (o) return wt(o, r);
|
|
2037
|
-
}
|
|
2038
|
-
} else if (e.id === t) return wt(e, n);
|
|
2039
|
-
return null;
|
|
2040
|
-
}
|
|
2041
|
-
function Ot(e, t, n) {
|
|
2042
|
-
let r = Et(e, n);
|
|
2043
|
-
for (let { block: e, bandWidth: n } of Tt(r.blocks, r.settings.width)) if (e.id === t) return Math.floor(n);
|
|
2044
|
-
return null;
|
|
2045
|
-
}
|
|
2046
|
-
function kt(e, t, n) {
|
|
2047
|
-
if (!z(e)) return;
|
|
2048
|
-
let r = B(e);
|
|
2049
|
-
if (r?.applied && r.height === "image") return (t ? Ot(t, e.id, n) : null) ?? yt(t?.settings);
|
|
2050
|
-
}
|
|
2051
|
-
// src/constants/socialIcons.ts
|
|
2052
|
-
var At = j, jt = {
|
|
2053
|
-
small: 24,
|
|
2054
|
-
medium: 32,
|
|
2055
|
-
large: 48
|
|
2056
|
-
}, Mt = [
|
|
2057
|
-
"facebook",
|
|
2058
|
-
"twitter",
|
|
2059
|
-
"instagram",
|
|
2060
|
-
"linkedin",
|
|
2061
|
-
"youtube",
|
|
2062
|
-
"tiktok",
|
|
2063
|
-
"pinterest",
|
|
2064
|
-
"email",
|
|
2065
|
-
"website",
|
|
2066
|
-
"whatsapp",
|
|
2067
|
-
"telegram",
|
|
2068
|
-
"discord",
|
|
2069
|
-
"snapchat",
|
|
2070
|
-
"reddit",
|
|
2071
|
-
"github",
|
|
2072
|
-
"dribbble",
|
|
2073
|
-
"behance"
|
|
2074
|
-
];
|
|
2075
|
-
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, ce as z };
|