@shapio/cms 0.5.5 → 0.5.6
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-CaYPqR_F.js → AssetTile-_qRYsivK.js} +2 -2
- package/dist/admin/assets/{AssetTile-CaYPqR_F.js.map → AssetTile-_qRYsivK.js.map} +1 -1
- package/dist/admin/assets/{AssistError-drmpXSbS.js → AssistError-CMXQWiQo.js} +2 -2
- package/dist/admin/assets/{AssistError-drmpXSbS.js.map → AssistError-CMXQWiQo.js.map} +1 -1
- package/dist/admin/assets/{BlockMenuItems-D-jZ0oaU.js → BlockMenuItems-WIrbyv1a.js} +2 -2
- package/dist/admin/assets/{BlockMenuItems-D-jZ0oaU.js.map → BlockMenuItems-WIrbyv1a.js.map} +1 -1
- package/dist/admin/assets/{Body-Gn_z2KPN.js → Body-BYc1IVsQ.js} +2 -2
- package/dist/admin/assets/{Body-Gn_z2KPN.js.map → Body-BYc1IVsQ.js.map} +1 -1
- package/dist/admin/assets/Builder-CwHpRhZN.js +2 -0
- package/dist/admin/assets/Builder-CwHpRhZN.js.map +1 -0
- package/dist/admin/assets/{CodeEditor-CzRU6och.js → CodeEditor-NMvrWgxT.js} +2 -2
- package/dist/admin/assets/{CodeEditor-CzRU6och.js.map → CodeEditor-NMvrWgxT.js.map} +1 -1
- package/dist/admin/assets/{ConfirmDialog-DZRJfdvH.js → ConfirmDialog-Rd6WDt6q.js} +2 -2
- package/dist/admin/assets/{ConfirmDialog-DZRJfdvH.js.map → ConfirmDialog-Rd6WDt6q.js.map} +1 -1
- package/dist/admin/assets/{CopyButton-h4HYhnYp.js → CopyButton-B0RuxynJ.js} +2 -2
- package/dist/admin/assets/{CopyButton-h4HYhnYp.js.map → CopyButton-B0RuxynJ.js.map} +1 -1
- package/dist/admin/assets/{CursorPager-H4SpVYw7.js → CursorPager-CQZsKNxR.js} +2 -2
- package/dist/admin/assets/{CursorPager-H4SpVYw7.js.map → CursorPager-CQZsKNxR.js.map} +1 -1
- package/dist/admin/assets/{FocalPoint-CSeKI4Iw.js → FocalPoint-BYu2fOTb.js} +2 -2
- package/dist/admin/assets/{FocalPoint-CSeKI4Iw.js.map → FocalPoint-BYu2fOTb.js.map} +1 -1
- package/dist/admin/assets/{Form-DF_YmR1G.js → Form-CiZUsLPp.js} +2 -2
- package/dist/admin/assets/{Form-DF_YmR1G.js.map → Form-CiZUsLPp.js.map} +1 -1
- package/dist/admin/assets/{FormCheckboxGroup-V3IKrvzc.js → FormCheckboxGroup-Bz8KERs1.js} +2 -2
- package/dist/admin/assets/{FormCheckboxGroup-V3IKrvzc.js.map → FormCheckboxGroup-Bz8KERs1.js.map} +1 -1
- package/dist/admin/assets/{FormRadioGroup-DIv-MYgn.js → FormRadioGroup-c-wyx7dq.js} +2 -2
- package/dist/admin/assets/{FormRadioGroup-DIv-MYgn.js.map → FormRadioGroup-c-wyx7dq.js.map} +1 -1
- package/dist/admin/assets/{FormSelectField-CUhaPIMY.js → FormSelectField-ijG9qPpb.js} +2 -2
- package/dist/admin/assets/{FormSelectField-CUhaPIMY.js.map → FormSelectField-ijG9qPpb.js.map} +1 -1
- package/dist/admin/assets/{FormSwitchField-DW8ysyk_.js → FormSwitchField-Bp3hNpeP.js} +2 -2
- package/dist/admin/assets/{FormSwitchField-DW8ysyk_.js.map → FormSwitchField-Bp3hNpeP.js.map} +1 -1
- package/dist/admin/assets/{FormTextareaField-DbqZ-MwI.js → FormTextareaField-BSKMqHcW.js} +2 -2
- package/dist/admin/assets/{FormTextareaField-DbqZ-MwI.js.map → FormTextareaField-BSKMqHcW.js.map} +1 -1
- package/dist/admin/assets/{HintedLabel-BlLtqVVz.js → HintedLabel-BrLH4NQW.js} +2 -2
- package/dist/admin/assets/{HintedLabel-BlLtqVVz.js.map → HintedLabel-BrLH4NQW.js.map} +1 -1
- package/dist/admin/assets/{InfoHint-bYMd_t0J.js → InfoHint-Dyzyf59c.js} +2 -2
- package/dist/admin/assets/{InfoHint-bYMd_t0J.js.map → InfoHint-Dyzyf59c.js.map} +1 -1
- package/dist/admin/assets/{InsertMenuItem-D2HGERzb.js → InsertMenuItem-BvRDuXtd.js} +2 -2
- package/dist/admin/assets/{InsertMenuItem-D2HGERzb.js.map → InsertMenuItem-BvRDuXtd.js.map} +1 -1
- package/dist/admin/assets/{Match-GDx_orOH.js → Match-Bixf1ygj.js} +2 -2
- package/dist/admin/assets/{Match-GDx_orOH.js.map → Match-Bixf1ygj.js.map} +1 -1
- package/dist/admin/assets/{QueryView-UBO-U5Wo.js → QueryView--_vvV7dC.js} +2 -2
- package/dist/admin/assets/{QueryView-UBO-U5Wo.js.map → QueryView--_vvV7dC.js.map} +1 -1
- package/dist/admin/assets/{RadioTile-CJbIIV8t.js → RadioTile-BCp6auUz.js} +2 -2
- package/dist/admin/assets/{RadioTile-CJbIIV8t.js.map → RadioTile-BCp6auUz.js.map} +1 -1
- package/dist/admin/assets/{RichTextField-M7HyUhYF.js → RichTextField-fWNjndUc.js} +2 -2
- package/dist/admin/assets/{RichTextField-M7HyUhYF.js.map → RichTextField-fWNjndUc.js.map} +1 -1
- package/dist/admin/assets/{RowTitle-DoxDM1XL.js → RowTitle-B4CE8tt7.js} +2 -2
- package/dist/admin/assets/{RowTitle-DoxDM1XL.js.map → RowTitle-B4CE8tt7.js.map} +1 -1
- package/dist/admin/assets/{SecretReveal-kCkLH5jg.js → SecretReveal-BhSqdWqh.js} +2 -2
- package/dist/admin/assets/{SecretReveal-kCkLH5jg.js.map → SecretReveal-BhSqdWqh.js.map} +1 -1
- package/dist/admin/assets/{SharedGlyph-D1OMHXPf.js → SharedGlyph-71FTypoi.js} +2 -2
- package/dist/admin/assets/{SharedGlyph-D1OMHXPf.js.map → SharedGlyph-71FTypoi.js.map} +1 -1
- package/dist/admin/assets/StepList-CZJmwy9e.js +2 -0
- package/dist/admin/assets/StepList-CZJmwy9e.js.map +1 -0
- package/dist/admin/assets/Structure-Dk87778W.js +2 -0
- package/dist/admin/assets/{Structure-CO4aJZVP.js.map → Structure-Dk87778W.js.map} +1 -1
- package/dist/admin/assets/{SuggestAltButton-CbRUxD5s.js → SuggestAltButton-CxS8IR6m.js} +2 -2
- package/dist/admin/assets/{SuggestAltButton-CbRUxD5s.js.map → SuggestAltButton-CxS8IR6m.js.map} +1 -1
- package/dist/admin/assets/{Thumbnail-D1XuDElk.js → Thumbnail-BwbCNpgQ.js} +2 -2
- package/dist/admin/assets/{Thumbnail-D1XuDElk.js.map → Thumbnail-BwbCNpgQ.js.map} +1 -1
- package/dist/admin/assets/{UnsavedChangesGuard-C1n7egF6.js → UnsavedChangesGuard-C6nD55Fn.js} +2 -2
- package/dist/admin/assets/{UnsavedChangesGuard-C1n7egF6.js.map → UnsavedChangesGuard-C6nD55Fn.js.map} +1 -1
- package/dist/admin/assets/{UserAvatar-Bl32IpG_.js → UserAvatar-D7IbSpsP.js} +2 -2
- package/dist/admin/assets/{UserAvatar-Bl32IpG_.js.map → UserAvatar-D7IbSpsP.js.map} +1 -1
- package/dist/admin/assets/{badge-ydvfgE8a.js → badge-vLiQczOd.js} +2 -2
- package/dist/admin/assets/{badge-ydvfgE8a.js.map → badge-vLiQczOd.js.map} +1 -1
- package/dist/admin/assets/{changeSets-DgfCKja3.js → changeSets-D5VevASj.js} +2 -2
- package/dist/admin/assets/{changeSets-DgfCKja3.js.map → changeSets-D5VevASj.js.map} +1 -1
- package/dist/admin/assets/{constants-esJAnNTh.js → constants-CKGh8uwT.js} +2 -2
- package/dist/admin/assets/{constants-esJAnNTh.js.map → constants-CKGh8uwT.js.map} +1 -1
- package/dist/admin/assets/{content-DsMSB6Wb.js → content-Cbavyq0x.js} +3 -3
- package/dist/admin/assets/{content-DsMSB6Wb.js.map → content-Cbavyq0x.js.map} +1 -1
- package/dist/admin/assets/{contentTypes-C-AKiYu1.js → contentTypes-DzQ_0v36.js} +2 -2
- package/dist/admin/assets/{contentTypes-C-AKiYu1.js.map → contentTypes-DzQ_0v36.js.map} +1 -1
- package/dist/admin/assets/{develop-DL-2W9jv.js → develop-BDqMOEql.js} +2 -2
- package/dist/admin/assets/{develop-DL-2W9jv.js.map → develop-BDqMOEql.js.map} +1 -1
- package/dist/admin/assets/{dropdown-menu-C53v9ioW.js → dropdown-menu-CVAnm22s.js} +2 -2
- package/dist/admin/assets/{dropdown-menu-C53v9ioW.js.map → dropdown-menu-CVAnm22s.js.map} +1 -1
- package/dist/admin/assets/es2015-BKfbx3rz.js +42 -0
- package/dist/admin/assets/es2015-BKfbx3rz.js.map +1 -0
- package/dist/admin/assets/{field-W1dB_h6d.js → field-Bg-JRgsB.js} +2 -2
- package/dist/admin/assets/{field-W1dB_h6d.js.map → field-Bg-JRgsB.js.map} +1 -1
- package/dist/admin/assets/{fileRoute-DzWMBrRx.js → fileRoute-DQCI1nMN.js} +2 -2
- package/dist/admin/assets/{fileRoute-DzWMBrRx.js.map → fileRoute-DQCI1nMN.js.map} +1 -1
- package/dist/admin/assets/{followPlural-D-5ZJqJF.js → followPlural-D0bENI5E.js} +2 -2
- package/dist/admin/assets/{followPlural-D-5ZJqJF.js.map → followPlural-D0bENI5E.js.map} +1 -1
- package/dist/admin/assets/{inbox-DUqOrFEA.js → inbox-Dfy4YBZ2.js} +2 -2
- package/dist/admin/assets/{inbox-DUqOrFEA.js.map → inbox-Dfy4YBZ2.js.map} +1 -1
- package/dist/admin/assets/{index-D03RZB7e.js → index-M4TUI1dl.js} +4 -4
- package/dist/admin/assets/{index-D03RZB7e.js.map → index-M4TUI1dl.js.map} +1 -1
- package/dist/admin/assets/{labels-CHE0gg1n.js → labels-BrwwGWnv.js} +2 -2
- package/dist/admin/assets/{labels-CHE0gg1n.js.map → labels-BrwwGWnv.js.map} +1 -1
- package/dist/admin/assets/{media-BUUEsWxd.js → media-DBdx-UmR.js} +2 -2
- package/dist/admin/assets/{media-BUUEsWxd.js.map → media-DBdx-UmR.js.map} +1 -1
- package/dist/admin/assets/{network-Bolr2lmf.js → network-BpbMYp6D.js} +2 -2
- package/dist/admin/assets/{network-Bolr2lmf.js.map → network-BpbMYp6D.js.map} +1 -1
- package/dist/admin/assets/{publishing-ClNjPLQ9.js → publishing-CpSDO3M7.js} +2 -2
- package/dist/admin/assets/{publishing-ClNjPLQ9.js.map → publishing-CpSDO3M7.js.map} +1 -1
- package/dist/admin/assets/{radio-group-rFxn7cz2.js → radio-group-DQ3sC1ol.js} +2 -2
- package/dist/admin/assets/{radio-group-rFxn7cz2.js.map → radio-group-DQ3sC1ol.js.map} +1 -1
- package/dist/admin/assets/{searchSchemas-C4qp-vCa.js → searchSchemas-D4S2ceA0.js} +2 -2
- package/dist/admin/assets/{searchSchemas-C4qp-vCa.js.map → searchSchemas-D4S2ceA0.js.map} +1 -1
- package/dist/admin/assets/{sections-C7Z6Xd8r.js → sections-Cl1LrzqH.js} +2 -2
- package/dist/admin/assets/{sections-C7Z6Xd8r.js.map → sections-Cl1LrzqH.js.map} +1 -1
- package/dist/admin/assets/{select-DUhL27UN.js → select-DjCAH45V.js} +2 -2
- package/dist/admin/assets/{select-DUhL27UN.js.map → select-DjCAH45V.js.map} +1 -1
- package/dist/admin/assets/{seo-l1ZORjtv.js → seo-DJ4k3LtY.js} +2 -2
- package/dist/admin/assets/{seo-l1ZORjtv.js.map → seo-DJ4k3LtY.js.map} +1 -1
- package/dist/admin/assets/{settings-DgoG3H8C.js → settings-DRZ33PTg.js} +2 -2
- package/dist/admin/assets/{settings-DgoG3H8C.js.map → settings-DRZ33PTg.js.map} +1 -1
- package/dist/admin/assets/{shapes-BZ87ap5s.js → shapes-BJe3IMuj.js} +5 -5
- package/dist/admin/assets/{shapes-BZ87ap5s.js.map → shapes-BJe3IMuj.js.map} +1 -1
- package/dist/admin/assets/{skeleton-Dyi_b1wq.js → skeleton-D4eOLKLY.js} +2 -2
- package/dist/admin/assets/{skeleton-Dyi_b1wq.js.map → skeleton-D4eOLKLY.js.map} +1 -1
- package/dist/admin/assets/src-DUpL-qwG.js +7 -0
- package/dist/admin/assets/src-DUpL-qwG.js.map +1 -0
- package/dist/admin/assets/{switch-C3dDDUIk.js → switch-B2R13aVU.js} +2 -2
- package/dist/admin/assets/{switch-C3dDDUIk.js.map → switch-B2R13aVU.js.map} +1 -1
- package/dist/admin/assets/{theme-DPe080iG.js → theme-X-qeg74W.js} +2 -2
- package/dist/admin/assets/{theme-DPe080iG.js.map → theme-X-qeg74W.js.map} +1 -1
- package/dist/admin/assets/{titles-C5PaMgFJ.js → titles-CLh5ftA2.js} +2 -2
- package/dist/admin/assets/{titles-C5PaMgFJ.js.map → titles-CLh5ftA2.js.map} +1 -1
- package/dist/admin/assets/{tooltip-BEaZkRPK.js → tooltip-u2epXfJF.js} +2 -2
- package/dist/admin/assets/{tooltip-BEaZkRPK.js.map → tooltip-u2epXfJF.js.map} +1 -1
- package/dist/admin/assets/{useContentSchema-wLDa2L3f.js → useContentSchema-DaQHlL19.js} +2 -2
- package/dist/admin/assets/{useContentSchema-wLDa2L3f.js.map → useContentSchema-DaQHlL19.js.map} +1 -1
- package/dist/admin/assets/{useDiscardGuard-WTUINqD5.js → useDiscardGuard-BVJGUCiH.js} +2 -2
- package/dist/admin/assets/{useDiscardGuard-WTUINqD5.js.map → useDiscardGuard-BVJGUCiH.js.map} +1 -1
- package/dist/admin/assets/{useMediaPickerDialog-CFN9ZKfe.js → useMediaPickerDialog-C23eOHQR.js} +2 -2
- package/dist/admin/assets/{useMediaPickerDialog-CFN9ZKfe.js.map → useMediaPickerDialog-C23eOHQR.js.map} +1 -1
- package/dist/admin/assets/{useMediaUploader-B42H_CMG.js → useMediaUploader-CTViR0LX.js} +2 -2
- package/dist/admin/assets/{useMediaUploader-B42H_CMG.js.map → useMediaUploader-CTViR0LX.js.map} +1 -1
- package/dist/admin/assets/{useResolvedScheme-aV0QDPi3.js → useResolvedScheme-Cg8TdO85.js} +2 -2
- package/dist/admin/assets/{useResolvedScheme-aV0QDPi3.js.map → useResolvedScheme-Cg8TdO85.js.map} +1 -1
- package/dist/admin/assets/{zod-C-k48Hnc.js → zod-D5i60ErJ.js} +2 -2
- package/dist/admin/assets/{zod-C-k48Hnc.js.map → zod-D5i60ErJ.js.map} +1 -1
- package/dist/admin/index.html +27 -27
- package/dist/cli.js +10 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.js +1 -1
- package/dist/{s3Adapter-sL1zP4Zl.js → s3Adapter-CtPzkzf0.js} +2 -2
- package/dist/{s3Adapter-sL1zP4Zl.js.map → s3Adapter-CtPzkzf0.js.map} +1 -1
- package/dist/{worker-DMES6pqh.js → worker-DRCCGGjl.js} +3823 -3719
- package/dist/worker-DRCCGGjl.js.map +1 -0
- package/package.json +5 -5
- package/dist/admin/assets/Builder-DyCcikfS.js +0 -2
- package/dist/admin/assets/Builder-DyCcikfS.js.map +0 -1
- package/dist/admin/assets/StepList-BIQjDaWQ.js +0 -2
- package/dist/admin/assets/StepList-BIQjDaWQ.js.map +0 -1
- package/dist/admin/assets/Structure-CO4aJZVP.js +0 -2
- package/dist/admin/assets/es2015-DrAA1N2V.js +0 -42
- package/dist/admin/assets/es2015-DrAA1N2V.js.map +0 -1
- package/dist/admin/assets/src-BcLeD2-K.js +0 -7
- package/dist/admin/assets/src-BcLeD2-K.js.map +0 -1
- package/dist/worker-DMES6pqh.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
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{k as i}from"./loader-circle-C-9trZPI.js";import{i as a}from"./media-VCJUbYzJ.js";import{n as o,t as s,v as c}from"./createLucideIcon-CqygG5K6.js";import{H as l}from"./src-
|
|
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{k as i}from"./loader-circle-C-9trZPI.js";import{i as a}from"./media-VCJUbYzJ.js";import{n as o,t as s,v as c}from"./createLucideIcon-CqygG5K6.js";import{H as l}from"./src-DUpL-qwG.js";import{C as u,E as d,_ as f,a as p,b as m,d as h,f as g,g as _,h as v,i as y,m as b,n as x,p as S,r as ee,v as te,w as ne,y as re}from"./InfoHint-Dyzyf59c.js";import{i as C,n as ie,r as ae,t as oe}from"./skeleton-D4eOLKLY.js";import{a as se,i as ce,n as le,r as ue,t as de}from"./select-DjCAH45V.js";import{_ as fe,l as pe,v as me}from"./field-Bg-JRgsB.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-WIrbyv1a.js";import{n as Ke,t as qe}from"./link-B3O0VUVT.js";import{n as Je}from"./stableId-iRkUbVIP.js";import{t as Ye}from"./image-off-TVxEyb74.js";import{t as Xe}from"./image-B6aL7hP8.js";import{a as Ze,l as Qe,m as $e,p as et,r as tt,t as nt}from"./dropdown-menu-CVAnm22s.js";import{t as rt}from"./plus-WfYKHW7G.js";import{t as it}from"./sparkles-DCRAqbqD.js";import{t as at}from"./undo-2-Zd1OT6qk.js";import{t as ot}from"./cn-DVhJ55Mo.js";import{i as st,n as ct,t as lt}from"./tooltip-u2epXfJF.js";import{t as ut}from"./HintedLabel-BrLH4NQW.js";import{n as dt,o as ft}from"./context-fImO9k99.js";import{h as pt,i as mt,l as ht,m as gt,r as _t,t as vt}from"./AssistError-CMXQWiQo.js";import{t as yt}from"./SuggestAltButton-CxS8IR6m.js";import{c as bt,n as xt,o as St,s as Ct}from"./InsertMenuItem-BvRDuXtd.js";import{t as wt}from"./textarea-BBjqMF-Y.js";import{n as Tt,t as Et}from"./w3c-keyname-BOAvb0qz.js";var Dt={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`}]]};Dt.node;var Ot=s(Dt),kt={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`}]]};kt.node;var At=s(kt),jt={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`}]]};jt.node;var Mt=s(jt),j=e(t(),1),Nt=e(n(),1),Pt=c(),Ft=Object.defineProperty,It=(e,t)=>{let n={};for(var r in e)Ft(n,r,{get:e[r],enumerable:!0});return t||Ft(n,Symbol.toStringTag,{value:`Module`}),n},Lt=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Rt(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var zt=(e,t,n)=>{let r=Rt(e,n);if(!r)return!1;let i=Gt(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(un(e,i,t,-1))return!0;if(r.parent.content.size==0&&(Ut(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(Ut(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},Bt=(e,t,n)=>{let r=Rt(e,n);if(!r)return!1;let i=Gt(r);return i?Ht(e,i,t):!1},Vt=(e,t,n)=>{let r=Kt(e,n);if(!r)return!1;let i=Yt(r);return i?Ht(e,i,t):!1};function Ht(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 Ut(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 Wt=(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=Gt(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 Gt(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 Kt(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var qt=(e,t,n)=>{let r=Kt(e,n);if(!r)return!1;let i=Yt(r);if(!i)return!1;let a=i.nodeAfter;if(un(e,i,t,1))return!0;if(r.parent.content.size==0&&(Ut(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(Ut(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},Jt=(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=Yt(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 Yt(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 Xt=(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},Zt=(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},Qt=(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)},$t=(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
2
|
`).scrollIntoView()),!0)};function en(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 tn=(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=en(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},nn=(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=en(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},rn=(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 an(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=en(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 on=an(),sn=(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)},cn=(e,t)=>(t&&t(e.tr.setSelection(new Le(e.doc))),!0);function ln(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 un(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&ln(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&&Ut(a,`start`,!0)&&Ut(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 dn(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 fn=dn(-1),pn=dn(1);function mn(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 hn(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 gn(...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 _n=gn(Lt,zt,Wt),vn=gn(Lt,qt,Jt),yn={Enter:gn($t,nn,rn,on),"Mod-Enter":tn,Backspace:_n,"Mod-Backspace":_n,"Shift-Backspace":_n,Delete:vn,"Mod-Delete":vn,"Mod-a":cn},bn={"Ctrl-h":yn.Backspace,"Alt-Backspace":yn[`Mod-Backspace`],"Ctrl-d":yn.Delete,"Ctrl-Alt-Backspace":yn[`Mod-Delete`],"Alt-Delete":yn[`Mod-Delete`],"Alt-d":yn[`Mod-Delete`],"Ctrl-a":fn,"Ctrl-e":pn};for(let e in yn)bn[e]=yn[e];typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform();function xn(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 Sn(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function Sn(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&&Cn(e,t,s,i,n),!0):!1}function Cn(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 wn(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?Tn(t,n,e,a):En(t,n,a):!0:!1}}function Tn(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 En(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 Dn(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),On=i(),N=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},kn=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},An=null,jn=function(e,t,n){let r=An||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},Mn=function(){An=null},Nn=function(e,t,n,r){return n&&(Fn(e,t,n,r,-1)||Fn(e,t,n,r,1))},Pn=/^(img|br|input|textarea|hr)$/i;function Fn(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:P(e))){let n=e.parentNode;if(!n||!F(n)||Bn(e)||Pn.test(e.nodeName)||e.contentEditable==`false`)return!1;t=N(e)+(i<0?0:1),e=n}else if(F(e)){let n=e.childNodes[t+(i<0?-1:0)];if(F(n)&&n.contentEditable==`false`){if(n.pmViewDesc?.ignoreForSelection)t+=i;else return!1}else e=n,t=i<0?P(e):0}else return!1}}function P(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function F(e){return e.nodeType==1}function I(e){return e.nodeType==3}function In(e,t){return t?e.contains(F(t)?t:t.parentNode):!1}function Ln(e,t){for(;;){if(I(e)&&t)return e;if(F(e)&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=P(e)}else if(e.parentNode&&!Bn(e))t=N(e),e=e.parentNode;else return null}}function Rn(e,t){for(;;){if(I(e)&&t<e.nodeValue.length)return e;if(F(e)&&t<e.childNodes.length){if(e.contentEditable==`false`)return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!Bn(e))t=N(e)+1,e=e.parentNode;else return null}}function zn(e,t,n){for(let r=t==0,i=t==P(e);r||i;){if(e==n)return!0;let t=N(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==P(e)}}function Bn(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 Vn=function(e){return e.focusNode&&Nn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Hn(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function Un(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function Wn(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(P(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(P(r.startContainer),r.startOffset)}}}var Gn=typeof navigator<`u`?navigator:null,Kn=typeof document<`u`?document:null,qn=Gn&&Gn.userAgent||``,Jn=/Edge\/(\d+)/.exec(qn),Yn=/MSIE \d/.exec(qn),Xn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(qn),Zn=!!(Yn||Xn||Jn),Qn=Yn?document.documentMode:Xn?+Xn[1]:Jn?+Jn[1]:0,$n=!Zn&&/gecko\/(\d+)/i.test(qn);$n&&+(/Firefox\/(\d+)/.exec(qn)||[0,0])[1];var er=!Zn&&/Chrome\/(\d+)/.exec(qn),L=!!er,tr=er?+er[1]:0,R=!Zn&&!!Gn&&/Apple Computer/.test(Gn.vendor),nr=R&&(/Mobile\/\w+/.test(qn)||!!Gn&&Gn.maxTouchPoints>2),rr=nr||(Gn?/Mac/.test(Gn.platform):!1),ir=Gn?/Win/.test(Gn.platform):!1,ar=/Android \d/.test(qn),or=!!Kn&&`webkitFontSmoothing`in Kn.documentElement.style,sr=or?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function cr(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 lr(e,t){return typeof e==`number`?e:e[t]}function ur(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 dr(e,t,n){if(!Er(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(!F(o)){o=kn(o);continue}let e=o==a.body,n=e?cr(a):ur(o),s=0,c=0;if(t.top<n.top+lr(r,`top`)?c=-(n.top-t.top+lr(i,`top`)):t.bottom>n.bottom-lr(r,`bottom`)&&(c=t.bottom-t.top>n.bottom-n.top?t.top+lr(i,`top`)-n.top:t.bottom-n.bottom+lr(i,`bottom`)),t.left<n.left+lr(r,`left`)?s=-(n.left-t.left+lr(i,`left`)):t.right>n.right-lr(r,`right`)&&(s=t.right-n.right+lr(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:kn(o)}}function fr(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:pr(e.dom)}}function pr(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=kn(r));return t}function mr({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;hr(n,r==0?0:r-t)}function hr(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 gr=null;function _r(e){if(e.setActive)return e.setActive();if(gr)return e.focus(gr);let t=pr(e);e.focus(gr==null?{get preventScroll(){return gr={preventScroll:!0},!0}}:void 0),gr||(gr=!1,hr(t,0))}function vr(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(F(u))e=u.getClientRects();else if(I(u))e=jn(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&&I(n)?{left:p.right<t.left?p.right:p.left,top:t.top}:t,F(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&&I(n)?yr(n,i):!n||r?{node:e,offset:a}:vr(n,i)}function yr(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=Dr(r,1);if(n.top!=n.bottom&&br(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function br(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function xr(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function Sr(e,t,n){let{node:r,offset:i}=vr(t,n),a=-1;if(F(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 Cr(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(F(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 wr(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(F(n)){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(br(t,i))return wr(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function Tr(e,t){let n=e.dom.ownerDocument,r,i=0,a=Wn(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(!br(t,n)||(o=wr(e.dom,t,n),!o))return null}if(R)for(let e=o;r&&e;e=kn(e))e.draggable&&(r=void 0);if(o=xr(o,t),r){if($n&&F(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;or&&i&&F(r)&&F(n=r.childNodes[i-1])&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&F(r.lastChild)&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||!F(r)||r.childNodes[i-1].nodeName!=`BR`)&&(s=Cr(e,r,i,t))}s??=Sr(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function Er(e){return e.top<e.bottom||e.left<e.right}function Dr(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Er(e))return e}return Array.prototype.find.call(n,Er)||e.getBoundingClientRect()}var Or=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function kr(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=or||$n;if(I(r)){if(o&&(Or.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=Dr(jn(r,i,i),n);if($n&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=Dr(jn(r,i-1,i-1),-1);if(t.top==e.top){let n=Dr(jn(r,i,i+1),-1);if(n.top!=e.top)return Ar(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++,Ar(Dr(jn(r,e,t),a),a<0)}}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==P(r))){let e=r.childNodes[i-1];if(F(e))return jr(e.getBoundingClientRect(),!1)}if(a==null&&i<P(r)){let e=r.childNodes[i];if(F(e))return jr(e.getBoundingClientRect(),!0)}return jr(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==P(r))){let e=r.childNodes[i-1],t=I(e)?jn(e,P(e)-+!o):F(e)&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return Ar(Dr(t,1),!1)}if(a==null&&i<P(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?I(e)?jn(e,0,+!o):F(e)?e:null:null;if(t)return Ar(Dr(t,-1),!0)}return Ar(Dr(I(r)?jn(r):r,-n),n>=0)}function Ar(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 jr(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 Mr(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 Nr(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return Mr(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=kr(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(F(e))t=e.getClientRects();else if(I(e))t=jn(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 Pr=/[\u0590-\u08ac]/;function Fr(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?!Pr.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:Mr(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&&!In(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 Ir=null,Lr=null,Rr=!1;function zr(e,t,n){return Ir==t&&Lr==n?Rr:(Ir=t,Lr=n,Rr=n==`up`||n==`down`?Nr(e,t,n):Fr(e,t,n))}var Br=0,Vr=1,Hr=2,Ur=3,Wr=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=Br,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&&In(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)&&!(F(a)?In(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 Zr||e instanceof Gr&&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(!F(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(($n||R)&&e==t){let{node:e,offset:t}=o;if(I(e)){if(u=!!(t&&e.nodeValue[t-1]==`
|
|
3
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($n&&l.focusNode&&l.focusNode!=s.node&&F(l.focusNode)){let e=l.focusNode.childNodes[l.focusOffset];e&&e.contentEditable==`false`&&(r=!0)}if(!(r||u&&R)&&Nn(o.node,o.offset,l.anchorNode,l.anchorOffset)&&Nn(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&$n)){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?Hr:Vr,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Ur:i.markDirty(e-r,t-r);return}i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Hr:Ur}n=a}this.dirty=Hr}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?Hr:Vr;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},Gr=class extends Wr{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=F(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==Br&&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}},Kr=class extends Wr{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}},qr=class e extends Wr{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&Ur||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ur&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Br){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=Br}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=mi(a,n,o,r)),t>0&&(a=mi(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()}},Jr=class e extends Wr{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(!I(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=ai(u,r,n),l?c=new Qr(t,n,r,i,u,d||null,f,l):n.isText?new Xr(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=>F(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==Br&&e.eq(this.node)&&oi(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 ci(this,a&&a.node,e),c=this.node.inlineContent,l=c&&this.node.isBlock;di(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==Hr)&&(a&&this.protectLocalComposition(e,a),$r(this.contentDOM,this.children,e),nr&&fi(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=pi(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 Kr(this,i,t,r);e.input.compositionNodes.push(a),this.children=mi(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==Ur||!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=Br}updateOuterDeco(e){if(oi(e,this.outerDeco))return;let t=!F(this.nodeDOM),n=this.dom;this.dom=ri(this.dom,this.nodeDOM,ni(this.outerDeco,this.node,t),ni(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){F(this.nodeDOM)&&(this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){F(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 Yr(e,t,n,r,i){ai(r,t,e);let a=new Jr(void 0,e,t,n,r,r,r);return a.contentDOM&&a.updateChildren(i,0),a}var Xr=class e extends Jr{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==Ur||this.dirty!=Br&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Br||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=Br,!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=Ur)}get domAtom(){return!1}isText(e){return this.node.text==e}},Zr=class extends Wr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Br&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},Qr=class extends Jr{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==Ur)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 $r(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=si(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof qr){let t=r?r.previousSibling:e.lastChild;$r(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=si(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var ei=function(e){e&&(this.nodeName=e)};ei.prototype=Object.create(null);var ti=[new ei];function ni(e,t,n){if(e.length==0)return ti;let r=n?ti[0]:new ei,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new ei(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new ei(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 ri(e,t,n,r){if(n==ti&&r==ti)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=ti[0],i=t)}ii(i,o||ti[0],a)}return i}function ii(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 ai(e,t,n){return ri(e,e,ti,ni(t,n,!F(e)))}function oi(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 si(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var ci=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=li(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=Br,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 qr&&t.dirty!=Ur&&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=qr.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==Ur&&a.dom==a.contentDOM&&(a.dirty=Hr),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 Jr){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!=Ur&&oi(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=Hr,u.updateChildren(r,a+1),u.dirty=Br),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)||!oi(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=Jr.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=Jr.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 Gr(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 qr;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Xr)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((R||L)&&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 Zr(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||F(e)&&e.contains(this.lock.parentNode))}};function li(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 qr)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 ui(e,t){return e.type.side-t.type.side}function di(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(ui);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 fi(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 pi(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 mi(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 hi(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(Vn(n)){for(c=o;i&&!i.node;)i=i.parent;if(i&&i.node.isAtom&&E.isSelectable(i.node)&&i.parent&&!(i.node.isInline&&zn(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new E(o==e?s:r.resolve(e))}else if($n&&t==`key`&&o>e.state.selection.to&&F(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||!F(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=Ei(e,u,s,n)}return l}function gi(e){return e.editable?e.hasFocus():Oi(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function _i(e,t=!1){let n=e.state.selection;if(wi(e,n),!gi(e))return;let r=e.input.mouseDown;if(!t&&L&&r){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Nn(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)&&r.delaySelUpdate()){e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)Ci(e);else{let{anchor:r,head:i}=n,a,o;vi&&!(n instanceof k)&&(n.$from.parent.inlineContent||(a=yi(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=yi(e,n.to))),e.docView.setSelection(r,i,e,t),vi&&(a&&xi(a),o&&xi(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&Si(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}var vi=R||L&&tr<63;function yi(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(R&&i&&i.contentEditable==`false`)return bi(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return bi(i);if(a)return bi(a)}}function bi(e){return e.contentEditable=`true`,R&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function xi(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function Si(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(()=>{(!gi(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function Ci(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&&Zn&&Qn<=11&&(n.disabled=!0,n.disabled=!1)}function wi(e,t){if(t instanceof E){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Ti(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Ti(e)}function Ti(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function Ei(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||k.between(t,n,r)}function Di(e){return e.editable&&!e.hasFocus()?!1:Oi(e)}function Oi(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return In(e.dom,t.anchorNode)&&(e.editable||In(e.dom,t.focusNode))}catch{return!1}}function ki(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Nn(t.node,t.offset,n.anchorNode,n.anchorOffset)}function Ai(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 ji(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Mi(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 ji(e,new k(r.$anchor,a))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=Ai(e.state,t);return n&&n instanceof E?ji(e,n):!1}if(!(rr&&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)?ji(e,new E(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):ji(e,new k(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1}}else if(r instanceof E&&r.node.isInline)return ji(e,new k(t>0?r.$to:r.$from));else{let n=Ai(e.state,t);return n?ji(e,n):!1}}function Ni(e,t){let n=e.pmViewDesc;return n?n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`):F(e)&&e.contentEditable==`false`}function Pi(e,t){return t<0?Fi(e):Ii(e)}function Fi(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for($n&&F(n)&&r<P(n)&&Ni(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(!F(n))break;let e=n.childNodes[r-1];if(Ni(e,-1))i=n,a=--r;else if(I(e))n=e,r=n.nodeValue.length;else break}else if(Li(n))break;else{let t=n.previousSibling;for(;t&&Ni(t,-1);)i=n.parentNode,a=N(t),t=t.previousSibling;if(t)n=t,r=P(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?Bi(e,n,r):i&&Bi(e,i,a)}function Ii(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=P(n),a,o;for(;;)if(r<i){if(!F(n))break;let e=n.childNodes[r];if(Ni(e,1))a=n,o=++r;else break}else if(Li(n))break;else{let t=n.nextSibling;for(;t&&Ni(t,1);)a=t.parentNode,o=N(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=P(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&Bi(e,a,o)}function Li(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Ri(e,t){for(;e&&t==e.childNodes.length&&!Bn(e);)t=N(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(I(n))return n;if(F(n)&&n.contentEditable==`false`)break;e=n,t=0}}function zi(e,t){for(;e&&!t&&!Bn(e);)t=N(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(I(n))return n;if(F(n)&&n.contentEditable==`false`)break;e=n,t=e.childNodes.length}}function Bi(e,t,n){if(!I(t)){let e,r;(r=Ri(t,n))?(t=r,n=0):(e=zi(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Vn(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&&_i(e)},50)}function Vi(e,t){let n=e.state.doc.resolve(t);if(!(L||ir)&&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 Hi(e,t,n){let r=e.state.selection;if(r instanceof k&&!r.empty||n.indexOf(`s`)>-1||rr&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=Ai(e.state,t);if(n&&n instanceof E)return ji(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?ji(e,o):!1}return!1}function Ui(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 Wi(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Gi(e){if(!R||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&F(t)&&n==0&&t.firstChild&&F(t.firstChild)&&t.firstChild.contentEditable==`false`){let n=t.firstChild;Wi(e,n,`true`),setTimeout(()=>Wi(e,n,`false`),20)}return!1}function Ki(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function qi(e,t){let n=t.keyCode,r=Ki(t);if(n==8||rr&&n==72&&r==`c`)return Ui(e,-1)||Pi(e,-1);if(n==46&&!t.shiftKey||rr&&n==68&&r==`c`)return Ui(e,1)||Pi(e,1);if(n==13||n==27)return!0;if(n==37||rr&&n==66&&r==`c`){let t=n==37?Vi(e,e.state.selection.from)==`ltr`?-1:1:-1;return Mi(e,t,r)||Pi(e,t)}if(n==39||rr&&n==70&&r==`c`){let t=n==39?Vi(e,e.state.selection.from)==`ltr`?1:-1:1;return Mi(e,t,r)||Pi(e,t)}return n==38||rr&&n==80&&r==`c`?Hi(e,-1,r)||Pi(e,-1):n==40||rr&&n==78&&r==`c`?Gi(e)||Hi(e,1,r)||Pi(e,1):!(r!=(rr?`m`:`c`)||n!=66&&n!=73&&n!=89&&n!=90)}function Ji(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=ia(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&F(l)&&(u=ra[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&&F(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
4
|
|
|
@@ -141,4 +141,4 @@ img.ProseMirror-separator {
|
|
|
141
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(Nx,this.editor.getAttributes(Px)).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=Dx(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=Pd({find:Fx,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:e});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Pd({find:Fx,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Px)}),joinPredicate:e,editor:this.editor})),[t]}}),Rx=/^\s*(\[([( |x])?\])\s$/,zx=`position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0`,Bx=(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`}`},Vx=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)=>Xu(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addExtensions(){return this.options.nested?[Ub(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=zx;let l=e=>{let t=Bx(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=al(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[Pd({find:Rx,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),Hx=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
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=qu(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=qu(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(zb.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(cx.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(_x.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(Lx.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(Vx.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Hx.configure(this.options.taskList)),e}});var Ux=` `,Wx=`\xA0`,Gx=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===Ux||n[0].text===Ux||n[0].raw===Wx||n[0].text===Wx)&&r.length===1&&r[0].type===`text`&&(r[0].text===Ux||r[0].text===Wx)?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?Ux:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Kx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,qx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Jx=sd.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[jd({find:Kx,type:this.type})]},addPasteRules(){return[Id({find:qx,type:this.type})]}}),Yx=K.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),Xx=sd.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()}}}),Zx=G.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(vb.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(pb.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(zb.configure(this.options.bulletList)),this.options.code!==!1&&e.push(Sb.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(Eb.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(Db.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(jy.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(My.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(Ob.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(kb.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(rb.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(Ab.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(Fb.configure(this.options.italic)),this.options.listItem!==!1&&e.push(cx.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(_x.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(Iv.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(Lx.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(Gx.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(Jx.configure(this.options.strike)),this.options.text!==!1&&e.push(Yx.configure(this.options.text)),this.options.underline!==!1&&e.push(Xx.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(nb.configure(this.options?.trailingNode)),e}}),Qx=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,$x=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=>Qx.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}})}}}),eS=Iv.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=>Ip.test(e.trim())}),tS=e=>e.extend({addAttributes(){let{align:e,...t}=this.parent?.()??{};return t}}),nS=({placeholder:e,imageView:t}={})=>[Zx.configure({strike:!1,underline:!1,link:!1,heading:{levels:[1,2,3,4,5,6]}}),eS,_y.configure({table:{resizable:!0,allowTableNodeSelection:!0},tableCell:!1,tableHeader:!1}),tS(qv),tS(Jv),t?$x.extend({addNodeView:()=>t}):$x,...e?[Xy.configure({placeholder:e})]:[]],rS=[`w1280`,`w640`],iS=e=>typeof e==`string`?e:``,aS=({node:e,updateAttributes:t,deleteNode:n,selected:r,editor:i,appearance:s=`form`})=>{let{t:c}=o(),l=typeof e.attrs.mediaId==`string`?e.attrs.mediaId:void 0,u=iS(e.attrs.alt),d=iS(e.attrs.title),f=a(l),p=rS.map(e=>f.data?.variants.find(t=>t.name===e&&t.url)?.url).find(Boolean)??f.data?.url,m=i.isEditable,h=(0,j.useId)(),g=(0,j.useId)(),_=s===`canvas`,v=(0,j.useContext)(dt)?.locale,y=(e,n)=>t({[e]:n===``?null:n});return(0,M.jsxs)(rp,{as:`figure`,"data-drag-handle":!0,"data-media-id":l,className:ot(`not-prose my-4 space-y-2`,_?`font-sans`:`rounded-lg border bg-card p-2`,r&&`rounded-lg ring-2 ring-ring ring-offset-2 ring-offset-background`),children:[f.isPending?(0,M.jsx)(oe,{className:ot(`w-full rounded-md`,_?`h-72 rounded-xl`:`h-48`)}):p?(0,M.jsx)(`img`,{src:p,alt:u,className:ot(`w-full object-contain`,_?`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)(Ye,{"aria-hidden":`true`,className:`size-4`}),c(`content.richText.imageMissing`)]}),_?(0,M.jsxs)(`figcaption`,{className:`space-y-1`,children:[(0,M.jsx)(`label`,{htmlFor:g,className:`sr-only`,children:c(`entry.image.caption`)}),(0,M.jsx)(`input`,{id:g,value:d,readOnly:!m,placeholder:f.data?.caption||c(`entry.image.captionPlaceholder`),onChange:e=>y(`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:h,className:`shrink-0 text-meta font-semibold text-muted-foreground`,children:c(`content.richText.altLabel`)}),(0,M.jsx)(ie,{id:h,value:u,readOnly:!m,placeholder:f.data?.alt||c(`content.richText.altPlaceholder`),inputSize:`sm`,"data-alt-input":!0,onChange:e=>y(`alt`,e.target.value)}),m?(0,M.jsx)(yt,{assetId:l,mimeType:f.data?.mimeType,locale:v,onSuggest:e=>y(`alt`,e),className:`shrink-0`}):null,m?(0,M.jsx)(C,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":c(`content.richText.removeImage`),onClick:n,children:(0,M.jsx)(fe,{"aria-hidden":`true`})}):null]})]})},oS=e=>(0,M.jsx)(aS,{...e,appearance:`canvas`});function sS(e){let{char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:o}=e,s=n&&!r,c=Hu(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 cS(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
143
|
`);return/\s/.test(n)}):!1}function lS(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 uS(e,t,n,r){return n?()=>{let n=r.getState(e.state)?.decorationId;return t.dom.querySelector(`[data-decoration-id="${n}"]`)?.getBoundingClientRect()||null}:lS(e)}function dS({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&&!cS(r)}function fS({view:e,pluginKeyRef:t}){let n=e.state.tr.setMeta(t,{exit:!0});e.dispatch(n)}function pS({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),z.create(a.doc,[io.inline(s.from,s.to,{nodeName:t,class:d.join(` `),"data-decoration-id":c||void 0,"data-decoration-content":r})])}}}function mS({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 hS({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 gS({placement:e,offset:t,flip:n,floatingUi:r}){var i;let a=[te({mainAxis:t.mainAxis??4,crossAxis:t.crossAxis??0})];return n&&a.push(v()),r!=null&&(i=r.middleware)!=null&&i.length&&a.push(...r.middleware),{placement:e,strategy:r?.strategy??`absolute`,middleware:a}}function _S(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 vS({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&&_S(r).appendChild(o),s.onPosition||(o.style.visibility=`hidden`,o.style.width=`max-content`);let d=S(c,o,()=>{b(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 yS({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,_=hS({editor:e,items:n}),v=gS({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,ee=b.query!==x.query,te=b.text!==x.text,ne=b.range.from!==x.range.from||b.range.to!==x.range.to,re=ee||te||ne;if(!b.active&&x.active)S=`started`;else if(b.active&&!x.active)S=`stopped`;else if(x.active&&re)S=`updated`;else return;let C=S===`stopped`?b:x,ie=n.dom.querySelector(`[data-decoration-id="${C.decorationId}"]`),ae=m(n,ie),oe=i===0||(C.query?C.query.length>=i:!1),se=(S===`started`||S===`updated`)&&oe;if(g={editor:e,range:C.range,query:C.query||``,text:C.text||``,items:o??[],command:t=>p({editor:e,range:C.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:vS({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(C.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 bS=new A(`suggestion`);function xS({pluginKey:e=bS,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:ee=()=>!0,findSuggestionMatch:te=sS,shouldShow:ne,shouldResetDismissed:re}){let C=S?.(),ie=r&&!i,ae=(n,r)=>uS(t,n,r,e);function oe(e){return dS({...e,editor:t,shouldResetDismissed:re,effectiveAllowSpaces:ie})}let se=t=>fS({view:t,pluginKeyRef:e});return new O({key:e,view:()=>yS({editor:t,pluginKey:e,items:f,renderer:C,minQueryLength:p,debounce:m,initialItems:h,placement:g,offset:_,container:v,flip:y,floatingUi:b,dismissOnOutsideClick:x,command:d,clientRectFor:ae,dispatchExit:se}),state:mS({editor:t,char:n,effectiveAllowSpaces:ie,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,findSuggestionMatch:te,allow:ee,shouldShow:ne,shouldKeepDismissed:oe,pluginKey:e}),props:pS({pluginKey:e,decorationTag:s,decorationClass:c,decorationContent:l,decorationEmptyClass:u,renderer:C,dispatchExit:se})})}function SS(e,t=bS){let n=e.state.tr.setMeta(t,{exit:!0});e.dispatch(n)}var CS=()=>({onChange:Sp(()=>void 0),onKeyDown:Sp(()=>!1)}),wS=new A(`slashCommand`),TS=e=>SS(e,wS),ES=()=>null,DS=G.create({name:`slashCommand`,addOptions(){return{bridge:CS()}},addProseMirrorPlugins(){let{bridge:e}=this.options,t=t=>e.onChange.call({query:t.query,range:t.range,rect:t.clientRect??ES});return[xS({editor:this.editor,pluginKey:wS,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)})})]}}),OS=e=>e?.id,kS=new A(`uploadPlaceholder`),AS=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},jS=G.create({name:`uploadPlaceholder`,addOptions(){return{label:e=>e}},addProseMirrorPlugins(){let{label:e}=this.options;return[new O({key:kS,state:{init:()=>z.empty,apply:(t,n)=>{let r=n.map(t.mapping,t.doc),i=t.getMeta(kS);if(i&&`add`in i){let n=io.widget(i.add.pos,()=>AS(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=>OS(e)===i.remove.id)));return r}},props:{decorations:e=>kS.getState(e)}})]}}),MS=(e,t,n,r)=>e.setMeta(kS,{add:{id:t,pos:n},name:r}),NS=(e,t)=>e.setMeta(kS,{remove:{id:t}}),PS=(e,t)=>kS.getState(e)?.find(void 0,void 0,e=>OS(e)===t)[0]?.from,FS=[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`image/avif`,`image/svg+xml`],IS=(e,t,n,r,i)=>Promise.all(t.map(async t=>{let a=crypto.randomUUID();e.view.dispatch(MS(e.state.tr,a,n,t.name));try{let n=await r(t);if(e.isDestroyed)return;let i=PS(e.state,a);e.view.dispatch(NS(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(NS(e.state.tr,a)),i(t,n)}})),LS=({placeholder:e,uploadingLabel:t,slash:n,onFiles:r})=>[...nS({placeholder:e,imageView:_p(oS)}),qp,DS.configure({bridge:n}),jS.configure({label:t}),...r?[fg.configure({allowedMimeTypes:FS,consumePasteEvent:!0,onDrop:(e,t,n)=>r(e,t,n),onPaste:(e,t)=>r(e,t,e.state.selection.to)})]:[]],RS=({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)(x,{open:t.open,onOpenChange:e=>{e||(t.close(),a(``))},children:[s?(0,M.jsx)(ee,{virtualRef:Vp(e,s)}):null,(0,M.jsx)(y,{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)(ut,{htmlFor:`${r}-result`,label:n(`assist.rewrite.proposal`,{model:c.model}),hint:n(`assist.rewrite.marksHint`)}),(0,M.jsx)(wt,{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)(C,{type:`button`,variant:`ghost`,size:`sm`,onClick:t.discard,children:n(`assist.discard`)}),(0,M.jsx)(C,{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)(ut,{htmlFor:`${r}-instruction`,label:n(`assist.rewrite.instruction`),hint:n(`assist.rewrite.marksHint`)}),(0,M.jsx)(ie,{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:gt.toLocaleString()})}):null,(0,M.jsx)(vt,{error:t.error}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,M.jsx)(C,{type:`button`,variant:`outline`,size:`sm`,disabled:l||t.tooLong,onClick:()=>t.run(pt.shorten),children:n(`assist.rewrite.shorten`)}),(0,M.jsx)(C,{type:`button`,variant:`outline`,size:`sm`,disabled:l||t.tooLong,onClick:()=>t.run(pt.expand),children:n(`assist.rewrite.expand`)}),(0,M.jsx)(_t,{variant:`default`,pending:l,pendingLabel:n(`assist.working`),disabled:i.trim()===``||t.tooLong,onClick:()=>t.run(i),children:n(`assist.rewrite.run`)})]})]})})]})},zS={ArrowDown:1,ArrowUp:-1},BS=({editor:e,bridge:t,onChoose:n})=>{let{t:r}=o(),i=(0,j.useId)(),[a,s]=(0,j.useState)(null),[c,l]=(0,j.useState)(0),u=e=>r(e.labelKey),d=a?Re(a.query,u):[],f=d[Math.min(c,d.length-1)],p=e=>{e&&a&&n(e.type,a)};(0,j.useEffect)(()=>{t.onChange.set(e=>{s(e),e?.query!==a?.query&&l(0)}),t.onKeyDown.set(e=>{if(!a||d.length===0)return!1;let t=zS[e.key];return t===void 0?e.key===`Enter`||e.key===`Tab`?(p(f),!0):!1:(l(e=>(e+t+d.length)%d.length),!0)})}),(0,j.useEffect)(()=>()=>{t.onChange.reset(),t.onKeyDown.reset()},[t]);let m=a!==null&&d.length>0;return(0,M.jsxs)(x,{open:m,onOpenChange:t=>{t||TS(e.view)},children:[(0,M.jsx)(ee,{virtualRef:{current:{getBoundingClientRect:()=>a?.rect()??new DOMRect}}}),(0,M.jsx)(y,{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:d.map((e,t)=>(0,M.jsxs)(`li`,{role:`option`,"aria-selected":e===f,className:ot(`flex cursor-pointer items-center gap-3 rounded-md px-2 py-1.5 text-sm`,e===f&&`bg-accent text-accent-foreground`),onMouseEnter:()=>l(t),onMouseDown:t=>{t.preventDefault(),p(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`})}),u(e)]},e.type))})})]})},VS=[`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(` `),HS=(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=Wp(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}},US=e=>{let{t}=o(),{uploadMedia:n}=ft(),{context:r,definition:i,field:a,path:s}=e,[c,l]=(0,j.useState)(!1),[f,p]=(0,j.useState)(null),[m,h]=(0,j.useState)(!1),[g]=(0,j.useState)(CS),_=(0,j.useRef)(null),[v]=(0,j.useState)(()=>Sp(()=>void 0)),y=n!==void 0,b=typeof a.options.placeholder==`string`?a.options.placeholder:void 0,x=(0,j.useMemo)(()=>LS({placeholder:b??t(`entry.canvas.placeholder`),uploadingLabel:e=>t(`entry.upload.uploading`,{name:e}),slash:g,onFiles:y?v.call:void 0}),[b,t,g,y,v]);(0,j.useEffect)(()=>{v.set((e,r,i)=>{n&&IS(e,r,i,n,(e,n)=>{u(n,`uploading ${e.name} into rich text`),d.error(t(`entry.upload.failed`,{name:e.name}))})})});let{editor:S,initial:ee,editable:te}=Bp({props:e,extensions:x,contentClasses:VS,onLinkShortcut:()=>l(!0),refuseFileDrops:!y}),re=mt(),C=kp(S),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 ne(e,`picking images`),[]}},[r]),ae=(0,j.useCallback)((e,t)=>Me(S,e,t,ie),[S,ie]),oe=(0,j.useMemo)(()=>({insertBlock:(e,t)=>ae(e,Ie(S,t))}),[ae,S]);be(s,te?oe:void 0);let se=e=>{!m&&_.current&&te&&p(HS(S,_.current,e.clientY))},ce=i.type===`richtext`?i.settings.maxLength:void 0;return(0,M.jsxs)(`div`,{ref:_,className:`relative`,onMouseMove:se,onMouseLeave:()=>m?void 0:p(null),"data-rich-text-canvas":!0,children:[te&&f?(0,M.jsx)(Jp,{editor:S,block:f,onInsert:(e,t)=>void ae(e,t),onMenuOpenChange:h}):null,(0,M.jsx)(Gf,{editor:S}),te?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(ug,{editor:S,onLink:()=>l(!0),onRewrite:re?C.start:void 0}),re?(0,M.jsx)(RS,{editor:S,rewrite:C}):null,(0,M.jsx)(Hp,{editor:S,active:S.isActive(`link`),disabled:!1,open:c,onOpenChange:l,anchorToSelection:!0}),(0,M.jsx)(BS,{editor:S,bridge:g,onChoose:(e,t)=>void De(S,e,t.range,ie)})]}):null,(0,M.jsx)(Up,{editor:S,initial:ee,maxLength:ce})]})},WS={rows:3,cols:3,withHeaderRow:!0},GS=({editor:e,inTable:t,disabled:n})=>{let{t:r}=o(),i=t=>t(e.chain().focus()).run();return(0,M.jsxs)(nt,{children:[(0,M.jsx)(et,{asChild:!0,disabled:n,children:(0,M.jsx)(C,{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)(tt,{align:`start`,onCloseAutoFocus:t=>{t.preventDefault(),e.commands.focus()},children:[(0,M.jsx)(Ze,{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(WS)),children:r(`content.richText.insertTable`)}),(0,M.jsx)(Qe,{}),(0,M.jsx)(Ze,{disabled:!t,onSelect:()=>i(e=>e.addRowAfter()),children:r(`content.richText.addRow`)}),(0,M.jsx)(Ze,{disabled:!t,onSelect:()=>i(e=>e.addColumnAfter()),children:r(`content.richText.addColumn`)}),(0,M.jsx)(Ze,{disabled:!t,onSelect:()=>i(e=>e.toggleHeaderRow()),children:r(`content.richText.toggleHeaderRow`)}),(0,M.jsx)(Ze,{disabled:!t,onSelect:()=>i(e=>e.deleteRow()),children:r(`content.richText.deleteRow`)}),(0,M.jsx)(Ze,{disabled:!t,onSelect:()=>i(e=>e.deleteColumn()),children:r(`content.richText.deleteColumn`)}),(0,M.jsx)(Qe,{}),(0,M.jsx)(Ze,{disabled:!t,variant:`destructive`,onSelect:()=>i(e=>e.deleteTable()),children:r(`content.richText.deleteTable`)})]})]})},KS=[1,2,3,4,5,6],qS={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`},JS=e=>{if(e.isActive(`codeBlock`))return`codeBlock`;let t=KS.find(t=>e.isActive(`heading`,{level:t}));return t?`h${t}`:`paragraph`},YS=(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()},XS=({editor:e,minimal:t,disabled:n,linkOpen:r,onLinkOpenChange:i,onInsertImage:a})=>{let{t:s}=o(),c=Jf({editor:e,selector:({editor:e})=>({block:JS(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)(de,{value:c.block,disabled:n,onValueChange:t=>YS(e,t),children:[(0,M.jsx)(ce,{size:`sm`,"aria-label":s(`content.richText.blockType`),className:`w-36 border-transparent bg-transparent shadow-none dark:bg-transparent`,children:(0,M.jsx)(se,{})}),(0,M.jsx)(le,{children:Object.keys(qS).map(e=>(0,M.jsx)(ue,{value:e,children:s(qS[e])},e))})]}),(0,M.jsx)(pe,{orientation:`vertical`,className:`mx-1 h-5`})]}),(0,M.jsx)(Y,{icon:Ot,label:s(`content.richText.bold`),keys:`Mod+B`,pressed:c.bold,disabled:n,onClick:()=>l().toggleBold().run()}),(0,M.jsx)(Y,{icon:At,label:s(`content.richText.italic`),keys:`Mod+I`,pressed:c.italic,disabled:n,onClick:()=>l().toggleItalic().run()}),t?null:(0,M.jsx)(Y,{icon:Ke,label:s(`content.richText.code`),keys:`Mod+E`,pressed:c.code,disabled:n,onClick:()=>l().toggleCode().run()}),(0,M.jsx)(Hp,{editor:e,active:c.link,disabled:n,open:r,onOpenChange:i}),(0,M.jsx)(pe,{orientation:`vertical`,className:`mx-1 h-5`}),(0,M.jsx)(Y,{icon:$e,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)(pe,{orientation:`vertical`,className:`mx-1 h-5`}),(0,M.jsx)(Y,{icon:Xe,label:s(`content.richText.image`),disabled:n,onClick:a}),(0,M.jsx)(GS,{editor:e,inTable:c.table,disabled:n}),(0,M.jsx)(Y,{icon:me,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:at,label:s(`content.richText.undo`),keys:`Mod+Z`,disabled:n||!c.canUndo,onClick:()=>l().undo().run()}),(0,M.jsx)(Y,{icon:Mt,label:s(`content.richText.redo`),keys:`Mod+Shift+Z`,disabled:n||!c.canRedo,onClick:()=>l().redo().run()})]})]})},ZS=[`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(` `),QS=e=>e.appearance===`canvas`?(0,M.jsx)(US,{...e}):(0,M.jsx)($S,{...e}),$S=e=>{let{t}=o(),{field:n,context:r,validation:i,definition:a}=e,[s,c]=(0,j.useState)(!1),l=typeof n.options.placeholder==`string`?n.options.placeholder:void 0,{editor:u,initial:d,editable:f}=Bp({props:e,extensions:(0,j.useMemo)(()=>nS({placeholder:l??t(`content.richText.placeholder`),imageView:_p(aS)}),[l,t]),contentClasses:ZS,onLinkShortcut:()=>c(!0),refuseFileDrops:!0}),p=a.type===`richtext`?a.settings.maxLength:void 0,m=async()=>{try{let e=await r.pickMedia({multiple:!0,allowedKinds:[`image`]});for(let t of e??[])u.chain().focus().insertMediaImage({mediaId:t.id,alt:t.alt||null}).run()}catch(e){ne(e,`inserting an image`)}};return(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsxs)(`div`,{className:ot(`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:[f?(0,M.jsx)(XS,{editor:u,minimal:n.options.toolbar===`minimal`,disabled:!f,linkOpen:s,onLinkOpenChange:c,onInsertImage:()=>void m()}):null,(0,M.jsx)(Gf,{editor:u})]}),(0,M.jsx)(Up,{editor:u,initial:d,maxLength:p})]})};export{QS as RichTextField};
|
|
144
|
-
//# sourceMappingURL=RichTextField-
|
|
144
|
+
//# sourceMappingURL=RichTextField-fWNjndUc.js.map
|