@shapio/cms 0.3.1 → 0.4.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/admin/assets/AssetTile-C-Mu0BRF.js +2 -0
- package/dist/admin/assets/AssetTile-C-Mu0BRF.js.map +1 -0
- package/dist/admin/assets/{AssistError-BYR085vj.js → AssistError-B-bnaHhJ.js} +2 -2
- package/dist/admin/assets/{AssistError-BYR085vj.js.map → AssistError-B-bnaHhJ.js.map} +1 -1
- package/dist/admin/assets/{BlockMenuItems-BnLF3Efc.js → BlockMenuItems-Dn9WULjL.js} +3 -3
- package/dist/admin/assets/{BlockMenuItems-BnLF3Efc.js.map → BlockMenuItems-Dn9WULjL.js.map} +1 -1
- package/dist/admin/assets/Body-C0SwduLi.js +2 -0
- package/dist/admin/assets/{Body-CCOZq2q9.js.map → Body-C0SwduLi.js.map} +1 -1
- package/dist/admin/assets/Builder-C11yUgu9.js +2 -0
- package/dist/admin/assets/Builder-C11yUgu9.js.map +1 -0
- package/dist/admin/assets/{ConfirmDialog-Tu-gjEwm.js → ConfirmDialog-BfpN2MQx.js} +2 -2
- package/dist/admin/assets/{ConfirmDialog-Tu-gjEwm.js.map → ConfirmDialog-BfpN2MQx.js.map} +1 -1
- package/dist/admin/assets/{CopyButton-BuBaIlCk.js → CopyButton-Dxbzp7hC.js} +2 -2
- package/dist/admin/assets/{CopyButton-BuBaIlCk.js.map → CopyButton-Dxbzp7hC.js.map} +1 -1
- package/dist/admin/assets/{CursorPager-Bvu3CXpD.js → CursorPager-DkZs6rPg.js} +2 -2
- package/dist/admin/assets/{CursorPager-Bvu3CXpD.js.map → CursorPager-DkZs6rPg.js.map} +1 -1
- package/dist/admin/assets/{ExternalLink-CCr5oRXI.js → ExternalLink-KdO72pTj.js} +2 -2
- package/dist/admin/assets/{ExternalLink-CCr5oRXI.js.map → ExternalLink-KdO72pTj.js.map} +1 -1
- package/dist/admin/assets/FocalPoint-r1MG_y-r.js +2 -0
- package/dist/admin/assets/FocalPoint-r1MG_y-r.js.map +1 -0
- package/dist/admin/assets/Form-D8vp4Kd_.js +2 -0
- package/dist/admin/assets/{Form-Doc0JEzF.js.map → Form-D8vp4Kd_.js.map} +1 -1
- package/dist/admin/assets/{FormCheckboxGroup-eg39IJvf.js → FormCheckboxGroup-8ObPh9cH.js} +2 -2
- package/dist/admin/assets/{FormCheckboxGroup-eg39IJvf.js.map → FormCheckboxGroup-8ObPh9cH.js.map} +1 -1
- package/dist/admin/assets/{FormRadioGroup-ZppSTZK6.js → FormRadioGroup-CAB3qzVS.js} +2 -2
- package/dist/admin/assets/{FormRadioGroup-ZppSTZK6.js.map → FormRadioGroup-CAB3qzVS.js.map} +1 -1
- package/dist/admin/assets/{FormSelectField-Cosnxiz-.js → FormSelectField-C7hE05Wq.js} +2 -2
- package/dist/admin/assets/{FormSelectField-Cosnxiz-.js.map → FormSelectField-C7hE05Wq.js.map} +1 -1
- package/dist/admin/assets/{FormSwitchField-DsKQEZw6.js → FormSwitchField-7EEYkGOH.js} +2 -2
- package/dist/admin/assets/{FormSwitchField-DsKQEZw6.js.map → FormSwitchField-7EEYkGOH.js.map} +1 -1
- package/dist/admin/assets/{FormTextareaField-BXidSgIE.js → FormTextareaField-BasuRoXW.js} +2 -2
- package/dist/admin/assets/{FormTextareaField-BXidSgIE.js.map → FormTextareaField-BasuRoXW.js.map} +1 -1
- package/dist/admin/assets/{HintedLabel-USQku9Yt.js → HintedLabel-BDV81kIT.js} +2 -2
- package/dist/admin/assets/{HintedLabel-USQku9Yt.js.map → HintedLabel-BDV81kIT.js.map} +1 -1
- package/dist/admin/assets/{InfoHint-Bz_yvehr.js → InfoHint-DWn9kLf1.js} +2 -2
- package/dist/admin/assets/{InfoHint-Bz_yvehr.js.map → InfoHint-DWn9kLf1.js.map} +1 -1
- package/dist/admin/assets/InsertMenuItem-DhJk5BeH.js +2 -0
- package/dist/admin/assets/InsertMenuItem-DhJk5BeH.js.map +1 -0
- package/dist/admin/assets/{LinkTabs-D4U-rJyK.js → LinkTabs-stM3j4aH.js} +2 -2
- package/dist/admin/assets/{LinkTabs-D4U-rJyK.js.map → LinkTabs-stM3j4aH.js.map} +1 -1
- package/dist/admin/assets/{Match-UAw1Ss8a.js → Match-Zu4pwfCC.js} +2 -2
- package/dist/admin/assets/{Match-UAw1Ss8a.js.map → Match-Zu4pwfCC.js.map} +1 -1
- package/dist/admin/assets/{Panel-BdjqCkKs.js → Panel-ClY9b33D.js} +2 -2
- package/dist/admin/assets/{Panel-BdjqCkKs.js.map → Panel-ClY9b33D.js.map} +1 -1
- package/dist/admin/assets/{QueryView-Bkyizh1P.js → QueryView-Cu-KPtQI.js} +2 -2
- package/dist/admin/assets/{QueryView-Bkyizh1P.js.map → QueryView-Cu-KPtQI.js.map} +1 -1
- package/dist/admin/assets/{RadioTile-VHTPl88w.js → RadioTile-Ci0LucKI.js} +2 -2
- package/dist/admin/assets/{RadioTile-VHTPl88w.js.map → RadioTile-Ci0LucKI.js.map} +1 -1
- package/dist/admin/assets/RichTextField-BcYOFkeW.js +144 -0
- package/dist/admin/assets/{RichTextField-B21FqrT5.js.map → RichTextField-BcYOFkeW.js.map} +1 -1
- package/dist/admin/assets/{RowTitle-BD8QPs_v.js → RowTitle-BdDgA5Lb.js} +2 -2
- package/dist/admin/assets/{RowTitle-BD8QPs_v.js.map → RowTitle-BdDgA5Lb.js.map} +1 -1
- package/dist/admin/assets/{SecretReveal-BfJKUxXW.js → SecretReveal-ai1uMW_b.js} +2 -2
- package/dist/admin/assets/{SecretReveal-BfJKUxXW.js.map → SecretReveal-ai1uMW_b.js.map} +1 -1
- package/dist/admin/assets/{SharedGlyph-DDPdvsm_.js → SharedGlyph-y6ZsA_gz.js} +2 -2
- package/dist/admin/assets/{SharedGlyph-DDPdvsm_.js.map → SharedGlyph-y6ZsA_gz.js.map} +1 -1
- package/dist/admin/assets/{StepList-DKhkw1hN.js → StepList-xmD9CPZl.js} +2 -2
- package/dist/admin/assets/{StepList-DKhkw1hN.js.map → StepList-xmD9CPZl.js.map} +1 -1
- package/dist/admin/assets/Structure-DGt-TDk5.js +2 -0
- package/dist/admin/assets/{Structure-C7dr00Bp.js.map → Structure-DGt-TDk5.js.map} +1 -1
- package/dist/admin/assets/{SubNavLink-BAF2-wuF.js → SubNavLink-YjjaDN40.js} +2 -2
- package/dist/admin/assets/{SubNavLink-BAF2-wuF.js.map → SubNavLink-YjjaDN40.js.map} +1 -1
- package/dist/admin/assets/{SuggestAltButton-DEsbHvs4.js → SuggestAltButton-D1-v_0wB.js} +2 -2
- package/dist/admin/assets/{SuggestAltButton-DEsbHvs4.js.map → SuggestAltButton-D1-v_0wB.js.map} +1 -1
- package/dist/admin/assets/{TextLink-CegO3jom.js → TextLink-DIqr5zkJ.js} +2 -2
- package/dist/admin/assets/{TextLink-CegO3jom.js.map → TextLink-DIqr5zkJ.js.map} +1 -1
- package/dist/admin/assets/Thumbnail-cjA7fSWh.js +2 -0
- package/dist/admin/assets/Thumbnail-cjA7fSWh.js.map +1 -0
- package/dist/admin/assets/{UnsavedChangesGuard-Cbfg-Bgj.js → UnsavedChangesGuard-B57D0278.js} +2 -2
- package/dist/admin/assets/{UnsavedChangesGuard-Cbfg-Bgj.js.map → UnsavedChangesGuard-B57D0278.js.map} +1 -1
- package/dist/admin/assets/{UserAvatar-CiZ00-cr.js → UserAvatar--pMv2i3c.js} +2 -2
- package/dist/admin/assets/{UserAvatar-CiZ00-cr.js.map → UserAvatar--pMv2i3c.js.map} +1 -1
- package/dist/admin/assets/{auth-BaVAo0u_.js → auth-YVfK3SxF.js} +2 -2
- package/dist/admin/assets/{auth-BaVAo0u_.js.map → auth-YVfK3SxF.js.map} +1 -1
- package/dist/admin/assets/{badge-IBeVOhKd.js → badge-C5oMRtwJ.js} +2 -2
- package/dist/admin/assets/{badge-IBeVOhKd.js.map → badge-C5oMRtwJ.js.map} +1 -1
- package/dist/admin/assets/{boxes-BH0MDegO.js → boxes-DRvd25_u.js} +2 -2
- package/dist/admin/assets/{boxes-BH0MDegO.js.map → boxes-DRvd25_u.js.map} +1 -1
- package/dist/admin/assets/{calendar-clock-DKUk-w81.js → calendar-clock-VENf4s1R.js} +2 -2
- package/dist/admin/assets/{calendar-clock-DKUk-w81.js.map → calendar-clock-VENf4s1R.js.map} +1 -1
- package/dist/admin/assets/{changeSets-o_G67qPk.js → changeSets-CObZV8H2.js} +2 -2
- package/dist/admin/assets/{changeSets-o_G67qPk.js.map → changeSets-CObZV8H2.js.map} +1 -1
- package/dist/admin/assets/chevron-left-D2DnQyeV.js +2 -0
- package/dist/admin/assets/{chevron-left-D259hWJn.js.map → chevron-left-D2DnQyeV.js.map} +1 -1
- package/dist/admin/assets/{circle-check-Cidzt1Ww.js → circle-check-jmRQz1Jq.js} +2 -2
- package/dist/admin/assets/{circle-check-Cidzt1Ww.js.map → circle-check-jmRQz1Jq.js.map} +1 -1
- package/dist/admin/assets/{clock-BOtPNp9-.js → clock-DrSTMGjp.js} +2 -2
- package/dist/admin/assets/{clock-BOtPNp9-.js.map → clock-DrSTMGjp.js.map} +1 -1
- package/dist/admin/assets/cn-CL1YHRrS.js +2 -0
- package/dist/admin/assets/cn-CL1YHRrS.js.map +1 -0
- package/dist/admin/assets/coerce-B4MJTGg1.js +2 -0
- package/dist/admin/assets/{coerce-DWI5sgLW.js.map → coerce-B4MJTGg1.js.map} +1 -1
- package/dist/admin/assets/constants-DT4WPUvz.js +2 -0
- package/dist/admin/assets/{constants-CgUdkWmf.js.map → constants-DT4WPUvz.js.map} +1 -1
- package/dist/admin/assets/content-HvisCB5m.js +3 -0
- package/dist/admin/assets/content-HvisCB5m.js.map +1 -0
- package/dist/admin/assets/{contentCounts-T-LmvUf5.js → contentCounts-DzIvdeXR.js} +2 -2
- package/dist/admin/assets/{contentCounts-T-LmvUf5.js.map → contentCounts-DzIvdeXR.js.map} +1 -1
- package/dist/admin/assets/{contentTypes-BSlp81l1.js → contentTypes-ArLEfM29.js} +2 -2
- package/dist/admin/assets/{contentTypes-BSlp81l1.js.map → contentTypes-ArLEfM29.js.map} +1 -1
- package/dist/admin/assets/context-4Jl20mYc.js +2 -0
- package/dist/admin/assets/context-4Jl20mYc.js.map +1 -0
- package/dist/admin/assets/{copy-DT7dAzVm.js → copy-t6kAFw-O.js} +2 -2
- package/dist/admin/assets/{copy-DT7dAzVm.js.map → copy-t6kAFw-O.js.map} +1 -1
- package/dist/admin/assets/{dateTimeLocal-DRq7DuYO.js → dateTimeLocal-IDUOKulz.js} +2 -2
- package/dist/admin/assets/{dateTimeLocal-DRq7DuYO.js.map → dateTimeLocal-IDUOKulz.js.map} +1 -1
- package/dist/admin/assets/develop-DvKYqVeK.js +11 -0
- package/dist/admin/assets/develop-DvKYqVeK.js.map +1 -0
- package/dist/admin/assets/dropdown-menu-DPzDthV7.js +2 -0
- package/dist/admin/assets/dropdown-menu-DPzDthV7.js.map +1 -0
- package/dist/admin/assets/{ellipsis-xDmHl1SK.js → ellipsis-DEHUaCkn.js} +2 -2
- package/dist/admin/assets/{ellipsis-xDmHl1SK.js.map → ellipsis-DEHUaCkn.js.map} +1 -1
- package/dist/admin/assets/external-link-B8UFREQ_.js +2 -0
- package/dist/admin/assets/external-link-B8UFREQ_.js.map +1 -0
- package/dist/admin/assets/{fileRoute-Buucm0CU.js → fileRoute-sJvv4Ipn.js} +2 -2
- package/dist/admin/assets/{fileRoute-Buucm0CU.js.map → fileRoute-sJvv4Ipn.js.map} +1 -1
- package/dist/admin/assets/folder-plus-iDg1hhew.js +2 -0
- package/dist/admin/assets/folder-plus-iDg1hhew.js.map +1 -0
- package/dist/admin/assets/followPlural-tOh6gDgT.js +2 -0
- package/dist/admin/assets/{followPlural-Cuocm4Sv.js.map → followPlural-tOh6gDgT.js.map} +1 -1
- package/dist/admin/assets/{globe-CAhrwBgv.js → globe-TooNSp9V.js} +2 -2
- package/dist/admin/assets/{globe-CAhrwBgv.js.map → globe-TooNSp9V.js.map} +1 -1
- package/dist/admin/assets/{image-CGN6ffEu.js → image-CXZXXH58.js} +2 -2
- package/dist/admin/assets/{image-CGN6ffEu.js.map → image-CXZXXH58.js.map} +1 -1
- package/dist/admin/assets/{image-off-0zX_kODH.js → image-off-cxva5G-Y.js} +2 -2
- package/dist/admin/assets/{image-off-0zX_kODH.js.map → image-off-cxva5G-Y.js.map} +1 -1
- package/dist/admin/assets/{inbox-CukkApHK.js → inbox-B8c9Kj_z.js} +2 -2
- package/dist/admin/assets/{inbox-CukkApHK.js.map → inbox-B8c9Kj_z.js.map} +1 -1
- package/dist/admin/assets/{inbox-CWq1hHqK.js → inbox-nfR2K7f6.js} +2 -2
- package/dist/admin/assets/{inbox-CWq1hHqK.js.map → inbox-nfR2K7f6.js.map} +1 -1
- package/dist/admin/assets/index-Bbb2ER3l.css +2 -0
- package/dist/admin/assets/index-C6FrF34G.js +4 -0
- package/dist/admin/assets/index-C6FrF34G.js.map +1 -0
- package/dist/admin/assets/{key-round-DnE-2gr0.js → key-round-CFJ61iCd.js} +2 -2
- package/dist/admin/assets/{key-round-DnE-2gr0.js.map → key-round-CFJ61iCd.js.map} +1 -1
- package/dist/admin/assets/languages-eh7U4anI.js +2 -0
- package/dist/admin/assets/languages-eh7U4anI.js.map +1 -0
- package/dist/admin/assets/layers-mGfmMsKE.js +2 -0
- package/dist/admin/assets/layers-mGfmMsKE.js.map +1 -0
- package/dist/admin/assets/link-2-off-DbZzRN_w.js +2 -0
- package/dist/admin/assets/link-2-off-DbZzRN_w.js.map +1 -0
- package/dist/admin/assets/{link-DPniuk00.js → link-b2pFaN-A.js} +2 -2
- package/dist/admin/assets/{link-DPniuk00.js.map → link-b2pFaN-A.js.map} +1 -1
- package/dist/admin/assets/{locales-DFLQ17ow.js → locales-oBD0q1pN.js} +2 -2
- package/dist/admin/assets/{locales-DFLQ17ow.js.map → locales-oBD0q1pN.js.map} +1 -1
- package/dist/admin/assets/{media-CKTs3j83.js → media-5ks_0Rre.js} +2 -2
- package/dist/admin/assets/{media-CKTs3j83.js.map → media-5ks_0Rre.js.map} +1 -1
- package/dist/admin/assets/media-BzivlEh2.js +2 -0
- package/dist/admin/assets/{media-CUfV74JZ.js.map → media-BzivlEh2.js.map} +1 -1
- package/dist/admin/assets/network-Cj04CpFi.js +2 -0
- package/dist/admin/assets/network-Cj04CpFi.js.map +1 -0
- package/dist/admin/assets/{pencil-BqAgKC9v.js → pencil-C7eD5mlZ.js} +2 -2
- package/dist/admin/assets/{pencil-BqAgKC9v.js.map → pencil-C7eD5mlZ.js.map} +1 -1
- package/dist/admin/assets/{plus-DLRcpVhJ.js → plus-BDZHQBlU.js} +2 -2
- package/dist/admin/assets/{plus-DLRcpVhJ.js.map → plus-BDZHQBlU.js.map} +1 -1
- package/dist/admin/assets/{preload-helper-BHNBIF88.js → preload-helper-CJNJ4S3k.js} +2 -2
- package/dist/admin/assets/{preload-helper-BHNBIF88.js.map → preload-helper-CJNJ4S3k.js.map} +1 -1
- package/dist/admin/assets/publishing-ChHkrwvr.js +2 -0
- package/dist/admin/assets/{publishing-DaaE8PaU.js.map → publishing-ChHkrwvr.js.map} +1 -1
- package/dist/admin/assets/{radio-group-CA3XlQcc.js → radio-group-DSK5LPaM.js} +2 -2
- package/dist/admin/assets/{radio-group-CA3XlQcc.js.map → radio-group-DSK5LPaM.js.map} +1 -1
- package/dist/admin/assets/{rotate-ccw-CfrkcgYa.js → rotate-ccw-DCWwb4Ga.js} +2 -2
- package/dist/admin/assets/{rotate-ccw-CfrkcgYa.js.map → rotate-ccw-DCWwb4Ga.js.map} +1 -1
- package/dist/admin/assets/{schedules-hJQkjEhN.js → schedules-DXrBSypK.js} +2 -2
- package/dist/admin/assets/{schedules-hJQkjEhN.js.map → schedules-DXrBSypK.js.map} +1 -1
- package/dist/admin/assets/{schema--xSR7cf9.js → schema-B7L9OJrX.js} +2 -2
- package/dist/admin/assets/{schema--xSR7cf9.js.map → schema-B7L9OJrX.js.map} +1 -1
- package/dist/admin/assets/{scroll-text-BA9yh7Za.js → scroll-text-BLThe4Ki.js} +2 -2
- package/dist/admin/assets/{scroll-text-BA9yh7Za.js.map → scroll-text-BLThe4Ki.js.map} +1 -1
- package/dist/admin/assets/{file-text-BJkQMeQO.js → search-CcJQqtRw.js} +2 -2
- package/dist/admin/assets/search-CcJQqtRw.js.map +1 -0
- package/dist/admin/assets/{searchSchemas-C-nQbyhd.js → searchSchemas-BdwAFaVO.js} +2 -2
- package/dist/admin/assets/{searchSchemas-C-nQbyhd.js.map → searchSchemas-BdwAFaVO.js.map} +1 -1
- package/dist/admin/assets/{sections-D0OZozD2.js → sections-TIN_Nl1b.js} +2 -2
- package/dist/admin/assets/{sections-D0OZozD2.js.map → sections-TIN_Nl1b.js.map} +1 -1
- package/dist/admin/assets/sections-iNOzo7pL.js +2 -0
- package/dist/admin/assets/sections-iNOzo7pL.js.map +1 -0
- package/dist/admin/assets/{select-De48SQdZ.js → select-DyD7qIkJ.js} +2 -2
- package/dist/admin/assets/{select-De48SQdZ.js.map → select-DyD7qIkJ.js.map} +1 -1
- package/dist/admin/assets/{send-NuSmLVSD.js → send-CbP0Rc9_.js} +2 -2
- package/dist/admin/assets/{send-NuSmLVSD.js.map → send-CbP0Rc9_.js.map} +1 -1
- package/dist/admin/assets/seo-uMm2fGPB.js +2 -0
- package/dist/admin/assets/seo-uMm2fGPB.js.map +1 -0
- package/dist/admin/assets/settings-CJVORrIV.js +2 -0
- package/dist/admin/assets/settings-CJVORrIV.js.map +1 -0
- package/dist/admin/assets/skeleton-B5GJgv7y.js +42 -0
- package/dist/admin/assets/skeleton-B5GJgv7y.js.map +1 -0
- package/dist/admin/assets/snapshots-DkyyrWX3.js +2 -0
- package/dist/admin/assets/{snapshots-BQeFK5cj.js.map → snapshots-DkyyrWX3.js.map} +1 -1
- package/dist/admin/assets/{sparkles-B-0I44es.js → sparkles-D88gf3vX.js} +2 -2
- package/dist/admin/assets/{sparkles-B-0I44es.js.map → sparkles-D88gf3vX.js.map} +1 -1
- package/dist/admin/assets/src-B2qcqjNM.js +4 -0
- package/dist/admin/assets/src-B2qcqjNM.js.map +1 -0
- package/dist/admin/assets/{stableId-rPnYVF-A.js → stableId-DlNKh3HM.js} +2 -2
- package/dist/admin/assets/{stableId-rPnYVF-A.js.map → stableId-DlNKh3HM.js.map} +1 -1
- package/dist/admin/assets/{store-Bqd9L9DK.js → store-jUWyOXDG.js} +2 -2
- package/dist/admin/assets/{store-Bqd9L9DK.js.map → store-jUWyOXDG.js.map} +1 -1
- package/dist/admin/assets/{switch-JmfyFAQG.js → switch-DbIrjP3h.js} +2 -2
- package/dist/admin/assets/{switch-JmfyFAQG.js.map → switch-DbIrjP3h.js.map} +1 -1
- package/dist/admin/assets/table-DQ5ILlSh.js +56 -0
- package/dist/admin/assets/table-DQ5ILlSh.js.map +1 -0
- package/dist/admin/assets/tabs-BJhfL-lw.js +5 -0
- package/dist/admin/assets/tabs-BJhfL-lw.js.map +1 -0
- package/dist/admin/assets/{textarea-eatLAWE_.js → textarea-FwSvwmyT.js} +2 -2
- package/dist/admin/assets/{textarea-eatLAWE_.js.map → textarea-FwSvwmyT.js.map} +1 -1
- package/dist/admin/assets/theme-C0Tv6M38.js +2 -0
- package/dist/admin/assets/theme-C0Tv6M38.js.map +1 -0
- package/dist/admin/assets/{titles-Bi2fWNN4.js → titles-uL13bpi8.js} +2 -2
- package/dist/admin/assets/{titles-Bi2fWNN4.js.map → titles-uL13bpi8.js.map} +1 -1
- package/dist/admin/assets/{tokens-C2E7swse.js → tokens-C-20gLAT.js} +2 -2
- package/dist/admin/assets/{tokens-C2E7swse.js.map → tokens-C-20gLAT.js.map} +1 -1
- package/dist/admin/assets/{tooltip-Bji9fmSr.js → tooltip-BK5FqmJ0.js} +2 -2
- package/dist/admin/assets/{tooltip-Bji9fmSr.js.map → tooltip-BK5FqmJ0.js.map} +1 -1
- package/dist/admin/assets/{undo-2-BU-uqm7e.js → undo-2-CLy2zklL.js} +2 -2
- package/dist/admin/assets/{undo-2-BU-uqm7e.js.map → undo-2-CLy2zklL.js.map} +1 -1
- package/dist/admin/assets/{useAuditLabels-D5nmbXqN.js → useAuditLabels-BJF7M5RY.js} +2 -2
- package/dist/admin/assets/{useAuditLabels-D5nmbXqN.js.map → useAuditLabels-BJF7M5RY.js.map} +1 -1
- package/dist/admin/assets/{useConfirmTarget-Y7_8kVX5.js → useConfirmTarget-BUvlrGSW.js} +2 -2
- package/dist/admin/assets/{useConfirmTarget-Y7_8kVX5.js.map → useConfirmTarget-BUvlrGSW.js.map} +1 -1
- package/dist/admin/assets/{useContentSchema-DJTqjlUk.js → useContentSchema-BCdLYsKa.js} +2 -2
- package/dist/admin/assets/{useContentSchema-DJTqjlUk.js.map → useContentSchema-BCdLYsKa.js.map} +1 -1
- package/dist/admin/assets/{useCursorPager-CiJroOo7.js → useCursorPager-CzB6NDOB.js} +2 -2
- package/dist/admin/assets/{useCursorPager-CiJroOo7.js.map → useCursorPager-CzB6NDOB.js.map} +1 -1
- package/dist/admin/assets/{useDiscardGuard-t_N3l9TQ.js → useDiscardGuard-CGFgC3xY.js} +2 -2
- package/dist/admin/assets/{useDiscardGuard-t_N3l9TQ.js.map → useDiscardGuard-CGFgC3xY.js.map} +1 -1
- package/dist/admin/assets/useMediaPickerDialog-BOkGEyG7.js +2 -0
- package/dist/admin/assets/useMediaPickerDialog-BOkGEyG7.js.map +1 -0
- package/dist/admin/assets/useMediaUploader-D1ouV8jc.js +2 -0
- package/dist/admin/assets/useMediaUploader-D1ouV8jc.js.map +1 -0
- package/dist/admin/assets/{usePaletteItems-BVjWCdow.js → usePaletteItems-neKzBlys.js} +2 -2
- package/dist/admin/assets/{usePaletteItems-BVjWCdow.js.map → usePaletteItems-neKzBlys.js.map} +1 -1
- package/dist/admin/assets/{usePlaces-CnSOZwtO.js → usePlaces-6iTN15Xy.js} +2 -2
- package/dist/admin/assets/{usePlaces-CnSOZwtO.js.map → usePlaces-6iTN15Xy.js.map} +1 -1
- package/dist/admin/assets/{useQueries-BRolGUiw.js → useQueries-CYfcxI0Q.js} +2 -2
- package/dist/admin/assets/{useQueries-BRolGUiw.js.map → useQueries-CYfcxI0Q.js.map} +1 -1
- package/dist/admin/assets/useResolvedScheme-D0moXjaP.js +2 -0
- package/dist/admin/assets/{searchSchema-Ypl6gq9g.js.map → useResolvedScheme-D0moXjaP.js.map} +1 -1
- package/dist/admin/assets/useSchemaScopeAccess-WQKmj8_3.js +2 -0
- package/dist/admin/assets/useSchemaScopeAccess-WQKmj8_3.js.map +1 -0
- package/dist/admin/assets/{users-CbErtM7w.js → users-B01EH47o.js} +2 -2
- package/dist/admin/assets/{users-CbErtM7w.js.map → users-B01EH47o.js.map} +1 -1
- package/dist/admin/assets/{users-bDGYpSXg.js → users-BgTNDPXx.js} +2 -2
- package/dist/admin/assets/{users-bDGYpSXg.js.map → users-BgTNDPXx.js.map} +1 -1
- package/dist/admin/assets/{zod-Gtw4e0qi.js → zod-CS0EvbwG.js} +2 -2
- package/dist/admin/assets/{zod-Gtw4e0qi.js.map → zod-CS0EvbwG.js.map} +1 -1
- package/dist/admin/index.html +57 -57
- package/dist/admin/theme-init.js +23 -21
- package/dist/cli.js +19 -9
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/{public-B7fFHMNr.d.ts → public-BSbOGbK-.d.ts} +19 -3
- package/dist/{worker-BAmQPoTJ.js → worker-i1rY2TIZ.js} +1894 -612
- package/dist/worker-i1rY2TIZ.js.map +1 -0
- package/package.json +5 -5
- package/dist/admin/assets/Body-CCOZq2q9.js +0 -2
- package/dist/admin/assets/Builder-BZy9mphs.js +0 -2
- package/dist/admin/assets/Builder-BZy9mphs.js.map +0 -1
- package/dist/admin/assets/Form-Doc0JEzF.js +0 -2
- package/dist/admin/assets/InsertMenuItem-DJXglsEd.js +0 -2
- package/dist/admin/assets/InsertMenuItem-DJXglsEd.js.map +0 -1
- package/dist/admin/assets/RichTextField-B21FqrT5.js +0 -144
- package/dist/admin/assets/Structure-C7dr00Bp.js +0 -2
- package/dist/admin/assets/Thumbnail-CTpKlrxR.js +0 -2
- package/dist/admin/assets/Thumbnail-CTpKlrxR.js.map +0 -1
- package/dist/admin/assets/arrow-up-DwMJqZVV.js +0 -2
- package/dist/admin/assets/arrow-up-DwMJqZVV.js.map +0 -1
- package/dist/admin/assets/chevron-left-D259hWJn.js +0 -2
- package/dist/admin/assets/circle-x-c1RwmC6j.js +0 -2
- package/dist/admin/assets/circle-x-c1RwmC6j.js.map +0 -1
- package/dist/admin/assets/cn-M4_WHiur.js +0 -2
- package/dist/admin/assets/cn-M4_WHiur.js.map +0 -1
- package/dist/admin/assets/coerce-DWI5sgLW.js +0 -2
- package/dist/admin/assets/constants-CgUdkWmf.js +0 -2
- package/dist/admin/assets/content-D25ainqV.js +0 -3
- package/dist/admin/assets/content-D25ainqV.js.map +0 -1
- package/dist/admin/assets/develop-qF10t9tM.js +0 -11
- package/dist/admin/assets/develop-qF10t9tM.js.map +0 -1
- package/dist/admin/assets/dropdown-menu-Cl20LCvY.js +0 -2
- package/dist/admin/assets/dropdown-menu-Cl20LCvY.js.map +0 -1
- package/dist/admin/assets/external-link-DtJAaOWk.js +0 -2
- package/dist/admin/assets/external-link-DtJAaOWk.js.map +0 -1
- package/dist/admin/assets/file-text-BJkQMeQO.js.map +0 -1
- package/dist/admin/assets/followPlural-Cuocm4Sv.js +0 -2
- package/dist/admin/assets/index-C9uJxg4J.js +0 -4
- package/dist/admin/assets/index-C9uJxg4J.js.map +0 -1
- package/dist/admin/assets/index-Cz3C-LxB.css +0 -2
- package/dist/admin/assets/link-2-off-Cbpvb3w4.js +0 -2
- package/dist/admin/assets/link-2-off-Cbpvb3w4.js.map +0 -1
- package/dist/admin/assets/list-CkHF_4xh.js +0 -2
- package/dist/admin/assets/list-CkHF_4xh.js.map +0 -1
- package/dist/admin/assets/media-CUfV74JZ.js +0 -2
- package/dist/admin/assets/network-Fri1cjMt.js +0 -2
- package/dist/admin/assets/network-Fri1cjMt.js.map +0 -1
- package/dist/admin/assets/publishing-DaaE8PaU.js +0 -2
- package/dist/admin/assets/search--71HzPvh.js +0 -2
- package/dist/admin/assets/search--71HzPvh.js.map +0 -1
- package/dist/admin/assets/searchSchema-Ypl6gq9g.js +0 -2
- package/dist/admin/assets/sections-BBN2JErq.js +0 -2
- package/dist/admin/assets/sections-BBN2JErq.js.map +0 -1
- package/dist/admin/assets/settings-CYXU73dP.js +0 -2
- package/dist/admin/assets/settings-CYXU73dP.js.map +0 -1
- package/dist/admin/assets/skeleton-CCwdO9oq.js +0 -42
- package/dist/admin/assets/skeleton-CCwdO9oq.js.map +0 -1
- package/dist/admin/assets/snapshots-BQeFK5cj.js +0 -2
- package/dist/admin/assets/src-CQu-YxUM.js +0 -4
- package/dist/admin/assets/src-CQu-YxUM.js.map +0 -1
- package/dist/admin/assets/table-BEDv9IRM.js +0 -56
- package/dist/admin/assets/table-BEDv9IRM.js.map +0 -1
- package/dist/admin/assets/tabs-DSS1c-Kf.js +0 -5
- package/dist/admin/assets/tabs-DSS1c-Kf.js.map +0 -1
- package/dist/admin/assets/useMediaUploader-CLHmKCwq.js +0 -2
- package/dist/admin/assets/useMediaUploader-CLHmKCwq.js.map +0 -1
- package/dist/admin/assets/useSchemaScopeAccess-bd8RQxuu.js +0 -2
- package/dist/admin/assets/useSchemaScopeAccess-bd8RQxuu.js.map +0 -1
- package/dist/worker-BAmQPoTJ.js.map +0 -1
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{t as n}from"./react-dom-pEVw9mjF.js";import{t as r}from"./jsx-runtime-DREnUpxT.js";import{B as i,i as a,j as o,t as s,z as c}from"./cn-M4_WHiur.js";import{i as l}from"./media-CKTs3j83.js";import{A as u,C as d,D as f,E as p,G as m,H as h,M as g,O as _,R as v,T as y,U as b,a as x,i as S,j as C,k as ee,m as te,n as ne,r as re,w as ie,z as ae}from"./InfoHint-Bz_yvehr.js";import{i as oe,n as se,r as ce,t as le}from"./skeleton-CCwdO9oq.js";import{a as ue,i as de,n as fe,r as pe,t as me}from"./select-De48SQdZ.js";import{A as he,B as ge,C as _e,D as ve,E as ye,F as be,I as xe,L as Se,M as w,O as T,R as Ce,S as we,T as Te,_ as Ee,a as De,b as Oe,c as E,d as D,f as ke,g as Ae,h as je,i as Me,j as Ne,k as Pe,l as O,m as Fe,n as Ie,o as Le,p as k,r as Re,s as ze,t as Be,u as A,v as Ve,w as He,x as Ue,y as We,z as Ge}from"./BlockMenuItems-BnLF3Efc.js";import{n as Ke}from"./stableId-rPnYVF-A.js";import{t as qe}from"./image-off-0zX_kODH.js";import{t as Je}from"./image-CGN6ffEu.js";import{t as Ye}from"./link-DPniuk00.js";import{t as Xe}from"./list-CkHF_4xh.js";import{t as Ze}from"./plus-DLRcpVhJ.js";import{t as Qe}from"./sparkles-B-0I44es.js";import{t as $e}from"./undo-2-BU-uqm7e.js";import{a as et,l as tt,p as nt,r as rt,t as it}from"./dropdown-menu-Cl20LCvY.js";import{i as at,n as ot,t as st}from"./tooltip-Bji9fmSr.js";import{F as ct}from"./src-CQu-YxUM.js";import{t as lt}from"./HintedLabel-USQku9Yt.js";import{c as ut,m as dt,n as ft,o as pt,s as mt,v as ht}from"./InsertMenuItem-DJXglsEd.js";import{t as gt}from"./textarea-eatLAWE_.js";import{h as _t,i as vt,l as yt,m as bt,r as xt,t as St}from"./AssistError-BYR085vj.js";import{t as Ct}from"./SuggestAltButton-DEsbHvs4.js";import{n as wt,t as Tt}from"./w3c-keyname-BOAvb0qz.js";var Et={name:`bold`,size:24,node:[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]};Et.node;var Dt=a(Et),Ot={name:`code`,size:24,node:[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]};Ot.node;var kt=a(Ot),At={name:`italic`,size:24,node:[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]};At.node;var jt=a(At),Mt={name:`redo-2`,size:24,node:[[`path`,{d:`m15 14 5-5-5-5`,key:`12vg1m`}],[`path`,{d:`M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13`,key:`6uklza`}]]};Mt.node;var Nt=a(Mt),j=e(t(),1),Pt=e(n(),1),Ft=i(),It=Object.defineProperty,Lt=(e,t)=>{let n={};for(var r in e)It(n,r,{get:e[r],enumerable:!0});return t||It(n,Symbol.toStringTag,{value:`Module`}),n},Rt=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function zt(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var Bt=(e,t,n)=>{let r=zt(e,n);if(!r)return!1;let i=Kt(r);if(!i){let n=r.blockRange(),i=n&&He(n);return i!=null&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(dn(e,i,t,-1))return!0;if(r.parent.content.size==0&&(Wt(a,`end`)||E.isSelectable(a)))for(let n=r.depth;;n--){let o=Te(e.doc,r.before(n),r.after(n),w.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(Wt(a,`end`)?D.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):E.create(n.doc,i.pos-a.nodeSize)),t(n.scrollIntoView())}return!0}if(n==1||r.node(n-1).childCount>1)break}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},Vt=(e,t,n)=>{let r=zt(e,n);if(!r)return!1;let i=Kt(r);return i?Ut(e,i,t):!1},Ht=(e,t,n)=>{let r=qt(e,n);if(!r)return!1;let i=Xt(r);return i?Ut(e,i,t):!1};function Ut(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let a=t.nodeAfter,o=t.pos+1;for(;!a.isTextblock;o++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let s=Te(e.doc,i,o,w.empty);if(!s||s.from!=i||s instanceof Ee&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(k.create(t.doc,i)),n(t.scrollIntoView())}return!0}function Wt(e,t,n=!1){for(let r=e;r;r=t==`start`?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var Gt=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`backward`,e):r.parentOffset>0)return!1;a=Kt(r)}let o=a&&a.nodeBefore;return!o||!E.isSelectable(o)?!1:(t&&t(e.tr.setSelection(E.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function Kt(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function qt(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var Jt=(e,t,n)=>{let r=qt(e,n);if(!r)return!1;let i=Xt(r);if(!i)return!1;let a=i.nodeAfter;if(dn(e,i,t,1))return!0;if(r.parent.content.size==0&&(Wt(a,`start`)||E.isSelectable(a))){let n=Te(e.doc,r.before(),r.after(),w.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(Wt(a,`start`)?D.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):E.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},Yt=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`forward`,e):r.parentOffset<r.parent.content.size)return!1;a=Xt(r)}let o=a&&a.nodeAfter;return!o||!E.isSelectable(o)?!1:(t&&t(e.tr.setSelection(E.create(e.doc,a.pos)).scrollIntoView()),!0)};function Xt(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}var Zt=(e,t)=>{let n=e.selection,r=n instanceof E,i;if(r){if(n.node.isTextblock||!We(e.doc,n.from))return!1;i=n.from}else if(i=_e(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(E.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},Qt=(e,t)=>{let n=e.selection,r;if(n instanceof E){if(n.node.isTextblock||!We(e.doc,n.to))return!1;r=n.to}else if(r=_e(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},$t=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&He(i);return a!=null&&(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},en=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
|
|
2
|
-
`).scrollIntoView()),!0)};function tn(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var nn=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),a=n.indexAfter(-1),o=tn(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(D.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},rn=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof Le||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=tn(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,o=e.tr.insert(n,a.createAndFill());o.setSelection(k.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},an=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(Oe(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&He(r);return i!=null&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function on(e){return(t,n)=>{if(t.selection instanceof E&&t.selection.node.isBlock){let{$from:e}=t.selection;return!e.parentOffset||!Oe(t.doc,e.pos)?!1:(n&&n(t.tr.split(e.pos).scrollIntoView()),!0)}if(!t.selection.$from.depth)return!1;let r=t.tr;!t.selection.empty&&(t.selection instanceof k||t.selection instanceof Le)&&r.deleteSelection();let{$from:i}=r.selection,a=r.steps.length,o=[],s,c,l=!1,u=!1;for(let t=i.depth;;t--)if(i.node(t).isBlock){l=i.end(t)==i.pos+(i.depth-t),u=i.start(t)==i.pos-(i.depth-t),c=tn(i.node(t-1).contentMatchAt(i.indexAfter(t-1)));let n=e&&e(i.parent,l,i);o.unshift(n||(l&&c?{type:c}:null)),s=t;break}else{if(t==1)return!1;o.unshift(null)}let d=i.pos,f=Oe(r.doc,d,o.length,o);if(f||=(o[0]=c?{type:c}:null,Oe(r.doc,d,o.length,o)),!f)return!1;if(r.split(d,o.length,o),!l&&u&&i.node(s).type!=c){let e=r.mapping.slice(a),t=e.map(i.before(s)),n=r.doc.resolve(t);c&&i.node(s-1).canReplaceWith(n.index(),n.index()+1,c)&&r.setNodeMarkup(e.map(i.before(s)),c)}return n&&n(r.scrollIntoView()),!0}}var sn=on(),cn=(e,t)=>{let{$from:n,to:r}=e.selection,i,a=n.sharedDepth(r);return a!=0&&(i=n.before(a),t&&t(e.tr.setSelection(E.create(e.doc,i))),!0)},ln=(e,t)=>(t&&t(e.tr.setSelection(new Le(e.doc))),!0);function un(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,a=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||We(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function dn(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&un(e,t,n))return!0;let l=!c&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,s=T.empty;for(let e=o.length-1;e>=0;e--)s=T.from(o[e].create(null,s));s=T.from(i.copy(s));let c=e.tr.step(new Ae(t.pos-1,r,t.pos,r,new w(s,1,0),o.length,!0)),l=c.doc.resolve(r+2*o.length);l.nodeAfter&&l.nodeAfter.type==i.type&&We(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:D.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&He(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&Wt(a,`start`,!0)&&Wt(i,`end`)){let r=i,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let s=a,c=1;for(;!s.isTextblock;s=s.firstChild)c++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=T.empty;for(let e=o.length-1;e>=0;e--)r=T.from(o[e].copy(r));n(e.tr.step(new Ae(t.pos-o.length,t.pos+a.nodeSize,t.pos+c,t.pos+a.nodeSize-c,new w(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function fn(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(t.tr.setSelection(k.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var pn=fn(-1),mn=fn(1);function hn(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&we(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function gn(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];n.doc.nodesBetween(a,o,(r,a)=>{if(i)return!1;if(r.isTextblock&&!r.hasMarkup(e,t)){if(r.type==e)i=!0;else{let t=n.doc.resolve(a),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];i.setBlockType(a,o,e,t)}r(i.scrollIntoView())}return!0}}function _n(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}var vn=_n(Rt,Bt,Gt),yn=_n(Rt,Jt,Yt),bn={Enter:_n(en,rn,an,sn),"Mod-Enter":nn,Backspace:vn,"Mod-Backspace":vn,"Shift-Backspace":vn,Delete:yn,"Mod-Delete":yn,"Mod-a":ln},xn={"Ctrl-h":bn.Backspace,"Alt-Backspace":bn[`Mod-Backspace`],"Ctrl-d":bn.Delete,"Ctrl-Alt-Backspace":bn[`Mod-Delete`],"Alt-Delete":bn[`Mod-Delete`],"Alt-d":bn[`Mod-Delete`],"Ctrl-a":pn,"Ctrl-e":mn};for(let e in bn)xn[e]=bn[e];typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform();function Sn(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a);if(!o)return!1;let s=r?n.tr:null;return Cn(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function Cn(e,t,n,r=null){let i=!1,a=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let e=o.resolve(t.start-2);a=new he(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new he(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=we(a,n,r,t);return s?(e&&wn(e,t,s,i,n),!0):!1}function wn(e,t,n,r,i){let a=T.empty;for(let e=n.length-1;e>=0;e--)a=T.from(n[e].type.create(n[e].attrs,a));e.step(new Ae(t.start-(r?2:0),t.end,t.start,t.end,new w(a,0,0),n.length,!0));let o=0;for(let e=0;e<n.length;e++)n[e].type==i&&(o=e+1);let s=n.length-o,c=t.start+n.length-(r?2:0),l=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&Oe(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function Tn(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?En(t,n,e,a):Dn(t,n,a):!0:!1}}function En(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new Ae(a-1,o,a,o,new w(T.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new he(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=He(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return We(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function Dn(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,a=n.startIndex;t>a;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,l=a.node(-1),u=a.index(-1);if(!l.canReplace(u+ +!s,u+1,o.content.append(c?T.empty:T.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new Ae(d-+!!s,f+ +!!c,d+1,f-1,new w((s?T.empty:T.from(i.copy(T.empty))).append(c?T.empty:T.from(i.copy(T.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function On(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,c=s.child(o-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==s.type,i=T.from(r?e.create():null),o=new w(T.from(e.create(null,T.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new Ae(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}var M=e(r(),1),kn=c(),N=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},An=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},jn=null,Mn=function(e,t,n){let r=jn||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},Nn=function(){jn=null},Pn=function(e,t,n,r){return n&&(In(e,t,n,r,-1)||In(e,t,n,r,1))},Fn=/^(img|br|input|textarea|hr)$/i;function In(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Ln(e))){let n=e.parentNode;if(!n||!P(n)||Hn(e)||Fn.test(e.nodeName)||e.contentEditable==`false`)return!1;t=N(e)+(i<0?0:1),e=n}else if(P(e)){let n=e.childNodes[t+(i<0?-1:0)];if(P(n)&&n.contentEditable==`false`){if(n.pmViewDesc?.ignoreForSelection)t+=i;else return!1}else e=n,t=i<0?Ln(e):0}else return!1}}function Ln(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function P(e){return e.nodeType==1}function F(e){return e.nodeType==3}function Rn(e,t){return t?e.contains(P(t)?t:t.parentNode):!1}function zn(e,t){for(;;){if(F(e)&&t)return e;if(P(e)&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=Ln(e)}else if(e.parentNode&&!Hn(e))t=N(e),e=e.parentNode;else return null}}function Bn(e,t){for(;;){if(F(e)&&t<e.nodeValue.length)return e;if(P(e)&&t<e.childNodes.length){if(e.contentEditable==`false`)return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!Hn(e))t=N(e)+1,e=e.parentNode;else return null}}function Vn(e,t,n){for(let r=t==0,i=t==Ln(e);r||i;){if(e==n)return!0;let t=N(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==Ln(e)}}function Hn(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var Un=function(e){return e.focusNode&&Pn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Wn(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function Gn(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function Kn(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Ln(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(Ln(r.startContainer),r.startOffset)}}}var qn=typeof navigator<`u`?navigator:null,Jn=typeof document<`u`?document:null,Yn=qn&&qn.userAgent||``,Xn=/Edge\/(\d+)/.exec(Yn),Zn=/MSIE \d/.exec(Yn),Qn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Yn),$n=!!(Zn||Qn||Xn),er=Zn?document.documentMode:Qn?+Qn[1]:Xn?+Xn[1]:0,tr=!$n&&/gecko\/(\d+)/i.test(Yn);tr&&+(/Firefox\/(\d+)/.exec(Yn)||[0,0])[1];var nr=!$n&&/Chrome\/(\d+)/.exec(Yn),I=!!nr,rr=nr?+nr[1]:0,L=!$n&&!!qn&&/Apple Computer/.test(qn.vendor),ir=L&&(/Mobile\/\w+/.test(Yn)||!!qn&&qn.maxTouchPoints>2),ar=ir||(qn?/Mac/.test(qn.platform):!1),or=qn?/Win/.test(qn.platform):!1,sr=/Android \d/.test(Yn),cr=!!Jn&&`webkitFontSmoothing`in Jn.documentElement.style,lr=cr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function ur(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function dr(e,t){return typeof e==`number`?e:e[t]}function fr(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function pr(e,t,n){if(!Or(t)&&t.left==0)return;let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(!P(o)){o=An(o);continue}let e=o==a.body,n=e?ur(a):fr(o),s=0,c=0;if(t.top<n.top+dr(r,`top`)?c=-(n.top-t.top+dr(i,`top`)):t.bottom>n.bottom-dr(r,`bottom`)&&(c=t.bottom-t.top>n.bottom-n.top?t.top+dr(i,`top`)-n.top:t.bottom-n.bottom+dr(i,`bottom`)),t.left<n.left+dr(r,`left`)?s=-(n.left-t.left+dr(i,`left`)):t.right>n.right-dr(r,`right`)&&(s=t.right-n.right+dr(i,`right`)),s||c){if(e)a.defaultView.scrollBy(s,c);else{let e=o.scrollLeft,n=o.scrollTop;c&&(o.scrollTop+=c),s&&(o.scrollLeft+=s);let r=o.scrollLeft-e,i=o.scrollTop-n;t={left:t.left-r,top:t.top-i,right:t.right-r,bottom:t.bottom-i}}}let l=e?`fixed`:getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(l))break;o=l==`absolute`?o.offsetParent:An(o)}}function mr(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let t=e.root.elementFromPoint(a,o);if(!t||t==e.dom||!e.dom.contains(t))continue;let s=t.getBoundingClientRect();if(s.top>=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:hr(e.dom)}}function hr(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=An(r));return t}function gr({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;_r(n,r==0?0:r-t)}function _r(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:a}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=a&&(r.scrollLeft=a)}}var vr=null;function yr(e){if(e.setActive)return e.setActive();if(vr)return e.focus(vr);let t=hr(e);e.focus(vr==null?{get preventScroll(){return vr={preventScroll:!0},!0}}:void 0),vr||(vr=!1,_r(t,0))}function br(e,t){let n,r=2e8,i,a=0,o=t.top,s=t.top,c,l;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(P(u))e=u.getClientRects();else if(F(u))e=Mn(u).getClientRects();else continue;for(let f=0;f<e.length;f++){let p=e[f];if(p.top<=o&&p.bottom>=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<r){n=u,r=e,i=e&&F(n)?{left:p.right<t.left?p.right:p.left,top:t.top}:t,P(u)&&e&&(a=d+ +(t.left>=(p.left+p.right)/2));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&F(n)?xr(n,i):!n||r?{node:e,offset:a}:br(n,i)}function xr(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a<n;a++){r.setEnd(e,a+1),r.setStart(e,a);let n=kr(r,1);if(n.top!=n.bottom&&Sr(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function Sr(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Cr(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function wr(e,t,n){let{node:r,offset:i}=br(t,n),a=-1;if(P(r)&&!r.firstChild){let e=r.getBoundingClientRect();a=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function Tr(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(P(t.dom)&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),a=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function Er(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),a=i;;){let n=e.childNodes[a];if(P(n)){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(Sr(t,i))return Er(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function Dr(e,t){let n=e.dom.ownerDocument,r,i=0,a=Kn(n,t.left,t.top);a&&({node:r,offset:i}=a);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),s;if(!o||!e.dom.contains(o)){let n=e.dom.getBoundingClientRect();if(!Sr(t,n)||(o=Er(e.dom,t,n),!o))return null}if(L)for(let e=o;r&&e;e=An(e))e.draggable&&(r=void 0);if(o=Cr(o,t),r){if(tr&&P(r)&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e=r.childNodes[i],n;e.nodeName==`IMG`&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&i++}let n;cr&&i&&P(r)&&P(n=r.childNodes[i-1])&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&P(r.lastChild)&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||!P(r)||r.childNodes[i-1].nodeName!=`BR`)&&(s=Tr(e,r,i,t))}s??=wr(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function Or(e){return e.top<e.bottom||e.left<e.right}function kr(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Or(e))return e}return Array.prototype.find.call(n,Or)||e.getBoundingClientRect()}var Ar=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function jr(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=cr||tr;if(F(r)){if(o&&(Ar.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=kr(Mn(r,i,i),n);if(tr&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=kr(Mn(r,i-1,i-1),-1);if(t.top==e.top){let n=kr(Mn(r,i,i+1),-1);if(n.top!=e.top)return Mr(n,n.left<t.left)}}return e}{let e=i,t=i,a=n<0?1:-1;return n<0&&!i?(t++,a=-1):n>=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,Mr(kr(Mn(r,e,t),a),a<0)}}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==Ln(r))){let e=r.childNodes[i-1];if(P(e))return Nr(e.getBoundingClientRect(),!1)}if(a==null&&i<Ln(r)){let e=r.childNodes[i];if(P(e))return Nr(e.getBoundingClientRect(),!0)}return Nr(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==Ln(r))){let e=r.childNodes[i-1],t=F(e)?Mn(e,Ln(e)-+!o):P(e)&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return Mr(kr(t,1),!1)}if(a==null&&i<Ln(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?F(e)?Mn(e,0,+!o):P(e)?e:null:null;if(t)return Mr(kr(t,-1),!0)}return Mr(kr(F(r)?Mn(r):r,-n),n>=0)}function Mr(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Nr(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Pr(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function Fr(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return Pr(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=jr(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(P(e))t=e.getClientRects();else if(F(e))t=Mn(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}var Ir=/[\u0590-\u08ac]/;function Lr(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!Ir.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:Pr(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!Rn(l,u)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch{}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}var Rr=null,zr=null,Br=!1;function Vr(e,t,n){return Rr==t&&zr==n?Br:(Rr=t,zr=n,Br=n==`up`||n==`down`?Fr(e,t,n):Lr(e,t,n))}var Hr=0,Ur=1,Wr=2,Gr=3,Kr=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=Hr,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&Rn(this.contentDOM,e)){if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(e==this.dom&&this.contentDOM)r=t>N(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=!!(e.compareDocumentPosition(this.contentDOM)&4);else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return r??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node)){if(n&&(a=i.nodeDOM)&&!(P(a)?Rn(a,e):a==e))n=!1;else return i}}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],a=t+i.size;if(a>e){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(;n>0;n--){let e=this.children[n-1];if(e.size||!(e instanceof $r||e instanceof qr&&e.side>=0))break}if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?N(e.dom)+1:0}}{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?N(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let a=n,o=0;;o++){let n=this.children[o],s=a+n.size;if(r==-1&&e<=s){let i=a+n.border;if(e>=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=N(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=N(n.dom);break}t+=n.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=s}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(!P(t)||n==t.childNodes.length)throw RangeError(`No node after pos `+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let o=0,s=0;o<this.children.length;o++){let c=this.children[o],l=s+c.size;if(i>s&&a<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}let o=this.domFromPos(e,e?-1:1),s=t==e?o:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),l=n.domSelectionRange(),u=!1;if((tr||L)&&e==t){let{node:e,offset:t}=o;if(F(e)){if(u=!!(t&&e.nodeValue[t-1]==`
|
|
3
|
-
`),u&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){n.nodeName==`BR`&&(o=s={node:n.parentNode,offset:N(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&(n.nodeName==`BR`||n.contentEditable==`false`)}}if(tr&&l.focusNode&&l.focusNode!=s.node&&P(l.focusNode)){let e=l.focusNode.childNodes[l.focusOffset];e&&e.contentEditable==`false`&&(r=!0)}if(!(r||u&&L)&&Pn(o.node,o.offset,l.anchorNode,l.anchorOffset)&&Pn(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&tr)){c.collapse(o.node,o.offset);try{e!=t&&c.extend(s.node,s.offset),d=!0}catch{}}if(!d){if(e>t){let e=o;o=s,s=e}let n=document.createRange();n.setEnd(s.node,s.offset),n.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&e.type!=`selection`}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],a=n+i.size;if(n==a?e<=a&&t>=n:e<a&&t>n){let r=n+i.border,o=a-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==a?Wr:Ur,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Gr:i.markDirty(e-r,t-r);return}i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Wr:Gr}n=a}this.dirty=Wr}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?Wr:Ur;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},qr=class extends Kr{constructor(e,t,n,r){let i,a=t.type.toDOM;if(typeof a==`function`&&(a=a(n,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){let e=P(a)?a:document.createElement(`span`);e!=a&&e.appendChild(a),e.hasAttribute(`contenteditable`)||(e.contentEditable=`false`),e.classList.add(`ProseMirror-widget`)}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==Hr&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!=`selection`||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},Jr=class extends Kr{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e==this.textDOM?this.posAtStart+t:this.posAtStart+(t?this.size:0)}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}},Yr=class e extends Kr{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=ve.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Gr||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Gr&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Hr){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=Hr}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=gi(a,n,o,r)),t>0&&(a=gi(a,0,t,r));for(let e=0;e<a.length;e++)a[e].parent=i;return i.children=a,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},Xr=class e extends Kr{constructor(e,t,n,r,i,a,o){super(e,[],i,a),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(t,n,r,i,a,o){let s=a.nodeViews[n.type.name],c,l=s&&s(n,a,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(!F(u))throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=ve.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);({dom:u,contentDOM:d}=e)}!d&&!n.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=si(u,r,n),l?c=new ei(t,n,r,i,u,d||null,f,l):n.isText?new Qr(t,n,r,i,u,f):new e(t,n,r,i,u,d||null,f)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(t.preserveWhitespace=`full`),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let e=this.children.length-1;e>=0;e--){let n=this.children[e];if(this.dom.contains(n.dom.parentNode)){t.contentElement=n.dom.parentNode;break}}if(!t.contentElement){let n=e&&e.find(t=>P(t)&&e.indexOf(t.parentNode)<0&&this.dom.contains(t));n?t.contentElement=n:t.getContent=()=>T.empty}}return t}matchesNode(e,t,n){return this.dirty==Hr&&e.eq(this.node)&&ci(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new ui(this,a&&a.node,e),c=this.node.inlineContent,l=c&&this.node.isBlock;pi(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?s.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!a&&s.syncToMarks(i==this.node.childCount?Pe.none:this.node.child(i).marks,n,e,i),s.placeWidget(t,e,r)},(t,a,u,d)=>{s.syncToMarks(t.marks,n,e,d),l&&t.isAtom&&!t.isText&&s.addHackNode(`IMG`,s.top);let f;s.findNodeMatch(t,a,u,d)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(f=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(t,a,u,f,e)||s.updateNextNode(t,a,u,e,d,r)||s.addNode(t,a,u,e,r),r+=t.nodeSize,c&&(l=t.isAtom&&!t.isText)}),s.syncToMarks([],n,e,0),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==Wr)&&(a&&this.protectLocalComposition(e,a),ti(this.contentDOM,this.children,e),ir&&mi(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof k)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,a=hi(this.node.content,e,n-t,r-t);return a<0?null:{node:i,pos:a,text:e}}return{node:i,pos:-1,text:``}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let a=new Jr(this,i,t,r);e.input.compositionNodes.push(a),this.children=gi(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==Gr||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=Hr}updateOuterDeco(e){if(ci(e,this.outerDeco))return;let t=!P(this.nodeDOM),n=this.dom;this.dom=ai(this.dom,this.nodeDOM,ii(this.outerDeco,this.node,t),ii(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){P(this.nodeDOM)&&(this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){P(this.nodeDOM)&&(this.nodeDOM.classList.remove(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute(`draggable`))}get domAtom(){return this.node.isAtom}};function Zr(e,t,n,r,i){si(r,t,e);let a=new Xr(void 0,e,t,n,r,r,r);return a.contentDOM&&a.updateChildren(i,0),a}var Qr=class e extends Xr{constructor(e,t,n,r,i,a){super(e,t,n,r,i,null,a)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return this.dirty==Gr||this.dirty!=Hr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Hr||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=Hr,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!=`characterData`&&e.type!=`selection`}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Gr)}get domAtom(){return!1}isText(e){return this.node.text==e}},$r=class extends Kr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Hr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},ei=class extends Xr{constructor(e,t,n,r,i,a,o,s){super(e,t,n,r,i,a,o),this.spec=s}update(e,t,n,r){if(this.dirty==Gr)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function ti(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a<t.length;a++){let o=t[a],s=o.dom;if(s.parentNode==e){for(;s!=r;)r=li(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof Yr){let t=r?r.previousSibling:e.lastChild;ti(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=li(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var ni=function(e){e&&(this.nodeName=e)};ni.prototype=Object.create(null);var ri=[new ni];function ii(e,t,n){if(e.length==0)return ri;let r=n?ri[0]:new ni,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new ni(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new ni(t.isInline?`span`:`div`)),e==`class`?r.class=(r.class?r.class+` `:``)+a:e==`style`?r.style=(r.style?r.style+`;`:``)+a:e!=`nodeName`&&(r[e]=a))}}}return i}function ai(e,t,n,r){if(n==ri&&r==ri)return t;let i=t;for(let t=0;t<r.length;t++){let a=r[t],o=n[t];if(t){let t;o&&o.nodeName==a.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==a.nodeName?i=t:(t=document.createElement(a.nodeName),t.pmIsDeco=!0,t.appendChild(i),o=ri[0],i=t)}oi(i,o||ri[0],a)}return i}function oi(e,t,n){for(let r in t)r!=`class`&&r!=`style`&&r!=`nodeName`&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!=`class`&&r!=`style`&&r!=`nodeName`&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(` `).filter(Boolean):[],i=n.class?n.class.split(` `).filter(Boolean):[];for(let t=0;t<r.length;t++)i.indexOf(r[t])==-1&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)r.indexOf(i[t])==-1&&e.classList.add(i[t]);e.classList.length==0&&e.removeAttribute(`class`)}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}function si(e,t,n){return ai(e,e,ri,ii(t,n,!P(e)))}function ci(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function li(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var ui=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=di(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,a=this.stack.length>>1,o=Math.min(a,e.length);for(;i<o&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=Hr,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let n=this.top.children[t];if(n.matchesMark(e[a])&&!this.isLocked(n.dom)){i=t;break}}if(i<0&&this.index<this.top.children.length){let t=this.top.children[this.index];t instanceof Yr&&t.dirty!=Gr&&t.mark.type==e[a].type&&t.spec.update&&!this.isLocked(t.dom)&&t.spec.update(e[a])&&(t.mark=e[a],i=this.index,this.changed=!0)}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=Yr.create(this.top,e[a],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,n,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(let r=this.index,a=Math.min(this.top.children.length,r+5);r<a;r++){let a=this.top.children[r];if(a.matchesNode(e,t,n)&&!this.preMatch.matched.has(a)){i=r;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let a=this.top.children[r];return a.dirty==Gr&&a.dom==a.contentDOM&&(a.dirty=Wr),a.update(e,t,n,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return-1}e=t}}updateNextNode(e,t,n,r,i,a){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof Xr){let c=this.preMatch.matched.get(s);if(c!=null&&c!=i)return!1;let l=s.dom,u,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=Gr&&ci(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,o),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=Wr,u.updateChildren(r,a+1),u.dirty=Hr),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!ci(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=Xr.create(this.top,t,n,r,i,a);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,t,n,r,i){let a=Xr.create(this.top,e,t,n,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new qr(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Yr;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Qr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((L||I)&&e&&e.dom.contentEditable==`false`&&this.addHackNode(`IMG`,t),this.addHackNode(`BR`,this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e==`IMG`&&(n.className=`ProseMirror-separator`,n.alt=``),e==`BR`&&(n.className=`ProseMirror-trailingBreak`);let r=new $r(this.top,[],n,null);t==this.top?t.children.splice(this.index++,0,r):t.children.push(r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||P(e)&&e.contains(this.lock.parentNode))}};function di(e,t){let n=t,r=n.children.length,i=e.childCount,a=new Map,o=[];outer:for(;i>0;){let s;for(;;)if(r){let e=n.children[r-1];if(e instanceof Yr)n=e,r=e.children.length;else{s=e,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;let c=s.node;if(c){if(c!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function fi(e,t){return e.type.side-t.type.side}function pi(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(a,o),n),a+=o.nodeSize}return}let o=0,s=[],c=null;for(let l=0;;){let u,d;for(;o<i.length&&i[o].to==a;){let e=i[o++];e.widget&&(u?(d||=[u]).push(e):u=e)}if(u){if(d){d.sort(fi);for(let e=0;e<d.length;e++)n(d[e],l,!!c)}else n(u,l,!!c)}let f,p;if(c)p=-1,f=c,c=null;else if(l<e.childCount)p=l,f=e.child(l++);else break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let m=a+f.nodeSize;if(f.isText){let e=m;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<s.length;t++)s[t].to<e&&(e=s[t].to);e<m&&(c=f.cut(e-a),f=f.cut(0,e-a),m=e,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let h=f.isInline&&!f.isLeaf?s.filter(e=>!e.inline):s.slice();r(f,h,t.forChild(a,f),p),a=m}}function mi(e){if(e.nodeName==`UL`||e.nodeName==`OL`){let t=e.style.cssText;e.style.cssText=t+`; list-style: square !important`,window.getComputedStyle(e).listStyle,e.style.cssText=t}}function hi(e,t,n,r){for(let i=0,a=0;i<e.childCount&&a<=r;){let o=e.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<e.childCount;){let t=e.child(i++);if(a+=t.nodeSize,!t.isText)break;c+=t.text}if(a>=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;let e=s<r?c.lastIndexOf(t,r-s-1):-1;if(e>=0&&e+t.length+s>=n)return s+e;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}return-1}function gi(e,t,n,r,i){let a=[];for(let o=0,s=0;o<e.length;o++){let c=e[o],l=s,u=s+=c.size;l>=n||u<=t?a.push(c):(l<t&&a.push(c.slice(0,t-l,r)),i&&=(a.push(i),void 0),u>n&&a.push(c.slice(n-l,c.size,r)))}return a}function _i(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),c,l;if(Un(n)){for(c=o;i&&!i.node;)i=i.parent;if(i&&i.node.isAtom&&E.isSelectable(i.node)&&i.parent&&!(i.node.isInline&&Vn(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new E(o==e?s:r.resolve(e))}else if(tr&&t==`key`&&o>e.state.selection.to&&P(n.focusNode)&&n.focusOffset==n.focusNode.childNodes.length&&i&&i.posAtStart>e.state.selection.to)for(let e=n.focusNode;;e=e.parentNode){if(getComputedStyle(e).overflow!=`visible`){l=D.findFrom(r.resolve(i.posAtStart),1);break}if(e==i.dom||e.nextSibling||!e.parentNode||!P(e.parentNode))break}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r<n.rangeCount;r++){let a=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(a.startContainer,a.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(a.endContainer,a.endOffset,-1))}if(t<0)return null;[c,o]=i==e.state.selection.anchor?[i,t]:[t,i],s=r.resolve(o)}else c=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!l){let n=t==`pointer`||e.state.selection.head<s.pos&&!a?1:-1;l=Oi(e,u,s,n)}return l}function vi(e){return e.editable?e.hasFocus():Ai(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function yi(e,t=!1){let n=e.state.selection;if(Ei(e,n),!vi(e))return;let r=e.input.mouseDown;if(!t&&I&&r){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Pn(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)&&r.delaySelUpdate()){e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)Ti(e);else{let{anchor:r,head:i}=n,a,o;bi&&!(n instanceof k)&&(n.$from.parent.inlineContent||(a=xi(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=xi(e,n.to))),e.docView.setSelection(r,i,e,t),bi&&(a&&Ci(a),o&&Ci(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&wi(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}var bi=L||I&&rr<63;function xi(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,a=r?n.childNodes[r-1]:null;if(L&&i&&i.contentEditable==`false`)return Si(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return Si(i);if(a)return Si(a)}}function Si(e){return e.contentEditable=`true`,L&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Ci(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function wi(e){let t=e.dom.ownerDocument;t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener(`selectionchange`,e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(()=>{(!vi(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function Ti(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,N(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&$n&&er<=11&&(n.disabled=!0,n.disabled=!1)}function Ei(e,t){if(t instanceof E){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Di(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Di(e)}function Di(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function Oi(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||k.between(t,n,r)}function ki(e){return e.editable&&!e.hasFocus()?!1:Ai(e)}function Ai(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return Rn(e.dom,t.anchorNode)&&(e.editable||Rn(e.dom,t.focusNode))}catch{return!1}}function ji(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Pn(t.node,t.offset,n.anchorNode,n.anchorOffset)}function Mi(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&D.findFrom(a,t)}function Ni(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Pi(e,t,n){let r=e.state.selection;if(r instanceof k){if(n.indexOf(`s`)>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return Ni(e,new k(r.$anchor,a))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=Mi(e.state,t);return n&&n instanceof E?Ni(e,n):!1}if(!(ar&&n.indexOf(`m`)>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,a;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return i.isAtom||(a=e.docView.descAt(o))&&!a.contentDOM?E.isSelectable(i)?Ni(e,new E(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):Ni(e,new k(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1}}else if(r instanceof E&&r.node.isInline)return Ni(e,new k(t>0?r.$to:r.$from));else{let n=Mi(e.state,t);return n?Ni(e,n):!1}}function Fi(e,t){let n=e.pmViewDesc;return n?n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`):P(e)&&e.contentEditable==`false`}function Ii(e,t){return t<0?Li(e):Ri(e)}function Li(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(tr&&P(n)&&r<Ln(n)&&Fi(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(!P(n))break;let e=n.childNodes[r-1];if(Fi(e,-1))i=n,a=--r;else if(F(e))n=e,r=n.nodeValue.length;else break}else if(zi(n))break;else{let t=n.previousSibling;for(;t&&Fi(t,-1);)i=n.parentNode,a=N(t),t=t.previousSibling;if(t)n=t,r=Ln(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?Hi(e,n,r):i&&Hi(e,i,a)}function Ri(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=Ln(n),a,o;for(;;)if(r<i){if(!P(n))break;let e=n.childNodes[r];if(Fi(e,1))a=n,o=++r;else break}else if(zi(n))break;else{let t=n.nextSibling;for(;t&&Fi(t,1);)a=t.parentNode,o=N(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=Ln(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&Hi(e,a,o)}function zi(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Bi(e,t){for(;e&&t==e.childNodes.length&&!Hn(e);)t=N(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(F(n))return n;if(P(n)&&n.contentEditable==`false`)break;e=n,t=0}}function Vi(e,t){for(;e&&!t&&!Hn(e);)t=N(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(F(n))return n;if(P(n)&&n.contentEditable==`false`)break;e=n,t=e.childNodes.length}}function Hi(e,t,n){if(!F(t)){let e,r;(r=Bi(t,n))?(t=r,n=0):(e=Vi(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Un(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&yi(e)},50)}function Ui(e,t){let n=e.state.doc.resolve(t);if(!(I||or)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?`ltr`:`rtl`}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?`ltr`:`rtl`}}return getComputedStyle(e.dom).direction==`rtl`?`rtl`:`ltr`}function Wi(e,t,n){let r=e.state.selection;if(r instanceof k&&!r.empty||n.indexOf(`s`)>-1||ar&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=Mi(e.state,t);if(n&&n instanceof E)return Ni(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof Le?D.near(n,t):D.findFrom(n,t);return o?Ni(e,o):!1}return!1}function Gi(e,t){if(!(e.state.selection instanceof k))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let r=e.state.tr;return t<0?r.delete(n.pos-a.nodeSize,n.pos):r.delete(n.pos,n.pos+a.nodeSize),e.dispatch(r),!0}return!1}function Ki(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function qi(e){if(!L||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&P(t)&&n==0&&t.firstChild&&P(t.firstChild)&&t.firstChild.contentEditable==`false`){let n=t.firstChild;Ki(e,n,`true`),setTimeout(()=>Ki(e,n,`false`),20)}return!1}function Ji(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function Yi(e,t){let n=t.keyCode,r=Ji(t);if(n==8||ar&&n==72&&r==`c`)return Gi(e,-1)||Ii(e,-1);if(n==46&&!t.shiftKey||ar&&n==68&&r==`c`)return Gi(e,1)||Ii(e,1);if(n==13||n==27)return!0;if(n==37||ar&&n==66&&r==`c`){let t=n==37?Ui(e,e.state.selection.from)==`ltr`?-1:1:-1;return Pi(e,t,r)||Ii(e,t)}if(n==39||ar&&n==70&&r==`c`){let t=n==39?Ui(e,e.state.selection.from)==`ltr`?1:-1:1;return Pi(e,t,r)||Ii(e,t)}return n==38||ar&&n==80&&r==`c`?Wi(e,-1,r)||Ii(e,-1):n==40||ar&&n==78&&r==`c`?qi(e)||Wi(e,1,r)||Ii(e,1):!(r!=(ar?`m`:`c`)||n!=66&&n!=73&&n!=89&&n!=90)}function Xi(e,t){e.someProp(`transformCopied`,n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let e=r.firstChild;n.push(e.type.name,e.attrs==e.type.defaultAttrs?null:e.attrs),r=e.content}let o=e.someProp(`clipboardSerializer`)||ve.fromSchema(e.state.schema),s=oa(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&P(l)&&(u=aa[l.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=s.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),d++}l=c.firstChild}return l&&P(l)&&l.setAttribute(`data-pm-slice`,`${i} ${a}${d?` -${d}`:``} ${JSON.stringify(n)}`),{dom:c,text:e.someProp(`clipboardTextSerializer`,n=>n(t,e))||t.content.textBetween(0,t.content.size,`
|
|
4
|
-
|
|
5
|
-
`),slice:t}}function Zi(e,t,n,r,i){let a=i.parent.type.spec.code,o,s;if(!n&&!t)return null;let c=!!t&&(r||a||!n);if(c){if(e.someProp(`transformPastedText`,n=>{t=n(t,a||r,e)}),a)return s=new w(T.from(e.state.schema.text(t.replace(/\r\n?/g,`
|
|
6
|
-
`))),0,0),e.someProp(`transformPasted`,t=>{s=t(s,e,!0)}),s;let n=e.someProp(`clipboardTextParser`,n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,a=ve.fromSchema(r);o=document.createElement(`div`),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement(`p`));e&&t.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp(`transformPastedHTML`,t=>{n=t(n,e)}),o=la(n),cr&&ua(o);let l=o&&o.querySelector(`[data-pm-slice]`),u=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute(`data-pm-slice`)||``);if(u&&u[3])for(let e=+u[3];e>0;e--){let e=o.firstChild;for(;e&&!P(e);)e=e.nextSibling;if(!e)break;o=e}if(s||=(e.someProp(`clipboardParser`)||e.someProp(`domParser`)||ye.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!Qi.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=da(ia(s,+u[1],+u[2]),u[4]);else if(s=w.maxOpen($i(s.content,i),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=ia(s,e,t)}return e.someProp(`transformPasted`,t=>{s=t(s,e,c)}),s}var Qi=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function $i(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,a=[];if(e.forEach(e=>{if(!a)return;let t=r.findWrapping(e.type),n;if(!t)return a=null;if(n=a.length&&i.length&&ta(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=na(a[a.length-1],i.length));let n=ea(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return T.from(a)}return e}function ea(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,T.from(e));return e}function ta(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let a=ta(e,t,n,r.lastChild,i+1);if(a)return r.copy(r.content.replaceChild(r.childCount-1,a));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(T.from(ea(n,e,i+1))))}}function na(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,na(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(T.empty,!0);return e.copy(n.append(r))}function ra(e,t,n,r,i,a){let o=t<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(a=0),i<r-1&&(s=ra(s,t,n,r,i+1,a)),i>=n&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(T.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function ia(e,t,n){return t<e.openStart&&(e=new w(ra(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new w(ra(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var aa={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]};function oa(){return document.implementation.createHTMLDocument(`title`)}var sa=null;function ca(e){let t=window.trustedTypes;if(!t)return e;if(!sa){if(sa=t.defaultPolicy)try{return sa.createHTML(e)}catch{}sa=t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e})}return sa.createHTML(e)}function la(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=oa(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(e),a;if((a=i&&aa[i[1].toLowerCase()])&&(e=a.map(e=>`<`+e+`>`).join(``)+e+a.map(e=>`</`+e+`>`).reverse().join(``)),r.innerHTML=ca(e),a)for(let e=0;e<a.length;e++)r=r.querySelector(a[e])||r;for(let e=0;e<n.styleSheets.length;e++){let t=n.styleSheets[e];for(let e=0;e<t.rules.length;e++){let n=t.rules[e];if(n instanceof CSSStyleRule){let e=r.querySelectorAll(n.selectorText);for(let t=0;t<e.length;t++)e[t].style.cssText+=n.style.cssText}}}return r}function ua(e){let t=e.querySelectorAll(I?`span:not([class]):not([style])`:`span.Apple-converted-space`);for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==`\xA0`&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(` `),r)}}function da(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:i,openStart:a,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;try{i=T.from(t.create(r[e+1],i))}catch{break}a++,o++}return new w(i,a,o)}var fa={},pa={},ma={touchstart:!0,touchmove:!0},ha=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:``,button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function ga(e){for(let t in fa){let n=fa[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{xa(e,t)&&!ba(e,t)&&(e.editable||!(t.type in pa))&&n(e,t)},ma[t]?{passive:!0}:void 0)}L&&e.dom.addEventListener(`input`,()=>null),ya(e)}function _a(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function va(e){e.input.mouseDown&&e.input.mouseDown.done(),e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function ya(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>ba(e,t))})}function ba(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function xa(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function Sa(e,t){!ba(e,t)&&fa[t.type]&&(e.editable||!(t.type in pa))&&fa[t.type](e,t)}pa.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!za(e)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(sr&&I&&n.keyCode==13))){if(n.keyCode!=229&&e.domObserver.forceFlush(),ir&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp(`handleKeyDown`,t=>t(e,Wn(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||Yi(e,n)?n.preventDefault():_a(e,`key`)}},pa.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},pa.keypress=(e,t)=>{let n=t;if(za(e)||!n.charCode||n.ctrlKey&&!n.altKey||ar&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof k)||!r.$from.sameParent(r.$to)){let t=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(t).scrollIntoView();!/[\r\n]/.test(t)&&!e.someProp(`handleTextInput`,n=>n(e,r.$from.pos,r.$to.pos,t,i))&&e.dispatch(i()),n.preventDefault()}};function Ca(e){return{left:e.clientX,top:e.clientY}}function wa(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function Ta(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let r=a.depth+1;r>0;r--)if(e.someProp(t,t=>r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)))return!0;return!1}function Ea(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta(`pointer`,!0),e.dispatch(r)}function Da(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&E.isSelectable(r)?(Ea(e,new E(n)),!0):!1}function Oa(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof E&&(r=n.node);let a=e.state.doc.resolve(t);for(let e=a.depth+1;e>0;e--){let t=e>a.depth?a.nodeAfter:a.node(e);if(E.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?a.before(n.$from.depth):a.before(e);break}}return i!=null&&(Ea(e,E.create(e.state.doc,i)),!0)}function ka(e,t,n,r,i){return Ta(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?Oa(e,n):Da(e,n))}function Aa(e,t,n,r){return Ta(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function ja(e,t,n,r){return Ta(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||Ma(e,n,r)}function Ma(e,t,n){if(n.button!=0)return!1;let r=Na(e,t,!0),i=e.state.doc;return r?(Ea(e,r),r instanceof k&&i.eq(e.state.doc)&&(e.input.mouseDown=new Ra(e,r)),!0):!1}function Na(e,t,n){let r=e.state.doc;if(t==-1)return r.inlineContent?k.create(r,0,r.content.size):null;let i=r.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e),a=i.before(e);if(t.inlineContent)return k.create(r,a+1,a+1+t.content.size);if(n&&E.isSelectable(t))return E.create(r,a)}return null}function Pa(e){return Ga(e)}var Fa=ar?`metaKey`:`ctrlKey`;fa.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=Pa(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&wa(n,e.input.lastClick)&&!n[Fa]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button},e.input.mouseDown&&e.input.mouseDown.done();let o=e.posAtCoords(Ca(n));o&&(a==`singleClick`?e.input.mouseDown=new La(e,o,n,!!r):(a==`doubleClick`?Aa:ja)(e,o.pos,o.inside,n)?n.preventDefault():_a(e,`pointer`))};var Ia=class{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener(`mouseup`,this.up=this.up.bind(this)),e.root.addEventListener(`mousemove`,this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener(`mouseup`,this.up),this.view.root.removeEventListener(`mousemove`,this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}},La=class extends Ia{constructor(e,t,n,r){super(e),this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!n[Fa],this.allowDefault=n.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,a=n.depth?n.before():0}let o=r?null:n.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&P(s.nodeDOM)?s.nodeDOM:null;let{selection:c}=e.state;n.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof E&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!(!this.target||this.target.draggable),setUneditable:!!(this.target&&tr&&!this.target.hasAttribute(`contentEditable`))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute(`contentEditable`,`false`)},20),this.view.domObserver.start()),_a(e,`pointer`)}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute(`draggable`),this.mightDrag.setUneditable&&this.target.removeAttribute(`contentEditable`),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||yi(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Ca(e))),this.updateAllowDefault(e),this.allowDefault||!t?_a(this.view,`pointer`):ka(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||L&&this.mightDrag&&!this.mightDrag.node.isAtom||I&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Ea(this.view,D.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):_a(this.view,`pointer`)}move(e){this.updateAllowDefault(e),_a(this.view,`pointer`),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}},Ra=class extends Ia{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),_a(this.view,`pointer`);let t=this.view.posAtCoords(Ca(e)),n=t&&Na(this.view,t.inside,!1);if(!n)return;let{doc:r}=this.view.state,i=this.startSelection,[a,o]=n.from<i.from?[i.to,n.from]:[i.from,n.to];Ea(this.view,k.create(r,a,o))}};fa.touchstart=e=>{e.input.lastTouch=Date.now(),Pa(e),_a(e,`pointer`)},fa.touchmove=e=>{e.input.lastTouch=Date.now(),_a(e,`pointer`)},fa.contextmenu=e=>Pa(e);function za(e,t){return e.composing?!0:L&&Math.abs(Date.now()-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var Ba=sr?5e3:-1;pa.compositionstart=pa.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof k&&t.selection.empty&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||I&&or&&Va(e)))e.markCursor=e.state.storedMarks||n.marks(),Ga(e,!0),e.markCursor=null;else if(Ga(e,!t.selection.empty),tr&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&P(n)&&r!=0;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(F(t)){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}Ha(e,Ba)};function Va(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||!P(t)||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return P(r)&&r.contentEditable==`false`}pa.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,Ha(e,20))};function Ha(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Ga(e),t))}function Ua(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Wa(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=zn(t.focusNode,t.focusOffset),r=Bn(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(e&&e.isText(n.nodeValue))return r}}return n||r}function Ga(e,t=!1){if(!(sr&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Ua(e),t||e.docView&&e.docView.dirty){let n=_i(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function Ka(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement(`div`));n.appendChild(t),n.style.cssText=`position: fixed; left: -10000px; top: 10px`;let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}var qa=$n&&er<15||ir&&lr<604;fa.copy=pa.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=qa?null:n.clipboardData,{dom:o,text:s}=Xi(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):Ka(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function Ja(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function Ya(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?`textarea`:`div`));n||(r.contentEditable=`true`),r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Xa(e,r.value,null,i,t):Xa(e,r.textContent,r.innerHTML,i,t)},50)}function Xa(e,t,n,r,i){let a=Zi(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||w.empty)))return!0;if(!a)return!1;let o=Ja(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta(`paste`,!0).setMeta(`uiEvent`,`paste`)),!0}function Za(e){let t=e.getData(`text/plain`)||e.getData(`Text`);if(t)return t;let n=e.getData(`text/uri-list`);return n?n.replace(/\r?\n/g,` `):``}pa.paste=(e,t)=>{let n=t;if(e.composing&&!sr)return;let r=qa?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&Xa(e,Za(r),r.getData(`text/html`),i,n)?n.preventDefault():Ya(e,n)};var Qa=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},$a=ar?`altKey`:`ctrlKey`;function eo(e,t){let n;return e.someProp(`dragCopies`,e=>{n||=e(t)}),n==null?!t[$a]:!n}fa.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(Ca(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof E?i.to-1:i.to))){if(r&&r.mightDrag)o=E.create(e.state.doc,r.mightDrag.pos);else if(n.target&&P(n.target)){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=E.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=Xi(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!I||rr>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(qa?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,qa||n.dataTransfer.setData(`text/plain`,c),e.dragging=new Qa(l,eo(e,n),o)},fa.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},pa.dragover=pa.dragenter=(e,t)=>t.preventDefault(),pa.drop=(e,t)=>{try{to(e,t,e.dragging)}finally{e.dragging=null}};function to(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(Ca(t));if(!r)return;let i=e.state.doc.resolve(r.pos),a=n&&n.slice;a?e.someProp(`transformPasted`,t=>{a=t(a,e,!1)}):a=Zi(e,Za(t.dataTransfer),qa?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&eo(e,t));if(e.someProp(`handleDrop`,n=>n(e,t,a||w.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?Ue(e.state.doc,i.pos,a):i.pos;s??=i.pos;let c=e.state.tr;if(o){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let l=c.mapping.map(s),u=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(l,l,a.content.firstChild):c.replaceRange(l,l,a),c.doc.eq(d))return;let f=c.doc.resolve(l);if(u&&E.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new E(f));else{let t=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),c.setSelection(Oi(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}fa.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add(`ProseMirror-focused`),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&yi(e)},20))},fa.blur=(e,t)=>{let n=t;e.focused&&=(e.domObserver.stop(),e.dom.classList.remove(`ProseMirror-focused`),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),!1)},fa.beforeinput=(e,t)=>{if(sr&&t.inputType==`deleteContentBackward`){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp(`handleKeyDown`,t=>t(e,Wn(8,`Backspace`)))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in pa)fa[e]=pa[e];function no(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}var ro=class e{constructor(e,t){this.toDOM=e,this.spec=t||co,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new oo(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&no(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},io=class e{constructor(e,t){this.attrs=e,this.spec=t||co}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=a?null:new oo(i,a,this)}valid(e,t){return t.from<t.to}eq(t){return this==t||t instanceof e&&no(this.attrs,t.attrs)&&no(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},ao=class e{constructor(e,t){this.attrs=e,this.spec=t||co}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new oo(i.pos-n,a.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(t){return this==t||t instanceof e&&no(this.attrs,t.attrs)&&no(this.spec,t.spec)}destroy(){}},oo=class e{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(t,n){return new e(t,n,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(t,n,r){return new e(t,t,new ro(n,r))}static inline(t,n,r,i){return new e(t,n,new io(r,i))}static node(t,n,r,i){return new e(t,n,new ao(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof io}get widget(){return this.type instanceof ro}},so=[],co={},R=class e{constructor(e,t){this.local=e.length?e:so,this.children=t.length?t:so}static create(e,t){return t.length?go(t,e,0,co):z}find(e,t,n){let r=[];return this.findInner(e??0,t??1e9,r,0,n),r}findInner(e,t,n,r,i){for(let a=0;a<this.local.length;a++){let o=this.local[a];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==z||e.maps.length==0?this:this.mapInner(e,t,0,0,n||co)}mapInner(t,n,r,i,a){let o;for(let e=0;e<this.local.length;e++){let s=this.local[e].map(t,r,i);s&&s.type.valid(n,s)?(o||=[]).push(s):a.onRemove&&a.onRemove(this.local[e].spec)}return this.children.length?uo(this.children,o||[],t,n,r,i,a):o?new e(o.sort(_o),so):z}add(t,n){return n.length?this==z?e.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,a=0;t.forEach((e,t)=>{let o=t+r,s;if(s=mo(n,e,o)){for(i||=this.children.slice();a<i.length&&i[a]<t;)a+=3;i[a]==t?i[a+2]=i[a+2].addInner(e,s,o+1):i.splice(a,0,t,t+e.nodeSize,go(s,e,o+1,co)),a+=3}});let o=fo(a?ho(n):n,-r);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||o.splice(e--,1);return new e(o.length?this.local.concat(o).sort(_o):this.local,i||this.children)}remove(e){return e.length==0||this==z?this:this.removeInner(e,0)}removeInner(t,n){let r=this.children,i=this.local;for(let e=0;e<r.length;e+=3){let i,a=r[e]+n,o=r[e+1]+n;for(let e=0,n;e<t.length;e++)(n=t[e])&&n.from>a&&n.to<o&&(t[e]=null,(i||=[]).push(n));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[e+2].removeInner(i,a+1);s==z?(r.splice(e,3),e-=3):r[e+2]=s}if(i.length){for(let e=0,r;e<t.length;e++)if(r=t[e])for(let e=0;e<i.length;e++)i[e].eq(r,n)&&(i==this.local&&(i=this.local.slice()),i.splice(e--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new e(i,r):z}forChild(t,n){if(this==z)return this;if(n.isLeaf)return e.empty;let r,i;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(r=this.children[e+2]);break}let a=t+1,o=a+n.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>a&&t.type instanceof io){let e=Math.max(a,t.from)-a,n=Math.min(o,t.to)-a;e<n&&(i||=[]).push(t.copy(e,n))}}if(i){let t=new e(i.sort(_o),so);return r?new lo([t,r]):t}return r||z}eq(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(e){return vo(this.localsInner(e))}localsInner(e){if(this==z)return so;if(e.inlineContent||!this.local.some(io.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof io||t.push(this.local[e]);return t}forEachSet(e){e(this)}};R.empty=new R([],[]),R.removeOverlap=vo;var z=R.empty,lo=class e{constructor(e){this.members=e}map(t,n){let r=this.members.map(e=>e.map(t,n,co));return e.from(r)}forChild(t,n){if(n.isLeaf)return R.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,n);a!=z&&(a instanceof e?r=r.concat(a.members):r.push(a))}return e.from(r)}eq(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length){if(!t)t=i;else{n&&=(t=t.slice(),!1);for(let e=0;e<i.length;e++)t.push(i[e])}}}return t?vo(n?t:t.sort(_o)):so}static from(t){switch(t.length){case 0:return z;case 1:return t[0];default:return new e(t.every(e=>e instanceof R)?t:t.reduce((e,t)=>e.concat(t instanceof R?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function uo(e,t,n,r,i,a,o){let s=e.slice();for(let e=0,t=a;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,a)=>{let o=a-i-(n-e);for(let i=0;i<s.length;i+=3){let a=s[i+1];if(a<0||e>a+t-r)continue;let c=s[i]+t-r;n>=c?s[i+1]=e<=c?-2:-1:e>=t&&o&&(s[i]+=o,s[i+1]+=o)}r+=o}),t=n.maps[e].map(t,-1)}let c=!1;for(let t=0;t<s.length;t+=3)if(s[t+1]<0){if(s[t+1]==-2){c=!0,s[t+1]=-1;continue}let l=n.map(e[t]+a),u=l-i;if(u<0||u>=r.content.size){c=!0;continue}let d=n.map(e[t+1]+a,-1)-i,{index:f,offset:p}=r.content.findIndex(u),m=r.maybeChild(f);if(m&&p==u&&p+m.nodeSize==d){let r=s[t+2].mapInner(n,m,l+1,e[t]+a+1,o);r==z?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=go(po(s,e,t,n,i,a,o),r,0,o);t=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<s.length&&s[t]<n;)t+=3;s.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new R(t.sort(_o),s)}function fo(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new oo(i.from+t,i.to+t,i.type))}return n}function po(e,t,n,r,i,a,o){function s(e,t){for(let a=0;a<e.local.length;a++){let s=e.local[a].map(r,i,t);s?n.push(s):o.onRemove&&o.onRemove(e.local[a].spec)}for(let n=0;n<e.children.length;n+=3)s(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)e[n+1]==-1&&s(e[n+2],t[n]+a+1);return n}function mo(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,a;t<e.length;t++)(a=e[t])&&a.from>n&&a.to<r&&((i||=[]).push(a),e[t]=null);return i}function ho(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function go(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=mo(e,t,o+n);if(s){a=!0;let e=go(s,t,n+o+1,r);e!=z&&i.push(o,o+t.nodeSize,e)}});let o=fo(a?ho(e):e,-n).sort(_o);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||(r.onRemove&&r.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new R(o,i):z}function _o(e,t){return e.from-t.from||e.to-t.to}function vo(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let a=t[i];if(a.from==r.from){a.to!=r.to&&(t==e&&(t=e.slice()),t[i]=a.copy(a.from,r.to),yo(t,i+1,a.copy(r.to,a.to)));continue}a.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,a.from),yo(t,i,r.copy(a.from,r.to)));break}}return t}function yo(e,t,n){for(;t<e.length&&_o(n,e[t])>0;)t++;e.splice(t,0,n)}function bo(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=z&&t.push(r)}),e.cursorWrapper&&t.push(R.create(e.state.doc,[e.cursorWrapper.deco])),lo.from(t)}var xo={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},So=$n&&er<=11,Co=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},wo=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Co,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);$n&&er<=11&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():L&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),So&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,xo)),this.onCharData&&this.view.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener(`selectionchange`,this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener(`selectionchange`,this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(ki(this.view)){if(this.suppressingSelectionUpdates)return yi(this.view);if($n&&er<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Pn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=An(n))t.add(n);for(let r=e.anchorNode;r;r=An(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:`selection`,target:F(n)?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&ki(e)&&!this.ignoreSelectionChange(n),i=-1,a=-1,o=!1,s=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],s);n&&(i=i<0?n.from:Math.min(n.from,i),a=a<0?n.to:Math.max(n.to,a),n.typeOver&&(o=!0))}if(s.some(e=>e.nodeName==`BR`)&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||I&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(e=>e.type==`childList`&&e.removedNodes.length))){for(let e of s)if(e.nodeName==`BR`&&e.parentNode){let t=e.nextSibling;for(;t&&P(t);){if(t.contentEditable==`false`){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(tr&&s.length){let t=s.filter(e=>e.nodeName==`BR`);if(t.length==2){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;t&&t.nodeName==`LI`&&(!n||Ao(e,n)!=t)&&r.remove()}}}let c=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Un(n)&&(c=_i(e))&&c.eq(D.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,yi(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),Do(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,jo(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||yi(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type==`attributes`&&(n==this.view.docView||e.attributeName==`contenteditable`||e.attributeName==`style`&&!e.oldValue&&!e.target.getAttribute(`style`))||!n||n.ignoreMutation(e))return null;if(e.type==`childList`){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),F(r)&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if($n&&er<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:a}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!a||Array.prototype.indexOf.call(e.addedNodes,a)<0)&&(i=a)}let a=r&&r.parentNode==e.target?N(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?N(i):e.target.childNodes.length;return{from:o,to:n.localPosFromDOM(e.target,s,1)}}return e.type==`attributes`?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}},To=new WeakMap,Eo=!1;function Do(e){if(!To.has(e)&&(To.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=tr,Eo)return;console.warn(`ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.`),Eo=!0}}function Oo(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return Pn(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function ko(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Oo(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener(`beforeinput`,r,!0),document.execCommand(`indent`),e.dom.removeEventListener(`beforeinput`,r,!0),n?Oo(e,n):null}function Ao(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function jo(e,t){let{focusNode:n,focusOffset:r}=e.domSelectionRange();for(let i of t)if(i.parentNode?.nodeName==`TR`){let t=i.nextSibling;for(;t&&t.nodeName!=`TD`&&t.nodeName!=`TH`;)t=t.nextSibling;if(t){let a=t;for(;;){let e=a.firstChild;if(!e||!P(e)||e.contentEditable==`false`||/^(BR|IMG)$/.test(e.nodeName))break;a=e}a.insertBefore(i,a.firstChild),n==i&&e.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function Mo(e,t,n,r){let{node:i,fromOffset:a,toOffset:o,from:s,to:c}=e.docView.parseRange(t,n),l=e.domSelectionRange(),u,d=l.anchorNode;if(d&&Rn(e.dom,d)&&(u=[{node:d,offset:l.anchorOffset}],Un(l)||u.push({node:l.focusNode,offset:l.focusOffset})),I&&e.input.lastKeyCode===8)for(let e=o;e>a;e--){let t=i.childNodes[e-1],n=t.pmViewDesc;if(t.nodeName==`BR`&&!n){o=e;break}if(!n||n.size)break}let f=e.state.doc,p=e.someProp(`domParser`)||ye.fromSchema(e.state.schema),m=f.resolve(s),h=null,g=p.parse(i,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:a,to:o,preserveWhitespace:m.parent.type.whitespace!=`pre`||`full`,findPositions:u,ruleFromNode:No(r),context:m});if(u&&u[0].pos!=null){let e=u[0].pos,t=u[1]&&u[1].pos;t??=e,h={anchor:e+s,head:t+s}}return{doc:g,sel:h,from:s,to:c}}var No=e=>t=>{let n=t.pmViewDesc;if(n)return n.parseRule(e);if(t.nodeName==`BR`&&t.parentNode){if(L&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let e=document.createElement(`div`);return e.appendChild(document.createElement(`li`)),{skip:e}}if(t.parentNode.lastChild==t||L&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName==`IMG`&&t.getAttribute(`mark-placeholder`))return{ignore:!0};return null},Po=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Fo(e,t,n,r,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=_i(e,t);if(n&&!e.state.selection.eq(n)){if(I&&sr&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,t=>t(e,Wn(13,`Enter`))))return;let r=e.state.tr.setSelection(n);t==`pointer`?r.setMeta(`pointer`,!0):t==`key`&&r.scrollIntoView(),a&&r.setMeta(`composition`,a),e.dispatch(r)}return}let o=e.state.doc.resolve(t),s=o.sharedDepth(n);t=o.before(s+1),n=e.state.doc.resolve(n).after(s+1);let c=e.state.selection,l=Mo(e,t,n,i),u=e.state.doc,d=u.slice(l.from,l.to),f,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,p=`end`):(f=e.state.selection.from,p=`start`),e.input.lastKeyCode=null;let m=Vo(d.content,l.doc.content,l.from,f,p);if(m&&e.input.domChangeCount++,(ir&&e.input.lastIOSEnter>Date.now()-225||sr)&&i.some(e=>P(e)&&!Po.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,Wn(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m){if(r&&c instanceof k&&!c.empty&&c.$head.sameParent(c.$anchor)&&!e.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(l.sel){let t=Io(e,e.state.doc,l.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta(`composition`,a),e.dispatch(n)}}return}}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof k&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=l.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=l.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),$n&&er<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>l.from&&l.doc.textBetween(m.start-l.from-1,m.start-l.from+1)==` \xA0`&&(m.start--,m.endA--,m.endB--);let h=l.doc.resolveNoCache(m.start-l.from),g=l.doc.resolveNoCache(m.endB-l.from),_=u.resolve(m.start),v=h.sameParent(g)&&h.parent.inlineContent&&_.end()>=m.endA;if((ir&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>e.nodeName==`DIV`||e.nodeName==`P`))||!v&&zo(l.doc,h.pos,g.pos))&&e.someProp(`handleKeyDown`,t=>t(e,Wn(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&Ro(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,Wn(8,`Backspace`)))){sr&&I&&e.domObserver.suppressSelectionUpdates();return}I&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),sr&&!v&&h.start()!=g.start()&&g.parentOffset==0&&h.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==m.endA&&(m.endB-=2,g=l.doc.resolveNoCache(m.endB-l.from),setTimeout(()=>{e.someProp(`handleKeyDown`,function(t){return t(e,Wn(13,`Enter`))})},20));let y=m.start,b=m.endA,x=t=>{let n=t||e.state.tr.replace(y,b,l.doc.slice(m.start-l.from,m.endB-l.from));if(l.sel){let t=Io(e,n.doc,l.sel);t&&!(I&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==y||t.head==n.mapping.map(b)-1)||$n&&t.empty&&t.head==y)&&n.setSelection(t)}return a&&n.setMeta(`composition`,a),n.scrollIntoView()},S;if(v){if(h.pos==g.pos){$n&&er<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>yi(e),20));let t=x(e.state.tr.delete(y,b)),n=u.resolve(m.start).marksAcross(u.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(S=Lo(h.parent.content.cut(h.parentOffset,g.parentOffset),_.parent.content.cut(_.parentOffset,m.endA-_.start())))){let t=x(e.state.tr);S.type==`add`?t.addMark(y,b,S.mark):t.removeMark(y,b,S.mark),e.dispatch(t)}else if(h.parent.child(h.index()).isText&&h.index()==g.index()-+!g.textOffset){let t=h.parent.textBetween(h.parentOffset,g.parentOffset),n=()=>x(e.state.tr.insertText(t,y,b));e.someProp(`handleTextInput`,r=>r(e,y,b,t,n))||e.dispatch(n())}else e.dispatch(x())}else e.dispatch(x())}function Io(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Oi(e,t.resolve(n.anchor),t.resolve(n.head))}function Lo(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,a=r,o,s,c;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)a=n[e].removeFromSet(a);if(i.length==1&&a.length==0)s=i[0],o=`add`,c=e=>e.mark(s.addToSet(e.marks));else if(i.length==0&&a.length==1)s=a[0],o=`remove`,c=e=>e.mark(s.removeFromSet(e.marks));else return null;let l=[];for(let e=0;e<t.childCount;e++)l.push(c(t.child(e)));if(T.from(l).eq(e))return{mark:s,type:o}}function Ro(e,t,n,r,i){if(n-t<=i.pos-r.pos||Bo(r,!0,!1)<i.pos)return!1;let a=e.resolve(t);if(!r.parent.isTextblock){let e=a.nodeAfter;return e!=null&&n==t+e.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=e.resolve(Bo(a,!0,!0));return!o.parent.isTextblock||o.pos>n||Bo(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function zo(e,t,n){let r=0,i=0;return e.nodesBetween(t,n,(e,a)=>{e.isTextblock&&a>=t&&a<n?r++:(e.isText?/\S/.test(e.text.slice(Math.max(0,t-a),Math.min(e.nodeSize,n-a))):e.isLeaf)&&i++}),i==0&&r==1}function Bo(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function Vo(e,t,n,r,i){let a=e.findDiffStart(t,n),o=n+e.size,s=n+t.size;if(a==null)return null;let{a:c,b:l}=e.findDiffEnd(t,o,s);if(i==`end`){let e=Math.max(0,a-Math.min(c,l));r-=c+e-a}if(c<a&&o<s){let e=r<=a&&r>=c?a-r:0;a-=e,l=a+(l-c),c=a}else if(l<a){let e=r<=a&&r>=l?a-r:0;a-=e,c=a+(c-l),l=a}return{start:a,endA:c,endB:l}}var Ho=class{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new ha,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Yo),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement(`div`),e&&(e.appendChild?e.appendChild(this.dom):typeof e==`function`?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Go(this),Wo(this),this.nodeViews=qo(this),this.docView=Zr(this.state.doc,Uo(this),bo(this),this.dom,this),this.domObserver=new wo(this,(e,t,n,r)=>Fo(this,e,t,n,r)),this.domObserver.start(),ga(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ya(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Yo),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(Ua(this),i=!0),this.state=e;let a=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=qo(this);Jo(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&ya(this),this.editable=Go(this),Wo(this);let o=bo(this),s=Uo(this),c=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?`reset`:e.scrollToSelection>n.scrollToSelection?`to selection`:`preserve`,l=r||!this.docView.matchesNode(e.doc,s,o);(l||!e.selection.eq(n.selection))&&(i=!0);let u=c==`preserve`&&i&&this.dom.style.overflowAnchor==null&&mr(this);if(i){this.domObserver.stop();let t=l&&($n||I)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&Ko(n.selection,e.selection);if(l){let n=I?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Wa(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=Zr(e.doc,s,o,this.dom,this)),n&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(t=!0)}let i=this.input.mouseDown;t||!(i&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&ji(this)&&i.delaySelUpdate())?yi(this,t):(Ei(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),this.dragging?.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),c==`reset`?this.dom.scrollTop=0:c==`to selection`?this.scrollToSelection():u&&gr(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&Rn(this.dom,e)&&!this.someProp(`handleScrollToSelection`,e=>e(this))){if(this.state.selection instanceof E){let t=this.docView.domAfterPos(this.state.selection.from);P(t)&&pr(this,t.getBoundingClientRect(),e)}else pr(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new Qa(e.slice,e.move,r<0?void 0:E.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(n!=null&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(i!=null&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let a=i[n].props[e];if(a!=null&&(r=t?t(a):a))return r}}hasFocus(){if($n){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable==`false`)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&yr(this.dom),yi(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Dr(this,e)}coordsAtPos(e,t=1){return jr(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(r==null)throw RangeError(`DOM position not inside the editor`);return r}endOfTextblock(e,t){return Vr(this,t||this.state,e)}pasteHTML(e,t){return Xa(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return Xa(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return Xi(this,e)}destroy(){this.docView&&(va(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],bo(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Nn())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Sa(this,e)}domSelectionRange(){let e=this.dom.isConnected!==!1&&this.domSelection();return e?L&&this.root.nodeType===11&&Gn(this.dom.ownerDocument)==this.dom&&ko(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};Ho.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function Uo(e){let t=Object.create(null);return t.class=`ProseMirror`,t.contenteditable=String(e.editable),e.someProp(`attributes`,n=>{if(typeof n==`function`&&(n=n(e.state)),n)for(let e in n)e==`class`?t.class+=` `+n[e]:e==`style`?t.style=(t.style?t.style+`;`:``)+n[e]:!t[e]&&e!=`contenteditable`&&e!=`nodeName`&&(t[e]=String(n[e]))}),t.translate||=`no`,[oo.node(0,e.state.doc.content.size,t)]}function Wo(e){if(e.markCursor){let t=document.createElement(`img`);t.className=`ProseMirror-separator`,t.setAttribute(`mark-placeholder`,`true`),t.setAttribute(`alt`,``),e.cursorWrapper={dom:t,deco:oo.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Go(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function Ko(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function qo(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp(`nodeViews`,n),e.someProp(`markViews`,n),t}function Jo(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r}function Yo(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError(`Plugins passed directly to the view must not have a state component`)}var Xo=typeof navigator<`u`&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Zo=typeof navigator<`u`&&/Win/.test(navigator.platform);function Qo(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n==`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e++){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))Xo?o=!0:i=!0;else throw Error(`Unrecognized modifier name: `+n)}return r&&(n=`Alt-`+n),i&&(n=`Ctrl-`+n),o&&(n=`Meta-`+n),a&&(n=`Shift-`+n),n}function $o(e){let t=Object.create(null);for(let n in e)t[Qo(n)]=e[n];return t}function es(e,t,n=!0){return t.altKey&&(e=`Alt-`+e),t.ctrlKey&&(e=`Ctrl-`+e),t.metaKey&&(e=`Meta-`+e),n&&t.shiftKey&&(e=`Shift-`+e),e}function ts(e){return new O({props:{handleKeyDown:ns(e)}})}function ns(e){let t=$o(e);return function(e,n){let r=wt(n),i,a=t[es(r,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(r.length==1&&r!=` `){if(n.shiftKey){let i=t[es(r,n,!1)];if(i&&i(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(Zo&&n.ctrlKey&&n.altKey)&&(i=Tt[n.keyCode])&&i!=r){let r=t[es(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var rs=200,B=function(){};B.prototype.append=function(e){return e.length?(e=B.from(e),!this.length&&e||e.length<rs&&this.leafAppend(e)||this.length<rs&&e.leafPrepend(this)||this.appendInner(e)):this},B.prototype.prepend=function(e){return e.length?B.from(e).append(this):this},B.prototype.appendInner=function(e){return new as(this,e)},B.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?B.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},B.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},B.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},B.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},B.from=function(e){return e instanceof B?e:e&&e.length?new is(e):B.empty};var is=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=rs)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=rs)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(B);B.empty=new is([]);var as=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(B),ss=500,cs=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new us(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new us(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new us(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>fs&&(s=ls(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new Fe;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new us(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;n=Math.min(this.items.length,n);let r=[],i=this.items.length-n,a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new us(i,o,l))}else r.push(new us(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new us(a.maps[e]));let u=this.items.slice(0,i).append(l).append(r),d=new e(u,s);return d.emptyItemCount()>ss&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new us(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(B.from(i.reverse()),a)}};cs.empty=new cs(B.empty,0);function ls(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var us=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},ds=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},fs=20;function ps(e,t,n,r){let i=n.getMeta(Ss),a;if(i)return i.historyState;n.getMeta(Cs)&&(e=new ds(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(Ss))return o.getMeta(Ss).redo?new ds(e.done.addTransform(n,void 0,r,bs(t)),e.undone,hs(n.mapping.maps),e.prevTime,e.prevComposition):new ds(e.done,e.undone.addTransform(n,void 0,r,bs(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!ms(n,e.prevRanges)),s=o?gs(e.prevRanges,n.mapping):hs(n.mapping.maps);return new ds(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,bs(t)),cs.empty,s,n.time,i??e.prevComposition)}return(a=n.getMeta(`rebased`))?new ds(e.done.rebased(n,a),e.undone.rebased(n,a),gs(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new ds(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),gs(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function ms(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function hs(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function gs(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function _s(e,t,n){let r=bs(t),i=Ss.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new ds(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(Ss,{redo:n,historyState:c})}var vs=!1,ys=null;function bs(e){let t=e.plugins;if(ys!=t){vs=!1,ys=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){vs=!0;break}}return vs}function xs(e){return e.setMeta(Cs,!0)}var Ss=new A(`history`),Cs=new A(`closeHistory`);function ws(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new O({key:Ss,state:{init(){return new ds(cs.empty,cs.empty,null,0,-1)},apply(t,n,r){return ps(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?Es:n==`historyRedo`?Ds:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function Ts(e,t){return(n,r)=>{let i=Ss.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=_s(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var Es=Ts(!1,!0),Ds=Ts(!0,!0);function Os(e){return e.getMeta(Ss)!=null}function ks(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var As=class e{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u}])),run:l};return u}static createFakeChain(){let e=new Proxy({},{get:(t,n)=>{if(n!==`then`)return n===`run`?()=>!1:()=>e}});return e}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}static createFallbackCan(){let t=e.createFakeChain();return new Proxy({chain:()=>t},{get:(e,t)=>{if(t!==`then`)return t===`chain`?e.chain:()=>!1}})}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:ks({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},js=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{if(!e.isDestroyed){var n;t.dom.blur(),(n=window)==null||(n=n.getSelection())==null||n.removeAllRanges()}}),!0),Ms=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),Ns=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,a=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),s=a.blockRange(o);if(!s)return;let c=He(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(c||c===0)&&t.lift(s,c)})}),!0},Ps=e=>t=>e(t),Fs=()=>({state:e,dispatch:t})=>rn(e,t),Is=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new k(r.doc.resolve(Math.max(o-1,0)))),!0},Ls=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function V(e,t){if(typeof e==`string`){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var Rs=e=>({tr:t,state:n,dispatch:r})=>{let i=V(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},zs=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},Bs=e=>e.content?/^text(\*|\+)/.test(e.content):!1,Vs=(e,t,n)=>{if(!e.parent.isInline||n===`left`&&e.pos>e.start()||n===`right`&&e.pos<e.end())return e.pos;let r=t.nodes[e.parent.type.name].spec;return Bs(r)?n===`left`?e.start()-1:e.end()+1:e.pos},Hs=(e,t,n)=>({from:Vs(e,n,`left`),to:Vs(t,n,`right`)}),Us=()=>({state:e,dispatch:t})=>{if(e.selection.empty)return!1;if(t){let n=e.tr,{ranges:r}=e.selection,i=n.steps.length;r.forEach(t=>{let r=n.mapping.slice(i),{from:a,to:o}=Hs(n.doc.resolve(r.map(t.$from.pos)),n.doc.resolve(r.map(t.$to.pos)),e.schema);n.deleteRange(a,o)}),n.selection.empty||n.setSelection(k.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),t(n)}return!0},Ws=()=>({commands:e})=>e.keyboardShortcut(`Enter`),Gs=()=>({state:e,dispatch:t})=>nn(e,t);function Ks(e){return Object.prototype.toString.call(e)===`[object RegExp]`}function qs(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:Ks(t[r])?t[r].test(e[r]):t[r]===e[r])}function Js(e,t,n={}){return e.find(e=>e.type===t&&qs(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function Ys(e,t,n={}){return!!Js(e,t,n)}function Xs(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if((!r.node||!r.node.marks.some(e=>e.type===t))&&(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!Js([...r.node.marks],t,n))return;let i=r.index,a=e.start()+r.offset,o=i+1,s=a+r.node.nodeSize;for(;i>0&&Ys([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&Ys([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function Zs(e,t){if(typeof e==`string`){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var Qs=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=Zs(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=Xs(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=k.create(o,e.from,e.to);n.setSelection(t)}}return!0},$s=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function ec(e){return e instanceof k}function tc(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function nc(e,t=null){if(!t)return null;let n=D.atStart(e),r=D.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?k.create(e,tc(0,i,a),tc(e.content.size,i,a)):k.create(e,tc(t,i,a),tc(t,i,a))}function rc(){return[`Android`].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function ic(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function ac(){return typeof navigator<`u`&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}var oc=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(ic()||rc())&&r.dom.focus(),ac()&&!ic()&&!rc()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!ec(n.state.selection))return o(),!0;let s=nc(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},sc=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),cc=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),lc=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&lc(r)}return e};function uc(e){if(typeof window>`u`)throw Error(`[tiptap error]: there is no window object available, so this function cannot be used`);let t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return lc(n)}function dc(e){return typeof e?.nodesBetween==`function`}function fc(e,t,n){if(dc(e))return e;let r=typeof e==`object`&&!!e;n={slice:!0,parseOptions:{},...n};let i=typeof e==`string`;if(r)try{if(Array.isArray(e)&&e.length>0)return T.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error(`[tiptap error]: Invalid JSON content`,{cause:r});return console.warn(`[tiptap warn]: Invalid content.`,`Passed value:`,e,`Error:`,r),fc(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new Ne({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:`inline*`,group:`block`,parseDOM:[{tag:`*`,getAttrs:e=>(r=!0,i=typeof e==`string`?e:e.outerHTML,null)}]}})});if(n.slice?ye.fromSchema(a).parseSlice(uc(e),n.parseOptions):ye.fromSchema(a).parse(uc(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=ye.fromSchema(t);return n.slice?r.parseSlice(uc(e),n.parseOptions).content:r.parse(uc(e),n.parseOptions)}return fc(``,t,n)}function pc(e){return!(`type`in e)}function mc(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof Ee||i instanceof Ae))return;let a=e.mapping.maps[r],o=0;a.forEach((e,t,n,r)=>{o===0&&(o=r)}),e.setSelection(D.near(e.doc.resolve(o),n))}var hc=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{`collaboration`in a.storage&&typeof a.storage.collaboration==`object`&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{fc(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=fc(t,a.schema,{parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent??a.options.enableContentCheck})}catch(e){return o(e),!1}let{from:c,to:l}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0,f=pc(i)?i.content:[i];if(f.forEach(e=>{e.check(),u=u?e.isText&&e.marks.length===0:!1,d=d?e.isBlock:!1}),c===l&&d){let{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--c,l+=1)}let p;if(u)p=Array.isArray(t)?t.map(e=>e.text||``).join(``):dc(t)?f.map(e=>e.text??``).join(``):typeof t==`object`&&t&&t.text?t.text:t,r.insertText(p,c,l);else{p=T.from(f);let e=r.doc.resolve(c),t=e.node(),n=e.parentOffset===0,i=t.isText||t.isTextblock,a=t.content.size>0;n&&i&&a&&d&&(c=Math.max(0,c-1)),r.replaceWith(c,l,f)}n.updateSelection&&mc(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:c,text:p}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:c,text:p})}return!0};function gc(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var _c=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{pos:i,attrs:a,content:o,updateSelection:s=!0}=e,c;c=typeof i==`number`?t.doc.resolve(i):i||t.selection.$from;let l=gc(c.parent.contentMatchAt(c.index()));if(!l)return!1;let u=Object.keys(l.spec.attrs||{}),d=a?Object.fromEntries(Object.entries(a).filter(([e])=>u.includes(e))):{},f;if(o){let e=fc(o,r.schema);f=l.createAndFill(d,e)}else f=l.createAndFill(d);return f?(n&&(t.insert(c.pos,f),s&&mc(t,t.steps.length-1,-1)),!0):!1},vc=()=>({state:e,dispatch:t})=>Zt(e,t),yc=()=>({state:e,dispatch:t})=>Qt(e,t),bc=()=>({state:e,dispatch:t})=>Bt(e,t),xc=()=>({state:e,dispatch:t})=>Jt(e,t),Sc=(e,t)=>{let n=e.resolve(t),r=n.nodeBefore,i=n.nodeAfter;return!r||!i?!1:!r.type.spec.isolating&&!i.type.spec.isolating},Cc=()=>({state:e,dispatch:t,tr:n})=>{try{let r=_e(e.doc,e.selection.$from.pos,-1);return r==null||!Sc(e.doc,r)?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},wc=()=>({state:e,dispatch:t,tr:n})=>{try{let r=_e(e.doc,e.selection.$from.pos,1);return r==null||!Sc(e.doc,r)?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},Tc=()=>({state:e,dispatch:t})=>Vt(e,t),Ec=()=>({state:e,dispatch:t})=>Ht(e,t);function Dc(){return typeof navigator<`u`&&/Mac/.test(navigator.platform)}function Oc(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n===`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e+=1){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))ic()||Dc()?o=!0:i=!0;else throw Error(`Unrecognized modifier name: ${n}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}var kc=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=Oc(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0});return t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))})?.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function Ac(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?V(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:n,to:a})});let c=i-r,l=s.filter(e=>!o||o.name===e.node.type.name).filter(e=>qs(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var jc=(e,t={})=>({state:n,dispatch:r})=>Ac(n,V(e,n.schema),t)?$t(n,r):!1,Mc=()=>({state:e,dispatch:t})=>an(e,t),Nc=e=>({state:t,dispatch:n})=>Tn(V(e,t.schema))(t,n),Pc=()=>({state:e,dispatch:t})=>en(e,t);function Fc(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function Ic(e,t){let n=typeof t==`string`?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var Lc=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=Fc(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=V(e,r.schema)),s===`mark`&&(o=Zs(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,Ic(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(c=!0,i&&n.addMark(r,r+e.nodeSize,o.create(Ic(a.attrs,t))))})})}),c},Rc=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),zc=()=>({tr:e,dispatch:t})=>{if(t){let t=new Le(e.doc);e.setSelection(t)}return!0},Bc=()=>({state:e,dispatch:t})=>Gt(e,t),Vc=()=>({state:e,dispatch:t})=>Yt(e,t),Hc=()=>({state:e,dispatch:t})=>cn(e,t),Uc=()=>({state:e,dispatch:t})=>mn(e,t),Wc=()=>({state:e,dispatch:t})=>pn(e,t);function Gc(e,t,n={},r={}){return fc(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var Kc=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(r.preserveWhitespace!==`full`){let s=Gc(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});if(o){let e=pc(s)?s.content:[s];a.replaceWith(0,c.content.size,e).setMeta(`preventUpdate`,!n)}return!0}return o&&a.setMeta(`preventUpdate`,!n),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function qc(e,t){let n=Zs(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let s=o.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function Jc(e,t){let n=new Ve(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function Yc(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function Xc(e,t){for(let n=e.depth;n>0;--n){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function Zc(e){return t=>Xc(t.$from,e)}function H(e,t,n){return e.config[t]===void 0&&e.parent?H(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?H(e.parent,t,n):null}):e.config[t]}function Qc(e){return e.map(e=>{let t=H(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...Qc(t())]:e}).flat(10)}function $c(e,t){let n=ve.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}function el(e){return typeof e==`function`}function U(e,t=void 0,...n){return el(e)?t?e.bind(t)(...n):e(...n):e}function tl(e={}){return Object.keys(e).length===0&&e.constructor===Object}function nl(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function rl(e){let t=[],{nodeExtensions:n,markExtensions:r}=nl(e),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(e=>e.name!==`text`).map(e=>e.name),s=r.map(e=>e.name),c=[...o,...s];return e.forEach(e=>{let n=H(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:e.types===`*`?c:e.types===`nodes`?o:e.types===`marks`?s:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}),i.forEach(e=>{let n=H(e,`addAttributes`,{name:e.name,options:e.options,storage:e.storage});if(!n)return;let r=n();Object.entries(r).forEach(([n,r])=>{let i={...a,...r};typeof i?.default==`function`&&(i.default=i.default()),i?.isRequired&&i?.default===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function il(e){let t=[],n=``,r=!1,i=!1,a=0,o=e.length;for(let s=0;s<o;s+=1){let o=e[s];if(o===`'`&&!i){r=!r,n+=o;continue}if(o===`"`&&!r){i=!i,n+=o;continue}if(!r&&!i){if(o===`(`){a+=1,n+=o;continue}if(o===`)`&&a>0){--a,n+=o;continue}if(o===`;`&&a===0){t.push(n),n=``;continue}}n+=o}return n&&t.push(n),t}function al(e){let t=[],n=il(e||``),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(`:`);if(i===-1)continue;let a=r.slice(0,i).trim(),o=r.slice(i+1).trim();a&&o&&t.push([a,o])}return t}function W(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(e===`__proto__`){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0});return}if(!n[e]){n[e]=t;return}if(e===`class`){let r=t?String(t).split(` `):[],i=n[e]?n[e].split(` `):[],a=r.filter(e=>!i.includes(e));n[e]=[...i,...a].join(` `)}else if(e===`style`){let r=new Map([...al(n[e]),...al(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function ol(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>W(e,t),{})}function sl(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`||e!==`false`&&e:e}function cl(e,t){return`style`in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((e,t)=>{let r=t.attribute.parseHTML?t.attribute.parseHTML(n):sl(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function ll(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&tl(t)?!1:t!=null))}function ul(e){var t,n;let r={};return!(e!=null&&(t=e.attribute)!=null&&t.isRequired)&&`default`in(e?.attribute||{})&&(r.default=e.attribute.default),(e==null||(n=e.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function dl(e,t){let n=rl(e),{nodeExtensions:r,markExtensions:i}=nl(e),a=r.find(e=>H(e,`topNode`))?.name,o=Object.fromEntries(r.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=ll({...e.reduce((e,t)=>{let n=H(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:U(H(r,`content`,a)),marks:U(H(r,`marks`,a)),group:U(H(r,`group`,a)),inline:U(H(r,`inline`,a)),atom:U(H(r,`atom`,a)),selectable:U(H(r,`selectable`,a)),draggable:U(H(r,`draggable`,a)),code:U(H(r,`code`,a)),whitespace:U(H(r,`whitespace`,a)),linebreakReplacement:U(H(r,`linebreakReplacement`,a)),defining:U(H(r,`defining`,a)),isolating:U(H(r,`isolating`,a)),attrs:Object.fromEntries(i.map(ul))}),s=U(H(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>cl(e,i)));let c=H(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:ol(e,i)}));let l=H(r,`renderText`,a);return l&&(o.toText=l),[r.name,o]})),s=Object.fromEntries(i.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=ll({...e.reduce((e,t)=>{let n=H(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:U(H(r,`inclusive`,a)),excludes:U(H(r,`excludes`,a)),group:U(H(r,`group`,a)),spanning:U(H(r,`spanning`,a)),code:U(H(r,`code`,a)),attrs:Object.fromEntries(i.map(ul))}),s=U(H(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>cl(e,i)));let c=H(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:ol(e,i)})),[r.name,o]}));return new Ne({topNode:a,nodes:o,marks:s})}function fl(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function pl(e){return e.sort((e,t)=>{let n=H(e,`priority`)||100,r=H(t,`priority`)||100;return n>r?-1:+(n<r)})}function ml(e){let t=pl(Qc(e)),n=fl(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(`, `)}]. This can lead to issues.`),t}function hl(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=`
|
|
7
|
-
|
|
8
|
-
`,textSerializers:o={}}=n||{},s=``;return e.nodesBetween(r,i,(e,n,c,l)=>{e.isBlock&&n>r&&(s+=a);let u=o?.[e.type.name];if(u)return c&&(s+=u({node:e,pos:n,parent:c,index:l,range:t})),!1;if(e.isText){var d;s+=e==null||(d=e.text)==null?void 0:d.slice(Math.max(r,n)-n,i-n)}}),s}function gl(e,t){return hl(e,{from:0,to:e.content.size},t)}function _l(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function vl(e,t){let n=V(t,e.schema),{from:r,to:i}=e.selection,a=[];e.doc.nodesBetween(r,i,e=>{a.push(e)});let o=a.reverse().find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}function yl(e,t){let n=Fc(typeof t==`string`?t:t.name,e.schema);return n===`node`?vl(e,t):n===`mark`?qc(e,t):{}}function bl(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function xl(e){let t=bl(e);return t.length===1?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function Sl(e){let{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,i)=>{let a=[];if(e.ranges.length)e.forEach((e,t)=>{a.push({from:e,to:t})});else{let{from:e,to:t}=n[i];if(e===void 0||t===void 0)return;a.push({from:e,to:t})}a.forEach(({from:e,to:n})=>{let a=t.slice(i).map(e,-1),o=t.slice(i).map(n),s=t.invert().map(a,-1),c=t.invert().map(o);r.push({oldRange:{from:s,to:c},newRange:{from:a,to:o}})})}),xl(r)}function Cl(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=Xs(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{e&&e?.nodeSize!==void 0&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}var wl=(e,t,n,r=20)=>{let i=e.doc.resolve(n),a=r,o=null;for(;a>0&&o===null;){let e=i.node(a);e?.type.name===t?o=e:--a}return[o,a]},Tl=e=>{let t=e.depth-1;if(t<0)return null;let n=e.index(t);return n===0?null:e.node(t).child(n-1)};function El(e,t){return t.nodes[e]||t.marks[e]||null}function Dl(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return r?r.attribute.keepOnSplit:!1}))}var Ol=(e,t=500)=>{let n=``,r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,a)=>{var o;let s=(o=e.type.spec).toText?.call(o,{node:e,pos:t,parent:i,index:a})||e.textContent||`%leaf%`;n+=e.isAtom&&!e.isText?s:s.slice(0,Math.max(0,r-t))}),n};function kl(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?Zs(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!a||a.name===e.type.name).find(e=>qs(e.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(a&&e.inlineContent&&!e.type.allowsMarkType(a))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),c=Math.min(i,t+e.nodeSize),l=c-n;o+=l,s.push(...e.marks.map(e=>({mark:e,from:n,to:c})))})}),o===0)return!1;let c=s.filter(e=>!a||a.name===e.mark.type.name).filter(e=>qs(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),l=s.filter(e=>!a||e.mark.type!==a&&e.mark.type.excludes(a)).reduce((e,t)=>e+t.to-t.from,0);return(c>0?c+l:c)>=o}function Al(e,t,n={}){if(!t)return Ac(e,null,n)||kl(e,null,n);let r=Fc(t,e.schema);return r===`node`?Ac(e,t,n):r===`mark`&&kl(e,t,n)}var jl=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=Zc(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},Ml=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function Nl(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function Pl(e,t){let{nodeExtensions:n}=nl(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=U(H(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`&&i.split(` `).includes(`list`)}function Fl(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name===`hardBreak`)return!0;if(e.isText)return!/\S/.test(e.text??``)}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let r=!0;return e.content.forEach(e=>{r!==!1&&(Fl(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function Il(e){return e instanceof E}var Ll=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function Rl(e,t){let n=t.mapping.mapResult(e.position);return{position:new Ll(n.pos),mapResult:n}}function zl(e){return new Ll(e)}function Bl(e,t,n){let r=e.state.doc.content.size,i=tc(t,0,r),a=tc(n,0,r),o=e.coordsAtPos(i),s=e.coordsAtPos(a,-1),c=Math.min(o.top,s.top),l=Math.max(o.bottom,s.bottom),u=Math.min(o.left,s.left),d=Math.max(o.right,s.right),f={top:c,bottom:l,left:u,right:d,width:d-u,height:l-c,x:u,y:c};return{...f,toJSON:()=>f}}function Vl(e,t,n){let{selection:r}=t,i=null;if(ec(r)&&(i=r.$cursor),i){let t=e.storedMarks??i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:a}=r;return a.some(({$from:t,$to:r})=>{let i=t.depth===0&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),a=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&a}return!i}),i})}var Hl=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=Zs(e,r.schema);if(i){if(o){let e=qc(r,c);n.addStoredMark(c.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{let o=Math.max(r,i),s=Math.min(r+e.nodeSize,a);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(o,s,c.create({...e.attrs,...t}))}):n.addMark(o,s,c.create(t))})})}return Vl(r,n,c)},Ul=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),Wl=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=V(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>gn(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>gn(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},Gl=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=tc(e,0,n.content.size),i=E.create(n,r);t.setSelection(i)}return!0},Kl=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t==`number`?(o=t,s=t):t&&`from`in t&&`to`in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},ql=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=k.atStart(n).from,o=k.atEnd(n).to,s=tc(r,a,o),c=tc(i,a,o),l=k.create(n,s,c);t.setSelection(l)}return!0},Jl=e=>({state:t,dispatch:n})=>On(V(e,t.schema))(t,n);function Yl(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>t?.includes(e.type.name));e.tr.ensureMarks(r)}}var Xl=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:c}=a,l=i.extensionManager.attributes,u=Dl(l,s.node().type.name,s.node().attrs);if(a instanceof E&&a.node.isBlock)return!s.parentOffset||!Oe(o,s.pos)?!1:(r&&(e&&Yl(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let d=c.parentOffset===c.parent.content.size,f=s.depth===0?void 0:gc(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=a instanceof k&&!a.empty?ze.create({doc:t.doc,selection:a}).tr.deleteSelection():null,h=m?m.doc:t.doc,g=m?m.mapping.map(s.pos):s.pos,_=Oe(h,g,1,p);if(!p&&!_&&Oe(h,g,1,f?[{type:f}]:void 0)&&(_=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(_){let e=t.steps.length;if(a instanceof k&&t.deleteSelection(),t.split(t.mapping.slice(e).map(s.pos),1,p),f&&!d&&!s.parentOffset&&s.parent.type!==f){let n=t.mapping.slice(e).map(s.before()),r=t.doc.resolve(n);s.node(-1).canReplaceWith(r.index(),r.index()+1,f)&&t.setNodeMarkup(t.mapping.slice(e).map(s.before()),f)}}e&&Yl(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return _},Zl=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=V(e,r.schema),{$from:s,$to:c}=r.selection,l=r.selection.node;if(l&&l.isBlock||s.depth<2||!s.sameParent(c))return!1;let u=s.node(-1);if(u.type!==o)return!1;let d=a.extensionManager.attributes;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==o||s.index(-2)!==s.node(-2).childCount-1)return!1;if(i){let e=T.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=T.from(s.node(t).copy(e));let i=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3,a={...Dl(d,s.node().type.name,s.node().attrs),...t},c=o.contentMatch.defaultType?.createAndFill(a)||void 0;e=e.append(T.from(o.createAndFill(null,c)||void 0));let l=s.before(s.depth-(r-1));n.replace(l,s.after(-i),new w(e,4-r,0));let u=-1;n.doc.nodesBetween(l,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&e.content.size===0&&(u=t+1)}),u>-1&&n.setSelection(k.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...Dl(d,u.type.name,u.attrs),...t},m={...Dl(d,s.node().type.name,s.node().attrs),...t},h=s.parentOffset===0&&s.index(-1)===0,g=s.before(-1);n.delete(s.pos,c.pos);let _=h?u.attrs:p,v=f?[{type:o,attrs:_},{type:f,attrs:m}]:[{type:o,attrs:_}];if(!Oe(n.doc,s.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=a.extensionManager,c=t||e.$to.parentOffset&&e.$from.marks();if(n.split(s.pos,2,v).scrollIntoView(),h&&n.setNodeMarkup(g,void 0,p),!c||!i)return!0;let l=c.filter(e=>o.includes(e.type.name));n.ensureMarks(l)}return!0};function Ql(e){return!e||e===`1`?null:e}function $l(e,t){return Ql(e)===Ql(t)}var eu=(e,t)=>{let n=Zc(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&We(e.doc,n.pos))||!$l(n.node.attrs.type,i?.attrs.type)||e.join(n.pos),!0},tu=(e,t)=>{let n=Zc(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&We(e.doc,r))||!$l(n.node.attrs.type,i?.attrs.type)||e.join(r),!0};function nu(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return k.between(r,i)}var ru=(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:c,commands:l,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=V(e,o.schema),m=V(t,o.schema),{selection:h,storedMarks:g}=o,{$from:_,$to:v}=h,y=_.blockRange(v),b=g||h.$to.parentOffset&&h.$from.marks();if(!y)return!1;let x=Zc(e=>Pl(e.type.name,d))(h),S=h.from===0&&h.to===o.doc.content.size,C=o.doc.content.content,ee=C.length===1?C[0]:null,te=S&&ee&&Pl(ee.type.name,d)?{node:ee,pos:0,depth:0}:null,ne=x??te,re=!!x&&y.depth>=1&&y.depth-x.depth<=1,ie=!!te;if((re||ie)&&ne){if(ne.node.type===p)return S&&ie?c().command(({tr:e,dispatch:t})=>{let n=nu(e);return n?(e.setSelection(n),t&&t(e),!0):!1}).liftListItem(m).run():l.liftListItem(m);if(Pl(ne.node.type.name,d)&&p.validContent(ne.node.content))return c().command(()=>(a.setNodeMarkup(ne.pos,p),!0)).command(()=>eu(a,p)).command(()=>tu(a,p)).run()}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>eu(a,p)).command(()=>tu(a,p)).run():c().command(()=>{let e=u().wrapInList(p,r),t=b.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),e?!0:l.clearNodes()}).wrapInList(p,r).command(()=>eu(a,p)).command(()=>tu(a,p)).run()},iu=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=Zs(e,r.schema);return kl(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},au=(e,t,n={})=>({state:r,commands:i})=>{let a=V(e,r.schema),o=V(t,r.schema),s=Ac(r,a,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(o,c):i.setNode(a,{...c,...n})},ou=(e,t={})=>({state:n,commands:r})=>{let i=V(e,n.schema);return Ac(n,i,t)?r.lift(i):r.wrapIn(i,t)},su=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i=n[r],a;if(i.spec.isInputRules&&(a=i.getState(e))){if(t){let t=e.tr,n=a.transform;for(let e=n.steps.length-1;e>=0;--e)t.step(n.steps[e].invert(n.docs[e]));if(a.text){let n=t.doc.resolve(a.from).marks();t.replaceWith(a.from,a.to,e.schema.text(a.text,n))}else t.delete(a.from,a.to)}return!0}}return!1},cu=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{ignoreClearable:i=!1}=e,{selection:a}=t,{empty:o,ranges:s}=a;if(o)return!0;let{nonClearableMarks:c}=r.extensionManager;if(n){let e=Object.values(r.schema.marks).filter(e=>i||!c.includes(e.name));s.forEach(n=>{for(let r of e)t.removeMark(n.$from.pos,n.$to.pos,r)})}return!0},lu=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=Zs(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=Xs(c,s,c.marks().find(e=>e.type===s)?.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},uu=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e==`number`?(a=e,o=e):e&&`from`in e&&`to`in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},du=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=Fc(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=V(e,r.schema)),s===`mark`&&(o=Zs(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{let s=e.$from.pos,l=e.$to.pos,u,d,f,p;n.selection.empty?r.doc.nodesBetween(s,l,(e,t)=>{a&&a===e.type&&(c=!0,f=Math.max(t,s),p=Math.min(t+e.nodeSize,l),u=t,d=e)}):r.doc.nodesBetween(s,l,(e,r)=>{r<s&&a&&a===e.type&&(c=!0,f=Math.max(r,s),p=Math.min(r+e.nodeSize,l),u=r,d=e),r>=s&&r<=l&&(a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type&&(c=!0,i)){let i=Math.max(r,s),c=Math.min(r+e.nodeSize,l);n.addMark(i,c,o.create({...a.attrs,...t}))}}))}),d&&(u!==void 0&&i&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),o&&d.marks.length&&d.marks.forEach(e=>{o===e.type&&i&&n.addMark(f,p,o.create({...e.attrs,...t}))}))}),c},fu=new A(`__tiptap_decorations__`),pu=e=>({tr:t,dispatch:n})=>(n&&t.setMeta(fu,{type:`force`,name:e}),!0),mu=(e,t={})=>({state:n,dispatch:r})=>hn(V(e,n.schema),t)(n,r),hu=(e,t={})=>({state:n,dispatch:r})=>Sn(V(e,n.schema),t)(n,r),gu=Lt({blur:()=>js,clearContent:()=>Ms,clearNodes:()=>Ns,command:()=>Ps,createParagraphNear:()=>Fs,cut:()=>Is,deleteCurrentNode:()=>Ls,deleteNode:()=>Rs,deleteRange:()=>zs,deleteSelection:()=>Us,enter:()=>Ws,exitCode:()=>Gs,extendMarkRange:()=>Qs,first:()=>$s,focus:()=>oc,forEach:()=>sc,insertContent:()=>cc,insertContentAt:()=>hc,insertDefaultBlock:()=>_c,joinBackward:()=>bc,joinDown:()=>yc,joinForward:()=>xc,joinItemBackward:()=>Cc,joinItemForward:()=>wc,joinTextblockBackward:()=>Tc,joinTextblockForward:()=>Ec,joinUp:()=>vc,keyboardShortcut:()=>kc,lift:()=>jc,liftEmptyBlock:()=>Mc,liftListItem:()=>Nc,newlineInCode:()=>Pc,resetAttributes:()=>Lc,scrollIntoView:()=>Rc,selectAll:()=>zc,selectNodeBackward:()=>Bc,selectNodeForward:()=>Vc,selectParentNode:()=>Hc,selectTextblockEnd:()=>Uc,selectTextblockStart:()=>Wc,setContent:()=>Kc,setMark:()=>Hl,setMeta:()=>Ul,setNode:()=>Wl,setNodeSelection:()=>Gl,setTextDirection:()=>Kl,setTextSelection:()=>ql,sinkListItem:()=>Jl,splitBlock:()=>Xl,splitListItem:()=>Zl,toggleList:()=>ru,toggleMark:()=>iu,toggleNode:()=>au,toggleWrap:()=>ou,undoInputRule:()=>su,unsetAllMarks:()=>cu,unsetMark:()=>lu,unsetTextDirection:()=>uu,updateAttributes:()=>du,updateDecorations:()=>pu,wrapIn:()=>mu,wrapInList:()=>hu}),_u=new WeakMap;function vu(e,t){_u.set(e,(_u.get(e)??0)+1);try{return t()}finally{let t=(_u.get(e)??1)-1;t>0?_u.set(e,t):_u.delete(e)}}function yu(e){return _u.has(e)}var bu=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},xu=typeof process<`u`&&!1;function Su(e){return e.kind===`widget`}function Cu(e,t){let n=[],r=new Set;for(let i of e)i.kind===`widget`&&Su(i)&&r.add(i.key),n.push(i.toPMDecoration(t));return{decorations:n,widgetKeys:r}}function wu(e,t,n){let{decorations:r,widgetKeys:i}=Cu(t,n);return{set:R.create(e,r),widgetKeys:i}}function Tu({position:e,from:t,to:n,docSize:r}){return e<t?!1:e<n||e===n&&n===r}function Eu({decorations:e,from:t,to:n,docSize:r,extensionName:i,warnedExtensions:a}){return e.filter(e=>Tu({position:e.anchor,from:t,to:n,docSize:r})?!0:(e.anchor===n||a.has(i)||(a.add(i),console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${t}, ${n}). It was ignored.`)),!1))}function Du(e){let t=e.spec?.key;return typeof t==`string`?t:void 0}function Ou(e){let t=new Map,n=new Map;for(let r of e.find()){let e=Du(r);if(!e)continue;let i=r.spec.extensionName??`unknown`,a=t.get(e)??new Set;a.add(i),t.set(e,a),n.set(e,(n.get(e)??0)+1)}return Array.from(t,([e,t])=>({key:e,extensions:t})).filter(({key:e})=>(n.get(e)??0)>1)}function ku(e){return e.jsonID===`attr`}function Au(e){let t=!1;if(e.getMap().forEach(()=>{t=!0}),t||ku(e))return!0;let n=e;return typeof n.from==`number`&&typeof n.to==`number`}function ju(e,t){let n=null,r=0,i=0;for(let a=0;a<e.childCount&&!(i>t.to);a+=1){let o=i+e.child(a).nodeSize;o>=t.from&&(n===null&&(n=i),r=o),i=o}return n===null?null:{from:n,to:r}}function Mu(e,t){if(e.steps.some(e=>!Au(e)))return{type:`full`};let n=Sl(e).map(({newRange:e})=>e);e.steps.forEach((t,r)=>{if(!ku(t))return;let i=e.mapping.slice(r);n.push({from:i.map(t.pos,-1),to:i.map(t.pos+1)})});let r=[];for(let e of n){let n=ju(t,e);n&&r.push(n)}r.sort((e,t)=>e.from-t.from);let i=[];for(let e of r){let t=i[i.length-1];t&&e.from<=t.to?t.to=Math.max(t.to,e.to):i.push({...e})}return{type:`ranges`,ranges:i}}function Nu(e,t,n,r){return e.map(t,n,{onRemove:e=>{let t=e?.key;typeof t==`string`&&r.delete(t)}})}function Pu(e,t,n){let r=t.decorationSetsByExtension[e]??R.empty,i=new Set(t.widgetKeysByExtension[e]??[]);return{set:Nu(r,n.mapping,n.doc,i),widgetKeys:i}}function Fu(e,t){let n=Object.values(t).flatMap(e=>e.find());return R.create(e,n)}function Iu(e){let t=new Set;for(let n of Object.values(e))for(let e of n)t.add(e);return t}function Lu(e,t){switch(t.update??`document`){case`document`:if(t.createInRange)throw Error(`[tiptap error]: Extension "${e}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case`changedRanges`:if(!t.createInRange)throw Error(`[tiptap error]: Extension "${e}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case`manual`:if(t.createInRange)throw Error(`[tiptap error]: Extension "${e}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(t.shouldUpdate)throw Error(`[tiptap error]: Extension "${e}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw Error(`[tiptap error]: Extension "${e}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}function Ru(e,t,n){return n?!0:e.update===`manual`?!1:e.shouldUpdate?e.shouldUpdate(t):t.tr.docChanged}var zu=new Set,Bu=class{constructor(e){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{let t=fu.getState(e);t&&this.warnDuplicateWidgetKeys(t)},this.editor=e.editor,this.entries=this.resolveEntries(e.entries),this.entries.forEach(({name:e,spec:t})=>Lu(e,t)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on(`beforeTransaction`,this.handleBeforeTransaction)}destroy(){this.editor.off(`beforeTransaction`,this.handleBeforeTransaction)}liveWidgetKeys(){return fu.getState(this.editor.state)?.widgetKeys??zu}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(e){let t=[];for(let{name:n,addDecorations:r}of e){let e=r();e&&t.push({name:n,spec:e})}return t}createPlugin(){let{editor:e,entries:t}=this;return new O({key:fu,state:{init:(e,n)=>{let r={},i={};for(let{name:e,spec:a}of t){let{set:t,widgetKeys:o}=this.buildFullSet(e,a,n);r[e]=t,i[e]=o}let a={decorationSetsByExtension:r,widgetKeysByExtension:i,mergedDecorationSet:this.buildMergedSet(n.doc,r),widgetKeys:Iu(i)};return this.warnDuplicateWidgetKeys(a),a},apply:(n,r,i,a)=>{let o=n.getMeta(fu),s=o?.type===`force`&&!o.name,c=o?.type===`force`?o.name:void 0,l={},u={},d=new Set;return vu(e,()=>{for(let{name:o,spec:f}of t){let t=s||c===o;if(!Ru(f,{editor:e,tr:n,oldState:i,newState:a},t)){let e=Pu(o,r,n);l[o]=e.set,u[o]=e.widgetKeys}else if(f.update===`changedRanges`&&n.docChanged&&!t){let e=this.applyChangedRangesRecompute(o,f,r,n,a);l[o]=e.set,u[o]=e.widgetKeys,d.add(o)}else{let{set:e,widgetKeys:t}=this.buildFullSet(o,f,a);l[o]=e,u[o]=t,d.add(o)}}}),d.size===0&&!n.docChanged?r:{decorationSetsByExtension:l,widgetKeysByExtension:u,mergedDecorationSet:this.mergeAfterApply({entries:t,previous:r,tr:n,decorationSetsByExtension:l,recomputedNames:d}),widgetKeys:Iu(u)}}},props:{decorations(e){return fu.getState(e)?.mergedDecorationSet??R.empty}}})}applyChangedRangesRecompute(e,t,n,r,i){let a=Mu(r,i.doc);return a.type===`full`?this.buildFullSet(e,t,i):this.rebuildRanges(e,t,n,r,i,a.ranges)}rebuildRanges(e,t,n,r,i,a){let o=n.decorationSetsByExtension[e]??R.empty,s=new Set(n.widgetKeysByExtension[e]??[]),c=Nu(o,r.mapping,r.doc,s),l=i.doc.content.size;for(let{from:n,to:r}of a){let a=c.find(n,r).filter(e=>Tu({position:e.from,from:n,to:r,docSize:l}));for(let e of a){let t=Du(e);t&&s.delete(t)}c=c.remove(a);let{decorations:o,widgetKeys:u}=Cu(Eu({decorations:this.runCreate(e,`createInRange`,()=>t.createInRange({editor:this.editor,state:i,view:this.mountedView,from:n,to:r})),from:n,to:r,docSize:l,extensionName:e,warnedExtensions:this.warnedOutOfRangeExtensions}),e);c=c.add(i.doc,o);for(let e of u)s.add(e)}return{set:c,widgetKeys:s}}buildFullSet(e,t,n){let r=this.runCreate(e,`create`,()=>t.create({editor:this.editor,state:n,view:this.mountedView}));return wu(n.doc,r,e)}runCreate(e,t,n){try{return n()}catch(n){return console.error(`[tiptap error]: Extension "${e}" threw in \`addDecorations().${t}()\`. Its decorations were dropped for this update.`,n),[]}}warnDuplicateWidgetKeys(e){if(!xu)return;if(e.widgetKeys.size===0){this.warnedWidgetKeys.clear();return}let t=Ou(e.mergedDecorationSet),n=new Set(t.map(({key:e})=>e));for(let{key:e,extensions:n}of t){if(this.warnedWidgetKeys.has(e))continue;let t=Array.from(n).map(e=>`"${e}"`).join(`, `);console.warn(`[tiptap warn]: Duplicate widget decoration key "${e}" in extension${n.size===1?``:`s`} ${t}. Widget decoration keys must be globally unique, otherwise ProseMirror misplaces the widget DOM. Use a stable, unique key (e.g. \`comment-\${id}\`).`)}this.warnedWidgetKeys=n}buildMergedSet(e,t){let n=Object.keys(t);return n.length===1?t[n[0]]:Fu(e,t)}mergeAfterApply({entries:e,previous:t,tr:n,decorationSetsByExtension:r,recomputedNames:i}){return e.length===1?r[e[0].name]:i.size===0?t.mergedDecorationSet.map(n.mapping,n.doc):Fu(n.doc,r)}};function Vu(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof E){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;--i}return!1}function Hu(e,t,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:``}]`);if(r!==null)return r;let i=document.createElement(`style`);return t&&i.setAttribute(`nonce`,t),i.setAttribute(`data-tiptap-style${n?`-${n}`:``}`,``),i.innerHTML=e,document.getElementsByTagName(`head`)[0].appendChild(i),i}function Uu(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)}function Wu(e){return typeof e==`number`}function Gu(e){return Object.prototype.toString.call(e).slice(8,-1)}function Ku(e){return Gu(e)===`Object`&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function qu(e){return typeof e==`string`&&e.trim().length>0&&!/[;{}]/.test(e)}function Ju(e,t,n){let r=e.split(`
|
|
9
|
-
`),i=[],a=``,o=0,s=t.baseIndentSize||2;for(;o<r.length;){let e=r[o],u=e.match(t.itemPattern);if(!u){if(i.length>0)break;if(e.trim()===``){o+=1,a=`${a}${e}\n`;continue}return}let d=t.extractItemData(u),{indentLevel:f,mainContent:p}=d;a=`${a}${e}\n`;let m=[p];for(o+=1;o<r.length;){var c;let e=r[o];if(e.trim()===``){var l;let t=r.slice(o+1).findIndex(e=>e.trim()!==``);if(t===-1)break;if((((l=r[o+1+t].match(/^(\s*)/))==null||(l=l[1])==null?void 0:l.length)||0)>f){m.push(e),a=`${a}${e}\n`,o+=1;continue}break}if((((c=e.match(/^(\s*)/))==null||(c=c[1])==null?void 0:c.length)||0)>f)m.push(e),a=`${a}${e}\n`,o+=1;else break}let h,g=m.slice(1);if(g.length>0){let e=g.map(e=>e.slice(f+s)).join(`
|
|
10
|
-
`);e.trim()&&(h=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}let _=t.createToken(d,h);i.push(_)}if(i.length!==0)return{items:i,raw:a}}var Yu=4;function Xu(e){let t=0;for(let n of e)t=n===` `?t+Yu-t%Yu:t+1;return t}function Zu(e,t,n,r,i){if(!e||!Array.isArray(e.content))return``;let a=typeof n==`function`?n(r):n,[o,...s]=e.content,c=`${a}${t.renderChildren([o])}`;return s&&s.length>0&&s.forEach((e,n)=>{let r=t.renderChild?.call(t,e,n+1)??t.renderChildren([e]);if(r!=null){let n=e=>{if(!i?.alignNestedToPrefix)return t.indent(e);let n=t.indent(``),r=Xu(a);return(Xu(n)>=r?n:` `.repeat(r))+e},o=r.split(`
|
|
11
|
-
`).map(e=>n(e||``)).join(`
|
|
12
|
-
`);c+=e.type===`paragraph`?`\n\n${o}`:`\n${o}`}}),c}function Qu(e,t){let n={...e};return Ku(e)&&Ku(t)&&Object.keys(t).forEach(r=>{Ku(t[r])&&Ku(e[r])?n[r]=Qu(e[r],t[r]):n[r]=t[r]}),n}function $u(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants((t,r)=>{let i=a.mapping.map(r),s=a.mapping.map(r)+t.nodeSize,c=null;if(t.marks.forEach(e=>{if(e!==o)return!1;c=e}),!c)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==c.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});a.removeMark(i,s,e.type),a.addMark(i,s,t)}}),a.docChanged&&t.view.dispatch(a)}var ed=class{constructor(e){this.find=e.find,this.handler=e.handler,this.undoable=e.undoable??!0}},td=(e,t)=>{if(Ks(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn(`[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".`),r.push(n.replaceWith)),r};function nd(e){let{editor:t,from:n,to:r,text:i,insertText:a}=e;if(!a)return{inputTransaction:null,tr:t.view.state.tr};let o=t.view.state.tr.insertText(i,n,r);return{inputTransaction:o,tr:ze.create({doc:o.doc,selection:o.selection,storedMarks:o.storedMarks}).tr}}function rd(e){let{editor:t,from:n,to:r,text:i,rule:a,match:o,plugin:s,insertText:c}=e,{view:l}=t,{inputTransaction:u,tr:d}=nd({editor:t,from:n,to:r,text:i,insertText:c}),f=u?n+i.length:r,p=ks({state:l.state,transaction:d}),m={from:n-(o[0].length-i.length),to:f},{commands:h,chain:g,can:_}=new As({editor:t,state:p});return a.handler({state:p,range:m,match:o,commands:h,chain:g,can:_})===null||!d.steps.length?!1:u&&(l.dispatch(u),!l.state.doc.eq(u.doc))?!0:(xs(d),d.setMeta(`inputRule`,!0),a.undoable&&d.setMeta(s,{transform:d,from:n,to:f,text:i}),l.dispatch(d),!0)}function id(e,t,n){let r=t[0].length-n.length;if(r<=0)return!0;let i=e.parentOffset-r;return i>=0&&e.parent.textBetween(i,e.parentOffset)===t[0].slice(0,r)}function ad(e){let{editor:t,from:n,to:r,text:i,rules:a,plugin:o,insertText:s}=e,{view:c}=t;if(c.composing)return!1;let l=c.state.doc.resolve(n);if(l.parent.type.spec.code||(l.nodeBefore||l.nodeAfter)?.marks.find(e=>e.type.spec.code))return!1;let u=Ol(l)+i;for(let e of a){let a=td(u,e.find);if(a&&id(l,a,i)&&rd({editor:t,from:n,to:r,text:i,rule:e,match:a,plugin:o,insertText:s}))return!0}return!1}function od(e){let{editor:t,rules:n}=e,r=new O({state:{init(){return null},apply(e,i,a){let o=e.getMeta(r);if(o)return o;let s=e.getMeta(`applyInputRules`);return s&&setTimeout(()=>{let{text:e}=s;e=typeof e==`string`?e:$c(T.from(e),a.schema);let{from:i}=s,o=i+e.length;ad({editor:t,from:i,to:o,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput(e,i,a,o){return ad({editor:t,from:i,to:a,text:o,rules:n,plugin:r,insertText:!0})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&ad({editor:t,from:i.pos,to:i.pos,text:``,rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if(i.key!==`Enter`)return!1;let{$cursor:a}=e.state.selection;return a?ad({editor:t,from:a.pos,to:a.pos,text:`
|
|
13
|
-
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var sd=class{constructor(e={}){this.type=`extendable`,this.parent=null,this.child=null,this.name=``,this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...U(H(this,`addOptions`,{name:this.name}))}}get storage(){return{...U(H(this,`addStorage`,{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>Qu(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name=`name`in e?e.name:t.parent.name,t}},cd=class e extends sd{constructor(...e){super(...e),this.type=`mark`}static create(t={}){let n=typeof t==`function`?t():t;return new e(n)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>e?.type.name===t.name))return!1;let a=i.find(e=>e?.type.name===t.name);return a&&n.removeStoredMark(a),n.insertText(` `,r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},ld=class{constructor(e){this.find=e.find,this.handler=e.handler}},ud=(e,t,n)=>{if(Ks(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn(`[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".`),n.push(t.replaceWith)),n}):[]};function dd(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new As({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{var f;if((f=e.type)!=null&&(f=f.spec)!=null&&f.code||!(e.isText||e.isTextblock||e.isInline))return;let p=e.content?.size??e.nodeSize??0,m=Math.max(r,t),h=Math.min(i,t+p);m>=h||ud(e.isText?e.text||``:e.textBetween(m-t,h-t,void 0,``),a.find,o).forEach(e=>{if(e.index===void 0)return;let t=m+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},f=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(f)})}),d.every(e=>e!==null)}var fd=null,pd=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n};function md(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,s;try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}let c=({state:e,from:n,to:r,rule:i,pasteEvt:a})=>{let c=e.tr,l=ks({state:e,transaction:c});if(dd({editor:t,state:l,from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:a,dropEvent:s})&&c.steps.length){try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}return o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,c}};return t.on(`destroy`,()=>{fd===t&&(fd=null)}),n.map(e=>new O({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&(fd=t)},i=()=>{fd&&=null};return window.addEventListener(`dragstart`,n),window.addEventListener(`dragend`,i),{destroy(){window.removeEventListener(`dragstart`,n),window.removeEventListener(`dragend`,i)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(a=r===e.dom.parentElement,s=t,!a){let e=fd;e?.isEditable&&setTimeout(()=>{if(e.isDestroyed)return;let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{let n=t.clipboardData?.getData(`text/html`);return o=t,i=!!n?.includes(`data-pm-slice`),!1}}},appendTransaction:(t,n,r)=>{let s=t[0],l=s.getMeta(`uiEvent`)===`paste`&&!i,u=s.getMeta(`uiEvent`)===`drop`&&!a,d=s.getMeta(`applyPasteRules`),f=!!d;if(!l&&!u&&!f)return;if(f){let{text:t}=d;t=typeof t==`string`?t:$c(T.from(t),r.schema);let{from:n}=d,i=n+t.length,a=pd(t);return c({rule:e,state:r,from:n,to:{b:i},pasteEvt:a})}let p=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);if(Wu(p)&&m&&p!==m.b)return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}var hd=class{constructor(e,t){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=t,this.baseExtensions=e,this.extensions=ml(e),this.schema=dl(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=H(t,`addCommands`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:El(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this,t=pl([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:El(t.name,this.schema)},r=[],i=H(t,`addKeyboardShortcuts`,n),a={};if(t.type===`mark`&&H(t,`exitable`,n)&&(a.ArrowRight=()=>cd.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}let o=ts(a);r.push(o);let s=H(t,`addInputRules`,n);if(Nl(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let n=od({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let c=H(t,`addPasteRules`,n);if(Nl(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=md({editor:e,rules:t});r.push(...n)}}let l=H(t,`addProseMirrorPlugins`,n);if(l){let e=l();r.push(...e)}return r}),n=this.createDecorationPlugin();return n&&t.push(n),t}createDecorationPlugin(){var e;let{editor:t}=this;(e=this.decorationManager)==null||e.destroy();let n=[];return this.extensions.forEach(e=>{let r=H(e,`addDecorations`,{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:El(e.name,this.schema)});r&&n.push({name:e.name,addDecorations:r})}),this.decorationManager=new Bu({editor:t,entries:n}),this.decorationManager.plugin}get attributes(){return rl(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=nl(this.extensions);return Object.fromEntries(t.filter(e=>!!H(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=H(t,`addNodeView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:V(t.name,this.schema)});if(!r)return[];let i=r();return i?[t.name,(r,a,o,s,c)=>{let l=ol(r,n);return i({node:r,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:l})}]:[]}))}dispatchTransaction(e){let{editor:t}=this;return pl([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:El(n.name,this.schema)},i=H(n,`dispatchTransaction`,r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return pl([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:El(n.name,this.schema)},i=H(n,`transformPastedHTML`,r);return i?(t,n)=>{let a=e(t,n);return i.call(r,a)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=nl(this.extensions);return Object.fromEntries(t.filter(e=>!!H(e,`addMarkView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=H(t,`addMarkView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Zs(t.name,this.schema)});return r?[t.name,(i,a,o)=>{let s=ol(i,n);return r()({mark:i,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{$u(i,e,t)}})}]:[]}))}destroy(){var e;(e=this.decorationManager)==null||e.destroy(),this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:El(e.name,this.schema)};e.type===`mark`&&((U(H(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name),(U(H(e,`clearable`,t))??!0)||this.nonClearableMarks.push(e.name));let n=H(e,`onBeforeCreate`,t),r=H(e,`onCreate`,t),i=H(e,`onUpdate`,t),a=H(e,`onSelectionUpdate`,t),o=H(e,`onTransaction`,t),s=H(e,`onFocus`,t),c=H(e,`onBlur`,t),l=H(e,`onDestroy`,t);n&&this.editor.on(`beforeCreate`,n),r&&this.editor.on(`create`,r),i&&this.editor.on(`update`,i),a&&this.editor.on(`selectionUpdate`,a),o&&this.editor.on(`transaction`,o),s&&this.editor.on(`focus`,s),c&&this.editor.on(`blur`,c),l&&this.editor.on(`destroy`,l)})}};hd.resolve=ml,hd.sort=pl,hd.flatten=Qc;var G=class e extends sd{constructor(...e){super(...e),this.type=`extension`}static create(t={}){let n=typeof t==`function`?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},gd=G.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new O({key:new A(`clipboardTextSerializer`),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,a=_l(n),{blockSeparator:o}=this.options,s={...o===void 0?{}:{blockSeparator:o},textSerializers:a};return[...i.ranges].sort((e,t)=>e.$from.pos-t.$from.pos).map(({$from:e,$to:t})=>hl(r,{from:e.pos,to:t.pos},s)).join(o??`
|
|
14
|
-
|
|
15
|
-
`)}}})]}}),_d=G.create({name:`commands`,addCommands(){return{...gu}}}),vd=G.create({name:`delete`,onUpdate({transaction:e,appendedTransactions:t}){var n;let r=()=>{var n,r;if(((n=this.editor.options.coreExtensionOptions)==null||(n=n.delete)==null||(r=n.filterTransaction)==null?void 0:r.call(n,e))??e.getMeta(`y-sync$`))return;let i=Jc(e.before,[e,...t]);Sl(i).forEach(t=>{i.mapping.mapResult(t.oldRange.from).deletedAfter&&i.mapping.mapResult(t.oldRange.to).deletedBefore&&i.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{let a=r+n.nodeSize-2,o=t.oldRange.from<=r&&a<=t.oldRange.to;this.editor.emit(`delete`,{type:`node`,node:n,from:r,to:a,newFrom:i.mapping.map(r),newTo:i.mapping.map(a),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:i})})});let a=i.mapping;i.steps.forEach((t,n)=>{if(t instanceof je){let r=a.slice(n).map(t.from,-1),o=a.slice(n).map(t.to),s=a.invert().map(r,-1),c=a.invert().map(o),l=r>0&&i.doc.nodeAt(r-1)?.marks.some(e=>e.eq(t.mark)),u=i.doc.nodeAt(o)?.marks.some(e=>e.eq(t.mark));this.editor.emit(`delete`,{type:`mark`,mark:t.mark,from:t.from,to:t.to,deletedRange:{from:s,to:c},newRange:{from:r,to:o},partial:!!(u||l),editor:this.editor,transaction:e,combinedTransform:i})}})};((n=this.editor.options.coreExtensionOptions)==null||(n=n.delete)==null?void 0:n.async)??!0?setTimeout(r,0):r()}}),yd=G.create({name:`drop`,addProseMirrorPlugins(){return[new O({key:new A(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),bd=G.create({name:`editable`,addProseMirrorPlugins(){return[new O({key:new A(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),xd=new A(`focusEvents`),Sd=G.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new O({key:xd,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta(`focus`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta(`blur`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1}}}})]}}),Cd=G.create({name:`keymap`,addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:a}=n,{pos:o,parent:s}=a,c=a.parent.isTextblock&&o>0?t.doc.resolve(o-1):a,l=c.parent.type.spec.isolating,u=a.pos-a.parentOffset,d=l&&c.parent.childCount===1?u===a.pos:D.atStart(r).from===o;return!i||!s.type.isTextblock||s.textContent.length||!d||d&&a.parent.type.name===`paragraph`?!1:e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ic()||Dc()?i:r},addProseMirrorPlugins(){return[new O({key:new A(`clearDocument`),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta(`composition`)))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta(`preventClearDocument`));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,c=D.atStart(t.doc).from,l=D.atEnd(t.doc).to;if(a||o!==c||s!==l||!Fl(n.doc))return;let u=n.tr,d=ks({state:n,transaction:u}),{commands:f}=new As({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),wd=G.create({name:`paste`,addProseMirrorPlugins(){return[new O({key:new A(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),Td=G.create({name:`tabindex`,addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new O({key:new A(`tabindex`),props:{attributes:()=>!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:this.options.value??`0`}}})]}}),Ed=G.create({name:`textDirection`,addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=nl(this.extensions);return[{types:e.filter(e=>e.name!==`text`).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute(`dir`);return t&&(t===`ltr`||t===`rtl`||t===`auto`)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new O({key:new A(`textDirection`),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),Dd=!1;function Od(e){if(Dd)return;Dd=!0;let t;try{t=Ee.fromJSON(e,{from:0,to:0}).slice.content}catch{return}t instanceof T||console.warn(`[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.`)}var kd=class e{get name(){return this.node.type.name}constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){return this.actualDepth??this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(this.depth===0)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new e(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,s=this.pos+r+ +!a;if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let c=this.resolvedPos.doc.resolve(s);if(!i&&!o&&c.depth<=this.depth)return;let l=new e(c,this.editor,i,i||o?n:null);i&&(l.actualDepth=this.depth+1),t.push(l)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e){if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r}r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||this.children.length===0)return r;let i=Object.keys(t);return this.children.forEach(a=>{n&&r.length>0||(a.node.type.name===e&&i.every(e=>t[e]===a.node.attrs[e])&&r.push(a),!(n&&r.length>0)&&(r=r.concat(a.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},Ad=`.ProseMirror {
|
|
16
|
-
position: relative;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.ProseMirror {
|
|
20
|
-
word-wrap: break-word;
|
|
21
|
-
white-space: pre-wrap;
|
|
22
|
-
white-space: break-spaces;
|
|
23
|
-
-webkit-font-variant-ligatures: none;
|
|
24
|
-
font-variant-ligatures: none;
|
|
25
|
-
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.ProseMirror [contenteditable="false"] {
|
|
29
|
-
white-space: normal;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
33
|
-
white-space: pre-wrap;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.ProseMirror pre {
|
|
37
|
-
white-space: pre-wrap;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
img.ProseMirror-separator {
|
|
41
|
-
display: inline !important;
|
|
42
|
-
border: none !important;
|
|
43
|
-
margin: 0 !important;
|
|
44
|
-
width: 0 !important;
|
|
45
|
-
height: 0 !important;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.ProseMirror-gapcursor {
|
|
49
|
-
display: none;
|
|
50
|
-
pointer-events: none;
|
|
51
|
-
position: absolute;
|
|
52
|
-
margin: 0;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.ProseMirror-gapcursor:after {
|
|
56
|
-
content: "";
|
|
57
|
-
display: block;
|
|
58
|
-
position: absolute;
|
|
59
|
-
top: -2px;
|
|
60
|
-
width: 20px;
|
|
61
|
-
border-top: 1px solid black;
|
|
62
|
-
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
@keyframes ProseMirror-cursor-blink {
|
|
66
|
-
to {
|
|
67
|
-
visibility: hidden;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.ProseMirror-hideselection *::selection {
|
|
72
|
-
background: transparent;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.ProseMirror-hideselection *::-moz-selection {
|
|
76
|
-
background: transparent;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.ProseMirror-hideselection * {
|
|
80
|
-
caret-color: transparent;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
84
|
-
display: block;
|
|
85
|
-
}`,jd=class extends bu{constructor(e={}){super(),this.css=null,this.className=`tiptap`,this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:typeof document<`u`?document.createElement(`div`):null,content:``,injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Rl,createMappablePosition:zl},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on(`beforeCreate`,this.options.onBeforeCreate),this.emit(`beforeCreate`,{editor:this}),this.on(`mount`,this.options.onMount),this.on(`unmount`,this.options.onUnmount),this.on(`contentError`,this.options.onContentError),this.on(`create`,this.options.onCreate),this.on(`update`,this.options.onUpdate),this.on(`selectionUpdate`,this.options.onSelectionUpdate),this.on(`transaction`,this.options.onTransaction),this.on(`focus`,this.options.onFocus),this.on(`blur`,this.options.onBlur),this.on(`destroy`,this.options.onDestroy),this.on(`drop`,({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on(`paste`,({event:e,slice:t})=>this.options.onPaste(e,t)),this.on(`delete`,this.options.onDelete);let t=this.createDoc();if(!this.editorState){let e=nc(t,this.options.autofocus);this.editorState=ze.create({doc:t,schema:this.schema,selection:e||void 0})}Od(this.schema),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>`u`)throw Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);this.createView(e),this.emit(`mount`,{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit(`create`,{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;let e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove==`function`?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn(`Failed to remove CSS element:`,e)}this.css=null,this.emit(`unmount`,{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():As.createFakeChain()}can(){return this.commandManager?this.commandManager.can():As.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<`u`&&(this.css=Hu(Ad,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps({...this.options.editorProps,attributes:this.getEditorViewAttributes()}),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit(`update`,{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t===`state`)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return xu&&!this.hasWarnedStaleDecorationRead&&yu(this)&&(this.hasWarnedStaleDecorationRead=!0,console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")),this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=el(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t=typeof e==`string`?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;let n=[...this.options.enableCoreExtensions?[bd,gd.configure({blockSeparator:(e=this.options.coreExtensionOptions)==null||(e=e.clipboardTextSerializer)==null?void 0:e.blockSeparator}),_d,Sd,Cd,Td.configure({value:(t=this.options.coreExtensionOptions)==null||(t=t.tabindex)==null?void 0:t.value}),yd,wd,vd,Ed.configure({direction:this.options.textDirection})].filter(e=>typeof this.options.enableCoreExtensions!=`object`||this.options.enableCoreExtensions[e.name]!==!1):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e?.type));this.extensionManager=new hd(n,this)}createCommandManager(){this.commandManager=new As({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Gc(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||![`[tiptap error]: Invalid JSON content`,`[tiptap error]: Invalid HTML content`].includes(e.message))throw e;let t=Gc(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=ze.create({doc:t,schema:this.schema,selection:nc(t,this.options.autofocus)||void 0}),this.emit(`contentError`,{editor:this,error:e,disableCollaboration:()=>{`collaboration`in this.storage&&typeof this.storage.collaboration==`object`&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>e.name!==`collaboration`),this.createExtensionManager()}}),this.editorState.doc}return e}getEditorViewAttributes(){let e=this.options.editorProps?.attributes;return el(e)?t=>({role:`textbox`,...e(t)}):{role:`textbox`,...e}}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,a=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new Ho(e,{...t,attributes:this.getEditorViewAttributes(),dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();let c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>this.capturedTransaction?.step(e));return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),a=this.state;if(this.emit(`beforeTransaction`,{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit(`transaction`,{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit(`selectionUpdate`,{editor:this,transaction:e});let o=n.findLast(e=>e.getMeta(`focus`)||e.getMeta(`blur`)),s=o?.getMeta(`focus`),c=o?.getMeta(`blur`);s&&this.emit(`focus`,{editor:this,event:s.event,transaction:o}),c&&this.emit(`blur`,{editor:this,event:c.event,transaction:o}),!(e.getMeta(`preventUpdate`)||!n.some(e=>e.docChanged)||a.doc.eq(t.doc))&&this.emit(`update`,{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return yl(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return Al(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return $c(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=`
|
|
86
|
-
|
|
87
|
-
`,textSerializers:n={}}=e||{};return gl(this.state.doc,{blockSeparator:t,textSerializers:{..._l(this.schema),...n}})}get isEmpty(){return Fl(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit(`destroy`),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText&&t.nodeAfter.isAtom?t.nodeAfter:null;return new kd(t,this,!1,n)}get $doc(){return this.$pos(0)}};function Md(e){return new ed({find:e.find,handler:({state:t,range:n,match:r})=>{let i=U(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(Cl(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function Nd(e){return new ed({find:e.find,handler:({state:t,range:n,match:r})=>{let i=U(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function Pd(e){return new ed({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=U(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function Fd(e){return new ed({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=U(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&we(s,e.type,a);if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&We(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}var K=class e extends sd{constructor(...e){super(...e),this.type=`node`}static create(t={}){let n=typeof t==`function`?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},Id=class{constructor(e,t,n){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=()=>{try{return t.getPos()}catch{return}},this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){let{view:t}=this.editor,n=e.target,r=n.nodeType===3?n.parentElement?.closest(`[data-drag-handle]`):n.closest(`[data-drag-handle]`);if(!this.dom||this.contentDOM?.contains(n)||!r)return;let i=0,a=0;if(this.dom!==r){let t=this.dom.getBoundingClientRect(),n=r.getBoundingClientRect(),o=e.offsetX??e.nativeEvent?.offsetX,s=e.offsetY??e.nativeEvent?.offsetY;i=n.x-t.x+o,a=n.y-t.y+s}let o=this.dom.cloneNode(!0);try{let e=this.dom.getBoundingClientRect();o.style.width=`${Math.round(e.width)}px`,o.style.height=`${Math.round(e.height)}px`,o.style.boxSizing=`border-box`,o.style.pointerEvents=`none`}catch{}let s=null;try{var c;s=document.createElement(`div`),s.style.position=`absolute`,s.style.top=`-9999px`,s.style.left=`-9999px`,s.style.pointerEvents=`none`,s.appendChild(o),document.body.appendChild(s),(c=e.dataTransfer)==null||c.setDragImage(o,i,a)}finally{s&&setTimeout(()=>{try{s?.remove()}catch{}},0)}let l=this.getPos();if(typeof l!=`number`)return;let u=E.create(t.state.doc,l),d=t.state.tr.setSelection(u);t.dispatch(d)}stopEvent(e){if(!this.dom)return!1;if(typeof this.options.stopEvent==`function`)return this.options.stopEvent({event:e});let t=e.target;if(!this.dom.contains(t)||this.contentDOM?.contains(t))return!1;let n=e.type.startsWith(`drag`),r=e.type===`dragover`||e.type===`dragenter`,i=e.type===`drop`;if(([`INPUT`,`BUTTON`,`SELECT`,`TEXTAREA`].includes(t.tagName)||t.isContentEditable)&&!i&&!n)return!0;let{isEditable:a}=this.editor,{isDragging:o}=this,s=!!this.node.type.spec.draggable,c=E.isSelectable(this.node),l=e.type===`copy`,u=e.type===`paste`,d=e.type===`cut`,f=e.type===`mousedown`;if(!s&&c&&n&&e.target===this.dom&&e.preventDefault(),s&&n&&!o&&e.target===this.dom)return e.preventDefault(),!1;if(s&&a&&!o&&f){let e=t.closest(`[data-drag-handle]`);e&&(this.dom===e||this.dom.contains(e))&&(this.isDragging=!0,document.addEventListener(`dragend`,()=>{this.isDragging=!1},{once:!0}),document.addEventListener(`drop`,()=>{this.isDragging=!1},{once:!0}),document.addEventListener(`mouseup`,()=>{this.isDragging=!1},{once:!0}))}return!(o||r||i||l||u||d||f&&c)}ignoreMutation(e){return this.dom?this.contentDOM?typeof this.options.ignoreMutation==`function`?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type===`selection`||this.contentDOM.contains(e.target)&&e.type===`childList`&&(ic()||rc())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable)?!1:this.contentDOM===e.target&&e.type===`attributes`||!this.contentDOM.contains(e.target):e.type!==`selection`:!0}updateAttributes(e){this.editor.commands.command(({tr:t})=>{let n=this.getPos();return typeof n==`number`&&(t.setNodeMarkup(n,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){let e=this.getPos();if(typeof e!=`number`)return;let t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function Ld(e){return new ld({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=U(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(Cl(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>u).length)return null;d<n.to&&o.delete(d,n.to),u>n.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}var{getOwnPropertyNames:Rd,getOwnPropertySymbols:zd}=Object,{hasOwnProperty:Bd}=Object.prototype;function Vd(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function Hd(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function Ud(e){return e?.[Symbol.toStringTag]}function Wd(e){return Rd(e).concat(zd(e))}var Gd=Object.hasOwn||((e,t)=>Bd.call(e,t));function Kd(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var qd=`__v`,Jd=`__o`,Yd=`_owner`,Xd=typeof Float16Array<`u`,{getOwnPropertyDescriptor:Zd,keys:Qd}=Object;function $d(e,t){return e.byteLength===t.byteLength&&pf(new Uint8Array(e),new Uint8Array(t))}function ef(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-->0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function tf(e,t){return e.byteLength===t.byteLength&&pf(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function nf(e,t){return Kd(e.getTime(),t.getTime())}function rf(e,t,n){return e.name===t.name&&e.message===t.message&&e.stack===t.stack&&n.equals(e.cause,t.cause,`cause`,`cause`,e,t,n)}function af(e,t){return e===t}function of(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var sf=Kd;function cf(e,t,n){let r=Qd(e),i=r.length;if(Qd(t).length!==i)return!1;for(;i-->0;)if(!_f(e,t,n,r[i]))return!1;return!0}function lf(e,t,n){let r=Wd(e),i=r.length;if(Wd(t).length!==i)return!1;let a,o,s;for(;i-->0;)if(a=r[i],!_f(e,t,n,a)||(o=Zd(e,a),s=Zd(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function uf(e,t){return Kd(e.valueOf(),t.valueOf())}function df(e,t){return e.source===t.source&&e.flags===t.flags}function ff(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function pf(e,t){let n=e.length;if(t.length!==n||e.byteOffset!==t.byteOffset)return!1;if(e instanceof Float64Array||e instanceof Float32Array||Xd&&e instanceof Float16Array){for(;n-->0;)if(e[n]!==t[n]&&(e[n]===e[n]||t[n]===t[n]))return!1;return!0}for(;n-->0;)if(e[n]!==t[n])return!1;return!0}function mf(e,t){return e.href===t.href||e.protocol===t.protocol&&e.username===t.username&&e.password===t.password&&e.host===t.host&&e.pathname===t.pathname&&e.hash===t.hash&&hf(e.searchParams,t.searchParams)}function hf(e,t){let n=e.toString(),r=t.toString();return n===r||gf(n)===gf(r)}function gf(e){return e.split(`&`).sort().join(`&`)}function _f(e,t,n,r){return(r===Yd||r===Jd||r===qd)&&(e.$$typeof||t.$$typeof)?!0:Gd(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var vf=`[object ArrayBuffer]`,yf=`[object Arguments]`,bf=`[object Boolean]`,xf=`[object DataView]`,Sf=`[object Date]`,Cf=`[object Error]`,wf=`[object Map]`,Tf=`[object Number]`,Ef=`[object Object]`,Df=`[object RegExp]`,Of=`[object Set]`,kf=`[object String]`,Af={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},jf=`[object URL]`,Mf=Object.prototype.toString;function Nf({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`&&a(h,g,_);let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);if(y==null)return c(h,g,_);let b=Mf.call(h);if(b===Sf)return r(h,g,_);if(b===Df)return u(h,g,_);if(b===wf)return o(h,g,_);if(b===Of)return d(h,g,_);if(b===Ef)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===jf)return p(h,g,_);if(b===Cf)return i(h,g,_);if(b===yf)return c(h,g,_);if(Af[b])return f(h,g,_);if(b===vf)return e(h,g,_);if(b===xf)return n(h,g,_);if(b===bf||b===Tf||b===kf)return l(h,g,_);if(m){let e=m[b];if(!e){let t=Ud(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function Pf({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:$d,areArraysEqual:n?lf:ef,areDataViewsEqual:tf,areDatesEqual:nf,areErrorsEqual:n?Vd(rf,lf):Vd(rf,cf),areFunctionsEqual:af,areMapsEqual:n?Vd(of,lf):of,areNumbersEqual:sf,areObjectsEqual:n?lf:cf,arePrimitiveWrappersEqual:uf,areRegExpsEqual:df,areSetsEqual:n?Vd(ff,lf):ff,areTypedArraysEqual:n?Vd(pf,lf):pf,areUrlsEqual:mf,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=Hd(r.areArraysEqual),t=Hd(r.areErrorsEqual),n=Hd(r.areMapsEqual),i=Hd(r.areObjectsEqual),a=Hd(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areErrorsEqual:t,areMapsEqual:n,areObjectsEqual:i,areSetsEqual:a})}return r}function Ff(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function If({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var Lf=Rf();Rf({strict:!0}),Rf({circular:!0}),Rf({circular:!0,strict:!0}),Rf({createInternalComparator:()=>Kd}),Rf({strict:!0,createInternalComparator:()=>Kd}),Rf({circular:!0,createInternalComparator:()=>Kd}),Rf({circular:!0,createInternalComparator:()=>Kd,strict:!0});function Rf(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=Nf(Pf(e));return If({circular:t,comparator:a,createState:r,equals:n?n(a):Ff(a),strict:i})}function zf(e,t){if(e.isDestroyed||t.defaultPrevented||!t.cancelable||!e.isEditable||t.inputType!==`insertParagraph`&&t.inputType!==`insertLineBreak`||!ic()&&!rc())return;let n=e.view,r=n.root,i=(r.getSelection?.call(r)??n.dom.ownerDocument.getSelection())?.anchorNode,a=(i?.nodeType===1?i:i?.parentElement)?.closest(`[data-node-view-content-react]`);if(!a||!n.dom.contains(a))return;let o=n.input.lastKeyCode;o===13&&(n.input.lastKeyCode=null),n.domObserver.forceFlush(),n.domObserver.flush();let s=new KeyboardEvent(`keydown`,{key:`Enter`,code:`Enter`,keyCode:13,shiftKey:t.inputType===`insertLineBreak`,bubbles:!0,cancelable:!0});n.someProp(`handleKeyDown`,e=>e(n,s))?(t.preventDefault(),n.input.lastIOSEnter=0,clearTimeout(n.input.lastIOSEnterFallbackTimeout)):o===13&&(n.input.lastKeyCode=o)}var Bf=new A(`reactMobileEnter`),Vf=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},Hf=({contentComponent:e})=>{let t=(0,Ft.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,M.jsx)(M.Fragment,{children:Object.values(t)})};function Uf(){let e=new Set,t={},n=!1,r=()=>{!n&&e.size&&(n=!0,queueMicrotask(()=>{n=!1,e.forEach(e=>e())}))};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(e,n){t={...t,[e]:Pt.createPortal(n.reactElement,n.element,e)},r()},removeRenderer(e){let n={...t};delete n[e],t=n,r()}}}var Wf=class extends j.Component{constructor(e){super(e),this.editorContentRef=j.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.view.dom?.parentNode){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=Uf(),e.createNodeViews(),e.registerPlugin(new O({key:Bf,props:{handleDOMEvents:{beforeinput:(t,n)=>zf(e,n)}}})),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||(e.unregisterPlugin(Bf),e.view.setProps({nodeViews:{}})),e.contentComponent=null;try{if(!e.view.dom?.parentNode)return;let t=document.createElement(`div`);t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{ref:Vf(t,this.editorContentRef),...n}),e?.contentComponent&&(0,M.jsx)(Hf,{contentComponent:e.contentComponent})]})}},Gf=(0,j.forwardRef)((e,t)=>{let n=j.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return j.createElement(Wf,{key:n,innerRef:t,...e})}),Kf=j.memo(Gf),qf=typeof window<`u`?j.useLayoutEffect:j.useEffect,Jf=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e,t=t=>{(t?.transaction===void 0||t.transaction!==e)&&(e=t?.transaction,this.transactionNumber+=1,this.subscribers.forEach(e=>e()))},n=this.editor;return n.on(`transaction`,t),n.on(`update`,t),()=>{n.off(`transaction`,t),n.off(`update`,t)}}}};function Yf(e){let[t]=(0,j.useState)(()=>new Jf(e.editor)),n=(0,kn.useSyncExternalStoreWithSelector)(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??Lf);return qf(()=>t.watch(e.editor),[e.editor,t]),(0,j.useDebugValue)(n),n}var Xf=typeof window>`u`,Zf=Xf||!!(typeof window<`u`&&window.next),Qf=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId=``,this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=e??!0;return(Xf||Zf&&e===void 0)&&(t=!1),t?this.createEditor():null}createEditor(){return new jd({...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)},onDelete:(...e)=>{var t;return(t=this.options.current).onDelete?.call(t,...e)},onMount:(...e)=>{var t;return(t=this.options.current).onMount?.call(t,...e)},onUnmount:(...e)=>{var t;return(t=this.options.current).onUnmount?.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,n)=>e===t.extensions?.[n]):e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function $f(e={},t=[]){let n=(0,j.useRef)(e);n.current=e;let[r]=(0,j.useState)(()=>new Qf(n)),i=(0,Ft.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,j.useDebugValue)(i),(0,j.useEffect)(r.onRender(t)),Yf({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&t===0?0:t+1}),i}var ep=(0,j.createContext)({editor:null});ep.Consumer;var tp=()=>(0,j.useContext)(ep),np=(0,j.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),rp=()=>(0,j.useContext)(np),ip=j.forwardRef((e,t)=>{let{onDragStart:n}=rp(),r=e.as||`div`;return(0,M.jsx)(r,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})});function ap(e){return!!(typeof e==`function`&&e.prototype&&e.prototype.isReactComponent)}function op(e){return!(typeof e!=`object`||!e.$$typeof||e.$$typeof.toString()!==`Symbol(react.forward_ref)`&&e.$$typeof.description!==`react.forward_ref`)}function sp(e){return!(typeof e!=`object`||!e.$$typeof||e.$$typeof.toString()!==`Symbol(react.memo)`&&e.$$typeof.description!==`react.memo`)}function cp(e){if(ap(e)||op(e))return!0;if(sp(e)){let t=e.type;if(t)return ap(t)||op(t)}return!1}function lp(){try{if(j.version)return parseInt(j.version.split(`.`)[0],10)>=19}catch{}return!1}var up=class{constructor(e,{editor:t,props:n={},as:r=`div`,className:i=``}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add(`react-renderer`),i&&this.element.classList.add(...i.split(` `)),this.editor.isEditorContentInitialized?(0,Pt.flushSync)(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;let t=this.component,n=this.props,r=this.editor,i=lp(),a=cp(t),o={...n};o.ref&&!(i||a)&&delete o.ref,!o.ref&&(i||a)&&(o.ref=e=>{this.ref=e}),this.reactElement=(0,M.jsx)(t,{...o}),r==null||(e=r.contentComponent)==null||e.setRenderer(this.id,this)}updateProps(e={}){if(this.destroyed)return;let t=!1,n=Object.keys(e);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==this.props[i]){t=!0;break}}t&&(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0;let t=this.editor;t==null||(e=t.contentComponent)==null||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};j.createContext({markViewContentRef:()=>{}});function dp(e){var t;let n=e.getRootNode(),r=typeof n.getSelection==`function`?n.getSelection():(t=e.ownerDocument)==null||(t=t.defaultView)==null?void 0:t.getSelection();if(!r||r.rangeCount===0)return null;let{anchorNode:i,anchorOffset:a,focusNode:o,focusOffset:s}=r;return!i||!o||!e.contains(i)||!e.contains(o)?null:()=>{try{r.setBaseAndExtent(i,a,o,s)}catch{}}}function fp(e,t,n){return e.node(n)===t.node(n)&&e.before(n)===t.before(n)}function pp(e){if(!ec(e))return[];let{$from:t,$to:n}=e,r=[],i=Math.min(t.depth,n.depth);for(let e=1;e<=i&&fp(t,n,e);e+=1)r.push(t.before(e));return r}var mp=class{constructor(e){this.views=new WeakMap,this.viewCount=0,this.insideViews=new Set,this.syncQueued=!1,this.scheduleSync=()=>{this.syncQueued||(this.syncQueued=!0,queueMicrotask(()=>{this.syncQueued=!1,this.sync()}))},this.handleTransaction=()=>this.scheduleSync(),this.editor=e}register(e){this.viewCount===0&&this.editor.on(`transaction`,this.handleTransaction),this.views.set(e.dom,e),this.viewCount+=1,this.scheduleSync()}unregister(e){this.views.delete(e.dom),--this.viewCount,this.insideViews.delete(e),this.viewCount===0&&this.editor.off(`transaction`,this.handleTransaction)}sync(){if(this.viewCount===0||this.editor.isDestroyed)return;let e=this.findInsideViews();this.updateViews(this.insideViews,e,!1),this.updateViews(e,this.insideViews,!0),this.insideViews=e}updateViews(e,t,n){for(let r of e)t.has(r)||r.setSelectionInside(n)}findInsideViews(){let e=new Set;for(let t of pp(this.editor.state.selection)){let n=this.editor.view.nodeDOM(t),r=n?this.views.get(n):void 0;r&&e.add(r)}return e}},hp=new WeakMap;function gp(e){let t=hp.get(e);return t||(t=new mp(e),hp.set(e,t)),t}var _p=class extends Id{constructor(e,t,n){if(super(e,t,n),this.nodeSelected=!1,this.handlePositionUpdate=()=>{let e=this.getPos();typeof e==`number`&&e!==this.currentPos&&(this.currentPos=e,this.renderer.updateProps({getPos:()=>this.getPos()}),typeof this.options.attrs==`function`&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.contentDOMElement=this.options.contentDOMElementTag?document.createElement(this.options.contentDOMElementTag):document.createElement(this.node.isInline?`span`:`div`),this.contentDOMElement.dataset.nodeViewContentReact=``,this.contentDOMElement.dataset.nodeViewWrapper=``,this.contentDOMElement.style.whiteSpace=`inherit`;let e=this.dom.querySelector(`[data-node-view-content]`);e?e.appendChild(this.contentDOMElement):this.dom.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on(`update`,this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){let e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,r,i){return r===`storage`?e.storage[t.name]??{}:Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){let e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,selectionInside:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e),deleteNode:()=>this.deleteNode(),ref:(0,j.createRef)()};if(!this.component.displayName){let e=e=>e.charAt(0).toUpperCase()+e.substring(1);this.component.displayName=e(this.extension.name)}let t={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:e=>{if(e&&this.contentDOMElement&&e.firstChild!==this.contentDOMElement){e.hasAttribute(`data-node-view-wrapper`)&&e.removeAttribute(`data-node-view-wrapper`);let t=dp(this.contentDOMElement);e.appendChild(this.contentDOMElement),t?.()}}},n=this.component,r=(0,j.memo)(e=>(0,M.jsx)(np.Provider,{value:t,children:(0,j.createElement)(n,e)}));r.displayName=`ReactNodeView`;let i=this.node.isInline?`span`:`div`;this.options.as&&(i=this.options.as);let{className:a=``}=this.options;this.renderer=new up(r,{editor:this.editor,props:e,as:i,className:`node-${this.node.type.name} ${a}`.trim()}),gp(this.editor).register(this),this.updateElementAttributes(),this.currentPos=this.getPos()}get dom(){if(this.renderer.element.firstElementChild&&!this.renderer.element.firstElementChild?.hasAttribute(`data-node-view-wrapper`))throw Error(`Please use the NodeViewWrapper component for your node view.`);return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}update(e,t,n){let r=e=>{this.renderer.updateProps(e),typeof this.options.attrs==`function`&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update==`function`){let i=this.node,a=this.decorations,o=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=this.getPos(),this.options.update({oldNode:i,oldDecorations:a,newNode:e,newDecorations:t,oldInnerDecorations:o,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}if(e===this.node)return this.node=e,this.decorations=t,this.innerDecorations=n,!0;let i=this.getPos();this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=i;let a={node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(a.getPos=()=>this.getPos()),r(a),!0}selectNode(){this.nodeSelected=!0,this.updateSelectedState(!0)}deselectNode(){this.nodeSelected=!1,this.updateSelectedState(this.options.selectedOnTextSelection===!0&&this.isTextSelectionInside())}setSelectionInside(e){let t=this.nodeSelected||this.options.selectedOnTextSelection===!0&&e;this.renderer.updateProps({selectionInside:e,selected:t}),this.renderer.element.classList.toggle(`ProseMirror-selectednode`,t)}updateSelectedState(e){this.renderer.updateProps({selected:e}),this.renderer.element.classList.toggle(`ProseMirror-selectednode`,e)}isTextSelectionInside(){let e=this.getPos();return typeof e==`number`&&pp(this.editor.state.selection).includes(e)}destroy(){this.renderer.destroy(),gp(this.editor).unregister(this),this.options.trackNodeViewPosition&&this.editor.off(`update`,this.handlePositionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs==`function`){let t=this.editor.extensionManager.attributes,n=ol(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:n})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}};function vp(e,t){return n=>n.editor.contentComponent?new _p(e,n,t):{dom:document.createElement(`span`),contentDOM:null,update:()=>!1,destroy:()=>{},selectNode:()=>{},deselectNode:()=>{},stopEvent:()=>!1,ignoreMutation:()=>!0}}var yp=(0,j.createContext)({get editor(){throw Error(`useTiptap must be used within a <Tiptap> provider`)}});yp.displayName=`TiptapContext`;var bp=()=>(0,j.useContext)(yp);function xp({children:e,...t}){let n=`editor`in t?t.editor:t.instance;if(!n)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let r=(0,j.useMemo)(()=>({editor:n}),[n]),i=(0,j.useMemo)(()=>({editor:n}),[n]);return(0,M.jsx)(ep.Provider,{value:i,children:(0,M.jsx)(yp.Provider,{value:r,children:e})})}xp.displayName=`Tiptap`;function Sp({...e}){let{editor:t}=bp();return(0,M.jsx)(Kf,{editor:t,...e})}Sp.displayName=`Tiptap.Content`,Object.assign(xp,{Content:Sp});var Cp=e=>{let t=e;return{set:e=>{t=e},reset:()=>{t=e},call:(...e)=>t(...e)}},wp=`
|
|
88
|
-
|
|
89
|
-
`,Tp=(e,{from:t,to:n})=>e.textBetween(t,n,wp,``),Ep=e=>{let{from:t,to:n,empty:r}=e.selection;if(r)return null;let i=Tp(e.doc,{from:t,to:n});return i.trim()===``?null:{from:t,to:n,text:i}},Dp=(e,t)=>t.to<=e.content.size&&Tp(e,t)===t.text,Op=e=>e.split(`
|
|
90
|
-
`).flatMap((e,t)=>[...t>0?[{type:`hardBreak`}]:[],...e===``?[]:[{type:`text`,text:e}]]),kp=e=>{let t=e.replace(/\r\n?/g,`
|
|
91
|
-
`).trim().split(/\n{2,}/).filter(e=>e.trim()!==``);return t.length<=1?Op(t[0]??``):t.map(e=>({type:`paragraph`,content:Op(e)}))},Ap=e=>{let[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null),[a,o]=(0,j.useState)(null),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(!1),d=yt(),f=()=>{o(null),c(``),u(!1),d.reset()},p=()=>{let t=Ep(e.state);t&&(f(),i(t),n(!0))},m=()=>{n(!1),f()};return{open:t,captured:r,tooLong:(r?.text.length??0)>bt,result:a,draft:s,setDraft:c,stale:l,pending:d.isPending,error:d.error,start:p,close:m,run:e=>{r&&e.trim()!==``&&(u(!1),d.mutate({text:r.text,instruction:e.trim()},{onSuccess:e=>{o(e),c(e.text)}}))},apply:()=>{if(r&&s.trim()!==``){if(!Dp(e.state.doc,r)){u(!0);return}e.chain().focus().insertContentAt({from:r.from,to:r.to},kp(s)).run(),m()}},discard:f}},jp={type:`doc`,content:[{type:`paragraph`}]},Mp={},Np=e=>({type:`doc`,content:e.split(/\n{2,}/).map(e=>e.trim()).filter(Boolean).map(e=>({type:`paragraph`,content:[{type:`text`,text:e}]}))}),Pp=e=>mt(e)&&e.type===`doc`,Fp=e=>{if(pt(e))return{status:`ok`,doc:jp};if(typeof e==`string`)return{status:`ok`,doc:Np(e)};if(!mt(e)||e.format!==`shapio-richtext`||!Pp(e.doc)||typeof e.version!=`number`)return{status:`unreadable`,doc:jp};if(e.version>1)return{status:`newer`,doc:e.doc,version:e.version};let t=e.doc;for(let n=e.version;n<1;n+=1){let e=Mp[n];if(!e)return{status:`unreadable`,doc:jp};t=e(t)}return{status:`ok`,doc:t}},Ip=e=>{let t={format:ct,version:1,doc:e};return pt(t)?null:t},Lp=/^(https?:\/\/|mailto:|tel:|\/(?!\/)|#)/i,Rp=e=>{let t=e.trim();return t===``?null:Lp.test(t)?t:/^[a-z][a-z0-9+.-]*:/i.test(t)?null:`https://${t}`},zp=e=>e.replace(/<!--[\s\S]*?-->/g,``).replace(/<(script|style|template|iframe|object|noscript)[\s\S]*?<\/\1\s*>/gi,``).replace(/<\/?(meta|link|base|o:p|xml)[^>]*>/gi,``),Bp=e=>(e.metaKey||e.ctrlKey)&&e.shiftKey&&!e.altKey&&e.key.toLowerCase()===`k`,Vp=({props:e,extensions:t,contentClasses:n,onLinkShortcut:r,refuseFileDrops:i})=>{let{inputId:a,labelId:o,describedBy:s,value:c,onChange:l,onBlur:u,readOnly:d,disabled:f,validation:p}=e,[m]=(0,j.useState)(()=>Fp(c)),h=(0,j.useRef)(c),g=(0,j.useRef)({onChange:l,onBlur:u,onLinkShortcut:r});(0,j.useEffect)(()=>{g.current={onChange:l,onBlur:u,onLinkShortcut:r}});let _=!d&&!f&&m.status===`ok`,v=$f({extensions:t,content:m.doc,editable:_,immediatelyRender:!0,shouldRerenderOnTransaction:!1,editorProps:{attributes:{id:a,role:`textbox`,"aria-multiline":`true`,"aria-labelledby":o,...s?{"aria-describedby":s}:{},...p.invalid?{"aria-invalid":`true`}:{},..._?{}:{"aria-readonly":`true`},class:n},transformPastedHTML:zp,handleKeyDown:(e,t)=>Bp(t)?(t.preventDefault(),g.current.onLinkShortcut(),!0):!1,handleDrop:(e,t)=>i&&(t.dataTransfer?.files.length??0)>0?(t.preventDefault(),!0):!1},onUpdate:({editor:e})=>{let t=Ip(e.getJSON());h.current=t,g.current.onChange(t)},onBlur:()=>g.current.onBlur()});return(0,j.useEffect)(()=>{ut(c,h.current)||(h.current=c,v.commands.setContent(Fp(c).doc,{emitUpdate:!1}))},[c,v]),(0,j.useEffect)(()=>v.setEditable(_),[v,_]),{editor:v,initial:m,editable:_}},Hp=(e,t)=>({current:{getBoundingClientRect:()=>{let{from:n,to:r}=t??e.state.selection,i=e.state.doc.content.size,a=e.view.coordsAtPos(Math.min(n,i)),o=e.view.coordsAtPos(Math.min(r,i));return new DOMRect(a.left,a.top,Math.max(o.right-a.left,1),o.bottom-a.top)}}}),Up=({editor:e,active:t,disabled:n,open:r,onOpenChange:i,anchorToSelection:a=!1})=>{let{t:s}=o(),c=(0,j.useId)(),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(!1),p=s(`content.richText.link`),m=t=>{if(t){let t=e.getAttributes(`link`).href;u(typeof t==`string`?t:``),f(!1)}i(t)},h=()=>{let t=Rp(l);if(l.trim()!==``&&!t){f(!0);return}let n=e.chain().focus().extendMarkRange(`link`);(t?n.setLink({href:t}):n.unsetLink()).run(),i(!1)};return(0,M.jsxs)(ne,{open:r,onOpenChange:m,children:[a?(0,M.jsx)(re,{virtualRef:Hp(e)}):(0,M.jsxs)(st,{children:[(0,M.jsx)(at,{asChild:!0,children:(0,M.jsx)(x,{asChild:!0,children:(0,M.jsx)(oe,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":p,"aria-pressed":t,disabled:n,className:`aria-pressed:bg-accent aria-pressed:text-accent-foreground`,children:(0,M.jsx)(Ye,{"aria-hidden":`true`})})})}),(0,M.jsx)(ot,{children:s(`content.richText.shortcut`,{action:p,keys:`Mod+Shift+K`})})]}),(0,M.jsx)(S,{align:`start`,className:`w-80 font-sans`,onCloseAutoFocus:t=>{t.preventDefault(),e.commands.focus()},children:(0,M.jsxs)(`form`,{className:`space-y-2`,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),h()},children:[(0,M.jsx)(ce,{htmlFor:c,children:s(`content.richText.linkUrl`)}),(0,M.jsx)(se,{id:c,value:l,autoFocus:!0,inputMode:`url`,placeholder:s(`content.richText.linkPlaceholder`),"aria-invalid":d||void 0,"aria-describedby":d?`${c}-error`:void 0,onChange:e=>{u(e.target.value),f(!1)}}),d?(0,M.jsx)(`p`,{id:`${c}-error`,className:`text-meta text-destructive`,children:s(`content.richText.linkInvalid`)}):null,(0,M.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[t?(0,M.jsx)(oe,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{e.chain().focus().extendMarkRange(`link`).unsetLink().run(),i(!1)},children:s(`content.richText.removeLink`)}):null,(0,M.jsx)(oe,{type:`submit`,size:`sm`,children:s(`content.richText.applyLink`)})]})]})})]})},Wp=({editor:e,initial:t,maxLength:n})=>{let{t:r}=o(),i=Yf({editor:e,selector:({editor:e})=>e.state.doc.textContent.length});return(0,M.jsxs)(M.Fragment,{children:[t.status===`newer`?(0,M.jsx)(`p`,{className:`font-sans text-meta text-muted-foreground`,children:r(`content.richText.newerVersion`,{version:t.version})}):null,t.status===`unreadable`?(0,M.jsx)(`p`,{className:`font-sans text-meta text-destructive`,children:r(`content.richText.unreadable`)}):null,n?(0,M.jsx)(`p`,{className:`text-right font-sans text-meta text-muted-foreground tabular-nums`,children:r(`content.fields.characterCount`,{count:i,max:n})}):null]})},Gp=(e,t)=>{if(e.childCount===0)return;let n=e.resolve(Math.min(Math.max(t,0),e.content.size)),r=n.depth===0?Math.min(n.index(0),e.childCount-1):n.index(0),i=e.maybeChild(r);if(!i)return;let a=0;for(let t=0;t<r;t+=1)a+=e.child(t).nodeSize;return{node:i,pos:a,index:r}},Kp=(e,t,n)=>{let{doc:r,selection:i}=e,a=Gp(r,i.from);if(!a)return!1;let o=t===`up`?a.index-1:a.index+1,s=r.maybeChild(o);if(!s)return!1;if(n){let r=i.from-a.pos,o=t===`up`?a.pos-s.nodeSize:a.pos+s.nodeSize,c=e.tr.delete(a.pos,a.pos+a.node.nodeSize);c.insert(o,a.node);let l=c.doc.resolve(Math.min(o+r,c.doc.content.size));c.setSelection(i instanceof E?E.create(c.doc,o):k.near(l)),n(c.scrollIntoView())}return!0},qp=(e,t,n)=>{let r=E.create(e.state.doc,t);if(e.dispatch(e.state.tr.setSelection(r)),e.dragging={slice:r.content(),move:!0},n.dataTransfer){n.dataTransfer.effectAllowed=`move`,n.dataTransfer.setData(`text/plain`,r.node.textContent);let i=e.nodeDOM(t);i instanceof HTMLElement&&n.dataTransfer.setDragImage(i,0,0)}},Jp=G.create({name:`blockMoveKeys`,addKeyboardShortcuts(){return{"Alt-ArrowUp":({editor:e})=>Kp(e.state,`up`,e.view.dispatch),"Alt-ArrowDown":({editor:e})=>Kp(e.state,`down`,e.view.dispatch)}}}),Yp=({editor:e,block:t,onInsert:n,onMenuOpenChange:r})=>{let{t:i}=o(),[a,s]=(0,j.useState)(!1),c=ft(),l=e.state.doc.nodeAt(t.pos);if(!l)return null;let u=t.pos+l.nodeSize;return(0,M.jsxs)(`div`,{className:`absolute top-(--handle-top) -left-16 hidden w-14 items-center justify-end gap-0.5 font-sans lg:flex`,style:{"--handle-top":`${t.top}px`},"data-block-handle":!0,children:[(0,M.jsxs)(it,{open:a,onOpenChange:e=>{s(e),r(e)},children:[(0,M.jsxs)(st,{children:[(0,M.jsx)(at,{asChild:!0,children:(0,M.jsx)(nt,{asChild:!0,children:(0,M.jsx)(oe,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`text-muted-foreground`,"aria-label":i(`entry.blocks.addAfter`),children:(0,M.jsx)(Ze,{"aria-hidden":`true`})})})}),(0,M.jsx)(ot,{children:i(`entry.blocks.addAfter`)})]}),(0,M.jsx)(rt,{align:`start`,className:`w-72`,onCloseAutoFocus:c.onCloseAutoFocus,children:(0,M.jsx)(Be,{onSelect:e=>c.defer(()=>n(e,u))})})]}),(0,M.jsxs)(st,{children:[(0,M.jsx)(at,{asChild:!0,children:(0,M.jsx)(oe,{type:`button`,variant:`ghost`,size:`icon-xs`,draggable:!0,className:`cursor-grab text-muted-foreground active:cursor-grabbing`,"aria-label":i(`entry.blocks.drag`),onClick:()=>{e.view.dispatch(e.state.tr.setSelection(E.create(e.state.doc,t.pos))),e.view.focus()},onDragStart:n=>qp(e.view,t.pos,n.nativeEvent),children:(0,M.jsx)(Ke,{"aria-hidden":`true`})})}),(0,M.jsx)(ot,{children:i(`entry.blocks.dragHint`)})]})]})},Xp,Zp;if(typeof WeakMap<`u`){let e=new WeakMap;Xp=t=>e.get(t),Zp=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;Xp=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},Zp=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var q=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return Xp(e)||Zp(e,Qp(e))}};function Qp(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=$p(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new q(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&em(s,o,e),s}function $p(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function em(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=tm(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function tm(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function nm(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var rm=new A(`selectingCells`);function im(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function am(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if(n===`cell`||n===`header_cell`)return e.node(t)}return null}function om(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function sm(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=im(t.$head)||cm(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function cm(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function lm(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function um(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function dm(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function fm(e,t,n){let r=e.node(-1),i=q.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function pm(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function mm(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}function hm(e,t,n){let r=nm(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0}var J=class e extends D{constructor(e,t=e){let n=e.node(-1),r=q.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new ke(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(lm(r)&&lm(i)&&dm(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return k.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=q.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=pm(e,0,l)),u>0&&(e=pm(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(T.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new w(T.from(o),1,1)}replace(e,t=w.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?w.empty:t)}let i=D.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new w(T.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=q.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=q.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=q.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=q.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new gm(this.$anchorCell.pos,this.$headCell.pos)}};J.prototype.visible=!1,D.jsonID(`cell`,J);var gm=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&dm(t,n)?new J(t,n):D.near(n,1)}};function _m(e){if(!(e.selection instanceof J))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(oo.node(n,n+e.nodeSize,{class:`selectedCell`}))}),R.create(e.doc,t)}function vm({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function ym({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.spec.tableRole===`cell`||r.type.spec.tableRole===`header_cell`){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.spec.tableRole===`cell`||n.type.spec.tableRole===`header_cell`){r=n;break}}return n!==r&&t.parentOffset===0}function bm(e,t,n){let r=(t||e).selection,i=(t||e).doc,a,o;if(r instanceof E&&(o=r.node.type.spec.tableRole)){if(o==`cell`||o==`header_cell`)a=J.create(i,r.from);else if(o==`row`){let e=i.resolve(r.from+1);a=J.rowSelection(e,e)}else if(!n){let e=q.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];a=J.create(i,t+1,n)}}else r instanceof k&&vm(r)?a=k.create(i,r.from):r instanceof k&&ym(r)&&(a=k.create(i,r.$from.start(),r.$from.end()));return a&&(t||=e.tr).setSelection(a),t}var xm=new A(`fix-tables`);function Sm(e,t,n,r){let i=e.childCount,a=t.childCount;outer:for(let o=0,s=0;o<a;o++){let a=t.child(o);for(let t=s,r=Math.min(i,o+3);t<r;t++)if(e.child(t)==a){s=t+1,n+=a.nodeSize;continue outer}r(a,n),s<i&&e.child(s).sameMarkup(a)?Sm(e.child(s),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function Cm(e,t){let n,r=(t,r)=>{t.type.spec.tableRole==`table`&&(n=wm(e,t,r,n))};return t?t.doc!=e.doc&&Sm(t.doc,e.doc,0,r):e.doc.descendants(r),n}function wm(e,t,n,r){let i=q.get(t);if(!i.problems)return r;r||=e.tr;let a=[];for(let e=0;e<i.height;e++)a.push(0);for(let e=0;e<i.problems.length;e++){let o=i.problems[e];if(o.type==`collision`){let e=t.nodeAt(o.pos);if(!e)continue;let i=e.attrs;for(let e=0;e<i.rowspan;e++)a[o.row+e]+=o.n;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,pm(i,i.colspan-o.n,o.n))}else if(o.type==`missing`)a[o.row]+=o.n;else if(o.type==`overlong_rowspan`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-o.n})}else if(o.type==`colwidth mismatch`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,colwidth:o.colwidth})}else if(o.type==`zero_sized`){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let o,s;for(let e=0;e<a.length;e++)a[e]&&(o??=e,s=e);for(let c=0,l=n+1;c<i.height;c++){let n=t.child(c),i=l+n.nodeSize,u=a[c];if(u>0){let t=`cell`;n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<u;n++){let n=nm(e.schema)[t].createAndFill();n&&a.push(n)}let d=(c==0||o==c-1)&&s==c?l+1:i-1;r.insert(r.mapping.map(d),a)}l=i}return r.setMeta(xm,{fixTables:!0})}function Tm(e){let t=e.selection,n=sm(e),r=n.node(-1),i=n.start(-1),a=q.get(r);return{...t instanceof J?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function Em(e,{map:t,tableStart:n,table:r},i){let a=i>0?-1:0;hm(t,r,i+a)&&(a=i==0||i==t.width?null:0);for(let o=0;o<t.height;o++){let s=o*t.width+i;if(i>0&&i<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],c=r.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,mm(c.attrs,i-t.colCount(a))),o+=c.attrs.rowspan-1}else{let c=a==null?nm(r.type.schema).cell:r.nodeAt(t.map[s+a]).type,l=t.positionAt(o,i,r);e.insert(e.mapping.map(n+l),c.createAndFill())}}return e}function Dm(e,t){if(!om(e))return!1;if(t){let n=Tm(e);t(Em(e.tr,n,n.left))}return!0}function Om(e,t){if(!om(e))return!1;if(t){let n=Tm(e);t(Em(e.tr,n,n.right))}return!0}function km(e,{map:t,table:n,tableStart:r},i){let a=e.mapping.maps.length;for(let o=0;o<t.height;){let s=o*t.width+i,c=t.map[s],l=n.nodeAt(c),u=l.attrs;if(i>0&&t.map[s-1]==c||i<t.width-1&&t.map[s+1]==c)e.setNodeMarkup(e.mapping.slice(a).map(r+c),null,pm(u,i-t.colCount(c)));else{let t=e.mapping.slice(a).map(r+c);e.delete(t,t+l.nodeSize)}o+=u.rowspan}}function Am(e,t){if(!om(e))return!1;if(t){let n=Tm(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let e=n.right-1;km(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=q.get(e)}t(r)}return!0}function jm(e,t,n){let r=nm(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if(t.nodeAt(e.map[i+n*e.width])?.type!=r)return!1;return!0}function Mm(e,{map:t,tableStart:n,table:r},i){let a=n;for(let e=0;e<i;e++)a+=r.child(e).nodeSize;let o=[],s=i>0?-1:0;jm(t,r,i+s)&&(s=i==0||i==t.height?null:0);for(let a=0,c=t.width*i;a<t.width;a++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],o=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...o,rowspan:o.rowspan+1}),a+=o.colspan-1}else{let e=(s==null?nm(r.type.schema).cell:r.nodeAt(t.map[c+s*t.width])?.type)?.createAndFill();e&&o.push(e)}return e.insert(a,nm(r.type.schema).row.create(null,o)),e}function Nm(e,t){if(!om(e))return!1;if(t){let n=Tm(e);t(Mm(e.tr,n,n.top))}return!0}function Pm(e,t){if(!om(e))return!1;if(t){let n=Tm(e);t(Mm(e.tr,n,n.bottom))}return!0}function Fm(e,{map:t,table:n,tableStart:r},i){let a=0;for(let e=0;e<i;e++)a+=n.child(e).nodeSize;let o=a+n.child(i).nodeSize,s=e.mapping.maps.length;e.delete(a+r,o+r);let c=new Set;for(let a=0,o=i*t.width;a<t.width;a++,o++){let l=t.map[o];if(!c.has(l)){if(c.add(l),i>0&&l==t.map[o-t.width]){let t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(s).map(l+r),null,{...t,rowspan:t.rowspan-1}),a+=t.colspan-1}else if(i<t.height&&l==t.map[o+t.width]){let o=n.nodeAt(l),c=o.attrs,u=o.type.create({...c,rowspan:o.attrs.rowspan-1},o.content),d=t.positionAt(i+1,a,n);e.insert(e.mapping.slice(s).map(r+d),u),a+=c.colspan-1}}}}function Im(e,t){if(!om(e))return!1;if(t){let n=Tm(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;Fm(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=q.get(n.table)}t(r)}return!0}function Lm(e){let t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function Rm({width:e,height:t,map:n},r){let i=r.top*e+r.left,a=i,o=(r.bottom-1)*e+r.left,s=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[a]==n[a-1]||r.right<e&&n[s]==n[s+1])return!0;a+=e,s+=e}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[o]==n[o+e])return!0;i++,o++}return!1}function zm(e,t){let n=e.selection;if(!(n instanceof J)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=Tm(e),{map:i}=r;if(Rm(i,r))return!1;if(t){let n=e.tr,a={},o=T.empty,s,c;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let l=i.map[e*i.width+t],u=r.table.nodeAt(l);if(!a[l]&&u){if(a[l]=!0,s==null)s=l,c=u;else{Lm(u)||(o=o.append(u.content));let e=n.mapping.map(l+r.tableStart);n.delete(e,e+u.nodeSize)}}}if(s==null||c==null)return!0;if(n.setNodeMarkup(s+r.tableStart,null,{...mm(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),o.size>0){let e=s+1+c.content.size,t=Lm(c)?s+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,o)}n.setSelection(new J(n.doc.resolve(s+r.tableStart))),t(n)}return!0}function Bm(e,t){let n=nm(e.schema);return Vm(({node:e})=>n[e.type.spec.tableRole])(e,t)}function Vm(e){return(t,n)=>{let r=t.selection,i,a;if(r instanceof J){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{if(i=am(r.$from),!i)return!1;a=im(r.$from)?.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let o=i.attrs,s=[],c=o.colwidth;o.rowspan>1&&(o={...o,rowspan:1}),o.colspan>1&&(o={...o,colspan:1});let l=Tm(t),u=t.tr;for(let e=0;e<l.right-l.left;e++)s.push(c?{...o,colwidth:c&&c[e]?[c[e]]:null}:o);let d;for(let t=l.top;t<l.bottom;t++){let n=l.map.positionAt(t,l.left,l.table);t==l.top&&(n+=i.nodeSize);for(let r=l.left,a=0;r<l.right;r++,a++)(r!=l.left||t!=l.top)&&u.insert(d=u.mapping.map(n+l.tableStart,1),e({node:i,row:t,col:r}).createAndFill(s[a]))}u.setNodeMarkup(a,e({node:i,row:l.top,col:l.left}),s[0]),r instanceof J&&u.setSelection(new J(u.doc.resolve(r.$anchorCell.pos),d?u.doc.resolve(d):void 0)),n(u)}return!0}}function Hm(e,t){return function(n,r){if(!om(n))return!1;let i=sm(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let a=n.tr;n.selection instanceof J?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&a.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(a)}return!0}}function Um(e){return function(t,n){if(!om(t))return!1;if(n){let r=nm(t.schema),i=Tm(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function Wm(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function Gm(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?Um(e):function(t,n){if(!om(t))return!1;if(n){let r=nm(t.schema),i=Tm(t),a=t.tr,o=Wm(`row`,i,r),s=Wm(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}Gm(`row`,{useDeprecatedLogic:!0}),Gm(`column`,{useDeprecatedLogic:!0});var Km=Gm(`cell`,{useDeprecatedLogic:!0});function qm(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}function Jm(e){return function(t,n){if(!om(t))return!1;let r=qm(sm(t),e);if(r==null)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(k.between(e,um(e))).scrollIntoView())}return!0}}function Ym(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole==`table`)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Xm(e,t){let n=e.selection;if(!(n instanceof J))return!1;if(t){let r=e.tr,i=nm(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new w(i,0,0))}),r.docChanged&&t(r)}return!0}function Zm(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole==`table`);)n--,r--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,o=i.type.schema,s=[];if(a==`row`)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,a=e?0:Math.max(0,n-1),c=e<t.childCount-1?0:Math.max(0,r-1);(a||c)&&(i=$m(nm(o).row,new w(i,a,c)).content),s.push(i)}else if(a==`cell`||a==`header_cell`)s.push(n||r?$m(nm(o).row,new w(t,n,r)).content:t);else return null;return Qm(o,s)}function Qm(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:a}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+a}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(T.empty),n[i]<r){let a=nm(e).cell.createAndFill(),o=[];for(let e=n[i];e<r;e++)o.push(a);t[i]=t[i].append(T.from(o))}return{height:t.length,width:r,rows:t}}function $m(e,t){let n=e.createAndFill();return new Ve(n).replace(0,n.content.size,t).doc}function eh({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let a=n[e],o=[];for(let n=t[e]||0,i=0;n<r;i++){let s=a.child(i%a.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(pm(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),o.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}i.push(T.from(o))}n=i,e=r}if(t!=i){let e=[];for(let r=0,a=0;r<i;r++,a++){let o=[],s=n[a%t];for(let e=0;e<s.childCount;e++){let t=s.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(T.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}function th(e,t,n,r,i,a,o){let s=e.doc.type.schema,c=nm(s),l,u;if(i>t.width)for(let a=0,s=0;a<t.height;a++){let d=n.child(a);s+=d.nodeSize;let f=[],p;p=d.lastChild==null||d.lastChild.type==c.cell?l||=c.cell.createAndFill():u||=c.header_cell.createAndFill();for(let e=t.width;e<i;e++)f.push(p);e.insert(e.mapping.slice(o).map(s-1+r),f)}if(a>t.height){let s=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=e>=t.width?!1:n.nodeAt(t.map[r+e]).type==c.header_cell;s.push(i?u||=c.header_cell.createAndFill():l||=c.cell.createAndFill())}let d=c.row.create(null,T.from(s)),f=[];for(let e=t.height;e<a;e++)f.push(d);e.insert(e.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||u)}function nh(e,t,n,r,i,a,o,s){if(o==0||o==t.height)return!1;let c=!1;for(let l=i;l<a;l++){let i=o*t.width+l,a=t.map[i];if(t.map[i-t.width]==a){c=!0;let i=n.nodeAt(a),{top:u,left:d}=t.findCell(a);e.setNodeMarkup(e.mapping.slice(s).map(a+r),null,{...i.attrs,rowspan:o-u}),e.insert(e.mapping.slice(s).map(t.positionAt(o,d,n)),i.type.createAndFill({...i.attrs,rowspan:u+i.attrs.rowspan-o})),l+=i.attrs.colspan-1}}return c}function rh(e,t,n,r,i,a,o,s){if(o==0||o==t.width)return!1;let c=!1;for(let l=i;l<a;l++){let i=l*t.width+o,a=t.map[i];if(t.map[i-1]==a){c=!0;let i=n.nodeAt(a),u=t.colCount(a),d=e.mapping.slice(s).map(a+r);e.setNodeMarkup(d,null,pm(i.attrs,o-u,i.attrs.colspan-(o-u))),e.insert(d+i.nodeSize,i.type.createAndFill(pm(i.attrs,0,o-u))),l+=i.attrs.rowspan-1}}return c}function ih(e,t,n,r,i){let a=n?e.doc.nodeAt(n-1):e.doc;if(!a)throw Error(`No table found`);let o=q.get(a),{top:s,left:c}=r,l=c+i.width,u=s+i.height,d=e.tr,f=0;function p(){if(a=n?d.doc.nodeAt(n-1):d.doc,!a)throw Error(`No table found`);o=q.get(a),f=d.mapping.maps.length}th(d,o,a,n,l,u,f)&&p(),nh(d,o,a,n,c,l,s,f)&&p(),nh(d,o,a,n,c,l,u,f)&&p(),rh(d,o,a,n,s,u,c,f)&&p(),rh(d,o,a,n,s,u,l,f)&&p();for(let e=s;e<u;e++){let t=o.positionAt(e,c,a),r=o.positionAt(e,l,a);d.replace(d.mapping.slice(f).map(t+n),d.mapping.slice(f).map(r+n),new w(i.rows[e-s],0,0))}p(),d.setSelection(new J(d.doc.resolve(n+o.positionAt(s,c,a)),d.doc.resolve(n+o.positionAt(u-1,l-1,a)))),t(d)}var ah=ns({ArrowLeft:sh(`horiz`,-1),ArrowRight:sh(`horiz`,1),ArrowUp:sh(`vert`,-1),ArrowDown:sh(`vert`,1),"Shift-ArrowLeft":ch(`horiz`,-1),"Shift-ArrowRight":ch(`horiz`,1),"Shift-ArrowUp":ch(`vert`,-1),"Shift-ArrowDown":ch(`vert`,1),Backspace:Xm,"Mod-Backspace":Xm,Delete:Xm,"Mod-Delete":Xm});function oh(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function sh(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof J)return oh(n,r,D.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=fh(i,e,t);if(o==null)return!1;if(e==`horiz`)return oh(n,r,D.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=fm(i,e,t),s;return s=a?D.near(a,1):t<0?D.near(n.doc.resolve(i.before(-1)),-1):D.near(n.doc.resolve(i.after(-1)),1),oh(n,r,s)}}}function ch(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof J)o=a;else{let r=fh(i,e,t);if(r==null)return!1;o=new J(n.doc.resolve(r))}let s=fm(o.$headCell,e,t);return s?oh(n,r,new J(o.$anchorCell,s)):!1}}function lh(e,t){let n=e.state.doc,r=im(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new J(r))),!0):!1}function uh(e,t,n){if(!om(e.state))return!1;let r=Zm(n),i=e.state.selection;if(i instanceof J){r||={width:1,height:1,rows:[T.from($m(nm(e.state.schema).cell,n))]};let t=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),o=q.get(t).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=eh(r,o.right-o.left,o.bottom-o.top),ih(e.state,e.dispatch,a,o,r),!0}if(r){let t=sm(e.state),n=t.start(-1);return ih(e.state,e.dispatch,n,q.get(t.node(-1)).findCell(t.pos-n),r),!0}return!1}function dh(e,t){if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=ph(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof J)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=im(e.state.selection.$anchor))!=null&&mh(e,t)?.pos!=r.pos)i(r,t),t.preventDefault();else if(!n)return;function i(t,n){let r=mh(e,n),i=rm.getState(e.state)==null;if(!r||!dm(t,r)){if(i)r=t;else return}let a=new J(t,r);if(i||!e.state.selection.eq(a)){let n=e.state.tr.setSelection(a);i&&n.setMeta(rm,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener(`mouseup`,a),e.root.removeEventListener(`dragstart`,a),e.root.removeEventListener(`mousemove`,o),rm.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(rm,-1))}function o(r){let o=r,s=rm.getState(e.state),c;if(s!=null)c=e.state.doc.resolve(s);else if(ph(e,o.target)!=n&&(c=mh(e,t),!c))return a();c&&i(c,o)}e.root.addEventListener(`mouseup`,a),e.root.addEventListener(`dragstart`,a),e.root.addEventListener(`mousemove`,o)}function fh(e,t,n){if(!(e.state.selection instanceof k))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}function ph(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function mh(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&im(e.state.doc.resolve(r))||im(e.state.doc.resolve(i))}var hh=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),this.table.style.setProperty(`--default-cell-min-width`,`${t}px`),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),gh(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type==this.node.type&&(this.node=e,gh(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type==`attributes`&&(e.target==this.table||this.colgroup.contains(e.target))}};function gh(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l){for(let e=0,n=0;e<l.childCount;e++){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e++,n++){let l=i==n?a:d&&d[e],u=l?l+`px`:``;if(o+=l||r,l||(s=!1),c)c.style.width!=u&&(c.style.width=u),c=c.nextSibling;else{let e=document.createElement(`col`);e.style.width=u,t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}s?(n.style.width=o+`px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=o+`px`)}}var _h=new A(`tableColumnResizing`);function vh({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=hh,lastColumnResizable:i=!0}={}){let a=new O({key:_h,state:{init(e,t){var i;let o=(i=a.spec)==null||(i=i.props)==null?void 0:i.nodeViews,s=nm(t.schema).table.name;return r&&o&&(o[s]=(e,t)=>new r(e,n,t)),new yh(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=_h.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,n)=>{bh(t,n,e,i)},mouseleave:e=>{xh(e)},mousedown:(e,r)=>{Sh(e,r,t,n)}},decorations:e=>{let t=_h.getState(e);if(t&&t.activeHandle>-1)return jh(e,t.activeHandle)},nodeViews:{}}});return a}var yh=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=this,r=t.getMeta(_h);if(r&&r.setHandle!=null)return new e(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return lm(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function bh(e,t,n,r){if(!e.editable)return;let i=_h.getState(e.state);if(i&&!i.dragging){let a=wh(t.target),o=-1;if(a){let{left:r,right:i}=a.getBoundingClientRect();t.clientX-r<=n?o=Th(e,t,`left`,n):i-t.clientX<=n&&(o=Th(e,t,`right`,n))}if(o!=i.activeHandle){if(!r&&o!==-1){let t=e.state.doc.resolve(o),n=t.node(-1),r=q.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}Dh(e,o)}}}function xh(e){if(!e.editable)return;let t=_h.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&Dh(e,-1)}function Sh(e,t,n,r){if(!e.editable)return!1;let i=e.dom.ownerDocument.defaultView??window,a=_h.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;let o=e.state.doc.nodeAt(a.activeHandle),s=Ch(e,a.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta(_h,{setDragging:{startX:t.clientX,startWidth:s}}));function c(t){i.removeEventListener(`mouseup`,c),i.removeEventListener(`mousemove`,l);let r=_h.getState(e.state);r?.dragging&&(Oh(e,r.activeHandle,Eh(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(_h,{setDragging:null})))}function l(t){if(!t.which)return c(t);let i=_h.getState(e.state);if(i&&i.dragging){let a=Eh(i.dragging,t,n);kh(e,i.activeHandle,a,r)}}return kh(e,a.activeHandle,s,r),i.addEventListener(`mouseup`,c),i.addEventListener(`mousemove`,l),t.preventDefault(),!0}function Ch(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let a=e.domAtPos(t),o=a.node.childNodes[a.offset].offsetWidth,s=n;if(r)for(let e=0;e<n;e++)r[e]&&(o-=r[e],s--);return o/s}function wh(e){for(;e&&e.nodeName!=`TD`&&e.nodeName!=`TH`;)e=e.classList&&e.classList.contains(`ProseMirror`)?null:e.parentNode;return e}function Th(e,t,n,r){let i=n==`right`?-r:r,a=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!a)return-1;let{pos:o}=a,s=im(e.state.doc.resolve(o));if(!s)return-1;if(n==`right`)return s.pos;let c=q.get(s.node(-1)),l=s.start(-1),u=c.map.indexOf(s.pos-l);return u%c.width==0?-1:l+c.map[u-1]}function Eh(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function Dh(e,t){e.dispatch(e.state.tr.setMeta(_h,{setHandle:t}))}function Oh(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),a=q.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let e=0;e<a.height;e++){let t=e*a.width+s;if(e&&a.map[t]==a.map[t-a.width])continue;let r=a.map[t],l=i.nodeAt(r).attrs,u=l.colspan==1?0:s-a.colCount(r);if(l.colwidth&&l.colwidth[u]==n)continue;let d=l.colwidth?l.colwidth.slice():Ah(l.colspan);d[u]=n,c.setNodeMarkup(o+r,null,{...l,colwidth:d})}c.docChanged&&e.dispatch(c)}function kh(e,t,n,r){let i=e.state.doc.resolve(t),a=i.node(-1),o=i.start(-1),s=q.get(a).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,c=e.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!=`TABLE`;)c=c.parentNode;c&&gh(a,c.firstChild,c,r,s,n)}function Ah(e){return Array(e).fill(0)}function jh(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return R.empty;let a=q.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<a.height;t++){let r=s+t*a.width;if((s==a.width-1||a.map[r]!=a.map[r+1])&&(t==0||a.map[r]!=a.map[r-a.width])){let t=a.map[r],s=o+t+i.nodeAt(t).nodeSize-1,c=document.createElement(`div`);c.className=`column-resize-handle`,_h.getState(e)?.dragging&&n.push(oo.node(o+t,o+t+i.nodeAt(t).nodeSize,{class:`column-resize-dragging`})),n.push(oo.widget(s,c))}}return R.create(e.doc,n)}function Mh({allowTableNodeSelection:e=!1}={}){return new O({key:rm,state:{init(){return null},apply(e,t){let n=e.getMeta(rm);if(n!=null)return n==-1?null:n;if(t==null||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:_m,handleDOMEvents:{mousedown:dh},createSelectionBetween(e){return rm.getState(e.state)==null?null:e.state.selection},handleTripleClick:lh,handleKeyDown:ah,handlePaste:uh},appendTransaction(t,n,r){return bm(r,Cm(r,n),e)}})}function Nh(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var Ph=class{get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(f(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(C(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(u(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(d(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(g(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(ie(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(_(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(ee(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){var e;let{selection:t}=this.editor.state,n=this.getReferencedVirtualElement?.call(this);if(n)return n;if(!((e=this.view)!=null&&(e=e.dom)!=null&&e.parentNode))return;let r=Bl(this.view,t.from,t.to),i={getBoundingClientRect:()=>r,getClientRects:()=>[r]};if(t instanceof E){let e=this.view.nodeDOM(t.from),n=e.dataset.nodeViewWrapper?e:e.querySelector(`[data-node-view-wrapper]`);n&&(e=n),e&&(i={getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>[e.getBoundingClientRect()]})}if(t instanceof J){let{$anchorCell:e,$headCell:n}=t,r=e?e.pos:n.pos,a=n?n.pos:e.pos,o=this.view.nodeDOM(r),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():Nh(o.getBoundingClientRect(),s.getBoundingClientRect());i={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return i}constructor({editor:e,element:t,view:n,pluginKey:r=`bubbleMenu`,updateDelay:i=250,resizeDelay:a=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:c,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&ec(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);(n||r)&&(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&p(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(this.isVisible&&!this.editor.isDestroyed&&this.element.isConnected){if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener(`dragstart`,this.dragstartHandler),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Fh=e=>new O({key:typeof e.pluginKey==`string`?new A(e.pluginKey):e.pluginKey,view:t=>new Ph({view:t,...e})});G.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Fh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var Ih=class{getTextContent(e){return gl(e,{textSerializers:_l(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(f(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(C(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(u(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(d(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(g(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(ie(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(_(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(ee(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}constructor({editor:e,element:t,view:n,pluginKey:r=`floatingMenu`,updateDelay:i=250,resizeDelay:a=60,options:o,appendTo:s,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=o?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){var e;if(!((e=this.view)!=null&&(e=e.dom)!=null&&e.parentNode))return;let{selection:t}=this.editor.state,n=Bl(this.view,t.from,t.to);p({getBoundingClientRect:()=>n,getClientRects:()=>[n]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Lh=e=>new O({key:typeof e.pluginKey==`string`?new A(e.pluginKey):e.pluginKey,view:t=>new Ih({view:t,...e})});G.create({name:`floatingMenu`,addOptions(){return{element:null,options:{},pluginKey:`floatingMenu`,updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,`updatePosition`),!0)}},addProseMirrorPlugins(){return this.options.element?[Lh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function Rh(e,t){return e??new A(t)}var zh=typeof window<`u`?j.useLayoutEffect:j.useEffect,Bh=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),Vh=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.columnCount.columns.fillOpacity.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineClamp.lineHeight.opacity.order.orphans.scale.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth.tabSize.widows.zIndex.zoom`.split(`.`)),Hh=new Set([`children`,`className`,`style`]),Uh=new Set([`tabIndex`]),Wh=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),Gh={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function Kh(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function qh(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function Jh(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||Wh.has(e)}function Yh(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function Xh(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:Gh[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function Zh(e,t){let n=t.defaultPrevented,r=!1,i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>void 0},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>r},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{r=!0,t.stopPropagation()}}}),i}function Qh(e){return Uh.has(e)}function $h(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function eg(e,t){if(t===`tabIndex`){e.removeAttribute(`tabindex`);return}let n=e[t];if(typeof n==`boolean`){e[t]=!1;return}if(typeof n==`number`){e[t]=0;return}e[t]=``}function tg(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||Vh.has(e)?String(t):`${t}px`}function ng(e,t){Bh.has(t)||e.style.removeProperty(Yh(t))}function rg(e,t,n){Bh.has(t)||e.style.setProperty(Yh(t),tg(t,n))}function ig(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(Hh.has(r)||!Jh(r)||Kh(r,t[r])||Kh(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=qh(r);if(a==null||a===!1){Qh(r)&&eg(e,r),e.removeAttribute(o);return}if(a===!0){Qh(r)&&$h(e,r,!0),e.setAttribute(o,``);return}if(Qh(r)){$h(e,r,a);return}e.setAttribute(o,String(a))})}function ag(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function og(e,t,n){let r=t??{},i=n??{};new Set([...Object.keys(r),...Object.keys(i)]).forEach(t=>{let n=r[t],a=i[t];if(n!==a){if(a==null){ng(e,t);return}rg(e,t,a)}})}function sg(e,t,n){t.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)});let r=[];return Object.entries(n).forEach(([t,n])=>{if(!Kh(t,n))return;let{eventName:i,options:a}=Xh(t),o=t=>{n(Zh(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function cg(e,t){let n=(0,j.useRef)({}),r=(0,j.useRef)([]);zh(()=>{let i=n.current;return ag(e,i.className,t.className),og(e,i.style,t.style),ig(e,i,t),r.current=sg(e,r.current,t),n.current=t,()=>{r.current.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),r.current=[]}},[e,t])}var lg=j.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:c,...l},u)=>{let d=(0,j.useRef)(document.createElement(`div`)),f=(0,j.useRef)(Rh(e,`bubbleMenu`)).current;cg(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=tp(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,j.useRef)(h);g.current=h;let[_,v]=(0,j.useState)(!1),y=(0,j.useRef)(!0);return(0,j.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=Fh({...g.current,editor:m,element:e});m.registerPlugin(t);let n=g.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),m.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[m]),(0,j.useEffect)(()=>{if(_&&m&&!m.isDestroyed){if(y.current){y.current=!1;return}m.view.dispatch(m.state.tr.setMeta(f,{type:`updateOptions`,options:g.current}))}},[_,m,n,r,a,s,i,o,f]),(0,Pt.createPortal)(c,d.current)});j.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,j.useRef)(document.createElement(`div`)),d=(0,j.useRef)(Rh(e,`floatingMenu`)).current;cg(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=tp(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,j.useRef)(m);h.current=m;let[g,_]=(0,j.useState)(!1),v=(0,j.useRef)(!0);return(0,j.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=Lh({...h.current,editor:p,element:e});p.registerPlugin(t);let n=h.current.pluginKey;return v.current=!0,_(!0),()=>{_(!1),p.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[p]),(0,j.useEffect)(()=>{if(g&&p&&!p.isDestroyed){if(v.current){v.current=!1;return}p.view.dispatch(p.state.tr.setMeta(d,{type:`updateOptions`,options:h.current}))}},[g,p,n,r,a,o,i,d]),(0,Pt.createPortal)(s,u.current)});var Y=({icon:e,label:t,keys:n,pressed:r,disabled:i,onClick:a})=>{let{t:s}=o();return(0,M.jsxs)(st,{children:[(0,M.jsx)(at,{asChild:!0,children:(0,M.jsx)(oe,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":t,"aria-pressed":r,disabled:i,className:`aria-pressed:bg-accent aria-pressed:text-accent-foreground`,onClick:a,children:(0,M.jsx)(e,{"aria-hidden":`true`})})}),(0,M.jsx)(ot,{children:n?s(`content.richText.shortcut`,{action:t,keys:n}):t})]})},ug=({editor:e})=>{let{selection:t}=e.state;return e.isEditable&&!t.empty&&!(t instanceof E)&&!e.isActive(`codeBlock`)},dg=({editor:e,onLink:t,onRewrite:n})=>{let{t:r}=o(),i=Yf({editor:e,selector:({editor:e})=>({bold:e.isActive(`bold`),italic:e.isActive(`italic`),code:e.isActive(`code`),link:e.isActive(`link`),heading2:e.isActive(`heading`,{level:2}),heading3:e.isActive(`heading`,{level:3}),blockquote:e.isActive(`blockquote`),bulletList:e.isActive(`bulletList`)})}),a=()=>e.chain().focus();return(0,M.jsx)(lg,{editor:e,shouldShow:ug,options:{placement:`top`},children:(0,M.jsxs)(`div`,{role:`toolbar`,"aria-label":r(`content.richText.toolbar`),className:`flex items-center gap-0.5 rounded-xl border bg-popover p-1 font-sans text-popover-foreground shadow-md`,children:[(0,M.jsx)(Y,{icon:Dt,label:r(`content.richText.bold`),keys:`Mod+B`,pressed:i.bold,disabled:!1,onClick:()=>a().toggleBold().run()}),(0,M.jsx)(Y,{icon:jt,label:r(`content.richText.italic`),keys:`Mod+I`,pressed:i.italic,disabled:!1,onClick:()=>a().toggleItalic().run()}),(0,M.jsx)(Y,{icon:kt,label:r(`content.richText.code`),keys:`Mod+E`,pressed:i.code,disabled:!1,onClick:()=>a().toggleCode().run()}),(0,M.jsx)(Y,{icon:Ye,label:r(`content.richText.link`),keys:`Mod+Shift+K`,pressed:i.link,disabled:!1,onClick:t}),(0,M.jsx)(te,{orientation:`vertical`,className:`mx-1 h-5`}),(0,M.jsx)(Y,{icon:ge,label:r(`entry.blocks.heading`),pressed:i.heading2,disabled:!1,onClick:()=>a().toggleHeading({level:2}).run()}),(0,M.jsx)(Y,{icon:Ge,label:r(`entry.blocks.subheading`),pressed:i.heading3,disabled:!1,onClick:()=>a().toggleHeading({level:3}).run()}),(0,M.jsx)(Y,{icon:Se,label:r(`content.richText.blockquote`),keys:`Mod+Shift+B`,pressed:i.blockquote,disabled:!1,onClick:()=>a().toggleBlockquote().run()}),(0,M.jsx)(Y,{icon:Xe,label:r(`content.richText.bulletList`),keys:`Mod+Shift+8`,pressed:i.bulletList,disabled:!1,onClick:()=>a().toggleBulletList().run()}),n?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(te,{orientation:`vertical`,className:`mx-1 h-5`}),(0,M.jsx)(Y,{icon:Qe,label:r(`assist.rewrite.open`),disabled:!1,onClick:n})]}):null]})})},fg=({key:e,editor:t,onPaste:n,onDrop:r,allowedMimeTypes:i,consumePasteEvent:a})=>new O({key:e||new A(`fileHandler`),props:{handleDrop(e,n){if(!r||n.dataTransfer?.types.includes(`application/x-prosemirror-slice`)||!n.dataTransfer?.files.length)return!1;let a=e.posAtCoords({left:n.clientX,top:n.clientY}),o=Array.from(n.dataTransfer.files);return i&&(o=o.filter(e=>i.includes(e.type))),o.length!==0&&(n.preventDefault(),n.stopPropagation(),r(t,o,a?.pos||0),!0)},handlePaste(e,r){if(!n||!r.clipboardData?.files.length)return!1;let o=Array.from(r.clipboardData.files),s=r.clipboardData.getData(`text/html`);return i&&(o=o.filter(e=>i.includes(e.type))),!(o.length===0||(r.preventDefault(),r.stopPropagation(),n(t,o,s),s.length>0&&!a))}}}),pg=G.create({name:`fileHandler`,addOptions(){return{onPaste:void 0,onDrop:void 0,allowedMimeTypes:void 0,consumePasteEvent:!1}},addProseMirrorPlugins(){return[fg({key:new A(this.name),editor:this.editor,allowedMimeTypes:this.options.allowedMimeTypes,onDrop:this.options.onDrop,onPaste:this.options.onPaste,consumePasteEvent:this.options.consumePasteEvent})]}}),mg=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,hg=`ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2`,gg=`numeric`,_g=`ascii`,vg=`alpha`,yg=`asciinumeric`,bg=`alphanumeric`,xg=`domain`,Sg=`emoji`,Cg=`scheme`,wg=`slashscheme`,Tg=`whitespace`;function Eg(e,t){return e in t||(t[e]=[]),t[e]}function Dg(e,t,n){t[gg]&&(t[yg]=!0,t[bg]=!0),t[_g]&&(t[yg]=!0,t[vg]=!0),t[yg]&&(t[bg]=!0),t[vg]&&(t[bg]=!0),t[bg]&&(t[xg]=!0),t[Sg]&&(t[xg]=!0);for(let r in t){let t=Eg(r,n);t.indexOf(e)<0&&t.push(e)}}function Og(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function kg(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}kg.groups={},kg.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){let r=t.jr[n][0],i=t.jr[n][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r||=kg.groups;let i;return t&&t.j?i=t:(i=new kg(t),n&&r&&Dg(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,n,r)},tt(e,t,n,r){r||=kg.groups;let i=this;if(t&&t.j)return i.j[e]=t,t;let a=t,o,s=i.go(e);return s?(o=new kg,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new kg,a&&(r&&(o.t&&typeof o.t==`string`?Dg(a,Object.assign(Og(o.t,r),n),r):n&&Dg(a,n,r)),o.t=a),i.j[e]=o,o}};var X=(e,t,n,r,i)=>e.ta(t,n,r,i),Z=(e,t,n,r,i)=>e.tr(t,n,r,i),Ag=(e,t,n,r,i)=>e.ts(t,n,r,i),Q=(e,t,n,r,i)=>e.tt(t,n,r,i),jg=`WORD`,Mg=`UWORD`,Ng=`ASCIINUMERICAL`,Pg=`ALPHANUMERICAL`,Fg=`LOCALHOST`,Ig=`TLD`,Lg=`UTLD`,Rg=`SCHEME`,zg=`SLASH_SCHEME`,Bg=`NUM`,Vg=`WS`,Hg=`NL`,Ug=`OPENBRACE`,Wg=`CLOSEBRACE`,Gg=`OPENBRACKET`,Kg=`CLOSEBRACKET`,qg=`OPENPAREN`,Jg=`CLOSEPAREN`,Yg=`OPENANGLEBRACKET`,Xg=`CLOSEANGLEBRACKET`,Zg=`FULLWIDTHLEFTPAREN`,Qg=`FULLWIDTHRIGHTPAREN`,$g=`LEFTCORNERBRACKET`,e_=`RIGHTCORNERBRACKET`,t_=`LEFTWHITECORNERBRACKET`,n_=`RIGHTWHITECORNERBRACKET`,r_=`FULLWIDTHLESSTHAN`,i_=`FULLWIDTHGREATERTHAN`,a_=`AMPERSAND`,o_=`APOSTROPHE`,s_=`ASTERISK`,c_=`AT`,l_=`BACKSLASH`,u_=`BACKTICK`,d_=`CARET`,f_=`COLON`,p_=`COMMA`,m_=`DOLLAR`,h_=`DOT`,g_=`EQUALS`,__=`EXCLAMATION`,v_=`HYPHEN`,y_=`PERCENT`,b_=`PIPE`,x_=`PLUS`,S_=`POUND`,C_=`QUERY`,w_=`QUOTE`,T_=`FULLWIDTHMIDDLEDOT`,E_=`SEMI`,D_=`SLASH`,O_=`TILDE`,k_=`UNDERSCORE`,A_=`EMOJI`,j_=`SYM`,M_=Object.freeze({__proto__:null,ALPHANUMERICAL:Pg,AMPERSAND:a_,APOSTROPHE:o_,ASCIINUMERICAL:Ng,ASTERISK:s_,AT:c_,BACKSLASH:l_,BACKTICK:u_,CARET:d_,CLOSEANGLEBRACKET:Xg,CLOSEBRACE:Wg,CLOSEBRACKET:Kg,CLOSEPAREN:Jg,COLON:f_,COMMA:p_,DOLLAR:m_,DOT:h_,EMOJI:A_,EQUALS:g_,EXCLAMATION:__,FULLWIDTHGREATERTHAN:i_,FULLWIDTHLEFTPAREN:Zg,FULLWIDTHLESSTHAN:r_,FULLWIDTHMIDDLEDOT:T_,FULLWIDTHRIGHTPAREN:Qg,HYPHEN:v_,LEFTCORNERBRACKET:$g,LEFTWHITECORNERBRACKET:t_,LOCALHOST:Fg,NL:Hg,NUM:Bg,OPENANGLEBRACKET:Yg,OPENBRACE:Ug,OPENBRACKET:Gg,OPENPAREN:qg,PERCENT:y_,PIPE:b_,PLUS:x_,POUND:S_,QUERY:C_,QUOTE:w_,RIGHTCORNERBRACKET:e_,RIGHTWHITECORNERBRACKET:n_,SCHEME:Rg,SEMI:E_,SLASH:D_,SLASH_SCHEME:zg,SYM:j_,TILDE:O_,TLD:Ig,UNDERSCORE:k_,UTLD:Lg,UWORD:Mg,WORD:jg,WS:Vg}),N_=/[a-z]/,P_=/\p{L}/u,F_=/\p{Emoji}/u,I_=/\d/,L_=/\s/,R_=`\r`,z_=`
|
|
92
|
-
`,B_=`️`,V_=``,H_=``,U_=null,W_=null;function G_(e=[]){let t={};kg.groups=t;let n=new kg;U_??=Y_(mg),W_??=Y_(hg),Q(n,`'`,o_),Q(n,`{`,Ug),Q(n,`}`,Wg),Q(n,`[`,Gg),Q(n,`]`,Kg),Q(n,`(`,qg),Q(n,`)`,Jg),Q(n,`<`,Yg),Q(n,`>`,Xg),Q(n,`(`,Zg),Q(n,`)`,Qg),Q(n,`「`,$g),Q(n,`」`,e_),Q(n,`『`,t_),Q(n,`』`,n_),Q(n,`<`,r_),Q(n,`>`,i_),Q(n,`&`,a_),Q(n,`*`,s_),Q(n,`@`,c_),Q(n,"`",u_),Q(n,`^`,d_),Q(n,`:`,f_),Q(n,`,`,p_),Q(n,`$`,m_),Q(n,`.`,h_),Q(n,`=`,g_),Q(n,`!`,__),Q(n,`-`,v_),Q(n,`%`,y_),Q(n,`|`,b_),Q(n,`+`,x_),Q(n,`#`,S_),Q(n,`?`,C_),Q(n,`"`,w_),Q(n,`/`,D_),Q(n,`;`,E_),Q(n,`~`,O_),Q(n,`_`,k_),Q(n,`\\`,l_),Q(n,`・`,T_);let r=Z(n,I_,Bg,{[gg]:!0});Z(r,I_,r);let i=Z(r,N_,Ng,{[yg]:!0}),a=Z(r,P_,Pg,{[bg]:!0}),o=Z(n,N_,jg,{[_g]:!0});Z(o,I_,i),Z(o,N_,o),Z(i,I_,i),Z(i,N_,i);let s=Z(n,P_,Mg,{[vg]:!0});Z(s,N_),Z(s,I_,a),Z(s,P_,s),Z(a,I_,a),Z(a,N_),Z(a,P_,a);let c=Q(n,z_,Hg,{[Tg]:!0}),l=Q(n,R_,Vg,{[Tg]:!0}),u=Z(n,L_,Vg,{[Tg]:!0});Q(n,H_,u),Q(l,z_,c),Q(l,H_,u),Z(l,L_,u),Q(u,R_),Q(u,z_),Z(u,L_,u),Q(u,H_,u);let d=Z(n,F_,A_,{[Sg]:!0});Q(d,`#`),Z(d,F_,d),Q(d,B_,d);let f=Q(d,V_);Q(f,`#`),Z(f,F_,d);let p=[[N_,o],[I_,i]],m=[[N_,null],[P_,s],[I_,a]];for(let e=0;e<U_.length;e++)J_(n,U_[e],Ig,jg,p);for(let e=0;e<W_.length;e++)J_(n,W_[e],Lg,Mg,m);Dg(Ig,{tld:!0,ascii:!0},t),Dg(Lg,{utld:!0,alpha:!0},t),J_(n,`file`,Rg,jg,p),J_(n,`mailto`,Rg,jg,p),J_(n,`http`,zg,jg,p),J_(n,`https`,zg,jg,p),J_(n,`ftp`,zg,jg,p),J_(n,`ftps`,zg,jg,p),Dg(Rg,{scheme:!0,ascii:!0},t),Dg(zg,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{[Cg]:!0}:{[wg]:!0};r.indexOf(`-`)>=0?i[xg]=!0:N_.test(r)?I_.test(r)?i[yg]=!0:i[_g]=!0:i[gg]=!0,Ag(n,r,r,i)}return Ag(n,`localhost`,Fg,{ascii:!0}),n.jd=new kg(j_),{start:n,tokens:Object.assign({groups:t},M_)}}function K_(e,t){let n=q_(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o<r;){let s=e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d>=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function q_(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.charCodeAt(r),a,o=i<55296||i>56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function J_(e,t,n,r,i){let a,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?a=e.j[o]:(a=new kg(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new kg(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function Y_(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;`0123456789`.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}var X_={defaultProtocol:`http`,events:null,format:Q_,formatHref:Q_,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Z_(e,t=null){let n=Object.assign({},X_);e&&(n=Object.assign(n,e instanceof Z_?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}Z_.prototype={o:X_,ignoreTags:[],defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i&&(typeof i==`object`?(i=n.t in i?i[n.t]:X_[e],typeof i==`function`&&r&&(i=i(t,n))):typeof i==`function`&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`&&t!=null&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}};function Q_(e){return e}function $_(e,t){this.t=`token`,this.v=e,this.tk=t}$_.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n&&r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=X_.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}};function ev(e,t){class n extends $_{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}var tv=ev(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),nv=ev(`text`),rv=ev(`nl`),iv=ev(`url`,{isLink:!0,toHref(e=X_.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==Fg&&e[1].t===f_}}),av=e=>new kg(e);function ov({groups:e}){let t=e.domain.concat([a_,s_,c_,l_,u_,d_,m_,g_,v_,Bg,y_,b_,x_,S_,D_,j_,O_,k_]),n=[o_,f_,p_,h_,__,y_,C_,w_,E_,Yg,Xg,Ug,Wg,Kg,Gg,qg,Jg,Zg,Qg,$g,e_,t_,n_,r_,i_],r=[a_,o_,s_,l_,u_,d_,m_,g_,v_,Ug,Wg,y_,b_,x_,S_,C_,D_,j_,O_,k_],i=av(),a=Q(i,O_);X(a,r,a),X(a,e.domain,a);let o=av(),s=av(),c=av();X(i,e.domain,o),X(i,e.scheme,s),X(i,e.slashscheme,c),X(o,r,a),X(o,e.domain,o);let l=Q(o,c_);Q(a,c_,l),Q(s,c_,l),Q(c,c_,l);let u=Q(a,h_);X(u,r,a),X(u,e.domain,a);let d=av();X(l,e.domain,d),X(d,e.domain,d);let f=Q(d,h_);X(f,e.domain,d);let p=av(tv);X(f,e.tld,p),X(f,e.utld,p),Q(l,Fg,p);let m=Q(d,v_);Q(m,v_,m),X(m,e.domain,d),X(p,e.domain,d),Q(p,h_,f),Q(p,v_,m);let h=Q(o,v_),g=Q(o,h_);Q(h,v_,h),X(h,e.domain,o),X(g,r,a),X(g,e.domain,o);let _=av(iv);X(g,e.tld,_),X(g,e.utld,_),X(_,e.domain,o),X(_,r,a),Q(_,h_,g),Q(_,v_,h),Q(_,c_,l);let v=Q(_,f_),y=av(iv);X(v,e.numeric,y);let b=av(iv),x=av();X(b,t,b),X(b,n,x),X(x,t,b),X(x,n,x),Q(_,D_,b),Q(y,D_,b);let S=Q(s,f_),C=Q(Q(Q(c,f_),D_),D_);X(s,e.domain,o),Q(s,h_,g),Q(s,v_,h),X(c,e.domain,o),Q(c,h_,g),Q(c,v_,h),X(S,e.domain,b),Q(S,D_,b),Q(S,C_,b),X(C,e.domain,b),X(C,t,b),Q(C,D_,b);let ee=[[Ug,Wg],[Gg,Kg],[qg,Jg],[Yg,Xg],[Zg,Qg],[$g,e_],[t_,n_],[r_,i_]];for(let e=0;e<ee.length;e++){let[r,i]=ee[e],a=Q(b,r);Q(x,r,a);let o=av(iv);X(a,t,o);let s=av();X(a,n,s),Q(a,i,b),X(o,t,o),X(o,n,s),X(s,t,o),X(s,n,s),Q(o,i,b),Q(s,i,b)}return Q(i,Fg,_),Q(i,Hg,rv),{start:i,tokens:M_}}function sv(e,t,n){let r=n.length,i=0,a=[],o=[];for(;i<r;){let s=e,c=null,l=null,u=0,d=null,f=-1;for(;i<r&&!(c=s.go(n[i].t));)o.push(n[i++]);for(;i<r&&(l=c||s.go(n[i].t));)c=null,s=l,s.accepts()?(f=0,d=s):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(a.push(cv(nv,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(cv(e,t,r))}}return o.length>0&&a.push(cv(nv,t,o)),a}function cv(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}var lv=typeof console<`u`&&console&&console.warn||(()=>{}),uv=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,$={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function dv(){return kg.groups={},$.scanner=null,$.parser=null,$.tokenQueue=[],$.pluginQueue=[],$.customSchemes=[],$.initialized=!1,$}function fv(e,t=!1){if($.initialized&&lv(`linkifyjs: already initialized - will not register custom scheme "${e}" ${uv}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
|
|
93
|
-
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
94
|
-
2. Cannot start or end with "-"
|
|
95
|
-
3. "-" cannot repeat`);$.customSchemes.push([e,t])}function pv(){$.scanner=G_($.customSchemes);for(let e=0;e<$.tokenQueue.length;e++)$.tokenQueue[e][1]({scanner:$.scanner});$.parser=ov($.scanner.tokens);for(let e=0;e<$.pluginQueue.length;e++)$.pluginQueue[e][1]({scanner:$.scanner,parser:$.parser});return $.initialized=!0,$}function mv(e){return $.initialized||pv(),sv($.parser.start,e,K_($.scanner.start,e))}mv.scan=K_;function hv(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new Z_(n),i=mv(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var gv=`[\0- \xA0 -\u2029 ]`,_v=new RegExp(gv),vv=RegExp(`${gv}$`),yv=RegExp(`${gv}+$`),bv=new RegExp(gv,`g`);function xv(e,t,n){let r=e.doc.resolve(t.to);if(!r.nodeBefore?.isText)return;let i=e.doc.textBetween(t.from,t.to,``,``).match(yv)?.[0];if(!i)return;let a=t.to-i.length,o=Cl(a,t.to,e.doc).filter(e=>e.mark.type===n);if(!o.length)return;let{nodeAfter:s}=r;if(s&&o.some(e=>e.mark.isInSet(s.marks)))return;let c=e.storedMarks;e.removeMark(a,t.to,n),e.setStoredMarks(c),e.selection.empty&&e.selection.from===t.to&&e.removeStoredMark(n)}function Sv(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function Cv(e){return new O({key:new A(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r,s=Jc(n.doc,[...t]);if(!t.some(Os)){let t=[];s.steps.forEach((e,n)=>{if(!(e instanceof Ee)||!e.slice.size)return;let r=s.mapping.slice(n+1),i=r.map(e.from,1),a=r.map(e.from+e.slice.size,-1);i<a&&t.push({from:i,to:a})}),t.sort((e,t)=>t.to-e.to),t.forEach(t=>xv(o,t,e.type))}if(Sl(s).forEach(({newRange:t})=>{let n=Yc(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!vv.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(_v).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=mv(n).map(t=>t.toObject(e.defaultProtocol));if(!Sv(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>!r.schema.marks.code||!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{Cl(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function wv(e){return new O({key:new A(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=yl(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}var Tv=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,Ev=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function Dv(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;--r)n+=1;return n%2==1}function Ov(e,t){let n=0,r=0;for(;r<t;){if(e[r]!=="`"){r+=1;continue}if(n===0&&Dv(e,r)){r+=1;continue}let i=0;for(;r<t&&e[r]==="`";)i+=1,r+=1;n===0?n=i:i===n&&(n=0)}return n>0}function kv(e,t,n){let[,r,i]=t;return(t.index?e[t.index-1]:void 0)===`!`||Dv(e,t.index??0)||Ov(e,t.index??0)?!1:!!r.trim()&&n(i)}function Av(e){let[t,n,r,,i,a,o]=e,s=i??a??o;return{index:e.index??0,text:t,replaceWith:n,data:{href:r,title:s||null,markdown:!0}}}function jv(e,t){return e.index<t.index+t.text.length&&t.index<e.index+e.text.length}function Mv(e){return{href:e.data?.href,title:e.data?.title??null}}function Nv(e){let t=Md({find:t=>{let n=Tv.exec(t);return!n||!kv(t,n,e.isAllowedHref)?null:Av(n)},type:e.type,getAttributes:Mv});return new ed({find:t.find,handler:e=>{let n=t.handler(e);return n!==null&&e.state.tr.steps.length&&e.state.tr.setMeta(`preventAutolink`,!0),n}})}function Pv(e){let t=Ld({find:t=>{let n=[];for(let r of t.matchAll(Ev))kv(t,r,e.isAllowedHref)&&n.push(Av(r));let r=(e.findPlainUrls?.call(e,t)??[]).filter(e=>!n.some(t=>jv(t,e)));return[...n,...r]},type:e.type,getAttributes:Mv});return new ld({find:t.find,handler:e=>{let n=t.handler(e);return n!==null&&e.state.tr.steps.length&&e.match.data?.markdown&&e.state.tr.setMeta(`preventAutolink`,!0),n}})}function Fv(e){return new O({key:new A(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=hv(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function Iv(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(bv,``).match(RegExp(`^(?:(?:${n.map(e=>e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)).join(`|`)}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,`i`))}var Lv=cd.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e==`string`){fv(e);return}fv(e.scheme,e.optionalSlashes)})},onDestroy(){dv()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!Iv(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target??null},rel:{default:this.options.HTMLAttributes.rel??null},class:{default:this.options.HTMLAttributes.class??null},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!Iv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!Iv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,W(this.options.HTMLAttributes,e),0]:[`a`,W(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!Iv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!Iv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addInputRules(){return this.options.markdownLinks?[Nv({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Iv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){let e=e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options;hv(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!Iv(e,n),protocols:n,defaultProtocol:r})).forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t};return this.options.markdownLinks?[Pv({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Iv(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:e})]:[Ld({find:e,type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(Cv({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Iv(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(wv({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(Fv({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}});function Rv(e){return e===`left`||e===`right`||e===`center`?e:null}function zv(e){let t=(e.style.textAlign||``).trim().toLowerCase(),n=(e.getAttribute(`align`)||``).trim().toLowerCase();return Rv(t||n)}function Bv(e){return Rv(e?.align)}function Vv(){return{default:null,parseHTML:e=>zv(e),renderHTML:e=>{let t=Rv(e.align);return qu(t)?{style:`text-align: ${t}`}:{}}}}function Hv(e){let t=e.parentElement,n=e.closest(`table`);if(!t||!n)return null;let r=Array.from(t.children).indexOf(e),i=n.querySelectorAll(`colgroup > col`)[r]?.getAttribute(`width`);return i?[parseInt(i,10)]:null}function Uv(e){let t=e.getAttribute(`colwidth`);return t?t.split(`,`).map(e=>parseInt(e,10)):Hv(e)}var Wv=/[ \t\r\n\f]+/g;function Gv(e){return e.children.length>0?!1:(e.textContent??``).replace(Wv,``)===``}function Kv(e){let t=e.createAndFill();if(!t)throw Error(`[tiptap error]: "${e.name}" has no default content to backfill.`);return t.content}function qv(e,t,n){if(!(n in t))return;let r=t[n];(r===1||r===`1`||r==null)&&delete e[n]}var Jv=K.create({name:`tableCell`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:Uv},align:Vv()}},tableRole:`cell`,isolating:!0,parseHTML(){return[{tag:`td`,getAttrs:e=>Gv(e)?{}:!1,getContent:(e,t)=>Kv(t.nodes[this.name])},{tag:`td`}]},renderHTML({HTMLAttributes:e}){let t=W(this.options.HTMLAttributes,e);return qv(t,e,`colspan`),qv(t,e,`rowspan`),[`td`,t,0]}}),Yv=K.create({name:`tableHeader`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:Uv},align:Vv()}},tableRole:`header_cell`,isolating:!0,parseHTML(){return[{tag:`th`,getAttrs:e=>Gv(e)?{}:!1,getContent:(e,t)=>Kv(t.nodes[this.name])},{tag:`th`}]},renderHTML({HTMLAttributes:e}){let t=W(this.options.HTMLAttributes,e);return qv(t,e,`colspan`),qv(t,e,`rowspan`),[`th`,t,0]}}),Xv=K.create({name:`tableRow`,addOptions(){return{HTMLAttributes:{}}},content:`(tableCell | tableHeader)*`,tableRole:`row`,parseHTML(){return[{tag:`tr`}]},renderHTML({HTMLAttributes:e}){return[`tr`,W(this.options.HTMLAttributes,e),0]}});function Zv(e,t){return t?[`width`,`${Math.max(t,e)}px`]:[`min-width`,`${e}px`]}function Qv(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l!==null)for(let e=0,n=0;e<l.childCount;e+=1){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e+=1,n+=1){let l=i===n?a:d&&d[e],u=l?`${l}px`:``;if(o+=l||r,l||(s=!1),c){if(c.style.width!==u){let[e,t]=Zv(r,l);c.style.setProperty(e,t)}c=c.nextSibling}else{let e=document.createElement(`col`),[n,i]=Zv(r,l);e.style.setProperty(n,i),t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}let d=e.attrs.style&&typeof e.attrs.style==`string`&&/\bwidth\s*:/i.test(e.attrs.style);s&&!d?(n.style.width=`${o}px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=`${o}px`)}var $v=class{constructor(e,t,n,r={}){this.node=e,this.cellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`));for(let[e,t]of Object.entries(r))t!=null&&(e===`style`?this.table.style.cssText=String(t):this.table.setAttribute(e,String(t)));e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),Qv(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type===this.node.type&&(this.node=e,Qv(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){let t=e.target,n=this.dom.contains(t),r=this.contentDOM.contains(t);return!(!n||r||e.type!==`attributes`&&e.type!==`childList`&&e.type!==`characterData`)}};function ey(e,t,n,r){let i=0,a=!0,o=[],s=e.firstChild;if(!s)return{};for(let e=0,c=0;e<s.childCount;e+=1){let{colspan:l,colwidth:u}=s.child(e).attrs;for(let e=0;e<l;e+=1,c+=1){let s=n===c?r:u&&u[e];i+=s||t,s||(a=!1);let[l,d]=Zv(t,s);o.push([`col`,{style:`${l}: ${d}`}])}}let c=a?`${i}px`:``,l=a?``:`${i}px`;return{colgroup:[`colgroup`,{},...o],tableWidth:c,tableMinWidth:l}}function ty(e,t){return t?e.createChecked(null,t):e.createAndFill()}function ny(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;let t={};return Object.keys(e.nodes).forEach(n=>{let r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}function ry(e,t,n,r,i){let a=ny(e),o=[],s=[];for(let e=0;e<n;e+=1){let e=ty(a.cell,i);if(e&&s.push(e),r){let e=ty(a.header_cell,i);e&&o.push(e)}}let c=[];for(let e=0;e<t;e+=1)c.push(a.row.createChecked(null,r&&e===0?o:s));return a.table.createChecked(null,c)}function iy(e){return e instanceof J}var ay=({editor:e})=>{let{selection:t}=e.state;if(!iy(t))return!1;let n=0;return Xc(t.ranges[0].$from,e=>e.type.name===`table`)?.node.descendants(e=>{if(e.type.name===`table`)return!1;[`tableCell`,`tableHeader`].includes(e.type.name)&&(n+=1)}),n===t.ranges.length&&(e.commands.deleteTable(),!0)};function oy(e,t){let n=e.mapping.map(t);if(Xc(e.selection.$from,e=>e.type.name===`table`)?.pos===n)return;let r=e.doc.nodeAt(n);if(!r)return;let i=n+r.nodeSize-1;e.setSelection(k.near(e.doc.resolve(i),-1))}function sy(e){let t=``,n=0;for(;n<e.length;){if(e[n]===`\\`&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}if(e[n]!=="`"){t+=e[n++];continue}let r=0;for(;n+r<e.length&&e[n+r]==="`";)r+=1;let i=n+r,a=!1;for(;i<e.length;){if(e[i]!=="`"){i+=1;continue}let o=0;for(;i+o<e.length&&e[i+o]==="`";)o+=1;if(o===r){let o=e.slice(n+r,i);t+=e.slice(n,n+r)+o.replace(/\\\||\|/g,e=>e===`|`?`\\|`:e)+e.slice(i,i+r),n=i+r,a=!0;break}i+=o}a||(t+=e.slice(n,n+r),n+=r)}return t}function cy(e){return e.split(`
|
|
96
|
-
`).map(e=>!e.includes(`|`)||!e.includes("`")?e:sy(e)).join(`
|
|
97
|
-
`)}function ly(e){return(e||``).replaceAll(``,` `).replace(/\s+/g,` `).trim()}function uy(e,t){return t?e.split(t).join(`
|
|
98
|
-
`):e}function dy(e){return e.replace(/\\.|\|/g,e=>e===`|`?`\\|`:e)}function fy(e,t,n={}){if(!e||!e.content||e.content.length===0)return``;let r=[];e.content.forEach(e=>{let i=[];e.content&&e.content.forEach(e=>{let r=``;r=e.content&&Array.isArray(e.content)&&e.content.length>1?e.content.map(e=>uy(t.renderChildren(e),n.cellLineSeparator)).join(`
|
|
99
|
-
`):uy(e.content?t.renderChildren(e.content):``,n.cellLineSeparator);let a=dy(ly(r.replace(/[ \t]*\r?\n[ \t]*/g,`<br>`))),o=e.type===`tableHeader`,s=Bv(e.attrs);i.push({text:a,isHeader:o,align:s})}),r.push(i)});let i=r.reduce((e,t)=>Math.max(e,t.length),0);if(i===0)return``;let a=Array.from({length:i}).fill(0);r.forEach(e=>{for(let t=0;t<i;t+=1){let n=(e[t]?.text||``).length;n>a[t]&&(a[t]=n),a[t]<3&&(a[t]=3)}});let o=(e,t)=>e+` `.repeat(Math.max(0,t-e.length)),s=r[0],c=s.some(e=>e.isHeader),l=Array.from({length:i}).fill(null);r.forEach(e=>{for(let t=0;t<i;t+=1)!l[t]&&e[t]?.align&&(l[t]=e[t].align)});let u=`
|
|
100
|
-
`,d=Array.from({length:i}).map((e,t)=>c&&s[t]&&s[t].text||``);return u+=`| ${d.map((e,t)=>o(e,a[t])).join(` | `)} |\n`,u+=`| ${a.map((e,t)=>{let n=Math.max(3,e),r=l[t];return r===`left`?`:${`-`.repeat(n)}`:r===`right`?`${`-`.repeat(n)}:`:r===`center`?`:${`-`.repeat(n)}:`:`-`.repeat(n)}).join(` | `)} |\n`,(c?r.slice(1):r).forEach(e=>{u+=`| ${Array.from({length:i}).fill(0).map((t,n)=>o(e[n]&&e[n].text||``,a[n])).join(` | `)} |\n`}),u}var py=new A(`preserveCellSelectionOnContextMenu`);function my(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(n)return n.pos;if(!(t.target instanceof Node))return null;try{return e.posAtDOM(t.target,0)}catch{return null}}function hy(e,t){let n=!1;return e.forEachCell((e,r)=>{t>=r&&t<r+e.nodeSize&&(n=!0)}),n}function gy(){return new O({key:py,props:{handleDOMEvents:{mousedown(e,t){if(t.button!==2)return!1;let{selection:n}=e.state;if(!iy(n)||n.ranges.length<2)return!1;let r=my(e,t);return r==null||!hy(n,r)?!1:(t.preventDefault(),!0)}}}})}var _y=K.create({name:`table`,addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:$v,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:`tableRow+`,tableRole:`table`,isolating:!0,group:`block`,parseHTML(){return[{tag:`table`}]},renderHTML({node:e,HTMLAttributes:t}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=ey(e,this.options.cellMinWidth),a=t.style;function o(){return a||(r?`width: ${r}`:`min-width: ${i}`)}let s=[`table`,W(this.options.HTMLAttributes,t,{style:o()}),n,[`tbody`,0]];return this.options.renderWrapper?[`div`,{class:`tableWrapper`},s]:s},parseMarkdown:(e,t)=>{let n=[],r=Array.isArray(e.align)?e.align:[];if(e.header){let i=[];e.header.forEach((e,n)=>{let a=Rv(r[n]??e.align),o=a?{align:a}:{};i.push(t.createNode(`tableHeader`,o,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},i))}return e.rows&&e.rows.forEach(e=>{let i=[];e.forEach((e,n)=>{let a=Rv(r[n]??e.align),o=a?{align:a}:{};i.push(t.createNode(`tableCell`,o,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},i))}),t.createNode(`table`,void 0,n)},renderMarkdown:(e,t)=>fy(e,t),markdownTokenizer:{name:`table`,level:`block`,start:e=>{let t=e.split(`
|
|
101
|
-
`);if(t.length<2)return-1;let n=t[1];return!/^[ \t|:]*-[ \t|:-]*$/.test(n)||!n.includes(`|`)?-1:t[0].includes(`|`)?0:-1},tokenize(e,t,n){let r=e.indexOf(`
|
|
102
|
-
|
|
103
|
-
`),i=r>=0?e.slice(0,r):e,a=i.split(`
|
|
104
|
-
`);if(a.length<2)return;let o=a[1];if(!/^[ \t|:]*-[ \t|:-]*$/.test(o)||!o.includes(`|`))return;let s=cy(i);if(s===i)return;let c=n.blockTokens(s)[0];if(c?.type!==`table`||!c.raw)return;let l=c.raw.split(`
|
|
105
|
-
`).length,u=e.split(`
|
|
106
|
-
`).slice(0,l).join(`
|
|
107
|
-
`);return{...c,raw:u}}},addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:a})=>{let o=ry(a.schema,e,t,n);if(i){let e=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(k.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>Dm(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>Om(e,t),deleteColumn:()=>({state:e,dispatch:t})=>{let n=Xc(e.selection.$from,e=>e.type.name===`table`);return Am(e,t&&(e=>{n&&oy(e,n.pos),t(e)}))},addRowBefore:()=>({state:e,dispatch:t})=>Nm(e,t),addRowAfter:()=>({state:e,dispatch:t})=>Pm(e,t),deleteRow:()=>({state:e,dispatch:t})=>{let n=Xc(e.selection.$from,e=>e.type.name===`table`);return Im(e,t&&(e=>{n&&oy(e,n.pos),t(e)}))},deleteTable:()=>({state:e,dispatch:t})=>Ym(e,t),mergeCells:()=>({state:e,dispatch:t})=>zm(e,t),splitCell:()=>({state:e,dispatch:t})=>Bm(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>Gm(`column`)(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>Gm(`row`)(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>Km(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>zm(e,t)?!0:Bm(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>Hm(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>Jm(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>Jm(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&Cm(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){let n=J.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:ay,"Mod-Backspace":ay,Delete:ay,"Mod-Delete":ay}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[vh({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Mh({allowTableNodeSelection:this.options.allowTableNodeSelection}),gy()]},addNodeView(){let e=this.options.resizable&&this.editor.isEditable,t=this.options.View;return e||!t?null:({node:e,view:n,HTMLAttributes:r})=>{let i=W(this.options.HTMLAttributes,r);return new t(e,this.options.cellMinWidth,n,i)}},extendNodeSchema(e){return{tableRole:U(H(e,`tableRole`,{name:e.name,options:e.options,storage:e.storage}))}}}),vy=G.create({name:`tableKit`,addExtensions(){let e=[];return this.options.table!==!1&&e.push(_y.configure(this.options.table)),this.options.tableCell!==!1&&e.push(Jv.configure(this.options.tableCell)),this.options.tableHeader!==!1&&e.push(Yv.configure(this.options.tableHeader)),this.options.tableRow!==!1&&e.push(Xv.configure(this.options.tableRow)),e}});function yy(e={}){return new O({view(t){return new by(t,e)}})}var by=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc){if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else this.updateOverlay()}}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(!t||i)return null;let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=Ue(this.editorView.state.doc,a,this.editorView.dragging.slice);e!=null&&(a=e)}return a}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},xy=class e extends D{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):D.near(r)}content(){return w.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new Sy(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!wy(e)||!Ty(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!E.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};xy.prototype.visible=!1,xy.findFrom=xy.findGapCursorFrom,D.jsonID(`gapcursor`,xy);var Sy=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return xy.valid(t)?new xy(t):D.near(t)}};function Cy(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function wy(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||Cy(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Ty(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||Cy(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Ey(){return new O({props:{decorations:jy,createSelectionBetween(e,t,n){return t.pos==n.pos&&xy.valid(n)?new xy(n):null},handleClick:ky,handleKeyDown:Dy,handleDOMEvents:{beforeinput:Ay}}})}var Dy=ns({ArrowLeft:Oy(`horiz`,-1),ArrowRight:Oy(`horiz`,1),ArrowUp:Oy(`vert`,-1),ArrowDown:Oy(`vert`,1)});function Oy(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof k){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=xy.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new xy(c))),!0):!1}}function ky(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!xy.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&E.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new xy(r))),!0)}function Ay(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof xy))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=T.empty;for(let e=r.length-1;e>=0;e--)i=T.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new w(i,0,0));return a.setSelection(k.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function jy(e){if(!(e.selection instanceof xy))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,R.create(e.doc,[oo.widget(e.selection.head,t,{key:`gapcursor`})])}G.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new O({key:new A(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var My=G.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[yy(this.options)]}});G.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new O({key:new A(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return R.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(oo.node(t,t+e.nodeSize,{class:this.options.className}))}),R.create(e,a)}}})]}});var Ny=G.create({name:`gapCursor`,addProseMirrorPlugins(){return[Ey()]},extendNodeSchema(e){return{allowGapCursor:U(H(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),Py=`placeholder`,Fy=new A(`tiptap__placeholder`);function Iy(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),oo.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function Ly(e,t){return typeof e==`function`?e(t):e}function Ry({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:a,to:o}){let{anchor:s}=i,c=[],l=e.isEmpty;return r.nodesBetween(a,o,(r,i)=>{let a=s>=i&&s<=i+r.nodeSize,o=!r.isLeaf&&Fl(r);return r.type.isTextblock&&(a||!t.showOnlyCurrent)&&o&&c.push(Iy({editor:e,isEmptyDoc:l,dataAttribute:n,hasAnchor:a,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:Ly(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:a})},node:r,pos:i})),t.includeChildren}),c}function zy({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!e.isEditable&&t.showOnlyWhenEditable)return null;let{anchor:a}=i,o=[],s=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),c=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(c&&c.type.isTextblock&&Fl(c)){let r=a>=l&&a<=l+c.nodeSize;o.push(Iy({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:Ly(t.emptyNodeClass,{editor:e,node:c,pos:l,hasAnchor:r})},node:c,pos:l}))}}else o.push(...Ry({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return R.create(r,o)}function By(e,t){let n=e.resolve(t);if(n.depth===0){let e=n.nodeAfter??n.nodeBefore;if(!e)return{from:t,to:t};let r=n.nodeAfter?t:t-e.nodeSize;return{from:r,to:r+e.nodeSize}}let r=n.before(1);return{from:r,to:r+n.node(1).nodeSize}}function Vy(e,t){return{from:Math.max(0,t.from-1),to:Math.min(e.content.size,t.to-1)}}function Hy(e,t,n){let r=[];return e.forEach((e,i)=>{let a=i,o=a+e.nodeSize,s=a+1,c=o+1;s<n&&c>t&&r.push({from:a,to:o})}),r}function Uy(e){if(e.length===0)return[];let t=[...e].sort((e,t)=>e.from-t.from),n=[{...t[0]}];for(let e=1;e<t.length;e+=1){let r=n[n.length-1],i=t[e];i.from<=r.to?r.to=Math.max(r.to,i.to):n.push({...i})}return n}function Wy(e,t){let n=Hy(e,t.from,t.to);return n.push(Vy(e,By(e,t.from))),t.to>t.from?n.push(Vy(e,By(e,Math.min(t.to,e.content.size+1)-1))):t.from<e.content.size+1&&n.push(Vy(e,By(e,Math.min(t.from+1,e.content.size)))),n}function Gy(e,t,n){let r=[];if(e.docChanged){let t=Sl(e);for(let e of t)r.push(...Wy(n.doc,e.newRange))}return e.selectionSet&&(r.push(Vy(n.doc,By(n.doc,e.mapping.map(t.selection.anchor)))),r.push(Vy(n.doc,By(n.doc,n.selection.anchor)))),Uy(r)}function Ky(e,t,n){let r=Math.max(0,Math.min(e,n.content.size));return{from:r,to:Math.max(r,Math.min(t,n.content.size))}}function qy({decorations:e,ranges:t,editor:n,options:r,dataAttribute:i,doc:a,selection:o}){let s=e;for(let e of t){let{from:t,to:c}=Ky(e.from,e.to,a),l=s.find(t,c).filter(e=>e.from>=t&&e.to<=c);l.length&&(s=s.remove(l));let u=Ry({editor:n,options:r,dataAttribute:i,doc:a,selection:o,from:t,to:c});u.length&&(s=s.add(a,u))}return s}function Jy({editor:e,options:t,dataAttribute:n}){return{init(r,i){return zy({editor:e,options:t,dataAttribute:n,doc:i.doc,selection:i.selection})??R.empty},apply(r,i,a,o){return!r.docChanged&&!r.selectionSet?i:qy({decorations:i.map(r.mapping,r.doc),ranges:Gy(r,a,o),editor:e,options:t,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function Yy(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function Xy({editor:e,options:t}){let n=t.dataAttribute?`data-${Yy(t.dataAttribute)}`:`data-${Py}`,r=t.showOnlyCurrent&&!t.includeChildren;return new O({key:Fy,...r?{}:{state:Jy({editor:e,options:t,dataAttribute:n})},props:{decorations:r?({doc:r,selection:i})=>zy({editor:e,options:t,dataAttribute:n,doc:r,selection:i}):n=>t.showOnlyWhenEditable&&!e.isEditable?R.empty:Fy.getState(n)??R.empty}})}var Zy=G.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:Py,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[Xy({editor:this.editor,options:this.options})]}});function Qy(e,t){return!e.selection.empty&&!Il(e.selection)&&t.isEditable}function $y(e,t){return Qy(e,t)&&!t.isFocused&&!t.view.dragging}function eb(){var e;(e=window.getSelection())==null||e.removeAllRanges()}function tb(e){e.focus()}G.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new O({key:new A(`selection`),props:{decorations(n){return $y(n,e)?R.create(n.doc,[oo.inline(n.selection.from,n.selection.to,{class:t.className})]):null},handleDOMEvents:{blur(t){return Qy(t.state,e)&&eb(),!1},focus(t){return Qy(t.state,e)&&requestAnimationFrame(()=>{!e.isDestroyed&&t.hasFocus()&&tb(t)}),!1}}}})]}});function nb({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var rb=G.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new A(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new O({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!nb({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!nb({node:r,types:n})}}})]}}),ib=G.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>Es(e,t),redo:()=>({state:e,dispatch:t})=>Ds(e,t)}},addProseMirrorPlugins(){return[ws(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),ab=new WeakSet,ob=new WeakSet;function sb(e){let t=e;return ab.add(t),t}function cb(e){return Array.isArray(e)&&ab.has(e)}function lb(e){return e.flatMap(e=>e==null?[]:Array.isArray(e)&&ob.has(e)&&!cb(e)?lb(e):[e])}function ub(e,t){if(e===`slot`)return 0;if(e instanceof Function){let n=e(t);return Array.isArray(n)&&!cb(n)&&!ob.has(n)?sb(n):n}let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);if(Array.isArray(n)){if(cb(n))return sb([e,r,n]);if(n.length===0)return sb([e,r]);let t=lb(n);return t.length===0?sb([e,r]):sb([e,r,...t])}return sb(n==null?[e,r]:[e,r,n])}var db=(e,t)=>ub(e,t),fb=(e,t)=>{let{state:n}=e,{selection:r}=n;if(!r.empty)return!1;let{$from:i}=r;if(i.parentOffset!==0)return!1;let a=i.depth-1;if(a<0)return!1;let o=i.node(a),s=i.index(a);if(s===0)return!1;if(o.type===t)return e.commands.lift(t.name);let c=o.child(s-1);if(c.type!==t||!c.lastChild?.isTextblock)return!1;let l=i.before()-1-1;return e.commands.command(({tr:e,dispatch:t})=>{if(!t)return!0;let n=i.parent.content,r=new w(n,0,0);return e.replace(l,i.after(),r),e.setSelection(k.create(e.doc,l+n.size)),e.scrollIntoView(),t(e),!0})},pb=/^\s*>\s$/,mb=K.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return db(`blockquote`,{...W(this.options.HTMLAttributes,e),children:db(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(`
|
|
108
|
-
`).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(`
|
|
109
|
-
`))}),n.join(`
|
|
110
|
-
>
|
|
111
|
-
`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>fb(this.editor,this.type)}},addInputRules(){return[Fd({find:pb,type:this.type})]}}),hb=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,gb=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,_b=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,vb=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,yb=cd.create({name:`bold`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!==`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name===this.name},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return db(`strong`,{...W(this.options.HTMLAttributes,e),children:db(`slot`,{})})},markdownTokenName:`strong`,parseMarkdown:(e,t)=>t.applyMark(`bold`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<strong>`,close:`</strong>`}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Md({find:hb,type:this.type}),Md({find:_b,type:this.type})]},addPasteRules(){return[Ld({find:gb,type:this.type}),Ld({find:vb,type:this.type})]}}),bb=e=>{let t=/`([^`]+)`(?!`)$/.exec(e);return!t||t.index>0&&e[t.index-1]==="`"?null:{index:t.index,text:t[0],replaceWith:t[1]}},xb=e=>{let t=/`([^`]+)`(?!`)/g,n=[],r;for(;(r=t.exec(e))!==null;)r.index>0&&e[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n};function Sb(e){let t=new Set((e.match(/`+/g)||[]).map(e=>e.length)),n=1;for(;t.has(n);)n+=1;return n}var Cb=cd.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,W(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t,n)=>{var r;if(!e.content)return``;let i=typeof(n==null||(r=n.meta)==null?void 0:r.markText)==`string`?n.meta.markText:``,a="`".repeat(Sb(i)),o=i.startsWith("`")||i.endsWith("`")?` `:``;return`${a}${o}${t.renderChildren(e.content)}${o}${a}`},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Md({find:bb,type:this.type})]},addPasteRules(){return[Ld({find:xb,type:this.type})]}}),wb=4,Tb=/^```([a-z]+)?[\s\n]$/,Eb=/^~~~([a-z]+)?[\s\n]$/,Db=K.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:wb,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return t&&[...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,W(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:`code`,parseMarkdown:(e,t)=>e.raw?.startsWith("```")===!1&&e.raw?.startsWith(`~~~`)===!1&&e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[]),renderMarkdown:(e,t)=>{let n=``,r=e.attrs?.language||``;return n=e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(`
|
|
112
|
-
`):`\`\`\`${r}\n\n\`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??wb,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;if(i.parent.type!==this.type)return!1;let o=` `.repeat(t);return a?e.commands.insertContent(o):e.commands.command(({tr:e})=>{let{from:t,to:i}=r,a=n.doc.textBetween(t,i,`
|
|
113
|
-
`,`
|
|
114
|
-
`).split(`
|
|
115
|
-
`).map(e=>o+e).join(`
|
|
116
|
-
`);return e.replaceWith(t,i,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??wb,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;return i.parent.type===this.type?a?e.commands.command(({tr:e})=>{let{pos:r}=i,a=i.start(),o=i.end(),s=n.doc.textBetween(a,o,`
|
|
117
|
-
`,`
|
|
118
|
-
`).split(`
|
|
119
|
-
`),c=0,l=0,u=r-a;for(let e=0;e<s.length;e+=1){if(l+s[e].length>=u){c=e;break}l+=s[e].length+1}let d=s[c].match(/^ */)?.[0]||``,f=Math.min(d.length,t);if(f===0)return!0;let p=a;for(let e=0;e<c;e+=1)p+=s[e].length+1;return e.delete(p,p+f),r-p<=f&&e.setSelection(k.create(e.doc,p)),!0}):e.commands.command(({tr:e})=>{let{from:i,to:a}=r,o=n.doc.textBetween(i,a,`
|
|
120
|
-
`,`
|
|
121
|
-
`).split(`
|
|
122
|
-
`).map(e=>{let n=e.match(/^ */)?.[0]||``,r=Math.min(n.length,t);return e.slice(r)}).join(`
|
|
123
|
-
`);return e.replaceWith(i,a,n.schema.text(o)),!0}):!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
|
|
124
|
-
|
|
125
|
-
`);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:e})=>{if(!this.options.exitOnArrowUp)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type||r.parentOffset!==0)return!1;let a=r.before();return a>0?!1:e.commands.insertDefaultBlock({pos:a})},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(D.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[Pd({find:Tb,type:this.type,getAttributes:e=>({language:e[1]})}),Pd({find:Eb,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new O({key:new A(`codeBlockVSCodeHandler`),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData(`text/plain`),r=t.clipboardData.getData(`vscode-editor-data`),i=(r?JSON.parse(r):void 0)?.mode;if(!n||!i)return!1;let{tr:a,schema:o}=e.state,s=o.text(n.replace(/\r\n?/g,`
|
|
126
|
-
`));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(k.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),Ob=K.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
127
|
-
|
|
128
|
-
`):``}),kb=K.create({name:`hardBreak`,markdownTokenName:`br`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,W(this.options.HTMLAttributes,e)]},renderText(){return`
|
|
129
|
-
`},renderMarkdown:()=>`
|
|
130
|
-
`,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&s&&a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Ab=K.create({name:`heading`,addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:`inline*`,group:`block`,defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,W(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode(`heading`,{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{let n=e.attrs?.level?parseInt(e.attrs.level,10):1,r=`#`.repeat(n);return e.content?`${r} ${t.renderChildren(e.content)}`:``},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>Pd({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),jb=K.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,W(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!Vu(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return Il(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(k.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(E.create(t.doc,n.pos)):t.setSelection(k.create(t.doc,n.pos));else{let i=(e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType)?.create();i&&(t.insert(r,i),t.setSelection(k.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Nd({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Mb=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Nb=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Pb=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Fb=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Ib=cd.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`&&null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,W(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:`em`,parseMarkdown:(e,t)=>t.applyMark(`italic`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<em>`,close:`</em>`}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Md({find:Mb,type:this.type}),Md({find:Pb,type:this.type})]},addPasteRules(){return[Ld({find:Nb,type:this.type}),Ld({find:Fb,type:this.type})]}}),Lb=`listItem`,Rb=`textStyle`,zb=/^\s*([-+*])\s$/,Bb=K.create({name:`bulletList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul`}]},renderHTML({HTMLAttributes:e}){return[`ul`,W(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
131
|
-
`):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Lb,this.editor.getAttributes(Rb)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=Fd({find:zb,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Fd({find:zb,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Rb),editor:this.editor})),[e]}}),Vb=(e,t,n)=>{let{selection:r}=e;if(!r.empty)return null;let{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let a=-1;for(let e=i.depth;e>0;--e)if(i.node(e).type.name===t){a=e;break}if(a<0)return null;let o=i.node(a),s=i.index(a);if(s+1>=o.childCount)return null;let c=o.child(s+1);if(!n.includes(c.type.name))return null;let l=e.schema.nodes[t],u=!1;if(c.forEach(e=>{e.type===l&&e.childCount>1&&(u=!0)}),!u)return null;let d=e.doc.resolve(i.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;let f=[];return d.forEach(e=>{f.push(e)}),f.length===0?null:{listItemDepth:a,nestedList:d,nestedListPos:i.after(),insertPos:i.after(a),items:f}},Hb=(e,t,n,r)=>{let i=Vb(e,n,r);if(!i)return!1;let{selection:a}=e,{nestedList:o,nestedListPos:s,insertPos:c,items:l}=i,u=e.tr;u.delete(s,s+o.nodeSize);let d=u.mapping.map(c);return u.insert(d,T.from(l)),u.setSelection(a.map(u.doc,u.mapping)),t&&t(u),!0},Ub=(e,t,n)=>Hb(e.state,e.view.dispatch,t,n),Wb=(e,t)=>G.create({name:`${e}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let n=()=>Ub(this.editor,e,t);return{Delete:n,"Mod-Delete":n}}}),Gb=[[1e3,`m`],[900,`cm`],[500,`d`],[400,`cd`],[100,`c`],[90,`xc`],[50,`l`],[40,`xl`],[10,`x`],[9,`ix`],[5,`v`],[4,`iv`],[1,`i`]],Kb=`abcdefghijklmnopqrstuvwxyz`,qb=String.raw`\d+|[ivxlcdmIVXLCDM]+|${`[a-zA-Z]{1,2}`}`;function Jb(e){let t=e,n=``;for(let[e,r]of Gb)for(;t>=e;)n+=r,t-=e;return n}function Yb(e){return Jb(e).toUpperCase()}function Xb(e){let t=e.toLowerCase(),n=0,r=0;for(;n<t.length;){let e=!1;for(let[i,a]of Gb)if(t.startsWith(a,n)){r+=i,n+=a.length,e=!0;break}if(!e)return 0}return r}function Zb(e){if(!/^[ivxlcdmIVXLCDM]+$/.test(e))return!1;let t=Xb(e);return t<=0?!1:(e===e.toLowerCase()?Jb(t):Yb(t))===e}function Qb(e){let t=e.toLowerCase();if(t.length===1)return t.charCodeAt(0)-97+1;if(t.length===2){let e=t.charCodeAt(0)-97,n=t.charCodeAt(1)-97;return(e+1)*26+n+1}return 0}function $b(e){if(e<=26)return Kb[e-1];let t=Math.floor((e-1)/26)-1,n=(e-1)%26;return t<0?Kb[n]:Kb[t]+Kb[n]}function ex(e){if(e&&!/^\d+$/.test(e)){if(Zb(e))return e===e.toLowerCase()?`i`:`I`;if(/^[a-z]{1,2}$/.test(e))return`a`;if(/^[A-Z]{1,2}$/.test(e))return`A`}}function tx(e){if(/^\d+$/.test(e))return parseInt(e,10);let t=ex(e);if(t===`i`||t===`I`)return Xb(e);if(t===`a`||t===`A`){let t=Qb(e);return t>0?t:1}let n=parseInt(e,10);return Number.isNaN(n)?1:n}function nx(e,t){if(e===`numeric`)return String(t);switch(e){case`a`:return $b(t);case`A`:return $b(t).toUpperCase();case`i`:return Jb(t);case`I`:return Yb(t);default:return String(t)}}function rx(e){if(e.length===0)return!1;let t=ex(e[0])??`numeric`,n=tx(e[0]);if(n<1)return!1;for(let r=0;r<e.length;r++){let i=nx(t,n+r);if(e[r]!==i)return!1}return!0}function ix(e){return{type:ex(e),start:tx(e)}}function ax(e){let{type:t,start:n}=ix(e),r={};return t&&(r.type=t),n!==1&&(r.start=n),r}function ox(e,t,n=`. `){let r=t+1;if(!e||e===`1`)return`${r}${n}`;switch(e){case`a`:return`${$b(r)}${n}`;case`A`:return`${$b(r).toUpperCase()}${n}`;case`i`:return`${Jb(r)}${n}`;case`I`:return`${Yb(r)}${n}`;default:return`${r}${n}`}}function sx(e){let t=e.tokens?.[0];return!!(e.text&&e.tokens?.length===1&&t?.type===`list`&&t.ordered&&t.raw===e.text)}function cx(e,t){return t.tokenizeInline?t.parseInline(t.tokenizeInline(e)):t.parseInline([{type:`text`,raw:e,text:e}])}var lx=K.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,W(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{if(e.type!==`list_item`)return[];let n=t.parseBlockChildren??t.parseChildren,r=[];if(e.tokens&&e.tokens.length>0){if(sx(e))return{type:`listItem`,content:[{type:`paragraph`,content:cx(e.text||``,t)}]};if(e.tokens.some(e=>e.type===`paragraph`))r=n(e.tokens);else{let i=e.tokens[0];if(i&&i.type===`text`&&i.tokens&&i.tokens.length>0){if(r=[{type:`paragraph`,content:t.parseInline(i.tokens)}],e.tokens.length>1){let t=n(e.tokens.slice(1));r.push(...t)}}else r=n(e.tokens)}}return r.length===0&&(r=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:r}},renderMarkdown:(e,t,n)=>Zu(e,t,e=>{if(e.parentType===`bulletList`)return`- `;if(e.parentType===`orderedList`){var t,n;let r=((t=e.meta)==null||(t=t.parentAttrs)==null?void 0:t.start)||1;return ox((n=e.meta)==null||(n=n.parentAttrs)==null?void 0:n.type,r-1+(e.index||0),`. `)}return`- `},n,{alignNestedToPrefix:n?.parentType===`orderedList`}),addExtensions(){return[Wb(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),ux=(e,t)=>{let{$from:n}=t.selection,r=V(e,t.schema),i=null,a=n.depth,o=n.pos,s=null;for(;a>0&&s===null;)i=n.node(a),i.type===r?s=a:(--a,--o);return s===null?null:{$pos:t.doc.resolve(o),depth:s}},dx=(e,t)=>{let n=ux(e,t);if(!n)return!1;let[,r]=wl(t,e,n.$pos.pos+4);return r},fx=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),a=e.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},px=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!Ac(e.state,t)&&fx(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(r.start()+a.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}if(!Ac(e.state,t)||!Ml(e.state))return!1;let{$from:r}=e.state.selection,i=r.depth-1;return r.node(i).type!==e.schema.nodes[t]||r.index(i)!==0?!1:e.chain().liftListItem(t).run()},mx=(e,t)=>{let n=dx(e,t),r=ux(e,t);return!r||!n?!1:n>r.depth},hx=(e,t)=>{let n=dx(e,t),r=ux(e,t);return!r||!n?!1:n<r.depth},gx=(e,t)=>{if(!Ac(e.state,t)||!jl(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:mx(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():hx(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},_x=(e,t,n)=>{let{state:r}=e,{selection:i}=r;if(!i.empty)return!1;let{$from:a}=i;if(a.parentOffset!==0||!a.parent.isTextblock||Ac(r,t))return!1;let o=Tl(a);if(!o||!n.includes(o.type.name))return!1;let s=o.lastChild;if(!s||s.type.name!==t)return!1;let c=a.parent;if(!s.canReplace(s.childCount,s.childCount,T.from(c)))return!1;let l=a.before(),u=a.after(),d=l-2;return e.commands.command(({tr:e,dispatch:t})=>(t&&(e.delete(l,u).insert(d,T.from(c)),e.setSelection(k.create(e.doc,d+1)),e.scrollIntoView()),!0))},vx=G.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&gx(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&gx(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&px(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&px(e,n,r)&&(t=!0)}),t},Tab:({editor:e})=>{for(let{itemName:t,wrapperNames:n}of this.options.listTypes)if(e.state.schema.nodes[t]!==void 0&&_x(e,t,n))return!0;return!1}}}}),yx=RegExp(`^(\\s*)(${qb})([.)])\\s+(.*)$`),bx=/^\s/,xx={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function Sx(e){return yx.test(e.trimStart())}function Cx(e){let t=e.trimStart();return xx.bulletItem.test(t)||Sx(t)||xx.heading.test(t)||xx.thematicBreak.test(t)&&!t.startsWith(`-`)||/^>\s?/.test(t)||xx.codeFence.test(t)||xx.blockMath.test(t)}function wx(e){return Object.values(xx).some(t=>t.test(e))}function Tx(e){let t=[],n=[],r=!1;return e.forEach(e=>{if(r){n.push(e);return}if(e.trim()===``){r=!0,n.push(e);return}if(t.length>0&&Cx(e)){r=!0,n.push(e);return}t.push(e)}),{paragraphLines:t,blockLines:n}}function Ex(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],a=i.match(yx);if(!a)break;let[,o,s,c,l]=a,u=o.length,d=parseInt(s,10),f=isNaN(d)?ex(s):void 0,p=isNaN(d)?tx(s):d,m=[l],h=n+1,g=[i],_=!1;for(;h<e.length;){let t=e[h];if(t.match(yx))break;if(t.trim()===``)g.push(t),m.push(``),_=!0,h+=1;else if(t.match(bx)){let e=t.length-t.trimStart().length,n=u+s.length+1;g.push(t),m.push(t.slice(Math.min(e,n))),h+=1}else{if(_||wx(t))break;g.push(t),m.push(t),h+=1}}t.push({indent:u,number:p,type:f,content:m.join(`
|
|
132
|
-
`).trim(),contentLines:m,raw:g.join(`
|
|
133
|
-
`)}),r=h,n=h}return[t,r]}var Dx=RegExp(`^(${qb})([.)])\\s+(.+)$`);function Ox(e){let t=e.split(`
|
|
134
|
-
`).filter(e=>e.trim().length>0);if(t.length===0)return null;let n=[];for(let e of t){let t=e.trim().match(Dx);if(!t)return null;n.push({marker:t[1],content:t[3]})}return rx(n.map(e=>e.marker))?{type:`orderedList`,attrs:ax(n[0].marker),content:n.map(e=>({type:`listItem`,content:[{type:`paragraph`,content:[{type:`text`,text:e.content}]}]}))}:null}function kx(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i];if(a.indent===t){let{paragraphLines:o,blockLines:s}=Tx(a.contentLines),c=o.join(`
|
|
135
|
-
`).trim(),l=[];c&&l.push({type:`paragraph`,raw:c,tokens:n.inlineTokens(c)});let u=s.join(`
|
|
136
|
-
`).trim();if(u){let e=n.blockTokens(u);l.push(...e)}let d=i+1,f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){let e=kx(f,Math.min(...f.map(e=>e.indent)),n);l.push({type:`list`,ordered:!0,start:f[0].number,typeMarker:f[0].type,items:e,raw:f.map(e=>e.raw).join(`
|
|
137
|
-
`)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function Ax(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e]));else if(e.type===`text`&&e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:`listItem`,content:n}})}var jx=64;function Mx(e,t){let n=[],r=0;for(;n.length<t;){let t=e.indexOf(`
|
|
138
|
-
`,r);if(t===-1)return n.push(e.slice(r)),n;n.push(e.slice(r,t)),r=t+1}return n}function Nx(e){let t=e.indexOf(`
|
|
139
|
-
`),n=t===-1?e:e.slice(0,t);if(!yx.test(n))return[[],0,[]];let r=jx,i=Mx(e,r),a=Ex(i);for(;a[1]===i.length&&i.length===r;)r*=2,i=Mx(e,r),a=Ex(i);return[a[0],a[1],i]}var Px=`listItem`,Fx=`textStyle`,Ix=/^(\d+)\.\s$/;function Lx(e){let t=e.match(/list-style-type\s*:\s*([^;]+)/i);if(!t)return null;switch(t[1].trim().toLowerCase()){case`upper-roman`:return`I`;case`lower-roman`:return`i`;case`upper-alpha`:case`upper-latin`:return`A`;case`lower-alpha`:case`lower-latin`:return`a`;default:return null}}var Rx=K.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>{let t=e.getAttribute(`type`);if(t)return t;let n=e.getAttribute(`style`);if(n){let e=Lx(n);if(e)return e}let r=e.querySelector(`li`);if(r){let e=r.getAttribute(`style`);if(e){let t=Lx(e);if(t)return t}}return null}}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,type:n,...r}=e,i=W(this.options.HTMLAttributes,r);return t!==1&&(i.start=t),n&&n!==`1`&&(i.type=n),[`ol`,i,0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.typeMarker,i=e.items?Ax(e.items,t):[],a={};return n!==1&&(a.start=n),r&&(a.type=r),Object.keys(a).length>0?{type:`orderedList`,attrs:a,content:i}:{type:`orderedList`,content:i}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
140
|
-
`):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:()=>-1,tokenize:(e,t,n)=>{let[r,i,a]=Nx(e);if(r.length===0)return;let o=kx(r,r[0].indent,n);if(o.length!==0)return{type:`list`,ordered:!0,start:r[0]?.number||1,typeMarker:r[0]?.type,items:o,raw:a.slice(0,i).join(`
|
|
141
|
-
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Px,this.editor.getAttributes(Fx)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new O({props:{handlePaste:(e,t)=>{if((t.clipboardData?.getData(`text/html`))?.trim())return!1;let n=t.clipboardData?.getData(`text/plain`);if(!n)return!1;let r=Ox(n);if(!r)return!1;try{let t=e.state.schema.nodeFromJSON(r),n=e.state.tr.replaceSelectionWith(t);return e.dispatch(n),!0}catch{return!1}}}})]},addInputRules(){let e=(e,t)=>(!t.attrs.type||t.attrs.type===`1`)&&t.childCount+t.attrs.start===+e[1],t=Fd({find:Ix,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:e});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Fd({find:Ix,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Fx)}),joinPredicate:e,editor:this.editor})),[t]}}),zx=/^\s*(\[([( |x])?\])\s$/,Bx=`position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0`,Vx=(e,t,n)=>{var r;return(n==null||(r=n.checkboxLabel)==null?void 0:r.call(n,e,t))||`Task item checkbox for ${e.textContent||`empty task item`}`},Hx=K.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:e=>e.querySelector(`div`)??e}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,W(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>Zu(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addExtensions(){return this.options.nested?[Wb(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`);o.style.cssText=Bx;let l=e=>{let t=Vx(e,e.attrs.checked,this.options.a11y);s.setAttribute(`aria-label`,t),o.textContent=t};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=ol(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[Fd({find:zx,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),Ux=K.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,W(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
142
|
-
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=Ju(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(t){let r={type:`taskList`,raw:t.raw,items:t.items},i=e.slice(t.raw.length);return i.trim()?[r,...n.blockTokens(i)]:[r]}return n.blockTokens(e)},i=Ju(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});G.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(Bb.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(lx.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(vx.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(Rx.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(Hx.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Ux.configure(this.options.taskList)),e}});var Wx=` `,Gx=`\xA0`,Kx=K.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,W(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===Wx||n[0].text===Wx||n[0].raw===Gx||n[0].text===Gx)&&r.length===1&&r[0].type===`text`&&(r[0].text===Wx||r[0].text===Gx)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){var i,a;let e=Array.isArray(n==null||(i=n.previousNode)==null?void 0:i.content)?n.previousNode.content:[];return(n==null||(a=n.previousNode)==null?void 0:a.type)===`paragraph`&&e.length===0?Wx:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),qx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Jx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Yx=cd.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,W(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Md({find:qx,type:this.type})]},addPasteRules(){return[Ld({find:Jx,type:this.type})]}}),Xx=K.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),Zx=cd.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,W(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Qx=G.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(yb.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(mb.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(Bb.configure(this.options.bulletList)),this.options.code!==!1&&e.push(Cb.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(Db.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(Ob.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(My.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(Ny.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(kb.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(Ab.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(ib.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(jb.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(Ib.configure(this.options.italic)),this.options.listItem!==!1&&e.push(lx.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(vx.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(Lv.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(Rx.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(Kx.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(Yx.configure(this.options.strike)),this.options.text!==!1&&e.push(Xx.configure(this.options.text)),this.options.underline!==!1&&e.push(Zx.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(rb.configure(this.options?.trailingNode)),e}}),$x=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,eS=K.create({name:`image`,group:`block`,atom:!0,draggable:!0,selectable:!0,addAttributes(){return{mediaId:{default:null,parseHTML:e=>e.getAttribute(`data-media-id`)},alt:{default:null,parseHTML:e=>e.getAttribute(`alt`)||null},title:{default:null,parseHTML:e=>e.getAttribute(`title`)||null}}},parseHTML(){return[{tag:`img[data-media-id]`,getAttrs:e=>$x.test(e.getAttribute(`data-media-id`)??``)?null:!1}]},renderHTML({node:e,HTMLAttributes:t}){return[`img`,W({"data-media-id":e.attrs.mediaId},{alt:t.alt,title:t.title})]},addCommands(){return{insertMediaImage:({mediaId:e,alt:t=null})=>({commands:n})=>n.insertContent({type:this.name,attrs:{mediaId:e,alt:t||null,title:null}})}}}),tS=Lv.extend({addAttributes(){let{title:e,...t}=this.parent?.()??{};return t}}).configure({openOnClick:!1,autolink:!0,linkOnPaste:!0,defaultProtocol:`https`,HTMLAttributes:{target:null,rel:null,class:null},isAllowedUri:e=>Lp.test(e.trim())}),nS=e=>e.extend({addAttributes(){let{align:e,...t}=this.parent?.()??{};return t}}),rS=({placeholder:e,imageView:t}={})=>[Qx.configure({strike:!1,underline:!1,link:!1,heading:{levels:[1,2,3,4,5,6]}}),tS,vy.configure({table:{resizable:!0,allowTableNodeSelection:!0},tableCell:!1,tableHeader:!1}),nS(Jv),nS(Yv),t?eS.extend({addNodeView:()=>t}):eS,...e?[Zy.configure({placeholder:e})]:[]],iS=[`w1280`,`w640`],aS=e=>typeof e==`string`?e:``,oS=({node:e,updateAttributes:t,deleteNode:n,selected:r,editor:i,appearance:a=`form`})=>{let{t:c}=o(),u=typeof e.attrs.mediaId==`string`?e.attrs.mediaId:void 0,d=aS(e.attrs.alt),f=aS(e.attrs.title),p=l(u),m=iS.map(e=>p.data?.variants.find(t=>t.name===e&&t.url)?.url).find(Boolean)??p.data?.url,h=i.isEditable,g=(0,j.useId)(),_=(0,j.useId)(),y=a===`canvas`,b=(0,j.useContext)(dt)?.locale,x=(e,n)=>t({[e]:n===``?null:n});return(0,M.jsxs)(ip,{as:`figure`,"data-drag-handle":!0,"data-media-id":u,className:s(`not-prose my-4 space-y-2`,y?`font-sans`:`rounded-lg border bg-card p-2`,r&&`rounded-lg ring-2 ring-ring ring-offset-2 ring-offset-background`),children:[p.isPending?(0,M.jsx)(le,{className:s(`w-full rounded-md`,y?`h-72 rounded-xl`:`h-48`)}):m?(0,M.jsx)(`img`,{src:m,alt:d,className:s(`w-full object-contain`,y?`max-h-[32rem] rounded-xl`:`max-h-96 rounded-md`)}):(0,M.jsxs)(`div`,{className:`flex h-32 items-center justify-center gap-2 rounded-md bg-muted text-sm text-muted-foreground`,children:[(0,M.jsx)(qe,{"aria-hidden":`true`,className:`size-4`}),c(`content.richText.imageMissing`)]}),y?(0,M.jsxs)(`figcaption`,{className:`space-y-1`,children:[(0,M.jsx)(`label`,{htmlFor:_,className:`sr-only`,children:c(`entry.image.caption`)}),(0,M.jsx)(`input`,{id:_,value:f,readOnly:!h,placeholder:p.data?.caption||c(`entry.image.captionPlaceholder`),onChange:e=>x(`title`,e.target.value),className:`w-full rounded-md bg-transparent px-1 text-meta text-muted-foreground outline-none placeholder:text-muted-foreground/70 focus-visible:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}):null,(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`label`,{htmlFor:g,className:`shrink-0 text-meta font-semibold text-muted-foreground`,children:c(`content.richText.altLabel`)}),(0,M.jsx)(se,{id:g,value:d,readOnly:!h,placeholder:p.data?.alt||c(`content.richText.altPlaceholder`),inputSize:`sm`,"data-alt-input":!0,onChange:e=>x(`alt`,e.target.value)}),h?(0,M.jsx)(Ct,{assetId:u,mimeType:p.data?.mimeType,locale:b,onSuggest:e=>x(`alt`,e),className:`shrink-0`}):null,h?(0,M.jsx)(oe,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":c(`content.richText.removeImage`),onClick:n,children:(0,M.jsx)(v,{"aria-hidden":`true`})}):null]})]})},sS=e=>(0,M.jsx)(oS,{...e,appearance:`canvas`});function cS(e){let{char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:o}=e,s=n&&!r,c=Uu(t),l=RegExp(`\\s${c}$`),u=a?`^`:``,d=r?``:c,f=RegExp(s?`${u}${c}.*?(?=\\s${d}|$)`:`${u}(?:^)?${c}[^\\s${d}]*`,`gm`),p=o.nodeBefore?.isText&&o.nodeBefore.text;if(!p)return null;let m=o.pos-p.length,h=Array.from(p.matchAll(f)).pop();if(!h||h.input===void 0||h.index===void 0)return null;let g=h.input.slice(Math.max(0,h.index-1),h.index),_=RegExp(`^[${i?.join(``)}\0]?$`).test(g);if(i!==null&&!_)return null;let v=m+h.index,y=v+h[0].length;return s&&l.test(p.slice(y-1,y+1))&&(h[0]+=` `,y+=1),v<o.pos&&y>=o.pos?{range:{from:v,to:y},query:h[0].slice(t.length),text:h[0]}:null}function lS(e){return e.docChanged?e.steps.some(e=>{let t=e.slice;if(!t?.content)return!1;let n=t.content.textBetween(0,t.content.size,`
|
|
143
|
-
`);return/\s/.test(n)}):!1}function uS(e){return()=>{let t=e.state.selection.$anchor.pos,{top:n,right:r,bottom:i,left:a}=e.view.coordsAtPos(t);try{return new DOMRect(a,n,r-a,i-n)}catch{return null}}}function dS(e,t,n,r){return n?()=>{let n=r.getState(e.state)?.decorationId;return t.dom.querySelector(`[data-decoration-id="${n}"]`)?.getBoundingClientRect()||null}:uS(e)}function fS({match:e,dismissedRange:t,state:n,transaction:r,editor:i,shouldResetDismissed:a,effectiveAllowSpaces:o}){return a?.({editor:i,state:n,range:t,match:e,transaction:r,allowSpaces:o})?!1:o?e.range.from===t.from:e.range.from===t.from&&!lS(r)}function pS({view:e,pluginKeyRef:t}){let n=e.state.tr.setMeta(t,{exit:!0});e.dispatch(n)}function mS({pluginKey:e,decorationTag:t,decorationClass:n,decorationContent:r,decorationEmptyClass:i,renderer:a,dispatchExit:o}){return{handleKeyDown(t,n){var r;let i=e.getState(t.state);if(!i.active)return!1;if(n.key===`Escape`||n.key===`Esc`){var s;return a==null||(s=a.onKeyDown)==null||s.call(a,{view:t,event:n,range:i.range}),o(t),!0}return(a==null||(r=a.onKeyDown)==null?void 0:r.call(a,{view:t,event:n,range:i.range}))||!1},decorations(a){let{active:o,range:s,decorationId:c,query:l}=e.getState(a);if(!o)return null;let u=!l?.length,d=[n];return u&&d.push(i),R.create(a.doc,[oo.inline(s.from,s.to,{nodeName:t,class:d.join(` `),"data-decoration-id":c||void 0,"data-decoration-content":r})])}}}function hS({editor:e,char:t,effectiveAllowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,findSuggestionMatch:o,allow:s,shouldShow:c,shouldKeepDismissed:l,pluginKey:u}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(d,f,p,m){let{isEditable:h}=e,{composing:g}=e.view,{selection:_}=d,{empty:v,from:y}=_,b={...f},x=d.getMeta(u);if(x&&x.exit)return b.active=!1,b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null,b.dismissedRange=f.active?{...f.range}:f.dismissedRange,b;if(b.composing=g,d.docChanged&&b.dismissedRange!==null&&(b.dismissedRange={from:d.mapping.map(b.dismissedRange.from),to:d.mapping.map(b.dismissedRange.to)}),h&&(v||e.view.composing)){(y<f.range.from||y>f.range.to)&&!g&&!f.composing&&(b.active=!1);let u=o({char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:_.$from}),p=`id_${Math.floor(Math.random()*4294967295)}`;u&&s({editor:e,state:m,range:u.range,isActive:f.active})&&(!c||c({editor:e,range:u.range,query:u.query,text:u.text,transaction:d}))?(b.dismissedRange!==null&&!l({match:u,dismissedRange:b.dismissedRange,state:m,transaction:d})&&(b.dismissedRange=null),b.dismissedRange===null?(b.active=!0,b.decorationId=f.decorationId||p,b.range=u.range,b.query=u.query,b.text=u.text):b.active=!1):(u||(b.dismissedRange=null),b.active=!1)}else b.active=!1;return b.active||(b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null),b}}}function gS({editor:e,items:t}){let n=null,r=null,i=null,a=()=>{r!==null&&(clearTimeout(r),r=null),i?.(),i=null},o=e=>new Promise(t=>{i=t,r=setTimeout(()=>{r=null;let e=i;i=null,e?.()},e)}),s=()=>{n?.abort(),a(),n=null};return{abort:s,fetch:async(r,i)=>{s(),n=new AbortController;let a=n;if(i>0&&await o(i),n!==a||a.signal.aborted)return{status:`aborted`};try{let i=await t({editor:e,query:r,signal:a.signal});return n!==a||a.signal.aborted?{status:`aborted`}:{status:`resolved`,items:i}}catch{return n!==a||a.signal.aborted?{status:`aborted`}:{status:`error`}}}}}function _S({placement:e,offset:t,flip:n,floatingUi:r}){var i;let a=[u({mainAxis:t.mainAxis??4,crossAxis:t.crossAxis??0})];return n&&a.push(f()),r!=null&&(i=r.middleware)!=null&&i.length&&a.push(...r.middleware),{placement:e,strategy:r?.strategy??`absolute`,middleware:a}}function vS(e){if(e instanceof HTMLElement)return e;if(typeof e==`string`)try{let t=document.querySelector(e);if(t)return t}catch{return document.body}return document.body}function yS({getReferenceRect:e,contextElement:t,config:n,container:r,dismissOnOutsideClick:i,dismiss:a}){return(o,s={})=>{let c={getBoundingClientRect:()=>e()??new DOMRect,contextElement:t},l=!1,u=!o.isConnected;u&&vS(r).appendChild(o),s.onPosition||(o.style.visibility=`hidden`,o.style.width=`max-content`);let d=y(c,o,()=>{p(c,o,{placement:n.placement,strategy:n.strategy,middleware:n.middleware}).then(({x:e,y:t,placement:n,strategy:r})=>{if(s.onPosition){s.onPosition({x:e,y:t,placement:n,strategy:r});return}Object.assign(o.style,{position:r,left:`${e}px`,top:`${t}px`}),l||(l=!0,o.style.visibility=``)})},s.autoUpdate),f;return i&&(f=e=>{let n=e.target;!(n instanceof Node)||o.contains(n)||t.contains(n)||a()},document.addEventListener(`pointerdown`,f,!0)),()=>{d(),f&&document.removeEventListener(`pointerdown`,f,!0),u&&o.remove()}}}function bS({editor:e,pluginKey:t,items:n,renderer:r,minQueryLength:i,debounce:a,initialItems:o,placement:s,offset:c,container:l,flip:u,floatingUi:d,dismissOnOutsideClick:f,command:p,clientRectFor:m,dispatchExit:h}){let g,_=gS({editor:e,items:n}),v=_S({placement:s,offset:c,flip:u,floatingUi:d});function y(e,t){switch(e){case`started`:var n;r==null||(n=r.onStart)==null||n.call(r,t);break;case`updated`:var i;r==null||(i=r.onUpdate)==null||i.call(r,t);break;case`stopped`:var a;r==null||(a=r.onExit)==null||a.call(r,t)}}return{update:async(n,d)=>{let b=t.getState(d),x=t.getState(n.state);if(!b||!x)return;let S=null,C=b.query!==x.query,ee=b.text!==x.text,te=b.range.from!==x.range.from||b.range.to!==x.range.to,ne=C||ee||te;if(!b.active&&x.active)S=`started`;else if(b.active&&!x.active)S=`stopped`;else if(x.active&&ne)S=`updated`;else return;let re=S===`stopped`?b:x,ie=n.dom.querySelector(`[data-decoration-id="${re.decorationId}"]`),ae=m(n,ie),oe=i===0||(re.query?re.query.length>=i:!1),se=(S===`started`||S===`updated`)&&oe;if(g={editor:e,range:re.range,query:re.query||``,text:re.text||``,items:o??[],command:t=>p({editor:e,range:re.range,props:t}),decorationNode:ie,clientRect:ae,loading:se,placement:s,offset:{mainAxis:c.mainAxis??4,crossAxis:c.crossAxis??0},container:l,flip:u,floatingUi:v,mount:yS({getReferenceRect:ae,contextElement:n.dom,config:v,container:l,dismissOnOutsideClick:f,dismiss:()=>h(e.view)})},S===`started`){var ce;r==null||(ce=r.onBeforeStart)==null||ce.call(r,g)}if(S===`updated`){var le;r==null||(le=r.onBeforeUpdate)==null||le.call(r,g)}if(S===`started`&&y(S,g),S===`started`||S===`updated`){if(!se)_.abort(),g={...g,items:o??[],loading:!1};else{g={...g,items:o??[],loading:!0},S=`updated`,y(S,g);let e=await _.fetch(re.query||``,a);if(e.status===`aborted`)return;if(!t.getState(n.state)?.active){_.abort();return}g=e.status===`resolved`?{...g,items:e.items,loading:!1}:{...g,loading:!1}}}if(S===`stopped`){_.abort(),y(S,g),g=void 0;return}S===`updated`&&y(S,g)},destroy:()=>{var e;_.abort(),g&&(r==null||(e=r.onExit)==null||e.call(r,g))}}}var xS=new A(`suggestion`);function SS({pluginKey:e=xS,editor:t,char:n=`@`,allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:a=[` `],startOfLine:o=!1,decorationTag:s=`span`,decorationClass:c=`suggestion`,decorationContent:l=``,decorationEmptyClass:u=`is-empty`,command:d=()=>null,items:f=()=>[],minQueryLength:p=0,debounce:m=0,initialItems:h,placement:g=`bottom-start`,offset:_={},container:v,flip:y=!0,floatingUi:b,dismissOnOutsideClick:x=!0,render:S=()=>({}),allow:C=()=>!0,findSuggestionMatch:ee=cS,shouldShow:te,shouldResetDismissed:ne}){let re=S?.(),ie=r&&!i,ae=(n,r)=>dS(t,n,r,e);function oe(e){return fS({...e,editor:t,shouldResetDismissed:ne,effectiveAllowSpaces:ie})}let se=t=>pS({view:t,pluginKeyRef:e});return new O({key:e,view:()=>bS({editor:t,pluginKey:e,items:f,renderer:re,minQueryLength:p,debounce:m,initialItems:h,placement:g,offset:_,container:v,flip:y,floatingUi:b,dismissOnOutsideClick:x,command:d,clientRectFor:ae,dispatchExit:se}),state:hS({editor:t,char:n,effectiveAllowSpaces:ie,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,findSuggestionMatch:ee,allow:C,shouldShow:te,shouldKeepDismissed:oe,pluginKey:e}),props:mS({pluginKey:e,decorationTag:s,decorationClass:c,decorationContent:l,decorationEmptyClass:u,renderer:re,dispatchExit:se})})}function CS(e,t=xS){let n=e.state.tr.setMeta(t,{exit:!0});e.dispatch(n)}var wS=()=>({onChange:Cp(()=>void 0),onKeyDown:Cp(()=>!1)}),TS=new A(`slashCommand`),ES=e=>CS(e,TS),DS=()=>null,OS=G.create({name:`slashCommand`,addOptions(){return{bridge:wS()}},addProseMirrorPlugins(){let{bridge:e}=this.options,t=t=>e.onChange.call({query:t.query,range:t.range,rect:t.clientRect??DS});return[SS({editor:this.editor,pluginKey:TS,char:`/`,dismissOnOutsideClick:!1,allow:({state:e,range:t})=>!e.doc.resolve(t.from).parent.type.spec.code,items:()=>[],command:()=>void 0,render:()=>({onStart:t,onUpdate:t,onKeyDown:({event:t})=>t.key===`Escape`?(e.onChange.call(null),!0):e.onKeyDown.call(t),onExit:()=>e.onChange.call(null)})})]}}),kS=e=>e?.id,AS=new A(`uploadPlaceholder`),jS=e=>{let t=document.createElement(`div`);t.className=`my-4 flex h-40 items-center justify-center gap-2 rounded-xl border border-dashed bg-muted/40 font-sans text-sm text-muted-foreground`,t.setAttribute(`role`,`status`),t.setAttribute(`data-upload-placeholder`,``);let n=document.createElement(`span`);n.className=`size-4 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`,n.setAttribute(`aria-hidden`,`true`);let r=document.createElement(`span`);return r.textContent=e,t.append(n,r),t},MS=G.create({name:`uploadPlaceholder`,addOptions(){return{label:e=>e}},addProseMirrorPlugins(){let{label:e}=this.options;return[new O({key:AS,state:{init:()=>R.empty,apply:(t,n)=>{let r=n.map(t.mapping,t.doc),i=t.getMeta(AS);if(i&&`add`in i){let n=oo.widget(i.add.pos,()=>jS(e(i.name??``)),{id:i.add.id,side:-1});r=r.add(t.doc,[n])}else i&&`remove`in i&&(r=r.remove(r.find(void 0,void 0,e=>kS(e)===i.remove.id)));return r}},props:{decorations:e=>AS.getState(e)}})]}}),NS=(e,t,n,r)=>e.setMeta(AS,{add:{id:t,pos:n},name:r}),PS=(e,t)=>e.setMeta(AS,{remove:{id:t}}),FS=(e,t)=>AS.getState(e)?.find(void 0,void 0,e=>kS(e)===t)[0]?.from,IS=[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`image/avif`,`image/svg+xml`],LS=(e,t,n,r,i)=>Promise.all(t.map(async t=>{let a=crypto.randomUUID();e.view.dispatch(NS(e.state.tr,a,n,t.name));try{let n=await r(t);if(e.isDestroyed)return;let i=FS(e.state,a);e.view.dispatch(PS(e.state.tr,a)),i!==void 0&&e.chain().insertContentAt(i,{type:`image`,attrs:{mediaId:n.id,alt:n.alt,title:null}}).run()}catch(n){e.isDestroyed||e.view.dispatch(PS(e.state.tr,a)),i(t,n)}})),RS=({placeholder:e,uploadingLabel:t,slash:n,onFiles:r})=>[...rS({placeholder:e,imageView:vp(sS)}),Jp,OS.configure({bridge:n}),MS.configure({label:t}),...r?[pg.configure({allowedMimeTypes:IS,consumePasteEvent:!0,onDrop:(e,t,n)=>r(e,t,n),onPaste:(e,t)=>r(e,t,e.state.selection.to)})]:[]],zS=({editor:e,rewrite:t})=>{let{t:n}=o(),r=(0,j.useId)(),[i,a]=(0,j.useState)(``),{captured:s,result:c}=t,l=t.pending;return(0,M.jsxs)(ne,{open:t.open,onOpenChange:e=>{e||(t.close(),a(``))},children:[s?(0,M.jsx)(re,{virtualRef:Hp(e,s)}):null,(0,M.jsx)(S,{align:`start`,className:`w-[min(26rem,calc(100vw-2rem))] space-y-3 font-sans`,"aria-label":n(`assist.rewrite.title`),onCloseAutoFocus:t=>{t.preventDefault(),e.commands.focus()},children:c?(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(lt,{htmlFor:`${r}-result`,label:n(`assist.rewrite.proposal`,{model:c.model}),hint:n(`assist.rewrite.marksHint`)}),(0,M.jsx)(gt,{id:`${r}-result`,value:t.draft,autoFocus:!0,rows:5,className:`max-h-72`,onChange:e=>t.setDraft(e.target.value)}),c.truncated?(0,M.jsx)(`p`,{className:`text-meta text-muted-foreground`,children:n(`assist.truncated`)}):null,t.stale?(0,M.jsx)(`p`,{role:`alert`,className:`text-meta text-destructive`,children:n(`assist.rewrite.stale`)}):null,(0,M.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,M.jsx)(oe,{type:`button`,variant:`ghost`,size:`sm`,onClick:t.discard,children:n(`assist.discard`)}),(0,M.jsx)(oe,{type:`button`,size:`sm`,disabled:t.draft.trim()===``||t.stale,onClick:t.apply,children:n(`assist.rewrite.replace`)})]})]}):(0,M.jsxs)(`form`,{className:`space-y-2`,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),t.run(i)},children:[(0,M.jsx)(lt,{htmlFor:`${r}-instruction`,label:n(`assist.rewrite.instruction`),hint:n(`assist.rewrite.marksHint`)}),(0,M.jsx)(se,{id:`${r}-instruction`,value:i,autoFocus:!0,maxLength:500,placeholder:n(`assist.rewrite.instructionPlaceholder`),disabled:l||t.tooLong,onChange:e=>a(e.target.value)}),t.tooLong?(0,M.jsx)(`p`,{role:`alert`,className:`text-meta text-destructive`,children:n(`assist.rewrite.tooLong`,{max:bt.toLocaleString()})}):null,(0,M.jsx)(St,{error:t.error}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,M.jsx)(oe,{type:`button`,variant:`outline`,size:`sm`,disabled:l||t.tooLong,onClick:()=>t.run(_t.shorten),children:n(`assist.rewrite.shorten`)}),(0,M.jsx)(oe,{type:`button`,variant:`outline`,size:`sm`,disabled:l||t.tooLong,onClick:()=>t.run(_t.expand),children:n(`assist.rewrite.expand`)}),(0,M.jsx)(xt,{variant:`default`,pending:l,pendingLabel:n(`assist.working`),disabled:i.trim()===``||t.tooLong,onClick:()=>t.run(i),children:n(`assist.rewrite.run`)})]})]})})]})},BS={ArrowDown:1,ArrowUp:-1},VS=({editor:e,bridge:t,onChoose:n})=>{let{t:r}=o(),i=(0,j.useId)(),[a,c]=(0,j.useState)(null),[l,u]=(0,j.useState)(0),d=e=>r(e.labelKey),f=a?Re(a.query,d):[],p=f[Math.min(l,f.length-1)],m=e=>{e&&a&&n(e.type,a)};(0,j.useEffect)(()=>{t.onChange.set(e=>{c(e),e?.query!==a?.query&&u(0)}),t.onKeyDown.set(e=>{if(!a||f.length===0)return!1;let t=BS[e.key];return t===void 0?e.key===`Enter`||e.key===`Tab`?(m(p),!0):!1:(u(e=>(e+t+f.length)%f.length),!0)})}),(0,j.useEffect)(()=>()=>{t.onChange.reset(),t.onKeyDown.reset()},[t]);let h=a!==null&&f.length>0;return(0,M.jsxs)(ne,{open:h,onOpenChange:t=>{t||ES(e.view)},children:[(0,M.jsx)(re,{virtualRef:{current:{getBoundingClientRect:()=>a?.rect()??new DOMRect}}}),(0,M.jsx)(S,{align:`start`,className:`w-72 p-1 font-sans`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),children:(0,M.jsx)(`ul`,{role:`listbox`,id:i,"aria-label":r(`entry.blocks.menu`),className:`max-h-80 overflow-y-auto`,children:f.map((e,t)=>(0,M.jsxs)(`li`,{role:`option`,"aria-selected":e===p,className:s(`flex cursor-pointer items-center gap-3 rounded-md px-2 py-1.5 text-sm`,e===p&&`bg-accent text-accent-foreground`),onMouseEnter:()=>u(t),onMouseDown:t=>{t.preventDefault(),m(e)},children:[(0,M.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground [&_svg]:size-4`,children:(0,M.jsx)(e.icon,{"aria-hidden":`true`})}),d(e)]},e.type))})})]})},HS=[`min-h-16 font-serif text-canvas text-foreground outline-none`,`-mx-3 rounded-lg px-3 py-1 focus-visible:ring-[3px] focus-visible:ring-ring/50`,`[&_h1]:mt-10 [&_h1]:mb-3 [&_h1]:font-sans [&_h1]:text-3xl [&_h1]:font-bold [&_h1]:tracking-tight`,`[&_h2]:mt-10 [&_h2]:mb-3 [&_h2]:font-sans [&_h2]:text-2xl [&_h2]:font-semibold [&_h2]:tracking-tight`,`[&_h3]:mt-8 [&_h3]:mb-2 [&_h3]:font-sans [&_h3]:text-xl [&_h3]:font-semibold`,`[&_h4]:mt-6 [&_h4]:font-sans [&_h4]:text-lg [&_h4]:font-semibold [&_h5]:mt-4 [&_h5]:font-sans [&_h5]:font-semibold [&_h6]:mt-4 [&_h6]:font-sans [&_h6]:font-semibold`,`[&_p]:my-3 [&_a]:text-link [&_a]:underline [&_a]:underline-offset-2`,`[&_ul]:my-3 [&_ul]:list-disc [&_ul]:pl-7 [&_ol]:my-3 [&_ol]:list-decimal [&_ol]:pl-7 [&_li_p]:my-1`,`[&_blockquote]:my-5 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-5 [&_blockquote]:text-muted-foreground [&_blockquote]:italic`,`[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.85em]`,`[&_pre]:my-5 [&_pre]:overflow-x-auto [&_pre]:rounded-lg [&_pre]:bg-muted [&_pre]:p-4 [&_pre]:text-sm [&_pre_code]:bg-transparent [&_pre_code]:p-0`,`[&_hr]:my-8 [&_hr]:border-border`,`[&_.tableWrapper]:my-5 [&_.tableWrapper]:overflow-x-auto [&_table]:w-full [&_table]:table-fixed [&_table]:border-collapse [&_table]:font-sans [&_table]:text-sm`,`[&_td]:relative [&_td]:border [&_td]:border-border [&_td]:p-2 [&_td]:align-top`,`[&_th]:relative [&_th]:border [&_th]:border-border [&_th]:bg-muted [&_th]:p-2 [&_th]:text-left [&_th]:font-semibold`,`[&_.selectedCell]:bg-accent`,`[&_.column-resize-handle]:pointer-events-none [&_.column-resize-handle]:absolute [&_.column-resize-handle]:top-0 [&_.column-resize-handle]:-right-0.5 [&_.column-resize-handle]:bottom-0 [&_.column-resize-handle]:w-1 [&_.column-resize-handle]:bg-primary`,`[&.resize-cursor]:cursor-col-resize`,`[&_.is-empty]:before:pointer-events-none [&_.is-empty]:before:float-left [&_.is-empty]:before:h-0 [&_.is-empty]:before:text-muted-foreground [&_.is-empty]:before:content-[attr(data-placeholder)]`].join(` `),US=(e,t,n)=>{let r=e.view.dom.getBoundingClientRect(),i=e.view.posAtCoords({left:r.left+8,top:n});if(!i)return null;let a=Gp(e.state.doc,i.inside>=0?i.inside:i.pos),o=a?e.view.nodeDOM(a.pos):null;return!a||!(o instanceof HTMLElement)?null:{pos:a.pos,top:o.getBoundingClientRect().top-t.getBoundingClientRect().top}},WS=e=>{let{t}=o(),{uploadMedia:n}=ht(),{context:r,definition:i,field:a,path:s}=e,[c,l]=(0,j.useState)(!1),[u,d]=(0,j.useState)(null),[f,p]=(0,j.useState)(!1),[g]=(0,j.useState)(wS),_=(0,j.useRef)(null),[v]=(0,j.useState)(()=>Cp(()=>void 0)),y=n!==void 0,x=typeof a.options.placeholder==`string`?a.options.placeholder:void 0,S=(0,j.useMemo)(()=>RS({placeholder:x??t(`entry.canvas.placeholder`),uploadingLabel:e=>t(`entry.upload.uploading`,{name:e}),slash:g,onFiles:y?v.call:void 0}),[x,t,g,y,v]);(0,j.useEffect)(()=>{v.set((e,r,i)=>{n&&LS(e,r,i,n,(e,n)=>{h(n,`uploading ${e.name} into rich text`),m.error(t(`entry.upload.failed`,{name:e.name}))})})});let{editor:C,initial:ee,editable:te}=Vp({props:e,extensions:S,contentClasses:HS,onLinkShortcut:()=>l(!0),refuseFileDrops:!y}),ne=vt(),re=Ap(C),ie=(0,j.useCallback)(async()=>{try{return(await r.pickMedia({multiple:!0,allowedKinds:[`image`]})??[]).map(e=>({mediaId:e.id,alt:e.alt||null}))}catch(e){return b(e,`picking images`),[]}},[r]),ae=(0,j.useCallback)((e,t)=>Me(C,e,t,ie),[C,ie]),oe=(0,j.useMemo)(()=>({insertBlock:(e,t)=>ae(e,Ie(C,t))}),[ae,C]);be(s,te?oe:void 0);let se=e=>{!f&&_.current&&te&&d(US(C,_.current,e.clientY))},ce=i.type===`richtext`?i.settings.maxLength:void 0;return(0,M.jsxs)(`div`,{ref:_,className:`relative`,onMouseMove:se,onMouseLeave:()=>f?void 0:d(null),"data-rich-text-canvas":!0,children:[te&&u?(0,M.jsx)(Yp,{editor:C,block:u,onInsert:(e,t)=>void ae(e,t),onMenuOpenChange:p}):null,(0,M.jsx)(Kf,{editor:C}),te?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(dg,{editor:C,onLink:()=>l(!0),onRewrite:ne?re.start:void 0}),ne?(0,M.jsx)(zS,{editor:C,rewrite:re}):null,(0,M.jsx)(Up,{editor:C,active:C.isActive(`link`),disabled:!1,open:c,onOpenChange:l,anchorToSelection:!0}),(0,M.jsx)(VS,{editor:C,bridge:g,onChoose:(e,t)=>void De(C,e,t.range,ie)})]}):null,(0,M.jsx)(Wp,{editor:C,initial:ee,maxLength:ce})]})},GS={rows:3,cols:3,withHeaderRow:!0},KS=({editor:e,inTable:t,disabled:n})=>{let{t:r}=o(),i=t=>t(e.chain().focus()).run();return(0,M.jsxs)(it,{children:[(0,M.jsx)(nt,{asChild:!0,disabled:n,children:(0,M.jsx)(oe,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":r(`content.richText.table`),"aria-pressed":t,className:`aria-pressed:bg-accent aria-pressed:text-accent-foreground`,children:(0,M.jsx)(xe,{"aria-hidden":`true`})})}),(0,M.jsxs)(rt,{align:`start`,onCloseAutoFocus:t=>{t.preventDefault(),e.commands.focus()},children:[(0,M.jsx)(et,{disabled:t,onSelect:()=>i(e=>e.command(({tr:e})=>(e.selection instanceof E&&e.setSelection(k.near(e.doc.resolve(e.selection.to))),!0)).insertTable(GS)),children:r(`content.richText.insertTable`)}),(0,M.jsx)(tt,{}),(0,M.jsx)(et,{disabled:!t,onSelect:()=>i(e=>e.addRowAfter()),children:r(`content.richText.addRow`)}),(0,M.jsx)(et,{disabled:!t,onSelect:()=>i(e=>e.addColumnAfter()),children:r(`content.richText.addColumn`)}),(0,M.jsx)(et,{disabled:!t,onSelect:()=>i(e=>e.toggleHeaderRow()),children:r(`content.richText.toggleHeaderRow`)}),(0,M.jsx)(et,{disabled:!t,onSelect:()=>i(e=>e.deleteRow()),children:r(`content.richText.deleteRow`)}),(0,M.jsx)(et,{disabled:!t,onSelect:()=>i(e=>e.deleteColumn()),children:r(`content.richText.deleteColumn`)}),(0,M.jsx)(tt,{}),(0,M.jsx)(et,{disabled:!t,variant:`destructive`,onSelect:()=>i(e=>e.deleteTable()),children:r(`content.richText.deleteTable`)})]})]})},qS=[1,2,3,4,5,6],JS={paragraph:`content.richText.paragraph`,h1:`content.richText.heading1`,h2:`content.richText.heading2`,h3:`content.richText.heading3`,h4:`content.richText.heading4`,h5:`content.richText.heading5`,h6:`content.richText.heading6`,codeBlock:`content.richText.codeBlock`},YS=e=>{if(e.isActive(`codeBlock`))return`codeBlock`;let t=qS.find(t=>e.isActive(`heading`,{level:t}));return t?`h${t}`:`paragraph`},XS=(e,t)=>{let n=e.chain().focus();t===`paragraph`?n.setParagraph().run():t===`codeBlock`?n.toggleCodeBlock().run():n.setHeading({level:Number(t.slice(1))}).run()},ZS=({editor:e,minimal:t,disabled:n,linkOpen:r,onLinkOpenChange:i,onInsertImage:a})=>{let{t:s}=o(),c=Yf({editor:e,selector:({editor:e})=>({block:YS(e),bold:e.isActive(`bold`),italic:e.isActive(`italic`),code:e.isActive(`code`),link:e.isActive(`link`),bulletList:e.isActive(`bulletList`),orderedList:e.isActive(`orderedList`),blockquote:e.isActive(`blockquote`),table:e.isActive(`table`),canUndo:e.can().undo(),canRedo:e.can().redo()})}),l=()=>e.chain().focus();return(0,M.jsxs)(`div`,{role:`toolbar`,"aria-label":s(`content.richText.toolbar`),className:`flex min-h-9 flex-wrap items-center gap-0.5 border-b bg-muted/40 px-1`,children:[t?null:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(me,{value:c.block,disabled:n,onValueChange:t=>XS(e,t),children:[(0,M.jsx)(de,{size:`sm`,"aria-label":s(`content.richText.blockType`),className:`w-36 border-transparent bg-transparent shadow-none dark:bg-transparent`,children:(0,M.jsx)(ue,{})}),(0,M.jsx)(fe,{children:Object.keys(JS).map(e=>(0,M.jsx)(pe,{value:e,children:s(JS[e])},e))})]}),(0,M.jsx)(te,{orientation:`vertical`,className:`mx-1 h-5`})]}),(0,M.jsx)(Y,{icon:Dt,label:s(`content.richText.bold`),keys:`Mod+B`,pressed:c.bold,disabled:n,onClick:()=>l().toggleBold().run()}),(0,M.jsx)(Y,{icon:jt,label:s(`content.richText.italic`),keys:`Mod+I`,pressed:c.italic,disabled:n,onClick:()=>l().toggleItalic().run()}),t?null:(0,M.jsx)(Y,{icon:kt,label:s(`content.richText.code`),keys:`Mod+E`,pressed:c.code,disabled:n,onClick:()=>l().toggleCode().run()}),(0,M.jsx)(Up,{editor:e,active:c.link,disabled:n,open:r,onOpenChange:i}),(0,M.jsx)(te,{orientation:`vertical`,className:`mx-1 h-5`}),(0,M.jsx)(Y,{icon:Xe,label:s(`content.richText.bulletList`),keys:`Mod+Shift+8`,pressed:c.bulletList,disabled:n,onClick:()=>l().toggleBulletList().run()}),(0,M.jsx)(Y,{icon:Ce,label:s(`content.richText.orderedList`),keys:`Mod+Shift+7`,pressed:c.orderedList,disabled:n,onClick:()=>l().toggleOrderedList().run()}),t?null:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Y,{icon:Se,label:s(`content.richText.blockquote`),keys:`Mod+Shift+B`,pressed:c.blockquote,disabled:n,onClick:()=>l().toggleBlockquote().run()}),(0,M.jsx)(te,{orientation:`vertical`,className:`mx-1 h-5`}),(0,M.jsx)(Y,{icon:Je,label:s(`content.richText.image`),disabled:n,onClick:a}),(0,M.jsx)(KS,{editor:e,inTable:c.table,disabled:n}),(0,M.jsx)(Y,{icon:ae,label:s(`content.richText.horizontalRule`),disabled:n,onClick:()=>l().setHorizontalRule().run()})]}),(0,M.jsxs)(`span`,{className:`ml-auto flex`,children:[(0,M.jsx)(Y,{icon:$e,label:s(`content.richText.undo`),keys:`Mod+Z`,disabled:n||!c.canUndo,onClick:()=>l().undo().run()}),(0,M.jsx)(Y,{icon:Nt,label:s(`content.richText.redo`),keys:`Mod+Shift+Z`,disabled:n||!c.canRedo,onClick:()=>l().redo().run()})]})]})},QS=[`min-h-48 px-4 py-3 text-sm leading-relaxed outline-none`,`[&_h1]:mt-4 [&_h1]:mb-2 [&_h1]:text-3xl [&_h1]:font-extrabold [&_h1]:tracking-tight`,`[&_h2]:mt-4 [&_h2]:mb-2 [&_h2]:text-2xl [&_h2]:font-bold`,`[&_h3]:mt-3 [&_h3]:mb-1.5 [&_h3]:text-xl [&_h3]:font-bold`,`[&_h4]:mt-3 [&_h4]:mb-1 [&_h4]:text-lg [&_h4]:font-semibold`,`[&_h5]:mt-2 [&_h5]:font-semibold [&_h6]:mt-2 [&_h6]:font-semibold [&_h6]:text-muted-foreground`,`[&_p]:my-2 [&_a]:text-link [&_a]:underline [&_a]:underline-offset-2`,`[&_ul]:my-2 [&_ul]:list-disc [&_ul]:pl-6 [&_ol]:my-2 [&_ol]:list-decimal [&_ol]:pl-6`,`[&_blockquote]:my-3 [&_blockquote]:border-l-4 [&_blockquote]:border-border dark:[&_blockquote]:border-link [&_blockquote]:pl-4 [&_blockquote]:text-muted-foreground`,`[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.85em]`,`[&_pre]:my-3 [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-3 [&_pre_code]:bg-transparent [&_pre_code]:p-0`,`[&_hr]:my-4 [&_hr]:border-border`,`[&_.tableWrapper]:my-3 [&_.tableWrapper]:overflow-x-auto`,`[&_table]:w-full [&_table]:table-fixed [&_table]:border-collapse`,`[&_td]:relative [&_td]:border [&_td]:border-border [&_td]:p-2 [&_td]:align-top`,`[&_th]:relative [&_th]:border [&_th]:border-border [&_th]:bg-muted [&_th]:p-2 [&_th]:text-left [&_th]:font-semibold`,`[&_.selectedCell]:bg-accent`,`[&_.column-resize-handle]:pointer-events-none [&_.column-resize-handle]:absolute [&_.column-resize-handle]:top-0 [&_.column-resize-handle]:-right-0.5 [&_.column-resize-handle]:bottom-0 [&_.column-resize-handle]:w-1 [&_.column-resize-handle]:bg-primary`,`[&.resize-cursor]:cursor-col-resize`,`[&_p.is-editor-empty:first-child]:before:pointer-events-none [&_p.is-editor-empty:first-child]:before:float-left [&_p.is-editor-empty:first-child]:before:h-0 [&_p.is-editor-empty:first-child]:before:text-muted-foreground [&_p.is-editor-empty:first-child]:before:content-[attr(data-placeholder)]`].join(` `),$S=e=>e.appearance===`canvas`?(0,M.jsx)(WS,{...e}):(0,M.jsx)(eC,{...e}),eC=e=>{let{t}=o(),{field:n,context:r,validation:i,definition:a}=e,[c,l]=(0,j.useState)(!1),u=typeof n.options.placeholder==`string`?n.options.placeholder:void 0,{editor:d,initial:f,editable:p}=Vp({props:e,extensions:(0,j.useMemo)(()=>rS({placeholder:u??t(`content.richText.placeholder`),imageView:vp(oS)}),[u,t]),contentClasses:QS,onLinkShortcut:()=>l(!0),refuseFileDrops:!0}),m=a.type===`richtext`?a.settings.maxLength:void 0,h=async()=>{try{let e=await r.pickMedia({multiple:!0,allowedKinds:[`image`]});for(let t of e??[])d.chain().focus().insertMediaImage({mediaId:t.id,alt:t.alt||null}).run()}catch(e){b(e,`inserting an image`)}};return(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsxs)(`div`,{className:s(`overflow-hidden rounded-lg border border-input bg-card focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50 dark:bg-input/20`,i.invalid&&`border-destructive`),children:[p?(0,M.jsx)(ZS,{editor:d,minimal:n.options.toolbar===`minimal`,disabled:!p,linkOpen:c,onLinkOpenChange:l,onInsertImage:()=>void h()}):null,(0,M.jsx)(Kf,{editor:d})]}),(0,M.jsx)(Wp,{editor:d,initial:f,maxLength:m})]})};export{$S as RichTextField};
|
|
144
|
-
//# sourceMappingURL=RichTextField-B21FqrT5.js.map
|