@templatical/editor 0.56.1 → 0.57.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-CpZ7UeAZ.js → AiAltTextPopover-BjClNscQ.js} +5 -5
- package/dist/{AiAltTextReview-LYxvn7Qe.js → AiAltTextReview-DeMdVbtT.js} +6 -6
- package/dist/{AiChatPanel-Cy05P-iO.js → AiChatPanel-Cros4ZCM.js} +22 -25
- package/dist/AiPanels-D_CdHqFZ.js +26 -0
- package/dist/{AiRewriteMenu-DgqJHnza.js → AiRewriteMenu-BSzj1dKC.js} +53 -53
- package/dist/{BlockIssueBadge-CxHJmuOh.js → BlockIssueBadge-i2cZy5PB.js} +5 -5
- package/dist/{BlockPreviewCanvas-DEmNZkEG.js → BlockPreviewCanvas-D-If_vd_.js} +27 -27
- package/dist/{CloudHeaderExtras-Cqhw-jMz.js → CloudHeaderExtras-CJsXi4Ku.js} +2 -2
- package/dist/{CloudPanels-Bmlf05Il.js → CloudPanels-DPeK_siQ.js} +6 -6
- package/dist/{CollaborationNotices-C27GCMvK.js → CollaborationNotices-DkYX-ose.js} +3 -3
- package/dist/{CollaboratorBar-CLQjksX-.js → CollaboratorBar-xDweDvB6.js} +3 -3
- package/dist/CommentsPanel-t3w16YUl.js +23 -0
- package/dist/CommentsSidebar-B3M90RY_.js +516 -0
- package/dist/{CountdownBlock-D8dqjm3F.js → CountdownBlock-BrR2uqM3.js} +4 -4
- package/dist/{CountdownToolbar-IjpCOjCd.js → CountdownToolbar-DBu2ZqC6.js} +7 -7
- package/dist/{IssuesPanel-uwuzeMSW.js → IssuesPanel-BnUut-p-.js} +13 -13
- package/dist/{LanguageMenu-C-eQ0lFy.js → LanguageMenu-DfTxrbvp.js} +16 -16
- package/dist/{LoadingTrack-BG8cg9xi.js → LoadingTrack-c4SeD16s.js} +1 -1
- package/dist/{LocaleNotices-CDK_9D7P.js → LocaleNotices-D6zk-QCL.js} +5 -5
- package/dist/{LogicTagInsertButton-BSolF7Fd.js → LogicTagInsertButton-CJ1Jk6jv.js} +65 -65
- package/dist/{MediaEditModal-C8yc9dxt.js → MediaEditModal-BxbwZxnf.js} +4 -4
- package/dist/{MediaPanels-FI4I8asn.js → MediaPanels-BiUxsTMM.js} +2 -2
- package/dist/{MergeTagInput-B1nl2ZMT.js → MergeTagInput-CV-z85s9.js} +2 -2
- package/dist/{MergeTagModeToggle-DXvb80OE.js → MergeTagModeToggle-CixgX5C_.js} +7 -7
- package/dist/{MergeTagTextarea-DJlf3VbS.js → MergeTagTextarea-B1zOC_Nr.js} +9 -9
- package/dist/{ParagraphEditor-Dqco128s.js → ParagraphEditor-C9UhWvRB.js} +51 -51
- package/dist/{RestoreVersionDialog-hqLCuGV5.js → RestoreVersionDialog-Do7fZWpT.js} +5 -5
- package/dist/{RichTextEditorContent-xIEF0Y3Z.js → RichTextEditorContent-wW_SMun2.js} +10 -10
- package/dist/{SaveBlockDialog-CQlCP_XC.js → SaveBlockDialog-CCHIUfR-.js} +15 -15
- package/dist/{SavedBlocksBrowserModal-BXA32Fx6.js → SavedBlocksBrowserModal-DtPHhfw9.js} +13 -13
- package/dist/{SavedBlocksPanels-BKUzbamj.js → SavedBlocksPanels-CYIby5pR.js} +2 -2
- package/dist/{SavedBlocksPickBar-BlvF-4UF.js → SavedBlocksPickBar-CCwBugqN.js} +4 -4
- package/dist/{TemplateSettings-CYFtR8zv.js → TemplateSettings-B8IVy5q9.js} +14 -14
- package/dist/{TestEmailModal-BbaL17HO.js → TestEmailModal-CS5JoKRH.js} +13 -13
- package/dist/{TestEmailPanel-DhB1CSpg.js → TestEmailPanel-sOIZfKzc.js} +2 -2
- package/dist/{TitleEditor-3BRl8u5l.js → TitleEditor-ZlBcq9_P.js} +14 -14
- package/dist/{ToggleSwitch-R3wCCYE6.js → ToggleSwitch-BIPdFWUr.js} +1 -1
- package/dist/{Toolbar-pzNIakGM.js → Toolbar-c4_rLLJT.js} +218 -218
- package/dist/{TplModal-WNuWhHZm.js → TplModal-DnFFEulp.js} +6 -6
- package/dist/{VersionHistoryMenu--T-Qp_mH.js → VersionHistoryMenu-Cd2IaHgT.js} +10 -10
- package/dist/{VersionHistoryPanels-BPubvYIE.js → VersionHistoryPanels-TdGaMaa_.js} +2 -2
- package/dist/{VersionPreviewBanner-ClL3Wkln.js → VersionPreviewBanner-lkAf7tc8.js} +3 -3
- package/dist/{WrapperBlock-CjfCPceb.js → WrapperBlock-BiW4ye3w.js} +5 -5
- package/dist/{blockTypeIcons-12OMwVyN.js → blockTypeIcons-D1aYMC1M.js} +3 -3
- package/dist/bundle-stats.json +7 -7
- package/dist/cdn/chunks/{AiAltTextPopover-PFjTrl0y.js → AiAltTextPopover-CfGJNBOb.js} +5 -5
- package/dist/cdn/chunks/{AiAltTextPopover-PFjTrl0y.js.map → AiAltTextPopover-CfGJNBOb.js.map} +1 -1
- package/dist/cdn/chunks/{AiAltTextReview-BMjzvApH.js → AiAltTextReview-PKe31R_g.js} +6 -6
- package/dist/cdn/chunks/{AiAltTextReview-BMjzvApH.js.map → AiAltTextReview-PKe31R_g.js.map} +1 -1
- package/dist/cdn/chunks/{AiChatPanel-C2gpq4kP.js → AiChatPanel-DNCUpV8n.js} +15 -18
- package/dist/cdn/chunks/AiChatPanel-DNCUpV8n.js.map +1 -0
- package/dist/cdn/chunks/AiPanels-IV0VEkBL.js +27 -0
- package/dist/cdn/chunks/AiPanels-IV0VEkBL.js.map +1 -0
- package/dist/cdn/chunks/{AiRewriteMenu-CnkyjPEu.js → AiRewriteMenu-ZDBwReuU.js} +58 -58
- package/dist/cdn/chunks/AiRewriteMenu-ZDBwReuU.js.map +1 -0
- package/dist/cdn/chunks/{BlockIssueBadge-DncZ-HDf.js → BlockIssueBadge-DIlFDDwh.js} +5 -5
- package/dist/cdn/chunks/BlockIssueBadge-DIlFDDwh.js.map +1 -0
- package/dist/cdn/chunks/{BlockPreviewCanvas-CCSEzL46.js → BlockPreviewCanvas-D7U6nQ7t.js} +28 -28
- package/dist/cdn/chunks/BlockPreviewCanvas-D7U6nQ7t.js.map +1 -0
- package/dist/cdn/chunks/{CloudHeaderExtras-uUJYJFJ6.js → CloudHeaderExtras-CazfMn6A.js} +3 -3
- package/dist/cdn/chunks/{CloudHeaderExtras-uUJYJFJ6.js.map → CloudHeaderExtras-CazfMn6A.js.map} +1 -1
- package/dist/cdn/chunks/{CloudPanels-CRztnw4M.js → CloudPanels-EXXNMLbs.js} +5 -5
- package/dist/cdn/chunks/CloudPanels-EXXNMLbs.js.map +1 -0
- package/dist/cdn/chunks/{CollaborationNotices-IuLYT2x7.js → CollaborationNotices-DGA8XRZJ.js} +4 -4
- package/dist/cdn/chunks/{CollaborationNotices-IuLYT2x7.js.map → CollaborationNotices-DGA8XRZJ.js.map} +1 -1
- package/dist/cdn/chunks/{CollaboratorBar-C1ZI2xwa.js → CollaboratorBar-BWL1Shc1.js} +4 -4
- package/dist/cdn/chunks/{CollaboratorBar-C1ZI2xwa.js.map → CollaboratorBar-BWL1Shc1.js.map} +1 -1
- package/dist/cdn/chunks/CommentsPanel-4mrl4zMK.js +24 -0
- package/dist/cdn/chunks/CommentsPanel-4mrl4zMK.js.map +1 -0
- package/dist/cdn/chunks/CommentsSidebar-BJ87vc7i.js +486 -0
- package/dist/cdn/chunks/CommentsSidebar-BJ87vc7i.js.map +1 -0
- package/dist/cdn/chunks/{CountdownBlock-8aPSExrv.js → CountdownBlock-Do6oItNW.js} +5 -5
- package/dist/cdn/chunks/{CountdownBlock-8aPSExrv.js.map → CountdownBlock-Do6oItNW.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownToolbar-CnWQEW5g.js → CountdownToolbar-BN2_zvRj.js} +8 -8
- package/dist/cdn/chunks/{CountdownToolbar-CnWQEW5g.js.map → CountdownToolbar-BN2_zvRj.js.map} +1 -1
- package/dist/cdn/chunks/{IssuesPanel-CrplCzo8.js → IssuesPanel-BDwegn0s.js} +9 -9
- package/dist/cdn/chunks/IssuesPanel-BDwegn0s.js.map +1 -0
- package/dist/cdn/chunks/{LanguageMenu-B6MNInCL.js → LanguageMenu-DXq9cXUd.js} +105 -105
- package/dist/cdn/chunks/LanguageMenu-DXq9cXUd.js.map +1 -0
- package/dist/cdn/chunks/{LoadingTrack-DUYcDHOV.js → LoadingTrack-o-89hApJ.js} +2 -2
- package/dist/cdn/chunks/{LoadingTrack-DUYcDHOV.js.map → LoadingTrack-o-89hApJ.js.map} +1 -1
- package/dist/cdn/chunks/{LocaleNotices-TxeAl8Iq.js → LocaleNotices-CUN5K5QJ.js} +5 -5
- package/dist/cdn/chunks/{LocaleNotices-TxeAl8Iq.js.map → LocaleNotices-CUN5K5QJ.js.map} +1 -1
- package/dist/cdn/chunks/{LogicTagInsertButton-DvSVx2DB.js → LogicTagInsertButton-BEArlbra.js} +12 -12
- package/dist/cdn/chunks/{LogicTagInsertButton-DvSVx2DB.js.map → LogicTagInsertButton-BEArlbra.js.map} +1 -1
- package/dist/cdn/chunks/{MediaEditModal-tGK6htBl.js → MediaEditModal-BHTMNHx0.js} +4 -4
- package/dist/cdn/chunks/{MediaEditModal-tGK6htBl.js.map → MediaEditModal-BHTMNHx0.js.map} +1 -1
- package/dist/cdn/chunks/{MediaPanels-BVrQYz2C.js → MediaPanels-BlianNRh.js} +3 -3
- package/dist/cdn/chunks/{MediaPanels-BVrQYz2C.js.map → MediaPanels-BlianNRh.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagInput-DeuNH3re.js → MergeTagInput-B3SLXXzL.js} +3 -3
- package/dist/cdn/chunks/{MergeTagInput-DeuNH3re.js.map → MergeTagInput-B3SLXXzL.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagModeToggle-D7maMGIM.js → MergeTagModeToggle-Dywp9ntA.js} +6 -6
- package/dist/cdn/chunks/{MergeTagModeToggle-D7maMGIM.js.map → MergeTagModeToggle-Dywp9ntA.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagTextarea-B2xxIU3e.js → MergeTagTextarea-B9TM7FgM.js} +7 -7
- package/dist/cdn/chunks/{MergeTagTextarea-B2xxIU3e.js.map → MergeTagTextarea-B9TM7FgM.js.map} +1 -1
- package/dist/cdn/chunks/{ParagraphEditor-Bx_Hlw8d.js → ParagraphEditor-CVGtTYta.js} +30 -30
- package/dist/cdn/chunks/{ParagraphEditor-Bx_Hlw8d.js.map → ParagraphEditor-CVGtTYta.js.map} +1 -1
- package/dist/cdn/chunks/{RestoreVersionDialog-CPrrWTsT.js → RestoreVersionDialog-Dt_0qOOW.js} +5 -5
- package/dist/cdn/chunks/RestoreVersionDialog-Dt_0qOOW.js.map +1 -0
- package/dist/cdn/chunks/{RichTextEditorContent-Dze4C9VI.js → RichTextEditorContent-BjN4mnzL.js} +9 -9
- package/dist/cdn/chunks/{RichTextEditorContent-Dze4C9VI.js.map → RichTextEditorContent-BjN4mnzL.js.map} +1 -1
- package/dist/cdn/chunks/{SaveBlockDialog-CXVwnfsy.js → SaveBlockDialog-D9eBjE99.js} +13 -13
- package/dist/cdn/chunks/{SaveBlockDialog-CXVwnfsy.js.map → SaveBlockDialog-D9eBjE99.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-BDTmenOE.js → SavedBlocksBrowserModal-ClsTpkdk.js} +9 -9
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-BDTmenOE.js.map → SavedBlocksBrowserModal-ClsTpkdk.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksPanels-B41Rk_v1.js → SavedBlocksPanels-CxlNHhUs.js} +3 -3
- package/dist/cdn/chunks/{SavedBlocksPanels-B41Rk_v1.js.map → SavedBlocksPanels-CxlNHhUs.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksPickBar-B97z_rFH.js → SavedBlocksPickBar-C7_Z8phX.js} +5 -5
- package/dist/cdn/chunks/{SavedBlocksPickBar-B97z_rFH.js.map → SavedBlocksPickBar-C7_Z8phX.js.map} +1 -1
- package/dist/cdn/chunks/{TemplateSettings-YwwRbxPc.js → TemplateSettings-B6zDtjSs.js} +12 -12
- package/dist/cdn/chunks/{TemplateSettings-YwwRbxPc.js.map → TemplateSettings-B6zDtjSs.js.map} +1 -1
- package/dist/cdn/chunks/{TestEmailModal-BiFP2Cbx.js → TestEmailModal-CJ_QYFua.js} +10 -10
- package/dist/cdn/chunks/{TestEmailModal-BiFP2Cbx.js.map → TestEmailModal-CJ_QYFua.js.map} +1 -1
- package/dist/cdn/chunks/{TestEmailPanel-BrivPMk2.js → TestEmailPanel-CsFrTq_a.js} +3 -3
- package/dist/cdn/chunks/{TestEmailPanel-BrivPMk2.js.map → TestEmailPanel-CsFrTq_a.js.map} +1 -1
- package/dist/cdn/chunks/{TitleEditor-CzPkkL2s.js → TitleEditor-CuKJptyw.js} +13 -13
- package/dist/cdn/chunks/{TitleEditor-CzPkkL2s.js.map → TitleEditor-CuKJptyw.js.map} +1 -1
- package/dist/cdn/chunks/{ToggleSwitch-BSkySwA1.js → ToggleSwitch-C0w0srN_.js} +2 -2
- package/dist/cdn/chunks/{ToggleSwitch-BSkySwA1.js.map → ToggleSwitch-C0w0srN_.js.map} +1 -1
- package/dist/cdn/chunks/{Toolbar-VH07SzX7.js → Toolbar-TS2WwlPW.js} +302 -302
- package/dist/cdn/chunks/Toolbar-TS2WwlPW.js.map +1 -0
- package/dist/cdn/chunks/{TplModal-DMe6J811.js → TplModal-CsadClrH.js} +6 -6
- package/dist/cdn/chunks/{TplModal-DMe6J811.js.map → TplModal-CsadClrH.js.map} +1 -1
- package/dist/cdn/chunks/{VersionHistoryMenu-DkwbKhBl.js → VersionHistoryMenu-BNPxnWiO.js} +9 -9
- package/dist/cdn/chunks/{VersionHistoryMenu-DkwbKhBl.js.map → VersionHistoryMenu-BNPxnWiO.js.map} +1 -1
- package/dist/cdn/chunks/{VersionHistoryPanels-CgxhMRAl.js → VersionHistoryPanels-CieY91f0.js} +3 -3
- package/dist/cdn/chunks/{VersionHistoryPanels-CgxhMRAl.js.map → VersionHistoryPanels-CieY91f0.js.map} +1 -1
- package/dist/cdn/chunks/{VersionPreviewBanner-WVBDBrwQ.js → VersionPreviewBanner-BldFvgxJ.js} +4 -4
- package/dist/cdn/chunks/{VersionPreviewBanner-WVBDBrwQ.js.map → VersionPreviewBanner-BldFvgxJ.js.map} +1 -1
- package/dist/cdn/chunks/{WrapperBlock-CCCIcqe2.js → WrapperBlock-DtnRuKWE.js} +6 -6
- package/dist/cdn/chunks/{WrapperBlock-CCCIcqe2.js.map → WrapperBlock-DtnRuKWE.js.map} +1 -1
- package/dist/cdn/chunks/{blockTypeIcons-CzYA5DF9.js → blockTypeIcons-19xd5ZPi.js} +6 -6
- package/dist/cdn/chunks/{blockTypeIcons-CzYA5DF9.js.map → blockTypeIcons-19xd5ZPi.js.map} +1 -1
- package/dist/cdn/chunks/{composables-D3lsO7Io.js → composables-CUIiW9OD.js} +750 -730
- package/dist/cdn/chunks/composables-CUIiW9OD.js.map +1 -0
- package/dist/cdn/chunks/{createCloudRuntime-CE79GB1H.js → createCloudRuntime-B7D04wKf.js} +157 -143
- package/dist/cdn/chunks/createCloudRuntime-B7D04wKf.js.map +1 -0
- package/dist/cdn/chunks/da-CYWJkrTg.js +97 -0
- package/dist/cdn/chunks/da-CYWJkrTg.js.map +1 -0
- package/dist/cdn/chunks/da-qQzj0QGy.js +950 -0
- package/dist/cdn/chunks/da-qQzj0QGy.js.map +1 -0
- package/dist/cdn/chunks/{dist-BzXULHvI.js → dist-BtWMy7UQ.js} +3 -3
- package/dist/cdn/chunks/{dist-BzXULHvI.js.map → dist-BtWMy7UQ.js.map} +1 -1
- package/dist/cdn/chunks/{dist-Cf1pSluo.js → dist-zu1jwYIS.js} +4 -4
- package/dist/cdn/chunks/{dist-Cf1pSluo.js.map → dist-zu1jwYIS.js.map} +1 -1
- package/dist/cdn/chunks/{draggable-DepKdldn.js → draggable-IRVFEZ-b.js} +1535 -1500
- package/dist/cdn/chunks/draggable-IRVFEZ-b.js.map +1 -0
- package/dist/cdn/chunks/{editor-modal-CN69NlOK.js → editor-modal-CarOiAYJ.js} +77 -76
- package/dist/cdn/chunks/{editor-modal-CN69NlOK.js.map → editor-modal-CarOiAYJ.js.map} +1 -1
- package/dist/cdn/chunks/en-B4s_0ryk.js +1 -0
- package/dist/cdn/chunks/{extensions-8dlM-fU4.js → extensions-Cbvk9i08.js} +7 -7
- package/dist/cdn/chunks/{extensions-8dlM-fU4.js.map → extensions-Cbvk9i08.js.map} +1 -1
- package/dist/cdn/chunks/{icons-DHExFLlT.js → icons-Cl4oR2mf.js} +73 -73
- package/dist/cdn/chunks/icons-Cl4oR2mf.js.map +1 -0
- package/dist/cdn/chunks/keys-BQqbBUag.js +11 -0
- package/dist/cdn/chunks/keys-BQqbBUag.js.map +1 -0
- package/dist/cdn/chunks/{normalizeMergeTagMarkup-aWjkotui.js → normalizeMergeTagMarkup-BJ-MnCqF.js} +55 -55
- package/dist/cdn/chunks/{normalizeMergeTagMarkup-aWjkotui.js.map → normalizeMergeTagMarkup-BJ-MnCqF.js.map} +1 -1
- package/dist/cdn/chunks/{preRenderCustomBlocks-Dn6dFUwx.js → preRenderCustomBlocks-D2wISRHq.js} +2 -2
- package/dist/cdn/chunks/{preRenderCustomBlocks-Dn6dFUwx.js.map → preRenderCustomBlocks-D2wISRHq.js.map} +1 -1
- package/dist/cdn/chunks/{sanitizeHtml-B3njfkSy.js → sanitizeHtml-CB7fjHFs.js} +22 -11
- package/dist/cdn/chunks/sanitizeHtml-CB7fjHFs.js.map +1 -0
- package/dist/cdn/chunks/{socialIcons-BFgc3qqJ.js → socialIcons-C_yggK1_.js} +575 -524
- package/dist/cdn/chunks/socialIcons-C_yggK1_.js.map +1 -0
- package/dist/cdn/chunks/{src-C9JWWxAk.js → src-Bp7bZcuD.js} +108 -95
- package/dist/cdn/chunks/src-Bp7bZcuD.js.map +1 -0
- package/dist/cdn/chunks/{src-mXG-Of9A.js → src-CdVAke9t.js} +721 -696
- package/dist/cdn/chunks/src-CdVAke9t.js.map +1 -0
- package/dist/cdn/chunks/{src-GgKlXNxy.js → src-D-URHI0Z.js} +232 -228
- package/dist/cdn/chunks/src-D-URHI0Z.js.map +1 -0
- package/dist/cdn/chunks/{tiptap-C940SvId.js → tiptap-BPiZqxCt.js} +40 -31
- package/dist/cdn/chunks/tiptap-BPiZqxCt.js.map +1 -0
- package/dist/cdn/chunks/{useCloudI18n-Xsih9yRH.js → useCloudI18n-Dr4S2TRW.js} +3 -3
- package/dist/cdn/chunks/{useCloudI18n-Xsih9yRH.js.map → useCloudI18n-Dr4S2TRW.js.map} +1 -1
- package/dist/cdn/chunks/useEditorRoot-B_kf_k-g.js +9 -0
- package/dist/cdn/chunks/{useEditorRoot-Beau2Z_T.js.map → useEditorRoot-B_kf_k-g.js.map} +1 -1
- package/dist/cdn/chunks/{useI18n-D8s7HtTn.js → useI18n-CSf-ZpcM.js} +3 -3
- package/dist/cdn/chunks/{useI18n-D8s7HtTn.js.map → useI18n-CSf-ZpcM.js.map} +1 -1
- package/dist/cdn/chunks/useLocalizedDisplay-slFOCPrh.js +33 -0
- package/dist/cdn/chunks/{useLocalizedDisplay-Bgg4qpev.js.map → useLocalizedDisplay-slFOCPrh.js.map} +1 -1
- package/dist/cdn/chunks/{useLogicTag-B0PDeDxl.js → useLogicTag-lPjCGeGC.js} +4 -4
- package/dist/cdn/chunks/{useLogicTag-B0PDeDxl.js.map → useLogicTag-lPjCGeGC.js.map} +1 -1
- package/dist/cdn/chunks/{useMergeTag-BSU75bKk.js → useMergeTag-BKNBwIry.js} +4 -4
- package/dist/cdn/chunks/{useMergeTag-BSU75bKk.js.map → useMergeTag-BKNBwIry.js.map} +1 -1
- package/dist/cdn/chunks/{usePopoverPosition-esO6wjvU.js → usePopoverPosition-BJFFi8x6.js} +3 -3
- package/dist/cdn/chunks/{usePopoverPosition-esO6wjvU.js.map → usePopoverPosition-BJFFi8x6.js.map} +1 -1
- package/dist/cdn/chunks/{useScrollToBlock-CJuUu7Xj.js → useScrollToBlock-MI4PP5lk.js} +3 -3
- package/dist/cdn/chunks/{useScrollToBlock-CJuUu7Xj.js.map → useScrollToBlock-MI4PP5lk.js.map} +1 -1
- package/dist/cdn/chunks/{withCurrentFont-QqBilClC.js → withCurrentFont-CzTFFaJA.js} +2 -2
- package/dist/cdn/chunks/{withCurrentFont-QqBilClC.js.map → withCurrentFont-CzTFFaJA.js.map} +1 -1
- package/dist/cdn/editor.css +1 -1
- package/dist/cdn/editor.js +685 -663
- package/dist/cdn/editor.js.map +1 -1
- package/dist/{check-CcuCoJDh.js → check-C7ua4TAK.js} +1 -1
- package/dist/{chevron-down-BfYIbFbC.js → chevron-down-DftQrAkI.js} +1 -1
- package/dist/{chevron-right-DyjFqY35.js → chevron-right-B-DULGbg.js} +1 -1
- package/dist/{chevron-up-BHEIxuS-.js → chevron-up-CeYsyD8c.js} +1 -1
- package/dist/{circle-alert-Tq7kAh9S.js → circle-exclamation-point-DHjORV_I.js} +3 -3
- package/dist/{clock-Df0ZiXwQ.js → clock-CajOtLEZ.js} +1 -1
- package/dist/{composables-DreAt_0A.js → composables-DbjgUQlV.js} +1123 -1103
- package/dist/{createCloudRuntime-CL4tUlDC.js → createCloudRuntime-Cnh2M6iT.js} +42 -28
- package/dist/{createLucideIcon-CfBdtoUw.js → createLucideIcon-D-mELTSY.js} +6 -6
- package/dist/da-CYWJkrTg.js +95 -0
- package/dist/da-qQzj0QGy.js +948 -0
- package/dist/{dist-CX7skkvG.js → dist-A328tG0Z.js} +2 -2
- package/dist/{dist-BjzK1g4Z.js → dist-B15BvV94.js} +2 -2
- package/dist/{dist-DDytHU_6.js → dist-B3G4Yvpd.js} +3 -3
- package/dist/{dist-CiYotUR8.js → dist-B6ptxfPo.js} +3 -3
- package/dist/{dist-0GWMyHtM.js → dist-BmV-2uBJ.js} +2 -2
- package/dist/{dist-CCLRTtJP.js → dist-BxKFi2h_.js} +5 -5
- package/dist/{dist-BMUUt3zJ.js → dist-CAvsz9cW.js} +680 -655
- package/dist/{dist-CsknfjrZ.js → dist-CMBOqk9I.js} +7 -7
- package/dist/{dist-ZrT0vAB6.js → dist-CXTsTO5h.js} +2 -2
- package/dist/{dist-Dq9VnANT.js → dist-D5BUcCjv.js} +2 -2
- package/dist/dist-D9cbSSSx.js +4 -0
- package/dist/{dist-BsumKKh9.js → dist-DAdrn64r.js} +2 -2
- package/dist/{dist-C3avsUq9.js → dist-DENg3ORe.js} +31 -22
- package/dist/{dist-Cr1CLCmx.js → dist-DI_8rB1X.js} +2 -2
- package/dist/dist-ELLEk-lS.js +4 -0
- package/dist/{editor-modal-BD32TXws.js → editor-modal-CgsaLpwB.js} +20 -19
- package/dist/en-DBLcB-CW.js +1 -0
- package/dist/{extensions-DKxHlSd7.js → extensions-7fb-XtNJ.js} +21 -21
- package/dist/{eye-B3psrAqd.js → eye-fe5sKF_K.js} +1 -1
- package/dist/{image-C3yuPDxx.js → image-CUC7SZiW.js} +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/{info-DKja7A68.js → info-DDbLU4pT.js} +1 -1
- package/dist/keys-D9oKZN1h.js +9 -0
- package/dist/{link-DhzPI4Hn.js → link-C2icj0iH.js} +1 -1
- package/dist/{list-DVGn7Ik2.js → list-KYC_Jb5A.js} +1 -1
- package/dist/{loader-circle-DqKWsMHO.js → loader-circle-DmyagWpc.js} +1 -1
- package/dist/{message-circle-C4TonoBs.js → message-circle-ijyWn6UJ.js} +1 -1
- package/dist/{normalizeMergeTagMarkup-Da9JAgx7.js → normalizeMergeTagMarkup-GrXJfXsQ.js} +82 -82
- package/dist/{package-9OkiEO4S.js → package-CKYm_jQY.js} +1 -1
- package/dist/{pencil-M9vkOB7C.js → pencil-C2TRSR-Y.js} +1 -1
- package/dist/{plus-DxZiv9YC.js → plus-CotJVDxb.js} +1 -1
- package/dist/{preRenderCustomBlocks-CdqSp2P7.js → preRenderCustomBlocks-DuXtzD-F.js} +3 -3
- package/dist/{refresh-cw-UY8_sdFG.js → refresh-cw-CuCRV6D5.js} +1 -1
- package/dist/{rotate-ccw-BFTGCpHn.js → rotate-ccw-BlnQ3y6R.js} +1 -1
- package/dist/{runtime-dom.esm-bundler-DlHp8xgy.js → runtime-dom.esm-bundler-nN-jsqr1.js} +20 -20
- package/dist/{sanitizeHtml-wBibnBF4.js → sanitizeHtml-eV4_BpI6.js} +25 -14
- package/dist/{search-RuGJnMEn.js → search-Dxw6oFrZ.js} +1 -1
- package/dist/{send-DGB1ar02.js → send-C-blQBZ9.js} +1 -1
- package/dist/{smartphone-CVA29CU_.js → smartphone-rLz4X-Dd.js} +1 -1
- package/dist/{socialIcons-oo4uL16Y.js → socialIcons-brRkK9Om.js} +600 -549
- package/dist/{sparkles-IHfEwEcd.js → sparkles-JWQlUiSn.js} +1 -1
- package/dist/{square-_Cl44UU6.js → square-DshDy1Il.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/templatical-editor.js +748 -726
- package/dist/{text-align-start-Dqk2Xt_Q.js → text-align-start-CyasaQtr.js} +13 -13
- package/dist/{trash-Cr7rD5Hh.js → trash-B1lZp2Tv.js} +1 -1
- package/dist/{triangle-alert-CKcpwtUj.js → triangle-exclamation-point-BhJvBEoT.js} +3 -3
- package/dist/{upload-DR9pqVON.js → upload-CNK8JX38.js} +1 -1
- package/dist/{useCloudI18n-BczJoFf4.js → useCloudI18n-HhCZYRV6.js} +2 -2
- package/dist/useEditorRoot-B0Njczhx.js +7 -0
- package/dist/{useI18n-zeWYtWSv.js → useI18n-CM9vKbYc.js} +2 -2
- package/dist/{cdn/chunks/useLocalizedDisplay-Bgg4qpev.js → useLocalizedDisplay-DoaT7nWk.js} +2 -4
- package/dist/{useLogicTag-B4Zpk3eo.js → useLogicTag-cTC2KbWd.js} +3 -3
- package/dist/{useMergeTag-B5qlq8px.js → useMergeTag-D2YDZ8vR.js} +3 -3
- package/dist/{usePopoverPosition-Br3zt_MQ.js → usePopoverPosition-CVRzzLkC.js} +2 -2
- package/dist/{useScrollToBlock-BfOzc1Z6.js → useScrollToBlock-vf_KD0FM.js} +3 -3
- package/dist/{vue.runtime.esm-bundler-BJXc_Mri.js → vue.runtime.esm-bundler-BE5V8ADU.js} +414 -362
- package/dist/{withCurrentFont-m_PHcOD0.js → withCurrentFont-DAmED4fN.js} +1 -1
- package/dist/{x-DZSFHafL.js → x-DbLX5Qdm.js} +1 -1
- package/package.json +23 -23
- package/dist/AiPanels-CwKmXzyr.js +0 -31
- package/dist/CommentsPanel-B5NqPMmY.js +0 -16
- package/dist/CommentsSidebar-BDrcrDxS.js +0 -526
- package/dist/cdn/chunks/AiChatPanel-C2gpq4kP.js.map +0 -1
- package/dist/cdn/chunks/AiPanels-Cx3PE2mE.js +0 -32
- package/dist/cdn/chunks/AiPanels-Cx3PE2mE.js.map +0 -1
- package/dist/cdn/chunks/AiRewriteMenu-CnkyjPEu.js.map +0 -1
- package/dist/cdn/chunks/BlockIssueBadge-DncZ-HDf.js.map +0 -1
- package/dist/cdn/chunks/BlockPreviewCanvas-CCSEzL46.js.map +0 -1
- package/dist/cdn/chunks/CloudPanels-CRztnw4M.js.map +0 -1
- package/dist/cdn/chunks/CommentsPanel-lgjJNrrY.js +0 -18
- package/dist/cdn/chunks/CommentsPanel-lgjJNrrY.js.map +0 -1
- package/dist/cdn/chunks/CommentsSidebar-DTold7iy.js +0 -496
- package/dist/cdn/chunks/CommentsSidebar-DTold7iy.js.map +0 -1
- package/dist/cdn/chunks/IssuesPanel-CrplCzo8.js.map +0 -1
- package/dist/cdn/chunks/LanguageMenu-B6MNInCL.js.map +0 -1
- package/dist/cdn/chunks/RestoreVersionDialog-CPrrWTsT.js.map +0 -1
- package/dist/cdn/chunks/Toolbar-VH07SzX7.js.map +0 -1
- package/dist/cdn/chunks/composables-D3lsO7Io.js.map +0 -1
- package/dist/cdn/chunks/createCloudRuntime-CE79GB1H.js.map +0 -1
- package/dist/cdn/chunks/draggable-DepKdldn.js.map +0 -1
- package/dist/cdn/chunks/en-Bcz4gS9U.js +0 -1
- package/dist/cdn/chunks/icons-DHExFLlT.js.map +0 -1
- package/dist/cdn/chunks/keys-BUmIvYy3.js +0 -11
- package/dist/cdn/chunks/keys-BUmIvYy3.js.map +0 -1
- package/dist/cdn/chunks/sanitizeHtml-B3njfkSy.js.map +0 -1
- package/dist/cdn/chunks/socialIcons-BFgc3qqJ.js.map +0 -1
- package/dist/cdn/chunks/src-C9JWWxAk.js.map +0 -1
- package/dist/cdn/chunks/src-GgKlXNxy.js.map +0 -1
- package/dist/cdn/chunks/src-mXG-Of9A.js.map +0 -1
- package/dist/cdn/chunks/tiptap-C940SvId.js.map +0 -1
- package/dist/cdn/chunks/useEditorRoot-Beau2Z_T.js +0 -9
- package/dist/dist-B_0FPmoy.js +0 -4
- package/dist/dist-DKV9m4Uu.js +0 -4
- package/dist/en-Dgs_-NBw.js +0 -1
- package/dist/keys-w_VRjoMu.js +0 -9
- package/dist/useEditorRoot-BcXKhM_8.js +0 -7
- package/dist/useLocalizedDisplay-Cbhx208c.js +0 -31
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { $ as e, B as t, Ft as n, G as r, M as i, Mt as a, Pt as o, Q as s, Y as c, Z as l, _ as u, c as d, ct as f, et as p, f as m, g as h, it as g, k as _, lt as v, nt as y, ot as b, q as x, r as S, w as C, y as w } from "./vue.runtime.esm-bundler-
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as
|
|
5
|
-
import { t as
|
|
6
|
-
import { B as
|
|
7
|
-
import { t as
|
|
8
|
-
import { r as
|
|
9
|
-
import { i as
|
|
1
|
+
import { $ as e, B as t, Ft as n, G as r, M as i, Mt as a, Pt as o, Q as s, Y as c, Z as l, _ as u, c as d, ct as f, et as p, f as m, g as h, it as g, k as _, lt as v, nt as y, ot as b, q as x, r as S, w as C, y as w } from "./vue.runtime.esm-bundler-BE5V8ADU.js";
|
|
2
|
+
import { A as T, At as E, D, E as O, Et as k, Ft as A, G as j, Lt as ee, N as M, O as N, Ot as te, R as P, Rt as F, S as ne, T as re, Tt as I, Wt as L, Yt as R, _ as z, bt as ie, et as B, f as V, g as ae, h as oe, in as H, j as se, kt as ce, lt as U, qt as le, rt as W, sn as ue, tn as de, ut as fe, v as G, vt as pe, w as K, zt as q } from "./dist-CAvsz9cW.js";
|
|
3
|
+
import { t as J } from "./createLucideIcon-D-mELTSY.js";
|
|
4
|
+
import { t as me } from "./upload-CNK8JX38.js";
|
|
5
|
+
import { t as he } from "./loader-circle-DmyagWpc.js";
|
|
6
|
+
import { B as ge, C as _e, W as ve, u as ye } from "./keys-D9oKZN1h.js";
|
|
7
|
+
import { t as be } from "./useI18n-CM9vKbYc.js";
|
|
8
|
+
import { r as xe } from "./dist-B6ptxfPo.js";
|
|
9
|
+
import { i as Se, r as Ce } from "./usePopoverPosition-CVRzzLkC.js";
|
|
10
10
|
// ../core/dist/index.js
|
|
11
|
-
var
|
|
11
|
+
var Y = (e) => typeof e == "object" && !!e && !Array.isArray(e), we = (e) => Array.isArray(e) && e.length > 0 && e.every((e) => Y(e) && typeof e.id == "string"), Te = /* @__PURE__ */ new Set([
|
|
12
12
|
"id",
|
|
13
13
|
"type",
|
|
14
14
|
"children",
|
|
@@ -16,51 +16,51 @@ var X = (e) => typeof e == "object" && !!e && !Array.isArray(e), Se = (e) => Arr
|
|
|
16
16
|
"l10n",
|
|
17
17
|
"renderedHtml"
|
|
18
18
|
]);
|
|
19
|
-
function
|
|
19
|
+
function Ee(e, t, n) {
|
|
20
20
|
let r = /* @__PURE__ */ new Set();
|
|
21
21
|
for (let i of n) {
|
|
22
|
-
if (!
|
|
23
|
-
let n = i.split("."), a = n.pop(), o = n.join("."), s =
|
|
22
|
+
if (!I(i)) continue;
|
|
23
|
+
let n = i.split("."), a = n.pop(), o = n.join("."), s = q(e, i), c = t;
|
|
24
24
|
for (let [t, i] of n.entries()) {
|
|
25
25
|
let a = n.slice(0, t + 1).join(".");
|
|
26
|
-
s !== void 0 &&
|
|
26
|
+
s !== void 0 && Y(c) && q(c, i) === void 0 && Y(q(e, a)) && (c[i] = {}, r.add(a)), c = q(c, i);
|
|
27
27
|
}
|
|
28
28
|
if (Array.isArray(c)) {
|
|
29
|
-
let e = c.findIndex((e) =>
|
|
29
|
+
let e = c.findIndex((e) => Y(e) && e.id === a);
|
|
30
30
|
if (e < 0) continue;
|
|
31
|
-
s === void 0 ? c.splice(e, 1) : c[e] =
|
|
32
|
-
} else
|
|
31
|
+
s === void 0 ? c.splice(e, 1) : c[e] = R(s);
|
|
32
|
+
} else Y(c) && (s === void 0 ? delete c[a] : c[a] = R(s), o && Object.keys(c).length === 0 && q(e, o) === void 0 && Ee(e, t, [o]));
|
|
33
33
|
}
|
|
34
34
|
return r;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
if (
|
|
38
|
-
else if (i &&
|
|
36
|
+
function De(e, t, n, r, i = !0, a = /* @__PURE__ */ new Set()) {
|
|
37
|
+
if (Y(e) && Y(t) && !a.has(n)) for (let o of /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)])) (n || !Te.has(o)) && De(e[o], t[o], n ? `${n}.${o}` : o, r, i, a);
|
|
38
|
+
else if (i && we(e) && we(t)) for (let o of t) {
|
|
39
39
|
if (o.id.includes(".")) continue;
|
|
40
40
|
let t = e.find((e) => e.id === o.id);
|
|
41
|
-
t &&
|
|
41
|
+
t && De(t, o, `${n}.${o.id}`, r, i, a);
|
|
42
42
|
}
|
|
43
|
-
else
|
|
43
|
+
else B(e, t) || r.set(n, t);
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function X(e, t, n, r = [], i = /* @__PURE__ */ new Set()) {
|
|
46
46
|
let a = /* @__PURE__ */ new Map();
|
|
47
|
-
|
|
48
|
-
let o = new Set(e.type === "custom" ?
|
|
49
|
-
for (let [t, r] of a) if ((e.type === "custom" ? o.has(t) :
|
|
47
|
+
De(e, t, "", a, e.type !== "custom", i);
|
|
48
|
+
let o = new Set(e.type === "custom" ? ue(e, r) : []), s = {}, c = {};
|
|
49
|
+
for (let [t, r] of a) if ((e.type === "custom" ? o.has(t) : ce(e.type, t)) && typeof r == "string" && q(e, t) !== void 0) {
|
|
50
50
|
let i = n?.text?.[t];
|
|
51
51
|
s[t] = i && i.value === r ? i : {
|
|
52
52
|
value: r,
|
|
53
|
-
sourceHash:
|
|
53
|
+
sourceHash: de(String(q(e, t) ?? ""))
|
|
54
54
|
};
|
|
55
55
|
} else c[t] = r === void 0 ? null : r;
|
|
56
56
|
let l = {};
|
|
57
57
|
return Object.keys(s).length && (l.text = s), Object.keys(c).length && (l.set = c), n?.hidden && (l.hidden = !0), l;
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function Oe(e, t, n) {
|
|
60
60
|
let r = !1;
|
|
61
61
|
function i(e, t, n, a) {
|
|
62
|
-
let o = e[n], s = t[n], c = (e) => Array.isArray(e) && e.every((e) =>
|
|
63
|
-
if (c(o) && c(s) && (JSON.stringify(o.map((e) => e.id)) !== JSON.stringify(s.map((e) => e.id)) && (r = !0, e[n] = s.map((e) =>
|
|
62
|
+
let o = e[n], s = t[n], c = (e) => Array.isArray(e) && e.every((e) => Y(e) && typeof e.id == "string");
|
|
63
|
+
if (c(o) && c(s) && (JSON.stringify(o.map((e) => e.id)) !== JSON.stringify(s.map((e) => e.id)) && (r = !0, e[n] = s.map((e) => R(o.find((t) => t.id === e.id) ?? e))), a)) for (let t of s) {
|
|
64
64
|
let r = e[n].find((e) => e.id === t.id);
|
|
65
65
|
r && i(r, t, a);
|
|
66
66
|
}
|
|
@@ -68,51 +68,51 @@ function De(e, t, n) {
|
|
|
68
68
|
let a = e, o = t;
|
|
69
69
|
if (e.type === "menu" && i(a, o, "items"), e.type === "table" && i(a, o, "rows", "cells"), e.type === "social" && i(a, o, "icons"), e.type === "section" && t.type === "section") {
|
|
70
70
|
let i = (e) => e.map((e) => e.map((e) => e.id));
|
|
71
|
-
(e.columns !== t.columns || JSON.stringify(i(e.children)) !== JSON.stringify(i(t.children))) && (r = !0, e.columns = t.columns, e.children = t.children.map((e) => e.map((e) =>
|
|
71
|
+
(e.columns !== t.columns || JSON.stringify(i(e.children)) !== JSON.stringify(i(t.children))) && (r = !0, e.columns = t.columns, e.children = t.children.map((e) => e.map((e) => R(n(e.id) ?? e))));
|
|
72
72
|
}
|
|
73
73
|
return r;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function ke(e, t, n) {
|
|
76
76
|
let r = (e) => {
|
|
77
77
|
let { locale: t, locales: n, l10n: r, ...i } = e;
|
|
78
78
|
return i;
|
|
79
79
|
}, i = /* @__PURE__ */ new Map();
|
|
80
|
-
|
|
80
|
+
De(r(e), r(t), "", i);
|
|
81
81
|
let a = {};
|
|
82
|
-
for (let [t, r] of i) if (
|
|
82
|
+
for (let [t, r] of i) if (oe.includes(t) && typeof r == "string" && q(e, t) !== void 0) {
|
|
83
83
|
let i = n?.text?.[t];
|
|
84
84
|
(a.text ??= {})[t] = i?.value === r ? i : {
|
|
85
85
|
value: r,
|
|
86
|
-
sourceHash:
|
|
86
|
+
sourceHash: de(String(q(e, t) ?? ""))
|
|
87
87
|
};
|
|
88
88
|
} else (a.set ??= {})[t] = r === void 0 ? null : r;
|
|
89
89
|
return a;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
let o =
|
|
91
|
+
function Ae(e, t, n, r, i, a = []) {
|
|
92
|
+
let o = R(e ?? {}), s = [.../* @__PURE__ */ new Set([...a, ...[.../* @__PURE__ */ new Set([
|
|
93
93
|
...Object.keys(t.text ?? {}),
|
|
94
94
|
...Object.keys(t.set ?? {}),
|
|
95
95
|
...Object.keys(n.text ?? {}),
|
|
96
96
|
...Object.keys(n.set ?? {})
|
|
97
|
-
])].filter((e) => !
|
|
97
|
+
])].filter((e) => !B(t.text?.[e], n.text?.[e]) || !B(t.set?.[e], n.set?.[e]))])], c = Object.keys(e?.set ?? {}).filter((e) => s.some((t) => t.startsWith(`${e}.`)));
|
|
98
98
|
for (let e of c) {
|
|
99
|
-
let t =
|
|
100
|
-
if (
|
|
101
|
-
else if (n.length &&
|
|
99
|
+
let t = q(i, e), n = s.filter((t) => t.startsWith(`${e}.`) && B(q(r, t), q(i, t)));
|
|
100
|
+
if (B(t, q(r, e))) delete o.set[e];
|
|
101
|
+
else if (n.length && Y(q(r, e)) && Y(t)) {
|
|
102
102
|
delete o.set[e];
|
|
103
103
|
let i = (e, t, a) => {
|
|
104
104
|
if (!n.some((t) => e === t || e.startsWith(`${t}.`))) {
|
|
105
|
-
if (
|
|
106
|
-
else if (
|
|
107
|
-
else
|
|
105
|
+
if (Y(t) && Y(a)) for (let n of /* @__PURE__ */ new Set([...Object.keys(t), ...Object.keys(a)])) i(`${e}.${n}`, t[n], a[n]);
|
|
106
|
+
else if (Y(r) && r.type !== "custom" && we(t) && we(a)) for (let n of a) i(`${e}.${n.id}`, t.find((e) => e.id === n.id), n);
|
|
107
|
+
else Y(r) && typeof r.type == "string" && te(r, e, a) || o.text?.[e] && o.text[e].value === a || ((o.set ??= {})[e] = a === void 0 ? null : R(a));
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
|
-
i(e,
|
|
111
|
-
} else o.set[e] = t === void 0 ? null :
|
|
110
|
+
i(e, q(r, e), t);
|
|
111
|
+
} else o.set[e] = t === void 0 ? null : R(t);
|
|
112
112
|
for (let t of ["text", "set"]) for (let n of Object.keys(o[t] ?? {})) {
|
|
113
113
|
if (!n.startsWith(`${e}.`)) continue;
|
|
114
114
|
let r = t === "text" ? o.text[n].value : o.set[n] ?? void 0;
|
|
115
|
-
|
|
115
|
+
B(r, q(i, n)) || delete o[t][n];
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
for (let e of s) if (!c.includes(e)) {
|
|
@@ -121,7 +121,7 @@ function ke(e, t, n, r, i, a = []) {
|
|
|
121
121
|
}
|
|
122
122
|
return o.text && !Object.keys(o.text).length && delete o.text, o.set && !Object.keys(o.set).length && delete o.set, o;
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function je(e) {
|
|
125
125
|
return [
|
|
126
126
|
"addBlock",
|
|
127
127
|
"removeBlock",
|
|
@@ -129,18 +129,18 @@ function Ae(e) {
|
|
|
129
129
|
"duplicateBlock"
|
|
130
130
|
].includes(e);
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function Me(e, t, n) {
|
|
133
133
|
if (e.canEdit && !e.canEdit()) return !1;
|
|
134
134
|
let r = t === "addBlock", i = t === "duplicateBlock", a = typeof n[0] == "string" ? n[0] : n[0].id, o = r ? n[0] : e.findBlock?.(a);
|
|
135
135
|
if (!r && e.findBlock && !o) return !1;
|
|
136
136
|
let s = r ? null : e.findBlockLocation?.(a);
|
|
137
|
-
if (!r && e.findBlockLocation && !s || !r && e.isBlockLocked(a, !0) || s?.targetSectionId && e.isBlockLocked(s.targetSectionId, !0)) return !1;
|
|
137
|
+
if (!r && e.findBlockLocation && !s || !r && e.isBlockLocked(a, !0) || !r && o && N(o).some((t) => t !== a && e.isBlockLocked(t, !0)) || s?.targetSectionId && e.isBlockLocked(s.targetSectionId, !0)) return !1;
|
|
138
138
|
if (r && e.content) {
|
|
139
139
|
let t = {
|
|
140
140
|
...e.content(),
|
|
141
141
|
blocks: [o]
|
|
142
142
|
};
|
|
143
|
-
|
|
143
|
+
O(t), D(t);
|
|
144
144
|
}
|
|
145
145
|
if (t === "removeBlock") return !0;
|
|
146
146
|
let c = i && n[1] === void 0 && n[2] === void 0, l = c ? s?.targetSectionId : n[t === "moveBlock" ? 2 : 1], u = (c ? s?.columnIndex : n[t === "moveBlock" ? 3 : 2]) ?? 0;
|
|
@@ -148,24 +148,24 @@ function je(e, t, n) {
|
|
|
148
148
|
if (e.isBlockLocked(l, !0) || o?.type === "section") return !1;
|
|
149
149
|
if (e.findBlock) {
|
|
150
150
|
let t = e.findBlock(l);
|
|
151
|
-
if (t?.type !== "section" || u < 0 || u >=
|
|
151
|
+
if (t?.type !== "section" || u < 0 || u >= fe(t.columns)) return !1;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
return t !== "moveBlock" || s?.targetSectionId !== l || (s?.columnIndex ?? 0) !== u || s?.index !== n[1];
|
|
155
155
|
}
|
|
156
|
-
var
|
|
157
|
-
function
|
|
158
|
-
|
|
159
|
-
for (let n of Object.values(e)) typeof n == "function" &&
|
|
156
|
+
var Ne = /* @__PURE__ */ new WeakMap();
|
|
157
|
+
function Pe(e, t) {
|
|
158
|
+
Ne.set(e, t);
|
|
159
|
+
for (let n of Object.values(e)) typeof n == "function" && Ne.set(n, t);
|
|
160
160
|
}
|
|
161
161
|
function Z(e, t) {
|
|
162
|
-
let n =
|
|
163
|
-
n &&
|
|
162
|
+
let n = Ne.get(e);
|
|
163
|
+
n && Ne.set(t, n);
|
|
164
164
|
}
|
|
165
165
|
function Q(e, t, n) {
|
|
166
|
-
let r = Reflect.get(e, t), i =
|
|
166
|
+
let r = Reflect.get(e, t), i = Ne.get(e) ?? (typeof r == "function" ? Ne.get(r) : void 0);
|
|
167
167
|
if (i) return i(t, n);
|
|
168
|
-
if (!
|
|
168
|
+
if (!je(t)) return !0;
|
|
169
169
|
let a = Reflect.get(e, "isBlockLocked");
|
|
170
170
|
if (typeof a != "function") return !0;
|
|
171
171
|
let o = { isBlockLocked: (t, n) => a.call(e, t, n) }, s = Reflect.get(e, "content");
|
|
@@ -178,21 +178,21 @@ function Q(e, t, n) {
|
|
|
178
178
|
let n = Reflect.get(e, t);
|
|
179
179
|
typeof n == "function" && (o[t] = n.bind(e));
|
|
180
180
|
}
|
|
181
|
-
return
|
|
181
|
+
return Me(o, t, n);
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function Fe(e) {
|
|
184
184
|
return e instanceof Error ? e : Error(String(e), { cause: e });
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function Ie(e, t) {
|
|
187
187
|
try {
|
|
188
188
|
t();
|
|
189
189
|
} catch (t) {
|
|
190
|
-
e?.(
|
|
190
|
+
e?.(Fe(t));
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
let n = t.content ??
|
|
195
|
-
|
|
193
|
+
function Le(t) {
|
|
194
|
+
let n = t.content ?? P(t.defaultFontFamily, t.templateDefaults);
|
|
195
|
+
O(n), D(n);
|
|
196
196
|
let i = s({
|
|
197
197
|
template: null,
|
|
198
198
|
content: n,
|
|
@@ -207,11 +207,11 @@ function Ie(t) {
|
|
|
207
207
|
uiTheme: "auto"
|
|
208
208
|
}), a = g(i, "activeLocale"), o = [];
|
|
209
209
|
function c(e) {
|
|
210
|
-
let t =
|
|
211
|
-
if (e === t && (e = null), e !== null && !i.content.settings.locales?.includes(e)) throw new
|
|
210
|
+
let t = W(i.content);
|
|
211
|
+
if (e === t && (e = null), e !== null && !i.content.settings.locales?.includes(e)) throw new G(`This template has no "${e}" version.`, void 0, "unknown_locale");
|
|
212
212
|
a.value = e;
|
|
213
213
|
}
|
|
214
|
-
v(() => a.value ??
|
|
214
|
+
v(() => a.value ?? W(i.content), (e) => Ie(t.onError, () => t.onLocaleChange?.(e))), v(() => i.content.settings.locales?.includes(a.value ?? ""), () => {
|
|
215
215
|
a.value && !i.content.settings.locales?.includes(a.value) && c(null);
|
|
216
216
|
});
|
|
217
217
|
function l() {
|
|
@@ -221,20 +221,20 @@ function Ie(t) {
|
|
|
221
221
|
o = e;
|
|
222
222
|
}
|
|
223
223
|
function d(e) {
|
|
224
|
-
return
|
|
224
|
+
return j(i.content, e, o);
|
|
225
225
|
}
|
|
226
226
|
function f(e, n) {
|
|
227
227
|
if (!l()) return null;
|
|
228
|
-
if (e === "addLocale" && (!
|
|
229
|
-
let r =
|
|
230
|
-
return
|
|
228
|
+
if (e === "addLocale" && (!ie(n) || t.localization && !t.localization.locales.includes(n))) throw new G(`Locale "${n}" is not enabled.`, void 0, "unknown_locale");
|
|
229
|
+
let r = R(i.content);
|
|
230
|
+
return re(r, [{
|
|
231
231
|
op: e,
|
|
232
232
|
locale: n
|
|
233
|
-
}]),
|
|
233
|
+
}]), B(r, i.content) ? null : r;
|
|
234
234
|
}
|
|
235
235
|
function m(e, t) {
|
|
236
236
|
let n = f(e, t);
|
|
237
|
-
n && (i.content = n,
|
|
237
|
+
n && (i.content = n, M());
|
|
238
238
|
}
|
|
239
239
|
function h(e) {
|
|
240
240
|
m("addLocale", e);
|
|
@@ -251,24 +251,24 @@ function Ie(t) {
|
|
|
251
251
|
}
|
|
252
252
|
function b(e, t) {
|
|
253
253
|
let [n, r] = t;
|
|
254
|
-
if (!a.value || !l() ||
|
|
254
|
+
if (!a.value || !l() || z(n)) return null;
|
|
255
255
|
let s = I(i.content.blocks, n);
|
|
256
256
|
if (!s) return null;
|
|
257
|
-
let c = s.l10n?.[a.value], u =
|
|
257
|
+
let c = s.l10n?.[a.value], u = A(s, a.value, W(i.content)), d = X(s, u, c, o), f = e === "resetLocaleFields" && Array.isArray(r) ? Ee(s, u, r) : void 0, p = e === "resetLocaleFields" ? Ae(c, d, X(s, u, c, o, f), s, u, Array.isArray(r) ? r : []) : R(c ?? {});
|
|
258
258
|
if (e === "setBlockHidden") r ? p.hidden = !0 : delete p.hidden;
|
|
259
259
|
else if (e === "resetLocaleFields") r || (delete p.text, delete p.set, delete p.hidden);
|
|
260
260
|
else for (let e of r) {
|
|
261
261
|
let t = p.text?.[e];
|
|
262
|
-
t && (t.sourceHash =
|
|
262
|
+
t && (t.sourceHash = de(String(q(s, e) ?? "")));
|
|
263
263
|
}
|
|
264
|
-
return p.text && !Object.keys(p.text).length && delete p.text, p.set && !Object.keys(p.set).length && delete p.set,
|
|
264
|
+
return p.text && !Object.keys(p.text).length && delete p.text, p.set && !Object.keys(p.set).length && delete p.set, B(c ?? {}, p) ? null : {
|
|
265
265
|
block: s,
|
|
266
266
|
layer: p
|
|
267
267
|
};
|
|
268
268
|
}
|
|
269
269
|
function x(e, t) {
|
|
270
270
|
let n = b(e, t);
|
|
271
|
-
n && (y(n.block, n.layer),
|
|
271
|
+
n && (y(n.block, n.layer), M());
|
|
272
272
|
}
|
|
273
273
|
function S(e, t) {
|
|
274
274
|
x("setBlockHidden", [e, t]);
|
|
@@ -279,16 +279,16 @@ function Ie(t) {
|
|
|
279
279
|
function w(e, t) {
|
|
280
280
|
x("keepTranslations", [e, t]);
|
|
281
281
|
}
|
|
282
|
-
let
|
|
283
|
-
function
|
|
284
|
-
i.isDirty = !0,
|
|
282
|
+
let T = p(0), E = 0, k = 0;
|
|
283
|
+
function M() {
|
|
284
|
+
i.isDirty = !0, k++;
|
|
285
285
|
}
|
|
286
|
-
let
|
|
286
|
+
let te = r({
|
|
287
287
|
get: () => i.content,
|
|
288
288
|
set: (e) => {
|
|
289
|
-
i.content = e,
|
|
289
|
+
i.content = e, M();
|
|
290
290
|
}
|
|
291
|
-
}),
|
|
291
|
+
}), ne = r(() => i.selectedBlockId ? I(i.content.blocks, i.selectedBlockId) : null);
|
|
292
292
|
function I(e, t) {
|
|
293
293
|
for (let n of e) {
|
|
294
294
|
if (n.id === t) return n;
|
|
@@ -299,15 +299,12 @@ function Ie(t) {
|
|
|
299
299
|
}
|
|
300
300
|
return null;
|
|
301
301
|
}
|
|
302
|
-
function
|
|
303
|
-
if (t.add(e.id), e.type === "section") for (let n of e.children) for (let e of n) ie(e, t);
|
|
304
|
-
}
|
|
305
|
-
function B(e, t, n = { blocks: e }) {
|
|
302
|
+
function L(e, t, n = { blocks: e }) {
|
|
306
303
|
for (let r = 0; r < e.length; r++) {
|
|
307
304
|
let i = e[r];
|
|
308
305
|
if (i.id === t) return n;
|
|
309
306
|
if (i.type === "section") for (let e = 0; e < i.children.length; e++) {
|
|
310
|
-
let n =
|
|
307
|
+
let n = L(i.children[e], t, {
|
|
311
308
|
blocks: i.children[e],
|
|
312
309
|
sectionId: i.id,
|
|
313
310
|
columnIndex: e
|
|
@@ -317,7 +314,7 @@ function Ie(t) {
|
|
|
317
314
|
}
|
|
318
315
|
return null;
|
|
319
316
|
}
|
|
320
|
-
function
|
|
317
|
+
function z(e, n = !1) {
|
|
321
318
|
let r = a.value ?? t.lockLocale?.value ?? null;
|
|
322
319
|
for (let [i, a] of t.lockedBlocks?.value ?? []) {
|
|
323
320
|
let o = a;
|
|
@@ -327,8 +324,8 @@ function Ie(t) {
|
|
|
327
324
|
}
|
|
328
325
|
return !1;
|
|
329
326
|
}
|
|
330
|
-
function
|
|
331
|
-
let t =
|
|
327
|
+
function V(e) {
|
|
328
|
+
let t = L(i.content.blocks, e);
|
|
332
329
|
if (!t) return null;
|
|
333
330
|
let n = t.blocks.findIndex((t) => t.id === e);
|
|
334
331
|
return n === -1 ? null : {
|
|
@@ -338,92 +335,103 @@ function Ie(t) {
|
|
|
338
335
|
};
|
|
339
336
|
}
|
|
340
337
|
function ae(e, t = !0) {
|
|
341
|
-
|
|
342
|
-
}
|
|
343
|
-
function U(e) {
|
|
344
|
-
e && V(e) || (i.selectedBlockId = e);
|
|
338
|
+
O(e), D(e), i.content = e, t && M();
|
|
345
339
|
}
|
|
346
340
|
function oe(e) {
|
|
341
|
+
e && z(e) || (i.selectedBlockId = e);
|
|
342
|
+
}
|
|
343
|
+
function H(e) {
|
|
347
344
|
i.viewport = e;
|
|
348
345
|
}
|
|
349
346
|
function se(e) {
|
|
350
347
|
i.darkMode = e;
|
|
351
348
|
}
|
|
352
|
-
function
|
|
349
|
+
function ce(e) {
|
|
353
350
|
i.uiTheme = e;
|
|
354
351
|
}
|
|
355
|
-
function
|
|
352
|
+
function U(e) {
|
|
356
353
|
i.previewMode = e, e && (i.selectedBlockId = null);
|
|
357
354
|
}
|
|
358
|
-
function
|
|
355
|
+
function ue(e, t) {
|
|
359
356
|
if (!l()) return !1;
|
|
360
357
|
let n = I(i.content.blocks, e);
|
|
361
358
|
if (!n) return !1;
|
|
362
|
-
if ("l10n" in t) throw new
|
|
359
|
+
if ("l10n" in t) throw new G("l10n is immutable in updateBlock.", void 0, "invalid_operation");
|
|
363
360
|
let r = {
|
|
364
361
|
...n,
|
|
365
362
|
...t
|
|
366
|
-
};
|
|
367
|
-
|
|
363
|
+
}, o = R(n), s = Oe(o, r, (e) => I(i.content.blocks, e)), c = "children" in t, u = s || c || r.type !== n.type;
|
|
364
|
+
if (c && r.type === "section" && Array.isArray(r.children)) {
|
|
365
|
+
let e = new Set(N(n).slice(1)), t = /* @__PURE__ */ new Set();
|
|
366
|
+
for (let n of r.children) for (let r of n) for (let n of N(r)) {
|
|
367
|
+
if (t.has(n) || z(n, !0) || I(i.content.blocks, n) !== null && !e.has(n)) return !1;
|
|
368
|
+
t.add(n);
|
|
369
|
+
}
|
|
370
|
+
if (a.value) {
|
|
371
|
+
let e = N(o);
|
|
372
|
+
if (new Set(e).size !== e.length) return !1;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
return !z(e, u || "columns" in t) && (!u || !N(n).some((t) => t !== e && z(t, !0)));
|
|
368
376
|
}
|
|
369
377
|
function fe(e, n) {
|
|
370
|
-
if (!
|
|
378
|
+
if (!ue(e, n)) return;
|
|
371
379
|
let r = I(i.content.blocks, e);
|
|
372
380
|
if (!r) return;
|
|
373
381
|
let s = a.value;
|
|
374
382
|
if (s) {
|
|
375
|
-
let a =
|
|
383
|
+
let a = A(r, s, W(i.content)), c = {
|
|
376
384
|
...a,
|
|
377
385
|
...n
|
|
378
|
-
}, l =
|
|
379
|
-
if (
|
|
386
|
+
}, l = R(r), u = Oe(l, c, (e) => I(i.content.blocks, e));
|
|
387
|
+
if (z(e, u)) return;
|
|
380
388
|
u && t.onStructureChange?.();
|
|
381
|
-
let d =
|
|
382
|
-
delete r.l10n, Object.assign(r, d), y(r,
|
|
389
|
+
let d = ee(l);
|
|
390
|
+
delete r.l10n, Object.assign(r, d), y(r, Ae(r.l10n?.[s], X(r, a, r.l10n?.[s], o), X(r, c, r.l10n?.[s], o), r, c));
|
|
383
391
|
} else {
|
|
384
|
-
if (
|
|
385
|
-
let t =
|
|
392
|
+
if (z(e, "children" in n || "columns" in n)) return;
|
|
393
|
+
let t = ee({
|
|
386
394
|
...r,
|
|
387
395
|
...n
|
|
388
396
|
});
|
|
389
397
|
delete r.l10n, Object.assign(r, t);
|
|
390
398
|
}
|
|
391
|
-
|
|
399
|
+
M();
|
|
392
400
|
}
|
|
393
401
|
function pe(e) {
|
|
394
|
-
if ("locales" in e || "l10n" in e) throw new
|
|
395
|
-
if ("locale" in e && e.locale !==
|
|
402
|
+
if ("locales" in e || "l10n" in e) throw new G("locales and l10n are immutable in updateSettings.", void 0, "invalid_operation");
|
|
403
|
+
if ("locale" in e && e.locale !== W(i.content) && i.content.settings.locales?.length) throw new G("The default locale can't change while language versions exist.", void 0, "invalid_operation");
|
|
396
404
|
}
|
|
397
|
-
function
|
|
405
|
+
function K(e) {
|
|
398
406
|
if (!l()) return;
|
|
399
407
|
pe(e);
|
|
400
408
|
let t = a.value;
|
|
401
|
-
if (!t) i.content.settings =
|
|
409
|
+
if (!t) i.content.settings = F({
|
|
402
410
|
...i.content.settings,
|
|
403
411
|
...e
|
|
404
412
|
});
|
|
405
413
|
else {
|
|
406
|
-
let n = i.content.settings, r =
|
|
414
|
+
let n = i.content.settings, r = le(i.content, t).settings, a = {
|
|
407
415
|
...r,
|
|
408
416
|
locale: n.locale,
|
|
409
417
|
...e
|
|
410
|
-
}, o = n.l10n?.[t], s =
|
|
418
|
+
}, o = n.l10n?.[t], s = Ae(o, ke(n, r, o), ke(n, a, o), n, a);
|
|
411
419
|
Object.keys(s).length ? n.l10n = {
|
|
412
420
|
...n.l10n,
|
|
413
421
|
[t]: s
|
|
414
422
|
} : n.l10n && (delete n.l10n[t], Object.keys(n.l10n).length || delete n.l10n);
|
|
415
423
|
}
|
|
416
|
-
|
|
424
|
+
M();
|
|
417
425
|
}
|
|
418
426
|
let J = {
|
|
419
427
|
canEdit: l,
|
|
420
428
|
content: () => i.content,
|
|
421
429
|
findBlock: (e) => I(i.content.blocks, e),
|
|
422
|
-
findBlockLocation:
|
|
423
|
-
isBlockLocked:
|
|
430
|
+
findBlockLocation: V,
|
|
431
|
+
isBlockLocked: z
|
|
424
432
|
};
|
|
425
433
|
function me(e, n, r = 0, o) {
|
|
426
|
-
if (
|
|
434
|
+
if (Me(J, "addBlock", [
|
|
427
435
|
e,
|
|
428
436
|
n,
|
|
429
437
|
r,
|
|
@@ -437,91 +445,87 @@ function Ie(t) {
|
|
|
437
445
|
o !== void 0 && o < n.length ? n.splice(o, 0, e) : n.push(e);
|
|
438
446
|
}
|
|
439
447
|
} else o !== void 0 && o < i.content.blocks.length ? i.content.blocks.splice(o, 0, e) : i.content.blocks.push(e);
|
|
440
|
-
a.value && t.onStructureChange?.(),
|
|
448
|
+
a.value && t.onStructureChange?.(), M();
|
|
441
449
|
}
|
|
442
450
|
}
|
|
443
451
|
function he(e) {
|
|
444
|
-
if (!
|
|
445
|
-
let n =
|
|
452
|
+
if (!Me(J, "removeBlock", [e])) return;
|
|
453
|
+
let n = L(i.content.blocks, e);
|
|
446
454
|
if (n) {
|
|
447
455
|
let r = n.blocks.findIndex((t) => t.id === e);
|
|
448
456
|
if (r !== -1) {
|
|
449
457
|
let [e] = n.blocks.splice(r, 1);
|
|
450
|
-
|
|
451
|
-
let t = /* @__PURE__ */ new Set();
|
|
452
|
-
ie(e, t), t.has(i.selectedBlockId) && (i.selectedBlockId = null);
|
|
453
|
-
}
|
|
454
|
-
a.value && t.onStructureChange?.(), A();
|
|
458
|
+
i.selectedBlockId && new Set(N(e)).has(i.selectedBlockId) && (i.selectedBlockId = null), a.value && t.onStructureChange?.(), M();
|
|
455
459
|
}
|
|
456
460
|
}
|
|
457
461
|
}
|
|
458
462
|
function ge(e, n, r, o = 0) {
|
|
459
|
-
if (!
|
|
463
|
+
if (!Me(J, "moveBlock", [
|
|
460
464
|
e,
|
|
461
465
|
n,
|
|
462
466
|
r,
|
|
463
467
|
o
|
|
464
468
|
])) return;
|
|
465
|
-
let s =
|
|
469
|
+
let s = L(i.content.blocks, e), c = s.blocks.findIndex((t) => t.id === e), l;
|
|
466
470
|
if (r) {
|
|
467
471
|
let e = I(i.content.blocks, r);
|
|
468
472
|
e.children[o] = e.children[o] || [], l = e.children[o];
|
|
469
473
|
} else l = i.content.blocks;
|
|
470
474
|
let [u] = s.blocks.splice(c, 1);
|
|
471
|
-
l.splice(n, 0, u), a.value && t.onStructureChange?.(),
|
|
475
|
+
l.splice(n, 0, u), a.value && t.onStructureChange?.(), M();
|
|
472
476
|
}
|
|
473
477
|
function _e() {
|
|
474
|
-
|
|
478
|
+
M();
|
|
475
479
|
}
|
|
476
480
|
function ve(e, t) {
|
|
477
|
-
throw new
|
|
481
|
+
throw new G(`[Templatical] Templates: ${e} ${t}`);
|
|
478
482
|
}
|
|
479
483
|
function ye(e) {
|
|
480
|
-
|
|
484
|
+
Ie(t.onError, e);
|
|
481
485
|
}
|
|
482
486
|
function be(e) {
|
|
483
487
|
let { templates: n } = t;
|
|
484
488
|
return n || ve(e, "needs a templates provider. Pass one as `init({ templates })` to enable saving and loading."), n;
|
|
485
489
|
}
|
|
486
|
-
function
|
|
490
|
+
function xe(e) {
|
|
487
491
|
i.template && (i.template = {
|
|
488
492
|
...i.template,
|
|
489
493
|
name: e
|
|
490
|
-
},
|
|
494
|
+
}, M());
|
|
491
495
|
}
|
|
492
|
-
async function
|
|
496
|
+
async function Se(e) {
|
|
493
497
|
let n = be("create()"), { create: r } = n;
|
|
494
498
|
typeof r != "function" && ve("create()", "is disabled by the provider — its `create` is `false`.");
|
|
495
|
-
let a, o = ++
|
|
499
|
+
let a, o = ++E;
|
|
496
500
|
i.isLoading = !0;
|
|
497
501
|
try {
|
|
498
502
|
e?.content && (i.content = e.content);
|
|
499
|
-
let t =
|
|
503
|
+
let t = k;
|
|
500
504
|
a = await r(e?.name === void 0 ? { content: i.content } : {
|
|
501
505
|
name: e.name,
|
|
502
506
|
content: i.content
|
|
503
|
-
}), i.template = a,
|
|
507
|
+
}), i.template = a, k === t && (i.isDirty = !1), T.value++;
|
|
504
508
|
} catch (e) {
|
|
505
509
|
throw t.onError?.(e), e;
|
|
506
510
|
} finally {
|
|
507
|
-
|
|
511
|
+
E === o && (i.isLoading = !1);
|
|
508
512
|
}
|
|
509
513
|
return ye(() => n.onCreated?.(a)), a;
|
|
510
514
|
}
|
|
511
|
-
async function
|
|
512
|
-
let r = be("load()"), a, o = ++
|
|
515
|
+
async function Ce(e, n) {
|
|
516
|
+
let r = be("load()"), a, o = ++E;
|
|
513
517
|
i.isLoading = !0;
|
|
514
518
|
try {
|
|
515
|
-
if (a = await r.load(e),
|
|
516
|
-
i.template = a, i.content = a.content, i.isDirty = !1,
|
|
519
|
+
if (a = await r.load(e), O(a.content), D(a.content), n && !n()) return a;
|
|
520
|
+
i.template = a, i.content = a.content, i.isDirty = !1, T.value++;
|
|
517
521
|
} catch (e) {
|
|
518
522
|
throw t.onError?.(e), e;
|
|
519
523
|
} finally {
|
|
520
|
-
|
|
524
|
+
E === o && (i.isLoading = !1);
|
|
521
525
|
}
|
|
522
526
|
return ye(() => r.onLoaded?.(a)), a;
|
|
523
527
|
}
|
|
524
|
-
async function
|
|
528
|
+
async function Y(e = "api") {
|
|
525
529
|
let n = be("save()"), { save: r } = n;
|
|
526
530
|
typeof r != "function" && ve("save()", "is disabled by the provider — its `save` is `false`.");
|
|
527
531
|
let a = i.template;
|
|
@@ -532,7 +536,7 @@ function Ie(t) {
|
|
|
532
536
|
}, s;
|
|
533
537
|
i.isSaving = !0;
|
|
534
538
|
try {
|
|
535
|
-
let e =
|
|
539
|
+
let e = k;
|
|
536
540
|
if (s = await r(a.id, o), i.template?.id === a.id) {
|
|
537
541
|
let e = i.template.name;
|
|
538
542
|
i.template = e === a.name ? s : {
|
|
@@ -540,7 +544,7 @@ function Ie(t) {
|
|
|
540
544
|
name: e
|
|
541
545
|
};
|
|
542
546
|
}
|
|
543
|
-
|
|
547
|
+
k === e && (i.isDirty = !1);
|
|
544
548
|
} catch (e) {
|
|
545
549
|
throw t.onError?.(e), e;
|
|
546
550
|
} finally {
|
|
@@ -548,14 +552,14 @@ function Ie(t) {
|
|
|
548
552
|
}
|
|
549
553
|
return ye(() => n.onSaved?.(s, { trigger: e })), s;
|
|
550
554
|
}
|
|
551
|
-
function
|
|
555
|
+
function we() {
|
|
552
556
|
return i.template?.id !== void 0;
|
|
553
557
|
}
|
|
554
558
|
let Te = {
|
|
555
559
|
state: e(i),
|
|
556
|
-
loadVersion: e(
|
|
557
|
-
content:
|
|
558
|
-
selectedBlock:
|
|
560
|
+
loadVersion: e(T),
|
|
561
|
+
content: te,
|
|
562
|
+
selectedBlock: ne,
|
|
559
563
|
activeLocale: a,
|
|
560
564
|
setActiveLocale: c,
|
|
561
565
|
addLocale: h,
|
|
@@ -565,33 +569,33 @@ function Ie(t) {
|
|
|
565
569
|
keepTranslations: w,
|
|
566
570
|
setCustomBlockDefinitions: u,
|
|
567
571
|
createSetDefaultLocaleOperation: d,
|
|
568
|
-
isBlockLocked:
|
|
572
|
+
isBlockLocked: z,
|
|
569
573
|
setContent: ae,
|
|
570
|
-
selectBlock:
|
|
571
|
-
setViewport:
|
|
574
|
+
selectBlock: oe,
|
|
575
|
+
setViewport: H,
|
|
572
576
|
setDarkMode: se,
|
|
573
|
-
setUiTheme:
|
|
574
|
-
setPreviewMode:
|
|
577
|
+
setUiTheme: ce,
|
|
578
|
+
setPreviewMode: U,
|
|
575
579
|
updateBlock: fe,
|
|
576
|
-
updateSettings:
|
|
580
|
+
updateSettings: K,
|
|
577
581
|
addBlock: me,
|
|
578
582
|
removeBlock: he,
|
|
579
583
|
moveBlock: ge,
|
|
580
584
|
markDirty: _e,
|
|
581
|
-
findBlockLocation:
|
|
582
|
-
setName:
|
|
583
|
-
create:
|
|
584
|
-
load:
|
|
585
|
-
save:
|
|
586
|
-
hasTemplate:
|
|
585
|
+
findBlockLocation: V,
|
|
586
|
+
setName: xe,
|
|
587
|
+
create: Se,
|
|
588
|
+
load: Ce,
|
|
589
|
+
save: Y,
|
|
590
|
+
hasTemplate: we
|
|
587
591
|
};
|
|
588
|
-
return
|
|
592
|
+
return Pe(Te, (e, t) => je(e) ? Me(J, e, t) : l() ? e === "updateBlock" ? ue(t[0], t[1]) : (e === "updateSettings" && pe(t[0]), e === "addLocale" || e === "removeLocale" ? f(e, t[0]) !== null : e === "setBlockHidden" || e === "resetLocaleFields" || e === "keepTranslations" ? b(e, t) !== null : !0) : !1), Te;
|
|
589
593
|
}
|
|
590
|
-
var
|
|
591
|
-
function
|
|
592
|
-
let { content: t, setContent: n, maxSize: i =
|
|
594
|
+
var Re = 50, ze = 300, Be = 1500;
|
|
595
|
+
function Ve(e) {
|
|
596
|
+
let { content: t, setContent: n, maxSize: i = Re } = e, a = p([]), o = p([]), s = p(!1), c = null, l = null, u = r(() => a.value.length > 0), d = r(() => o.value.length > 0);
|
|
593
597
|
function f() {
|
|
594
|
-
return
|
|
598
|
+
return R(t.value);
|
|
595
599
|
}
|
|
596
600
|
function m(e) {
|
|
597
601
|
a.value.push(e), a.value.length > i && a.value.splice(0, a.value.length - i);
|
|
@@ -605,17 +609,17 @@ function Be(e) {
|
|
|
605
609
|
function _(e) {
|
|
606
610
|
l && l.blockId === e ? (clearTimeout(l.timeoutId), l.timeoutId = setTimeout(() => {
|
|
607
611
|
l = null;
|
|
608
|
-
},
|
|
612
|
+
}, ze)) : (h(), m(f()), o.value = [], l = {
|
|
609
613
|
blockId: e,
|
|
610
614
|
timeoutId: setTimeout(() => {
|
|
611
615
|
l = null;
|
|
612
|
-
},
|
|
616
|
+
}, ze)
|
|
613
617
|
});
|
|
614
618
|
}
|
|
615
619
|
function v() {
|
|
616
620
|
s.value = !0, c && clearTimeout(c), c = setTimeout(() => {
|
|
617
621
|
s.value = !1, c = null;
|
|
618
|
-
},
|
|
622
|
+
}, Be);
|
|
619
623
|
}
|
|
620
624
|
function y() {
|
|
621
625
|
if (a.value.length === 0) return;
|
|
@@ -648,14 +652,14 @@ function Be(e) {
|
|
|
648
652
|
flushDebounce: h
|
|
649
653
|
};
|
|
650
654
|
}
|
|
651
|
-
function
|
|
655
|
+
function He(e) {
|
|
652
656
|
let { addBlock: t, removeBlock: n, updateBlock: r, selectBlock: i, findBlockLocation: a } = e;
|
|
653
657
|
function o(n, r, a) {
|
|
654
|
-
let o = typeof e.blockDefaults == "function" ? e.blockDefaults() : e.blockDefaults, s =
|
|
658
|
+
let o = typeof e.blockDefaults == "function" ? e.blockDefaults() : e.blockDefaults, s = M(n, o);
|
|
655
659
|
return t(s, r, a), i(s.id), s;
|
|
656
660
|
}
|
|
657
661
|
function s(e, n, r) {
|
|
658
|
-
let o =
|
|
662
|
+
let o = T(e);
|
|
659
663
|
if (!Q(t, "duplicateBlock", [
|
|
660
664
|
e,
|
|
661
665
|
n,
|
|
@@ -681,9 +685,9 @@ function Ve(e) {
|
|
|
681
685
|
updateBlockProperty: l
|
|
682
686
|
};
|
|
683
687
|
}
|
|
684
|
-
var
|
|
685
|
-
function
|
|
686
|
-
let { content: t, isDirty: n, onChange: r, debounce: i =
|
|
688
|
+
var Ue = 2e3;
|
|
689
|
+
function We(e) {
|
|
690
|
+
let { content: t, isDirty: n, onChange: r, debounce: i = Ue, enabled: a = !0 } = e, o = null, s = !1;
|
|
687
691
|
function c() {
|
|
688
692
|
return typeof a == "function" ? a() : a;
|
|
689
693
|
}
|
|
@@ -718,7 +722,7 @@ function Ue(e) {
|
|
|
718
722
|
destroy: h
|
|
719
723
|
};
|
|
720
724
|
}
|
|
721
|
-
function
|
|
725
|
+
function Ge(e) {
|
|
722
726
|
let t = s(/* @__PURE__ */ new Set()), n = r(() => t.size > 0);
|
|
723
727
|
function i(e) {
|
|
724
728
|
return t.has(e);
|
|
@@ -736,7 +740,7 @@ function We(e) {
|
|
|
736
740
|
hasHiddenBlocks: n
|
|
737
741
|
};
|
|
738
742
|
}
|
|
739
|
-
function
|
|
743
|
+
function Ke(e) {
|
|
740
744
|
let t = p(!1), n = p(!1), i = r(() => !!e.definition.value?.dataSource), a = r(() => i.value && !e.block.value.dataSourceFetched);
|
|
741
745
|
async function o() {
|
|
742
746
|
let r = e.definition.value;
|
|
@@ -766,7 +770,7 @@ function Ge(e) {
|
|
|
766
770
|
needsFetch: a
|
|
767
771
|
};
|
|
768
772
|
}
|
|
769
|
-
function
|
|
773
|
+
function qe(e, t) {
|
|
770
774
|
e.activeLocale && v(e.activeLocale, () => t.flushDebounce?.());
|
|
771
775
|
for (let n of [
|
|
772
776
|
"addLocale",
|
|
@@ -803,43 +807,48 @@ function Ke(e, t) {
|
|
|
803
807
|
Q(e, "updateSettings", [n]) && (t.record(), o(n));
|
|
804
808
|
}, Z(a, e.updateBlock), Z(o, e.updateSettings);
|
|
805
809
|
}
|
|
806
|
-
var
|
|
810
|
+
var Je = "root", Ye = /* @__PURE__ */ new Set([
|
|
807
811
|
"id",
|
|
808
812
|
"type",
|
|
809
813
|
"children",
|
|
810
814
|
"l10n"
|
|
811
|
-
]),
|
|
815
|
+
]), Xe = /* @__PURE__ */ new Set([
|
|
812
816
|
"id",
|
|
813
817
|
"type",
|
|
814
818
|
"children",
|
|
815
819
|
"columns",
|
|
816
820
|
"l10n"
|
|
817
|
-
]),
|
|
818
|
-
function Qe(e) {
|
|
819
|
-
return e === null ? qe : JSON.stringify([e.sectionId, e.column]);
|
|
820
|
-
}
|
|
821
|
+
]), Ze = /* @__PURE__ */ new Set(), Qe = /* @__PURE__ */ new Set(["locales", "l10n"]);
|
|
821
822
|
function $e(e) {
|
|
823
|
+
return e === null ? Je : "wrapperId" in e ? JSON.stringify(["wrapper", e.wrapperId]) : JSON.stringify([
|
|
824
|
+
"section",
|
|
825
|
+
e.sectionId,
|
|
826
|
+
e.column
|
|
827
|
+
]);
|
|
828
|
+
}
|
|
829
|
+
function et(e) {
|
|
822
830
|
let t = e.children;
|
|
823
831
|
return e.type === "section" && Array.isArray(t) ? t : [];
|
|
824
832
|
}
|
|
825
|
-
function
|
|
833
|
+
function tt(e) {
|
|
826
834
|
let t = /* @__PURE__ */ new Map(), n = (e, r) => {
|
|
827
835
|
e.forEach((e, i) => {
|
|
828
836
|
t.has(e.id) || t.set(e.id, {
|
|
829
837
|
block: e,
|
|
830
|
-
|
|
838
|
+
parent: r,
|
|
839
|
+
key: $e(r),
|
|
831
840
|
index: i
|
|
832
|
-
}),
|
|
841
|
+
}), et(e).forEach((t, r) => {
|
|
833
842
|
Array.isArray(t) && n(t, {
|
|
834
843
|
sectionId: e.id,
|
|
835
844
|
column: r
|
|
836
845
|
});
|
|
837
|
-
});
|
|
846
|
+
}), e.type === "wrapper" && Array.isArray(e.children) && n(e.children, { wrapperId: e.id });
|
|
838
847
|
});
|
|
839
848
|
};
|
|
840
849
|
return n(e, null), t;
|
|
841
850
|
}
|
|
842
|
-
function
|
|
851
|
+
function nt(e) {
|
|
843
852
|
let t = [], n = Array(e.length).fill(-1);
|
|
844
853
|
e.forEach((r, i) => {
|
|
845
854
|
let a = 0, o = t.length;
|
|
@@ -853,17 +862,17 @@ function tt(e) {
|
|
|
853
862
|
for (; i !== -1;) r.add(i), i = n[i];
|
|
854
863
|
return r;
|
|
855
864
|
}
|
|
856
|
-
function
|
|
865
|
+
function rt(e, t, n) {
|
|
857
866
|
let r = {}, i = [];
|
|
858
|
-
for (let i of Object.keys(t)) n.has(i) || t[i] === void 0 ||
|
|
867
|
+
for (let i of Object.keys(t)) n.has(i) || t[i] === void 0 || B(e[i], t[i]) || (r[i] = R(t[i]));
|
|
859
868
|
for (let r of Object.keys(e)) n.has(r) || e[r] === void 0 || t[r] === void 0 && i.push(r);
|
|
860
869
|
return {
|
|
861
870
|
set: r,
|
|
862
871
|
unset: i
|
|
863
872
|
};
|
|
864
873
|
}
|
|
865
|
-
function
|
|
866
|
-
let n =
|
|
874
|
+
function it(e = {}, t = {}) {
|
|
875
|
+
let n = rt(e.text ?? {}, t.text ?? {}, Ze), r = rt(e.set ?? {}, t.set ?? {}, Ze), i = [.../* @__PURE__ */ new Set([...n.unset, ...r.unset])];
|
|
867
876
|
return {
|
|
868
877
|
...Object.keys(n.set).length > 0 ? { text: n.set } : {},
|
|
869
878
|
...Object.keys(r.set).length > 0 ? { set: r.set } : {},
|
|
@@ -871,107 +880,142 @@ function rt(e = {}, t = {}) {
|
|
|
871
880
|
...e.hidden === t.hidden ? {} : { hidden: t.hidden === !0 }
|
|
872
881
|
};
|
|
873
882
|
}
|
|
874
|
-
function
|
|
883
|
+
function at(e, t) {
|
|
875
884
|
if (e.settings.locale !== t.settings.locale && (e.settings.locales?.length || t.settings.locales?.length)) return [{
|
|
876
885
|
op: "setContent",
|
|
877
|
-
content:
|
|
886
|
+
content: R(t)
|
|
878
887
|
}];
|
|
879
|
-
let n =
|
|
888
|
+
let n = tt(e.blocks), r = tt(t.blocks), i = [], a = new Set(t.settings.locales ?? []), o = new Set(e.settings.locales ?? []), s = (e) => {
|
|
880
889
|
let t = r.get(e), i = n.get(e);
|
|
881
890
|
return t !== void 0 && i !== void 0 && t.block.type !== i.block.type;
|
|
882
|
-
},
|
|
891
|
+
}, c = (e) => r.has(e.id) && !s(e.id), l = (e) => e.type === "wrapper" && Array.isArray(e.children) ? [e.children] : et(e), u = (e) => l(e).some((e) => e.some((e) => c(e) || !s(e.id) && u(e))), d = /* @__PURE__ */ new Set(), f = [], p = (e, t) => {
|
|
883
892
|
let n = "kept";
|
|
884
|
-
t === "dropped" ? (
|
|
893
|
+
t === "dropped" ? (d.add(e.id), n = "dropped") : s(e.id) ? (i.push({
|
|
885
894
|
op: "deleteBlock",
|
|
886
895
|
blockId: e.id
|
|
887
|
-
}),
|
|
896
|
+
}), d.add(e.id), n = "dropped") : r.has(e.id) || (t === "deferred" ? n = "deferred" : u(e) ? (f.push(e.id), n = "deferred") : (i.push({
|
|
888
897
|
op: "deleteBlock",
|
|
889
898
|
blockId: e.id
|
|
890
|
-
}),
|
|
891
|
-
for (let t of
|
|
899
|
+
}), d.add(e.id), n = "dropped"));
|
|
900
|
+
for (let t of l(e)) if (Array.isArray(t)) for (let e of t) p(e, n);
|
|
892
901
|
};
|
|
893
|
-
for (let t of e.blocks)
|
|
894
|
-
let
|
|
895
|
-
let t =
|
|
896
|
-
return t.type === "section"
|
|
897
|
-
},
|
|
898
|
-
let a =
|
|
902
|
+
for (let t of e.blocks) p(t, "kept");
|
|
903
|
+
let m = (e) => n.has(e) && !d.has(e), h = (e) => {
|
|
904
|
+
let t = R(e);
|
|
905
|
+
return t.type === "section" ? t.children = et(e).map((e) => Array.isArray(e) ? e.filter((e) => !m(e.id)).map(h) : e) : t.type === "wrapper" && e.type === "wrapper" && (t.children = e.children.filter((e) => !m(e.id)).map(h)), t;
|
|
906
|
+
}, g = (e, t, r) => {
|
|
907
|
+
let a = $e(e), o = [], s = [];
|
|
899
908
|
t.forEach((e, t) => {
|
|
900
909
|
let r = n.get(e.id);
|
|
901
|
-
|
|
910
|
+
m(e.id) && r !== void 0 && r.key === a && (o.push(r.index), s.push(t));
|
|
902
911
|
});
|
|
903
|
-
let c = new Set([...
|
|
912
|
+
let c = new Set([...nt(o)].map((e) => s[e]));
|
|
904
913
|
t.forEach((n, a) => {
|
|
905
914
|
if (c.has(a) || r(n)) return;
|
|
906
915
|
let o = a > 0 ? t[a - 1].id : null;
|
|
907
|
-
i.push(
|
|
916
|
+
i.push(m(n.id) ? {
|
|
908
917
|
op: "moveBlock",
|
|
909
918
|
blockId: n.id,
|
|
910
919
|
parent: e,
|
|
911
920
|
after: o
|
|
912
921
|
} : {
|
|
913
922
|
op: "addBlock",
|
|
914
|
-
block:
|
|
923
|
+
block: h(n),
|
|
915
924
|
parent: e,
|
|
916
925
|
after: o
|
|
917
926
|
});
|
|
918
927
|
});
|
|
919
928
|
};
|
|
920
|
-
|
|
921
|
-
let
|
|
922
|
-
for (let t of
|
|
923
|
-
if (!
|
|
924
|
-
let r =
|
|
929
|
+
g(null, t.blocks, () => !1);
|
|
930
|
+
let _ = [...r.values()].map(({ block: e }) => e).filter((e) => e.type === "section"), v = /* @__PURE__ */ new Set(), y = (e) => {
|
|
931
|
+
for (let t of _) {
|
|
932
|
+
if (!m(t.id)) continue;
|
|
933
|
+
let r = et(n.get(t.id).block).length, a = et(t).length;
|
|
925
934
|
(e ? a > r : a < r) && (i.push({
|
|
926
935
|
op: "updateBlock",
|
|
927
936
|
blockId: t.id,
|
|
928
937
|
set: { columns: t.columns }
|
|
929
|
-
}),
|
|
938
|
+
}), v.add(t.id));
|
|
930
939
|
}
|
|
931
940
|
};
|
|
932
|
-
|
|
933
|
-
for (let e of
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
941
|
+
y(!0);
|
|
942
|
+
for (let { block: e } of r.values()) {
|
|
943
|
+
if (e.type !== "wrapper") continue;
|
|
944
|
+
let t = !m(e.id);
|
|
945
|
+
g({ wrapperId: e.id }, e.children, (e) => t && !m(e.id));
|
|
946
|
+
}
|
|
947
|
+
for (let e of _) {
|
|
948
|
+
let t = !m(e.id);
|
|
949
|
+
et(e).forEach((n, r) => {
|
|
950
|
+
Array.isArray(n) && g({
|
|
937
951
|
sectionId: e.id,
|
|
938
952
|
column: r
|
|
939
|
-
}, n, (e) => t && !
|
|
953
|
+
}, n, (e) => t && !m(e.id));
|
|
940
954
|
});
|
|
941
955
|
}
|
|
942
|
-
|
|
943
|
-
for (let e of
|
|
956
|
+
y(!1);
|
|
957
|
+
for (let e of f) i.push({
|
|
944
958
|
op: "deleteBlock",
|
|
945
959
|
blockId: e
|
|
946
960
|
});
|
|
961
|
+
let b = (e) => e.type === "slot" || l(e).some((e) => e.some(b)), x = (e) => {
|
|
962
|
+
let t = [], n = e;
|
|
963
|
+
for (; n !== null;) {
|
|
964
|
+
let e = "wrapperId" in n ? n.wrapperId : n.sectionId;
|
|
965
|
+
"wrapperId" in n && t.push(e), n = r.get(e)?.parent ?? null;
|
|
966
|
+
}
|
|
967
|
+
return t;
|
|
968
|
+
}, S = new Set(i.flatMap((e) => {
|
|
969
|
+
if (e.op !== "addBlock" && e.op !== "moveBlock" || e.parent === null) return [];
|
|
970
|
+
let t = e.op === "addBlock" ? e.block : n.get(e.blockId)?.block;
|
|
971
|
+
return t && b(t) ? x(e.parent) : [];
|
|
972
|
+
})), C = /* @__PURE__ */ new Set(), w = [];
|
|
973
|
+
for (let [e, t] of n) {
|
|
974
|
+
let n = r.get(e);
|
|
975
|
+
if (S.has(e) && n && c(t.block)) for (let [r, i] of Object.entries(t.block.l10n ?? {})) i.hidden === !0 && n.block.l10n?.[r]?.hidden !== !0 && o.has(r) && (w.push({
|
|
976
|
+
op: "updateBlockLocale",
|
|
977
|
+
blockId: e,
|
|
978
|
+
locale: r,
|
|
979
|
+
hidden: !1
|
|
980
|
+
}), C.add(JSON.stringify([e, r])));
|
|
981
|
+
}
|
|
982
|
+
let T = /* @__PURE__ */ new Set(), E = [];
|
|
983
|
+
for (let [e, t] of n) {
|
|
984
|
+
let n = r.get(e);
|
|
985
|
+
n && c(t.block) && t.block.type === "section" && t.block.wrapper !== void 0 && n.block.wrapper === void 0 && n.parent !== null && "wrapperId" in n.parent && (T.add(e), E.push({
|
|
986
|
+
op: "updateBlock",
|
|
987
|
+
blockId: e,
|
|
988
|
+
unset: ["wrapper"]
|
|
989
|
+
}));
|
|
990
|
+
}
|
|
991
|
+
i.unshift(...w, ...E);
|
|
947
992
|
for (let [e, t] of r) {
|
|
948
|
-
if (!
|
|
949
|
-
let
|
|
950
|
-
(Object.keys(
|
|
993
|
+
if (!m(e)) continue;
|
|
994
|
+
let r = rt(n.get(e).block, t.block, v.has(e) ? Xe : Ye), { set: a } = r, o = T.has(e) ? r.unset.filter((e) => e !== "wrapper") : r.unset;
|
|
995
|
+
(Object.keys(a).length !== 0 || o.length !== 0) && i.push({
|
|
951
996
|
op: "updateBlock",
|
|
952
997
|
blockId: e,
|
|
953
|
-
...Object.keys(
|
|
954
|
-
...
|
|
998
|
+
...Object.keys(a).length > 0 ? { set: a } : {},
|
|
999
|
+
...o.length > 0 ? { unset: o } : {}
|
|
955
1000
|
});
|
|
956
1001
|
}
|
|
957
|
-
let
|
|
958
|
-
(Object.keys(
|
|
1002
|
+
let D = rt(e.settings, t.settings, Qe);
|
|
1003
|
+
(Object.keys(D.set).length > 0 || D.unset.length > 0) && i.push({
|
|
959
1004
|
op: "updateSettings",
|
|
960
|
-
...Object.keys(
|
|
961
|
-
...
|
|
1005
|
+
...Object.keys(D.set).length > 0 ? { set: D.set } : {},
|
|
1006
|
+
...D.unset.length > 0 ? { unset: D.unset } : {}
|
|
962
1007
|
});
|
|
963
|
-
let
|
|
964
|
-
for (let e of y) v.has(e) || i.push({
|
|
1008
|
+
for (let e of a) o.has(e) || i.push({
|
|
965
1009
|
op: "addLocale",
|
|
966
1010
|
locale: e
|
|
967
1011
|
});
|
|
968
1012
|
for (let [e, t] of r) {
|
|
969
|
-
if (!
|
|
970
|
-
let r = n.get(e).block.l10n ?? {},
|
|
971
|
-
for (let t of /* @__PURE__ */ new Set([...Object.keys(r), ...Object.keys(
|
|
972
|
-
if (!
|
|
973
|
-
let n =
|
|
974
|
-
Object.keys(n).length > 0 && i.push({
|
|
1013
|
+
if (!m(e)) continue;
|
|
1014
|
+
let r = n.get(e).block.l10n ?? {}, o = t.block.l10n ?? {};
|
|
1015
|
+
for (let t of /* @__PURE__ */ new Set([...Object.keys(r), ...Object.keys(o)])) {
|
|
1016
|
+
if (!a.has(t)) continue;
|
|
1017
|
+
let n = it(r[t], o[t]);
|
|
1018
|
+
C.has(JSON.stringify([e, t])) && delete n.hidden, Object.keys(n).length > 0 && i.push({
|
|
975
1019
|
op: "updateBlockLocale",
|
|
976
1020
|
blockId: e,
|
|
977
1021
|
locale: t,
|
|
@@ -979,17 +1023,17 @@ function it(e, t) {
|
|
|
979
1023
|
});
|
|
980
1024
|
}
|
|
981
1025
|
}
|
|
982
|
-
let
|
|
983
|
-
for (let e of /* @__PURE__ */ new Set([...Object.keys(
|
|
984
|
-
if (!
|
|
985
|
-
let t =
|
|
1026
|
+
let O = e.settings.l10n ?? {}, k = t.settings.l10n ?? {};
|
|
1027
|
+
for (let e of /* @__PURE__ */ new Set([...Object.keys(O), ...Object.keys(k)])) {
|
|
1028
|
+
if (!a.has(e)) continue;
|
|
1029
|
+
let t = it(O[e], k[e]);
|
|
986
1030
|
Object.keys(t).length > 0 && i.push({
|
|
987
1031
|
op: "updateSettingsLocale",
|
|
988
1032
|
locale: e,
|
|
989
1033
|
...t
|
|
990
1034
|
});
|
|
991
1035
|
}
|
|
992
|
-
for (let e of
|
|
1036
|
+
for (let e of o) a.has(e) || i.push({
|
|
993
1037
|
op: "removeLocale",
|
|
994
1038
|
locale: e
|
|
995
1039
|
});
|
|
@@ -997,23 +1041,30 @@ function it(e, t) {
|
|
|
997
1041
|
}
|
|
998
1042
|
function $(e) {
|
|
999
1043
|
let t = /* @__PURE__ */ new Map(), n = (e) => {
|
|
1000
|
-
t.set(e.id, e), e.type === "section"
|
|
1044
|
+
t.set(e.id, e), e.type === "section" ? e.children.flat().forEach(n) : e.type === "wrapper" && e.children.forEach(n);
|
|
1001
1045
|
};
|
|
1002
1046
|
return e.forEach(n), t;
|
|
1003
1047
|
}
|
|
1004
|
-
function
|
|
1048
|
+
function ot(e, t) {
|
|
1005
1049
|
if (t === null) return e.blocks;
|
|
1006
|
-
|
|
1007
|
-
|
|
1050
|
+
if ("sectionId" in t) {
|
|
1051
|
+
let n = $(e.blocks).get(t.sectionId);
|
|
1052
|
+
return n?.type === "section" ? n.children[t.column] : [];
|
|
1053
|
+
}
|
|
1054
|
+
let n = $(e.blocks).get(t.wrapperId);
|
|
1055
|
+
return n?.type === "wrapper" ? n.children : [];
|
|
1008
1056
|
}
|
|
1009
|
-
function
|
|
1057
|
+
function st(e, t) {
|
|
1010
1058
|
let n = (e, r) => {
|
|
1011
1059
|
let i = e.findIndex((e) => e.id === t);
|
|
1012
1060
|
if (i >= 0) return {
|
|
1013
1061
|
parent: r,
|
|
1014
1062
|
after: e[i - 1]?.id ?? null
|
|
1015
1063
|
};
|
|
1016
|
-
for (let t of e) if (t.type === "
|
|
1064
|
+
for (let t of e) if (t.type === "wrapper") {
|
|
1065
|
+
let e = n(t.children, { wrapperId: t.id });
|
|
1066
|
+
if (e) return e;
|
|
1067
|
+
} else if (t.type === "section") for (let [e, r] of t.children.entries()) {
|
|
1017
1068
|
let i = n(r, {
|
|
1018
1069
|
sectionId: t.id,
|
|
1019
1070
|
column: e
|
|
@@ -1023,22 +1074,22 @@ function ot(e, t) {
|
|
|
1023
1074
|
};
|
|
1024
1075
|
return n(e.blocks, null);
|
|
1025
1076
|
}
|
|
1026
|
-
function
|
|
1077
|
+
function ct(e, t, n, r, i) {
|
|
1027
1078
|
if (r !== null) return r;
|
|
1028
|
-
let a =
|
|
1079
|
+
let a = ot(t, n).find((e) => e.id !== i), o = ot(e, n).filter((e) => e.id !== i);
|
|
1029
1080
|
return o[(a ? o.findIndex((e) => e.id === a.id) : o.length) - 1]?.id ?? null;
|
|
1030
1081
|
}
|
|
1031
|
-
function
|
|
1082
|
+
function lt(e, t, n) {
|
|
1032
1083
|
Object.keys(n).length ? (e.l10n ??= {})[t] = n : e.l10n && (delete e.l10n[t], Object.keys(e.l10n).length || delete e.l10n);
|
|
1033
1084
|
}
|
|
1034
|
-
function
|
|
1035
|
-
let t =
|
|
1036
|
-
return delete t.l10n, t.type === "section"
|
|
1085
|
+
function ut(e) {
|
|
1086
|
+
let t = R(e);
|
|
1087
|
+
return delete t.l10n, t.type === "section" ? t.children = t.children.map((e) => e.map(ut)) : t.type === "wrapper" && (t.children = t.children.map(ut)), t;
|
|
1037
1088
|
}
|
|
1038
|
-
function
|
|
1039
|
-
let i =
|
|
1089
|
+
function dt(e, t, n, r) {
|
|
1090
|
+
let i = le(e, t), a = R(e), o = R(i.settings), s = !1, c = /* @__PURE__ */ new Map(), l = (n, r) => {
|
|
1040
1091
|
for (let [i, a] of $(n)) c.set(i, {
|
|
1041
|
-
initial:
|
|
1092
|
+
initial: A(a, t, W(e)),
|
|
1042
1093
|
added: r,
|
|
1043
1094
|
changed: !1
|
|
1044
1095
|
});
|
|
@@ -1048,7 +1099,7 @@ function ut(e, t, n, r) {
|
|
|
1048
1099
|
if (t.some((e) => e?.op === "setDefaultLocale")) throw new V("invalid_operation", n, "Changing the default language isn't possible in a language view; switch to the default language.");
|
|
1049
1100
|
if (t.some((e) => e?.op === "setContent")) throw new V("invalid_operation", n, "Replacing the whole template isn't possible in a language view; switch to the default language.");
|
|
1050
1101
|
try {
|
|
1051
|
-
return
|
|
1102
|
+
return K(e, t);
|
|
1052
1103
|
} catch (e) {
|
|
1053
1104
|
throw e instanceof V ? new V(e.code, n, e.message, e.blockId) : e;
|
|
1054
1105
|
}
|
|
@@ -1057,19 +1108,19 @@ function ut(e, t, n, r) {
|
|
|
1057
1108
|
}, p = (e, n) => {
|
|
1058
1109
|
let o = c.get(e);
|
|
1059
1110
|
if (!o?.changed) return;
|
|
1060
|
-
let s = $(a.blocks).get(e), l = $(i.blocks).get(e), u =
|
|
1061
|
-
if (o.added) p =
|
|
1111
|
+
let s = $(a.blocks).get(e), l = $(i.blocks).get(e), u = R(a), d = ot(u, st(u, e).parent), p = R(s);
|
|
1112
|
+
if (o.added) p = ut(l), p.type === "section" && s.type === "section" ? (p.children = s.children, p.columns = s.columns) : p.type === "wrapper" && s.type === "wrapper" && (p.children = s.children);
|
|
1062
1113
|
else {
|
|
1063
1114
|
let e = p.type === "section" ? {
|
|
1064
1115
|
...l,
|
|
1065
1116
|
children: p.children,
|
|
1066
1117
|
columns: p.columns
|
|
1067
1118
|
} : l;
|
|
1068
|
-
|
|
1119
|
+
Oe(p, e, (e) => $(a.blocks).get(e) ?? null), p = ee(p);
|
|
1069
1120
|
let n = p.l10n?.[t];
|
|
1070
|
-
|
|
1121
|
+
lt(p, t, Ae(n, X(p, o.initial, n, r), X(p, l, n, r), p, l));
|
|
1071
1122
|
}
|
|
1072
|
-
d[d.findIndex((t) => t.id === e)] = p, f(
|
|
1123
|
+
d[d.findIndex((t) => t.id === e)] = p, f(at(a, u), n), o.changed = !1;
|
|
1073
1124
|
}, m = (e, t, n) => {
|
|
1074
1125
|
let r = $(a.blocks).get(e.blockId), i = $(t.blocks).get(e.blockId);
|
|
1075
1126
|
if (r.type !== "section" || i.type !== "section" || r.columns === i.columns) return;
|
|
@@ -1088,7 +1139,7 @@ function ut(e, t, n, r) {
|
|
|
1088
1139
|
op: "updateBlock",
|
|
1089
1140
|
blockId: e.blockId,
|
|
1090
1141
|
set: { columns: i.columns },
|
|
1091
|
-
...e.expect ? { expect: Object.fromEntries(Object.keys(e.expect).map((e) => [e,
|
|
1142
|
+
...e.expect ? { expect: Object.fromEntries(Object.keys(e.expect).map((e) => [e, q(u, e) ?? null])) } : {}
|
|
1092
1143
|
}], n);
|
|
1093
1144
|
};
|
|
1094
1145
|
n.forEach((e, t) => {
|
|
@@ -1096,19 +1147,19 @@ function ut(e, t, n, r) {
|
|
|
1096
1147
|
let n = d(i, [e], t);
|
|
1097
1148
|
switch (e.op) {
|
|
1098
1149
|
case "addBlock": {
|
|
1099
|
-
let n =
|
|
1150
|
+
let n = ut(e.block);
|
|
1100
1151
|
f([{
|
|
1101
1152
|
...e,
|
|
1102
1153
|
block: n,
|
|
1103
|
-
after:
|
|
1154
|
+
after: ct(a, i, e.parent, e.after)
|
|
1104
1155
|
}], t), l([n], !0);
|
|
1105
1156
|
break;
|
|
1106
1157
|
}
|
|
1107
1158
|
case "moveBlock":
|
|
1108
1159
|
f([{
|
|
1109
1160
|
...e,
|
|
1110
|
-
after:
|
|
1111
|
-
...e.expect ? { expect:
|
|
1161
|
+
after: ct(a, i, e.parent, e.after, e.blockId),
|
|
1162
|
+
...e.expect ? { expect: st(a, e.blockId) } : {}
|
|
1112
1163
|
}], t);
|
|
1113
1164
|
break;
|
|
1114
1165
|
case "deleteBlock": {
|
|
@@ -1133,18 +1184,18 @@ function ut(e, t, n, r) {
|
|
|
1133
1184
|
});
|
|
1134
1185
|
for (let e of c.keys()) p(e, n.length - 1);
|
|
1135
1186
|
if (s) {
|
|
1136
|
-
let e =
|
|
1137
|
-
|
|
1187
|
+
let e = R(a), r = e.settings.l10n?.[t];
|
|
1188
|
+
lt(e.settings, t, Ae(r, ke(e.settings, o, r), ke(e.settings, i.settings, r), e.settings, i.settings)), f(at(a, e), n.length - 1);
|
|
1138
1189
|
}
|
|
1139
1190
|
return u;
|
|
1140
1191
|
}
|
|
1141
|
-
var
|
|
1192
|
+
var ft = 1e3, pt = 1e4, mt = [
|
|
1142
1193
|
1e3,
|
|
1143
1194
|
2e3,
|
|
1144
1195
|
5e3,
|
|
1145
1196
|
1e4,
|
|
1146
1197
|
3e4
|
|
1147
|
-
],
|
|
1198
|
+
], ht = 50, gt = 100, _t = /* @__PURE__ */ new Set([
|
|
1148
1199
|
"block_exists",
|
|
1149
1200
|
"block_missing",
|
|
1150
1201
|
"anchor_missing",
|
|
@@ -1155,49 +1206,49 @@ var dt = 1e3, ft = 1e4, pt = [
|
|
|
1155
1206
|
"lock_lost",
|
|
1156
1207
|
"content_too_large"
|
|
1157
1208
|
]);
|
|
1158
|
-
function
|
|
1209
|
+
function vt(e, t) {
|
|
1159
1210
|
return e.ops.some((e) => e.op === "setContent") ? e.view = t : delete e.view, e;
|
|
1160
1211
|
}
|
|
1161
|
-
function
|
|
1212
|
+
function yt(e) {
|
|
1162
1213
|
let t = e?.code;
|
|
1163
|
-
return typeof t == "string" &&
|
|
1214
|
+
return typeof t == "string" && _t.has(t) ? t : null;
|
|
1164
1215
|
}
|
|
1165
|
-
function
|
|
1216
|
+
function bt(e) {
|
|
1166
1217
|
let t = e?.holder;
|
|
1167
1218
|
return typeof t == "object" && t && typeof t.sessionId == "string" ? t : void 0;
|
|
1168
1219
|
}
|
|
1169
|
-
function
|
|
1220
|
+
function xt(e) {
|
|
1170
1221
|
let t = e?.statusCode;
|
|
1171
1222
|
return typeof t != "number" || t >= 500 || t === 408 || t === 429;
|
|
1172
1223
|
}
|
|
1173
|
-
function
|
|
1224
|
+
function St(e, t) {
|
|
1174
1225
|
return e.some((e) => {
|
|
1175
1226
|
if (e.id === t) return !0;
|
|
1176
1227
|
let n = e.children;
|
|
1177
|
-
return e.type === "section" && Array.isArray(n) && n.some((e) => Array.isArray(e) &&
|
|
1228
|
+
return e.type === "wrapper" && Array.isArray(n) && St(n, t) || e.type === "section" && Array.isArray(n) && n.some((e) => Array.isArray(e) && St(e, t));
|
|
1178
1229
|
});
|
|
1179
1230
|
}
|
|
1180
|
-
function
|
|
1231
|
+
function Ct(e) {
|
|
1181
1232
|
if (e.length === 1 && e[0].op === "updateSettings") return !0;
|
|
1182
1233
|
let t = e[0];
|
|
1183
1234
|
return t.op === "updateBlock" && e.every((e) => e.op === "updateBlock" && e.blockId === t.blockId) || t.op === "updateBlockLocale" && e.every((e) => e.op === "updateBlockLocale" && e.blockId === t.blockId && e.locale === t.locale);
|
|
1184
1235
|
}
|
|
1185
|
-
function
|
|
1236
|
+
function wt(e) {
|
|
1186
1237
|
return e.map((e) => {
|
|
1187
1238
|
if (!("expect" in e)) return e;
|
|
1188
1239
|
let { expect: t, ...n } = e;
|
|
1189
1240
|
return n;
|
|
1190
1241
|
});
|
|
1191
1242
|
}
|
|
1192
|
-
function
|
|
1193
|
-
let { provider: t } = e, n = e.sessionId ?? crypto.randomUUID(), i = e.maxUndo ??
|
|
1243
|
+
function Tt(e) {
|
|
1244
|
+
let { provider: t } = e, n = e.sessionId ?? crypto.randomUUID(), i = e.maxUndo ?? ht, a = typeof t.acquireLock == "function" && typeof t.renewLock == "function" && typeof t.releaseLock == "function", o = y([]), s = y(/* @__PURE__ */ new Map()), c = /* @__PURE__ */ new WeakSet(), u = /* @__PURE__ */ new WeakMap(), d = 0, f = p(null), m = p(null), h = p(0), g = p(0), _ = null, b = null, S = !1, C = !1, w = !1, T = !1, E = null, D = 0, O = !1, k = [], A = null, j = null, ee = Promise.resolve(), M = null, N = r(() => (g.value, (b?.undo.length ?? 0) > 0)), te = r(() => (g.value, (b?.redo.length ?? 0) > 0));
|
|
1194
1245
|
function P(t) {
|
|
1195
1246
|
e.onError?.(t instanceof Error ? t : Error(String(t)));
|
|
1196
1247
|
}
|
|
1197
1248
|
function F(t, n = b) {
|
|
1198
|
-
n !== b ||
|
|
1249
|
+
n !== b || O || e.onNotice?.(t);
|
|
1199
1250
|
}
|
|
1200
|
-
function
|
|
1251
|
+
function ne() {
|
|
1201
1252
|
return {
|
|
1202
1253
|
locks: [...s.value.values()].map((e) => ({
|
|
1203
1254
|
blockId: e.blockId,
|
|
@@ -1207,62 +1258,62 @@ function wt(e) {
|
|
|
1207
1258
|
session: n
|
|
1208
1259
|
};
|
|
1209
1260
|
}
|
|
1210
|
-
function
|
|
1261
|
+
function I() {
|
|
1211
1262
|
g.value++;
|
|
1212
1263
|
}
|
|
1213
|
-
function
|
|
1264
|
+
function L(e, t) {
|
|
1214
1265
|
e.push(t), e.length > i && e.splice(0, e.length - i);
|
|
1215
1266
|
}
|
|
1216
1267
|
function z(e) {
|
|
1217
1268
|
if (!_ || S) return;
|
|
1218
1269
|
C = !0;
|
|
1219
1270
|
try {
|
|
1220
|
-
let t = _.content.value, n =
|
|
1271
|
+
let t = _.content.value, n = at(t, e);
|
|
1221
1272
|
if (n.length > 0) try {
|
|
1222
|
-
|
|
1273
|
+
re(t, n);
|
|
1223
1274
|
} catch {
|
|
1224
|
-
_.setContent(
|
|
1275
|
+
_.setContent(R(e), !1);
|
|
1225
1276
|
}
|
|
1226
|
-
|
|
1277
|
+
B(_.content.value, e) || _.setContent(R(e), !1);
|
|
1227
1278
|
} finally {
|
|
1228
1279
|
C = !1;
|
|
1229
1280
|
}
|
|
1230
1281
|
let t = _.state.selectedBlockId;
|
|
1231
|
-
t && !
|
|
1282
|
+
t && !St(e.blocks, t) && _.selectBlock(null);
|
|
1232
1283
|
}
|
|
1233
1284
|
function ie() {
|
|
1234
1285
|
C || T || (T = !0, queueMicrotask(() => {
|
|
1235
|
-
T = !1,
|
|
1286
|
+
T = !1, oe(!1);
|
|
1236
1287
|
}));
|
|
1237
1288
|
}
|
|
1238
|
-
function
|
|
1239
|
-
|
|
1289
|
+
function ae() {
|
|
1290
|
+
E &&= (clearTimeout(E), null);
|
|
1240
1291
|
}
|
|
1241
|
-
function
|
|
1292
|
+
function oe(e, t = !1) {
|
|
1242
1293
|
let n = b;
|
|
1243
1294
|
if (!_ || !n || S || C || _.state.isLoading && !t || _.state.template?.id !== n.templateId) return;
|
|
1244
|
-
let r =
|
|
1245
|
-
if (r.length === 0)
|
|
1295
|
+
let r = at(n.view, _.content.value);
|
|
1296
|
+
if (r.length === 0) ae();
|
|
1246
1297
|
else {
|
|
1247
|
-
if (!e &&
|
|
1298
|
+
if (!e && Ct(r)) {
|
|
1248
1299
|
let e = Date.now();
|
|
1249
|
-
if (
|
|
1250
|
-
|
|
1251
|
-
|
|
1300
|
+
if (E === null && (D = e), e - D < 1e3) {
|
|
1301
|
+
E && clearTimeout(E), E = setTimeout(() => {
|
|
1302
|
+
E = null, oe(!0);
|
|
1252
1303
|
}, 300);
|
|
1253
1304
|
return;
|
|
1254
1305
|
}
|
|
1255
1306
|
}
|
|
1256
|
-
|
|
1307
|
+
ae(), se(n, r);
|
|
1257
1308
|
}
|
|
1258
1309
|
}
|
|
1259
|
-
function
|
|
1260
|
-
|
|
1310
|
+
function H() {
|
|
1311
|
+
oe(!0);
|
|
1261
1312
|
}
|
|
1262
|
-
function
|
|
1313
|
+
function se(e, t) {
|
|
1263
1314
|
let n = t, r;
|
|
1264
1315
|
try {
|
|
1265
|
-
r =
|
|
1316
|
+
r = K(e.view, n, ne());
|
|
1266
1317
|
} catch (n) {
|
|
1267
1318
|
if (!(n instanceof V)) throw n;
|
|
1268
1319
|
z(e.view);
|
|
@@ -1278,13 +1329,13 @@ function wt(e) {
|
|
|
1278
1329
|
return;
|
|
1279
1330
|
}
|
|
1280
1331
|
let i = _.content.value;
|
|
1281
|
-
if (!
|
|
1332
|
+
if (!B(r, i)) {
|
|
1282
1333
|
P(/* @__PURE__ */ Error("[Templatical] Collaboration: a change couldn't be expressed as block operations, so the whole content was sent.")), n = [{
|
|
1283
1334
|
op: "setContent",
|
|
1284
|
-
content:
|
|
1335
|
+
content: R(i)
|
|
1285
1336
|
}];
|
|
1286
1337
|
try {
|
|
1287
|
-
r =
|
|
1338
|
+
r = K(e.view, n, ne());
|
|
1288
1339
|
} catch (t) {
|
|
1289
1340
|
if (!(t instanceof V)) throw t;
|
|
1290
1341
|
z(e.view), F({
|
|
@@ -1294,15 +1345,15 @@ function wt(e) {
|
|
|
1294
1345
|
return;
|
|
1295
1346
|
}
|
|
1296
1347
|
}
|
|
1297
|
-
let a =
|
|
1298
|
-
|
|
1348
|
+
let a = vt({ ops: pe(e.view, n) }, r);
|
|
1349
|
+
L(e.undo, a), e.redo = [], I();
|
|
1299
1350
|
let o = e.view;
|
|
1300
|
-
e.view = r,
|
|
1351
|
+
e.view = r, ce(e, n, "edit", a, o);
|
|
1301
1352
|
}
|
|
1302
|
-
function
|
|
1353
|
+
function ce(e, t, n, r, i) {
|
|
1303
1354
|
let a = { dropped: !1 }, o = 0, s = i;
|
|
1304
1355
|
do {
|
|
1305
|
-
let i = t.slice(o, o +
|
|
1356
|
+
let i = t.slice(o, o + gt);
|
|
1306
1357
|
if (e.pending.push({
|
|
1307
1358
|
batchId: crypto.randomUUID(),
|
|
1308
1359
|
ops: i,
|
|
@@ -1312,62 +1363,62 @@ function wt(e) {
|
|
|
1312
1363
|
sent: !1,
|
|
1313
1364
|
revision: null,
|
|
1314
1365
|
...s && i.some((e) => e.op === "setContent") ? { base: s } : {}
|
|
1315
|
-
}), o +=
|
|
1316
|
-
s =
|
|
1366
|
+
}), o += gt, s && t.slice(o).some((e) => e.op === "setContent")) try {
|
|
1367
|
+
s = K(s, i);
|
|
1317
1368
|
} catch {
|
|
1318
1369
|
s = null;
|
|
1319
1370
|
}
|
|
1320
1371
|
} while (o < t.length);
|
|
1321
|
-
|
|
1372
|
+
U(e);
|
|
1322
1373
|
}
|
|
1323
|
-
function
|
|
1374
|
+
function U(e) {
|
|
1324
1375
|
if (e.inFlight || w) return;
|
|
1325
1376
|
let t = e.pending.find((e) => !e.sent);
|
|
1326
|
-
t ? (t.sent = !0, e.inFlight = t,
|
|
1377
|
+
t ? (t.sent = !0, e.inFlight = t, le(e, t, 0)) : q(e);
|
|
1327
1378
|
}
|
|
1328
|
-
function
|
|
1379
|
+
function le(e, n, r) {
|
|
1329
1380
|
t.submit(e.templateId, {
|
|
1330
1381
|
batchId: n.batchId,
|
|
1331
1382
|
baseRevision: n.baseRevision ??= e.revision,
|
|
1332
1383
|
ops: n.ops,
|
|
1333
1384
|
...n.origin === "ai" ? { origin: "ai" } : {}
|
|
1334
1385
|
}).then(({ revision: t }) => {
|
|
1335
|
-
e.inFlight = null,
|
|
1386
|
+
e.inFlight = null, W(e, n, t), U(e);
|
|
1336
1387
|
}, (t) => {
|
|
1337
|
-
if (
|
|
1338
|
-
else if (
|
|
1388
|
+
if (yt(t) !== null) e.inFlight = null, G(e, n, t), U(e);
|
|
1389
|
+
else if (xt(t)) {
|
|
1339
1390
|
J(e, t);
|
|
1340
|
-
let i =
|
|
1391
|
+
let i = mt[Math.min(r, mt.length - 1)];
|
|
1341
1392
|
setTimeout(() => {
|
|
1342
|
-
|
|
1393
|
+
O || le(e, n, r + 1);
|
|
1343
1394
|
}, i);
|
|
1344
|
-
} else e.inFlight = null, P(t),
|
|
1395
|
+
} else e.inFlight = null, P(t), G(e, n, t), U(e);
|
|
1345
1396
|
});
|
|
1346
1397
|
}
|
|
1347
|
-
function
|
|
1348
|
-
t.revision === null && (t.revision = n, n <= e.revision ? (
|
|
1398
|
+
function W(e, t, n) {
|
|
1399
|
+
t.revision === null && (t.revision = n, n <= e.revision ? (ue(e, t), _e(e)) : (e.own.set(n, t), ge(e)));
|
|
1349
1400
|
}
|
|
1350
|
-
function
|
|
1401
|
+
function ue(e, t) {
|
|
1351
1402
|
e.pending = e.pending.filter((e) => e !== t), q(e);
|
|
1352
1403
|
}
|
|
1353
|
-
function
|
|
1404
|
+
function de(e, t) {
|
|
1354
1405
|
if (t.entry) {
|
|
1355
1406
|
for (let n of [e.undo, e.redo]) {
|
|
1356
1407
|
let e = n.indexOf(t.entry);
|
|
1357
1408
|
e !== -1 && n.splice(e, 1);
|
|
1358
1409
|
}
|
|
1359
|
-
|
|
1410
|
+
I();
|
|
1360
1411
|
}
|
|
1361
1412
|
}
|
|
1362
1413
|
function fe(e, t) {
|
|
1363
1414
|
let n = !t.group.dropped;
|
|
1364
|
-
return t.group.dropped = !0, e.pending = e.pending.filter((e) => e.group !== t.group || e.sent), n &&
|
|
1415
|
+
return t.group.dropped = !0, e.pending = e.pending.filter((e) => e.group !== t.group || e.sent), n && de(e, t), q(e), n;
|
|
1365
1416
|
}
|
|
1366
|
-
function
|
|
1367
|
-
if (
|
|
1368
|
-
let r =
|
|
1417
|
+
function G(e, t, n) {
|
|
1418
|
+
if (ue(e, t), fe(e, t)) {
|
|
1419
|
+
let r = yt(n) ?? "invalid_operation";
|
|
1369
1420
|
if (t.origin === "edit" || t.origin === "ai") {
|
|
1370
|
-
let t =
|
|
1421
|
+
let t = bt(n);
|
|
1371
1422
|
F({
|
|
1372
1423
|
type: "editRefused",
|
|
1373
1424
|
code: r,
|
|
@@ -1378,7 +1429,7 @@ function wt(e) {
|
|
|
1378
1429
|
code: r
|
|
1379
1430
|
}, e);
|
|
1380
1431
|
}
|
|
1381
|
-
_e(e), e === b &&
|
|
1432
|
+
_e(e), e === b && xe();
|
|
1382
1433
|
}
|
|
1383
1434
|
function q(e) {
|
|
1384
1435
|
if (!(e.pending.length > 0 || e.waiters.length === 0)) for (let t of e.waiters.splice(0)) t.resolve();
|
|
@@ -1390,7 +1441,7 @@ function wt(e) {
|
|
|
1390
1441
|
function me(e, t) {
|
|
1391
1442
|
if (t.revision <= e.revision) return;
|
|
1392
1443
|
let n = e.pending.find((e) => e.batchId === t.batchId);
|
|
1393
|
-
n ?
|
|
1444
|
+
n ? W(e, n, t.revision) : (e.remote.set(t.revision, t), ge(e));
|
|
1394
1445
|
}
|
|
1395
1446
|
function he(t, n) {
|
|
1396
1447
|
let r = n.ops;
|
|
@@ -1399,7 +1450,7 @@ function wt(e) {
|
|
|
1399
1450
|
} catch (e) {
|
|
1400
1451
|
P(e);
|
|
1401
1452
|
}
|
|
1402
|
-
return
|
|
1453
|
+
return wt(r);
|
|
1403
1454
|
}
|
|
1404
1455
|
function ge(t) {
|
|
1405
1456
|
let n = [], r = !1;
|
|
@@ -1407,16 +1458,16 @@ function wt(e) {
|
|
|
1407
1458
|
let e = t.revision + 1, i = t.remote.get(e), a = t.own.get(e);
|
|
1408
1459
|
if (!i && !a) break;
|
|
1409
1460
|
try {
|
|
1410
|
-
t.confirmed =
|
|
1461
|
+
t.confirmed = K(t.confirmed, i ? he(t, i) : a.ops);
|
|
1411
1462
|
} catch {
|
|
1412
1463
|
if (t.recovering) {
|
|
1413
1464
|
t.remote.clear(), t.own.clear(), P(/* @__PURE__ */ Error("[Templatical] Collaboration: this editor can't follow the template's changes. Reload the page."));
|
|
1414
1465
|
return;
|
|
1415
1466
|
}
|
|
1416
|
-
|
|
1467
|
+
Se(t);
|
|
1417
1468
|
return;
|
|
1418
1469
|
}
|
|
1419
|
-
t.revision = e, i ? (t.remote.delete(e), n.push(i)) : (t.own.delete(e), a.group.dropped && (r = !0),
|
|
1470
|
+
t.revision = e, i ? (t.remote.delete(e), n.push(i)) : (t.own.delete(e), a.group.dropped && (r = !0), ue(t, a));
|
|
1420
1471
|
}
|
|
1421
1472
|
if (t === b && (h.value = t.revision), t.remote.size > 0 || t.own.size > 0 ? ye(t) : be(t), (n.length !== 0 || r) && (_e(t), t === b)) for (let t of n) try {
|
|
1422
1473
|
e.onRemoteChange?.({
|
|
@@ -1436,16 +1487,16 @@ function wt(e) {
|
|
|
1436
1487
|
} finally {
|
|
1437
1488
|
t && (w = !1);
|
|
1438
1489
|
}
|
|
1439
|
-
t &&
|
|
1490
|
+
t && U(e);
|
|
1440
1491
|
}
|
|
1441
1492
|
function ve(e) {
|
|
1442
|
-
e === b &&
|
|
1493
|
+
e === b && H();
|
|
1443
1494
|
let t = e.confirmed;
|
|
1444
1495
|
for (let n = 0; n < e.pending.length; n++) {
|
|
1445
1496
|
let r = e.pending[n], i;
|
|
1446
|
-
if (r.base && !
|
|
1497
|
+
if (r.base && !B(r.base, t)) i = "precondition_failed";
|
|
1447
1498
|
else try {
|
|
1448
|
-
t =
|
|
1499
|
+
t = K(t, r.ops);
|
|
1449
1500
|
continue;
|
|
1450
1501
|
} catch (e) {
|
|
1451
1502
|
i = e instanceof V ? e.code : "invalid_operation";
|
|
@@ -1462,20 +1513,20 @@ function wt(e) {
|
|
|
1462
1513
|
}
|
|
1463
1514
|
function ye(e) {
|
|
1464
1515
|
e.gapTimer ||= setTimeout(() => {
|
|
1465
|
-
e.gapTimer = null, e === b &&
|
|
1466
|
-
},
|
|
1516
|
+
e.gapTimer = null, e === b && xe();
|
|
1517
|
+
}, ft);
|
|
1467
1518
|
}
|
|
1468
1519
|
function be(e) {
|
|
1469
1520
|
e.gapTimer &&= (clearTimeout(e.gapTimer), null);
|
|
1470
1521
|
}
|
|
1471
|
-
function
|
|
1522
|
+
function xe() {
|
|
1472
1523
|
let e = b;
|
|
1473
1524
|
return e ? (e.catchingUp ||= (async () => {
|
|
1474
1525
|
try {
|
|
1475
1526
|
let n = await t.operationsAfter(e.templateId, e.revision);
|
|
1476
1527
|
if (e.retired) return;
|
|
1477
1528
|
if ("resync" in n) {
|
|
1478
|
-
await
|
|
1529
|
+
await Se(e);
|
|
1479
1530
|
return;
|
|
1480
1531
|
}
|
|
1481
1532
|
for (let t of n.batches) me(e, t);
|
|
@@ -1486,14 +1537,14 @@ function wt(e) {
|
|
|
1486
1537
|
}
|
|
1487
1538
|
})(), e.catchingUp) : Promise.resolve();
|
|
1488
1539
|
}
|
|
1489
|
-
async function
|
|
1540
|
+
async function Se(t) {
|
|
1490
1541
|
t.recovering = !0;
|
|
1491
1542
|
try {
|
|
1492
1543
|
let n = await e.loadTemplate(t.templateId);
|
|
1493
1544
|
if (t.retired) return;
|
|
1494
1545
|
let r = n.revision ?? t.revision;
|
|
1495
|
-
t.confirmed =
|
|
1496
|
-
for (let [e, n] of [...t.own]) e <= r && (t.own.delete(e),
|
|
1546
|
+
t.confirmed = R(n.content), t.revision = r, t.remote = new Map([...t.remote].filter(([e]) => e > r));
|
|
1547
|
+
for (let [e, n] of [...t.own]) e <= r && (t.own.delete(e), ue(t, n));
|
|
1497
1548
|
t === b && (h.value = r), _e(t), ge(t);
|
|
1498
1549
|
} catch (e) {
|
|
1499
1550
|
P(e);
|
|
@@ -1501,7 +1552,7 @@ function wt(e) {
|
|
|
1501
1552
|
t.recovering = !1;
|
|
1502
1553
|
}
|
|
1503
1554
|
}
|
|
1504
|
-
function
|
|
1555
|
+
function Ce(t) {
|
|
1505
1556
|
let n = () => t === b && !t.retired;
|
|
1506
1557
|
return {
|
|
1507
1558
|
onBatch: (e) => {
|
|
@@ -1517,7 +1568,7 @@ function wt(e) {
|
|
|
1517
1568
|
} catch (e) {
|
|
1518
1569
|
P(e);
|
|
1519
1570
|
}
|
|
1520
|
-
|
|
1571
|
+
xe();
|
|
1521
1572
|
}
|
|
1522
1573
|
},
|
|
1523
1574
|
onLock: (e) => {
|
|
@@ -1527,26 +1578,26 @@ function wt(e) {
|
|
|
1527
1578
|
n() && Me(e, t, r);
|
|
1528
1579
|
},
|
|
1529
1580
|
onMembers: (e) => {
|
|
1530
|
-
n() &&
|
|
1581
|
+
n() && Pe(e);
|
|
1531
1582
|
},
|
|
1532
1583
|
onConnectionChange: (e) => {
|
|
1533
|
-
n() &&
|
|
1584
|
+
n() && Ee(t, e);
|
|
1534
1585
|
}
|
|
1535
1586
|
};
|
|
1536
1587
|
}
|
|
1537
|
-
function
|
|
1588
|
+
function Y(e, r) {
|
|
1538
1589
|
let i = d;
|
|
1539
|
-
t.join(e.templateId, { sessionId: n },
|
|
1540
|
-
e.retired || e !== b ? r || t.leave() : (e.leave = t.leave, Ne(t.locks, !r, i),
|
|
1590
|
+
t.join(e.templateId, { sessionId: n }, Ce(e)).then((t) => {
|
|
1591
|
+
e.retired || e !== b ? r || t.leave() : (e.leave = t.leave, Ne(t.locks, !r, i), Pe(t.members), t.members.length > 0 && (m.value = "connected"), t.revision > e.revision && xe(), r && Q());
|
|
1541
1592
|
}, (e) => P(e));
|
|
1542
1593
|
}
|
|
1543
|
-
function
|
|
1544
|
-
let t =
|
|
1594
|
+
function we(e) {
|
|
1595
|
+
let t = R(e.content), n = {
|
|
1545
1596
|
templateId: e.id,
|
|
1546
1597
|
confirmed: t,
|
|
1547
1598
|
revision: e.revision ?? 0,
|
|
1548
1599
|
pending: [],
|
|
1549
|
-
view:
|
|
1600
|
+
view: R(t),
|
|
1550
1601
|
remote: /* @__PURE__ */ new Map(),
|
|
1551
1602
|
own: /* @__PURE__ */ new Map(),
|
|
1552
1603
|
inFlight: null,
|
|
@@ -1559,19 +1610,19 @@ function wt(e) {
|
|
|
1559
1610
|
redo: [],
|
|
1560
1611
|
waiters: []
|
|
1561
1612
|
};
|
|
1562
|
-
b = n, h.value = n.revision,
|
|
1613
|
+
b = n, h.value = n.revision, I(), Y(n, !1), _?.state.selectedBlockId && ze(_.state.selectedBlockId), ie();
|
|
1563
1614
|
}
|
|
1564
|
-
function
|
|
1615
|
+
function Te(e) {
|
|
1565
1616
|
e.retired = !0, be(e), e.leave?.(), e.leave = null, J(e, /* @__PURE__ */ Error("[Templatical] The template was closed."));
|
|
1566
1617
|
}
|
|
1567
|
-
function
|
|
1618
|
+
function Ee(e, t) {
|
|
1568
1619
|
let n = m.value;
|
|
1569
|
-
m.value = t, t === "connected" && n !== null && n !== "connected" &&
|
|
1620
|
+
m.value = t, t === "connected" && n !== null && n !== "connected" && Y(e, !0);
|
|
1570
1621
|
}
|
|
1571
|
-
function
|
|
1572
|
-
b && b.templateId === e?.id || (b &&= (
|
|
1622
|
+
function De(e) {
|
|
1623
|
+
b && b.templateId === e?.id || (b &&= (ae(), Te(b), null), o.value = [], s.value = /* @__PURE__ */ new Map(), m.value = null, A = null, Q(), I(), e && we(e));
|
|
1573
1624
|
}
|
|
1574
|
-
function
|
|
1625
|
+
function X(e, t) {
|
|
1575
1626
|
return `${e}\u0000${t ?? ""}`;
|
|
1576
1627
|
}
|
|
1577
1628
|
function Oe(e, t, n) {
|
|
@@ -1581,55 +1632,55 @@ function wt(e) {
|
|
|
1581
1632
|
return [...s.value.values()].filter((t) => t.blockId === e);
|
|
1582
1633
|
}
|
|
1583
1634
|
function Ae(e) {
|
|
1584
|
-
e !== f.value && (
|
|
1635
|
+
e !== f.value && (H(), f.value = e, ze(_?.state.selectedBlockId ?? null));
|
|
1585
1636
|
}
|
|
1586
1637
|
function je(e, t = !1) {
|
|
1587
1638
|
if (e.holder.sessionId === n) return;
|
|
1588
1639
|
t ? c.add(e) : u.set(e, ++d);
|
|
1589
1640
|
let r = new Map([...s.value].filter(([, t]) => t.holder.sessionId !== e.holder.sessionId));
|
|
1590
|
-
r.set(
|
|
1641
|
+
r.set(X(e.blockId, e.locale), e), s.value = r, _?.state.selectedBlockId === e.blockId && (f.value === null || e.locale == null || e.locale === f.value) && (_.selectBlock(null), F({
|
|
1591
1642
|
type: "selectionRefused",
|
|
1592
1643
|
blockId: e.blockId,
|
|
1593
1644
|
holder: e.holder
|
|
1594
1645
|
}));
|
|
1595
1646
|
}
|
|
1596
1647
|
function Me(e, t, n) {
|
|
1597
|
-
let r =
|
|
1648
|
+
let r = X(e, n), i = new Map([...s.value].filter(([n, i]) => i.holder.sessionId !== t || n !== r && !(i.blockId === e && c.has(i))));
|
|
1598
1649
|
i.size !== s.value.size && (s.value = i);
|
|
1599
1650
|
}
|
|
1600
1651
|
function Ne(e, t, r) {
|
|
1601
1652
|
let i = new Map([...s.value].filter(([, e]) => !c.has(e) && (t || (u.get(e) ?? 0) > r))), a = [...i.values()];
|
|
1602
1653
|
for (let t of e) if (t.holder.sessionId !== n && !a.some((e) => e.holder.sessionId === t.holder.sessionId || Oe(e, t.blockId, t.locale))) {
|
|
1603
1654
|
for (let [e, n] of i) n.holder.sessionId === t.holder.sessionId && i.delete(e);
|
|
1604
|
-
i.set(
|
|
1655
|
+
i.set(X(t.blockId, t.locale), t);
|
|
1605
1656
|
}
|
|
1606
1657
|
s.value = i;
|
|
1607
1658
|
}
|
|
1608
|
-
function
|
|
1659
|
+
function Pe(e) {
|
|
1609
1660
|
let t = new Set(e.map((e) => e.sessionId)), n = new Set(o.value.map((e) => e.sessionId).filter((e) => !t.has(e)));
|
|
1610
1661
|
if (o.value = e, n.size === 0) return;
|
|
1611
1662
|
let r = new Map([...s.value].filter(([, e]) => !n.has(e.holder.sessionId)));
|
|
1612
1663
|
r.size !== s.value.size && (s.value = r);
|
|
1613
1664
|
}
|
|
1614
|
-
function
|
|
1665
|
+
function Z(e) {
|
|
1615
1666
|
ee = ee.then(e).catch(P);
|
|
1616
1667
|
}
|
|
1617
|
-
function
|
|
1618
|
-
a &&
|
|
1619
|
-
if (
|
|
1620
|
-
let e =
|
|
1621
|
-
|
|
1668
|
+
function Q() {
|
|
1669
|
+
a && Z(async () => {
|
|
1670
|
+
if (j && (A === null || j.templateId !== A.templateId || j.locale !== A.locale)) {
|
|
1671
|
+
let e = j;
|
|
1672
|
+
j = null, Re(), await t.releaseLock(e.templateId, e.blockId, e.locale);
|
|
1622
1673
|
}
|
|
1623
|
-
let e =
|
|
1624
|
-
if (!(!e ||
|
|
1674
|
+
let e = A;
|
|
1675
|
+
if (!(!e || j?.templateId === e.templateId && j.blockId === e.blockId && j.locale === e.locale)) try {
|
|
1625
1676
|
let n = await t.acquireLock(e.templateId, e.blockId, e.locale);
|
|
1626
|
-
|
|
1677
|
+
j = e, Le(), Fe(n.blockId, n.locale ?? null);
|
|
1627
1678
|
} catch (n) {
|
|
1628
|
-
if (
|
|
1629
|
-
let e =
|
|
1630
|
-
|
|
1679
|
+
if (j?.templateId === e.templateId) {
|
|
1680
|
+
let e = j;
|
|
1681
|
+
j = null, Re(), await t.releaseLock(e.templateId, e.blockId, e.locale).catch(() => {});
|
|
1631
1682
|
}
|
|
1632
|
-
if (
|
|
1683
|
+
if (A !== e) return;
|
|
1633
1684
|
Ie(e.blockId, n);
|
|
1634
1685
|
}
|
|
1635
1686
|
});
|
|
@@ -1639,55 +1690,55 @@ function wt(e) {
|
|
|
1639
1690
|
n.size !== s.value.size && (s.value = n);
|
|
1640
1691
|
}
|
|
1641
1692
|
function Ie(e, t) {
|
|
1642
|
-
let n =
|
|
1693
|
+
let n = yt(t);
|
|
1643
1694
|
if (n === "lock_held" || n === "block_missing") {
|
|
1644
|
-
|
|
1645
|
-
let n =
|
|
1695
|
+
A = null;
|
|
1696
|
+
let n = bt(t);
|
|
1646
1697
|
n ? je({
|
|
1647
1698
|
blockId: e,
|
|
1648
1699
|
holder: n,
|
|
1649
1700
|
expiresAt: ""
|
|
1650
1701
|
}, !0) : _?.state.selectedBlockId === e && _.selectBlock(null);
|
|
1651
1702
|
} else P(t), setTimeout(() => {
|
|
1652
|
-
|
|
1653
|
-
},
|
|
1703
|
+
A?.blockId === e && Q();
|
|
1704
|
+
}, mt[0]);
|
|
1654
1705
|
}
|
|
1655
1706
|
function Le() {
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
let e =
|
|
1707
|
+
M ||= setInterval(() => {
|
|
1708
|
+
Z(async () => {
|
|
1709
|
+
let e = j;
|
|
1659
1710
|
if (e) try {
|
|
1660
1711
|
await t.renewLock(e.templateId, e.blockId, e.locale);
|
|
1661
1712
|
} catch (e) {
|
|
1662
|
-
if (
|
|
1663
|
-
|
|
1713
|
+
if (yt(e) === "lock_lost") {
|
|
1714
|
+
j = null, Re(), Q();
|
|
1664
1715
|
return;
|
|
1665
1716
|
}
|
|
1666
1717
|
P(e);
|
|
1667
1718
|
}
|
|
1668
1719
|
});
|
|
1669
|
-
},
|
|
1720
|
+
}, pt);
|
|
1670
1721
|
}
|
|
1671
1722
|
function Re() {
|
|
1672
|
-
|
|
1723
|
+
M &&= (clearInterval(M), null);
|
|
1673
1724
|
}
|
|
1674
1725
|
function ze(e) {
|
|
1675
|
-
|
|
1726
|
+
H(), b && (A = e ? {
|
|
1676
1727
|
templateId: b.templateId,
|
|
1677
1728
|
blockId: e,
|
|
1678
1729
|
locale: f.value
|
|
1679
|
-
} : null,
|
|
1730
|
+
} : null, Q());
|
|
1680
1731
|
}
|
|
1681
1732
|
function Be() {
|
|
1682
|
-
|
|
1733
|
+
H(), j && a && (t.releaseLock(j.templateId, j.blockId, j.locale).catch(() => {}), j = null, Re()), b?.leave?.(), b && (b.leave = null);
|
|
1683
1734
|
}
|
|
1684
1735
|
function Ve(e) {
|
|
1685
1736
|
let t = b;
|
|
1686
1737
|
if (!t || S) return;
|
|
1687
|
-
|
|
1738
|
+
H();
|
|
1688
1739
|
let n = (e === "undo" ? t.undo : t.redo).pop();
|
|
1689
1740
|
if (!n) return;
|
|
1690
|
-
if (
|
|
1741
|
+
if (I(), n.view && !B(n.view, t.view)) {
|
|
1691
1742
|
F({
|
|
1692
1743
|
type: "undoSkipped",
|
|
1693
1744
|
code: "precondition_failed"
|
|
@@ -1696,7 +1747,7 @@ function wt(e) {
|
|
|
1696
1747
|
}
|
|
1697
1748
|
let r;
|
|
1698
1749
|
try {
|
|
1699
|
-
r =
|
|
1750
|
+
r = K(t.view, n.ops, ne());
|
|
1700
1751
|
} catch (e) {
|
|
1701
1752
|
if (!(e instanceof V)) throw e;
|
|
1702
1753
|
F({
|
|
@@ -1705,10 +1756,10 @@ function wt(e) {
|
|
|
1705
1756
|
});
|
|
1706
1757
|
return;
|
|
1707
1758
|
}
|
|
1708
|
-
let i =
|
|
1709
|
-
|
|
1759
|
+
let i = vt({ ops: pe(t.view, n.ops) }, r);
|
|
1760
|
+
L(e === "undo" ? t.redo : t.undo, i);
|
|
1710
1761
|
let a = t.view;
|
|
1711
|
-
t.view = r, z(r), _?.markDirty(),
|
|
1762
|
+
t.view = r, z(r), _?.markDirty(), ce(t, n.ops, e, i, a);
|
|
1712
1763
|
}
|
|
1713
1764
|
function He(e, t) {
|
|
1714
1765
|
let n = b;
|
|
@@ -1717,7 +1768,7 @@ function wt(e) {
|
|
|
1717
1768
|
error: new V("invalid_operation", 0, "No template is open for editing.")
|
|
1718
1769
|
};
|
|
1719
1770
|
if (t.origin === void 0) try {
|
|
1720
|
-
|
|
1771
|
+
K(_.content.value, e, ne());
|
|
1721
1772
|
} catch (e) {
|
|
1722
1773
|
if (e instanceof V) return {
|
|
1723
1774
|
applied: !1,
|
|
@@ -1725,10 +1776,10 @@ function wt(e) {
|
|
|
1725
1776
|
};
|
|
1726
1777
|
throw e;
|
|
1727
1778
|
}
|
|
1728
|
-
|
|
1779
|
+
H();
|
|
1729
1780
|
let r, i;
|
|
1730
1781
|
try {
|
|
1731
|
-
r =
|
|
1782
|
+
r = K(n.view, e, ne()), i = pe(n.view, e);
|
|
1732
1783
|
} catch (e) {
|
|
1733
1784
|
if (e instanceof V) return {
|
|
1734
1785
|
applied: !1,
|
|
@@ -1738,15 +1789,15 @@ function wt(e) {
|
|
|
1738
1789
|
}
|
|
1739
1790
|
let a = n.undo.at(-1), o;
|
|
1740
1791
|
if (t.origin === "ai" && t.turn !== void 0 && a && a.turn === t.turn) {
|
|
1741
|
-
let e = a.view !== void 0 && !
|
|
1742
|
-
a.ops = [...i, ...a.ops], o = e ? a :
|
|
1743
|
-
} else o =
|
|
1792
|
+
let e = a.view !== void 0 && !B(a.view, n.view);
|
|
1793
|
+
a.ops = [...i, ...a.ops], o = e ? a : vt(a, r);
|
|
1794
|
+
} else o = vt({
|
|
1744
1795
|
ops: i,
|
|
1745
1796
|
...t.origin === "ai" && t.turn !== void 0 ? { turn: t.turn } : {}
|
|
1746
|
-
}, r),
|
|
1747
|
-
n.redo = [],
|
|
1797
|
+
}, r), L(n.undo, o);
|
|
1798
|
+
n.redo = [], I();
|
|
1748
1799
|
let s = n.view;
|
|
1749
|
-
return n.view = r, z(r), _.markDirty(),
|
|
1800
|
+
return n.view = r, z(r), _.markDirty(), ce(n, e, t.origin ?? "edit", o, s), {
|
|
1750
1801
|
applied: !0,
|
|
1751
1802
|
inverse: i
|
|
1752
1803
|
};
|
|
@@ -1757,28 +1808,28 @@ function wt(e) {
|
|
|
1757
1808
|
if (t.moveBlock && t.findBlockLocation) {
|
|
1758
1809
|
let n = t.moveBlock, r = (...r) => {
|
|
1759
1810
|
let i = b, a = i && !S && !C && !e.state.isLoading && e.state.template?.id === i.templateId;
|
|
1760
|
-
if (a &&
|
|
1811
|
+
if (a && oe(!0), n(...r), !a || B(i.view, e.content.value)) return;
|
|
1761
1812
|
let o = t.findBlockLocation(r[0]);
|
|
1762
1813
|
if (!o) return;
|
|
1763
1814
|
let s = o.targetSectionId ? {
|
|
1764
1815
|
sectionId: o.targetSectionId,
|
|
1765
1816
|
column: o.columnIndex ?? 0
|
|
1766
1817
|
} : null, c = s ? e.content.value.blocks.find((e) => e.id === s.sectionId) : void 0, l = s && c?.type === "section" ? c.children[s.column] : e.content.value.blocks;
|
|
1767
|
-
|
|
1818
|
+
se(i, [{
|
|
1768
1819
|
op: "moveBlock",
|
|
1769
1820
|
blockId: r[0],
|
|
1770
1821
|
parent: s,
|
|
1771
1822
|
after: l[o.index - 1]?.id ?? null
|
|
1772
1823
|
}]);
|
|
1773
1824
|
};
|
|
1774
|
-
t.moveBlock = r,
|
|
1825
|
+
t.moveBlock = r, k.push(() => {
|
|
1775
1826
|
t.moveBlock === r && (t.moveBlock = n);
|
|
1776
1827
|
});
|
|
1777
1828
|
}
|
|
1778
|
-
|
|
1829
|
+
k.push(v(() => e.state.template, (e) => De(e), { immediate: !0 }), v(() => e.content.value, ie, { deep: !0 }), v(() => e.state.selectedBlockId, ze), v(() => e.state.isLoading, (e) => e ? oe(!0, !0) : ie())), typeof window < "u" && (window.addEventListener("pagehide", Be), window.addEventListener("blur", H)), x() && l(qe);
|
|
1779
1830
|
}
|
|
1780
1831
|
function We() {
|
|
1781
|
-
|
|
1832
|
+
H();
|
|
1782
1833
|
let e = b;
|
|
1783
1834
|
return !e || e.pending.length === 0 ? Promise.resolve() : new Promise((t, n) => e.waiters.push({
|
|
1784
1835
|
resolve: t,
|
|
@@ -1786,16 +1837,16 @@ function wt(e) {
|
|
|
1786
1837
|
}));
|
|
1787
1838
|
}
|
|
1788
1839
|
function Ge() {
|
|
1789
|
-
|
|
1840
|
+
H(), S = !0;
|
|
1790
1841
|
}
|
|
1791
1842
|
function Ke() {
|
|
1792
1843
|
S = !1, b && z(b.view);
|
|
1793
1844
|
}
|
|
1794
1845
|
function qe() {
|
|
1795
|
-
if (!
|
|
1796
|
-
|
|
1797
|
-
for (let e of
|
|
1798
|
-
|
|
1846
|
+
if (!O) {
|
|
1847
|
+
H();
|
|
1848
|
+
for (let e of k.splice(0)) e();
|
|
1849
|
+
ae(), Be(), O = !0, b && Te(b), b = null, Re(), typeof window < "u" && (window.removeEventListener("pagehide", Be), window.removeEventListener("blur", H));
|
|
1799
1850
|
}
|
|
1800
1851
|
}
|
|
1801
1852
|
return {
|
|
@@ -1807,25 +1858,25 @@ function wt(e) {
|
|
|
1807
1858
|
setLockLocale: Ae,
|
|
1808
1859
|
connection: m,
|
|
1809
1860
|
revision: h,
|
|
1810
|
-
canUndo:
|
|
1811
|
-
canRedo:
|
|
1861
|
+
canUndo: N,
|
|
1862
|
+
canRedo: te,
|
|
1812
1863
|
attach: Ue,
|
|
1813
1864
|
undo: () => Ve("undo"),
|
|
1814
1865
|
redo: () => Ve("redo"),
|
|
1815
1866
|
clearHistory: () => {
|
|
1816
|
-
b && (b.undo = [], b.redo = [],
|
|
1867
|
+
b && (b.undo = [], b.redo = [], I());
|
|
1817
1868
|
},
|
|
1818
|
-
flush:
|
|
1869
|
+
flush: H,
|
|
1819
1870
|
settle: We,
|
|
1820
1871
|
suspend: Ge,
|
|
1821
1872
|
resume: Ke,
|
|
1822
|
-
catchUp:
|
|
1823
|
-
hasConfirmedBlock: (e) => b ?
|
|
1873
|
+
catchUp: xe,
|
|
1874
|
+
hasConfirmedBlock: (e) => b ? St(b.confirmed.blocks, e) : !1,
|
|
1824
1875
|
applyOperations: He,
|
|
1825
1876
|
destroy: qe
|
|
1826
1877
|
};
|
|
1827
1878
|
}
|
|
1828
|
-
function
|
|
1879
|
+
function Et(e) {
|
|
1829
1880
|
let { provider: t } = e, n = p([]), r = p(!1), i = d(() => {
|
|
1830
1881
|
let e = /* @__PURE__ */ new Set();
|
|
1831
1882
|
for (let t of n.value) {
|
|
@@ -1841,10 +1892,10 @@ function Tt(e) {
|
|
|
1841
1892
|
return s.value && e.canDelete !== !1;
|
|
1842
1893
|
}
|
|
1843
1894
|
function u(e, t) {
|
|
1844
|
-
throw new
|
|
1895
|
+
throw new G(`[Templatical] Saved blocks: ${e} is ${t}. Check the capability before calling — the editor's own UI hides the action.`);
|
|
1845
1896
|
}
|
|
1846
1897
|
function f(t) {
|
|
1847
|
-
|
|
1898
|
+
Ie(e.onError, t);
|
|
1848
1899
|
}
|
|
1849
1900
|
async function m(i) {
|
|
1850
1901
|
r.value = !0;
|
|
@@ -1911,9 +1962,9 @@ function Tt(e) {
|
|
|
1911
1962
|
remove: _
|
|
1912
1963
|
};
|
|
1913
1964
|
}
|
|
1914
|
-
var
|
|
1915
|
-
function
|
|
1916
|
-
let t = e.key ??
|
|
1965
|
+
var Dt = "templatical:saved-blocks";
|
|
1966
|
+
function Ot(e = {}) {
|
|
1967
|
+
let t = e.key ?? Dt;
|
|
1917
1968
|
function n() {
|
|
1918
1969
|
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.");
|
|
1919
1970
|
return localStorage;
|
|
@@ -1938,7 +1989,7 @@ function Dt(e = {}) {
|
|
|
1938
1989
|
},
|
|
1939
1990
|
async create(e) {
|
|
1940
1991
|
let t = (/* @__PURE__ */ new Date()).toISOString(), n = {
|
|
1941
|
-
id:
|
|
1992
|
+
id: U(),
|
|
1942
1993
|
name: e.name,
|
|
1943
1994
|
content: e.content,
|
|
1944
1995
|
...e.category ? { category: e.category } : {},
|
|
@@ -1964,9 +2015,9 @@ function Dt(e = {}) {
|
|
|
1964
2015
|
}
|
|
1965
2016
|
};
|
|
1966
2017
|
}
|
|
1967
|
-
var
|
|
1968
|
-
function
|
|
1969
|
-
let t = e.key ??
|
|
2018
|
+
var kt = "templatical:media", At = 50;
|
|
2019
|
+
function jt(e = {}) {
|
|
2020
|
+
let t = e.key ?? kt;
|
|
1970
2021
|
function n() {
|
|
1971
2022
|
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.");
|
|
1972
2023
|
return localStorage;
|
|
@@ -1999,12 +2050,12 @@ function At(e = {}) {
|
|
|
1999
2050
|
let t = r(), n = e?.search?.trim().toLowerCase(), i = n ? t.filter((e) => {
|
|
2000
2051
|
let t = e.filename?.toLowerCase() ?? "", r = e.alt?.toLowerCase() ?? "";
|
|
2001
2052
|
return t.includes(n) || r.includes(n);
|
|
2002
|
-
}) : t, a = e?.cursor ? Number.parseInt(e.cursor, 10) : 0, o = Number.isFinite(a) && a > 0 ? a : 0, s = i.slice(o, o +
|
|
2053
|
+
}) : t, a = e?.cursor ? Number.parseInt(e.cursor, 10) : 0, o = Number.isFinite(a) && a > 0 ? a : 0, s = i.slice(o, o + At), c = { items: s }, l = o + s.length;
|
|
2003
2054
|
return l < i.length && (c.nextCursor = String(l)), c;
|
|
2004
2055
|
},
|
|
2005
2056
|
async create(e) {
|
|
2006
2057
|
let t = await a(e.file), n = (/* @__PURE__ */ new Date()).toISOString(), o = {
|
|
2007
|
-
id:
|
|
2058
|
+
id: U(),
|
|
2008
2059
|
url: t,
|
|
2009
2060
|
filename: e.filename || e.file.name,
|
|
2010
2061
|
createdAt: n,
|
|
@@ -2039,18 +2090,18 @@ function At(e = {}) {
|
|
|
2039
2090
|
storage: !1
|
|
2040
2091
|
};
|
|
2041
2092
|
}
|
|
2042
|
-
function
|
|
2093
|
+
function Mt(e) {
|
|
2043
2094
|
let { provider: t, getTemplateId: n } = e, r = p([]), i = p(!1), a = p(void 0), o = p(!1), s = /* @__PURE__ */ new Map(), c = d(() => typeof t.create == "function"), l = d(() => typeof t.restore == "function");
|
|
2044
2095
|
function u(e) {
|
|
2045
2096
|
let t = n();
|
|
2046
|
-
if (!t) throw new
|
|
2097
|
+
if (!t) throw new G(`[Templatical] Version history: ${e} needs a template. Call create() or load() first.`);
|
|
2047
2098
|
return t;
|
|
2048
2099
|
}
|
|
2049
2100
|
function f(e) {
|
|
2050
|
-
throw new
|
|
2101
|
+
throw new G(`[Templatical] Version history: ${e} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`);
|
|
2051
2102
|
}
|
|
2052
2103
|
function m(t) {
|
|
2053
|
-
|
|
2104
|
+
Ie(e.onError, t);
|
|
2054
2105
|
}
|
|
2055
2106
|
async function h(n) {
|
|
2056
2107
|
let o = u("list");
|
|
@@ -2117,7 +2168,7 @@ function jt(e) {
|
|
|
2117
2168
|
restore: y
|
|
2118
2169
|
};
|
|
2119
2170
|
}
|
|
2120
|
-
function
|
|
2171
|
+
function Nt(e) {
|
|
2121
2172
|
let { provider: t, getTemplateId: n, getUser: r } = e, i = p([]), a = p(!1), o = p(!1), s = d(() => typeof t.create == "function"), c = d(() => typeof t.update == "function"), l = d(() => typeof t.delete == "function"), u = d(() => typeof t.setResolved == "function"), f = d(() => i.value.reduce((e, t) => e + 1 + (t.replies?.length ?? 0), 0)), m = d(() => i.value.filter((e) => !e.resolvedAt).length), h = d(() => {
|
|
2122
2173
|
let e = /* @__PURE__ */ new Map();
|
|
2123
2174
|
for (let t of i.value) t.blockId && e.set(t.blockId, (e.get(t.blockId) ?? 0) + 1 + (t.replies?.length ?? 0));
|
|
@@ -2125,16 +2176,16 @@ function Mt(e) {
|
|
|
2125
2176
|
});
|
|
2126
2177
|
function g(e) {
|
|
2127
2178
|
let t = n();
|
|
2128
|
-
if (!t) throw new
|
|
2179
|
+
if (!t) throw new G(`[Templatical] Comments: ${e} needs a template. Call create() or load() first.`);
|
|
2129
2180
|
return t;
|
|
2130
2181
|
}
|
|
2131
2182
|
function _(e) {
|
|
2132
2183
|
let t = r();
|
|
2133
|
-
if (!t) throw new
|
|
2184
|
+
if (!t) throw new G(`[Templatical] Comments: ${e} needs to know who is commenting. Pass init({ user: { id, name } }) — an unattributed comment is not written.`);
|
|
2134
2185
|
return t;
|
|
2135
2186
|
}
|
|
2136
2187
|
function v(e) {
|
|
2137
|
-
throw new
|
|
2188
|
+
throw new G(`[Templatical] Comments: ${e} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`);
|
|
2138
2189
|
}
|
|
2139
2190
|
function y(e) {
|
|
2140
2191
|
for (let t of i.value) {
|
|
@@ -2148,11 +2199,11 @@ function Mt(e) {
|
|
|
2148
2199
|
return t !== null && e.author.id === t.id;
|
|
2149
2200
|
}
|
|
2150
2201
|
function x(t) {
|
|
2151
|
-
let n =
|
|
2202
|
+
let n = Fe(t);
|
|
2152
2203
|
throw e.onError?.(n), n;
|
|
2153
2204
|
}
|
|
2154
2205
|
function S(t) {
|
|
2155
|
-
|
|
2206
|
+
Ie(e.onError, t);
|
|
2156
2207
|
}
|
|
2157
2208
|
function C(e, t, n) {
|
|
2158
2209
|
return [
|
|
@@ -2259,13 +2310,13 @@ function Mt(e) {
|
|
|
2259
2310
|
o.value = !1;
|
|
2260
2311
|
}
|
|
2261
2312
|
}
|
|
2262
|
-
function
|
|
2313
|
+
function ee(e) {
|
|
2263
2314
|
T(e) && S(() => t.onCreated?.(e, { origin: "remote" }));
|
|
2264
2315
|
}
|
|
2265
|
-
function
|
|
2316
|
+
function M(e) {
|
|
2266
2317
|
T(e) && S(() => (e.resolvedAt ? t.onResolved : t.onUpdated)?.(e, { origin: "remote" }));
|
|
2267
2318
|
}
|
|
2268
|
-
function
|
|
2319
|
+
function N(e, n) {
|
|
2269
2320
|
let r = E(e, n);
|
|
2270
2321
|
r && S(() => t.onDeleted?.(r, { origin: "remote" }));
|
|
2271
2322
|
}
|
|
@@ -2287,12 +2338,12 @@ function Mt(e) {
|
|
|
2287
2338
|
setResolved: j,
|
|
2288
2339
|
find: y,
|
|
2289
2340
|
isOwn: b,
|
|
2290
|
-
applyRemoteCreate:
|
|
2291
|
-
applyRemoteUpdate:
|
|
2292
|
-
applyRemoteDelete:
|
|
2341
|
+
applyRemoteCreate: ee,
|
|
2342
|
+
applyRemoteUpdate: M,
|
|
2343
|
+
applyRemoteDelete: N
|
|
2293
2344
|
};
|
|
2294
2345
|
}
|
|
2295
|
-
function
|
|
2346
|
+
function Pt(e) {
|
|
2296
2347
|
let { comments: n, provider: r, getTemplateId: i } = e, { subscribe: a } = r;
|
|
2297
2348
|
if (typeof a != "function") return;
|
|
2298
2349
|
let o = null;
|
|
@@ -2313,7 +2364,7 @@ function Nt(e) {
|
|
|
2313
2364
|
}));
|
|
2314
2365
|
}, { immediate: !0 }), l(s);
|
|
2315
2366
|
}
|
|
2316
|
-
var
|
|
2367
|
+
var Ft = J({
|
|
2317
2368
|
name: "code",
|
|
2318
2369
|
size: 24,
|
|
2319
2370
|
node: [["path", {
|
|
@@ -2323,14 +2374,14 @@ var Pt = q({
|
|
|
2323
2374
|
d: "m8 6-6 6 6 6",
|
|
2324
2375
|
key: "ppft3o"
|
|
2325
2376
|
}]]
|
|
2326
|
-
}),
|
|
2377
|
+
}), It = J({
|
|
2327
2378
|
name: "navigation",
|
|
2328
2379
|
size: 24,
|
|
2329
2380
|
node: [["polygon", {
|
|
2330
2381
|
points: "3 11 22 2 13 21 11 13 3 11",
|
|
2331
2382
|
key: "1ltx0t"
|
|
2332
2383
|
}]]
|
|
2333
|
-
}),
|
|
2384
|
+
}), Lt = J({
|
|
2334
2385
|
name: "share-2",
|
|
2335
2386
|
size: 24,
|
|
2336
2387
|
node: [
|
|
@@ -2367,7 +2418,7 @@ var Pt = q({
|
|
|
2367
2418
|
key: "1n3mei"
|
|
2368
2419
|
}]
|
|
2369
2420
|
]
|
|
2370
|
-
}),
|
|
2421
|
+
}), Rt = J({
|
|
2371
2422
|
name: "table",
|
|
2372
2423
|
size: 24,
|
|
2373
2424
|
node: [
|
|
@@ -2392,9 +2443,9 @@ var Pt = q({
|
|
|
2392
2443
|
key: "5xshup"
|
|
2393
2444
|
}]
|
|
2394
2445
|
]
|
|
2395
|
-
}),
|
|
2446
|
+
}), zt = 1e4;
|
|
2396
2447
|
// src/composables/useImageUrlResolver.ts
|
|
2397
|
-
function
|
|
2448
|
+
function Bt(e) {
|
|
2398
2449
|
let t = s(/* @__PURE__ */ new Map()), n = /* @__PURE__ */ new Set();
|
|
2399
2450
|
function r(e) {
|
|
2400
2451
|
return t.get(e);
|
|
@@ -2423,8 +2474,8 @@ function zt(e) {
|
|
|
2423
2474
|
lookup: a
|
|
2424
2475
|
};
|
|
2425
2476
|
}
|
|
2426
|
-
function
|
|
2427
|
-
let n = C(
|
|
2477
|
+
function Vt(e) {
|
|
2478
|
+
let n = C(_e, null), r = d(e);
|
|
2428
2479
|
if (!n) return r;
|
|
2429
2480
|
let i;
|
|
2430
2481
|
function a() {
|
|
@@ -2445,37 +2496,37 @@ function Bt(e) {
|
|
|
2445
2496
|
return typeof t == "string" && t.length > 0 ? t : e;
|
|
2446
2497
|
});
|
|
2447
2498
|
}
|
|
2448
|
-
function
|
|
2499
|
+
function Ht(e, t) {
|
|
2449
2500
|
if (!e || !t) return t;
|
|
2450
2501
|
let n = e.get(t);
|
|
2451
2502
|
return typeof n == "string" && n.length > 0 ? n : t;
|
|
2452
2503
|
}
|
|
2453
|
-
function
|
|
2504
|
+
function Ut(e, t) {
|
|
2454
2505
|
return typeof e?.url == "string" && se(e.url, t);
|
|
2455
2506
|
}
|
|
2456
|
-
function
|
|
2507
|
+
function Wt(e, t) {
|
|
2457
2508
|
let n = e?.url;
|
|
2458
2509
|
if (typeof n == "string" && n.trim() !== "") return se(n, t) ? void 0 : n;
|
|
2459
2510
|
}
|
|
2460
|
-
function
|
|
2461
|
-
let t = C(
|
|
2462
|
-
return d(() =>
|
|
2511
|
+
function Gt(e) {
|
|
2512
|
+
let t = C(ge, z.liquid), n = Vt(() => Wt(e(), t));
|
|
2513
|
+
return d(() => Ut(e(), t) ? null : n.value);
|
|
2463
2514
|
}
|
|
2464
|
-
function
|
|
2465
|
-
return
|
|
2515
|
+
function Kt(e, t, n) {
|
|
2516
|
+
return Ut(t, n) ? null : Ht(e, Wt(t, n));
|
|
2466
2517
|
}
|
|
2467
2518
|
// src/utils/blockTypeLabels.ts
|
|
2468
|
-
function
|
|
2519
|
+
function qt(e, t) {
|
|
2469
2520
|
return t.blocks[e] ?? e;
|
|
2470
2521
|
}
|
|
2471
|
-
function
|
|
2472
|
-
if (e.type !== "custom") return
|
|
2522
|
+
function Jt(e, t, n = []) {
|
|
2523
|
+
if (e.type !== "custom") return qt(e.type, t);
|
|
2473
2524
|
let { customType: r } = e;
|
|
2474
2525
|
return n.find((e) => e.type === r)?.name ?? r;
|
|
2475
2526
|
}
|
|
2476
2527
|
// src/utils/resolveFieldColors.ts
|
|
2477
|
-
function
|
|
2478
|
-
let n =
|
|
2528
|
+
function Yt(e, t) {
|
|
2529
|
+
let n = Se({ presets: e.presets }, Ce), r = n.presets.length === 0, i = e.allowCustom ?? t.allowCustom;
|
|
2479
2530
|
return {
|
|
2480
2531
|
presets: r ? t.presets : n.presets,
|
|
2481
2532
|
allowCustom: t.allowCustom !== !1 && i,
|
|
@@ -2486,19 +2537,19 @@ function Jt(e, t) {
|
|
|
2486
2537
|
};
|
|
2487
2538
|
}
|
|
2488
2539
|
// src/utils/imageNaturalSize.ts
|
|
2489
|
-
function
|
|
2540
|
+
function Xt(e) {
|
|
2490
2541
|
return typeof e == "number" && Number.isFinite(e) && e > 0;
|
|
2491
2542
|
}
|
|
2492
|
-
function
|
|
2493
|
-
return
|
|
2543
|
+
function Zt(e, t) {
|
|
2544
|
+
return Xt(e) && Xt(t) ? {
|
|
2494
2545
|
width: e,
|
|
2495
2546
|
height: t
|
|
2496
2547
|
} : null;
|
|
2497
2548
|
}
|
|
2498
|
-
function Zt(e) {
|
|
2499
|
-
return Xt(e.naturalWidth, e.naturalHeight);
|
|
2500
|
-
}
|
|
2501
2549
|
function Qt(e) {
|
|
2550
|
+
return Zt(e.naturalWidth, e.naturalHeight);
|
|
2551
|
+
}
|
|
2552
|
+
function $t(e) {
|
|
2502
2553
|
return e ? {
|
|
2503
2554
|
naturalWidth: e.width,
|
|
2504
2555
|
naturalHeight: e.height
|
|
@@ -2507,35 +2558,35 @@ function Qt(e) {
|
|
|
2507
2558
|
naturalHeight: void 0
|
|
2508
2559
|
};
|
|
2509
2560
|
}
|
|
2510
|
-
function
|
|
2561
|
+
function en(e, t) {
|
|
2511
2562
|
if (typeof Image > "u") return t(null), () => {};
|
|
2512
2563
|
let n = new Image(), r = () => {
|
|
2513
2564
|
n.onload = null, n.onerror = null;
|
|
2514
2565
|
};
|
|
2515
2566
|
return n.onload = () => {
|
|
2516
|
-
r(), t(
|
|
2567
|
+
r(), t(Zt(n.naturalWidth, n.naturalHeight));
|
|
2517
2568
|
}, n.onerror = () => {
|
|
2518
2569
|
r(), t(null);
|
|
2519
2570
|
}, n.src = e, r;
|
|
2520
2571
|
}
|
|
2521
|
-
function
|
|
2572
|
+
function tn(e) {
|
|
2522
2573
|
return new Promise((t) => {
|
|
2523
2574
|
let n = setTimeout(() => {
|
|
2524
2575
|
r(), t(null);
|
|
2525
|
-
},
|
|
2576
|
+
}, zt), r = en(e, (e) => {
|
|
2526
2577
|
clearTimeout(n), t(e);
|
|
2527
2578
|
});
|
|
2528
2579
|
});
|
|
2529
2580
|
}
|
|
2530
2581
|
// src/components/MediaDropOverlay.vue
|
|
2531
|
-
var
|
|
2582
|
+
var nn = /* @__PURE__ */ w({
|
|
2532
2583
|
__name: "MediaDropOverlay",
|
|
2533
2584
|
props: {
|
|
2534
2585
|
uploading: { type: Boolean },
|
|
2535
2586
|
size: { default: "field" }
|
|
2536
2587
|
},
|
|
2537
2588
|
setup(e) {
|
|
2538
|
-
let t = e, { t: r } =
|
|
2589
|
+
let t = e, { t: r } = be(), s = {
|
|
2539
2590
|
field: {
|
|
2540
2591
|
gap: "tpl:gap-1.5",
|
|
2541
2592
|
icon: 18,
|
|
@@ -2550,39 +2601,39 @@ var tn = /* @__PURE__ */ w({
|
|
|
2550
2601
|
return (t, s) => (i(), m("div", {
|
|
2551
2602
|
class: a(["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)]", c.value.gap]),
|
|
2552
2603
|
style: o({ backgroundColor: `color-mix(in srgb, var(--tpl-bg) ${c.value.veil}, transparent)` })
|
|
2553
|
-
}, [e.uploading ? (i(), m(S, { key: 0 }, [u(f(
|
|
2604
|
+
}, [e.uploading ? (i(), m(S, { key: 0 }, [u(f(he), {
|
|
2554
2605
|
class: "tpl-spinner",
|
|
2555
2606
|
size: c.value.icon,
|
|
2556
2607
|
"stroke-width": 2
|
|
2557
|
-
}, null, 8, ["size"]), h(" " + n(f(r).image.uploading), 1)], 64)) : (i(), m(S, { key: 1 }, [u(f(
|
|
2608
|
+
}, null, 8, ["size"]), h(" " + n(f(r).image.uploading), 1)], 64)) : (i(), m(S, { key: 1 }, [u(f(me), {
|
|
2558
2609
|
size: c.value.icon,
|
|
2559
2610
|
"stroke-width": 1.5
|
|
2560
2611
|
}, null, 8, ["size"]), h(" " + n(f(r).image.dropToUpload), 1)], 64))], 6));
|
|
2561
2612
|
}
|
|
2562
2613
|
});
|
|
2563
2614
|
// src/composables/useAliveFlag.ts
|
|
2564
|
-
function
|
|
2615
|
+
function rn() {
|
|
2565
2616
|
let e = { alive: !0 };
|
|
2566
2617
|
return _(() => {
|
|
2567
2618
|
e.alive = !1;
|
|
2568
2619
|
}), e;
|
|
2569
2620
|
}
|
|
2570
2621
|
// src/composables/useImageDrop.ts
|
|
2571
|
-
var
|
|
2572
|
-
function
|
|
2573
|
-
let { target: t, onFiles: n, enabled: r } = e, i = () => r === void 0 || b(r), { isOverDropZone: a } =
|
|
2622
|
+
var an = "image/";
|
|
2623
|
+
function on(e) {
|
|
2624
|
+
let { target: t, onFiles: n, enabled: r } = e, i = () => r === void 0 || b(r), { isOverDropZone: a } = xe(t, {
|
|
2574
2625
|
preventDefaultForUnhandled: !0,
|
|
2575
2626
|
onDrop: (e) => {
|
|
2576
2627
|
if (!i()) return;
|
|
2577
|
-
let t = (e ?? []).filter((e) => e.type.startsWith(
|
|
2628
|
+
let t = (e ?? []).filter((e) => e.type.startsWith(an));
|
|
2578
2629
|
t.length > 0 && n([t[0]]);
|
|
2579
2630
|
}
|
|
2580
2631
|
});
|
|
2581
2632
|
return { isOver: d(() => i() && a.value) };
|
|
2582
2633
|
}
|
|
2583
2634
|
// src/composables/useMediaDropField.ts
|
|
2584
|
-
function
|
|
2585
|
-
let { target: t, blocked: n, apply: r } = e, i = C(
|
|
2635
|
+
function sn(e) {
|
|
2636
|
+
let { target: t, blocked: n, apply: r } = e, i = C(ve, null), a = C(ye, null), o = rn();
|
|
2586
2637
|
async function s() {
|
|
2587
2638
|
let e = await i?.({ accept: ["images"] });
|
|
2588
2639
|
o.alive && e && r(e);
|
|
@@ -2603,7 +2654,7 @@ function on(e) {
|
|
|
2603
2654
|
}
|
|
2604
2655
|
}
|
|
2605
2656
|
}
|
|
2606
|
-
let { isOver: f } =
|
|
2657
|
+
let { isOver: f } = on({
|
|
2607
2658
|
target: t,
|
|
2608
2659
|
enabled: l,
|
|
2609
2660
|
onFiles: u
|
|
@@ -2616,10 +2667,10 @@ function on(e) {
|
|
|
2616
2667
|
openMediaBrowser: s
|
|
2617
2668
|
};
|
|
2618
2669
|
}
|
|
2619
|
-
function
|
|
2670
|
+
function cn(e, t = "desktop") {
|
|
2620
2671
|
return t === "mobile" ? 375 : e?.width ?? 600;
|
|
2621
2672
|
}
|
|
2622
|
-
var
|
|
2673
|
+
var ln = "width 300ms cubic-bezier(0.34, 1.56, 0.64, 1)", un = {
|
|
2623
2674
|
1: [100],
|
|
2624
2675
|
2: [50, 50],
|
|
2625
2676
|
3: [
|
|
@@ -2643,60 +2694,60 @@ var cn = "width 300ms cubic-bezier(0.34, 1.56, 0.64, 1)", ln = {
|
|
|
2643
2694
|
25
|
|
2644
2695
|
]
|
|
2645
2696
|
};
|
|
2646
|
-
function un(e, t) {
|
|
2647
|
-
let n = (e) => Math.trunc(e ?? 0), r = (e) => ce(e) === null ? 0 : Math.trunc(e.width);
|
|
2648
|
-
return n(e?.left) + n(e?.right) + r(t?.left) + r(t?.right);
|
|
2649
|
-
}
|
|
2650
2697
|
function dn(e, t) {
|
|
2651
|
-
|
|
2698
|
+
let n = (e) => Math.trunc(e ?? 0), r = (e) => H(e) === null ? 0 : Math.trunc(e.width);
|
|
2699
|
+
return n(e?.left) + n(e?.right) + r(t?.left) + r(t?.right);
|
|
2652
2700
|
}
|
|
2653
2701
|
function fn(e, t) {
|
|
2702
|
+
return Math.floor(e) - dn(t);
|
|
2703
|
+
}
|
|
2704
|
+
function pn(e, t) {
|
|
2654
2705
|
let n = "border" in e ? e.border : void 0;
|
|
2655
|
-
return Math.floor(t) -
|
|
2706
|
+
return Math.floor(t) - dn(e.styles.padding, n);
|
|
2656
2707
|
}
|
|
2657
|
-
function*
|
|
2658
|
-
for (let n of e)
|
|
2708
|
+
function* mn(e, t) {
|
|
2709
|
+
for (let n of e) E(n) ? yield* mn(n.children, fn(t, n.styles.padding)) : yield {
|
|
2659
2710
|
block: n,
|
|
2660
|
-
bandWidth:
|
|
2711
|
+
bandWidth: k(n) && n.wrapper ? fn(t, n.wrapper.padding) : t
|
|
2661
2712
|
};
|
|
2662
2713
|
}
|
|
2663
|
-
function
|
|
2714
|
+
function hn(e, t, n = W(e)) {
|
|
2664
2715
|
if (!t) return e;
|
|
2665
2716
|
try {
|
|
2666
|
-
return
|
|
2717
|
+
return ne(le(t, n, { missing: "default" }), e);
|
|
2667
2718
|
} catch {
|
|
2668
2719
|
return e;
|
|
2669
2720
|
}
|
|
2670
2721
|
}
|
|
2671
|
-
function
|
|
2672
|
-
let i =
|
|
2673
|
-
for (let { block: e, bandWidth: n } of
|
|
2674
|
-
let r =
|
|
2722
|
+
function gn(e, t, n, r) {
|
|
2723
|
+
let i = hn(e, n, r);
|
|
2724
|
+
for (let { block: e, bandWidth: n } of mn(i.blocks, i.settings.width)) if (k(e)) {
|
|
2725
|
+
let r = L(e)?.applied ? void 0 : e.border, i = Math.floor(n) - dn(e.styles.padding, r), a = un[e.columns] ?? [100];
|
|
2675
2726
|
for (let n = 0; n < e.children.length; n++) {
|
|
2676
2727
|
let r = Math.floor(i * (a[n] ?? 100) / 100), o = e.children[n].find((e) => e.id === t);
|
|
2677
|
-
if (o) return
|
|
2728
|
+
if (o) return pn(o, r);
|
|
2678
2729
|
}
|
|
2679
|
-
} else if (e.id === t) return
|
|
2730
|
+
} else if (e.id === t) return pn(e, n);
|
|
2680
2731
|
return null;
|
|
2681
2732
|
}
|
|
2682
|
-
function
|
|
2683
|
-
let i =
|
|
2684
|
-
for (let { block: e, bandWidth: n } of
|
|
2733
|
+
function _n(e, t, n, r) {
|
|
2734
|
+
let i = hn(e, n, r);
|
|
2735
|
+
for (let { block: e, bandWidth: n } of mn(i.blocks, i.settings.width)) if (e.id === t) return Math.floor(n);
|
|
2685
2736
|
return null;
|
|
2686
2737
|
}
|
|
2687
|
-
function
|
|
2688
|
-
let t =
|
|
2738
|
+
function vn(e) {
|
|
2739
|
+
let t = k(e) ? L(e) : null;
|
|
2689
2740
|
return !!t?.applied && t.height === "image";
|
|
2690
2741
|
}
|
|
2691
|
-
function
|
|
2692
|
-
if (
|
|
2742
|
+
function yn(e, t, n, r) {
|
|
2743
|
+
if (vn(e)) return (t ? _n(t, e.id, n, r) : null) ?? cn(t?.settings);
|
|
2693
2744
|
}
|
|
2694
2745
|
// src/constants/socialIcons.ts
|
|
2695
|
-
var
|
|
2746
|
+
var bn = ae, xn = {
|
|
2696
2747
|
small: 24,
|
|
2697
2748
|
medium: 32,
|
|
2698
2749
|
large: 48
|
|
2699
|
-
},
|
|
2750
|
+
}, Sn = [
|
|
2700
2751
|
"facebook",
|
|
2701
2752
|
"twitter",
|
|
2702
2753
|
"instagram",
|
|
@@ -2716,4 +2767,4 @@ var yn = U, bn = {
|
|
|
2716
2767
|
"dribbble",
|
|
2717
2768
|
"behance"
|
|
2718
2769
|
];
|
|
2719
|
-
export {
|
|
2770
|
+
export { Ue as A, Ke as B, Kt as C, Lt as D, Rt as E, He as F, Mt as G, Ve as H, Tt as I, Pt as L, Ot as M, dt as N, It as O, We as P, Nt as R, Wt as S, Vt as T, qe as U, Le as V, Et as W, Zt as _, vn as a, qt as b, ln as c, rn as d, nn as f, Qt as g, $t as h, gn as i, jt as j, Ft as k, cn as l, tn as m, bn as n, yn as o, en as p, Sn as r, _n as s, xn as t, sn as u, Yt as v, Gt as w, Bt as x, Jt as y, Ge as z };
|