@templatical/editor 0.59.2 → 0.60.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/dist/{AiAltTextPopover-BhWHOOKX.js → AiAltTextPopover-DiIaqDtB.js} +1 -1
- package/dist/{AiAltTextReview-CmW7pLmo.js → AiAltTextReview-DIe0WBbj.js} +1 -1
- package/dist/{AiChatPanel-CV0mCtad.js → AiChatPanel-aj2TPO9F.js} +8 -8
- package/dist/{AiPanels-C8M7q_vM.js → AiPanels-CRM3jf82.js} +1 -1
- package/dist/{AiRewriteMenu-DC2ZLH5L.js → AiRewriteMenu-F3GyXBsk.js} +8 -8
- package/dist/{BlockIssueBadge-B8sl9BM1.js → BlockIssueBadge-DlhA_I6J.js} +2 -2
- package/dist/{BlockPreviewCanvas-yhOQAQhJ.js → BlockPreviewCanvas-DYspUXMO.js} +19 -44
- package/dist/{CloudPanels-CD0lsL0R.js → CloudPanels-CAMn545-.js} +3 -3
- package/dist/{CollaborationNotices-DrMrP73M.js → CollaborationNotices-CnfS8BQy.js} +1 -1
- package/dist/{CollaboratorBar-TsK872uC.js → CollaboratorBar-DufLdLQP.js} +1 -1
- package/dist/{CommentsPanel-BX8JVrXU.js → CommentsPanel-C2hFFs0o.js} +1 -1
- package/dist/{CommentsSidebar-BUlseNwL.js → CommentsSidebar-CgEwxt2T.js} +10 -10
- package/dist/{CountdownToolbar-dx3FVRjh.js → CountdownToolbar-CNqYDevp.js} +4 -4
- package/dist/{IssuesPanel-BwnvXxBC.js → IssuesPanel-cPKhimE9.js} +9 -9
- package/dist/{LanguageMenu-Cf5bKocE.js → LanguageMenu-zxlpmw2x.js} +12 -12
- package/dist/{LocaleNotices-CGEp0pQ8.js → LocaleNotices-PIfpvCCI.js} +2 -2
- package/dist/{LogicTagInsertButton-BdDe-vrZ.js → LogicTagInsertButton-DqTkGJSR.js} +16 -16
- package/dist/{MediaEditModal-BWOqjEZN.js → MediaEditModal-C2Bn8WGb.js} +1 -1
- package/dist/{MediaPanels-C-XrldMu.js → MediaPanels-BAZByHRA.js} +1 -1
- package/dist/{MergeTagInput-CTTi-eB0.js → MergeTagInput-Jly1Pw0v.js} +1 -1
- package/dist/{MergeTagModeToggle-Bd0svGQm.js → MergeTagModeToggle-5kaFLRAm.js} +4 -4
- package/dist/{MergeTagTextarea-DiahMV-3.js → MergeTagTextarea-CCfirhcR.js} +5 -5
- package/dist/{ParagraphEditor-Db1cmj8Y.js → ParagraphEditor-DTdnxgDZ.js} +43 -43
- package/dist/{RestoreVersionDialog-DA1Z0q9Z.js → RestoreVersionDialog-cUYu3Xqs.js} +3 -3
- package/dist/{RichTextEditorContent-CyO6e4ZG.js → RichTextEditorContent-Aub9tOHF.js} +4 -4
- package/dist/{SaveBlockDialog-D7SaFxa_.js → SaveBlockDialog-D_ie3uIF.js} +7 -7
- package/dist/{SavedBlocksBrowserModal-B5r3LWWG.js → SavedBlocksBrowserModal-fhSnYT1l.js} +9 -9
- package/dist/{SavedBlocksPanels-BH2f7jm-.js → SavedBlocksPanels-Lklqy4XI.js} +1 -1
- package/dist/{SavedBlocksPickBar-B24TScw0.js → SavedBlocksPickBar-CpWkCa8G.js} +2 -2
- package/dist/{TemplateSettings-CuN9Vkl_.js → TemplateSettings-BJ4a8RBr.js} +8 -8
- package/dist/{TestEmailModal-C4DAaohi.js → TestEmailModal-BEoapoDc.js} +8 -8
- package/dist/{TestEmailPanel-DoMcVJSE.js → TestEmailPanel-DgyzokCf.js} +1 -1
- package/dist/{TitleEditor-b5Pr_m9j.js → TitleEditor-BQoSPgOi.js} +9 -9
- package/dist/{Toolbar-BOf7Y862.js → Toolbar-KhPpWyX1.js} +857 -756
- package/dist/{TplModal-DAcXzBJh.js → TplModal-F_kA7luG.js} +1 -1
- package/dist/{VersionHistoryMenu-TbIGteNi.js → VersionHistoryMenu-Bz4G8cNm.js} +5 -5
- package/dist/{VersionHistoryPanels-Ia6ipOqG.js → VersionHistoryPanels-DmVRyWv9.js} +1 -1
- package/dist/{VersionPreviewBanner-CRfu6quf.js → VersionPreviewBanner-BeppXZyn.js} +1 -1
- package/dist/{WrapperBlock-BZenrXM6.js → WrapperBlock-Ds7yfbhg.js} +3 -3
- package/dist/{blockTypeIcons-DdYZy8yG.js → blockTypeIcons-Do1QqDjg.js} +3 -3
- package/dist/bundle-stats.json +6 -6
- package/dist/{cdn/chunks/ca-YfIxwO1G.js → ca-Ce3NmK9v.js} +6 -3
- package/dist/cdn/chunks/{AiAltTextPopover-CcX_OMUU.js → AiAltTextPopover-CUzIaLRK.js} +2 -2
- package/dist/cdn/chunks/AiAltTextPopover-CUzIaLRK.js.map +1 -0
- package/dist/cdn/chunks/{AiAltTextReview-Dmm3h0jd.js → AiAltTextReview-BXBlE71X.js} +2 -2
- package/dist/cdn/chunks/AiAltTextReview-BXBlE71X.js.map +1 -0
- package/dist/cdn/chunks/{AiChatPanel-DV23DJ-2.js → AiChatPanel-BKydciDQ.js} +2 -2
- package/dist/cdn/chunks/AiChatPanel-BKydciDQ.js.map +1 -0
- package/dist/cdn/chunks/{AiPanels-CxhOpMAp.js → AiPanels-De-cIZ4p.js} +2 -2
- package/dist/cdn/chunks/AiPanels-De-cIZ4p.js.map +1 -0
- package/dist/cdn/chunks/{AiRewriteMenu-87-O514r.js → AiRewriteMenu-C9vBUTIB.js} +6 -6
- package/dist/cdn/chunks/AiRewriteMenu-C9vBUTIB.js.map +1 -0
- package/dist/cdn/chunks/{BlockIssueBadge-Dp06vQd3.js → BlockIssueBadge-B3CTTvgw.js} +2 -2
- package/dist/cdn/chunks/BlockIssueBadge-B3CTTvgw.js.map +1 -0
- package/dist/cdn/chunks/{BlockPreviewCanvas-DQGzUvZ5.js → BlockPreviewCanvas-B4Bj--kc.js} +20 -45
- package/dist/cdn/chunks/BlockPreviewCanvas-B4Bj--kc.js.map +1 -0
- package/dist/cdn/chunks/CloudHeaderExtras-Cd-ePldd.js.map +1 -1
- package/dist/cdn/chunks/{CloudPanels-D8fchoYt.js → CloudPanels-CQ75I3hQ.js} +3 -3
- package/dist/cdn/chunks/CloudPanels-CQ75I3hQ.js.map +1 -0
- package/dist/cdn/chunks/{CollaborationNotices-DNEs3g9B.js → CollaborationNotices-CgLea-hu.js} +2 -2
- package/dist/cdn/chunks/CollaborationNotices-CgLea-hu.js.map +1 -0
- package/dist/cdn/chunks/{CollaboratorBar-CN6XAlbn.js → CollaboratorBar-CjRcbebT.js} +2 -2
- package/dist/cdn/chunks/CollaboratorBar-CjRcbebT.js.map +1 -0
- package/dist/cdn/chunks/{CommentsPanel-CxZ1kFcK.js → CommentsPanel-D_ud9GMN.js} +2 -2
- package/dist/cdn/chunks/CommentsPanel-D_ud9GMN.js.map +1 -0
- package/dist/cdn/chunks/{CommentsSidebar-DCr2mV8b.js → CommentsSidebar-CXn1EGAI.js} +2 -2
- package/dist/cdn/chunks/CommentsSidebar-CXn1EGAI.js.map +1 -0
- package/dist/cdn/chunks/CountdownBlock--hlKE2aj.js.map +1 -1
- package/dist/cdn/chunks/{CountdownToolbar-CUTbVPPV.js → CountdownToolbar-BOyk_4k7.js} +5 -5
- package/dist/cdn/chunks/CountdownToolbar-BOyk_4k7.js.map +1 -0
- package/dist/cdn/chunks/{IssuesPanel-BhcSzwuL.js → IssuesPanel-DOC94ZsH.js} +4 -4
- package/dist/cdn/chunks/IssuesPanel-DOC94ZsH.js.map +1 -0
- package/dist/cdn/chunks/{LanguageMenu-6wGhkyFT.js → LanguageMenu-DktneIpL.js} +7 -7
- package/dist/cdn/chunks/LanguageMenu-DktneIpL.js.map +1 -0
- package/dist/cdn/chunks/{LocaleNotices-Br92Xueo.js → LocaleNotices-B2NgnHoP.js} +2 -2
- package/dist/cdn/chunks/LocaleNotices-B2NgnHoP.js.map +1 -0
- package/dist/cdn/chunks/{LogicTagInsertButton-r2EVUtDU.js → LogicTagInsertButton-CQ8RiOou.js} +5 -5
- package/dist/cdn/chunks/LogicTagInsertButton-CQ8RiOou.js.map +1 -0
- package/dist/cdn/chunks/{MediaEditModal-CfgN7Jyi.js → MediaEditModal-Cs7_Om7e.js} +2 -2
- package/dist/cdn/chunks/MediaEditModal-Cs7_Om7e.js.map +1 -0
- package/dist/cdn/chunks/{MediaPanels-Cb5vsgb-.js → MediaPanels-BeekGmql.js} +2 -2
- package/dist/cdn/chunks/MediaPanels-BeekGmql.js.map +1 -0
- package/dist/cdn/chunks/{MergeTagInput-Dh3N6CEV.js → MergeTagInput-D7FZ0ca0.js} +2 -2
- package/dist/cdn/chunks/MergeTagInput-D7FZ0ca0.js.map +1 -0
- package/dist/cdn/chunks/{MergeTagModeToggle-D6u3hMrI.js → MergeTagModeToggle-CySCCEDs.js} +3 -3
- package/dist/cdn/chunks/MergeTagModeToggle-CySCCEDs.js.map +1 -0
- package/dist/cdn/chunks/{MergeTagTextarea-BpVtpiNL.js → MergeTagTextarea-DJbWTYVH.js} +7 -7
- package/dist/cdn/chunks/MergeTagTextarea-DJbWTYVH.js.map +1 -0
- package/dist/cdn/chunks/{ParagraphEditor-DGJmPAC1.js → ParagraphEditor-DAQUWqQJ.js} +23 -23
- package/dist/cdn/chunks/ParagraphEditor-DAQUWqQJ.js.map +1 -0
- package/dist/cdn/chunks/{RestoreVersionDialog-D5qeCa0F.js → RestoreVersionDialog-COTRe_rM.js} +3 -3
- package/dist/cdn/chunks/RestoreVersionDialog-COTRe_rM.js.map +1 -0
- package/dist/cdn/chunks/{RichTextEditorContent-DyGiXKKI.js → RichTextEditorContent-DeWPMd9V.js} +4 -4
- package/dist/cdn/chunks/RichTextEditorContent-DeWPMd9V.js.map +1 -0
- package/dist/cdn/chunks/{SaveBlockDialog-B0TJYxd8.js → SaveBlockDialog-adQMbKR1.js} +6 -6
- package/dist/cdn/chunks/SaveBlockDialog-adQMbKR1.js.map +1 -0
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-D8Ly7LrA.js → SavedBlocksBrowserModal-CGIFCRAx.js} +6 -6
- package/dist/cdn/chunks/SavedBlocksBrowserModal-CGIFCRAx.js.map +1 -0
- package/dist/cdn/chunks/{SavedBlocksPanels-Co1cbWR8.js → SavedBlocksPanels-Du0RYlEf.js} +2 -2
- package/dist/cdn/chunks/SavedBlocksPanels-Du0RYlEf.js.map +1 -0
- package/dist/cdn/chunks/{SavedBlocksPickBar-DNtVbpm-.js → SavedBlocksPickBar-DmleyUrn.js} +3 -3
- package/dist/cdn/chunks/SavedBlocksPickBar-DmleyUrn.js.map +1 -0
- package/dist/cdn/chunks/{TemplateSettings-BRc878ZF.js → TemplateSettings-Csjef99q.js} +6 -6
- package/dist/cdn/chunks/TemplateSettings-Csjef99q.js.map +1 -0
- package/dist/cdn/chunks/{TestEmailModal-CIui7VfS.js → TestEmailModal-ClkexOtF.js} +7 -7
- package/dist/cdn/chunks/TestEmailModal-ClkexOtF.js.map +1 -0
- package/dist/cdn/chunks/{TestEmailPanel-vKvruW_r.js → TestEmailPanel-DYEYzhU2.js} +2 -2
- package/dist/cdn/chunks/TestEmailPanel-DYEYzhU2.js.map +1 -0
- package/dist/cdn/chunks/{TitleEditor-BI-9Nnj3.js → TitleEditor-opvaIgVr.js} +8 -8
- package/dist/cdn/chunks/TitleEditor-opvaIgVr.js.map +1 -0
- package/dist/cdn/chunks/ToggleSwitch-C0w0srN_.js.map +1 -1
- package/dist/cdn/chunks/{Toolbar-CYnnArxv.js → Toolbar-DbqkKRXy.js} +771 -670
- package/dist/cdn/chunks/Toolbar-DbqkKRXy.js.map +1 -0
- package/dist/cdn/chunks/{TplModal-B3nZeGWK.js → TplModal-DLV5OeMD.js} +2 -2
- package/dist/cdn/chunks/TplModal-DLV5OeMD.js.map +1 -0
- package/dist/cdn/chunks/{VersionHistoryMenu-CMGfAKuV.js → VersionHistoryMenu-DBd0zwjE.js} +2 -2
- package/dist/cdn/chunks/VersionHistoryMenu-DBd0zwjE.js.map +1 -0
- package/dist/cdn/chunks/{VersionHistoryPanels-Bb2ouQg7.js → VersionHistoryPanels-hy_Ybxie.js} +2 -2
- package/dist/cdn/chunks/VersionHistoryPanels-hy_Ybxie.js.map +1 -0
- package/dist/cdn/chunks/{VersionPreviewBanner-573UP-g4.js → VersionPreviewBanner-D-yHxWWY.js} +2 -2
- package/dist/cdn/chunks/VersionPreviewBanner-D-yHxWWY.js.map +1 -0
- package/dist/cdn/chunks/{WrapperBlock-DVu632LD.js → WrapperBlock-Ce_k8m_x.js} +4 -4
- package/dist/cdn/chunks/WrapperBlock-Ce_k8m_x.js.map +1 -0
- package/dist/cdn/chunks/{blockTypeIcons-CGxNYHVA.js → blockTypeIcons-DBoP1HkR.js} +2 -2
- package/dist/cdn/chunks/{blockTypeIcons-CGxNYHVA.js.map → blockTypeIcons-DBoP1HkR.js.map} +1 -1
- package/dist/{ca-YfIxwO1G.js → cdn/chunks/ca-Ce3NmK9v.js} +8 -1
- package/dist/cdn/chunks/ca-Ce3NmK9v.js.map +1 -0
- package/dist/cdn/chunks/{composables-DY3anqHO.js → composables-Brr4m0Sg.js} +566 -591
- package/dist/cdn/chunks/composables-Brr4m0Sg.js.map +1 -0
- package/dist/cdn/chunks/{createCloudRuntime-B5numxlW.js → createCloudRuntime-QPeg45XL.js} +3 -3
- package/dist/cdn/chunks/{createCloudRuntime-B5numxlW.js.map → createCloudRuntime-QPeg45XL.js.map} +1 -1
- package/dist/cdn/chunks/{da-CM6DCvRG.js → da-4YwDAuEr.js} +7 -2
- package/dist/cdn/chunks/da-4YwDAuEr.js.map +1 -0
- package/dist/{de-Dugz1zXC.js → cdn/chunks/de-BlQ0vdZJ.js} +8 -1
- package/dist/cdn/chunks/de-BlQ0vdZJ.js.map +1 -0
- package/dist/cdn/chunks/{editor-modal-CXSSZplR.js → editor-modal-BCcbvIxc.js} +4 -4
- package/dist/cdn/chunks/editor-modal-BCcbvIxc.js.map +1 -0
- package/dist/cdn/chunks/en-DkulseE1.js +1 -0
- package/dist/{en-BykoFuFY.js → cdn/chunks/en-MlNeQVSG.js} +8 -1
- package/dist/cdn/chunks/en-MlNeQVSG.js.map +1 -0
- package/dist/{es-DaWsTkpj.js → cdn/chunks/es-2s8x4OM2.js} +8 -1
- package/dist/cdn/chunks/es-2s8x4OM2.js.map +1 -0
- package/dist/cdn/chunks/{extensions-BWVlr8Ga.js → extensions-BpuyqKVY.js} +5 -5
- package/dist/cdn/chunks/extensions-BpuyqKVY.js.map +1 -0
- package/dist/{fr-DqwQHtJo.js → cdn/chunks/fr-D3MjrsgQ.js} +8 -1
- package/dist/cdn/chunks/fr-D3MjrsgQ.js.map +1 -0
- package/dist/cdn/chunks/{icons-C7vjUBLn.js → icons-BJ6AtVgu.js} +23 -23
- package/dist/cdn/chunks/{icons-C7vjUBLn.js.map → icons-BJ6AtVgu.js.map} +1 -1
- package/dist/cdn/chunks/{ja-BH4MS1Ye.js → ja-B4Kx7uBX.js} +7 -2
- package/dist/cdn/chunks/ja-B4Kx7uBX.js.map +1 -0
- package/dist/{nl-BQl1_UHv.js → cdn/chunks/nl-U65iX7wN.js} +8 -1
- package/dist/cdn/chunks/nl-U65iX7wN.js.map +1 -0
- package/dist/cdn/chunks/{normalizeMergeTagMarkup-Dw3rFvyd.js → normalizeMergeTagMarkup-B81BAWKT.js} +64 -64
- package/dist/cdn/chunks/{normalizeMergeTagMarkup-Dw3rFvyd.js.map → normalizeMergeTagMarkup-B81BAWKT.js.map} +1 -1
- package/dist/cdn/chunks/{preRenderCustomBlocks-BGtb8Xbp.js → preRenderCustomBlocks-CQuaMxuv.js} +2 -2
- package/dist/cdn/chunks/{preRenderCustomBlocks-BGtb8Xbp.js.map → preRenderCustomBlocks-CQuaMxuv.js.map} +1 -1
- package/dist/{pt-BR-eyzmU9Vs.js → cdn/chunks/pt-BR-_jsX1xLv.js} +8 -1
- package/dist/cdn/chunks/pt-BR-_jsX1xLv.js.map +1 -0
- package/dist/cdn/chunks/{sanitizeHtml-CLRY8s2s.js → sanitizeHtml-BdAjvU9I.js} +2 -2
- package/dist/cdn/chunks/{sanitizeHtml-CLRY8s2s.js.map → sanitizeHtml-BdAjvU9I.js.map} +1 -1
- package/dist/cdn/chunks/{socialIcons-kYhdXJ9P.js → socialIcons-Df9dNe7I.js} +495 -517
- package/dist/cdn/chunks/socialIcons-Df9dNe7I.js.map +1 -0
- package/dist/cdn/chunks/{src-BmzzkUf7.js → src-B3v_3j9b.js} +436 -404
- package/dist/cdn/chunks/src-B3v_3j9b.js.map +1 -0
- package/dist/cdn/chunks/{src-DY2kMjoD.js → src-BHgVGOTi.js} +771 -667
- package/dist/cdn/chunks/src-BHgVGOTi.js.map +1 -0
- package/dist/cdn/chunks/src-C5V_yzAU.js +673 -0
- package/dist/cdn/chunks/src-C5V_yzAU.js.map +1 -0
- package/dist/cdn/chunks/{tiptap-B7gxx0aJ.js → tiptap-D9amDW4u.js} +1030 -1027
- package/dist/cdn/chunks/tiptap-D9amDW4u.js.map +1 -0
- package/dist/cdn/chunks/useLocalizedDisplay-C3lIetmX.js +33 -0
- package/dist/cdn/chunks/{useLocalizedDisplay-B5wMJLru.js.map → useLocalizedDisplay-C3lIetmX.js.map} +1 -1
- package/dist/cdn/chunks/{useLogicTag-0wkSxy3z.js → useLogicTag-DOIlsGk8.js} +2 -2
- package/dist/cdn/chunks/{useLogicTag-0wkSxy3z.js.map → useLogicTag-DOIlsGk8.js.map} +1 -1
- package/dist/cdn/chunks/{useMergeTag-y3bX8M_6.js → useMergeTag-DUNl364g.js} +2 -2
- package/dist/cdn/chunks/{useMergeTag-y3bX8M_6.js.map → useMergeTag-DUNl364g.js.map} +1 -1
- package/dist/cdn/chunks/{withCurrentFont-B42BKo9N.js → withCurrentFont-ufGLu2Vt.js} +2 -2
- package/dist/cdn/chunks/{withCurrentFont-B42BKo9N.js.map → withCurrentFont-ufGLu2Vt.js.map} +1 -1
- package/dist/cdn/editor.js +109 -109
- package/dist/cdn/editor.js.map +1 -1
- package/dist/{check-ErKdPXG6.js → check-CWq6Nfjj.js} +1 -1
- package/dist/{chevron-down-C_vv5fZE.js → chevron-down-B9t0SK_-.js} +1 -1
- package/dist/{chevron-right-Cw4GpjFA.js → chevron-right-B_qslOCS.js} +1 -1
- package/dist/{chevron-up-uijYZoph.js → chevron-up-CxZ2teV2.js} +1 -1
- package/dist/{circle-exclamation-point-CIYHx5Tw.js → circle-exclamation-point-B1tbhkNb.js} +1 -1
- package/dist/{clock-tnC1IvZk.js → clock-Rw4btQn-.js} +1 -1
- package/dist/{composables-CFTH0Nqb.js → composables-5KJV0O9T.js} +914 -939
- package/dist/{createCloudRuntime-BvWlm_38.js → createCloudRuntime-BdoKeYJi.js} +2 -2
- package/dist/{createLucideIcon-CssArtUe.js → createLucideIcon-B6Zkn9r0.js} +5 -5
- package/dist/{da-CM6DCvRG.js → da-4YwDAuEr.js} +6 -1
- package/dist/{cdn/chunks/de-Dugz1zXC.js → de-BlQ0vdZJ.js} +6 -3
- package/dist/dist-AyAOL8Bj.js +4 -0
- package/dist/{dist-BTUMr4Pb.js → dist-BNrGwgev.js} +2 -2
- package/dist/{dist-CsplpC_6.js → dist-BPVNNdTv.js} +2 -2
- package/dist/{dist-bWIkrMkM.js → dist-C7YLw60i.js} +2 -2
- package/dist/{dist-Clfx1JeL.js → dist-CBnAqr27.js} +2 -2
- package/dist/{dist-CkHJRChP.js → dist-COvAA64n.js} +2 -2
- package/dist/{dist-C-NRkFsp.js → dist-CuRjmtWu.js} +5 -5
- package/dist/{dist-HKEDfp__.js → dist-DG_AWt8v.js} +2 -2
- package/dist/{dist-DY3WbyCO.js → dist-DYtuc3jc.js} +2 -2
- package/dist/dist-DkPTWQuO.js +4 -0
- package/dist/{dist-DwpKFWF4.js → dist-DoWk1r7z.js} +77 -74
- package/dist/{dist-CMo4K5So.js → dist-DsA7NeIy.js} +798 -696
- package/dist/{dist-BlrlMP8f.js → dist-fDsB6dCL.js} +2 -2
- package/dist/{editor-modal-BWvxfSj8.js → editor-modal-_ylhrf4g.js} +15 -15
- package/dist/en-DwxgN_-Y.js +1 -0
- package/dist/{cdn/chunks/en-BykoFuFY.js → en-MlNeQVSG.js} +6 -3
- package/dist/{cdn/chunks/es-DaWsTkpj.js → es-2s8x4OM2.js} +6 -3
- package/dist/{extensions-BPVackEE.js → extensions-DCJGAZ9z.js} +73 -73
- package/dist/{eye-DK4--qHk.js → eye-BE-DeEqG.js} +1 -1
- package/dist/{cdn/chunks/fr-DqwQHtJo.js → fr-D3MjrsgQ.js} +6 -3
- package/dist/{image-B5pJOw5Q.js → image-DfRxUmUh.js} +1 -1
- package/dist/index.d.ts +37 -7
- package/dist/{info-DKM0_thN.js → info-D1PS-81D.js} +1 -1
- package/dist/{ja-BH4MS1Ye.js → ja-B4Kx7uBX.js} +6 -1
- package/dist/{link-BNgTZ_Sw.js → link-DLaACaIz.js} +1 -1
- package/dist/{list-Bqynqm7o.js → list-CvtzVlvM.js} +1 -1
- package/dist/{loader-circle-BMc3fVpa.js → loader-circle-DCkSXApP.js} +1 -1
- package/dist/{message-circle-D_TpvAJh.js → message-circle-Bj4F9bBO.js} +1 -1
- package/dist/{cdn/chunks/nl-BQl1_UHv.js → nl-U65iX7wN.js} +6 -3
- package/dist/{normalizeMergeTagMarkup-PQqrbfmt.js → normalizeMergeTagMarkup-B7n_-4Dz.js} +45 -45
- package/dist/{package-D2fov5PU.js → package-By1au8Wi.js} +1 -1
- package/dist/{pencil-BNdkJyfY.js → pencil-T4qqyRLl.js} +1 -1
- package/dist/{plus-CWmBmMx-.js → plus-3Zry-1gs.js} +1 -1
- package/dist/{preRenderCustomBlocks-Dg5GBNi2.js → preRenderCustomBlocks-D3GzENVB.js} +3 -3
- package/dist/{cdn/chunks/pt-BR-eyzmU9Vs.js → pt-BR-_jsX1xLv.js} +6 -3
- package/dist/{refresh-cw-Ryg1j66N.js → refresh-cw-BwaO0ioc.js} +1 -1
- package/dist/{rotate-ccw-D8j7gXXv.js → rotate-ccw-C3E0W5q-.js} +1 -1
- package/dist/{sanitizeHtml-DVdfdxOz.js → sanitizeHtml-BcbjlypU.js} +6 -6
- package/dist/{search-CX2JkSHz.js → search-DfExisVv.js} +1 -1
- package/dist/{send-BLR1b-p5.js → send-FRC7Giap.js} +1 -1
- package/dist/{smartphone-Co8m0LLg.js → smartphone-BlYU_z_x.js} +1 -1
- package/dist/{socialIcons-DBHv_ntg.js → socialIcons-By2LPWOQ.js} +561 -583
- package/dist/{sparkles-Dc3Undp5.js → sparkles-DSi61skE.js} +1 -1
- package/dist/{square-CPw_cyX8.js → square-DEE8tT2w.js} +1 -1
- package/dist/templatical-editor.js +139 -139
- package/dist/{text-align-start-2VZGhCiK.js → text-align-start-DGdrmKcG.js} +1 -1
- package/dist/{trash-t6XXliVc.js → trash-YZPJMZc7.js} +1 -1
- package/dist/{triangle-exclamation-point-_YYWE2ZH.js → triangle-exclamation-point-BR-W6pQm.js} +1 -1
- package/dist/{upload-BWYXWYHb.js → upload-B_Eoqj-4.js} +1 -1
- package/dist/useLocalizedDisplay-_P6-hXaO.js +31 -0
- package/dist/{useLogicTag-CVOj0VUv.js → useLogicTag-f0SJ1Cd2.js} +1 -1
- package/dist/{useMergeTag-Bams_kam.js → useMergeTag-0-EudwkV.js} +3 -3
- package/dist/{useScrollToBlock-CwUQ_nKz.js → useScrollToBlock-CtM_ydOS.js} +1 -1
- package/dist/withCurrentFont-BOg3jmCT.js +18 -0
- package/dist/{x-CTKOxIyZ.js → x-C0X5MoK3.js} +1 -1
- package/package.json +22 -22
- package/dist/cdn/chunks/AiAltTextPopover-CcX_OMUU.js.map +0 -1
- package/dist/cdn/chunks/AiAltTextReview-Dmm3h0jd.js.map +0 -1
- package/dist/cdn/chunks/AiChatPanel-DV23DJ-2.js.map +0 -1
- package/dist/cdn/chunks/AiPanels-CxhOpMAp.js.map +0 -1
- package/dist/cdn/chunks/AiRewriteMenu-87-O514r.js.map +0 -1
- package/dist/cdn/chunks/BlockIssueBadge-Dp06vQd3.js.map +0 -1
- package/dist/cdn/chunks/BlockPreviewCanvas-DQGzUvZ5.js.map +0 -1
- package/dist/cdn/chunks/CloudPanels-D8fchoYt.js.map +0 -1
- package/dist/cdn/chunks/CollaborationNotices-DNEs3g9B.js.map +0 -1
- package/dist/cdn/chunks/CollaboratorBar-CN6XAlbn.js.map +0 -1
- package/dist/cdn/chunks/CommentsPanel-CxZ1kFcK.js.map +0 -1
- package/dist/cdn/chunks/CommentsSidebar-DCr2mV8b.js.map +0 -1
- package/dist/cdn/chunks/CountdownToolbar-CUTbVPPV.js.map +0 -1
- package/dist/cdn/chunks/IssuesPanel-BhcSzwuL.js.map +0 -1
- package/dist/cdn/chunks/LanguageMenu-6wGhkyFT.js.map +0 -1
- package/dist/cdn/chunks/LocaleNotices-Br92Xueo.js.map +0 -1
- package/dist/cdn/chunks/LogicTagInsertButton-r2EVUtDU.js.map +0 -1
- package/dist/cdn/chunks/MediaEditModal-CfgN7Jyi.js.map +0 -1
- package/dist/cdn/chunks/MediaPanels-Cb5vsgb-.js.map +0 -1
- package/dist/cdn/chunks/MergeTagInput-Dh3N6CEV.js.map +0 -1
- package/dist/cdn/chunks/MergeTagModeToggle-D6u3hMrI.js.map +0 -1
- package/dist/cdn/chunks/MergeTagTextarea-BpVtpiNL.js.map +0 -1
- package/dist/cdn/chunks/ParagraphEditor-DGJmPAC1.js.map +0 -1
- package/dist/cdn/chunks/RestoreVersionDialog-D5qeCa0F.js.map +0 -1
- package/dist/cdn/chunks/RichTextEditorContent-DyGiXKKI.js.map +0 -1
- package/dist/cdn/chunks/SaveBlockDialog-B0TJYxd8.js.map +0 -1
- package/dist/cdn/chunks/SavedBlocksBrowserModal-D8Ly7LrA.js.map +0 -1
- package/dist/cdn/chunks/SavedBlocksPanels-Co1cbWR8.js.map +0 -1
- package/dist/cdn/chunks/SavedBlocksPickBar-DNtVbpm-.js.map +0 -1
- package/dist/cdn/chunks/TemplateSettings-BRc878ZF.js.map +0 -1
- package/dist/cdn/chunks/TestEmailModal-CIui7VfS.js.map +0 -1
- package/dist/cdn/chunks/TestEmailPanel-vKvruW_r.js.map +0 -1
- package/dist/cdn/chunks/TitleEditor-BI-9Nnj3.js.map +0 -1
- package/dist/cdn/chunks/Toolbar-CYnnArxv.js.map +0 -1
- package/dist/cdn/chunks/TplModal-B3nZeGWK.js.map +0 -1
- package/dist/cdn/chunks/VersionHistoryMenu-CMGfAKuV.js.map +0 -1
- package/dist/cdn/chunks/VersionHistoryPanels-Bb2ouQg7.js.map +0 -1
- package/dist/cdn/chunks/VersionPreviewBanner-573UP-g4.js.map +0 -1
- package/dist/cdn/chunks/WrapperBlock-DVu632LD.js.map +0 -1
- package/dist/cdn/chunks/ca-YfIxwO1G.js.map +0 -1
- package/dist/cdn/chunks/composables-DY3anqHO.js.map +0 -1
- package/dist/cdn/chunks/da-CM6DCvRG.js.map +0 -1
- package/dist/cdn/chunks/de-Dugz1zXC.js.map +0 -1
- package/dist/cdn/chunks/editor-modal-CXSSZplR.js.map +0 -1
- package/dist/cdn/chunks/en-BykoFuFY.js.map +0 -1
- package/dist/cdn/chunks/en-DYMYt1TN.js +0 -1
- package/dist/cdn/chunks/es-DaWsTkpj.js.map +0 -1
- package/dist/cdn/chunks/extensions-BWVlr8Ga.js.map +0 -1
- package/dist/cdn/chunks/fr-DqwQHtJo.js.map +0 -1
- package/dist/cdn/chunks/ja-BH4MS1Ye.js.map +0 -1
- package/dist/cdn/chunks/nl-BQl1_UHv.js.map +0 -1
- package/dist/cdn/chunks/pt-BR-eyzmU9Vs.js.map +0 -1
- package/dist/cdn/chunks/socialIcons-kYhdXJ9P.js.map +0 -1
- package/dist/cdn/chunks/src-B7X7x_ST.js +0 -707
- package/dist/cdn/chunks/src-B7X7x_ST.js.map +0 -1
- package/dist/cdn/chunks/src-BmzzkUf7.js.map +0 -1
- package/dist/cdn/chunks/src-DY2kMjoD.js.map +0 -1
- package/dist/cdn/chunks/tiptap-B7gxx0aJ.js.map +0 -1
- package/dist/cdn/chunks/useLocalizedDisplay-B5wMJLru.js +0 -33
- package/dist/dist-CkIeJEsa.js +0 -4
- package/dist/dist-eAgG-nCb.js +0 -4
- package/dist/en-DvCaYqiR.js +0 -1
- package/dist/useLocalizedDisplay-CbFM0cCV.js +0 -31
- package/dist/withCurrentFont-y0O5kOLW.js +0 -18
|
@@ -1,14 +1,14 @@
|
|
|
1
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 {
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as he } from "./upload-
|
|
5
|
-
import { t as ge } from "./loader-circle-
|
|
2
|
+
import { C as T, Ct as E, D, E as ee, Ht as te, I as O, J as k, Jt as A, M as j, Mt as M, Nt as ne, O as re, Ot as N, P, Rt as ie, T as F, Ut as I, V as ae, Vt as L, Zt as oe, _ as R, en as z, ft as B, g as V, jt as se, k as H, kt as U, ot as W, p as G, pn as ce, pt as le, rn as ue, rt as K, sn as de, un as fe, v as pe, xt as me, y as q } from "./dist-DsA7NeIy.js";
|
|
3
|
+
import { t as J } from "./createLucideIcon-B6Zkn9r0.js";
|
|
4
|
+
import { t as he } from "./upload-B_Eoqj-4.js";
|
|
5
|
+
import { t as ge } from "./loader-circle-DCkSXApP.js";
|
|
6
6
|
import { B as _e, C as ve, W as ye, u as be } from "./keys-B4DimcgX.js";
|
|
7
|
-
import { t as
|
|
8
|
-
import { r as
|
|
7
|
+
import { t as Y } from "./useI18n-Cx9W7OWb.js";
|
|
8
|
+
import { r as xe } from "./dist-B6ptxfPo.js";
|
|
9
9
|
import { i as Se, r as Ce } from "./usePopoverPosition-DF0ZYH7g.js";
|
|
10
10
|
// ../core/dist/index.js
|
|
11
|
-
var
|
|
11
|
+
var X = (e) => typeof e == "object" && !!e && !Array.isArray(e), we = (e) => Array.isArray(e) && e.length > 0 && e.every((e) => X(e) && typeof e.id == "string"), Te = /* @__PURE__ */ new Set([
|
|
12
12
|
"id",
|
|
13
13
|
"type",
|
|
14
14
|
"children",
|
|
@@ -19,38 +19,38 @@ var Y = (e) => typeof e == "object" && !!e && !Array.isArray(e), we = (e) => Arr
|
|
|
19
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 (!N(i)) continue;
|
|
23
|
+
let n = i.split("."), a = n.pop(), o = n.join("."), s = I(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 && X(c) && I(c, i) === void 0 && X(I(e, a)) && (c[i] = {}, r.add(a)), c = I(c, i);
|
|
27
27
|
}
|
|
28
28
|
if (Array.isArray(c)) {
|
|
29
|
-
let e = c.findIndex((e) =>
|
|
29
|
+
let e = c.findIndex((e) => X(e) && e.id === a);
|
|
30
30
|
if (e < 0) continue;
|
|
31
31
|
s === void 0 ? c.splice(e, 1) : c[e] = z(s);
|
|
32
|
-
} else
|
|
32
|
+
} else X(c) && (s === void 0 ? delete c[a] : c[a] = z(s), o && Object.keys(c).length === 0 && I(e, o) === void 0 && Ee(e, t, [o]));
|
|
33
33
|
}
|
|
34
34
|
return r;
|
|
35
35
|
}
|
|
36
36
|
function De(e, t, n, r, i = !0, a = /* @__PURE__ */ new Set()) {
|
|
37
|
-
if (
|
|
37
|
+
if (X(e) && X(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
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
41
|
t && De(t, o, `${n}.${o.id}`, r, i, a);
|
|
42
42
|
}
|
|
43
|
-
else
|
|
43
|
+
else K(e, t) || r.set(n, t);
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function Z(e, t, n, r = [], i = /* @__PURE__ */ new Set()) {
|
|
46
46
|
let a = /* @__PURE__ */ new Map();
|
|
47
47
|
De(e, t, "", a, e.type !== "custom", i);
|
|
48
|
-
let o = new Set(e.type === "custom" ?
|
|
49
|
-
for (let [t, r] of a) if ((e.type === "custom" ? o.has(t) :
|
|
48
|
+
let o = new Set(e.type === "custom" ? ce(e, r) : []), s = {}, c = {};
|
|
49
|
+
for (let [t, r] of a) if ((e.type === "custom" ? o.has(t) : M(e.type, t)) && typeof r == "string" && I(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: de(String(
|
|
53
|
+
sourceHash: de(String(I(e, t) ?? ""))
|
|
54
54
|
};
|
|
55
55
|
} else c[t] = r === void 0 ? null : r;
|
|
56
56
|
let l = {};
|
|
@@ -59,7 +59,7 @@ function X(e, t, n, r = [], i = /* @__PURE__ */ new Set()) {
|
|
|
59
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) =>
|
|
62
|
+
let o = e[n], s = t[n], c = (e) => Array.isArray(e) && e.every((e) => X(e) && typeof e.id == "string");
|
|
63
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) => z(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);
|
|
@@ -79,11 +79,11 @@ function ke(e, t, n) {
|
|
|
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 (V.includes(t) && typeof r == "string" && I(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: de(String(
|
|
86
|
+
sourceHash: de(String(I(e, t) ?? ""))
|
|
87
87
|
};
|
|
88
88
|
} else (a.set ??= {})[t] = r === void 0 ? null : r;
|
|
89
89
|
return a;
|
|
@@ -94,25 +94,25 @@ function Ae(e, t, n, r, i, a = []) {
|
|
|
94
94
|
...Object.keys(t.set ?? {}),
|
|
95
95
|
...Object.keys(n.text ?? {}),
|
|
96
96
|
...Object.keys(n.set ?? {})
|
|
97
|
-
])].filter((e) => !
|
|
97
|
+
])].filter((e) => !K(t.text?.[e], n.text?.[e]) || !K(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 = I(i, e), n = s.filter((t) => t.startsWith(`${e}.`) && K(I(r, t), I(i, t)));
|
|
100
|
+
if (K(t, I(r, e))) delete o.set[e];
|
|
101
|
+
else if (n.length && X(I(r, e)) && X(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 (X(t) && X(a)) for (let n of /* @__PURE__ */ new Set([...Object.keys(t), ...Object.keys(a)])) i(`${e}.${n}`, t[n], a[n]);
|
|
106
|
+
else if (X(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 X(r) && typeof r.type == "string" && se(r, e, a) || o.text?.[e] && o.text[e].value === a || ((o.set ??= {})[e] = a === void 0 ? null : z(a));
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
|
-
i(e,
|
|
110
|
+
i(e, I(r, e), t);
|
|
111
111
|
} else o.set[e] = t === void 0 ? null : z(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
|
+
K(r, I(i, n)) || delete o[t][n];
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
for (let e of s) if (!c.includes(e)) {
|
|
@@ -134,13 +134,13 @@ function Me(e, t, n) {
|
|
|
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) || !r && o &&
|
|
137
|
+
if (!r && e.findBlockLocation && !s || !r && e.isBlockLocked(a, !0) || !r && o && H(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
|
+
D(t), re(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,7 +148,7 @@ function Me(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 >= le(t.columns)) return !1;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
return t !== "moveBlock" || s?.targetSectionId !== l || (s?.columnIndex ?? 0) !== u || s?.index !== n[1];
|
|
@@ -158,7 +158,7 @@ function Pe(e, t) {
|
|
|
158
158
|
Ne.set(e, t);
|
|
159
159
|
for (let n of Object.values(e)) typeof n == "function" && Ne.set(n, t);
|
|
160
160
|
}
|
|
161
|
-
function
|
|
161
|
+
function Fe(e, t) {
|
|
162
162
|
let n = Ne.get(e);
|
|
163
163
|
n && Ne.set(t, n);
|
|
164
164
|
}
|
|
@@ -180,19 +180,19 @@ function Q(e, t, n) {
|
|
|
180
180
|
}
|
|
181
181
|
return Me(o, t, n);
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function Ie(e) {
|
|
184
184
|
return e instanceof Error ? e : Error(String(e), { cause: e });
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function Le(e, t) {
|
|
187
187
|
try {
|
|
188
188
|
t();
|
|
189
189
|
} catch (t) {
|
|
190
|
-
e?.(
|
|
190
|
+
e?.(Ie(t));
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
let n = t.content ??
|
|
195
|
-
|
|
193
|
+
function Re(t) {
|
|
194
|
+
let n = t.content ?? ae(t.defaultFontFamily, t.templateDefaults);
|
|
195
|
+
D(n), re(n);
|
|
196
196
|
let i = s({
|
|
197
197
|
template: null,
|
|
198
198
|
content: n,
|
|
@@ -208,10 +208,10 @@ function Le(t) {
|
|
|
208
208
|
}), a = g(i, "activeLocale"), o = [];
|
|
209
209
|
function c(e) {
|
|
210
210
|
let t = W(i.content);
|
|
211
|
-
if (e === t && (e = null), e !== null && !i.content.settings.locales?.includes(e)) throw new
|
|
211
|
+
if (e === t && (e = null), e !== null && !i.content.settings.locales?.includes(e)) throw new q(`This template has no "${e}" version.`, void 0, "unknown_locale");
|
|
212
212
|
a.value = e;
|
|
213
213
|
}
|
|
214
|
-
v(() => a.value ?? W(i.content), (e) =>
|
|
214
|
+
v(() => a.value ?? W(i.content), (e) => Le(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 Le(t) {
|
|
|
221
221
|
o = e;
|
|
222
222
|
}
|
|
223
223
|
function d(e) {
|
|
224
|
-
return
|
|
224
|
+
return k(i.content, e, o);
|
|
225
225
|
}
|
|
226
226
|
function f(e, n) {
|
|
227
227
|
if (!l()) return null;
|
|
228
|
-
if (e === "addLocale" && (!
|
|
228
|
+
if (e === "addLocale" && (!E(n) || t.localization && !t.localization.locales.includes(n))) throw new q(`Locale "${n}" is not enabled.`, void 0, "unknown_locale");
|
|
229
229
|
let r = z(i.content);
|
|
230
|
-
return
|
|
230
|
+
return ee(r, [{
|
|
231
231
|
op: e,
|
|
232
232
|
locale: n
|
|
233
|
-
}]),
|
|
233
|
+
}]), K(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 Le(t) {
|
|
|
251
251
|
}
|
|
252
252
|
function b(e, t) {
|
|
253
253
|
let [n, r] = t;
|
|
254
|
-
if (!a.value || !l() ||
|
|
255
|
-
let s =
|
|
254
|
+
if (!a.value || !l() || R(n)) return null;
|
|
255
|
+
let s = P(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 = ie(s, a.value, W(i.content)), d = Z(s, u, c, o), f = e === "resetLocaleFields" && Array.isArray(r) ? Ee(s, u, r) : void 0, p = e === "resetLocaleFields" ? Ae(c, d, Z(s, u, c, o, f), s, u, Array.isArray(r) ? r : []) : z(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 = de(String(
|
|
262
|
+
t && (t.sourceHash = de(String(I(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, K(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,32 +279,32 @@ function Le(t) {
|
|
|
279
279
|
function w(e, t) {
|
|
280
280
|
x("keepTranslations", [e, t]);
|
|
281
281
|
}
|
|
282
|
-
let T = p(0),
|
|
283
|
-
function
|
|
284
|
-
i.isDirty = !0,
|
|
282
|
+
let T = p(0), O = p(0), A = 0, j = 0;
|
|
283
|
+
function M() {
|
|
284
|
+
i.isDirty = !0, j++;
|
|
285
285
|
}
|
|
286
|
-
let
|
|
286
|
+
let ne = r({
|
|
287
287
|
get: () => i.content,
|
|
288
288
|
set: (e) => {
|
|
289
|
-
i.content = e,
|
|
289
|
+
i.content = e, M();
|
|
290
290
|
}
|
|
291
|
-
}),
|
|
292
|
-
function
|
|
291
|
+
}), N = r(() => i.selectedBlockId ? P(i.content.blocks, i.selectedBlockId) : null);
|
|
292
|
+
function P(e, t) {
|
|
293
293
|
for (let n of e) {
|
|
294
294
|
if (n.id === t) return n;
|
|
295
295
|
if (n.type === "section") for (let e of n.children) {
|
|
296
|
-
let n =
|
|
296
|
+
let n = P(e, t);
|
|
297
297
|
if (n) return n;
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
return null;
|
|
301
301
|
}
|
|
302
|
-
function
|
|
302
|
+
function F(e, t, n = { blocks: e }) {
|
|
303
303
|
for (let r = 0; r < e.length; r++) {
|
|
304
304
|
let i = e[r];
|
|
305
305
|
if (i.id === t) return n;
|
|
306
306
|
if (i.type === "section") for (let e = 0; e < i.children.length; e++) {
|
|
307
|
-
let n =
|
|
307
|
+
let n = F(i.children[e], t, {
|
|
308
308
|
blocks: i.children[e],
|
|
309
309
|
sectionId: i.id,
|
|
310
310
|
columnIndex: e
|
|
@@ -314,7 +314,7 @@ function Le(t) {
|
|
|
314
314
|
}
|
|
315
315
|
return null;
|
|
316
316
|
}
|
|
317
|
-
function
|
|
317
|
+
function R(e, n = !1) {
|
|
318
318
|
let r = a.value ?? t.lockLocale?.value ?? null;
|
|
319
319
|
for (let [i, a] of t.lockedBlocks?.value ?? []) {
|
|
320
320
|
let o = a;
|
|
@@ -324,8 +324,8 @@ function Le(t) {
|
|
|
324
324
|
}
|
|
325
325
|
return !1;
|
|
326
326
|
}
|
|
327
|
-
function
|
|
328
|
-
let t =
|
|
327
|
+
function B(e) {
|
|
328
|
+
let t = F(i.content.blocks, e);
|
|
329
329
|
if (!t) return null;
|
|
330
330
|
let n = t.blocks.findIndex((t) => t.id === e);
|
|
331
331
|
return n === -1 ? null : {
|
|
@@ -334,84 +334,84 @@ function Le(t) {
|
|
|
334
334
|
index: n
|
|
335
335
|
};
|
|
336
336
|
}
|
|
337
|
-
function
|
|
338
|
-
|
|
337
|
+
function V(e, t = !0) {
|
|
338
|
+
D(e), re(e), i.content = e, t && M();
|
|
339
339
|
}
|
|
340
|
-
function
|
|
341
|
-
e &&
|
|
340
|
+
function se(e) {
|
|
341
|
+
e && R(e) || (i.selectedBlockId = e);
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function U(e) {
|
|
344
344
|
i.viewport = e;
|
|
345
345
|
}
|
|
346
|
-
function
|
|
346
|
+
function G(e) {
|
|
347
347
|
i.darkMode = e;
|
|
348
348
|
}
|
|
349
349
|
function ce(e) {
|
|
350
350
|
i.uiTheme = e;
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function le(e) {
|
|
353
353
|
i.previewMode = e, e && (i.selectedBlockId = null);
|
|
354
354
|
}
|
|
355
|
-
function
|
|
355
|
+
function ue(e, t) {
|
|
356
356
|
if (!l()) return !1;
|
|
357
|
-
let n =
|
|
357
|
+
let n = P(i.content.blocks, e);
|
|
358
358
|
if (!n) return !1;
|
|
359
|
-
if ("l10n" in t) throw new
|
|
359
|
+
if ("l10n" in t) throw new q("l10n is immutable in updateBlock.", void 0, "invalid_operation");
|
|
360
360
|
let r = {
|
|
361
361
|
...n,
|
|
362
362
|
...t
|
|
363
|
-
}, o = z(n), s = Oe(o, r, (e) =>
|
|
363
|
+
}, o = z(n), s = Oe(o, r, (e) => P(i.content.blocks, e)), c = "children" in t, u = s || c || r.type !== n.type;
|
|
364
364
|
if (c && r.type === "section" && Array.isArray(r.children)) {
|
|
365
|
-
let e = new Set(
|
|
366
|
-
for (let n of r.children) for (let r of n) for (let n of
|
|
367
|
-
if (t.has(n) ||
|
|
365
|
+
let e = new Set(H(n).slice(1)), t = /* @__PURE__ */ new Set();
|
|
366
|
+
for (let n of r.children) for (let r of n) for (let n of H(r)) {
|
|
367
|
+
if (t.has(n) || R(n, !0) || P(i.content.blocks, n) !== null && !e.has(n)) return !1;
|
|
368
368
|
t.add(n);
|
|
369
369
|
}
|
|
370
370
|
if (a.value) {
|
|
371
|
-
let e =
|
|
371
|
+
let e = H(o);
|
|
372
372
|
if (new Set(e).size !== e.length) return !1;
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
|
-
return !
|
|
375
|
+
return !R(e, u || "columns" in t) && (!u || !H(n).some((t) => t !== e && R(t, !0)));
|
|
376
376
|
}
|
|
377
|
-
function
|
|
378
|
-
if (!
|
|
379
|
-
let r =
|
|
377
|
+
function fe(e, n) {
|
|
378
|
+
if (!ue(e, n)) return;
|
|
379
|
+
let r = P(i.content.blocks, e);
|
|
380
380
|
if (!r) return;
|
|
381
381
|
let s = a.value;
|
|
382
382
|
if (s) {
|
|
383
|
-
let a =
|
|
383
|
+
let a = ie(r, s, W(i.content)), c = {
|
|
384
384
|
...a,
|
|
385
385
|
...n
|
|
386
|
-
}, l = z(r), u = Oe(l, c, (e) =>
|
|
387
|
-
if (
|
|
386
|
+
}, l = z(r), u = Oe(l, c, (e) => P(i.content.blocks, e));
|
|
387
|
+
if (R(e, u)) return;
|
|
388
388
|
u && t.onStructureChange?.();
|
|
389
|
-
let d =
|
|
390
|
-
delete r.l10n, Object.assign(r, d), y(r, Ae(r.l10n?.[s],
|
|
389
|
+
let d = L(l);
|
|
390
|
+
delete r.l10n, Object.assign(r, d), y(r, Ae(r.l10n?.[s], Z(r, a, r.l10n?.[s], o), Z(r, c, r.l10n?.[s], o), r, c));
|
|
391
391
|
} else {
|
|
392
|
-
if (
|
|
393
|
-
let t =
|
|
392
|
+
if (R(e, "children" in n || "columns" in n)) return;
|
|
393
|
+
let t = L({
|
|
394
394
|
...r,
|
|
395
395
|
...n
|
|
396
396
|
});
|
|
397
397
|
delete r.l10n, Object.assign(r, t);
|
|
398
398
|
}
|
|
399
|
-
|
|
399
|
+
M();
|
|
400
400
|
}
|
|
401
|
-
function
|
|
402
|
-
if ("locales" in e || "l10n" in e) throw new
|
|
403
|
-
if ("locale" in e && e.locale !== W(i.content) && i.content.settings.locales?.length) throw new
|
|
401
|
+
function pe(e) {
|
|
402
|
+
if ("locales" in e || "l10n" in e) throw new q("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 q("The default locale can't change while language versions exist.", void 0, "invalid_operation");
|
|
404
404
|
}
|
|
405
405
|
function me(e) {
|
|
406
406
|
if (!l()) return;
|
|
407
|
-
|
|
407
|
+
pe(e);
|
|
408
408
|
let t = a.value;
|
|
409
|
-
if (!t) i.content.settings =
|
|
409
|
+
if (!t) i.content.settings = te({
|
|
410
410
|
...i.content.settings,
|
|
411
411
|
...e
|
|
412
412
|
});
|
|
413
413
|
else {
|
|
414
|
-
let n = i.content.settings, r =
|
|
414
|
+
let n = i.content.settings, r = oe(i.content, t).settings, a = {
|
|
415
415
|
...r,
|
|
416
416
|
locale: n.locale,
|
|
417
417
|
...e
|
|
@@ -421,122 +421,122 @@ function Le(t) {
|
|
|
421
421
|
[t]: s
|
|
422
422
|
} : n.l10n && (delete n.l10n[t], Object.keys(n.l10n).length || delete n.l10n);
|
|
423
423
|
}
|
|
424
|
-
|
|
424
|
+
M();
|
|
425
425
|
}
|
|
426
|
-
let
|
|
426
|
+
let J = {
|
|
427
427
|
canEdit: l,
|
|
428
428
|
content: () => i.content,
|
|
429
|
-
findBlock: (e) =>
|
|
430
|
-
findBlockLocation:
|
|
431
|
-
isBlockLocked:
|
|
429
|
+
findBlock: (e) => P(i.content.blocks, e),
|
|
430
|
+
findBlockLocation: B,
|
|
431
|
+
isBlockLocked: R
|
|
432
432
|
};
|
|
433
|
-
function
|
|
434
|
-
if (Me(
|
|
433
|
+
function he(e, n, r = 0, o) {
|
|
434
|
+
if (Me(J, "addBlock", [
|
|
435
435
|
e,
|
|
436
436
|
n,
|
|
437
437
|
r,
|
|
438
438
|
o
|
|
439
439
|
])) {
|
|
440
440
|
if (n) {
|
|
441
|
-
let t =
|
|
441
|
+
let t = P(i.content.blocks, n);
|
|
442
442
|
if (t && t.type === "section") {
|
|
443
443
|
t.children[r] = t.children[r] || [];
|
|
444
444
|
let n = t.children[r];
|
|
445
445
|
o !== void 0 && o < n.length ? n.splice(o, 0, e) : n.push(e);
|
|
446
446
|
}
|
|
447
447
|
} else o !== void 0 && o < i.content.blocks.length ? i.content.blocks.splice(o, 0, e) : i.content.blocks.push(e);
|
|
448
|
-
a.value && t.onStructureChange?.(),
|
|
448
|
+
a.value && t.onStructureChange?.(), M();
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
|
-
function
|
|
452
|
-
if (!Me(
|
|
453
|
-
let n =
|
|
451
|
+
function ge(e) {
|
|
452
|
+
if (!Me(J, "removeBlock", [e])) return;
|
|
453
|
+
let n = F(i.content.blocks, e);
|
|
454
454
|
if (n) {
|
|
455
455
|
let r = n.blocks.findIndex((t) => t.id === e);
|
|
456
456
|
if (r !== -1) {
|
|
457
457
|
let [e] = n.blocks.splice(r, 1);
|
|
458
|
-
i.selectedBlockId && new Set(
|
|
458
|
+
i.selectedBlockId && new Set(H(e)).has(i.selectedBlockId) && (i.selectedBlockId = null), a.value && t.onStructureChange?.(), M();
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
|
-
function
|
|
463
|
-
if (!Me(
|
|
462
|
+
function _e(e, n, r, o = 0) {
|
|
463
|
+
if (!Me(J, "moveBlock", [
|
|
464
464
|
e,
|
|
465
465
|
n,
|
|
466
466
|
r,
|
|
467
467
|
o
|
|
468
468
|
])) return;
|
|
469
|
-
let s =
|
|
469
|
+
let s = F(i.content.blocks, e), c = s.blocks.findIndex((t) => t.id === e), l;
|
|
470
470
|
if (r) {
|
|
471
|
-
let e =
|
|
471
|
+
let e = P(i.content.blocks, r);
|
|
472
472
|
e.children[o] = e.children[o] || [], l = e.children[o];
|
|
473
473
|
} else l = i.content.blocks;
|
|
474
474
|
let [u] = s.blocks.splice(c, 1);
|
|
475
|
-
l.splice(n, 0, u), a.value && t.onStructureChange?.(),
|
|
475
|
+
l.splice(n, 0, u), a.value && t.onStructureChange?.(), M();
|
|
476
476
|
}
|
|
477
|
-
function
|
|
478
|
-
|
|
477
|
+
function ve() {
|
|
478
|
+
M();
|
|
479
479
|
}
|
|
480
|
-
function
|
|
481
|
-
throw new
|
|
480
|
+
function ye(e, t) {
|
|
481
|
+
throw new q(`[Templatical] Templates: ${e} ${t}`);
|
|
482
482
|
}
|
|
483
|
-
function
|
|
484
|
-
|
|
483
|
+
function be(e) {
|
|
484
|
+
Le(t.onError, e);
|
|
485
485
|
}
|
|
486
|
-
function
|
|
486
|
+
function Y(e) {
|
|
487
487
|
let { templates: n } = t;
|
|
488
|
-
return n ||
|
|
488
|
+
return n || ye(e, "needs a templates provider. Pass one as `init({ templates })` to enable saving and loading."), n;
|
|
489
489
|
}
|
|
490
|
-
function
|
|
490
|
+
function xe(e) {
|
|
491
491
|
i.template && (i.template = {
|
|
492
492
|
...i.template,
|
|
493
493
|
name: e
|
|
494
|
-
},
|
|
494
|
+
}, M());
|
|
495
495
|
}
|
|
496
|
-
async function
|
|
497
|
-
let n =
|
|
498
|
-
typeof r != "function" &&
|
|
499
|
-
let a, o = ++
|
|
496
|
+
async function Se(e) {
|
|
497
|
+
let n = Y("create()"), { create: r } = n;
|
|
498
|
+
typeof r != "function" && ye("create()", "is disabled by the provider — its `create` is `false`.");
|
|
499
|
+
let a, o = ++A;
|
|
500
500
|
i.isLoading = !0;
|
|
501
501
|
try {
|
|
502
|
-
e?.content !== void 0 && (i.content = e.content,
|
|
503
|
-
let t =
|
|
502
|
+
e?.content !== void 0 && (i.content = e.content, O.value++);
|
|
503
|
+
let t = j;
|
|
504
504
|
a = await r(e?.name === void 0 ? { content: i.content } : {
|
|
505
505
|
name: e.name,
|
|
506
506
|
content: i.content
|
|
507
|
-
}), i.template = a,
|
|
507
|
+
}), i.template = a, j === t && (i.isDirty = !1), T.value++;
|
|
508
508
|
} catch (e) {
|
|
509
509
|
throw t.onError?.(e), e;
|
|
510
510
|
} finally {
|
|
511
|
-
|
|
511
|
+
A === o && (i.isLoading = !1);
|
|
512
512
|
}
|
|
513
|
-
return
|
|
513
|
+
return be(() => n.onCreated?.(a)), a;
|
|
514
514
|
}
|
|
515
|
-
async function
|
|
516
|
-
let r =
|
|
515
|
+
async function Ce(e, n) {
|
|
516
|
+
let r = Y("load()"), a, o = ++A;
|
|
517
517
|
i.isLoading = !0;
|
|
518
518
|
try {
|
|
519
|
-
if (a = await r.load(e),
|
|
520
|
-
i.template = a, i.content = a.content,
|
|
519
|
+
if (a = await r.load(e), D(a.content), re(a.content), n && !n()) return a;
|
|
520
|
+
i.template = a, i.content = a.content, O.value++, i.isDirty = !1, T.value++;
|
|
521
521
|
} catch (e) {
|
|
522
522
|
throw t.onError?.(e), e;
|
|
523
523
|
} finally {
|
|
524
|
-
|
|
524
|
+
A === o && (i.isLoading = !1);
|
|
525
525
|
}
|
|
526
|
-
return
|
|
526
|
+
return be(() => r.onLoaded?.(a)), a;
|
|
527
527
|
}
|
|
528
|
-
async function
|
|
529
|
-
let n =
|
|
530
|
-
typeof r != "function" &&
|
|
528
|
+
async function X(e = "api") {
|
|
529
|
+
let n = Y("save()"), { save: r } = n;
|
|
530
|
+
typeof r != "function" && ye("save()", "is disabled by the provider — its `save` is `false`.");
|
|
531
531
|
let a = i.template;
|
|
532
|
-
a ||
|
|
532
|
+
a || ye("save()", "has no template loaded. Call create() or load() first.");
|
|
533
533
|
let o = a.name === void 0 ? { content: i.content } : {
|
|
534
534
|
name: a.name,
|
|
535
535
|
content: i.content
|
|
536
536
|
}, s;
|
|
537
537
|
i.isSaving = !0;
|
|
538
538
|
try {
|
|
539
|
-
let e =
|
|
539
|
+
let e = j;
|
|
540
540
|
if (s = await r(a.id, o), i.template?.id === a.id) {
|
|
541
541
|
let e = i.template.name;
|
|
542
542
|
i.template = e === a.name ? s : {
|
|
@@ -544,23 +544,23 @@ function Le(t) {
|
|
|
544
544
|
name: e
|
|
545
545
|
};
|
|
546
546
|
}
|
|
547
|
-
|
|
547
|
+
j === e && (i.isDirty = !1);
|
|
548
548
|
} catch (e) {
|
|
549
549
|
throw t.onError?.(e), e;
|
|
550
550
|
} finally {
|
|
551
551
|
i.isSaving = !1;
|
|
552
552
|
}
|
|
553
|
-
return
|
|
553
|
+
return be(() => n.onSaved?.(s, { trigger: e })), s;
|
|
554
554
|
}
|
|
555
|
-
function
|
|
555
|
+
function we() {
|
|
556
556
|
return i.template?.id !== void 0;
|
|
557
557
|
}
|
|
558
|
-
let
|
|
558
|
+
let Te = {
|
|
559
559
|
state: e(i),
|
|
560
560
|
loadVersion: e(T),
|
|
561
|
-
contentReplaced: e(
|
|
562
|
-
content:
|
|
563
|
-
selectedBlock:
|
|
561
|
+
contentReplaced: e(O),
|
|
562
|
+
content: ne,
|
|
563
|
+
selectedBlock: N,
|
|
564
564
|
activeLocale: a,
|
|
565
565
|
setActiveLocale: c,
|
|
566
566
|
addLocale: h,
|
|
@@ -570,31 +570,31 @@ function Le(t) {
|
|
|
570
570
|
keepTranslations: w,
|
|
571
571
|
setCustomBlockDefinitions: u,
|
|
572
572
|
createSetDefaultLocaleOperation: d,
|
|
573
|
-
isBlockLocked:
|
|
574
|
-
setContent:
|
|
575
|
-
selectBlock:
|
|
576
|
-
setViewport:
|
|
577
|
-
setDarkMode:
|
|
573
|
+
isBlockLocked: R,
|
|
574
|
+
setContent: V,
|
|
575
|
+
selectBlock: se,
|
|
576
|
+
setViewport: U,
|
|
577
|
+
setDarkMode: G,
|
|
578
578
|
setUiTheme: ce,
|
|
579
|
-
setPreviewMode:
|
|
580
|
-
updateBlock:
|
|
579
|
+
setPreviewMode: le,
|
|
580
|
+
updateBlock: fe,
|
|
581
581
|
updateSettings: me,
|
|
582
|
-
addBlock:
|
|
583
|
-
removeBlock:
|
|
584
|
-
moveBlock:
|
|
585
|
-
markDirty:
|
|
586
|
-
findBlockLocation:
|
|
587
|
-
setName:
|
|
588
|
-
create:
|
|
589
|
-
load:
|
|
590
|
-
save:
|
|
591
|
-
hasTemplate:
|
|
582
|
+
addBlock: he,
|
|
583
|
+
removeBlock: ge,
|
|
584
|
+
moveBlock: _e,
|
|
585
|
+
markDirty: ve,
|
|
586
|
+
findBlockLocation: B,
|
|
587
|
+
setName: xe,
|
|
588
|
+
create: Se,
|
|
589
|
+
load: Ce,
|
|
590
|
+
save: X,
|
|
591
|
+
hasTemplate: we
|
|
592
592
|
};
|
|
593
|
-
return Pe(
|
|
593
|
+
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;
|
|
594
594
|
}
|
|
595
|
-
var
|
|
596
|
-
function
|
|
597
|
-
let { content: t, setContent: n, maxSize: i =
|
|
595
|
+
var ze = 50, Be = 300, Ve = 1500;
|
|
596
|
+
function He(e) {
|
|
597
|
+
let { content: t, setContent: n, maxSize: i = ze } = e, a = p([]), o = p([]), s = p(!1), c = null, l = null, u = r(() => a.value.length > 0), d = r(() => o.value.length > 0);
|
|
598
598
|
function f() {
|
|
599
599
|
return z(t.value);
|
|
600
600
|
}
|
|
@@ -610,17 +610,17 @@ function Ve(e) {
|
|
|
610
610
|
function _(e) {
|
|
611
611
|
l && l.blockId === e ? (clearTimeout(l.timeoutId), l.timeoutId = setTimeout(() => {
|
|
612
612
|
l = null;
|
|
613
|
-
},
|
|
613
|
+
}, Be)) : (h(), m(f()), o.value = [], l = {
|
|
614
614
|
blockId: e,
|
|
615
615
|
timeoutId: setTimeout(() => {
|
|
616
616
|
l = null;
|
|
617
|
-
},
|
|
617
|
+
}, Be)
|
|
618
618
|
});
|
|
619
619
|
}
|
|
620
620
|
function v() {
|
|
621
621
|
s.value = !0, c && clearTimeout(c), c = setTimeout(() => {
|
|
622
622
|
s.value = !1, c = null;
|
|
623
|
-
},
|
|
623
|
+
}, Ve);
|
|
624
624
|
}
|
|
625
625
|
function y() {
|
|
626
626
|
if (a.value.length === 0) return;
|
|
@@ -653,14 +653,14 @@ function Ve(e) {
|
|
|
653
653
|
flushDebounce: h
|
|
654
654
|
};
|
|
655
655
|
}
|
|
656
|
-
function
|
|
656
|
+
function Ue(e) {
|
|
657
657
|
let { addBlock: t, removeBlock: n, updateBlock: r, selectBlock: i, findBlockLocation: a } = e;
|
|
658
658
|
function o(n, r, a) {
|
|
659
|
-
let o = typeof e.blockDefaults == "function" ? e.blockDefaults() : e.blockDefaults, s =
|
|
659
|
+
let o = typeof e.blockDefaults == "function" ? e.blockDefaults() : e.blockDefaults, s = O(n, o);
|
|
660
660
|
return t(s, r, a), i(s.id), s;
|
|
661
661
|
}
|
|
662
662
|
function s(e, n, r) {
|
|
663
|
-
let o =
|
|
663
|
+
let o = j(e);
|
|
664
664
|
if (!Q(t, "duplicateBlock", [
|
|
665
665
|
e,
|
|
666
666
|
n,
|
|
@@ -686,9 +686,9 @@ function He(e) {
|
|
|
686
686
|
updateBlockProperty: l
|
|
687
687
|
};
|
|
688
688
|
}
|
|
689
|
-
var
|
|
690
|
-
function
|
|
691
|
-
let { content: t, isDirty: n, onChange: r, debounce: i =
|
|
689
|
+
var We = 2e3;
|
|
690
|
+
function Ge(e) {
|
|
691
|
+
let { content: t, isDirty: n, onChange: r, debounce: i = We, enabled: a = !0 } = e, o = null, s = !1;
|
|
692
692
|
function c() {
|
|
693
693
|
return typeof a == "function" ? a() : a;
|
|
694
694
|
}
|
|
@@ -723,7 +723,7 @@ function We(e) {
|
|
|
723
723
|
destroy: h
|
|
724
724
|
};
|
|
725
725
|
}
|
|
726
|
-
function
|
|
726
|
+
function Ke(e) {
|
|
727
727
|
let t = s(/* @__PURE__ */ new Set()), n = r(() => t.size > 0);
|
|
728
728
|
function i(e) {
|
|
729
729
|
return t.has(e);
|
|
@@ -741,7 +741,7 @@ function Ge(e) {
|
|
|
741
741
|
hasHiddenBlocks: n
|
|
742
742
|
};
|
|
743
743
|
}
|
|
744
|
-
function
|
|
744
|
+
function qe(e) {
|
|
745
745
|
let t = p(!1), n = p(!1), i = r(() => !!e.definition.value?.dataSource), a = r(() => i.value && !e.block.value.dataSourceFetched);
|
|
746
746
|
async function o() {
|
|
747
747
|
let r = e.definition.value;
|
|
@@ -771,7 +771,7 @@ function Ke(e) {
|
|
|
771
771
|
needsFetch: a
|
|
772
772
|
};
|
|
773
773
|
}
|
|
774
|
-
function
|
|
774
|
+
function Je(e, t) {
|
|
775
775
|
e.contentReplaced && v(e.contentReplaced, () => t.clear()), e.activeLocale && v(e.activeLocale, () => t.flushDebounce?.());
|
|
776
776
|
for (let n of [
|
|
777
777
|
"addLocale",
|
|
@@ -783,7 +783,7 @@ function qe(e, t) {
|
|
|
783
783
|
let r = e[n];
|
|
784
784
|
r && (Object.assign(e, { [n]: (...i) => {
|
|
785
785
|
Q(e, n, i) && (["addLocale", "removeLocale"].includes(n) || !e.isBlockLocked(i[0])) && (t.record(), r(...i));
|
|
786
|
-
} }),
|
|
786
|
+
} }), Fe(r, e[n]));
|
|
787
787
|
}
|
|
788
788
|
let n = e.addBlock, r = e.removeBlock, i = e.moveBlock, a = e.updateBlock, o = e.updateSettings;
|
|
789
789
|
e.addBlock = (r, i, a, o) => {
|
|
@@ -802,44 +802,44 @@ function qe(e, t) {
|
|
|
802
802
|
a,
|
|
803
803
|
o
|
|
804
804
|
]) && (t.record(), i(n, r, a, o));
|
|
805
|
-
},
|
|
805
|
+
}, Fe(n, e.addBlock), Fe(r, e.removeBlock), Fe(i, e.moveBlock), e.updateBlock = (n, r) => {
|
|
806
806
|
Q(e, "updateBlock", [n, r]) && (e.isBlockLocked(n) || (t.recordDebounced(n), a(n, r)));
|
|
807
807
|
}, e.updateSettings = (n) => {
|
|
808
808
|
Q(e, "updateSettings", [n]) && (t.record(), o(n));
|
|
809
|
-
},
|
|
809
|
+
}, Fe(a, e.updateBlock), Fe(o, e.updateSettings);
|
|
810
810
|
}
|
|
811
|
-
var
|
|
811
|
+
var Ye = "root", Xe = /* @__PURE__ */ new Set([
|
|
812
812
|
"id",
|
|
813
813
|
"type",
|
|
814
814
|
"children",
|
|
815
815
|
"l10n"
|
|
816
|
-
]),
|
|
816
|
+
]), Ze = /* @__PURE__ */ new Set([
|
|
817
817
|
"id",
|
|
818
818
|
"type",
|
|
819
819
|
"children",
|
|
820
820
|
"columns",
|
|
821
821
|
"l10n"
|
|
822
|
-
]),
|
|
823
|
-
function
|
|
824
|
-
return e === null ?
|
|
822
|
+
]), Qe = /* @__PURE__ */ new Set(), $e = /* @__PURE__ */ new Set(["locales", "l10n"]);
|
|
823
|
+
function et(e) {
|
|
824
|
+
return e === null ? Ye : "wrapperId" in e ? JSON.stringify(["wrapper", e.wrapperId]) : JSON.stringify([
|
|
825
825
|
"section",
|
|
826
826
|
e.sectionId,
|
|
827
827
|
e.column
|
|
828
828
|
]);
|
|
829
829
|
}
|
|
830
|
-
function
|
|
830
|
+
function tt(e) {
|
|
831
831
|
let t = e.children;
|
|
832
832
|
return e.type === "section" && Array.isArray(t) ? t : [];
|
|
833
833
|
}
|
|
834
|
-
function
|
|
834
|
+
function nt(e) {
|
|
835
835
|
let t = /* @__PURE__ */ new Map(), n = (e, r) => {
|
|
836
836
|
e.forEach((e, i) => {
|
|
837
837
|
t.has(e.id) || t.set(e.id, {
|
|
838
838
|
block: e,
|
|
839
839
|
parent: r,
|
|
840
|
-
key:
|
|
840
|
+
key: et(r),
|
|
841
841
|
index: i
|
|
842
|
-
}),
|
|
842
|
+
}), tt(e).forEach((t, r) => {
|
|
843
843
|
Array.isArray(t) && n(t, {
|
|
844
844
|
sectionId: e.id,
|
|
845
845
|
column: r
|
|
@@ -849,7 +849,7 @@ function tt(e) {
|
|
|
849
849
|
};
|
|
850
850
|
return n(e, null), t;
|
|
851
851
|
}
|
|
852
|
-
function
|
|
852
|
+
function rt(e) {
|
|
853
853
|
let t = [], n = Array(e.length).fill(-1);
|
|
854
854
|
e.forEach((r, i) => {
|
|
855
855
|
let a = 0, o = t.length;
|
|
@@ -863,17 +863,17 @@ function nt(e) {
|
|
|
863
863
|
for (; i !== -1;) r.add(i), i = n[i];
|
|
864
864
|
return r;
|
|
865
865
|
}
|
|
866
|
-
function
|
|
866
|
+
function it(e, t, n) {
|
|
867
867
|
let r = {}, i = [];
|
|
868
|
-
for (let i of Object.keys(t)) n.has(i) || t[i] === void 0 ||
|
|
868
|
+
for (let i of Object.keys(t)) n.has(i) || t[i] === void 0 || K(e[i], t[i]) || (r[i] = z(t[i]));
|
|
869
869
|
for (let r of Object.keys(e)) n.has(r) || e[r] === void 0 || t[r] === void 0 && i.push(r);
|
|
870
870
|
return {
|
|
871
871
|
set: r,
|
|
872
872
|
unset: i
|
|
873
873
|
};
|
|
874
874
|
}
|
|
875
|
-
function
|
|
876
|
-
let n =
|
|
875
|
+
function at(e = {}, t = {}) {
|
|
876
|
+
let n = it(e.text ?? {}, t.text ?? {}, Qe), r = it(e.set ?? {}, t.set ?? {}, Qe), i = [.../* @__PURE__ */ new Set([...n.unset, ...r.unset])];
|
|
877
877
|
return {
|
|
878
878
|
...Object.keys(n.set).length > 0 ? { text: n.set } : {},
|
|
879
879
|
...Object.keys(r.set).length > 0 ? { set: r.set } : {},
|
|
@@ -881,15 +881,15 @@ function it(e = {}, t = {}) {
|
|
|
881
881
|
...e.hidden === t.hidden ? {} : { hidden: t.hidden === !0 }
|
|
882
882
|
};
|
|
883
883
|
}
|
|
884
|
-
function
|
|
884
|
+
function ot(e, t) {
|
|
885
885
|
if (e.settings.locale !== t.settings.locale && (e.settings.locales?.length || t.settings.locales?.length)) return [{
|
|
886
886
|
op: "setContent",
|
|
887
887
|
content: z(t)
|
|
888
888
|
}];
|
|
889
|
-
let n =
|
|
889
|
+
let n = nt(e.blocks), r = nt(t.blocks), i = [], a = new Set(t.settings.locales ?? []), o = new Set(e.settings.locales ?? []), s = (e) => {
|
|
890
890
|
let t = r.get(e), i = n.get(e);
|
|
891
891
|
return t !== void 0 && i !== void 0 && t.block.type !== i.block.type;
|
|
892
|
-
}, c = (e) => r.has(e.id) && !s(e.id), l = (e) => e.type === "wrapper" && Array.isArray(e.children) ? [e.children] :
|
|
892
|
+
}, c = (e) => r.has(e.id) && !s(e.id), l = (e) => e.type === "wrapper" && Array.isArray(e.children) ? [e.children] : tt(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) => {
|
|
893
893
|
let n = "kept";
|
|
894
894
|
t === "dropped" ? (d.add(e.id), n = "dropped") : s(e.id) ? (i.push({
|
|
895
895
|
op: "deleteBlock",
|
|
@@ -903,14 +903,14 @@ function at(e, t) {
|
|
|
903
903
|
for (let t of e.blocks) p(t, "kept");
|
|
904
904
|
let m = (e) => n.has(e) && !d.has(e), h = (e) => {
|
|
905
905
|
let t = z(e);
|
|
906
|
-
return t.type === "section" ? t.children =
|
|
906
|
+
return t.type === "section" ? t.children = tt(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;
|
|
907
907
|
}, g = (e, t, r) => {
|
|
908
|
-
let a =
|
|
908
|
+
let a = et(e), o = [], s = [];
|
|
909
909
|
t.forEach((e, t) => {
|
|
910
910
|
let r = n.get(e.id);
|
|
911
911
|
m(e.id) && r !== void 0 && r.key === a && (o.push(r.index), s.push(t));
|
|
912
912
|
});
|
|
913
|
-
let c = new Set([...
|
|
913
|
+
let c = new Set([...rt(o)].map((e) => s[e]));
|
|
914
914
|
t.forEach((n, a) => {
|
|
915
915
|
if (c.has(a) || r(n)) return;
|
|
916
916
|
let o = a > 0 ? t[a - 1].id : null;
|
|
@@ -931,7 +931,7 @@ function at(e, t) {
|
|
|
931
931
|
let _ = [...r.values()].map(({ block: e }) => e).filter((e) => e.type === "section"), v = /* @__PURE__ */ new Set(), y = (e) => {
|
|
932
932
|
for (let t of _) {
|
|
933
933
|
if (!m(t.id)) continue;
|
|
934
|
-
let r =
|
|
934
|
+
let r = tt(n.get(t.id).block).length, a = tt(t).length;
|
|
935
935
|
(e ? a > r : a < r) && (i.push({
|
|
936
936
|
op: "updateBlock",
|
|
937
937
|
blockId: t.id,
|
|
@@ -947,7 +947,7 @@ function at(e, t) {
|
|
|
947
947
|
}
|
|
948
948
|
for (let e of _) {
|
|
949
949
|
let t = !m(e.id);
|
|
950
|
-
|
|
950
|
+
tt(e).forEach((n, r) => {
|
|
951
951
|
Array.isArray(n) && g({
|
|
952
952
|
sectionId: e.id,
|
|
953
953
|
column: r
|
|
@@ -992,7 +992,7 @@ function at(e, t) {
|
|
|
992
992
|
i.unshift(...w, ...E);
|
|
993
993
|
for (let [e, t] of r) {
|
|
994
994
|
if (!m(e)) continue;
|
|
995
|
-
let r =
|
|
995
|
+
let r = it(n.get(e).block, t.block, v.has(e) ? Ze : Xe), { set: a } = r, o = T.has(e) ? r.unset.filter((e) => e !== "wrapper") : r.unset;
|
|
996
996
|
(Object.keys(a).length !== 0 || o.length !== 0) && i.push({
|
|
997
997
|
op: "updateBlock",
|
|
998
998
|
blockId: e,
|
|
@@ -1000,7 +1000,7 @@ function at(e, t) {
|
|
|
1000
1000
|
...o.length > 0 ? { unset: o } : {}
|
|
1001
1001
|
});
|
|
1002
1002
|
}
|
|
1003
|
-
let D =
|
|
1003
|
+
let D = it(e.settings, t.settings, $e);
|
|
1004
1004
|
(Object.keys(D.set).length > 0 || D.unset.length > 0) && i.push({
|
|
1005
1005
|
op: "updateSettings",
|
|
1006
1006
|
...Object.keys(D.set).length > 0 ? { set: D.set } : {},
|
|
@@ -1015,7 +1015,7 @@ function at(e, t) {
|
|
|
1015
1015
|
let r = n.get(e).block.l10n ?? {}, o = t.block.l10n ?? {};
|
|
1016
1016
|
for (let t of /* @__PURE__ */ new Set([...Object.keys(r), ...Object.keys(o)])) {
|
|
1017
1017
|
if (!a.has(t)) continue;
|
|
1018
|
-
let n =
|
|
1018
|
+
let n = at(r[t], o[t]);
|
|
1019
1019
|
C.has(JSON.stringify([e, t])) && delete n.hidden, Object.keys(n).length > 0 && i.push({
|
|
1020
1020
|
op: "updateBlockLocale",
|
|
1021
1021
|
blockId: e,
|
|
@@ -1024,10 +1024,10 @@ function at(e, t) {
|
|
|
1024
1024
|
});
|
|
1025
1025
|
}
|
|
1026
1026
|
}
|
|
1027
|
-
let
|
|
1028
|
-
for (let e of /* @__PURE__ */ new Set([...Object.keys(
|
|
1027
|
+
let ee = e.settings.l10n ?? {}, te = t.settings.l10n ?? {};
|
|
1028
|
+
for (let e of /* @__PURE__ */ new Set([...Object.keys(ee), ...Object.keys(te)])) {
|
|
1029
1029
|
if (!a.has(e)) continue;
|
|
1030
|
-
let t =
|
|
1030
|
+
let t = at(ee[e], te[e]);
|
|
1031
1031
|
Object.keys(t).length > 0 && i.push({
|
|
1032
1032
|
op: "updateSettingsLocale",
|
|
1033
1033
|
locale: e,
|
|
@@ -1046,7 +1046,7 @@ function $(e) {
|
|
|
1046
1046
|
};
|
|
1047
1047
|
return e.forEach(n), t;
|
|
1048
1048
|
}
|
|
1049
|
-
function
|
|
1049
|
+
function st(e, t) {
|
|
1050
1050
|
if (t === null) return e.blocks;
|
|
1051
1051
|
if ("sectionId" in t) {
|
|
1052
1052
|
let n = $(e.blocks).get(t.sectionId);
|
|
@@ -1055,7 +1055,7 @@ function ot(e, t) {
|
|
|
1055
1055
|
let n = $(e.blocks).get(t.wrapperId);
|
|
1056
1056
|
return n?.type === "wrapper" ? n.children : [];
|
|
1057
1057
|
}
|
|
1058
|
-
function
|
|
1058
|
+
function ct(e, t) {
|
|
1059
1059
|
let n = (e, r) => {
|
|
1060
1060
|
let i = e.findIndex((e) => e.id === t);
|
|
1061
1061
|
if (i >= 0) return {
|
|
@@ -1075,53 +1075,53 @@ function st(e, t) {
|
|
|
1075
1075
|
};
|
|
1076
1076
|
return n(e.blocks, null);
|
|
1077
1077
|
}
|
|
1078
|
-
function
|
|
1078
|
+
function lt(e, t, n, r, i) {
|
|
1079
1079
|
if (r !== null) return r;
|
|
1080
|
-
let a =
|
|
1080
|
+
let a = st(t, n).find((e) => e.id !== i), o = st(e, n).filter((e) => e.id !== i);
|
|
1081
1081
|
return o[(a ? o.findIndex((e) => e.id === a.id) : o.length) - 1]?.id ?? null;
|
|
1082
1082
|
}
|
|
1083
|
-
function
|
|
1083
|
+
function ut(e, t, n) {
|
|
1084
1084
|
Object.keys(n).length ? (e.l10n ??= {})[t] = n : e.l10n && (delete e.l10n[t], Object.keys(e.l10n).length || delete e.l10n);
|
|
1085
1085
|
}
|
|
1086
|
-
function
|
|
1086
|
+
function dt(e) {
|
|
1087
1087
|
let t = z(e);
|
|
1088
|
-
return delete t.l10n, t.type === "section" ? t.children = t.children.map((e) => e.map(
|
|
1088
|
+
return delete t.l10n, t.type === "section" ? t.children = t.children.map((e) => e.map(dt)) : t.type === "wrapper" && (t.children = t.children.map(dt)), t;
|
|
1089
1089
|
}
|
|
1090
|
-
function
|
|
1091
|
-
let i =
|
|
1090
|
+
function ft(e, t, n, r) {
|
|
1091
|
+
let i = oe(e, t), a = z(e), o = z(i.settings), s = !1, c = /* @__PURE__ */ new Map(), l = (n, r) => {
|
|
1092
1092
|
for (let [i, a] of $(n)) c.set(i, {
|
|
1093
|
-
initial:
|
|
1093
|
+
initial: ie(a, t, W(e)),
|
|
1094
1094
|
added: r,
|
|
1095
1095
|
changed: !1
|
|
1096
1096
|
});
|
|
1097
1097
|
};
|
|
1098
1098
|
l(i.blocks, !1);
|
|
1099
1099
|
let u = [], d = (e, t, n) => {
|
|
1100
|
-
if (t.some((e) => e?.op === "setDefaultLocale")) throw new
|
|
1101
|
-
if (t.some((e) => e?.op === "setContent")) throw new
|
|
1100
|
+
if (t.some((e) => e?.op === "setDefaultLocale")) throw new G("invalid_operation", n, "Changing the default language isn't possible in a language view; switch to the default language.");
|
|
1101
|
+
if (t.some((e) => e?.op === "setContent")) throw new G("invalid_operation", n, "Replacing the whole template isn't possible in a language view; switch to the default language.");
|
|
1102
1102
|
try {
|
|
1103
|
-
return
|
|
1103
|
+
return F(e, t);
|
|
1104
1104
|
} catch (e) {
|
|
1105
|
-
throw e instanceof
|
|
1105
|
+
throw e instanceof G ? new G(e.code, n, e.message, e.blockId) : e;
|
|
1106
1106
|
}
|
|
1107
1107
|
}, f = (e, t) => {
|
|
1108
1108
|
a = d(a, e, t), u.push(...e);
|
|
1109
1109
|
}, p = (e, n) => {
|
|
1110
1110
|
let o = c.get(e);
|
|
1111
1111
|
if (!o?.changed) return;
|
|
1112
|
-
let s = $(a.blocks).get(e), l = $(i.blocks).get(e), u = z(a), d =
|
|
1113
|
-
if (o.added) p =
|
|
1112
|
+
let s = $(a.blocks).get(e), l = $(i.blocks).get(e), u = z(a), d = st(u, ct(u, e).parent), p = z(s);
|
|
1113
|
+
if (o.added) p = dt(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);
|
|
1114
1114
|
else {
|
|
1115
1115
|
let e = p.type === "section" ? {
|
|
1116
1116
|
...l,
|
|
1117
1117
|
children: p.children,
|
|
1118
1118
|
columns: p.columns
|
|
1119
1119
|
} : l;
|
|
1120
|
-
Oe(p, e, (e) => $(a.blocks).get(e) ?? null), p =
|
|
1120
|
+
Oe(p, e, (e) => $(a.blocks).get(e) ?? null), p = L(p);
|
|
1121
1121
|
let n = p.l10n?.[t];
|
|
1122
|
-
|
|
1122
|
+
ut(p, t, Ae(n, Z(p, o.initial, n, r), Z(p, l, n, r), p, l));
|
|
1123
1123
|
}
|
|
1124
|
-
d[d.findIndex((t) => t.id === e)] = p, f(
|
|
1124
|
+
d[d.findIndex((t) => t.id === e)] = p, f(ot(a, u), n), o.changed = !1;
|
|
1125
1125
|
}, m = (e, t, n) => {
|
|
1126
1126
|
let r = $(a.blocks).get(e.blockId), i = $(t.blocks).get(e.blockId);
|
|
1127
1127
|
if (r.type !== "section" || i.type !== "section" || r.columns === i.columns) return;
|
|
@@ -1140,7 +1140,7 @@ function dt(e, t, n, r) {
|
|
|
1140
1140
|
op: "updateBlock",
|
|
1141
1141
|
blockId: e.blockId,
|
|
1142
1142
|
set: { columns: i.columns },
|
|
1143
|
-
...e.expect ? { expect: Object.fromEntries(Object.keys(e.expect).map((e) => [e,
|
|
1143
|
+
...e.expect ? { expect: Object.fromEntries(Object.keys(e.expect).map((e) => [e, I(u, e) ?? null])) } : {}
|
|
1144
1144
|
}], n);
|
|
1145
1145
|
};
|
|
1146
1146
|
n.forEach((e, t) => {
|
|
@@ -1148,19 +1148,19 @@ function dt(e, t, n, r) {
|
|
|
1148
1148
|
let n = d(i, [e], t);
|
|
1149
1149
|
switch (e.op) {
|
|
1150
1150
|
case "addBlock": {
|
|
1151
|
-
let n =
|
|
1151
|
+
let n = dt(e.block);
|
|
1152
1152
|
f([{
|
|
1153
1153
|
...e,
|
|
1154
1154
|
block: n,
|
|
1155
|
-
after:
|
|
1155
|
+
after: lt(a, i, e.parent, e.after)
|
|
1156
1156
|
}], t), l([n], !0);
|
|
1157
1157
|
break;
|
|
1158
1158
|
}
|
|
1159
1159
|
case "moveBlock":
|
|
1160
1160
|
f([{
|
|
1161
1161
|
...e,
|
|
1162
|
-
after:
|
|
1163
|
-
...e.expect ? { expect:
|
|
1162
|
+
after: lt(a, i, e.parent, e.after, e.blockId),
|
|
1163
|
+
...e.expect ? { expect: ct(a, e.blockId) } : {}
|
|
1164
1164
|
}], t);
|
|
1165
1165
|
break;
|
|
1166
1166
|
case "deleteBlock": {
|
|
@@ -1186,17 +1186,17 @@ function dt(e, t, n, r) {
|
|
|
1186
1186
|
for (let e of c.keys()) p(e, n.length - 1);
|
|
1187
1187
|
if (s) {
|
|
1188
1188
|
let e = z(a), r = e.settings.l10n?.[t];
|
|
1189
|
-
|
|
1189
|
+
ut(e.settings, t, Ae(r, ke(e.settings, o, r), ke(e.settings, i.settings, r), e.settings, i.settings)), f(ot(a, e), n.length - 1);
|
|
1190
1190
|
}
|
|
1191
1191
|
return u;
|
|
1192
1192
|
}
|
|
1193
|
-
var
|
|
1193
|
+
var pt = 1e3, mt = 1e4, ht = [
|
|
1194
1194
|
1e3,
|
|
1195
1195
|
2e3,
|
|
1196
1196
|
5e3,
|
|
1197
1197
|
1e4,
|
|
1198
1198
|
3e4
|
|
1199
|
-
],
|
|
1199
|
+
], gt = 50, _t = 100, vt = /* @__PURE__ */ new Set([
|
|
1200
1200
|
"block_exists",
|
|
1201
1201
|
"block_missing",
|
|
1202
1202
|
"anchor_missing",
|
|
@@ -1207,49 +1207,49 @@ var ft = 1e3, pt = 1e4, mt = [
|
|
|
1207
1207
|
"lock_lost",
|
|
1208
1208
|
"content_too_large"
|
|
1209
1209
|
]);
|
|
1210
|
-
function
|
|
1210
|
+
function yt(e, t) {
|
|
1211
1211
|
return e.ops.some((e) => e.op === "setContent") ? e.view = t : delete e.view, e;
|
|
1212
1212
|
}
|
|
1213
|
-
function
|
|
1213
|
+
function bt(e) {
|
|
1214
1214
|
let t = e?.code;
|
|
1215
|
-
return typeof t == "string" &&
|
|
1215
|
+
return typeof t == "string" && vt.has(t) ? t : null;
|
|
1216
1216
|
}
|
|
1217
|
-
function
|
|
1217
|
+
function xt(e) {
|
|
1218
1218
|
let t = e?.holder;
|
|
1219
1219
|
return typeof t == "object" && t && typeof t.sessionId == "string" ? t : void 0;
|
|
1220
1220
|
}
|
|
1221
|
-
function
|
|
1221
|
+
function St(e) {
|
|
1222
1222
|
let t = e?.statusCode;
|
|
1223
1223
|
return typeof t != "number" || t >= 500 || t === 408 || t === 429;
|
|
1224
1224
|
}
|
|
1225
|
-
function
|
|
1225
|
+
function Ct(e, t) {
|
|
1226
1226
|
return e.some((e) => {
|
|
1227
1227
|
if (e.id === t) return !0;
|
|
1228
1228
|
let n = e.children;
|
|
1229
|
-
return e.type === "wrapper" && Array.isArray(n) &&
|
|
1229
|
+
return e.type === "wrapper" && Array.isArray(n) && Ct(n, t) || e.type === "section" && Array.isArray(n) && n.some((e) => Array.isArray(e) && Ct(e, t));
|
|
1230
1230
|
});
|
|
1231
1231
|
}
|
|
1232
|
-
function
|
|
1232
|
+
function wt(e) {
|
|
1233
1233
|
if (e.length === 1 && e[0].op === "updateSettings") return !0;
|
|
1234
1234
|
let t = e[0];
|
|
1235
1235
|
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);
|
|
1236
1236
|
}
|
|
1237
|
-
function
|
|
1237
|
+
function Tt(e) {
|
|
1238
1238
|
return e.map((e) => {
|
|
1239
1239
|
if (!("expect" in e)) return e;
|
|
1240
1240
|
let { expect: t, ...n } = e;
|
|
1241
1241
|
return n;
|
|
1242
1242
|
});
|
|
1243
1243
|
}
|
|
1244
|
-
function
|
|
1245
|
-
let { provider: t } = e, n = e.sessionId ?? crypto.randomUUID(), i = e.maxUndo ??
|
|
1246
|
-
function
|
|
1244
|
+
function Et(e) {
|
|
1245
|
+
let { provider: t } = e, n = e.sessionId ?? crypto.randomUUID(), i = e.maxUndo ?? gt, 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, te = !1, O = [], k = null, A = null, j = Promise.resolve(), M = null, ne = r(() => (g.value, (b?.undo.length ?? 0) > 0)), re = r(() => (g.value, (b?.redo.length ?? 0) > 0));
|
|
1246
|
+
function N(t) {
|
|
1247
1247
|
e.onError?.(t instanceof Error ? t : Error(String(t)));
|
|
1248
1248
|
}
|
|
1249
|
-
function
|
|
1250
|
-
n !== b ||
|
|
1249
|
+
function P(t, n = b) {
|
|
1250
|
+
n !== b || te || e.onNotice?.(t);
|
|
1251
1251
|
}
|
|
1252
|
-
function
|
|
1252
|
+
function ie() {
|
|
1253
1253
|
return {
|
|
1254
1254
|
locks: [...s.value.values()].map((e) => ({
|
|
1255
1255
|
blockId: e.blockId,
|
|
@@ -1259,102 +1259,102 @@ function Tt(e) {
|
|
|
1259
1259
|
session: n
|
|
1260
1260
|
};
|
|
1261
1261
|
}
|
|
1262
|
-
function
|
|
1262
|
+
function I() {
|
|
1263
1263
|
g.value++;
|
|
1264
1264
|
}
|
|
1265
|
-
function
|
|
1265
|
+
function ae(e, t) {
|
|
1266
1266
|
e.push(t), e.length > i && e.splice(0, e.length - i);
|
|
1267
1267
|
}
|
|
1268
|
-
function
|
|
1268
|
+
function L(e) {
|
|
1269
1269
|
if (!_ || S) return;
|
|
1270
1270
|
C = !0;
|
|
1271
1271
|
try {
|
|
1272
|
-
let t = _.content.value, n =
|
|
1272
|
+
let t = _.content.value, n = ot(t, e);
|
|
1273
1273
|
if (n.length > 0) try {
|
|
1274
|
-
|
|
1274
|
+
ee(t, n);
|
|
1275
1275
|
} catch {
|
|
1276
1276
|
_.setContent(z(e), !1);
|
|
1277
1277
|
}
|
|
1278
|
-
|
|
1278
|
+
K(_.content.value, e) || _.setContent(z(e), !1);
|
|
1279
1279
|
} finally {
|
|
1280
1280
|
C = !1;
|
|
1281
1281
|
}
|
|
1282
1282
|
let t = _.state.selectedBlockId;
|
|
1283
|
-
t && !
|
|
1283
|
+
t && !Ct(e.blocks, t) && _.selectBlock(null);
|
|
1284
1284
|
}
|
|
1285
|
-
function
|
|
1285
|
+
function oe() {
|
|
1286
1286
|
C || T || (T = !0, queueMicrotask(() => {
|
|
1287
|
-
T = !1,
|
|
1287
|
+
T = !1, B(!1);
|
|
1288
1288
|
}));
|
|
1289
1289
|
}
|
|
1290
|
-
function
|
|
1290
|
+
function R() {
|
|
1291
1291
|
E &&= (clearTimeout(E), null);
|
|
1292
1292
|
}
|
|
1293
|
-
function
|
|
1293
|
+
function B(e, t = !1) {
|
|
1294
1294
|
let n = b;
|
|
1295
1295
|
if (!_ || !n || S || C || _.state.isLoading && !t || _.state.template?.id !== n.templateId) return;
|
|
1296
|
-
let r =
|
|
1297
|
-
if (r.length === 0)
|
|
1296
|
+
let r = ot(n.view, _.content.value);
|
|
1297
|
+
if (r.length === 0) R();
|
|
1298
1298
|
else {
|
|
1299
|
-
if (!e &&
|
|
1299
|
+
if (!e && wt(r)) {
|
|
1300
1300
|
let e = Date.now();
|
|
1301
1301
|
if (E === null && (D = e), e - D < 1e3) {
|
|
1302
1302
|
E && clearTimeout(E), E = setTimeout(() => {
|
|
1303
|
-
E = null,
|
|
1303
|
+
E = null, B(!0);
|
|
1304
1304
|
}, 300);
|
|
1305
1305
|
return;
|
|
1306
1306
|
}
|
|
1307
1307
|
}
|
|
1308
|
-
|
|
1308
|
+
R(), se(n, r);
|
|
1309
1309
|
}
|
|
1310
1310
|
}
|
|
1311
|
-
function
|
|
1312
|
-
|
|
1311
|
+
function V() {
|
|
1312
|
+
B(!0);
|
|
1313
1313
|
}
|
|
1314
|
-
function
|
|
1314
|
+
function se(e, t) {
|
|
1315
1315
|
let n = t, r;
|
|
1316
1316
|
try {
|
|
1317
|
-
r =
|
|
1317
|
+
r = F(e.view, n, ie());
|
|
1318
1318
|
} catch (n) {
|
|
1319
|
-
if (!(n instanceof
|
|
1320
|
-
|
|
1321
|
-
let r = n.blockId === void 0 ? void 0 :
|
|
1319
|
+
if (!(n instanceof G)) throw n;
|
|
1320
|
+
L(e.view);
|
|
1321
|
+
let r = n.blockId === void 0 ? void 0 : ke(n.blockId).find((e) => {
|
|
1322
1322
|
let r = t[n.opIndex];
|
|
1323
1323
|
return r.op !== "updateBlockLocale" || e.locale == null || e.locale === r.locale;
|
|
1324
1324
|
})?.holder;
|
|
1325
|
-
|
|
1325
|
+
P({
|
|
1326
1326
|
type: "editRefused",
|
|
1327
1327
|
code: n.code,
|
|
1328
1328
|
...r ? { holder: r } : {}
|
|
1329
|
-
}), n.code === "invalid_operation" &&
|
|
1329
|
+
}), n.code === "invalid_operation" && N(n);
|
|
1330
1330
|
return;
|
|
1331
1331
|
}
|
|
1332
1332
|
let i = _.content.value;
|
|
1333
|
-
if (!
|
|
1334
|
-
|
|
1333
|
+
if (!K(r, i)) {
|
|
1334
|
+
N(/* @__PURE__ */ Error("[Templatical] Collaboration: a change couldn't be expressed as block operations, so the whole content was sent.")), n = [{
|
|
1335
1335
|
op: "setContent",
|
|
1336
1336
|
content: z(i)
|
|
1337
1337
|
}];
|
|
1338
1338
|
try {
|
|
1339
|
-
r =
|
|
1339
|
+
r = F(e.view, n, ie());
|
|
1340
1340
|
} catch (t) {
|
|
1341
|
-
if (!(t instanceof
|
|
1342
|
-
|
|
1341
|
+
if (!(t instanceof G)) throw t;
|
|
1342
|
+
L(e.view), P({
|
|
1343
1343
|
type: "editRefused",
|
|
1344
1344
|
code: t.code
|
|
1345
1345
|
});
|
|
1346
1346
|
return;
|
|
1347
1347
|
}
|
|
1348
1348
|
}
|
|
1349
|
-
let a =
|
|
1350
|
-
|
|
1349
|
+
let a = yt({ ops: me(e.view, n) }, r);
|
|
1350
|
+
ae(e.undo, a), e.redo = [], I();
|
|
1351
1351
|
let o = e.view;
|
|
1352
|
-
e.view = r,
|
|
1352
|
+
e.view = r, H(e, n, "edit", a, o);
|
|
1353
1353
|
}
|
|
1354
|
-
function
|
|
1354
|
+
function H(e, t, n, r, i) {
|
|
1355
1355
|
let a = { dropped: !1 }, o = 0, s = i;
|
|
1356
1356
|
do {
|
|
1357
|
-
let i = t.slice(o, o +
|
|
1357
|
+
let i = t.slice(o, o + _t);
|
|
1358
1358
|
if (e.pending.push({
|
|
1359
1359
|
batchId: crypto.randomUUID(),
|
|
1360
1360
|
ops: i,
|
|
@@ -1364,145 +1364,145 @@ function Tt(e) {
|
|
|
1364
1364
|
sent: !1,
|
|
1365
1365
|
revision: null,
|
|
1366
1366
|
...s && i.some((e) => e.op === "setContent") ? { base: s } : {}
|
|
1367
|
-
}), o +=
|
|
1368
|
-
s =
|
|
1367
|
+
}), o += _t, s && t.slice(o).some((e) => e.op === "setContent")) try {
|
|
1368
|
+
s = F(s, i);
|
|
1369
1369
|
} catch {
|
|
1370
1370
|
s = null;
|
|
1371
1371
|
}
|
|
1372
1372
|
} while (o < t.length);
|
|
1373
|
-
|
|
1373
|
+
U(e);
|
|
1374
1374
|
}
|
|
1375
|
-
function
|
|
1375
|
+
function U(e) {
|
|
1376
1376
|
if (e.inFlight || w) return;
|
|
1377
1377
|
let t = e.pending.find((e) => !e.sent);
|
|
1378
|
-
t ? (t.sent = !0, e.inFlight = t,
|
|
1378
|
+
t ? (t.sent = !0, e.inFlight = t, W(e, t, 0)) : pe(e);
|
|
1379
1379
|
}
|
|
1380
|
-
function
|
|
1380
|
+
function W(e, n, r) {
|
|
1381
1381
|
t.submit(e.templateId, {
|
|
1382
1382
|
batchId: n.batchId,
|
|
1383
1383
|
baseRevision: n.baseRevision ??= e.revision,
|
|
1384
1384
|
ops: n.ops,
|
|
1385
1385
|
...n.origin === "ai" ? { origin: "ai" } : {}
|
|
1386
1386
|
}).then(({ revision: t }) => {
|
|
1387
|
-
e.inFlight = null,
|
|
1387
|
+
e.inFlight = null, ce(e, n, t), U(e);
|
|
1388
1388
|
}, (t) => {
|
|
1389
|
-
if (
|
|
1390
|
-
else if (
|
|
1391
|
-
|
|
1392
|
-
let i =
|
|
1389
|
+
if (bt(t) !== null) e.inFlight = null, fe(e, n, t), U(e);
|
|
1390
|
+
else if (St(t)) {
|
|
1391
|
+
q(e, t);
|
|
1392
|
+
let i = ht[Math.min(r, ht.length - 1)];
|
|
1393
1393
|
setTimeout(() => {
|
|
1394
|
-
|
|
1394
|
+
te || W(e, n, r + 1);
|
|
1395
1395
|
}, i);
|
|
1396
|
-
} else e.inFlight = null,
|
|
1396
|
+
} else e.inFlight = null, N(t), fe(e, n, t), U(e);
|
|
1397
1397
|
});
|
|
1398
1398
|
}
|
|
1399
|
-
function
|
|
1400
|
-
t.revision === null && (t.revision = n, n <= e.revision ? (
|
|
1399
|
+
function ce(e, t, n) {
|
|
1400
|
+
t.revision === null && (t.revision = n, n <= e.revision ? (le(e, t), _e(e)) : (e.own.set(n, t), ge(e)));
|
|
1401
1401
|
}
|
|
1402
|
-
function
|
|
1403
|
-
e.pending = e.pending.filter((e) => e !== t),
|
|
1402
|
+
function le(e, t) {
|
|
1403
|
+
e.pending = e.pending.filter((e) => e !== t), pe(e);
|
|
1404
1404
|
}
|
|
1405
|
-
function
|
|
1405
|
+
function ue(e, t) {
|
|
1406
1406
|
if (t.entry) {
|
|
1407
1407
|
for (let n of [e.undo, e.redo]) {
|
|
1408
1408
|
let e = n.indexOf(t.entry);
|
|
1409
1409
|
e !== -1 && n.splice(e, 1);
|
|
1410
1410
|
}
|
|
1411
|
-
|
|
1411
|
+
I();
|
|
1412
1412
|
}
|
|
1413
1413
|
}
|
|
1414
|
-
function
|
|
1414
|
+
function de(e, t) {
|
|
1415
1415
|
let n = !t.group.dropped;
|
|
1416
|
-
return t.group.dropped = !0, e.pending = e.pending.filter((e) => e.group !== t.group || e.sent), n &&
|
|
1416
|
+
return t.group.dropped = !0, e.pending = e.pending.filter((e) => e.group !== t.group || e.sent), n && ue(e, t), pe(e), n;
|
|
1417
1417
|
}
|
|
1418
|
-
function
|
|
1419
|
-
if (
|
|
1420
|
-
let r =
|
|
1418
|
+
function fe(e, t, n) {
|
|
1419
|
+
if (le(e, t), de(e, t)) {
|
|
1420
|
+
let r = bt(n) ?? "invalid_operation";
|
|
1421
1421
|
if (t.origin === "edit" || t.origin === "ai") {
|
|
1422
|
-
let t =
|
|
1423
|
-
|
|
1422
|
+
let t = xt(n);
|
|
1423
|
+
P({
|
|
1424
1424
|
type: "editRefused",
|
|
1425
1425
|
code: r,
|
|
1426
1426
|
...t ? { holder: t } : {}
|
|
1427
1427
|
}, e);
|
|
1428
|
-
} else
|
|
1428
|
+
} else P({
|
|
1429
1429
|
type: "undoSkipped",
|
|
1430
1430
|
code: r
|
|
1431
1431
|
}, e);
|
|
1432
1432
|
}
|
|
1433
|
-
|
|
1433
|
+
_e(e), e === b && Y();
|
|
1434
1434
|
}
|
|
1435
|
-
function
|
|
1435
|
+
function pe(e) {
|
|
1436
1436
|
if (!(e.pending.length > 0 || e.waiters.length === 0)) for (let t of e.waiters.splice(0)) t.resolve();
|
|
1437
1437
|
}
|
|
1438
|
-
function
|
|
1438
|
+
function q(e, t) {
|
|
1439
1439
|
let n = t instanceof Error ? t : Error(String(t));
|
|
1440
1440
|
for (let t of e.waiters.splice(0)) t.reject(n);
|
|
1441
1441
|
}
|
|
1442
|
-
function
|
|
1442
|
+
function J(e, t) {
|
|
1443
1443
|
if (t.revision <= e.revision) return;
|
|
1444
1444
|
let n = e.pending.find((e) => e.batchId === t.batchId);
|
|
1445
|
-
n ?
|
|
1445
|
+
n ? ce(e, n, t.revision) : (e.remote.set(t.revision, t), ge(e));
|
|
1446
1446
|
}
|
|
1447
|
-
function
|
|
1447
|
+
function he(t, n) {
|
|
1448
1448
|
let r = n.ops;
|
|
1449
1449
|
if (e.normalizeRemoteOperations) try {
|
|
1450
1450
|
r = e.normalizeRemoteOperations(n.ops, t.confirmed);
|
|
1451
1451
|
} catch (e) {
|
|
1452
|
-
|
|
1452
|
+
N(e);
|
|
1453
1453
|
}
|
|
1454
|
-
return
|
|
1454
|
+
return Tt(r);
|
|
1455
1455
|
}
|
|
1456
|
-
function
|
|
1456
|
+
function ge(t) {
|
|
1457
1457
|
let n = [], r = !1;
|
|
1458
1458
|
for (;;) {
|
|
1459
1459
|
let e = t.revision + 1, i = t.remote.get(e), a = t.own.get(e);
|
|
1460
1460
|
if (!i && !a) break;
|
|
1461
1461
|
try {
|
|
1462
|
-
t.confirmed =
|
|
1462
|
+
t.confirmed = F(t.confirmed, i ? he(t, i) : a.ops);
|
|
1463
1463
|
} catch {
|
|
1464
1464
|
if (t.recovering) {
|
|
1465
|
-
t.remote.clear(), t.own.clear(),
|
|
1465
|
+
t.remote.clear(), t.own.clear(), N(/* @__PURE__ */ Error("[Templatical] Collaboration: this editor can't follow the template's changes. Reload the page."));
|
|
1466
1466
|
return;
|
|
1467
1467
|
}
|
|
1468
|
-
|
|
1468
|
+
xe(t);
|
|
1469
1469
|
return;
|
|
1470
1470
|
}
|
|
1471
|
-
t.revision = e, i ? (t.remote.delete(e), n.push(i)) : (t.own.delete(e), a.group.dropped && (r = !0),
|
|
1471
|
+
t.revision = e, i ? (t.remote.delete(e), n.push(i)) : (t.own.delete(e), a.group.dropped && (r = !0), le(t, a));
|
|
1472
1472
|
}
|
|
1473
|
-
if (t === b && (h.value = t.revision), t.remote.size > 0 || t.own.size > 0 ?
|
|
1473
|
+
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 {
|
|
1474
1474
|
e.onRemoteChange?.({
|
|
1475
1475
|
actor: t.actor,
|
|
1476
1476
|
ops: t.ops,
|
|
1477
1477
|
locale: t.ops.find((e) => e.op !== "setDefaultLocale" && "locale" in e)?.locale ?? null
|
|
1478
1478
|
});
|
|
1479
1479
|
} catch (e) {
|
|
1480
|
-
|
|
1480
|
+
N(e);
|
|
1481
1481
|
}
|
|
1482
1482
|
}
|
|
1483
|
-
function
|
|
1483
|
+
function _e(e) {
|
|
1484
1484
|
let t = !w;
|
|
1485
1485
|
w = !0;
|
|
1486
1486
|
try {
|
|
1487
|
-
|
|
1487
|
+
ve(e);
|
|
1488
1488
|
} finally {
|
|
1489
1489
|
t && (w = !1);
|
|
1490
1490
|
}
|
|
1491
|
-
t &&
|
|
1491
|
+
t && U(e);
|
|
1492
1492
|
}
|
|
1493
|
-
function
|
|
1494
|
-
e === b &&
|
|
1493
|
+
function ve(e) {
|
|
1494
|
+
e === b && V();
|
|
1495
1495
|
let t = e.confirmed;
|
|
1496
1496
|
for (let n = 0; n < e.pending.length; n++) {
|
|
1497
1497
|
let r = e.pending[n], i;
|
|
1498
|
-
if (r.base && !
|
|
1498
|
+
if (r.base && !K(r.base, t)) i = "precondition_failed";
|
|
1499
1499
|
else try {
|
|
1500
|
-
t =
|
|
1500
|
+
t = F(t, r.ops);
|
|
1501
1501
|
continue;
|
|
1502
1502
|
} catch (e) {
|
|
1503
|
-
i = e instanceof
|
|
1503
|
+
i = e instanceof G ? e.code : "invalid_operation";
|
|
1504
1504
|
}
|
|
1505
|
-
r.sent || (
|
|
1505
|
+
r.sent || (de(e, r) && P(r.origin === "edit" || r.origin === "ai" ? {
|
|
1506
1506
|
type: "editRefused",
|
|
1507
1507
|
code: i
|
|
1508
1508
|
} : {
|
|
@@ -1510,57 +1510,57 @@ function Tt(e) {
|
|
|
1510
1510
|
code: i
|
|
1511
1511
|
}, e), t = e.confirmed, n = -1);
|
|
1512
1512
|
}
|
|
1513
|
-
e.view = t,
|
|
1513
|
+
e.view = t, pe(e), e === b && L(t);
|
|
1514
1514
|
}
|
|
1515
|
-
function
|
|
1515
|
+
function ye(e) {
|
|
1516
1516
|
e.gapTimer ||= setTimeout(() => {
|
|
1517
|
-
e.gapTimer = null, e === b &&
|
|
1518
|
-
},
|
|
1517
|
+
e.gapTimer = null, e === b && Y();
|
|
1518
|
+
}, pt);
|
|
1519
1519
|
}
|
|
1520
|
-
function
|
|
1520
|
+
function be(e) {
|
|
1521
1521
|
e.gapTimer &&= (clearTimeout(e.gapTimer), null);
|
|
1522
1522
|
}
|
|
1523
|
-
function
|
|
1523
|
+
function Y() {
|
|
1524
1524
|
let e = b;
|
|
1525
1525
|
return e ? (e.catchingUp ||= (async () => {
|
|
1526
1526
|
try {
|
|
1527
1527
|
let n = await t.operationsAfter(e.templateId, e.revision);
|
|
1528
1528
|
if (e.retired) return;
|
|
1529
1529
|
if ("resync" in n) {
|
|
1530
|
-
await
|
|
1530
|
+
await xe(e);
|
|
1531
1531
|
return;
|
|
1532
1532
|
}
|
|
1533
|
-
for (let t of n.batches)
|
|
1533
|
+
for (let t of n.batches) J(e, t);
|
|
1534
1534
|
} catch (e) {
|
|
1535
|
-
|
|
1535
|
+
N(e);
|
|
1536
1536
|
} finally {
|
|
1537
1537
|
e.catchingUp = null;
|
|
1538
1538
|
}
|
|
1539
1539
|
})(), e.catchingUp) : Promise.resolve();
|
|
1540
1540
|
}
|
|
1541
|
-
async function
|
|
1541
|
+
async function xe(t) {
|
|
1542
1542
|
t.recovering = !0;
|
|
1543
1543
|
try {
|
|
1544
1544
|
let n = await e.loadTemplate(t.templateId);
|
|
1545
1545
|
if (t.retired) return;
|
|
1546
|
-
|
|
1546
|
+
Se(t, n);
|
|
1547
1547
|
} catch (e) {
|
|
1548
|
-
|
|
1548
|
+
N(e);
|
|
1549
1549
|
} finally {
|
|
1550
1550
|
t.recovering = !1;
|
|
1551
1551
|
}
|
|
1552
1552
|
}
|
|
1553
|
-
function
|
|
1553
|
+
function Se(e, t) {
|
|
1554
1554
|
let n = t.revision ?? e.revision;
|
|
1555
1555
|
e.confirmed = z(t.content), e.revision = n, e.remote = new Map([...e.remote].filter(([e]) => e > n));
|
|
1556
|
-
for (let [t, r] of [...e.own]) t <= n && (e.own.delete(t),
|
|
1557
|
-
e === b && (h.value = n),
|
|
1556
|
+
for (let [t, r] of [...e.own]) t <= n && (e.own.delete(t), le(e, r));
|
|
1557
|
+
e === b && (h.value = n), _e(e), ge(e);
|
|
1558
1558
|
}
|
|
1559
|
-
function
|
|
1559
|
+
function Ce(t) {
|
|
1560
1560
|
let n = () => t === b && !t.retired;
|
|
1561
1561
|
return {
|
|
1562
1562
|
onBatch: (e) => {
|
|
1563
|
-
n() &&
|
|
1563
|
+
n() && J(t, e);
|
|
1564
1564
|
},
|
|
1565
1565
|
onResync: (r, i) => {
|
|
1566
1566
|
if (!(!n() || r <= t.revision)) {
|
|
@@ -1570,32 +1570,32 @@ function Tt(e) {
|
|
|
1570
1570
|
actor: i
|
|
1571
1571
|
});
|
|
1572
1572
|
} catch (e) {
|
|
1573
|
-
|
|
1573
|
+
N(e);
|
|
1574
1574
|
}
|
|
1575
|
-
|
|
1575
|
+
Y();
|
|
1576
1576
|
}
|
|
1577
1577
|
},
|
|
1578
1578
|
onLock: (e) => {
|
|
1579
|
-
n() &&
|
|
1579
|
+
n() && je(e);
|
|
1580
1580
|
},
|
|
1581
1581
|
onUnlock: (e, t, r) => {
|
|
1582
|
-
n() &&
|
|
1582
|
+
n() && Me(e, t, r);
|
|
1583
1583
|
},
|
|
1584
1584
|
onMembers: (e) => {
|
|
1585
|
-
n() &&
|
|
1585
|
+
n() && Pe(e);
|
|
1586
1586
|
},
|
|
1587
1587
|
onConnectionChange: (e) => {
|
|
1588
|
-
n() &&
|
|
1588
|
+
n() && Ee(t, e);
|
|
1589
1589
|
}
|
|
1590
1590
|
};
|
|
1591
1591
|
}
|
|
1592
|
-
function
|
|
1592
|
+
function X(e, r) {
|
|
1593
1593
|
let i = d;
|
|
1594
|
-
t.join(e.templateId, { sessionId: n },
|
|
1595
|
-
e.retired || e !== b ? r || t.leave() : (e.leave = t.leave,
|
|
1596
|
-
}, (e) =>
|
|
1594
|
+
t.join(e.templateId, { sessionId: n }, Ce(e)).then((t) => {
|
|
1595
|
+
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 && Y(), r && Q());
|
|
1596
|
+
}, (e) => N(e));
|
|
1597
1597
|
}
|
|
1598
|
-
function
|
|
1598
|
+
function we(e, t) {
|
|
1599
1599
|
let n = z(e.content), r = {
|
|
1600
1600
|
templateId: e.id,
|
|
1601
1601
|
confirmed: n,
|
|
@@ -1614,139 +1614,139 @@ function Tt(e) {
|
|
|
1614
1614
|
redo: t?.redo ?? [],
|
|
1615
1615
|
waiters: []
|
|
1616
1616
|
};
|
|
1617
|
-
b = r, h.value = r.revision,
|
|
1617
|
+
b = r, h.value = r.revision, I(), X(r, !1), _?.state.selectedBlockId && Be(_.state.selectedBlockId), oe();
|
|
1618
1618
|
}
|
|
1619
|
-
function
|
|
1620
|
-
e.retired = !0,
|
|
1619
|
+
function Te(e) {
|
|
1620
|
+
e.retired = !0, be(e), e.leave?.(), e.leave = null, q(e, /* @__PURE__ */ Error("[Templatical] The template was closed."));
|
|
1621
1621
|
}
|
|
1622
|
-
function
|
|
1622
|
+
function Ee(e, t) {
|
|
1623
1623
|
let n = m.value;
|
|
1624
|
-
m.value = t, t === "connected" && n !== null && n !== "connected" &&
|
|
1624
|
+
m.value = t, t === "connected" && n !== null && n !== "connected" && X(e, !0);
|
|
1625
1625
|
}
|
|
1626
|
-
function
|
|
1627
|
-
b && b.templateId === e?.id || (b &&= (
|
|
1626
|
+
function De(e, t) {
|
|
1627
|
+
b && b.templateId === e?.id || (b &&= (R(), Te(b), null), o.value = [], s.value = /* @__PURE__ */ new Map(), m.value = null, k = null, Q(), I(), e && we(e, t));
|
|
1628
1628
|
}
|
|
1629
|
-
function
|
|
1629
|
+
function Z(e, t) {
|
|
1630
1630
|
return `${e}\u0000${t ?? ""}`;
|
|
1631
1631
|
}
|
|
1632
|
-
function
|
|
1632
|
+
function Oe(e, t, n) {
|
|
1633
1633
|
return e.blockId === t && (n == null || e.locale == null || e.locale === n);
|
|
1634
1634
|
}
|
|
1635
|
-
function
|
|
1635
|
+
function ke(e) {
|
|
1636
1636
|
return [...s.value.values()].filter((t) => t.blockId === e);
|
|
1637
1637
|
}
|
|
1638
|
-
function
|
|
1639
|
-
e !== f.value && (
|
|
1638
|
+
function Ae(e) {
|
|
1639
|
+
e !== f.value && (V(), f.value = e, Be(_?.state.selectedBlockId ?? null));
|
|
1640
1640
|
}
|
|
1641
|
-
function
|
|
1641
|
+
function je(e, t = !1) {
|
|
1642
1642
|
if (e.holder.sessionId === n) return;
|
|
1643
1643
|
t ? c.add(e) : u.set(e, ++d);
|
|
1644
1644
|
let r = new Map([...s.value].filter(([, t]) => t.holder.sessionId !== e.holder.sessionId));
|
|
1645
|
-
r.set(
|
|
1645
|
+
r.set(Z(e.blockId, e.locale), e), s.value = r, _?.state.selectedBlockId === e.blockId && (f.value === null || e.locale == null || e.locale === f.value) && (_.selectBlock(null), P({
|
|
1646
1646
|
type: "selectionRefused",
|
|
1647
1647
|
blockId: e.blockId,
|
|
1648
1648
|
holder: e.holder
|
|
1649
1649
|
}));
|
|
1650
1650
|
}
|
|
1651
|
-
function
|
|
1652
|
-
let r =
|
|
1651
|
+
function Me(e, t, n) {
|
|
1652
|
+
let r = Z(e, n), i = new Map([...s.value].filter(([n, i]) => i.holder.sessionId !== t || n !== r && !(i.blockId === e && c.has(i))));
|
|
1653
1653
|
i.size !== s.value.size && (s.value = i);
|
|
1654
1654
|
}
|
|
1655
|
-
function
|
|
1655
|
+
function Ne(e, t, r) {
|
|
1656
1656
|
let i = new Map([...s.value].filter(([, e]) => !c.has(e) && (t || (u.get(e) ?? 0) > r))), a = [...i.values()];
|
|
1657
|
-
for (let t of e) if (t.holder.sessionId !== n && !a.some((e) => e.holder.sessionId === t.holder.sessionId ||
|
|
1657
|
+
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))) {
|
|
1658
1658
|
for (let [e, n] of i) n.holder.sessionId === t.holder.sessionId && i.delete(e);
|
|
1659
|
-
i.set(
|
|
1659
|
+
i.set(Z(t.blockId, t.locale), t);
|
|
1660
1660
|
}
|
|
1661
1661
|
s.value = i;
|
|
1662
1662
|
}
|
|
1663
|
-
function
|
|
1663
|
+
function Pe(e) {
|
|
1664
1664
|
let t = new Set(e.map((e) => e.sessionId)), n = new Set(o.value.map((e) => e.sessionId).filter((e) => !t.has(e)));
|
|
1665
1665
|
if (o.value = e, n.size === 0) return;
|
|
1666
1666
|
let r = new Map([...s.value].filter(([, e]) => !n.has(e.holder.sessionId)));
|
|
1667
1667
|
r.size !== s.value.size && (s.value = r);
|
|
1668
1668
|
}
|
|
1669
|
-
function
|
|
1670
|
-
|
|
1669
|
+
function Fe(e) {
|
|
1670
|
+
j = j.then(e).catch(N);
|
|
1671
1671
|
}
|
|
1672
|
-
function
|
|
1673
|
-
a &&
|
|
1674
|
-
if (
|
|
1675
|
-
let e =
|
|
1676
|
-
|
|
1672
|
+
function Q() {
|
|
1673
|
+
a && Fe(async () => {
|
|
1674
|
+
if (A && (k === null || A.templateId !== k.templateId || A.locale !== k.locale)) {
|
|
1675
|
+
let e = A;
|
|
1676
|
+
A = null, ze(), await t.releaseLock(e.templateId, e.blockId, e.locale);
|
|
1677
1677
|
}
|
|
1678
|
-
let e =
|
|
1679
|
-
if (!(!e ||
|
|
1678
|
+
let e = k;
|
|
1679
|
+
if (!(!e || A?.templateId === e.templateId && A.blockId === e.blockId && A.locale === e.locale)) try {
|
|
1680
1680
|
let n = await t.acquireLock(e.templateId, e.blockId, e.locale);
|
|
1681
|
-
|
|
1681
|
+
A = e, Re(), Ie(n.blockId, n.locale ?? null);
|
|
1682
1682
|
} catch (n) {
|
|
1683
|
-
if (
|
|
1684
|
-
let e =
|
|
1685
|
-
|
|
1683
|
+
if (A?.templateId === e.templateId) {
|
|
1684
|
+
let e = A;
|
|
1685
|
+
A = null, ze(), await t.releaseLock(e.templateId, e.blockId, e.locale).catch(() => {});
|
|
1686
1686
|
}
|
|
1687
|
-
if (
|
|
1687
|
+
if (k !== e) return;
|
|
1688
1688
|
Le(e.blockId, n);
|
|
1689
1689
|
}
|
|
1690
1690
|
});
|
|
1691
1691
|
}
|
|
1692
1692
|
function Ie(e, t) {
|
|
1693
|
-
let n = new Map([...s.value].filter(([, n]) => !
|
|
1693
|
+
let n = new Map([...s.value].filter(([, n]) => !Oe(n, e, t)));
|
|
1694
1694
|
n.size !== s.value.size && (s.value = n);
|
|
1695
1695
|
}
|
|
1696
1696
|
function Le(e, t) {
|
|
1697
|
-
let n =
|
|
1697
|
+
let n = bt(t);
|
|
1698
1698
|
if (n === "lock_held" || n === "block_missing") {
|
|
1699
|
-
|
|
1700
|
-
let n =
|
|
1701
|
-
n ?
|
|
1699
|
+
k = null;
|
|
1700
|
+
let n = xt(t);
|
|
1701
|
+
n ? je({
|
|
1702
1702
|
blockId: e,
|
|
1703
1703
|
holder: n,
|
|
1704
1704
|
expiresAt: ""
|
|
1705
1705
|
}, !0) : _?.state.selectedBlockId === e && _.selectBlock(null);
|
|
1706
|
-
} else
|
|
1707
|
-
|
|
1708
|
-
},
|
|
1706
|
+
} else N(t), setTimeout(() => {
|
|
1707
|
+
k?.blockId === e && Q();
|
|
1708
|
+
}, ht[0]);
|
|
1709
1709
|
}
|
|
1710
1710
|
function Re() {
|
|
1711
1711
|
M ||= setInterval(() => {
|
|
1712
|
-
|
|
1713
|
-
let e =
|
|
1712
|
+
Fe(async () => {
|
|
1713
|
+
let e = A;
|
|
1714
1714
|
if (e) try {
|
|
1715
1715
|
await t.renewLock(e.templateId, e.blockId, e.locale);
|
|
1716
1716
|
} catch (e) {
|
|
1717
|
-
if (
|
|
1718
|
-
|
|
1717
|
+
if (bt(e) === "lock_lost") {
|
|
1718
|
+
A = null, ze(), Q();
|
|
1719
1719
|
return;
|
|
1720
1720
|
}
|
|
1721
|
-
|
|
1721
|
+
N(e);
|
|
1722
1722
|
}
|
|
1723
1723
|
});
|
|
1724
|
-
},
|
|
1724
|
+
}, mt);
|
|
1725
1725
|
}
|
|
1726
1726
|
function ze() {
|
|
1727
1727
|
M &&= (clearInterval(M), null);
|
|
1728
1728
|
}
|
|
1729
1729
|
function Be(e) {
|
|
1730
|
-
|
|
1730
|
+
V(), b && (k = e ? {
|
|
1731
1731
|
templateId: b.templateId,
|
|
1732
1732
|
blockId: e,
|
|
1733
1733
|
locale: f.value
|
|
1734
|
-
} : null,
|
|
1734
|
+
} : null, Q());
|
|
1735
1735
|
}
|
|
1736
1736
|
function Ve() {
|
|
1737
|
-
|
|
1737
|
+
V(), A && a && (t.releaseLock(A.templateId, A.blockId, A.locale).catch(() => {}), A = null, ze()), b?.leave?.(), b && (b.leave = null);
|
|
1738
1738
|
}
|
|
1739
1739
|
function He() {
|
|
1740
|
-
b && (b.undo = [], b.redo = [],
|
|
1740
|
+
b && (b.undo = [], b.redo = [], I());
|
|
1741
1741
|
}
|
|
1742
1742
|
function Ue(e) {
|
|
1743
1743
|
let t = b;
|
|
1744
1744
|
if (!t || S) return;
|
|
1745
|
-
|
|
1745
|
+
V();
|
|
1746
1746
|
let n = (e === "undo" ? t.undo : t.redo).pop();
|
|
1747
1747
|
if (!n) return;
|
|
1748
|
-
if (
|
|
1749
|
-
|
|
1748
|
+
if (I(), n.view && !K(n.view, t.view)) {
|
|
1749
|
+
P({
|
|
1750
1750
|
type: "undoSkipped",
|
|
1751
1751
|
code: "precondition_failed"
|
|
1752
1752
|
});
|
|
@@ -1754,41 +1754,41 @@ function Tt(e) {
|
|
|
1754
1754
|
}
|
|
1755
1755
|
let r;
|
|
1756
1756
|
try {
|
|
1757
|
-
r =
|
|
1757
|
+
r = F(t.view, n.ops, ie());
|
|
1758
1758
|
} catch (e) {
|
|
1759
|
-
if (!(e instanceof
|
|
1760
|
-
|
|
1759
|
+
if (!(e instanceof G)) throw e;
|
|
1760
|
+
P({
|
|
1761
1761
|
type: "undoSkipped",
|
|
1762
1762
|
code: e.code
|
|
1763
1763
|
});
|
|
1764
1764
|
return;
|
|
1765
1765
|
}
|
|
1766
|
-
let i =
|
|
1767
|
-
|
|
1766
|
+
let i = yt({ ops: me(t.view, n.ops) }, r);
|
|
1767
|
+
ae(e === "undo" ? t.redo : t.undo, i);
|
|
1768
1768
|
let a = t.view;
|
|
1769
|
-
t.view = r,
|
|
1769
|
+
t.view = r, L(r), _?.markDirty(), H(t, n.ops, e, i, a);
|
|
1770
1770
|
}
|
|
1771
1771
|
function We(e, t) {
|
|
1772
1772
|
let n = b;
|
|
1773
1773
|
if (!_ || !n || S) return {
|
|
1774
1774
|
applied: !1,
|
|
1775
|
-
error: new
|
|
1775
|
+
error: new G("invalid_operation", 0, "No template is open for editing.")
|
|
1776
1776
|
};
|
|
1777
1777
|
if (t.origin === void 0) try {
|
|
1778
|
-
|
|
1778
|
+
F(_.content.value, e, ie());
|
|
1779
1779
|
} catch (e) {
|
|
1780
|
-
if (e instanceof
|
|
1780
|
+
if (e instanceof G) return {
|
|
1781
1781
|
applied: !1,
|
|
1782
1782
|
error: e
|
|
1783
1783
|
};
|
|
1784
1784
|
throw e;
|
|
1785
1785
|
}
|
|
1786
|
-
|
|
1786
|
+
V();
|
|
1787
1787
|
let r, i;
|
|
1788
1788
|
try {
|
|
1789
|
-
r =
|
|
1789
|
+
r = F(n.view, e, ie()), i = me(n.view, e);
|
|
1790
1790
|
} catch (e) {
|
|
1791
|
-
if (e instanceof
|
|
1791
|
+
if (e instanceof G) return {
|
|
1792
1792
|
applied: !1,
|
|
1793
1793
|
error: e
|
|
1794
1794
|
};
|
|
@@ -1796,15 +1796,15 @@ function Tt(e) {
|
|
|
1796
1796
|
}
|
|
1797
1797
|
let a = n.undo.at(-1), o;
|
|
1798
1798
|
if (t.origin === "ai" && t.turn !== void 0 && a && a.turn === t.turn) {
|
|
1799
|
-
let e = a.view !== void 0 && !
|
|
1800
|
-
a.ops = [...i, ...a.ops], o = e ? a :
|
|
1801
|
-
} else o =
|
|
1799
|
+
let e = a.view !== void 0 && !K(a.view, n.view);
|
|
1800
|
+
a.ops = [...i, ...a.ops], o = e ? a : yt(a, r);
|
|
1801
|
+
} else o = yt({
|
|
1802
1802
|
ops: i,
|
|
1803
1803
|
...t.origin === "ai" && t.turn !== void 0 ? { turn: t.turn } : {}
|
|
1804
|
-
}, r),
|
|
1805
|
-
n.redo = [],
|
|
1804
|
+
}, r), ae(n.undo, o);
|
|
1805
|
+
n.redo = [], I();
|
|
1806
1806
|
let s = n.view;
|
|
1807
|
-
return n.view = r,
|
|
1807
|
+
return n.view = r, L(r), _.markDirty(), H(n, e, t.origin ?? "edit", o, s), {
|
|
1808
1808
|
applied: !0,
|
|
1809
1809
|
inverse: i
|
|
1810
1810
|
};
|
|
@@ -1815,40 +1815,40 @@ function Tt(e) {
|
|
|
1815
1815
|
if (n.moveBlock && n.findBlockLocation) {
|
|
1816
1816
|
let t = n.moveBlock, r = (...r) => {
|
|
1817
1817
|
let i = b, a = i && !S && !C && !e.state.isLoading && e.state.template?.id === i.templateId;
|
|
1818
|
-
if (a &&
|
|
1818
|
+
if (a && B(!0), t(...r), !a || K(i.view, e.content.value)) return;
|
|
1819
1819
|
let o = n.findBlockLocation(r[0]);
|
|
1820
1820
|
if (!o) return;
|
|
1821
1821
|
let s = o.targetSectionId ? {
|
|
1822
1822
|
sectionId: o.targetSectionId,
|
|
1823
1823
|
column: o.columnIndex ?? 0
|
|
1824
1824
|
} : 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;
|
|
1825
|
-
|
|
1825
|
+
se(i, [{
|
|
1826
1826
|
op: "moveBlock",
|
|
1827
1827
|
blockId: r[0],
|
|
1828
1828
|
parent: s,
|
|
1829
1829
|
after: l[o.index - 1]?.id ?? null
|
|
1830
1830
|
}]);
|
|
1831
1831
|
};
|
|
1832
|
-
n.moveBlock = r,
|
|
1832
|
+
n.moveBlock = r, O.push(() => {
|
|
1833
1833
|
n.moveBlock === r && (n.moveBlock = t);
|
|
1834
1834
|
});
|
|
1835
1835
|
}
|
|
1836
|
-
|
|
1837
|
-
e.loadVersion && e.contentReplaced && e.state.isLoading ||
|
|
1838
|
-
}, { immediate: !0 }), v(() => e.content.value,
|
|
1836
|
+
O.push(v(() => e.state.template, (t) => {
|
|
1837
|
+
e.loadVersion && e.contentReplaced && e.state.isLoading || De(t);
|
|
1838
|
+
}, { immediate: !0 }), v(() => e.content.value, oe, { deep: !0 }), v(() => e.state.selectedBlockId, Be), v(() => e.state.isLoading, (e) => e ? B(!0, !0) : oe()));
|
|
1839
1839
|
let r = e.contentReplaced, i = e.loadVersion;
|
|
1840
|
-
r && i &&
|
|
1840
|
+
r && i && O.push(v(r, He), v(i, () => {
|
|
1841
1841
|
let n = r.value !== t;
|
|
1842
1842
|
t = r.value;
|
|
1843
1843
|
let i = e.state.template;
|
|
1844
|
-
b?.templateId === i?.id ? n && b && i &&
|
|
1844
|
+
b?.templateId === i?.id ? n && b && i && Se(b, i) : De(i, !n && b && i ? {
|
|
1845
1845
|
undo: b.undo,
|
|
1846
1846
|
redo: b.redo
|
|
1847
1847
|
} : void 0);
|
|
1848
|
-
})), typeof window < "u" && (window.addEventListener("pagehide", Ve), window.addEventListener("blur",
|
|
1848
|
+
})), typeof window < "u" && (window.addEventListener("pagehide", Ve), window.addEventListener("blur", V)), x() && l(Ye);
|
|
1849
1849
|
}
|
|
1850
1850
|
function Ke() {
|
|
1851
|
-
|
|
1851
|
+
V();
|
|
1852
1852
|
let e = b;
|
|
1853
1853
|
return !e || e.pending.length === 0 ? Promise.resolve() : new Promise((t, n) => e.waiters.push({
|
|
1854
1854
|
resolve: t,
|
|
@@ -1856,44 +1856,44 @@ function Tt(e) {
|
|
|
1856
1856
|
}));
|
|
1857
1857
|
}
|
|
1858
1858
|
function qe() {
|
|
1859
|
-
|
|
1859
|
+
V(), S = !0;
|
|
1860
1860
|
}
|
|
1861
1861
|
function Je() {
|
|
1862
|
-
S = !1, b &&
|
|
1862
|
+
S = !1, b && L(b.view);
|
|
1863
1863
|
}
|
|
1864
1864
|
function Ye() {
|
|
1865
|
-
if (!
|
|
1866
|
-
|
|
1867
|
-
for (let e of
|
|
1868
|
-
|
|
1865
|
+
if (!te) {
|
|
1866
|
+
V();
|
|
1867
|
+
for (let e of O.splice(0)) e();
|
|
1868
|
+
R(), Ve(), te = !0, b && Te(b), b = null, ze(), typeof window < "u" && (window.removeEventListener("pagehide", Ve), window.removeEventListener("blur", V));
|
|
1869
1869
|
}
|
|
1870
1870
|
}
|
|
1871
1871
|
return {
|
|
1872
1872
|
sessionId: n,
|
|
1873
1873
|
members: o,
|
|
1874
1874
|
locks: s,
|
|
1875
|
-
locksOf:
|
|
1875
|
+
locksOf: ke,
|
|
1876
1876
|
lockLocale: f,
|
|
1877
|
-
setLockLocale:
|
|
1877
|
+
setLockLocale: Ae,
|
|
1878
1878
|
connection: m,
|
|
1879
1879
|
revision: h,
|
|
1880
|
-
canUndo:
|
|
1881
|
-
canRedo:
|
|
1880
|
+
canUndo: ne,
|
|
1881
|
+
canRedo: re,
|
|
1882
1882
|
attach: Ge,
|
|
1883
1883
|
undo: () => Ue("undo"),
|
|
1884
1884
|
redo: () => Ue("redo"),
|
|
1885
1885
|
clearHistory: He,
|
|
1886
|
-
flush:
|
|
1886
|
+
flush: V,
|
|
1887
1887
|
settle: Ke,
|
|
1888
1888
|
suspend: qe,
|
|
1889
1889
|
resume: Je,
|
|
1890
|
-
catchUp:
|
|
1891
|
-
hasConfirmedBlock: (e) => b ?
|
|
1890
|
+
catchUp: Y,
|
|
1891
|
+
hasConfirmedBlock: (e) => b ? Ct(b.confirmed.blocks, e) : !1,
|
|
1892
1892
|
applyOperations: We,
|
|
1893
1893
|
destroy: Ye
|
|
1894
1894
|
};
|
|
1895
1895
|
}
|
|
1896
|
-
function
|
|
1896
|
+
function Dt(e) {
|
|
1897
1897
|
let { provider: t } = e, n = p([]), r = p(!1), i = d(() => {
|
|
1898
1898
|
let e = /* @__PURE__ */ new Set();
|
|
1899
1899
|
for (let t of n.value) {
|
|
@@ -1909,10 +1909,10 @@ function Et(e) {
|
|
|
1909
1909
|
return s.value && e.canDelete !== !1;
|
|
1910
1910
|
}
|
|
1911
1911
|
function u(e, t) {
|
|
1912
|
-
throw new
|
|
1912
|
+
throw new q(`[Templatical] Saved blocks: ${e} is ${t}. Check the capability before calling — the editor's own UI hides the action.`);
|
|
1913
1913
|
}
|
|
1914
1914
|
function f(t) {
|
|
1915
|
-
|
|
1915
|
+
Le(e.onError, t);
|
|
1916
1916
|
}
|
|
1917
1917
|
async function m(i) {
|
|
1918
1918
|
r.value = !0;
|
|
@@ -1979,9 +1979,9 @@ function Et(e) {
|
|
|
1979
1979
|
remove: _
|
|
1980
1980
|
};
|
|
1981
1981
|
}
|
|
1982
|
-
var
|
|
1983
|
-
function
|
|
1984
|
-
let t = e.key ??
|
|
1982
|
+
var Ot = "templatical:saved-blocks";
|
|
1983
|
+
function kt(e = {}) {
|
|
1984
|
+
let t = e.key ?? Ot;
|
|
1985
1985
|
function n() {
|
|
1986
1986
|
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.");
|
|
1987
1987
|
return localStorage;
|
|
@@ -2006,7 +2006,7 @@ function Ot(e = {}) {
|
|
|
2006
2006
|
},
|
|
2007
2007
|
async create(e) {
|
|
2008
2008
|
let t = (/* @__PURE__ */ new Date()).toISOString(), n = {
|
|
2009
|
-
id:
|
|
2009
|
+
id: B(),
|
|
2010
2010
|
name: e.name,
|
|
2011
2011
|
content: e.content,
|
|
2012
2012
|
...e.category ? { category: e.category } : {},
|
|
@@ -2032,9 +2032,9 @@ function Ot(e = {}) {
|
|
|
2032
2032
|
}
|
|
2033
2033
|
};
|
|
2034
2034
|
}
|
|
2035
|
-
var
|
|
2036
|
-
function
|
|
2037
|
-
let t = e.key ??
|
|
2035
|
+
var At = "templatical:media", jt = 50;
|
|
2036
|
+
function Mt(e = {}) {
|
|
2037
|
+
let t = e.key ?? At;
|
|
2038
2038
|
function n() {
|
|
2039
2039
|
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.");
|
|
2040
2040
|
return localStorage;
|
|
@@ -2067,12 +2067,12 @@ function jt(e = {}) {
|
|
|
2067
2067
|
let t = r(), n = e?.search?.trim().toLowerCase(), i = n ? t.filter((e) => {
|
|
2068
2068
|
let t = e.filename?.toLowerCase() ?? "", r = e.alt?.toLowerCase() ?? "";
|
|
2069
2069
|
return t.includes(n) || r.includes(n);
|
|
2070
|
-
}) : t, a = e?.cursor ? Number.parseInt(e.cursor, 10) : 0, o = Number.isFinite(a) && a > 0 ? a : 0, s = i.slice(o, o +
|
|
2070
|
+
}) : t, a = e?.cursor ? Number.parseInt(e.cursor, 10) : 0, o = Number.isFinite(a) && a > 0 ? a : 0, s = i.slice(o, o + jt), c = { items: s }, l = o + s.length;
|
|
2071
2071
|
return l < i.length && (c.nextCursor = String(l)), c;
|
|
2072
2072
|
},
|
|
2073
2073
|
async create(e) {
|
|
2074
2074
|
let t = await a(e.file), n = (/* @__PURE__ */ new Date()).toISOString(), o = {
|
|
2075
|
-
id:
|
|
2075
|
+
id: B(),
|
|
2076
2076
|
url: t,
|
|
2077
2077
|
filename: e.filename || e.file.name,
|
|
2078
2078
|
createdAt: n,
|
|
@@ -2107,18 +2107,18 @@ function jt(e = {}) {
|
|
|
2107
2107
|
storage: !1
|
|
2108
2108
|
};
|
|
2109
2109
|
}
|
|
2110
|
-
function
|
|
2110
|
+
function Nt(e) {
|
|
2111
2111
|
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");
|
|
2112
2112
|
function u(e) {
|
|
2113
2113
|
let t = n();
|
|
2114
|
-
if (!t) throw new
|
|
2114
|
+
if (!t) throw new q(`[Templatical] Version history: ${e} needs a template. Call create() or load() first.`);
|
|
2115
2115
|
return t;
|
|
2116
2116
|
}
|
|
2117
2117
|
function f(e) {
|
|
2118
|
-
throw new
|
|
2118
|
+
throw new q(`[Templatical] Version history: ${e} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`);
|
|
2119
2119
|
}
|
|
2120
2120
|
function m(t) {
|
|
2121
|
-
|
|
2121
|
+
Le(e.onError, t);
|
|
2122
2122
|
}
|
|
2123
2123
|
async function h(n) {
|
|
2124
2124
|
let o = u("list");
|
|
@@ -2185,7 +2185,7 @@ function Mt(e) {
|
|
|
2185
2185
|
restore: y
|
|
2186
2186
|
};
|
|
2187
2187
|
}
|
|
2188
|
-
function
|
|
2188
|
+
function Pt(e) {
|
|
2189
2189
|
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(() => {
|
|
2190
2190
|
let e = /* @__PURE__ */ new Map();
|
|
2191
2191
|
for (let t of i.value) t.blockId && e.set(t.blockId, (e.get(t.blockId) ?? 0) + 1 + (t.replies?.length ?? 0));
|
|
@@ -2193,16 +2193,16 @@ function Nt(e) {
|
|
|
2193
2193
|
});
|
|
2194
2194
|
function g(e) {
|
|
2195
2195
|
let t = n();
|
|
2196
|
-
if (!t) throw new
|
|
2196
|
+
if (!t) throw new q(`[Templatical] Comments: ${e} needs a template. Call create() or load() first.`);
|
|
2197
2197
|
return t;
|
|
2198
2198
|
}
|
|
2199
2199
|
function _(e) {
|
|
2200
2200
|
let t = r();
|
|
2201
|
-
if (!t) throw new
|
|
2201
|
+
if (!t) throw new q(`[Templatical] Comments: ${e} needs to know who is commenting. Pass init({ user: { id, name } }) — an unattributed comment is not written.`);
|
|
2202
2202
|
return t;
|
|
2203
2203
|
}
|
|
2204
2204
|
function v(e) {
|
|
2205
|
-
throw new
|
|
2205
|
+
throw new q(`[Templatical] Comments: ${e} is disabled by the provider. Check the capability before calling — the editor's own UI hides the action.`);
|
|
2206
2206
|
}
|
|
2207
2207
|
function y(e) {
|
|
2208
2208
|
for (let t of i.value) {
|
|
@@ -2216,11 +2216,11 @@ function Nt(e) {
|
|
|
2216
2216
|
return t !== null && e.author.id === t.id;
|
|
2217
2217
|
}
|
|
2218
2218
|
function x(t) {
|
|
2219
|
-
let n =
|
|
2219
|
+
let n = Ie(t);
|
|
2220
2220
|
throw e.onError?.(n), n;
|
|
2221
2221
|
}
|
|
2222
2222
|
function S(t) {
|
|
2223
|
-
|
|
2223
|
+
Le(e.onError, t);
|
|
2224
2224
|
}
|
|
2225
2225
|
function C(e, t, n) {
|
|
2226
2226
|
return [
|
|
@@ -2270,7 +2270,7 @@ function Nt(e) {
|
|
|
2270
2270
|
a.value = !1;
|
|
2271
2271
|
}
|
|
2272
2272
|
}
|
|
2273
|
-
async function
|
|
2273
|
+
async function ee(e) {
|
|
2274
2274
|
let { create: n } = t;
|
|
2275
2275
|
typeof n != "function" && v("create");
|
|
2276
2276
|
let r = g("create");
|
|
@@ -2284,7 +2284,7 @@ function Nt(e) {
|
|
|
2284
2284
|
o.value = !1;
|
|
2285
2285
|
}
|
|
2286
2286
|
}
|
|
2287
|
-
async function
|
|
2287
|
+
async function te(e, n) {
|
|
2288
2288
|
let { update: r } = t;
|
|
2289
2289
|
typeof r != "function" && v("update");
|
|
2290
2290
|
let i = g("update");
|
|
@@ -2298,7 +2298,7 @@ function Nt(e) {
|
|
|
2298
2298
|
o.value = !1;
|
|
2299
2299
|
}
|
|
2300
2300
|
}
|
|
2301
|
-
async function
|
|
2301
|
+
async function O(e) {
|
|
2302
2302
|
let { delete: n } = t;
|
|
2303
2303
|
typeof n != "function" && v("delete");
|
|
2304
2304
|
let r = g("delete");
|
|
@@ -2313,7 +2313,7 @@ function Nt(e) {
|
|
|
2313
2313
|
o.value = !1;
|
|
2314
2314
|
}
|
|
2315
2315
|
}
|
|
2316
|
-
async function
|
|
2316
|
+
async function k(e, n) {
|
|
2317
2317
|
let { setResolved: r } = t;
|
|
2318
2318
|
typeof r != "function" && v("setResolved");
|
|
2319
2319
|
let i = g("setResolved");
|
|
@@ -2327,13 +2327,13 @@ function Nt(e) {
|
|
|
2327
2327
|
o.value = !1;
|
|
2328
2328
|
}
|
|
2329
2329
|
}
|
|
2330
|
-
function
|
|
2330
|
+
function A(e) {
|
|
2331
2331
|
T(e) && S(() => t.onCreated?.(e, { origin: "remote" }));
|
|
2332
2332
|
}
|
|
2333
|
-
function
|
|
2333
|
+
function j(e) {
|
|
2334
2334
|
T(e) && S(() => (e.resolvedAt ? t.onResolved : t.onUpdated)?.(e, { origin: "remote" }));
|
|
2335
2335
|
}
|
|
2336
|
-
function
|
|
2336
|
+
function M(e, n) {
|
|
2337
2337
|
let r = E(e, n);
|
|
2338
2338
|
r && S(() => t.onDeleted?.(r, { origin: "remote" }));
|
|
2339
2339
|
}
|
|
@@ -2349,18 +2349,18 @@ function Nt(e) {
|
|
|
2349
2349
|
unresolvedCount: m,
|
|
2350
2350
|
commentCountByBlock: h,
|
|
2351
2351
|
load: D,
|
|
2352
|
-
create:
|
|
2353
|
-
update:
|
|
2354
|
-
remove:
|
|
2355
|
-
setResolved:
|
|
2352
|
+
create: ee,
|
|
2353
|
+
update: te,
|
|
2354
|
+
remove: O,
|
|
2355
|
+
setResolved: k,
|
|
2356
2356
|
find: y,
|
|
2357
2357
|
isOwn: b,
|
|
2358
|
-
applyRemoteCreate:
|
|
2359
|
-
applyRemoteUpdate:
|
|
2360
|
-
applyRemoteDelete:
|
|
2358
|
+
applyRemoteCreate: A,
|
|
2359
|
+
applyRemoteUpdate: j,
|
|
2360
|
+
applyRemoteDelete: M
|
|
2361
2361
|
};
|
|
2362
2362
|
}
|
|
2363
|
-
function
|
|
2363
|
+
function Ft(e) {
|
|
2364
2364
|
let { comments: n, provider: r, getTemplateId: i } = e, { subscribe: a } = r;
|
|
2365
2365
|
if (typeof a != "function") return;
|
|
2366
2366
|
let o = null;
|
|
@@ -2381,7 +2381,7 @@ function Pt(e) {
|
|
|
2381
2381
|
}));
|
|
2382
2382
|
}, { immediate: !0 }), l(s);
|
|
2383
2383
|
}
|
|
2384
|
-
var
|
|
2384
|
+
var It = J({
|
|
2385
2385
|
name: "code",
|
|
2386
2386
|
size: 24,
|
|
2387
2387
|
node: [["path", {
|
|
@@ -2391,14 +2391,14 @@ var Ft = me({
|
|
|
2391
2391
|
d: "m8 6-6 6 6 6",
|
|
2392
2392
|
key: "ppft3o"
|
|
2393
2393
|
}]]
|
|
2394
|
-
}),
|
|
2394
|
+
}), Lt = J({
|
|
2395
2395
|
name: "navigation",
|
|
2396
2396
|
size: 24,
|
|
2397
2397
|
node: [["polygon", {
|
|
2398
2398
|
points: "3 11 22 2 13 21 11 13 3 11",
|
|
2399
2399
|
key: "1ltx0t"
|
|
2400
2400
|
}]]
|
|
2401
|
-
}),
|
|
2401
|
+
}), Rt = J({
|
|
2402
2402
|
name: "share-2",
|
|
2403
2403
|
size: 24,
|
|
2404
2404
|
node: [
|
|
@@ -2435,7 +2435,7 @@ var Ft = me({
|
|
|
2435
2435
|
key: "1n3mei"
|
|
2436
2436
|
}]
|
|
2437
2437
|
]
|
|
2438
|
-
}),
|
|
2438
|
+
}), zt = J({
|
|
2439
2439
|
name: "table",
|
|
2440
2440
|
size: 24,
|
|
2441
2441
|
node: [
|
|
@@ -2460,9 +2460,9 @@ var Ft = me({
|
|
|
2460
2460
|
key: "5xshup"
|
|
2461
2461
|
}]
|
|
2462
2462
|
]
|
|
2463
|
-
}),
|
|
2463
|
+
}), Bt = 1e4;
|
|
2464
2464
|
// src/composables/useImageUrlResolver.ts
|
|
2465
|
-
function
|
|
2465
|
+
function Vt(e) {
|
|
2466
2466
|
let t = s(/* @__PURE__ */ new Map()), n = /* @__PURE__ */ new Set();
|
|
2467
2467
|
function r(e) {
|
|
2468
2468
|
return t.get(e);
|
|
@@ -2491,7 +2491,7 @@ function Bt(e) {
|
|
|
2491
2491
|
lookup: a
|
|
2492
2492
|
};
|
|
2493
2493
|
}
|
|
2494
|
-
function
|
|
2494
|
+
function Ht(e) {
|
|
2495
2495
|
let n = C(ve, null), r = d(e);
|
|
2496
2496
|
if (!n) return r;
|
|
2497
2497
|
let i;
|
|
@@ -2513,36 +2513,36 @@ function Vt(e) {
|
|
|
2513
2513
|
return typeof t == "string" && t.length > 0 ? t : e;
|
|
2514
2514
|
});
|
|
2515
2515
|
}
|
|
2516
|
-
function
|
|
2516
|
+
function Ut(e, t) {
|
|
2517
2517
|
if (!e || !t) return t;
|
|
2518
2518
|
let n = e.get(t);
|
|
2519
2519
|
return typeof n == "string" && n.length > 0 ? n : t;
|
|
2520
2520
|
}
|
|
2521
|
-
function Ut(e, t) {
|
|
2522
|
-
return typeof e?.url == "string" && oe(e.url, t);
|
|
2523
|
-
}
|
|
2524
2521
|
function Wt(e, t) {
|
|
2522
|
+
return typeof e?.url == "string" && P(e.url, t);
|
|
2523
|
+
}
|
|
2524
|
+
function Gt(e, t) {
|
|
2525
2525
|
let n = e?.url;
|
|
2526
|
-
if (typeof n == "string" && n.trim() !== "") return
|
|
2526
|
+
if (typeof n == "string" && n.trim() !== "") return P(n, t) ? void 0 : n;
|
|
2527
2527
|
}
|
|
2528
|
-
function
|
|
2529
|
-
let t = C(_e,
|
|
2530
|
-
return d(() =>
|
|
2528
|
+
function Kt(e) {
|
|
2529
|
+
let t = C(_e, pe.liquid), n = Ht(() => Gt(e(), t));
|
|
2530
|
+
return d(() => Wt(e(), t) ? null : n.value);
|
|
2531
2531
|
}
|
|
2532
|
-
function
|
|
2533
|
-
return
|
|
2532
|
+
function qt(e, t, n) {
|
|
2533
|
+
return Wt(t, n) ? null : Ut(e, Gt(t, n));
|
|
2534
2534
|
}
|
|
2535
2535
|
// src/utils/blockTypeLabels.ts
|
|
2536
|
-
function
|
|
2536
|
+
function Jt(e, t) {
|
|
2537
2537
|
return t.blocks[e] ?? e;
|
|
2538
2538
|
}
|
|
2539
|
-
function
|
|
2540
|
-
if (e.type !== "custom") return
|
|
2539
|
+
function Yt(e, t, n = []) {
|
|
2540
|
+
if (e.type !== "custom") return Jt(e.type, t);
|
|
2541
2541
|
let { customType: r } = e;
|
|
2542
2542
|
return n.find((e) => e.type === r)?.name ?? r;
|
|
2543
2543
|
}
|
|
2544
2544
|
// src/utils/resolveFieldColors.ts
|
|
2545
|
-
function
|
|
2545
|
+
function Xt(e, t) {
|
|
2546
2546
|
let n = Se({ presets: e.presets }, Ce), r = n.presets.length === 0, i = e.allowCustom ?? t.allowCustom;
|
|
2547
2547
|
return {
|
|
2548
2548
|
presets: r ? t.presets : n.presets,
|
|
@@ -2554,19 +2554,19 @@ function Yt(e, t) {
|
|
|
2554
2554
|
};
|
|
2555
2555
|
}
|
|
2556
2556
|
// src/utils/imageNaturalSize.ts
|
|
2557
|
-
function
|
|
2557
|
+
function Zt(e) {
|
|
2558
2558
|
return typeof e == "number" && Number.isFinite(e) && e > 0;
|
|
2559
2559
|
}
|
|
2560
|
-
function
|
|
2561
|
-
return
|
|
2560
|
+
function Qt(e, t) {
|
|
2561
|
+
return Zt(e) && Zt(t) ? {
|
|
2562
2562
|
width: e,
|
|
2563
2563
|
height: t
|
|
2564
2564
|
} : null;
|
|
2565
2565
|
}
|
|
2566
|
-
function Qt(e) {
|
|
2567
|
-
return Zt(e.naturalWidth, e.naturalHeight);
|
|
2568
|
-
}
|
|
2569
2566
|
function $t(e) {
|
|
2567
|
+
return Qt(e.naturalWidth, e.naturalHeight);
|
|
2568
|
+
}
|
|
2569
|
+
function en(e) {
|
|
2570
2570
|
return e ? {
|
|
2571
2571
|
naturalWidth: e.width,
|
|
2572
2572
|
naturalHeight: e.height
|
|
@@ -2575,35 +2575,35 @@ function $t(e) {
|
|
|
2575
2575
|
naturalHeight: void 0
|
|
2576
2576
|
};
|
|
2577
2577
|
}
|
|
2578
|
-
function
|
|
2578
|
+
function tn(e, t) {
|
|
2579
2579
|
if (typeof Image > "u") return t(null), () => {};
|
|
2580
2580
|
let n = new Image(), r = () => {
|
|
2581
2581
|
n.onload = null, n.onerror = null;
|
|
2582
2582
|
};
|
|
2583
2583
|
return n.onload = () => {
|
|
2584
|
-
r(), t(
|
|
2584
|
+
r(), t(Qt(n.naturalWidth, n.naturalHeight));
|
|
2585
2585
|
}, n.onerror = () => {
|
|
2586
2586
|
r(), t(null);
|
|
2587
2587
|
}, n.src = e, r;
|
|
2588
2588
|
}
|
|
2589
|
-
function
|
|
2589
|
+
function nn(e) {
|
|
2590
2590
|
return new Promise((t) => {
|
|
2591
2591
|
let n = setTimeout(() => {
|
|
2592
2592
|
r(), t(null);
|
|
2593
|
-
},
|
|
2593
|
+
}, Bt), r = tn(e, (e) => {
|
|
2594
2594
|
clearTimeout(n), t(e);
|
|
2595
2595
|
});
|
|
2596
2596
|
});
|
|
2597
2597
|
}
|
|
2598
2598
|
// src/components/MediaDropOverlay.vue
|
|
2599
|
-
var
|
|
2599
|
+
var rn = /* @__PURE__ */ w({
|
|
2600
2600
|
__name: "MediaDropOverlay",
|
|
2601
2601
|
props: {
|
|
2602
2602
|
uploading: { type: Boolean },
|
|
2603
2603
|
size: { default: "field" }
|
|
2604
2604
|
},
|
|
2605
2605
|
setup(e) {
|
|
2606
|
-
let t = e, { t: r } =
|
|
2606
|
+
let t = e, { t: r } = Y(), s = {
|
|
2607
2607
|
field: {
|
|
2608
2608
|
gap: "tpl:gap-1.5",
|
|
2609
2609
|
icon: 18,
|
|
@@ -2629,28 +2629,28 @@ var nn = /* @__PURE__ */ w({
|
|
|
2629
2629
|
}
|
|
2630
2630
|
});
|
|
2631
2631
|
// src/composables/useAliveFlag.ts
|
|
2632
|
-
function
|
|
2632
|
+
function an() {
|
|
2633
2633
|
let e = { alive: !0 };
|
|
2634
2634
|
return _(() => {
|
|
2635
2635
|
e.alive = !1;
|
|
2636
2636
|
}), e;
|
|
2637
2637
|
}
|
|
2638
2638
|
// src/composables/useImageDrop.ts
|
|
2639
|
-
var
|
|
2640
|
-
function
|
|
2641
|
-
let { target: t, onFiles: n, enabled: r } = e, i = () => r === void 0 || b(r), { isOverDropZone: a } =
|
|
2639
|
+
var on = "image/";
|
|
2640
|
+
function sn(e) {
|
|
2641
|
+
let { target: t, onFiles: n, enabled: r } = e, i = () => r === void 0 || b(r), { isOverDropZone: a } = xe(t, {
|
|
2642
2642
|
preventDefaultForUnhandled: !0,
|
|
2643
2643
|
onDrop: (e) => {
|
|
2644
2644
|
if (!i()) return;
|
|
2645
|
-
let t = (e ?? []).filter((e) => e.type.startsWith(
|
|
2645
|
+
let t = (e ?? []).filter((e) => e.type.startsWith(on));
|
|
2646
2646
|
t.length > 0 && n([t[0]]);
|
|
2647
2647
|
}
|
|
2648
2648
|
});
|
|
2649
2649
|
return { isOver: d(() => i() && a.value) };
|
|
2650
2650
|
}
|
|
2651
2651
|
// src/composables/useMediaDropField.ts
|
|
2652
|
-
function
|
|
2653
|
-
let { target: t, blocked: n, apply: r } = e, i = C(ye, null), a = C(be, null), o =
|
|
2652
|
+
function cn(e) {
|
|
2653
|
+
let { target: t, blocked: n, apply: r } = e, i = C(ye, null), a = C(be, null), o = an();
|
|
2654
2654
|
async function s() {
|
|
2655
2655
|
let e = await i?.({ accept: ["images"] });
|
|
2656
2656
|
o.alive && e && r(e);
|
|
@@ -2671,7 +2671,7 @@ function sn(e) {
|
|
|
2671
2671
|
}
|
|
2672
2672
|
}
|
|
2673
2673
|
}
|
|
2674
|
-
let { isOver: f } =
|
|
2674
|
+
let { isOver: f } = sn({
|
|
2675
2675
|
target: t,
|
|
2676
2676
|
enabled: l,
|
|
2677
2677
|
onFiles: u
|
|
@@ -2684,35 +2684,13 @@ function sn(e) {
|
|
|
2684
2684
|
openMediaBrowser: s
|
|
2685
2685
|
};
|
|
2686
2686
|
}
|
|
2687
|
-
function
|
|
2687
|
+
function ln(e, t = "desktop") {
|
|
2688
2688
|
return t === "mobile" ? 375 : e?.width ?? 600;
|
|
2689
2689
|
}
|
|
2690
|
-
var
|
|
2691
|
-
|
|
2692
|
-
2: [50, 50],
|
|
2693
|
-
3: [
|
|
2694
|
-
33.33,
|
|
2695
|
-
33.33,
|
|
2696
|
-
33.34
|
|
2697
|
-
],
|
|
2698
|
-
4: [
|
|
2699
|
-
25,
|
|
2700
|
-
25,
|
|
2701
|
-
25,
|
|
2702
|
-
25
|
|
2703
|
-
],
|
|
2704
|
-
"1-2": [33.33, 66.67],
|
|
2705
|
-
"2-1": [66.67, 33.33],
|
|
2706
|
-
"1-3": [25, 75],
|
|
2707
|
-
"3-1": [75, 25],
|
|
2708
|
-
"1-2-1": [
|
|
2709
|
-
25,
|
|
2710
|
-
50,
|
|
2711
|
-
25
|
|
2712
|
-
]
|
|
2713
|
-
};
|
|
2690
|
+
var un = "width 300ms cubic-bezier(0.34, 1.56, 0.64, 1)";
|
|
2691
|
+
// src/utils/imageRoom.ts
|
|
2714
2692
|
function dn(e, t) {
|
|
2715
|
-
let n = (e) => Math.trunc(e ?? 0), r = (e) =>
|
|
2693
|
+
let n = (e) => Math.trunc(e ?? 0), r = (e) => fe(e) === null ? 0 : Math.trunc(e.width);
|
|
2716
2694
|
return n(e?.left) + n(e?.right) + r(t?.left) + r(t?.right);
|
|
2717
2695
|
}
|
|
2718
2696
|
function fn(e, t) {
|
|
@@ -2723,23 +2701,23 @@ function pn(e, t) {
|
|
|
2723
2701
|
return Math.floor(t) - dn(e.styles.padding, n);
|
|
2724
2702
|
}
|
|
2725
2703
|
function* mn(e, t) {
|
|
2726
|
-
for (let n of e)
|
|
2704
|
+
for (let n of e) ne(n) ? yield* mn(n.children, fn(t, n.styles.padding)) : yield {
|
|
2727
2705
|
block: n,
|
|
2728
|
-
bandWidth:
|
|
2706
|
+
bandWidth: U(n) && n.wrapper ? fn(t, n.wrapper.padding) : t
|
|
2729
2707
|
};
|
|
2730
2708
|
}
|
|
2731
2709
|
function hn(e, t, n = W(e)) {
|
|
2732
2710
|
if (!t) return e;
|
|
2733
2711
|
try {
|
|
2734
|
-
return
|
|
2712
|
+
return T(oe(t, n, { missing: "default" }), e);
|
|
2735
2713
|
} catch {
|
|
2736
2714
|
return e;
|
|
2737
2715
|
}
|
|
2738
2716
|
}
|
|
2739
2717
|
function gn(e, t, n, r) {
|
|
2740
2718
|
let i = hn(e, n, r);
|
|
2741
|
-
for (let { block: e, bandWidth: n } of mn(i.blocks, i.settings.width)) if (
|
|
2742
|
-
let r =
|
|
2719
|
+
for (let { block: e, bandWidth: n } of mn(i.blocks, i.settings.width)) if (U(e)) {
|
|
2720
|
+
let r = A(e)?.applied ? void 0 : e.border, i = Math.floor(n) - dn(e.styles.padding, r), a = ue(e);
|
|
2743
2721
|
for (let n = 0; n < e.children.length; n++) {
|
|
2744
2722
|
let r = Math.floor(i * (a[n] ?? 100) / 100), o = e.children[n].find((e) => e.id === t);
|
|
2745
2723
|
if (o) return pn(o, r);
|
|
@@ -2753,14 +2731,14 @@ function _n(e, t, n, r) {
|
|
|
2753
2731
|
return null;
|
|
2754
2732
|
}
|
|
2755
2733
|
function vn(e) {
|
|
2756
|
-
let t =
|
|
2734
|
+
let t = U(e) ? A(e) : null;
|
|
2757
2735
|
return !!t?.applied && t.height === "image";
|
|
2758
2736
|
}
|
|
2759
2737
|
function yn(e, t, n, r) {
|
|
2760
|
-
if (vn(e)) return (t ? _n(t, e.id, n, r) : null) ??
|
|
2738
|
+
if (vn(e)) return (t ? _n(t, e.id, n, r) : null) ?? ln(t?.settings);
|
|
2761
2739
|
}
|
|
2762
2740
|
// src/constants/socialIcons.ts
|
|
2763
|
-
var bn =
|
|
2741
|
+
var bn = R, xn = {
|
|
2764
2742
|
small: 24,
|
|
2765
2743
|
medium: 32,
|
|
2766
2744
|
large: 48
|
|
@@ -2784,4 +2762,4 @@ var bn = ie, xn = {
|
|
|
2784
2762
|
"dribbble",
|
|
2785
2763
|
"behance"
|
|
2786
2764
|
];
|
|
2787
|
-
export {
|
|
2765
|
+
export { We as A, qe as B, qt as C, Rt as D, zt as E, Ue as F, Nt as G, He as H, Et as I, Ft as L, kt as M, ft as N, Lt as O, Ge as P, Pt as R, Gt as S, Ht as T, Je as U, Re as V, Dt as W, Qt as _, vn as a, Jt as b, un as c, an as d, rn as f, $t as g, en as h, gn as i, Mt as j, It as k, ln as l, nn as m, bn as n, yn as o, tn as p, Sn as r, _n as s, xn as t, cn as u, Xt as v, Kt as w, Vt as x, Yt as y, Ke as z };
|