1||0==a||e.content.size)&&(d=t,h.push(B(e.mark(u.allowedMarks(e.marks)),1==c?a:0,c==l.childCount?p:-1)))}let f=c==l.childCount;f||(p=-1),this.placed=_(this.placed,t,r.c.from(h)),this.frontier[t].match=d,f&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let r=0,m=l;r1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t=0;n--){let{match:t,type:r}=this.frontier[n],i=V(e,n,r,t,!0);if(!i||i.childCount)continue e}return{depth:t,fit:o,move:i?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=_(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=_(this.placed,this.depth,r.c.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(r.c.empty,!0);e.childCount&&(this.placed=_(this.placed,this.frontier.length,e))}}function P(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(P(e.firstChild.content,t-1,n)))}function _(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(_(e.lastChild.content,t-1,n)))}function j(e,t){for(let n=0;n1&&(i=i.replaceChild(0,B(i.firstChild,t-1,1==i.childCount?n-1:0))),t>0&&(i=e.type.contentMatch.fillBefore(i).append(i),n<=0&&(i=i.append(e.type.contentMatch.matchFragment(i).fillBefore(r.c.empty,!0)))),e.copy(i)}function V(e,t,n,r,i){let o=e.node(t),s=i?e.indexAfter(t):e.index(t);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!function(e,t,n){for(let r=n;ri){let t=o.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(r.c.empty,!0))}return e}function q(e,t){let n=[];for(let r=Math.min(e.depth,t.depth);r>=0;r--){let i=e.start(r);if(it.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(i==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==i-1)&&n.push(r)}return n}let J=class extends Error{};(J=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n}).prototype=Object.create(Error.prototype),J.prototype.constructor=J,J.prototype.name="TransformError";class W{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new f}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new J(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=r.j.empty){let i=I(this.doc,e,t,n);return i&&this.step(i),this}replaceWith(e,t,n){return this.replace(e,t,new r.j(r.c.from(n),0,0))}delete(e,t){return this.replace(e,t,r.j.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return function(e,t,n,i){if(!i.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),s=e.doc.resolve(n);if($(o,s,i))return e.step(new x(t,n,i));let l=q(o,e.doc.resolve(n));0==l[l.length-1]&&l.pop();let a=-(o.depth+1);l.unshift(a);for(let r=o.depth,p=o.pos-1;r>0;r--,p--){let e=o.node(r).type.spec;if(e.defining||e.definingAsContext||e.isolating)break;l.indexOf(r)>-1?a=r:o.before(r)==p&&l.splice(1,0,-r)}let c=l.indexOf(a),h=[],d=i.openStart;for(let r=i.content,p=0;;p++){let e=r.firstChild;if(h.push(e),p==i.openStart)break;r=e.content}for(let r=d-1;r>=0;r--){let e=h[r].type,t=L(e);if(t&&o.node(c).type!=e)d=r;else if(t||!e.isTextblock)break}for(let p=i.openStart;p>=0;p--){let t=(p+d+1)%(i.openStart+1),a=h[t];if(a)for(let h=0;h=0&&(e.replace(t,n,i),!(e.steps.length>u));r--){let e=l[r];e<0||(t=o.before(e),n=s.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return function(e,t,n,i){if(!i.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let r=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let i=r.depth-1;i>=0;i--){let e=r.index(i);if(r.node(i).canReplaceWith(e,e,n))return r.before(i+1);if(e>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let e=r.indexAfter(i);if(r.node(i).canReplaceWith(e,e,n))return r.after(i+1);if(e0&&(n||r.node(t-1).canReplace(r.index(t-1),i.indexAfter(t-1))))return e.delete(r.before(t),i.after(t))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(t-r.start(s)==r.depth-s&&n>r.end(s)&&i.end(s)-n!=i.depth-s)return e.delete(r.before(s),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return function(e,t,n){let{$from:i,$to:o,depth:s}=t,l=i.before(s+1),a=o.after(s+1),c=l,h=a,d=r.c.empty,u=0;for(let m=s,g=!1;m>n;m--)g||i.index(m)>0?(g=!0,d=r.c.from(i.node(m).copy(d)),u++):c--;let p=r.c.empty,f=0;for(let m=s,g=!1;m>n;m--)g||o.after(m+1)=0;l--){if(i.size){let e=n[l].type.contentMatch.matchFragment(i);if(!e||!e.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=r.c.from(n[l].type.create(n[l].attrs,i))}let o=t.start,s=t.end;e.step(new k(o,s,o,s,new r.j(i,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,i=null){return function(e,t,n,i,o){if(!i.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{if(t.isTextblock&&!t.hasMarkup(i,o)&&function(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}(e.doc,e.mapping.slice(s).map(n),i)){e.clearIncompatible(e.mapping.slice(s).map(n,1),i);let l=e.mapping.slice(s),a=l.map(n,1),c=l.map(n+t.nodeSize,1);return e.step(new k(a,c,a+1,c-1,new r.j(r.c.from(i.create(o,null,t.marks)),0,0),1,!0)),!1}})}(this,e,t,n,i),this}setNodeMarkup(e,t,n=null,i=[]){return function(e,t,n,i,o){let s=e.doc.nodeAt(t);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let l=n.create(i,null,o||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,l);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new k(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new r.j(r.c.from(l),0,0),1,!0))}(this,e,t,n,i),this}split(e,t=1,n){return function(e,t,n=1,i){let o=e.doc.resolve(t),s=r.c.empty,l=r.c.empty;for(let a=o.depth,c=o.depth-n,h=n-1;a>c;a--,h--){s=r.c.from(o.node(a).copy(s));let e=i&&i[h];l=r.c.from(e?e.type.create(e.attrs,l):o.node(a).copy(l))}e.step(new x(t,t,new r.j(s.append(l),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){return function(e,t,n,r){let i,o,s=[],l=[];e.doc.nodesBetween(t,n,(e,a,c)=>{if(!e.isInline)return;let h=e.marks;if(!r.isInSet(h)&&c.type.allowsMarkType(r.type)){let c=Math.max(a,t),d=Math.min(a+e.nodeSize,n),u=r.addToSet(h);for(let e=0;ee.step(t)),l.forEach(t=>e.step(t))}(this,e,t,n),this}removeMark(e,t,n){return function(e,t,n,i){let o=[],s=0;e.doc.nodesBetween(t,n,(e,l)=>{if(!e.isInline)return;s++;let a=null;if(i instanceof r.e){let t,n=e.marks;for(;t=i.isInSet(n);)(a||(a=[])).push(t),n=t.removeFromSet(n)}else i?i.isInSet(e.marks)&&(a=[i]):a=e.marks;if(a&&a.length){let r=Math.min(l+e.nodeSize,n);for(let e=0;ee.step(new w(t.from,t.to,t.style)))}(this,e,t,n),this}clearIncompatible(e,t,n){return function(e,t,n,i=n.contentMatch){let o=e.doc.nodeAt(t),s=[],l=t+1;for(let a=0;a=0;r--)e.step(s[r])}(this,e,t,n),this}}},vbtb:function(e,t){function n(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,xhtml:!1}}e.exports={defaults:{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,xhtml:!1},getDefaults:n,changeDefaults:function(t){e.exports.defaults=t}}},zUJn:function(e,t,n){"use strict";n.d(t,"g",function(){return r.d}),n.d(t,"h",function(){return r.e}),n.d(t,"a",function(){return R}),n.d(t,"b",function(){return I}),n.d(t,"c",function(){return z}),n.d(t,"d",function(){return S}),n.d(t,"e",function(){return O}),n.d(t,"f",function(){return N});var r=n("b/sn"),i=n("cD+i"),o=n("MEpN"),s=n("uSMm");class l{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width||1,this.color=t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){null!=this.cursorPos&&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,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t=this.editorView.state.doc.resolve(this.cursorPos);if(!t.parent.inlineContent){let n=t.nodeBefore,r=t.nodeAfter;if(n||r){let t=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0)).getBoundingClientRect(),i=n?t.bottom:t.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),e={left:t.left,right:t.right,top:i-this.width/2,bottom:i+this.width/2}}}if(!e){let t=this.editorView.coordsAtPos(this.cursorPos);e={left:t.left-this.width/2,right:t.left+this.width/2,top:t.top,bottom:t.bottom}}let n,r,i=this.editorView.dom.offsetParent;if(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; background-color: "+this.color),!i||i==document.body&&"static"==getComputedStyle(i).position)n=-pageXOffset,r=-pageYOffset;else{let e=i.getBoundingClientRect();n=e.left-i.scrollLeft,r=e.top-i.scrollTop}this.element.style.left=e.left-n+"px",this.element.style.top=e.top-r+"px",this.element.style.width=e.right-e.left+"px",this.element.style.height=e.bottom-e.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),r=n&&n.type.spec.disableDropCursor,i="function"==typeof r?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice&&null==(e=Object(s.h)(this.editorView.state.doc,e,this.editorView.dragging.slice)))return this.setCursor(null);this.setCursor(e),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)}}var a=n("49oK");class c extends r.f{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return c.valid(n)?new c(n):r.f.near(n)}content(){return o.j.empty}eq(e){return e instanceof c&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new c(e.resolve(t.pos))}getBookmark(){return new h(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0!=n)for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||e.isAtom||e.type.spec.isolating)return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n!=r.childCount)for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||e.isAtom||e.type.spec.isolating)return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&c.valid(e))return e;let i=e.pos,o=null;for(let n=e.depth;;n--){let r=e.node(n);if(t>0?e.indexAfter(n)0){o=r.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;i+=t;let s=e.doc.resolve(i);if(c.valid(s))return s}for(;;){let s=t>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!r.c.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*t),n=!1;continue e}break}o=s,i+=t;let l=e.doc.resolve(i);if(c.valid(l))return l}return null}}}c.prototype.visible=!1,c.findFrom=c.findGapCursorFrom,r.f.jsonID("gapcursor",c);class h{constructor(e){this.pos=e}map(e){return new h(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return c.valid(t)?new c(t):r.f.near(t)}}const d=Object(a.a)({ArrowLeft:u("horiz",-1),ArrowRight:u("horiz",1),ArrowUp:u("vert",-1),ArrowDown:u("vert",1)});function u(e,t){const n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,i,o){let s=e.selection,l=t>0?s.$to:s.$from,a=s.empty;if(s instanceof r.h){if(!o.endOfTextblock(n)||0==l.depth)return!1;a=!1,l=e.doc.resolve(t>0?l.after():l.before())}let h=c.findGapCursorFrom(l,t,a);return!!h&&(i&&i(e.tr.setSelection(new c(h))),!0)}}function p(e,t,n){if(!e||!e.editable)return!1;let i=e.state.doc.resolve(t);if(!c.valid(i))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return!(o&&o.inside>-1&&r.c.isSelectable(e.state.doc.nodeAt(o.inside)))&&(e.dispatch(e.state.tr.setSelection(new c(i))),!0)}function f(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof c))return!1;let{$from:n}=e.state.selection,i=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!i)return!1;let s=o.c.empty;for(let r=i.length-1;r>=0;r--)s=o.c.from(i[r].createAndFill(null,s));let l=e.state.tr.replace(n.pos,n.pos,new o.j(s,0,0));return l.setSelection(r.h.near(l.doc.resolve(n.pos+1))),e.dispatch(l),!1}function m(e){if(!(e.selection instanceof c))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",i.b.create(e.doc,[i.a.widget(e.selection.head,t,{key:"gapcursor"})])}var g=n("RCw7"),y=n("cqjR"),v=n("oV9I"),b=n("Kw5r"),w=n("qd4/");class x{constructor(e,{editor:t,extension:n,parent:r,node:i,view:o,decorations:s,getPos:l}){this.component=e,this.editor=t,this.extension=n,this.parent=r,this.node=i,this.view=o,this.decorations=s,this.isNode=!!this.node.marks,this.isMark=!this.isNode,this.getPos=this.isMark?this.getMarkPos:l,this.captureEvents=!0,this.dom=this.createDOM(),this.contentDOM=this.vm.$refs.content}createDOM(){const e=b.default.extend(this.component),t={editor:this.editor,node:this.node,view:this.view,getPos:()=>this.getPos(),decorations:this.decorations,selected:!1,options:this.extension.options,updateAttrs:e=>this.updateAttrs(e)};return"function"==typeof this.extension.setSelection&&(this.setSelection=this.extension.setSelection),"function"==typeof this.extension.update&&(this.update=this.extension.update),this.vm=new e({parent:this.parent,propsData:t}).$mount(),this.vm.$el}update(e,t){return e.type===this.node.type&&(e===this.node&&this.decorations===t||(this.node=e,this.decorations=t,this.updateComponentProps({node:e,decorations:t}),!0))}updateComponentProps(e){if(!this.vm._props)return;const t=b.default.config.silent;b.default.config.silent=!0,Object.entries(e).forEach(([e,t])=>{this.vm._props[e]=t}),b.default.config.silent=t}updateAttrs(e){if(!this.view.editable)return;const{state:t}=this.view,{type:n}=this.node,r=this.getPos(),i={...this.node.attrs,...e},o=this.isMark?t.tr.removeMark(r.from,r.to,n).addMark(r.from,r.to,n.create(i)):t.tr.setNodeMarkup(r,null,i);this.view.dispatch(o)}ignoreMutation(e){return"selection"!==e.type&&(!this.contentDOM||!this.contentDOM.contains(e.target))}stopEvent(e){if("function"==typeof this.extension.stopEvent)return this.extension.stopEvent(e);const t=!!this.extension.schema.draggable;if(t&&"mousedown"===e.type){const t=e.target.closest&&e.target.closest("[data-drag-handle]");t&&(this.dom===t||this.dom.contains(t))&&(this.captureEvents=!1,document.addEventListener("dragend",()=>{this.captureEvents=!0},{once:!0}))}const n="copy"===e.type,r="paste"===e.type,i="cut"===e.type,o=e.type.startsWith("drag")||"drop"===e.type;return!(t&&o||n||r||i)&&this.captureEvents}selectNode(){this.updateComponentProps({selected:!0})}deselectNode(){this.updateComponentProps({selected:!1})}getMarkPos(){const e=this.view.posAtDOM(this.dom),t=this.view.state.doc.resolve(e);return Object(v.e)(t,this.node.type)}destroy(){this.vm.$destroy()}}class k{on(e,t){return this._callbacks=this._callbacks||{},this._callbacks[e]||(this._callbacks[e]=[]),this._callbacks[e].push(t),this}emit(e,...t){this._callbacks=this._callbacks||{};const n=this._callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){if(arguments.length){const n=this._callbacks?this._callbacks[e]:null;n&&(t?this._callbacks[e]=n.filter(e=>e!==t):delete this._callbacks[e])}else this._callbacks={};return this}}class S{constructor(e={}){this.options={...this.defaultOptions,...e}}init(){return null}bindEditor(e=null){this.editor=e}get name(){return null}get type(){return"extension"}get defaultOptions(){return{}}get plugins(){return[]}inputRules(){return[]}pasteRules(){return[]}keys(){return{}}}class C{constructor(e=[],t){e.forEach(e=>{e.bindEditor(t),e.init()}),this.extensions=e}get nodes(){return this.extensions.filter(e=>"node"===e.type).reduce((e,{name:t,schema:n})=>({...e,[t]:n}),{})}get options(){const{view:e}=this;return this.extensions.reduce((t,n)=>({...t,[n.name]:new Proxy(n.options,{set(t,n,r){const i=t[n]!==r;return Object.assign(t,{[n]:r}),i&&e.updateState(e.state),!0}})}),{})}get marks(){return this.extensions.filter(e=>"mark"===e.type).reduce((e,{name:t,schema:n})=>({...e,[t]:n}),{})}get plugins(){return this.extensions.filter(e=>e.plugins).reduce((e,{plugins:t})=>[...e,...t],[])}keymaps({schema:e}){const t=this.extensions.filter(e=>["extension"].includes(e.type)).filter(e=>e.keys).map(t=>t.keys({schema:e})),n=this.extensions.filter(e=>["node","mark"].includes(e.type)).filter(e=>e.keys).map(t=>t.keys({type:e[`${t.type}s`][t.name],schema:e}));return[...t,...n].map(e=>Object(a.b)(e))}inputRules({schema:e,excludedExtensions:t}){if(!(t instanceof Array)&&t)return[];const n=t instanceof Array?this.extensions.filter(e=>!t.includes(e.name)):this.extensions,r=n.filter(e=>["extension"].includes(e.type)).filter(e=>e.inputRules).map(t=>t.inputRules({schema:e})),i=n.filter(e=>["node","mark"].includes(e.type)).filter(e=>e.inputRules).map(t=>t.inputRules({type:e[`${t.type}s`][t.name],schema:e}));return[...r,...i].reduce((e,t)=>[...e,...t],[])}pasteRules({schema:e,excludedExtensions:t}){if(!(t instanceof Array)&&t)return[];const n=t instanceof Array?this.extensions.filter(e=>!t.includes(e.name)):this.extensions,r=n.filter(e=>["extension"].includes(e.type)).filter(e=>e.pasteRules).map(t=>t.pasteRules({schema:e})),i=n.filter(e=>["node","mark"].includes(e.type)).filter(e=>e.pasteRules).map(t=>t.pasteRules({type:e[`${t.type}s`][t.name],schema:e}));return[...r,...i].reduce((e,t)=>[...e,...t],[])}commands({schema:e,view:t}){return this.extensions.filter(e=>e.commands).reduce((n,r)=>{const{name:i,type:o}=r,s={},l=r.commands({schema:e,...["node","mark"].includes(o)?{type:e[`${o}s`][i]}:{}}),a=(e,n)=>!!t.editable&&(t.focus(),e(n)(t.state,t.dispatch,t)),c=(e,t)=>{Array.isArray(t)?s[e]=(e=>t.forEach(t=>a(t,e))):"function"==typeof t&&(s[e]=(e=>a(t,e)))};return"object"==typeof l?Object.entries(l).forEach(([e,t])=>{c(e,t)}):c(i,l),{...n,...s}},{})}}class O extends S{constructor(e={}){super(e)}get type(){return"mark"}get view(){return null}get schema(){return null}command(){return()=>{}}}function M(e=0,t=0,n=0){return Math.min(Math.max(parseInt(e,10),t),n)}class N extends S{constructor(e={}){super(e)}get type(){return"node"}get view(){return null}get schema(){return null}command(){return()=>{}}}class E extends N{get name(){return"doc"}get schema(){return{content:"block+"}}}class A extends N{get name(){return"paragraph"}get schema(){return{content:"inline*",group:"block",draggable:!1,parseDOM:[{tag:"p"}],toDOM:()=>["p",0]}}commands({type:e}){return()=>Object(w.k)(e)}}class D extends N{get name(){return"text"}get schema(){return{group:"inline"}}}var T='.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}\n';class R extends k{constructor(e={}){super(),this.defaultOptions={editorProps:{},editable:!0,autoFocus:null,extensions:[],content:"",topNode:"doc",emptyDocument:{type:"doc",content:[{type:"paragraph"}]},useBuiltInExtensions:!0,disableInputRules:!1,disablePasteRules:!1,dropCursor:{},enableDropCursor:!0,enableGapCursor:!0,parseOptions:{},injectCSS:!0,onInit:()=>{},onTransaction:()=>{},onUpdate:()=>{},onFocus:()=>{},onBlur:()=>{},onPaste:()=>{},onDrop:()=>{}},this.events=["init","transaction","update","focus","blur","paste","drop"],this.init(e)}init(e={}){this.setOptions({...this.defaultOptions,...e}),this.focused=!1,this.selection={from:0,to:0},this.element=document.createElement("div"),this.extensions=this.createExtensions(),this.nodes=this.createNodes(),this.marks=this.createMarks(),this.schema=this.createSchema(),this.plugins=this.createPlugins(),this.keymaps=this.createKeymaps(),this.inputRules=this.createInputRules(),this.pasteRules=this.createPasteRules(),this.view=this.createView(),this.commands=this.createCommands(),this.setActiveNodesAndMarks(),this.options.injectCSS&&function(e){{const t=document.createElement("style");t.type="text/css",t.textContent=e;const{head:n}=document,{firstChild:r}=n;r?n.insertBefore(t,r):n.appendChild(t)}}(T),null!==this.options.autoFocus&&this.focus(this.options.autoFocus),this.events.forEach(e=>{this.on(e,this.options[
/*!
* tiptap v1.32.1
* (c) 2021 überdosis GbR (limited liability)
* @license MIT
*/
function(e){return e.replace(/(?:^\w|[A-Z]|\b\w)/g,(e,t)=>0===t?e.toLowerCase():e.toUpperCase()).replace(/\s+/g,"")}(`on ${e}`)]||(()=>{}))}),this.emit("init",{view:this.view,state:this.state}),this.extensions.view=this.view}setOptions(e){this.options={...this.options,...e},this.view&&this.state&&this.view.updateState(this.state)}get builtInExtensions(){return this.options.useBuiltInExtensions?[new E,new D,new A]:[]}get state(){return this.view?this.view.state:null}createExtensions(){return new C([...this.builtInExtensions,...this.options.extensions],this)}createPlugins(){return this.extensions.plugins}createKeymaps(){return this.extensions.keymaps({schema:this.schema})}createInputRules(){return this.extensions.inputRules({schema:this.schema,excludedExtensions:this.options.disableInputRules})}createPasteRules(){return this.extensions.pasteRules({schema:this.schema,excludedExtensions:this.options.disablePasteRules})}createCommands(){return this.extensions.commands({schema:this.schema,view:this.view})}createNodes(){return this.extensions.nodes}createMarks(){return this.extensions.marks}createSchema(){return new o.i({topNode:this.options.topNode,nodes:this.nodes,marks:this.marks})}createState(){return r.b.create({schema:this.schema,doc:this.createDocument(this.options.content),plugins:[...this.plugins,Object(y.b)({rules:this.inputRules}),...this.pasteRules,...this.keymaps,Object(a.b)({Backspace:y.d}),Object(a.b)(g.a),...this.options.enableDropCursor?[function(e={}){return new r.d({view:t=>new l(t,e)})}(this.options.dropCursor)]:[],...this.options.enableGapCursor?[new r.d({props:{decorations:m,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&c.valid(n)?new c(n):null,handleClick:p,handleKeyDown:d,handleDOMEvents:{beforeinput:f}}})]:[],new r.d({key:new r.e("editable"),props:{editable:()=>this.options.editable}}),new r.d({props:{attributes:{tabindex:0},handleDOMEvents:{focus:(e,t)=>{this.focused=!0,this.emit("focus",{event:t,state:e.state,view:e});const n=this.state.tr.setMeta("focused",!0);this.view.dispatch(n)},blur:(e,t)=>{this.focused=!1,this.emit("blur",{event:t,state:e.state,view:e});const n=this.state.tr.setMeta("focused",!1);this.view.dispatch(n)}}}}),new r.d({props:this.options.editorProps})]})}createDocument(e,t=this.options.parseOptions){if(null===e)return this.schema.nodeFromJSON(this.options.emptyDocument);if("object"==typeof e)try{return this.schema.nodeFromJSON(e)}catch(t){return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",t),this.schema.nodeFromJSON(this.options.emptyDocument)}if("string"==typeof e){const n=`${e}
`,r=(new window.DOMParser).parseFromString(n,"text/html").body.firstElementChild;return o.a.fromSchema(this.schema).parse(r,t)}return!1}createView(){return new i.c(this.element,{state:this.createState(),handlePaste:(...e)=>{this.emit("paste",...e)},handleDrop:(...e)=>{this.emit("drop",...e)},dispatchTransaction:this.dispatchTransaction.bind(this)})}setParentComponent(e=null){e&&this.view.setProps({nodeViews:this.initNodeViews({parent:e,extensions:[...this.builtInExtensions,...this.options.extensions]})})}initNodeViews({parent:e,extensions:t}){return t.filter(e=>["node","mark"].includes(e.type)).filter(e=>e.view).reduce((t,n)=>{return{...t,[n.name]:(t,r,i,o)=>{const s=n.view;return new x(s,{editor:this,extension:n,parent:e,node:t,view:r,getPos:i,decorations:o})}}},{})}dispatchTransaction(e){const t=this.state.apply(e);this.view.updateState(t),this.selection={from:this.state.selection.from,to:this.state.selection.to},this.setActiveNodesAndMarks(),this.emit("transaction",{getHTML:this.getHTML.bind(this),getJSON:this.getJSON.bind(this),state:this.state,transaction:e}),e.docChanged&&!e.getMeta("preventUpdate")&&this.emitUpdate(e)}emitUpdate(e){this.emit("update",{getHTML:this.getHTML.bind(this),getJSON:this.getJSON.bind(this),state:this.state,transaction:e})}resolveSelection(e=null){if(this.selection&&null===e)return this.selection;if("start"===e||!0===e)return{from:0,to:0};if("end"===e){const{doc:e}=this.state;return{from:e.content.size,to:e.content.size}}return{from:e,to:e}}focus(e=null){if(this.view.focused&&null===e||!1===e)return;const{from:t,to:n}=this.resolveSelection(e);this.setSelection(t,n),setTimeout(()=>this.view.focus(),10)}setSelection(e=0,t=0){const{doc:n,tr:i}=this.state,o=M(e,0,n.content.size),s=M(t,0,n.content.size),l=r.h.create(n,o,s),a=i.setSelection(l);this.view.dispatch(a)}blur(){this.view.dom.blur()}getSchemaJSON(){return JSON.parse(JSON.stringify({nodes:this.extensions.nodes,marks:this.extensions.marks}))}getHTML(){const e=document.createElement("div"),t=o.b.fromSchema(this.schema).serializeFragment(this.state.doc.content);return e.appendChild(t),e.innerHTML}getJSON(){return this.state.doc.toJSON()}setContent(e={},t=!1,n){const{doc:i,tr:o}=this.state,s=this.createDocument(e,n),l=r.h.create(i,0,i.content.size),a=o.setSelection(l).replaceSelectionWith(s,!1).setMeta("preventUpdate",!t);this.view.dispatch(a)}clearContent(e=!1){this.setContent(this.options.emptyDocument,e)}setActiveNodesAndMarks(){this.activeMarks=Object.entries(this.schema.marks).reduce((e,[t,n])=>({...e,[t]:(e={})=>Object(v.g)(this.state,n,e)}),{}),this.activeMarkAttrs=Object.entries(this.schema.marks).reduce((e,[t,n])=>({...e,[t]:Object(v.d)(this.state,n)}),{}),this.activeNodes=Object.entries(this.schema.nodes).reduce((e,[t,n])=>({...e,[t]:(e={})=>Object(v.i)(this.state,n,e)}),{})}getMarkAttrs(e=null){return this.activeMarkAttrs[e]}getNodeAttrs(e=null){return{...Object(v.f)(this.state,this.schema.nodes[e])}}get isActive(){return Object.entries({...this.activeMarks,...this.activeNodes}).reduce((e,[t,n])=>({...e,[t]:(e={})=>n(e)}),{})}registerPlugin(e=null,t){const n="function"==typeof t?t(e,this.state.plugins):[e,...this.state.plugins],r=this.state.reconfigure({plugins:n});this.view.updateState(r)}unregisterPlugin(e=null){if(!e||!this.view.docView)return;const t=this.state.reconfigure({plugins:this.state.plugins.filter(t=>!t.key.startsWith(`${e}$`))});this.view.updateState(t)}destroy(){this.view&&this.view.destroy()}}var I={props:{editor:{default:null,type:Object}},watch:{editor:{immediate:!0,handler(e){e&&e.element&&this.$nextTick(()=>{this.$el.appendChild(e.element.firstChild),e.setParentComponent(this)})}}},render:e=>e("div"),beforeDestroy(){this.editor.element=this.$el}};class ${constructor({options:e}){this.options=e,this.preventHide=!1,this.mousedownHandler=this.handleClick.bind(this),this.options.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.blurHandler=(()=>{this.preventHide?this.preventHide=!1:this.options.editor.emit("menubar:focusUpdate",!1)}),this.options.editor.on("blur",this.blurHandler)}handleClick(){this.preventHide=!0}destroy(){this.options.element.removeEventListener("mousedown",this.mousedownHandler),this.options.editor.off("blur",this.blurHandler)}}var z={props:{editor:{default:null,type:Object}},data:()=>({focused:!1}),watch:{editor:{immediate:!0,handler(e){e&&this.$nextTick(()=>{e.registerPlugin(function(e){return new r.d({key:new r.e("menu_bar"),view:t=>new $({editorView:t,options:e})})}({editor:e,element:this.$el})),this.focused=e.focused,e.on("focus",()=>{this.focused=!0}),e.on("menubar:focusUpdate",e=>{this.focused=e})})}}},render(){return this.editor?this.$scopedSlots.default({focused:this.focused,focus:this.editor.focus,commands:this.editor.commands,isActive:this.editor.isActive,getMarkAttrs:this.editor.getMarkAttrs.bind(this.editor),getNodeAttrs:this.editor.getNodeAttrs.bind(this.editor)}):null}};Object,Boolean;Object}}]);
//# sourceMappingURL=chunk-0e2d.04760e2c.js.map