1&&(i=0),s.type.spec.isolating&&i<=n){e=n;break}t=s.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let i,s=null;n?(s=Dn(this.unplaced.content,n-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],d,u=null;if(t==1&&(o?c.matchType(o.type)||(u=c.fillBefore(b.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:n,frontierDepth:l,parent:s,inject:u};if(t==2&&o&&(d=c.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:l,parent:s,wrap:d};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=Dn(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new k(e,t+1,Math.max(n,i.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=Dn(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new k(St(e,t-1,1),t-1,s?t-1:n)}else this.unplaced=new k(St(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m1||a==0||m.content.size)&&(u=g,d.push(bs(m.mark(f.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?p:-1)))}let h=c==l.childCount;h||(p=-1),this.placed=Mt(this.placed,t,b.from(d)),this.frontier[t].match=u,h&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m1&&i==this.$to.end(--n);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:i}=this.frontier[t],s=t=0;l--){let{match:a,type:c}=this.frontier[l],d=In(e,l,c,a,!0);if(!d||d.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Mt(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let i=e.node(n),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(n));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,n){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Mt(this.placed,this.depth,b.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(b.empty,!0);t.childCount&&(this.placed=Mt(this.placed,this.frontier.length,t))}}function St(r,e,t){return e==0?r.cutByIndex(t,r.childCount):r.replaceChild(0,r.firstChild.copy(St(r.firstChild.content,e-1,t)))}function Mt(r,e,t){return e==0?r.append(t):r.replaceChild(r.childCount-1,r.lastChild.copy(Mt(r.lastChild.content,e-1,t)))}function Dn(r,e){for(let t=0;t1&&(n=n.replaceChild(0,bs(n.firstChild,e-1,n.childCount==1?t-1:0))),e>0&&(n=r.type.contentMatch.fillBefore(n).append(n),t<=0&&(n=n.append(r.type.contentMatch.matchFragment(n).fillBefore(b.empty,!0)))),r.copy(n)}function In(r,e,t,n,i){let s=r.node(e),o=i?r.indexAfter(e):r.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let l=n.fillBefore(s.content,!0,o);return l&&!Bl(t,s.content,o)?l:null}function Bl(r,e,t){for(let n=t;n0;f--,p--){let h=i.node(f).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;o.indexOf(f)>-1?l=f:i.before(f)==p&&o.splice(1,0,-f)}let a=o.indexOf(l),c=[],d=n.openStart;for(let f=n.content,p=0;;p++){let h=f.firstChild;if(c.push(h),p==n.openStart)break;f=h.content}for(let f=d-1;f>=0;f--){let p=c[f],h=Ll(p.type);if(h&&!p.sameMarkup(i.node(Math.abs(l)-1)))d=f;else if(h||!p.type.isTextblock)break}for(let f=n.openStart;f>=0;f--){let p=(f+d+1)%(n.openStart+1),h=c[p];if(h)for(let m=0;m=0&&(r.replace(e,t,n),!(r.steps.length>u));f--){let p=o[f];p<0||(e=i.before(p),t=s.after(p))}}function ks(r,e,t,n,i){if(en){let s=i.contentMatchAt(0),o=s.fillBefore(r).append(r);r=o.append(s.matchFragment(o).fillBefore(b.empty,!0))}return r}function Fl(r,e,t,n){if(!n.isInline&&e==t&&r.doc.resolve(e).parent.content.size){let i=Rl(r.doc,e,n.type);i!=null&&(e=t=i)}r.replaceRange(e,t,new k(b.from(n),0,0))}function Vl(r,e,t){let n=r.doc.resolve(e),i=r.doc.resolve(t),s=xs(n,i);for(let o=0;o0&&(a||n.node(l-1).canReplace(n.index(l-1),i.indexAfter(l-1))))return r.delete(n.before(l),i.after(l))}for(let o=1;o<=n.depth&&o<=i.depth;o++)if(e-n.start(o)==n.depth-o&&t>n.end(o)&&i.end(o)-t!=i.depth-o)return r.delete(n.before(o),t);r.delete(e,t)}function xs(r,e){let t=[],n=Math.min(r.depth,e.depth);for(let i=n;i>=0;i--){let s=r.start(i);if(se.pos+(e.depth-i)||r.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==r.depth&&i==e.depth&&r.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class ut extends Z{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return F.fail("No node at attribute step's position");let n=Object.create(null);for(let s in t.attrs)n[s]=t.attrs[s];n[this.attr]=this.value;let i=t.type.create(n,null,t.marks);return F.fromReplace(e,this.pos,this.pos+1,new k(b.from(i),0,t.isLeaf?0:1))}getMap(){return oe.empty}invert(e){return new ut(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ut(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new ut(t.pos,t.attr,t.value)}}Z.jsonID("attr",ut);class Nt extends Z{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return F.ok(n)}getMap(){return oe.empty}invert(e){return new Nt(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Nt(t.attr,t.value)}}Z.jsonID("docAttr",Nt);let pt=class extends Error{};pt=function r(e){let t=Error.call(this,e);return t.__proto__=r.prototype,t};pt.prototype=Object.create(Error.prototype);pt.prototype.constructor=pt;pt.prototype.name="TransformError";class $l{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ct}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new pt(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=k.empty){let i=mn(this.doc,e,t,n);return i&&this.step(i),this}replaceWith(e,t,n){return this.replace(e,t,new k(b.from(n),0,0))}delete(e,t){return this.replace(e,t,k.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return zl(this,e,t,n),this}replaceRangeWith(e,t,n){return Fl(this,e,t,n),this}deleteRange(e,t){return Vl(this,e,t),this}lift(e,t){return Ml(this,e,t),this}join(e,t=1){return Il(this,e,t),this}wrap(e,t){return Tl(this,e,t),this}setBlockType(e,t=e,n,i=null){return vl(this,e,t,n,i),this}setNodeMarkup(e,t,n=null,i){return El(this,e,t,n,i),this}setNodeAttribute(e,t,n){return this.step(new ut(e,t,n)),this}setDocAttribute(e,t){return this.step(new Nt(e,t)),this}addNodeMark(e,t){return this.step(new De(e,t)),this}removeNodeMark(e,t){if(!(t instanceof R)){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t=t.isInSet(n.marks),!t)return this}return this.step(new ht(e,t)),this}split(e,t=1,n){return Dl(this,e,t,n),this}addMark(e,t,n){return kl(this,e,t,n),this}removeMark(e,t,n){return xl(this,e,t,n),this}clearIncompatible(e,t,n){return ps(this,e,t,n),this}}const Rn=Object.create(null);class T{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new _l(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t=0;s--){let o=t<0?st(e.node(0),e.node(s),e.before(s+1),e.index(s),t,n):st(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,n);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new me(e.node(0))}static atStart(e){return st(e,e,0,0,1)||new me(e)}static atEnd(e){return st(e,e,e.content.size,e.childCount,-1)||new me(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Rn[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Rn)throw new RangeError("Duplicate use of selection JSON ID "+e);return Rn[e]=t,t.prototype.jsonID=e,t}getBookmark(){return C.between(this.$anchor,this.$head).getBookmark()}}T.prototype.visible=!0;class _l{constructor(e,t){this.$from=e,this.$to=t}}let Wr=!1;function Jr(r){!Wr&&!r.parent.inlineContent&&(Wr=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+r.parent.type.name+")"))}class C extends T{constructor(e,t=e){Jr(e),Jr(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return T.near(n);let i=e.resolve(t.map(this.anchor));return new C(i.parent.inlineContent?i:n,n)}replace(e,t=k.empty){if(super.replace(e,t),t==k.empty){let n=this.$from.marksAcross(this.$to);n&&e.ensureMarks(n)}}eq(e){return e instanceof C&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new gn(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new C(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let i=e.resolve(t);return new this(i,n==t?i:e.resolve(n))}static between(e,t,n){let i=e.pos-t.pos;if((!n||i)&&(n=i>=0?1:-1),!t.parent.inlineContent){let s=T.findFrom(t,n,!0)||T.findFrom(t,-n,!0);if(s)t=s.$head;else return T.near(t,n)}return e.parent.inlineContent||(i==0?e=t:(e=(T.findFrom(e,-n,!0)||T.findFrom(e,n,!0)).$anchor,e.pos0?0:1);i>0?o=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&M.isSelectable(l))return M.create(r,t-(i<0?l.nodeSize:0))}else{let a=st(r,l,t+i,i<0?l.childCount:0,i,s);if(a)return a}t+=l.nodeSize*i}return null}function qr(r,e,t){let n=r.steps.length-1;if(n{o==null&&(o=d)}),r.setSelection(T.near(r.doc.resolve(o),t))}const Kr=1,Ht=2,Ur=4;class jl extends $l{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Ht,this}ensureMarks(e){return R.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Ht)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Ht,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||R.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(n==null&&(n=t),n=n??t,!e)return this.deleteRange(t,n);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=n==t?o.marks():o.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,i.text(e,s)),this.selection.empty||this.setSelection(T.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Ur,this}get scrolledIntoView(){return(this.updated&Ur)>0}}function Gr(r,e){return!e||!r?r:r.bind(e)}class wt{constructor(e,t,n){this.name=e,this.init=Gr(t.init,n),this.apply=Gr(t.apply,n)}}const Wl=[new wt("doc",{init(r){return r.doc||r.schema.topNodeType.createAndFill()},apply(r){return r.doc}}),new wt("selection",{init(r,e){return r.selection||T.atStart(e.doc)},apply(r){return r.selection}}),new wt("storedMarks",{init(r){return r.storedMarks||null},apply(r,e,t,n){return n.selection.$cursor?r.storedMarks:null}}),new wt("scrollToSelection",{init(){return 0},apply(r,e){return r.scrolledIntoView?e+1:e}})];class Pn{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Wl.slice(),t&&t.forEach(n=>{if(this.pluginsByKey[n.key])throw new RangeError("Adding different instances of a keyed plugin ("+n.key+")");this.plugins.push(n),this.pluginsByKey[n.key]=n,n.spec.state&&this.fields.push(new wt(n.key,n.spec.state,n))})}}class lt{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;nn.toJSON())),e&&typeof e=="object")for(let n in e){if(n=="doc"||n=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[n],s=i.spec.state;s&&s.toJSON&&(t[n]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Pn(e.schema,e.plugins),s=new lt(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Ge.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=T.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let l in n){let a=n[l],c=a.spec.state;if(a.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){s[o.name]=c.fromJSON.call(a,e,t[l],s);return}}s[o.name]=o.init(e,s)}}),s}}function Ss(r,e,t){for(let n in r){let i=r[n];i instanceof Function?i=i.bind(e):n=="handleDOMEvents"&&(i=Ss(i,e,{})),t[n]=i}return t}class fe{constructor(e){this.spec=e,this.props={},e.props&&Ss(e.props,this,this.props),this.key=e.key?e.key.key:Ms("plugin")}getState(e){return e[this.key]}}const Bn=Object.create(null);function Ms(r){return r in Bn?r+"$"+ ++Bn[r]:(Bn[r]=0,r+"$")}class Ve{constructor(e="key"){this.key=Ms(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const K=function(r){for(var e=0;;e++)if(r=r.previousSibling,!r)return e},Et=function(r){let e=r.assignedSlot||r.parentNode;return e&&e.nodeType==11?e.host:e};let Zn=null;const Ce=function(r,e,t){let n=Zn||(Zn=document.createRange());return n.setEnd(r,t??r.nodeValue.length),n.setStart(r,e||0),n},Jl=function(){Zn=null},et=function(r,e,t,n){return t&&(Yr(r,e,t,n,-1)||Yr(r,e,t,n,1))},ql=/^(img|br|input|textarea|hr)$/i;function Yr(r,e,t,n,i){for(;;){if(r==t&&e==n)return!0;if(e==(i<0?0:be(r))){let s=r.parentNode;if(!s||s.nodeType!=1||Lt(r)||ql.test(r.nodeName)||r.contentEditable=="false")return!1;e=K(r)+(i<0?0:1),r=s}else if(r.nodeType==1){if(r=r.childNodes[e+(i<0?-1:0)],r.contentEditable=="false")return!1;e=i<0?be(r):0}else return!1}}function be(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function Kl(r,e){for(;;){if(r.nodeType==3&&e)return r;if(r.nodeType==1&&e>0){if(r.contentEditable=="false")return null;r=r.childNodes[e-1],e=be(r)}else if(r.parentNode&&!Lt(r))e=K(r),r=r.parentNode;else return null}}function Ul(r,e){for(;;){if(r.nodeType==3&&e2),ce=mt||(xe?/Mac/.test(xe.platform):!1),Zl=xe?/Win/.test(xe.platform):!1,he=/Android \d/.test($e),zt=!!Xr&&"webkitFontSmoothing"in Xr.documentElement.style,Ql=zt?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function ea(r){let e=r.defaultView&&r.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:r.documentElement.clientWidth,top:0,bottom:r.documentElement.clientHeight}}function we(r,e){return typeof r=="number"?r:r[e]}function ta(r){let e=r.getBoundingClientRect(),t=e.width/r.offsetWidth||1,n=e.height/r.offsetHeight||1;return{left:e.left,right:e.left+r.clientWidth*t,top:e.top,bottom:e.top+r.clientHeight*n}}function Zr(r,e,t){let n=r.someProp("scrollThreshold")||0,i=r.someProp("scrollMargin")||5,s=r.dom.ownerDocument;for(let o=t||r.dom;o;o=Et(o)){if(o.nodeType!=1)continue;let l=o,a=l==s.body,c=a?ea(s):ta(l),d=0,u=0;if(e.topc.bottom-we(n,"bottom")&&(u=e.bottom-e.top>c.bottom-c.top?e.top+we(i,"top")-c.top:e.bottom-c.bottom+we(i,"bottom")),e.leftc.right-we(n,"right")&&(d=e.right-c.right+we(i,"right")),d||u)if(a)s.defaultView.scrollBy(d,u);else{let f=l.scrollLeft,p=l.scrollTop;u&&(l.scrollTop+=u),d&&(l.scrollLeft+=d);let h=l.scrollLeft-f,m=l.scrollTop-p;e={left:e.left-h,top:e.top-m,right:e.right-h,bottom:e.bottom-m}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function na(r){let e=r.dom.getBoundingClientRect(),t=Math.max(0,e.top),n,i;for(let s=(e.left+e.right)/2,o=t+1;o=t-20){n=l,i=a.top;break}}return{refDOM:n,refTop:i,stack:Ts(r.dom)}}function Ts(r){let e=[],t=r.ownerDocument;for(let n=r;n&&(e.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),r!=t);n=Et(n));return e}function ra({refDOM:r,refTop:e,stack:t}){let n=r?r.getBoundingClientRect().top:0;vs(t,n==0?0:n-e)}function vs(r,e){for(let t=0;t=l){o=Math.max(h.bottom,o),l=Math.min(h.top,l);let m=h.left>e.left?h.left-e.left:h.right=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!a&&h.left<=e.left&&h.right>=e.left&&(a=d,c={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!t&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(s=u+1)}}return!t&&a&&(t=a,i=c,n=0),t&&t.nodeType==3?sa(t,i):!t||n&&t.nodeType==1?{node:r,offset:s}:Os(t,i)}function sa(r,e){let t=r.nodeValue.length,n=document.createRange();for(let i=0;i=(s.left+s.right)/2?1:0)}}return{node:r,offset:0}}function yr(r,e){return r.left>=e.left-1&&r.left<=e.right+1&&r.top>=e.top-1&&r.top<=e.bottom+1}function oa(r,e){let t=r.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left(o.left+o.right)/2?1:-1}return r.docView.posFromDOM(n,i,s)}function aa(r,e,t,n){let i=-1;for(let s=e,o=!1;s!=r.dom;){let l=r.docView.nearestDesc(s,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&(!o&&a.left>n.left||a.top>n.top?i=l.posBefore:(!o&&a.right-1?i:r.docView.posFromDOM(e,t,-1)}function As(r,e,t){let n=r.childNodes.length;if(n&&t.tope.top&&i++}let c;zt&&i&&n.nodeType==1&&(c=n.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,n==r.dom&&i==n.childNodes.length-1&&n.lastChild.nodeType==1&&e.top>n.lastChild.getBoundingClientRect().bottom?l=r.state.doc.content.size:(i==0||n.nodeType!=1||n.childNodes[i-1].nodeName!="BR")&&(l=aa(r,n,i,e))}l==null&&(l=la(r,o,e));let a=r.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Qr(r){return r.top=0&&i==n.nodeValue.length?(a--,d=1):t<0?a--:c++,xt(ve(Ce(n,a,c),d),d<0)}if(!r.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==be(n))){let a=n.childNodes[i-1];if(a.nodeType==1)return Ln(a.getBoundingClientRect(),!1)}if(s==null&&i=0)}if(s==null&&i&&(t<0||i==be(n))){let a=n.childNodes[i-1],c=a.nodeType==3?Ce(a,be(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return xt(ve(c,1),!1)}if(s==null&&i=0)}function xt(r,e){if(r.width==0)return r;let t=e?r.left:r.right;return{top:r.top,bottom:r.bottom,left:t,right:t}}function Ln(r,e){if(r.height==0)return r;let t=e?r.top:r.bottom;return{top:t,bottom:t,left:r.left,right:r.right}}function Es(r,e,t){let n=r.state,i=r.root.activeElement;n!=e&&r.updateState(e),i!=r.dom&&r.focus();try{return t()}finally{n!=e&&r.updateState(n),i!=r.dom&&i&&i.focus()}}function ua(r,e,t){let n=e.selection,i=t=="up"?n.$from:n.$to;return Es(r,e,()=>{let{node:s}=r.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=r.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=Ns(r,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=Ce(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;cd.top+1&&(t=="up"?o.top-d.top>(d.bottom-o.top)*2:d.bottom-o.bottom>(o.bottom-d.top)*2))return!1}}return!0})}const fa=/[\u0590-\u08ac]/;function ha(r,e,t){let{$head:n}=e.selection;if(!n.parent.isTextblock)return!1;let i=n.parentOffset,s=!i,o=i==n.parent.content.size,l=r.domSelection();return!fa.test(n.parent.textContent)||!l.modify?t=="left"||t=="backward"?s:o:Es(r,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:d,anchorOffset:u}=r.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",t,"character");let p=n.depth?r.docView.domAfterPos(n.before()):r.dom,{focusNode:h,focusOffset:m}=r.domSelectionRange(),g=h&&!p.contains(h.nodeType==1?h:h.parentNode)||a==h&&c==m;try{l.collapse(d,u),a&&(a!=d||c!=u)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),g})}let ei=null,ti=null,ni=!1;function pa(r,e,t){return ei==e&&ti==t?ni:(ei=e,ti=t,ni=t=="up"||t=="down"?ua(r,e,t):ha(r,e,t))}const ue=0,ri=1,We=2,Se=3;class Ft{constructor(e,t,n,i){this.parent=e,this.children=t,this.dom=n,this.contentDOM=i,this.dirty=ue,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;tK(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(n&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))n=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let n=t;n;n=n.parent)if(n==this)return t}posFromDOM(e,t,n){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;te||o instanceof Is){i=e-s;break}s=l}if(i)return this.children[n].domFromPos(i-this.children[n].border,t);for(let s;n&&!(s=this.children[n-1]).size&&s instanceof Ds&&s.side>=0;n--);if(t<=0){let s,o=!0;for(;s=n?this.children[n-1]:null,!(!s||s.dom.parentNode==this.contentDOM);n--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?K(s.dom)+1:0}}else{let s,o=!0;for(;s=n=d&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,d);e=o;for(let u=l;u>0;u--){let f=this.children[u-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=K(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(c>t||l==this.children.length-1)){t=c;for(let d=l+1;dp&&ot){let p=l;l=a,a=p}let f=document.createRange();f.setEnd(a.node,a.offset),f.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(f)}}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,i=0;i=n:en){let l=n+s.border,a=o-s.border;if(e>=l&&t<=a){this.dirty=e==n||t==o?We:ri,e==l&&t==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Se:s.markDirty(e-l,t-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?We:Se}n=o}this.dirty=We}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?We:ri;t.dirty{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==ue&&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 side(){return this.widget.type.side}}class ma extends Ft{constructor(e,t,n,i){super(e,[],t,null),this.textDOM=n,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class tt extends Ft{constructor(e,t,n,i){super(e,[],n,i),this.mark=t}static create(e,t,n,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,n);return(!o||!o.dom)&&(o=nt.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new tt(e,t,o.dom,o.contentDOM||o.dom)}parseRule(){return this.dirty&Se||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Se&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=ue){let n=this.parent;for(;!n.node;)n=n.parent;n.dirty0&&(s=ir(s,0,e,n));for(let l=0;l{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},n,i),d=c&&c.dom,u=c&&c.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=nt.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!u&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let f=d;return d=Bs(d,n,t),c?a=new ga(e,t,n,i,d,u||null,f,c,s,o+1):t.isText?new bn(e,t,n,i,d,f,s):new Be(e,t,n,i,d,u||null,f,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>b.empty)}return e}matchesNode(e,t,n){return this.dirty==ue&&e.eq(this.node)&&rr(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new ba(this,o&&o.node,e);Sa(this.node,this.innerDeco,(c,d,u)=>{c.spec.marks?a.syncToMarks(c.spec.marks,n,e):c.type.side>=0&&!u&&a.syncToMarks(d==this.node.childCount?R.none:this.node.child(d).marks,n,e),a.placeWidget(c,e,i)},(c,d,u,f)=>{a.syncToMarks(c.marks,n,e);let p;a.findNodeMatch(c,d,u,f)||l&&e.state.selection.from>i&&e.state.selection.to-1&&a.updateNodeAt(c,d,u,p,e)||a.updateNextNode(c,d,u,e,f,i)||a.addNode(c,d,u,e,i),i+=c.nodeSize}),a.syncToMarks([],n,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==We)&&(o&&this.protectLocalComposition(e,o),Rs(this.contentDOM,this.children,e),mt&&Ma(this.dom))}localCompositionInfo(e,t){let{from:n,to:i}=e.state.selection;if(!(e.state.selection instanceof C)||nt+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,l=wa(this.node.content,o,n-t,i-t);return l<0?null:{node:s,pos:l,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new ma(this,s,t,i);e.input.compositionNodes.push(o),this.children=ir(this.children,n,n+i.length,e,o)}update(e,t,n,i){return this.dirty==Se||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,i),!0)}updateInner(e,t,n,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=ue}updateOuterDeco(e){if(rr(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=Ps(this.dom,this.nodeDOM,nr(this.outerDeco,this.node,t),nr(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function ii(r,e,t,n,i){Bs(n,e,r);let s=new Be(void 0,r,e,t,n,n,n,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class bn extends Be{constructor(e,t,n,i,s,o,l){super(e,t,n,i,s,null,o,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,i){return this.dirty==Se||this.dirty!=ue&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=ue||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=ue,!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(e,t,n){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new bn(this.parent,i,this.outerDeco,this.innerDeco,s,s,n)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Se)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Is extends Ft{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ue&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class ga extends Be{constructor(e,t,n,i,s,o,l,a,c,d){super(e,t,n,i,s,o,l,c,d),this.spec=a}update(e,t,n,i){if(this.dirty==Se)return!1;if(this.spec.update){let s=this.spec.update(e,t,n);return s&&this.updateInner(e,t,n,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,n,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,i){this.spec.setSelection?this.spec.setSelection(e,t,n):super.setSelection(e,t,n,i)}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 Rs(r,e,t){let n=r.firstChild,i=!1;for(let s=0;s>1,o=Math.min(s,e.length);for(;i-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=tt.create(this.top,e[s],t,n);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,n,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))s=this.top.children.indexOf(o,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l0;){let l;for(;;)if(n){let c=t.children[n-1];if(c instanceof tt)t=c,n=c.children.length;else{l=c,n--;break}}else{if(t==e)break e;n=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=r.child(i-1))break;--i,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}function xa(r,e){return r.type.side-e.type.side}function Sa(r,e,t,n){let i=e.locals(r),s=0;if(i.length==0){for(let c=0;cs;)l.push(i[o++]);let h=s+f.nodeSize;if(f.isText){let g=h;o!g.inline):l.slice();n(f,m,e.forChild(s,f),p),s=h}}function Ma(r){if(r.nodeName=="UL"||r.nodeName=="OL"){let e=r.style.cssText;r.style.cssText=e+"; list-style: square !important",window.getComputedStyle(r).listStyle,r.style.cssText=e}}function wa(r,e,t,n){for(let i=0,s=0;i=t){if(s>=n&&a.slice(n-e.length-l,n-l)==e)return n-e.length;let c=l=0&&c+e.length+l>=t)return l+c;if(t==n&&a.length>=n+e.length-l&&a.slice(n-l,n-l+e.length)==e)return n}}return-1}function ir(r,e,t,n,i){let s=[];for(let o=0,l=0;o=t||d<=e?s.push(a):(ct&&s.push(a.slice(t-c,a.size,n)))}return s}function br(r,e=null){let t=r.domSelectionRange(),n=r.state.doc;if(!t.focusNode)return null;let i=r.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=r.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let l=n.resolve(o),a,c;if(yn(t)){for(a=l;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&M.isSelectable(d)&&i.parent&&!(d.isInline&&Gl(t.focusNode,t.focusOffset,i.dom))){let u=i.posBefore;c=new M(o==u?l:n.resolve(u))}}else{let d=r.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(d<0)return null;a=n.resolve(d)}if(!c){let d=e=="pointer"||r.state.selection.head{(t.anchorNode!=n||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",r.input.hideSelectionGuard),setTimeout(()=>{(!Ls(r)||r.state.selection.visible)&&r.dom.classList.remove("ProseMirror-hideselection")},20))})}function Ta(r){let e=r.domSelection(),t=document.createRange(),n=r.cursorWrapper.dom,i=n.nodeName=="IMG";i?t.setEnd(n.parentNode,K(n)+1):t.setEnd(n,0),t.collapse(!1),e.removeAllRanges(),e.addRange(t),!i&&!r.state.selection.visible&&re&&Pe<=11&&(n.disabled=!0,n.disabled=!1)}function zs(r,e){if(e instanceof M){let t=r.docView.descAt(e.from);t!=r.lastSelectedViewDesc&&(ci(r),t&&t.selectNode(),r.lastSelectedViewDesc=t)}else ci(r)}function ci(r){r.lastSelectedViewDesc&&(r.lastSelectedViewDesc.parent&&r.lastSelectedViewDesc.deselectNode(),r.lastSelectedViewDesc=void 0)}function kr(r,e,t,n){return r.someProp("createSelectionBetween",i=>i(r,e,t))||C.between(e,t,n)}function di(r){return r.editable&&!r.hasFocus()?!1:Fs(r)}function Fs(r){let e=r.domSelectionRange();if(!e.anchorNode)return!1;try{return r.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(r.editable||r.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function va(r){let e=r.docView.domFromPos(r.state.selection.anchor,0),t=r.domSelectionRange();return et(e.node,e.offset,t.anchorNode,t.anchorOffset)}function sr(r,e){let{$anchor:t,$head:n}=r.selection,i=e>0?t.max(n):t.min(n),s=i.parent.inlineContent?i.depth?r.doc.resolve(e>0?i.after():i.before()):null:i;return s&&T.findFrom(s,e)}function Oe(r,e){return r.dispatch(r.state.tr.setSelection(e).scrollIntoView()),!0}function ui(r,e,t){let n=r.state.selection;if(n instanceof C)if(t.indexOf("s")>-1){let{$head:i}=n,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=r.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Oe(r,new C(n.$anchor,o))}else if(n.empty){if(r.endOfTextblock(e>0?"forward":"backward")){let i=sr(r.state,e);return i&&i instanceof M?Oe(r,i):!1}else if(!(ce&&t.indexOf("m")>-1)){let i=n.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=r.docView.descAt(l))&&!o.contentDOM?M.isSelectable(s)?Oe(r,new M(e<0?r.state.doc.resolve(i.pos-s.nodeSize):i)):zt?Oe(r,new C(r.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(n instanceof M&&n.node.isInline)return Oe(r,new C(e>0?n.$to:n.$from));{let i=sr(r.state,e);return i?Oe(r,i):!1}}}function sn(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function Ot(r,e){let t=r.pmViewDesc;return t&&t.size==0&&(e<0||r.nextSibling||r.nodeName!="BR")}function it(r,e){return e<0?Oa(r):Aa(r)}function Oa(r){let e=r.domSelectionRange(),t=e.focusNode,n=e.focusOffset;if(!t)return;let i,s,o=!1;for(ge&&t.nodeType==1&&n0){if(t.nodeType!=1)break;{let l=t.childNodes[n-1];if(Ot(l,-1))i=t,s=--n;else if(l.nodeType==3)t=l,n=t.nodeValue.length;else break}}else{if(Vs(t))break;{let l=t.previousSibling;for(;l&&Ot(l,-1);)i=t.parentNode,s=K(l),l=l.previousSibling;if(l)t=l,n=sn(t);else{if(t=t.parentNode,t==r.dom)break;n=0}}}o?or(r,t,n):i&&or(r,i,s)}function Aa(r){let e=r.domSelectionRange(),t=e.focusNode,n=e.focusOffset;if(!t)return;let i=sn(t),s,o;for(;;)if(n{r.state==i&&Te(r)},50)}function fi(r,e){let t=r.state.doc.resolve(e);if(!(Y||Zl)&&t.parent.inlineContent){let i=r.coordsAtPos(e);if(e>t.start()){let s=r.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o1)return s.lefti.top&&o1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(r.dom).direction=="rtl"?"rtl":"ltr"}function hi(r,e,t){let n=r.state.selection;if(n instanceof C&&!n.empty||t.indexOf("s")>-1||ce&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=n;if(!i.parent.inlineContent||r.endOfTextblock(e<0?"up":"down")){let o=sr(r.state,e);if(o&&o instanceof M)return Oe(r,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=n instanceof me?T.near(o,e):T.findFrom(o,e);return l?Oe(r,l):!1}return!1}function pi(r,e){if(!(r.state.selection instanceof C))return!0;let{$head:t,$anchor:n,empty:i}=r.state.selection;if(!t.sameParent(n))return!0;if(!i)return!1;if(r.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=r.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),r.dispatch(o),!0}return!1}function mi(r,e,t){r.domObserver.stop(),e.contentEditable=t,r.domObserver.start()}function Da(r){if(!ee||r.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=r.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let n=e.firstChild;mi(r,n,"true"),setTimeout(()=>mi(r,n,"false"),20)}return!1}function Ia(r){let e="";return r.ctrlKey&&(e+="c"),r.metaKey&&(e+="m"),r.altKey&&(e+="a"),r.shiftKey&&(e+="s"),e}function Ra(r,e){let t=e.keyCode,n=Ia(e);if(t==8||ce&&t==72&&n=="c")return pi(r,-1)||it(r,-1);if(t==46&&!e.shiftKey||ce&&t==68&&n=="c")return pi(r,1)||it(r,1);if(t==13||t==27)return!0;if(t==37||ce&&t==66&&n=="c"){let i=t==37?fi(r,r.state.selection.from)=="ltr"?-1:1:-1;return ui(r,i,n)||it(r,i)}else if(t==39||ce&&t==70&&n=="c"){let i=t==39?fi(r,r.state.selection.from)=="ltr"?1:-1:1;return ui(r,i,n)||it(r,i)}else{if(t==38||ce&&t==80&&n=="c")return hi(r,-1,n)||it(r,-1);if(t==40||ce&&t==78&&n=="c")return Da(r)||hi(r,1,n)||it(r,1);if(n==(ce?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function $s(r,e){r.someProp("transformCopied",p=>{e=p(e,r)});let t=[],{content:n,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&n.childCount==1&&n.firstChild.childCount==1;){i--,s--;let p=n.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),n=p.content}let o=r.someProp("clipboardSerializer")||nt.fromSchema(r.state.schema),l=qs(),a=l.createElement("div");a.appendChild(o.serializeFragment(n,{document:l}));let c=a.firstChild,d,u=0;for(;c&&c.nodeType==1&&(d=Js[c.nodeName.toLowerCase()]);){for(let p=d.length-1;p>=0;p--){let h=l.createElement(d[p]);for(;a.firstChild;)h.appendChild(a.firstChild);a.appendChild(h),u++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${u?` -${u}`:""} ${JSON.stringify(t)}`);let f=r.someProp("clipboardTextSerializer",p=>p(e,r))||e.content.textBetween(0,e.content.size,`
`);return{dom:a,text:f,slice:e}}function _s(r,e,t,n,i){let s=i.parent.type.spec.code,o,l;if(!t&&!e)return null;let a=e&&(n||s||!t);if(a){if(r.someProp("transformPastedText",f=>{e=f(e,s||n,r)}),s)return e?new k(b.from(r.state.schema.text(e.replace(/\r\n?/g,`
`))),0,0):k.empty;let u=r.someProp("clipboardTextParser",f=>f(e,i,n,r));if(u)l=u;else{let f=i.marks(),{schema:p}=r.state,h=nt.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(h.serializeNode(p.text(m,f)))})}}else r.someProp("transformPastedHTML",u=>{t=u(t,r)}),o=La(t),zt&&za(o);let c=o&&o.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0;u--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(r.someProp("clipboardParser")||r.someProp("domParser")||Re.fromSchema(r.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||d),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Pa.test(f.parentNode.nodeName)?{ignore:!0}:null}})),d)l=Fa(gi(l,+d[1],+d[2]),d[4]);else if(l=k.maxOpen(Ba(l.content,i),!0),l.openStart||l.openEnd){let u=0,f=0;for(let p=l.content.firstChild;u{l=u(l,r)}),l}const Pa=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Ba(r,e){if(r.childCount<2)return r;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(r.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&s.length&&js(a,s,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Ws(o[o.length-1],s.length));let d=Hs(l,a);o.push(d),i=i.matchType(d.type),s=a}}),o)return b.from(o)}return r}function Hs(r,e,t=0){for(let n=e.length-1;n>=t;n--)r=e[n].create(null,b.from(r));return r}function js(r,e,t,n,i){if(i1&&(s=0),i=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(b.empty,!0))),r.replaceChild(e<0?0:r.childCount-1,o.copy(l))}function gi(r,e,t){return e]*>)*/.exec(r);e&&(r=r.slice(e[0].length));let t=qs().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(r),i;if((i=n&&Js[n[1].toLowerCase()])&&(r=i.map(s=>"<"+s+">").join("")+r+i.map(s=>""+s+">").reverse().join("")),t.innerHTML=r,i)for(let s=0;s=0;l-=2){let a=t.nodes[n[l]];if(!a||a.hasRequiredAttrs())break;i=b.from(a.create(n[l+1],i)),s++,o++}return new k(i,s,o)}const te={},ne={},Va={touchstart:!0,touchmove:!0};class $a{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function _a(r){for(let e in te){let t=te[e];r.dom.addEventListener(e,r.input.eventHandlers[e]=n=>{ja(r,n)&&!xr(r,n)&&(r.editable||!(n.type in ne))&&t(r,n)},Va[e]?{passive:!0}:void 0)}ee&&r.dom.addEventListener("input",()=>null),ar(r)}function Ie(r,e){r.input.lastSelectionOrigin=e,r.input.lastSelectionTime=Date.now()}function Ha(r){r.domObserver.stop();for(let e in r.input.eventHandlers)r.dom.removeEventListener(e,r.input.eventHandlers[e]);clearTimeout(r.input.composingTimeout),clearTimeout(r.input.lastIOSEnterFallbackTimeout)}function ar(r){r.someProp("handleDOMEvents",e=>{for(let t in e)r.input.eventHandlers[t]||r.dom.addEventListener(t,r.input.eventHandlers[t]=n=>xr(r,n))})}function xr(r,e){return r.someProp("handleDOMEvents",t=>{let n=t[e.type];return n?n(r,e)||e.defaultPrevented:!1})}function ja(r,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=r.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Wa(r,e){!xr(r,e)&&te[e.type]&&(r.editable||!(e.type in ne))&&te[e.type](r,e)}ne.keydown=(r,e)=>{let t=e;if(r.input.shiftKey=t.keyCode==16||t.shiftKey,!Us(r,t)&&(r.input.lastKeyCode=t.keyCode,r.input.lastKeyCodeTime=Date.now(),!(he&&Y&&t.keyCode==13)))if(t.keyCode!=229&&r.domObserver.forceFlush(),mt&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let n=Date.now();r.input.lastIOSEnter=n,r.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{r.input.lastIOSEnter==n&&(r.someProp("handleKeyDown",i=>i(r,He(13,"Enter"))),r.input.lastIOSEnter=0)},200)}else r.someProp("handleKeyDown",n=>n(r,t))||Ra(r,t)?t.preventDefault():Ie(r,"key")};ne.keyup=(r,e)=>{e.keyCode==16&&(r.input.shiftKey=!1)};ne.keypress=(r,e)=>{let t=e;if(Us(r,t)||!t.charCode||t.ctrlKey&&!t.altKey||ce&&t.metaKey)return;if(r.someProp("handleKeyPress",i=>i(r,t))){t.preventDefault();return}let n=r.state.selection;if(!(n instanceof C)||!n.$from.sameParent(n.$to)){let i=String.fromCharCode(t.charCode);!/[\r\n]/.test(i)&&!r.someProp("handleTextInput",s=>s(r,n.$from.pos,n.$to.pos,i))&&r.dispatch(r.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function kn(r){return{left:r.clientX,top:r.clientY}}function Ja(r,e){let t=e.x-r.clientX,n=e.y-r.clientY;return t*t+n*n<100}function Sr(r,e,t,n,i){if(n==-1)return!1;let s=r.state.doc.resolve(n);for(let o=s.depth+1;o>0;o--)if(r.someProp(e,l=>o>s.depth?l(r,t,s.nodeAfter,s.before(o),i,!0):l(r,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function ft(r,e,t){r.focused||r.focus();let n=r.state.tr.setSelection(e);n.setMeta("pointer",!0),r.dispatch(n)}function qa(r,e){if(e==-1)return!1;let t=r.state.doc.resolve(e),n=t.nodeAfter;return n&&n.isAtom&&M.isSelectable(n)?(ft(r,new M(t)),!0):!1}function Ka(r,e){if(e==-1)return!1;let t=r.state.selection,n,i;t instanceof M&&(n=t.node);let s=r.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(M.isSelectable(l)){n&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(ft(r,M.create(r.state.doc,i)),!0):!1}function Ua(r,e,t,n,i){return Sr(r,"handleClickOn",e,t,n)||r.someProp("handleClick",s=>s(r,e,n))||(i?Ka(r,t):qa(r,t))}function Ga(r,e,t,n){return Sr(r,"handleDoubleClickOn",e,t,n)||r.someProp("handleDoubleClick",i=>i(r,e,n))}function Ya(r,e,t,n){return Sr(r,"handleTripleClickOn",e,t,n)||r.someProp("handleTripleClick",i=>i(r,e,n))||Xa(r,t,n)}function Xa(r,e,t){if(t.button!=0)return!1;let n=r.state.doc;if(e==-1)return n.inlineContent?(ft(r,C.create(n,0,n.content.size)),!0):!1;let i=n.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(o.inlineContent)ft(r,C.create(n,l+1,l+1+o.content.size));else if(M.isSelectable(o))ft(r,M.create(n,l));else continue;return!0}}function Mr(r){return on(r)}const Ks=ce?"metaKey":"ctrlKey";te.mousedown=(r,e)=>{let t=e;r.input.shiftKey=t.shiftKey;let n=Mr(r),i=Date.now(),s="singleClick";i-r.input.lastClick.time<500&&Ja(t,r.input.lastClick)&&!t[Ks]&&(r.input.lastClick.type=="singleClick"?s="doubleClick":r.input.lastClick.type=="doubleClick"&&(s="tripleClick")),r.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s};let o=r.posAtCoords(kn(t));o&&(s=="singleClick"?(r.input.mouseDown&&r.input.mouseDown.done(),r.input.mouseDown=new Za(r,o,t,!!n)):(s=="doubleClick"?Ga:Ya)(r,o.pos,o.inside,t)?t.preventDefault():Ie(r,"pointer"))};class Za{constructor(e,t,n,i){this.view=e,this.pos=t,this.event=n,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[Ks],this.allowDefault=n.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let d=e.state.doc.resolve(t.pos);s=d.parent,o=d.depth?d.before():0}const l=i?null:n.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=e.state;(n.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof M&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ge&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Ie(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Te(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(kn(e))),this.updateAllowDefault(e),this.allowDefault||!t?Ie(this.view,"pointer"):Ua(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ee&&this.mightDrag&&!this.mightDrag.node.isAtom||Y&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(ft(this.view,T.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Ie(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ie(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}te.touchstart=r=>{r.input.lastTouch=Date.now(),Mr(r),Ie(r,"pointer")};te.touchmove=r=>{r.input.lastTouch=Date.now(),Ie(r,"pointer")};te.contextmenu=r=>Mr(r);function Us(r,e){return r.composing?!0:ee&&Math.abs(e.timeStamp-r.input.compositionEndedAt)<500?(r.input.compositionEndedAt=-2e8,!0):!1}const Qa=he?5e3:-1;ne.compositionstart=ne.compositionupdate=r=>{if(!r.composing){r.domObserver.flush();let{state:e}=r,t=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)))r.markCursor=r.state.storedMarks||t.marks(),on(r,!0),r.markCursor=null;else if(on(r),ge&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let n=r.domSelectionRange();for(let i=n.focusNode,s=n.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){r.domSelection().collapse(o,o.nodeValue.length);break}else i=o,s=-1}}r.input.composing=!0}Gs(r,Qa)};ne.compositionend=(r,e)=>{r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=e.timeStamp,r.input.compositionPendingChanges=r.domObserver.pendingRecords().length?r.input.compositionID:0,r.input.compositionNode=null,r.input.compositionPendingChanges&&Promise.resolve().then(()=>r.domObserver.flush()),r.input.compositionID++,Gs(r,20))};function Gs(r,e){clearTimeout(r.input.composingTimeout),e>-1&&(r.input.composingTimeout=setTimeout(()=>on(r),e))}function Ys(r){for(r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=tc());r.input.compositionNodes.length>0;)r.input.compositionNodes.pop().markParentsDirty()}function ec(r){let e=r.domSelectionRange();if(!e.focusNode)return null;let t=Kl(e.focusNode,e.focusOffset),n=Ul(e.focusNode,e.focusOffset);if(t&&n&&t!=n){let i=n.pmViewDesc,s=r.domObserver.lastChangedTextNode;if(t==s||n==s)return s;if(!i||!i.isText(n.nodeValue))return n;if(r.input.compositionNode==n){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return n}}return t||n}function tc(){let r=document.createEvent("Event");return r.initEvent("event",!0,!0),r.timeStamp}function on(r,e=!1){if(!(he&&r.domObserver.flushingSoon>=0)){if(r.domObserver.forceFlush(),Ys(r),e||r.docView&&r.docView.dirty){let t=br(r);return t&&!t.eq(r.state.selection)?r.dispatch(r.state.tr.setSelection(t)):r.updateState(r.state),!0}return!1}}function nc(r,e){if(!r.dom.parentNode)return;let t=r.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(e),r.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),r.focus()},50)}const Dt=re&&Pe<15||mt&&Ql<604;te.copy=ne.cut=(r,e)=>{let t=e,n=r.state.selection,i=t.type=="cut";if(n.empty)return;let s=Dt?null:t.clipboardData,o=n.content(),{dom:l,text:a}=$s(r,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):nc(r,l),i&&r.dispatch(r.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function rc(r){return r.openStart==0&&r.openEnd==0&&r.content.childCount==1?r.content.firstChild:null}function ic(r,e){if(!r.dom.parentNode)return;let t=r.input.shiftKey||r.state.selection.$from.parent.type.spec.code,n=r.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=r.input.shiftKey&&r.input.lastKeyCode!=45;setTimeout(()=>{r.focus(),n.parentNode&&n.parentNode.removeChild(n),t?It(r,n.value,null,i,e):It(r,n.textContent,n.innerHTML,i,e)},50)}function It(r,e,t,n,i){let s=_s(r,e,t,n,r.state.selection.$from);if(r.someProp("handlePaste",a=>a(r,i,s||k.empty)))return!0;if(!s)return!1;let o=rc(s),l=o?r.state.tr.replaceSelectionWith(o,n):r.state.tr.replaceSelection(s);return r.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Xs(r){let e=r.getData("text/plain")||r.getData("Text");if(e)return e;let t=r.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}ne.paste=(r,e)=>{let t=e;if(r.composing&&!he)return;let n=Dt?null:t.clipboardData,i=r.input.shiftKey&&r.input.lastKeyCode!=45;n&&It(r,Xs(n),n.getData("text/html"),i,t)?t.preventDefault():ic(r,t)};class Zs{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const Qs=ce?"altKey":"ctrlKey";te.dragstart=(r,e)=>{let t=e,n=r.input.mouseDown;if(n&&n.done(),!t.dataTransfer)return;let i=r.state.selection,s=i.empty?null:r.posAtCoords(kn(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof M?i.to-1:i.to))){if(n&&n.mightDrag)o=M.create(r.state.doc,n.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let u=r.docView.nearestDesc(t.target,!0);u&&u.node.type.spec.draggable&&u!=r.docView&&(o=M.create(r.state.doc,u.posBefore))}}let l=(o||r.state.selection).content(),{dom:a,text:c,slice:d}=$s(r,l);(!t.dataTransfer.files.length||!Y||Cs>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Dt?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Dt||t.dataTransfer.setData("text/plain",c),r.dragging=new Zs(d,!t[Qs],o)};te.dragend=r=>{let e=r.dragging;window.setTimeout(()=>{r.dragging==e&&(r.dragging=null)},50)};ne.dragover=ne.dragenter=(r,e)=>e.preventDefault();ne.drop=(r,e)=>{let t=e,n=r.dragging;if(r.dragging=null,!t.dataTransfer)return;let i=r.posAtCoords(kn(t));if(!i)return;let s=r.state.doc.resolve(i.pos),o=n&&n.slice;o?r.someProp("transformPasted",h=>{o=h(o,r)}):o=_s(r,Xs(t.dataTransfer),Dt?null:t.dataTransfer.getData("text/html"),!1,s);let l=!!(n&&!t[Qs]);if(r.someProp("handleDrop",h=>h(r,t,o||k.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let a=o?gs(r.state.doc,s.pos,o):s.pos;a==null&&(a=s.pos);let c=r.state.tr;if(l){let{node:h}=n;h?h.replace(c):c.deleteSelection()}let d=c.mapping.map(a),u=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,f=c.doc;if(u?c.replaceRangeWith(d,d,o.content.firstChild):c.replaceRange(d,d,o),c.doc.eq(f))return;let p=c.doc.resolve(d);if(u&&M.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new M(p));else{let h=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,y,x)=>h=x),c.setSelection(kr(r,p,c.doc.resolve(h)))}r.focus(),r.dispatch(c.setMeta("uiEvent","drop"))};te.focus=r=>{r.input.lastFocus=Date.now(),r.focused||(r.domObserver.stop(),r.dom.classList.add("ProseMirror-focused"),r.domObserver.start(),r.focused=!0,setTimeout(()=>{r.docView&&r.hasFocus()&&!r.domObserver.currentSelection.eq(r.domSelectionRange())&&Te(r)},20))};te.blur=(r,e)=>{let t=e;r.focused&&(r.domObserver.stop(),r.dom.classList.remove("ProseMirror-focused"),r.domObserver.start(),t.relatedTarget&&r.dom.contains(t.relatedTarget)&&r.domObserver.currentSelection.clear(),r.focused=!1)};te.beforeinput=(r,e)=>{if(Y&&he&&e.inputType=="deleteContentBackward"){r.domObserver.flushSoon();let{domChangeCount:n}=r.input;setTimeout(()=>{if(r.input.domChangeCount!=n||(r.dom.blur(),r.focus(),r.someProp("handleKeyDown",s=>s(r,He(8,"Backspace")))))return;let{$cursor:i}=r.state.selection;i&&i.pos>0&&r.dispatch(r.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let r in ne)te[r]=ne[r];function Rt(r,e){if(r==e)return!0;for(let t in r)if(r[t]!==e[t])return!1;for(let t in e)if(!(t in r))return!1;return!0}class ln{constructor(e,t){this.toDOM=e,this.spec=t||Ye,this.side=this.spec.side||0}map(e,t,n,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new de(s-n,s-n,this)}valid(){return!0}eq(e){return this==e||e instanceof ln&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Rt(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Le{constructor(e,t){this.attrs=e,this.spec=t||Ye}map(e,t,n,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-n;return s>=o?null:new de(s,o,this)}valid(e,t){return t.from=e&&(!s||s(l.spec))&&n.push(l.copy(l.from+i,l.to+i))}for(let o=0;oe){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,n,i+l,s)}}map(e,t,n){return this==G||e.maps.length==0?this:this.mapInner(e,t,0,0,n||Ye)}mapInner(e,t,n,i,s){let o;for(let l=0;l{let c=a+n,d;if(d=to(t,l,c)){for(i||(i=this.children.slice());sl&&u.to=e){this.children[l]==e&&(n=this.children[l+2]);break}let s=e+1,o=s+t.content.size;for(let l=0;ls&&a.type instanceof Le){let c=Math.max(s,a.from)-s,d=Math.min(o,a.to)-s;ci.map(e,t,Ye));return Ne.from(n)}forChild(e,t){if(t.isLeaf)return V.empty;let n=[];for(let i=0;it instanceof V)?e:e.reduce((t,n)=>t.concat(n instanceof V?n:n.members),[]))}}}function sc(r,e,t,n,i,s,o){let l=r.slice();for(let c=0,d=s;c{let g=m-h-(p-f);for(let y=0;yx+d-u)continue;let v=l[y]+d-u;p>=v?l[y+1]=f<=v?-2:-1:f>=d&&g&&(l[y]+=g,l[y+1]+=g)}u+=g}),d=t.maps[c].map(d,-1)}let a=!1;for(let c=0;c=n.content.size){a=!0;continue}let f=t.map(r[c+1]+s,-1),p=f-i,{index:h,offset:m}=n.content.findIndex(u),g=n.maybeChild(h);if(g&&m==u&&m+g.nodeSize==p){let y=l[c+2].mapInner(t,g,d+1,r[c]+s+1,o);y!=G?(l[c]=u,l[c+1]=p,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=oc(l,r,e,t,i,s,o),d=an(c,n,0,o);e=d.local;for(let u=0;ut&&o.to{let c=to(r,l,a+t);if(c){s=!0;let d=an(c,l,t+a+1,n);d!=G&&i.push(a,a+l.nodeSize,d)}});let o=eo(s?no(r):r,-t).sort(Xe);for(let l=0;l0;)e++;r.splice(e,0,t)}function Fn(r){let e=[];return r.someProp("decorations",t=>{let n=t(r.state);n&&n!=G&&e.push(n)}),r.cursorWrapper&&e.push(V.create(r.state.doc,[r.cursorWrapper.deco])),Ne.from(e)}const lc={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ac=re&&Pe<=11;class cc{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class dc{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new cc,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(n=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),ac&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,lc)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;tthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(di(this.view)){if(this.suppressingSelectionUpdates)return Te(this.view);if(re&&Pe<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&et(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let s=e.focusNode;s;s=Et(s))t.add(s);for(let s=e.anchorNode;s;s=Et(s))if(t.has(s)){n=s;break}let i=n&&this.view.docView.nearestDesc(n);if(i&&i.ignoreMutation({type:"selection",target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&di(e)&&!this.ignoreSelectionChange(n),s=-1,o=-1,l=!1,a=[];if(e.editable)for(let d=0;du.nodeName=="BR");if(d.length==2){let[u,f]=d;u.parentNode&&u.parentNode.parentNode==f.parentNode?f.remove():u.remove()}else{let{focusNode:u}=this.currentSelection;for(let f of d){let p=f.parentNode;p&&p.nodeName=="LI"&&(!u||hc(e,u)!=p)&&f.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||i)&&(s>-1&&(e.docView.markDirty(s,o),uc(e)),this.handleDOMChange(s,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Te(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(n==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;di;g--){let y=n.childNodes[g-1],x=y.pmViewDesc;if(y.nodeName=="BR"&&!x){s=g;break}if(!x||x.size)break}let u=r.state.doc,f=r.someProp("domParser")||Re.fromSchema(r.state.schema),p=u.resolve(o),h=null,m=f.parse(n,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:mc,context:p});if(c&&c[0].pos!=null){let g=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=g),h={anchor:g+o,head:y+o}}return{doc:m,sel:h,from:o,to:l}}function mc(r){let e=r.pmViewDesc;if(e)return e.parseRule();if(r.nodeName=="BR"&&r.parentNode){if(ee&&/^(ul|ol)$/i.test(r.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(r.parentNode.lastChild==r||ee&&/^(tr|table)$/i.test(r.parentNode.nodeName))return{ignore:!0}}else if(r.nodeName=="IMG"&&r.getAttribute("mark-placeholder"))return{ignore:!0};return null}const gc=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function yc(r,e,t,n,i){let s=r.input.compositionPendingChanges||(r.composing?r.input.compositionID:0);if(r.input.compositionPendingChanges=0,e<0){let N=r.input.lastSelectionTime>Date.now()-50?r.input.lastSelectionOrigin:null,O=br(r,N);if(O&&!r.state.selection.eq(O)){if(Y&&he&&r.input.lastKeyCode===13&&Date.now()-100To(r,He(13,"Enter"))))return;let Vt=r.state.tr.setSelection(O);N=="pointer"?Vt.setMeta("pointer",!0):N=="key"&&Vt.scrollIntoView(),s&&Vt.setMeta("composition",s),r.dispatch(Vt)}return}let o=r.state.doc.resolve(e),l=o.sharedDepth(t);e=o.before(l+1),t=r.state.doc.resolve(t).after(l+1);let a=r.state.selection,c=pc(r,e,t),d=r.state.doc,u=d.slice(c.from,c.to),f,p;r.input.lastKeyCode===8&&Date.now()-100Date.now()-225||he)&&i.some(N=>N.nodeType==1&&!gc.test(N.nodeName))&&(!h||h.endA>=h.endB)&&r.someProp("handleKeyDown",N=>N(r,He(13,"Enter")))){r.input.lastIOSEnter=0;return}if(!h)if(n&&a instanceof C&&!a.empty&&a.$head.sameParent(a.$anchor)&&!r.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))h={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let N=Mi(r,r.state.doc,c.sel);if(N&&!N.eq(r.state.selection)){let O=r.state.tr.setSelection(N);s&&O.setMeta("composition",s),r.dispatch(O)}}return}r.input.domChangeCount++,r.state.selection.fromr.state.selection.from&&h.start<=r.state.selection.from+2&&r.state.selection.from>=c.from?h.start=r.state.selection.from:h.endA=r.state.selection.to-2&&r.state.selection.to<=c.to&&(h.endB+=r.state.selection.to-h.endA,h.endA=r.state.selection.to)),re&&Pe<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>c.from&&c.doc.textBetween(h.start-c.from-1,h.start-c.from+1)==" "&&(h.start--,h.endA--,h.endB--);let m=c.doc.resolveNoCache(h.start-c.from),g=c.doc.resolveNoCache(h.endB-c.from),y=d.resolve(h.start),x=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=h.endA,v;if((mt&&r.input.lastIOSEnter>Date.now()-225&&(!x||i.some(N=>N.nodeName=="DIV"||N.nodeName=="P"))||!x&&m.posN(r,He(13,"Enter")))){r.input.lastIOSEnter=0;return}if(r.state.selection.anchor>h.start&&kc(d,h.start,h.endA,m,g)&&r.someProp("handleKeyDown",N=>N(r,He(8,"Backspace")))){he&&Y&&r.domObserver.suppressSelectionUpdates();return}Y&&he&&h.endB==h.start&&(r.input.lastAndroidDelete=Date.now()),he&&!x&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==h.endA&&(h.endB-=2,g=c.doc.resolveNoCache(h.endB-c.from),setTimeout(()=>{r.someProp("handleKeyDown",function(N){return N(r,He(13,"Enter"))})},20));let P=h.start,B=h.endA,D,_,ae;if(x){if(m.pos==g.pos)re&&Pe<=11&&m.parentOffset==0&&(r.domObserver.suppressSelectionUpdates(),setTimeout(()=>Te(r),20)),D=r.state.tr.delete(P,B),_=d.resolve(h.start).marksAcross(d.resolve(h.endA));else if(h.endA==h.endB&&(ae=bc(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,h.endA-y.start()))))D=r.state.tr,ae.type=="add"?D.addMark(P,B,ae.mark):D.removeMark(P,B,ae.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let N=m.parent.textBetween(m.parentOffset,g.parentOffset);if(r.someProp("handleTextInput",O=>O(r,P,B,N)))return;D=r.state.tr.insertText(N,P,B)}}if(D||(D=r.state.tr.replace(P,B,c.doc.slice(h.start-c.from,h.endB-c.from))),c.sel){let N=Mi(r,D.doc,c.sel);N&&!(Y&&he&&r.composing&&N.empty&&(h.start!=h.endB||r.input.lastAndroidDeletee.content.size?null:kr(r,e.resolve(t.anchor),e.resolve(t.head))}function bc(r,e){let t=r.firstChild.marks,n=e.firstChild.marks,i=t,s=n,o,l,a;for(let d=0;dd.mark(l.addToSet(d.marks));else if(i.length==0&&s.length==1)l=s[0],o="remove",a=d=>d.mark(l.removeFromSet(d.marks));else return null;let c=[];for(let d=0;dt||Vn(o,!0,!1)0&&(e||r.indexAfter(n)==r.node(n).childCount);)n--,i++,e=!1;if(t){let s=r.node(n).maybeChild(r.indexAfter(n));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function xc(r,e,t,n,i){let s=r.findDiffStart(e,t);if(s==null)return null;let{a:o,b:l}=r.findDiffEnd(e,t+r.size,t+e.size);if(i=="end"){let a=Math.max(0,s-Math.min(o,l));n-=o+a-s}if(o=o?s-n:0;s-=a,s&&s=l?s-n:0;s-=a,s&&s=56320&&e<=57343&&t>=55296&&t<=56319}class Sc{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new $a,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Ai),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=vi(this),Ti(this),this.nodeViews=Oi(this),this.docView=ii(this.state.doc,Ci(this),Fn(this),this.dom,this),this.domObserver=new dc(this,(n,i,s,o)=>yc(this,n,i,s,o)),this.domObserver.start(),_a(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ar(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Ai),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let n in this._props)t[n]=this._props[n];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(Ys(this),o=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let p=Oi(this);wc(p,this.nodeViews)&&(this.nodeViews=p,s=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&ar(this),this.editable=vi(this),Ti(this);let a=Fn(this),c=Ci(this),d=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",u=s||!this.docView.matchesNode(e.doc,c,a);(u||!e.selection.eq(i.selection))&&(o=!0);let f=d=="preserve"&&o&&this.dom.style.overflowAnchor==null&&na(this);if(o){this.domObserver.stop();let p=u&&(re||Y)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&Mc(i.selection,e.selection);if(u){let h=Y?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=ec(this)),(s||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=ii(e.doc,c,a,this.dom,this)),h&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&va(this))?Te(this,p):(zs(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((n=this.dragging)===null||n===void 0)&&n.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():f&&ra(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof M){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Zr(this,t.getBoundingClientRect(),e)}else Zr(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t0&&this.state.doc.nodeAt(s))==n.node&&(i=s)}this.dragging=new Zs(e.slice,e.move,i<0?void 0:M.create(this.state.doc,i))}someProp(e,t){let n=this._props&&this._props[e],i;if(n!=null&&(i=t?t(n):n))return i;for(let o=0;ot.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return ca(this,e)}coordsAtPos(e,t=1){return Ns(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let i=this.docView.posFromDOM(e,t,n);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return pa(this,t||this.state,e)}pasteHTML(e,t){return It(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return It(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(Ha(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Fn(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Jl())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Wa(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return ee&&this.root.nodeType===11&&Yl(this.dom.ownerDocument)==this.dom&&fc(this,e)||e}domSelection(){return this.root.getSelection()}}function Ci(r){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(r.editable),r.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(r.state)),t)for(let n in t)n=="class"?e.class+=" "+t[n]:n=="style"?e.style=(e.style?e.style+";":"")+t[n]:!e[n]&&n!="contenteditable"&&n!="nodeName"&&(e[n]=String(t[n]))}),e.translate||(e.translate="no"),[de.node(0,r.state.doc.content.size,e)]}function Ti(r){if(r.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),r.cursorWrapper={dom:e,deco:de.widget(r.state.selection.head,e,{raw:!0,marks:r.markCursor})}}else r.cursorWrapper=null}function vi(r){return!r.someProp("editable",e=>e(r.state)===!1)}function Mc(r,e){let t=Math.min(r.$anchor.sharedDepth(r.head),e.$anchor.sharedDepth(e.head));return r.$anchor.start(t)!=e.$anchor.start(t)}function Oi(r){let e=Object.create(null);function t(n){for(let i in n)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=n[i])}return r.someProp("nodeViews",t),r.someProp("markViews",t),e}function wc(r,e){let t=0,n=0;for(let i in r){if(r[i]!=e[i])return!0;t++}for(let i in e)n++;return t!=n}function Ai(r){if(r.spec.state||r.spec.filterTransaction||r.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var ze={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},cn={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Cc=typeof navigator<"u"&&/Mac/.test(navigator.platform),Tc=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var U=0;U<10;U++)ze[48+U]=ze[96+U]=String(U);for(var U=1;U<=24;U++)ze[U+111]="F"+U;for(var U=65;U<=90;U++)ze[U]=String.fromCharCode(U+32),cn[U]=String.fromCharCode(U);for(var $n in ze)cn.hasOwnProperty($n)||(cn[$n]=ze[$n]);function vc(r){var e=Cc&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||Tc&&r.shiftKey&&r.key&&r.key.length==1||r.key=="Unidentified",t=!e&&r.key||(r.shiftKey?cn:ze)[r.keyCode]||r.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const Oc=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function Ac(r){let e=r.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let n,i,s,o;for(let l=0;l127)&&(s=ze[n.keyCode])&&s!=i){let l=e[_n(s,n)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const Dc=(r,e)=>r.selection.empty?!1:(e&&e(r.tr.deleteSelection().scrollIntoView()),!0);function io(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("backward",r):t.parentOffset>0)?null:t}const Ic=(r,e,t)=>{let n=io(r,t);if(!n)return!1;let i=Tr(n);if(!i){let o=n.blockRange(),l=o&&kt(o);return l==null?!1:(e&&e(r.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(ao(r,i,e,-1))return!0;if(n.parent.content.size==0&&(gt(s,"end")||M.isSelectable(s)))for(let o=n.depth;;o--){let l=mn(r.doc,n.before(o),n.after(o),k.empty);if(l&&l.slice.size1)break}return s.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},Rc=(r,e,t)=>{let n=io(r,t);if(!n)return!1;let i=Tr(n);return i?so(r,i,e):!1},Pc=(r,e,t)=>{let n=oo(r,t);if(!n)return!1;let i=vr(n);return i?so(r,i,e):!1};function so(r,e,t){let n=e.nodeBefore,i=n,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let d=i.lastChild;if(!d)return!1;i=d}let o=e.nodeAfter,l=o,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let d=l.firstChild;if(!d)return!1;l=d}let c=mn(r.doc,s,a,k.empty);if(!c||c.from!=s||c instanceof H&&c.slice.size>=a-s)return!1;if(t){let d=r.tr.step(c);d.setSelection(C.create(d.doc,s)),t(d.scrollIntoView())}return!0}function gt(r,e,t=!1){for(let n=r;n;n=e=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(t&&n.childCount!=1)return!1}return!1}const Bc=(r,e,t)=>{let{$head:n,empty:i}=r.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("backward",r):n.parentOffset>0)return!1;s=Tr(n)}let o=s&&s.nodeBefore;return!o||!M.isSelectable(o)?!1:(e&&e(r.tr.setSelection(M.create(r.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Tr(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){if(r.index(e)>0)return r.doc.resolve(r.before(e+1));if(r.node(e).type.spec.isolating)break}return null}function oo(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("forward",r):t.parentOffset{let n=oo(r,t);if(!n)return!1;let i=vr(n);if(!i)return!1;let s=i.nodeAfter;if(ao(r,i,e,1))return!0;if(n.parent.content.size==0&&(gt(s,"start")||M.isSelectable(s))){let o=mn(r.doc,n.before(),n.after(),k.empty);if(o&&o.slice.size{let{$head:n,empty:i}=r.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("forward",r):n.parentOffset=0;e--){let t=r.node(e);if(r.index(e)+1{let t=r.selection,n=t instanceof M,i;if(n){if(t.node.isTextblock||!Fe(r.doc,t.from))return!1;i=t.from}else if(i=pn(r.doc,t.from,-1),i==null)return!1;if(e){let s=r.tr.join(i);n&&s.setSelection(M.create(s.doc,i-r.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},Vc=(r,e)=>{let t=r.selection,n;if(t instanceof M){if(t.node.isTextblock||!Fe(r.doc,t.to))return!1;n=t.to}else if(n=pn(r.doc,t.to,1),n==null)return!1;return e&&e(r.tr.join(n).scrollIntoView()),!0},$c=(r,e)=>{let{$from:t,$to:n}=r.selection,i=t.blockRange(n),s=i&&kt(i);return s==null?!1:(e&&e(r.tr.lift(i,s).scrollIntoView()),!0)},_c=(r,e)=>{let{$head:t,$anchor:n}=r.selection;return!t.parent.type.spec.code||!t.sameParent(n)?!1:(e&&e(r.tr.insertText(`
`).scrollIntoView()),!0)};function lo(r){for(let e=0;e{let{$head:t,$anchor:n}=r.selection;if(!t.parent.type.spec.code||!t.sameParent(n))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=lo(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=t.after(),a=r.tr.replaceWith(l,l,o.createAndFill());a.setSelection(T.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},jc=(r,e)=>{let t=r.selection,{$from:n,$to:i}=t;if(t instanceof me||n.parent.inlineContent||i.parent.inlineContent)return!1;let s=lo(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!n.parentOffset&&i.index(){let{$cursor:t}=r.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(dt(r.doc,s))return e&&e(r.tr.split(s).scrollIntoView()),!0}let n=t.blockRange(),i=n&&kt(n);return i==null?!1:(e&&e(r.tr.lift(n,i).scrollIntoView()),!0)},Jc=(r,e)=>{let{$from:t,to:n}=r.selection,i,s=t.sharedDepth(n);return s==0?!1:(i=t.before(s),e&&e(r.tr.setSelection(M.create(r.doc,i))),!0)};function qc(r,e,t){let n=e.nodeBefore,i=e.nodeAfter,s=e.index();return!n||!i||!n.type.compatibleContent(i.type)?!1:!n.content.size&&e.parent.canReplace(s-1,s)?(t&&t(r.tr.delete(e.pos-n.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Fe(r.doc,e.pos))?!1:(t&&t(r.tr.clearIncompatible(e.pos,n.type,n.contentMatchAt(n.childCount)).join(e.pos).scrollIntoView()),!0)}function ao(r,e,t,n){let i=e.nodeBefore,s=e.nodeAfter,o,l,a=i.type.spec.isolating||s.type.spec.isolating;if(!a&&qc(r,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(l=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(t){let p=e.pos+s.nodeSize,h=b.empty;for(let y=o.length-1;y>=0;y--)h=b.from(o[y].create(null,h));h=b.from(i.copy(h));let m=r.tr.step(new j(e.pos-1,p,e.pos,p,new k(h,1,0),o.length,!0)),g=p+2*o.length;Fe(m.doc,g)&&m.join(g),t(m.scrollIntoView())}return!0}let d=s.type.spec.isolating||n>0&&a?null:T.findFrom(e,1),u=d&&d.$from.blockRange(d.$to),f=u&&kt(u);if(f!=null&&f>=e.depth)return t&&t(r.tr.lift(u,f).scrollIntoView()),!0;if(c&>(s,"start",!0)&>(i,"end")){let p=i,h=[];for(;h.push(p),!p.isTextblock;)p=p.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(t){let y=b.empty;for(let v=h.length-1;v>=0;v--)y=b.from(h[v].copy(y));let x=r.tr.step(new j(e.pos-h.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new k(y,h.length,0),0,!0));t(x.scrollIntoView())}return!0}}return!1}function co(r){return function(e,t){let n=e.selection,i=r<0?n.$from:n.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(C.create(e.doc,r<0?i.start(s):i.end(s)))),!0):!1}}const Kc=co(-1),Uc=co(1);function Gc(r,e=null){return function(t,n){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),l=o&&mr(o,r,e);return l?(n&&n(t.tr.wrap(o,l).scrollIntoView()),!0):!1}}function Ni(r,e=null){return function(t,n){let i=!1;for(let s=0;s{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(r,e)))if(a.type==r)i=!0;else{let d=t.doc.resolve(c),u=d.index();i=d.parent.canReplaceWith(u,u+1,r)}})}if(!i)return!1;if(n){let s=t.tr;for(let o=0;o=2&&i.node(o.depth-1).type.compatibleContent(r)&&o.startIndex==0){if(i.index(o.depth-1)==0)return!1;let d=t.doc.resolve(o.start-2);a=new en(d,d,o.depth),o.endIndex=0;d--)s=b.from(t[d].type.create(t[d].attrs,s));r.step(new j(e.start-(n?2:0),e.end,e.start,e.end,new k(s,0,0),t.length,!0));let o=0;for(let d=0;do.childCount>0&&o.firstChild.type==r);return s?t?n.node(s.depth-1).type==r?Qc(e,t,r,s):ed(e,t,s):!0:!1}}function Qc(r,e,t,n){let i=r.tr,s=n.end,o=n.$to.end(n.depth);sm;h--)p-=i.child(h).nodeSize,n.delete(p-1,p+1);let s=n.doc.resolve(t.start),o=s.nodeAfter;if(n.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==i.childCount,c=s.node(-1),d=s.index(-1);if(!c.canReplace(d+(l?0:1),d+1,o.content.append(a?b.empty:b.from(i))))return!1;let u=s.pos,f=u+o.nodeSize;return n.step(new j(u-(l?1:0),f+(a?1:0),u+1,f-1,new k((l?b.empty:b.from(i.copy(b.empty))).append(a?b.empty:b.from(i.copy(b.empty))),l?0:1,a?0:1),l?0:1)),e(n.scrollIntoView()),!0}function td(r){return function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,c=>c.childCount>0&&c.firstChild.type==r);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let l=s.parent,a=l.child(o-1);if(a.type!=r)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,d=b.from(c?r.create():null),u=new k(b.from(r.create(null,b.from(l.type.create(null,d)))),c?3:1,0),f=s.start,p=s.end;t(e.tr.step(new j(f-(c?3:1),p,f,p,u,1,!0)).scrollIntoView())}return!0}}function xn(r){const{state:e,transaction:t}=r;let{selection:n}=t,{doc:i}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return n},get doc(){return i},get tr(){return n=t.selection,i=t.doc,s=t.storedMarks,t}}}class Sn{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:n}=this,{view:i}=t,{tr:s}=n,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...d)=>{const u=a(...d)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:n,editor:i,state:s}=this,{view:o}=i,l=[],a=!!e,c=e||s.tr,d=()=>(!a&&t&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),l.every(f=>f===!0)),u={...Object.fromEntries(Object.entries(n).map(([f,p])=>[f,(...m)=>{const g=this.buildProps(c,t),y=p(...m)(g);return l.push(y),u}])),run:d};return u}createCan(e){const{rawCommands:t,state:n}=this,i=!1,s=e||n.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(t).map(([a,c])=>[a,(...d)=>c(...d)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,t=!0){const{rawCommands:n,editor:i,state:s}=this,{view:o}=i,l={tr:e,editor:i,view:o,state:xn({state:s,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([a,c])=>[a,(...d)=>c(...d)(l)]))}};return l}}class nd{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const n=this.callbacks[e];return n&&n.forEach(i=>i.apply(this,t)),this}off(e,t){const n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(i=>i!==t):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}}function S(r,e,t){return r.config[e]===void 0&&r.parent?S(r.parent,e,t):typeof r.config[e]=="function"?r.config[e].bind({...t,parent:r.parent?S(r.parent,e,t):null}):r.config[e]}function Mn(r){const e=r.filter(i=>i.type==="extension"),t=r.filter(i=>i.type==="node"),n=r.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:n}}function uo(r){const e=[],{nodeExtensions:t,markExtensions:n}=Mn(r),i=[...t,...n],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return r.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage,extensions:i},a=S(o,"addGlobalAttributes",l);if(!a)return;a().forEach(d=>{d.types.forEach(u=>{Object.entries(d.attributes).forEach(([f,p])=>{e.push({type:u,name:f,attribute:{...s,...p}})})})})}),i.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage},a=S(o,"addAttributes",l);if(!a)return;const c=a();Object.entries(c).forEach(([d,u])=>{const f={...s,...u};typeof(f==null?void 0:f.default)=="function"&&(f.default=f.default()),f!=null&&f.isRequired&&(f==null?void 0:f.default)===void 0&&delete f.default,e.push({type:o.name,name:d,attribute:f})})}),e}function J(r,e){if(typeof r=="string"){if(!e.nodes[r])throw Error(`There is no node type named '${r}'. Maybe you forgot to add the extension?`);return e.nodes[r]}return r}function $(...r){return r.filter(e=>!!e).reduce((e,t)=>{const n={...e};return Object.entries(t).forEach(([i,s])=>{if(!n[i]){n[i]=s;return}if(i==="class"){const l=s?s.split(" "):[],a=n[i]?n[i].split(" "):[],c=l.filter(d=>!a.includes(d));n[i]=[...a,...c].join(" ")}else i==="style"?n[i]=[n[i],s].join("; "):n[i]=s}),n},{})}function cr(r,e){return e.filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(r.attrs)||{}:{[t.name]:r.attrs[t.name]}).reduce((t,n)=>$(t,n),{})}function fo(r){return typeof r=="function"}function A(r,e=void 0,...t){return fo(r)?e?r.bind(e)(...t):r(...t):r}function rd(r={}){return Object.keys(r).length===0&&r.constructor===Object}function id(r){return typeof r!="string"?r:r.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(r):r==="true"?!0:r==="false"?!1:r}function Ei(r,e){return"style"in r?r:{...r,getAttrs:t=>{const n=r.getAttrs?r.getAttrs(t):r.attrs;if(n===!1)return!1;const i=e.reduce((s,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(t):id(t.getAttribute(o.name));return l==null?s:{...s,[o.name]:l}},{});return{...n,...i}}}}function Di(r){return Object.fromEntries(Object.entries(r).filter(([e,t])=>e==="attrs"&&rd(t)?!1:t!=null))}function sd(r,e){var t;const n=uo(r),{nodeExtensions:i,markExtensions:s}=Mn(r),o=(t=i.find(c=>S(c,"topNode")))===null||t===void 0?void 0:t.name,l=Object.fromEntries(i.map(c=>{const d=n.filter(y=>y.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},f=r.reduce((y,x)=>{const v=S(x,"extendNodeSchema",u);return{...y,...v?v(c):{}}},{}),p=Di({...f,content:A(S(c,"content",u)),marks:A(S(c,"marks",u)),group:A(S(c,"group",u)),inline:A(S(c,"inline",u)),atom:A(S(c,"atom",u)),selectable:A(S(c,"selectable",u)),draggable:A(S(c,"draggable",u)),code:A(S(c,"code",u)),whitespace:A(S(c,"whitespace",u)),defining:A(S(c,"defining",u)),isolating:A(S(c,"isolating",u)),attrs:Object.fromEntries(d.map(y=>{var x;return[y.name,{default:(x=y==null?void 0:y.attribute)===null||x===void 0?void 0:x.default}]}))}),h=A(S(c,"parseHTML",u));h&&(p.parseDOM=h.map(y=>Ei(y,d)));const m=S(c,"renderHTML",u);m&&(p.toDOM=y=>m({node:y,HTMLAttributes:cr(y,d)}));const g=S(c,"renderText",u);return g&&(p.toText=g),[c.name,p]})),a=Object.fromEntries(s.map(c=>{const d=n.filter(g=>g.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:e},f=r.reduce((g,y)=>{const x=S(y,"extendMarkSchema",u);return{...g,...x?x(c):{}}},{}),p=Di({...f,inclusive:A(S(c,"inclusive",u)),excludes:A(S(c,"excludes",u)),group:A(S(c,"group",u)),spanning:A(S(c,"spanning",u)),code:A(S(c,"code",u)),attrs:Object.fromEntries(d.map(g=>{var y;return[g.name,{default:(y=g==null?void 0:g.attribute)===null||y===void 0?void 0:y.default}]}))}),h=A(S(c,"parseHTML",u));h&&(p.parseDOM=h.map(g=>Ei(g,d)));const m=S(c,"renderHTML",u);return m&&(p.toDOM=g=>m({mark:g,HTMLAttributes:cr(g,d)})),[c.name,p]}));return new ss({topNode:o,nodes:l,marks:a})}function Hn(r,e){return e.nodes[r]||e.marks[r]||null}function Ii(r,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===r.name):e}const od=(r,e=500)=>{let t="";const n=r.parentOffset;return r.parent.nodesBetween(Math.max(0,n-e),n,(i,s,o,l)=>{var a,c;const d=((c=(a=i.type.spec).toText)===null||c===void 0?void 0:c.call(a,{node:i,pos:s,parent:o,index:l}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?d:d.slice(0,Math.max(0,n-s))}),t};function Or(r){return Object.prototype.toString.call(r)==="[object RegExp]"}class wn{constructor(e){this.find=e.find,this.handler=e.handler}}const ld=(r,e)=>{if(Or(e))return e.exec(r);const t=e(r);if(!t)return null;const n=[t.text];return n.index=t.index,n.input=r,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),n.push(t.replaceWith)),n};function jt(r){var e;const{editor:t,from:n,to:i,text:s,rules:o,plugin:l}=r,{view:a}=t;if(a.composing)return!1;const c=a.state.doc.resolve(n);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let d=!1;const u=od(c)+s;return o.forEach(f=>{if(d)return;const p=ld(u,f.find);if(!p)return;const h=a.state.tr,m=xn({state:a.state,transaction:h}),g={from:n-(p[0].length-s.length),to:i},{commands:y,chain:x,can:v}=new Sn({editor:t,state:m});f.handler({state:m,range:g,match:p,commands:y,chain:x,can:v})===null||!h.steps.length||(h.setMeta(l,{transform:h,from:n,to:i,text:s}),a.dispatch(h),d=!0)}),d}function ad(r){const{editor:e,rules:t}=r,n=new fe({state:{init(){return null},apply(i,s){const o=i.getMeta(n);if(o)return o;const l=i.getMeta("applyInputRules");return!!l&&setTimeout(()=>{const{from:c,text:d}=l,u=c+d.length;jt({editor:e,from:c,to:u,text:d,rules:t,plugin:n})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,l){return jt({editor:e,from:s,to:o,text:l,rules:t,plugin:n})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&jt({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:n})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?jt({editor:e,from:o.pos,to:o.pos,text:`
`,rules:t,plugin:n}):!1}},isInputRules:!0});return n}function cd(r){return typeof r=="number"}class dd{constructor(e){this.find=e.find,this.handler=e.handler}}const ud=(r,e,t)=>{if(Or(e))return[...r.matchAll(e)];const n=e(r,t);return n?n.map(i=>{const s=[i.text];return s.index=i.index,s.input=r,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function fd(r){const{editor:e,state:t,from:n,to:i,rule:s,pasteEvent:o,dropEvent:l}=r,{commands:a,chain:c,can:d}=new Sn({editor:e,state:t}),u=[];return t.doc.nodesBetween(n,i,(p,h)=>{if(!p.isTextblock||p.type.spec.code)return;const m=Math.max(n,h),g=Math.min(i,h+p.content.size),y=p.textBetween(m-h,g-h,void 0,"");ud(y,s.find,o).forEach(v=>{if(v.index===void 0)return;const P=m+v.index+1,B=P+v[0].length,D={from:t.tr.mapping.map(P),to:t.tr.mapping.map(B)},_=s.handler({state:t,range:D,match:v,commands:a,chain:c,can:d,pasteEvent:o,dropEvent:l});u.push(_)})}),u.every(p=>p!==null)}const hd=r=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)===null||e===void 0||e.setData("text/html",r),t};function pd(r){const{editor:e,rules:t}=r;let n=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l=typeof DragEvent<"u"?new DragEvent("drop"):null;const a=({state:d,from:u,to:f,rule:p,pasteEvt:h})=>{const m=d.tr,g=xn({state:d,transaction:m});if(!(!fd({editor:e,state:g,from:Math.max(u-1,0),to:f.b-1,rule:p,pasteEvent:h,dropEvent:l})||!m.steps.length))return l=typeof DragEvent<"u"?new DragEvent("drop"):null,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m};return t.map(d=>new fe({view(u){const f=p=>{var h;n=!((h=u.dom.parentElement)===null||h===void 0)&&h.contains(p.target)?u.dom.parentElement:null};return window.addEventListener("dragstart",f),{destroy(){window.removeEventListener("dragstart",f)}}},props:{handleDOMEvents:{drop:(u,f)=>(s=n===u.dom.parentElement,l=f,!1),paste:(u,f)=>{var p;const h=(p=f.clipboardData)===null||p===void 0?void 0:p.getData("text/html");return o=f,i=!!(h!=null&&h.includes("data-pm-slice")),!1}}},appendTransaction:(u,f,p)=>{const h=u[0],m=h.getMeta("uiEvent")==="paste"&&!i,g=h.getMeta("uiEvent")==="drop"&&!s,y=h.getMeta("applyPasteRules"),x=!!y;if(!m&&!g&&!x)return;if(x){const{from:B,text:D}=y,_=B+D.length,ae=hd(D);return a({rule:d,state:p,from:B,to:{b:_},pasteEvt:ae})}const v=f.doc.content.findDiffStart(p.doc.content),P=f.doc.content.findDiffEnd(p.doc.content);if(!(!cd(v)||!P||v===P.b))return a({rule:d,state:p,from:v,to:P,pasteEvt:o})}}))}function md(r){const e=r.filter((t,n)=>r.indexOf(t)!==n);return[...new Set(e)]}class at{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=at.resolve(e),this.schema=sd(this.extensions,t),this.setupExtensions()}static resolve(e){const t=at.sort(at.flatten(e)),n=md(t.map(i=>i.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(t=>{const n={name:t.name,options:t.options,storage:t.storage},i=S(t,"addExtensions",n);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((n,i)=>{const s=S(n,"priority")||100,o=S(i,"priority")||100;return s>o?-1:s{const n={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:Hn(t.name,this.schema)},i=S(t,"addCommands",n);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=at.sort([...this.extensions].reverse()),n=[],i=[],s=t.map(o=>{const l={name:o.name,options:o.options,storage:o.storage,editor:e,type:Hn(o.name,this.schema)},a=[],c=S(o,"addKeyboardShortcuts",l);let d={};if(o.type==="mark"&&S(o,"exitable",l)&&(d.ArrowRight=()=>Me.handleExit({editor:e,mark:o})),c){const m=Object.fromEntries(Object.entries(c()).map(([g,y])=>[g,()=>y({editor:e})]));d={...d,...m}}const u=Ec(d);a.push(u);const f=S(o,"addInputRules",l);Ii(o,e.options.enableInputRules)&&f&&n.push(...f());const p=S(o,"addPasteRules",l);Ii(o,e.options.enablePasteRules)&&p&&i.push(...p());const h=S(o,"addProseMirrorPlugins",l);if(h){const m=h();a.push(...m)}return a}).flat();return[ad({editor:e,rules:n}),...pd({editor:e,rules:i}),...s]}get attributes(){return uo(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Mn(this.extensions);return Object.fromEntries(t.filter(n=>!!S(n,"addNodeView")).map(n=>{const i=this.attributes.filter(a=>a.type===n.name),s={name:n.name,options:n.options,storage:n.storage,editor:e,type:J(n.name,this.schema)},o=S(n,"addNodeView",s);if(!o)return[];const l=(a,c,d,u)=>{const f=cr(a,i);return o()({editor:e,node:a,getPos:d,decorations:u,HTMLAttributes:f,extension:n})};return[n.name,l]}))}setupExtensions(){this.extensions.forEach(e=>{var t;this.editor.extensionStorage[e.name]=e.storage;const n={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Hn(e.name,this.schema)};e.type==="mark"&&(!((t=A(S(e,"keepOnSplit",n)))!==null&&t!==void 0)||t)&&this.splittableMarks.push(e.name);const i=S(e,"onBeforeCreate",n),s=S(e,"onCreate",n),o=S(e,"onUpdate",n),l=S(e,"onSelectionUpdate",n),a=S(e,"onTransaction",n),c=S(e,"onFocus",n),d=S(e,"onBlur",n),u=S(e,"onDestroy",n);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),u&&this.editor.on("destroy",u)})}}function gd(r){return Object.prototype.toString.call(r).slice(8,-1)}function Wt(r){return gd(r)!=="Object"?!1:r.constructor===Object&&Object.getPrototypeOf(r)===Object.prototype}function Cn(r,e){const t={...r};return Wt(r)&&Wt(e)&&Object.keys(e).forEach(n=>{Wt(e[n])&&Wt(r[n])?t[n]=Cn(r[n],e[n]):t[n]=e[n]}),t}class se{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=A(S(this,"addOptions",{name:this.name}))),this.storage=A(S(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new se(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Cn(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new se({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=A(S(t,"addOptions",{name:t.name})),t.storage=A(S(t,"addStorage",{name:t.name,options:t.options})),t}}function ho(r,e,t){const{from:n,to:i}=e,{blockSeparator:s=`
`,textSerializers:o={}}=t||{};let l="";return r.nodesBetween(n,i,(a,c,d,u)=>{var f;a.isBlock&&c>n&&(l+=s);const p=o==null?void 0:o[a.type.name];if(p)return d&&(l+=p({node:a,pos:c,parent:d,index:u,range:e})),!1;a.isText&&(l+=(f=a==null?void 0:a.text)===null||f===void 0?void 0:f.slice(Math.max(n,c)-c,i-c))}),l}function po(r){return Object.fromEntries(Object.entries(r.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}const yd=se.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new fe({key:new Ve("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:r}=this,{state:e,schema:t}=r,{doc:n,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(d=>d.$from.pos)),l=Math.max(...s.map(d=>d.$to.pos)),a=po(t);return ho(n,{from:o,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),bd=()=>({editor:r,view:e})=>(requestAnimationFrame(()=>{var t;r.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),kd=(r=!1)=>({commands:e})=>e.setContent("",r),xd=()=>({state:r,tr:e,dispatch:t})=>{const{selection:n}=e,{ranges:i}=n;return t&&i.forEach(({$from:s,$to:o})=>{r.doc.nodesBetween(s.pos,o.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:d}=e,u=c.resolve(d.map(a)),f=c.resolve(d.map(a+l.nodeSize)),p=u.blockRange(f);if(!p)return;const h=kt(p);if(l.type.isTextblock){const{defaultType:m}=u.parent.contentMatchAt(u.index());e.setNodeMarkup(p.start,m)}(h||h===0)&&e.lift(p,h)})}),!0},Sd=r=>e=>r(e),Md=()=>({state:r,dispatch:e})=>jc(r,e),wd=(r,e)=>({editor:t,tr:n})=>{const{state:i}=t,s=i.doc.slice(r.from,r.to);n.deleteRange(r.from,r.to);const o=n.mapping.map(e);return n.insert(o,s.content),n.setSelection(new C(n.doc.resolve(o-1))),!0},Cd=()=>({tr:r,dispatch:e})=>{const{selection:t}=r,n=t.$anchor.node();if(n.content.size>0)return!1;const i=r.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===n.type){if(e){const l=i.before(s),a=i.after(s);r.delete(l,a).scrollIntoView()}return!0}return!1},Td=r=>({tr:e,state:t,dispatch:n})=>{const i=J(r,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(n){const a=s.before(o),c=s.after(o);e.delete(a,c).scrollIntoView()}return!0}return!1},vd=r=>({tr:e,dispatch:t})=>{const{from:n,to:i}=r;return t&&e.delete(n,i),!0},Od=()=>({state:r,dispatch:e})=>Dc(r,e),Ad=()=>({commands:r})=>r.keyboardShortcut("Enter"),Nd=()=>({state:r,dispatch:e})=>Hc(r,e);function dn(r,e,t={strict:!0}){const n=Object.keys(e);return n.length?n.every(i=>t.strict?e[i]===r[i]:Or(e[i])?e[i].test(r[i]):e[i]===r[i]):!0}function dr(r,e,t={}){return r.find(n=>n.type===e&&dn(n.attrs,t))}function Ed(r,e,t={}){return!!dr(r,e,t)}function Ar(r,e,t={}){if(!r||!e)return;let n=r.parent.childAfter(r.parentOffset);if(r.parentOffset===n.offset&&n.offset!==0&&(n=r.parent.childBefore(r.parentOffset)),!n.node)return;const i=dr([...n.node.marks],e,t);if(!i)return;let s=n.index,o=r.start()+n.offset,l=s+1,a=o+n.node.nodeSize;for(dr([...n.node.marks],e,t);s>0&&i.isInSet(r.parent.child(s-1).marks);)s-=1,o-=r.parent.child(s).nodeSize;for(;l({tr:t,state:n,dispatch:i})=>{const s=_e(r,n.schema),{doc:o,selection:l}=t,{$from:a,from:c,to:d}=l;if(i){const u=Ar(a,s,e);if(u&&u.from<=c&&u.to>=d){const f=C.create(o,u.from,u.to);t.setSelection(f)}}return!0},Id=r=>e=>{const t=typeof r=="function"?r(e):r;for(let n=0;n({editor:t,view:n,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{Nr()&&n.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(n.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};if(n.hasFocus()&&r===null||r===!1)return!0;if(s&&r===null&&!mo(t.state.selection))return o(),!0;const l=go(i.doc,r)||t.state.selection,a=t.state.selection.eq(l);return s&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Pd=(r,e)=>t=>r.every((n,i)=>e(n,{...t,index:i})),Bd=(r,e)=>({tr:t,commands:n})=>n.insertContentAt({from:t.selection.from,to:t.selection.to},r,e),yo=r=>{const e=r.childNodes;for(let t=e.length-1;t>=0;t-=1){const n=e[t];n.nodeType===3&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?r.removeChild(n):n.nodeType===1&&yo(n)}return r};function Jt(r){const e=`${r}`,t=new window.DOMParser().parseFromString(e,"text/html").body;return yo(t)}function un(r,e,t){t={slice:!0,parseOptions:{},...t};const n=typeof r=="object"&&r!==null,i=typeof r=="string";if(n)try{return Array.isArray(r)&&r.length>0?b.fromArray(r.map(o=>e.nodeFromJSON(o))):e.nodeFromJSON(r)}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",r,"Error:",s),un("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,l="";const a=new ss({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?Re.fromSchema(a).parseSlice(Jt(r),t.parseOptions):Re.fromSchema(a).parse(Jt(r),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const s=Re.fromSchema(e);return t.slice?s.parseSlice(Jt(r),t.parseOptions).content:s.parse(Jt(r),t.parseOptions)}return un("",e,t)}function Ld(r,e,t){const n=r.steps.length-1;if(n{o===0&&(o=d)}),r.setSelection(T.near(r.doc.resolve(o),t))}const zd=r=>!("type"in r),Fd=(r,e,t)=>({tr:n,dispatch:i,editor:s})=>{var o;if(i){t={parseOptions:{},updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l;try{l=un(e,s.schema,{parseOptions:{preserveWhitespace:"full",...t.parseOptions},errorOnInvalidContent:(o=t.errorOnInvalidContent)!==null&&o!==void 0?o:s.options.enableContentCheck})}catch(h){return s.emit("contentError",{editor:s,error:h,disableCollaboration:()=>{console.error("[tiptap error]: Unable to disable collaboration at this point in time")}}),!1}let{from:a,to:c}=typeof r=="number"?{from:r,to:r}:{from:r.from,to:r.to},d=!0,u=!0;if((zd(l)?l:[l]).forEach(h=>{h.check(),d=d?h.isText&&h.marks.length===0:!1,u=u?h.isBlock:!1}),a===c&&u){const{parent:h}=n.doc.resolve(a);h.isTextblock&&!h.type.spec.code&&!h.childCount&&(a-=1,c+=1)}let p;d?(Array.isArray(e)?p=e.map(h=>h.text||"").join(""):typeof e=="object"&&e&&e.text?p=e.text:p=e,n.insertText(p,a,c)):(p=l,n.replaceWith(a,c,p)),t.updateSelection&&Ld(n,n.steps.length-1,-1),t.applyInputRules&&n.setMeta("applyInputRules",{from:a,text:p}),t.applyPasteRules&&n.setMeta("applyPasteRules",{from:a,text:p})}return!0},Vd=()=>({state:r,dispatch:e})=>Fc(r,e),$d=()=>({state:r,dispatch:e})=>Vc(r,e),_d=()=>({state:r,dispatch:e})=>Ic(r,e),Hd=()=>({state:r,dispatch:e})=>Lc(r,e),jd=()=>({state:r,dispatch:e,tr:t})=>{try{const n=pn(r.doc,r.selection.$from.pos,-1);return n==null?!1:(t.join(n,2),e&&e(t),!0)}catch{return!1}},Wd=()=>({state:r,dispatch:e,tr:t})=>{try{const n=pn(r.doc,r.selection.$from.pos,1);return n==null?!1:(t.join(n,2),e&&e(t),!0)}catch{return!1}},Jd=()=>({state:r,dispatch:e})=>Rc(r,e),qd=()=>({state:r,dispatch:e})=>Pc(r,e);function bo(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Kd(r){const e=r.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let n,i,s,o;for(let l=0;l({editor:e,view:t,tr:n,dispatch:i})=>{const s=Kd(r).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,l))});return a==null||a.steps.forEach(c=>{const d=c.map(n.mapping);d&&i&&n.maybeStep(d)}),!0};function Pt(r,e,t={}){const{from:n,to:i,empty:s}=r.selection,o=e?J(e,r.schema):null,l=[];r.doc.nodesBetween(n,i,(u,f)=>{if(u.isText)return;const p=Math.max(n,f),h=Math.min(i,f+u.nodeSize);l.push({node:u,from:p,to:h})});const a=i-n,c=l.filter(u=>o?o.name===u.node.type.name:!0).filter(u=>dn(u.node.attrs,t,{strict:!1}));return s?!!c.length:c.reduce((u,f)=>u+f.to-f.from,0)>=a}const Gd=(r,e={})=>({state:t,dispatch:n})=>{const i=J(r,t.schema);return Pt(t,i,e)?$c(t,n):!1},Yd=()=>({state:r,dispatch:e})=>Wc(r,e),Xd=r=>({state:e,dispatch:t})=>{const n=J(r,e.schema);return Zc(n)(e,t)},Zd=()=>({state:r,dispatch:e})=>_c(r,e);function Tn(r,e){return e.nodes[r]?"node":e.marks[r]?"mark":null}function Ri(r,e){const t=typeof e=="string"?[e]:e;return Object.keys(r).reduce((n,i)=>(t.includes(i)||(n[i]=r[i]),n),{})}const Qd=(r,e)=>({tr:t,state:n,dispatch:i})=>{let s=null,o=null;const l=Tn(typeof r=="string"?r:r.name,n.schema);return l?(l==="node"&&(s=J(r,n.schema)),l==="mark"&&(o=_e(r,n.schema)),i&&t.selection.ranges.forEach(a=>{n.doc.nodesBetween(a.$from.pos,a.$to.pos,(c,d)=>{s&&s===c.type&&t.setNodeMarkup(d,void 0,Ri(c.attrs,e)),o&&c.marks.length&&c.marks.forEach(u=>{o===u.type&&t.addMark(d,d+c.nodeSize,o.create(Ri(u.attrs,e)))})})}),!0):!1},eu=()=>({tr:r,dispatch:e})=>(e&&r.scrollIntoView(),!0),tu=()=>({tr:r,commands:e})=>e.setTextSelection({from:0,to:r.doc.content.size}),nu=()=>({state:r,dispatch:e})=>Bc(r,e),ru=()=>({state:r,dispatch:e})=>zc(r,e),iu=()=>({state:r,dispatch:e})=>Jc(r,e),su=()=>({state:r,dispatch:e})=>Uc(r,e),ou=()=>({state:r,dispatch:e})=>Kc(r,e);function ur(r,e,t={},n={}){return un(r,e,{slice:!1,parseOptions:t,errorOnInvalidContent:n.errorOnInvalidContent})}const lu=(r,e=!1,t={},n={})=>({editor:i,tr:s,dispatch:o,commands:l})=>{var a,c;const{doc:d}=s;if(t.preserveWhitespace!=="full"){const u=ur(r,i.schema,t,{errorOnInvalidContent:(a=n.errorOnInvalidContent)!==null&&a!==void 0?a:i.options.enableContentCheck});return o&&s.replaceWith(0,d.content.size,u).setMeta("preventUpdate",!e),!0}return o&&s.setMeta("preventUpdate",!e),l.insertContentAt({from:0,to:d.content.size},r,{parseOptions:t,errorOnInvalidContent:(c=n.errorOnInvalidContent)!==null&&c!==void 0?c:i.options.enableContentCheck})};function vn(r,e){const t=_e(e,r.schema),{from:n,to:i,empty:s}=r.selection,o=[];s?(r.storedMarks&&o.push(...r.storedMarks),o.push(...r.selection.$head.marks())):r.doc.nodesBetween(n,i,a=>{o.push(...a.marks)});const l=o.find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function au(r){for(let e=0;e0;t-=1){const n=r.node(t);if(e(n))return{pos:t>0?r.before(t):0,start:r.start(t),depth:t,node:n}}}function Er(r){return e=>cu(e.$from,r)}function du(r,e){const t=nt.fromSchema(e).serializeFragment(r),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}function uu(r,e){const t={from:0,to:r.content.size};return ho(r,t,e)}function fu(r,e){const t=J(e,r.schema),{from:n,to:i}=r.selection,s=[];r.doc.nodesBetween(n,i,l=>{s.push(l)});const o=s.reverse().find(l=>l.type.name===t.name);return o?{...o.attrs}:{}}function hu(r,e){const t=Tn(typeof e=="string"?e:e.name,r.schema);return t==="node"?fu(r,e):t==="mark"?vn(r,e):{}}function ko(r,e,t){const n=[];return r===e?t.resolve(r).marks().forEach(i=>{const s=t.resolve(r-1),o=Ar(s,i.type);o&&n.push({mark:i,...o})}):t.nodesBetween(r,e,(i,s)=>{!i||(i==null?void 0:i.nodeSize)===void 0||n.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),n}function Gt(r,e,t){return Object.fromEntries(Object.entries(t).filter(([n])=>{const i=r.find(s=>s.type===e&&s.name===n);return i?i.attribute.keepOnSplit:!1}))}function fr(r,e,t={}){const{empty:n,ranges:i}=r.selection,s=e?_e(e,r.schema):null;if(n)return!!(r.storedMarks||r.selection.$from.marks()).filter(u=>s?s.name===u.type.name:!0).find(u=>dn(u.attrs,t,{strict:!1}));let o=0;const l=[];if(i.forEach(({$from:u,$to:f})=>{const p=u.pos,h=f.pos;r.doc.nodesBetween(p,h,(m,g)=>{if(!m.isText&&!m.marks.length)return;const y=Math.max(p,g),x=Math.min(h,g+m.nodeSize),v=x-y;o+=v,l.push(...m.marks.map(P=>({mark:P,from:y,to:x})))})}),o===0)return!1;const a=l.filter(u=>s?s.name===u.mark.type.name:!0).filter(u=>dn(u.mark.attrs,t,{strict:!1})).reduce((u,f)=>u+f.to-f.from,0),c=l.filter(u=>s?u.mark.type!==s&&u.mark.type.excludes(s):!0).reduce((u,f)=>u+f.to-f.from,0);return(a>0?a+c:a)>=o}function pu(r,e,t={}){if(!e)return Pt(r,null,t)||fr(r,null,t);const n=Tn(e,r.schema);return n==="node"?Pt(r,e,t):n==="mark"?fr(r,e,t):!1}function Pi(r,e){const{nodeExtensions:t}=Mn(e),n=t.find(o=>o.name===r);if(!n)return!1;const i={name:n.name,options:n.options,storage:n.storage},s=A(S(n,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function xo(r,{checkChildren:e}={checkChildren:!0}){if(r.isText)return!r.text;if(r.content.childCount===0)return!0;if(r.isLeaf)return!1;if(e){let t=!0;return r.content.forEach(n=>{t!==!1&&(xo(n)||(t=!1))}),t}return!1}function mu(r){return r instanceof M}function gu(r,e,t){var n;const{selection:i}=e;let s=null;if(mo(i)&&(s=i.$cursor),s){const l=(n=r.storedMarks)!==null&&n!==void 0?n:s.marks();return!!t.isInSet(l)||!l.some(a=>a.type.excludes(t))}const{ranges:o}=i;return o.some(({$from:l,$to:a})=>{let c=l.depth===0?r.doc.inlineContent&&r.doc.type.allowsMarkType(t):!1;return r.doc.nodesBetween(l.pos,a.pos,(d,u,f)=>{if(c)return!1;if(d.isInline){const p=!f||f.type.allowsMarkType(t),h=!!t.isInSet(d.marks)||!d.marks.some(m=>m.type.excludes(t));c=p&&h}return!c}),c})}const yu=(r,e={})=>({tr:t,state:n,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:l}=s,a=_e(r,n.schema);if(i)if(o){const c=vn(n,a);t.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;n.doc.nodesBetween(d,u,(f,p)=>{const h=Math.max(p,d),m=Math.min(p+f.nodeSize,u);f.marks.find(y=>y.type===a)?f.marks.forEach(y=>{a===y.type&&t.addMark(h,m,a.create({...y.attrs,...e}))}):t.addMark(h,m,a.create(e))})});return gu(n,t,a)},bu=(r,e)=>({tr:t})=>(t.setMeta(r,e),!0),ku=(r,e={})=>({state:t,dispatch:n,chain:i})=>{const s=J(r,t.schema);return s.isTextblock?i().command(({commands:o})=>Ni(s,e)(t)?!0:o.clearNodes()).command(({state:o})=>Ni(s,e)(o,n)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},xu=r=>({tr:e,dispatch:t})=>{if(t){const{doc:n}=e,i=qe(r,0,n.content.size),s=M.create(n,i);e.setSelection(s)}return!0},Su=r=>({tr:e,dispatch:t})=>{if(t){const{doc:n}=e,{from:i,to:s}=typeof r=="number"?{from:r,to:r}:r,o=C.atStart(n).from,l=C.atEnd(n).to,a=qe(i,o,l),c=qe(s,o,l),d=C.create(n,a,c);e.setSelection(d)}return!0},Mu=r=>({state:e,dispatch:t})=>{const n=J(r,e.schema);return td(n)(e,t)};function Bi(r,e){const t=r.storedMarks||r.selection.$to.parentOffset&&r.selection.$from.marks();if(t){const n=t.filter(i=>e==null?void 0:e.includes(i.type.name));r.tr.ensureMarks(n)}}const wu=({keepMarks:r=!0}={})=>({tr:e,state:t,dispatch:n,editor:i})=>{const{selection:s,doc:o}=e,{$from:l,$to:a}=s,c=i.extensionManager.attributes,d=Gt(c,l.node().type.name,l.node().attrs);if(s instanceof M&&s.node.isBlock)return!l.parentOffset||!dt(o,l.pos)?!1:(n&&(r&&Bi(t,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const u=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:au(l.node(-1).contentMatchAt(l.indexAfter(-1)));let p=u&&f?[{type:f,attrs:d}]:void 0,h=dt(e.doc,e.mapping.map(l.pos),1,p);if(!p&&!h&&dt(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(h=!0,p=f?[{type:f,attrs:d}]:void 0),n){if(h&&(s instanceof C&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,p),f&&!u&&!l.parentOffset&&l.parent.type!==f)){const m=e.mapping.map(l.before()),g=e.doc.resolve(m);l.node(-1).canReplaceWith(g.index(),g.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}r&&Bi(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return h},Cu=r=>({tr:e,state:t,dispatch:n,editor:i})=>{var s;const o=J(r,t.schema),{$from:l,$to:a}=t.selection,c=t.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(a))return!1;const d=l.node(-1);if(d.type!==o)return!1;const u=i.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==o||l.index(-2)!==l.node(-2).childCount-1)return!1;if(n){let g=b.empty;const y=l.index(-1)?1:l.index(-2)?2:3;for(let _=l.depth-y;_>=l.depth-3;_-=1)g=b.from(l.node(_).copy(g));const x=l.indexAfter(-1){if(D>-1)return!1;_.isTextblock&&_.content.size===0&&(D=ae+1)}),D>-1&&e.setSelection(C.near(e.doc.resolve(D))),e.scrollIntoView()}return!0}const f=a.pos===l.end()?d.contentMatchAt(0).defaultType:null,p=Gt(u,d.type.name,d.attrs),h=Gt(u,l.node().type.name,l.node().attrs);e.delete(l.pos,a.pos);const m=f?[{type:o,attrs:p},{type:f,attrs:h}]:[{type:o,attrs:p}];if(!dt(e.doc,l.pos,2))return!1;if(n){const{selection:g,storedMarks:y}=t,{splittableMarks:x}=i.extensionManager,v=y||g.$to.parentOffset&&g.$from.marks();if(e.split(l.pos,2,m).scrollIntoView(),!v||!n)return!0;const P=v.filter(B=>x.includes(B.type.name));e.ensureMarks(P)}return!0},jn=(r,e)=>{const t=Er(o=>o.type===e)(r.selection);if(!t)return!0;const n=r.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(n===void 0)return!0;const i=r.doc.nodeAt(n);return t.node.type===(i==null?void 0:i.type)&&Fe(r.doc,t.pos)&&r.join(t.pos),!0},Wn=(r,e)=>{const t=Er(o=>o.type===e)(r.selection);if(!t)return!0;const n=r.doc.resolve(t.start).after(t.depth);if(n===void 0)return!0;const i=r.doc.nodeAt(n);return t.node.type===(i==null?void 0:i.type)&&Fe(r.doc,n)&&r.join(n),!0},Tu=(r,e,t,n={})=>({editor:i,tr:s,state:o,dispatch:l,chain:a,commands:c,can:d})=>{const{extensions:u,splittableMarks:f}=i.extensionManager,p=J(r,o.schema),h=J(e,o.schema),{selection:m,storedMarks:g}=o,{$from:y,$to:x}=m,v=y.blockRange(x),P=g||m.$to.parentOffset&&m.$from.marks();if(!v)return!1;const B=Er(D=>Pi(D.type.name,u))(m);if(v.depth>=1&&B&&v.depth-B.depth<=1){if(B.node.type===p)return c.liftListItem(h);if(Pi(B.node.type.name,u)&&p.validContent(B.node.content)&&l)return a().command(()=>(s.setNodeMarkup(B.pos,p),!0)).command(()=>jn(s,p)).command(()=>Wn(s,p)).run()}return!t||!P||!l?a().command(()=>d().wrapInList(p,n)?!0:c.clearNodes()).wrapInList(p,n).command(()=>jn(s,p)).command(()=>Wn(s,p)).run():a().command(()=>{const D=d().wrapInList(p,n),_=P.filter(ae=>f.includes(ae.type.name));return s.ensureMarks(_),D?!0:c.clearNodes()}).wrapInList(p,n).command(()=>jn(s,p)).command(()=>Wn(s,p)).run()},vu=(r,e={},t={})=>({state:n,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=_e(r,n.schema);return fr(n,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},Ou=(r,e,t={})=>({state:n,commands:i})=>{const s=J(r,n.schema),o=J(e,n.schema);return Pt(n,s,t)?i.setNode(o):i.setNode(s,t)},Au=(r,e={})=>({state:t,commands:n})=>{const i=J(r,t.schema);return Pt(t,i,e)?n.lift(i):n.wrapIn(i,e)},Nu=()=>({state:r,dispatch:e})=>{const t=r.plugins;for(let n=0;n=0;a-=1)o.step(l.steps[a].invert(l.docs[a]));if(s.text){const a=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,r.schema.text(s.text,a))}else o.delete(s.from,s.to)}return!0}}return!1},Eu=()=>({tr:r,dispatch:e})=>{const{selection:t}=r,{empty:n,ranges:i}=t;return n||e&&i.forEach(s=>{r.removeMark(s.$from.pos,s.$to.pos)}),!0},Du=(r,e={})=>({tr:t,state:n,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:l}=t,a=_e(r,n.schema),{$from:c,empty:d,ranges:u}=l;if(!i)return!0;if(d&&o){let{from:f,to:p}=l;const h=(s=c.marks().find(g=>g.type===a))===null||s===void 0?void 0:s.attrs,m=Ar(c,a,h);m&&(f=m.from,p=m.to),t.removeMark(f,p,a)}else u.forEach(f=>{t.removeMark(f.$from.pos,f.$to.pos,a)});return t.removeStoredMark(a),!0},Iu=(r,e={})=>({tr:t,state:n,dispatch:i})=>{let s=null,o=null;const l=Tn(typeof r=="string"?r:r.name,n.schema);return l?(l==="node"&&(s=J(r,n.schema)),l==="mark"&&(o=_e(r,n.schema)),i&&t.selection.ranges.forEach(a=>{const c=a.$from.pos,d=a.$to.pos;n.doc.nodesBetween(c,d,(u,f)=>{s&&s===u.type&&t.setNodeMarkup(f,void 0,{...u.attrs,...e}),o&&u.marks.length&&u.marks.forEach(p=>{if(o===p.type){const h=Math.max(f,c),m=Math.min(f+u.nodeSize,d);t.addMark(h,m,o.create({...p.attrs,...e}))}})})}),!0):!1},Ru=(r,e={})=>({state:t,dispatch:n})=>{const i=J(r,t.schema);return Gc(i,e)(t,n)},Pu=(r,e={})=>({state:t,dispatch:n})=>{const i=J(r,t.schema);return Yc(i,e)(t,n)};var Bu=Object.freeze({__proto__:null,blur:bd,clearContent:kd,clearNodes:xd,command:Sd,createParagraphNear:Md,cut:wd,deleteCurrentNode:Cd,deleteNode:Td,deleteRange:vd,deleteSelection:Od,enter:Ad,exitCode:Nd,extendMarkRange:Dd,first:Id,focus:Rd,forEach:Pd,insertContent:Bd,insertContentAt:Fd,joinBackward:_d,joinDown:$d,joinForward:Hd,joinItemBackward:jd,joinItemForward:Wd,joinTextblockBackward:Jd,joinTextblockForward:qd,joinUp:Vd,keyboardShortcut:Ud,lift:Gd,liftEmptyBlock:Yd,liftListItem:Xd,newlineInCode:Zd,resetAttributes:Qd,scrollIntoView:eu,selectAll:tu,selectNodeBackward:nu,selectNodeForward:ru,selectParentNode:iu,selectTextblockEnd:su,selectTextblockStart:ou,setContent:lu,setMark:yu,setMeta:bu,setNode:ku,setNodeSelection:xu,setTextSelection:Su,sinkListItem:Mu,splitBlock:wu,splitListItem:Cu,toggleList:Tu,toggleMark:vu,toggleNode:Ou,toggleWrap:Au,undoInputRule:Nu,unsetAllMarks:Eu,unsetMark:Du,updateAttributes:Iu,wrapIn:Ru,wrapInList:Pu});const Lu=se.create({name:"commands",addCommands(){return{...Bu}}}),zu=se.create({name:"editable",addProseMirrorPlugins(){return[new fe({key:new Ve("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Fu=se.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:r}=this;return[new fe({key:new Ve("focusEvents"),props:{handleDOMEvents:{focus:(e,t)=>{r.isFocused=!0;const n=r.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(n),!1},blur:(e,t)=>{r.isFocused=!1;const n=r.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(n),!1}}}})]}}),Vu=se.create({name:"keymap",addKeyboardShortcuts(){const r=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:d,$anchor:u}=a,{pos:f,parent:p}=u,h=u.parent.isTextblock&&f>0?l.doc.resolve(f-1):u,m=h.parent.type.spec.isolating,g=u.pos-u.parentOffset,y=m&&h.parent.childCount===1?g===u.pos:T.atStart(c).from===f;return!d||!p.type.isTextblock||p.textContent.length||!y||y&&u.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:r,"Mod-Backspace":r,"Shift-Backspace":r,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...n},s={...n,"Ctrl-h":r,"Alt-Backspace":r,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Nr()||bo()?s:i},addProseMirrorPlugins(){return[new fe({key:new Ve("clearDocument"),appendTransaction:(r,e,t)=>{if(!(r.some(h=>h.docChanged)&&!e.doc.eq(t.doc)))return;const{empty:i,from:s,to:o}=e.selection,l=T.atStart(e.doc).from,a=T.atEnd(e.doc).to;if(i||!(s===l&&o===a)||!(t.doc.textBetween(0,t.doc.content.size," "," ").length===0))return;const u=t.tr,f=xn({state:t,transaction:u}),{commands:p}=new Sn({editor:this.editor,state:f});if(p.clearNodes(),!!u.steps.length)return u}})]}}),$u=se.create({name:"tabindex",addProseMirrorPlugins(){return[new fe({key:new Ve("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class je{get name(){return this.node.type.name}constructor(e,t,n=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new je(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new je(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new je(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,n)=>{const i=t.isBlock&&!t.isTextblock,s=this.pos+n+1,o=this.resolvedPos.doc.resolve(s);if(!i&&o.depth<=this.depth)return;const l=new je(o,this.editor,i,i?t:null);i&&(l.actualDepth=this.depth+1),e.push(new je(o,this.editor,i,i?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,i=this.parent;for(;i&&!n;){if(i.node.type.name===e)if(Object.keys(t).length>0){const s=i.node.attrs,o=Object.keys(t);for(let l=0;l{n&&i.length>0||(o.node.type.name===e&&s.every(a=>t[a]===o.node.attrs[a])&&i.push(o),!(n&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,t,n))))}),i}setAttribute(e){const t=this.editor.state.selection;this.editor.chain().setTextSelection(this.from).updateAttributes(this.node.type.name,e).setTextSelection(t.from).run()}}const _u=`.ProseMirror {
position: relative;
}
.ProseMirror {
word-wrap: break-word;
white-space: pre-wrap;
white-space: break-spaces;
-webkit-font-variant-ligatures: none;
font-variant-ligatures: none;
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
}
.ProseMirror [contenteditable="false"] {
white-space: normal;
}
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
white-space: pre-wrap;
}
.ProseMirror pre {
white-space: pre-wrap;
}
img.ProseMirror-separator {
display: inline !important;
border: none !important;
margin: 0 !important;
width: 1px !important;
height: 1px !important;
}
.ProseMirror-gapcursor {
display: none;
pointer-events: none;
position: absolute;
margin: 0;
}
.ProseMirror-gapcursor:after {
content: "";
display: block;
position: absolute;
top: -2px;
width: 20px;
border-top: 1px solid black;
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
}
@keyframes ProseMirror-cursor-blink {
to {
visibility: hidden;
}
}
.ProseMirror-hideselection *::selection {
background: transparent;
}
.ProseMirror-hideselection *::-moz-selection {
background: transparent;
}
.ProseMirror-hideselection * {
caret-color: transparent;
}
.ProseMirror-focused .ProseMirror-gapcursor {
display: block;
}
.tippy-box[data-animation=fade][data-state=hidden] {
opacity: 0
}`;function Hu(r,e,t){const n=document.querySelector("style[data-tiptap-style]");if(n!==null)return n;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=r,document.getElementsByTagName("head")[0].appendChild(i),i}let ju=class extends nd{constructor(e={}){super(),this.isFocused=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:t})=>{throw t}},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}))},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=Hu(_u,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,t){const n=fo(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:n});this.view.updateState(i)}unregisterPlugin(e){if(this.isDestroyed)return;const t=typeof e=="string"?`${e}$`:e.key,n=this.state.reconfigure({plugins:this.state.plugins.filter(i=>!i.key.startsWith(t))});this.view.updateState(n)}createExtensionManager(){var e,t;const i=[...this.options.enableCoreExtensions?[zu,yd.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),Lu,Fu,Vu,$u]:[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new at(i,this)}createCommandManager(){this.commandManager=new Sn({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){let e;try{e=ur(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(s){if(!(s instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(s.message))throw s;this.emit("contentError",{editor:this,error:s,disableCollaboration:()=>{this.options.extensions=this.options.extensions.filter(o=>o.name!=="collaboration"),this.createExtensionManager()}}),e=ur(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const t=go(e,this.options.autofocus);this.view=new Sc(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:lt.create({doc:e,selection:t||void 0})});const n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.createNodeViews(),this.prependClass();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(o=>{var l;return(l=this.capturedTransaction)===null||l===void 0?void 0:l.step(o)});return}const t=this.state.apply(e),n=!this.state.selection.eq(t.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),n&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),s=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),s&&this.emit("blur",{editor:this,event:s.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return hu(this.state,e)}isActive(e,t){const n=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return pu(this.state,n,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return du(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
`,textSerializers:n={}}=e||{};return uu(this.state.doc,{blockSeparator:t,textSerializers:{...po(this.schema),...n}})}get isEmpty(){return xo(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,t){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new je(t,this)}get $doc(){return this.$pos(0)}};function yt(r){return new wn({find:r.find,handler:({state:e,range:t,match:n})=>{const i=A(r.getAttributes,void 0,n);if(i===!1||i===null)return null;const{tr:s}=e,o=n[n.length-1],l=n[0];if(o){const a=l.search(/\S/),c=t.from+l.indexOf(o),d=c+o.length;if(ko(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(m=>m===r.type&&m!==p.mark.type)).filter(p=>p.to>c).length)return null;dt.from&&s.delete(t.from+a,c);const f=t.from+a+o.length;s.addMark(t.from+a,f,r.type.create(i||{})),s.removeStoredMark(r.type)}}})}function Wu(r){return new wn({find:r.find,handler:({state:e,range:t,match:n})=>{const i=A(r.getAttributes,void 0,n)||{},{tr:s}=e,o=t.from;let l=t.to;const a=r.type.create(i);if(n[1]){const c=n[0].lastIndexOf(n[1]);let d=o+c;d>l?d=l:l=d+n[1].length;const u=n[0][n[0].length-1];s.insertText(u,o+n[0].length-1),s.replaceWith(d,l,a)}else if(n[0]){const c=r.type.isInline?o:o-1;s.insert(c,r.type.create(i)).delete(s.mapping.map(o),s.mapping.map(l))}s.scrollIntoView()}})}function hr(r){return new wn({find:r.find,handler:({state:e,range:t,match:n})=>{const i=e.doc.resolve(t.from),s=A(r.getAttributes,void 0,n)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),r.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,r.type,s)}})}function Bt(r){return new wn({find:r.find,handler:({state:e,range:t,match:n,chain:i})=>{const s=A(r.getAttributes,void 0,n)||{},o=e.tr.delete(t.from,t.to),a=o.doc.resolve(t.from).blockRange(),c=a&&mr(a,r.type,s);if(!c)return null;if(o.wrap(a,c),r.keepMarks&&r.editor){const{selection:u,storedMarks:f}=e,{splittableMarks:p}=r.editor.extensionManager,h=f||u.$to.parentOffset&&u.$from.marks();if(h){const m=h.filter(g=>p.includes(g.type.name));o.ensureMarks(m)}}if(r.keepAttributes){const u=r.type.name==="bulletList"||r.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(u,s).run()}const d=o.doc.resolve(t.from-1).nodeBefore;d&&d.type===r.type&&Fe(o.doc,t.from-1)&&(!r.joinPredicate||r.joinPredicate(n,d))&&o.join(t.from-1)}})}class Me{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=A(S(this,"addOptions",{name:this.name}))),this.storage=A(S(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Me(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Cn(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new Me(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=A(S(t,"addOptions",{name:t.name})),t.storage=A(S(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:n}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(c=>(c==null?void 0:c.type.name)===t.name))return!1;const a=o.find(c=>(c==null?void 0:c.type.name)===t.name);return a&&n.removeStoredMark(a),n.insertText(" ",i.pos),e.view.dispatch(n),!0}return!1}}class X{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=A(S(this,"addOptions",{name:this.name}))),this.storage=A(S(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new X(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Cn(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new X(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=A(S(t,"addOptions",{name:t.name})),t.storage=A(S(t,"addStorage",{name:t.name,options:t.options})),t}}function bt(r){return new dd({find:r.find,handler:({state:e,range:t,match:n,pasteEvent:i})=>{const s=A(r.getAttributes,void 0,n,i);if(s===!1||s===null)return null;const{tr:o}=e,l=n[n.length-1],a=n[0];let c=t.to;if(l){const d=a.search(/\S/),u=t.from+a.indexOf(l),f=u+l.length;if(ko(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===r.type&&g!==h.mark.type)).filter(h=>h.to>u).length)return null;ft.from&&o.delete(t.from+d,u),c=t.from+d+l.length,o.addMark(t.from+d,c,r.type.create(s||{})),o.removeStoredMark(r.type)}}})}function Li(r){return Lo((e,t)=>({get(){return e(),r},set(n){r=n,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}class Ju extends ju{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=Li(this.view.state),this.reactiveExtensionStorage=Li(this.extensionStorage),this.on("beforeTransaction",({nextState:t})=>{this.reactiveState.value=t,this.reactiveExtensionStorage.value=this.extensionStorage}),Bo(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,t){super.registerPlugin(e,t),this.reactiveState.value=this.view.state}unregisterPlugin(e){super.unregisterPlugin(e),this.reactiveState.value=this.view.state}}const qu=vo({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(r){const e=Oo(),t=Ao();return No(()=>{const n=r.editor;n&&n.options.element&&e.value&&Eo(()=>{if(!e.value||!n.options.element.firstChild)return;const i=Do(e.value);e.value.append(...n.options.element.childNodes),n.contentComponent=t.ctx._,t&&(n.appContext={...t.appContext,provides:t.provides}),n.setOptions({element:i}),n.createNodeViews()})}),ji(()=>{const n=r.editor;if(!n||(n.isDestroyed||n.view.setProps({nodeViews:{}}),n.contentComponent=null,n.appContext=null,!n.options.element.firstChild))return;const i=document.createElement("div");i.append(...n.options.element.childNodes),n.setOptions({element:i})}),{rootEl:e}},render(){return Io("div",{ref:r=>{this.rootEl=r}})}}),Ku=(r={})=>{const e=Ro();return Po(()=>{e.value=new Ju(r)}),ji(()=>{var t;(t=e.value)===null||t===void 0||t.destroy()}),e},Uu=/^\s*>\s$/,Gu=X.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:r}){return["blockquote",$(this.options.HTMLAttributes,r),0]},addCommands(){return{setBlockquote:()=>({commands:r})=>r.wrapIn(this.name),toggleBlockquote:()=>({commands:r})=>r.toggleWrap(this.name),unsetBlockquote:()=>({commands:r})=>r.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Bt({find:Uu,type:this.type})]}}),Yu=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Xu=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Zu=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Qu=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,ef=Me.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:r=>r.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:r=>/^(bold(er)?|[5-9]\d{2,})$/.test(r)&&null}]},renderHTML({HTMLAttributes:r}){return["strong",$(this.options.HTMLAttributes,r),0]},addCommands(){return{setBold:()=>({commands:r})=>r.setMark(this.name),toggleBold:()=>({commands:r})=>r.toggleMark(this.name),unsetBold:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[yt({find:Yu,type:this.type}),yt({find:Zu,type:this.type})]},addPasteRules(){return[bt({find:Xu,type:this.type}),bt({find:Qu,type:this.type})]}}),tf=X.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:r}){return["li",$(this.options.HTMLAttributes,r),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),zi=Me.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:r=>r.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:r}){return["span",$(this.options.HTMLAttributes,r),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:r,commands:e})=>{const t=vn(r,this.type);return Object.entries(t).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),Fi=/^\s*([-+*])\s$/,nf=X.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:r}){return["ul",$(this.options.HTMLAttributes,r),0]},addCommands(){return{toggleBulletList:()=>({commands:r,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(tf.name,this.editor.getAttributes(zi.name)).run():r.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let r=Bt({find:Fi,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(r=Bt({find:Fi,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(zi.name),editor:this.editor})),[r]}}),rf=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/,sf=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g,of=Me.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:r}){return["code",$(this.options.HTMLAttributes,r),0]},addCommands(){return{setCode:()=>({commands:r})=>r.setMark(this.name),toggleCode:()=>({commands:r})=>r.toggleMark(this.name),unsetCode:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[yt({find:rf,type:this.type})]},addPasteRules(){return[bt({find:sf,type:this.type})]}}),lf=/^```([a-z]+)?[\s\n]$/,af=/^~~~([a-z]+)?[\s\n]$/,cf=X.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:r=>{var e;const{languageClassPrefix:t}=this.options,s=[...((e=r.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(t)).map(o=>o.replace(t,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:r,HTMLAttributes:e}){return["pre",$(this.options.HTMLAttributes,e),["code",{class:r.attrs.language?this.options.languageClassPrefix+r.attrs.language:null},0]]},addCommands(){return{setCodeBlock:r=>({commands:e})=>e.setNode(this.name,r),toggleCodeBlock:r=>({commands:e})=>e.toggleNode(this.name,"paragraph",r)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:r,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!r||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:r})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=r,{selection:t}=e,{$from:n,empty:i}=t;if(!i||n.parent.type!==this.type)return!1;const s=n.parentOffset===n.parent.nodeSize-2,o=n.parent.textContent.endsWith(`
`);return!s||!o?!1:r.chain().command(({tr:l})=>(l.delete(n.pos-2,n.pos),!0)).exitCode().run()},ArrowDown:({editor:r})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=r,{selection:t,doc:n}=e,{$from:i,empty:s}=t;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const l=i.after();return l===void 0?!1:n.nodeAt(l)?r.commands.command(({tr:c})=>(c.setSelection(T.near(n.resolve(l))),!0)):r.commands.exitCode()}}},addInputRules(){return[hr({find:lf,type:this.type,getAttributes:r=>({language:r[1]})}),hr({find:af,type:this.type,getAttributes:r=>({language:r[1]})})]},addProseMirrorPlugins(){return[new fe({key:new Ve("codeBlockVSCodeHandler"),props:{handlePaste:(r,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),n=e.clipboardData.getData("vscode-editor-data"),i=n?JSON.parse(n):void 0,s=i==null?void 0:i.mode;if(!t||!s)return!1;const{tr:o,schema:l}=r.state,a=l.text(t.replace(/\r\n?/g,`
`));return o.replaceSelectionWith(this.type.create({language:s},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(C.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),r.dispatch(o),!0}}})]}}),df=X.create({name:"doc",topNode:!0,content:"block+"});function uf(r={}){return new fe({view(e){return new ff(e,r)}})}class ff{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=t.width)!==null&&n!==void 0?n:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n;if(t){let l=e.nodeBefore,a=e.nodeAfter;if(l||a){let c=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(c){let d=c.getBoundingClientRect(),u=l?d.bottom:d.top;l&&a&&(u=(u+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),n={left:d.left,right:d.right,top:u-this.width/2,bottom:u+this.width/2}}}}if(!n){let l=this.editorView.coordsAtPos(this.cursorPos);n={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let i=this.editorView.dom.offsetParent;this.element||(this.element=i.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let s,o;if(!i||i==document.body&&getComputedStyle(i).position=="static")s=-pageXOffset,o=-pageYOffset;else{let l=i.getBoundingClientRect();s=l.left-i.scrollLeft,o=l.top-i.scrollTop}this.element.style.left=n.left-s+"px",this.element.style.top=n.top-o+"px",this.element.style.width=n.right-n.left+"px",this.element.style.height=n.bottom-n.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=n&&n.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=gs(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const hf=se.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[uf(this.options)]}});class L extends T{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return L.valid(n)?new L(n):T.near(n)}content(){return k.empty}eq(e){return e instanceof L&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new L(e.resolve(t.pos))}getBookmark(){return new Dr(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!pf(e)||!mf(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&L.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)0){s=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let a=e.doc.resolve(i);if(L.valid(a))return a}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!M.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),n=!1;continue e}break}s=o,i+=t;let l=e.doc.resolve(i);if(L.valid(l))return l}return null}}}L.prototype.visible=!1;L.findFrom=L.findGapCursorFrom;T.jsonID("gapcursor",L);class Dr{constructor(e){this.pos=e}map(e){return new Dr(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return L.valid(t)?new L(t):T.near(t)}}function pf(r){for(let e=r.depth;e>=0;e--){let t=r.index(e),n=r.node(e);if(t==0){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function mf(r){for(let e=r.depth;e>=0;e--){let t=r.indexAfter(e),n=r.node(e);if(t==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let i=n.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function gf(){return new fe({props:{decorations:xf,createSelectionBetween(r,e,t){return e.pos==t.pos&&L.valid(t)?new L(t):null},handleClick:bf,handleKeyDown:yf,handleDOMEvents:{beforeinput:kf}}})}const yf=ro({ArrowLeft:qt("horiz",-1),ArrowRight:qt("horiz",1),ArrowUp:qt("vert",-1),ArrowDown:qt("vert",1)});function qt(r,e){const t=r=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,i,s){let o=n.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof C){if(!s.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=n.doc.resolve(e>0?l.after():l.before())}let c=L.findGapCursorFrom(l,e,a);return c?(i&&i(n.tr.setSelection(new L(c))),!0):!1}}function bf(r,e,t){if(!r||!r.editable)return!1;let n=r.state.doc.resolve(e);if(!L.valid(n))return!1;let i=r.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&M.isSelectable(r.state.doc.nodeAt(i.inside))?!1:(r.dispatch(r.state.tr.setSelection(new L(n))),!0)}function kf(r,e){if(e.inputType!="insertCompositionText"||!(r.state.selection instanceof L))return!1;let{$from:t}=r.state.selection,n=t.parent.contentMatchAt(t.index()).findWrapping(r.state.schema.nodes.text);if(!n)return!1;let i=b.empty;for(let o=n.length-1;o>=0;o--)i=b.from(n[o].createAndFill(null,i));let s=r.state.tr.replace(t.pos,t.pos,new k(i,0,0));return s.setSelection(C.near(s.doc.resolve(t.pos+1))),r.dispatch(s),!1}function xf(r){if(!(r.selection instanceof L))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",V.create(r.doc,[de.widget(r.selection.head,e,{key:"gapcursor"})])}const Sf=se.create({name:"gapCursor",addProseMirrorPlugins(){return[gf()]},extendNodeSchema(r){var e;const t={name:r.name,options:r.options,storage:r.storage};return{allowGapCursor:(e=A(S(r,"allowGapCursor",t)))!==null&&e!==void 0?e:null}}}),Mf=X.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:r}){return["br",$(this.options.HTMLAttributes,r)]},renderText(){return`
`},addCommands(){return{setHardBreak:()=>({commands:r,chain:e,state:t,editor:n})=>r.first([()=>r.exitCode(),()=>r.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=n.extensionManager,a=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&a&&o){const u=a.filter(f=>l.includes(f.type.name));c.ensureMarks(u)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),wf=X.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(r=>({tag:`h${r}`,attrs:{level:r}}))},renderHTML({node:r,HTMLAttributes:e}){return[`h${this.options.levels.includes(r.attrs.level)?r.attrs.level:this.options.levels[0]}`,$(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:r=>({commands:e})=>this.options.levels.includes(r.level)?e.setNode(this.name,r):!1,toggleHeading:r=>({commands:e})=>this.options.levels.includes(r.level)?e.toggleNode(this.name,"paragraph",r):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((r,e)=>({...r,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(r=>hr({find:new RegExp(`^(#{1,${r}})\\s$`),type:this.type,getAttributes:{level:r}}))}});var fn=200,W=function(){};W.prototype.append=function(e){return e.length?(e=W.from(e),!this.length&&e||e.length=t?W.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};W.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};W.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)};W.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,n),i};W.from=function(e){return e instanceof W?e:e&&e.length?new So(e):W.empty};var So=function(r){function e(n){r.call(this),this.values=n}r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var a=s;a=o;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=fn)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=fn)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(W);W.empty=new So([]);var Cf=function(r){function e(t,n){r.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return r&&(e.__proto__=r),e.prototype=Object.create(r&&r.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return nl&&this.right.forEachInner(n,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(n,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(n,i-l,Math.max(s,l)-l,o+l)===!1||s=s?this.right.slice(n-s,i-s):this.left.slice(n,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(n){var i=this.right.leafAppend(n);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(n){var i=this.left.leafPrepend(n);if(i)return new e(i,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}(W);const Tf=500;class pe{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let i,s;t&&(i=this.remapping(n,this.items.length),s=i.maps.length);let o=e.tr,l,a,c=[],d=[];return this.items.forEach((u,f)=>{if(!u.step){i||(i=this.remapping(n,f+1),s=i.maps.length),s--,d.push(u);return}if(i){d.push(new ye(u.map));let p=u.step.map(i.slice(s)),h;p&&o.maybeStep(p).doc&&(h=o.mapping.maps[o.mapping.maps.length-1],c.push(new ye(h,void 0,void 0,c.length+d.length))),s--,h&&i.appendMap(h,s)}else o.maybeStep(u.step);if(u.selection)return l=i?u.selection.map(i.slice(s)):u.selection,a=new pe(this.items.slice(0,n).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,n,i){let s=[],o=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let d=0;dOf&&(l=vf(l,c),o-=c),new pe(l.append(s),o)}remapping(e,t){let n=new ct;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?n.maps.length-i.mirrorOffset:void 0;n.appendMap(i.map,o)},e,t),n}addMaps(e){return this.eventCount==0?this:new pe(this.items.append(e.map(t=>new ye(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},i);let a=t;this.items.forEach(f=>{let p=s.getMirror(--a);if(p==null)return;o=Math.min(o,p);let h=s.maps[p];if(f.step){let m=e.steps[p].invert(e.docs[p]),g=f.selection&&f.selection.map(s.slice(a+1,p));g&&l++,n.push(new ye(h,m,g))}else n.push(new ye(h))},i);let c=[];for(let f=t;fTf&&(u=u.compress(this.items.length-n.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,i=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(t.slice(n)),c=a&&a.getMap();if(n--,c&&t.appendMap(c,n),a){let d=o.selection&&o.selection.map(t.slice(n));d&&s++;let u=new ye(c.invert(),a,d),f,p=i.length-1;(f=i.length&&i[p].merge(u))?i[p]=f:i.push(u)}}else o.map&&n--},this.items.length,0),new pe(W.from(i.reverse()),s)}}pe.empty=new pe(W.empty,0);function vf(r,e){let t;return r.forEach((n,i)=>{if(n.selection&&e--==0)return t=i,!1}),r.slice(t)}class ye{constructor(e,t,n,i){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new ye(t.getMap().invert(),t,this.selection)}}}class Ae{constructor(e,t,n,i,s){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=i,this.prevComposition=s}}const Of=20;function Af(r,e,t,n){let i=t.getMeta(Ze),s;if(i)return i.historyState;t.getMeta(Df)&&(r=new Ae(r.done,r.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return r;if(o&&o.getMeta(Ze))return o.getMeta(Ze).redo?new Ae(r.done.addTransform(t,void 0,n,Yt(e)),r.undone,Vi(t.mapping.maps),r.prevTime,r.prevComposition):new Ae(r.done,r.undone.addTransform(t,void 0,n,Yt(e)),null,r.prevTime,r.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=r.prevTime==0||!o&&r.prevComposition!=l&&(r.prevTime<(t.time||0)-n.newGroupDelay||!Nf(t,r.prevRanges)),c=o?Jn(r.prevRanges,t.mapping):Vi(t.mapping.maps);return new Ae(r.done.addTransform(t,a?e.selection.getBookmark():void 0,n,Yt(e)),pe.empty,c,t.time,l??r.prevComposition)}else return(s=t.getMeta("rebased"))?new Ae(r.done.rebased(t,s),r.undone.rebased(t,s),Jn(r.prevRanges,t.mapping),r.prevTime,r.prevComposition):new Ae(r.done.addMaps(t.mapping.maps),r.undone.addMaps(t.mapping.maps),Jn(r.prevRanges,t.mapping),r.prevTime,r.prevComposition)}function Nf(r,e){if(!e)return!1;if(!r.docChanged)return!0;let t=!1;return r.mapping.maps[0].forEach((n,i)=>{for(let s=0;s=e[s]&&(t=!0)}),t}function Vi(r){let e=[];for(let t=r.length-1;t>=0&&e.length==0;t--)r[t].forEach((n,i,s,o)=>e.push(s,o));return e}function Jn(r,e){if(!r)return null;let t=[];for(let n=0;n{let i=Ze.getState(t);if(!i||(r?i.undone:i.done).eventCount==0)return!1;if(n){let s=Ef(i,t,r);s&&n(e?s.scrollIntoView():s)}return!0}}const wo=Mo(!1,!0),Co=Mo(!0,!0),Rf=se.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:r,dispatch:e})=>wo(r,e),redo:()=>({state:r,dispatch:e})=>Co(r,e)}},addProseMirrorPlugins(){return[If(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Pf=X.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:r}){return["hr",$(this.options.HTMLAttributes,r)]},addCommands(){return{setHorizontalRule:()=>({chain:r,state:e})=>{const{selection:t}=e,{$from:n,$to:i}=t,s=r();return n.parentOffset===0?s.insertContentAt({from:Math.max(n.pos-1,0),to:i.pos},{type:this.name}):mu(t)?s.insertContentAt(i.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:o,dispatch:l})=>{var a;if(l){const{$to:c}=o.selection,d=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?o.setSelection(C.create(o.doc,c.pos+1)):c.nodeAfter.isBlock?o.setSelection(M.create(o.doc,c.pos)):o.setSelection(C.create(o.doc,c.pos));else{const u=(a=c.parent.type.contentMatch.defaultType)===null||a===void 0?void 0:a.create();u&&(o.insert(d,u),o.setSelection(C.create(o.doc,d+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Wu({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Bf=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Lf=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,zf=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Ff=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Vf=Me.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:r=>r.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:r}){return["em",$(this.options.HTMLAttributes,r),0]},addCommands(){return{setItalic:()=>({commands:r})=>r.setMark(this.name),toggleItalic:()=>({commands:r})=>r.toggleMark(this.name),unsetItalic:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[yt({find:Bf,type:this.type}),yt({find:zf,type:this.type})]},addPasteRules(){return[bt({find:Lf,type:this.type}),bt({find:Ff,type:this.type})]}}),$f=X.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:r}){return["li",$(this.options.HTMLAttributes,r),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),_f=X.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:r}){return["li",$(this.options.HTMLAttributes,r),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),_i=Me.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:r=>r.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:r}){return["span",$(this.options.HTMLAttributes,r),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:r,commands:e})=>{const t=vn(r,this.type);return Object.entries(t).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),Hi=/^(\d+)\.\s$/,Hf=X.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:r=>r.hasAttribute("start")?parseInt(r.getAttribute("start")||"",10):1}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:r}){const{start:e,...t}=r;return e===1?["ol",$(this.options.HTMLAttributes,t),0]:["ol",$(this.options.HTMLAttributes,r),0]},addCommands(){return{toggleOrderedList:()=>({commands:r,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(_f.name,this.editor.getAttributes(_i.name)).run():r.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let r=Bt({find:Hi,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(r=Bt({find:Hi,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(_i.name)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[r]}}),jf=X.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:r}){return["p",$(this.options.HTMLAttributes,r),0]},addCommands(){return{setParagraph:()=>({commands:r})=>r.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Wf=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Jf=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,qf=Me.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:r=>r.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:r}){return["s",$(this.options.HTMLAttributes,r),0]},addCommands(){return{setStrike:()=>({commands:r})=>r.setMark(this.name),toggleStrike:()=>({commands:r})=>r.toggleMark(this.name),unsetStrike:()=>({commands:r})=>r.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[yt({find:Wf,type:this.type})]},addPasteRules(){return[bt({find:Jf,type:this.type})]}}),Kf=X.create({name:"text",group:"inline"}),Uf=se.create({name:"starterKit",addExtensions(){var r,e,t,n,i,s,o,l,a,c,d,u,f,p,h,m,g,y;const x=[];return this.options.bold!==!1&&x.push(ef.configure((r=this.options)===null||r===void 0?void 0:r.bold)),this.options.blockquote!==!1&&x.push(Gu.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&x.push(nf.configure((t=this.options)===null||t===void 0?void 0:t.bulletList)),this.options.code!==!1&&x.push(of.configure((n=this.options)===null||n===void 0?void 0:n.code)),this.options.codeBlock!==!1&&x.push(cf.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&x.push(df.configure((s=this.options)===null||s===void 0?void 0:s.document)),this.options.dropcursor!==!1&&x.push(hf.configure((o=this.options)===null||o===void 0?void 0:o.dropcursor)),this.options.gapcursor!==!1&&x.push(Sf.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&x.push(Mf.configure((a=this.options)===null||a===void 0?void 0:a.hardBreak)),this.options.heading!==!1&&x.push(wf.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&x.push(Rf.configure((d=this.options)===null||d===void 0?void 0:d.history)),this.options.horizontalRule!==!1&&x.push(Pf.configure((u=this.options)===null||u===void 0?void 0:u.horizontalRule)),this.options.italic!==!1&&x.push(Vf.configure((f=this.options)===null||f===void 0?void 0:f.italic)),this.options.listItem!==!1&&x.push($f.configure((p=this.options)===null||p===void 0?void 0:p.listItem)),this.options.orderedList!==!1&&x.push(Hf.configure((h=this.options)===null||h===void 0?void 0:h.orderedList)),this.options.paragraph!==!1&&x.push(jf.configure((m=this.options)===null||m===void 0?void 0:m.paragraph)),this.options.strike!==!1&&x.push(qf.configure((g=this.options)===null||g===void 0?void 0:g.strike)),this.options.text!==!1&&x.push(Kf.configure((y=this.options)===null||y===void 0?void 0:y.text)),x}}),Gf=se.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:r=>{const e=r.style.textAlign||this.options.defaultAlignment;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:r=>r.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${r.textAlign}`}}}}]},addCommands(){return{setTextAlign:r=>({commands:e})=>this.options.alignments.includes(r)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:r})).every(t=>t):!1,unsetTextAlign:()=>({commands:r})=>this.options.types.map(e=>r.resetAttributes(e,"textAlign")).every(e=>e)}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),Yf={},Xf={viewBox:"0 0 24 24"},Zf=w("path",{d:"M17.194 10.962A6.271 6.271 0 0012.844.248H4.3a1.25 1.25 0 000 2.5h1.013a.25.25 0 01.25.25V21a.25.25 0 01-.25.25H4.3a1.25 1.25 0 100 2.5h9.963a6.742 6.742 0 002.93-12.786zm-4.35-8.214a3.762 3.762 0 010 7.523H8.313a.25.25 0 01-.25-.25V3a.25.25 0 01.25-.25zm1.42 18.5H8.313a.25.25 0 01-.25-.25v-7.977a.25.25 0 01.25-.25h5.951a4.239 4.239 0 010 8.477z"},null,-1),Qf=[Zf];function eh(r,e){return Q(),ie("svg",Xf,Qf)}const th=le(Yf,[["render",eh]]),nh={},rh={viewBox:"0 0 24 24"},ih=w("path",{d:"M9.147 21.552a1.244 1.244 0 01-.895-.378L.84 13.561a2.257 2.257 0 010-3.125l7.412-7.613a1.25 1.25 0 011.791 1.744l-6.9 7.083a.5.5 0 000 .7l6.9 7.082a1.25 1.25 0 01-.9 2.122zm5.707 0a1.25 1.25 0 01-.9-2.122l6.9-7.083a.5.5 0 000-.7l-6.9-7.082a1.25 1.25 0 011.791-1.744l7.411 7.612a2.257 2.257 0 010 3.125l-7.412 7.614a1.244 1.244 0 01-.89.38zm6.514-9.373z"},null,-1),sh=[ih];function oh(r,e){return Q(),ie("svg",rh,sh)}const lh=le(nh,[["render",oh]]),ah={},ch={viewBox:"0 0 24 24"},dh=w("path",{d:"M22.5.248h-7.637a1.25 1.25 0 000 2.5h1.086a.25.25 0 01.211.384L4.78 21.017a.5.5 0 01-.422.231H1.5a1.25 1.25 0 000 2.5h7.637a1.25 1.25 0 000-2.5H8.051a.25.25 0 01-.211-.384L19.22 2.98a.5.5 0 01.422-.232H22.5a1.25 1.25 0 000-2.5z"},null,-1),uh=[dh];function fh(r,e){return Q(),ie("svg",ch,uh)}const hh=le(ah,[["render",fh]]),ph={},mh={viewBox:"0 0 24 24"},gh=w("path",{d:"M7.75 4.5h15a1 1 0 000-2h-15a1 1 0 000 2zm15 6.5h-15a1 1 0 100 2h15a1 1 0 000-2zm0 8.5h-15a1 1 0 000 2h15a1 1 0 000-2zM2.212 17.248a2 2 0 00-1.933 1.484.75.75 0 101.45.386.5.5 0 11.483.63.75.75 0 100 1.5.5.5 0 11-.482.635.75.75 0 10-1.445.4 2 2 0 103.589-1.648.251.251 0 010-.278 2 2 0 00-1.662-3.111zm2.038-6.5a2 2 0 00-4 0 .75.75 0 001.5 0 .5.5 0 011 0 1.031 1.031 0 01-.227.645L.414 14.029A.75.75 0 001 15.248h2.5a.75.75 0 000-1.5h-.419a.249.249 0 01-.195-.406L3.7 12.33a2.544 2.544 0 00.55-1.582zM4 5.248h-.25A.25.25 0 013.5 5V1.623A1.377 1.377 0 002.125.248H1.5a.75.75 0 000 1.5h.25A.25.25 0 012 2v3a.25.25 0 01-.25.25H1.5a.75.75 0 000 1.5H4a.75.75 0 000-1.5z"},null,-1),yh=[gh];function bh(r,e){return Q(),ie("svg",mh,yh)}const kh=le(ph,[["render",bh]]),xh={},Sh={viewBox:"0 0 24 24"},Mh=zo('',6),wh=[Mh];function Ch(r,e){return Q(),ie("svg",Sh,wh)}const Th=le(xh,[["render",Ch]]),vh={},Oh={viewBox:"0 0 24 24"},Ah=w("path",{d:"M22.5.248H7.228a6.977 6.977 0 100 13.954h2.318a.25.25 0 01.25.25V22.5a1.25 1.25 0 002.5 0V3a.25.25 0 01.25-.25h3.682a.25.25 0 01.25.25v19.5a1.25 1.25 0 002.5 0V3a.249.249 0 01.25-.25H22.5a1.25 1.25 0 000-2.5zM9.8 11.452a.25.25 0 01-.25.25H7.228a4.477 4.477 0 110-8.954h2.318A.25.25 0 019.8 3z"},null,-1),Nh=[Ah];function Eh(r,e){return Q(),ie("svg",Oh,Nh)}const Dh=le(vh,[["render",Eh]]),Ih={},Rh={viewBox:"0 0 24 24"},Ph=w("path",{d:"M18.559 3.932a4.942 4.942 0 100 9.883 4.609 4.609 0 001.115-.141.25.25 0 01.276.368 6.83 6.83 0 01-5.878 3.523 1.25 1.25 0 000 2.5 9.71 9.71 0 009.428-9.95V8.873a4.947 4.947 0 00-4.941-4.941zm-12.323 0a4.942 4.942 0 000 9.883 4.6 4.6 0 001.115-.141.25.25 0 01.277.368 6.83 6.83 0 01-5.878 3.523 1.25 1.25 0 000 2.5 9.711 9.711 0 009.428-9.95V8.873a4.947 4.947 0 00-4.942-4.941z"},null,-1),Bh=[Ph];function Lh(r,e){return Q(),ie("svg",Rh,Bh)}const zh=le(Ih,[["render",Lh]]),Fh={},Vh={viewBox:"0 0 24 24"},$h=w("path",{d:"M23.75 12.952A1.25 1.25 0 0022.5 11.7h-8.936a.492.492 0 01-.282-.09c-.722-.513-1.482-.981-2.218-1.432-2.8-1.715-4.5-2.9-4.5-4.863 0-2.235 2.207-2.569 3.523-2.569a4.54 4.54 0 013.081.764 2.662 2.662 0 01.447 1.99v.3a1.25 1.25 0 102.5 0v-.268a4.887 4.887 0 00-1.165-3.777C13.949.741 12.359.248 10.091.248c-3.658 0-6.023 1.989-6.023 5.069 0 2.773 1.892 4.512 4 5.927a.25.25 0 01-.139.458H1.5a1.25 1.25 0 000 2.5h10.977a.251.251 0 01.159.058 4.339 4.339 0 011.932 3.466c0 3.268-3.426 3.522-4.477 3.522-1.814 0-3.139-.405-3.834-1.173a3.394 3.394 0 01-.65-2.7 1.25 1.25 0 00-2.488-.246A5.76 5.76 0 004.4 21.753c1.2 1.324 3.114 2 5.688 2 4.174 0 6.977-2.42 6.977-6.022a6.059 6.059 0 00-.849-3.147.25.25 0 01.216-.377H22.5a1.25 1.25 0 001.25-1.255z"},null,-1),_h=[$h];function Hh(r,e){return Q(),ie("svg",Vh,_h)}const jh=le(Fh,[["render",Hh]]),Wh={},Jh={viewBox:"0 0 24 24"},qh=w("path",{d:"M17.786 3.77a12.542 12.542 0 00-12.965-.865.249.249 0 01-.292-.045L1.937.269A.507.507 0 001.392.16a.5.5 0 00-.308.462v6.7a.5.5 0 00.5.5h6.7a.5.5 0 00.354-.854L6.783 5.115a.253.253 0 01-.068-.228.249.249 0 01.152-.181 10 10 0 019.466 1.1 9.759 9.759 0 01.094 15.809 1.25 1.25 0 001.473 2.016 12.122 12.122 0 005.013-9.961 12.125 12.125 0 00-5.127-9.9z"},null,-1),Kh=[qh];function Uh(r,e){return Q(),ie("svg",Jh,Kh)}const Gh=le(Wh,[["render",Uh]]),Yh={},Xh={viewBox:"0 0 24 24"},Zh=w("path",{d:"M22.608.161a.5.5 0 00-.545.108L19.472 2.86a.25.25 0 01-.292.045 12.537 12.537 0 00-12.966.865A12.259 12.259 0 006.1 23.632a1.25 1.25 0 001.476-2.018 9.759 9.759 0 01.091-15.809 10 10 0 019.466-1.1.25.25 0 01.084.409l-1.85 1.85a.5.5 0 00.354.853h6.7a.5.5 0 00.5-.5V.623a.5.5 0 00-.313-.462z"},null,-1),Qh=[Zh];function ep(r,e){return Q(),ie("svg",Xh,Qh)}const tp=le(Yh,[["render",ep]]),np={},rp={viewBox:"0 0 24 24"},ip=w("path",{d:"M9.147 21.552a1.244 1.244 0 01-.895-.378L.84 13.561a2.257 2.257 0 010-3.125l7.412-7.613a1.25 1.25 0 011.791 1.744l-6.9 7.083a.5.5 0 000 .7l6.9 7.082a1.25 1.25 0 01-.9 2.122zm5.707 0a1.25 1.25 0 01-.9-2.122l6.9-7.083a.5.5 0 000-.7l-6.9-7.082a1.25 1.25 0 011.791-1.744l7.411 7.612a2.257 2.257 0 010 3.125l-7.412 7.614a1.244 1.244 0 01-.89.38zm6.514-9.373z"},null,-1),sp=[ip];function op(r,e){return Q(),ie("svg",rp,sp)}const lp=le(np,[["render",op]]),ap={},cp={viewBox:"0 0 24 24"},dp=w("path",{fill:"currentColor","fill-rule":"evenodd",d:"M3.75 5.25h16.5a.75.75 0 1 1 0 1.5H3.75a.75.75 0 0 1 0-1.5zm4 4h8.5a.75.75 0 1 1 0 1.5h-8.5a.75.75 0 1 1 0-1.5zm-4 4h16.5a.75.75 0 1 1 0 1.5H3.75a.75.75 0 1 1 0-1.5zm4 4h8.5a.75.75 0 1 1 0 1.5h-8.5a.75.75 0 1 1 0-1.5z"},null,-1),up=[dp];function fp(r,e){return Q(),ie("svg",cp,up)}const hp=le(ap,[["render",fp]]),pp={components:{EditorContent:qu,BoldIcon:th,CodingIcon:lh,ItalicIcon:hh,ListIcon:kh,ListUlIcon:Th,ParagraphIcon:Dh,QuoteIcon:zh,StrikethroughIcon:jh,UndoIcon:Gh,RedoIcon:tp,CodeBlockIcon:lp,DotsVerticalIcon:Fo,MenuCenterIcon:hp,MenuAlt2Icon:Vo,MenuAlt3Icon:$o,MenuIcon:_o},props:{modelValue:{type:String,default:""},contentLoading:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(r,{emit:e}){const t=Ku({content:r.modelValue,extensions:[Uf,Gf.configure({types:["heading","paragraph"],alignments:["left","right","center","justify"]})],onUpdate:()=>{e("update:modelValue",t.value.getHTML())}});return Ho(()=>r.modelValue,n=>{t.value.getHTML()!==n&&t.value.commands.setContent(r.modelValue,!1)}),jo(()=>{setTimeout(()=>{t.value.destroy()},500)}),{editor:t}}},mp={key:1,class:"box-border w-full text-sm leading-8 text-left bg-white border border-gray-200 rounded-md min-h-[200px] overflow-hidden"},gp={key:0,class:"editor-content"},yp={class:"flex justify-end p-2 border-b border-gray-200 md:hidden"},bp={class:"flex items-center justify-center w-6 h-6 ml-2 text-sm text-black bg-white rounded-sm md:h-9 md:w-9"},kp={class:"flex flex-wrap space-x-1"},xp={class:"hidden p-2 border-b border-gray-200 md:flex"},Sp={class:"flex flex-wrap space-x-1"};function Mp(r,e,t,n,i,s){const o=z("BaseContentPlaceholdersBox"),l=z("BaseContentPlaceholders"),a=z("dots-vertical-icon"),c=z("bold-icon"),d=z("italic-icon"),u=z("strikethrough-icon"),f=z("coding-icon"),p=z("paragraph-icon"),h=z("list-ul-icon"),m=z("list-icon"),g=z("quote-icon"),y=z("code-block-icon"),x=z("undo-icon"),v=z("redo-icon"),P=z("BaseDropdown"),B=z("menu-alt2-icon"),D=z("menu-alt3-icon"),_=z("menu-icon"),ae=z("menu-center-icon"),N=z("editor-content");return t.contentLoading?(Q(),Wo(l,{key:0},{default:On(()=>[I(o,{rounded:!0,class:"w-full",style:{height:"200px"}})]),_:1})):(Q(),ie("div",mp,[n.editor?(Q(),ie("div",gp,[w("div",yp,[I(P,{"width-class":"w-48"},{activator:On(()=>[w("div",bp,[I(a,{class:"w-6 h-6 text-gray-600"})])]),default:On(()=>[w("div",kp,[w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("bold")}]),onClick:e[0]||(e[0]=O=>n.editor.chain().focus().toggleBold().run())},[I(c,{class:"h-3 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("italic")}]),onClick:e[1]||(e[1]=O=>n.editor.chain().focus().toggleItalic().run())},[I(d,{class:"h-3 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("strike")}]),onClick:e[2]||(e[2]=O=>n.editor.chain().focus().toggleStrike().run())},[I(u,{class:"h-3 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("code")}]),onClick:e[3]||(e[3]=O=>n.editor.chain().focus().toggleCode().run())},[I(f,{class:"h-3 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("paragraph")}]),onClick:e[4]||(e[4]=O=>n.editor.chain().focus().setParagraph().run())},[I(p,{class:"h-3 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("heading",{level:1})}]),onClick:e[5]||(e[5]=O=>n.editor.chain().focus().toggleHeading({level:1}).run())}," H1 ",2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("heading",{level:2})}]),onClick:e[6]||(e[6]=O=>n.editor.chain().focus().toggleHeading({level:2}).run())}," H2 ",2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("heading",{level:3})}]),onClick:e[7]||(e[7]=O=>n.editor.chain().focus().toggleHeading({level:3}).run())}," H3 ",2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("bulletList")}]),onClick:e[8]||(e[8]=O=>n.editor.chain().focus().toggleBulletList().run())},[I(h,{class:"h-3 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("orderedList")}]),onClick:e[9]||(e[9]=O=>n.editor.chain().focus().toggleOrderedList().run())},[I(m,{class:"h-3 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("blockquote")}]),onClick:e[10]||(e[10]=O=>n.editor.chain().focus().toggleBlockquote().run())},[I(g,{class:"h-3 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("codeBlock")}]),onClick:e[11]||(e[11]=O=>n.editor.chain().focus().toggleCodeBlock().run())},[I(y,{class:"h-3 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("undo")}]),onClick:e[12]||(e[12]=O=>n.editor.chain().focus().undo().run())},[I(x,{class:"h-3 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("redo")}]),onClick:e[13]||(e[13]=O=>n.editor.chain().focus().redo().run())},[I(v,{class:"h-3 cursor-pointer fill-current"})],2)])]),_:1})]),w("div",xp,[w("div",Sp,[w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("bold")}]),onClick:e[14]||(e[14]=O=>n.editor.chain().focus().toggleBold().run())},[I(c,{class:"h-3 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("italic")}]),onClick:e[15]||(e[15]=O=>n.editor.chain().focus().toggleItalic().run())},[I(d,{class:"h-3 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("strike")}]),onClick:e[16]||(e[16]=O=>n.editor.chain().focus().toggleStrike().run())},[I(u,{class:"h-3 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("code")}]),onClick:e[17]||(e[17]=O=>n.editor.chain().focus().toggleCode().run())},[I(f,{class:"h-3 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("paragraph")}]),onClick:e[18]||(e[18]=O=>n.editor.chain().focus().setParagraph().run())},[I(p,{class:"h-3 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("heading",{level:1})}]),onClick:e[19]||(e[19]=O=>n.editor.chain().focus().toggleHeading({level:1}).run())}," H1 ",2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("heading",{level:2})}]),onClick:e[20]||(e[20]=O=>n.editor.chain().focus().toggleHeading({level:2}).run())}," H2 ",2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("heading",{level:3})}]),onClick:e[21]||(e[21]=O=>n.editor.chain().focus().toggleHeading({level:3}).run())}," H3 ",2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("bulletList")}]),onClick:e[22]||(e[22]=O=>n.editor.chain().focus().toggleBulletList().run())},[I(h,{class:"h-3 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("orderedList")}]),onClick:e[23]||(e[23]=O=>n.editor.chain().focus().toggleOrderedList().run())},[I(m,{class:"h-3 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("blockquote")}]),onClick:e[24]||(e[24]=O=>n.editor.chain().focus().toggleBlockquote().run())},[I(g,{class:"h-3 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("codeBlock")}]),onClick:e[25]||(e[25]=O=>n.editor.chain().focus().toggleCodeBlock().run())},[I(y,{class:"h-3 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("undo")}]),onClick:e[26]||(e[26]=O=>n.editor.chain().focus().undo().run())},[I(x,{class:"h-3 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive("redo")}]),onClick:e[27]||(e[27]=O=>n.editor.chain().focus().redo().run())},[I(v,{class:"h-3 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive({textAlign:"left"})}]),onClick:e[28]||(e[28]=O=>n.editor.chain().focus().setTextAlign("left").run())},[I(B,{class:"h-5 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive({textAlign:"right"})}]),onClick:e[29]||(e[29]=O=>n.editor.chain().focus().setTextAlign("right").run())},[I(D,{class:"h-5 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive({textAlign:"justify"})}]),onClick:e[30]||(e[30]=O=>n.editor.chain().focus().setTextAlign("justify").run())},[I(_,{class:"h-5 cursor-pointer fill-current"})],2),w("span",{class:E(["flex items-center justify-center w-6 h-6 rounded-sm cursor-pointer hover:bg-gray-100",{"bg-gray-200":n.editor.isActive({textAlign:"center"})}]),onClick:e[31]||(e[31]=O=>n.editor.chain().focus().setTextAlign("center").run())},[I(ae,{class:"h-5 cursor-pointer fill-current"})],2)])]),I(N,{editor:n.editor,class:"box-border relative w-full text-sm leading-8 text-left editor__content"},null,8,["editor"])])):Jo("",!0)]))}const Tp=le(pp,[["render",Mp]]);export{Tp as default};